zenstack 0.4.2 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
- "use strict";var ZE=Object.create;var Bl=Object.defineProperty;var QE=Object.getOwnPropertyDescriptor;var eC=Object.getOwnPropertyNames,fy=Object.getOwnPropertySymbols,my=Object.getPrototypeOf,hy=Object.prototype.hasOwnProperty,tC=Object.prototype.propertyIsEnumerable,rC=Reflect.get;var py=(r,e,t)=>e in r?Bl(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,yy=(r,e)=>{for(var t in e||={})hy.call(e,t)&&py(r,t,e[t]);if(fy)for(var t of fy(e))tC.call(e,t)&&py(r,t,e[t]);return r};var C=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var nC=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of eC(e))!hy.call(r,i)&&i!==t&&Bl(r,i,{get:()=>e[i],enumerable:!(n=QE(e,i))||n.enumerable});return r};var St=(r,e,t)=>(t=r!=null?ZE(my(r)):{},nC(e||!r||!r.__esModule?Bl(t,"default",{value:r,enumerable:!0}):t,r));var Es=(r,e,t)=>rC(my(r),t,e);var no=(r,e,t)=>new Promise((n,i)=>{var o=u=>{try{s(t.next(u))}catch(c){i(c)}},a=u=>{try{s(t.throw(u))}catch(c){i(c)}},s=u=>u.done?n(u.value):Promise.resolve(u.value).then(o,a);s((t=t.apply(r,e)).next())});var Cs=C(yt=>{"use strict";Object.defineProperty(yt,"__esModule",{value:!0});yt.thenable=yt.typedArray=yt.stringArray=yt.array=yt.func=yt.error=yt.number=yt.string=yt.boolean=void 0;function iC(r){return r===!0||r===!1}yt.boolean=iC;function gy(r){return typeof r=="string"||r instanceof String}yt.string=gy;function oC(r){return typeof r=="number"||r instanceof Number}yt.number=oC;function aC(r){return r instanceof Error}yt.error=aC;function vy(r){return typeof r=="function"}yt.func=vy;function Ty(r){return Array.isArray(r)}yt.array=Ty;function sC(r){return Ty(r)&&r.every(e=>gy(e))}yt.stringArray=sC;function uC(r,e){return Array.isArray(r)&&r.every(e)}yt.typedArray=uC;function cC(r){return r&&vy(r.then)}yt.thenable=cC});var Ln=C(Yl=>{"use strict";Object.defineProperty(Yl,"__esModule",{value:!0});var zl;function Vl(){if(zl===void 0)throw new Error("No runtime abstraction layer installed");return zl}(function(r){function e(t){if(t===void 0)throw new Error("No runtime abstraction layer provided");zl=t}r.install=e})(Vl||(Vl={}));Yl.default=Vl});var Xl=C(aa=>{"use strict";Object.defineProperty(aa,"__esModule",{value:!0});aa.Disposable=void 0;var lC;(function(r){function e(t){return{dispose:t}}r.create=e})(lC=aa.Disposable||(aa.Disposable={}))});var Ry=C(Ps=>{"use strict";Object.defineProperty(Ps,"__esModule",{value:!0});Ps.AbstractMessageBuffer=void 0;var dC=13,fC=10,pC=`\r
2
- `,Jl=class{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(){if(this._chunks.length===0)return;let e=0,t=0,n=0,i=0;e:for(;t<this._chunks.length;){let u=this._chunks[t];n=0;t:for(;n<u.length;){switch(u[n]){case dC:switch(e){case 0:e=1;break;case 2:e=3;break;default:e=0}break;case fC:switch(e){case 1:e=2;break;case 3:e=4,n++;break e;default:e=0}break;default:e=0}n++}i+=u.byteLength,t++}if(e!==4)return;let o=this._read(i+n),a=new Map,s=this.toString(o,"ascii").split(pC);if(s.length<2)return a;for(let u=0;u<s.length-2;u++){let c=s[u],l=c.indexOf(":");if(l===-1)throw new Error("Message header must separate key and value using :");let d=c.substr(0,l),g=c.substr(l+1).trim();a.set(d,g)}return a}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 new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===e){let o=this._chunks[0];return this._chunks.shift(),this._totalLength-=e,this.asNative(o)}if(this._chunks[0].byteLength>e){let o=this._chunks[0],a=this.asNative(o,e);return this._chunks[0]=o.slice(e),this._totalLength-=e,a}let t=this.allocNative(e),n=0,i=0;for(;e>0;){let o=this._chunks[i];if(o.byteLength>e){let a=o.slice(0,e);t.set(a,n),n+=e,this._chunks[i]=o.slice(e),this._totalLength-=e,e-=e}else t.set(o,n),n+=o.byteLength,this._chunks.shift(),this._totalLength-=o.byteLength,e-=o.byteLength}return t}};Ps.AbstractMessageBuffer=Jl});var by=C(td=>{"use strict";Object.defineProperty(td,"__esModule",{value:!0});var mC=Ln(),_y=require("util"),ki=Xl(),hC=Ry(),io=class extends hC.AbstractMessageBuffer{constructor(e="utf-8"){super(e)}emptyBuffer(){return io.emptyBuffer}fromString(e,t){return Buffer.from(e,t)}toString(e,t){return e instanceof Buffer?e.toString(t):new _y.TextDecoder(t).decode(e)}asNative(e,t){return t===void 0?e instanceof Buffer?e:Buffer.from(e):e instanceof Buffer?e.slice(0,t):Buffer.from(e,0,t)}allocNative(e){return Buffer.allocUnsafe(e)}};io.emptyBuffer=Buffer.allocUnsafe(0);var Zl=class{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),ki.Disposable.create(()=>this.stream.off("close",e))}onError(e){return this.stream.on("error",e),ki.Disposable.create(()=>this.stream.off("error",e))}onEnd(e){return this.stream.on("end",e),ki.Disposable.create(()=>this.stream.off("end",e))}onData(e){return this.stream.on("data",e),ki.Disposable.create(()=>this.stream.off("data",e))}},Ql=class{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),ki.Disposable.create(()=>this.stream.off("close",e))}onError(e){return this.stream.on("error",e),ki.Disposable.create(()=>this.stream.off("error",e))}onEnd(e){return this.stream.on("end",e),ki.Disposable.create(()=>this.stream.off("end",e))}write(e,t){return new Promise((n,i)=>{let o=a=>{a==null?n():i(a)};typeof e=="string"?this.stream.write(e,t,o):this.stream.write(e,o)})}end(){this.stream.end()}},Ay=Object.freeze({messageBuffer:Object.freeze({create:r=>new io(r)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(r,e)=>{try{return Promise.resolve(Buffer.from(JSON.stringify(r,void 0,0),e.charset))}catch(t){return Promise.reject(t)}}}),decoder:Object.freeze({name:"application/json",decode:(r,e)=>{try{return r instanceof Buffer?Promise.resolve(JSON.parse(r.toString(e.charset))):Promise.resolve(JSON.parse(new _y.TextDecoder(e.charset).decode(r)))}catch(t){return Promise.reject(t)}}})}),stream:Object.freeze({asReadableStream:r=>new Zl(r),asWritableStream:r=>new Ql(r)}),console,timer:Object.freeze({setTimeout(r,e,...t){let n=setTimeout(r,e,...t);return{dispose:()=>clearTimeout(n)}},setImmediate(r,...e){let t=setImmediate(r,...e);return{dispose:()=>clearImmediate(t)}},setInterval(r,e,...t){let n=setInterval(r,e,...t);return{dispose:()=>clearInterval(n)}}})});function ed(){return Ay}(function(r){function e(){mC.default.install(Ay)}r.install=e})(ed||(ed={}));td.default=ed});var oo=C(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.stringArray=Wt.array=Wt.func=Wt.error=Wt.number=Wt.string=Wt.boolean=void 0;function yC(r){return r===!0||r===!1}Wt.boolean=yC;function Ey(r){return typeof r=="string"||r instanceof String}Wt.string=Ey;function gC(r){return typeof r=="number"||r instanceof Number}Wt.number=gC;function vC(r){return r instanceof Error}Wt.error=vC;function TC(r){return typeof r=="function"}Wt.func=TC;function Cy(r){return Array.isArray(r)}Wt.array=Cy;function RC(r){return Cy(r)&&r.every(e=>Ey(e))}Wt.stringArray=RC});var Ed=C(Y=>{"use strict";Object.defineProperty(Y,"__esModule",{value:!0});Y.Message=Y.NotificationType9=Y.NotificationType8=Y.NotificationType7=Y.NotificationType6=Y.NotificationType5=Y.NotificationType4=Y.NotificationType3=Y.NotificationType2=Y.NotificationType1=Y.NotificationType0=Y.NotificationType=Y.RequestType9=Y.RequestType8=Y.RequestType7=Y.RequestType6=Y.RequestType5=Y.RequestType4=Y.RequestType3=Y.RequestType2=Y.RequestType1=Y.RequestType=Y.RequestType0=Y.AbstractMessageSignature=Y.ParameterStructures=Y.ResponseError=Y.ErrorCodes=void 0;var xi=oo(),Py;(function(r){r.ParseError=-32700,r.InvalidRequest=-32600,r.MethodNotFound=-32601,r.InvalidParams=-32602,r.InternalError=-32603,r.jsonrpcReservedErrorRangeStart=-32099,r.serverErrorStart=-32099,r.MessageWriteError=-32099,r.MessageReadError=-32098,r.PendingResponseRejected=-32097,r.ConnectionInactive=-32096,r.ServerNotInitialized=-32002,r.UnknownErrorCode=-32001,r.jsonrpcReservedErrorRangeEnd=-32e3,r.serverErrorEnd=-32e3})(Py=Y.ErrorCodes||(Y.ErrorCodes={}));var sa=class extends Error{constructor(e,t,n){super(t),this.code=xi.number(e)?e:Py.UnknownErrorCode,this.data=n,Object.setPrototypeOf(this,sa.prototype)}toJson(){let e={code:this.code,message:this.message};return this.data!==void 0&&(e.data=this.data),e}};Y.ResponseError=sa;var Nt=class{constructor(e){this.kind=e}static is(e){return e===Nt.auto||e===Nt.byName||e===Nt.byPosition}toString(){return this.kind}};Y.ParameterStructures=Nt;Nt.auto=new Nt("auto");Nt.byPosition=new Nt("byPosition");Nt.byName=new Nt("byName");var Xe=class{constructor(e,t){this.method=e,this.numberOfParams=t}get parameterStructures(){return Nt.auto}};Y.AbstractMessageSignature=Xe;var rd=class extends Xe{constructor(e){super(e,0)}};Y.RequestType0=rd;var nd=class extends Xe{constructor(e,t=Nt.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};Y.RequestType=nd;var id=class extends Xe{constructor(e,t=Nt.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};Y.RequestType1=id;var od=class extends Xe{constructor(e){super(e,2)}};Y.RequestType2=od;var ad=class extends Xe{constructor(e){super(e,3)}};Y.RequestType3=ad;var sd=class extends Xe{constructor(e){super(e,4)}};Y.RequestType4=sd;var ud=class extends Xe{constructor(e){super(e,5)}};Y.RequestType5=ud;var cd=class extends Xe{constructor(e){super(e,6)}};Y.RequestType6=cd;var ld=class extends Xe{constructor(e){super(e,7)}};Y.RequestType7=ld;var dd=class extends Xe{constructor(e){super(e,8)}};Y.RequestType8=dd;var fd=class extends Xe{constructor(e){super(e,9)}};Y.RequestType9=fd;var pd=class extends Xe{constructor(e,t=Nt.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};Y.NotificationType=pd;var md=class extends Xe{constructor(e){super(e,0)}};Y.NotificationType0=md;var hd=class extends Xe{constructor(e,t=Nt.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};Y.NotificationType1=hd;var yd=class extends Xe{constructor(e){super(e,2)}};Y.NotificationType2=yd;var gd=class extends Xe{constructor(e){super(e,3)}};Y.NotificationType3=gd;var vd=class extends Xe{constructor(e){super(e,4)}};Y.NotificationType4=vd;var Td=class extends Xe{constructor(e){super(e,5)}};Y.NotificationType5=Td;var Rd=class extends Xe{constructor(e){super(e,6)}};Y.NotificationType6=Rd;var _d=class extends Xe{constructor(e){super(e,7)}};Y.NotificationType7=_d;var Ad=class extends Xe{constructor(e){super(e,8)}};Y.NotificationType8=Ad;var bd=class extends Xe{constructor(e){super(e,9)}};Y.NotificationType9=bd;var _C;(function(r){function e(i){let o=i;return o&&xi.string(o.method)&&(xi.string(o.id)||xi.number(o.id))}r.isRequest=e;function t(i){let o=i;return o&&xi.string(o.method)&&i.id===void 0}r.isNotification=t;function n(i){let o=i;return o&&(o.result!==void 0||!!o.error)&&(xi.string(o.id)||xi.number(o.id)||o.id===null)}r.isResponse=n})(_C=Y.Message||(Y.Message={}))});var Pd=C(Fn=>{"use strict";var ky;Object.defineProperty(Fn,"__esModule",{value:!0});Fn.LRUCache=Fn.LinkedMap=Fn.Touch=void 0;var er;(function(r){r.None=0,r.First=1,r.AsOld=r.First,r.Last=2,r.AsNew=r.Last})(er=Fn.Touch||(Fn.Touch={}));var ks=class{constructor(){this[ky]="LinkedMap",this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){return this._head?.value}get last(){return this._tail?.value}has(e){return this._map.has(e)}get(e,t=er.None){let n=this._map.get(e);if(!!n)return t!==er.None&&this.touch(n,t),n.value}set(e,t,n=er.None){let i=this._map.get(e);if(i)i.value=t,n!==er.None&&this.touch(i,n);else{switch(i={key:e,value:t,next:void 0,previous:void 0},n){case er.None:this.addItemLast(i);break;case er.First:this.addItemFirst(i);break;case er.Last:this.addItemLast(i);break;default:this.addItemLast(i);break}this._map.set(e,i),this._size++}return this}delete(e){return!!this.remove(e)}remove(e){let t=this._map.get(e);if(!!t)return this._map.delete(e),this.removeItem(t),this._size--,t.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");let e=this._head;return this._map.delete(e.key),this.removeItem(e),this._size--,e.value}forEach(e,t){let n=this._state,i=this._head;for(;i;){if(t?e.bind(t)(i.value,i.key,this):e(i.value,i.key,this),this._state!==n)throw new Error("LinkedMap got modified during iteration.");i=i.next}}keys(){let e=this._state,t=this._head,n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){let i={value:t.key,done:!1};return t=t.next,i}else return{value:void 0,done:!0}}};return n}values(){let e=this._state,t=this._head,n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){let i={value:t.value,done:!1};return t=t.next,i}else return{value:void 0,done:!0}}};return n}entries(){let e=this._state,t=this._head,n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){let i={value:[t.key,t.value],done:!1};return t=t.next,i}else return{value:void 0,done:!0}}};return n}[(ky=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(e){if(e>=this.size)return;if(e===0){this.clear();return}let t=this._head,n=this.size;for(;t&&n>e;)this._map.delete(t.key),t=t.next,n--;this._head=t,this._size=n,t&&(t.previous=void 0),this._state++}addItemFirst(e){if(!this._head&&!this._tail)this._tail=e;else if(this._head)e.next=this._head,this._head.previous=e;else throw new Error("Invalid list");this._head=e,this._state++}addItemLast(e){if(!this._head&&!this._tail)this._head=e;else if(this._tail)e.previous=this._tail,this._tail.next=e;else throw new Error("Invalid list");this._tail=e,this._state++}removeItem(e){if(e===this._head&&e===this._tail)this._head=void 0,this._tail=void 0;else if(e===this._head){if(!e.next)throw new Error("Invalid list");e.next.previous=void 0,this._head=e.next}else if(e===this._tail){if(!e.previous)throw new Error("Invalid list");e.previous.next=void 0,this._tail=e.previous}else{let t=e.next,n=e.previous;if(!t||!n)throw new Error("Invalid list");t.previous=n,n.next=t}e.next=void 0,e.previous=void 0,this._state++}touch(e,t){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(t!==er.First&&t!==er.Last)){if(t===er.First){if(e===this._head)return;let n=e.next,i=e.previous;e===this._tail?(i.next=void 0,this._tail=i):(n.previous=i,i.next=n),e.previous=void 0,e.next=this._head,this._head.previous=e,this._head=e,this._state++}else if(t===er.Last){if(e===this._tail)return;let n=e.next,i=e.previous;e===this._head?(n.previous=void 0,this._head=n):(n.previous=i,i.next=n),e.next=void 0,e.previous=this._tail,this._tail.next=e,this._tail=e,this._state++}}}toJSON(){let e=[];return this.forEach((t,n)=>{e.push([n,t])}),e}fromJSON(e){this.clear();for(let[t,n]of e)this.set(t,n)}};Fn.LinkedMap=ks;var Cd=class extends ks{constructor(e,t=1){super(),this._limit=e,this._ratio=Math.min(Math.max(0,t),1)}get limit(){return this._limit}set limit(e){this._limit=e,this.checkTrim()}get ratio(){return this._ratio}set ratio(e){this._ratio=Math.min(Math.max(0,e),1),this.checkTrim()}get(e,t=er.AsNew){return super.get(e,t)}peek(e){return super.get(e,er.None)}set(e,t){return super.set(e,t,er.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}};Fn.LRUCache=Cd});var so=C(Si=>{"use strict";Object.defineProperty(Si,"__esModule",{value:!0});Si.Emitter=Si.Event=void 0;var AC=Ln(),bC;(function(r){let e={dispose(){}};r.None=function(){return e}})(bC=Si.Event||(Si.Event={}));var kd=class{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:()=>this.remove(e,t)})}remove(e,t=null){if(!this._callbacks)return;let n=!1;for(let i=0,o=this._callbacks.length;i<o;i++)if(this._callbacks[i]===e)if(this._contexts[i]===t){this._callbacks.splice(i,1),this._contexts.splice(i,1);return}else n=!0;if(n)throw new Error("When adding a listener with a context, you should remove it with the same context")}invoke(...e){if(!this._callbacks)return[];let t=[],n=this._callbacks.slice(0),i=this._contexts.slice(0);for(let o=0,a=n.length;o<a;o++)try{t.push(n[o].apply(i[o],e))}catch(s){(0,AC.default)().console.error(s)}return t}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}},ao=class{constructor(e){this._options=e}get event(){return this._event||(this._event=(e,t,n)=>{this._callbacks||(this._callbacks=new kd),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(e,t);let i={dispose:()=>{!this._callbacks||(this._callbacks.remove(e,t),i.dispose=ao._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(n)&&n.push(i),i}),this._event}fire(e){this._callbacks&&this._callbacks.invoke.call(this._callbacks,e)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}};Si.Emitter=ao;ao._noop=function(){}});var Dd=C(Ni=>{"use strict";Object.defineProperty(Ni,"__esModule",{value:!0});Ni.CancellationTokenSource=Ni.CancellationToken=void 0;var EC=Ln(),CC=oo(),xd=so(),Sd;(function(r){r.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:xd.Event.None}),r.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:xd.Event.None});function e(t){let n=t;return n&&(n===r.None||n===r.Cancelled||CC.boolean(n.isCancellationRequested)&&!!n.onCancellationRequested)}r.is=e})(Sd=Ni.CancellationToken||(Ni.CancellationToken={}));var PC=Object.freeze(function(r,e){let t=(0,EC.default)().timer.setTimeout(r.bind(e),0);return{dispose(){t.dispose()}}}),xs=class{constructor(){this._isCancelled=!1}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?PC:(this._emitter||(this._emitter=new xd.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}},Nd=class{get token(){return this._token||(this._token=new xs),this._token}cancel(){this._token?this._token.cancel():this._token=Sd.Cancelled}dispose(){this._token?this._token instanceof xs&&this._token.dispose():this._token=Sd.None}};Ni.CancellationTokenSource=Nd});var xy=C(qn=>{"use strict";Object.defineProperty(qn,"__esModule",{value:!0});qn.ReadableStreamMessageReader=qn.AbstractMessageReader=qn.MessageReader=void 0;var Id=Ln(),uo=oo(),wd=so(),kC;(function(r){function e(t){let n=t;return n&&uo.func(n.listen)&&uo.func(n.dispose)&&uo.func(n.onError)&&uo.func(n.onClose)&&uo.func(n.onPartialMessage)}r.is=e})(kC=qn.MessageReader||(qn.MessageReader={}));var Ss=class{constructor(){this.errorEmitter=new wd.Emitter,this.closeEmitter=new wd.Emitter,this.partialMessageEmitter=new wd.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e){this.errorEmitter.fire(this.asError(e))}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}get onPartialMessage(){return this.partialMessageEmitter.event}firePartialMessage(e){this.partialMessageEmitter.fire(e)}asError(e){return e instanceof Error?e:new Error(`Reader received error. Reason: ${uo.string(e.message)?e.message:"unknown"}`)}};qn.AbstractMessageReader=Ss;var Od;(function(r){function e(t){let n,i,o,a=new Map,s,u=new Map;if(t===void 0||typeof t=="string")n=t??"utf-8";else{if(n=t.charset??"utf-8",t.contentDecoder!==void 0&&(o=t.contentDecoder,a.set(o.name,o)),t.contentDecoders!==void 0)for(let c of t.contentDecoders)a.set(c.name,c);if(t.contentTypeDecoder!==void 0&&(s=t.contentTypeDecoder,u.set(s.name,s)),t.contentTypeDecoders!==void 0)for(let c of t.contentTypeDecoders)u.set(c.name,c)}return s===void 0&&(s=(0,Id.default)().applicationJson.decoder,u.set(s.name,s)),{charset:n,contentDecoder:o,contentDecoders:a,contentTypeDecoder:s,contentTypeDecoders:u}}r.fromOptions=e})(Od||(Od={}));var $d=class extends Ss{constructor(e,t){super(),this.readable=e,this.options=Od.fromOptions(t),this.buffer=(0,Id.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0}set partialMessageTimeout(e){this._partialMessageTimeout=e}get partialMessageTimeout(){return this._partialMessageTimeout}listen(e){this.nextMessageLength=-1,this.messageToken=0,this.partialMessageTimer=void 0,this.callback=e;let t=this.readable.onData(n=>{this.onData(n)});return this.readable.onError(n=>this.fireError(n)),this.readable.onClose(()=>this.fireClose()),t}onData(e){for(this.buffer.append(e);;){if(this.nextMessageLength===-1){let i=this.buffer.tryReadHeaders();if(!i)return;let o=i.get("Content-Length");if(!o)throw new Error("Header must provide a Content-Length property.");let a=parseInt(o);if(isNaN(a))throw new Error("Content-Length value must be a number.");this.nextMessageLength=a}let t=this.buffer.tryReadBody(this.nextMessageLength);if(t===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1;let n;this.options.contentDecoder!==void 0?n=this.options.contentDecoder.decode(t):n=Promise.resolve(t),n.then(i=>{this.options.contentTypeDecoder.decode(i,this.options).then(o=>{this.callback(o)},o=>{this.fireError(o)})},i=>{this.fireError(i)})}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=(0,Id.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))}};qn.ReadableStreamMessageReader=$d});var Sy=C(Ns=>{"use strict";Object.defineProperty(Ns,"__esModule",{value:!0});Ns.Semaphore=void 0;var xC=Ln(),Md=class{constructor(e=1){if(e<=0)throw new Error("Capacity must be greater than 0");this._capacity=e,this._active=0,this._waiting=[]}lock(e){return new Promise((t,n)=>{this._waiting.push({thunk:e,resolve:t,reject:n}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length===0||this._active===this._capacity||(0,xC.default)().timer.setImmediate(()=>this.doRunNext())}doRunNext(){if(this._waiting.length===0||this._active===this._capacity)return;let e=this._waiting.shift();if(this._active++,this._active>this._capacity)throw new Error("To many thunks active");try{let t=e.thunk();t instanceof Promise?t.then(n=>{this._active--,e.resolve(n),this.runNext()},n=>{this._active--,e.reject(n),this.runNext()}):(this._active--,e.resolve(t),this.runNext())}catch(t){this._active--,e.reject(t),this.runNext()}}};Ns.Semaphore=Md});var Iy=C(jn=>{"use strict";Object.defineProperty(jn,"__esModule",{value:!0});jn.WriteableStreamMessageWriter=jn.AbstractMessageWriter=jn.MessageWriter=void 0;var Ny=Ln(),ua=oo(),SC=Sy(),Dy=so(),NC="Content-Length: ",wy=`\r
3
- `,DC;(function(r){function e(t){let n=t;return n&&ua.func(n.dispose)&&ua.func(n.onClose)&&ua.func(n.onError)&&ua.func(n.write)}r.is=e})(DC=jn.MessageWriter||(jn.MessageWriter={}));var Ds=class{constructor(){this.errorEmitter=new Dy.Emitter,this.closeEmitter=new Dy.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:new Error(`Writer received error. Reason: ${ua.string(e.message)?e.message:"unknown"}`)}};jn.AbstractMessageWriter=Ds;var Ld;(function(r){function e(t){return t===void 0||typeof t=="string"?{charset:t??"utf-8",contentTypeEncoder:(0,Ny.default)().applicationJson.encoder}:{charset:t.charset??"utf-8",contentEncoder:t.contentEncoder,contentTypeEncoder:t.contentTypeEncoder??(0,Ny.default)().applicationJson.encoder}}r.fromOptions=e})(Ld||(Ld={}));var Fd=class extends Ds{constructor(e,t){super(),this.writable=e,this.options=Ld.fromOptions(t),this.errorCount=0,this.writeSemaphore=new SC.Semaphore(1),this.writable.onError(n=>this.fireError(n)),this.writable.onClose(()=>this.fireClose())}async write(e){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(e,this.options).then(n=>this.options.contentEncoder!==void 0?this.options.contentEncoder.encode(n):n).then(n=>{let i=[];return i.push(NC,n.byteLength.toString(),wy),i.push(wy),this.doWrite(e,i,n)},n=>{throw this.fireError(n),n}))}async doWrite(e,t,n){try{return await this.writable.write(t.join(""),"ascii"),this.writable.write(n)}catch(i){return this.handleError(i,e),Promise.reject(i)}}handleError(e,t){this.errorCount++,this.fireError(e,t,this.errorCount)}end(){this.writable.end()}};jn.WriteableStreamMessageWriter=Fd});var qy=C(J=>{"use strict";Object.defineProperty(J,"__esModule",{value:!0});J.createMessageConnection=J.ConnectionOptions=J.CancellationStrategy=J.CancellationSenderStrategy=J.CancellationReceiverStrategy=J.ConnectionStrategy=J.ConnectionError=J.ConnectionErrors=J.LogTraceNotification=J.SetTraceNotification=J.TraceFormat=J.TraceValues=J.Trace=J.NullLogger=J.ProgressType=J.ProgressToken=void 0;var Oy=Ln(),Et=oo(),Q=Ed(),$y=Pd(),ca=so(),qd=Dd(),da;(function(r){r.type=new Q.NotificationType("$/cancelRequest")})(da||(da={}));var My;(function(r){function e(t){return typeof t=="string"||typeof t=="number"}r.is=e})(My=J.ProgressToken||(J.ProgressToken={}));var la;(function(r){r.type=new Q.NotificationType("$/progress")})(la||(la={}));var jd=class{constructor(){}};J.ProgressType=jd;var Gd;(function(r){function e(t){return Et.func(t)}r.is=e})(Gd||(Gd={}));J.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}});var Se;(function(r){r[r.Off=0]="Off",r[r.Messages=1]="Messages",r[r.Compact=2]="Compact",r[r.Verbose=3]="Verbose"})(Se=J.Trace||(J.Trace={}));var wC;(function(r){r.Off="off",r.Messages="messages",r.Compact="compact",r.Verbose="verbose"})(wC=J.TraceValues||(J.TraceValues={}));(function(r){function e(n){if(!Et.string(n))return r.Off;switch(n=n.toLowerCase(),n){case"off":return r.Off;case"messages":return r.Messages;case"compact":return r.Compact;case"verbose":return r.Verbose;default:return r.Off}}r.fromString=e;function t(n){switch(n){case r.Off:return"off";case r.Messages:return"messages";case r.Compact:return"compact";case r.Verbose:return"verbose";default:return"off"}}r.toString=t})(Se=J.Trace||(J.Trace={}));var jr;(function(r){r.Text="text",r.JSON="json"})(jr=J.TraceFormat||(J.TraceFormat={}));(function(r){function e(t){return Et.string(t)?(t=t.toLowerCase(),t==="json"?r.JSON:r.Text):r.Text}r.fromString=e})(jr=J.TraceFormat||(J.TraceFormat={}));var Ly;(function(r){r.type=new Q.NotificationType("$/setTrace")})(Ly=J.SetTraceNotification||(J.SetTraceNotification={}));var Ud;(function(r){r.type=new Q.NotificationType("$/logTrace")})(Ud=J.LogTraceNotification||(J.LogTraceNotification={}));var ws;(function(r){r[r.Closed=1]="Closed",r[r.Disposed=2]="Disposed",r[r.AlreadyListening=3]="AlreadyListening"})(ws=J.ConnectionErrors||(J.ConnectionErrors={}));var ni=class extends Error{constructor(e,t){super(t),this.code=e,Object.setPrototypeOf(this,ni.prototype)}};J.ConnectionError=ni;var Fy;(function(r){function e(t){let n=t;return n&&Et.func(n.cancelUndispatched)}r.is=e})(Fy=J.ConnectionStrategy||(J.ConnectionStrategy={}));var Hd;(function(r){r.Message=Object.freeze({createCancellationTokenSource(t){return new qd.CancellationTokenSource}});function e(t){let n=t;return n&&Et.func(n.createCancellationTokenSource)}r.is=e})(Hd=J.CancellationReceiverStrategy||(J.CancellationReceiverStrategy={}));var Wd;(function(r){r.Message=Object.freeze({sendCancellation(t,n){return t.sendNotification(da.type,{id:n})},cleanup(t){}});function e(t){let n=t;return n&&Et.func(n.sendCancellation)&&Et.func(n.cleanup)}r.is=e})(Wd=J.CancellationSenderStrategy||(J.CancellationSenderStrategy={}));var Kd;(function(r){r.Message=Object.freeze({receiver:Hd.Message,sender:Wd.Message});function e(t){let n=t;return n&&Hd.is(n.receiver)&&Wd.is(n.sender)}r.is=e})(Kd=J.CancellationStrategy||(J.CancellationStrategy={}));var IC;(function(r){function e(t){let n=t;return n&&(Kd.is(n.cancellationStrategy)||Fy.is(n.connectionStrategy))}r.is=e})(IC=J.ConnectionOptions||(J.ConnectionOptions={}));var Gr;(function(r){r[r.New=1]="New",r[r.Listening=2]="Listening",r[r.Closed=3]="Closed",r[r.Disposed=4]="Disposed"})(Gr||(Gr={}));function OC(r,e,t,n){let i=t!==void 0?t:J.NullLogger,o=0,a=0,s=0,u="2.0",c,l=new Map,d,g=new Map,y=new Map,p,A=new $y.LinkedMap,x=new Map,k=new Set,_=new Map,R=Se.Off,D=jr.Text,B,V=Gr.New,G=new ca.Emitter,ge=new ca.Emitter,je=new ca.Emitter,Ze=new ca.Emitter,Ge=new ca.Emitter,L=n&&n.cancellationStrategy?n.cancellationStrategy:Kd.Message;function M(b){if(b===null)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+b.toString()}function F(b){return b===null?"res-unknown-"+(++s).toString():"res-"+b.toString()}function K(){return"not-"+(++a).toString()}function pe(b,O){Q.Message.isRequest(O)?b.set(M(O.id),O):Q.Message.isResponse(O)?b.set(F(O.id),O):b.set(K(),O)}function ee(b){}function ie(){return V===Gr.Listening}function Ae(){return V===Gr.Closed}function Ue(){return V===Gr.Disposed}function ft(){(V===Gr.New||V===Gr.Listening)&&(V=Gr.Closed,ge.fire(void 0))}function ur(b){G.fire([b,void 0,void 0])}function yr(b){G.fire(b)}r.onClose(ft),r.onError(ur),e.onClose(ft),e.onError(yr);function Xi(){p||A.size===0||(p=(0,Oy.default)().timer.setImmediate(()=>{p=void 0,Ji()}))}function Ji(){if(A.size===0)return;let b=A.shift();try{Q.Message.isRequest(b)?Zi(b):Q.Message.isNotification(b)?ia(b):Q.Message.isResponse(b)?Qi(b):Rr(b)}finally{Xi()}}let Qt=b=>{try{if(Q.Message.isNotification(b)&&b.method===da.type.method){let O=b.params.id,j=M(O),z=A.get(j);if(Q.Message.isRequest(z)){let $e=n?.connectionStrategy,Qe=$e&&$e.cancelUndispatched?$e.cancelUndispatched(z,ee):void 0;if(Qe&&(Qe.error!==void 0||Qe.result!==void 0)){A.delete(j),_.delete(O),Qe.id=z.id,un(Qe,b.method,Date.now()),e.write(Qe).catch(()=>i.error("Sending response for canceled message failed."));return}}let Oe=_.get(O);if(Oe!==void 0){Oe.cancel(),In(b);return}else k.add(O)}pe(A,b)}finally{Xi()}};function Zi(b){if(Ue())return;function O(le,He,ve){let pt={jsonrpc:u,id:b.id};le instanceof Q.ResponseError?pt.error=le.toJson():pt.result=le===void 0?null:le,un(pt,He,ve),e.write(pt).catch(()=>i.error("Sending response failed."))}function j(le,He,ve){let pt={jsonrpc:u,id:b.id,error:le.toJson()};un(pt,He,ve),e.write(pt).catch(()=>i.error("Sending response failed."))}function z(le,He,ve){le===void 0&&(le=null);let pt={jsonrpc:u,id:b.id,result:le};un(pt,He,ve),e.write(pt).catch(()=>i.error("Sending response failed."))}ti(b);let Oe=l.get(b.method),$e,Qe;Oe&&($e=Oe.type,Qe=Oe.handler);let ht=Date.now();if(Qe||c){let le=b.id??String(Date.now()),He=L.receiver.createCancellationTokenSource(le);b.id!==null&&k.has(b.id)&&He.cancel(),b.id!==null&&_.set(le,He);try{let ve;if(Qe)if(b.params===void 0){if($e!==void 0&&$e.numberOfParams!==0){j(new Q.ResponseError(Q.ErrorCodes.InvalidParams,`Request ${b.method} defines ${$e.numberOfParams} params but received none.`),b.method,ht);return}ve=Qe(He.token)}else if(Array.isArray(b.params)){if($e!==void 0&&$e.parameterStructures===Q.ParameterStructures.byName){j(new Q.ResponseError(Q.ErrorCodes.InvalidParams,`Request ${b.method} defines parameters by name but received parameters by position`),b.method,ht);return}ve=Qe(...b.params,He.token)}else{if($e!==void 0&&$e.parameterStructures===Q.ParameterStructures.byPosition){j(new Q.ResponseError(Q.ErrorCodes.InvalidParams,`Request ${b.method} defines parameters by position but received parameters by name`),b.method,ht);return}ve=Qe(b.params,He.token)}else c&&(ve=c(b.method,b.params,He.token));let pt=ve;ve?pt.then?pt.then(Ht=>{_.delete(le),O(Ht,b.method,ht)},Ht=>{_.delete(le),Ht instanceof Q.ResponseError?j(Ht,b.method,ht):Ht&&Et.string(Ht.message)?j(new Q.ResponseError(Q.ErrorCodes.InternalError,`Request ${b.method} failed with message: ${Ht.message}`),b.method,ht):j(new Q.ResponseError(Q.ErrorCodes.InternalError,`Request ${b.method} failed unexpectedly without providing any details.`),b.method,ht)}):(_.delete(le),O(ve,b.method,ht)):(_.delete(le),z(ve,b.method,ht))}catch(ve){_.delete(le),ve instanceof Q.ResponseError?O(ve,b.method,ht):ve&&Et.string(ve.message)?j(new Q.ResponseError(Q.ErrorCodes.InternalError,`Request ${b.method} failed with message: ${ve.message}`),b.method,ht):j(new Q.ResponseError(Q.ErrorCodes.InternalError,`Request ${b.method} failed unexpectedly without providing any details.`),b.method,ht)}}else j(new Q.ResponseError(Q.ErrorCodes.MethodNotFound,`Unhandled method ${b.method}`),b.method,ht)}function Qi(b){if(!Ue())if(b.id===null)b.error?i.error(`Received response message without id: Error is:
4
- ${JSON.stringify(b.error,void 0,4)}`):i.error("Received response message without id. No further error information provided.");else{let O=b.id,j=x.get(O);if(Pi(b,j),j!==void 0){x.delete(O);try{if(b.error){let z=b.error;j.reject(new Q.ResponseError(z.code,z.message,z.data))}else if(b.result!==void 0)j.resolve(b.result);else throw new Error("Should never happen.")}catch(z){z.message?i.error(`Response handler '${j.method}' failed with message: ${z.message}`):i.error(`Response handler '${j.method}' failed unexpectedly.`)}}}}function ia(b){if(Ue())return;let O,j;if(b.method===da.type.method){let z=b.params.id;k.delete(z),In(b);return}else{let z=g.get(b.method);z&&(j=z.handler,O=z.type)}if(j||d)try{if(In(b),j)if(b.params===void 0)O!==void 0&&O.numberOfParams!==0&&O.parameterStructures!==Q.ParameterStructures.byName&&i.error(`Notification ${b.method} defines ${O.numberOfParams} params but received none.`),j();else if(Array.isArray(b.params)){let z=b.params;b.method===la.type.method&&z.length===2&&My.is(z[0])?j({token:z[0],value:z[1]}):(O!==void 0&&(O.parameterStructures===Q.ParameterStructures.byName&&i.error(`Notification ${b.method} defines parameters by name but received parameters by position`),O.numberOfParams!==b.params.length&&i.error(`Notification ${b.method} defines ${O.numberOfParams} params but received ${z.length} arguments`)),j(...z))}else O!==void 0&&O.parameterStructures===Q.ParameterStructures.byPosition&&i.error(`Notification ${b.method} defines parameters by position but received parameters by name`),j(b.params);else d&&d(b.method,b.params)}catch(z){z.message?i.error(`Notification handler '${b.method}' failed with message: ${z.message}`):i.error(`Notification handler '${b.method}' failed unexpectedly.`)}else je.fire(b)}function Rr(b){if(!b){i.error("Received empty message.");return}i.error(`Received message which is neither a response nor a notification message:
1
+ "use strict";var YE=Object.create;var Wl=Object.defineProperty;var XE=Object.getOwnPropertyDescriptor;var JE=Object.getOwnPropertyNames,ly=Object.getOwnPropertySymbols,fy=Object.getPrototypeOf,py=Object.prototype.hasOwnProperty,ZE=Object.prototype.propertyIsEnumerable,QE=Reflect.get;var dy=(r,e,t)=>e in r?Wl(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,my=(r,e)=>{for(var t in e||={})py.call(e,t)&&dy(r,t,e[t]);if(ly)for(var t of ly(e))ZE.call(e,t)&&dy(r,t,e[t]);return r};var C=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var eC=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of JE(e))!py.call(r,i)&&i!==t&&Wl(r,i,{get:()=>e[i],enumerable:!(n=XE(e,i))||n.enumerable});return r};var Ht=(r,e,t)=>(t=r!=null?YE(fy(r)):{},eC(e||!r||!r.__esModule?Wl(t,"default",{value:r,enumerable:!0}):t,r));var bs=(r,e,t)=>QE(fy(r),t,e);var no=(r,e,t)=>new Promise((n,i)=>{var o=u=>{try{s(t.next(u))}catch(c){i(c)}},a=u=>{try{s(t.throw(u))}catch(c){i(c)}},s=u=>u.done?n(u.value):Promise.resolve(u.value).then(o,a);s((t=t.apply(r,e)).next())});var Es=C(yt=>{"use strict";Object.defineProperty(yt,"__esModule",{value:!0});yt.thenable=yt.typedArray=yt.stringArray=yt.array=yt.func=yt.error=yt.number=yt.string=yt.boolean=void 0;function tC(r){return r===!0||r===!1}yt.boolean=tC;function hy(r){return typeof r=="string"||r instanceof String}yt.string=hy;function rC(r){return typeof r=="number"||r instanceof Number}yt.number=rC;function nC(r){return r instanceof Error}yt.error=nC;function yy(r){return typeof r=="function"}yt.func=yy;function gy(r){return Array.isArray(r)}yt.array=gy;function iC(r){return gy(r)&&r.every(e=>hy(e))}yt.stringArray=iC;function oC(r,e){return Array.isArray(r)&&r.every(e)}yt.typedArray=oC;function aC(r){return r&&yy(r.then)}yt.thenable=aC});var Mn=C(zl=>{"use strict";Object.defineProperty(zl,"__esModule",{value:!0});var Kl;function Bl(){if(Kl===void 0)throw new Error("No runtime abstraction layer installed");return Kl}(function(r){function e(t){if(t===void 0)throw new Error("No runtime abstraction layer provided");Kl=t}r.install=e})(Bl||(Bl={}));zl.default=Bl});var Vl=C(aa=>{"use strict";Object.defineProperty(aa,"__esModule",{value:!0});aa.Disposable=void 0;var sC;(function(r){function e(t){return{dispose:t}}r.create=e})(sC=aa.Disposable||(aa.Disposable={}))});var vy=C(Cs=>{"use strict";Object.defineProperty(Cs,"__esModule",{value:!0});Cs.AbstractMessageBuffer=void 0;var uC=13,cC=10,lC=`\r
2
+ `,Yl=class{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(){if(this._chunks.length===0)return;let e=0,t=0,n=0,i=0;e:for(;t<this._chunks.length;){let u=this._chunks[t];n=0;t:for(;n<u.length;){switch(u[n]){case uC:switch(e){case 0:e=1;break;case 2:e=3;break;default:e=0}break;case cC:switch(e){case 1:e=2;break;case 3:e=4,n++;break e;default:e=0}break;default:e=0}n++}i+=u.byteLength,t++}if(e!==4)return;let o=this._read(i+n),a=new Map,s=this.toString(o,"ascii").split(lC);if(s.length<2)return a;for(let u=0;u<s.length-2;u++){let c=s[u],l=c.indexOf(":");if(l===-1)throw new Error("Message header must separate key and value using :");let d=c.substr(0,l),g=c.substr(l+1).trim();a.set(d,g)}return a}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 new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===e){let o=this._chunks[0];return this._chunks.shift(),this._totalLength-=e,this.asNative(o)}if(this._chunks[0].byteLength>e){let o=this._chunks[0],a=this.asNative(o,e);return this._chunks[0]=o.slice(e),this._totalLength-=e,a}let t=this.allocNative(e),n=0,i=0;for(;e>0;){let o=this._chunks[i];if(o.byteLength>e){let a=o.slice(0,e);t.set(a,n),n+=e,this._chunks[i]=o.slice(e),this._totalLength-=e,e-=e}else t.set(o,n),n+=o.byteLength,this._chunks.shift(),this._totalLength-=o.byteLength,e-=o.byteLength}return t}};Cs.AbstractMessageBuffer=Yl});var _y=C(Ql=>{"use strict";Object.defineProperty(Ql,"__esModule",{value:!0});var dC=Mn(),Ty=require("util"),ki=Vl(),fC=vy(),io=class extends fC.AbstractMessageBuffer{constructor(e="utf-8"){super(e)}emptyBuffer(){return io.emptyBuffer}fromString(e,t){return Buffer.from(e,t)}toString(e,t){return e instanceof Buffer?e.toString(t):new Ty.TextDecoder(t).decode(e)}asNative(e,t){return t===void 0?e instanceof Buffer?e:Buffer.from(e):e instanceof Buffer?e.slice(0,t):Buffer.from(e,0,t)}allocNative(e){return Buffer.allocUnsafe(e)}};io.emptyBuffer=Buffer.allocUnsafe(0);var Xl=class{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),ki.Disposable.create(()=>this.stream.off("close",e))}onError(e){return this.stream.on("error",e),ki.Disposable.create(()=>this.stream.off("error",e))}onEnd(e){return this.stream.on("end",e),ki.Disposable.create(()=>this.stream.off("end",e))}onData(e){return this.stream.on("data",e),ki.Disposable.create(()=>this.stream.off("data",e))}},Jl=class{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),ki.Disposable.create(()=>this.stream.off("close",e))}onError(e){return this.stream.on("error",e),ki.Disposable.create(()=>this.stream.off("error",e))}onEnd(e){return this.stream.on("end",e),ki.Disposable.create(()=>this.stream.off("end",e))}write(e,t){return new Promise((n,i)=>{let o=a=>{a==null?n():i(a)};typeof e=="string"?this.stream.write(e,t,o):this.stream.write(e,o)})}end(){this.stream.end()}},Ry=Object.freeze({messageBuffer:Object.freeze({create:r=>new io(r)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(r,e)=>{try{return Promise.resolve(Buffer.from(JSON.stringify(r,void 0,0),e.charset))}catch(t){return Promise.reject(t)}}}),decoder:Object.freeze({name:"application/json",decode:(r,e)=>{try{return r instanceof Buffer?Promise.resolve(JSON.parse(r.toString(e.charset))):Promise.resolve(JSON.parse(new Ty.TextDecoder(e.charset).decode(r)))}catch(t){return Promise.reject(t)}}})}),stream:Object.freeze({asReadableStream:r=>new Xl(r),asWritableStream:r=>new Jl(r)}),console,timer:Object.freeze({setTimeout(r,e,...t){let n=setTimeout(r,e,...t);return{dispose:()=>clearTimeout(n)}},setImmediate(r,...e){let t=setImmediate(r,...e);return{dispose:()=>clearImmediate(t)}},setInterval(r,e,...t){let n=setInterval(r,e,...t);return{dispose:()=>clearInterval(n)}}})});function Zl(){return Ry}(function(r){function e(){dC.default.install(Ry)}r.install=e})(Zl||(Zl={}));Ql.default=Zl});var oo=C(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.stringArray=Wt.array=Wt.func=Wt.error=Wt.number=Wt.string=Wt.boolean=void 0;function pC(r){return r===!0||r===!1}Wt.boolean=pC;function Ay(r){return typeof r=="string"||r instanceof String}Wt.string=Ay;function mC(r){return typeof r=="number"||r instanceof Number}Wt.number=mC;function hC(r){return r instanceof Error}Wt.error=hC;function yC(r){return typeof r=="function"}Wt.func=yC;function by(r){return Array.isArray(r)}Wt.array=by;function gC(r){return by(r)&&r.every(e=>Ay(e))}Wt.stringArray=gC});var Ad=C(Y=>{"use strict";Object.defineProperty(Y,"__esModule",{value:!0});Y.Message=Y.NotificationType9=Y.NotificationType8=Y.NotificationType7=Y.NotificationType6=Y.NotificationType5=Y.NotificationType4=Y.NotificationType3=Y.NotificationType2=Y.NotificationType1=Y.NotificationType0=Y.NotificationType=Y.RequestType9=Y.RequestType8=Y.RequestType7=Y.RequestType6=Y.RequestType5=Y.RequestType4=Y.RequestType3=Y.RequestType2=Y.RequestType1=Y.RequestType=Y.RequestType0=Y.AbstractMessageSignature=Y.ParameterStructures=Y.ResponseError=Y.ErrorCodes=void 0;var xi=oo(),Ey;(function(r){r.ParseError=-32700,r.InvalidRequest=-32600,r.MethodNotFound=-32601,r.InvalidParams=-32602,r.InternalError=-32603,r.jsonrpcReservedErrorRangeStart=-32099,r.serverErrorStart=-32099,r.MessageWriteError=-32099,r.MessageReadError=-32098,r.PendingResponseRejected=-32097,r.ConnectionInactive=-32096,r.ServerNotInitialized=-32002,r.UnknownErrorCode=-32001,r.jsonrpcReservedErrorRangeEnd=-32e3,r.serverErrorEnd=-32e3})(Ey=Y.ErrorCodes||(Y.ErrorCodes={}));var sa=class extends Error{constructor(e,t,n){super(t),this.code=xi.number(e)?e:Ey.UnknownErrorCode,this.data=n,Object.setPrototypeOf(this,sa.prototype)}toJson(){let e={code:this.code,message:this.message};return this.data!==void 0&&(e.data=this.data),e}};Y.ResponseError=sa;var St=class{constructor(e){this.kind=e}static is(e){return e===St.auto||e===St.byName||e===St.byPosition}toString(){return this.kind}};Y.ParameterStructures=St;St.auto=new St("auto");St.byPosition=new St("byPosition");St.byName=new St("byName");var Xe=class{constructor(e,t){this.method=e,this.numberOfParams=t}get parameterStructures(){return St.auto}};Y.AbstractMessageSignature=Xe;var ed=class extends Xe{constructor(e){super(e,0)}};Y.RequestType0=ed;var td=class extends Xe{constructor(e,t=St.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};Y.RequestType=td;var rd=class extends Xe{constructor(e,t=St.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};Y.RequestType1=rd;var nd=class extends Xe{constructor(e){super(e,2)}};Y.RequestType2=nd;var id=class extends Xe{constructor(e){super(e,3)}};Y.RequestType3=id;var od=class extends Xe{constructor(e){super(e,4)}};Y.RequestType4=od;var ad=class extends Xe{constructor(e){super(e,5)}};Y.RequestType5=ad;var sd=class extends Xe{constructor(e){super(e,6)}};Y.RequestType6=sd;var ud=class extends Xe{constructor(e){super(e,7)}};Y.RequestType7=ud;var cd=class extends Xe{constructor(e){super(e,8)}};Y.RequestType8=cd;var ld=class extends Xe{constructor(e){super(e,9)}};Y.RequestType9=ld;var dd=class extends Xe{constructor(e,t=St.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};Y.NotificationType=dd;var fd=class extends Xe{constructor(e){super(e,0)}};Y.NotificationType0=fd;var pd=class extends Xe{constructor(e,t=St.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};Y.NotificationType1=pd;var md=class extends Xe{constructor(e){super(e,2)}};Y.NotificationType2=md;var hd=class extends Xe{constructor(e){super(e,3)}};Y.NotificationType3=hd;var yd=class extends Xe{constructor(e){super(e,4)}};Y.NotificationType4=yd;var gd=class extends Xe{constructor(e){super(e,5)}};Y.NotificationType5=gd;var vd=class extends Xe{constructor(e){super(e,6)}};Y.NotificationType6=vd;var Td=class extends Xe{constructor(e){super(e,7)}};Y.NotificationType7=Td;var Rd=class extends Xe{constructor(e){super(e,8)}};Y.NotificationType8=Rd;var _d=class extends Xe{constructor(e){super(e,9)}};Y.NotificationType9=_d;var vC;(function(r){function e(i){let o=i;return o&&xi.string(o.method)&&(xi.string(o.id)||xi.number(o.id))}r.isRequest=e;function t(i){let o=i;return o&&xi.string(o.method)&&i.id===void 0}r.isNotification=t;function n(i){let o=i;return o&&(o.result!==void 0||!!o.error)&&(xi.string(o.id)||xi.number(o.id)||o.id===null)}r.isResponse=n})(vC=Y.Message||(Y.Message={}))});var Ed=C(Ln=>{"use strict";var Cy;Object.defineProperty(Ln,"__esModule",{value:!0});Ln.LRUCache=Ln.LinkedMap=Ln.Touch=void 0;var er;(function(r){r.None=0,r.First=1,r.AsOld=r.First,r.Last=2,r.AsNew=r.Last})(er=Ln.Touch||(Ln.Touch={}));var Ps=class{constructor(){this[Cy]="LinkedMap",this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){return this._head?.value}get last(){return this._tail?.value}has(e){return this._map.has(e)}get(e,t=er.None){let n=this._map.get(e);if(!!n)return t!==er.None&&this.touch(n,t),n.value}set(e,t,n=er.None){let i=this._map.get(e);if(i)i.value=t,n!==er.None&&this.touch(i,n);else{switch(i={key:e,value:t,next:void 0,previous:void 0},n){case er.None:this.addItemLast(i);break;case er.First:this.addItemFirst(i);break;case er.Last:this.addItemLast(i);break;default:this.addItemLast(i);break}this._map.set(e,i),this._size++}return this}delete(e){return!!this.remove(e)}remove(e){let t=this._map.get(e);if(!!t)return this._map.delete(e),this.removeItem(t),this._size--,t.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");let e=this._head;return this._map.delete(e.key),this.removeItem(e),this._size--,e.value}forEach(e,t){let n=this._state,i=this._head;for(;i;){if(t?e.bind(t)(i.value,i.key,this):e(i.value,i.key,this),this._state!==n)throw new Error("LinkedMap got modified during iteration.");i=i.next}}keys(){let e=this._state,t=this._head,n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){let i={value:t.key,done:!1};return t=t.next,i}else return{value:void 0,done:!0}}};return n}values(){let e=this._state,t=this._head,n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){let i={value:t.value,done:!1};return t=t.next,i}else return{value:void 0,done:!0}}};return n}entries(){let e=this._state,t=this._head,n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){let i={value:[t.key,t.value],done:!1};return t=t.next,i}else return{value:void 0,done:!0}}};return n}[(Cy=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(e){if(e>=this.size)return;if(e===0){this.clear();return}let t=this._head,n=this.size;for(;t&&n>e;)this._map.delete(t.key),t=t.next,n--;this._head=t,this._size=n,t&&(t.previous=void 0),this._state++}addItemFirst(e){if(!this._head&&!this._tail)this._tail=e;else if(this._head)e.next=this._head,this._head.previous=e;else throw new Error("Invalid list");this._head=e,this._state++}addItemLast(e){if(!this._head&&!this._tail)this._head=e;else if(this._tail)e.previous=this._tail,this._tail.next=e;else throw new Error("Invalid list");this._tail=e,this._state++}removeItem(e){if(e===this._head&&e===this._tail)this._head=void 0,this._tail=void 0;else if(e===this._head){if(!e.next)throw new Error("Invalid list");e.next.previous=void 0,this._head=e.next}else if(e===this._tail){if(!e.previous)throw new Error("Invalid list");e.previous.next=void 0,this._tail=e.previous}else{let t=e.next,n=e.previous;if(!t||!n)throw new Error("Invalid list");t.previous=n,n.next=t}e.next=void 0,e.previous=void 0,this._state++}touch(e,t){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(t!==er.First&&t!==er.Last)){if(t===er.First){if(e===this._head)return;let n=e.next,i=e.previous;e===this._tail?(i.next=void 0,this._tail=i):(n.previous=i,i.next=n),e.previous=void 0,e.next=this._head,this._head.previous=e,this._head=e,this._state++}else if(t===er.Last){if(e===this._tail)return;let n=e.next,i=e.previous;e===this._head?(n.previous=void 0,this._head=n):(n.previous=i,i.next=n),e.next=void 0,e.previous=this._tail,this._tail.next=e,this._tail=e,this._state++}}}toJSON(){let e=[];return this.forEach((t,n)=>{e.push([n,t])}),e}fromJSON(e){this.clear();for(let[t,n]of e)this.set(t,n)}};Ln.LinkedMap=Ps;var bd=class extends Ps{constructor(e,t=1){super(),this._limit=e,this._ratio=Math.min(Math.max(0,t),1)}get limit(){return this._limit}set limit(e){this._limit=e,this.checkTrim()}get ratio(){return this._ratio}set ratio(e){this._ratio=Math.min(Math.max(0,e),1),this.checkTrim()}get(e,t=er.AsNew){return super.get(e,t)}peek(e){return super.get(e,er.None)}set(e,t){return super.set(e,t,er.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}};Ln.LRUCache=bd});var so=C(Si=>{"use strict";Object.defineProperty(Si,"__esModule",{value:!0});Si.Emitter=Si.Event=void 0;var TC=Mn(),RC;(function(r){let e={dispose(){}};r.None=function(){return e}})(RC=Si.Event||(Si.Event={}));var Cd=class{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:()=>this.remove(e,t)})}remove(e,t=null){if(!this._callbacks)return;let n=!1;for(let i=0,o=this._callbacks.length;i<o;i++)if(this._callbacks[i]===e)if(this._contexts[i]===t){this._callbacks.splice(i,1),this._contexts.splice(i,1);return}else n=!0;if(n)throw new Error("When adding a listener with a context, you should remove it with the same context")}invoke(...e){if(!this._callbacks)return[];let t=[],n=this._callbacks.slice(0),i=this._contexts.slice(0);for(let o=0,a=n.length;o<a;o++)try{t.push(n[o].apply(i[o],e))}catch(s){(0,TC.default)().console.error(s)}return t}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}},ao=class{constructor(e){this._options=e}get event(){return this._event||(this._event=(e,t,n)=>{this._callbacks||(this._callbacks=new Cd),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(e,t);let i={dispose:()=>{!this._callbacks||(this._callbacks.remove(e,t),i.dispose=ao._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(n)&&n.push(i),i}),this._event}fire(e){this._callbacks&&this._callbacks.invoke.call(this._callbacks,e)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}};Si.Emitter=ao;ao._noop=function(){}});var Sd=C(Ni=>{"use strict";Object.defineProperty(Ni,"__esModule",{value:!0});Ni.CancellationTokenSource=Ni.CancellationToken=void 0;var _C=Mn(),AC=oo(),Pd=so(),kd;(function(r){r.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Pd.Event.None}),r.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Pd.Event.None});function e(t){let n=t;return n&&(n===r.None||n===r.Cancelled||AC.boolean(n.isCancellationRequested)&&!!n.onCancellationRequested)}r.is=e})(kd=Ni.CancellationToken||(Ni.CancellationToken={}));var bC=Object.freeze(function(r,e){let t=(0,_C.default)().timer.setTimeout(r.bind(e),0);return{dispose(){t.dispose()}}}),ks=class{constructor(){this._isCancelled=!1}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?bC:(this._emitter||(this._emitter=new Pd.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}},xd=class{get token(){return this._token||(this._token=new ks),this._token}cancel(){this._token?this._token.cancel():this._token=kd.Cancelled}dispose(){this._token?this._token instanceof ks&&this._token.dispose():this._token=kd.None}};Ni.CancellationTokenSource=xd});var Py=C(Fn=>{"use strict";Object.defineProperty(Fn,"__esModule",{value:!0});Fn.ReadableStreamMessageReader=Fn.AbstractMessageReader=Fn.MessageReader=void 0;var Dd=Mn(),uo=oo(),Nd=so(),EC;(function(r){function e(t){let n=t;return n&&uo.func(n.listen)&&uo.func(n.dispose)&&uo.func(n.onError)&&uo.func(n.onClose)&&uo.func(n.onPartialMessage)}r.is=e})(EC=Fn.MessageReader||(Fn.MessageReader={}));var xs=class{constructor(){this.errorEmitter=new Nd.Emitter,this.closeEmitter=new Nd.Emitter,this.partialMessageEmitter=new Nd.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e){this.errorEmitter.fire(this.asError(e))}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}get onPartialMessage(){return this.partialMessageEmitter.event}firePartialMessage(e){this.partialMessageEmitter.fire(e)}asError(e){return e instanceof Error?e:new Error(`Reader received error. Reason: ${uo.string(e.message)?e.message:"unknown"}`)}};Fn.AbstractMessageReader=xs;var wd;(function(r){function e(t){let n,i,o,a=new Map,s,u=new Map;if(t===void 0||typeof t=="string")n=t??"utf-8";else{if(n=t.charset??"utf-8",t.contentDecoder!==void 0&&(o=t.contentDecoder,a.set(o.name,o)),t.contentDecoders!==void 0)for(let c of t.contentDecoders)a.set(c.name,c);if(t.contentTypeDecoder!==void 0&&(s=t.contentTypeDecoder,u.set(s.name,s)),t.contentTypeDecoders!==void 0)for(let c of t.contentTypeDecoders)u.set(c.name,c)}return s===void 0&&(s=(0,Dd.default)().applicationJson.decoder,u.set(s.name,s)),{charset:n,contentDecoder:o,contentDecoders:a,contentTypeDecoder:s,contentTypeDecoders:u}}r.fromOptions=e})(wd||(wd={}));var Id=class extends xs{constructor(e,t){super(),this.readable=e,this.options=wd.fromOptions(t),this.buffer=(0,Dd.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0}set partialMessageTimeout(e){this._partialMessageTimeout=e}get partialMessageTimeout(){return this._partialMessageTimeout}listen(e){this.nextMessageLength=-1,this.messageToken=0,this.partialMessageTimer=void 0,this.callback=e;let t=this.readable.onData(n=>{this.onData(n)});return this.readable.onError(n=>this.fireError(n)),this.readable.onClose(()=>this.fireClose()),t}onData(e){for(this.buffer.append(e);;){if(this.nextMessageLength===-1){let i=this.buffer.tryReadHeaders();if(!i)return;let o=i.get("Content-Length");if(!o)throw new Error("Header must provide a Content-Length property.");let a=parseInt(o);if(isNaN(a))throw new Error("Content-Length value must be a number.");this.nextMessageLength=a}let t=this.buffer.tryReadBody(this.nextMessageLength);if(t===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1;let n;this.options.contentDecoder!==void 0?n=this.options.contentDecoder.decode(t):n=Promise.resolve(t),n.then(i=>{this.options.contentTypeDecoder.decode(i,this.options).then(o=>{this.callback(o)},o=>{this.fireError(o)})},i=>{this.fireError(i)})}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=(0,Dd.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))}};Fn.ReadableStreamMessageReader=Id});var ky=C(Ss=>{"use strict";Object.defineProperty(Ss,"__esModule",{value:!0});Ss.Semaphore=void 0;var CC=Mn(),Od=class{constructor(e=1){if(e<=0)throw new Error("Capacity must be greater than 0");this._capacity=e,this._active=0,this._waiting=[]}lock(e){return new Promise((t,n)=>{this._waiting.push({thunk:e,resolve:t,reject:n}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length===0||this._active===this._capacity||(0,CC.default)().timer.setImmediate(()=>this.doRunNext())}doRunNext(){if(this._waiting.length===0||this._active===this._capacity)return;let e=this._waiting.shift();if(this._active++,this._active>this._capacity)throw new Error("To many thunks active");try{let t=e.thunk();t instanceof Promise?t.then(n=>{this._active--,e.resolve(n),this.runNext()},n=>{this._active--,e.reject(n),this.runNext()}):(this._active--,e.resolve(t),this.runNext())}catch(t){this._active--,e.reject(t),this.runNext()}}};Ss.Semaphore=Od});var Dy=C(qn=>{"use strict";Object.defineProperty(qn,"__esModule",{value:!0});qn.WriteableStreamMessageWriter=qn.AbstractMessageWriter=qn.MessageWriter=void 0;var xy=Mn(),ua=oo(),PC=ky(),Sy=so(),kC="Content-Length: ",Ny=`\r
3
+ `,xC;(function(r){function e(t){let n=t;return n&&ua.func(n.dispose)&&ua.func(n.onClose)&&ua.func(n.onError)&&ua.func(n.write)}r.is=e})(xC=qn.MessageWriter||(qn.MessageWriter={}));var Ns=class{constructor(){this.errorEmitter=new Sy.Emitter,this.closeEmitter=new Sy.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:new Error(`Writer received error. Reason: ${ua.string(e.message)?e.message:"unknown"}`)}};qn.AbstractMessageWriter=Ns;var $d;(function(r){function e(t){return t===void 0||typeof t=="string"?{charset:t??"utf-8",contentTypeEncoder:(0,xy.default)().applicationJson.encoder}:{charset:t.charset??"utf-8",contentEncoder:t.contentEncoder,contentTypeEncoder:t.contentTypeEncoder??(0,xy.default)().applicationJson.encoder}}r.fromOptions=e})($d||($d={}));var Md=class extends Ns{constructor(e,t){super(),this.writable=e,this.options=$d.fromOptions(t),this.errorCount=0,this.writeSemaphore=new PC.Semaphore(1),this.writable.onError(n=>this.fireError(n)),this.writable.onClose(()=>this.fireClose())}async write(e){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(e,this.options).then(n=>this.options.contentEncoder!==void 0?this.options.contentEncoder.encode(n):n).then(n=>{let i=[];return i.push(kC,n.byteLength.toString(),Ny),i.push(Ny),this.doWrite(e,i,n)},n=>{throw this.fireError(n),n}))}async doWrite(e,t,n){try{return await this.writable.write(t.join(""),"ascii"),this.writable.write(n)}catch(i){return this.handleError(i,e),Promise.reject(i)}}handleError(e,t){this.errorCount++,this.fireError(e,t,this.errorCount)}end(){this.writable.end()}};qn.WriteableStreamMessageWriter=Md});var Ly=C(J=>{"use strict";Object.defineProperty(J,"__esModule",{value:!0});J.createMessageConnection=J.ConnectionOptions=J.CancellationStrategy=J.CancellationSenderStrategy=J.CancellationReceiverStrategy=J.ConnectionStrategy=J.ConnectionError=J.ConnectionErrors=J.LogTraceNotification=J.SetTraceNotification=J.TraceFormat=J.TraceValues=J.Trace=J.NullLogger=J.ProgressType=J.ProgressToken=void 0;var wy=Mn(),Et=oo(),Q=Ad(),Iy=Ed(),ca=so(),Ld=Sd(),da;(function(r){r.type=new Q.NotificationType("$/cancelRequest")})(da||(da={}));var Oy;(function(r){function e(t){return typeof t=="string"||typeof t=="number"}r.is=e})(Oy=J.ProgressToken||(J.ProgressToken={}));var la;(function(r){r.type=new Q.NotificationType("$/progress")})(la||(la={}));var Fd=class{constructor(){}};J.ProgressType=Fd;var qd;(function(r){function e(t){return Et.func(t)}r.is=e})(qd||(qd={}));J.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}});var Se;(function(r){r[r.Off=0]="Off",r[r.Messages=1]="Messages",r[r.Compact=2]="Compact",r[r.Verbose=3]="Verbose"})(Se=J.Trace||(J.Trace={}));var SC;(function(r){r.Off="off",r.Messages="messages",r.Compact="compact",r.Verbose="verbose"})(SC=J.TraceValues||(J.TraceValues={}));(function(r){function e(n){if(!Et.string(n))return r.Off;switch(n=n.toLowerCase(),n){case"off":return r.Off;case"messages":return r.Messages;case"compact":return r.Compact;case"verbose":return r.Verbose;default:return r.Off}}r.fromString=e;function t(n){switch(n){case r.Off:return"off";case r.Messages:return"messages";case r.Compact:return"compact";case r.Verbose:return"verbose";default:return"off"}}r.toString=t})(Se=J.Trace||(J.Trace={}));var jr;(function(r){r.Text="text",r.JSON="json"})(jr=J.TraceFormat||(J.TraceFormat={}));(function(r){function e(t){return Et.string(t)?(t=t.toLowerCase(),t==="json"?r.JSON:r.Text):r.Text}r.fromString=e})(jr=J.TraceFormat||(J.TraceFormat={}));var $y;(function(r){r.type=new Q.NotificationType("$/setTrace")})($y=J.SetTraceNotification||(J.SetTraceNotification={}));var jd;(function(r){r.type=new Q.NotificationType("$/logTrace")})(jd=J.LogTraceNotification||(J.LogTraceNotification={}));var Ds;(function(r){r[r.Closed=1]="Closed",r[r.Disposed=2]="Disposed",r[r.AlreadyListening=3]="AlreadyListening"})(Ds=J.ConnectionErrors||(J.ConnectionErrors={}));var ni=class extends Error{constructor(e,t){super(t),this.code=e,Object.setPrototypeOf(this,ni.prototype)}};J.ConnectionError=ni;var My;(function(r){function e(t){let n=t;return n&&Et.func(n.cancelUndispatched)}r.is=e})(My=J.ConnectionStrategy||(J.ConnectionStrategy={}));var Gd;(function(r){r.Message=Object.freeze({createCancellationTokenSource(t){return new Ld.CancellationTokenSource}});function e(t){let n=t;return n&&Et.func(n.createCancellationTokenSource)}r.is=e})(Gd=J.CancellationReceiverStrategy||(J.CancellationReceiverStrategy={}));var Ud;(function(r){r.Message=Object.freeze({sendCancellation(t,n){return t.sendNotification(da.type,{id:n})},cleanup(t){}});function e(t){let n=t;return n&&Et.func(n.sendCancellation)&&Et.func(n.cleanup)}r.is=e})(Ud=J.CancellationSenderStrategy||(J.CancellationSenderStrategy={}));var Hd;(function(r){r.Message=Object.freeze({receiver:Gd.Message,sender:Ud.Message});function e(t){let n=t;return n&&Gd.is(n.receiver)&&Ud.is(n.sender)}r.is=e})(Hd=J.CancellationStrategy||(J.CancellationStrategy={}));var NC;(function(r){function e(t){let n=t;return n&&(Hd.is(n.cancellationStrategy)||My.is(n.connectionStrategy))}r.is=e})(NC=J.ConnectionOptions||(J.ConnectionOptions={}));var Gr;(function(r){r[r.New=1]="New",r[r.Listening=2]="Listening",r[r.Closed=3]="Closed",r[r.Disposed=4]="Disposed"})(Gr||(Gr={}));function DC(r,e,t,n){let i=t!==void 0?t:J.NullLogger,o=0,a=0,s=0,u="2.0",c,l=new Map,d,g=new Map,y=new Map,p,A=new Iy.LinkedMap,x=new Map,k=new Set,_=new Map,R=Se.Off,D=jr.Text,B,V=Gr.New,G=new ca.Emitter,ge=new ca.Emitter,je=new ca.Emitter,Ze=new ca.Emitter,Ge=new ca.Emitter,L=n&&n.cancellationStrategy?n.cancellationStrategy:Hd.Message;function M(b){if(b===null)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+b.toString()}function F(b){return b===null?"res-unknown-"+(++s).toString():"res-"+b.toString()}function K(){return"not-"+(++a).toString()}function pe(b,O){Q.Message.isRequest(O)?b.set(M(O.id),O):Q.Message.isResponse(O)?b.set(F(O.id),O):b.set(K(),O)}function ee(b){}function ie(){return V===Gr.Listening}function Ae(){return V===Gr.Closed}function Ue(){return V===Gr.Disposed}function ft(){(V===Gr.New||V===Gr.Listening)&&(V=Gr.Closed,ge.fire(void 0))}function ur(b){G.fire([b,void 0,void 0])}function yr(b){G.fire(b)}r.onClose(ft),r.onError(ur),e.onClose(ft),e.onError(yr);function Xi(){p||A.size===0||(p=(0,wy.default)().timer.setImmediate(()=>{p=void 0,Ji()}))}function Ji(){if(A.size===0)return;let b=A.shift();try{Q.Message.isRequest(b)?Zi(b):Q.Message.isNotification(b)?ia(b):Q.Message.isResponse(b)?Qi(b):Rr(b)}finally{Xi()}}let Qt=b=>{try{if(Q.Message.isNotification(b)&&b.method===da.type.method){let O=b.params.id,j=M(O),z=A.get(j);if(Q.Message.isRequest(z)){let $e=n?.connectionStrategy,Qe=$e&&$e.cancelUndispatched?$e.cancelUndispatched(z,ee):void 0;if(Qe&&(Qe.error!==void 0||Qe.result!==void 0)){A.delete(j),_.delete(O),Qe.id=z.id,un(Qe,b.method,Date.now()),e.write(Qe).catch(()=>i.error("Sending response for canceled message failed."));return}}let Oe=_.get(O);if(Oe!==void 0){Oe.cancel(),wn(b);return}else k.add(O)}pe(A,b)}finally{Xi()}};function Zi(b){if(Ue())return;function O(le,He,ve){let pt={jsonrpc:u,id:b.id};le instanceof Q.ResponseError?pt.error=le.toJson():pt.result=le===void 0?null:le,un(pt,He,ve),e.write(pt).catch(()=>i.error("Sending response failed."))}function j(le,He,ve){let pt={jsonrpc:u,id:b.id,error:le.toJson()};un(pt,He,ve),e.write(pt).catch(()=>i.error("Sending response failed."))}function z(le,He,ve){le===void 0&&(le=null);let pt={jsonrpc:u,id:b.id,result:le};un(pt,He,ve),e.write(pt).catch(()=>i.error("Sending response failed."))}ti(b);let Oe=l.get(b.method),$e,Qe;Oe&&($e=Oe.type,Qe=Oe.handler);let ht=Date.now();if(Qe||c){let le=b.id??String(Date.now()),He=L.receiver.createCancellationTokenSource(le);b.id!==null&&k.has(b.id)&&He.cancel(),b.id!==null&&_.set(le,He);try{let ve;if(Qe)if(b.params===void 0){if($e!==void 0&&$e.numberOfParams!==0){j(new Q.ResponseError(Q.ErrorCodes.InvalidParams,`Request ${b.method} defines ${$e.numberOfParams} params but received none.`),b.method,ht);return}ve=Qe(He.token)}else if(Array.isArray(b.params)){if($e!==void 0&&$e.parameterStructures===Q.ParameterStructures.byName){j(new Q.ResponseError(Q.ErrorCodes.InvalidParams,`Request ${b.method} defines parameters by name but received parameters by position`),b.method,ht);return}ve=Qe(...b.params,He.token)}else{if($e!==void 0&&$e.parameterStructures===Q.ParameterStructures.byPosition){j(new Q.ResponseError(Q.ErrorCodes.InvalidParams,`Request ${b.method} defines parameters by position but received parameters by name`),b.method,ht);return}ve=Qe(b.params,He.token)}else c&&(ve=c(b.method,b.params,He.token));let pt=ve;ve?pt.then?pt.then(Ut=>{_.delete(le),O(Ut,b.method,ht)},Ut=>{_.delete(le),Ut instanceof Q.ResponseError?j(Ut,b.method,ht):Ut&&Et.string(Ut.message)?j(new Q.ResponseError(Q.ErrorCodes.InternalError,`Request ${b.method} failed with message: ${Ut.message}`),b.method,ht):j(new Q.ResponseError(Q.ErrorCodes.InternalError,`Request ${b.method} failed unexpectedly without providing any details.`),b.method,ht)}):(_.delete(le),O(ve,b.method,ht)):(_.delete(le),z(ve,b.method,ht))}catch(ve){_.delete(le),ve instanceof Q.ResponseError?O(ve,b.method,ht):ve&&Et.string(ve.message)?j(new Q.ResponseError(Q.ErrorCodes.InternalError,`Request ${b.method} failed with message: ${ve.message}`),b.method,ht):j(new Q.ResponseError(Q.ErrorCodes.InternalError,`Request ${b.method} failed unexpectedly without providing any details.`),b.method,ht)}}else j(new Q.ResponseError(Q.ErrorCodes.MethodNotFound,`Unhandled method ${b.method}`),b.method,ht)}function Qi(b){if(!Ue())if(b.id===null)b.error?i.error(`Received response message without id: Error is:
4
+ ${JSON.stringify(b.error,void 0,4)}`):i.error("Received response message without id. No further error information provided.");else{let O=b.id,j=x.get(O);if(Pi(b,j),j!==void 0){x.delete(O);try{if(b.error){let z=b.error;j.reject(new Q.ResponseError(z.code,z.message,z.data))}else if(b.result!==void 0)j.resolve(b.result);else throw new Error("Should never happen.")}catch(z){z.message?i.error(`Response handler '${j.method}' failed with message: ${z.message}`):i.error(`Response handler '${j.method}' failed unexpectedly.`)}}}}function ia(b){if(Ue())return;let O,j;if(b.method===da.type.method){let z=b.params.id;k.delete(z),wn(b);return}else{let z=g.get(b.method);z&&(j=z.handler,O=z.type)}if(j||d)try{if(wn(b),j)if(b.params===void 0)O!==void 0&&O.numberOfParams!==0&&O.parameterStructures!==Q.ParameterStructures.byName&&i.error(`Notification ${b.method} defines ${O.numberOfParams} params but received none.`),j();else if(Array.isArray(b.params)){let z=b.params;b.method===la.type.method&&z.length===2&&Oy.is(z[0])?j({token:z[0],value:z[1]}):(O!==void 0&&(O.parameterStructures===Q.ParameterStructures.byName&&i.error(`Notification ${b.method} defines parameters by name but received parameters by position`),O.numberOfParams!==b.params.length&&i.error(`Notification ${b.method} defines ${O.numberOfParams} params but received ${z.length} arguments`)),j(...z))}else O!==void 0&&O.parameterStructures===Q.ParameterStructures.byPosition&&i.error(`Notification ${b.method} defines parameters by position but received parameters by name`),j(b.params);else d&&d(b.method,b.params)}catch(z){z.message?i.error(`Notification handler '${b.method}' failed with message: ${z.message}`):i.error(`Notification handler '${b.method}' failed unexpectedly.`)}else je.fire(b)}function Rr(b){if(!b){i.error("Received empty message.");return}i.error(`Received message which is neither a response nor a notification message:
5
5
  ${JSON.stringify(b,null,4)}`);let O=b;if(Et.string(O.id)||Et.number(O.id)){let j=O.id,z=x.get(j);z&&z.reject(new Error("The received response has neither a result nor an error property."))}}function xt(b){if(b!=null)switch(R){case Se.Verbose:return JSON.stringify(b,null,4);case Se.Compact:return JSON.stringify(b);default:return}}function oa(b){if(!(R===Se.Off||!B))if(D===jr.Text){let O;(R===Se.Verbose||R===Se.Compact)&&b.params&&(O=`Params: ${xt(b.params)}
6
6
 
7
7
  `),B.log(`Sending request '${b.method} - (${b.id})'.`,O)}else _r("send-request",b)}function Ci(b){if(!(R===Se.Off||!B))if(D===jr.Text){let O;(R===Se.Verbose||R===Se.Compact)&&(b.params?O=`Params: ${xt(b.params)}
@@ -16,7 +16,7 @@ ${JSON.stringify(b,null,4)}`);let O=b;if(Et.string(O.id)||Et.number(O.id)){let j
16
16
 
17
17
  `)),B.log(`Sending response '${O} - (${b.id})'. Processing request took ${Date.now()-j}ms`,z)}else _r("send-response",b)}function ti(b){if(!(R===Se.Off||!B))if(D===jr.Text){let O;(R===Se.Verbose||R===Se.Compact)&&b.params&&(O=`Params: ${xt(b.params)}
18
18
 
19
- `),B.log(`Received request '${b.method} - (${b.id})'.`,O)}else _r("receive-request",b)}function In(b){if(!(R===Se.Off||!B||b.method===Ud.type.method))if(D===jr.Text){let O;(R===Se.Verbose||R===Se.Compact)&&(b.params?O=`Params: ${xt(b.params)}
19
+ `),B.log(`Received request '${b.method} - (${b.id})'.`,O)}else _r("receive-request",b)}function wn(b){if(!(R===Se.Off||!B||b.method===jd.type.method))if(D===jr.Text){let O;(R===Se.Verbose||R===Se.Compact)&&(b.params?O=`Params: ${xt(b.params)}
20
20
 
21
21
  `:O=`No parameters provided.
22
22
 
@@ -26,11 +26,11 @@ ${JSON.stringify(b,null,4)}`);let O=b;if(Et.string(O.id)||Et.number(O.id)){let j
26
26
 
27
27
  `:b.error===void 0&&(j=`No result returned.
28
28
 
29
- `)),O){let z=b.error?` Request failed: ${b.error.message} (${b.error.code}).`:"";B.log(`Received response '${O.method} - (${b.id})' in ${Date.now()-O.timerStart}ms.${z}`,j)}else B.log(`Received response ${b.id} without active response promise.`,j)}else _r("receive-response",b)}function _r(b,O){if(!B||R===Se.Off)return;let j={isLSPMessage:!0,type:b,message:O,timestamp:Date.now()};B.log(j)}function cn(){if(Ae())throw new ni(ws.Closed,"Connection is closed.");if(Ue())throw new ni(ws.Disposed,"Connection is disposed.")}function eo(){if(ie())throw new ni(ws.AlreadyListening,"Connection is already listening")}function On(){if(!ie())throw new Error("Call listen() first.")}function Lr(b){return b===void 0?null:b}function ut(b){if(b!==null)return b}function ln(b){return b!=null&&!Array.isArray(b)&&typeof b=="object"}function Ar(b,O){switch(b){case Q.ParameterStructures.auto:return ln(O)?ut(O):[Lr(O)];case Q.ParameterStructures.byName:if(!ln(O))throw new Error("Received parameters by name but param is not an object literal.");return ut(O);case Q.ParameterStructures.byPosition:return[Lr(O)];default:throw new Error(`Unknown parameter structure ${b.toString()}`)}}function to(b,O){let j,z=b.numberOfParams;switch(z){case 0:j=void 0;break;case 1:j=Ar(b.parameterStructures,O[0]);break;default:j=[];for(let Oe=0;Oe<O.length&&Oe<z;Oe++)j.push(Lr(O[Oe]));if(O.length<z)for(let Oe=O.length;Oe<z;Oe++)j.push(null);break}return j}let ri={sendNotification:(b,...O)=>{cn();let j,z;if(Et.string(b)){j=b;let $e=O[0],Qe=0,ht=Q.ParameterStructures.auto;Q.ParameterStructures.is($e)&&(Qe=1,ht=$e);let le=O.length,He=le-Qe;switch(He){case 0:z=void 0;break;case 1:z=Ar(ht,O[Qe]);break;default:if(ht===Q.ParameterStructures.byName)throw new Error(`Received ${He} parameters for 'by Name' notification parameter structure.`);z=O.slice(Qe,le).map(ve=>Lr(ve));break}}else{let $e=O;j=b.method,z=to(b,$e)}let Oe={jsonrpc:u,method:j,params:z};return Ci(Oe),e.write(Oe).catch(()=>i.error("Sending notification failed."))},onNotification:(b,O)=>{cn();let j;return Et.func(b)?d=b:O&&(Et.string(b)?(j=b,g.set(b,{type:void 0,handler:O})):(j=b.method,g.set(b.method,{type:b,handler:O}))),{dispose:()=>{j!==void 0?g.delete(j):d=void 0}}},onProgress:(b,O,j)=>{if(y.has(O))throw new Error(`Progress handler for token ${O} already registered`);return y.set(O,j),{dispose:()=>{y.delete(O)}}},sendProgress:(b,O,j)=>ri.sendNotification(la.type,{token:O,value:j}),onUnhandledProgress:Ze.event,sendRequest:(b,...O)=>{cn(),On();let j,z,Oe;if(Et.string(b)){j=b;let le=O[0],He=O[O.length-1],ve=0,pt=Q.ParameterStructures.auto;Q.ParameterStructures.is(le)&&(ve=1,pt=le);let Ht=O.length;qd.CancellationToken.is(He)&&(Ht=Ht-1,Oe=He);let $n=Ht-ve;switch($n){case 0:z=void 0;break;case 1:z=Ar(pt,O[ve]);break;default:if(pt===Q.ParameterStructures.byName)throw new Error(`Received ${$n} parameters for 'by Name' request parameter structure.`);z=O.slice(ve,Ht).map(dn=>Lr(dn));break}}else{let le=O;j=b.method,z=to(b,le);let He=b.numberOfParams;Oe=qd.CancellationToken.is(le[He])?le[He]:void 0}let $e=o++,Qe;return Oe&&(Qe=Oe.onCancellationRequested(()=>{let le=L.sender.sendCancellation(ri,$e);return le===void 0?(i.log(`Received no promise from cancellation strategy when cancelling id ${$e}`),Promise.resolve()):le.catch(()=>{i.log(`Sending cancellation messages for id ${$e} failed`)})})),new Promise((le,He)=>{let ve={jsonrpc:u,id:$e,method:j,params:z},pt=dn=>{le(dn),L.sender.cleanup($e),Qe?.dispose()},Ht=dn=>{He(dn),L.sender.cleanup($e),Qe?.dispose()},$n={method:j,timerStart:Date.now(),resolve:pt,reject:Ht};oa(ve);try{e.write(ve).catch(()=>i.error("Sending request failed."))}catch(dn){$n.reject(new Q.ResponseError(Q.ErrorCodes.MessageWriteError,dn.message?dn.message:"Unknown reason")),$n=null}$n&&x.set($e,$n)})},onRequest:(b,O)=>{cn();let j=null;return Gd.is(b)?(j=void 0,c=b):Et.string(b)?(j=null,O!==void 0&&(j=b,l.set(b,{handler:O,type:void 0}))):O!==void 0&&(j=b.method,l.set(b.method,{type:b,handler:O})),{dispose:()=>{j!==null&&(j!==void 0?l.delete(j):c=void 0)}}},hasPendingResponse:()=>x.size>0,trace:async(b,O,j)=>{let z=!1,Oe=jr.Text;j!==void 0&&(Et.boolean(j)?z=j:(z=j.sendNotification||!1,Oe=j.traceFormat||jr.Text)),R=b,D=Oe,R===Se.Off?B=void 0:B=O,z&&!Ae()&&!Ue()&&await ri.sendNotification(Ly.type,{value:Se.toString(b)})},onError:G.event,onClose:ge.event,onUnhandledNotification:je.event,onDispose:Ge.event,end:()=>{e.end()},dispose:()=>{if(Ue())return;V=Gr.Disposed,Ge.fire(void 0);let b=new Q.ResponseError(Q.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(let O of x.values())O.reject(b);x=new Map,_=new Map,k=new Set,A=new $y.LinkedMap,Et.func(e.dispose)&&e.dispose(),Et.func(r.dispose)&&r.dispose()},listen:()=>{cn(),eo(),V=Gr.Listening,r.listen(Qt)},inspect:()=>{(0,Oy.default)().console.log("inspect")}};return ri.onNotification(Ud.type,b=>{if(R===Se.Off||!B)return;let O=R===Se.Verbose||R===Se.Compact;B.log(b.message,O?b.verbose:void 0)}),ri.onNotification(la.type,b=>{let O=y.get(b.token);O?O(b.value):Ze.fire(b)}),ri}J.createMessageConnection=OC});var Yd=C(w=>{"use strict";Object.defineProperty(w,"__esModule",{value:!0});w.TraceFormat=w.TraceValues=w.Trace=w.ProgressType=w.ProgressToken=w.createMessageConnection=w.NullLogger=w.ConnectionOptions=w.ConnectionStrategy=w.WriteableStreamMessageWriter=w.AbstractMessageWriter=w.MessageWriter=w.ReadableStreamMessageReader=w.AbstractMessageReader=w.MessageReader=w.CancellationToken=w.CancellationTokenSource=w.Emitter=w.Event=w.Disposable=w.LRUCache=w.Touch=w.LinkedMap=w.ParameterStructures=w.NotificationType9=w.NotificationType8=w.NotificationType7=w.NotificationType6=w.NotificationType5=w.NotificationType4=w.NotificationType3=w.NotificationType2=w.NotificationType1=w.NotificationType0=w.NotificationType=w.ErrorCodes=w.ResponseError=w.RequestType9=w.RequestType8=w.RequestType7=w.RequestType6=w.RequestType5=w.RequestType4=w.RequestType3=w.RequestType2=w.RequestType1=w.RequestType0=w.RequestType=w.Message=w.RAL=void 0;w.CancellationStrategy=w.CancellationSenderStrategy=w.CancellationReceiverStrategy=w.ConnectionError=w.ConnectionErrors=w.LogTraceNotification=w.SetTraceNotification=void 0;var Ke=Ed();Object.defineProperty(w,"Message",{enumerable:!0,get:function(){return Ke.Message}});Object.defineProperty(w,"RequestType",{enumerable:!0,get:function(){return Ke.RequestType}});Object.defineProperty(w,"RequestType0",{enumerable:!0,get:function(){return Ke.RequestType0}});Object.defineProperty(w,"RequestType1",{enumerable:!0,get:function(){return Ke.RequestType1}});Object.defineProperty(w,"RequestType2",{enumerable:!0,get:function(){return Ke.RequestType2}});Object.defineProperty(w,"RequestType3",{enumerable:!0,get:function(){return Ke.RequestType3}});Object.defineProperty(w,"RequestType4",{enumerable:!0,get:function(){return Ke.RequestType4}});Object.defineProperty(w,"RequestType5",{enumerable:!0,get:function(){return Ke.RequestType5}});Object.defineProperty(w,"RequestType6",{enumerable:!0,get:function(){return Ke.RequestType6}});Object.defineProperty(w,"RequestType7",{enumerable:!0,get:function(){return Ke.RequestType7}});Object.defineProperty(w,"RequestType8",{enumerable:!0,get:function(){return Ke.RequestType8}});Object.defineProperty(w,"RequestType9",{enumerable:!0,get:function(){return Ke.RequestType9}});Object.defineProperty(w,"ResponseError",{enumerable:!0,get:function(){return Ke.ResponseError}});Object.defineProperty(w,"ErrorCodes",{enumerable:!0,get:function(){return Ke.ErrorCodes}});Object.defineProperty(w,"NotificationType",{enumerable:!0,get:function(){return Ke.NotificationType}});Object.defineProperty(w,"NotificationType0",{enumerable:!0,get:function(){return Ke.NotificationType0}});Object.defineProperty(w,"NotificationType1",{enumerable:!0,get:function(){return Ke.NotificationType1}});Object.defineProperty(w,"NotificationType2",{enumerable:!0,get:function(){return Ke.NotificationType2}});Object.defineProperty(w,"NotificationType3",{enumerable:!0,get:function(){return Ke.NotificationType3}});Object.defineProperty(w,"NotificationType4",{enumerable:!0,get:function(){return Ke.NotificationType4}});Object.defineProperty(w,"NotificationType5",{enumerable:!0,get:function(){return Ke.NotificationType5}});Object.defineProperty(w,"NotificationType6",{enumerable:!0,get:function(){return Ke.NotificationType6}});Object.defineProperty(w,"NotificationType7",{enumerable:!0,get:function(){return Ke.NotificationType7}});Object.defineProperty(w,"NotificationType8",{enumerable:!0,get:function(){return Ke.NotificationType8}});Object.defineProperty(w,"NotificationType9",{enumerable:!0,get:function(){return Ke.NotificationType9}});Object.defineProperty(w,"ParameterStructures",{enumerable:!0,get:function(){return Ke.ParameterStructures}});var Bd=Pd();Object.defineProperty(w,"LinkedMap",{enumerable:!0,get:function(){return Bd.LinkedMap}});Object.defineProperty(w,"LRUCache",{enumerable:!0,get:function(){return Bd.LRUCache}});Object.defineProperty(w,"Touch",{enumerable:!0,get:function(){return Bd.Touch}});var $C=Xl();Object.defineProperty(w,"Disposable",{enumerable:!0,get:function(){return $C.Disposable}});var jy=so();Object.defineProperty(w,"Event",{enumerable:!0,get:function(){return jy.Event}});Object.defineProperty(w,"Emitter",{enumerable:!0,get:function(){return jy.Emitter}});var Gy=Dd();Object.defineProperty(w,"CancellationTokenSource",{enumerable:!0,get:function(){return Gy.CancellationTokenSource}});Object.defineProperty(w,"CancellationToken",{enumerable:!0,get:function(){return Gy.CancellationToken}});var zd=xy();Object.defineProperty(w,"MessageReader",{enumerable:!0,get:function(){return zd.MessageReader}});Object.defineProperty(w,"AbstractMessageReader",{enumerable:!0,get:function(){return zd.AbstractMessageReader}});Object.defineProperty(w,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return zd.ReadableStreamMessageReader}});var Vd=Iy();Object.defineProperty(w,"MessageWriter",{enumerable:!0,get:function(){return Vd.MessageWriter}});Object.defineProperty(w,"AbstractMessageWriter",{enumerable:!0,get:function(){return Vd.AbstractMessageWriter}});Object.defineProperty(w,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return Vd.WriteableStreamMessageWriter}});var Kt=qy();Object.defineProperty(w,"ConnectionStrategy",{enumerable:!0,get:function(){return Kt.ConnectionStrategy}});Object.defineProperty(w,"ConnectionOptions",{enumerable:!0,get:function(){return Kt.ConnectionOptions}});Object.defineProperty(w,"NullLogger",{enumerable:!0,get:function(){return Kt.NullLogger}});Object.defineProperty(w,"createMessageConnection",{enumerable:!0,get:function(){return Kt.createMessageConnection}});Object.defineProperty(w,"ProgressToken",{enumerable:!0,get:function(){return Kt.ProgressToken}});Object.defineProperty(w,"ProgressType",{enumerable:!0,get:function(){return Kt.ProgressType}});Object.defineProperty(w,"Trace",{enumerable:!0,get:function(){return Kt.Trace}});Object.defineProperty(w,"TraceValues",{enumerable:!0,get:function(){return Kt.TraceValues}});Object.defineProperty(w,"TraceFormat",{enumerable:!0,get:function(){return Kt.TraceFormat}});Object.defineProperty(w,"SetTraceNotification",{enumerable:!0,get:function(){return Kt.SetTraceNotification}});Object.defineProperty(w,"LogTraceNotification",{enumerable:!0,get:function(){return Kt.LogTraceNotification}});Object.defineProperty(w,"ConnectionErrors",{enumerable:!0,get:function(){return Kt.ConnectionErrors}});Object.defineProperty(w,"ConnectionError",{enumerable:!0,get:function(){return Kt.ConnectionError}});Object.defineProperty(w,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return Kt.CancellationReceiverStrategy}});Object.defineProperty(w,"CancellationSenderStrategy",{enumerable:!0,get:function(){return Kt.CancellationSenderStrategy}});Object.defineProperty(w,"CancellationStrategy",{enumerable:!0,get:function(){return Kt.CancellationStrategy}});var MC=Ln();w.RAL=MC.default});var pn=C(be=>{"use strict";var LC=be&&be.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),FC=be&&be.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&LC(e,r,t)};Object.defineProperty(be,"__esModule",{value:!0});be.createMessageConnection=be.createServerSocketTransport=be.createClientSocketTransport=be.createServerPipeTransport=be.createClientPipeTransport=be.generateRandomPipeName=be.StreamMessageWriter=be.StreamMessageReader=be.SocketMessageWriter=be.SocketMessageReader=be.IPCMessageWriter=be.IPCMessageReader=void 0;var co=by();co.default.install();var fn=Yd(),Uy=require("path"),qC=require("os"),jC=require("crypto"),$s=require("net");FC(Yd(),be);var Xd=class extends fn.AbstractMessageReader{constructor(e){super(),this.process=e;let t=this.process;t.on("error",n=>this.fireError(n)),t.on("close",()=>this.fireClose())}listen(e){return this.process.on("message",e),fn.Disposable.create(()=>this.process.off("message",e))}};be.IPCMessageReader=Xd;var Jd=class extends fn.AbstractMessageWriter{constructor(e){super(),this.process=e,this.errorCount=0;let t=this.process;t.on("error",n=>this.fireError(n)),t.on("close",()=>this.fireClose)}write(e){try{return typeof this.process.send=="function"&&this.process.send(e,void 0,void 0,t=>{t?(this.errorCount++,this.handleError(t,e)):this.errorCount=0}),Promise.resolve()}catch(t){return this.handleError(t,e),Promise.reject(t)}}handleError(e,t){this.errorCount++,this.fireError(e,t,this.errorCount)}end(){}};be.IPCMessageWriter=Jd;var Di=class extends fn.ReadableStreamMessageReader{constructor(e,t="utf-8"){super((0,co.default)().stream.asReadableStream(e),t)}};be.SocketMessageReader=Di;var wi=class extends fn.WriteableStreamMessageWriter{constructor(e,t){super((0,co.default)().stream.asWritableStream(e),t),this.socket=e}dispose(){super.dispose(),this.socket.destroy()}};be.SocketMessageWriter=wi;var Is=class extends fn.ReadableStreamMessageReader{constructor(e,t){super((0,co.default)().stream.asReadableStream(e),t)}};be.StreamMessageReader=Is;var Os=class extends fn.WriteableStreamMessageWriter{constructor(e,t){super((0,co.default)().stream.asWritableStream(e),t)}};be.StreamMessageWriter=Os;var Hy=process.env.XDG_RUNTIME_DIR,GC=new Map([["linux",107],["darwin",103]]);function UC(){let r=(0,jC.randomBytes)(21).toString("hex");if(process.platform==="win32")return`\\\\.\\pipe\\vscode-jsonrpc-${r}-sock`;let e;Hy?e=Uy.join(Hy,`vscode-ipc-${r}.sock`):e=Uy.join(qC.tmpdir(),`vscode-${r}.sock`);let t=GC.get(process.platform);return t!==void 0&&e.length>=t&&(0,co.default)().console.warn(`WARNING: IPC handle "${e}" is longer than ${t} characters.`),e}be.generateRandomPipeName=UC;function HC(r,e="utf-8"){let t,n=new Promise((i,o)=>{t=i});return new Promise((i,o)=>{let a=(0,$s.createServer)(s=>{a.close(),t([new Di(s,e),new wi(s,e)])});a.on("error",o),a.listen(r,()=>{a.removeListener("error",o),i({onConnected:()=>n})})})}be.createClientPipeTransport=HC;function WC(r,e="utf-8"){let t=(0,$s.createConnection)(r);return[new Di(t,e),new wi(t,e)]}be.createServerPipeTransport=WC;function KC(r,e="utf-8"){let t,n=new Promise((i,o)=>{t=i});return new Promise((i,o)=>{let a=(0,$s.createServer)(s=>{a.close(),t([new Di(s,e),new wi(s,e)])});a.on("error",o),a.listen(r,"127.0.0.1",()=>{a.removeListener("error",o),i({onConnected:()=>n})})})}be.createClientSocketTransport=KC;function BC(r,e="utf-8"){let t=(0,$s.createConnection)(r,"127.0.0.1");return[new Di(t,e),new wi(t,e)]}be.createServerSocketTransport=BC;function zC(r){let e=r;return e.read!==void 0&&e.addListener!==void 0}function VC(r){let e=r;return e.write!==void 0&&e.addListener!==void 0}function YC(r,e,t,n){t||(t=fn.NullLogger);let i=zC(r)?new Is(r):r,o=VC(e)?new Os(e):e;return fn.ConnectionStrategy.is(n)&&(n={connectionStrategy:n}),(0,fn.createMessageConnection)(i,o,t,n)}be.createMessageConnection=YC});var Zd=C((SF,Wy)=>{"use strict";Wy.exports=pn()});var lo=C((Ky,Ms)=>{(function(r){if(typeof Ms=="object"&&typeof Ms.exports=="object"){var e=r(require,Ky);e!==void 0&&(Ms.exports=e)}else typeof define=="function"&&define.amd&&define(["require","exports"],r)})(function(r,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TextDocument=e.EOL=e.WorkspaceFolder=e.InlayHint=e.InlayHintLabelPart=e.InlayHintKind=e.InlineValueContext=e.InlineValueEvaluatableExpression=e.InlineValueVariableLookup=e.InlineValueText=e.SemanticTokens=e.SemanticTokenModifiers=e.SemanticTokenTypes=e.SelectionRange=e.DocumentLink=e.FormattingOptions=e.CodeLens=e.CodeAction=e.CodeActionContext=e.CodeActionTriggerKind=e.CodeActionKind=e.DocumentSymbol=e.WorkspaceSymbol=e.SymbolInformation=e.SymbolTag=e.SymbolKind=e.DocumentHighlight=e.DocumentHighlightKind=e.SignatureInformation=e.ParameterInformation=e.Hover=e.MarkedString=e.CompletionList=e.CompletionItem=e.CompletionItemLabelDetails=e.InsertTextMode=e.InsertReplaceEdit=e.CompletionItemTag=e.InsertTextFormat=e.CompletionItemKind=e.MarkupContent=e.MarkupKind=e.TextDocumentItem=e.OptionalVersionedTextDocumentIdentifier=e.VersionedTextDocumentIdentifier=e.TextDocumentIdentifier=e.WorkspaceChange=e.WorkspaceEdit=e.DeleteFile=e.RenameFile=e.CreateFile=e.TextDocumentEdit=e.AnnotatedTextEdit=e.ChangeAnnotationIdentifier=e.ChangeAnnotation=e.TextEdit=e.Command=e.Diagnostic=e.CodeDescription=e.DiagnosticTag=e.DiagnosticSeverity=e.DiagnosticRelatedInformation=e.FoldingRange=e.FoldingRangeKind=e.ColorPresentation=e.ColorInformation=e.Color=e.LocationLink=e.Location=e.Range=e.Position=e.uinteger=e.integer=e.URI=e.DocumentUri=void 0;var t;(function(m){function E(P){return typeof P=="string"}m.is=E})(t=e.DocumentUri||(e.DocumentUri={}));var n;(function(m){function E(P){return typeof P=="string"}m.is=E})(n=e.URI||(e.URI={}));var i;(function(m){m.MIN_VALUE=-2147483648,m.MAX_VALUE=2147483647;function E(P){return typeof P=="number"&&m.MIN_VALUE<=P&&P<=m.MAX_VALUE}m.is=E})(i=e.integer||(e.integer={}));var o;(function(m){m.MIN_VALUE=0,m.MAX_VALUE=2147483647;function E(P){return typeof P=="number"&&m.MIN_VALUE<=P&&P<=m.MAX_VALUE}m.is=E})(o=e.uinteger||(e.uinteger={}));var a;(function(m){function E(v,f){return v===Number.MAX_VALUE&&(v=o.MAX_VALUE),f===Number.MAX_VALUE&&(f=o.MAX_VALUE),{line:v,character:f}}m.create=E;function P(v){var f=v;return S.objectLiteral(f)&&S.uinteger(f.line)&&S.uinteger(f.character)}m.is=P})(a=e.Position||(e.Position={}));var s;(function(m){function E(v,f,N,I){if(S.uinteger(v)&&S.uinteger(f)&&S.uinteger(N)&&S.uinteger(I))return{start:a.create(v,f),end:a.create(N,I)};if(a.is(v)&&a.is(f))return{start:v,end:f};throw new Error("Range#create called with invalid arguments[".concat(v,", ").concat(f,", ").concat(N,", ").concat(I,"]"))}m.create=E;function P(v){var f=v;return S.objectLiteral(f)&&a.is(f.start)&&a.is(f.end)}m.is=P})(s=e.Range||(e.Range={}));var u;(function(m){function E(v,f){return{uri:v,range:f}}m.create=E;function P(v){var f=v;return S.objectLiteral(f)&&s.is(f.range)&&(S.string(f.uri)||S.undefined(f.uri))}m.is=P})(u=e.Location||(e.Location={}));var c;(function(m){function E(v,f,N,I){return{targetUri:v,targetRange:f,targetSelectionRange:N,originSelectionRange:I}}m.create=E;function P(v){var f=v;return S.objectLiteral(f)&&s.is(f.targetRange)&&S.string(f.targetUri)&&s.is(f.targetSelectionRange)&&(s.is(f.originSelectionRange)||S.undefined(f.originSelectionRange))}m.is=P})(c=e.LocationLink||(e.LocationLink={}));var l;(function(m){function E(v,f,N,I){return{red:v,green:f,blue:N,alpha:I}}m.create=E;function P(v){var f=v;return S.objectLiteral(f)&&S.numberRange(f.red,0,1)&&S.numberRange(f.green,0,1)&&S.numberRange(f.blue,0,1)&&S.numberRange(f.alpha,0,1)}m.is=P})(l=e.Color||(e.Color={}));var d;(function(m){function E(v,f){return{range:v,color:f}}m.create=E;function P(v){var f=v;return S.objectLiteral(f)&&s.is(f.range)&&l.is(f.color)}m.is=P})(d=e.ColorInformation||(e.ColorInformation={}));var g;(function(m){function E(v,f,N){return{label:v,textEdit:f,additionalTextEdits:N}}m.create=E;function P(v){var f=v;return S.objectLiteral(f)&&S.string(f.label)&&(S.undefined(f.textEdit)||B.is(f))&&(S.undefined(f.additionalTextEdits)||S.typedArray(f.additionalTextEdits,B.is))}m.is=P})(g=e.ColorPresentation||(e.ColorPresentation={}));var y;(function(m){m.Comment="comment",m.Imports="imports",m.Region="region"})(y=e.FoldingRangeKind||(e.FoldingRangeKind={}));var p;(function(m){function E(v,f,N,I,re,ct){var We={startLine:v,endLine:f};return S.defined(N)&&(We.startCharacter=N),S.defined(I)&&(We.endCharacter=I),S.defined(re)&&(We.kind=re),S.defined(ct)&&(We.collapsedText=ct),We}m.create=E;function P(v){var f=v;return S.objectLiteral(f)&&S.uinteger(f.startLine)&&S.uinteger(f.startLine)&&(S.undefined(f.startCharacter)||S.uinteger(f.startCharacter))&&(S.undefined(f.endCharacter)||S.uinteger(f.endCharacter))&&(S.undefined(f.kind)||S.string(f.kind))}m.is=P})(p=e.FoldingRange||(e.FoldingRange={}));var A;(function(m){function E(v,f){return{location:v,message:f}}m.create=E;function P(v){var f=v;return S.defined(f)&&u.is(f.location)&&S.string(f.message)}m.is=P})(A=e.DiagnosticRelatedInformation||(e.DiagnosticRelatedInformation={}));var x;(function(m){m.Error=1,m.Warning=2,m.Information=3,m.Hint=4})(x=e.DiagnosticSeverity||(e.DiagnosticSeverity={}));var k;(function(m){m.Unnecessary=1,m.Deprecated=2})(k=e.DiagnosticTag||(e.DiagnosticTag={}));var _;(function(m){function E(P){var v=P;return S.objectLiteral(v)&&S.string(v.href)}m.is=E})(_=e.CodeDescription||(e.CodeDescription={}));var R;(function(m){function E(v,f,N,I,re,ct){var We={range:v,message:f};return S.defined(N)&&(We.severity=N),S.defined(I)&&(We.code=I),S.defined(re)&&(We.source=re),S.defined(ct)&&(We.relatedInformation=ct),We}m.create=E;function P(v){var f,N=v;return S.defined(N)&&s.is(N.range)&&S.string(N.message)&&(S.number(N.severity)||S.undefined(N.severity))&&(S.integer(N.code)||S.string(N.code)||S.undefined(N.code))&&(S.undefined(N.codeDescription)||S.string((f=N.codeDescription)===null||f===void 0?void 0:f.href))&&(S.string(N.source)||S.undefined(N.source))&&(S.undefined(N.relatedInformation)||S.typedArray(N.relatedInformation,A.is))}m.is=P})(R=e.Diagnostic||(e.Diagnostic={}));var D;(function(m){function E(v,f){for(var N=[],I=2;I<arguments.length;I++)N[I-2]=arguments[I];var re={title:v,command:f};return S.defined(N)&&N.length>0&&(re.arguments=N),re}m.create=E;function P(v){var f=v;return S.defined(f)&&S.string(f.title)&&S.string(f.command)}m.is=P})(D=e.Command||(e.Command={}));var B;(function(m){function E(N,I){return{range:N,newText:I}}m.replace=E;function P(N,I){return{range:{start:N,end:N},newText:I}}m.insert=P;function v(N){return{range:N,newText:""}}m.del=v;function f(N){var I=N;return S.objectLiteral(I)&&S.string(I.newText)&&s.is(I.range)}m.is=f})(B=e.TextEdit||(e.TextEdit={}));var V;(function(m){function E(v,f,N){var I={label:v};return f!==void 0&&(I.needsConfirmation=f),N!==void 0&&(I.description=N),I}m.create=E;function P(v){var f=v;return S.objectLiteral(f)&&S.string(f.label)&&(S.boolean(f.needsConfirmation)||f.needsConfirmation===void 0)&&(S.string(f.description)||f.description===void 0)}m.is=P})(V=e.ChangeAnnotation||(e.ChangeAnnotation={}));var G;(function(m){function E(P){var v=P;return S.string(v)}m.is=E})(G=e.ChangeAnnotationIdentifier||(e.ChangeAnnotationIdentifier={}));var ge;(function(m){function E(N,I,re){return{range:N,newText:I,annotationId:re}}m.replace=E;function P(N,I,re){return{range:{start:N,end:N},newText:I,annotationId:re}}m.insert=P;function v(N,I){return{range:N,newText:"",annotationId:I}}m.del=v;function f(N){var I=N;return B.is(I)&&(V.is(I.annotationId)||G.is(I.annotationId))}m.is=f})(ge=e.AnnotatedTextEdit||(e.AnnotatedTextEdit={}));var je;(function(m){function E(v,f){return{textDocument:v,edits:f}}m.create=E;function P(v){var f=v;return S.defined(f)&&Ae.is(f.textDocument)&&Array.isArray(f.edits)}m.is=P})(je=e.TextDocumentEdit||(e.TextDocumentEdit={}));var Ze;(function(m){function E(v,f,N){var I={kind:"create",uri:v};return f!==void 0&&(f.overwrite!==void 0||f.ignoreIfExists!==void 0)&&(I.options=f),N!==void 0&&(I.annotationId=N),I}m.create=E;function P(v){var f=v;return f&&f.kind==="create"&&S.string(f.uri)&&(f.options===void 0||(f.options.overwrite===void 0||S.boolean(f.options.overwrite))&&(f.options.ignoreIfExists===void 0||S.boolean(f.options.ignoreIfExists)))&&(f.annotationId===void 0||G.is(f.annotationId))}m.is=P})(Ze=e.CreateFile||(e.CreateFile={}));var Ge;(function(m){function E(v,f,N,I){var re={kind:"rename",oldUri:v,newUri:f};return N!==void 0&&(N.overwrite!==void 0||N.ignoreIfExists!==void 0)&&(re.options=N),I!==void 0&&(re.annotationId=I),re}m.create=E;function P(v){var f=v;return f&&f.kind==="rename"&&S.string(f.oldUri)&&S.string(f.newUri)&&(f.options===void 0||(f.options.overwrite===void 0||S.boolean(f.options.overwrite))&&(f.options.ignoreIfExists===void 0||S.boolean(f.options.ignoreIfExists)))&&(f.annotationId===void 0||G.is(f.annotationId))}m.is=P})(Ge=e.RenameFile||(e.RenameFile={}));var L;(function(m){function E(v,f,N){var I={kind:"delete",uri:v};return f!==void 0&&(f.recursive!==void 0||f.ignoreIfNotExists!==void 0)&&(I.options=f),N!==void 0&&(I.annotationId=N),I}m.create=E;function P(v){var f=v;return f&&f.kind==="delete"&&S.string(f.uri)&&(f.options===void 0||(f.options.recursive===void 0||S.boolean(f.options.recursive))&&(f.options.ignoreIfNotExists===void 0||S.boolean(f.options.ignoreIfNotExists)))&&(f.annotationId===void 0||G.is(f.annotationId))}m.is=P})(L=e.DeleteFile||(e.DeleteFile={}));var M;(function(m){function E(P){var v=P;return v&&(v.changes!==void 0||v.documentChanges!==void 0)&&(v.documentChanges===void 0||v.documentChanges.every(function(f){return S.string(f.kind)?Ze.is(f)||Ge.is(f)||L.is(f):je.is(f)}))}m.is=E})(M=e.WorkspaceEdit||(e.WorkspaceEdit={}));var F=function(){function m(E,P){this.edits=E,this.changeAnnotations=P}return m.prototype.insert=function(E,P,v){var f,N;if(v===void 0?f=B.insert(E,P):G.is(v)?(N=v,f=ge.insert(E,P,v)):(this.assertChangeAnnotations(this.changeAnnotations),N=this.changeAnnotations.manage(v),f=ge.insert(E,P,N)),this.edits.push(f),N!==void 0)return N},m.prototype.replace=function(E,P,v){var f,N;if(v===void 0?f=B.replace(E,P):G.is(v)?(N=v,f=ge.replace(E,P,v)):(this.assertChangeAnnotations(this.changeAnnotations),N=this.changeAnnotations.manage(v),f=ge.replace(E,P,N)),this.edits.push(f),N!==void 0)return N},m.prototype.delete=function(E,P){var v,f;if(P===void 0?v=B.del(E):G.is(P)?(f=P,v=ge.del(E,P)):(this.assertChangeAnnotations(this.changeAnnotations),f=this.changeAnnotations.manage(P),v=ge.del(E,f)),this.edits.push(v),f!==void 0)return f},m.prototype.add=function(E){this.edits.push(E)},m.prototype.all=function(){return this.edits},m.prototype.clear=function(){this.edits.splice(0,this.edits.length)},m.prototype.assertChangeAnnotations=function(E){if(E===void 0)throw new Error("Text edit change is not configured to manage change annotations.")},m}(),K=function(){function m(E){this._annotations=E===void 0?Object.create(null):E,this._counter=0,this._size=0}return m.prototype.all=function(){return this._annotations},Object.defineProperty(m.prototype,"size",{get:function(){return this._size},enumerable:!1,configurable:!0}),m.prototype.manage=function(E,P){var v;if(G.is(E)?v=E:(v=this.nextId(),P=E),this._annotations[v]!==void 0)throw new Error("Id ".concat(v," is already in use."));if(P===void 0)throw new Error("No annotation provided for id ".concat(v));return this._annotations[v]=P,this._size++,v},m.prototype.nextId=function(){return this._counter++,this._counter.toString()},m}(),pe=function(){function m(E){var P=this;this._textEditChanges=Object.create(null),E!==void 0?(this._workspaceEdit=E,E.documentChanges?(this._changeAnnotations=new K(E.changeAnnotations),E.changeAnnotations=this._changeAnnotations.all(),E.documentChanges.forEach(function(v){if(je.is(v)){var f=new F(v.edits,P._changeAnnotations);P._textEditChanges[v.textDocument.uri]=f}})):E.changes&&Object.keys(E.changes).forEach(function(v){var f=new F(E.changes[v]);P._textEditChanges[v]=f})):this._workspaceEdit={}}return Object.defineProperty(m.prototype,"edit",{get:function(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit},enumerable:!1,configurable:!0}),m.prototype.getTextEditChange=function(E){if(Ae.is(E)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var P={uri:E.uri,version:E.version},v=this._textEditChanges[P.uri];if(!v){var f=[],N={textDocument:P,edits:f};this._workspaceEdit.documentChanges.push(N),v=new F(f,this._changeAnnotations),this._textEditChanges[P.uri]=v}return v}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");var v=this._textEditChanges[E];if(!v){var f=[];this._workspaceEdit.changes[E]=f,v=new F(f),this._textEditChanges[E]=v}return v}},m.prototype.initDocumentChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new K,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())},m.prototype.initChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))},m.prototype.createFile=function(E,P,v){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var f;V.is(P)||G.is(P)?f=P:v=P;var N,I;if(f===void 0?N=Ze.create(E,v):(I=G.is(f)?f:this._changeAnnotations.manage(f),N=Ze.create(E,v,I)),this._workspaceEdit.documentChanges.push(N),I!==void 0)return I},m.prototype.renameFile=function(E,P,v,f){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var N;V.is(v)||G.is(v)?N=v:f=v;var I,re;if(N===void 0?I=Ge.create(E,P,f):(re=G.is(N)?N:this._changeAnnotations.manage(N),I=Ge.create(E,P,f,re)),this._workspaceEdit.documentChanges.push(I),re!==void 0)return re},m.prototype.deleteFile=function(E,P,v){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var f;V.is(P)||G.is(P)?f=P:v=P;var N,I;if(f===void 0?N=L.create(E,v):(I=G.is(f)?f:this._changeAnnotations.manage(f),N=L.create(E,v,I)),this._workspaceEdit.documentChanges.push(N),I!==void 0)return I},m}();e.WorkspaceChange=pe;var ee;(function(m){function E(v){return{uri:v}}m.create=E;function P(v){var f=v;return S.defined(f)&&S.string(f.uri)}m.is=P})(ee=e.TextDocumentIdentifier||(e.TextDocumentIdentifier={}));var ie;(function(m){function E(v,f){return{uri:v,version:f}}m.create=E;function P(v){var f=v;return S.defined(f)&&S.string(f.uri)&&S.integer(f.version)}m.is=P})(ie=e.VersionedTextDocumentIdentifier||(e.VersionedTextDocumentIdentifier={}));var Ae;(function(m){function E(v,f){return{uri:v,version:f}}m.create=E;function P(v){var f=v;return S.defined(f)&&S.string(f.uri)&&(f.version===null||S.integer(f.version))}m.is=P})(Ae=e.OptionalVersionedTextDocumentIdentifier||(e.OptionalVersionedTextDocumentIdentifier={}));var Ue;(function(m){function E(v,f,N,I){return{uri:v,languageId:f,version:N,text:I}}m.create=E;function P(v){var f=v;return S.defined(f)&&S.string(f.uri)&&S.string(f.languageId)&&S.integer(f.version)&&S.string(f.text)}m.is=P})(Ue=e.TextDocumentItem||(e.TextDocumentItem={}));var ft;(function(m){m.PlainText="plaintext",m.Markdown="markdown";function E(P){var v=P;return v===m.PlainText||v===m.Markdown}m.is=E})(ft=e.MarkupKind||(e.MarkupKind={}));var ur;(function(m){function E(P){var v=P;return S.objectLiteral(P)&&ft.is(v.kind)&&S.string(v.value)}m.is=E})(ur=e.MarkupContent||(e.MarkupContent={}));var yr;(function(m){m.Text=1,m.Method=2,m.Function=3,m.Constructor=4,m.Field=5,m.Variable=6,m.Class=7,m.Interface=8,m.Module=9,m.Property=10,m.Unit=11,m.Value=12,m.Enum=13,m.Keyword=14,m.Snippet=15,m.Color=16,m.File=17,m.Reference=18,m.Folder=19,m.EnumMember=20,m.Constant=21,m.Struct=22,m.Event=23,m.Operator=24,m.TypeParameter=25})(yr=e.CompletionItemKind||(e.CompletionItemKind={}));var Xi;(function(m){m.PlainText=1,m.Snippet=2})(Xi=e.InsertTextFormat||(e.InsertTextFormat={}));var Ji;(function(m){m.Deprecated=1})(Ji=e.CompletionItemTag||(e.CompletionItemTag={}));var Qt;(function(m){function E(v,f,N){return{newText:v,insert:f,replace:N}}m.create=E;function P(v){var f=v;return f&&S.string(f.newText)&&s.is(f.insert)&&s.is(f.replace)}m.is=P})(Qt=e.InsertReplaceEdit||(e.InsertReplaceEdit={}));var Zi;(function(m){m.asIs=1,m.adjustIndentation=2})(Zi=e.InsertTextMode||(e.InsertTextMode={}));var Qi;(function(m){function E(P){var v=P;return v&&(S.string(v.detail)||v.detail===void 0)&&(S.string(v.description)||v.description===void 0)}m.is=E})(Qi=e.CompletionItemLabelDetails||(e.CompletionItemLabelDetails={}));var ia;(function(m){function E(P){return{label:P}}m.create=E})(ia=e.CompletionItem||(e.CompletionItem={}));var Rr;(function(m){function E(P,v){return{items:P||[],isIncomplete:!!v}}m.create=E})(Rr=e.CompletionList||(e.CompletionList={}));var xt;(function(m){function E(v){return v.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}m.fromPlainText=E;function P(v){var f=v;return S.string(f)||S.objectLiteral(f)&&S.string(f.language)&&S.string(f.value)}m.is=P})(xt=e.MarkedString||(e.MarkedString={}));var oa;(function(m){function E(P){var v=P;return!!v&&S.objectLiteral(v)&&(ur.is(v.contents)||xt.is(v.contents)||S.typedArray(v.contents,xt.is))&&(P.range===void 0||s.is(P.range))}m.is=E})(oa=e.Hover||(e.Hover={}));var Ci;(function(m){function E(P,v){return v?{label:P,documentation:v}:{label:P}}m.create=E})(Ci=e.ParameterInformation||(e.ParameterInformation={}));var un;(function(m){function E(P,v){for(var f=[],N=2;N<arguments.length;N++)f[N-2]=arguments[N];var I={label:P};return S.defined(v)&&(I.documentation=v),S.defined(f)?I.parameters=f:I.parameters=[],I}m.create=E})(un=e.SignatureInformation||(e.SignatureInformation={}));var ti;(function(m){m.Text=1,m.Read=2,m.Write=3})(ti=e.DocumentHighlightKind||(e.DocumentHighlightKind={}));var In;(function(m){function E(P,v){var f={range:P};return S.number(v)&&(f.kind=v),f}m.create=E})(In=e.DocumentHighlight||(e.DocumentHighlight={}));var Pi;(function(m){m.File=1,m.Module=2,m.Namespace=3,m.Package=4,m.Class=5,m.Method=6,m.Property=7,m.Field=8,m.Constructor=9,m.Enum=10,m.Interface=11,m.Function=12,m.Variable=13,m.Constant=14,m.String=15,m.Number=16,m.Boolean=17,m.Array=18,m.Object=19,m.Key=20,m.Null=21,m.EnumMember=22,m.Struct=23,m.Event=24,m.Operator=25,m.TypeParameter=26})(Pi=e.SymbolKind||(e.SymbolKind={}));var _r;(function(m){m.Deprecated=1})(_r=e.SymbolTag||(e.SymbolTag={}));var cn;(function(m){function E(P,v,f,N,I){var re={name:P,kind:v,location:{uri:N,range:f}};return I&&(re.containerName=I),re}m.create=E})(cn=e.SymbolInformation||(e.SymbolInformation={}));var eo;(function(m){function E(P,v,f,N){return N!==void 0?{name:P,kind:v,location:{uri:f,range:N}}:{name:P,kind:v,location:{uri:f}}}m.create=E})(eo=e.WorkspaceSymbol||(e.WorkspaceSymbol={}));var On;(function(m){function E(v,f,N,I,re,ct){var We={name:v,detail:f,kind:N,range:I,selectionRange:re};return ct!==void 0&&(We.children=ct),We}m.create=E;function P(v){var f=v;return f&&S.string(f.name)&&S.number(f.kind)&&s.is(f.range)&&s.is(f.selectionRange)&&(f.detail===void 0||S.string(f.detail))&&(f.deprecated===void 0||S.boolean(f.deprecated))&&(f.children===void 0||Array.isArray(f.children))&&(f.tags===void 0||Array.isArray(f.tags))}m.is=P})(On=e.DocumentSymbol||(e.DocumentSymbol={}));var Lr;(function(m){m.Empty="",m.QuickFix="quickfix",m.Refactor="refactor",m.RefactorExtract="refactor.extract",m.RefactorInline="refactor.inline",m.RefactorRewrite="refactor.rewrite",m.Source="source",m.SourceOrganizeImports="source.organizeImports",m.SourceFixAll="source.fixAll"})(Lr=e.CodeActionKind||(e.CodeActionKind={}));var ut;(function(m){m.Invoked=1,m.Automatic=2})(ut=e.CodeActionTriggerKind||(e.CodeActionTriggerKind={}));var ln;(function(m){function E(v,f,N){var I={diagnostics:v};return f!=null&&(I.only=f),N!=null&&(I.triggerKind=N),I}m.create=E;function P(v){var f=v;return S.defined(f)&&S.typedArray(f.diagnostics,R.is)&&(f.only===void 0||S.typedArray(f.only,S.string))&&(f.triggerKind===void 0||f.triggerKind===ut.Invoked||f.triggerKind===ut.Automatic)}m.is=P})(ln=e.CodeActionContext||(e.CodeActionContext={}));var Ar;(function(m){function E(v,f,N){var I={title:v},re=!0;return typeof f=="string"?(re=!1,I.kind=f):D.is(f)?I.command=f:I.edit=f,re&&N!==void 0&&(I.kind=N),I}m.create=E;function P(v){var f=v;return f&&S.string(f.title)&&(f.diagnostics===void 0||S.typedArray(f.diagnostics,R.is))&&(f.kind===void 0||S.string(f.kind))&&(f.edit!==void 0||f.command!==void 0)&&(f.command===void 0||D.is(f.command))&&(f.isPreferred===void 0||S.boolean(f.isPreferred))&&(f.edit===void 0||M.is(f.edit))}m.is=P})(Ar=e.CodeAction||(e.CodeAction={}));var to;(function(m){function E(v,f){var N={range:v};return S.defined(f)&&(N.data=f),N}m.create=E;function P(v){var f=v;return S.defined(f)&&s.is(f.range)&&(S.undefined(f.command)||D.is(f.command))}m.is=P})(to=e.CodeLens||(e.CodeLens={}));var ri;(function(m){function E(v,f){return{tabSize:v,insertSpaces:f}}m.create=E;function P(v){var f=v;return S.defined(f)&&S.uinteger(f.tabSize)&&S.boolean(f.insertSpaces)}m.is=P})(ri=e.FormattingOptions||(e.FormattingOptions={}));var b;(function(m){function E(v,f,N){return{range:v,target:f,data:N}}m.create=E;function P(v){var f=v;return S.defined(f)&&s.is(f.range)&&(S.undefined(f.target)||S.string(f.target))}m.is=P})(b=e.DocumentLink||(e.DocumentLink={}));var O;(function(m){function E(v,f){return{range:v,parent:f}}m.create=E;function P(v){var f=v;return S.objectLiteral(f)&&s.is(f.range)&&(f.parent===void 0||m.is(f.parent))}m.is=P})(O=e.SelectionRange||(e.SelectionRange={}));var j;(function(m){m.namespace="namespace",m.type="type",m.class="class",m.enum="enum",m.interface="interface",m.struct="struct",m.typeParameter="typeParameter",m.parameter="parameter",m.variable="variable",m.property="property",m.enumMember="enumMember",m.event="event",m.function="function",m.method="method",m.macro="macro",m.keyword="keyword",m.modifier="modifier",m.comment="comment",m.string="string",m.number="number",m.regexp="regexp",m.operator="operator",m.decorator="decorator"})(j=e.SemanticTokenTypes||(e.SemanticTokenTypes={}));var z;(function(m){m.declaration="declaration",m.definition="definition",m.readonly="readonly",m.static="static",m.deprecated="deprecated",m.abstract="abstract",m.async="async",m.modification="modification",m.documentation="documentation",m.defaultLibrary="defaultLibrary"})(z=e.SemanticTokenModifiers||(e.SemanticTokenModifiers={}));var Oe;(function(m){function E(P){var v=P;return S.objectLiteral(v)&&(v.resultId===void 0||typeof v.resultId=="string")&&Array.isArray(v.data)&&(v.data.length===0||typeof v.data[0]=="number")}m.is=E})(Oe=e.SemanticTokens||(e.SemanticTokens={}));var $e;(function(m){function E(v,f){return{range:v,text:f}}m.create=E;function P(v){var f=v;return f!=null&&s.is(f.range)&&S.string(f.text)}m.is=P})($e=e.InlineValueText||(e.InlineValueText={}));var Qe;(function(m){function E(v,f,N){return{range:v,variableName:f,caseSensitiveLookup:N}}m.create=E;function P(v){var f=v;return f!=null&&s.is(f.range)&&S.boolean(f.caseSensitiveLookup)&&(S.string(f.variableName)||f.variableName===void 0)}m.is=P})(Qe=e.InlineValueVariableLookup||(e.InlineValueVariableLookup={}));var ht;(function(m){function E(v,f){return{range:v,expression:f}}m.create=E;function P(v){var f=v;return f!=null&&s.is(f.range)&&(S.string(f.expression)||f.expression===void 0)}m.is=P})(ht=e.InlineValueEvaluatableExpression||(e.InlineValueEvaluatableExpression={}));var le;(function(m){function E(v,f){return{frameId:v,stoppedLocation:f}}m.create=E;function P(v){var f=v;return S.defined(f)&&s.is(v.stoppedLocation)}m.is=P})(le=e.InlineValueContext||(e.InlineValueContext={}));var He;(function(m){m.Type=1,m.Parameter=2;function E(P){return P===1||P===2}m.is=E})(He=e.InlayHintKind||(e.InlayHintKind={}));var ve;(function(m){function E(v){return{value:v}}m.create=E;function P(v){var f=v;return S.objectLiteral(f)&&(f.tooltip===void 0||S.string(f.tooltip)||ur.is(f.tooltip))&&(f.location===void 0||u.is(f.location))&&(f.command===void 0||D.is(f.command))}m.is=P})(ve=e.InlayHintLabelPart||(e.InlayHintLabelPart={}));var pt;(function(m){function E(v,f,N){var I={position:v,label:f};return N!==void 0&&(I.kind=N),I}m.create=E;function P(v){var f=v;return S.objectLiteral(f)&&a.is(f.position)&&(S.string(f.label)||S.typedArray(f.label,ve.is))&&(f.kind===void 0||He.is(f.kind))&&f.textEdits===void 0||S.typedArray(f.textEdits,B.is)&&(f.tooltip===void 0||S.string(f.tooltip)||ur.is(f.tooltip))&&(f.paddingLeft===void 0||S.boolean(f.paddingLeft))&&(f.paddingRight===void 0||S.boolean(f.paddingRight))}m.is=P})(pt=e.InlayHint||(e.InlayHint={}));var Ht;(function(m){function E(P){var v=P;return S.objectLiteral(v)&&n.is(v.uri)&&S.string(v.name)}m.is=E})(Ht=e.WorkspaceFolder||(e.WorkspaceFolder={})),e.EOL=[`
29
+ `)),O){let z=b.error?` Request failed: ${b.error.message} (${b.error.code}).`:"";B.log(`Received response '${O.method} - (${b.id})' in ${Date.now()-O.timerStart}ms.${z}`,j)}else B.log(`Received response ${b.id} without active response promise.`,j)}else _r("receive-response",b)}function _r(b,O){if(!B||R===Se.Off)return;let j={isLSPMessage:!0,type:b,message:O,timestamp:Date.now()};B.log(j)}function cn(){if(Ae())throw new ni(Ds.Closed,"Connection is closed.");if(Ue())throw new ni(Ds.Disposed,"Connection is disposed.")}function eo(){if(ie())throw new ni(Ds.AlreadyListening,"Connection is already listening")}function In(){if(!ie())throw new Error("Call listen() first.")}function Lr(b){return b===void 0?null:b}function ut(b){if(b!==null)return b}function ln(b){return b!=null&&!Array.isArray(b)&&typeof b=="object"}function Ar(b,O){switch(b){case Q.ParameterStructures.auto:return ln(O)?ut(O):[Lr(O)];case Q.ParameterStructures.byName:if(!ln(O))throw new Error("Received parameters by name but param is not an object literal.");return ut(O);case Q.ParameterStructures.byPosition:return[Lr(O)];default:throw new Error(`Unknown parameter structure ${b.toString()}`)}}function to(b,O){let j,z=b.numberOfParams;switch(z){case 0:j=void 0;break;case 1:j=Ar(b.parameterStructures,O[0]);break;default:j=[];for(let Oe=0;Oe<O.length&&Oe<z;Oe++)j.push(Lr(O[Oe]));if(O.length<z)for(let Oe=O.length;Oe<z;Oe++)j.push(null);break}return j}let ri={sendNotification:(b,...O)=>{cn();let j,z;if(Et.string(b)){j=b;let $e=O[0],Qe=0,ht=Q.ParameterStructures.auto;Q.ParameterStructures.is($e)&&(Qe=1,ht=$e);let le=O.length,He=le-Qe;switch(He){case 0:z=void 0;break;case 1:z=Ar(ht,O[Qe]);break;default:if(ht===Q.ParameterStructures.byName)throw new Error(`Received ${He} parameters for 'by Name' notification parameter structure.`);z=O.slice(Qe,le).map(ve=>Lr(ve));break}}else{let $e=O;j=b.method,z=to(b,$e)}let Oe={jsonrpc:u,method:j,params:z};return Ci(Oe),e.write(Oe).catch(()=>i.error("Sending notification failed."))},onNotification:(b,O)=>{cn();let j;return Et.func(b)?d=b:O&&(Et.string(b)?(j=b,g.set(b,{type:void 0,handler:O})):(j=b.method,g.set(b.method,{type:b,handler:O}))),{dispose:()=>{j!==void 0?g.delete(j):d=void 0}}},onProgress:(b,O,j)=>{if(y.has(O))throw new Error(`Progress handler for token ${O} already registered`);return y.set(O,j),{dispose:()=>{y.delete(O)}}},sendProgress:(b,O,j)=>ri.sendNotification(la.type,{token:O,value:j}),onUnhandledProgress:Ze.event,sendRequest:(b,...O)=>{cn(),In();let j,z,Oe;if(Et.string(b)){j=b;let le=O[0],He=O[O.length-1],ve=0,pt=Q.ParameterStructures.auto;Q.ParameterStructures.is(le)&&(ve=1,pt=le);let Ut=O.length;Ld.CancellationToken.is(He)&&(Ut=Ut-1,Oe=He);let On=Ut-ve;switch(On){case 0:z=void 0;break;case 1:z=Ar(pt,O[ve]);break;default:if(pt===Q.ParameterStructures.byName)throw new Error(`Received ${On} parameters for 'by Name' request parameter structure.`);z=O.slice(ve,Ut).map(dn=>Lr(dn));break}}else{let le=O;j=b.method,z=to(b,le);let He=b.numberOfParams;Oe=Ld.CancellationToken.is(le[He])?le[He]:void 0}let $e=o++,Qe;return Oe&&(Qe=Oe.onCancellationRequested(()=>{let le=L.sender.sendCancellation(ri,$e);return le===void 0?(i.log(`Received no promise from cancellation strategy when cancelling id ${$e}`),Promise.resolve()):le.catch(()=>{i.log(`Sending cancellation messages for id ${$e} failed`)})})),new Promise((le,He)=>{let ve={jsonrpc:u,id:$e,method:j,params:z},pt=dn=>{le(dn),L.sender.cleanup($e),Qe?.dispose()},Ut=dn=>{He(dn),L.sender.cleanup($e),Qe?.dispose()},On={method:j,timerStart:Date.now(),resolve:pt,reject:Ut};oa(ve);try{e.write(ve).catch(()=>i.error("Sending request failed."))}catch(dn){On.reject(new Q.ResponseError(Q.ErrorCodes.MessageWriteError,dn.message?dn.message:"Unknown reason")),On=null}On&&x.set($e,On)})},onRequest:(b,O)=>{cn();let j=null;return qd.is(b)?(j=void 0,c=b):Et.string(b)?(j=null,O!==void 0&&(j=b,l.set(b,{handler:O,type:void 0}))):O!==void 0&&(j=b.method,l.set(b.method,{type:b,handler:O})),{dispose:()=>{j!==null&&(j!==void 0?l.delete(j):c=void 0)}}},hasPendingResponse:()=>x.size>0,trace:async(b,O,j)=>{let z=!1,Oe=jr.Text;j!==void 0&&(Et.boolean(j)?z=j:(z=j.sendNotification||!1,Oe=j.traceFormat||jr.Text)),R=b,D=Oe,R===Se.Off?B=void 0:B=O,z&&!Ae()&&!Ue()&&await ri.sendNotification($y.type,{value:Se.toString(b)})},onError:G.event,onClose:ge.event,onUnhandledNotification:je.event,onDispose:Ge.event,end:()=>{e.end()},dispose:()=>{if(Ue())return;V=Gr.Disposed,Ge.fire(void 0);let b=new Q.ResponseError(Q.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(let O of x.values())O.reject(b);x=new Map,_=new Map,k=new Set,A=new Iy.LinkedMap,Et.func(e.dispose)&&e.dispose(),Et.func(r.dispose)&&r.dispose()},listen:()=>{cn(),eo(),V=Gr.Listening,r.listen(Qt)},inspect:()=>{(0,wy.default)().console.log("inspect")}};return ri.onNotification(jd.type,b=>{if(R===Se.Off||!B)return;let O=R===Se.Verbose||R===Se.Compact;B.log(b.message,O?b.verbose:void 0)}),ri.onNotification(la.type,b=>{let O=y.get(b.token);O?O(b.value):Ze.fire(b)}),ri}J.createMessageConnection=DC});var zd=C(w=>{"use strict";Object.defineProperty(w,"__esModule",{value:!0});w.TraceFormat=w.TraceValues=w.Trace=w.ProgressType=w.ProgressToken=w.createMessageConnection=w.NullLogger=w.ConnectionOptions=w.ConnectionStrategy=w.WriteableStreamMessageWriter=w.AbstractMessageWriter=w.MessageWriter=w.ReadableStreamMessageReader=w.AbstractMessageReader=w.MessageReader=w.CancellationToken=w.CancellationTokenSource=w.Emitter=w.Event=w.Disposable=w.LRUCache=w.Touch=w.LinkedMap=w.ParameterStructures=w.NotificationType9=w.NotificationType8=w.NotificationType7=w.NotificationType6=w.NotificationType5=w.NotificationType4=w.NotificationType3=w.NotificationType2=w.NotificationType1=w.NotificationType0=w.NotificationType=w.ErrorCodes=w.ResponseError=w.RequestType9=w.RequestType8=w.RequestType7=w.RequestType6=w.RequestType5=w.RequestType4=w.RequestType3=w.RequestType2=w.RequestType1=w.RequestType0=w.RequestType=w.Message=w.RAL=void 0;w.CancellationStrategy=w.CancellationSenderStrategy=w.CancellationReceiverStrategy=w.ConnectionError=w.ConnectionErrors=w.LogTraceNotification=w.SetTraceNotification=void 0;var Ke=Ad();Object.defineProperty(w,"Message",{enumerable:!0,get:function(){return Ke.Message}});Object.defineProperty(w,"RequestType",{enumerable:!0,get:function(){return Ke.RequestType}});Object.defineProperty(w,"RequestType0",{enumerable:!0,get:function(){return Ke.RequestType0}});Object.defineProperty(w,"RequestType1",{enumerable:!0,get:function(){return Ke.RequestType1}});Object.defineProperty(w,"RequestType2",{enumerable:!0,get:function(){return Ke.RequestType2}});Object.defineProperty(w,"RequestType3",{enumerable:!0,get:function(){return Ke.RequestType3}});Object.defineProperty(w,"RequestType4",{enumerable:!0,get:function(){return Ke.RequestType4}});Object.defineProperty(w,"RequestType5",{enumerable:!0,get:function(){return Ke.RequestType5}});Object.defineProperty(w,"RequestType6",{enumerable:!0,get:function(){return Ke.RequestType6}});Object.defineProperty(w,"RequestType7",{enumerable:!0,get:function(){return Ke.RequestType7}});Object.defineProperty(w,"RequestType8",{enumerable:!0,get:function(){return Ke.RequestType8}});Object.defineProperty(w,"RequestType9",{enumerable:!0,get:function(){return Ke.RequestType9}});Object.defineProperty(w,"ResponseError",{enumerable:!0,get:function(){return Ke.ResponseError}});Object.defineProperty(w,"ErrorCodes",{enumerable:!0,get:function(){return Ke.ErrorCodes}});Object.defineProperty(w,"NotificationType",{enumerable:!0,get:function(){return Ke.NotificationType}});Object.defineProperty(w,"NotificationType0",{enumerable:!0,get:function(){return Ke.NotificationType0}});Object.defineProperty(w,"NotificationType1",{enumerable:!0,get:function(){return Ke.NotificationType1}});Object.defineProperty(w,"NotificationType2",{enumerable:!0,get:function(){return Ke.NotificationType2}});Object.defineProperty(w,"NotificationType3",{enumerable:!0,get:function(){return Ke.NotificationType3}});Object.defineProperty(w,"NotificationType4",{enumerable:!0,get:function(){return Ke.NotificationType4}});Object.defineProperty(w,"NotificationType5",{enumerable:!0,get:function(){return Ke.NotificationType5}});Object.defineProperty(w,"NotificationType6",{enumerable:!0,get:function(){return Ke.NotificationType6}});Object.defineProperty(w,"NotificationType7",{enumerable:!0,get:function(){return Ke.NotificationType7}});Object.defineProperty(w,"NotificationType8",{enumerable:!0,get:function(){return Ke.NotificationType8}});Object.defineProperty(w,"NotificationType9",{enumerable:!0,get:function(){return Ke.NotificationType9}});Object.defineProperty(w,"ParameterStructures",{enumerable:!0,get:function(){return Ke.ParameterStructures}});var Wd=Ed();Object.defineProperty(w,"LinkedMap",{enumerable:!0,get:function(){return Wd.LinkedMap}});Object.defineProperty(w,"LRUCache",{enumerable:!0,get:function(){return Wd.LRUCache}});Object.defineProperty(w,"Touch",{enumerable:!0,get:function(){return Wd.Touch}});var wC=Vl();Object.defineProperty(w,"Disposable",{enumerable:!0,get:function(){return wC.Disposable}});var Fy=so();Object.defineProperty(w,"Event",{enumerable:!0,get:function(){return Fy.Event}});Object.defineProperty(w,"Emitter",{enumerable:!0,get:function(){return Fy.Emitter}});var qy=Sd();Object.defineProperty(w,"CancellationTokenSource",{enumerable:!0,get:function(){return qy.CancellationTokenSource}});Object.defineProperty(w,"CancellationToken",{enumerable:!0,get:function(){return qy.CancellationToken}});var Kd=Py();Object.defineProperty(w,"MessageReader",{enumerable:!0,get:function(){return Kd.MessageReader}});Object.defineProperty(w,"AbstractMessageReader",{enumerable:!0,get:function(){return Kd.AbstractMessageReader}});Object.defineProperty(w,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return Kd.ReadableStreamMessageReader}});var Bd=Dy();Object.defineProperty(w,"MessageWriter",{enumerable:!0,get:function(){return Bd.MessageWriter}});Object.defineProperty(w,"AbstractMessageWriter",{enumerable:!0,get:function(){return Bd.AbstractMessageWriter}});Object.defineProperty(w,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return Bd.WriteableStreamMessageWriter}});var Kt=Ly();Object.defineProperty(w,"ConnectionStrategy",{enumerable:!0,get:function(){return Kt.ConnectionStrategy}});Object.defineProperty(w,"ConnectionOptions",{enumerable:!0,get:function(){return Kt.ConnectionOptions}});Object.defineProperty(w,"NullLogger",{enumerable:!0,get:function(){return Kt.NullLogger}});Object.defineProperty(w,"createMessageConnection",{enumerable:!0,get:function(){return Kt.createMessageConnection}});Object.defineProperty(w,"ProgressToken",{enumerable:!0,get:function(){return Kt.ProgressToken}});Object.defineProperty(w,"ProgressType",{enumerable:!0,get:function(){return Kt.ProgressType}});Object.defineProperty(w,"Trace",{enumerable:!0,get:function(){return Kt.Trace}});Object.defineProperty(w,"TraceValues",{enumerable:!0,get:function(){return Kt.TraceValues}});Object.defineProperty(w,"TraceFormat",{enumerable:!0,get:function(){return Kt.TraceFormat}});Object.defineProperty(w,"SetTraceNotification",{enumerable:!0,get:function(){return Kt.SetTraceNotification}});Object.defineProperty(w,"LogTraceNotification",{enumerable:!0,get:function(){return Kt.LogTraceNotification}});Object.defineProperty(w,"ConnectionErrors",{enumerable:!0,get:function(){return Kt.ConnectionErrors}});Object.defineProperty(w,"ConnectionError",{enumerable:!0,get:function(){return Kt.ConnectionError}});Object.defineProperty(w,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return Kt.CancellationReceiverStrategy}});Object.defineProperty(w,"CancellationSenderStrategy",{enumerable:!0,get:function(){return Kt.CancellationSenderStrategy}});Object.defineProperty(w,"CancellationStrategy",{enumerable:!0,get:function(){return Kt.CancellationStrategy}});var IC=Mn();w.RAL=IC.default});var pn=C(be=>{"use strict";var OC=be&&be.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),$C=be&&be.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&OC(e,r,t)};Object.defineProperty(be,"__esModule",{value:!0});be.createMessageConnection=be.createServerSocketTransport=be.createClientSocketTransport=be.createServerPipeTransport=be.createClientPipeTransport=be.generateRandomPipeName=be.StreamMessageWriter=be.StreamMessageReader=be.SocketMessageWriter=be.SocketMessageReader=be.IPCMessageWriter=be.IPCMessageReader=void 0;var co=_y();co.default.install();var fn=zd(),jy=require("path"),MC=require("os"),LC=require("crypto"),Os=require("net");$C(zd(),be);var Vd=class extends fn.AbstractMessageReader{constructor(e){super(),this.process=e;let t=this.process;t.on("error",n=>this.fireError(n)),t.on("close",()=>this.fireClose())}listen(e){return this.process.on("message",e),fn.Disposable.create(()=>this.process.off("message",e))}};be.IPCMessageReader=Vd;var Yd=class extends fn.AbstractMessageWriter{constructor(e){super(),this.process=e,this.errorCount=0;let t=this.process;t.on("error",n=>this.fireError(n)),t.on("close",()=>this.fireClose)}write(e){try{return typeof this.process.send=="function"&&this.process.send(e,void 0,void 0,t=>{t?(this.errorCount++,this.handleError(t,e)):this.errorCount=0}),Promise.resolve()}catch(t){return this.handleError(t,e),Promise.reject(t)}}handleError(e,t){this.errorCount++,this.fireError(e,t,this.errorCount)}end(){}};be.IPCMessageWriter=Yd;var Di=class extends fn.ReadableStreamMessageReader{constructor(e,t="utf-8"){super((0,co.default)().stream.asReadableStream(e),t)}};be.SocketMessageReader=Di;var wi=class extends fn.WriteableStreamMessageWriter{constructor(e,t){super((0,co.default)().stream.asWritableStream(e),t),this.socket=e}dispose(){super.dispose(),this.socket.destroy()}};be.SocketMessageWriter=wi;var ws=class extends fn.ReadableStreamMessageReader{constructor(e,t){super((0,co.default)().stream.asReadableStream(e),t)}};be.StreamMessageReader=ws;var Is=class extends fn.WriteableStreamMessageWriter{constructor(e,t){super((0,co.default)().stream.asWritableStream(e),t)}};be.StreamMessageWriter=Is;var Gy=process.env.XDG_RUNTIME_DIR,FC=new Map([["linux",107],["darwin",103]]);function qC(){let r=(0,LC.randomBytes)(21).toString("hex");if(process.platform==="win32")return`\\\\.\\pipe\\vscode-jsonrpc-${r}-sock`;let e;Gy?e=jy.join(Gy,`vscode-ipc-${r}.sock`):e=jy.join(MC.tmpdir(),`vscode-${r}.sock`);let t=FC.get(process.platform);return t!==void 0&&e.length>=t&&(0,co.default)().console.warn(`WARNING: IPC handle "${e}" is longer than ${t} characters.`),e}be.generateRandomPipeName=qC;function jC(r,e="utf-8"){let t,n=new Promise((i,o)=>{t=i});return new Promise((i,o)=>{let a=(0,Os.createServer)(s=>{a.close(),t([new Di(s,e),new wi(s,e)])});a.on("error",o),a.listen(r,()=>{a.removeListener("error",o),i({onConnected:()=>n})})})}be.createClientPipeTransport=jC;function GC(r,e="utf-8"){let t=(0,Os.createConnection)(r);return[new Di(t,e),new wi(t,e)]}be.createServerPipeTransport=GC;function UC(r,e="utf-8"){let t,n=new Promise((i,o)=>{t=i});return new Promise((i,o)=>{let a=(0,Os.createServer)(s=>{a.close(),t([new Di(s,e),new wi(s,e)])});a.on("error",o),a.listen(r,"127.0.0.1",()=>{a.removeListener("error",o),i({onConnected:()=>n})})})}be.createClientSocketTransport=UC;function HC(r,e="utf-8"){let t=(0,Os.createConnection)(r,"127.0.0.1");return[new Di(t,e),new wi(t,e)]}be.createServerSocketTransport=HC;function WC(r){let e=r;return e.read!==void 0&&e.addListener!==void 0}function KC(r){let e=r;return e.write!==void 0&&e.addListener!==void 0}function BC(r,e,t,n){t||(t=fn.NullLogger);let i=WC(r)?new ws(r):r,o=KC(e)?new Is(e):e;return fn.ConnectionStrategy.is(n)&&(n={connectionStrategy:n}),(0,fn.createMessageConnection)(i,o,t,n)}be.createMessageConnection=BC});var Xd=C((PF,Uy)=>{"use strict";Uy.exports=pn()});var lo=C((Hy,$s)=>{(function(r){if(typeof $s=="object"&&typeof $s.exports=="object"){var e=r(require,Hy);e!==void 0&&($s.exports=e)}else typeof define=="function"&&define.amd&&define(["require","exports"],r)})(function(r,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TextDocument=e.EOL=e.WorkspaceFolder=e.InlayHint=e.InlayHintLabelPart=e.InlayHintKind=e.InlineValueContext=e.InlineValueEvaluatableExpression=e.InlineValueVariableLookup=e.InlineValueText=e.SemanticTokens=e.SemanticTokenModifiers=e.SemanticTokenTypes=e.SelectionRange=e.DocumentLink=e.FormattingOptions=e.CodeLens=e.CodeAction=e.CodeActionContext=e.CodeActionTriggerKind=e.CodeActionKind=e.DocumentSymbol=e.WorkspaceSymbol=e.SymbolInformation=e.SymbolTag=e.SymbolKind=e.DocumentHighlight=e.DocumentHighlightKind=e.SignatureInformation=e.ParameterInformation=e.Hover=e.MarkedString=e.CompletionList=e.CompletionItem=e.CompletionItemLabelDetails=e.InsertTextMode=e.InsertReplaceEdit=e.CompletionItemTag=e.InsertTextFormat=e.CompletionItemKind=e.MarkupContent=e.MarkupKind=e.TextDocumentItem=e.OptionalVersionedTextDocumentIdentifier=e.VersionedTextDocumentIdentifier=e.TextDocumentIdentifier=e.WorkspaceChange=e.WorkspaceEdit=e.DeleteFile=e.RenameFile=e.CreateFile=e.TextDocumentEdit=e.AnnotatedTextEdit=e.ChangeAnnotationIdentifier=e.ChangeAnnotation=e.TextEdit=e.Command=e.Diagnostic=e.CodeDescription=e.DiagnosticTag=e.DiagnosticSeverity=e.DiagnosticRelatedInformation=e.FoldingRange=e.FoldingRangeKind=e.ColorPresentation=e.ColorInformation=e.Color=e.LocationLink=e.Location=e.Range=e.Position=e.uinteger=e.integer=e.URI=e.DocumentUri=void 0;var t;(function(m){function E(P){return typeof P=="string"}m.is=E})(t=e.DocumentUri||(e.DocumentUri={}));var n;(function(m){function E(P){return typeof P=="string"}m.is=E})(n=e.URI||(e.URI={}));var i;(function(m){m.MIN_VALUE=-2147483648,m.MAX_VALUE=2147483647;function E(P){return typeof P=="number"&&m.MIN_VALUE<=P&&P<=m.MAX_VALUE}m.is=E})(i=e.integer||(e.integer={}));var o;(function(m){m.MIN_VALUE=0,m.MAX_VALUE=2147483647;function E(P){return typeof P=="number"&&m.MIN_VALUE<=P&&P<=m.MAX_VALUE}m.is=E})(o=e.uinteger||(e.uinteger={}));var a;(function(m){function E(v,f){return v===Number.MAX_VALUE&&(v=o.MAX_VALUE),f===Number.MAX_VALUE&&(f=o.MAX_VALUE),{line:v,character:f}}m.create=E;function P(v){var f=v;return S.objectLiteral(f)&&S.uinteger(f.line)&&S.uinteger(f.character)}m.is=P})(a=e.Position||(e.Position={}));var s;(function(m){function E(v,f,N,I){if(S.uinteger(v)&&S.uinteger(f)&&S.uinteger(N)&&S.uinteger(I))return{start:a.create(v,f),end:a.create(N,I)};if(a.is(v)&&a.is(f))return{start:v,end:f};throw new Error("Range#create called with invalid arguments[".concat(v,", ").concat(f,", ").concat(N,", ").concat(I,"]"))}m.create=E;function P(v){var f=v;return S.objectLiteral(f)&&a.is(f.start)&&a.is(f.end)}m.is=P})(s=e.Range||(e.Range={}));var u;(function(m){function E(v,f){return{uri:v,range:f}}m.create=E;function P(v){var f=v;return S.objectLiteral(f)&&s.is(f.range)&&(S.string(f.uri)||S.undefined(f.uri))}m.is=P})(u=e.Location||(e.Location={}));var c;(function(m){function E(v,f,N,I){return{targetUri:v,targetRange:f,targetSelectionRange:N,originSelectionRange:I}}m.create=E;function P(v){var f=v;return S.objectLiteral(f)&&s.is(f.targetRange)&&S.string(f.targetUri)&&s.is(f.targetSelectionRange)&&(s.is(f.originSelectionRange)||S.undefined(f.originSelectionRange))}m.is=P})(c=e.LocationLink||(e.LocationLink={}));var l;(function(m){function E(v,f,N,I){return{red:v,green:f,blue:N,alpha:I}}m.create=E;function P(v){var f=v;return S.objectLiteral(f)&&S.numberRange(f.red,0,1)&&S.numberRange(f.green,0,1)&&S.numberRange(f.blue,0,1)&&S.numberRange(f.alpha,0,1)}m.is=P})(l=e.Color||(e.Color={}));var d;(function(m){function E(v,f){return{range:v,color:f}}m.create=E;function P(v){var f=v;return S.objectLiteral(f)&&s.is(f.range)&&l.is(f.color)}m.is=P})(d=e.ColorInformation||(e.ColorInformation={}));var g;(function(m){function E(v,f,N){return{label:v,textEdit:f,additionalTextEdits:N}}m.create=E;function P(v){var f=v;return S.objectLiteral(f)&&S.string(f.label)&&(S.undefined(f.textEdit)||B.is(f))&&(S.undefined(f.additionalTextEdits)||S.typedArray(f.additionalTextEdits,B.is))}m.is=P})(g=e.ColorPresentation||(e.ColorPresentation={}));var y;(function(m){m.Comment="comment",m.Imports="imports",m.Region="region"})(y=e.FoldingRangeKind||(e.FoldingRangeKind={}));var p;(function(m){function E(v,f,N,I,re,ct){var We={startLine:v,endLine:f};return S.defined(N)&&(We.startCharacter=N),S.defined(I)&&(We.endCharacter=I),S.defined(re)&&(We.kind=re),S.defined(ct)&&(We.collapsedText=ct),We}m.create=E;function P(v){var f=v;return S.objectLiteral(f)&&S.uinteger(f.startLine)&&S.uinteger(f.startLine)&&(S.undefined(f.startCharacter)||S.uinteger(f.startCharacter))&&(S.undefined(f.endCharacter)||S.uinteger(f.endCharacter))&&(S.undefined(f.kind)||S.string(f.kind))}m.is=P})(p=e.FoldingRange||(e.FoldingRange={}));var A;(function(m){function E(v,f){return{location:v,message:f}}m.create=E;function P(v){var f=v;return S.defined(f)&&u.is(f.location)&&S.string(f.message)}m.is=P})(A=e.DiagnosticRelatedInformation||(e.DiagnosticRelatedInformation={}));var x;(function(m){m.Error=1,m.Warning=2,m.Information=3,m.Hint=4})(x=e.DiagnosticSeverity||(e.DiagnosticSeverity={}));var k;(function(m){m.Unnecessary=1,m.Deprecated=2})(k=e.DiagnosticTag||(e.DiagnosticTag={}));var _;(function(m){function E(P){var v=P;return S.objectLiteral(v)&&S.string(v.href)}m.is=E})(_=e.CodeDescription||(e.CodeDescription={}));var R;(function(m){function E(v,f,N,I,re,ct){var We={range:v,message:f};return S.defined(N)&&(We.severity=N),S.defined(I)&&(We.code=I),S.defined(re)&&(We.source=re),S.defined(ct)&&(We.relatedInformation=ct),We}m.create=E;function P(v){var f,N=v;return S.defined(N)&&s.is(N.range)&&S.string(N.message)&&(S.number(N.severity)||S.undefined(N.severity))&&(S.integer(N.code)||S.string(N.code)||S.undefined(N.code))&&(S.undefined(N.codeDescription)||S.string((f=N.codeDescription)===null||f===void 0?void 0:f.href))&&(S.string(N.source)||S.undefined(N.source))&&(S.undefined(N.relatedInformation)||S.typedArray(N.relatedInformation,A.is))}m.is=P})(R=e.Diagnostic||(e.Diagnostic={}));var D;(function(m){function E(v,f){for(var N=[],I=2;I<arguments.length;I++)N[I-2]=arguments[I];var re={title:v,command:f};return S.defined(N)&&N.length>0&&(re.arguments=N),re}m.create=E;function P(v){var f=v;return S.defined(f)&&S.string(f.title)&&S.string(f.command)}m.is=P})(D=e.Command||(e.Command={}));var B;(function(m){function E(N,I){return{range:N,newText:I}}m.replace=E;function P(N,I){return{range:{start:N,end:N},newText:I}}m.insert=P;function v(N){return{range:N,newText:""}}m.del=v;function f(N){var I=N;return S.objectLiteral(I)&&S.string(I.newText)&&s.is(I.range)}m.is=f})(B=e.TextEdit||(e.TextEdit={}));var V;(function(m){function E(v,f,N){var I={label:v};return f!==void 0&&(I.needsConfirmation=f),N!==void 0&&(I.description=N),I}m.create=E;function P(v){var f=v;return S.objectLiteral(f)&&S.string(f.label)&&(S.boolean(f.needsConfirmation)||f.needsConfirmation===void 0)&&(S.string(f.description)||f.description===void 0)}m.is=P})(V=e.ChangeAnnotation||(e.ChangeAnnotation={}));var G;(function(m){function E(P){var v=P;return S.string(v)}m.is=E})(G=e.ChangeAnnotationIdentifier||(e.ChangeAnnotationIdentifier={}));var ge;(function(m){function E(N,I,re){return{range:N,newText:I,annotationId:re}}m.replace=E;function P(N,I,re){return{range:{start:N,end:N},newText:I,annotationId:re}}m.insert=P;function v(N,I){return{range:N,newText:"",annotationId:I}}m.del=v;function f(N){var I=N;return B.is(I)&&(V.is(I.annotationId)||G.is(I.annotationId))}m.is=f})(ge=e.AnnotatedTextEdit||(e.AnnotatedTextEdit={}));var je;(function(m){function E(v,f){return{textDocument:v,edits:f}}m.create=E;function P(v){var f=v;return S.defined(f)&&Ae.is(f.textDocument)&&Array.isArray(f.edits)}m.is=P})(je=e.TextDocumentEdit||(e.TextDocumentEdit={}));var Ze;(function(m){function E(v,f,N){var I={kind:"create",uri:v};return f!==void 0&&(f.overwrite!==void 0||f.ignoreIfExists!==void 0)&&(I.options=f),N!==void 0&&(I.annotationId=N),I}m.create=E;function P(v){var f=v;return f&&f.kind==="create"&&S.string(f.uri)&&(f.options===void 0||(f.options.overwrite===void 0||S.boolean(f.options.overwrite))&&(f.options.ignoreIfExists===void 0||S.boolean(f.options.ignoreIfExists)))&&(f.annotationId===void 0||G.is(f.annotationId))}m.is=P})(Ze=e.CreateFile||(e.CreateFile={}));var Ge;(function(m){function E(v,f,N,I){var re={kind:"rename",oldUri:v,newUri:f};return N!==void 0&&(N.overwrite!==void 0||N.ignoreIfExists!==void 0)&&(re.options=N),I!==void 0&&(re.annotationId=I),re}m.create=E;function P(v){var f=v;return f&&f.kind==="rename"&&S.string(f.oldUri)&&S.string(f.newUri)&&(f.options===void 0||(f.options.overwrite===void 0||S.boolean(f.options.overwrite))&&(f.options.ignoreIfExists===void 0||S.boolean(f.options.ignoreIfExists)))&&(f.annotationId===void 0||G.is(f.annotationId))}m.is=P})(Ge=e.RenameFile||(e.RenameFile={}));var L;(function(m){function E(v,f,N){var I={kind:"delete",uri:v};return f!==void 0&&(f.recursive!==void 0||f.ignoreIfNotExists!==void 0)&&(I.options=f),N!==void 0&&(I.annotationId=N),I}m.create=E;function P(v){var f=v;return f&&f.kind==="delete"&&S.string(f.uri)&&(f.options===void 0||(f.options.recursive===void 0||S.boolean(f.options.recursive))&&(f.options.ignoreIfNotExists===void 0||S.boolean(f.options.ignoreIfNotExists)))&&(f.annotationId===void 0||G.is(f.annotationId))}m.is=P})(L=e.DeleteFile||(e.DeleteFile={}));var M;(function(m){function E(P){var v=P;return v&&(v.changes!==void 0||v.documentChanges!==void 0)&&(v.documentChanges===void 0||v.documentChanges.every(function(f){return S.string(f.kind)?Ze.is(f)||Ge.is(f)||L.is(f):je.is(f)}))}m.is=E})(M=e.WorkspaceEdit||(e.WorkspaceEdit={}));var F=function(){function m(E,P){this.edits=E,this.changeAnnotations=P}return m.prototype.insert=function(E,P,v){var f,N;if(v===void 0?f=B.insert(E,P):G.is(v)?(N=v,f=ge.insert(E,P,v)):(this.assertChangeAnnotations(this.changeAnnotations),N=this.changeAnnotations.manage(v),f=ge.insert(E,P,N)),this.edits.push(f),N!==void 0)return N},m.prototype.replace=function(E,P,v){var f,N;if(v===void 0?f=B.replace(E,P):G.is(v)?(N=v,f=ge.replace(E,P,v)):(this.assertChangeAnnotations(this.changeAnnotations),N=this.changeAnnotations.manage(v),f=ge.replace(E,P,N)),this.edits.push(f),N!==void 0)return N},m.prototype.delete=function(E,P){var v,f;if(P===void 0?v=B.del(E):G.is(P)?(f=P,v=ge.del(E,P)):(this.assertChangeAnnotations(this.changeAnnotations),f=this.changeAnnotations.manage(P),v=ge.del(E,f)),this.edits.push(v),f!==void 0)return f},m.prototype.add=function(E){this.edits.push(E)},m.prototype.all=function(){return this.edits},m.prototype.clear=function(){this.edits.splice(0,this.edits.length)},m.prototype.assertChangeAnnotations=function(E){if(E===void 0)throw new Error("Text edit change is not configured to manage change annotations.")},m}(),K=function(){function m(E){this._annotations=E===void 0?Object.create(null):E,this._counter=0,this._size=0}return m.prototype.all=function(){return this._annotations},Object.defineProperty(m.prototype,"size",{get:function(){return this._size},enumerable:!1,configurable:!0}),m.prototype.manage=function(E,P){var v;if(G.is(E)?v=E:(v=this.nextId(),P=E),this._annotations[v]!==void 0)throw new Error("Id ".concat(v," is already in use."));if(P===void 0)throw new Error("No annotation provided for id ".concat(v));return this._annotations[v]=P,this._size++,v},m.prototype.nextId=function(){return this._counter++,this._counter.toString()},m}(),pe=function(){function m(E){var P=this;this._textEditChanges=Object.create(null),E!==void 0?(this._workspaceEdit=E,E.documentChanges?(this._changeAnnotations=new K(E.changeAnnotations),E.changeAnnotations=this._changeAnnotations.all(),E.documentChanges.forEach(function(v){if(je.is(v)){var f=new F(v.edits,P._changeAnnotations);P._textEditChanges[v.textDocument.uri]=f}})):E.changes&&Object.keys(E.changes).forEach(function(v){var f=new F(E.changes[v]);P._textEditChanges[v]=f})):this._workspaceEdit={}}return Object.defineProperty(m.prototype,"edit",{get:function(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit},enumerable:!1,configurable:!0}),m.prototype.getTextEditChange=function(E){if(Ae.is(E)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var P={uri:E.uri,version:E.version},v=this._textEditChanges[P.uri];if(!v){var f=[],N={textDocument:P,edits:f};this._workspaceEdit.documentChanges.push(N),v=new F(f,this._changeAnnotations),this._textEditChanges[P.uri]=v}return v}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");var v=this._textEditChanges[E];if(!v){var f=[];this._workspaceEdit.changes[E]=f,v=new F(f),this._textEditChanges[E]=v}return v}},m.prototype.initDocumentChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new K,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())},m.prototype.initChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))},m.prototype.createFile=function(E,P,v){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var f;V.is(P)||G.is(P)?f=P:v=P;var N,I;if(f===void 0?N=Ze.create(E,v):(I=G.is(f)?f:this._changeAnnotations.manage(f),N=Ze.create(E,v,I)),this._workspaceEdit.documentChanges.push(N),I!==void 0)return I},m.prototype.renameFile=function(E,P,v,f){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var N;V.is(v)||G.is(v)?N=v:f=v;var I,re;if(N===void 0?I=Ge.create(E,P,f):(re=G.is(N)?N:this._changeAnnotations.manage(N),I=Ge.create(E,P,f,re)),this._workspaceEdit.documentChanges.push(I),re!==void 0)return re},m.prototype.deleteFile=function(E,P,v){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var f;V.is(P)||G.is(P)?f=P:v=P;var N,I;if(f===void 0?N=L.create(E,v):(I=G.is(f)?f:this._changeAnnotations.manage(f),N=L.create(E,v,I)),this._workspaceEdit.documentChanges.push(N),I!==void 0)return I},m}();e.WorkspaceChange=pe;var ee;(function(m){function E(v){return{uri:v}}m.create=E;function P(v){var f=v;return S.defined(f)&&S.string(f.uri)}m.is=P})(ee=e.TextDocumentIdentifier||(e.TextDocumentIdentifier={}));var ie;(function(m){function E(v,f){return{uri:v,version:f}}m.create=E;function P(v){var f=v;return S.defined(f)&&S.string(f.uri)&&S.integer(f.version)}m.is=P})(ie=e.VersionedTextDocumentIdentifier||(e.VersionedTextDocumentIdentifier={}));var Ae;(function(m){function E(v,f){return{uri:v,version:f}}m.create=E;function P(v){var f=v;return S.defined(f)&&S.string(f.uri)&&(f.version===null||S.integer(f.version))}m.is=P})(Ae=e.OptionalVersionedTextDocumentIdentifier||(e.OptionalVersionedTextDocumentIdentifier={}));var Ue;(function(m){function E(v,f,N,I){return{uri:v,languageId:f,version:N,text:I}}m.create=E;function P(v){var f=v;return S.defined(f)&&S.string(f.uri)&&S.string(f.languageId)&&S.integer(f.version)&&S.string(f.text)}m.is=P})(Ue=e.TextDocumentItem||(e.TextDocumentItem={}));var ft;(function(m){m.PlainText="plaintext",m.Markdown="markdown";function E(P){var v=P;return v===m.PlainText||v===m.Markdown}m.is=E})(ft=e.MarkupKind||(e.MarkupKind={}));var ur;(function(m){function E(P){var v=P;return S.objectLiteral(P)&&ft.is(v.kind)&&S.string(v.value)}m.is=E})(ur=e.MarkupContent||(e.MarkupContent={}));var yr;(function(m){m.Text=1,m.Method=2,m.Function=3,m.Constructor=4,m.Field=5,m.Variable=6,m.Class=7,m.Interface=8,m.Module=9,m.Property=10,m.Unit=11,m.Value=12,m.Enum=13,m.Keyword=14,m.Snippet=15,m.Color=16,m.File=17,m.Reference=18,m.Folder=19,m.EnumMember=20,m.Constant=21,m.Struct=22,m.Event=23,m.Operator=24,m.TypeParameter=25})(yr=e.CompletionItemKind||(e.CompletionItemKind={}));var Xi;(function(m){m.PlainText=1,m.Snippet=2})(Xi=e.InsertTextFormat||(e.InsertTextFormat={}));var Ji;(function(m){m.Deprecated=1})(Ji=e.CompletionItemTag||(e.CompletionItemTag={}));var Qt;(function(m){function E(v,f,N){return{newText:v,insert:f,replace:N}}m.create=E;function P(v){var f=v;return f&&S.string(f.newText)&&s.is(f.insert)&&s.is(f.replace)}m.is=P})(Qt=e.InsertReplaceEdit||(e.InsertReplaceEdit={}));var Zi;(function(m){m.asIs=1,m.adjustIndentation=2})(Zi=e.InsertTextMode||(e.InsertTextMode={}));var Qi;(function(m){function E(P){var v=P;return v&&(S.string(v.detail)||v.detail===void 0)&&(S.string(v.description)||v.description===void 0)}m.is=E})(Qi=e.CompletionItemLabelDetails||(e.CompletionItemLabelDetails={}));var ia;(function(m){function E(P){return{label:P}}m.create=E})(ia=e.CompletionItem||(e.CompletionItem={}));var Rr;(function(m){function E(P,v){return{items:P||[],isIncomplete:!!v}}m.create=E})(Rr=e.CompletionList||(e.CompletionList={}));var xt;(function(m){function E(v){return v.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}m.fromPlainText=E;function P(v){var f=v;return S.string(f)||S.objectLiteral(f)&&S.string(f.language)&&S.string(f.value)}m.is=P})(xt=e.MarkedString||(e.MarkedString={}));var oa;(function(m){function E(P){var v=P;return!!v&&S.objectLiteral(v)&&(ur.is(v.contents)||xt.is(v.contents)||S.typedArray(v.contents,xt.is))&&(P.range===void 0||s.is(P.range))}m.is=E})(oa=e.Hover||(e.Hover={}));var Ci;(function(m){function E(P,v){return v?{label:P,documentation:v}:{label:P}}m.create=E})(Ci=e.ParameterInformation||(e.ParameterInformation={}));var un;(function(m){function E(P,v){for(var f=[],N=2;N<arguments.length;N++)f[N-2]=arguments[N];var I={label:P};return S.defined(v)&&(I.documentation=v),S.defined(f)?I.parameters=f:I.parameters=[],I}m.create=E})(un=e.SignatureInformation||(e.SignatureInformation={}));var ti;(function(m){m.Text=1,m.Read=2,m.Write=3})(ti=e.DocumentHighlightKind||(e.DocumentHighlightKind={}));var wn;(function(m){function E(P,v){var f={range:P};return S.number(v)&&(f.kind=v),f}m.create=E})(wn=e.DocumentHighlight||(e.DocumentHighlight={}));var Pi;(function(m){m.File=1,m.Module=2,m.Namespace=3,m.Package=4,m.Class=5,m.Method=6,m.Property=7,m.Field=8,m.Constructor=9,m.Enum=10,m.Interface=11,m.Function=12,m.Variable=13,m.Constant=14,m.String=15,m.Number=16,m.Boolean=17,m.Array=18,m.Object=19,m.Key=20,m.Null=21,m.EnumMember=22,m.Struct=23,m.Event=24,m.Operator=25,m.TypeParameter=26})(Pi=e.SymbolKind||(e.SymbolKind={}));var _r;(function(m){m.Deprecated=1})(_r=e.SymbolTag||(e.SymbolTag={}));var cn;(function(m){function E(P,v,f,N,I){var re={name:P,kind:v,location:{uri:N,range:f}};return I&&(re.containerName=I),re}m.create=E})(cn=e.SymbolInformation||(e.SymbolInformation={}));var eo;(function(m){function E(P,v,f,N){return N!==void 0?{name:P,kind:v,location:{uri:f,range:N}}:{name:P,kind:v,location:{uri:f}}}m.create=E})(eo=e.WorkspaceSymbol||(e.WorkspaceSymbol={}));var In;(function(m){function E(v,f,N,I,re,ct){var We={name:v,detail:f,kind:N,range:I,selectionRange:re};return ct!==void 0&&(We.children=ct),We}m.create=E;function P(v){var f=v;return f&&S.string(f.name)&&S.number(f.kind)&&s.is(f.range)&&s.is(f.selectionRange)&&(f.detail===void 0||S.string(f.detail))&&(f.deprecated===void 0||S.boolean(f.deprecated))&&(f.children===void 0||Array.isArray(f.children))&&(f.tags===void 0||Array.isArray(f.tags))}m.is=P})(In=e.DocumentSymbol||(e.DocumentSymbol={}));var Lr;(function(m){m.Empty="",m.QuickFix="quickfix",m.Refactor="refactor",m.RefactorExtract="refactor.extract",m.RefactorInline="refactor.inline",m.RefactorRewrite="refactor.rewrite",m.Source="source",m.SourceOrganizeImports="source.organizeImports",m.SourceFixAll="source.fixAll"})(Lr=e.CodeActionKind||(e.CodeActionKind={}));var ut;(function(m){m.Invoked=1,m.Automatic=2})(ut=e.CodeActionTriggerKind||(e.CodeActionTriggerKind={}));var ln;(function(m){function E(v,f,N){var I={diagnostics:v};return f!=null&&(I.only=f),N!=null&&(I.triggerKind=N),I}m.create=E;function P(v){var f=v;return S.defined(f)&&S.typedArray(f.diagnostics,R.is)&&(f.only===void 0||S.typedArray(f.only,S.string))&&(f.triggerKind===void 0||f.triggerKind===ut.Invoked||f.triggerKind===ut.Automatic)}m.is=P})(ln=e.CodeActionContext||(e.CodeActionContext={}));var Ar;(function(m){function E(v,f,N){var I={title:v},re=!0;return typeof f=="string"?(re=!1,I.kind=f):D.is(f)?I.command=f:I.edit=f,re&&N!==void 0&&(I.kind=N),I}m.create=E;function P(v){var f=v;return f&&S.string(f.title)&&(f.diagnostics===void 0||S.typedArray(f.diagnostics,R.is))&&(f.kind===void 0||S.string(f.kind))&&(f.edit!==void 0||f.command!==void 0)&&(f.command===void 0||D.is(f.command))&&(f.isPreferred===void 0||S.boolean(f.isPreferred))&&(f.edit===void 0||M.is(f.edit))}m.is=P})(Ar=e.CodeAction||(e.CodeAction={}));var to;(function(m){function E(v,f){var N={range:v};return S.defined(f)&&(N.data=f),N}m.create=E;function P(v){var f=v;return S.defined(f)&&s.is(f.range)&&(S.undefined(f.command)||D.is(f.command))}m.is=P})(to=e.CodeLens||(e.CodeLens={}));var ri;(function(m){function E(v,f){return{tabSize:v,insertSpaces:f}}m.create=E;function P(v){var f=v;return S.defined(f)&&S.uinteger(f.tabSize)&&S.boolean(f.insertSpaces)}m.is=P})(ri=e.FormattingOptions||(e.FormattingOptions={}));var b;(function(m){function E(v,f,N){return{range:v,target:f,data:N}}m.create=E;function P(v){var f=v;return S.defined(f)&&s.is(f.range)&&(S.undefined(f.target)||S.string(f.target))}m.is=P})(b=e.DocumentLink||(e.DocumentLink={}));var O;(function(m){function E(v,f){return{range:v,parent:f}}m.create=E;function P(v){var f=v;return S.objectLiteral(f)&&s.is(f.range)&&(f.parent===void 0||m.is(f.parent))}m.is=P})(O=e.SelectionRange||(e.SelectionRange={}));var j;(function(m){m.namespace="namespace",m.type="type",m.class="class",m.enum="enum",m.interface="interface",m.struct="struct",m.typeParameter="typeParameter",m.parameter="parameter",m.variable="variable",m.property="property",m.enumMember="enumMember",m.event="event",m.function="function",m.method="method",m.macro="macro",m.keyword="keyword",m.modifier="modifier",m.comment="comment",m.string="string",m.number="number",m.regexp="regexp",m.operator="operator",m.decorator="decorator"})(j=e.SemanticTokenTypes||(e.SemanticTokenTypes={}));var z;(function(m){m.declaration="declaration",m.definition="definition",m.readonly="readonly",m.static="static",m.deprecated="deprecated",m.abstract="abstract",m.async="async",m.modification="modification",m.documentation="documentation",m.defaultLibrary="defaultLibrary"})(z=e.SemanticTokenModifiers||(e.SemanticTokenModifiers={}));var Oe;(function(m){function E(P){var v=P;return S.objectLiteral(v)&&(v.resultId===void 0||typeof v.resultId=="string")&&Array.isArray(v.data)&&(v.data.length===0||typeof v.data[0]=="number")}m.is=E})(Oe=e.SemanticTokens||(e.SemanticTokens={}));var $e;(function(m){function E(v,f){return{range:v,text:f}}m.create=E;function P(v){var f=v;return f!=null&&s.is(f.range)&&S.string(f.text)}m.is=P})($e=e.InlineValueText||(e.InlineValueText={}));var Qe;(function(m){function E(v,f,N){return{range:v,variableName:f,caseSensitiveLookup:N}}m.create=E;function P(v){var f=v;return f!=null&&s.is(f.range)&&S.boolean(f.caseSensitiveLookup)&&(S.string(f.variableName)||f.variableName===void 0)}m.is=P})(Qe=e.InlineValueVariableLookup||(e.InlineValueVariableLookup={}));var ht;(function(m){function E(v,f){return{range:v,expression:f}}m.create=E;function P(v){var f=v;return f!=null&&s.is(f.range)&&(S.string(f.expression)||f.expression===void 0)}m.is=P})(ht=e.InlineValueEvaluatableExpression||(e.InlineValueEvaluatableExpression={}));var le;(function(m){function E(v,f){return{frameId:v,stoppedLocation:f}}m.create=E;function P(v){var f=v;return S.defined(f)&&s.is(v.stoppedLocation)}m.is=P})(le=e.InlineValueContext||(e.InlineValueContext={}));var He;(function(m){m.Type=1,m.Parameter=2;function E(P){return P===1||P===2}m.is=E})(He=e.InlayHintKind||(e.InlayHintKind={}));var ve;(function(m){function E(v){return{value:v}}m.create=E;function P(v){var f=v;return S.objectLiteral(f)&&(f.tooltip===void 0||S.string(f.tooltip)||ur.is(f.tooltip))&&(f.location===void 0||u.is(f.location))&&(f.command===void 0||D.is(f.command))}m.is=P})(ve=e.InlayHintLabelPart||(e.InlayHintLabelPart={}));var pt;(function(m){function E(v,f,N){var I={position:v,label:f};return N!==void 0&&(I.kind=N),I}m.create=E;function P(v){var f=v;return S.objectLiteral(f)&&a.is(f.position)&&(S.string(f.label)||S.typedArray(f.label,ve.is))&&(f.kind===void 0||He.is(f.kind))&&f.textEdits===void 0||S.typedArray(f.textEdits,B.is)&&(f.tooltip===void 0||S.string(f.tooltip)||ur.is(f.tooltip))&&(f.paddingLeft===void 0||S.boolean(f.paddingLeft))&&(f.paddingRight===void 0||S.boolean(f.paddingRight))}m.is=P})(pt=e.InlayHint||(e.InlayHint={}));var Ut;(function(m){function E(P){var v=P;return S.objectLiteral(v)&&n.is(v.uri)&&S.string(v.name)}m.is=E})(Ut=e.WorkspaceFolder||(e.WorkspaceFolder={})),e.EOL=[`
30
30
  `,`\r
31
- `,"\r"];var $n;(function(m){function E(N,I,re,ct){return new dn(N,I,re,ct)}m.create=E;function P(N){var I=N;return!!(S.defined(I)&&S.string(I.uri)&&(S.undefined(I.languageId)||S.string(I.languageId))&&S.uinteger(I.lineCount)&&S.func(I.getText)&&S.func(I.positionAt)&&S.func(I.offsetAt))}m.is=P;function v(N,I){for(var re=N.getText(),ct=f(I,function(ro,bs){var dy=ro.range.start.line-bs.range.start.line;return dy===0?ro.range.start.character-bs.range.start.character:dy}),We=re.length,Fr=ct.length-1;Fr>=0;Fr--){var qr=ct[Fr],Mn=N.offsetAt(qr.range.start),de=N.offsetAt(qr.range.end);if(de<=We)re=re.substring(0,Mn)+qr.newText+re.substring(de,re.length);else throw new Error("Overlapping edit");We=Mn}return re}m.applyEdits=v;function f(N,I){if(N.length<=1)return N;var re=N.length/2|0,ct=N.slice(0,re),We=N.slice(re);f(ct,I),f(We,I);for(var Fr=0,qr=0,Mn=0;Fr<ct.length&&qr<We.length;){var de=I(ct[Fr],We[qr]);de<=0?N[Mn++]=ct[Fr++]:N[Mn++]=We[qr++]}for(;Fr<ct.length;)N[Mn++]=ct[Fr++];for(;qr<We.length;)N[Mn++]=We[qr++];return N}})($n=e.TextDocument||(e.TextDocument={}));var dn=function(){function m(E,P,v,f){this._uri=E,this._languageId=P,this._version=v,this._content=f,this._lineOffsets=void 0}return Object.defineProperty(m.prototype,"uri",{get:function(){return this._uri},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"languageId",{get:function(){return this._languageId},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"version",{get:function(){return this._version},enumerable:!1,configurable:!0}),m.prototype.getText=function(E){if(E){var P=this.offsetAt(E.start),v=this.offsetAt(E.end);return this._content.substring(P,v)}return this._content},m.prototype.update=function(E,P){this._content=E.text,this._version=P,this._lineOffsets=void 0},m.prototype.getLineOffsets=function(){if(this._lineOffsets===void 0){for(var E=[],P=this._content,v=!0,f=0;f<P.length;f++){v&&(E.push(f),v=!1);var N=P.charAt(f);v=N==="\r"||N===`
31
+ `,"\r"];var On;(function(m){function E(N,I,re,ct){return new dn(N,I,re,ct)}m.create=E;function P(N){var I=N;return!!(S.defined(I)&&S.string(I.uri)&&(S.undefined(I.languageId)||S.string(I.languageId))&&S.uinteger(I.lineCount)&&S.func(I.getText)&&S.func(I.positionAt)&&S.func(I.offsetAt))}m.is=P;function v(N,I){for(var re=N.getText(),ct=f(I,function(ro,As){var cy=ro.range.start.line-As.range.start.line;return cy===0?ro.range.start.character-As.range.start.character:cy}),We=re.length,Fr=ct.length-1;Fr>=0;Fr--){var qr=ct[Fr],$n=N.offsetAt(qr.range.start),de=N.offsetAt(qr.range.end);if(de<=We)re=re.substring(0,$n)+qr.newText+re.substring(de,re.length);else throw new Error("Overlapping edit");We=$n}return re}m.applyEdits=v;function f(N,I){if(N.length<=1)return N;var re=N.length/2|0,ct=N.slice(0,re),We=N.slice(re);f(ct,I),f(We,I);for(var Fr=0,qr=0,$n=0;Fr<ct.length&&qr<We.length;){var de=I(ct[Fr],We[qr]);de<=0?N[$n++]=ct[Fr++]:N[$n++]=We[qr++]}for(;Fr<ct.length;)N[$n++]=ct[Fr++];for(;qr<We.length;)N[$n++]=We[qr++];return N}})(On=e.TextDocument||(e.TextDocument={}));var dn=function(){function m(E,P,v,f){this._uri=E,this._languageId=P,this._version=v,this._content=f,this._lineOffsets=void 0}return Object.defineProperty(m.prototype,"uri",{get:function(){return this._uri},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"languageId",{get:function(){return this._languageId},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"version",{get:function(){return this._version},enumerable:!1,configurable:!0}),m.prototype.getText=function(E){if(E){var P=this.offsetAt(E.start),v=this.offsetAt(E.end);return this._content.substring(P,v)}return this._content},m.prototype.update=function(E,P){this._content=E.text,this._version=P,this._lineOffsets=void 0},m.prototype.getLineOffsets=function(){if(this._lineOffsets===void 0){for(var E=[],P=this._content,v=!0,f=0;f<P.length;f++){v&&(E.push(f),v=!1);var N=P.charAt(f);v=N==="\r"||N===`
32
32
  `,N==="\r"&&f+1<P.length&&P.charAt(f+1)===`
33
- `&&f++}v&&P.length>0&&E.push(P.length),this._lineOffsets=E}return this._lineOffsets},m.prototype.positionAt=function(E){E=Math.max(Math.min(E,this._content.length),0);var P=this.getLineOffsets(),v=0,f=P.length;if(f===0)return a.create(0,E);for(;v<f;){var N=Math.floor((v+f)/2);P[N]>E?f=N:v=N+1}var I=v-1;return a.create(I,E-P[I])},m.prototype.offsetAt=function(E){var P=this.getLineOffsets();if(E.line>=P.length)return this._content.length;if(E.line<0)return 0;var v=P[E.line],f=E.line+1<P.length?P[E.line+1]:this._content.length;return Math.max(Math.min(v+E.character,f),v)},Object.defineProperty(m.prototype,"lineCount",{get:function(){return this.getLineOffsets().length},enumerable:!1,configurable:!0}),m}(),S;(function(m){var E=Object.prototype.toString;function P(de){return typeof de<"u"}m.defined=P;function v(de){return typeof de>"u"}m.undefined=v;function f(de){return de===!0||de===!1}m.boolean=f;function N(de){return E.call(de)==="[object String]"}m.string=N;function I(de){return E.call(de)==="[object Number]"}m.number=I;function re(de,ro,bs){return E.call(de)==="[object Number]"&&ro<=de&&de<=bs}m.numberRange=re;function ct(de){return E.call(de)==="[object Number]"&&-2147483648<=de&&de<=2147483647}m.integer=ct;function We(de){return E.call(de)==="[object Number]"&&0<=de&&de<=2147483647}m.uinteger=We;function Fr(de){return E.call(de)==="[object Function]"}m.func=Fr;function qr(de){return de!==null&&typeof de=="object"}m.objectLiteral=qr;function Mn(de,ro){return Array.isArray(de)&&de.every(ro)}m.typedArray=Mn})(S||(S={}))})});var it=C(tr=>{"use strict";Object.defineProperty(tr,"__esModule",{value:!0});tr.ProtocolNotificationType=tr.ProtocolNotificationType0=tr.ProtocolRequestType=tr.ProtocolRequestType0=tr.RegistrationType=tr.MessageDirection=void 0;var fo=pn(),XC;(function(r){r.clientToServer="clientToServer",r.serverToClient="serverToClient",r.both="both"})(XC=tr.MessageDirection||(tr.MessageDirection={}));var Qd=class{constructor(e){this.method=e}};tr.RegistrationType=Qd;var ef=class extends fo.RequestType0{constructor(e){super(e)}};tr.ProtocolRequestType0=ef;var tf=class extends fo.RequestType{constructor(e){super(e,fo.ParameterStructures.byName)}};tr.ProtocolRequestType=tf;var rf=class extends fo.NotificationType0{constructor(e){super(e)}};tr.ProtocolNotificationType0=rf;var nf=class extends fo.NotificationType{constructor(e){super(e,fo.ParameterStructures.byName)}};tr.ProtocolNotificationType=nf});var Ls=C(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.objectLiteral=gt.typedArray=gt.stringArray=gt.array=gt.func=gt.error=gt.number=gt.string=gt.boolean=void 0;function JC(r){return r===!0||r===!1}gt.boolean=JC;function By(r){return typeof r=="string"||r instanceof String}gt.string=By;function ZC(r){return typeof r=="number"||r instanceof Number}gt.number=ZC;function QC(r){return r instanceof Error}gt.error=QC;function eP(r){return typeof r=="function"}gt.func=eP;function zy(r){return Array.isArray(r)}gt.array=zy;function tP(r){return zy(r)&&r.every(e=>By(e))}gt.stringArray=tP;function rP(r,e){return Array.isArray(r)&&r.every(e)}gt.typedArray=rP;function nP(r){return r!==null&&typeof r=="object"}gt.objectLiteral=nP});var Yy=C(fa=>{"use strict";Object.defineProperty(fa,"__esModule",{value:!0});fa.ImplementationRequest=void 0;var Vy=it(),iP;(function(r){r.method="textDocument/implementation",r.messageDirection=Vy.MessageDirection.clientToServer,r.type=new Vy.ProtocolRequestType(r.method)})(iP=fa.ImplementationRequest||(fa.ImplementationRequest={}))});var Jy=C(pa=>{"use strict";Object.defineProperty(pa,"__esModule",{value:!0});pa.TypeDefinitionRequest=void 0;var Xy=it(),oP;(function(r){r.method="textDocument/typeDefinition",r.messageDirection=Xy.MessageDirection.clientToServer,r.type=new Xy.ProtocolRequestType(r.method)})(oP=pa.TypeDefinitionRequest||(pa.TypeDefinitionRequest={}))});var Zy=C(ii=>{"use strict";Object.defineProperty(ii,"__esModule",{value:!0});ii.DidChangeWorkspaceFoldersNotification=ii.WorkspaceFoldersRequest=void 0;var Fs=it(),aP;(function(r){r.method="workspace/workspaceFolders",r.messageDirection=Fs.MessageDirection.serverToClient,r.type=new Fs.ProtocolRequestType0(r.method)})(aP=ii.WorkspaceFoldersRequest||(ii.WorkspaceFoldersRequest={}));var sP;(function(r){r.method="workspace/didChangeWorkspaceFolders",r.messageDirection=Fs.MessageDirection.clientToServer,r.type=new Fs.ProtocolNotificationType(r.method)})(sP=ii.DidChangeWorkspaceFoldersNotification||(ii.DidChangeWorkspaceFoldersNotification={}))});var eg=C(ma=>{"use strict";Object.defineProperty(ma,"__esModule",{value:!0});ma.ConfigurationRequest=void 0;var Qy=it(),uP;(function(r){r.method="workspace/configuration",r.messageDirection=Qy.MessageDirection.serverToClient,r.type=new Qy.ProtocolRequestType(r.method)})(uP=ma.ConfigurationRequest||(ma.ConfigurationRequest={}))});var tg=C(oi=>{"use strict";Object.defineProperty(oi,"__esModule",{value:!0});oi.ColorPresentationRequest=oi.DocumentColorRequest=void 0;var qs=it(),cP;(function(r){r.method="textDocument/documentColor",r.messageDirection=qs.MessageDirection.clientToServer,r.type=new qs.ProtocolRequestType(r.method)})(cP=oi.DocumentColorRequest||(oi.DocumentColorRequest={}));var lP;(function(r){r.method="textDocument/colorPresentation",r.messageDirection=qs.MessageDirection.clientToServer,r.type=new qs.ProtocolRequestType(r.method)})(lP=oi.ColorPresentationRequest||(oi.ColorPresentationRequest={}))});var ng=C(ha=>{"use strict";Object.defineProperty(ha,"__esModule",{value:!0});ha.FoldingRangeRequest=void 0;var rg=it(),dP;(function(r){r.method="textDocument/foldingRange",r.messageDirection=rg.MessageDirection.clientToServer,r.type=new rg.ProtocolRequestType(r.method)})(dP=ha.FoldingRangeRequest||(ha.FoldingRangeRequest={}))});var og=C(ya=>{"use strict";Object.defineProperty(ya,"__esModule",{value:!0});ya.DeclarationRequest=void 0;var ig=it(),fP;(function(r){r.method="textDocument/declaration",r.messageDirection=ig.MessageDirection.clientToServer,r.type=new ig.ProtocolRequestType(r.method)})(fP=ya.DeclarationRequest||(ya.DeclarationRequest={}))});var sg=C(ga=>{"use strict";Object.defineProperty(ga,"__esModule",{value:!0});ga.SelectionRangeRequest=void 0;var ag=it(),pP;(function(r){r.method="textDocument/selectionRange",r.messageDirection=ag.MessageDirection.clientToServer,r.type=new ag.ProtocolRequestType(r.method)})(pP=ga.SelectionRangeRequest||(ga.SelectionRangeRequest={}))});var ug=C(Ur=>{"use strict";Object.defineProperty(Ur,"__esModule",{value:!0});Ur.WorkDoneProgressCancelNotification=Ur.WorkDoneProgressCreateRequest=Ur.WorkDoneProgress=void 0;var mP=pn(),js=it(),hP;(function(r){r.type=new mP.ProgressType;function e(t){return t===r.type}r.is=e})(hP=Ur.WorkDoneProgress||(Ur.WorkDoneProgress={}));var yP;(function(r){r.method="window/workDoneProgress/create",r.messageDirection=js.MessageDirection.serverToClient,r.type=new js.ProtocolRequestType(r.method)})(yP=Ur.WorkDoneProgressCreateRequest||(Ur.WorkDoneProgressCreateRequest={}));var gP;(function(r){r.method="window/workDoneProgress/cancel",r.messageDirection=js.MessageDirection.clientToServer,r.type=new js.ProtocolNotificationType(r.method)})(gP=Ur.WorkDoneProgressCancelNotification||(Ur.WorkDoneProgressCancelNotification={}))});var cg=C(Hr=>{"use strict";Object.defineProperty(Hr,"__esModule",{value:!0});Hr.CallHierarchyOutgoingCallsRequest=Hr.CallHierarchyIncomingCallsRequest=Hr.CallHierarchyPrepareRequest=void 0;var po=it(),vP;(function(r){r.method="textDocument/prepareCallHierarchy",r.messageDirection=po.MessageDirection.clientToServer,r.type=new po.ProtocolRequestType(r.method)})(vP=Hr.CallHierarchyPrepareRequest||(Hr.CallHierarchyPrepareRequest={}));var TP;(function(r){r.method="callHierarchy/incomingCalls",r.messageDirection=po.MessageDirection.clientToServer,r.type=new po.ProtocolRequestType(r.method)})(TP=Hr.CallHierarchyIncomingCallsRequest||(Hr.CallHierarchyIncomingCallsRequest={}));var RP;(function(r){r.method="callHierarchy/outgoingCalls",r.messageDirection=po.MessageDirection.clientToServer,r.type=new po.ProtocolRequestType(r.method)})(RP=Hr.CallHierarchyOutgoingCallsRequest||(Hr.CallHierarchyOutgoingCallsRequest={}))});var lg=C(vt=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});vt.SemanticTokensRefreshRequest=vt.SemanticTokensRangeRequest=vt.SemanticTokensDeltaRequest=vt.SemanticTokensRequest=vt.SemanticTokensRegistrationType=vt.TokenFormat=void 0;var Gn=it(),_P;(function(r){r.Relative="relative"})(_P=vt.TokenFormat||(vt.TokenFormat={}));var Gs;(function(r){r.method="textDocument/semanticTokens",r.type=new Gn.RegistrationType(r.method)})(Gs=vt.SemanticTokensRegistrationType||(vt.SemanticTokensRegistrationType={}));var AP;(function(r){r.method="textDocument/semanticTokens/full",r.messageDirection=Gn.MessageDirection.clientToServer,r.type=new Gn.ProtocolRequestType(r.method),r.registrationMethod=Gs.method})(AP=vt.SemanticTokensRequest||(vt.SemanticTokensRequest={}));var bP;(function(r){r.method="textDocument/semanticTokens/full/delta",r.messageDirection=Gn.MessageDirection.clientToServer,r.type=new Gn.ProtocolRequestType(r.method),r.registrationMethod=Gs.method})(bP=vt.SemanticTokensDeltaRequest||(vt.SemanticTokensDeltaRequest={}));var EP;(function(r){r.method="textDocument/semanticTokens/range",r.messageDirection=Gn.MessageDirection.clientToServer,r.type=new Gn.ProtocolRequestType(r.method),r.registrationMethod=Gs.method})(EP=vt.SemanticTokensRangeRequest||(vt.SemanticTokensRangeRequest={}));var CP;(function(r){r.method="workspace/semanticTokens/refresh",r.messageDirection=Gn.MessageDirection.clientToServer,r.type=new Gn.ProtocolRequestType0(r.method)})(CP=vt.SemanticTokensRefreshRequest||(vt.SemanticTokensRefreshRequest={}))});var fg=C(va=>{"use strict";Object.defineProperty(va,"__esModule",{value:!0});va.ShowDocumentRequest=void 0;var dg=it(),PP;(function(r){r.method="window/showDocument",r.messageDirection=dg.MessageDirection.serverToClient,r.type=new dg.ProtocolRequestType(r.method)})(PP=va.ShowDocumentRequest||(va.ShowDocumentRequest={}))});var mg=C(Ta=>{"use strict";Object.defineProperty(Ta,"__esModule",{value:!0});Ta.LinkedEditingRangeRequest=void 0;var pg=it(),kP;(function(r){r.method="textDocument/linkedEditingRange",r.messageDirection=pg.MessageDirection.clientToServer,r.type=new pg.ProtocolRequestType(r.method)})(kP=Ta.LinkedEditingRangeRequest||(Ta.LinkedEditingRangeRequest={}))});var hg=C(ot=>{"use strict";Object.defineProperty(ot,"__esModule",{value:!0});ot.WillDeleteFilesRequest=ot.DidDeleteFilesNotification=ot.DidRenameFilesNotification=ot.WillRenameFilesRequest=ot.DidCreateFilesNotification=ot.WillCreateFilesRequest=ot.FileOperationPatternKind=void 0;var br=it(),xP;(function(r){r.file="file",r.folder="folder"})(xP=ot.FileOperationPatternKind||(ot.FileOperationPatternKind={}));var SP;(function(r){r.method="workspace/willCreateFiles",r.messageDirection=br.MessageDirection.clientToServer,r.type=new br.ProtocolRequestType(r.method)})(SP=ot.WillCreateFilesRequest||(ot.WillCreateFilesRequest={}));var NP;(function(r){r.method="workspace/didCreateFiles",r.messageDirection=br.MessageDirection.clientToServer,r.type=new br.ProtocolNotificationType(r.method)})(NP=ot.DidCreateFilesNotification||(ot.DidCreateFilesNotification={}));var DP;(function(r){r.method="workspace/willRenameFiles",r.messageDirection=br.MessageDirection.clientToServer,r.type=new br.ProtocolRequestType(r.method)})(DP=ot.WillRenameFilesRequest||(ot.WillRenameFilesRequest={}));var wP;(function(r){r.method="workspace/didRenameFiles",r.messageDirection=br.MessageDirection.clientToServer,r.type=new br.ProtocolNotificationType(r.method)})(wP=ot.DidRenameFilesNotification||(ot.DidRenameFilesNotification={}));var IP;(function(r){r.method="workspace/didDeleteFiles",r.messageDirection=br.MessageDirection.clientToServer,r.type=new br.ProtocolNotificationType(r.method)})(IP=ot.DidDeleteFilesNotification||(ot.DidDeleteFilesNotification={}));var OP;(function(r){r.method="workspace/willDeleteFiles",r.messageDirection=br.MessageDirection.clientToServer,r.type=new br.ProtocolRequestType(r.method)})(OP=ot.WillDeleteFilesRequest||(ot.WillDeleteFilesRequest={}))});var gg=C(Wr=>{"use strict";Object.defineProperty(Wr,"__esModule",{value:!0});Wr.MonikerRequest=Wr.MonikerKind=Wr.UniquenessLevel=void 0;var yg=it(),$P;(function(r){r.document="document",r.project="project",r.group="group",r.scheme="scheme",r.global="global"})($P=Wr.UniquenessLevel||(Wr.UniquenessLevel={}));var MP;(function(r){r.$import="import",r.$export="export",r.local="local"})(MP=Wr.MonikerKind||(Wr.MonikerKind={}));var LP;(function(r){r.method="textDocument/moniker",r.messageDirection=yg.MessageDirection.clientToServer,r.type=new yg.ProtocolRequestType(r.method)})(LP=Wr.MonikerRequest||(Wr.MonikerRequest={}))});var vg=C(Kr=>{"use strict";Object.defineProperty(Kr,"__esModule",{value:!0});Kr.TypeHierarchySubtypesRequest=Kr.TypeHierarchySupertypesRequest=Kr.TypeHierarchyPrepareRequest=void 0;var mo=it(),FP;(function(r){r.method="textDocument/prepareTypeHierarchy",r.messageDirection=mo.MessageDirection.clientToServer,r.type=new mo.ProtocolRequestType(r.method)})(FP=Kr.TypeHierarchyPrepareRequest||(Kr.TypeHierarchyPrepareRequest={}));var qP;(function(r){r.method="typeHierarchy/supertypes",r.messageDirection=mo.MessageDirection.clientToServer,r.type=new mo.ProtocolRequestType(r.method)})(qP=Kr.TypeHierarchySupertypesRequest||(Kr.TypeHierarchySupertypesRequest={}));var jP;(function(r){r.method="typeHierarchy/subtypes",r.messageDirection=mo.MessageDirection.clientToServer,r.type=new mo.ProtocolRequestType(r.method)})(jP=Kr.TypeHierarchySubtypesRequest||(Kr.TypeHierarchySubtypesRequest={}))});var Tg=C(ai=>{"use strict";Object.defineProperty(ai,"__esModule",{value:!0});ai.InlineValueRefreshRequest=ai.InlineValueRequest=void 0;var Us=it(),GP;(function(r){r.method="textDocument/inlineValue",r.messageDirection=Us.MessageDirection.clientToServer,r.type=new Us.ProtocolRequestType(r.method)})(GP=ai.InlineValueRequest||(ai.InlineValueRequest={}));var UP;(function(r){r.method="workspace/inlineValue/refresh",r.messageDirection=Us.MessageDirection.clientToServer,r.type=new Us.ProtocolRequestType0(r.method)})(UP=ai.InlineValueRefreshRequest||(ai.InlineValueRefreshRequest={}))});var Rg=C(Br=>{"use strict";Object.defineProperty(Br,"__esModule",{value:!0});Br.InlayHintRefreshRequest=Br.InlayHintResolveRequest=Br.InlayHintRequest=void 0;var ho=it(),HP;(function(r){r.method="textDocument/inlayHint",r.messageDirection=ho.MessageDirection.clientToServer,r.type=new ho.ProtocolRequestType(r.method)})(HP=Br.InlayHintRequest||(Br.InlayHintRequest={}));var WP;(function(r){r.method="inlayHint/resolve",r.messageDirection=ho.MessageDirection.clientToServer,r.type=new ho.ProtocolRequestType(r.method)})(WP=Br.InlayHintResolveRequest||(Br.InlayHintResolveRequest={}));var KP;(function(r){r.method="workspace/inlayHint/refresh",r.messageDirection=ho.MessageDirection.clientToServer,r.type=new ho.ProtocolRequestType0(r.method)})(KP=Br.InlayHintRefreshRequest||(Br.InlayHintRefreshRequest={}))});var Ag=C(Ot=>{"use strict";Object.defineProperty(Ot,"__esModule",{value:!0});Ot.DiagnosticRefreshRequest=Ot.WorkspaceDiagnosticRequest=Ot.DocumentDiagnosticRequest=Ot.DocumentDiagnosticReportKind=Ot.DiagnosticServerCancellationData=void 0;var _g=pn(),BP=Ls(),yo=it(),zP;(function(r){function e(t){let n=t;return n&&BP.boolean(n.retriggerRequest)}r.is=e})(zP=Ot.DiagnosticServerCancellationData||(Ot.DiagnosticServerCancellationData={}));var VP;(function(r){r.Full="full",r.Unchanged="unchanged"})(VP=Ot.DocumentDiagnosticReportKind||(Ot.DocumentDiagnosticReportKind={}));var YP;(function(r){r.method="textDocument/diagnostic",r.messageDirection=yo.MessageDirection.clientToServer,r.type=new yo.ProtocolRequestType(r.method),r.partialResult=new _g.ProgressType})(YP=Ot.DocumentDiagnosticRequest||(Ot.DocumentDiagnosticRequest={}));var XP;(function(r){r.method="workspace/diagnostic",r.messageDirection=yo.MessageDirection.clientToServer,r.type=new yo.ProtocolRequestType(r.method),r.partialResult=new _g.ProgressType})(XP=Ot.WorkspaceDiagnosticRequest||(Ot.WorkspaceDiagnosticRequest={}));var JP;(function(r){r.method="workspace/diagnostic/refresh",r.messageDirection=yo.MessageDirection.clientToServer,r.type=new yo.ProtocolRequestType0(r.method)})(JP=Ot.DiagnosticRefreshRequest||(Ot.DiagnosticRefreshRequest={}))});var Cg=C(Te=>{"use strict";Object.defineProperty(Te,"__esModule",{value:!0});Te.DidCloseNotebookDocumentNotification=Te.DidSaveNotebookDocumentNotification=Te.DidChangeNotebookDocumentNotification=Te.NotebookCellArrayChange=Te.DidOpenNotebookDocumentNotification=Te.NotebookDocumentSyncRegistrationType=Te.NotebookDocument=Te.NotebookCell=Te.ExecutionSummary=Te.NotebookCellKind=void 0;var Ra=lo(),zr=Ls(),mn=it(),bg;(function(r){r.Markup=1,r.Code=2;function e(t){return t===1||t===2}r.is=e})(bg=Te.NotebookCellKind||(Te.NotebookCellKind={}));var Eg;(function(r){function e(i,o){let a={executionOrder:i};return(o===!0||o===!1)&&(a.success=o),a}r.create=e;function t(i){let o=i;return zr.objectLiteral(o)&&Ra.uinteger.is(o.executionOrder)&&(o.success===void 0||zr.boolean(o.success))}r.is=t;function n(i,o){return i===o?!0:i==null||o===null||o===void 0?!1:i.executionOrder===o.executionOrder&&i.success===o.success}r.equals=n})(Eg=Te.ExecutionSummary||(Te.ExecutionSummary={}));var of;(function(r){function e(o,a){return{kind:o,document:a}}r.create=e;function t(o){let a=o;return zr.objectLiteral(a)&&bg.is(a.kind)&&Ra.DocumentUri.is(a.document)&&(a.metadata===void 0||zr.objectLiteral(a.metadata))}r.is=t;function n(o,a){let s=new Set;return o.document!==a.document&&s.add("document"),o.kind!==a.kind&&s.add("kind"),o.executionSummary!==a.executionSummary&&s.add("executionSummary"),(o.metadata!==void 0||a.metadata!==void 0)&&!i(o.metadata,a.metadata)&&s.add("metadata"),(o.executionSummary!==void 0||a.executionSummary!==void 0)&&!Eg.equals(o.executionSummary,a.executionSummary)&&s.add("executionSummary"),s}r.diff=n;function i(o,a){if(o===a)return!0;if(o==null||a===null||a===void 0||typeof o!=typeof a||typeof o!="object")return!1;let s=Array.isArray(o),u=Array.isArray(a);if(s!==u)return!1;if(s&&u){if(o.length!==a.length)return!1;for(let c=0;c<o.length;c++)if(!i(o[c],a[c]))return!1}if(zr.objectLiteral(o)&&zr.objectLiteral(a)){let c=Object.keys(o),l=Object.keys(a);if(c.length!==l.length||(c.sort(),l.sort(),!i(c,l)))return!1;for(let d=0;d<c.length;d++){let g=c[d];if(!i(o[g],a[g]))return!1}}return!0}})(of=Te.NotebookCell||(Te.NotebookCell={}));var ZP;(function(r){function e(n,i,o,a){return{uri:n,notebookType:i,version:o,cells:a}}r.create=e;function t(n){let i=n;return zr.objectLiteral(i)&&zr.string(i.uri)&&Ra.integer.is(i.version)&&zr.typedArray(i.cells,of.is)}r.is=t})(ZP=Te.NotebookDocument||(Te.NotebookDocument={}));var _a;(function(r){r.method="notebookDocument/sync",r.messageDirection=mn.MessageDirection.clientToServer,r.type=new mn.RegistrationType(r.method)})(_a=Te.NotebookDocumentSyncRegistrationType||(Te.NotebookDocumentSyncRegistrationType={}));var QP;(function(r){r.method="notebookDocument/didOpen",r.messageDirection=mn.MessageDirection.clientToServer,r.type=new mn.ProtocolNotificationType(r.method),r.registrationMethod=_a.method})(QP=Te.DidOpenNotebookDocumentNotification||(Te.DidOpenNotebookDocumentNotification={}));var ek;(function(r){function e(n){let i=n;return zr.objectLiteral(i)&&Ra.uinteger.is(i.start)&&Ra.uinteger.is(i.deleteCount)&&(i.cells===void 0||zr.typedArray(i.cells,of.is))}r.is=e;function t(n,i,o){let a={start:n,deleteCount:i};return o!==void 0&&(a.cells=o),a}r.create=t})(ek=Te.NotebookCellArrayChange||(Te.NotebookCellArrayChange={}));var tk;(function(r){r.method="notebookDocument/didChange",r.messageDirection=mn.MessageDirection.clientToServer,r.type=new mn.ProtocolNotificationType(r.method),r.registrationMethod=_a.method})(tk=Te.DidChangeNotebookDocumentNotification||(Te.DidChangeNotebookDocumentNotification={}));var rk;(function(r){r.method="notebookDocument/didSave",r.messageDirection=mn.MessageDirection.clientToServer,r.type=new mn.ProtocolNotificationType(r.method),r.registrationMethod=_a.method})(rk=Te.DidSaveNotebookDocumentNotification||(Te.DidSaveNotebookDocumentNotification={}));var nk;(function(r){r.method="notebookDocument/didClose",r.messageDirection=mn.MessageDirection.clientToServer,r.type=new mn.ProtocolNotificationType(r.method),r.registrationMethod=_a.method})(nk=Te.DidCloseNotebookDocumentNotification||(Te.DidCloseNotebookDocumentNotification={}))});var Og=C(h=>{"use strict";Object.defineProperty(h,"__esModule",{value:!0});h.WorkspaceSymbolRequest=h.CodeActionResolveRequest=h.CodeActionRequest=h.DocumentSymbolRequest=h.DocumentHighlightRequest=h.ReferencesRequest=h.DefinitionRequest=h.SignatureHelpRequest=h.SignatureHelpTriggerKind=h.HoverRequest=h.CompletionResolveRequest=h.CompletionRequest=h.CompletionTriggerKind=h.PublishDiagnosticsNotification=h.WatchKind=h.RelativePattern=h.FileChangeType=h.DidChangeWatchedFilesNotification=h.WillSaveTextDocumentWaitUntilRequest=h.WillSaveTextDocumentNotification=h.TextDocumentSaveReason=h.DidSaveTextDocumentNotification=h.DidCloseTextDocumentNotification=h.DidChangeTextDocumentNotification=h.TextDocumentContentChangeEvent=h.DidOpenTextDocumentNotification=h.TextDocumentSyncKind=h.TelemetryEventNotification=h.LogMessageNotification=h.ShowMessageRequest=h.ShowMessageNotification=h.MessageType=h.DidChangeConfigurationNotification=h.ExitNotification=h.ShutdownRequest=h.InitializedNotification=h.InitializeErrorCodes=h.InitializeRequest=h.WorkDoneProgressOptions=h.TextDocumentRegistrationOptions=h.StaticRegistrationOptions=h.PositionEncodingKind=h.FailureHandlingKind=h.ResourceOperationKind=h.UnregistrationRequest=h.RegistrationRequest=h.DocumentSelector=h.NotebookCellTextDocumentFilter=h.NotebookDocumentFilter=h.TextDocumentFilter=void 0;h.TypeHierarchySubtypesRequest=h.TypeHierarchyPrepareRequest=h.MonikerRequest=h.MonikerKind=h.UniquenessLevel=h.WillDeleteFilesRequest=h.DidDeleteFilesNotification=h.WillRenameFilesRequest=h.DidRenameFilesNotification=h.WillCreateFilesRequest=h.DidCreateFilesNotification=h.FileOperationPatternKind=h.LinkedEditingRangeRequest=h.ShowDocumentRequest=h.SemanticTokensRegistrationType=h.SemanticTokensRefreshRequest=h.SemanticTokensRangeRequest=h.SemanticTokensDeltaRequest=h.SemanticTokensRequest=h.TokenFormat=h.CallHierarchyPrepareRequest=h.CallHierarchyOutgoingCallsRequest=h.CallHierarchyIncomingCallsRequest=h.WorkDoneProgressCancelNotification=h.WorkDoneProgressCreateRequest=h.WorkDoneProgress=h.SelectionRangeRequest=h.DeclarationRequest=h.FoldingRangeRequest=h.ColorPresentationRequest=h.DocumentColorRequest=h.ConfigurationRequest=h.DidChangeWorkspaceFoldersNotification=h.WorkspaceFoldersRequest=h.TypeDefinitionRequest=h.ImplementationRequest=h.ApplyWorkspaceEditRequest=h.ExecuteCommandRequest=h.PrepareRenameRequest=h.RenameRequest=h.PrepareSupportDefaultBehavior=h.DocumentOnTypeFormattingRequest=h.DocumentRangeFormattingRequest=h.DocumentFormattingRequest=h.DocumentLinkResolveRequest=h.DocumentLinkRequest=h.CodeLensRefreshRequest=h.CodeLensResolveRequest=h.CodeLensRequest=h.WorkspaceSymbolResolveRequest=void 0;h.DidCloseNotebookDocumentNotification=h.DidSaveNotebookDocumentNotification=h.DidChangeNotebookDocumentNotification=h.NotebookCellArrayChange=h.DidOpenNotebookDocumentNotification=h.NotebookDocumentSyncRegistrationType=h.NotebookDocument=h.NotebookCell=h.ExecutionSummary=h.NotebookCellKind=h.DiagnosticRefreshRequest=h.WorkspaceDiagnosticRequest=h.DocumentDiagnosticRequest=h.DocumentDiagnosticReportKind=h.DiagnosticServerCancellationData=h.InlayHintRefreshRequest=h.InlayHintResolveRequest=h.InlayHintRequest=h.InlineValueRefreshRequest=h.InlineValueRequest=h.TypeHierarchySupertypesRequest=void 0;var q=it(),Pg=lo(),$t=Ls(),ik=Yy();Object.defineProperty(h,"ImplementationRequest",{enumerable:!0,get:function(){return ik.ImplementationRequest}});var ok=Jy();Object.defineProperty(h,"TypeDefinitionRequest",{enumerable:!0,get:function(){return ok.TypeDefinitionRequest}});var kg=Zy();Object.defineProperty(h,"WorkspaceFoldersRequest",{enumerable:!0,get:function(){return kg.WorkspaceFoldersRequest}});Object.defineProperty(h,"DidChangeWorkspaceFoldersNotification",{enumerable:!0,get:function(){return kg.DidChangeWorkspaceFoldersNotification}});var ak=eg();Object.defineProperty(h,"ConfigurationRequest",{enumerable:!0,get:function(){return ak.ConfigurationRequest}});var xg=tg();Object.defineProperty(h,"DocumentColorRequest",{enumerable:!0,get:function(){return xg.DocumentColorRequest}});Object.defineProperty(h,"ColorPresentationRequest",{enumerable:!0,get:function(){return xg.ColorPresentationRequest}});var sk=ng();Object.defineProperty(h,"FoldingRangeRequest",{enumerable:!0,get:function(){return sk.FoldingRangeRequest}});var uk=og();Object.defineProperty(h,"DeclarationRequest",{enumerable:!0,get:function(){return uk.DeclarationRequest}});var ck=sg();Object.defineProperty(h,"SelectionRangeRequest",{enumerable:!0,get:function(){return ck.SelectionRangeRequest}});var af=ug();Object.defineProperty(h,"WorkDoneProgress",{enumerable:!0,get:function(){return af.WorkDoneProgress}});Object.defineProperty(h,"WorkDoneProgressCreateRequest",{enumerable:!0,get:function(){return af.WorkDoneProgressCreateRequest}});Object.defineProperty(h,"WorkDoneProgressCancelNotification",{enumerable:!0,get:function(){return af.WorkDoneProgressCancelNotification}});var sf=cg();Object.defineProperty(h,"CallHierarchyIncomingCallsRequest",{enumerable:!0,get:function(){return sf.CallHierarchyIncomingCallsRequest}});Object.defineProperty(h,"CallHierarchyOutgoingCallsRequest",{enumerable:!0,get:function(){return sf.CallHierarchyOutgoingCallsRequest}});Object.defineProperty(h,"CallHierarchyPrepareRequest",{enumerable:!0,get:function(){return sf.CallHierarchyPrepareRequest}});var go=lg();Object.defineProperty(h,"TokenFormat",{enumerable:!0,get:function(){return go.TokenFormat}});Object.defineProperty(h,"SemanticTokensRequest",{enumerable:!0,get:function(){return go.SemanticTokensRequest}});Object.defineProperty(h,"SemanticTokensDeltaRequest",{enumerable:!0,get:function(){return go.SemanticTokensDeltaRequest}});Object.defineProperty(h,"SemanticTokensRangeRequest",{enumerable:!0,get:function(){return go.SemanticTokensRangeRequest}});Object.defineProperty(h,"SemanticTokensRefreshRequest",{enumerable:!0,get:function(){return go.SemanticTokensRefreshRequest}});Object.defineProperty(h,"SemanticTokensRegistrationType",{enumerable:!0,get:function(){return go.SemanticTokensRegistrationType}});var lk=fg();Object.defineProperty(h,"ShowDocumentRequest",{enumerable:!0,get:function(){return lk.ShowDocumentRequest}});var dk=mg();Object.defineProperty(h,"LinkedEditingRangeRequest",{enumerable:!0,get:function(){return dk.LinkedEditingRangeRequest}});var Ii=hg();Object.defineProperty(h,"FileOperationPatternKind",{enumerable:!0,get:function(){return Ii.FileOperationPatternKind}});Object.defineProperty(h,"DidCreateFilesNotification",{enumerable:!0,get:function(){return Ii.DidCreateFilesNotification}});Object.defineProperty(h,"WillCreateFilesRequest",{enumerable:!0,get:function(){return Ii.WillCreateFilesRequest}});Object.defineProperty(h,"DidRenameFilesNotification",{enumerable:!0,get:function(){return Ii.DidRenameFilesNotification}});Object.defineProperty(h,"WillRenameFilesRequest",{enumerable:!0,get:function(){return Ii.WillRenameFilesRequest}});Object.defineProperty(h,"DidDeleteFilesNotification",{enumerable:!0,get:function(){return Ii.DidDeleteFilesNotification}});Object.defineProperty(h,"WillDeleteFilesRequest",{enumerable:!0,get:function(){return Ii.WillDeleteFilesRequest}});var uf=gg();Object.defineProperty(h,"UniquenessLevel",{enumerable:!0,get:function(){return uf.UniquenessLevel}});Object.defineProperty(h,"MonikerKind",{enumerable:!0,get:function(){return uf.MonikerKind}});Object.defineProperty(h,"MonikerRequest",{enumerable:!0,get:function(){return uf.MonikerRequest}});var cf=vg();Object.defineProperty(h,"TypeHierarchyPrepareRequest",{enumerable:!0,get:function(){return cf.TypeHierarchyPrepareRequest}});Object.defineProperty(h,"TypeHierarchySubtypesRequest",{enumerable:!0,get:function(){return cf.TypeHierarchySubtypesRequest}});Object.defineProperty(h,"TypeHierarchySupertypesRequest",{enumerable:!0,get:function(){return cf.TypeHierarchySupertypesRequest}});var Sg=Tg();Object.defineProperty(h,"InlineValueRequest",{enumerable:!0,get:function(){return Sg.InlineValueRequest}});Object.defineProperty(h,"InlineValueRefreshRequest",{enumerable:!0,get:function(){return Sg.InlineValueRefreshRequest}});var lf=Rg();Object.defineProperty(h,"InlayHintRequest",{enumerable:!0,get:function(){return lf.InlayHintRequest}});Object.defineProperty(h,"InlayHintResolveRequest",{enumerable:!0,get:function(){return lf.InlayHintResolveRequest}});Object.defineProperty(h,"InlayHintRefreshRequest",{enumerable:!0,get:function(){return lf.InlayHintRefreshRequest}});var Aa=Ag();Object.defineProperty(h,"DiagnosticServerCancellationData",{enumerable:!0,get:function(){return Aa.DiagnosticServerCancellationData}});Object.defineProperty(h,"DocumentDiagnosticReportKind",{enumerable:!0,get:function(){return Aa.DocumentDiagnosticReportKind}});Object.defineProperty(h,"DocumentDiagnosticRequest",{enumerable:!0,get:function(){return Aa.DocumentDiagnosticRequest}});Object.defineProperty(h,"WorkspaceDiagnosticRequest",{enumerable:!0,get:function(){return Aa.WorkspaceDiagnosticRequest}});Object.defineProperty(h,"DiagnosticRefreshRequest",{enumerable:!0,get:function(){return Aa.DiagnosticRefreshRequest}});var hn=Cg();Object.defineProperty(h,"NotebookCellKind",{enumerable:!0,get:function(){return hn.NotebookCellKind}});Object.defineProperty(h,"ExecutionSummary",{enumerable:!0,get:function(){return hn.ExecutionSummary}});Object.defineProperty(h,"NotebookCell",{enumerable:!0,get:function(){return hn.NotebookCell}});Object.defineProperty(h,"NotebookDocument",{enumerable:!0,get:function(){return hn.NotebookDocument}});Object.defineProperty(h,"NotebookDocumentSyncRegistrationType",{enumerable:!0,get:function(){return hn.NotebookDocumentSyncRegistrationType}});Object.defineProperty(h,"DidOpenNotebookDocumentNotification",{enumerable:!0,get:function(){return hn.DidOpenNotebookDocumentNotification}});Object.defineProperty(h,"NotebookCellArrayChange",{enumerable:!0,get:function(){return hn.NotebookCellArrayChange}});Object.defineProperty(h,"DidChangeNotebookDocumentNotification",{enumerable:!0,get:function(){return hn.DidChangeNotebookDocumentNotification}});Object.defineProperty(h,"DidSaveNotebookDocumentNotification",{enumerable:!0,get:function(){return hn.DidSaveNotebookDocumentNotification}});Object.defineProperty(h,"DidCloseNotebookDocumentNotification",{enumerable:!0,get:function(){return hn.DidCloseNotebookDocumentNotification}});var Ng;(function(r){function e(t){let n=t;return $t.string(n.language)||$t.string(n.scheme)||$t.string(n.pattern)}r.is=e})(Ng=h.TextDocumentFilter||(h.TextDocumentFilter={}));var Dg;(function(r){function e(t){let n=t;return $t.objectLiteral(n)&&($t.string(n.notebookType)||$t.string(n.scheme)||$t.string(n.pattern))}r.is=e})(Dg=h.NotebookDocumentFilter||(h.NotebookDocumentFilter={}));var wg;(function(r){function e(t){let n=t;return $t.objectLiteral(n)&&($t.string(n.notebook)||Dg.is(n.notebook))&&(n.language===void 0||$t.string(n.language))}r.is=e})(wg=h.NotebookCellTextDocumentFilter||(h.NotebookCellTextDocumentFilter={}));var Ig;(function(r){function e(t){if(!Array.isArray(t))return!1;for(let n of t)if(!$t.string(n)&&!Ng.is(n)&&!wg.is(n))return!1;return!0}r.is=e})(Ig=h.DocumentSelector||(h.DocumentSelector={}));var fk;(function(r){r.method="client/registerCapability",r.messageDirection=q.MessageDirection.serverToClient,r.type=new q.ProtocolRequestType(r.method)})(fk=h.RegistrationRequest||(h.RegistrationRequest={}));var pk;(function(r){r.method="client/unregisterCapability",r.messageDirection=q.MessageDirection.serverToClient,r.type=new q.ProtocolRequestType(r.method)})(pk=h.UnregistrationRequest||(h.UnregistrationRequest={}));var mk;(function(r){r.Create="create",r.Rename="rename",r.Delete="delete"})(mk=h.ResourceOperationKind||(h.ResourceOperationKind={}));var hk;(function(r){r.Abort="abort",r.Transactional="transactional",r.TextOnlyTransactional="textOnlyTransactional",r.Undo="undo"})(hk=h.FailureHandlingKind||(h.FailureHandlingKind={}));var yk;(function(r){r.UTF8="utf-8",r.UTF16="utf-16",r.UTF32="utf-32"})(yk=h.PositionEncodingKind||(h.PositionEncodingKind={}));var gk;(function(r){function e(t){let n=t;return n&&$t.string(n.id)&&n.id.length>0}r.hasId=e})(gk=h.StaticRegistrationOptions||(h.StaticRegistrationOptions={}));var vk;(function(r){function e(t){let n=t;return n&&(n.documentSelector===null||Ig.is(n.documentSelector))}r.is=e})(vk=h.TextDocumentRegistrationOptions||(h.TextDocumentRegistrationOptions={}));var Tk;(function(r){function e(n){let i=n;return $t.objectLiteral(i)&&(i.workDoneProgress===void 0||$t.boolean(i.workDoneProgress))}r.is=e;function t(n){let i=n;return i&&$t.boolean(i.workDoneProgress)}r.hasWorkDoneProgress=t})(Tk=h.WorkDoneProgressOptions||(h.WorkDoneProgressOptions={}));var Rk;(function(r){r.method="initialize",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(Rk=h.InitializeRequest||(h.InitializeRequest={}));var _k;(function(r){r.unknownProtocolVersion=1})(_k=h.InitializeErrorCodes||(h.InitializeErrorCodes={}));var Ak;(function(r){r.method="initialized",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolNotificationType(r.method)})(Ak=h.InitializedNotification||(h.InitializedNotification={}));var bk;(function(r){r.method="shutdown",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType0(r.method)})(bk=h.ShutdownRequest||(h.ShutdownRequest={}));var Ek;(function(r){r.method="exit",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolNotificationType0(r.method)})(Ek=h.ExitNotification||(h.ExitNotification={}));var Ck;(function(r){r.method="workspace/didChangeConfiguration",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolNotificationType(r.method)})(Ck=h.DidChangeConfigurationNotification||(h.DidChangeConfigurationNotification={}));var Pk;(function(r){r.Error=1,r.Warning=2,r.Info=3,r.Log=4})(Pk=h.MessageType||(h.MessageType={}));var kk;(function(r){r.method="window/showMessage",r.messageDirection=q.MessageDirection.serverToClient,r.type=new q.ProtocolNotificationType(r.method)})(kk=h.ShowMessageNotification||(h.ShowMessageNotification={}));var xk;(function(r){r.method="window/showMessageRequest",r.messageDirection=q.MessageDirection.serverToClient,r.type=new q.ProtocolRequestType(r.method)})(xk=h.ShowMessageRequest||(h.ShowMessageRequest={}));var Sk;(function(r){r.method="window/logMessage",r.messageDirection=q.MessageDirection.serverToClient,r.type=new q.ProtocolNotificationType(r.method)})(Sk=h.LogMessageNotification||(h.LogMessageNotification={}));var Nk;(function(r){r.method="telemetry/event",r.messageDirection=q.MessageDirection.serverToClient,r.type=new q.ProtocolNotificationType(r.method)})(Nk=h.TelemetryEventNotification||(h.TelemetryEventNotification={}));var Dk;(function(r){r.None=0,r.Full=1,r.Incremental=2})(Dk=h.TextDocumentSyncKind||(h.TextDocumentSyncKind={}));var wk;(function(r){r.method="textDocument/didOpen",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolNotificationType(r.method)})(wk=h.DidOpenTextDocumentNotification||(h.DidOpenTextDocumentNotification={}));var Ik;(function(r){function e(n){let i=n;return i!=null&&typeof i.text=="string"&&i.range!==void 0&&(i.rangeLength===void 0||typeof i.rangeLength=="number")}r.isIncremental=e;function t(n){let i=n;return i!=null&&typeof i.text=="string"&&i.range===void 0&&i.rangeLength===void 0}r.isFull=t})(Ik=h.TextDocumentContentChangeEvent||(h.TextDocumentContentChangeEvent={}));var Ok;(function(r){r.method="textDocument/didChange",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolNotificationType(r.method)})(Ok=h.DidChangeTextDocumentNotification||(h.DidChangeTextDocumentNotification={}));var $k;(function(r){r.method="textDocument/didClose",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolNotificationType(r.method)})($k=h.DidCloseTextDocumentNotification||(h.DidCloseTextDocumentNotification={}));var Mk;(function(r){r.method="textDocument/didSave",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolNotificationType(r.method)})(Mk=h.DidSaveTextDocumentNotification||(h.DidSaveTextDocumentNotification={}));var Lk;(function(r){r.Manual=1,r.AfterDelay=2,r.FocusOut=3})(Lk=h.TextDocumentSaveReason||(h.TextDocumentSaveReason={}));var Fk;(function(r){r.method="textDocument/willSave",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolNotificationType(r.method)})(Fk=h.WillSaveTextDocumentNotification||(h.WillSaveTextDocumentNotification={}));var qk;(function(r){r.method="textDocument/willSaveWaitUntil",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(qk=h.WillSaveTextDocumentWaitUntilRequest||(h.WillSaveTextDocumentWaitUntilRequest={}));var jk;(function(r){r.method="workspace/didChangeWatchedFiles",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolNotificationType(r.method)})(jk=h.DidChangeWatchedFilesNotification||(h.DidChangeWatchedFilesNotification={}));var Gk;(function(r){r.Created=1,r.Changed=2,r.Deleted=3})(Gk=h.FileChangeType||(h.FileChangeType={}));var Uk;(function(r){function e(t){let n=t;return $t.objectLiteral(n)&&(Pg.URI.is(n.baseUri)||Pg.WorkspaceFolder.is(n.baseUri))&&$t.string(n.pattern)}r.is=e})(Uk=h.RelativePattern||(h.RelativePattern={}));var Hk;(function(r){r.Create=1,r.Change=2,r.Delete=4})(Hk=h.WatchKind||(h.WatchKind={}));var Wk;(function(r){r.method="textDocument/publishDiagnostics",r.messageDirection=q.MessageDirection.serverToClient,r.type=new q.ProtocolNotificationType(r.method)})(Wk=h.PublishDiagnosticsNotification||(h.PublishDiagnosticsNotification={}));var Kk;(function(r){r.Invoked=1,r.TriggerCharacter=2,r.TriggerForIncompleteCompletions=3})(Kk=h.CompletionTriggerKind||(h.CompletionTriggerKind={}));var Bk;(function(r){r.method="textDocument/completion",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(Bk=h.CompletionRequest||(h.CompletionRequest={}));var zk;(function(r){r.method="completionItem/resolve",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(zk=h.CompletionResolveRequest||(h.CompletionResolveRequest={}));var Vk;(function(r){r.method="textDocument/hover",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(Vk=h.HoverRequest||(h.HoverRequest={}));var Yk;(function(r){r.Invoked=1,r.TriggerCharacter=2,r.ContentChange=3})(Yk=h.SignatureHelpTriggerKind||(h.SignatureHelpTriggerKind={}));var Xk;(function(r){r.method="textDocument/signatureHelp",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(Xk=h.SignatureHelpRequest||(h.SignatureHelpRequest={}));var Jk;(function(r){r.method="textDocument/definition",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(Jk=h.DefinitionRequest||(h.DefinitionRequest={}));var Zk;(function(r){r.method="textDocument/references",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(Zk=h.ReferencesRequest||(h.ReferencesRequest={}));var Qk;(function(r){r.method="textDocument/documentHighlight",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(Qk=h.DocumentHighlightRequest||(h.DocumentHighlightRequest={}));var e0;(function(r){r.method="textDocument/documentSymbol",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(e0=h.DocumentSymbolRequest||(h.DocumentSymbolRequest={}));var t0;(function(r){r.method="textDocument/codeAction",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(t0=h.CodeActionRequest||(h.CodeActionRequest={}));var r0;(function(r){r.method="codeAction/resolve",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(r0=h.CodeActionResolveRequest||(h.CodeActionResolveRequest={}));var n0;(function(r){r.method="workspace/symbol",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(n0=h.WorkspaceSymbolRequest||(h.WorkspaceSymbolRequest={}));var i0;(function(r){r.method="workspaceSymbol/resolve",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(i0=h.WorkspaceSymbolResolveRequest||(h.WorkspaceSymbolResolveRequest={}));var o0;(function(r){r.method="textDocument/codeLens",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(o0=h.CodeLensRequest||(h.CodeLensRequest={}));var a0;(function(r){r.method="codeLens/resolve",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(a0=h.CodeLensResolveRequest||(h.CodeLensResolveRequest={}));var s0;(function(r){r.method="workspace/codeLens/refresh",r.messageDirection=q.MessageDirection.serverToClient,r.type=new q.ProtocolRequestType0(r.method)})(s0=h.CodeLensRefreshRequest||(h.CodeLensRefreshRequest={}));var u0;(function(r){r.method="textDocument/documentLink",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(u0=h.DocumentLinkRequest||(h.DocumentLinkRequest={}));var c0;(function(r){r.method="documentLink/resolve",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(c0=h.DocumentLinkResolveRequest||(h.DocumentLinkResolveRequest={}));var l0;(function(r){r.method="textDocument/formatting",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(l0=h.DocumentFormattingRequest||(h.DocumentFormattingRequest={}));var d0;(function(r){r.method="textDocument/rangeFormatting",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(d0=h.DocumentRangeFormattingRequest||(h.DocumentRangeFormattingRequest={}));var f0;(function(r){r.method="textDocument/onTypeFormatting",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(f0=h.DocumentOnTypeFormattingRequest||(h.DocumentOnTypeFormattingRequest={}));var p0;(function(r){r.Identifier=1})(p0=h.PrepareSupportDefaultBehavior||(h.PrepareSupportDefaultBehavior={}));var m0;(function(r){r.method="textDocument/rename",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(m0=h.RenameRequest||(h.RenameRequest={}));var h0;(function(r){r.method="textDocument/prepareRename",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(h0=h.PrepareRenameRequest||(h.PrepareRenameRequest={}));var y0;(function(r){r.method="workspace/executeCommand",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(y0=h.ExecuteCommandRequest||(h.ExecuteCommandRequest={}));var g0;(function(r){r.method="workspace/applyEdit",r.messageDirection=q.MessageDirection.serverToClient,r.type=new q.ProtocolRequestType("workspace/applyEdit")})(g0=h.ApplyWorkspaceEditRequest||(h.ApplyWorkspaceEditRequest={}))});var Mg=C(Hs=>{"use strict";Object.defineProperty(Hs,"__esModule",{value:!0});Hs.createProtocolConnection=void 0;var $g=pn();function v0(r,e,t,n){return $g.ConnectionStrategy.is(n)&&(n={connectionStrategy:n}),(0,$g.createMessageConnection)(r,e,t,n)}Hs.createProtocolConnection=v0});var Lg=C(rr=>{"use strict";var T0=rr&&rr.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),Ws=rr&&rr.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&T0(e,r,t)};Object.defineProperty(rr,"__esModule",{value:!0});rr.LSPErrorCodes=rr.createProtocolConnection=void 0;Ws(pn(),rr);Ws(lo(),rr);Ws(it(),rr);Ws(Og(),rr);var R0=Mg();Object.defineProperty(rr,"createProtocolConnection",{enumerable:!0,get:function(){return R0.createProtocolConnection}});var _0;(function(r){r.lspReservedErrorRangeStart=-32899,r.RequestFailed=-32803,r.ServerCancelled=-32802,r.ContentModified=-32801,r.RequestCancelled=-32800,r.lspReservedErrorRangeEnd=-32800})(_0=rr.LSPErrorCodes||(rr.LSPErrorCodes={}))});var Tt=C(yn=>{"use strict";var A0=yn&&yn.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),Fg=yn&&yn.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&A0(e,r,t)};Object.defineProperty(yn,"__esModule",{value:!0});yn.createProtocolConnection=void 0;var b0=Zd();Fg(Zd(),yn);Fg(Lg(),yn);function E0(r,e,t,n){return(0,b0.createMessageConnection)(r,e,t,n)}yn.createProtocolConnection=E0});var df=C(Er=>{"use strict";Object.defineProperty(Er,"__esModule",{value:!0});Er.generateUuid=Er.parse=Er.isUUID=Er.v4=Er.empty=void 0;var ba=class{constructor(e){this._value=e}asHex(){return this._value}equals(e){return this.asHex()===e.asHex()}},ne=class extends ba{constructor(){super([ne._randomHex(),ne._randomHex(),ne._randomHex(),ne._randomHex(),ne._randomHex(),ne._randomHex(),ne._randomHex(),ne._randomHex(),"-",ne._randomHex(),ne._randomHex(),ne._randomHex(),ne._randomHex(),"-","4",ne._randomHex(),ne._randomHex(),ne._randomHex(),"-",ne._oneOf(ne._timeHighBits),ne._randomHex(),ne._randomHex(),ne._randomHex(),"-",ne._randomHex(),ne._randomHex(),ne._randomHex(),ne._randomHex(),ne._randomHex(),ne._randomHex(),ne._randomHex(),ne._randomHex(),ne._randomHex(),ne._randomHex(),ne._randomHex(),ne._randomHex()].join(""))}static _oneOf(e){return e[Math.floor(e.length*Math.random())]}static _randomHex(){return ne._oneOf(ne._chars)}};ne._chars=["0","1","2","3","4","5","6","6","7","8","9","a","b","c","d","e","f"];ne._timeHighBits=["8","9","a","b"];Er.empty=new ba("00000000-0000-0000-0000-000000000000");function qg(){return new ne}Er.v4=qg;var C0=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function jg(r){return C0.test(r)}Er.isUUID=jg;function P0(r){if(!jg(r))throw new Error("invalid uuid");return new ba(r)}Er.parse=P0;function k0(){return qg().asHex()}Er.generateUuid=k0});var Gg=C(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:!0});ui.attachPartialResult=ui.ProgressFeature=ui.attachWorkDone=void 0;var si=Tt(),x0=df(),gn=class{constructor(e,t){this._connection=e,this._token=t,gn.Instances.set(this._token,this)}begin(e,t,n,i){let o={kind:"begin",title:e,percentage:t,message:n,cancellable:i};this._connection.sendProgress(si.WorkDoneProgress.type,this._token,o)}report(e,t){let n={kind:"report"};typeof e=="number"?(n.percentage=e,t!==void 0&&(n.message=t)):n.message=e,this._connection.sendProgress(si.WorkDoneProgress.type,this._token,n)}done(){gn.Instances.delete(this._token),this._connection.sendProgress(si.WorkDoneProgress.type,this._token,{kind:"end"})}};gn.Instances=new Map;var Ks=class extends gn{constructor(e,t){super(e,t),this._source=new si.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose(),super.done()}cancel(){this._source.cancel()}},Ea=class{constructor(){}begin(){}report(){}done(){}},Bs=class extends Ea{constructor(){super(),this._source=new si.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose()}cancel(){this._source.cancel()}};function S0(r,e){if(e===void 0||e.workDoneToken===void 0)return new Ea;let t=e.workDoneToken;return delete e.workDoneToken,new gn(r,t)}ui.attachWorkDone=S0;var N0=r=>class extends r{constructor(){super(),this._progressSupported=!1}initialize(e){super.initialize(e),e?.window?.workDoneProgress===!0&&(this._progressSupported=!0,this.connection.onNotification(si.WorkDoneProgressCancelNotification.type,t=>{let n=gn.Instances.get(t.token);(n instanceof Ks||n instanceof Bs)&&n.cancel()}))}attachWorkDoneProgress(e){return e===void 0?new Ea:new gn(this.connection,e)}createWorkDoneProgress(){if(this._progressSupported){let e=(0,x0.generateUuid)();return this.connection.sendRequest(si.WorkDoneProgressCreateRequest.type,{token:e}).then(()=>new Ks(this.connection,e))}else return Promise.resolve(new Bs)}};ui.ProgressFeature=N0;var ff;(function(r){r.type=new si.ProgressType})(ff||(ff={}));var pf=class{constructor(e,t){this._connection=e,this._token=t}report(e){this._connection.sendProgress(ff.type,this._token,e)}};function D0(r,e){if(e===void 0||e.partialResultToken===void 0)return;let t=e.partialResultToken;return delete e.partialResultToken,new pf(r,t)}ui.attachPartialResult=D0});var Ug=C(zs=>{"use strict";Object.defineProperty(zs,"__esModule",{value:!0});zs.ConfigurationFeature=void 0;var w0=Tt(),I0=Cs(),O0=r=>class extends r{getConfiguration(e){return e?I0.string(e)?this._getConfiguration({section:e}):this._getConfiguration(e):this._getConfiguration({})}_getConfiguration(e){let t={items:Array.isArray(e)?e:[e]};return this.connection.sendRequest(w0.ConfigurationRequest.type,t).then(n=>Array.isArray(n)?Array.isArray(e)?n:n[0]:Array.isArray(e)?[]:null)}};zs.ConfigurationFeature=O0});var Hg=C(Ys=>{"use strict";Object.defineProperty(Ys,"__esModule",{value:!0});Ys.WorkspaceFoldersFeature=void 0;var Vs=Tt(),$0=r=>class extends r{constructor(){super(),this._notificationIsAutoRegistered=!1}initialize(e){super.initialize(e);let t=e.workspace;t&&t.workspaceFolders&&(this._onDidChangeWorkspaceFolders=new Vs.Emitter,this.connection.onNotification(Vs.DidChangeWorkspaceFoldersNotification.type,n=>{this._onDidChangeWorkspaceFolders.fire(n.event)}))}fillServerCapabilities(e){super.fillServerCapabilities(e);let t=e.workspace?.workspaceFolders?.changeNotifications;this._notificationIsAutoRegistered=t===!0||typeof t=="string"}getWorkspaceFolders(){return this.connection.sendRequest(Vs.WorkspaceFoldersRequest.type)}get onDidChangeWorkspaceFolders(){if(!this._onDidChangeWorkspaceFolders)throw new Error("Client doesn't support sending workspace folder change events.");return!this._notificationIsAutoRegistered&&!this._unregistration&&(this._unregistration=this.connection.client.register(Vs.DidChangeWorkspaceFoldersNotification.type)),this._onDidChangeWorkspaceFolders.event}};Ys.WorkspaceFoldersFeature=$0});var Wg=C(Xs=>{"use strict";Object.defineProperty(Xs,"__esModule",{value:!0});Xs.CallHierarchyFeature=void 0;var mf=Tt(),M0=r=>class extends r{get callHierarchy(){return{onPrepare:e=>this.connection.onRequest(mf.CallHierarchyPrepareRequest.type,(t,n)=>e(t,n,this.attachWorkDoneProgress(t),void 0)),onIncomingCalls:e=>{let t=mf.CallHierarchyIncomingCallsRequest.type;return this.connection.onRequest(t,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(t,n)))},onOutgoingCalls:e=>{let t=mf.CallHierarchyOutgoingCallsRequest.type;return this.connection.onRequest(t,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(t,n)))}}}};Xs.CallHierarchyFeature=M0});var yf=C(ci=>{"use strict";Object.defineProperty(ci,"__esModule",{value:!0});ci.SemanticTokensBuilder=ci.SemanticTokensDiff=ci.SemanticTokensFeature=void 0;var Js=Tt(),L0=r=>class extends r{get semanticTokens(){return{refresh:()=>this.connection.sendRequest(Js.SemanticTokensRefreshRequest.type),on:e=>{let t=Js.SemanticTokensRequest.type;return this.connection.onRequest(t,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(t,n)))},onDelta:e=>{let t=Js.SemanticTokensDeltaRequest.type;return this.connection.onRequest(t,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(t,n)))},onRange:e=>{let t=Js.SemanticTokensRangeRequest.type;return this.connection.onRequest(t,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(t,n)))}}}};ci.SemanticTokensFeature=L0;var Zs=class{constructor(e,t){this.originalSequence=e,this.modifiedSequence=t}computeDiff(){let e=this.originalSequence.length,t=this.modifiedSequence.length,n=0;for(;n<t&&n<e&&this.originalSequence[n]===this.modifiedSequence[n];)n++;if(n<t&&n<e){let i=e-1,o=t-1;for(;i>=n&&o>=n&&this.originalSequence[i]===this.modifiedSequence[o];)i--,o--;(i<n||o<n)&&(i++,o++);let a=i-n+1,s=this.modifiedSequence.slice(n,o+1);return s.length===1&&s[0]===this.originalSequence[i]?[{start:n,deleteCount:a-1}]:[{start:n,deleteCount:a,data:s}]}else return n<t?[{start:n,deleteCount:0,data:this.modifiedSequence.slice(n)}]:n<e?[{start:n,deleteCount:e-n}]:[]}};ci.SemanticTokensDiff=Zs;var hf=class{constructor(){this._prevData=void 0,this.initialize()}initialize(){this._id=Date.now(),this._prevLine=0,this._prevChar=0,this._data=[],this._dataLen=0}push(e,t,n,i,o){let a=e,s=t;this._dataLen>0&&(a-=this._prevLine,a===0&&(s-=this._prevChar)),this._data[this._dataLen++]=a,this._data[this._dataLen++]=s,this._data[this._dataLen++]=n,this._data[this._dataLen++]=i,this._data[this._dataLen++]=o,this._prevLine=e,this._prevChar=t}get id(){return this._id.toString()}previousResult(e){this.id===e&&(this._prevData=this._data),this.initialize()}build(){return this._prevData=void 0,{resultId:this.id,data:this._data}}canBuildEdits(){return this._prevData!==void 0}buildEdits(){return this._prevData!==void 0?{resultId:this.id,edits:new Zs(this._prevData,this._data).computeDiff()}:this.build()}};ci.SemanticTokensBuilder=hf});var Kg=C(Qs=>{"use strict";Object.defineProperty(Qs,"__esModule",{value:!0});Qs.ShowDocumentFeature=void 0;var F0=Tt(),q0=r=>class extends r{showDocument(e){return this.connection.sendRequest(F0.ShowDocumentRequest.type,e)}};Qs.ShowDocumentFeature=q0});var Bg=C(eu=>{"use strict";Object.defineProperty(eu,"__esModule",{value:!0});eu.FileOperationsFeature=void 0;var vo=Tt(),j0=r=>class extends r{onDidCreateFiles(e){return this.connection.onNotification(vo.DidCreateFilesNotification.type,t=>{e(t)})}onDidRenameFiles(e){return this.connection.onNotification(vo.DidRenameFilesNotification.type,t=>{e(t)})}onDidDeleteFiles(e){return this.connection.onNotification(vo.DidDeleteFilesNotification.type,t=>{e(t)})}onWillCreateFiles(e){return this.connection.onRequest(vo.WillCreateFilesRequest.type,(t,n)=>e(t,n))}onWillRenameFiles(e){return this.connection.onRequest(vo.WillRenameFilesRequest.type,(t,n)=>e(t,n))}onWillDeleteFiles(e){return this.connection.onRequest(vo.WillDeleteFilesRequest.type,(t,n)=>e(t,n))}};eu.FileOperationsFeature=j0});var zg=C(tu=>{"use strict";Object.defineProperty(tu,"__esModule",{value:!0});tu.LinkedEditingRangeFeature=void 0;var G0=Tt(),U0=r=>class extends r{onLinkedEditingRange(e){return this.connection.onRequest(G0.LinkedEditingRangeRequest.type,(t,n)=>e(t,n,this.attachWorkDoneProgress(t),void 0))}};tu.LinkedEditingRangeFeature=U0});var Vg=C(ru=>{"use strict";Object.defineProperty(ru,"__esModule",{value:!0});ru.TypeHierarchyFeature=void 0;var gf=Tt(),H0=r=>class extends r{get typeHierarchy(){return{onPrepare:e=>this.connection.onRequest(gf.TypeHierarchyPrepareRequest.type,(t,n)=>e(t,n,this.attachWorkDoneProgress(t),void 0)),onSupertypes:e=>{let t=gf.TypeHierarchySupertypesRequest.type;return this.connection.onRequest(t,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(t,n)))},onSubtypes:e=>{let t=gf.TypeHierarchySubtypesRequest.type;return this.connection.onRequest(t,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(t,n)))}}}};ru.TypeHierarchyFeature=H0});var Xg=C(nu=>{"use strict";Object.defineProperty(nu,"__esModule",{value:!0});nu.InlineValueFeature=void 0;var Yg=Tt(),W0=r=>class extends r{get inlineValue(){return{refresh:()=>this.connection.sendRequest(Yg.InlineValueRefreshRequest.type),on:e=>this.connection.onRequest(Yg.InlineValueRequest.type,(t,n)=>e(t,n,this.attachWorkDoneProgress(t)))}}};nu.InlineValueFeature=W0});var Jg=C(iu=>{"use strict";Object.defineProperty(iu,"__esModule",{value:!0});iu.InlayHintFeature=void 0;var vf=Tt(),K0=r=>class extends r{get inlayHint(){return{refresh:()=>this.connection.sendRequest(vf.InlayHintRefreshRequest.type),on:e=>this.connection.onRequest(vf.InlayHintRequest.type,(t,n)=>e(t,n,this.attachWorkDoneProgress(t))),resolve:e=>this.connection.onRequest(vf.InlayHintResolveRequest.type,(t,n)=>e(t,n))}}};iu.InlayHintFeature=K0});var Zg=C(ou=>{"use strict";Object.defineProperty(ou,"__esModule",{value:!0});ou.DiagnosticFeature=void 0;var Ca=Tt(),B0=r=>class extends r{get diagnostics(){return{refresh:()=>this.connection.sendRequest(Ca.DiagnosticRefreshRequest.type),on:e=>this.connection.onRequest(Ca.DocumentDiagnosticRequest.type,(t,n)=>e(t,n,this.attachWorkDoneProgress(t),this.attachPartialResultProgress(Ca.DocumentDiagnosticRequest.partialResult,t))),onWorkspace:e=>this.connection.onRequest(Ca.WorkspaceDiagnosticRequest.type,(t,n)=>e(t,n,this.attachWorkDoneProgress(t),this.attachPartialResultProgress(Ca.WorkspaceDiagnosticRequest.partialResult,t)))}}};ou.DiagnosticFeature=B0});var Rf=C(au=>{"use strict";Object.defineProperty(au,"__esModule",{value:!0});au.TextDocuments=void 0;var Oi=Tt(),Tf=class{constructor(e){this._configuration=e,this._syncedDocuments=new Map,this._onDidChangeContent=new Oi.Emitter,this._onDidOpen=new Oi.Emitter,this._onDidClose=new Oi.Emitter,this._onDidSave=new Oi.Emitter,this._onWillSave=new Oi.Emitter}get onDidOpen(){return this._onDidOpen.event}get onDidChangeContent(){return this._onDidChangeContent.event}get onWillSave(){return this._onWillSave.event}onWillSaveWaitUntil(e){this._willSaveWaitUntil=e}get onDidSave(){return this._onDidSave.event}get onDidClose(){return this._onDidClose.event}get(e){return this._syncedDocuments.get(e)}all(){return Array.from(this._syncedDocuments.values())}keys(){return Array.from(this._syncedDocuments.keys())}listen(e){e.__textDocumentSync=Oi.TextDocumentSyncKind.Incremental;let t=[];return t.push(e.onDidOpenTextDocument(n=>{let i=n.textDocument,o=this._configuration.create(i.uri,i.languageId,i.version,i.text);this._syncedDocuments.set(i.uri,o);let a=Object.freeze({document:o});this._onDidOpen.fire(a),this._onDidChangeContent.fire(a)})),t.push(e.onDidChangeTextDocument(n=>{let i=n.textDocument,o=n.contentChanges;if(o.length===0)return;let{version:a}=i;if(a==null)throw new Error(`Received document change event for ${i.uri} without valid version identifier`);let s=this._syncedDocuments.get(i.uri);s!==void 0&&(s=this._configuration.update(s,o,a),this._syncedDocuments.set(i.uri,s),this._onDidChangeContent.fire(Object.freeze({document:s})))})),t.push(e.onDidCloseTextDocument(n=>{let i=this._syncedDocuments.get(n.textDocument.uri);i!==void 0&&(this._syncedDocuments.delete(n.textDocument.uri),this._onDidClose.fire(Object.freeze({document:i})))})),t.push(e.onWillSaveTextDocument(n=>{let i=this._syncedDocuments.get(n.textDocument.uri);i!==void 0&&this._onWillSave.fire(Object.freeze({document:i,reason:n.reason}))})),t.push(e.onWillSaveTextDocumentWaitUntil((n,i)=>{let o=this._syncedDocuments.get(n.textDocument.uri);return o!==void 0&&this._willSaveWaitUntil?this._willSaveWaitUntil(Object.freeze({document:o,reason:n.reason}),i):[]})),t.push(e.onDidSaveTextDocument(n=>{let i=this._syncedDocuments.get(n.textDocument.uri);i!==void 0&&this._onDidSave.fire(Object.freeze({document:i}))})),Oi.Disposable.create(()=>{t.forEach(n=>n.dispose())})}};au.TextDocuments=Tf});var Af=C(To=>{"use strict";Object.defineProperty(To,"__esModule",{value:!0});To.NotebookDocuments=To.NotebookSyncFeature=void 0;var Cr=Tt(),Qg=Rf(),z0=r=>class extends r{get synchronization(){return{onDidOpenNotebookDocument:e=>this.connection.onNotification(Cr.DidOpenNotebookDocumentNotification.type,t=>{e(t)}),onDidChangeNotebookDocument:e=>this.connection.onNotification(Cr.DidChangeNotebookDocumentNotification.type,t=>{e(t)}),onDidSaveNotebookDocument:e=>this.connection.onNotification(Cr.DidSaveNotebookDocumentNotification.type,t=>{e(t)}),onDidCloseNotebookDocument:e=>this.connection.onNotification(Cr.DidCloseNotebookDocumentNotification.type,t=>{e(t)})}}};To.NotebookSyncFeature=z0;var li=class{onDidOpenTextDocument(e){return this.openHandler=e,Cr.Disposable.create(()=>{this.openHandler=void 0})}openTextDocument(e){this.openHandler&&this.openHandler(e)}onDidChangeTextDocument(e){return this.changeHandler=e,Cr.Disposable.create(()=>{this.changeHandler=e})}changeTextDocument(e){this.changeHandler&&this.changeHandler(e)}onDidCloseTextDocument(e){return this.closeHandler=e,Cr.Disposable.create(()=>{this.closeHandler=void 0})}closeTextDocument(e){this.closeHandler&&this.closeHandler(e)}onWillSaveTextDocument(){return li.NULL_DISPOSE}onWillSaveTextDocumentWaitUntil(){return li.NULL_DISPOSE}onDidSaveTextDocument(){return li.NULL_DISPOSE}};li.NULL_DISPOSE=Object.freeze({dispose:()=>{}});var _f=class{constructor(e){e instanceof Qg.TextDocuments?this._cellTextDocuments=e:this._cellTextDocuments=new Qg.TextDocuments(e),this.notebookDocuments=new Map,this.notebookCellMap=new Map,this._onDidOpen=new Cr.Emitter,this._onDidChange=new Cr.Emitter,this._onDidSave=new Cr.Emitter,this._onDidClose=new Cr.Emitter}get cellTextDocuments(){return this._cellTextDocuments}getCellTextDocument(e){return this._cellTextDocuments.get(e.document)}getNotebookDocument(e){return this.notebookDocuments.get(e)}getNotebookCell(e){let t=this.notebookCellMap.get(e);return t&&t[0]}findNotebookDocumentForCell(e){let t=typeof e=="string"?e:e.document,n=this.notebookCellMap.get(t);return n&&n[1]}get onDidOpen(){return this._onDidOpen.event}get onDidSave(){return this._onDidSave.event}get onDidChange(){return this._onDidChange.event}get onDidClose(){return this._onDidClose.event}listen(e){let t=new li,n=[];return n.push(this.cellTextDocuments.listen(t)),n.push(e.notebooks.synchronization.onDidOpenNotebookDocument(i=>{this.notebookDocuments.set(i.notebookDocument.uri,i.notebookDocument);for(let o of i.cellTextDocuments)t.openTextDocument({textDocument:o});this.updateCellMap(i.notebookDocument),this._onDidOpen.fire(i.notebookDocument)})),n.push(e.notebooks.synchronization.onDidChangeNotebookDocument(i=>{let o=this.notebookDocuments.get(i.notebookDocument.uri);if(o===void 0)return;o.version=i.notebookDocument.version;let a=o.metadata,s=!1,u=i.change;u.metadata!==void 0&&(s=!0,o.metadata=u.metadata);let c=[],l=[],d=[],g=[];if(u.cells!==void 0){let k=u.cells;if(k.structure!==void 0){let _=k.structure.array;if(o.cells.splice(_.start,_.deleteCount,..._.cells!==void 0?_.cells:[]),k.structure.didOpen!==void 0)for(let R of k.structure.didOpen)t.openTextDocument({textDocument:R}),c.push(R.uri);if(k.structure.didClose)for(let R of k.structure.didClose)t.closeTextDocument({textDocument:R}),l.push(R.uri)}if(k.data!==void 0){let _=new Map(k.data.map(R=>[R.document,R]));for(let R=0;R<=o.cells.length;R++){let D=_.get(o.cells[R].document);if(D!==void 0){let B=o.cells.splice(R,1,D);if(d.push({old:B[0],new:D}),_.delete(D.document),_.size===0)break}}}if(k.textContent!==void 0)for(let _ of k.textContent)t.changeTextDocument({textDocument:_.document,contentChanges:_.changes}),g.push(_.document.uri)}this.updateCellMap(o);let y={notebookDocument:o};s&&(y.metadata={old:a,new:o.metadata});let p=[];for(let k of c)p.push(this.getNotebookCell(k));let A=[];for(let k of l)A.push(this.getNotebookCell(k));let x=[];for(let k of g)x.push(this.getNotebookCell(k));(p.length>0||A.length>0||d.length>0||x.length>0)&&(y.cells={added:p,removed:A,changed:{data:d,textContent:x}}),(y.metadata!==void 0||y.cells!==void 0)&&this._onDidChange.fire(y)})),n.push(e.notebooks.synchronization.onDidSaveNotebookDocument(i=>{let o=this.notebookDocuments.get(i.notebookDocument.uri);o!==void 0&&this._onDidSave.fire(o)})),n.push(e.notebooks.synchronization.onDidCloseNotebookDocument(i=>{let o=this.notebookDocuments.get(i.notebookDocument.uri);if(o!==void 0){this._onDidClose.fire(o);for(let a of i.cellTextDocuments)t.closeTextDocument({textDocument:a});this.notebookDocuments.delete(i.notebookDocument.uri);for(let a of o.cells)this.notebookCellMap.delete(a.document)}})),Cr.Disposable.create(()=>{n.forEach(i=>i.dispose())})}updateCellMap(e){for(let t of e.cells)this.notebookCellMap.set(t.document,[t,e])}};To.NotebookDocuments=_f});var ev=C(su=>{"use strict";Object.defineProperty(su,"__esModule",{value:!0});su.MonikerFeature=void 0;var V0=Tt(),Y0=r=>class extends r{get moniker(){return{on:e=>{let t=V0.MonikerRequest.type;return this.connection.onRequest(t,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(t,n)))}}}};su.MonikerFeature=Y0});var xf=C(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.createConnection=me.combineFeatures=me.combineNotebooksFeatures=me.combineLanguagesFeatures=me.combineWorkspaceFeatures=me.combineWindowFeatures=me.combineClientFeatures=me.combineTracerFeatures=me.combineTelemetryFeatures=me.combineConsoleFeatures=me._NotebooksImpl=me._LanguagesImpl=me.BulkUnregistration=me.BulkRegistration=me.ErrorMessageTracker=void 0;var U=Tt(),Pr=Cs(),Ef=df(),te=Gg(),X0=Ug(),J0=Hg(),Z0=Wg(),Q0=yf(),ex=Kg(),tx=Bg(),rx=zg(),nx=Vg(),ix=Xg(),ox=Jg(),ax=Zg(),sx=Af(),ux=ev();function bf(r){if(r!==null)return r}var Cf=class{constructor(){this._messages=Object.create(null)}add(e){let t=this._messages[e];t||(t=0),t++,this._messages[e]=t}sendErrors(e){Object.keys(this._messages).forEach(t=>{e.window.showErrorMessage(t)})}};me.ErrorMessageTracker=Cf;var uu=class{constructor(){}rawAttach(e){this._rawConnection=e}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}fillServerCapabilities(e){}initialize(e){}error(e){this.send(U.MessageType.Error,e)}warn(e){this.send(U.MessageType.Warning,e)}info(e){this.send(U.MessageType.Info,e)}log(e){this.send(U.MessageType.Log,e)}send(e,t){this._rawConnection&&this._rawConnection.sendNotification(U.LogMessageNotification.type,{type:e,message:t}).catch(()=>{(0,U.RAL)().console.error("Sending log message failed")})}},Pf=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}showErrorMessage(e,...t){let n={type:U.MessageType.Error,message:e,actions:t};return this.connection.sendRequest(U.ShowMessageRequest.type,n).then(bf)}showWarningMessage(e,...t){let n={type:U.MessageType.Warning,message:e,actions:t};return this.connection.sendRequest(U.ShowMessageRequest.type,n).then(bf)}showInformationMessage(e,...t){let n={type:U.MessageType.Info,message:e,actions:t};return this.connection.sendRequest(U.ShowMessageRequest.type,n).then(bf)}},tv=(0,ex.ShowDocumentFeature)((0,te.ProgressFeature)(Pf)),cx;(function(r){function e(){return new cu}r.create=e})(cx=me.BulkRegistration||(me.BulkRegistration={}));var cu=class{constructor(){this._registrations=[],this._registered=new Set}add(e,t){let n=Pr.string(e)?e:e.method;if(this._registered.has(n))throw new Error(`${n} is already added to this registration`);let i=Ef.generateUuid();this._registrations.push({id:i,method:n,registerOptions:t||{}}),this._registered.add(n)}asRegistrationParams(){return{registrations:this._registrations}}},lx;(function(r){function e(){return new Pa(void 0,[])}r.create=e})(lx=me.BulkUnregistration||(me.BulkUnregistration={}));var Pa=class{constructor(e,t){this._connection=e,this._unregistrations=new Map,t.forEach(n=>{this._unregistrations.set(n.method,n)})}get isAttached(){return!!this._connection}attach(e){this._connection=e}add(e){this._unregistrations.set(e.method,e)}dispose(){let e=[];for(let n of this._unregistrations.values())e.push(n);let t={unregisterations:e};this._connection.sendRequest(U.UnregistrationRequest.type,t).catch(()=>{this._connection.console.info("Bulk unregistration failed.")})}disposeSingle(e){let t=Pr.string(e)?e:e.method,n=this._unregistrations.get(t);if(!n)return!1;let i={unregisterations:[n]};return this._connection.sendRequest(U.UnregistrationRequest.type,i).then(()=>{this._unregistrations.delete(t)},o=>{this._connection.console.info(`Un-registering request handler for ${n.id} failed.`)}),!0}},lu=class{attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}register(e,t,n){return e instanceof cu?this.registerMany(e):e instanceof Pa?this.registerSingle1(e,t,n):this.registerSingle2(e,t)}registerSingle1(e,t,n){let i=Pr.string(t)?t:t.method,o=Ef.generateUuid(),a={registrations:[{id:o,method:i,registerOptions:n||{}}]};return e.isAttached||e.attach(this.connection),this.connection.sendRequest(U.RegistrationRequest.type,a).then(s=>(e.add({id:o,method:i}),e),s=>(this.connection.console.info(`Registering request handler for ${i} failed.`),Promise.reject(s)))}registerSingle2(e,t){let n=Pr.string(e)?e:e.method,i=Ef.generateUuid(),o={registrations:[{id:i,method:n,registerOptions:t||{}}]};return this.connection.sendRequest(U.RegistrationRequest.type,o).then(a=>U.Disposable.create(()=>{this.unregisterSingle(i,n).catch(()=>{this.connection.console.info(`Un-registering capability with id ${i} failed.`)})}),a=>(this.connection.console.info(`Registering request handler for ${n} failed.`),Promise.reject(a)))}unregisterSingle(e,t){let n={unregisterations:[{id:e,method:t}]};return this.connection.sendRequest(U.UnregistrationRequest.type,n).catch(()=>{this.connection.console.info(`Un-registering request handler for ${e} failed.`)})}registerMany(e){let t=e.asRegistrationParams();return this.connection.sendRequest(U.RegistrationRequest.type,t).then(()=>new Pa(this._connection,t.registrations.map(n=>({id:n.id,method:n.method}))),n=>(this.connection.console.info("Bulk registration failed."),Promise.reject(n)))}},kf=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}applyEdit(e){function t(i){return i&&!!i.edit}let n=t(e)?e:{edit:e};return this.connection.sendRequest(U.ApplyWorkspaceEditRequest.type,n)}},rv=(0,tx.FileOperationsFeature)((0,J0.WorkspaceFoldersFeature)((0,X0.ConfigurationFeature)(kf))),du=class{constructor(){this._trace=U.Trace.Off}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}set trace(e){this._trace=e}log(e,t){this._trace!==U.Trace.Off&&this.connection.sendNotification(U.LogTraceNotification.type,{message:e,verbose:this._trace===U.Trace.Verbose?t:void 0}).catch(()=>{})}},fu=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}logEvent(e){this.connection.sendNotification(U.TelemetryEventNotification.type,e).catch(()=>{this.connection.console.log("Sending TelemetryEventNotification failed")})}},pu=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}attachWorkDoneProgress(e){return(0,te.attachWorkDone)(this.connection,e)}attachPartialResultProgress(e,t){return(0,te.attachPartialResult)(this.connection,t)}};me._LanguagesImpl=pu;var nv=(0,ux.MonikerFeature)((0,ax.DiagnosticFeature)((0,ox.InlayHintFeature)((0,ix.InlineValueFeature)((0,nx.TypeHierarchyFeature)((0,rx.LinkedEditingRangeFeature)((0,Q0.SemanticTokensFeature)((0,Z0.CallHierarchyFeature)(pu)))))))),mu=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}attachWorkDoneProgress(e){return(0,te.attachWorkDone)(this.connection,e)}attachPartialResultProgress(e,t){return(0,te.attachPartialResult)(this.connection,t)}};me._NotebooksImpl=mu;var iv=(0,sx.NotebookSyncFeature)(mu);function ov(r,e){return function(t){return e(r(t))}}me.combineConsoleFeatures=ov;function av(r,e){return function(t){return e(r(t))}}me.combineTelemetryFeatures=av;function sv(r,e){return function(t){return e(r(t))}}me.combineTracerFeatures=sv;function uv(r,e){return function(t){return e(r(t))}}me.combineClientFeatures=uv;function cv(r,e){return function(t){return e(r(t))}}me.combineWindowFeatures=cv;function lv(r,e){return function(t){return e(r(t))}}me.combineWorkspaceFeatures=lv;function dv(r,e){return function(t){return e(r(t))}}me.combineLanguagesFeatures=dv;function fv(r,e){return function(t){return e(r(t))}}me.combineNotebooksFeatures=fv;function dx(r,e){function t(i,o,a){return i&&o?a(i,o):i||o}return{__brand:"features",console:t(r.console,e.console,ov),tracer:t(r.tracer,e.tracer,sv),telemetry:t(r.telemetry,e.telemetry,av),client:t(r.client,e.client,uv),window:t(r.window,e.window,cv),workspace:t(r.workspace,e.workspace,lv),languages:t(r.languages,e.languages,dv),notebooks:t(r.notebooks,e.notebooks,fv)}}me.combineFeatures=dx;function fx(r,e,t){let n=t&&t.console?new(t.console(uu)):new uu,i=r(n);n.rawAttach(i);let o=t&&t.tracer?new(t.tracer(du)):new du,a=t&&t.telemetry?new(t.telemetry(fu)):new fu,s=t&&t.client?new(t.client(lu)):new lu,u=t&&t.window?new(t.window(tv)):new tv,c=t&&t.workspace?new(t.workspace(rv)):new rv,l=t&&t.languages?new(t.languages(nv)):new nv,d=t&&t.notebooks?new(t.notebooks(iv)):new iv,g=[n,o,a,s,u,c,l,d];function y(_){return _ instanceof Promise?_:Pr.thenable(_)?new Promise((R,D)=>{_.then(B=>R(B),B=>D(B))}):Promise.resolve(_)}let p,A,x,k={listen:()=>i.listen(),sendRequest:(_,...R)=>i.sendRequest(Pr.string(_)?_:_.method,...R),onRequest:(_,R)=>i.onRequest(_,R),sendNotification:(_,R)=>{let D=Pr.string(_)?_:_.method;return arguments.length===1?i.sendNotification(D):i.sendNotification(D,R)},onNotification:(_,R)=>i.onNotification(_,R),onProgress:i.onProgress,sendProgress:i.sendProgress,onInitialize:_=>(A=_,{dispose:()=>{A=void 0}}),onInitialized:_=>i.onNotification(U.InitializedNotification.type,_),onShutdown:_=>(p=_,{dispose:()=>{p=void 0}}),onExit:_=>(x=_,{dispose:()=>{x=void 0}}),get console(){return n},get telemetry(){return a},get tracer(){return o},get client(){return s},get window(){return u},get workspace(){return c},get languages(){return l},get notebooks(){return d},onDidChangeConfiguration:_=>i.onNotification(U.DidChangeConfigurationNotification.type,_),onDidChangeWatchedFiles:_=>i.onNotification(U.DidChangeWatchedFilesNotification.type,_),__textDocumentSync:void 0,onDidOpenTextDocument:_=>i.onNotification(U.DidOpenTextDocumentNotification.type,_),onDidChangeTextDocument:_=>i.onNotification(U.DidChangeTextDocumentNotification.type,_),onDidCloseTextDocument:_=>i.onNotification(U.DidCloseTextDocumentNotification.type,_),onWillSaveTextDocument:_=>i.onNotification(U.WillSaveTextDocumentNotification.type,_),onWillSaveTextDocumentWaitUntil:_=>i.onRequest(U.WillSaveTextDocumentWaitUntilRequest.type,_),onDidSaveTextDocument:_=>i.onNotification(U.DidSaveTextDocumentNotification.type,_),sendDiagnostics:_=>i.sendNotification(U.PublishDiagnosticsNotification.type,_),onHover:_=>i.onRequest(U.HoverRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),void 0)),onCompletion:_=>i.onRequest(U.CompletionRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),(0,te.attachPartialResult)(i,R))),onCompletionResolve:_=>i.onRequest(U.CompletionResolveRequest.type,_),onSignatureHelp:_=>i.onRequest(U.SignatureHelpRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),void 0)),onDeclaration:_=>i.onRequest(U.DeclarationRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),(0,te.attachPartialResult)(i,R))),onDefinition:_=>i.onRequest(U.DefinitionRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),(0,te.attachPartialResult)(i,R))),onTypeDefinition:_=>i.onRequest(U.TypeDefinitionRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),(0,te.attachPartialResult)(i,R))),onImplementation:_=>i.onRequest(U.ImplementationRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),(0,te.attachPartialResult)(i,R))),onReferences:_=>i.onRequest(U.ReferencesRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),(0,te.attachPartialResult)(i,R))),onDocumentHighlight:_=>i.onRequest(U.DocumentHighlightRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),(0,te.attachPartialResult)(i,R))),onDocumentSymbol:_=>i.onRequest(U.DocumentSymbolRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),(0,te.attachPartialResult)(i,R))),onWorkspaceSymbol:_=>i.onRequest(U.WorkspaceSymbolRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),(0,te.attachPartialResult)(i,R))),onWorkspaceSymbolResolve:_=>i.onRequest(U.WorkspaceSymbolResolveRequest.type,_),onCodeAction:_=>i.onRequest(U.CodeActionRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),(0,te.attachPartialResult)(i,R))),onCodeActionResolve:_=>i.onRequest(U.CodeActionResolveRequest.type,(R,D)=>_(R,D)),onCodeLens:_=>i.onRequest(U.CodeLensRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),(0,te.attachPartialResult)(i,R))),onCodeLensResolve:_=>i.onRequest(U.CodeLensResolveRequest.type,(R,D)=>_(R,D)),onDocumentFormatting:_=>i.onRequest(U.DocumentFormattingRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),void 0)),onDocumentRangeFormatting:_=>i.onRequest(U.DocumentRangeFormattingRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),void 0)),onDocumentOnTypeFormatting:_=>i.onRequest(U.DocumentOnTypeFormattingRequest.type,(R,D)=>_(R,D)),onRenameRequest:_=>i.onRequest(U.RenameRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),void 0)),onPrepareRename:_=>i.onRequest(U.PrepareRenameRequest.type,(R,D)=>_(R,D)),onDocumentLinks:_=>i.onRequest(U.DocumentLinkRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),(0,te.attachPartialResult)(i,R))),onDocumentLinkResolve:_=>i.onRequest(U.DocumentLinkResolveRequest.type,(R,D)=>_(R,D)),onDocumentColor:_=>i.onRequest(U.DocumentColorRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),(0,te.attachPartialResult)(i,R))),onColorPresentation:_=>i.onRequest(U.ColorPresentationRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),(0,te.attachPartialResult)(i,R))),onFoldingRanges:_=>i.onRequest(U.FoldingRangeRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),(0,te.attachPartialResult)(i,R))),onSelectionRanges:_=>i.onRequest(U.SelectionRangeRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),(0,te.attachPartialResult)(i,R))),onExecuteCommand:_=>i.onRequest(U.ExecuteCommandRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),void 0)),dispose:()=>i.dispose()};for(let _ of g)_.attach(k);return i.onRequest(U.InitializeRequest.type,_=>{e.initialize(_),Pr.string(_.trace)&&(o.trace=U.Trace.fromString(_.trace));for(let R of g)R.initialize(_.capabilities);if(A){let R=A(_,new U.CancellationTokenSource().token,(0,te.attachWorkDone)(i,_),void 0);return y(R).then(D=>{if(D instanceof U.ResponseError)return D;let B=D;B||(B={capabilities:{}});let V=B.capabilities;V||(V={},B.capabilities=V),V.textDocumentSync===void 0||V.textDocumentSync===null?V.textDocumentSync=Pr.number(k.__textDocumentSync)?k.__textDocumentSync:U.TextDocumentSyncKind.None:!Pr.number(V.textDocumentSync)&&!Pr.number(V.textDocumentSync.change)&&(V.textDocumentSync.change=Pr.number(k.__textDocumentSync)?k.__textDocumentSync:U.TextDocumentSyncKind.None);for(let G of g)G.fillServerCapabilities(V);return B})}else{let R={capabilities:{textDocumentSync:U.TextDocumentSyncKind.None}};for(let D of g)D.fillServerCapabilities(R.capabilities);return R}}),i.onRequest(U.ShutdownRequest.type,()=>{if(e.shutdownReceived=!0,p)return p(new U.CancellationTokenSource().token)}),i.onNotification(U.ExitNotification.type,()=>{try{x&&x()}finally{e.shutdownReceived?e.exit(0):e.exit(1)}}),i.onNotification(U.SetTraceNotification.type,_=>{o.trace=U.Trace.fromString(_.value)}),k}me.createConnection=fx});var mv=C(nr=>{"use strict";Object.defineProperty(nr,"__esModule",{value:!0});nr.resolveModulePath=nr.FileSystem=nr.resolveGlobalYarnPath=nr.resolveGlobalNodePath=nr.resolve=nr.uriToFilePath=void 0;var px=require("url"),Vr=require("path"),Sf=require("fs"),wf=require("child_process");function mx(r){let e=px.parse(r);if(e.protocol!=="file:"||!e.path)return;let t=e.path.split("/");for(var n=0,i=t.length;n<i;n++)t[n]=decodeURIComponent(t[n]);if(process.platform==="win32"&&t.length>1){let o=t[0],a=t[1];o.length===0&&a.length>1&&a[1]===":"&&t.shift()}return Vr.normalize(t.join("/"))}nr.uriToFilePath=mx;function Nf(){return process.platform==="win32"}function hu(r,e,t,n){let i="NODE_PATH",o=["var p = process;","p.on('message',function(m){","if(m.c==='e'){","p.exit(0);","}","else if(m.c==='rs'){","try{","var r=require.resolve(m.a);","p.send({c:'r',s:true,r:r});","}","catch(err){","p.send({c:'r',s:false});","}","}","});"].join("");return new Promise((a,s)=>{let u=process.env,c=Object.create(null);Object.keys(u).forEach(l=>c[l]=u[l]),e&&Sf.existsSync(e)&&(c[i]?c[i]=e+Vr.delimiter+c[i]:c[i]=e,n&&n(`NODE_PATH value is: ${c[i]}`)),c.ELECTRON_RUN_AS_NODE="1";try{let l=(0,wf.fork)("",[],{cwd:t,env:c,execArgv:["-e",o]});if(l.pid===void 0){s(new Error(`Starting process to resolve node module ${r} failed`));return}l.on("error",g=>{s(g)}),l.on("message",g=>{g.c==="r"&&(l.send({c:"e"}),g.s?a(g.r):s(new Error(`Failed to resolve module: ${r}`)))});let d={c:"rs",a:r};l.send(d)}catch(l){s(l)}})}nr.resolve=hu;function Df(r){let e="npm",t=Object.create(null);Object.keys(process.env).forEach(o=>t[o]=process.env[o]),t.NO_UPDATE_NOTIFIER="true";let n={encoding:"utf8",env:t};Nf()&&(e="npm.cmd",n.shell=!0);let i=()=>{};try{process.on("SIGPIPE",i);let o=(0,wf.spawnSync)(e,["config","get","prefix"],n).stdout;if(!o){r&&r("'npm config get prefix' didn't return a value.");return}let a=o.trim();return r&&r(`'npm config get prefix' value is: ${a}`),a.length>0?Nf()?Vr.join(a,"node_modules"):Vr.join(a,"lib","node_modules"):void 0}catch{return}finally{process.removeListener("SIGPIPE",i)}}nr.resolveGlobalNodePath=Df;function hx(r){let e="yarn",t={encoding:"utf8"};Nf()&&(e="yarn.cmd",t.shell=!0);let n=()=>{};try{process.on("SIGPIPE",n);let i=(0,wf.spawnSync)(e,["global","dir","--json"],t),o=i.stdout;if(!o){r&&(r("'yarn global dir' didn't return a value."),i.stderr&&r(i.stderr));return}let a=o.trim().split(/\r?\n/);for(let s of a)try{let u=JSON.parse(s);if(u.type==="log")return Vr.join(u.data,"node_modules")}catch{}return}catch{return}finally{process.removeListener("SIGPIPE",n)}}nr.resolveGlobalYarnPath=hx;var pv;(function(r){let e;function t(){return e!==void 0||(process.platform==="win32"?e=!1:e=!Sf.existsSync(__filename.toUpperCase())||!Sf.existsSync(__filename.toLowerCase())),e}r.isCaseSensitive=t;function n(i,o){return t()?Vr.normalize(o).indexOf(Vr.normalize(i))===0:Vr.normalize(o).toLowerCase().indexOf(Vr.normalize(i).toLowerCase())===0}r.isParent=n})(pv=nr.FileSystem||(nr.FileSystem={}));function yx(r,e,t,n){return t?(Vr.isAbsolute(t)||(t=Vr.join(r,t)),hu(e,t,t,n).then(i=>pv.isParent(t,i)?i:Promise.reject(new Error(`Failed to load ${e} from node path location.`))).then(void 0,i=>hu(e,Df(n),r,n))):hu(e,Df(n),r,n)}nr.resolveModulePath=yx});var If=C((O1,hv)=>{"use strict";hv.exports=Tt()});var gv=C(Mt=>{"use strict";var gx=Mt&&Mt.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),yv=Mt&&Mt.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&gx(e,r,t)};Object.defineProperty(Mt,"__esModule",{value:!0});Mt.ProposedFeatures=Mt.NotebookDocuments=Mt.TextDocuments=Mt.SemanticTokensBuilder=void 0;var vx=yf();Object.defineProperty(Mt,"SemanticTokensBuilder",{enumerable:!0,get:function(){return vx.SemanticTokensBuilder}});yv(Tt(),Mt);var Tx=Rf();Object.defineProperty(Mt,"TextDocuments",{enumerable:!0,get:function(){return Tx.TextDocuments}});var Rx=Af();Object.defineProperty(Mt,"NotebookDocuments",{enumerable:!0,get:function(){return Rx.NotebookDocuments}});yv(xf(),Mt);var _x;(function(r){r.all={__brand:"features"}})(_x=Mt.ProposedFeatures||(Mt.ProposedFeatures={}))});var Ne=C(gr=>{"use strict";var Ax=gr&&gr.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),Tv=gr&&gr.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Ax(e,r,t)};Object.defineProperty(gr,"__esModule",{value:!0});gr.createConnection=gr.Files=void 0;var Of=Cs(),bx=xf(),ka=mv(),$i=If();Tv(If(),gr);Tv(gv(),gr);var Ex;(function(r){r.uriToFilePath=ka.uriToFilePath,r.resolveGlobalNodePath=ka.resolveGlobalNodePath,r.resolveGlobalYarnPath=ka.resolveGlobalYarnPath,r.resolve=ka.resolve,r.resolveModulePath=ka.resolveModulePath})(Ex=gr.Files||(gr.Files={}));var vv;function yu(){if(vv!==void 0)try{vv.end()}catch{}}var Ro=!1,Rv;function Cx(){let r="--clientProcessId";function e(t){try{let n=parseInt(t);isNaN(n)||(Rv=setInterval(()=>{try{process.kill(n,0)}catch{yu(),process.exit(Ro?0:1)}},3e3))}catch{}}for(let t=2;t<process.argv.length;t++){let n=process.argv[t];if(n===r&&t+1<process.argv.length){e(process.argv[t+1]);return}else{let i=n.split("=");i[0]===r&&e(i[1])}}}Cx();var Px={initialize:r=>{let e=r.processId;Of.number(e)&&Rv===void 0&&setInterval(()=>{try{process.kill(e,0)}catch{process.exit(Ro?0:1)}},3e3)},get shutdownReceived(){return Ro},set shutdownReceived(r){Ro=r},exit:r=>{yu(),process.exit(r)}};function kx(r,e,t,n){let i,o,a,s;return r!==void 0&&r.__brand==="features"&&(i=r,r=e,e=t,t=n),$i.ConnectionStrategy.is(r)||$i.ConnectionOptions.is(r)?s=r:(o=r,a=e,s=t),xx(o,a,s,i)}gr.createConnection=kx;function xx(r,e,t,n){if(!r&&!e&&process.argv.length>2){let s,u,c=process.argv.slice(2);for(let l=0;l<c.length;l++){let d=c[l];if(d==="--node-ipc"){r=new $i.IPCMessageReader(process),e=new $i.IPCMessageWriter(process);break}else if(d==="--stdio"){r=process.stdin,e=process.stdout;break}else if(d==="--socket"){s=parseInt(c[l+1]);break}else if(d==="--pipe"){u=c[l+1];break}else{var i=d.split("=");if(i[0]==="--socket"){s=parseInt(i[1]);break}else if(i[0]==="--pipe"){u=i[1];break}}}if(s){let l=(0,$i.createServerSocketTransport)(s);r=l[0],e=l[1]}else if(u){let l=(0,$i.createServerPipeTransport)(u);r=l[0],e=l[1]}}var o="Use arguments of createConnection or set command line parameters: '--node-ipc', '--stdio' or '--socket={number}'";if(!r)throw new Error("Connection input stream is not set. "+o);if(!e)throw new Error("Connection output stream is not set. "+o);if(Of.func(r.read)&&Of.func(r.on)){let s=r;s.on("end",()=>{yu(),process.exit(Ro?0:1)}),s.on("close",()=>{yu(),process.exit(Ro?0:1)})}let a=s=>(0,$i.createProtocolConnection)(r,e,s,t);return(0,bx.createConnection)(a,Px,n)}});var vu=C((_v,gu)=>{(function(r){if(typeof gu=="object"&&typeof gu.exports=="object"){var e=r(require,_v);e!==void 0&&(gu.exports=e)}else typeof define=="function"&&define.amd&&define(["require","exports"],r)})(function(r,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TextDocument=void 0;class t{constructor(c,l,d,g){this._uri=c,this._languageId=l,this._version=d,this._content=g,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(c){if(c){let l=this.offsetAt(c.start),d=this.offsetAt(c.end);return this._content.substring(l,d)}return this._content}update(c,l){for(let d of c)if(t.isIncremental(d)){let g=a(d.range),y=this.offsetAt(g.start),p=this.offsetAt(g.end);this._content=this._content.substring(0,y)+d.text+this._content.substring(p,this._content.length);let A=Math.max(g.start.line,0),x=Math.max(g.end.line,0),k=this._lineOffsets,_=o(d.text,!1,y);if(x-A===_.length)for(let D=0,B=_.length;D<B;D++)k[D+A+1]=_[D];else _.length<1e4?k.splice(A+1,x-A,..._):this._lineOffsets=k=k.slice(0,A+1).concat(_,k.slice(x+1));let R=d.text.length-(p-y);if(R!==0)for(let D=A+1+_.length,B=k.length;D<B;D++)k[D]=k[D]+R}else if(t.isFull(d))this._content=d.text,this._lineOffsets=void 0;else throw new Error("Unknown change event received");this._version=l}getLineOffsets(){return this._lineOffsets===void 0&&(this._lineOffsets=o(this._content,!0)),this._lineOffsets}positionAt(c){c=Math.max(Math.min(c,this._content.length),0);let l=this.getLineOffsets(),d=0,g=l.length;if(g===0)return{line:0,character:c};for(;d<g;){let p=Math.floor((d+g)/2);l[p]>c?g=p:d=p+1}let y=d-1;return{line:y,character:c-l[y]}}offsetAt(c){let l=this.getLineOffsets();if(c.line>=l.length)return this._content.length;if(c.line<0)return 0;let d=l[c.line],g=c.line+1<l.length?l[c.line+1]:this._content.length;return Math.max(Math.min(d+c.character,g),d)}get lineCount(){return this.getLineOffsets().length}static isIncremental(c){let l=c;return l!=null&&typeof l.text=="string"&&l.range!==void 0&&(l.rangeLength===void 0||typeof l.rangeLength=="number")}static isFull(c){let l=c;return l!=null&&typeof l.text=="string"&&l.range===void 0&&l.rangeLength===void 0}}var n;(function(u){function c(g,y,p,A){return new t(g,y,p,A)}u.create=c;function l(g,y,p){if(g instanceof t)return g.update(y,p),g;throw new Error("TextDocument.update: document must be created by TextDocument.create")}u.update=l;function d(g,y){let p=g.getText(),A=i(y.map(s),(_,R)=>{let D=_.range.start.line-R.range.start.line;return D===0?_.range.start.character-R.range.start.character:D}),x=0,k=[];for(let _ of A){let R=g.offsetAt(_.range.start);if(R<x)throw new Error("Overlapping edit");R>x&&k.push(p.substring(x,R)),_.newText.length&&k.push(_.newText),x=g.offsetAt(_.range.end)}return k.push(p.substr(x)),k.join("")}u.applyEdits=d})(n=e.TextDocument||(e.TextDocument={}));function i(u,c){if(u.length<=1)return u;let l=u.length/2|0,d=u.slice(0,l),g=u.slice(l);i(d,c),i(g,c);let y=0,p=0,A=0;for(;y<d.length&&p<g.length;)c(d[y],g[p])<=0?u[A++]=d[y++]:u[A++]=g[p++];for(;y<d.length;)u[A++]=d[y++];for(;p<g.length;)u[A++]=g[p++];return u}function o(u,c,l=0){let d=c?[l]:[];for(let g=0;g<u.length;g++){let y=u.charCodeAt(g);(y===13||y===10)&&(y===13&&g+1<u.length&&u.charCodeAt(g+1)===10&&g++,d.push(l+g+1))}return d}function a(u){let c=u.start,l=u.end;return c.line>l.line||c.line===l.line&&c.character>l.character?{start:l,end:c}:u}function s(u){let c=a(u.range);return c!==u.range?{newText:u.newText,range:c}:u}})});var _o=C(di=>{"use strict";Object.defineProperty(di,"__esModule",{value:!0});di.isRootCstNode=di.isLeafCstNode=di.isCompositeCstNode=void 0;function Av(r){return typeof r=="object"&&!!r&&"children"in r}di.isCompositeCstNode=Av;function Sx(r){return typeof r=="object"&&!!r&&"tokenType"in r}di.isLeafCstNode=Sx;function Nx(r){return Av(r)&&"fullText"in r}di.isRootCstNode=Nx});var Ct=C(Be=>{"use strict";Object.defineProperty(Be,"__esModule",{value:!0});Be.Reduction=Be.TreeStreamImpl=Be.stream=Be.DONE_RESULT=Be.EMPTY_STREAM=Be.StreamImpl=void 0;var Lt=class{constructor(e,t){this.startFn=e,this.nextFn=t}iterator(){let e={state:this.startFn(),next:()=>this.nextFn(e.state),[Symbol.iterator]:()=>e};return e}[Symbol.iterator](){return this.iterator()}isEmpty(){return!!this.iterator().next().done}count(){let e=this.iterator(),t=0,n=e.next();for(;!n.done;)t++,n=e.next();return t}toArray(){let e=[],t=this.iterator(),n;do n=t.next(),n.value!==void 0&&e.push(n.value);while(!n.done);return e}toSet(){return new Set(this)}toMap(e,t){let n=this.map(i=>[e?e(i):i,t?t(i):i]);return new Map(n)}toString(){return this.join()}concat(e){let t=e[Symbol.iterator]();return new Lt(()=>({first:this.startFn(),firstDone:!1}),n=>{let i;if(!n.firstDone){do if(i=this.nextFn(n.first),!i.done)return i;while(!i.done);n.firstDone=!0}do if(i=t.next(),!i.done)return i;while(!i.done);return Be.DONE_RESULT})}join(e=","){let t=this.iterator(),n="",i,o=!1;do i=t.next(),i.done||(o&&(n+=e),n+=Dx(i.value)),o=!0;while(!i.done);return n}indexOf(e,t=0){let n=this.iterator(),i=0,o=n.next();for(;!o.done;){if(i>=t&&o.value===e)return i;o=n.next(),i++}return-1}every(e){let t=this.iterator(),n=t.next();for(;!n.done;){if(!e(n.value))return!1;n=t.next()}return!0}some(e){let t=this.iterator(),n=t.next();for(;!n.done;){if(e(n.value))return!0;n=t.next()}return!1}forEach(e){let t=this.iterator(),n=0,i=t.next();for(;!i.done;)e(i.value,n),i=t.next(),n++}map(e){return new Lt(this.startFn,t=>{let{done:n,value:i}=this.nextFn(t);return n?Be.DONE_RESULT:{done:!1,value:e(i)}})}filter(e){return new Lt(this.startFn,t=>{let n;do if(n=this.nextFn(t),!n.done&&e(n.value))return n;while(!n.done);return Be.DONE_RESULT})}nonNullable(){return this.filter(e=>e!=null)}reduce(e,t){let n=this.iterator(),i=t,o=n.next();for(;!o.done;)i===void 0?i=o.value:i=e(i,o.value),o=n.next();return i}reduceRight(e,t){return this.recursiveReduce(this.iterator(),e,t)}recursiveReduce(e,t,n){let i=e.next();if(i.done)return n;let o=this.recursiveReduce(e,t,n);return o===void 0?i.value:t(o,i.value)}find(e){let t=this.iterator(),n=t.next();for(;!n.done;){if(e(n.value))return n.value;n=t.next()}}findIndex(e){let t=this.iterator(),n=0,i=t.next();for(;!i.done;){if(e(i.value))return n;i=t.next(),n++}return-1}includes(e){let t=this.iterator(),n=t.next();for(;!n.done;){if(n.value===e)return!0;n=t.next()}return!1}flatMap(e){return new Lt(()=>({this:this.startFn()}),t=>{do{if(t.iterator){let o=t.iterator.next();if(o.done)t.iterator=void 0;else return o}let{done:n,value:i}=this.nextFn(t.this);if(!n){let o=e(i);if(Tu(o))t.iterator=o[Symbol.iterator]();else return{done:!1,value:o}}}while(t.iterator);return Be.DONE_RESULT})}flat(e){if(e===void 0&&(e=1),e<=0)return this;let t=e>1?this.flat(e-1):this;return new Lt(()=>({this:t.startFn()}),n=>{do{if(n.iterator){let a=n.iterator.next();if(a.done)n.iterator=void 0;else return a}let{done:i,value:o}=t.nextFn(n.this);if(!i)if(Tu(o))n.iterator=o[Symbol.iterator]();else return{done:!1,value:o}}while(n.iterator);return Be.DONE_RESULT})}head(){let t=this.iterator().next();if(!t.done)return t.value}tail(e=1){return new Lt(()=>{let t=this.startFn();for(let n=0;n<e;n++)if(this.nextFn(t).done)return t;return t},this.nextFn)}limit(e){return new Lt(()=>({size:0,state:this.startFn()}),t=>(t.size++,t.size>e?Be.DONE_RESULT:this.nextFn(t.state)))}distinct(e){let t=new Set;return this.filter(n=>{let i=e?e(n):n;return t.has(i)?!1:(t.add(i),!0)})}exclude(e,t){let n=new Set;for(let i of e){let o=t?t(i):i;n.add(o)}return this.filter(i=>{let o=t?t(i):i;return!n.has(o)})}};Be.StreamImpl=Lt;function Dx(r){return typeof r=="string"?r:typeof r>"u"?"undefined":typeof r.toString=="function"?r.toString():Object.prototype.toString.call(r)}function Tu(r){return!!r&&typeof r[Symbol.iterator]=="function"}Be.EMPTY_STREAM=new Lt(()=>{},()=>Be.DONE_RESULT);Be.DONE_RESULT=Object.freeze({done:!0,value:void 0});function wx(...r){if(r.length===1){let e=r[0];if(e instanceof Lt)return e;if(Tu(e))return new Lt(()=>e[Symbol.iterator](),t=>t.next());if(typeof e.length=="number")return new Lt(()=>({index:0}),t=>t.index<e.length?{done:!1,value:e[t.index++]}:Be.DONE_RESULT)}return r.length>1?new Lt(()=>({collIndex:0,arrIndex:0}),e=>{do{if(e.iterator){let t=e.iterator.next();if(!t.done)return t;e.iterator=void 0}if(e.array){if(e.arrIndex<e.array.length)return{done:!1,value:e.array[e.arrIndex++]};e.array=void 0,e.arrIndex=0}if(e.collIndex<r.length){let t=r[e.collIndex++];Tu(t)?e.iterator=t[Symbol.iterator]():t&&typeof t.length=="number"&&(e.array=t)}}while(e.iterator||e.array||e.collIndex<r.length);return Be.DONE_RESULT}):Be.EMPTY_STREAM}Be.stream=wx;var $f=class extends Lt{constructor(e,t,n){super(()=>({iterators:n?.includeRoot?[[e][Symbol.iterator]()]:[t(e)[Symbol.iterator]()],pruned:!1}),i=>{for(i.pruned&&(i.iterators.pop(),i.pruned=!1);i.iterators.length>0;){let a=i.iterators[i.iterators.length-1].next();if(a.done)i.iterators.pop();else return i.iterators.push(t(a.value)[Symbol.iterator]()),a}return Be.DONE_RESULT})}iterator(){let e={state:this.startFn(),next:()=>this.nextFn(e.state),prune:()=>{e.state.pruned=!0},[Symbol.iterator]:()=>e};return e}};Be.TreeStreamImpl=$f;var Ix;(function(r){function e(o){return o.reduce((a,s)=>a+s,0)}r.sum=e;function t(o){return o.reduce((a,s)=>a*s,0)}r.product=t;function n(o){return o.reduce((a,s)=>Math.min(a,s))}r.min=n;function i(o){return o.reduce((a,s)=>Math.max(a,s))}r.max=i})(Ix=Be.Reduction||(Be.Reduction={}))});var et=C(De=>{"use strict";Object.defineProperty(De,"__esModule",{value:!0});De.getInteriorNodes=De.getStartlineNode=De.getNextNode=De.getPreviousNode=De.findLeafNodeAtOffset=De.isCommentNode=De.findCommentNode=De.findDeclarationNodeAtOffset=De.DefaultNameRegexp=De.toDocumentSegment=De.tokenToRange=De.flattenCst=De.streamCst=void 0;var Ao=_o(),Ox=Ct();function Ev(r){return new Ox.TreeStreamImpl(r,e=>(0,Ao.isCompositeCstNode)(e)?e.children:[],{includeRoot:!0})}De.streamCst=Ev;function $x(r){return Ev(r).filter(Ao.isLeafCstNode)}De.flattenCst=$x;function Mx(r){return{start:{character:r.startColumn-1,line:r.startLine-1},end:{character:r.endColumn,line:r.endLine-1}}}De.tokenToRange=Mx;function Lx(r){let{offset:e,end:t,range:n}=r;return{range:n,offset:e,end:t,length:t-e}}De.toDocumentSegment=Lx;De.DefaultNameRegexp=/^[\w\p{L}]$/u;function Fx(r,e,t=De.DefaultNameRegexp){if(r){if(e>0){let n=e-r.offset,i=r.text.charAt(n);t.test(i)||e--}return Lf(r,e)}}De.findDeclarationNodeAtOffset=Fx;function qx(r,e){if(r){let t=Cv(r,!0);if(t&&Mf(t,e))return t;if((0,Ao.isRootCstNode)(r)){let n=r.children.findIndex(i=>!i.hidden);for(let i=n-1;i>=0;i--){let o=r.children[i];if(Mf(o,e))return o}}}}De.findCommentNode=qx;function Mf(r,e){return(0,Ao.isLeafCstNode)(r)&&e.includes(r.tokenType.name)}De.isCommentNode=Mf;function Lf(r,e){if((0,Ao.isLeafCstNode)(r))return r;if((0,Ao.isCompositeCstNode)(r)){let t=0,n=r.children.length-1;for(;t<=n;){let i=Math.floor((t+n)/2),o=r.children[i];if(o.offset>e)n=i-1;else if(o.end<=e)t=i+1;else return Lf(o,e)}}}De.findLeafNodeAtOffset=Lf;function Cv(r,e=!0){for(;r.parent;){let t=r.parent,n=t.children.indexOf(r);if(n===0)r=t;else{n--;let i=t.children[n];if(e||!i.hidden)return i}}}De.getPreviousNode=Cv;function jx(r,e=!0){for(;r.parent;){let t=r.parent,n=t.children.indexOf(r);if(t.children.length-1===n)r=t;else{n++;let i=t.children[n];if(e||!i.hidden)return i}}}De.getNextNode=jx;function Gx(r){if(r.range.start.character===0)return r;let e=r.range.start.line,t=r,n;for(;r.parent;){let i=r.parent,o=n??i.children.indexOf(r);if(o===0?(r=i,n=void 0):(n=o-1,r=i.children[n]),r.range.start.line!==e)break;t=r}return t}De.getStartlineNode=Gx;function Ux(r,e){let t=Hx(r,e);return t?t.parent.children.slice(t.a+1,t.b):[]}De.getInteriorNodes=Ux;function Hx(r,e){let t=bv(r),n=bv(e),i;for(let o=0;o<t.length&&o<n.length;o++){let a=t[o],s=n[o];if(a.parent===s.parent)i={parent:a.parent,a:a.index,b:s.index};else break}return i}function bv(r){let e=[];for(;r.parent;){let t=r.parent,n=t.children.indexOf(r);e.push({parent:t,index:n}),r=t}return e.reverse()}});var xa=C(bo=>{"use strict";Object.defineProperty(bo,"__esModule",{value:!0});bo.eagerLoad=bo.inject=void 0;function Wx(r,e,t,n){let i=[r,e,t,n].reduce(Nv,{});return Sv(i)}bo.inject=Wx;var Ff=Symbol("isProxy");function xv(r){if(r&&r[Ff])for(let e of Object.values(r))xv(e);return r}bo.eagerLoad=xv;function Sv(r,e){let t=new Proxy({},{deleteProperty:()=>!1,get:(n,i)=>kv(n,i,r,e||t),getOwnPropertyDescriptor:(n,i)=>(kv(n,i,r,e||t),Object.getOwnPropertyDescriptor(n,i)),has:(n,i)=>i in r,ownKeys:()=>[...Reflect.ownKeys(r),Ff]});return t[Ff]=!0,t}var Pv=Symbol();function kv(r,e,t,n){if(e in r){if(r[e]instanceof Error)throw new Error("Construction failure. Please make sure that your dependencies are constructable.",{cause:r[e]});if(r[e]===Pv)throw new Error('Cycle detected. Please make "'+String(e)+'" lazy. See https://langium.org/docs/di/cyclic-dependencies');return r[e]}else if(e in t){let i=t[e];r[e]=Pv;try{r[e]=typeof i=="function"?i(n):Sv(i,n)}catch(o){throw r[e]=o instanceof Error?o:void 0,o}return r[e]}else return}function Nv(r,e){if(e){for(let[t,n]of Object.entries(e))if(n!==void 0){let i=r[t];i!==null&&n!==null&&typeof i=="object"&&typeof n=="object"?r[t]=Nv(i,n):r[t]=n}}return r}});var Re=C(Pe=>{"use strict";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.findLocalReferences=Pe.streamReferences=Pe.streamAst=Pe.streamAllContents=Pe.streamContents=Pe.findRootNode=Pe.getDocument=Pe.hasContainerOfType=Pe.getContainerOfType=Pe.isLinkingError=Pe.isAstNodeDescription=Pe.isReference=Pe.linkContentToContainer=Pe.isAstNode=void 0;var Mi=Ct();function Eo(r){return typeof r=="object"&&r!==null&&typeof r.$type=="string"}Pe.isAstNode=Eo;function Kx(r){for(let[e,t]of Object.entries(r))e.startsWith("$")||(Array.isArray(t)?t.forEach((n,i)=>{Eo(n)&&(n.$container=r,n.$containerProperty=e,n.$containerIndex=i)}):Eo(t)&&(t.$container=r,t.$containerProperty=e))}Pe.linkContentToContainer=Kx;function Ru(r){return typeof r=="object"&&r!==null&&typeof r.$refText=="string"}Pe.isReference=Ru;function Bx(r){return typeof r=="object"&&r!==null&&typeof r.name=="string"&&typeof r.type=="string"&&typeof r.path=="string"}Pe.isAstNodeDescription=Bx;function zx(r){return typeof r=="object"&&r!==null&&Eo(r.container)&&Ru(r.reference)&&typeof r.message=="string"}Pe.isLinkingError=zx;function Vx(r,e){let t=r;for(;t;){if(e(t))return t;t=t.$container}}Pe.getContainerOfType=Vx;function Yx(r,e){let t=r;for(;t;){if(e(t))return!0;t=t.$container}return!1}Pe.hasContainerOfType=Yx;function Dv(r){let t=wv(r).$document;if(!t)throw new Error("AST node has no document.");return t}Pe.getDocument=Dv;function wv(r){for(;r.$container;)r=r.$container;return r}Pe.findRootNode=wv;function qf(r){return new Mi.StreamImpl(()=>({keys:Object.keys(r),keyIndex:0,arrayIndex:0}),e=>{for(;e.keyIndex<e.keys.length;){let t=e.keys[e.keyIndex];if(!t.startsWith("$")){let n=r[t];if(Eo(n))return e.keyIndex++,{done:!1,value:n};if(Array.isArray(n)){for(;e.arrayIndex<n.length;){let i=e.arrayIndex++,o=n[i];if(Eo(o))return{done:!1,value:o}}e.arrayIndex=0}}e.keyIndex++}return Mi.DONE_RESULT})}Pe.streamContents=qf;function Xx(r){return new Mi.TreeStreamImpl(r,e=>qf(e))}Pe.streamAllContents=Xx;function Iv(r){return new Mi.TreeStreamImpl(r,e=>qf(e),{includeRoot:!0})}Pe.streamAst=Iv;function Ov(r){return new Mi.StreamImpl(()=>({keys:Object.keys(r),keyIndex:0,arrayIndex:0}),e=>{for(;e.keyIndex<e.keys.length;){let t=e.keys[e.keyIndex];if(!t.startsWith("$")){let n=r[t];if(Ru(n))return e.keyIndex++,{done:!1,value:{reference:n,container:r,property:t}};if(Array.isArray(n)){for(;e.arrayIndex<n.length;){let i=e.arrayIndex++,o=n[i];if(Ru(o))return{done:!1,value:{reference:o,container:r,property:t,index:i}}}e.arrayIndex=0}}e.keyIndex++}return Mi.DONE_RESULT})}Pe.streamReferences=Ov;function Jx(r,e=Dv(r).parseResult.value){let t=[];return Iv(e).forEach(n=>{Ov(n).forEach(i=>{i.reference.ref===r&&t.push(i.reference)})}),(0,Mi.stream)(t)}Pe.findLocalReferences=Jx});var kr=C(_u=>{"use strict";Object.defineProperty(_u,"__esModule",{value:!0});_u.MultiMap=void 0;var Co=Ct(),jf=class{constructor(){this.map=new Map}get size(){return Co.Reduction.sum((0,Co.stream)(this.map.values()).map(e=>e.length))}clear(){this.map.clear()}delete(e,t){if(t===void 0)return this.map.delete(e);{let n=this.map.get(e);if(n){let i=n.indexOf(t);if(i>=0)return n.length===1?this.map.delete(e):n.splice(i,1),!0}return!1}}get(e){var t;return(t=this.map.get(e))!==null&&t!==void 0?t:[]}has(e,t){if(t===void 0)return this.map.has(e);{let n=this.map.get(e);return n?n.indexOf(t)>=0:!1}}add(e,t){return this.map.has(e)?this.map.get(e).push(t):this.map.set(e,[t]),this}addAll(e,t){return this.map.has(e)?this.map.get(e).push(...t):this.map.set(e,Array.from(t)),this}forEach(e){this.map.forEach((t,n)=>t.forEach(i=>e(i,n,this)))}[Symbol.iterator](){return this.entries().iterator()}entries(){return(0,Co.stream)(this.map.entries()).flatMap(([e,t])=>t.map(n=>[e,n]))}keys(){return(0,Co.stream)(this.map.keys())}values(){return(0,Co.stream)(this.map.values()).flat()}entriesGroupedByKey(){return(0,Co.stream)(this.map.entries())}};_u.MultiMap=jf});var bu=C(Po=>{"use strict";Object.defineProperty(Po,"__esModule",{value:!0});Po.EmptyFileSystem=Po.EmptyFileSystemProvider=void 0;var Au=class{readFile(){throw new Error("Method not implemented.")}readFileSync(){throw new Error("Method not implemented.")}async readDirectory(){return[]}};Po.EmptyFileSystemProvider=Au;Po.EmptyFileSystem={fileSystemProvider:()=>new Au}});var ze=C(T=>{"use strict";Object.defineProperty(T,"__esModule",{value:!0});T.isParserRule=T.ParserRule=T.isParameterReference=T.ParameterReference=T.isParameter=T.Parameter=T.isNegation=T.Negation=T.isNegatedToken=T.NegatedToken=T.isNamedArgument=T.NamedArgument=T.isLiteralCondition=T.LiteralCondition=T.isKeyword=T.Keyword=T.isInterface=T.Interface=T.isInferredType=T.InferredType=T.isGroup=T.Group=T.isGrammarImport=T.GrammarImport=T.isGrammar=T.Grammar=T.isDisjunction=T.Disjunction=T.isCrossReference=T.CrossReference=T.isConjunction=T.Conjunction=T.isCharacterRange=T.CharacterRange=T.isAtomType=T.AtomType=T.isAssignment=T.Assignment=T.isAlternatives=T.Alternatives=T.isAction=T.Action=T.isAbstractElement=T.AbstractElement=T.isCondition=T.Condition=T.isAbstractType=T.AbstractType=T.isAbstractRule=T.AbstractRule=void 0;T.reflection=T.LangiumGrammarAstReflection=T.isWildcard=T.Wildcard=T.isUntilToken=T.UntilToken=T.isUnorderedGroup=T.UnorderedGroup=T.isTypeAttribute=T.TypeAttribute=T.isType=T.Type=T.isTerminalRuleCall=T.TerminalRuleCall=T.isTerminalRule=T.TerminalRule=T.isTerminalGroup=T.TerminalGroup=T.isTerminalAlternatives=T.TerminalAlternatives=T.isRuleCall=T.RuleCall=T.isReturnType=T.ReturnType=T.isRegexToken=T.RegexToken=void 0;var Zx=Re();T.AbstractRule="AbstractRule";function Qx(r){return T.reflection.isInstance(r,T.AbstractRule)}T.isAbstractRule=Qx;T.AbstractType="AbstractType";function eS(r){return T.reflection.isInstance(r,T.AbstractType)}T.isAbstractType=eS;T.Condition="Condition";function tS(r){return T.reflection.isInstance(r,T.Condition)}T.isCondition=tS;T.AbstractElement="AbstractElement";function rS(r){return T.reflection.isInstance(r,T.AbstractElement)}T.isAbstractElement=rS;T.Action="Action";function nS(r){return T.reflection.isInstance(r,T.Action)}T.isAction=nS;T.Alternatives="Alternatives";function iS(r){return T.reflection.isInstance(r,T.Alternatives)}T.isAlternatives=iS;T.Assignment="Assignment";function oS(r){return T.reflection.isInstance(r,T.Assignment)}T.isAssignment=oS;T.AtomType="AtomType";function aS(r){return T.reflection.isInstance(r,T.AtomType)}T.isAtomType=aS;T.CharacterRange="CharacterRange";function sS(r){return T.reflection.isInstance(r,T.CharacterRange)}T.isCharacterRange=sS;T.Conjunction="Conjunction";function uS(r){return T.reflection.isInstance(r,T.Conjunction)}T.isConjunction=uS;T.CrossReference="CrossReference";function cS(r){return T.reflection.isInstance(r,T.CrossReference)}T.isCrossReference=cS;T.Disjunction="Disjunction";function lS(r){return T.reflection.isInstance(r,T.Disjunction)}T.isDisjunction=lS;T.Grammar="Grammar";function dS(r){return T.reflection.isInstance(r,T.Grammar)}T.isGrammar=dS;T.GrammarImport="GrammarImport";function fS(r){return T.reflection.isInstance(r,T.GrammarImport)}T.isGrammarImport=fS;T.Group="Group";function pS(r){return T.reflection.isInstance(r,T.Group)}T.isGroup=pS;T.InferredType="InferredType";function mS(r){return T.reflection.isInstance(r,T.InferredType)}T.isInferredType=mS;T.Interface="Interface";function hS(r){return T.reflection.isInstance(r,T.Interface)}T.isInterface=hS;T.Keyword="Keyword";function yS(r){return T.reflection.isInstance(r,T.Keyword)}T.isKeyword=yS;T.LiteralCondition="LiteralCondition";function gS(r){return T.reflection.isInstance(r,T.LiteralCondition)}T.isLiteralCondition=gS;T.NamedArgument="NamedArgument";function vS(r){return T.reflection.isInstance(r,T.NamedArgument)}T.isNamedArgument=vS;T.NegatedToken="NegatedToken";function TS(r){return T.reflection.isInstance(r,T.NegatedToken)}T.isNegatedToken=TS;T.Negation="Negation";function RS(r){return T.reflection.isInstance(r,T.Negation)}T.isNegation=RS;T.Parameter="Parameter";function _S(r){return T.reflection.isInstance(r,T.Parameter)}T.isParameter=_S;T.ParameterReference="ParameterReference";function AS(r){return T.reflection.isInstance(r,T.ParameterReference)}T.isParameterReference=AS;T.ParserRule="ParserRule";function bS(r){return T.reflection.isInstance(r,T.ParserRule)}T.isParserRule=bS;T.RegexToken="RegexToken";function ES(r){return T.reflection.isInstance(r,T.RegexToken)}T.isRegexToken=ES;T.ReturnType="ReturnType";function CS(r){return T.reflection.isInstance(r,T.ReturnType)}T.isReturnType=CS;T.RuleCall="RuleCall";function PS(r){return T.reflection.isInstance(r,T.RuleCall)}T.isRuleCall=PS;T.TerminalAlternatives="TerminalAlternatives";function kS(r){return T.reflection.isInstance(r,T.TerminalAlternatives)}T.isTerminalAlternatives=kS;T.TerminalGroup="TerminalGroup";function xS(r){return T.reflection.isInstance(r,T.TerminalGroup)}T.isTerminalGroup=xS;T.TerminalRule="TerminalRule";function SS(r){return T.reflection.isInstance(r,T.TerminalRule)}T.isTerminalRule=SS;T.TerminalRuleCall="TerminalRuleCall";function NS(r){return T.reflection.isInstance(r,T.TerminalRuleCall)}T.isTerminalRuleCall=NS;T.Type="Type";function DS(r){return T.reflection.isInstance(r,T.Type)}T.isType=DS;T.TypeAttribute="TypeAttribute";function wS(r){return T.reflection.isInstance(r,T.TypeAttribute)}T.isTypeAttribute=wS;T.UnorderedGroup="UnorderedGroup";function IS(r){return T.reflection.isInstance(r,T.UnorderedGroup)}T.isUnorderedGroup=IS;T.UntilToken="UntilToken";function OS(r){return T.reflection.isInstance(r,T.UntilToken)}T.isUntilToken=OS;T.Wildcard="Wildcard";function $S(r){return T.reflection.isInstance(r,T.Wildcard)}T.isWildcard=$S;var Eu=class{getAllTypes(){return["AbstractElement","AbstractRule","AbstractType","Action","Alternatives","Assignment","AtomType","CharacterRange","Condition","Conjunction","CrossReference","Disjunction","Grammar","GrammarImport","Group","InferredType","Interface","Keyword","LiteralCondition","NamedArgument","NegatedToken","Negation","Parameter","ParameterReference","ParserRule","RegexToken","ReturnType","RuleCall","TerminalAlternatives","TerminalGroup","TerminalRule","TerminalRuleCall","Type","TypeAttribute","UnorderedGroup","UntilToken","Wildcard"]}isInstance(e,t){return(0,Zx.isAstNode)(e)&&this.isSubtype(e.$type,t)}isSubtype(e,t){if(e===t)return!0;switch(e){case T.Action:return this.isSubtype(T.AbstractElement,t)||this.isSubtype(T.AbstractType,t);case T.Alternatives:case T.Assignment:case T.CharacterRange:case T.CrossReference:case T.Group:case T.Keyword:case T.NegatedToken:case T.RegexToken:case T.RuleCall:case T.TerminalAlternatives:case T.TerminalGroup:case T.TerminalRuleCall:case T.UnorderedGroup:case T.UntilToken:case T.Wildcard:return this.isSubtype(T.AbstractElement,t);case T.Conjunction:case T.Disjunction:case T.LiteralCondition:case T.Negation:case T.ParameterReference:return this.isSubtype(T.Condition,t);case T.Interface:case T.Type:return this.isSubtype(T.AbstractType,t);case T.ParserRule:return this.isSubtype(T.AbstractRule,t)||this.isSubtype(T.AbstractType,t);case T.TerminalRule:return this.isSubtype(T.AbstractRule,t);default:return!1}}getReferenceType(e){let t=`${e.container.$type}:${e.property}`;switch(t){case"Action:type":return T.AbstractType;case"AtomType:refType":return T.AbstractType;case"CrossReference:type":return T.AbstractType;case"Grammar:hiddenTokens":return T.AbstractRule;case"Grammar:usedGrammars":return T.Grammar;case"Interface:superTypes":return T.AbstractType;case"NamedArgument:parameter":return T.Parameter;case"ParameterReference:parameter":return T.Parameter;case"ParserRule:hiddenTokens":return T.AbstractRule;case"ParserRule:returnType":return T.AbstractType;case"RuleCall:rule":return T.AbstractRule;case"TerminalRuleCall:rule":return T.TerminalRule;default:throw new Error(`${t} is not a valid reference id.`)}}getTypeMetaData(e){switch(e){case"Alternatives":return{name:"Alternatives",mandatory:[{name:"elements",type:"array"}]};case"AtomType":return{name:"AtomType",mandatory:[{name:"isArray",type:"boolean"},{name:"isRef",type:"boolean"}]};case"CrossReference":return{name:"CrossReference",mandatory:[{name:"deprecatedSyntax",type:"boolean"}]};case"Grammar":return{name:"Grammar",mandatory:[{name:"definesHiddenTokens",type:"boolean"},{name:"hiddenTokens",type:"array"},{name:"imports",type:"array"},{name:"interfaces",type:"array"},{name:"isDeclared",type:"boolean"},{name:"rules",type:"array"},{name:"types",type:"array"},{name:"usedGrammars",type:"array"}]};case"Group":return{name:"Group",mandatory:[{name:"elements",type:"array"}]};case"Interface":return{name:"Interface",mandatory:[{name:"attributes",type:"array"},{name:"superTypes",type:"array"}]};case"LiteralCondition":return{name:"LiteralCondition",mandatory:[{name:"true",type:"boolean"}]};case"NamedArgument":return{name:"NamedArgument",mandatory:[{name:"calledByName",type:"boolean"}]};case"ParserRule":return{name:"ParserRule",mandatory:[{name:"definesHiddenTokens",type:"boolean"},{name:"entry",type:"boolean"},{name:"fragment",type:"boolean"},{name:"hiddenTokens",type:"array"},{name:"parameters",type:"array"},{name:"wildcard",type:"boolean"}]};case"RuleCall":return{name:"RuleCall",mandatory:[{name:"arguments",type:"array"}]};case"TerminalAlternatives":return{name:"TerminalAlternatives",mandatory:[{name:"elements",type:"array"}]};case"TerminalGroup":return{name:"TerminalGroup",mandatory:[{name:"elements",type:"array"}]};case"TerminalRule":return{name:"TerminalRule",mandatory:[{name:"fragment",type:"boolean"},{name:"hidden",type:"boolean"}]};case"Type":return{name:"Type",mandatory:[{name:"typeAlternatives",type:"array"}]};case"TypeAttribute":return{name:"TypeAttribute",mandatory:[{name:"isOptional",type:"boolean"},{name:"typeAlternatives",type:"array"}]};case"UnorderedGroup":return{name:"UnorderedGroup",mandatory:[{name:"elements",type:"array"}]};default:return{name:e,mandatory:[]}}}};T.LangiumGrammarAstReflection=Eu;T.reflection=new Eu});var $v=C(Pu=>{"use strict";Object.defineProperty(Pu,"__esModule",{value:!0});Pu.LangiumGrammarGrammar=void 0;var MS=Pt(),Cu,LS=()=>Cu??(Cu=(0,MS.loadGrammarFromJson)(`{
33
+ `&&f++}v&&P.length>0&&E.push(P.length),this._lineOffsets=E}return this._lineOffsets},m.prototype.positionAt=function(E){E=Math.max(Math.min(E,this._content.length),0);var P=this.getLineOffsets(),v=0,f=P.length;if(f===0)return a.create(0,E);for(;v<f;){var N=Math.floor((v+f)/2);P[N]>E?f=N:v=N+1}var I=v-1;return a.create(I,E-P[I])},m.prototype.offsetAt=function(E){var P=this.getLineOffsets();if(E.line>=P.length)return this._content.length;if(E.line<0)return 0;var v=P[E.line],f=E.line+1<P.length?P[E.line+1]:this._content.length;return Math.max(Math.min(v+E.character,f),v)},Object.defineProperty(m.prototype,"lineCount",{get:function(){return this.getLineOffsets().length},enumerable:!1,configurable:!0}),m}(),S;(function(m){var E=Object.prototype.toString;function P(de){return typeof de<"u"}m.defined=P;function v(de){return typeof de>"u"}m.undefined=v;function f(de){return de===!0||de===!1}m.boolean=f;function N(de){return E.call(de)==="[object String]"}m.string=N;function I(de){return E.call(de)==="[object Number]"}m.number=I;function re(de,ro,As){return E.call(de)==="[object Number]"&&ro<=de&&de<=As}m.numberRange=re;function ct(de){return E.call(de)==="[object Number]"&&-2147483648<=de&&de<=2147483647}m.integer=ct;function We(de){return E.call(de)==="[object Number]"&&0<=de&&de<=2147483647}m.uinteger=We;function Fr(de){return E.call(de)==="[object Function]"}m.func=Fr;function qr(de){return de!==null&&typeof de=="object"}m.objectLiteral=qr;function $n(de,ro){return Array.isArray(de)&&de.every(ro)}m.typedArray=$n})(S||(S={}))})});var it=C(tr=>{"use strict";Object.defineProperty(tr,"__esModule",{value:!0});tr.ProtocolNotificationType=tr.ProtocolNotificationType0=tr.ProtocolRequestType=tr.ProtocolRequestType0=tr.RegistrationType=tr.MessageDirection=void 0;var fo=pn(),zC;(function(r){r.clientToServer="clientToServer",r.serverToClient="serverToClient",r.both="both"})(zC=tr.MessageDirection||(tr.MessageDirection={}));var Jd=class{constructor(e){this.method=e}};tr.RegistrationType=Jd;var Zd=class extends fo.RequestType0{constructor(e){super(e)}};tr.ProtocolRequestType0=Zd;var Qd=class extends fo.RequestType{constructor(e){super(e,fo.ParameterStructures.byName)}};tr.ProtocolRequestType=Qd;var ef=class extends fo.NotificationType0{constructor(e){super(e)}};tr.ProtocolNotificationType0=ef;var tf=class extends fo.NotificationType{constructor(e){super(e,fo.ParameterStructures.byName)}};tr.ProtocolNotificationType=tf});var Ms=C(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.objectLiteral=gt.typedArray=gt.stringArray=gt.array=gt.func=gt.error=gt.number=gt.string=gt.boolean=void 0;function VC(r){return r===!0||r===!1}gt.boolean=VC;function Wy(r){return typeof r=="string"||r instanceof String}gt.string=Wy;function YC(r){return typeof r=="number"||r instanceof Number}gt.number=YC;function XC(r){return r instanceof Error}gt.error=XC;function JC(r){return typeof r=="function"}gt.func=JC;function Ky(r){return Array.isArray(r)}gt.array=Ky;function ZC(r){return Ky(r)&&r.every(e=>Wy(e))}gt.stringArray=ZC;function QC(r,e){return Array.isArray(r)&&r.every(e)}gt.typedArray=QC;function eP(r){return r!==null&&typeof r=="object"}gt.objectLiteral=eP});var zy=C(fa=>{"use strict";Object.defineProperty(fa,"__esModule",{value:!0});fa.ImplementationRequest=void 0;var By=it(),tP;(function(r){r.method="textDocument/implementation",r.messageDirection=By.MessageDirection.clientToServer,r.type=new By.ProtocolRequestType(r.method)})(tP=fa.ImplementationRequest||(fa.ImplementationRequest={}))});var Yy=C(pa=>{"use strict";Object.defineProperty(pa,"__esModule",{value:!0});pa.TypeDefinitionRequest=void 0;var Vy=it(),rP;(function(r){r.method="textDocument/typeDefinition",r.messageDirection=Vy.MessageDirection.clientToServer,r.type=new Vy.ProtocolRequestType(r.method)})(rP=pa.TypeDefinitionRequest||(pa.TypeDefinitionRequest={}))});var Xy=C(ii=>{"use strict";Object.defineProperty(ii,"__esModule",{value:!0});ii.DidChangeWorkspaceFoldersNotification=ii.WorkspaceFoldersRequest=void 0;var Ls=it(),nP;(function(r){r.method="workspace/workspaceFolders",r.messageDirection=Ls.MessageDirection.serverToClient,r.type=new Ls.ProtocolRequestType0(r.method)})(nP=ii.WorkspaceFoldersRequest||(ii.WorkspaceFoldersRequest={}));var iP;(function(r){r.method="workspace/didChangeWorkspaceFolders",r.messageDirection=Ls.MessageDirection.clientToServer,r.type=new Ls.ProtocolNotificationType(r.method)})(iP=ii.DidChangeWorkspaceFoldersNotification||(ii.DidChangeWorkspaceFoldersNotification={}))});var Zy=C(ma=>{"use strict";Object.defineProperty(ma,"__esModule",{value:!0});ma.ConfigurationRequest=void 0;var Jy=it(),oP;(function(r){r.method="workspace/configuration",r.messageDirection=Jy.MessageDirection.serverToClient,r.type=new Jy.ProtocolRequestType(r.method)})(oP=ma.ConfigurationRequest||(ma.ConfigurationRequest={}))});var Qy=C(oi=>{"use strict";Object.defineProperty(oi,"__esModule",{value:!0});oi.ColorPresentationRequest=oi.DocumentColorRequest=void 0;var Fs=it(),aP;(function(r){r.method="textDocument/documentColor",r.messageDirection=Fs.MessageDirection.clientToServer,r.type=new Fs.ProtocolRequestType(r.method)})(aP=oi.DocumentColorRequest||(oi.DocumentColorRequest={}));var sP;(function(r){r.method="textDocument/colorPresentation",r.messageDirection=Fs.MessageDirection.clientToServer,r.type=new Fs.ProtocolRequestType(r.method)})(sP=oi.ColorPresentationRequest||(oi.ColorPresentationRequest={}))});var tg=C(ha=>{"use strict";Object.defineProperty(ha,"__esModule",{value:!0});ha.FoldingRangeRequest=void 0;var eg=it(),uP;(function(r){r.method="textDocument/foldingRange",r.messageDirection=eg.MessageDirection.clientToServer,r.type=new eg.ProtocolRequestType(r.method)})(uP=ha.FoldingRangeRequest||(ha.FoldingRangeRequest={}))});var ng=C(ya=>{"use strict";Object.defineProperty(ya,"__esModule",{value:!0});ya.DeclarationRequest=void 0;var rg=it(),cP;(function(r){r.method="textDocument/declaration",r.messageDirection=rg.MessageDirection.clientToServer,r.type=new rg.ProtocolRequestType(r.method)})(cP=ya.DeclarationRequest||(ya.DeclarationRequest={}))});var og=C(ga=>{"use strict";Object.defineProperty(ga,"__esModule",{value:!0});ga.SelectionRangeRequest=void 0;var ig=it(),lP;(function(r){r.method="textDocument/selectionRange",r.messageDirection=ig.MessageDirection.clientToServer,r.type=new ig.ProtocolRequestType(r.method)})(lP=ga.SelectionRangeRequest||(ga.SelectionRangeRequest={}))});var ag=C(Ur=>{"use strict";Object.defineProperty(Ur,"__esModule",{value:!0});Ur.WorkDoneProgressCancelNotification=Ur.WorkDoneProgressCreateRequest=Ur.WorkDoneProgress=void 0;var dP=pn(),qs=it(),fP;(function(r){r.type=new dP.ProgressType;function e(t){return t===r.type}r.is=e})(fP=Ur.WorkDoneProgress||(Ur.WorkDoneProgress={}));var pP;(function(r){r.method="window/workDoneProgress/create",r.messageDirection=qs.MessageDirection.serverToClient,r.type=new qs.ProtocolRequestType(r.method)})(pP=Ur.WorkDoneProgressCreateRequest||(Ur.WorkDoneProgressCreateRequest={}));var mP;(function(r){r.method="window/workDoneProgress/cancel",r.messageDirection=qs.MessageDirection.clientToServer,r.type=new qs.ProtocolNotificationType(r.method)})(mP=Ur.WorkDoneProgressCancelNotification||(Ur.WorkDoneProgressCancelNotification={}))});var sg=C(Hr=>{"use strict";Object.defineProperty(Hr,"__esModule",{value:!0});Hr.CallHierarchyOutgoingCallsRequest=Hr.CallHierarchyIncomingCallsRequest=Hr.CallHierarchyPrepareRequest=void 0;var po=it(),hP;(function(r){r.method="textDocument/prepareCallHierarchy",r.messageDirection=po.MessageDirection.clientToServer,r.type=new po.ProtocolRequestType(r.method)})(hP=Hr.CallHierarchyPrepareRequest||(Hr.CallHierarchyPrepareRequest={}));var yP;(function(r){r.method="callHierarchy/incomingCalls",r.messageDirection=po.MessageDirection.clientToServer,r.type=new po.ProtocolRequestType(r.method)})(yP=Hr.CallHierarchyIncomingCallsRequest||(Hr.CallHierarchyIncomingCallsRequest={}));var gP;(function(r){r.method="callHierarchy/outgoingCalls",r.messageDirection=po.MessageDirection.clientToServer,r.type=new po.ProtocolRequestType(r.method)})(gP=Hr.CallHierarchyOutgoingCallsRequest||(Hr.CallHierarchyOutgoingCallsRequest={}))});var ug=C(vt=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});vt.SemanticTokensRefreshRequest=vt.SemanticTokensRangeRequest=vt.SemanticTokensDeltaRequest=vt.SemanticTokensRequest=vt.SemanticTokensRegistrationType=vt.TokenFormat=void 0;var jn=it(),vP;(function(r){r.Relative="relative"})(vP=vt.TokenFormat||(vt.TokenFormat={}));var js;(function(r){r.method="textDocument/semanticTokens",r.type=new jn.RegistrationType(r.method)})(js=vt.SemanticTokensRegistrationType||(vt.SemanticTokensRegistrationType={}));var TP;(function(r){r.method="textDocument/semanticTokens/full",r.messageDirection=jn.MessageDirection.clientToServer,r.type=new jn.ProtocolRequestType(r.method),r.registrationMethod=js.method})(TP=vt.SemanticTokensRequest||(vt.SemanticTokensRequest={}));var RP;(function(r){r.method="textDocument/semanticTokens/full/delta",r.messageDirection=jn.MessageDirection.clientToServer,r.type=new jn.ProtocolRequestType(r.method),r.registrationMethod=js.method})(RP=vt.SemanticTokensDeltaRequest||(vt.SemanticTokensDeltaRequest={}));var _P;(function(r){r.method="textDocument/semanticTokens/range",r.messageDirection=jn.MessageDirection.clientToServer,r.type=new jn.ProtocolRequestType(r.method),r.registrationMethod=js.method})(_P=vt.SemanticTokensRangeRequest||(vt.SemanticTokensRangeRequest={}));var AP;(function(r){r.method="workspace/semanticTokens/refresh",r.messageDirection=jn.MessageDirection.clientToServer,r.type=new jn.ProtocolRequestType0(r.method)})(AP=vt.SemanticTokensRefreshRequest||(vt.SemanticTokensRefreshRequest={}))});var lg=C(va=>{"use strict";Object.defineProperty(va,"__esModule",{value:!0});va.ShowDocumentRequest=void 0;var cg=it(),bP;(function(r){r.method="window/showDocument",r.messageDirection=cg.MessageDirection.serverToClient,r.type=new cg.ProtocolRequestType(r.method)})(bP=va.ShowDocumentRequest||(va.ShowDocumentRequest={}))});var fg=C(Ta=>{"use strict";Object.defineProperty(Ta,"__esModule",{value:!0});Ta.LinkedEditingRangeRequest=void 0;var dg=it(),EP;(function(r){r.method="textDocument/linkedEditingRange",r.messageDirection=dg.MessageDirection.clientToServer,r.type=new dg.ProtocolRequestType(r.method)})(EP=Ta.LinkedEditingRangeRequest||(Ta.LinkedEditingRangeRequest={}))});var pg=C(ot=>{"use strict";Object.defineProperty(ot,"__esModule",{value:!0});ot.WillDeleteFilesRequest=ot.DidDeleteFilesNotification=ot.DidRenameFilesNotification=ot.WillRenameFilesRequest=ot.DidCreateFilesNotification=ot.WillCreateFilesRequest=ot.FileOperationPatternKind=void 0;var br=it(),CP;(function(r){r.file="file",r.folder="folder"})(CP=ot.FileOperationPatternKind||(ot.FileOperationPatternKind={}));var PP;(function(r){r.method="workspace/willCreateFiles",r.messageDirection=br.MessageDirection.clientToServer,r.type=new br.ProtocolRequestType(r.method)})(PP=ot.WillCreateFilesRequest||(ot.WillCreateFilesRequest={}));var kP;(function(r){r.method="workspace/didCreateFiles",r.messageDirection=br.MessageDirection.clientToServer,r.type=new br.ProtocolNotificationType(r.method)})(kP=ot.DidCreateFilesNotification||(ot.DidCreateFilesNotification={}));var xP;(function(r){r.method="workspace/willRenameFiles",r.messageDirection=br.MessageDirection.clientToServer,r.type=new br.ProtocolRequestType(r.method)})(xP=ot.WillRenameFilesRequest||(ot.WillRenameFilesRequest={}));var SP;(function(r){r.method="workspace/didRenameFiles",r.messageDirection=br.MessageDirection.clientToServer,r.type=new br.ProtocolNotificationType(r.method)})(SP=ot.DidRenameFilesNotification||(ot.DidRenameFilesNotification={}));var NP;(function(r){r.method="workspace/didDeleteFiles",r.messageDirection=br.MessageDirection.clientToServer,r.type=new br.ProtocolNotificationType(r.method)})(NP=ot.DidDeleteFilesNotification||(ot.DidDeleteFilesNotification={}));var DP;(function(r){r.method="workspace/willDeleteFiles",r.messageDirection=br.MessageDirection.clientToServer,r.type=new br.ProtocolRequestType(r.method)})(DP=ot.WillDeleteFilesRequest||(ot.WillDeleteFilesRequest={}))});var hg=C(Wr=>{"use strict";Object.defineProperty(Wr,"__esModule",{value:!0});Wr.MonikerRequest=Wr.MonikerKind=Wr.UniquenessLevel=void 0;var mg=it(),wP;(function(r){r.document="document",r.project="project",r.group="group",r.scheme="scheme",r.global="global"})(wP=Wr.UniquenessLevel||(Wr.UniquenessLevel={}));var IP;(function(r){r.$import="import",r.$export="export",r.local="local"})(IP=Wr.MonikerKind||(Wr.MonikerKind={}));var OP;(function(r){r.method="textDocument/moniker",r.messageDirection=mg.MessageDirection.clientToServer,r.type=new mg.ProtocolRequestType(r.method)})(OP=Wr.MonikerRequest||(Wr.MonikerRequest={}))});var yg=C(Kr=>{"use strict";Object.defineProperty(Kr,"__esModule",{value:!0});Kr.TypeHierarchySubtypesRequest=Kr.TypeHierarchySupertypesRequest=Kr.TypeHierarchyPrepareRequest=void 0;var mo=it(),$P;(function(r){r.method="textDocument/prepareTypeHierarchy",r.messageDirection=mo.MessageDirection.clientToServer,r.type=new mo.ProtocolRequestType(r.method)})($P=Kr.TypeHierarchyPrepareRequest||(Kr.TypeHierarchyPrepareRequest={}));var MP;(function(r){r.method="typeHierarchy/supertypes",r.messageDirection=mo.MessageDirection.clientToServer,r.type=new mo.ProtocolRequestType(r.method)})(MP=Kr.TypeHierarchySupertypesRequest||(Kr.TypeHierarchySupertypesRequest={}));var LP;(function(r){r.method="typeHierarchy/subtypes",r.messageDirection=mo.MessageDirection.clientToServer,r.type=new mo.ProtocolRequestType(r.method)})(LP=Kr.TypeHierarchySubtypesRequest||(Kr.TypeHierarchySubtypesRequest={}))});var gg=C(ai=>{"use strict";Object.defineProperty(ai,"__esModule",{value:!0});ai.InlineValueRefreshRequest=ai.InlineValueRequest=void 0;var Gs=it(),FP;(function(r){r.method="textDocument/inlineValue",r.messageDirection=Gs.MessageDirection.clientToServer,r.type=new Gs.ProtocolRequestType(r.method)})(FP=ai.InlineValueRequest||(ai.InlineValueRequest={}));var qP;(function(r){r.method="workspace/inlineValue/refresh",r.messageDirection=Gs.MessageDirection.clientToServer,r.type=new Gs.ProtocolRequestType0(r.method)})(qP=ai.InlineValueRefreshRequest||(ai.InlineValueRefreshRequest={}))});var vg=C(Br=>{"use strict";Object.defineProperty(Br,"__esModule",{value:!0});Br.InlayHintRefreshRequest=Br.InlayHintResolveRequest=Br.InlayHintRequest=void 0;var ho=it(),jP;(function(r){r.method="textDocument/inlayHint",r.messageDirection=ho.MessageDirection.clientToServer,r.type=new ho.ProtocolRequestType(r.method)})(jP=Br.InlayHintRequest||(Br.InlayHintRequest={}));var GP;(function(r){r.method="inlayHint/resolve",r.messageDirection=ho.MessageDirection.clientToServer,r.type=new ho.ProtocolRequestType(r.method)})(GP=Br.InlayHintResolveRequest||(Br.InlayHintResolveRequest={}));var UP;(function(r){r.method="workspace/inlayHint/refresh",r.messageDirection=ho.MessageDirection.clientToServer,r.type=new ho.ProtocolRequestType0(r.method)})(UP=Br.InlayHintRefreshRequest||(Br.InlayHintRefreshRequest={}))});var Rg=C(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.DiagnosticRefreshRequest=It.WorkspaceDiagnosticRequest=It.DocumentDiagnosticRequest=It.DocumentDiagnosticReportKind=It.DiagnosticServerCancellationData=void 0;var Tg=pn(),HP=Ms(),yo=it(),WP;(function(r){function e(t){let n=t;return n&&HP.boolean(n.retriggerRequest)}r.is=e})(WP=It.DiagnosticServerCancellationData||(It.DiagnosticServerCancellationData={}));var KP;(function(r){r.Full="full",r.Unchanged="unchanged"})(KP=It.DocumentDiagnosticReportKind||(It.DocumentDiagnosticReportKind={}));var BP;(function(r){r.method="textDocument/diagnostic",r.messageDirection=yo.MessageDirection.clientToServer,r.type=new yo.ProtocolRequestType(r.method),r.partialResult=new Tg.ProgressType})(BP=It.DocumentDiagnosticRequest||(It.DocumentDiagnosticRequest={}));var zP;(function(r){r.method="workspace/diagnostic",r.messageDirection=yo.MessageDirection.clientToServer,r.type=new yo.ProtocolRequestType(r.method),r.partialResult=new Tg.ProgressType})(zP=It.WorkspaceDiagnosticRequest||(It.WorkspaceDiagnosticRequest={}));var VP;(function(r){r.method="workspace/diagnostic/refresh",r.messageDirection=yo.MessageDirection.clientToServer,r.type=new yo.ProtocolRequestType0(r.method)})(VP=It.DiagnosticRefreshRequest||(It.DiagnosticRefreshRequest={}))});var bg=C(Te=>{"use strict";Object.defineProperty(Te,"__esModule",{value:!0});Te.DidCloseNotebookDocumentNotification=Te.DidSaveNotebookDocumentNotification=Te.DidChangeNotebookDocumentNotification=Te.NotebookCellArrayChange=Te.DidOpenNotebookDocumentNotification=Te.NotebookDocumentSyncRegistrationType=Te.NotebookDocument=Te.NotebookCell=Te.ExecutionSummary=Te.NotebookCellKind=void 0;var Ra=lo(),zr=Ms(),mn=it(),_g;(function(r){r.Markup=1,r.Code=2;function e(t){return t===1||t===2}r.is=e})(_g=Te.NotebookCellKind||(Te.NotebookCellKind={}));var Ag;(function(r){function e(i,o){let a={executionOrder:i};return(o===!0||o===!1)&&(a.success=o),a}r.create=e;function t(i){let o=i;return zr.objectLiteral(o)&&Ra.uinteger.is(o.executionOrder)&&(o.success===void 0||zr.boolean(o.success))}r.is=t;function n(i,o){return i===o?!0:i==null||o===null||o===void 0?!1:i.executionOrder===o.executionOrder&&i.success===o.success}r.equals=n})(Ag=Te.ExecutionSummary||(Te.ExecutionSummary={}));var rf;(function(r){function e(o,a){return{kind:o,document:a}}r.create=e;function t(o){let a=o;return zr.objectLiteral(a)&&_g.is(a.kind)&&Ra.DocumentUri.is(a.document)&&(a.metadata===void 0||zr.objectLiteral(a.metadata))}r.is=t;function n(o,a){let s=new Set;return o.document!==a.document&&s.add("document"),o.kind!==a.kind&&s.add("kind"),o.executionSummary!==a.executionSummary&&s.add("executionSummary"),(o.metadata!==void 0||a.metadata!==void 0)&&!i(o.metadata,a.metadata)&&s.add("metadata"),(o.executionSummary!==void 0||a.executionSummary!==void 0)&&!Ag.equals(o.executionSummary,a.executionSummary)&&s.add("executionSummary"),s}r.diff=n;function i(o,a){if(o===a)return!0;if(o==null||a===null||a===void 0||typeof o!=typeof a||typeof o!="object")return!1;let s=Array.isArray(o),u=Array.isArray(a);if(s!==u)return!1;if(s&&u){if(o.length!==a.length)return!1;for(let c=0;c<o.length;c++)if(!i(o[c],a[c]))return!1}if(zr.objectLiteral(o)&&zr.objectLiteral(a)){let c=Object.keys(o),l=Object.keys(a);if(c.length!==l.length||(c.sort(),l.sort(),!i(c,l)))return!1;for(let d=0;d<c.length;d++){let g=c[d];if(!i(o[g],a[g]))return!1}}return!0}})(rf=Te.NotebookCell||(Te.NotebookCell={}));var YP;(function(r){function e(n,i,o,a){return{uri:n,notebookType:i,version:o,cells:a}}r.create=e;function t(n){let i=n;return zr.objectLiteral(i)&&zr.string(i.uri)&&Ra.integer.is(i.version)&&zr.typedArray(i.cells,rf.is)}r.is=t})(YP=Te.NotebookDocument||(Te.NotebookDocument={}));var _a;(function(r){r.method="notebookDocument/sync",r.messageDirection=mn.MessageDirection.clientToServer,r.type=new mn.RegistrationType(r.method)})(_a=Te.NotebookDocumentSyncRegistrationType||(Te.NotebookDocumentSyncRegistrationType={}));var XP;(function(r){r.method="notebookDocument/didOpen",r.messageDirection=mn.MessageDirection.clientToServer,r.type=new mn.ProtocolNotificationType(r.method),r.registrationMethod=_a.method})(XP=Te.DidOpenNotebookDocumentNotification||(Te.DidOpenNotebookDocumentNotification={}));var JP;(function(r){function e(n){let i=n;return zr.objectLiteral(i)&&Ra.uinteger.is(i.start)&&Ra.uinteger.is(i.deleteCount)&&(i.cells===void 0||zr.typedArray(i.cells,rf.is))}r.is=e;function t(n,i,o){let a={start:n,deleteCount:i};return o!==void 0&&(a.cells=o),a}r.create=t})(JP=Te.NotebookCellArrayChange||(Te.NotebookCellArrayChange={}));var ZP;(function(r){r.method="notebookDocument/didChange",r.messageDirection=mn.MessageDirection.clientToServer,r.type=new mn.ProtocolNotificationType(r.method),r.registrationMethod=_a.method})(ZP=Te.DidChangeNotebookDocumentNotification||(Te.DidChangeNotebookDocumentNotification={}));var QP;(function(r){r.method="notebookDocument/didSave",r.messageDirection=mn.MessageDirection.clientToServer,r.type=new mn.ProtocolNotificationType(r.method),r.registrationMethod=_a.method})(QP=Te.DidSaveNotebookDocumentNotification||(Te.DidSaveNotebookDocumentNotification={}));var ek;(function(r){r.method="notebookDocument/didClose",r.messageDirection=mn.MessageDirection.clientToServer,r.type=new mn.ProtocolNotificationType(r.method),r.registrationMethod=_a.method})(ek=Te.DidCloseNotebookDocumentNotification||(Te.DidCloseNotebookDocumentNotification={}))});var wg=C(h=>{"use strict";Object.defineProperty(h,"__esModule",{value:!0});h.WorkspaceSymbolRequest=h.CodeActionResolveRequest=h.CodeActionRequest=h.DocumentSymbolRequest=h.DocumentHighlightRequest=h.ReferencesRequest=h.DefinitionRequest=h.SignatureHelpRequest=h.SignatureHelpTriggerKind=h.HoverRequest=h.CompletionResolveRequest=h.CompletionRequest=h.CompletionTriggerKind=h.PublishDiagnosticsNotification=h.WatchKind=h.RelativePattern=h.FileChangeType=h.DidChangeWatchedFilesNotification=h.WillSaveTextDocumentWaitUntilRequest=h.WillSaveTextDocumentNotification=h.TextDocumentSaveReason=h.DidSaveTextDocumentNotification=h.DidCloseTextDocumentNotification=h.DidChangeTextDocumentNotification=h.TextDocumentContentChangeEvent=h.DidOpenTextDocumentNotification=h.TextDocumentSyncKind=h.TelemetryEventNotification=h.LogMessageNotification=h.ShowMessageRequest=h.ShowMessageNotification=h.MessageType=h.DidChangeConfigurationNotification=h.ExitNotification=h.ShutdownRequest=h.InitializedNotification=h.InitializeErrorCodes=h.InitializeRequest=h.WorkDoneProgressOptions=h.TextDocumentRegistrationOptions=h.StaticRegistrationOptions=h.PositionEncodingKind=h.FailureHandlingKind=h.ResourceOperationKind=h.UnregistrationRequest=h.RegistrationRequest=h.DocumentSelector=h.NotebookCellTextDocumentFilter=h.NotebookDocumentFilter=h.TextDocumentFilter=void 0;h.TypeHierarchySubtypesRequest=h.TypeHierarchyPrepareRequest=h.MonikerRequest=h.MonikerKind=h.UniquenessLevel=h.WillDeleteFilesRequest=h.DidDeleteFilesNotification=h.WillRenameFilesRequest=h.DidRenameFilesNotification=h.WillCreateFilesRequest=h.DidCreateFilesNotification=h.FileOperationPatternKind=h.LinkedEditingRangeRequest=h.ShowDocumentRequest=h.SemanticTokensRegistrationType=h.SemanticTokensRefreshRequest=h.SemanticTokensRangeRequest=h.SemanticTokensDeltaRequest=h.SemanticTokensRequest=h.TokenFormat=h.CallHierarchyPrepareRequest=h.CallHierarchyOutgoingCallsRequest=h.CallHierarchyIncomingCallsRequest=h.WorkDoneProgressCancelNotification=h.WorkDoneProgressCreateRequest=h.WorkDoneProgress=h.SelectionRangeRequest=h.DeclarationRequest=h.FoldingRangeRequest=h.ColorPresentationRequest=h.DocumentColorRequest=h.ConfigurationRequest=h.DidChangeWorkspaceFoldersNotification=h.WorkspaceFoldersRequest=h.TypeDefinitionRequest=h.ImplementationRequest=h.ApplyWorkspaceEditRequest=h.ExecuteCommandRequest=h.PrepareRenameRequest=h.RenameRequest=h.PrepareSupportDefaultBehavior=h.DocumentOnTypeFormattingRequest=h.DocumentRangeFormattingRequest=h.DocumentFormattingRequest=h.DocumentLinkResolveRequest=h.DocumentLinkRequest=h.CodeLensRefreshRequest=h.CodeLensResolveRequest=h.CodeLensRequest=h.WorkspaceSymbolResolveRequest=void 0;h.DidCloseNotebookDocumentNotification=h.DidSaveNotebookDocumentNotification=h.DidChangeNotebookDocumentNotification=h.NotebookCellArrayChange=h.DidOpenNotebookDocumentNotification=h.NotebookDocumentSyncRegistrationType=h.NotebookDocument=h.NotebookCell=h.ExecutionSummary=h.NotebookCellKind=h.DiagnosticRefreshRequest=h.WorkspaceDiagnosticRequest=h.DocumentDiagnosticRequest=h.DocumentDiagnosticReportKind=h.DiagnosticServerCancellationData=h.InlayHintRefreshRequest=h.InlayHintResolveRequest=h.InlayHintRequest=h.InlineValueRefreshRequest=h.InlineValueRequest=h.TypeHierarchySupertypesRequest=void 0;var q=it(),Eg=lo(),Ot=Ms(),tk=zy();Object.defineProperty(h,"ImplementationRequest",{enumerable:!0,get:function(){return tk.ImplementationRequest}});var rk=Yy();Object.defineProperty(h,"TypeDefinitionRequest",{enumerable:!0,get:function(){return rk.TypeDefinitionRequest}});var Cg=Xy();Object.defineProperty(h,"WorkspaceFoldersRequest",{enumerable:!0,get:function(){return Cg.WorkspaceFoldersRequest}});Object.defineProperty(h,"DidChangeWorkspaceFoldersNotification",{enumerable:!0,get:function(){return Cg.DidChangeWorkspaceFoldersNotification}});var nk=Zy();Object.defineProperty(h,"ConfigurationRequest",{enumerable:!0,get:function(){return nk.ConfigurationRequest}});var Pg=Qy();Object.defineProperty(h,"DocumentColorRequest",{enumerable:!0,get:function(){return Pg.DocumentColorRequest}});Object.defineProperty(h,"ColorPresentationRequest",{enumerable:!0,get:function(){return Pg.ColorPresentationRequest}});var ik=tg();Object.defineProperty(h,"FoldingRangeRequest",{enumerable:!0,get:function(){return ik.FoldingRangeRequest}});var ok=ng();Object.defineProperty(h,"DeclarationRequest",{enumerable:!0,get:function(){return ok.DeclarationRequest}});var ak=og();Object.defineProperty(h,"SelectionRangeRequest",{enumerable:!0,get:function(){return ak.SelectionRangeRequest}});var nf=ag();Object.defineProperty(h,"WorkDoneProgress",{enumerable:!0,get:function(){return nf.WorkDoneProgress}});Object.defineProperty(h,"WorkDoneProgressCreateRequest",{enumerable:!0,get:function(){return nf.WorkDoneProgressCreateRequest}});Object.defineProperty(h,"WorkDoneProgressCancelNotification",{enumerable:!0,get:function(){return nf.WorkDoneProgressCancelNotification}});var of=sg();Object.defineProperty(h,"CallHierarchyIncomingCallsRequest",{enumerable:!0,get:function(){return of.CallHierarchyIncomingCallsRequest}});Object.defineProperty(h,"CallHierarchyOutgoingCallsRequest",{enumerable:!0,get:function(){return of.CallHierarchyOutgoingCallsRequest}});Object.defineProperty(h,"CallHierarchyPrepareRequest",{enumerable:!0,get:function(){return of.CallHierarchyPrepareRequest}});var go=ug();Object.defineProperty(h,"TokenFormat",{enumerable:!0,get:function(){return go.TokenFormat}});Object.defineProperty(h,"SemanticTokensRequest",{enumerable:!0,get:function(){return go.SemanticTokensRequest}});Object.defineProperty(h,"SemanticTokensDeltaRequest",{enumerable:!0,get:function(){return go.SemanticTokensDeltaRequest}});Object.defineProperty(h,"SemanticTokensRangeRequest",{enumerable:!0,get:function(){return go.SemanticTokensRangeRequest}});Object.defineProperty(h,"SemanticTokensRefreshRequest",{enumerable:!0,get:function(){return go.SemanticTokensRefreshRequest}});Object.defineProperty(h,"SemanticTokensRegistrationType",{enumerable:!0,get:function(){return go.SemanticTokensRegistrationType}});var sk=lg();Object.defineProperty(h,"ShowDocumentRequest",{enumerable:!0,get:function(){return sk.ShowDocumentRequest}});var uk=fg();Object.defineProperty(h,"LinkedEditingRangeRequest",{enumerable:!0,get:function(){return uk.LinkedEditingRangeRequest}});var Ii=pg();Object.defineProperty(h,"FileOperationPatternKind",{enumerable:!0,get:function(){return Ii.FileOperationPatternKind}});Object.defineProperty(h,"DidCreateFilesNotification",{enumerable:!0,get:function(){return Ii.DidCreateFilesNotification}});Object.defineProperty(h,"WillCreateFilesRequest",{enumerable:!0,get:function(){return Ii.WillCreateFilesRequest}});Object.defineProperty(h,"DidRenameFilesNotification",{enumerable:!0,get:function(){return Ii.DidRenameFilesNotification}});Object.defineProperty(h,"WillRenameFilesRequest",{enumerable:!0,get:function(){return Ii.WillRenameFilesRequest}});Object.defineProperty(h,"DidDeleteFilesNotification",{enumerable:!0,get:function(){return Ii.DidDeleteFilesNotification}});Object.defineProperty(h,"WillDeleteFilesRequest",{enumerable:!0,get:function(){return Ii.WillDeleteFilesRequest}});var af=hg();Object.defineProperty(h,"UniquenessLevel",{enumerable:!0,get:function(){return af.UniquenessLevel}});Object.defineProperty(h,"MonikerKind",{enumerable:!0,get:function(){return af.MonikerKind}});Object.defineProperty(h,"MonikerRequest",{enumerable:!0,get:function(){return af.MonikerRequest}});var sf=yg();Object.defineProperty(h,"TypeHierarchyPrepareRequest",{enumerable:!0,get:function(){return sf.TypeHierarchyPrepareRequest}});Object.defineProperty(h,"TypeHierarchySubtypesRequest",{enumerable:!0,get:function(){return sf.TypeHierarchySubtypesRequest}});Object.defineProperty(h,"TypeHierarchySupertypesRequest",{enumerable:!0,get:function(){return sf.TypeHierarchySupertypesRequest}});var kg=gg();Object.defineProperty(h,"InlineValueRequest",{enumerable:!0,get:function(){return kg.InlineValueRequest}});Object.defineProperty(h,"InlineValueRefreshRequest",{enumerable:!0,get:function(){return kg.InlineValueRefreshRequest}});var uf=vg();Object.defineProperty(h,"InlayHintRequest",{enumerable:!0,get:function(){return uf.InlayHintRequest}});Object.defineProperty(h,"InlayHintResolveRequest",{enumerable:!0,get:function(){return uf.InlayHintResolveRequest}});Object.defineProperty(h,"InlayHintRefreshRequest",{enumerable:!0,get:function(){return uf.InlayHintRefreshRequest}});var Aa=Rg();Object.defineProperty(h,"DiagnosticServerCancellationData",{enumerable:!0,get:function(){return Aa.DiagnosticServerCancellationData}});Object.defineProperty(h,"DocumentDiagnosticReportKind",{enumerable:!0,get:function(){return Aa.DocumentDiagnosticReportKind}});Object.defineProperty(h,"DocumentDiagnosticRequest",{enumerable:!0,get:function(){return Aa.DocumentDiagnosticRequest}});Object.defineProperty(h,"WorkspaceDiagnosticRequest",{enumerable:!0,get:function(){return Aa.WorkspaceDiagnosticRequest}});Object.defineProperty(h,"DiagnosticRefreshRequest",{enumerable:!0,get:function(){return Aa.DiagnosticRefreshRequest}});var hn=bg();Object.defineProperty(h,"NotebookCellKind",{enumerable:!0,get:function(){return hn.NotebookCellKind}});Object.defineProperty(h,"ExecutionSummary",{enumerable:!0,get:function(){return hn.ExecutionSummary}});Object.defineProperty(h,"NotebookCell",{enumerable:!0,get:function(){return hn.NotebookCell}});Object.defineProperty(h,"NotebookDocument",{enumerable:!0,get:function(){return hn.NotebookDocument}});Object.defineProperty(h,"NotebookDocumentSyncRegistrationType",{enumerable:!0,get:function(){return hn.NotebookDocumentSyncRegistrationType}});Object.defineProperty(h,"DidOpenNotebookDocumentNotification",{enumerable:!0,get:function(){return hn.DidOpenNotebookDocumentNotification}});Object.defineProperty(h,"NotebookCellArrayChange",{enumerable:!0,get:function(){return hn.NotebookCellArrayChange}});Object.defineProperty(h,"DidChangeNotebookDocumentNotification",{enumerable:!0,get:function(){return hn.DidChangeNotebookDocumentNotification}});Object.defineProperty(h,"DidSaveNotebookDocumentNotification",{enumerable:!0,get:function(){return hn.DidSaveNotebookDocumentNotification}});Object.defineProperty(h,"DidCloseNotebookDocumentNotification",{enumerable:!0,get:function(){return hn.DidCloseNotebookDocumentNotification}});var xg;(function(r){function e(t){let n=t;return Ot.string(n.language)||Ot.string(n.scheme)||Ot.string(n.pattern)}r.is=e})(xg=h.TextDocumentFilter||(h.TextDocumentFilter={}));var Sg;(function(r){function e(t){let n=t;return Ot.objectLiteral(n)&&(Ot.string(n.notebookType)||Ot.string(n.scheme)||Ot.string(n.pattern))}r.is=e})(Sg=h.NotebookDocumentFilter||(h.NotebookDocumentFilter={}));var Ng;(function(r){function e(t){let n=t;return Ot.objectLiteral(n)&&(Ot.string(n.notebook)||Sg.is(n.notebook))&&(n.language===void 0||Ot.string(n.language))}r.is=e})(Ng=h.NotebookCellTextDocumentFilter||(h.NotebookCellTextDocumentFilter={}));var Dg;(function(r){function e(t){if(!Array.isArray(t))return!1;for(let n of t)if(!Ot.string(n)&&!xg.is(n)&&!Ng.is(n))return!1;return!0}r.is=e})(Dg=h.DocumentSelector||(h.DocumentSelector={}));var ck;(function(r){r.method="client/registerCapability",r.messageDirection=q.MessageDirection.serverToClient,r.type=new q.ProtocolRequestType(r.method)})(ck=h.RegistrationRequest||(h.RegistrationRequest={}));var lk;(function(r){r.method="client/unregisterCapability",r.messageDirection=q.MessageDirection.serverToClient,r.type=new q.ProtocolRequestType(r.method)})(lk=h.UnregistrationRequest||(h.UnregistrationRequest={}));var dk;(function(r){r.Create="create",r.Rename="rename",r.Delete="delete"})(dk=h.ResourceOperationKind||(h.ResourceOperationKind={}));var fk;(function(r){r.Abort="abort",r.Transactional="transactional",r.TextOnlyTransactional="textOnlyTransactional",r.Undo="undo"})(fk=h.FailureHandlingKind||(h.FailureHandlingKind={}));var pk;(function(r){r.UTF8="utf-8",r.UTF16="utf-16",r.UTF32="utf-32"})(pk=h.PositionEncodingKind||(h.PositionEncodingKind={}));var mk;(function(r){function e(t){let n=t;return n&&Ot.string(n.id)&&n.id.length>0}r.hasId=e})(mk=h.StaticRegistrationOptions||(h.StaticRegistrationOptions={}));var hk;(function(r){function e(t){let n=t;return n&&(n.documentSelector===null||Dg.is(n.documentSelector))}r.is=e})(hk=h.TextDocumentRegistrationOptions||(h.TextDocumentRegistrationOptions={}));var yk;(function(r){function e(n){let i=n;return Ot.objectLiteral(i)&&(i.workDoneProgress===void 0||Ot.boolean(i.workDoneProgress))}r.is=e;function t(n){let i=n;return i&&Ot.boolean(i.workDoneProgress)}r.hasWorkDoneProgress=t})(yk=h.WorkDoneProgressOptions||(h.WorkDoneProgressOptions={}));var gk;(function(r){r.method="initialize",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(gk=h.InitializeRequest||(h.InitializeRequest={}));var vk;(function(r){r.unknownProtocolVersion=1})(vk=h.InitializeErrorCodes||(h.InitializeErrorCodes={}));var Tk;(function(r){r.method="initialized",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolNotificationType(r.method)})(Tk=h.InitializedNotification||(h.InitializedNotification={}));var Rk;(function(r){r.method="shutdown",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType0(r.method)})(Rk=h.ShutdownRequest||(h.ShutdownRequest={}));var _k;(function(r){r.method="exit",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolNotificationType0(r.method)})(_k=h.ExitNotification||(h.ExitNotification={}));var Ak;(function(r){r.method="workspace/didChangeConfiguration",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolNotificationType(r.method)})(Ak=h.DidChangeConfigurationNotification||(h.DidChangeConfigurationNotification={}));var bk;(function(r){r.Error=1,r.Warning=2,r.Info=3,r.Log=4})(bk=h.MessageType||(h.MessageType={}));var Ek;(function(r){r.method="window/showMessage",r.messageDirection=q.MessageDirection.serverToClient,r.type=new q.ProtocolNotificationType(r.method)})(Ek=h.ShowMessageNotification||(h.ShowMessageNotification={}));var Ck;(function(r){r.method="window/showMessageRequest",r.messageDirection=q.MessageDirection.serverToClient,r.type=new q.ProtocolRequestType(r.method)})(Ck=h.ShowMessageRequest||(h.ShowMessageRequest={}));var Pk;(function(r){r.method="window/logMessage",r.messageDirection=q.MessageDirection.serverToClient,r.type=new q.ProtocolNotificationType(r.method)})(Pk=h.LogMessageNotification||(h.LogMessageNotification={}));var kk;(function(r){r.method="telemetry/event",r.messageDirection=q.MessageDirection.serverToClient,r.type=new q.ProtocolNotificationType(r.method)})(kk=h.TelemetryEventNotification||(h.TelemetryEventNotification={}));var xk;(function(r){r.None=0,r.Full=1,r.Incremental=2})(xk=h.TextDocumentSyncKind||(h.TextDocumentSyncKind={}));var Sk;(function(r){r.method="textDocument/didOpen",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolNotificationType(r.method)})(Sk=h.DidOpenTextDocumentNotification||(h.DidOpenTextDocumentNotification={}));var Nk;(function(r){function e(n){let i=n;return i!=null&&typeof i.text=="string"&&i.range!==void 0&&(i.rangeLength===void 0||typeof i.rangeLength=="number")}r.isIncremental=e;function t(n){let i=n;return i!=null&&typeof i.text=="string"&&i.range===void 0&&i.rangeLength===void 0}r.isFull=t})(Nk=h.TextDocumentContentChangeEvent||(h.TextDocumentContentChangeEvent={}));var Dk;(function(r){r.method="textDocument/didChange",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolNotificationType(r.method)})(Dk=h.DidChangeTextDocumentNotification||(h.DidChangeTextDocumentNotification={}));var wk;(function(r){r.method="textDocument/didClose",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolNotificationType(r.method)})(wk=h.DidCloseTextDocumentNotification||(h.DidCloseTextDocumentNotification={}));var Ik;(function(r){r.method="textDocument/didSave",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolNotificationType(r.method)})(Ik=h.DidSaveTextDocumentNotification||(h.DidSaveTextDocumentNotification={}));var Ok;(function(r){r.Manual=1,r.AfterDelay=2,r.FocusOut=3})(Ok=h.TextDocumentSaveReason||(h.TextDocumentSaveReason={}));var $k;(function(r){r.method="textDocument/willSave",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolNotificationType(r.method)})($k=h.WillSaveTextDocumentNotification||(h.WillSaveTextDocumentNotification={}));var Mk;(function(r){r.method="textDocument/willSaveWaitUntil",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(Mk=h.WillSaveTextDocumentWaitUntilRequest||(h.WillSaveTextDocumentWaitUntilRequest={}));var Lk;(function(r){r.method="workspace/didChangeWatchedFiles",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolNotificationType(r.method)})(Lk=h.DidChangeWatchedFilesNotification||(h.DidChangeWatchedFilesNotification={}));var Fk;(function(r){r.Created=1,r.Changed=2,r.Deleted=3})(Fk=h.FileChangeType||(h.FileChangeType={}));var qk;(function(r){function e(t){let n=t;return Ot.objectLiteral(n)&&(Eg.URI.is(n.baseUri)||Eg.WorkspaceFolder.is(n.baseUri))&&Ot.string(n.pattern)}r.is=e})(qk=h.RelativePattern||(h.RelativePattern={}));var jk;(function(r){r.Create=1,r.Change=2,r.Delete=4})(jk=h.WatchKind||(h.WatchKind={}));var Gk;(function(r){r.method="textDocument/publishDiagnostics",r.messageDirection=q.MessageDirection.serverToClient,r.type=new q.ProtocolNotificationType(r.method)})(Gk=h.PublishDiagnosticsNotification||(h.PublishDiagnosticsNotification={}));var Uk;(function(r){r.Invoked=1,r.TriggerCharacter=2,r.TriggerForIncompleteCompletions=3})(Uk=h.CompletionTriggerKind||(h.CompletionTriggerKind={}));var Hk;(function(r){r.method="textDocument/completion",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(Hk=h.CompletionRequest||(h.CompletionRequest={}));var Wk;(function(r){r.method="completionItem/resolve",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(Wk=h.CompletionResolveRequest||(h.CompletionResolveRequest={}));var Kk;(function(r){r.method="textDocument/hover",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(Kk=h.HoverRequest||(h.HoverRequest={}));var Bk;(function(r){r.Invoked=1,r.TriggerCharacter=2,r.ContentChange=3})(Bk=h.SignatureHelpTriggerKind||(h.SignatureHelpTriggerKind={}));var zk;(function(r){r.method="textDocument/signatureHelp",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(zk=h.SignatureHelpRequest||(h.SignatureHelpRequest={}));var Vk;(function(r){r.method="textDocument/definition",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(Vk=h.DefinitionRequest||(h.DefinitionRequest={}));var Yk;(function(r){r.method="textDocument/references",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(Yk=h.ReferencesRequest||(h.ReferencesRequest={}));var Xk;(function(r){r.method="textDocument/documentHighlight",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(Xk=h.DocumentHighlightRequest||(h.DocumentHighlightRequest={}));var Jk;(function(r){r.method="textDocument/documentSymbol",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(Jk=h.DocumentSymbolRequest||(h.DocumentSymbolRequest={}));var Zk;(function(r){r.method="textDocument/codeAction",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(Zk=h.CodeActionRequest||(h.CodeActionRequest={}));var Qk;(function(r){r.method="codeAction/resolve",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(Qk=h.CodeActionResolveRequest||(h.CodeActionResolveRequest={}));var e0;(function(r){r.method="workspace/symbol",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(e0=h.WorkspaceSymbolRequest||(h.WorkspaceSymbolRequest={}));var t0;(function(r){r.method="workspaceSymbol/resolve",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(t0=h.WorkspaceSymbolResolveRequest||(h.WorkspaceSymbolResolveRequest={}));var r0;(function(r){r.method="textDocument/codeLens",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(r0=h.CodeLensRequest||(h.CodeLensRequest={}));var n0;(function(r){r.method="codeLens/resolve",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(n0=h.CodeLensResolveRequest||(h.CodeLensResolveRequest={}));var i0;(function(r){r.method="workspace/codeLens/refresh",r.messageDirection=q.MessageDirection.serverToClient,r.type=new q.ProtocolRequestType0(r.method)})(i0=h.CodeLensRefreshRequest||(h.CodeLensRefreshRequest={}));var o0;(function(r){r.method="textDocument/documentLink",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(o0=h.DocumentLinkRequest||(h.DocumentLinkRequest={}));var a0;(function(r){r.method="documentLink/resolve",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(a0=h.DocumentLinkResolveRequest||(h.DocumentLinkResolveRequest={}));var s0;(function(r){r.method="textDocument/formatting",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(s0=h.DocumentFormattingRequest||(h.DocumentFormattingRequest={}));var u0;(function(r){r.method="textDocument/rangeFormatting",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(u0=h.DocumentRangeFormattingRequest||(h.DocumentRangeFormattingRequest={}));var c0;(function(r){r.method="textDocument/onTypeFormatting",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(c0=h.DocumentOnTypeFormattingRequest||(h.DocumentOnTypeFormattingRequest={}));var l0;(function(r){r.Identifier=1})(l0=h.PrepareSupportDefaultBehavior||(h.PrepareSupportDefaultBehavior={}));var d0;(function(r){r.method="textDocument/rename",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(d0=h.RenameRequest||(h.RenameRequest={}));var f0;(function(r){r.method="textDocument/prepareRename",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(f0=h.PrepareRenameRequest||(h.PrepareRenameRequest={}));var p0;(function(r){r.method="workspace/executeCommand",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(p0=h.ExecuteCommandRequest||(h.ExecuteCommandRequest={}));var m0;(function(r){r.method="workspace/applyEdit",r.messageDirection=q.MessageDirection.serverToClient,r.type=new q.ProtocolRequestType("workspace/applyEdit")})(m0=h.ApplyWorkspaceEditRequest||(h.ApplyWorkspaceEditRequest={}))});var Og=C(Us=>{"use strict";Object.defineProperty(Us,"__esModule",{value:!0});Us.createProtocolConnection=void 0;var Ig=pn();function h0(r,e,t,n){return Ig.ConnectionStrategy.is(n)&&(n={connectionStrategy:n}),(0,Ig.createMessageConnection)(r,e,t,n)}Us.createProtocolConnection=h0});var $g=C(rr=>{"use strict";var y0=rr&&rr.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),Hs=rr&&rr.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&y0(e,r,t)};Object.defineProperty(rr,"__esModule",{value:!0});rr.LSPErrorCodes=rr.createProtocolConnection=void 0;Hs(pn(),rr);Hs(lo(),rr);Hs(it(),rr);Hs(wg(),rr);var g0=Og();Object.defineProperty(rr,"createProtocolConnection",{enumerable:!0,get:function(){return g0.createProtocolConnection}});var v0;(function(r){r.lspReservedErrorRangeStart=-32899,r.RequestFailed=-32803,r.ServerCancelled=-32802,r.ContentModified=-32801,r.RequestCancelled=-32800,r.lspReservedErrorRangeEnd=-32800})(v0=rr.LSPErrorCodes||(rr.LSPErrorCodes={}))});var Tt=C(yn=>{"use strict";var T0=yn&&yn.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),Mg=yn&&yn.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&T0(e,r,t)};Object.defineProperty(yn,"__esModule",{value:!0});yn.createProtocolConnection=void 0;var R0=Xd();Mg(Xd(),yn);Mg($g(),yn);function _0(r,e,t,n){return(0,R0.createMessageConnection)(r,e,t,n)}yn.createProtocolConnection=_0});var cf=C(Er=>{"use strict";Object.defineProperty(Er,"__esModule",{value:!0});Er.generateUuid=Er.parse=Er.isUUID=Er.v4=Er.empty=void 0;var ba=class{constructor(e){this._value=e}asHex(){return this._value}equals(e){return this.asHex()===e.asHex()}},ne=class extends ba{constructor(){super([ne._randomHex(),ne._randomHex(),ne._randomHex(),ne._randomHex(),ne._randomHex(),ne._randomHex(),ne._randomHex(),ne._randomHex(),"-",ne._randomHex(),ne._randomHex(),ne._randomHex(),ne._randomHex(),"-","4",ne._randomHex(),ne._randomHex(),ne._randomHex(),"-",ne._oneOf(ne._timeHighBits),ne._randomHex(),ne._randomHex(),ne._randomHex(),"-",ne._randomHex(),ne._randomHex(),ne._randomHex(),ne._randomHex(),ne._randomHex(),ne._randomHex(),ne._randomHex(),ne._randomHex(),ne._randomHex(),ne._randomHex(),ne._randomHex(),ne._randomHex()].join(""))}static _oneOf(e){return e[Math.floor(e.length*Math.random())]}static _randomHex(){return ne._oneOf(ne._chars)}};ne._chars=["0","1","2","3","4","5","6","6","7","8","9","a","b","c","d","e","f"];ne._timeHighBits=["8","9","a","b"];Er.empty=new ba("00000000-0000-0000-0000-000000000000");function Lg(){return new ne}Er.v4=Lg;var A0=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Fg(r){return A0.test(r)}Er.isUUID=Fg;function b0(r){if(!Fg(r))throw new Error("invalid uuid");return new ba(r)}Er.parse=b0;function E0(){return Lg().asHex()}Er.generateUuid=E0});var qg=C(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:!0});ui.attachPartialResult=ui.ProgressFeature=ui.attachWorkDone=void 0;var si=Tt(),C0=cf(),gn=class{constructor(e,t){this._connection=e,this._token=t,gn.Instances.set(this._token,this)}begin(e,t,n,i){let o={kind:"begin",title:e,percentage:t,message:n,cancellable:i};this._connection.sendProgress(si.WorkDoneProgress.type,this._token,o)}report(e,t){let n={kind:"report"};typeof e=="number"?(n.percentage=e,t!==void 0&&(n.message=t)):n.message=e,this._connection.sendProgress(si.WorkDoneProgress.type,this._token,n)}done(){gn.Instances.delete(this._token),this._connection.sendProgress(si.WorkDoneProgress.type,this._token,{kind:"end"})}};gn.Instances=new Map;var Ws=class extends gn{constructor(e,t){super(e,t),this._source=new si.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose(),super.done()}cancel(){this._source.cancel()}},Ea=class{constructor(){}begin(){}report(){}done(){}},Ks=class extends Ea{constructor(){super(),this._source=new si.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose()}cancel(){this._source.cancel()}};function P0(r,e){if(e===void 0||e.workDoneToken===void 0)return new Ea;let t=e.workDoneToken;return delete e.workDoneToken,new gn(r,t)}ui.attachWorkDone=P0;var k0=r=>class extends r{constructor(){super(),this._progressSupported=!1}initialize(e){super.initialize(e),e?.window?.workDoneProgress===!0&&(this._progressSupported=!0,this.connection.onNotification(si.WorkDoneProgressCancelNotification.type,t=>{let n=gn.Instances.get(t.token);(n instanceof Ws||n instanceof Ks)&&n.cancel()}))}attachWorkDoneProgress(e){return e===void 0?new Ea:new gn(this.connection,e)}createWorkDoneProgress(){if(this._progressSupported){let e=(0,C0.generateUuid)();return this.connection.sendRequest(si.WorkDoneProgressCreateRequest.type,{token:e}).then(()=>new Ws(this.connection,e))}else return Promise.resolve(new Ks)}};ui.ProgressFeature=k0;var lf;(function(r){r.type=new si.ProgressType})(lf||(lf={}));var df=class{constructor(e,t){this._connection=e,this._token=t}report(e){this._connection.sendProgress(lf.type,this._token,e)}};function x0(r,e){if(e===void 0||e.partialResultToken===void 0)return;let t=e.partialResultToken;return delete e.partialResultToken,new df(r,t)}ui.attachPartialResult=x0});var jg=C(Bs=>{"use strict";Object.defineProperty(Bs,"__esModule",{value:!0});Bs.ConfigurationFeature=void 0;var S0=Tt(),N0=Es(),D0=r=>class extends r{getConfiguration(e){return e?N0.string(e)?this._getConfiguration({section:e}):this._getConfiguration(e):this._getConfiguration({})}_getConfiguration(e){let t={items:Array.isArray(e)?e:[e]};return this.connection.sendRequest(S0.ConfigurationRequest.type,t).then(n=>Array.isArray(n)?Array.isArray(e)?n:n[0]:Array.isArray(e)?[]:null)}};Bs.ConfigurationFeature=D0});var Gg=C(Vs=>{"use strict";Object.defineProperty(Vs,"__esModule",{value:!0});Vs.WorkspaceFoldersFeature=void 0;var zs=Tt(),w0=r=>class extends r{constructor(){super(),this._notificationIsAutoRegistered=!1}initialize(e){super.initialize(e);let t=e.workspace;t&&t.workspaceFolders&&(this._onDidChangeWorkspaceFolders=new zs.Emitter,this.connection.onNotification(zs.DidChangeWorkspaceFoldersNotification.type,n=>{this._onDidChangeWorkspaceFolders.fire(n.event)}))}fillServerCapabilities(e){super.fillServerCapabilities(e);let t=e.workspace?.workspaceFolders?.changeNotifications;this._notificationIsAutoRegistered=t===!0||typeof t=="string"}getWorkspaceFolders(){return this.connection.sendRequest(zs.WorkspaceFoldersRequest.type)}get onDidChangeWorkspaceFolders(){if(!this._onDidChangeWorkspaceFolders)throw new Error("Client doesn't support sending workspace folder change events.");return!this._notificationIsAutoRegistered&&!this._unregistration&&(this._unregistration=this.connection.client.register(zs.DidChangeWorkspaceFoldersNotification.type)),this._onDidChangeWorkspaceFolders.event}};Vs.WorkspaceFoldersFeature=w0});var Ug=C(Ys=>{"use strict";Object.defineProperty(Ys,"__esModule",{value:!0});Ys.CallHierarchyFeature=void 0;var ff=Tt(),I0=r=>class extends r{get callHierarchy(){return{onPrepare:e=>this.connection.onRequest(ff.CallHierarchyPrepareRequest.type,(t,n)=>e(t,n,this.attachWorkDoneProgress(t),void 0)),onIncomingCalls:e=>{let t=ff.CallHierarchyIncomingCallsRequest.type;return this.connection.onRequest(t,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(t,n)))},onOutgoingCalls:e=>{let t=ff.CallHierarchyOutgoingCallsRequest.type;return this.connection.onRequest(t,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(t,n)))}}}};Ys.CallHierarchyFeature=I0});var mf=C(ci=>{"use strict";Object.defineProperty(ci,"__esModule",{value:!0});ci.SemanticTokensBuilder=ci.SemanticTokensDiff=ci.SemanticTokensFeature=void 0;var Xs=Tt(),O0=r=>class extends r{get semanticTokens(){return{refresh:()=>this.connection.sendRequest(Xs.SemanticTokensRefreshRequest.type),on:e=>{let t=Xs.SemanticTokensRequest.type;return this.connection.onRequest(t,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(t,n)))},onDelta:e=>{let t=Xs.SemanticTokensDeltaRequest.type;return this.connection.onRequest(t,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(t,n)))},onRange:e=>{let t=Xs.SemanticTokensRangeRequest.type;return this.connection.onRequest(t,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(t,n)))}}}};ci.SemanticTokensFeature=O0;var Js=class{constructor(e,t){this.originalSequence=e,this.modifiedSequence=t}computeDiff(){let e=this.originalSequence.length,t=this.modifiedSequence.length,n=0;for(;n<t&&n<e&&this.originalSequence[n]===this.modifiedSequence[n];)n++;if(n<t&&n<e){let i=e-1,o=t-1;for(;i>=n&&o>=n&&this.originalSequence[i]===this.modifiedSequence[o];)i--,o--;(i<n||o<n)&&(i++,o++);let a=i-n+1,s=this.modifiedSequence.slice(n,o+1);return s.length===1&&s[0]===this.originalSequence[i]?[{start:n,deleteCount:a-1}]:[{start:n,deleteCount:a,data:s}]}else return n<t?[{start:n,deleteCount:0,data:this.modifiedSequence.slice(n)}]:n<e?[{start:n,deleteCount:e-n}]:[]}};ci.SemanticTokensDiff=Js;var pf=class{constructor(){this._prevData=void 0,this.initialize()}initialize(){this._id=Date.now(),this._prevLine=0,this._prevChar=0,this._data=[],this._dataLen=0}push(e,t,n,i,o){let a=e,s=t;this._dataLen>0&&(a-=this._prevLine,a===0&&(s-=this._prevChar)),this._data[this._dataLen++]=a,this._data[this._dataLen++]=s,this._data[this._dataLen++]=n,this._data[this._dataLen++]=i,this._data[this._dataLen++]=o,this._prevLine=e,this._prevChar=t}get id(){return this._id.toString()}previousResult(e){this.id===e&&(this._prevData=this._data),this.initialize()}build(){return this._prevData=void 0,{resultId:this.id,data:this._data}}canBuildEdits(){return this._prevData!==void 0}buildEdits(){return this._prevData!==void 0?{resultId:this.id,edits:new Js(this._prevData,this._data).computeDiff()}:this.build()}};ci.SemanticTokensBuilder=pf});var Hg=C(Zs=>{"use strict";Object.defineProperty(Zs,"__esModule",{value:!0});Zs.ShowDocumentFeature=void 0;var $0=Tt(),M0=r=>class extends r{showDocument(e){return this.connection.sendRequest($0.ShowDocumentRequest.type,e)}};Zs.ShowDocumentFeature=M0});var Wg=C(Qs=>{"use strict";Object.defineProperty(Qs,"__esModule",{value:!0});Qs.FileOperationsFeature=void 0;var vo=Tt(),L0=r=>class extends r{onDidCreateFiles(e){return this.connection.onNotification(vo.DidCreateFilesNotification.type,t=>{e(t)})}onDidRenameFiles(e){return this.connection.onNotification(vo.DidRenameFilesNotification.type,t=>{e(t)})}onDidDeleteFiles(e){return this.connection.onNotification(vo.DidDeleteFilesNotification.type,t=>{e(t)})}onWillCreateFiles(e){return this.connection.onRequest(vo.WillCreateFilesRequest.type,(t,n)=>e(t,n))}onWillRenameFiles(e){return this.connection.onRequest(vo.WillRenameFilesRequest.type,(t,n)=>e(t,n))}onWillDeleteFiles(e){return this.connection.onRequest(vo.WillDeleteFilesRequest.type,(t,n)=>e(t,n))}};Qs.FileOperationsFeature=L0});var Kg=C(eu=>{"use strict";Object.defineProperty(eu,"__esModule",{value:!0});eu.LinkedEditingRangeFeature=void 0;var F0=Tt(),q0=r=>class extends r{onLinkedEditingRange(e){return this.connection.onRequest(F0.LinkedEditingRangeRequest.type,(t,n)=>e(t,n,this.attachWorkDoneProgress(t),void 0))}};eu.LinkedEditingRangeFeature=q0});var Bg=C(tu=>{"use strict";Object.defineProperty(tu,"__esModule",{value:!0});tu.TypeHierarchyFeature=void 0;var hf=Tt(),j0=r=>class extends r{get typeHierarchy(){return{onPrepare:e=>this.connection.onRequest(hf.TypeHierarchyPrepareRequest.type,(t,n)=>e(t,n,this.attachWorkDoneProgress(t),void 0)),onSupertypes:e=>{let t=hf.TypeHierarchySupertypesRequest.type;return this.connection.onRequest(t,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(t,n)))},onSubtypes:e=>{let t=hf.TypeHierarchySubtypesRequest.type;return this.connection.onRequest(t,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(t,n)))}}}};tu.TypeHierarchyFeature=j0});var Vg=C(ru=>{"use strict";Object.defineProperty(ru,"__esModule",{value:!0});ru.InlineValueFeature=void 0;var zg=Tt(),G0=r=>class extends r{get inlineValue(){return{refresh:()=>this.connection.sendRequest(zg.InlineValueRefreshRequest.type),on:e=>this.connection.onRequest(zg.InlineValueRequest.type,(t,n)=>e(t,n,this.attachWorkDoneProgress(t)))}}};ru.InlineValueFeature=G0});var Yg=C(nu=>{"use strict";Object.defineProperty(nu,"__esModule",{value:!0});nu.InlayHintFeature=void 0;var yf=Tt(),U0=r=>class extends r{get inlayHint(){return{refresh:()=>this.connection.sendRequest(yf.InlayHintRefreshRequest.type),on:e=>this.connection.onRequest(yf.InlayHintRequest.type,(t,n)=>e(t,n,this.attachWorkDoneProgress(t))),resolve:e=>this.connection.onRequest(yf.InlayHintResolveRequest.type,(t,n)=>e(t,n))}}};nu.InlayHintFeature=U0});var Xg=C(iu=>{"use strict";Object.defineProperty(iu,"__esModule",{value:!0});iu.DiagnosticFeature=void 0;var Ca=Tt(),H0=r=>class extends r{get diagnostics(){return{refresh:()=>this.connection.sendRequest(Ca.DiagnosticRefreshRequest.type),on:e=>this.connection.onRequest(Ca.DocumentDiagnosticRequest.type,(t,n)=>e(t,n,this.attachWorkDoneProgress(t),this.attachPartialResultProgress(Ca.DocumentDiagnosticRequest.partialResult,t))),onWorkspace:e=>this.connection.onRequest(Ca.WorkspaceDiagnosticRequest.type,(t,n)=>e(t,n,this.attachWorkDoneProgress(t),this.attachPartialResultProgress(Ca.WorkspaceDiagnosticRequest.partialResult,t)))}}};iu.DiagnosticFeature=H0});var vf=C(ou=>{"use strict";Object.defineProperty(ou,"__esModule",{value:!0});ou.TextDocuments=void 0;var Oi=Tt(),gf=class{constructor(e){this._configuration=e,this._syncedDocuments=new Map,this._onDidChangeContent=new Oi.Emitter,this._onDidOpen=new Oi.Emitter,this._onDidClose=new Oi.Emitter,this._onDidSave=new Oi.Emitter,this._onWillSave=new Oi.Emitter}get onDidOpen(){return this._onDidOpen.event}get onDidChangeContent(){return this._onDidChangeContent.event}get onWillSave(){return this._onWillSave.event}onWillSaveWaitUntil(e){this._willSaveWaitUntil=e}get onDidSave(){return this._onDidSave.event}get onDidClose(){return this._onDidClose.event}get(e){return this._syncedDocuments.get(e)}all(){return Array.from(this._syncedDocuments.values())}keys(){return Array.from(this._syncedDocuments.keys())}listen(e){e.__textDocumentSync=Oi.TextDocumentSyncKind.Incremental;let t=[];return t.push(e.onDidOpenTextDocument(n=>{let i=n.textDocument,o=this._configuration.create(i.uri,i.languageId,i.version,i.text);this._syncedDocuments.set(i.uri,o);let a=Object.freeze({document:o});this._onDidOpen.fire(a),this._onDidChangeContent.fire(a)})),t.push(e.onDidChangeTextDocument(n=>{let i=n.textDocument,o=n.contentChanges;if(o.length===0)return;let{version:a}=i;if(a==null)throw new Error(`Received document change event for ${i.uri} without valid version identifier`);let s=this._syncedDocuments.get(i.uri);s!==void 0&&(s=this._configuration.update(s,o,a),this._syncedDocuments.set(i.uri,s),this._onDidChangeContent.fire(Object.freeze({document:s})))})),t.push(e.onDidCloseTextDocument(n=>{let i=this._syncedDocuments.get(n.textDocument.uri);i!==void 0&&(this._syncedDocuments.delete(n.textDocument.uri),this._onDidClose.fire(Object.freeze({document:i})))})),t.push(e.onWillSaveTextDocument(n=>{let i=this._syncedDocuments.get(n.textDocument.uri);i!==void 0&&this._onWillSave.fire(Object.freeze({document:i,reason:n.reason}))})),t.push(e.onWillSaveTextDocumentWaitUntil((n,i)=>{let o=this._syncedDocuments.get(n.textDocument.uri);return o!==void 0&&this._willSaveWaitUntil?this._willSaveWaitUntil(Object.freeze({document:o,reason:n.reason}),i):[]})),t.push(e.onDidSaveTextDocument(n=>{let i=this._syncedDocuments.get(n.textDocument.uri);i!==void 0&&this._onDidSave.fire(Object.freeze({document:i}))})),Oi.Disposable.create(()=>{t.forEach(n=>n.dispose())})}};ou.TextDocuments=gf});var Rf=C(To=>{"use strict";Object.defineProperty(To,"__esModule",{value:!0});To.NotebookDocuments=To.NotebookSyncFeature=void 0;var Cr=Tt(),Jg=vf(),W0=r=>class extends r{get synchronization(){return{onDidOpenNotebookDocument:e=>this.connection.onNotification(Cr.DidOpenNotebookDocumentNotification.type,t=>{e(t)}),onDidChangeNotebookDocument:e=>this.connection.onNotification(Cr.DidChangeNotebookDocumentNotification.type,t=>{e(t)}),onDidSaveNotebookDocument:e=>this.connection.onNotification(Cr.DidSaveNotebookDocumentNotification.type,t=>{e(t)}),onDidCloseNotebookDocument:e=>this.connection.onNotification(Cr.DidCloseNotebookDocumentNotification.type,t=>{e(t)})}}};To.NotebookSyncFeature=W0;var li=class{onDidOpenTextDocument(e){return this.openHandler=e,Cr.Disposable.create(()=>{this.openHandler=void 0})}openTextDocument(e){this.openHandler&&this.openHandler(e)}onDidChangeTextDocument(e){return this.changeHandler=e,Cr.Disposable.create(()=>{this.changeHandler=e})}changeTextDocument(e){this.changeHandler&&this.changeHandler(e)}onDidCloseTextDocument(e){return this.closeHandler=e,Cr.Disposable.create(()=>{this.closeHandler=void 0})}closeTextDocument(e){this.closeHandler&&this.closeHandler(e)}onWillSaveTextDocument(){return li.NULL_DISPOSE}onWillSaveTextDocumentWaitUntil(){return li.NULL_DISPOSE}onDidSaveTextDocument(){return li.NULL_DISPOSE}};li.NULL_DISPOSE=Object.freeze({dispose:()=>{}});var Tf=class{constructor(e){e instanceof Jg.TextDocuments?this._cellTextDocuments=e:this._cellTextDocuments=new Jg.TextDocuments(e),this.notebookDocuments=new Map,this.notebookCellMap=new Map,this._onDidOpen=new Cr.Emitter,this._onDidChange=new Cr.Emitter,this._onDidSave=new Cr.Emitter,this._onDidClose=new Cr.Emitter}get cellTextDocuments(){return this._cellTextDocuments}getCellTextDocument(e){return this._cellTextDocuments.get(e.document)}getNotebookDocument(e){return this.notebookDocuments.get(e)}getNotebookCell(e){let t=this.notebookCellMap.get(e);return t&&t[0]}findNotebookDocumentForCell(e){let t=typeof e=="string"?e:e.document,n=this.notebookCellMap.get(t);return n&&n[1]}get onDidOpen(){return this._onDidOpen.event}get onDidSave(){return this._onDidSave.event}get onDidChange(){return this._onDidChange.event}get onDidClose(){return this._onDidClose.event}listen(e){let t=new li,n=[];return n.push(this.cellTextDocuments.listen(t)),n.push(e.notebooks.synchronization.onDidOpenNotebookDocument(i=>{this.notebookDocuments.set(i.notebookDocument.uri,i.notebookDocument);for(let o of i.cellTextDocuments)t.openTextDocument({textDocument:o});this.updateCellMap(i.notebookDocument),this._onDidOpen.fire(i.notebookDocument)})),n.push(e.notebooks.synchronization.onDidChangeNotebookDocument(i=>{let o=this.notebookDocuments.get(i.notebookDocument.uri);if(o===void 0)return;o.version=i.notebookDocument.version;let a=o.metadata,s=!1,u=i.change;u.metadata!==void 0&&(s=!0,o.metadata=u.metadata);let c=[],l=[],d=[],g=[];if(u.cells!==void 0){let k=u.cells;if(k.structure!==void 0){let _=k.structure.array;if(o.cells.splice(_.start,_.deleteCount,..._.cells!==void 0?_.cells:[]),k.structure.didOpen!==void 0)for(let R of k.structure.didOpen)t.openTextDocument({textDocument:R}),c.push(R.uri);if(k.structure.didClose)for(let R of k.structure.didClose)t.closeTextDocument({textDocument:R}),l.push(R.uri)}if(k.data!==void 0){let _=new Map(k.data.map(R=>[R.document,R]));for(let R=0;R<=o.cells.length;R++){let D=_.get(o.cells[R].document);if(D!==void 0){let B=o.cells.splice(R,1,D);if(d.push({old:B[0],new:D}),_.delete(D.document),_.size===0)break}}}if(k.textContent!==void 0)for(let _ of k.textContent)t.changeTextDocument({textDocument:_.document,contentChanges:_.changes}),g.push(_.document.uri)}this.updateCellMap(o);let y={notebookDocument:o};s&&(y.metadata={old:a,new:o.metadata});let p=[];for(let k of c)p.push(this.getNotebookCell(k));let A=[];for(let k of l)A.push(this.getNotebookCell(k));let x=[];for(let k of g)x.push(this.getNotebookCell(k));(p.length>0||A.length>0||d.length>0||x.length>0)&&(y.cells={added:p,removed:A,changed:{data:d,textContent:x}}),(y.metadata!==void 0||y.cells!==void 0)&&this._onDidChange.fire(y)})),n.push(e.notebooks.synchronization.onDidSaveNotebookDocument(i=>{let o=this.notebookDocuments.get(i.notebookDocument.uri);o!==void 0&&this._onDidSave.fire(o)})),n.push(e.notebooks.synchronization.onDidCloseNotebookDocument(i=>{let o=this.notebookDocuments.get(i.notebookDocument.uri);if(o!==void 0){this._onDidClose.fire(o);for(let a of i.cellTextDocuments)t.closeTextDocument({textDocument:a});this.notebookDocuments.delete(i.notebookDocument.uri);for(let a of o.cells)this.notebookCellMap.delete(a.document)}})),Cr.Disposable.create(()=>{n.forEach(i=>i.dispose())})}updateCellMap(e){for(let t of e.cells)this.notebookCellMap.set(t.document,[t,e])}};To.NotebookDocuments=Tf});var Zg=C(au=>{"use strict";Object.defineProperty(au,"__esModule",{value:!0});au.MonikerFeature=void 0;var K0=Tt(),B0=r=>class extends r{get moniker(){return{on:e=>{let t=K0.MonikerRequest.type;return this.connection.onRequest(t,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(t,n)))}}}};au.MonikerFeature=B0});var Pf=C(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.createConnection=me.combineFeatures=me.combineNotebooksFeatures=me.combineLanguagesFeatures=me.combineWorkspaceFeatures=me.combineWindowFeatures=me.combineClientFeatures=me.combineTracerFeatures=me.combineTelemetryFeatures=me.combineConsoleFeatures=me._NotebooksImpl=me._LanguagesImpl=me.BulkUnregistration=me.BulkRegistration=me.ErrorMessageTracker=void 0;var U=Tt(),Pr=Es(),Af=cf(),te=qg(),z0=jg(),V0=Gg(),Y0=Ug(),X0=mf(),J0=Hg(),Z0=Wg(),Q0=Kg(),ex=Bg(),tx=Vg(),rx=Yg(),nx=Xg(),ix=Rf(),ox=Zg();function _f(r){if(r!==null)return r}var bf=class{constructor(){this._messages=Object.create(null)}add(e){let t=this._messages[e];t||(t=0),t++,this._messages[e]=t}sendErrors(e){Object.keys(this._messages).forEach(t=>{e.window.showErrorMessage(t)})}};me.ErrorMessageTracker=bf;var su=class{constructor(){}rawAttach(e){this._rawConnection=e}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}fillServerCapabilities(e){}initialize(e){}error(e){this.send(U.MessageType.Error,e)}warn(e){this.send(U.MessageType.Warning,e)}info(e){this.send(U.MessageType.Info,e)}log(e){this.send(U.MessageType.Log,e)}send(e,t){this._rawConnection&&this._rawConnection.sendNotification(U.LogMessageNotification.type,{type:e,message:t}).catch(()=>{(0,U.RAL)().console.error("Sending log message failed")})}},Ef=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}showErrorMessage(e,...t){let n={type:U.MessageType.Error,message:e,actions:t};return this.connection.sendRequest(U.ShowMessageRequest.type,n).then(_f)}showWarningMessage(e,...t){let n={type:U.MessageType.Warning,message:e,actions:t};return this.connection.sendRequest(U.ShowMessageRequest.type,n).then(_f)}showInformationMessage(e,...t){let n={type:U.MessageType.Info,message:e,actions:t};return this.connection.sendRequest(U.ShowMessageRequest.type,n).then(_f)}},Qg=(0,J0.ShowDocumentFeature)((0,te.ProgressFeature)(Ef)),ax;(function(r){function e(){return new uu}r.create=e})(ax=me.BulkRegistration||(me.BulkRegistration={}));var uu=class{constructor(){this._registrations=[],this._registered=new Set}add(e,t){let n=Pr.string(e)?e:e.method;if(this._registered.has(n))throw new Error(`${n} is already added to this registration`);let i=Af.generateUuid();this._registrations.push({id:i,method:n,registerOptions:t||{}}),this._registered.add(n)}asRegistrationParams(){return{registrations:this._registrations}}},sx;(function(r){function e(){return new Pa(void 0,[])}r.create=e})(sx=me.BulkUnregistration||(me.BulkUnregistration={}));var Pa=class{constructor(e,t){this._connection=e,this._unregistrations=new Map,t.forEach(n=>{this._unregistrations.set(n.method,n)})}get isAttached(){return!!this._connection}attach(e){this._connection=e}add(e){this._unregistrations.set(e.method,e)}dispose(){let e=[];for(let n of this._unregistrations.values())e.push(n);let t={unregisterations:e};this._connection.sendRequest(U.UnregistrationRequest.type,t).catch(()=>{this._connection.console.info("Bulk unregistration failed.")})}disposeSingle(e){let t=Pr.string(e)?e:e.method,n=this._unregistrations.get(t);if(!n)return!1;let i={unregisterations:[n]};return this._connection.sendRequest(U.UnregistrationRequest.type,i).then(()=>{this._unregistrations.delete(t)},o=>{this._connection.console.info(`Un-registering request handler for ${n.id} failed.`)}),!0}},cu=class{attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}register(e,t,n){return e instanceof uu?this.registerMany(e):e instanceof Pa?this.registerSingle1(e,t,n):this.registerSingle2(e,t)}registerSingle1(e,t,n){let i=Pr.string(t)?t:t.method,o=Af.generateUuid(),a={registrations:[{id:o,method:i,registerOptions:n||{}}]};return e.isAttached||e.attach(this.connection),this.connection.sendRequest(U.RegistrationRequest.type,a).then(s=>(e.add({id:o,method:i}),e),s=>(this.connection.console.info(`Registering request handler for ${i} failed.`),Promise.reject(s)))}registerSingle2(e,t){let n=Pr.string(e)?e:e.method,i=Af.generateUuid(),o={registrations:[{id:i,method:n,registerOptions:t||{}}]};return this.connection.sendRequest(U.RegistrationRequest.type,o).then(a=>U.Disposable.create(()=>{this.unregisterSingle(i,n).catch(()=>{this.connection.console.info(`Un-registering capability with id ${i} failed.`)})}),a=>(this.connection.console.info(`Registering request handler for ${n} failed.`),Promise.reject(a)))}unregisterSingle(e,t){let n={unregisterations:[{id:e,method:t}]};return this.connection.sendRequest(U.UnregistrationRequest.type,n).catch(()=>{this.connection.console.info(`Un-registering request handler for ${e} failed.`)})}registerMany(e){let t=e.asRegistrationParams();return this.connection.sendRequest(U.RegistrationRequest.type,t).then(()=>new Pa(this._connection,t.registrations.map(n=>({id:n.id,method:n.method}))),n=>(this.connection.console.info("Bulk registration failed."),Promise.reject(n)))}},Cf=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}applyEdit(e){function t(i){return i&&!!i.edit}let n=t(e)?e:{edit:e};return this.connection.sendRequest(U.ApplyWorkspaceEditRequest.type,n)}},ev=(0,Z0.FileOperationsFeature)((0,V0.WorkspaceFoldersFeature)((0,z0.ConfigurationFeature)(Cf))),lu=class{constructor(){this._trace=U.Trace.Off}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}set trace(e){this._trace=e}log(e,t){this._trace!==U.Trace.Off&&this.connection.sendNotification(U.LogTraceNotification.type,{message:e,verbose:this._trace===U.Trace.Verbose?t:void 0}).catch(()=>{})}},du=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}logEvent(e){this.connection.sendNotification(U.TelemetryEventNotification.type,e).catch(()=>{this.connection.console.log("Sending TelemetryEventNotification failed")})}},fu=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}attachWorkDoneProgress(e){return(0,te.attachWorkDone)(this.connection,e)}attachPartialResultProgress(e,t){return(0,te.attachPartialResult)(this.connection,t)}};me._LanguagesImpl=fu;var tv=(0,ox.MonikerFeature)((0,nx.DiagnosticFeature)((0,rx.InlayHintFeature)((0,tx.InlineValueFeature)((0,ex.TypeHierarchyFeature)((0,Q0.LinkedEditingRangeFeature)((0,X0.SemanticTokensFeature)((0,Y0.CallHierarchyFeature)(fu)))))))),pu=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}attachWorkDoneProgress(e){return(0,te.attachWorkDone)(this.connection,e)}attachPartialResultProgress(e,t){return(0,te.attachPartialResult)(this.connection,t)}};me._NotebooksImpl=pu;var rv=(0,ix.NotebookSyncFeature)(pu);function nv(r,e){return function(t){return e(r(t))}}me.combineConsoleFeatures=nv;function iv(r,e){return function(t){return e(r(t))}}me.combineTelemetryFeatures=iv;function ov(r,e){return function(t){return e(r(t))}}me.combineTracerFeatures=ov;function av(r,e){return function(t){return e(r(t))}}me.combineClientFeatures=av;function sv(r,e){return function(t){return e(r(t))}}me.combineWindowFeatures=sv;function uv(r,e){return function(t){return e(r(t))}}me.combineWorkspaceFeatures=uv;function cv(r,e){return function(t){return e(r(t))}}me.combineLanguagesFeatures=cv;function lv(r,e){return function(t){return e(r(t))}}me.combineNotebooksFeatures=lv;function ux(r,e){function t(i,o,a){return i&&o?a(i,o):i||o}return{__brand:"features",console:t(r.console,e.console,nv),tracer:t(r.tracer,e.tracer,ov),telemetry:t(r.telemetry,e.telemetry,iv),client:t(r.client,e.client,av),window:t(r.window,e.window,sv),workspace:t(r.workspace,e.workspace,uv),languages:t(r.languages,e.languages,cv),notebooks:t(r.notebooks,e.notebooks,lv)}}me.combineFeatures=ux;function cx(r,e,t){let n=t&&t.console?new(t.console(su)):new su,i=r(n);n.rawAttach(i);let o=t&&t.tracer?new(t.tracer(lu)):new lu,a=t&&t.telemetry?new(t.telemetry(du)):new du,s=t&&t.client?new(t.client(cu)):new cu,u=t&&t.window?new(t.window(Qg)):new Qg,c=t&&t.workspace?new(t.workspace(ev)):new ev,l=t&&t.languages?new(t.languages(tv)):new tv,d=t&&t.notebooks?new(t.notebooks(rv)):new rv,g=[n,o,a,s,u,c,l,d];function y(_){return _ instanceof Promise?_:Pr.thenable(_)?new Promise((R,D)=>{_.then(B=>R(B),B=>D(B))}):Promise.resolve(_)}let p,A,x,k={listen:()=>i.listen(),sendRequest:(_,...R)=>i.sendRequest(Pr.string(_)?_:_.method,...R),onRequest:(_,R)=>i.onRequest(_,R),sendNotification:(_,R)=>{let D=Pr.string(_)?_:_.method;return arguments.length===1?i.sendNotification(D):i.sendNotification(D,R)},onNotification:(_,R)=>i.onNotification(_,R),onProgress:i.onProgress,sendProgress:i.sendProgress,onInitialize:_=>(A=_,{dispose:()=>{A=void 0}}),onInitialized:_=>i.onNotification(U.InitializedNotification.type,_),onShutdown:_=>(p=_,{dispose:()=>{p=void 0}}),onExit:_=>(x=_,{dispose:()=>{x=void 0}}),get console(){return n},get telemetry(){return a},get tracer(){return o},get client(){return s},get window(){return u},get workspace(){return c},get languages(){return l},get notebooks(){return d},onDidChangeConfiguration:_=>i.onNotification(U.DidChangeConfigurationNotification.type,_),onDidChangeWatchedFiles:_=>i.onNotification(U.DidChangeWatchedFilesNotification.type,_),__textDocumentSync:void 0,onDidOpenTextDocument:_=>i.onNotification(U.DidOpenTextDocumentNotification.type,_),onDidChangeTextDocument:_=>i.onNotification(U.DidChangeTextDocumentNotification.type,_),onDidCloseTextDocument:_=>i.onNotification(U.DidCloseTextDocumentNotification.type,_),onWillSaveTextDocument:_=>i.onNotification(U.WillSaveTextDocumentNotification.type,_),onWillSaveTextDocumentWaitUntil:_=>i.onRequest(U.WillSaveTextDocumentWaitUntilRequest.type,_),onDidSaveTextDocument:_=>i.onNotification(U.DidSaveTextDocumentNotification.type,_),sendDiagnostics:_=>i.sendNotification(U.PublishDiagnosticsNotification.type,_),onHover:_=>i.onRequest(U.HoverRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),void 0)),onCompletion:_=>i.onRequest(U.CompletionRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),(0,te.attachPartialResult)(i,R))),onCompletionResolve:_=>i.onRequest(U.CompletionResolveRequest.type,_),onSignatureHelp:_=>i.onRequest(U.SignatureHelpRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),void 0)),onDeclaration:_=>i.onRequest(U.DeclarationRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),(0,te.attachPartialResult)(i,R))),onDefinition:_=>i.onRequest(U.DefinitionRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),(0,te.attachPartialResult)(i,R))),onTypeDefinition:_=>i.onRequest(U.TypeDefinitionRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),(0,te.attachPartialResult)(i,R))),onImplementation:_=>i.onRequest(U.ImplementationRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),(0,te.attachPartialResult)(i,R))),onReferences:_=>i.onRequest(U.ReferencesRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),(0,te.attachPartialResult)(i,R))),onDocumentHighlight:_=>i.onRequest(U.DocumentHighlightRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),(0,te.attachPartialResult)(i,R))),onDocumentSymbol:_=>i.onRequest(U.DocumentSymbolRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),(0,te.attachPartialResult)(i,R))),onWorkspaceSymbol:_=>i.onRequest(U.WorkspaceSymbolRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),(0,te.attachPartialResult)(i,R))),onWorkspaceSymbolResolve:_=>i.onRequest(U.WorkspaceSymbolResolveRequest.type,_),onCodeAction:_=>i.onRequest(U.CodeActionRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),(0,te.attachPartialResult)(i,R))),onCodeActionResolve:_=>i.onRequest(U.CodeActionResolveRequest.type,(R,D)=>_(R,D)),onCodeLens:_=>i.onRequest(U.CodeLensRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),(0,te.attachPartialResult)(i,R))),onCodeLensResolve:_=>i.onRequest(U.CodeLensResolveRequest.type,(R,D)=>_(R,D)),onDocumentFormatting:_=>i.onRequest(U.DocumentFormattingRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),void 0)),onDocumentRangeFormatting:_=>i.onRequest(U.DocumentRangeFormattingRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),void 0)),onDocumentOnTypeFormatting:_=>i.onRequest(U.DocumentOnTypeFormattingRequest.type,(R,D)=>_(R,D)),onRenameRequest:_=>i.onRequest(U.RenameRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),void 0)),onPrepareRename:_=>i.onRequest(U.PrepareRenameRequest.type,(R,D)=>_(R,D)),onDocumentLinks:_=>i.onRequest(U.DocumentLinkRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),(0,te.attachPartialResult)(i,R))),onDocumentLinkResolve:_=>i.onRequest(U.DocumentLinkResolveRequest.type,(R,D)=>_(R,D)),onDocumentColor:_=>i.onRequest(U.DocumentColorRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),(0,te.attachPartialResult)(i,R))),onColorPresentation:_=>i.onRequest(U.ColorPresentationRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),(0,te.attachPartialResult)(i,R))),onFoldingRanges:_=>i.onRequest(U.FoldingRangeRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),(0,te.attachPartialResult)(i,R))),onSelectionRanges:_=>i.onRequest(U.SelectionRangeRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),(0,te.attachPartialResult)(i,R))),onExecuteCommand:_=>i.onRequest(U.ExecuteCommandRequest.type,(R,D)=>_(R,D,(0,te.attachWorkDone)(i,R),void 0)),dispose:()=>i.dispose()};for(let _ of g)_.attach(k);return i.onRequest(U.InitializeRequest.type,_=>{e.initialize(_),Pr.string(_.trace)&&(o.trace=U.Trace.fromString(_.trace));for(let R of g)R.initialize(_.capabilities);if(A){let R=A(_,new U.CancellationTokenSource().token,(0,te.attachWorkDone)(i,_),void 0);return y(R).then(D=>{if(D instanceof U.ResponseError)return D;let B=D;B||(B={capabilities:{}});let V=B.capabilities;V||(V={},B.capabilities=V),V.textDocumentSync===void 0||V.textDocumentSync===null?V.textDocumentSync=Pr.number(k.__textDocumentSync)?k.__textDocumentSync:U.TextDocumentSyncKind.None:!Pr.number(V.textDocumentSync)&&!Pr.number(V.textDocumentSync.change)&&(V.textDocumentSync.change=Pr.number(k.__textDocumentSync)?k.__textDocumentSync:U.TextDocumentSyncKind.None);for(let G of g)G.fillServerCapabilities(V);return B})}else{let R={capabilities:{textDocumentSync:U.TextDocumentSyncKind.None}};for(let D of g)D.fillServerCapabilities(R.capabilities);return R}}),i.onRequest(U.ShutdownRequest.type,()=>{if(e.shutdownReceived=!0,p)return p(new U.CancellationTokenSource().token)}),i.onNotification(U.ExitNotification.type,()=>{try{x&&x()}finally{e.shutdownReceived?e.exit(0):e.exit(1)}}),i.onNotification(U.SetTraceNotification.type,_=>{o.trace=U.Trace.fromString(_.value)}),k}me.createConnection=cx});var fv=C(nr=>{"use strict";Object.defineProperty(nr,"__esModule",{value:!0});nr.resolveModulePath=nr.FileSystem=nr.resolveGlobalYarnPath=nr.resolveGlobalNodePath=nr.resolve=nr.uriToFilePath=void 0;var lx=require("url"),Vr=require("path"),kf=require("fs"),Nf=require("child_process");function dx(r){let e=lx.parse(r);if(e.protocol!=="file:"||!e.path)return;let t=e.path.split("/");for(var n=0,i=t.length;n<i;n++)t[n]=decodeURIComponent(t[n]);if(process.platform==="win32"&&t.length>1){let o=t[0],a=t[1];o.length===0&&a.length>1&&a[1]===":"&&t.shift()}return Vr.normalize(t.join("/"))}nr.uriToFilePath=dx;function xf(){return process.platform==="win32"}function mu(r,e,t,n){let i="NODE_PATH",o=["var p = process;","p.on('message',function(m){","if(m.c==='e'){","p.exit(0);","}","else if(m.c==='rs'){","try{","var r=require.resolve(m.a);","p.send({c:'r',s:true,r:r});","}","catch(err){","p.send({c:'r',s:false});","}","}","});"].join("");return new Promise((a,s)=>{let u=process.env,c=Object.create(null);Object.keys(u).forEach(l=>c[l]=u[l]),e&&kf.existsSync(e)&&(c[i]?c[i]=e+Vr.delimiter+c[i]:c[i]=e,n&&n(`NODE_PATH value is: ${c[i]}`)),c.ELECTRON_RUN_AS_NODE="1";try{let l=(0,Nf.fork)("",[],{cwd:t,env:c,execArgv:["-e",o]});if(l.pid===void 0){s(new Error(`Starting process to resolve node module ${r} failed`));return}l.on("error",g=>{s(g)}),l.on("message",g=>{g.c==="r"&&(l.send({c:"e"}),g.s?a(g.r):s(new Error(`Failed to resolve module: ${r}`)))});let d={c:"rs",a:r};l.send(d)}catch(l){s(l)}})}nr.resolve=mu;function Sf(r){let e="npm",t=Object.create(null);Object.keys(process.env).forEach(o=>t[o]=process.env[o]),t.NO_UPDATE_NOTIFIER="true";let n={encoding:"utf8",env:t};xf()&&(e="npm.cmd",n.shell=!0);let i=()=>{};try{process.on("SIGPIPE",i);let o=(0,Nf.spawnSync)(e,["config","get","prefix"],n).stdout;if(!o){r&&r("'npm config get prefix' didn't return a value.");return}let a=o.trim();return r&&r(`'npm config get prefix' value is: ${a}`),a.length>0?xf()?Vr.join(a,"node_modules"):Vr.join(a,"lib","node_modules"):void 0}catch{return}finally{process.removeListener("SIGPIPE",i)}}nr.resolveGlobalNodePath=Sf;function fx(r){let e="yarn",t={encoding:"utf8"};xf()&&(e="yarn.cmd",t.shell=!0);let n=()=>{};try{process.on("SIGPIPE",n);let i=(0,Nf.spawnSync)(e,["global","dir","--json"],t),o=i.stdout;if(!o){r&&(r("'yarn global dir' didn't return a value."),i.stderr&&r(i.stderr));return}let a=o.trim().split(/\r?\n/);for(let s of a)try{let u=JSON.parse(s);if(u.type==="log")return Vr.join(u.data,"node_modules")}catch{}return}catch{return}finally{process.removeListener("SIGPIPE",n)}}nr.resolveGlobalYarnPath=fx;var dv;(function(r){let e;function t(){return e!==void 0||(process.platform==="win32"?e=!1:e=!kf.existsSync(__filename.toUpperCase())||!kf.existsSync(__filename.toLowerCase())),e}r.isCaseSensitive=t;function n(i,o){return t()?Vr.normalize(o).indexOf(Vr.normalize(i))===0:Vr.normalize(o).toLowerCase().indexOf(Vr.normalize(i).toLowerCase())===0}r.isParent=n})(dv=nr.FileSystem||(nr.FileSystem={}));function px(r,e,t,n){return t?(Vr.isAbsolute(t)||(t=Vr.join(r,t)),mu(e,t,t,n).then(i=>dv.isParent(t,i)?i:Promise.reject(new Error(`Failed to load ${e} from node path location.`))).then(void 0,i=>mu(e,Sf(n),r,n))):mu(e,Sf(n),r,n)}nr.resolveModulePath=px});var Df=C((D1,pv)=>{"use strict";pv.exports=Tt()});var hv=C($t=>{"use strict";var mx=$t&&$t.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),mv=$t&&$t.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&mx(e,r,t)};Object.defineProperty($t,"__esModule",{value:!0});$t.ProposedFeatures=$t.NotebookDocuments=$t.TextDocuments=$t.SemanticTokensBuilder=void 0;var hx=mf();Object.defineProperty($t,"SemanticTokensBuilder",{enumerable:!0,get:function(){return hx.SemanticTokensBuilder}});mv(Tt(),$t);var yx=vf();Object.defineProperty($t,"TextDocuments",{enumerable:!0,get:function(){return yx.TextDocuments}});var gx=Rf();Object.defineProperty($t,"NotebookDocuments",{enumerable:!0,get:function(){return gx.NotebookDocuments}});mv(Pf(),$t);var vx;(function(r){r.all={__brand:"features"}})(vx=$t.ProposedFeatures||($t.ProposedFeatures={}))});var we=C(gr=>{"use strict";var Tx=gr&&gr.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),gv=gr&&gr.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Tx(e,r,t)};Object.defineProperty(gr,"__esModule",{value:!0});gr.createConnection=gr.Files=void 0;var wf=Es(),Rx=Pf(),ka=fv(),$i=Df();gv(Df(),gr);gv(hv(),gr);var _x;(function(r){r.uriToFilePath=ka.uriToFilePath,r.resolveGlobalNodePath=ka.resolveGlobalNodePath,r.resolveGlobalYarnPath=ka.resolveGlobalYarnPath,r.resolve=ka.resolve,r.resolveModulePath=ka.resolveModulePath})(_x=gr.Files||(gr.Files={}));var yv;function hu(){if(yv!==void 0)try{yv.end()}catch{}}var Ro=!1,vv;function Ax(){let r="--clientProcessId";function e(t){try{let n=parseInt(t);isNaN(n)||(vv=setInterval(()=>{try{process.kill(n,0)}catch{hu(),process.exit(Ro?0:1)}},3e3))}catch{}}for(let t=2;t<process.argv.length;t++){let n=process.argv[t];if(n===r&&t+1<process.argv.length){e(process.argv[t+1]);return}else{let i=n.split("=");i[0]===r&&e(i[1])}}}Ax();var bx={initialize:r=>{let e=r.processId;wf.number(e)&&vv===void 0&&setInterval(()=>{try{process.kill(e,0)}catch{process.exit(Ro?0:1)}},3e3)},get shutdownReceived(){return Ro},set shutdownReceived(r){Ro=r},exit:r=>{hu(),process.exit(r)}};function Ex(r,e,t,n){let i,o,a,s;return r!==void 0&&r.__brand==="features"&&(i=r,r=e,e=t,t=n),$i.ConnectionStrategy.is(r)||$i.ConnectionOptions.is(r)?s=r:(o=r,a=e,s=t),Cx(o,a,s,i)}gr.createConnection=Ex;function Cx(r,e,t,n){if(!r&&!e&&process.argv.length>2){let s,u,c=process.argv.slice(2);for(let l=0;l<c.length;l++){let d=c[l];if(d==="--node-ipc"){r=new $i.IPCMessageReader(process),e=new $i.IPCMessageWriter(process);break}else if(d==="--stdio"){r=process.stdin,e=process.stdout;break}else if(d==="--socket"){s=parseInt(c[l+1]);break}else if(d==="--pipe"){u=c[l+1];break}else{var i=d.split("=");if(i[0]==="--socket"){s=parseInt(i[1]);break}else if(i[0]==="--pipe"){u=i[1];break}}}if(s){let l=(0,$i.createServerSocketTransport)(s);r=l[0],e=l[1]}else if(u){let l=(0,$i.createServerPipeTransport)(u);r=l[0],e=l[1]}}var o="Use arguments of createConnection or set command line parameters: '--node-ipc', '--stdio' or '--socket={number}'";if(!r)throw new Error("Connection input stream is not set. "+o);if(!e)throw new Error("Connection output stream is not set. "+o);if(wf.func(r.read)&&wf.func(r.on)){let s=r;s.on("end",()=>{hu(),process.exit(Ro?0:1)}),s.on("close",()=>{hu(),process.exit(Ro?0:1)})}let a=s=>(0,$i.createProtocolConnection)(r,e,s,t);return(0,Rx.createConnection)(a,bx,n)}});var gu=C((Tv,yu)=>{(function(r){if(typeof yu=="object"&&typeof yu.exports=="object"){var e=r(require,Tv);e!==void 0&&(yu.exports=e)}else typeof define=="function"&&define.amd&&define(["require","exports"],r)})(function(r,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TextDocument=void 0;class t{constructor(c,l,d,g){this._uri=c,this._languageId=l,this._version=d,this._content=g,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(c){if(c){let l=this.offsetAt(c.start),d=this.offsetAt(c.end);return this._content.substring(l,d)}return this._content}update(c,l){for(let d of c)if(t.isIncremental(d)){let g=a(d.range),y=this.offsetAt(g.start),p=this.offsetAt(g.end);this._content=this._content.substring(0,y)+d.text+this._content.substring(p,this._content.length);let A=Math.max(g.start.line,0),x=Math.max(g.end.line,0),k=this._lineOffsets,_=o(d.text,!1,y);if(x-A===_.length)for(let D=0,B=_.length;D<B;D++)k[D+A+1]=_[D];else _.length<1e4?k.splice(A+1,x-A,..._):this._lineOffsets=k=k.slice(0,A+1).concat(_,k.slice(x+1));let R=d.text.length-(p-y);if(R!==0)for(let D=A+1+_.length,B=k.length;D<B;D++)k[D]=k[D]+R}else if(t.isFull(d))this._content=d.text,this._lineOffsets=void 0;else throw new Error("Unknown change event received");this._version=l}getLineOffsets(){return this._lineOffsets===void 0&&(this._lineOffsets=o(this._content,!0)),this._lineOffsets}positionAt(c){c=Math.max(Math.min(c,this._content.length),0);let l=this.getLineOffsets(),d=0,g=l.length;if(g===0)return{line:0,character:c};for(;d<g;){let p=Math.floor((d+g)/2);l[p]>c?g=p:d=p+1}let y=d-1;return{line:y,character:c-l[y]}}offsetAt(c){let l=this.getLineOffsets();if(c.line>=l.length)return this._content.length;if(c.line<0)return 0;let d=l[c.line],g=c.line+1<l.length?l[c.line+1]:this._content.length;return Math.max(Math.min(d+c.character,g),d)}get lineCount(){return this.getLineOffsets().length}static isIncremental(c){let l=c;return l!=null&&typeof l.text=="string"&&l.range!==void 0&&(l.rangeLength===void 0||typeof l.rangeLength=="number")}static isFull(c){let l=c;return l!=null&&typeof l.text=="string"&&l.range===void 0&&l.rangeLength===void 0}}var n;(function(u){function c(g,y,p,A){return new t(g,y,p,A)}u.create=c;function l(g,y,p){if(g instanceof t)return g.update(y,p),g;throw new Error("TextDocument.update: document must be created by TextDocument.create")}u.update=l;function d(g,y){let p=g.getText(),A=i(y.map(s),(_,R)=>{let D=_.range.start.line-R.range.start.line;return D===0?_.range.start.character-R.range.start.character:D}),x=0,k=[];for(let _ of A){let R=g.offsetAt(_.range.start);if(R<x)throw new Error("Overlapping edit");R>x&&k.push(p.substring(x,R)),_.newText.length&&k.push(_.newText),x=g.offsetAt(_.range.end)}return k.push(p.substr(x)),k.join("")}u.applyEdits=d})(n=e.TextDocument||(e.TextDocument={}));function i(u,c){if(u.length<=1)return u;let l=u.length/2|0,d=u.slice(0,l),g=u.slice(l);i(d,c),i(g,c);let y=0,p=0,A=0;for(;y<d.length&&p<g.length;)c(d[y],g[p])<=0?u[A++]=d[y++]:u[A++]=g[p++];for(;y<d.length;)u[A++]=d[y++];for(;p<g.length;)u[A++]=g[p++];return u}function o(u,c,l=0){let d=c?[l]:[];for(let g=0;g<u.length;g++){let y=u.charCodeAt(g);(y===13||y===10)&&(y===13&&g+1<u.length&&u.charCodeAt(g+1)===10&&g++,d.push(l+g+1))}return d}function a(u){let c=u.start,l=u.end;return c.line>l.line||c.line===l.line&&c.character>l.character?{start:l,end:c}:u}function s(u){let c=a(u.range);return c!==u.range?{newText:u.newText,range:c}:u}})});var _o=C(di=>{"use strict";Object.defineProperty(di,"__esModule",{value:!0});di.isRootCstNode=di.isLeafCstNode=di.isCompositeCstNode=void 0;function Rv(r){return typeof r=="object"&&!!r&&"children"in r}di.isCompositeCstNode=Rv;function Px(r){return typeof r=="object"&&!!r&&"tokenType"in r}di.isLeafCstNode=Px;function kx(r){return Rv(r)&&"fullText"in r}di.isRootCstNode=kx});var Ct=C(Be=>{"use strict";Object.defineProperty(Be,"__esModule",{value:!0});Be.Reduction=Be.TreeStreamImpl=Be.stream=Be.DONE_RESULT=Be.EMPTY_STREAM=Be.StreamImpl=void 0;var Mt=class{constructor(e,t){this.startFn=e,this.nextFn=t}iterator(){let e={state:this.startFn(),next:()=>this.nextFn(e.state),[Symbol.iterator]:()=>e};return e}[Symbol.iterator](){return this.iterator()}isEmpty(){return!!this.iterator().next().done}count(){let e=this.iterator(),t=0,n=e.next();for(;!n.done;)t++,n=e.next();return t}toArray(){let e=[],t=this.iterator(),n;do n=t.next(),n.value!==void 0&&e.push(n.value);while(!n.done);return e}toSet(){return new Set(this)}toMap(e,t){let n=this.map(i=>[e?e(i):i,t?t(i):i]);return new Map(n)}toString(){return this.join()}concat(e){let t=e[Symbol.iterator]();return new Mt(()=>({first:this.startFn(),firstDone:!1}),n=>{let i;if(!n.firstDone){do if(i=this.nextFn(n.first),!i.done)return i;while(!i.done);n.firstDone=!0}do if(i=t.next(),!i.done)return i;while(!i.done);return Be.DONE_RESULT})}join(e=","){let t=this.iterator(),n="",i,o=!1;do i=t.next(),i.done||(o&&(n+=e),n+=xx(i.value)),o=!0;while(!i.done);return n}indexOf(e,t=0){let n=this.iterator(),i=0,o=n.next();for(;!o.done;){if(i>=t&&o.value===e)return i;o=n.next(),i++}return-1}every(e){let t=this.iterator(),n=t.next();for(;!n.done;){if(!e(n.value))return!1;n=t.next()}return!0}some(e){let t=this.iterator(),n=t.next();for(;!n.done;){if(e(n.value))return!0;n=t.next()}return!1}forEach(e){let t=this.iterator(),n=0,i=t.next();for(;!i.done;)e(i.value,n),i=t.next(),n++}map(e){return new Mt(this.startFn,t=>{let{done:n,value:i}=this.nextFn(t);return n?Be.DONE_RESULT:{done:!1,value:e(i)}})}filter(e){return new Mt(this.startFn,t=>{let n;do if(n=this.nextFn(t),!n.done&&e(n.value))return n;while(!n.done);return Be.DONE_RESULT})}nonNullable(){return this.filter(e=>e!=null)}reduce(e,t){let n=this.iterator(),i=t,o=n.next();for(;!o.done;)i===void 0?i=o.value:i=e(i,o.value),o=n.next();return i}reduceRight(e,t){return this.recursiveReduce(this.iterator(),e,t)}recursiveReduce(e,t,n){let i=e.next();if(i.done)return n;let o=this.recursiveReduce(e,t,n);return o===void 0?i.value:t(o,i.value)}find(e){let t=this.iterator(),n=t.next();for(;!n.done;){if(e(n.value))return n.value;n=t.next()}}findIndex(e){let t=this.iterator(),n=0,i=t.next();for(;!i.done;){if(e(i.value))return n;i=t.next(),n++}return-1}includes(e){let t=this.iterator(),n=t.next();for(;!n.done;){if(n.value===e)return!0;n=t.next()}return!1}flatMap(e){return new Mt(()=>({this:this.startFn()}),t=>{do{if(t.iterator){let o=t.iterator.next();if(o.done)t.iterator=void 0;else return o}let{done:n,value:i}=this.nextFn(t.this);if(!n){let o=e(i);if(vu(o))t.iterator=o[Symbol.iterator]();else return{done:!1,value:o}}}while(t.iterator);return Be.DONE_RESULT})}flat(e){if(e===void 0&&(e=1),e<=0)return this;let t=e>1?this.flat(e-1):this;return new Mt(()=>({this:t.startFn()}),n=>{do{if(n.iterator){let a=n.iterator.next();if(a.done)n.iterator=void 0;else return a}let{done:i,value:o}=t.nextFn(n.this);if(!i)if(vu(o))n.iterator=o[Symbol.iterator]();else return{done:!1,value:o}}while(n.iterator);return Be.DONE_RESULT})}head(){let t=this.iterator().next();if(!t.done)return t.value}tail(e=1){return new Mt(()=>{let t=this.startFn();for(let n=0;n<e;n++)if(this.nextFn(t).done)return t;return t},this.nextFn)}limit(e){return new Mt(()=>({size:0,state:this.startFn()}),t=>(t.size++,t.size>e?Be.DONE_RESULT:this.nextFn(t.state)))}distinct(e){let t=new Set;return this.filter(n=>{let i=e?e(n):n;return t.has(i)?!1:(t.add(i),!0)})}exclude(e,t){let n=new Set;for(let i of e){let o=t?t(i):i;n.add(o)}return this.filter(i=>{let o=t?t(i):i;return!n.has(o)})}};Be.StreamImpl=Mt;function xx(r){return typeof r=="string"?r:typeof r>"u"?"undefined":typeof r.toString=="function"?r.toString():Object.prototype.toString.call(r)}function vu(r){return!!r&&typeof r[Symbol.iterator]=="function"}Be.EMPTY_STREAM=new Mt(()=>{},()=>Be.DONE_RESULT);Be.DONE_RESULT=Object.freeze({done:!0,value:void 0});function Sx(...r){if(r.length===1){let e=r[0];if(e instanceof Mt)return e;if(vu(e))return new Mt(()=>e[Symbol.iterator](),t=>t.next());if(typeof e.length=="number")return new Mt(()=>({index:0}),t=>t.index<e.length?{done:!1,value:e[t.index++]}:Be.DONE_RESULT)}return r.length>1?new Mt(()=>({collIndex:0,arrIndex:0}),e=>{do{if(e.iterator){let t=e.iterator.next();if(!t.done)return t;e.iterator=void 0}if(e.array){if(e.arrIndex<e.array.length)return{done:!1,value:e.array[e.arrIndex++]};e.array=void 0,e.arrIndex=0}if(e.collIndex<r.length){let t=r[e.collIndex++];vu(t)?e.iterator=t[Symbol.iterator]():t&&typeof t.length=="number"&&(e.array=t)}}while(e.iterator||e.array||e.collIndex<r.length);return Be.DONE_RESULT}):Be.EMPTY_STREAM}Be.stream=Sx;var If=class extends Mt{constructor(e,t,n){super(()=>({iterators:n?.includeRoot?[[e][Symbol.iterator]()]:[t(e)[Symbol.iterator]()],pruned:!1}),i=>{for(i.pruned&&(i.iterators.pop(),i.pruned=!1);i.iterators.length>0;){let a=i.iterators[i.iterators.length-1].next();if(a.done)i.iterators.pop();else return i.iterators.push(t(a.value)[Symbol.iterator]()),a}return Be.DONE_RESULT})}iterator(){let e={state:this.startFn(),next:()=>this.nextFn(e.state),prune:()=>{e.state.pruned=!0},[Symbol.iterator]:()=>e};return e}};Be.TreeStreamImpl=If;var Nx;(function(r){function e(o){return o.reduce((a,s)=>a+s,0)}r.sum=e;function t(o){return o.reduce((a,s)=>a*s,0)}r.product=t;function n(o){return o.reduce((a,s)=>Math.min(a,s))}r.min=n;function i(o){return o.reduce((a,s)=>Math.max(a,s))}r.max=i})(Nx=Be.Reduction||(Be.Reduction={}))});var et=C(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.getInteriorNodes=Ne.getStartlineNode=Ne.getNextNode=Ne.getPreviousNode=Ne.findLeafNodeAtOffset=Ne.isCommentNode=Ne.findCommentNode=Ne.findDeclarationNodeAtOffset=Ne.DefaultNameRegexp=Ne.toDocumentSegment=Ne.tokenToRange=Ne.flattenCst=Ne.streamCst=void 0;var Ao=_o(),Dx=Ct();function Av(r){return new Dx.TreeStreamImpl(r,e=>(0,Ao.isCompositeCstNode)(e)?e.children:[],{includeRoot:!0})}Ne.streamCst=Av;function wx(r){return Av(r).filter(Ao.isLeafCstNode)}Ne.flattenCst=wx;function Ix(r){return{start:{character:r.startColumn-1,line:r.startLine-1},end:{character:r.endColumn,line:r.endLine-1}}}Ne.tokenToRange=Ix;function Ox(r){let{offset:e,end:t,range:n}=r;return{range:n,offset:e,end:t,length:t-e}}Ne.toDocumentSegment=Ox;Ne.DefaultNameRegexp=/^[\w\p{L}]$/u;function $x(r,e,t=Ne.DefaultNameRegexp){if(r){if(e>0){let n=e-r.offset,i=r.text.charAt(n);t.test(i)||e--}return $f(r,e)}}Ne.findDeclarationNodeAtOffset=$x;function Mx(r,e){if(r){let t=bv(r,!0);if(t&&Of(t,e))return t;if((0,Ao.isRootCstNode)(r)){let n=r.children.findIndex(i=>!i.hidden);for(let i=n-1;i>=0;i--){let o=r.children[i];if(Of(o,e))return o}}}}Ne.findCommentNode=Mx;function Of(r,e){return(0,Ao.isLeafCstNode)(r)&&e.includes(r.tokenType.name)}Ne.isCommentNode=Of;function $f(r,e){if((0,Ao.isLeafCstNode)(r))return r;if((0,Ao.isCompositeCstNode)(r)){let t=0,n=r.children.length-1;for(;t<=n;){let i=Math.floor((t+n)/2),o=r.children[i];if(o.offset>e)n=i-1;else if(o.end<=e)t=i+1;else return $f(o,e)}}}Ne.findLeafNodeAtOffset=$f;function bv(r,e=!0){for(;r.parent;){let t=r.parent,n=t.children.indexOf(r);if(n===0)r=t;else{n--;let i=t.children[n];if(e||!i.hidden)return i}}}Ne.getPreviousNode=bv;function Lx(r,e=!0){for(;r.parent;){let t=r.parent,n=t.children.indexOf(r);if(t.children.length-1===n)r=t;else{n++;let i=t.children[n];if(e||!i.hidden)return i}}}Ne.getNextNode=Lx;function Fx(r){if(r.range.start.character===0)return r;let e=r.range.start.line,t=r,n;for(;r.parent;){let i=r.parent,o=n??i.children.indexOf(r);if(o===0?(r=i,n=void 0):(n=o-1,r=i.children[n]),r.range.start.line!==e)break;t=r}return t}Ne.getStartlineNode=Fx;function qx(r,e){let t=jx(r,e);return t?t.parent.children.slice(t.a+1,t.b):[]}Ne.getInteriorNodes=qx;function jx(r,e){let t=_v(r),n=_v(e),i;for(let o=0;o<t.length&&o<n.length;o++){let a=t[o],s=n[o];if(a.parent===s.parent)i={parent:a.parent,a:a.index,b:s.index};else break}return i}function _v(r){let e=[];for(;r.parent;){let t=r.parent,n=t.children.indexOf(r);e.push({parent:t,index:n}),r=t}return e.reverse()}});var xa=C(bo=>{"use strict";Object.defineProperty(bo,"__esModule",{value:!0});bo.eagerLoad=bo.inject=void 0;function Gx(r,e,t,n){let i=[r,e,t,n].reduce(xv,{});return kv(i)}bo.inject=Gx;var Mf=Symbol("isProxy");function Pv(r){if(r&&r[Mf])for(let e of Object.values(r))Pv(e);return r}bo.eagerLoad=Pv;function kv(r,e){let t=new Proxy({},{deleteProperty:()=>!1,get:(n,i)=>Cv(n,i,r,e||t),getOwnPropertyDescriptor:(n,i)=>(Cv(n,i,r,e||t),Object.getOwnPropertyDescriptor(n,i)),has:(n,i)=>i in r,ownKeys:()=>[...Reflect.ownKeys(r),Mf]});return t[Mf]=!0,t}var Ev=Symbol();function Cv(r,e,t,n){if(e in r){if(r[e]instanceof Error)throw new Error("Construction failure. Please make sure that your dependencies are constructable.",{cause:r[e]});if(r[e]===Ev)throw new Error('Cycle detected. Please make "'+String(e)+'" lazy. See https://langium.org/docs/di/cyclic-dependencies');return r[e]}else if(e in t){let i=t[e];r[e]=Ev;try{r[e]=typeof i=="function"?i(n):kv(i,n)}catch(o){throw r[e]=o instanceof Error?o:void 0,o}return r[e]}else return}function xv(r,e){if(e){for(let[t,n]of Object.entries(e))if(n!==void 0){let i=r[t];i!==null&&n!==null&&typeof i=="object"&&typeof n=="object"?r[t]=xv(i,n):r[t]=n}}return r}});var Re=C(Pe=>{"use strict";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.findLocalReferences=Pe.streamReferences=Pe.streamAst=Pe.streamAllContents=Pe.streamContents=Pe.findRootNode=Pe.getDocument=Pe.hasContainerOfType=Pe.getContainerOfType=Pe.isLinkingError=Pe.isAstNodeDescription=Pe.isReference=Pe.linkContentToContainer=Pe.isAstNode=void 0;var Mi=Ct();function Eo(r){return typeof r=="object"&&r!==null&&typeof r.$type=="string"}Pe.isAstNode=Eo;function Ux(r){for(let[e,t]of Object.entries(r))e.startsWith("$")||(Array.isArray(t)?t.forEach((n,i)=>{Eo(n)&&(n.$container=r,n.$containerProperty=e,n.$containerIndex=i)}):Eo(t)&&(t.$container=r,t.$containerProperty=e))}Pe.linkContentToContainer=Ux;function Tu(r){return typeof r=="object"&&r!==null&&typeof r.$refText=="string"}Pe.isReference=Tu;function Hx(r){return typeof r=="object"&&r!==null&&typeof r.name=="string"&&typeof r.type=="string"&&typeof r.path=="string"}Pe.isAstNodeDescription=Hx;function Wx(r){return typeof r=="object"&&r!==null&&Eo(r.container)&&Tu(r.reference)&&typeof r.message=="string"}Pe.isLinkingError=Wx;function Kx(r,e){let t=r;for(;t;){if(e(t))return t;t=t.$container}}Pe.getContainerOfType=Kx;function Bx(r,e){let t=r;for(;t;){if(e(t))return!0;t=t.$container}return!1}Pe.hasContainerOfType=Bx;function Sv(r){let t=Nv(r).$document;if(!t)throw new Error("AST node has no document.");return t}Pe.getDocument=Sv;function Nv(r){for(;r.$container;)r=r.$container;return r}Pe.findRootNode=Nv;function Lf(r){return new Mi.StreamImpl(()=>({keys:Object.keys(r),keyIndex:0,arrayIndex:0}),e=>{for(;e.keyIndex<e.keys.length;){let t=e.keys[e.keyIndex];if(!t.startsWith("$")){let n=r[t];if(Eo(n))return e.keyIndex++,{done:!1,value:n};if(Array.isArray(n)){for(;e.arrayIndex<n.length;){let i=e.arrayIndex++,o=n[i];if(Eo(o))return{done:!1,value:o}}e.arrayIndex=0}}e.keyIndex++}return Mi.DONE_RESULT})}Pe.streamContents=Lf;function zx(r){return new Mi.TreeStreamImpl(r,e=>Lf(e))}Pe.streamAllContents=zx;function Dv(r){return new Mi.TreeStreamImpl(r,e=>Lf(e),{includeRoot:!0})}Pe.streamAst=Dv;function wv(r){return new Mi.StreamImpl(()=>({keys:Object.keys(r),keyIndex:0,arrayIndex:0}),e=>{for(;e.keyIndex<e.keys.length;){let t=e.keys[e.keyIndex];if(!t.startsWith("$")){let n=r[t];if(Tu(n))return e.keyIndex++,{done:!1,value:{reference:n,container:r,property:t}};if(Array.isArray(n)){for(;e.arrayIndex<n.length;){let i=e.arrayIndex++,o=n[i];if(Tu(o))return{done:!1,value:{reference:o,container:r,property:t,index:i}}}e.arrayIndex=0}}e.keyIndex++}return Mi.DONE_RESULT})}Pe.streamReferences=wv;function Vx(r,e=Sv(r).parseResult.value){let t=[];return Dv(e).forEach(n=>{wv(n).forEach(i=>{i.reference.ref===r&&t.push(i.reference)})}),(0,Mi.stream)(t)}Pe.findLocalReferences=Vx});var kr=C(Ru=>{"use strict";Object.defineProperty(Ru,"__esModule",{value:!0});Ru.MultiMap=void 0;var Co=Ct(),Ff=class{constructor(){this.map=new Map}get size(){return Co.Reduction.sum((0,Co.stream)(this.map.values()).map(e=>e.length))}clear(){this.map.clear()}delete(e,t){if(t===void 0)return this.map.delete(e);{let n=this.map.get(e);if(n){let i=n.indexOf(t);if(i>=0)return n.length===1?this.map.delete(e):n.splice(i,1),!0}return!1}}get(e){var t;return(t=this.map.get(e))!==null&&t!==void 0?t:[]}has(e,t){if(t===void 0)return this.map.has(e);{let n=this.map.get(e);return n?n.indexOf(t)>=0:!1}}add(e,t){return this.map.has(e)?this.map.get(e).push(t):this.map.set(e,[t]),this}addAll(e,t){return this.map.has(e)?this.map.get(e).push(...t):this.map.set(e,Array.from(t)),this}forEach(e){this.map.forEach((t,n)=>t.forEach(i=>e(i,n,this)))}[Symbol.iterator](){return this.entries().iterator()}entries(){return(0,Co.stream)(this.map.entries()).flatMap(([e,t])=>t.map(n=>[e,n]))}keys(){return(0,Co.stream)(this.map.keys())}values(){return(0,Co.stream)(this.map.values()).flat()}entriesGroupedByKey(){return(0,Co.stream)(this.map.entries())}};Ru.MultiMap=Ff});var Au=C(Po=>{"use strict";Object.defineProperty(Po,"__esModule",{value:!0});Po.EmptyFileSystem=Po.EmptyFileSystemProvider=void 0;var _u=class{readFile(){throw new Error("Method not implemented.")}readFileSync(){throw new Error("Method not implemented.")}async readDirectory(){return[]}};Po.EmptyFileSystemProvider=_u;Po.EmptyFileSystem={fileSystemProvider:()=>new _u}});var ze=C(T=>{"use strict";Object.defineProperty(T,"__esModule",{value:!0});T.isParserRule=T.ParserRule=T.isParameterReference=T.ParameterReference=T.isParameter=T.Parameter=T.isNegation=T.Negation=T.isNegatedToken=T.NegatedToken=T.isNamedArgument=T.NamedArgument=T.isLiteralCondition=T.LiteralCondition=T.isKeyword=T.Keyword=T.isInterface=T.Interface=T.isInferredType=T.InferredType=T.isGroup=T.Group=T.isGrammarImport=T.GrammarImport=T.isGrammar=T.Grammar=T.isDisjunction=T.Disjunction=T.isCrossReference=T.CrossReference=T.isConjunction=T.Conjunction=T.isCharacterRange=T.CharacterRange=T.isAtomType=T.AtomType=T.isAssignment=T.Assignment=T.isAlternatives=T.Alternatives=T.isAction=T.Action=T.isAbstractElement=T.AbstractElement=T.isCondition=T.Condition=T.isAbstractType=T.AbstractType=T.isAbstractRule=T.AbstractRule=void 0;T.reflection=T.LangiumGrammarAstReflection=T.isWildcard=T.Wildcard=T.isUntilToken=T.UntilToken=T.isUnorderedGroup=T.UnorderedGroup=T.isTypeAttribute=T.TypeAttribute=T.isType=T.Type=T.isTerminalRuleCall=T.TerminalRuleCall=T.isTerminalRule=T.TerminalRule=T.isTerminalGroup=T.TerminalGroup=T.isTerminalAlternatives=T.TerminalAlternatives=T.isRuleCall=T.RuleCall=T.isReturnType=T.ReturnType=T.isRegexToken=T.RegexToken=void 0;var Yx=Re();T.AbstractRule="AbstractRule";function Xx(r){return T.reflection.isInstance(r,T.AbstractRule)}T.isAbstractRule=Xx;T.AbstractType="AbstractType";function Jx(r){return T.reflection.isInstance(r,T.AbstractType)}T.isAbstractType=Jx;T.Condition="Condition";function Zx(r){return T.reflection.isInstance(r,T.Condition)}T.isCondition=Zx;T.AbstractElement="AbstractElement";function Qx(r){return T.reflection.isInstance(r,T.AbstractElement)}T.isAbstractElement=Qx;T.Action="Action";function eS(r){return T.reflection.isInstance(r,T.Action)}T.isAction=eS;T.Alternatives="Alternatives";function tS(r){return T.reflection.isInstance(r,T.Alternatives)}T.isAlternatives=tS;T.Assignment="Assignment";function rS(r){return T.reflection.isInstance(r,T.Assignment)}T.isAssignment=rS;T.AtomType="AtomType";function nS(r){return T.reflection.isInstance(r,T.AtomType)}T.isAtomType=nS;T.CharacterRange="CharacterRange";function iS(r){return T.reflection.isInstance(r,T.CharacterRange)}T.isCharacterRange=iS;T.Conjunction="Conjunction";function oS(r){return T.reflection.isInstance(r,T.Conjunction)}T.isConjunction=oS;T.CrossReference="CrossReference";function aS(r){return T.reflection.isInstance(r,T.CrossReference)}T.isCrossReference=aS;T.Disjunction="Disjunction";function sS(r){return T.reflection.isInstance(r,T.Disjunction)}T.isDisjunction=sS;T.Grammar="Grammar";function uS(r){return T.reflection.isInstance(r,T.Grammar)}T.isGrammar=uS;T.GrammarImport="GrammarImport";function cS(r){return T.reflection.isInstance(r,T.GrammarImport)}T.isGrammarImport=cS;T.Group="Group";function lS(r){return T.reflection.isInstance(r,T.Group)}T.isGroup=lS;T.InferredType="InferredType";function dS(r){return T.reflection.isInstance(r,T.InferredType)}T.isInferredType=dS;T.Interface="Interface";function fS(r){return T.reflection.isInstance(r,T.Interface)}T.isInterface=fS;T.Keyword="Keyword";function pS(r){return T.reflection.isInstance(r,T.Keyword)}T.isKeyword=pS;T.LiteralCondition="LiteralCondition";function mS(r){return T.reflection.isInstance(r,T.LiteralCondition)}T.isLiteralCondition=mS;T.NamedArgument="NamedArgument";function hS(r){return T.reflection.isInstance(r,T.NamedArgument)}T.isNamedArgument=hS;T.NegatedToken="NegatedToken";function yS(r){return T.reflection.isInstance(r,T.NegatedToken)}T.isNegatedToken=yS;T.Negation="Negation";function gS(r){return T.reflection.isInstance(r,T.Negation)}T.isNegation=gS;T.Parameter="Parameter";function vS(r){return T.reflection.isInstance(r,T.Parameter)}T.isParameter=vS;T.ParameterReference="ParameterReference";function TS(r){return T.reflection.isInstance(r,T.ParameterReference)}T.isParameterReference=TS;T.ParserRule="ParserRule";function RS(r){return T.reflection.isInstance(r,T.ParserRule)}T.isParserRule=RS;T.RegexToken="RegexToken";function _S(r){return T.reflection.isInstance(r,T.RegexToken)}T.isRegexToken=_S;T.ReturnType="ReturnType";function AS(r){return T.reflection.isInstance(r,T.ReturnType)}T.isReturnType=AS;T.RuleCall="RuleCall";function bS(r){return T.reflection.isInstance(r,T.RuleCall)}T.isRuleCall=bS;T.TerminalAlternatives="TerminalAlternatives";function ES(r){return T.reflection.isInstance(r,T.TerminalAlternatives)}T.isTerminalAlternatives=ES;T.TerminalGroup="TerminalGroup";function CS(r){return T.reflection.isInstance(r,T.TerminalGroup)}T.isTerminalGroup=CS;T.TerminalRule="TerminalRule";function PS(r){return T.reflection.isInstance(r,T.TerminalRule)}T.isTerminalRule=PS;T.TerminalRuleCall="TerminalRuleCall";function kS(r){return T.reflection.isInstance(r,T.TerminalRuleCall)}T.isTerminalRuleCall=kS;T.Type="Type";function xS(r){return T.reflection.isInstance(r,T.Type)}T.isType=xS;T.TypeAttribute="TypeAttribute";function SS(r){return T.reflection.isInstance(r,T.TypeAttribute)}T.isTypeAttribute=SS;T.UnorderedGroup="UnorderedGroup";function NS(r){return T.reflection.isInstance(r,T.UnorderedGroup)}T.isUnorderedGroup=NS;T.UntilToken="UntilToken";function DS(r){return T.reflection.isInstance(r,T.UntilToken)}T.isUntilToken=DS;T.Wildcard="Wildcard";function wS(r){return T.reflection.isInstance(r,T.Wildcard)}T.isWildcard=wS;var bu=class{getAllTypes(){return["AbstractElement","AbstractRule","AbstractType","Action","Alternatives","Assignment","AtomType","CharacterRange","Condition","Conjunction","CrossReference","Disjunction","Grammar","GrammarImport","Group","InferredType","Interface","Keyword","LiteralCondition","NamedArgument","NegatedToken","Negation","Parameter","ParameterReference","ParserRule","RegexToken","ReturnType","RuleCall","TerminalAlternatives","TerminalGroup","TerminalRule","TerminalRuleCall","Type","TypeAttribute","UnorderedGroup","UntilToken","Wildcard"]}isInstance(e,t){return(0,Yx.isAstNode)(e)&&this.isSubtype(e.$type,t)}isSubtype(e,t){if(e===t)return!0;switch(e){case T.Action:return this.isSubtype(T.AbstractElement,t)||this.isSubtype(T.AbstractType,t);case T.Alternatives:case T.Assignment:case T.CharacterRange:case T.CrossReference:case T.Group:case T.Keyword:case T.NegatedToken:case T.RegexToken:case T.RuleCall:case T.TerminalAlternatives:case T.TerminalGroup:case T.TerminalRuleCall:case T.UnorderedGroup:case T.UntilToken:case T.Wildcard:return this.isSubtype(T.AbstractElement,t);case T.Conjunction:case T.Disjunction:case T.LiteralCondition:case T.Negation:case T.ParameterReference:return this.isSubtype(T.Condition,t);case T.Interface:case T.Type:return this.isSubtype(T.AbstractType,t);case T.ParserRule:return this.isSubtype(T.AbstractRule,t)||this.isSubtype(T.AbstractType,t);case T.TerminalRule:return this.isSubtype(T.AbstractRule,t);default:return!1}}getReferenceType(e){let t=`${e.container.$type}:${e.property}`;switch(t){case"Action:type":return T.AbstractType;case"AtomType:refType":return T.AbstractType;case"CrossReference:type":return T.AbstractType;case"Grammar:hiddenTokens":return T.AbstractRule;case"Grammar:usedGrammars":return T.Grammar;case"Interface:superTypes":return T.AbstractType;case"NamedArgument:parameter":return T.Parameter;case"ParameterReference:parameter":return T.Parameter;case"ParserRule:hiddenTokens":return T.AbstractRule;case"ParserRule:returnType":return T.AbstractType;case"RuleCall:rule":return T.AbstractRule;case"TerminalRuleCall:rule":return T.TerminalRule;default:throw new Error(`${t} is not a valid reference id.`)}}getTypeMetaData(e){switch(e){case"Alternatives":return{name:"Alternatives",mandatory:[{name:"elements",type:"array"}]};case"AtomType":return{name:"AtomType",mandatory:[{name:"isArray",type:"boolean"},{name:"isRef",type:"boolean"}]};case"CrossReference":return{name:"CrossReference",mandatory:[{name:"deprecatedSyntax",type:"boolean"}]};case"Grammar":return{name:"Grammar",mandatory:[{name:"definesHiddenTokens",type:"boolean"},{name:"hiddenTokens",type:"array"},{name:"imports",type:"array"},{name:"interfaces",type:"array"},{name:"isDeclared",type:"boolean"},{name:"rules",type:"array"},{name:"types",type:"array"},{name:"usedGrammars",type:"array"}]};case"Group":return{name:"Group",mandatory:[{name:"elements",type:"array"}]};case"Interface":return{name:"Interface",mandatory:[{name:"attributes",type:"array"},{name:"superTypes",type:"array"}]};case"LiteralCondition":return{name:"LiteralCondition",mandatory:[{name:"true",type:"boolean"}]};case"NamedArgument":return{name:"NamedArgument",mandatory:[{name:"calledByName",type:"boolean"}]};case"ParserRule":return{name:"ParserRule",mandatory:[{name:"definesHiddenTokens",type:"boolean"},{name:"entry",type:"boolean"},{name:"fragment",type:"boolean"},{name:"hiddenTokens",type:"array"},{name:"parameters",type:"array"},{name:"wildcard",type:"boolean"}]};case"RuleCall":return{name:"RuleCall",mandatory:[{name:"arguments",type:"array"}]};case"TerminalAlternatives":return{name:"TerminalAlternatives",mandatory:[{name:"elements",type:"array"}]};case"TerminalGroup":return{name:"TerminalGroup",mandatory:[{name:"elements",type:"array"}]};case"TerminalRule":return{name:"TerminalRule",mandatory:[{name:"fragment",type:"boolean"},{name:"hidden",type:"boolean"}]};case"Type":return{name:"Type",mandatory:[{name:"typeAlternatives",type:"array"}]};case"TypeAttribute":return{name:"TypeAttribute",mandatory:[{name:"isOptional",type:"boolean"},{name:"typeAlternatives",type:"array"}]};case"UnorderedGroup":return{name:"UnorderedGroup",mandatory:[{name:"elements",type:"array"}]};default:return{name:e,mandatory:[]}}}};T.LangiumGrammarAstReflection=bu;T.reflection=new bu});var Iv=C(Cu=>{"use strict";Object.defineProperty(Cu,"__esModule",{value:!0});Cu.LangiumGrammarGrammar=void 0;var IS=Pt(),Eu,OS=()=>Eu??(Eu=(0,IS.loadGrammarFromJson)(`{
34
34
  "$type": "Grammar",
35
35
  "isDeclared": true,
36
36
  "name": "LangiumGrammar",
@@ -3566,10 +3566,10 @@ ${JSON.stringify(b,null,4)}`);let O=b;if(Et.string(O.id)||Et.number(O.id)){let j
3566
3566
  "imports": [],
3567
3567
  "interfaces": [],
3568
3568
  "usedGrammars": []
3569
- }`));Pu.LangiumGrammarGrammar=LS});var Mv=C(Un=>{"use strict";Object.defineProperty(Un,"__esModule",{value:!0});Un.LangiumGrammarGeneratedModule=Un.LangiumGrammarGeneratedSharedModule=Un.LangiumGrammarLanguageMetaData=void 0;var FS=ze(),qS=$v();Un.LangiumGrammarLanguageMetaData={languageId:"langium",fileExtensions:[".langium"],caseInsensitive:!1};Un.LangiumGrammarGeneratedSharedModule={AstReflection:()=>new FS.LangiumGrammarAstReflection};Un.LangiumGrammarGeneratedModule={Grammar:()=>(0,qS.LangiumGrammarGrammar)(),LanguageMetaData:()=>Un.LangiumGrammarLanguageMetaData,parser:{}}});var Yr=C(Rt=>{"use strict";Object.defineProperty(Rt,"__esModule",{value:!0});Rt.Deferred=Rt.MutexLock=Rt.interruptAndCheck=Rt.isOperationCancelled=Rt.OperationCancelled=Rt.setInterruptionPeriod=Rt.startCancelableOperation=Rt.delayNextTick=void 0;var ku=pn();function Lv(){return new Promise(r=>{typeof setImmediate>"u"?setTimeout(r,0):setImmediate(r)})}Rt.delayNextTick=Lv;var Gf=0,Fv=10;function jS(){return Gf=Date.now(),new ku.CancellationTokenSource}Rt.startCancelableOperation=jS;function GS(r){Fv=r}Rt.setInterruptionPeriod=GS;Rt.OperationCancelled=Symbol("OperationCancelled");function qv(r){return r===Rt.OperationCancelled}Rt.isOperationCancelled=qv;async function US(r){if(r===ku.CancellationToken.None)return;let e=Date.now();if(e-Gf>=Fv&&(Gf=e,await Lv()),r.isCancellationRequested)throw Rt.OperationCancelled}Rt.interruptAndCheck=US;var Uf=class{constructor(){this.previousAction=Promise.resolve(),this.previousTokenSource=new ku.CancellationTokenSource}lock(e){this.cancel();let t=new ku.CancellationTokenSource;return this.previousTokenSource=t,this.previousAction=this.previousAction.then(()=>e(t.token).catch(n=>{qv(n)||console.error("Error: ",n)}))}cancel(){this.previousTokenSource.cancel()}};Rt.MutexLock=Uf;var Hf=class{constructor(){this.promise=new Promise((e,t)=>{this.resolve=n=>(e(n),this),this.reject=n=>(t(n),this)})}};Rt.Deferred=Hf});var Su=C(xu=>{"use strict";Object.defineProperty(xu,"__esModule",{value:!0});xu.DefaultScopeComputation=void 0;var Wf=pn(),jv=Re(),HS=kr(),Gv=Yr(),Kf=class{constructor(e){this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider}async computeExports(e,t=Wf.CancellationToken.None){return this.computeExportsForNode(e.parseResult.value,e,void 0,t)}async computeExportsForNode(e,t,n=jv.streamContents,i=Wf.CancellationToken.None){let o=[];this.exportNode(e,o,t);for(let a of n(e))await(0,Gv.interruptAndCheck)(i),this.exportNode(a,o,t);return o}exportNode(e,t,n){let i=this.nameProvider.getName(e);i&&t.push(this.descriptions.createDescription(e,i,n))}async computeLocalScopes(e,t=Wf.CancellationToken.None){let n=e.parseResult.value,i=new HS.MultiMap;for(let o of(0,jv.streamAllContents)(n))await(0,Gv.interruptAndCheck)(t),this.processNode(o,e,i);return i}processNode(e,t,n){let i=e.$container;if(i){let o=this.nameProvider.getName(e);o&&n.add(i,this.descriptions.createDescription(e,o,t))}}computeScope(){throw new Error("Deprecated: This method has been renamed to `computeLocalScopes`.")}};xu.DefaultScopeComputation=Kf});var Du=C(fi=>{"use strict";Object.defineProperty(fi,"__esModule",{value:!0});fi.DefaultScopeProvider=fi.EMPTY_SCOPE=fi.StreamScope=void 0;var WS=Re(),Nu=Ct(),ko=class{constructor(e,t,n){this.elements=e,this.outerScope=t,this.caseInsensitive=n?.caseInsensitive}getAllElements(){return this.outerScope?this.elements.concat(this.outerScope.getAllElements()):this.elements}getElement(e){let t=this.caseInsensitive?this.elements.find(n=>n.name.toLowerCase()===e.toLowerCase()):this.elements.find(n=>n.name===e);if(t)return t;if(this.outerScope)return this.outerScope.getElement(e)}};fi.StreamScope=ko;fi.EMPTY_SCOPE={getElement(){},getAllElements(){return Nu.EMPTY_STREAM}};var Bf=class{constructor(e){this.reflection=e.shared.AstReflection,this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider,this.indexManager=e.shared.workspace.IndexManager}getScope(e){let t=[],n=this.reflection.getReferenceType(e),i=(0,WS.getDocument)(e.container).precomputedScopes;if(i){let a=e.container;do{let s=i.get(a);s.length>0&&t.push((0,Nu.stream)(s).filter(u=>this.reflection.isSubtype(u.type,n))),a=a.$container}while(a)}let o=this.getGlobalScope(n);for(let a=t.length-1;a>=0;a--)o=this.createScope(t[a],o);return o}createScope(e,t,n){return new ko((0,Nu.stream)(e),t,n)}createScopeForNodes(e,t,n){let i=(0,Nu.stream)(e).map(o=>{let a=this.nameProvider.getName(o);if(a)return this.descriptions.createDescription(o,a)}).nonNullable();return new ko(i,t,n)}getGlobalScope(e){return new ko(this.indexManager.allElements(e))}};fi.DefaultScopeProvider=Bf});var vn=C((Sa,zf)=>{(function(r,e){if(typeof Sa=="object"&&typeof zf=="object")zf.exports=e();else if(typeof define=="function"&&define.amd)define([],e);else{var t=e();for(var n in t)(typeof Sa=="object"?Sa:r)[n]=t[n]}})(Sa,()=>(()=>{"use strict";var r={470:i=>{function o(u){if(typeof u!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(u))}function a(u,c){for(var l,d="",g=0,y=-1,p=0,A=0;A<=u.length;++A){if(A<u.length)l=u.charCodeAt(A);else{if(l===47)break;l=47}if(l===47){if(!(y===A-1||p===1))if(y!==A-1&&p===2){if(d.length<2||g!==2||d.charCodeAt(d.length-1)!==46||d.charCodeAt(d.length-2)!==46){if(d.length>2){var x=d.lastIndexOf("/");if(x!==d.length-1){x===-1?(d="",g=0):g=(d=d.slice(0,x)).length-1-d.lastIndexOf("/"),y=A,p=0;continue}}else if(d.length===2||d.length===1){d="",g=0,y=A,p=0;continue}}c&&(d.length>0?d+="/..":d="..",g=2)}else d.length>0?d+="/"+u.slice(y+1,A):d=u.slice(y+1,A),g=A-y-1;y=A,p=0}else l===46&&p!==-1?++p:p=-1}return d}var s={resolve:function(){for(var u,c="",l=!1,d=arguments.length-1;d>=-1&&!l;d--){var g;d>=0?g=arguments[d]:(u===void 0&&(u=process.cwd()),g=u),o(g),g.length!==0&&(c=g+"/"+c,l=g.charCodeAt(0)===47)}return c=a(c,!l),l?c.length>0?"/"+c:"/":c.length>0?c:"."},normalize:function(u){if(o(u),u.length===0)return".";var c=u.charCodeAt(0)===47,l=u.charCodeAt(u.length-1)===47;return(u=a(u,!c)).length!==0||c||(u="."),u.length>0&&l&&(u+="/"),c?"/"+u:u},isAbsolute:function(u){return o(u),u.length>0&&u.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var u,c=0;c<arguments.length;++c){var l=arguments[c];o(l),l.length>0&&(u===void 0?u=l:u+="/"+l)}return u===void 0?".":s.normalize(u)},relative:function(u,c){if(o(u),o(c),u===c||(u=s.resolve(u))===(c=s.resolve(c)))return"";for(var l=1;l<u.length&&u.charCodeAt(l)===47;++l);for(var d=u.length,g=d-l,y=1;y<c.length&&c.charCodeAt(y)===47;++y);for(var p=c.length-y,A=g<p?g:p,x=-1,k=0;k<=A;++k){if(k===A){if(p>A){if(c.charCodeAt(y+k)===47)return c.slice(y+k+1);if(k===0)return c.slice(y+k)}else g>A&&(u.charCodeAt(l+k)===47?x=k:k===0&&(x=0));break}var _=u.charCodeAt(l+k);if(_!==c.charCodeAt(y+k))break;_===47&&(x=k)}var R="";for(k=l+x+1;k<=d;++k)k!==d&&u.charCodeAt(k)!==47||(R.length===0?R+="..":R+="/..");return R.length>0?R+c.slice(y+x):(y+=x,c.charCodeAt(y)===47&&++y,c.slice(y))},_makeLong:function(u){return u},dirname:function(u){if(o(u),u.length===0)return".";for(var c=u.charCodeAt(0),l=c===47,d=-1,g=!0,y=u.length-1;y>=1;--y)if((c=u.charCodeAt(y))===47){if(!g){d=y;break}}else g=!1;return d===-1?l?"/":".":l&&d===1?"//":u.slice(0,d)},basename:function(u,c){if(c!==void 0&&typeof c!="string")throw new TypeError('"ext" argument must be a string');o(u);var l,d=0,g=-1,y=!0;if(c!==void 0&&c.length>0&&c.length<=u.length){if(c.length===u.length&&c===u)return"";var p=c.length-1,A=-1;for(l=u.length-1;l>=0;--l){var x=u.charCodeAt(l);if(x===47){if(!y){d=l+1;break}}else A===-1&&(y=!1,A=l+1),p>=0&&(x===c.charCodeAt(p)?--p==-1&&(g=l):(p=-1,g=A))}return d===g?g=A:g===-1&&(g=u.length),u.slice(d,g)}for(l=u.length-1;l>=0;--l)if(u.charCodeAt(l)===47){if(!y){d=l+1;break}}else g===-1&&(y=!1,g=l+1);return g===-1?"":u.slice(d,g)},extname:function(u){o(u);for(var c=-1,l=0,d=-1,g=!0,y=0,p=u.length-1;p>=0;--p){var A=u.charCodeAt(p);if(A!==47)d===-1&&(g=!1,d=p+1),A===46?c===-1?c=p:y!==1&&(y=1):c!==-1&&(y=-1);else if(!g){l=p+1;break}}return c===-1||d===-1||y===0||y===1&&c===d-1&&c===l+1?"":u.slice(c,d)},format:function(u){if(u===null||typeof u!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof u);return function(c,l){var d=l.dir||l.root,g=l.base||(l.name||"")+(l.ext||"");return d?d===l.root?d+g:d+"/"+g:g}(0,u)},parse:function(u){o(u);var c={root:"",dir:"",base:"",ext:"",name:""};if(u.length===0)return c;var l,d=u.charCodeAt(0),g=d===47;g?(c.root="/",l=1):l=0;for(var y=-1,p=0,A=-1,x=!0,k=u.length-1,_=0;k>=l;--k)if((d=u.charCodeAt(k))!==47)A===-1&&(x=!1,A=k+1),d===46?y===-1?y=k:_!==1&&(_=1):y!==-1&&(_=-1);else if(!x){p=k+1;break}return y===-1||A===-1||_===0||_===1&&y===A-1&&y===p+1?A!==-1&&(c.base=c.name=p===0&&g?u.slice(1,A):u.slice(p,A)):(p===0&&g?(c.name=u.slice(1,y),c.base=u.slice(1,A)):(c.name=u.slice(p,y),c.base=u.slice(p,A)),c.ext=u.slice(y,A)),p>0?c.dir=u.slice(0,p-1):g&&(c.dir="/"),c},sep:"/",delimiter:":",win32:null,posix:null};s.posix=s,i.exports=s},674:(i,o)=>{if(Object.defineProperty(o,"__esModule",{value:!0}),o.isWindows=void 0,typeof process=="object")o.isWindows=process.platform==="win32";else if(typeof navigator=="object"){var a=navigator.userAgent;o.isWindows=a.indexOf("Windows")>=0}},796:function(i,o,a){var s,u,c=this&&this.__extends||(s=function(L,M){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(F,K){F.__proto__=K}||function(F,K){for(var pe in K)Object.prototype.hasOwnProperty.call(K,pe)&&(F[pe]=K[pe])},s(L,M)},function(L,M){if(typeof M!="function"&&M!==null)throw new TypeError("Class extends value "+String(M)+" is not a constructor or null");function F(){this.constructor=L}s(L,M),L.prototype=M===null?Object.create(M):(F.prototype=M.prototype,new F)});Object.defineProperty(o,"__esModule",{value:!0}),o.uriToFsPath=o.URI=void 0;var l=a(674),d=/^\w[\w\d+.-]*$/,g=/^\//,y=/^\/\//,p="",A="/",x=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,k=function(){function L(M,F,K,pe,ee,ie){ie===void 0&&(ie=!1),typeof M=="object"?(this.scheme=M.scheme||p,this.authority=M.authority||p,this.path=M.path||p,this.query=M.query||p,this.fragment=M.fragment||p):(this.scheme=function(Ae,Ue){return Ae||Ue?Ae:"file"}(M,ie),this.authority=F||p,this.path=function(Ae,Ue){switch(Ae){case"https":case"http":case"file":Ue?Ue[0]!==A&&(Ue=A+Ue):Ue=A}return Ue}(this.scheme,K||p),this.query=pe||p,this.fragment=ee||p,function(Ae,Ue){if(!Ae.scheme&&Ue)throw new Error('[UriError]: Scheme is missing: {scheme: "", authority: "'.concat(Ae.authority,'", path: "').concat(Ae.path,'", query: "').concat(Ae.query,'", fragment: "').concat(Ae.fragment,'"}'));if(Ae.scheme&&!d.test(Ae.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(Ae.path){if(Ae.authority){if(!g.test(Ae.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(y.test(Ae.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}(this,ie))}return L.isUri=function(M){return M instanceof L||!!M&&typeof M.authority=="string"&&typeof M.fragment=="string"&&typeof M.path=="string"&&typeof M.query=="string"&&typeof M.scheme=="string"&&typeof M.fsPath=="string"&&typeof M.with=="function"&&typeof M.toString=="function"},Object.defineProperty(L.prototype,"fsPath",{get:function(){return G(this,!1)},enumerable:!1,configurable:!0}),L.prototype.with=function(M){if(!M)return this;var F=M.scheme,K=M.authority,pe=M.path,ee=M.query,ie=M.fragment;return F===void 0?F=this.scheme:F===null&&(F=p),K===void 0?K=this.authority:K===null&&(K=p),pe===void 0?pe=this.path:pe===null&&(pe=p),ee===void 0?ee=this.query:ee===null&&(ee=p),ie===void 0?ie=this.fragment:ie===null&&(ie=p),F===this.scheme&&K===this.authority&&pe===this.path&&ee===this.query&&ie===this.fragment?this:new R(F,K,pe,ee,ie)},L.parse=function(M,F){F===void 0&&(F=!1);var K=x.exec(M);return K?new R(K[2]||p,Ge(K[4]||p),Ge(K[5]||p),Ge(K[7]||p),Ge(K[9]||p),F):new R(p,p,p,p,p)},L.file=function(M){var F=p;if(l.isWindows&&(M=M.replace(/\\/g,A)),M[0]===A&&M[1]===A){var K=M.indexOf(A,2);K===-1?(F=M.substring(2),M=A):(F=M.substring(2,K),M=M.substring(K)||A)}return new R("file",F,M,p,p)},L.from=function(M){return new R(M.scheme,M.authority,M.path,M.query,M.fragment)},L.prototype.toString=function(M){return M===void 0&&(M=!1),ge(this,M)},L.prototype.toJSON=function(){return this},L.revive=function(M){if(M){if(M instanceof L)return M;var F=new R(M);return F._formatted=M.external,F._fsPath=M._sep===_?M.fsPath:null,F}return M},L}();o.URI=k;var _=l.isWindows?1:void 0,R=function(L){function M(){var F=L!==null&&L.apply(this,arguments)||this;return F._formatted=null,F._fsPath=null,F}return c(M,L),Object.defineProperty(M.prototype,"fsPath",{get:function(){return this._fsPath||(this._fsPath=G(this,!1)),this._fsPath},enumerable:!1,configurable:!0}),M.prototype.toString=function(F){return F===void 0&&(F=!1),F?ge(this,!0):(this._formatted||(this._formatted=ge(this,!1)),this._formatted)},M.prototype.toJSON=function(){var F={$mid:1};return this._fsPath&&(F.fsPath=this._fsPath,F._sep=_),this._formatted&&(F.external=this._formatted),this.path&&(F.path=this.path),this.scheme&&(F.scheme=this.scheme),this.authority&&(F.authority=this.authority),this.query&&(F.query=this.query),this.fragment&&(F.fragment=this.fragment),F},M}(k),D=((u={})[58]="%3A",u[47]="%2F",u[63]="%3F",u[35]="%23",u[91]="%5B",u[93]="%5D",u[64]="%40",u[33]="%21",u[36]="%24",u[38]="%26",u[39]="%27",u[40]="%28",u[41]="%29",u[42]="%2A",u[43]="%2B",u[44]="%2C",u[59]="%3B",u[61]="%3D",u[32]="%20",u);function B(L,M){for(var F=void 0,K=-1,pe=0;pe<L.length;pe++){var ee=L.charCodeAt(pe);if(ee>=97&&ee<=122||ee>=65&&ee<=90||ee>=48&&ee<=57||ee===45||ee===46||ee===95||ee===126||M&&ee===47)K!==-1&&(F+=encodeURIComponent(L.substring(K,pe)),K=-1),F!==void 0&&(F+=L.charAt(pe));else{F===void 0&&(F=L.substr(0,pe));var ie=D[ee];ie!==void 0?(K!==-1&&(F+=encodeURIComponent(L.substring(K,pe)),K=-1),F+=ie):K===-1&&(K=pe)}}return K!==-1&&(F+=encodeURIComponent(L.substring(K))),F!==void 0?F:L}function V(L){for(var M=void 0,F=0;F<L.length;F++){var K=L.charCodeAt(F);K===35||K===63?(M===void 0&&(M=L.substr(0,F)),M+=D[K]):M!==void 0&&(M+=L[F])}return M!==void 0?M:L}function G(L,M){var F;return F=L.authority&&L.path.length>1&&L.scheme==="file"?"//".concat(L.authority).concat(L.path):L.path.charCodeAt(0)===47&&(L.path.charCodeAt(1)>=65&&L.path.charCodeAt(1)<=90||L.path.charCodeAt(1)>=97&&L.path.charCodeAt(1)<=122)&&L.path.charCodeAt(2)===58?M?L.path.substr(1):L.path[1].toLowerCase()+L.path.substr(2):L.path,l.isWindows&&(F=F.replace(/\//g,"\\")),F}function ge(L,M){var F=M?V:B,K="",pe=L.scheme,ee=L.authority,ie=L.path,Ae=L.query,Ue=L.fragment;if(pe&&(K+=pe,K+=":"),(ee||pe==="file")&&(K+=A,K+=A),ee){var ft=ee.indexOf("@");if(ft!==-1){var ur=ee.substr(0,ft);ee=ee.substr(ft+1),(ft=ur.indexOf(":"))===-1?K+=F(ur,!1):(K+=F(ur.substr(0,ft),!1),K+=":",K+=F(ur.substr(ft+1),!1)),K+="@"}(ft=(ee=ee.toLowerCase()).indexOf(":"))===-1?K+=F(ee,!1):(K+=F(ee.substr(0,ft),!1),K+=ee.substr(ft))}if(ie){if(ie.length>=3&&ie.charCodeAt(0)===47&&ie.charCodeAt(2)===58)(yr=ie.charCodeAt(1))>=65&&yr<=90&&(ie="/".concat(String.fromCharCode(yr+32),":").concat(ie.substr(3)));else if(ie.length>=2&&ie.charCodeAt(1)===58){var yr;(yr=ie.charCodeAt(0))>=65&&yr<=90&&(ie="".concat(String.fromCharCode(yr+32),":").concat(ie.substr(2)))}K+=F(ie,!0)}return Ae&&(K+="?",K+=F(Ae,!1)),Ue&&(K+="#",K+=M?Ue:B(Ue,!1)),K}function je(L){try{return decodeURIComponent(L)}catch{return L.length>3?L.substr(0,3)+je(L.substr(3)):L}}o.uriToFsPath=G;var Ze=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function Ge(L){return L.match(Ze)?L.replace(Ze,function(M){return je(M)}):L}},679:function(i,o,a){var s=this&&this.__spreadArray||function(g,y,p){if(p||arguments.length===2)for(var A,x=0,k=y.length;x<k;x++)!A&&x in y||(A||(A=Array.prototype.slice.call(y,0,x)),A[x]=y[x]);return g.concat(A||Array.prototype.slice.call(y))};Object.defineProperty(o,"__esModule",{value:!0}),o.Utils=void 0;var u,c=a(470),l=c.posix||c,d="/";(u=o.Utils||(o.Utils={})).joinPath=function(g){for(var y=[],p=1;p<arguments.length;p++)y[p-1]=arguments[p];return g.with({path:l.join.apply(l,s([g.path],y,!1))})},u.resolvePath=function(g){for(var y=[],p=1;p<arguments.length;p++)y[p-1]=arguments[p];var A=g.path,x=!1;A[0]!==d&&(A=d+A,x=!0);var k=l.resolve.apply(l,s([A],y,!1));return x&&k[0]===d&&!g.authority&&(k=k.substring(1)),g.with({path:k})},u.dirname=function(g){if(g.path.length===0||g.path===d)return g;var y=l.dirname(g.path);return y.length===1&&y.charCodeAt(0)===46&&(y=""),g.with({path:y})},u.basename=function(g){return l.basename(g.path)},u.extname=function(g){return l.extname(g.path)}}},e={};function t(i){var o=e[i];if(o!==void 0)return o.exports;var a=e[i]={exports:{}};return r[i].call(a.exports,a,a.exports,t),a.exports}var n={};return(()=>{var i=n;Object.defineProperty(i,"__esModule",{value:!0}),i.Utils=i.URI=void 0;var o=t(796);Object.defineProperty(i,"URI",{enumerable:!0,get:function(){return o.URI}});var a=t(679);Object.defineProperty(i,"Utils",{enumerable:!0,get:function(){return a.Utils}})})(),n})())});var Ou=C(xr=>{"use strict";Object.defineProperty(xr,"__esModule",{value:!0});xr.NLEmpty=xr.NL=xr.NewLineNode=xr.IndentNode=xr.CompositeGeneratorNode=void 0;var KS=typeof process>"u"?`
3569
+ }`));Cu.LangiumGrammarGrammar=OS});var Ov=C(Gn=>{"use strict";Object.defineProperty(Gn,"__esModule",{value:!0});Gn.LangiumGrammarGeneratedModule=Gn.LangiumGrammarGeneratedSharedModule=Gn.LangiumGrammarLanguageMetaData=void 0;var $S=ze(),MS=Iv();Gn.LangiumGrammarLanguageMetaData={languageId:"langium",fileExtensions:[".langium"],caseInsensitive:!1};Gn.LangiumGrammarGeneratedSharedModule={AstReflection:()=>new $S.LangiumGrammarAstReflection};Gn.LangiumGrammarGeneratedModule={Grammar:()=>(0,MS.LangiumGrammarGrammar)(),LanguageMetaData:()=>Gn.LangiumGrammarLanguageMetaData,parser:{}}});var Yr=C(Rt=>{"use strict";Object.defineProperty(Rt,"__esModule",{value:!0});Rt.Deferred=Rt.MutexLock=Rt.interruptAndCheck=Rt.isOperationCancelled=Rt.OperationCancelled=Rt.setInterruptionPeriod=Rt.startCancelableOperation=Rt.delayNextTick=void 0;var Pu=pn();function $v(){return new Promise(r=>{typeof setImmediate>"u"?setTimeout(r,0):setImmediate(r)})}Rt.delayNextTick=$v;var qf=0,Mv=10;function LS(){return qf=Date.now(),new Pu.CancellationTokenSource}Rt.startCancelableOperation=LS;function FS(r){Mv=r}Rt.setInterruptionPeriod=FS;Rt.OperationCancelled=Symbol("OperationCancelled");function Lv(r){return r===Rt.OperationCancelled}Rt.isOperationCancelled=Lv;async function qS(r){if(r===Pu.CancellationToken.None)return;let e=Date.now();if(e-qf>=Mv&&(qf=e,await $v()),r.isCancellationRequested)throw Rt.OperationCancelled}Rt.interruptAndCheck=qS;var jf=class{constructor(){this.previousAction=Promise.resolve(),this.previousTokenSource=new Pu.CancellationTokenSource}lock(e){this.cancel();let t=new Pu.CancellationTokenSource;return this.previousTokenSource=t,this.previousAction=this.previousAction.then(()=>e(t.token).catch(n=>{Lv(n)||console.error("Error: ",n)}))}cancel(){this.previousTokenSource.cancel()}};Rt.MutexLock=jf;var Gf=class{constructor(){this.promise=new Promise((e,t)=>{this.resolve=n=>(e(n),this),this.reject=n=>(t(n),this)})}};Rt.Deferred=Gf});var xu=C(ku=>{"use strict";Object.defineProperty(ku,"__esModule",{value:!0});ku.DefaultScopeComputation=void 0;var Uf=pn(),Fv=Re(),jS=kr(),qv=Yr(),Hf=class{constructor(e){this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider}async computeExports(e,t=Uf.CancellationToken.None){return this.computeExportsForNode(e.parseResult.value,e,void 0,t)}async computeExportsForNode(e,t,n=Fv.streamContents,i=Uf.CancellationToken.None){let o=[];this.exportNode(e,o,t);for(let a of n(e))await(0,qv.interruptAndCheck)(i),this.exportNode(a,o,t);return o}exportNode(e,t,n){let i=this.nameProvider.getName(e);i&&t.push(this.descriptions.createDescription(e,i,n))}async computeLocalScopes(e,t=Uf.CancellationToken.None){let n=e.parseResult.value,i=new jS.MultiMap;for(let o of(0,Fv.streamAllContents)(n))await(0,qv.interruptAndCheck)(t),this.processNode(o,e,i);return i}processNode(e,t,n){let i=e.$container;if(i){let o=this.nameProvider.getName(e);o&&n.add(i,this.descriptions.createDescription(e,o,t))}}computeScope(){throw new Error("Deprecated: This method has been renamed to `computeLocalScopes`.")}};ku.DefaultScopeComputation=Hf});var Nu=C(fi=>{"use strict";Object.defineProperty(fi,"__esModule",{value:!0});fi.DefaultScopeProvider=fi.EMPTY_SCOPE=fi.StreamScope=void 0;var GS=Re(),Su=Ct(),ko=class{constructor(e,t,n){this.elements=e,this.outerScope=t,this.caseInsensitive=n?.caseInsensitive}getAllElements(){return this.outerScope?this.elements.concat(this.outerScope.getAllElements()):this.elements}getElement(e){let t=this.caseInsensitive?this.elements.find(n=>n.name.toLowerCase()===e.toLowerCase()):this.elements.find(n=>n.name===e);if(t)return t;if(this.outerScope)return this.outerScope.getElement(e)}};fi.StreamScope=ko;fi.EMPTY_SCOPE={getElement(){},getAllElements(){return Su.EMPTY_STREAM}};var Wf=class{constructor(e){this.reflection=e.shared.AstReflection,this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider,this.indexManager=e.shared.workspace.IndexManager}getScope(e){let t=[],n=this.reflection.getReferenceType(e),i=(0,GS.getDocument)(e.container).precomputedScopes;if(i){let a=e.container;do{let s=i.get(a);s.length>0&&t.push((0,Su.stream)(s).filter(u=>this.reflection.isSubtype(u.type,n))),a=a.$container}while(a)}let o=this.getGlobalScope(n);for(let a=t.length-1;a>=0;a--)o=this.createScope(t[a],o);return o}createScope(e,t,n){return new ko((0,Su.stream)(e),t,n)}createScopeForNodes(e,t,n){let i=(0,Su.stream)(e).map(o=>{let a=this.nameProvider.getName(o);if(a)return this.descriptions.createDescription(o,a)}).nonNullable();return new ko(i,t,n)}getGlobalScope(e){return new ko(this.indexManager.allElements(e))}};fi.DefaultScopeProvider=Wf});var vn=C((Sa,Kf)=>{(function(r,e){if(typeof Sa=="object"&&typeof Kf=="object")Kf.exports=e();else if(typeof define=="function"&&define.amd)define([],e);else{var t=e();for(var n in t)(typeof Sa=="object"?Sa:r)[n]=t[n]}})(Sa,()=>(()=>{"use strict";var r={470:i=>{function o(u){if(typeof u!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(u))}function a(u,c){for(var l,d="",g=0,y=-1,p=0,A=0;A<=u.length;++A){if(A<u.length)l=u.charCodeAt(A);else{if(l===47)break;l=47}if(l===47){if(!(y===A-1||p===1))if(y!==A-1&&p===2){if(d.length<2||g!==2||d.charCodeAt(d.length-1)!==46||d.charCodeAt(d.length-2)!==46){if(d.length>2){var x=d.lastIndexOf("/");if(x!==d.length-1){x===-1?(d="",g=0):g=(d=d.slice(0,x)).length-1-d.lastIndexOf("/"),y=A,p=0;continue}}else if(d.length===2||d.length===1){d="",g=0,y=A,p=0;continue}}c&&(d.length>0?d+="/..":d="..",g=2)}else d.length>0?d+="/"+u.slice(y+1,A):d=u.slice(y+1,A),g=A-y-1;y=A,p=0}else l===46&&p!==-1?++p:p=-1}return d}var s={resolve:function(){for(var u,c="",l=!1,d=arguments.length-1;d>=-1&&!l;d--){var g;d>=0?g=arguments[d]:(u===void 0&&(u=process.cwd()),g=u),o(g),g.length!==0&&(c=g+"/"+c,l=g.charCodeAt(0)===47)}return c=a(c,!l),l?c.length>0?"/"+c:"/":c.length>0?c:"."},normalize:function(u){if(o(u),u.length===0)return".";var c=u.charCodeAt(0)===47,l=u.charCodeAt(u.length-1)===47;return(u=a(u,!c)).length!==0||c||(u="."),u.length>0&&l&&(u+="/"),c?"/"+u:u},isAbsolute:function(u){return o(u),u.length>0&&u.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var u,c=0;c<arguments.length;++c){var l=arguments[c];o(l),l.length>0&&(u===void 0?u=l:u+="/"+l)}return u===void 0?".":s.normalize(u)},relative:function(u,c){if(o(u),o(c),u===c||(u=s.resolve(u))===(c=s.resolve(c)))return"";for(var l=1;l<u.length&&u.charCodeAt(l)===47;++l);for(var d=u.length,g=d-l,y=1;y<c.length&&c.charCodeAt(y)===47;++y);for(var p=c.length-y,A=g<p?g:p,x=-1,k=0;k<=A;++k){if(k===A){if(p>A){if(c.charCodeAt(y+k)===47)return c.slice(y+k+1);if(k===0)return c.slice(y+k)}else g>A&&(u.charCodeAt(l+k)===47?x=k:k===0&&(x=0));break}var _=u.charCodeAt(l+k);if(_!==c.charCodeAt(y+k))break;_===47&&(x=k)}var R="";for(k=l+x+1;k<=d;++k)k!==d&&u.charCodeAt(k)!==47||(R.length===0?R+="..":R+="/..");return R.length>0?R+c.slice(y+x):(y+=x,c.charCodeAt(y)===47&&++y,c.slice(y))},_makeLong:function(u){return u},dirname:function(u){if(o(u),u.length===0)return".";for(var c=u.charCodeAt(0),l=c===47,d=-1,g=!0,y=u.length-1;y>=1;--y)if((c=u.charCodeAt(y))===47){if(!g){d=y;break}}else g=!1;return d===-1?l?"/":".":l&&d===1?"//":u.slice(0,d)},basename:function(u,c){if(c!==void 0&&typeof c!="string")throw new TypeError('"ext" argument must be a string');o(u);var l,d=0,g=-1,y=!0;if(c!==void 0&&c.length>0&&c.length<=u.length){if(c.length===u.length&&c===u)return"";var p=c.length-1,A=-1;for(l=u.length-1;l>=0;--l){var x=u.charCodeAt(l);if(x===47){if(!y){d=l+1;break}}else A===-1&&(y=!1,A=l+1),p>=0&&(x===c.charCodeAt(p)?--p==-1&&(g=l):(p=-1,g=A))}return d===g?g=A:g===-1&&(g=u.length),u.slice(d,g)}for(l=u.length-1;l>=0;--l)if(u.charCodeAt(l)===47){if(!y){d=l+1;break}}else g===-1&&(y=!1,g=l+1);return g===-1?"":u.slice(d,g)},extname:function(u){o(u);for(var c=-1,l=0,d=-1,g=!0,y=0,p=u.length-1;p>=0;--p){var A=u.charCodeAt(p);if(A!==47)d===-1&&(g=!1,d=p+1),A===46?c===-1?c=p:y!==1&&(y=1):c!==-1&&(y=-1);else if(!g){l=p+1;break}}return c===-1||d===-1||y===0||y===1&&c===d-1&&c===l+1?"":u.slice(c,d)},format:function(u){if(u===null||typeof u!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof u);return function(c,l){var d=l.dir||l.root,g=l.base||(l.name||"")+(l.ext||"");return d?d===l.root?d+g:d+"/"+g:g}(0,u)},parse:function(u){o(u);var c={root:"",dir:"",base:"",ext:"",name:""};if(u.length===0)return c;var l,d=u.charCodeAt(0),g=d===47;g?(c.root="/",l=1):l=0;for(var y=-1,p=0,A=-1,x=!0,k=u.length-1,_=0;k>=l;--k)if((d=u.charCodeAt(k))!==47)A===-1&&(x=!1,A=k+1),d===46?y===-1?y=k:_!==1&&(_=1):y!==-1&&(_=-1);else if(!x){p=k+1;break}return y===-1||A===-1||_===0||_===1&&y===A-1&&y===p+1?A!==-1&&(c.base=c.name=p===0&&g?u.slice(1,A):u.slice(p,A)):(p===0&&g?(c.name=u.slice(1,y),c.base=u.slice(1,A)):(c.name=u.slice(p,y),c.base=u.slice(p,A)),c.ext=u.slice(y,A)),p>0?c.dir=u.slice(0,p-1):g&&(c.dir="/"),c},sep:"/",delimiter:":",win32:null,posix:null};s.posix=s,i.exports=s},674:(i,o)=>{if(Object.defineProperty(o,"__esModule",{value:!0}),o.isWindows=void 0,typeof process=="object")o.isWindows=process.platform==="win32";else if(typeof navigator=="object"){var a=navigator.userAgent;o.isWindows=a.indexOf("Windows")>=0}},796:function(i,o,a){var s,u,c=this&&this.__extends||(s=function(L,M){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(F,K){F.__proto__=K}||function(F,K){for(var pe in K)Object.prototype.hasOwnProperty.call(K,pe)&&(F[pe]=K[pe])},s(L,M)},function(L,M){if(typeof M!="function"&&M!==null)throw new TypeError("Class extends value "+String(M)+" is not a constructor or null");function F(){this.constructor=L}s(L,M),L.prototype=M===null?Object.create(M):(F.prototype=M.prototype,new F)});Object.defineProperty(o,"__esModule",{value:!0}),o.uriToFsPath=o.URI=void 0;var l=a(674),d=/^\w[\w\d+.-]*$/,g=/^\//,y=/^\/\//,p="",A="/",x=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,k=function(){function L(M,F,K,pe,ee,ie){ie===void 0&&(ie=!1),typeof M=="object"?(this.scheme=M.scheme||p,this.authority=M.authority||p,this.path=M.path||p,this.query=M.query||p,this.fragment=M.fragment||p):(this.scheme=function(Ae,Ue){return Ae||Ue?Ae:"file"}(M,ie),this.authority=F||p,this.path=function(Ae,Ue){switch(Ae){case"https":case"http":case"file":Ue?Ue[0]!==A&&(Ue=A+Ue):Ue=A}return Ue}(this.scheme,K||p),this.query=pe||p,this.fragment=ee||p,function(Ae,Ue){if(!Ae.scheme&&Ue)throw new Error('[UriError]: Scheme is missing: {scheme: "", authority: "'.concat(Ae.authority,'", path: "').concat(Ae.path,'", query: "').concat(Ae.query,'", fragment: "').concat(Ae.fragment,'"}'));if(Ae.scheme&&!d.test(Ae.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(Ae.path){if(Ae.authority){if(!g.test(Ae.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(y.test(Ae.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}(this,ie))}return L.isUri=function(M){return M instanceof L||!!M&&typeof M.authority=="string"&&typeof M.fragment=="string"&&typeof M.path=="string"&&typeof M.query=="string"&&typeof M.scheme=="string"&&typeof M.fsPath=="string"&&typeof M.with=="function"&&typeof M.toString=="function"},Object.defineProperty(L.prototype,"fsPath",{get:function(){return G(this,!1)},enumerable:!1,configurable:!0}),L.prototype.with=function(M){if(!M)return this;var F=M.scheme,K=M.authority,pe=M.path,ee=M.query,ie=M.fragment;return F===void 0?F=this.scheme:F===null&&(F=p),K===void 0?K=this.authority:K===null&&(K=p),pe===void 0?pe=this.path:pe===null&&(pe=p),ee===void 0?ee=this.query:ee===null&&(ee=p),ie===void 0?ie=this.fragment:ie===null&&(ie=p),F===this.scheme&&K===this.authority&&pe===this.path&&ee===this.query&&ie===this.fragment?this:new R(F,K,pe,ee,ie)},L.parse=function(M,F){F===void 0&&(F=!1);var K=x.exec(M);return K?new R(K[2]||p,Ge(K[4]||p),Ge(K[5]||p),Ge(K[7]||p),Ge(K[9]||p),F):new R(p,p,p,p,p)},L.file=function(M){var F=p;if(l.isWindows&&(M=M.replace(/\\/g,A)),M[0]===A&&M[1]===A){var K=M.indexOf(A,2);K===-1?(F=M.substring(2),M=A):(F=M.substring(2,K),M=M.substring(K)||A)}return new R("file",F,M,p,p)},L.from=function(M){return new R(M.scheme,M.authority,M.path,M.query,M.fragment)},L.prototype.toString=function(M){return M===void 0&&(M=!1),ge(this,M)},L.prototype.toJSON=function(){return this},L.revive=function(M){if(M){if(M instanceof L)return M;var F=new R(M);return F._formatted=M.external,F._fsPath=M._sep===_?M.fsPath:null,F}return M},L}();o.URI=k;var _=l.isWindows?1:void 0,R=function(L){function M(){var F=L!==null&&L.apply(this,arguments)||this;return F._formatted=null,F._fsPath=null,F}return c(M,L),Object.defineProperty(M.prototype,"fsPath",{get:function(){return this._fsPath||(this._fsPath=G(this,!1)),this._fsPath},enumerable:!1,configurable:!0}),M.prototype.toString=function(F){return F===void 0&&(F=!1),F?ge(this,!0):(this._formatted||(this._formatted=ge(this,!1)),this._formatted)},M.prototype.toJSON=function(){var F={$mid:1};return this._fsPath&&(F.fsPath=this._fsPath,F._sep=_),this._formatted&&(F.external=this._formatted),this.path&&(F.path=this.path),this.scheme&&(F.scheme=this.scheme),this.authority&&(F.authority=this.authority),this.query&&(F.query=this.query),this.fragment&&(F.fragment=this.fragment),F},M}(k),D=((u={})[58]="%3A",u[47]="%2F",u[63]="%3F",u[35]="%23",u[91]="%5B",u[93]="%5D",u[64]="%40",u[33]="%21",u[36]="%24",u[38]="%26",u[39]="%27",u[40]="%28",u[41]="%29",u[42]="%2A",u[43]="%2B",u[44]="%2C",u[59]="%3B",u[61]="%3D",u[32]="%20",u);function B(L,M){for(var F=void 0,K=-1,pe=0;pe<L.length;pe++){var ee=L.charCodeAt(pe);if(ee>=97&&ee<=122||ee>=65&&ee<=90||ee>=48&&ee<=57||ee===45||ee===46||ee===95||ee===126||M&&ee===47)K!==-1&&(F+=encodeURIComponent(L.substring(K,pe)),K=-1),F!==void 0&&(F+=L.charAt(pe));else{F===void 0&&(F=L.substr(0,pe));var ie=D[ee];ie!==void 0?(K!==-1&&(F+=encodeURIComponent(L.substring(K,pe)),K=-1),F+=ie):K===-1&&(K=pe)}}return K!==-1&&(F+=encodeURIComponent(L.substring(K))),F!==void 0?F:L}function V(L){for(var M=void 0,F=0;F<L.length;F++){var K=L.charCodeAt(F);K===35||K===63?(M===void 0&&(M=L.substr(0,F)),M+=D[K]):M!==void 0&&(M+=L[F])}return M!==void 0?M:L}function G(L,M){var F;return F=L.authority&&L.path.length>1&&L.scheme==="file"?"//".concat(L.authority).concat(L.path):L.path.charCodeAt(0)===47&&(L.path.charCodeAt(1)>=65&&L.path.charCodeAt(1)<=90||L.path.charCodeAt(1)>=97&&L.path.charCodeAt(1)<=122)&&L.path.charCodeAt(2)===58?M?L.path.substr(1):L.path[1].toLowerCase()+L.path.substr(2):L.path,l.isWindows&&(F=F.replace(/\//g,"\\")),F}function ge(L,M){var F=M?V:B,K="",pe=L.scheme,ee=L.authority,ie=L.path,Ae=L.query,Ue=L.fragment;if(pe&&(K+=pe,K+=":"),(ee||pe==="file")&&(K+=A,K+=A),ee){var ft=ee.indexOf("@");if(ft!==-1){var ur=ee.substr(0,ft);ee=ee.substr(ft+1),(ft=ur.indexOf(":"))===-1?K+=F(ur,!1):(K+=F(ur.substr(0,ft),!1),K+=":",K+=F(ur.substr(ft+1),!1)),K+="@"}(ft=(ee=ee.toLowerCase()).indexOf(":"))===-1?K+=F(ee,!1):(K+=F(ee.substr(0,ft),!1),K+=ee.substr(ft))}if(ie){if(ie.length>=3&&ie.charCodeAt(0)===47&&ie.charCodeAt(2)===58)(yr=ie.charCodeAt(1))>=65&&yr<=90&&(ie="/".concat(String.fromCharCode(yr+32),":").concat(ie.substr(3)));else if(ie.length>=2&&ie.charCodeAt(1)===58){var yr;(yr=ie.charCodeAt(0))>=65&&yr<=90&&(ie="".concat(String.fromCharCode(yr+32),":").concat(ie.substr(2)))}K+=F(ie,!0)}return Ae&&(K+="?",K+=F(Ae,!1)),Ue&&(K+="#",K+=M?Ue:B(Ue,!1)),K}function je(L){try{return decodeURIComponent(L)}catch{return L.length>3?L.substr(0,3)+je(L.substr(3)):L}}o.uriToFsPath=G;var Ze=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function Ge(L){return L.match(Ze)?L.replace(Ze,function(M){return je(M)}):L}},679:function(i,o,a){var s=this&&this.__spreadArray||function(g,y,p){if(p||arguments.length===2)for(var A,x=0,k=y.length;x<k;x++)!A&&x in y||(A||(A=Array.prototype.slice.call(y,0,x)),A[x]=y[x]);return g.concat(A||Array.prototype.slice.call(y))};Object.defineProperty(o,"__esModule",{value:!0}),o.Utils=void 0;var u,c=a(470),l=c.posix||c,d="/";(u=o.Utils||(o.Utils={})).joinPath=function(g){for(var y=[],p=1;p<arguments.length;p++)y[p-1]=arguments[p];return g.with({path:l.join.apply(l,s([g.path],y,!1))})},u.resolvePath=function(g){for(var y=[],p=1;p<arguments.length;p++)y[p-1]=arguments[p];var A=g.path,x=!1;A[0]!==d&&(A=d+A,x=!0);var k=l.resolve.apply(l,s([A],y,!1));return x&&k[0]===d&&!g.authority&&(k=k.substring(1)),g.with({path:k})},u.dirname=function(g){if(g.path.length===0||g.path===d)return g;var y=l.dirname(g.path);return y.length===1&&y.charCodeAt(0)===46&&(y=""),g.with({path:y})},u.basename=function(g){return l.basename(g.path)},u.extname=function(g){return l.extname(g.path)}}},e={};function t(i){var o=e[i];if(o!==void 0)return o.exports;var a=e[i]={exports:{}};return r[i].call(a.exports,a,a.exports,t),a.exports}var n={};return(()=>{var i=n;Object.defineProperty(i,"__esModule",{value:!0}),i.Utils=i.URI=void 0;var o=t(796);Object.defineProperty(i,"URI",{enumerable:!0,get:function(){return o.URI}});var a=t(679);Object.defineProperty(i,"Utils",{enumerable:!0,get:function(){return a.Utils}})})(),n})())});var Iu=C(xr=>{"use strict";Object.defineProperty(xr,"__esModule",{value:!0});xr.NLEmpty=xr.NL=xr.NewLineNode=xr.IndentNode=xr.CompositeGeneratorNode=void 0;var US=typeof process>"u"?`
3570
3570
  `:process.platform==="win32"?`\r
3571
3571
  `:`
3572
- `,wu=class{constructor(...e){this.contents=[],this.append(...e)}append(...e){for(let t of e)typeof t=="function"?t(this):this.contents.push(t);return this}indent(e){let t=new Iu;return this.contents.push(t),e&&e(t),this}};xr.CompositeGeneratorNode=wu;var Iu=class extends wu{constructor(e,t=!0,n=!1){super(),this.indentImmediately=!0,this.indentEmptyLines=!1,typeof e=="string"?this.indentation=e:typeof e=="number"&&(this.indentation="".padStart(e)),this.indentImmediately=t,this.indentEmptyLines=n}};xr.IndentNode=Iu;var Na=class{constructor(e,t=!1){this.ifNotEmpty=!1,this.lineDelimiter=e??KS,this.ifNotEmpty=t}};xr.NewLineNode=Na;xr.NL=new Na;xr.NLEmpty=new Na(void 0,!0)});var Yf=C($u=>{"use strict";Object.defineProperty($u,"__esModule",{value:!0});$u.processGeneratorNode=void 0;var Da=Ou(),Vf=class{constructor(e){this.defaultIndentation=" ",this.pendingIndent=!0,this.currentIndents=[],this.lines=[[]],typeof e=="string"?this.defaultIndentation=e:typeof e=="number"&&(this.defaultIndentation="".padStart(e))}get content(){return this.lines.map(e=>e.join("")).join("")}get currentLineNumber(){return this.lines.length-1}get currentLineContent(){return this.lines[this.currentLineNumber].join("")}append(e){e.length>0&&this.lines[this.currentLineNumber].push(e)}increaseIndent(e){this.currentIndents.push(e)}decreaseIndent(){this.currentIndents.pop()}resetCurrentLine(){this.lines[this.currentLineNumber]=[]}addNewLine(){this.pendingIndent=!0,this.lines.push([])}};function BS(r,e){let t=new Vf(e);return Uv(r,t),t.content}$u.processGeneratorNode=BS;function Uv(r,e){typeof r=="string"?zS(r,e):r instanceof Da.IndentNode?VS(r,e):r instanceof Da.CompositeGeneratorNode?Kv(r,e):r instanceof Da.NewLineNode&&YS(r,e)}function Hv(r,e){return typeof r=="string"?Bv(r):r instanceof Da.CompositeGeneratorNode?r.contents.some(t=>Hv(t,e)):r instanceof Da.NewLineNode?!(r.ifNotEmpty&&e.currentLineContent.length===0):!1}function zS(r,e){r&&(e.pendingIndent&&Wv(e,!1),e.append(r))}function Wv(r,e){var t;let n="";for(let i of r.currentIndents.filter(o=>o.indentEmptyLines||!e))n+=(t=i.indentation)!==null&&t!==void 0?t:r.defaultIndentation;r.append(n),r.pendingIndent=!1}function Kv(r,e){for(let t of r.contents)Uv(t,e)}function VS(r,e){var t;if(Hv(r,e)){r.indentImmediately&&!e.pendingIndent&&e.append((t=r.indentation)!==null&&t!==void 0?t:e.defaultIndentation);try{e.increaseIndent(r),Kv(r,e)}finally{e.decreaseIndent()}}}function YS(r,e){r.ifNotEmpty&&!Bv(e.currentLineContent)?e.resetCurrentLine():(e.pendingIndent&&Wv(e,!0),e.append(r.lineDelimiter),e.addNewLine())}function Bv(r){return r.trimStart()!==""}});var mi=C(lt=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.collectSuperTypes=lt.collectChildrenTypes=lt.typePropertyToString=lt.distinctAndSorted=lt.propertyTypeArrayToString=lt.collectAllAstResources=lt.collectAllProperties=lt.TypeResolutionError=lt.InterfaceType=lt.UnionType=void 0;var ir=Ou(),Vv=Yf(),XS=Re(),JS=kr(),pi=ze(),zv=Ft(),Xf=class{constructor(e,t,n){var i;this.superTypes=new Set,this.name=e,this.union=t,this.reflection=(i=n?.reflection)!==null&&i!==void 0?i:!1}toString(){let e=new ir.CompositeGeneratorNode;return e.contents.push(`export type ${this.name} = ${ep(this.union)};`,ir.NL),this.reflection&&Jv(this.name,e),(0,Vv.processGeneratorNode)(e)}};lt.UnionType=Xf;var Jf=class{constructor(e,t,n){this.superTypes=new Set,this.interfaceSuperTypes=[],this.subTypes=new Set,this.containerTypes=new Set,this.name=e,this.superTypes=new Set(t),this.interfaceSuperTypes=[...t],this.properties=n}toString(){let e=new ir.CompositeGeneratorNode,t=this.interfaceSuperTypes.length>0?xo([...this.interfaceSuperTypes]):["AstNode"];e.contents.push(`export interface ${this.name} extends ${t.join(", ")} {`,ir.NL);let n=new ir.IndentNode;this.containerTypes.size>0&&n.contents.push(`readonly $container: ${xo([...this.containerTypes]).join(" | ")};`,ir.NL);for(let i of xo(this.properties,(o,a)=>o.name.localeCompare(a.name))){let o=i.optional&&!i.typeAlternatives.some(s=>s.array)&&!i.typeAlternatives.every(s=>s.types.length===1&&s.types[0]==="boolean")?"?":"",a=ep(i.typeAlternatives);n.contents.push(`${i.name}${o}: ${a}`,ir.NL)}return e.contents.push(n,"}",ir.NL),Jv(this.name,e),(0,Vv.processGeneratorNode)(e)}};lt.InterfaceType=Jf;var Zf=class extends Error{constructor(e,t){super(e),this.name="TypeResolutionError",this.target=t}};lt.TypeResolutionError=Zf;function ZS(r){let e=new JS.MultiMap;for(let t of r)e.addAll(t.name,t.properties);for(let t of r)for(let n of t.interfaceSuperTypes){let i=e.get(n);i&&e.addAll(t.name,i)}return e}lt.collectAllProperties=ZS;function Yv(r,e,t=new Set,n={parserRules:new Set,datatypeRules:new Set,interfaces:new Set,types:new Set}){for(let i of r){let o=(0,XS.getDocument)(i);if(!t.has(o.uri)){t.add(o.uri);for(let a of i.rules)(0,pi.isParserRule)(a)&&!a.fragment&&((0,zv.isDataTypeRule)(a)?n.datatypeRules.add(a):n.parserRules.add(a));if(i.interfaces.forEach(a=>n.interfaces.add(a)),i.types.forEach(a=>n.types.add(a)),e){let a=i.imports.map(s=>(0,zv.resolveImport)(e,s));Yv(a,e,t,n)}}}return n}lt.collectAllAstResources=Yv;function ep(r){return xo(r.map(Xv)).join(" | ")}lt.propertyTypeArrayToString=ep;function xo(r,e){return Array.from(new Set(r)).sort(e)}lt.distinctAndSorted=xo;function Xv(r){let e=xo(r.types).join(" | ");return e=r.reference?`Reference<${e}>`:e,e=r.array?`Array<${e}>`:e,e}lt.typePropertyToString=Xv;function Jv(r,e){e.contents.push(ir.NL,`export const ${r} = '${r}';`,ir.NL,ir.NL),e.contents.push(`export function is${r}(item: unknown): item is ${r} {`,ir.NL);let t=new ir.IndentNode;t.contents.push(`return reflection.isInstance(item, ${r});`,ir.NL),e.contents.push(t,"}",ir.NL)}function Zv(r,e,t,n){let i=new Set;return i.add(r),e.findReferences(r,{}).forEach(a=>{let s=t.getOrCreateDocument(a.sourceUri),u=n.getAstNode(s,a.sourcePath);(0,pi.isInterface)(u)?(i.add(u),Zv(u,e,t,n).forEach(l=>i.add(l))):u&&(0,pi.isType)(u.$container)&&i.add(u.$container)}),i}lt.collectChildrenTypes=Zv;function Qf(r){let e=new Set;return(0,pi.isInterface)(r)?(e.add(r),r.superTypes.forEach(t=>{if((0,pi.isInterface)(t.ref)){e.add(t.ref);let n=Qf(t.ref);for(let i of n)e.add(i)}})):(0,pi.isType)(r)&&r.typeAlternatives.forEach(t=>{var n;if(!((n=t.refType)===null||n===void 0)&&n.ref&&((0,pi.isInterface)(t.refType.ref)||(0,pi.isType)(t.refType.ref))){let i=Qf(t.refType.ref);for(let o of i)e.add(o)}}),e}lt.collectSuperTypes=Qf});var wa=C((Qv,Mu)=>{(function(r,e){typeof define=="function"&&define.amd?define([],e):typeof Mu=="object"&&Mu.exports?Mu.exports=e():r.regexpToAst=e()})(typeof self<"u"?self:Qv,function(){function r(){}r.prototype.saveState=function(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}},r.prototype.restoreState=function(p){this.idx=p.idx,this.input=p.input,this.groupIdx=p.groupIdx},r.prototype.pattern=function(p){this.idx=0,this.input=p,this.groupIdx=0,this.consumeChar("/");var A=this.disjunction();this.consumeChar("/");for(var x={type:"Flags",loc:{begin:this.idx,end:p.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};this.isRegExpFlag();)switch(this.popChar()){case"g":a(x,"global");break;case"i":a(x,"ignoreCase");break;case"m":a(x,"multiLine");break;case"u":a(x,"unicode");break;case"y":a(x,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:x,value:A,loc:this.loc(0)}},r.prototype.disjunction=function(){var p=[],A=this.idx;for(p.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),p.push(this.alternative());return{type:"Disjunction",value:p,loc:this.loc(A)}},r.prototype.alternative=function(){for(var p=[],A=this.idx;this.isTerm();)p.push(this.term());return{type:"Alternative",value:p,loc:this.loc(A)}},r.prototype.term=function(){return this.isAssertion()?this.assertion():this.atom()},r.prototype.assertion=function(){var p=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(p)};case"$":return{type:"EndAnchor",loc:this.loc(p)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(p)};case"B":return{type:"NonWordBoundary",loc:this.loc(p)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");var A;switch(this.popChar()){case"=":A="Lookahead";break;case"!":A="NegativeLookahead";break}s(A);var x=this.disjunction();return this.consumeChar(")"),{type:A,value:x,loc:this.loc(p)}}u()},r.prototype.quantifier=function(p){var A,x=this.idx;switch(this.popChar()){case"*":A={atLeast:0,atMost:1/0};break;case"+":A={atLeast:1,atMost:1/0};break;case"?":A={atLeast:0,atMost:1};break;case"{":var k=this.integerIncludingZero();switch(this.popChar()){case"}":A={atLeast:k,atMost:k};break;case",":var _;this.isDigit()?(_=this.integerIncludingZero(),A={atLeast:k,atMost:_}):A={atLeast:k,atMost:1/0},this.consumeChar("}");break}if(p===!0&&A===void 0)return;s(A);break}if(!(p===!0&&A===void 0))return s(A),this.peekChar(0)==="?"?(this.consumeChar("?"),A.greedy=!1):A.greedy=!0,A.type="Quantifier",A.loc=this.loc(x),A},r.prototype.atom=function(){var p,A=this.idx;switch(this.peekChar()){case".":p=this.dotAll();break;case"\\":p=this.atomEscape();break;case"[":p=this.characterClass();break;case"(":p=this.group();break}return p===void 0&&this.isPatternCharacter()&&(p=this.patternCharacter()),s(p),p.loc=this.loc(A),this.isQuantifier()&&(p.quantifier=this.quantifier()),p},r.prototype.dotAll=function(){return this.consumeChar("."),{type:"Set",complement:!0,value:[i(`
3572
+ `,Du=class{constructor(...e){this.contents=[],this.append(...e)}append(...e){for(let t of e)typeof t=="function"?t(this):this.contents.push(t);return this}indent(e){let t=new wu;return this.contents.push(t),e&&e(t),this}};xr.CompositeGeneratorNode=Du;var wu=class extends Du{constructor(e,t=!0,n=!1){super(),this.indentImmediately=!0,this.indentEmptyLines=!1,typeof e=="string"?this.indentation=e:typeof e=="number"&&(this.indentation="".padStart(e)),this.indentImmediately=t,this.indentEmptyLines=n}};xr.IndentNode=wu;var Na=class{constructor(e,t=!1){this.ifNotEmpty=!1,this.lineDelimiter=e??US,this.ifNotEmpty=t}};xr.NewLineNode=Na;xr.NL=new Na;xr.NLEmpty=new Na(void 0,!0)});var zf=C(Ou=>{"use strict";Object.defineProperty(Ou,"__esModule",{value:!0});Ou.processGeneratorNode=void 0;var Da=Iu(),Bf=class{constructor(e){this.defaultIndentation=" ",this.pendingIndent=!0,this.currentIndents=[],this.lines=[[]],typeof e=="string"?this.defaultIndentation=e:typeof e=="number"&&(this.defaultIndentation="".padStart(e))}get content(){return this.lines.map(e=>e.join("")).join("")}get currentLineNumber(){return this.lines.length-1}get currentLineContent(){return this.lines[this.currentLineNumber].join("")}append(e){e.length>0&&this.lines[this.currentLineNumber].push(e)}increaseIndent(e){this.currentIndents.push(e)}decreaseIndent(){this.currentIndents.pop()}resetCurrentLine(){this.lines[this.currentLineNumber]=[]}addNewLine(){this.pendingIndent=!0,this.lines.push([])}};function HS(r,e){let t=new Bf(e);return jv(r,t),t.content}Ou.processGeneratorNode=HS;function jv(r,e){typeof r=="string"?WS(r,e):r instanceof Da.IndentNode?KS(r,e):r instanceof Da.CompositeGeneratorNode?Hv(r,e):r instanceof Da.NewLineNode&&BS(r,e)}function Gv(r,e){return typeof r=="string"?Wv(r):r instanceof Da.CompositeGeneratorNode?r.contents.some(t=>Gv(t,e)):r instanceof Da.NewLineNode?!(r.ifNotEmpty&&e.currentLineContent.length===0):!1}function WS(r,e){r&&(e.pendingIndent&&Uv(e,!1),e.append(r))}function Uv(r,e){var t;let n="";for(let i of r.currentIndents.filter(o=>o.indentEmptyLines||!e))n+=(t=i.indentation)!==null&&t!==void 0?t:r.defaultIndentation;r.append(n),r.pendingIndent=!1}function Hv(r,e){for(let t of r.contents)jv(t,e)}function KS(r,e){var t;if(Gv(r,e)){r.indentImmediately&&!e.pendingIndent&&e.append((t=r.indentation)!==null&&t!==void 0?t:e.defaultIndentation);try{e.increaseIndent(r),Hv(r,e)}finally{e.decreaseIndent()}}}function BS(r,e){r.ifNotEmpty&&!Wv(e.currentLineContent)?e.resetCurrentLine():(e.pendingIndent&&Uv(e,!0),e.append(r.lineDelimiter),e.addNewLine())}function Wv(r){return r.trimStart()!==""}});var mi=C(lt=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.collectSuperTypes=lt.collectChildrenTypes=lt.typePropertyToString=lt.distinctAndSorted=lt.propertyTypeArrayToString=lt.collectAllAstResources=lt.collectAllProperties=lt.TypeResolutionError=lt.InterfaceType=lt.UnionType=void 0;var ir=Iu(),Bv=zf(),zS=Re(),VS=kr(),pi=ze(),Kv=Lt(),Vf=class{constructor(e,t,n){var i;this.superTypes=new Set,this.name=e,this.union=t,this.reflection=(i=n?.reflection)!==null&&i!==void 0?i:!1}toString(){let e=new ir.CompositeGeneratorNode;return e.contents.push(`export type ${this.name} = ${Zf(this.union)};`,ir.NL),this.reflection&&Yv(this.name,e),(0,Bv.processGeneratorNode)(e)}};lt.UnionType=Vf;var Yf=class{constructor(e,t,n){this.superTypes=new Set,this.interfaceSuperTypes=[],this.subTypes=new Set,this.containerTypes=new Set,this.name=e,this.superTypes=new Set(t),this.interfaceSuperTypes=[...t],this.properties=n}toString(){let e=new ir.CompositeGeneratorNode,t=this.interfaceSuperTypes.length>0?xo([...this.interfaceSuperTypes]):["AstNode"];e.contents.push(`export interface ${this.name} extends ${t.join(", ")} {`,ir.NL);let n=new ir.IndentNode;this.containerTypes.size>0&&n.contents.push(`readonly $container: ${xo([...this.containerTypes]).join(" | ")};`,ir.NL);for(let i of xo(this.properties,(o,a)=>o.name.localeCompare(a.name))){let o=i.optional&&!i.typeAlternatives.some(s=>s.array)&&!i.typeAlternatives.every(s=>s.types.length===1&&s.types[0]==="boolean")?"?":"",a=Zf(i.typeAlternatives);n.contents.push(`${i.name}${o}: ${a}`,ir.NL)}return e.contents.push(n,"}",ir.NL),Yv(this.name,e),(0,Bv.processGeneratorNode)(e)}};lt.InterfaceType=Yf;var Xf=class extends Error{constructor(e,t){super(e),this.name="TypeResolutionError",this.target=t}};lt.TypeResolutionError=Xf;function YS(r){let e=new VS.MultiMap;for(let t of r)e.addAll(t.name,t.properties);for(let t of r)for(let n of t.interfaceSuperTypes){let i=e.get(n);i&&e.addAll(t.name,i)}return e}lt.collectAllProperties=YS;function zv(r,e,t=new Set,n={parserRules:new Set,datatypeRules:new Set,interfaces:new Set,types:new Set}){for(let i of r){let o=(0,zS.getDocument)(i);if(!t.has(o.uri)){t.add(o.uri);for(let a of i.rules)(0,pi.isParserRule)(a)&&!a.fragment&&((0,Kv.isDataTypeRule)(a)?n.datatypeRules.add(a):n.parserRules.add(a));if(i.interfaces.forEach(a=>n.interfaces.add(a)),i.types.forEach(a=>n.types.add(a)),e){let a=i.imports.map(s=>(0,Kv.resolveImport)(e,s));zv(a,e,t,n)}}}return n}lt.collectAllAstResources=zv;function Zf(r){return xo(r.map(Vv)).join(" | ")}lt.propertyTypeArrayToString=Zf;function xo(r,e){return Array.from(new Set(r)).sort(e)}lt.distinctAndSorted=xo;function Vv(r){let e=xo(r.types).join(" | ");return e=r.reference?`Reference<${e}>`:e,e=r.array?`Array<${e}>`:e,e}lt.typePropertyToString=Vv;function Yv(r,e){e.contents.push(ir.NL,`export const ${r} = '${r}';`,ir.NL,ir.NL),e.contents.push(`export function is${r}(item: unknown): item is ${r} {`,ir.NL);let t=new ir.IndentNode;t.contents.push(`return reflection.isInstance(item, ${r});`,ir.NL),e.contents.push(t,"}",ir.NL)}function Xv(r,e,t,n){let i=new Set;return i.add(r),e.findReferences(r,{}).forEach(a=>{let s=t.getOrCreateDocument(a.sourceUri),u=n.getAstNode(s,a.sourcePath);(0,pi.isInterface)(u)?(i.add(u),Xv(u,e,t,n).forEach(l=>i.add(l))):u&&(0,pi.isType)(u.$container)&&i.add(u.$container)}),i}lt.collectChildrenTypes=Xv;function Jf(r){let e=new Set;return(0,pi.isInterface)(r)?(e.add(r),r.superTypes.forEach(t=>{if((0,pi.isInterface)(t.ref)){e.add(t.ref);let n=Jf(t.ref);for(let i of n)e.add(i)}})):(0,pi.isType)(r)&&r.typeAlternatives.forEach(t=>{var n;if(!((n=t.refType)===null||n===void 0)&&n.ref&&((0,pi.isInterface)(t.refType.ref)||(0,pi.isType)(t.refType.ref))){let i=Jf(t.refType.ref);for(let o of i)e.add(o)}}),e}lt.collectSuperTypes=Jf});var wa=C((Jv,$u)=>{(function(r,e){typeof define=="function"&&define.amd?define([],e):typeof $u=="object"&&$u.exports?$u.exports=e():r.regexpToAst=e()})(typeof self<"u"?self:Jv,function(){function r(){}r.prototype.saveState=function(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}},r.prototype.restoreState=function(p){this.idx=p.idx,this.input=p.input,this.groupIdx=p.groupIdx},r.prototype.pattern=function(p){this.idx=0,this.input=p,this.groupIdx=0,this.consumeChar("/");var A=this.disjunction();this.consumeChar("/");for(var x={type:"Flags",loc:{begin:this.idx,end:p.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};this.isRegExpFlag();)switch(this.popChar()){case"g":a(x,"global");break;case"i":a(x,"ignoreCase");break;case"m":a(x,"multiLine");break;case"u":a(x,"unicode");break;case"y":a(x,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:x,value:A,loc:this.loc(0)}},r.prototype.disjunction=function(){var p=[],A=this.idx;for(p.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),p.push(this.alternative());return{type:"Disjunction",value:p,loc:this.loc(A)}},r.prototype.alternative=function(){for(var p=[],A=this.idx;this.isTerm();)p.push(this.term());return{type:"Alternative",value:p,loc:this.loc(A)}},r.prototype.term=function(){return this.isAssertion()?this.assertion():this.atom()},r.prototype.assertion=function(){var p=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(p)};case"$":return{type:"EndAnchor",loc:this.loc(p)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(p)};case"B":return{type:"NonWordBoundary",loc:this.loc(p)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");var A;switch(this.popChar()){case"=":A="Lookahead";break;case"!":A="NegativeLookahead";break}s(A);var x=this.disjunction();return this.consumeChar(")"),{type:A,value:x,loc:this.loc(p)}}u()},r.prototype.quantifier=function(p){var A,x=this.idx;switch(this.popChar()){case"*":A={atLeast:0,atMost:1/0};break;case"+":A={atLeast:1,atMost:1/0};break;case"?":A={atLeast:0,atMost:1};break;case"{":var k=this.integerIncludingZero();switch(this.popChar()){case"}":A={atLeast:k,atMost:k};break;case",":var _;this.isDigit()?(_=this.integerIncludingZero(),A={atLeast:k,atMost:_}):A={atLeast:k,atMost:1/0},this.consumeChar("}");break}if(p===!0&&A===void 0)return;s(A);break}if(!(p===!0&&A===void 0))return s(A),this.peekChar(0)==="?"?(this.consumeChar("?"),A.greedy=!1):A.greedy=!0,A.type="Quantifier",A.loc=this.loc(x),A},r.prototype.atom=function(){var p,A=this.idx;switch(this.peekChar()){case".":p=this.dotAll();break;case"\\":p=this.atomEscape();break;case"[":p=this.characterClass();break;case"(":p=this.group();break}return p===void 0&&this.isPatternCharacter()&&(p=this.patternCharacter()),s(p),p.loc=this.loc(A),this.isQuantifier()&&(p.quantifier=this.quantifier()),p},r.prototype.dotAll=function(){return this.consumeChar("."),{type:"Set",complement:!0,value:[i(`
3573
3573
  `),i("\r"),i("\u2028"),i("\u2029")]}},r.prototype.atomEscape=function(){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()}},r.prototype.decimalEscapeAtom=function(){var p=this.positiveInteger();return{type:"GroupBackReference",value:p}},r.prototype.characterClassEscape=function(){var p,A=!1;switch(this.popChar()){case"d":p=l;break;case"D":p=l,A=!0;break;case"s":p=g;break;case"S":p=g,A=!0;break;case"w":p=d;break;case"W":p=d,A=!0;break}return s(p),{type:"Set",value:p,complement:A}},r.prototype.controlEscapeAtom=function(){var p;switch(this.popChar()){case"f":p=i("\f");break;case"n":p=i(`
3574
3574
  `);break;case"r":p=i("\r");break;case"t":p=i(" ");break;case"v":p=i("\v");break}return s(p),{type:"Character",value:p}},r.prototype.controlLetterEscapeAtom=function(){this.consumeChar("c");var p=this.popChar();if(/[a-zA-Z]/.test(p)===!1)throw Error("Invalid ");var A=p.toUpperCase().charCodeAt(0)-64;return{type:"Character",value:A}},r.prototype.nulCharacterAtom=function(){return this.consumeChar("0"),{type:"Character",value:i("\0")}},r.prototype.hexEscapeSequenceAtom=function(){return this.consumeChar("x"),this.parseHexDigits(2)},r.prototype.regExpUnicodeEscapeSequenceAtom=function(){return this.consumeChar("u"),this.parseHexDigits(4)},r.prototype.identityEscapeAtom=function(){var p=this.popChar();return{type:"Character",value:i(p)}},r.prototype.classPatternCharacterAtom=function(){switch(this.peekChar()){case`
3575
3575
  `:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:var p=this.popChar();return{type:"Character",value:i(p)}}},r.prototype.characterClass=function(){var p=[],A=!1;for(this.consumeChar("["),this.peekChar(0)==="^"&&(this.consumeChar("^"),A=!0);this.isClassAtom();){var x=this.classAtom(),k=x.type==="Character";if(k&&this.isRangeDash()){this.consumeChar("-");var _=this.classAtom(),R=_.type==="Character";if(R){if(_.value<x.value)throw Error("Range out of order in character class");p.push({from:x.value,to:_.value})}else o(x.value,p),p.push(i("-")),o(_.value,p)}else o(x.value,p)}return this.consumeChar("]"),{type:"Set",complement:A,value:p}},r.prototype.classAtom=function(){switch(this.peekChar()){case"]":case`
@@ -3577,67 +3577,67 @@ ${JSON.stringify(b,null,4)}`);let O=b;if(Et.string(O.id)||Et.number(O.id)){let j
3577
3577
  `: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:i(p)}}},r.prototype.isRegExpFlag=function(){switch(this.peekChar(0)){case"g":case"i":case"m":case"u":case"y":return!0;default:return!1}},r.prototype.isRangeDash=function(){return this.peekChar()==="-"&&this.isClassAtom(1)},r.prototype.isDigit=function(){return t.test(this.peekChar(0))},r.prototype.isClassAtom=function(p){switch(p===void 0&&(p=0),this.peekChar(p)){case"]":case`
3578
3578
  `:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}},r.prototype.isTerm=function(){return this.isAtom()||this.isAssertion()},r.prototype.isAtom=function(){if(this.isPatternCharacter())return!0;switch(this.peekChar(0)){case".":case"\\":case"[":case"(":return!0;default:return!1}},r.prototype.isAssertion=function(){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)==="!");default:return!1}},r.prototype.isQuantifier=function(){var p=this.saveState();try{return this.quantifier(!0)!==void 0}catch{return!1}finally{this.restoreState(p)}},r.prototype.isPatternCharacter=function(){switch(this.peekChar()){case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":case"/":case`
3579
3579
  `:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}},r.prototype.parseHexDigits=function(p){for(var A="",x=0;x<p;x++){var k=this.popChar();if(e.test(k)===!1)throw Error("Expecting a HexDecimal digits");A+=k}var _=parseInt(A,16);return{type:"Character",value:_}},r.prototype.peekChar=function(p){return p===void 0&&(p=0),this.input[this.idx+p]},r.prototype.popChar=function(){var p=this.peekChar(0);return this.consumeChar(),p},r.prototype.consumeChar=function(p){if(p!==void 0&&this.input[this.idx]!==p)throw Error("Expected: '"+p+"' but found: '"+this.input[this.idx]+"' at offset: "+this.idx);if(this.idx>=this.input.length)throw Error("Unexpected end of input");this.idx++},r.prototype.loc=function(p){return{begin:p,end:this.idx}};var e=/[0-9a-fA-F]/,t=/[0-9]/,n=/[1-9]/;function i(p){return p.charCodeAt(0)}function o(p,A){p.length!==void 0?p.forEach(function(x){A.push(x)}):A.push(p)}function a(p,A){if(p[A]===!0)throw"duplicate flag "+A;p[A]=!0}function s(p){if(p===void 0)throw Error("Internal Error - Should never get here!")}function u(){throw Error("Internal Error - Should never get here!")}var c,l=[];for(c=i("0");c<=i("9");c++)l.push(c);var d=[i("_")].concat(l);for(c=i("a");c<=i("z");c++)d.push(c);for(c=i("A");c<=i("Z");c++)d.push(c);var g=[i(" "),i("\f"),i(`
3580
- `),i("\r"),i(" "),i("\v"),i(" "),i("\xA0"),i("\u1680"),i("\u2000"),i("\u2001"),i("\u2002"),i("\u2003"),i("\u2004"),i("\u2005"),i("\u2006"),i("\u2007"),i("\u2008"),i("\u2009"),i("\u200A"),i("\u2028"),i("\u2029"),i("\u202F"),i("\u205F"),i("\u3000"),i("\uFEFF")];function y(){}return y.prototype.visitChildren=function(p){for(var A in p){var x=p[A];p.hasOwnProperty(A)&&(x.type!==void 0?this.visit(x):Array.isArray(x)&&x.forEach(function(k){this.visit(k)},this))}},y.prototype.visit=function(p){switch(p.type){case"Pattern":this.visitPattern(p);break;case"Flags":this.visitFlags(p);break;case"Disjunction":this.visitDisjunction(p);break;case"Alternative":this.visitAlternative(p);break;case"StartAnchor":this.visitStartAnchor(p);break;case"EndAnchor":this.visitEndAnchor(p);break;case"WordBoundary":this.visitWordBoundary(p);break;case"NonWordBoundary":this.visitNonWordBoundary(p);break;case"Lookahead":this.visitLookahead(p);break;case"NegativeLookahead":this.visitNegativeLookahead(p);break;case"Character":this.visitCharacter(p);break;case"Set":this.visitSet(p);break;case"Group":this.visitGroup(p);break;case"GroupBackReference":this.visitGroupBackReference(p);break;case"Quantifier":this.visitQuantifier(p);break}this.visitChildren(p)},y.prototype.visitPattern=function(p){},y.prototype.visitFlags=function(p){},y.prototype.visitDisjunction=function(p){},y.prototype.visitAlternative=function(p){},y.prototype.visitStartAnchor=function(p){},y.prototype.visitEndAnchor=function(p){},y.prototype.visitWordBoundary=function(p){},y.prototype.visitNonWordBoundary=function(p){},y.prototype.visitLookahead=function(p){},y.prototype.visitNegativeLookahead=function(p){},y.prototype.visitCharacter=function(p){},y.prototype.visitSet=function(p){},y.prototype.visitGroup=function(p){},y.prototype.visitGroupBackReference=function(p){},y.prototype.visitQuantifier=function(p){},{RegExpParser:r,BaseRegExpVisitor:y,VERSION:"0.5.0"}})});var So=C(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.partialRegex=Bt.partialMatches=Bt.getCaseInsensitivePattern=Bt.escapeRegExp=Bt.isWhitespaceRegExp=Bt.isMultilineComment=Bt.getTerminalParts=void 0;var eT=wa(),tT=new eT.RegExpParser,tp=class extends eT.BaseRegExpVisitor{constructor(){super(...arguments),this.isStarting=!0,this.endRegexStack=[],this.multiline=!1}get endRegex(){return this.endRegexStack.join("")}reset(e){this.multiline=!1,this.regex=e,this.startRegex="",this.isStarting=!0,this.endRegexStack=[]}visitGroup(e){e.quantifier&&(this.isStarting=!1,this.endRegexStack=[])}visitCharacter(e){let t=String.fromCharCode(e.value);if(!this.multiline&&t===`
3581
- `&&(this.multiline=!0),e.quantifier)this.isStarting=!1,this.endRegexStack=[];else{let n=rp(t);this.endRegexStack.push(n),this.isStarting&&(this.startRegex+=n)}}visitSet(e){if(!this.multiline){let t=this.regex.substring(e.loc.begin,e.loc.end),n=new RegExp(t);this.multiline=!!`
3582
- `.match(n)}if(e.quantifier)this.isStarting=!1,this.endRegexStack=[];else{let t=this.regex.substring(e.loc.begin,e.loc.end);this.endRegexStack.push(t),this.isStarting&&(this.startRegex+=t)}}},Li=new tp;function QS(r){try{typeof r!="string"&&(r=r.source),r=`/${r}/`;let e=tT.pattern(r),t=[];for(let n of e.value.value)Li.reset(r),Li.visit(n),t.push({start:Li.startRegex,end:Li.endRegex});return t}catch{return[]}}Bt.getTerminalParts=QS;function eN(r){try{return typeof r!="string"&&(r=r.source),r=`/${r}/`,Li.reset(r),Li.visit(tT.pattern(r)),Li.multiline}catch{return!1}}Bt.isMultilineComment=eN;function tN(r){return(typeof r=="string"?new RegExp(r):r).test(" ")}Bt.isWhitespaceRegExp=tN;function rp(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}Bt.escapeRegExp=rp;function rN(r){return Array.prototype.map.call(r,e=>/\w/.test(e)?`[${e.toLowerCase()}${e.toUpperCase()}]`:rp(e)).join("")}Bt.getCaseInsensitivePattern=rN;function nN(r,e){let t=rT(r),n=e.match(t);return!!n&&n[0].length>0}Bt.partialMatches=nN;function rT(r){typeof r=="string"&&(r=new RegExp(r));let e=r,t=r.source,n=0;function i(){let o="",a;function s(c){o+=t.substr(n,c),n+=c}function u(c){o+="(?:"+t.substr(n,c)+"|$)",n+=c}for(;n<t.length;)switch(t[n]){case"\\":switch(t[n+1]){case"c":u(3);break;case"x":u(4);break;case"u":e.unicode?t[n+2]==="{"?u(t.indexOf("}",n)-n+1):u(6):u(2);break;case"p":case"P":e.unicode?u(t.indexOf("}",n)-n+1):u(2);break;case"k":u(t.indexOf(">",n)-n+1);break;default:u(2);break}break;case"[":a=/\[(?:\\.|.)*?\]/g,a.lastIndex=n,a=a.exec(t)||[],u(a[0].length);break;case"|":case"^":case"$":case"*":case"+":case"?":s(1);break;case"{":a=/\{\d+,?\d*\}/g,a.lastIndex=n,a=a.exec(t),a?s(a[0].length):u(1);break;case"(":if(t[n+1]==="?")switch(t[n+2]){case":":o+="(?:",n+=3,o+=i()+"|$)";break;case"=":o+="(?=",n+=3,o+=i()+")";break;case"!":a=n,n+=3,i(),o+=t.substr(a,n-a);break;case"<":switch(t[n+3]){case"=":case"!":a=n,n+=4,i(),o+=t.substr(a,n-a);break;default:s(t.indexOf(">",n)-n+1),o+=i()+"|$)";break}break}else s(1),o+=i()+"|$)";break;case")":return++n,o;default:u(1);break}return o}return new RegExp(i(),r.flags)}Bt.partialRegex=rT});var Ft=C(ae=>{"use strict";var iN=ae&&ae.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),oN=ae&&ae.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),aN=ae&&ae.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&iN(e,r,t);return oN(e,r),e};Object.defineProperty(ae,"__esModule",{value:!0});ae.extractAssignments=ae.processActionNodeWithNodeDescriptionProvider=ae.processTypeNodeWithNodeLocator=ae.prepareGrammar=ae.resolveTransitiveImports=ae.resolveImport=ae.terminalRegex=ae.getRuleType=ae.getExplicitRuleType=ae.getTypeName=ae.getActionAtElement=ae.isDataTypeRule=ae.isArrayOperator=ae.isArrayCardinality=ae.isOptionalCardinality=void 0;var fe=aN(ze()),ip=vn(),Fi=Re(),sN=kr(),uN=mi(),cN=So();function lN(r){return r==="?"||r==="*"}ae.isOptionalCardinality=lN;function dN(r){return r==="*"||r==="+"}ae.isArrayCardinality=dN;function fN(r){return r==="+="}ae.isArrayOperator=fN;function ap(r){return nT(r,new Set)}ae.isDataTypeRule=ap;function nT(r,e){if(e.has(r))return!0;e.add(r);for(let t of(0,Fi.streamAllContents)(r))if(fe.isRuleCall(t)&&fe.isParserRule(t.rule.ref)){if(!nT(t.rule.ref,e))return!1}else{if(fe.isAssignment(t))return!1;if(fe.isAction(t))return!1}return!0}function iT(r){let e=r.$container;if(fe.isGroup(e)){let t=e.elements,n=t.indexOf(r);for(let i=n-1;i>=0;i--){let o=t[i];if(fe.isAction(o))return o;{let a=(0,Fi.streamAllContents)(t[i]).find(fe.isAction);if(a)return a}}}if(fe.isAbstractElement(e))return iT(e)}ae.getActionAtElement=iT;function oT(r){var e;if(fe.isParserRule(r))return ap(r)?r.name:(e=sp(r))!==null&&e!==void 0?e:r.name;if(fe.isInterface(r)||fe.isType(r)||fe.isReturnType(r))return r.name;if(fe.isAction(r)){let t=aT(r);if(t)return t}else if(fe.isInferredType(r))return r.name;throw new uN.TypeResolutionError("Cannot get name of Unknown Type",r.$cstNode)}ae.getTypeName=oT;function sp(r){if(r.inferredType)return r.inferredType.name;if(r.dataType)return r.dataType;if(r.returnType){let e=r.returnType.ref;if(e){if(fe.isParserRule(e))return e.name;if(fe.isInterface(e)||fe.isType(e))return e.name}}}ae.getExplicitRuleType=sp;function aT(r){var e;if(r.inferredType)return r.inferredType.name;if(!((e=r.type)===null||e===void 0)&&e.ref)return oT(r.type.ref)}function pN(r){var e,t,n;return fe.isTerminalRule(r)?(t=(e=r.type)===null||e===void 0?void 0:e.name)!==null&&t!==void 0?t:"string":ap(r)?r.name:(n=sp(r))!==null&&n!==void 0?n:r.name}ae.getRuleType=pN;function sT(r){return Ia(r.definition)}ae.terminalRegex=sT;var up=/[\s\S]/.source;function Ia(r){if(fe.isTerminalAlternatives(r))return mN(r);if(fe.isTerminalGroup(r))return hN(r);if(fe.isCharacterRange(r))return vN(r);if(fe.isTerminalRuleCall(r)){let e=r.rule.ref;if(!e)throw new Error("Missing rule reference.");return Hn(sT(e),r.cardinality)}else{if(fe.isNegatedToken(r))return gN(r);if(fe.isUntilToken(r))return yN(r);if(fe.isRegexToken(r))return Hn(r.regex,r.cardinality,!1);if(fe.isWildcard(r))return Hn(up,r.cardinality);throw new Error("Invalid terminal element.")}}function mN(r){return Hn(r.elements.map(Ia).join("|"),r.cardinality)}function hN(r){return Hn(r.elements.map(Ia).join(""),r.cardinality)}function yN(r){return Hn(`${up}*?${Ia(r.terminal)}`,r.cardinality)}function gN(r){return Hn(`(?!${Ia(r.terminal)})${up}*?`,r.cardinality)}function vN(r){return r.right?Hn(`[${np(r.left)}-${np(r.right)}]`,r.cardinality,!1):Hn(np(r.left),r.cardinality,!1)}function np(r){return(0,cN.escapeRegExp)(r.value)}function Hn(r,e,t=!0){return t&&(r=`(${r})`),e?`${r}${e}`:r}function cp(r,e){if(e.path===void 0||e.path.length===0)return;let t=ip.Utils.dirname((0,Fi.getDocument)(e).uri),n=e.path;n.endsWith(".langium")||(n+=".langium");let i=ip.Utils.resolvePath(t,n);try{let a=r.getOrCreateDocument(i).parseResult.value;if(fe.isGrammar(a))return a}catch{}}ae.resolveImport=cp;function TN(r,e){if(fe.isGrammarImport(e)){let t=cp(r,e);if(t){let n=op(r,t);return n.push(t),n}return[]}else return op(r,e)}ae.resolveTransitiveImports=TN;function op(r,e,t=e,n=new Set,i=new Set){let o=(0,Fi.getDocument)(e);if(t!==e&&i.add(e),!n.has(o.uri)){n.add(o.uri);for(let a of e.imports){let s=cp(r,a);s&&op(r,s,t,n,i)}}return Array.from(i)}function RN(r,e){let t=e,n=r.shared.workspace.LangiumDocumentFactory.fromModel(e,ip.URI.parse("memory://grammar.langium"));return t.$document=n,n.precomputedScopes=_N(r,e),e}ae.prepareGrammar=RN;function _N(r,e){let t=r.references.NameProvider,n=r.workspace.AstNodeDescriptionProvider,i=(0,Fi.getDocument)(e),o=new sN.MultiMap,a=uT(r.workspace.AstNodeLocator),s=cT(n);for(let u of(0,Fi.streamAllContents)(e)){if(fe.isReturnType(u))continue;s(u,i,o),a(u,i,o);let c=u.$container;if(c){let l=t.getName(u);l&&o.add(c,n.createDescription(u,l,i))}}return o}function uT(r){return(e,t,n)=>{var i;let o=e.$container;if(o&&fe.isParserRule(e)&&!e.returnType&&!e.dataType){let a=(i=e.inferredType)!==null&&i!==void 0?i:e;n.add(o,{node:a,name:a.name,type:"Interface",documentUri:t.uri,path:r.getAstNodePath(a)})}}}ae.processTypeNodeWithNodeLocator=uT;function cT(r){return(e,t,n)=>{let i=(0,Fi.findRootNode)(e);if(i&&fe.isAction(e)&&e.inferredType){let o=aT(e);o&&n.add(i,r.createDescription(e,o,t))}}}ae.processActionNodeWithNodeDescriptionProvider=cT;function lT(r){return fe.isAssignment(r)?[r]:fe.isAlternatives(r)||fe.isGroup(r)||fe.isUnorderedGroup(r)?r.elements.flatMap(e=>lT(e)):[]}ae.extractAssignments=lT});var pT=C(No=>{"use strict";Object.defineProperty(No,"__esModule",{value:!0});No.LangiumGrammarScopeComputation=No.LangiumGrammarScopeProvider=void 0;var AN=Su(),bN=Du(),dT=Re(),EN=Ct(),CN=ze(),fT=Ft(),lp=class extends bN.DefaultScopeProvider{constructor(e){super(e)}getScope(e){let t=this.reflection.getReferenceType(e);if(t!=="AbstractType")return super.getScope(e);let n=[],i=(0,dT.getDocument)(e.container).precomputedScopes,o=(0,dT.findRootNode)(e.container);if(i&&o){let s=i.get(o),u=[],c=[];if(s.length>0){for(let l of s)this.reflection.isSubtype(l.type,"ParserRule")?u.push(l):this.reflection.isSubtype(l.type,t)&&c.push(l);n.push((0,EN.stream)(c.concat(u.filter(l=>!c.some(d=>d.name===l.name)))))}}let a=this.getGlobalScope(t);for(let s=n.length-1;s>=0;s--)a=this.createScope(n[s],a);return a}};No.LangiumGrammarScopeProvider=lp;var dp=class extends AN.DefaultScopeComputation{constructor(e){super(e),this.processTypeNode=(0,fT.processTypeNodeWithNodeLocator)(e.workspace.AstNodeLocator),this.processActionNode=(0,fT.processActionNodeWithNodeDescriptionProvider)(e.workspace.AstNodeDescriptionProvider)}processNode(e,t,n){(0,CN.isReturnType)(e)||(this.processTypeNode(e,t,n),this.processActionNode(e,t,n),super.processNode(e,t,n))}};No.LangiumGrammarScopeComputation=dp});var hi=C(Do=>{"use strict";Object.defineProperty(Do,"__esModule",{value:!0});Do.relativeURI=Do.equalURI=void 0;function PN(r,e){return r?.toString()===e?.toString()}Do.equalURI=PN;function kN(r,e){let t=r.path,n=e.path,i=t.split("/").filter(c=>c.length>0),o=n.split("/").filter(c=>c.length>0),a=0;for(;a<i.length&&i[a]===o[a];a++);let s="../".repeat(i.length-a),u=o.slice(a).join("/");return s+u}Do.relativeURI=kN});var Fu=C(Lu=>{"use strict";Object.defineProperty(Lu,"__esModule",{value:!0});Lu.ValidationRegistry=void 0;var xN=kr(),SN=Yr(),fp=class{constructor(e){this.validationChecks=new xN.MultiMap,this.reflection=e.shared.AstReflection}register(e,t=this){for(let[n,i]of Object.entries(e))if(Array.isArray(i))for(let o of i)this.doRegister(n,this.wrapValidationException(o,t));else i&&this.doRegister(n,this.wrapValidationException(i,t))}wrapValidationException(e,t){return async(n,i,o)=>{try{await e.call(t,n,i,o)}catch(a){if((0,SN.isOperationCancelled)(a))throw a;console.error("An error occurred during validation:",a);let s=a instanceof Error?a.message:String(a);a instanceof Error&&a.stack&&console.error(a.stack),i("error","An error occurred during validation: "+s,{node:n})}}}doRegister(e,t){for(let n of this.reflection.getAllTypes())this.reflection.isSubtype(n,e)&&this.validationChecks.add(n,t)}getChecks(e){return this.validationChecks.get(e)}};Lu.ValidationRegistry=fp});var mp=C(qu=>{"use strict";Object.defineProperty(qu,"__esModule",{value:!0});qu.collectDeclaredTypes=void 0;var pp=Ft(),mT=mi(),NN=kr();function DN(r,e,t){var n;function i(s,u){var c;let l=(c=u.unions.find(d=>d.name===s))!==null&&c!==void 0?c:u.interfaces.find(d=>d.name===s);l&&a.get(s).forEach(d=>l.superTypes.add(d))}let o={unions:[],interfaces:[]};for(let s of r){let u=s.superTypes.filter(l=>l.ref).map(l=>(0,pp.getTypeName)(l.ref)),c=s.attributes.map(l=>({name:l.name,optional:l.isOptional===!0,typeAlternatives:l.typeAlternatives.map(hT)}));o.interfaces.push(new mT.InterfaceType(s.name,u,c))}let a=new NN.MultiMap;for(let s of e){let u=s.typeAlternatives.map(hT),c=s.typeAlternatives.length>1&&s.typeAlternatives.some(l=>{var d;return((d=l.refType)===null||d===void 0?void 0:d.ref)!==void 0});if(o.unions.push(new mT.UnionType(s.name,u,{reflection:c})),c)for(let l of s.typeAlternatives)!((n=l.refType)===null||n===void 0)&&n.ref&&a.add((0,pp.getTypeName)(l.refType.ref),s.name)}for(let s of a.keys())i(s,t),i(s,o);return o}qu.collectDeclaredTypes=DN;function hT(r){var e,t;let n=[];return r.refType?n=[r.refType.ref?(0,pp.getTypeName)(r.refType.ref):r.refType.$refText]:n=[(e=r.primitiveType)!==null&&e!==void 0?e:`'${(t=r.keywordType)===null||t===void 0?void 0:t.value}'`],{types:n,reference:r.isRef===!0,array:r.isArray===!0}}});var Io=C(wo=>{"use strict";Object.defineProperty(wo,"__esModule",{value:!0});wo.DefaultNameProvider=wo.isNamed=void 0;var wN=Pt();function yT(r){return typeof r.name=="string"}wo.isNamed=yT;var hp=class{getName(e){if(yT(e))return e.name}getNameNode(e){return(0,wN.findNodeForProperty)(e.$cstNode,"name")}};wo.DefaultNameProvider=hp});var Tp=C(ju=>{"use strict";Object.defineProperty(ju,"__esModule",{value:!0});ju.collectInferredTypes=void 0;var Dt=ze(),IN=Io(),ON=Ct(),Oo=mi(),vT=kr(),Wn=Ft();function gT(r){return JSON.parse(JSON.stringify(r))}function yp(r,e,t){if(e.ruleCalls.length>0){for(let n of e.ruleCalls)t.add(n);return}for(let n of e.parents)r.name===void 0?yp(n,n,t):n.name!==void 0&&n.name!==r.name?t.add(n.name):yp(r,n,t);e.parents.length===0&&e.name&&t.add(e.name)}var gp=class{constructor(e,t){this.context=e,this.root=t}getTypes(){let e={name:this.root.name,properties:this.root.properties,ruleCalls:this.root.ruleCalls,super:[]};return this.root.children.length===0?[e]:this.applyNext(this.root,{alt:e,next:this.root.children}).map(t=>t.alt)}applyNext(e,t){let n=this.splitType(t.alt,t.next.length),i=[];for(let o=0;o<t.next.length;o++){let a=n[o],s=t.next[o];if(s.declaredType)continue;s.actionWithAssignment&&i.push({alt:gT(a),next:[]}),s.name!==void 0&&s.name!==a.name&&(s.actionWithAssignment?(a.properties=[],a.ruleCalls=[],a.super=[e.name],a.name=s.name):(a.super=[a.name],a.name=s.name)),a.properties.push(...s.properties),a.ruleCalls.push(...s.ruleCalls);let u={alt:a,next:s.children};u.next.length===0?(u.alt.super=u.alt.super.filter(c=>c!==u.alt.name),i.push(u)):i.push(...this.applyNext(e,u))}return i}splitType(e,t){let n=[];for(let i=0;i<t;i++)n.push(gT(e));return n}getSuperTypes(e){let t=new Set;return yp(e,e,t),Array.from(t).sort()}connect(e,t){return t.parents.push(e),e.children.push(t),t}merge(...e){if(e.length===1)return e[0];if(e.length===0)return;let t=Oa();t.parents=e;for(let n of e)n.children.push(t);return t}};function $N(r,e){var t;let n=[],i={fragments:new Map};for(let u of r)n.push(...TT(i,u));let o=_T(n);BN(o);let a=MN(o),s=YN(o,a);for(let u of e){let c=(0,Dt.isAlternatives)(u.definition)&&u.definition.elements.every(l=>(0,Dt.isKeyword)(l))?(0,ON.stream)(u.definition.elements).filter(Dt.isKeyword).map(l=>`'${l.value}'`).toArray().sort():[(t=(0,Wn.getExplicitRuleType)(u))!==null&&t!==void 0?t:"string"];s.unions.push(new Oo.UnionType(u.name,$a(!1,!1,c)))}return s}ju.collectInferredTypes=$N;function MN(r){let e=[],t=new vT.MultiMap;for(let n of r)for(let i of n.superTypes)t.add(i,n.name);for(let[n,i]of t.entriesGroupedByKey())r.some(o=>o.name===n)||e.push(new Oo.UnionType(n,$a(!1,!1,i),{reflection:!0}));return e}function TT(r,e){let t=Oa(e),n=new gp(r,t);return vp(n,n.root,e.definition),n.getTypes()}function Oa(r){return{name:(0,Dt.isParserRule)(r)?(0,Wn.getTypeName)(r):r,properties:[],ruleCalls:[],children:[],parents:[],actionWithAssignment:!1}}function vp(r,e,t){let n=(0,Wn.isOptionalCardinality)(t.cardinality);if((0,Dt.isAlternatives)(t)){let i=[];n&&i.push(e);for(let o of t.elements){let a=r.connect(e,Oa());i.push(vp(r,a,o))}return r.merge(...i)}else if((0,Dt.isGroup)(t)||(0,Dt.isUnorderedGroup)(t)){let i=n?r.connect(e,Oa()):e;for(let o of t.elements)i=vp(r,i,o);return n?r.merge(e,i):i}else{if((0,Dt.isAction)(t))return LN(r,e,t);(0,Dt.isAssignment)(t)?FN(e,t):(0,Dt.isRuleCall)(t)&&jN(r,e,t)}return e}function LN(r,e,t){var n,i;let o=r.connect(e,Oa((n=t.inferredType)===null||n===void 0?void 0:n.name));if(t.type){o.declaredType=!0;let a=(i=t.type)===null||i===void 0?void 0:i.ref;a&&(0,IN.isNamed)(a)&&(o.name=a.name)}return t.feature&&t.operator&&(o.actionWithAssignment=!0,o.properties.push({name:t.feature,optional:!1,typeAlternatives:$a(t.operator==="+=",!1,r.root.ruleCalls.length!==0?r.root.ruleCalls:r.getSuperTypes(o))})),o}function FN(r,e){let t={types:new Set,reference:!1};RT(e.terminal,t);let n=$a(e.operator==="+=",t.reference,e.operator==="?="?["boolean"]:Array.from(t.types));r.properties.push({name:e.feature,optional:(0,Wn.isOptionalCardinality)(e.cardinality),typeAlternatives:n})}function RT(r,e){(0,Dt.isAlternatives)(r)||(0,Dt.isUnorderedGroup)(r)||(0,Dt.isGroup)(r)?qN(r,e):(0,Dt.isKeyword)(r)?e.types.add(`'${r.value}'`):(0,Dt.isRuleCall)(r)&&r.rule.ref?e.types.add((0,Wn.getRuleType)(r.rule.ref)):(0,Dt.isCrossReference)(r)&&r.type.ref&&(e.types.add((0,Wn.getTypeName)(r.type.ref)),e.reference=!0)}function qN(r,e){for(let t of r.elements)RT(t,e)}function jN(r,e,t){let n=t.rule.ref;if((0,Dt.isParserRule)(n)&&n.fragment){let i=GN(n,r.context);(0,Wn.isOptionalCardinality)(t.cardinality)?e.properties.push(...i.map(o=>Object.assign(Object.assign({},o),{optional:!0}))):e.properties.push(...i)}else(0,Dt.isParserRule)(n)&&e.ruleCalls.push((0,Wn.getRuleType)(n))}function GN(r,e){let t=e.fragments.get(r);if(t)return t;let n=[];e.fragments.set(r,n);let i=(0,Wn.getTypeName)(r),o=TT(e,r),s=_T(o).find(u=>u.name===i);return s&&n.push(...s.properties),n}function _T(r){let e=new Map,t=[],n=UN(r);for(let i of n){let o=new Oo.InterfaceType(i.name,i.super,i.properties);e.set(o.name,o),i.ruleCalls.length>0&&(t.push(i),i.ruleCalls.forEach(a=>{a!==o.name&&o.subTypes.add(a)}))}for(let i of t)for(let o of i.ruleCalls){let a=e.get(o);a&&a.name!==i.name&&a.superTypes.add(i.name)}return Array.from(e.values())}function UN(r){let e=r.reduce((n,i)=>n.add(i.name,i),new vT.MultiMap),t=[];for(let[n,i]of e.entriesGroupedByKey()){let o=[],a=new Set,s={name:n,properties:o,ruleCalls:[],super:[]};for(let u of i){s.super.push(...u.super);let c=u.properties,l=new Set;for(let d of c){l.add(d.name);let g=o.find(y=>y.name===d.name);g?d.typeAlternatives.filter(HN(g.typeAlternatives)).forEach(y=>g.typeAlternatives.push(y)):o.push(Object.assign({},d))}c.length===0&&u.ruleCalls.forEach(d=>a.add(d))}for(let u of i)if(u.ruleCalls.length===0)for(let c of o)u.properties.find(l=>l.name===c.name)||(c.optional=!0);s.ruleCalls=Array.from(a),t.push(s)}return t}function HN(r){return e=>!r.some(t=>WN(t,e))}function WN(r,e){return r.array===e.array&&r.reference===e.reference&&KN(r.types,e.types)}function KN(r,e,t=(n,i)=>n===i){let n=(0,Oo.distinctAndSorted)(r),i=(0,Oo.distinctAndSorted)(e);return n.length!==i.length?!1:i.every((o,a)=>t(o,n[a]))}function BN(r){var e,t;for(let i of r){for(let o of i.properties.flatMap(a=>a.typeAlternatives.filter(s=>!s.reference).flatMap(s=>s.types)))(e=r.find(a=>a.name===o))===null||e===void 0||e.containerTypes.add(i.name);for(let o of i.superTypes)(t=r.find(a=>a.name===o))===null||t===void 0||t.subTypes.add(i.name)}let n=[];zN(n,r),VN(n)}function zN(r,e){function t(i){let o=[i];n.add(i.name);let a=[...i.subTypes,...i.superTypes];for(let s of a)if(!n.has(s)){let u=e.find(c=>c.name===s);u&&o.push(...t(u))}return o}let n=new Set;for(let i of e)n.has(i.name)||r.push(t(i))}function VN(r){for(let e of r){let t=new Set;e.forEach(n=>n.containerTypes.forEach(i=>t.add(i))),e.forEach(n=>n.containerTypes=t)}}function YN(r,e){let t={interfaces:[],unions:e},n=new Set(e.map(i=>i.name));for(let i of r)if(i.properties.length===0&&i.subTypes.size>0){let o=$a(!1,!1,Array.from(i.subTypes)),a=e.find(s=>s.name===i.name);if(a)a.union.push(...o);else{let s=new Oo.UnionType(i.name,o,{reflection:!0});s.superTypes=i.superTypes,t.unions.push(s),n.add(i.name)}}else t.interfaces.push(i);for(let i of t.interfaces)i.interfaceSuperTypes=[...i.superTypes].filter(o=>!n.has(o)).sort();return t}function $a(r,e,t){return r||e?[{array:r,reference:e,types:t}]:t.map(n=>({array:r,reference:e,types:[n]}))}});var NT=C(Tn=>{"use strict";Object.defineProperty(Tn,"__esModule",{value:!0});Tn.collectAllInterfaces=Tn.collectValidationResources=Tn.applyErrorToAssignment=Tn.validateTypesConsistency=void 0;var Rp=kr(),ET=mp(),CT=Tp(),La=mi(),Fa=Ct(),_p=Ft();function XN(r,e){function t(a,s){return u=>{a.forEach(c=>e("error",u+` in a rule that returns type '${s}'.`,{node:c?.inferredType?c.inferredType:c,property:"name"}))}}function n(a,s){return(u,c)=>{a.forEach(l=>{(0,_p.extractAssignments)(l.definition).find(g=>g.feature===u)===void 0&&e("error",c+` in rule '${l.name}', but is required in type '${s}'.`,{node:l,property:"parameters"})})}}let i=kT(r),o=new Rp.MultiMap;for(let[a,s]of i.entries())"declared"in s&&Ma(s.declared)&&o.addAll(a,Gu(s.declared,"declared",i).values());for(let[a,s]of i.entries()){if("declared"in s&&JN(s,o,e),!eD(s))continue;let u=t(s.nodes,a),c=n(s.nodes,a),l=PT(s.nodes,e);if(AT(s.inferred)&&AT(s.declared))rD(s.inferred.union,s.declared.union,u);else if(Ma(s.inferred)&&Ma(s.declared)){let d=Gu(s.inferred,"inferred",i),g=Gu(s.declared,"declared",i);nD(d,g,u,l,c)}else{let d=`Inferred and declared versions of type ${a} both have to be interfaces or unions.`;s.nodes.forEach(g=>e("error",d,{node:g?.inferredType?g.inferredType:g,property:"name"})),e("error",d,{node:s.node,property:"name"})}}}Tn.validateTypesConsistency=XN;function JN(r,e,t){let n=r.declared;if(!Ma(n))return;let i=n.interfaceSuperTypes;for(let a=0;a<i.length;a++)for(let s=a+1;s<i.length;s++){let u=i[a],c=i[s],l=e.get(u),d=e.get(c),g=ZN(l,d);g.length>0&&t("error",`Cannot simultaneously inherit from '${u}' and '${c}'. Their ${g.map(y=>"'"+y+"'").join(", ")} properties are not identical.`,{node:r.node,property:"name"})}let o=new Set;for(let a of i){let s=e.get(a);for(let u of s)o.add(u.name)}for(let a of n.properties)if(o.has(a.name)){let u=r.node.attributes.find(c=>c.name===a.name);u&&t("error",`Cannot redeclare property '${a.name}'. It is already inherited from another interface.`,{node:u,property:"name"})}}function ZN(r,e){let t=[];for(let n of r){let i=e.find(o=>o.name===n.name);i&&!QN(n,i)&&t.push(n.name)}return t}function QN(r,e){if(r.optional!==e.optional||r.typeAlternatives.length!==e.typeAlternatives.length)return!1;for(let t of r.typeAlternatives){let n=!1;for(let i of e.typeAlternatives)i.array===t.array&&i.reference===t.reference&&i.types.length===t.types.length&&i.types.every(o=>t.types.includes(o))&&(n=!0);if(!n)return!1}return!0}function Gu(r,e,t,n=new Rp.MultiMap,i=new Set){if(i.has(r.name))return n;i.add(r.name);let o=r.properties;for(let a of o)n.add(a.name,a);for(let a of r.interfaceSuperTypes){let s=t.get(a),u=s?.[e];Ma(u)&&Gu(u,e,t,n,i)}return n}function PT(r,e){let t=r.flatMap(n=>(0,_p.extractAssignments)(n.definition));return(n,i)=>{let o=t.find(a=>a.feature===n);o&&e("error",i,{node:o,property:"feature"})}}Tn.applyErrorToAssignment=PT;function AT(r){return r&&"union"in r}function Ma(r){return r&&"properties"in r}function eD(r){return r&&"inferred"in r&&"declared"in r}function kT(r){let e=(0,La.collectAllAstResources)([r]),t=(0,CT.collectInferredTypes)(Array.from(e.parserRules),Array.from(e.datatypeRules)),n=(0,ET.collectDeclaredTypes)(Array.from(e.interfaces),Array.from(e.types),t),i=xT(e),o=bT(t).reduce((s,u)=>s.set(u.name,{inferred:u,nodes:i.get(u.name)}),new Map);return bT(n).reduce((s,u)=>{var c;let l=(c=(0,Fa.stream)(e.types).find(d=>d.name===u.name))!==null&&c!==void 0?c:(0,Fa.stream)(e.interfaces).find(d=>d.name===u.name);if(l){let d=o.get(u.name);s.set(u.name,d?Object.assign(Object.assign({},d),{declared:u,node:l}):{declared:u,node:l})}return s},new Map)}Tn.collectValidationResources=kT;function xT(r){return(0,Fa.stream)(r.parserRules).concat(r.datatypeRules).reduce((e,t)=>e.add((0,_p.getRuleType)(t),t),new Rp.MultiMap)}function bT(r){return r.interfaces.concat(r.unions)}var tD=(r,e)=>r.array&&!e.array&&r.reference&&!e.reference?"can't be an array and a reference":!r.array&&e.array&&!r.reference&&e.reference?"has to be an array and a reference":r.array&&!e.array?"can't be an array":!r.array&&e.array?"has to be an array":r.reference&&!e.reference?"can't be a reference":!r.reference&&e.reference?"has to be a reference":"";function ST(r,e){let t=a=>a.reduce((s,u)=>s.set((0,La.distinctAndSorted)(u.types).join(" | "),u),new Map),n=t(r),i=t(e),o=[];for(let[a,s]of(0,Fa.stream)(n)){let u=i.get(a);u?(u.array!==s.array||u.reference!==s.reference)&&o.push({typeString:a,errorMessage:tD(s,u)}):o.push({typeString:a,errorMessage:"is not expected"})}return o}function rD(r,e,t){let n=ST(r,e);for(let i of n)t(`A type '${i.typeString}' ${i.errorMessage}`)}function nD(r,e,t,n,i){let o=(s,u,c)=>`The assigned type '${u}' is not compatible with the declared property '${s}' of type '${c}'.`,a=(s,u)=>!(s.typeAlternatives.length===1&&s.typeAlternatives[0].array||u.typeAlternatives.length===1&&u.typeAlternatives[0].array);for(let s of r.keys()){let c=r.get(s)[0],d=e.get(s)[0];if(d){let g=(0,La.propertyTypeArrayToString)(c.typeAlternatives),y=(0,La.propertyTypeArrayToString)(d.typeAlternatives);if(g!==y){let p=ST(c.typeAlternatives,d.typeAlternatives);if(p.length>0){let A=o(c.name,g,y);for(let x of p)A=A+` '${x.typeString}' ${x.errorMessage};`;A=A.replace(/;$/,"."),n(c.name,A)}}a(c,d)&&!d.optional&&c.optional&&i(c.name,`Property '${c.name}' is missing`)}else n(c.name,`A property '${c.name}' is not expected.`)}for(let[s,u]of e.entriesGroupedByKey())r.get(s).length===0&&!u.some(l=>l.optional)&&t(`A property '${s}' is expected`)}function iD(r){let e=(0,La.collectAllAstResources)([r]),t=(0,CT.collectInferredTypes)(Array.from(e.parserRules),Array.from(e.datatypeRules)),n=(0,ET.collectDeclaredTypes)(Array.from(e.interfaces),Array.from(e.types),t),i=xT(e),o=t.interfaces.reduce((a,s)=>a.set(s.name,{type:s,node:i.get(s.name)}),new Map);return n.interfaces.reduce((a,s)=>{if(!a.has(s.name)){let u=(0,Fa.stream)(e.interfaces).find(c=>c.name===s.name);u&&a.set(s.name,{type:s,node:u})}return a},o)}Tn.collectAllInterfaces=iD});var xp=C(or=>{"use strict";var oD=or&&or.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),aD=or&&or.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),sD=or&&or.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&oD(e,r,t);return aD(e,r),e};Object.defineProperty(or,"__esModule",{value:!0});or.LangiumGrammarValidator=or.IssueCodes=or.LangiumGrammarValidationRegistry=void 0;var Ap=lo(),uD=vn(),yi=Re(),Uu=kr(),bp=et(),Kn=Pt(),Ep=Ct(),cD=hi(),lD=Fu(),Ve=sD(ze()),DT=ze(),qt=Ft(),Cp=NT(),Pp=class extends lD.ValidationRegistry{constructor(e){super(e);let t=e.validation.LangiumGrammarValidator,n={Action:t.checkActionTypeUnions,AbstractRule:t.checkRuleName,Assignment:[t.checkAssignmentWithFeatureName,t.checkAssignmentToFragmentRule],ParserRule:[t.checkParserRuleDataType,t.checkRuleParametersUsed],TerminalRule:[t.checkTerminalRuleReturnType,t.checkHiddenTerminalRule,t.checkEmptyTerminalRule],Keyword:t.checkKeyword,UnorderedGroup:t.checkUnorderedGroup,Grammar:[t.checkGrammarName,t.checkEntryGrammarRule,t.checkUniqueRuleName,t.checkUniqueTypeName,t.checkUniqueImportedRules,t.checkDuplicateImportedGrammar,t.checkGrammarHiddenTokens,t.checkGrammarForUnusedRules,t.checkGrammarImports,t.checkGrammarTypeUnions,t.checkGrammarTypeInfer,t.checkTypesConsistency,t.checkPropertyNameDuplication],GrammarImport:t.checkPackageImport,CharacterRange:t.checkInvalidCharacterRange,RuleCall:[t.checkUsedHiddenTerminalRule,t.checkUsedFragmentTerminalRule,t.checkRuleCallParameters],TerminalRuleCall:t.checkUsedHiddenTerminalRule,CrossReference:[t.checkCrossReferenceSyntax,t.checkCrossRefNameAssignment,t.checkCrossRefTerminalType,t.checkCrossRefType],AtomType:[t.checkAtomTypeRefType,t.checkFragmentsInTypes]};this.register(n,t)}};or.LangiumGrammarValidationRegistry=Pp;var zt;(function(r){r.GrammarNameUppercase="grammar-name-uppercase",r.RuleNameUppercase="rule-name-uppercase",r.HiddenGrammarTokens="hidden-grammar-tokens",r.UseRegexTokens="use-regex-tokens",r.EntryRuleTokenSyntax="entry-rule-token-syntax",r.CrossRefTokenSyntax="cross-ref-token-syntax",r.MissingImport="missing-import",r.UnnecessaryFileExtension="unnecessary-file-extension",r.InvalidReturns="invalid-returns",r.InvalidInfers="invalid-infers",r.MissingInfer="missing-infer",r.SuperfluousInfer="superfluous-infer",r.OptionalUnorderedGroup="optional-unordered-group"})(zt=or.IssueCodes||(or.IssueCodes={}));var kp=class{constructor(e){this.references=e.references.References,this.documents=e.shared.workspace.LangiumDocuments}checkGrammarName(e,t){if(e.name){let n=e.name.substring(0,1);n.toUpperCase()!==n&&t("warning","Grammar name should start with an upper case letter.",{node:e,property:"name",code:zt.GrammarNameUppercase})}}checkEntryGrammarRule(e,t){let n=e.rules.filter(i=>Ve.isParserRule(i)&&i.entry);if(e.isDeclared&&n.length===0){let i=e.rules.find(o=>Ve.isParserRule(o)&&!(0,qt.isDataTypeRule)(o));i?t("error","The grammar is missing an entry parser rule. This rule can be an entry one.",{node:i,property:"name",code:zt.EntryRuleTokenSyntax}):t("error","This grammar is missing an entry parser rule.",{node:e,property:"name"})}else!e.isDeclared&&n.length>=1?n.forEach(i=>t("error","Cannot declare entry rules for unnamed grammars.",{node:i,property:"name"})):n.length>1?n.forEach(i=>t("error","The entry rule has to be unique.",{node:i,property:"name"})):n.length===1&&(0,qt.isDataTypeRule)(n[0])&&t("error","The entry rule cannot be a data type rule.",{node:n[0],property:"name"})}checkUniqueRuleName(e,t){let n=i=>(0,Ep.stream)(i.rules).filter(o=>!qa(o));this.checkUniqueName(e,t,n,"rule")}checkUniqueTypeName(e,t){let n=i=>(0,Ep.stream)(i.types).concat(i.interfaces);this.checkUniqueName(e,t,n,"type")}checkUniqueName(e,t,n,i){let o=new Uu.MultiMap;n(e).forEach(u=>o.add(u.name,u));for(let[,u]of o.entriesGroupedByKey())u.length>1&&u.forEach(c=>{t("error",`A ${i}'s name has to be unique.`,{node:c,property:"name"})});let a=new Set,s=(0,qt.resolveTransitiveImports)(this.documents,e);for(let u of s)n(u).forEach(c=>a.add(c.name));for(let u of o.keys())a.has(u)&&o.get(u).forEach(l=>{t("error",`A ${i} with the name '${l.name}' already exists in an imported grammar.`,{node:l,property:"name"})})}checkDuplicateImportedGrammar(e,t){let n=new Uu.MultiMap;for(let i of e.imports){let o=(0,qt.resolveImport)(this.documents,i);o&&n.add(o,i)}for(let[,i]of n.entriesGroupedByKey())i.length>1&&i.forEach((o,a)=>{a>0&&t("warning","The grammar is already being directly imported.",{node:o,tags:[Ap.DiagnosticTag.Unnecessary]})})}checkUniqueImportedRules(e,t){let n=new Map;for(let o of e.imports){let a=(0,qt.resolveTransitiveImports)(this.documents,o);n.set(o,a)}let i=new Uu.MultiMap;for(let o of e.imports){let a=n.get(o);for(let s of e.imports){if(o===s)continue;let u=n.get(s),c=this.getDuplicateExportedRules(a,u);for(let l of c)i.add(o,l)}}for(let o of e.imports){let a=i.get(o);a.length>0&&t("error","Some rules exported by this grammar are also included in other imports: "+(0,Ep.stream)(a).distinct().join(", "),{node:o,property:"path"})}}getDuplicateExportedRules(e,t){let i=e.filter(s=>!t.includes(s)).flatMap(s=>s.rules),o=t.flatMap(s=>s.rules),a=new Set;for(let s of i){let u=s.name;for(let c of o){let l=c.name;u===l&&a.add(c.name)}}return a}checkGrammarTypeInfer(e,t){var n,i;let o=new Set;for(let s of e.types)o.add(s.name);for(let s of e.interfaces)o.add(s.name);(0,qt.resolveTransitiveImports)(this.documents,e).forEach(s=>{s.types.forEach(u=>o.add(u.name)),s.interfaces.forEach(u=>o.add(u.name))});for(let s of e.rules.filter(Ve.isParserRule)){if(qa(s))continue;let u=(0,qt.isDataTypeRule)(s),c=!s.returnType&&!s.dataType,l=(0,qt.getTypeName)(s);if(!u&&l&&o.has(l)===c){let d=c?(0,Kn.findNodeForKeyword)(s.$cstNode,"infer"):(0,Kn.findNodeForKeyword)(s.$cstNode,"returns");t("error",a(l,c),{node:(n=s.inferredType)!==null&&n!==void 0?n:s,property:"name",code:c?zt.InvalidInfers:zt.InvalidReturns,data:d&&(0,bp.toDocumentSegment)(d)})}else if(u&&c){let d=(0,Kn.findNodeForKeyword)(s.$cstNode,"infer");t("error","Data type rules cannot infer a type.",{node:s,property:"inferredType",code:zt.InvalidInfers,data:d&&(0,bp.toDocumentSegment)(d)})}}for(let s of(0,yi.streamAllContents)(e).filter(Ve.isAction)){let u=this.getActionType(s);if(u){let c=!!s.inferredType,l=(0,qt.getTypeName)(s);if(s.type&&o.has(l)===c){let d=c?(0,Kn.findNodeForKeyword)(s.$cstNode,"infer"):(0,Kn.findNodeForKeyword)(s.$cstNode,"{");t("error",a(l,c),{node:s,property:"type",code:c?zt.SuperfluousInfer:zt.MissingInfer,data:d&&(0,bp.toDocumentSegment)(d)})}else if(u&&o.has(l)&&c&&s.$cstNode){let d=(0,Kn.findNodeForProperty)((i=s.inferredType)===null||i===void 0?void 0:i.$cstNode,"name"),g=(0,Kn.findNodeForKeyword)(s.$cstNode,"{");d&&g&&t("error",`${l} is a declared type and cannot be redefined.`,{node:s,property:"type",code:zt.SuperfluousInfer,data:{start:g.range.end,end:d.range.start}})}}}function a(s,u){return u?`The type '${s}' is already explicitly declared and cannot be inferred.`:`The type '${s}' is not explicitly declared and must be inferred.`}}getActionType(e){var t;if(e.type)return(t=e.type)===null||t===void 0?void 0:t.ref;if(e.inferredType)return e.inferredType}checkGrammarHiddenTokens(e,t){e.definesHiddenTokens&&t("error","Hidden terminals are declared at the terminal definition.",{node:e,property:"definesHiddenTokens",code:zt.HiddenGrammarTokens})}checkHiddenTerminalRule(e,t){e.hidden&&e.fragment&&t("error","Cannot use terminal fragments as hidden tokens.",{node:e,property:"hidden"})}checkEmptyTerminalRule(e,t){try{let n=(0,qt.terminalRegex)(e);new RegExp(n).test("")&&t("error","This terminal could match an empty string.",{node:e,property:"name"})}catch{}}checkUsedHiddenTerminalRule(e,t){let n=(0,yi.getContainerOfType)(e,i=>Ve.isTerminalRule(i)||Ve.isParserRule(i));if(n){if("hidden"in n&&n.hidden)return;let i=e.rule.ref;Ve.isTerminalRule(i)&&i.hidden&&t("error","Cannot use hidden terminal in non-hidden rule",{node:e,property:"rule"})}}checkUsedFragmentTerminalRule(e,t){let n=e.rule.ref;Ve.isTerminalRule(n)&&n.fragment&&(0,yi.getContainerOfType)(e,Ve.isParserRule)&&t("error","Cannot use terminal fragments as part of parser rules.",{node:e,property:"rule"})}checkCrossReferenceSyntax(e,t){e.deprecatedSyntax&&t("error","'|' is deprecated. Please, use ':' instead.",{node:e,property:"deprecatedSyntax",code:zt.CrossRefTokenSyntax})}checkPackageImport(e,t){(0,qt.resolveImport)(this.documents,e)===void 0?t("error","Import cannot be resolved.",{node:e,property:"path"}):e.path.endsWith(".langium")&&t("warning","Imports do not need file extensions.",{node:e,property:"path",code:zt.UnnecessaryFileExtension})}checkGrammarImports(e,t){let n=new Set((0,qt.resolveTransitiveImports)(this.documents,e).map(i=>(0,yi.getDocument)(i)));(0,yi.streamAllContents)(e).forEach(i=>{(Ve.isRuleCall(i)||Ve.isTerminalRuleCall(i))&&this.checkRuleCallImport(i,n,t)})}checkRuleCallImport(e,t,n){var i;let o=e.rule.ref;if(o){let a=(0,yi.getDocument)(o),s=(0,yi.getDocument)(e),u=s.parseResult.value;if(Ve.isGrammar(u)&&a!==s&&!t.has(a)){let c=(0,cD.relativeURI)(uD.Utils.dirname(s.uri),a.uri);c.endsWith(".langium")&&(c=c.substring(0,c.length-8)),c.startsWith(".")||(c="./"+c),n("error",`Referenced rule "${(i=e.rule.ref)===null||i===void 0?void 0:i.name}" is not imported.`,{node:e,property:"rule",code:zt.MissingImport,data:c})}}}checkGrammarTypeUnions(e,t){for(let n of e.rules)Ve.isParserRule(n)&&Ve.isType(n.returnType)&&t("error","Rules are not allowed to return union types.",{node:n,property:"returnType"});for(let n of e.interfaces)n.superTypes.forEach((i,o)=>{i.ref&&Ve.isType(i.ref)&&t("error","Interfaces cannot extend union types.",{node:n,property:"superTypes",index:o})})}checkActionTypeUnions(e,t){Ve.isType(e.type)&&t("error","Actions cannot create union types.",{node:e,property:"type"})}checkTypesConsistency(e,t){(0,Cp.validateTypesConsistency)(e,t)}checkPropertyNameDuplication(e,t){if(e.interfaces.length===0)return;let n=(0,Cp.collectAllInterfaces)(e);for(let i of e.interfaces.map(o=>o.name)){let o=new Uu.MultiMap;this.collectPropertyNamesForHierarchy(n,new Set,o,i);for(let[a,s]of o.entriesGroupedByKey())if(!(s.length<2))for(let u of s){let c=`A property '${a}' has to be unique for the whole hierarchy.`;if(Ve.isInterface(u)){let l=u.attributes.find(d=>d.name===a);l&&t("error",c,{node:l,property:"name"})}else(0,Cp.applyErrorToAssignment)(u,t)(a,c)}}}collectPropertyNamesForHierarchy(e,t,n,i){function o(a){if(t.has(a))return;t.add(a);let s=e.get(a);s&&(s.type.properties.forEach(u=>n.add(u.name,s.node)),s.type.interfaceSuperTypes.forEach(u=>o(u)))}o(i)}checkInvalidCharacterRange(e,t){if(e.right){let n="Character ranges cannot use more than one character",i=!1;e.left.value.length>1&&(i=!0,t("error",n,{node:e.left,property:"value"})),e.right.value.length>1&&(i=!0,t("error",n,{node:e.right,property:"value"})),i||t("hint","Consider using regex instead of character ranges",{node:e,code:zt.UseRegexTokens})}}checkGrammarForUnusedRules(e,t){let n=(0,Kn.getAllReachableRules)(e,!0);for(let i of e.rules)Ve.isTerminalRule(i)&&i.hidden||qa(i)||n.has(i)||t("hint","This rule is declared but never referenced.",{node:i,property:"name",tags:[Ap.DiagnosticTag.Unnecessary]})}checkRuleName(e,t){if(e.name&&!qa(e)){let n=e.name.substring(0,1);n.toUpperCase()!==n&&t("warning","Rule name should start with an upper case letter.",{node:e,property:"name",code:zt.RuleNameUppercase})}}checkKeyword(e,t){e.value.length===0?t("error","Keywords cannot be empty.",{node:e}):e.value.trim().length===0?t("error","Keywords cannot only consist of whitespace characters.",{node:e}):/\s/g.test(e.value)&&t("warning","Keywords should not contain whitespace characters.",{node:e})}checkUnorderedGroup(e,t){e.elements.forEach(n=>{(0,qt.isOptionalCardinality)(n.cardinality)&&t("error","Optional elements in Unordered groups are currently not supported",{node:n,code:zt.OptionalUnorderedGroup})})}checkRuleParametersUsed(e,t){let n=e.parameters;if(n.length>0){let i=(0,yi.streamAllContents)(e).filter(Ve.isParameterReference);for(let o of n)i.some(a=>a.parameter.ref===o)||t("hint",`Parameter '${o.name}' is unused.`,{node:o,tags:[Ap.DiagnosticTag.Unnecessary]})}}checkParserRuleDataType(e,t){if(qa(e))return;let n=e.dataType,i=(0,qt.isDataTypeRule)(e);!n&&i?t("error","This parser rule does not create an object. Add a primitive return type or an action to the start of the rule to force object instantiation.",{node:e,property:"name"}):n&&!i&&t("error","Normal parser rules are not allowed to return a primitive value. Use a datatype rule for that.",{node:e,property:"dataType"})}checkAssignmentToFragmentRule(e,t){(0,DT.isRuleCall)(e.terminal)&&(0,DT.isParserRule)(e.terminal.rule.ref)&&e.terminal.rule.ref.fragment&&t("error",`Cannot use fragment rule '${e.terminal.rule.ref.name}' for assignment of property '${e.feature}'.`,{node:e,property:"terminal"})}checkTerminalRuleReturnType(e,t){var n;((n=e.type)===null||n===void 0?void 0:n.name)&&!fD(e.type.name)&&t("error","Terminal rules can only return primitive types like 'string', 'boolean', 'number', 'Date' or 'bigint'.",{node:e.type,property:"name"})}checkRuleCallParameters(e,t){let n=e.rule.ref;if(Ve.isParserRule(n)){let i=n.parameters.length,o=e.arguments.length;i!==o&&t("error",`Rule '${n.name}' expects ${i} arguments, but got ${o}.`,{node:e})}else Ve.isTerminalRule(n)&&e.arguments.length>0&&t("error","Terminal rules do not accept any arguments",{node:e})}checkCrossRefNameAssignment(e,t){!e.terminal&&e.type.ref&&!(0,Kn.findNameAssignment)(e.type.ref)&&t("error","Cannot infer terminal or data type rule for cross reference.",{node:e,property:"type"})}checkCrossRefTerminalType(e,t){Ve.isRuleCall(e.terminal)&&Ve.isParserRule(e.terminal.rule.ref)&&!(0,qt.isDataTypeRule)(e.terminal.rule.ref)&&t("error","Parser rules cannot be used for cross references.",{node:e.terminal,property:"rule"})}checkCrossRefType(e,t){let n=this.checkReferenceToRuleButNotType(e?.type);n&&t("error",n,{node:e,property:"type"})}checkAtomTypeRefType(e,t){if(e?.refType){let n=this.checkReferenceToRuleButNotType(e?.refType);n&&t("error",n,{node:e,property:"refType"})}}checkFragmentsInTypes(e,t){var n,i;Ve.isParserRule((n=e.refType)===null||n===void 0?void 0:n.ref)&&((i=e.refType)===null||i===void 0?void 0:i.ref.fragment)&&t("error","Cannot use rule fragments in types.",{node:e,property:"refType"})}checkReferenceToRuleButNotType(e){if(e&&Ve.isParserRule(e.ref)&&!(0,qt.isDataTypeRule)(e.ref)&&(e.ref.returnType||e.ref.inferredType)){let t=(0,qt.getTypeName)(e.ref);if(t)return`Use the rule type '${t}' instead of the typed rule name '${e.ref.name}' for cross references.`}}checkAssignmentWithFeatureName(e,t){e.feature==="name"&&Ve.isCrossReference(e.terminal)&&t("warning",'The "name" property is not recommended for cross-references.',{node:e,property:"feature"})}};or.LangiumGrammarValidator=kp;var dD=["string","number","boolean","Date","bigint"];function fD(r){return dD.includes(r)}function qa(r){return!r.definition||!r.definition.$cstNode||r.definition.$cstNode.length===0}});var Ku=C(Xr=>{"use strict";Object.defineProperty(Xr,"__esModule",{value:!0});Xr.DocumentValidator=Xr.toDiagnosticSeverity=Xr.getDiagnosticRange=Xr.DefaultDocumentValidator=void 0;var Sr=Ne(),wT=Pt(),pD=Re(),mD=et(),Hu=Yr(),Sp=class{constructor(e){this.validationRegistry=e.validation.ValidationRegistry,this.metadata=e.LanguageMetaData}async validateDocument(e,t=Sr.CancellationToken.None){let n=e.parseResult,i=[];await(0,Hu.interruptAndCheck)(t);for(let o of n.lexerErrors){let a={severity:Sr.DiagnosticSeverity.Error,range:{start:{line:o.line-1,character:o.column-1},end:{line:o.line-1,character:o.column+o.length-1}},message:o.message,code:Wu.LexingError,source:this.getSource()};i.push(a)}for(let o of n.parserErrors){let a;if(isNaN(o.token.startOffset)){if("previousToken"in o){let s=o.previousToken;if(isNaN(s.startOffset))a=Sr.Range.create(0,0,0,0);else{let u=Sr.Position.create(s.endLine-1,s.endColumn);a=Sr.Range.create(u,u)}}}else a=(0,mD.tokenToRange)(o.token);if(a){let s={severity:Sr.DiagnosticSeverity.Error,range:a,message:o.message,code:Wu.ParsingError,source:this.getSource()};i.push(s)}}for(let o of e.references){let a=o.error;if(a){let s={containerType:a.container.$type,property:a.property,refText:a.reference.$refText},u={node:a.container,property:a.property,index:a.index,code:Wu.LinkingError,data:s};i.push(this.toDiagnostic("error",a.message,u))}}try{i.push(...await this.validateAst(n.value,e,t))}catch(o){if((0,Hu.isOperationCancelled)(o))throw o;console.error("An error occurred during validation:",o)}return await(0,Hu.interruptAndCheck)(t),i}async validateAst(e,t,n=Sr.CancellationToken.None){let i=[],o=(a,s,u)=>{i.push(this.toDiagnostic(a,s,u))};return await Promise.all((0,pD.streamAst)(e).map(async a=>{await(0,Hu.interruptAndCheck)(n);let s=this.validationRegistry.getChecks(a.$type);for(let u of s)await u(a,o,n)})),i}toDiagnostic(e,t,n){return{message:t,range:IT(n),severity:OT(e),code:n.code,codeDescription:n.codeDescription,tags:n.tags,relatedInformation:n.relatedInformation,data:n.data,source:this.getSource()}}getSource(){return this.metadata.languageId}};Xr.DefaultDocumentValidator=Sp;function IT(r){if(Sr.Range.is(r.range))return r.range;let e;return typeof r.property=="string"?e=(0,wT.findNodeForProperty)(r.node.$cstNode,r.property,r.index):typeof r.keyword=="string"&&(e=(0,wT.findNodeForKeyword)(r.node.$cstNode,r.keyword,r.index)),e??(e=r.node.$cstNode),e?e.range:{start:{line:0,character:0},end:{line:0,character:0}}}Xr.getDiagnosticRange=IT;function OT(r){switch(r){case"error":return Sr.DiagnosticSeverity.Error;case"warning":return Sr.DiagnosticSeverity.Warning;case"info":return Sr.DiagnosticSeverity.Information;case"hint":return Sr.DiagnosticSeverity.Hint;default:throw new Error("Invalid diagnostic severity: "+r)}}Xr.toDiagnosticSeverity=OT;var Wu;(function(r){r.LexingError="lexing-error",r.ParsingError="parsing-error",r.LinkingError="linking-error"})(Wu=Xr.DocumentValidator||(Xr.DocumentValidator={}))});var FT=C(Rn=>{"use strict";var hD=Rn&&Rn.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),yD=Rn&&Rn.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),gD=Rn&&Rn.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&hD(e,r,t);return yD(e,r),e};Object.defineProperty(Rn,"__esModule",{value:!0});Rn.LangiumGrammarCodeActionProvider=void 0;var Jr=Ne(),$T=Re(),MT=et(),vD=Pt(),LT=So(),TD=Ku(),Np=gD(ze()),Nr=xp(),Dp=class{getCodeActions(e,t){let n=[];for(let i of t.context.diagnostics){let o=this.createCodeAction(i,e);o&&n.push(o)}return n}createCodeAction(e,t){switch(e.code){case Nr.IssueCodes.GrammarNameUppercase:case Nr.IssueCodes.RuleNameUppercase:return this.makeUpperCase(e,t);case Nr.IssueCodes.HiddenGrammarTokens:return this.fixHiddenTerminals(e,t);case Nr.IssueCodes.UseRegexTokens:return this.fixRegexTokens(e,t);case Nr.IssueCodes.EntryRuleTokenSyntax:return this.addEntryKeyword(e,t);case Nr.IssueCodes.CrossRefTokenSyntax:return this.fixCrossRefSyntax(e,t);case Nr.IssueCodes.MissingImport:return this.fixMissingImport(e,t);case Nr.IssueCodes.UnnecessaryFileExtension:return this.fixUnnecessaryFileExtension(e,t);case Nr.IssueCodes.InvalidInfers:case Nr.IssueCodes.InvalidReturns:return this.fixInvalidReturnsInfers(e,t);case Nr.IssueCodes.MissingInfer:return this.fixMissingInfer(e,t);case Nr.IssueCodes.SuperfluousInfer:return this.fixSuperfluousInfer(e,t);case TD.DocumentValidator.LinkingError:{let n=e.data;if(n&&n.containerType==="RuleCall"&&n.property==="rule")return this.addNewRule(e,n,t);break}}}fixInvalidReturnsInfers(e,t){let n=e.data;if(n){let i=t.textDocument.getText(n.range);return{title:`Correct ${i} usage`,kind:Jr.CodeActionKind.QuickFix,diagnostics:[e],edit:{changes:{[t.textDocument.uri]:[{range:n.range,newText:i==="infers"?"returns":"infers"}]}}}}}fixMissingInfer(e,t){let n=e.data;if(n)return{title:"Correct 'infer' usage",kind:Jr.CodeActionKind.QuickFix,diagnostics:[e],edit:{changes:{[t.textDocument.uri]:[{range:{start:n.range.end,end:n.range.end},newText:"infer "}]}}}}fixSuperfluousInfer(e,t){if(e.data)return{title:"Remove the 'infer' keyword",kind:Jr.CodeActionKind.QuickFix,diagnostics:[e],edit:{changes:{[t.textDocument.uri]:[{range:e.data,newText:""}]}}}}fixUnnecessaryFileExtension(e,t){let n=Object.assign({},e.range.end);n.character-=1;let i=Object.assign({},n);return i.character-=8,{title:"Remove file extension",kind:Jr.CodeActionKind.QuickFix,diagnostics:[e],isPreferred:!0,edit:{changes:{[t.textDocument.uri]:[{range:{start:i,end:n},newText:""}]}}}}fixMissingImport(e,t){let n,i=t.parseResult.value,o=i.imports,a=i.rules;if(o.length>0)n=o[0].$cstNode.range.start;else if(a.length>0)n=a[0].$cstNode.range.start;else return;let s=e.data;if(typeof s=="string")return{title:`Add import to '${s}'`,kind:Jr.CodeActionKind.QuickFix,diagnostics:[e],isPreferred:!0,edit:{changes:{[t.textDocument.uri]:[{range:{start:n,end:n},newText:`import '${s}';
3583
- `}]}}}}makeUpperCase(e,t){let n={start:e.range.start,end:{line:e.range.start.line,character:e.range.start.character+1}};return{title:"First letter to upper case",kind:Jr.CodeActionKind.QuickFix,diagnostics:[e],isPreferred:!0,edit:{changes:{[t.textDocument.uri]:[{range:n,newText:t.textDocument.getText(n).toUpperCase()}]}}}}addEntryKeyword(e,t){return{title:"Add entry keyword",kind:Jr.CodeActionKind.QuickFix,diagnostics:[e],isPreferred:!0,edit:{changes:{[t.textDocument.uri]:[{range:{start:e.range.start,end:e.range.start},newText:"entry "}]}}}}fixRegexTokens(e,t){let n=t.textDocument.offsetAt(e.range.start),i=t.parseResult.value.$cstNode;if(i){let o=(0,MT.findLeafNodeAtOffset)(i,n),a=(0,$T.getContainerOfType)(o?.element,Np.isCharacterRange);if(a&&a.right&&a.$cstNode){let s=a.left.value,u=a.right.value;return{title:"Refactor into regular expression",kind:Jr.CodeActionKind.QuickFix,diagnostics:[e],isPreferred:!0,edit:{changes:{[t.textDocument.uri]:[{range:a.$cstNode.range,newText:`/[${(0,LT.escapeRegExp)(s)}-${(0,LT.escapeRegExp)(u)}]/`}]}}}}}}fixCrossRefSyntax(e,t){return{title:"Replace '|' with ':'",kind:Jr.CodeActionKind.QuickFix,diagnostics:[e],isPreferred:!0,edit:{changes:{[t.textDocument.uri]:[{range:e.range,newText:":"}]}}}}fixHiddenTerminals(e,t){let n=t.parseResult.value,i=n.hiddenTokens,o=[],a=(0,vD.findNodeForProperty)(n.$cstNode,"definesHiddenTokens");if(a){let s=a.range.start,u=a.offset,c=n.$cstNode.text.indexOf(")",u)+1;o.push({newText:"",range:{start:s,end:t.textDocument.positionAt(c)}})}for(let s of i){let u=s.ref;if(u&&Np.isTerminalRule(u)&&!u.hidden&&u.$cstNode){let c=u.$cstNode.range.start;o.push({newText:"hidden ",range:{start:c,end:c}})}}return{title:"Fix hidden terminals",kind:Jr.CodeActionKind.QuickFix,diagnostics:[e],isPreferred:!0,edit:{changes:{[t.textDocument.uri]:o}}}}addNewRule(e,t,n){let i=n.textDocument.offsetAt(e.range.start),o=n.parseResult.value.$cstNode;if(o){let a=(0,MT.findLeafNodeAtOffset)(o,i),s=(0,$T.getContainerOfType)(a?.element,Np.isParserRule);if(s&&s.$cstNode)return{title:`Add new rule '${t.refText}'`,kind:Jr.CodeActionKind.QuickFix,diagnostics:[e],isPreferred:!0,edit:{changes:{[n.textDocument.uri]:[{range:{start:s.$cstNode.range.end,end:s.$cstNode.range.end},newText:`
3580
+ `),i("\r"),i(" "),i("\v"),i(" "),i("\xA0"),i("\u1680"),i("\u2000"),i("\u2001"),i("\u2002"),i("\u2003"),i("\u2004"),i("\u2005"),i("\u2006"),i("\u2007"),i("\u2008"),i("\u2009"),i("\u200A"),i("\u2028"),i("\u2029"),i("\u202F"),i("\u205F"),i("\u3000"),i("\uFEFF")];function y(){}return y.prototype.visitChildren=function(p){for(var A in p){var x=p[A];p.hasOwnProperty(A)&&(x.type!==void 0?this.visit(x):Array.isArray(x)&&x.forEach(function(k){this.visit(k)},this))}},y.prototype.visit=function(p){switch(p.type){case"Pattern":this.visitPattern(p);break;case"Flags":this.visitFlags(p);break;case"Disjunction":this.visitDisjunction(p);break;case"Alternative":this.visitAlternative(p);break;case"StartAnchor":this.visitStartAnchor(p);break;case"EndAnchor":this.visitEndAnchor(p);break;case"WordBoundary":this.visitWordBoundary(p);break;case"NonWordBoundary":this.visitNonWordBoundary(p);break;case"Lookahead":this.visitLookahead(p);break;case"NegativeLookahead":this.visitNegativeLookahead(p);break;case"Character":this.visitCharacter(p);break;case"Set":this.visitSet(p);break;case"Group":this.visitGroup(p);break;case"GroupBackReference":this.visitGroupBackReference(p);break;case"Quantifier":this.visitQuantifier(p);break}this.visitChildren(p)},y.prototype.visitPattern=function(p){},y.prototype.visitFlags=function(p){},y.prototype.visitDisjunction=function(p){},y.prototype.visitAlternative=function(p){},y.prototype.visitStartAnchor=function(p){},y.prototype.visitEndAnchor=function(p){},y.prototype.visitWordBoundary=function(p){},y.prototype.visitNonWordBoundary=function(p){},y.prototype.visitLookahead=function(p){},y.prototype.visitNegativeLookahead=function(p){},y.prototype.visitCharacter=function(p){},y.prototype.visitSet=function(p){},y.prototype.visitGroup=function(p){},y.prototype.visitGroupBackReference=function(p){},y.prototype.visitQuantifier=function(p){},{RegExpParser:r,BaseRegExpVisitor:y,VERSION:"0.5.0"}})});var So=C(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.partialRegex=Bt.partialMatches=Bt.getCaseInsensitivePattern=Bt.escapeRegExp=Bt.isWhitespaceRegExp=Bt.isMultilineComment=Bt.getTerminalParts=void 0;var Zv=wa(),Qv=new Zv.RegExpParser,Qf=class extends Zv.BaseRegExpVisitor{constructor(){super(...arguments),this.isStarting=!0,this.endRegexStack=[],this.multiline=!1}get endRegex(){return this.endRegexStack.join("")}reset(e){this.multiline=!1,this.regex=e,this.startRegex="",this.isStarting=!0,this.endRegexStack=[]}visitGroup(e){e.quantifier&&(this.isStarting=!1,this.endRegexStack=[])}visitCharacter(e){let t=String.fromCharCode(e.value);if(!this.multiline&&t===`
3581
+ `&&(this.multiline=!0),e.quantifier)this.isStarting=!1,this.endRegexStack=[];else{let n=ep(t);this.endRegexStack.push(n),this.isStarting&&(this.startRegex+=n)}}visitSet(e){if(!this.multiline){let t=this.regex.substring(e.loc.begin,e.loc.end),n=new RegExp(t);this.multiline=!!`
3582
+ `.match(n)}if(e.quantifier)this.isStarting=!1,this.endRegexStack=[];else{let t=this.regex.substring(e.loc.begin,e.loc.end);this.endRegexStack.push(t),this.isStarting&&(this.startRegex+=t)}}},Li=new Qf;function XS(r){try{typeof r!="string"&&(r=r.source),r=`/${r}/`;let e=Qv.pattern(r),t=[];for(let n of e.value.value)Li.reset(r),Li.visit(n),t.push({start:Li.startRegex,end:Li.endRegex});return t}catch{return[]}}Bt.getTerminalParts=XS;function JS(r){try{return typeof r!="string"&&(r=r.source),r=`/${r}/`,Li.reset(r),Li.visit(Qv.pattern(r)),Li.multiline}catch{return!1}}Bt.isMultilineComment=JS;function ZS(r){return(typeof r=="string"?new RegExp(r):r).test(" ")}Bt.isWhitespaceRegExp=ZS;function ep(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}Bt.escapeRegExp=ep;function QS(r){return Array.prototype.map.call(r,e=>/\w/.test(e)?`[${e.toLowerCase()}${e.toUpperCase()}]`:ep(e)).join("")}Bt.getCaseInsensitivePattern=QS;function eN(r,e){let t=eT(r),n=e.match(t);return!!n&&n[0].length>0}Bt.partialMatches=eN;function eT(r){typeof r=="string"&&(r=new RegExp(r));let e=r,t=r.source,n=0;function i(){let o="",a;function s(c){o+=t.substr(n,c),n+=c}function u(c){o+="(?:"+t.substr(n,c)+"|$)",n+=c}for(;n<t.length;)switch(t[n]){case"\\":switch(t[n+1]){case"c":u(3);break;case"x":u(4);break;case"u":e.unicode?t[n+2]==="{"?u(t.indexOf("}",n)-n+1):u(6):u(2);break;case"p":case"P":e.unicode?u(t.indexOf("}",n)-n+1):u(2);break;case"k":u(t.indexOf(">",n)-n+1);break;default:u(2);break}break;case"[":a=/\[(?:\\.|.)*?\]/g,a.lastIndex=n,a=a.exec(t)||[],u(a[0].length);break;case"|":case"^":case"$":case"*":case"+":case"?":s(1);break;case"{":a=/\{\d+,?\d*\}/g,a.lastIndex=n,a=a.exec(t),a?s(a[0].length):u(1);break;case"(":if(t[n+1]==="?")switch(t[n+2]){case":":o+="(?:",n+=3,o+=i()+"|$)";break;case"=":o+="(?=",n+=3,o+=i()+")";break;case"!":a=n,n+=3,i(),o+=t.substr(a,n-a);break;case"<":switch(t[n+3]){case"=":case"!":a=n,n+=4,i(),o+=t.substr(a,n-a);break;default:s(t.indexOf(">",n)-n+1),o+=i()+"|$)";break}break}else s(1),o+=i()+"|$)";break;case")":return++n,o;default:u(1);break}return o}return new RegExp(i(),r.flags)}Bt.partialRegex=eT});var Lt=C(ae=>{"use strict";var tN=ae&&ae.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),rN=ae&&ae.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),nN=ae&&ae.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&tN(e,r,t);return rN(e,r),e};Object.defineProperty(ae,"__esModule",{value:!0});ae.extractAssignments=ae.processActionNodeWithNodeDescriptionProvider=ae.processTypeNodeWithNodeLocator=ae.prepareGrammar=ae.resolveTransitiveImports=ae.resolveImport=ae.terminalRegex=ae.getRuleType=ae.getExplicitRuleType=ae.getTypeName=ae.getActionAtElement=ae.isDataTypeRule=ae.isArrayOperator=ae.isArrayCardinality=ae.isOptionalCardinality=void 0;var fe=nN(ze()),rp=vn(),Fi=Re(),iN=kr(),oN=mi(),aN=So();function sN(r){return r==="?"||r==="*"}ae.isOptionalCardinality=sN;function uN(r){return r==="*"||r==="+"}ae.isArrayCardinality=uN;function cN(r){return r==="+="}ae.isArrayOperator=cN;function ip(r){return tT(r,new Set)}ae.isDataTypeRule=ip;function tT(r,e){if(e.has(r))return!0;e.add(r);for(let t of(0,Fi.streamAllContents)(r))if(fe.isRuleCall(t)&&fe.isParserRule(t.rule.ref)){if(!tT(t.rule.ref,e))return!1}else{if(fe.isAssignment(t))return!1;if(fe.isAction(t))return!1}return!0}function rT(r){let e=r.$container;if(fe.isGroup(e)){let t=e.elements,n=t.indexOf(r);for(let i=n-1;i>=0;i--){let o=t[i];if(fe.isAction(o))return o;{let a=(0,Fi.streamAllContents)(t[i]).find(fe.isAction);if(a)return a}}}if(fe.isAbstractElement(e))return rT(e)}ae.getActionAtElement=rT;function nT(r){var e;if(fe.isParserRule(r))return ip(r)?r.name:(e=op(r))!==null&&e!==void 0?e:r.name;if(fe.isInterface(r)||fe.isType(r)||fe.isReturnType(r))return r.name;if(fe.isAction(r)){let t=iT(r);if(t)return t}else if(fe.isInferredType(r))return r.name;throw new oN.TypeResolutionError("Cannot get name of Unknown Type",r.$cstNode)}ae.getTypeName=nT;function op(r){if(r.inferredType)return r.inferredType.name;if(r.dataType)return r.dataType;if(r.returnType){let e=r.returnType.ref;if(e){if(fe.isParserRule(e))return e.name;if(fe.isInterface(e)||fe.isType(e))return e.name}}}ae.getExplicitRuleType=op;function iT(r){var e;if(r.inferredType)return r.inferredType.name;if(!((e=r.type)===null||e===void 0)&&e.ref)return nT(r.type.ref)}function lN(r){var e,t,n;return fe.isTerminalRule(r)?(t=(e=r.type)===null||e===void 0?void 0:e.name)!==null&&t!==void 0?t:"string":ip(r)?r.name:(n=op(r))!==null&&n!==void 0?n:r.name}ae.getRuleType=lN;function oT(r){return Ia(r.definition)}ae.terminalRegex=oT;var ap=/[\s\S]/.source;function Ia(r){if(fe.isTerminalAlternatives(r))return dN(r);if(fe.isTerminalGroup(r))return fN(r);if(fe.isCharacterRange(r))return hN(r);if(fe.isTerminalRuleCall(r)){let e=r.rule.ref;if(!e)throw new Error("Missing rule reference.");return Un(oT(e),r.cardinality)}else{if(fe.isNegatedToken(r))return mN(r);if(fe.isUntilToken(r))return pN(r);if(fe.isRegexToken(r))return Un(r.regex,r.cardinality,!1);if(fe.isWildcard(r))return Un(ap,r.cardinality);throw new Error("Invalid terminal element.")}}function dN(r){return Un(r.elements.map(Ia).join("|"),r.cardinality)}function fN(r){return Un(r.elements.map(Ia).join(""),r.cardinality)}function pN(r){return Un(`${ap}*?${Ia(r.terminal)}`,r.cardinality)}function mN(r){return Un(`(?!${Ia(r.terminal)})${ap}*?`,r.cardinality)}function hN(r){return r.right?Un(`[${tp(r.left)}-${tp(r.right)}]`,r.cardinality,!1):Un(tp(r.left),r.cardinality,!1)}function tp(r){return(0,aN.escapeRegExp)(r.value)}function Un(r,e,t=!0){return t&&(r=`(${r})`),e?`${r}${e}`:r}function sp(r,e){if(e.path===void 0||e.path.length===0)return;let t=rp.Utils.dirname((0,Fi.getDocument)(e).uri),n=e.path;n.endsWith(".langium")||(n+=".langium");let i=rp.Utils.resolvePath(t,n);try{let a=r.getOrCreateDocument(i).parseResult.value;if(fe.isGrammar(a))return a}catch{}}ae.resolveImport=sp;function yN(r,e){if(fe.isGrammarImport(e)){let t=sp(r,e);if(t){let n=np(r,t);return n.push(t),n}return[]}else return np(r,e)}ae.resolveTransitiveImports=yN;function np(r,e,t=e,n=new Set,i=new Set){let o=(0,Fi.getDocument)(e);if(t!==e&&i.add(e),!n.has(o.uri)){n.add(o.uri);for(let a of e.imports){let s=sp(r,a);s&&np(r,s,t,n,i)}}return Array.from(i)}function gN(r,e){let t=e,n=r.shared.workspace.LangiumDocumentFactory.fromModel(e,rp.URI.parse("memory://grammar.langium"));return t.$document=n,n.precomputedScopes=vN(r,e),e}ae.prepareGrammar=gN;function vN(r,e){let t=r.references.NameProvider,n=r.workspace.AstNodeDescriptionProvider,i=(0,Fi.getDocument)(e),o=new iN.MultiMap,a=aT(r.workspace.AstNodeLocator),s=sT(n);for(let u of(0,Fi.streamAllContents)(e)){if(fe.isReturnType(u))continue;s(u,i,o),a(u,i,o);let c=u.$container;if(c){let l=t.getName(u);l&&o.add(c,n.createDescription(u,l,i))}}return o}function aT(r){return(e,t,n)=>{var i;let o=e.$container;if(o&&fe.isParserRule(e)&&!e.returnType&&!e.dataType){let a=(i=e.inferredType)!==null&&i!==void 0?i:e;n.add(o,{node:a,name:a.name,type:"Interface",documentUri:t.uri,path:r.getAstNodePath(a)})}}}ae.processTypeNodeWithNodeLocator=aT;function sT(r){return(e,t,n)=>{let i=(0,Fi.findRootNode)(e);if(i&&fe.isAction(e)&&e.inferredType){let o=iT(e);o&&n.add(i,r.createDescription(e,o,t))}}}ae.processActionNodeWithNodeDescriptionProvider=sT;function uT(r){return fe.isAssignment(r)?[r]:fe.isAlternatives(r)||fe.isGroup(r)||fe.isUnorderedGroup(r)?r.elements.flatMap(e=>uT(e)):[]}ae.extractAssignments=uT});var dT=C(No=>{"use strict";Object.defineProperty(No,"__esModule",{value:!0});No.LangiumGrammarScopeComputation=No.LangiumGrammarScopeProvider=void 0;var TN=xu(),RN=Nu(),cT=Re(),_N=Ct(),AN=ze(),lT=Lt(),up=class extends RN.DefaultScopeProvider{constructor(e){super(e)}getScope(e){let t=this.reflection.getReferenceType(e);if(t!=="AbstractType")return super.getScope(e);let n=[],i=(0,cT.getDocument)(e.container).precomputedScopes,o=(0,cT.findRootNode)(e.container);if(i&&o){let s=i.get(o),u=[],c=[];if(s.length>0){for(let l of s)this.reflection.isSubtype(l.type,"ParserRule")?u.push(l):this.reflection.isSubtype(l.type,t)&&c.push(l);n.push((0,_N.stream)(c.concat(u.filter(l=>!c.some(d=>d.name===l.name)))))}}let a=this.getGlobalScope(t);for(let s=n.length-1;s>=0;s--)a=this.createScope(n[s],a);return a}};No.LangiumGrammarScopeProvider=up;var cp=class extends TN.DefaultScopeComputation{constructor(e){super(e),this.processTypeNode=(0,lT.processTypeNodeWithNodeLocator)(e.workspace.AstNodeLocator),this.processActionNode=(0,lT.processActionNodeWithNodeDescriptionProvider)(e.workspace.AstNodeDescriptionProvider)}processNode(e,t,n){(0,AN.isReturnType)(e)||(this.processTypeNode(e,t,n),this.processActionNode(e,t,n),super.processNode(e,t,n))}};No.LangiumGrammarScopeComputation=cp});var hi=C(Do=>{"use strict";Object.defineProperty(Do,"__esModule",{value:!0});Do.relativeURI=Do.equalURI=void 0;function bN(r,e){return r?.toString()===e?.toString()}Do.equalURI=bN;function EN(r,e){let t=r.path,n=e.path,i=t.split("/").filter(c=>c.length>0),o=n.split("/").filter(c=>c.length>0),a=0;for(;a<i.length&&i[a]===o[a];a++);let s="../".repeat(i.length-a),u=o.slice(a).join("/");return s+u}Do.relativeURI=EN});var Lu=C(Mu=>{"use strict";Object.defineProperty(Mu,"__esModule",{value:!0});Mu.ValidationRegistry=void 0;var CN=kr(),PN=Yr(),lp=class{constructor(e){this.validationChecks=new CN.MultiMap,this.reflection=e.shared.AstReflection}register(e,t=this){for(let[n,i]of Object.entries(e))if(Array.isArray(i))for(let o of i)this.doRegister(n,this.wrapValidationException(o,t));else i&&this.doRegister(n,this.wrapValidationException(i,t))}wrapValidationException(e,t){return async(n,i,o)=>{try{await e.call(t,n,i,o)}catch(a){if((0,PN.isOperationCancelled)(a))throw a;console.error("An error occurred during validation:",a);let s=a instanceof Error?a.message:String(a);a instanceof Error&&a.stack&&console.error(a.stack),i("error","An error occurred during validation: "+s,{node:n})}}}doRegister(e,t){for(let n of this.reflection.getAllTypes())this.reflection.isSubtype(n,e)&&this.validationChecks.add(n,t)}getChecks(e){return this.validationChecks.get(e)}};Mu.ValidationRegistry=lp});var fp=C(Fu=>{"use strict";Object.defineProperty(Fu,"__esModule",{value:!0});Fu.collectDeclaredTypes=void 0;var dp=Lt(),fT=mi(),kN=kr();function xN(r,e,t){var n;function i(s,u){var c;let l=(c=u.unions.find(d=>d.name===s))!==null&&c!==void 0?c:u.interfaces.find(d=>d.name===s);l&&a.get(s).forEach(d=>l.superTypes.add(d))}let o={unions:[],interfaces:[]};for(let s of r){let u=s.superTypes.filter(l=>l.ref).map(l=>(0,dp.getTypeName)(l.ref)),c=s.attributes.map(l=>({name:l.name,optional:l.isOptional===!0,typeAlternatives:l.typeAlternatives.map(pT)}));o.interfaces.push(new fT.InterfaceType(s.name,u,c))}let a=new kN.MultiMap;for(let s of e){let u=s.typeAlternatives.map(pT),c=s.typeAlternatives.length>1&&s.typeAlternatives.some(l=>{var d;return((d=l.refType)===null||d===void 0?void 0:d.ref)!==void 0});if(o.unions.push(new fT.UnionType(s.name,u,{reflection:c})),c)for(let l of s.typeAlternatives)!((n=l.refType)===null||n===void 0)&&n.ref&&a.add((0,dp.getTypeName)(l.refType.ref),s.name)}for(let s of a.keys())i(s,t),i(s,o);return o}Fu.collectDeclaredTypes=xN;function pT(r){var e,t;let n=[];return r.refType?n=[r.refType.ref?(0,dp.getTypeName)(r.refType.ref):r.refType.$refText]:n=[(e=r.primitiveType)!==null&&e!==void 0?e:`'${(t=r.keywordType)===null||t===void 0?void 0:t.value}'`],{types:n,reference:r.isRef===!0,array:r.isArray===!0}}});var Io=C(wo=>{"use strict";Object.defineProperty(wo,"__esModule",{value:!0});wo.DefaultNameProvider=wo.isNamed=void 0;var SN=Pt();function mT(r){return typeof r.name=="string"}wo.isNamed=mT;var pp=class{getName(e){if(mT(e))return e.name}getNameNode(e){return(0,SN.findNodeForProperty)(e.$cstNode,"name")}};wo.DefaultNameProvider=pp});var gp=C(qu=>{"use strict";Object.defineProperty(qu,"__esModule",{value:!0});qu.collectInferredTypes=void 0;var Nt=ze(),NN=Io(),DN=Ct(),Oo=mi(),yT=kr(),Hn=Lt();function hT(r){return JSON.parse(JSON.stringify(r))}function mp(r,e,t){if(e.ruleCalls.length>0){for(let n of e.ruleCalls)t.add(n);return}for(let n of e.parents)r.name===void 0?mp(n,n,t):n.name!==void 0&&n.name!==r.name?t.add(n.name):mp(r,n,t);e.parents.length===0&&e.name&&t.add(e.name)}var hp=class{constructor(e,t){this.context=e,this.root=t}getTypes(){let e={name:this.root.name,properties:this.root.properties,ruleCalls:this.root.ruleCalls,super:[]};return this.root.children.length===0?[e]:this.applyNext(this.root,{alt:e,next:this.root.children}).map(t=>t.alt)}applyNext(e,t){let n=this.splitType(t.alt,t.next.length),i=[];for(let o=0;o<t.next.length;o++){let a=n[o],s=t.next[o];if(s.declaredType)continue;s.actionWithAssignment&&i.push({alt:hT(a),next:[]}),s.name!==void 0&&s.name!==a.name&&(s.actionWithAssignment?(a.properties=[],a.ruleCalls=[],a.super=[e.name],a.name=s.name):(a.super=[a.name],a.name=s.name)),a.properties.push(...s.properties),a.ruleCalls.push(...s.ruleCalls);let u={alt:a,next:s.children};u.next.length===0?(u.alt.super=u.alt.super.filter(c=>c!==u.alt.name),i.push(u)):i.push(...this.applyNext(e,u))}return i}splitType(e,t){let n=[];for(let i=0;i<t;i++)n.push(hT(e));return n}getSuperTypes(e){let t=new Set;return mp(e,e,t),Array.from(t).sort()}connect(e,t){return t.parents.push(e),e.children.push(t),t}merge(...e){if(e.length===1)return e[0];if(e.length===0)return;let t=Oa();t.parents=e;for(let n of e)n.children.push(t);return t}};function wN(r,e){var t;let n=[],i={fragments:new Map};for(let u of r)n.push(...gT(i,u));let o=TT(n);HN(o);let a=IN(o),s=BN(o,a);for(let u of e){let c=(0,Nt.isAlternatives)(u.definition)&&u.definition.elements.every(l=>(0,Nt.isKeyword)(l))?(0,DN.stream)(u.definition.elements).filter(Nt.isKeyword).map(l=>`'${l.value}'`).toArray().sort():[(t=(0,Hn.getExplicitRuleType)(u))!==null&&t!==void 0?t:"string"];s.unions.push(new Oo.UnionType(u.name,$a(!1,!1,c)))}return s}qu.collectInferredTypes=wN;function IN(r){let e=[],t=new yT.MultiMap;for(let n of r)for(let i of n.superTypes)t.add(i,n.name);for(let[n,i]of t.entriesGroupedByKey())r.some(o=>o.name===n)||e.push(new Oo.UnionType(n,$a(!1,!1,i),{reflection:!0}));return e}function gT(r,e){let t=Oa(e),n=new hp(r,t);return yp(n,n.root,e.definition),n.getTypes()}function Oa(r){return{name:(0,Nt.isParserRule)(r)?(0,Hn.getTypeName)(r):r,properties:[],ruleCalls:[],children:[],parents:[],actionWithAssignment:!1}}function yp(r,e,t){let n=(0,Hn.isOptionalCardinality)(t.cardinality);if((0,Nt.isAlternatives)(t)){let i=[];n&&i.push(e);for(let o of t.elements){let a=r.connect(e,Oa());i.push(yp(r,a,o))}return r.merge(...i)}else if((0,Nt.isGroup)(t)||(0,Nt.isUnorderedGroup)(t)){let i=n?r.connect(e,Oa()):e;for(let o of t.elements)i=yp(r,i,o);return n?r.merge(e,i):i}else{if((0,Nt.isAction)(t))return ON(r,e,t);(0,Nt.isAssignment)(t)?$N(e,t):(0,Nt.isRuleCall)(t)&&LN(r,e,t)}return e}function ON(r,e,t){var n,i;let o=r.connect(e,Oa((n=t.inferredType)===null||n===void 0?void 0:n.name));if(t.type){o.declaredType=!0;let a=(i=t.type)===null||i===void 0?void 0:i.ref;a&&(0,NN.isNamed)(a)&&(o.name=a.name)}return t.feature&&t.operator&&(o.actionWithAssignment=!0,o.properties.push({name:t.feature,optional:!1,typeAlternatives:$a(t.operator==="+=",!1,r.root.ruleCalls.length!==0?r.root.ruleCalls:r.getSuperTypes(o))})),o}function $N(r,e){let t={types:new Set,reference:!1};vT(e.terminal,t);let n=$a(e.operator==="+=",t.reference,e.operator==="?="?["boolean"]:Array.from(t.types));r.properties.push({name:e.feature,optional:(0,Hn.isOptionalCardinality)(e.cardinality),typeAlternatives:n})}function vT(r,e){(0,Nt.isAlternatives)(r)||(0,Nt.isUnorderedGroup)(r)||(0,Nt.isGroup)(r)?MN(r,e):(0,Nt.isKeyword)(r)?e.types.add(`'${r.value}'`):(0,Nt.isRuleCall)(r)&&r.rule.ref?e.types.add((0,Hn.getRuleType)(r.rule.ref)):(0,Nt.isCrossReference)(r)&&r.type.ref&&(e.types.add((0,Hn.getTypeName)(r.type.ref)),e.reference=!0)}function MN(r,e){for(let t of r.elements)vT(t,e)}function LN(r,e,t){let n=t.rule.ref;if((0,Nt.isParserRule)(n)&&n.fragment){let i=FN(n,r.context);(0,Hn.isOptionalCardinality)(t.cardinality)?e.properties.push(...i.map(o=>Object.assign(Object.assign({},o),{optional:!0}))):e.properties.push(...i)}else(0,Nt.isParserRule)(n)&&e.ruleCalls.push((0,Hn.getRuleType)(n))}function FN(r,e){let t=e.fragments.get(r);if(t)return t;let n=[];e.fragments.set(r,n);let i=(0,Hn.getTypeName)(r),o=gT(e,r),s=TT(o).find(u=>u.name===i);return s&&n.push(...s.properties),n}function TT(r){let e=new Map,t=[],n=qN(r);for(let i of n){let o=new Oo.InterfaceType(i.name,i.super,i.properties);e.set(o.name,o),i.ruleCalls.length>0&&(t.push(i),i.ruleCalls.forEach(a=>{a!==o.name&&o.subTypes.add(a)}))}for(let i of t)for(let o of i.ruleCalls){let a=e.get(o);a&&a.name!==i.name&&a.superTypes.add(i.name)}return Array.from(e.values())}function qN(r){let e=r.reduce((n,i)=>n.add(i.name,i),new yT.MultiMap),t=[];for(let[n,i]of e.entriesGroupedByKey()){let o=[],a=new Set,s={name:n,properties:o,ruleCalls:[],super:[]};for(let u of i){s.super.push(...u.super);let c=u.properties,l=new Set;for(let d of c){l.add(d.name);let g=o.find(y=>y.name===d.name);g?d.typeAlternatives.filter(jN(g.typeAlternatives)).forEach(y=>g.typeAlternatives.push(y)):o.push(Object.assign({},d))}c.length===0&&u.ruleCalls.forEach(d=>a.add(d))}for(let u of i)if(u.ruleCalls.length===0)for(let c of o)u.properties.find(l=>l.name===c.name)||(c.optional=!0);s.ruleCalls=Array.from(a),t.push(s)}return t}function jN(r){return e=>!r.some(t=>GN(t,e))}function GN(r,e){return r.array===e.array&&r.reference===e.reference&&UN(r.types,e.types)}function UN(r,e,t=(n,i)=>n===i){let n=(0,Oo.distinctAndSorted)(r),i=(0,Oo.distinctAndSorted)(e);return n.length!==i.length?!1:i.every((o,a)=>t(o,n[a]))}function HN(r){var e,t;for(let i of r){for(let o of i.properties.flatMap(a=>a.typeAlternatives.filter(s=>!s.reference).flatMap(s=>s.types)))(e=r.find(a=>a.name===o))===null||e===void 0||e.containerTypes.add(i.name);for(let o of i.superTypes)(t=r.find(a=>a.name===o))===null||t===void 0||t.subTypes.add(i.name)}let n=[];WN(n,r),KN(n)}function WN(r,e){function t(i){let o=[i];n.add(i.name);let a=[...i.subTypes,...i.superTypes];for(let s of a)if(!n.has(s)){let u=e.find(c=>c.name===s);u&&o.push(...t(u))}return o}let n=new Set;for(let i of e)n.has(i.name)||r.push(t(i))}function KN(r){for(let e of r){let t=new Set;e.forEach(n=>n.containerTypes.forEach(i=>t.add(i))),e.forEach(n=>n.containerTypes=t)}}function BN(r,e){let t={interfaces:[],unions:e},n=new Set(e.map(i=>i.name));for(let i of r)if(i.properties.length===0&&i.subTypes.size>0){let o=$a(!1,!1,Array.from(i.subTypes)),a=e.find(s=>s.name===i.name);if(a)a.union.push(...o);else{let s=new Oo.UnionType(i.name,o,{reflection:!0});s.superTypes=i.superTypes,t.unions.push(s),n.add(i.name)}}else t.interfaces.push(i);for(let i of t.interfaces)i.interfaceSuperTypes=[...i.superTypes].filter(o=>!n.has(o)).sort();return t}function $a(r,e,t){return r||e?[{array:r,reference:e,types:t}]:t.map(n=>({array:r,reference:e,types:[n]}))}});var xT=C(Tn=>{"use strict";Object.defineProperty(Tn,"__esModule",{value:!0});Tn.collectAllInterfaces=Tn.collectValidationResources=Tn.applyErrorToAssignment=Tn.validateTypesConsistency=void 0;var vp=kr(),AT=fp(),bT=gp(),La=mi(),Fa=Ct(),Tp=Lt();function zN(r,e){function t(a,s){return u=>{a.forEach(c=>e("error",u+` in a rule that returns type '${s}'.`,{node:c?.inferredType?c.inferredType:c,property:"name"}))}}function n(a,s){return(u,c)=>{a.forEach(l=>{(0,Tp.extractAssignments)(l.definition).find(g=>g.feature===u)===void 0&&e("error",c+` in rule '${l.name}', but is required in type '${s}'.`,{node:l,property:"parameters"})})}}let i=CT(r),o=new vp.MultiMap;for(let[a,s]of i.entries())"declared"in s&&Ma(s.declared)&&o.addAll(a,ju(s.declared,"declared",i).values());for(let[a,s]of i.entries()){if("declared"in s&&VN(s,o,e),!JN(s))continue;let u=t(s.nodes,a),c=n(s.nodes,a),l=ET(s.nodes,e);if(RT(s.inferred)&&RT(s.declared))QN(s.inferred.union,s.declared.union,u);else if(Ma(s.inferred)&&Ma(s.declared)){let d=ju(s.inferred,"inferred",i),g=ju(s.declared,"declared",i);eD(d,g,u,l,c)}else{let d=`Inferred and declared versions of type ${a} both have to be interfaces or unions.`;s.nodes.forEach(g=>e("error",d,{node:g?.inferredType?g.inferredType:g,property:"name"})),e("error",d,{node:s.node,property:"name"})}}}Tn.validateTypesConsistency=zN;function VN(r,e,t){let n=r.declared;if(!Ma(n))return;let i=n.interfaceSuperTypes;for(let a=0;a<i.length;a++)for(let s=a+1;s<i.length;s++){let u=i[a],c=i[s],l=e.get(u),d=e.get(c),g=YN(l,d);g.length>0&&t("error",`Cannot simultaneously inherit from '${u}' and '${c}'. Their ${g.map(y=>"'"+y+"'").join(", ")} properties are not identical.`,{node:r.node,property:"name"})}let o=new Set;for(let a of i){let s=e.get(a);for(let u of s)o.add(u.name)}for(let a of n.properties)if(o.has(a.name)){let u=r.node.attributes.find(c=>c.name===a.name);u&&t("error",`Cannot redeclare property '${a.name}'. It is already inherited from another interface.`,{node:u,property:"name"})}}function YN(r,e){let t=[];for(let n of r){let i=e.find(o=>o.name===n.name);i&&!XN(n,i)&&t.push(n.name)}return t}function XN(r,e){if(r.optional!==e.optional||r.typeAlternatives.length!==e.typeAlternatives.length)return!1;for(let t of r.typeAlternatives){let n=!1;for(let i of e.typeAlternatives)i.array===t.array&&i.reference===t.reference&&i.types.length===t.types.length&&i.types.every(o=>t.types.includes(o))&&(n=!0);if(!n)return!1}return!0}function ju(r,e,t,n=new vp.MultiMap,i=new Set){if(i.has(r.name))return n;i.add(r.name);let o=r.properties;for(let a of o)n.add(a.name,a);for(let a of r.interfaceSuperTypes){let s=t.get(a),u=s?.[e];Ma(u)&&ju(u,e,t,n,i)}return n}function ET(r,e){let t=r.flatMap(n=>(0,Tp.extractAssignments)(n.definition));return(n,i)=>{let o=t.find(a=>a.feature===n);o&&e("error",i,{node:o,property:"feature"})}}Tn.applyErrorToAssignment=ET;function RT(r){return r&&"union"in r}function Ma(r){return r&&"properties"in r}function JN(r){return r&&"inferred"in r&&"declared"in r}function CT(r){let e=(0,La.collectAllAstResources)([r]),t=(0,bT.collectInferredTypes)(Array.from(e.parserRules),Array.from(e.datatypeRules)),n=(0,AT.collectDeclaredTypes)(Array.from(e.interfaces),Array.from(e.types),t),i=PT(e),o=_T(t).reduce((s,u)=>s.set(u.name,{inferred:u,nodes:i.get(u.name)}),new Map);return _T(n).reduce((s,u)=>{var c;let l=(c=(0,Fa.stream)(e.types).find(d=>d.name===u.name))!==null&&c!==void 0?c:(0,Fa.stream)(e.interfaces).find(d=>d.name===u.name);if(l){let d=o.get(u.name);s.set(u.name,d?Object.assign(Object.assign({},d),{declared:u,node:l}):{declared:u,node:l})}return s},new Map)}Tn.collectValidationResources=CT;function PT(r){return(0,Fa.stream)(r.parserRules).concat(r.datatypeRules).reduce((e,t)=>e.add((0,Tp.getRuleType)(t),t),new vp.MultiMap)}function _T(r){return r.interfaces.concat(r.unions)}var ZN=(r,e)=>r.array&&!e.array&&r.reference&&!e.reference?"can't be an array and a reference":!r.array&&e.array&&!r.reference&&e.reference?"has to be an array and a reference":r.array&&!e.array?"can't be an array":!r.array&&e.array?"has to be an array":r.reference&&!e.reference?"can't be a reference":!r.reference&&e.reference?"has to be a reference":"";function kT(r,e){let t=a=>a.reduce((s,u)=>s.set((0,La.distinctAndSorted)(u.types).join(" | "),u),new Map),n=t(r),i=t(e),o=[];for(let[a,s]of(0,Fa.stream)(n)){let u=i.get(a);u?(u.array!==s.array||u.reference!==s.reference)&&o.push({typeString:a,errorMessage:ZN(s,u)}):o.push({typeString:a,errorMessage:"is not expected"})}return o}function QN(r,e,t){let n=kT(r,e);for(let i of n)t(`A type '${i.typeString}' ${i.errorMessage}`)}function eD(r,e,t,n,i){let o=(s,u,c)=>`The assigned type '${u}' is not compatible with the declared property '${s}' of type '${c}'.`,a=(s,u)=>!(s.typeAlternatives.length===1&&s.typeAlternatives[0].array||u.typeAlternatives.length===1&&u.typeAlternatives[0].array);for(let s of r.keys()){let c=r.get(s)[0],d=e.get(s)[0];if(d){let g=(0,La.propertyTypeArrayToString)(c.typeAlternatives),y=(0,La.propertyTypeArrayToString)(d.typeAlternatives);if(g!==y){let p=kT(c.typeAlternatives,d.typeAlternatives);if(p.length>0){let A=o(c.name,g,y);for(let x of p)A=A+` '${x.typeString}' ${x.errorMessage};`;A=A.replace(/;$/,"."),n(c.name,A)}}a(c,d)&&!d.optional&&c.optional&&i(c.name,`Property '${c.name}' is missing`)}else n(c.name,`A property '${c.name}' is not expected.`)}for(let[s,u]of e.entriesGroupedByKey())r.get(s).length===0&&!u.some(l=>l.optional)&&t(`A property '${s}' is expected`)}function tD(r){let e=(0,La.collectAllAstResources)([r]),t=(0,bT.collectInferredTypes)(Array.from(e.parserRules),Array.from(e.datatypeRules)),n=(0,AT.collectDeclaredTypes)(Array.from(e.interfaces),Array.from(e.types),t),i=PT(e),o=t.interfaces.reduce((a,s)=>a.set(s.name,{type:s,node:i.get(s.name)}),new Map);return n.interfaces.reduce((a,s)=>{if(!a.has(s.name)){let u=(0,Fa.stream)(e.interfaces).find(c=>c.name===s.name);u&&a.set(s.name,{type:s,node:u})}return a},o)}Tn.collectAllInterfaces=tD});var Pp=C(or=>{"use strict";var rD=or&&or.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),nD=or&&or.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),iD=or&&or.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&rD(e,r,t);return nD(e,r),e};Object.defineProperty(or,"__esModule",{value:!0});or.LangiumGrammarValidator=or.IssueCodes=or.LangiumGrammarValidationRegistry=void 0;var Rp=lo(),oD=vn(),yi=Re(),Gu=kr(),_p=et(),Wn=Pt(),Ap=Ct(),aD=hi(),sD=Lu(),Ve=iD(ze()),ST=ze(),Ft=Lt(),bp=xT(),Ep=class extends sD.ValidationRegistry{constructor(e){super(e);let t=e.validation.LangiumGrammarValidator,n={Action:t.checkActionTypeUnions,AbstractRule:t.checkRuleName,Assignment:[t.checkAssignmentWithFeatureName,t.checkAssignmentToFragmentRule],ParserRule:[t.checkParserRuleDataType,t.checkRuleParametersUsed],TerminalRule:[t.checkTerminalRuleReturnType,t.checkHiddenTerminalRule,t.checkEmptyTerminalRule],Keyword:t.checkKeyword,UnorderedGroup:t.checkUnorderedGroup,Grammar:[t.checkGrammarName,t.checkEntryGrammarRule,t.checkUniqueRuleName,t.checkUniqueTypeName,t.checkUniqueImportedRules,t.checkDuplicateImportedGrammar,t.checkGrammarHiddenTokens,t.checkGrammarForUnusedRules,t.checkGrammarImports,t.checkGrammarTypeUnions,t.checkGrammarTypeInfer,t.checkTypesConsistency,t.checkPropertyNameDuplication],GrammarImport:t.checkPackageImport,CharacterRange:t.checkInvalidCharacterRange,RuleCall:[t.checkUsedHiddenTerminalRule,t.checkUsedFragmentTerminalRule,t.checkRuleCallParameters],TerminalRuleCall:t.checkUsedHiddenTerminalRule,CrossReference:[t.checkCrossReferenceSyntax,t.checkCrossRefNameAssignment,t.checkCrossRefTerminalType,t.checkCrossRefType],AtomType:[t.checkAtomTypeRefType,t.checkFragmentsInTypes]};this.register(n,t)}};or.LangiumGrammarValidationRegistry=Ep;var zt;(function(r){r.GrammarNameUppercase="grammar-name-uppercase",r.RuleNameUppercase="rule-name-uppercase",r.HiddenGrammarTokens="hidden-grammar-tokens",r.UseRegexTokens="use-regex-tokens",r.EntryRuleTokenSyntax="entry-rule-token-syntax",r.CrossRefTokenSyntax="cross-ref-token-syntax",r.MissingImport="missing-import",r.UnnecessaryFileExtension="unnecessary-file-extension",r.InvalidReturns="invalid-returns",r.InvalidInfers="invalid-infers",r.MissingInfer="missing-infer",r.SuperfluousInfer="superfluous-infer",r.OptionalUnorderedGroup="optional-unordered-group"})(zt=or.IssueCodes||(or.IssueCodes={}));var Cp=class{constructor(e){this.references=e.references.References,this.documents=e.shared.workspace.LangiumDocuments}checkGrammarName(e,t){if(e.name){let n=e.name.substring(0,1);n.toUpperCase()!==n&&t("warning","Grammar name should start with an upper case letter.",{node:e,property:"name",code:zt.GrammarNameUppercase})}}checkEntryGrammarRule(e,t){let n=e.rules.filter(i=>Ve.isParserRule(i)&&i.entry);if(e.isDeclared&&n.length===0){let i=e.rules.find(o=>Ve.isParserRule(o)&&!(0,Ft.isDataTypeRule)(o));i?t("error","The grammar is missing an entry parser rule. This rule can be an entry one.",{node:i,property:"name",code:zt.EntryRuleTokenSyntax}):t("error","This grammar is missing an entry parser rule.",{node:e,property:"name"})}else!e.isDeclared&&n.length>=1?n.forEach(i=>t("error","Cannot declare entry rules for unnamed grammars.",{node:i,property:"name"})):n.length>1?n.forEach(i=>t("error","The entry rule has to be unique.",{node:i,property:"name"})):n.length===1&&(0,Ft.isDataTypeRule)(n[0])&&t("error","The entry rule cannot be a data type rule.",{node:n[0],property:"name"})}checkUniqueRuleName(e,t){let n=i=>(0,Ap.stream)(i.rules).filter(o=>!qa(o));this.checkUniqueName(e,t,n,"rule")}checkUniqueTypeName(e,t){let n=i=>(0,Ap.stream)(i.types).concat(i.interfaces);this.checkUniqueName(e,t,n,"type")}checkUniqueName(e,t,n,i){let o=new Gu.MultiMap;n(e).forEach(u=>o.add(u.name,u));for(let[,u]of o.entriesGroupedByKey())u.length>1&&u.forEach(c=>{t("error",`A ${i}'s name has to be unique.`,{node:c,property:"name"})});let a=new Set,s=(0,Ft.resolveTransitiveImports)(this.documents,e);for(let u of s)n(u).forEach(c=>a.add(c.name));for(let u of o.keys())a.has(u)&&o.get(u).forEach(l=>{t("error",`A ${i} with the name '${l.name}' already exists in an imported grammar.`,{node:l,property:"name"})})}checkDuplicateImportedGrammar(e,t){let n=new Gu.MultiMap;for(let i of e.imports){let o=(0,Ft.resolveImport)(this.documents,i);o&&n.add(o,i)}for(let[,i]of n.entriesGroupedByKey())i.length>1&&i.forEach((o,a)=>{a>0&&t("warning","The grammar is already being directly imported.",{node:o,tags:[Rp.DiagnosticTag.Unnecessary]})})}checkUniqueImportedRules(e,t){let n=new Map;for(let o of e.imports){let a=(0,Ft.resolveTransitiveImports)(this.documents,o);n.set(o,a)}let i=new Gu.MultiMap;for(let o of e.imports){let a=n.get(o);for(let s of e.imports){if(o===s)continue;let u=n.get(s),c=this.getDuplicateExportedRules(a,u);for(let l of c)i.add(o,l)}}for(let o of e.imports){let a=i.get(o);a.length>0&&t("error","Some rules exported by this grammar are also included in other imports: "+(0,Ap.stream)(a).distinct().join(", "),{node:o,property:"path"})}}getDuplicateExportedRules(e,t){let i=e.filter(s=>!t.includes(s)).flatMap(s=>s.rules),o=t.flatMap(s=>s.rules),a=new Set;for(let s of i){let u=s.name;for(let c of o){let l=c.name;u===l&&a.add(c.name)}}return a}checkGrammarTypeInfer(e,t){var n,i;let o=new Set;for(let s of e.types)o.add(s.name);for(let s of e.interfaces)o.add(s.name);(0,Ft.resolveTransitiveImports)(this.documents,e).forEach(s=>{s.types.forEach(u=>o.add(u.name)),s.interfaces.forEach(u=>o.add(u.name))});for(let s of e.rules.filter(Ve.isParserRule)){if(qa(s))continue;let u=(0,Ft.isDataTypeRule)(s),c=!s.returnType&&!s.dataType,l=(0,Ft.getTypeName)(s);if(!u&&l&&o.has(l)===c){let d=c?(0,Wn.findNodeForKeyword)(s.$cstNode,"infer"):(0,Wn.findNodeForKeyword)(s.$cstNode,"returns");t("error",a(l,c),{node:(n=s.inferredType)!==null&&n!==void 0?n:s,property:"name",code:c?zt.InvalidInfers:zt.InvalidReturns,data:d&&(0,_p.toDocumentSegment)(d)})}else if(u&&c){let d=(0,Wn.findNodeForKeyword)(s.$cstNode,"infer");t("error","Data type rules cannot infer a type.",{node:s,property:"inferredType",code:zt.InvalidInfers,data:d&&(0,_p.toDocumentSegment)(d)})}}for(let s of(0,yi.streamAllContents)(e).filter(Ve.isAction)){let u=this.getActionType(s);if(u){let c=!!s.inferredType,l=(0,Ft.getTypeName)(s);if(s.type&&o.has(l)===c){let d=c?(0,Wn.findNodeForKeyword)(s.$cstNode,"infer"):(0,Wn.findNodeForKeyword)(s.$cstNode,"{");t("error",a(l,c),{node:s,property:"type",code:c?zt.SuperfluousInfer:zt.MissingInfer,data:d&&(0,_p.toDocumentSegment)(d)})}else if(u&&o.has(l)&&c&&s.$cstNode){let d=(0,Wn.findNodeForProperty)((i=s.inferredType)===null||i===void 0?void 0:i.$cstNode,"name"),g=(0,Wn.findNodeForKeyword)(s.$cstNode,"{");d&&g&&t("error",`${l} is a declared type and cannot be redefined.`,{node:s,property:"type",code:zt.SuperfluousInfer,data:{start:g.range.end,end:d.range.start}})}}}function a(s,u){return u?`The type '${s}' is already explicitly declared and cannot be inferred.`:`The type '${s}' is not explicitly declared and must be inferred.`}}getActionType(e){var t;if(e.type)return(t=e.type)===null||t===void 0?void 0:t.ref;if(e.inferredType)return e.inferredType}checkGrammarHiddenTokens(e,t){e.definesHiddenTokens&&t("error","Hidden terminals are declared at the terminal definition.",{node:e,property:"definesHiddenTokens",code:zt.HiddenGrammarTokens})}checkHiddenTerminalRule(e,t){e.hidden&&e.fragment&&t("error","Cannot use terminal fragments as hidden tokens.",{node:e,property:"hidden"})}checkEmptyTerminalRule(e,t){try{let n=(0,Ft.terminalRegex)(e);new RegExp(n).test("")&&t("error","This terminal could match an empty string.",{node:e,property:"name"})}catch{}}checkUsedHiddenTerminalRule(e,t){let n=(0,yi.getContainerOfType)(e,i=>Ve.isTerminalRule(i)||Ve.isParserRule(i));if(n){if("hidden"in n&&n.hidden)return;let i=e.rule.ref;Ve.isTerminalRule(i)&&i.hidden&&t("error","Cannot use hidden terminal in non-hidden rule",{node:e,property:"rule"})}}checkUsedFragmentTerminalRule(e,t){let n=e.rule.ref;Ve.isTerminalRule(n)&&n.fragment&&(0,yi.getContainerOfType)(e,Ve.isParserRule)&&t("error","Cannot use terminal fragments as part of parser rules.",{node:e,property:"rule"})}checkCrossReferenceSyntax(e,t){e.deprecatedSyntax&&t("error","'|' is deprecated. Please, use ':' instead.",{node:e,property:"deprecatedSyntax",code:zt.CrossRefTokenSyntax})}checkPackageImport(e,t){(0,Ft.resolveImport)(this.documents,e)===void 0?t("error","Import cannot be resolved.",{node:e,property:"path"}):e.path.endsWith(".langium")&&t("warning","Imports do not need file extensions.",{node:e,property:"path",code:zt.UnnecessaryFileExtension})}checkGrammarImports(e,t){let n=new Set((0,Ft.resolveTransitiveImports)(this.documents,e).map(i=>(0,yi.getDocument)(i)));(0,yi.streamAllContents)(e).forEach(i=>{(Ve.isRuleCall(i)||Ve.isTerminalRuleCall(i))&&this.checkRuleCallImport(i,n,t)})}checkRuleCallImport(e,t,n){var i;let o=e.rule.ref;if(o){let a=(0,yi.getDocument)(o),s=(0,yi.getDocument)(e),u=s.parseResult.value;if(Ve.isGrammar(u)&&a!==s&&!t.has(a)){let c=(0,aD.relativeURI)(oD.Utils.dirname(s.uri),a.uri);c.endsWith(".langium")&&(c=c.substring(0,c.length-8)),c.startsWith(".")||(c="./"+c),n("error",`Referenced rule "${(i=e.rule.ref)===null||i===void 0?void 0:i.name}" is not imported.`,{node:e,property:"rule",code:zt.MissingImport,data:c})}}}checkGrammarTypeUnions(e,t){for(let n of e.rules)Ve.isParserRule(n)&&Ve.isType(n.returnType)&&t("error","Rules are not allowed to return union types.",{node:n,property:"returnType"});for(let n of e.interfaces)n.superTypes.forEach((i,o)=>{i.ref&&Ve.isType(i.ref)&&t("error","Interfaces cannot extend union types.",{node:n,property:"superTypes",index:o})})}checkActionTypeUnions(e,t){Ve.isType(e.type)&&t("error","Actions cannot create union types.",{node:e,property:"type"})}checkTypesConsistency(e,t){(0,bp.validateTypesConsistency)(e,t)}checkPropertyNameDuplication(e,t){if(e.interfaces.length===0)return;let n=(0,bp.collectAllInterfaces)(e);for(let i of e.interfaces.map(o=>o.name)){let o=new Gu.MultiMap;this.collectPropertyNamesForHierarchy(n,new Set,o,i);for(let[a,s]of o.entriesGroupedByKey())if(!(s.length<2))for(let u of s){let c=`A property '${a}' has to be unique for the whole hierarchy.`;if(Ve.isInterface(u)){let l=u.attributes.find(d=>d.name===a);l&&t("error",c,{node:l,property:"name"})}else(0,bp.applyErrorToAssignment)(u,t)(a,c)}}}collectPropertyNamesForHierarchy(e,t,n,i){function o(a){if(t.has(a))return;t.add(a);let s=e.get(a);s&&(s.type.properties.forEach(u=>n.add(u.name,s.node)),s.type.interfaceSuperTypes.forEach(u=>o(u)))}o(i)}checkInvalidCharacterRange(e,t){if(e.right){let n="Character ranges cannot use more than one character",i=!1;e.left.value.length>1&&(i=!0,t("error",n,{node:e.left,property:"value"})),e.right.value.length>1&&(i=!0,t("error",n,{node:e.right,property:"value"})),i||t("hint","Consider using regex instead of character ranges",{node:e,code:zt.UseRegexTokens})}}checkGrammarForUnusedRules(e,t){let n=(0,Wn.getAllReachableRules)(e,!0);for(let i of e.rules)Ve.isTerminalRule(i)&&i.hidden||qa(i)||n.has(i)||t("hint","This rule is declared but never referenced.",{node:i,property:"name",tags:[Rp.DiagnosticTag.Unnecessary]})}checkRuleName(e,t){if(e.name&&!qa(e)){let n=e.name.substring(0,1);n.toUpperCase()!==n&&t("warning","Rule name should start with an upper case letter.",{node:e,property:"name",code:zt.RuleNameUppercase})}}checkKeyword(e,t){e.value.length===0?t("error","Keywords cannot be empty.",{node:e}):e.value.trim().length===0?t("error","Keywords cannot only consist of whitespace characters.",{node:e}):/\s/g.test(e.value)&&t("warning","Keywords should not contain whitespace characters.",{node:e})}checkUnorderedGroup(e,t){e.elements.forEach(n=>{(0,Ft.isOptionalCardinality)(n.cardinality)&&t("error","Optional elements in Unordered groups are currently not supported",{node:n,code:zt.OptionalUnorderedGroup})})}checkRuleParametersUsed(e,t){let n=e.parameters;if(n.length>0){let i=(0,yi.streamAllContents)(e).filter(Ve.isParameterReference);for(let o of n)i.some(a=>a.parameter.ref===o)||t("hint",`Parameter '${o.name}' is unused.`,{node:o,tags:[Rp.DiagnosticTag.Unnecessary]})}}checkParserRuleDataType(e,t){if(qa(e))return;let n=e.dataType,i=(0,Ft.isDataTypeRule)(e);!n&&i?t("error","This parser rule does not create an object. Add a primitive return type or an action to the start of the rule to force object instantiation.",{node:e,property:"name"}):n&&!i&&t("error","Normal parser rules are not allowed to return a primitive value. Use a datatype rule for that.",{node:e,property:"dataType"})}checkAssignmentToFragmentRule(e,t){(0,ST.isRuleCall)(e.terminal)&&(0,ST.isParserRule)(e.terminal.rule.ref)&&e.terminal.rule.ref.fragment&&t("error",`Cannot use fragment rule '${e.terminal.rule.ref.name}' for assignment of property '${e.feature}'.`,{node:e,property:"terminal"})}checkTerminalRuleReturnType(e,t){var n;((n=e.type)===null||n===void 0?void 0:n.name)&&!cD(e.type.name)&&t("error","Terminal rules can only return primitive types like 'string', 'boolean', 'number', 'Date' or 'bigint'.",{node:e.type,property:"name"})}checkRuleCallParameters(e,t){let n=e.rule.ref;if(Ve.isParserRule(n)){let i=n.parameters.length,o=e.arguments.length;i!==o&&t("error",`Rule '${n.name}' expects ${i} arguments, but got ${o}.`,{node:e})}else Ve.isTerminalRule(n)&&e.arguments.length>0&&t("error","Terminal rules do not accept any arguments",{node:e})}checkCrossRefNameAssignment(e,t){!e.terminal&&e.type.ref&&!(0,Wn.findNameAssignment)(e.type.ref)&&t("error","Cannot infer terminal or data type rule for cross reference.",{node:e,property:"type"})}checkCrossRefTerminalType(e,t){Ve.isRuleCall(e.terminal)&&Ve.isParserRule(e.terminal.rule.ref)&&!(0,Ft.isDataTypeRule)(e.terminal.rule.ref)&&t("error","Parser rules cannot be used for cross references.",{node:e.terminal,property:"rule"})}checkCrossRefType(e,t){let n=this.checkReferenceToRuleButNotType(e?.type);n&&t("error",n,{node:e,property:"type"})}checkAtomTypeRefType(e,t){if(e?.refType){let n=this.checkReferenceToRuleButNotType(e?.refType);n&&t("error",n,{node:e,property:"refType"})}}checkFragmentsInTypes(e,t){var n,i;Ve.isParserRule((n=e.refType)===null||n===void 0?void 0:n.ref)&&((i=e.refType)===null||i===void 0?void 0:i.ref.fragment)&&t("error","Cannot use rule fragments in types.",{node:e,property:"refType"})}checkReferenceToRuleButNotType(e){if(e&&Ve.isParserRule(e.ref)&&!(0,Ft.isDataTypeRule)(e.ref)&&(e.ref.returnType||e.ref.inferredType)){let t=(0,Ft.getTypeName)(e.ref);if(t)return`Use the rule type '${t}' instead of the typed rule name '${e.ref.name}' for cross references.`}}checkAssignmentWithFeatureName(e,t){e.feature==="name"&&Ve.isCrossReference(e.terminal)&&t("warning",'The "name" property is not recommended for cross-references.',{node:e,property:"feature"})}};or.LangiumGrammarValidator=Cp;var uD=["string","number","boolean","Date","bigint"];function cD(r){return uD.includes(r)}function qa(r){return!r.definition||!r.definition.$cstNode||r.definition.$cstNode.length===0}});var Wu=C(Xr=>{"use strict";Object.defineProperty(Xr,"__esModule",{value:!0});Xr.DocumentValidator=Xr.toDiagnosticSeverity=Xr.getDiagnosticRange=Xr.DefaultDocumentValidator=void 0;var Sr=we(),NT=Pt(),lD=Re(),dD=et(),Uu=Yr(),kp=class{constructor(e){this.validationRegistry=e.validation.ValidationRegistry,this.metadata=e.LanguageMetaData}async validateDocument(e,t=Sr.CancellationToken.None){let n=e.parseResult,i=[];await(0,Uu.interruptAndCheck)(t);for(let o of n.lexerErrors){let a={severity:Sr.DiagnosticSeverity.Error,range:{start:{line:o.line-1,character:o.column-1},end:{line:o.line-1,character:o.column+o.length-1}},message:o.message,code:Hu.LexingError,source:this.getSource()};i.push(a)}for(let o of n.parserErrors){let a;if(isNaN(o.token.startOffset)){if("previousToken"in o){let s=o.previousToken;if(isNaN(s.startOffset))a=Sr.Range.create(0,0,0,0);else{let u=Sr.Position.create(s.endLine-1,s.endColumn);a=Sr.Range.create(u,u)}}}else a=(0,dD.tokenToRange)(o.token);if(a){let s={severity:Sr.DiagnosticSeverity.Error,range:a,message:o.message,code:Hu.ParsingError,source:this.getSource()};i.push(s)}}for(let o of e.references){let a=o.error;if(a){let s={containerType:a.container.$type,property:a.property,refText:a.reference.$refText},u={node:a.container,property:a.property,index:a.index,code:Hu.LinkingError,data:s};i.push(this.toDiagnostic("error",a.message,u))}}try{i.push(...await this.validateAst(n.value,e,t))}catch(o){if((0,Uu.isOperationCancelled)(o))throw o;console.error("An error occurred during validation:",o)}return await(0,Uu.interruptAndCheck)(t),i}async validateAst(e,t,n=Sr.CancellationToken.None){let i=[],o=(a,s,u)=>{i.push(this.toDiagnostic(a,s,u))};return await Promise.all((0,lD.streamAst)(e).map(async a=>{await(0,Uu.interruptAndCheck)(n);let s=this.validationRegistry.getChecks(a.$type);for(let u of s)await u(a,o,n)})),i}toDiagnostic(e,t,n){return{message:t,range:DT(n),severity:wT(e),code:n.code,codeDescription:n.codeDescription,tags:n.tags,relatedInformation:n.relatedInformation,data:n.data,source:this.getSource()}}getSource(){return this.metadata.languageId}};Xr.DefaultDocumentValidator=kp;function DT(r){if(Sr.Range.is(r.range))return r.range;let e;return typeof r.property=="string"?e=(0,NT.findNodeForProperty)(r.node.$cstNode,r.property,r.index):typeof r.keyword=="string"&&(e=(0,NT.findNodeForKeyword)(r.node.$cstNode,r.keyword,r.index)),e??(e=r.node.$cstNode),e?e.range:{start:{line:0,character:0},end:{line:0,character:0}}}Xr.getDiagnosticRange=DT;function wT(r){switch(r){case"error":return Sr.DiagnosticSeverity.Error;case"warning":return Sr.DiagnosticSeverity.Warning;case"info":return Sr.DiagnosticSeverity.Information;case"hint":return Sr.DiagnosticSeverity.Hint;default:throw new Error("Invalid diagnostic severity: "+r)}}Xr.toDiagnosticSeverity=wT;var Hu;(function(r){r.LexingError="lexing-error",r.ParsingError="parsing-error",r.LinkingError="linking-error"})(Hu=Xr.DocumentValidator||(Xr.DocumentValidator={}))});var MT=C(Rn=>{"use strict";var fD=Rn&&Rn.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),pD=Rn&&Rn.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),mD=Rn&&Rn.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&fD(e,r,t);return pD(e,r),e};Object.defineProperty(Rn,"__esModule",{value:!0});Rn.LangiumGrammarCodeActionProvider=void 0;var Jr=we(),IT=Re(),OT=et(),hD=Pt(),$T=So(),yD=Wu(),xp=mD(ze()),Nr=Pp(),Sp=class{getCodeActions(e,t){let n=[];for(let i of t.context.diagnostics){let o=this.createCodeAction(i,e);o&&n.push(o)}return n}createCodeAction(e,t){switch(e.code){case Nr.IssueCodes.GrammarNameUppercase:case Nr.IssueCodes.RuleNameUppercase:return this.makeUpperCase(e,t);case Nr.IssueCodes.HiddenGrammarTokens:return this.fixHiddenTerminals(e,t);case Nr.IssueCodes.UseRegexTokens:return this.fixRegexTokens(e,t);case Nr.IssueCodes.EntryRuleTokenSyntax:return this.addEntryKeyword(e,t);case Nr.IssueCodes.CrossRefTokenSyntax:return this.fixCrossRefSyntax(e,t);case Nr.IssueCodes.MissingImport:return this.fixMissingImport(e,t);case Nr.IssueCodes.UnnecessaryFileExtension:return this.fixUnnecessaryFileExtension(e,t);case Nr.IssueCodes.InvalidInfers:case Nr.IssueCodes.InvalidReturns:return this.fixInvalidReturnsInfers(e,t);case Nr.IssueCodes.MissingInfer:return this.fixMissingInfer(e,t);case Nr.IssueCodes.SuperfluousInfer:return this.fixSuperfluousInfer(e,t);case yD.DocumentValidator.LinkingError:{let n=e.data;if(n&&n.containerType==="RuleCall"&&n.property==="rule")return this.addNewRule(e,n,t);break}}}fixInvalidReturnsInfers(e,t){let n=e.data;if(n){let i=t.textDocument.getText(n.range);return{title:`Correct ${i} usage`,kind:Jr.CodeActionKind.QuickFix,diagnostics:[e],edit:{changes:{[t.textDocument.uri]:[{range:n.range,newText:i==="infers"?"returns":"infers"}]}}}}}fixMissingInfer(e,t){let n=e.data;if(n)return{title:"Correct 'infer' usage",kind:Jr.CodeActionKind.QuickFix,diagnostics:[e],edit:{changes:{[t.textDocument.uri]:[{range:{start:n.range.end,end:n.range.end},newText:"infer "}]}}}}fixSuperfluousInfer(e,t){if(e.data)return{title:"Remove the 'infer' keyword",kind:Jr.CodeActionKind.QuickFix,diagnostics:[e],edit:{changes:{[t.textDocument.uri]:[{range:e.data,newText:""}]}}}}fixUnnecessaryFileExtension(e,t){let n=Object.assign({},e.range.end);n.character-=1;let i=Object.assign({},n);return i.character-=8,{title:"Remove file extension",kind:Jr.CodeActionKind.QuickFix,diagnostics:[e],isPreferred:!0,edit:{changes:{[t.textDocument.uri]:[{range:{start:i,end:n},newText:""}]}}}}fixMissingImport(e,t){let n,i=t.parseResult.value,o=i.imports,a=i.rules;if(o.length>0)n=o[0].$cstNode.range.start;else if(a.length>0)n=a[0].$cstNode.range.start;else return;let s=e.data;if(typeof s=="string")return{title:`Add import to '${s}'`,kind:Jr.CodeActionKind.QuickFix,diagnostics:[e],isPreferred:!0,edit:{changes:{[t.textDocument.uri]:[{range:{start:n,end:n},newText:`import '${s}';
3583
+ `}]}}}}makeUpperCase(e,t){let n={start:e.range.start,end:{line:e.range.start.line,character:e.range.start.character+1}};return{title:"First letter to upper case",kind:Jr.CodeActionKind.QuickFix,diagnostics:[e],isPreferred:!0,edit:{changes:{[t.textDocument.uri]:[{range:n,newText:t.textDocument.getText(n).toUpperCase()}]}}}}addEntryKeyword(e,t){return{title:"Add entry keyword",kind:Jr.CodeActionKind.QuickFix,diagnostics:[e],isPreferred:!0,edit:{changes:{[t.textDocument.uri]:[{range:{start:e.range.start,end:e.range.start},newText:"entry "}]}}}}fixRegexTokens(e,t){let n=t.textDocument.offsetAt(e.range.start),i=t.parseResult.value.$cstNode;if(i){let o=(0,OT.findLeafNodeAtOffset)(i,n),a=(0,IT.getContainerOfType)(o?.element,xp.isCharacterRange);if(a&&a.right&&a.$cstNode){let s=a.left.value,u=a.right.value;return{title:"Refactor into regular expression",kind:Jr.CodeActionKind.QuickFix,diagnostics:[e],isPreferred:!0,edit:{changes:{[t.textDocument.uri]:[{range:a.$cstNode.range,newText:`/[${(0,$T.escapeRegExp)(s)}-${(0,$T.escapeRegExp)(u)}]/`}]}}}}}}fixCrossRefSyntax(e,t){return{title:"Replace '|' with ':'",kind:Jr.CodeActionKind.QuickFix,diagnostics:[e],isPreferred:!0,edit:{changes:{[t.textDocument.uri]:[{range:e.range,newText:":"}]}}}}fixHiddenTerminals(e,t){let n=t.parseResult.value,i=n.hiddenTokens,o=[],a=(0,hD.findNodeForProperty)(n.$cstNode,"definesHiddenTokens");if(a){let s=a.range.start,u=a.offset,c=n.$cstNode.text.indexOf(")",u)+1;o.push({newText:"",range:{start:s,end:t.textDocument.positionAt(c)}})}for(let s of i){let u=s.ref;if(u&&xp.isTerminalRule(u)&&!u.hidden&&u.$cstNode){let c=u.$cstNode.range.start;o.push({newText:"hidden ",range:{start:c,end:c}})}}return{title:"Fix hidden terminals",kind:Jr.CodeActionKind.QuickFix,diagnostics:[e],isPreferred:!0,edit:{changes:{[t.textDocument.uri]:o}}}}addNewRule(e,t,n){let i=n.textDocument.offsetAt(e.range.start),o=n.parseResult.value.$cstNode;if(o){let a=(0,OT.findLeafNodeAtOffset)(o,i),s=(0,IT.getContainerOfType)(a?.element,xp.isParserRule);if(s&&s.$cstNode)return{title:`Add new rule '${t.refText}'`,kind:Jr.CodeActionKind.QuickFix,diagnostics:[e],isPreferred:!0,edit:{changes:{[n.textDocument.uri]:[{range:{start:s.$cstNode.range.end,end:s.$cstNode.range.end},newText:`
3584
3584
 
3585
3585
  `+t.refText+`:
3586
- /* TODO implement rule */ {infer `+t.refText+"};"}]}}}}}};Rn.LangiumGrammarCodeActionProvider=Dp});var zu=C(Bu=>{"use strict";Object.defineProperty(Bu,"__esModule",{value:!0});Bu.DefaultFoldingRangeProvider=void 0;var wp=Ne(),RD=Re(),_D=et(),Ip=class{constructor(e){this.commentNames=e.parser.GrammarConfig.multilineCommentRules}getFoldingRanges(e){let t=[],n=i=>t.push(i);return this.collectFolding(e,n),t}collectFolding(e,t){var n;let i=(n=e.parseResult)===null||n===void 0?void 0:n.value;if(i){if(this.shouldProcessContent(i)){let o=(0,RD.streamAllContents)(i).iterator(),a;do if(a=o.next(),!a.done){let s=a.value;this.shouldProcess(s)&&this.collectObjectFolding(e,s,t),this.shouldProcessContent(s)||o.prune()}while(!a.done)}this.collectCommentFolding(e,i,t)}}shouldProcess(e){return!0}shouldProcessContent(e){return!0}collectObjectFolding(e,t,n){let i=t.$cstNode;if(i){let o=this.toFoldingRange(e,i);o&&n(o)}}collectCommentFolding(e,t,n){let i=t.$cstNode;if(i){for(let o of(0,_D.flattenCst)(i))if(this.commentNames.includes(o.tokenType.name)){let a=this.toFoldingRange(e,o,wp.FoldingRangeKind.Comment);a&&n(a)}}}toFoldingRange(e,t,n){let i=t.range,o=i.start,a=i.end;if(!(a.line-o.line<2))return this.includeLastFoldingLine(t,n)||(a=e.textDocument.positionAt(e.textDocument.offsetAt({line:a.line,character:0})-1)),wp.FoldingRange.create(o.line,a.line,o.character,a.character,n)}includeLastFoldingLine(e,t){if(t===wp.FoldingRangeKind.Comment)return!1;let n=e.text,i=n.charAt(n.length-1);return!(i==="}"||i===")"||i==="]")}};Bu.DefaultFoldingRangeProvider=Ip});var qT=C(Vu=>{"use strict";Object.defineProperty(Vu,"__esModule",{value:!0});Vu.LangiumGrammarFoldingRangeProvider=void 0;var AD=zu(),bD=ze(),Op=class extends AD.DefaultFoldingRangeProvider{shouldProcessContent(e){return!(0,bD.isParserRule)(e)}};Vu.LangiumGrammarFoldingRangeProvider=Op});var Lp=C(Zr=>{"use strict";Object.defineProperty(Zr,"__esModule",{value:!0});Zr.Formatting=Zr.FormattingRegion=Zr.DefaultNodeFormatter=Zr.AbstractFormatter=void 0;var Yu=Pt(),$p=_o(),ED=Re(),jT=et(),ja=Ct(),Mp=class{constructor(){this.collector=()=>{}}getNodeFormatter(e){return new Xu(e,this.collector)}formatDocument(e,t){return this.doDocumentFormat(e,t.options)}formatDocumentRange(e,t){return this.doDocumentFormat(e,t.options,t.range)}formatDocumentOnType(e,t){return this.doDocumentFormat(e,t.options,{start:{character:0,line:t.position.line},end:t.position})}get formatOnTypeOptions(){}doDocumentFormat(e,t,n){let i=new Map,o=(s,u,c)=>{var l,d;let g=this.nodeModeToKey(s,u),y=i.get(g),p=(l=c.options.priority)!==null&&l!==void 0?l:0,A=(d=y?.options.priority)!==null&&d!==void 0?d:0;(!y||A<=p)&&i.set(g,c)};this.collector=o,this.iterateAstFormatting(e,n);let a=this.iterateCstFormatting(e,i,t,n);return this.avoidOverlappingEdits(e.textDocument,a)}avoidOverlappingEdits(e,t){let n=[];for(let i of t){let o=n[n.length-1];if(o){let a=e.offsetAt(i.range.start),s=e.offsetAt(o.range.end);a<s&&n.pop()}n.push(i)}return n}iterateAstFormatting(e,t){let n=e.parseResult.value;this.format(n);let i=(0,ED.streamAllContents)(n).iterator(),o;do if(o=i.next(),!o.done){let a=o.value;this.insideRange(a.$cstNode.range,t)?this.format(a):i.prune()}while(!o.done)}nodeModeToKey(e,t){return`${e.offset}:${e.end}:${t}`}insideRange(e,t){return!t||e.start.line<=t.start.line&&e.end.line>=t.end.line||e.start.line>=t.start.line&&e.end.line<=t.end.line||e.start.line<=t.end.line&&e.end.line>=t.end.line}isNecessary(e,t){return t.getText(e.range)!==e.newText}iterateCstFormatting(e,t,n,i){let o={indentation:0,options:n,document:e.textDocument},a=[],u=this.iterateCstTree(e,o).iterator(),c,l;do if(l=u.next(),!l.done){let d=l.value,g=(0,$p.isLeafCstNode)(d),y=this.nodeModeToKey(d,"prepend"),p=t.get(y);if(t.delete(y),p){let k=this.createTextEdit(c,d,p,o);for(let _ of k)_&&this.insideRange(_.range,i)&&this.isNecessary(_,e.textDocument)&&a.push(_)}let A=this.nodeModeToKey(d,"append"),x=t.get(A);if(t.delete(A),x){let k=(0,jT.getNextNode)(d);if(k){let _=this.createTextEdit(d,k,x,o);for(let R of _)R&&this.insideRange(R.range,i)&&this.isNecessary(R,e.textDocument)&&a.push(R)}}if(!p&&d.hidden){let k=this.createHiddenTextEdits(c,d,void 0,o);for(let _ of k)_&&this.insideRange(_.range,i)&&this.isNecessary(_,e.textDocument)&&a.push(_)}g&&(c=d)}while(!l.done);return a}createHiddenTextEdits(e,t,n,i){var o;let a=t.range.start.line;if(e&&e.range.end.line===a)return[];let s=[],u={start:{character:0,line:a},end:t.range.start},c=i.document.getText(u),l=this.findFittingMove(u,(o=n?.moves)!==null&&o!==void 0?o:[],i),d=this.getExistingIndentationCharacterCount(c,i),y=this.getIndentationCharacterCount(i,l)-d;if(y===0)return[];let p="";y>0&&(p=(i.options.insertSpaces?" ":" ").repeat(y));let A=t.text.split(`
3587
- `);A[0]=c+A[0];for(let x=0;x<A.length;x++){let k=a+x,_={character:0,line:k};if(y>0)s.push({newText:p,range:{start:_,end:_}});else{let R=A[x],D=0;for(;D<R.length;D++){let B=R.charAt(D);if(B!==" "&&B!==" ")break}s.push({newText:"",range:{start:_,end:{line:k,character:Math.min(D,Math.abs(y))}}})}}return s}getExistingIndentationCharacterCount(e,t){let n=" ".repeat(t.options.tabSize);return(t.options.insertSpaces?e.replaceAll(" ",n):e.replaceAll(n," ")).length}getIndentationCharacterCount(e,t){let n=e.indentation;return t&&t.tabs&&(n+=t.tabs),(e.options.insertSpaces?e.options.tabSize:1)*n}createTextEdit(e,t,n,i){var o;if(t.hidden)return this.createHiddenTextEdits(e,t,n,i);let a={start:(o=e?.range.end)!==null&&o!==void 0?o:{character:0,line:0},end:t.range.start},s=this.findFittingMove(a,n.moves,i);if(!s)return[];let u=s.characters,c=s.lines,l=s.tabs,d=i.indentation;i.indentation+=l??0;let g=[];return u!==void 0?g.push(this.createSpaceTextEdit(a,u,n.options)):c!==void 0?g.push(this.createLineTextEdit(a,c,i,n.options)):l!==void 0&&g.push(this.createTabTextEdit(a,!!e,i)),(0,$p.isLeafCstNode)(t)&&(i.indentation=d),g}createSpaceTextEdit(e,t,n){if(e.start.line===e.end.line){let o=e.end.character-e.start.character;t=this.fitIntoOptions(t,o,n)}return{newText:" ".repeat(t),range:e}}createLineTextEdit(e,t,n,i){let o=e.end.line-e.start.line;t=this.fitIntoOptions(t,o,i);let s=(n.options.insertSpaces?" ".repeat(n.options.tabSize):" ").repeat(n.indentation);return{newText:`${`
3586
+ /* TODO implement rule */ {infer `+t.refText+"};"}]}}}}}};Rn.LangiumGrammarCodeActionProvider=Sp});var Bu=C(Ku=>{"use strict";Object.defineProperty(Ku,"__esModule",{value:!0});Ku.DefaultFoldingRangeProvider=void 0;var Np=we(),gD=Re(),vD=et(),Dp=class{constructor(e){this.commentNames=e.parser.GrammarConfig.multilineCommentRules}getFoldingRanges(e){let t=[],n=i=>t.push(i);return this.collectFolding(e,n),t}collectFolding(e,t){var n;let i=(n=e.parseResult)===null||n===void 0?void 0:n.value;if(i){if(this.shouldProcessContent(i)){let o=(0,gD.streamAllContents)(i).iterator(),a;do if(a=o.next(),!a.done){let s=a.value;this.shouldProcess(s)&&this.collectObjectFolding(e,s,t),this.shouldProcessContent(s)||o.prune()}while(!a.done)}this.collectCommentFolding(e,i,t)}}shouldProcess(e){return!0}shouldProcessContent(e){return!0}collectObjectFolding(e,t,n){let i=t.$cstNode;if(i){let o=this.toFoldingRange(e,i);o&&n(o)}}collectCommentFolding(e,t,n){let i=t.$cstNode;if(i){for(let o of(0,vD.flattenCst)(i))if(this.commentNames.includes(o.tokenType.name)){let a=this.toFoldingRange(e,o,Np.FoldingRangeKind.Comment);a&&n(a)}}}toFoldingRange(e,t,n){let i=t.range,o=i.start,a=i.end;if(!(a.line-o.line<2))return this.includeLastFoldingLine(t,n)||(a=e.textDocument.positionAt(e.textDocument.offsetAt({line:a.line,character:0})-1)),Np.FoldingRange.create(o.line,a.line,o.character,a.character,n)}includeLastFoldingLine(e,t){if(t===Np.FoldingRangeKind.Comment)return!1;let n=e.text,i=n.charAt(n.length-1);return!(i==="}"||i===")"||i==="]")}};Ku.DefaultFoldingRangeProvider=Dp});var LT=C(zu=>{"use strict";Object.defineProperty(zu,"__esModule",{value:!0});zu.LangiumGrammarFoldingRangeProvider=void 0;var TD=Bu(),RD=ze(),wp=class extends TD.DefaultFoldingRangeProvider{shouldProcessContent(e){return!(0,RD.isParserRule)(e)}};zu.LangiumGrammarFoldingRangeProvider=wp});var $p=C(Zr=>{"use strict";Object.defineProperty(Zr,"__esModule",{value:!0});Zr.Formatting=Zr.FormattingRegion=Zr.DefaultNodeFormatter=Zr.AbstractFormatter=void 0;var Vu=Pt(),Ip=_o(),_D=Re(),FT=et(),ja=Ct(),Op=class{constructor(){this.collector=()=>{}}getNodeFormatter(e){return new Yu(e,this.collector)}formatDocument(e,t){return this.doDocumentFormat(e,t.options)}formatDocumentRange(e,t){return this.doDocumentFormat(e,t.options,t.range)}formatDocumentOnType(e,t){return this.doDocumentFormat(e,t.options,{start:{character:0,line:t.position.line},end:t.position})}get formatOnTypeOptions(){}doDocumentFormat(e,t,n){let i=new Map,o=(s,u,c)=>{var l,d;let g=this.nodeModeToKey(s,u),y=i.get(g),p=(l=c.options.priority)!==null&&l!==void 0?l:0,A=(d=y?.options.priority)!==null&&d!==void 0?d:0;(!y||A<=p)&&i.set(g,c)};this.collector=o,this.iterateAstFormatting(e,n);let a=this.iterateCstFormatting(e,i,t,n);return this.avoidOverlappingEdits(e.textDocument,a)}avoidOverlappingEdits(e,t){let n=[];for(let i of t){let o=n[n.length-1];if(o){let a=e.offsetAt(i.range.start),s=e.offsetAt(o.range.end);a<s&&n.pop()}n.push(i)}return n}iterateAstFormatting(e,t){let n=e.parseResult.value;this.format(n);let i=(0,_D.streamAllContents)(n).iterator(),o;do if(o=i.next(),!o.done){let a=o.value;this.insideRange(a.$cstNode.range,t)?this.format(a):i.prune()}while(!o.done)}nodeModeToKey(e,t){return`${e.offset}:${e.end}:${t}`}insideRange(e,t){return!t||e.start.line<=t.start.line&&e.end.line>=t.end.line||e.start.line>=t.start.line&&e.end.line<=t.end.line||e.start.line<=t.end.line&&e.end.line>=t.end.line}isNecessary(e,t){return t.getText(e.range)!==e.newText}iterateCstFormatting(e,t,n,i){let o={indentation:0,options:n,document:e.textDocument},a=[],u=this.iterateCstTree(e,o).iterator(),c,l;do if(l=u.next(),!l.done){let d=l.value,g=(0,Ip.isLeafCstNode)(d),y=this.nodeModeToKey(d,"prepend"),p=t.get(y);if(t.delete(y),p){let k=this.createTextEdit(c,d,p,o);for(let _ of k)_&&this.insideRange(_.range,i)&&this.isNecessary(_,e.textDocument)&&a.push(_)}let A=this.nodeModeToKey(d,"append"),x=t.get(A);if(t.delete(A),x){let k=(0,FT.getNextNode)(d);if(k){let _=this.createTextEdit(d,k,x,o);for(let R of _)R&&this.insideRange(R.range,i)&&this.isNecessary(R,e.textDocument)&&a.push(R)}}if(!p&&d.hidden){let k=this.createHiddenTextEdits(c,d,void 0,o);for(let _ of k)_&&this.insideRange(_.range,i)&&this.isNecessary(_,e.textDocument)&&a.push(_)}g&&(c=d)}while(!l.done);return a}createHiddenTextEdits(e,t,n,i){var o;let a=t.range.start.line;if(e&&e.range.end.line===a)return[];let s=[],u={start:{character:0,line:a},end:t.range.start},c=i.document.getText(u),l=this.findFittingMove(u,(o=n?.moves)!==null&&o!==void 0?o:[],i),d=this.getExistingIndentationCharacterCount(c,i),y=this.getIndentationCharacterCount(i,l)-d;if(y===0)return[];let p="";y>0&&(p=(i.options.insertSpaces?" ":" ").repeat(y));let A=t.text.split(`
3587
+ `);A[0]=c+A[0];for(let x=0;x<A.length;x++){let k=a+x,_={character:0,line:k};if(y>0)s.push({newText:p,range:{start:_,end:_}});else{let R=A[x],D=0;for(;D<R.length;D++){let B=R.charAt(D);if(B!==" "&&B!==" ")break}s.push({newText:"",range:{start:_,end:{line:k,character:Math.min(D,Math.abs(y))}}})}}return s}getExistingIndentationCharacterCount(e,t){let n=" ".repeat(t.options.tabSize);return(t.options.insertSpaces?e.replaceAll(" ",n):e.replaceAll(n," ")).length}getIndentationCharacterCount(e,t){let n=e.indentation;return t&&t.tabs&&(n+=t.tabs),(e.options.insertSpaces?e.options.tabSize:1)*n}createTextEdit(e,t,n,i){var o;if(t.hidden)return this.createHiddenTextEdits(e,t,n,i);let a={start:(o=e?.range.end)!==null&&o!==void 0?o:{character:0,line:0},end:t.range.start},s=this.findFittingMove(a,n.moves,i);if(!s)return[];let u=s.characters,c=s.lines,l=s.tabs,d=i.indentation;i.indentation+=l??0;let g=[];return u!==void 0?g.push(this.createSpaceTextEdit(a,u,n.options)):c!==void 0?g.push(this.createLineTextEdit(a,c,i,n.options)):l!==void 0&&g.push(this.createTabTextEdit(a,!!e,i)),(0,Ip.isLeafCstNode)(t)&&(i.indentation=d),g}createSpaceTextEdit(e,t,n){if(e.start.line===e.end.line){let o=e.end.character-e.start.character;t=this.fitIntoOptions(t,o,n)}return{newText:" ".repeat(t),range:e}}createLineTextEdit(e,t,n,i){let o=e.end.line-e.start.line;t=this.fitIntoOptions(t,o,i);let s=(n.options.insertSpaces?" ".repeat(n.options.tabSize):" ").repeat(n.indentation);return{newText:`${`
3588
3588
  `.repeat(t)}${s}`,range:e}}createTabTextEdit(e,t,n){let o=(n.options.insertSpaces?" ".repeat(n.options.tabSize):" ").repeat(n.indentation),a=t?1:0,s=Math.max(e.end.line-e.start.line,a);return{newText:`${`
3589
- `.repeat(s)}${o}`,range:e}}fitIntoOptions(e,t,n){return n.allowMore?e=Math.max(t,e):n.allowLess&&(e=Math.min(t,e)),e}findFittingMove(e,t,n){if(t.length===0)return;if(t.length===1)return t[0];let i=e.end.line-e.start.line;for(let o of t){if(o.lines!==void 0&&i<=o.lines)return o;if(o.lines===void 0&&i===0)return o}return t[t.length-1]}iterateCstTree(e,t){let i=e.parseResult.value.$cstNode;return i?new ja.TreeStreamImpl(i,o=>this.iterateCst(o,t)):ja.EMPTY_STREAM}iterateCst(e,t){if(!(0,$p.isCompositeCstNode)(e))return ja.EMPTY_STREAM;let n=t.indentation;return new ja.StreamImpl(()=>({index:0}),i=>i.index<e.children.length?{done:!1,value:e.children[i.index++]}:(t.indentation=n,ja.DONE_RESULT))}};Zr.AbstractFormatter=Mp;var Xu=class{constructor(e,t){this.astNode=e,this.collector=t}node(e){return new cr(e.$cstNode?[e.$cstNode]:[],this.collector)}nodes(...e){let t=[];for(let n of e)n.$cstNode&&t.push(n.$cstNode);return new cr(t,this.collector)}property(e,t){let n=(0,Yu.findNodeForProperty)(this.astNode.$cstNode,e,t);return new cr(n?[n]:[],this.collector)}properties(...e){let t=[];for(let n of e){let i=(0,Yu.findNodesForProperty)(this.astNode.$cstNode,n);t.push(...i)}return new cr(t,this.collector)}keyword(e,t){let n=(0,Yu.findNodeForKeyword)(this.astNode.$cstNode,e,t);return new cr(n?[n]:[],this.collector)}keywords(...e){let t=[];for(let n of e){let i=(0,Yu.findNodesForKeyword)(this.astNode.$cstNode,n);t.push(...i)}return new cr(t,this.collector)}cst(e){return new cr([...e],this.collector)}interior(e,t){let n=e.nodes,i=t.nodes;if(n.length!==1||i.length!==1)return new cr([],this.collector);let o=n[0],a=i[0];if(o.offset>a.offset){let s=o;o=a,a=s}return new cr((0,jT.getInteriorNodes)(o,a),this.collector)}};Zr.DefaultNodeFormatter=Xu;var cr=class{constructor(e,t){this.nodes=e,this.collector=t}prepend(e){for(let t of this.nodes)this.collector(t,"prepend",e);return this}append(e){for(let t of this.nodes)this.collector(t,"append",e);return this}surround(e){for(let t of this.nodes)this.collector(t,"prepend",e),this.collector(t,"append",e);return this}slice(e,t){return new cr(this.nodes.slice(e,t),this.collector)}};Zr.FormattingRegion=cr;var CD;(function(r){function e(...l){return{options:{},moves:l.flatMap(d=>d.moves).sort(c)}}r.fit=e;function t(l){return i(0,l)}r.noSpace=t;function n(l){return i(1,l)}r.oneSpace=n;function i(l,d){return{options:d??{},moves:[{characters:l}]}}r.spaces=i;function o(l){return a(1,l)}r.newLine=o;function a(l,d){return{options:d??{},moves:[{lines:l}]}}r.newLines=a;function s(l){return{options:l??{},moves:[{tabs:1,lines:1}]}}r.indent=s;function u(l){return{options:l??{},moves:[{tabs:0}]}}r.noIndent=u;function c(l,d){var g,y,p,A,x,k;let _=(g=l.lines)!==null&&g!==void 0?g:0,R=(y=d.lines)!==null&&y!==void 0?y:0,D=(p=l.tabs)!==null&&p!==void 0?p:0,B=(A=d.tabs)!==null&&A!==void 0?A:0,V=(x=l.characters)!==null&&x!==void 0?x:0,G=(k=d.characters)!==null&&k!==void 0?k:0;return _<R?-1:_>R?1:D<B?-1:D>B?1:V<G?-1:V>G?1:0}})(CD=Zr.Formatting||(Zr.Formatting={}))});var GT=C(_n=>{"use strict";var PD=_n&&_n.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),kD=_n&&_n.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),xD=_n&&_n.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&PD(e,r,t);return kD(e,r),e};Object.defineProperty(_n,"__esModule",{value:!0});_n.LangiumGrammarFormatter=void 0;var Ee=Lp(),gi=xD(ze()),Fp=class extends Ee.AbstractFormatter{format(e){if(gi.isCrossReference(e))this.getNodeFormatter(e).properties("type","terminal").surround(Ee.Formatting.noSpace());else if(gi.isParserRule(e)){let t=this.getNodeFormatter(e);t.keywords("entry","fragment","returns").append(Ee.Formatting.oneSpace()),(e.inferredType||e.returnType||e.dataType)&&e.parameters.length===0?t.property("name").append(Ee.Formatting.oneSpace()):t.property("name").append(Ee.Formatting.noSpace()),t.properties("parameters").append(Ee.Formatting.noSpace()),t.keywords(",").append(Ee.Formatting.oneSpace()),t.keywords("<").append(Ee.Formatting.noSpace());let n=t.keyword(";"),i=t.keyword(":");i.prepend(Ee.Formatting.noSpace()),t.interior(i,n).prepend(Ee.Formatting.indent()),n.prepend(Ee.Formatting.fit(Ee.Formatting.noSpace(),Ee.Formatting.newLine())),t.node(e).prepend(Ee.Formatting.noIndent())}else if(gi.isTerminalRule(e)){let t=this.getNodeFormatter(e);e.type&&(t.property("name").append(Ee.Formatting.oneSpace()),t.keyword("returns").append(Ee.Formatting.oneSpace())),t.keywords("hidden","terminal","fragment").append(Ee.Formatting.oneSpace()),t.keyword(":").prepend(Ee.Formatting.noSpace()),t.keyword(";").prepend(Ee.Formatting.fit(Ee.Formatting.noSpace(),Ee.Formatting.newLine())),t.node(e).prepend(Ee.Formatting.noIndent())}else if(gi.isAction(e)){let t=this.getNodeFormatter(e);t.keyword("{").append(Ee.Formatting.noSpace()),t.keywords(".","+=","=").surround(Ee.Formatting.noSpace()),t.keyword("}").prepend(Ee.Formatting.noSpace())}else if(gi.isInferredType(e))this.getNodeFormatter(e).keywords("infer","infers").append(Ee.Formatting.oneSpace());else if(gi.isAssignment(e))this.getNodeFormatter(e).keywords("=","+=","?=").surround(Ee.Formatting.noSpace());else if(gi.isRuleCall(e)){let t=this.getNodeFormatter(e);t.keyword("<").surround(Ee.Formatting.noSpace()),t.keyword(",").append(Ee.Formatting.oneSpace()),t.properties("arguments").append(Ee.Formatting.noSpace())}gi.isAbstractElement(e)&&this.getNodeFormatter(e).property("cardinality").prepend(Ee.Formatting.noSpace())}};_n.LangiumGrammarFormatter=Fp});var Qu=C(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.SemanticTokensDecoder=_t.AbstractSemanticTokenProvider=_t.SemanticTokensBuilder=_t.DefaultSemanticTokenOptions=_t.AllSemanticTokenModifiers=_t.AllSemanticTokenTypes=void 0;var ue=Ne(),Ju=Pt(),SD=Re();_t.AllSemanticTokenTypes={[ue.SemanticTokenTypes.class]:0,[ue.SemanticTokenTypes.comment]:1,[ue.SemanticTokenTypes.enum]:2,[ue.SemanticTokenTypes.enumMember]:3,[ue.SemanticTokenTypes.event]:4,[ue.SemanticTokenTypes.function]:5,[ue.SemanticTokenTypes.interface]:6,[ue.SemanticTokenTypes.keyword]:7,[ue.SemanticTokenTypes.macro]:8,[ue.SemanticTokenTypes.method]:9,[ue.SemanticTokenTypes.modifier]:10,[ue.SemanticTokenTypes.namespace]:11,[ue.SemanticTokenTypes.number]:12,[ue.SemanticTokenTypes.operator]:13,[ue.SemanticTokenTypes.parameter]:14,[ue.SemanticTokenTypes.property]:15,[ue.SemanticTokenTypes.regexp]:16,[ue.SemanticTokenTypes.string]:17,[ue.SemanticTokenTypes.struct]:18,[ue.SemanticTokenTypes.type]:19,[ue.SemanticTokenTypes.typeParameter]:20,[ue.SemanticTokenTypes.variable]:21};_t.AllSemanticTokenModifiers={[ue.SemanticTokenModifiers.abstract]:1<<0,[ue.SemanticTokenModifiers.async]:1<<1,[ue.SemanticTokenModifiers.declaration]:1<<2,[ue.SemanticTokenModifiers.defaultLibrary]:1<<3,[ue.SemanticTokenModifiers.definition]:1<<4,[ue.SemanticTokenModifiers.deprecated]:1<<5,[ue.SemanticTokenModifiers.documentation]:1<<6,[ue.SemanticTokenModifiers.modification]:1<<7,[ue.SemanticTokenModifiers.readonly]:1<<8,[ue.SemanticTokenModifiers.static]:1<<9};_t.DefaultSemanticTokenOptions={legend:{tokenTypes:Object.keys(_t.AllSemanticTokenTypes),tokenModifiers:Object.keys(_t.AllSemanticTokenModifiers)},full:{delta:!0},range:!0};var Zu=class extends ue.SemanticTokensBuilder{constructor(){super(...arguments),this._tokens=[]}push(e,t,n,i,o){this._tokens.push({line:e,char:t,length:n,tokenType:i,tokenModifiers:o})}build(){return this.applyTokens(),super.build()}buildEdits(){return this.applyTokens(),super.buildEdits()}applyTokens(){for(let e of this._tokens.sort(this.compareTokens))super.push(e.line,e.char,e.length,e.tokenType,e.tokenModifiers);this._tokens=[]}compareTokens(e,t){return e.line===t.line?e.char-t.char:e.line-t.line}};_t.SemanticTokensBuilder=Zu;var qp=class{constructor(e){this.tokensBuilders=new Map,e.shared.workspace.TextDocuments.onDidClose(t=>{this.tokensBuilders.delete(t.document.uri)}),e.shared.lsp.LanguageServer.onInitialize(t=>{var n;this.initialize((n=t.capabilities.textDocument)===null||n===void 0?void 0:n.semanticTokens)})}initialize(e){this.clientCapabilities=e}semanticHighlight(e,t,n=ue.CancellationToken.None){return this.currentRange=void 0,this.currentDocument=e,this.currentTokensBuilder=this.getDocumentTokensBuilder(e),this.computeHighlighting(e,this.createAcceptor(),n),this.currentTokensBuilder.build()}semanticHighlightRange(e,t,n=ue.CancellationToken.None){return this.currentRange=t.range,this.currentDocument=e,this.currentTokensBuilder=this.getDocumentTokensBuilder(e),this.computeHighlighting(e,this.createAcceptor(),n),this.currentTokensBuilder.build()}semanticHighlightDelta(e,t,n=ue.CancellationToken.None){return this.currentRange=void 0,this.currentDocument=e,this.currentTokensBuilder=this.getDocumentTokensBuilder(e),this.currentTokensBuilder.previousResult(t.previousResultId),this.computeHighlighting(e,this.createAcceptor(),n),this.currentTokensBuilder.buildEdits()}createAcceptor(){return t=>{"line"in t?this.highlightToken({range:{start:{line:t.line,character:t.char},end:{line:t.line,character:t.char+t.length}},type:t.type,modifier:t.modifier}):"range"in t?this.highlightToken(t):"keyword"in t?this.highlightKeyword(t):"property"in t?this.highlightProperty(t):this.highlightNode({node:t.cst,type:t.type,modifier:t.modifier})}}getDocumentTokensBuilder(e){let t=this.tokensBuilders.get(e.uri.toString());if(t)return t;let n=new Zu;return this.tokensBuilders.set(e.uri.toString(),n),n}computeHighlighting(e,t,n){let i=e.parseResult.value;if(this.highlightElement(i,t)==="prune")return;let o=(0,SD.streamAllContents)(i).iterator(),a;do if(a=o.next(),!a.done){if(n.isCancellationRequested)break;let s=a.value,u=s.$cstNode.range,c=this.compareRange(u);if(c===1)break;if(c===-1)continue;this.highlightElement(s,t)==="prune"&&o.prune()}while(!a.done)}compareRange(e){if(!this.currentRange)return 0;let t=typeof e=="number"?e:e.start.line;return(typeof e=="number"?e:e.end.line)<this.currentRange.start.line?-1:t>this.currentRange.end.line?1:0}highlightToken(e){var t;let{range:n,type:i}=e,o=e.modifier;if(this.compareRange(n)!==0||!this.currentDocument||!this.currentTokensBuilder)return;let a=_t.AllSemanticTokenTypes[i],s=0;if(o!==void 0){typeof o=="string"&&(o=[o]);for(let l of o){let d=_t.AllSemanticTokenModifiers[l];s|=d}}let u=n.start.line,c=n.end.line;if(u===c){let l=n.start.character,d=n.end.character-l;this.currentTokensBuilder.push(u,l,d,a,s)}else if(!((t=this.clientCapabilities)===null||t===void 0)&&t.multilineTokenSupport){let l=n.start.character,d=this.currentDocument.textDocument.offsetAt(n.start),g=this.currentDocument.textDocument.offsetAt(n.end);this.currentTokensBuilder.push(u,l,g-d,a,s)}else{let l=n.start,d=this.currentDocument.textDocument.offsetAt({line:u+1,character:0});this.currentTokensBuilder.push(l.line,l.character,d-l.character-1,a,s);for(let g=u+1;g<c;g++){let y=d;d=this.currentDocument.textDocument.offsetAt({line:g+1,character:0}),this.currentTokensBuilder.push(g,0,d-y-1,a,s)}this.currentTokensBuilder.push(c,0,n.end.character,a,s)}}highlightProperty(e){let t=[];if(typeof e.index=="number"){let o=(0,Ju.findNodeForProperty)(e.node.$cstNode,e.property,e.index);o&&t.push(o)}else t.push(...(0,Ju.findNodesForProperty)(e.node.$cstNode,e.property));let{type:n,modifier:i}=e;for(let o of t)this.highlightNode({node:o,type:n,modifier:i})}highlightKeyword(e){let{node:t,keyword:n,type:i,index:o,modifier:a}=e,s=[];if(typeof o=="number"){let u=(0,Ju.findNodeForKeyword)(t.$cstNode,n,o);u&&s.push(u)}else s.push(...(0,Ju.findNodesForKeyword)(t.$cstNode,n));for(let u of s)this.highlightNode({node:u,type:i,modifier:a})}highlightNode(e){let{node:t,type:n,modifier:i}=e,o=t.range;this.highlightToken({range:o,type:n,modifier:i})}};_t.AbstractSemanticTokenProvider=qp;var ND;(function(r){function e(n,i){let o=new Map;Object.entries(_t.AllSemanticTokenTypes).forEach(([u,c])=>o.set(c,u));let a=0,s=0;return t(n.data,5).map(u=>{a+=u[0],u[0]!==0&&(s=0),s+=u[1];let c=u[2];return{offset:i.textDocument.offsetAt({line:a,character:s}),tokenType:o.get(u[3]),tokenModifiers:u[4],text:i.textDocument.getText({start:{line:a,character:s},end:{line:a,character:s+c}})}})}r.decode=e;function t(n,i){let o=[];for(let a=0;a<n.length;a+=i){let s=n.slice(a,a+i);o.push(s)}return o}})(ND=_t.SemanticTokensDecoder||(_t.SemanticTokensDecoder={}))});var UT=C(ec=>{"use strict";Object.defineProperty(ec,"__esModule",{value:!0});ec.LangiumGrammarSemanticTokenProvider=void 0;var qi=Ne(),DD=Qu(),ji=ze(),jp=class extends DD.AbstractSemanticTokenProvider{highlightElement(e,t){var n;(0,ji.isAssignment)(e)?t({node:e,property:"feature",type:qi.SemanticTokenTypes.property}):(0,ji.isAction)(e)?e.feature&&t({node:e,property:"feature",type:qi.SemanticTokenTypes.property}):(0,ji.isReturnType)(e)?t({node:e,property:"name",type:qi.SemanticTokenTypes.type}):(0,ji.isAtomType)(e)?(e.primitiveType||e.refType)&&t({node:e,property:e.primitiveType?"primitiveType":"refType",type:qi.SemanticTokenTypes.type}):(0,ji.isParameter)(e)?t({node:e,property:"name",type:qi.SemanticTokenTypes.parameter}):(0,ji.isParameterReference)(e)?t({node:e,property:"parameter",type:qi.SemanticTokenTypes.parameter}):(0,ji.isRuleCall)(e)&&!((n=e.rule.ref)===null||n===void 0)&&n.fragment&&t({node:e,property:"rule",type:qi.SemanticTokenTypes.type})}};ec.LangiumGrammarSemanticTokenProvider=jp});var WT=C(tc=>{"use strict";Object.defineProperty(tc,"__esModule",{value:!0});tc.LangiumGrammarNameProvider=void 0;var wD=Io(),ID=Pt(),HT=ze(),Gp=class extends wD.DefaultNameProvider{getName(e){return(0,HT.isAssignment)(e)?e.feature:super.getName(e)}getNameNode(e){return(0,HT.isAssignment)(e)?(0,ID.findNodeForProperty)(e.$cstNode,"feature"):super.getNameNode(e)}};tc.LangiumGrammarNameProvider=Gp});var Hp=C(rc=>{"use strict";Object.defineProperty(rc,"__esModule",{value:!0});rc.DefaultReferences=void 0;var OD=Pt(),An=Re(),KT=et(),BT=Ct(),$D=hi(),Up=class{constructor(e){this.nameProvider=e.references.NameProvider,this.index=e.shared.workspace.IndexManager,this.nodeLocator=e.workspace.AstNodeLocator}findDeclaration(e){if(e){let t=(0,OD.findAssignment)(e),n=e.element;if(t&&n){let i=n[t.feature];if((0,An.isReference)(i))return i.ref;if(Array.isArray(i)){for(let o of i)if((0,An.isReference)(o)&&o.$refNode.offset<=e.offset&&o.$refNode.end>=e.end)return o.ref}else return n}}}findDeclarationNode(e){let t=this.findDeclaration(e);if(t?.$cstNode){let n=this.nameProvider.getNameNode(t);return n||t.$cstNode}}findReferences(e,t){return t.onlyLocal?this.findLocalReferences(e,t.includeDeclaration):this.findGlobalReferences(e,t.includeDeclaration)}findGlobalReferences(e,t=!1){let n=[];if(t){let i=this.getReferenceToSelf(e);i&&n.push(i)}return n.push(...this.index.findAllReferences(e,this.nodeLocator.getAstNodePath(e))),(0,BT.stream)(n)}findLocalReferences(e,t=!1){let i=(0,An.getDocument)(e).parseResult.value,o=[];if(t){let s=this.getReferenceToSelf(e);s&&o.push(s)}let a=[];return(0,An.streamAst)(i).forEach(s=>{(0,An.streamReferences)(s).forEach(u=>{u.reference.ref===e&&a.push(u.reference)})}),a.forEach(s=>{o.push({sourceUri:(0,An.getDocument)(s.$refNode.element).uri,sourcePath:this.nodeLocator.getAstNodePath(s.$refNode.element),targetUri:(0,An.getDocument)(e).uri,targetPath:this.nodeLocator.getAstNodePath(e),segment:(0,KT.toDocumentSegment)(s.$refNode),local:(0,$D.equalURI)((0,An.getDocument)(s.$refNode.element).uri,(0,An.getDocument)(e).uri)})}),(0,BT.stream)(o)}getReferenceToSelf(e){let t=this.nameProvider.getNameNode(e);if(t){let n=(0,An.getDocument)(e),i=this.nodeLocator.getAstNodePath(e);return{sourceUri:n.uri,sourcePath:i,targetUri:n.uri,targetPath:i,segment:(0,KT.toDocumentSegment)(t),local:!0}}}};rc.DefaultReferences=Up});var JT=C(ic=>{"use strict";Object.defineProperty(ic,"__esModule",{value:!0});ic.LangiumGrammarReferences=void 0;var MD=Hp(),Vt=Re(),zT=et(),VT=Pt(),YT=Ct(),Wp=hi(),jt=ze(),XT=Ft(),nc=mi(),Kp=class extends MD.DefaultReferences{constructor(e){super(e),this.documents=e.shared.workspace.LangiumDocuments}findDeclaration(e){let t=e.element,n=(0,VT.findAssignment)(e);if(n&&n.feature==="feature"){if((0,jt.isAssignment)(t))return this.findAssignmentDeclaration(t);if((0,jt.isAction)(t))return this.findActionDeclaration(t)}return super.findDeclaration(e)}findLocalReferences(e,t=!1){if((0,jt.isTypeAttribute)(e)){let i=(0,Vt.getDocument)(e).parseResult.value;return this.findLocalReferencesToTypeAttribute(e,i,t)}else return super.findLocalReferences(e,t)}findGlobalReferences(e,t=!1){return(0,jt.isTypeAttribute)(e)?this.findReferencesToTypeAttribute(e,t):super.findGlobalReferences(e,t)}findLocalReferencesToTypeAttribute(e,t,n){let i=[],o=(0,Vt.getContainerOfType)(e,jt.isInterface);if(o){let a=(0,nc.collectChildrenTypes)(o,this,this.documents,this.nodeLocator),s=[];if(a.forEach(u=>{let c=this.findLocalRulesWithReturnType(u,t);s.push(...c)}),(0,Wp.equalURI)((0,Vt.getDocument)(e).uri,(0,Vt.getDocument)(t).uri)&&n){let u=this.getReferenceToSelf(e);u&&i.push(u)}s.forEach(u=>{let c=this.createReferencesToAttribute(u,e);i.push(...c)})}return(0,YT.stream)(i)}findReferencesToTypeAttribute(e,t){let n=[],i=(0,Vt.getContainerOfType)(e,jt.isInterface);if(i){if(t){let s=this.getReferenceToSelf(e);s&&n.push(s)}let o=(0,nc.collectChildrenTypes)(i,this,this.documents,this.nodeLocator),a=[];o.forEach(s=>{let u=this.findRulesWithReturnType(s);a.push(...u)}),a.forEach(s=>{let u=this.createReferencesToAttribute(s,e);n.push(...u)})}return(0,YT.stream)(n)}createReferencesToAttribute(e,t){let n=[];if((0,jt.isParserRule)(e)){let i=(0,XT.extractAssignments)(e.definition).find(o=>o.feature===t.name);if(i?.$cstNode){let o=this.nameProvider.getNameNode(i);o&&n.push({sourceUri:(0,Vt.getDocument)(i).uri,sourcePath:this.nodeLocator.getAstNodePath(i),targetUri:(0,Vt.getDocument)(t).uri,targetPath:this.nodeLocator.getAstNodePath(t),segment:(0,zT.toDocumentSegment)(o),local:(0,Wp.equalURI)((0,Vt.getDocument)(i).uri,(0,Vt.getDocument)(t).uri)})}}else{if(e.feature===t.name){let o=(0,VT.findNodeForProperty)(e.$cstNode,"feature");o&&n.push({sourceUri:(0,Vt.getDocument)(e).uri,sourcePath:this.nodeLocator.getAstNodePath(e),targetUri:(0,Vt.getDocument)(t).uri,targetPath:this.nodeLocator.getAstNodePath(t),segment:(0,zT.toDocumentSegment)(o),local:(0,Wp.equalURI)((0,Vt.getDocument)(e).uri,(0,Vt.getDocument)(t).uri)})}let i=(0,Vt.getContainerOfType)(e,jt.isParserRule);n.push(...this.createReferencesToAttribute(i,t))}return n}findAssignmentDeclaration(e){var t;let n=(0,Vt.getContainerOfType)(e,jt.isParserRule),i=(0,XT.getActionAtElement)(e);if(i){let o=this.findActionDeclaration(i,e.feature);if(o)return o}if(!((t=n?.returnType)===null||t===void 0)&&t.ref&&((0,jt.isInterface)(n.returnType.ref)||(0,jt.isType)(n.returnType.ref))){let o=(0,nc.collectSuperTypes)(n.returnType.ref);for(let a of o){let s=a.attributes.find(u=>u.name===e.feature);if(s)return s}}return e}findActionDeclaration(e,t){var n;if(!((n=e.type)===null||n===void 0)&&n.ref){let i=t??e.feature,o=(0,nc.collectSuperTypes)(e.type.ref);for(let a of o){let s=a.attributes.find(u=>u.name===i);if(s)return s}}}findRulesWithReturnType(e){let t=[];return this.index.findAllReferences(e,this.nodeLocator.getAstNodePath(e)).forEach(i=>{let o=this.documents.getOrCreateDocument(i.sourceUri),a=this.nodeLocator.getAstNode(o,i.sourcePath);((0,jt.isParserRule)(a)||(0,jt.isAction)(a))&&t.push(a)}),t}findLocalRulesWithReturnType(e,t){let n=[];return(0,Vt.streamAst)(t).filter(o=>{var a,s;return(0,jt.isParserRule)(o)&&((a=o.returnType)===null||a===void 0?void 0:a.ref)===e||(0,jt.isAction)(o)&&((s=o.type)===null||s===void 0?void 0:s.ref)===e}).forEach(o=>{((0,jt.isParserRule)(o)||(0,jt.isAction)(o))&&n.push(o)}),n}};ic.LangiumGrammarReferences=Kp});var Vp=C(Dr=>{"use strict";var LD=Dr&&Dr.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),FD=Dr&&Dr.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),qD=Dr&&Dr.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&LD(e,r,t);return FD(e,r),e};Object.defineProperty(Dr,"__esModule",{value:!0});Dr.findFirstFeatures=Dr.findNextFeatures=void 0;var Yt=qD(ze()),Bn=Ft(),ZT=Re(),jD=Pt();function GD(r,e){let t={stacks:r,tokens:e};return UD(t),t.stacks.flat().forEach(i=>{i.property=void 0}),tR(t.stacks).map(i=>i[i.length-1])}Dr.findNextFeatures=GD;function Bp(r){let{next:e,cardinalities:t,visited:n,plus:i}=r,o=[],a=e.feature;if(n.has(a))return[];n.add(a);let s,u=a;for(;u.$container;)if(Yt.isGroup(u.$container)){s=u.$container;break}else if(Yt.isAbstractElement(u.$container))u=u.$container;else break;if((0,Bn.isArrayCardinality)(u.cardinality)){let c=$o({next:{feature:u,type:e.type,new:!1},cardinalities:t,visited:n,plus:i});for(let l of c)i.add(l.feature);o.push(...c)}if(s){let c=s.elements.indexOf(u);c!==void 0&&c<s.elements.length-1&&o.push(...eR({feature:s,type:e.type,new:!1},c+1,t,n,i)),o.every(l=>(0,Bn.isOptionalCardinality)(l.feature.cardinality)||(0,Bn.isOptionalCardinality)(t.get(l.feature))||i.has(l.feature))&&o.push(...Bp({next:{feature:s,type:e.type,new:!1},cardinalities:t,visited:n,plus:i}))}return o}function QT(r){return(0,ZT.isAstNode)(r)&&(r={feature:r}),$o({next:r,cardinalities:new Map,visited:new Set,plus:new Set})}Dr.findFirstFeatures=QT;function $o(r){var e,t,n;let{next:i,cardinalities:o,visited:a,plus:s}=r;if(i===void 0)return[];let{feature:u,type:c}=i;if(Yt.isGroup(u)){if(a.has(u))return[];a.add(u)}if(Yt.isGroup(u))return eR(i,0,o,a,s).map(l=>oc(l,u.cardinality,o));if(Yt.isAlternatives(u)||Yt.isUnorderedGroup(u))return u.elements.flatMap(l=>$o({next:{feature:l,new:!1,type:c},cardinalities:o,visited:a,plus:s})).map(l=>oc(l,u.cardinality,o));if(Yt.isAssignment(u)){let l={feature:u.terminal,new:!1,type:c,property:(e=i.property)!==null&&e!==void 0?e:u.feature};return $o({next:l,cardinalities:o,visited:a,plus:s}).map(d=>oc(d,u.cardinality,o))}else{if(Yt.isAction(u))return Bp({next:{feature:u,new:!0,type:(0,Bn.getTypeName)(u),property:(t=i.property)!==null&&t!==void 0?t:u.feature},cardinalities:o,visited:a,plus:s});if(Yt.isRuleCall(u)&&Yt.isParserRule(u.rule.ref)){let l=u.rule.ref,d={feature:l.definition,new:!0,type:l.fragment?void 0:(n=(0,Bn.getExplicitRuleType)(l))!==null&&n!==void 0?n:l.name,property:i.property};return $o({next:d,cardinalities:o,visited:a,plus:s}).map(g=>oc(g,u.cardinality,o))}else return[i]}}function oc(r,e,t){return t.set(r.feature,e),r}function eR(r,e,t,n,i){var o;let a=[],s;for(;e<r.feature.elements.length&&(s={feature:r.feature.elements[e++],new:!1,type:r.type},a.push(...$o({next:s,cardinalities:t,visited:n,plus:i})),!!(0,Bn.isOptionalCardinality)((o=s.feature.cardinality)!==null&&o!==void 0?o:t.get(s.feature))););return a}function UD(r){for(let e of r.tokens){let t=tR(r.stacks,e);r.stacks=t}}function tR(r,e){let t=[];for(let n of r)t.push(...HD(n,e));return t}function HD(r,e){let t=new Map,n=new Set(r.map(o=>o.feature).filter(WD)),i=[];for(;r.length>0;){let o=r.pop(),a=Bp({next:o,cardinalities:t,plus:n,visited:new Set}).filter(s=>e?zp(s.feature,e):!0);for(let s of a)i.push([...r,s]);if(!a.every(s=>(0,Bn.isOptionalCardinality)(s.feature.cardinality)||(0,Bn.isOptionalCardinality)(t.get(s.feature))))break}return i}function WD(r){if(r.cardinality==="+")return!0;let e=(0,ZT.getContainerOfType)(r,Yt.isAssignment);return!!(e&&e.cardinality==="+")}function zp(r,e){if(Yt.isKeyword(r))return r.value===e.image;if(Yt.isRuleCall(r))return KD(r.rule.ref,e);if(Yt.isCrossReference(r)){let t=(0,jD.getCrossReferenceTerminal)(r);if(t)return zp(t,e)}return!1}function KD(r,e){return Yt.isParserRule(r)?QT(r.definition).some(n=>zp(n.feature,e)):Yt.isTerminalRule(r)?new RegExp((0,Bn.terminalRegex)(r)).test(e.image):!1}});var Jp=C(bn=>{"use strict";var BD=bn&&bn.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),zD=bn&&bn.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),VD=bn&&bn.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&BD(e,r,t);return zD(e,r),e};Object.defineProperty(bn,"__esModule",{value:!0});bn.DefaultCompletionProvider=void 0;var Ga=Ne(),Ua=VD(ze()),YD=Ft(),Yp=Re(),XD=et(),rR=Pt(),nR=Ct(),ac=Vp(),Xp=class{constructor(e){this.scopeProvider=e.references.ScopeProvider,this.grammar=e.Grammar,this.completionParser=e.parser.CompletionParser,this.nameProvider=e.references.NameProvider,this.grammarConfig=e.parser.GrammarConfig}async getCompletion(e,t){let i=e.parseResult.value.$cstNode;if(!i)return;let o=[],a=e.textDocument,s=a.getText(),u=a.offsetAt(t.position),c=(x,k)=>{let _=this.fillCompletionItem(a,u,x,k);_&&o.push(_)},l=(0,XD.findLeafNodeAtOffset)(i,this.backtrackToAnyToken(s,u));if(!l){let x=(0,rR.getEntryRule)(this.grammar);return await this.completionForRule(void 0,x,c),Ga.CompletionList.create(o,!0)}let d=this.backtrackToTokenStart(s,u),g=this.findFeaturesAt(a,d),y=[],p=u!==d;p&&(y=this.findFeaturesAt(a,u));let A=x=>Ua.isKeyword(x.feature)?x.feature.value:x.feature;if(await Promise.all((0,nR.stream)(g).distinct(A).map(x=>this.completionFor(l.element,x,c))),p){let x=a.getText({start:a.positionAt(d),end:t.position}).toLowerCase();o=o.filter(k=>k.label.toLowerCase().startsWith(x)),await Promise.all((0,nR.stream)(y).exclude(g,A).distinct(A).map(k=>this.completionFor(l.element,k,c)))}return Ga.CompletionList.create(o,!0)}findFeaturesAt(e,t){let n=e.getText({start:Ga.Position.create(0,0),end:e.positionAt(t)}),i=this.completionParser.parse(n),o=i.tokens;if(i.tokenIndex===0){let u=(0,rR.getEntryRule)(this.grammar),c=(0,ac.findFirstFeatures)({feature:u.definition,new:!0,type:(0,YD.getExplicitRuleType)(u)});return o.length>0?(o.shift(),(0,ac.findNextFeatures)(c.map(l=>[l]),o)):c}let a=[...o].splice(i.tokenIndex);return(0,ac.findNextFeatures)([i.elementStack.map(u=>({feature:u}))],a)}backtrackToAnyToken(e,t){for(t>=e.length&&(t=e.length-1);t>0&&/\s/.test(e.charAt(t));)t--;return t}backtrackToTokenStart(e,t){if(t<1)return t;let n=this.grammarConfig.nameRegexp,i=e.charAt(t-1);for(;t>0&&n.test(i);)t--,i=e.charAt(t-1);return t}async completionForRule(e,t,n){if(Ua.isParserRule(t)){let i=(0,ac.findFirstFeatures)(t.definition);await Promise.all(i.map(o=>this.completionFor(e,o,n)))}}completionFor(e,t,n){if(Ua.isKeyword(t.feature))return this.completionForKeyword(t.feature,e,n);if(Ua.isCrossReference(t.feature)&&e)return this.completionForCrossReference(t,e,n)}completionForCrossReference(e,t,n){let i=(0,Yp.getContainerOfType)(e.feature,Ua.isAssignment);if(i){if(e.type&&(e.new||t?.$type!==e.type)&&(t={$type:e.type,$container:t,$containerProperty:e.property}),!t)return;let o={reference:{},container:t,property:i.feature};try{let a=this.scopeProvider.getScope(o),s=new Set;a.getAllElements().forEach(u=>{!s.has(u.name)&&this.filterCrossReference(u)&&(n(u,this.createReferenceCompletionItem(u)),s.add(u.name))})}catch(a){console.error(a)}}}createReferenceCompletionItem(e){return{kind:Ga.CompletionItemKind.Reference,detail:e.type,sortText:"0"}}filterCrossReference(e){return!0}completionForKeyword(e,t,n){!e.value.match(/[\w]+/)||n(e.value,{kind:Ga.CompletionItemKind.Keyword,detail:"Keyword",sortText:/\w/.test(e.value)?"1":"2"})}fillCompletionItem(e,t,n,i){let o;if(typeof n=="string")o=n;else if((0,Yp.isAstNode)(n)){let u=this.nameProvider.getName(n);if(!u)return;o=u}else if(!(0,Yp.isAstNode)(n))o=n.name;else return;let a=this.buildCompletionTextEdit(e,t,o);return a?Object.assign({label:o,textEdit:a},i):void 0}buildCompletionTextEdit(e,t,n){let i=0,o=e.getText(),a=o.toLowerCase(),s=n.toLowerCase();for(let u=s.length;u>0;u--){let c=a.substring(t-u,t);if(s.startsWith(c)&&(u===0||!this.isWordCharacterAt(a,t-u-1))){i=u;break}}if(i>0||t===0||!this.isWordCharacterAt(n,0)||!this.isWordCharacterAt(o,t-1)){let u=e.positionAt(t-i),c=e.positionAt(t);return{newText:n,range:{start:u,end:c}}}else return}isWordCharacterAt(e,t){return this.grammarConfig.nameRegexp.test(e.charAt(t))}};bn.DefaultCompletionProvider=Xp});var oR=C(iR=>{"use strict";Object.defineProperty(iR,"__esModule",{value:!0})});var Qp=C(sc=>{"use strict";Object.defineProperty(sc,"__esModule",{value:!0});sc.DefaultDocumentHighlightProvider=void 0;var JD=Ne(),ZD=Re(),QD=et(),ew=hi(),Zp=class{constructor(e){this.references=e.references.References,this.nameProvider=e.references.NameProvider,this.grammarConfig=e.parser.GrammarConfig}getDocumentHighlight(e,t){let n=e.parseResult.value.$cstNode;if(!n)return;let i=(0,QD.findDeclarationNodeAtOffset)(n,e.textDocument.offsetAt(t.position),this.grammarConfig.nameRegexp);if(!i)return;let o=this.references.findDeclaration(i);if(o){let a=[],u={onlyLocal:!0,includeDeclaration:(0,ew.equalURI)((0,ZD.getDocument)(o).uri,e.uri)};return this.references.findReferences(o,u).forEach(c=>{a.push(this.createDocumentHighlight(c))}),a}}createDocumentHighlight(e){return JD.DocumentHighlight.create(e.segment.range)}};sc.DefaultDocumentHighlightProvider=Zp});var sR=C(aR=>{"use strict";Object.defineProperty(aR,"__esModule",{value:!0})});var tm=C(uc=>{"use strict";Object.defineProperty(uc,"__esModule",{value:!0});uc.DefaultDocumentSymbolProvider=void 0;var tw=Ne(),rw=Re(),em=class{constructor(e){this.nameProvider=e.references.NameProvider}getSymbols(e){return this.getSymbol(e,e.parseResult.value)}getSymbol(e,t){let n=t.$cstNode,i=this.nameProvider.getNameNode(t);if(i&&n){let o=this.nameProvider.getName(t);return[{kind:this.getSymbolKind(t.$type),name:o??i.text,range:n.range,selectionRange:i.range,children:this.getChildSymbols(e,t)}]}else return this.getChildSymbols(e,t)||[]}getChildSymbols(e,t){let n=[];for(let i of(0,rw.streamContents)(t)){let o=this.getSymbol(e,i);n.push(...o)}if(n.length>0)return n}getSymbolKind(e){return tw.SymbolKind.Field}};uc.DefaultDocumentSymbolProvider=em});var uR=C(cc=>{"use strict";Object.defineProperty(cc,"__esModule",{value:!0});cc.AbstractExecuteCommandHandler=void 0;var nw=Ne(),rm=class{constructor(){this.registeredCommands=new Map,this.registerCommands(this.createCommandAcceptor())}get commands(){return Array.from(this.registeredCommands.keys())}async executeCommand(e,t,n=nw.CancellationToken.None){let i=this.registeredCommands.get(e);if(i)return i(t,n)}createCommandAcceptor(){return(e,t)=>this.registeredCommands.set(e,t)}};cc.AbstractExecuteCommandHandler=rm});var im=C(lc=>{"use strict";Object.defineProperty(lc,"__esModule",{value:!0});lc.DefaultDefinitionProvider=void 0;var iw=Ne(),ow=Re(),aw=et(),nm=class{constructor(e){this.nameProvider=e.references.NameProvider,this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}getDefinition(e,t){let n=e.parseResult.value;if(n.$cstNode){let i=n.$cstNode,o=(0,aw.findDeclarationNodeAtOffset)(i,e.textDocument.offsetAt(t.position),this.grammarConfig.nameRegexp);if(o)return this.collectLocationLinks(o,t)}}collectLocationLinks(e,t){var n;let i=this.findLink(e);if(i)return[iw.LocationLink.create(i.targetDocument.textDocument.uri,((n=i.target.element.$cstNode)!==null&&n!==void 0?n:i.target).range,i.target.range,i.source.range)]}findLink(e){let t=this.references.findDeclarationNode(e);if(t?.element){let n=(0,ow.getDocument)(t.element);if(t&&n)return{source:e,target:t,targetDocument:n}}}};lc.DefaultDefinitionProvider=nm});var am=C(Mo=>{"use strict";Object.defineProperty(Mo,"__esModule",{value:!0});Mo.MultilineCommentHoverProvider=Mo.AstNodeHoverProvider=void 0;var cR=et(),dc=class{constructor(e){this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}getHoverContent(e,t){var n,i;let o=(i=(n=e.parseResult)===null||n===void 0?void 0:n.value)===null||i===void 0?void 0:i.$cstNode;if(o){let a=e.textDocument.offsetAt(t.position),s=(0,cR.findDeclarationNodeAtOffset)(o,a,this.grammarConfig.nameRegexp);if(s&&s.offset+s.length>a){let u=this.references.findDeclaration(s);if(u)return this.getAstNodeHoverContent(u)}}}};Mo.AstNodeHoverProvider=dc;var om=class extends dc{constructor(){super(...arguments),this.commentContentRegex=/\/\*([\s\S]*?)\*\//}getAstNodeHoverContent(e){let t=(0,cR.findCommentNode)(e.$cstNode,this.grammarConfig.multilineCommentRules),n;if(t){let i=this.commentContentRegex.exec(t.text);i&&i[1]&&(n=this.getCommentContent(i[1]))}if(n)return{contents:{kind:"markdown",value:n}}}getCommentContent(e){return e.split(`
3590
- `).map(n=>(n=n.trim(),n.startsWith("*")&&(n=n.substring(1).trim()),n)).join(" ").trim()}};Mo.MultilineCommentHoverProvider=om});var lR=C(fc=>{"use strict";Object.defineProperty(fc,"__esModule",{value:!0});fc.AbstractGoToImplementationProvider=void 0;var sw=Ne(),uw=et(),sm=class{constructor(e){this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}getImplementation(e,t,n=sw.CancellationToken.None){let i=e.parseResult.value;if(i.$cstNode){let o=(0,uw.findDeclarationNodeAtOffset)(i.$cstNode,e.textDocument.offsetAt(t.position),this.grammarConfig.nameRegexp);if(o){let a=this.references.findDeclaration(o);if(a)return this.collectGoToImplementationLocationLinks(a,n)}}}};fc.AbstractGoToImplementationProvider=sm});var Gi=C(Qr=>{"use strict";Object.defineProperty(Qr,"__esModule",{value:!0});Qr.DefaultLangiumDocuments=Qr.DefaultLangiumDocumentFactory=Qr.DefaultTextDocumentFactory=Qr.DocumentState=void 0;var dR=vu(),cw=vn(),lw=Ct(),dm;(function(r){r[r.Changed=0]="Changed",r[r.Parsed=1]="Parsed",r[r.IndexedContent=2]="IndexedContent",r[r.ComputedScopes=3]="ComputedScopes",r[r.Linked=4]="Linked",r[r.IndexedReferences=5]="IndexedReferences",r[r.Validated=6]="Validated"})(dm=Qr.DocumentState||(Qr.DocumentState={}));var um=class{constructor(e){this.serviceRegistry=e.ServiceRegistry,this.fileSystemProvider=e.workspace.FileSystemProvider}fromUri(e){let t=this.getContent(e),n=this.serviceRegistry.getServices(e);return dR.TextDocument.create(e.toString(),n.LanguageMetaData.languageId,0,t)}getContent(e){return this.fileSystemProvider.readFileSync(e)}};Qr.DefaultTextDocumentFactory=um;var cm=class{constructor(e){this.serviceRegistry=e.ServiceRegistry}fromTextDocument(e,t){return this.create(e,void 0,void 0,t)}fromString(e,t){return this.create(void 0,e,void 0,t)}fromModel(e,t){return this.create(void 0,void 0,e,t)}create(e,t,n,i){i===void 0&&(i=cw.URI.parse(e.uri));let o=this.serviceRegistry.getServices(i),a;return n===void 0?a=o.parser.LangiumParser.parse(t??e.getText()):a={value:n,parserErrors:[],lexerErrors:[]},this.createLangiumDocument(a,i,e??{$template:!0,languageId:o.LanguageMetaData.languageId,uri:i,text:t})}createLangiumDocument(e,t,n){let i,o=this,a={parseResult:e,uri:t,state:dm.Parsed,references:[],get textDocument(){return i||(i=n.$template?o.createTextDocument(n):n),i}};return e.value.$document=a,a}createTextDocument(e){var t;return dR.TextDocument.create(e.uri.toString(),e.languageId,0,(t=e.text)!==null&&t!==void 0?t:"")}};Qr.DefaultLangiumDocumentFactory=cm;var lm=class{constructor(e){this.documentMap=new Map,this.textDocuments=e.workspace.TextDocuments,this.fileSystemProvider=e.workspace.FileSystemProvider,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory}get all(){return(0,lw.stream)(this.documentMap.values())}addDocument(e){let t=e.uri.toString();if(this.documentMap.has(t))throw new Error(`A document with the URI '${t}' is already present.`);this.documentMap.set(t,e)}getOrCreateDocument(e){let t=e.toString(),n=this.documentMap.get(t);if(n)return n;let i=this.textDocuments.get(t);return i?n=this.langiumDocumentFactory.fromTextDocument(i,e):n=this.langiumDocumentFactory.fromString(this.getContent(e),e),this.documentMap.set(t,n),n}getContent(e){return this.fileSystemProvider.readFileSync(e)}hasDocument(e){return this.documentMap.has(e.toString())}invalidateDocument(e){let t=e.toString(),n=this.documentMap.get(t);n&&(n.state=dm.Changed,this.documentMap.delete(t))}};Qr.DefaultLangiumDocuments=lm});var pm=C(Lo=>{"use strict";Object.defineProperty(Lo,"__esModule",{value:!0});Lo.mergeSignatureHelpOptions=Lo.AbstractSignatureHelpProvider=void 0;var dw=Ne(),fw=et(),fm=class{provideSignatureHelp(e,t,n=dw.CancellationToken.None){let o=e.parseResult.value.$cstNode;if(o){let a=(0,fw.findLeafNodeAtOffset)(o,e.textDocument.offsetAt(t.position));if(a)return this.getSignatureFromElement(a.element,n)}}get signatureHelpOptions(){return{triggerCharacters:["("],retriggerCharacters:[","]}}};Lo.AbstractSignatureHelpProvider=fm;function pw(r){let e=[],t=[];r.forEach(i=>{i?.triggerCharacters&&e.push(...i.triggerCharacters),i?.retriggerCharacters&&t.push(...i.retriggerCharacters)});let n={triggerCharacters:e.length>0?Array.from(new Set(e)).sort():void 0,retriggerCharacters:t.length>0?Array.from(new Set(t)).sort():void 0};return n.triggerCharacters?n:void 0}Lo.mergeSignatureHelpOptions=pw});var ym=C(X=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});X.createRequestHandler=X.createServerRequestHandler=X.createCallHierarchyRequestHandler=X.addCallHierarchyHandler=X.addSignatureHelpHandler=X.addDocumentLinkHandler=X.addExecuteCommandHandler=X.addConfigurationChangeHandler=X.addSemanticTokenHandler=X.addRenameHandler=X.addFormattingHandler=X.addFoldingRangeHandler=X.addHoverHandler=X.addDocumentHighlightsHandler=X.addGoToImplementationHandler=X.addGoToTypeDefinitionHandler=X.addGotoDefinitionHandler=X.addDocumentSymbolHandler=X.addCodeActionHandler=X.addFindReferencesHandler=X.addCompletionHandler=X.addDiagnosticsHandler=X.addDocumentsHandler=X.startLanguageServer=X.DefaultLanguageServer=void 0;var lr=Ne(),Fo=vn(),fR=xa(),mw=Yr(),hw=Gi(),yw=Qu(),gw=pm(),mm=class{constructor(e){this.onInitializeEmitter=new lr.Emitter,this.onInitializedEmitter=new lr.Emitter,this.services=e}get onInitialize(){return this.onInitializeEmitter.event}get onInitialized(){return this.onInitializedEmitter.event}async initialize(e){return this.eagerLoadServices(),this.onInitializeEmitter.fire(e),this.onInitializeEmitter.dispose(),this.buildInitializeResult(e)}eagerLoadServices(){(0,fR.eagerLoad)(this.services),this.services.ServiceRegistry.all.forEach(e=>(0,fR.eagerLoad)(e))}hasService(e){return this.services.ServiceRegistry.all.some(t=>e(t)!==void 0)}buildInitializeResult(e){var t;let n=this.services.ServiceRegistry.all,i=this.hasService(G=>G.lsp.Formatter),o=n.map(G=>{var ge;return(ge=G.lsp.Formatter)===null||ge===void 0?void 0:ge.formatOnTypeOptions}).find(G=>!!G),a=this.hasService(G=>G.lsp.CodeActionProvider),s=this.hasService(G=>G.lsp.SemanticTokenProvider),u=(t=this.services.lsp.ExecuteCommandHandler)===null||t===void 0?void 0:t.commands,c=this.services.lsp.DocumentLinkProvider,l=(0,gw.mergeSignatureHelpOptions)(n.map(G=>{var ge;return(ge=G.lsp.SignatureHelp)===null||ge===void 0?void 0:ge.signatureHelpOptions})),d=this.hasService(G=>G.lsp.TypeProvider),g=this.hasService(G=>G.lsp.ImplementationProvider),y=this.hasService(G=>G.lsp.CompletionProvider),p=this.hasService(G=>G.lsp.ReferencesProvider),A=this.hasService(G=>G.lsp.DocumentSymbolProvider),x=this.hasService(G=>G.lsp.DefinitionProvider),k=this.hasService(G=>G.lsp.DocumentHighlightProvider),_=this.hasService(G=>G.lsp.FoldingRangeProvider),R=this.hasService(G=>G.lsp.HoverProvider),D=this.hasService(G=>G.lsp.RenameProvider),B=this.hasService(G=>G.lsp.CallHierarchyProvider);return{capabilities:{workspace:{workspaceFolders:{supported:!0}},executeCommandProvider:u&&{commands:u},textDocumentSync:lr.TextDocumentSyncKind.Incremental,completionProvider:y?{}:void 0,referencesProvider:p,documentSymbolProvider:A,definitionProvider:x,typeDefinitionProvider:d,documentHighlightProvider:k,codeActionProvider:a,documentFormattingProvider:i,documentRangeFormattingProvider:i,documentOnTypeFormattingProvider:o,foldingRangeProvider:_,hoverProvider:R,renameProvider:D?{prepareProvider:!0}:void 0,semanticTokensProvider:s?yw.DefaultSemanticTokenOptions:void 0,signatureHelpProvider:l,implementationProvider:g,callHierarchyProvider:B?{}:void 0,documentLinkProvider:c?{resolveProvider:!!c.resolveDocumentLink}:void 0}}}async initialized(e){this.onInitializedEmitter.fire(e),this.onInitializedEmitter.dispose()}};X.DefaultLanguageServer=mm;function vw(r){let e=r.lsp.Connection;if(!e)throw new Error("Starting a language server requires the languageServer.Connection service to be set.");pR(e,r),mR(e,r),hR(e,r),yR(e,r),vR(e,r),TR(e,r),RR(e,r),_R(e,r),AR(e,r),ER(e,r),CR(e,r),gR(e,r),PR(e,r),bR(e,r),kR(e,r),SR(e,r),DR(e,r),wR(e,r),NR(e,r),xR(e,r),e.onInitialize(n=>r.lsp.LanguageServer.initialize(n)),e.onInitialized(n=>r.lsp.LanguageServer.initialized(n)),r.workspace.TextDocuments.listen(e),e.listen()}X.startLanguageServer=vw;function pR(r,e){let t=e.workspace.DocumentBuilder,n=e.workspace.MutexLock;function i(a,s){n.lock(u=>t.update(a,s,u))}e.workspace.TextDocuments.onDidChangeContent(a=>{i([Fo.URI.parse(a.document.uri)],[])}),r.onDidChangeWatchedFiles(a=>{let s=a.changes.filter(c=>c.type!==lr.FileChangeType.Deleted).map(c=>Fo.URI.parse(c.uri)),u=a.changes.filter(c=>c.type===lr.FileChangeType.Deleted).map(c=>Fo.URI.parse(c.uri));i(s,u)})}X.addDocumentsHandler=pR;function mR(r,e){e.workspace.DocumentBuilder.onBuildPhase(hw.DocumentState.Validated,async(n,i)=>{for(let o of n)if(o.diagnostics&&r.sendDiagnostics({uri:o.uri.toString(),diagnostics:o.diagnostics}),i.isCancellationRequested)return})}X.addDiagnosticsHandler=mR;function hR(r,e){r.onCompletion(Xt((t,n,i,o)=>{var a;return(a=t.lsp.CompletionProvider)===null||a===void 0?void 0:a.getCompletion(n,i,o)},e))}X.addCompletionHandler=hR;function yR(r,e){r.onReferences(Xt((t,n,i,o)=>{var a;return(a=t.lsp.ReferencesProvider)===null||a===void 0?void 0:a.findReferences(n,i,o)},e))}X.addFindReferencesHandler=yR;function gR(r,e){r.onCodeAction(Xt((t,n,i,o)=>{var a;return(a=t.lsp.CodeActionProvider)===null||a===void 0?void 0:a.getCodeActions(n,i,o)},e))}X.addCodeActionHandler=gR;function vR(r,e){r.onDocumentSymbol(Xt((t,n,i,o)=>{var a;return(a=t.lsp.DocumentSymbolProvider)===null||a===void 0?void 0:a.getSymbols(n,i,o)},e))}X.addDocumentSymbolHandler=vR;function TR(r,e){r.onDefinition(Xt((t,n,i,o)=>{var a;return(a=t.lsp.DefinitionProvider)===null||a===void 0?void 0:a.getDefinition(n,i,o)},e))}X.addGotoDefinitionHandler=TR;function RR(r,e){r.onTypeDefinition(Xt((t,n,i,o)=>{var a;return(a=t.lsp.TypeProvider)===null||a===void 0?void 0:a.getTypeDefinition(n,i,o)},e))}X.addGoToTypeDefinitionHandler=RR;function _R(r,e){r.onImplementation(Xt((t,n,i,o)=>{var a;return(a=t.lsp.ImplementationProvider)===null||a===void 0?void 0:a.getImplementation(n,i,o)},e))}X.addGoToImplementationHandler=_R;function AR(r,e){r.onDocumentHighlight(Xt((t,n,i,o)=>{var a;return(a=t.lsp.DocumentHighlightProvider)===null||a===void 0?void 0:a.getDocumentHighlight(n,i,o)},e))}X.addDocumentHighlightsHandler=AR;function bR(r,e){r.onHover(Xt((t,n,i,o)=>{var a;return(a=t.lsp.HoverProvider)===null||a===void 0?void 0:a.getHoverContent(n,i,o)},e))}X.addHoverHandler=bR;function ER(r,e){r.onFoldingRanges(Xt((t,n,i,o)=>{var a;return(a=t.lsp.FoldingRangeProvider)===null||a===void 0?void 0:a.getFoldingRanges(n,i,o)},e))}X.addFoldingRangeHandler=ER;function CR(r,e){r.onDocumentFormatting(Xt((t,n,i,o)=>{var a;return(a=t.lsp.Formatter)===null||a===void 0?void 0:a.formatDocument(n,i,o)},e)),r.onDocumentRangeFormatting(Xt((t,n,i,o)=>{var a;return(a=t.lsp.Formatter)===null||a===void 0?void 0:a.formatDocumentRange(n,i,o)},e)),r.onDocumentOnTypeFormatting(Xt((t,n,i,o)=>{var a;return(a=t.lsp.Formatter)===null||a===void 0?void 0:a.formatDocumentOnType(n,i,o)},e))}X.addFormattingHandler=CR;function PR(r,e){r.onRenameRequest(Xt((t,n,i,o)=>{var a;return(a=t.lsp.RenameProvider)===null||a===void 0?void 0:a.rename(n,i,o)},e)),r.onPrepareRename(Xt((t,n,i,o)=>{var a;return(a=t.lsp.RenameProvider)===null||a===void 0?void 0:a.prepareRename(n,i,o)},e))}X.addRenameHandler=PR;function kR(r,e){let t="No semantic token provider registered";r.languages.semanticTokens.on(Ui((n,i,o,a)=>n.lsp.SemanticTokenProvider?n.lsp.SemanticTokenProvider.semanticHighlight(i,o,a):new lr.ResponseError(0,t),e)),r.languages.semanticTokens.onDelta(Ui((n,i,o,a)=>n.lsp.SemanticTokenProvider?n.lsp.SemanticTokenProvider.semanticHighlightDelta(i,o,a):new lr.ResponseError(0,t),e)),r.languages.semanticTokens.onRange(Ui((n,i,o,a)=>n.lsp.SemanticTokenProvider?n.lsp.SemanticTokenProvider.semanticHighlightRange(i,o,a):new lr.ResponseError(0,t),e))}X.addSemanticTokenHandler=kR;function xR(r,e){r.onDidChangeConfiguration(t=>{t.settings&&e.workspace.ConfigurationProvider.updateConfiguration(t)})}X.addConfigurationChangeHandler=xR;function SR(r,e){let t=e.lsp.ExecuteCommandHandler;t&&r.onExecuteCommand(async(n,i)=>{var o;try{return await t.executeCommand(n.command,(o=n.arguments)!==null&&o!==void 0?o:[],i)}catch(a){return Ha(a)}})}X.addExecuteCommandHandler=SR;function NR(r,e){var t;let n=e.lsp.DocumentLinkProvider;if(n){r.onDocumentLinks(Ui((o,a,s,u)=>n.getDocumentLinks(a,s,u),e));let i=(t=n.resolveDocumentLink)===null||t===void 0?void 0:t.bind(n);i&&r.onDocumentLinkResolve(async(o,a)=>{try{return await i(o,a)}catch(s){return Ha(s)}})}}X.addDocumentLinkHandler=NR;function DR(r,e){r.onSignatureHelp(Ui((t,n,i,o)=>{var a;return(a=t.lsp.SignatureHelp)===null||a===void 0?void 0:a.provideSignatureHelp(n,i,o)},e))}X.addSignatureHelpHandler=DR;function wR(r,e){let t="No call hierarchy provider registered";r.languages.callHierarchy.onPrepare(Ui((n,i,o,a)=>{var s;return n.lsp.CallHierarchyProvider?(s=n.lsp.CallHierarchyProvider.prepareCallHierarchy(i,o,a))!==null&&s!==void 0?s:null:new lr.ResponseError(0,t)},e)),r.languages.callHierarchy.onIncomingCalls(hm((n,i,o)=>{var a;return n.lsp.CallHierarchyProvider?(a=n.lsp.CallHierarchyProvider.incomingCalls(i,o))!==null&&a!==void 0?a:null:new lr.ResponseError(0,t)},e)),r.languages.callHierarchy.onOutgoingCalls(hm((n,i,o)=>{var a;return n.lsp.CallHierarchyProvider?(a=n.lsp.CallHierarchyProvider.outgoingCalls(i,o))!==null&&a!==void 0?a:null:new lr.ResponseError(0,t)},e))}X.addCallHierarchyHandler=wR;function hm(r,e){let t=e.ServiceRegistry;return async(n,i)=>{let o=Fo.URI.parse(n.item.uri),a=t.getServices(o);if(!a)throw console.error(`Could not find service instance for uri: '${o.toString()}'`),new Error;try{return await r(a,n,i)}catch(s){return Ha(s)}}}X.createCallHierarchyRequestHandler=hm;function Ui(r,e){let t=e.workspace.LangiumDocuments,n=e.ServiceRegistry;return async(i,o)=>{let a=Fo.URI.parse(i.textDocument.uri),s=n.getServices(a);if(!s)throw console.error(`Could not find service instance for uri: '${a.toString()}'`),new Error;let u=t.getOrCreateDocument(a);if(!u)throw new Error;try{return await r(s,u,i,o)}catch(c){return Ha(c)}}}X.createServerRequestHandler=Ui;function Xt(r,e){let t=e.workspace.LangiumDocuments,n=e.ServiceRegistry;return async(i,o)=>{let a=Fo.URI.parse(i.textDocument.uri),s=n.getServices(a);if(!s)return console.error(`Could not find service instance for uri: '${a.toString()}'`),null;let u=t.getOrCreateDocument(a);if(!u)return null;try{return await r(s,u,i,o)}catch(c){return Ha(c)}}}X.createRequestHandler=Xt;function Ha(r){if((0,mw.isOperationCancelled)(r))return new lr.ResponseError(lr.LSPErrorCodes.RequestCancelled,"The request has been cancelled.");if(r instanceof lr.ResponseError)return r;throw r}});var vm=C(pc=>{"use strict";Object.defineProperty(pc,"__esModule",{value:!0});pc.DefaultReferencesProvider=void 0;var IR=Ne(),Tw=Re(),Rw=et(),gm=class{constructor(e){this.nameProvider=e.references.NameProvider,this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}findReferences(e,t){let n=e.parseResult.value.$cstNode;if(!n)return[];let i=(0,Rw.findDeclarationNodeAtOffset)(n,e.textDocument.offsetAt(t.position),this.grammarConfig.nameRegexp);return i?this.getReferences(i,t,e):[]}getReferences(e,t,n){let i=[],o=this.references.findDeclaration(e);if(o){let a={includeDeclaration:t.context.includeDeclaration};this.references.findReferences(o,a).forEach(s=>{(0,Tw.isReference)(s)?i.push(IR.Location.create(n.uri.toString(),s.$refNode.range)):i.push(IR.Location.create(s.sourceUri.toString(),s.segment.range))})}return i}};pc.DefaultReferencesProvider=gm});var Rm=C(mc=>{"use strict";Object.defineProperty(mc,"__esModule",{value:!0});mc.DefaultRenameProvider=void 0;var _w=Ne(),Aw=Io(),OR=et(),Tm=class{constructor(e){this.references=e.references.References,this.nameProvider=e.references.NameProvider,this.grammarConfig=e.parser.GrammarConfig}async rename(e,t){let n={},i=e.parseResult.value.$cstNode;if(!i)return;let o=e.textDocument.offsetAt(t.position),a=(0,OR.findDeclarationNodeAtOffset)(i,o,this.grammarConfig.nameRegexp);if(!a)return;let s=this.references.findDeclaration(a);if(!s)return;let u={onlyLocal:!1,includeDeclaration:!0};return this.references.findReferences(s,u).forEach(l=>{let d=_w.TextEdit.replace(l.segment.range,t.newName),g=l.sourceUri.toString();n[g]?n[g].push(d):n[g]=[d]}),{changes:n}}prepareRename(e,t){return this.renameNodeRange(e,t.position)}renameNodeRange(e,t){let n=e.parseResult.value.$cstNode,i=e.textDocument.offsetAt(t);if(n&&i){let o=(0,OR.findDeclarationNodeAtOffset)(n,i,this.grammarConfig.nameRegexp);if(!o)return;if(this.references.findDeclaration(o)||this.isNameNode(o))return o.range}}isNameNode(e){return e?.element&&(0,Aw.isNamed)(e.element)&&e===this.nameProvider.getNameNode(e.element)}};mc.DefaultRenameProvider=Tm});var $R=C(hc=>{"use strict";Object.defineProperty(hc,"__esModule",{value:!0});hc.AbstractTypeDefinitionProvider=void 0;var bw=Ne(),Ew=et(),_m=class{constructor(e){this.references=e.references.References}getTypeDefinition(e,t,n=bw.CancellationToken.None){let i=e.parseResult.value;if(i.$cstNode){let o=(0,Ew.findDeclarationNodeAtOffset)(i.$cstNode,e.textDocument.offsetAt(t.position));if(o){let a=this.references.findDeclaration(o);if(a)return this.collectGoToTypeLocationLinks(a,n)}}}};hc.AbstractTypeDefinitionProvider=_m});var Am=C(tt=>{"use strict";var Cw=tt&&tt.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),wt=tt&&tt.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Cw(e,r,t)};Object.defineProperty(tt,"__esModule",{value:!0});wt(Jp(),tt);wt(Vp(),tt);wt(oR(),tt);wt(Qp(),tt);wt(sR(),tt);wt(tm(),tt);wt(uR(),tt);wt(zu(),tt);wt(im(),tt);wt(am(),tt);wt(Lp(),tt);wt(lR(),tt);wt(ym(),tt);wt(vm(),tt);wt(Rm(),tt);wt(Qu(),tt);wt(pm(),tt);wt($R(),tt)});var MR=C(yc=>{"use strict";Object.defineProperty(yc,"__esModule",{value:!0});yc.LangiumGrammarDefinitionProvider=void 0;var bm=Ne(),Pw=Am(),kw=Re(),xw=Pt(),Sw=ze(),Nw=Ft(),Em=class extends Pw.DefaultDefinitionProvider{constructor(e){super(e),this.documents=e.shared.workspace.LangiumDocuments}collectLocationLinks(e,t){var n,i,o,a,s,u;let c="path";if((0,Sw.isGrammarImport)(e.element)&&((n=(0,xw.findAssignment)(e))===null||n===void 0?void 0:n.feature)===c){let l=(0,Nw.resolveImport)(this.documents,e.element);if(l?.$document){let d=(i=this.findTargetObject(l))!==null&&i!==void 0?i:l,g=(a=(o=this.nameProvider.getNameNode(d))===null||o===void 0?void 0:o.range)!==null&&a!==void 0?a:bm.Range.create(0,0,0,0),y=(u=(s=d.$cstNode)===null||s===void 0?void 0:s.range)!==null&&u!==void 0?u:bm.Range.create(0,0,0,0);return[bm.LocationLink.create(l.$document.uri.toString(),y,g,e.range)]}return}return super.collectLocationLinks(e,t)}findTargetObject(e){return e.isDeclared?e:(0,kw.streamContents)(e).head()}};yc.LangiumGrammarDefinitionProvider=Em});var FR=C(gc=>{"use strict";Object.defineProperty(gc,"__esModule",{value:!0});gc.AbstractCallHierarchyProvider=void 0;var Dw=Ne(),LR=vn(),Cm=et(),Pm=class{constructor(e){this.grammarConfig=e.parser.GrammarConfig,this.nameProvider=e.references.NameProvider,this.documents=e.shared.workspace.LangiumDocuments,this.references=e.references.References}prepareCallHierarchy(e,t){let n=e.parseResult.value,i=(0,Cm.findDeclarationNodeAtOffset)(n.$cstNode,e.textDocument.offsetAt(t.position),this.grammarConfig.nameRegexp);if(!i)return;let o=this.references.findDeclarationNode(i);if(!!o)return this.getCallHierarchyItems(o.element,e)}getCallHierarchyItems(e,t){let n=this.nameProvider.getNameNode(e),i=this.nameProvider.getName(e);if(!(!n||!e.$cstNode||i===void 0))return[Object.assign({kind:Dw.SymbolKind.Method,name:i,range:e.$cstNode.range,selectionRange:n.range,uri:t.uri.toString()},this.getCallHierarchyItem(e))]}getCallHierarchyItem(e){}incomingCalls(e){let t=this.documents.getOrCreateDocument(LR.URI.parse(e.item.uri)),n=t.parseResult.value,i=(0,Cm.findDeclarationNodeAtOffset)(n.$cstNode,t.textDocument.offsetAt(e.item.range.start),this.grammarConfig.nameRegexp);if(!i)return;let o=this.references.findReferences(i.element,{includeDeclaration:!1,onlyLocal:!1});return this.getIncomingCalls(i.element,o)}outgoingCalls(e){let t=this.documents.getOrCreateDocument(LR.URI.parse(e.item.uri)),n=t.parseResult.value,i=(0,Cm.findDeclarationNodeAtOffset)(n.$cstNode,t.textDocument.offsetAt(e.item.range.start),this.grammarConfig.nameRegexp);if(!!i)return this.getOutgoingCalls(i.element)}};gc.AbstractCallHierarchyProvider=Pm});var jR=C(Tc=>{"use strict";Object.defineProperty(Tc,"__esModule",{value:!0});Tc.LangiumGrammarCallHierarchyProvider=void 0;var qR=Ne(),ww=FR(),km=Re(),Iw=et(),vc=ze(),xm=class extends ww.AbstractCallHierarchyProvider{getIncomingCalls(e,t){if(!(0,vc.isParserRule)(e))return;let n=new Map;if(t.forEach(i=>{let a=this.documents.getOrCreateDocument(i.sourceUri).parseResult.value;if(!a.$cstNode)return;let s=(0,Iw.findLeafNodeAtOffset)(a.$cstNode,i.segment.offset);if(!s)return;let u=(0,km.getContainerOfType)(s.element,vc.isParserRule);if(!u||!u.$cstNode)return;let c=this.nameProvider.getNameNode(u);if(!c)return;let l=i.sourceUri.toString(),d=l+"@"+c.text;n.has(d)?n.set(d,{parserRule:u.$cstNode,nameNode:c,targetNodes:[...n.get(d).targetNodes,s],docUri:l}):n.set(d,{parserRule:u.$cstNode,nameNode:c,targetNodes:[s],docUri:l})}),n.size!==0)return Array.from(n.values()).map(i=>({from:{kind:qR.SymbolKind.Method,name:i.nameNode.text,range:i.parserRule.range,selectionRange:i.nameNode.range,uri:i.docUri},fromRanges:i.targetNodes.map(o=>o.range)}))}getOutgoingCalls(e){if(!(0,vc.isParserRule)(e))return;let t=(0,km.streamAllContents)(e).filter(vc.isRuleCall).toArray(),n=new Map;if(t.forEach(i=>{var o;let a=i.$cstNode;if(!a)return;let s=(o=i.rule.ref)===null||o===void 0?void 0:o.$cstNode;if(!s)return;let u=this.nameProvider.getNameNode(s.element);if(!u)return;let c=(0,km.getDocument)(s.element).uri.toString(),l=c+"@"+u.text;n.has(l)?n.set(l,{refCstNode:s,to:u,from:[...n.get(l).from,a.range],docUri:c}):n.set(l,{refCstNode:s,to:u,from:[a.range],docUri:c})}),n.size!==0)return Array.from(n.values()).map(i=>({to:{kind:qR.SymbolKind.Method,name:i.to.text,range:i.refCstNode.range,selectionRange:i.to.range,uri:i.docUri},fromRanges:i.from}))}};Tc.LangiumGrammarCallHierarchyProvider=xm});var Rc=C(Hi=>{"use strict";Object.defineProperty(Hi,"__esModule",{value:!0});Hi.createLangiumGrammarServices=Hi.LangiumGrammarModule=void 0;var GR=_c(),UR=xa(),HR=Mv(),WR=pT(),KR=xp(),Ow=FT(),$w=qT(),Mw=GT(),Lw=UT(),Fw=WT(),qw=JT(),jw=MR(),Gw=jR();Hi.LangiumGrammarModule={validation:{ValidationRegistry:r=>new KR.LangiumGrammarValidationRegistry(r),LangiumGrammarValidator:r=>new KR.LangiumGrammarValidator(r)},lsp:{FoldingRangeProvider:r=>new $w.LangiumGrammarFoldingRangeProvider(r),CodeActionProvider:()=>new Ow.LangiumGrammarCodeActionProvider,SemanticTokenProvider:r=>new Lw.LangiumGrammarSemanticTokenProvider(r),Formatter:()=>new Mw.LangiumGrammarFormatter,DefinitionProvider:r=>new jw.LangiumGrammarDefinitionProvider(r),CallHierarchyProvider:r=>new Gw.LangiumGrammarCallHierarchyProvider(r)},references:{ScopeComputation:r=>new WR.LangiumGrammarScopeComputation(r),ScopeProvider:r=>new WR.LangiumGrammarScopeProvider(r),References:r=>new qw.LangiumGrammarReferences(r),NameProvider:()=>new Fw.LangiumGrammarNameProvider}};function Uw(r,e){let t=(0,UR.inject)((0,GR.createDefaultSharedModule)(r),HR.LangiumGrammarGeneratedSharedModule,e),n=(0,UR.inject)((0,GR.createDefaultModule)({shared:t}),HR.LangiumGrammarGeneratedModule,Hi.LangiumGrammarModule);return t.ServiceRegistry.register(n),{shared:t,grammar:n}}Hi.createLangiumGrammarServices=Uw});var zR=C(Ac=>{"use strict";Object.defineProperty(Ac,"__esModule",{value:!0});Ac.collectAst=void 0;var BR=Ct(),Hw=Tp(),Ww=mp(),Kw=mi();function Bw(r,e){let t=(0,Kw.collectAllAstResources)(e,r),n=(0,Hw.collectInferredTypes)(Array.from(t.parserRules),Array.from(t.datatypeRules)),i=(0,Ww.collectDeclaredTypes)(Array.from(t.interfaces),Array.from(t.types),n),o=n.interfaces.concat(i.interfaces),a=n.unions.concat(i.unions);return zw(o),a.sort((s,u)=>s.name.localeCompare(u.name)),{interfaces:(0,BR.stream)(o).distinct(s=>s.name).toArray(),unions:(0,BR.stream)(a).distinct(s=>s.name).toArray()}}Ac.collectAst=Bw;function zw(r){let e=r.sort((i,o)=>i.name.localeCompare(o.name)).map(i=>({value:i,nodes:[]}));for(let i of e)i.nodes=e.filter(o=>i.value.superTypes.has(o.value.name));let t=[],n=e.filter(i=>i.nodes.length===0);for(;n.length>0;){let i=n.shift();t.includes(i)||(t.push(i),e.filter(o=>o.nodes.includes(i)).forEach(o=>n.push(o)))}return t.map(i=>i.value)}});var Nm=C(bc=>{"use strict";Object.defineProperty(bc,"__esModule",{value:!0});bc.interpretAstReflection=void 0;var Vw=Re(),Yw=kr(),Xw=bu(),Jw=ze(),Zw=Rc(),Qw=zR(),eI=mi(),Sm;function tI(r,e){let t;(0,Jw.isGrammar)(r)?(!Sm&&!e&&(Sm=(0,Zw.createLangiumGrammarServices)(Xw.EmptyFileSystem).shared.workspace.LangiumDocuments),t=(0,Qw.collectAst)(e??Sm,[r])):t=r;let n=t.interfaces.map(s=>s.name).concat(t.unions.map(s=>s.name)),i=rI(t),o=nI(t),a=oI(t);return{getAllTypes(){return n},getReferenceType(s){let u=`${s.container.$type}:${s.property}`,c=i.get(u);if(c)return c;throw new Error("Could not find reference type for "+u)},getTypeMetaData(s){var u;return(u=o.get(s))!==null&&u!==void 0?u:{name:s,mandatory:[]}},isInstance(s,u){return(0,Vw.isAstNode)(s)&&this.isSubtype(s.$type,u)},isSubtype(s,u){if(s===u)return!0;let c=a.get(s);for(let l of c)if(this.isSubtype(l,u))return!0;return!1}}}bc.interpretAstReflection=tI;function rI(r){let e=new Map;for(let t of r.interfaces)for(let n of t.properties)for(let i of n.typeAlternatives)i.reference&&e.set(`${t.name}:${n.name}`,i.types[0]);return e}function nI(r){let e=new Map,t=(0,eI.collectAllProperties)(r.interfaces);for(let n of r.interfaces){let i=t.get(n.name),o=i.filter(s=>s.typeAlternatives.some(u=>u.array)),a=i.filter(s=>s.typeAlternatives.every(u=>!u.array&&u.types.includes("boolean")));(o.length>0||a.length>0)&&e.set(n.name,{name:n.name,mandatory:iI(o,a)})}return e}function iI(r,e){let t=[],n=r.concat(e).sort((i,o)=>i.name.localeCompare(o.name));for(let i of n){let o=r.includes(i)?"array":"boolean";t.push({name:i.name,type:o})}return t}function oI(r){let e=new Yw.MultiMap;for(let t of r.interfaces)e.addAll(t.name,t.superTypes);for(let t of r.unions)e.addAll(t.name,t.superTypes);return e}});var Pt=C(he=>{"use strict";var aI=he&&he.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),sI=he&&he.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),uI=he&&he.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&aI(e,r,t);return sI(e,r),e};Object.defineProperty(he,"__esModule",{value:!0});he.createServicesForGrammar=he.loadGrammarFromJson=he.findNameAssignment=he.findAssignment=he.findNodesForKeywordInternal=he.findNodeForKeyword=he.findNodesForKeyword=he.findNodeForProperty=he.findNodesForProperty=he.isCommentTerminal=he.getCrossReferenceTerminal=he.getAllReachableRules=he.getEntryRule=void 0;var VR=_c(),YR=xa(),cI=Nm(),ar=uI(ze()),wm=Ft(),XR=Rc(),lI=_o(),Wa=Re(),dI=et(),Dm=bu();function JR(r){return r.rules.find(e=>ar.isParserRule(e)&&e.entry)}he.getEntryRule=JR;function fI(r,e){let t=new Set,n=JR(r);if(!n)return new Set(r.rules);ZR(n,t,e);let i=new Set;for(let o of r.rules)(t.has(o.name)||ar.isTerminalRule(o)&&o.hidden)&&i.add(o);return i}he.getAllReachableRules=fI;function ZR(r,e,t){e.add(r.name),(0,Wa.streamAllContents)(r).forEach(n=>{if(ar.isRuleCall(n)||t&&ar.isTerminalRuleCall(n)){let i=n.rule.ref;i&&!e.has(i.name)&&ZR(i,e,t)}})}function pI(r){if(r.terminal)return r.terminal;if(r.type.ref){let e=QR(r.type.ref);return e?.terminal}}he.getCrossReferenceTerminal=pI;function mI(r){return r.hidden&&!" ".match((0,wm.terminalRegex)(r))}he.isCommentTerminal=mI;function hI(r,e){return!r||!e?[]:Im(r,e,r.element,!0)}he.findNodesForProperty=hI;function yI(r,e,t){if(!r||!e)return;let n=Im(r,e,r.element,!0);if(n.length!==0)return t!==void 0?t=Math.max(0,Math.min(t,n.length-1)):t=0,n[t]}he.findNodeForProperty=yI;function Im(r,e,t,n){if(!n){let i=(0,Wa.getContainerOfType)(r.feature,ar.isAssignment);if(i&&i.feature===e)return[r]}return(0,lI.isCompositeCstNode)(r)&&r.element===t?r.children.flatMap(i=>Im(i,e,t,!1)):[]}function gI(r,e){return r?Om(r,e,r?.element):[]}he.findNodesForKeyword=gI;function vI(r,e,t){if(!r)return;let n=Om(r,e,r?.element);if(n.length!==0)return t!==void 0?t=Math.max(0,Math.min(t,n.length-1)):t=0,n[t]}he.findNodeForKeyword=vI;function Om(r,e,t){if(r.element!==t)return[];if(ar.isKeyword(r.feature)&&r.feature.value===e)return[r];let n=(0,dI.streamCst)(r).iterator(),i,o=[];do if(i=n.next(),!i.done){let a=i.value;a.element===t?ar.isKeyword(a.feature)&&a.feature.value===e&&o.push(a):n.prune()}while(!i.done);return o}he.findNodesForKeywordInternal=Om;function TI(r){let e=r;do{let t=(0,Wa.getContainerOfType)(e.feature,ar.isAssignment);if(t)return t;e=e.parent}while(e)}he.findAssignment=TI;function QR(r){return ar.isInferredType(r)&&(r=r.$container),e_(r,new Map)}he.findNameAssignment=QR;function e_(r,e){var t;function n(i,o){let a;return(0,Wa.getContainerOfType)(i,ar.isAssignment)||(a=e_(o,e)),e.set(r,a),a}if(e.has(r))return e.get(r);e.set(r,void 0);for(let i of(0,Wa.streamAllContents)(r)){if(ar.isAssignment(i)&&i.feature.toLowerCase()==="name")return e.set(r,i),i;if(ar.isRuleCall(i)&&ar.isParserRule(i.rule.ref))return n(i,i.rule.ref);if(ar.isAtomType(i)&&((t=i?.refType)===null||t===void 0?void 0:t.ref))return n(i,i.refType.ref)}}function RI(r){let e=(0,XR.createLangiumGrammarServices)(Dm.EmptyFileSystem).grammar,t=e.serializer.JsonSerializer.deserialize(r);if(!ar.isGrammar(t))throw new Error("Could not load grammar from specified json input.");return(0,wm.prepareGrammar)(e,t)}he.loadGrammarFromJson=RI;function _I(r){var e,t,n,i,o,a;let s=(e=r.grammarServices)!==null&&e!==void 0?e:(0,XR.createLangiumGrammarServices)(Dm.EmptyFileSystem).grammar,u=typeof r.grammar=="string"?s.parser.LangiumParser.parse(r.grammar).value:r.grammar;(0,wm.prepareGrammar)(s,u);let c=(t=r.parserConfig)!==null&&t!==void 0?t:{skipValidations:!1},l=(n=r.languageMetaData)!==null&&n!==void 0?n:{caseInsensitive:!1,fileExtensions:[`.${(o=(i=u.name)===null||i===void 0?void 0:i.toLowerCase())!==null&&o!==void 0?o:"unknown"}`],languageId:(a=u.name)!==null&&a!==void 0?a:"UNKNOWN"},d={AstReflection:()=>(0,cI.interpretAstReflection)(u)},g={Grammar:()=>u,LanguageMetaData:()=>l,parser:{ParserConfig:()=>c}},y=(0,YR.inject)((0,VR.createDefaultSharedModule)(Dm.EmptyFileSystem),d,r.sharedModule),p=(0,YR.inject)((0,VR.createDefaultModule)({shared:y}),g,r.module);return y.ServiceRegistry.register(p),p}he.createServicesForGrammar=_I});var t_=C(Ec=>{"use strict";Object.defineProperty(Ec,"__esModule",{value:!0});Ec.createGrammarConfig=void 0;var AI=et(),bI=Pt(),EI=So(),CI=ze(),PI=Ft();function kI(r){let e=[],t=r.Grammar;for(let n of t.rules)(0,CI.isTerminalRule)(n)&&(0,bI.isCommentTerminal)(n)&&(0,EI.isMultilineComment)((0,PI.terminalRegex)(n))&&e.push(n.name);return{multilineCommentRules:e,nameRegexp:AI.DefaultNameRegexp}}Ec.createGrammarConfig=kI});var $m=C(Cc=>{"use strict";Object.defineProperty(Cc,"__esModule",{value:!0});Cc.VERSION=void 0;Cc.VERSION="9.1.0"});var _e=C((exports,module)=>{"use strict";var __spreadArray=exports&&exports.__spreadArray||function(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,o;n<i;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return r.concat(o||Array.prototype.slice.call(e))};Object.defineProperty(exports,"__esModule",{value:!0});exports.toFastProperties=exports.timer=exports.peek=exports.isES2015MapSupported=exports.PRINT_WARNING=exports.PRINT_ERROR=exports.packArray=exports.IDENTITY=exports.NOOP=exports.merge=exports.groupBy=exports.defaults=exports.assignNoOverwrite=exports.assign=exports.zipObject=exports.sortBy=exports.indexOf=exports.some=exports.difference=exports.every=exports.isObject=exports.isRegExp=exports.isArray=exports.partial=exports.uniq=exports.compact=exports.reduce=exports.findAll=exports.find=exports.cloneObj=exports.cloneArr=exports.contains=exports.has=exports.pick=exports.reject=exports.filter=exports.dropRight=exports.drop=exports.isFunction=exports.isUndefined=exports.isString=exports.forEach=exports.last=exports.first=exports.flatten=exports.map=exports.mapValues=exports.values=exports.keys=exports.isEmpty=void 0;exports.upperFirst=void 0;function isEmpty(r){return r&&r.length===0}exports.isEmpty=isEmpty;function keys(r){return r==null?[]:Object.keys(r)}exports.keys=keys;function values(r){for(var e=[],t=Object.keys(r),n=0;n<t.length;n++)e.push(r[t[n]]);return e}exports.values=values;function mapValues(r,e){for(var t=[],n=keys(r),i=0;i<n.length;i++){var o=n[i];t.push(e.call(null,r[o],o))}return t}exports.mapValues=mapValues;function map(r,e){for(var t=[],n=0;n<r.length;n++)t.push(e.call(null,r[n],n));return t}exports.map=map;function flatten(r){for(var e=[],t=0;t<r.length;t++){var n=r[t];Array.isArray(n)?e=e.concat(flatten(n)):e.push(n)}return e}exports.flatten=flatten;function first(r){return isEmpty(r)?void 0:r[0]}exports.first=first;function last(r){var e=r&&r.length;return e?r[e-1]:void 0}exports.last=last;function forEach(r,e){if(Array.isArray(r))for(var t=0;t<r.length;t++)e.call(null,r[t],t);else if(isObject(r))for(var n=keys(r),t=0;t<n.length;t++){var i=n[t],o=r[i];e.call(null,o,i)}else throw Error("non exhaustive match")}exports.forEach=forEach;function isString(r){return typeof r=="string"}exports.isString=isString;function isUndefined(r){return r===void 0}exports.isUndefined=isUndefined;function isFunction(r){return r instanceof Function}exports.isFunction=isFunction;function drop(r,e){return e===void 0&&(e=1),r.slice(e,r.length)}exports.drop=drop;function dropRight(r,e){return e===void 0&&(e=1),r.slice(0,r.length-e)}exports.dropRight=dropRight;function filter(r,e){var t=[];if(Array.isArray(r))for(var n=0;n<r.length;n++){var i=r[n];e.call(null,i)&&t.push(i)}return t}exports.filter=filter;function reject(r,e){return filter(r,function(t){return!e(t)})}exports.reject=reject;function pick(r,e){for(var t=Object.keys(r),n={},i=0;i<t.length;i++){var o=t[i],a=r[o];e(a)&&(n[o]=a)}return n}exports.pick=pick;function has(r,e){return isObject(r)?r.hasOwnProperty(e):!1}exports.has=has;function contains(r,e){return find(r,function(t){return t===e})!==void 0}exports.contains=contains;function cloneArr(r){for(var e=[],t=0;t<r.length;t++)e.push(r[t]);return e}exports.cloneArr=cloneArr;function cloneObj(r){var e={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e}exports.cloneObj=cloneObj;function find(r,e){for(var t=0;t<r.length;t++){var n=r[t];if(e.call(null,n))return n}}exports.find=find;function findAll(r,e){for(var t=[],n=0;n<r.length;n++){var i=r[n];e.call(null,i)&&t.push(i)}return t}exports.findAll=findAll;function reduce(r,e,t){for(var n=Array.isArray(r),i=n?r:values(r),o=n?[]:keys(r),a=t,s=0;s<i.length;s++)a=e.call(null,a,i[s],n?s:o[s]);return a}exports.reduce=reduce;function compact(r){return reject(r,function(e){return e==null})}exports.compact=compact;function uniq(r,e){e===void 0&&(e=function(n){return n});var t=[];return reduce(r,function(n,i){var o=e(i);return contains(t,o)?n:(t.push(o),n.concat(i))},[])}exports.uniq=uniq;function partial(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];var n=[null],i=n.concat(e);return Function.bind.apply(r,i)}exports.partial=partial;function isArray(r){return Array.isArray(r)}exports.isArray=isArray;function isRegExp(r){return r instanceof RegExp}exports.isRegExp=isRegExp;function isObject(r){return r instanceof Object}exports.isObject=isObject;function every(r,e){for(var t=0;t<r.length;t++)if(!e(r[t],t))return!1;return!0}exports.every=every;function difference(r,e){return reject(r,function(t){return contains(e,t)})}exports.difference=difference;function some(r,e){for(var t=0;t<r.length;t++)if(e(r[t]))return!0;return!1}exports.some=some;function indexOf(r,e){for(var t=0;t<r.length;t++)if(r[t]===e)return t;return-1}exports.indexOf=indexOf;function sortBy(r,e){var t=cloneArr(r);return t.sort(function(n,i){return e(n)-e(i)}),t}exports.sortBy=sortBy;function zipObject(r,e){if(r.length!==e.length)throw Error("can't zipObject with different number of keys and values!");for(var t={},n=0;n<r.length;n++)t[r[n]]=e[n];return t}exports.zipObject=zipObject;function assign(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];for(var n=0;n<e.length;n++)for(var i=e[n],o=keys(i),a=0;a<o.length;a++){var s=o[a];r[s]=i[s]}return r}exports.assign=assign;function assignNoOverwrite(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];for(var n=0;n<e.length;n++)for(var i=e[n],o=keys(i),a=0;a<o.length;a++){var s=o[a];has(r,s)||(r[s]=i[s])}return r}exports.assignNoOverwrite=assignNoOverwrite;function defaults(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return assignNoOverwrite.apply(void 0,__spreadArray([{}],r,!1))}exports.defaults=defaults;function groupBy(r,e){var t={};return forEach(r,function(n){var i=e(n),o=t[i];o?o.push(n):t[i]=[n]}),t}exports.groupBy=groupBy;function merge(r,e){for(var t=cloneObj(r),n=keys(e),i=0;i<n.length;i++){var o=n[i],a=e[o];t[o]=a}return t}exports.merge=merge;function NOOP(){}exports.NOOP=NOOP;function IDENTITY(r){return r}exports.IDENTITY=IDENTITY;function packArray(r){for(var e=[],t=0;t<r.length;t++){var n=r[t];e.push(n!==void 0?n:void 0)}return e}exports.packArray=packArray;function PRINT_ERROR(r){console&&console.error&&console.error("Error: "+r)}exports.PRINT_ERROR=PRINT_ERROR;function PRINT_WARNING(r){console&&console.warn&&console.warn("Warning: "+r)}exports.PRINT_WARNING=PRINT_WARNING;function isES2015MapSupported(){return typeof Map=="function"}exports.isES2015MapSupported=isES2015MapSupported;function peek(r){return r[r.length-1]}exports.peek=peek;function timer(r){var e=new Date().getTime(),t=r(),n=new Date().getTime(),i=n-e;return{time:i,value:t}}exports.timer=timer;function toFastProperties(toBecomeFast){function FakeConstructor(){}FakeConstructor.prototype=toBecomeFast;var fakeInstance=new FakeConstructor;function fakeAccess(){return typeof fakeInstance.bar}return fakeAccess(),fakeAccess(),toBecomeFast;eval(toBecomeFast)}exports.toFastProperties=toFastProperties;function upperFirst(r){if(!r)return r;var e=getCharacterFromCodePointAt(r,0);return e.toUpperCase()+r.substring(e.length)}exports.upperFirst=upperFirst;var surrogatePairPattern=/[\uD800-\uDBFF][\uDC00-\uDFFF]/;function getCharacterFromCodePointAt(r,e){var t=r.substring(e,e+1);return surrogatePairPattern.test(t)?t:r[e]}});var kc=C(qo=>{"use strict";Object.defineProperty(qo,"__esModule",{value:!0});qo.clearRegExpParserCache=qo.getRegExpAst=void 0;var xI=wa(),Pc={},SI=new xI.RegExpParser;function NI(r){var e=r.toString();if(Pc.hasOwnProperty(e))return Pc[e];var t=SI.pattern(e);return Pc[e]=t,t}qo.getRegExpAst=NI;function DI(){Pc={}}qo.clearRegExpParserCache=DI});var a_=C(dr=>{"use strict";var wI=dr&&dr.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(dr,"__esModule",{value:!0});dr.canMatchCharCode=dr.firstCharOptimizedIndices=dr.getOptimizedStartCodesIndices=dr.failedOptimizationPrefixMsg=void 0;var n_=wa(),wr=_e(),i_=kc(),zn=Lm(),o_="Complement Sets are not supported for first char optimization";dr.failedOptimizationPrefixMsg=`Unable to use "first char" lexer optimizations:
3591
- `;function II(r,e){e===void 0&&(e=!1);try{var t=(0,i_.getRegExpAst)(r),n=Sc(t.value,{},t.flags.ignoreCase);return n}catch(o){if(o.message===o_)e&&(0,wr.PRINT_WARNING)(""+dr.failedOptimizationPrefixMsg+(" Unable to optimize: < "+r.toString()+` >
3589
+ `.repeat(s)}${o}`,range:e}}fitIntoOptions(e,t,n){return n.allowMore?e=Math.max(t,e):n.allowLess&&(e=Math.min(t,e)),e}findFittingMove(e,t,n){if(t.length===0)return;if(t.length===1)return t[0];let i=e.end.line-e.start.line;for(let o of t){if(o.lines!==void 0&&i<=o.lines)return o;if(o.lines===void 0&&i===0)return o}return t[t.length-1]}iterateCstTree(e,t){let i=e.parseResult.value.$cstNode;return i?new ja.TreeStreamImpl(i,o=>this.iterateCst(o,t)):ja.EMPTY_STREAM}iterateCst(e,t){if(!(0,Ip.isCompositeCstNode)(e))return ja.EMPTY_STREAM;let n=t.indentation;return new ja.StreamImpl(()=>({index:0}),i=>i.index<e.children.length?{done:!1,value:e.children[i.index++]}:(t.indentation=n,ja.DONE_RESULT))}};Zr.AbstractFormatter=Op;var Yu=class{constructor(e,t){this.astNode=e,this.collector=t}node(e){return new cr(e.$cstNode?[e.$cstNode]:[],this.collector)}nodes(...e){let t=[];for(let n of e)n.$cstNode&&t.push(n.$cstNode);return new cr(t,this.collector)}property(e,t){let n=(0,Vu.findNodeForProperty)(this.astNode.$cstNode,e,t);return new cr(n?[n]:[],this.collector)}properties(...e){let t=[];for(let n of e){let i=(0,Vu.findNodesForProperty)(this.astNode.$cstNode,n);t.push(...i)}return new cr(t,this.collector)}keyword(e,t){let n=(0,Vu.findNodeForKeyword)(this.astNode.$cstNode,e,t);return new cr(n?[n]:[],this.collector)}keywords(...e){let t=[];for(let n of e){let i=(0,Vu.findNodesForKeyword)(this.astNode.$cstNode,n);t.push(...i)}return new cr(t,this.collector)}cst(e){return new cr([...e],this.collector)}interior(e,t){let n=e.nodes,i=t.nodes;if(n.length!==1||i.length!==1)return new cr([],this.collector);let o=n[0],a=i[0];if(o.offset>a.offset){let s=o;o=a,a=s}return new cr((0,FT.getInteriorNodes)(o,a),this.collector)}};Zr.DefaultNodeFormatter=Yu;var cr=class{constructor(e,t){this.nodes=e,this.collector=t}prepend(e){for(let t of this.nodes)this.collector(t,"prepend",e);return this}append(e){for(let t of this.nodes)this.collector(t,"append",e);return this}surround(e){for(let t of this.nodes)this.collector(t,"prepend",e),this.collector(t,"append",e);return this}slice(e,t){return new cr(this.nodes.slice(e,t),this.collector)}};Zr.FormattingRegion=cr;var AD;(function(r){function e(...l){return{options:{},moves:l.flatMap(d=>d.moves).sort(c)}}r.fit=e;function t(l){return i(0,l)}r.noSpace=t;function n(l){return i(1,l)}r.oneSpace=n;function i(l,d){return{options:d??{},moves:[{characters:l}]}}r.spaces=i;function o(l){return a(1,l)}r.newLine=o;function a(l,d){return{options:d??{},moves:[{lines:l}]}}r.newLines=a;function s(l){return{options:l??{},moves:[{tabs:1,lines:1}]}}r.indent=s;function u(l){return{options:l??{},moves:[{tabs:0}]}}r.noIndent=u;function c(l,d){var g,y,p,A,x,k;let _=(g=l.lines)!==null&&g!==void 0?g:0,R=(y=d.lines)!==null&&y!==void 0?y:0,D=(p=l.tabs)!==null&&p!==void 0?p:0,B=(A=d.tabs)!==null&&A!==void 0?A:0,V=(x=l.characters)!==null&&x!==void 0?x:0,G=(k=d.characters)!==null&&k!==void 0?k:0;return _<R?-1:_>R?1:D<B?-1:D>B?1:V<G?-1:V>G?1:0}})(AD=Zr.Formatting||(Zr.Formatting={}))});var qT=C(_n=>{"use strict";var bD=_n&&_n.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),ED=_n&&_n.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),CD=_n&&_n.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&bD(e,r,t);return ED(e,r),e};Object.defineProperty(_n,"__esModule",{value:!0});_n.LangiumGrammarFormatter=void 0;var Ee=$p(),gi=CD(ze()),Mp=class extends Ee.AbstractFormatter{format(e){if(gi.isCrossReference(e))this.getNodeFormatter(e).properties("type","terminal").surround(Ee.Formatting.noSpace());else if(gi.isParserRule(e)){let t=this.getNodeFormatter(e);t.keywords("entry","fragment","returns").append(Ee.Formatting.oneSpace()),(e.inferredType||e.returnType||e.dataType)&&e.parameters.length===0?t.property("name").append(Ee.Formatting.oneSpace()):t.property("name").append(Ee.Formatting.noSpace()),t.properties("parameters").append(Ee.Formatting.noSpace()),t.keywords(",").append(Ee.Formatting.oneSpace()),t.keywords("<").append(Ee.Formatting.noSpace());let n=t.keyword(";"),i=t.keyword(":");i.prepend(Ee.Formatting.noSpace()),t.interior(i,n).prepend(Ee.Formatting.indent()),n.prepend(Ee.Formatting.fit(Ee.Formatting.noSpace(),Ee.Formatting.newLine())),t.node(e).prepend(Ee.Formatting.noIndent())}else if(gi.isTerminalRule(e)){let t=this.getNodeFormatter(e);e.type&&(t.property("name").append(Ee.Formatting.oneSpace()),t.keyword("returns").append(Ee.Formatting.oneSpace())),t.keywords("hidden","terminal","fragment").append(Ee.Formatting.oneSpace()),t.keyword(":").prepend(Ee.Formatting.noSpace()),t.keyword(";").prepend(Ee.Formatting.fit(Ee.Formatting.noSpace(),Ee.Formatting.newLine())),t.node(e).prepend(Ee.Formatting.noIndent())}else if(gi.isAction(e)){let t=this.getNodeFormatter(e);t.keyword("{").append(Ee.Formatting.noSpace()),t.keywords(".","+=","=").surround(Ee.Formatting.noSpace()),t.keyword("}").prepend(Ee.Formatting.noSpace())}else if(gi.isInferredType(e))this.getNodeFormatter(e).keywords("infer","infers").append(Ee.Formatting.oneSpace());else if(gi.isAssignment(e))this.getNodeFormatter(e).keywords("=","+=","?=").surround(Ee.Formatting.noSpace());else if(gi.isRuleCall(e)){let t=this.getNodeFormatter(e);t.keyword("<").surround(Ee.Formatting.noSpace()),t.keyword(",").append(Ee.Formatting.oneSpace()),t.properties("arguments").append(Ee.Formatting.noSpace())}gi.isAbstractElement(e)&&this.getNodeFormatter(e).property("cardinality").prepend(Ee.Formatting.noSpace())}};_n.LangiumGrammarFormatter=Mp});var Zu=C(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.SemanticTokensDecoder=_t.AbstractSemanticTokenProvider=_t.SemanticTokensBuilder=_t.DefaultSemanticTokenOptions=_t.AllSemanticTokenModifiers=_t.AllSemanticTokenTypes=void 0;var ue=we(),Xu=Pt(),PD=Re();_t.AllSemanticTokenTypes={[ue.SemanticTokenTypes.class]:0,[ue.SemanticTokenTypes.comment]:1,[ue.SemanticTokenTypes.enum]:2,[ue.SemanticTokenTypes.enumMember]:3,[ue.SemanticTokenTypes.event]:4,[ue.SemanticTokenTypes.function]:5,[ue.SemanticTokenTypes.interface]:6,[ue.SemanticTokenTypes.keyword]:7,[ue.SemanticTokenTypes.macro]:8,[ue.SemanticTokenTypes.method]:9,[ue.SemanticTokenTypes.modifier]:10,[ue.SemanticTokenTypes.namespace]:11,[ue.SemanticTokenTypes.number]:12,[ue.SemanticTokenTypes.operator]:13,[ue.SemanticTokenTypes.parameter]:14,[ue.SemanticTokenTypes.property]:15,[ue.SemanticTokenTypes.regexp]:16,[ue.SemanticTokenTypes.string]:17,[ue.SemanticTokenTypes.struct]:18,[ue.SemanticTokenTypes.type]:19,[ue.SemanticTokenTypes.typeParameter]:20,[ue.SemanticTokenTypes.variable]:21};_t.AllSemanticTokenModifiers={[ue.SemanticTokenModifiers.abstract]:1<<0,[ue.SemanticTokenModifiers.async]:1<<1,[ue.SemanticTokenModifiers.declaration]:1<<2,[ue.SemanticTokenModifiers.defaultLibrary]:1<<3,[ue.SemanticTokenModifiers.definition]:1<<4,[ue.SemanticTokenModifiers.deprecated]:1<<5,[ue.SemanticTokenModifiers.documentation]:1<<6,[ue.SemanticTokenModifiers.modification]:1<<7,[ue.SemanticTokenModifiers.readonly]:1<<8,[ue.SemanticTokenModifiers.static]:1<<9};_t.DefaultSemanticTokenOptions={legend:{tokenTypes:Object.keys(_t.AllSemanticTokenTypes),tokenModifiers:Object.keys(_t.AllSemanticTokenModifiers)},full:{delta:!0},range:!0};var Ju=class extends ue.SemanticTokensBuilder{constructor(){super(...arguments),this._tokens=[]}push(e,t,n,i,o){this._tokens.push({line:e,char:t,length:n,tokenType:i,tokenModifiers:o})}build(){return this.applyTokens(),super.build()}buildEdits(){return this.applyTokens(),super.buildEdits()}applyTokens(){for(let e of this._tokens.sort(this.compareTokens))super.push(e.line,e.char,e.length,e.tokenType,e.tokenModifiers);this._tokens=[]}compareTokens(e,t){return e.line===t.line?e.char-t.char:e.line-t.line}};_t.SemanticTokensBuilder=Ju;var Lp=class{constructor(e){this.tokensBuilders=new Map,e.shared.workspace.TextDocuments.onDidClose(t=>{this.tokensBuilders.delete(t.document.uri)}),e.shared.lsp.LanguageServer.onInitialize(t=>{var n;this.initialize((n=t.capabilities.textDocument)===null||n===void 0?void 0:n.semanticTokens)})}initialize(e){this.clientCapabilities=e}semanticHighlight(e,t,n=ue.CancellationToken.None){return this.currentRange=void 0,this.currentDocument=e,this.currentTokensBuilder=this.getDocumentTokensBuilder(e),this.computeHighlighting(e,this.createAcceptor(),n),this.currentTokensBuilder.build()}semanticHighlightRange(e,t,n=ue.CancellationToken.None){return this.currentRange=t.range,this.currentDocument=e,this.currentTokensBuilder=this.getDocumentTokensBuilder(e),this.computeHighlighting(e,this.createAcceptor(),n),this.currentTokensBuilder.build()}semanticHighlightDelta(e,t,n=ue.CancellationToken.None){return this.currentRange=void 0,this.currentDocument=e,this.currentTokensBuilder=this.getDocumentTokensBuilder(e),this.currentTokensBuilder.previousResult(t.previousResultId),this.computeHighlighting(e,this.createAcceptor(),n),this.currentTokensBuilder.buildEdits()}createAcceptor(){return t=>{"line"in t?this.highlightToken({range:{start:{line:t.line,character:t.char},end:{line:t.line,character:t.char+t.length}},type:t.type,modifier:t.modifier}):"range"in t?this.highlightToken(t):"keyword"in t?this.highlightKeyword(t):"property"in t?this.highlightProperty(t):this.highlightNode({node:t.cst,type:t.type,modifier:t.modifier})}}getDocumentTokensBuilder(e){let t=this.tokensBuilders.get(e.uri.toString());if(t)return t;let n=new Ju;return this.tokensBuilders.set(e.uri.toString(),n),n}computeHighlighting(e,t,n){let i=e.parseResult.value;if(this.highlightElement(i,t)==="prune")return;let o=(0,PD.streamAllContents)(i).iterator(),a;do if(a=o.next(),!a.done){if(n.isCancellationRequested)break;let s=a.value,u=s.$cstNode.range,c=this.compareRange(u);if(c===1)break;if(c===-1)continue;this.highlightElement(s,t)==="prune"&&o.prune()}while(!a.done)}compareRange(e){if(!this.currentRange)return 0;let t=typeof e=="number"?e:e.start.line;return(typeof e=="number"?e:e.end.line)<this.currentRange.start.line?-1:t>this.currentRange.end.line?1:0}highlightToken(e){var t;let{range:n,type:i}=e,o=e.modifier;if(this.compareRange(n)!==0||!this.currentDocument||!this.currentTokensBuilder)return;let a=_t.AllSemanticTokenTypes[i],s=0;if(o!==void 0){typeof o=="string"&&(o=[o]);for(let l of o){let d=_t.AllSemanticTokenModifiers[l];s|=d}}let u=n.start.line,c=n.end.line;if(u===c){let l=n.start.character,d=n.end.character-l;this.currentTokensBuilder.push(u,l,d,a,s)}else if(!((t=this.clientCapabilities)===null||t===void 0)&&t.multilineTokenSupport){let l=n.start.character,d=this.currentDocument.textDocument.offsetAt(n.start),g=this.currentDocument.textDocument.offsetAt(n.end);this.currentTokensBuilder.push(u,l,g-d,a,s)}else{let l=n.start,d=this.currentDocument.textDocument.offsetAt({line:u+1,character:0});this.currentTokensBuilder.push(l.line,l.character,d-l.character-1,a,s);for(let g=u+1;g<c;g++){let y=d;d=this.currentDocument.textDocument.offsetAt({line:g+1,character:0}),this.currentTokensBuilder.push(g,0,d-y-1,a,s)}this.currentTokensBuilder.push(c,0,n.end.character,a,s)}}highlightProperty(e){let t=[];if(typeof e.index=="number"){let o=(0,Xu.findNodeForProperty)(e.node.$cstNode,e.property,e.index);o&&t.push(o)}else t.push(...(0,Xu.findNodesForProperty)(e.node.$cstNode,e.property));let{type:n,modifier:i}=e;for(let o of t)this.highlightNode({node:o,type:n,modifier:i})}highlightKeyword(e){let{node:t,keyword:n,type:i,index:o,modifier:a}=e,s=[];if(typeof o=="number"){let u=(0,Xu.findNodeForKeyword)(t.$cstNode,n,o);u&&s.push(u)}else s.push(...(0,Xu.findNodesForKeyword)(t.$cstNode,n));for(let u of s)this.highlightNode({node:u,type:i,modifier:a})}highlightNode(e){let{node:t,type:n,modifier:i}=e,o=t.range;this.highlightToken({range:o,type:n,modifier:i})}};_t.AbstractSemanticTokenProvider=Lp;var kD;(function(r){function e(n,i){let o=new Map;Object.entries(_t.AllSemanticTokenTypes).forEach(([u,c])=>o.set(c,u));let a=0,s=0;return t(n.data,5).map(u=>{a+=u[0],u[0]!==0&&(s=0),s+=u[1];let c=u[2];return{offset:i.textDocument.offsetAt({line:a,character:s}),tokenType:o.get(u[3]),tokenModifiers:u[4],text:i.textDocument.getText({start:{line:a,character:s},end:{line:a,character:s+c}})}})}r.decode=e;function t(n,i){let o=[];for(let a=0;a<n.length;a+=i){let s=n.slice(a,a+i);o.push(s)}return o}})(kD=_t.SemanticTokensDecoder||(_t.SemanticTokensDecoder={}))});var jT=C(Qu=>{"use strict";Object.defineProperty(Qu,"__esModule",{value:!0});Qu.LangiumGrammarSemanticTokenProvider=void 0;var qi=we(),xD=Zu(),ji=ze(),Fp=class extends xD.AbstractSemanticTokenProvider{highlightElement(e,t){var n;(0,ji.isAssignment)(e)?t({node:e,property:"feature",type:qi.SemanticTokenTypes.property}):(0,ji.isAction)(e)?e.feature&&t({node:e,property:"feature",type:qi.SemanticTokenTypes.property}):(0,ji.isReturnType)(e)?t({node:e,property:"name",type:qi.SemanticTokenTypes.type}):(0,ji.isAtomType)(e)?(e.primitiveType||e.refType)&&t({node:e,property:e.primitiveType?"primitiveType":"refType",type:qi.SemanticTokenTypes.type}):(0,ji.isParameter)(e)?t({node:e,property:"name",type:qi.SemanticTokenTypes.parameter}):(0,ji.isParameterReference)(e)?t({node:e,property:"parameter",type:qi.SemanticTokenTypes.parameter}):(0,ji.isRuleCall)(e)&&!((n=e.rule.ref)===null||n===void 0)&&n.fragment&&t({node:e,property:"rule",type:qi.SemanticTokenTypes.type})}};Qu.LangiumGrammarSemanticTokenProvider=Fp});var UT=C(ec=>{"use strict";Object.defineProperty(ec,"__esModule",{value:!0});ec.LangiumGrammarNameProvider=void 0;var SD=Io(),ND=Pt(),GT=ze(),qp=class extends SD.DefaultNameProvider{getName(e){return(0,GT.isAssignment)(e)?e.feature:super.getName(e)}getNameNode(e){return(0,GT.isAssignment)(e)?(0,ND.findNodeForProperty)(e.$cstNode,"feature"):super.getNameNode(e)}};ec.LangiumGrammarNameProvider=qp});var Gp=C(tc=>{"use strict";Object.defineProperty(tc,"__esModule",{value:!0});tc.DefaultReferences=void 0;var DD=Pt(),An=Re(),HT=et(),WT=Ct(),wD=hi(),jp=class{constructor(e){this.nameProvider=e.references.NameProvider,this.index=e.shared.workspace.IndexManager,this.nodeLocator=e.workspace.AstNodeLocator}findDeclaration(e){if(e){let t=(0,DD.findAssignment)(e),n=e.element;if(t&&n){let i=n[t.feature];if((0,An.isReference)(i))return i.ref;if(Array.isArray(i)){for(let o of i)if((0,An.isReference)(o)&&o.$refNode.offset<=e.offset&&o.$refNode.end>=e.end)return o.ref}else return n}}}findDeclarationNode(e){let t=this.findDeclaration(e);if(t?.$cstNode){let n=this.nameProvider.getNameNode(t);return n||t.$cstNode}}findReferences(e,t){return t.onlyLocal?this.findLocalReferences(e,t.includeDeclaration):this.findGlobalReferences(e,t.includeDeclaration)}findGlobalReferences(e,t=!1){let n=[];if(t){let i=this.getReferenceToSelf(e);i&&n.push(i)}return n.push(...this.index.findAllReferences(e,this.nodeLocator.getAstNodePath(e))),(0,WT.stream)(n)}findLocalReferences(e,t=!1){let i=(0,An.getDocument)(e).parseResult.value,o=[];if(t){let s=this.getReferenceToSelf(e);s&&o.push(s)}let a=[];return(0,An.streamAst)(i).forEach(s=>{(0,An.streamReferences)(s).forEach(u=>{u.reference.ref===e&&a.push(u.reference)})}),a.forEach(s=>{o.push({sourceUri:(0,An.getDocument)(s.$refNode.element).uri,sourcePath:this.nodeLocator.getAstNodePath(s.$refNode.element),targetUri:(0,An.getDocument)(e).uri,targetPath:this.nodeLocator.getAstNodePath(e),segment:(0,HT.toDocumentSegment)(s.$refNode),local:(0,wD.equalURI)((0,An.getDocument)(s.$refNode.element).uri,(0,An.getDocument)(e).uri)})}),(0,WT.stream)(o)}getReferenceToSelf(e){let t=this.nameProvider.getNameNode(e);if(t){let n=(0,An.getDocument)(e),i=this.nodeLocator.getAstNodePath(e);return{sourceUri:n.uri,sourcePath:i,targetUri:n.uri,targetPath:i,segment:(0,HT.toDocumentSegment)(t),local:!0}}}};tc.DefaultReferences=jp});var YT=C(nc=>{"use strict";Object.defineProperty(nc,"__esModule",{value:!0});nc.LangiumGrammarReferences=void 0;var ID=Gp(),Vt=Re(),KT=et(),BT=Pt(),zT=Ct(),Up=hi(),qt=ze(),VT=Lt(),rc=mi(),Hp=class extends ID.DefaultReferences{constructor(e){super(e),this.documents=e.shared.workspace.LangiumDocuments}findDeclaration(e){let t=e.element,n=(0,BT.findAssignment)(e);if(n&&n.feature==="feature"){if((0,qt.isAssignment)(t))return this.findAssignmentDeclaration(t);if((0,qt.isAction)(t))return this.findActionDeclaration(t)}return super.findDeclaration(e)}findLocalReferences(e,t=!1){if((0,qt.isTypeAttribute)(e)){let i=(0,Vt.getDocument)(e).parseResult.value;return this.findLocalReferencesToTypeAttribute(e,i,t)}else return super.findLocalReferences(e,t)}findGlobalReferences(e,t=!1){return(0,qt.isTypeAttribute)(e)?this.findReferencesToTypeAttribute(e,t):super.findGlobalReferences(e,t)}findLocalReferencesToTypeAttribute(e,t,n){let i=[],o=(0,Vt.getContainerOfType)(e,qt.isInterface);if(o){let a=(0,rc.collectChildrenTypes)(o,this,this.documents,this.nodeLocator),s=[];if(a.forEach(u=>{let c=this.findLocalRulesWithReturnType(u,t);s.push(...c)}),(0,Up.equalURI)((0,Vt.getDocument)(e).uri,(0,Vt.getDocument)(t).uri)&&n){let u=this.getReferenceToSelf(e);u&&i.push(u)}s.forEach(u=>{let c=this.createReferencesToAttribute(u,e);i.push(...c)})}return(0,zT.stream)(i)}findReferencesToTypeAttribute(e,t){let n=[],i=(0,Vt.getContainerOfType)(e,qt.isInterface);if(i){if(t){let s=this.getReferenceToSelf(e);s&&n.push(s)}let o=(0,rc.collectChildrenTypes)(i,this,this.documents,this.nodeLocator),a=[];o.forEach(s=>{let u=this.findRulesWithReturnType(s);a.push(...u)}),a.forEach(s=>{let u=this.createReferencesToAttribute(s,e);n.push(...u)})}return(0,zT.stream)(n)}createReferencesToAttribute(e,t){let n=[];if((0,qt.isParserRule)(e)){let i=(0,VT.extractAssignments)(e.definition).find(o=>o.feature===t.name);if(i?.$cstNode){let o=this.nameProvider.getNameNode(i);o&&n.push({sourceUri:(0,Vt.getDocument)(i).uri,sourcePath:this.nodeLocator.getAstNodePath(i),targetUri:(0,Vt.getDocument)(t).uri,targetPath:this.nodeLocator.getAstNodePath(t),segment:(0,KT.toDocumentSegment)(o),local:(0,Up.equalURI)((0,Vt.getDocument)(i).uri,(0,Vt.getDocument)(t).uri)})}}else{if(e.feature===t.name){let o=(0,BT.findNodeForProperty)(e.$cstNode,"feature");o&&n.push({sourceUri:(0,Vt.getDocument)(e).uri,sourcePath:this.nodeLocator.getAstNodePath(e),targetUri:(0,Vt.getDocument)(t).uri,targetPath:this.nodeLocator.getAstNodePath(t),segment:(0,KT.toDocumentSegment)(o),local:(0,Up.equalURI)((0,Vt.getDocument)(e).uri,(0,Vt.getDocument)(t).uri)})}let i=(0,Vt.getContainerOfType)(e,qt.isParserRule);n.push(...this.createReferencesToAttribute(i,t))}return n}findAssignmentDeclaration(e){var t;let n=(0,Vt.getContainerOfType)(e,qt.isParserRule),i=(0,VT.getActionAtElement)(e);if(i){let o=this.findActionDeclaration(i,e.feature);if(o)return o}if(!((t=n?.returnType)===null||t===void 0)&&t.ref&&((0,qt.isInterface)(n.returnType.ref)||(0,qt.isType)(n.returnType.ref))){let o=(0,rc.collectSuperTypes)(n.returnType.ref);for(let a of o){let s=a.attributes.find(u=>u.name===e.feature);if(s)return s}}return e}findActionDeclaration(e,t){var n;if(!((n=e.type)===null||n===void 0)&&n.ref){let i=t??e.feature,o=(0,rc.collectSuperTypes)(e.type.ref);for(let a of o){let s=a.attributes.find(u=>u.name===i);if(s)return s}}}findRulesWithReturnType(e){let t=[];return this.index.findAllReferences(e,this.nodeLocator.getAstNodePath(e)).forEach(i=>{let o=this.documents.getOrCreateDocument(i.sourceUri),a=this.nodeLocator.getAstNode(o,i.sourcePath);((0,qt.isParserRule)(a)||(0,qt.isAction)(a))&&t.push(a)}),t}findLocalRulesWithReturnType(e,t){let n=[];return(0,Vt.streamAst)(t).filter(o=>{var a,s;return(0,qt.isParserRule)(o)&&((a=o.returnType)===null||a===void 0?void 0:a.ref)===e||(0,qt.isAction)(o)&&((s=o.type)===null||s===void 0?void 0:s.ref)===e}).forEach(o=>{((0,qt.isParserRule)(o)||(0,qt.isAction)(o))&&n.push(o)}),n}};nc.LangiumGrammarReferences=Hp});var Bp=C(Dr=>{"use strict";var OD=Dr&&Dr.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),$D=Dr&&Dr.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),MD=Dr&&Dr.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&OD(e,r,t);return $D(e,r),e};Object.defineProperty(Dr,"__esModule",{value:!0});Dr.findFirstFeatures=Dr.findNextFeatures=void 0;var Yt=MD(ze()),Kn=Lt(),XT=Re(),LD=Pt();function FD(r,e){let t={stacks:r,tokens:e};return qD(t),t.stacks.flat().forEach(i=>{i.property=void 0}),QT(t.stacks).map(i=>i[i.length-1])}Dr.findNextFeatures=FD;function Wp(r){let{next:e,cardinalities:t,visited:n,plus:i}=r,o=[],a=e.feature;if(n.has(a))return[];n.add(a);let s,u=a;for(;u.$container;)if(Yt.isGroup(u.$container)){s=u.$container;break}else if(Yt.isAbstractElement(u.$container))u=u.$container;else break;if((0,Kn.isArrayCardinality)(u.cardinality)){let c=$o({next:{feature:u,type:e.type,new:!1},cardinalities:t,visited:n,plus:i});for(let l of c)i.add(l.feature);o.push(...c)}if(s){let c=s.elements.indexOf(u);c!==void 0&&c<s.elements.length-1&&o.push(...ZT({feature:s,type:e.type,new:!1},c+1,t,n,i)),o.every(l=>(0,Kn.isOptionalCardinality)(l.feature.cardinality)||(0,Kn.isOptionalCardinality)(t.get(l.feature))||i.has(l.feature))&&o.push(...Wp({next:{feature:s,type:e.type,new:!1},cardinalities:t,visited:n,plus:i}))}return o}function JT(r){return(0,XT.isAstNode)(r)&&(r={feature:r}),$o({next:r,cardinalities:new Map,visited:new Set,plus:new Set})}Dr.findFirstFeatures=JT;function $o(r){var e,t,n;let{next:i,cardinalities:o,visited:a,plus:s}=r;if(i===void 0)return[];let{feature:u,type:c}=i;if(Yt.isGroup(u)){if(a.has(u))return[];a.add(u)}if(Yt.isGroup(u))return ZT(i,0,o,a,s).map(l=>ic(l,u.cardinality,o));if(Yt.isAlternatives(u)||Yt.isUnorderedGroup(u))return u.elements.flatMap(l=>$o({next:{feature:l,new:!1,type:c},cardinalities:o,visited:a,plus:s})).map(l=>ic(l,u.cardinality,o));if(Yt.isAssignment(u)){let l={feature:u.terminal,new:!1,type:c,property:(e=i.property)!==null&&e!==void 0?e:u.feature};return $o({next:l,cardinalities:o,visited:a,plus:s}).map(d=>ic(d,u.cardinality,o))}else{if(Yt.isAction(u))return Wp({next:{feature:u,new:!0,type:(0,Kn.getTypeName)(u),property:(t=i.property)!==null&&t!==void 0?t:u.feature},cardinalities:o,visited:a,plus:s});if(Yt.isRuleCall(u)&&Yt.isParserRule(u.rule.ref)){let l=u.rule.ref,d={feature:l.definition,new:!0,type:l.fragment?void 0:(n=(0,Kn.getExplicitRuleType)(l))!==null&&n!==void 0?n:l.name,property:i.property};return $o({next:d,cardinalities:o,visited:a,plus:s}).map(g=>ic(g,u.cardinality,o))}else return[i]}}function ic(r,e,t){return t.set(r.feature,e),r}function ZT(r,e,t,n,i){var o;let a=[],s;for(;e<r.feature.elements.length&&(s={feature:r.feature.elements[e++],new:!1,type:r.type},a.push(...$o({next:s,cardinalities:t,visited:n,plus:i})),!!(0,Kn.isOptionalCardinality)((o=s.feature.cardinality)!==null&&o!==void 0?o:t.get(s.feature))););return a}function qD(r){for(let e of r.tokens){let t=QT(r.stacks,e);r.stacks=t}}function QT(r,e){let t=[];for(let n of r)t.push(...jD(n,e));return t}function jD(r,e){let t=new Map,n=new Set(r.map(o=>o.feature).filter(GD)),i=[];for(;r.length>0;){let o=r.pop(),a=Wp({next:o,cardinalities:t,plus:n,visited:new Set}).filter(s=>e?Kp(s.feature,e):!0);for(let s of a)i.push([...r,s]);if(!a.every(s=>(0,Kn.isOptionalCardinality)(s.feature.cardinality)||(0,Kn.isOptionalCardinality)(t.get(s.feature))))break}return i}function GD(r){if(r.cardinality==="+")return!0;let e=(0,XT.getContainerOfType)(r,Yt.isAssignment);return!!(e&&e.cardinality==="+")}function Kp(r,e){if(Yt.isKeyword(r))return r.value===e.image;if(Yt.isRuleCall(r))return UD(r.rule.ref,e);if(Yt.isCrossReference(r)){let t=(0,LD.getCrossReferenceTerminal)(r);if(t)return Kp(t,e)}return!1}function UD(r,e){return Yt.isParserRule(r)?JT(r.definition).some(n=>Kp(n.feature,e)):Yt.isTerminalRule(r)?new RegExp((0,Kn.terminalRegex)(r)).test(e.image):!1}});var Yp=C(bn=>{"use strict";var HD=bn&&bn.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),WD=bn&&bn.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),KD=bn&&bn.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&HD(e,r,t);return WD(e,r),e};Object.defineProperty(bn,"__esModule",{value:!0});bn.DefaultCompletionProvider=void 0;var Ga=we(),Ua=KD(ze()),BD=Lt(),zp=Re(),zD=et(),eR=Pt(),tR=Ct(),oc=Bp(),Vp=class{constructor(e){this.scopeProvider=e.references.ScopeProvider,this.grammar=e.Grammar,this.completionParser=e.parser.CompletionParser,this.nameProvider=e.references.NameProvider,this.grammarConfig=e.parser.GrammarConfig}async getCompletion(e,t){let i=e.parseResult.value.$cstNode;if(!i)return;let o=[],a=e.textDocument,s=a.getText(),u=a.offsetAt(t.position),c=(x,k)=>{let _=this.fillCompletionItem(a,u,x,k);_&&o.push(_)},l=(0,zD.findLeafNodeAtOffset)(i,this.backtrackToAnyToken(s,u));if(!l){let x=(0,eR.getEntryRule)(this.grammar);return await this.completionForRule(void 0,x,c),Ga.CompletionList.create(o,!0)}let d=this.backtrackToTokenStart(s,u),g=this.findFeaturesAt(a,d),y=[],p=u!==d;p&&(y=this.findFeaturesAt(a,u));let A=x=>Ua.isKeyword(x.feature)?x.feature.value:x.feature;if(await Promise.all((0,tR.stream)(g).distinct(A).map(x=>this.completionFor(l.element,x,c))),p){let x=a.getText({start:a.positionAt(d),end:t.position}).toLowerCase();o=o.filter(k=>k.label.toLowerCase().startsWith(x)),await Promise.all((0,tR.stream)(y).exclude(g,A).distinct(A).map(k=>this.completionFor(l.element,k,c)))}return Ga.CompletionList.create(o,!0)}findFeaturesAt(e,t){let n=e.getText({start:Ga.Position.create(0,0),end:e.positionAt(t)}),i=this.completionParser.parse(n),o=i.tokens;if(i.tokenIndex===0){let u=(0,eR.getEntryRule)(this.grammar),c=(0,oc.findFirstFeatures)({feature:u.definition,new:!0,type:(0,BD.getExplicitRuleType)(u)});return o.length>0?(o.shift(),(0,oc.findNextFeatures)(c.map(l=>[l]),o)):c}let a=[...o].splice(i.tokenIndex);return(0,oc.findNextFeatures)([i.elementStack.map(u=>({feature:u}))],a)}backtrackToAnyToken(e,t){for(t>=e.length&&(t=e.length-1);t>0&&/\s/.test(e.charAt(t));)t--;return t}backtrackToTokenStart(e,t){if(t<1)return t;let n=this.grammarConfig.nameRegexp,i=e.charAt(t-1);for(;t>0&&n.test(i);)t--,i=e.charAt(t-1);return t}async completionForRule(e,t,n){if(Ua.isParserRule(t)){let i=(0,oc.findFirstFeatures)(t.definition);await Promise.all(i.map(o=>this.completionFor(e,o,n)))}}completionFor(e,t,n){if(Ua.isKeyword(t.feature))return this.completionForKeyword(t.feature,e,n);if(Ua.isCrossReference(t.feature)&&e)return this.completionForCrossReference(t,e,n)}completionForCrossReference(e,t,n){let i=(0,zp.getContainerOfType)(e.feature,Ua.isAssignment);if(i){if(e.type&&(e.new||t?.$type!==e.type)&&(t={$type:e.type,$container:t,$containerProperty:e.property}),!t)return;let o={reference:{},container:t,property:i.feature};try{let a=this.scopeProvider.getScope(o),s=new Set;a.getAllElements().forEach(u=>{!s.has(u.name)&&this.filterCrossReference(u)&&(n(u,this.createReferenceCompletionItem(u)),s.add(u.name))})}catch(a){console.error(a)}}}createReferenceCompletionItem(e){return{kind:Ga.CompletionItemKind.Reference,detail:e.type,sortText:"0"}}filterCrossReference(e){return!0}completionForKeyword(e,t,n){!e.value.match(/[\w]+/)||n(e.value,{kind:Ga.CompletionItemKind.Keyword,detail:"Keyword",sortText:/\w/.test(e.value)?"1":"2"})}fillCompletionItem(e,t,n,i){let o;if(typeof n=="string")o=n;else if((0,zp.isAstNode)(n)){let u=this.nameProvider.getName(n);if(!u)return;o=u}else if(!(0,zp.isAstNode)(n))o=n.name;else return;let a=this.buildCompletionTextEdit(e,t,o);return a?Object.assign({label:o,textEdit:a},i):void 0}buildCompletionTextEdit(e,t,n){let i=0,o=e.getText(),a=o.toLowerCase(),s=n.toLowerCase();for(let u=s.length;u>0;u--){let c=a.substring(t-u,t);if(s.startsWith(c)&&(u===0||!this.isWordCharacterAt(a,t-u-1))){i=u;break}}if(i>0||t===0||!this.isWordCharacterAt(n,0)||!this.isWordCharacterAt(o,t-1)){let u=e.positionAt(t-i),c=e.positionAt(t);return{newText:n,range:{start:u,end:c}}}else return}isWordCharacterAt(e,t){return this.grammarConfig.nameRegexp.test(e.charAt(t))}};bn.DefaultCompletionProvider=Vp});var nR=C(rR=>{"use strict";Object.defineProperty(rR,"__esModule",{value:!0})});var Jp=C(ac=>{"use strict";Object.defineProperty(ac,"__esModule",{value:!0});ac.DefaultDocumentHighlightProvider=void 0;var VD=we(),YD=Re(),XD=et(),JD=hi(),Xp=class{constructor(e){this.references=e.references.References,this.nameProvider=e.references.NameProvider,this.grammarConfig=e.parser.GrammarConfig}getDocumentHighlight(e,t){let n=e.parseResult.value.$cstNode;if(!n)return;let i=(0,XD.findDeclarationNodeAtOffset)(n,e.textDocument.offsetAt(t.position),this.grammarConfig.nameRegexp);if(!i)return;let o=this.references.findDeclaration(i);if(o){let a=[],u={onlyLocal:!0,includeDeclaration:(0,JD.equalURI)((0,YD.getDocument)(o).uri,e.uri)};return this.references.findReferences(o,u).forEach(c=>{a.push(this.createDocumentHighlight(c))}),a}}createDocumentHighlight(e){return VD.DocumentHighlight.create(e.segment.range)}};ac.DefaultDocumentHighlightProvider=Xp});var oR=C(iR=>{"use strict";Object.defineProperty(iR,"__esModule",{value:!0})});var Qp=C(sc=>{"use strict";Object.defineProperty(sc,"__esModule",{value:!0});sc.DefaultDocumentSymbolProvider=void 0;var ZD=we(),QD=Re(),Zp=class{constructor(e){this.nameProvider=e.references.NameProvider}getSymbols(e){return this.getSymbol(e,e.parseResult.value)}getSymbol(e,t){let n=t.$cstNode,i=this.nameProvider.getNameNode(t);if(i&&n){let o=this.nameProvider.getName(t);return[{kind:this.getSymbolKind(t.$type),name:o??i.text,range:n.range,selectionRange:i.range,children:this.getChildSymbols(e,t)}]}else return this.getChildSymbols(e,t)||[]}getChildSymbols(e,t){let n=[];for(let i of(0,QD.streamContents)(t)){let o=this.getSymbol(e,i);n.push(...o)}if(n.length>0)return n}getSymbolKind(e){return ZD.SymbolKind.Field}};sc.DefaultDocumentSymbolProvider=Zp});var aR=C(uc=>{"use strict";Object.defineProperty(uc,"__esModule",{value:!0});uc.AbstractExecuteCommandHandler=void 0;var ew=we(),em=class{constructor(){this.registeredCommands=new Map,this.registerCommands(this.createCommandAcceptor())}get commands(){return Array.from(this.registeredCommands.keys())}async executeCommand(e,t,n=ew.CancellationToken.None){let i=this.registeredCommands.get(e);if(i)return i(t,n)}createCommandAcceptor(){return(e,t)=>this.registeredCommands.set(e,t)}};uc.AbstractExecuteCommandHandler=em});var rm=C(cc=>{"use strict";Object.defineProperty(cc,"__esModule",{value:!0});cc.DefaultDefinitionProvider=void 0;var tw=we(),rw=Re(),nw=et(),tm=class{constructor(e){this.nameProvider=e.references.NameProvider,this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}getDefinition(e,t){let n=e.parseResult.value;if(n.$cstNode){let i=n.$cstNode,o=(0,nw.findDeclarationNodeAtOffset)(i,e.textDocument.offsetAt(t.position),this.grammarConfig.nameRegexp);if(o)return this.collectLocationLinks(o,t)}}collectLocationLinks(e,t){var n;let i=this.findLink(e);if(i)return[tw.LocationLink.create(i.targetDocument.textDocument.uri,((n=i.target.element.$cstNode)!==null&&n!==void 0?n:i.target).range,i.target.range,i.source.range)]}findLink(e){let t=this.references.findDeclarationNode(e);if(t?.element){let n=(0,rw.getDocument)(t.element);if(t&&n)return{source:e,target:t,targetDocument:n}}}};cc.DefaultDefinitionProvider=tm});var im=C(Mo=>{"use strict";Object.defineProperty(Mo,"__esModule",{value:!0});Mo.MultilineCommentHoverProvider=Mo.AstNodeHoverProvider=void 0;var sR=et(),lc=class{constructor(e){this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}getHoverContent(e,t){var n,i;let o=(i=(n=e.parseResult)===null||n===void 0?void 0:n.value)===null||i===void 0?void 0:i.$cstNode;if(o){let a=e.textDocument.offsetAt(t.position),s=(0,sR.findDeclarationNodeAtOffset)(o,a,this.grammarConfig.nameRegexp);if(s&&s.offset+s.length>a){let u=this.references.findDeclaration(s);if(u)return this.getAstNodeHoverContent(u)}}}};Mo.AstNodeHoverProvider=lc;var nm=class extends lc{constructor(){super(...arguments),this.commentContentRegex=/\/\*([\s\S]*?)\*\//}getAstNodeHoverContent(e){let t=(0,sR.findCommentNode)(e.$cstNode,this.grammarConfig.multilineCommentRules),n;if(t){let i=this.commentContentRegex.exec(t.text);i&&i[1]&&(n=this.getCommentContent(i[1]))}if(n)return{contents:{kind:"markdown",value:n}}}getCommentContent(e){return e.split(`
3590
+ `).map(n=>(n=n.trim(),n.startsWith("*")&&(n=n.substring(1).trim()),n)).join(" ").trim()}};Mo.MultilineCommentHoverProvider=nm});var uR=C(dc=>{"use strict";Object.defineProperty(dc,"__esModule",{value:!0});dc.AbstractGoToImplementationProvider=void 0;var iw=we(),ow=et(),om=class{constructor(e){this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}getImplementation(e,t,n=iw.CancellationToken.None){let i=e.parseResult.value;if(i.$cstNode){let o=(0,ow.findDeclarationNodeAtOffset)(i.$cstNode,e.textDocument.offsetAt(t.position),this.grammarConfig.nameRegexp);if(o){let a=this.references.findDeclaration(o);if(a)return this.collectGoToImplementationLocationLinks(a,n)}}}};dc.AbstractGoToImplementationProvider=om});var Gi=C(Qr=>{"use strict";Object.defineProperty(Qr,"__esModule",{value:!0});Qr.DefaultLangiumDocuments=Qr.DefaultLangiumDocumentFactory=Qr.DefaultTextDocumentFactory=Qr.DocumentState=void 0;var cR=gu(),aw=vn(),sw=Ct(),cm;(function(r){r[r.Changed=0]="Changed",r[r.Parsed=1]="Parsed",r[r.IndexedContent=2]="IndexedContent",r[r.ComputedScopes=3]="ComputedScopes",r[r.Linked=4]="Linked",r[r.IndexedReferences=5]="IndexedReferences",r[r.Validated=6]="Validated"})(cm=Qr.DocumentState||(Qr.DocumentState={}));var am=class{constructor(e){this.serviceRegistry=e.ServiceRegistry,this.fileSystemProvider=e.workspace.FileSystemProvider}fromUri(e){let t=this.getContent(e),n=this.serviceRegistry.getServices(e);return cR.TextDocument.create(e.toString(),n.LanguageMetaData.languageId,0,t)}getContent(e){return this.fileSystemProvider.readFileSync(e)}};Qr.DefaultTextDocumentFactory=am;var sm=class{constructor(e){this.serviceRegistry=e.ServiceRegistry}fromTextDocument(e,t){return this.create(e,void 0,void 0,t)}fromString(e,t){return this.create(void 0,e,void 0,t)}fromModel(e,t){return this.create(void 0,void 0,e,t)}create(e,t,n,i){i===void 0&&(i=aw.URI.parse(e.uri));let o=this.serviceRegistry.getServices(i),a;return n===void 0?a=o.parser.LangiumParser.parse(t??e.getText()):a={value:n,parserErrors:[],lexerErrors:[]},this.createLangiumDocument(a,i,e??{$template:!0,languageId:o.LanguageMetaData.languageId,uri:i,text:t})}createLangiumDocument(e,t,n){let i,o=this,a={parseResult:e,uri:t,state:cm.Parsed,references:[],get textDocument(){return i||(i=n.$template?o.createTextDocument(n):n),i}};return e.value.$document=a,a}createTextDocument(e){var t;return cR.TextDocument.create(e.uri.toString(),e.languageId,0,(t=e.text)!==null&&t!==void 0?t:"")}};Qr.DefaultLangiumDocumentFactory=sm;var um=class{constructor(e){this.documentMap=new Map,this.textDocuments=e.workspace.TextDocuments,this.fileSystemProvider=e.workspace.FileSystemProvider,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory}get all(){return(0,sw.stream)(this.documentMap.values())}addDocument(e){let t=e.uri.toString();if(this.documentMap.has(t))throw new Error(`A document with the URI '${t}' is already present.`);this.documentMap.set(t,e)}getOrCreateDocument(e){let t=e.toString(),n=this.documentMap.get(t);if(n)return n;let i=this.textDocuments.get(t);return i?n=this.langiumDocumentFactory.fromTextDocument(i,e):n=this.langiumDocumentFactory.fromString(this.getContent(e),e),this.documentMap.set(t,n),n}getContent(e){return this.fileSystemProvider.readFileSync(e)}hasDocument(e){return this.documentMap.has(e.toString())}invalidateDocument(e){let t=e.toString(),n=this.documentMap.get(t);n&&(n.state=cm.Changed,this.documentMap.delete(t))}};Qr.DefaultLangiumDocuments=um});var dm=C(Lo=>{"use strict";Object.defineProperty(Lo,"__esModule",{value:!0});Lo.mergeSignatureHelpOptions=Lo.AbstractSignatureHelpProvider=void 0;var uw=we(),cw=et(),lm=class{provideSignatureHelp(e,t,n=uw.CancellationToken.None){let o=e.parseResult.value.$cstNode;if(o){let a=(0,cw.findLeafNodeAtOffset)(o,e.textDocument.offsetAt(t.position));if(a)return this.getSignatureFromElement(a.element,n)}}get signatureHelpOptions(){return{triggerCharacters:["("],retriggerCharacters:[","]}}};Lo.AbstractSignatureHelpProvider=lm;function lw(r){let e=[],t=[];r.forEach(i=>{i?.triggerCharacters&&e.push(...i.triggerCharacters),i?.retriggerCharacters&&t.push(...i.retriggerCharacters)});let n={triggerCharacters:e.length>0?Array.from(new Set(e)).sort():void 0,retriggerCharacters:t.length>0?Array.from(new Set(t)).sort():void 0};return n.triggerCharacters?n:void 0}Lo.mergeSignatureHelpOptions=lw});var mm=C(X=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});X.createRequestHandler=X.createServerRequestHandler=X.createCallHierarchyRequestHandler=X.addCallHierarchyHandler=X.addSignatureHelpHandler=X.addDocumentLinkHandler=X.addExecuteCommandHandler=X.addConfigurationChangeHandler=X.addSemanticTokenHandler=X.addRenameHandler=X.addFormattingHandler=X.addFoldingRangeHandler=X.addHoverHandler=X.addDocumentHighlightsHandler=X.addGoToImplementationHandler=X.addGoToTypeDefinitionHandler=X.addGotoDefinitionHandler=X.addDocumentSymbolHandler=X.addCodeActionHandler=X.addFindReferencesHandler=X.addCompletionHandler=X.addDiagnosticsHandler=X.addDocumentsHandler=X.startLanguageServer=X.DefaultLanguageServer=void 0;var lr=we(),Fo=vn(),lR=xa(),dw=Yr(),fw=Gi(),pw=Zu(),mw=dm(),fm=class{constructor(e){this.onInitializeEmitter=new lr.Emitter,this.onInitializedEmitter=new lr.Emitter,this.services=e}get onInitialize(){return this.onInitializeEmitter.event}get onInitialized(){return this.onInitializedEmitter.event}async initialize(e){return this.eagerLoadServices(),this.onInitializeEmitter.fire(e),this.onInitializeEmitter.dispose(),this.buildInitializeResult(e)}eagerLoadServices(){(0,lR.eagerLoad)(this.services),this.services.ServiceRegistry.all.forEach(e=>(0,lR.eagerLoad)(e))}hasService(e){return this.services.ServiceRegistry.all.some(t=>e(t)!==void 0)}buildInitializeResult(e){var t;let n=this.services.ServiceRegistry.all,i=this.hasService(G=>G.lsp.Formatter),o=n.map(G=>{var ge;return(ge=G.lsp.Formatter)===null||ge===void 0?void 0:ge.formatOnTypeOptions}).find(G=>!!G),a=this.hasService(G=>G.lsp.CodeActionProvider),s=this.hasService(G=>G.lsp.SemanticTokenProvider),u=(t=this.services.lsp.ExecuteCommandHandler)===null||t===void 0?void 0:t.commands,c=this.services.lsp.DocumentLinkProvider,l=(0,mw.mergeSignatureHelpOptions)(n.map(G=>{var ge;return(ge=G.lsp.SignatureHelp)===null||ge===void 0?void 0:ge.signatureHelpOptions})),d=this.hasService(G=>G.lsp.TypeProvider),g=this.hasService(G=>G.lsp.ImplementationProvider),y=this.hasService(G=>G.lsp.CompletionProvider),p=this.hasService(G=>G.lsp.ReferencesProvider),A=this.hasService(G=>G.lsp.DocumentSymbolProvider),x=this.hasService(G=>G.lsp.DefinitionProvider),k=this.hasService(G=>G.lsp.DocumentHighlightProvider),_=this.hasService(G=>G.lsp.FoldingRangeProvider),R=this.hasService(G=>G.lsp.HoverProvider),D=this.hasService(G=>G.lsp.RenameProvider),B=this.hasService(G=>G.lsp.CallHierarchyProvider);return{capabilities:{workspace:{workspaceFolders:{supported:!0}},executeCommandProvider:u&&{commands:u},textDocumentSync:lr.TextDocumentSyncKind.Incremental,completionProvider:y?{}:void 0,referencesProvider:p,documentSymbolProvider:A,definitionProvider:x,typeDefinitionProvider:d,documentHighlightProvider:k,codeActionProvider:a,documentFormattingProvider:i,documentRangeFormattingProvider:i,documentOnTypeFormattingProvider:o,foldingRangeProvider:_,hoverProvider:R,renameProvider:D?{prepareProvider:!0}:void 0,semanticTokensProvider:s?pw.DefaultSemanticTokenOptions:void 0,signatureHelpProvider:l,implementationProvider:g,callHierarchyProvider:B?{}:void 0,documentLinkProvider:c?{resolveProvider:!!c.resolveDocumentLink}:void 0}}}async initialized(e){this.onInitializedEmitter.fire(e),this.onInitializedEmitter.dispose()}};X.DefaultLanguageServer=fm;function hw(r){let e=r.lsp.Connection;if(!e)throw new Error("Starting a language server requires the languageServer.Connection service to be set.");dR(e,r),fR(e,r),pR(e,r),mR(e,r),yR(e,r),gR(e,r),vR(e,r),TR(e,r),RR(e,r),AR(e,r),bR(e,r),hR(e,r),ER(e,r),_R(e,r),CR(e,r),kR(e,r),SR(e,r),NR(e,r),xR(e,r),PR(e,r),e.onInitialize(n=>r.lsp.LanguageServer.initialize(n)),e.onInitialized(n=>r.lsp.LanguageServer.initialized(n)),r.workspace.TextDocuments.listen(e),e.listen()}X.startLanguageServer=hw;function dR(r,e){let t=e.workspace.DocumentBuilder,n=e.workspace.MutexLock;function i(a,s){n.lock(u=>t.update(a,s,u))}e.workspace.TextDocuments.onDidChangeContent(a=>{i([Fo.URI.parse(a.document.uri)],[])}),r.onDidChangeWatchedFiles(a=>{let s=a.changes.filter(c=>c.type!==lr.FileChangeType.Deleted).map(c=>Fo.URI.parse(c.uri)),u=a.changes.filter(c=>c.type===lr.FileChangeType.Deleted).map(c=>Fo.URI.parse(c.uri));i(s,u)})}X.addDocumentsHandler=dR;function fR(r,e){e.workspace.DocumentBuilder.onBuildPhase(fw.DocumentState.Validated,async(n,i)=>{for(let o of n)if(o.diagnostics&&r.sendDiagnostics({uri:o.uri.toString(),diagnostics:o.diagnostics}),i.isCancellationRequested)return})}X.addDiagnosticsHandler=fR;function pR(r,e){r.onCompletion(Xt((t,n,i,o)=>{var a;return(a=t.lsp.CompletionProvider)===null||a===void 0?void 0:a.getCompletion(n,i,o)},e))}X.addCompletionHandler=pR;function mR(r,e){r.onReferences(Xt((t,n,i,o)=>{var a;return(a=t.lsp.ReferencesProvider)===null||a===void 0?void 0:a.findReferences(n,i,o)},e))}X.addFindReferencesHandler=mR;function hR(r,e){r.onCodeAction(Xt((t,n,i,o)=>{var a;return(a=t.lsp.CodeActionProvider)===null||a===void 0?void 0:a.getCodeActions(n,i,o)},e))}X.addCodeActionHandler=hR;function yR(r,e){r.onDocumentSymbol(Xt((t,n,i,o)=>{var a;return(a=t.lsp.DocumentSymbolProvider)===null||a===void 0?void 0:a.getSymbols(n,i,o)},e))}X.addDocumentSymbolHandler=yR;function gR(r,e){r.onDefinition(Xt((t,n,i,o)=>{var a;return(a=t.lsp.DefinitionProvider)===null||a===void 0?void 0:a.getDefinition(n,i,o)},e))}X.addGotoDefinitionHandler=gR;function vR(r,e){r.onTypeDefinition(Xt((t,n,i,o)=>{var a;return(a=t.lsp.TypeProvider)===null||a===void 0?void 0:a.getTypeDefinition(n,i,o)},e))}X.addGoToTypeDefinitionHandler=vR;function TR(r,e){r.onImplementation(Xt((t,n,i,o)=>{var a;return(a=t.lsp.ImplementationProvider)===null||a===void 0?void 0:a.getImplementation(n,i,o)},e))}X.addGoToImplementationHandler=TR;function RR(r,e){r.onDocumentHighlight(Xt((t,n,i,o)=>{var a;return(a=t.lsp.DocumentHighlightProvider)===null||a===void 0?void 0:a.getDocumentHighlight(n,i,o)},e))}X.addDocumentHighlightsHandler=RR;function _R(r,e){r.onHover(Xt((t,n,i,o)=>{var a;return(a=t.lsp.HoverProvider)===null||a===void 0?void 0:a.getHoverContent(n,i,o)},e))}X.addHoverHandler=_R;function AR(r,e){r.onFoldingRanges(Xt((t,n,i,o)=>{var a;return(a=t.lsp.FoldingRangeProvider)===null||a===void 0?void 0:a.getFoldingRanges(n,i,o)},e))}X.addFoldingRangeHandler=AR;function bR(r,e){r.onDocumentFormatting(Xt((t,n,i,o)=>{var a;return(a=t.lsp.Formatter)===null||a===void 0?void 0:a.formatDocument(n,i,o)},e)),r.onDocumentRangeFormatting(Xt((t,n,i,o)=>{var a;return(a=t.lsp.Formatter)===null||a===void 0?void 0:a.formatDocumentRange(n,i,o)},e)),r.onDocumentOnTypeFormatting(Xt((t,n,i,o)=>{var a;return(a=t.lsp.Formatter)===null||a===void 0?void 0:a.formatDocumentOnType(n,i,o)},e))}X.addFormattingHandler=bR;function ER(r,e){r.onRenameRequest(Xt((t,n,i,o)=>{var a;return(a=t.lsp.RenameProvider)===null||a===void 0?void 0:a.rename(n,i,o)},e)),r.onPrepareRename(Xt((t,n,i,o)=>{var a;return(a=t.lsp.RenameProvider)===null||a===void 0?void 0:a.prepareRename(n,i,o)},e))}X.addRenameHandler=ER;function CR(r,e){let t="No semantic token provider registered";r.languages.semanticTokens.on(Ui((n,i,o,a)=>n.lsp.SemanticTokenProvider?n.lsp.SemanticTokenProvider.semanticHighlight(i,o,a):new lr.ResponseError(0,t),e)),r.languages.semanticTokens.onDelta(Ui((n,i,o,a)=>n.lsp.SemanticTokenProvider?n.lsp.SemanticTokenProvider.semanticHighlightDelta(i,o,a):new lr.ResponseError(0,t),e)),r.languages.semanticTokens.onRange(Ui((n,i,o,a)=>n.lsp.SemanticTokenProvider?n.lsp.SemanticTokenProvider.semanticHighlightRange(i,o,a):new lr.ResponseError(0,t),e))}X.addSemanticTokenHandler=CR;function PR(r,e){r.onDidChangeConfiguration(t=>{t.settings&&e.workspace.ConfigurationProvider.updateConfiguration(t)})}X.addConfigurationChangeHandler=PR;function kR(r,e){let t=e.lsp.ExecuteCommandHandler;t&&r.onExecuteCommand(async(n,i)=>{var o;try{return await t.executeCommand(n.command,(o=n.arguments)!==null&&o!==void 0?o:[],i)}catch(a){return Ha(a)}})}X.addExecuteCommandHandler=kR;function xR(r,e){var t;let n=e.lsp.DocumentLinkProvider;if(n){r.onDocumentLinks(Ui((o,a,s,u)=>n.getDocumentLinks(a,s,u),e));let i=(t=n.resolveDocumentLink)===null||t===void 0?void 0:t.bind(n);i&&r.onDocumentLinkResolve(async(o,a)=>{try{return await i(o,a)}catch(s){return Ha(s)}})}}X.addDocumentLinkHandler=xR;function SR(r,e){r.onSignatureHelp(Ui((t,n,i,o)=>{var a;return(a=t.lsp.SignatureHelp)===null||a===void 0?void 0:a.provideSignatureHelp(n,i,o)},e))}X.addSignatureHelpHandler=SR;function NR(r,e){let t="No call hierarchy provider registered";r.languages.callHierarchy.onPrepare(Ui((n,i,o,a)=>{var s;return n.lsp.CallHierarchyProvider?(s=n.lsp.CallHierarchyProvider.prepareCallHierarchy(i,o,a))!==null&&s!==void 0?s:null:new lr.ResponseError(0,t)},e)),r.languages.callHierarchy.onIncomingCalls(pm((n,i,o)=>{var a;return n.lsp.CallHierarchyProvider?(a=n.lsp.CallHierarchyProvider.incomingCalls(i,o))!==null&&a!==void 0?a:null:new lr.ResponseError(0,t)},e)),r.languages.callHierarchy.onOutgoingCalls(pm((n,i,o)=>{var a;return n.lsp.CallHierarchyProvider?(a=n.lsp.CallHierarchyProvider.outgoingCalls(i,o))!==null&&a!==void 0?a:null:new lr.ResponseError(0,t)},e))}X.addCallHierarchyHandler=NR;function pm(r,e){let t=e.ServiceRegistry;return async(n,i)=>{let o=Fo.URI.parse(n.item.uri),a=t.getServices(o);if(!a)throw console.error(`Could not find service instance for uri: '${o.toString()}'`),new Error;try{return await r(a,n,i)}catch(s){return Ha(s)}}}X.createCallHierarchyRequestHandler=pm;function Ui(r,e){let t=e.workspace.LangiumDocuments,n=e.ServiceRegistry;return async(i,o)=>{let a=Fo.URI.parse(i.textDocument.uri),s=n.getServices(a);if(!s)throw console.error(`Could not find service instance for uri: '${a.toString()}'`),new Error;let u=t.getOrCreateDocument(a);if(!u)throw new Error;try{return await r(s,u,i,o)}catch(c){return Ha(c)}}}X.createServerRequestHandler=Ui;function Xt(r,e){let t=e.workspace.LangiumDocuments,n=e.ServiceRegistry;return async(i,o)=>{let a=Fo.URI.parse(i.textDocument.uri),s=n.getServices(a);if(!s)return console.error(`Could not find service instance for uri: '${a.toString()}'`),null;let u=t.getOrCreateDocument(a);if(!u)return null;try{return await r(s,u,i,o)}catch(c){return Ha(c)}}}X.createRequestHandler=Xt;function Ha(r){if((0,dw.isOperationCancelled)(r))return new lr.ResponseError(lr.LSPErrorCodes.RequestCancelled,"The request has been cancelled.");if(r instanceof lr.ResponseError)return r;throw r}});var ym=C(fc=>{"use strict";Object.defineProperty(fc,"__esModule",{value:!0});fc.DefaultReferencesProvider=void 0;var DR=we(),yw=Re(),gw=et(),hm=class{constructor(e){this.nameProvider=e.references.NameProvider,this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}findReferences(e,t){let n=e.parseResult.value.$cstNode;if(!n)return[];let i=(0,gw.findDeclarationNodeAtOffset)(n,e.textDocument.offsetAt(t.position),this.grammarConfig.nameRegexp);return i?this.getReferences(i,t,e):[]}getReferences(e,t,n){let i=[],o=this.references.findDeclaration(e);if(o){let a={includeDeclaration:t.context.includeDeclaration};this.references.findReferences(o,a).forEach(s=>{(0,yw.isReference)(s)?i.push(DR.Location.create(n.uri.toString(),s.$refNode.range)):i.push(DR.Location.create(s.sourceUri.toString(),s.segment.range))})}return i}};fc.DefaultReferencesProvider=hm});var vm=C(pc=>{"use strict";Object.defineProperty(pc,"__esModule",{value:!0});pc.DefaultRenameProvider=void 0;var vw=we(),Tw=Io(),wR=et(),gm=class{constructor(e){this.references=e.references.References,this.nameProvider=e.references.NameProvider,this.grammarConfig=e.parser.GrammarConfig}async rename(e,t){let n={},i=e.parseResult.value.$cstNode;if(!i)return;let o=e.textDocument.offsetAt(t.position),a=(0,wR.findDeclarationNodeAtOffset)(i,o,this.grammarConfig.nameRegexp);if(!a)return;let s=this.references.findDeclaration(a);if(!s)return;let u={onlyLocal:!1,includeDeclaration:!0};return this.references.findReferences(s,u).forEach(l=>{let d=vw.TextEdit.replace(l.segment.range,t.newName),g=l.sourceUri.toString();n[g]?n[g].push(d):n[g]=[d]}),{changes:n}}prepareRename(e,t){return this.renameNodeRange(e,t.position)}renameNodeRange(e,t){let n=e.parseResult.value.$cstNode,i=e.textDocument.offsetAt(t);if(n&&i){let o=(0,wR.findDeclarationNodeAtOffset)(n,i,this.grammarConfig.nameRegexp);if(!o)return;if(this.references.findDeclaration(o)||this.isNameNode(o))return o.range}}isNameNode(e){return e?.element&&(0,Tw.isNamed)(e.element)&&e===this.nameProvider.getNameNode(e.element)}};pc.DefaultRenameProvider=gm});var IR=C(mc=>{"use strict";Object.defineProperty(mc,"__esModule",{value:!0});mc.AbstractTypeDefinitionProvider=void 0;var Rw=we(),_w=et(),Tm=class{constructor(e){this.references=e.references.References}getTypeDefinition(e,t,n=Rw.CancellationToken.None){let i=e.parseResult.value;if(i.$cstNode){let o=(0,_w.findDeclarationNodeAtOffset)(i.$cstNode,e.textDocument.offsetAt(t.position));if(o){let a=this.references.findDeclaration(o);if(a)return this.collectGoToTypeLocationLinks(a,n)}}}};mc.AbstractTypeDefinitionProvider=Tm});var Rm=C(tt=>{"use strict";var Aw=tt&&tt.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),Dt=tt&&tt.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Aw(e,r,t)};Object.defineProperty(tt,"__esModule",{value:!0});Dt(Yp(),tt);Dt(Bp(),tt);Dt(nR(),tt);Dt(Jp(),tt);Dt(oR(),tt);Dt(Qp(),tt);Dt(aR(),tt);Dt(Bu(),tt);Dt(rm(),tt);Dt(im(),tt);Dt($p(),tt);Dt(uR(),tt);Dt(mm(),tt);Dt(ym(),tt);Dt(vm(),tt);Dt(Zu(),tt);Dt(dm(),tt);Dt(IR(),tt)});var OR=C(hc=>{"use strict";Object.defineProperty(hc,"__esModule",{value:!0});hc.LangiumGrammarDefinitionProvider=void 0;var _m=we(),bw=Rm(),Ew=Re(),Cw=Pt(),Pw=ze(),kw=Lt(),Am=class extends bw.DefaultDefinitionProvider{constructor(e){super(e),this.documents=e.shared.workspace.LangiumDocuments}collectLocationLinks(e,t){var n,i,o,a,s,u;let c="path";if((0,Pw.isGrammarImport)(e.element)&&((n=(0,Cw.findAssignment)(e))===null||n===void 0?void 0:n.feature)===c){let l=(0,kw.resolveImport)(this.documents,e.element);if(l?.$document){let d=(i=this.findTargetObject(l))!==null&&i!==void 0?i:l,g=(a=(o=this.nameProvider.getNameNode(d))===null||o===void 0?void 0:o.range)!==null&&a!==void 0?a:_m.Range.create(0,0,0,0),y=(u=(s=d.$cstNode)===null||s===void 0?void 0:s.range)!==null&&u!==void 0?u:_m.Range.create(0,0,0,0);return[_m.LocationLink.create(l.$document.uri.toString(),y,g,e.range)]}return}return super.collectLocationLinks(e,t)}findTargetObject(e){return e.isDeclared?e:(0,Ew.streamContents)(e).head()}};hc.LangiumGrammarDefinitionProvider=Am});var MR=C(yc=>{"use strict";Object.defineProperty(yc,"__esModule",{value:!0});yc.AbstractCallHierarchyProvider=void 0;var xw=we(),$R=vn(),bm=et(),Em=class{constructor(e){this.grammarConfig=e.parser.GrammarConfig,this.nameProvider=e.references.NameProvider,this.documents=e.shared.workspace.LangiumDocuments,this.references=e.references.References}prepareCallHierarchy(e,t){let n=e.parseResult.value,i=(0,bm.findDeclarationNodeAtOffset)(n.$cstNode,e.textDocument.offsetAt(t.position),this.grammarConfig.nameRegexp);if(!i)return;let o=this.references.findDeclarationNode(i);if(!!o)return this.getCallHierarchyItems(o.element,e)}getCallHierarchyItems(e,t){let n=this.nameProvider.getNameNode(e),i=this.nameProvider.getName(e);if(!(!n||!e.$cstNode||i===void 0))return[Object.assign({kind:xw.SymbolKind.Method,name:i,range:e.$cstNode.range,selectionRange:n.range,uri:t.uri.toString()},this.getCallHierarchyItem(e))]}getCallHierarchyItem(e){}incomingCalls(e){let t=this.documents.getOrCreateDocument($R.URI.parse(e.item.uri)),n=t.parseResult.value,i=(0,bm.findDeclarationNodeAtOffset)(n.$cstNode,t.textDocument.offsetAt(e.item.range.start),this.grammarConfig.nameRegexp);if(!i)return;let o=this.references.findReferences(i.element,{includeDeclaration:!1,onlyLocal:!1});return this.getIncomingCalls(i.element,o)}outgoingCalls(e){let t=this.documents.getOrCreateDocument($R.URI.parse(e.item.uri)),n=t.parseResult.value,i=(0,bm.findDeclarationNodeAtOffset)(n.$cstNode,t.textDocument.offsetAt(e.item.range.start),this.grammarConfig.nameRegexp);if(!!i)return this.getOutgoingCalls(i.element)}};yc.AbstractCallHierarchyProvider=Em});var FR=C(vc=>{"use strict";Object.defineProperty(vc,"__esModule",{value:!0});vc.LangiumGrammarCallHierarchyProvider=void 0;var LR=we(),Sw=MR(),Cm=Re(),Nw=et(),gc=ze(),Pm=class extends Sw.AbstractCallHierarchyProvider{getIncomingCalls(e,t){if(!(0,gc.isParserRule)(e))return;let n=new Map;if(t.forEach(i=>{let a=this.documents.getOrCreateDocument(i.sourceUri).parseResult.value;if(!a.$cstNode)return;let s=(0,Nw.findLeafNodeAtOffset)(a.$cstNode,i.segment.offset);if(!s)return;let u=(0,Cm.getContainerOfType)(s.element,gc.isParserRule);if(!u||!u.$cstNode)return;let c=this.nameProvider.getNameNode(u);if(!c)return;let l=i.sourceUri.toString(),d=l+"@"+c.text;n.has(d)?n.set(d,{parserRule:u.$cstNode,nameNode:c,targetNodes:[...n.get(d).targetNodes,s],docUri:l}):n.set(d,{parserRule:u.$cstNode,nameNode:c,targetNodes:[s],docUri:l})}),n.size!==0)return Array.from(n.values()).map(i=>({from:{kind:LR.SymbolKind.Method,name:i.nameNode.text,range:i.parserRule.range,selectionRange:i.nameNode.range,uri:i.docUri},fromRanges:i.targetNodes.map(o=>o.range)}))}getOutgoingCalls(e){if(!(0,gc.isParserRule)(e))return;let t=(0,Cm.streamAllContents)(e).filter(gc.isRuleCall).toArray(),n=new Map;if(t.forEach(i=>{var o;let a=i.$cstNode;if(!a)return;let s=(o=i.rule.ref)===null||o===void 0?void 0:o.$cstNode;if(!s)return;let u=this.nameProvider.getNameNode(s.element);if(!u)return;let c=(0,Cm.getDocument)(s.element).uri.toString(),l=c+"@"+u.text;n.has(l)?n.set(l,{refCstNode:s,to:u,from:[...n.get(l).from,a.range],docUri:c}):n.set(l,{refCstNode:s,to:u,from:[a.range],docUri:c})}),n.size!==0)return Array.from(n.values()).map(i=>({to:{kind:LR.SymbolKind.Method,name:i.to.text,range:i.refCstNode.range,selectionRange:i.to.range,uri:i.docUri},fromRanges:i.from}))}};vc.LangiumGrammarCallHierarchyProvider=Pm});var Tc=C(Hi=>{"use strict";Object.defineProperty(Hi,"__esModule",{value:!0});Hi.createLangiumGrammarServices=Hi.LangiumGrammarModule=void 0;var qR=Rc(),jR=xa(),GR=Ov(),UR=dT(),HR=Pp(),Dw=MT(),ww=LT(),Iw=qT(),Ow=jT(),$w=UT(),Mw=YT(),Lw=OR(),Fw=FR();Hi.LangiumGrammarModule={validation:{ValidationRegistry:r=>new HR.LangiumGrammarValidationRegistry(r),LangiumGrammarValidator:r=>new HR.LangiumGrammarValidator(r)},lsp:{FoldingRangeProvider:r=>new ww.LangiumGrammarFoldingRangeProvider(r),CodeActionProvider:()=>new Dw.LangiumGrammarCodeActionProvider,SemanticTokenProvider:r=>new Ow.LangiumGrammarSemanticTokenProvider(r),Formatter:()=>new Iw.LangiumGrammarFormatter,DefinitionProvider:r=>new Lw.LangiumGrammarDefinitionProvider(r),CallHierarchyProvider:r=>new Fw.LangiumGrammarCallHierarchyProvider(r)},references:{ScopeComputation:r=>new UR.LangiumGrammarScopeComputation(r),ScopeProvider:r=>new UR.LangiumGrammarScopeProvider(r),References:r=>new Mw.LangiumGrammarReferences(r),NameProvider:()=>new $w.LangiumGrammarNameProvider}};function qw(r,e){let t=(0,jR.inject)((0,qR.createDefaultSharedModule)(r),GR.LangiumGrammarGeneratedSharedModule,e),n=(0,jR.inject)((0,qR.createDefaultModule)({shared:t}),GR.LangiumGrammarGeneratedModule,Hi.LangiumGrammarModule);return t.ServiceRegistry.register(n),{shared:t,grammar:n}}Hi.createLangiumGrammarServices=qw});var KR=C(_c=>{"use strict";Object.defineProperty(_c,"__esModule",{value:!0});_c.collectAst=void 0;var WR=Ct(),jw=gp(),Gw=fp(),Uw=mi();function Hw(r,e){let t=(0,Uw.collectAllAstResources)(e,r),n=(0,jw.collectInferredTypes)(Array.from(t.parserRules),Array.from(t.datatypeRules)),i=(0,Gw.collectDeclaredTypes)(Array.from(t.interfaces),Array.from(t.types),n),o=n.interfaces.concat(i.interfaces),a=n.unions.concat(i.unions);return Ww(o),a.sort((s,u)=>s.name.localeCompare(u.name)),{interfaces:(0,WR.stream)(o).distinct(s=>s.name).toArray(),unions:(0,WR.stream)(a).distinct(s=>s.name).toArray()}}_c.collectAst=Hw;function Ww(r){let e=r.sort((i,o)=>i.name.localeCompare(o.name)).map(i=>({value:i,nodes:[]}));for(let i of e)i.nodes=e.filter(o=>i.value.superTypes.has(o.value.name));let t=[],n=e.filter(i=>i.nodes.length===0);for(;n.length>0;){let i=n.shift();t.includes(i)||(t.push(i),e.filter(o=>o.nodes.includes(i)).forEach(o=>n.push(o)))}return t.map(i=>i.value)}});var xm=C(Ac=>{"use strict";Object.defineProperty(Ac,"__esModule",{value:!0});Ac.interpretAstReflection=void 0;var Kw=Re(),Bw=kr(),zw=Au(),Vw=ze(),Yw=Tc(),Xw=KR(),Jw=mi(),km;function Zw(r,e){let t;(0,Vw.isGrammar)(r)?(!km&&!e&&(km=(0,Yw.createLangiumGrammarServices)(zw.EmptyFileSystem).shared.workspace.LangiumDocuments),t=(0,Xw.collectAst)(e??km,[r])):t=r;let n=t.interfaces.map(s=>s.name).concat(t.unions.map(s=>s.name)),i=Qw(t),o=eI(t),a=rI(t);return{getAllTypes(){return n},getReferenceType(s){let u=`${s.container.$type}:${s.property}`,c=i.get(u);if(c)return c;throw new Error("Could not find reference type for "+u)},getTypeMetaData(s){var u;return(u=o.get(s))!==null&&u!==void 0?u:{name:s,mandatory:[]}},isInstance(s,u){return(0,Kw.isAstNode)(s)&&this.isSubtype(s.$type,u)},isSubtype(s,u){if(s===u)return!0;let c=a.get(s);for(let l of c)if(this.isSubtype(l,u))return!0;return!1}}}Ac.interpretAstReflection=Zw;function Qw(r){let e=new Map;for(let t of r.interfaces)for(let n of t.properties)for(let i of n.typeAlternatives)i.reference&&e.set(`${t.name}:${n.name}`,i.types[0]);return e}function eI(r){let e=new Map,t=(0,Jw.collectAllProperties)(r.interfaces);for(let n of r.interfaces){let i=t.get(n.name),o=i.filter(s=>s.typeAlternatives.some(u=>u.array)),a=i.filter(s=>s.typeAlternatives.every(u=>!u.array&&u.types.includes("boolean")));(o.length>0||a.length>0)&&e.set(n.name,{name:n.name,mandatory:tI(o,a)})}return e}function tI(r,e){let t=[],n=r.concat(e).sort((i,o)=>i.name.localeCompare(o.name));for(let i of n){let o=r.includes(i)?"array":"boolean";t.push({name:i.name,type:o})}return t}function rI(r){let e=new Bw.MultiMap;for(let t of r.interfaces)e.addAll(t.name,t.superTypes);for(let t of r.unions)e.addAll(t.name,t.superTypes);return e}});var Pt=C(he=>{"use strict";var nI=he&&he.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),iI=he&&he.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),oI=he&&he.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&nI(e,r,t);return iI(e,r),e};Object.defineProperty(he,"__esModule",{value:!0});he.createServicesForGrammar=he.loadGrammarFromJson=he.findNameAssignment=he.findAssignment=he.findNodesForKeywordInternal=he.findNodeForKeyword=he.findNodesForKeyword=he.findNodeForProperty=he.findNodesForProperty=he.isCommentTerminal=he.getCrossReferenceTerminal=he.getAllReachableRules=he.getEntryRule=void 0;var BR=Rc(),zR=xa(),aI=xm(),ar=oI(ze()),Nm=Lt(),VR=Tc(),sI=_o(),Wa=Re(),uI=et(),Sm=Au();function YR(r){return r.rules.find(e=>ar.isParserRule(e)&&e.entry)}he.getEntryRule=YR;function cI(r,e){let t=new Set,n=YR(r);if(!n)return new Set(r.rules);XR(n,t,e);let i=new Set;for(let o of r.rules)(t.has(o.name)||ar.isTerminalRule(o)&&o.hidden)&&i.add(o);return i}he.getAllReachableRules=cI;function XR(r,e,t){e.add(r.name),(0,Wa.streamAllContents)(r).forEach(n=>{if(ar.isRuleCall(n)||t&&ar.isTerminalRuleCall(n)){let i=n.rule.ref;i&&!e.has(i.name)&&XR(i,e,t)}})}function lI(r){if(r.terminal)return r.terminal;if(r.type.ref){let e=JR(r.type.ref);return e?.terminal}}he.getCrossReferenceTerminal=lI;function dI(r){return r.hidden&&!" ".match((0,Nm.terminalRegex)(r))}he.isCommentTerminal=dI;function fI(r,e){return!r||!e?[]:Dm(r,e,r.element,!0)}he.findNodesForProperty=fI;function pI(r,e,t){if(!r||!e)return;let n=Dm(r,e,r.element,!0);if(n.length!==0)return t!==void 0?t=Math.max(0,Math.min(t,n.length-1)):t=0,n[t]}he.findNodeForProperty=pI;function Dm(r,e,t,n){if(!n){let i=(0,Wa.getContainerOfType)(r.feature,ar.isAssignment);if(i&&i.feature===e)return[r]}return(0,sI.isCompositeCstNode)(r)&&r.element===t?r.children.flatMap(i=>Dm(i,e,t,!1)):[]}function mI(r,e){return r?wm(r,e,r?.element):[]}he.findNodesForKeyword=mI;function hI(r,e,t){if(!r)return;let n=wm(r,e,r?.element);if(n.length!==0)return t!==void 0?t=Math.max(0,Math.min(t,n.length-1)):t=0,n[t]}he.findNodeForKeyword=hI;function wm(r,e,t){if(r.element!==t)return[];if(ar.isKeyword(r.feature)&&r.feature.value===e)return[r];let n=(0,uI.streamCst)(r).iterator(),i,o=[];do if(i=n.next(),!i.done){let a=i.value;a.element===t?ar.isKeyword(a.feature)&&a.feature.value===e&&o.push(a):n.prune()}while(!i.done);return o}he.findNodesForKeywordInternal=wm;function yI(r){let e=r;do{let t=(0,Wa.getContainerOfType)(e.feature,ar.isAssignment);if(t)return t;e=e.parent}while(e)}he.findAssignment=yI;function JR(r){return ar.isInferredType(r)&&(r=r.$container),ZR(r,new Map)}he.findNameAssignment=JR;function ZR(r,e){var t;function n(i,o){let a;return(0,Wa.getContainerOfType)(i,ar.isAssignment)||(a=ZR(o,e)),e.set(r,a),a}if(e.has(r))return e.get(r);e.set(r,void 0);for(let i of(0,Wa.streamAllContents)(r)){if(ar.isAssignment(i)&&i.feature.toLowerCase()==="name")return e.set(r,i),i;if(ar.isRuleCall(i)&&ar.isParserRule(i.rule.ref))return n(i,i.rule.ref);if(ar.isAtomType(i)&&((t=i?.refType)===null||t===void 0?void 0:t.ref))return n(i,i.refType.ref)}}function gI(r){let e=(0,VR.createLangiumGrammarServices)(Sm.EmptyFileSystem).grammar,t=e.serializer.JsonSerializer.deserialize(r);if(!ar.isGrammar(t))throw new Error("Could not load grammar from specified json input.");return(0,Nm.prepareGrammar)(e,t)}he.loadGrammarFromJson=gI;function vI(r){var e,t,n,i,o,a;let s=(e=r.grammarServices)!==null&&e!==void 0?e:(0,VR.createLangiumGrammarServices)(Sm.EmptyFileSystem).grammar,u=typeof r.grammar=="string"?s.parser.LangiumParser.parse(r.grammar).value:r.grammar;(0,Nm.prepareGrammar)(s,u);let c=(t=r.parserConfig)!==null&&t!==void 0?t:{skipValidations:!1},l=(n=r.languageMetaData)!==null&&n!==void 0?n:{caseInsensitive:!1,fileExtensions:[`.${(o=(i=u.name)===null||i===void 0?void 0:i.toLowerCase())!==null&&o!==void 0?o:"unknown"}`],languageId:(a=u.name)!==null&&a!==void 0?a:"UNKNOWN"},d={AstReflection:()=>(0,aI.interpretAstReflection)(u)},g={Grammar:()=>u,LanguageMetaData:()=>l,parser:{ParserConfig:()=>c}},y=(0,zR.inject)((0,BR.createDefaultSharedModule)(Sm.EmptyFileSystem),d,r.sharedModule),p=(0,zR.inject)((0,BR.createDefaultModule)({shared:y}),g,r.module);return y.ServiceRegistry.register(p),p}he.createServicesForGrammar=vI});var QR=C(bc=>{"use strict";Object.defineProperty(bc,"__esModule",{value:!0});bc.createGrammarConfig=void 0;var TI=et(),RI=Pt(),_I=So(),AI=ze(),bI=Lt();function EI(r){let e=[],t=r.Grammar;for(let n of t.rules)(0,AI.isTerminalRule)(n)&&(0,RI.isCommentTerminal)(n)&&(0,_I.isMultilineComment)((0,bI.terminalRegex)(n))&&e.push(n.name);return{multilineCommentRules:e,nameRegexp:TI.DefaultNameRegexp}}bc.createGrammarConfig=EI});var Im=C(Ec=>{"use strict";Object.defineProperty(Ec,"__esModule",{value:!0});Ec.VERSION=void 0;Ec.VERSION="9.1.0"});var _e=C((exports,module)=>{"use strict";var __spreadArray=exports&&exports.__spreadArray||function(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,o;n<i;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return r.concat(o||Array.prototype.slice.call(e))};Object.defineProperty(exports,"__esModule",{value:!0});exports.toFastProperties=exports.timer=exports.peek=exports.isES2015MapSupported=exports.PRINT_WARNING=exports.PRINT_ERROR=exports.packArray=exports.IDENTITY=exports.NOOP=exports.merge=exports.groupBy=exports.defaults=exports.assignNoOverwrite=exports.assign=exports.zipObject=exports.sortBy=exports.indexOf=exports.some=exports.difference=exports.every=exports.isObject=exports.isRegExp=exports.isArray=exports.partial=exports.uniq=exports.compact=exports.reduce=exports.findAll=exports.find=exports.cloneObj=exports.cloneArr=exports.contains=exports.has=exports.pick=exports.reject=exports.filter=exports.dropRight=exports.drop=exports.isFunction=exports.isUndefined=exports.isString=exports.forEach=exports.last=exports.first=exports.flatten=exports.map=exports.mapValues=exports.values=exports.keys=exports.isEmpty=void 0;exports.upperFirst=void 0;function isEmpty(r){return r&&r.length===0}exports.isEmpty=isEmpty;function keys(r){return r==null?[]:Object.keys(r)}exports.keys=keys;function values(r){for(var e=[],t=Object.keys(r),n=0;n<t.length;n++)e.push(r[t[n]]);return e}exports.values=values;function mapValues(r,e){for(var t=[],n=keys(r),i=0;i<n.length;i++){var o=n[i];t.push(e.call(null,r[o],o))}return t}exports.mapValues=mapValues;function map(r,e){for(var t=[],n=0;n<r.length;n++)t.push(e.call(null,r[n],n));return t}exports.map=map;function flatten(r){for(var e=[],t=0;t<r.length;t++){var n=r[t];Array.isArray(n)?e=e.concat(flatten(n)):e.push(n)}return e}exports.flatten=flatten;function first(r){return isEmpty(r)?void 0:r[0]}exports.first=first;function last(r){var e=r&&r.length;return e?r[e-1]:void 0}exports.last=last;function forEach(r,e){if(Array.isArray(r))for(var t=0;t<r.length;t++)e.call(null,r[t],t);else if(isObject(r))for(var n=keys(r),t=0;t<n.length;t++){var i=n[t],o=r[i];e.call(null,o,i)}else throw Error("non exhaustive match")}exports.forEach=forEach;function isString(r){return typeof r=="string"}exports.isString=isString;function isUndefined(r){return r===void 0}exports.isUndefined=isUndefined;function isFunction(r){return r instanceof Function}exports.isFunction=isFunction;function drop(r,e){return e===void 0&&(e=1),r.slice(e,r.length)}exports.drop=drop;function dropRight(r,e){return e===void 0&&(e=1),r.slice(0,r.length-e)}exports.dropRight=dropRight;function filter(r,e){var t=[];if(Array.isArray(r))for(var n=0;n<r.length;n++){var i=r[n];e.call(null,i)&&t.push(i)}return t}exports.filter=filter;function reject(r,e){return filter(r,function(t){return!e(t)})}exports.reject=reject;function pick(r,e){for(var t=Object.keys(r),n={},i=0;i<t.length;i++){var o=t[i],a=r[o];e(a)&&(n[o]=a)}return n}exports.pick=pick;function has(r,e){return isObject(r)?r.hasOwnProperty(e):!1}exports.has=has;function contains(r,e){return find(r,function(t){return t===e})!==void 0}exports.contains=contains;function cloneArr(r){for(var e=[],t=0;t<r.length;t++)e.push(r[t]);return e}exports.cloneArr=cloneArr;function cloneObj(r){var e={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e}exports.cloneObj=cloneObj;function find(r,e){for(var t=0;t<r.length;t++){var n=r[t];if(e.call(null,n))return n}}exports.find=find;function findAll(r,e){for(var t=[],n=0;n<r.length;n++){var i=r[n];e.call(null,i)&&t.push(i)}return t}exports.findAll=findAll;function reduce(r,e,t){for(var n=Array.isArray(r),i=n?r:values(r),o=n?[]:keys(r),a=t,s=0;s<i.length;s++)a=e.call(null,a,i[s],n?s:o[s]);return a}exports.reduce=reduce;function compact(r){return reject(r,function(e){return e==null})}exports.compact=compact;function uniq(r,e){e===void 0&&(e=function(n){return n});var t=[];return reduce(r,function(n,i){var o=e(i);return contains(t,o)?n:(t.push(o),n.concat(i))},[])}exports.uniq=uniq;function partial(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];var n=[null],i=n.concat(e);return Function.bind.apply(r,i)}exports.partial=partial;function isArray(r){return Array.isArray(r)}exports.isArray=isArray;function isRegExp(r){return r instanceof RegExp}exports.isRegExp=isRegExp;function isObject(r){return r instanceof Object}exports.isObject=isObject;function every(r,e){for(var t=0;t<r.length;t++)if(!e(r[t],t))return!1;return!0}exports.every=every;function difference(r,e){return reject(r,function(t){return contains(e,t)})}exports.difference=difference;function some(r,e){for(var t=0;t<r.length;t++)if(e(r[t]))return!0;return!1}exports.some=some;function indexOf(r,e){for(var t=0;t<r.length;t++)if(r[t]===e)return t;return-1}exports.indexOf=indexOf;function sortBy(r,e){var t=cloneArr(r);return t.sort(function(n,i){return e(n)-e(i)}),t}exports.sortBy=sortBy;function zipObject(r,e){if(r.length!==e.length)throw Error("can't zipObject with different number of keys and values!");for(var t={},n=0;n<r.length;n++)t[r[n]]=e[n];return t}exports.zipObject=zipObject;function assign(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];for(var n=0;n<e.length;n++)for(var i=e[n],o=keys(i),a=0;a<o.length;a++){var s=o[a];r[s]=i[s]}return r}exports.assign=assign;function assignNoOverwrite(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];for(var n=0;n<e.length;n++)for(var i=e[n],o=keys(i),a=0;a<o.length;a++){var s=o[a];has(r,s)||(r[s]=i[s])}return r}exports.assignNoOverwrite=assignNoOverwrite;function defaults(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return assignNoOverwrite.apply(void 0,__spreadArray([{}],r,!1))}exports.defaults=defaults;function groupBy(r,e){var t={};return forEach(r,function(n){var i=e(n),o=t[i];o?o.push(n):t[i]=[n]}),t}exports.groupBy=groupBy;function merge(r,e){for(var t=cloneObj(r),n=keys(e),i=0;i<n.length;i++){var o=n[i],a=e[o];t[o]=a}return t}exports.merge=merge;function NOOP(){}exports.NOOP=NOOP;function IDENTITY(r){return r}exports.IDENTITY=IDENTITY;function packArray(r){for(var e=[],t=0;t<r.length;t++){var n=r[t];e.push(n!==void 0?n:void 0)}return e}exports.packArray=packArray;function PRINT_ERROR(r){console&&console.error&&console.error("Error: "+r)}exports.PRINT_ERROR=PRINT_ERROR;function PRINT_WARNING(r){console&&console.warn&&console.warn("Warning: "+r)}exports.PRINT_WARNING=PRINT_WARNING;function isES2015MapSupported(){return typeof Map=="function"}exports.isES2015MapSupported=isES2015MapSupported;function peek(r){return r[r.length-1]}exports.peek=peek;function timer(r){var e=new Date().getTime(),t=r(),n=new Date().getTime(),i=n-e;return{time:i,value:t}}exports.timer=timer;function toFastProperties(toBecomeFast){function FakeConstructor(){}FakeConstructor.prototype=toBecomeFast;var fakeInstance=new FakeConstructor;function fakeAccess(){return typeof fakeInstance.bar}return fakeAccess(),fakeAccess(),toBecomeFast;eval(toBecomeFast)}exports.toFastProperties=toFastProperties;function upperFirst(r){if(!r)return r;var e=getCharacterFromCodePointAt(r,0);return e.toUpperCase()+r.substring(e.length)}exports.upperFirst=upperFirst;var surrogatePairPattern=/[\uD800-\uDBFF][\uDC00-\uDFFF]/;function getCharacterFromCodePointAt(r,e){var t=r.substring(e,e+1);return surrogatePairPattern.test(t)?t:r[e]}});var Pc=C(qo=>{"use strict";Object.defineProperty(qo,"__esModule",{value:!0});qo.clearRegExpParserCache=qo.getRegExpAst=void 0;var CI=wa(),Cc={},PI=new CI.RegExpParser;function kI(r){var e=r.toString();if(Cc.hasOwnProperty(e))return Cc[e];var t=PI.pattern(e);return Cc[e]=t,t}qo.getRegExpAst=kI;function xI(){Cc={}}qo.clearRegExpParserCache=xI});var i_=C(dr=>{"use strict";var SI=dr&&dr.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(dr,"__esModule",{value:!0});dr.canMatchCharCode=dr.firstCharOptimizedIndices=dr.getOptimizedStartCodesIndices=dr.failedOptimizationPrefixMsg=void 0;var t_=wa(),wr=_e(),r_=Pc(),Bn=$m(),n_="Complement Sets are not supported for first char optimization";dr.failedOptimizationPrefixMsg=`Unable to use "first char" lexer optimizations:
3591
+ `;function NI(r,e){e===void 0&&(e=!1);try{var t=(0,r_.getRegExpAst)(r),n=xc(t.value,{},t.flags.ignoreCase);return n}catch(o){if(o.message===n_)e&&(0,wr.PRINT_WARNING)(""+dr.failedOptimizationPrefixMsg+(" Unable to optimize: < "+r.toString()+` >
3592
3592
  `)+` Complement Sets cannot be automatically optimized.
3593
3593
  This will disable the lexer's first char optimizations.
3594
3594
  See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{var i="";e&&(i=`
3595
3595
  This will disable the lexer's first char optimizations.
3596
3596
  See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),(0,wr.PRINT_ERROR)(dr.failedOptimizationPrefixMsg+`
3597
3597
  `+(" Failed parsing: < "+r.toString()+` >
3598
- `)+(" Using the regexp-to-ast library version: "+n_.VERSION+`
3599
- `)+" Please open an issue at: https://github.com/bd82/regexp-to-ast/issues"+i)}}return[]}dr.getOptimizedStartCodesIndices=II;function Sc(r,e,t){switch(r.type){case"Disjunction":for(var n=0;n<r.value.length;n++)Sc(r.value[n],e,t);break;case"Alternative":for(var i=r.value,n=0;n<i.length;n++){var o=i[n];switch(o.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}var a=o;switch(a.type){case"Character":xc(a.value,e,t);break;case"Set":if(a.complement===!0)throw Error(o_);(0,wr.forEach)(a.value,function(c){if(typeof c=="number")xc(c,e,t);else{var l=c;if(t===!0)for(var d=l.from;d<=l.to;d++)xc(d,e,t);else{for(var d=l.from;d<=l.to&&d<zn.minOptimizationVal;d++)xc(d,e,t);if(l.to>=zn.minOptimizationVal)for(var g=l.from>=zn.minOptimizationVal?l.from:zn.minOptimizationVal,y=l.to,p=(0,zn.charCodeToOptimizedIndex)(g),A=(0,zn.charCodeToOptimizedIndex)(y),x=p;x<=A;x++)e[x]=x}}});break;case"Group":Sc(a.value,e,t);break;default:throw Error("Non Exhaustive Match")}var s=a.quantifier!==void 0&&a.quantifier.atLeast===0;if(a.type==="Group"&&Mm(a)===!1||a.type!=="Group"&&s===!1)break}break;default:throw Error("non exhaustive match!")}return(0,wr.values)(e)}dr.firstCharOptimizedIndices=Sc;function xc(r,e,t){var n=(0,zn.charCodeToOptimizedIndex)(r);e[n]=n,t===!0&&OI(r,e)}function OI(r,e){var t=String.fromCharCode(r),n=t.toUpperCase();if(n!==t){var i=(0,zn.charCodeToOptimizedIndex)(n.charCodeAt(0));e[i]=i}else{var o=t.toLowerCase();if(o!==t){var i=(0,zn.charCodeToOptimizedIndex)(o.charCodeAt(0));e[i]=i}}}function r_(r,e){return(0,wr.find)(r.value,function(t){if(typeof t=="number")return(0,wr.contains)(e,t);var n=t;return(0,wr.find)(e,function(i){return n.from<=i&&i<=n.to})!==void 0})}function Mm(r){return r.quantifier&&r.quantifier.atLeast===0?!0:r.value?(0,wr.isArray)(r.value)?(0,wr.every)(r.value,Mm):Mm(r.value):!1}var $I=function(r){wI(e,r);function e(t){var n=r.call(this)||this;return n.targetCharCodes=t,n.found=!1,n}return e.prototype.visitChildren=function(t){if(this.found!==!0){switch(t.type){case"Lookahead":this.visitLookahead(t);return;case"NegativeLookahead":this.visitNegativeLookahead(t);return}r.prototype.visitChildren.call(this,t)}},e.prototype.visitCharacter=function(t){(0,wr.contains)(this.targetCharCodes,t.value)&&(this.found=!0)},e.prototype.visitSet=function(t){t.complement?r_(t,this.targetCharCodes)===void 0&&(this.found=!0):r_(t,this.targetCharCodes)!==void 0&&(this.found=!0)},e}(n_.BaseRegExpVisitor);function MI(r,e){if(e instanceof RegExp){var t=(0,i_.getRegExpAst)(e),n=new $I(r);return n.visit(t),n.found}else return(0,wr.find)(e,function(i){return(0,wr.contains)(r,i.charCodeAt(0))})!==void 0}dr.canMatchCharCode=MI});var Lm=C(W=>{"use strict";var s_=W&&W.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(W,"__esModule",{value:!0});W.charCodeToOptimizedIndex=W.minOptimizationVal=W.buildLineBreakIssueMessage=W.LineTerminatorOptimizedTester=W.isShortPattern=W.isCustomPattern=W.cloneEmptyGroups=W.performWarningRuntimeChecks=W.performRuntimeChecks=W.addStickyFlag=W.addStartOfInput=W.findUnreachablePatterns=W.findModesThatDoNotExist=W.findInvalidGroupType=W.findDuplicatePatterns=W.findUnsupportedFlags=W.findStartOfInputAnchor=W.findEmptyMatchRegExps=W.findEndOfInputAnchor=W.findInvalidPatterns=W.findMissingPatterns=W.validatePatterns=W.analyzeTokenTypes=W.enableSticky=W.disableSticky=W.SUPPORT_STICKY=W.MODES=W.DEFAULT_MODE=void 0;var u_=wa(),Me=Ka(),$=_e(),jo=a_(),c_=kc(),En="PATTERN";W.DEFAULT_MODE="defaultMode";W.MODES="modes";W.SUPPORT_STICKY=typeof new RegExp("(?:)").sticky=="boolean";function LI(){W.SUPPORT_STICKY=!1}W.disableSticky=LI;function FI(){W.SUPPORT_STICKY=!0}W.enableSticky=FI;function qI(r,e){e=(0,$.defaults)(e,{useSticky:W.SUPPORT_STICKY,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
3600
- `],tracer:function(_,R){return R()}});var t=e.tracer;t("initCharCodeToOptimizedIndexMap",function(){YI()});var n;t("Reject Lexer.NA",function(){n=(0,$.reject)(r,function(_){return _[En]===Me.Lexer.NA})});var i=!1,o;t("Transform Patterns",function(){i=!1,o=(0,$.map)(n,function(_){var R=_[En];if((0,$.isRegExp)(R)){var D=R.source;return D.length===1&&D!=="^"&&D!=="$"&&D!=="."&&!R.ignoreCase?D:D.length===2&&D[0]==="\\"&&!(0,$.contains)(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],D[1])?D[1]:e.useSticky?jm(R):qm(R)}else{if((0,$.isFunction)(R))return i=!0,{exec:R};if((0,$.has)(R,"exec"))return i=!0,R;if(typeof R=="string"){if(R.length===1)return R;var B=R.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),V=new RegExp(B);return e.useSticky?jm(V):qm(V)}else throw Error("non exhaustive match")}})});var a,s,u,c,l;t("misc mapping",function(){a=(0,$.map)(n,function(_){return _.tokenTypeIdx}),s=(0,$.map)(n,function(_){var R=_.GROUP;if(R!==Me.Lexer.SKIPPED){if((0,$.isString)(R))return R;if((0,$.isUndefined)(R))return!1;throw Error("non exhaustive match")}}),u=(0,$.map)(n,function(_){var R=_.LONGER_ALT;if(R){var D=(0,$.isArray)(R)?(0,$.map)(R,function(B){return(0,$.indexOf)(n,B)}):[(0,$.indexOf)(n,R)];return D}}),c=(0,$.map)(n,function(_){return _.PUSH_MODE}),l=(0,$.map)(n,function(_){return(0,$.has)(_,"POP_MODE")})});var d;t("Line Terminator Handling",function(){var _=b_(e.lineTerminatorCharacters);d=(0,$.map)(n,function(R){return!1}),e.positionTracking!=="onlyOffset"&&(d=(0,$.map)(n,function(R){if((0,$.has)(R,"LINE_BREAKS"))return R.LINE_BREAKS;if(__(R,_)===!1)return(0,jo.canMatchCharCode)(_,R.PATTERN)}))});var g,y,p,A;t("Misc Mapping #2",function(){g=(0,$.map)(n,Um),y=(0,$.map)(o,R_),p=(0,$.reduce)(n,function(_,R){var D=R.GROUP;return(0,$.isString)(D)&&D!==Me.Lexer.SKIPPED&&(_[D]=[]),_},{}),A=(0,$.map)(o,function(_,R){return{pattern:o[R],longerAlt:u[R],canLineTerminator:d[R],isCustom:g[R],short:y[R],group:s[R],push:c[R],pop:l[R],tokenTypeIdx:a[R],tokenType:n[R]}})});var x=!0,k=[];return e.safeMode||t("First Char Optimization",function(){k=(0,$.reduce)(n,function(_,R,D){if(typeof R.PATTERN=="string"){var B=R.PATTERN.charCodeAt(0),V=Gm(B);Fm(_,V,A[D])}else if((0,$.isArray)(R.START_CHARS_HINT)){var G;(0,$.forEach)(R.START_CHARS_HINT,function(je){var Ze=typeof je=="string"?je.charCodeAt(0):je,Ge=Gm(Ze);G!==Ge&&(G=Ge,Fm(_,Ge,A[D]))})}else if((0,$.isRegExp)(R.PATTERN))if(R.PATTERN.unicode)x=!1,e.ensureOptimizations&&(0,$.PRINT_ERROR)(""+jo.failedOptimizationPrefixMsg+(" Unable to analyze < "+R.PATTERN.toString()+` > pattern.
3598
+ `)+(" Using the regexp-to-ast library version: "+t_.VERSION+`
3599
+ `)+" Please open an issue at: https://github.com/bd82/regexp-to-ast/issues"+i)}}return[]}dr.getOptimizedStartCodesIndices=NI;function xc(r,e,t){switch(r.type){case"Disjunction":for(var n=0;n<r.value.length;n++)xc(r.value[n],e,t);break;case"Alternative":for(var i=r.value,n=0;n<i.length;n++){var o=i[n];switch(o.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}var a=o;switch(a.type){case"Character":kc(a.value,e,t);break;case"Set":if(a.complement===!0)throw Error(n_);(0,wr.forEach)(a.value,function(c){if(typeof c=="number")kc(c,e,t);else{var l=c;if(t===!0)for(var d=l.from;d<=l.to;d++)kc(d,e,t);else{for(var d=l.from;d<=l.to&&d<Bn.minOptimizationVal;d++)kc(d,e,t);if(l.to>=Bn.minOptimizationVal)for(var g=l.from>=Bn.minOptimizationVal?l.from:Bn.minOptimizationVal,y=l.to,p=(0,Bn.charCodeToOptimizedIndex)(g),A=(0,Bn.charCodeToOptimizedIndex)(y),x=p;x<=A;x++)e[x]=x}}});break;case"Group":xc(a.value,e,t);break;default:throw Error("Non Exhaustive Match")}var s=a.quantifier!==void 0&&a.quantifier.atLeast===0;if(a.type==="Group"&&Om(a)===!1||a.type!=="Group"&&s===!1)break}break;default:throw Error("non exhaustive match!")}return(0,wr.values)(e)}dr.firstCharOptimizedIndices=xc;function kc(r,e,t){var n=(0,Bn.charCodeToOptimizedIndex)(r);e[n]=n,t===!0&&DI(r,e)}function DI(r,e){var t=String.fromCharCode(r),n=t.toUpperCase();if(n!==t){var i=(0,Bn.charCodeToOptimizedIndex)(n.charCodeAt(0));e[i]=i}else{var o=t.toLowerCase();if(o!==t){var i=(0,Bn.charCodeToOptimizedIndex)(o.charCodeAt(0));e[i]=i}}}function e_(r,e){return(0,wr.find)(r.value,function(t){if(typeof t=="number")return(0,wr.contains)(e,t);var n=t;return(0,wr.find)(e,function(i){return n.from<=i&&i<=n.to})!==void 0})}function Om(r){return r.quantifier&&r.quantifier.atLeast===0?!0:r.value?(0,wr.isArray)(r.value)?(0,wr.every)(r.value,Om):Om(r.value):!1}var wI=function(r){SI(e,r);function e(t){var n=r.call(this)||this;return n.targetCharCodes=t,n.found=!1,n}return e.prototype.visitChildren=function(t){if(this.found!==!0){switch(t.type){case"Lookahead":this.visitLookahead(t);return;case"NegativeLookahead":this.visitNegativeLookahead(t);return}r.prototype.visitChildren.call(this,t)}},e.prototype.visitCharacter=function(t){(0,wr.contains)(this.targetCharCodes,t.value)&&(this.found=!0)},e.prototype.visitSet=function(t){t.complement?e_(t,this.targetCharCodes)===void 0&&(this.found=!0):e_(t,this.targetCharCodes)!==void 0&&(this.found=!0)},e}(t_.BaseRegExpVisitor);function II(r,e){if(e instanceof RegExp){var t=(0,r_.getRegExpAst)(e),n=new wI(r);return n.visit(t),n.found}else return(0,wr.find)(e,function(i){return(0,wr.contains)(r,i.charCodeAt(0))})!==void 0}dr.canMatchCharCode=II});var $m=C(W=>{"use strict";var o_=W&&W.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(W,"__esModule",{value:!0});W.charCodeToOptimizedIndex=W.minOptimizationVal=W.buildLineBreakIssueMessage=W.LineTerminatorOptimizedTester=W.isShortPattern=W.isCustomPattern=W.cloneEmptyGroups=W.performWarningRuntimeChecks=W.performRuntimeChecks=W.addStickyFlag=W.addStartOfInput=W.findUnreachablePatterns=W.findModesThatDoNotExist=W.findInvalidGroupType=W.findDuplicatePatterns=W.findUnsupportedFlags=W.findStartOfInputAnchor=W.findEmptyMatchRegExps=W.findEndOfInputAnchor=W.findInvalidPatterns=W.findMissingPatterns=W.validatePatterns=W.analyzeTokenTypes=W.enableSticky=W.disableSticky=W.SUPPORT_STICKY=W.MODES=W.DEFAULT_MODE=void 0;var a_=wa(),Me=Ka(),$=_e(),jo=i_(),s_=Pc(),En="PATTERN";W.DEFAULT_MODE="defaultMode";W.MODES="modes";W.SUPPORT_STICKY=typeof new RegExp("(?:)").sticky=="boolean";function OI(){W.SUPPORT_STICKY=!1}W.disableSticky=OI;function $I(){W.SUPPORT_STICKY=!0}W.enableSticky=$I;function MI(r,e){e=(0,$.defaults)(e,{useSticky:W.SUPPORT_STICKY,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
3600
+ `],tracer:function(_,R){return R()}});var t=e.tracer;t("initCharCodeToOptimizedIndexMap",function(){BI()});var n;t("Reject Lexer.NA",function(){n=(0,$.reject)(r,function(_){return _[En]===Me.Lexer.NA})});var i=!1,o;t("Transform Patterns",function(){i=!1,o=(0,$.map)(n,function(_){var R=_[En];if((0,$.isRegExp)(R)){var D=R.source;return D.length===1&&D!=="^"&&D!=="$"&&D!=="."&&!R.ignoreCase?D:D.length===2&&D[0]==="\\"&&!(0,$.contains)(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],D[1])?D[1]:e.useSticky?Fm(R):Lm(R)}else{if((0,$.isFunction)(R))return i=!0,{exec:R};if((0,$.has)(R,"exec"))return i=!0,R;if(typeof R=="string"){if(R.length===1)return R;var B=R.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),V=new RegExp(B);return e.useSticky?Fm(V):Lm(V)}else throw Error("non exhaustive match")}})});var a,s,u,c,l;t("misc mapping",function(){a=(0,$.map)(n,function(_){return _.tokenTypeIdx}),s=(0,$.map)(n,function(_){var R=_.GROUP;if(R!==Me.Lexer.SKIPPED){if((0,$.isString)(R))return R;if((0,$.isUndefined)(R))return!1;throw Error("non exhaustive match")}}),u=(0,$.map)(n,function(_){var R=_.LONGER_ALT;if(R){var D=(0,$.isArray)(R)?(0,$.map)(R,function(B){return(0,$.indexOf)(n,B)}):[(0,$.indexOf)(n,R)];return D}}),c=(0,$.map)(n,function(_){return _.PUSH_MODE}),l=(0,$.map)(n,function(_){return(0,$.has)(_,"POP_MODE")})});var d;t("Line Terminator Handling",function(){var _=__(e.lineTerminatorCharacters);d=(0,$.map)(n,function(R){return!1}),e.positionTracking!=="onlyOffset"&&(d=(0,$.map)(n,function(R){if((0,$.has)(R,"LINE_BREAKS"))return R.LINE_BREAKS;if(T_(R,_)===!1)return(0,jo.canMatchCharCode)(_,R.PATTERN)}))});var g,y,p,A;t("Misc Mapping #2",function(){g=(0,$.map)(n,jm),y=(0,$.map)(o,v_),p=(0,$.reduce)(n,function(_,R){var D=R.GROUP;return(0,$.isString)(D)&&D!==Me.Lexer.SKIPPED&&(_[D]=[]),_},{}),A=(0,$.map)(o,function(_,R){return{pattern:o[R],longerAlt:u[R],canLineTerminator:d[R],isCustom:g[R],short:y[R],group:s[R],push:c[R],pop:l[R],tokenTypeIdx:a[R],tokenType:n[R]}})});var x=!0,k=[];return e.safeMode||t("First Char Optimization",function(){k=(0,$.reduce)(n,function(_,R,D){if(typeof R.PATTERN=="string"){var B=R.PATTERN.charCodeAt(0),V=qm(B);Mm(_,V,A[D])}else if((0,$.isArray)(R.START_CHARS_HINT)){var G;(0,$.forEach)(R.START_CHARS_HINT,function(je){var Ze=typeof je=="string"?je.charCodeAt(0):je,Ge=qm(Ze);G!==Ge&&(G=Ge,Mm(_,Ge,A[D]))})}else if((0,$.isRegExp)(R.PATTERN))if(R.PATTERN.unicode)x=!1,e.ensureOptimizations&&(0,$.PRINT_ERROR)(""+jo.failedOptimizationPrefixMsg+(" Unable to analyze < "+R.PATTERN.toString()+` > pattern.
3601
3601
  `)+` The regexp unicode flag is not currently supported by the regexp-to-ast library.
3602
3602
  This will disable the lexer's first char optimizations.
3603
- For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{var ge=(0,jo.getOptimizedStartCodesIndices)(R.PATTERN,e.ensureOptimizations);(0,$.isEmpty)(ge)&&(x=!1),(0,$.forEach)(ge,function(je){Fm(_,je,A[D])})}else e.ensureOptimizations&&(0,$.PRINT_ERROR)(""+jo.failedOptimizationPrefixMsg+(" TokenType: <"+R.name+`> is using a custom token pattern without providing <start_chars_hint> parameter.
3603
+ For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{var ge=(0,jo.getOptimizedStartCodesIndices)(R.PATTERN,e.ensureOptimizations);(0,$.isEmpty)(ge)&&(x=!1),(0,$.forEach)(ge,function(je){Mm(_,je,A[D])})}else e.ensureOptimizations&&(0,$.PRINT_ERROR)(""+jo.failedOptimizationPrefixMsg+(" TokenType: <"+R.name+`> is using a custom token pattern without providing <start_chars_hint> parameter.
3604
3604
  `)+` This will disable the lexer's first char optimizations.
3605
- For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),x=!1;return _},[])}),t("ArrayPacking",function(){k=(0,$.packArray)(k)}),{emptyGroups:p,patternIdxToConfig:A,charCodeToPatternIdxToConfig:k,hasCustom:i,canBeOptimized:x}}W.analyzeTokenTypes=qI;function jI(r,e){var t=[],n=l_(r);t=t.concat(n.errors);var i=d_(n.valid),o=i.valid;return t=t.concat(i.errors),t=t.concat(GI(o)),t=t.concat(g_(o)),t=t.concat(v_(o,e)),t=t.concat(T_(o)),t}W.validatePatterns=jI;function GI(r){var e=[],t=(0,$.filter)(r,function(n){return(0,$.isRegExp)(n[En])});return e=e.concat(f_(t)),e=e.concat(m_(t)),e=e.concat(h_(t)),e=e.concat(y_(t)),e=e.concat(p_(t)),e}function l_(r){var e=(0,$.filter)(r,function(i){return!(0,$.has)(i,En)}),t=(0,$.map)(e,function(i){return{message:"Token Type: ->"+i.name+"<- missing static 'PATTERN' property",type:Me.LexerDefinitionErrorType.MISSING_PATTERN,tokenTypes:[i]}}),n=(0,$.difference)(r,e);return{errors:t,valid:n}}W.findMissingPatterns=l_;function d_(r){var e=(0,$.filter)(r,function(i){var o=i[En];return!(0,$.isRegExp)(o)&&!(0,$.isFunction)(o)&&!(0,$.has)(o,"exec")&&!(0,$.isString)(o)}),t=(0,$.map)(e,function(i){return{message:"Token Type: ->"+i.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:Me.LexerDefinitionErrorType.INVALID_PATTERN,tokenTypes:[i]}}),n=(0,$.difference)(r,e);return{errors:t,valid:n}}W.findInvalidPatterns=d_;var UI=/[^\\][\$]/;function f_(r){var e=function(i){s_(o,i);function o(){var a=i!==null&&i.apply(this,arguments)||this;return a.found=!1,a}return o.prototype.visitEndAnchor=function(a){this.found=!0},o}(u_.BaseRegExpVisitor),t=(0,$.filter)(r,function(i){var o=i[En];try{var a=(0,c_.getRegExpAst)(o),s=new e;return s.visit(a),s.found}catch{return UI.test(o.source)}}),n=(0,$.map)(t,function(i){return{message:`Unexpected RegExp Anchor Error:
3605
+ For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),x=!1;return _},[])}),t("ArrayPacking",function(){k=(0,$.packArray)(k)}),{emptyGroups:p,patternIdxToConfig:A,charCodeToPatternIdxToConfig:k,hasCustom:i,canBeOptimized:x}}W.analyzeTokenTypes=MI;function LI(r,e){var t=[],n=u_(r);t=t.concat(n.errors);var i=c_(n.valid),o=i.valid;return t=t.concat(i.errors),t=t.concat(FI(o)),t=t.concat(h_(o)),t=t.concat(y_(o,e)),t=t.concat(g_(o)),t}W.validatePatterns=LI;function FI(r){var e=[],t=(0,$.filter)(r,function(n){return(0,$.isRegExp)(n[En])});return e=e.concat(l_(t)),e=e.concat(f_(t)),e=e.concat(p_(t)),e=e.concat(m_(t)),e=e.concat(d_(t)),e}function u_(r){var e=(0,$.filter)(r,function(i){return!(0,$.has)(i,En)}),t=(0,$.map)(e,function(i){return{message:"Token Type: ->"+i.name+"<- missing static 'PATTERN' property",type:Me.LexerDefinitionErrorType.MISSING_PATTERN,tokenTypes:[i]}}),n=(0,$.difference)(r,e);return{errors:t,valid:n}}W.findMissingPatterns=u_;function c_(r){var e=(0,$.filter)(r,function(i){var o=i[En];return!(0,$.isRegExp)(o)&&!(0,$.isFunction)(o)&&!(0,$.has)(o,"exec")&&!(0,$.isString)(o)}),t=(0,$.map)(e,function(i){return{message:"Token Type: ->"+i.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:Me.LexerDefinitionErrorType.INVALID_PATTERN,tokenTypes:[i]}}),n=(0,$.difference)(r,e);return{errors:t,valid:n}}W.findInvalidPatterns=c_;var qI=/[^\\][\$]/;function l_(r){var e=function(i){o_(o,i);function o(){var a=i!==null&&i.apply(this,arguments)||this;return a.found=!1,a}return o.prototype.visitEndAnchor=function(a){this.found=!0},o}(a_.BaseRegExpVisitor),t=(0,$.filter)(r,function(i){var o=i[En];try{var a=(0,s_.getRegExpAst)(o),s=new e;return s.visit(a),s.found}catch{return qI.test(o.source)}}),n=(0,$.map)(t,function(i){return{message:`Unexpected RegExp Anchor Error:
3606
3606
  Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain end of input anchor '$'
3607
- See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:Me.LexerDefinitionErrorType.EOI_ANCHOR_FOUND,tokenTypes:[i]}});return n}W.findEndOfInputAnchor=f_;function p_(r){var e=(0,$.filter)(r,function(n){var i=n[En];return i.test("")}),t=(0,$.map)(e,function(n){return{message:"Token Type: ->"+n.name+"<- static 'PATTERN' must not match an empty string",type:Me.LexerDefinitionErrorType.EMPTY_MATCH_PATTERN,tokenTypes:[n]}});return t}W.findEmptyMatchRegExps=p_;var HI=/[^\\[][\^]|^\^/;function m_(r){var e=function(i){s_(o,i);function o(){var a=i!==null&&i.apply(this,arguments)||this;return a.found=!1,a}return o.prototype.visitStartAnchor=function(a){this.found=!0},o}(u_.BaseRegExpVisitor),t=(0,$.filter)(r,function(i){var o=i[En];try{var a=(0,c_.getRegExpAst)(o),s=new e;return s.visit(a),s.found}catch{return HI.test(o.source)}}),n=(0,$.map)(t,function(i){return{message:`Unexpected RegExp Anchor Error:
3607
+ See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:Me.LexerDefinitionErrorType.EOI_ANCHOR_FOUND,tokenTypes:[i]}});return n}W.findEndOfInputAnchor=l_;function d_(r){var e=(0,$.filter)(r,function(n){var i=n[En];return i.test("")}),t=(0,$.map)(e,function(n){return{message:"Token Type: ->"+n.name+"<- static 'PATTERN' must not match an empty string",type:Me.LexerDefinitionErrorType.EMPTY_MATCH_PATTERN,tokenTypes:[n]}});return t}W.findEmptyMatchRegExps=d_;var jI=/[^\\[][\^]|^\^/;function f_(r){var e=function(i){o_(o,i);function o(){var a=i!==null&&i.apply(this,arguments)||this;return a.found=!1,a}return o.prototype.visitStartAnchor=function(a){this.found=!0},o}(a_.BaseRegExpVisitor),t=(0,$.filter)(r,function(i){var o=i[En];try{var a=(0,s_.getRegExpAst)(o),s=new e;return s.visit(a),s.found}catch{return jI.test(o.source)}}),n=(0,$.map)(t,function(i){return{message:`Unexpected RegExp Anchor Error:
3608
3608
  Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain start of input anchor '^'
3609
- See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:Me.LexerDefinitionErrorType.SOI_ANCHOR_FOUND,tokenTypes:[i]}});return n}W.findStartOfInputAnchor=m_;function h_(r){var e=(0,$.filter)(r,function(n){var i=n[En];return i instanceof RegExp&&(i.multiline||i.global)}),t=(0,$.map)(e,function(n){return{message:"Token Type: ->"+n.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:Me.LexerDefinitionErrorType.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[n]}});return t}W.findUnsupportedFlags=h_;function y_(r){var e=[],t=(0,$.map)(r,function(o){return(0,$.reduce)(r,function(a,s){return o.PATTERN.source===s.PATTERN.source&&!(0,$.contains)(e,s)&&s.PATTERN!==Me.Lexer.NA&&(e.push(s),a.push(s)),a},[])});t=(0,$.compact)(t);var n=(0,$.filter)(t,function(o){return o.length>1}),i=(0,$.map)(n,function(o){var a=(0,$.map)(o,function(u){return u.name}),s=(0,$.first)(o).PATTERN;return{message:"The same RegExp pattern ->"+s+"<-"+("has been used in all of the following Token Types: "+a.join(", ")+" <-"),type:Me.LexerDefinitionErrorType.DUPLICATE_PATTERNS_FOUND,tokenTypes:o}});return i}W.findDuplicatePatterns=y_;function g_(r){var e=(0,$.filter)(r,function(n){if(!(0,$.has)(n,"GROUP"))return!1;var i=n.GROUP;return i!==Me.Lexer.SKIPPED&&i!==Me.Lexer.NA&&!(0,$.isString)(i)}),t=(0,$.map)(e,function(n){return{message:"Token Type: ->"+n.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:Me.LexerDefinitionErrorType.INVALID_GROUP_TYPE_FOUND,tokenTypes:[n]}});return t}W.findInvalidGroupType=g_;function v_(r,e){var t=(0,$.filter)(r,function(i){return i.PUSH_MODE!==void 0&&!(0,$.contains)(e,i.PUSH_MODE)}),n=(0,$.map)(t,function(i){var o="Token Type: ->"+i.name+"<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->"+i.PUSH_MODE+"<-which does not exist";return{message:o,type:Me.LexerDefinitionErrorType.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[i]}});return n}W.findModesThatDoNotExist=v_;function T_(r){var e=[],t=(0,$.reduce)(r,function(n,i,o){var a=i.PATTERN;return a===Me.Lexer.NA||((0,$.isString)(a)?n.push({str:a,idx:o,tokenType:i}):(0,$.isRegExp)(a)&&KI(a)&&n.push({str:a.source,idx:o,tokenType:i})),n},[]);return(0,$.forEach)(r,function(n,i){(0,$.forEach)(t,function(o){var a=o.str,s=o.idx,u=o.tokenType;if(i<s&&WI(a,n.PATTERN)){var c="Token: ->"+u.name+`<- can never be matched.
3609
+ See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:Me.LexerDefinitionErrorType.SOI_ANCHOR_FOUND,tokenTypes:[i]}});return n}W.findStartOfInputAnchor=f_;function p_(r){var e=(0,$.filter)(r,function(n){var i=n[En];return i instanceof RegExp&&(i.multiline||i.global)}),t=(0,$.map)(e,function(n){return{message:"Token Type: ->"+n.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:Me.LexerDefinitionErrorType.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[n]}});return t}W.findUnsupportedFlags=p_;function m_(r){var e=[],t=(0,$.map)(r,function(o){return(0,$.reduce)(r,function(a,s){return o.PATTERN.source===s.PATTERN.source&&!(0,$.contains)(e,s)&&s.PATTERN!==Me.Lexer.NA&&(e.push(s),a.push(s)),a},[])});t=(0,$.compact)(t);var n=(0,$.filter)(t,function(o){return o.length>1}),i=(0,$.map)(n,function(o){var a=(0,$.map)(o,function(u){return u.name}),s=(0,$.first)(o).PATTERN;return{message:"The same RegExp pattern ->"+s+"<-"+("has been used in all of the following Token Types: "+a.join(", ")+" <-"),type:Me.LexerDefinitionErrorType.DUPLICATE_PATTERNS_FOUND,tokenTypes:o}});return i}W.findDuplicatePatterns=m_;function h_(r){var e=(0,$.filter)(r,function(n){if(!(0,$.has)(n,"GROUP"))return!1;var i=n.GROUP;return i!==Me.Lexer.SKIPPED&&i!==Me.Lexer.NA&&!(0,$.isString)(i)}),t=(0,$.map)(e,function(n){return{message:"Token Type: ->"+n.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:Me.LexerDefinitionErrorType.INVALID_GROUP_TYPE_FOUND,tokenTypes:[n]}});return t}W.findInvalidGroupType=h_;function y_(r,e){var t=(0,$.filter)(r,function(i){return i.PUSH_MODE!==void 0&&!(0,$.contains)(e,i.PUSH_MODE)}),n=(0,$.map)(t,function(i){var o="Token Type: ->"+i.name+"<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->"+i.PUSH_MODE+"<-which does not exist";return{message:o,type:Me.LexerDefinitionErrorType.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[i]}});return n}W.findModesThatDoNotExist=y_;function g_(r){var e=[],t=(0,$.reduce)(r,function(n,i,o){var a=i.PATTERN;return a===Me.Lexer.NA||((0,$.isString)(a)?n.push({str:a,idx:o,tokenType:i}):(0,$.isRegExp)(a)&&UI(a)&&n.push({str:a.source,idx:o,tokenType:i})),n},[]);return(0,$.forEach)(r,function(n,i){(0,$.forEach)(t,function(o){var a=o.str,s=o.idx,u=o.tokenType;if(i<s&&GI(a,n.PATTERN)){var c="Token: ->"+u.name+`<- can never be matched.
3610
3610
  `+("Because it appears AFTER the Token Type ->"+n.name+"<-")+`in the lexer's definition.
3611
- See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;e.push({message:c,type:Me.LexerDefinitionErrorType.UNREACHABLE_PATTERN,tokenTypes:[n,u]})}})}),e}W.findUnreachablePatterns=T_;function WI(r,e){if((0,$.isRegExp)(e)){var t=e.exec(r);return t!==null&&t.index===0}else{if((0,$.isFunction)(e))return e(r,0,[],{});if((0,$.has)(e,"exec"))return e.exec(r,0,[],{});if(typeof e=="string")return e===r;throw Error("non exhaustive match")}}function KI(r){var e=[".","\\","[","]","|","^","$","(",")","?","*","+","{"];return(0,$.find)(e,function(t){return r.source.indexOf(t)!==-1})===void 0}function qm(r){var e=r.ignoreCase?"i":"";return new RegExp("^(?:"+r.source+")",e)}W.addStartOfInput=qm;function jm(r){var e=r.ignoreCase?"iy":"y";return new RegExp(""+r.source,e)}W.addStickyFlag=jm;function BI(r,e,t){var n=[];return(0,$.has)(r,W.DEFAULT_MODE)||n.push({message:"A MultiMode Lexer cannot be initialized without a <"+W.DEFAULT_MODE+`> property in its definition
3611
+ See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;e.push({message:c,type:Me.LexerDefinitionErrorType.UNREACHABLE_PATTERN,tokenTypes:[n,u]})}})}),e}W.findUnreachablePatterns=g_;function GI(r,e){if((0,$.isRegExp)(e)){var t=e.exec(r);return t!==null&&t.index===0}else{if((0,$.isFunction)(e))return e(r,0,[],{});if((0,$.has)(e,"exec"))return e.exec(r,0,[],{});if(typeof e=="string")return e===r;throw Error("non exhaustive match")}}function UI(r){var e=[".","\\","[","]","|","^","$","(",")","?","*","+","{"];return(0,$.find)(e,function(t){return r.source.indexOf(t)!==-1})===void 0}function Lm(r){var e=r.ignoreCase?"i":"";return new RegExp("^(?:"+r.source+")",e)}W.addStartOfInput=Lm;function Fm(r){var e=r.ignoreCase?"iy":"y";return new RegExp(""+r.source,e)}W.addStickyFlag=Fm;function HI(r,e,t){var n=[];return(0,$.has)(r,W.DEFAULT_MODE)||n.push({message:"A MultiMode Lexer cannot be initialized without a <"+W.DEFAULT_MODE+`> property in its definition
3612
3612
  `,type:Me.LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),(0,$.has)(r,W.MODES)||n.push({message:"A MultiMode Lexer cannot be initialized without a <"+W.MODES+`> property in its definition
3613
3613
  `,type:Me.LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),(0,$.has)(r,W.MODES)&&(0,$.has)(r,W.DEFAULT_MODE)&&!(0,$.has)(r.modes,r.defaultMode)&&n.push({message:"A MultiMode Lexer cannot be initialized with a "+W.DEFAULT_MODE+": <"+r.defaultMode+`>which does not exist
3614
3614
  `,type:Me.LexerDefinitionErrorType.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),(0,$.has)(r,W.MODES)&&(0,$.forEach)(r.modes,function(i,o){(0,$.forEach)(i,function(a,s){(0,$.isUndefined)(a)&&n.push({message:"A Lexer cannot be initialized using an undefined Token Type. Mode:"+("<"+o+"> at index: <"+s+`>
3615
- `),type:Me.LexerDefinitionErrorType.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED})})}),n}W.performRuntimeChecks=BI;function zI(r,e,t){var n=[],i=!1,o=(0,$.compact)((0,$.flatten)((0,$.mapValues)(r.modes,function(u){return u}))),a=(0,$.reject)(o,function(u){return u[En]===Me.Lexer.NA}),s=b_(t);return e&&(0,$.forEach)(a,function(u){var c=__(u,s);if(c!==!1){var l=A_(u,c),d={message:l,type:c.issue,tokenType:u};n.push(d)}else(0,$.has)(u,"LINE_BREAKS")?u.LINE_BREAKS===!0&&(i=!0):(0,jo.canMatchCharCode)(s,u.PATTERN)&&(i=!0)}),e&&!i&&n.push({message:`Warning: No LINE_BREAKS Found.
3615
+ `),type:Me.LexerDefinitionErrorType.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED})})}),n}W.performRuntimeChecks=HI;function WI(r,e,t){var n=[],i=!1,o=(0,$.compact)((0,$.flatten)((0,$.mapValues)(r.modes,function(u){return u}))),a=(0,$.reject)(o,function(u){return u[En]===Me.Lexer.NA}),s=__(t);return e&&(0,$.forEach)(a,function(u){var c=T_(u,s);if(c!==!1){var l=R_(u,c),d={message:l,type:c.issue,tokenType:u};n.push(d)}else(0,$.has)(u,"LINE_BREAKS")?u.LINE_BREAKS===!0&&(i=!0):(0,jo.canMatchCharCode)(s,u.PATTERN)&&(i=!0)}),e&&!i&&n.push({message:`Warning: No LINE_BREAKS Found.
3616
3616
  This Lexer has been defined to track line and column information,
3617
3617
  But none of the Token Types can be identified as matching a line terminator.
3618
3618
  See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS
3619
- for details.`,type:Me.LexerDefinitionErrorType.NO_LINE_BREAKS_FLAGS}),n}W.performWarningRuntimeChecks=zI;function VI(r){var e={},t=(0,$.keys)(r);return(0,$.forEach)(t,function(n){var i=r[n];if((0,$.isArray)(i))e[n]=[];else throw Error("non exhaustive match")}),e}W.cloneEmptyGroups=VI;function Um(r){var e=r.PATTERN;if((0,$.isRegExp)(e))return!1;if((0,$.isFunction)(e))return!0;if((0,$.has)(e,"exec"))return!0;if((0,$.isString)(e))return!1;throw Error("non exhaustive match")}W.isCustomPattern=Um;function R_(r){return(0,$.isString)(r)&&r.length===1?r.charCodeAt(0):!1}W.isShortPattern=R_;W.LineTerminatorOptimizedTester={test:function(r){for(var e=r.length,t=this.lastIndex;t<e;t++){var n=r.charCodeAt(t);if(n===10)return this.lastIndex=t+1,!0;if(n===13)return r.charCodeAt(t+1)===10?this.lastIndex=t+2:this.lastIndex=t+1,!0}return!1},lastIndex:0};function __(r,e){if((0,$.has)(r,"LINE_BREAKS"))return!1;if((0,$.isRegExp)(r.PATTERN)){try{(0,jo.canMatchCharCode)(e,r.PATTERN)}catch(t){return{issue:Me.LexerDefinitionErrorType.IDENTIFY_TERMINATOR,errMsg:t.message}}return!1}else{if((0,$.isString)(r.PATTERN))return!1;if(Um(r))return{issue:Me.LexerDefinitionErrorType.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}}function A_(r,e){if(e.issue===Me.LexerDefinitionErrorType.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
3619
+ for details.`,type:Me.LexerDefinitionErrorType.NO_LINE_BREAKS_FLAGS}),n}W.performWarningRuntimeChecks=WI;function KI(r){var e={},t=(0,$.keys)(r);return(0,$.forEach)(t,function(n){var i=r[n];if((0,$.isArray)(i))e[n]=[];else throw Error("non exhaustive match")}),e}W.cloneEmptyGroups=KI;function jm(r){var e=r.PATTERN;if((0,$.isRegExp)(e))return!1;if((0,$.isFunction)(e))return!0;if((0,$.has)(e,"exec"))return!0;if((0,$.isString)(e))return!1;throw Error("non exhaustive match")}W.isCustomPattern=jm;function v_(r){return(0,$.isString)(r)&&r.length===1?r.charCodeAt(0):!1}W.isShortPattern=v_;W.LineTerminatorOptimizedTester={test:function(r){for(var e=r.length,t=this.lastIndex;t<e;t++){var n=r.charCodeAt(t);if(n===10)return this.lastIndex=t+1,!0;if(n===13)return r.charCodeAt(t+1)===10?this.lastIndex=t+2:this.lastIndex=t+1,!0}return!1},lastIndex:0};function T_(r,e){if((0,$.has)(r,"LINE_BREAKS"))return!1;if((0,$.isRegExp)(r.PATTERN)){try{(0,jo.canMatchCharCode)(e,r.PATTERN)}catch(t){return{issue:Me.LexerDefinitionErrorType.IDENTIFY_TERMINATOR,errMsg:t.message}}return!1}else{if((0,$.isString)(r.PATTERN))return!1;if(jm(r))return{issue:Me.LexerDefinitionErrorType.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}}function R_(r,e){if(e.issue===Me.LexerDefinitionErrorType.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
3620
3620
  `+(" The problem is in the <"+r.name+`> Token Type
3621
3621
  `)+(" Root cause: "+e.errMsg+`.
3622
3622
  `)+" For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR";if(e.issue===Me.LexerDefinitionErrorType.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.
3623
3623
  `+(" The problem is in the <"+r.name+`> Token Type
3624
- `)+" For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK";throw Error("non exhaustive match")}W.buildLineBreakIssueMessage=A_;function b_(r){var e=(0,$.map)(r,function(t){return(0,$.isString)(t)&&t.length>0?t.charCodeAt(0):t});return e}function Fm(r,e,t){r[e]===void 0?r[e]=[t]:r[e].push(t)}W.minOptimizationVal=256;var Nc=[];function Gm(r){return r<W.minOptimizationVal?r:Nc[r]}W.charCodeToOptimizedIndex=Gm;function YI(){if((0,$.isEmpty)(Nc)){Nc=new Array(65536);for(var r=0;r<65536;r++)Nc[r]=r>255?255+~~(r/255):r}}});var Go=C(ce=>{"use strict";Object.defineProperty(ce,"__esModule",{value:!0});ce.isTokenType=ce.hasExtendingTokensTypesMapProperty=ce.hasExtendingTokensTypesProperty=ce.hasCategoriesProperty=ce.hasShortKeyProperty=ce.singleAssignCategoriesToksMap=ce.assignCategoriesMapProp=ce.assignCategoriesTokensProp=ce.assignTokenDefaultProps=ce.expandCategories=ce.augmentTokenTypes=ce.tokenIdxToClass=ce.tokenShortNameIdx=ce.tokenStructuredMatcherNoCategories=ce.tokenStructuredMatcher=void 0;var At=_e();function XI(r,e){var t=r.tokenTypeIdx;return t===e.tokenTypeIdx?!0:e.isParent===!0&&e.categoryMatchesMap[t]===!0}ce.tokenStructuredMatcher=XI;function JI(r,e){return r.tokenTypeIdx===e.tokenTypeIdx}ce.tokenStructuredMatcherNoCategories=JI;ce.tokenShortNameIdx=1;ce.tokenIdxToClass={};function ZI(r){var e=E_(r);C_(e),k_(e),P_(e),(0,At.forEach)(e,function(t){t.isParent=t.categoryMatches.length>0})}ce.augmentTokenTypes=ZI;function E_(r){for(var e=(0,At.cloneArr)(r),t=r,n=!0;n;){t=(0,At.compact)((0,At.flatten)((0,At.map)(t,function(o){return o.CATEGORIES})));var i=(0,At.difference)(t,e);e=e.concat(i),(0,At.isEmpty)(i)?n=!1:t=i}return e}ce.expandCategories=E_;function C_(r){(0,At.forEach)(r,function(e){x_(e)||(ce.tokenIdxToClass[ce.tokenShortNameIdx]=e,e.tokenTypeIdx=ce.tokenShortNameIdx++),Hm(e)&&!(0,At.isArray)(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),Hm(e)||(e.CATEGORIES=[]),S_(e)||(e.categoryMatches=[]),N_(e)||(e.categoryMatchesMap={})})}ce.assignTokenDefaultProps=C_;function P_(r){(0,At.forEach)(r,function(e){e.categoryMatches=[],(0,At.forEach)(e.categoryMatchesMap,function(t,n){e.categoryMatches.push(ce.tokenIdxToClass[n].tokenTypeIdx)})})}ce.assignCategoriesTokensProp=P_;function k_(r){(0,At.forEach)(r,function(e){Wm([],e)})}ce.assignCategoriesMapProp=k_;function Wm(r,e){(0,At.forEach)(r,function(t){e.categoryMatchesMap[t.tokenTypeIdx]=!0}),(0,At.forEach)(e.CATEGORIES,function(t){var n=r.concat(e);(0,At.contains)(n,t)||Wm(n,t)})}ce.singleAssignCategoriesToksMap=Wm;function x_(r){return(0,At.has)(r,"tokenTypeIdx")}ce.hasShortKeyProperty=x_;function Hm(r){return(0,At.has)(r,"CATEGORIES")}ce.hasCategoriesProperty=Hm;function S_(r){return(0,At.has)(r,"categoryMatches")}ce.hasExtendingTokensTypesProperty=S_;function N_(r){return(0,At.has)(r,"categoryMatchesMap")}ce.hasExtendingTokensTypesMapProperty=N_;function QI(r){return(0,At.has)(r,"tokenTypeIdx")}ce.isTokenType=QI});var Km=C(Dc=>{"use strict";Object.defineProperty(Dc,"__esModule",{value:!0});Dc.defaultLexerErrorProvider=void 0;Dc.defaultLexerErrorProvider={buildUnableToPopLexerModeMessage:function(r){return"Unable to pop Lexer Mode after encountering Token ->"+r.image+"<- The Mode Stack is empty"},buildUnexpectedCharactersMessage:function(r,e,t,n,i){return"unexpected character: ->"+r.charAt(e)+"<- at offset: "+e+","+(" skipped "+t+" characters.")}}});var Ka=C(Wi=>{"use strict";Object.defineProperty(Wi,"__esModule",{value:!0});Wi.Lexer=Wi.LexerDefinitionErrorType=void 0;var en=Lm(),Le=_e(),eO=Go(),tO=Km(),rO=kc(),nO;(function(r){r[r.MISSING_PATTERN=0]="MISSING_PATTERN",r[r.INVALID_PATTERN=1]="INVALID_PATTERN",r[r.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",r[r.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",r[r.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",r[r.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",r[r.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",r[r.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",r[r.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",r[r.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",r[r.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",r[r.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",r[r.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",r[r.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",r[r.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",r[r.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",r[r.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK"})(nO=Wi.LexerDefinitionErrorType||(Wi.LexerDefinitionErrorType={}));var Ba={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
3625
- `,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:tO.defaultLexerErrorProvider,traceInitPerf:!1,skipValidations:!1};Object.freeze(Ba);var iO=function(){function r(e,t){var n=this;if(t===void 0&&(t=Ba),this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.config=void 0,this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},typeof t=="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
3624
+ `)+" For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK";throw Error("non exhaustive match")}W.buildLineBreakIssueMessage=R_;function __(r){var e=(0,$.map)(r,function(t){return(0,$.isString)(t)&&t.length>0?t.charCodeAt(0):t});return e}function Mm(r,e,t){r[e]===void 0?r[e]=[t]:r[e].push(t)}W.minOptimizationVal=256;var Sc=[];function qm(r){return r<W.minOptimizationVal?r:Sc[r]}W.charCodeToOptimizedIndex=qm;function BI(){if((0,$.isEmpty)(Sc)){Sc=new Array(65536);for(var r=0;r<65536;r++)Sc[r]=r>255?255+~~(r/255):r}}});var Go=C(ce=>{"use strict";Object.defineProperty(ce,"__esModule",{value:!0});ce.isTokenType=ce.hasExtendingTokensTypesMapProperty=ce.hasExtendingTokensTypesProperty=ce.hasCategoriesProperty=ce.hasShortKeyProperty=ce.singleAssignCategoriesToksMap=ce.assignCategoriesMapProp=ce.assignCategoriesTokensProp=ce.assignTokenDefaultProps=ce.expandCategories=ce.augmentTokenTypes=ce.tokenIdxToClass=ce.tokenShortNameIdx=ce.tokenStructuredMatcherNoCategories=ce.tokenStructuredMatcher=void 0;var At=_e();function zI(r,e){var t=r.tokenTypeIdx;return t===e.tokenTypeIdx?!0:e.isParent===!0&&e.categoryMatchesMap[t]===!0}ce.tokenStructuredMatcher=zI;function VI(r,e){return r.tokenTypeIdx===e.tokenTypeIdx}ce.tokenStructuredMatcherNoCategories=VI;ce.tokenShortNameIdx=1;ce.tokenIdxToClass={};function YI(r){var e=A_(r);b_(e),C_(e),E_(e),(0,At.forEach)(e,function(t){t.isParent=t.categoryMatches.length>0})}ce.augmentTokenTypes=YI;function A_(r){for(var e=(0,At.cloneArr)(r),t=r,n=!0;n;){t=(0,At.compact)((0,At.flatten)((0,At.map)(t,function(o){return o.CATEGORIES})));var i=(0,At.difference)(t,e);e=e.concat(i),(0,At.isEmpty)(i)?n=!1:t=i}return e}ce.expandCategories=A_;function b_(r){(0,At.forEach)(r,function(e){P_(e)||(ce.tokenIdxToClass[ce.tokenShortNameIdx]=e,e.tokenTypeIdx=ce.tokenShortNameIdx++),Gm(e)&&!(0,At.isArray)(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),Gm(e)||(e.CATEGORIES=[]),k_(e)||(e.categoryMatches=[]),x_(e)||(e.categoryMatchesMap={})})}ce.assignTokenDefaultProps=b_;function E_(r){(0,At.forEach)(r,function(e){e.categoryMatches=[],(0,At.forEach)(e.categoryMatchesMap,function(t,n){e.categoryMatches.push(ce.tokenIdxToClass[n].tokenTypeIdx)})})}ce.assignCategoriesTokensProp=E_;function C_(r){(0,At.forEach)(r,function(e){Um([],e)})}ce.assignCategoriesMapProp=C_;function Um(r,e){(0,At.forEach)(r,function(t){e.categoryMatchesMap[t.tokenTypeIdx]=!0}),(0,At.forEach)(e.CATEGORIES,function(t){var n=r.concat(e);(0,At.contains)(n,t)||Um(n,t)})}ce.singleAssignCategoriesToksMap=Um;function P_(r){return(0,At.has)(r,"tokenTypeIdx")}ce.hasShortKeyProperty=P_;function Gm(r){return(0,At.has)(r,"CATEGORIES")}ce.hasCategoriesProperty=Gm;function k_(r){return(0,At.has)(r,"categoryMatches")}ce.hasExtendingTokensTypesProperty=k_;function x_(r){return(0,At.has)(r,"categoryMatchesMap")}ce.hasExtendingTokensTypesMapProperty=x_;function XI(r){return(0,At.has)(r,"tokenTypeIdx")}ce.isTokenType=XI});var Hm=C(Nc=>{"use strict";Object.defineProperty(Nc,"__esModule",{value:!0});Nc.defaultLexerErrorProvider=void 0;Nc.defaultLexerErrorProvider={buildUnableToPopLexerModeMessage:function(r){return"Unable to pop Lexer Mode after encountering Token ->"+r.image+"<- The Mode Stack is empty"},buildUnexpectedCharactersMessage:function(r,e,t,n,i){return"unexpected character: ->"+r.charAt(e)+"<- at offset: "+e+","+(" skipped "+t+" characters.")}}});var Ka=C(Wi=>{"use strict";Object.defineProperty(Wi,"__esModule",{value:!0});Wi.Lexer=Wi.LexerDefinitionErrorType=void 0;var en=$m(),Le=_e(),JI=Go(),ZI=Hm(),QI=Pc(),eO;(function(r){r[r.MISSING_PATTERN=0]="MISSING_PATTERN",r[r.INVALID_PATTERN=1]="INVALID_PATTERN",r[r.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",r[r.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",r[r.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",r[r.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",r[r.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",r[r.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",r[r.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",r[r.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",r[r.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",r[r.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",r[r.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",r[r.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",r[r.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",r[r.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",r[r.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK"})(eO=Wi.LexerDefinitionErrorType||(Wi.LexerDefinitionErrorType={}));var Ba={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
3625
+ `,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:ZI.defaultLexerErrorProvider,traceInitPerf:!1,skipValidations:!1};Object.freeze(Ba);var tO=function(){function r(e,t){var n=this;if(t===void 0&&(t=Ba),this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.config=void 0,this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},typeof t=="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
3626
3626
  a boolean 2nd argument is no longer supported`);this.config=(0,Le.merge)(Ba,t);var i=this.config.traceInitPerf;i===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof i=="number"&&(this.traceInitMaxIdent=i,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",function(){var o,a=!0;n.TRACE_INIT("Lexer Config handling",function(){if(n.config.lineTerminatorsPattern===Ba.lineTerminatorsPattern)n.config.lineTerminatorsPattern=en.LineTerminatorOptimizedTester;else if(n.config.lineTerminatorCharacters===Ba.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
3627
- 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.');n.trackStartLines=/full|onlyStart/i.test(n.config.positionTracking),n.trackEndLines=/full/i.test(n.config.positionTracking),(0,Le.isArray)(e)?(o={modes:{}},o.modes[en.DEFAULT_MODE]=(0,Le.cloneArr)(e),o[en.DEFAULT_MODE]=en.DEFAULT_MODE):(a=!1,o=(0,Le.cloneObj)(e))}),n.config.skipValidations===!1&&(n.TRACE_INIT("performRuntimeChecks",function(){n.lexerDefinitionErrors=n.lexerDefinitionErrors.concat((0,en.performRuntimeChecks)(o,n.trackStartLines,n.config.lineTerminatorCharacters))}),n.TRACE_INIT("performWarningRuntimeChecks",function(){n.lexerDefinitionWarning=n.lexerDefinitionWarning.concat((0,en.performWarningRuntimeChecks)(o,n.trackStartLines,n.config.lineTerminatorCharacters))})),o.modes=o.modes?o.modes:{},(0,Le.forEach)(o.modes,function(l,d){o.modes[d]=(0,Le.reject)(l,function(g){return(0,Le.isUndefined)(g)})});var s=(0,Le.keys)(o.modes);if((0,Le.forEach)(o.modes,function(l,d){n.TRACE_INIT("Mode: <"+d+"> processing",function(){if(n.modes.push(d),n.config.skipValidations===!1&&n.TRACE_INIT("validatePatterns",function(){n.lexerDefinitionErrors=n.lexerDefinitionErrors.concat((0,en.validatePatterns)(l,s))}),(0,Le.isEmpty)(n.lexerDefinitionErrors)){(0,eO.augmentTokenTypes)(l);var g;n.TRACE_INIT("analyzeTokenTypes",function(){g=(0,en.analyzeTokenTypes)(l,{lineTerminatorCharacters:n.config.lineTerminatorCharacters,positionTracking:t.positionTracking,ensureOptimizations:t.ensureOptimizations,safeMode:t.safeMode,tracer:n.TRACE_INIT.bind(n)})}),n.patternIdxToConfig[d]=g.patternIdxToConfig,n.charCodeToPatternIdxToConfig[d]=g.charCodeToPatternIdxToConfig,n.emptyGroups=(0,Le.merge)(n.emptyGroups,g.emptyGroups),n.hasCustom=g.hasCustom||n.hasCustom,n.canModeBeOptimized[d]=g.canBeOptimized}})}),n.defaultMode=o.defaultMode,!(0,Le.isEmpty)(n.lexerDefinitionErrors)&&!n.config.deferDefinitionErrorsHandling){var u=(0,Le.map)(n.lexerDefinitionErrors,function(l){return l.message}),c=u.join(`-----------------------
3627
+ 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.');n.trackStartLines=/full|onlyStart/i.test(n.config.positionTracking),n.trackEndLines=/full/i.test(n.config.positionTracking),(0,Le.isArray)(e)?(o={modes:{}},o.modes[en.DEFAULT_MODE]=(0,Le.cloneArr)(e),o[en.DEFAULT_MODE]=en.DEFAULT_MODE):(a=!1,o=(0,Le.cloneObj)(e))}),n.config.skipValidations===!1&&(n.TRACE_INIT("performRuntimeChecks",function(){n.lexerDefinitionErrors=n.lexerDefinitionErrors.concat((0,en.performRuntimeChecks)(o,n.trackStartLines,n.config.lineTerminatorCharacters))}),n.TRACE_INIT("performWarningRuntimeChecks",function(){n.lexerDefinitionWarning=n.lexerDefinitionWarning.concat((0,en.performWarningRuntimeChecks)(o,n.trackStartLines,n.config.lineTerminatorCharacters))})),o.modes=o.modes?o.modes:{},(0,Le.forEach)(o.modes,function(l,d){o.modes[d]=(0,Le.reject)(l,function(g){return(0,Le.isUndefined)(g)})});var s=(0,Le.keys)(o.modes);if((0,Le.forEach)(o.modes,function(l,d){n.TRACE_INIT("Mode: <"+d+"> processing",function(){if(n.modes.push(d),n.config.skipValidations===!1&&n.TRACE_INIT("validatePatterns",function(){n.lexerDefinitionErrors=n.lexerDefinitionErrors.concat((0,en.validatePatterns)(l,s))}),(0,Le.isEmpty)(n.lexerDefinitionErrors)){(0,JI.augmentTokenTypes)(l);var g;n.TRACE_INIT("analyzeTokenTypes",function(){g=(0,en.analyzeTokenTypes)(l,{lineTerminatorCharacters:n.config.lineTerminatorCharacters,positionTracking:t.positionTracking,ensureOptimizations:t.ensureOptimizations,safeMode:t.safeMode,tracer:n.TRACE_INIT.bind(n)})}),n.patternIdxToConfig[d]=g.patternIdxToConfig,n.charCodeToPatternIdxToConfig[d]=g.charCodeToPatternIdxToConfig,n.emptyGroups=(0,Le.merge)(n.emptyGroups,g.emptyGroups),n.hasCustom=g.hasCustom||n.hasCustom,n.canModeBeOptimized[d]=g.canBeOptimized}})}),n.defaultMode=o.defaultMode,!(0,Le.isEmpty)(n.lexerDefinitionErrors)&&!n.config.deferDefinitionErrorsHandling){var u=(0,Le.map)(n.lexerDefinitionErrors,function(l){return l.message}),c=u.join(`-----------------------
3628
3628
  `);throw new Error(`Errors detected in definition of Lexer:
3629
3629
  `+c)}(0,Le.forEach)(n.lexerDefinitionWarning,function(l){(0,Le.PRINT_WARNING)(l.message)}),n.TRACE_INIT("Choosing sub-methods implementations",function(){if(en.SUPPORT_STICKY?(n.chopInput=Le.IDENTITY,n.match=n.matchWithTest):(n.updateLastIndex=Le.NOOP,n.match=n.matchWithExec),a&&(n.handleModes=Le.NOOP),n.trackStartLines===!1&&(n.computeNewColumn=Le.IDENTITY),n.trackEndLines===!1&&(n.updateTokenEndLineColumnLocation=Le.NOOP),/full/i.test(n.config.positionTracking))n.createTokenInstance=n.createFullToken;else if(/onlyStart/i.test(n.config.positionTracking))n.createTokenInstance=n.createStartOnlyToken;else if(/onlyOffset/i.test(n.config.positionTracking))n.createTokenInstance=n.createOffsetOnlyToken;else throw Error('Invalid <positionTracking> config option: "'+n.config.positionTracking+'"');n.hasCustom?(n.addToken=n.addTokenUsingPush,n.handlePayload=n.handlePayloadWithCustom):(n.addToken=n.addTokenUsingMemberAccess,n.handlePayload=n.handlePayloadNoCustom)}),n.TRACE_INIT("Failed Optimization Warnings",function(){var l=(0,Le.reduce)(n.canModeBeOptimized,function(d,g,y){return g===!1&&d.push(y),d},[]);if(t.ensureOptimizations&&!(0,Le.isEmpty)(l))throw Error("Lexer Modes: < "+l.join(", ")+` > cannot be optimized.
3630
3630
  Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
3631
- Or inspect the console log for details on how to resolve these issues.`)}),n.TRACE_INIT("clearRegExpParserCache",function(){(0,rO.clearRegExpParserCache)()}),n.TRACE_INIT("toFastProperties",function(){(0,Le.toFastProperties)(n)})})}return r.prototype.tokenize=function(e,t){if(t===void 0&&(t=this.defaultMode),!(0,Le.isEmpty)(this.lexerDefinitionErrors)){var n=(0,Le.map)(this.lexerDefinitionErrors,function(a){return a.message}),i=n.join(`-----------------------
3631
+ Or inspect the console log for details on how to resolve these issues.`)}),n.TRACE_INIT("clearRegExpParserCache",function(){(0,QI.clearRegExpParserCache)()}),n.TRACE_INIT("toFastProperties",function(){(0,Le.toFastProperties)(n)})})}return r.prototype.tokenize=function(e,t){if(t===void 0&&(t=this.defaultMode),!(0,Le.isEmpty)(this.lexerDefinitionErrors)){var n=(0,Le.map)(this.lexerDefinitionErrors,function(a){return a.message}),i=n.join(`-----------------------
3632
3632
  `);throw new Error(`Unable to Tokenize because Errors detected in definition of Lexer:
3633
- `+i)}var o=this.tokenizeInternal(e,t);return o},r.prototype.tokenizeInternal=function(e,t){var n=this,i,o,a,s,u,c,l,d,g,y,p,A,x,k,_,R,D=e,B=D.length,V=0,G=0,ge=this.hasCustom?0:Math.floor(e.length/10),je=new Array(ge),Ze=[],Ge=this.trackStartLines?1:void 0,L=this.trackStartLines?1:void 0,M=(0,en.cloneEmptyGroups)(this.emptyGroups),F=this.trackStartLines,K=this.config.lineTerminatorsPattern,pe=0,ee=[],ie=[],Ae=[],Ue=[];Object.freeze(Ue);var ft=void 0;function ur(){return ee}function yr(ut){var ln=(0,en.charCodeToOptimizedIndex)(ut),Ar=ie[ln];return Ar===void 0?Ue:Ar}var Xi=function(ut){if(Ae.length===1&&ut.tokenType.PUSH_MODE===void 0){var ln=n.config.errorMessageProvider.buildUnableToPopLexerModeMessage(ut);Ze.push({offset:ut.startOffset,line:ut.startLine!==void 0?ut.startLine:void 0,column:ut.startColumn!==void 0?ut.startColumn:void 0,length:ut.image.length,message:ln})}else{Ae.pop();var Ar=(0,Le.last)(Ae);ee=n.patternIdxToConfig[Ar],ie=n.charCodeToPatternIdxToConfig[Ar],pe=ee.length;var to=n.canModeBeOptimized[Ar]&&n.config.safeMode===!1;ie&&to?ft=yr:ft=ur}};function Ji(ut){Ae.push(ut),ie=this.charCodeToPatternIdxToConfig[ut],ee=this.patternIdxToConfig[ut],pe=ee.length,pe=ee.length;var ln=this.canModeBeOptimized[ut]&&this.config.safeMode===!1;ie&&ln?ft=yr:ft=ur}Ji.call(this,t);for(var Qt;V<B;){c=null;var Zi=D.charCodeAt(V),Qi=ft(Zi),ia=Qi.length;for(i=0;i<ia;i++){Qt=Qi[i];var Rr=Qt.pattern;l=null;var xt=Qt.short;if(xt!==!1?Zi===xt&&(c=Rr):Qt.isCustom===!0?(R=Rr.exec(D,V,je,M),R!==null?(c=R[0],R.payload!==void 0&&(l=R.payload)):c=null):(this.updateLastIndex(Rr,V),c=this.match(Rr,e,V)),c!==null){if(u=Qt.longerAlt,u!==void 0){var oa=u.length;for(a=0;a<oa;a++){var Ci=ee[u[a]],un=Ci.pattern;if(d=null,Ci.isCustom===!0?(R=un.exec(D,V,je,M),R!==null?(s=R[0],R.payload!==void 0&&(d=R.payload)):s=null):(this.updateLastIndex(un,V),s=this.match(un,e,V)),s&&s.length>c.length){c=s,l=d,Qt=Ci;break}}}break}}if(c!==null){if(g=c.length,y=Qt.group,y!==void 0&&(p=Qt.tokenTypeIdx,A=this.createTokenInstance(c,V,p,Qt.tokenType,Ge,L,g),this.handlePayload(A,l),y===!1?G=this.addToken(je,G,A):M[y].push(A)),e=this.chopInput(e,g),V=V+g,L=this.computeNewColumn(L,g),F===!0&&Qt.canLineTerminator===!0){var ti=0,In=void 0,Pi=void 0;K.lastIndex=0;do In=K.test(c),In===!0&&(Pi=K.lastIndex-1,ti++);while(In===!0);ti!==0&&(Ge=Ge+ti,L=g-Pi,this.updateTokenEndLineColumnLocation(A,y,Pi,ti,Ge,L,g))}this.handleModes(Qt,Xi,Ji,A)}else{for(var _r=V,cn=Ge,eo=L,On=!1;!On&&V<B;)for(k=D.charCodeAt(V),e=this.chopInput(e,1),V++,o=0;o<pe;o++){var Lr=ee[o],Rr=Lr.pattern,xt=Lr.short;if(xt!==!1?D.charCodeAt(V)===xt&&(On=!0):Lr.isCustom===!0?On=Rr.exec(D,V,je,M)!==null:(this.updateLastIndex(Rr,V),On=Rr.exec(e)!==null),On===!0)break}x=V-_r,_=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(D,_r,x,cn,eo),Ze.push({offset:_r,line:cn,column:eo,length:x,message:_})}}return this.hasCustom||(je.length=G),{tokens:je,groups:M,errors:Ze}},r.prototype.handleModes=function(e,t,n,i){if(e.pop===!0){var o=e.push;t(i),o!==void 0&&n.call(this,o)}else e.push!==void 0&&n.call(this,e.push)},r.prototype.chopInput=function(e,t){return e.substring(t)},r.prototype.updateLastIndex=function(e,t){e.lastIndex=t},r.prototype.updateTokenEndLineColumnLocation=function(e,t,n,i,o,a,s){var u,c;t!==void 0&&(u=n===s-1,c=u?-1:0,i===1&&u===!0||(e.endLine=o+c,e.endColumn=a-1+-c))},r.prototype.computeNewColumn=function(e,t){return e+t},r.prototype.createTokenInstance=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return null},r.prototype.createOffsetOnlyToken=function(e,t,n,i){return{image:e,startOffset:t,tokenTypeIdx:n,tokenType:i}},r.prototype.createStartOnlyToken=function(e,t,n,i,o,a){return{image:e,startOffset:t,startLine:o,startColumn:a,tokenTypeIdx:n,tokenType:i}},r.prototype.createFullToken=function(e,t,n,i,o,a,s){return{image:e,startOffset:t,endOffset:t+s-1,startLine:o,endLine:o,startColumn:a,endColumn:a+s-1,tokenTypeIdx:n,tokenType:i}},r.prototype.addToken=function(e,t,n){return 666},r.prototype.addTokenUsingPush=function(e,t,n){return e.push(n),t},r.prototype.addTokenUsingMemberAccess=function(e,t,n){return e[t]=n,t++,t},r.prototype.handlePayload=function(e,t){},r.prototype.handlePayloadNoCustom=function(e,t){},r.prototype.handlePayloadWithCustom=function(e,t){t!==null&&(e.payload=t)},r.prototype.match=function(e,t,n){return null},r.prototype.matchWithTest=function(e,t,n){var i=e.test(t);return i===!0?t.substring(n,e.lastIndex):null},r.prototype.matchWithExec=function(e,t){var n=e.exec(t);return n!==null?n[0]:n},r.prototype.TRACE_INIT=function(e,t){if(this.traceInitPerf===!0){this.traceInitIndent++;var n=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(n+"--> <"+e+">");var i=(0,Le.timer)(t),o=i.time,a=i.value,s=o>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&s(n+"<-- <"+e+"> time: "+o+"ms"),this.traceInitIndent--,a}else return t()},r.SKIPPED="This marks a skipped Token pattern, this means each token identified by it willbe consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.",r.NA=/NOT_APPLICABLE/,r}();Wi.Lexer=iO});var vi=C(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Gt.tokenMatcher=Gt.createTokenInstance=Gt.EOF=Gt.createToken=Gt.hasTokenLabel=Gt.tokenName=Gt.tokenLabel=void 0;var tn=_e(),oO=Ka(),Bm=Go();function aO(r){return q_(r)?r.LABEL:r.name}Gt.tokenLabel=aO;function sO(r){return r.name}Gt.tokenName=sO;function q_(r){return(0,tn.isString)(r.LABEL)&&r.LABEL!==""}Gt.hasTokenLabel=q_;var uO="parent",D_="categories",w_="label",I_="group",O_="push_mode",$_="pop_mode",M_="longer_alt",L_="line_breaks",F_="start_chars_hint";function j_(r){return cO(r)}Gt.createToken=j_;function cO(r){var e=r.pattern,t={};if(t.name=r.name,(0,tn.isUndefined)(e)||(t.PATTERN=e),(0,tn.has)(r,uO))throw`The parent property is no longer supported.
3634
- See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return(0,tn.has)(r,D_)&&(t.CATEGORIES=r[D_]),(0,Bm.augmentTokenTypes)([t]),(0,tn.has)(r,w_)&&(t.LABEL=r[w_]),(0,tn.has)(r,I_)&&(t.GROUP=r[I_]),(0,tn.has)(r,$_)&&(t.POP_MODE=r[$_]),(0,tn.has)(r,O_)&&(t.PUSH_MODE=r[O_]),(0,tn.has)(r,M_)&&(t.LONGER_ALT=r[M_]),(0,tn.has)(r,L_)&&(t.LINE_BREAKS=r[L_]),(0,tn.has)(r,F_)&&(t.START_CHARS_HINT=r[F_]),t}Gt.EOF=j_({name:"EOF",pattern:oO.Lexer.NA});(0,Bm.augmentTokenTypes)([Gt.EOF]);function lO(r,e,t,n,i,o,a,s){return{image:e,startOffset:t,endOffset:n,startLine:i,endLine:o,startColumn:a,endColumn:s,tokenTypeIdx:r.tokenTypeIdx,tokenType:r}}Gt.createTokenInstance=lO;function dO(r,e){return(0,Bm.tokenStructuredMatcher)(r,e)}Gt.tokenMatcher=dO});var fr=C(ke=>{"use strict";var Vn=ke&&ke.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(ke,"__esModule",{value:!0});ke.serializeProduction=ke.serializeGrammar=ke.Terminal=ke.Alternation=ke.RepetitionWithSeparator=ke.Repetition=ke.RepetitionMandatoryWithSeparator=ke.RepetitionMandatory=ke.Option=ke.Alternative=ke.Rule=ke.NonTerminal=ke.AbstractProduction=void 0;var Ye=_e(),fO=vi(),Cn=function(){function r(e){this._definition=e}return Object.defineProperty(r.prototype,"definition",{get:function(){return this._definition},set:function(e){this._definition=e},enumerable:!1,configurable:!0}),r.prototype.accept=function(e){e.visit(this),(0,Ye.forEach)(this.definition,function(t){t.accept(e)})},r}();ke.AbstractProduction=Cn;var G_=function(r){Vn(e,r);function e(t){var n=r.call(this,[])||this;return n.idx=1,(0,Ye.assign)(n,(0,Ye.pick)(t,function(i){return i!==void 0})),n}return Object.defineProperty(e.prototype,"definition",{get:function(){return this.referencedRule!==void 0?this.referencedRule.definition:[]},set:function(t){},enumerable:!1,configurable:!0}),e.prototype.accept=function(t){t.visit(this)},e}(Cn);ke.NonTerminal=G_;var U_=function(r){Vn(e,r);function e(t){var n=r.call(this,t.definition)||this;return n.orgText="",(0,Ye.assign)(n,(0,Ye.pick)(t,function(i){return i!==void 0})),n}return e}(Cn);ke.Rule=U_;var H_=function(r){Vn(e,r);function e(t){var n=r.call(this,t.definition)||this;return n.ignoreAmbiguities=!1,(0,Ye.assign)(n,(0,Ye.pick)(t,function(i){return i!==void 0})),n}return e}(Cn);ke.Alternative=H_;var W_=function(r){Vn(e,r);function e(t){var n=r.call(this,t.definition)||this;return n.idx=1,(0,Ye.assign)(n,(0,Ye.pick)(t,function(i){return i!==void 0})),n}return e}(Cn);ke.Option=W_;var K_=function(r){Vn(e,r);function e(t){var n=r.call(this,t.definition)||this;return n.idx=1,(0,Ye.assign)(n,(0,Ye.pick)(t,function(i){return i!==void 0})),n}return e}(Cn);ke.RepetitionMandatory=K_;var B_=function(r){Vn(e,r);function e(t){var n=r.call(this,t.definition)||this;return n.idx=1,(0,Ye.assign)(n,(0,Ye.pick)(t,function(i){return i!==void 0})),n}return e}(Cn);ke.RepetitionMandatoryWithSeparator=B_;var z_=function(r){Vn(e,r);function e(t){var n=r.call(this,t.definition)||this;return n.idx=1,(0,Ye.assign)(n,(0,Ye.pick)(t,function(i){return i!==void 0})),n}return e}(Cn);ke.Repetition=z_;var V_=function(r){Vn(e,r);function e(t){var n=r.call(this,t.definition)||this;return n.idx=1,(0,Ye.assign)(n,(0,Ye.pick)(t,function(i){return i!==void 0})),n}return e}(Cn);ke.RepetitionWithSeparator=V_;var Y_=function(r){Vn(e,r);function e(t){var n=r.call(this,t.definition)||this;return n.idx=1,n.ignoreAmbiguities=!1,n.hasPredicates=!1,(0,Ye.assign)(n,(0,Ye.pick)(t,function(i){return i!==void 0})),n}return Object.defineProperty(e.prototype,"definition",{get:function(){return this._definition},set:function(t){this._definition=t},enumerable:!1,configurable:!0}),e}(Cn);ke.Alternation=Y_;var wc=function(){function r(e){this.idx=1,(0,Ye.assign)(this,(0,Ye.pick)(e,function(t){return t!==void 0}))}return r.prototype.accept=function(e){e.visit(this)},r}();ke.Terminal=wc;function pO(r){return(0,Ye.map)(r,za)}ke.serializeGrammar=pO;function za(r){function e(o){return(0,Ye.map)(o,za)}if(r instanceof G_){var t={type:"NonTerminal",name:r.nonTerminalName,idx:r.idx};return(0,Ye.isString)(r.label)&&(t.label=r.label),t}else{if(r instanceof H_)return{type:"Alternative",definition:e(r.definition)};if(r instanceof W_)return{type:"Option",idx:r.idx,definition:e(r.definition)};if(r instanceof K_)return{type:"RepetitionMandatory",idx:r.idx,definition:e(r.definition)};if(r instanceof B_)return{type:"RepetitionMandatoryWithSeparator",idx:r.idx,separator:za(new wc({terminalType:r.separator})),definition:e(r.definition)};if(r instanceof V_)return{type:"RepetitionWithSeparator",idx:r.idx,separator:za(new wc({terminalType:r.separator})),definition:e(r.definition)};if(r instanceof z_)return{type:"Repetition",idx:r.idx,definition:e(r.definition)};if(r instanceof Y_)return{type:"Alternation",idx:r.idx,definition:e(r.definition)};if(r instanceof wc){var n={type:"Terminal",name:r.terminalType.name,label:(0,fO.tokenLabel)(r.terminalType),idx:r.idx};(0,Ye.isString)(r.label)&&(n.terminalLabel=r.label);var i=r.terminalType.PATTERN;return r.terminalType.PATTERN&&(n.pattern=(0,Ye.isRegExp)(i)?i.source:i),n}else{if(r instanceof U_)return{type:"Rule",name:r.name,orgText:r.orgText,definition:e(r.definition)};throw Error("non exhaustive match")}}}ke.serializeProduction=za});var Oc=C(Ic=>{"use strict";Object.defineProperty(Ic,"__esModule",{value:!0});Ic.RestWalker=void 0;var zm=_e(),pr=fr(),mO=function(){function r(){}return r.prototype.walk=function(e,t){var n=this;t===void 0&&(t=[]),(0,zm.forEach)(e.definition,function(i,o){var a=(0,zm.drop)(e.definition,o+1);if(i instanceof pr.NonTerminal)n.walkProdRef(i,a,t);else if(i instanceof pr.Terminal)n.walkTerminal(i,a,t);else if(i instanceof pr.Alternative)n.walkFlat(i,a,t);else if(i instanceof pr.Option)n.walkOption(i,a,t);else if(i instanceof pr.RepetitionMandatory)n.walkAtLeastOne(i,a,t);else if(i instanceof pr.RepetitionMandatoryWithSeparator)n.walkAtLeastOneSep(i,a,t);else if(i instanceof pr.RepetitionWithSeparator)n.walkManySep(i,a,t);else if(i instanceof pr.Repetition)n.walkMany(i,a,t);else if(i instanceof pr.Alternation)n.walkOr(i,a,t);else throw Error("non exhaustive match")})},r.prototype.walkTerminal=function(e,t,n){},r.prototype.walkProdRef=function(e,t,n){},r.prototype.walkFlat=function(e,t,n){var i=t.concat(n);this.walk(e,i)},r.prototype.walkOption=function(e,t,n){var i=t.concat(n);this.walk(e,i)},r.prototype.walkAtLeastOne=function(e,t,n){var i=[new pr.Option({definition:e.definition})].concat(t,n);this.walk(e,i)},r.prototype.walkAtLeastOneSep=function(e,t,n){var i=X_(e,t,n);this.walk(e,i)},r.prototype.walkMany=function(e,t,n){var i=[new pr.Option({definition:e.definition})].concat(t,n);this.walk(e,i)},r.prototype.walkManySep=function(e,t,n){var i=X_(e,t,n);this.walk(e,i)},r.prototype.walkOr=function(e,t,n){var i=this,o=t.concat(n);(0,zm.forEach)(e.definition,function(a){var s=new pr.Alternative({definition:[a]});i.walk(s,o)})},r}();Ic.RestWalker=mO;function X_(r,e,t){var n=[new pr.Option({definition:[new pr.Terminal({terminalType:r.separator})].concat(r.definition)})],i=n.concat(e,t);return i}});var Uo=C($c=>{"use strict";Object.defineProperty($c,"__esModule",{value:!0});$c.GAstVisitor=void 0;var Pn=fr(),hO=function(){function r(){}return r.prototype.visit=function(e){var t=e;switch(t.constructor){case Pn.NonTerminal:return this.visitNonTerminal(t);case Pn.Alternative:return this.visitAlternative(t);case Pn.Option:return this.visitOption(t);case Pn.RepetitionMandatory:return this.visitRepetitionMandatory(t);case Pn.RepetitionMandatoryWithSeparator:return this.visitRepetitionMandatoryWithSeparator(t);case Pn.RepetitionWithSeparator:return this.visitRepetitionWithSeparator(t);case Pn.Repetition:return this.visitRepetition(t);case Pn.Alternation:return this.visitAlternation(t);case Pn.Terminal:return this.visitTerminal(t);case Pn.Rule:return this.visitRule(t);default:throw Error("non exhaustive match")}},r.prototype.visitNonTerminal=function(e){},r.prototype.visitAlternative=function(e){},r.prototype.visitOption=function(e){},r.prototype.visitRepetition=function(e){},r.prototype.visitRepetitionMandatory=function(e){},r.prototype.visitRepetitionMandatoryWithSeparator=function(e){},r.prototype.visitRepetitionWithSeparator=function(e){},r.prototype.visitAlternation=function(e){},r.prototype.visitTerminal=function(e){},r.prototype.visitRule=function(e){},r}();$c.GAstVisitor=hO});var Ya=C(Jt=>{"use strict";var yO=Jt&&Jt.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(Jt,"__esModule",{value:!0});Jt.collectMethods=Jt.DslMethodsCollectorVisitor=Jt.getProductionDslName=Jt.isBranchingProd=Jt.isOptionalProd=Jt.isSequenceProd=void 0;var Va=_e(),rt=fr(),gO=Uo();function vO(r){return r instanceof rt.Alternative||r instanceof rt.Option||r instanceof rt.Repetition||r instanceof rt.RepetitionMandatory||r instanceof rt.RepetitionMandatoryWithSeparator||r instanceof rt.RepetitionWithSeparator||r instanceof rt.Terminal||r instanceof rt.Rule}Jt.isSequenceProd=vO;function Vm(r,e){e===void 0&&(e=[]);var t=r instanceof rt.Option||r instanceof rt.Repetition||r instanceof rt.RepetitionWithSeparator;return t?!0:r instanceof rt.Alternation?(0,Va.some)(r.definition,function(n){return Vm(n,e)}):r instanceof rt.NonTerminal&&(0,Va.contains)(e,r)?!1:r instanceof rt.AbstractProduction?(r instanceof rt.NonTerminal&&e.push(r),(0,Va.every)(r.definition,function(n){return Vm(n,e)})):!1}Jt.isOptionalProd=Vm;function TO(r){return r instanceof rt.Alternation}Jt.isBranchingProd=TO;function RO(r){if(r instanceof rt.NonTerminal)return"SUBRULE";if(r instanceof rt.Option)return"OPTION";if(r instanceof rt.Alternation)return"OR";if(r instanceof rt.RepetitionMandatory)return"AT_LEAST_ONE";if(r instanceof rt.RepetitionMandatoryWithSeparator)return"AT_LEAST_ONE_SEP";if(r instanceof rt.RepetitionWithSeparator)return"MANY_SEP";if(r instanceof rt.Repetition)return"MANY";if(r instanceof rt.Terminal)return"CONSUME";throw Error("non exhaustive match")}Jt.getProductionDslName=RO;var J_=function(r){yO(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.separator="-",t.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]},t}return e.prototype.reset=function(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}},e.prototype.visitTerminal=function(t){var n=t.terminalType.name+this.separator+"Terminal";(0,Va.has)(this.dslMethods,n)||(this.dslMethods[n]=[]),this.dslMethods[n].push(t)},e.prototype.visitNonTerminal=function(t){var n=t.nonTerminalName+this.separator+"Terminal";(0,Va.has)(this.dslMethods,n)||(this.dslMethods[n]=[]),this.dslMethods[n].push(t)},e.prototype.visitOption=function(t){this.dslMethods.option.push(t)},e.prototype.visitRepetitionWithSeparator=function(t){this.dslMethods.repetitionWithSeparator.push(t)},e.prototype.visitRepetitionMandatory=function(t){this.dslMethods.repetitionMandatory.push(t)},e.prototype.visitRepetitionMandatoryWithSeparator=function(t){this.dslMethods.repetitionMandatoryWithSeparator.push(t)},e.prototype.visitRepetition=function(t){this.dslMethods.repetition.push(t)},e.prototype.visitAlternation=function(t){this.dslMethods.alternation.push(t)},e}(gO.GAstVisitor);Jt.DslMethodsCollectorVisitor=J_;var Mc=new J_;function _O(r){Mc.reset(),r.accept(Mc);var e=Mc.dslMethods;return Mc.reset(),e}Jt.collectMethods=_O});var Xm=C(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});kn.firstForTerminal=kn.firstForBranching=kn.firstForSequence=kn.first=void 0;var Lc=_e(),Z_=fr(),Ym=Ya();function Fc(r){if(r instanceof Z_.NonTerminal)return Fc(r.referencedRule);if(r instanceof Z_.Terminal)return tA(r);if((0,Ym.isSequenceProd)(r))return Q_(r);if((0,Ym.isBranchingProd)(r))return eA(r);throw Error("non exhaustive match")}kn.first=Fc;function Q_(r){for(var e=[],t=r.definition,n=0,i=t.length>n,o,a=!0;i&&a;)o=t[n],a=(0,Ym.isOptionalProd)(o),e=e.concat(Fc(o)),n=n+1,i=t.length>n;return(0,Lc.uniq)(e)}kn.firstForSequence=Q_;function eA(r){var e=(0,Lc.map)(r.definition,function(t){return Fc(t)});return(0,Lc.uniq)((0,Lc.flatten)(e))}kn.firstForBranching=eA;function tA(r){return[r.terminalType]}kn.firstForTerminal=tA});var Jm=C(qc=>{"use strict";Object.defineProperty(qc,"__esModule",{value:!0});qc.IN=void 0;qc.IN="_~IN~_"});var aA=C(Ir=>{"use strict";var AO=Ir&&Ir.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(Ir,"__esModule",{value:!0});Ir.buildInProdFollowPrefix=Ir.buildBetweenProdsFollowPrefix=Ir.computeAllProdsFollows=Ir.ResyncFollowsWalker=void 0;var bO=Oc(),EO=Xm(),rA=_e(),nA=Jm(),CO=fr(),iA=function(r){AO(e,r);function e(t){var n=r.call(this)||this;return n.topProd=t,n.follows={},n}return e.prototype.startWalking=function(){return this.walk(this.topProd),this.follows},e.prototype.walkTerminal=function(t,n,i){},e.prototype.walkProdRef=function(t,n,i){var o=oA(t.referencedRule,t.idx)+this.topProd.name,a=n.concat(i),s=new CO.Alternative({definition:a}),u=(0,EO.first)(s);this.follows[o]=u},e}(bO.RestWalker);Ir.ResyncFollowsWalker=iA;function PO(r){var e={};return(0,rA.forEach)(r,function(t){var n=new iA(t).startWalking();(0,rA.assign)(e,n)}),e}Ir.computeAllProdsFollows=PO;function oA(r,e){return r.name+e+nA.IN}Ir.buildBetweenProdsFollowPrefix=oA;function kO(r){var e=r.terminalType.name;return e+r.idx+nA.IN}Ir.buildInProdFollowPrefix=kO});var Xa=C(Yn=>{"use strict";Object.defineProperty(Yn,"__esModule",{value:!0});Yn.defaultGrammarValidatorErrorProvider=Yn.defaultGrammarResolverErrorProvider=Yn.defaultParserErrorProvider=void 0;var Ho=vi(),xO=_e(),rn=_e(),Zm=fr(),sA=Ya();Yn.defaultParserErrorProvider={buildMismatchTokenMessage:function(r){var e=r.expected,t=r.actual,n=r.previous,i=r.ruleName,o=(0,Ho.hasTokenLabel)(e),a=o?"--> "+(0,Ho.tokenLabel)(e)+" <--":"token of type --> "+e.name+" <--",s="Expecting "+a+" but found --> '"+t.image+"' <--";return s},buildNotAllInputParsedMessage:function(r){var e=r.firstRedundant,t=r.ruleName;return"Redundant input, expecting EOF but found: "+e.image},buildNoViableAltMessage:function(r){var e=r.expectedPathsPerAlt,t=r.actual,n=r.previous,i=r.customUserDescription,o=r.ruleName,a="Expecting: ",s=(0,rn.first)(t).image,u=`
3633
+ `+i)}var o=this.tokenizeInternal(e,t);return o},r.prototype.tokenizeInternal=function(e,t){var n=this,i,o,a,s,u,c,l,d,g,y,p,A,x,k,_,R,D=e,B=D.length,V=0,G=0,ge=this.hasCustom?0:Math.floor(e.length/10),je=new Array(ge),Ze=[],Ge=this.trackStartLines?1:void 0,L=this.trackStartLines?1:void 0,M=(0,en.cloneEmptyGroups)(this.emptyGroups),F=this.trackStartLines,K=this.config.lineTerminatorsPattern,pe=0,ee=[],ie=[],Ae=[],Ue=[];Object.freeze(Ue);var ft=void 0;function ur(){return ee}function yr(ut){var ln=(0,en.charCodeToOptimizedIndex)(ut),Ar=ie[ln];return Ar===void 0?Ue:Ar}var Xi=function(ut){if(Ae.length===1&&ut.tokenType.PUSH_MODE===void 0){var ln=n.config.errorMessageProvider.buildUnableToPopLexerModeMessage(ut);Ze.push({offset:ut.startOffset,line:ut.startLine!==void 0?ut.startLine:void 0,column:ut.startColumn!==void 0?ut.startColumn:void 0,length:ut.image.length,message:ln})}else{Ae.pop();var Ar=(0,Le.last)(Ae);ee=n.patternIdxToConfig[Ar],ie=n.charCodeToPatternIdxToConfig[Ar],pe=ee.length;var to=n.canModeBeOptimized[Ar]&&n.config.safeMode===!1;ie&&to?ft=yr:ft=ur}};function Ji(ut){Ae.push(ut),ie=this.charCodeToPatternIdxToConfig[ut],ee=this.patternIdxToConfig[ut],pe=ee.length,pe=ee.length;var ln=this.canModeBeOptimized[ut]&&this.config.safeMode===!1;ie&&ln?ft=yr:ft=ur}Ji.call(this,t);for(var Qt;V<B;){c=null;var Zi=D.charCodeAt(V),Qi=ft(Zi),ia=Qi.length;for(i=0;i<ia;i++){Qt=Qi[i];var Rr=Qt.pattern;l=null;var xt=Qt.short;if(xt!==!1?Zi===xt&&(c=Rr):Qt.isCustom===!0?(R=Rr.exec(D,V,je,M),R!==null?(c=R[0],R.payload!==void 0&&(l=R.payload)):c=null):(this.updateLastIndex(Rr,V),c=this.match(Rr,e,V)),c!==null){if(u=Qt.longerAlt,u!==void 0){var oa=u.length;for(a=0;a<oa;a++){var Ci=ee[u[a]],un=Ci.pattern;if(d=null,Ci.isCustom===!0?(R=un.exec(D,V,je,M),R!==null?(s=R[0],R.payload!==void 0&&(d=R.payload)):s=null):(this.updateLastIndex(un,V),s=this.match(un,e,V)),s&&s.length>c.length){c=s,l=d,Qt=Ci;break}}}break}}if(c!==null){if(g=c.length,y=Qt.group,y!==void 0&&(p=Qt.tokenTypeIdx,A=this.createTokenInstance(c,V,p,Qt.tokenType,Ge,L,g),this.handlePayload(A,l),y===!1?G=this.addToken(je,G,A):M[y].push(A)),e=this.chopInput(e,g),V=V+g,L=this.computeNewColumn(L,g),F===!0&&Qt.canLineTerminator===!0){var ti=0,wn=void 0,Pi=void 0;K.lastIndex=0;do wn=K.test(c),wn===!0&&(Pi=K.lastIndex-1,ti++);while(wn===!0);ti!==0&&(Ge=Ge+ti,L=g-Pi,this.updateTokenEndLineColumnLocation(A,y,Pi,ti,Ge,L,g))}this.handleModes(Qt,Xi,Ji,A)}else{for(var _r=V,cn=Ge,eo=L,In=!1;!In&&V<B;)for(k=D.charCodeAt(V),e=this.chopInput(e,1),V++,o=0;o<pe;o++){var Lr=ee[o],Rr=Lr.pattern,xt=Lr.short;if(xt!==!1?D.charCodeAt(V)===xt&&(In=!0):Lr.isCustom===!0?In=Rr.exec(D,V,je,M)!==null:(this.updateLastIndex(Rr,V),In=Rr.exec(e)!==null),In===!0)break}x=V-_r,_=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(D,_r,x,cn,eo),Ze.push({offset:_r,line:cn,column:eo,length:x,message:_})}}return this.hasCustom||(je.length=G),{tokens:je,groups:M,errors:Ze}},r.prototype.handleModes=function(e,t,n,i){if(e.pop===!0){var o=e.push;t(i),o!==void 0&&n.call(this,o)}else e.push!==void 0&&n.call(this,e.push)},r.prototype.chopInput=function(e,t){return e.substring(t)},r.prototype.updateLastIndex=function(e,t){e.lastIndex=t},r.prototype.updateTokenEndLineColumnLocation=function(e,t,n,i,o,a,s){var u,c;t!==void 0&&(u=n===s-1,c=u?-1:0,i===1&&u===!0||(e.endLine=o+c,e.endColumn=a-1+-c))},r.prototype.computeNewColumn=function(e,t){return e+t},r.prototype.createTokenInstance=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return null},r.prototype.createOffsetOnlyToken=function(e,t,n,i){return{image:e,startOffset:t,tokenTypeIdx:n,tokenType:i}},r.prototype.createStartOnlyToken=function(e,t,n,i,o,a){return{image:e,startOffset:t,startLine:o,startColumn:a,tokenTypeIdx:n,tokenType:i}},r.prototype.createFullToken=function(e,t,n,i,o,a,s){return{image:e,startOffset:t,endOffset:t+s-1,startLine:o,endLine:o,startColumn:a,endColumn:a+s-1,tokenTypeIdx:n,tokenType:i}},r.prototype.addToken=function(e,t,n){return 666},r.prototype.addTokenUsingPush=function(e,t,n){return e.push(n),t},r.prototype.addTokenUsingMemberAccess=function(e,t,n){return e[t]=n,t++,t},r.prototype.handlePayload=function(e,t){},r.prototype.handlePayloadNoCustom=function(e,t){},r.prototype.handlePayloadWithCustom=function(e,t){t!==null&&(e.payload=t)},r.prototype.match=function(e,t,n){return null},r.prototype.matchWithTest=function(e,t,n){var i=e.test(t);return i===!0?t.substring(n,e.lastIndex):null},r.prototype.matchWithExec=function(e,t){var n=e.exec(t);return n!==null?n[0]:n},r.prototype.TRACE_INIT=function(e,t){if(this.traceInitPerf===!0){this.traceInitIndent++;var n=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(n+"--> <"+e+">");var i=(0,Le.timer)(t),o=i.time,a=i.value,s=o>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&s(n+"<-- <"+e+"> time: "+o+"ms"),this.traceInitIndent--,a}else return t()},r.SKIPPED="This marks a skipped Token pattern, this means each token identified by it willbe consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.",r.NA=/NOT_APPLICABLE/,r}();Wi.Lexer=tO});var vi=C(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.tokenMatcher=jt.createTokenInstance=jt.EOF=jt.createToken=jt.hasTokenLabel=jt.tokenName=jt.tokenLabel=void 0;var tn=_e(),rO=Ka(),Wm=Go();function nO(r){return L_(r)?r.LABEL:r.name}jt.tokenLabel=nO;function iO(r){return r.name}jt.tokenName=iO;function L_(r){return(0,tn.isString)(r.LABEL)&&r.LABEL!==""}jt.hasTokenLabel=L_;var oO="parent",S_="categories",N_="label",D_="group",w_="push_mode",I_="pop_mode",O_="longer_alt",$_="line_breaks",M_="start_chars_hint";function F_(r){return aO(r)}jt.createToken=F_;function aO(r){var e=r.pattern,t={};if(t.name=r.name,(0,tn.isUndefined)(e)||(t.PATTERN=e),(0,tn.has)(r,oO))throw`The parent property is no longer supported.
3634
+ See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return(0,tn.has)(r,S_)&&(t.CATEGORIES=r[S_]),(0,Wm.augmentTokenTypes)([t]),(0,tn.has)(r,N_)&&(t.LABEL=r[N_]),(0,tn.has)(r,D_)&&(t.GROUP=r[D_]),(0,tn.has)(r,I_)&&(t.POP_MODE=r[I_]),(0,tn.has)(r,w_)&&(t.PUSH_MODE=r[w_]),(0,tn.has)(r,O_)&&(t.LONGER_ALT=r[O_]),(0,tn.has)(r,$_)&&(t.LINE_BREAKS=r[$_]),(0,tn.has)(r,M_)&&(t.START_CHARS_HINT=r[M_]),t}jt.EOF=F_({name:"EOF",pattern:rO.Lexer.NA});(0,Wm.augmentTokenTypes)([jt.EOF]);function sO(r,e,t,n,i,o,a,s){return{image:e,startOffset:t,endOffset:n,startLine:i,endLine:o,startColumn:a,endColumn:s,tokenTypeIdx:r.tokenTypeIdx,tokenType:r}}jt.createTokenInstance=sO;function uO(r,e){return(0,Wm.tokenStructuredMatcher)(r,e)}jt.tokenMatcher=uO});var fr=C(ke=>{"use strict";var zn=ke&&ke.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(ke,"__esModule",{value:!0});ke.serializeProduction=ke.serializeGrammar=ke.Terminal=ke.Alternation=ke.RepetitionWithSeparator=ke.Repetition=ke.RepetitionMandatoryWithSeparator=ke.RepetitionMandatory=ke.Option=ke.Alternative=ke.Rule=ke.NonTerminal=ke.AbstractProduction=void 0;var Ye=_e(),cO=vi(),Cn=function(){function r(e){this._definition=e}return Object.defineProperty(r.prototype,"definition",{get:function(){return this._definition},set:function(e){this._definition=e},enumerable:!1,configurable:!0}),r.prototype.accept=function(e){e.visit(this),(0,Ye.forEach)(this.definition,function(t){t.accept(e)})},r}();ke.AbstractProduction=Cn;var q_=function(r){zn(e,r);function e(t){var n=r.call(this,[])||this;return n.idx=1,(0,Ye.assign)(n,(0,Ye.pick)(t,function(i){return i!==void 0})),n}return Object.defineProperty(e.prototype,"definition",{get:function(){return this.referencedRule!==void 0?this.referencedRule.definition:[]},set:function(t){},enumerable:!1,configurable:!0}),e.prototype.accept=function(t){t.visit(this)},e}(Cn);ke.NonTerminal=q_;var j_=function(r){zn(e,r);function e(t){var n=r.call(this,t.definition)||this;return n.orgText="",(0,Ye.assign)(n,(0,Ye.pick)(t,function(i){return i!==void 0})),n}return e}(Cn);ke.Rule=j_;var G_=function(r){zn(e,r);function e(t){var n=r.call(this,t.definition)||this;return n.ignoreAmbiguities=!1,(0,Ye.assign)(n,(0,Ye.pick)(t,function(i){return i!==void 0})),n}return e}(Cn);ke.Alternative=G_;var U_=function(r){zn(e,r);function e(t){var n=r.call(this,t.definition)||this;return n.idx=1,(0,Ye.assign)(n,(0,Ye.pick)(t,function(i){return i!==void 0})),n}return e}(Cn);ke.Option=U_;var H_=function(r){zn(e,r);function e(t){var n=r.call(this,t.definition)||this;return n.idx=1,(0,Ye.assign)(n,(0,Ye.pick)(t,function(i){return i!==void 0})),n}return e}(Cn);ke.RepetitionMandatory=H_;var W_=function(r){zn(e,r);function e(t){var n=r.call(this,t.definition)||this;return n.idx=1,(0,Ye.assign)(n,(0,Ye.pick)(t,function(i){return i!==void 0})),n}return e}(Cn);ke.RepetitionMandatoryWithSeparator=W_;var K_=function(r){zn(e,r);function e(t){var n=r.call(this,t.definition)||this;return n.idx=1,(0,Ye.assign)(n,(0,Ye.pick)(t,function(i){return i!==void 0})),n}return e}(Cn);ke.Repetition=K_;var B_=function(r){zn(e,r);function e(t){var n=r.call(this,t.definition)||this;return n.idx=1,(0,Ye.assign)(n,(0,Ye.pick)(t,function(i){return i!==void 0})),n}return e}(Cn);ke.RepetitionWithSeparator=B_;var z_=function(r){zn(e,r);function e(t){var n=r.call(this,t.definition)||this;return n.idx=1,n.ignoreAmbiguities=!1,n.hasPredicates=!1,(0,Ye.assign)(n,(0,Ye.pick)(t,function(i){return i!==void 0})),n}return Object.defineProperty(e.prototype,"definition",{get:function(){return this._definition},set:function(t){this._definition=t},enumerable:!1,configurable:!0}),e}(Cn);ke.Alternation=z_;var Dc=function(){function r(e){this.idx=1,(0,Ye.assign)(this,(0,Ye.pick)(e,function(t){return t!==void 0}))}return r.prototype.accept=function(e){e.visit(this)},r}();ke.Terminal=Dc;function lO(r){return(0,Ye.map)(r,za)}ke.serializeGrammar=lO;function za(r){function e(o){return(0,Ye.map)(o,za)}if(r instanceof q_){var t={type:"NonTerminal",name:r.nonTerminalName,idx:r.idx};return(0,Ye.isString)(r.label)&&(t.label=r.label),t}else{if(r instanceof G_)return{type:"Alternative",definition:e(r.definition)};if(r instanceof U_)return{type:"Option",idx:r.idx,definition:e(r.definition)};if(r instanceof H_)return{type:"RepetitionMandatory",idx:r.idx,definition:e(r.definition)};if(r instanceof W_)return{type:"RepetitionMandatoryWithSeparator",idx:r.idx,separator:za(new Dc({terminalType:r.separator})),definition:e(r.definition)};if(r instanceof B_)return{type:"RepetitionWithSeparator",idx:r.idx,separator:za(new Dc({terminalType:r.separator})),definition:e(r.definition)};if(r instanceof K_)return{type:"Repetition",idx:r.idx,definition:e(r.definition)};if(r instanceof z_)return{type:"Alternation",idx:r.idx,definition:e(r.definition)};if(r instanceof Dc){var n={type:"Terminal",name:r.terminalType.name,label:(0,cO.tokenLabel)(r.terminalType),idx:r.idx};(0,Ye.isString)(r.label)&&(n.terminalLabel=r.label);var i=r.terminalType.PATTERN;return r.terminalType.PATTERN&&(n.pattern=(0,Ye.isRegExp)(i)?i.source:i),n}else{if(r instanceof j_)return{type:"Rule",name:r.name,orgText:r.orgText,definition:e(r.definition)};throw Error("non exhaustive match")}}}ke.serializeProduction=za});var Ic=C(wc=>{"use strict";Object.defineProperty(wc,"__esModule",{value:!0});wc.RestWalker=void 0;var Km=_e(),pr=fr(),dO=function(){function r(){}return r.prototype.walk=function(e,t){var n=this;t===void 0&&(t=[]),(0,Km.forEach)(e.definition,function(i,o){var a=(0,Km.drop)(e.definition,o+1);if(i instanceof pr.NonTerminal)n.walkProdRef(i,a,t);else if(i instanceof pr.Terminal)n.walkTerminal(i,a,t);else if(i instanceof pr.Alternative)n.walkFlat(i,a,t);else if(i instanceof pr.Option)n.walkOption(i,a,t);else if(i instanceof pr.RepetitionMandatory)n.walkAtLeastOne(i,a,t);else if(i instanceof pr.RepetitionMandatoryWithSeparator)n.walkAtLeastOneSep(i,a,t);else if(i instanceof pr.RepetitionWithSeparator)n.walkManySep(i,a,t);else if(i instanceof pr.Repetition)n.walkMany(i,a,t);else if(i instanceof pr.Alternation)n.walkOr(i,a,t);else throw Error("non exhaustive match")})},r.prototype.walkTerminal=function(e,t,n){},r.prototype.walkProdRef=function(e,t,n){},r.prototype.walkFlat=function(e,t,n){var i=t.concat(n);this.walk(e,i)},r.prototype.walkOption=function(e,t,n){var i=t.concat(n);this.walk(e,i)},r.prototype.walkAtLeastOne=function(e,t,n){var i=[new pr.Option({definition:e.definition})].concat(t,n);this.walk(e,i)},r.prototype.walkAtLeastOneSep=function(e,t,n){var i=V_(e,t,n);this.walk(e,i)},r.prototype.walkMany=function(e,t,n){var i=[new pr.Option({definition:e.definition})].concat(t,n);this.walk(e,i)},r.prototype.walkManySep=function(e,t,n){var i=V_(e,t,n);this.walk(e,i)},r.prototype.walkOr=function(e,t,n){var i=this,o=t.concat(n);(0,Km.forEach)(e.definition,function(a){var s=new pr.Alternative({definition:[a]});i.walk(s,o)})},r}();wc.RestWalker=dO;function V_(r,e,t){var n=[new pr.Option({definition:[new pr.Terminal({terminalType:r.separator})].concat(r.definition)})],i=n.concat(e,t);return i}});var Uo=C(Oc=>{"use strict";Object.defineProperty(Oc,"__esModule",{value:!0});Oc.GAstVisitor=void 0;var Pn=fr(),fO=function(){function r(){}return r.prototype.visit=function(e){var t=e;switch(t.constructor){case Pn.NonTerminal:return this.visitNonTerminal(t);case Pn.Alternative:return this.visitAlternative(t);case Pn.Option:return this.visitOption(t);case Pn.RepetitionMandatory:return this.visitRepetitionMandatory(t);case Pn.RepetitionMandatoryWithSeparator:return this.visitRepetitionMandatoryWithSeparator(t);case Pn.RepetitionWithSeparator:return this.visitRepetitionWithSeparator(t);case Pn.Repetition:return this.visitRepetition(t);case Pn.Alternation:return this.visitAlternation(t);case Pn.Terminal:return this.visitTerminal(t);case Pn.Rule:return this.visitRule(t);default:throw Error("non exhaustive match")}},r.prototype.visitNonTerminal=function(e){},r.prototype.visitAlternative=function(e){},r.prototype.visitOption=function(e){},r.prototype.visitRepetition=function(e){},r.prototype.visitRepetitionMandatory=function(e){},r.prototype.visitRepetitionMandatoryWithSeparator=function(e){},r.prototype.visitRepetitionWithSeparator=function(e){},r.prototype.visitAlternation=function(e){},r.prototype.visitTerminal=function(e){},r.prototype.visitRule=function(e){},r}();Oc.GAstVisitor=fO});var Ya=C(Jt=>{"use strict";var pO=Jt&&Jt.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(Jt,"__esModule",{value:!0});Jt.collectMethods=Jt.DslMethodsCollectorVisitor=Jt.getProductionDslName=Jt.isBranchingProd=Jt.isOptionalProd=Jt.isSequenceProd=void 0;var Va=_e(),rt=fr(),mO=Uo();function hO(r){return r instanceof rt.Alternative||r instanceof rt.Option||r instanceof rt.Repetition||r instanceof rt.RepetitionMandatory||r instanceof rt.RepetitionMandatoryWithSeparator||r instanceof rt.RepetitionWithSeparator||r instanceof rt.Terminal||r instanceof rt.Rule}Jt.isSequenceProd=hO;function Bm(r,e){e===void 0&&(e=[]);var t=r instanceof rt.Option||r instanceof rt.Repetition||r instanceof rt.RepetitionWithSeparator;return t?!0:r instanceof rt.Alternation?(0,Va.some)(r.definition,function(n){return Bm(n,e)}):r instanceof rt.NonTerminal&&(0,Va.contains)(e,r)?!1:r instanceof rt.AbstractProduction?(r instanceof rt.NonTerminal&&e.push(r),(0,Va.every)(r.definition,function(n){return Bm(n,e)})):!1}Jt.isOptionalProd=Bm;function yO(r){return r instanceof rt.Alternation}Jt.isBranchingProd=yO;function gO(r){if(r instanceof rt.NonTerminal)return"SUBRULE";if(r instanceof rt.Option)return"OPTION";if(r instanceof rt.Alternation)return"OR";if(r instanceof rt.RepetitionMandatory)return"AT_LEAST_ONE";if(r instanceof rt.RepetitionMandatoryWithSeparator)return"AT_LEAST_ONE_SEP";if(r instanceof rt.RepetitionWithSeparator)return"MANY_SEP";if(r instanceof rt.Repetition)return"MANY";if(r instanceof rt.Terminal)return"CONSUME";throw Error("non exhaustive match")}Jt.getProductionDslName=gO;var Y_=function(r){pO(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.separator="-",t.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]},t}return e.prototype.reset=function(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}},e.prototype.visitTerminal=function(t){var n=t.terminalType.name+this.separator+"Terminal";(0,Va.has)(this.dslMethods,n)||(this.dslMethods[n]=[]),this.dslMethods[n].push(t)},e.prototype.visitNonTerminal=function(t){var n=t.nonTerminalName+this.separator+"Terminal";(0,Va.has)(this.dslMethods,n)||(this.dslMethods[n]=[]),this.dslMethods[n].push(t)},e.prototype.visitOption=function(t){this.dslMethods.option.push(t)},e.prototype.visitRepetitionWithSeparator=function(t){this.dslMethods.repetitionWithSeparator.push(t)},e.prototype.visitRepetitionMandatory=function(t){this.dslMethods.repetitionMandatory.push(t)},e.prototype.visitRepetitionMandatoryWithSeparator=function(t){this.dslMethods.repetitionMandatoryWithSeparator.push(t)},e.prototype.visitRepetition=function(t){this.dslMethods.repetition.push(t)},e.prototype.visitAlternation=function(t){this.dslMethods.alternation.push(t)},e}(mO.GAstVisitor);Jt.DslMethodsCollectorVisitor=Y_;var $c=new Y_;function vO(r){$c.reset(),r.accept($c);var e=$c.dslMethods;return $c.reset(),e}Jt.collectMethods=vO});var Vm=C(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});kn.firstForTerminal=kn.firstForBranching=kn.firstForSequence=kn.first=void 0;var Mc=_e(),X_=fr(),zm=Ya();function Lc(r){if(r instanceof X_.NonTerminal)return Lc(r.referencedRule);if(r instanceof X_.Terminal)return Q_(r);if((0,zm.isSequenceProd)(r))return J_(r);if((0,zm.isBranchingProd)(r))return Z_(r);throw Error("non exhaustive match")}kn.first=Lc;function J_(r){for(var e=[],t=r.definition,n=0,i=t.length>n,o,a=!0;i&&a;)o=t[n],a=(0,zm.isOptionalProd)(o),e=e.concat(Lc(o)),n=n+1,i=t.length>n;return(0,Mc.uniq)(e)}kn.firstForSequence=J_;function Z_(r){var e=(0,Mc.map)(r.definition,function(t){return Lc(t)});return(0,Mc.uniq)((0,Mc.flatten)(e))}kn.firstForBranching=Z_;function Q_(r){return[r.terminalType]}kn.firstForTerminal=Q_});var Ym=C(Fc=>{"use strict";Object.defineProperty(Fc,"__esModule",{value:!0});Fc.IN=void 0;Fc.IN="_~IN~_"});var iA=C(Ir=>{"use strict";var TO=Ir&&Ir.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(Ir,"__esModule",{value:!0});Ir.buildInProdFollowPrefix=Ir.buildBetweenProdsFollowPrefix=Ir.computeAllProdsFollows=Ir.ResyncFollowsWalker=void 0;var RO=Ic(),_O=Vm(),eA=_e(),tA=Ym(),AO=fr(),rA=function(r){TO(e,r);function e(t){var n=r.call(this)||this;return n.topProd=t,n.follows={},n}return e.prototype.startWalking=function(){return this.walk(this.topProd),this.follows},e.prototype.walkTerminal=function(t,n,i){},e.prototype.walkProdRef=function(t,n,i){var o=nA(t.referencedRule,t.idx)+this.topProd.name,a=n.concat(i),s=new AO.Alternative({definition:a}),u=(0,_O.first)(s);this.follows[o]=u},e}(RO.RestWalker);Ir.ResyncFollowsWalker=rA;function bO(r){var e={};return(0,eA.forEach)(r,function(t){var n=new rA(t).startWalking();(0,eA.assign)(e,n)}),e}Ir.computeAllProdsFollows=bO;function nA(r,e){return r.name+e+tA.IN}Ir.buildBetweenProdsFollowPrefix=nA;function EO(r){var e=r.terminalType.name;return e+r.idx+tA.IN}Ir.buildInProdFollowPrefix=EO});var Xa=C(Vn=>{"use strict";Object.defineProperty(Vn,"__esModule",{value:!0});Vn.defaultGrammarValidatorErrorProvider=Vn.defaultGrammarResolverErrorProvider=Vn.defaultParserErrorProvider=void 0;var Ho=vi(),CO=_e(),rn=_e(),Xm=fr(),oA=Ya();Vn.defaultParserErrorProvider={buildMismatchTokenMessage:function(r){var e=r.expected,t=r.actual,n=r.previous,i=r.ruleName,o=(0,Ho.hasTokenLabel)(e),a=o?"--> "+(0,Ho.tokenLabel)(e)+" <--":"token of type --> "+e.name+" <--",s="Expecting "+a+" but found --> '"+t.image+"' <--";return s},buildNotAllInputParsedMessage:function(r){var e=r.firstRedundant,t=r.ruleName;return"Redundant input, expecting EOF but found: "+e.image},buildNoViableAltMessage:function(r){var e=r.expectedPathsPerAlt,t=r.actual,n=r.previous,i=r.customUserDescription,o=r.ruleName,a="Expecting: ",s=(0,rn.first)(t).image,u=`
3635
3635
  but found: '`+s+"'";if(i)return a+i+u;var c=(0,rn.reduce)(e,function(y,p){return y.concat(p)},[]),l=(0,rn.map)(c,function(y){return"["+(0,rn.map)(y,function(p){return(0,Ho.tokenLabel)(p)}).join(", ")+"]"}),d=(0,rn.map)(l,function(y,p){return" "+(p+1)+". "+y}),g=`one of these possible Token sequences:
3636
3636
  `+d.join(`
3637
3637
  `);return a+g+u},buildEarlyExitMessage:function(r){var e=r.expectedIterationPaths,t=r.actual,n=r.customUserDescription,i=r.ruleName,o="Expecting: ",a=(0,rn.first)(t).image,s=`
3638
3638
  but found: '`+a+"'";if(n)return o+n+s;var u=(0,rn.map)(e,function(l){return"["+(0,rn.map)(l,function(d){return(0,Ho.tokenLabel)(d)}).join(",")+"]"}),c=`expecting at least one iteration which starts with one of these possible Token sequences::
3639
- `+("<"+u.join(" ,")+">");return o+c+s}};Object.freeze(Yn.defaultParserErrorProvider);Yn.defaultGrammarResolverErrorProvider={buildRuleNotFoundError:function(r,e){var t="Invalid grammar, reference to a rule which is not defined: ->"+e.nonTerminalName+`<-
3640
- inside top level rule: ->`+r.name+"<-";return t}};Yn.defaultGrammarValidatorErrorProvider={buildDuplicateFoundError:function(r,e){function t(l){return l instanceof Zm.Terminal?l.terminalType.name:l instanceof Zm.NonTerminal?l.nonTerminalName:""}var n=r.name,i=(0,rn.first)(e),o=i.idx,a=(0,sA.getProductionDslName)(i),s=t(i),u=o>0,c="->"+a+(u?o:"")+"<- "+(s?"with argument: ->"+s+"<-":"")+`
3639
+ `+("<"+u.join(" ,")+">");return o+c+s}};Object.freeze(Vn.defaultParserErrorProvider);Vn.defaultGrammarResolverErrorProvider={buildRuleNotFoundError:function(r,e){var t="Invalid grammar, reference to a rule which is not defined: ->"+e.nonTerminalName+`<-
3640
+ inside top level rule: ->`+r.name+"<-";return t}};Vn.defaultGrammarValidatorErrorProvider={buildDuplicateFoundError:function(r,e){function t(l){return l instanceof Xm.Terminal?l.terminalType.name:l instanceof Xm.NonTerminal?l.nonTerminalName:""}var n=r.name,i=(0,rn.first)(e),o=i.idx,a=(0,oA.getProductionDslName)(i),s=t(i),u=o>0,c="->"+a+(u?o:"")+"<- "+(s?"with argument: ->"+s+"<-":"")+`
3641
3641
  appears more than once (`+e.length+" times) in the top level rule: ->"+n+`<-.
3642
3642
  For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES
3643
3643
  `;return c=c.replace(/[ \t]+/g," "),c=c.replace(/\s\s+/g,`
@@ -3652,42 +3652,42 @@ and Non-Terminal names start with a lower case letter.`;return e},buildAlternati
3652
3652
  For Further details.`;return n},buildAlternationAmbiguityError:function(r){var e=(0,rn.map)(r.prefixPath,function(i){return(0,Ho.tokenLabel)(i)}).join(", "),t=r.alternation.idx===0?"":r.alternation.idx,n="Ambiguous Alternatives Detected: <"+r.ambiguityIndices.join(" ,")+"> in <OR"+t+">"+(" inside <"+r.topLevelRule.name+`> Rule,
3653
3653
  `)+("<"+e+`> may appears as a prefix path in all these alternatives.
3654
3654
  `);return n=n+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
3655
- For Further details.`,n},buildEmptyRepetitionError:function(r){var e=(0,sA.getProductionDslName)(r.repetition);r.repetition.idx!==0&&(e+=r.repetition.idx);var t="The repetition <"+e+"> within Rule <"+r.topLevelRule.name+`> can never consume any tokens.
3655
+ For Further details.`,n},buildEmptyRepetitionError:function(r){var e=(0,oA.getProductionDslName)(r.repetition);r.repetition.idx!==0&&(e+=r.repetition.idx);var t="The repetition <"+e+"> within Rule <"+r.topLevelRule.name+`> can never consume any tokens.
3656
3656
  This could lead to an infinite loop.`;return t},buildTokenNameError:function(r){return"deprecated"},buildEmptyAlternationError:function(r){var e="Ambiguous empty alternative: <"+(r.emptyChoiceIdx+1)+">"+(" in <OR"+r.alternation.idx+"> inside <"+r.topLevelRule.name+`> Rule.
3657
3657
  `)+"Only the last alternative may be an empty alternative.";return e},buildTooManyAlternativesError:function(r){var e=`An Alternation cannot have more than 256 alternatives:
3658
3658
  `+("<OR"+r.alternation.idx+"> inside <"+r.topLevelRule.name+`> Rule.
3659
- has `+(r.alternation.definition.length+1)+" alternatives.");return e},buildLeftRecursionError:function(r){var e=r.topLevelRule.name,t=xO.map(r.leftRecursionPath,function(o){return o.name}),n=e+" --> "+t.concat([e]).join(" --> "),i=`Left Recursion found in grammar.
3659
+ has `+(r.alternation.definition.length+1)+" alternatives.");return e},buildLeftRecursionError:function(r){var e=r.topLevelRule.name,t=CO.map(r.leftRecursionPath,function(o){return o.name}),n=e+" --> "+t.concat([e]).join(" --> "),i=`Left Recursion found in grammar.
3660
3660
  `+("rule: <"+e+`> can be invoked from itself (directly or indirectly)
3661
3661
  `)+(`without consuming any Tokens. The grammar path that causes this is:
3662
3662
  `+n+`
3663
3663
  `)+` To fix this refactor your grammar to remove the left recursion.
3664
- see: https://en.wikipedia.org/wiki/LL_parser#Left_Factoring.`;return i},buildInvalidRuleNameError:function(r){return"deprecated"},buildDuplicateRuleNameError:function(r){var e;r.topLevelRule instanceof Zm.Rule?e=r.topLevelRule.name:e=r.topLevelRule;var t="Duplicate definition, rule: ->"+e+"<- is already defined in the grammar: ->"+r.grammarName+"<-";return t}}});var lA=C(Ti=>{"use strict";var SO=Ti&&Ti.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(Ti,"__esModule",{value:!0});Ti.GastRefResolverVisitor=Ti.resolveGrammar=void 0;var NO=vr(),uA=_e(),DO=Uo();function wO(r,e){var t=new cA(r,e);return t.resolveRefs(),t.errors}Ti.resolveGrammar=wO;var cA=function(r){SO(e,r);function e(t,n){var i=r.call(this)||this;return i.nameToTopRule=t,i.errMsgProvider=n,i.errors=[],i}return e.prototype.resolveRefs=function(){var t=this;(0,uA.forEach)((0,uA.values)(this.nameToTopRule),function(n){t.currTopLevel=n,n.accept(t)})},e.prototype.visitNonTerminal=function(t){var n=this.nameToTopRule[t.nonTerminalName];if(n)t.referencedRule=n;else{var i=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,t);this.errors.push({message:i,type:NO.ParserDefinitionErrorType.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:t.nonTerminalName})}},e}(DO.GAstVisitor);Ti.GastRefResolverVisitor=cA});var Za=C(dt=>{"use strict";var Ki=dt&&dt.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(dt,"__esModule",{value:!0});dt.nextPossibleTokensAfter=dt.possiblePathsFrom=dt.NextTerminalAfterAtLeastOneSepWalker=dt.NextTerminalAfterAtLeastOneWalker=dt.NextTerminalAfterManySepWalker=dt.NextTerminalAfterManyWalker=dt.AbstractNextTerminalAfterProductionWalker=dt.NextAfterTokenWalker=dt.AbstractNextPossibleTokensWalker=void 0;var dA=Oc(),ye=_e(),IO=Xm(),se=fr(),fA=function(r){Ki(e,r);function e(t,n){var i=r.call(this)||this;return i.topProd=t,i.path=n,i.possibleTokTypes=[],i.nextProductionName="",i.nextProductionOccurrence=0,i.found=!1,i.isAtEndOfPath=!1,i}return e.prototype.startWalking=function(){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=(0,ye.cloneArr)(this.path.ruleStack).reverse(),this.occurrenceStack=(0,ye.cloneArr)(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes},e.prototype.walk=function(t,n){n===void 0&&(n=[]),this.found||r.prototype.walk.call(this,t,n)},e.prototype.walkProdRef=function(t,n,i){if(t.referencedRule.name===this.nextProductionName&&t.idx===this.nextProductionOccurrence){var o=n.concat(i);this.updateExpectedNext(),this.walk(t.referencedRule,o)}},e.prototype.updateExpectedNext=function(){(0,ye.isEmpty)(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())},e}(dA.RestWalker);dt.AbstractNextPossibleTokensWalker=fA;var OO=function(r){Ki(e,r);function e(t,n){var i=r.call(this,t,n)||this;return i.path=n,i.nextTerminalName="",i.nextTerminalOccurrence=0,i.nextTerminalName=i.path.lastTok.name,i.nextTerminalOccurrence=i.path.lastTokOccurrence,i}return e.prototype.walkTerminal=function(t,n,i){if(this.isAtEndOfPath&&t.terminalType.name===this.nextTerminalName&&t.idx===this.nextTerminalOccurrence&&!this.found){var o=n.concat(i),a=new se.Alternative({definition:o});this.possibleTokTypes=(0,IO.first)(a),this.found=!0}},e}(fA);dt.NextAfterTokenWalker=OO;var Ja=function(r){Ki(e,r);function e(t,n){var i=r.call(this)||this;return i.topRule=t,i.occurrence=n,i.result={token:void 0,occurrence:void 0,isEndOfRule:void 0},i}return e.prototype.startWalking=function(){return this.walk(this.topRule),this.result},e}(dA.RestWalker);dt.AbstractNextTerminalAfterProductionWalker=Ja;var $O=function(r){Ki(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.walkMany=function(t,n,i){if(t.idx===this.occurrence){var o=(0,ye.first)(n.concat(i));this.result.isEndOfRule=o===void 0,o instanceof se.Terminal&&(this.result.token=o.terminalType,this.result.occurrence=o.idx)}else r.prototype.walkMany.call(this,t,n,i)},e}(Ja);dt.NextTerminalAfterManyWalker=$O;var MO=function(r){Ki(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.walkManySep=function(t,n,i){if(t.idx===this.occurrence){var o=(0,ye.first)(n.concat(i));this.result.isEndOfRule=o===void 0,o instanceof se.Terminal&&(this.result.token=o.terminalType,this.result.occurrence=o.idx)}else r.prototype.walkManySep.call(this,t,n,i)},e}(Ja);dt.NextTerminalAfterManySepWalker=MO;var LO=function(r){Ki(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.walkAtLeastOne=function(t,n,i){if(t.idx===this.occurrence){var o=(0,ye.first)(n.concat(i));this.result.isEndOfRule=o===void 0,o instanceof se.Terminal&&(this.result.token=o.terminalType,this.result.occurrence=o.idx)}else r.prototype.walkAtLeastOne.call(this,t,n,i)},e}(Ja);dt.NextTerminalAfterAtLeastOneWalker=LO;var FO=function(r){Ki(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.walkAtLeastOneSep=function(t,n,i){if(t.idx===this.occurrence){var o=(0,ye.first)(n.concat(i));this.result.isEndOfRule=o===void 0,o instanceof se.Terminal&&(this.result.token=o.terminalType,this.result.occurrence=o.idx)}else r.prototype.walkAtLeastOneSep.call(this,t,n,i)},e}(Ja);dt.NextTerminalAfterAtLeastOneSepWalker=FO;function pA(r,e,t){t===void 0&&(t=[]),t=(0,ye.cloneArr)(t);var n=[],i=0;function o(c){return c.concat((0,ye.drop)(r,i+1))}function a(c){var l=pA(o(c),e,t);return n.concat(l)}for(;t.length<e&&i<r.length;){var s=r[i];if(s instanceof se.Alternative)return a(s.definition);if(s instanceof se.NonTerminal)return a(s.definition);if(s instanceof se.Option)n=a(s.definition);else if(s instanceof se.RepetitionMandatory){var u=s.definition.concat([new se.Repetition({definition:s.definition})]);return a(u)}else if(s instanceof se.RepetitionMandatoryWithSeparator){var u=[new se.Alternative({definition:s.definition}),new se.Repetition({definition:[new se.Terminal({terminalType:s.separator})].concat(s.definition)})];return a(u)}else if(s instanceof se.RepetitionWithSeparator){var u=s.definition.concat([new se.Repetition({definition:[new se.Terminal({terminalType:s.separator})].concat(s.definition)})]);n=a(u)}else if(s instanceof se.Repetition){var u=s.definition.concat([new se.Repetition({definition:s.definition})]);n=a(u)}else{if(s instanceof se.Alternation)return(0,ye.forEach)(s.definition,function(c){(0,ye.isEmpty)(c.definition)===!1&&(n=a(c.definition))}),n;if(s instanceof se.Terminal)t.push(s.terminalType);else throw Error("non exhaustive match")}i++}return n.push({partialPath:t,suffixDef:(0,ye.drop)(r,i)}),n}dt.possiblePathsFrom=pA;function qO(r,e,t,n){var i="EXIT_NONE_TERMINAL",o=[i],a="EXIT_ALTERNATIVE",s=!1,u=e.length,c=u-n-1,l=[],d=[];for(d.push({idx:-1,def:r,ruleStack:[],occurrenceStack:[]});!(0,ye.isEmpty)(d);){var g=d.pop();if(g===a){s&&(0,ye.last)(d).idx<=c&&d.pop();continue}var y=g.def,p=g.idx,A=g.ruleStack,x=g.occurrenceStack;if(!(0,ye.isEmpty)(y)){var k=y[0];if(k===i){var _={idx:p,def:(0,ye.drop)(y),ruleStack:(0,ye.dropRight)(A),occurrenceStack:(0,ye.dropRight)(x)};d.push(_)}else if(k instanceof se.Terminal)if(p<u-1){var R=p+1,D=e[R];if(t(D,k.terminalType)){var _={idx:R,def:(0,ye.drop)(y),ruleStack:A,occurrenceStack:x};d.push(_)}}else if(p===u-1)l.push({nextTokenType:k.terminalType,nextTokenOccurrence:k.idx,ruleStack:A,occurrenceStack:x}),s=!0;else throw Error("non exhaustive match");else if(k instanceof se.NonTerminal){var B=(0,ye.cloneArr)(A);B.push(k.nonTerminalName);var V=(0,ye.cloneArr)(x);V.push(k.idx);var _={idx:p,def:k.definition.concat(o,(0,ye.drop)(y)),ruleStack:B,occurrenceStack:V};d.push(_)}else if(k instanceof se.Option){var G={idx:p,def:(0,ye.drop)(y),ruleStack:A,occurrenceStack:x};d.push(G),d.push(a);var ge={idx:p,def:k.definition.concat((0,ye.drop)(y)),ruleStack:A,occurrenceStack:x};d.push(ge)}else if(k instanceof se.RepetitionMandatory){var je=new se.Repetition({definition:k.definition,idx:k.idx}),Ze=k.definition.concat([je],(0,ye.drop)(y)),_={idx:p,def:Ze,ruleStack:A,occurrenceStack:x};d.push(_)}else if(k instanceof se.RepetitionMandatoryWithSeparator){var Ge=new se.Terminal({terminalType:k.separator}),je=new se.Repetition({definition:[Ge].concat(k.definition),idx:k.idx}),Ze=k.definition.concat([je],(0,ye.drop)(y)),_={idx:p,def:Ze,ruleStack:A,occurrenceStack:x};d.push(_)}else if(k instanceof se.RepetitionWithSeparator){var G={idx:p,def:(0,ye.drop)(y),ruleStack:A,occurrenceStack:x};d.push(G),d.push(a);var Ge=new se.Terminal({terminalType:k.separator}),L=new se.Repetition({definition:[Ge].concat(k.definition),idx:k.idx}),Ze=k.definition.concat([L],(0,ye.drop)(y)),ge={idx:p,def:Ze,ruleStack:A,occurrenceStack:x};d.push(ge)}else if(k instanceof se.Repetition){var G={idx:p,def:(0,ye.drop)(y),ruleStack:A,occurrenceStack:x};d.push(G),d.push(a);var L=new se.Repetition({definition:k.definition,idx:k.idx}),Ze=k.definition.concat([L],(0,ye.drop)(y)),ge={idx:p,def:Ze,ruleStack:A,occurrenceStack:x};d.push(ge)}else if(k instanceof se.Alternation)for(var M=k.definition.length-1;M>=0;M--){var F=k.definition[M],K={idx:p,def:F.definition.concat((0,ye.drop)(y)),ruleStack:A,occurrenceStack:x};d.push(K),d.push(a)}else if(k instanceof se.Alternative)d.push({idx:p,def:k.definition.concat((0,ye.drop)(y)),ruleStack:A,occurrenceStack:x});else if(k instanceof se.Rule)d.push(jO(k,p,A,x));else throw Error("non exhaustive match")}}return l}dt.nextPossibleTokensAfter=qO;function jO(r,e,t,n){var i=(0,ye.cloneArr)(t);i.push(r.name);var o=(0,ye.cloneArr)(n);return o.push(1),{idx:e,def:r.definition,ruleStack:i,occurrenceStack:o}}});var Qa=C(we=>{"use strict";var yA=we&&we.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(we,"__esModule",{value:!0});we.areTokenCategoriesNotUsed=we.isStrictPrefixOfPath=we.containsPath=we.getLookaheadPathsForOptionalProd=we.getLookaheadPathsForOr=we.lookAheadSequenceFromAlternatives=we.buildSingleAlternativeLookaheadFunction=we.buildAlternativesLookAheadFunc=we.buildLookaheadFuncForOptionalProd=we.buildLookaheadFuncForOr=we.getProdType=we.PROD_TYPE=void 0;var Fe=_e(),mA=Za(),GO=Oc(),jc=Go(),Ri=fr(),UO=Uo(),kt;(function(r){r[r.OPTION=0]="OPTION",r[r.REPETITION=1]="REPETITION",r[r.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",r[r.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",r[r.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",r[r.ALTERNATION=5]="ALTERNATION"})(kt=we.PROD_TYPE||(we.PROD_TYPE={}));function HO(r){if(r instanceof Ri.Option)return kt.OPTION;if(r instanceof Ri.Repetition)return kt.REPETITION;if(r instanceof Ri.RepetitionMandatory)return kt.REPETITION_MANDATORY;if(r instanceof Ri.RepetitionMandatoryWithSeparator)return kt.REPETITION_MANDATORY_WITH_SEPARATOR;if(r instanceof Ri.RepetitionWithSeparator)return kt.REPETITION_WITH_SEPARATOR;if(r instanceof Ri.Alternation)return kt.ALTERNATION;throw Error("non exhaustive match")}we.getProdType=HO;function WO(r,e,t,n,i,o){var a=vA(r,e,t),s=th(a)?jc.tokenStructuredMatcherNoCategories:jc.tokenStructuredMatcher;return o(a,n,s,i)}we.buildLookaheadFuncForOr=WO;function KO(r,e,t,n,i,o){var a=TA(r,e,i,t),s=th(a)?jc.tokenStructuredMatcherNoCategories:jc.tokenStructuredMatcher;return o(a[0],s,n)}we.buildLookaheadFuncForOptionalProd=KO;function BO(r,e,t,n){var i=r.length,o=(0,Fe.every)(r,function(u){return(0,Fe.every)(u,function(c){return c.length===1})});if(e)return function(u){for(var c=(0,Fe.map)(u,function(R){return R.GATE}),l=0;l<i;l++){var d=r[l],g=d.length,y=c[l];if(y!==void 0&&y.call(this)===!1)continue;e:for(var p=0;p<g;p++){for(var A=d[p],x=A.length,k=0;k<x;k++){var _=this.LA(k+1);if(t(_,A[k])===!1)continue e}return l}}};if(o&&!n){var a=(0,Fe.map)(r,function(u){return(0,Fe.flatten)(u)}),s=(0,Fe.reduce)(a,function(u,c,l){return(0,Fe.forEach)(c,function(d){(0,Fe.has)(u,d.tokenTypeIdx)||(u[d.tokenTypeIdx]=l),(0,Fe.forEach)(d.categoryMatches,function(g){(0,Fe.has)(u,g)||(u[g]=l)})}),u},[]);return function(){var u=this.LA(1);return s[u.tokenTypeIdx]}}else return function(){for(var u=0;u<i;u++){var c=r[u],l=c.length;e:for(var d=0;d<l;d++){for(var g=c[d],y=g.length,p=0;p<y;p++){var A=this.LA(p+1);if(t(A,g[p])===!1)continue e}return u}}}}we.buildAlternativesLookAheadFunc=BO;function zO(r,e,t){var n=(0,Fe.every)(r,function(c){return c.length===1}),i=r.length;if(n&&!t){var o=(0,Fe.flatten)(r);if(o.length===1&&(0,Fe.isEmpty)(o[0].categoryMatches)){var a=o[0],s=a.tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===s}}else{var u=(0,Fe.reduce)(o,function(c,l,d){return c[l.tokenTypeIdx]=!0,(0,Fe.forEach)(l.categoryMatches,function(g){c[g]=!0}),c},[]);return function(){var c=this.LA(1);return u[c.tokenTypeIdx]===!0}}}else return function(){e:for(var c=0;c<i;c++){for(var l=r[c],d=l.length,g=0;g<d;g++){var y=this.LA(g+1);if(e(y,l[g])===!1)continue e}return!0}return!1}}we.buildSingleAlternativeLookaheadFunction=zO;var VO=function(r){yA(e,r);function e(t,n,i){var o=r.call(this)||this;return o.topProd=t,o.targetOccurrence=n,o.targetProdType=i,o}return e.prototype.startWalking=function(){return this.walk(this.topProd),this.restDef},e.prototype.checkIsTarget=function(t,n,i,o){return t.idx===this.targetOccurrence&&this.targetProdType===n?(this.restDef=i.concat(o),!0):!1},e.prototype.walkOption=function(t,n,i){this.checkIsTarget(t,kt.OPTION,n,i)||r.prototype.walkOption.call(this,t,n,i)},e.prototype.walkAtLeastOne=function(t,n,i){this.checkIsTarget(t,kt.REPETITION_MANDATORY,n,i)||r.prototype.walkOption.call(this,t,n,i)},e.prototype.walkAtLeastOneSep=function(t,n,i){this.checkIsTarget(t,kt.REPETITION_MANDATORY_WITH_SEPARATOR,n,i)||r.prototype.walkOption.call(this,t,n,i)},e.prototype.walkMany=function(t,n,i){this.checkIsTarget(t,kt.REPETITION,n,i)||r.prototype.walkOption.call(this,t,n,i)},e.prototype.walkManySep=function(t,n,i){this.checkIsTarget(t,kt.REPETITION_WITH_SEPARATOR,n,i)||r.prototype.walkOption.call(this,t,n,i)},e}(GO.RestWalker),gA=function(r){yA(e,r);function e(t,n,i){var o=r.call(this)||this;return o.targetOccurrence=t,o.targetProdType=n,o.targetRef=i,o.result=[],o}return e.prototype.checkIsTarget=function(t,n){t.idx===this.targetOccurrence&&this.targetProdType===n&&(this.targetRef===void 0||t===this.targetRef)&&(this.result=t.definition)},e.prototype.visitOption=function(t){this.checkIsTarget(t,kt.OPTION)},e.prototype.visitRepetition=function(t){this.checkIsTarget(t,kt.REPETITION)},e.prototype.visitRepetitionMandatory=function(t){this.checkIsTarget(t,kt.REPETITION_MANDATORY)},e.prototype.visitRepetitionMandatoryWithSeparator=function(t){this.checkIsTarget(t,kt.REPETITION_MANDATORY_WITH_SEPARATOR)},e.prototype.visitRepetitionWithSeparator=function(t){this.checkIsTarget(t,kt.REPETITION_WITH_SEPARATOR)},e.prototype.visitAlternation=function(t){this.checkIsTarget(t,kt.ALTERNATION)},e}(UO.GAstVisitor);function hA(r){for(var e=new Array(r),t=0;t<r;t++)e[t]=[];return e}function Qm(r){for(var e=[""],t=0;t<r.length;t++){for(var n=r[t],i=[],o=0;o<e.length;o++){var a=e[o];i.push(a+"_"+n.tokenTypeIdx);for(var s=0;s<n.categoryMatches.length;s++){var u="_"+n.categoryMatches[s];i.push(a+u)}}e=i}return e}function YO(r,e,t){for(var n=0;n<r.length;n++)if(n!==t)for(var i=r[n],o=0;o<e.length;o++){var a=e[o];if(i[a]===!0)return!1}return!0}function eh(r,e){for(var t=(0,Fe.map)(r,function(l){return(0,mA.possiblePathsFrom)([l],1)}),n=hA(t.length),i=(0,Fe.map)(t,function(l){var d={};return(0,Fe.forEach)(l,function(g){var y=Qm(g.partialPath);(0,Fe.forEach)(y,function(p){d[p]=!0})}),d}),o=t,a=1;a<=e;a++){var s=o;o=hA(s.length);for(var u=function(l){for(var d=s[l],g=0;g<d.length;g++){var y=d[g].partialPath,p=d[g].suffixDef,A=Qm(y),x=YO(i,A,l);if(x||(0,Fe.isEmpty)(p)||y.length===e){var k=n[l];if(RA(k,y)===!1){k.push(y);for(var _=0;_<A.length;_++){var R=A[_];i[l][R]=!0}}}else{var D=(0,mA.possiblePathsFrom)(p,a+1,y);o[l]=o[l].concat(D),(0,Fe.forEach)(D,function(B){var V=Qm(B.partialPath);(0,Fe.forEach)(V,function(G){i[l][G]=!0})})}}},c=0;c<s.length;c++)u(c)}return n}we.lookAheadSequenceFromAlternatives=eh;function vA(r,e,t,n){var i=new gA(r,kt.ALTERNATION,n);return e.accept(i),eh(i.result,t)}we.getLookaheadPathsForOr=vA;function TA(r,e,t,n){var i=new gA(r,t);e.accept(i);var o=i.result,a=new VO(e,r,t),s=a.startWalking(),u=new Ri.Alternative({definition:o}),c=new Ri.Alternative({definition:s});return eh([u,c],n)}we.getLookaheadPathsForOptionalProd=TA;function RA(r,e){e:for(var t=0;t<r.length;t++){var n=r[t];if(n.length===e.length){for(var i=0;i<n.length;i++){var o=e[i],a=n[i],s=o===a||a.categoryMatchesMap[o.tokenTypeIdx]!==void 0;if(s===!1)continue e}return!0}}return!1}we.containsPath=RA;function XO(r,e){return r.length<e.length&&(0,Fe.every)(r,function(t,n){var i=e[n];return t===i||i.categoryMatchesMap[t.tokenTypeIdx]})}we.isStrictPrefixOfPath=XO;function th(r){return(0,Fe.every)(r,function(e){return(0,Fe.every)(e,function(t){return(0,Fe.every)(t,function(n){return(0,Fe.isEmpty)(n.categoryMatches)})})})}we.areTokenCategoriesNotUsed=th});var sh=C(xe=>{"use strict";var rh=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(xe,"__esModule",{value:!0});xe.checkPrefixAlternativesAmbiguities=xe.validateSomeNonEmptyLookaheadPath=xe.validateTooManyAlts=xe.RepetionCollector=xe.validateAmbiguousAlternationAlternatives=xe.validateEmptyOrAlternative=xe.getFirstNoneTerminal=xe.validateNoLeftRecursion=xe.validateRuleIsOverridden=xe.validateRuleDoesNotAlreadyExist=xe.OccurrenceValidationCollector=xe.identifyProductionForDuplicates=xe.validateGrammar=void 0;var Ie=_e(),nt=_e(),xn=vr(),nh=Ya(),Wo=Qa(),JO=Za(),nn=fr(),ih=Uo();function ZO(r,e,t,n,i){var o=Ie.map(r,function(y){return QO(y,n)}),a=Ie.map(r,function(y){return oh(y,y,n)}),s=[],u=[],c=[];(0,nt.every)(a,nt.isEmpty)&&(s=(0,nt.map)(r,function(y){return CA(y,n)}),u=(0,nt.map)(r,function(y){return PA(y,e,n)}),c=SA(r,e,n));var l=r$(r,t,n),d=(0,nt.map)(r,function(y){return xA(y,n)}),g=(0,nt.map)(r,function(y){return EA(y,r,i,n)});return Ie.flatten(o.concat(c,a,s,u,l,d,g))}xe.validateGrammar=ZO;function QO(r,e){var t=new bA;r.accept(t);var n=t.allProductions,i=Ie.groupBy(n,_A),o=Ie.pick(i,function(s){return s.length>1}),a=Ie.map(Ie.values(o),function(s){var u=Ie.first(s),c=e.buildDuplicateFoundError(r,s),l=(0,nh.getProductionDslName)(u),d={message:c,type:xn.ParserDefinitionErrorType.DUPLICATE_PRODUCTIONS,ruleName:r.name,dslName:l,occurrence:u.idx},g=AA(u);return g&&(d.parameter=g),d});return a}function _A(r){return(0,nh.getProductionDslName)(r)+"_#_"+r.idx+"_#_"+AA(r)}xe.identifyProductionForDuplicates=_A;function AA(r){return r instanceof nn.Terminal?r.terminalType.name:r instanceof nn.NonTerminal?r.nonTerminalName:""}var bA=function(r){rh(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.allProductions=[],t}return e.prototype.visitNonTerminal=function(t){this.allProductions.push(t)},e.prototype.visitOption=function(t){this.allProductions.push(t)},e.prototype.visitRepetitionWithSeparator=function(t){this.allProductions.push(t)},e.prototype.visitRepetitionMandatory=function(t){this.allProductions.push(t)},e.prototype.visitRepetitionMandatoryWithSeparator=function(t){this.allProductions.push(t)},e.prototype.visitRepetition=function(t){this.allProductions.push(t)},e.prototype.visitAlternation=function(t){this.allProductions.push(t)},e.prototype.visitTerminal=function(t){this.allProductions.push(t)},e}(ih.GAstVisitor);xe.OccurrenceValidationCollector=bA;function EA(r,e,t,n){var i=[],o=(0,nt.reduce)(e,function(s,u){return u.name===r.name?s+1:s},0);if(o>1){var a=n.buildDuplicateRuleNameError({topLevelRule:r,grammarName:t});i.push({message:a,type:xn.ParserDefinitionErrorType.DUPLICATE_RULE_NAME,ruleName:r.name})}return i}xe.validateRuleDoesNotAlreadyExist=EA;function e$(r,e,t){var n=[],i;return Ie.contains(e,r)||(i="Invalid rule override, rule: ->"+r+"<- cannot be overridden in the grammar: ->"+t+"<-as it is not defined in any of the super grammars ",n.push({message:i,type:xn.ParserDefinitionErrorType.INVALID_RULE_OVERRIDE,ruleName:r})),n}xe.validateRuleIsOverridden=e$;function oh(r,e,t,n){n===void 0&&(n=[]);var i=[],o=es(e.definition);if(Ie.isEmpty(o))return[];var a=r.name,s=Ie.contains(o,r);s&&i.push({message:t.buildLeftRecursionError({topLevelRule:r,leftRecursionPath:n}),type:xn.ParserDefinitionErrorType.LEFT_RECURSION,ruleName:a});var u=Ie.difference(o,n.concat([r])),c=Ie.map(u,function(l){var d=Ie.cloneArr(n);return d.push(l),oh(r,l,t,d)});return i.concat(Ie.flatten(c))}xe.validateNoLeftRecursion=oh;function es(r){var e=[];if(Ie.isEmpty(r))return e;var t=Ie.first(r);if(t instanceof nn.NonTerminal)e.push(t.referencedRule);else if(t instanceof nn.Alternative||t instanceof nn.Option||t instanceof nn.RepetitionMandatory||t instanceof nn.RepetitionMandatoryWithSeparator||t instanceof nn.RepetitionWithSeparator||t instanceof nn.Repetition)e=e.concat(es(t.definition));else if(t instanceof nn.Alternation)e=Ie.flatten(Ie.map(t.definition,function(a){return es(a.definition)}));else if(!(t instanceof nn.Terminal))throw Error("non exhaustive match");var n=(0,nh.isOptionalProd)(t),i=r.length>1;if(n&&i){var o=Ie.drop(r);return e.concat(es(o))}else return e}xe.getFirstNoneTerminal=es;var ah=function(r){rh(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.alternations=[],t}return e.prototype.visitAlternation=function(t){this.alternations.push(t)},e}(ih.GAstVisitor);function CA(r,e){var t=new ah;r.accept(t);var n=t.alternations,i=Ie.reduce(n,function(o,a){var s=Ie.dropRight(a.definition),u=Ie.map(s,function(c,l){var d=(0,JO.nextPossibleTokensAfter)([c],[],null,1);return Ie.isEmpty(d)?{message:e.buildEmptyAlternationError({topLevelRule:r,alternation:a,emptyChoiceIdx:l}),type:xn.ParserDefinitionErrorType.NONE_LAST_EMPTY_ALT,ruleName:r.name,occurrence:a.idx,alternative:l+1}:null});return o.concat(Ie.compact(u))},[]);return i}xe.validateEmptyOrAlternative=CA;function PA(r,e,t){var n=new ah;r.accept(n);var i=n.alternations;i=(0,nt.reject)(i,function(a){return a.ignoreAmbiguities===!0});var o=Ie.reduce(i,function(a,s){var u=s.idx,c=s.maxLookahead||e,l=(0,Wo.getLookaheadPathsForOr)(u,r,c,s),d=t$(l,s,r,t),g=NA(l,s,r,t);return a.concat(d,g)},[]);return o}xe.validateAmbiguousAlternationAlternatives=PA;var kA=function(r){rh(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.allProductions=[],t}return e.prototype.visitRepetitionWithSeparator=function(t){this.allProductions.push(t)},e.prototype.visitRepetitionMandatory=function(t){this.allProductions.push(t)},e.prototype.visitRepetitionMandatoryWithSeparator=function(t){this.allProductions.push(t)},e.prototype.visitRepetition=function(t){this.allProductions.push(t)},e}(ih.GAstVisitor);xe.RepetionCollector=kA;function xA(r,e){var t=new ah;r.accept(t);var n=t.alternations,i=Ie.reduce(n,function(o,a){return a.definition.length>255&&o.push({message:e.buildTooManyAlternativesError({topLevelRule:r,alternation:a}),type:xn.ParserDefinitionErrorType.TOO_MANY_ALTS,ruleName:r.name,occurrence:a.idx}),o},[]);return i}xe.validateTooManyAlts=xA;function SA(r,e,t){var n=[];return(0,nt.forEach)(r,function(i){var o=new kA;i.accept(o);var a=o.allProductions;(0,nt.forEach)(a,function(s){var u=(0,Wo.getProdType)(s),c=s.maxLookahead||e,l=s.idx,d=(0,Wo.getLookaheadPathsForOptionalProd)(l,i,u,c),g=d[0];if((0,nt.isEmpty)((0,nt.flatten)(g))){var y=t.buildEmptyRepetitionError({topLevelRule:i,repetition:s});n.push({message:y,type:xn.ParserDefinitionErrorType.NO_NON_EMPTY_LOOKAHEAD,ruleName:i.name})}})}),n}xe.validateSomeNonEmptyLookaheadPath=SA;function t$(r,e,t,n){var i=[],o=(0,nt.reduce)(r,function(s,u,c){return e.definition[c].ignoreAmbiguities===!0||(0,nt.forEach)(u,function(l){var d=[c];(0,nt.forEach)(r,function(g,y){c!==y&&(0,Wo.containsPath)(g,l)&&e.definition[y].ignoreAmbiguities!==!0&&d.push(y)}),d.length>1&&!(0,Wo.containsPath)(i,l)&&(i.push(l),s.push({alts:d,path:l}))}),s},[]),a=Ie.map(o,function(s){var u=(0,nt.map)(s.alts,function(l){return l+1}),c=n.buildAlternationAmbiguityError({topLevelRule:t,alternation:e,ambiguityIndices:u,prefixPath:s.path});return{message:c,type:xn.ParserDefinitionErrorType.AMBIGUOUS_ALTS,ruleName:t.name,occurrence:e.idx,alternatives:[s.alts]}});return a}function NA(r,e,t,n){var i=[],o=(0,nt.reduce)(r,function(a,s,u){var c=(0,nt.map)(s,function(l){return{idx:u,path:l}});return a.concat(c)},[]);return(0,nt.forEach)(o,function(a){var s=e.definition[a.idx];if(s.ignoreAmbiguities!==!0){var u=a.idx,c=a.path,l=(0,nt.findAll)(o,function(g){return e.definition[g.idx].ignoreAmbiguities!==!0&&g.idx<u&&(0,Wo.isStrictPrefixOfPath)(g.path,c)}),d=(0,nt.map)(l,function(g){var y=[g.idx+1,u+1],p=e.idx===0?"":e.idx,A=n.buildAlternationPrefixAmbiguityError({topLevelRule:t,alternation:e,ambiguityIndices:y,prefixPath:g.path});return{message:A,type:xn.ParserDefinitionErrorType.AMBIGUOUS_PREFIX_ALTS,ruleName:t.name,occurrence:p,alternatives:y}});i=i.concat(d)}}),i}xe.checkPrefixAlternativesAmbiguities=NA;function r$(r,e,t){var n=[],i=(0,nt.map)(e,function(o){return o.name});return(0,nt.forEach)(r,function(o){var a=o.name;if((0,nt.contains)(i,a)){var s=t.buildNamespaceConflictError(o);n.push({message:s,type:xn.ParserDefinitionErrorType.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:a})}}),n}});var wA=C(Ko=>{"use strict";Object.defineProperty(Ko,"__esModule",{value:!0});Ko.validateGrammar=Ko.resolveGrammar=void 0;var uh=_e(),n$=lA(),i$=sh(),DA=Xa();function o$(r){r=(0,uh.defaults)(r,{errMsgProvider:DA.defaultGrammarResolverErrorProvider});var e={};return(0,uh.forEach)(r.rules,function(t){e[t.name]=t}),(0,n$.resolveGrammar)(e,r.errMsgProvider)}Ko.resolveGrammar=o$;function a$(r){return r=(0,uh.defaults)(r,{errMsgProvider:DA.defaultGrammarValidatorErrorProvider}),(0,i$.validateGrammar)(r.rules,r.maxLookahead,r.tokenTypes,r.errMsgProvider,r.grammarName)}Ko.validateGrammar=a$});var Bo=C(mr=>{"use strict";var ts=mr&&mr.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(mr,"__esModule",{value:!0});mr.EarlyExitException=mr.NotAllInputParsedException=mr.NoViableAltException=mr.MismatchedTokenException=mr.isRecognitionException=void 0;var s$=_e(),IA="MismatchedTokenException",OA="NoViableAltException",$A="EarlyExitException",MA="NotAllInputParsedException",LA=[IA,OA,$A,MA];Object.freeze(LA);function u$(r){return(0,s$.contains)(LA,r.name)}mr.isRecognitionException=u$;var Gc=function(r){ts(e,r);function e(t,n){var i=this.constructor,o=r.call(this,t)||this;return o.token=n,o.resyncedTokens=[],Object.setPrototypeOf(o,i.prototype),Error.captureStackTrace&&Error.captureStackTrace(o,o.constructor),o}return e}(Error),c$=function(r){ts(e,r);function e(t,n,i){var o=r.call(this,t,n)||this;return o.previousToken=i,o.name=IA,o}return e}(Gc);mr.MismatchedTokenException=c$;var l$=function(r){ts(e,r);function e(t,n,i){var o=r.call(this,t,n)||this;return o.previousToken=i,o.name=OA,o}return e}(Gc);mr.NoViableAltException=l$;var d$=function(r){ts(e,r);function e(t,n){var i=r.call(this,t,n)||this;return i.name=MA,i}return e}(Gc);mr.NotAllInputParsedException=d$;var f$=function(r){ts(e,r);function e(t,n,i){var o=r.call(this,t,n)||this;return o.previousToken=i,o.name=$A,o}return e}(Gc);mr.EarlyExitException=f$});var lh=C(Zt=>{"use strict";Object.defineProperty(Zt,"__esModule",{value:!0});Zt.attemptInRepetitionRecovery=Zt.Recoverable=Zt.InRuleRecoveryException=Zt.IN_RULE_RECOVERY_EXCEPTION=Zt.EOF_FOLLOW_KEY=void 0;var Uc=vi(),Or=_e(),p$=Bo(),m$=Jm(),h$=vr();Zt.EOF_FOLLOW_KEY={};Zt.IN_RULE_RECOVERY_EXCEPTION="InRuleRecoveryException";function ch(r){this.name=Zt.IN_RULE_RECOVERY_EXCEPTION,this.message=r}Zt.InRuleRecoveryException=ch;ch.prototype=Error.prototype;var y$=function(){function r(){}return r.prototype.initRecoverable=function(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=(0,Or.has)(e,"recoveryEnabled")?e.recoveryEnabled:h$.DEFAULT_PARSER_CONFIG.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=FA)},r.prototype.getTokenToInsert=function(e){var t=(0,Uc.createTokenInstance)(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return t.isInsertedInRecovery=!0,t},r.prototype.canTokenTypeBeInsertedInRecovery=function(e){return!0},r.prototype.tryInRepetitionRecovery=function(e,t,n,i){for(var o=this,a=this.findReSyncTokenType(),s=this.exportLexerState(),u=[],c=!1,l=this.LA(1),d=this.LA(1),g=function(){var y=o.LA(0),p=o.errorMessageProvider.buildMismatchTokenMessage({expected:i,actual:l,previous:y,ruleName:o.getCurrRuleFullName()}),A=new p$.MismatchedTokenException(p,l,o.LA(0));A.resyncedTokens=(0,Or.dropRight)(u),o.SAVE_ERROR(A)};!c;)if(this.tokenMatcher(d,i)){g();return}else if(n.call(this)){g(),e.apply(this,t);return}else this.tokenMatcher(d,a)?c=!0:(d=this.SKIP_TOKEN(),this.addToResyncTokens(d,u));this.importLexerState(s)},r.prototype.shouldInRepetitionRecoveryBeTried=function(e,t,n){return!(n===!1||e===void 0||t===void 0||this.tokenMatcher(this.LA(1),e)||this.isBackTracking()||this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,t)))},r.prototype.getFollowsForInRuleRecovery=function(e,t){var n=this.getCurrentGrammarPath(e,t),i=this.getNextPossibleTokenTypes(n);return i},r.prototype.tryInRuleRecovery=function(e,t){if(this.canRecoverWithSingleTokenInsertion(e,t)){var n=this.getTokenToInsert(e);return n}if(this.canRecoverWithSingleTokenDeletion(e)){var i=this.SKIP_TOKEN();return this.consumeToken(),i}throw new ch("sad sad panda")},r.prototype.canPerformInRuleRecovery=function(e,t){return this.canRecoverWithSingleTokenInsertion(e,t)||this.canRecoverWithSingleTokenDeletion(e)},r.prototype.canRecoverWithSingleTokenInsertion=function(e,t){var n=this;if(!this.canTokenTypeBeInsertedInRecovery(e)||(0,Or.isEmpty)(t))return!1;var i=this.LA(1),o=(0,Or.find)(t,function(a){return n.tokenMatcher(i,a)})!==void 0;return o},r.prototype.canRecoverWithSingleTokenDeletion=function(e){var t=this.tokenMatcher(this.LA(2),e);return t},r.prototype.isInCurrentRuleReSyncSet=function(e){var t=this.getCurrFollowKey(),n=this.getFollowSetFromFollowKey(t);return(0,Or.contains)(n,e)},r.prototype.findReSyncTokenType=function(){for(var e=this.flattenFollowSet(),t=this.LA(1),n=2;;){var i=t.tokenType;if((0,Or.contains)(e,i))return i;t=this.LA(n),n++}},r.prototype.getCurrFollowKey=function(){if(this.RULE_STACK.length===1)return Zt.EOF_FOLLOW_KEY;var e=this.getLastExplicitRuleShortName(),t=this.getLastExplicitRuleOccurrenceIndex(),n=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:t,inRule:this.shortRuleNameToFullName(n)}},r.prototype.buildFullFollowKeyStack=function(){var e=this,t=this.RULE_STACK,n=this.RULE_OCCURRENCE_STACK;return(0,Or.map)(t,function(i,o){return o===0?Zt.EOF_FOLLOW_KEY:{ruleName:e.shortRuleNameToFullName(i),idxInCallingRule:n[o],inRule:e.shortRuleNameToFullName(t[o-1])}})},r.prototype.flattenFollowSet=function(){var e=this,t=(0,Or.map)(this.buildFullFollowKeyStack(),function(n){return e.getFollowSetFromFollowKey(n)});return(0,Or.flatten)(t)},r.prototype.getFollowSetFromFollowKey=function(e){if(e===Zt.EOF_FOLLOW_KEY)return[Uc.EOF];var t=e.ruleName+e.idxInCallingRule+m$.IN+e.inRule;return this.resyncFollows[t]},r.prototype.addToResyncTokens=function(e,t){return this.tokenMatcher(e,Uc.EOF)||t.push(e),t},r.prototype.reSyncTo=function(e){for(var t=[],n=this.LA(1);this.tokenMatcher(n,e)===!1;)n=this.SKIP_TOKEN(),this.addToResyncTokens(n,t);return(0,Or.dropRight)(t)},r.prototype.attemptInRepetitionRecovery=function(e,t,n,i,o,a,s){},r.prototype.getCurrentGrammarPath=function(e,t){var n=this.getHumanReadableRuleStack(),i=(0,Or.cloneArr)(this.RULE_OCCURRENCE_STACK),o={ruleStack:n,occurrenceStack:i,lastTok:e,lastTokOccurrence:t};return o},r.prototype.getHumanReadableRuleStack=function(){var e=this;return(0,Or.map)(this.RULE_STACK,function(t){return e.shortRuleNameToFullName(t)})},r}();Zt.Recoverable=y$;function FA(r,e,t,n,i,o,a){var s=this.getKeyForAutomaticLookahead(n,i),u=this.firstAfterRepMap[s];if(u===void 0){var c=this.getCurrRuleFullName(),l=this.getGAstProductions()[c],d=new o(l,i);u=d.startWalking(),this.firstAfterRepMap[s]=u}var g=u.token,y=u.occurrence,p=u.isEndOfRule;this.RULE_STACK.length===1&&p&&g===void 0&&(g=Uc.EOF,y=1),this.shouldInRepetitionRecoveryBeTried(g,y,a)&&this.tryInRepetitionRecovery(r,e,t,g)}Zt.attemptInRepetitionRecovery=FA});var Hc=C(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.getKeyForAutomaticLookahead=Ce.AT_LEAST_ONE_SEP_IDX=Ce.MANY_SEP_IDX=Ce.AT_LEAST_ONE_IDX=Ce.MANY_IDX=Ce.OPTION_IDX=Ce.OR_IDX=Ce.BITS_FOR_ALT_IDX=Ce.BITS_FOR_RULE_IDX=Ce.BITS_FOR_OCCURRENCE_IDX=Ce.BITS_FOR_METHOD_TYPE=void 0;Ce.BITS_FOR_METHOD_TYPE=4;Ce.BITS_FOR_OCCURRENCE_IDX=8;Ce.BITS_FOR_RULE_IDX=12;Ce.BITS_FOR_ALT_IDX=8;Ce.OR_IDX=1<<Ce.BITS_FOR_OCCURRENCE_IDX;Ce.OPTION_IDX=2<<Ce.BITS_FOR_OCCURRENCE_IDX;Ce.MANY_IDX=3<<Ce.BITS_FOR_OCCURRENCE_IDX;Ce.AT_LEAST_ONE_IDX=4<<Ce.BITS_FOR_OCCURRENCE_IDX;Ce.MANY_SEP_IDX=5<<Ce.BITS_FOR_OCCURRENCE_IDX;Ce.AT_LEAST_ONE_SEP_IDX=6<<Ce.BITS_FOR_OCCURRENCE_IDX;function g$(r,e,t){return t|e|r}Ce.getKeyForAutomaticLookahead=g$;var mj=32-Ce.BITS_FOR_ALT_IDX});var jA=C(Wc=>{"use strict";Object.defineProperty(Wc,"__esModule",{value:!0});Wc.LooksAhead=void 0;var Xn=Qa(),on=_e(),qA=vr(),Jn=Hc(),Bi=Ya(),v$=function(){function r(){}return r.prototype.initLooksAhead=function(e){this.dynamicTokensEnabled=(0,on.has)(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:qA.DEFAULT_PARSER_CONFIG.dynamicTokensEnabled,this.maxLookahead=(0,on.has)(e,"maxLookahead")?e.maxLookahead:qA.DEFAULT_PARSER_CONFIG.maxLookahead,this.lookAheadFuncsCache=(0,on.isES2015MapSupported)()?new Map:[],(0,on.isES2015MapSupported)()?(this.getLaFuncFromCache=this.getLaFuncFromMap,this.setLaFuncCache=this.setLaFuncCacheUsingMap):(this.getLaFuncFromCache=this.getLaFuncFromObj,this.setLaFuncCache=this.setLaFuncUsingObj)},r.prototype.preComputeLookaheadFunctions=function(e){var t=this;(0,on.forEach)(e,function(n){t.TRACE_INIT(n.name+" Rule Lookahead",function(){var i=(0,Bi.collectMethods)(n),o=i.alternation,a=i.repetition,s=i.option,u=i.repetitionMandatory,c=i.repetitionMandatoryWithSeparator,l=i.repetitionWithSeparator;(0,on.forEach)(o,function(d){var g=d.idx===0?"":d.idx;t.TRACE_INIT(""+(0,Bi.getProductionDslName)(d)+g,function(){var y=(0,Xn.buildLookaheadFuncForOr)(d.idx,n,d.maxLookahead||t.maxLookahead,d.hasPredicates,t.dynamicTokensEnabled,t.lookAheadBuilderForAlternatives),p=(0,Jn.getKeyForAutomaticLookahead)(t.fullRuleNameToShort[n.name],Jn.OR_IDX,d.idx);t.setLaFuncCache(p,y)})}),(0,on.forEach)(a,function(d){t.computeLookaheadFunc(n,d.idx,Jn.MANY_IDX,Xn.PROD_TYPE.REPETITION,d.maxLookahead,(0,Bi.getProductionDslName)(d))}),(0,on.forEach)(s,function(d){t.computeLookaheadFunc(n,d.idx,Jn.OPTION_IDX,Xn.PROD_TYPE.OPTION,d.maxLookahead,(0,Bi.getProductionDslName)(d))}),(0,on.forEach)(u,function(d){t.computeLookaheadFunc(n,d.idx,Jn.AT_LEAST_ONE_IDX,Xn.PROD_TYPE.REPETITION_MANDATORY,d.maxLookahead,(0,Bi.getProductionDslName)(d))}),(0,on.forEach)(c,function(d){t.computeLookaheadFunc(n,d.idx,Jn.AT_LEAST_ONE_SEP_IDX,Xn.PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR,d.maxLookahead,(0,Bi.getProductionDslName)(d))}),(0,on.forEach)(l,function(d){t.computeLookaheadFunc(n,d.idx,Jn.MANY_SEP_IDX,Xn.PROD_TYPE.REPETITION_WITH_SEPARATOR,d.maxLookahead,(0,Bi.getProductionDslName)(d))})})})},r.prototype.computeLookaheadFunc=function(e,t,n,i,o,a){var s=this;this.TRACE_INIT(""+a+(t===0?"":t),function(){var u=(0,Xn.buildLookaheadFuncForOptionalProd)(t,e,o||s.maxLookahead,s.dynamicTokensEnabled,i,s.lookAheadBuilderForOptional),c=(0,Jn.getKeyForAutomaticLookahead)(s.fullRuleNameToShort[e.name],n,t);s.setLaFuncCache(c,u)})},r.prototype.lookAheadBuilderForOptional=function(e,t,n){return(0,Xn.buildSingleAlternativeLookaheadFunction)(e,t,n)},r.prototype.lookAheadBuilderForAlternatives=function(e,t,n,i){return(0,Xn.buildAlternativesLookAheadFunc)(e,t,n,i)},r.prototype.getKeyForAutomaticLookahead=function(e,t){var n=this.getLastExplicitRuleShortName();return(0,Jn.getKeyForAutomaticLookahead)(n,e,t)},r.prototype.getLaFuncFromCache=function(e){},r.prototype.getLaFuncFromMap=function(e){return this.lookAheadFuncsCache.get(e)},r.prototype.getLaFuncFromObj=function(e){return this.lookAheadFuncsCache[e]},r.prototype.setLaFuncCache=function(e,t){},r.prototype.setLaFuncCacheUsingMap=function(e,t){this.lookAheadFuncsCache.set(e,t)},r.prototype.setLaFuncUsingObj=function(e,t){this.lookAheadFuncsCache[e]=t},r}();Wc.LooksAhead=v$});var GA=C(Sn=>{"use strict";Object.defineProperty(Sn,"__esModule",{value:!0});Sn.addNoneTerminalToCst=Sn.addTerminalToCst=Sn.setNodeLocationFull=Sn.setNodeLocationOnlyOffset=void 0;function T$(r,e){isNaN(r.startOffset)===!0?(r.startOffset=e.startOffset,r.endOffset=e.endOffset):r.endOffset<e.endOffset&&(r.endOffset=e.endOffset)}Sn.setNodeLocationOnlyOffset=T$;function R$(r,e){isNaN(r.startOffset)===!0?(r.startOffset=e.startOffset,r.startColumn=e.startColumn,r.startLine=e.startLine,r.endOffset=e.endOffset,r.endColumn=e.endColumn,r.endLine=e.endLine):r.endOffset<e.endOffset&&(r.endOffset=e.endOffset,r.endColumn=e.endColumn,r.endLine=e.endLine)}Sn.setNodeLocationFull=R$;function _$(r,e,t){r.children[t]===void 0?r.children[t]=[e]:r.children[t].push(e)}Sn.addTerminalToCst=_$;function A$(r,e,t){r.children[e]===void 0?r.children[e]=[t]:r.children[e].push(t)}Sn.addNoneTerminalToCst=A$});var dh=C(_i=>{"use strict";Object.defineProperty(_i,"__esModule",{value:!0});_i.defineNameProp=_i.functionName=_i.classNameFromInstance=void 0;var b$=_e();function E$(r){return HA(r.constructor)}_i.classNameFromInstance=E$;var UA="name";function HA(r){var e=r.name;return e||"anonymous"}_i.functionName=HA;function C$(r,e){var t=Object.getOwnPropertyDescriptor(r,UA);return(0,b$.isUndefined)(t)||t.configurable?(Object.defineProperty(r,UA,{enumerable:!1,configurable:!0,writable:!1,value:e}),!0):!1}_i.defineNameProp=C$});var VA=C(Ut=>{"use strict";Object.defineProperty(Ut,"__esModule",{value:!0});Ut.validateRedundantMethods=Ut.validateMissingCstMethods=Ut.validateVisitor=Ut.CstVisitorDefinitionError=Ut.createBaseVisitorConstructorWithDefaults=Ut.createBaseSemanticVisitorConstructor=Ut.defaultVisit=void 0;var $r=_e(),rs=dh();function WA(r,e){for(var t=(0,$r.keys)(r),n=t.length,i=0;i<n;i++)for(var o=t[i],a=r[o],s=a.length,u=0;u<s;u++){var c=a[u];c.tokenTypeIdx===void 0&&this[c.name](c.children,e)}}Ut.defaultVisit=WA;function P$(r,e){var t=function(){};(0,rs.defineNameProp)(t,r+"BaseSemantics");var n={visit:function(i,o){if((0,$r.isArray)(i)&&(i=i[0]),!(0,$r.isUndefined)(i))return this[i.name](i.children,o)},validateVisitor:function(){var i=KA(this,e);if(!(0,$r.isEmpty)(i)){var o=(0,$r.map)(i,function(a){return a.msg});throw Error("Errors Detected in CST Visitor <"+(0,rs.functionName)(this.constructor)+`>:
3664
+ see: https://en.wikipedia.org/wiki/LL_parser#Left_Factoring.`;return i},buildInvalidRuleNameError:function(r){return"deprecated"},buildDuplicateRuleNameError:function(r){var e;r.topLevelRule instanceof Xm.Rule?e=r.topLevelRule.name:e=r.topLevelRule;var t="Duplicate definition, rule: ->"+e+"<- is already defined in the grammar: ->"+r.grammarName+"<-";return t}}});var uA=C(Ti=>{"use strict";var PO=Ti&&Ti.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(Ti,"__esModule",{value:!0});Ti.GastRefResolverVisitor=Ti.resolveGrammar=void 0;var kO=vr(),aA=_e(),xO=Uo();function SO(r,e){var t=new sA(r,e);return t.resolveRefs(),t.errors}Ti.resolveGrammar=SO;var sA=function(r){PO(e,r);function e(t,n){var i=r.call(this)||this;return i.nameToTopRule=t,i.errMsgProvider=n,i.errors=[],i}return e.prototype.resolveRefs=function(){var t=this;(0,aA.forEach)((0,aA.values)(this.nameToTopRule),function(n){t.currTopLevel=n,n.accept(t)})},e.prototype.visitNonTerminal=function(t){var n=this.nameToTopRule[t.nonTerminalName];if(n)t.referencedRule=n;else{var i=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,t);this.errors.push({message:i,type:kO.ParserDefinitionErrorType.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:t.nonTerminalName})}},e}(xO.GAstVisitor);Ti.GastRefResolverVisitor=sA});var Za=C(dt=>{"use strict";var Ki=dt&&dt.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(dt,"__esModule",{value:!0});dt.nextPossibleTokensAfter=dt.possiblePathsFrom=dt.NextTerminalAfterAtLeastOneSepWalker=dt.NextTerminalAfterAtLeastOneWalker=dt.NextTerminalAfterManySepWalker=dt.NextTerminalAfterManyWalker=dt.AbstractNextTerminalAfterProductionWalker=dt.NextAfterTokenWalker=dt.AbstractNextPossibleTokensWalker=void 0;var cA=Ic(),ye=_e(),NO=Vm(),se=fr(),lA=function(r){Ki(e,r);function e(t,n){var i=r.call(this)||this;return i.topProd=t,i.path=n,i.possibleTokTypes=[],i.nextProductionName="",i.nextProductionOccurrence=0,i.found=!1,i.isAtEndOfPath=!1,i}return e.prototype.startWalking=function(){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=(0,ye.cloneArr)(this.path.ruleStack).reverse(),this.occurrenceStack=(0,ye.cloneArr)(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes},e.prototype.walk=function(t,n){n===void 0&&(n=[]),this.found||r.prototype.walk.call(this,t,n)},e.prototype.walkProdRef=function(t,n,i){if(t.referencedRule.name===this.nextProductionName&&t.idx===this.nextProductionOccurrence){var o=n.concat(i);this.updateExpectedNext(),this.walk(t.referencedRule,o)}},e.prototype.updateExpectedNext=function(){(0,ye.isEmpty)(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())},e}(cA.RestWalker);dt.AbstractNextPossibleTokensWalker=lA;var DO=function(r){Ki(e,r);function e(t,n){var i=r.call(this,t,n)||this;return i.path=n,i.nextTerminalName="",i.nextTerminalOccurrence=0,i.nextTerminalName=i.path.lastTok.name,i.nextTerminalOccurrence=i.path.lastTokOccurrence,i}return e.prototype.walkTerminal=function(t,n,i){if(this.isAtEndOfPath&&t.terminalType.name===this.nextTerminalName&&t.idx===this.nextTerminalOccurrence&&!this.found){var o=n.concat(i),a=new se.Alternative({definition:o});this.possibleTokTypes=(0,NO.first)(a),this.found=!0}},e}(lA);dt.NextAfterTokenWalker=DO;var Ja=function(r){Ki(e,r);function e(t,n){var i=r.call(this)||this;return i.topRule=t,i.occurrence=n,i.result={token:void 0,occurrence:void 0,isEndOfRule:void 0},i}return e.prototype.startWalking=function(){return this.walk(this.topRule),this.result},e}(cA.RestWalker);dt.AbstractNextTerminalAfterProductionWalker=Ja;var wO=function(r){Ki(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.walkMany=function(t,n,i){if(t.idx===this.occurrence){var o=(0,ye.first)(n.concat(i));this.result.isEndOfRule=o===void 0,o instanceof se.Terminal&&(this.result.token=o.terminalType,this.result.occurrence=o.idx)}else r.prototype.walkMany.call(this,t,n,i)},e}(Ja);dt.NextTerminalAfterManyWalker=wO;var IO=function(r){Ki(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.walkManySep=function(t,n,i){if(t.idx===this.occurrence){var o=(0,ye.first)(n.concat(i));this.result.isEndOfRule=o===void 0,o instanceof se.Terminal&&(this.result.token=o.terminalType,this.result.occurrence=o.idx)}else r.prototype.walkManySep.call(this,t,n,i)},e}(Ja);dt.NextTerminalAfterManySepWalker=IO;var OO=function(r){Ki(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.walkAtLeastOne=function(t,n,i){if(t.idx===this.occurrence){var o=(0,ye.first)(n.concat(i));this.result.isEndOfRule=o===void 0,o instanceof se.Terminal&&(this.result.token=o.terminalType,this.result.occurrence=o.idx)}else r.prototype.walkAtLeastOne.call(this,t,n,i)},e}(Ja);dt.NextTerminalAfterAtLeastOneWalker=OO;var $O=function(r){Ki(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.walkAtLeastOneSep=function(t,n,i){if(t.idx===this.occurrence){var o=(0,ye.first)(n.concat(i));this.result.isEndOfRule=o===void 0,o instanceof se.Terminal&&(this.result.token=o.terminalType,this.result.occurrence=o.idx)}else r.prototype.walkAtLeastOneSep.call(this,t,n,i)},e}(Ja);dt.NextTerminalAfterAtLeastOneSepWalker=$O;function dA(r,e,t){t===void 0&&(t=[]),t=(0,ye.cloneArr)(t);var n=[],i=0;function o(c){return c.concat((0,ye.drop)(r,i+1))}function a(c){var l=dA(o(c),e,t);return n.concat(l)}for(;t.length<e&&i<r.length;){var s=r[i];if(s instanceof se.Alternative)return a(s.definition);if(s instanceof se.NonTerminal)return a(s.definition);if(s instanceof se.Option)n=a(s.definition);else if(s instanceof se.RepetitionMandatory){var u=s.definition.concat([new se.Repetition({definition:s.definition})]);return a(u)}else if(s instanceof se.RepetitionMandatoryWithSeparator){var u=[new se.Alternative({definition:s.definition}),new se.Repetition({definition:[new se.Terminal({terminalType:s.separator})].concat(s.definition)})];return a(u)}else if(s instanceof se.RepetitionWithSeparator){var u=s.definition.concat([new se.Repetition({definition:[new se.Terminal({terminalType:s.separator})].concat(s.definition)})]);n=a(u)}else if(s instanceof se.Repetition){var u=s.definition.concat([new se.Repetition({definition:s.definition})]);n=a(u)}else{if(s instanceof se.Alternation)return(0,ye.forEach)(s.definition,function(c){(0,ye.isEmpty)(c.definition)===!1&&(n=a(c.definition))}),n;if(s instanceof se.Terminal)t.push(s.terminalType);else throw Error("non exhaustive match")}i++}return n.push({partialPath:t,suffixDef:(0,ye.drop)(r,i)}),n}dt.possiblePathsFrom=dA;function MO(r,e,t,n){var i="EXIT_NONE_TERMINAL",o=[i],a="EXIT_ALTERNATIVE",s=!1,u=e.length,c=u-n-1,l=[],d=[];for(d.push({idx:-1,def:r,ruleStack:[],occurrenceStack:[]});!(0,ye.isEmpty)(d);){var g=d.pop();if(g===a){s&&(0,ye.last)(d).idx<=c&&d.pop();continue}var y=g.def,p=g.idx,A=g.ruleStack,x=g.occurrenceStack;if(!(0,ye.isEmpty)(y)){var k=y[0];if(k===i){var _={idx:p,def:(0,ye.drop)(y),ruleStack:(0,ye.dropRight)(A),occurrenceStack:(0,ye.dropRight)(x)};d.push(_)}else if(k instanceof se.Terminal)if(p<u-1){var R=p+1,D=e[R];if(t(D,k.terminalType)){var _={idx:R,def:(0,ye.drop)(y),ruleStack:A,occurrenceStack:x};d.push(_)}}else if(p===u-1)l.push({nextTokenType:k.terminalType,nextTokenOccurrence:k.idx,ruleStack:A,occurrenceStack:x}),s=!0;else throw Error("non exhaustive match");else if(k instanceof se.NonTerminal){var B=(0,ye.cloneArr)(A);B.push(k.nonTerminalName);var V=(0,ye.cloneArr)(x);V.push(k.idx);var _={idx:p,def:k.definition.concat(o,(0,ye.drop)(y)),ruleStack:B,occurrenceStack:V};d.push(_)}else if(k instanceof se.Option){var G={idx:p,def:(0,ye.drop)(y),ruleStack:A,occurrenceStack:x};d.push(G),d.push(a);var ge={idx:p,def:k.definition.concat((0,ye.drop)(y)),ruleStack:A,occurrenceStack:x};d.push(ge)}else if(k instanceof se.RepetitionMandatory){var je=new se.Repetition({definition:k.definition,idx:k.idx}),Ze=k.definition.concat([je],(0,ye.drop)(y)),_={idx:p,def:Ze,ruleStack:A,occurrenceStack:x};d.push(_)}else if(k instanceof se.RepetitionMandatoryWithSeparator){var Ge=new se.Terminal({terminalType:k.separator}),je=new se.Repetition({definition:[Ge].concat(k.definition),idx:k.idx}),Ze=k.definition.concat([je],(0,ye.drop)(y)),_={idx:p,def:Ze,ruleStack:A,occurrenceStack:x};d.push(_)}else if(k instanceof se.RepetitionWithSeparator){var G={idx:p,def:(0,ye.drop)(y),ruleStack:A,occurrenceStack:x};d.push(G),d.push(a);var Ge=new se.Terminal({terminalType:k.separator}),L=new se.Repetition({definition:[Ge].concat(k.definition),idx:k.idx}),Ze=k.definition.concat([L],(0,ye.drop)(y)),ge={idx:p,def:Ze,ruleStack:A,occurrenceStack:x};d.push(ge)}else if(k instanceof se.Repetition){var G={idx:p,def:(0,ye.drop)(y),ruleStack:A,occurrenceStack:x};d.push(G),d.push(a);var L=new se.Repetition({definition:k.definition,idx:k.idx}),Ze=k.definition.concat([L],(0,ye.drop)(y)),ge={idx:p,def:Ze,ruleStack:A,occurrenceStack:x};d.push(ge)}else if(k instanceof se.Alternation)for(var M=k.definition.length-1;M>=0;M--){var F=k.definition[M],K={idx:p,def:F.definition.concat((0,ye.drop)(y)),ruleStack:A,occurrenceStack:x};d.push(K),d.push(a)}else if(k instanceof se.Alternative)d.push({idx:p,def:k.definition.concat((0,ye.drop)(y)),ruleStack:A,occurrenceStack:x});else if(k instanceof se.Rule)d.push(LO(k,p,A,x));else throw Error("non exhaustive match")}}return l}dt.nextPossibleTokensAfter=MO;function LO(r,e,t,n){var i=(0,ye.cloneArr)(t);i.push(r.name);var o=(0,ye.cloneArr)(n);return o.push(1),{idx:e,def:r.definition,ruleStack:i,occurrenceStack:o}}});var Qa=C(De=>{"use strict";var mA=De&&De.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(De,"__esModule",{value:!0});De.areTokenCategoriesNotUsed=De.isStrictPrefixOfPath=De.containsPath=De.getLookaheadPathsForOptionalProd=De.getLookaheadPathsForOr=De.lookAheadSequenceFromAlternatives=De.buildSingleAlternativeLookaheadFunction=De.buildAlternativesLookAheadFunc=De.buildLookaheadFuncForOptionalProd=De.buildLookaheadFuncForOr=De.getProdType=De.PROD_TYPE=void 0;var Fe=_e(),fA=Za(),FO=Ic(),qc=Go(),Ri=fr(),qO=Uo(),kt;(function(r){r[r.OPTION=0]="OPTION",r[r.REPETITION=1]="REPETITION",r[r.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",r[r.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",r[r.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",r[r.ALTERNATION=5]="ALTERNATION"})(kt=De.PROD_TYPE||(De.PROD_TYPE={}));function jO(r){if(r instanceof Ri.Option)return kt.OPTION;if(r instanceof Ri.Repetition)return kt.REPETITION;if(r instanceof Ri.RepetitionMandatory)return kt.REPETITION_MANDATORY;if(r instanceof Ri.RepetitionMandatoryWithSeparator)return kt.REPETITION_MANDATORY_WITH_SEPARATOR;if(r instanceof Ri.RepetitionWithSeparator)return kt.REPETITION_WITH_SEPARATOR;if(r instanceof Ri.Alternation)return kt.ALTERNATION;throw Error("non exhaustive match")}De.getProdType=jO;function GO(r,e,t,n,i,o){var a=yA(r,e,t),s=Qm(a)?qc.tokenStructuredMatcherNoCategories:qc.tokenStructuredMatcher;return o(a,n,s,i)}De.buildLookaheadFuncForOr=GO;function UO(r,e,t,n,i,o){var a=gA(r,e,i,t),s=Qm(a)?qc.tokenStructuredMatcherNoCategories:qc.tokenStructuredMatcher;return o(a[0],s,n)}De.buildLookaheadFuncForOptionalProd=UO;function HO(r,e,t,n){var i=r.length,o=(0,Fe.every)(r,function(u){return(0,Fe.every)(u,function(c){return c.length===1})});if(e)return function(u){for(var c=(0,Fe.map)(u,function(R){return R.GATE}),l=0;l<i;l++){var d=r[l],g=d.length,y=c[l];if(y!==void 0&&y.call(this)===!1)continue;e:for(var p=0;p<g;p++){for(var A=d[p],x=A.length,k=0;k<x;k++){var _=this.LA(k+1);if(t(_,A[k])===!1)continue e}return l}}};if(o&&!n){var a=(0,Fe.map)(r,function(u){return(0,Fe.flatten)(u)}),s=(0,Fe.reduce)(a,function(u,c,l){return(0,Fe.forEach)(c,function(d){(0,Fe.has)(u,d.tokenTypeIdx)||(u[d.tokenTypeIdx]=l),(0,Fe.forEach)(d.categoryMatches,function(g){(0,Fe.has)(u,g)||(u[g]=l)})}),u},[]);return function(){var u=this.LA(1);return s[u.tokenTypeIdx]}}else return function(){for(var u=0;u<i;u++){var c=r[u],l=c.length;e:for(var d=0;d<l;d++){for(var g=c[d],y=g.length,p=0;p<y;p++){var A=this.LA(p+1);if(t(A,g[p])===!1)continue e}return u}}}}De.buildAlternativesLookAheadFunc=HO;function WO(r,e,t){var n=(0,Fe.every)(r,function(c){return c.length===1}),i=r.length;if(n&&!t){var o=(0,Fe.flatten)(r);if(o.length===1&&(0,Fe.isEmpty)(o[0].categoryMatches)){var a=o[0],s=a.tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===s}}else{var u=(0,Fe.reduce)(o,function(c,l,d){return c[l.tokenTypeIdx]=!0,(0,Fe.forEach)(l.categoryMatches,function(g){c[g]=!0}),c},[]);return function(){var c=this.LA(1);return u[c.tokenTypeIdx]===!0}}}else return function(){e:for(var c=0;c<i;c++){for(var l=r[c],d=l.length,g=0;g<d;g++){var y=this.LA(g+1);if(e(y,l[g])===!1)continue e}return!0}return!1}}De.buildSingleAlternativeLookaheadFunction=WO;var KO=function(r){mA(e,r);function e(t,n,i){var o=r.call(this)||this;return o.topProd=t,o.targetOccurrence=n,o.targetProdType=i,o}return e.prototype.startWalking=function(){return this.walk(this.topProd),this.restDef},e.prototype.checkIsTarget=function(t,n,i,o){return t.idx===this.targetOccurrence&&this.targetProdType===n?(this.restDef=i.concat(o),!0):!1},e.prototype.walkOption=function(t,n,i){this.checkIsTarget(t,kt.OPTION,n,i)||r.prototype.walkOption.call(this,t,n,i)},e.prototype.walkAtLeastOne=function(t,n,i){this.checkIsTarget(t,kt.REPETITION_MANDATORY,n,i)||r.prototype.walkOption.call(this,t,n,i)},e.prototype.walkAtLeastOneSep=function(t,n,i){this.checkIsTarget(t,kt.REPETITION_MANDATORY_WITH_SEPARATOR,n,i)||r.prototype.walkOption.call(this,t,n,i)},e.prototype.walkMany=function(t,n,i){this.checkIsTarget(t,kt.REPETITION,n,i)||r.prototype.walkOption.call(this,t,n,i)},e.prototype.walkManySep=function(t,n,i){this.checkIsTarget(t,kt.REPETITION_WITH_SEPARATOR,n,i)||r.prototype.walkOption.call(this,t,n,i)},e}(FO.RestWalker),hA=function(r){mA(e,r);function e(t,n,i){var o=r.call(this)||this;return o.targetOccurrence=t,o.targetProdType=n,o.targetRef=i,o.result=[],o}return e.prototype.checkIsTarget=function(t,n){t.idx===this.targetOccurrence&&this.targetProdType===n&&(this.targetRef===void 0||t===this.targetRef)&&(this.result=t.definition)},e.prototype.visitOption=function(t){this.checkIsTarget(t,kt.OPTION)},e.prototype.visitRepetition=function(t){this.checkIsTarget(t,kt.REPETITION)},e.prototype.visitRepetitionMandatory=function(t){this.checkIsTarget(t,kt.REPETITION_MANDATORY)},e.prototype.visitRepetitionMandatoryWithSeparator=function(t){this.checkIsTarget(t,kt.REPETITION_MANDATORY_WITH_SEPARATOR)},e.prototype.visitRepetitionWithSeparator=function(t){this.checkIsTarget(t,kt.REPETITION_WITH_SEPARATOR)},e.prototype.visitAlternation=function(t){this.checkIsTarget(t,kt.ALTERNATION)},e}(qO.GAstVisitor);function pA(r){for(var e=new Array(r),t=0;t<r;t++)e[t]=[];return e}function Jm(r){for(var e=[""],t=0;t<r.length;t++){for(var n=r[t],i=[],o=0;o<e.length;o++){var a=e[o];i.push(a+"_"+n.tokenTypeIdx);for(var s=0;s<n.categoryMatches.length;s++){var u="_"+n.categoryMatches[s];i.push(a+u)}}e=i}return e}function BO(r,e,t){for(var n=0;n<r.length;n++)if(n!==t)for(var i=r[n],o=0;o<e.length;o++){var a=e[o];if(i[a]===!0)return!1}return!0}function Zm(r,e){for(var t=(0,Fe.map)(r,function(l){return(0,fA.possiblePathsFrom)([l],1)}),n=pA(t.length),i=(0,Fe.map)(t,function(l){var d={};return(0,Fe.forEach)(l,function(g){var y=Jm(g.partialPath);(0,Fe.forEach)(y,function(p){d[p]=!0})}),d}),o=t,a=1;a<=e;a++){var s=o;o=pA(s.length);for(var u=function(l){for(var d=s[l],g=0;g<d.length;g++){var y=d[g].partialPath,p=d[g].suffixDef,A=Jm(y),x=BO(i,A,l);if(x||(0,Fe.isEmpty)(p)||y.length===e){var k=n[l];if(vA(k,y)===!1){k.push(y);for(var _=0;_<A.length;_++){var R=A[_];i[l][R]=!0}}}else{var D=(0,fA.possiblePathsFrom)(p,a+1,y);o[l]=o[l].concat(D),(0,Fe.forEach)(D,function(B){var V=Jm(B.partialPath);(0,Fe.forEach)(V,function(G){i[l][G]=!0})})}}},c=0;c<s.length;c++)u(c)}return n}De.lookAheadSequenceFromAlternatives=Zm;function yA(r,e,t,n){var i=new hA(r,kt.ALTERNATION,n);return e.accept(i),Zm(i.result,t)}De.getLookaheadPathsForOr=yA;function gA(r,e,t,n){var i=new hA(r,t);e.accept(i);var o=i.result,a=new KO(e,r,t),s=a.startWalking(),u=new Ri.Alternative({definition:o}),c=new Ri.Alternative({definition:s});return Zm([u,c],n)}De.getLookaheadPathsForOptionalProd=gA;function vA(r,e){e:for(var t=0;t<r.length;t++){var n=r[t];if(n.length===e.length){for(var i=0;i<n.length;i++){var o=e[i],a=n[i],s=o===a||a.categoryMatchesMap[o.tokenTypeIdx]!==void 0;if(s===!1)continue e}return!0}}return!1}De.containsPath=vA;function zO(r,e){return r.length<e.length&&(0,Fe.every)(r,function(t,n){var i=e[n];return t===i||i.categoryMatchesMap[t.tokenTypeIdx]})}De.isStrictPrefixOfPath=zO;function Qm(r){return(0,Fe.every)(r,function(e){return(0,Fe.every)(e,function(t){return(0,Fe.every)(t,function(n){return(0,Fe.isEmpty)(n.categoryMatches)})})})}De.areTokenCategoriesNotUsed=Qm});var oh=C(xe=>{"use strict";var eh=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(xe,"__esModule",{value:!0});xe.checkPrefixAlternativesAmbiguities=xe.validateSomeNonEmptyLookaheadPath=xe.validateTooManyAlts=xe.RepetionCollector=xe.validateAmbiguousAlternationAlternatives=xe.validateEmptyOrAlternative=xe.getFirstNoneTerminal=xe.validateNoLeftRecursion=xe.validateRuleIsOverridden=xe.validateRuleDoesNotAlreadyExist=xe.OccurrenceValidationCollector=xe.identifyProductionForDuplicates=xe.validateGrammar=void 0;var Ie=_e(),nt=_e(),xn=vr(),th=Ya(),Wo=Qa(),VO=Za(),nn=fr(),rh=Uo();function YO(r,e,t,n,i){var o=Ie.map(r,function(y){return XO(y,n)}),a=Ie.map(r,function(y){return nh(y,y,n)}),s=[],u=[],c=[];(0,nt.every)(a,nt.isEmpty)&&(s=(0,nt.map)(r,function(y){return bA(y,n)}),u=(0,nt.map)(r,function(y){return EA(y,e,n)}),c=kA(r,e,n));var l=QO(r,t,n),d=(0,nt.map)(r,function(y){return PA(y,n)}),g=(0,nt.map)(r,function(y){return AA(y,r,i,n)});return Ie.flatten(o.concat(c,a,s,u,l,d,g))}xe.validateGrammar=YO;function XO(r,e){var t=new _A;r.accept(t);var n=t.allProductions,i=Ie.groupBy(n,TA),o=Ie.pick(i,function(s){return s.length>1}),a=Ie.map(Ie.values(o),function(s){var u=Ie.first(s),c=e.buildDuplicateFoundError(r,s),l=(0,th.getProductionDslName)(u),d={message:c,type:xn.ParserDefinitionErrorType.DUPLICATE_PRODUCTIONS,ruleName:r.name,dslName:l,occurrence:u.idx},g=RA(u);return g&&(d.parameter=g),d});return a}function TA(r){return(0,th.getProductionDslName)(r)+"_#_"+r.idx+"_#_"+RA(r)}xe.identifyProductionForDuplicates=TA;function RA(r){return r instanceof nn.Terminal?r.terminalType.name:r instanceof nn.NonTerminal?r.nonTerminalName:""}var _A=function(r){eh(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.allProductions=[],t}return e.prototype.visitNonTerminal=function(t){this.allProductions.push(t)},e.prototype.visitOption=function(t){this.allProductions.push(t)},e.prototype.visitRepetitionWithSeparator=function(t){this.allProductions.push(t)},e.prototype.visitRepetitionMandatory=function(t){this.allProductions.push(t)},e.prototype.visitRepetitionMandatoryWithSeparator=function(t){this.allProductions.push(t)},e.prototype.visitRepetition=function(t){this.allProductions.push(t)},e.prototype.visitAlternation=function(t){this.allProductions.push(t)},e.prototype.visitTerminal=function(t){this.allProductions.push(t)},e}(rh.GAstVisitor);xe.OccurrenceValidationCollector=_A;function AA(r,e,t,n){var i=[],o=(0,nt.reduce)(e,function(s,u){return u.name===r.name?s+1:s},0);if(o>1){var a=n.buildDuplicateRuleNameError({topLevelRule:r,grammarName:t});i.push({message:a,type:xn.ParserDefinitionErrorType.DUPLICATE_RULE_NAME,ruleName:r.name})}return i}xe.validateRuleDoesNotAlreadyExist=AA;function JO(r,e,t){var n=[],i;return Ie.contains(e,r)||(i="Invalid rule override, rule: ->"+r+"<- cannot be overridden in the grammar: ->"+t+"<-as it is not defined in any of the super grammars ",n.push({message:i,type:xn.ParserDefinitionErrorType.INVALID_RULE_OVERRIDE,ruleName:r})),n}xe.validateRuleIsOverridden=JO;function nh(r,e,t,n){n===void 0&&(n=[]);var i=[],o=es(e.definition);if(Ie.isEmpty(o))return[];var a=r.name,s=Ie.contains(o,r);s&&i.push({message:t.buildLeftRecursionError({topLevelRule:r,leftRecursionPath:n}),type:xn.ParserDefinitionErrorType.LEFT_RECURSION,ruleName:a});var u=Ie.difference(o,n.concat([r])),c=Ie.map(u,function(l){var d=Ie.cloneArr(n);return d.push(l),nh(r,l,t,d)});return i.concat(Ie.flatten(c))}xe.validateNoLeftRecursion=nh;function es(r){var e=[];if(Ie.isEmpty(r))return e;var t=Ie.first(r);if(t instanceof nn.NonTerminal)e.push(t.referencedRule);else if(t instanceof nn.Alternative||t instanceof nn.Option||t instanceof nn.RepetitionMandatory||t instanceof nn.RepetitionMandatoryWithSeparator||t instanceof nn.RepetitionWithSeparator||t instanceof nn.Repetition)e=e.concat(es(t.definition));else if(t instanceof nn.Alternation)e=Ie.flatten(Ie.map(t.definition,function(a){return es(a.definition)}));else if(!(t instanceof nn.Terminal))throw Error("non exhaustive match");var n=(0,th.isOptionalProd)(t),i=r.length>1;if(n&&i){var o=Ie.drop(r);return e.concat(es(o))}else return e}xe.getFirstNoneTerminal=es;var ih=function(r){eh(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.alternations=[],t}return e.prototype.visitAlternation=function(t){this.alternations.push(t)},e}(rh.GAstVisitor);function bA(r,e){var t=new ih;r.accept(t);var n=t.alternations,i=Ie.reduce(n,function(o,a){var s=Ie.dropRight(a.definition),u=Ie.map(s,function(c,l){var d=(0,VO.nextPossibleTokensAfter)([c],[],null,1);return Ie.isEmpty(d)?{message:e.buildEmptyAlternationError({topLevelRule:r,alternation:a,emptyChoiceIdx:l}),type:xn.ParserDefinitionErrorType.NONE_LAST_EMPTY_ALT,ruleName:r.name,occurrence:a.idx,alternative:l+1}:null});return o.concat(Ie.compact(u))},[]);return i}xe.validateEmptyOrAlternative=bA;function EA(r,e,t){var n=new ih;r.accept(n);var i=n.alternations;i=(0,nt.reject)(i,function(a){return a.ignoreAmbiguities===!0});var o=Ie.reduce(i,function(a,s){var u=s.idx,c=s.maxLookahead||e,l=(0,Wo.getLookaheadPathsForOr)(u,r,c,s),d=ZO(l,s,r,t),g=xA(l,s,r,t);return a.concat(d,g)},[]);return o}xe.validateAmbiguousAlternationAlternatives=EA;var CA=function(r){eh(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.allProductions=[],t}return e.prototype.visitRepetitionWithSeparator=function(t){this.allProductions.push(t)},e.prototype.visitRepetitionMandatory=function(t){this.allProductions.push(t)},e.prototype.visitRepetitionMandatoryWithSeparator=function(t){this.allProductions.push(t)},e.prototype.visitRepetition=function(t){this.allProductions.push(t)},e}(rh.GAstVisitor);xe.RepetionCollector=CA;function PA(r,e){var t=new ih;r.accept(t);var n=t.alternations,i=Ie.reduce(n,function(o,a){return a.definition.length>255&&o.push({message:e.buildTooManyAlternativesError({topLevelRule:r,alternation:a}),type:xn.ParserDefinitionErrorType.TOO_MANY_ALTS,ruleName:r.name,occurrence:a.idx}),o},[]);return i}xe.validateTooManyAlts=PA;function kA(r,e,t){var n=[];return(0,nt.forEach)(r,function(i){var o=new CA;i.accept(o);var a=o.allProductions;(0,nt.forEach)(a,function(s){var u=(0,Wo.getProdType)(s),c=s.maxLookahead||e,l=s.idx,d=(0,Wo.getLookaheadPathsForOptionalProd)(l,i,u,c),g=d[0];if((0,nt.isEmpty)((0,nt.flatten)(g))){var y=t.buildEmptyRepetitionError({topLevelRule:i,repetition:s});n.push({message:y,type:xn.ParserDefinitionErrorType.NO_NON_EMPTY_LOOKAHEAD,ruleName:i.name})}})}),n}xe.validateSomeNonEmptyLookaheadPath=kA;function ZO(r,e,t,n){var i=[],o=(0,nt.reduce)(r,function(s,u,c){return e.definition[c].ignoreAmbiguities===!0||(0,nt.forEach)(u,function(l){var d=[c];(0,nt.forEach)(r,function(g,y){c!==y&&(0,Wo.containsPath)(g,l)&&e.definition[y].ignoreAmbiguities!==!0&&d.push(y)}),d.length>1&&!(0,Wo.containsPath)(i,l)&&(i.push(l),s.push({alts:d,path:l}))}),s},[]),a=Ie.map(o,function(s){var u=(0,nt.map)(s.alts,function(l){return l+1}),c=n.buildAlternationAmbiguityError({topLevelRule:t,alternation:e,ambiguityIndices:u,prefixPath:s.path});return{message:c,type:xn.ParserDefinitionErrorType.AMBIGUOUS_ALTS,ruleName:t.name,occurrence:e.idx,alternatives:[s.alts]}});return a}function xA(r,e,t,n){var i=[],o=(0,nt.reduce)(r,function(a,s,u){var c=(0,nt.map)(s,function(l){return{idx:u,path:l}});return a.concat(c)},[]);return(0,nt.forEach)(o,function(a){var s=e.definition[a.idx];if(s.ignoreAmbiguities!==!0){var u=a.idx,c=a.path,l=(0,nt.findAll)(o,function(g){return e.definition[g.idx].ignoreAmbiguities!==!0&&g.idx<u&&(0,Wo.isStrictPrefixOfPath)(g.path,c)}),d=(0,nt.map)(l,function(g){var y=[g.idx+1,u+1],p=e.idx===0?"":e.idx,A=n.buildAlternationPrefixAmbiguityError({topLevelRule:t,alternation:e,ambiguityIndices:y,prefixPath:g.path});return{message:A,type:xn.ParserDefinitionErrorType.AMBIGUOUS_PREFIX_ALTS,ruleName:t.name,occurrence:p,alternatives:y}});i=i.concat(d)}}),i}xe.checkPrefixAlternativesAmbiguities=xA;function QO(r,e,t){var n=[],i=(0,nt.map)(e,function(o){return o.name});return(0,nt.forEach)(r,function(o){var a=o.name;if((0,nt.contains)(i,a)){var s=t.buildNamespaceConflictError(o);n.push({message:s,type:xn.ParserDefinitionErrorType.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:a})}}),n}});var NA=C(Ko=>{"use strict";Object.defineProperty(Ko,"__esModule",{value:!0});Ko.validateGrammar=Ko.resolveGrammar=void 0;var ah=_e(),e$=uA(),t$=oh(),SA=Xa();function r$(r){r=(0,ah.defaults)(r,{errMsgProvider:SA.defaultGrammarResolverErrorProvider});var e={};return(0,ah.forEach)(r.rules,function(t){e[t.name]=t}),(0,e$.resolveGrammar)(e,r.errMsgProvider)}Ko.resolveGrammar=r$;function n$(r){return r=(0,ah.defaults)(r,{errMsgProvider:SA.defaultGrammarValidatorErrorProvider}),(0,t$.validateGrammar)(r.rules,r.maxLookahead,r.tokenTypes,r.errMsgProvider,r.grammarName)}Ko.validateGrammar=n$});var Bo=C(mr=>{"use strict";var ts=mr&&mr.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(mr,"__esModule",{value:!0});mr.EarlyExitException=mr.NotAllInputParsedException=mr.NoViableAltException=mr.MismatchedTokenException=mr.isRecognitionException=void 0;var i$=_e(),DA="MismatchedTokenException",wA="NoViableAltException",IA="EarlyExitException",OA="NotAllInputParsedException",$A=[DA,wA,IA,OA];Object.freeze($A);function o$(r){return(0,i$.contains)($A,r.name)}mr.isRecognitionException=o$;var jc=function(r){ts(e,r);function e(t,n){var i=this.constructor,o=r.call(this,t)||this;return o.token=n,o.resyncedTokens=[],Object.setPrototypeOf(o,i.prototype),Error.captureStackTrace&&Error.captureStackTrace(o,o.constructor),o}return e}(Error),a$=function(r){ts(e,r);function e(t,n,i){var o=r.call(this,t,n)||this;return o.previousToken=i,o.name=DA,o}return e}(jc);mr.MismatchedTokenException=a$;var s$=function(r){ts(e,r);function e(t,n,i){var o=r.call(this,t,n)||this;return o.previousToken=i,o.name=wA,o}return e}(jc);mr.NoViableAltException=s$;var u$=function(r){ts(e,r);function e(t,n){var i=r.call(this,t,n)||this;return i.name=OA,i}return e}(jc);mr.NotAllInputParsedException=u$;var c$=function(r){ts(e,r);function e(t,n,i){var o=r.call(this,t,n)||this;return o.previousToken=i,o.name=IA,o}return e}(jc);mr.EarlyExitException=c$});var uh=C(Zt=>{"use strict";Object.defineProperty(Zt,"__esModule",{value:!0});Zt.attemptInRepetitionRecovery=Zt.Recoverable=Zt.InRuleRecoveryException=Zt.IN_RULE_RECOVERY_EXCEPTION=Zt.EOF_FOLLOW_KEY=void 0;var Gc=vi(),Or=_e(),l$=Bo(),d$=Ym(),f$=vr();Zt.EOF_FOLLOW_KEY={};Zt.IN_RULE_RECOVERY_EXCEPTION="InRuleRecoveryException";function sh(r){this.name=Zt.IN_RULE_RECOVERY_EXCEPTION,this.message=r}Zt.InRuleRecoveryException=sh;sh.prototype=Error.prototype;var p$=function(){function r(){}return r.prototype.initRecoverable=function(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=(0,Or.has)(e,"recoveryEnabled")?e.recoveryEnabled:f$.DEFAULT_PARSER_CONFIG.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=MA)},r.prototype.getTokenToInsert=function(e){var t=(0,Gc.createTokenInstance)(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return t.isInsertedInRecovery=!0,t},r.prototype.canTokenTypeBeInsertedInRecovery=function(e){return!0},r.prototype.tryInRepetitionRecovery=function(e,t,n,i){for(var o=this,a=this.findReSyncTokenType(),s=this.exportLexerState(),u=[],c=!1,l=this.LA(1),d=this.LA(1),g=function(){var y=o.LA(0),p=o.errorMessageProvider.buildMismatchTokenMessage({expected:i,actual:l,previous:y,ruleName:o.getCurrRuleFullName()}),A=new l$.MismatchedTokenException(p,l,o.LA(0));A.resyncedTokens=(0,Or.dropRight)(u),o.SAVE_ERROR(A)};!c;)if(this.tokenMatcher(d,i)){g();return}else if(n.call(this)){g(),e.apply(this,t);return}else this.tokenMatcher(d,a)?c=!0:(d=this.SKIP_TOKEN(),this.addToResyncTokens(d,u));this.importLexerState(s)},r.prototype.shouldInRepetitionRecoveryBeTried=function(e,t,n){return!(n===!1||e===void 0||t===void 0||this.tokenMatcher(this.LA(1),e)||this.isBackTracking()||this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,t)))},r.prototype.getFollowsForInRuleRecovery=function(e,t){var n=this.getCurrentGrammarPath(e,t),i=this.getNextPossibleTokenTypes(n);return i},r.prototype.tryInRuleRecovery=function(e,t){if(this.canRecoverWithSingleTokenInsertion(e,t)){var n=this.getTokenToInsert(e);return n}if(this.canRecoverWithSingleTokenDeletion(e)){var i=this.SKIP_TOKEN();return this.consumeToken(),i}throw new sh("sad sad panda")},r.prototype.canPerformInRuleRecovery=function(e,t){return this.canRecoverWithSingleTokenInsertion(e,t)||this.canRecoverWithSingleTokenDeletion(e)},r.prototype.canRecoverWithSingleTokenInsertion=function(e,t){var n=this;if(!this.canTokenTypeBeInsertedInRecovery(e)||(0,Or.isEmpty)(t))return!1;var i=this.LA(1),o=(0,Or.find)(t,function(a){return n.tokenMatcher(i,a)})!==void 0;return o},r.prototype.canRecoverWithSingleTokenDeletion=function(e){var t=this.tokenMatcher(this.LA(2),e);return t},r.prototype.isInCurrentRuleReSyncSet=function(e){var t=this.getCurrFollowKey(),n=this.getFollowSetFromFollowKey(t);return(0,Or.contains)(n,e)},r.prototype.findReSyncTokenType=function(){for(var e=this.flattenFollowSet(),t=this.LA(1),n=2;;){var i=t.tokenType;if((0,Or.contains)(e,i))return i;t=this.LA(n),n++}},r.prototype.getCurrFollowKey=function(){if(this.RULE_STACK.length===1)return Zt.EOF_FOLLOW_KEY;var e=this.getLastExplicitRuleShortName(),t=this.getLastExplicitRuleOccurrenceIndex(),n=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:t,inRule:this.shortRuleNameToFullName(n)}},r.prototype.buildFullFollowKeyStack=function(){var e=this,t=this.RULE_STACK,n=this.RULE_OCCURRENCE_STACK;return(0,Or.map)(t,function(i,o){return o===0?Zt.EOF_FOLLOW_KEY:{ruleName:e.shortRuleNameToFullName(i),idxInCallingRule:n[o],inRule:e.shortRuleNameToFullName(t[o-1])}})},r.prototype.flattenFollowSet=function(){var e=this,t=(0,Or.map)(this.buildFullFollowKeyStack(),function(n){return e.getFollowSetFromFollowKey(n)});return(0,Or.flatten)(t)},r.prototype.getFollowSetFromFollowKey=function(e){if(e===Zt.EOF_FOLLOW_KEY)return[Gc.EOF];var t=e.ruleName+e.idxInCallingRule+d$.IN+e.inRule;return this.resyncFollows[t]},r.prototype.addToResyncTokens=function(e,t){return this.tokenMatcher(e,Gc.EOF)||t.push(e),t},r.prototype.reSyncTo=function(e){for(var t=[],n=this.LA(1);this.tokenMatcher(n,e)===!1;)n=this.SKIP_TOKEN(),this.addToResyncTokens(n,t);return(0,Or.dropRight)(t)},r.prototype.attemptInRepetitionRecovery=function(e,t,n,i,o,a,s){},r.prototype.getCurrentGrammarPath=function(e,t){var n=this.getHumanReadableRuleStack(),i=(0,Or.cloneArr)(this.RULE_OCCURRENCE_STACK),o={ruleStack:n,occurrenceStack:i,lastTok:e,lastTokOccurrence:t};return o},r.prototype.getHumanReadableRuleStack=function(){var e=this;return(0,Or.map)(this.RULE_STACK,function(t){return e.shortRuleNameToFullName(t)})},r}();Zt.Recoverable=p$;function MA(r,e,t,n,i,o,a){var s=this.getKeyForAutomaticLookahead(n,i),u=this.firstAfterRepMap[s];if(u===void 0){var c=this.getCurrRuleFullName(),l=this.getGAstProductions()[c],d=new o(l,i);u=d.startWalking(),this.firstAfterRepMap[s]=u}var g=u.token,y=u.occurrence,p=u.isEndOfRule;this.RULE_STACK.length===1&&p&&g===void 0&&(g=Gc.EOF,y=1),this.shouldInRepetitionRecoveryBeTried(g,y,a)&&this.tryInRepetitionRecovery(r,e,t,g)}Zt.attemptInRepetitionRecovery=MA});var Uc=C(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.getKeyForAutomaticLookahead=Ce.AT_LEAST_ONE_SEP_IDX=Ce.MANY_SEP_IDX=Ce.AT_LEAST_ONE_IDX=Ce.MANY_IDX=Ce.OPTION_IDX=Ce.OR_IDX=Ce.BITS_FOR_ALT_IDX=Ce.BITS_FOR_RULE_IDX=Ce.BITS_FOR_OCCURRENCE_IDX=Ce.BITS_FOR_METHOD_TYPE=void 0;Ce.BITS_FOR_METHOD_TYPE=4;Ce.BITS_FOR_OCCURRENCE_IDX=8;Ce.BITS_FOR_RULE_IDX=12;Ce.BITS_FOR_ALT_IDX=8;Ce.OR_IDX=1<<Ce.BITS_FOR_OCCURRENCE_IDX;Ce.OPTION_IDX=2<<Ce.BITS_FOR_OCCURRENCE_IDX;Ce.MANY_IDX=3<<Ce.BITS_FOR_OCCURRENCE_IDX;Ce.AT_LEAST_ONE_IDX=4<<Ce.BITS_FOR_OCCURRENCE_IDX;Ce.MANY_SEP_IDX=5<<Ce.BITS_FOR_OCCURRENCE_IDX;Ce.AT_LEAST_ONE_SEP_IDX=6<<Ce.BITS_FOR_OCCURRENCE_IDX;function m$(r,e,t){return t|e|r}Ce.getKeyForAutomaticLookahead=m$;var dj=32-Ce.BITS_FOR_ALT_IDX});var FA=C(Hc=>{"use strict";Object.defineProperty(Hc,"__esModule",{value:!0});Hc.LooksAhead=void 0;var Yn=Qa(),on=_e(),LA=vr(),Xn=Uc(),Bi=Ya(),h$=function(){function r(){}return r.prototype.initLooksAhead=function(e){this.dynamicTokensEnabled=(0,on.has)(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:LA.DEFAULT_PARSER_CONFIG.dynamicTokensEnabled,this.maxLookahead=(0,on.has)(e,"maxLookahead")?e.maxLookahead:LA.DEFAULT_PARSER_CONFIG.maxLookahead,this.lookAheadFuncsCache=(0,on.isES2015MapSupported)()?new Map:[],(0,on.isES2015MapSupported)()?(this.getLaFuncFromCache=this.getLaFuncFromMap,this.setLaFuncCache=this.setLaFuncCacheUsingMap):(this.getLaFuncFromCache=this.getLaFuncFromObj,this.setLaFuncCache=this.setLaFuncUsingObj)},r.prototype.preComputeLookaheadFunctions=function(e){var t=this;(0,on.forEach)(e,function(n){t.TRACE_INIT(n.name+" Rule Lookahead",function(){var i=(0,Bi.collectMethods)(n),o=i.alternation,a=i.repetition,s=i.option,u=i.repetitionMandatory,c=i.repetitionMandatoryWithSeparator,l=i.repetitionWithSeparator;(0,on.forEach)(o,function(d){var g=d.idx===0?"":d.idx;t.TRACE_INIT(""+(0,Bi.getProductionDslName)(d)+g,function(){var y=(0,Yn.buildLookaheadFuncForOr)(d.idx,n,d.maxLookahead||t.maxLookahead,d.hasPredicates,t.dynamicTokensEnabled,t.lookAheadBuilderForAlternatives),p=(0,Xn.getKeyForAutomaticLookahead)(t.fullRuleNameToShort[n.name],Xn.OR_IDX,d.idx);t.setLaFuncCache(p,y)})}),(0,on.forEach)(a,function(d){t.computeLookaheadFunc(n,d.idx,Xn.MANY_IDX,Yn.PROD_TYPE.REPETITION,d.maxLookahead,(0,Bi.getProductionDslName)(d))}),(0,on.forEach)(s,function(d){t.computeLookaheadFunc(n,d.idx,Xn.OPTION_IDX,Yn.PROD_TYPE.OPTION,d.maxLookahead,(0,Bi.getProductionDslName)(d))}),(0,on.forEach)(u,function(d){t.computeLookaheadFunc(n,d.idx,Xn.AT_LEAST_ONE_IDX,Yn.PROD_TYPE.REPETITION_MANDATORY,d.maxLookahead,(0,Bi.getProductionDslName)(d))}),(0,on.forEach)(c,function(d){t.computeLookaheadFunc(n,d.idx,Xn.AT_LEAST_ONE_SEP_IDX,Yn.PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR,d.maxLookahead,(0,Bi.getProductionDslName)(d))}),(0,on.forEach)(l,function(d){t.computeLookaheadFunc(n,d.idx,Xn.MANY_SEP_IDX,Yn.PROD_TYPE.REPETITION_WITH_SEPARATOR,d.maxLookahead,(0,Bi.getProductionDslName)(d))})})})},r.prototype.computeLookaheadFunc=function(e,t,n,i,o,a){var s=this;this.TRACE_INIT(""+a+(t===0?"":t),function(){var u=(0,Yn.buildLookaheadFuncForOptionalProd)(t,e,o||s.maxLookahead,s.dynamicTokensEnabled,i,s.lookAheadBuilderForOptional),c=(0,Xn.getKeyForAutomaticLookahead)(s.fullRuleNameToShort[e.name],n,t);s.setLaFuncCache(c,u)})},r.prototype.lookAheadBuilderForOptional=function(e,t,n){return(0,Yn.buildSingleAlternativeLookaheadFunction)(e,t,n)},r.prototype.lookAheadBuilderForAlternatives=function(e,t,n,i){return(0,Yn.buildAlternativesLookAheadFunc)(e,t,n,i)},r.prototype.getKeyForAutomaticLookahead=function(e,t){var n=this.getLastExplicitRuleShortName();return(0,Xn.getKeyForAutomaticLookahead)(n,e,t)},r.prototype.getLaFuncFromCache=function(e){},r.prototype.getLaFuncFromMap=function(e){return this.lookAheadFuncsCache.get(e)},r.prototype.getLaFuncFromObj=function(e){return this.lookAheadFuncsCache[e]},r.prototype.setLaFuncCache=function(e,t){},r.prototype.setLaFuncCacheUsingMap=function(e,t){this.lookAheadFuncsCache.set(e,t)},r.prototype.setLaFuncUsingObj=function(e,t){this.lookAheadFuncsCache[e]=t},r}();Hc.LooksAhead=h$});var qA=C(Sn=>{"use strict";Object.defineProperty(Sn,"__esModule",{value:!0});Sn.addNoneTerminalToCst=Sn.addTerminalToCst=Sn.setNodeLocationFull=Sn.setNodeLocationOnlyOffset=void 0;function y$(r,e){isNaN(r.startOffset)===!0?(r.startOffset=e.startOffset,r.endOffset=e.endOffset):r.endOffset<e.endOffset&&(r.endOffset=e.endOffset)}Sn.setNodeLocationOnlyOffset=y$;function g$(r,e){isNaN(r.startOffset)===!0?(r.startOffset=e.startOffset,r.startColumn=e.startColumn,r.startLine=e.startLine,r.endOffset=e.endOffset,r.endColumn=e.endColumn,r.endLine=e.endLine):r.endOffset<e.endOffset&&(r.endOffset=e.endOffset,r.endColumn=e.endColumn,r.endLine=e.endLine)}Sn.setNodeLocationFull=g$;function v$(r,e,t){r.children[t]===void 0?r.children[t]=[e]:r.children[t].push(e)}Sn.addTerminalToCst=v$;function T$(r,e,t){r.children[e]===void 0?r.children[e]=[t]:r.children[e].push(t)}Sn.addNoneTerminalToCst=T$});var ch=C(_i=>{"use strict";Object.defineProperty(_i,"__esModule",{value:!0});_i.defineNameProp=_i.functionName=_i.classNameFromInstance=void 0;var R$=_e();function _$(r){return GA(r.constructor)}_i.classNameFromInstance=_$;var jA="name";function GA(r){var e=r.name;return e||"anonymous"}_i.functionName=GA;function A$(r,e){var t=Object.getOwnPropertyDescriptor(r,jA);return(0,R$.isUndefined)(t)||t.configurable?(Object.defineProperty(r,jA,{enumerable:!1,configurable:!0,writable:!1,value:e}),!0):!1}_i.defineNameProp=A$});var BA=C(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Gt.validateRedundantMethods=Gt.validateMissingCstMethods=Gt.validateVisitor=Gt.CstVisitorDefinitionError=Gt.createBaseVisitorConstructorWithDefaults=Gt.createBaseSemanticVisitorConstructor=Gt.defaultVisit=void 0;var $r=_e(),rs=ch();function UA(r,e){for(var t=(0,$r.keys)(r),n=t.length,i=0;i<n;i++)for(var o=t[i],a=r[o],s=a.length,u=0;u<s;u++){var c=a[u];c.tokenTypeIdx===void 0&&this[c.name](c.children,e)}}Gt.defaultVisit=UA;function b$(r,e){var t=function(){};(0,rs.defineNameProp)(t,r+"BaseSemantics");var n={visit:function(i,o){if((0,$r.isArray)(i)&&(i=i[0]),!(0,$r.isUndefined)(i))return this[i.name](i.children,o)},validateVisitor:function(){var i=HA(this,e);if(!(0,$r.isEmpty)(i)){var o=(0,$r.map)(i,function(a){return a.msg});throw Error("Errors Detected in CST Visitor <"+(0,rs.functionName)(this.constructor)+`>:
3665
3665
  `+(""+o.join(`
3666
3666
 
3667
3667
  `).replace(/\n/g,`
3668
- `)))}}};return t.prototype=n,t.prototype.constructor=t,t._RULE_NAMES=e,t}Ut.createBaseSemanticVisitorConstructor=P$;function k$(r,e,t){var n=function(){};(0,rs.defineNameProp)(n,r+"BaseSemanticsWithDefaults");var i=Object.create(t.prototype);return(0,$r.forEach)(e,function(o){i[o]=WA}),n.prototype=i,n.prototype.constructor=n,n}Ut.createBaseVisitorConstructorWithDefaults=k$;var fh;(function(r){r[r.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",r[r.MISSING_METHOD=1]="MISSING_METHOD"})(fh=Ut.CstVisitorDefinitionError||(Ut.CstVisitorDefinitionError={}));function KA(r,e){var t=BA(r,e),n=zA(r,e);return t.concat(n)}Ut.validateVisitor=KA;function BA(r,e){var t=(0,$r.map)(e,function(n){if(!(0,$r.isFunction)(r[n]))return{msg:"Missing visitor method: <"+n+"> on "+(0,rs.functionName)(r.constructor)+" CST Visitor.",type:fh.MISSING_METHOD,methodName:n}});return(0,$r.compact)(t)}Ut.validateMissingCstMethods=BA;var x$=["constructor","visit","validateVisitor"];function zA(r,e){var t=[];for(var n in r)(0,$r.isFunction)(r[n])&&!(0,$r.contains)(x$,n)&&!(0,$r.contains)(e,n)&&t.push({msg:"Redundant visitor method: <"+n+"> on "+(0,rs.functionName)(r.constructor)+` CST Visitor
3668
+ `)))}}};return t.prototype=n,t.prototype.constructor=t,t._RULE_NAMES=e,t}Gt.createBaseSemanticVisitorConstructor=b$;function E$(r,e,t){var n=function(){};(0,rs.defineNameProp)(n,r+"BaseSemanticsWithDefaults");var i=Object.create(t.prototype);return(0,$r.forEach)(e,function(o){i[o]=UA}),n.prototype=i,n.prototype.constructor=n,n}Gt.createBaseVisitorConstructorWithDefaults=E$;var lh;(function(r){r[r.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",r[r.MISSING_METHOD=1]="MISSING_METHOD"})(lh=Gt.CstVisitorDefinitionError||(Gt.CstVisitorDefinitionError={}));function HA(r,e){var t=WA(r,e),n=KA(r,e);return t.concat(n)}Gt.validateVisitor=HA;function WA(r,e){var t=(0,$r.map)(e,function(n){if(!(0,$r.isFunction)(r[n]))return{msg:"Missing visitor method: <"+n+"> on "+(0,rs.functionName)(r.constructor)+" CST Visitor.",type:lh.MISSING_METHOD,methodName:n}});return(0,$r.compact)(t)}Gt.validateMissingCstMethods=WA;var C$=["constructor","visit","validateVisitor"];function KA(r,e){var t=[];for(var n in r)(0,$r.isFunction)(r[n])&&!(0,$r.contains)(C$,n)&&!(0,$r.contains)(e,n)&&t.push({msg:"Redundant visitor method: <"+n+"> on "+(0,rs.functionName)(r.constructor)+` CST Visitor
3669
3669
  There is no Grammar Rule corresponding to this method's name.
3670
- `,type:fh.REDUNDANT_METHOD,methodName:n});return t}Ut.validateRedundantMethods=zA});var XA=C(Kc=>{"use strict";Object.defineProperty(Kc,"__esModule",{value:!0});Kc.TreeBuilder=void 0;var zo=GA(),bt=_e(),YA=VA(),S$=vr(),N$=function(){function r(){}return r.prototype.initTreeBuilder=function(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=(0,bt.has)(e,"nodeLocationTracking")?e.nodeLocationTracking:S$.DEFAULT_PARSER_CONFIG.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=bt.NOOP,this.cstFinallyStateUpdate=bt.NOOP,this.cstPostTerminal=bt.NOOP,this.cstPostNonTerminal=bt.NOOP,this.cstPostRule=bt.NOOP;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=zo.setNodeLocationFull,this.setNodeLocationFromNode=zo.setNodeLocationFull,this.cstPostRule=bt.NOOP,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=bt.NOOP,this.setNodeLocationFromNode=bt.NOOP,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=zo.setNodeLocationOnlyOffset,this.setNodeLocationFromNode=zo.setNodeLocationOnlyOffset,this.cstPostRule=bt.NOOP,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=bt.NOOP,this.setNodeLocationFromNode=bt.NOOP,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=bt.NOOP,this.setNodeLocationFromNode=bt.NOOP,this.cstPostRule=bt.NOOP,this.setInitialNodeLocation=bt.NOOP;else throw Error('Invalid <nodeLocationTracking> config option: "'+e.nodeLocationTracking+'"')},r.prototype.setInitialNodeLocationOnlyOffsetRecovery=function(e){e.location={startOffset:NaN,endOffset:NaN}},r.prototype.setInitialNodeLocationOnlyOffsetRegular=function(e){e.location={startOffset:this.LA(1).startOffset,endOffset:NaN}},r.prototype.setInitialNodeLocationFullRecovery=function(e){e.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}},r.prototype.setInitialNodeLocationFullRegular=function(e){var t=this.LA(1);e.location={startOffset:t.startOffset,startLine:t.startLine,startColumn:t.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}},r.prototype.cstInvocationStateUpdate=function(e,t){var n={name:e,children:{}};this.setInitialNodeLocation(n),this.CST_STACK.push(n)},r.prototype.cstFinallyStateUpdate=function(){this.CST_STACK.pop()},r.prototype.cstPostRuleFull=function(e){var 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)},r.prototype.cstPostRuleOnlyOffset=function(e){var t=this.LA(0),n=e.location;n.startOffset<=t.startOffset?n.endOffset=t.endOffset:n.startOffset=NaN},r.prototype.cstPostTerminal=function(e,t){var n=this.CST_STACK[this.CST_STACK.length-1];(0,zo.addTerminalToCst)(n,t,e),this.setNodeLocationFromToken(n.location,t)},r.prototype.cstPostNonTerminal=function(e,t){var n=this.CST_STACK[this.CST_STACK.length-1];(0,zo.addNoneTerminalToCst)(n,t,e),this.setNodeLocationFromNode(n.location,e.location)},r.prototype.getBaseCstVisitorConstructor=function(){if((0,bt.isUndefined)(this.baseCstVisitorConstructor)){var e=(0,YA.createBaseSemanticVisitorConstructor)(this.className,(0,bt.keys)(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor},r.prototype.getBaseCstVisitorConstructorWithDefaults=function(){if((0,bt.isUndefined)(this.baseCstVisitorWithDefaultsConstructor)){var e=(0,YA.createBaseVisitorConstructorWithDefaults)(this.className,(0,bt.keys)(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor},r.prototype.getLastExplicitRuleShortName=function(){var e=this.RULE_STACK;return e[e.length-1]},r.prototype.getPreviousExplicitRuleShortName=function(){var e=this.RULE_STACK;return e[e.length-2]},r.prototype.getLastExplicitRuleOccurrenceIndex=function(){var e=this.RULE_OCCURRENCE_STACK;return e[e.length-1]},r}();Kc.TreeBuilder=N$});var ZA=C(Bc=>{"use strict";Object.defineProperty(Bc,"__esModule",{value:!0});Bc.LexerAdapter=void 0;var JA=vr(),D$=function(){function r(){}return r.prototype.initLexerAdapter=function(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1},Object.defineProperty(r.prototype,"input",{get:function(){return this.tokVector},set:function(e){if(this.selfAnalysisDone!==!0)throw Error("Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=e,this.tokVectorLength=e.length},enumerable:!1,configurable:!0}),r.prototype.SKIP_TOKEN=function(){return this.currIdx<=this.tokVector.length-2?(this.consumeToken(),this.LA(1)):JA.END_OF_FILE},r.prototype.LA=function(e){var t=this.currIdx+e;return t<0||this.tokVectorLength<=t?JA.END_OF_FILE:this.tokVector[t]},r.prototype.consumeToken=function(){this.currIdx++},r.prototype.exportLexerState=function(){return this.currIdx},r.prototype.importLexerState=function(e){this.currIdx=e},r.prototype.resetLexerState=function(){this.currIdx=-1},r.prototype.moveToTerminatedState=function(){this.currIdx=this.tokVector.length-1},r.prototype.getLexerPosition=function(){return this.exportLexerState()},r}();Bc.LexerAdapter=D$});var eb=C(zc=>{"use strict";Object.defineProperty(zc,"__esModule",{value:!0});zc.RecognizerApi=void 0;var QA=_e(),w$=Bo(),ph=vr(),I$=Xa(),O$=sh(),$$=fr(),M$=function(){function r(){}return r.prototype.ACTION=function(e){return e.call(this)},r.prototype.consume=function(e,t,n){return this.consumeInternal(t,e,n)},r.prototype.subrule=function(e,t,n){return this.subruleInternal(t,e,n)},r.prototype.option=function(e,t){return this.optionInternal(t,e)},r.prototype.or=function(e,t){return this.orInternal(t,e)},r.prototype.many=function(e,t){return this.manyInternal(e,t)},r.prototype.atLeastOne=function(e,t){return this.atLeastOneInternal(e,t)},r.prototype.CONSUME=function(e,t){return this.consumeInternal(e,0,t)},r.prototype.CONSUME1=function(e,t){return this.consumeInternal(e,1,t)},r.prototype.CONSUME2=function(e,t){return this.consumeInternal(e,2,t)},r.prototype.CONSUME3=function(e,t){return this.consumeInternal(e,3,t)},r.prototype.CONSUME4=function(e,t){return this.consumeInternal(e,4,t)},r.prototype.CONSUME5=function(e,t){return this.consumeInternal(e,5,t)},r.prototype.CONSUME6=function(e,t){return this.consumeInternal(e,6,t)},r.prototype.CONSUME7=function(e,t){return this.consumeInternal(e,7,t)},r.prototype.CONSUME8=function(e,t){return this.consumeInternal(e,8,t)},r.prototype.CONSUME9=function(e,t){return this.consumeInternal(e,9,t)},r.prototype.SUBRULE=function(e,t){return this.subruleInternal(e,0,t)},r.prototype.SUBRULE1=function(e,t){return this.subruleInternal(e,1,t)},r.prototype.SUBRULE2=function(e,t){return this.subruleInternal(e,2,t)},r.prototype.SUBRULE3=function(e,t){return this.subruleInternal(e,3,t)},r.prototype.SUBRULE4=function(e,t){return this.subruleInternal(e,4,t)},r.prototype.SUBRULE5=function(e,t){return this.subruleInternal(e,5,t)},r.prototype.SUBRULE6=function(e,t){return this.subruleInternal(e,6,t)},r.prototype.SUBRULE7=function(e,t){return this.subruleInternal(e,7,t)},r.prototype.SUBRULE8=function(e,t){return this.subruleInternal(e,8,t)},r.prototype.SUBRULE9=function(e,t){return this.subruleInternal(e,9,t)},r.prototype.OPTION=function(e){return this.optionInternal(e,0)},r.prototype.OPTION1=function(e){return this.optionInternal(e,1)},r.prototype.OPTION2=function(e){return this.optionInternal(e,2)},r.prototype.OPTION3=function(e){return this.optionInternal(e,3)},r.prototype.OPTION4=function(e){return this.optionInternal(e,4)},r.prototype.OPTION5=function(e){return this.optionInternal(e,5)},r.prototype.OPTION6=function(e){return this.optionInternal(e,6)},r.prototype.OPTION7=function(e){return this.optionInternal(e,7)},r.prototype.OPTION8=function(e){return this.optionInternal(e,8)},r.prototype.OPTION9=function(e){return this.optionInternal(e,9)},r.prototype.OR=function(e){return this.orInternal(e,0)},r.prototype.OR1=function(e){return this.orInternal(e,1)},r.prototype.OR2=function(e){return this.orInternal(e,2)},r.prototype.OR3=function(e){return this.orInternal(e,3)},r.prototype.OR4=function(e){return this.orInternal(e,4)},r.prototype.OR5=function(e){return this.orInternal(e,5)},r.prototype.OR6=function(e){return this.orInternal(e,6)},r.prototype.OR7=function(e){return this.orInternal(e,7)},r.prototype.OR8=function(e){return this.orInternal(e,8)},r.prototype.OR9=function(e){return this.orInternal(e,9)},r.prototype.MANY=function(e){this.manyInternal(0,e)},r.prototype.MANY1=function(e){this.manyInternal(1,e)},r.prototype.MANY2=function(e){this.manyInternal(2,e)},r.prototype.MANY3=function(e){this.manyInternal(3,e)},r.prototype.MANY4=function(e){this.manyInternal(4,e)},r.prototype.MANY5=function(e){this.manyInternal(5,e)},r.prototype.MANY6=function(e){this.manyInternal(6,e)},r.prototype.MANY7=function(e){this.manyInternal(7,e)},r.prototype.MANY8=function(e){this.manyInternal(8,e)},r.prototype.MANY9=function(e){this.manyInternal(9,e)},r.prototype.MANY_SEP=function(e){this.manySepFirstInternal(0,e)},r.prototype.MANY_SEP1=function(e){this.manySepFirstInternal(1,e)},r.prototype.MANY_SEP2=function(e){this.manySepFirstInternal(2,e)},r.prototype.MANY_SEP3=function(e){this.manySepFirstInternal(3,e)},r.prototype.MANY_SEP4=function(e){this.manySepFirstInternal(4,e)},r.prototype.MANY_SEP5=function(e){this.manySepFirstInternal(5,e)},r.prototype.MANY_SEP6=function(e){this.manySepFirstInternal(6,e)},r.prototype.MANY_SEP7=function(e){this.manySepFirstInternal(7,e)},r.prototype.MANY_SEP8=function(e){this.manySepFirstInternal(8,e)},r.prototype.MANY_SEP9=function(e){this.manySepFirstInternal(9,e)},r.prototype.AT_LEAST_ONE=function(e){this.atLeastOneInternal(0,e)},r.prototype.AT_LEAST_ONE1=function(e){return this.atLeastOneInternal(1,e)},r.prototype.AT_LEAST_ONE2=function(e){this.atLeastOneInternal(2,e)},r.prototype.AT_LEAST_ONE3=function(e){this.atLeastOneInternal(3,e)},r.prototype.AT_LEAST_ONE4=function(e){this.atLeastOneInternal(4,e)},r.prototype.AT_LEAST_ONE5=function(e){this.atLeastOneInternal(5,e)},r.prototype.AT_LEAST_ONE6=function(e){this.atLeastOneInternal(6,e)},r.prototype.AT_LEAST_ONE7=function(e){this.atLeastOneInternal(7,e)},r.prototype.AT_LEAST_ONE8=function(e){this.atLeastOneInternal(8,e)},r.prototype.AT_LEAST_ONE9=function(e){this.atLeastOneInternal(9,e)},r.prototype.AT_LEAST_ONE_SEP=function(e){this.atLeastOneSepFirstInternal(0,e)},r.prototype.AT_LEAST_ONE_SEP1=function(e){this.atLeastOneSepFirstInternal(1,e)},r.prototype.AT_LEAST_ONE_SEP2=function(e){this.atLeastOneSepFirstInternal(2,e)},r.prototype.AT_LEAST_ONE_SEP3=function(e){this.atLeastOneSepFirstInternal(3,e)},r.prototype.AT_LEAST_ONE_SEP4=function(e){this.atLeastOneSepFirstInternal(4,e)},r.prototype.AT_LEAST_ONE_SEP5=function(e){this.atLeastOneSepFirstInternal(5,e)},r.prototype.AT_LEAST_ONE_SEP6=function(e){this.atLeastOneSepFirstInternal(6,e)},r.prototype.AT_LEAST_ONE_SEP7=function(e){this.atLeastOneSepFirstInternal(7,e)},r.prototype.AT_LEAST_ONE_SEP8=function(e){this.atLeastOneSepFirstInternal(8,e)},r.prototype.AT_LEAST_ONE_SEP9=function(e){this.atLeastOneSepFirstInternal(9,e)},r.prototype.RULE=function(e,t,n){if(n===void 0&&(n=ph.DEFAULT_RULE_CONFIG),(0,QA.contains)(this.definedRulesNames,e)){var i=I$.defaultGrammarValidatorErrorProvider.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),o={message:i,type:ph.ParserDefinitionErrorType.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(o)}this.definedRulesNames.push(e);var a=this.defineRule(e,t,n);return this[e]=a,a},r.prototype.OVERRIDE_RULE=function(e,t,n){n===void 0&&(n=ph.DEFAULT_RULE_CONFIG);var i=[];i=i.concat((0,O$.validateRuleIsOverridden)(e,this.definedRulesNames,this.className)),this.definitionErrors=this.definitionErrors.concat(i);var o=this.defineRule(e,t,n);return this[e]=o,o},r.prototype.BACKTRACK=function(e,t){return function(){this.isBackTrackingStack.push(1);var n=this.saveRecogState();try{return e.apply(this,t),!0}catch(i){if((0,w$.isRecognitionException)(i))return!1;throw i}finally{this.reloadRecogState(n),this.isBackTrackingStack.pop()}}},r.prototype.getGAstProductions=function(){return this.gastProductionsCache},r.prototype.getSerializedGastProductions=function(){return(0,$$.serializeGrammar)((0,QA.values)(this.gastProductionsCache))},r}();zc.RecognizerApi=M$});var ib=C(Yc=>{"use strict";Object.defineProperty(Yc,"__esModule",{value:!0});Yc.RecognizerEngine=void 0;var at=_e(),Tr=Hc(),Vc=Bo(),tb=Qa(),Vo=Za(),rb=vr(),L$=lh(),nb=vi(),ns=Go(),F$=dh(),q$=function(){function r(){}return r.prototype.initRecognizerEngine=function(e,t){if(this.className=(0,F$.classNameFromInstance)(this),this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=ns.tokenStructuredMatcherNoCategories,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},(0,at.has)(t,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
3670
+ `,type:lh.REDUNDANT_METHOD,methodName:n});return t}Gt.validateRedundantMethods=KA});var VA=C(Wc=>{"use strict";Object.defineProperty(Wc,"__esModule",{value:!0});Wc.TreeBuilder=void 0;var zo=qA(),bt=_e(),zA=BA(),P$=vr(),k$=function(){function r(){}return r.prototype.initTreeBuilder=function(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=(0,bt.has)(e,"nodeLocationTracking")?e.nodeLocationTracking:P$.DEFAULT_PARSER_CONFIG.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=bt.NOOP,this.cstFinallyStateUpdate=bt.NOOP,this.cstPostTerminal=bt.NOOP,this.cstPostNonTerminal=bt.NOOP,this.cstPostRule=bt.NOOP;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=zo.setNodeLocationFull,this.setNodeLocationFromNode=zo.setNodeLocationFull,this.cstPostRule=bt.NOOP,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=bt.NOOP,this.setNodeLocationFromNode=bt.NOOP,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=zo.setNodeLocationOnlyOffset,this.setNodeLocationFromNode=zo.setNodeLocationOnlyOffset,this.cstPostRule=bt.NOOP,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=bt.NOOP,this.setNodeLocationFromNode=bt.NOOP,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=bt.NOOP,this.setNodeLocationFromNode=bt.NOOP,this.cstPostRule=bt.NOOP,this.setInitialNodeLocation=bt.NOOP;else throw Error('Invalid <nodeLocationTracking> config option: "'+e.nodeLocationTracking+'"')},r.prototype.setInitialNodeLocationOnlyOffsetRecovery=function(e){e.location={startOffset:NaN,endOffset:NaN}},r.prototype.setInitialNodeLocationOnlyOffsetRegular=function(e){e.location={startOffset:this.LA(1).startOffset,endOffset:NaN}},r.prototype.setInitialNodeLocationFullRecovery=function(e){e.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}},r.prototype.setInitialNodeLocationFullRegular=function(e){var t=this.LA(1);e.location={startOffset:t.startOffset,startLine:t.startLine,startColumn:t.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}},r.prototype.cstInvocationStateUpdate=function(e,t){var n={name:e,children:{}};this.setInitialNodeLocation(n),this.CST_STACK.push(n)},r.prototype.cstFinallyStateUpdate=function(){this.CST_STACK.pop()},r.prototype.cstPostRuleFull=function(e){var 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)},r.prototype.cstPostRuleOnlyOffset=function(e){var t=this.LA(0),n=e.location;n.startOffset<=t.startOffset?n.endOffset=t.endOffset:n.startOffset=NaN},r.prototype.cstPostTerminal=function(e,t){var n=this.CST_STACK[this.CST_STACK.length-1];(0,zo.addTerminalToCst)(n,t,e),this.setNodeLocationFromToken(n.location,t)},r.prototype.cstPostNonTerminal=function(e,t){var n=this.CST_STACK[this.CST_STACK.length-1];(0,zo.addNoneTerminalToCst)(n,t,e),this.setNodeLocationFromNode(n.location,e.location)},r.prototype.getBaseCstVisitorConstructor=function(){if((0,bt.isUndefined)(this.baseCstVisitorConstructor)){var e=(0,zA.createBaseSemanticVisitorConstructor)(this.className,(0,bt.keys)(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor},r.prototype.getBaseCstVisitorConstructorWithDefaults=function(){if((0,bt.isUndefined)(this.baseCstVisitorWithDefaultsConstructor)){var e=(0,zA.createBaseVisitorConstructorWithDefaults)(this.className,(0,bt.keys)(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor},r.prototype.getLastExplicitRuleShortName=function(){var e=this.RULE_STACK;return e[e.length-1]},r.prototype.getPreviousExplicitRuleShortName=function(){var e=this.RULE_STACK;return e[e.length-2]},r.prototype.getLastExplicitRuleOccurrenceIndex=function(){var e=this.RULE_OCCURRENCE_STACK;return e[e.length-1]},r}();Wc.TreeBuilder=k$});var XA=C(Kc=>{"use strict";Object.defineProperty(Kc,"__esModule",{value:!0});Kc.LexerAdapter=void 0;var YA=vr(),x$=function(){function r(){}return r.prototype.initLexerAdapter=function(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1},Object.defineProperty(r.prototype,"input",{get:function(){return this.tokVector},set:function(e){if(this.selfAnalysisDone!==!0)throw Error("Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=e,this.tokVectorLength=e.length},enumerable:!1,configurable:!0}),r.prototype.SKIP_TOKEN=function(){return this.currIdx<=this.tokVector.length-2?(this.consumeToken(),this.LA(1)):YA.END_OF_FILE},r.prototype.LA=function(e){var t=this.currIdx+e;return t<0||this.tokVectorLength<=t?YA.END_OF_FILE:this.tokVector[t]},r.prototype.consumeToken=function(){this.currIdx++},r.prototype.exportLexerState=function(){return this.currIdx},r.prototype.importLexerState=function(e){this.currIdx=e},r.prototype.resetLexerState=function(){this.currIdx=-1},r.prototype.moveToTerminatedState=function(){this.currIdx=this.tokVector.length-1},r.prototype.getLexerPosition=function(){return this.exportLexerState()},r}();Kc.LexerAdapter=x$});var ZA=C(Bc=>{"use strict";Object.defineProperty(Bc,"__esModule",{value:!0});Bc.RecognizerApi=void 0;var JA=_e(),S$=Bo(),dh=vr(),N$=Xa(),D$=oh(),w$=fr(),I$=function(){function r(){}return r.prototype.ACTION=function(e){return e.call(this)},r.prototype.consume=function(e,t,n){return this.consumeInternal(t,e,n)},r.prototype.subrule=function(e,t,n){return this.subruleInternal(t,e,n)},r.prototype.option=function(e,t){return this.optionInternal(t,e)},r.prototype.or=function(e,t){return this.orInternal(t,e)},r.prototype.many=function(e,t){return this.manyInternal(e,t)},r.prototype.atLeastOne=function(e,t){return this.atLeastOneInternal(e,t)},r.prototype.CONSUME=function(e,t){return this.consumeInternal(e,0,t)},r.prototype.CONSUME1=function(e,t){return this.consumeInternal(e,1,t)},r.prototype.CONSUME2=function(e,t){return this.consumeInternal(e,2,t)},r.prototype.CONSUME3=function(e,t){return this.consumeInternal(e,3,t)},r.prototype.CONSUME4=function(e,t){return this.consumeInternal(e,4,t)},r.prototype.CONSUME5=function(e,t){return this.consumeInternal(e,5,t)},r.prototype.CONSUME6=function(e,t){return this.consumeInternal(e,6,t)},r.prototype.CONSUME7=function(e,t){return this.consumeInternal(e,7,t)},r.prototype.CONSUME8=function(e,t){return this.consumeInternal(e,8,t)},r.prototype.CONSUME9=function(e,t){return this.consumeInternal(e,9,t)},r.prototype.SUBRULE=function(e,t){return this.subruleInternal(e,0,t)},r.prototype.SUBRULE1=function(e,t){return this.subruleInternal(e,1,t)},r.prototype.SUBRULE2=function(e,t){return this.subruleInternal(e,2,t)},r.prototype.SUBRULE3=function(e,t){return this.subruleInternal(e,3,t)},r.prototype.SUBRULE4=function(e,t){return this.subruleInternal(e,4,t)},r.prototype.SUBRULE5=function(e,t){return this.subruleInternal(e,5,t)},r.prototype.SUBRULE6=function(e,t){return this.subruleInternal(e,6,t)},r.prototype.SUBRULE7=function(e,t){return this.subruleInternal(e,7,t)},r.prototype.SUBRULE8=function(e,t){return this.subruleInternal(e,8,t)},r.prototype.SUBRULE9=function(e,t){return this.subruleInternal(e,9,t)},r.prototype.OPTION=function(e){return this.optionInternal(e,0)},r.prototype.OPTION1=function(e){return this.optionInternal(e,1)},r.prototype.OPTION2=function(e){return this.optionInternal(e,2)},r.prototype.OPTION3=function(e){return this.optionInternal(e,3)},r.prototype.OPTION4=function(e){return this.optionInternal(e,4)},r.prototype.OPTION5=function(e){return this.optionInternal(e,5)},r.prototype.OPTION6=function(e){return this.optionInternal(e,6)},r.prototype.OPTION7=function(e){return this.optionInternal(e,7)},r.prototype.OPTION8=function(e){return this.optionInternal(e,8)},r.prototype.OPTION9=function(e){return this.optionInternal(e,9)},r.prototype.OR=function(e){return this.orInternal(e,0)},r.prototype.OR1=function(e){return this.orInternal(e,1)},r.prototype.OR2=function(e){return this.orInternal(e,2)},r.prototype.OR3=function(e){return this.orInternal(e,3)},r.prototype.OR4=function(e){return this.orInternal(e,4)},r.prototype.OR5=function(e){return this.orInternal(e,5)},r.prototype.OR6=function(e){return this.orInternal(e,6)},r.prototype.OR7=function(e){return this.orInternal(e,7)},r.prototype.OR8=function(e){return this.orInternal(e,8)},r.prototype.OR9=function(e){return this.orInternal(e,9)},r.prototype.MANY=function(e){this.manyInternal(0,e)},r.prototype.MANY1=function(e){this.manyInternal(1,e)},r.prototype.MANY2=function(e){this.manyInternal(2,e)},r.prototype.MANY3=function(e){this.manyInternal(3,e)},r.prototype.MANY4=function(e){this.manyInternal(4,e)},r.prototype.MANY5=function(e){this.manyInternal(5,e)},r.prototype.MANY6=function(e){this.manyInternal(6,e)},r.prototype.MANY7=function(e){this.manyInternal(7,e)},r.prototype.MANY8=function(e){this.manyInternal(8,e)},r.prototype.MANY9=function(e){this.manyInternal(9,e)},r.prototype.MANY_SEP=function(e){this.manySepFirstInternal(0,e)},r.prototype.MANY_SEP1=function(e){this.manySepFirstInternal(1,e)},r.prototype.MANY_SEP2=function(e){this.manySepFirstInternal(2,e)},r.prototype.MANY_SEP3=function(e){this.manySepFirstInternal(3,e)},r.prototype.MANY_SEP4=function(e){this.manySepFirstInternal(4,e)},r.prototype.MANY_SEP5=function(e){this.manySepFirstInternal(5,e)},r.prototype.MANY_SEP6=function(e){this.manySepFirstInternal(6,e)},r.prototype.MANY_SEP7=function(e){this.manySepFirstInternal(7,e)},r.prototype.MANY_SEP8=function(e){this.manySepFirstInternal(8,e)},r.prototype.MANY_SEP9=function(e){this.manySepFirstInternal(9,e)},r.prototype.AT_LEAST_ONE=function(e){this.atLeastOneInternal(0,e)},r.prototype.AT_LEAST_ONE1=function(e){return this.atLeastOneInternal(1,e)},r.prototype.AT_LEAST_ONE2=function(e){this.atLeastOneInternal(2,e)},r.prototype.AT_LEAST_ONE3=function(e){this.atLeastOneInternal(3,e)},r.prototype.AT_LEAST_ONE4=function(e){this.atLeastOneInternal(4,e)},r.prototype.AT_LEAST_ONE5=function(e){this.atLeastOneInternal(5,e)},r.prototype.AT_LEAST_ONE6=function(e){this.atLeastOneInternal(6,e)},r.prototype.AT_LEAST_ONE7=function(e){this.atLeastOneInternal(7,e)},r.prototype.AT_LEAST_ONE8=function(e){this.atLeastOneInternal(8,e)},r.prototype.AT_LEAST_ONE9=function(e){this.atLeastOneInternal(9,e)},r.prototype.AT_LEAST_ONE_SEP=function(e){this.atLeastOneSepFirstInternal(0,e)},r.prototype.AT_LEAST_ONE_SEP1=function(e){this.atLeastOneSepFirstInternal(1,e)},r.prototype.AT_LEAST_ONE_SEP2=function(e){this.atLeastOneSepFirstInternal(2,e)},r.prototype.AT_LEAST_ONE_SEP3=function(e){this.atLeastOneSepFirstInternal(3,e)},r.prototype.AT_LEAST_ONE_SEP4=function(e){this.atLeastOneSepFirstInternal(4,e)},r.prototype.AT_LEAST_ONE_SEP5=function(e){this.atLeastOneSepFirstInternal(5,e)},r.prototype.AT_LEAST_ONE_SEP6=function(e){this.atLeastOneSepFirstInternal(6,e)},r.prototype.AT_LEAST_ONE_SEP7=function(e){this.atLeastOneSepFirstInternal(7,e)},r.prototype.AT_LEAST_ONE_SEP8=function(e){this.atLeastOneSepFirstInternal(8,e)},r.prototype.AT_LEAST_ONE_SEP9=function(e){this.atLeastOneSepFirstInternal(9,e)},r.prototype.RULE=function(e,t,n){if(n===void 0&&(n=dh.DEFAULT_RULE_CONFIG),(0,JA.contains)(this.definedRulesNames,e)){var i=N$.defaultGrammarValidatorErrorProvider.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),o={message:i,type:dh.ParserDefinitionErrorType.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(o)}this.definedRulesNames.push(e);var a=this.defineRule(e,t,n);return this[e]=a,a},r.prototype.OVERRIDE_RULE=function(e,t,n){n===void 0&&(n=dh.DEFAULT_RULE_CONFIG);var i=[];i=i.concat((0,D$.validateRuleIsOverridden)(e,this.definedRulesNames,this.className)),this.definitionErrors=this.definitionErrors.concat(i);var o=this.defineRule(e,t,n);return this[e]=o,o},r.prototype.BACKTRACK=function(e,t){return function(){this.isBackTrackingStack.push(1);var n=this.saveRecogState();try{return e.apply(this,t),!0}catch(i){if((0,S$.isRecognitionException)(i))return!1;throw i}finally{this.reloadRecogState(n),this.isBackTrackingStack.pop()}}},r.prototype.getGAstProductions=function(){return this.gastProductionsCache},r.prototype.getSerializedGastProductions=function(){return(0,w$.serializeGrammar)((0,JA.values)(this.gastProductionsCache))},r}();Bc.RecognizerApi=I$});var rb=C(Vc=>{"use strict";Object.defineProperty(Vc,"__esModule",{value:!0});Vc.RecognizerEngine=void 0;var at=_e(),Tr=Uc(),zc=Bo(),QA=Qa(),Vo=Za(),eb=vr(),O$=uh(),tb=vi(),ns=Go(),$$=ch(),M$=function(){function r(){}return r.prototype.initRecognizerEngine=function(e,t){if(this.className=(0,$$.classNameFromInstance)(this),this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=ns.tokenStructuredMatcherNoCategories,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},(0,at.has)(t,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
3671
3671
  See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
3672
3672
  For Further details.`);if((0,at.isArray)(e)){if((0,at.isEmpty)(e))throw Error(`A Token Vocabulary cannot be empty.
3673
3673
  Note that the first argument for the parser constructor
3674
3674
  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.
3675
3675
  See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
3676
- For Further details.`)}if((0,at.isArray)(e))this.tokensMap=(0,at.reduce)(e,function(a,s){return a[s.name]=s,a},{});else if((0,at.has)(e,"modes")&&(0,at.every)((0,at.flatten)((0,at.values)(e.modes)),ns.isTokenType)){var n=(0,at.flatten)((0,at.values)(e.modes)),i=(0,at.uniq)(n);this.tokensMap=(0,at.reduce)(i,function(a,s){return a[s.name]=s,a},{})}else if((0,at.isObject)(e))this.tokensMap=(0,at.cloneObj)(e);else throw new Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap.EOF=nb.EOF;var o=(0,at.every)((0,at.values)(e),function(a){return(0,at.isEmpty)(a.categoryMatches)});this.tokenMatcher=o?ns.tokenStructuredMatcherNoCategories:ns.tokenStructuredMatcher,(0,ns.augmentTokenTypes)((0,at.values)(this.tokensMap))},r.prototype.defineRule=function(e,t,n){if(this.selfAnalysisDone)throw Error("Grammar rule <"+e+`> may not be defined after the 'performSelfAnalysis' method has been called'
3677
- Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);var i=(0,at.has)(n,"resyncEnabled")?n.resyncEnabled:rb.DEFAULT_RULE_CONFIG.resyncEnabled,o=(0,at.has)(n,"recoveryValueFunc")?n.recoveryValueFunc:rb.DEFAULT_RULE_CONFIG.recoveryValueFunc,a=this.ruleShortNameIdx<<Tr.BITS_FOR_METHOD_TYPE+Tr.BITS_FOR_OCCURRENCE_IDX;this.ruleShortNameIdx++,this.shortRuleNameToFull[a]=e,this.fullRuleNameToShort[e]=a;function s(l){try{if(this.outputCst===!0){t.apply(this,l);var d=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(d),d}else return t.apply(this,l)}catch(g){return this.invokeRuleCatch(g,i,o)}finally{this.ruleFinallyStateUpdate()}}var u=function(l,d){return l===void 0&&(l=0),this.ruleInvocationStateUpdate(a,e,l),s.call(this,d)},c="ruleName";return u[c]=e,u.originalGrammarAction=t,u},r.prototype.invokeRuleCatch=function(e,t,n){var i=this.RULE_STACK.length===1,o=t&&!this.isBackTracking()&&this.recoveryEnabled;if((0,Vc.isRecognitionException)(e)){var a=e;if(o){var s=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(s))if(a.resyncedTokens=this.reSyncTo(s),this.outputCst){var u=this.CST_STACK[this.CST_STACK.length-1];return u.recoveredNode=!0,u}else return n();else{if(this.outputCst){var u=this.CST_STACK[this.CST_STACK.length-1];u.recoveredNode=!0,a.partialCstResult=u}throw a}}else{if(i)return this.moveToTerminatedState(),n();throw a}}else throw e},r.prototype.optionInternal=function(e,t){var n=this.getKeyForAutomaticLookahead(Tr.OPTION_IDX,t);return this.optionInternalLogic(e,t,n)},r.prototype.optionInternalLogic=function(e,t,n){var i=this,o=this.getLaFuncFromCache(n),a,s;if(e.DEF!==void 0){if(a=e.DEF,s=e.GATE,s!==void 0){var u=o;o=function(){return s.call(i)&&u.call(i)}}}else a=e;if(o.call(this)===!0)return a.call(this)},r.prototype.atLeastOneInternal=function(e,t){var n=this.getKeyForAutomaticLookahead(Tr.AT_LEAST_ONE_IDX,e);return this.atLeastOneInternalLogic(e,t,n)},r.prototype.atLeastOneInternalLogic=function(e,t,n){var i=this,o=this.getLaFuncFromCache(n),a,s;if(t.DEF!==void 0){if(a=t.DEF,s=t.GATE,s!==void 0){var u=o;o=function(){return s.call(i)&&u.call(i)}}}else a=t;if(o.call(this)===!0)for(var c=this.doSingleRepetition(a);o.call(this)===!0&&c===!0;)c=this.doSingleRepetition(a);else throw this.raiseEarlyExitException(e,tb.PROD_TYPE.REPETITION_MANDATORY,t.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,t],o,Tr.AT_LEAST_ONE_IDX,e,Vo.NextTerminalAfterAtLeastOneWalker)},r.prototype.atLeastOneSepFirstInternal=function(e,t){var n=this.getKeyForAutomaticLookahead(Tr.AT_LEAST_ONE_SEP_IDX,e);this.atLeastOneSepFirstInternalLogic(e,t,n)},r.prototype.atLeastOneSepFirstInternalLogic=function(e,t,n){var i=this,o=t.DEF,a=t.SEP,s=this.getLaFuncFromCache(n);if(s.call(this)===!0){o.call(this);for(var u=function(){return i.tokenMatcher(i.LA(1),a)};this.tokenMatcher(this.LA(1),a)===!0;)this.CONSUME(a),o.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,a,u,o,Vo.NextTerminalAfterAtLeastOneSepWalker],u,Tr.AT_LEAST_ONE_SEP_IDX,e,Vo.NextTerminalAfterAtLeastOneSepWalker)}else throw this.raiseEarlyExitException(e,tb.PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR,t.ERR_MSG)},r.prototype.manyInternal=function(e,t){var n=this.getKeyForAutomaticLookahead(Tr.MANY_IDX,e);return this.manyInternalLogic(e,t,n)},r.prototype.manyInternalLogic=function(e,t,n){var i=this,o=this.getLaFuncFromCache(n),a,s;if(t.DEF!==void 0){if(a=t.DEF,s=t.GATE,s!==void 0){var u=o;o=function(){return s.call(i)&&u.call(i)}}}else a=t;for(var c=!0;o.call(this)===!0&&c===!0;)c=this.doSingleRepetition(a);this.attemptInRepetitionRecovery(this.manyInternal,[e,t],o,Tr.MANY_IDX,e,Vo.NextTerminalAfterManyWalker,c)},r.prototype.manySepFirstInternal=function(e,t){var n=this.getKeyForAutomaticLookahead(Tr.MANY_SEP_IDX,e);this.manySepFirstInternalLogic(e,t,n)},r.prototype.manySepFirstInternalLogic=function(e,t,n){var i=this,o=t.DEF,a=t.SEP,s=this.getLaFuncFromCache(n);if(s.call(this)===!0){o.call(this);for(var u=function(){return i.tokenMatcher(i.LA(1),a)};this.tokenMatcher(this.LA(1),a)===!0;)this.CONSUME(a),o.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,a,u,o,Vo.NextTerminalAfterManySepWalker],u,Tr.MANY_SEP_IDX,e,Vo.NextTerminalAfterManySepWalker)}},r.prototype.repetitionSepSecondInternal=function(e,t,n,i,o){for(;n();)this.CONSUME(t),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,t,n,i,o],n,Tr.AT_LEAST_ONE_SEP_IDX,e,o)},r.prototype.doSingleRepetition=function(e){var t=this.getLexerPosition();e.call(this);var n=this.getLexerPosition();return n>t},r.prototype.orInternal=function(e,t){var n=this.getKeyForAutomaticLookahead(Tr.OR_IDX,t),i=(0,at.isArray)(e)?e:e.DEF,o=this.getLaFuncFromCache(n),a=o.call(this,i);if(a!==void 0){var s=i[a];return s.ALT.call(this)}this.raiseNoAltException(t,e.ERR_MSG)},r.prototype.ruleFinallyStateUpdate=function(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),this.RULE_STACK.length===0&&this.isAtEndOfInput()===!1){var e=this.LA(1),t=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new Vc.NotAllInputParsedException(t,e))}},r.prototype.subruleInternal=function(e,t,n){var i;try{var o=n!==void 0?n.ARGS:void 0;return i=e.call(this,t,o),this.cstPostNonTerminal(i,n!==void 0&&n.LABEL!==void 0?n.LABEL:e.ruleName),i}catch(a){this.subruleInternalError(a,n,e.ruleName)}},r.prototype.subruleInternalError=function(e,t,n){throw(0,Vc.isRecognitionException)(e)&&e.partialCstResult!==void 0&&(this.cstPostNonTerminal(e.partialCstResult,t!==void 0&&t.LABEL!==void 0?t.LABEL:n),delete e.partialCstResult),e},r.prototype.consumeInternal=function(e,t,n){var i;try{var o=this.LA(1);this.tokenMatcher(o,e)===!0?(this.consumeToken(),i=o):this.consumeInternalError(e,o,n)}catch(a){i=this.consumeInternalRecovery(e,t,a)}return this.cstPostTerminal(n!==void 0&&n.LABEL!==void 0?n.LABEL:e.name,i),i},r.prototype.consumeInternalError=function(e,t,n){var i,o=this.LA(0);throw n!==void 0&&n.ERR_MSG?i=n.ERR_MSG:i=this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:t,previous:o,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new Vc.MismatchedTokenException(i,t,o))},r.prototype.consumeInternalRecovery=function(e,t,n){if(this.recoveryEnabled&&n.name==="MismatchedTokenException"&&!this.isBackTracking()){var i=this.getFollowsForInRuleRecovery(e,t);try{return this.tryInRuleRecovery(e,i)}catch(o){throw o.name===L$.IN_RULE_RECOVERY_EXCEPTION?n:o}}else throw n},r.prototype.saveRecogState=function(){var e=this.errors,t=(0,at.cloneArr)(this.RULE_STACK);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:t,CST_STACK:this.CST_STACK}},r.prototype.reloadRecogState=function(e){this.errors=e.errors,this.importLexerState(e.lexerState),this.RULE_STACK=e.RULE_STACK},r.prototype.ruleInvocationStateUpdate=function(e,t,n){this.RULE_OCCURRENCE_STACK.push(n),this.RULE_STACK.push(e),this.cstInvocationStateUpdate(t,e)},r.prototype.isBackTracking=function(){return this.isBackTrackingStack.length!==0},r.prototype.getCurrRuleFullName=function(){var e=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[e]},r.prototype.shortRuleNameToFullName=function(e){return this.shortRuleNameToFull[e]},r.prototype.isAtEndOfInput=function(){return this.tokenMatcher(this.LA(1),nb.EOF)},r.prototype.reset=function(){this.resetLexerState(),this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]},r}();Yc.RecognizerEngine=q$});var ab=C(Xc=>{"use strict";Object.defineProperty(Xc,"__esModule",{value:!0});Xc.ErrorHandler=void 0;var mh=Bo(),hh=_e(),ob=Qa(),j$=vr(),G$=function(){function r(){}return r.prototype.initErrorHandler=function(e){this._errors=[],this.errorMessageProvider=(0,hh.has)(e,"errorMessageProvider")?e.errorMessageProvider:j$.DEFAULT_PARSER_CONFIG.errorMessageProvider},r.prototype.SAVE_ERROR=function(e){if((0,mh.isRecognitionException)(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:(0,hh.cloneArr)(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")},Object.defineProperty(r.prototype,"errors",{get:function(){return(0,hh.cloneArr)(this._errors)},set:function(e){this._errors=e},enumerable:!1,configurable:!0}),r.prototype.raiseEarlyExitException=function(e,t,n){for(var i=this.getCurrRuleFullName(),o=this.getGAstProductions()[i],a=(0,ob.getLookaheadPathsForOptionalProd)(e,o,t,this.maxLookahead),s=a[0],u=[],c=1;c<=this.maxLookahead;c++)u.push(this.LA(c));var l=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:s,actual:u,previous:this.LA(0),customUserDescription:n,ruleName:i});throw this.SAVE_ERROR(new mh.EarlyExitException(l,this.LA(1),this.LA(0)))},r.prototype.raiseNoAltException=function(e,t){for(var n=this.getCurrRuleFullName(),i=this.getGAstProductions()[n],o=(0,ob.getLookaheadPathsForOr)(e,i,this.maxLookahead),a=[],s=1;s<=this.maxLookahead;s++)a.push(this.LA(s));var u=this.LA(0),c=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:o,actual:a,previous:u,customUserDescription:t,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new mh.NoViableAltException(c,this.LA(1),u))},r}();Xc.ErrorHandler=G$});var cb=C(Jc=>{"use strict";Object.defineProperty(Jc,"__esModule",{value:!0});Jc.ContentAssist=void 0;var sb=Za(),ub=_e(),U$=function(){function r(){}return r.prototype.initContentAssist=function(){},r.prototype.computeContentAssist=function(e,t){var n=this.gastProductionsCache[e];if((0,ub.isUndefined)(n))throw Error("Rule ->"+e+"<- does not exist in this grammar.");return(0,sb.nextPossibleTokensAfter)([n],t,this.tokenMatcher,this.maxLookahead)},r.prototype.getNextPossibleTokenTypes=function(e){var t=(0,ub.first)(e.ruleStack),n=this.getGAstProductions(),i=n[t],o=new sb.NextAfterTokenWalker(i,e).startWalking();return o},r}();Jc.ContentAssist=U$});var gb=C(el=>{"use strict";Object.defineProperty(el,"__esModule",{value:!0});el.GastRecorder=void 0;var hr=_e(),Nn=fr(),H$=Ka(),pb=Go(),mb=vi(),W$=vr(),K$=Hc(),Qc={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(Qc);var lb=!0,db=Math.pow(2,K$.BITS_FOR_OCCURRENCE_IDX)-1,hb=(0,mb.createToken)({name:"RECORDING_PHASE_TOKEN",pattern:H$.Lexer.NA});(0,pb.augmentTokenTypes)([hb]);var yb=(0,mb.createTokenInstance)(hb,`This IToken indicates the Parser is in Recording Phase
3678
- See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(yb);var B$={name:`This CSTNode indicates the Parser is in Recording Phase
3679
- See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}},z$=function(){function r(){}return r.prototype.initGastRecorder=function(e){this.recordingProdStack=[],this.RECORDING_PHASE=!1},r.prototype.enableRecording=function(){var e=this;this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",function(){for(var t=function(i){var o=i>0?i:"";e["CONSUME"+o]=function(a,s){return this.consumeInternalRecord(a,i,s)},e["SUBRULE"+o]=function(a,s){return this.subruleInternalRecord(a,i,s)},e["OPTION"+o]=function(a){return this.optionInternalRecord(a,i)},e["OR"+o]=function(a){return this.orInternalRecord(a,i)},e["MANY"+o]=function(a){this.manyInternalRecord(i,a)},e["MANY_SEP"+o]=function(a){this.manySepFirstInternalRecord(i,a)},e["AT_LEAST_ONE"+o]=function(a){this.atLeastOneInternalRecord(i,a)},e["AT_LEAST_ONE_SEP"+o]=function(a){this.atLeastOneSepFirstInternalRecord(i,a)}},n=0;n<10;n++)t(n);e.consume=function(i,o,a){return this.consumeInternalRecord(o,i,a)},e.subrule=function(i,o,a){return this.subruleInternalRecord(o,i,a)},e.option=function(i,o){return this.optionInternalRecord(o,i)},e.or=function(i,o){return this.orInternalRecord(o,i)},e.many=function(i,o){this.manyInternalRecord(i,o)},e.atLeastOne=function(i,o){this.atLeastOneInternalRecord(i,o)},e.ACTION=e.ACTION_RECORD,e.BACKTRACK=e.BACKTRACK_RECORD,e.LA=e.LA_RECORD})},r.prototype.disableRecording=function(){var e=this;this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",function(){for(var t=0;t<10;t++){var 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})},r.prototype.ACTION_RECORD=function(e){},r.prototype.BACKTRACK_RECORD=function(e,t){return function(){return!0}},r.prototype.LA_RECORD=function(e){return W$.END_OF_FILE},r.prototype.topLevelRuleRecord=function(e,t){try{var n=new Nn.Rule({definition:[],name:e});return n.name=e,this.recordingProdStack.push(n),t.call(this),this.recordingProdStack.pop(),n}catch(i){if(i.KNOWN_RECORDER_ERROR!==!0)try{i.message=i.message+`
3676
+ For Further details.`)}if((0,at.isArray)(e))this.tokensMap=(0,at.reduce)(e,function(a,s){return a[s.name]=s,a},{});else if((0,at.has)(e,"modes")&&(0,at.every)((0,at.flatten)((0,at.values)(e.modes)),ns.isTokenType)){var n=(0,at.flatten)((0,at.values)(e.modes)),i=(0,at.uniq)(n);this.tokensMap=(0,at.reduce)(i,function(a,s){return a[s.name]=s,a},{})}else if((0,at.isObject)(e))this.tokensMap=(0,at.cloneObj)(e);else throw new Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap.EOF=tb.EOF;var o=(0,at.every)((0,at.values)(e),function(a){return(0,at.isEmpty)(a.categoryMatches)});this.tokenMatcher=o?ns.tokenStructuredMatcherNoCategories:ns.tokenStructuredMatcher,(0,ns.augmentTokenTypes)((0,at.values)(this.tokensMap))},r.prototype.defineRule=function(e,t,n){if(this.selfAnalysisDone)throw Error("Grammar rule <"+e+`> may not be defined after the 'performSelfAnalysis' method has been called'
3677
+ Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);var i=(0,at.has)(n,"resyncEnabled")?n.resyncEnabled:eb.DEFAULT_RULE_CONFIG.resyncEnabled,o=(0,at.has)(n,"recoveryValueFunc")?n.recoveryValueFunc:eb.DEFAULT_RULE_CONFIG.recoveryValueFunc,a=this.ruleShortNameIdx<<Tr.BITS_FOR_METHOD_TYPE+Tr.BITS_FOR_OCCURRENCE_IDX;this.ruleShortNameIdx++,this.shortRuleNameToFull[a]=e,this.fullRuleNameToShort[e]=a;function s(l){try{if(this.outputCst===!0){t.apply(this,l);var d=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(d),d}else return t.apply(this,l)}catch(g){return this.invokeRuleCatch(g,i,o)}finally{this.ruleFinallyStateUpdate()}}var u=function(l,d){return l===void 0&&(l=0),this.ruleInvocationStateUpdate(a,e,l),s.call(this,d)},c="ruleName";return u[c]=e,u.originalGrammarAction=t,u},r.prototype.invokeRuleCatch=function(e,t,n){var i=this.RULE_STACK.length===1,o=t&&!this.isBackTracking()&&this.recoveryEnabled;if((0,zc.isRecognitionException)(e)){var a=e;if(o){var s=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(s))if(a.resyncedTokens=this.reSyncTo(s),this.outputCst){var u=this.CST_STACK[this.CST_STACK.length-1];return u.recoveredNode=!0,u}else return n();else{if(this.outputCst){var u=this.CST_STACK[this.CST_STACK.length-1];u.recoveredNode=!0,a.partialCstResult=u}throw a}}else{if(i)return this.moveToTerminatedState(),n();throw a}}else throw e},r.prototype.optionInternal=function(e,t){var n=this.getKeyForAutomaticLookahead(Tr.OPTION_IDX,t);return this.optionInternalLogic(e,t,n)},r.prototype.optionInternalLogic=function(e,t,n){var i=this,o=this.getLaFuncFromCache(n),a,s;if(e.DEF!==void 0){if(a=e.DEF,s=e.GATE,s!==void 0){var u=o;o=function(){return s.call(i)&&u.call(i)}}}else a=e;if(o.call(this)===!0)return a.call(this)},r.prototype.atLeastOneInternal=function(e,t){var n=this.getKeyForAutomaticLookahead(Tr.AT_LEAST_ONE_IDX,e);return this.atLeastOneInternalLogic(e,t,n)},r.prototype.atLeastOneInternalLogic=function(e,t,n){var i=this,o=this.getLaFuncFromCache(n),a,s;if(t.DEF!==void 0){if(a=t.DEF,s=t.GATE,s!==void 0){var u=o;o=function(){return s.call(i)&&u.call(i)}}}else a=t;if(o.call(this)===!0)for(var c=this.doSingleRepetition(a);o.call(this)===!0&&c===!0;)c=this.doSingleRepetition(a);else throw this.raiseEarlyExitException(e,QA.PROD_TYPE.REPETITION_MANDATORY,t.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,t],o,Tr.AT_LEAST_ONE_IDX,e,Vo.NextTerminalAfterAtLeastOneWalker)},r.prototype.atLeastOneSepFirstInternal=function(e,t){var n=this.getKeyForAutomaticLookahead(Tr.AT_LEAST_ONE_SEP_IDX,e);this.atLeastOneSepFirstInternalLogic(e,t,n)},r.prototype.atLeastOneSepFirstInternalLogic=function(e,t,n){var i=this,o=t.DEF,a=t.SEP,s=this.getLaFuncFromCache(n);if(s.call(this)===!0){o.call(this);for(var u=function(){return i.tokenMatcher(i.LA(1),a)};this.tokenMatcher(this.LA(1),a)===!0;)this.CONSUME(a),o.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,a,u,o,Vo.NextTerminalAfterAtLeastOneSepWalker],u,Tr.AT_LEAST_ONE_SEP_IDX,e,Vo.NextTerminalAfterAtLeastOneSepWalker)}else throw this.raiseEarlyExitException(e,QA.PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR,t.ERR_MSG)},r.prototype.manyInternal=function(e,t){var n=this.getKeyForAutomaticLookahead(Tr.MANY_IDX,e);return this.manyInternalLogic(e,t,n)},r.prototype.manyInternalLogic=function(e,t,n){var i=this,o=this.getLaFuncFromCache(n),a,s;if(t.DEF!==void 0){if(a=t.DEF,s=t.GATE,s!==void 0){var u=o;o=function(){return s.call(i)&&u.call(i)}}}else a=t;for(var c=!0;o.call(this)===!0&&c===!0;)c=this.doSingleRepetition(a);this.attemptInRepetitionRecovery(this.manyInternal,[e,t],o,Tr.MANY_IDX,e,Vo.NextTerminalAfterManyWalker,c)},r.prototype.manySepFirstInternal=function(e,t){var n=this.getKeyForAutomaticLookahead(Tr.MANY_SEP_IDX,e);this.manySepFirstInternalLogic(e,t,n)},r.prototype.manySepFirstInternalLogic=function(e,t,n){var i=this,o=t.DEF,a=t.SEP,s=this.getLaFuncFromCache(n);if(s.call(this)===!0){o.call(this);for(var u=function(){return i.tokenMatcher(i.LA(1),a)};this.tokenMatcher(this.LA(1),a)===!0;)this.CONSUME(a),o.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,a,u,o,Vo.NextTerminalAfterManySepWalker],u,Tr.MANY_SEP_IDX,e,Vo.NextTerminalAfterManySepWalker)}},r.prototype.repetitionSepSecondInternal=function(e,t,n,i,o){for(;n();)this.CONSUME(t),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,t,n,i,o],n,Tr.AT_LEAST_ONE_SEP_IDX,e,o)},r.prototype.doSingleRepetition=function(e){var t=this.getLexerPosition();e.call(this);var n=this.getLexerPosition();return n>t},r.prototype.orInternal=function(e,t){var n=this.getKeyForAutomaticLookahead(Tr.OR_IDX,t),i=(0,at.isArray)(e)?e:e.DEF,o=this.getLaFuncFromCache(n),a=o.call(this,i);if(a!==void 0){var s=i[a];return s.ALT.call(this)}this.raiseNoAltException(t,e.ERR_MSG)},r.prototype.ruleFinallyStateUpdate=function(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),this.RULE_STACK.length===0&&this.isAtEndOfInput()===!1){var e=this.LA(1),t=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new zc.NotAllInputParsedException(t,e))}},r.prototype.subruleInternal=function(e,t,n){var i;try{var o=n!==void 0?n.ARGS:void 0;return i=e.call(this,t,o),this.cstPostNonTerminal(i,n!==void 0&&n.LABEL!==void 0?n.LABEL:e.ruleName),i}catch(a){this.subruleInternalError(a,n,e.ruleName)}},r.prototype.subruleInternalError=function(e,t,n){throw(0,zc.isRecognitionException)(e)&&e.partialCstResult!==void 0&&(this.cstPostNonTerminal(e.partialCstResult,t!==void 0&&t.LABEL!==void 0?t.LABEL:n),delete e.partialCstResult),e},r.prototype.consumeInternal=function(e,t,n){var i;try{var o=this.LA(1);this.tokenMatcher(o,e)===!0?(this.consumeToken(),i=o):this.consumeInternalError(e,o,n)}catch(a){i=this.consumeInternalRecovery(e,t,a)}return this.cstPostTerminal(n!==void 0&&n.LABEL!==void 0?n.LABEL:e.name,i),i},r.prototype.consumeInternalError=function(e,t,n){var i,o=this.LA(0);throw n!==void 0&&n.ERR_MSG?i=n.ERR_MSG:i=this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:t,previous:o,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new zc.MismatchedTokenException(i,t,o))},r.prototype.consumeInternalRecovery=function(e,t,n){if(this.recoveryEnabled&&n.name==="MismatchedTokenException"&&!this.isBackTracking()){var i=this.getFollowsForInRuleRecovery(e,t);try{return this.tryInRuleRecovery(e,i)}catch(o){throw o.name===O$.IN_RULE_RECOVERY_EXCEPTION?n:o}}else throw n},r.prototype.saveRecogState=function(){var e=this.errors,t=(0,at.cloneArr)(this.RULE_STACK);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:t,CST_STACK:this.CST_STACK}},r.prototype.reloadRecogState=function(e){this.errors=e.errors,this.importLexerState(e.lexerState),this.RULE_STACK=e.RULE_STACK},r.prototype.ruleInvocationStateUpdate=function(e,t,n){this.RULE_OCCURRENCE_STACK.push(n),this.RULE_STACK.push(e),this.cstInvocationStateUpdate(t,e)},r.prototype.isBackTracking=function(){return this.isBackTrackingStack.length!==0},r.prototype.getCurrRuleFullName=function(){var e=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[e]},r.prototype.shortRuleNameToFullName=function(e){return this.shortRuleNameToFull[e]},r.prototype.isAtEndOfInput=function(){return this.tokenMatcher(this.LA(1),tb.EOF)},r.prototype.reset=function(){this.resetLexerState(),this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]},r}();Vc.RecognizerEngine=M$});var ib=C(Yc=>{"use strict";Object.defineProperty(Yc,"__esModule",{value:!0});Yc.ErrorHandler=void 0;var fh=Bo(),ph=_e(),nb=Qa(),L$=vr(),F$=function(){function r(){}return r.prototype.initErrorHandler=function(e){this._errors=[],this.errorMessageProvider=(0,ph.has)(e,"errorMessageProvider")?e.errorMessageProvider:L$.DEFAULT_PARSER_CONFIG.errorMessageProvider},r.prototype.SAVE_ERROR=function(e){if((0,fh.isRecognitionException)(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:(0,ph.cloneArr)(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")},Object.defineProperty(r.prototype,"errors",{get:function(){return(0,ph.cloneArr)(this._errors)},set:function(e){this._errors=e},enumerable:!1,configurable:!0}),r.prototype.raiseEarlyExitException=function(e,t,n){for(var i=this.getCurrRuleFullName(),o=this.getGAstProductions()[i],a=(0,nb.getLookaheadPathsForOptionalProd)(e,o,t,this.maxLookahead),s=a[0],u=[],c=1;c<=this.maxLookahead;c++)u.push(this.LA(c));var l=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:s,actual:u,previous:this.LA(0),customUserDescription:n,ruleName:i});throw this.SAVE_ERROR(new fh.EarlyExitException(l,this.LA(1),this.LA(0)))},r.prototype.raiseNoAltException=function(e,t){for(var n=this.getCurrRuleFullName(),i=this.getGAstProductions()[n],o=(0,nb.getLookaheadPathsForOr)(e,i,this.maxLookahead),a=[],s=1;s<=this.maxLookahead;s++)a.push(this.LA(s));var u=this.LA(0),c=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:o,actual:a,previous:u,customUserDescription:t,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new fh.NoViableAltException(c,this.LA(1),u))},r}();Yc.ErrorHandler=F$});var sb=C(Xc=>{"use strict";Object.defineProperty(Xc,"__esModule",{value:!0});Xc.ContentAssist=void 0;var ob=Za(),ab=_e(),q$=function(){function r(){}return r.prototype.initContentAssist=function(){},r.prototype.computeContentAssist=function(e,t){var n=this.gastProductionsCache[e];if((0,ab.isUndefined)(n))throw Error("Rule ->"+e+"<- does not exist in this grammar.");return(0,ob.nextPossibleTokensAfter)([n],t,this.tokenMatcher,this.maxLookahead)},r.prototype.getNextPossibleTokenTypes=function(e){var t=(0,ab.first)(e.ruleStack),n=this.getGAstProductions(),i=n[t],o=new ob.NextAfterTokenWalker(i,e).startWalking();return o},r}();Xc.ContentAssist=q$});var hb=C(Qc=>{"use strict";Object.defineProperty(Qc,"__esModule",{value:!0});Qc.GastRecorder=void 0;var hr=_e(),Nn=fr(),j$=Ka(),db=Go(),fb=vi(),G$=vr(),U$=Uc(),Zc={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(Zc);var ub=!0,cb=Math.pow(2,U$.BITS_FOR_OCCURRENCE_IDX)-1,pb=(0,fb.createToken)({name:"RECORDING_PHASE_TOKEN",pattern:j$.Lexer.NA});(0,db.augmentTokenTypes)([pb]);var mb=(0,fb.createTokenInstance)(pb,`This IToken indicates the Parser is in Recording Phase
3678
+ See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(mb);var H$={name:`This CSTNode indicates the Parser is in Recording Phase
3679
+ See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}},W$=function(){function r(){}return r.prototype.initGastRecorder=function(e){this.recordingProdStack=[],this.RECORDING_PHASE=!1},r.prototype.enableRecording=function(){var e=this;this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",function(){for(var t=function(i){var o=i>0?i:"";e["CONSUME"+o]=function(a,s){return this.consumeInternalRecord(a,i,s)},e["SUBRULE"+o]=function(a,s){return this.subruleInternalRecord(a,i,s)},e["OPTION"+o]=function(a){return this.optionInternalRecord(a,i)},e["OR"+o]=function(a){return this.orInternalRecord(a,i)},e["MANY"+o]=function(a){this.manyInternalRecord(i,a)},e["MANY_SEP"+o]=function(a){this.manySepFirstInternalRecord(i,a)},e["AT_LEAST_ONE"+o]=function(a){this.atLeastOneInternalRecord(i,a)},e["AT_LEAST_ONE_SEP"+o]=function(a){this.atLeastOneSepFirstInternalRecord(i,a)}},n=0;n<10;n++)t(n);e.consume=function(i,o,a){return this.consumeInternalRecord(o,i,a)},e.subrule=function(i,o,a){return this.subruleInternalRecord(o,i,a)},e.option=function(i,o){return this.optionInternalRecord(o,i)},e.or=function(i,o){return this.orInternalRecord(o,i)},e.many=function(i,o){this.manyInternalRecord(i,o)},e.atLeastOne=function(i,o){this.atLeastOneInternalRecord(i,o)},e.ACTION=e.ACTION_RECORD,e.BACKTRACK=e.BACKTRACK_RECORD,e.LA=e.LA_RECORD})},r.prototype.disableRecording=function(){var e=this;this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",function(){for(var t=0;t<10;t++){var 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})},r.prototype.ACTION_RECORD=function(e){},r.prototype.BACKTRACK_RECORD=function(e,t){return function(){return!0}},r.prototype.LA_RECORD=function(e){return G$.END_OF_FILE},r.prototype.topLevelRuleRecord=function(e,t){try{var n=new Nn.Rule({definition:[],name:e});return n.name=e,this.recordingProdStack.push(n),t.call(this),this.recordingProdStack.pop(),n}catch(i){if(i.KNOWN_RECORDER_ERROR!==!0)try{i.message=i.message+`
3680
3680
  This error was thrown during the "grammar recording phase" For more info see:
3681
- https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw i}throw i}},r.prototype.optionInternalRecord=function(e,t){return is.call(this,Nn.Option,e,t)},r.prototype.atLeastOneInternalRecord=function(e,t){is.call(this,Nn.RepetitionMandatory,t,e)},r.prototype.atLeastOneSepFirstInternalRecord=function(e,t){is.call(this,Nn.RepetitionMandatoryWithSeparator,t,e,lb)},r.prototype.manyInternalRecord=function(e,t){is.call(this,Nn.Repetition,t,e)},r.prototype.manySepFirstInternalRecord=function(e,t){is.call(this,Nn.RepetitionWithSeparator,t,e,lb)},r.prototype.orInternalRecord=function(e,t){return V$.call(this,e,t)},r.prototype.subruleInternalRecord=function(e,t,n){if(Zc(t),!e||(0,hr.has)(e,"ruleName")===!1){var i=new Error("<SUBRULE"+fb(t)+"> argument is invalid"+(" expecting a Parser method reference but got: <"+JSON.stringify(e)+">")+(`
3682
- inside top level rule: <`+this.recordingProdStack[0].name+">"));throw i.KNOWN_RECORDER_ERROR=!0,i}var o=(0,hr.peek)(this.recordingProdStack),a=e.ruleName,s=new Nn.NonTerminal({idx:t,nonTerminalName:a,label:n?.LABEL,referencedRule:void 0});return o.definition.push(s),this.outputCst?B$:Qc},r.prototype.consumeInternalRecord=function(e,t,n){if(Zc(t),!(0,pb.hasShortKeyProperty)(e)){var i=new Error("<CONSUME"+fb(t)+"> argument is invalid"+(" expecting a TokenType reference but got: <"+JSON.stringify(e)+">")+(`
3683
- inside top level rule: <`+this.recordingProdStack[0].name+">"));throw i.KNOWN_RECORDER_ERROR=!0,i}var o=(0,hr.peek)(this.recordingProdStack),a=new Nn.Terminal({idx:t,terminalType:e,label:n?.LABEL});return o.definition.push(a),yb},r}();el.GastRecorder=z$;function is(r,e,t,n){n===void 0&&(n=!1),Zc(t);var i=(0,hr.peek)(this.recordingProdStack),o=(0,hr.isFunction)(e)?e:e.DEF,a=new r({definition:[],idx:t});return n&&(a.separator=e.SEP),(0,hr.has)(e,"MAX_LOOKAHEAD")&&(a.maxLookahead=e.MAX_LOOKAHEAD),this.recordingProdStack.push(a),o.call(this),i.definition.push(a),this.recordingProdStack.pop(),Qc}function V$(r,e){var t=this;Zc(e);var n=(0,hr.peek)(this.recordingProdStack),i=(0,hr.isArray)(r)===!1,o=i===!1?r:r.DEF,a=new Nn.Alternation({definition:[],idx:e,ignoreAmbiguities:i&&r.IGNORE_AMBIGUITIES===!0});(0,hr.has)(r,"MAX_LOOKAHEAD")&&(a.maxLookahead=r.MAX_LOOKAHEAD);var s=(0,hr.some)(o,function(u){return(0,hr.isFunction)(u.GATE)});return a.hasPredicates=s,n.definition.push(a),(0,hr.forEach)(o,function(u){var c=new Nn.Alternative({definition:[]});a.definition.push(c),(0,hr.has)(u,"IGNORE_AMBIGUITIES")?c.ignoreAmbiguities=u.IGNORE_AMBIGUITIES:(0,hr.has)(u,"GATE")&&(c.ignoreAmbiguities=!0),t.recordingProdStack.push(c),u.ALT.call(t),t.recordingProdStack.pop()}),Qc}function fb(r){return r===0?"":""+r}function Zc(r){if(r<0||r>db){var e=new Error("Invalid DSL Method idx value: <"+r+`>
3684
- `+("Idx value must be a none negative value smaller than "+(db+1)));throw e.KNOWN_RECORDER_ERROR=!0,e}}});var Tb=C(tl=>{"use strict";Object.defineProperty(tl,"__esModule",{value:!0});tl.PerformanceTracer=void 0;var vb=_e(),Y$=vr(),X$=function(){function r(){}return r.prototype.initPerformanceTracer=function(e){if((0,vb.has)(e,"traceInitPerf")){var 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=Y$.DEFAULT_PARSER_CONFIG.traceInitPerf;this.traceInitIndent=-1},r.prototype.TRACE_INIT=function(e,t){if(this.traceInitPerf===!0){this.traceInitIndent++;var n=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(n+"--> <"+e+">");var i=(0,vb.timer)(t),o=i.time,a=i.value,s=o>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&s(n+"<-- <"+e+"> time: "+o+"ms"),this.traceInitIndent--,a}else return t()},r}();tl.PerformanceTracer=X$});var Rb=C(rl=>{"use strict";Object.defineProperty(rl,"__esModule",{value:!0});rl.applyMixins=void 0;function J$(r,e){e.forEach(function(t){var n=t.prototype;Object.getOwnPropertyNames(n).forEach(function(i){if(i!=="constructor"){var o=Object.getOwnPropertyDescriptor(n,i);o&&(o.get||o.set)?Object.defineProperty(r.prototype,i,o):r.prototype[i]=t.prototype[i]}})})}rl.applyMixins=J$});var vr=C(Je=>{"use strict";var bb=Je&&Je.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(Je,"__esModule",{value:!0});Je.EmbeddedActionsParser=Je.CstParser=Je.Parser=Je.EMPTY_ALT=Je.ParserDefinitionErrorType=Je.DEFAULT_RULE_CONFIG=Je.DEFAULT_PARSER_CONFIG=Je.END_OF_FILE=void 0;var sr=_e(),Z$=aA(),_b=vi(),Eb=Xa(),Ab=wA(),Q$=lh(),eM=jA(),tM=XA(),rM=ZA(),nM=eb(),iM=ib(),oM=ab(),aM=cb(),sM=gb(),uM=Tb(),cM=Rb();Je.END_OF_FILE=(0,_b.createTokenInstance)(_b.EOF,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(Je.END_OF_FILE);Je.DEFAULT_PARSER_CONFIG=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:Eb.defaultParserErrorProvider,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1});Je.DEFAULT_RULE_CONFIG=Object.freeze({recoveryValueFunc:function(){},resyncEnabled:!0});var lM;(function(r){r[r.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",r[r.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",r[r.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",r[r.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",r[r.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",r[r.LEFT_RECURSION=5]="LEFT_RECURSION",r[r.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",r[r.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",r[r.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",r[r.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",r[r.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",r[r.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",r[r.TOO_MANY_ALTS=12]="TOO_MANY_ALTS"})(lM=Je.ParserDefinitionErrorType||(Je.ParserDefinitionErrorType={}));function dM(r){return r===void 0&&(r=void 0),function(){return r}}Je.EMPTY_ALT=dM;var nl=function(){function r(e,t){this.definitionErrors=[],this.selfAnalysisDone=!1;var 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),(0,sr.has)(t,"ignoredIssues"))throw new Error(`The <ignoredIssues> IParserConfig property has been deprecated.
3681
+ https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw i}throw i}},r.prototype.optionInternalRecord=function(e,t){return is.call(this,Nn.Option,e,t)},r.prototype.atLeastOneInternalRecord=function(e,t){is.call(this,Nn.RepetitionMandatory,t,e)},r.prototype.atLeastOneSepFirstInternalRecord=function(e,t){is.call(this,Nn.RepetitionMandatoryWithSeparator,t,e,ub)},r.prototype.manyInternalRecord=function(e,t){is.call(this,Nn.Repetition,t,e)},r.prototype.manySepFirstInternalRecord=function(e,t){is.call(this,Nn.RepetitionWithSeparator,t,e,ub)},r.prototype.orInternalRecord=function(e,t){return K$.call(this,e,t)},r.prototype.subruleInternalRecord=function(e,t,n){if(Jc(t),!e||(0,hr.has)(e,"ruleName")===!1){var i=new Error("<SUBRULE"+lb(t)+"> argument is invalid"+(" expecting a Parser method reference but got: <"+JSON.stringify(e)+">")+(`
3682
+ inside top level rule: <`+this.recordingProdStack[0].name+">"));throw i.KNOWN_RECORDER_ERROR=!0,i}var o=(0,hr.peek)(this.recordingProdStack),a=e.ruleName,s=new Nn.NonTerminal({idx:t,nonTerminalName:a,label:n?.LABEL,referencedRule:void 0});return o.definition.push(s),this.outputCst?H$:Zc},r.prototype.consumeInternalRecord=function(e,t,n){if(Jc(t),!(0,db.hasShortKeyProperty)(e)){var i=new Error("<CONSUME"+lb(t)+"> argument is invalid"+(" expecting a TokenType reference but got: <"+JSON.stringify(e)+">")+(`
3683
+ inside top level rule: <`+this.recordingProdStack[0].name+">"));throw i.KNOWN_RECORDER_ERROR=!0,i}var o=(0,hr.peek)(this.recordingProdStack),a=new Nn.Terminal({idx:t,terminalType:e,label:n?.LABEL});return o.definition.push(a),mb},r}();Qc.GastRecorder=W$;function is(r,e,t,n){n===void 0&&(n=!1),Jc(t);var i=(0,hr.peek)(this.recordingProdStack),o=(0,hr.isFunction)(e)?e:e.DEF,a=new r({definition:[],idx:t});return n&&(a.separator=e.SEP),(0,hr.has)(e,"MAX_LOOKAHEAD")&&(a.maxLookahead=e.MAX_LOOKAHEAD),this.recordingProdStack.push(a),o.call(this),i.definition.push(a),this.recordingProdStack.pop(),Zc}function K$(r,e){var t=this;Jc(e);var n=(0,hr.peek)(this.recordingProdStack),i=(0,hr.isArray)(r)===!1,o=i===!1?r:r.DEF,a=new Nn.Alternation({definition:[],idx:e,ignoreAmbiguities:i&&r.IGNORE_AMBIGUITIES===!0});(0,hr.has)(r,"MAX_LOOKAHEAD")&&(a.maxLookahead=r.MAX_LOOKAHEAD);var s=(0,hr.some)(o,function(u){return(0,hr.isFunction)(u.GATE)});return a.hasPredicates=s,n.definition.push(a),(0,hr.forEach)(o,function(u){var c=new Nn.Alternative({definition:[]});a.definition.push(c),(0,hr.has)(u,"IGNORE_AMBIGUITIES")?c.ignoreAmbiguities=u.IGNORE_AMBIGUITIES:(0,hr.has)(u,"GATE")&&(c.ignoreAmbiguities=!0),t.recordingProdStack.push(c),u.ALT.call(t),t.recordingProdStack.pop()}),Zc}function lb(r){return r===0?"":""+r}function Jc(r){if(r<0||r>cb){var e=new Error("Invalid DSL Method idx value: <"+r+`>
3684
+ `+("Idx value must be a none negative value smaller than "+(cb+1)));throw e.KNOWN_RECORDER_ERROR=!0,e}}});var gb=C(el=>{"use strict";Object.defineProperty(el,"__esModule",{value:!0});el.PerformanceTracer=void 0;var yb=_e(),B$=vr(),z$=function(){function r(){}return r.prototype.initPerformanceTracer=function(e){if((0,yb.has)(e,"traceInitPerf")){var 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=B$.DEFAULT_PARSER_CONFIG.traceInitPerf;this.traceInitIndent=-1},r.prototype.TRACE_INIT=function(e,t){if(this.traceInitPerf===!0){this.traceInitIndent++;var n=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(n+"--> <"+e+">");var i=(0,yb.timer)(t),o=i.time,a=i.value,s=o>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&s(n+"<-- <"+e+"> time: "+o+"ms"),this.traceInitIndent--,a}else return t()},r}();el.PerformanceTracer=z$});var vb=C(tl=>{"use strict";Object.defineProperty(tl,"__esModule",{value:!0});tl.applyMixins=void 0;function V$(r,e){e.forEach(function(t){var n=t.prototype;Object.getOwnPropertyNames(n).forEach(function(i){if(i!=="constructor"){var o=Object.getOwnPropertyDescriptor(n,i);o&&(o.get||o.set)?Object.defineProperty(r.prototype,i,o):r.prototype[i]=t.prototype[i]}})})}tl.applyMixins=V$});var vr=C(Je=>{"use strict";var _b=Je&&Je.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(Je,"__esModule",{value:!0});Je.EmbeddedActionsParser=Je.CstParser=Je.Parser=Je.EMPTY_ALT=Je.ParserDefinitionErrorType=Je.DEFAULT_RULE_CONFIG=Je.DEFAULT_PARSER_CONFIG=Je.END_OF_FILE=void 0;var sr=_e(),Y$=iA(),Tb=vi(),Ab=Xa(),Rb=NA(),X$=uh(),J$=FA(),Z$=VA(),Q$=XA(),eM=ZA(),tM=rb(),rM=ib(),nM=sb(),iM=hb(),oM=gb(),aM=vb();Je.END_OF_FILE=(0,Tb.createTokenInstance)(Tb.EOF,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(Je.END_OF_FILE);Je.DEFAULT_PARSER_CONFIG=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:Ab.defaultParserErrorProvider,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1});Je.DEFAULT_RULE_CONFIG=Object.freeze({recoveryValueFunc:function(){},resyncEnabled:!0});var sM;(function(r){r[r.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",r[r.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",r[r.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",r[r.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",r[r.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",r[r.LEFT_RECURSION=5]="LEFT_RECURSION",r[r.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",r[r.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",r[r.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",r[r.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",r[r.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",r[r.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",r[r.TOO_MANY_ALTS=12]="TOO_MANY_ALTS"})(sM=Je.ParserDefinitionErrorType||(Je.ParserDefinitionErrorType={}));function uM(r){return r===void 0&&(r=void 0),function(){return r}}Je.EMPTY_ALT=uM;var rl=function(){function r(e,t){this.definitionErrors=[],this.selfAnalysisDone=!1;var 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),(0,sr.has)(t,"ignoredIssues"))throw new Error(`The <ignoredIssues> IParserConfig property has been deprecated.
3685
3685
  Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
3686
3686
  See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES
3687
- For further details.`);this.skipValidations=(0,sr.has)(t,"skipValidations")?t.skipValidations:Je.DEFAULT_PARSER_CONFIG.skipValidations}return r.performSelfAnalysis=function(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")},r.prototype.performSelfAnalysis=function(){var e=this;this.TRACE_INIT("performSelfAnalysis",function(){var t;e.selfAnalysisDone=!0;var n=e.className;e.TRACE_INIT("toFastProps",function(){(0,sr.toFastProperties)(e)}),e.TRACE_INIT("Grammar Recording",function(){try{e.enableRecording(),(0,sr.forEach)(e.definedRulesNames,function(o){var a=e[o],s=a.originalGrammarAction,u=void 0;e.TRACE_INIT(o+" Rule",function(){u=e.topLevelRuleRecord(o,s)}),e.gastProductionsCache[o]=u})}finally{e.disableRecording()}});var i=[];if(e.TRACE_INIT("Grammar Resolving",function(){i=(0,Ab.resolveGrammar)({rules:(0,sr.values)(e.gastProductionsCache)}),e.definitionErrors=e.definitionErrors.concat(i)}),e.TRACE_INIT("Grammar Validations",function(){if((0,sr.isEmpty)(i)&&e.skipValidations===!1){var o=(0,Ab.validateGrammar)({rules:(0,sr.values)(e.gastProductionsCache),maxLookahead:e.maxLookahead,tokenTypes:(0,sr.values)(e.tokensMap),errMsgProvider:Eb.defaultGrammarValidatorErrorProvider,grammarName:n});e.definitionErrors=e.definitionErrors.concat(o)}}),(0,sr.isEmpty)(e.definitionErrors)&&(e.recoveryEnabled&&e.TRACE_INIT("computeAllProdsFollows",function(){var o=(0,Z$.computeAllProdsFollows)((0,sr.values)(e.gastProductionsCache));e.resyncFollows=o}),e.TRACE_INIT("ComputeLookaheadFunctions",function(){e.preComputeLookaheadFunctions((0,sr.values)(e.gastProductionsCache))})),!r.DEFER_DEFINITION_ERRORS_HANDLING&&!(0,sr.isEmpty)(e.definitionErrors))throw t=(0,sr.map)(e.definitionErrors,function(o){return o.message}),new Error(`Parser Definition Errors detected:
3687
+ For further details.`);this.skipValidations=(0,sr.has)(t,"skipValidations")?t.skipValidations:Je.DEFAULT_PARSER_CONFIG.skipValidations}return r.performSelfAnalysis=function(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")},r.prototype.performSelfAnalysis=function(){var e=this;this.TRACE_INIT("performSelfAnalysis",function(){var t;e.selfAnalysisDone=!0;var n=e.className;e.TRACE_INIT("toFastProps",function(){(0,sr.toFastProperties)(e)}),e.TRACE_INIT("Grammar Recording",function(){try{e.enableRecording(),(0,sr.forEach)(e.definedRulesNames,function(o){var a=e[o],s=a.originalGrammarAction,u=void 0;e.TRACE_INIT(o+" Rule",function(){u=e.topLevelRuleRecord(o,s)}),e.gastProductionsCache[o]=u})}finally{e.disableRecording()}});var i=[];if(e.TRACE_INIT("Grammar Resolving",function(){i=(0,Rb.resolveGrammar)({rules:(0,sr.values)(e.gastProductionsCache)}),e.definitionErrors=e.definitionErrors.concat(i)}),e.TRACE_INIT("Grammar Validations",function(){if((0,sr.isEmpty)(i)&&e.skipValidations===!1){var o=(0,Rb.validateGrammar)({rules:(0,sr.values)(e.gastProductionsCache),maxLookahead:e.maxLookahead,tokenTypes:(0,sr.values)(e.tokensMap),errMsgProvider:Ab.defaultGrammarValidatorErrorProvider,grammarName:n});e.definitionErrors=e.definitionErrors.concat(o)}}),(0,sr.isEmpty)(e.definitionErrors)&&(e.recoveryEnabled&&e.TRACE_INIT("computeAllProdsFollows",function(){var o=(0,Y$.computeAllProdsFollows)((0,sr.values)(e.gastProductionsCache));e.resyncFollows=o}),e.TRACE_INIT("ComputeLookaheadFunctions",function(){e.preComputeLookaheadFunctions((0,sr.values)(e.gastProductionsCache))})),!r.DEFER_DEFINITION_ERRORS_HANDLING&&!(0,sr.isEmpty)(e.definitionErrors))throw t=(0,sr.map)(e.definitionErrors,function(o){return o.message}),new Error(`Parser Definition Errors detected:
3688
3688
  `+t.join(`
3689
3689
  -------------------------------
3690
- `))})},r.DEFER_DEFINITION_ERRORS_HANDLING=!1,r}();Je.Parser=nl;(0,cM.applyMixins)(nl,[Q$.Recoverable,eM.LooksAhead,tM.TreeBuilder,rM.LexerAdapter,iM.RecognizerEngine,nM.RecognizerApi,oM.ErrorHandler,aM.ContentAssist,sM.GastRecorder,uM.PerformanceTracer]);var fM=function(r){bb(e,r);function e(t,n){n===void 0&&(n=Je.DEFAULT_PARSER_CONFIG);var i=this,o=(0,sr.cloneObj)(n);return o.outputCst=!0,i=r.call(this,t,o)||this,i}return e}(nl);Je.CstParser=fM;var pM=function(r){bb(e,r);function e(t,n){n===void 0&&(n=Je.DEFAULT_PARSER_CONFIG);var i=this,o=(0,sr.cloneObj)(n);return o.outputCst=!1,i=r.call(this,t,o)||this,i}return e}(nl);Je.EmbeddedActionsParser=pM});var Pb=C(il=>{"use strict";Object.defineProperty(il,"__esModule",{value:!0});il.createSyntaxDiagramsCode=void 0;var Cb=$m();function mM(r,e){var t=e===void 0?{}:e,n=t.resourceBase,i=n===void 0?"https://unpkg.com/chevrotain@"+Cb.VERSION+"/diagrams/":n,o=t.css,a=o===void 0?"https://unpkg.com/chevrotain@"+Cb.VERSION+"/diagrams/diagrams.css":o,s=`
3690
+ `))})},r.DEFER_DEFINITION_ERRORS_HANDLING=!1,r}();Je.Parser=rl;(0,aM.applyMixins)(rl,[X$.Recoverable,J$.LooksAhead,Z$.TreeBuilder,Q$.LexerAdapter,tM.RecognizerEngine,eM.RecognizerApi,rM.ErrorHandler,nM.ContentAssist,iM.GastRecorder,oM.PerformanceTracer]);var cM=function(r){_b(e,r);function e(t,n){n===void 0&&(n=Je.DEFAULT_PARSER_CONFIG);var i=this,o=(0,sr.cloneObj)(n);return o.outputCst=!0,i=r.call(this,t,o)||this,i}return e}(rl);Je.CstParser=cM;var lM=function(r){_b(e,r);function e(t,n){n===void 0&&(n=Je.DEFAULT_PARSER_CONFIG);var i=this,o=(0,sr.cloneObj)(n);return o.outputCst=!1,i=r.call(this,t,o)||this,i}return e}(rl);Je.EmbeddedActionsParser=lM});var Eb=C(nl=>{"use strict";Object.defineProperty(nl,"__esModule",{value:!0});nl.createSyntaxDiagramsCode=void 0;var bb=Im();function dM(r,e){var t=e===void 0?{}:e,n=t.resourceBase,i=n===void 0?"https://unpkg.com/chevrotain@"+bb.VERSION+"/diagrams/":n,o=t.css,a=o===void 0?"https://unpkg.com/chevrotain@"+bb.VERSION+"/diagrams/diagrams.css":o,s=`
3691
3691
  <!-- This is a generated file -->
3692
3692
  <!DOCTYPE html>
3693
3693
  <meta charset="utf-8">
@@ -3715,14 +3715,14 @@ Make sure that all grammar rule definitions are done before 'performSelfAnalysis
3715
3715
  var diagramsDiv = document.getElementById("diagrams");
3716
3716
  main.drawDiagramsFromSerializedGrammar(serializedGrammar, diagramsDiv);
3717
3717
  <\/script>
3718
- `;return s+u+c+l+d+g}il.createSyntaxDiagramsCode=mM});var al=C(H=>{"use strict";Object.defineProperty(H,"__esModule",{value:!0});H.Parser=H.createSyntaxDiagramsCode=H.clearCache=H.GAstVisitor=H.serializeProduction=H.serializeGrammar=H.Terminal=H.Rule=H.RepetitionWithSeparator=H.RepetitionMandatoryWithSeparator=H.RepetitionMandatory=H.Repetition=H.Option=H.NonTerminal=H.Alternative=H.Alternation=H.defaultLexerErrorProvider=H.NoViableAltException=H.NotAllInputParsedException=H.MismatchedTokenException=H.isRecognitionException=H.EarlyExitException=H.defaultParserErrorProvider=H.tokenName=H.tokenMatcher=H.tokenLabel=H.EOF=H.createTokenInstance=H.createToken=H.LexerDefinitionErrorType=H.Lexer=H.EMPTY_ALT=H.ParserDefinitionErrorType=H.EmbeddedActionsParser=H.CstParser=H.VERSION=void 0;var hM=$m();Object.defineProperty(H,"VERSION",{enumerable:!0,get:function(){return hM.VERSION}});var ol=vr();Object.defineProperty(H,"CstParser",{enumerable:!0,get:function(){return ol.CstParser}});Object.defineProperty(H,"EmbeddedActionsParser",{enumerable:!0,get:function(){return ol.EmbeddedActionsParser}});Object.defineProperty(H,"ParserDefinitionErrorType",{enumerable:!0,get:function(){return ol.ParserDefinitionErrorType}});Object.defineProperty(H,"EMPTY_ALT",{enumerable:!0,get:function(){return ol.EMPTY_ALT}});var kb=Ka();Object.defineProperty(H,"Lexer",{enumerable:!0,get:function(){return kb.Lexer}});Object.defineProperty(H,"LexerDefinitionErrorType",{enumerable:!0,get:function(){return kb.LexerDefinitionErrorType}});var Yo=vi();Object.defineProperty(H,"createToken",{enumerable:!0,get:function(){return Yo.createToken}});Object.defineProperty(H,"createTokenInstance",{enumerable:!0,get:function(){return Yo.createTokenInstance}});Object.defineProperty(H,"EOF",{enumerable:!0,get:function(){return Yo.EOF}});Object.defineProperty(H,"tokenLabel",{enumerable:!0,get:function(){return Yo.tokenLabel}});Object.defineProperty(H,"tokenMatcher",{enumerable:!0,get:function(){return Yo.tokenMatcher}});Object.defineProperty(H,"tokenName",{enumerable:!0,get:function(){return Yo.tokenName}});var yM=Xa();Object.defineProperty(H,"defaultParserErrorProvider",{enumerable:!0,get:function(){return yM.defaultParserErrorProvider}});var os=Bo();Object.defineProperty(H,"EarlyExitException",{enumerable:!0,get:function(){return os.EarlyExitException}});Object.defineProperty(H,"isRecognitionException",{enumerable:!0,get:function(){return os.isRecognitionException}});Object.defineProperty(H,"MismatchedTokenException",{enumerable:!0,get:function(){return os.MismatchedTokenException}});Object.defineProperty(H,"NotAllInputParsedException",{enumerable:!0,get:function(){return os.NotAllInputParsedException}});Object.defineProperty(H,"NoViableAltException",{enumerable:!0,get:function(){return os.NoViableAltException}});var gM=Km();Object.defineProperty(H,"defaultLexerErrorProvider",{enumerable:!0,get:function(){return gM.defaultLexerErrorProvider}});var Dn=fr();Object.defineProperty(H,"Alternation",{enumerable:!0,get:function(){return Dn.Alternation}});Object.defineProperty(H,"Alternative",{enumerable:!0,get:function(){return Dn.Alternative}});Object.defineProperty(H,"NonTerminal",{enumerable:!0,get:function(){return Dn.NonTerminal}});Object.defineProperty(H,"Option",{enumerable:!0,get:function(){return Dn.Option}});Object.defineProperty(H,"Repetition",{enumerable:!0,get:function(){return Dn.Repetition}});Object.defineProperty(H,"RepetitionMandatory",{enumerable:!0,get:function(){return Dn.RepetitionMandatory}});Object.defineProperty(H,"RepetitionMandatoryWithSeparator",{enumerable:!0,get:function(){return Dn.RepetitionMandatoryWithSeparator}});Object.defineProperty(H,"RepetitionWithSeparator",{enumerable:!0,get:function(){return Dn.RepetitionWithSeparator}});Object.defineProperty(H,"Rule",{enumerable:!0,get:function(){return Dn.Rule}});Object.defineProperty(H,"Terminal",{enumerable:!0,get:function(){return Dn.Terminal}});var xb=fr();Object.defineProperty(H,"serializeGrammar",{enumerable:!0,get:function(){return xb.serializeGrammar}});Object.defineProperty(H,"serializeProduction",{enumerable:!0,get:function(){return xb.serializeProduction}});var vM=Uo();Object.defineProperty(H,"GAstVisitor",{enumerable:!0,get:function(){return vM.GAstVisitor}});function TM(){console.warn(`The clearCache function was 'soft' removed from the Chevrotain API.
3718
+ `;return s+u+c+l+d+g}nl.createSyntaxDiagramsCode=dM});var ol=C(H=>{"use strict";Object.defineProperty(H,"__esModule",{value:!0});H.Parser=H.createSyntaxDiagramsCode=H.clearCache=H.GAstVisitor=H.serializeProduction=H.serializeGrammar=H.Terminal=H.Rule=H.RepetitionWithSeparator=H.RepetitionMandatoryWithSeparator=H.RepetitionMandatory=H.Repetition=H.Option=H.NonTerminal=H.Alternative=H.Alternation=H.defaultLexerErrorProvider=H.NoViableAltException=H.NotAllInputParsedException=H.MismatchedTokenException=H.isRecognitionException=H.EarlyExitException=H.defaultParserErrorProvider=H.tokenName=H.tokenMatcher=H.tokenLabel=H.EOF=H.createTokenInstance=H.createToken=H.LexerDefinitionErrorType=H.Lexer=H.EMPTY_ALT=H.ParserDefinitionErrorType=H.EmbeddedActionsParser=H.CstParser=H.VERSION=void 0;var fM=Im();Object.defineProperty(H,"VERSION",{enumerable:!0,get:function(){return fM.VERSION}});var il=vr();Object.defineProperty(H,"CstParser",{enumerable:!0,get:function(){return il.CstParser}});Object.defineProperty(H,"EmbeddedActionsParser",{enumerable:!0,get:function(){return il.EmbeddedActionsParser}});Object.defineProperty(H,"ParserDefinitionErrorType",{enumerable:!0,get:function(){return il.ParserDefinitionErrorType}});Object.defineProperty(H,"EMPTY_ALT",{enumerable:!0,get:function(){return il.EMPTY_ALT}});var Cb=Ka();Object.defineProperty(H,"Lexer",{enumerable:!0,get:function(){return Cb.Lexer}});Object.defineProperty(H,"LexerDefinitionErrorType",{enumerable:!0,get:function(){return Cb.LexerDefinitionErrorType}});var Yo=vi();Object.defineProperty(H,"createToken",{enumerable:!0,get:function(){return Yo.createToken}});Object.defineProperty(H,"createTokenInstance",{enumerable:!0,get:function(){return Yo.createTokenInstance}});Object.defineProperty(H,"EOF",{enumerable:!0,get:function(){return Yo.EOF}});Object.defineProperty(H,"tokenLabel",{enumerable:!0,get:function(){return Yo.tokenLabel}});Object.defineProperty(H,"tokenMatcher",{enumerable:!0,get:function(){return Yo.tokenMatcher}});Object.defineProperty(H,"tokenName",{enumerable:!0,get:function(){return Yo.tokenName}});var pM=Xa();Object.defineProperty(H,"defaultParserErrorProvider",{enumerable:!0,get:function(){return pM.defaultParserErrorProvider}});var os=Bo();Object.defineProperty(H,"EarlyExitException",{enumerable:!0,get:function(){return os.EarlyExitException}});Object.defineProperty(H,"isRecognitionException",{enumerable:!0,get:function(){return os.isRecognitionException}});Object.defineProperty(H,"MismatchedTokenException",{enumerable:!0,get:function(){return os.MismatchedTokenException}});Object.defineProperty(H,"NotAllInputParsedException",{enumerable:!0,get:function(){return os.NotAllInputParsedException}});Object.defineProperty(H,"NoViableAltException",{enumerable:!0,get:function(){return os.NoViableAltException}});var mM=Hm();Object.defineProperty(H,"defaultLexerErrorProvider",{enumerable:!0,get:function(){return mM.defaultLexerErrorProvider}});var Dn=fr();Object.defineProperty(H,"Alternation",{enumerable:!0,get:function(){return Dn.Alternation}});Object.defineProperty(H,"Alternative",{enumerable:!0,get:function(){return Dn.Alternative}});Object.defineProperty(H,"NonTerminal",{enumerable:!0,get:function(){return Dn.NonTerminal}});Object.defineProperty(H,"Option",{enumerable:!0,get:function(){return Dn.Option}});Object.defineProperty(H,"Repetition",{enumerable:!0,get:function(){return Dn.Repetition}});Object.defineProperty(H,"RepetitionMandatory",{enumerable:!0,get:function(){return Dn.RepetitionMandatory}});Object.defineProperty(H,"RepetitionMandatoryWithSeparator",{enumerable:!0,get:function(){return Dn.RepetitionMandatoryWithSeparator}});Object.defineProperty(H,"RepetitionWithSeparator",{enumerable:!0,get:function(){return Dn.RepetitionWithSeparator}});Object.defineProperty(H,"Rule",{enumerable:!0,get:function(){return Dn.Rule}});Object.defineProperty(H,"Terminal",{enumerable:!0,get:function(){return Dn.Terminal}});var Pb=fr();Object.defineProperty(H,"serializeGrammar",{enumerable:!0,get:function(){return Pb.serializeGrammar}});Object.defineProperty(H,"serializeProduction",{enumerable:!0,get:function(){return Pb.serializeProduction}});var hM=Uo();Object.defineProperty(H,"GAstVisitor",{enumerable:!0,get:function(){return hM.GAstVisitor}});function yM(){console.warn(`The clearCache function was 'soft' removed from the Chevrotain API.
3719
3719
  It performs no action other than printing this message.
3720
- Please avoid using it as it will be completely removed in the future`)}H.clearCache=TM;var RM=Pb();Object.defineProperty(H,"createSyntaxDiagramsCode",{enumerable:!0,get:function(){return RM.createSyntaxDiagramsCode}});var _M=function(){function r(){throw new Error(`The Parser class has been deprecated, use CstParser or EmbeddedActionsParser instead.
3721
- See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_7-0-0`)}return r}();H.Parser=_M});var Db=C(Mr=>{"use strict";Object.defineProperty(Mr,"__esModule",{value:!0});Mr.RootCstNodeImpl=Mr.CompositeCstNodeImpl=Mr.LeafCstNodeImpl=Mr.AbstractCstNode=Mr.CstNodeBuilder=void 0;var Sb=lo(),AM=_o(),Nb=et(),yh=class{constructor(){this.nodeStack=[]}get current(){return this.nodeStack[this.nodeStack.length-1]}buildRootNode(e){return this.rootNode=new sl(e),this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(e){let t=new us;return t.feature=e,t.root=this.rootNode,this.current.children.push(t),this.nodeStack.push(t),t}buildLeafNode(e,t){let n=new ss(e.startOffset,e.image.length,(0,Nb.tokenToRange)(e),e.tokenType,!1);return n.feature=t,n.root=this.rootNode,this.current.children.push(n),n}removeNode(e){let t=e.parent;if(t){let n=t.children.indexOf(e);n>=0&&t.children.splice(n,1)}}construct(e){let t=this.current;typeof e.$type=="string"&&(this.current.element=e),e.$cstNode=t;let n=this.nodeStack.pop();n?.children.length===0&&this.removeNode(n)}addHiddenTokens(e){if(e)for(let t of e){let n=new ss(t.startOffset,t.image.length,(0,Nb.tokenToRange)(t),t.tokenType,!0);n.root=this.rootNode,this.addHiddenToken(this.rootNode,n)}}addHiddenToken(e,t){let{offset:n,end:i}=t;for(let o=0;o<e.children.length;o++){let a=e.children[o],{offset:s,end:u}=a;if((0,AM.isCompositeCstNode)(a)&&n>s&&i<u){this.addHiddenToken(a,t);return}else if(i<=s){e.children.splice(o,0,t);return}}e.children.push(t)}};Mr.CstNodeBuilder=yh;var as=class{get hidden(){return!1}get element(){var e,t;let n=typeof((e=this._element)===null||e===void 0?void 0:e.$type)=="string"?this._element:(t=this.parent)===null||t===void 0?void 0:t.element;if(!n)throw new Error("This node has no associated AST element");return n}set element(e){this._element=e}get text(){return this.root.fullText.substring(this.offset,this.end)}};Mr.AbstractCstNode=as;var ss=class extends as{constructor(e,t,n,i,o=!1){super(),this._hidden=o,this._offset=e,this._tokenType=i,this._length=t,this._range=n}get offset(){return this._offset}get length(){return this._length}get end(){return this._offset+this._length}get hidden(){return this._hidden}get tokenType(){return this._tokenType}get range(){return this._range}};Mr.LeafCstNodeImpl=ss;var us=class extends as{constructor(){super(...arguments),this.children=new cs(this)}get offset(){var e,t;return(t=(e=this.firstNonHiddenNode)===null||e===void 0?void 0:e.offset)!==null&&t!==void 0?t:0}get length(){return this.end-this.offset}get end(){var e,t;return(t=(e=this.lastNonHiddenNode)===null||e===void 0?void 0:e.end)!==null&&t!==void 0?t:0}get range(){let e=this.firstNonHiddenNode,t=this.lastNonHiddenNode;if(e&&t){if(this._rangeCache===void 0){let{range:n}=e,{range:i}=t;this._rangeCache={start:n.start,end:i.end.line<n.start.line?n.start:i.end}}return this._rangeCache}else return{start:Sb.Position.create(0,0),end:Sb.Position.create(0,0)}}get firstNonHiddenNode(){for(let e of this.children)if(!e.hidden)return e;return this.children[0]}get lastNonHiddenNode(){for(let e=this.children.length-1;e>=0;e--){let t=this.children[e];if(!t.hidden)return t}return this.children[this.children.length-1]}};Mr.CompositeCstNodeImpl=us;var cs=class extends Array{constructor(e){super(),this.parent=e,Object.setPrototypeOf(this,cs.prototype)}push(...e){return this.addParents(e),super.push(...e)}unshift(...e){return this.addParents(e),super.unshift(...e)}splice(e,t,...n){return this.addParents(n),super.splice(e,t,...n)}addParents(e){for(let t of e)t.parent=this.parent}},sl=class extends us{constructor(e){super(),this._text="",this._text=e??""}get text(){return this._text.substring(this.offset,this.end)}get fullText(){return this._text}};Mr.RootCstNodeImpl=sl});var ds=C(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.isTokenTypeDictionary=mt.isIMultiModeLexerDefinition=mt.isTokenTypeArray=mt.LangiumCompletionParser=mt.LangiumParserErrorMessageProvider=mt.LangiumParser=mt.AbstractLangiumParser=mt.DatatypeSymbol=void 0;var cl=al(),ul=ze(),wb=Ft(),Ib=Re(),bM=Db();mt.DatatypeSymbol=Symbol("Datatype");function gh(r){return r.$type===mt.DatatypeSymbol}var ls=class{constructor(e,t){this._unorderedGroups=new Map,this.lexer=new cl.Lexer(Mb(t)?Object.values(t):t),this.wrapper=new Rh(t,e.parser.ParserConfig)}alternatives(e,t){this.wrapper.wrapOr(e,t)}optional(e,t){this.wrapper.wrapOption(e,t)}many(e,t){this.wrapper.wrapMany(e,t)}atLeastOne(e,t){this.wrapper.wrapAtLeastOne(e,t)}isRecording(){return this.wrapper.IS_RECORDING}get unorderedGroups(){return this._unorderedGroups}getRuleStack(){return this.wrapper.RULE_STACK}finalize(){this.wrapper.wrapSelfAnalysis()}};mt.AbstractLangiumParser=ls;var vh=class extends ls{constructor(e,t){super(e,t),this.nodeBuilder=new bM.CstNodeBuilder,this.stack=[],this.assignmentMap=new Map,this.linker=e.references.Linker,this.converter=e.parser.ValueConverter,this.astReflection=e.shared.AstReflection}get current(){return this.stack[this.stack.length-1]}rule(e,t){let n=e.fragment?void 0:(0,wb.isDataTypeRule)(e)?mt.DatatypeSymbol:(0,wb.getTypeName)(e),i=this.wrapper.DEFINE_RULE(e.name,this.startImplementation(n,t).bind(this));return e.entry&&(this.mainRule=i),i}parse(e){this.nodeBuilder.buildRootNode(e);let t=this.lexer.tokenize(e);this.wrapper.input=t.tokens;let n=this.mainRule.call(this.wrapper);return this.nodeBuilder.addHiddenTokens(t.groups.hidden),this.unorderedGroups.clear(),{value:n,lexerErrors:t.errors,parserErrors:this.wrapper.errors}}startImplementation(e,t){return n=>{if(!this.isRecording()){let o={$type:e};this.stack.push(o),e===mt.DatatypeSymbol&&(o.value="")}let i;try{i=t(n)}catch{i=void 0}return!this.isRecording()&&i===void 0&&(i=this.construct()),i}}consume(e,t,n){let i=this.wrapper.wrapConsume(e,t);if(!this.isRecording()){let o=this.nodeBuilder.buildLeafNode(i,n),{assignment:a,isCrossRef:s}=this.getAssignment(n),u=this.current;if(a){let c=(0,ul.isKeyword)(n)?i.image:this.converter.convert(i.image,o);this.assign(a.operator,a.feature,c,o,s)}else if(gh(u)){let c=i.image;(0,ul.isKeyword)(n)||(c=this.converter.convert(c,o).toString()),u.value+=c}}}subrule(e,t,n,i){let o;this.isRecording()||(o=this.nodeBuilder.buildCompositeNode(n));let a=this.wrapper.wrapSubrule(e,t,i);this.isRecording()||this.performSubruleAssignment(a,n,o)}performSubruleAssignment(e,t,n){let{assignment:i,isCrossRef:o}=this.getAssignment(t);if(i&&n)this.assign(i.operator,i.feature,e,n,o);else if(!i){let a=this.current;if(gh(a))a.value+=e.toString();else{let s=e.$type,u=this.assignWithoutOverride(e,a);s&&(u.$type=s);let c=u;this.stack.pop(),this.stack.push(c)}}}action(e,t){if(!this.isRecording()){let n=this.current;if(!n.$cstNode&&t.feature&&t.operator){n=this.construct(!1);let o=n.$cstNode.feature;this.nodeBuilder.buildCompositeNode(o)}let i={$type:e};this.stack.pop(),this.stack.push(i),t.feature&&t.operator&&this.assign(t.operator,t.feature,n,n.$cstNode,!1)}}construct(e=!0){if(this.isRecording())return;let t=this.current;return(0,Ib.linkContentToContainer)(t),this.nodeBuilder.construct(t),e&&this.stack.pop(),gh(t)?this.converter.convert(t.value,t.$cstNode):(this.assignMandatoryProperties(t),t)}assignMandatoryProperties(e){let t=this.astReflection.getTypeMetaData(e.$type);for(let n of t.mandatory){let i=e[n.name];n.type==="array"&&!Array.isArray(i)?e[n.name]=[]:n.type==="boolean"&&i===void 0&&(e[n.name]=!1)}}getAssignment(e){if(!this.assignmentMap.has(e)){let t=(0,Ib.getContainerOfType)(e,ul.isAssignment);this.assignmentMap.set(e,{assignment:t,isCrossRef:t?(0,ul.isCrossReference)(t.terminal):!1})}return this.assignmentMap.get(e)}assign(e,t,n,i,o){let a=this.current,s;switch(o&&typeof n=="string"?s=this.linker.buildReference(a,t,i,n):s=n,e){case"=":{a[t]=s;break}case"?=":{a[t]=!0;break}case"+=":Array.isArray(a[t])||(a[t]=[]),a[t].push(s)}}assignWithoutOverride(e,t){for(let[n,i]of Object.entries(t))e[n]===void 0&&(e[n]=i);return e}get definitionErrors(){return this.wrapper.definitionErrors}};mt.LangiumParser=vh;var ll=class{buildMismatchTokenMessage({expected:e,actual:t}){return`Expecting ${e.LABEL?"`"+e.LABEL+"`":e.name.endsWith(":KW")?`keyword '${e.name.substring(0,e.name.length-3)}'`:`token of type '${e.name}'`} but found \`${t.image}\`.`}buildNotAllInputParsedMessage({firstRedundant:e}){return`Expecting end of file but found \`${e.image}\`.`}buildNoViableAltMessage(e){return cl.defaultParserErrorProvider.buildNoViableAltMessage(e)}buildEarlyExitMessage(e){return cl.defaultParserErrorProvider.buildEarlyExitMessage(e)}};mt.LangiumParserErrorMessageProvider=ll;var Th=class extends ls{constructor(){super(...arguments),this.tokens=[],this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}action(){}construct(){}parse(e){this.resetState();let t=this.lexer.tokenize(e);return this.tokens=t.tokens,this.wrapper.input=[...this.tokens],this.mainRule.call(this.wrapper),this.unorderedGroups.clear(),{tokens:this.tokens,elementStack:[...this.lastElementStack],tokenIndex:this.nextTokenIndex}}rule(e,t){let n=this.wrapper.DEFINE_RULE(e.name,this.startImplementation(t).bind(this));return e.entry&&(this.mainRule=n),n}resetState(){this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}startImplementation(e){return t=>{let n=this.keepStackSize();try{e(t)}finally{this.resetStackSize(n)}}}removeUnexpectedElements(){this.elementStack.splice(this.stackSize)}keepStackSize(){let e=this.elementStack.length;return this.stackSize=e,e}resetStackSize(e){this.removeUnexpectedElements(),this.stackSize=e}consume(e,t,n){this.wrapper.wrapConsume(e,t),this.isRecording()||(this.lastElementStack=[...this.elementStack,n],this.nextTokenIndex=this.currIdx+1)}subrule(e,t,n,i){this.before(n),this.wrapper.wrapSubrule(e,t,i),this.after(n)}before(e){this.isRecording()||this.elementStack.push(e)}after(e){if(!this.isRecording()){let t=this.elementStack.lastIndexOf(e);t>=0&&this.elementStack.splice(t)}}get currIdx(){return this.wrapper.currIdx}};mt.LangiumCompletionParser=Th;var EM={recoveryEnabled:!0,nodeLocationTracking:"full",skipValidations:!0,errorMessageProvider:new ll},Rh=class extends cl.EmbeddedActionsParser{constructor(e,t){super(e,Object.assign(Object.assign({},EM),t))}get IS_RECORDING(){return this.RECORDING_PHASE}DEFINE_RULE(e,t){return this.RULE(e,t)}wrapSelfAnalysis(){this.performSelfAnalysis()}wrapConsume(e,t){return this.consume(e,t)}wrapSubrule(e,t,n){return this.subrule(e,t,{ARGS:[n]})}wrapOr(e,t){this.or(e,t)}wrapOption(e,t){this.option(e,t)}wrapMany(e,t){this.many(e,t)}wrapAtLeastOne(e,t){this.atLeastOne(e,t)}};function Ob(r){return Array.isArray(r)&&(r.length===0||"name"in r[0])}mt.isTokenTypeArray=Ob;function $b(r){return r&&"modes"in r&&"defaultMode"in r}mt.isIMultiModeLexerDefinition=$b;function Mb(r){return!Ob(r)&&!$b(r)}mt.isTokenTypeDictionary=Mb});var Lb=C(Xo=>{"use strict";Object.defineProperty(Xo,"__esModule",{value:!0});Xo.assertUnreachable=Xo.ErrorWithLocation=void 0;var _h=class extends Error{constructor(e,t){super(e?`${t} at ${e.range.start.line}:${e.range.start.character}`:t)}};Xo.ErrorWithLocation=_h;function CM(r){throw new Error("Error! The input value was not handled.")}Xo.assertUnreachable=CM});var bh=C(fl=>{"use strict";Object.defineProperty(fl,"__esModule",{value:!0});fl.createParser=void 0;var Fb=al(),qe=ze(),qb=ds(),fs=Lb(),PM=Ct(),jb=Ft(),Gb=Pt();function kM(r,e,t){let n=MM(t);return xM({parser:e,tokens:n,rules:new Map,ruleNames:new Map},r),e}fl.createParser=kM;function xM(r,e){let t=(0,Gb.getAllReachableRules)(e,!1),n=(0,PM.stream)(e.rules).filter(qe.isParserRule).filter(i=>t.has(i));for(let i of n){let o=Object.assign(Object.assign({},r),{consume:1,optional:1,subrule:1,many:1,or:1});o.rules.set(i.name,r.parser.rule(i,zi(o,i.definition)))}}function zi(r,e,t=!1){let n;if((0,qe.isKeyword)(e))n=$M(r,e);else if((0,qe.isAction)(e))n=SM(r,e);else if((0,qe.isAssignment)(e))n=zi(r,e.terminal);else if((0,qe.isCrossReference)(e))n=Ub(r,e);else if((0,qe.isRuleCall)(e))n=NM(r,e);else if((0,qe.isAlternatives)(e))n=wM(r,e);else if((0,qe.isUnorderedGroup)(e))n=IM(r,e);else if((0,qe.isGroup)(e))n=OM(r,e);else throw new fs.ErrorWithLocation(e.$cstNode,`Unexpected element type: ${e.$type}`);return Wb(r,t?void 0:dl(e),n,e.cardinality)}function SM(r,e){let t=(0,jb.getTypeName)(e);return()=>r.parser.action(t,e)}function NM(r,e){let t=e.rule.ref;if((0,qe.isParserRule)(t)){let n=r.subrule++,i=e.arguments.length>0?DM(t,e.arguments):()=>({});return o=>r.parser.subrule(n,Kb(r,t),e,i(o))}else if((0,qe.isTerminalRule)(t)){let n=r.consume++,i=Ah(r,t.name);return()=>r.parser.consume(n,i,e)}else if(t)(0,fs.assertUnreachable)(t);else throw new fs.ErrorWithLocation(e.$cstNode,`Undefined rule type: ${e.$type}`)}function DM(r,e){let t=e.map(n=>Zn(n.value));return n=>{let i={};for(let o=0;o<t.length;o++){let a=r.parameters[o],s=t[o];i[a.name]=s(n)}return i}}function Zn(r){if((0,qe.isDisjunction)(r)){let e=Zn(r.left),t=Zn(r.right);return n=>e(n)||t(n)}else if((0,qe.isConjunction)(r)){let e=Zn(r.left),t=Zn(r.right);return n=>e(n)&&t(n)}else if((0,qe.isNegation)(r)){let e=Zn(r.value);return t=>!e(t)}else if((0,qe.isParameterReference)(r)){let e=r.parameter.ref.name;return t=>t!==void 0&&t[e]===!0}else if((0,qe.isLiteralCondition)(r)){let e=!!r.true;return()=>e}(0,fs.assertUnreachable)(r)}function wM(r,e){if(e.elements.length===1)return zi(r,e.elements[0]);{let t=[];for(let i of e.elements){let o={ALT:zi(r,i,!0)},a=dl(i);a&&(o.GATE=Zn(a)),t.push(o)}let n=r.or++;return i=>r.parser.alternatives(n,t.map(o=>{let a={ALT:()=>o.ALT(i)},s=o.GATE;return s&&(a.GATE=()=>s(i)),a}))}}function IM(r,e){if(e.elements.length===1)return zi(r,e.elements[0]);let t=[];for(let s of e.elements){let u={ALT:zi(r,s,!0)},c=dl(s);c&&(u.GATE=Zn(c)),t.push(u)}let n=r.or++,i=(s,u)=>{let c=u.getRuleStack().join("-");return`uGroup_${s}_${c}`},o=s=>r.parser.alternatives(n,t.map((u,c)=>{let l={ALT:()=>!0},d=r.parser;l.ALT=()=>{if(u.ALT(s),!d.isRecording()){let y=i(n,d);d.unorderedGroups.get(y)||d.unorderedGroups.set(y,[]);let p=d.unorderedGroups.get(y);typeof p?.[c]>"u"&&(p[c]=!0)}};let g=u.GATE;return g?l.GATE=()=>g(s):l.GATE=()=>{let y=d.unorderedGroups.get(i(n,d));return!y?.[c]},l})),a=Wb(r,dl(e),o,"*");return s=>{a(s),r.parser.isRecording()||r.parser.unorderedGroups.delete(i(n,r.parser))}}function OM(r,e){let t=e.elements.map(n=>zi(r,n));return n=>t.forEach(i=>i(n))}function dl(r){if((0,qe.isGroup)(r))return r.guardCondition}function Ub(r,e,t=e.terminal){if(t)if((0,qe.isRuleCall)(t)&&(0,qe.isParserRule)(t.rule.ref)){let n=r.subrule++;return i=>r.parser.subrule(n,Kb(r,t.rule.ref),e,i)}else if((0,qe.isRuleCall)(t)&&(0,qe.isTerminalRule)(t.rule.ref)){let n=r.consume++,i=Ah(r,t.rule.ref.name);return()=>r.parser.consume(n,i,e)}else if((0,qe.isKeyword)(t)){let n=r.consume++,i=Ah(r,t.value);return i.name=Hb(i.name),()=>r.parser.consume(n,i,e)}else throw new Error("Could not build cross reference parser");else{if(!e.type.ref)throw new Error("Could not resolve reference to type: "+e.type.$refText);let n=(0,Gb.findNameAssignment)(e.type.ref),i=n?.terminal;if(!i)throw new Error("Could not find name assignment for type: "+(0,jb.getTypeName)(e.type.ref));return Ub(r,e,i)}}var Hb=r=>r.endsWith(":KW")?r:r+":KW";function $M(r,e){let t=r.consume++,n=r.tokens[e.value];if(!n)throw new Error("Could not find token for keyword: "+e.value);return n.name=Hb(n.name),()=>r.parser.consume(t,n,e)}function Wb(r,e,t,n){let i=e&&Zn(e);if(!n)if(i){let o=r.or++;return a=>r.parser.alternatives(o,[{ALT:()=>t(a),GATE:()=>i(a)},{ALT:(0,Fb.EMPTY_ALT)(),GATE:()=>!i(a)}])}else return t;if(n==="*"){let o=r.many++;return a=>r.parser.many(o,{DEF:()=>t(a),GATE:i?()=>i(a):void 0})}else if(n==="+"){let o=r.many++;if(i){let a=r.or++;return s=>r.parser.alternatives(a,[{ALT:()=>r.parser.atLeastOne(o,{DEF:()=>t(s)}),GATE:()=>i(s)},{ALT:(0,Fb.EMPTY_ALT)(),GATE:()=>!i(s)}])}else return a=>r.parser.atLeastOne(o,{DEF:()=>t(a)})}else if(n==="?"){let o=r.optional++;return a=>r.parser.optional(o,{DEF:()=>t(a),GATE:i?()=>i(a):void 0})}else(0,fs.assertUnreachable)(n)}function MM(r){if((0,qb.isTokenTypeDictionary)(r))return r;let e=(0,qb.isIMultiModeLexerDefinition)(r)?Object.values(r.modes).flat():r,t={};return e.forEach(n=>t[n.name]=n),t}function Kb(r,e){let t=LM(r,e),n=r.rules.get(t);if(!n)throw new Error(`Rule "${t}" not found."`);return n}function LM(r,e){if((0,qe.isParserRule)(e))return e.name;if(r.ruleNames.has(e))return r.ruleNames.get(e);{let t=e,n=t.$container,i=e.$type;for(;!(0,qe.isParserRule)(n);)((0,qe.isGroup)(n)||(0,qe.isAlternatives)(n)||(0,qe.isUnorderedGroup)(n))&&(i=n.elements.indexOf(t).toString()+":"+i),t=n,n=n.$container;return i=n.name+":"+i,r.ruleNames.set(e,i),i}}function Ah(r,e){let t=r.tokens[e];if(!t)throw new Error(`Token "${e}" not found."`);return t}});var Bb=C(pl=>{"use strict";Object.defineProperty(pl,"__esModule",{value:!0});pl.createCompletionParser=void 0;var FM=ds(),qM=bh();function jM(r){let e=r.Grammar,t=r.parser.TokenBuilder.buildTokens(e,{caseInsensitive:r.LanguageMetaData.caseInsensitive}),n=new FM.LangiumCompletionParser(r,t);return(0,qM.createParser)(e,n,t),n.finalize(),n}pl.createCompletionParser=jM});var Eh=C(Jo=>{"use strict";Object.defineProperty(Jo,"__esModule",{value:!0});Jo.prepareLangiumParser=Jo.createLangiumParser=void 0;var GM=ds(),UM=bh();function HM(r){let e=zb(r);return e.finalize(),e}Jo.createLangiumParser=HM;function zb(r){let e=r.Grammar,t=r.parser.TokenBuilder.buildTokens(e,{caseInsensitive:r.LanguageMetaData.caseInsensitive}),n=new GM.LangiumParser(r,t);return(0,UM.createParser)(e,n,t)}Jo.prepareLangiumParser=zb});var kh=C(hl=>{"use strict";Object.defineProperty(hl,"__esModule",{value:!0});hl.DefaultTokenBuilder=void 0;var WM=al(),Ch=ze(),KM=Ft(),BM=Re(),zM=Pt(),ml=So(),VM=Ct(),Ph=class{buildTokens(e,t){let n=(0,VM.stream)((0,zM.getAllReachableRules)(e,!1)),i=this.buildTerminalTokens(n),o=this.buildKeywordTokens(n,i,t);return i.forEach(a=>{let s=a.PATTERN;typeof s=="object"&&s&&"test"in s&&(0,ml.isWhitespaceRegExp)(s)?o.unshift(a):o.push(a)}),o}buildTerminalTokens(e){return e.filter(Ch.isTerminalRule).filter(t=>!t.fragment).map(t=>this.buildTerminalToken(t)).toArray()}buildTerminalToken(e){let t=(0,KM.terminalRegex)(e),n={name:e.name,PATTERN:new RegExp(t)};return e.hidden&&(n.GROUP=(0,ml.isWhitespaceRegExp)(t)?WM.Lexer.SKIPPED:"hidden"),n}buildKeywordTokens(e,t,n){return e.filter(Ch.isParserRule).flatMap(i=>(0,BM.streamAllContents)(i).filter(Ch.isKeyword)).distinct(i=>i.value).toArray().sort((i,o)=>o.value.length-i.value.length).map(i=>this.buildKeywordToken(i,t,!!n?.caseInsensitive))}buildKeywordToken(e,t,n){return{name:e.value,PATTERN:this.buildKeywordPattern(e,n),LONGER_ALT:this.findLongerAlt(e,t)}}buildKeywordPattern(e,t){return t?new RegExp((0,ml.getCaseInsensitivePattern)(e.value)):e.value}findLongerAlt(e,t){return t.reduce((n,i)=>{let o=i?.PATTERN;return o?.source&&(0,ml.partialMatches)("^"+o.source+"$",e.value)&&n.push(i),n},[])}};hl.DefaultTokenBuilder=Ph});var Nh=C(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.convertBoolean=It.convertNumber=It.convertDate=It.convertBigint=It.convertInt=It.convertID=It.convertString=It.DefaultValueConverter=void 0;var Vb=ze(),YM=Ft(),XM=Pt(),xh=class{convert(e,t){let n=t.feature;if((0,Vb.isCrossReference)(n)&&(n=(0,XM.getCrossReferenceTerminal)(n)),(0,Vb.isRuleCall)(n)){let i=n.rule.ref;if(!i)throw new Error("This cst node was not parsed by a rule.");return this.runConverter(i,e,t)}return e}runConverter(e,t,n){var i;switch(e.name.toUpperCase()){case"INT":return Xb(t);case"STRING":return Sh(t);case"ID":return Yb(t);case"REGEXLITERAL":return Sh(t)}switch((i=(0,YM.getRuleType)(e))===null||i===void 0?void 0:i.toLowerCase()){case"number":return Qb(t);case"boolean":return eE(t);case"bigint":return Jb(t);case"date":return Zb(t);default:return t}}};It.DefaultValueConverter=xh;function Sh(r){return r.substring(1,r.length-1)}It.convertString=Sh;function Yb(r){return r.charAt(0)==="^"?r.substring(1):r}It.convertID=Yb;function Xb(r){return parseInt(r)}It.convertInt=Xb;function Jb(r){return BigInt(r)}It.convertBigint=Jb;function Zb(r){return new Date(r)}It.convertDate=Zb;function Qb(r){return Number(r)}It.convertNumber=Qb;function eE(r){return r.toLowerCase()==="true"}It.convertBoolean=eE});var wh=C(yl=>{"use strict";Object.defineProperty(yl,"__esModule",{value:!0});yl.DefaultLinker=void 0;var JM=Ne(),Qn=Re(),ZM=Yr(),tE=Gi(),Dh=class{constructor(e){this.reflection=e.shared.AstReflection,this.langiumDocuments=()=>e.shared.workspace.LangiumDocuments,this.scopeProvider=e.references.ScopeProvider,this.astNodeLocator=e.workspace.AstNodeLocator}async link(e,t=JM.CancellationToken.None){for(let n of(0,Qn.streamAst)(e.parseResult.value))await(0,ZM.interruptAndCheck)(t),(0,Qn.streamReferences)(n).forEach(i=>this.doLink(i,e));e.state=tE.DocumentState.Linked}doLink(e,t){let n=e.reference;if(n._ref===void 0)try{let i=this.getCandidate(e);if((0,Qn.isLinkingError)(i))n._ref=i;else if(n._nodeDescription=i,this.langiumDocuments().hasDocument(i.documentUri)){let o=this.loadAstNode(i);n._ref=o??this.createLinkingError(e,i)}}catch(i){n._ref=Object.assign(Object.assign({},e),{message:`An error occurred while resolving reference to '${n.$refText}': ${i}`})}t.references.push(n)}unlink(e){for(let t of e.references)delete t._ref,delete t._nodeDescription;e.references=[]}getCandidate(e){let n=this.scopeProvider.getScope(e).getElement(e.reference.$refText);return n??this.createLinkingError(e)}buildReference(e,t,n,i){let o=this,a={$refNode:n,$refText:i,get ref(){var s;if((0,Qn.isAstNode)(this._ref))return this._ref;if((0,Qn.isAstNodeDescription)(this._nodeDescription)){let u=o.loadAstNode(this._nodeDescription);this._ref=u??o.createLinkingError({reference:a,container:e,property:t},this._nodeDescription)}else if(this._ref===void 0){let u=o.getLinkedNode({reference:a,container:e,property:t});this._ref=(s=u.node)!==null&&s!==void 0?s:u.error,this._nodeDescription=u.descr}return(0,Qn.isAstNode)(this._ref)?this._ref:void 0},get $nodeDescription(){return this._nodeDescription},get error(){return(0,Qn.isLinkingError)(this._ref)?this._ref:void 0}};return a}getLinkedNode(e){try{let t=this.getCandidate(e);if((0,Qn.isLinkingError)(t))return{error:t};let n=this.loadAstNode(t);return n?{node:n,descr:t}:{descr:t,error:this.createLinkingError(e,t)}}catch(t){return{error:Object.assign(Object.assign({},e),{message:`An error occurred while resolving reference to '${e.reference.$refText}': ${t}`})}}}loadAstNode(e){if(e.node)return e.node;let t=this.langiumDocuments().getOrCreateDocument(e.documentUri);return this.astNodeLocator.getAstNode(t,e.path)}createLinkingError(e,t){let n=(0,Qn.getDocument)(e.container);n.state<tE.DocumentState.ComputedScopes&&console.warn(`Attempted reference resolution before document reached ComputedScopes state (${n.uri}).`);let i=this.reflection.getReferenceType(e);return Object.assign(Object.assign({},e),{message:`Could not resolve reference to ${i} named '${e.reference.$refText}'.`,targetDescription:t})}};yl.DefaultLinker=Dh});var Oh=C(vl=>{"use strict";Object.defineProperty(vl,"__esModule",{value:!0});vl.DefaultJsonSerializer=void 0;var gl=Re(),Ih=class{constructor(e){this.ignoreProperties=["$container","$containerProperty","$containerIndex","$document","$cstNode"],this.linker=e.references.Linker}serialize(e,t){return JSON.stringify(this.decycle(e,this.ignoreProperties),void 0,t)}deserialize(e){return this.revive(JSON.parse(e))}decycle(e,t){let n=new Set,i=o=>{if(typeof o=="object"&&o!==null){if(n.has(o))throw new Error("Cycle in ast detected.");if(n.add(o),(0,gl.isReference)(o))return{$refText:o.$refText};let a;if(Array.isArray(o)){a=[];for(let s=0;s<o.length;s++)a[s]=i(o[s])}else{a={};for(let[s,u]of Object.entries(o))t.includes(s)||(a[s]=i(u))}return a}return o};return i(e)}revive(e){let t=(n,i,o)=>{if(Array.isArray(n))for(let a=0;a<n.length;a++){let s=n[a];if((0,gl.isReference)(s)&&(0,gl.isAstNode)(i)){let u=this.linker.buildReference(i,o,s.$refNode,s.$refText);n[a]=u}else typeof s=="object"&&s!==null&&(t(s),s.$container=i,s.$containerProperty=o,s.$containerIndex=a)}else if(typeof n=="object"&&n!==null){for(let[a,s]of Object.entries(n))if(typeof s=="object"&&s!==null)if((0,gl.isReference)(s)){let u=this.linker.buildReference(n,a,s.$refNode,s.$refText);n[a]=u}else Array.isArray(s)?t(s,n,a):(t(s),s.$container=n,s.$containerProperty=a)}};return t(e),e}};vl.DefaultJsonSerializer=Ih});var Mh=C(Tl=>{"use strict";Object.defineProperty(Tl,"__esModule",{value:!0});Tl.DefaultServiceRegistry=void 0;var QM=vn(),$h=class{register(e){if(!this.singleton&&!this.map){this.singleton=e;return}if(!this.map&&(this.map={},this.singleton)){for(let t of this.singleton.LanguageMetaData.fileExtensions)this.map[t]=this.singleton;this.singleton=void 0}for(let t of e.LanguageMetaData.fileExtensions)this.map[t]!==void 0&&this.map[t]!==e&&console.warn(`The file extension ${t} is used by multiple languages. It is now assigned to '${e.LanguageMetaData.languageId}'.`),this.map[t]=e}getServices(e){if(this.singleton!==void 0)return this.singleton;if(this.map===void 0)throw new Error("The service registry is empty. Use `register` to register the services of a language.");let t=QM.Utils.extname(e),n=this.map[t];if(!n)throw new Error(`The service registry contains no services for the extension '${t}'.`);return n}get all(){return this.singleton!==void 0?[this.singleton]:this.map!==void 0?Object.values(this.map):[]}};Tl.DefaultServiceRegistry=$h});var qh=C(Zo=>{"use strict";Object.defineProperty(Zo,"__esModule",{value:!0});Zo.DefaultReferenceDescriptionProvider=Zo.DefaultAstNodeDescriptionProvider=void 0;var eL=Ne(),ps=Re(),tL=et(),rL=Yr(),nL=hi(),Lh=class{constructor(e){this.astNodeLocator=e.workspace.AstNodeLocator}createDescription(e,t,n=(0,ps.getDocument)(e)){return{node:e,name:t,type:e.$type,documentUri:n.uri,path:this.astNodeLocator.getAstNodePath(e)}}createDescriptions(){throw new Error("Deprecated: This method has been moved to the `ScopeComputation` service and renamed to `computeExports`.")}};Zo.DefaultAstNodeDescriptionProvider=Lh;var Fh=class{constructor(e){this.nodeLocator=e.workspace.AstNodeLocator}async createDescriptions(e,t=eL.CancellationToken.None){let n=[],i=e.parseResult.value;for(let o of(0,ps.streamAst)(i))await(0,rL.interruptAndCheck)(t),(0,ps.streamReferences)(o).filter(a=>!(0,ps.isLinkingError)(a)).forEach(a=>{let s=a.reference.$nodeDescription;s&&n.push(this.createDescription(a,s))});return n}createDescription(e,t){let n=(0,ps.getDocument)(e.container).uri,i=e.reference.$refNode;return{sourceUri:n,sourcePath:this.nodeLocator.getAstNodePath(e.container),targetUri:t.documentUri,targetPath:t.path,segment:(0,tL.toDocumentSegment)(i),local:(0,nL.equalURI)(t.documentUri,n)}}};Zo.DefaultReferenceDescriptionProvider=Fh});var rE=C(Rl=>{"use strict";Object.defineProperty(Rl,"__esModule",{value:!0});Rl.DefaultAstNodeLocator=void 0;var jh=class{constructor(){this.segmentSeparator="/",this.indexSeparator="@"}getAstNodePath(e){if(e.$container){let t=this.getAstNodePath(e.$container),n=this.getPathSegment(e);return t+this.segmentSeparator+n}return""}getPathSegment({$containerProperty:e,$containerIndex:t}){if(!e)throw new Error("Missing '$containerProperty' in AST node.");return t!==void 0?e+this.indexSeparator+t:e}getAstNode(e,t){return t.split(this.segmentSeparator).reduce((i,o)=>{if(!i||o.length===0)return i;let a=o.indexOf(this.indexSeparator);if(a>0){let s=o.substring(0,a),u=parseInt(o.substring(a+1));return i[s][u]}return i[o]},e.parseResult.value)}};Rl.DefaultAstNodeLocator=jh});var Uh=C(_l=>{"use strict";Object.defineProperty(_l,"__esModule",{value:!0});_l.DefaultConfigurationProvider=void 0;var iL=Tt(),Gh=class{constructor(e){this.settings={},this.workspaceConfig=!1,this.initialized=!1,this.serviceRegistry=e.ServiceRegistry,this.connection=e.lsp.Connection,e.lsp.LanguageServer.onInitialize(t=>{var n,i;this.workspaceConfig=(i=(n=t.capabilities.workspace)===null||n===void 0?void 0:n.configuration)!==null&&i!==void 0?i:!1}),e.lsp.LanguageServer.onInitialized(t=>{var n;let i=this.serviceRegistry.all;(n=e.lsp.Connection)===null||n===void 0||n.client.register(iL.DidChangeConfigurationNotification.type,{section:i.map(o=>this.toSectionName(o.LanguageMetaData.languageId))})})}async initialize(){if(this.workspaceConfig&&this.connection){let t=this.serviceRegistry.all.map(i=>({section:this.toSectionName(i.LanguageMetaData.languageId)})),n=await this.connection.workspace.getConfiguration(t);t.forEach((i,o)=>{this.updateSectionConfiguration(i.section,n[o])})}this.initialized=!0}updateConfiguration(e){!e.settings||Object.keys(e.settings).forEach(t=>{this.updateSectionConfiguration(t,e.settings[t])})}updateSectionConfiguration(e,t){this.settings[e]=t}async getConfiguration(e,t){this.initialized||await this.initialize();let n=this.toSectionName(e);if(this.settings[n])return this.settings[n][t]}toSectionName(e){return`${e}`}};_l.DefaultConfigurationProvider=Gh});var Kh=C(bl=>{"use strict";Object.defineProperty(bl,"__esModule",{value:!0});bl.DefaultDocumentBuilder=void 0;var Al=Ne(),oL=kr(),Hh=Yr(),ei=Gi(),Wh=class{constructor(e){this.updateListeners=[],this.buildPhaseListeners=new oL.MultiMap,this.langiumDocuments=e.workspace.LangiumDocuments,this.indexManager=e.workspace.IndexManager,this.serviceRegistry=e.ServiceRegistry}async build(e,t={},n=Al.CancellationToken.None){await this.buildDocuments(e,t,n)}async update(e,t,n=Al.CancellationToken.None){for(let s of t)this.langiumDocuments.invalidateDocument(s);this.indexManager.remove(t);for(let s of e)this.langiumDocuments.invalidateDocument(s);for(let s of this.updateListeners)s(e,t);await(0,Hh.interruptAndCheck)(n);let i=e.map(s=>this.langiumDocuments.getOrCreateDocument(s)),o=this.collectDocuments(i,t),a={validationChecks:"all"};await this.buildDocuments(o,a,n)}onUpdate(e){return this.updateListeners.push(e),Al.Disposable.create(()=>{let t=this.updateListeners.indexOf(e);t>=0&&this.updateListeners.splice(t,1)})}collectDocuments(e,t){let n=e.map(a=>a.uri).concat(t),i=this.indexManager.getAffectedDocuments(n).toArray();i.forEach(a=>{this.serviceRegistry.getServices(a.uri).references.Linker.unlink(a),a.state=Math.min(a.state,ei.DocumentState.ComputedScopes)});let o=new Set([...e,...i,...this.langiumDocuments.all.filter(a=>a.state<ei.DocumentState.Validated)]);return Array.from(o)}async buildDocuments(e,t,n){await this.runCancelable(e,ei.DocumentState.IndexedContent,n,o=>this.indexManager.updateContent(o,n)),await this.runCancelable(e,ei.DocumentState.ComputedScopes,n,o=>this.computeScopes(o,n)),await this.runCancelable(e,ei.DocumentState.Linked,n,o=>this.serviceRegistry.getServices(o.uri).references.Linker.link(o,n)),await this.runCancelable(e,ei.DocumentState.IndexedReferences,n,o=>this.indexManager.updateReferences(o,n));let i=e.filter(o=>this.shouldValidate(o,t));await this.runCancelable(i,ei.DocumentState.Validated,n,o=>this.validate(o,n))}async runCancelable(e,t,n,i){let o=e.filter(a=>a.state<t);for(let a of o)await(0,Hh.interruptAndCheck)(n),await i(a);await this.notifyBuildPhase(o,t,n)}onBuildPhase(e,t){return this.buildPhaseListeners.add(e,t),Al.Disposable.create(()=>{this.buildPhaseListeners.delete(e,t)})}async notifyBuildPhase(e,t,n){if(e.length===0)return;let i=this.buildPhaseListeners.get(t);for(let o of i)await(0,Hh.interruptAndCheck)(n),await o(e,n)}async computeScopes(e,t){let n=this.serviceRegistry.getServices(e.uri).references.ScopeComputation;e.precomputedScopes=await n.computeLocalScopes(e,t),e.state=ei.DocumentState.ComputedScopes}shouldValidate(e,t){return t.validationChecks==="all"}async validate(e,t){let i=await this.serviceRegistry.getServices(e.uri).validation.DocumentValidator.validateDocument(e,t);e.diagnostics=i,e.state=ei.DocumentState.Validated}};bl.DefaultDocumentBuilder=Wh});var Yh=C(El=>{"use strict";Object.defineProperty(El,"__esModule",{value:!0});El.DefaultIndexManager=void 0;var nE=Ne(),aL=Re(),Bh=Ct(),zh=hi(),iE=Gi(),Vh=class{constructor(e){this.simpleIndex=new Map,this.referenceIndex=new Map,this.globalScopeCache=new Map,this.serviceRegistry=e.ServiceRegistry,this.astReflection=e.AstReflection,this.langiumDocuments=()=>e.workspace.LangiumDocuments}findAllReferences(e,t){let n=(0,aL.getDocument)(e).uri,i=[];return this.referenceIndex.forEach(o=>{o.forEach(a=>{(0,zh.equalURI)(a.targetUri,n)&&a.targetPath===t&&i.push(a)})}),(0,Bh.stream)(i)}allElements(e=""){this.globalScopeCache.has("")||this.globalScopeCache.set("",Array.from(this.simpleIndex.values()).flat());let t=this.globalScopeCache.get(e);if(t)return(0,Bh.stream)(t);{let n=this.globalScopeCache.get("").filter(i=>this.astReflection.isSubtype(i.type,e));return this.globalScopeCache.set(e,n),(0,Bh.stream)(n)}}remove(e){for(let t of e){let n=t.toString();this.simpleIndex.delete(n),this.referenceIndex.delete(n)}}async updateContent(e,t=nE.CancellationToken.None){this.globalScopeCache.clear();let i=await this.serviceRegistry.getServices(e.uri).references.ScopeComputation.computeExports(e,t);for(let o of i)o.node=void 0;this.simpleIndex.set(e.uri.toString(),i),e.state=iE.DocumentState.IndexedContent}async updateReferences(e,t=nE.CancellationToken.None){let i=await this.serviceRegistry.getServices(e.uri).workspace.ReferenceDescriptionProvider.createDescriptions(e,t);this.referenceIndex.set(e.uri.toString(),i),e.state=iE.DocumentState.IndexedReferences}getAffectedDocuments(e){return this.langiumDocuments().all.filter(t=>{if(e.some(n=>(0,zh.equalURI)(t.uri,n)))return!1;for(let n of e)if(this.isAffected(t,n))return!0;return!1})}isAffected(e,t){let n=t.toString(),i=e.uri.toString();if(e.references.some(a=>a.error!==void 0))return!0;let o=this.referenceIndex.get(i);return o?o.filter(a=>!a.local).some(a=>(0,zh.equalURI)(a.targetUri,n)):!1}};El.DefaultIndexManager=Vh});var Zh=C(Cl=>{"use strict";Object.defineProperty(Cl,"__esModule",{value:!0});Cl.DefaultWorkspaceManager=void 0;var sL=Ne(),Xh=vn(),uL=Yr(),Jh=class{constructor(e){this.serviceRegistry=e.ServiceRegistry,this.langiumDocuments=e.workspace.LangiumDocuments,this.documentBuilder=e.workspace.DocumentBuilder,this.fileSystemProvider=e.workspace.FileSystemProvider,this.mutex=e.workspace.MutexLock,e.lsp.LanguageServer.onInitialize(t=>{var n;this.folders=(n=t.workspaceFolders)!==null&&n!==void 0?n:void 0}),e.lsp.LanguageServer.onInitialized(t=>{this.mutex.lock(n=>{var i;return this.initializeWorkspace((i=this.folders)!==null&&i!==void 0?i:[],n)})})}async initializeWorkspace(e,t=sL.CancellationToken.None){let n=this.serviceRegistry.all.flatMap(a=>a.LanguageMetaData.fileExtensions),i=[],o=a=>{i.push(a),this.langiumDocuments.hasDocument(a.uri)||this.langiumDocuments.addDocument(a)};await this.loadAdditionalDocuments(e,o),await Promise.all(e.map(a=>[a,this.getRootFolder(a)]).map(async a=>this.traverseFolder(...a,n,o))),await(0,uL.interruptAndCheck)(t),await this.documentBuilder.build(i,void 0,t)}loadAdditionalDocuments(e,t){return Promise.resolve()}getRootFolder(e){return Xh.URI.parse(e.uri)}async traverseFolder(e,t,n,i){let o=await this.fileSystemProvider.readDirectory(t);await Promise.all(o.map(async a=>{if(this.includeEntry(e,a,n)){if(a.isDirectory)await this.traverseFolder(e,a.uri,n,i);else if(a.isFile){let s=this.langiumDocuments.getOrCreateDocument(a.uri);i(s)}}}))}includeEntry(e,t,n){let i=Xh.Utils.basename(t.uri);if(i.startsWith("."))return!1;if(t.isDirectory)return i!=="node_modules"&&i!=="out";if(t.isFile){let o=Xh.Utils.extname(t.uri);return n.includes(o)}return!1}};Cl.DefaultWorkspaceManager=Jh});var _c=C(Qo=>{"use strict";Object.defineProperty(Qo,"__esModule",{value:!0});Qo.createDefaultSharedModule=Qo.createDefaultModule=void 0;var cL=Ne(),lL=vu(),dL=t_(),fL=Bb(),pL=Jp(),mL=Qp(),hL=tm(),yL=zu(),gL=im(),vL=am(),TL=ym(),RL=vm(),_L=Rm(),AL=Eh(),bL=kh(),EL=Nh(),CL=wh(),PL=Io(),kL=Hp(),xL=Su(),SL=Du(),NL=Oh(),DL=Mh(),wL=Yr(),IL=Ku(),OL=Fu(),oE=qh(),$L=rE(),ML=Uh(),LL=Kh(),Qh=Gi(),FL=Yh(),qL=Zh();function jL(r){return{parser:{GrammarConfig:e=>(0,dL.createGrammarConfig)(e),LangiumParser:e=>(0,AL.createLangiumParser)(e),CompletionParser:e=>(0,fL.createCompletionParser)(e),ValueConverter:()=>new EL.DefaultValueConverter,TokenBuilder:()=>new bL.DefaultTokenBuilder},lsp:{CompletionProvider:e=>new pL.DefaultCompletionProvider(e),DocumentSymbolProvider:e=>new hL.DefaultDocumentSymbolProvider(e),HoverProvider:e=>new vL.MultilineCommentHoverProvider(e),FoldingRangeProvider:e=>new yL.DefaultFoldingRangeProvider(e),ReferencesProvider:e=>new RL.DefaultReferencesProvider(e),DefinitionProvider:e=>new gL.DefaultDefinitionProvider(e),DocumentHighlightProvider:e=>new mL.DefaultDocumentHighlightProvider(e),RenameProvider:e=>new _L.DefaultRenameProvider(e)},workspace:{AstNodeLocator:()=>new $L.DefaultAstNodeLocator,AstNodeDescriptionProvider:e=>new oE.DefaultAstNodeDescriptionProvider(e),ReferenceDescriptionProvider:e=>new oE.DefaultReferenceDescriptionProvider(e)},references:{Linker:e=>new CL.DefaultLinker(e),NameProvider:()=>new PL.DefaultNameProvider,ScopeProvider:e=>new SL.DefaultScopeProvider(e),ScopeComputation:e=>new xL.DefaultScopeComputation(e),References:e=>new kL.DefaultReferences(e)},serializer:{JsonSerializer:e=>new NL.DefaultJsonSerializer(e)},validation:{DocumentValidator:e=>new IL.DefaultDocumentValidator(e),ValidationRegistry:e=>new OL.ValidationRegistry(e)},shared:()=>r.shared}}Qo.createDefaultModule=jL;function GL(r){return{ServiceRegistry:()=>new DL.DefaultServiceRegistry,lsp:{Connection:()=>r.connection,LanguageServer:e=>new TL.DefaultLanguageServer(e)},workspace:{LangiumDocuments:e=>new Qh.DefaultLangiumDocuments(e),LangiumDocumentFactory:e=>new Qh.DefaultLangiumDocumentFactory(e),DocumentBuilder:e=>new LL.DefaultDocumentBuilder(e),TextDocuments:()=>new cL.TextDocuments(lL.TextDocument),TextDocumentFactory:e=>new Qh.DefaultTextDocumentFactory(e),IndexManager:e=>new FL.DefaultIndexManager(e),WorkspaceManager:e=>new qL.DefaultWorkspaceManager(e),FileSystemProvider:e=>r.fileSystemProvider(e),MutexLock:()=>new wL.MutexLock,ConfigurationProvider:e=>new ML.DefaultConfigurationProvider(e)}}}Qo.createDefaultSharedModule=GL});var aE=C(Pl=>{"use strict";Object.defineProperty(Pl,"__esModule",{value:!0});Pl.s=void 0;var UL=/^(s*\n)+/,HL=/\n/g,WL=/\S|$/;function KL(r,...e){let t=e.reduce((i,o,a)=>i+BL(String(o),i)+r[a+1],r[0]).split(`
3722
- `).map(i=>i.trimRight()),n=zL(t);return t.map(i=>i.slice(n).trimRight()).join(`
3723
- `).trimRight().replace(UL,"")}Pl.s=KL;function BL(r,e){let t=Math.max(0,e.length-e.lastIndexOf(`
3724
- `)-1),n=" ".repeat(t);return r.replace(HL,`
3725
- `+n)}function zL(r){let e=r.filter(n=>n.length>0).map(n=>n.search(WL)),t=e.length===0?0:Math.min(...e);return Math.max(0,t)}});var uE=C(sE=>{"use strict";Object.defineProperty(sE,"__esModule",{value:!0})});var lE=C(cE=>{"use strict";Object.defineProperty(cE,"__esModule",{value:!0})});var fE=C(dE=>{"use strict";Object.defineProperty(dE,"__esModule",{value:!0})});var wn=C(Z=>{"use strict";var pE=Z&&Z.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),VL=Z&&Z.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),oe=Z&&Z.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&pE(e,r,t)},YL=Z&&Z.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&pE(e,r,t);return VL(e,r),e};Object.defineProperty(Z,"__esModule",{value:!0});Z.GrammarAST=void 0;oe(_c(),Z);oe(xa(),Z);oe(Ou(),Z);oe(Yf(),Z);oe(aE(),Z);oe(Nm(),Z);oe(Rc(),Z);oe(uE(),Z);oe(Am(),Z);oe(ds(),Z);oe(Eh(),Z);oe(lE(),Z);oe(kh(),Z);oe(Nh(),Z);oe(wh(),Z);oe(Io(),Z);oe(Su(),Z);oe(Du(),Z);oe(Oh(),Z);oe(Mh(),Z);oe(fE(),Z);oe(_o(),Z);oe(Re(),Z);oe(kr(),Z);oe(et(),Z);oe(Pt(),Z);oe(Yr(),Z);oe(hi(),Z);oe(So(),Z);oe(Ct(),Z);oe(Ku(),Z);oe(Fu(),Z);oe(qh(),Z);oe(Kh(),Z);oe(Gi(),Z);oe(Yh(),Z);oe(bu(),Z);oe(Zh(),Z);oe(Uh(),Z);var XL=YL(ze());Z.GrammarAST=XL});var mE=C(Ai=>{"use strict";var JL=Ai&&Ai.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ai,"__esModule",{value:!0});Ai.NodeFileSystem=Ai.NodeFileSystemProvider=void 0;var ey=JL(require("fs")),ZL=vn(),kl=class{constructor(){this.encoding="utf-8"}readFile(e){return ey.default.promises.readFile(e.fsPath,this.encoding)}readFileSync(e){return ey.default.readFileSync(e.fsPath,this.encoding)}async readDirectory(e){return(await ey.default.promises.readdir(e.fsPath,{withFileTypes:!0})).map(n=>({dirent:n,isFile:n.isFile(),isDirectory:n.isDirectory(),uri:ZL.Utils.joinPath(e,n.name)}))}};Ai.NodeFileSystemProvider=kl;Ai.NodeFileSystem={fileSystemProvider:()=>new kl}});var hE=C(Vi=>{"use strict";var QL=Vi&&Vi.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),eF=Vi&&Vi.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&QL(e,r,t)};Object.defineProperty(Vi,"__esModule",{value:!0});eF(mE(),Vi)});var gE=C((nG,yE)=>{yE.exports=hE()});var TE=C((iG,vE)=>{"use strict";vE.exports=Ne()});var jE=C((cy,ly)=>{(function(r,e){typeof require=="function"&&typeof cy=="object"&&typeof ly=="object"?ly.exports=e():typeof define=="function"&&define.amd?define(function(){return e()}):r.pluralize=e()})(cy,function(){var r=[],e=[],t={},n={},i={};function o(y){return typeof y=="string"?new RegExp("^"+y+"$","i"):y}function a(y,p){return y===p?p:y===y.toLowerCase()?p.toLowerCase():y===y.toUpperCase()?p.toUpperCase():y[0]===y[0].toUpperCase()?p.charAt(0).toUpperCase()+p.substr(1).toLowerCase():p.toLowerCase()}function s(y,p){return y.replace(/\$(\d{1,2})/g,function(A,x){return p[x]||""})}function u(y,p){return y.replace(p[0],function(A,x){var k=s(p[1],arguments);return a(A===""?y[x-1]:A,k)})}function c(y,p,A){if(!y.length||t.hasOwnProperty(y))return p;for(var x=A.length;x--;){var k=A[x];if(k[0].test(p))return u(p,k)}return p}function l(y,p,A){return function(x){var k=x.toLowerCase();return p.hasOwnProperty(k)?a(x,k):y.hasOwnProperty(k)?a(x,y[k]):c(k,x,A)}}function d(y,p,A,x){return function(k){var _=k.toLowerCase();return p.hasOwnProperty(_)?!0:y.hasOwnProperty(_)?!1:c(_,_,A)===_}}function g(y,p,A){var x=p===1?g.singular(y):g.plural(y);return(A?p+" ":"")+x}return g.plural=l(i,n,r),g.isPlural=d(i,n,r),g.singular=l(n,i,e),g.isSingular=d(n,i,e),g.addPluralRule=function(y,p){r.push([o(y),p])},g.addSingularRule=function(y,p){e.push([o(y),p])},g.addUncountableRule=function(y){if(typeof y=="string"){t[y.toLowerCase()]=!0;return}g.addPluralRule(y,"$0"),g.addSingularRule(y,"$0")},g.addIrregularRule=function(y,p){p=p.toLowerCase(),y=y.toLowerCase(),i[y]=p,n[p]=y},[["I","we"],["me","us"],["he","they"],["she","they"],["them","them"],["myself","ourselves"],["yourself","yourselves"],["itself","themselves"],["herself","themselves"],["himself","themselves"],["themself","themselves"],["is","are"],["was","were"],["has","have"],["this","these"],["that","those"],["echo","echoes"],["dingo","dingoes"],["volcano","volcanoes"],["tornado","tornadoes"],["torpedo","torpedoes"],["genus","genera"],["viscus","viscera"],["stigma","stigmata"],["stoma","stomata"],["dogma","dogmata"],["lemma","lemmata"],["schema","schemata"],["anathema","anathemata"],["ox","oxen"],["axe","axes"],["die","dice"],["yes","yeses"],["foot","feet"],["eave","eaves"],["goose","geese"],["tooth","teeth"],["quiz","quizzes"],["human","humans"],["proof","proofs"],["carve","carves"],["valve","valves"],["looey","looies"],["thief","thieves"],["groove","grooves"],["pickaxe","pickaxes"],["passerby","passersby"]].forEach(function(y){return g.addIrregularRule(y[0],y[1])}),[[/s?$/i,"s"],[/[^\u0000-\u007F]$/i,"$0"],[/([^aeiou]ese)$/i,"$1"],[/(ax|test)is$/i,"$1es"],[/(alias|[^aou]us|t[lm]as|gas|ris)$/i,"$1es"],[/(e[mn]u)s?$/i,"$1s"],[/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i,"$1"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1i"],[/(alumn|alg|vertebr)(?:a|ae)$/i,"$1ae"],[/(seraph|cherub)(?:im)?$/i,"$1im"],[/(her|at|gr)o$/i,"$1oes"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i,"$1a"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i,"$1a"],[/sis$/i,"ses"],[/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i,"$1$2ves"],[/([^aeiouy]|qu)y$/i,"$1ies"],[/([^ch][ieo][ln])ey$/i,"$1ies"],[/(x|ch|ss|sh|zz)$/i,"$1es"],[/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i,"$1ices"],[/\b((?:tit)?m|l)(?:ice|ouse)$/i,"$1ice"],[/(pe)(?:rson|ople)$/i,"$1ople"],[/(child)(?:ren)?$/i,"$1ren"],[/eaux$/i,"$0"],[/m[ae]n$/i,"men"],["thou","you"]].forEach(function(y){return g.addPluralRule(y[0],y[1])}),[[/s$/i,""],[/(ss)$/i,"$1"],[/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i,"$1fe"],[/(ar|(?:wo|[ae])l|[eo][ao])ves$/i,"$1f"],[/ies$/i,"y"],[/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i,"$1ie"],[/\b(mon|smil)ies$/i,"$1ey"],[/\b((?:tit)?m|l)ice$/i,"$1ouse"],[/(seraph|cherub)im$/i,"$1"],[/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i,"$1"],[/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i,"$1sis"],[/(movie|twelve|abuse|e[mn]u)s$/i,"$1"],[/(test)(?:is|es)$/i,"$1is"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1us"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i,"$1um"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i,"$1on"],[/(alumn|alg|vertebr)ae$/i,"$1a"],[/(cod|mur|sil|vert|ind)ices$/i,"$1ex"],[/(matr|append)ices$/i,"$1ix"],[/(pe)(rson|ople)$/i,"$1rson"],[/(child)ren$/i,"$1"],[/(eau)x?$/i,"$1"],[/men$/i,"man"]].forEach(function(y){return g.addSingularRule(y[0],y[1])}),["adulthood","advice","agenda","aid","aircraft","alcohol","ammo","analytics","anime","athletics","audio","bison","blood","bream","buffalo","butter","carp","cash","chassis","chess","clothing","cod","commerce","cooperation","corps","debris","diabetes","digestion","elk","energy","equipment","excretion","expertise","firmware","flounder","fun","gallows","garbage","graffiti","hardware","headquarters","health","herpes","highjinks","homework","housework","information","jeans","justice","kudos","labour","literature","machinery","mackerel","mail","media","mews","moose","music","mud","manga","news","only","personnel","pike","plankton","pliers","police","pollution","premises","rain","research","rice","salmon","scissors","series","sewage","shambles","shrimp","software","species","staff","swine","tennis","traffic","transportation","trout","tuna","wealth","welfare","whiting","wildebeest","wildlife","you",/pok[eé]mon$/i,/[^aeiou]ese$/i,/deer$/i,/fish$/i,/measles$/i,/o[iu]s$/i,/pox$/i,/sheep$/i].forEach(g.addUncountableRule),g})});var XE=St(wn()),JE=St(gE()),Kl=St(TE());var st=St(wn());var bE=St(wn()),RE="AbstractDeclaration";var tF="Expression";var _E="ReferenceTarget";var xl="TypeDeclaration";var Sl="ArrayExpr";function EE(r){return an.isInstance(r,Sl)}var ms="Attribute";function CE(r){return an.isInstance(r,ms)}var PE="AttributeArg";var Nl="BinaryExpr";function kE(r){return an.isInstance(r,Nl)}var xE="DataModel";function bi(r){return an.isInstance(r,xE)}var ty="DataModelField";function ea(r){return an.isInstance(r,ty)}var SE="DataSource";function NE(r){return an.isInstance(r,SE)}var rF="Enum";var Dl="EnumField";function DE(r){return an.isInstance(r,Dl)}var AE="Function";var nF="FunctionParam";var wl="InvocationExpr";function Il(r){return an.isInstance(r,wl)}var Ol="LiteralExpr";function $l(r){return an.isInstance(r,Ol)}var ry="MemberAccessExpr";var iF="Model";function wE(r){return an.isInstance(r,iF)}var ny="NullExpr";var Ml="ReferenceExpr";function iy(r){return an.isInstance(r,Ml)}var oy="ThisExpr";var ay="UnaryExpr";var hs=class{getAllTypes(){return["AbstractDeclaration","Argument","ArrayExpr","Attribute","AttributeArg","AttributeAttribute","AttributeParam","AttributeParamType","BinaryExpr","DataModel","DataModelAttribute","DataModelField","DataModelFieldAttribute","DataModelFieldType","DataSource","DataSourceField","Enum","EnumField","Expression","Function","FunctionParam","FunctionParamType","InvocationExpr","LiteralExpr","MemberAccessExpr","Model","NullExpr","ReferenceArg","ReferenceExpr","ReferenceTarget","ThisExpr","TypeDeclaration","UnaryExpr"]}isInstance(e,t){return(0,bE.isAstNode)(e)&&this.isSubtype(e.$type,t)}isSubtype(e,t){if(e===t)return!0;switch(e){case Sl:case Nl:case wl:case Ol:case ry:case ny:case Ml:case oy:case ay:return this.isSubtype(tF,t);case ms:case SE:case AE:return this.isSubtype(RE,t);case xE:case rF:return this.isSubtype(RE,t)||this.isSubtype(xl,t);case ty:case Dl:case nF:return this.isSubtype(_E,t);default:return!1}}getReferenceType(e){let t=`${e.container.$type}:${e.property}`;switch(t){case"AttributeAttribute:decl":return ms;case"AttributeParamType:reference":return xl;case"DataModelAttribute:decl":return ms;case"DataModelFieldAttribute:decl":return ms;case"DataModelFieldType:reference":return xl;case"FunctionParamType:reference":return xl;case"InvocationExpr:function":return AE;case"MemberAccessExpr:member":return ty;case"ReferenceExpr:target":return _E;default:throw new Error(`${t} is not a valid reference id.`)}}getTypeMetaData(e){switch(e){case"ArrayExpr":return{name:"ArrayExpr",mandatory:[{name:"items",type:"array"}]};case"Attribute":return{name:"Attribute",mandatory:[{name:"attributes",type:"array"},{name:"params",type:"array"}]};case"AttributeAttribute":return{name:"AttributeAttribute",mandatory:[{name:"args",type:"array"}]};case"AttributeParam":return{name:"AttributeParam",mandatory:[{name:"default",type:"boolean"}]};case"AttributeParamType":return{name:"AttributeParamType",mandatory:[{name:"array",type:"boolean"},{name:"optional",type:"boolean"}]};case"DataModel":return{name:"DataModel",mandatory:[{name:"attributes",type:"array"},{name:"fields",type:"array"}]};case"DataModelAttribute":return{name:"DataModelAttribute",mandatory:[{name:"args",type:"array"}]};case"DataModelField":return{name:"DataModelField",mandatory:[{name:"attributes",type:"array"}]};case"DataModelFieldAttribute":return{name:"DataModelFieldAttribute",mandatory:[{name:"args",type:"array"}]};case"DataModelFieldType":return{name:"DataModelFieldType",mandatory:[{name:"array",type:"boolean"},{name:"optional",type:"boolean"}]};case"DataSource":return{name:"DataSource",mandatory:[{name:"fields",type:"array"}]};case"Enum":return{name:"Enum",mandatory:[{name:"fields",type:"array"}]};case"Function":return{name:"Function",mandatory:[{name:"params",type:"array"}]};case"FunctionParamType":return{name:"FunctionParamType",mandatory:[{name:"array",type:"boolean"}]};case"InvocationExpr":return{name:"InvocationExpr",mandatory:[{name:"args",type:"array"}]};case"Model":return{name:"Model",mandatory:[{name:"declarations",type:"array"}]};case"ReferenceExpr":return{name:"ReferenceExpr",mandatory:[{name:"args",type:"array"}]};default:return{name:e,mandatory:[]}}}},an=new hs;var IE=St(wn()),Ll,OE=()=>Ll!=null?Ll:Ll=(0,IE.loadGrammarFromJson)(`{
3720
+ Please avoid using it as it will be completely removed in the future`)}H.clearCache=yM;var gM=Eb();Object.defineProperty(H,"createSyntaxDiagramsCode",{enumerable:!0,get:function(){return gM.createSyntaxDiagramsCode}});var vM=function(){function r(){throw new Error(`The Parser class has been deprecated, use CstParser or EmbeddedActionsParser instead.
3721
+ See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_7-0-0`)}return r}();H.Parser=vM});var Sb=C(Mr=>{"use strict";Object.defineProperty(Mr,"__esModule",{value:!0});Mr.RootCstNodeImpl=Mr.CompositeCstNodeImpl=Mr.LeafCstNodeImpl=Mr.AbstractCstNode=Mr.CstNodeBuilder=void 0;var kb=lo(),TM=_o(),xb=et(),mh=class{constructor(){this.nodeStack=[]}get current(){return this.nodeStack[this.nodeStack.length-1]}buildRootNode(e){return this.rootNode=new al(e),this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(e){let t=new us;return t.feature=e,t.root=this.rootNode,this.current.children.push(t),this.nodeStack.push(t),t}buildLeafNode(e,t){let n=new ss(e.startOffset,e.image.length,(0,xb.tokenToRange)(e),e.tokenType,!1);return n.feature=t,n.root=this.rootNode,this.current.children.push(n),n}removeNode(e){let t=e.parent;if(t){let n=t.children.indexOf(e);n>=0&&t.children.splice(n,1)}}construct(e){let t=this.current;typeof e.$type=="string"&&(this.current.element=e),e.$cstNode=t;let n=this.nodeStack.pop();n?.children.length===0&&this.removeNode(n)}addHiddenTokens(e){if(e)for(let t of e){let n=new ss(t.startOffset,t.image.length,(0,xb.tokenToRange)(t),t.tokenType,!0);n.root=this.rootNode,this.addHiddenToken(this.rootNode,n)}}addHiddenToken(e,t){let{offset:n,end:i}=t;for(let o=0;o<e.children.length;o++){let a=e.children[o],{offset:s,end:u}=a;if((0,TM.isCompositeCstNode)(a)&&n>s&&i<u){this.addHiddenToken(a,t);return}else if(i<=s){e.children.splice(o,0,t);return}}e.children.push(t)}};Mr.CstNodeBuilder=mh;var as=class{get hidden(){return!1}get element(){var e,t;let n=typeof((e=this._element)===null||e===void 0?void 0:e.$type)=="string"?this._element:(t=this.parent)===null||t===void 0?void 0:t.element;if(!n)throw new Error("This node has no associated AST element");return n}set element(e){this._element=e}get text(){return this.root.fullText.substring(this.offset,this.end)}};Mr.AbstractCstNode=as;var ss=class extends as{constructor(e,t,n,i,o=!1){super(),this._hidden=o,this._offset=e,this._tokenType=i,this._length=t,this._range=n}get offset(){return this._offset}get length(){return this._length}get end(){return this._offset+this._length}get hidden(){return this._hidden}get tokenType(){return this._tokenType}get range(){return this._range}};Mr.LeafCstNodeImpl=ss;var us=class extends as{constructor(){super(...arguments),this.children=new cs(this)}get offset(){var e,t;return(t=(e=this.firstNonHiddenNode)===null||e===void 0?void 0:e.offset)!==null&&t!==void 0?t:0}get length(){return this.end-this.offset}get end(){var e,t;return(t=(e=this.lastNonHiddenNode)===null||e===void 0?void 0:e.end)!==null&&t!==void 0?t:0}get range(){let e=this.firstNonHiddenNode,t=this.lastNonHiddenNode;if(e&&t){if(this._rangeCache===void 0){let{range:n}=e,{range:i}=t;this._rangeCache={start:n.start,end:i.end.line<n.start.line?n.start:i.end}}return this._rangeCache}else return{start:kb.Position.create(0,0),end:kb.Position.create(0,0)}}get firstNonHiddenNode(){for(let e of this.children)if(!e.hidden)return e;return this.children[0]}get lastNonHiddenNode(){for(let e=this.children.length-1;e>=0;e--){let t=this.children[e];if(!t.hidden)return t}return this.children[this.children.length-1]}};Mr.CompositeCstNodeImpl=us;var cs=class extends Array{constructor(e){super(),this.parent=e,Object.setPrototypeOf(this,cs.prototype)}push(...e){return this.addParents(e),super.push(...e)}unshift(...e){return this.addParents(e),super.unshift(...e)}splice(e,t,...n){return this.addParents(n),super.splice(e,t,...n)}addParents(e){for(let t of e)t.parent=this.parent}},al=class extends us{constructor(e){super(),this._text="",this._text=e??""}get text(){return this._text.substring(this.offset,this.end)}get fullText(){return this._text}};Mr.RootCstNodeImpl=al});var ds=C(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.isTokenTypeDictionary=mt.isIMultiModeLexerDefinition=mt.isTokenTypeArray=mt.LangiumCompletionParser=mt.LangiumParserErrorMessageProvider=mt.LangiumParser=mt.AbstractLangiumParser=mt.DatatypeSymbol=void 0;var ul=ol(),sl=ze(),Nb=Lt(),Db=Re(),RM=Sb();mt.DatatypeSymbol=Symbol("Datatype");function hh(r){return r.$type===mt.DatatypeSymbol}var ls=class{constructor(e,t){this._unorderedGroups=new Map,this.lexer=new ul.Lexer(Ob(t)?Object.values(t):t),this.wrapper=new vh(t,e.parser.ParserConfig)}alternatives(e,t){this.wrapper.wrapOr(e,t)}optional(e,t){this.wrapper.wrapOption(e,t)}many(e,t){this.wrapper.wrapMany(e,t)}atLeastOne(e,t){this.wrapper.wrapAtLeastOne(e,t)}isRecording(){return this.wrapper.IS_RECORDING}get unorderedGroups(){return this._unorderedGroups}getRuleStack(){return this.wrapper.RULE_STACK}finalize(){this.wrapper.wrapSelfAnalysis()}};mt.AbstractLangiumParser=ls;var yh=class extends ls{constructor(e,t){super(e,t),this.nodeBuilder=new RM.CstNodeBuilder,this.stack=[],this.assignmentMap=new Map,this.linker=e.references.Linker,this.converter=e.parser.ValueConverter,this.astReflection=e.shared.AstReflection}get current(){return this.stack[this.stack.length-1]}rule(e,t){let n=e.fragment?void 0:(0,Nb.isDataTypeRule)(e)?mt.DatatypeSymbol:(0,Nb.getTypeName)(e),i=this.wrapper.DEFINE_RULE(e.name,this.startImplementation(n,t).bind(this));return e.entry&&(this.mainRule=i),i}parse(e){this.nodeBuilder.buildRootNode(e);let t=this.lexer.tokenize(e);this.wrapper.input=t.tokens;let n=this.mainRule.call(this.wrapper);return this.nodeBuilder.addHiddenTokens(t.groups.hidden),this.unorderedGroups.clear(),{value:n,lexerErrors:t.errors,parserErrors:this.wrapper.errors}}startImplementation(e,t){return n=>{if(!this.isRecording()){let o={$type:e};this.stack.push(o),e===mt.DatatypeSymbol&&(o.value="")}let i;try{i=t(n)}catch{i=void 0}return!this.isRecording()&&i===void 0&&(i=this.construct()),i}}consume(e,t,n){let i=this.wrapper.wrapConsume(e,t);if(!this.isRecording()){let o=this.nodeBuilder.buildLeafNode(i,n),{assignment:a,isCrossRef:s}=this.getAssignment(n),u=this.current;if(a){let c=(0,sl.isKeyword)(n)?i.image:this.converter.convert(i.image,o);this.assign(a.operator,a.feature,c,o,s)}else if(hh(u)){let c=i.image;(0,sl.isKeyword)(n)||(c=this.converter.convert(c,o).toString()),u.value+=c}}}subrule(e,t,n,i){let o;this.isRecording()||(o=this.nodeBuilder.buildCompositeNode(n));let a=this.wrapper.wrapSubrule(e,t,i);this.isRecording()||this.performSubruleAssignment(a,n,o)}performSubruleAssignment(e,t,n){let{assignment:i,isCrossRef:o}=this.getAssignment(t);if(i&&n)this.assign(i.operator,i.feature,e,n,o);else if(!i){let a=this.current;if(hh(a))a.value+=e.toString();else{let s=e.$type,u=this.assignWithoutOverride(e,a);s&&(u.$type=s);let c=u;this.stack.pop(),this.stack.push(c)}}}action(e,t){if(!this.isRecording()){let n=this.current;if(!n.$cstNode&&t.feature&&t.operator){n=this.construct(!1);let o=n.$cstNode.feature;this.nodeBuilder.buildCompositeNode(o)}let i={$type:e};this.stack.pop(),this.stack.push(i),t.feature&&t.operator&&this.assign(t.operator,t.feature,n,n.$cstNode,!1)}}construct(e=!0){if(this.isRecording())return;let t=this.current;return(0,Db.linkContentToContainer)(t),this.nodeBuilder.construct(t),e&&this.stack.pop(),hh(t)?this.converter.convert(t.value,t.$cstNode):(this.assignMandatoryProperties(t),t)}assignMandatoryProperties(e){let t=this.astReflection.getTypeMetaData(e.$type);for(let n of t.mandatory){let i=e[n.name];n.type==="array"&&!Array.isArray(i)?e[n.name]=[]:n.type==="boolean"&&i===void 0&&(e[n.name]=!1)}}getAssignment(e){if(!this.assignmentMap.has(e)){let t=(0,Db.getContainerOfType)(e,sl.isAssignment);this.assignmentMap.set(e,{assignment:t,isCrossRef:t?(0,sl.isCrossReference)(t.terminal):!1})}return this.assignmentMap.get(e)}assign(e,t,n,i,o){let a=this.current,s;switch(o&&typeof n=="string"?s=this.linker.buildReference(a,t,i,n):s=n,e){case"=":{a[t]=s;break}case"?=":{a[t]=!0;break}case"+=":Array.isArray(a[t])||(a[t]=[]),a[t].push(s)}}assignWithoutOverride(e,t){for(let[n,i]of Object.entries(t))e[n]===void 0&&(e[n]=i);return e}get definitionErrors(){return this.wrapper.definitionErrors}};mt.LangiumParser=yh;var cl=class{buildMismatchTokenMessage({expected:e,actual:t}){return`Expecting ${e.LABEL?"`"+e.LABEL+"`":e.name.endsWith(":KW")?`keyword '${e.name.substring(0,e.name.length-3)}'`:`token of type '${e.name}'`} but found \`${t.image}\`.`}buildNotAllInputParsedMessage({firstRedundant:e}){return`Expecting end of file but found \`${e.image}\`.`}buildNoViableAltMessage(e){return ul.defaultParserErrorProvider.buildNoViableAltMessage(e)}buildEarlyExitMessage(e){return ul.defaultParserErrorProvider.buildEarlyExitMessage(e)}};mt.LangiumParserErrorMessageProvider=cl;var gh=class extends ls{constructor(){super(...arguments),this.tokens=[],this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}action(){}construct(){}parse(e){this.resetState();let t=this.lexer.tokenize(e);return this.tokens=t.tokens,this.wrapper.input=[...this.tokens],this.mainRule.call(this.wrapper),this.unorderedGroups.clear(),{tokens:this.tokens,elementStack:[...this.lastElementStack],tokenIndex:this.nextTokenIndex}}rule(e,t){let n=this.wrapper.DEFINE_RULE(e.name,this.startImplementation(t).bind(this));return e.entry&&(this.mainRule=n),n}resetState(){this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}startImplementation(e){return t=>{let n=this.keepStackSize();try{e(t)}finally{this.resetStackSize(n)}}}removeUnexpectedElements(){this.elementStack.splice(this.stackSize)}keepStackSize(){let e=this.elementStack.length;return this.stackSize=e,e}resetStackSize(e){this.removeUnexpectedElements(),this.stackSize=e}consume(e,t,n){this.wrapper.wrapConsume(e,t),this.isRecording()||(this.lastElementStack=[...this.elementStack,n],this.nextTokenIndex=this.currIdx+1)}subrule(e,t,n,i){this.before(n),this.wrapper.wrapSubrule(e,t,i),this.after(n)}before(e){this.isRecording()||this.elementStack.push(e)}after(e){if(!this.isRecording()){let t=this.elementStack.lastIndexOf(e);t>=0&&this.elementStack.splice(t)}}get currIdx(){return this.wrapper.currIdx}};mt.LangiumCompletionParser=gh;var _M={recoveryEnabled:!0,nodeLocationTracking:"full",skipValidations:!0,errorMessageProvider:new cl},vh=class extends ul.EmbeddedActionsParser{constructor(e,t){super(e,Object.assign(Object.assign({},_M),t))}get IS_RECORDING(){return this.RECORDING_PHASE}DEFINE_RULE(e,t){return this.RULE(e,t)}wrapSelfAnalysis(){this.performSelfAnalysis()}wrapConsume(e,t){return this.consume(e,t)}wrapSubrule(e,t,n){return this.subrule(e,t,{ARGS:[n]})}wrapOr(e,t){this.or(e,t)}wrapOption(e,t){this.option(e,t)}wrapMany(e,t){this.many(e,t)}wrapAtLeastOne(e,t){this.atLeastOne(e,t)}};function wb(r){return Array.isArray(r)&&(r.length===0||"name"in r[0])}mt.isTokenTypeArray=wb;function Ib(r){return r&&"modes"in r&&"defaultMode"in r}mt.isIMultiModeLexerDefinition=Ib;function Ob(r){return!wb(r)&&!Ib(r)}mt.isTokenTypeDictionary=Ob});var $b=C(Xo=>{"use strict";Object.defineProperty(Xo,"__esModule",{value:!0});Xo.assertUnreachable=Xo.ErrorWithLocation=void 0;var Th=class extends Error{constructor(e,t){super(e?`${t} at ${e.range.start.line}:${e.range.start.character}`:t)}};Xo.ErrorWithLocation=Th;function AM(r){throw new Error("Error! The input value was not handled.")}Xo.assertUnreachable=AM});var _h=C(dl=>{"use strict";Object.defineProperty(dl,"__esModule",{value:!0});dl.createParser=void 0;var Mb=ol(),qe=ze(),Lb=ds(),fs=$b(),bM=Ct(),Fb=Lt(),qb=Pt();function EM(r,e,t){let n=IM(t);return CM({parser:e,tokens:n,rules:new Map,ruleNames:new Map},r),e}dl.createParser=EM;function CM(r,e){let t=(0,qb.getAllReachableRules)(e,!1),n=(0,bM.stream)(e.rules).filter(qe.isParserRule).filter(i=>t.has(i));for(let i of n){let o=Object.assign(Object.assign({},r),{consume:1,optional:1,subrule:1,many:1,or:1});o.rules.set(i.name,r.parser.rule(i,zi(o,i.definition)))}}function zi(r,e,t=!1){let n;if((0,qe.isKeyword)(e))n=wM(r,e);else if((0,qe.isAction)(e))n=PM(r,e);else if((0,qe.isAssignment)(e))n=zi(r,e.terminal);else if((0,qe.isCrossReference)(e))n=jb(r,e);else if((0,qe.isRuleCall)(e))n=kM(r,e);else if((0,qe.isAlternatives)(e))n=SM(r,e);else if((0,qe.isUnorderedGroup)(e))n=NM(r,e);else if((0,qe.isGroup)(e))n=DM(r,e);else throw new fs.ErrorWithLocation(e.$cstNode,`Unexpected element type: ${e.$type}`);return Ub(r,t?void 0:ll(e),n,e.cardinality)}function PM(r,e){let t=(0,Fb.getTypeName)(e);return()=>r.parser.action(t,e)}function kM(r,e){let t=e.rule.ref;if((0,qe.isParserRule)(t)){let n=r.subrule++,i=e.arguments.length>0?xM(t,e.arguments):()=>({});return o=>r.parser.subrule(n,Hb(r,t),e,i(o))}else if((0,qe.isTerminalRule)(t)){let n=r.consume++,i=Rh(r,t.name);return()=>r.parser.consume(n,i,e)}else if(t)(0,fs.assertUnreachable)(t);else throw new fs.ErrorWithLocation(e.$cstNode,`Undefined rule type: ${e.$type}`)}function xM(r,e){let t=e.map(n=>Jn(n.value));return n=>{let i={};for(let o=0;o<t.length;o++){let a=r.parameters[o],s=t[o];i[a.name]=s(n)}return i}}function Jn(r){if((0,qe.isDisjunction)(r)){let e=Jn(r.left),t=Jn(r.right);return n=>e(n)||t(n)}else if((0,qe.isConjunction)(r)){let e=Jn(r.left),t=Jn(r.right);return n=>e(n)&&t(n)}else if((0,qe.isNegation)(r)){let e=Jn(r.value);return t=>!e(t)}else if((0,qe.isParameterReference)(r)){let e=r.parameter.ref.name;return t=>t!==void 0&&t[e]===!0}else if((0,qe.isLiteralCondition)(r)){let e=!!r.true;return()=>e}(0,fs.assertUnreachable)(r)}function SM(r,e){if(e.elements.length===1)return zi(r,e.elements[0]);{let t=[];for(let i of e.elements){let o={ALT:zi(r,i,!0)},a=ll(i);a&&(o.GATE=Jn(a)),t.push(o)}let n=r.or++;return i=>r.parser.alternatives(n,t.map(o=>{let a={ALT:()=>o.ALT(i)},s=o.GATE;return s&&(a.GATE=()=>s(i)),a}))}}function NM(r,e){if(e.elements.length===1)return zi(r,e.elements[0]);let t=[];for(let s of e.elements){let u={ALT:zi(r,s,!0)},c=ll(s);c&&(u.GATE=Jn(c)),t.push(u)}let n=r.or++,i=(s,u)=>{let c=u.getRuleStack().join("-");return`uGroup_${s}_${c}`},o=s=>r.parser.alternatives(n,t.map((u,c)=>{let l={ALT:()=>!0},d=r.parser;l.ALT=()=>{if(u.ALT(s),!d.isRecording()){let y=i(n,d);d.unorderedGroups.get(y)||d.unorderedGroups.set(y,[]);let p=d.unorderedGroups.get(y);typeof p?.[c]>"u"&&(p[c]=!0)}};let g=u.GATE;return g?l.GATE=()=>g(s):l.GATE=()=>{let y=d.unorderedGroups.get(i(n,d));return!y?.[c]},l})),a=Ub(r,ll(e),o,"*");return s=>{a(s),r.parser.isRecording()||r.parser.unorderedGroups.delete(i(n,r.parser))}}function DM(r,e){let t=e.elements.map(n=>zi(r,n));return n=>t.forEach(i=>i(n))}function ll(r){if((0,qe.isGroup)(r))return r.guardCondition}function jb(r,e,t=e.terminal){if(t)if((0,qe.isRuleCall)(t)&&(0,qe.isParserRule)(t.rule.ref)){let n=r.subrule++;return i=>r.parser.subrule(n,Hb(r,t.rule.ref),e,i)}else if((0,qe.isRuleCall)(t)&&(0,qe.isTerminalRule)(t.rule.ref)){let n=r.consume++,i=Rh(r,t.rule.ref.name);return()=>r.parser.consume(n,i,e)}else if((0,qe.isKeyword)(t)){let n=r.consume++,i=Rh(r,t.value);return i.name=Gb(i.name),()=>r.parser.consume(n,i,e)}else throw new Error("Could not build cross reference parser");else{if(!e.type.ref)throw new Error("Could not resolve reference to type: "+e.type.$refText);let n=(0,qb.findNameAssignment)(e.type.ref),i=n?.terminal;if(!i)throw new Error("Could not find name assignment for type: "+(0,Fb.getTypeName)(e.type.ref));return jb(r,e,i)}}var Gb=r=>r.endsWith(":KW")?r:r+":KW";function wM(r,e){let t=r.consume++,n=r.tokens[e.value];if(!n)throw new Error("Could not find token for keyword: "+e.value);return n.name=Gb(n.name),()=>r.parser.consume(t,n,e)}function Ub(r,e,t,n){let i=e&&Jn(e);if(!n)if(i){let o=r.or++;return a=>r.parser.alternatives(o,[{ALT:()=>t(a),GATE:()=>i(a)},{ALT:(0,Mb.EMPTY_ALT)(),GATE:()=>!i(a)}])}else return t;if(n==="*"){let o=r.many++;return a=>r.parser.many(o,{DEF:()=>t(a),GATE:i?()=>i(a):void 0})}else if(n==="+"){let o=r.many++;if(i){let a=r.or++;return s=>r.parser.alternatives(a,[{ALT:()=>r.parser.atLeastOne(o,{DEF:()=>t(s)}),GATE:()=>i(s)},{ALT:(0,Mb.EMPTY_ALT)(),GATE:()=>!i(s)}])}else return a=>r.parser.atLeastOne(o,{DEF:()=>t(a)})}else if(n==="?"){let o=r.optional++;return a=>r.parser.optional(o,{DEF:()=>t(a),GATE:i?()=>i(a):void 0})}else(0,fs.assertUnreachable)(n)}function IM(r){if((0,Lb.isTokenTypeDictionary)(r))return r;let e=(0,Lb.isIMultiModeLexerDefinition)(r)?Object.values(r.modes).flat():r,t={};return e.forEach(n=>t[n.name]=n),t}function Hb(r,e){let t=OM(r,e),n=r.rules.get(t);if(!n)throw new Error(`Rule "${t}" not found."`);return n}function OM(r,e){if((0,qe.isParserRule)(e))return e.name;if(r.ruleNames.has(e))return r.ruleNames.get(e);{let t=e,n=t.$container,i=e.$type;for(;!(0,qe.isParserRule)(n);)((0,qe.isGroup)(n)||(0,qe.isAlternatives)(n)||(0,qe.isUnorderedGroup)(n))&&(i=n.elements.indexOf(t).toString()+":"+i),t=n,n=n.$container;return i=n.name+":"+i,r.ruleNames.set(e,i),i}}function Rh(r,e){let t=r.tokens[e];if(!t)throw new Error(`Token "${e}" not found."`);return t}});var Wb=C(fl=>{"use strict";Object.defineProperty(fl,"__esModule",{value:!0});fl.createCompletionParser=void 0;var $M=ds(),MM=_h();function LM(r){let e=r.Grammar,t=r.parser.TokenBuilder.buildTokens(e,{caseInsensitive:r.LanguageMetaData.caseInsensitive}),n=new $M.LangiumCompletionParser(r,t);return(0,MM.createParser)(e,n,t),n.finalize(),n}fl.createCompletionParser=LM});var Ah=C(Jo=>{"use strict";Object.defineProperty(Jo,"__esModule",{value:!0});Jo.prepareLangiumParser=Jo.createLangiumParser=void 0;var FM=ds(),qM=_h();function jM(r){let e=Kb(r);return e.finalize(),e}Jo.createLangiumParser=jM;function Kb(r){let e=r.Grammar,t=r.parser.TokenBuilder.buildTokens(e,{caseInsensitive:r.LanguageMetaData.caseInsensitive}),n=new FM.LangiumParser(r,t);return(0,qM.createParser)(e,n,t)}Jo.prepareLangiumParser=Kb});var Ch=C(ml=>{"use strict";Object.defineProperty(ml,"__esModule",{value:!0});ml.DefaultTokenBuilder=void 0;var GM=ol(),bh=ze(),UM=Lt(),HM=Re(),WM=Pt(),pl=So(),KM=Ct(),Eh=class{buildTokens(e,t){let n=(0,KM.stream)((0,WM.getAllReachableRules)(e,!1)),i=this.buildTerminalTokens(n),o=this.buildKeywordTokens(n,i,t);return i.forEach(a=>{let s=a.PATTERN;typeof s=="object"&&s&&"test"in s&&(0,pl.isWhitespaceRegExp)(s)?o.unshift(a):o.push(a)}),o}buildTerminalTokens(e){return e.filter(bh.isTerminalRule).filter(t=>!t.fragment).map(t=>this.buildTerminalToken(t)).toArray()}buildTerminalToken(e){let t=(0,UM.terminalRegex)(e),n={name:e.name,PATTERN:new RegExp(t)};return e.hidden&&(n.GROUP=(0,pl.isWhitespaceRegExp)(t)?GM.Lexer.SKIPPED:"hidden"),n}buildKeywordTokens(e,t,n){return e.filter(bh.isParserRule).flatMap(i=>(0,HM.streamAllContents)(i).filter(bh.isKeyword)).distinct(i=>i.value).toArray().sort((i,o)=>o.value.length-i.value.length).map(i=>this.buildKeywordToken(i,t,!!n?.caseInsensitive))}buildKeywordToken(e,t,n){return{name:e.value,PATTERN:this.buildKeywordPattern(e,n),LONGER_ALT:this.findLongerAlt(e,t)}}buildKeywordPattern(e,t){return t?new RegExp((0,pl.getCaseInsensitivePattern)(e.value)):e.value}findLongerAlt(e,t){return t.reduce((n,i)=>{let o=i?.PATTERN;return o?.source&&(0,pl.partialMatches)("^"+o.source+"$",e.value)&&n.push(i),n},[])}};ml.DefaultTokenBuilder=Eh});var xh=C(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.convertBoolean=wt.convertNumber=wt.convertDate=wt.convertBigint=wt.convertInt=wt.convertID=wt.convertString=wt.DefaultValueConverter=void 0;var Bb=ze(),BM=Lt(),zM=Pt(),Ph=class{convert(e,t){let n=t.feature;if((0,Bb.isCrossReference)(n)&&(n=(0,zM.getCrossReferenceTerminal)(n)),(0,Bb.isRuleCall)(n)){let i=n.rule.ref;if(!i)throw new Error("This cst node was not parsed by a rule.");return this.runConverter(i,e,t)}return e}runConverter(e,t,n){var i;switch(e.name.toUpperCase()){case"INT":return Vb(t);case"STRING":return kh(t);case"ID":return zb(t);case"REGEXLITERAL":return kh(t)}switch((i=(0,BM.getRuleType)(e))===null||i===void 0?void 0:i.toLowerCase()){case"number":return Jb(t);case"boolean":return Zb(t);case"bigint":return Yb(t);case"date":return Xb(t);default:return t}}};wt.DefaultValueConverter=Ph;function kh(r){return r.substring(1,r.length-1)}wt.convertString=kh;function zb(r){return r.charAt(0)==="^"?r.substring(1):r}wt.convertID=zb;function Vb(r){return parseInt(r)}wt.convertInt=Vb;function Yb(r){return BigInt(r)}wt.convertBigint=Yb;function Xb(r){return new Date(r)}wt.convertDate=Xb;function Jb(r){return Number(r)}wt.convertNumber=Jb;function Zb(r){return r.toLowerCase()==="true"}wt.convertBoolean=Zb});var Nh=C(hl=>{"use strict";Object.defineProperty(hl,"__esModule",{value:!0});hl.DefaultLinker=void 0;var VM=we(),Zn=Re(),YM=Yr(),Qb=Gi(),Sh=class{constructor(e){this.reflection=e.shared.AstReflection,this.langiumDocuments=()=>e.shared.workspace.LangiumDocuments,this.scopeProvider=e.references.ScopeProvider,this.astNodeLocator=e.workspace.AstNodeLocator}async link(e,t=VM.CancellationToken.None){for(let n of(0,Zn.streamAst)(e.parseResult.value))await(0,YM.interruptAndCheck)(t),(0,Zn.streamReferences)(n).forEach(i=>this.doLink(i,e));e.state=Qb.DocumentState.Linked}doLink(e,t){let n=e.reference;if(n._ref===void 0)try{let i=this.getCandidate(e);if((0,Zn.isLinkingError)(i))n._ref=i;else if(n._nodeDescription=i,this.langiumDocuments().hasDocument(i.documentUri)){let o=this.loadAstNode(i);n._ref=o??this.createLinkingError(e,i)}}catch(i){n._ref=Object.assign(Object.assign({},e),{message:`An error occurred while resolving reference to '${n.$refText}': ${i}`})}t.references.push(n)}unlink(e){for(let t of e.references)delete t._ref,delete t._nodeDescription;e.references=[]}getCandidate(e){let n=this.scopeProvider.getScope(e).getElement(e.reference.$refText);return n??this.createLinkingError(e)}buildReference(e,t,n,i){let o=this,a={$refNode:n,$refText:i,get ref(){var s;if((0,Zn.isAstNode)(this._ref))return this._ref;if((0,Zn.isAstNodeDescription)(this._nodeDescription)){let u=o.loadAstNode(this._nodeDescription);this._ref=u??o.createLinkingError({reference:a,container:e,property:t},this._nodeDescription)}else if(this._ref===void 0){let u=o.getLinkedNode({reference:a,container:e,property:t});this._ref=(s=u.node)!==null&&s!==void 0?s:u.error,this._nodeDescription=u.descr}return(0,Zn.isAstNode)(this._ref)?this._ref:void 0},get $nodeDescription(){return this._nodeDescription},get error(){return(0,Zn.isLinkingError)(this._ref)?this._ref:void 0}};return a}getLinkedNode(e){try{let t=this.getCandidate(e);if((0,Zn.isLinkingError)(t))return{error:t};let n=this.loadAstNode(t);return n?{node:n,descr:t}:{descr:t,error:this.createLinkingError(e,t)}}catch(t){return{error:Object.assign(Object.assign({},e),{message:`An error occurred while resolving reference to '${e.reference.$refText}': ${t}`})}}}loadAstNode(e){if(e.node)return e.node;let t=this.langiumDocuments().getOrCreateDocument(e.documentUri);return this.astNodeLocator.getAstNode(t,e.path)}createLinkingError(e,t){let n=(0,Zn.getDocument)(e.container);n.state<Qb.DocumentState.ComputedScopes&&console.warn(`Attempted reference resolution before document reached ComputedScopes state (${n.uri}).`);let i=this.reflection.getReferenceType(e);return Object.assign(Object.assign({},e),{message:`Could not resolve reference to ${i} named '${e.reference.$refText}'.`,targetDescription:t})}};hl.DefaultLinker=Sh});var wh=C(gl=>{"use strict";Object.defineProperty(gl,"__esModule",{value:!0});gl.DefaultJsonSerializer=void 0;var yl=Re(),Dh=class{constructor(e){this.ignoreProperties=["$container","$containerProperty","$containerIndex","$document","$cstNode"],this.linker=e.references.Linker}serialize(e,t){return JSON.stringify(this.decycle(e,this.ignoreProperties),void 0,t)}deserialize(e){return this.revive(JSON.parse(e))}decycle(e,t){let n=new Set,i=o=>{if(typeof o=="object"&&o!==null){if(n.has(o))throw new Error("Cycle in ast detected.");if(n.add(o),(0,yl.isReference)(o))return{$refText:o.$refText};let a;if(Array.isArray(o)){a=[];for(let s=0;s<o.length;s++)a[s]=i(o[s])}else{a={};for(let[s,u]of Object.entries(o))t.includes(s)||(a[s]=i(u))}return a}return o};return i(e)}revive(e){let t=(n,i,o)=>{if(Array.isArray(n))for(let a=0;a<n.length;a++){let s=n[a];if((0,yl.isReference)(s)&&(0,yl.isAstNode)(i)){let u=this.linker.buildReference(i,o,s.$refNode,s.$refText);n[a]=u}else typeof s=="object"&&s!==null&&(t(s),s.$container=i,s.$containerProperty=o,s.$containerIndex=a)}else if(typeof n=="object"&&n!==null){for(let[a,s]of Object.entries(n))if(typeof s=="object"&&s!==null)if((0,yl.isReference)(s)){let u=this.linker.buildReference(n,a,s.$refNode,s.$refText);n[a]=u}else Array.isArray(s)?t(s,n,a):(t(s),s.$container=n,s.$containerProperty=a)}};return t(e),e}};gl.DefaultJsonSerializer=Dh});var Oh=C(vl=>{"use strict";Object.defineProperty(vl,"__esModule",{value:!0});vl.DefaultServiceRegistry=void 0;var XM=vn(),Ih=class{register(e){if(!this.singleton&&!this.map){this.singleton=e;return}if(!this.map&&(this.map={},this.singleton)){for(let t of this.singleton.LanguageMetaData.fileExtensions)this.map[t]=this.singleton;this.singleton=void 0}for(let t of e.LanguageMetaData.fileExtensions)this.map[t]!==void 0&&this.map[t]!==e&&console.warn(`The file extension ${t} is used by multiple languages. It is now assigned to '${e.LanguageMetaData.languageId}'.`),this.map[t]=e}getServices(e){if(this.singleton!==void 0)return this.singleton;if(this.map===void 0)throw new Error("The service registry is empty. Use `register` to register the services of a language.");let t=XM.Utils.extname(e),n=this.map[t];if(!n)throw new Error(`The service registry contains no services for the extension '${t}'.`);return n}get all(){return this.singleton!==void 0?[this.singleton]:this.map!==void 0?Object.values(this.map):[]}};vl.DefaultServiceRegistry=Ih});var Lh=C(Zo=>{"use strict";Object.defineProperty(Zo,"__esModule",{value:!0});Zo.DefaultReferenceDescriptionProvider=Zo.DefaultAstNodeDescriptionProvider=void 0;var JM=we(),ps=Re(),ZM=et(),QM=Yr(),eL=hi(),$h=class{constructor(e){this.astNodeLocator=e.workspace.AstNodeLocator}createDescription(e,t,n=(0,ps.getDocument)(e)){return{node:e,name:t,type:e.$type,documentUri:n.uri,path:this.astNodeLocator.getAstNodePath(e)}}createDescriptions(){throw new Error("Deprecated: This method has been moved to the `ScopeComputation` service and renamed to `computeExports`.")}};Zo.DefaultAstNodeDescriptionProvider=$h;var Mh=class{constructor(e){this.nodeLocator=e.workspace.AstNodeLocator}async createDescriptions(e,t=JM.CancellationToken.None){let n=[],i=e.parseResult.value;for(let o of(0,ps.streamAst)(i))await(0,QM.interruptAndCheck)(t),(0,ps.streamReferences)(o).filter(a=>!(0,ps.isLinkingError)(a)).forEach(a=>{let s=a.reference.$nodeDescription;s&&n.push(this.createDescription(a,s))});return n}createDescription(e,t){let n=(0,ps.getDocument)(e.container).uri,i=e.reference.$refNode;return{sourceUri:n,sourcePath:this.nodeLocator.getAstNodePath(e.container),targetUri:t.documentUri,targetPath:t.path,segment:(0,ZM.toDocumentSegment)(i),local:(0,eL.equalURI)(t.documentUri,n)}}};Zo.DefaultReferenceDescriptionProvider=Mh});var eE=C(Tl=>{"use strict";Object.defineProperty(Tl,"__esModule",{value:!0});Tl.DefaultAstNodeLocator=void 0;var Fh=class{constructor(){this.segmentSeparator="/",this.indexSeparator="@"}getAstNodePath(e){if(e.$container){let t=this.getAstNodePath(e.$container),n=this.getPathSegment(e);return t+this.segmentSeparator+n}return""}getPathSegment({$containerProperty:e,$containerIndex:t}){if(!e)throw new Error("Missing '$containerProperty' in AST node.");return t!==void 0?e+this.indexSeparator+t:e}getAstNode(e,t){return t.split(this.segmentSeparator).reduce((i,o)=>{if(!i||o.length===0)return i;let a=o.indexOf(this.indexSeparator);if(a>0){let s=o.substring(0,a),u=parseInt(o.substring(a+1));return i[s][u]}return i[o]},e.parseResult.value)}};Tl.DefaultAstNodeLocator=Fh});var jh=C(Rl=>{"use strict";Object.defineProperty(Rl,"__esModule",{value:!0});Rl.DefaultConfigurationProvider=void 0;var tL=Tt(),qh=class{constructor(e){this.settings={},this.workspaceConfig=!1,this.initialized=!1,this.serviceRegistry=e.ServiceRegistry,this.connection=e.lsp.Connection,e.lsp.LanguageServer.onInitialize(t=>{var n,i;this.workspaceConfig=(i=(n=t.capabilities.workspace)===null||n===void 0?void 0:n.configuration)!==null&&i!==void 0?i:!1}),e.lsp.LanguageServer.onInitialized(t=>{var n;let i=this.serviceRegistry.all;(n=e.lsp.Connection)===null||n===void 0||n.client.register(tL.DidChangeConfigurationNotification.type,{section:i.map(o=>this.toSectionName(o.LanguageMetaData.languageId))})})}async initialize(){if(this.workspaceConfig&&this.connection){let t=this.serviceRegistry.all.map(i=>({section:this.toSectionName(i.LanguageMetaData.languageId)})),n=await this.connection.workspace.getConfiguration(t);t.forEach((i,o)=>{this.updateSectionConfiguration(i.section,n[o])})}this.initialized=!0}updateConfiguration(e){!e.settings||Object.keys(e.settings).forEach(t=>{this.updateSectionConfiguration(t,e.settings[t])})}updateSectionConfiguration(e,t){this.settings[e]=t}async getConfiguration(e,t){this.initialized||await this.initialize();let n=this.toSectionName(e);if(this.settings[n])return this.settings[n][t]}toSectionName(e){return`${e}`}};Rl.DefaultConfigurationProvider=qh});var Hh=C(Al=>{"use strict";Object.defineProperty(Al,"__esModule",{value:!0});Al.DefaultDocumentBuilder=void 0;var _l=we(),rL=kr(),Gh=Yr(),Qn=Gi(),Uh=class{constructor(e){this.updateListeners=[],this.buildPhaseListeners=new rL.MultiMap,this.langiumDocuments=e.workspace.LangiumDocuments,this.indexManager=e.workspace.IndexManager,this.serviceRegistry=e.ServiceRegistry}async build(e,t={},n=_l.CancellationToken.None){await this.buildDocuments(e,t,n)}async update(e,t,n=_l.CancellationToken.None){for(let s of t)this.langiumDocuments.invalidateDocument(s);this.indexManager.remove(t);for(let s of e)this.langiumDocuments.invalidateDocument(s);for(let s of this.updateListeners)s(e,t);await(0,Gh.interruptAndCheck)(n);let i=e.map(s=>this.langiumDocuments.getOrCreateDocument(s)),o=this.collectDocuments(i,t),a={validationChecks:"all"};await this.buildDocuments(o,a,n)}onUpdate(e){return this.updateListeners.push(e),_l.Disposable.create(()=>{let t=this.updateListeners.indexOf(e);t>=0&&this.updateListeners.splice(t,1)})}collectDocuments(e,t){let n=e.map(a=>a.uri).concat(t),i=this.indexManager.getAffectedDocuments(n).toArray();i.forEach(a=>{this.serviceRegistry.getServices(a.uri).references.Linker.unlink(a),a.state=Math.min(a.state,Qn.DocumentState.ComputedScopes)});let o=new Set([...e,...i,...this.langiumDocuments.all.filter(a=>a.state<Qn.DocumentState.Validated)]);return Array.from(o)}async buildDocuments(e,t,n){await this.runCancelable(e,Qn.DocumentState.IndexedContent,n,o=>this.indexManager.updateContent(o,n)),await this.runCancelable(e,Qn.DocumentState.ComputedScopes,n,o=>this.computeScopes(o,n)),await this.runCancelable(e,Qn.DocumentState.Linked,n,o=>this.serviceRegistry.getServices(o.uri).references.Linker.link(o,n)),await this.runCancelable(e,Qn.DocumentState.IndexedReferences,n,o=>this.indexManager.updateReferences(o,n));let i=e.filter(o=>this.shouldValidate(o,t));await this.runCancelable(i,Qn.DocumentState.Validated,n,o=>this.validate(o,n))}async runCancelable(e,t,n,i){let o=e.filter(a=>a.state<t);for(let a of o)await(0,Gh.interruptAndCheck)(n),await i(a);await this.notifyBuildPhase(o,t,n)}onBuildPhase(e,t){return this.buildPhaseListeners.add(e,t),_l.Disposable.create(()=>{this.buildPhaseListeners.delete(e,t)})}async notifyBuildPhase(e,t,n){if(e.length===0)return;let i=this.buildPhaseListeners.get(t);for(let o of i)await(0,Gh.interruptAndCheck)(n),await o(e,n)}async computeScopes(e,t){let n=this.serviceRegistry.getServices(e.uri).references.ScopeComputation;e.precomputedScopes=await n.computeLocalScopes(e,t),e.state=Qn.DocumentState.ComputedScopes}shouldValidate(e,t){return t.validationChecks==="all"}async validate(e,t){let i=await this.serviceRegistry.getServices(e.uri).validation.DocumentValidator.validateDocument(e,t);e.diagnostics=i,e.state=Qn.DocumentState.Validated}};Al.DefaultDocumentBuilder=Uh});var zh=C(bl=>{"use strict";Object.defineProperty(bl,"__esModule",{value:!0});bl.DefaultIndexManager=void 0;var tE=we(),nL=Re(),Wh=Ct(),Kh=hi(),rE=Gi(),Bh=class{constructor(e){this.simpleIndex=new Map,this.referenceIndex=new Map,this.globalScopeCache=new Map,this.serviceRegistry=e.ServiceRegistry,this.astReflection=e.AstReflection,this.langiumDocuments=()=>e.workspace.LangiumDocuments}findAllReferences(e,t){let n=(0,nL.getDocument)(e).uri,i=[];return this.referenceIndex.forEach(o=>{o.forEach(a=>{(0,Kh.equalURI)(a.targetUri,n)&&a.targetPath===t&&i.push(a)})}),(0,Wh.stream)(i)}allElements(e=""){this.globalScopeCache.has("")||this.globalScopeCache.set("",Array.from(this.simpleIndex.values()).flat());let t=this.globalScopeCache.get(e);if(t)return(0,Wh.stream)(t);{let n=this.globalScopeCache.get("").filter(i=>this.astReflection.isSubtype(i.type,e));return this.globalScopeCache.set(e,n),(0,Wh.stream)(n)}}remove(e){for(let t of e){let n=t.toString();this.simpleIndex.delete(n),this.referenceIndex.delete(n)}}async updateContent(e,t=tE.CancellationToken.None){this.globalScopeCache.clear();let i=await this.serviceRegistry.getServices(e.uri).references.ScopeComputation.computeExports(e,t);for(let o of i)o.node=void 0;this.simpleIndex.set(e.uri.toString(),i),e.state=rE.DocumentState.IndexedContent}async updateReferences(e,t=tE.CancellationToken.None){let i=await this.serviceRegistry.getServices(e.uri).workspace.ReferenceDescriptionProvider.createDescriptions(e,t);this.referenceIndex.set(e.uri.toString(),i),e.state=rE.DocumentState.IndexedReferences}getAffectedDocuments(e){return this.langiumDocuments().all.filter(t=>{if(e.some(n=>(0,Kh.equalURI)(t.uri,n)))return!1;for(let n of e)if(this.isAffected(t,n))return!0;return!1})}isAffected(e,t){let n=t.toString(),i=e.uri.toString();if(e.references.some(a=>a.error!==void 0))return!0;let o=this.referenceIndex.get(i);return o?o.filter(a=>!a.local).some(a=>(0,Kh.equalURI)(a.targetUri,n)):!1}};bl.DefaultIndexManager=Bh});var Xh=C(El=>{"use strict";Object.defineProperty(El,"__esModule",{value:!0});El.DefaultWorkspaceManager=void 0;var iL=we(),Vh=vn(),oL=Yr(),Yh=class{constructor(e){this.serviceRegistry=e.ServiceRegistry,this.langiumDocuments=e.workspace.LangiumDocuments,this.documentBuilder=e.workspace.DocumentBuilder,this.fileSystemProvider=e.workspace.FileSystemProvider,this.mutex=e.workspace.MutexLock,e.lsp.LanguageServer.onInitialize(t=>{var n;this.folders=(n=t.workspaceFolders)!==null&&n!==void 0?n:void 0}),e.lsp.LanguageServer.onInitialized(t=>{this.mutex.lock(n=>{var i;return this.initializeWorkspace((i=this.folders)!==null&&i!==void 0?i:[],n)})})}async initializeWorkspace(e,t=iL.CancellationToken.None){let n=this.serviceRegistry.all.flatMap(a=>a.LanguageMetaData.fileExtensions),i=[],o=a=>{i.push(a),this.langiumDocuments.hasDocument(a.uri)||this.langiumDocuments.addDocument(a)};await this.loadAdditionalDocuments(e,o),await Promise.all(e.map(a=>[a,this.getRootFolder(a)]).map(async a=>this.traverseFolder(...a,n,o))),await(0,oL.interruptAndCheck)(t),await this.documentBuilder.build(i,void 0,t)}loadAdditionalDocuments(e,t){return Promise.resolve()}getRootFolder(e){return Vh.URI.parse(e.uri)}async traverseFolder(e,t,n,i){let o=await this.fileSystemProvider.readDirectory(t);await Promise.all(o.map(async a=>{if(this.includeEntry(e,a,n)){if(a.isDirectory)await this.traverseFolder(e,a.uri,n,i);else if(a.isFile){let s=this.langiumDocuments.getOrCreateDocument(a.uri);i(s)}}}))}includeEntry(e,t,n){let i=Vh.Utils.basename(t.uri);if(i.startsWith("."))return!1;if(t.isDirectory)return i!=="node_modules"&&i!=="out";if(t.isFile){let o=Vh.Utils.extname(t.uri);return n.includes(o)}return!1}};El.DefaultWorkspaceManager=Yh});var Rc=C(Qo=>{"use strict";Object.defineProperty(Qo,"__esModule",{value:!0});Qo.createDefaultSharedModule=Qo.createDefaultModule=void 0;var aL=we(),sL=gu(),uL=QR(),cL=Wb(),lL=Yp(),dL=Jp(),fL=Qp(),pL=Bu(),mL=rm(),hL=im(),yL=mm(),gL=ym(),vL=vm(),TL=Ah(),RL=Ch(),_L=xh(),AL=Nh(),bL=Io(),EL=Gp(),CL=xu(),PL=Nu(),kL=wh(),xL=Oh(),SL=Yr(),NL=Wu(),DL=Lu(),nE=Lh(),wL=eE(),IL=jh(),OL=Hh(),Jh=Gi(),$L=zh(),ML=Xh();function LL(r){return{parser:{GrammarConfig:e=>(0,uL.createGrammarConfig)(e),LangiumParser:e=>(0,TL.createLangiumParser)(e),CompletionParser:e=>(0,cL.createCompletionParser)(e),ValueConverter:()=>new _L.DefaultValueConverter,TokenBuilder:()=>new RL.DefaultTokenBuilder},lsp:{CompletionProvider:e=>new lL.DefaultCompletionProvider(e),DocumentSymbolProvider:e=>new fL.DefaultDocumentSymbolProvider(e),HoverProvider:e=>new hL.MultilineCommentHoverProvider(e),FoldingRangeProvider:e=>new pL.DefaultFoldingRangeProvider(e),ReferencesProvider:e=>new gL.DefaultReferencesProvider(e),DefinitionProvider:e=>new mL.DefaultDefinitionProvider(e),DocumentHighlightProvider:e=>new dL.DefaultDocumentHighlightProvider(e),RenameProvider:e=>new vL.DefaultRenameProvider(e)},workspace:{AstNodeLocator:()=>new wL.DefaultAstNodeLocator,AstNodeDescriptionProvider:e=>new nE.DefaultAstNodeDescriptionProvider(e),ReferenceDescriptionProvider:e=>new nE.DefaultReferenceDescriptionProvider(e)},references:{Linker:e=>new AL.DefaultLinker(e),NameProvider:()=>new bL.DefaultNameProvider,ScopeProvider:e=>new PL.DefaultScopeProvider(e),ScopeComputation:e=>new CL.DefaultScopeComputation(e),References:e=>new EL.DefaultReferences(e)},serializer:{JsonSerializer:e=>new kL.DefaultJsonSerializer(e)},validation:{DocumentValidator:e=>new NL.DefaultDocumentValidator(e),ValidationRegistry:e=>new DL.ValidationRegistry(e)},shared:()=>r.shared}}Qo.createDefaultModule=LL;function FL(r){return{ServiceRegistry:()=>new xL.DefaultServiceRegistry,lsp:{Connection:()=>r.connection,LanguageServer:e=>new yL.DefaultLanguageServer(e)},workspace:{LangiumDocuments:e=>new Jh.DefaultLangiumDocuments(e),LangiumDocumentFactory:e=>new Jh.DefaultLangiumDocumentFactory(e),DocumentBuilder:e=>new OL.DefaultDocumentBuilder(e),TextDocuments:()=>new aL.TextDocuments(sL.TextDocument),TextDocumentFactory:e=>new Jh.DefaultTextDocumentFactory(e),IndexManager:e=>new $L.DefaultIndexManager(e),WorkspaceManager:e=>new ML.DefaultWorkspaceManager(e),FileSystemProvider:e=>r.fileSystemProvider(e),MutexLock:()=>new SL.MutexLock,ConfigurationProvider:e=>new IL.DefaultConfigurationProvider(e)}}}Qo.createDefaultSharedModule=FL});var iE=C(Cl=>{"use strict";Object.defineProperty(Cl,"__esModule",{value:!0});Cl.s=void 0;var qL=/^(s*\n)+/,jL=/\n/g,GL=/\S|$/;function UL(r,...e){let t=e.reduce((i,o,a)=>i+HL(String(o),i)+r[a+1],r[0]).split(`
3722
+ `).map(i=>i.trimRight()),n=WL(t);return t.map(i=>i.slice(n).trimRight()).join(`
3723
+ `).trimRight().replace(qL,"")}Cl.s=UL;function HL(r,e){let t=Math.max(0,e.length-e.lastIndexOf(`
3724
+ `)-1),n=" ".repeat(t);return r.replace(jL,`
3725
+ `+n)}function WL(r){let e=r.filter(n=>n.length>0).map(n=>n.search(GL)),t=e.length===0?0:Math.min(...e);return Math.max(0,t)}});var aE=C(oE=>{"use strict";Object.defineProperty(oE,"__esModule",{value:!0})});var uE=C(sE=>{"use strict";Object.defineProperty(sE,"__esModule",{value:!0})});var lE=C(cE=>{"use strict";Object.defineProperty(cE,"__esModule",{value:!0})});var ei=C(Z=>{"use strict";var dE=Z&&Z.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),KL=Z&&Z.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),oe=Z&&Z.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&dE(e,r,t)},BL=Z&&Z.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&dE(e,r,t);return KL(e,r),e};Object.defineProperty(Z,"__esModule",{value:!0});Z.GrammarAST=void 0;oe(Rc(),Z);oe(xa(),Z);oe(Iu(),Z);oe(zf(),Z);oe(iE(),Z);oe(xm(),Z);oe(Tc(),Z);oe(aE(),Z);oe(Rm(),Z);oe(ds(),Z);oe(Ah(),Z);oe(uE(),Z);oe(Ch(),Z);oe(xh(),Z);oe(Nh(),Z);oe(Io(),Z);oe(xu(),Z);oe(Nu(),Z);oe(wh(),Z);oe(Oh(),Z);oe(lE(),Z);oe(_o(),Z);oe(Re(),Z);oe(kr(),Z);oe(et(),Z);oe(Pt(),Z);oe(Yr(),Z);oe(hi(),Z);oe(So(),Z);oe(Ct(),Z);oe(Wu(),Z);oe(Lu(),Z);oe(Lh(),Z);oe(Hh(),Z);oe(Gi(),Z);oe(zh(),Z);oe(Au(),Z);oe(Xh(),Z);oe(jh(),Z);var zL=BL(ze());Z.GrammarAST=zL});var fE=C(Ai=>{"use strict";var VL=Ai&&Ai.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ai,"__esModule",{value:!0});Ai.NodeFileSystem=Ai.NodeFileSystemProvider=void 0;var Zh=VL(require("fs")),YL=vn(),Pl=class{constructor(){this.encoding="utf-8"}readFile(e){return Zh.default.promises.readFile(e.fsPath,this.encoding)}readFileSync(e){return Zh.default.readFileSync(e.fsPath,this.encoding)}async readDirectory(e){return(await Zh.default.promises.readdir(e.fsPath,{withFileTypes:!0})).map(n=>({dirent:n,isFile:n.isFile(),isDirectory:n.isDirectory(),uri:YL.Utils.joinPath(e,n.name)}))}};Ai.NodeFileSystemProvider=Pl;Ai.NodeFileSystem={fileSystemProvider:()=>new Pl}});var pE=C(Vi=>{"use strict";var XL=Vi&&Vi.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),JL=Vi&&Vi.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&XL(e,r,t)};Object.defineProperty(Vi,"__esModule",{value:!0});JL(fE(),Vi)});var hE=C((eG,mE)=>{mE.exports=pE()});var gE=C((tG,yE)=>{"use strict";yE.exports=we()});var FE=C((sy,uy)=>{(function(r,e){typeof require=="function"&&typeof sy=="object"&&typeof uy=="object"?uy.exports=e():typeof define=="function"&&define.amd?define(function(){return e()}):r.pluralize=e()})(sy,function(){var r=[],e=[],t={},n={},i={};function o(y){return typeof y=="string"?new RegExp("^"+y+"$","i"):y}function a(y,p){return y===p?p:y===y.toLowerCase()?p.toLowerCase():y===y.toUpperCase()?p.toUpperCase():y[0]===y[0].toUpperCase()?p.charAt(0).toUpperCase()+p.substr(1).toLowerCase():p.toLowerCase()}function s(y,p){return y.replace(/\$(\d{1,2})/g,function(A,x){return p[x]||""})}function u(y,p){return y.replace(p[0],function(A,x){var k=s(p[1],arguments);return a(A===""?y[x-1]:A,k)})}function c(y,p,A){if(!y.length||t.hasOwnProperty(y))return p;for(var x=A.length;x--;){var k=A[x];if(k[0].test(p))return u(p,k)}return p}function l(y,p,A){return function(x){var k=x.toLowerCase();return p.hasOwnProperty(k)?a(x,k):y.hasOwnProperty(k)?a(x,y[k]):c(k,x,A)}}function d(y,p,A,x){return function(k){var _=k.toLowerCase();return p.hasOwnProperty(_)?!0:y.hasOwnProperty(_)?!1:c(_,_,A)===_}}function g(y,p,A){var x=p===1?g.singular(y):g.plural(y);return(A?p+" ":"")+x}return g.plural=l(i,n,r),g.isPlural=d(i,n,r),g.singular=l(n,i,e),g.isSingular=d(n,i,e),g.addPluralRule=function(y,p){r.push([o(y),p])},g.addSingularRule=function(y,p){e.push([o(y),p])},g.addUncountableRule=function(y){if(typeof y=="string"){t[y.toLowerCase()]=!0;return}g.addPluralRule(y,"$0"),g.addSingularRule(y,"$0")},g.addIrregularRule=function(y,p){p=p.toLowerCase(),y=y.toLowerCase(),i[y]=p,n[p]=y},[["I","we"],["me","us"],["he","they"],["she","they"],["them","them"],["myself","ourselves"],["yourself","yourselves"],["itself","themselves"],["herself","themselves"],["himself","themselves"],["themself","themselves"],["is","are"],["was","were"],["has","have"],["this","these"],["that","those"],["echo","echoes"],["dingo","dingoes"],["volcano","volcanoes"],["tornado","tornadoes"],["torpedo","torpedoes"],["genus","genera"],["viscus","viscera"],["stigma","stigmata"],["stoma","stomata"],["dogma","dogmata"],["lemma","lemmata"],["schema","schemata"],["anathema","anathemata"],["ox","oxen"],["axe","axes"],["die","dice"],["yes","yeses"],["foot","feet"],["eave","eaves"],["goose","geese"],["tooth","teeth"],["quiz","quizzes"],["human","humans"],["proof","proofs"],["carve","carves"],["valve","valves"],["looey","looies"],["thief","thieves"],["groove","grooves"],["pickaxe","pickaxes"],["passerby","passersby"]].forEach(function(y){return g.addIrregularRule(y[0],y[1])}),[[/s?$/i,"s"],[/[^\u0000-\u007F]$/i,"$0"],[/([^aeiou]ese)$/i,"$1"],[/(ax|test)is$/i,"$1es"],[/(alias|[^aou]us|t[lm]as|gas|ris)$/i,"$1es"],[/(e[mn]u)s?$/i,"$1s"],[/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i,"$1"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1i"],[/(alumn|alg|vertebr)(?:a|ae)$/i,"$1ae"],[/(seraph|cherub)(?:im)?$/i,"$1im"],[/(her|at|gr)o$/i,"$1oes"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i,"$1a"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i,"$1a"],[/sis$/i,"ses"],[/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i,"$1$2ves"],[/([^aeiouy]|qu)y$/i,"$1ies"],[/([^ch][ieo][ln])ey$/i,"$1ies"],[/(x|ch|ss|sh|zz)$/i,"$1es"],[/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i,"$1ices"],[/\b((?:tit)?m|l)(?:ice|ouse)$/i,"$1ice"],[/(pe)(?:rson|ople)$/i,"$1ople"],[/(child)(?:ren)?$/i,"$1ren"],[/eaux$/i,"$0"],[/m[ae]n$/i,"men"],["thou","you"]].forEach(function(y){return g.addPluralRule(y[0],y[1])}),[[/s$/i,""],[/(ss)$/i,"$1"],[/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i,"$1fe"],[/(ar|(?:wo|[ae])l|[eo][ao])ves$/i,"$1f"],[/ies$/i,"y"],[/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i,"$1ie"],[/\b(mon|smil)ies$/i,"$1ey"],[/\b((?:tit)?m|l)ice$/i,"$1ouse"],[/(seraph|cherub)im$/i,"$1"],[/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i,"$1"],[/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i,"$1sis"],[/(movie|twelve|abuse|e[mn]u)s$/i,"$1"],[/(test)(?:is|es)$/i,"$1is"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1us"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i,"$1um"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i,"$1on"],[/(alumn|alg|vertebr)ae$/i,"$1a"],[/(cod|mur|sil|vert|ind)ices$/i,"$1ex"],[/(matr|append)ices$/i,"$1ix"],[/(pe)(rson|ople)$/i,"$1rson"],[/(child)ren$/i,"$1"],[/(eau)x?$/i,"$1"],[/men$/i,"man"]].forEach(function(y){return g.addSingularRule(y[0],y[1])}),["adulthood","advice","agenda","aid","aircraft","alcohol","ammo","analytics","anime","athletics","audio","bison","blood","bream","buffalo","butter","carp","cash","chassis","chess","clothing","cod","commerce","cooperation","corps","debris","diabetes","digestion","elk","energy","equipment","excretion","expertise","firmware","flounder","fun","gallows","garbage","graffiti","hardware","headquarters","health","herpes","highjinks","homework","housework","information","jeans","justice","kudos","labour","literature","machinery","mackerel","mail","media","mews","moose","music","mud","manga","news","only","personnel","pike","plankton","pliers","police","pollution","premises","rain","research","rice","salmon","scissors","series","sewage","shambles","shrimp","software","species","staff","swine","tennis","traffic","transportation","trout","tuna","wealth","welfare","whiting","wildebeest","wildlife","you",/pok[eé]mon$/i,/[^aeiou]ese$/i,/deer$/i,/fish$/i,/measles$/i,/o[iu]s$/i,/pox$/i,/sheep$/i].forEach(g.addUncountableRule),g})});var zE=Ht(ei()),VE=Ht(hE()),Hl=Ht(gE());var st=Ht(ei());var _E=Ht(ei()),vE="AbstractDeclaration";var ZL="Expression";var TE="ReferenceTarget";var kl="TypeDeclaration";var xl="ArrayExpr";function AE(r){return an.isInstance(r,xl)}var ms="Attribute";function bE(r){return an.isInstance(r,ms)}var EE="AttributeArg";var Sl="BinaryExpr";function CE(r){return an.isInstance(r,Sl)}var PE="DataModel";function bi(r){return an.isInstance(r,PE)}var Qh="DataModelField";function ea(r){return an.isInstance(r,Qh)}var kE="DataSource";function xE(r){return an.isInstance(r,kE)}var QL="Enum";var Nl="EnumField";function SE(r){return an.isInstance(r,Nl)}var RE="Function";var eF="FunctionParam";var Dl="InvocationExpr";function wl(r){return an.isInstance(r,Dl)}var Il="LiteralExpr";function Ol(r){return an.isInstance(r,Il)}var ey="MemberAccessExpr";var tF="Model";function NE(r){return an.isInstance(r,tF)}var ty="NullExpr";var $l="ReferenceExpr";function ry(r){return an.isInstance(r,$l)}var ny="ThisExpr";var iy="UnaryExpr";var hs=class{getAllTypes(){return["AbstractDeclaration","Argument","ArrayExpr","Attribute","AttributeArg","AttributeAttribute","AttributeParam","AttributeParamType","BinaryExpr","DataModel","DataModelAttribute","DataModelField","DataModelFieldAttribute","DataModelFieldType","DataSource","DataSourceField","Enum","EnumField","Expression","Function","FunctionParam","FunctionParamType","InvocationExpr","LiteralExpr","MemberAccessExpr","Model","NullExpr","ReferenceArg","ReferenceExpr","ReferenceTarget","ThisExpr","TypeDeclaration","UnaryExpr"]}isInstance(e,t){return(0,_E.isAstNode)(e)&&this.isSubtype(e.$type,t)}isSubtype(e,t){if(e===t)return!0;switch(e){case xl:case Sl:case Dl:case Il:case ey:case ty:case $l:case ny:case iy:return this.isSubtype(ZL,t);case ms:case kE:case RE:return this.isSubtype(vE,t);case PE:case QL:return this.isSubtype(vE,t)||this.isSubtype(kl,t);case Qh:case Nl:case eF:return this.isSubtype(TE,t);default:return!1}}getReferenceType(e){let t=`${e.container.$type}:${e.property}`;switch(t){case"AttributeAttribute:decl":return ms;case"AttributeParamType:reference":return kl;case"DataModelAttribute:decl":return ms;case"DataModelFieldAttribute:decl":return ms;case"DataModelFieldType:reference":return kl;case"FunctionParamType:reference":return kl;case"InvocationExpr:function":return RE;case"MemberAccessExpr:member":return Qh;case"ReferenceExpr:target":return TE;default:throw new Error(`${t} is not a valid reference id.`)}}getTypeMetaData(e){switch(e){case"ArrayExpr":return{name:"ArrayExpr",mandatory:[{name:"items",type:"array"}]};case"Attribute":return{name:"Attribute",mandatory:[{name:"attributes",type:"array"},{name:"params",type:"array"}]};case"AttributeAttribute":return{name:"AttributeAttribute",mandatory:[{name:"args",type:"array"}]};case"AttributeParam":return{name:"AttributeParam",mandatory:[{name:"default",type:"boolean"}]};case"AttributeParamType":return{name:"AttributeParamType",mandatory:[{name:"array",type:"boolean"},{name:"optional",type:"boolean"}]};case"DataModel":return{name:"DataModel",mandatory:[{name:"attributes",type:"array"},{name:"fields",type:"array"}]};case"DataModelAttribute":return{name:"DataModelAttribute",mandatory:[{name:"args",type:"array"}]};case"DataModelField":return{name:"DataModelField",mandatory:[{name:"attributes",type:"array"}]};case"DataModelFieldAttribute":return{name:"DataModelFieldAttribute",mandatory:[{name:"args",type:"array"}]};case"DataModelFieldType":return{name:"DataModelFieldType",mandatory:[{name:"array",type:"boolean"},{name:"optional",type:"boolean"}]};case"DataSource":return{name:"DataSource",mandatory:[{name:"fields",type:"array"}]};case"Enum":return{name:"Enum",mandatory:[{name:"fields",type:"array"}]};case"Function":return{name:"Function",mandatory:[{name:"params",type:"array"}]};case"FunctionParamType":return{name:"FunctionParamType",mandatory:[{name:"array",type:"boolean"}]};case"InvocationExpr":return{name:"InvocationExpr",mandatory:[{name:"args",type:"array"}]};case"Model":return{name:"Model",mandatory:[{name:"declarations",type:"array"}]};case"ReferenceExpr":return{name:"ReferenceExpr",mandatory:[{name:"args",type:"array"}]};default:return{name:e,mandatory:[]}}}},an=new hs;var DE=Ht(ei()),Ml,wE=()=>Ml!=null?Ml:Ml=(0,DE.loadGrammarFromJson)(`{
3726
3726
  "$type": "Grammar",
3727
3727
  "isDeclared": true,
3728
3728
  "name": "ZModel",
@@ -6205,4 +6205,4 @@ See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_7-0-0`)}return r}
6205
6205
  "imports": [],
6206
6206
  "interfaces": [],
6207
6207
  "usedGrammars": []
6208
- }`);var oF={languageId:"zmodel",fileExtensions:[".zmodel"],caseInsensitive:!1},$E={AstReflection:()=>new hs},ME={Grammar:()=>OE(),LanguageMetaData:()=>oF,parser:{}};var sn=St(wn()),qE=St(pn());var sy=["sqlite","postgresql","mysql","sqlserver","cockroachdb"],LE=["String","Int","Float","Decimal","BigInt","Boolean","Bytes","DateTime"],ta="stdlib.zmodel";function Fl(r){return r?wE(r)?r:Fl(r.$container):null}function ql(r){var t;let e=Fl(r);return e&&((t=e.$document)==null?void 0:t.uri.path.endsWith(ta))}function Ei(r,e){let t=r.reduce((n,i)=>{var o;return n[i.name]=(o=n[i.name])!=null?o:[],n[i.name].push(i),n},{});for(let[n,i]of Object.entries(t))i.length>1&&e("error",`Duplicated declaration name "${n}"`,{node:i[1]})}function jl(r){if($l(r)&&typeof r.value=="string")return r.value}function aF(r,e){switch(r){case"Any":return!0;case"Float":return e==="Any"||e==="Int"||e==="Float";default:return e==="Any"||e===r}}function uy(r){switch(r){case"Any":case"Boolean":case"String":case"DateTime":case"Int":case"Float":case"Null":return r;case"BigInt":return"Int";case"Decimal":return"Float";case"Json":case"Bytes":return"Any"}}function FE(r,e,t){var s,u;let n=r.$resolvedType;if(!n)return!1;let i=e.type.type,o=e.type.array,a=e.type.reference;if(i){if(typeof(n==null?void 0:n.decl)!="string")return!1;if(i==="FieldReference")return o?EE(r.value)&&!r.value.items.find(c=>!iy(c)||!ea(c.target.ref)):iy(r.value)&&ea(r.value.target.ref);if(i==="ContextType")if(ea(t.$container)){if(!((u=(s=t.$container)==null?void 0:s.type)!=null&&u.type))return!1;i=uy(t.$container.type.type)}else i="Any";return aF(i,n.decl)&&o===n.array}else return(a==null?void 0:a.ref)===n.decl&&o===n.array}var Gl=class extends sn.DefaultLinker{constructor(t){super(t);this.descriptions=t.workspace.AstNodeDescriptionProvider}link(i){return no(this,arguments,function*(t,n=qE.CancellationToken.None){var o,a;if(!(((o=t.parseResult.lexerErrors)==null?void 0:o.length)>0||((a=t.parseResult.parserErrors)==null?void 0:a.length)>0)){for(let s of(0,sn.streamContents)(t.parseResult.value))yield(0,sn.interruptAndCheck)(n),this.resolve(s,t);t.state=sn.DocumentState.Linked}})}linkReference(t,n,i,o){if(!this.resolveFromScopeProviders(t,n,i,o)){let a=t[n];this.doLink({reference:a,container:t,property:n},i)}}resolveFromScopeProviders(t,n,i,o){let a=t[n];for(let s of o){let u=s(a.$refText);if(u)return a._ref=u,a._nodeDescription=this.descriptions.createDescription(u,u.name,i),u}return null}resolve(t,n,i=[]){if(!t.$resolvedType)switch(t.$type){case Ol:this.resolveLiteral(t);break;case wl:this.resolveInvocation(t,n,i);break;case Sl:this.resolveArray(t,n,i);break;case Ml:this.resolveReference(t,n,i);break;case ry:this.resolveMemberAccess(t,n,i);break;case ay:this.resolveUnary(t,n,i);break;case Nl:this.resolveBinary(t,n,i);break;case oy:this.resolveThis(t,n,i);break;case ny:this.resolveNull(t,n,i);break;case PE:this.resolveAttributeArg(t,n,i);break;default:this.resolveDefault(t,n,i);break}}resolveBinary(t,n,i){switch(t.operator){case">":case">=":case"<":case"<=":case"==":case"!=":case"&&":case"||":this.resolve(t.left,n,i),this.resolve(t.right,n,i),this.resolveToBuiltinTypeOrDecl(t,"Boolean");break;case"?":case"!":case"^":this.resolveCollectionPredicate(t,n,i);break;default:throw Error(`Unsupported binary operator: ${t.operator}`)}}resolveUnary(t,n,i){this.resolve(t.operand,n,i),t.$resolvedType=t.operand.$resolvedType}resolveReference(t,n,i){this.linkReference(t,"target",n,i),t.args.forEach(o=>this.resolve(o,n,i)),t.target.ref&&(t.target.ref.$type===Dl?this.resolveToBuiltinTypeOrDecl(t,t.target.ref.$container):this.resolveToDeclaredType(t,t.target.ref.type))}resolveArray(t,n,i){t.items.forEach(a=>this.resolve(a,n,i));let o=t.items[0].$resolvedType;o!=null&&o.decl&&this.resolveToBuiltinTypeOrDecl(t,o.decl,!0)}resolveInvocation(t,n,i){if(this.linkReference(t,"function",n,i),t.args.forEach(o=>this.resolve(o,n,i)),t.function.ref){let o=t.function.ref;if(o.name==="auth"&&ql(o)){let a=Fl(t),s=a==null?void 0:a.declarations.find(u=>bi(u)&&u.name==="User");s&&(t.$resolvedType={decl:s})}else this.resolveToDeclaredType(t,o.returnType)}}resolveLiteral(t){let n=typeof t.value=="string"?"String":typeof t.value=="boolean"?"Boolean":typeof t.value=="number"?"Int":void 0;n&&this.resolveToBuiltinTypeOrDecl(t,n)}resolveMemberAccess(t,n,i){this.resolve(t.operand,n,i);let o=t.operand.$resolvedType;if(o&&!o.array&&bi(o.decl)){let a=o.decl;i=[u=>a.fields.find(c=>c.name===u),...i]}this.linkReference(t,"member",n,i),t.member.ref&&this.resolveToDeclaredType(t,t.member.ref.type)}resolveCollectionPredicate(t,n,i){this.resolve(t.left,n,i);let o=t.left.$resolvedType;if(o&&bi(o.decl)&&o.array){let a=o.decl;i=[u=>a.fields.find(c=>c.name===u),...i],this.resolve(t.right,n,i),this.resolveToBuiltinTypeOrDecl(t,"Boolean")}}resolveThis(t,n,i){let o=t.$container;for(;o&&!bi(o);)o=o.$container;o&&this.resolveToBuiltinTypeOrDecl(t,o)}resolveNull(t,n,i){this.resolveToBuiltinTypeOrDecl(t,"Null")}resolveAttributeArg(t,n,i){this.resolve(t.value,n,i),t.$resolvedType=t.value.$resolvedType}resolveDefault(t,n,i){for(let[o,a]of Object.entries(t))o.startsWith("$")||(0,sn.isReference)(a)&&this.linkReference(t,o,n,i);for(let o of(0,sn.streamContents)(t))this.resolve(o,n,i)}resolveToDeclaredType(t,n){if(n.type){let i=uy(n.type);t.$resolvedType={decl:i,array:n.array}}else n.reference&&(t.$resolvedType={decl:n.reference.ref,array:n.array})}resolveToBuiltinTypeOrDecl(t,n,i=!1){t.$resolvedType={decl:n,array:i}}};var na=St(wn());var ra=class extends na.DefaultScopeComputation{constructor(t){super(t);this.services=t}computeExports(t,n){return no(this,null,function*(){let i=yield Es(ra.prototype,this,"computeExports").call(this,t,n);for(let o of(0,na.streamAllContents)(t.parseResult.value))if(n&&(yield(0,na.interruptAndCheck)(n)),DE(o)){let a=this.services.workspace.AstNodeDescriptionProvider.createDescription(o,o.name,t);i.push(a)}return i})}};var UE=St(wn());var ys=class{validate(e,t){var n;Ei(e.declarations,t),(n=e.$document)!=null&&n.uri.path.endsWith(ta)||this.validateDataSources(e,t)}validateDataSources(e,t){let n=e.declarations.filter(i=>NE(i));n.length===0?t("error","Model must define a datasource",{node:e}):n.length>1&&t("error","Multiple datasource declarations are not allowed",{node:n[1]})}};var sF=["provider","url","shadowDatabaseUrl","relationMode"],gs=class{validate(e,t){Ei(e.fields,t),this.validateFields(e,t),this.validateProvider(e,t),this.validateUrl(e,t),this.validateRelationMode(e,t)}validateFields(e,t){e.fields.forEach(n=>{sF.includes(n.name)||t("error",`Unexpected field "${n.name}"`,{node:n})})}validateProvider(e,t){let n=e.fields.find(o=>o.name==="provider");if(!n){t("error",'datasource must include a "provider" field',{node:e});return}let i=jl(n.value);i?sy.includes(i)||t("error",`Provider "${i}" is not supported. Choose from ${sy.map(o=>'"'+o+'"').join(" | ")}.`,{node:n.value}):t("error",'"provider" must be set to a string literal',{node:n.value})}validateUrl(e,t){var i;e.fields.find(o=>o.name==="url")||t("error",'datasource must include a "url" field',{node:e});for(let o of["url","shadowDatabaseUrl"]){let a=e.fields.find(u=>u.name===o);if(!a)continue;!jl(a.value)&&!(Il(a.value)&&((i=a.value.function.ref)==null?void 0:i.name)==="env")&&t("error",`"${o}" must be set to a string literal or an invocation of "env" function`,{node:a.value})}}validateRelationMode(e,t){let n=e.fields.find(i=>i.name==="relationMode");if(n){let i=jl(n.value);(!i||!["foreignKeys","prisma"].includes(i))&&t("error",'"relationMode" must be set to "foreignKeys" or "prisma"',{node:n.value})}}};var GE=St(jE()),vs=class{validate(e,t){Ei(e.fields,t),this.validateFields(e,t),this.validateAttributes(e,t)}validateFields(e,t){let n=e.fields.filter(i=>i.attributes.find(o=>{var a;return((a=o.decl.ref)==null?void 0:a.name)==="@id"}));n.length===0?t("error","Model must include a field with @id attribute",{node:e}):n.length>1?t("error","Model can include at most one field with @id attribute",{node:e}):(n[0].type.optional&&t("error","Field with @id attribute must not be optional",{node:n[0]}),(n[0].type.array||!n[0].type.type||!LE.includes(n[0].type.type))&&t("error","Field with @id attribute must be of scalar type",{node:n[0]})),e.fields.forEach(i=>this.validateField(i,t))}validateField(e,t){var n;e.type.array&&e.type.optional&&t("error","Optional lists are not supported. Use either `Type[]` or `Type?`",{node:e.type}),e.attributes.forEach(i=>this.validateAttributeApplication(i,t)),bi((n=e.type.reference)==null?void 0:n.ref)&&this.validateRelationField(e,t)}validateAttributes(e,t){e.attributes.forEach(n=>{this.validateAttributeApplication(n,t)})}validateAttributeApplication(e,t){let n=e.decl.ref;if(!n)return;let i=e.$container;if(n.name==="@@@targetField"&&!CE(i)){t("error",`attribute "${n.name}" can only be used on attribute declarations`,{node:e});return}ea(i)&&!this.isValidAttributeTarget(n,i)&&t("error",`attribute "${n.name}" cannot be used on this type of field`,{node:e});let o=new Set;for(let s of e.args){let u;if(s.name){if(u=n.params.find(c=>c.name===s.name),!u)return t("error",`Attribute "${n.name}" doesn't have a parameter named "${s.name}"`,{node:s}),!1}else if(u=n.params.find(c=>c.default&&!o.has(c)),!u)return t("error","Unexpected unnamed argument",{node:s}),!1;if(!FE(s,u,e))return t("error","Value is not assignable to parameter",{node:s}),!1;if(o.has(u))return t("error",`Parameter "${u.name}" is already provided`,{node:s}),!1;o.add(u),s.$resolvedParam=u}let a=n.params.filter(s=>!s.type.optional&&!o.has(s));return a.length>0?(t("error",`Required ${(0,GE.default)("parameter",a.length)} not provided: ${a.map(s=>s.name).join(", ")}`,{node:e}),!1):!0}isValidAttributeTarget(e,t){var a;let n=e.attributes.find(s=>{var u;return((u=s.decl.ref)==null?void 0:u.name)==="@@@targetField"});if(!n)return!0;let i=n.args[0].value.items.map(s=>{var u;return(u=s.target.ref)==null?void 0:u.name}),o=!1;for(let s of i){switch(s){case"StringField":o=o||t.type.type==="String";break;case"IntField":o=o||t.type.type==="Int";break;case"FloatField":o=o||t.type.type==="Float";break;case"DecimalField":o=o||t.type.type==="Decimal";break;case"BooleanField":o=o||t.type.type==="Boolean";break;case"DateTimeField":o=o||t.type.type==="DateTime";break;case"JsonField":o=o||t.type.type==="Json";break;case"BytesField":o=o||t.type.type==="Bytes";break;case"ModelField":o=o||bi((a=t.type.reference)==null?void 0:a.ref);break;default:break}if(o)break}return o}parseRelation(e,t){let n=e.attributes.find(u=>{var c;return((c=u.decl.ref)==null?void 0:c.name)==="@relation"}),i,o,a,s=!0;if(!n)return{attr:n,name:i,fields:o,references:a,valid:!0};for(let u of n.args)!u.name||u.name==="name"?$l(u.value)&&(i=u.value.value):u.name==="fields"?(o=u.value.items,o.length===0&&(t&&t("error",'"fields" value cannot be emtpy',{node:u}),s=!1)):u.name==="references"&&(a=u.value.items,a.length===0&&(t&&t("error",'"references" value cannot be emtpy',{node:u}),s=!1));return{attr:n,name:i,fields:o,references:a,valid:s}}validateRelationField(e,t){var c,l,d,g,y;let n=this.parseRelation(e,t);if(!n.valid)return;let i=e.type.reference.ref,o=i.fields.filter(p=>{var A;return((A=p.type.reference)==null?void 0:A.ref)===e.$container});if(o=o.filter(p=>{let A=this.parseRelation(p);return A.valid&&A.name===n.name}),o.length===0){t("error",`The relation field "${e.name}" on model "${e.$container.name}" is missing an opposite relation field on model "${i.name}"`,{node:e});return}else if(o.length>1){o.forEach(p=>t("error",`Fields ${o.map(A=>'"'+A.name+'"').join(", ")} on model "${i.name}" refer to the same relation to model "${e.$container.name}"`,{node:p}));return}let a=o[0],s=this.parseRelation(a),u;if(((c=n==null?void 0:n.references)==null?void 0:c.length)&&((l=n.fields)==null?void 0:l.length))if((s==null?void 0:s.references)||(s==null?void 0:s.fields)){t("error",'"fields" and "references" must be provided only on one side of relation field',{node:a});return}else u=a;else if(((d=s==null?void 0:s.references)==null?void 0:d.length)&&((g=s.fields)==null?void 0:g.length))if((n==null?void 0:n.references)||(n==null?void 0:n.fields)){t("error",'"fields" and "references" must be provided only on one side of relation field',{node:e});return}else u=e;else{[e,a].forEach(p=>t("error",'Field for one side of relation must carry @relation attribute with both "fields" and "references" fields',{node:p}));return}if(!u.type.array&&!u.type.optional){t("error","Relation field needs to be list or optional",{node:u});return}u!==e&&!u.type.array&&((y=n.fields)==null||y.forEach(p=>{let A=p.target.ref;A&&!A.attributes.find(x=>{var k;return((k=x.decl.ref)==null?void 0:k.name)==="@unique"})&&t("error",`Field "${A.name}" is part of a one-to-one relation and must be marked as @unique`,{node:A})}))}};var Ts=class{validate(e,t){}};var Rs=class{validate(e,t){Ei(e.fields,t)}};var _s=class{validate(e,t){e.$resolvedType||(this.isAuthInvocation(e)?t("error",'auth() cannot be resolved because no "User" model is defined',{node:e}):this.isCollectionPredicate(e)?t("error","collection predicate can only be used on an array of model type",{node:e}):t("error","expression cannot be resolved",{node:e}))}isCollectionPredicate(e){return kE(e)&&["?","!","^"].includes(e.operator)}isAuthInvocation(e){var t;return Il(e)&&((t=e.function.ref)==null?void 0:t.name)==="auth"&&ql(e.function.ref)}};var Ul=class extends UE.ValidationRegistry{constructor(e){super(e);let t=e.validation.ZModelValidator,n={Model:t.checkModel,DataSource:t.checkDataSource,DataModel:t.checkDataModel,Enum:t.checkEnum,Attribute:t.checkAttribute,Expression:t.checkExpression};this.register(n,t)}},Hl=class{shouldCheck(e){let t,n=e;for(;n;){if(n.$document){t=n.$document;break}n=n.$container}return(t==null?void 0:t.parseResult.lexerErrors.length)===0&&(t==null?void 0:t.parseResult.parserErrors.length)===0}checkModel(e,t){this.shouldCheck(e)&&new ys().validate(e,t)}checkDataSource(e,t){this.shouldCheck(e)&&new gs().validate(e,t)}checkDataModel(e,t){this.shouldCheck(e)&&new vs().validate(e,t)}checkEnum(e,t){this.shouldCheck(e)&&new Rs().validate(e,t)}checkAttribute(e,t){this.shouldCheck(e)&&new Ts().validate(e,t)}checkExpression(e,t){new _s().validate(e,t)}};var zE=St(Ne()),VE=St(vu());var HE=St(wn()),WE=St(require("path")),KE=St(vn());var Yi=class extends HE.DefaultWorkspaceManager{loadAdditionalDocuments(e,t){return no(this,null,function*(){yield Es(Yi.prototype,this,"loadAdditionalDocuments").call(this,e,t);let n=KE.URI.file(WE.default.join(__dirname,"../res",ta));console.log(`Adding stdlib document from ${n}`);let i=this.langiumDocuments.getOrCreateDocument(n);t(i)})}};var Wl=St(wn()),BE=St(Ne()),As=class{constructor(e){this.nameProvider=e.references.NameProvider,this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}getDefinition(e,t){let n=e.parseResult.value;if(n.$cstNode){let i=n.$cstNode,o=(0,Wl.findDeclarationNodeAtOffset)(i,e.textDocument.offsetAt(t.position),this.grammarConfig.nameRegexp);if(o)return this.collectLocationLinks(o,t)}}collectLocationLinks(e,t){var i;let n=this.findLink(e);if(n&&!n.targetDocument.textDocument.uri.endsWith("stdlib.zmodel"))return[BE.LocationLink.create(n.targetDocument.textDocument.uri,((i=n.target.element.$cstNode)!=null?i:n.target).range,n.target.range,n.source.range)]}findLink(e){let t=this.references.findDeclarationNode(e);if(t!=null&&t.element){let n=(0,Wl.getDocument)(t.element);if(t&&n)return{source:e,target:t,targetDocument:n}}}};var uF={references:{ScopeComputation:r=>new ra(r),Linker:r=>new Gl(r)},validation:{ValidationRegistry:r=>new Ul(r),ZModelValidator:()=>new Hl},lsp:{DefinitionProvider:r=>new As(r)}};function cF(r){return{ServiceRegistry:()=>new st.DefaultServiceRegistry,lsp:{Connection:()=>r.connection,LanguageServer:e=>new st.DefaultLanguageServer(e)},workspace:{LangiumDocuments:e=>new st.DefaultLangiumDocuments(e),LangiumDocumentFactory:e=>new st.DefaultLangiumDocumentFactory(e),DocumentBuilder:e=>new st.DefaultDocumentBuilder(e),TextDocuments:()=>new zE.TextDocuments(VE.TextDocument),TextDocumentFactory:e=>new st.DefaultTextDocumentFactory(e),IndexManager:e=>new st.DefaultIndexManager(e),WorkspaceManager:e=>new Yi(e),FileSystemProvider:e=>r.fileSystemProvider(e),MutexLock:()=>new st.MutexLock,ConfigurationProvider:e=>new st.DefaultConfigurationProvider(e)}}}function YE(r){let e=(0,st.inject)(cF(r),$E),t=(0,st.inject)((0,st.createDefaultModule)({shared:e}),ME,uF);return e.ServiceRegistry.register(t),{shared:e,ZModel:t}}var lF=(0,Kl.createConnection)(Kl.ProposedFeatures.all),{shared:dF}=YE(yy({connection:lF},JE.NodeFileSystem));(0,XE.startLanguageServer)(dF);
6208
+ }`);var rF={languageId:"zmodel",fileExtensions:[".zmodel"],caseInsensitive:!1},IE={AstReflection:()=>new hs},OE={Grammar:()=>wE(),LanguageMetaData:()=>rF,parser:{}};var sn=Ht(ei()),LE=Ht(pn());var oy=["sqlite","postgresql","mysql","sqlserver","cockroachdb"],$E=["String","Int","Float","Decimal","BigInt","Boolean","Bytes","DateTime"],ta="stdlib.zmodel";function Ll(r){return r?NE(r)?r:Ll(r.$container):null}function Fl(r){var t;let e=Ll(r);return e&&((t=e.$document)==null?void 0:t.uri.path.endsWith(ta))}function Ei(r,e){let t=r.reduce((n,i)=>{var o;return n[i.name]=(o=n[i.name])!=null?o:[],n[i.name].push(i),n},{});for(let[n,i]of Object.entries(t))i.length>1&&e("error",`Duplicated declaration name "${n}"`,{node:i[1]})}function ql(r){if(Ol(r)&&typeof r.value=="string")return r.value}function nF(r,e){switch(r){case"Any":return!0;case"Float":return e==="Any"||e==="Int"||e==="Float";default:return e==="Any"||e===r}}function ay(r){switch(r){case"Any":case"Boolean":case"String":case"DateTime":case"Int":case"Float":case"Null":return r;case"BigInt":return"Int";case"Decimal":return"Float";case"Json":case"Bytes":return"Any"}}function ME(r,e,t){var s,u;let n=r.$resolvedType;if(!n)return!1;let i=e.type.type,o=e.type.array,a=e.type.reference;if(i){if(typeof(n==null?void 0:n.decl)!="string")return!1;if(i==="FieldReference")return o?AE(r.value)&&!r.value.items.find(c=>!ry(c)||!ea(c.target.ref)):ry(r.value)&&ea(r.value.target.ref);if(i==="ContextType")if(ea(t.$container)){if(!((u=(s=t.$container)==null?void 0:s.type)!=null&&u.type))return!1;i=ay(t.$container.type.type)}else i="Any";return nF(i,n.decl)&&o===n.array}else return(a==null?void 0:a.ref)===n.decl&&o===n.array}var jl=class extends sn.DefaultLinker{constructor(t){super(t);this.descriptions=t.workspace.AstNodeDescriptionProvider}link(i){return no(this,arguments,function*(t,n=LE.CancellationToken.None){var o,a;if(!(((o=t.parseResult.lexerErrors)==null?void 0:o.length)>0||((a=t.parseResult.parserErrors)==null?void 0:a.length)>0)){for(let s of(0,sn.streamContents)(t.parseResult.value))yield(0,sn.interruptAndCheck)(n),this.resolve(s,t);t.state=sn.DocumentState.Linked}})}linkReference(t,n,i,o){if(!this.resolveFromScopeProviders(t,n,i,o)){let a=t[n];this.doLink({reference:a,container:t,property:n},i)}}resolveFromScopeProviders(t,n,i,o){let a=t[n];for(let s of o){let u=s(a.$refText);if(u)return a._ref=u,a._nodeDescription=this.descriptions.createDescription(u,u.name,i),u}return null}resolve(t,n,i=[]){switch(t.$type){case Il:this.resolveLiteral(t);break;case Dl:this.resolveInvocation(t,n,i);break;case xl:this.resolveArray(t,n,i);break;case $l:this.resolveReference(t,n,i);break;case ey:this.resolveMemberAccess(t,n,i);break;case iy:this.resolveUnary(t,n,i);break;case Sl:this.resolveBinary(t,n,i);break;case ny:this.resolveThis(t,n,i);break;case ty:this.resolveNull(t,n,i);break;case EE:this.resolveAttributeArg(t,n,i);break;default:this.resolveDefault(t,n,i);break}}resolveBinary(t,n,i){switch(t.operator){case">":case">=":case"<":case"<=":case"==":case"!=":case"&&":case"||":this.resolve(t.left,n,i),this.resolve(t.right,n,i),this.resolveToBuiltinTypeOrDecl(t,"Boolean");break;case"?":case"!":case"^":this.resolveCollectionPredicate(t,n,i);break;default:throw Error(`Unsupported binary operator: ${t.operator}`)}}resolveUnary(t,n,i){this.resolve(t.operand,n,i),t.$resolvedType=t.operand.$resolvedType}resolveReference(t,n,i){this.linkReference(t,"target",n,i),t.args.forEach(o=>this.resolve(o,n,i)),t.target.ref&&(t.target.ref.$type===Nl?this.resolveToBuiltinTypeOrDecl(t,t.target.ref.$container):this.resolveToDeclaredType(t,t.target.ref.type))}resolveArray(t,n,i){t.items.forEach(a=>this.resolve(a,n,i));let o=t.items[0].$resolvedType;o!=null&&o.decl&&this.resolveToBuiltinTypeOrDecl(t,o.decl,!0)}resolveInvocation(t,n,i){if(this.linkReference(t,"function",n,i),t.args.forEach(o=>this.resolve(o,n,i)),t.function.ref){let o=t.function.ref;if(o.name==="auth"&&Fl(o)){let a=Ll(t),s=a==null?void 0:a.declarations.find(u=>bi(u)&&u.name==="User");s&&(t.$resolvedType={decl:s})}else this.resolveToDeclaredType(t,o.returnType)}}resolveLiteral(t){let n=typeof t.value=="string"?"String":typeof t.value=="boolean"?"Boolean":typeof t.value=="number"?"Int":void 0;n&&this.resolveToBuiltinTypeOrDecl(t,n)}resolveMemberAccess(t,n,i){this.resolve(t.operand,n,i);let o=t.operand.$resolvedType;if(o&&!o.array&&bi(o.decl)){let a=o.decl;i=[u=>a.fields.find(c=>c.name===u),...i]}this.linkReference(t,"member",n,i),t.member.ref&&this.resolveToDeclaredType(t,t.member.ref.type)}resolveCollectionPredicate(t,n,i){this.resolve(t.left,n,i);let o=t.left.$resolvedType;if(o&&bi(o.decl)&&o.array){let a=o.decl;i=[u=>a.fields.find(c=>c.name===u),...i],this.resolve(t.right,n,i),this.resolveToBuiltinTypeOrDecl(t,"Boolean")}}resolveThis(t,n,i){let o=t.$container;for(;o&&!bi(o);)o=o.$container;o&&this.resolveToBuiltinTypeOrDecl(t,o)}resolveNull(t,n,i){this.resolveToBuiltinTypeOrDecl(t,"Null")}resolveAttributeArg(t,n,i){this.resolve(t.value,n,i),t.$resolvedType=t.value.$resolvedType}resolveDefault(t,n,i){for(let[o,a]of Object.entries(t))o.startsWith("$")||(0,sn.isReference)(a)&&this.linkReference(t,o,n,i);for(let o of(0,sn.streamContents)(t))this.resolve(o,n,i)}resolveToDeclaredType(t,n){if(n.type){let i=ay(n.type);t.$resolvedType={decl:i,array:n.array}}else n.reference&&(t.$resolvedType={decl:n.reference.ref,array:n.array})}resolveToBuiltinTypeOrDecl(t,n,i=!1){t.$resolvedType={decl:n,array:i}}};var na=Ht(ei());var ra=class extends na.DefaultScopeComputation{constructor(t){super(t);this.services=t}computeExports(t,n){return no(this,null,function*(){let i=yield bs(ra.prototype,this,"computeExports").call(this,t,n);for(let o of(0,na.streamAllContents)(t.parseResult.value))if(n&&(yield(0,na.interruptAndCheck)(n)),SE(o)){let a=this.services.workspace.AstNodeDescriptionProvider.createDescription(o,o.name,t);i.push(a)}return i})}};var jE=Ht(ei());var ys=class{validate(e,t){var n;Ei(e.declarations,t),(n=e.$document)!=null&&n.uri.path.endsWith(ta)||this.validateDataSources(e,t)}validateDataSources(e,t){let n=e.declarations.filter(i=>xE(i));n.length===0?t("error","Model must define a datasource",{node:e}):n.length>1&&t("error","Multiple datasource declarations are not allowed",{node:n[1]})}};var iF=["provider","url","shadowDatabaseUrl","relationMode"],gs=class{validate(e,t){Ei(e.fields,t),this.validateFields(e,t),this.validateProvider(e,t),this.validateUrl(e,t),this.validateRelationMode(e,t)}validateFields(e,t){e.fields.forEach(n=>{iF.includes(n.name)||t("error",`Unexpected field "${n.name}"`,{node:n})})}validateProvider(e,t){let n=e.fields.find(o=>o.name==="provider");if(!n){t("error",'datasource must include a "provider" field',{node:e});return}let i=ql(n.value);i?oy.includes(i)||t("error",`Provider "${i}" is not supported. Choose from ${oy.map(o=>'"'+o+'"').join(" | ")}.`,{node:n.value}):t("error",'"provider" must be set to a string literal',{node:n.value})}validateUrl(e,t){var i;e.fields.find(o=>o.name==="url")||t("error",'datasource must include a "url" field',{node:e});for(let o of["url","shadowDatabaseUrl"]){let a=e.fields.find(u=>u.name===o);if(!a)continue;!ql(a.value)&&!(wl(a.value)&&((i=a.value.function.ref)==null?void 0:i.name)==="env")&&t("error",`"${o}" must be set to a string literal or an invocation of "env" function`,{node:a.value})}}validateRelationMode(e,t){let n=e.fields.find(i=>i.name==="relationMode");if(n){let i=ql(n.value);(!i||!["foreignKeys","prisma"].includes(i))&&t("error",'"relationMode" must be set to "foreignKeys" or "prisma"',{node:n.value})}}};var qE=Ht(FE()),vs=class{validate(e,t){Ei(e.fields,t),this.validateFields(e,t),this.validateAttributes(e,t)}validateFields(e,t){let n=e.fields.filter(i=>i.attributes.find(o=>{var a;return((a=o.decl.ref)==null?void 0:a.name)==="@id"}));n.length===0?t("error","Model must include a field with @id attribute",{node:e}):n.length>1?t("error","Model can include at most one field with @id attribute",{node:e}):(n[0].type.optional&&t("error","Field with @id attribute must not be optional",{node:n[0]}),(n[0].type.array||!n[0].type.type||!$E.includes(n[0].type.type))&&t("error","Field with @id attribute must be of scalar type",{node:n[0]})),e.fields.forEach(i=>this.validateField(i,t))}validateField(e,t){var n;e.type.array&&e.type.optional&&t("error","Optional lists are not supported. Use either `Type[]` or `Type?`",{node:e.type}),e.attributes.forEach(i=>this.validateAttributeApplication(i,t)),bi((n=e.type.reference)==null?void 0:n.ref)&&this.validateRelationField(e,t)}validateAttributes(e,t){e.attributes.forEach(n=>{this.validateAttributeApplication(n,t)})}validateAttributeApplication(e,t){let n=e.decl.ref;if(!n)return;let i=e.$container;if(n.name==="@@@targetField"&&!bE(i)){t("error",`attribute "${n.name}" can only be used on attribute declarations`,{node:e});return}ea(i)&&!this.isValidAttributeTarget(n,i)&&t("error",`attribute "${n.name}" cannot be used on this type of field`,{node:e});let o=new Set;for(let s of e.args){let u;if(s.name){if(u=n.params.find(c=>c.name===s.name),!u)return t("error",`Attribute "${n.name}" doesn't have a parameter named "${s.name}"`,{node:s}),!1}else if(u=n.params.find(c=>c.default&&!o.has(c)),!u)return t("error","Unexpected unnamed argument",{node:s}),!1;if(!ME(s,u,e))return t("error","Value is not assignable to parameter",{node:s}),!1;if(o.has(u))return t("error",`Parameter "${u.name}" is already provided`,{node:s}),!1;o.add(u),s.$resolvedParam=u}let a=n.params.filter(s=>!s.type.optional&&!o.has(s));return a.length>0?(t("error",`Required ${(0,qE.default)("parameter",a.length)} not provided: ${a.map(s=>s.name).join(", ")}`,{node:e}),!1):!0}isValidAttributeTarget(e,t){var a;let n=e.attributes.find(s=>{var u;return((u=s.decl.ref)==null?void 0:u.name)==="@@@targetField"});if(!n)return!0;let i=n.args[0].value.items.map(s=>{var u;return(u=s.target.ref)==null?void 0:u.name}),o=!1;for(let s of i){switch(s){case"StringField":o=o||t.type.type==="String";break;case"IntField":o=o||t.type.type==="Int";break;case"FloatField":o=o||t.type.type==="Float";break;case"DecimalField":o=o||t.type.type==="Decimal";break;case"BooleanField":o=o||t.type.type==="Boolean";break;case"DateTimeField":o=o||t.type.type==="DateTime";break;case"JsonField":o=o||t.type.type==="Json";break;case"BytesField":o=o||t.type.type==="Bytes";break;case"ModelField":o=o||bi((a=t.type.reference)==null?void 0:a.ref);break;default:break}if(o)break}return o}parseRelation(e,t){let n=e.attributes.find(u=>{var c;return((c=u.decl.ref)==null?void 0:c.name)==="@relation"}),i,o,a,s=!0;if(!n)return{attr:n,name:i,fields:o,references:a,valid:!0};for(let u of n.args)!u.name||u.name==="name"?Ol(u.value)&&(i=u.value.value):u.name==="fields"?(o=u.value.items,o.length===0&&(t&&t("error",'"fields" value cannot be emtpy',{node:u}),s=!1)):u.name==="references"&&(a=u.value.items,a.length===0&&(t&&t("error",'"references" value cannot be emtpy',{node:u}),s=!1));return{attr:n,name:i,fields:o,references:a,valid:s}}validateRelationField(e,t){var c,l,d,g,y;let n=this.parseRelation(e,t);if(!n.valid)return;let i=e.type.reference.ref,o=i.fields.filter(p=>{var A;return((A=p.type.reference)==null?void 0:A.ref)===e.$container});if(o=o.filter(p=>{let A=this.parseRelation(p);return A.valid&&A.name===n.name}),o.length===0){t("error",`The relation field "${e.name}" on model "${e.$container.name}" is missing an opposite relation field on model "${i.name}"`,{node:e});return}else if(o.length>1){o.forEach(p=>t("error",`Fields ${o.map(A=>'"'+A.name+'"').join(", ")} on model "${i.name}" refer to the same relation to model "${e.$container.name}"`,{node:p}));return}let a=o[0],s=this.parseRelation(a),u;if(((c=n==null?void 0:n.references)==null?void 0:c.length)&&((l=n.fields)==null?void 0:l.length))if((s==null?void 0:s.references)||(s==null?void 0:s.fields)){t("error",'"fields" and "references" must be provided only on one side of relation field',{node:a});return}else u=a;else if(((d=s==null?void 0:s.references)==null?void 0:d.length)&&((g=s.fields)==null?void 0:g.length))if((n==null?void 0:n.references)||(n==null?void 0:n.fields)){t("error",'"fields" and "references" must be provided only on one side of relation field',{node:e});return}else u=e;else{[e,a].forEach(p=>t("error",'Field for one side of relation must carry @relation attribute with both "fields" and "references" fields',{node:p}));return}if(!u.type.array&&!u.type.optional){t("error","Relation field needs to be list or optional",{node:u});return}u!==e&&!u.type.array&&((y=n.fields)==null||y.forEach(p=>{let A=p.target.ref;A&&!A.attributes.find(x=>{var k;return((k=x.decl.ref)==null?void 0:k.name)==="@unique"})&&t("error",`Field "${A.name}" is part of a one-to-one relation and must be marked as @unique`,{node:A})}))}};var Ts=class{validate(e,t){}};var Rs=class{validate(e,t){Ei(e.fields,t)}};var _s=class{validate(e,t){e.$resolvedType||(this.isAuthInvocation(e)?t("error",'auth() cannot be resolved because no "User" model is defined',{node:e}):this.isCollectionPredicate(e)?t("error","collection predicate can only be used on an array of model type",{node:e}):t("error","expression cannot be resolved",{node:e}))}isCollectionPredicate(e){return CE(e)&&["?","!","^"].includes(e.operator)}isAuthInvocation(e){var t;return wl(e)&&((t=e.function.ref)==null?void 0:t.name)==="auth"&&Fl(e.function.ref)}};var Gl=class extends jE.ValidationRegistry{constructor(e){super(e);let t=e.validation.ZModelValidator,n={Model:t.checkModel,DataSource:t.checkDataSource,DataModel:t.checkDataModel,Enum:t.checkEnum,Attribute:t.checkAttribute,Expression:t.checkExpression};this.register(n,t)}},Ul=class{shouldCheck(e){let t,n=e;for(;n;){if(n.$document){t=n.$document;break}n=n.$container}return(t==null?void 0:t.parseResult.lexerErrors.length)===0&&(t==null?void 0:t.parseResult.parserErrors.length)===0}checkModel(e,t){this.shouldCheck(e)&&new ys().validate(e,t)}checkDataSource(e,t){this.shouldCheck(e)&&new gs().validate(e,t)}checkDataModel(e,t){this.shouldCheck(e)&&new vs().validate(e,t)}checkEnum(e,t){this.shouldCheck(e)&&new Rs().validate(e,t)}checkAttribute(e,t){this.shouldCheck(e)&&new Ts().validate(e,t)}checkExpression(e,t){new _s().validate(e,t)}};var WE=Ht(we()),KE=Ht(gu());var GE=Ht(ei()),UE=Ht(require("path")),HE=Ht(vn());var Yi=class extends GE.DefaultWorkspaceManager{loadAdditionalDocuments(e,t){return no(this,null,function*(){yield bs(Yi.prototype,this,"loadAdditionalDocuments").call(this,e,t);let n=HE.URI.file(UE.default.join(__dirname,"../res",ta));console.log(`Adding stdlib document from ${n}`);let i=this.langiumDocuments.getOrCreateDocument(n);t(i)})}};var oF={references:{ScopeComputation:r=>new ra(r),Linker:r=>new jl(r)},validation:{ValidationRegistry:r=>new Gl(r),ZModelValidator:()=>new Ul}};function aF(r){return{ServiceRegistry:()=>new st.DefaultServiceRegistry,lsp:{Connection:()=>r.connection,LanguageServer:e=>new st.DefaultLanguageServer(e)},workspace:{LangiumDocuments:e=>new st.DefaultLangiumDocuments(e),LangiumDocumentFactory:e=>new st.DefaultLangiumDocumentFactory(e),DocumentBuilder:e=>new st.DefaultDocumentBuilder(e),TextDocuments:()=>new WE.TextDocuments(KE.TextDocument),TextDocumentFactory:e=>new st.DefaultTextDocumentFactory(e),IndexManager:e=>new st.DefaultIndexManager(e),WorkspaceManager:e=>new Yi(e),FileSystemProvider:e=>r.fileSystemProvider(e),MutexLock:()=>new st.MutexLock,ConfigurationProvider:e=>new st.DefaultConfigurationProvider(e)}}}function BE(r){let e=(0,st.inject)(aF(r),IE),t=(0,st.inject)((0,st.createDefaultModule)({shared:e}),OE,oF);return e.ServiceRegistry.register(t),{shared:e,ZModel:t}}var sF=(0,Hl.createConnection)(Hl.ProposedFeatures.all),{shared:uF}=BE(my({connection:sF},VE.NodeFileSystem));(0,zE.startLanguageServer)(uF);