Files
static-php-cli/assets/chunks/chunk-KEIR6QF5.Dj-OpFgW.js

161 lines
647 KiB
JavaScript
Raw Normal View History

var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,n)=>t(e,`name`,{value:n,configurable:!0}),s=(e,t)=>function(){return e&&(t=(0,e[r(e)[0]])(e=0)),t},c=(e,t)=>function(){return t||(0,e[r(e)[0]])((t={exports:{}}).exports,t),t.exports},l=(e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})},u=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(let c of r(i))!a.call(e,c)&&c!==o&&t(e,c,{get:()=>i[c],enumerable:!(s=n(i,c))||s.enumerable});return e},d=(e,t,n)=>(u(e,t,`default`),n&&u(n,t,`default`)),f=(n,r,a)=>(a=n==null?{}:e(i(n)),u(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n)),p=e=>u(t({},`__esModule`,{value:!0}),e),m={};l(m,{AnnotatedTextEdit:()=>T,ChangeAnnotation:()=>de,ChangeAnnotationIdentifier:()=>w,CodeAction:()=>We,CodeActionContext:()=>Ue,CodeActionKind:()=>Ve,CodeActionTriggerKind:()=>He,CodeDescription:()=>se,CodeLens:()=>Ge,Color:()=>S,ColorInformation:()=>te,ColorPresentation:()=>ne,Command:()=>le,CompletionItem:()=>Oe,CompletionItemKind:()=>Se,CompletionItemLabelDetails:()=>De,CompletionItemTag:()=>we,CompletionList:()=>ke,CreateFile:()=>D,DeleteFile:()=>fe,Diagnostic:()=>ce,DiagnosticRelatedInformation:()=>ie,DiagnosticSeverity:()=>ae,DiagnosticTag:()=>oe,DocumentHighlight:()=>Fe,DocumentHighlightKind:()=>Pe,DocumentLink:()=>qe,DocumentSymbol:()=>Be,DocumentUri:()=>h,EOL:()=>ft,FoldingRange:()=>re,FoldingRangeKind:()=>C,FormattingOptions:()=>Ke,Hover:()=>je,InlayHint:()=>it,InlayHintKind:()=>nt,InlayHintLabelPart:()=>rt,InlineCompletionContext:()=>ut,InlineCompletionItem:()=>ot,InlineCompletionList:()=>st,InlineCompletionTriggerKind:()=>ct,InlineValueContext:()=>tt,InlineValueEvaluatableExpression:()=>et,InlineValueText:()=>Qe,InlineValueVariableLookup:()=>$e,InsertReplaceEdit:()=>Te,InsertTextFormat:()=>Ce,InsertTextMode:()=>Ee,Location:()=>x,LocationLink:()=>ee,MarkedString:()=>Ae,MarkupContent:()=>xe,MarkupKind:()=>be,OptionalVersionedTextDocumentIdentifier:()=>ve,ParameterInformation:()=>Me,Position:()=>y,Range:()=>b,RenameFile:()=>O,SelectedCompletionInfo:()=>lt,SelectionRange:()=>Je,SemanticTokenModifiers:()=>Xe,SemanticTokenTypes:()=>Ye,SemanticTokens:()=>Ze,SignatureInformation:()=>Ne,StringValue:()=>at,SymbolInformation:()=>Re,SymbolKind:()=>Ie,SymbolTag:()=>Le,TextDocument:()=>pt,TextDocumentEdit:()=>E,TextDocumentIdentifier:()=>ge,TextDocumentItem:()=>ye,TextEdit:()=>ue,URI:()=>g,VersionedTextDocumentIdentifier:()=>_e,WorkspaceChange:()=>he,WorkspaceEdit:()=>k,WorkspaceFolder:()=>dt,WorkspaceSymbol:()=>ze,integer:()=>_,uinteger:()=>v});var h,g,_,v,y,b,x,ee,S,te,ne,C,re,ie,ae,oe,se,ce,le,ue,de,w,T,E,D,O,fe,k,pe,me,he,ge,_e,ve,ye,be,xe,Se,Ce,we,Te,Ee,De,Oe,ke,Ae,je,Me,Ne,Pe,Fe,Ie,Le,Re,ze,Be,Ve,He,Ue,We,Ge,Ke,qe,Je,Ye,Xe,Ze,Qe,$e,et,tt,nt,rt,it,at,ot,st,ct,lt,ut,dt,ft,pt,mt,A,ht=s({"../../node_modules/.pnpm/vscode-languageserver-types@3.17.5/node_modules/vscode-languageserver-types/lib/esm/main.js"(){(function(e){function t(e){return typeof e==`string`}o(t,`is`),e.is=t})(h||={}),(function(e){function t(e){return typeof e==`string`}o(t,`is`),e.is=t})(g||={}),(function(e){e.MIN_VALUE=-2147483648,e.MAX_VALUE=2147483647;function t(t){return typeof t==`number`&&e.MIN_VALUE<=t&&t<=e.MAX_VALUE}o(t,`is`),e.is=t})(_||={}),(function(e){e.MIN_VALUE=0,e.MAX_VALUE=2147483647;function t(t){return typeof t==`number`&&e.MIN_VALUE<=t&&t<=e.MAX_VALUE}o(t,`is`),e.is=t})(v||={}),(function(e){function t(e,t){return e===Number.MAX_VALUE&&(e=v.MAX_VALUE),t===Number.MAX_VALUE&&(t=v.MAX_VALUE),{line:e,character:t}}o(t,`create`),e.create=t;function n(e){let t=e;return A.objectLiteral(t)&&A.uinteger(t.line)&&A.uinteger(t.character)}o(n,`is`),e.is=n})(y||={}),(function(e){function t(e,t,n,r){if(A.uinteger(e)&&A.uinteger(t)&&A.uinteger(n)&&A.uinteger(r))return{start:y.create(e,t),end:y.create(n,r)};if(y.is(e)&&y.is(t))return{start:e,end:t};throw Error(`Range#create called with invalid arguments[${e}, ${t}, ${n}, ${r}]`)}o(t,`create`),e.create=t;function n(e){let t=e;return A.objec
`,`\r
`,`\r`],(function(e){function t(e,t,n,r){return new mt(e,t,n,r)}o(t,`create`),e.create=t;function n(e){let t=e;return!!(A.defined(t)&&A.string(t.uri)&&(A.undefined(t.languageId)||A.string(t.languageId))&&A.uinteger(t.lineCount)&&A.func(t.getText)&&A.func(t.positionAt)&&A.func(t.offsetAt))}o(n,`is`),e.is=n;function r(e,t){let n=e.getText(),r=i(t,(e,t)=>{let n=e.range.start.line-t.range.start.line;return n===0?e.range.start.character-t.range.start.character:n}),a=n.length;for(let t=r.length-1;t>=0;t--){let i=r[t],o=e.offsetAt(i.range.start),s=e.offsetAt(i.range.end);if(s<=a)n=n.substring(0,o)+i.newText+n.substring(s,n.length);else throw Error(`Overlapping edit`);a=o}return n}o(r,`applyEdits`),e.applyEdits=r;function i(e,t){if(e.length<=1)return e;let n=e.length/2|0,r=e.slice(0,n),a=e.slice(n);i(r,t),i(a,t);let o=0,s=0,c=0;for(;o<r.length&&s<a.length;)t(r[o],a[s])<=0?e[c++]=r[o++]:e[c++]=a[s++];for(;o<r.length;)e[c++]=r[o++];for(;s<a.length;)e[c++]=a[s++];return e}o(i,`mergeSort`)})(pt||={}),mt=class{static{o(this,`FullTextDocument`)}constructor(e,t,n,r){this._uri=e,this._languageId=t,this._version=n,this._content=r,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let t=this.offsetAt(e.start),n=this.offsetAt(e.end);return this._content.substring(t,n)}return this._content}update(e,t){this._content=e.text,this._version=t,this._lineOffsets=void 0}getLineOffsets(){if(this._lineOffsets===void 0){let e=[],t=this._content,n=!0;for(let r=0;r<t.length;r++){n&&=(e.push(r),!1);let i=t.charAt(r);n=i===`\r`||i===`
`,i===`\r`&&r+1<t.length&&t.charAt(r+1)===`
`&&r++}n&&t.length>0&&e.push(t.length),this._lineOffsets=e}return this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let t=this.getLineOffsets(),n=0,r=t.length;if(r===0)return y.create(0,e);for(;n<r;){let i=Math.floor((n+r)/2);t[i]>e?r=i:n=i+1}let i=n-1;return y.create(i,e-t[i])}offsetAt(e){let t=this.getLineOffsets();if(e.line>=t.length)return this._content.length;if(e.line<0)return 0;let n=t[e.line],r=e.line+1<t.length?t[e.line+1]:this._content.length;return Math.max(Math.min(n+e.character,r),n)}get lineCount(){return this.getLineOffsets().length}},(function(e){let t=Object.prototype.toString;function n(e){return e!==void 0}o(n,`defined`),e.defined=n;function r(e){return e===void 0}o(r,`undefined`),e.undefined=r;function i(e){return e===!0||e===!1}o(i,`boolean`),e.boolean=i;function a(e){return t.call(e)===`[object String]`}o(a,`string`),e.string=a;function s(e){return t.call(e)===`[object Number]`}o(s,`number`),e.number=s;function c(e,n,r){return t.call(e)===`[object Number]`&&n<=e&&e<=r}o(c,`numberRange`),e.numberRange=c;function l(e){return t.call(e)===`[object Number]`&&-2147483648<=e&&e<=2147483647}o(l,`integer`),e.integer=l;function u(e){return t.call(e)===`[object Number]`&&0<=e&&e<=2147483647}o(u,`uinteger`),e.uinteger=u;function d(e){return t.call(e)===`[object Function]`}o(d,`func`),e.func=d;function f(e){return typeof e==`object`&&!!e}o(f,`objectLiteral`),e.objectLiteral=f;function p(e,t){return Array.isArray(e)&&e.every(t)}o(p,`typedArray`),e.typedArray=p})(A||={})}}),gt=c({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/ral.js"(e){Object.defineProperty(e,"__esModule",{value:!0});var t;function n(){if(t===void 0)throw Error(`No runtime abstraction layer installed`);return t}o(n,`RAL`),(function(e){function n(e){if(e===void 0)throw Error(`No runtime abstraction layer provided`);t=e}o(n,`install`),e.install=n})(n||={}),e.default=n}}),_t=c({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/is.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.stringArray=e.array=e.func=e.error=e.number=e.string=e.boolean=void 0;function t(e){return e===!0||e===!1}o(t,`boolean`),e.boolean=t;function n(e){return typeof e==`string`||e instanceof String}o(n,`string`),e.string=n;function r(e){return typeof e==`number`||e instanceof Number}o(r,`number`),e.number=r;function i(e){return e instanceof Error}o(i,`error`),e.error=i;function a(e){return typeof e==`function`}o(a,`func`),e.func=a;function s(e){return Array.isArray(e)}o(s,`array`),e.array=s;function c(e){return s(e)&&e.every(e=>n(e))}o(c,`stringArray`),e.stringArray=c}}),vt=c({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/events.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Emitter=e.Event=void 0;var t=gt(),n;(function(e){let t={dispose(){}};e.None=function(){return t}})(n||(e.Event=n={}));var r=class{static{o(this,`CallbackList`)}add(e,t=null,n){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(e),this._contexts.push(t),Array.isArray(n)&&n.push({dispose:o(()=>this.remove(e,t),`dispose`)})}remove(e,t=null){if(!this._callbacks)return;let n=!1;for(let r=0,i=this._callbacks.length;r<i;r++)if(this._callbacks[r]===e)if(this._contexts[r]===t){this._callbacks.splice(r,1),this._contexts.splice(r,1);return}else n=!0;if(n)throw Error(`When adding a listener with a context, you should remove it with the same context`)}invoke(...e){if(!this._callbacks)return[];let n=[],r=this._callbacks.slice(0),i=this._contexts.slice(0);for(let a=0,o=r.length;a<o;a++)try{n.push(r[a].apply(i[a],e))}catch(e){(0,t.default)().console.error(e)}return n}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}},i=class e{static{o(this,`Emitter`)}constructor(e){this._options=e}get event(){return this._event||=(t,n,i)=>{this._callbacks||=new r,this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callb
${JSON.stringify(Object.fromEntries(e))}`));return}let n=parseInt(t);if(isNaN(n)){this.fireError(Error(`Content-Length value must be a number. Got ${t}`));return}this.nextMessageLength=n}let e=this.buffer.tryReadBody(this.nextMessageLength);if(e===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock(async()=>{let t=this.options.contentDecoder===void 0?e:await this.options.contentDecoder.decode(e),n=await this.options.contentTypeDecoder.decode(t,this.options);this.callback(n)}).catch(e=>{this.fireError(e)})}}catch(e){this.fireError(e)}}clearPartialMessageTimer(){this.partialMessageTimer&&=(this.partialMessageTimer.dispose(),void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=(0,t.default)().timer.setTimeout((e,t)=>{this.partialMessageTimer=void 0,e===this.messageToken&&(this.firePartialMessage({messageToken:e,waitingTime:t}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}}}}),Et=c({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/messageWriter.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.WriteableStreamMessageWriter=e.AbstractMessageWriter=e.MessageWriter=void 0;var t=gt(),n=_t(),r=wt(),i=vt(),a=`Content-Length: `,s=`\r
`,c;(function(e){function t(e){let t=e;return t&&n.func(t.dispose)&&n.func(t.onClose)&&n.func(t.onError)&&n.func(t.write)}o(t,`is`),e.is=t})(c||(e.MessageWriter=c={}));var l=class{static{o(this,`AbstractMessageWriter`)}constructor(){this.errorEmitter=new i.Emitter,this.closeEmitter=new i.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e,t,n){this.errorEmitter.fire([this.asError(e),t,n])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(e){return e instanceof Error?e:Error(`Writer received error. Reason: ${n.string(e.message)?e.message:`unknown`}`)}};e.AbstractMessageWriter=l;var u;(function(e){function n(e){return e===void 0||typeof e==`string`?{charset:e??`utf-8`,contentTypeEncoder:(0,t.default)().applicationJson.encoder}:{charset:e.charset??`utf-8`,contentEncoder:e.contentEncoder,contentTypeEncoder:e.contentTypeEncoder??(0,t.default)().applicationJson.encoder}}o(n,`fromOptions`),e.fromOptions=n})(u||={}),e.WriteableStreamMessageWriter=class extends l{static{o(this,`WriteableStreamMessageWriter`)}constructor(e,t){super(),this.writable=e,this.options=u.fromOptions(t),this.errorCount=0,this.writeSemaphore=new r.Semaphore(1),this.writable.onError(e=>this.fireError(e)),this.writable.onClose(()=>this.fireClose())}async write(e){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(e,this.options).then(e=>this.options.contentEncoder===void 0?e:this.options.contentEncoder.encode(e)).then(t=>{let n=[];return n.push(a,t.byteLength.toString(),s),n.push(s),this.doWrite(e,n,t)},e=>{throw this.fireError(e),e}))}async doWrite(e,t,n){try{return await this.writable.write(t.join(``),`ascii`),this.writable.write(n)}catch(t){return this.handleError(t,e),Promise.reject(t)}}handleError(e,t){this.errorCount++,this.fireError(e,t,this.errorCount)}end(){this.writable.end()}}}}),Dt=c({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/messageBuffer.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractMessageBuffer=void 0;var t=13,n=10,r=`\r
`;e.AbstractMessageBuffer=class{static{o(this,`AbstractMessageBuffer`)}constructor(e=`utf-8`){this._encoding=e,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(e){let t=typeof e==`string`?this.fromString(e,this._encoding):e;this._chunks.push(t),this._totalLength+=t.byteLength}tryReadHeaders(e=!1){if(this._chunks.length===0)return;let i=0,a=0,o=0,s=0;row:for(;a<this._chunks.length;){let e=this._chunks[a];o=0;column:for(;o<e.length;){switch(e[o]){case t:switch(i){case 0:i=1;break;case 2:i=3;break;default:i=0}break;case n:switch(i){case 1:i=2;break;case 3:i=4,o++;break row;default:i=0}break;default:i=0}o++}s+=e.byteLength,a++}if(i!==4)return;let c=this._read(s+o),l=new Map,u=this.toString(c,`ascii`).split(r);if(u.length<2)return l;for(let t=0;t<u.length-2;t++){let n=u[t],r=n.indexOf(`:`);if(r===-1)throw Error(`Message header must separate key and value using ':'
${n}`);let i=n.substr(0,r),a=n.substr(r+1).trim();l.set(e?i.toLowerCase():i,a)}return l}tryReadBody(e){if(!(this._totalLength<e))return this._read(e)}get numberOfBytes(){return this._totalLength}_read(e){if(e===0)return this.emptyBuffer();if(e>this._totalLength)throw Error(`Cannot read so many bytes!`);if(this._chunks[0].byteLength===e){let t=this._chunks[0];return this._chunks.shift(),this._totalLength-=e,this.asNative(t)}if(this._chunks[0].byteLength>e){let t=this._chunks[0],n=this.asNative(t,e);return this._chunks[0]=t.slice(e),this._totalLength-=e,n}let t=this.allocNative(e),n=0;for(;e>0;){let r=this._chunks[0];if(r.byteLength>e){let i=r.slice(0,e);t.set(i,n),n+=e,this._chunks[0]=r.slice(e),this._totalLength-=e,e-=e}else t.set(r,n),n+=r.byteLength,this._chunks.shift(),this._totalLength-=r.byteLength,e-=r.byteLength}return t}}}}),Ot=c({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/connection.js"(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createMessageConnection=e.ConnectionOptions=e.MessageStrategy=e.CancellationStrategy=e.CancellationSenderStrategy=e.CancellationReceiverStrategy=e.RequestCancellationReceiverStrategy=e.IdCancellationReceiverStrategy=e.ConnectionStrategy=e.ConnectionError=e.ConnectionErrors=e.LogTraceNotification=e.SetTraceNotification=e.TraceFormat=e.TraceValues=e.Trace=e.NullLogger=e.ProgressType=e.ProgressToken=void 0;var t=gt(),n=_t(),r=bt(),i=xt(),a=vt(),s=yt(),c;(function(e){e.type=new r.NotificationType(`$/cancelRequest`)})(c||={});var l;(function(e){function t(e){return typeof e==`string`||typeof e==`number`}o(t,`is`),e.is=t})(l||(e.ProgressToken=l={}));var u;(function(e){e.type=new r.NotificationType(`$/progress`)})(u||={}),e.ProgressType=class{static{o(this,`ProgressType`)}constructor(){}};var d;(function(e){function t(e){return n.func(e)}o(t,`is`),e.is=t})(d||={}),e.NullLogger=Object.freeze({error:o(()=>{},`error`),warn:o(()=>{},`warn`),info:o(()=>{},`info`),log:o(()=>{},`log`)});var f;(function(e){e[e.Off=0]=`Off`,e[e.Messages=1]=`Messages`,e[e.Compact=2]=`Compact`,e[e.Verbose=3]=`Verbose`})(f||(e.Trace=f={}));var p;(function(e){e.Off=`off`,e.Messages=`messages`,e.Compact=`compact`,e.Verbose=`verbose`})(p||(e.TraceValues=p={})),(function(e){function t(t){if(!n.string(t))return e.Off;switch(t=t.toLowerCase(),t){case`off`:return e.Off;case`messages`:return e.Messages;case`compact`:return e.Compact;case`verbose`:return e.Verbose;default:return e.Off}}o(t,`fromString`),e.fromString=t;function r(t){switch(t){case e.Off:return`off`;case e.Messages:return`messages`;case e.Compact:return`compact`;case e.Verbose:return`verbose`;default:return`off`}}o(r,`toString`),e.toString=r})(f||(e.Trace=f={}));var m;(function(e){e.Text=`text`,e.JSON=`json`})(m||(e.TraceFormat=m={})),(function(e){function t(t){return n.string(t)?(t=t.toLowerCase(),t===`json`?e.JSON:e.Text):e.Text}o(t,`fromString`),e.fromString=t})(m||(e.TraceFormat=m={}));var h;(function(e){e.type=new r.NotificationType(`$/setTrace`)})(h||(e.SetTraceNotification=h={}));var g;(function(e){e.type=new r.NotificationType(`$/logTrace`)})(g||(e.LogTraceNotification=g={}));var _;(function(e){e[e.Closed=1]=`Closed`,e[e.Disposed=2]=`Disposed`,e[e.AlreadyListening=3]=`AlreadyListening`})(_||(e.ConnectionErrors=_={}));var v=class e extends Error{static{o(this,`ConnectionError`)}constructor(t,n){super(n),this.code=t,Object.setPrototypeOf(this,e.prototype)}};e.ConnectionError=v;var y;(function(e){function t(e){let t=e;return t&&n.func(t.cancelUndispatched)}o(t,`is`),e.is=t})(y||(e.ConnectionStrategy=y={}));var b;(function(e){function t(e){let t=e;return t&&(t.kind===void 0||t.kind===`id`)&&n.func(t.createCancellationTokenSource)&&(t.dispose===void 0||n.func(t.dispose))}o(t,`is`),e.is=t})(b||(e.IdCancellationReceiverStrategy=b={}));var x;(function(e){function t(e){let t=e;return t&&t.kind===`request`&&n.func(t.createCancellationTokenSource)&&(t.dispose===void 0||n.func(t.dispose))}o(t,`is`),e.is=t})(x||(e.RequestCancellationReceiverStrategy=x={}));var ee;(function(e){e.Message=Object.freeze({createCancellatio
${JSON.stringify(e.error,void 0,4)}`):S.error(`Received response message without id. No further error information provided.`);else{let t=e.id,n=T.get(t);if(Ge(e,n),n!==void 0){T.delete(t);try{if(e.error){let t=e.error;n.reject(new r.ResponseError(t.code,t.message,t.data))}else if(e.result!==void 0)n.resolve(e.result);else throw Error(`Should never happen.`)}catch(e){e.message?S.error(`Response handler '${n.method}' failed with message: ${e.message}`):S.error(`Response handler '${n.method}' failed unexpectedly.`)}}}}o(Ie,`handleResponse`);function Le(e){if(De())return;let t,n;if(e.method===c.type.method){let t=e.params.id;E.delete(t),We(e);return}else{let r=le.get(e.method);r&&(n=r.handler,t=r.type)}if(n||ce)try{if(We(e),n)if(e.params===void 0)t!==void 0&&t.numberOfParams!==0&&t.parameterStructures!==r.ParameterStructures.byName&&S.error(`Notification ${e.method} defines ${t.numberOfParams} params but received none.`),n();else if(Array.isArray(e.params)){let i=e.params;e.method===u.type.method&&i.length===2&&l.is(i[0])?n({token:i[0],value:i[1]}):(t!==void 0&&(t.parameterStructures===r.ParameterStructures.byName&&S.error(`Notification ${e.method} defines parameters by name but received parameters by position`),t.numberOfParams!==e.params.length&&S.error(`Notification ${e.method} defines ${t.numberOfParams} params but received ${i.length} arguments`)),n(...i))}else t!==void 0&&t.parameterStructures===r.ParameterStructures.byPosition&&S.error(`Notification ${e.method} defines parameters by position but received parameters by name`),n(e.params);else ce&&ce(e.method,e.params)}catch(t){t.message?S.error(`Notification handler '${e.method}' failed with message: ${t.message}`):S.error(`Notification handler '${e.method}' failed unexpectedly.`)}else ge.fire(e)}o(Le,`handleNotification`);function Re(e){if(!e){S.error(`Received empty message.`);return}S.error(`Received message which is neither a response nor a notification message:
${JSON.stringify(e,null,4)}`);let t=e;if(n.string(t.id)||n.number(t.id)){let e=t.id,n=T.get(e);n&&n.reject(Error(`The received response has neither a result nor an error property.`))}}o(Re,`handleInvalidMessage`);function ze(e){if(e!=null)switch(O){case f.Verbose:return JSON.stringify(e,null,4);case f.Compact:return JSON.stringify(e);default:return}}o(ze,`stringifyTrace`);function Be(e){if(!(O===f.Off||!k))if(fe===m.Text){let t;(O===f.Verbose||O===f.Compact)&&e.params&&(t=`Params: ${ze(e.params)}
`),k.log(`Sending request '${e.method} - (${e.id})'.`,t)}else Ke(`send-request`,e)}o(Be,`traceSendingRequest`);function Ve(e){if(!(O===f.Off||!k))if(fe===m.Text){let t;(O===f.Verbose||O===f.Compact)&&(t=e.params?`Params: ${ze(e.params)}
`:`No parameters provided.
`),k.log(`Sending notification '${e.method}'.`,t)}else Ke(`send-notification`,e)}o(Ve,`traceSendingNotification`);function He(e,t,n){if(!(O===f.Off||!k))if(fe===m.Text){let r;(O===f.Verbose||O===f.Compact)&&(e.error&&e.error.data?r=`Error data: ${ze(e.error.data)}
`:e.result?r=`Result: ${ze(e.result)}
`:e.error===void 0&&(r=`No result returned.
`)),k.log(`Sending response '${t} - (${e.id})'. Processing request took ${Date.now()-n}ms`,r)}else Ke(`send-response`,e)}o(He,`traceSendingResponse`);function Ue(e){if(!(O===f.Off||!k))if(fe===m.Text){let t;(O===f.Verbose||O===f.Compact)&&e.params&&(t=`Params: ${ze(e.params)}
`),k.log(`Received request '${e.method} - (${e.id})'.`,t)}else Ke(`receive-request`,e)}o(Ue,`traceReceivedRequest`);function We(e){if(!(O===f.Off||!k||e.method===g.type.method))if(fe===m.Text){let t;(O===f.Verbose||O===f.Compact)&&(t=e.params?`Params: ${ze(e.params)}
`:`No parameters provided.
`),k.log(`Received notification '${e.method}'.`,t)}else Ke(`receive-notification`,e)}o(We,`traceReceivedNotification`);function Ge(e,t){if(!(O===f.Off||!k))if(fe===m.Text){let n;if((O===f.Verbose||O===f.Compact)&&(e.error&&e.error.data?n=`Error data: ${ze(e.error.data)}
`:e.result?n=`Result: ${ze(e.result)}
`:e.error===void 0&&(n=`No result returned.
`)),t){let r=e.error?` Request failed: ${e.error.message} (${e.error.code}).`:``;k.log(`Received response '${t.method} - (${e.id})' in ${Date.now()-t.timerStart}ms.${r}`,n)}else k.log(`Received response ${e.id} without active response promise.`,n)}else Ke(`receive-response`,e)}o(Ge,`traceReceivedResponse`);function Ke(e,t){if(!k||O===f.Off)return;let n={isLSPMessage:!0,type:e,message:t,timestamp:Date.now()};k.log(n)}o(Ke,`logLSPMessage`);function qe(){if(Ee())throw new v(_.Closed,`Connection is closed.`);if(De())throw new v(_.Disposed,`Connection is disposed.`)}o(qe,`throwIfClosedOrDisposed`);function Je(){if(Te())throw new v(_.AlreadyListening,`Connection is already listening`)}o(Je,`throwIfListening`);function Ye(){if(!Te())throw Error(`Call listen() first.`)}o(Ye,`throwIfNotListening`);function Xe(e){return e===void 0?null:e}o(Xe,`undefinedToNull`);function Ze(e){if(e!==null)return e}o(Ze,`nullToUndefined`);function Qe(e){return e!=null&&!Array.isArray(e)&&typeof e==`object`}o(Qe,`isNamedParam`);function $e(e,t){switch(e){case r.ParameterStructures.auto:return Qe(t)?Ze(t):[Xe(t)];case r.ParameterStructures.byName:if(!Qe(t))throw Error(`Received parameters by name but param is not an object literal.`);return Ze(t);case r.ParameterStructures.byPosition:return[Xe(t)];default:throw Error(`Unknown parameter structure ${e.toString()}`)}}o($e,`computeSingleParam`);function et(e,t){let n,r=e.numberOfParams;switch(r){case 0:n=void 0;break;case 1:n=$e(e.parameterStructures,t[0]);break;default:n=[];for(let e=0;e<t.length&&e<r;e++)n.push(Xe(t[e]));if(t.length<r)for(let e=t.length;e<r;e++)n.push(null);break}return n}o(et,`computeMessageParams`);let tt={sendNotification:o((e,...t)=>{qe();let i,a;if(n.string(e)){i=e;let n=t[0],o=0,s=r.ParameterStructures.auto;r.ParameterStructures.is(n)&&(o=1,s=n);let c=t.length,l=c-o;switch(l){case 0:a=void 0;break;case 1:a=$e(s,t[o]);break;default:if(s===r.ParameterStructures.byName)throw Error(`Received ${l} parameters for 'by Name' notification parameter structure.`);a=t.slice(o,c).map(e=>Xe(e));break}}else{let n=t;i=e.method,a=et(e,n)}let o={jsonrpc:`2.0`,method:i,params:a};return Ve(o),y.write(o).catch(e=>{throw S.error(`Sending notification failed.`),e})},`sendNotification`),onNotification:o((e,t)=>{qe();let r;return n.func(e)?ce=e:t&&(n.string(e)?(r=e,le.set(e,{type:void 0,handler:t})):(r=e.method,le.set(e.method,{type:e,handler:t}))),{dispose:o(()=>{r===void 0?ce=void 0:le.delete(r)},`dispose`)}},`onNotification`),onProgress:o((e,t,n)=>{if(ue.has(t))throw Error(`Progress handler for token ${t} already registered`);return ue.set(t,n),{dispose:o(()=>{ue.delete(t)},`dispose`)}},`onProgress`),sendProgress:o((e,t,n)=>tt.sendNotification(u.type,{token:t,value:n}),`sendProgress`),onUnhandledProgress:_e.event,sendRequest:o((e,...t)=>{qe(),Ye();let i,a,c;if(n.string(e)){i=e;let n=t[0],o=t[t.length-1],l=0,u=r.ParameterStructures.auto;r.ParameterStructures.is(n)&&(l=1,u=n);let d=t.length;s.CancellationToken.is(o)&&(--d,c=o);let f=d-l;switch(f){case 0:a=void 0;break;case 1:a=$e(u,t[l]);break;default:if(u===r.ParameterStructures.byName)throw Error(`Received ${f} parameters for 'by Name' request parameter structure.`);a=t.slice(l,d).map(e=>Xe(e));break}}else{let n=t;i=e.method,a=et(e,n);let r=e.numberOfParams;c=s.CancellationToken.is(n[r])?n[r]:void 0}let l=C++,u;c&&(u=c.onCancellationRequested(()=>{let e=ye.sender.sendCancellation(tt,l);return e===void 0?(S.log(`Received no promise from cancellation strategy when cancelling id ${l}`),Promise.resolve()):e.catch(()=>{S.log(`Sending cancellation messages for id ${l} failed`)})}));let d={jsonrpc:`2.0`,id:l,method:i,params:a};return Be(d),typeof ye.sender.enableCancellation==`function`&&ye.sender.enableCancellation(d),new Promise(async(e,t)=>{let n=o(t=>{e(t),ye.sender.cleanup(l),u?.dispose()},`resolveWithCleanup`),a=o(e=>{t(e),ye.sender.cleanup(l),u?.dispose()},`rejectWithCleanup`),s={method:i,timerStart:Date.now(),resolve:n,reject:a};try{await y.write(d),T.set(l,s)}catch(e){throw S.error(`Sending request failed.`),s.reject(new r.ResponseError(r.ErrorCodes
`),F(`\r`),F(` `),F(`\v`),F(` `),F(`\xA0`),F(``),F(` `),F(``),F(``),F(``),F(``),F(``),F(``),F(``),F(``),F(``),F(``),F(`\u2028`),F(`\u2029`),F(``),F(``),F(` `),F(``)],ga=/[0-9a-fA-F]/,_a=/[0-9]/,va=/[1-9]/,ya=class{static{o(this,`RegExpParser`)}constructor(){this.idx=0,this.input=``,this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx}pattern(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar(`/`);let t=this.disjunction();this.consumeChar(`/`);let n={type:`Flags`,loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case`g`:la(n,`global`);break;case`i`:la(n,`ignoreCase`);break;case`m`:la(n,`multiLine`);break;case`u`:la(n,`unicode`);break;case`y`:la(n,`sticky`);break}if(this.idx!==this.input.length)throw Error(`Redundant input: `+this.input.substring(this.idx));return{type:`Pattern`,flags:n,value:t,loc:this.loc(0)}}disjunction(){let e=[],t=this.idx;for(e.push(this.alternative());this.peekChar()===`|`;)this.consumeChar(`|`),e.push(this.alternative());return{type:`Disjunction`,value:e,loc:this.loc(t)}}alternative(){let e=[],t=this.idx;for(;this.isTerm();)e.push(this.term());return{type:`Alternative`,value:e,loc:this.loc(t)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){let e=this.idx;switch(this.popChar()){case`^`:return{type:`StartAnchor`,loc:this.loc(e)};case`$`:return{type:`EndAnchor`,loc:this.loc(e)};case`\\`:switch(this.popChar()){case`b`:return{type:`WordBoundary`,loc:this.loc(e)};case`B`:return{type:`NonWordBoundary`,loc:this.loc(e)}}throw Error(`Invalid Assertion Escape`);case`(`:this.consumeChar(`?`);let t;switch(this.popChar()){case`=`:t=`Lookahead`;break;case`!`:t=`NegativeLookahead`;break;case`<`:switch(this.popChar()){case`=`:t=`Lookbehind`;break;case`!`:t=`NegativeLookbehind`}break}ua(t);let n=this.disjunction();return this.consumeChar(`)`),{type:t,value:n,loc:this.loc(e)}}return da()}quantifier(e=!1){let t,n=this.idx;switch(this.popChar()){case`*`:t={atLeast:0,atMost:1/0};break;case`+`:t={atLeast:1,atMost:1/0};break;case`?`:t={atLeast:0,atMost:1};break;case`{`:let n=this.integerIncludingZero();switch(this.popChar()){case`}`:t={atLeast:n,atMost:n};break;case`,`:let e;this.isDigit()?(e=this.integerIncludingZero(),t={atLeast:n,atMost:e}):t={atLeast:n,atMost:1/0},this.consumeChar(`}`);break}if(e===!0&&t===void 0)return;ua(t);break}if(!(e===!0&&t===void 0)&&ua(t))return this.peekChar(0)===`?`?(this.consumeChar(`?`),t.greedy=!1):t.greedy=!0,t.type=`Quantifier`,t.loc=this.loc(n),t}atom(){let e,t=this.idx;switch(this.peekChar()){case`.`:e=this.dotAll();break;case`\\`:e=this.atomEscape();break;case`[`:e=this.characterClass();break;case`(`:e=this.group();break}return e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),ua(e)?(e.loc=this.loc(t),this.isQuantifier()&&(e.quantifier=this.quantifier()),e):da()}dotAll(){return this.consumeChar(`.`),{type:`Set`,complement:!0,value:[F(`
`),F(`\r`),F(`\u2028`),F(`\u2029`)]}}atomEscape(){switch(this.consumeChar(`\\`),this.peekChar()){case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:return this.decimalEscapeAtom();case`d`:case`D`:case`s`:case`S`:case`w`:case`W`:return this.characterClassEscape();case`f`:case`n`:case`r`:case`t`:case`v`:return this.controlEscapeAtom();case`c`:return this.controlLetterEscapeAtom();case`0`:return this.nulCharacterAtom();case`x`:return this.hexEscapeSequenceAtom();case`u`:return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}decimalEscapeAtom(){return{type:`GroupBackReference`,value:this.positiveInteger()}}characterClassEscape(){let e,t=!1;switch(this.popChar()){case`d`:e=pa;break;case`D`:e=pa,t=!0;break;case`s`:e=ha;break;case`S`:e=ha,t=!0;break;case`w`:e=ma;break;case`W`:e=ma,t=!0;break}return ua(e)?{type:`Set`,value:e,complement:t}:da()}controlEscapeAtom(){let e;switch(this.popChar()){case`f`:e=F(`\f`);break;case`n`:e=F(`
`);break;case`r`:e=F(`\r`);break;case`t`:e=F(` `);break;case`v`:e=F(`\v`);break}return ua(e)?{type:`Character`,value:e}:da()}controlLetterEscapeAtom(){this.consumeChar(`c`);let e=this.popChar();if(/[a-zA-Z]/.test(e)===!1)throw Error(`Invalid `);return{type:`Character`,value:e.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar(`0`),{type:`Character`,value:F(`\0`)}}hexEscapeSequenceAtom(){return this.consumeChar(`x`),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar(`u`),this.parseHexDigits(4)}identityEscapeAtom(){return{type:`Character`,value:F(this.popChar())}}classPatternCharacterAtom(){switch(this.peekChar()){case`
`:case`\r`:case`\u2028`:case`\u2029`:case`\\`:case`]`:throw Error(`TBD`);default:return{type:`Character`,value:F(this.popChar())}}}characterClass(){let e=[],t=!1;for(this.consumeChar(`[`),this.peekChar(0)===`^`&&(this.consumeChar(`^`),t=!0);this.isClassAtom();){let t=this.classAtom();if(t.type,fa(t)&&this.isRangeDash()){this.consumeChar(`-`);let n=this.classAtom();if(n.type,fa(n)){if(n.value<t.value)throw Error(`Range out of order in character class`);e.push({from:t.value,to:n.value})}else ca(t.value,e),e.push(F(`-`)),ca(n.value,e)}else ca(t.value,e)}return this.consumeChar(`]`),{type:`Set`,complement:t,value:e}}classAtom(){switch(this.peekChar()){case`]`:case`
`:case`\r`:case`\u2028`:case`\u2029`:throw Error(`TBD`);case`\\`:return this.classEscape();default:return this.classPatternCharacterAtom()}}classEscape(){switch(this.consumeChar(`\\`),this.peekChar()){case`b`:return this.consumeChar(`b`),{type:`Character`,value:F(`\b`)};case`d`:case`D`:case`s`:case`S`:case`w`:case`W`:return this.characterClassEscape();case`f`:case`n`:case`r`:case`t`:case`v`:return this.controlEscapeAtom();case`c`:return this.controlLetterEscapeAtom();case`0`:return this.nulCharacterAtom();case`x`:return this.hexEscapeSequenceAtom();case`u`:return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}group(){let e=!0;switch(this.consumeChar(`(`),this.peekChar(0)){case`?`:this.consumeChar(`?`),this.consumeChar(`:`),e=!1;break;default:this.groupIdx++;break}let t=this.disjunction();this.consumeChar(`)`);let n={type:`Group`,capturing:e,value:t};return e&&(n.idx=this.groupIdx),n}positiveInteger(){let e=this.popChar();if(va.test(e)===!1)throw Error(`Expecting a positive integer`);for(;_a.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(_a.test(e)===!1)throw Error(`Expecting an integer`);for(;_a.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}patternCharacter(){let e=this.popChar();switch(e){case`
`:case`\r`:case`\u2028`:case`\u2029`:case`^`:case`$`:case`\\`:case`.`:case`*`:case`+`:case`?`:case`(`:case`)`:case`[`:case`|`:throw Error(`TBD`);default:return{type:`Character`,value:F(e)}}}isRegExpFlag(){switch(this.peekChar(0)){case`g`:case`i`:case`m`:case`u`:case`y`:return!0;default:return!1}}isRangeDash(){return this.peekChar()===`-`&&this.isClassAtom(1)}isDigit(){return _a.test(this.peekChar(0))}isClassAtom(e=0){switch(this.peekChar(e)){case`]`:case`
`:case`\r`:case`\u2028`:case`\u2029`:return!1;default:return!0}}isTerm(){return this.isAtom()||this.isAssertion()}isAtom(){if(this.isPatternCharacter())return!0;switch(this.peekChar(0)){case`.`:case`\\`:case`[`:case`(`:return!0;default:return!1}}isAssertion(){switch(this.peekChar(0)){case`^`:case`$`:return!0;case`\\`:switch(this.peekChar(1)){case`b`:case`B`:return!0;default:return!1}case`(`:return this.peekChar(1)===`?`&&(this.peekChar(2)===`=`||this.peekChar(2)===`!`||this.peekChar(2)===`<`&&(this.peekChar(3)===`=`||this.peekChar(3)===`!`));default:return!1}}isQuantifier(){let e=this.saveState();try{return this.quantifier(!0)!==void 0}catch{return!1}finally{this.restoreState(e)}}isPatternCharacter(){switch(this.peekChar()){case`^`:case`$`:case`\\`:case`.`:case`*`:case`+`:case`?`:case`(`:case`)`:case`[`:case`|`:case`/`:case`
`:case`\r`:case`\u2028`:case`\u2029`:return!1;default:return!0}}parseHexDigits(e){let t=``;for(let n=0;n<e;n++){let e=this.popChar();if(ga.test(e)===!1)throw Error(`Expecting a HexDecimal digits`);t+=e}return{type:`Character`,value:parseInt(t,16)}}peekChar(e=0){return this.input[this.idx+e]}popChar(){let e=this.peekChar(0);return this.consumeChar(void 0),e}consumeChar(e){if(e!==void 0&&this.input[this.idx]!==e)throw Error(`Expected: '`+e+`' but found: '`+this.input[this.idx]+`' at offset: `+this.idx);if(this.idx>=this.input.length)throw Error(`Unexpected end of input`);this.idx++}loc(e){return{begin:e,end:this.idx}}},ba=class{static{o(this,`BaseRegExpVisitor`)}visitChildren(e){for(let t in e){let n=e[t];e.hasOwnProperty(t)&&(n.type===void 0?Array.isArray(n)&&n.forEach(e=>{this.visit(e)},this):this.visit(n))}}visit(e){switch(e.type){case`Pattern`:this.visitPattern(e);break;case`Flags`:this.visitFlags(e);break;case`Disjunction`:this.visitDisjunction(e);break;case`Alternative`:this.visitAlternative(e);break;case`StartAnchor`:this.visitStartAnchor(e);break;case`EndAnchor`:this.visitEndAnchor(e);break;case`WordBoundary`:this.visitWordBoundary(e);break;case`NonWordBoundary`:this.visitNonWordBoundary(e);break;case`Lookahead`:this.visitLookahead(e);break;case`NegativeLookahead`:this.visitNegativeLookahead(e);break;case`Lookbehind`:this.visitLookbehind(e);break;case`NegativeLookbehind`:this.visitNegativeLookbehind(e);break;case`Character`:this.visitCharacter(e);break;case`Set`:this.visitSet(e);break;case`Group`:this.visitGroup(e);break;case`GroupBackReference`:this.visitGroupBackReference(e);break;case`Quantifier`:this.visitQuantifier(e);break}this.visitChildren(e)}visitPattern(e){}visitFlags(e){}visitDisjunction(e){}visitAlternative(e){}visitStartAnchor(e){}visitEndAnchor(e){}visitWordBoundary(e){}visitNonWordBoundary(e){}visitLookahead(e){}visitNegativeLookahead(e){}visitLookbehind(e){}visitNegativeLookbehind(e){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}},xa=/\r?\n/gm,Sa=new ya,Ca=new class extends ba{static{o(this,`TerminalRegExpVisitor`)}constructor(){super(...arguments),this.isStarting=!0,this.endRegexpStack=[],this.multiline=!1}get endRegex(){return this.endRegexpStack.join(``)}reset(e){this.multiline=!1,this.regex=e,this.startRegexp=``,this.isStarting=!0,this.endRegexpStack=[]}visitGroup(e){e.quantifier&&(this.isStarting=!1,this.endRegexpStack=[])}visitCharacter(e){let t=String.fromCharCode(e.value);if(!this.multiline&&t===`
`&&(this.multiline=!0),e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{let e=Oa(t);this.endRegexpStack.push(e),this.isStarting&&(this.startRegexp+=e)}}visitSet(e){if(!this.multiline){let t=this.regex.substring(e.loc.begin,e.loc.end),n=new RegExp(t);this.multiline=!!`
`.match(n)}if(e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{let t=this.regex.substring(e.loc.begin,e.loc.end);this.endRegexpStack.push(t),this.isStarting&&(this.startRegexp+=t)}}visitChildren(e){e.type===`Group`&&e.quantifier||super.visitChildren(e)}};function wa(e){try{typeof e!=`string`&&(e=e.source),e=`/${e}/`;let t=Sa.pattern(e),n=[];for(let r of t.value.value)Ca.reset(e),Ca.visit(r),n.push({start:Ca.startRegexp,end:Ca.endRegex});return n}catch{return[]}}o(wa,`getTerminalParts`);function Ta(e){try{return typeof e==`string`&&(e=new RegExp(e)),e=e.toString(),Ca.reset(e),Ca.visit(Sa.pattern(e)),Ca.multiline}catch{return!1}}o(Ta,`isMultilineComment`);var Ea=`\f
\r \v \xA0 \u2028\u2029 `.split(``);function Da(e){let t=typeof e==`string`?new RegExp(e):e;return Ea.some(e=>t.test(e))}o(Da,`isWhitespace`);function Oa(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}o(Oa,`escapeRegExp`);function ka(e,t){let n=Aa(e),r=t.match(n);return!!r&&r[0].length>0}o(ka,`partialMatches`);function Aa(e){typeof e==`string`&&(e=new RegExp(e));let t=e,n=e.source,r=0;function i(){let e=``,a;function s(t){e+=n.substr(r,t),r+=t}o(s,`appendRaw`);function c(t){e+=`(?:`+n.substr(r,t)+`|$)`,r+=t}for(o(c,`appendOptional`);r<n.length;)switch(n[r]){case`\\`:switch(n[r+1]){case`c`:c(3);break;case`x`:c(4);break;case`u`:t.unicode?n[r+2]===`{`?c(n.indexOf(`}`,r)-r+1):c(6):c(2);break;case`p`:case`P`:t.unicode?c(n.indexOf(`}`,r)-r+1):c(2);break;case`k`:c(n.indexOf(`>`,r)-r+1);break;default:c(2);break}break;case`[`:a=/\[(?:\\.|.)*?\]/g,a.lastIndex=r,a=a.exec(n)||[],c(a[0].length);break;case`|`:case`^`:case`$`:case`*`:case`+`:case`?`:s(1);break;case`{`:a=/\{\d+,?\d*\}/g,a.lastIndex=r,a=a.exec(n),a?s(a[0].length):c(1);break;case`(`:if(n[r+1]===`?`)switch(n[r+2]){case`:`:e+=`(?:`,r+=3,e+=i()+`|$)`;break;case`=`:e+=`(?=`,r+=3,e+=i()+`)`;break;case`!`:a=r,r+=3,i(),e+=n.substr(a,r-a);break;case`<`:switch(n[r+3]){case`=`:case`!`:a=r,r+=4,i(),e+=n.substr(a,r-a);break;default:s(n.indexOf(`>`,r)-r+1),e+=i()+`|$)`;break}break}else s(1),e+=i()+`|$)`;break;case`)`:return++r,e;default:c(1);break}return e}return o(i,`process`),new RegExp(i(),e.flags)}o(Aa,`partialRegExp`);function ja(e){return e.rules.find(e=>Yr(e)&&e.entry)}o(ja,`getEntryRule`);function Ma(e){return e.rules.filter(e=>hi(e)&&e.hidden)}o(Ma,`getHiddenRules`);function Na(e,t){let n=new Set,r=ja(e);if(!r)return new Set(e.rules);let i=[r].concat(Ma(e));for(let e of i)Pa(e,n,t);let a=new Set;for(let t of e.rules)(n.has(t.name)||hi(t)&&t.hidden)&&a.add(t);return a}o(Na,`getAllReachableRules`);function Pa(e,t,n){t.add(e.name),jn(e).forEach(e=>{if(ri(e)||n&&_i(e)){let r=e.rule.ref;r&&!t.has(r.name)&&Pa(r,t,n)}})}o(Pa,`ruleDfs`);function Fa(e){let t=new Set;return jn(e).forEach(e=>{pr(e)&&(Yr(e.type.ref)&&t.add(e.type.ref),Tr(e.type.ref)&&Yr(e.type.ref.$container)&&t.add(e.type.ref.$container))}),t}o(Fa,`getAllRulesUsedForCrossReferences`);function Ia(e){if(e.terminal)return e.terminal;if(e.type.ref)return Ga(e.type.ref)?.terminal}o(Ia,`getCrossReferenceTerminal`);function La(e){return e.hidden&&!Da(oo(e))}o(La,`isCommentTerminal`);function Ra(e,t){return!e||!t?[]:Ba(e,t,e.astNode,!0)}o(Ra,`findNodesForProperty`);function za(e,t,n){if(!e||!t)return;let r=Ba(e,t,e.astNode,!0);if(r.length!==0)return n=n===void 0?0:Math.max(0,Math.min(n,r.length-1)),r[n]}o(za,`findNodeForProperty`);function Ba(e,t,n,r){if(!r){let n=Tn(e.grammarSource,rr);if(n&&n.feature===t)return[e]}return pn(e)&&e.astNode===n?e.content.flatMap(e=>Ba(e,t,n,!1)):[]}o(Ba,`findNodesForPropertyInternal`);function Va(e,t){return e?Ua(e,t,e?.astNode):[]}o(Va,`findNodesForKeyword`);function Ha(e,t,n){if(!e)return;let r=Ua(e,t,e?.astNode);if(r.length!==0)return n=n===void 0?0:Math.max(0,Math.min(n,r.length-1)),r[n]}o(Ha,`findNodeForKeyword`);function Ua(e,t,n){if(e.astNode!==n)return[];if(Fr(e.grammarSource)&&e.grammarSource.value===t)return[e];let r=Ii(e).iterator(),i,a=[];do if(i=r.next(),!i.done){let e=i.value;e.astNode===n?Fr(e.grammarSource)&&e.grammarSource.value===t&&a.push(e):r.prune()}while(!i.done);return a}o(Ua,`findNodesForKeywordInternal`);function Wa(e){let t=e.astNode;for(;t===e.container?.astNode;){let t=Tn(e.grammarSource,rr);if(t)return t;e=e.container}}o(Wa,`findAssignment`);function Ga(e){let t=e;return Tr(t)&&(Yn(t.$container)?t=t.$container.$container:Un(t.$container)?t=t.$container:aa(t.$container)),Ka(e,t,new Map)}o(Ga,`findNameAssignment`);function Ka(e,t,n){function r(t,r){let i;return Tn(t,rr)||(i=Ka(r,r,n)),n.set(e,i),i}if(o(r,`go`),n.has(e))return n.get(e);n.set(e,void 0);for(let i of jn(t))if(rr(i)&&i.feature.toLowerCase()===`name`)return n.set(e,i),i;else if(ri(i)&&Yr(i.rule.ref))return r(i,i.rule.ref);else if(ai(i)&&i.typeRef?.ref)return
`;function Pv(e,t=!1){try{let t=Av(e);return Fv(t.value,{},t.flags.ignoreCase)}catch(n){if(n.message===Mv)t&&Z_(`${Nv} Unable to optimize: < ${e.toString()} >
Complement Sets cannot be automatically optimized.
This will disable the lexer's first char optimizations.
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{let n=``;t&&(n=`
This will disable the lexer's first char optimizations.
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),X_(`${Nv}
Failed parsing: < ${e.toString()} >
Using the @chevrotain/regexp-to-ast library
Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+n)}}return[]}o(Pv,`getOptimizedStartCodesIndices`);function Fv(e,t,n){switch(e.type){case`Disjunction`:for(let r=0;r<e.value.length;r++)Fv(e.value[r],t,n);break;case`Alternative`:let r=e.value;for(let e=0;e<r.length;e++){let i=r[e];switch(i.type){case`EndAnchor`:case`GroupBackReference`:case`Lookahead`:case`NegativeLookahead`:case`Lookbehind`:case`NegativeLookbehind`:case`StartAnchor`:case`WordBoundary`:case`NonWordBoundary`:continue}let a=i;switch(a.type){case`Character`:Iv(a.value,t,n);break;case`Set`:if(a.complement===!0)throw Error(Mv);z(a.value,e=>{if(typeof e==`number`)Iv(e,t,n);else{let r=e;if(n===!0)for(let e=r.from;e<=r.to;e++)Iv(e,t,n);else{for(let e=r.from;e<=r.to&&e<by;e++)Iv(e,t,n);if(r.to>=by){let e=r.from>=by?r.from:by,n=r.to,i=Sy(e),a=Sy(n);for(let e=i;e<=a;e++)t[e]=e}}}});break;case`Group`:Fv(a.value,t,n);break;default:throw Error(`Non Exhaustive Match`)}let o=a.quantifier!==void 0&&a.quantifier.atLeast===0;if(a.type===`Group`&&zv(a)===!1||a.type!==`Group`&&o===!1)break}break;default:throw Error(`non exhaustive match!`)}return H(t)}o(Fv,`firstCharOptimizedIndices`);function Iv(e,t,n){let r=Sy(e);t[r]=r,n===!0&&Lv(e,t)}o(Iv,`addOptimizedIdxToResult`);function Lv(e,t){let n=String.fromCharCode(e),r=n.toUpperCase();if(r!==n){let e=Sy(r.charCodeAt(0));t[e]=e}else{let e=n.toLowerCase();if(e!==n){let n=Sy(e.charCodeAt(0));t[n]=n}}}o(Lv,`handleIgnoreCase`);function Rv(e,t){return Hg(e.value,e=>{if(typeof e==`number`)return u_(t,e);{let n=e;return Hg(t,e=>n.from<=e&&e<=n.to)!==void 0}})}o(Rv,`findCode`);function zv(e){let t=e.quantifier;return t&&t.atLeast===0?!0:e.value?I(e.value)?Ng(e.value,zv):zv(e.value):!1}o(zv,`isWholeOptional`);var Bv=class extends ba{static{o(this,`CharCodeFinder`)}constructor(e){super(),this.targetCharCodes=e,this.found=!1}visitChildren(e){if(this.found!==!0){switch(e.type){case`Lookahead`:this.visitLookahead(e);return;case`NegativeLookahead`:this.visitNegativeLookahead(e);return;case`Lookbehind`:this.visitLookbehind(e);return;case`NegativeLookbehind`:this.visitNegativeLookbehind(e);return}super.visitChildren(e)}}visitCharacter(e){u_(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?Rv(e,this.targetCharCodes)===void 0&&(this.found=!0):Rv(e,this.targetCharCodes)!==void 0&&(this.found=!0)}};function Vv(e,t){if(t instanceof RegExp){let n=Av(t),r=new Bv(e);return r.visit(n),r.found}else return Hg(t,t=>u_(e,t.charCodeAt(0)))!==void 0}o(Vv,`canMatchCharCode`);var Hv=`PATTERN`,Uv=`defaultMode`,Wv=`modes`;function Gv(e,t){t=ug(t,{debug:!1,safeMode:!1,positionTracking:`full`,lineTerminatorCharacters:[`\r`,`
`],tracer:o((e,t)=>t(),`tracer`)});let n=t.tracer;n(`initCharCodeToOptimizedIndexMap`,()=>{Cy()});let r;n(`Reject Lexer.NA`,()=>{r=z_(e,e=>e[Hv]===Vy.NA)});let i=!1,a;n(`Transform Patterns`,()=>{i=!1,a=B(r,e=>{let t=e[Hv];if(S_(t)){let e=t.source;return e.length===1&&e!==`^`&&e!==`$`&&e!==`.`&&!t.ignoreCase?e:e.length===2&&e[0]===`\\`&&!u_([`d`,`D`,`s`,`S`,`t`,`r`,`n`,`t`,`0`,`c`,`b`,`B`,`f`,`v`,`w`,`W`],e[1])?e[1]:ly(t)}else if(Ss(t))return i=!0,{exec:t};else if(typeof t==`object`)return i=!0,t;else if(typeof t==`string`){if(t.length===1)return t;{let e=t.replace(/[\\^$.*+?()[\]{}|]/g,`\\$&`);return ly(new RegExp(e))}}else throw Error(`non exhaustive match`)})});let s,c,l,u,d;n(`misc mapping`,()=>{s=B(r,e=>e.tokenTypeIdx),c=B(r,e=>{let t=e.GROUP;if(t!==Vy.SKIPPED){if(i_(t))return t;if(w_(t))return!1;throw Error(`non exhaustive match`)}}),l=B(r,e=>{let t=e.LONGER_ALT;if(t)return I(t)?B(t,e=>p_(r,e)):[p_(r,t)]}),u=B(r,e=>e.PUSH_MODE),d=B(r,e=>V(e,`POP_MODE`))});let f;n(`Line Terminator Handling`,()=>{let e=vy(t.lineTerminatorCharacters);f=B(r,e=>!1),t.positionTracking!==`onlyOffset`&&(f=B(r,t=>V(t,`LINE_BREAKS`)?!!t.LINE_BREAKS:gy(t,e)===!1&&Vv(e,t.PATTERN)))});let p,m,h,g;n(`Misc Mapping #2`,()=>{p=B(r,py),m=B(a,my),h=L_(r,(e,t)=>{let n=t.GROUP;return i_(n)&&n!==Vy.SKIPPED&&(e[n]=[]),e},{}),g=B(a,(e,t)=>({pattern:a[t],longerAlt:l[t],canLineTerminator:f[t],isCustom:p[t],short:m[t],group:c[t],push:u[t],pop:d[t],tokenTypeIdx:s[t],tokenType:r[t]}))});let _=!0,v=[];return t.safeMode||n(`First Char Optimization`,()=>{v=L_(r,(e,n,r)=>{if(typeof n.PATTERN==`string`)yy(e,Sy(n.PATTERN.charCodeAt(0)),g[r]);else if(I(n.START_CHARS_HINT)){let t;z(n.START_CHARS_HINT,n=>{let i=Sy(typeof n==`string`?n.charCodeAt(0):n);t!==i&&(t=i,yy(e,i,g[r]))})}else if(S_(n.PATTERN))if(n.PATTERN.unicode)_=!1,t.ensureOptimizations&&X_(`${Nv} Unable to analyze < ${n.PATTERN.toString()} > pattern.
The regexp unicode flag is not currently supported by the regexp-to-ast library.
This will disable the lexer's first char optimizations.
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{let i=Pv(n.PATTERN,t.ensureOptimizations);U(i)&&(_=!1),z(i,t=>{yy(e,t,g[r])})}else t.ensureOptimizations&&X_(`${Nv} TokenType: <${n.name}> is using a custom token pattern without providing <start_chars_hint> parameter.
This will disable the lexer's first char optimizations.
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),_=!1;return e},[])}),{emptyGroups:h,patternIdxToConfig:g,charCodeToPatternIdxToConfig:v,hasCustom:i,canBeOptimized:_}}o(Gv,`analyzeTokenTypes`);function Kv(e,t){let n=[],r=Jv(e);n=n.concat(r.errors);let i=Yv(r.valid),a=i.valid;return n=n.concat(i.errors),n=n.concat(qv(a)),n=n.concat(ry(a)),n=n.concat(iy(a,t)),n=n.concat(ay(a)),n}o(Kv,`validatePatterns`);function qv(e){let t=[],n=Lg(e,e=>S_(e[Hv]));return t=t.concat(Zv(n)),t=t.concat(ey(n)),t=t.concat(ty(n)),t=t.concat(ny(n)),t=t.concat(Qv(n)),t}o(qv,`validateRegExpPattern`);function Jv(e){let t=Lg(e,e=>!V(e,Hv));return{errors:B(t,e=>({message:`Token Type: ->`+e.name+`<- missing static 'PATTERN' property`,type:K.MISSING_PATTERN,tokenTypes:[e]})),valid:vg(e,t)}}o(Jv,`findMissingPatterns`);function Yv(e){let t=Lg(e,e=>{let t=e[Hv];return!S_(t)&&!Ss(t)&&!V(t,`exec`)&&!i_(t)});return{errors:B(t,e=>({message:`Token Type: ->`+e.name+`<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.`,type:K.INVALID_PATTERN,tokenTypes:[e]})),valid:vg(e,t)}}o(Yv,`findInvalidPatterns`);var Xv=/[^\\][$]/;function Zv(e){class t extends ba{static{o(this,`EndAnchorFinder`)}constructor(){super(...arguments),this.found=!1}visitEndAnchor(e){this.found=!0}}return B(Lg(e,e=>{let n=e.PATTERN;try{let e=Av(n),r=new t;return r.visit(e),r.found}catch{return Xv.test(n.source)}}),e=>({message:`Unexpected RegExp Anchor Error:
Token Type: ->`+e.name+`<- static 'PATTERN' cannot contain end of input anchor '$'
See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:K.EOI_ANCHOR_FOUND,tokenTypes:[e]}))}o(Zv,`findEndOfInputAnchor`);function Qv(e){return B(Lg(e,e=>e.PATTERN.test(``)),e=>({message:`Token Type: ->`+e.name+`<- static 'PATTERN' must not match an empty string`,type:K.EMPTY_MATCH_PATTERN,tokenTypes:[e]}))}o(Qv,`findEmptyMatchRegExps`);var $v=/[^\\[][\^]|^\^/;function ey(e){class t extends ba{static{o(this,`StartAnchorFinder`)}constructor(){super(...arguments),this.found=!1}visitStartAnchor(e){this.found=!0}}return B(Lg(e,e=>{let n=e.PATTERN;try{let e=Av(n),r=new t;return r.visit(e),r.found}catch{return $v.test(n.source)}}),e=>({message:`Unexpected RegExp Anchor Error:
Token Type: ->`+e.name+`<- static 'PATTERN' cannot contain start of input anchor '^'
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:K.SOI_ANCHOR_FOUND,tokenTypes:[e]}))}o(ey,`findStartOfInputAnchor`);function ty(e){return B(Lg(e,e=>{let t=e[Hv];return t instanceof RegExp&&(t.multiline||t.global)}),e=>({message:`Token Type: ->`+e.name+`<- static 'PATTERN' may NOT contain global('g') or multiline('m')`,type:K.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[e]}))}o(ty,`findUnsupportedFlags`);function ny(e){let t=[],n=B(e,n=>L_(e,(e,r)=>n.PATTERN.source===r.PATTERN.source&&!u_(t,r)&&r.PATTERN!==Vy.NA?(t.push(r),e.push(r),e):e,[]));return n=wm(n),B(Lg(n,e=>e.length>1),e=>{let t=B(e,e=>e.name);return{message:`The same RegExp pattern ->${Wg(e).PATTERN}<-has been used in all of the following Token Types: ${t.join(`, `)} <-`,type:K.DUPLICATE_PATTERNS_FOUND,tokenTypes:e}})}o(ny,`findDuplicatePatterns`);function ry(e){return B(Lg(e,e=>{if(!V(e,`GROUP`))return!1;let t=e.GROUP;return t!==Vy.SKIPPED&&t!==Vy.NA&&!i_(t)}),e=>({message:`Token Type: ->`+e.name+`<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String`,type:K.INVALID_GROUP_TYPE_FOUND,tokenTypes:[e]}))}o(ry,`findInvalidGroupType`);function iy(e,t){return B(Lg(e,e=>e.PUSH_MODE!==void 0&&!u_(t,e.PUSH_MODE)),e=>({message:`Token Type: ->${e.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${e.PUSH_MODE}<-which does not exist`,type:K.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[e]}))}o(iy,`findModesThatDoNotExist`);function ay(e){let t=[],n=L_(e,(e,t,n)=>{let r=t.PATTERN;return r===Vy.NA||(i_(r)?e.push({str:r,idx:n,tokenType:t}):S_(r)&&sy(r)&&e.push({str:r.source,idx:n,tokenType:t})),e},[]);return z(e,(e,r)=>{z(n,({str:n,idx:i,tokenType:a})=>{if(r<i&&oy(n,e.PATTERN)){let n=`Token: ->${a.name}<- can never be matched.
Because it appears AFTER the Token Type ->${e.name}<-in the lexer's definition.
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;t.push({message:n,type:K.UNREACHABLE_PATTERN,tokenTypes:[e,a]})}})}),t}o(ay,`findUnreachablePatterns`);function oy(e,t){if(S_(t)){if(cy(t))return!1;let n=t.exec(e);return n!==null&&n.index===0}else if(Ss(t))return t(e,0,[],{});else if(V(t,`exec`))return t.exec(e,0,[],{});else if(typeof t==`string`)return t===e;else throw Error(`non exhaustive match`)}o(oy,`tryToMatchStrToPattern`);function sy(e){return Hg([`.`,`\\`,`[`,`]`,`|`,`^`,`$`,`(`,`)`,`?`,`*`,`+`,`{`],t=>e.source.indexOf(t)!==-1)===void 0}o(sy,`noMetaChar`);function cy(e){return/(\(\?=)|(\(\?!)|(\(\?<=)|(\(\?<!)/.test(e.source)}o(cy,`usesLookAheadOrBehind`);function ly(e){let t=e.ignoreCase?`iy`:`y`;return RegExp(`${e.source}`,t)}o(ly,`addStickyFlag`);function uy(e,t,n){let r=[];return V(e,Uv)||r.push({message:`A MultiMode Lexer cannot be initialized without a <`+Uv+`> property in its definition
`,type:K.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),V(e,Wv)||r.push({message:`A MultiMode Lexer cannot be initialized without a <`+Wv+`> property in its definition
`,type:K.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),V(e,Wv)&&V(e,Uv)&&!V(e.modes,e.defaultMode)&&r.push({message:`A MultiMode Lexer cannot be initialized with a ${Uv}: <${e.defaultMode}>which does not exist
`,type:K.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),V(e,Wv)&&z(e.modes,(e,t)=>{z(e,(n,i)=>{w_(n)?r.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${t}> at index: <${i}>
`,type:K.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED}):V(n,`LONGER_ALT`)&&z(I(n.LONGER_ALT)?n.LONGER_ALT:[n.LONGER_ALT],i=>{!w_(i)&&!u_(e,i)&&r.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${i.name}> on token <${n.name}> outside of mode <${t}>
`,type:K.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})})}),r}o(uy,`performRuntimeChecks`);function dy(e,t,n){let r=[],i=!1,a=z_(wm(Ld(H(e.modes))),e=>e[Hv]===Vy.NA),o=vy(n);return t&&z(a,e=>{let t=gy(e,o);if(t!==!1){let n={message:_y(e,t),type:t.issue,tokenType:e};r.push(n)}else V(e,`LINE_BREAKS`)?e.LINE_BREAKS===!0&&(i=!0):Vv(o,e.PATTERN)&&(i=!0)}),t&&!i&&r.push({message:`Warning: No LINE_BREAKS Found.
This Lexer has been defined to track line and column information,
But none of the Token Types can be identified as matching a line terminator.
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS
for details.`,type:K.NO_LINE_BREAKS_FLAGS}),r}o(dy,`performWarningRuntimeChecks`);function fy(e){let t={};return z(eu(e),n=>{let r=e[n];if(I(r))t[n]=[];else throw Error(`non exhaustive match`)}),t}o(fy,`cloneEmptyGroups`);function py(e){let t=e.PATTERN;if(S_(t))return!1;if(Ss(t)||V(t,`exec`))return!0;if(i_(t))return!1;throw Error(`non exhaustive match`)}o(py,`isCustomPattern`);function my(e){return i_(e)&&e.length===1?e.charCodeAt(0):!1}o(my,`isShortPattern`);var hy={test:o(function(e){let t=e.length;for(let n=this.lastIndex;n<t;n++){let t=e.charCodeAt(n);if(t===10)return this.lastIndex=n+1,!0;if(t===13)return e.charCodeAt(n+1)===10?this.lastIndex=n+2:this.lastIndex=n+1,!0}return!1},`test`),lastIndex:0};function gy(e,t){if(V(e,`LINE_BREAKS`))return!1;if(S_(e.PATTERN)){try{Vv(t,e.PATTERN)}catch(e){return{issue:K.IDENTIFY_TERMINATOR,errMsg:e.message}}return!1}else if(i_(e.PATTERN))return!1;else if(py(e))return{issue:K.CUSTOM_LINE_BREAK};else throw Error(`non exhaustive match`)}o(gy,`checkLineBreaksIssues`);function _y(e,t){if(t.issue===K.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
The problem is in the <${e.name}> Token Type
Root cause: ${t.errMsg}.
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(t.issue===K.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.
The problem is in the <${e.name}> Token Type
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error(`non exhaustive match`)}o(_y,`buildLineBreakIssueMessage`);function vy(e){return B(e,e=>i_(e)?e.charCodeAt(0):e)}o(vy,`getCharCodes`);function yy(e,t,n){e[t]===void 0?e[t]=[n]:e[t].push(n)}o(yy,`addToMapOfArrays`);var by=256,xy=[];function Sy(e){return e<by?e:xy[e]}o(Sy,`charCodeToOptimizedIndex`);function Cy(){if(U(xy)){xy=Array(65536);for(let e=0;e<65536;e++)xy[e]=e>255?255+~~(e/255):e}}o(Cy,`initCharCodeToOptimizedIndexMap`);function wy(e,t){let n=e.tokenTypeIdx;return n===t.tokenTypeIdx||t.isParent===!0&&t.categoryMatchesMap[n]===!0}o(wy,`tokenStructuredMatcher`);function Ty(e,t){return e.tokenTypeIdx===t.tokenTypeIdx}o(Ty,`tokenStructuredMatcherNoCategories`);var Ey=1,Dy={};function Oy(e){let t=ky(e);Ay(t),My(t),jy(t),z(t,e=>{e.isParent=e.categoryMatches.length>0})}o(Oy,`augmentTokenTypes`);function ky(e){let t=Sm(e),n=e,r=!0;for(;r;){n=wm(Ld(B(n,e=>e.CATEGORIES)));let e=vg(n,t);t=t.concat(e),U(e)?r=!1:n=e}return t}o(ky,`expandCategories`);function Ay(e){z(e,e=>{Py(e)||(Dy[Ey]=e,e.tokenTypeIdx=Ey++),Fy(e)&&!I(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),Fy(e)||(e.CATEGORIES=[]),Iy(e)||(e.categoryMatches=[]),Ly(e)||(e.categoryMatchesMap={})})}o(Ay,`assignTokenDefaultProps`);function jy(e){z(e,e=>{e.categoryMatches=[],z(e.categoryMatchesMap,(t,n)=>{e.categoryMatches.push(Dy[n].tokenTypeIdx)})})}o(jy,`assignCategoriesTokensProp`);function My(e){z(e,e=>{Ny([],e)})}o(My,`assignCategoriesMapProp`);function Ny(e,t){z(e,e=>{t.categoryMatchesMap[e.tokenTypeIdx]=!0}),z(t.CATEGORIES,n=>{let r=e.concat(t);u_(r,n)||Ny(r,n)})}o(Ny,`singleAssignCategoriesToksMap`);function Py(e){return V(e,`tokenTypeIdx`)}o(Py,`hasShortKeyProperty`);function Fy(e){return V(e,`CATEGORIES`)}o(Fy,`hasCategoriesProperty`);function Iy(e){return V(e,`categoryMatches`)}o(Iy,`hasExtendingTokensTypesProperty`);function Ly(e){return V(e,`categoryMatchesMap`)}o(Ly,`hasExtendingTokensTypesMapProperty`);function Ry(e){return V(e,`tokenTypeIdx`)}o(Ry,`isTokenType`);var zy={buildUnableToPopLexerModeMessage(e){return`Unable to pop Lexer Mode after encountering Token ->${e.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage(e,t,n,r,i,a){return`unexpected character: ->${e.charAt(t)}<- at offset: ${t}, skipped ${n} characters.`}},K;(function(e){e[e.MISSING_PATTERN=0]=`MISSING_PATTERN`,e[e.INVALID_PATTERN=1]=`INVALID_PATTERN`,e[e.EOI_ANCHOR_FOUND=2]=`EOI_ANCHOR_FOUND`,e[e.UNSUPPORTED_FLAGS_FOUND=3]=`UNSUPPORTED_FLAGS_FOUND`,e[e.DUPLICATE_PATTERNS_FOUND=4]=`DUPLICATE_PATTERNS_FOUND`,e[e.INVALID_GROUP_TYPE_FOUND=5]=`INVALID_GROUP_TYPE_FOUND`,e[e.PUSH_MODE_DOES_NOT_EXIST=6]=`PUSH_MODE_DOES_NOT_EXIST`,e[e.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]=`MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE`,e[e.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]=`MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY`,e[e.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]=`MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST`,e[e.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]=`LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED`,e[e.SOI_ANCHOR_FOUND=11]=`SOI_ANCHOR_FOUND`,e[e.EMPTY_MATCH_PATTERN=12]=`EMPTY_MATCH_PATTERN`,e[e.NO_LINE_BREAKS_FLAGS=13]=`NO_LINE_BREAKS_FLAGS`,e[e.UNREACHABLE_PATTERN=14]=`UNREACHABLE_PATTERN`,e[e.IDENTIFY_TERMINATOR=15]=`IDENTIFY_TERMINATOR`,e[e.CUSTOM_LINE_BREAK=16]=`CUSTOM_LINE_BREAK`,e[e.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]=`MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE`})(K||={});var By={deferDefinitionErrorsHandling:!1,positionTracking:`full`,lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
`,`\r`],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:zy,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(By);var Vy=class{static{o(this,`Lexer`)}constructor(e,t=By){if(this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=(e,t)=>{if(this.traceInitPerf===!0){this.traceInitIndent++;let n=Array(this.traceInitIndent+1).join(` `);this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${n}--> <${e}>`);let{time:r,value:i}=Q_(t),a=r>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&a(`${n}<-- <${e}> time: ${r}ms`),this.traceInitIndent--,i}else return t()},typeof t==`boolean`)throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
a boolean 2nd argument is no longer supported`);this.config=nu({},By,t);let n=this.config.traceInitPerf;n===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof n==`number`&&(this.traceInitMaxIdent=n,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT(`Lexer Constructor`,()=>{let n,r=!0;this.TRACE_INIT(`Lexer Config handling`,()=>{if(this.config.lineTerminatorsPattern===By.lineTerminatorsPattern)this.config.lineTerminatorsPattern=hy;else if(this.config.lineTerminatorCharacters===By.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(t.safeMode&&t.ensureOptimizations)throw Error(`"safeMode" and "ensureOptimizations" flags are mutually exclusive.`);this.trackStartLines=/full|onlyStart/i.test(this.config.positionTracking),this.trackEndLines=/full/i.test(this.config.positionTracking),I(e)?n={modes:{defaultMode:Sm(e)},defaultMode:Uv}:(r=!1,n=Sm(e))}),this.config.skipValidations===!1&&(this.TRACE_INIT(`performRuntimeChecks`,()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(uy(n,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT(`performWarningRuntimeChecks`,()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(dy(n,this.trackStartLines,this.config.lineTerminatorCharacters))})),n.modes=n.modes?n.modes:{},z(n.modes,(e,t)=>{n.modes[t]=z_(e,e=>w_(e))});let i=eu(n.modes);if(z(n.modes,(e,n)=>{this.TRACE_INIT(`Mode: <${n}> processing`,()=>{if(this.modes.push(n),this.config.skipValidations===!1&&this.TRACE_INIT(`validatePatterns`,()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(Kv(e,i))}),U(this.lexerDefinitionErrors)){Oy(e);let r;this.TRACE_INIT(`analyzeTokenTypes`,()=>{r=Gv(e,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:t.positionTracking,ensureOptimizations:t.ensureOptimizations,safeMode:t.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[n]=r.patternIdxToConfig,this.charCodeToPatternIdxToConfig[n]=r.charCodeToPatternIdxToConfig,this.emptyGroups=nu({},this.emptyGroups,r.emptyGroups),this.hasCustom=r.hasCustom||this.hasCustom,this.canModeBeOptimized[n]=r.canBeOptimized}})}),this.defaultMode=n.defaultMode,!U(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){let e=B(this.lexerDefinitionErrors,e=>e.message).join(`-----------------------
`);throw Error(`Errors detected in definition of Lexer:
`+e)}z(this.lexerDefinitionWarning,e=>{Z_(e.message)}),this.TRACE_INIT(`Choosing sub-methods implementations`,()=>{if(r&&(this.handleModes=Ys),this.trackStartLines===!1&&(this.computeNewColumn=gs),this.trackEndLines===!1&&(this.updateTokenEndLineColumnLocation=Ys),/full/i.test(this.config.positionTracking))this.createTokenInstance=this.createFullToken;else if(/onlyStart/i.test(this.config.positionTracking))this.createTokenInstance=this.createStartOnlyToken;else if(/onlyOffset/i.test(this.config.positionTracking))this.createTokenInstance=this.createOffsetOnlyToken;else throw Error(`Invalid <positionTracking> config option: "${this.config.positionTracking}"`);this.hasCustom?(this.addToken=this.addTokenUsingPush,this.handlePayload=this.handlePayloadWithCustom):(this.addToken=this.addTokenUsingMemberAccess,this.handlePayload=this.handlePayloadNoCustom)}),this.TRACE_INIT(`Failed Optimization Warnings`,()=>{let e=L_(this.canModeBeOptimized,(e,t,n)=>(t===!1&&e.push(n),e),[]);if(t.ensureOptimizations&&!U(e))throw Error(`Lexer Modes: < ${e.join(`, `)} > cannot be optimized.
Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT(`clearRegExpParserCache`,()=>{jv()}),this.TRACE_INIT(`toFastProperties`,()=>{$_(this)})})}tokenize(e,t=this.defaultMode){if(!U(this.lexerDefinitionErrors)){let e=B(this.lexerDefinitionErrors,e=>e.message).join(`-----------------------
`);throw Error(`Unable to Tokenize because Errors detected in definition of Lexer:
`+e)}return this.tokenizeInternal(e,t)}tokenizeInternal(e,t){let n,r,i,a,s,c,l,u,d,f,p,m,h,g,_,v=e,y=v.length,b=0,x=0,ee=this.hasCustom?0:Math.floor(e.length/10),S=Array(ee),te=[],ne=this.trackStartLines?1:void 0,C=this.trackStartLines?1:void 0,re=fy(this.emptyGroups),ie=this.trackStartLines,ae=this.config.lineTerminatorsPattern,oe=0,se=[],ce=[],le=[],ue=[];Object.freeze(ue);let de=!1,w=o(e=>{if(le.length===1&&e.tokenType.PUSH_MODE===void 0){let t=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(e);te.push({offset:e.startOffset,line:e.startLine,column:e.startColumn,length:e.image.length,message:t})}else{le.pop();let e=bg(le);se=this.patternIdxToConfig[e],ce=this.charCodeToPatternIdxToConfig[e],oe=se.length;let t=this.canModeBeOptimized[e]&&this.config.safeMode===!1;de=!!(ce&&t)}},`pop_mode`);function T(e){le.push(e),ce=this.charCodeToPatternIdxToConfig[e],se=this.patternIdxToConfig[e],oe=se.length,oe=se.length;let t=this.canModeBeOptimized[e]&&this.config.safeMode===!1;de=!!(ce&&t)}o(T,`push_mode`),T.call(this,t);let E,D=this.config.recoveryEnabled;for(;b<y;){c=null,d=-1;let t=v.charCodeAt(b),o;if(de){let e=Sy(t),n=ce[e];o=n===void 0?ue:n}else o=se;let ee=o.length;for(n=0;n<ee;n++){E=o[n];let r=E.pattern;l=null;let f=E.short;if(f===!1?E.isCustom===!0?(_=r.exec(v,b,S,re),_===null?c=null:(c=_[0],d=c.length,_.payload!==void 0&&(l=_.payload))):(r.lastIndex=b,d=this.matchLength(r,e,b)):t===f&&(d=1,c=r),d!==-1){if(s=E.longerAlt,s!==void 0){c=e.substring(b,b+d);let t=s.length;for(i=0;i<t;i++){let t=se[s[i]],n=t.pattern;if(u=null,t.isCustom===!0?(_=n.exec(v,b,S,re),_===null?a=null:(a=_[0],_.payload!==void 0&&(u=_.payload))):(n.lastIndex=b,a=this.match(n,e,b)),a&&a.length>c.length){c=a,d=a.length,l=u,E=t;break}}}break}}if(d!==-1){if(f=E.group,f!==void 0&&(c=c===null?e.substring(b,b+d):c,p=E.tokenTypeIdx,m=this.createTokenInstance(c,b,p,E.tokenType,ne,C,d),this.handlePayload(m,l),f===!1?x=this.addToken(S,x,m):re[f].push(m)),ie===!0&&E.canLineTerminator===!0){let t=0,n,r;ae.lastIndex=0;do c=c===null?e.substring(b,b+d):c,n=ae.test(c),n===!0&&(r=ae.lastIndex-1,t++);while(n===!0);t===0?C=this.computeNewColumn(C,d):(ne+=t,C=d-r,this.updateTokenEndLineColumnLocation(m,f,r,t,ne,C,d))}else C=this.computeNewColumn(C,d);b+=d,this.handleModes(E,w,T,m)}else{let t=b,n=ne,i=C,a=D===!1;for(;a===!1&&b<y;)for(b++,r=0;r<oe;r++){let t=se[r],n=t.pattern,i=t.short;if(i===!1?t.isCustom===!0?a=n.exec(v,b,S,re)!==null:(n.lastIndex=b,a=n.exec(e)!==null):v.charCodeAt(b)===i&&(a=!0),a===!0)break}if(h=b-t,C=this.computeNewColumn(C,h),g=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(v,t,h,n,i,bg(le)),te.push({offset:t,line:n,column:i,length:h,message:g}),D===!1)break}}return this.hasCustom||(S.length=x),{tokens:S,groups:re,errors:te}}handleModes(e,t,n,r){if(e.pop===!0){let i=e.push;t(r),i!==void 0&&n.call(this,i)}else e.push!==void 0&&n.call(this,e.push)}updateTokenEndLineColumnLocation(e,t,n,r,i,a,o){let s,c;t!==void 0&&(s=n===o-1,c=s?-1:0,r===1&&s===!0||(e.endLine=i+c,e.endColumn=a-1+-c))}computeNewColumn(e,t){return e+t}createOffsetOnlyToken(e,t,n,r){return{image:e,startOffset:t,tokenTypeIdx:n,tokenType:r}}createStartOnlyToken(e,t,n,r,i,a){return{image:e,startOffset:t,startLine:i,startColumn:a,tokenTypeIdx:n,tokenType:r}}createFullToken(e,t,n,r,i,a,o){return{image:e,startOffset:t,endOffset:t+o-1,startLine:i,endLine:i,startColumn:a,endColumn:a+o-1,tokenTypeIdx:n,tokenType:r}}addTokenUsingPush(e,t,n){return e.push(n),t}addTokenUsingMemberAccess(e,t,n){return e[t]=n,t++,t}handlePayloadNoCustom(e,t){}handlePayloadWithCustom(e,t){t!==null&&(e.payload=t)}match(e,t,n){return e.test(t)===!0?t.substring(n,e.lastIndex):null}matchLength(e,t,n){return e.test(t)===!0?e.lastIndex-n:-1}};Vy.SKIPPED=`This marks a skipped Token pattern, this means each token identified by it will be consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.`,Vy.NA=/NOT_APPLICABLE/;function Hy(e){return Uy(e)?e.LABEL:e.name}o(Hy,`tokenLabel`);function Uy(e){return i_(e.LABEL)&&e.LABEL!==``}o(Uy,`hasTokenLabel
See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return V(e,Gy)&&(n.CATEGORIES=e[Gy]),Oy([n]),V(e,Ky)&&(n.LABEL=e[Ky]),V(e,qy)&&(n.GROUP=e[qy]),V(e,Yy)&&(n.POP_MODE=e[Yy]),V(e,Jy)&&(n.PUSH_MODE=e[Jy]),V(e,Xy)&&(n.LONGER_ALT=e[Xy]),V(e,Zy)&&(n.LINE_BREAKS=e[Zy]),V(e,Qy)&&(n.START_CHARS_HINT=e[Qy]),n}o(eb,`createTokenInternal`);var tb=$y({name:`EOF`,pattern:Vy.NA});Oy([tb]);function nb(e,t,n,r,i,a,o,s){return{image:t,startOffset:n,endOffset:r,startLine:i,endLine:a,startColumn:o,endColumn:s,tokenTypeIdx:e.tokenTypeIdx,tokenType:e}}o(nb,`createTokenInstance`);function rb(e,t){return wy(e,t)}o(rb,`tokenMatcher`);var ib={buildMismatchTokenMessage({expected:e,actual:t,previous:n,ruleName:r}){return`Expecting ${Uy(e)?`--> ${Hy(e)} <--`:`token of type --> ${e.name} <--`} but found --> '${t.image}' <--`},buildNotAllInputParsedMessage({firstRedundant:e,ruleName:t}){return`Redundant input, expecting EOF but found: `+e.image},buildNoViableAltMessage({expectedPathsPerAlt:e,actual:t,previous:n,customUserDescription:r,ruleName:i}){let a=`
but found: '`+Wg(t).image+`'`;return r?`Expecting: `+r+a:`Expecting: one of these possible Token sequences:
${B(B(L_(e,(e,t)=>e.concat(t),[]),e=>`[${B(e,e=>Hy(e)).join(`, `)}]`),(e,t)=>` ${t+1}. ${e}`).join(`
`)}`+a},buildEarlyExitMessage({expectedIterationPaths:e,actual:t,customUserDescription:n,ruleName:r}){let i=`
but found: '`+Wg(t).image+`'`;return n?`Expecting: `+n+i:`Expecting: expecting at least one iteration which starts with one of these possible Token sequences::
<${B(e,e=>`[${B(e,e=>Hy(e)).join(`,`)}]`).join(` ,`)}>`+i}};Object.freeze(ib);var ab={buildRuleNotFoundError(e,t){return`Invalid grammar, reference to a rule which is not defined: ->`+t.nonTerminalName+`<-
inside top level rule: ->`+e.name+`<-`}},ob={buildDuplicateFoundError(e,t){function n(e){return e instanceof G?e.terminalType.name:e instanceof rv?e.nonTerminalName:``}o(n,`getExtraProductionArgument`);let r=e.name,i=Wg(t),a=i.idx,s=_v(i),c=n(i),l=`->${s}${a>0?a:``}<- ${c?`with argument: ->${c}<-`:``}
appears more than once (${t.length} times) in the top level rule: ->${r}<-.
For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES
`;return l=l.replace(/[ \t]+/g,` `),l=l.replace(/\s\s+/g,`
`),l},buildNamespaceConflictError(e){return`Namespace conflict found in grammar.
The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${e.name}>.
To resolve this make sure each Terminal and Non-Terminal names are unique
This is easy to accomplish by using the convention that Terminal names start with an uppercase letter
and Non-Terminal names start with a lower case letter.`},buildAlternationPrefixAmbiguityError(e){let t=B(e.prefixPath,e=>Hy(e)).join(`, `),n=e.alternation.idx===0?``:e.alternation.idx;return`Ambiguous alternatives: <${e.ambiguityIndices.join(` ,`)}> due to common lookahead prefix
in <OR${n}> inside <${e.topLevelRule.name}> Rule,
<${t}> may appears as a prefix path in all these alternatives.
See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX
For Further details.`},buildAlternationAmbiguityError(e){let t=e.alternation.idx===0?``:e.alternation.idx,n=e.prefixPath.length===0,r=`Ambiguous Alternatives Detected: <${e.ambiguityIndices.join(` ,`)}> in <OR${t}> inside <${e.topLevelRule.name}> Rule,
`;if(n)r+=`These alternatives are all empty (match no tokens), making them indistinguishable.
Only the last alternative may be empty.
`;else{let t=B(e.prefixPath,e=>Hy(e)).join(`, `);r+=`<${t}> may appears as a prefix path in all these alternatives.
`}return r+=`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
For Further details.`,r},buildEmptyRepetitionError(e){let t=_v(e.repetition);return e.repetition.idx!==0&&(t+=e.repetition.idx),`The repetition <${t}> within Rule <${e.topLevelRule.name}> can never consume any tokens.
This could lead to an infinite loop.`},buildTokenNameError(e){return`deprecated`},buildEmptyAlternationError(e){return`Ambiguous empty alternative: <${e.emptyChoiceIdx+1}> in <OR${e.alternation.idx}> inside <${e.topLevelRule.name}> Rule.
Only the last alternative may be an empty alternative.`},buildTooManyAlternativesError(e){return`An Alternation cannot have more than 256 alternatives:
<OR${e.alternation.idx}> inside <${e.topLevelRule.name}> Rule.
has ${e.alternation.definition.length+1} alternatives.`},buildLeftRecursionError(e){let t=e.topLevelRule.name;return`Left Recursion found in grammar.
rule: <${t}> can be invoked from itself (directly or indirectly)
without consuming any Tokens. The grammar path that causes this is:
${`${t} --> ${B(e.leftRecursionPath,e=>e.name).concat([t]).join(` --> `)}`}
To fix this refactor your grammar to remove the left recursion.
see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(e){return`deprecated`},buildDuplicateRuleNameError(e){let t;return t=e.topLevelRule instanceof iv?e.topLevelRule.name:e.topLevelRule,`Duplicate definition, rule: ->${t}<- is already defined in the grammar: ->${e.grammarName}<-`}};function sb(e,t){let n=new cb(e,t);return n.resolveRefs(),n.errors}o(sb,`resolveGrammar`);var cb=class extends pv{static{o(this,`GastRefResolverVisitor`)}constructor(e,t){super(),this.nameToTopRule=e,this.errMsgProvider=t,this.errors=[]}resolveRefs(){z(H(this.nameToTopRule),e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){let t=this.nameToTopRule[e.nonTerminalName];if(t)e.referencedRule=t;else{let t=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:t,type:pS.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}},lb=class extends vv{static{o(this,`AbstractNextPossibleTokensWalker`)}constructor(e,t){super(),this.topProd=e,this.path=t,this.possibleTokTypes=[],this.nextProductionName=``,this.nextProductionOccurrence=0,this.found=!1,this.isAtEndOfPath=!1}startWalking(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error(`The path does not start with the walker's top Rule!`);return this.ruleStack=Sm(this.path.ruleStack).reverse(),this.occurrenceStack=Sm(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,t=[]){this.found||super.walk(e,t)}walkProdRef(e,t,n){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){let r=t.concat(n);this.updateExpectedNext(),this.walk(e.referencedRule,r)}}updateExpectedNext(){U(this.ruleStack)?(this.nextProductionName=``,this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}},ub=class extends lb{static{o(this,`NextAfterTokenWalker`)}constructor(e,t){super(e,t),this.path=t,this.nextTerminalName=``,this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,t,n){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){let e=new av({definition:t.concat(n)});this.possibleTokTypes=bv(e),this.found=!0}}},db=class extends vv{static{o(this,`AbstractNextTerminalAfterProductionWalker`)}constructor(e,t){super(),this.topRule=e,this.occurrence=t,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}},fb=class extends db{static{o(this,`NextTerminalAfterManyWalker`)}walkMany(e,t,n){if(e.idx===this.occurrence){let e=Wg(t.concat(n));this.result.isEndOfRule=e===void 0,e instanceof G&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkMany(e,t,n)}},pb=class extends db{static{o(this,`NextTerminalAfterManySepWalker`)}walkManySep(e,t,n){if(e.idx===this.occurrence){let e=Wg(t.concat(n));this.result.isEndOfRule=e===void 0,e instanceof G&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkManySep(e,t,n)}},mb=class extends db{static{o(this,`NextTerminalAfterAtLeastOneWalker`)}walkAtLeastOne(e,t,n){if(e.idx===this.occurrence){let e=Wg(t.concat(n));this.result.isEndOfRule=e===void 0,e instanceof G&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkAtLeastOne(e,t,n)}},hb=class extends db{static{o(this,`NextTerminalAfterAtLeastOneSepWalker`)}walkAtLeastOneSep(e,t,n){if(e.idx===this.occurrence){let e=Wg(t.concat(n));this.result.isEndOfRule=e===void 0,e instanceof G&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkAtLeastOneSep(e,t,n)}};function gb(e,t,n=[]){n=Sm(n);let r=[],i=0;function a(t){return t.concat(Sg(e,i+1))}o(a,`remainingPathWith`);function s(e){let i=gb(a(e),t,n);return r.concat(i)}for(o(s,`getAlternativesForProd`);n.le
${t.join(`
`).replace(/\n/g,`
`)}`)}},`validateVisitor`)},n.prototype.constructor=n,n._RULE_NAMES=t,n}o(Bx,`createBaseSemanticVisitorConstructor`);function Vx(e,t,n){let r=o(function(){},`derivedConstructor`);Rx(r,e+`BaseSemanticsWithDefaults`);let i=Object.create(n.prototype);return z(t,e=>{i[e]=zx}),r.prototype=i,r.prototype.constructor=r,r}o(Vx,`createBaseVisitorConstructorWithDefaults`);var Hx;(function(e){e[e.REDUNDANT_METHOD=0]=`REDUNDANT_METHOD`,e[e.MISSING_METHOD=1]=`MISSING_METHOD`})(Hx||={});function Ux(e,t){return Wx(e,t)}o(Ux,`validateVisitor`);function Wx(e,t){return wm(B(Lg(t,t=>Ss(e[t])===!1),t=>({msg:`Missing visitor method: <${t}> on ${e.constructor.name} CST Visitor.`,type:Hx.MISSING_METHOD,methodName:t})))}o(Wx,`validateMissingCstMethods`);var Gx=class{static{o(this,`TreeBuilder`)}initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=V(e,`nodeLocationTracking`)?e.nodeLocationTracking:dS.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=Ys,this.cstFinallyStateUpdate=Ys,this.cstPostTerminal=Ys,this.cstPostNonTerminal=Ys,this.cstPostRule=Ys;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=Px,this.setNodeLocationFromNode=Px,this.cstPostRule=Ys,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=Ys,this.setNodeLocationFromNode=Ys,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=Nx,this.setNodeLocationFromNode=Nx,this.cstPostRule=Ys,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=Ys,this.setNodeLocationFromNode=Ys,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=Ys,this.setNodeLocationFromNode=Ys,this.cstPostRule=Ys,this.setInitialNodeLocation=Ys;else throw Error(`Invalid <nodeLocationTracking> config option: "${e.nodeLocationTracking}"`)}setInitialNodeLocationOnlyOffsetRecovery(e){e.location={startOffset:NaN,endOffset:NaN}}setInitialNodeLocationOnlyOffsetRegular(e){e.location={startOffset:this.LA(1).startOffset,endOffset:NaN}}setInitialNodeLocationFullRecovery(e){e.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}}setInitialNodeLocationFullRegular(e){let t=this.LA(1);e.location={startOffset:t.startOffset,startLine:t.startLine,startColumn:t.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}}cstInvocationStateUpdate(e){let t={name:e,children:Object.create(null)};this.setInitialNodeLocation(t),this.CST_STACK.push(t)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){let t=this.LA(0),n=e.location;n.startOffset<=t.startOffset?(n.endOffset=t.endOffset,n.endLine=t.endLine,n.endColumn=t.endColumn):(n.startOffset=NaN,n.startLine=NaN,n.startColumn=NaN)}cstPostRuleOnlyOffset(e){let t=this.LA(0),n=e.location;n.startOffset<=t.startOffset?n.endOffset=t.endOffset:n.startOffset=NaN}cstPostTerminal(e,t){let n=this.CST_STACK[this.CST_STACK.length-1];Fx(n,t,e),this.setNodeLocationFromToken(n.location,t)}cstPostNonTerminal(e,t){let n=this.CST_STACK[this.CST_STACK.length-1];Ix(n,t,e),this.setNodeLocationFromNode(n.location,e.location)}getBaseCstVisitorConstructor(){if(w_(this.baseCstVisitorConstructor)){let e=Bx(this.className,eu(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(w_(this.baseCstVisitorWithDefaultsConstructor)){let e=Vx(this.className,eu(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor}getLastExplicitRuleShortName(){let e=this.RULE_STACK;return e[e.length-1]}getPreviousExplicitRuleShortName(){let e=this.RULE_STACK;return e[e.length-2]}getLastExplic
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
For Further details.`);if(I(e)){if(U(e))throw Error(`A Token Vocabulary cannot be empty.
Note that the first argument for the parser constructor
is no longer a Token vector (since v4.0).`);if(typeof e[0].startOffset==`number`)throw Error(`The Parser constructor no longer accepts a token vector as the first argument.
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
For Further details.`)}if(I(e))this.tokensMap=L_(e,(e,t)=>(e[t.name]=t,e),{});else if(V(e,`modes`)&&Ng(Ld(H(e.modes)),Ry)){let t=Y_(Ld(H(e.modes)));this.tokensMap=L_(t,(e,t)=>(e[t.name]=t,e),{})}else if(ts(e))this.tokensMap=Sm(e);else throw Error(`<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition`);this.tokensMap.EOF=tb;let n=Ng(V(e,`modes`)?Ld(H(e.modes)):H(e),e=>U(e.categoryMatches));this.tokenMatcher=n?Ty:wy,Oy(H(this.tokensMap))}defineRule(e,t,n){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called'
Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);let r=V(n,`resyncEnabled`)?n.resyncEnabled:fS.resyncEnabled,i=V(n,`recoveryValueFunc`)?n.recoveryValueFunc:fS.recoveryValueFunc,a=this.ruleShortNameIdx<<yx+bx;this.ruleShortNameIdx++,this.shortRuleNameToFull[a]=e,this.fullRuleNameToShort[e]=a;let s;return s=this.outputCst===!0?o(function(...n){try{this.ruleInvocationStateUpdate(a,e,this.subruleIdx),t.apply(this,n);let r=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(r),r}catch(e){return this.invokeRuleCatch(e,r,i)}finally{this.ruleFinallyStateUpdate()}},`invokeRuleWithTry`):o(function(...n){try{return this.ruleInvocationStateUpdate(a,e,this.subruleIdx),t.apply(this,n)}catch(e){return this.invokeRuleCatch(e,r,i)}finally{this.ruleFinallyStateUpdate()}},`invokeRuleWithTryCst`),Object.assign(s,{ruleName:e,originalGrammarAction:t})}invokeRuleCatch(e,t,n){let r=this.RULE_STACK.length===1,i=t&&!this.isBackTracking()&&this.recoveryEnabled;if(cx(e)){let t=e;if(i){let r=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(r))if(t.resyncedTokens=this.reSyncTo(r),this.outputCst){let e=this.CST_STACK[this.CST_STACK.length-1];return e.recoveredNode=!0,e}else return n(e);else{if(this.outputCst){let e=this.CST_STACK[this.CST_STACK.length-1];e.recoveredNode=!0,t.partialCstResult=e}throw t}}else if(r)return this.moveToTerminatedState(),n(e);else throw t}else throw e}optionInternal(e,t){let n=this.getKeyForAutomaticLookahead(Cx,t);return this.optionInternalLogic(e,t,n)}optionInternalLogic(e,t,n){let r=this.getLaFuncFromCache(n),i;if(typeof e!=`function`){i=e.DEF;let t=e.GATE;if(t!==void 0){let e=r;r=o(()=>t.call(this)&&e.call(this),`lookAheadFunc`)}}else i=e;if(r.call(this)===!0)return i.call(this)}atLeastOneInternal(e,t){let n=this.getKeyForAutomaticLookahead(Tx,e);return this.atLeastOneInternalLogic(e,t,n)}atLeastOneInternalLogic(e,t,n){let r=this.getLaFuncFromCache(n),i;if(typeof t!=`function`){i=t.DEF;let e=t.GATE;if(e!==void 0){let t=r;r=o(()=>e.call(this)&&t.call(this),`lookAheadFunc`)}}else i=t;if(r.call(this)===!0){let e=this.doSingleRepetition(i);for(;r.call(this)===!0&&e===!0;)e=this.doSingleRepetition(i)}else throw this.raiseEarlyExitException(e,q.REPETITION_MANDATORY,t.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,t],r,Tx,e,mb)}atLeastOneSepFirstInternal(e,t){let n=this.getKeyForAutomaticLookahead(Dx,e);this.atLeastOneSepFirstInternalLogic(e,t,n)}atLeastOneSepFirstInternalLogic(e,t,n){let r=t.DEF,i=t.SEP;if(this.getLaFuncFromCache(n).call(this)===!0){r.call(this);let t=o(()=>this.tokenMatcher(this.LA(1),i),`separatorLookAheadFunc`);for(;this.tokenMatcher(this.LA(1),i)===!0;)this.CONSUME(i),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,t,r,hb],t,Dx,e,hb)}else throw this.raiseEarlyExitException(e,q.REPETITION_MANDATORY_WITH_SEPARATOR,t.ERR_MSG)}manyInternal(e,t){let n=this.getKeyForAutomaticLookahead(wx,e);return this.manyInternalLogic(e,t,n)}manyInternalLogic(e,t,n){let r=this.getLaFuncFromCache(n),i;if(typeof t!=`function`){i=t.DEF;let e=t.GATE;if(e!==void 0){let t=r;r=o(()=>e.call(this)&&t.call(this),`lookaheadFunction`)}}else i=t;let a=!0;for(;r.call(this)===!0&&a===!0;)a=this.doSingleRepetition(i);this.attemptInRepetitionRecovery(this.manyInternal,[e,t],r,wx,e,fb,a)}manySepFirstInternal(e,t){let n=this.getKeyForAutomaticLookahead(Ex,e);this.manySepFirstInternalLogic(e,t,n)}manySepFirstInternalLogic(e,t,n){let r=t.DEF,i=t.SEP;if(this.getLaFuncFromCache(n).call(this)===!0){r.call(this);let t=o(()=>this.tokenMatcher(this.LA(1),i),`separatorLookAheadFunc`);for(;this.tokenMatcher(this.LA(1),i)===!0;)this.CONSUME(i),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,t,r,pb],t,Ex,e,pb)}}repetitionSepSecondInternal(e,t,n,r,i){for(;n();)this.CONSUME(t),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,t,n,r,i],n,Dx,e,i)}doSingleRepetition(e){let t=this.getLexerPosition();return e.call(this),this.getLexerPosition()>t}orInternal(e,t){let n=this
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(tS);var nS={name:`This CSTNode indicates the Parser is in Recording Phase
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}},rS=class{static{o(this,`GastRecorder`)}initGastRecorder(e){this.recordingProdStack=[],this.RECORDING_PHASE=!1}enableRecording(){this.RECORDING_PHASE=!0,this.TRACE_INIT(`Enable Recording`,()=>{for(let e=0;e<10;e++){let t=e>0?e:``;this[`CONSUME${t}`]=function(t,n){return this.consumeInternalRecord(t,e,n)},this[`SUBRULE${t}`]=function(t,n){return this.subruleInternalRecord(t,e,n)},this[`OPTION${t}`]=function(t){return this.optionInternalRecord(t,e)},this[`OR${t}`]=function(t){return this.orInternalRecord(t,e)},this[`MANY${t}`]=function(t){this.manyInternalRecord(e,t)},this[`MANY_SEP${t}`]=function(t){this.manySepFirstInternalRecord(e,t)},this[`AT_LEAST_ONE${t}`]=function(t){this.atLeastOneInternalRecord(e,t)},this[`AT_LEAST_ONE_SEP${t}`]=function(t){this.atLeastOneSepFirstInternalRecord(e,t)}}this.consume=function(e,t,n){return this.consumeInternalRecord(t,e,n)},this.subrule=function(e,t,n){return this.subruleInternalRecord(t,e,n)},this.option=function(e,t){return this.optionInternalRecord(t,e)},this.or=function(e,t){return this.orInternalRecord(t,e)},this.many=function(e,t){this.manyInternalRecord(e,t)},this.atLeastOne=function(e,t){this.atLeastOneInternalRecord(e,t)},this.ACTION=this.ACTION_RECORD,this.BACKTRACK=this.BACKTRACK_RECORD,this.LA=this.LA_RECORD})}disableRecording(){this.RECORDING_PHASE=!1,this.TRACE_INIT(`Deleting Recording methods`,()=>{let e=this;for(let t=0;t<10;t++){let n=t>0?t:``;delete e[`CONSUME${n}`],delete e[`SUBRULE${n}`],delete e[`OPTION${n}`],delete e[`OR${n}`],delete e[`MANY${n}`],delete e[`MANY_SEP${n}`],delete e[`AT_LEAST_ONE${n}`],delete e[`AT_LEAST_ONE_SEP${n}`]}delete e.consume,delete e.subrule,delete e.option,delete e.or,delete e.many,delete e.atLeastOne,delete e.ACTION,delete e.BACKTRACK,delete e.LA})}ACTION_RECORD(e){}BACKTRACK_RECORD(e,t){return()=>!0}LA_RECORD(e){return uS}topLevelRuleRecord(e,t){try{let n=new iv({definition:[],name:e});return n.name=e,this.recordingProdStack.push(n),t.call(this),this.recordingProdStack.pop(),n}catch(e){if(e.KNOWN_RECORDER_ERROR!==!0)try{e.message+=`
This error was thrown during the "grammar recording phase" For more info see:
https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw e}throw e}}optionInternalRecord(e,t){return iS.call(this,ov,e,t)}atLeastOneInternalRecord(e,t){iS.call(this,sv,t,e)}atLeastOneSepFirstInternalRecord(e,t){iS.call(this,cv,t,e,Qx)}manyInternalRecord(e,t){iS.call(this,W,t,e)}manySepFirstInternalRecord(e,t){iS.call(this,lv,t,e,Qx)}orInternalRecord(e,t){return aS.call(this,e,t)}subruleInternalRecord(e,t,n){if(sS(t),!e||V(e,`ruleName`)===!1){let n=Error(`<SUBRULE${oS(t)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>
inside top level rule: <${this.recordingProdStack[0].name}>`);throw n.KNOWN_RECORDER_ERROR=!0,n}let r=bg(this.recordingProdStack),i=e.ruleName,a=new rv({idx:t,nonTerminalName:i,label:n?.LABEL,referencedRule:void 0});return r.definition.push(a),this.outputCst?nS:Zx}consumeInternalRecord(e,t,n){if(sS(t),!Py(e)){let n=Error(`<CONSUME${oS(t)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>
inside top level rule: <${this.recordingProdStack[0].name}>`);throw n.KNOWN_RECORDER_ERROR=!0,n}let r=bg(this.recordingProdStack),i=new G({idx:t,terminalType:e,label:n?.LABEL});return r.definition.push(i),tS}};function iS(e,t,n,r=!1){sS(n);let i=bg(this.recordingProdStack),a=Ss(t)?t:t.DEF,o=new e({definition:[],idx:n});return r&&(o.separator=t.SEP),V(t,`MAX_LOOKAHEAD`)&&(o.maxLookahead=t.MAX_LOOKAHEAD),this.recordingProdStack.push(o),a.call(this),i.definition.push(o),this.recordingProdStack.pop(),Zx}o(iS,`recordProd`);function aS(e,t){sS(t);let n=bg(this.recordingProdStack),r=I(e)===!1,i=r===!1?e:e.DEF,a=new uv({definition:[],idx:t,ignoreAmbiguities:r&&e.IGNORE_AMBIGUITIES===!0});return V(e,`MAX_LOOKAHEAD`)&&(a.maxLookahead=e.MAX_LOOKAHEAD),a.hasPredicates=U_(i,e=>Ss(e.GATE)),n.definition.push(a),z(i,e=>{let t=new av({definition:[]});a.definition.push(t),V(e,`IGNORE_AMBIGUITIES`)?t.ignoreAmbiguities=e.IGNORE_AMBIGUITIES:V(e,`GATE`)&&(t.ignoreAmbiguities=!0),this.recordingProdStack.push(t),e.ALT.call(this),this.recordingProdStack.pop()}),Zx}o(aS,`recordOrProd`);function oS(e){return e===0?``:`${e}`}o(oS,`getIdxSuffix`);function sS(e){if(e<0||e>$x){let t=Error(`Invalid DSL Method idx value: <${e}>
Idx value must be a none negative value smaller than ${$x+1}`);throw t.KNOWN_RECORDER_ERROR=!0,t}}o(sS,`assertMethodIdxIsValid`);var cS=class{static{o(this,`PerformanceTracer`)}initPerformanceTracer(e){if(V(e,`traceInitPerf`)){let t=e.traceInitPerf,n=typeof t==`number`;this.traceInitMaxIdent=n?t:1/0,this.traceInitPerf=n?t>0:t}else this.traceInitMaxIdent=0,this.traceInitPerf=dS.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,t){if(this.traceInitPerf===!0){this.traceInitIndent++;let n=Array(this.traceInitIndent+1).join(` `);this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${n}--> <${e}>`);let{time:r,value:i}=Q_(t),a=r>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&a(`${n}<-- <${e}> time: ${r}ms`),this.traceInitIndent--,i}else return t()}};function lS(e,t){t.forEach(t=>{let n=t.prototype;Object.getOwnPropertyNames(n).forEach(r=>{if(r===`constructor`)return;let i=Object.getOwnPropertyDescriptor(n,r);i&&(i.get||i.set)?Object.defineProperty(e.prototype,r,i):e.prototype[r]=t.prototype[r]})})}o(lS,`applyMixins`);var uS=nb(tb,``,NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(uS);var dS=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:ib,nodeLocationTracking:`none`,traceInitPerf:!1,skipValidations:!1}),fS=Object.freeze({recoveryValueFunc:o(()=>void 0,`recoveryValueFunc`),resyncEnabled:!0}),pS;(function(e){e[e.INVALID_RULE_NAME=0]=`INVALID_RULE_NAME`,e[e.DUPLICATE_RULE_NAME=1]=`DUPLICATE_RULE_NAME`,e[e.INVALID_RULE_OVERRIDE=2]=`INVALID_RULE_OVERRIDE`,e[e.DUPLICATE_PRODUCTIONS=3]=`DUPLICATE_PRODUCTIONS`,e[e.UNRESOLVED_SUBRULE_REF=4]=`UNRESOLVED_SUBRULE_REF`,e[e.LEFT_RECURSION=5]=`LEFT_RECURSION`,e[e.NONE_LAST_EMPTY_ALT=6]=`NONE_LAST_EMPTY_ALT`,e[e.AMBIGUOUS_ALTS=7]=`AMBIGUOUS_ALTS`,e[e.CONFLICT_TOKENS_RULES_NAMESPACE=8]=`CONFLICT_TOKENS_RULES_NAMESPACE`,e[e.INVALID_TOKEN_NAME=9]=`INVALID_TOKEN_NAME`,e[e.NO_NON_EMPTY_LOOKAHEAD=10]=`NO_NON_EMPTY_LOOKAHEAD`,e[e.AMBIGUOUS_PREFIX_ALTS=11]=`AMBIGUOUS_PREFIX_ALTS`,e[e.TOO_MANY_ALTS=12]=`TOO_MANY_ALTS`,e[e.CUSTOM_LOOKAHEAD_VALIDATION=13]=`CUSTOM_LOOKAHEAD_VALIDATION`})(pS||={});function mS(e=void 0){return function(){return e}}o(mS,`EMPTY_ALT`);var hS=class e{static{o(this,`Parser`)}static performSelfAnalysis(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")}performSelfAnalysis(){this.TRACE_INIT(`performSelfAnalysis`,()=>{let t;this.selfAnalysisDone=!0;let n=this.className;this.TRACE_INIT(`toFastProps`,()=>{$_(this)}),this.TRACE_INIT(`Grammar Recording`,()=>{try{this.enableRecording(),z(this.definedRulesNames,e=>{let t=this[e].originalGrammarAction,n;this.TRACE_INIT(`${e} Rule`,()=>{n=this.topLevelRuleRecord(e,t)}),this.gastProductionsCache[e]=n})}finally{this.disableRecording()}});let r=[];if(this.TRACE_INIT(`Grammar Resolving`,()=>{r=tx({rules:H(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(r)}),this.TRACE_INIT(`Grammar Validations`,()=>{if(U(r)&&this.skipValidations===!1){let e=nx({rules:H(this.gastProductionsCache),tokenTypes:H(this.tokensMap),errMsgProvider:ob,grammarName:n}),t=Ib({lookaheadStrategy:this.lookaheadStrategy,rules:H(this.gastProductionsCache),tokenTypes:H(this.tokensMap),grammarName:n});this.definitionErrors=this.definitionErrors.concat(e,t)}}),U(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT(`computeAllProdsFollows`,()=>{let e=Ev(H(this.gastProductionsCache));this.resyncFollows=e}),this.TRACE_INIT(`ComputeLookaheadFunctions`,()=>{var e,t;(t=(e=this.lookaheadStrategy).initialize)==null||t.call(e,{rules:H(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(H(this.gastProductionsCache))})),!e.DEFER_DEFINITION_ERRORS_HANDLING&&!U(this.definitionErrors))throw t=B(this.definitionErrors,e=>e.message),Error(`Parser Definition Errors detected:
${t.join(`
-------------------------------
`)}`)})}constructor(e,t){this.definitionErrors=[],this.selfAnalysisDone=!1;let n=this;if(n.initErrorHandler(t),n.initLexerAdapter(),n.initLooksAhead(t),n.initRecognizerEngine(e,t),n.initRecoverable(t),n.initTreeBuilder(t),n.initContentAssist(),n.initGastRecorder(t),n.initPerformanceTracer(t),V(t,`ignoredIssues`))throw Error(`The <ignoredIssues> IParserConfig property has been deprecated.
Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES
For further details.`);this.skipValidations=V(t,`skipValidations`)?t.skipValidations:dS.skipValidations}};hS.DEFER_DEFINITION_ERRORS_HANDLING=!1,lS(hS,[_x,Ax,Gx,Kx,Jx,qx,Yx,Xx,rS,cS]);var gS=class extends hS{static{o(this,`EmbeddedActionsParser`)}constructor(e,t=dS){let n=Sm(t);n.outputCst=!1,super(e,n)}};function _S(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}o(_S,`arrayMap`);var vS=_S;function yS(){this.__data__=[],this.size=0}o(yS,`listCacheClear`);var bS=yS;function xS(e,t){return e===t||e!==e&&t!==t}o(xS,`eq`);var SS=xS;function CS(e,t){for(var n=e.length;n--;)if(SS(e[n][0],t))return n;return-1}o(CS,`assocIndexOf`);var wS=CS,TS=Array.prototype.splice;function ES(e){var t=this.__data__,n=wS(t,e);return n<0?!1:(n==t.length-1?t.pop():TS.call(t,n,1),--this.size,!0)}o(ES,`listCacheDelete`);var DS=ES;function OS(e){var t=this.__data__,n=wS(t,e);return n<0?void 0:t[n][1]}o(OS,`listCacheGet`);var kS=OS;function AS(e){return wS(this.__data__,e)>-1}o(AS,`listCacheHas`);var jS=AS;function MS(e,t){var n=this.__data__,r=wS(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}o(MS,`listCacheSet`);var NS=MS;function PS(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}o(PS,`ListCache`),PS.prototype.clear=bS,PS.prototype.delete=DS,PS.prototype.get=kS,PS.prototype.has=jS,PS.prototype.set=NS;var FS=PS;function IS(){this.__data__=new FS,this.size=0}o(IS,`stackClear`);var LS=IS;function RS(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}o(RS,`stackDelete`);var zS=RS;function BS(e){return this.__data__.get(e)}o(BS,`stackGet`);var VS=BS;function HS(e){return this.__data__.has(e)}o(HS,`stackHas`);var US=HS,WS=typeof global==`object`&&global&&global.Object===Object&&global,GS=typeof self==`object`&&self&&self.Object===Object&&self,KS=WS||GS||Function(`return this`)(),qS=KS.Symbol,JS=Object.prototype,YS=JS.hasOwnProperty,XS=JS.toString,ZS=qS?qS.toStringTag:void 0;function QS(e){var t=YS.call(e,ZS),n=e[ZS];try{e[ZS]=void 0;var r=!0}catch{}var i=XS.call(e);return r&&(t?e[ZS]=n:delete e[ZS]),i}o(QS,`getRawTag`);var $S=QS,eC=Object.prototype.toString;function tC(e){return eC.call(e)}o(tC,`objectToString`);var nC=tC,rC=`[object Null]`,iC=`[object Undefined]`,aC=qS?qS.toStringTag:void 0;function oC(e){return e==null?e===void 0?iC:rC:aC&&aC in Object(e)?$S(e):nC(e)}o(oC,`baseGetTag`);var sC=oC;function cC(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}o(cC,`isObject`);var lC=cC,uC=`[object AsyncFunction]`,dC=`[object Function]`,fC=`[object GeneratorFunction]`,pC=`[object Proxy]`;function mC(e){if(!lC(e))return!1;var t=sC(e);return t==dC||t==fC||t==uC||t==pC}o(mC,`isFunction`);var hC=mC,gC=KS[`__core-js_shared__`],_C=(function(){var e=/[^.]+$/.exec(gC&&gC.keys&&gC.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``})();function vC(e){return!!_C&&_C in e}o(vC,`isMasked`);var yC=vC,bC=Function.prototype.toString;function xC(e){if(e!=null){try{return bC.call(e)}catch{}try{return e+``}catch{}}return``}o(xC,`toSource`);var SC=xC,CC=/[\\^$.*+?()[\]{}|]/g,wC=/^\[object .+?Constructor\]$/,TC=Function.prototype,EC=Object.prototype,DC=TC.toString,OC=EC.hasOwnProperty,kC=RegExp(`^`+DC.call(OC).replace(CC,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function AC(e){return!lC(e)||yC(e)?!1:(hC(e)?kC:wC).test(SC(e))}o(AC,`baseIsNative`);var jC=AC;function MC(e,t){return e?.[t]}o(MC,`getValue`);var NC=MC;function PC(e,t){var n=NC(e,t);return jC(n)?n:void 0}o(PC,`getNative`);var FC=PC,IC=FC(KS,`Map`),LC=FC(Object,`create`);function RC(){this.__data__=LC?LC(null):{},this.size=0}o(RC,`hashClear`);var zC=RC;function BC(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}o(BC,`hashDelete`);var VC=BC,HC=`__lodash_hash_undefined__`,UC=Object.prototype.hasOwnProperty;function WC(e){var t=this.__data__;if(LC){var n=t[e];return n===HC?void 0:n}return UC.call(t,e)?t[e]:void 0}o(WC,`hashGet`);var GC=WC,KC=Object.prototype.hasOwnProperty;function qC(e){var t=this.__data__;return LC?t[e]!==void 0:KC.call(
<${t}> may appears as a prefix path in all these alternatives.
`;return r+=`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
For Further details.`,r}o(jA,`buildAmbiguityError`);function MA(e){if(e instanceof rv)return`SUBRULE`;if(e instanceof ov)return`OPTION`;if(e instanceof uv)return`OR`;if(e instanceof sv)return`AT_LEAST_ONE`;if(e instanceof cv)return`AT_LEAST_ONE_SEP`;if(e instanceof lv)return`MANY_SEP`;if(e instanceof W)return`MANY`;if(e instanceof G)return`CONSUME`;throw Error(`non exhaustive match`)}o(MA,`getProductionDslName`);function NA(e,t,n){return{actualToken:n,possibleTokenTypes:tA(Fk(t.configs.elements,e=>e.state.transitions).filter(e=>e instanceof YO).map(e=>e.tokenType),e=>e.tokenTypeIdx),tokenPath:e}}o(NA,`buildAdaptivePredictError`);function PA(e,t){return e.edges[t.tokenTypeIdx]}o(PA,`getExistingTargetState`);function FA(e,t,n){let r=new xk,i=[];for(let a of e.elements){if(n.is(a.alt)===!1)continue;if(a.state.type===HO){i.push(a);continue}let e=a.state.transitions.length;for(let n=0;n<e;n++){let e=a.state.transitions[n],i=IA(e,t);i!==void 0&&r.add({state:i,alt:a.alt,stack:a.stack})}}let a;if(i.length===0&&r.size===1&&(a=r),a===void 0){a=new xk;for(let e of r.elements)HA(e,a)}if(i.length>0&&!WA(a))for(let e of i)a.add(e);return a}o(FA,`computeReachSet`);function IA(e,t){if(e instanceof YO&&rb(t,e.tokenType))return e.target}o(IA,`getReachableTarget`);function LA(e,t){let n;for(let r of e.elements)if(t.is(r.alt)===!0){if(n===void 0)n=r.alt;else if(n!==r.alt)return}return n}o(LA,`getUniqueAlt`);function RA(e){return{configs:e,edges:{},isAcceptState:!1,prediction:-1}}o(RA,`newDFAState`);function zA(e,t,n,r){return r=BA(e,r),t.edges[n.tokenTypeIdx]=r,r}o(zA,`addDFAEdge`);function BA(e,t){if(t===bk)return t;let n=t.configs.key,r=e.states[n];return r===void 0?(t.configs.finalize(),e.states[n]=t,t):r}o(BA,`addDFAState`);function VA(e){let t=new xk,n=e.transitions.length;for(let r=0;r<n;r++)HA({state:e.transitions[r].target,alt:r,stack:[]},t);return t}o(VA,`computeStartState`);function HA(e,t){let n=e.state;if(n.type===HO){if(e.stack.length>0){let n=[...e.stack];HA({state:n.pop(),alt:e.alt,stack:n},t)}else t.add(e);return}n.epsilonOnlyTransitions||t.add(e);let r=n.transitions.length;for(let i=0;i<r;i++){let r=n.transitions[i],a=UA(e,r);a!==void 0&&HA(a,t)}}o(HA,`closure`);function UA(e,t){if(t instanceof XO)return{state:t.target,alt:e.alt,stack:e.stack};if(t instanceof ZO){let n=[...e.stack,t.followState];return{state:t.target,alt:e.alt,stack:n}}}o(UA,`getEpsilonTarget`);function WA(e){for(let t of e.elements)if(t.state.type===HO)return!0;return!1}o(WA,`hasConfigInRuleStopState`);function GA(e){for(let t of e.elements)if(t.state.type!==HO)return!1;return!0}o(GA,`allConfigsInRuleStopStates`);function KA(e){if(GA(e))return!0;let t=qA(e.elements);return JA(t)&&!YA(t)}o(KA,`hasConflictTerminatingPrediction`);function qA(e){let t=new Map;for(let n of e){let e=Sk(n,!1),r=t.get(e);r===void 0&&(r={},t.set(e,r)),r[n.alt]=!0}return t}o(qA,`getConflictingAltSets`);function JA(e){for(let t of Array.from(e.values()))if(Object.keys(t).length>1)return!0;return!1}o(JA,`hasConflictingAltSet`);function YA(e){for(let t of Array.from(e.values()))if(Object.keys(t).length===1)return!0;return!1}o(YA,`hasStateAssociatedWithOneAlt`),ht();var XA=class{static{o(this,`CstNodeBuilder`)}constructor(){this.nodeStack=[]}get current(){return this.nodeStack[this.nodeStack.length-1]??this.rootNode}buildRootNode(e){return this.rootNode=new tj(e),this.rootNode.root=this.rootNode,this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(e){let t=new $A;return t.grammarSource=e,t.root=this.rootNode,this.current.content.push(t),this.nodeStack.push(t),t}buildLeafNode(e,t){let n=new QA(e.startOffset,e.image.length,zi(e),e.tokenType,!t);return n.grammarSource=t,n.root=this.rootNode,this.current.content.push(n),n}removeNode(e){let t=e.container;if(t){let n=t.content.indexOf(e);n>=0&&t.content.splice(n,1)}}addHiddenNodes(e){let t=[];for(let n of e){let e=new QA(n.startOffset,n.image.length,zi(n),n.tokenType,!0);e.root=this.rootNode,t.push(e)}let n=this.current,r=!1;if(n.content.length>0){n.content.push(...t);return}for(;n.container;){let e=n.container.content.indexOf(n);
`;case`r`:return`\r`;case`t`:return` `;case`v`:return`\v`;case`0`:return`\0`;default:return e}}o(n,`convertEscapeCharacter`);function r(e){return e.charAt(0)===`^`?e.substring(1):e}o(r,`convertID`),e.convertID=r;function i(e){return parseInt(e)}o(i,`convertInt`),e.convertInt=i;function a(e){return BigInt(e)}o(a,`convertBigint`),e.convertBigint=a;function s(e){return new Date(e)}o(s,`convertDate`),e.convertDate=s;function c(e){return Number(e)}o(c,`convertNumber`),e.convertNumber=c;function l(e){return e.toLowerCase()===`true`}o(l,`convertBoolean`),e.convertBoolean=l})(Lj||={});var Z={};d(Z,f(yt(),1));function Rj(){return new Promise(e=>{typeof setImmediate>`u`?setTimeout(e,0):setImmediate(e)})}o(Rj,`delayNextTick`);var zj=0,Bj=10;function Vj(){return zj=performance.now(),new Z.CancellationTokenSource}o(Vj,`startCancelableOperation`);function Hj(e){Bj=e}o(Hj,`setInterruptionPeriod`);var Uj=Symbol(`OperationCancelled`);function Wj(e){return e===Uj}o(Wj,`isOperationCancelled`);async function Gj(e){if(e===Z.CancellationToken.None)return;let t=performance.now();if(t-zj>=Bj&&(zj=t,await Rj(),zj=performance.now()),e.isCancellationRequested)throw Uj}o(Gj,`interruptAndCheck`);var Kj=class{static{o(this,`Deferred`)}constructor(){this.promise=new Promise((e,t)=>{this.resolve=t=>(e(t),this),this.reject=e=>(t(e),this)})}},qj=class e{static{o(this,`FullTextDocument`)}constructor(e,t,n,r){this._uri=e,this._languageId=t,this._version=n,this._content=r,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let t=this.offsetAt(e.start),n=this.offsetAt(e.end);return this._content.substring(t,n)}return this._content}update(t,n){for(let n of t)if(e.isIncremental(n)){let e=Qj(n.range),t=this.offsetAt(e.start),r=this.offsetAt(e.end);this._content=this._content.substring(0,t)+n.text+this._content.substring(r,this._content.length);let i=Math.max(e.start.line,0),a=Math.max(e.end.line,0),o=this._lineOffsets,s=Xj(n.text,!1,t);if(a-i===s.length)for(let e=0,t=s.length;e<t;e++)o[e+i+1]=s[e];else s.length<1e4?o.splice(i+1,a-i,...s):this._lineOffsets=o=o.slice(0,i+1).concat(s,o.slice(a+1));let c=n.text.length-(r-t);if(c!==0)for(let e=i+1+s.length,t=o.length;e<t;e++)o[e]=o[e]+c}else if(e.isFull(n))this._content=n.text,this._lineOffsets=void 0;else throw Error(`Unknown change event received`);this._version=n}getLineOffsets(){return this._lineOffsets===void 0&&(this._lineOffsets=Xj(this._content,!0)),this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let t=this.getLineOffsets(),n=0,r=t.length;if(r===0)return{line:0,character:e};for(;n<r;){let i=Math.floor((n+r)/2);t[i]>e?r=i:n=i+1}let i=n-1;return e=this.ensureBeforeEOL(e,t[i]),{line:i,character:e-t[i]}}offsetAt(e){let t=this.getLineOffsets();if(e.line>=t.length)return this._content.length;if(e.line<0)return 0;let n=t[e.line];if(e.character<=0)return n;let r=e.line+1<t.length?t[e.line+1]:this._content.length,i=Math.min(n+e.character,r);return this.ensureBeforeEOL(i,n)}ensureBeforeEOL(e,t){for(;e>t&&Zj(this._content.charCodeAt(e-1));)e--;return e}get lineCount(){return this.getLineOffsets().length}static isIncremental(e){let t=e;return t!=null&&typeof t.text==`string`&&t.range!==void 0&&(t.rangeLength===void 0||typeof t.rangeLength==`number`)}static isFull(e){let t=e;return t!=null&&typeof t.text==`string`&&t.range===void 0&&t.rangeLength===void 0}},Jj;(function(e){function t(e,t,n,r){return new qj(e,t,n,r)}o(t,`create`),e.create=t;function n(e,t,n){if(e instanceof qj)return e.update(t,n),e;throw Error(`TextDocument.update: document must be created by TextDocument.create`)}o(n,`update`),e.update=n;function r(e,t){let n=e.getText(),r=Yj(t.map($j),(e,t)=>{let n=e.range.start.line-t.range.start.line;return n===0?e.range.start.character-t.range.start.character:n}),i=0,a=[];for(let t of r){let r=e.offsetAt(t.range.start);if(r<i)throw Error(`Overlapping edit`);r>i&&a.push(n.substring(i,r)),t.newText.length&&a.push(t.newText),i=e.offsetAt(t.range.end)}return a.push(n.substr(i)),a.join(``)}o(r,`app
${t}`),this.inline?`{${e}}`:e}toMarkdown(e){return e?.renderTag?.(this)??this.toMarkdownDefault(e)}toMarkdownDefault(e){let t=this.content.toMarkdown(e);if(this.inline){let n=SN(this.name,t,e??{});if(typeof n==`string`)return n}let n=``;e?.tag===`italic`||e?.tag===void 0?n=`*`:e?.tag===`bold`?n=`**`:e?.tag===`bold-italic`&&(n=`***`);let r=`${n}@${this.name}${n}`;return this.content.inlines.length===1?r=`${r} \u2014 ${t}`:this.content.inlines.length>1&&(r=`${r}
${t}`),this.inline?`{${r}}`:r}};function SN(e,t,n){if(e===`linkplain`||e===`linkcode`||e===`link`){let r=t.indexOf(` `),i=t;if(r>0){let e=lN(t,r);i=t.substring(e),t=t.substring(0,r)}return(e===`linkcode`||e===`link`&&n.link===`code`)&&(i=`\`${i}\``),n.renderLink?.(t,i)??CN(t,i)}}o(SN,`renderInlineTag`);function CN(e,t){try{return tM.parse(e,!0),`[${t}](${e})`}catch{return e}}o(CN,`renderLinkDefault`);var wN=class{static{o(this,`JSDocTextImpl`)}constructor(e,t){this.inlines=e,this.range=t}toString(){let e=``;for(let t=0;t<this.inlines.length;t++){let n=this.inlines[t],r=this.inlines[t+1];e+=n.toString(),r&&r.range.start.line>n.range.start.line&&(e+=`
`)}return e}toMarkdown(e){let t=``;for(let n=0;n<this.inlines.length;n++){let r=this.inlines[n],i=this.inlines[n+1];t+=r.toMarkdown(e),i&&i.range.start.line>r.range.start.line&&(t+=`
`)}return t}},TN=class{static{o(this,`JSDocLineImpl`)}constructor(e,t){this.text=e,this.range=t}toString(){return this.text}toMarkdown(){return this.text}};function EN(e){return e.endsWith(`
`)?`
`:`
`}o(EN,`fillNewlines`);var DN=class{static{o(this,`JSDocDocumentationProvider`)}constructor(e){this.indexManager=e.shared.workspace.IndexManager,this.commentProvider=e.documentation.CommentProvider}getDocumentation(e){let t=this.commentProvider.getComment(e);if(t&&tN(t))return eN(t).toMarkdown({renderLink:o((t,n)=>this.documentationLinkRenderer(e,t,n),`renderLink`),renderTag:o(t=>this.documentationTagRenderer(e,t),`renderTag`)})}documentationLinkRenderer(e,t,n){let r=this.findNameInLocalSymbols(e,t)??this.findNameInGlobalScope(e,t);if(r&&r.nameSegment){let e=r.nameSegment.range.start.line+1,t=r.nameSegment.range.start.character+1;return`[${n}](${r.documentUri.with({fragment:`L${e},${t}`}).toString()})`}else return}documentationTagRenderer(e,t){}findNameInLocalSymbols(e,t){let n=Dn(e).localSymbols;if(!n)return;let r=e;do{let e=n.getStream(r).find(e=>e.name===t);if(e)return e;r=r.$container}while(r)}findNameInGlobalScope(e,t){return this.indexManager.allElements().find(e=>e.name===t)}},ON=class{static{o(this,`DefaultCommentProvider`)}constructor(e){this.grammarConfig=()=>e.parser.GrammarConfig}getComment(e){return TM(e)?e.$comment:Ki(e.$cstNode,this.grammarConfig().multilineCommentRules)?.text}},kN=class{static{o(this,`DefaultAsyncParser`)}constructor(e){this.syncParser=e.parser.LangiumParser}parse(e,t){return Promise.resolve(this.syncParser.parse(e))}},AN=class{static{o(this,`AbstractThreadedAsyncParser`)}constructor(e){this.threadCount=8,this.terminationDelay=200,this.workerPool=[],this.queue=[],this.hydrator=e.serializer.Hydrator}initializeWorkers(){for(;this.workerPool.length<this.threadCount;){let e=this.createWorker();e.onReady(()=>{if(this.queue.length>0){let t=this.queue.shift();t&&(e.lock(),t.resolve(e))}}),this.workerPool.push(e)}}async parse(e,t){let n=await this.acquireParserWorker(t),r=new Kj,i,a=t.onCancellationRequested(()=>{i=setTimeout(()=>{this.terminateWorker(n)},this.terminationDelay)});return n.parse(e).then(e=>{let t=this.hydrator.hydrate(e);r.resolve(t)}).catch(e=>{r.reject(e)}).finally(()=>{a.dispose(),clearTimeout(i)}),r.promise}terminateWorker(e){e.terminate();let t=this.workerPool.indexOf(e);t>=0&&this.workerPool.splice(t,1)}async acquireParserWorker(e){this.initializeWorkers();for(let e of this.workerPool)if(e.ready)return e.lock(),e;let t=new Kj;return e.onCancellationRequested(()=>{let e=this.queue.indexOf(t);e>=0&&this.queue.splice(e,1),t.reject(Uj)}),this.queue.push(t),t.promise}},jN=class{static{o(this,`ParserWorker`)}get ready(){return this._ready}get onReady(){return this.onReadyEmitter.event}constructor(e,t,n,r){this.onReadyEmitter=new VM.Emitter,this.deferred=new Kj,this._ready=!0,this._parsing=!1,this.sendMessage=e,this._terminate=r,t(e=>{let t=e;this.deferred.resolve(t),this.unlock()}),n(e=>{this.deferred.reject(e),this.unlock()})}terminate(){this.deferred.reject(Uj),this._terminate()}lock(){this._ready=!1}unlock(){this._parsing=!1,this._ready=!0,this.onReadyEmitter.fire()}parse(e){if(this._parsing)throw Error(`Parser worker is busy`);return this._parsing=!0,this.deferred=new Kj,this.sendMessage(e),this.deferred.promise}},MN=class{static{o(this,`DefaultWorkspaceLock`)}constructor(){this.previousTokenSource=new Z.CancellationTokenSource,this.writeQueue=[],this.readQueue=[],this.done=!0}write(e){this.cancelWrite();let t=Vj();return this.previousTokenSource=t,this.enqueue(this.writeQueue,e,t.token)}read(e){return this.enqueue(this.readQueue,e)}enqueue(e,t,n=Z.CancellationToken.None){let r=new Kj,i={action:t,deferred:r,cancellationToken:n};return e.push(i),this.performNextOperation(),r.promise}async performNextOperation(){if(!this.done)return;let e=[];if(this.writeQueue.length>0)e.push(this.writeQueue.shift());else if(this.readQueue.length>0)e.push(...this.readQueue.splice(0,this.readQueue.length));else return;this.done=!1,await Promise.all(e.map(async({action:e,deferred:t,cancellationToken:n})=>{try{let r=await Promise.resolve().then(()=>e(n));t.resolve(r)}catch(e){Wj(e)?t.resolve(void 0):t.reject(e)}})),this.done=!0,this.performNextOperation()}cancelWrite(){this.previousTokenSource.can
`.includes(e[t-1])}matchWhitespace(e,t,n,r){this.whitespaceRegExp.lastIndex=t;let i=this.whitespaceRegExp.exec(e);return{currIndentLevel:i?.[0].length??0,prevIndentLevel:this.indentationStack.at(-1),match:i}}createIndentationTokenInstance(e,t,n,r){let i=this.getLineNumber(t,r);return nb(e,n,r,r+n.length,i,i,1,n.length)}getLineNumber(e,t){return e.substring(0,t).split(/\r\n|\r|\n/).length}indentMatcher(e,t,n,r){if(!this.isStartOfLine(e,t))return null;let{currIndentLevel:i,prevIndentLevel:a,match:o}=this.matchWhitespace(e,t,n,r);return i<=a?null:(this.indentationStack.push(i),o)}dedentMatcher(e,t,n,r){if(!this.isStartOfLine(e,t))return null;let{currIndentLevel:i,prevIndentLevel:a,match:o}=this.matchWhitespace(e,t,n,r);if(i>=a)return null;let s=this.indentationStack.lastIndexOf(i);if(s===-1)return this.diagnostics.push({severity:`error`,message:`Invalid dedent level ${i} at offset: ${t}. Current indentation stack: ${this.indentationStack}`,offset:t,length:o?.[0]?.length??0,line:this.getLineNumber(e,t),column:1}),null;let c=this.indentationStack.length-s-1,l=e.substring(0,t).match(/[\r\n]+$/)?.[0].length??1;for(let r=0;r<c;r++){let r=this.createIndentationTokenInstance(this.dedentTokenType,e,``,t-(l-1));n.push(r),this.indentationStack.pop()}return null}buildTerminalToken(e){let t=super.buildTerminalToken(e),{indentTokenName:n,dedentTokenName:r,whitespaceTokenName:i}=this.options;return t.name===n?this.indentTokenType:t.name===r?this.dedentTokenType:t.name===i?$y({name:i,pattern:this.whitespaceRegExp,group:Vy.SKIPPED}):t}flushRemainingDedents(e){let t=[];for(;this.indentationStack.length>1;)t.push(this.createIndentationTokenInstance(this.dedentTokenType,e,``,e.length)),this.indentationStack.pop();return this.indentationStack=[0],t}},qN=class extends XM{static{o(this,`IndentationAwareLexer`)}constructor(e){if(super(e),e.parser.TokenBuilder instanceof KN)this.indentationTokenBuilder=e.parser.TokenBuilder;else throw Error(`IndentationAwareLexer requires an accompanying IndentationAwareTokenBuilder`)}tokenize(e,t=YM){let n=super.tokenize(e),r=n.report;t?.mode===`full`&&n.tokens.push(...r.remainingDedents),r.remainingDedents=[];let{indentTokenType:i,dedentTokenType:a}=this.indentationTokenBuilder,o=i.tokenTypeIdx,s=a.tokenTypeIdx,c=[],l=n.tokens.length-1;for(let e=0;e<l;e++){let t=n.tokens[e],r=n.tokens[e+1];if(t.tokenTypeIdx===o&&r.tokenTypeIdx===s){e++;continue}c.push(t)}return l>=0&&c.push(n.tokens[l]),n.tokens=c,n}},JN={};l(JN,{AstUtils:()=>Cn,BiMap:()=>pM,Cancellation:()=>Z,ContextCache:()=>xM,CstUtils:()=>sn,DONE_RESULT:()=>bn,Deferred:()=>Kj,Disposable:()=>WM,DisposableCache:()=>yM,DocumentCache:()=>SM,EMPTY_STREAM:()=>yn,ErrorWithLocation:()=>ia,GrammarUtils:()=>ra,MultiMap:()=>fM,OperationCancelled:()=>Uj,Reduction:()=>Sn,RegExpUtils:()=>sa,SimpleCache:()=>bM,StreamImpl:()=>gn,TreeStreamImpl:()=>xn,URI:()=>tM,UriTrie:()=>iM,UriUtils:()=>rM,WorkspaceCache:()=>CM,assertCondition:()=>oa,assertUnreachable:()=>aa,delayNextTick:()=>Rj,interruptAndCheck:()=>Gj,isOperationCancelled:()=>Wj,loadGrammarFromJson:()=>eP,setInterruptionPeriod:()=>Hj,startCancelableOperation:()=>Vj,stream:()=>N}),d(JN,VM);var YN=class{static{o(this,`EmptyFileSystemProvider`)}stat(e){throw Error(`No file system is available.`)}statSync(e){throw Error(`No file system is available.`)}async exists(){return!1}existsSync(){return!1}readBinary(){throw Error(`No file system is available.`)}readBinarySync(){throw Error(`No file system is available.`)}readFile(){throw Error(`No file system is available.`)}readFileSync(){throw Error(`No file system is available.`)}async readDirectory(){return[]}readDirectorySync(){return[]}},XN={fileSystemProvider:o(()=>new YN,`fileSystemProvider`)},ZN={Grammar:o(()=>void 0,`Grammar`),LanguageMetaData:o(()=>({caseInsensitive:!1,fileExtensions:[`.langium`],languageId:`langium`}),`LanguageMetaData`)},QN={AstReflection:o(()=>new Pi,`AstReflection`)};function $N(){let e=LN(FN(XN),QN),t=LN(PN({shared:e}),ZN);return e.ServiceRegistry.register(t),t}o($N,`createMinimalGrammarServices`);function eP(e){let t=$N(),n=t.serializer.JsonSeriali
`)}}},tR=class extends eR{static{o(this,`CommonValueConverter`)}runCustomConverter(e,t,n){}},nR=class extends Fj{static{o(this,`AbstractMermaidTokenBuilder`)}constructor(e){super(),this.keywords=new Set(e)}buildKeywordTokens(e,t,n){let r=super.buildKeywordTokens(e,t,n);return r.forEach(e=>{this.keywords.has(e.name)&&e.PATTERN!==void 0&&(e.PATTERN=RegExp(e.PATTERN.toString()+`(?:(?=%%)|(?!\\S))`))}),r}};(class extends nR{static{o(this,`CommonTokenBuilder`)}});export{FN as C,PN as S,EF as T,YL as _,zL as a,QL as b,VL as c,UL as d,WL as f,JL as g,qL as h,tR as i,HL as l,KL as m,eR as n,XN as o,GL as p,RL as r,BL as s,nR as t,LL as u,ZL as v,LN as w,o as x,XL as y};