monaco-languageclient-examples 6.4.5 → 6.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/README.md +2 -2
  3. package/dist/browser/main.js +1 -1
  4. package/dist/browser/main.js.map +1 -1
  5. package/dist/common.d.ts.map +1 -1
  6. package/dist/common.js +5 -3
  7. package/dist/common.js.map +1 -1
  8. package/dist/index.d.ts +0 -1
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +0 -1
  11. package/dist/index.js.map +1 -1
  12. package/dist/json/client/main.js +1 -1
  13. package/dist/json/client/main.js.map +1 -1
  14. package/dist/langium/statemachineClient.js +3 -3
  15. package/dist/langium/statemachineClient.js.map +1 -1
  16. package/dist/python/client/main.js +1 -1
  17. package/dist/python/client/main.js.map +1 -1
  18. package/dist/python/server/direct.js +1 -1
  19. package/dist/python/server/direct.js.map +1 -1
  20. package/dist/react/app.js +1 -1
  21. package/dist/react/app.js.map +1 -1
  22. package/dist/worker/statemachineServerWorker.js +1 -1
  23. package/package.json +6 -11
  24. package/src/browser/main.ts +1 -1
  25. package/src/common.ts +5 -3
  26. package/src/index.ts +0 -1
  27. package/src/json/client/main.ts +1 -1
  28. package/src/langium/statemachineClient.ts +3 -3
  29. package/src/python/client/main.ts +1 -1
  30. package/src/python/server/direct.ts +1 -1
  31. package/src/react/app.tsx +1 -1
  32. package/vite.statemachine-worker.ts +1 -1
  33. package/dist/langium/langiumClient.d.ts +0 -4
  34. package/dist/langium/langiumClient.d.ts.map +0 -1
  35. package/dist/langium/langiumClient.js +0 -129
  36. package/dist/langium/langiumClient.js.map +0 -1
  37. package/dist/langium/langiumServerWorker.d.ts +0 -2
  38. package/dist/langium/langiumServerWorker.d.ts.map +0 -1
  39. package/dist/langium/langiumServerWorker.js +0 -18
  40. package/dist/langium/langiumServerWorker.js.map +0 -1
  41. package/dist/worker/langiumServerWorker.js +0 -210
  42. package/langium_client.html +0 -20
  43. package/src/langium/example.langium +0 -215
  44. package/src/langium/langium.configuration.json +0 -164
  45. package/src/langium/langium.tmLanguage.json +0 -290
  46. package/src/langium/langiumClient.ts +0 -145
  47. package/src/langium/langiumServerWorker.ts +0 -21
@@ -83,7 +83,7 @@ ${JSON.stringify(R,null,4)}`);let P=R;if(Ft.string(P.id)||Ft.number(P.id)){let O
83
83
  ${N}`}]}}}))}return p>=0&&(f[p].isPreferred=!0),f}};function WM(t,e){let r=qe.dirname(t),n=qe.relative(r,e);return!n.startsWith("./")&&!n.startsWith("../")&&(n="./"+n),n.endsWith(".langium")&&(n=n.substring(0,n.length-8)),n}var GS=Ie(bs(),1);var Wa=Ie(Qe(),1);function zy(t,e){let r={stacks:t,tokens:e};return HM(r),r.stacks.flat().forEach(i=>{i.property=void 0}),WS(r.stacks).map(i=>i[i.length-1])}function Vy(t){let{next:e,cardinalities:r,visited:n,plus:i}=t,o=[],s=e.feature;if(n.has(s))return[];n.add(s);let a,c=s;for(;c.$container;)if(Tr(c.$container)){a=c.$container;break}else if(va(c.$container))c=c.$container;else break;if(kS(c.cardinality)){let f=ja({next:{feature:c,type:e.type,new:!1},cardinalities:r,visited:n,plus:i});for(let p of f)i.add(p.feature);o.push(...f)}if(a){let f=a.elements.indexOf(c);f!==void 0&&f<a.elements.length-1&&o.push(...US({feature:a,type:e.type,new:!1},f+1,r,n,i)),o.every(p=>Wn(p.feature.cardinality,p.feature)||Wn(r.get(p.feature))||i.has(p.feature))&&o.push(...Vy({next:{feature:a,type:e.type,new:!1},cardinalities:r,visited:n,plus:i}))}return o}function Fu(t){return rr(t)&&(t={feature:t}),ja({next:t,cardinalities:new Map,visited:new Set,plus:new Set})}function ja(t){var e,r,n;let{next:i,cardinalities:o,visited:s,plus:a}=t;if(i===void 0)return[];let{feature:c,type:f}=i;if(Tr(c)){if(s.has(c))return[];s.add(c)}if(Tr(c))return US(i,0,o,s,a).map(p=>dd(p,c.cardinality,o));if(Sn(c)||kn(c))return c.elements.flatMap(p=>ja({next:{feature:p,new:!1,type:f},cardinalities:o,visited:s,plus:a})).map(p=>dd(p,c.cardinality,o));if(je(c)){let p={feature:c.terminal,new:!1,type:f,property:(e=i.property)!==null&&e!==void 0?e:c.feature};return ja({next:p,cardinalities:o,visited:s,plus:a}).map(m=>dd(m,c.cardinality,o))}else{if(et(c))return Vy({next:{feature:c,new:!0,type:li(c),property:(r=i.property)!==null&&r!==void 0?r:c.feature},cardinalities:o,visited:s,plus:a});if(tt(c)&&ee(c.rule.ref)){let p=c.rule.ref,m={feature:p.definition,new:!0,type:p.fragment?void 0:(n=Oa(p))!==null&&n!==void 0?n:p.name,property:i.property};return ja({next:m,cardinalities:o,visited:s,plus:a}).map(T=>dd(T,c.cardinality,o))}else return[i]}}function dd(t,e,r){return r.set(t.feature,e),t}function US(t,e,r,n,i){var o;let s=[],a;for(;e<t.feature.elements.length&&(a={feature:t.feature.elements[e++],new:!1,type:t.type},s.push(...ja({next:a,cardinalities:r,visited:n,plus:i})),!!Wn((o=a.feature.cardinality)!==null&&o!==void 0?o:r.get(a.feature),a.feature)););return s}function HM(t){for(let e of t.tokens){let r=WS(t.stacks,e);t.stacks=r}}function WS(t,e){let r=[];for(let n of t)r.push(...GM(n,e));return r}function GM(t,e){let r=new Map,n=new Set(t.map(o=>o.feature).filter(BM)),i=[];for(;t.length>0;){let o=t.pop(),s=Vy({next:o,cardinalities:r,plus:n,visited:new Set}).filter(a=>e?Xy(a.feature,e):!0);for(let a of s)i.push([...t,a]);if(!s.every(a=>Wn(a.feature.cardinality,a.feature)||Wn(r.get(a.feature))))break}return i}function BM(t){if(t.cardinality==="+")return!0;let e=rt(t,je);return!!(e&&e.cardinality==="+")}function Xy(t,e){if(Ht(t))return t.value===e.image;if(tt(t))return KM(t.rule.ref,e);if(Dr(t)){let r=pd(t);if(r)return Xy(r,e)}return!1}function KM(t,e){return ee(t)?Fu(t.definition).some(n=>Xy(n.feature,e)):Be(t)?Hn(t).test(e.image):!1}function HS(t){let e=Array.from(new Set(t.flatMap(n=>{var i;return(i=n?.triggerCharacters)!==null&&i!==void 0?i:[]}))),r=Array.from(new Set(t.flatMap(n=>{var i;return(i=n?.allCommitCharacters)!==null&&i!==void 0?i:[]})));return{triggerCharacters:e.length>0?e:void 0,allCommitCharacters:r.length>0?r:void 0}}var Ua=class{constructor(e){this.scopeProvider=e.references.ScopeProvider,this.grammar=e.Grammar,this.completionParser=e.parser.CompletionParser,this.nameProvider=e.references.NameProvider,this.lexer=e.parser.Lexer,this.nodeKindProvider=e.shared.lsp.NodeKindProvider,this.fuzzyMatcher=e.shared.lsp.FuzzyMatcher,this.grammarConfig=e.parser.GrammarConfig}async getCompletion(e,r){let n=[],i=this.buildContexts(e,r.position),o=(c,f)=>{let p=this.fillCompletionItem(c,f);p&&n.push(p)},s=c=>Ht(c.feature)?c.feature.value:c.feature,a=[];for(let c of i)if(await Promise.all(Ce(c.features).distinct(s).exclude(a).map(f=>this.completionFor(c,f,o))),a.push(...c.features),!this.continueCompletion(n))break;return Wa.CompletionList.create(this.deduplicateItems(n),!0)}deduplicateItems(e){return Ce(e).distinct(r=>`${r.kind}_${r.label}_${r.detail}`).toArray()}findFeaturesAt(e,r){let n=e.getText({start:Wa.Position.create(0,0),end:e.positionAt(r)}),i=this.completionParser.parse(n),o=i.tokens;if(i.tokenIndex===0){let c=md(this.grammar),f=Fu({feature:c.definition,new:!0,type:Oa(c)});return o.length>0?(o.shift(),zy(f.map(p=>[p]),o)):f}let s=[...o].splice(i.tokenIndex);return zy([i.elementStack.map(c=>({feature:c}))],s)}*buildContexts(e,r){var n,i,o,s,a;let c=e.parseResult.value.$cstNode;if(!c)return;let f=e.textDocument,p=f.getText(),m=f.offsetAt(r),T={document:e,textDocument:f,offset:m,position:r},_=this.findDataTypeRuleStart(c,m);if(_){let[h,C]=_,L=(n=dn(c,h))===null||n===void 0?void 0:n.astNode,J=this.findFeaturesAt(f,h);yield Object.assign(Object.assign({},T),{node:L,tokenOffset:h,tokenEndOffset:C,features:J})}let{nextTokenStart:E,nextTokenEnd:N,previousTokenStart:I,previousTokenEnd:A}=this.backtrackToAnyToken(p,m),y;if(I!==void 0&&A!==void 0&&A===m){y=(i=dn(c,I))===null||i===void 0?void 0:i.astNode;let h=this.findFeaturesAt(f,I);yield Object.assign(Object.assign({},T),{node:y,tokenOffset:I,tokenEndOffset:A,features:h})}if(y=(s=(o=dn(c,E))===null||o===void 0?void 0:o.astNode)!==null&&s!==void 0?s:I===void 0||(a=dn(c,I))===null||a===void 0?void 0:a.astNode,y){let h=this.findFeaturesAt(f,E);yield Object.assign(Object.assign({},T),{node:y,tokenOffset:E,tokenEndOffset:N,features:h})}else{let h=md(this.grammar),C=Fu(h.definition);yield Object.assign(Object.assign({},T),{tokenOffset:E,tokenEndOffset:N,features:C})}}findDataTypeRuleStart(e,r){var n,i;let o=dr(e,r,this.grammarConfig.nameRegexp),s=!!(!((n=rt(o?.grammarSource,ee))===null||n===void 0)&&n.dataType);if(s){for(;s;)o=o?.container,s=!!(!((i=rt(o?.grammarSource,ee))===null||i===void 0)&&i.dataType);if(o)return[o.offset,o.end]}}continueCompletion(e){return e.length===0}backtrackToAnyToken(e,r){let n=this.lexer.tokenize(e).tokens;if(n.length===0)return{nextTokenStart:r,nextTokenEnd:r};let i;for(let o of n){if(o.startOffset>=r)return{nextTokenStart:r,nextTokenEnd:r,previousTokenStart:i?i.startOffset:void 0,previousTokenEnd:i?i.endOffset+1:void 0};if(o.endOffset>=r)return{nextTokenStart:o.startOffset,nextTokenEnd:o.endOffset+1,previousTokenStart:i?i.startOffset:void 0,previousTokenEnd:i?i.endOffset+1:void 0};i=o}return{nextTokenStart:r,nextTokenEnd:r,previousTokenStart:i?i.startOffset:void 0,previousTokenEnd:i?i.endOffset+1:void 0}}async completionForRule(e,r,n){if(ee(r)){let i=Fu(r.definition);await Promise.all(i.map(o=>this.completionFor(e,o,n)))}}completionFor(e,r,n){if(Ht(r.feature))return this.completionForKeyword(e,r.feature,n);if(Dr(r.feature)&&e.node)return this.completionForCrossReference(e,r,n)}completionForCrossReference(e,r,n){let i=rt(r.feature,je),o=e.node;if(i&&o){if(r.type&&(r.new||o.$type!==r.type)&&(o={$type:r.type,$container:o,$containerProperty:r.property}),!e)return;let s={reference:{},container:o,property:i.feature};try{let a=this.scopeProvider.getScope(s),c=new Set;a.getAllElements().forEach(f=>{!c.has(f.name)&&this.filterCrossReference(f)&&(n(e,this.createReferenceCompletionItem(f)),c.add(f.name))})}catch(a){console.error(a)}}}createReferenceCompletionItem(e){return{nodeDescription:e,kind:this.nodeKindProvider.getCompletionItemKind(e),detail:e.type,sortText:"0"}}filterCrossReference(e){return!0}completionForKeyword(e,r,n){r.value.match(/[\w]/)&&n(e,{label:r.value,kind:Wa.CompletionItemKind.Keyword,detail:"Keyword",sortText:"1"})}fillCompletionItem(e,r){var n,i;let o;if(typeof r.label=="string")o=r.label;else if("node"in r){let f=this.nameProvider.getName(r.node);if(!f)return;o=f}else if("nodeDescription"in r)o=r.nodeDescription.name;else return;let s;typeof((n=r.textEdit)===null||n===void 0?void 0:n.newText)=="string"?s=r.textEdit.newText:typeof r.insertText=="string"?s=r.insertText:s=o;let a=(i=r.textEdit)!==null&&i!==void 0?i:this.buildCompletionTextEdit(e,o,s);return a?{additionalTextEdits:r.additionalTextEdits,command:r.command,commitCharacters:r.commitCharacters,data:r.data,detail:r.detail,documentation:r.documentation,filterText:r.filterText,insertText:r.insertText,insertTextFormat:r.insertTextFormat,insertTextMode:r.insertTextMode,kind:r.kind,labelDetails:r.labelDetails,preselect:r.preselect,sortText:r.sortText,tags:r.tags,textEditText:r.textEditText,textEdit:a,label:o}:void 0}buildCompletionTextEdit(e,r,n){let o=e.textDocument.getText().substring(e.tokenOffset,e.offset);if(this.fuzzyMatcher.match(o,r)){let s=e.textDocument.positionAt(e.tokenOffset),a=e.position;return{newText:n,range:{start:s,end:a}}}else return}};var hd=class extends Ua{constructor(e){super(e),this.documents=()=>e.shared.workspace.LangiumDocuments}completionFor(e,r,n){let i=rt(r.feature,je);if(i?.feature==="path")this.completeImportPath(e,n);else return super.completionFor(e,r,n)}completeImportPath(e,r){let i=e.textDocument.getText().substring(e.tokenOffset,e.offset),o=this.getAllFiles(e.document),s={start:e.position,end:e.position};if(i.length>0){let a=i.substring(1);o=o.filter(p=>p.startsWith(a));let c=e.textDocument.positionAt(e.tokenOffset+1),f=e.textDocument.positionAt(e.tokenEndOffset-1);s={start:c,end:f}}for(let a of o){let c=i.length>0?"":'"',f=`${c}${a}${c}`;r(e,{label:a,textEdit:{newText:f,range:s},kind:GS.CompletionItemKind.File,sortText:"0"})}}getAllFiles(e){let r=this.documents().all,n=e.uri.toString(),i=qe.dirname(e.uri).toString(),o=[];for(let s of r)if(!qe.equals(s.uri,n)){let a=s.uri.toString(),c=a.substring(0,a.length-qe.extname(s.uri).length),f=qe.relative(i,c);f.startsWith(".")||(f=`./${f}`),o.push(f)}return o}};var ju=Ie(Qe(),1);var Ha=class{constructor(e){this.commentNames=e.parser.GrammarConfig.multilineCommentRules}getFoldingRanges(e){let r=[],n=i=>r.push(i);return this.collectFolding(e,n),r}collectFolding(e,r){var n;let i=(n=e.parseResult)===null||n===void 0?void 0:n.value;if(i){if(this.shouldProcessContent(i)){let o=St(i).iterator(),s;do if(s=o.next(),!s.done){let a=s.value;this.shouldProcess(a)&&this.collectObjectFolding(e,a,r),this.shouldProcessContent(a)||o.prune()}while(!s.done)}this.collectCommentFolding(e,i,r)}}shouldProcess(e){return!0}shouldProcessContent(e){return!0}collectObjectFolding(e,r,n){let i=r.$cstNode;if(i){let o=this.toFoldingRange(e,i);o&&n(o)}}collectCommentFolding(e,r,n){let i=r.$cstNode;if(i){for(let o of Yx(i))if(this.commentNames.includes(o.tokenType.name)){let s=this.toFoldingRange(e,o,ju.FoldingRangeKind.Comment);s&&n(s)}}}toFoldingRange(e,r,n){let i=r.range,o=i.start,s=i.end;if(!(s.line-o.line<2))return this.includeLastFoldingLine(r,n)||(s=e.textDocument.positionAt(e.textDocument.offsetAt({line:s.line,character:0})-1)),ju.FoldingRange.create(o.line,s.line,o.character,s.character,n)}includeLastFoldingLine(e,r){if(r===ju.FoldingRangeKind.Comment)return!1;let n=e.text,i=n.charAt(n.length-1);return!(i==="}"||i===")"||i==="]")}};var gd=class extends Ha{shouldProcessContent(e){return!ee(e)}};var yd=class{constructor(){this.collector=()=>{}}getNodeFormatter(e){return new Yy(e,this.collector)}formatDocument(e,r){let n=e.parseResult;return n.lexerErrors.length===0&&n.parserErrors.length===0?this.doDocumentFormat(e,r.options):[]}isFormatRangeErrorFree(e,r){let n=e.parseResult;return n.lexerErrors.length||n.parserErrors.length?Math.min(...n.lexerErrors.map(o=>{var s;return(s=o.line)!==null&&s!==void 0?s:Number.MAX_VALUE}),...n.parserErrors.map(o=>{var s;return(s=o.token.startLine)!==null&&s!==void 0?s:Number.MAX_VALUE}))>r.end.line:!0}formatDocumentRange(e,r){return this.isFormatRangeErrorFree(e,r.range)?this.doDocumentFormat(e,r.options,r.range):[]}formatDocumentOnType(e,r){let n={start:{character:0,line:r.position.line},end:r.position};return this.isFormatRangeErrorFree(e,n)?this.doDocumentFormat(e,r.options,n):[]}get formatOnTypeOptions(){}doDocumentFormat(e,r,n){let i=new Map,o=(a,c,f)=>{var p,m;let T=this.nodeModeToKey(a,c),_=i.get(T),E=(p=f.options.priority)!==null&&p!==void 0?p:0,N=(m=_?.options.priority)!==null&&m!==void 0?m:0;(!_||N<=E)&&i.set(T,f)};this.collector=o,this.iterateAstFormatting(e,n);let s=this.iterateCstFormatting(e,i,r,n);return this.avoidOverlappingEdits(e.textDocument,s)}avoidOverlappingEdits(e,r){let n=[];for(let i of r){let o=n[n.length-1];if(o){let s=e.offsetAt(i.range.start),a=e.offsetAt(o.range.end);s<a&&n.pop()}n.push(i)}return n}iterateAstFormatting(e,r){let n=e.parseResult.value;this.format(n);let i=St(n).iterator(),o;do if(o=i.next(),!o.done){let s=o.value;this.insideRange(s.$cstNode.range,r)?this.format(s):i.prune()}while(!o.done)}nodeModeToKey(e,r){return`${e.offset}:${e.end}:${r}`}insideRange(e,r){return!r||e.start.line<=r.start.line&&e.end.line>=r.end.line||e.start.line>=r.start.line&&e.end.line<=r.end.line||e.start.line<=r.end.line&&e.end.line>=r.end.line}isNecessary(e,r){return r.getText(e.range)!==e.newText}iterateCstFormatting(e,r,n,i){let o={indentation:0,options:n,document:e.textDocument},s=[],c=this.iterateCstTree(e,o).iterator(),f,p;do if(p=c.next(),!p.done){let m=p.value,T=Cs(m),_=this.nodeModeToKey(m,"prepend"),E=r.get(_);if(r.delete(_),E){let A=this.createTextEdit(f,m,E,o);for(let y of A)y&&this.insideRange(y.range,i)&&this.isNecessary(y,e.textDocument)&&s.push(y)}let N=this.nodeModeToKey(m,"append"),I=r.get(N);if(r.delete(N),I){let A=Zx(m);if(A){let y=this.createTextEdit(m,A,I,o);for(let h of y)h&&this.insideRange(h.range,i)&&this.isNecessary(h,e.textDocument)&&s.push(h)}}if(!E&&m.hidden){let A=this.createHiddenTextEdits(f,m,void 0,o);for(let y of A)y&&this.insideRange(y.range,i)&&this.isNecessary(y,e.textDocument)&&s.push(y)}T&&(f=m)}while(!p.done);return s}createHiddenTextEdits(e,r,n,i){var o;let s=r.range.start.line;if(e&&e.range.end.line===s)return[];let a=[],c={start:{character:0,line:s},end:r.range.start},f=i.document.getText(c),p=this.findFittingMove(c,(o=n?.moves)!==null&&o!==void 0?o:[],i),m=this.getExistingIndentationCharacterCount(f,i),_=this.getIndentationCharacterCount(i,p)-m;if(_===0)return[];let E="";_>0&&(E=(i.options.insertSpaces?" ":" ").repeat(_));let N=r.text.split(`
84
84
  `);N[0]=f+N[0];for(let I=0;I<N.length;I++){let A=s+I,y={character:0,line:A};if(_>0)a.push({newText:E,range:{start:y,end:y}});else{let h=N[I],C=0;for(;C<h.length;C++){let L=h.charAt(C);if(L!==" "&&L!==" ")break}a.push({newText:"",range:{start:y,end:{line:A,character:Math.min(C,Math.abs(_))}}})}}return a}getExistingIndentationCharacterCount(e,r){let n=" ".repeat(r.options.tabSize);return(r.options.insertSpaces?e.replaceAll(" ",n):e.replaceAll(n," ")).length}getIndentationCharacterCount(e,r){let n=e.indentation;return r&&r.tabs&&(n+=r.tabs),(e.options.insertSpaces?e.options.tabSize:1)*n}createTextEdit(e,r,n,i){var o;if(r.hidden)return this.createHiddenTextEdits(e,r,n,i);let s={start:(o=e?.range.end)!==null&&o!==void 0?o:{character:0,line:0},end:r.range.start},a=this.findFittingMove(s,n.moves,i);if(!a)return[];let c=a.characters,f=a.lines,p=a.tabs,m=i.indentation;i.indentation+=p??0;let T=[];return c!==void 0?T.push(this.createSpaceTextEdit(s,c,n.options)):f!==void 0?T.push(this.createLineTextEdit(s,f,i,n.options)):p!==void 0&&T.push(this.createTabTextEdit(s,!!e,i)),Cs(r)&&(i.indentation=m),T}createSpaceTextEdit(e,r,n){if(e.start.line===e.end.line){let o=e.end.character-e.start.character;r=this.fitIntoOptions(r,o,n)}return{newText:" ".repeat(r),range:e}}createLineTextEdit(e,r,n,i){let o=e.end.line-e.start.line;r=this.fitIntoOptions(r,o,i);let a=(n.options.insertSpaces?" ".repeat(n.options.tabSize):" ").repeat(n.indentation);return{newText:`${`
85
85
  `.repeat(r)}${a}`,range:e}}createTabTextEdit(e,r,n){let o=(n.options.insertSpaces?" ".repeat(n.options.tabSize):" ").repeat(n.indentation),s=r?1:0,a=Math.max(e.end.line-e.start.line,s);return{newText:`${`
86
- `.repeat(a)}${o}`,range:e}}fitIntoOptions(e,r,n){return n.allowMore?e=Math.max(r,e):n.allowLess&&(e=Math.min(r,e)),e}findFittingMove(e,r,n){if(r.length===0)return;if(r.length===1)return r[0];let i=e.end.line-e.start.line;for(let o of r){if(o.lines!==void 0&&i<=o.lines)return o;if(o.lines===void 0&&i===0)return o}return r[r.length-1]}iterateCstTree(e,r){let i=e.parseResult.value.$cstNode;return i?new Fn(i,o=>this.iterateCst(o,r)):ya}iterateCst(e,r){if(!Pi(e))return ya;let n=r.indentation;return new _n(()=>({index:0}),i=>i.index<e.content.length?{done:!1,value:e.content[i.index++]}:(r.indentation=n,Zr))}},Yy=class{constructor(e,r){this.astNode=e,this.collector=r}node(e){return new di(e.$cstNode?[e.$cstNode]:[],this.collector)}nodes(...e){let r=[];for(let n of e)n.$cstNode&&r.push(n.$cstNode);return new di(r,this.collector)}property(e,r){let n=Pr(this.astNode.$cstNode,e,r);return new di(n?[n]:[],this.collector)}properties(...e){let r=[];for(let n of e){let i=jo(this.astNode.$cstNode,n);r.push(...i)}return new di(r,this.collector)}keyword(e,r){let n=Un(this.astNode.$cstNode,e,r);return new di(n?[n]:[],this.collector)}keywords(...e){let r=[];for(let n of e){let i=vd(this.astNode.$cstNode,n);r.push(...i)}return new di(r,this.collector)}cst(e){return new di([...e],this.collector)}interior(e,r){let n=e.nodes,i=r.nodes;if(n.length!==1||i.length!==1)return new di([],this.collector);let o=n[0],s=i[0];if(o.offset>s.offset){let a=o;o=s,s=a}return new di(e_(o,s),this.collector)}},di=class t{constructor(e,r){this.nodes=e,this.collector=r}prepend(e){for(let r of this.nodes)this.collector(r,"prepend",e);return this}append(e){for(let r of this.nodes)this.collector(r,"append",e);return this}surround(e){for(let r of this.nodes)this.collector(r,"prepend",e),this.collector(r,"append",e);return this}slice(e,r){return new t(this.nodes.slice(e,r),this.collector)}},Me;(function(t){function e(...p){return{options:{},moves:p.flatMap(m=>m.moves).sort(f)}}t.fit=e;function r(p){return i(0,p)}t.noSpace=r;function n(p){return i(1,p)}t.oneSpace=n;function i(p,m){return{options:m??{},moves:[{characters:p}]}}t.spaces=i;function o(p){return s(1,p)}t.newLine=o;function s(p,m){return{options:m??{},moves:[{lines:p}]}}t.newLines=s;function a(p){return{options:p??{},moves:[{tabs:1,lines:1}]}}t.indent=a;function c(p){return{options:p??{},moves:[{tabs:0}]}}t.noIndent=c;function f(p,m){var T,_,E,N,I,A;let y=(T=p.lines)!==null&&T!==void 0?T:0,h=(_=m.lines)!==null&&_!==void 0?_:0,C=(E=p.tabs)!==null&&E!==void 0?E:0,L=(N=m.tabs)!==null&&N!==void 0?N:0,J=(I=p.characters)!==null&&I!==void 0?I:0,fe=(A=m.characters)!==null&&A!==void 0?A:0;return y<h?-1:y>h?1:C<L?-1:C>L?1:J<fe?-1:J>fe?1:0}})(Me=Me||(Me={}));var Td=class extends yd{format(e){if(Dr(e))this.getNodeFormatter(e).properties("type","terminal").surround(Me.noSpace());else if(ee(e)){let r=this.getNodeFormatter(e);r.keywords("entry","fragment","returns").append(Me.oneSpace()),(e.inferredType||e.returnType||e.dataType)&&e.parameters.length===0?r.property("name").append(Me.oneSpace()):r.property("name").append(Me.noSpace()),r.properties("parameters").append(Me.noSpace()),r.keywords(",").append(Me.oneSpace()),r.keywords("<").append(Me.noSpace());let n=r.keyword(";"),i=r.keyword(":");i.prepend(Me.noSpace()),r.interior(i,n).prepend(Me.indent()),n.prepend(Me.fit(Me.noSpace(),Me.newLine())),r.node(e).prepend(Me.noIndent())}else if(Be(e)){let r=this.getNodeFormatter(e);e.type&&(r.property("name").append(Me.oneSpace()),r.keyword("returns").append(Me.oneSpace())),r.keywords("hidden","terminal","fragment").append(Me.oneSpace()),r.keyword(":").prepend(Me.noSpace()),r.keyword(";").prepend(Me.fit(Me.noSpace(),Me.newLine())),r.node(e).prepend(Me.noIndent())}else if(et(e)){let r=this.getNodeFormatter(e);r.keyword("{").append(Me.noSpace()),r.keywords(".","+=","=").surround(Me.noSpace()),r.keyword("}").prepend(Me.noSpace())}else if(Ra(e))this.getNodeFormatter(e).keywords("infer","infers").append(Me.oneSpace());else if(je(e))this.getNodeFormatter(e).keywords("=","+=","?=").surround(Me.noSpace());else if(tt(e)){let r=this.getNodeFormatter(e);r.keyword("<").surround(Me.noSpace()),r.keyword(",").append(Me.oneSpace()),r.properties("arguments").append(Me.noSpace())}va(e)&&this.getNodeFormatter(e).property("cardinality").prepend(Me.noSpace())}};var yo=Ie(Qe(),1);var we=Ie(Qe(),1);var Zy={[we.SemanticTokenTypes.class]:0,[we.SemanticTokenTypes.comment]:1,[we.SemanticTokenTypes.enum]:2,[we.SemanticTokenTypes.enumMember]:3,[we.SemanticTokenTypes.event]:4,[we.SemanticTokenTypes.function]:5,[we.SemanticTokenTypes.interface]:6,[we.SemanticTokenTypes.keyword]:7,[we.SemanticTokenTypes.macro]:8,[we.SemanticTokenTypes.method]:9,[we.SemanticTokenTypes.modifier]:10,[we.SemanticTokenTypes.namespace]:11,[we.SemanticTokenTypes.number]:12,[we.SemanticTokenTypes.operator]:13,[we.SemanticTokenTypes.parameter]:14,[we.SemanticTokenTypes.property]:15,[we.SemanticTokenTypes.regexp]:16,[we.SemanticTokenTypes.string]:17,[we.SemanticTokenTypes.struct]:18,[we.SemanticTokenTypes.type]:19,[we.SemanticTokenTypes.typeParameter]:20,[we.SemanticTokenTypes.variable]:21},BS={[we.SemanticTokenModifiers.abstract]:1,[we.SemanticTokenModifiers.async]:2,[we.SemanticTokenModifiers.declaration]:4,[we.SemanticTokenModifiers.defaultLibrary]:8,[we.SemanticTokenModifiers.definition]:16,[we.SemanticTokenModifiers.deprecated]:32,[we.SemanticTokenModifiers.documentation]:64,[we.SemanticTokenModifiers.modification]:128,[we.SemanticTokenModifiers.readonly]:256,[we.SemanticTokenModifiers.static]:512},KS={legend:{tokenTypes:Object.keys(Zy),tokenModifiers:Object.keys(BS)},full:{delta:!0},range:!0},Qy=class extends we.SemanticTokensBuilder{constructor(){super(...arguments),this._tokens=[]}push(e,r,n,i,o){this._tokens.push({line:e,char:r,length:n,tokenType:i,tokenModifiers:o})}build(){return this.applyTokens(),super.build()}buildEdits(){return this.applyTokens(),super.buildEdits()}applyTokens(){for(let e of this._tokens.sort(this.compareTokens))super.push(e.line,e.char,e.length,e.tokenType,e.tokenModifiers);this._tokens=[]}compareTokens(e,r){return e.line===r.line?e.char-r.char:e.line-r.line}},Rd=class{constructor(e){this.tokensBuilders=new Map,e.shared.workspace.TextDocuments.onDidClose(r=>{this.tokensBuilders.delete(r.document.uri)}),e.shared.lsp.LanguageServer.onInitialize(r=>{var n;this.initialize((n=r.capabilities.textDocument)===null||n===void 0?void 0:n.semanticTokens)})}initialize(e){this.clientCapabilities=e}async semanticHighlight(e,r,n=we.CancellationToken.None){return this.currentRange=void 0,this.currentDocument=e,this.currentTokensBuilder=this.getDocumentTokensBuilder(e),await this.computeHighlighting(e,this.createAcceptor(),n),this.currentTokensBuilder.build()}async semanticHighlightRange(e,r,n=we.CancellationToken.None){return this.currentRange=r.range,this.currentDocument=e,this.currentTokensBuilder=this.getDocumentTokensBuilder(e),await this.computeHighlighting(e,this.createAcceptor(),n),this.currentTokensBuilder.build()}async semanticHighlightDelta(e,r,n=we.CancellationToken.None){return this.currentRange=void 0,this.currentDocument=e,this.currentTokensBuilder=this.getDocumentTokensBuilder(e),this.currentTokensBuilder.previousResult(r.previousResultId),await this.computeHighlighting(e,this.createAcceptor(),n),this.currentTokensBuilder.buildEdits()}createAcceptor(){return r=>{"line"in r?this.highlightToken({range:{start:{line:r.line,character:r.char},end:{line:r.line,character:r.char+r.length}},type:r.type,modifier:r.modifier}):"range"in r?this.highlightToken(r):"keyword"in r?this.highlightKeyword(r):"property"in r?this.highlightProperty(r):this.highlightNode({node:r.cst,type:r.type,modifier:r.modifier})}}getDocumentTokensBuilder(e){let r=this.tokensBuilders.get(e.uri.toString());if(r)return r;let n=new Qy;return this.tokensBuilders.set(e.uri.toString(),n),n}async computeHighlighting(e,r,n){let i=e.parseResult.value,o=uo(i,{range:this.currentRange}).iterator(),s;do if(s=o.next(),!s.done){await kt(n);let a=s.value;this.highlightElement(a,r)==="prune"&&o.prune()}while(!s.done)}highlightToken(e){var r;let{range:n,type:i}=e,o=e.modifier;if(this.currentRange&&!Lf(n,this.currentRange)||!this.currentDocument||!this.currentTokensBuilder)return;let s=Zy[i],a=0;if(o!==void 0){typeof o=="string"&&(o=[o]);for(let p of o){let m=BS[p];a|=m}}let c=n.start.line,f=n.end.line;if(c===f){let p=n.start.character,m=n.end.character-p;this.currentTokensBuilder.push(c,p,m,s,a)}else if(!((r=this.clientCapabilities)===null||r===void 0)&&r.multilineTokenSupport){let p=n.start.character,m=this.currentDocument.textDocument.offsetAt(n.start),T=this.currentDocument.textDocument.offsetAt(n.end);this.currentTokensBuilder.push(c,p,T-m,s,a)}else{let p=n.start,m=this.currentDocument.textDocument.offsetAt({line:c+1,character:0});this.currentTokensBuilder.push(p.line,p.character,m-p.character-1,s,a);for(let T=c+1;T<f;T++){let _=m;m=this.currentDocument.textDocument.offsetAt({line:T+1,character:0}),this.currentTokensBuilder.push(T,0,m-_-1,s,a)}this.currentTokensBuilder.push(f,0,n.end.character,s,a)}}highlightProperty(e){let r=[];if(typeof e.index=="number"){let o=Pr(e.node.$cstNode,e.property,e.index);o&&r.push(o)}else r.push(...jo(e.node.$cstNode,e.property));let{type:n,modifier:i}=e;for(let o of r)this.highlightNode({node:o,type:n,modifier:i})}highlightKeyword(e){let{node:r,keyword:n,type:i,index:o,modifier:s}=e,a=[];if(typeof o=="number"){let c=Un(r.$cstNode,n,o);c&&a.push(c)}else a.push(...vd(r.$cstNode,n));for(let c of a)this.highlightNode({node:c,type:i,modifier:s})}highlightNode(e){let{node:r,type:n,modifier:i}=e,o=r.range;this.highlightToken({range:o,type:n,modifier:i})}},Jy;(function(t){function e(n,i){let o=new Map;Object.entries(Zy).forEach(([c,f])=>o.set(f,c));let s=0,a=0;return r(n.data,5).map(c=>{s+=c[0],c[0]!==0&&(a=0),a+=c[1];let f=c[2];return{offset:i.textDocument.offsetAt({line:s,character:a}),tokenType:o.get(c[3]),tokenModifiers:c[4],text:i.textDocument.getText({start:{line:s,character:a},end:{line:s,character:a+f}})}})}t.decode=e;function r(n,i){let o=[];for(let s=0;s<n.length;s+=i){let a=n.slice(s,s+i);o.push(a)}return o}})(Jy=Jy||(Jy={}));var bd=class extends Rd{highlightElement(e,r){var n;je(e)?r({node:e,property:"feature",type:yo.SemanticTokenTypes.property}):et(e)?e.feature&&r({node:e,property:"feature",type:yo.SemanticTokenTypes.property}):xa(e)?r({node:e,property:"name",type:yo.SemanticTokenTypes.type}):Hr(e)?(e.primitiveType||e.typeRef)&&r({node:e,property:e.primitiveType?"primitiveType":"typeRef",type:yo.SemanticTokenTypes.type}):g_(e)?r({node:e,property:"name",type:yo.SemanticTokenTypes.parameter}):ba(e)?r({node:e,property:"parameter",type:yo.SemanticTokenTypes.parameter}):tt(e)?!((n=e.rule.ref)===null||n===void 0)&&n.fragment&&r({node:e,property:"rule",type:yo.SemanticTokenTypes.type}):qf(e)&&r({node:e,property:"name",type:yo.SemanticTokenTypes.property})}};var xd=class extends wa{getName(e){return je(e)?e.feature:super.getName(e)}getNameNode(e){return je(e)?Pr(e.$cstNode,"feature"):super.getNameNode(e)}};var Ga=class{constructor(e){this.nameProvider=e.references.NameProvider,this.index=e.shared.workspace.IndexManager,this.nodeLocator=e.workspace.AstNodeLocator}findDeclaration(e){if(e){let r=Ba(e),n=e.astNode;if(r&&n){let i=n[r.feature];if(so(i))return i.ref;if(Array.isArray(i)){for(let o of i)if(so(o)&&o.$refNode&&o.$refNode.offset<=e.offset&&o.$refNode.end>=e.end)return o.ref}}if(n){let i=this.nameProvider.getNameNode(n);if(i&&(i===e||Jx(e,i)))return n}}}findDeclarationNode(e){let r=this.findDeclaration(e);if(r?.$cstNode){let n=this.nameProvider.getNameNode(r);return n??r.$cstNode}}findReferences(e,r){let n=[];if(r.includeDeclaration){let o=this.getReferenceToSelf(e);o&&n.push(o)}let i=this.index.findAllReferences(e,this.nodeLocator.getAstNodePath(e));return r.documentUri&&(i=i.filter(o=>qe.equals(o.sourceUri,r.documentUri))),n.push(...i),Ce(n)}getReferenceToSelf(e){let r=this.nameProvider.getNameNode(e);if(r){let n=ke(e),i=this.nodeLocator.getAstNodePath(e);return{sourceUri:n.uri,sourcePath:i,targetUri:n.uri,targetPath:i,segment:Wr(r),local:!0}}}};var _d=class extends Ga{constructor(e){super(e),this.documents=e.shared.workspace.LangiumDocuments}findDeclaration(e){let r=e.astNode,n=Ba(e);if(n&&n.feature==="feature"){if(je(r))return this.findAssignmentDeclaration(r);if(et(r))return this.findActionDeclaration(r)}return super.findDeclaration(e)}findReferences(e,r){var n;return qf(e)?this.findReferencesToTypeAttribute(e,(n=r.includeDeclaration)!==null&&n!==void 0?n:!1):super.findReferences(e,r)}findReferencesToTypeAttribute(e,r){let n=[],i=rt(e,pn);if(i){if(r){let a=this.getReferenceToSelf(e);a&&n.push(a)}let o=Sy(i,this,this.documents,this.nodeLocator),s=[];o.forEach(a=>{let c=this.findRulesWithReturnType(a);s.push(...c)}),s.forEach(a=>{let c=this.createReferencesToAttribute(a,e);n.push(...c)})}return Ce(n)}createReferencesToAttribute(e,r){let n=[];if(ee(e)){let i=Ia(e.definition).find(o=>o.feature===r.name);if(i?.$cstNode){let o=this.nameProvider.getNameNode(i);o&&n.push({sourceUri:ke(i).uri,sourcePath:this.nodeLocator.getAstNodePath(i),targetUri:ke(r).uri,targetPath:this.nodeLocator.getAstNodePath(r),segment:Wr(o),local:qe.equals(ke(i).uri,ke(r).uri)})}}else{if(e.feature===r.name){let o=Pr(e.$cstNode,"feature");o&&n.push({sourceUri:ke(e).uri,sourcePath:this.nodeLocator.getAstNodePath(e),targetUri:ke(r).uri,targetPath:this.nodeLocator.getAstNodePath(r),segment:Wr(o),local:qe.equals(ke(e).uri,ke(r).uri)})}let i=rt(e,ee);n.push(...this.createReferencesToAttribute(i,r))}return n}findAssignmentDeclaration(e){var r;let n=rt(e,ee),i=Fy(e);if(i){let o=this.findActionDeclaration(i,e.feature);if(o)return o}if(!((r=n?.returnType)===null||r===void 0)&&r.ref&&(pn(n.returnType.ref)||vr(n.returnType.ref))){let o=Cu(n.returnType.ref);for(let s of o){let a=s.attributes.find(c=>c.name===e.feature);if(a)return a}}return e}findActionDeclaration(e,r){var n;if(!((n=e.type)===null||n===void 0)&&n.ref){let i=r??e.feature,o=Cu(e.type.ref);for(let s of o){let a=s.attributes.find(c=>c.name===i);if(a)return a}}}findRulesWithReturnType(e){let r=[];return this.index.findAllReferences(e,this.nodeLocator.getAstNodePath(e)).forEach(i=>{let o=this.documents.getOrCreateDocument(i.sourceUri),s=this.nodeLocator.getAstNode(o.parseResult.value,i.sourcePath);(ee(s)||et(s))&&r.push(s)}),r}};var Uu=Ie(Qe(),1);var zS=Ie(Qe(),1);var Sd=class{constructor(e){this.grammarConfig=e.parser.GrammarConfig,this.nameProvider=e.references.NameProvider,this.documents=e.shared.workspace.LangiumDocuments,this.references=e.references.References}prepareCallHierarchy(e,r){let n=e.parseResult.value,i=dr(n.$cstNode,e.textDocument.offsetAt(r.position),this.grammarConfig.nameRegexp);if(!i)return;let o=this.references.findDeclarationNode(i);if(o)return this.getCallHierarchyItems(o.astNode,e)}getCallHierarchyItems(e,r){let n=this.nameProvider.getNameNode(e),i=this.nameProvider.getName(e);if(!(!n||!e.$cstNode||i===void 0))return[Object.assign({kind:zS.SymbolKind.Method,name:i,range:e.$cstNode.range,selectionRange:n.range,uri:r.uri.toString()},this.getCallHierarchyItem(e))]}getCallHierarchyItem(e){}incomingCalls(e){let r=this.documents.getOrCreateDocument(Ar.parse(e.item.uri)),n=r.parseResult.value,i=dr(n.$cstNode,r.textDocument.offsetAt(e.item.range.start),this.grammarConfig.nameRegexp);if(!i)return;let o=this.references.findReferences(i.astNode,{includeDeclaration:!1});return this.getIncomingCalls(i.astNode,o)}outgoingCalls(e){let r=this.documents.getOrCreateDocument(Ar.parse(e.item.uri)),n=r.parseResult.value,i=dr(n.$cstNode,r.textDocument.offsetAt(e.item.range.start),this.grammarConfig.nameRegexp);if(i)return this.getOutgoingCalls(i.astNode)}};var VS=Ie(Qe(),1);var Ka=class{constructor(e){this.nameProvider=e.references.NameProvider,this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}getDefinition(e,r){let n=e.parseResult.value;if(n.$cstNode){let i=n.$cstNode,o=dr(i,e.textDocument.offsetAt(r.position),this.grammarConfig.nameRegexp);if(o)return this.collectLocationLinks(o,r)}}collectLocationLinks(e,r){var n;let i=this.findLink(e);if(i)return[VS.LocationLink.create(i.targetDocument.textDocument.uri,((n=i.target.astNode.$cstNode)!==null&&n!==void 0?n:i.target).range,i.target.range,i.source.range)]}findLink(e){let r=this.references.findDeclarationNode(e);if(r?.astNode){let n=ke(r.astNode);if(r&&n)return{source:e,target:r,targetDocument:n}}}};var XS=Ie(Qe(),1);var kd=class{constructor(e){this.references=e.references.References,this.nameProvider=e.references.NameProvider,this.grammarConfig=e.parser.GrammarConfig}getDocumentHighlight(e,r){let n=e.parseResult.value.$cstNode;if(!n)return;let i=dr(n,e.textDocument.offsetAt(r.position),this.grammarConfig.nameRegexp);if(!i)return;let o=this.references.findDeclaration(i);if(o){let s=qe.equals(ke(o).uri,e.uri),a={documentUri:e.uri,includeDeclaration:s};return this.references.findReferences(o,a).map(f=>this.createDocumentHighlight(f)).toArray()}}createDocumentHighlight(e){return XS.DocumentHighlight.create(e.segment.range)}};var Cd=class{constructor(e){this.nameProvider=e.references.NameProvider,this.nodeKindProvider=e.shared.lsp.NodeKindProvider}getSymbols(e){return this.getSymbol(e,e.parseResult.value)}getSymbol(e,r){let n=r.$cstNode,i=this.nameProvider.getNameNode(r);if(i&&n){let o=this.nameProvider.getName(r);return[{kind:this.nodeKindProvider.getSymbolKind(r),name:o??i.text,range:n.range,selectionRange:i.range,children:this.getChildSymbols(e,r)}]}else return this.getChildSymbols(e,r)||[]}getChildSymbols(e,r){let n=[];for(let i of Fo(r)){let o=this.getSymbol(e,i);n.push(...o)}if(n.length>0)return n}};var zM=Ie(Qe(),1);var wd=class{match(e,r){if(e.length===0)return!0;r=r.toLowerCase();let n=!1,i,o=0,s=r.length;for(let a=0;a<s;a++){let c=r.charCodeAt(a),f=e.charCodeAt(o);if((c===f||this.toUpperCharCode(c)===this.toUpperCharCode(f))&&(n||(n=i===void 0||this.isWordTransition(i,c)),n&&o++,o===e.length))return!0;i=c}return!1}isWordTransition(e,r){return YS<=e&&e<=JS&&VM<=r&&r<=XM||e===QS&&r!==QS}toUpperCharCode(e){return YS<=e&&e<=JS?e-32:e}},YS="a".charCodeAt(0),JS="z".charCodeAt(0),VM="A".charCodeAt(0),XM="Z".charCodeAt(0),QS="_".charCodeAt(0);var ev=class{constructor(e){this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}getHoverContent(e,r){var n,i;let o=(i=(n=e.parseResult)===null||n===void 0?void 0:n.value)===null||i===void 0?void 0:i.$cstNode;if(o){let s=e.textDocument.offsetAt(r.position),a=dr(o,s,this.grammarConfig.nameRegexp);if(a&&a.offset+a.length>s){let c=this.references.findDeclaration(a);if(c)return this.getAstNodeHoverContent(c)}}}},Dd=class extends ev{constructor(e){super(e),this.documentationProvider=e.documentation.DocumentationProvider}getAstNodeHoverContent(e){let r=this.documentationProvider.getDocumentation(e);if(r)return{contents:{kind:"markdown",value:r}}}};var YM=Ie(Qe(),1);var JM=Ie(Qe(),1);var Gn=Ie(Qe(),1);var st;(function(t){t[t.Changed=0]="Changed",t[t.Parsed=1]="Parsed",t[t.IndexedContent=2]="IndexedContent",t[t.ComputedScopes=3]="ComputedScopes",t[t.Linked=4]="Linked",t[t.IndexedReferences=5]="IndexedReferences",t[t.Validated=6]="Validated"})(st=st||(st={}));var Ed=class{constructor(e){this.serviceRegistry=e.ServiceRegistry,this.textDocuments=e.workspace.TextDocuments,this.fileSystemProvider=e.workspace.FileSystemProvider}fromTextDocument(e,r){return this.create(r??Ar.parse(e.uri),e)}fromString(e,r){return this.create(r,e)}fromModel(e,r){return this.create(r,{$model:e})}create(e,r){if(r??(r=this.textDocuments.get(e.toString())),r??(r=this.getContentFromFileSystem(e)),typeof r=="string"){let n=this.parse(e,r);return this.createLangiumDocument(n,e,void 0,r)}else if("$model"in r){let n={value:r.$model,parserErrors:[],lexerErrors:[]};return this.createLangiumDocument(n,e)}else{let n=this.parse(e,r.getText());return this.createLangiumDocument(n,e,r)}}createLangiumDocument(e,r,n,i){let o;if(n)o={parseResult:e,uri:r,state:st.Parsed,references:[],textDocument:n};else{let s=this.createTextDocumentGetter(r,i);o={parseResult:e,uri:r,state:st.Parsed,references:[],get textDocument(){return s()}}}return e.value.$document=o,o}update(e){let r=this.textDocuments.get(e.uri.toString()),n=r?r.getText():this.getContentFromFileSystem(e.uri);if(r)Object.defineProperty(e,"textDocument",{value:r});else{let i=this.createTextDocumentGetter(e.uri,n);Object.defineProperty(e,"textDocument",{get:i})}return e.parseResult=this.parse(e.uri,n),e.parseResult.value.$document=e,e}getContentFromFileSystem(e){return this.fileSystemProvider.readFileSync(e)}parse(e,r){return this.serviceRegistry.getServices(e).parser.LangiumParser.parse(r)}createTextDocumentGetter(e,r){let n=this.serviceRegistry,i;return()=>i??(i=ha.create(e.toString(),n.getServices(e).LanguageMetaData.languageId,0,r??""))}},Pd=class{constructor(e){this.documentMap=new Map,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory}get all(){return Ce(this.documentMap.values())}addDocument(e){let r=e.uri.toString();if(this.documentMap.has(r))throw new Error(`A document with the URI '${r}' is already present.`);this.documentMap.set(r,e)}getOrCreateDocument(e){let r=e.toString(),n=this.documentMap.get(r);return n||(n=this.langiumDocumentFactory.create(e),this.documentMap.set(r,n),n)}hasDocument(e){return this.documentMap.has(e.toString())}invalidateDocument(e){let r=e.toString(),n=this.documentMap.get(r);return n&&(n.state=st.Changed,n.precomputedScopes=void 0,n.references=[],n.diagnostics=void 0),n}deleteDocument(e){let r=e.toString(),n=this.documentMap.get(r);return n&&(n.state=st.Changed,this.documentMap.delete(r)),n}};var QM=Ie(Qe(),1);function ZS(t){let e=[],r=[];t.forEach(i=>{i?.triggerCharacters&&e.push(...i.triggerCharacters),i?.retriggerCharacters&&r.push(...i.retriggerCharacters)});let n={triggerCharacters:e.length>0?Array.from(new Set(e)).sort():void 0,retriggerCharacters:r.length>0?Array.from(new Set(r)).sort():void 0};return n.triggerCharacters?n:void 0}var Ad=class{constructor(e){this.onInitializeEmitter=new Gn.Emitter,this.onInitializedEmitter=new Gn.Emitter,this.services=e}get onInitialize(){return this.onInitializeEmitter.event}get onInitialized(){return this.onInitializedEmitter.event}async initialize(e){return this.eagerLoadServices(),this.onInitializeEmitter.fire(e),this.onInitializeEmitter.dispose(),this.buildInitializeResult(e)}eagerLoadServices(){Mf(this.services),this.services.ServiceRegistry.all.forEach(e=>Mf(e))}hasService(e){return this.services.ServiceRegistry.all.some(r=>e(r)!==void 0)}buildInitializeResult(e){var r;let n=this.services.ServiceRegistry.all,i=this.hasService(V=>V.lsp.Formatter),o=n.map(V=>{var it;return(it=V.lsp.Formatter)===null||it===void 0?void 0:it.formatOnTypeOptions}).find(V=>!!V),s=this.hasService(V=>V.lsp.CodeActionProvider),a=this.hasService(V=>V.lsp.SemanticTokenProvider),c=(r=this.services.lsp.ExecuteCommandHandler)===null||r===void 0?void 0:r.commands,f=this.hasService(V=>V.lsp.DocumentLinkProvider),p=ZS(n.map(V=>{var it;return(it=V.lsp.SignatureHelp)===null||it===void 0?void 0:it.signatureHelpOptions})),m=this.hasService(V=>V.lsp.TypeProvider),T=this.hasService(V=>V.lsp.ImplementationProvider),_=this.hasService(V=>V.lsp.CompletionProvider),E=HS(n.map(V=>{var it;return(it=V.lsp.CompletionProvider)===null||it===void 0?void 0:it.completionOptions})),N=this.hasService(V=>V.lsp.ReferencesProvider),I=this.hasService(V=>V.lsp.DocumentSymbolProvider),A=this.hasService(V=>V.lsp.DefinitionProvider),y=this.hasService(V=>V.lsp.DocumentHighlightProvider),h=this.hasService(V=>V.lsp.FoldingRangeProvider),C=this.hasService(V=>V.lsp.HoverProvider),L=this.hasService(V=>V.lsp.RenameProvider),J=this.hasService(V=>V.lsp.CallHierarchyProvider),fe=this.hasService(V=>V.lsp.CodeLensProvider),Ae=this.hasService(V=>V.lsp.DeclarationProvider),Wt=this.hasService(V=>V.lsp.InlayHintProvider),Xe=this.services.lsp.WorkspaceSymbolProvider;return{capabilities:{workspace:{workspaceFolders:{supported:!0}},executeCommandProvider:c&&{commands:c},textDocumentSync:Gn.TextDocumentSyncKind.Incremental,completionProvider:_?E:void 0,referencesProvider:N,documentSymbolProvider:I,definitionProvider:A,typeDefinitionProvider:m,documentHighlightProvider:y,codeActionProvider:s,documentFormattingProvider:i,documentRangeFormattingProvider:i,documentOnTypeFormattingProvider:o,foldingRangeProvider:h,hoverProvider:C,renameProvider:L?{prepareProvider:!0}:void 0,semanticTokensProvider:a?KS:void 0,signatureHelpProvider:p,implementationProvider:T,callHierarchyProvider:J?{}:void 0,documentLinkProvider:f?{resolveProvider:!1}:void 0,codeLensProvider:fe?{resolveProvider:!1}:void 0,declarationProvider:Ae,inlayHintProvider:Wt?{resolveProvider:!1}:void 0,workspaceSymbolProvider:Xe?{resolveProvider:!!Xe.resolveSymbol}:void 0}}}async initialized(e){this.onInitializedEmitter.fire(e),this.onInitializedEmitter.dispose()}};function tk(t){let e=t.lsp.Connection;if(!e)throw new Error("Starting a language server requires the languageServer.Connection service to be set.");ZM(e,t),e$(e,t),t$(e,t),r$(e,t),i$(e,t),o$(e,t),s$(e,t),a$(e,t),u$(e,t),f$(e,t),d$(e,t),n$(e,t),p$(e,t),l$(e,t),m$(e,t),h$(e,t),y$(e,t),T$(e,t),x$(e,t),R$(e,t),v$(e,t),g$(e,t),c$(e,t),b$(e,t),e.onInitialize(n=>t.lsp.LanguageServer.initialize(n)),e.onInitialized(n=>t.lsp.LanguageServer.initialized(n)),t.workspace.TextDocuments.listen(e),e.listen()}function ZM(t,e){let r=e.workspace.DocumentBuilder,n=e.workspace.MutexLock;function i(s,a){n.lock(c=>r.update(s,a,c))}e.workspace.TextDocuments.onDidChangeContent(s=>{i([Ar.parse(s.document.uri)],[])}),t.onDidChangeWatchedFiles(s=>{let a=[],c=[];for(let f of s.changes){let p=Ar.parse(f.uri);f.type===Gn.FileChangeType.Deleted?c.push(p):a.push(p)}i(a,c)})}function e$(t,e){e.workspace.DocumentBuilder.onBuildPhase(st.Validated,async(n,i)=>{for(let o of n)if(o.diagnostics&&t.sendDiagnostics({uri:o.uri.toString(),diagnostics:o.diagnostics}),i.isCancellationRequested)return})}function t$(t,e){t.onCompletion(Br((r,n,i,o)=>{var s;return(s=r.lsp.CompletionProvider)===null||s===void 0?void 0:s.getCompletion(n,i,o)},e))}function r$(t,e){t.onReferences(Br((r,n,i,o)=>{var s;return(s=r.lsp.ReferencesProvider)===null||s===void 0?void 0:s.findReferences(n,i,o)},e))}function n$(t,e){t.onCodeAction(Br((r,n,i,o)=>{var s;return(s=r.lsp.CodeActionProvider)===null||s===void 0?void 0:s.getCodeActions(n,i,o)},e))}function i$(t,e){t.onDocumentSymbol(Br((r,n,i,o)=>{var s;return(s=r.lsp.DocumentSymbolProvider)===null||s===void 0?void 0:s.getSymbols(n,i,o)},e))}function o$(t,e){t.onDefinition(Br((r,n,i,o)=>{var s;return(s=r.lsp.DefinitionProvider)===null||s===void 0?void 0:s.getDefinition(n,i,o)},e))}function s$(t,e){t.onTypeDefinition(Br((r,n,i,o)=>{var s;return(s=r.lsp.TypeProvider)===null||s===void 0?void 0:s.getTypeDefinition(n,i,o)},e))}function a$(t,e){t.onImplementation(Br((r,n,i,o)=>{var s;return(s=r.lsp.ImplementationProvider)===null||s===void 0?void 0:s.getImplementation(n,i,o)},e))}function c$(t,e){t.onDeclaration(Br((r,n,i,o)=>{var s;return(s=r.lsp.DeclarationProvider)===null||s===void 0?void 0:s.getDeclaration(n,i,o)},e))}function u$(t,e){t.onDocumentHighlight(Br((r,n,i,o)=>{var s;return(s=r.lsp.DocumentHighlightProvider)===null||s===void 0?void 0:s.getDocumentHighlight(n,i,o)},e))}function l$(t,e){t.onHover(Br((r,n,i,o)=>{var s;return(s=r.lsp.HoverProvider)===null||s===void 0?void 0:s.getHoverContent(n,i,o)},e))}function f$(t,e){t.onFoldingRanges(Br((r,n,i,o)=>{var s;return(s=r.lsp.FoldingRangeProvider)===null||s===void 0?void 0:s.getFoldingRanges(n,i,o)},e))}function d$(t,e){t.onDocumentFormatting(Br((r,n,i,o)=>{var s;return(s=r.lsp.Formatter)===null||s===void 0?void 0:s.formatDocument(n,i,o)},e)),t.onDocumentRangeFormatting(Br((r,n,i,o)=>{var s;return(s=r.lsp.Formatter)===null||s===void 0?void 0:s.formatDocumentRange(n,i,o)},e)),t.onDocumentOnTypeFormatting(Br((r,n,i,o)=>{var s;return(s=r.lsp.Formatter)===null||s===void 0?void 0:s.formatDocumentOnType(n,i,o)},e))}function p$(t,e){t.onRenameRequest(Br((r,n,i,o)=>{var s;return(s=r.lsp.RenameProvider)===null||s===void 0?void 0:s.rename(n,i,o)},e)),t.onPrepareRename(Br((r,n,i,o)=>{var s;return(s=r.lsp.RenameProvider)===null||s===void 0?void 0:s.prepareRename(n,i,o)},e))}function m$(t,e){t.languages.inlayHint.on(Ho((r,n,i,o)=>{var s;return(s=r.lsp.InlayHintProvider)===null||s===void 0?void 0:s.getInlayHints(n,i,o)},e))}function h$(t,e){let r={data:[]};t.languages.semanticTokens.on(Ho((n,i,o,s)=>n.lsp.SemanticTokenProvider?n.lsp.SemanticTokenProvider.semanticHighlight(i,o,s):r,e)),t.languages.semanticTokens.onDelta(Ho((n,i,o,s)=>n.lsp.SemanticTokenProvider?n.lsp.SemanticTokenProvider.semanticHighlightDelta(i,o,s):r,e)),t.languages.semanticTokens.onRange(Ho((n,i,o,s)=>n.lsp.SemanticTokenProvider?n.lsp.SemanticTokenProvider.semanticHighlightRange(i,o,s):r,e))}function g$(t,e){t.onDidChangeConfiguration(r=>{r.settings&&e.workspace.ConfigurationProvider.updateConfiguration(r)})}function y$(t,e){let r=e.lsp.ExecuteCommandHandler;r&&t.onExecuteCommand(async(n,i)=>{var o;try{return await r.executeCommand(n.command,(o=n.arguments)!==null&&o!==void 0?o:[],i)}catch(s){return za(s)}})}function v$(t,e){t.onDocumentLinks(Ho((r,n,i,o)=>{var s;return(s=r.lsp.DocumentLinkProvider)===null||s===void 0?void 0:s.getDocumentLinks(n,i,o)},e))}function T$(t,e){t.onSignatureHelp(Ho((r,n,i,o)=>{var s;return(s=r.lsp.SignatureHelp)===null||s===void 0?void 0:s.provideSignatureHelp(n,i,o)},e))}function R$(t,e){t.onCodeLens(Ho((r,n,i,o)=>{var s;return(s=r.lsp.CodeLensProvider)===null||s===void 0?void 0:s.provideCodeLens(n,i,o)},e))}function b$(t,e){var r;let n=e.lsp.WorkspaceSymbolProvider;if(n){t.onWorkspaceSymbol(async(o,s)=>{try{return await n.getSymbols(o,s)}catch(a){return za(a)}});let i=(r=n.resolveSymbol)===null||r===void 0?void 0:r.bind(n);i&&t.onWorkspaceSymbolResolve(async(o,s)=>{try{return await i(o,s)}catch(a){return za(a)}})}}function x$(t,e){t.languages.callHierarchy.onPrepare(Ho((r,n,i,o)=>{var s;return r.lsp.CallHierarchyProvider&&(s=r.lsp.CallHierarchyProvider.prepareCallHierarchy(n,i,o))!==null&&s!==void 0?s:null},e)),t.languages.callHierarchy.onIncomingCalls(ek((r,n,i)=>{var o;return r.lsp.CallHierarchyProvider&&(o=r.lsp.CallHierarchyProvider.incomingCalls(n,i))!==null&&o!==void 0?o:null},e)),t.languages.callHierarchy.onOutgoingCalls(ek((r,n,i)=>{var o;return r.lsp.CallHierarchyProvider&&(o=r.lsp.CallHierarchyProvider.outgoingCalls(n,i))!==null&&o!==void 0?o:null},e))}function ek(t,e){let r=e.ServiceRegistry;return async(n,i)=>{let o=Ar.parse(n.item.uri),s=r.getServices(o);if(!s){let a=`Could not find service instance for uri: '${o.toString()}'`;throw console.error(a),new Error(a)}try{return await t(s,n,i)}catch(a){return za(a)}}}function Ho(t,e){let r=e.workspace.LangiumDocuments,n=e.ServiceRegistry;return async(i,o)=>{let s=Ar.parse(i.textDocument.uri),a=n.getServices(s);if(!a)throw console.error(`Could not find service instance for uri: '${s.toString()}'`),new Error;let c=r.getOrCreateDocument(s);if(!c)throw new Error;try{return await t(a,c,i,o)}catch(f){return za(f)}}}function Br(t,e){let r=e.workspace.LangiumDocuments,n=e.ServiceRegistry;return async(i,o)=>{let s=Ar.parse(i.textDocument.uri),a=n.getServices(s);if(!a)return console.error(`Could not find service instance for uri: '${s.toString()}'`),null;let c=r.getOrCreateDocument(s);if(!c)return null;try{return await t(a,c,i,o)}catch(f){return za(f)}}}function za(t){if(Os(t))return new Gn.ResponseError(Gn.LSPErrorCodes.RequestCancelled,"The request has been cancelled.");if(t instanceof Gn.ResponseError)return t;throw t}var Id=Ie(Qe(),1),Nd=class{getSymbolKind(){return Id.SymbolKind.Field}getCompletionItemKind(){return Id.CompletionItemKind.Reference}};var rk=Ie(Qe(),1);var Od=class{constructor(e){this.nameProvider=e.references.NameProvider,this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}findReferences(e,r){let n=e.parseResult.value.$cstNode;if(!n)return[];let i=dr(n,e.textDocument.offsetAt(r.position),this.grammarConfig.nameRegexp);return i?this.getReferences(i,r,e):[]}getReferences(e,r,n){let i=[],o=this.references.findDeclaration(e);if(o){let s={includeDeclaration:r.context.includeDeclaration};this.references.findReferences(o,s).forEach(a=>{i.push(rk.Location.create(a.sourceUri.toString(),a.segment.range))})}return i}};var nk=Ie(Qe(),1);var Ld=class{constructor(e){this.references=e.references.References,this.nameProvider=e.references.NameProvider,this.grammarConfig=e.parser.GrammarConfig}async rename(e,r){let n={},i=e.parseResult.value.$cstNode;if(!i)return;let o=e.textDocument.offsetAt(r.position),s=dr(i,o,this.grammarConfig.nameRegexp);if(!s)return;let a=this.references.findDeclaration(s);if(!a)return;let c={onlyLocal:!1,includeDeclaration:!0};return this.references.findReferences(a,c).forEach(p=>{let m=nk.TextEdit.replace(p.segment.range,r.newName),T=p.sourceUri.toString();n[T]?n[T].push(m):n[T]=[m]}),{changes:n}}prepareRename(e,r){return this.renameNodeRange(e,r.position)}renameNodeRange(e,r){let n=e.parseResult.value.$cstNode,i=e.textDocument.offsetAt(r);if(n&&i){let o=dr(n,i,this.grammarConfig.nameRegexp);if(!o)return;if(this.references.findDeclaration(o)||this.isNameNode(o))return o.range}}isNameNode(e){return e?.astNode&&wu(e.astNode)&&e===this.nameProvider.getNameNode(e.astNode)}};var _$=Ie(Qe(),1);var ik=Ie(Qe(),1);var Md=class{constructor(e){this.indexManager=e.workspace.IndexManager,this.nodeKindProvider=e.lsp.NodeKindProvider,this.fuzzyMatcher=e.lsp.FuzzyMatcher}async getSymbols(e,r=ik.CancellationToken.None){let n=[],i=e.query.toLowerCase();for(let o of this.indexManager.allElements())if(await kt(r),this.fuzzyMatcher.match(i,o.name)){let s=this.getWorkspaceSymbol(o);s&&n.push(s)}return n}getWorkspaceSymbol(e){let r=e.nameSegment;if(r)return{kind:this.nodeKindProvider.getSymbolKind(e),name:e.name,location:{range:r.range,uri:e.documentUri.toString()}}}};var $d=class extends Ka{constructor(e){super(e),this.documents=e.shared.workspace.LangiumDocuments}collectLocationLinks(e,r){var n,i,o,s,a,c;let f="path";if($f(e.astNode)&&((n=Ba(e))===null||n===void 0?void 0:n.feature)===f){let p=ho(this.documents,e.astNode);if(p?.$document){let m=(i=this.findTargetObject(p))!==null&&i!==void 0?i:p,T=(s=(o=this.nameProvider.getNameNode(m))===null||o===void 0?void 0:o.range)!==null&&s!==void 0?s:Uu.Range.create(0,0,0,0),_=(c=(a=m.$cstNode)===null||a===void 0?void 0:a.range)!==null&&c!==void 0?c:Uu.Range.create(0,0,0,0);return[Uu.LocationLink.create(p.$document.uri.toString(),_,T,e.range)]}return}return super.collectLocationLinks(e,r)}findTargetObject(e){return e.isDeclared?e:Fo(e).head()}};var tv=Ie(Qe(),1);var qd=class extends Sd{getIncomingCalls(e,r){if(!ee(e))return;let n=new Map;if(r.forEach(i=>{let s=this.documents.getOrCreateDocument(i.sourceUri).parseResult.value;if(!s.$cstNode)return;let a=dn(s.$cstNode,i.segment.offset);if(!a)return;let c=rt(a.astNode,ee);if(!c||!c.$cstNode)return;let f=this.nameProvider.getNameNode(c);if(!f)return;let p=i.sourceUri.toString(),m=p+"@"+f.text;n.has(m)?n.set(m,{parserRule:c.$cstNode,nameNode:f,targetNodes:[...n.get(m).targetNodes,a],docUri:p}):n.set(m,{parserRule:c.$cstNode,nameNode:f,targetNodes:[a],docUri:p})}),n.size!==0)return Array.from(n.values()).map(i=>({from:{kind:tv.SymbolKind.Method,name:i.nameNode.text,range:i.parserRule.range,selectionRange:i.nameNode.range,uri:i.docUri},fromRanges:i.targetNodes.map(o=>o.range)}))}getOutgoingCalls(e){if(!ee(e))return;let r=St(e).filter(tt).toArray(),n=new Map;if(r.forEach(i=>{var o;let s=i.$cstNode;if(!s)return;let a=(o=i.rule.ref)===null||o===void 0?void 0:o.$cstNode;if(!a)return;let c=this.nameProvider.getNameNode(a.astNode);if(!c)return;let f=ke(a.astNode).uri.toString(),p=f+"@"+c.text;n.has(p)?n.set(p,{refCstNode:a,to:c,from:[...n.get(p).from,s.range],docUri:f}):n.set(p,{refCstNode:a,to:c,from:[s.range],docUri:f})}),n.size!==0)return Array.from(n.values()).map(i=>({to:{kind:tv.SymbolKind.Method,name:i.to.text,range:i.refCstNode.range,selectionRange:i.to.range,uri:i.docUri},fromRanges:i.from}))}};var Fd=class{constructor(e){this.documents=e.shared.workspace.LangiumDocuments}collectValidationResources(e){let r=$S(e,this.documents);return{typeToValidationInfo:this.collectValidationInfo(r),typeToSuperProperties:this.collectSuperProperties(r)}}collectValidationInfo({astResources:e,inferred:r,declared:n}){let i=new Map,o=S$(e);for(let a of Xf(r))i.set(a.name,{inferred:a,inferredNodes:o.get(a.name)});let s=Ce(e.interfaces).concat(e.types).reduce((a,c)=>a.set(c.name,c),new Map);for(let a of Xf(n)){let c=s.get(a.name);if(c){let f=i.get(a.name);i.set(a.name,Object.assign(Object.assign({},f??{}),{declared:a,declaredNode:c}))}}return i}collectSuperProperties({inferred:e,declared:r}){let n=new Map,i=ky(e,r),o=new Map(i.map(s=>[s.name,s]));for(let s of ky(e,r))n.set(s.name,this.addSuperProperties(s,o,new Set));return n}addSuperProperties(e,r,n){if(n.has(e.name))return[];n.add(e.name);let i=[...e.properties];for(let o of e.superTypes){let s=r.get(o.name);s&&i.push(...this.addSuperProperties(s,r,n))}return i}};function S$({parserRules:t,datatypeRules:e}){let r=new Ze;Ce(t).concat(e).forEach(i=>r.add(Ms(i),i));function n(i){if(et(i)){let o=La(i);o&&r.add(o,i)}(Sn(i)||Tr(i)||kn(i))&&i.elements.forEach(o=>n(o))}return t.forEach(i=>n(i.definition)),r}function ok(t){return t&&"declared"in t}function sk(t){return t&&"inferred"in t}function ak(t){return t&&"inferred"in t&&"declared"in t}function uk(t){let e=t.validation.ValidationRegistry,r=t.validation.LangiumGrammarTypesValidator,n={Action:[r.checkActionIsNotUnionType],Grammar:[r.checkDeclaredTypesConsistency,r.checkDeclaredAndInferredTypesConsistency],Interface:[r.checkCyclicInterface],Type:[r.checkCyclicType]};e.register(n,r)}var jd=class{checkCyclicType(e,r){Go(e,new Set)&&r("error",`Type alias '${e.name}' circularly references itself.`,{node:e,property:"name"})}checkCyclicInterface(e,r){Go(e,new Set)&&r("error",`Type '${e.name}' recursively references itself as a base type.`,{node:e,property:"name"})}checkDeclaredTypesConsistency(e,r){var n;let i=(n=e.$document)===null||n===void 0?void 0:n.validationResources;if(i){for(let o of i.typeToValidationInfo.values())if(ok(o)&&ui(o.declared)&&pn(o.declaredNode)){let s=o;C$(s,r),w$(s,r)}}}checkDeclaredAndInferredTypesConsistency(e,r){var n;let i=(n=e.$document)===null||n===void 0?void 0:n.validationResources;if(i)for(let o of i.typeToValidationInfo.values())sk(o)&&o.inferred instanceof Ca&&k$(o.inferred,r),ak(o)&&P$(o,i,r)}checkActionIsNotUnionType(e,r){vr(e.type)&&r("error","Actions cannot create union types.",{node:e,property:"type"})}};function Go(t,e){var r;if(e.has(t))return!0;if(e.add(t),vr(t))return Go(t.type,e);if(pn(t))return t.superTypes.some(n=>n.ref&&Go(n.ref,e));if(Hr(t)){if(!((r=t.typeRef)===null||r===void 0)&&r.ref)return Go(t.typeRef.ref,e)}else{if(Ps(t))return Go(t.referenceType,e);if(Es(t))return Go(t.elementType,e);if(jn(t))return t.types.some(n=>Go(n,e))}return!1}function k$(t,e){t.properties.forEach(r=>{var n;let i=xy(r.type);if(i.length>1){let o=a=>lo(a)?"ref":"other",s=o(i[0]);if(i.slice(1).some(a=>o(a)!==s)){let a=(n=r.astNodes.values().next())===null||n===void 0?void 0:n.value;a&&e("error",`Mixing a cross-reference with other types is not supported. Consider splitting property "${r.name}" into two or more different properties.`,{node:a})}}})}function C$({declared:t,declaredNode:e},r){Array.from(t.superTypes).forEach((n,i)=>{n&&(ai(n)&&r("error","Interfaces cannot extend union types.",{node:e,property:"superTypes",index:i}),n.declared||r("error","Extending an inferred type is discouraged.",{node:e,property:"superTypes",index:i}))})}function w$({declared:t,declaredNode:e},r){let n=t.properties.reduce((s,a)=>s.add(a.name,a),new Ze);for(let[s,a]of n.entriesGroupedByKey())if(a.length>1)for(let c of a)r("error",`Cannot have two properties with the same name '${s}'.`,{node:Array.from(c.astNodes)[0],property:"name"});let i=Array.from(t.superTypes);for(let s=0;s<i.length;s++)for(let a=s+1;a<i.length;a++){let c=i[s],f=i[a],p=ui(c)?c.superProperties:[],m=ui(f)?f.superProperties:[],T=D$(p,m);T.length>0&&r("error",`Cannot simultaneously inherit from '${c}' and '${f}'. Their ${T.map(_=>"'"+_+"'").join(", ")} properties are not identical.`,{node:e,property:"name"})}let o=new Set;for(let s of i){let a=ui(s)?s.superProperties:[];for(let c of a)o.add(c.name)}for(let s of t.properties)if(o.has(s.name)){let a=e.attributes.find(c=>c.name===s.name);a&&r("error",`Cannot redeclare property '${s.name}'. It is already inherited from another interface.`,{node:a,property:"name"})}}function D$(t,e){let r=[];for(let n of t){let i=e.find(o=>o.name===n.name);i&&!E$(n,i)&&r.push(n.name)}return r}function E$(t,e){return ku(t.type,e.type)&&ku(e.type,t.type)}function P$(t,e,r){let{inferred:n,declared:i,declaredNode:o,inferredNodes:s}=t,a=i.name,c=m=>T=>s.forEach(_=>r("error",`${T}${m?` ${m}`:""}.`,_?.inferredType?{node:_?.inferredType,property:"name"}:{node:_,property:et(_)?"type":"name"})),f=(m,T)=>m.forEach(_=>r("error",T,{node:_,property:je(_)||et(_)?"feature":"name"})),p=m=>{s.forEach(T=>{ee(T)&&Ia(T.definition).find(E=>E.feature===m)===void 0&&r("error",`Property '${m}' is missing in a rule '${T.name}', but is required in type '${a}'.`,{node:T,property:"parameters"})})};if(ai(n)&&ai(i))A$(n.type,i.type,c(`in a rule that returns type '${a}'`));else if(ui(n)&&ui(i))N$(n,i,e,c(`in a rule that returns type '${a}'`),f,p);else{let m=`Inferred and declared versions of type '${a}' both have to be interfaces or unions.`;c()(m),r("error",m,{node:o,property:"name"})}}function A$(t,e,r){ku(t,e)||r(`Cannot assign type '${ci(t,"DeclaredType")}' to '${ci(e,"DeclaredType")}'`)}function ck(t){return t.optional||zf(t.type)}function N$(t,e,r,n,i,o){let s=new Set(t.properties.map(m=>m.name)),a=new Map(t.allProperties.map(m=>[m.name,m])),c=new Map(e.superProperties.map(m=>[m.name,m])),f=m=>{if(pr(m))return{types:m.types.map(T=>f(T))};if(lo(m))return{referenceType:f(m.referenceType)};if(fo(m))return{elementType:f(m.elementType)};if(Cn(m)){let T=r.typeToValidationInfo.get(m.value.name);return T?{value:"declared"in T?T.declared:T.inferred}:m}return m};for(let[m,T]of a.entries()){let _=c.get(m);if(_){let E=ci(T.type,"DeclaredType"),N=ci(_.type,"DeclaredType");if(!ku(f(T.type),_.type)&&N!=="unknown"){let A=`The assigned type '${E}' is not compatible with the declared property '${m}' of type '${N}'.`;i(T.astNodes,A)}T.optional&&!ck(_)&&o(m)}else s.has(m)&&i(T.astNodes,`A property '${m}' is not expected.`)}let p=new Set;for(let[m,T]of c.entries())!a.get(m)&&!ck(T)&&p.add(m);if(p.size>0){let m=p.size>1?"Properties":"A property",T=p.size>1?"are expected":"is expected",_=Array.from(p).map(E=>`'${E}'`).sort().join(", ");n(`${m} ${_} ${T}.`)}}var I$={validation:{LangiumGrammarValidator:t=>new nd(t),ValidationResourcesCollector:t=>new Fd(t),LangiumGrammarTypesValidator:()=>new jd},lsp:{FoldingRangeProvider:t=>new gd(t),CodeActionProvider:t=>new fd(t),SemanticTokenProvider:t=>new bd(t),Formatter:()=>new Td,DefinitionProvider:t=>new $d(t),CallHierarchyProvider:t=>new qd(t),CompletionProvider:t=>new hd(t)},references:{ScopeComputation:t=>new ud(t),ScopeProvider:t=>new cd(t),References:t=>new _d(t),NameProvider:()=>new xd}};function lk(t,e){let r=ws(Hu(t),qS,e),n=ws(Wu({shared:r}),FS,I$);return O$(r,n),r.ServiceRegistry.register(n),bS(n),uk(n),{shared:r,grammar:n}}function O$(t,e){t.workspace.DocumentBuilder.onBuildPhase(st.IndexedReferences,async(n,i)=>{for(let o of n){await kt(i);let s=e.validation.ValidationResourcesCollector,a=o.parseResult.value;o.validationResources=s.collectValidationResources(a)}})}var rv=class{readFile(){throw new Error("Method not implemented.")}readFileSync(){throw new Error("Method not implemented.")}async readDirectory(){return[]}},Ud={fileSystemProvider:()=>new rv};function md(t){return t.rules.find(e=>ee(e)&&e.entry)}function L$(t){return t.rules.filter(e=>Be(e)&&e.hidden)}function Na(t,e){let r=new Set,n=md(t);if(!n)return new Set(t.rules);let i=[n].concat(L$(t));for(let s of i)fk(s,r,e);let o=new Set;for(let s of t.rules)(r.has(s.name)||Be(s)&&s.hidden)&&o.add(s);return o}function fk(t,e,r){e.add(t.name),St(t).forEach(n=>{if(tt(n)||r&&jf(n)){let i=n.rule.ref;i&&!e.has(i.name)&&fk(i,e,r)}})}function pd(t){if(t.terminal)return t.terminal;if(t.type.ref){let e=Mu(t.type.ref);return e?.terminal}}function dk(t){return t.hidden&&!Hn(t).test(" ")}function jo(t,e){return!t||!e?[]:nv(t,e,t.astNode,!0)}function Pr(t,e,r){if(!t||!e)return;let n=nv(t,e,t.astNode,!0);if(n.length!==0)return r!==void 0?r=Math.max(0,Math.min(r,n.length-1)):r=0,n[r]}function nv(t,e,r,n){if(!n){let i=rt(t.grammarSource,je);if(i&&i.feature===e)return[t]}return Pi(t)&&t.astNode===r?t.content.flatMap(i=>nv(i,e,r,!1)):[]}function vd(t,e){return t?pk(t,e,t?.astNode):[]}function Un(t,e,r){if(!t)return;let n=pk(t,e,t?.astNode);if(n.length!==0)return r!==void 0?r=Math.max(0,Math.min(r,n.length-1)):r=0,n[r]}function pk(t,e,r){if(t.astNode!==r)return[];if(Ht(t.grammarSource)&&t.grammarSource.value===e)return[t];let n=cy(t).iterator(),i,o=[];do if(i=n.next(),!i.done){let s=i.value;s.astNode===r?Ht(s.grammarSource)&&s.grammarSource.value===e&&o.push(s):n.prune()}while(!i.done);return o}function Ba(t){var e;let r=t.astNode;for(;r===((e=t.container)===null||e===void 0?void 0:e.astNode);){let n=rt(t.grammarSource,je);if(n)return n;t=t.container}}function Mu(t){return Ra(t)&&(t=t.$container),mk(t,new Map)}function mk(t,e){var r;function n(i,o){let s;return rt(i,je)||(s=mk(o,e)),e.set(t,s),s}if(e.has(t))return e.get(t);e.set(t,void 0);for(let i of St(t)){if(je(i)&&i.feature.toLowerCase()==="name")return e.set(t,i),i;if(tt(i)&&ee(i.rule.ref))return n(i,i.rule.ref);if(Hr(i)&&(!((r=i.typeRef)===null||r===void 0)&&r.ref))return n(i,i.typeRef.ref)}}function Zf(t){var e;let r=lk(Ud).grammar,n=r.serializer.JsonSerializer.deserialize(t);return r.shared.workspace.LangiumDocumentFactory.fromModel(n,Ar.parse(`memory://${(e=n.name)!==null&&e!==void 0?e:"grammar"}.langium`)),n}function hk(t){let e=[],r=t.Grammar;for(let n of r.rules)Be(n)&&dk(n)&&fS(Hn(n))&&e.push(n.name);return{multilineCommentRules:e,nameRegexp:uy}}var M$=typeof global=="object"&&global&&global.Object===Object&&global,Wd=M$;var $$=typeof self=="object"&&self&&self.Object===Object&&self,q$=Wd||$$||Function("return this")(),nr=q$;var F$=nr.Symbol,Rr=F$;var gk=Object.prototype,j$=gk.hasOwnProperty,U$=gk.toString,Gu=Rr?Rr.toStringTag:void 0;function W$(t){var e=j$.call(t,Gu),r=t[Gu];try{t[Gu]=void 0;var n=!0}catch{}var i=U$.call(t);return n&&(e?t[Gu]=r:delete t[Gu]),i}var yk=W$;var H$=Object.prototype,G$=H$.toString;function B$(t){return G$.call(t)}var vk=B$;var K$="[object Null]",z$="[object Undefined]",Tk=Rr?Rr.toStringTag:void 0;function V$(t){return t==null?t===void 0?z$:K$:Tk&&Tk in Object(t)?yk(t):vk(t)}var en=V$;function X$(t){return t!=null&&typeof t=="object"}var zt=X$;var Y$="[object Symbol]";function J$(t){return typeof t=="symbol"||zt(t)&&en(t)==Y$}var Oi=J$;function Q$(t,e){for(var r=-1,n=t==null?0:t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}var Li=Q$;var Z$=Array.isArray,oe=Z$;var eq=1/0,Rk=Rr?Rr.prototype:void 0,bk=Rk?Rk.toString:void 0;function xk(t){if(typeof t=="string")return t;if(oe(t))return Li(t,xk)+"";if(Oi(t))return bk?bk.call(t):"";var e=t+"";return e=="0"&&1/t==-eq?"-0":e}var _k=xk;var tq=/\s/;function rq(t){for(var e=t.length;e--&&tq.test(t.charAt(e)););return e}var Sk=rq;var nq=/^\s+/;function iq(t){return t&&t.slice(0,Sk(t)+1).replace(nq,"")}var kk=iq;function oq(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var Mt=oq;var Ck=0/0,sq=/^[-+]0x[0-9a-f]+$/i,aq=/^0b[01]+$/i,cq=/^0o[0-7]+$/i,uq=parseInt;function lq(t){if(typeof t=="number")return t;if(Oi(t))return Ck;if(Mt(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Mt(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=kk(t);var r=aq.test(t);return r||cq.test(t)?uq(t.slice(2),r?2:8):sq.test(t)?Ck:+t}var wk=lq;var Dk=1/0,fq=17976931348623157e292;function dq(t){if(!t)return t===0?t:0;if(t=wk(t),t===Dk||t===-Dk){var e=t<0?-1:1;return e*fq}return t===t?t:0}var Ek=dq;function pq(t){var e=Ek(t),r=e%1;return e===e?r?e-r:e:0}var Mi=pq;function mq(t){return t}var mn=mq;var hq="[object AsyncFunction]",gq="[object Function]",yq="[object GeneratorFunction]",vq="[object Proxy]";function Tq(t){if(!Mt(t))return!1;var e=en(t);return e==gq||e==yq||e==hq||e==vq}var tn=Tq;var Rq=nr["__core-js_shared__"],Hd=Rq;var Pk=function(){var t=/[^.]+$/.exec(Hd&&Hd.keys&&Hd.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function bq(t){return!!Pk&&Pk in t}var Ak=bq;var xq=Function.prototype,_q=xq.toString;function Sq(t){if(t!=null){try{return _q.call(t)}catch{}try{return t+""}catch{}}return""}var vo=Sq;var kq=/[\\^$.*+?()[\]{}|]/g,Cq=/^\[object .+?Constructor\]$/,wq=Function.prototype,Dq=Object.prototype,Eq=wq.toString,Pq=Dq.hasOwnProperty,Aq=RegExp("^"+Eq.call(Pq).replace(kq,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Nq(t){if(!Mt(t)||Ak(t))return!1;var e=tn(t)?Aq:Cq;return e.test(vo(t))}var Nk=Nq;function Iq(t,e){return t?.[e]}var Ik=Iq;function Oq(t,e){var r=Ik(t,e);return Nk(r)?r:void 0}var hn=Oq;var Lq=hn(nr,"WeakMap"),Gd=Lq;var Ok=Object.create,Mq=function(){function t(){}return function(e){if(!Mt(e))return{};if(Ok)return Ok(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),Lk=Mq;function $q(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}var Mk=$q;function qq(){}var $t=qq;function Fq(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}var $k=Fq;var jq=800,Uq=16,Wq=Date.now;function Hq(t){var e=0,r=0;return function(){var n=Wq(),i=Uq-(n-r);if(r=n,i>0){if(++e>=jq)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var qk=Hq;function Gq(t){return function(){return t}}var Fk=Gq;var Bq=function(){try{var t=hn(Object,"defineProperty");return t({},"",{}),t}catch{}}(),Va=Bq;var Kq=Va?function(t,e){return Va(t,"toString",{configurable:!0,enumerable:!1,value:Fk(e),writable:!0})}:mn,jk=Kq;var zq=qk(jk),Uk=zq;function Vq(t,e){for(var r=-1,n=t==null?0:t.length;++r<n&&e(t[r],r,t)!==!1;);return t}var Bd=Vq;function Xq(t,e,r,n){for(var i=t.length,o=r+(n?1:-1);n?o--:++o<i;)if(e(t[o],o,t))return o;return-1}var Kd=Xq;function Yq(t){return t!==t}var Wk=Yq;function Jq(t,e,r){for(var n=r-1,i=t.length;++n<i;)if(t[n]===e)return n;return-1}var Hk=Jq;function Qq(t,e,r){return e===e?Hk(t,e,r):Kd(t,Wk,r)}var Xa=Qq;function Zq(t,e){var r=t==null?0:t.length;return!!r&&Xa(t,e,0)>-1}var zd=Zq;var eF=9007199254740991,tF=/^(?:0|[1-9]\d*)$/;function rF(t,e){var r=typeof t;return e=e??eF,!!e&&(r=="number"||r!="symbol"&&tF.test(t))&&t>-1&&t%1==0&&t<e}var Bo=rF;function nF(t,e,r){e=="__proto__"&&Va?Va(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var Ya=nF;function iF(t,e){return t===e||t!==t&&e!==e}var $i=iF;var oF=Object.prototype,sF=oF.hasOwnProperty;function aF(t,e,r){var n=t[e];(!(sF.call(t,e)&&$i(n,r))||r===void 0&&!(e in t))&&Ya(t,e,r)}var Ko=aF;function cF(t,e,r,n){var i=!r;r||(r={});for(var o=-1,s=e.length;++o<s;){var a=e[o],c=n?n(r[a],t[a],a,r,t):void 0;c===void 0&&(c=t[a]),i?Ya(r,a,c):Ko(r,a,c)}return r}var qi=cF;var Gk=Math.max;function uF(t,e,r){return e=Gk(e===void 0?t.length-1:e,0),function(){for(var n=arguments,i=-1,o=Gk(n.length-e,0),s=Array(o);++i<o;)s[i]=n[e+i];i=-1;for(var a=Array(e+1);++i<e;)a[i]=n[i];return a[e]=r(s),Mk(t,this,a)}}var Bk=uF;function lF(t,e){return Uk(Bk(t,e,mn),t+"")}var Ja=lF;var fF=9007199254740991;function dF(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=fF}var Qa=dF;function pF(t){return t!=null&&Qa(t.length)&&!tn(t)}var ir=pF;function mF(t,e,r){if(!Mt(r))return!1;var n=typeof e;return(n=="number"?ir(r)&&Bo(e,r.length):n=="string"&&e in r)?$i(r[e],t):!1}var zo=mF;function hF(t){return Ja(function(e,r){var n=-1,i=r.length,o=i>1?r[i-1]:void 0,s=i>2?r[2]:void 0;for(o=t.length>3&&typeof o=="function"?(i--,o):void 0,s&&zo(r[0],r[1],s)&&(o=i<3?void 0:o,i=1),e=Object(e);++n<i;){var a=r[n];a&&t(e,a,n,o)}return e})}var Kk=hF;var gF=Object.prototype;function yF(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||gF;return t===r}var Fi=yF;function vF(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}var zk=vF;var TF="[object Arguments]";function RF(t){return zt(t)&&en(t)==TF}var iv=RF;var Vk=Object.prototype,bF=Vk.hasOwnProperty,xF=Vk.propertyIsEnumerable,_F=iv(function(){return arguments}())?iv:function(t){return zt(t)&&bF.call(t,"callee")&&!xF.call(t,"callee")},Vo=_F;function SF(){return!1}var Xk=SF;var Qk=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Yk=Qk&&typeof module=="object"&&module&&!module.nodeType&&module,kF=Yk&&Yk.exports===Qk,Jk=kF?nr.Buffer:void 0,CF=Jk?Jk.isBuffer:void 0,wF=CF||Xk,To=wF;var DF="[object Arguments]",EF="[object Array]",PF="[object Boolean]",AF="[object Date]",NF="[object Error]",IF="[object Function]",OF="[object Map]",LF="[object Number]",MF="[object Object]",$F="[object RegExp]",qF="[object Set]",FF="[object String]",jF="[object WeakMap]",UF="[object ArrayBuffer]",WF="[object DataView]",HF="[object Float32Array]",GF="[object Float64Array]",BF="[object Int8Array]",KF="[object Int16Array]",zF="[object Int32Array]",VF="[object Uint8Array]",XF="[object Uint8ClampedArray]",YF="[object Uint16Array]",JF="[object Uint32Array]",xt={};xt[HF]=xt[GF]=xt[BF]=xt[KF]=xt[zF]=xt[VF]=xt[XF]=xt[YF]=xt[JF]=!0;xt[DF]=xt[EF]=xt[UF]=xt[PF]=xt[WF]=xt[AF]=xt[NF]=xt[IF]=xt[OF]=xt[LF]=xt[MF]=xt[$F]=xt[qF]=xt[FF]=xt[jF]=!1;function QF(t){return zt(t)&&Qa(t.length)&&!!xt[en(t)]}var Zk=QF;function ZF(t){return function(e){return t(e)}}var ji=ZF;var eC=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Bu=eC&&typeof module=="object"&&module&&!module.nodeType&&module,e1=Bu&&Bu.exports===eC,ov=e1&&Wd.process,t1=function(){try{var t=Bu&&Bu.require&&Bu.require("util").types;return t||ov&&ov.binding&&ov.binding("util")}catch{}}(),Bn=t1;var tC=Bn&&Bn.isTypedArray,r1=tC?ji(tC):Zk,Za=r1;var n1=Object.prototype,i1=n1.hasOwnProperty;function o1(t,e){var r=oe(t),n=!r&&Vo(t),i=!r&&!n&&To(t),o=!r&&!n&&!i&&Za(t),s=r||n||i||o,a=s?zk(t.length,String):[],c=a.length;for(var f in t)(e||i1.call(t,f))&&!(s&&(f=="length"||i&&(f=="offset"||f=="parent")||o&&(f=="buffer"||f=="byteLength"||f=="byteOffset")||Bo(f,c)))&&a.push(f);return a}var Vd=o1;function s1(t,e){return function(r){return t(e(r))}}var Xd=s1;var a1=Xd(Object.keys,Object),rC=a1;var c1=Object.prototype,u1=c1.hasOwnProperty;function l1(t){if(!Fi(t))return rC(t);var e=[];for(var r in Object(t))u1.call(t,r)&&r!="constructor"&&e.push(r);return e}var Yd=l1;function f1(t){return ir(t)?Vd(t):Yd(t)}var dt=f1;var d1=Object.prototype,p1=d1.hasOwnProperty,m1=Kk(function(t,e){if(Fi(e)||ir(e)){qi(e,dt(e),t);return}for(var r in e)p1.call(e,r)&&Ko(t,r,e[r])}),Nr=m1;function h1(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var nC=h1;var g1=Object.prototype,y1=g1.hasOwnProperty;function v1(t){if(!Mt(t))return nC(t);var e=Fi(t),r=[];for(var n in t)n=="constructor"&&(e||!y1.call(t,n))||r.push(n);return r}var iC=v1;function T1(t){return ir(t)?Vd(t,!0):iC(t)}var Xo=T1;var R1=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,b1=/^\w*$/;function x1(t,e){if(oe(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||Oi(t)?!0:b1.test(t)||!R1.test(t)||e!=null&&t in Object(e)}var ec=x1;var _1=hn(Object,"create"),Ro=_1;function S1(){this.__data__=Ro?Ro(null):{},this.size=0}var oC=S1;function k1(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var sC=k1;var C1="__lodash_hash_undefined__",w1=Object.prototype,D1=w1.hasOwnProperty;function E1(t){var e=this.__data__;if(Ro){var r=e[t];return r===C1?void 0:r}return D1.call(e,t)?e[t]:void 0}var aC=E1;var P1=Object.prototype,A1=P1.hasOwnProperty;function N1(t){var e=this.__data__;return Ro?e[t]!==void 0:A1.call(e,t)}var cC=N1;var I1="__lodash_hash_undefined__";function O1(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=Ro&&e===void 0?I1:e,this}var uC=O1;function tc(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}tc.prototype.clear=oC;tc.prototype.delete=sC;tc.prototype.get=aC;tc.prototype.has=cC;tc.prototype.set=uC;var sv=tc;function L1(){this.__data__=[],this.size=0}var lC=L1;function M1(t,e){for(var r=t.length;r--;)if($i(t[r][0],e))return r;return-1}var Yo=M1;var $1=Array.prototype,q1=$1.splice;function F1(t){var e=this.__data__,r=Yo(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():q1.call(e,r,1),--this.size,!0}var fC=F1;function j1(t){var e=this.__data__,r=Yo(e,t);return r<0?void 0:e[r][1]}var dC=j1;function U1(t){return Yo(this.__data__,t)>-1}var pC=U1;function W1(t,e){var r=this.__data__,n=Yo(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}var mC=W1;function rc(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}rc.prototype.clear=lC;rc.prototype.delete=fC;rc.prototype.get=dC;rc.prototype.has=pC;rc.prototype.set=mC;var Jo=rc;var H1=hn(nr,"Map"),Qo=H1;function G1(){this.size=0,this.__data__={hash:new sv,map:new(Qo||Jo),string:new sv}}var hC=G1;function B1(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var gC=B1;function K1(t,e){var r=t.__data__;return gC(e)?r[typeof e=="string"?"string":"hash"]:r.map}var Zo=K1;function z1(t){var e=Zo(this,t).delete(t);return this.size-=e?1:0,e}var yC=z1;function V1(t){return Zo(this,t).get(t)}var vC=V1;function X1(t){return Zo(this,t).has(t)}var TC=X1;function Y1(t,e){var r=Zo(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}var RC=Y1;function nc(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}nc.prototype.clear=hC;nc.prototype.delete=yC;nc.prototype.get=vC;nc.prototype.has=TC;nc.prototype.set=RC;var Fs=nc;var J1="Expected a function";function av(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(J1);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var s=t.apply(this,n);return r.cache=o.set(i,s)||o,s};return r.cache=new(av.Cache||Fs),r}av.Cache=Fs;var bC=av;var Q1=500;function Z1(t){var e=bC(t,function(n){return r.size===Q1&&r.clear(),n}),r=e.cache;return e}var xC=Z1;var ej=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,tj=/\\(\\)?/g,rj=xC(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(ej,function(r,n,i,o){e.push(i?o.replace(tj,"$1"):n||r)}),e}),_C=rj;function nj(t){return t==null?"":_k(t)}var SC=nj;function ij(t,e){return oe(t)?t:ec(t,e)?[t]:_C(SC(t))}var es=ij;var oj=1/0;function sj(t){if(typeof t=="string"||Oi(t))return t;var e=t+"";return e=="0"&&1/t==-oj?"-0":e}var Ui=sj;function aj(t,e){e=es(e,t);for(var r=0,n=e.length;t!=null&&r<n;)t=t[Ui(e[r++])];return r&&r==n?t:void 0}var ic=aj;function cj(t,e,r){var n=t==null?void 0:ic(t,e);return n===void 0?r:n}var kC=cj;function uj(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}var oc=uj;var CC=Rr?Rr.isConcatSpreadable:void 0;function lj(t){return oe(t)||Vo(t)||!!(CC&&t&&t[CC])}var wC=lj;function DC(t,e,r,n,i){var o=-1,s=t.length;for(r||(r=wC),i||(i=[]);++o<s;){var a=t[o];e>0&&r(a)?e>1?DC(a,e-1,r,n,i):oc(i,a):n||(i[i.length]=a)}return i}var sc=DC;function fj(t){var e=t==null?0:t.length;return e?sc(t,1):[]}var Vt=fj;var dj=Xd(Object.getPrototypeOf,Object),Jd=dj;function pj(t,e,r){var n=-1,i=t.length;e<0&&(e=-e>i?0:i+e),r=r>i?i:r,r<0&&(r+=i),i=e>r?0:r-e>>>0,e>>>=0;for(var o=Array(i);++n<i;)o[n]=t[n+e];return o}var Qd=pj;function mj(t,e,r,n){var i=-1,o=t==null?0:t.length;for(n&&o&&(r=t[++i]);++i<o;)r=e(r,t[i],i,t);return r}var EC=mj;function hj(){this.__data__=new Jo,this.size=0}var PC=hj;function gj(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var AC=gj;function yj(t){return this.__data__.get(t)}var NC=yj;function vj(t){return this.__data__.has(t)}var IC=vj;var Tj=200;function Rj(t,e){var r=this.__data__;if(r instanceof Jo){var n=r.__data__;if(!Qo||n.length<Tj-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new Fs(n)}return r.set(t,e),this.size=r.size,this}var OC=Rj;function ac(t){var e=this.__data__=new Jo(t);this.size=e.size}ac.prototype.clear=PC;ac.prototype.delete=AC;ac.prototype.get=NC;ac.prototype.has=IC;ac.prototype.set=OC;var ts=ac;function bj(t,e){return t&&qi(e,dt(e),t)}var LC=bj;function xj(t,e){return t&&qi(e,Xo(e),t)}var MC=xj;var jC=typeof exports=="object"&&exports&&!exports.nodeType&&exports,$C=jC&&typeof module=="object"&&module&&!module.nodeType&&module,_j=$C&&$C.exports===jC,qC=_j?nr.Buffer:void 0,FC=qC?qC.allocUnsafe:void 0;function Sj(t,e){if(e)return t.slice();var r=t.length,n=FC?FC(r):new t.constructor(r);return t.copy(n),n}var UC=Sj;function kj(t,e){for(var r=-1,n=t==null?0:t.length,i=0,o=[];++r<n;){var s=t[r];e(s,r,t)&&(o[i++]=s)}return o}var cc=kj;function Cj(){return[]}var Zd=Cj;var wj=Object.prototype,Dj=wj.propertyIsEnumerable,WC=Object.getOwnPropertySymbols,Ej=WC?function(t){return t==null?[]:(t=Object(t),cc(WC(t),function(e){return Dj.call(t,e)}))}:Zd,uc=Ej;function Pj(t,e){return qi(t,uc(t),e)}var HC=Pj;var Aj=Object.getOwnPropertySymbols,Nj=Aj?function(t){for(var e=[];t;)oc(e,uc(t)),t=Jd(t);return e}:Zd,ep=Nj;function Ij(t,e){return qi(t,ep(t),e)}var GC=Ij;function Oj(t,e,r){var n=e(t);return oe(t)?n:oc(n,r(t))}var tp=Oj;function Lj(t){return tp(t,dt,uc)}var Ku=Lj;function Mj(t){return tp(t,Xo,ep)}var rp=Mj;var $j=hn(nr,"DataView"),np=$j;var qj=hn(nr,"Promise"),ip=qj;var Fj=hn(nr,"Set"),rs=Fj;var BC="[object Map]",jj="[object Object]",KC="[object Promise]",zC="[object Set]",VC="[object WeakMap]",XC="[object DataView]",Uj=vo(np),Wj=vo(Qo),Hj=vo(ip),Gj=vo(rs),Bj=vo(Gd),js=en;(np&&js(new np(new ArrayBuffer(1)))!=XC||Qo&&js(new Qo)!=BC||ip&&js(ip.resolve())!=KC||rs&&js(new rs)!=zC||Gd&&js(new Gd)!=VC)&&(js=function(t){var e=en(t),r=e==jj?t.constructor:void 0,n=r?vo(r):"";if(n)switch(n){case Uj:return XC;case Wj:return BC;case Hj:return KC;case Gj:return zC;case Bj:return VC}return e});var pi=js;var Kj=Object.prototype,zj=Kj.hasOwnProperty;function Vj(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&zj.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var YC=Vj;var Xj=nr.Uint8Array,lc=Xj;function Yj(t){var e=new t.constructor(t.byteLength);return new lc(e).set(new lc(t)),e}var fc=Yj;function Jj(t,e){var r=e?fc(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var JC=Jj;var Qj=/\w*$/;function Zj(t){var e=new t.constructor(t.source,Qj.exec(t));return e.lastIndex=t.lastIndex,e}var QC=Zj;var ZC=Rr?Rr.prototype:void 0,ew=ZC?ZC.valueOf:void 0;function eU(t){return ew?Object(ew.call(t)):{}}var tw=eU;function tU(t,e){var r=e?fc(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var rw=tU;var rU="[object Boolean]",nU="[object Date]",iU="[object Map]",oU="[object Number]",sU="[object RegExp]",aU="[object Set]",cU="[object String]",uU="[object Symbol]",lU="[object ArrayBuffer]",fU="[object DataView]",dU="[object Float32Array]",pU="[object Float64Array]",mU="[object Int8Array]",hU="[object Int16Array]",gU="[object Int32Array]",yU="[object Uint8Array]",vU="[object Uint8ClampedArray]",TU="[object Uint16Array]",RU="[object Uint32Array]";function bU(t,e,r){var n=t.constructor;switch(e){case lU:return fc(t);case rU:case nU:return new n(+t);case fU:return JC(t,r);case dU:case pU:case mU:case hU:case gU:case yU:case vU:case TU:case RU:return rw(t,r);case iU:return new n;case oU:case cU:return new n(t);case sU:return QC(t);case aU:return new n;case uU:return tw(t)}}var nw=bU;function xU(t){return typeof t.constructor=="function"&&!Fi(t)?Lk(Jd(t)):{}}var iw=xU;var _U="[object Map]";function SU(t){return zt(t)&&pi(t)==_U}var ow=SU;var sw=Bn&&Bn.isMap,kU=sw?ji(sw):ow,aw=kU;var CU="[object Set]";function wU(t){return zt(t)&&pi(t)==CU}var cw=wU;var uw=Bn&&Bn.isSet,DU=uw?ji(uw):cw,lw=DU;var EU=1,PU=2,AU=4,fw="[object Arguments]",NU="[object Array]",IU="[object Boolean]",OU="[object Date]",LU="[object Error]",dw="[object Function]",MU="[object GeneratorFunction]",$U="[object Map]",qU="[object Number]",pw="[object Object]",FU="[object RegExp]",jU="[object Set]",UU="[object String]",WU="[object Symbol]",HU="[object WeakMap]",GU="[object ArrayBuffer]",BU="[object DataView]",KU="[object Float32Array]",zU="[object Float64Array]",VU="[object Int8Array]",XU="[object Int16Array]",YU="[object Int32Array]",JU="[object Uint8Array]",QU="[object Uint8ClampedArray]",ZU="[object Uint16Array]",eW="[object Uint32Array]",pt={};pt[fw]=pt[NU]=pt[GU]=pt[BU]=pt[IU]=pt[OU]=pt[KU]=pt[zU]=pt[VU]=pt[XU]=pt[YU]=pt[$U]=pt[qU]=pt[pw]=pt[FU]=pt[jU]=pt[UU]=pt[WU]=pt[JU]=pt[QU]=pt[ZU]=pt[eW]=!0;pt[LU]=pt[dw]=pt[HU]=!1;function op(t,e,r,n,i,o){var s,a=e&EU,c=e&PU,f=e&AU;if(r&&(s=i?r(t,n,i,o):r(t)),s!==void 0)return s;if(!Mt(t))return t;var p=oe(t);if(p){if(s=YC(t),!a)return $k(t,s)}else{var m=pi(t),T=m==dw||m==MU;if(To(t))return UC(t,a);if(m==pw||m==fw||T&&!i){if(s=c||T?{}:iw(t),!a)return c?GC(t,MC(s,t)):HC(t,LC(s,t))}else{if(!pt[m])return i?t:{};s=nw(t,m,a)}}o||(o=new ts);var _=o.get(t);if(_)return _;o.set(t,s),lw(t)?t.forEach(function(I){s.add(op(I,e,r,I,t,o))}):aw(t)&&t.forEach(function(I,A){s.set(A,op(I,e,r,A,t,o))});var E=f?c?rp:Ku:c?Xo:dt,N=p?void 0:E(t);return Bd(N||t,function(I,A){N&&(A=I,I=t[A]),Ko(s,A,op(I,e,r,A,t,o))}),s}var mw=op;var tW=4;function rW(t){return mw(t,tW)}var mt=rW;function nW(t){for(var e=-1,r=t==null?0:t.length,n=0,i=[];++e<r;){var o=t[e];o&&(i[n++]=o)}return i}var Wi=nW;var iW="__lodash_hash_undefined__";function oW(t){return this.__data__.set(t,iW),this}var hw=oW;function sW(t){return this.__data__.has(t)}var gw=sW;function sp(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new Fs;++e<r;)this.add(t[e])}sp.prototype.add=sp.prototype.push=hw;sp.prototype.has=gw;var dc=sp;function aW(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}var ap=aW;function cW(t,e){return t.has(e)}var pc=cW;var uW=1,lW=2;function fW(t,e,r,n,i,o){var s=r&uW,a=t.length,c=e.length;if(a!=c&&!(s&&c>a))return!1;var f=o.get(t),p=o.get(e);if(f&&p)return f==e&&p==t;var m=-1,T=!0,_=r&lW?new dc:void 0;for(o.set(t,e),o.set(e,t);++m<a;){var E=t[m],N=e[m];if(n)var I=s?n(N,E,m,e,t,o):n(E,N,m,t,e,o);if(I!==void 0){if(I)continue;T=!1;break}if(_){if(!ap(e,function(A,y){if(!pc(_,y)&&(E===A||i(E,A,r,n,o)))return _.push(y)})){T=!1;break}}else if(!(E===N||i(E,N,r,n,o))){T=!1;break}}return o.delete(t),o.delete(e),T}var cp=fW;function dW(t){var e=-1,r=Array(t.size);return t.forEach(function(n,i){r[++e]=[i,n]}),r}var yw=dW;function pW(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var mc=pW;var mW=1,hW=2,gW="[object Boolean]",yW="[object Date]",vW="[object Error]",TW="[object Map]",RW="[object Number]",bW="[object RegExp]",xW="[object Set]",_W="[object String]",SW="[object Symbol]",kW="[object ArrayBuffer]",CW="[object DataView]",vw=Rr?Rr.prototype:void 0,cv=vw?vw.valueOf:void 0;function wW(t,e,r,n,i,o,s){switch(r){case CW:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case kW:return!(t.byteLength!=e.byteLength||!o(new lc(t),new lc(e)));case gW:case yW:case RW:return $i(+t,+e);case vW:return t.name==e.name&&t.message==e.message;case bW:case _W:return t==e+"";case TW:var a=yw;case xW:var c=n&mW;if(a||(a=mc),t.size!=e.size&&!c)return!1;var f=s.get(t);if(f)return f==e;n|=hW,s.set(t,e);var p=cp(a(t),a(e),n,i,o,s);return s.delete(t),p;case SW:if(cv)return cv.call(t)==cv.call(e)}return!1}var Tw=wW;var DW=1,EW=Object.prototype,PW=EW.hasOwnProperty;function AW(t,e,r,n,i,o){var s=r&DW,a=Ku(t),c=a.length,f=Ku(e),p=f.length;if(c!=p&&!s)return!1;for(var m=c;m--;){var T=a[m];if(!(s?T in e:PW.call(e,T)))return!1}var _=o.get(t),E=o.get(e);if(_&&E)return _==e&&E==t;var N=!0;o.set(t,e),o.set(e,t);for(var I=s;++m<c;){T=a[m];var A=t[T],y=e[T];if(n)var h=s?n(y,A,T,e,t,o):n(A,y,T,t,e,o);if(!(h===void 0?A===y||i(A,y,r,n,o):h)){N=!1;break}I||(I=T=="constructor")}if(N&&!I){var C=t.constructor,L=e.constructor;C!=L&&"constructor"in t&&"constructor"in e&&!(typeof C=="function"&&C instanceof C&&typeof L=="function"&&L instanceof L)&&(N=!1)}return o.delete(t),o.delete(e),N}var Rw=AW;var NW=1,bw="[object Arguments]",xw="[object Array]",up="[object Object]",IW=Object.prototype,_w=IW.hasOwnProperty;function OW(t,e,r,n,i,o){var s=oe(t),a=oe(e),c=s?xw:pi(t),f=a?xw:pi(e);c=c==bw?up:c,f=f==bw?up:f;var p=c==up,m=f==up,T=c==f;if(T&&To(t)){if(!To(e))return!1;s=!0,p=!1}if(T&&!p)return o||(o=new ts),s||Za(t)?cp(t,e,r,n,i,o):Tw(t,e,c,r,n,i,o);if(!(r&NW)){var _=p&&_w.call(t,"__wrapped__"),E=m&&_w.call(e,"__wrapped__");if(_||E){var N=_?t.value():t,I=E?e.value():e;return o||(o=new ts),i(N,I,r,n,o)}}return T?(o||(o=new ts),Rw(t,e,r,n,i,o)):!1}var Sw=OW;function kw(t,e,r,n,i){return t===e?!0:t==null||e==null||!zt(t)&&!zt(e)?t!==t&&e!==e:Sw(t,e,r,n,kw,i)}var lp=kw;var LW=1,MW=2;function $W(t,e,r,n){var i=r.length,o=i,s=!n;if(t==null)return!o;for(t=Object(t);i--;){var a=r[i];if(s&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++i<o;){a=r[i];var c=a[0],f=t[c],p=a[1];if(s&&a[2]){if(f===void 0&&!(c in t))return!1}else{var m=new ts;if(n)var T=n(f,p,c,t,e,m);if(!(T===void 0?lp(p,f,LW|MW,n,m):T))return!1}}return!0}var Cw=$W;function qW(t){return t===t&&!Mt(t)}var fp=qW;function FW(t){for(var e=dt(t),r=e.length;r--;){var n=e[r],i=t[n];e[r]=[n,i,fp(i)]}return e}var ww=FW;function jW(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}var dp=jW;function UW(t){var e=ww(t);return e.length==1&&e[0][2]?dp(e[0][0],e[0][1]):function(r){return r===t||Cw(r,t,e)}}var Dw=UW;function WW(t,e){return t!=null&&e in Object(t)}var Ew=WW;function HW(t,e,r){e=es(e,t);for(var n=-1,i=e.length,o=!1;++n<i;){var s=Ui(e[n]);if(!(o=t!=null&&r(t,s)))break;t=t[s]}return o||++n!=i?o:(i=t==null?0:t.length,!!i&&Qa(i)&&Bo(s,i)&&(oe(t)||Vo(t)))}var pp=HW;function GW(t,e){return t!=null&&pp(t,e,Ew)}var Pw=GW;var BW=1,KW=2;function zW(t,e){return ec(t)&&fp(e)?dp(Ui(t),e):function(r){var n=kC(r,t);return n===void 0&&n===e?Pw(r,t):lp(e,n,BW|KW)}}var Aw=zW;function VW(t){return function(e){return e?.[t]}}var Nw=VW;function XW(t){return function(e){return ic(e,t)}}var Iw=XW;function YW(t){return ec(t)?Nw(Ui(t)):Iw(t)}var Ow=YW;function JW(t){return typeof t=="function"?t:t==null?mn:typeof t=="object"?oe(t)?Aw(t[0],t[1]):Dw(t):Ow(t)}var Gt=JW;function QW(t,e,r,n){for(var i=-1,o=t==null?0:t.length;++i<o;){var s=t[i];e(n,s,r(s),t)}return n}var Lw=QW;function ZW(t){return function(e,r,n){for(var i=-1,o=Object(e),s=n(e),a=s.length;a--;){var c=s[t?a:++i];if(r(o[c],c,o)===!1)break}return e}}var Mw=ZW;var eH=Mw(),$w=eH;function tH(t,e){return t&&$w(t,e,dt)}var qw=tH;function rH(t,e){return function(r,n){if(r==null)return r;if(!ir(r))return t(r,n);for(var i=r.length,o=e?i:-1,s=Object(r);(e?o--:++o<i)&&n(s[o],o,s)!==!1;);return r}}var Fw=rH;var nH=Fw(qw),gn=nH;function iH(t,e,r,n){return gn(t,function(i,o,s){e(n,i,r(i),s)}),n}var jw=iH;function oH(t,e){return function(r,n){var i=oe(r)?Lw:jw,o=e?e():{};return i(r,t,Gt(n,2),o)}}var Uw=oH;var Ww=Object.prototype,sH=Ww.hasOwnProperty,aH=Ja(function(t,e){t=Object(t);var r=-1,n=e.length,i=n>2?e[2]:void 0;for(i&&zo(e[0],e[1],i)&&(n=1);++r<n;)for(var o=e[r],s=Xo(o),a=-1,c=s.length;++a<c;){var f=s[a],p=t[f];(p===void 0||$i(p,Ww[f])&&!sH.call(t,f))&&(t[f]=o[f])}return t}),hc=aH;function cH(t){return zt(t)&&ir(t)}var uv=cH;function uH(t,e,r){for(var n=-1,i=t==null?0:t.length;++n<i;)if(r(e,t[n]))return!0;return!1}var mp=uH;var lH=200;function fH(t,e,r,n){var i=-1,o=zd,s=!0,a=t.length,c=[],f=e.length;if(!a)return c;r&&(e=Li(e,ji(r))),n?(o=mp,s=!1):e.length>=lH&&(o=pc,s=!1,e=new dc(e));e:for(;++i<a;){var p=t[i],m=r==null?p:r(p);if(p=n||p!==0?p:0,s&&m===m){for(var T=f;T--;)if(e[T]===m)continue e;c.push(p)}else o(e,m,n)||c.push(p)}return c}var Hw=fH;var dH=Ja(function(t,e){return uv(t)?Hw(t,sc(e,1,uv,!0)):[]}),ns=dH;function pH(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}var Hi=pH;function mH(t,e,r){var n=t==null?0:t.length;return n?(e=r||e===void 0?1:Mi(e),Qd(t,e<0?0:e,n)):[]}var Xt=mH;function hH(t,e,r){var n=t==null?0:t.length;return n?(e=r||e===void 0?1:Mi(e),e=n-e,Qd(t,0,e<0?0:e)):[]}var bo=hH;function gH(t){return typeof t=="function"?t:mn}var Gw=gH;function yH(t,e){var r=oe(t)?Bd:gn;return r(t,Gw(e))}var Z=yH;function vH(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(!e(t[r],r,t))return!1;return!0}var Bw=vH;function TH(t,e){var r=!0;return gn(t,function(n,i,o){return r=!!e(n,i,o),r}),r}var Kw=TH;function RH(t,e,r){var n=oe(t)?Bw:Kw;return r&&zo(t,e,r)&&(e=void 0),n(t,Gt(e,3))}var Kr=RH;function bH(t,e){var r=[];return gn(t,function(n,i,o){e(n,i,o)&&r.push(n)}),r}var hp=bH;function xH(t,e){var r=oe(t)?cc:hp;return r(t,Gt(e,3))}var br=xH;function _H(t){return function(e,r,n){var i=Object(e);if(!ir(e)){var o=Gt(r,3);e=dt(e),r=function(a){return o(i[a],a,i)}}var s=t(e,r,n);return s>-1?i[o?e[s]:s]:void 0}}var zw=_H;var SH=Math.max;function kH(t,e,r){var n=t==null?0:t.length;if(!n)return-1;var i=r==null?0:Mi(r);return i<0&&(i=SH(n+i,0)),Kd(t,Gt(e,3),i)}var Vw=kH;var CH=zw(Vw),Gi=CH;function wH(t){return t&&t.length?t[0]:void 0}var xr=wH;function DH(t,e){var r=-1,n=ir(t)?Array(t.length):[];return gn(t,function(i,o,s){n[++r]=e(i,o,s)}),n}var Xw=DH;function EH(t,e){var r=oe(t)?Li:Xw;return r(t,Gt(e,3))}var z=EH;function PH(t,e){return sc(z(t,e),1)}var Ir=PH;var AH=Object.prototype,NH=AH.hasOwnProperty,IH=Uw(function(t,e,r){NH.call(t,r)?t[r].push(e):Ya(t,r,[e])}),lv=IH;var OH=Object.prototype,LH=OH.hasOwnProperty;function MH(t,e){return t!=null&&LH.call(t,e)}var Yw=MH;function $H(t,e){return t!=null&&pp(t,e,Yw)}var te=$H;var qH="[object String]";function FH(t){return typeof t=="string"||!oe(t)&&zt(t)&&en(t)==qH}var mr=FH;function jH(t,e){return Li(e,function(r){return t[r]})}var Jw=jH;function UH(t){return t==null?[]:Jw(t,dt(t))}var at=UH;var WH=Math.max;function HH(t,e,r,n){t=ir(t)?t:at(t),r=r&&!n?Mi(r):0;var i=t.length;return r<0&&(r=WH(i+r,0)),mr(t)?r<=i&&t.indexOf(e,r)>-1:!!i&&Xa(t,e,r)>-1}var Ct=HH;var GH=Math.max;function BH(t,e,r){var n=t==null?0:t.length;if(!n)return-1;var i=r==null?0:Mi(r);return i<0&&(i=GH(n+i,0)),Xa(t,e,i)}var gp=BH;var KH="[object Map]",zH="[object Set]",VH=Object.prototype,XH=VH.hasOwnProperty;function YH(t){if(t==null)return!0;if(ir(t)&&(oe(t)||typeof t=="string"||typeof t.splice=="function"||To(t)||Za(t)||Vo(t)))return!t.length;var e=pi(t);if(e==KH||e==zH)return!t.size;if(Fi(t))return!Yd(t).length;for(var r in t)if(XH.call(t,r))return!1;return!0}var De=YH;var JH="[object RegExp]";function QH(t){return zt(t)&&en(t)==JH}var Qw=QH;var Zw=Bn&&Bn.isRegExp,ZH=Zw?ji(Zw):Qw,Kn=ZH;function eG(t){return t===void 0}var zr=eG;function tG(t,e){return t<e}var eD=tG;function rG(t,e,r){for(var n=-1,i=t.length;++n<i;){var o=t[n],s=e(o);if(s!=null&&(a===void 0?s===s&&!Oi(s):r(s,a)))var a=s,c=o}return c}var tD=rG;function nG(t){return t&&t.length?tD(t,mn,eD):void 0}var rD=nG;var iG="Expected a function";function oG(t){if(typeof t!="function")throw new TypeError(iG);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}var nD=oG;function sG(t,e,r,n){if(!Mt(t))return t;e=es(e,t);for(var i=-1,o=e.length,s=o-1,a=t;a!=null&&++i<o;){var c=Ui(e[i]),f=r;if(c==="__proto__"||c==="constructor"||c==="prototype")return t;if(i!=s){var p=a[c];f=n?n(p,c,a):void 0,f===void 0&&(f=Mt(p)?p:Bo(e[i+1])?[]:{})}Ko(a,c,f),a=a[c]}return t}var iD=sG;function aG(t,e,r){for(var n=-1,i=e.length,o={};++n<i;){var s=e[n],a=ic(t,s);r(a,s)&&iD(o,es(s,t),a)}return o}var oD=aG;function cG(t,e){if(t==null)return{};var r=Li(rp(t),function(n){return[n]});return e=Gt(e),oD(t,r,function(n,i){return e(n,i[0])})}var yn=cG;function uG(t,e,r,n,i){return i(t,function(o,s,a){r=n?(n=!1,o):e(r,o,s,a)}),r}var sD=uG;function lG(t,e,r){var n=oe(t)?EC:sD,i=arguments.length<3;return n(t,Gt(e,4),r,i,gn)}var qt=lG;function fG(t,e){var r=oe(t)?cc:hp;return r(t,nD(Gt(e,3)))}var is=fG;function dG(t,e){var r;return gn(t,function(n,i,o){return r=e(n,i,o),!r}),!!r}var aD=dG;function pG(t,e,r){var n=oe(t)?ap:aD;return r&&zo(t,e,r)&&(e=void 0),n(t,Gt(e,3))}var zu=pG;var mG=1/0,hG=rs&&1/mc(new rs([,-0]))[1]==mG?function(t){return new rs(t)}:$t,cD=hG;var gG=200;function yG(t,e,r){var n=-1,i=zd,o=t.length,s=!0,a=[],c=a;if(r)s=!1,i=mp;else if(o>=gG){var f=e?null:cD(t);if(f)return mc(f);s=!1,i=pc,c=new dc}else c=e?[]:a;e:for(;++n<o;){var p=t[n],m=e?e(p):p;if(p=r||p!==0?p:0,s&&m===m){for(var T=c.length;T--;)if(c[T]===m)continue e;e&&c.push(m),a.push(p)}else i(c,m,r)||(c!==a&&c.push(m),a.push(p))}return a}var yp=yG;function vG(t){return t&&t.length?yp(t):[]}var gc=vG;function TG(t,e){return t&&t.length?yp(t,Gt(e,2)):[]}var uD=TG;function yc(t){console&&console.error&&console.error(`Error: ${t}`)}function Vu(t){console&&console.warn&&console.warn(`Warning: ${t}`)}function Xu(t){let e=new Date().getTime(),r=t();return{time:new Date().getTime()-e,value:r}}function Yu(t){function e(){}e.prototype=t;let r=new e;function n(){return typeof r.bar}return n(),n(),t;(0,eval)(t)}function RG(t){return bG(t)?t.LABEL:t.name}function bG(t){return mr(t.LABEL)&&t.LABEL!==""}var An=class{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),Z(this.definition,r=>{r.accept(e)})}},ze=class extends An{constructor(e){super([]),this.idx=1,Nr(this,yn(e,r=>r!==void 0))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}},rn=class extends An{constructor(e){super(e.definition),this.orgText="",Nr(this,yn(e,r=>r!==void 0))}},ht=class extends An{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,Nr(this,yn(e,r=>r!==void 0))}},Ve=class extends An{constructor(e){super(e.definition),this.idx=1,Nr(this,yn(e,r=>r!==void 0))}},gt=class extends An{constructor(e){super(e.definition),this.idx=1,Nr(this,yn(e,r=>r!==void 0))}},yt=class extends An{constructor(e){super(e.definition),this.idx=1,Nr(this,yn(e,r=>r!==void 0))}},Oe=class extends An{constructor(e){super(e.definition),this.idx=1,Nr(this,yn(e,r=>r!==void 0))}},ut=class extends An{constructor(e){super(e.definition),this.idx=1,Nr(this,yn(e,r=>r!==void 0))}},lt=class extends An{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,Nr(this,yn(e,r=>r!==void 0))}},Ee=class{constructor(e){this.idx=1,Nr(this,yn(e,r=>r!==void 0))}accept(e){e.visit(this)}};function vp(t){return z(t,vc)}function vc(t){function e(r){return z(r,vc)}if(t instanceof ze){let r={type:"NonTerminal",name:t.nonTerminalName,idx:t.idx};return mr(t.label)&&(r.label=t.label),r}else{if(t instanceof ht)return{type:"Alternative",definition:e(t.definition)};if(t instanceof Ve)return{type:"Option",idx:t.idx,definition:e(t.definition)};if(t instanceof gt)return{type:"RepetitionMandatory",idx:t.idx,definition:e(t.definition)};if(t instanceof yt)return{type:"RepetitionMandatoryWithSeparator",idx:t.idx,separator:vc(new Ee({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof ut)return{type:"RepetitionWithSeparator",idx:t.idx,separator:vc(new Ee({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof Oe)return{type:"Repetition",idx:t.idx,definition:e(t.definition)};if(t instanceof lt)return{type:"Alternation",idx:t.idx,definition:e(t.definition)};if(t instanceof Ee){let r={type:"Terminal",name:t.terminalType.name,label:RG(t.terminalType),idx:t.idx};mr(t.label)&&(r.terminalLabel=t.label);let n=t.terminalType.PATTERN;return t.terminalType.PATTERN&&(r.pattern=Kn(n)?n.source:n),r}else{if(t instanceof rn)return{type:"Rule",name:t.name,orgText:t.orgText,definition:e(t.definition)};throw Error("non exhaustive match")}}}var nn=class{visit(e){let r=e;switch(r.constructor){case ze:return this.visitNonTerminal(r);case ht:return this.visitAlternative(r);case Ve:return this.visitOption(r);case gt:return this.visitRepetitionMandatory(r);case yt:return this.visitRepetitionMandatoryWithSeparator(r);case ut:return this.visitRepetitionWithSeparator(r);case Oe:return this.visitRepetition(r);case lt:return this.visitAlternation(r);case Ee:return this.visitTerminal(r);case rn:return this.visitRule(r);default:throw Error("non exhaustive match")}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}};function fv(t){return t instanceof ht||t instanceof Ve||t instanceof Oe||t instanceof gt||t instanceof yt||t instanceof ut||t instanceof Ee||t instanceof rn}function Us(t,e=[]){return t instanceof Ve||t instanceof Oe||t instanceof ut?!0:t instanceof lt?zu(t.definition,n=>Us(n,e)):t instanceof ze&&Ct(e,t)?!1:t instanceof An?(t instanceof ze&&e.push(t),Kr(t.definition,n=>Us(n,e))):!1}function dv(t){return t instanceof lt}function vn(t){if(t instanceof ze)return"SUBRULE";if(t instanceof Ve)return"OPTION";if(t instanceof lt)return"OR";if(t instanceof gt)return"AT_LEAST_ONE";if(t instanceof yt)return"AT_LEAST_ONE_SEP";if(t instanceof ut)return"MANY_SEP";if(t instanceof Oe)return"MANY";if(t instanceof Ee)return"CONSUME";throw Error("non exhaustive match")}var xo=class{walk(e,r=[]){Z(e.definition,(n,i)=>{let o=Xt(e.definition,i+1);if(n instanceof ze)this.walkProdRef(n,o,r);else if(n instanceof Ee)this.walkTerminal(n,o,r);else if(n instanceof ht)this.walkFlat(n,o,r);else if(n instanceof Ve)this.walkOption(n,o,r);else if(n instanceof gt)this.walkAtLeastOne(n,o,r);else if(n instanceof yt)this.walkAtLeastOneSep(n,o,r);else if(n instanceof ut)this.walkManySep(n,o,r);else if(n instanceof Oe)this.walkMany(n,o,r);else if(n instanceof lt)this.walkOr(n,o,r);else throw Error("non exhaustive match")})}walkTerminal(e,r,n){}walkProdRef(e,r,n){}walkFlat(e,r,n){let i=r.concat(n);this.walk(e,i)}walkOption(e,r,n){let i=r.concat(n);this.walk(e,i)}walkAtLeastOne(e,r,n){let i=[new Ve({definition:e.definition})].concat(r,n);this.walk(e,i)}walkAtLeastOneSep(e,r,n){let i=lD(e,r,n);this.walk(e,i)}walkMany(e,r,n){let i=[new Ve({definition:e.definition})].concat(r,n);this.walk(e,i)}walkManySep(e,r,n){let i=lD(e,r,n);this.walk(e,i)}walkOr(e,r,n){let i=r.concat(n);Z(e.definition,o=>{let s=new ht({definition:[o]});this.walk(s,i)})}};function lD(t,e,r){return[new Ve({definition:[new Ee({terminalType:t.separator})].concat(t.definition)})].concat(e,r)}function Ws(t){if(t instanceof ze)return Ws(t.referencedRule);if(t instanceof Ee)return SG(t);if(fv(t))return xG(t);if(dv(t))return _G(t);throw Error("non exhaustive match")}function xG(t){let e=[],r=t.definition,n=0,i=r.length>n,o,s=!0;for(;i&&s;)o=r[n],s=Us(o),e=e.concat(Ws(o)),n=n+1,i=r.length>n;return gc(e)}function _G(t){let e=z(t.definition,r=>Ws(r));return gc(Vt(e))}function SG(t){return[t.terminalType]}var Tp="_~IN~_";var pv=class extends xo{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,r,n){}walkProdRef(e,r,n){let i=kG(e.referencedRule,e.idx)+this.topProd.name,o=r.concat(n),s=new ht({definition:o}),a=Ws(s);this.follows[i]=a}};function fD(t){let e={};return Z(t,r=>{let n=new pv(r).startWalking();Nr(e,n)}),e}function kG(t,e){return t.name+e+Tp}var Rp={},CG=new Is;function Tc(t){let e=t.toString();if(Rp.hasOwnProperty(e))return Rp[e];{let r=CG.pattern(e);return Rp[e]=r,r}}function dD(){Rp={}}var mD="Complement Sets are not supported for first char optimization",Ju=`Unable to use "first char" lexer optimizations:
86
+ `.repeat(a)}${o}`,range:e}}fitIntoOptions(e,r,n){return n.allowMore?e=Math.max(r,e):n.allowLess&&(e=Math.min(r,e)),e}findFittingMove(e,r,n){if(r.length===0)return;if(r.length===1)return r[0];let i=e.end.line-e.start.line;for(let o of r){if(o.lines!==void 0&&i<=o.lines)return o;if(o.lines===void 0&&i===0)return o}return r[r.length-1]}iterateCstTree(e,r){let i=e.parseResult.value.$cstNode;return i?new Fn(i,o=>this.iterateCst(o,r)):ya}iterateCst(e,r){if(!Pi(e))return ya;let n=r.indentation;return new _n(()=>({index:0}),i=>i.index<e.content.length?{done:!1,value:e.content[i.index++]}:(r.indentation=n,Zr))}},Yy=class{constructor(e,r){this.astNode=e,this.collector=r}node(e){return new di(e.$cstNode?[e.$cstNode]:[],this.collector)}nodes(...e){let r=[];for(let n of e)n.$cstNode&&r.push(n.$cstNode);return new di(r,this.collector)}property(e,r){let n=Pr(this.astNode.$cstNode,e,r);return new di(n?[n]:[],this.collector)}properties(...e){let r=[];for(let n of e){let i=jo(this.astNode.$cstNode,n);r.push(...i)}return new di(r,this.collector)}keyword(e,r){let n=Un(this.astNode.$cstNode,e,r);return new di(n?[n]:[],this.collector)}keywords(...e){let r=[];for(let n of e){let i=vd(this.astNode.$cstNode,n);r.push(...i)}return new di(r,this.collector)}cst(e){return new di([...e],this.collector)}interior(e,r){let n=e.nodes,i=r.nodes;if(n.length!==1||i.length!==1)return new di([],this.collector);let o=n[0],s=i[0];if(o.offset>s.offset){let a=o;o=s,s=a}return new di(e_(o,s),this.collector)}},di=class t{constructor(e,r){this.nodes=e,this.collector=r}prepend(e){for(let r of this.nodes)this.collector(r,"prepend",e);return this}append(e){for(let r of this.nodes)this.collector(r,"append",e);return this}surround(e){for(let r of this.nodes)this.collector(r,"prepend",e),this.collector(r,"append",e);return this}slice(e,r){return new t(this.nodes.slice(e,r),this.collector)}},Me;(function(t){function e(...p){return{options:{},moves:p.flatMap(m=>m.moves).sort(f)}}t.fit=e;function r(p){return i(0,p)}t.noSpace=r;function n(p){return i(1,p)}t.oneSpace=n;function i(p,m){return{options:m??{},moves:[{characters:p}]}}t.spaces=i;function o(p){return s(1,p)}t.newLine=o;function s(p,m){return{options:m??{},moves:[{lines:p}]}}t.newLines=s;function a(p){return{options:p??{},moves:[{tabs:1,lines:1}]}}t.indent=a;function c(p){return{options:p??{},moves:[{tabs:0}]}}t.noIndent=c;function f(p,m){var T,_,E,N,I,A;let y=(T=p.lines)!==null&&T!==void 0?T:0,h=(_=m.lines)!==null&&_!==void 0?_:0,C=(E=p.tabs)!==null&&E!==void 0?E:0,L=(N=m.tabs)!==null&&N!==void 0?N:0,J=(I=p.characters)!==null&&I!==void 0?I:0,fe=(A=m.characters)!==null&&A!==void 0?A:0;return y<h?-1:y>h?1:C<L?-1:C>L?1:J<fe?-1:J>fe?1:0}})(Me=Me||(Me={}));var Td=class extends yd{format(e){if(Dr(e))this.getNodeFormatter(e).properties("type","terminal").surround(Me.noSpace());else if(ee(e)){let r=this.getNodeFormatter(e);r.keywords("entry","fragment","returns").append(Me.oneSpace()),(e.inferredType||e.returnType||e.dataType)&&e.parameters.length===0?r.property("name").append(Me.oneSpace()):r.property("name").append(Me.noSpace()),r.properties("parameters").append(Me.noSpace()),r.keywords(",").append(Me.oneSpace()),r.keywords("<").append(Me.noSpace());let n=r.keyword(";"),i=r.keyword(":");i.prepend(Me.noSpace()),r.interior(i,n).prepend(Me.indent()),n.prepend(Me.fit(Me.noSpace(),Me.newLine())),r.node(e).prepend(Me.noIndent())}else if(Be(e)){let r=this.getNodeFormatter(e);e.type&&(r.property("name").append(Me.oneSpace()),r.keyword("returns").append(Me.oneSpace())),r.keywords("hidden","terminal","fragment").append(Me.oneSpace()),r.keyword(":").prepend(Me.noSpace()),r.keyword(";").prepend(Me.fit(Me.noSpace(),Me.newLine())),r.node(e).prepend(Me.noIndent())}else if(et(e)){let r=this.getNodeFormatter(e);r.keyword("{").append(Me.noSpace()),r.keywords(".","+=","=").surround(Me.noSpace()),r.keyword("}").prepend(Me.noSpace())}else if(Ra(e))this.getNodeFormatter(e).keywords("infer","infers").append(Me.oneSpace());else if(je(e))this.getNodeFormatter(e).keywords("=","+=","?=").surround(Me.noSpace());else if(tt(e)){let r=this.getNodeFormatter(e);r.keyword("<").surround(Me.noSpace()),r.keyword(",").append(Me.oneSpace()),r.properties("arguments").append(Me.noSpace())}va(e)&&this.getNodeFormatter(e).property("cardinality").prepend(Me.noSpace())}};var yo=Ie(Qe(),1);var we=Ie(Qe(),1);var Zy={[we.SemanticTokenTypes.class]:0,[we.SemanticTokenTypes.comment]:1,[we.SemanticTokenTypes.enum]:2,[we.SemanticTokenTypes.enumMember]:3,[we.SemanticTokenTypes.event]:4,[we.SemanticTokenTypes.function]:5,[we.SemanticTokenTypes.interface]:6,[we.SemanticTokenTypes.keyword]:7,[we.SemanticTokenTypes.macro]:8,[we.SemanticTokenTypes.method]:9,[we.SemanticTokenTypes.modifier]:10,[we.SemanticTokenTypes.namespace]:11,[we.SemanticTokenTypes.number]:12,[we.SemanticTokenTypes.operator]:13,[we.SemanticTokenTypes.parameter]:14,[we.SemanticTokenTypes.property]:15,[we.SemanticTokenTypes.regexp]:16,[we.SemanticTokenTypes.string]:17,[we.SemanticTokenTypes.struct]:18,[we.SemanticTokenTypes.type]:19,[we.SemanticTokenTypes.typeParameter]:20,[we.SemanticTokenTypes.variable]:21},BS={[we.SemanticTokenModifiers.abstract]:1,[we.SemanticTokenModifiers.async]:2,[we.SemanticTokenModifiers.declaration]:4,[we.SemanticTokenModifiers.defaultLibrary]:8,[we.SemanticTokenModifiers.definition]:16,[we.SemanticTokenModifiers.deprecated]:32,[we.SemanticTokenModifiers.documentation]:64,[we.SemanticTokenModifiers.modification]:128,[we.SemanticTokenModifiers.readonly]:256,[we.SemanticTokenModifiers.static]:512},KS={legend:{tokenTypes:Object.keys(Zy),tokenModifiers:Object.keys(BS)},full:{delta:!0},range:!0},Qy=class extends we.SemanticTokensBuilder{constructor(){super(...arguments),this._tokens=[]}push(e,r,n,i,o){this._tokens.push({line:e,char:r,length:n,tokenType:i,tokenModifiers:o})}build(){return this.applyTokens(),super.build()}buildEdits(){return this.applyTokens(),super.buildEdits()}applyTokens(){for(let e of this._tokens.sort(this.compareTokens))super.push(e.line,e.char,e.length,e.tokenType,e.tokenModifiers);this._tokens=[]}compareTokens(e,r){return e.line===r.line?e.char-r.char:e.line-r.line}},Rd=class{constructor(e){this.tokensBuilders=new Map,e.shared.workspace.TextDocuments.onDidClose(r=>{this.tokensBuilders.delete(r.document.uri)}),e.shared.lsp.LanguageServer.onInitialize(r=>{var n;this.initialize((n=r.capabilities.textDocument)===null||n===void 0?void 0:n.semanticTokens)})}initialize(e){this.clientCapabilities=e}async semanticHighlight(e,r,n=we.CancellationToken.None){return this.currentRange=void 0,this.currentDocument=e,this.currentTokensBuilder=this.getDocumentTokensBuilder(e),await this.computeHighlighting(e,this.createAcceptor(),n),this.currentTokensBuilder.build()}async semanticHighlightRange(e,r,n=we.CancellationToken.None){return this.currentRange=r.range,this.currentDocument=e,this.currentTokensBuilder=this.getDocumentTokensBuilder(e),await this.computeHighlighting(e,this.createAcceptor(),n),this.currentTokensBuilder.build()}async semanticHighlightDelta(e,r,n=we.CancellationToken.None){return this.currentRange=void 0,this.currentDocument=e,this.currentTokensBuilder=this.getDocumentTokensBuilder(e),this.currentTokensBuilder.previousResult(r.previousResultId),await this.computeHighlighting(e,this.createAcceptor(),n),this.currentTokensBuilder.buildEdits()}createAcceptor(){return r=>{"line"in r?this.highlightToken({range:{start:{line:r.line,character:r.char},end:{line:r.line,character:r.char+r.length}},type:r.type,modifier:r.modifier}):"range"in r?this.highlightToken(r):"keyword"in r?this.highlightKeyword(r):"property"in r?this.highlightProperty(r):this.highlightNode({node:r.cst,type:r.type,modifier:r.modifier})}}getDocumentTokensBuilder(e){let r=this.tokensBuilders.get(e.uri.toString());if(r)return r;let n=new Qy;return this.tokensBuilders.set(e.uri.toString(),n),n}async computeHighlighting(e,r,n){let i=e.parseResult.value,o=uo(i,{range:this.currentRange}).iterator(),s;do if(s=o.next(),!s.done){await kt(n);let a=s.value;this.highlightElement(a,r)==="prune"&&o.prune()}while(!s.done)}highlightToken(e){var r;let{range:n,type:i}=e,o=e.modifier;if(this.currentRange&&!Lf(n,this.currentRange)||!this.currentDocument||!this.currentTokensBuilder)return;let s=Zy[i],a=0;if(o!==void 0){typeof o=="string"&&(o=[o]);for(let p of o){let m=BS[p];a|=m}}let c=n.start.line,f=n.end.line;if(c===f){let p=n.start.character,m=n.end.character-p;this.currentTokensBuilder.push(c,p,m,s,a)}else if(!((r=this.clientCapabilities)===null||r===void 0)&&r.multilineTokenSupport){let p=n.start.character,m=this.currentDocument.textDocument.offsetAt(n.start),T=this.currentDocument.textDocument.offsetAt(n.end);this.currentTokensBuilder.push(c,p,T-m,s,a)}else{let p=n.start,m=this.currentDocument.textDocument.offsetAt({line:c+1,character:0});this.currentTokensBuilder.push(p.line,p.character,m-p.character-1,s,a);for(let T=c+1;T<f;T++){let _=m;m=this.currentDocument.textDocument.offsetAt({line:T+1,character:0}),this.currentTokensBuilder.push(T,0,m-_-1,s,a)}this.currentTokensBuilder.push(f,0,n.end.character,s,a)}}highlightProperty(e){let r=[];if(typeof e.index=="number"){let o=Pr(e.node.$cstNode,e.property,e.index);o&&r.push(o)}else r.push(...jo(e.node.$cstNode,e.property));let{type:n,modifier:i}=e;for(let o of r)this.highlightNode({node:o,type:n,modifier:i})}highlightKeyword(e){let{node:r,keyword:n,type:i,index:o,modifier:s}=e,a=[];if(typeof o=="number"){let c=Un(r.$cstNode,n,o);c&&a.push(c)}else a.push(...vd(r.$cstNode,n));for(let c of a)this.highlightNode({node:c,type:i,modifier:s})}highlightNode(e){let{node:r,type:n,modifier:i}=e,o=r.range;this.highlightToken({range:o,type:n,modifier:i})}},Jy;(function(t){function e(n,i){let o=new Map;Object.entries(Zy).forEach(([c,f])=>o.set(f,c));let s=0,a=0;return r(n.data,5).map(c=>{s+=c[0],c[0]!==0&&(a=0),a+=c[1];let f=c[2];return{offset:i.textDocument.offsetAt({line:s,character:a}),tokenType:o.get(c[3]),tokenModifiers:c[4],text:i.textDocument.getText({start:{line:s,character:a},end:{line:s,character:a+f}})}})}t.decode=e;function r(n,i){let o=[];for(let s=0;s<n.length;s+=i){let a=n.slice(s,s+i);o.push(a)}return o}})(Jy=Jy||(Jy={}));var bd=class extends Rd{highlightElement(e,r){var n;je(e)?r({node:e,property:"feature",type:yo.SemanticTokenTypes.property}):et(e)?e.feature&&r({node:e,property:"feature",type:yo.SemanticTokenTypes.property}):xa(e)?r({node:e,property:"name",type:yo.SemanticTokenTypes.type}):Hr(e)?(e.primitiveType||e.typeRef)&&r({node:e,property:e.primitiveType?"primitiveType":"typeRef",type:yo.SemanticTokenTypes.type}):g_(e)?r({node:e,property:"name",type:yo.SemanticTokenTypes.parameter}):ba(e)?r({node:e,property:"parameter",type:yo.SemanticTokenTypes.parameter}):tt(e)?!((n=e.rule.ref)===null||n===void 0)&&n.fragment&&r({node:e,property:"rule",type:yo.SemanticTokenTypes.type}):qf(e)&&r({node:e,property:"name",type:yo.SemanticTokenTypes.property})}};var xd=class extends wa{getName(e){return je(e)?e.feature:super.getName(e)}getNameNode(e){return je(e)?Pr(e.$cstNode,"feature"):super.getNameNode(e)}};var Ga=class{constructor(e){this.nameProvider=e.references.NameProvider,this.index=e.shared.workspace.IndexManager,this.nodeLocator=e.workspace.AstNodeLocator}findDeclaration(e){if(e){let r=Ba(e),n=e.astNode;if(r&&n){let i=n[r.feature];if(so(i))return i.ref;if(Array.isArray(i)){for(let o of i)if(so(o)&&o.$refNode&&o.$refNode.offset<=e.offset&&o.$refNode.end>=e.end)return o.ref}}if(n){let i=this.nameProvider.getNameNode(n);if(i&&(i===e||Jx(e,i)))return n}}}findDeclarationNode(e){let r=this.findDeclaration(e);if(r?.$cstNode){let n=this.nameProvider.getNameNode(r);return n??r.$cstNode}}findReferences(e,r){let n=[];if(r.includeDeclaration){let o=this.getReferenceToSelf(e);o&&n.push(o)}let i=this.index.findAllReferences(e,this.nodeLocator.getAstNodePath(e));return r.documentUri&&(i=i.filter(o=>qe.equals(o.sourceUri,r.documentUri))),n.push(...i),Ce(n)}getReferenceToSelf(e){let r=this.nameProvider.getNameNode(e);if(r){let n=ke(e),i=this.nodeLocator.getAstNodePath(e);return{sourceUri:n.uri,sourcePath:i,targetUri:n.uri,targetPath:i,segment:Wr(r),local:!0}}}};var _d=class extends Ga{constructor(e){super(e),this.documents=e.shared.workspace.LangiumDocuments}findDeclaration(e){let r=e.astNode,n=Ba(e);if(n&&n.feature==="feature"){if(je(r))return this.findAssignmentDeclaration(r);if(et(r))return this.findActionDeclaration(r)}return super.findDeclaration(e)}findReferences(e,r){var n;return qf(e)?this.findReferencesToTypeAttribute(e,(n=r.includeDeclaration)!==null&&n!==void 0?n:!1):super.findReferences(e,r)}findReferencesToTypeAttribute(e,r){let n=[],i=rt(e,pn);if(i){if(r){let a=this.getReferenceToSelf(e);a&&n.push(a)}let o=Sy(i,this,this.documents,this.nodeLocator),s=[];o.forEach(a=>{let c=this.findRulesWithReturnType(a);s.push(...c)}),s.forEach(a=>{let c=this.createReferencesToAttribute(a,e);n.push(...c)})}return Ce(n)}createReferencesToAttribute(e,r){let n=[];if(ee(e)){let i=Ia(e.definition).find(o=>o.feature===r.name);if(i?.$cstNode){let o=this.nameProvider.getNameNode(i);o&&n.push({sourceUri:ke(i).uri,sourcePath:this.nodeLocator.getAstNodePath(i),targetUri:ke(r).uri,targetPath:this.nodeLocator.getAstNodePath(r),segment:Wr(o),local:qe.equals(ke(i).uri,ke(r).uri)})}}else{if(e.feature===r.name){let o=Pr(e.$cstNode,"feature");o&&n.push({sourceUri:ke(e).uri,sourcePath:this.nodeLocator.getAstNodePath(e),targetUri:ke(r).uri,targetPath:this.nodeLocator.getAstNodePath(r),segment:Wr(o),local:qe.equals(ke(e).uri,ke(r).uri)})}let i=rt(e,ee);n.push(...this.createReferencesToAttribute(i,r))}return n}findAssignmentDeclaration(e){var r;let n=rt(e,ee),i=Fy(e);if(i){let o=this.findActionDeclaration(i,e.feature);if(o)return o}if(!((r=n?.returnType)===null||r===void 0)&&r.ref&&(pn(n.returnType.ref)||vr(n.returnType.ref))){let o=Cu(n.returnType.ref);for(let s of o){let a=s.attributes.find(c=>c.name===e.feature);if(a)return a}}return e}findActionDeclaration(e,r){var n;if(!((n=e.type)===null||n===void 0)&&n.ref){let i=r??e.feature,o=Cu(e.type.ref);for(let s of o){let a=s.attributes.find(c=>c.name===i);if(a)return a}}}findRulesWithReturnType(e){let r=[];return this.index.findAllReferences(e,this.nodeLocator.getAstNodePath(e)).forEach(i=>{let o=this.documents.getOrCreateDocument(i.sourceUri),s=this.nodeLocator.getAstNode(o.parseResult.value,i.sourcePath);(ee(s)||et(s))&&r.push(s)}),r}};var Uu=Ie(Qe(),1);var zS=Ie(Qe(),1);var Sd=class{constructor(e){this.grammarConfig=e.parser.GrammarConfig,this.nameProvider=e.references.NameProvider,this.documents=e.shared.workspace.LangiumDocuments,this.references=e.references.References}prepareCallHierarchy(e,r){let n=e.parseResult.value,i=dr(n.$cstNode,e.textDocument.offsetAt(r.position),this.grammarConfig.nameRegexp);if(!i)return;let o=this.references.findDeclarationNode(i);if(o)return this.getCallHierarchyItems(o.astNode,e)}getCallHierarchyItems(e,r){let n=this.nameProvider.getNameNode(e),i=this.nameProvider.getName(e);if(!(!n||!e.$cstNode||i===void 0))return[Object.assign({kind:zS.SymbolKind.Method,name:i,range:e.$cstNode.range,selectionRange:n.range,uri:r.uri.toString()},this.getCallHierarchyItem(e))]}getCallHierarchyItem(e){}incomingCalls(e){let r=this.documents.getOrCreateDocument(Ar.parse(e.item.uri)),n=r.parseResult.value,i=dr(n.$cstNode,r.textDocument.offsetAt(e.item.range.start),this.grammarConfig.nameRegexp);if(!i)return;let o=this.references.findReferences(i.astNode,{includeDeclaration:!1});return this.getIncomingCalls(i.astNode,o)}outgoingCalls(e){let r=this.documents.getOrCreateDocument(Ar.parse(e.item.uri)),n=r.parseResult.value,i=dr(n.$cstNode,r.textDocument.offsetAt(e.item.range.start),this.grammarConfig.nameRegexp);if(i)return this.getOutgoingCalls(i.astNode)}};var VS=Ie(Qe(),1);var Ka=class{constructor(e){this.nameProvider=e.references.NameProvider,this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}getDefinition(e,r){let n=e.parseResult.value;if(n.$cstNode){let i=n.$cstNode,o=dr(i,e.textDocument.offsetAt(r.position),this.grammarConfig.nameRegexp);if(o)return this.collectLocationLinks(o,r)}}collectLocationLinks(e,r){var n;let i=this.findLink(e);if(i)return[VS.LocationLink.create(i.targetDocument.textDocument.uri,((n=i.target.astNode.$cstNode)!==null&&n!==void 0?n:i.target).range,i.target.range,i.source.range)]}findLink(e){let r=this.references.findDeclarationNode(e);if(r?.astNode){let n=ke(r.astNode);if(r&&n)return{source:e,target:r,targetDocument:n}}}};var XS=Ie(Qe(),1);var kd=class{constructor(e){this.references=e.references.References,this.nameProvider=e.references.NameProvider,this.grammarConfig=e.parser.GrammarConfig}getDocumentHighlight(e,r){let n=e.parseResult.value.$cstNode;if(!n)return;let i=dr(n,e.textDocument.offsetAt(r.position),this.grammarConfig.nameRegexp);if(!i)return;let o=this.references.findDeclaration(i);if(o){let s=qe.equals(ke(o).uri,e.uri),a={documentUri:e.uri,includeDeclaration:s};return this.references.findReferences(o,a).map(f=>this.createDocumentHighlight(f)).toArray()}}createDocumentHighlight(e){return XS.DocumentHighlight.create(e.segment.range)}};var Cd=class{constructor(e){this.nameProvider=e.references.NameProvider,this.nodeKindProvider=e.shared.lsp.NodeKindProvider}getSymbols(e){return this.getSymbol(e,e.parseResult.value)}getSymbol(e,r){let n=r.$cstNode,i=this.nameProvider.getNameNode(r);if(i&&n){let o=this.nameProvider.getName(r);return[{kind:this.nodeKindProvider.getSymbolKind(r),name:o??i.text,range:n.range,selectionRange:i.range,children:this.getChildSymbols(e,r)}]}else return this.getChildSymbols(e,r)||[]}getChildSymbols(e,r){let n=[];for(let i of Fo(r)){let o=this.getSymbol(e,i);n.push(...o)}if(n.length>0)return n}};var zM=Ie(Qe(),1);var wd=class{match(e,r){if(e.length===0)return!0;r=r.toLowerCase();let n=!1,i,o=0,s=r.length;for(let a=0;a<s;a++){let c=r.charCodeAt(a),f=e.charCodeAt(o);if((c===f||this.toUpperCharCode(c)===this.toUpperCharCode(f))&&(n||(n=i===void 0||this.isWordTransition(i,c)),n&&o++,o===e.length))return!0;i=c}return!1}isWordTransition(e,r){return YS<=e&&e<=JS&&VM<=r&&r<=XM||e===QS&&r!==QS}toUpperCharCode(e){return YS<=e&&e<=JS?e-32:e}},YS="a".charCodeAt(0),JS="z".charCodeAt(0),VM="A".charCodeAt(0),XM="Z".charCodeAt(0),QS="_".charCodeAt(0);var ev=class{constructor(e){this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}getHoverContent(e,r){var n,i;let o=(i=(n=e.parseResult)===null||n===void 0?void 0:n.value)===null||i===void 0?void 0:i.$cstNode;if(o){let s=e.textDocument.offsetAt(r.position),a=dr(o,s,this.grammarConfig.nameRegexp);if(a&&a.offset+a.length>s){let c=this.references.findDeclaration(a);if(c)return this.getAstNodeHoverContent(c)}}}},Dd=class extends ev{constructor(e){super(e),this.documentationProvider=e.documentation.DocumentationProvider}getAstNodeHoverContent(e){let r=this.documentationProvider.getDocumentation(e);if(r)return{contents:{kind:"markdown",value:r}}}};var YM=Ie(Qe(),1);var JM=Ie(Qe(),1);var Gn=Ie(Qe(),1);var st;(function(t){t[t.Changed=0]="Changed",t[t.Parsed=1]="Parsed",t[t.IndexedContent=2]="IndexedContent",t[t.ComputedScopes=3]="ComputedScopes",t[t.Linked=4]="Linked",t[t.IndexedReferences=5]="IndexedReferences",t[t.Validated=6]="Validated"})(st=st||(st={}));var Ed=class{constructor(e){this.serviceRegistry=e.ServiceRegistry,this.textDocuments=e.workspace.TextDocuments,this.fileSystemProvider=e.workspace.FileSystemProvider}fromTextDocument(e,r){return this.create(r??Ar.parse(e.uri),e)}fromString(e,r){return this.create(r,e)}fromModel(e,r){return this.create(r,{$model:e})}create(e,r){if(r??(r=this.textDocuments.get(e.toString())),r??(r=this.getContentFromFileSystem(e)),typeof r=="string"){let n=this.parse(e,r);return this.createLangiumDocument(n,e,void 0,r)}else if("$model"in r){let n={value:r.$model,parserErrors:[],lexerErrors:[]};return this.createLangiumDocument(n,e)}else{let n=this.parse(e,r.getText());return this.createLangiumDocument(n,e,r)}}createLangiumDocument(e,r,n,i){let o;if(n)o={parseResult:e,uri:r,state:st.Parsed,references:[],textDocument:n};else{let s=this.createTextDocumentGetter(r,i);o={parseResult:e,uri:r,state:st.Parsed,references:[],get textDocument(){return s()}}}return e.value.$document=o,o}update(e){let r=this.textDocuments.get(e.uri.toString()),n=r?r.getText():this.getContentFromFileSystem(e.uri);if(r)Object.defineProperty(e,"textDocument",{value:r});else{let i=this.createTextDocumentGetter(e.uri,n);Object.defineProperty(e,"textDocument",{get:i})}return e.parseResult=this.parse(e.uri,n),e.parseResult.value.$document=e,e}getContentFromFileSystem(e){return this.fileSystemProvider.readFileSync(e)}parse(e,r){return this.serviceRegistry.getServices(e).parser.LangiumParser.parse(r)}createTextDocumentGetter(e,r){let n=this.serviceRegistry,i;return()=>i??(i=ha.create(e.toString(),n.getServices(e).LanguageMetaData.languageId,0,r??""))}},Pd=class{constructor(e){this.documentMap=new Map,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory}get all(){return Ce(this.documentMap.values())}addDocument(e){let r=e.uri.toString();if(this.documentMap.has(r))throw new Error(`A document with the URI '${r}' is already present.`);this.documentMap.set(r,e)}getOrCreateDocument(e){let r=e.toString(),n=this.documentMap.get(r);return n||(n=this.langiumDocumentFactory.create(e),this.documentMap.set(r,n),n)}hasDocument(e){return this.documentMap.has(e.toString())}invalidateDocument(e){let r=e.toString(),n=this.documentMap.get(r);return n&&(n.state=st.Changed,n.precomputedScopes=void 0,n.references=[],n.diagnostics=void 0),n}deleteDocument(e){let r=e.toString(),n=this.documentMap.get(r);return n&&(n.state=st.Changed,this.documentMap.delete(r)),n}};var QM=Ie(Qe(),1);function ZS(t){let e=[],r=[];t.forEach(i=>{i?.triggerCharacters&&e.push(...i.triggerCharacters),i?.retriggerCharacters&&r.push(...i.retriggerCharacters)});let n={triggerCharacters:e.length>0?Array.from(new Set(e)).sort():void 0,retriggerCharacters:r.length>0?Array.from(new Set(r)).sort():void 0};return n.triggerCharacters?n:void 0}var Ad=class{constructor(e){this.onInitializeEmitter=new Gn.Emitter,this.onInitializedEmitter=new Gn.Emitter,this.services=e}get onInitialize(){return this.onInitializeEmitter.event}get onInitialized(){return this.onInitializedEmitter.event}async initialize(e){return this.eagerLoadServices(),this.onInitializeEmitter.fire(e),this.onInitializeEmitter.dispose(),this.buildInitializeResult(e)}eagerLoadServices(){Mf(this.services),this.services.ServiceRegistry.all.forEach(e=>Mf(e))}hasService(e){return this.services.ServiceRegistry.all.some(r=>e(r)!==void 0)}buildInitializeResult(e){var r;let n=this.services.ServiceRegistry.all,i=this.hasService(V=>V.lsp.Formatter),o=n.map(V=>{var it;return(it=V.lsp.Formatter)===null||it===void 0?void 0:it.formatOnTypeOptions}).find(V=>!!V),s=this.hasService(V=>V.lsp.CodeActionProvider),a=this.hasService(V=>V.lsp.SemanticTokenProvider),c=(r=this.services.lsp.ExecuteCommandHandler)===null||r===void 0?void 0:r.commands,f=this.hasService(V=>V.lsp.DocumentLinkProvider),p=ZS(n.map(V=>{var it;return(it=V.lsp.SignatureHelp)===null||it===void 0?void 0:it.signatureHelpOptions})),m=this.hasService(V=>V.lsp.TypeProvider),T=this.hasService(V=>V.lsp.ImplementationProvider),_=this.hasService(V=>V.lsp.CompletionProvider),E=HS(n.map(V=>{var it;return(it=V.lsp.CompletionProvider)===null||it===void 0?void 0:it.completionOptions})),N=this.hasService(V=>V.lsp.ReferencesProvider),I=this.hasService(V=>V.lsp.DocumentSymbolProvider),A=this.hasService(V=>V.lsp.DefinitionProvider),y=this.hasService(V=>V.lsp.DocumentHighlightProvider),h=this.hasService(V=>V.lsp.FoldingRangeProvider),C=this.hasService(V=>V.lsp.HoverProvider),L=this.hasService(V=>V.lsp.RenameProvider),J=this.hasService(V=>V.lsp.CallHierarchyProvider),fe=this.hasService(V=>V.lsp.CodeLensProvider),Ae=this.hasService(V=>V.lsp.DeclarationProvider),Wt=this.hasService(V=>V.lsp.InlayHintProvider),Xe=this.services.lsp.WorkspaceSymbolProvider;return{capabilities:{workspace:{workspaceFolders:{supported:!0}},executeCommandProvider:c&&{commands:c},textDocumentSync:Gn.TextDocumentSyncKind.Incremental,completionProvider:_?E:void 0,referencesProvider:N,documentSymbolProvider:I,definitionProvider:A,typeDefinitionProvider:m,documentHighlightProvider:y,codeActionProvider:s,documentFormattingProvider:i,documentRangeFormattingProvider:i,documentOnTypeFormattingProvider:o,foldingRangeProvider:h,hoverProvider:C,renameProvider:L?{prepareProvider:!0}:void 0,semanticTokensProvider:a?KS:void 0,signatureHelpProvider:p,implementationProvider:T,callHierarchyProvider:J?{}:void 0,documentLinkProvider:f?{resolveProvider:!1}:void 0,codeLensProvider:fe?{resolveProvider:!1}:void 0,declarationProvider:Ae,inlayHintProvider:Wt?{resolveProvider:!1}:void 0,workspaceSymbolProvider:Xe?{resolveProvider:!!Xe.resolveSymbol}:void 0}}}async initialized(e){this.onInitializedEmitter.fire(e),this.onInitializedEmitter.dispose()}};function tk(t){let e=t.lsp.Connection;if(!e)throw new Error("Starting a language server requires the languageServer.Connection service to be set.");ZM(e,t),e$(e,t),t$(e,t),r$(e,t),i$(e,t),o$(e,t),s$(e,t),a$(e,t),u$(e,t),f$(e,t),d$(e,t),n$(e,t),p$(e,t),l$(e,t),m$(e,t),h$(e,t),y$(e,t),T$(e,t),x$(e,t),R$(e,t),v$(e,t),g$(e,t),c$(e,t),b$(e,t),e.onInitialize(n=>t.lsp.LanguageServer.initialize(n)),e.onInitialized(n=>t.lsp.LanguageServer.initialized(n)),t.workspace.TextDocuments.listen(e),e.listen()}function ZM(t,e){let r=e.workspace.DocumentBuilder,n=e.workspace.MutexLock;function i(s,a){n.lock(c=>r.update(s,a,c))}e.workspace.TextDocuments.onDidChangeContent(s=>{i([Ar.parse(s.document.uri)],[])}),t.onDidChangeWatchedFiles(s=>{let a=[],c=[];for(let f of s.changes){let p=Ar.parse(f.uri);f.type===Gn.FileChangeType.Deleted?c.push(p):a.push(p)}i(a,c)})}function e$(t,e){e.workspace.DocumentBuilder.onBuildPhase(st.Validated,async(n,i)=>{for(let o of n)if(o.diagnostics&&t.sendDiagnostics({uri:o.uri.toString(),diagnostics:o.diagnostics}),i.isCancellationRequested)return})}function t$(t,e){t.onCompletion(Br((r,n,i,o)=>{var s;return(s=r.lsp.CompletionProvider)===null||s===void 0?void 0:s.getCompletion(n,i,o)},e))}function r$(t,e){t.onReferences(Br((r,n,i,o)=>{var s;return(s=r.lsp.ReferencesProvider)===null||s===void 0?void 0:s.findReferences(n,i,o)},e))}function n$(t,e){t.onCodeAction(Br((r,n,i,o)=>{var s;return(s=r.lsp.CodeActionProvider)===null||s===void 0?void 0:s.getCodeActions(n,i,o)},e))}function i$(t,e){t.onDocumentSymbol(Br((r,n,i,o)=>{var s;return(s=r.lsp.DocumentSymbolProvider)===null||s===void 0?void 0:s.getSymbols(n,i,o)},e))}function o$(t,e){t.onDefinition(Br((r,n,i,o)=>{var s;return(s=r.lsp.DefinitionProvider)===null||s===void 0?void 0:s.getDefinition(n,i,o)},e))}function s$(t,e){t.onTypeDefinition(Br((r,n,i,o)=>{var s;return(s=r.lsp.TypeProvider)===null||s===void 0?void 0:s.getTypeDefinition(n,i,o)},e))}function a$(t,e){t.onImplementation(Br((r,n,i,o)=>{var s;return(s=r.lsp.ImplementationProvider)===null||s===void 0?void 0:s.getImplementation(n,i,o)},e))}function c$(t,e){t.onDeclaration(Br((r,n,i,o)=>{var s;return(s=r.lsp.DeclarationProvider)===null||s===void 0?void 0:s.getDeclaration(n,i,o)},e))}function u$(t,e){t.onDocumentHighlight(Br((r,n,i,o)=>{var s;return(s=r.lsp.DocumentHighlightProvider)===null||s===void 0?void 0:s.getDocumentHighlight(n,i,o)},e))}function l$(t,e){t.onHover(Br((r,n,i,o)=>{var s;return(s=r.lsp.HoverProvider)===null||s===void 0?void 0:s.getHoverContent(n,i,o)},e))}function f$(t,e){t.onFoldingRanges(Br((r,n,i,o)=>{var s;return(s=r.lsp.FoldingRangeProvider)===null||s===void 0?void 0:s.getFoldingRanges(n,i,o)},e))}function d$(t,e){t.onDocumentFormatting(Br((r,n,i,o)=>{var s;return(s=r.lsp.Formatter)===null||s===void 0?void 0:s.formatDocument(n,i,o)},e)),t.onDocumentRangeFormatting(Br((r,n,i,o)=>{var s;return(s=r.lsp.Formatter)===null||s===void 0?void 0:s.formatDocumentRange(n,i,o)},e)),t.onDocumentOnTypeFormatting(Br((r,n,i,o)=>{var s;return(s=r.lsp.Formatter)===null||s===void 0?void 0:s.formatDocumentOnType(n,i,o)},e))}function p$(t,e){t.onRenameRequest(Br((r,n,i,o)=>{var s;return(s=r.lsp.RenameProvider)===null||s===void 0?void 0:s.rename(n,i,o)},e)),t.onPrepareRename(Br((r,n,i,o)=>{var s;return(s=r.lsp.RenameProvider)===null||s===void 0?void 0:s.prepareRename(n,i,o)},e))}function m$(t,e){t.languages.inlayHint.on(Ho((r,n,i,o)=>{var s;return(s=r.lsp.InlayHintProvider)===null||s===void 0?void 0:s.getInlayHints(n,i,o)},e))}function h$(t,e){let r={data:[]};t.languages.semanticTokens.on(Ho((n,i,o,s)=>n.lsp.SemanticTokenProvider?n.lsp.SemanticTokenProvider.semanticHighlight(i,o,s):r,e)),t.languages.semanticTokens.onDelta(Ho((n,i,o,s)=>n.lsp.SemanticTokenProvider?n.lsp.SemanticTokenProvider.semanticHighlightDelta(i,o,s):r,e)),t.languages.semanticTokens.onRange(Ho((n,i,o,s)=>n.lsp.SemanticTokenProvider?n.lsp.SemanticTokenProvider.semanticHighlightRange(i,o,s):r,e))}function g$(t,e){t.onDidChangeConfiguration(r=>{r.settings&&e.workspace.ConfigurationProvider.updateConfiguration(r)})}function y$(t,e){let r=e.lsp.ExecuteCommandHandler;r&&t.onExecuteCommand(async(n,i)=>{var o;try{return await r.executeCommand(n.command,(o=n.arguments)!==null&&o!==void 0?o:[],i)}catch(s){return za(s)}})}function v$(t,e){t.onDocumentLinks(Ho((r,n,i,o)=>{var s;return(s=r.lsp.DocumentLinkProvider)===null||s===void 0?void 0:s.getDocumentLinks(n,i,o)},e))}function T$(t,e){t.onSignatureHelp(Ho((r,n,i,o)=>{var s;return(s=r.lsp.SignatureHelp)===null||s===void 0?void 0:s.provideSignatureHelp(n,i,o)},e))}function R$(t,e){t.onCodeLens(Ho((r,n,i,o)=>{var s;return(s=r.lsp.CodeLensProvider)===null||s===void 0?void 0:s.provideCodeLens(n,i,o)},e))}function b$(t,e){var r;let n=e.lsp.WorkspaceSymbolProvider;if(n){t.onWorkspaceSymbol(async(o,s)=>{try{return await n.getSymbols(o,s)}catch(a){return za(a)}});let i=(r=n.resolveSymbol)===null||r===void 0?void 0:r.bind(n);i&&t.onWorkspaceSymbolResolve(async(o,s)=>{try{return await i(o,s)}catch(a){return za(a)}})}}function x$(t,e){t.languages.callHierarchy.onPrepare(Ho((r,n,i,o)=>{var s;return r.lsp.CallHierarchyProvider&&(s=r.lsp.CallHierarchyProvider.prepareCallHierarchy(n,i,o))!==null&&s!==void 0?s:null},e)),t.languages.callHierarchy.onIncomingCalls(ek((r,n,i)=>{var o;return r.lsp.CallHierarchyProvider&&(o=r.lsp.CallHierarchyProvider.incomingCalls(n,i))!==null&&o!==void 0?o:null},e)),t.languages.callHierarchy.onOutgoingCalls(ek((r,n,i)=>{var o;return r.lsp.CallHierarchyProvider&&(o=r.lsp.CallHierarchyProvider.outgoingCalls(n,i))!==null&&o!==void 0?o:null},e))}function ek(t,e){let r=e.ServiceRegistry;return async(n,i)=>{let o=Ar.parse(n.item.uri),s=r.getServices(o);if(!s){let a=`Could not find service instance for uri: '${o.toString()}'`;throw console.error(a),new Error(a)}try{return await t(s,n,i)}catch(a){return za(a)}}}function Ho(t,e){let r=e.workspace.LangiumDocuments,n=e.ServiceRegistry;return async(i,o)=>{let s=Ar.parse(i.textDocument.uri),a=n.getServices(s);if(!a)throw console.error(`Could not find service instance for uri: '${s.toString()}'`),new Error;let c=r.getOrCreateDocument(s);if(!c)throw new Error;try{return await t(a,c,i,o)}catch(f){return za(f)}}}function Br(t,e){let r=e.workspace.LangiumDocuments,n=e.ServiceRegistry;return async(i,o)=>{let s=Ar.parse(i.textDocument.uri),a=n.getServices(s);if(!a)return console.error(`Could not find service instance for uri: '${s.toString()}'`),null;let c=r.getOrCreateDocument(s);if(!c)return null;try{return await t(a,c,i,o)}catch(f){return za(f)}}}function za(t){if(Os(t))return new Gn.ResponseError(Gn.LSPErrorCodes.RequestCancelled,"The request has been cancelled.");if(t instanceof Gn.ResponseError)return t;throw t}var Id=Ie(Qe(),1),Nd=class{getSymbolKind(){return Id.SymbolKind.Field}getCompletionItemKind(){return Id.CompletionItemKind.Reference}};var rk=Ie(Qe(),1);var Od=class{constructor(e){this.nameProvider=e.references.NameProvider,this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}findReferences(e,r){let n=e.parseResult.value.$cstNode;if(!n)return[];let i=dr(n,e.textDocument.offsetAt(r.position),this.grammarConfig.nameRegexp);return i?this.getReferences(i,r,e):[]}getReferences(e,r,n){let i=[],o=this.references.findDeclaration(e);if(o){let s={includeDeclaration:r.context.includeDeclaration};this.references.findReferences(o,s).forEach(a=>{i.push(rk.Location.create(a.sourceUri.toString(),a.segment.range))})}return i}};var nk=Ie(Qe(),1);var Ld=class{constructor(e){this.references=e.references.References,this.nameProvider=e.references.NameProvider,this.grammarConfig=e.parser.GrammarConfig}async rename(e,r){let n={},i=e.parseResult.value.$cstNode;if(!i)return;let o=e.textDocument.offsetAt(r.position),s=dr(i,o,this.grammarConfig.nameRegexp);if(!s)return;let a=this.references.findDeclaration(s);if(!a)return;let c={onlyLocal:!1,includeDeclaration:!0};return this.references.findReferences(a,c).forEach(p=>{let m=nk.TextEdit.replace(p.segment.range,r.newName),T=p.sourceUri.toString();n[T]?n[T].push(m):n[T]=[m]}),{changes:n}}prepareRename(e,r){return this.renameNodeRange(e,r.position)}renameNodeRange(e,r){let n=e.parseResult.value.$cstNode,i=e.textDocument.offsetAt(r);if(n&&i){let o=dr(n,i,this.grammarConfig.nameRegexp);if(!o)return;if(this.references.findDeclaration(o)||this.isNameNode(o))return o.range}}isNameNode(e){return e?.astNode&&wu(e.astNode)&&e===this.nameProvider.getNameNode(e.astNode)}};var _$=Ie(Qe(),1);var ik=Ie(Qe(),1);var Md=class{constructor(e){this.indexManager=e.workspace.IndexManager,this.nodeKindProvider=e.lsp.NodeKindProvider,this.fuzzyMatcher=e.lsp.FuzzyMatcher}async getSymbols(e,r=ik.CancellationToken.None){let n=[],i=e.query.toLowerCase();for(let o of this.indexManager.allElements())if(await kt(r),this.fuzzyMatcher.match(i,o.name)){let s=this.getWorkspaceSymbol(o);s&&n.push(s)}return n}getWorkspaceSymbol(e){let r=e.nameSegment;if(r)return{kind:this.nodeKindProvider.getSymbolKind(e),name:e.name,location:{range:r.range,uri:e.documentUri.toString()}}}};var $d=class extends Ka{constructor(e){super(e),this.documents=e.shared.workspace.LangiumDocuments}collectLocationLinks(e,r){var n,i,o,s,a,c;let f="path";if($f(e.astNode)&&((n=Ba(e))===null||n===void 0?void 0:n.feature)===f){let p=ho(this.documents,e.astNode);if(p?.$document){let m=(i=this.findTargetObject(p))!==null&&i!==void 0?i:p,T=(s=(o=this.nameProvider.getNameNode(m))===null||o===void 0?void 0:o.range)!==null&&s!==void 0?s:Uu.Range.create(0,0,0,0),_=(c=(a=m.$cstNode)===null||a===void 0?void 0:a.range)!==null&&c!==void 0?c:Uu.Range.create(0,0,0,0);return[Uu.LocationLink.create(p.$document.uri.toString(),_,T,e.range)]}return}return super.collectLocationLinks(e,r)}findTargetObject(e){return e.isDeclared?e:Fo(e).head()}};var tv=Ie(Qe(),1);var qd=class extends Sd{getIncomingCalls(e,r){if(!ee(e))return;let n=new Map;if(r.forEach(i=>{let s=this.documents.getOrCreateDocument(i.sourceUri).parseResult.value;if(!s.$cstNode)return;let a=dn(s.$cstNode,i.segment.offset);if(!a)return;let c=rt(a.astNode,ee);if(!c||!c.$cstNode)return;let f=this.nameProvider.getNameNode(c);if(!f)return;let p=i.sourceUri.toString(),m=p+"@"+f.text;n.has(m)?n.set(m,{parserRule:c.$cstNode,nameNode:f,targetNodes:[...n.get(m).targetNodes,a],docUri:p}):n.set(m,{parserRule:c.$cstNode,nameNode:f,targetNodes:[a],docUri:p})}),n.size!==0)return Array.from(n.values()).map(i=>({from:{kind:tv.SymbolKind.Method,name:i.nameNode.text,range:i.parserRule.range,selectionRange:i.nameNode.range,uri:i.docUri},fromRanges:i.targetNodes.map(o=>o.range)}))}getOutgoingCalls(e){if(!ee(e))return;let r=St(e).filter(tt).toArray(),n=new Map;if(r.forEach(i=>{var o;let s=i.$cstNode;if(!s)return;let a=(o=i.rule.ref)===null||o===void 0?void 0:o.$cstNode;if(!a)return;let c=this.nameProvider.getNameNode(a.astNode);if(!c)return;let f=ke(a.astNode).uri.toString(),p=f+"@"+c.text;n.has(p)?n.set(p,{refCstNode:a,to:c,from:[...n.get(p).from,s.range],docUri:f}):n.set(p,{refCstNode:a,to:c,from:[s.range],docUri:f})}),n.size!==0)return Array.from(n.values()).map(i=>({to:{kind:tv.SymbolKind.Method,name:i.to.text,range:i.refCstNode.range,selectionRange:i.to.range,uri:i.docUri},fromRanges:i.from}))}};var Fd=class{constructor(e){this.documents=e.shared.workspace.LangiumDocuments}collectValidationResources(e){let r=$S(e,this.documents);return{typeToValidationInfo:this.collectValidationInfo(r),typeToSuperProperties:this.collectSuperProperties(r)}}collectValidationInfo({astResources:e,inferred:r,declared:n}){let i=new Map,o=S$(e);for(let a of Xf(r))i.set(a.name,{inferred:a,inferredNodes:o.get(a.name)});let s=Ce(e.interfaces).concat(e.types).reduce((a,c)=>a.set(c.name,c),new Map);for(let a of Xf(n)){let c=s.get(a.name);if(c){let f=i.get(a.name);i.set(a.name,Object.assign(Object.assign({},f??{}),{declared:a,declaredNode:c}))}}return i}collectSuperProperties({inferred:e,declared:r}){let n=new Map,i=ky(e,r),o=new Map(i.map(s=>[s.name,s]));for(let s of ky(e,r))n.set(s.name,this.addSuperProperties(s,o,new Set));return n}addSuperProperties(e,r,n){if(n.has(e.name))return[];n.add(e.name);let i=[...e.properties];for(let o of e.superTypes){let s=r.get(o.name);s&&i.push(...this.addSuperProperties(s,r,n))}return i}};function S$({parserRules:t,datatypeRules:e}){let r=new Ze;Ce(t).concat(e).forEach(i=>r.add(Ms(i),i));function n(i){if(et(i)){let o=La(i);o&&r.add(o,i)}(Sn(i)||Tr(i)||kn(i))&&i.elements.forEach(o=>n(o))}return t.forEach(i=>n(i.definition)),r}function ok(t){return t&&"declared"in t}function sk(t){return t&&"inferred"in t}function ak(t){return t&&"inferred"in t&&"declared"in t}function uk(t){let e=t.validation.ValidationRegistry,r=t.validation.LangiumGrammarTypesValidator,n={Action:[r.checkActionIsNotUnionType],Grammar:[r.checkDeclaredTypesConsistency,r.checkDeclaredAndInferredTypesConsistency],Interface:[r.checkCyclicInterface],Type:[r.checkCyclicType]};e.register(n,r)}var jd=class{checkCyclicType(e,r){Go(e,new Set)&&r("error",`Type alias '${e.name}' circularly references itself.`,{node:e,property:"name"})}checkCyclicInterface(e,r){Go(e,new Set)&&r("error",`Type '${e.name}' recursively references itself as a base type.`,{node:e,property:"name"})}checkDeclaredTypesConsistency(e,r){var n;let i=(n=e.$document)===null||n===void 0?void 0:n.validationResources;if(i){for(let o of i.typeToValidationInfo.values())if(ok(o)&&ui(o.declared)&&pn(o.declaredNode)){let s=o;C$(s,r),w$(s,r)}}}checkDeclaredAndInferredTypesConsistency(e,r){var n;let i=(n=e.$document)===null||n===void 0?void 0:n.validationResources;if(i)for(let o of i.typeToValidationInfo.values())sk(o)&&o.inferred instanceof Ca&&k$(o.inferred,r),ak(o)&&P$(o,i,r)}checkActionIsNotUnionType(e,r){vr(e.type)&&r("error","Actions cannot create union types.",{node:e,property:"type"})}};function Go(t,e){var r;if(e.has(t))return!0;if(e.add(t),vr(t))return Go(t.type,e);if(pn(t))return t.superTypes.some(n=>n.ref&&Go(n.ref,new Set(e)));if(Hr(t)){if(!((r=t.typeRef)===null||r===void 0)&&r.ref)return Go(t.typeRef.ref,e)}else{if(Ps(t))return Go(t.referenceType,e);if(Es(t))return Go(t.elementType,e);if(jn(t))return t.types.some(n=>Go(n,new Set(e)))}return!1}function k$(t,e){t.properties.forEach(r=>{var n;let i=xy(r.type);if(i.length>1){let o=a=>lo(a)?"ref":"other",s=o(i[0]);if(i.slice(1).some(a=>o(a)!==s)){let a=(n=r.astNodes.values().next())===null||n===void 0?void 0:n.value;a&&e("error",`Mixing a cross-reference with other types is not supported. Consider splitting property "${r.name}" into two or more different properties.`,{node:a})}}})}function C$({declared:t,declaredNode:e},r){Array.from(t.superTypes).forEach((n,i)=>{n&&(ai(n)&&r("error","Interfaces cannot extend union types.",{node:e,property:"superTypes",index:i}),n.declared||r("error","Extending an inferred type is discouraged.",{node:e,property:"superTypes",index:i}))})}function w$({declared:t,declaredNode:e},r){let n=t.properties.reduce((s,a)=>s.add(a.name,a),new Ze);for(let[s,a]of n.entriesGroupedByKey())if(a.length>1)for(let c of a)r("error",`Cannot have two properties with the same name '${s}'.`,{node:Array.from(c.astNodes)[0],property:"name"});let i=Array.from(t.superTypes);for(let s=0;s<i.length;s++)for(let a=s+1;a<i.length;a++){let c=i[s],f=i[a],p=ui(c)?c.superProperties:[],m=ui(f)?f.superProperties:[],T=D$(p,m);T.length>0&&r("error",`Cannot simultaneously inherit from '${c}' and '${f}'. Their ${T.map(_=>"'"+_+"'").join(", ")} properties are not identical.`,{node:e,property:"name"})}let o=new Set;for(let s of i){let a=ui(s)?s.superProperties:[];for(let c of a)o.add(c.name)}for(let s of t.properties)if(o.has(s.name)){let a=e.attributes.find(c=>c.name===s.name);a&&r("error",`Cannot redeclare property '${s.name}'. It is already inherited from another interface.`,{node:a,property:"name"})}}function D$(t,e){let r=[];for(let n of t){let i=e.find(o=>o.name===n.name);i&&!E$(n,i)&&r.push(n.name)}return r}function E$(t,e){return ku(t.type,e.type)&&ku(e.type,t.type)}function P$(t,e,r){let{inferred:n,declared:i,declaredNode:o,inferredNodes:s}=t,a=i.name,c=m=>T=>s.forEach(_=>r("error",`${T}${m?` ${m}`:""}.`,_?.inferredType?{node:_?.inferredType,property:"name"}:{node:_,property:et(_)?"type":"name"})),f=(m,T)=>m.forEach(_=>r("error",T,{node:_,property:je(_)||et(_)?"feature":"name"})),p=m=>{s.forEach(T=>{ee(T)&&Ia(T.definition).find(E=>E.feature===m)===void 0&&r("error",`Property '${m}' is missing in a rule '${T.name}', but is required in type '${a}'.`,{node:T,property:"parameters"})})};if(ai(n)&&ai(i))A$(n.type,i.type,c(`in a rule that returns type '${a}'`));else if(ui(n)&&ui(i))N$(n,i,e,c(`in a rule that returns type '${a}'`),f,p);else{let m=`Inferred and declared versions of type '${a}' both have to be interfaces or unions.`;c()(m),r("error",m,{node:o,property:"name"})}}function A$(t,e,r){ku(t,e)||r(`Cannot assign type '${ci(t,"DeclaredType")}' to '${ci(e,"DeclaredType")}'`)}function ck(t){return t.optional||zf(t.type)}function N$(t,e,r,n,i,o){let s=new Set(t.properties.map(m=>m.name)),a=new Map(t.allProperties.map(m=>[m.name,m])),c=new Map(e.superProperties.map(m=>[m.name,m])),f=m=>{if(pr(m))return{types:m.types.map(T=>f(T))};if(lo(m))return{referenceType:f(m.referenceType)};if(fo(m))return{elementType:f(m.elementType)};if(Cn(m)){let T=r.typeToValidationInfo.get(m.value.name);return T?{value:"declared"in T?T.declared:T.inferred}:m}return m};for(let[m,T]of a.entries()){let _=c.get(m);if(_){let E=ci(T.type,"DeclaredType"),N=ci(_.type,"DeclaredType");if(!ku(f(T.type),_.type)&&N!=="unknown"){let A=`The assigned type '${E}' is not compatible with the declared property '${m}' of type '${N}'.`;i(T.astNodes,A)}T.optional&&!ck(_)&&o(m)}else s.has(m)&&i(T.astNodes,`A property '${m}' is not expected.`)}let p=new Set;for(let[m,T]of c.entries())!a.get(m)&&!ck(T)&&p.add(m);if(p.size>0){let m=p.size>1?"Properties":"A property",T=p.size>1?"are expected":"is expected",_=Array.from(p).map(E=>`'${E}'`).sort().join(", ");n(`${m} ${_} ${T}.`)}}var I$={validation:{LangiumGrammarValidator:t=>new nd(t),ValidationResourcesCollector:t=>new Fd(t),LangiumGrammarTypesValidator:()=>new jd},lsp:{FoldingRangeProvider:t=>new gd(t),CodeActionProvider:t=>new fd(t),SemanticTokenProvider:t=>new bd(t),Formatter:()=>new Td,DefinitionProvider:t=>new $d(t),CallHierarchyProvider:t=>new qd(t),CompletionProvider:t=>new hd(t)},references:{ScopeComputation:t=>new ud(t),ScopeProvider:t=>new cd(t),References:t=>new _d(t),NameProvider:()=>new xd}};function lk(t,e){let r=ws(Hu(t),qS,e),n=ws(Wu({shared:r}),FS,I$);return O$(r,n),r.ServiceRegistry.register(n),bS(n),uk(n),{shared:r,grammar:n}}function O$(t,e){t.workspace.DocumentBuilder.onBuildPhase(st.IndexedReferences,async(n,i)=>{for(let o of n){await kt(i);let s=e.validation.ValidationResourcesCollector,a=o.parseResult.value;o.validationResources=s.collectValidationResources(a)}})}var rv=class{readFile(){throw new Error("Method not implemented.")}readFileSync(){throw new Error("Method not implemented.")}async readDirectory(){return[]}},Ud={fileSystemProvider:()=>new rv};function md(t){return t.rules.find(e=>ee(e)&&e.entry)}function L$(t){return t.rules.filter(e=>Be(e)&&e.hidden)}function Na(t,e){let r=new Set,n=md(t);if(!n)return new Set(t.rules);let i=[n].concat(L$(t));for(let s of i)fk(s,r,e);let o=new Set;for(let s of t.rules)(r.has(s.name)||Be(s)&&s.hidden)&&o.add(s);return o}function fk(t,e,r){e.add(t.name),St(t).forEach(n=>{if(tt(n)||r&&jf(n)){let i=n.rule.ref;i&&!e.has(i.name)&&fk(i,e,r)}})}function pd(t){if(t.terminal)return t.terminal;if(t.type.ref){let e=Mu(t.type.ref);return e?.terminal}}function dk(t){return t.hidden&&!Hn(t).test(" ")}function jo(t,e){return!t||!e?[]:nv(t,e,t.astNode,!0)}function Pr(t,e,r){if(!t||!e)return;let n=nv(t,e,t.astNode,!0);if(n.length!==0)return r!==void 0?r=Math.max(0,Math.min(r,n.length-1)):r=0,n[r]}function nv(t,e,r,n){if(!n){let i=rt(t.grammarSource,je);if(i&&i.feature===e)return[t]}return Pi(t)&&t.astNode===r?t.content.flatMap(i=>nv(i,e,r,!1)):[]}function vd(t,e){return t?pk(t,e,t?.astNode):[]}function Un(t,e,r){if(!t)return;let n=pk(t,e,t?.astNode);if(n.length!==0)return r!==void 0?r=Math.max(0,Math.min(r,n.length-1)):r=0,n[r]}function pk(t,e,r){if(t.astNode!==r)return[];if(Ht(t.grammarSource)&&t.grammarSource.value===e)return[t];let n=cy(t).iterator(),i,o=[];do if(i=n.next(),!i.done){let s=i.value;s.astNode===r?Ht(s.grammarSource)&&s.grammarSource.value===e&&o.push(s):n.prune()}while(!i.done);return o}function Ba(t){var e;let r=t.astNode;for(;r===((e=t.container)===null||e===void 0?void 0:e.astNode);){let n=rt(t.grammarSource,je);if(n)return n;t=t.container}}function Mu(t){return Ra(t)&&(t=t.$container),mk(t,new Map)}function mk(t,e){var r;function n(i,o){let s;return rt(i,je)||(s=mk(o,e)),e.set(t,s),s}if(e.has(t))return e.get(t);e.set(t,void 0);for(let i of St(t)){if(je(i)&&i.feature.toLowerCase()==="name")return e.set(t,i),i;if(tt(i)&&ee(i.rule.ref))return n(i,i.rule.ref);if(Hr(i)&&(!((r=i.typeRef)===null||r===void 0)&&r.ref))return n(i,i.typeRef.ref)}}function Zf(t){var e;let r=lk(Ud).grammar,n=r.serializer.JsonSerializer.deserialize(t);return r.shared.workspace.LangiumDocumentFactory.fromModel(n,Ar.parse(`memory://${(e=n.name)!==null&&e!==void 0?e:"grammar"}.langium`)),n}function hk(t){let e=[],r=t.Grammar;for(let n of r.rules)Be(n)&&dk(n)&&fS(Hn(n))&&e.push(n.name);return{multilineCommentRules:e,nameRegexp:uy}}var M$=typeof global=="object"&&global&&global.Object===Object&&global,Wd=M$;var $$=typeof self=="object"&&self&&self.Object===Object&&self,q$=Wd||$$||Function("return this")(),nr=q$;var F$=nr.Symbol,Rr=F$;var gk=Object.prototype,j$=gk.hasOwnProperty,U$=gk.toString,Gu=Rr?Rr.toStringTag:void 0;function W$(t){var e=j$.call(t,Gu),r=t[Gu];try{t[Gu]=void 0;var n=!0}catch{}var i=U$.call(t);return n&&(e?t[Gu]=r:delete t[Gu]),i}var yk=W$;var H$=Object.prototype,G$=H$.toString;function B$(t){return G$.call(t)}var vk=B$;var K$="[object Null]",z$="[object Undefined]",Tk=Rr?Rr.toStringTag:void 0;function V$(t){return t==null?t===void 0?z$:K$:Tk&&Tk in Object(t)?yk(t):vk(t)}var en=V$;function X$(t){return t!=null&&typeof t=="object"}var zt=X$;var Y$="[object Symbol]";function J$(t){return typeof t=="symbol"||zt(t)&&en(t)==Y$}var Oi=J$;function Q$(t,e){for(var r=-1,n=t==null?0:t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}var Li=Q$;var Z$=Array.isArray,oe=Z$;var eq=1/0,Rk=Rr?Rr.prototype:void 0,bk=Rk?Rk.toString:void 0;function xk(t){if(typeof t=="string")return t;if(oe(t))return Li(t,xk)+"";if(Oi(t))return bk?bk.call(t):"";var e=t+"";return e=="0"&&1/t==-eq?"-0":e}var _k=xk;var tq=/\s/;function rq(t){for(var e=t.length;e--&&tq.test(t.charAt(e)););return e}var Sk=rq;var nq=/^\s+/;function iq(t){return t&&t.slice(0,Sk(t)+1).replace(nq,"")}var kk=iq;function oq(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var Mt=oq;var Ck=0/0,sq=/^[-+]0x[0-9a-f]+$/i,aq=/^0b[01]+$/i,cq=/^0o[0-7]+$/i,uq=parseInt;function lq(t){if(typeof t=="number")return t;if(Oi(t))return Ck;if(Mt(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Mt(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=kk(t);var r=aq.test(t);return r||cq.test(t)?uq(t.slice(2),r?2:8):sq.test(t)?Ck:+t}var wk=lq;var Dk=1/0,fq=17976931348623157e292;function dq(t){if(!t)return t===0?t:0;if(t=wk(t),t===Dk||t===-Dk){var e=t<0?-1:1;return e*fq}return t===t?t:0}var Ek=dq;function pq(t){var e=Ek(t),r=e%1;return e===e?r?e-r:e:0}var Mi=pq;function mq(t){return t}var mn=mq;var hq="[object AsyncFunction]",gq="[object Function]",yq="[object GeneratorFunction]",vq="[object Proxy]";function Tq(t){if(!Mt(t))return!1;var e=en(t);return e==gq||e==yq||e==hq||e==vq}var tn=Tq;var Rq=nr["__core-js_shared__"],Hd=Rq;var Pk=function(){var t=/[^.]+$/.exec(Hd&&Hd.keys&&Hd.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function bq(t){return!!Pk&&Pk in t}var Ak=bq;var xq=Function.prototype,_q=xq.toString;function Sq(t){if(t!=null){try{return _q.call(t)}catch{}try{return t+""}catch{}}return""}var vo=Sq;var kq=/[\\^$.*+?()[\]{}|]/g,Cq=/^\[object .+?Constructor\]$/,wq=Function.prototype,Dq=Object.prototype,Eq=wq.toString,Pq=Dq.hasOwnProperty,Aq=RegExp("^"+Eq.call(Pq).replace(kq,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Nq(t){if(!Mt(t)||Ak(t))return!1;var e=tn(t)?Aq:Cq;return e.test(vo(t))}var Nk=Nq;function Iq(t,e){return t?.[e]}var Ik=Iq;function Oq(t,e){var r=Ik(t,e);return Nk(r)?r:void 0}var hn=Oq;var Lq=hn(nr,"WeakMap"),Gd=Lq;var Ok=Object.create,Mq=function(){function t(){}return function(e){if(!Mt(e))return{};if(Ok)return Ok(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),Lk=Mq;function $q(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}var Mk=$q;function qq(){}var $t=qq;function Fq(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}var $k=Fq;var jq=800,Uq=16,Wq=Date.now;function Hq(t){var e=0,r=0;return function(){var n=Wq(),i=Uq-(n-r);if(r=n,i>0){if(++e>=jq)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var qk=Hq;function Gq(t){return function(){return t}}var Fk=Gq;var Bq=function(){try{var t=hn(Object,"defineProperty");return t({},"",{}),t}catch{}}(),Va=Bq;var Kq=Va?function(t,e){return Va(t,"toString",{configurable:!0,enumerable:!1,value:Fk(e),writable:!0})}:mn,jk=Kq;var zq=qk(jk),Uk=zq;function Vq(t,e){for(var r=-1,n=t==null?0:t.length;++r<n&&e(t[r],r,t)!==!1;);return t}var Bd=Vq;function Xq(t,e,r,n){for(var i=t.length,o=r+(n?1:-1);n?o--:++o<i;)if(e(t[o],o,t))return o;return-1}var Kd=Xq;function Yq(t){return t!==t}var Wk=Yq;function Jq(t,e,r){for(var n=r-1,i=t.length;++n<i;)if(t[n]===e)return n;return-1}var Hk=Jq;function Qq(t,e,r){return e===e?Hk(t,e,r):Kd(t,Wk,r)}var Xa=Qq;function Zq(t,e){var r=t==null?0:t.length;return!!r&&Xa(t,e,0)>-1}var zd=Zq;var eF=9007199254740991,tF=/^(?:0|[1-9]\d*)$/;function rF(t,e){var r=typeof t;return e=e??eF,!!e&&(r=="number"||r!="symbol"&&tF.test(t))&&t>-1&&t%1==0&&t<e}var Bo=rF;function nF(t,e,r){e=="__proto__"&&Va?Va(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var Ya=nF;function iF(t,e){return t===e||t!==t&&e!==e}var $i=iF;var oF=Object.prototype,sF=oF.hasOwnProperty;function aF(t,e,r){var n=t[e];(!(sF.call(t,e)&&$i(n,r))||r===void 0&&!(e in t))&&Ya(t,e,r)}var Ko=aF;function cF(t,e,r,n){var i=!r;r||(r={});for(var o=-1,s=e.length;++o<s;){var a=e[o],c=n?n(r[a],t[a],a,r,t):void 0;c===void 0&&(c=t[a]),i?Ya(r,a,c):Ko(r,a,c)}return r}var qi=cF;var Gk=Math.max;function uF(t,e,r){return e=Gk(e===void 0?t.length-1:e,0),function(){for(var n=arguments,i=-1,o=Gk(n.length-e,0),s=Array(o);++i<o;)s[i]=n[e+i];i=-1;for(var a=Array(e+1);++i<e;)a[i]=n[i];return a[e]=r(s),Mk(t,this,a)}}var Bk=uF;function lF(t,e){return Uk(Bk(t,e,mn),t+"")}var Ja=lF;var fF=9007199254740991;function dF(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=fF}var Qa=dF;function pF(t){return t!=null&&Qa(t.length)&&!tn(t)}var ir=pF;function mF(t,e,r){if(!Mt(r))return!1;var n=typeof e;return(n=="number"?ir(r)&&Bo(e,r.length):n=="string"&&e in r)?$i(r[e],t):!1}var zo=mF;function hF(t){return Ja(function(e,r){var n=-1,i=r.length,o=i>1?r[i-1]:void 0,s=i>2?r[2]:void 0;for(o=t.length>3&&typeof o=="function"?(i--,o):void 0,s&&zo(r[0],r[1],s)&&(o=i<3?void 0:o,i=1),e=Object(e);++n<i;){var a=r[n];a&&t(e,a,n,o)}return e})}var Kk=hF;var gF=Object.prototype;function yF(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||gF;return t===r}var Fi=yF;function vF(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}var zk=vF;var TF="[object Arguments]";function RF(t){return zt(t)&&en(t)==TF}var iv=RF;var Vk=Object.prototype,bF=Vk.hasOwnProperty,xF=Vk.propertyIsEnumerable,_F=iv(function(){return arguments}())?iv:function(t){return zt(t)&&bF.call(t,"callee")&&!xF.call(t,"callee")},Vo=_F;function SF(){return!1}var Xk=SF;var Qk=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Yk=Qk&&typeof module=="object"&&module&&!module.nodeType&&module,kF=Yk&&Yk.exports===Qk,Jk=kF?nr.Buffer:void 0,CF=Jk?Jk.isBuffer:void 0,wF=CF||Xk,To=wF;var DF="[object Arguments]",EF="[object Array]",PF="[object Boolean]",AF="[object Date]",NF="[object Error]",IF="[object Function]",OF="[object Map]",LF="[object Number]",MF="[object Object]",$F="[object RegExp]",qF="[object Set]",FF="[object String]",jF="[object WeakMap]",UF="[object ArrayBuffer]",WF="[object DataView]",HF="[object Float32Array]",GF="[object Float64Array]",BF="[object Int8Array]",KF="[object Int16Array]",zF="[object Int32Array]",VF="[object Uint8Array]",XF="[object Uint8ClampedArray]",YF="[object Uint16Array]",JF="[object Uint32Array]",xt={};xt[HF]=xt[GF]=xt[BF]=xt[KF]=xt[zF]=xt[VF]=xt[XF]=xt[YF]=xt[JF]=!0;xt[DF]=xt[EF]=xt[UF]=xt[PF]=xt[WF]=xt[AF]=xt[NF]=xt[IF]=xt[OF]=xt[LF]=xt[MF]=xt[$F]=xt[qF]=xt[FF]=xt[jF]=!1;function QF(t){return zt(t)&&Qa(t.length)&&!!xt[en(t)]}var Zk=QF;function ZF(t){return function(e){return t(e)}}var ji=ZF;var eC=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Bu=eC&&typeof module=="object"&&module&&!module.nodeType&&module,e1=Bu&&Bu.exports===eC,ov=e1&&Wd.process,t1=function(){try{var t=Bu&&Bu.require&&Bu.require("util").types;return t||ov&&ov.binding&&ov.binding("util")}catch{}}(),Bn=t1;var tC=Bn&&Bn.isTypedArray,r1=tC?ji(tC):Zk,Za=r1;var n1=Object.prototype,i1=n1.hasOwnProperty;function o1(t,e){var r=oe(t),n=!r&&Vo(t),i=!r&&!n&&To(t),o=!r&&!n&&!i&&Za(t),s=r||n||i||o,a=s?zk(t.length,String):[],c=a.length;for(var f in t)(e||i1.call(t,f))&&!(s&&(f=="length"||i&&(f=="offset"||f=="parent")||o&&(f=="buffer"||f=="byteLength"||f=="byteOffset")||Bo(f,c)))&&a.push(f);return a}var Vd=o1;function s1(t,e){return function(r){return t(e(r))}}var Xd=s1;var a1=Xd(Object.keys,Object),rC=a1;var c1=Object.prototype,u1=c1.hasOwnProperty;function l1(t){if(!Fi(t))return rC(t);var e=[];for(var r in Object(t))u1.call(t,r)&&r!="constructor"&&e.push(r);return e}var Yd=l1;function f1(t){return ir(t)?Vd(t):Yd(t)}var dt=f1;var d1=Object.prototype,p1=d1.hasOwnProperty,m1=Kk(function(t,e){if(Fi(e)||ir(e)){qi(e,dt(e),t);return}for(var r in e)p1.call(e,r)&&Ko(t,r,e[r])}),Nr=m1;function h1(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var nC=h1;var g1=Object.prototype,y1=g1.hasOwnProperty;function v1(t){if(!Mt(t))return nC(t);var e=Fi(t),r=[];for(var n in t)n=="constructor"&&(e||!y1.call(t,n))||r.push(n);return r}var iC=v1;function T1(t){return ir(t)?Vd(t,!0):iC(t)}var Xo=T1;var R1=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,b1=/^\w*$/;function x1(t,e){if(oe(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||Oi(t)?!0:b1.test(t)||!R1.test(t)||e!=null&&t in Object(e)}var ec=x1;var _1=hn(Object,"create"),Ro=_1;function S1(){this.__data__=Ro?Ro(null):{},this.size=0}var oC=S1;function k1(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var sC=k1;var C1="__lodash_hash_undefined__",w1=Object.prototype,D1=w1.hasOwnProperty;function E1(t){var e=this.__data__;if(Ro){var r=e[t];return r===C1?void 0:r}return D1.call(e,t)?e[t]:void 0}var aC=E1;var P1=Object.prototype,A1=P1.hasOwnProperty;function N1(t){var e=this.__data__;return Ro?e[t]!==void 0:A1.call(e,t)}var cC=N1;var I1="__lodash_hash_undefined__";function O1(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=Ro&&e===void 0?I1:e,this}var uC=O1;function tc(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}tc.prototype.clear=oC;tc.prototype.delete=sC;tc.prototype.get=aC;tc.prototype.has=cC;tc.prototype.set=uC;var sv=tc;function L1(){this.__data__=[],this.size=0}var lC=L1;function M1(t,e){for(var r=t.length;r--;)if($i(t[r][0],e))return r;return-1}var Yo=M1;var $1=Array.prototype,q1=$1.splice;function F1(t){var e=this.__data__,r=Yo(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():q1.call(e,r,1),--this.size,!0}var fC=F1;function j1(t){var e=this.__data__,r=Yo(e,t);return r<0?void 0:e[r][1]}var dC=j1;function U1(t){return Yo(this.__data__,t)>-1}var pC=U1;function W1(t,e){var r=this.__data__,n=Yo(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}var mC=W1;function rc(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}rc.prototype.clear=lC;rc.prototype.delete=fC;rc.prototype.get=dC;rc.prototype.has=pC;rc.prototype.set=mC;var Jo=rc;var H1=hn(nr,"Map"),Qo=H1;function G1(){this.size=0,this.__data__={hash:new sv,map:new(Qo||Jo),string:new sv}}var hC=G1;function B1(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var gC=B1;function K1(t,e){var r=t.__data__;return gC(e)?r[typeof e=="string"?"string":"hash"]:r.map}var Zo=K1;function z1(t){var e=Zo(this,t).delete(t);return this.size-=e?1:0,e}var yC=z1;function V1(t){return Zo(this,t).get(t)}var vC=V1;function X1(t){return Zo(this,t).has(t)}var TC=X1;function Y1(t,e){var r=Zo(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}var RC=Y1;function nc(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}nc.prototype.clear=hC;nc.prototype.delete=yC;nc.prototype.get=vC;nc.prototype.has=TC;nc.prototype.set=RC;var Fs=nc;var J1="Expected a function";function av(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(J1);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var s=t.apply(this,n);return r.cache=o.set(i,s)||o,s};return r.cache=new(av.Cache||Fs),r}av.Cache=Fs;var bC=av;var Q1=500;function Z1(t){var e=bC(t,function(n){return r.size===Q1&&r.clear(),n}),r=e.cache;return e}var xC=Z1;var ej=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,tj=/\\(\\)?/g,rj=xC(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(ej,function(r,n,i,o){e.push(i?o.replace(tj,"$1"):n||r)}),e}),_C=rj;function nj(t){return t==null?"":_k(t)}var SC=nj;function ij(t,e){return oe(t)?t:ec(t,e)?[t]:_C(SC(t))}var es=ij;var oj=1/0;function sj(t){if(typeof t=="string"||Oi(t))return t;var e=t+"";return e=="0"&&1/t==-oj?"-0":e}var Ui=sj;function aj(t,e){e=es(e,t);for(var r=0,n=e.length;t!=null&&r<n;)t=t[Ui(e[r++])];return r&&r==n?t:void 0}var ic=aj;function cj(t,e,r){var n=t==null?void 0:ic(t,e);return n===void 0?r:n}var kC=cj;function uj(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}var oc=uj;var CC=Rr?Rr.isConcatSpreadable:void 0;function lj(t){return oe(t)||Vo(t)||!!(CC&&t&&t[CC])}var wC=lj;function DC(t,e,r,n,i){var o=-1,s=t.length;for(r||(r=wC),i||(i=[]);++o<s;){var a=t[o];e>0&&r(a)?e>1?DC(a,e-1,r,n,i):oc(i,a):n||(i[i.length]=a)}return i}var sc=DC;function fj(t){var e=t==null?0:t.length;return e?sc(t,1):[]}var Vt=fj;var dj=Xd(Object.getPrototypeOf,Object),Jd=dj;function pj(t,e,r){var n=-1,i=t.length;e<0&&(e=-e>i?0:i+e),r=r>i?i:r,r<0&&(r+=i),i=e>r?0:r-e>>>0,e>>>=0;for(var o=Array(i);++n<i;)o[n]=t[n+e];return o}var Qd=pj;function mj(t,e,r,n){var i=-1,o=t==null?0:t.length;for(n&&o&&(r=t[++i]);++i<o;)r=e(r,t[i],i,t);return r}var EC=mj;function hj(){this.__data__=new Jo,this.size=0}var PC=hj;function gj(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var AC=gj;function yj(t){return this.__data__.get(t)}var NC=yj;function vj(t){return this.__data__.has(t)}var IC=vj;var Tj=200;function Rj(t,e){var r=this.__data__;if(r instanceof Jo){var n=r.__data__;if(!Qo||n.length<Tj-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new Fs(n)}return r.set(t,e),this.size=r.size,this}var OC=Rj;function ac(t){var e=this.__data__=new Jo(t);this.size=e.size}ac.prototype.clear=PC;ac.prototype.delete=AC;ac.prototype.get=NC;ac.prototype.has=IC;ac.prototype.set=OC;var ts=ac;function bj(t,e){return t&&qi(e,dt(e),t)}var LC=bj;function xj(t,e){return t&&qi(e,Xo(e),t)}var MC=xj;var jC=typeof exports=="object"&&exports&&!exports.nodeType&&exports,$C=jC&&typeof module=="object"&&module&&!module.nodeType&&module,_j=$C&&$C.exports===jC,qC=_j?nr.Buffer:void 0,FC=qC?qC.allocUnsafe:void 0;function Sj(t,e){if(e)return t.slice();var r=t.length,n=FC?FC(r):new t.constructor(r);return t.copy(n),n}var UC=Sj;function kj(t,e){for(var r=-1,n=t==null?0:t.length,i=0,o=[];++r<n;){var s=t[r];e(s,r,t)&&(o[i++]=s)}return o}var cc=kj;function Cj(){return[]}var Zd=Cj;var wj=Object.prototype,Dj=wj.propertyIsEnumerable,WC=Object.getOwnPropertySymbols,Ej=WC?function(t){return t==null?[]:(t=Object(t),cc(WC(t),function(e){return Dj.call(t,e)}))}:Zd,uc=Ej;function Pj(t,e){return qi(t,uc(t),e)}var HC=Pj;var Aj=Object.getOwnPropertySymbols,Nj=Aj?function(t){for(var e=[];t;)oc(e,uc(t)),t=Jd(t);return e}:Zd,ep=Nj;function Ij(t,e){return qi(t,ep(t),e)}var GC=Ij;function Oj(t,e,r){var n=e(t);return oe(t)?n:oc(n,r(t))}var tp=Oj;function Lj(t){return tp(t,dt,uc)}var Ku=Lj;function Mj(t){return tp(t,Xo,ep)}var rp=Mj;var $j=hn(nr,"DataView"),np=$j;var qj=hn(nr,"Promise"),ip=qj;var Fj=hn(nr,"Set"),rs=Fj;var BC="[object Map]",jj="[object Object]",KC="[object Promise]",zC="[object Set]",VC="[object WeakMap]",XC="[object DataView]",Uj=vo(np),Wj=vo(Qo),Hj=vo(ip),Gj=vo(rs),Bj=vo(Gd),js=en;(np&&js(new np(new ArrayBuffer(1)))!=XC||Qo&&js(new Qo)!=BC||ip&&js(ip.resolve())!=KC||rs&&js(new rs)!=zC||Gd&&js(new Gd)!=VC)&&(js=function(t){var e=en(t),r=e==jj?t.constructor:void 0,n=r?vo(r):"";if(n)switch(n){case Uj:return XC;case Wj:return BC;case Hj:return KC;case Gj:return zC;case Bj:return VC}return e});var pi=js;var Kj=Object.prototype,zj=Kj.hasOwnProperty;function Vj(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&zj.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var YC=Vj;var Xj=nr.Uint8Array,lc=Xj;function Yj(t){var e=new t.constructor(t.byteLength);return new lc(e).set(new lc(t)),e}var fc=Yj;function Jj(t,e){var r=e?fc(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var JC=Jj;var Qj=/\w*$/;function Zj(t){var e=new t.constructor(t.source,Qj.exec(t));return e.lastIndex=t.lastIndex,e}var QC=Zj;var ZC=Rr?Rr.prototype:void 0,ew=ZC?ZC.valueOf:void 0;function eU(t){return ew?Object(ew.call(t)):{}}var tw=eU;function tU(t,e){var r=e?fc(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var rw=tU;var rU="[object Boolean]",nU="[object Date]",iU="[object Map]",oU="[object Number]",sU="[object RegExp]",aU="[object Set]",cU="[object String]",uU="[object Symbol]",lU="[object ArrayBuffer]",fU="[object DataView]",dU="[object Float32Array]",pU="[object Float64Array]",mU="[object Int8Array]",hU="[object Int16Array]",gU="[object Int32Array]",yU="[object Uint8Array]",vU="[object Uint8ClampedArray]",TU="[object Uint16Array]",RU="[object Uint32Array]";function bU(t,e,r){var n=t.constructor;switch(e){case lU:return fc(t);case rU:case nU:return new n(+t);case fU:return JC(t,r);case dU:case pU:case mU:case hU:case gU:case yU:case vU:case TU:case RU:return rw(t,r);case iU:return new n;case oU:case cU:return new n(t);case sU:return QC(t);case aU:return new n;case uU:return tw(t)}}var nw=bU;function xU(t){return typeof t.constructor=="function"&&!Fi(t)?Lk(Jd(t)):{}}var iw=xU;var _U="[object Map]";function SU(t){return zt(t)&&pi(t)==_U}var ow=SU;var sw=Bn&&Bn.isMap,kU=sw?ji(sw):ow,aw=kU;var CU="[object Set]";function wU(t){return zt(t)&&pi(t)==CU}var cw=wU;var uw=Bn&&Bn.isSet,DU=uw?ji(uw):cw,lw=DU;var EU=1,PU=2,AU=4,fw="[object Arguments]",NU="[object Array]",IU="[object Boolean]",OU="[object Date]",LU="[object Error]",dw="[object Function]",MU="[object GeneratorFunction]",$U="[object Map]",qU="[object Number]",pw="[object Object]",FU="[object RegExp]",jU="[object Set]",UU="[object String]",WU="[object Symbol]",HU="[object WeakMap]",GU="[object ArrayBuffer]",BU="[object DataView]",KU="[object Float32Array]",zU="[object Float64Array]",VU="[object Int8Array]",XU="[object Int16Array]",YU="[object Int32Array]",JU="[object Uint8Array]",QU="[object Uint8ClampedArray]",ZU="[object Uint16Array]",eW="[object Uint32Array]",pt={};pt[fw]=pt[NU]=pt[GU]=pt[BU]=pt[IU]=pt[OU]=pt[KU]=pt[zU]=pt[VU]=pt[XU]=pt[YU]=pt[$U]=pt[qU]=pt[pw]=pt[FU]=pt[jU]=pt[UU]=pt[WU]=pt[JU]=pt[QU]=pt[ZU]=pt[eW]=!0;pt[LU]=pt[dw]=pt[HU]=!1;function op(t,e,r,n,i,o){var s,a=e&EU,c=e&PU,f=e&AU;if(r&&(s=i?r(t,n,i,o):r(t)),s!==void 0)return s;if(!Mt(t))return t;var p=oe(t);if(p){if(s=YC(t),!a)return $k(t,s)}else{var m=pi(t),T=m==dw||m==MU;if(To(t))return UC(t,a);if(m==pw||m==fw||T&&!i){if(s=c||T?{}:iw(t),!a)return c?GC(t,MC(s,t)):HC(t,LC(s,t))}else{if(!pt[m])return i?t:{};s=nw(t,m,a)}}o||(o=new ts);var _=o.get(t);if(_)return _;o.set(t,s),lw(t)?t.forEach(function(I){s.add(op(I,e,r,I,t,o))}):aw(t)&&t.forEach(function(I,A){s.set(A,op(I,e,r,A,t,o))});var E=f?c?rp:Ku:c?Xo:dt,N=p?void 0:E(t);return Bd(N||t,function(I,A){N&&(A=I,I=t[A]),Ko(s,A,op(I,e,r,A,t,o))}),s}var mw=op;var tW=4;function rW(t){return mw(t,tW)}var mt=rW;function nW(t){for(var e=-1,r=t==null?0:t.length,n=0,i=[];++e<r;){var o=t[e];o&&(i[n++]=o)}return i}var Wi=nW;var iW="__lodash_hash_undefined__";function oW(t){return this.__data__.set(t,iW),this}var hw=oW;function sW(t){return this.__data__.has(t)}var gw=sW;function sp(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new Fs;++e<r;)this.add(t[e])}sp.prototype.add=sp.prototype.push=hw;sp.prototype.has=gw;var dc=sp;function aW(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}var ap=aW;function cW(t,e){return t.has(e)}var pc=cW;var uW=1,lW=2;function fW(t,e,r,n,i,o){var s=r&uW,a=t.length,c=e.length;if(a!=c&&!(s&&c>a))return!1;var f=o.get(t),p=o.get(e);if(f&&p)return f==e&&p==t;var m=-1,T=!0,_=r&lW?new dc:void 0;for(o.set(t,e),o.set(e,t);++m<a;){var E=t[m],N=e[m];if(n)var I=s?n(N,E,m,e,t,o):n(E,N,m,t,e,o);if(I!==void 0){if(I)continue;T=!1;break}if(_){if(!ap(e,function(A,y){if(!pc(_,y)&&(E===A||i(E,A,r,n,o)))return _.push(y)})){T=!1;break}}else if(!(E===N||i(E,N,r,n,o))){T=!1;break}}return o.delete(t),o.delete(e),T}var cp=fW;function dW(t){var e=-1,r=Array(t.size);return t.forEach(function(n,i){r[++e]=[i,n]}),r}var yw=dW;function pW(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var mc=pW;var mW=1,hW=2,gW="[object Boolean]",yW="[object Date]",vW="[object Error]",TW="[object Map]",RW="[object Number]",bW="[object RegExp]",xW="[object Set]",_W="[object String]",SW="[object Symbol]",kW="[object ArrayBuffer]",CW="[object DataView]",vw=Rr?Rr.prototype:void 0,cv=vw?vw.valueOf:void 0;function wW(t,e,r,n,i,o,s){switch(r){case CW:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case kW:return!(t.byteLength!=e.byteLength||!o(new lc(t),new lc(e)));case gW:case yW:case RW:return $i(+t,+e);case vW:return t.name==e.name&&t.message==e.message;case bW:case _W:return t==e+"";case TW:var a=yw;case xW:var c=n&mW;if(a||(a=mc),t.size!=e.size&&!c)return!1;var f=s.get(t);if(f)return f==e;n|=hW,s.set(t,e);var p=cp(a(t),a(e),n,i,o,s);return s.delete(t),p;case SW:if(cv)return cv.call(t)==cv.call(e)}return!1}var Tw=wW;var DW=1,EW=Object.prototype,PW=EW.hasOwnProperty;function AW(t,e,r,n,i,o){var s=r&DW,a=Ku(t),c=a.length,f=Ku(e),p=f.length;if(c!=p&&!s)return!1;for(var m=c;m--;){var T=a[m];if(!(s?T in e:PW.call(e,T)))return!1}var _=o.get(t),E=o.get(e);if(_&&E)return _==e&&E==t;var N=!0;o.set(t,e),o.set(e,t);for(var I=s;++m<c;){T=a[m];var A=t[T],y=e[T];if(n)var h=s?n(y,A,T,e,t,o):n(A,y,T,t,e,o);if(!(h===void 0?A===y||i(A,y,r,n,o):h)){N=!1;break}I||(I=T=="constructor")}if(N&&!I){var C=t.constructor,L=e.constructor;C!=L&&"constructor"in t&&"constructor"in e&&!(typeof C=="function"&&C instanceof C&&typeof L=="function"&&L instanceof L)&&(N=!1)}return o.delete(t),o.delete(e),N}var Rw=AW;var NW=1,bw="[object Arguments]",xw="[object Array]",up="[object Object]",IW=Object.prototype,_w=IW.hasOwnProperty;function OW(t,e,r,n,i,o){var s=oe(t),a=oe(e),c=s?xw:pi(t),f=a?xw:pi(e);c=c==bw?up:c,f=f==bw?up:f;var p=c==up,m=f==up,T=c==f;if(T&&To(t)){if(!To(e))return!1;s=!0,p=!1}if(T&&!p)return o||(o=new ts),s||Za(t)?cp(t,e,r,n,i,o):Tw(t,e,c,r,n,i,o);if(!(r&NW)){var _=p&&_w.call(t,"__wrapped__"),E=m&&_w.call(e,"__wrapped__");if(_||E){var N=_?t.value():t,I=E?e.value():e;return o||(o=new ts),i(N,I,r,n,o)}}return T?(o||(o=new ts),Rw(t,e,r,n,i,o)):!1}var Sw=OW;function kw(t,e,r,n,i){return t===e?!0:t==null||e==null||!zt(t)&&!zt(e)?t!==t&&e!==e:Sw(t,e,r,n,kw,i)}var lp=kw;var LW=1,MW=2;function $W(t,e,r,n){var i=r.length,o=i,s=!n;if(t==null)return!o;for(t=Object(t);i--;){var a=r[i];if(s&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++i<o;){a=r[i];var c=a[0],f=t[c],p=a[1];if(s&&a[2]){if(f===void 0&&!(c in t))return!1}else{var m=new ts;if(n)var T=n(f,p,c,t,e,m);if(!(T===void 0?lp(p,f,LW|MW,n,m):T))return!1}}return!0}var Cw=$W;function qW(t){return t===t&&!Mt(t)}var fp=qW;function FW(t){for(var e=dt(t),r=e.length;r--;){var n=e[r],i=t[n];e[r]=[n,i,fp(i)]}return e}var ww=FW;function jW(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}var dp=jW;function UW(t){var e=ww(t);return e.length==1&&e[0][2]?dp(e[0][0],e[0][1]):function(r){return r===t||Cw(r,t,e)}}var Dw=UW;function WW(t,e){return t!=null&&e in Object(t)}var Ew=WW;function HW(t,e,r){e=es(e,t);for(var n=-1,i=e.length,o=!1;++n<i;){var s=Ui(e[n]);if(!(o=t!=null&&r(t,s)))break;t=t[s]}return o||++n!=i?o:(i=t==null?0:t.length,!!i&&Qa(i)&&Bo(s,i)&&(oe(t)||Vo(t)))}var pp=HW;function GW(t,e){return t!=null&&pp(t,e,Ew)}var Pw=GW;var BW=1,KW=2;function zW(t,e){return ec(t)&&fp(e)?dp(Ui(t),e):function(r){var n=kC(r,t);return n===void 0&&n===e?Pw(r,t):lp(e,n,BW|KW)}}var Aw=zW;function VW(t){return function(e){return e?.[t]}}var Nw=VW;function XW(t){return function(e){return ic(e,t)}}var Iw=XW;function YW(t){return ec(t)?Nw(Ui(t)):Iw(t)}var Ow=YW;function JW(t){return typeof t=="function"?t:t==null?mn:typeof t=="object"?oe(t)?Aw(t[0],t[1]):Dw(t):Ow(t)}var Gt=JW;function QW(t,e,r,n){for(var i=-1,o=t==null?0:t.length;++i<o;){var s=t[i];e(n,s,r(s),t)}return n}var Lw=QW;function ZW(t){return function(e,r,n){for(var i=-1,o=Object(e),s=n(e),a=s.length;a--;){var c=s[t?a:++i];if(r(o[c],c,o)===!1)break}return e}}var Mw=ZW;var eH=Mw(),$w=eH;function tH(t,e){return t&&$w(t,e,dt)}var qw=tH;function rH(t,e){return function(r,n){if(r==null)return r;if(!ir(r))return t(r,n);for(var i=r.length,o=e?i:-1,s=Object(r);(e?o--:++o<i)&&n(s[o],o,s)!==!1;);return r}}var Fw=rH;var nH=Fw(qw),gn=nH;function iH(t,e,r,n){return gn(t,function(i,o,s){e(n,i,r(i),s)}),n}var jw=iH;function oH(t,e){return function(r,n){var i=oe(r)?Lw:jw,o=e?e():{};return i(r,t,Gt(n,2),o)}}var Uw=oH;var Ww=Object.prototype,sH=Ww.hasOwnProperty,aH=Ja(function(t,e){t=Object(t);var r=-1,n=e.length,i=n>2?e[2]:void 0;for(i&&zo(e[0],e[1],i)&&(n=1);++r<n;)for(var o=e[r],s=Xo(o),a=-1,c=s.length;++a<c;){var f=s[a],p=t[f];(p===void 0||$i(p,Ww[f])&&!sH.call(t,f))&&(t[f]=o[f])}return t}),hc=aH;function cH(t){return zt(t)&&ir(t)}var uv=cH;function uH(t,e,r){for(var n=-1,i=t==null?0:t.length;++n<i;)if(r(e,t[n]))return!0;return!1}var mp=uH;var lH=200;function fH(t,e,r,n){var i=-1,o=zd,s=!0,a=t.length,c=[],f=e.length;if(!a)return c;r&&(e=Li(e,ji(r))),n?(o=mp,s=!1):e.length>=lH&&(o=pc,s=!1,e=new dc(e));e:for(;++i<a;){var p=t[i],m=r==null?p:r(p);if(p=n||p!==0?p:0,s&&m===m){for(var T=f;T--;)if(e[T]===m)continue e;c.push(p)}else o(e,m,n)||c.push(p)}return c}var Hw=fH;var dH=Ja(function(t,e){return uv(t)?Hw(t,sc(e,1,uv,!0)):[]}),ns=dH;function pH(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}var Hi=pH;function mH(t,e,r){var n=t==null?0:t.length;return n?(e=r||e===void 0?1:Mi(e),Qd(t,e<0?0:e,n)):[]}var Xt=mH;function hH(t,e,r){var n=t==null?0:t.length;return n?(e=r||e===void 0?1:Mi(e),e=n-e,Qd(t,0,e<0?0:e)):[]}var bo=hH;function gH(t){return typeof t=="function"?t:mn}var Gw=gH;function yH(t,e){var r=oe(t)?Bd:gn;return r(t,Gw(e))}var Z=yH;function vH(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(!e(t[r],r,t))return!1;return!0}var Bw=vH;function TH(t,e){var r=!0;return gn(t,function(n,i,o){return r=!!e(n,i,o),r}),r}var Kw=TH;function RH(t,e,r){var n=oe(t)?Bw:Kw;return r&&zo(t,e,r)&&(e=void 0),n(t,Gt(e,3))}var Kr=RH;function bH(t,e){var r=[];return gn(t,function(n,i,o){e(n,i,o)&&r.push(n)}),r}var hp=bH;function xH(t,e){var r=oe(t)?cc:hp;return r(t,Gt(e,3))}var br=xH;function _H(t){return function(e,r,n){var i=Object(e);if(!ir(e)){var o=Gt(r,3);e=dt(e),r=function(a){return o(i[a],a,i)}}var s=t(e,r,n);return s>-1?i[o?e[s]:s]:void 0}}var zw=_H;var SH=Math.max;function kH(t,e,r){var n=t==null?0:t.length;if(!n)return-1;var i=r==null?0:Mi(r);return i<0&&(i=SH(n+i,0)),Kd(t,Gt(e,3),i)}var Vw=kH;var CH=zw(Vw),Gi=CH;function wH(t){return t&&t.length?t[0]:void 0}var xr=wH;function DH(t,e){var r=-1,n=ir(t)?Array(t.length):[];return gn(t,function(i,o,s){n[++r]=e(i,o,s)}),n}var Xw=DH;function EH(t,e){var r=oe(t)?Li:Xw;return r(t,Gt(e,3))}var z=EH;function PH(t,e){return sc(z(t,e),1)}var Ir=PH;var AH=Object.prototype,NH=AH.hasOwnProperty,IH=Uw(function(t,e,r){NH.call(t,r)?t[r].push(e):Ya(t,r,[e])}),lv=IH;var OH=Object.prototype,LH=OH.hasOwnProperty;function MH(t,e){return t!=null&&LH.call(t,e)}var Yw=MH;function $H(t,e){return t!=null&&pp(t,e,Yw)}var te=$H;var qH="[object String]";function FH(t){return typeof t=="string"||!oe(t)&&zt(t)&&en(t)==qH}var mr=FH;function jH(t,e){return Li(e,function(r){return t[r]})}var Jw=jH;function UH(t){return t==null?[]:Jw(t,dt(t))}var at=UH;var WH=Math.max;function HH(t,e,r,n){t=ir(t)?t:at(t),r=r&&!n?Mi(r):0;var i=t.length;return r<0&&(r=WH(i+r,0)),mr(t)?r<=i&&t.indexOf(e,r)>-1:!!i&&Xa(t,e,r)>-1}var Ct=HH;var GH=Math.max;function BH(t,e,r){var n=t==null?0:t.length;if(!n)return-1;var i=r==null?0:Mi(r);return i<0&&(i=GH(n+i,0)),Xa(t,e,i)}var gp=BH;var KH="[object Map]",zH="[object Set]",VH=Object.prototype,XH=VH.hasOwnProperty;function YH(t){if(t==null)return!0;if(ir(t)&&(oe(t)||typeof t=="string"||typeof t.splice=="function"||To(t)||Za(t)||Vo(t)))return!t.length;var e=pi(t);if(e==KH||e==zH)return!t.size;if(Fi(t))return!Yd(t).length;for(var r in t)if(XH.call(t,r))return!1;return!0}var De=YH;var JH="[object RegExp]";function QH(t){return zt(t)&&en(t)==JH}var Qw=QH;var Zw=Bn&&Bn.isRegExp,ZH=Zw?ji(Zw):Qw,Kn=ZH;function eG(t){return t===void 0}var zr=eG;function tG(t,e){return t<e}var eD=tG;function rG(t,e,r){for(var n=-1,i=t.length;++n<i;){var o=t[n],s=e(o);if(s!=null&&(a===void 0?s===s&&!Oi(s):r(s,a)))var a=s,c=o}return c}var tD=rG;function nG(t){return t&&t.length?tD(t,mn,eD):void 0}var rD=nG;var iG="Expected a function";function oG(t){if(typeof t!="function")throw new TypeError(iG);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}var nD=oG;function sG(t,e,r,n){if(!Mt(t))return t;e=es(e,t);for(var i=-1,o=e.length,s=o-1,a=t;a!=null&&++i<o;){var c=Ui(e[i]),f=r;if(c==="__proto__"||c==="constructor"||c==="prototype")return t;if(i!=s){var p=a[c];f=n?n(p,c,a):void 0,f===void 0&&(f=Mt(p)?p:Bo(e[i+1])?[]:{})}Ko(a,c,f),a=a[c]}return t}var iD=sG;function aG(t,e,r){for(var n=-1,i=e.length,o={};++n<i;){var s=e[n],a=ic(t,s);r(a,s)&&iD(o,es(s,t),a)}return o}var oD=aG;function cG(t,e){if(t==null)return{};var r=Li(rp(t),function(n){return[n]});return e=Gt(e),oD(t,r,function(n,i){return e(n,i[0])})}var yn=cG;function uG(t,e,r,n,i){return i(t,function(o,s,a){r=n?(n=!1,o):e(r,o,s,a)}),r}var sD=uG;function lG(t,e,r){var n=oe(t)?EC:sD,i=arguments.length<3;return n(t,Gt(e,4),r,i,gn)}var qt=lG;function fG(t,e){var r=oe(t)?cc:hp;return r(t,nD(Gt(e,3)))}var is=fG;function dG(t,e){var r;return gn(t,function(n,i,o){return r=e(n,i,o),!r}),!!r}var aD=dG;function pG(t,e,r){var n=oe(t)?ap:aD;return r&&zo(t,e,r)&&(e=void 0),n(t,Gt(e,3))}var zu=pG;var mG=1/0,hG=rs&&1/mc(new rs([,-0]))[1]==mG?function(t){return new rs(t)}:$t,cD=hG;var gG=200;function yG(t,e,r){var n=-1,i=zd,o=t.length,s=!0,a=[],c=a;if(r)s=!1,i=mp;else if(o>=gG){var f=e?null:cD(t);if(f)return mc(f);s=!1,i=pc,c=new dc}else c=e?[]:a;e:for(;++n<o;){var p=t[n],m=e?e(p):p;if(p=r||p!==0?p:0,s&&m===m){for(var T=c.length;T--;)if(c[T]===m)continue e;e&&c.push(m),a.push(p)}else i(c,m,r)||(c!==a&&c.push(m),a.push(p))}return a}var yp=yG;function vG(t){return t&&t.length?yp(t):[]}var gc=vG;function TG(t,e){return t&&t.length?yp(t,Gt(e,2)):[]}var uD=TG;function yc(t){console&&console.error&&console.error(`Error: ${t}`)}function Vu(t){console&&console.warn&&console.warn(`Warning: ${t}`)}function Xu(t){let e=new Date().getTime(),r=t();return{time:new Date().getTime()-e,value:r}}function Yu(t){function e(){}e.prototype=t;let r=new e;function n(){return typeof r.bar}return n(),n(),t;(0,eval)(t)}function RG(t){return bG(t)?t.LABEL:t.name}function bG(t){return mr(t.LABEL)&&t.LABEL!==""}var An=class{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),Z(this.definition,r=>{r.accept(e)})}},ze=class extends An{constructor(e){super([]),this.idx=1,Nr(this,yn(e,r=>r!==void 0))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}},rn=class extends An{constructor(e){super(e.definition),this.orgText="",Nr(this,yn(e,r=>r!==void 0))}},ht=class extends An{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,Nr(this,yn(e,r=>r!==void 0))}},Ve=class extends An{constructor(e){super(e.definition),this.idx=1,Nr(this,yn(e,r=>r!==void 0))}},gt=class extends An{constructor(e){super(e.definition),this.idx=1,Nr(this,yn(e,r=>r!==void 0))}},yt=class extends An{constructor(e){super(e.definition),this.idx=1,Nr(this,yn(e,r=>r!==void 0))}},Oe=class extends An{constructor(e){super(e.definition),this.idx=1,Nr(this,yn(e,r=>r!==void 0))}},ut=class extends An{constructor(e){super(e.definition),this.idx=1,Nr(this,yn(e,r=>r!==void 0))}},lt=class extends An{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,Nr(this,yn(e,r=>r!==void 0))}},Ee=class{constructor(e){this.idx=1,Nr(this,yn(e,r=>r!==void 0))}accept(e){e.visit(this)}};function vp(t){return z(t,vc)}function vc(t){function e(r){return z(r,vc)}if(t instanceof ze){let r={type:"NonTerminal",name:t.nonTerminalName,idx:t.idx};return mr(t.label)&&(r.label=t.label),r}else{if(t instanceof ht)return{type:"Alternative",definition:e(t.definition)};if(t instanceof Ve)return{type:"Option",idx:t.idx,definition:e(t.definition)};if(t instanceof gt)return{type:"RepetitionMandatory",idx:t.idx,definition:e(t.definition)};if(t instanceof yt)return{type:"RepetitionMandatoryWithSeparator",idx:t.idx,separator:vc(new Ee({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof ut)return{type:"RepetitionWithSeparator",idx:t.idx,separator:vc(new Ee({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof Oe)return{type:"Repetition",idx:t.idx,definition:e(t.definition)};if(t instanceof lt)return{type:"Alternation",idx:t.idx,definition:e(t.definition)};if(t instanceof Ee){let r={type:"Terminal",name:t.terminalType.name,label:RG(t.terminalType),idx:t.idx};mr(t.label)&&(r.terminalLabel=t.label);let n=t.terminalType.PATTERN;return t.terminalType.PATTERN&&(r.pattern=Kn(n)?n.source:n),r}else{if(t instanceof rn)return{type:"Rule",name:t.name,orgText:t.orgText,definition:e(t.definition)};throw Error("non exhaustive match")}}}var nn=class{visit(e){let r=e;switch(r.constructor){case ze:return this.visitNonTerminal(r);case ht:return this.visitAlternative(r);case Ve:return this.visitOption(r);case gt:return this.visitRepetitionMandatory(r);case yt:return this.visitRepetitionMandatoryWithSeparator(r);case ut:return this.visitRepetitionWithSeparator(r);case Oe:return this.visitRepetition(r);case lt:return this.visitAlternation(r);case Ee:return this.visitTerminal(r);case rn:return this.visitRule(r);default:throw Error("non exhaustive match")}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}};function fv(t){return t instanceof ht||t instanceof Ve||t instanceof Oe||t instanceof gt||t instanceof yt||t instanceof ut||t instanceof Ee||t instanceof rn}function Us(t,e=[]){return t instanceof Ve||t instanceof Oe||t instanceof ut?!0:t instanceof lt?zu(t.definition,n=>Us(n,e)):t instanceof ze&&Ct(e,t)?!1:t instanceof An?(t instanceof ze&&e.push(t),Kr(t.definition,n=>Us(n,e))):!1}function dv(t){return t instanceof lt}function vn(t){if(t instanceof ze)return"SUBRULE";if(t instanceof Ve)return"OPTION";if(t instanceof lt)return"OR";if(t instanceof gt)return"AT_LEAST_ONE";if(t instanceof yt)return"AT_LEAST_ONE_SEP";if(t instanceof ut)return"MANY_SEP";if(t instanceof Oe)return"MANY";if(t instanceof Ee)return"CONSUME";throw Error("non exhaustive match")}var xo=class{walk(e,r=[]){Z(e.definition,(n,i)=>{let o=Xt(e.definition,i+1);if(n instanceof ze)this.walkProdRef(n,o,r);else if(n instanceof Ee)this.walkTerminal(n,o,r);else if(n instanceof ht)this.walkFlat(n,o,r);else if(n instanceof Ve)this.walkOption(n,o,r);else if(n instanceof gt)this.walkAtLeastOne(n,o,r);else if(n instanceof yt)this.walkAtLeastOneSep(n,o,r);else if(n instanceof ut)this.walkManySep(n,o,r);else if(n instanceof Oe)this.walkMany(n,o,r);else if(n instanceof lt)this.walkOr(n,o,r);else throw Error("non exhaustive match")})}walkTerminal(e,r,n){}walkProdRef(e,r,n){}walkFlat(e,r,n){let i=r.concat(n);this.walk(e,i)}walkOption(e,r,n){let i=r.concat(n);this.walk(e,i)}walkAtLeastOne(e,r,n){let i=[new Ve({definition:e.definition})].concat(r,n);this.walk(e,i)}walkAtLeastOneSep(e,r,n){let i=lD(e,r,n);this.walk(e,i)}walkMany(e,r,n){let i=[new Ve({definition:e.definition})].concat(r,n);this.walk(e,i)}walkManySep(e,r,n){let i=lD(e,r,n);this.walk(e,i)}walkOr(e,r,n){let i=r.concat(n);Z(e.definition,o=>{let s=new ht({definition:[o]});this.walk(s,i)})}};function lD(t,e,r){return[new Ve({definition:[new Ee({terminalType:t.separator})].concat(t.definition)})].concat(e,r)}function Ws(t){if(t instanceof ze)return Ws(t.referencedRule);if(t instanceof Ee)return SG(t);if(fv(t))return xG(t);if(dv(t))return _G(t);throw Error("non exhaustive match")}function xG(t){let e=[],r=t.definition,n=0,i=r.length>n,o,s=!0;for(;i&&s;)o=r[n],s=Us(o),e=e.concat(Ws(o)),n=n+1,i=r.length>n;return gc(e)}function _G(t){let e=z(t.definition,r=>Ws(r));return gc(Vt(e))}function SG(t){return[t.terminalType]}var Tp="_~IN~_";var pv=class extends xo{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,r,n){}walkProdRef(e,r,n){let i=kG(e.referencedRule,e.idx)+this.topProd.name,o=r.concat(n),s=new ht({definition:o}),a=Ws(s);this.follows[i]=a}};function fD(t){let e={};return Z(t,r=>{let n=new pv(r).startWalking();Nr(e,n)}),e}function kG(t,e){return t.name+e+Tp}var Rp={},CG=new Is;function Tc(t){let e=t.toString();if(Rp.hasOwnProperty(e))return Rp[e];{let r=CG.pattern(e);return Rp[e]=r,r}}function dD(){Rp={}}var mD="Complement Sets are not supported for first char optimization",Ju=`Unable to use "first char" lexer optimizations:
87
87
  `;function hD(t,e=!1){try{let r=Tc(t);return mv(r.value,{},r.flags.ignoreCase)}catch(r){if(r.message===mD)e&&Vu(`${Ju} Unable to optimize: < ${t.toString()} >
88
88
  Complement Sets cannot be automatically optimized.
89
89
  This will disable the lexer's first char optimizations.
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "monaco-languageclient-examples",
3
- "version": "6.4.5",
3
+ "version": "6.4.6",
4
4
  "description": "Monaco Language client examples",
5
5
  "author": {
6
6
  "name": "TypeFox GmbH",
7
7
  "url": "http://www.typefox.io"
8
8
  },
9
- "homepage": "https://github.com/TypeFox/monaco-languageclient/blob/main/packages/examples/main/README.md",
9
+ "homepage": "https://github.com/TypeFox/monaco-languageclient/blob/main/packages/examples/README.md",
10
10
  "license": "MIT",
11
11
  "repository": {
12
12
  "type": "git",
13
13
  "url": "https://github.com/TypeFox/monaco-languageclient",
14
- "directory": "packages/examples/main"
14
+ "directory": "packages/examples"
15
15
  },
16
16
  "bugs": {
17
17
  "url": "https://github.com/TypeFox/monaco-languageclient/issues"
@@ -27,10 +27,6 @@
27
27
  "./node": {
28
28
  "types": "./dist/node.d.ts",
29
29
  "default": "./dist/node.js"
30
- },
31
- "./langiumWorker": {
32
- "types": "./dist/langium/langiumServerWorker.d.ts",
33
- "default": "./dist/worker/langiumServerWorker.js"
34
30
  }
35
31
  },
36
32
  "typesVersions": {
@@ -51,7 +47,7 @@
51
47
  "langium": "~2.0.1",
52
48
  "langium-statemachine-dsl": "~2.0.0",
53
49
  "monaco-editor-workers": "~0.41.0",
54
- "monaco-languageclient": "~6.4.5",
50
+ "monaco-languageclient": "~6.4.6",
55
51
  "pyright": "~1.1.322",
56
52
  "react": "~18.2.0",
57
53
  "react-dom": "~18.2.0",
@@ -87,9 +83,8 @@
87
83
  "compile": "tsc --build tsconfig.src.json",
88
84
  "build:msg": "echo Building main examples:",
89
85
  "build:worker:vite": "vite --config vite.statemachine-worker.ts build",
90
- "build:worker:statemachine": "esbuild ../../../node_modules/langium-statemachine-dsl/out/language-server/main-browser.js --bundle --tree-shaking=true --minify --format=iife --outfile=./dist/worker/statemachineServerWorker.js",
91
- "build:worker:langium": "esbuild ./src/langium/langiumServerWorker.js --bundle --tree-shaking=true --minify --format=iife --outfile=./dist/worker/langiumServerWorker.js",
92
- "build": "npm run build:msg && npm run clean && npm run compile && npm run build:worker:statemachine && npm run build:worker:langium",
86
+ "build:worker:statemachine": "esbuild ../../node_modules/langium-statemachine-dsl/out/language-server/main-browser.js --bundle --tree-shaking=true --minify --format=iife --outfile=./dist/worker/statemachineServerWorker.js",
87
+ "build": "npm run build:msg && npm run clean && npm run compile && npm run build:worker:statemachine",
93
88
  "start:server:json": "node --loader ts-node/esm src/json/server/direct.ts",
94
89
  "start:server:python": "node --loader ts-node/esm src/python/server/direct.ts"
95
90
  }
@@ -10,7 +10,7 @@ import { createDefaultJsonContent, createJsonEditor, performInit } from '../comm
10
10
  import 'vscode/default-extensions/theme-defaults';
11
11
  import 'vscode/default-extensions/json';
12
12
  import { buildWorkerDefinition } from 'monaco-editor-workers';
13
- buildWorkerDefinition('../../../node_modules/monaco-editor-workers/dist/workers/', new URL('', window.location.href).href, false);
13
+ buildWorkerDefinition('../../node_modules/monaco-editor-workers/dist/workers/', new URL('', window.location.href).href, false);
14
14
 
15
15
  const codeConverter = createCodeConverter();
16
16
  const protocolConverter = createProtocolConverter(undefined, true, true);
package/src/common.ts CHANGED
@@ -67,7 +67,7 @@ export const createDefaultJsonContent = (): string => {
67
67
  return `{
68
68
  "$schema": "http://json.schemastore.org/coffeelint",
69
69
  "line_endings": "unix"
70
- } `;
70
+ }`;
71
71
  };
72
72
 
73
73
  export type ExampleJsonEditor = {
@@ -85,11 +85,13 @@ export const performInit = async (vscodeApiInit: boolean) => {
85
85
  enableModelService: true,
86
86
  configureEditorOrViewsService: {
87
87
  },
88
+ configureConfigurationService: {
89
+ defaultWorkspaceUri: '/workspace'
90
+ },
88
91
  enableKeybindingsService: true,
89
92
  enableLanguagesService: true,
90
- enableOutputService: true,
91
93
  enableAccessibilityService: true,
92
- debugLogging: false
94
+ debugLogging: true
93
95
  });
94
96
 
95
97
  // register the JSON language with Monaco
package/src/index.ts CHANGED
@@ -6,7 +6,6 @@
6
6
  export * from './common.js';
7
7
  export * from './browser/main.js';
8
8
  export * from './json/client/main.js';
9
- export * from './langium/langiumClient.js';
10
9
  export * from './langium/statemachineClient.js';
11
10
  export * from './python/client/main.js';
12
11
  export * from './react/app.js';
@@ -5,7 +5,7 @@
5
5
 
6
6
  import { createDefaultJsonContent, createJsonEditor, createUrl, createWebSocketAndStartClient, performInit } from '../../common.js';
7
7
  import { buildWorkerDefinition } from 'monaco-editor-workers';
8
- buildWorkerDefinition('../../../node_modules/monaco-editor-workers/dist/workers/', new URL('', window.location.href).href, false);
8
+ buildWorkerDefinition('../../node_modules/monaco-editor-workers/dist/workers/', new URL('', window.location.href).href, false);
9
9
 
10
10
  export const startJsonClient = async () => {
11
11
  // use the same common method to create a monaco editor for json
@@ -16,7 +16,7 @@ import { LogLevel } from 'vscode/services';
16
16
  import 'vscode/default-extensions/theme-defaults';
17
17
 
18
18
  import { buildWorkerDefinition } from 'monaco-editor-workers';
19
- buildWorkerDefinition('../../../node_modules/monaco-editor-workers/dist/workers/', new URL('', window.location.href).href, false);
19
+ buildWorkerDefinition('../../node_modules/monaco-editor-workers/dist/workers/', new URL('', window.location.href).href, false);
20
20
 
21
21
  const languageId = 'statemachine';
22
22
 
@@ -91,8 +91,8 @@ export const setupStatemachineClient = async () => {
91
91
  };
92
92
  const { registerFileUrl } = registerExtension(extension, ExtensionHostKind.LocalProcess);
93
93
 
94
- registerFileUrl('/statemachine-configuration.json', new URL('../../../node_modules/langium-statemachine-dsl/language-configuration.json', window.location.href).href);
95
- registerFileUrl('/statemachine-grammar.json', new URL('../../../node_modules/langium-statemachine-dsl/syntaxes/statemachine.tmLanguage.json', window.location.href).href);
94
+ registerFileUrl('/statemachine-configuration.json', new URL('../../node_modules/langium-statemachine-dsl/language-configuration.json', window.location.href).href);
95
+ registerFileUrl('/statemachine-grammar.json', new URL('../../node_modules/langium-statemachine-dsl/syntaxes/statemachine.tmLanguage.json', window.location.href).href);
96
96
 
97
97
  updateUserConfiguration(`{
98
98
  "editor.fontSize": 14,