zenstack 0.3.18 → 0.3.20
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.
- package/README.md +23 -246
- package/bundle/cli/index.js +180 -167
- package/bundle/language-server/main.js +67 -67
- package/package.json +5 -5
- package/src/generator/next-auth/index.ts +0 -5
- package/src/generator/react-hooks/index.ts +18 -3
- package/src/generator/service/index.ts +40 -4
- package/src/language-server/utils.ts +21 -0
- package/src/language-server/validator/datamodel-validator.ts +32 -0
- package/src/language-server/validator/expression-validator.ts +48 -0
- package/src/language-server/validator/zmodel-validator.ts +7 -0
- package/src/language-server/zmodel-linker.ts +14 -3
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
`,Bl=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 aC:switch(e){case 0:e=1;break;case 2:e=3;break;default:e=0}break;case sC: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(uC);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}};Es.AbstractMessageBuffer=Bl});var Ty=C(Xl=>{"use strict";Object.defineProperty(Xl,"__esModule",{value:!0});var cC=Mn(),gy=require("util"),Pi=Kl(),lC=yy(),io=class extends lC.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 gy.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),Pi.Disposable.create(()=>this.stream.off("close",e))}onError(e){return this.stream.on("error",e),Pi.Disposable.create(()=>this.stream.off("error",e))}onEnd(e){return this.stream.on("end",e),Pi.Disposable.create(()=>this.stream.off("end",e))}onData(e){return this.stream.on("data",e),Pi.Disposable.create(()=>this.stream.off("data",e))}},Vl=class{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),Pi.Disposable.create(()=>this.stream.off("close",e))}onError(e){return this.stream.on("error",e),Pi.Disposable.create(()=>this.stream.off("error",e))}onEnd(e){return this.stream.on("end",e),Pi.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()}},vy=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 gy.TextDecoder(e.charset).decode(r)))}catch(t){return Promise.reject(t)}}})}),stream:Object.freeze({asReadableStream:r=>new zl(r),asWritableStream:r=>new Vl(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 Yl(){return vy}(function(r){function e(){cC.default.install(vy)}r.install=e})(Yl||(Yl={}));Xl.default=Yl});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 dC(r){return r===!0||r===!1}Wt.boolean=dC;function Ry(r){return typeof r=="string"||r instanceof String}Wt.string=Ry;function fC(r){return typeof r=="number"||r instanceof Number}Wt.number=fC;function pC(r){return r instanceof Error}Wt.error=pC;function mC(r){return typeof r=="function"}Wt.func=mC;function _y(r){return Array.isArray(r)}Wt.array=_y;function hC(r){return _y(r)&&r.every(e=>Ry(e))}Wt.stringArray=hC});var Td=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 ki=oo(),Ay;(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})(Ay=Y.ErrorCodes||(Y.ErrorCodes={}));var aa=class extends Error{constructor(e,t,n){super(t),this.code=ki.number(e)?e:Ay.UnknownErrorCode,this.data=n,Object.setPrototypeOf(this,aa.prototype)}toJson(){let e={code:this.code,message:this.message};return this.data!==void 0&&(e.data=this.data),e}};Y.ResponseError=aa;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 Jl=class extends Xe{constructor(e){super(e,0)}};Y.RequestType0=Jl;var Zl=class extends Xe{constructor(e,t=Nt.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};Y.RequestType=Zl;var Ql=class extends Xe{constructor(e,t=Nt.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};Y.RequestType1=Ql;var ed=class extends Xe{constructor(e){super(e,2)}};Y.RequestType2=ed;var td=class extends Xe{constructor(e){super(e,3)}};Y.RequestType3=td;var rd=class extends Xe{constructor(e){super(e,4)}};Y.RequestType4=rd;var nd=class extends Xe{constructor(e){super(e,5)}};Y.RequestType5=nd;var id=class extends Xe{constructor(e){super(e,6)}};Y.RequestType6=id;var od=class extends Xe{constructor(e){super(e,7)}};Y.RequestType7=od;var ad=class extends Xe{constructor(e){super(e,8)}};Y.RequestType8=ad;var sd=class extends Xe{constructor(e){super(e,9)}};Y.RequestType9=sd;var ud=class extends Xe{constructor(e,t=Nt.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};Y.NotificationType=ud;var cd=class extends Xe{constructor(e){super(e,0)}};Y.NotificationType0=cd;var ld=class extends Xe{constructor(e,t=Nt.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};Y.NotificationType1=ld;var dd=class extends Xe{constructor(e){super(e,2)}};Y.NotificationType2=dd;var fd=class extends Xe{constructor(e){super(e,3)}};Y.NotificationType3=fd;var pd=class extends Xe{constructor(e){super(e,4)}};Y.NotificationType4=pd;var md=class extends Xe{constructor(e){super(e,5)}};Y.NotificationType5=md;var hd=class extends Xe{constructor(e){super(e,6)}};Y.NotificationType6=hd;var yd=class extends Xe{constructor(e){super(e,7)}};Y.NotificationType7=yd;var gd=class extends Xe{constructor(e){super(e,8)}};Y.NotificationType8=gd;var vd=class extends Xe{constructor(e){super(e,9)}};Y.NotificationType9=vd;var yC;(function(r){function e(i){let o=i;return o&&ki.string(o.method)&&(ki.string(o.id)||ki.number(o.id))}r.isRequest=e;function t(i){let o=i;return o&&ki.string(o.method)&&i.id===void 0}r.isNotification=t;function n(i){let o=i;return o&&(o.result!==void 0||!!o.error)&&(ki.string(o.id)||ki.number(o.id)||o.id===null)}r.isResponse=n})(yC=Y.Message||(Y.Message={}))});var _d=C(Ln=>{"use strict";var by;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 Cs=class{constructor(){this[by]="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}[(by=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=Cs;var Rd=class extends Cs{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=Rd});var so=C(xi=>{"use strict";Object.defineProperty(xi,"__esModule",{value:!0});xi.Emitter=xi.Event=void 0;var gC=Mn(),vC;(function(r){let e={dispose(){}};r.None=function(){return e}})(vC=xi.Event||(xi.Event={}));var Ad=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,gC.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 Ad),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)}};xi.Emitter=ao;ao._noop=function(){}});var Pd=C(Si=>{"use strict";Object.defineProperty(Si,"__esModule",{value:!0});Si.CancellationTokenSource=Si.CancellationToken=void 0;var TC=Mn(),RC=oo(),bd=so(),Ed;(function(r){r.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:bd.Event.None}),r.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:bd.Event.None});function e(t){let n=t;return n&&(n===r.None||n===r.Cancelled||RC.boolean(n.isCancellationRequested)&&!!n.onCancellationRequested)}r.is=e})(Ed=Si.CancellationToken||(Si.CancellationToken={}));var _C=Object.freeze(function(r,e){let t=(0,TC.default)().timer.setTimeout(r.bind(e),0);return{dispose(){t.dispose()}}}),Ps=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?_C:(this._emitter||(this._emitter=new bd.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}},Cd=class{get token(){return this._token||(this._token=new Ps),this._token}cancel(){this._token?this._token.cancel():this._token=Ed.Cancelled}dispose(){this._token?this._token instanceof Ps&&this._token.dispose():this._token=Ed.None}};Si.CancellationTokenSource=Cd});var Ey=C(Fn=>{"use strict";Object.defineProperty(Fn,"__esModule",{value:!0});Fn.ReadableStreamMessageReader=Fn.AbstractMessageReader=Fn.MessageReader=void 0;var xd=Mn(),uo=oo(),kd=so(),AC;(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})(AC=Fn.MessageReader||(Fn.MessageReader={}));var ks=class{constructor(){this.errorEmitter=new kd.Emitter,this.closeEmitter=new kd.Emitter,this.partialMessageEmitter=new kd.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=ks;var Sd;(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,xd.default)().applicationJson.decoder,u.set(s.name,s)),{charset:n,contentDecoder:o,contentDecoders:a,contentTypeDecoder:s,contentTypeDecoders:u}}r.fromOptions=e})(Sd||(Sd={}));var Nd=class extends ks{constructor(e,t){super(),this.readable=e,this.options=Sd.fromOptions(t),this.buffer=(0,xd.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,xd.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=Nd});var Cy=C(xs=>{"use strict";Object.defineProperty(xs,"__esModule",{value:!0});xs.Semaphore=void 0;var bC=Mn(),Dd=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,bC.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()}}};xs.Semaphore=Dd});var Sy=C(qn=>{"use strict";Object.defineProperty(qn,"__esModule",{value:!0});qn.WriteableStreamMessageWriter=qn.AbstractMessageWriter=qn.MessageWriter=void 0;var Py=Mn(),sa=oo(),EC=Cy(),ky=so(),CC="Content-Length: ",xy=`\r
|
|
3
|
-
`,
|
|
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(
|
|
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
|
|
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:
|
|
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
|
-
`),B.log(`Sending request '${b.method} - (${b.id})'.`,O)}else _r("send-request",b)}function
|
|
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)}
|
|
8
8
|
|
|
9
9
|
`:O=`No parameters provided.
|
|
10
10
|
|
|
11
|
-
`),B.log(`Sending notification '${b.method}'.`,O)}else _r("send-notification",b)}function
|
|
11
|
+
`),B.log(`Sending notification '${b.method}'.`,O)}else _r("send-notification",b)}function un(b,O,j){if(!(R===Se.Off||!B))if(D===jr.Text){let z;(R===Se.Verbose||R===Se.Compact)&&(b.error&&b.error.data?z=`Error data: ${xt(b.error.data)}
|
|
12
12
|
|
|
13
13
|
`:b.result?z=`Result: ${xt(b.result)}
|
|
14
14
|
|
|
@@ -16,21 +16,21 @@ ${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
|
|
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)}
|
|
20
20
|
|
|
21
21
|
`:O=`No parameters provided.
|
|
22
22
|
|
|
23
|
-
`),B.log(`Received notification '${b.method}'.`,O)}else _r("receive-notification",b)}function
|
|
23
|
+
`),B.log(`Received notification '${b.method}'.`,O)}else _r("receive-notification",b)}function Pi(b,O){if(!(R===Se.Off||!B))if(D===jr.Text){let j;if((R===Se.Verbose||R===Se.Compact)&&(b.error&&b.error.data?j=`Error data: ${xt(b.error.data)}
|
|
24
24
|
|
|
25
25
|
`:b.result?j=`Result: ${xt(b.result)}
|
|
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 un(){if(Ae())throw new ni(Ns.Closed,"Connection is closed.");if(Ue())throw new ni(Ns.Disposed,"Connection is disposed.")}function eo(){if(ie())throw new ni(Ns.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 cn(b){return b!=null&&!Array.isArray(b)&&typeof b=="object"}function Ar(b,O){switch(b){case Q.ParameterStructures.auto:return cn(O)?ut(O):[Lr(O)];case Q.ParameterStructures.byName:if(!cn(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)=>{un();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 Ei(Oe),e.write(Oe).catch(()=>i.error("Sending notification failed."))},onNotification:(b,O)=>{un();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(h.has(O))throw new Error(`Progress handler for token ${O} already registered`);return h.set(O,j),{dispose:()=>{h.delete(O)}}},sendProgress:(b,O,j)=>ri.sendNotification(ca.type,{token:O,value:j}),onUnhandledProgress:Ze.event,sendRequest:(b,...O)=>{un(),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 Ht=O.length;Od.CancellationToken.is(He)&&(Ht=Ht-1,Oe=He);let On=Ht-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,Ht).map(ln=>Lr(ln));break}}else{let le=O;j=b.method,z=to(b,le);let He=b.numberOfParams;Oe=Od.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=ln=>{le(ln),L.sender.cleanup($e),Qe?.dispose()},Ht=ln=>{He(ln),L.sender.cleanup($e),Qe?.dispose()},On={method:j,timerStart:Date.now(),resolve:pt,reject:Ht};ia(ve);try{e.write(ve).catch(()=>i.error("Sending request failed."))}catch(ln){On.reject(new Q.ResponseError(Q.ErrorCodes.MessageWriteError,ln.message?ln.message:"Unknown reason")),On=null}On&&x.set($e,On)})},onRequest:(b,O)=>{un();let j=null;return Md.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(Iy.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 Dy.LinkedMap,Et.func(e.dispose)&&e.dispose(),Et.func(r.dispose)&&r.dispose()},listen:()=>{un(),eo(),V=Gr.Listening,r.listen(Qt)},inspect:()=>{(0,Ny.default)().console.log("inspect")}};return ri.onNotification(Ld.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(ca.type,b=>{let O=h.get(b.token);O?O(b.value):Ze.fire(b)}),ri}J.createMessageConnection=SC});var Wd=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=Td();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 Gd=_d();Object.defineProperty(w,"LinkedMap",{enumerable:!0,get:function(){return Gd.LinkedMap}});Object.defineProperty(w,"LRUCache",{enumerable:!0,get:function(){return Gd.LRUCache}});Object.defineProperty(w,"Touch",{enumerable:!0,get:function(){return Gd.Touch}});var NC=Kl();Object.defineProperty(w,"Disposable",{enumerable:!0,get:function(){return NC.Disposable}});var My=so();Object.defineProperty(w,"Event",{enumerable:!0,get:function(){return My.Event}});Object.defineProperty(w,"Emitter",{enumerable:!0,get:function(){return My.Emitter}});var Ly=Pd();Object.defineProperty(w,"CancellationTokenSource",{enumerable:!0,get:function(){return Ly.CancellationTokenSource}});Object.defineProperty(w,"CancellationToken",{enumerable:!0,get:function(){return Ly.CancellationToken}});var Ud=Ey();Object.defineProperty(w,"MessageReader",{enumerable:!0,get:function(){return Ud.MessageReader}});Object.defineProperty(w,"AbstractMessageReader",{enumerable:!0,get:function(){return Ud.AbstractMessageReader}});Object.defineProperty(w,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return Ud.ReadableStreamMessageReader}});var Hd=Sy();Object.defineProperty(w,"MessageWriter",{enumerable:!0,get:function(){return Hd.MessageWriter}});Object.defineProperty(w,"AbstractMessageWriter",{enumerable:!0,get:function(){return Hd.AbstractMessageWriter}});Object.defineProperty(w,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return Hd.WriteableStreamMessageWriter}});var Kt=$y();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 DC=Mn();w.RAL=DC.default});var fn=C(be=>{"use strict";var wC=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]}),IC=be&&be.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&wC(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=Ty();co.default.install();var dn=Wd(),Fy=require("path"),OC=require("os"),$C=require("crypto"),Is=require("net");IC(Wd(),be);var Kd=class extends dn.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),dn.Disposable.create(()=>this.process.off("message",e))}};be.IPCMessageReader=Kd;var Bd=class extends dn.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=Bd;var Ni=class extends dn.ReadableStreamMessageReader{constructor(e,t="utf-8"){super((0,co.default)().stream.asReadableStream(e),t)}};be.SocketMessageReader=Ni;var Di=class extends dn.WriteableStreamMessageWriter{constructor(e,t){super((0,co.default)().stream.asWritableStream(e),t),this.socket=e}dispose(){super.dispose(),this.socket.destroy()}};be.SocketMessageWriter=Di;var Ds=class extends dn.ReadableStreamMessageReader{constructor(e,t){super((0,co.default)().stream.asReadableStream(e),t)}};be.StreamMessageReader=Ds;var ws=class extends dn.WriteableStreamMessageWriter{constructor(e,t){super((0,co.default)().stream.asWritableStream(e),t)}};be.StreamMessageWriter=ws;var qy=process.env.XDG_RUNTIME_DIR,MC=new Map([["linux",107],["darwin",103]]);function LC(){let r=(0,$C.randomBytes)(21).toString("hex");if(process.platform==="win32")return`\\\\.\\pipe\\vscode-jsonrpc-${r}-sock`;let e;qy?e=Fy.join(qy,`vscode-ipc-${r}.sock`):e=Fy.join(OC.tmpdir(),`vscode-${r}.sock`);let t=MC.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=LC;function FC(r,e="utf-8"){let t,n=new Promise((i,o)=>{t=i});return new Promise((i,o)=>{let a=(0,Is.createServer)(s=>{a.close(),t([new Ni(s,e),new Di(s,e)])});a.on("error",o),a.listen(r,()=>{a.removeListener("error",o),i({onConnected:()=>n})})})}be.createClientPipeTransport=FC;function qC(r,e="utf-8"){let t=(0,Is.createConnection)(r);return[new Ni(t,e),new Di(t,e)]}be.createServerPipeTransport=qC;function jC(r,e="utf-8"){let t,n=new Promise((i,o)=>{t=i});return new Promise((i,o)=>{let a=(0,Is.createServer)(s=>{a.close(),t([new Ni(s,e),new Di(s,e)])});a.on("error",o),a.listen(r,"127.0.0.1",()=>{a.removeListener("error",o),i({onConnected:()=>n})})})}be.createClientSocketTransport=jC;function GC(r,e="utf-8"){let t=(0,Is.createConnection)(r,"127.0.0.1");return[new Ni(t,e),new Di(t,e)]}be.createServerSocketTransport=GC;function UC(r){let e=r;return e.read!==void 0&&e.addListener!==void 0}function HC(r){let e=r;return e.write!==void 0&&e.addListener!==void 0}function WC(r,e,t,n){t||(t=dn.NullLogger);let i=UC(r)?new Ds(r):r,o=HC(e)?new ws(e):e;return dn.ConnectionStrategy.is(n)&&(n={connectionStrategy:n}),(0,dn.createMessageConnection)(i,o,t,n)}be.createMessageConnection=WC});var zd=C((bF,jy)=>{"use strict";jy.exports=fn()});var lo=C((Gy,Os)=>{(function(r){if(typeof Os=="object"&&typeof Os.exports=="object"){var e=r(require,Gy);e!==void 0&&(Os.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 h;(function(m){m.Comment="comment",m.Imports="imports",m.Region="region"})(h=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 na;(function(m){function E(P){return{label:P}}m.create=E})(na=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 ia;(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})(ia=e.Hover||(e.Hover={}));var Ei;(function(m){function E(P,v){return v?{label:P,documentation:v}:{label:P}}m.create=E})(Ei=e.ParameterInformation||(e.ParameterInformation={}));var sn;(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})(sn=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 Ci;(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})(Ci=e.SymbolKind||(e.SymbolKind={}));var _r;(function(m){m.Deprecated=1})(_r=e.SymbolTag||(e.SymbolTag={}));var un;(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})(un=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 cn;(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})(cn=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(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=[`
|
|
30
30
|
`,`\r
|
|
31
|
-
`,"\r"];var
|
|
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===`
|
|
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,_s){return E.call(de)==="[object Number]"&&ro<=de&&de<=_s}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=fn(),KC;(function(r){r.clientToServer="clientToServer",r.serverToClient="serverToClient",r.both="both"})(KC=tr.MessageDirection||(tr.MessageDirection={}));var Vd=class{constructor(e){this.method=e}};tr.RegistrationType=Vd;var Yd=class extends fo.RequestType0{constructor(e){super(e)}};tr.ProtocolRequestType0=Yd;var Xd=class extends fo.RequestType{constructor(e){super(e,fo.ParameterStructures.byName)}};tr.ProtocolRequestType=Xd;var Jd=class extends fo.NotificationType0{constructor(e){super(e)}};tr.ProtocolNotificationType0=Jd;var Zd=class extends fo.NotificationType{constructor(e){super(e,fo.ParameterStructures.byName)}};tr.ProtocolNotificationType=Zd});var $s=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 BC(r){return r===!0||r===!1}gt.boolean=BC;function Uy(r){return typeof r=="string"||r instanceof String}gt.string=Uy;function zC(r){return typeof r=="number"||r instanceof Number}gt.number=zC;function VC(r){return r instanceof Error}gt.error=VC;function YC(r){return typeof r=="function"}gt.func=YC;function Hy(r){return Array.isArray(r)}gt.array=Hy;function XC(r){return Hy(r)&&r.every(e=>Uy(e))}gt.stringArray=XC;function JC(r,e){return Array.isArray(r)&&r.every(e)}gt.typedArray=JC;function ZC(r){return r!==null&&typeof r=="object"}gt.objectLiteral=ZC});var Ky=C(da=>{"use strict";Object.defineProperty(da,"__esModule",{value:!0});da.ImplementationRequest=void 0;var Wy=it(),QC;(function(r){r.method="textDocument/implementation",r.messageDirection=Wy.MessageDirection.clientToServer,r.type=new Wy.ProtocolRequestType(r.method)})(QC=da.ImplementationRequest||(da.ImplementationRequest={}))});var zy=C(fa=>{"use strict";Object.defineProperty(fa,"__esModule",{value:!0});fa.TypeDefinitionRequest=void 0;var By=it(),eP;(function(r){r.method="textDocument/typeDefinition",r.messageDirection=By.MessageDirection.clientToServer,r.type=new By.ProtocolRequestType(r.method)})(eP=fa.TypeDefinitionRequest||(fa.TypeDefinitionRequest={}))});var Vy=C(ii=>{"use strict";Object.defineProperty(ii,"__esModule",{value:!0});ii.DidChangeWorkspaceFoldersNotification=ii.WorkspaceFoldersRequest=void 0;var Ms=it(),tP;(function(r){r.method="workspace/workspaceFolders",r.messageDirection=Ms.MessageDirection.serverToClient,r.type=new Ms.ProtocolRequestType0(r.method)})(tP=ii.WorkspaceFoldersRequest||(ii.WorkspaceFoldersRequest={}));var rP;(function(r){r.method="workspace/didChangeWorkspaceFolders",r.messageDirection=Ms.MessageDirection.clientToServer,r.type=new Ms.ProtocolNotificationType(r.method)})(rP=ii.DidChangeWorkspaceFoldersNotification||(ii.DidChangeWorkspaceFoldersNotification={}))});var Xy=C(pa=>{"use strict";Object.defineProperty(pa,"__esModule",{value:!0});pa.ConfigurationRequest=void 0;var Yy=it(),nP;(function(r){r.method="workspace/configuration",r.messageDirection=Yy.MessageDirection.serverToClient,r.type=new Yy.ProtocolRequestType(r.method)})(nP=pa.ConfigurationRequest||(pa.ConfigurationRequest={}))});var Jy=C(oi=>{"use strict";Object.defineProperty(oi,"__esModule",{value:!0});oi.ColorPresentationRequest=oi.DocumentColorRequest=void 0;var Ls=it(),iP;(function(r){r.method="textDocument/documentColor",r.messageDirection=Ls.MessageDirection.clientToServer,r.type=new Ls.ProtocolRequestType(r.method)})(iP=oi.DocumentColorRequest||(oi.DocumentColorRequest={}));var oP;(function(r){r.method="textDocument/colorPresentation",r.messageDirection=Ls.MessageDirection.clientToServer,r.type=new Ls.ProtocolRequestType(r.method)})(oP=oi.ColorPresentationRequest||(oi.ColorPresentationRequest={}))});var Qy=C(ma=>{"use strict";Object.defineProperty(ma,"__esModule",{value:!0});ma.FoldingRangeRequest=void 0;var Zy=it(),aP;(function(r){r.method="textDocument/foldingRange",r.messageDirection=Zy.MessageDirection.clientToServer,r.type=new Zy.ProtocolRequestType(r.method)})(aP=ma.FoldingRangeRequest||(ma.FoldingRangeRequest={}))});var tg=C(ha=>{"use strict";Object.defineProperty(ha,"__esModule",{value:!0});ha.DeclarationRequest=void 0;var eg=it(),sP;(function(r){r.method="textDocument/declaration",r.messageDirection=eg.MessageDirection.clientToServer,r.type=new eg.ProtocolRequestType(r.method)})(sP=ha.DeclarationRequest||(ha.DeclarationRequest={}))});var ng=C(ya=>{"use strict";Object.defineProperty(ya,"__esModule",{value:!0});ya.SelectionRangeRequest=void 0;var rg=it(),uP;(function(r){r.method="textDocument/selectionRange",r.messageDirection=rg.MessageDirection.clientToServer,r.type=new rg.ProtocolRequestType(r.method)})(uP=ya.SelectionRangeRequest||(ya.SelectionRangeRequest={}))});var ig=C(Ur=>{"use strict";Object.defineProperty(Ur,"__esModule",{value:!0});Ur.WorkDoneProgressCancelNotification=Ur.WorkDoneProgressCreateRequest=Ur.WorkDoneProgress=void 0;var cP=fn(),Fs=it(),lP;(function(r){r.type=new cP.ProgressType;function e(t){return t===r.type}r.is=e})(lP=Ur.WorkDoneProgress||(Ur.WorkDoneProgress={}));var dP;(function(r){r.method="window/workDoneProgress/create",r.messageDirection=Fs.MessageDirection.serverToClient,r.type=new Fs.ProtocolRequestType(r.method)})(dP=Ur.WorkDoneProgressCreateRequest||(Ur.WorkDoneProgressCreateRequest={}));var fP;(function(r){r.method="window/workDoneProgress/cancel",r.messageDirection=Fs.MessageDirection.clientToServer,r.type=new Fs.ProtocolNotificationType(r.method)})(fP=Ur.WorkDoneProgressCancelNotification||(Ur.WorkDoneProgressCancelNotification={}))});var og=C(Hr=>{"use strict";Object.defineProperty(Hr,"__esModule",{value:!0});Hr.CallHierarchyOutgoingCallsRequest=Hr.CallHierarchyIncomingCallsRequest=Hr.CallHierarchyPrepareRequest=void 0;var po=it(),pP;(function(r){r.method="textDocument/prepareCallHierarchy",r.messageDirection=po.MessageDirection.clientToServer,r.type=new po.ProtocolRequestType(r.method)})(pP=Hr.CallHierarchyPrepareRequest||(Hr.CallHierarchyPrepareRequest={}));var mP;(function(r){r.method="callHierarchy/incomingCalls",r.messageDirection=po.MessageDirection.clientToServer,r.type=new po.ProtocolRequestType(r.method)})(mP=Hr.CallHierarchyIncomingCallsRequest||(Hr.CallHierarchyIncomingCallsRequest={}));var hP;(function(r){r.method="callHierarchy/outgoingCalls",r.messageDirection=po.MessageDirection.clientToServer,r.type=new po.ProtocolRequestType(r.method)})(hP=Hr.CallHierarchyOutgoingCallsRequest||(Hr.CallHierarchyOutgoingCallsRequest={}))});var ag=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(),yP;(function(r){r.Relative="relative"})(yP=vt.TokenFormat||(vt.TokenFormat={}));var qs;(function(r){r.method="textDocument/semanticTokens",r.type=new jn.RegistrationType(r.method)})(qs=vt.SemanticTokensRegistrationType||(vt.SemanticTokensRegistrationType={}));var gP;(function(r){r.method="textDocument/semanticTokens/full",r.messageDirection=jn.MessageDirection.clientToServer,r.type=new jn.ProtocolRequestType(r.method),r.registrationMethod=qs.method})(gP=vt.SemanticTokensRequest||(vt.SemanticTokensRequest={}));var vP;(function(r){r.method="textDocument/semanticTokens/full/delta",r.messageDirection=jn.MessageDirection.clientToServer,r.type=new jn.ProtocolRequestType(r.method),r.registrationMethod=qs.method})(vP=vt.SemanticTokensDeltaRequest||(vt.SemanticTokensDeltaRequest={}));var TP;(function(r){r.method="textDocument/semanticTokens/range",r.messageDirection=jn.MessageDirection.clientToServer,r.type=new jn.ProtocolRequestType(r.method),r.registrationMethod=qs.method})(TP=vt.SemanticTokensRangeRequest||(vt.SemanticTokensRangeRequest={}));var RP;(function(r){r.method="workspace/semanticTokens/refresh",r.messageDirection=jn.MessageDirection.clientToServer,r.type=new jn.ProtocolRequestType0(r.method)})(RP=vt.SemanticTokensRefreshRequest||(vt.SemanticTokensRefreshRequest={}))});var ug=C(ga=>{"use strict";Object.defineProperty(ga,"__esModule",{value:!0});ga.ShowDocumentRequest=void 0;var sg=it(),_P;(function(r){r.method="window/showDocument",r.messageDirection=sg.MessageDirection.serverToClient,r.type=new sg.ProtocolRequestType(r.method)})(_P=ga.ShowDocumentRequest||(ga.ShowDocumentRequest={}))});var lg=C(va=>{"use strict";Object.defineProperty(va,"__esModule",{value:!0});va.LinkedEditingRangeRequest=void 0;var cg=it(),AP;(function(r){r.method="textDocument/linkedEditingRange",r.messageDirection=cg.MessageDirection.clientToServer,r.type=new cg.ProtocolRequestType(r.method)})(AP=va.LinkedEditingRangeRequest||(va.LinkedEditingRangeRequest={}))});var dg=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(),bP;(function(r){r.file="file",r.folder="folder"})(bP=ot.FileOperationPatternKind||(ot.FileOperationPatternKind={}));var EP;(function(r){r.method="workspace/willCreateFiles",r.messageDirection=br.MessageDirection.clientToServer,r.type=new br.ProtocolRequestType(r.method)})(EP=ot.WillCreateFilesRequest||(ot.WillCreateFilesRequest={}));var CP;(function(r){r.method="workspace/didCreateFiles",r.messageDirection=br.MessageDirection.clientToServer,r.type=new br.ProtocolNotificationType(r.method)})(CP=ot.DidCreateFilesNotification||(ot.DidCreateFilesNotification={}));var PP;(function(r){r.method="workspace/willRenameFiles",r.messageDirection=br.MessageDirection.clientToServer,r.type=new br.ProtocolRequestType(r.method)})(PP=ot.WillRenameFilesRequest||(ot.WillRenameFilesRequest={}));var kP;(function(r){r.method="workspace/didRenameFiles",r.messageDirection=br.MessageDirection.clientToServer,r.type=new br.ProtocolNotificationType(r.method)})(kP=ot.DidRenameFilesNotification||(ot.DidRenameFilesNotification={}));var xP;(function(r){r.method="workspace/didDeleteFiles",r.messageDirection=br.MessageDirection.clientToServer,r.type=new br.ProtocolNotificationType(r.method)})(xP=ot.DidDeleteFilesNotification||(ot.DidDeleteFilesNotification={}));var SP;(function(r){r.method="workspace/willDeleteFiles",r.messageDirection=br.MessageDirection.clientToServer,r.type=new br.ProtocolRequestType(r.method)})(SP=ot.WillDeleteFilesRequest||(ot.WillDeleteFilesRequest={}))});var pg=C(Wr=>{"use strict";Object.defineProperty(Wr,"__esModule",{value:!0});Wr.MonikerRequest=Wr.MonikerKind=Wr.UniquenessLevel=void 0;var fg=it(),NP;(function(r){r.document="document",r.project="project",r.group="group",r.scheme="scheme",r.global="global"})(NP=Wr.UniquenessLevel||(Wr.UniquenessLevel={}));var DP;(function(r){r.$import="import",r.$export="export",r.local="local"})(DP=Wr.MonikerKind||(Wr.MonikerKind={}));var wP;(function(r){r.method="textDocument/moniker",r.messageDirection=fg.MessageDirection.clientToServer,r.type=new fg.ProtocolRequestType(r.method)})(wP=Wr.MonikerRequest||(Wr.MonikerRequest={}))});var mg=C(Kr=>{"use strict";Object.defineProperty(Kr,"__esModule",{value:!0});Kr.TypeHierarchySubtypesRequest=Kr.TypeHierarchySupertypesRequest=Kr.TypeHierarchyPrepareRequest=void 0;var mo=it(),IP;(function(r){r.method="textDocument/prepareTypeHierarchy",r.messageDirection=mo.MessageDirection.clientToServer,r.type=new mo.ProtocolRequestType(r.method)})(IP=Kr.TypeHierarchyPrepareRequest||(Kr.TypeHierarchyPrepareRequest={}));var OP;(function(r){r.method="typeHierarchy/supertypes",r.messageDirection=mo.MessageDirection.clientToServer,r.type=new mo.ProtocolRequestType(r.method)})(OP=Kr.TypeHierarchySupertypesRequest||(Kr.TypeHierarchySupertypesRequest={}));var $P;(function(r){r.method="typeHierarchy/subtypes",r.messageDirection=mo.MessageDirection.clientToServer,r.type=new mo.ProtocolRequestType(r.method)})($P=Kr.TypeHierarchySubtypesRequest||(Kr.TypeHierarchySubtypesRequest={}))});var hg=C(ai=>{"use strict";Object.defineProperty(ai,"__esModule",{value:!0});ai.InlineValueRefreshRequest=ai.InlineValueRequest=void 0;var js=it(),MP;(function(r){r.method="textDocument/inlineValue",r.messageDirection=js.MessageDirection.clientToServer,r.type=new js.ProtocolRequestType(r.method)})(MP=ai.InlineValueRequest||(ai.InlineValueRequest={}));var LP;(function(r){r.method="workspace/inlineValue/refresh",r.messageDirection=js.MessageDirection.clientToServer,r.type=new js.ProtocolRequestType0(r.method)})(LP=ai.InlineValueRefreshRequest||(ai.InlineValueRefreshRequest={}))});var yg=C(Br=>{"use strict";Object.defineProperty(Br,"__esModule",{value:!0});Br.InlayHintRefreshRequest=Br.InlayHintResolveRequest=Br.InlayHintRequest=void 0;var ho=it(),FP;(function(r){r.method="textDocument/inlayHint",r.messageDirection=ho.MessageDirection.clientToServer,r.type=new ho.ProtocolRequestType(r.method)})(FP=Br.InlayHintRequest||(Br.InlayHintRequest={}));var qP;(function(r){r.method="inlayHint/resolve",r.messageDirection=ho.MessageDirection.clientToServer,r.type=new ho.ProtocolRequestType(r.method)})(qP=Br.InlayHintResolveRequest||(Br.InlayHintResolveRequest={}));var jP;(function(r){r.method="workspace/inlayHint/refresh",r.messageDirection=ho.MessageDirection.clientToServer,r.type=new ho.ProtocolRequestType0(r.method)})(jP=Br.InlayHintRefreshRequest||(Br.InlayHintRefreshRequest={}))});var vg=C(Ot=>{"use strict";Object.defineProperty(Ot,"__esModule",{value:!0});Ot.DiagnosticRefreshRequest=Ot.WorkspaceDiagnosticRequest=Ot.DocumentDiagnosticRequest=Ot.DocumentDiagnosticReportKind=Ot.DiagnosticServerCancellationData=void 0;var gg=fn(),GP=$s(),yo=it(),UP;(function(r){function e(t){let n=t;return n&&GP.boolean(n.retriggerRequest)}r.is=e})(UP=Ot.DiagnosticServerCancellationData||(Ot.DiagnosticServerCancellationData={}));var HP;(function(r){r.Full="full",r.Unchanged="unchanged"})(HP=Ot.DocumentDiagnosticReportKind||(Ot.DocumentDiagnosticReportKind={}));var WP;(function(r){r.method="textDocument/diagnostic",r.messageDirection=yo.MessageDirection.clientToServer,r.type=new yo.ProtocolRequestType(r.method),r.partialResult=new gg.ProgressType})(WP=Ot.DocumentDiagnosticRequest||(Ot.DocumentDiagnosticRequest={}));var KP;(function(r){r.method="workspace/diagnostic",r.messageDirection=yo.MessageDirection.clientToServer,r.type=new yo.ProtocolRequestType(r.method),r.partialResult=new gg.ProgressType})(KP=Ot.WorkspaceDiagnosticRequest||(Ot.WorkspaceDiagnosticRequest={}));var BP;(function(r){r.method="workspace/diagnostic/refresh",r.messageDirection=yo.MessageDirection.clientToServer,r.type=new yo.ProtocolRequestType0(r.method)})(BP=Ot.DiagnosticRefreshRequest||(Ot.DiagnosticRefreshRequest={}))});var _g=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 Ta=lo(),zr=$s(),pn=it(),Tg;(function(r){r.Markup=1,r.Code=2;function e(t){return t===1||t===2}r.is=e})(Tg=Te.NotebookCellKind||(Te.NotebookCellKind={}));var Rg;(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)&&Ta.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})(Rg=Te.ExecutionSummary||(Te.ExecutionSummary={}));var Qd;(function(r){function e(o,a){return{kind:o,document:a}}r.create=e;function t(o){let a=o;return zr.objectLiteral(a)&&Tg.is(a.kind)&&Ta.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)&&!Rg.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}})(Qd=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)&&Ta.integer.is(i.version)&&zr.typedArray(i.cells,Qd.is)}r.is=t})(zP=Te.NotebookDocument||(Te.NotebookDocument={}));var Ra;(function(r){r.method="notebookDocument/sync",r.messageDirection=pn.MessageDirection.clientToServer,r.type=new pn.RegistrationType(r.method)})(Ra=Te.NotebookDocumentSyncRegistrationType||(Te.NotebookDocumentSyncRegistrationType={}));var VP;(function(r){r.method="notebookDocument/didOpen",r.messageDirection=pn.MessageDirection.clientToServer,r.type=new pn.ProtocolNotificationType(r.method),r.registrationMethod=Ra.method})(VP=Te.DidOpenNotebookDocumentNotification||(Te.DidOpenNotebookDocumentNotification={}));var YP;(function(r){function e(n){let i=n;return zr.objectLiteral(i)&&Ta.uinteger.is(i.start)&&Ta.uinteger.is(i.deleteCount)&&(i.cells===void 0||zr.typedArray(i.cells,Qd.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})(YP=Te.NotebookCellArrayChange||(Te.NotebookCellArrayChange={}));var XP;(function(r){r.method="notebookDocument/didChange",r.messageDirection=pn.MessageDirection.clientToServer,r.type=new pn.ProtocolNotificationType(r.method),r.registrationMethod=Ra.method})(XP=Te.DidChangeNotebookDocumentNotification||(Te.DidChangeNotebookDocumentNotification={}));var JP;(function(r){r.method="notebookDocument/didSave",r.messageDirection=pn.MessageDirection.clientToServer,r.type=new pn.ProtocolNotificationType(r.method),r.registrationMethod=Ra.method})(JP=Te.DidSaveNotebookDocumentNotification||(Te.DidSaveNotebookDocumentNotification={}));var ZP;(function(r){r.method="notebookDocument/didClose",r.messageDirection=pn.MessageDirection.clientToServer,r.type=new pn.ProtocolNotificationType(r.method),r.registrationMethod=Ra.method})(ZP=Te.DidCloseNotebookDocumentNotification||(Te.DidCloseNotebookDocumentNotification={}))});var Ng=C(y=>{"use strict";Object.defineProperty(y,"__esModule",{value:!0});y.WorkspaceSymbolRequest=y.CodeActionResolveRequest=y.CodeActionRequest=y.DocumentSymbolRequest=y.DocumentHighlightRequest=y.ReferencesRequest=y.DefinitionRequest=y.SignatureHelpRequest=y.SignatureHelpTriggerKind=y.HoverRequest=y.CompletionResolveRequest=y.CompletionRequest=y.CompletionTriggerKind=y.PublishDiagnosticsNotification=y.WatchKind=y.RelativePattern=y.FileChangeType=y.DidChangeWatchedFilesNotification=y.WillSaveTextDocumentWaitUntilRequest=y.WillSaveTextDocumentNotification=y.TextDocumentSaveReason=y.DidSaveTextDocumentNotification=y.DidCloseTextDocumentNotification=y.DidChangeTextDocumentNotification=y.TextDocumentContentChangeEvent=y.DidOpenTextDocumentNotification=y.TextDocumentSyncKind=y.TelemetryEventNotification=y.LogMessageNotification=y.ShowMessageRequest=y.ShowMessageNotification=y.MessageType=y.DidChangeConfigurationNotification=y.ExitNotification=y.ShutdownRequest=y.InitializedNotification=y.InitializeErrorCodes=y.InitializeRequest=y.WorkDoneProgressOptions=y.TextDocumentRegistrationOptions=y.StaticRegistrationOptions=y.PositionEncodingKind=y.FailureHandlingKind=y.ResourceOperationKind=y.UnregistrationRequest=y.RegistrationRequest=y.DocumentSelector=y.NotebookCellTextDocumentFilter=y.NotebookDocumentFilter=y.TextDocumentFilter=void 0;y.TypeHierarchySubtypesRequest=y.TypeHierarchyPrepareRequest=y.MonikerRequest=y.MonikerKind=y.UniquenessLevel=y.WillDeleteFilesRequest=y.DidDeleteFilesNotification=y.WillRenameFilesRequest=y.DidRenameFilesNotification=y.WillCreateFilesRequest=y.DidCreateFilesNotification=y.FileOperationPatternKind=y.LinkedEditingRangeRequest=y.ShowDocumentRequest=y.SemanticTokensRegistrationType=y.SemanticTokensRefreshRequest=y.SemanticTokensRangeRequest=y.SemanticTokensDeltaRequest=y.SemanticTokensRequest=y.TokenFormat=y.CallHierarchyPrepareRequest=y.CallHierarchyOutgoingCallsRequest=y.CallHierarchyIncomingCallsRequest=y.WorkDoneProgressCancelNotification=y.WorkDoneProgressCreateRequest=y.WorkDoneProgress=y.SelectionRangeRequest=y.DeclarationRequest=y.FoldingRangeRequest=y.ColorPresentationRequest=y.DocumentColorRequest=y.ConfigurationRequest=y.DidChangeWorkspaceFoldersNotification=y.WorkspaceFoldersRequest=y.TypeDefinitionRequest=y.ImplementationRequest=y.ApplyWorkspaceEditRequest=y.ExecuteCommandRequest=y.PrepareRenameRequest=y.RenameRequest=y.PrepareSupportDefaultBehavior=y.DocumentOnTypeFormattingRequest=y.DocumentRangeFormattingRequest=y.DocumentFormattingRequest=y.DocumentLinkResolveRequest=y.DocumentLinkRequest=y.CodeLensRefreshRequest=y.CodeLensResolveRequest=y.CodeLensRequest=y.WorkspaceSymbolResolveRequest=void 0;y.DidCloseNotebookDocumentNotification=y.DidSaveNotebookDocumentNotification=y.DidChangeNotebookDocumentNotification=y.NotebookCellArrayChange=y.DidOpenNotebookDocumentNotification=y.NotebookDocumentSyncRegistrationType=y.NotebookDocument=y.NotebookCell=y.ExecutionSummary=y.NotebookCellKind=y.DiagnosticRefreshRequest=y.WorkspaceDiagnosticRequest=y.DocumentDiagnosticRequest=y.DocumentDiagnosticReportKind=y.DiagnosticServerCancellationData=y.InlayHintRefreshRequest=y.InlayHintResolveRequest=y.InlayHintRequest=y.InlineValueRefreshRequest=y.InlineValueRequest=y.TypeHierarchySupertypesRequest=void 0;var q=it(),Ag=lo(),$t=$s(),QP=Ky();Object.defineProperty(y,"ImplementationRequest",{enumerable:!0,get:function(){return QP.ImplementationRequest}});var ek=zy();Object.defineProperty(y,"TypeDefinitionRequest",{enumerable:!0,get:function(){return ek.TypeDefinitionRequest}});var bg=Vy();Object.defineProperty(y,"WorkspaceFoldersRequest",{enumerable:!0,get:function(){return bg.WorkspaceFoldersRequest}});Object.defineProperty(y,"DidChangeWorkspaceFoldersNotification",{enumerable:!0,get:function(){return bg.DidChangeWorkspaceFoldersNotification}});var tk=Xy();Object.defineProperty(y,"ConfigurationRequest",{enumerable:!0,get:function(){return tk.ConfigurationRequest}});var Eg=Jy();Object.defineProperty(y,"DocumentColorRequest",{enumerable:!0,get:function(){return Eg.DocumentColorRequest}});Object.defineProperty(y,"ColorPresentationRequest",{enumerable:!0,get:function(){return Eg.ColorPresentationRequest}});var rk=Qy();Object.defineProperty(y,"FoldingRangeRequest",{enumerable:!0,get:function(){return rk.FoldingRangeRequest}});var nk=tg();Object.defineProperty(y,"DeclarationRequest",{enumerable:!0,get:function(){return nk.DeclarationRequest}});var ik=ng();Object.defineProperty(y,"SelectionRangeRequest",{enumerable:!0,get:function(){return ik.SelectionRangeRequest}});var ef=ig();Object.defineProperty(y,"WorkDoneProgress",{enumerable:!0,get:function(){return ef.WorkDoneProgress}});Object.defineProperty(y,"WorkDoneProgressCreateRequest",{enumerable:!0,get:function(){return ef.WorkDoneProgressCreateRequest}});Object.defineProperty(y,"WorkDoneProgressCancelNotification",{enumerable:!0,get:function(){return ef.WorkDoneProgressCancelNotification}});var tf=og();Object.defineProperty(y,"CallHierarchyIncomingCallsRequest",{enumerable:!0,get:function(){return tf.CallHierarchyIncomingCallsRequest}});Object.defineProperty(y,"CallHierarchyOutgoingCallsRequest",{enumerable:!0,get:function(){return tf.CallHierarchyOutgoingCallsRequest}});Object.defineProperty(y,"CallHierarchyPrepareRequest",{enumerable:!0,get:function(){return tf.CallHierarchyPrepareRequest}});var go=ag();Object.defineProperty(y,"TokenFormat",{enumerable:!0,get:function(){return go.TokenFormat}});Object.defineProperty(y,"SemanticTokensRequest",{enumerable:!0,get:function(){return go.SemanticTokensRequest}});Object.defineProperty(y,"SemanticTokensDeltaRequest",{enumerable:!0,get:function(){return go.SemanticTokensDeltaRequest}});Object.defineProperty(y,"SemanticTokensRangeRequest",{enumerable:!0,get:function(){return go.SemanticTokensRangeRequest}});Object.defineProperty(y,"SemanticTokensRefreshRequest",{enumerable:!0,get:function(){return go.SemanticTokensRefreshRequest}});Object.defineProperty(y,"SemanticTokensRegistrationType",{enumerable:!0,get:function(){return go.SemanticTokensRegistrationType}});var ok=ug();Object.defineProperty(y,"ShowDocumentRequest",{enumerable:!0,get:function(){return ok.ShowDocumentRequest}});var ak=lg();Object.defineProperty(y,"LinkedEditingRangeRequest",{enumerable:!0,get:function(){return ak.LinkedEditingRangeRequest}});var wi=dg();Object.defineProperty(y,"FileOperationPatternKind",{enumerable:!0,get:function(){return wi.FileOperationPatternKind}});Object.defineProperty(y,"DidCreateFilesNotification",{enumerable:!0,get:function(){return wi.DidCreateFilesNotification}});Object.defineProperty(y,"WillCreateFilesRequest",{enumerable:!0,get:function(){return wi.WillCreateFilesRequest}});Object.defineProperty(y,"DidRenameFilesNotification",{enumerable:!0,get:function(){return wi.DidRenameFilesNotification}});Object.defineProperty(y,"WillRenameFilesRequest",{enumerable:!0,get:function(){return wi.WillRenameFilesRequest}});Object.defineProperty(y,"DidDeleteFilesNotification",{enumerable:!0,get:function(){return wi.DidDeleteFilesNotification}});Object.defineProperty(y,"WillDeleteFilesRequest",{enumerable:!0,get:function(){return wi.WillDeleteFilesRequest}});var rf=pg();Object.defineProperty(y,"UniquenessLevel",{enumerable:!0,get:function(){return rf.UniquenessLevel}});Object.defineProperty(y,"MonikerKind",{enumerable:!0,get:function(){return rf.MonikerKind}});Object.defineProperty(y,"MonikerRequest",{enumerable:!0,get:function(){return rf.MonikerRequest}});var nf=mg();Object.defineProperty(y,"TypeHierarchyPrepareRequest",{enumerable:!0,get:function(){return nf.TypeHierarchyPrepareRequest}});Object.defineProperty(y,"TypeHierarchySubtypesRequest",{enumerable:!0,get:function(){return nf.TypeHierarchySubtypesRequest}});Object.defineProperty(y,"TypeHierarchySupertypesRequest",{enumerable:!0,get:function(){return nf.TypeHierarchySupertypesRequest}});var Cg=hg();Object.defineProperty(y,"InlineValueRequest",{enumerable:!0,get:function(){return Cg.InlineValueRequest}});Object.defineProperty(y,"InlineValueRefreshRequest",{enumerable:!0,get:function(){return Cg.InlineValueRefreshRequest}});var of=yg();Object.defineProperty(y,"InlayHintRequest",{enumerable:!0,get:function(){return of.InlayHintRequest}});Object.defineProperty(y,"InlayHintResolveRequest",{enumerable:!0,get:function(){return of.InlayHintResolveRequest}});Object.defineProperty(y,"InlayHintRefreshRequest",{enumerable:!0,get:function(){return of.InlayHintRefreshRequest}});var _a=vg();Object.defineProperty(y,"DiagnosticServerCancellationData",{enumerable:!0,get:function(){return _a.DiagnosticServerCancellationData}});Object.defineProperty(y,"DocumentDiagnosticReportKind",{enumerable:!0,get:function(){return _a.DocumentDiagnosticReportKind}});Object.defineProperty(y,"DocumentDiagnosticRequest",{enumerable:!0,get:function(){return _a.DocumentDiagnosticRequest}});Object.defineProperty(y,"WorkspaceDiagnosticRequest",{enumerable:!0,get:function(){return _a.WorkspaceDiagnosticRequest}});Object.defineProperty(y,"DiagnosticRefreshRequest",{enumerable:!0,get:function(){return _a.DiagnosticRefreshRequest}});var mn=_g();Object.defineProperty(y,"NotebookCellKind",{enumerable:!0,get:function(){return mn.NotebookCellKind}});Object.defineProperty(y,"ExecutionSummary",{enumerable:!0,get:function(){return mn.ExecutionSummary}});Object.defineProperty(y,"NotebookCell",{enumerable:!0,get:function(){return mn.NotebookCell}});Object.defineProperty(y,"NotebookDocument",{enumerable:!0,get:function(){return mn.NotebookDocument}});Object.defineProperty(y,"NotebookDocumentSyncRegistrationType",{enumerable:!0,get:function(){return mn.NotebookDocumentSyncRegistrationType}});Object.defineProperty(y,"DidOpenNotebookDocumentNotification",{enumerable:!0,get:function(){return mn.DidOpenNotebookDocumentNotification}});Object.defineProperty(y,"NotebookCellArrayChange",{enumerable:!0,get:function(){return mn.NotebookCellArrayChange}});Object.defineProperty(y,"DidChangeNotebookDocumentNotification",{enumerable:!0,get:function(){return mn.DidChangeNotebookDocumentNotification}});Object.defineProperty(y,"DidSaveNotebookDocumentNotification",{enumerable:!0,get:function(){return mn.DidSaveNotebookDocumentNotification}});Object.defineProperty(y,"DidCloseNotebookDocumentNotification",{enumerable:!0,get:function(){return mn.DidCloseNotebookDocumentNotification}});var Pg;(function(r){function e(t){let n=t;return $t.string(n.language)||$t.string(n.scheme)||$t.string(n.pattern)}r.is=e})(Pg=y.TextDocumentFilter||(y.TextDocumentFilter={}));var kg;(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})(kg=y.NotebookDocumentFilter||(y.NotebookDocumentFilter={}));var xg;(function(r){function e(t){let n=t;return $t.objectLiteral(n)&&($t.string(n.notebook)||kg.is(n.notebook))&&(n.language===void 0||$t.string(n.language))}r.is=e})(xg=y.NotebookCellTextDocumentFilter||(y.NotebookCellTextDocumentFilter={}));var Sg;(function(r){function e(t){if(!Array.isArray(t))return!1;for(let n of t)if(!$t.string(n)&&!Pg.is(n)&&!xg.is(n))return!1;return!0}r.is=e})(Sg=y.DocumentSelector||(y.DocumentSelector={}));var sk;(function(r){r.method="client/registerCapability",r.messageDirection=q.MessageDirection.serverToClient,r.type=new q.ProtocolRequestType(r.method)})(sk=y.RegistrationRequest||(y.RegistrationRequest={}));var uk;(function(r){r.method="client/unregisterCapability",r.messageDirection=q.MessageDirection.serverToClient,r.type=new q.ProtocolRequestType(r.method)})(uk=y.UnregistrationRequest||(y.UnregistrationRequest={}));var ck;(function(r){r.Create="create",r.Rename="rename",r.Delete="delete"})(ck=y.ResourceOperationKind||(y.ResourceOperationKind={}));var lk;(function(r){r.Abort="abort",r.Transactional="transactional",r.TextOnlyTransactional="textOnlyTransactional",r.Undo="undo"})(lk=y.FailureHandlingKind||(y.FailureHandlingKind={}));var dk;(function(r){r.UTF8="utf-8",r.UTF16="utf-16",r.UTF32="utf-32"})(dk=y.PositionEncodingKind||(y.PositionEncodingKind={}));var fk;(function(r){function e(t){let n=t;return n&&$t.string(n.id)&&n.id.length>0}r.hasId=e})(fk=y.StaticRegistrationOptions||(y.StaticRegistrationOptions={}));var pk;(function(r){function e(t){let n=t;return n&&(n.documentSelector===null||Sg.is(n.documentSelector))}r.is=e})(pk=y.TextDocumentRegistrationOptions||(y.TextDocumentRegistrationOptions={}));var mk;(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})(mk=y.WorkDoneProgressOptions||(y.WorkDoneProgressOptions={}));var hk;(function(r){r.method="initialize",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(hk=y.InitializeRequest||(y.InitializeRequest={}));var yk;(function(r){r.unknownProtocolVersion=1})(yk=y.InitializeErrorCodes||(y.InitializeErrorCodes={}));var gk;(function(r){r.method="initialized",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolNotificationType(r.method)})(gk=y.InitializedNotification||(y.InitializedNotification={}));var vk;(function(r){r.method="shutdown",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType0(r.method)})(vk=y.ShutdownRequest||(y.ShutdownRequest={}));var Tk;(function(r){r.method="exit",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolNotificationType0(r.method)})(Tk=y.ExitNotification||(y.ExitNotification={}));var Rk;(function(r){r.method="workspace/didChangeConfiguration",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolNotificationType(r.method)})(Rk=y.DidChangeConfigurationNotification||(y.DidChangeConfigurationNotification={}));var _k;(function(r){r.Error=1,r.Warning=2,r.Info=3,r.Log=4})(_k=y.MessageType||(y.MessageType={}));var Ak;(function(r){r.method="window/showMessage",r.messageDirection=q.MessageDirection.serverToClient,r.type=new q.ProtocolNotificationType(r.method)})(Ak=y.ShowMessageNotification||(y.ShowMessageNotification={}));var bk;(function(r){r.method="window/showMessageRequest",r.messageDirection=q.MessageDirection.serverToClient,r.type=new q.ProtocolRequestType(r.method)})(bk=y.ShowMessageRequest||(y.ShowMessageRequest={}));var Ek;(function(r){r.method="window/logMessage",r.messageDirection=q.MessageDirection.serverToClient,r.type=new q.ProtocolNotificationType(r.method)})(Ek=y.LogMessageNotification||(y.LogMessageNotification={}));var Ck;(function(r){r.method="telemetry/event",r.messageDirection=q.MessageDirection.serverToClient,r.type=new q.ProtocolNotificationType(r.method)})(Ck=y.TelemetryEventNotification||(y.TelemetryEventNotification={}));var Pk;(function(r){r.None=0,r.Full=1,r.Incremental=2})(Pk=y.TextDocumentSyncKind||(y.TextDocumentSyncKind={}));var kk;(function(r){r.method="textDocument/didOpen",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolNotificationType(r.method)})(kk=y.DidOpenTextDocumentNotification||(y.DidOpenTextDocumentNotification={}));var xk;(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})(xk=y.TextDocumentContentChangeEvent||(y.TextDocumentContentChangeEvent={}));var Sk;(function(r){r.method="textDocument/didChange",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolNotificationType(r.method)})(Sk=y.DidChangeTextDocumentNotification||(y.DidChangeTextDocumentNotification={}));var Nk;(function(r){r.method="textDocument/didClose",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolNotificationType(r.method)})(Nk=y.DidCloseTextDocumentNotification||(y.DidCloseTextDocumentNotification={}));var Dk;(function(r){r.method="textDocument/didSave",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolNotificationType(r.method)})(Dk=y.DidSaveTextDocumentNotification||(y.DidSaveTextDocumentNotification={}));var wk;(function(r){r.Manual=1,r.AfterDelay=2,r.FocusOut=3})(wk=y.TextDocumentSaveReason||(y.TextDocumentSaveReason={}));var Ik;(function(r){r.method="textDocument/willSave",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolNotificationType(r.method)})(Ik=y.WillSaveTextDocumentNotification||(y.WillSaveTextDocumentNotification={}));var Ok;(function(r){r.method="textDocument/willSaveWaitUntil",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(Ok=y.WillSaveTextDocumentWaitUntilRequest||(y.WillSaveTextDocumentWaitUntilRequest={}));var $k;(function(r){r.method="workspace/didChangeWatchedFiles",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolNotificationType(r.method)})($k=y.DidChangeWatchedFilesNotification||(y.DidChangeWatchedFilesNotification={}));var Mk;(function(r){r.Created=1,r.Changed=2,r.Deleted=3})(Mk=y.FileChangeType||(y.FileChangeType={}));var Lk;(function(r){function e(t){let n=t;return $t.objectLiteral(n)&&(Ag.URI.is(n.baseUri)||Ag.WorkspaceFolder.is(n.baseUri))&&$t.string(n.pattern)}r.is=e})(Lk=y.RelativePattern||(y.RelativePattern={}));var Fk;(function(r){r.Create=1,r.Change=2,r.Delete=4})(Fk=y.WatchKind||(y.WatchKind={}));var qk;(function(r){r.method="textDocument/publishDiagnostics",r.messageDirection=q.MessageDirection.serverToClient,r.type=new q.ProtocolNotificationType(r.method)})(qk=y.PublishDiagnosticsNotification||(y.PublishDiagnosticsNotification={}));var jk;(function(r){r.Invoked=1,r.TriggerCharacter=2,r.TriggerForIncompleteCompletions=3})(jk=y.CompletionTriggerKind||(y.CompletionTriggerKind={}));var Gk;(function(r){r.method="textDocument/completion",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(Gk=y.CompletionRequest||(y.CompletionRequest={}));var Uk;(function(r){r.method="completionItem/resolve",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(Uk=y.CompletionResolveRequest||(y.CompletionResolveRequest={}));var Hk;(function(r){r.method="textDocument/hover",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(Hk=y.HoverRequest||(y.HoverRequest={}));var Wk;(function(r){r.Invoked=1,r.TriggerCharacter=2,r.ContentChange=3})(Wk=y.SignatureHelpTriggerKind||(y.SignatureHelpTriggerKind={}));var Kk;(function(r){r.method="textDocument/signatureHelp",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(Kk=y.SignatureHelpRequest||(y.SignatureHelpRequest={}));var Bk;(function(r){r.method="textDocument/definition",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(Bk=y.DefinitionRequest||(y.DefinitionRequest={}));var zk;(function(r){r.method="textDocument/references",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(zk=y.ReferencesRequest||(y.ReferencesRequest={}));var Vk;(function(r){r.method="textDocument/documentHighlight",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(Vk=y.DocumentHighlightRequest||(y.DocumentHighlightRequest={}));var Yk;(function(r){r.method="textDocument/documentSymbol",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(Yk=y.DocumentSymbolRequest||(y.DocumentSymbolRequest={}));var Xk;(function(r){r.method="textDocument/codeAction",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(Xk=y.CodeActionRequest||(y.CodeActionRequest={}));var Jk;(function(r){r.method="codeAction/resolve",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(Jk=y.CodeActionResolveRequest||(y.CodeActionResolveRequest={}));var Zk;(function(r){r.method="workspace/symbol",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(Zk=y.WorkspaceSymbolRequest||(y.WorkspaceSymbolRequest={}));var Qk;(function(r){r.method="workspaceSymbol/resolve",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(Qk=y.WorkspaceSymbolResolveRequest||(y.WorkspaceSymbolResolveRequest={}));var e0;(function(r){r.method="textDocument/codeLens",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(e0=y.CodeLensRequest||(y.CodeLensRequest={}));var t0;(function(r){r.method="codeLens/resolve",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(t0=y.CodeLensResolveRequest||(y.CodeLensResolveRequest={}));var r0;(function(r){r.method="workspace/codeLens/refresh",r.messageDirection=q.MessageDirection.serverToClient,r.type=new q.ProtocolRequestType0(r.method)})(r0=y.CodeLensRefreshRequest||(y.CodeLensRefreshRequest={}));var n0;(function(r){r.method="textDocument/documentLink",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(n0=y.DocumentLinkRequest||(y.DocumentLinkRequest={}));var i0;(function(r){r.method="documentLink/resolve",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(i0=y.DocumentLinkResolveRequest||(y.DocumentLinkResolveRequest={}));var o0;(function(r){r.method="textDocument/formatting",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(o0=y.DocumentFormattingRequest||(y.DocumentFormattingRequest={}));var a0;(function(r){r.method="textDocument/rangeFormatting",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(a0=y.DocumentRangeFormattingRequest||(y.DocumentRangeFormattingRequest={}));var s0;(function(r){r.method="textDocument/onTypeFormatting",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(s0=y.DocumentOnTypeFormattingRequest||(y.DocumentOnTypeFormattingRequest={}));var u0;(function(r){r.Identifier=1})(u0=y.PrepareSupportDefaultBehavior||(y.PrepareSupportDefaultBehavior={}));var c0;(function(r){r.method="textDocument/rename",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(c0=y.RenameRequest||(y.RenameRequest={}));var l0;(function(r){r.method="textDocument/prepareRename",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(l0=y.PrepareRenameRequest||(y.PrepareRenameRequest={}));var d0;(function(r){r.method="workspace/executeCommand",r.messageDirection=q.MessageDirection.clientToServer,r.type=new q.ProtocolRequestType(r.method)})(d0=y.ExecuteCommandRequest||(y.ExecuteCommandRequest={}));var f0;(function(r){r.method="workspace/applyEdit",r.messageDirection=q.MessageDirection.serverToClient,r.type=new q.ProtocolRequestType("workspace/applyEdit")})(f0=y.ApplyWorkspaceEditRequest||(y.ApplyWorkspaceEditRequest={}))});var wg=C(Gs=>{"use strict";Object.defineProperty(Gs,"__esModule",{value:!0});Gs.createProtocolConnection=void 0;var Dg=fn();function p0(r,e,t,n){return Dg.ConnectionStrategy.is(n)&&(n={connectionStrategy:n}),(0,Dg.createMessageConnection)(r,e,t,n)}Gs.createProtocolConnection=p0});var Ig=C(rr=>{"use strict";var m0=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]}),Us=rr&&rr.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&m0(e,r,t)};Object.defineProperty(rr,"__esModule",{value:!0});rr.LSPErrorCodes=rr.createProtocolConnection=void 0;Us(fn(),rr);Us(lo(),rr);Us(it(),rr);Us(Ng(),rr);var h0=wg();Object.defineProperty(rr,"createProtocolConnection",{enumerable:!0,get:function(){return h0.createProtocolConnection}});var y0;(function(r){r.lspReservedErrorRangeStart=-32899,r.RequestFailed=-32803,r.ServerCancelled=-32802,r.ContentModified=-32801,r.RequestCancelled=-32800,r.lspReservedErrorRangeEnd=-32800})(y0=rr.LSPErrorCodes||(rr.LSPErrorCodes={}))});var Tt=C(hn=>{"use strict";var g0=hn&&hn.__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]}),Og=hn&&hn.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&g0(e,r,t)};Object.defineProperty(hn,"__esModule",{value:!0});hn.createProtocolConnection=void 0;var v0=zd();Og(zd(),hn);Og(Ig(),hn);function T0(r,e,t,n){return(0,v0.createMessageConnection)(r,e,t,n)}hn.createProtocolConnection=T0});var af=C(Er=>{"use strict";Object.defineProperty(Er,"__esModule",{value:!0});Er.generateUuid=Er.parse=Er.isUUID=Er.v4=Er.empty=void 0;var Aa=class{constructor(e){this._value=e}asHex(){return this._value}equals(e){return this.asHex()===e.asHex()}},ne=class extends Aa{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 Aa("00000000-0000-0000-0000-000000000000");function $g(){return new ne}Er.v4=$g;var R0=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Mg(r){return R0.test(r)}Er.isUUID=Mg;function _0(r){if(!Mg(r))throw new Error("invalid uuid");return new Aa(r)}Er.parse=_0;function A0(){return $g().asHex()}Er.generateUuid=A0});var Lg=C(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:!0});ui.attachPartialResult=ui.ProgressFeature=ui.attachWorkDone=void 0;var si=Tt(),b0=af(),yn=class{constructor(e,t){this._connection=e,this._token=t,yn.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(){yn.Instances.delete(this._token),this._connection.sendProgress(si.WorkDoneProgress.type,this._token,{kind:"end"})}};yn.Instances=new Map;var Hs=class extends yn{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()}},ba=class{constructor(){}begin(){}report(){}done(){}},Ws=class extends ba{constructor(){super(),this._source=new si.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose()}cancel(){this._source.cancel()}};function E0(r,e){if(e===void 0||e.workDoneToken===void 0)return new ba;let t=e.workDoneToken;return delete e.workDoneToken,new yn(r,t)}ui.attachWorkDone=E0;var C0=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=yn.Instances.get(t.token);(n instanceof Hs||n instanceof Ws)&&n.cancel()}))}attachWorkDoneProgress(e){return e===void 0?new ba:new yn(this.connection,e)}createWorkDoneProgress(){if(this._progressSupported){let e=(0,b0.generateUuid)();return this.connection.sendRequest(si.WorkDoneProgressCreateRequest.type,{token:e}).then(()=>new Hs(this.connection,e))}else return Promise.resolve(new Ws)}};ui.ProgressFeature=C0;var sf;(function(r){r.type=new si.ProgressType})(sf||(sf={}));var uf=class{constructor(e,t){this._connection=e,this._token=t}report(e){this._connection.sendProgress(sf.type,this._token,e)}};function P0(r,e){if(e===void 0||e.partialResultToken===void 0)return;let t=e.partialResultToken;return delete e.partialResultToken,new uf(r,t)}ui.attachPartialResult=P0});var Fg=C(Ks=>{"use strict";Object.defineProperty(Ks,"__esModule",{value:!0});Ks.ConfigurationFeature=void 0;var k0=Tt(),x0=bs(),S0=r=>class extends r{getConfiguration(e){return e?x0.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(k0.ConfigurationRequest.type,t).then(n=>Array.isArray(n)?Array.isArray(e)?n:n[0]:Array.isArray(e)?[]:null)}};Ks.ConfigurationFeature=S0});var qg=C(zs=>{"use strict";Object.defineProperty(zs,"__esModule",{value:!0});zs.WorkspaceFoldersFeature=void 0;var Bs=Tt(),N0=r=>class extends r{constructor(){super(),this._notificationIsAutoRegistered=!1}initialize(e){super.initialize(e);let t=e.workspace;t&&t.workspaceFolders&&(this._onDidChangeWorkspaceFolders=new Bs.Emitter,this.connection.onNotification(Bs.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(Bs.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(Bs.DidChangeWorkspaceFoldersNotification.type)),this._onDidChangeWorkspaceFolders.event}};zs.WorkspaceFoldersFeature=N0});var jg=C(Vs=>{"use strict";Object.defineProperty(Vs,"__esModule",{value:!0});Vs.CallHierarchyFeature=void 0;var cf=Tt(),D0=r=>class extends r{get callHierarchy(){return{onPrepare:e=>this.connection.onRequest(cf.CallHierarchyPrepareRequest.type,(t,n)=>e(t,n,this.attachWorkDoneProgress(t),void 0)),onIncomingCalls:e=>{let t=cf.CallHierarchyIncomingCallsRequest.type;return this.connection.onRequest(t,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(t,n)))},onOutgoingCalls:e=>{let t=cf.CallHierarchyOutgoingCallsRequest.type;return this.connection.onRequest(t,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(t,n)))}}}};Vs.CallHierarchyFeature=D0});var df=C(ci=>{"use strict";Object.defineProperty(ci,"__esModule",{value:!0});ci.SemanticTokensBuilder=ci.SemanticTokensDiff=ci.SemanticTokensFeature=void 0;var Ys=Tt(),w0=r=>class extends r{get semanticTokens(){return{refresh:()=>this.connection.sendRequest(Ys.SemanticTokensRefreshRequest.type),on:e=>{let t=Ys.SemanticTokensRequest.type;return this.connection.onRequest(t,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(t,n)))},onDelta:e=>{let t=Ys.SemanticTokensDeltaRequest.type;return this.connection.onRequest(t,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(t,n)))},onRange:e=>{let t=Ys.SemanticTokensRangeRequest.type;return this.connection.onRequest(t,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(t,n)))}}}};ci.SemanticTokensFeature=w0;var Xs=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=Xs;var lf=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 Xs(this._prevData,this._data).computeDiff()}:this.build()}};ci.SemanticTokensBuilder=lf});var Gg=C(Js=>{"use strict";Object.defineProperty(Js,"__esModule",{value:!0});Js.ShowDocumentFeature=void 0;var I0=Tt(),O0=r=>class extends r{showDocument(e){return this.connection.sendRequest(I0.ShowDocumentRequest.type,e)}};Js.ShowDocumentFeature=O0});var Ug=C(Zs=>{"use strict";Object.defineProperty(Zs,"__esModule",{value:!0});Zs.FileOperationsFeature=void 0;var vo=Tt(),$0=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))}};Zs.FileOperationsFeature=$0});var Hg=C(Qs=>{"use strict";Object.defineProperty(Qs,"__esModule",{value:!0});Qs.LinkedEditingRangeFeature=void 0;var M0=Tt(),L0=r=>class extends r{onLinkedEditingRange(e){return this.connection.onRequest(M0.LinkedEditingRangeRequest.type,(t,n)=>e(t,n,this.attachWorkDoneProgress(t),void 0))}};Qs.LinkedEditingRangeFeature=L0});var Wg=C(eu=>{"use strict";Object.defineProperty(eu,"__esModule",{value:!0});eu.TypeHierarchyFeature=void 0;var ff=Tt(),F0=r=>class extends r{get typeHierarchy(){return{onPrepare:e=>this.connection.onRequest(ff.TypeHierarchyPrepareRequest.type,(t,n)=>e(t,n,this.attachWorkDoneProgress(t),void 0)),onSupertypes:e=>{let t=ff.TypeHierarchySupertypesRequest.type;return this.connection.onRequest(t,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(t,n)))},onSubtypes:e=>{let t=ff.TypeHierarchySubtypesRequest.type;return this.connection.onRequest(t,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(t,n)))}}}};eu.TypeHierarchyFeature=F0});var Bg=C(tu=>{"use strict";Object.defineProperty(tu,"__esModule",{value:!0});tu.InlineValueFeature=void 0;var Kg=Tt(),q0=r=>class extends r{get inlineValue(){return{refresh:()=>this.connection.sendRequest(Kg.InlineValueRefreshRequest.type),on:e=>this.connection.onRequest(Kg.InlineValueRequest.type,(t,n)=>e(t,n,this.attachWorkDoneProgress(t)))}}};tu.InlineValueFeature=q0});var zg=C(ru=>{"use strict";Object.defineProperty(ru,"__esModule",{value:!0});ru.InlayHintFeature=void 0;var pf=Tt(),j0=r=>class extends r{get inlayHint(){return{refresh:()=>this.connection.sendRequest(pf.InlayHintRefreshRequest.type),on:e=>this.connection.onRequest(pf.InlayHintRequest.type,(t,n)=>e(t,n,this.attachWorkDoneProgress(t))),resolve:e=>this.connection.onRequest(pf.InlayHintResolveRequest.type,(t,n)=>e(t,n))}}};ru.InlayHintFeature=j0});var Vg=C(nu=>{"use strict";Object.defineProperty(nu,"__esModule",{value:!0});nu.DiagnosticFeature=void 0;var Ea=Tt(),G0=r=>class extends r{get diagnostics(){return{refresh:()=>this.connection.sendRequest(Ea.DiagnosticRefreshRequest.type),on:e=>this.connection.onRequest(Ea.DocumentDiagnosticRequest.type,(t,n)=>e(t,n,this.attachWorkDoneProgress(t),this.attachPartialResultProgress(Ea.DocumentDiagnosticRequest.partialResult,t))),onWorkspace:e=>this.connection.onRequest(Ea.WorkspaceDiagnosticRequest.type,(t,n)=>e(t,n,this.attachWorkDoneProgress(t),this.attachPartialResultProgress(Ea.WorkspaceDiagnosticRequest.partialResult,t)))}}};nu.DiagnosticFeature=G0});var hf=C(iu=>{"use strict";Object.defineProperty(iu,"__esModule",{value:!0});iu.TextDocuments=void 0;var Ii=Tt(),mf=class{constructor(e){this._configuration=e,this._syncedDocuments=new Map,this._onDidChangeContent=new Ii.Emitter,this._onDidOpen=new Ii.Emitter,this._onDidClose=new Ii.Emitter,this._onDidSave=new Ii.Emitter,this._onWillSave=new Ii.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=Ii.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}))})),Ii.Disposable.create(()=>{t.forEach(n=>n.dispose())})}};iu.TextDocuments=mf});var gf=C(To=>{"use strict";Object.defineProperty(To,"__esModule",{value:!0});To.NotebookDocuments=To.NotebookSyncFeature=void 0;var Cr=Tt(),Yg=hf(),U0=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=U0;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 yf=class{constructor(e){e instanceof Yg.TextDocuments?this._cellTextDocuments=e:this._cellTextDocuments=new Yg.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 h={notebookDocument:o};s&&(h.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)&&(h.cells={added:p,removed:A,changed:{data:d,textContent:x}}),(h.metadata!==void 0||h.cells!==void 0)&&this._onDidChange.fire(h)})),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=yf});var Xg=C(ou=>{"use strict";Object.defineProperty(ou,"__esModule",{value:!0});ou.MonikerFeature=void 0;var H0=Tt(),W0=r=>class extends r{get moniker(){return{on:e=>{let t=H0.MonikerRequest.type;return this.connection.onRequest(t,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(t,n)))}}}};ou.MonikerFeature=W0});var bf=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=bs(),Tf=af(),te=Lg(),K0=Fg(),B0=qg(),z0=jg(),V0=df(),Y0=Gg(),X0=Ug(),J0=Hg(),Z0=Wg(),Q0=Bg(),ex=zg(),tx=Vg(),rx=gf(),nx=Xg();function vf(r){if(r!==null)return r}var Rf=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=Rf;var au=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")})}},_f=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(vf)}showWarningMessage(e,...t){let n={type:U.MessageType.Warning,message:e,actions:t};return this.connection.sendRequest(U.ShowMessageRequest.type,n).then(vf)}showInformationMessage(e,...t){let n={type:U.MessageType.Info,message:e,actions:t};return this.connection.sendRequest(U.ShowMessageRequest.type,n).then(vf)}},Jg=(0,Y0.ShowDocumentFeature)((0,te.ProgressFeature)(_f)),ix;(function(r){function e(){return new su}r.create=e})(ix=me.BulkRegistration||(me.BulkRegistration={}));var su=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=Tf.generateUuid();this._registrations.push({id:i,method:n,registerOptions:t||{}}),this._registered.add(n)}asRegistrationParams(){return{registrations:this._registrations}}},ox;(function(r){function e(){return new Ca(void 0,[])}r.create=e})(ox=me.BulkUnregistration||(me.BulkUnregistration={}));var Ca=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}},uu=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 su?this.registerMany(e):e instanceof Ca?this.registerSingle1(e,t,n):this.registerSingle2(e,t)}registerSingle1(e,t,n){let i=Pr.string(t)?t:t.method,o=Tf.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=Tf.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 Ca(this._connection,t.registrations.map(n=>({id:n.id,method:n.method}))),n=>(this.connection.console.info("Bulk registration failed."),Promise.reject(n)))}},Af=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)}},Zg=(0,X0.FileOperationsFeature)((0,B0.WorkspaceFoldersFeature)((0,K0.ConfigurationFeature)(Af))),cu=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(()=>{})}},lu=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")})}},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){}attachWorkDoneProgress(e){return(0,te.attachWorkDone)(this.connection,e)}attachPartialResultProgress(e,t){return(0,te.attachPartialResult)(this.connection,t)}};me._LanguagesImpl=du;var Qg=(0,nx.MonikerFeature)((0,tx.DiagnosticFeature)((0,ex.InlayHintFeature)((0,Q0.InlineValueFeature)((0,Z0.TypeHierarchyFeature)((0,J0.LinkedEditingRangeFeature)((0,V0.SemanticTokensFeature)((0,z0.CallHierarchyFeature)(du)))))))),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._NotebooksImpl=fu;var ev=(0,rx.NotebookSyncFeature)(fu);function tv(r,e){return function(t){return e(r(t))}}me.combineConsoleFeatures=tv;function rv(r,e){return function(t){return e(r(t))}}me.combineTelemetryFeatures=rv;function nv(r,e){return function(t){return e(r(t))}}me.combineTracerFeatures=nv;function iv(r,e){return function(t){return e(r(t))}}me.combineClientFeatures=iv;function ov(r,e){return function(t){return e(r(t))}}me.combineWindowFeatures=ov;function av(r,e){return function(t){return e(r(t))}}me.combineWorkspaceFeatures=av;function sv(r,e){return function(t){return e(r(t))}}me.combineLanguagesFeatures=sv;function uv(r,e){return function(t){return e(r(t))}}me.combineNotebooksFeatures=uv;function ax(r,e){function t(i,o,a){return i&&o?a(i,o):i||o}return{__brand:"features",console:t(r.console,e.console,tv),tracer:t(r.tracer,e.tracer,nv),telemetry:t(r.telemetry,e.telemetry,rv),client:t(r.client,e.client,iv),window:t(r.window,e.window,ov),workspace:t(r.workspace,e.workspace,av),languages:t(r.languages,e.languages,sv),notebooks:t(r.notebooks,e.notebooks,uv)}}me.combineFeatures=ax;function sx(r,e,t){let n=t&&t.console?new(t.console(au)):new au,i=r(n);n.rawAttach(i);let o=t&&t.tracer?new(t.tracer(cu)):new cu,a=t&&t.telemetry?new(t.telemetry(lu)):new lu,s=t&&t.client?new(t.client(uu)):new uu,u=t&&t.window?new(t.window(Jg)):new Jg,c=t&&t.workspace?new(t.workspace(Zg)):new Zg,l=t&&t.languages?new(t.languages(Qg)):new Qg,d=t&&t.notebooks?new(t.notebooks(ev)):new ev,g=[n,o,a,s,u,c,l,d];function h(_){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 h(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=sx});var lv=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 ux=require("url"),Vr=require("path"),Ef=require("fs"),kf=require("child_process");function cx(r){let e=ux.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=cx;function Cf(){return process.platform==="win32"}function pu(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&&Ef.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,kf.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=pu;function Pf(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};Cf()&&(e="npm.cmd",n.shell=!0);let i=()=>{};try{process.on("SIGPIPE",i);let o=(0,kf.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?Cf()?Vr.join(a,"node_modules"):Vr.join(a,"lib","node_modules"):void 0}catch{return}finally{process.removeListener("SIGPIPE",i)}}nr.resolveGlobalNodePath=Pf;function lx(r){let e="yarn",t={encoding:"utf8"};Cf()&&(e="yarn.cmd",t.shell=!0);let n=()=>{};try{process.on("SIGPIPE",n);let i=(0,kf.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=lx;var cv;(function(r){let e;function t(){return e!==void 0||(process.platform==="win32"?e=!1:e=!Ef.existsSync(__filename.toUpperCase())||!Ef.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})(cv=nr.FileSystem||(nr.FileSystem={}));function dx(r,e,t,n){return t?(Vr.isAbsolute(t)||(t=Vr.join(r,t)),pu(e,t,t,n).then(i=>cv.isParent(t,i)?i:Promise.reject(new Error(`Failed to load ${e} from node path location.`))).then(void 0,i=>pu(e,Pf(n),r,n))):pu(e,Pf(n),r,n)}nr.resolveModulePath=dx});var xf=C((x1,dv)=>{"use strict";dv.exports=Tt()});var pv=C(Mt=>{"use strict";var fx=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]}),fv=Mt&&Mt.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&fx(e,r,t)};Object.defineProperty(Mt,"__esModule",{value:!0});Mt.ProposedFeatures=Mt.NotebookDocuments=Mt.TextDocuments=Mt.SemanticTokensBuilder=void 0;var px=df();Object.defineProperty(Mt,"SemanticTokensBuilder",{enumerable:!0,get:function(){return px.SemanticTokensBuilder}});fv(Tt(),Mt);var mx=hf();Object.defineProperty(Mt,"TextDocuments",{enumerable:!0,get:function(){return mx.TextDocuments}});var hx=gf();Object.defineProperty(Mt,"NotebookDocuments",{enumerable:!0,get:function(){return hx.NotebookDocuments}});fv(bf(),Mt);var yx;(function(r){r.all={__brand:"features"}})(yx=Mt.ProposedFeatures||(Mt.ProposedFeatures={}))});var Ne=C(gr=>{"use strict";var gx=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]}),hv=gr&&gr.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&gx(e,r,t)};Object.defineProperty(gr,"__esModule",{value:!0});gr.createConnection=gr.Files=void 0;var Sf=bs(),vx=bf(),Pa=lv(),Oi=xf();hv(xf(),gr);hv(pv(),gr);var Tx;(function(r){r.uriToFilePath=Pa.uriToFilePath,r.resolveGlobalNodePath=Pa.resolveGlobalNodePath,r.resolveGlobalYarnPath=Pa.resolveGlobalYarnPath,r.resolve=Pa.resolve,r.resolveModulePath=Pa.resolveModulePath})(Tx=gr.Files||(gr.Files={}));var mv;function mu(){if(mv!==void 0)try{mv.end()}catch{}}var Ro=!1,yv;function Rx(){let r="--clientProcessId";function e(t){try{let n=parseInt(t);isNaN(n)||(yv=setInterval(()=>{try{process.kill(n,0)}catch{mu(),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])}}}Rx();var _x={initialize:r=>{let e=r.processId;Sf.number(e)&&yv===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=>{mu(),process.exit(r)}};function Ax(r,e,t,n){let i,o,a,s;return r!==void 0&&r.__brand==="features"&&(i=r,r=e,e=t,t=n),Oi.ConnectionStrategy.is(r)||Oi.ConnectionOptions.is(r)?s=r:(o=r,a=e,s=t),bx(o,a,s,i)}gr.createConnection=Ax;function bx(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 Oi.IPCMessageReader(process),e=new Oi.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,Oi.createServerSocketTransport)(s);r=l[0],e=l[1]}else if(u){let l=(0,Oi.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(Sf.func(r.read)&&Sf.func(r.on)){let s=r;s.on("end",()=>{mu(),process.exit(Ro?0:1)}),s.on("close",()=>{mu(),process.exit(Ro?0:1)})}let a=s=>(0,Oi.createProtocolConnection)(r,e,s,t);return(0,vx.createConnection)(a,_x,n)}});var yu=C((gv,hu)=>{(function(r){if(typeof hu=="object"&&typeof hu.exports=="object"){var e=r(require,gv);e!==void 0&&(hu.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),h=this.offsetAt(g.start),p=this.offsetAt(g.end);this._content=this._content.substring(0,h)+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,h);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-h);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 h=d-1;return{line:h,character:c-l[h]}}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,h,p,A){return new t(g,h,p,A)}u.create=c;function l(g,h,p){if(g instanceof t)return g.update(h,p),g;throw new Error("TextDocument.update: document must be created by TextDocument.create")}u.update=l;function d(g,h){let p=g.getText(),A=i(h.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 h=0,p=0,A=0;for(;h<d.length&&p<g.length;)c(d[h],g[p])<=0?u[A++]=d[h++]:u[A++]=g[p++];for(;h<d.length;)u[A++]=d[h++];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 h=u.charCodeAt(g);(h===13||h===10)&&(h===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 vv(r){return typeof r=="object"&&!!r&&"children"in r}di.isCompositeCstNode=vv;function Ex(r){return typeof r=="object"&&!!r&&"tokenType"in r}di.isLeafCstNode=Ex;function Cx(r){return vv(r)&&"fullText"in r}di.isRootCstNode=Cx});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+=Px(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(gu(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(gu(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 Px(r){return typeof r=="string"?r:typeof r>"u"?"undefined":typeof r.toString=="function"?r.toString():Object.prototype.toString.call(r)}function gu(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 kx(...r){if(r.length===1){let e=r[0];if(e instanceof Lt)return e;if(gu(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++];gu(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=kx;var Nf=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=Nf;var xx;(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})(xx=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(),Sx=Ct();function Rv(r){return new Sx.TreeStreamImpl(r,e=>(0,Ao.isCompositeCstNode)(e)?e.children:[],{includeRoot:!0})}De.streamCst=Rv;function Nx(r){return Rv(r).filter(Ao.isLeafCstNode)}De.flattenCst=Nx;function Dx(r){return{start:{character:r.startColumn-1,line:r.startLine-1},end:{character:r.endColumn,line:r.endLine-1}}}De.tokenToRange=Dx;function wx(r){let{offset:e,end:t,range:n}=r;return{range:n,offset:e,end:t,length:t-e}}De.toDocumentSegment=wx;De.DefaultNameRegexp=/^[\w\p{L}]$/u;function Ix(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 wf(r,e)}}De.findDeclarationNodeAtOffset=Ix;function Ox(r,e){if(r){let t=_v(r,!0);if(t&&Df(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(Df(o,e))return o}}}}De.findCommentNode=Ox;function Df(r,e){return(0,Ao.isLeafCstNode)(r)&&e.includes(r.tokenType.name)}De.isCommentNode=Df;function wf(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 wf(o,e)}}}De.findLeafNodeAtOffset=wf;function _v(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=_v;function $x(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=$x;function Mx(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=Mx;function Lx(r,e){let t=Fx(r,e);return t?t.parent.children.slice(t.a+1,t.b):[]}De.getInteriorNodes=Lx;function Fx(r,e){let t=Tv(r),n=Tv(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 Tv(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 ka=C(bo=>{"use strict";Object.defineProperty(bo,"__esModule",{value:!0});bo.eagerLoad=bo.inject=void 0;function qx(r,e,t,n){let i=[r,e,t,n].reduce(Pv,{});return Cv(i)}bo.inject=qx;var If=Symbol("isProxy");function Ev(r){if(r&&r[If])for(let e of Object.values(r))Ev(e);return r}bo.eagerLoad=Ev;function Cv(r,e){let t=new Proxy({},{deleteProperty:()=>!1,get:(n,i)=>bv(n,i,r,e||t),getOwnPropertyDescriptor:(n,i)=>(bv(n,i,r,e||t),Object.getOwnPropertyDescriptor(n,i)),has:(n,i)=>i in r,ownKeys:()=>[...Reflect.ownKeys(r),If]});return t[If]=!0,t}var Av=Symbol();function bv(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]===Av)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]=Av;try{r[e]=typeof i=="function"?i(n):Cv(i,n)}catch(o){throw r[e]=o instanceof Error?o:void 0,o}return r[e]}else return}function Pv(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]=Pv(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 $i=Ct();function Eo(r){return typeof r=="object"&&r!==null&&typeof r.$type=="string"}Pe.isAstNode=Eo;function jx(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=jx;function vu(r){return typeof r=="object"&&r!==null&&typeof r.$refText=="string"}Pe.isReference=vu;function Gx(r){return typeof r=="object"&&r!==null&&typeof r.name=="string"&&typeof r.type=="string"&&typeof r.path=="string"}Pe.isAstNodeDescription=Gx;function Ux(r){return typeof r=="object"&&r!==null&&Eo(r.container)&&vu(r.reference)&&typeof r.message=="string"}Pe.isLinkingError=Ux;function Hx(r,e){let t=r;for(;t;){if(e(t))return t;t=t.$container}}Pe.getContainerOfType=Hx;function Wx(r,e){let t=r;for(;t;){if(e(t))return!0;t=t.$container}return!1}Pe.hasContainerOfType=Wx;function kv(r){let t=xv(r).$document;if(!t)throw new Error("AST node has no document.");return t}Pe.getDocument=kv;function xv(r){for(;r.$container;)r=r.$container;return r}Pe.findRootNode=xv;function Of(r){return new $i.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 $i.DONE_RESULT})}Pe.streamContents=Of;function Kx(r){return new $i.TreeStreamImpl(r,e=>Of(e))}Pe.streamAllContents=Kx;function Sv(r){return new $i.TreeStreamImpl(r,e=>Of(e),{includeRoot:!0})}Pe.streamAst=Sv;function Nv(r){return new $i.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(vu(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(vu(o))return{done:!1,value:{reference:o,container:r,property:t,index:i}}}e.arrayIndex=0}}e.keyIndex++}return $i.DONE_RESULT})}Pe.streamReferences=Nv;function Bx(r,e=kv(r).parseResult.value){let t=[];return Sv(e).forEach(n=>{Nv(n).forEach(i=>{i.reference.ref===r&&t.push(i.reference)})}),(0,$i.stream)(t)}Pe.findLocalReferences=Bx});var kr=C(Tu=>{"use strict";Object.defineProperty(Tu,"__esModule",{value:!0});Tu.MultiMap=void 0;var Co=Ct(),$f=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())}};Tu.MultiMap=$f});var _u=C(Po=>{"use strict";Object.defineProperty(Po,"__esModule",{value:!0});Po.EmptyFileSystem=Po.EmptyFileSystemProvider=void 0;var Ru=class{readFile(){throw new Error("Method not implemented.")}readFileSync(){throw new Error("Method not implemented.")}async readDirectory(){return[]}};Po.EmptyFileSystemProvider=Ru;Po.EmptyFileSystem={fileSystemProvider:()=>new Ru}});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 Vx(r){return T.reflection.isInstance(r,T.AbstractRule)}T.isAbstractRule=Vx;T.AbstractType="AbstractType";function Yx(r){return T.reflection.isInstance(r,T.AbstractType)}T.isAbstractType=Yx;T.Condition="Condition";function Xx(r){return T.reflection.isInstance(r,T.Condition)}T.isCondition=Xx;T.AbstractElement="AbstractElement";function Jx(r){return T.reflection.isInstance(r,T.AbstractElement)}T.isAbstractElement=Jx;T.Action="Action";function Zx(r){return T.reflection.isInstance(r,T.Action)}T.isAction=Zx;T.Alternatives="Alternatives";function Qx(r){return T.reflection.isInstance(r,T.Alternatives)}T.isAlternatives=Qx;T.Assignment="Assignment";function eS(r){return T.reflection.isInstance(r,T.Assignment)}T.isAssignment=eS;T.AtomType="AtomType";function tS(r){return T.reflection.isInstance(r,T.AtomType)}T.isAtomType=tS;T.CharacterRange="CharacterRange";function rS(r){return T.reflection.isInstance(r,T.CharacterRange)}T.isCharacterRange=rS;T.Conjunction="Conjunction";function nS(r){return T.reflection.isInstance(r,T.Conjunction)}T.isConjunction=nS;T.CrossReference="CrossReference";function iS(r){return T.reflection.isInstance(r,T.CrossReference)}T.isCrossReference=iS;T.Disjunction="Disjunction";function oS(r){return T.reflection.isInstance(r,T.Disjunction)}T.isDisjunction=oS;T.Grammar="Grammar";function aS(r){return T.reflection.isInstance(r,T.Grammar)}T.isGrammar=aS;T.GrammarImport="GrammarImport";function sS(r){return T.reflection.isInstance(r,T.GrammarImport)}T.isGrammarImport=sS;T.Group="Group";function uS(r){return T.reflection.isInstance(r,T.Group)}T.isGroup=uS;T.InferredType="InferredType";function cS(r){return T.reflection.isInstance(r,T.InferredType)}T.isInferredType=cS;T.Interface="Interface";function lS(r){return T.reflection.isInstance(r,T.Interface)}T.isInterface=lS;T.Keyword="Keyword";function dS(r){return T.reflection.isInstance(r,T.Keyword)}T.isKeyword=dS;T.LiteralCondition="LiteralCondition";function fS(r){return T.reflection.isInstance(r,T.LiteralCondition)}T.isLiteralCondition=fS;T.NamedArgument="NamedArgument";function pS(r){return T.reflection.isInstance(r,T.NamedArgument)}T.isNamedArgument=pS;T.NegatedToken="NegatedToken";function mS(r){return T.reflection.isInstance(r,T.NegatedToken)}T.isNegatedToken=mS;T.Negation="Negation";function hS(r){return T.reflection.isInstance(r,T.Negation)}T.isNegation=hS;T.Parameter="Parameter";function yS(r){return T.reflection.isInstance(r,T.Parameter)}T.isParameter=yS;T.ParameterReference="ParameterReference";function gS(r){return T.reflection.isInstance(r,T.ParameterReference)}T.isParameterReference=gS;T.ParserRule="ParserRule";function vS(r){return T.reflection.isInstance(r,T.ParserRule)}T.isParserRule=vS;T.RegexToken="RegexToken";function TS(r){return T.reflection.isInstance(r,T.RegexToken)}T.isRegexToken=TS;T.ReturnType="ReturnType";function RS(r){return T.reflection.isInstance(r,T.ReturnType)}T.isReturnType=RS;T.RuleCall="RuleCall";function _S(r){return T.reflection.isInstance(r,T.RuleCall)}T.isRuleCall=_S;T.TerminalAlternatives="TerminalAlternatives";function AS(r){return T.reflection.isInstance(r,T.TerminalAlternatives)}T.isTerminalAlternatives=AS;T.TerminalGroup="TerminalGroup";function bS(r){return T.reflection.isInstance(r,T.TerminalGroup)}T.isTerminalGroup=bS;T.TerminalRule="TerminalRule";function ES(r){return T.reflection.isInstance(r,T.TerminalRule)}T.isTerminalRule=ES;T.TerminalRuleCall="TerminalRuleCall";function CS(r){return T.reflection.isInstance(r,T.TerminalRuleCall)}T.isTerminalRuleCall=CS;T.Type="Type";function PS(r){return T.reflection.isInstance(r,T.Type)}T.isType=PS;T.TypeAttribute="TypeAttribute";function kS(r){return T.reflection.isInstance(r,T.TypeAttribute)}T.isTypeAttribute=kS;T.UnorderedGroup="UnorderedGroup";function xS(r){return T.reflection.isInstance(r,T.UnorderedGroup)}T.isUnorderedGroup=xS;T.UntilToken="UntilToken";function SS(r){return T.reflection.isInstance(r,T.UntilToken)}T.isUntilToken=SS;T.Wildcard="Wildcard";function NS(r){return T.reflection.isInstance(r,T.Wildcard)}T.isWildcard=NS;var Au=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=Au;T.reflection=new Au});var Dv=C(Eu=>{"use strict";Object.defineProperty(Eu,"__esModule",{value:!0});Eu.LangiumGrammarGrammar=void 0;var DS=Pt(),bu,wS=()=>bu??(bu=(0,DS.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,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)(`{
|
|
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
|
-
}`));Eu.LangiumGrammarGrammar=wS});var wv=C(Gn=>{"use strict";Object.defineProperty(Gn,"__esModule",{value:!0});Gn.LangiumGrammarGeneratedModule=Gn.LangiumGrammarGeneratedSharedModule=Gn.LangiumGrammarLanguageMetaData=void 0;var IS=ze(),OS=Dv();Gn.LangiumGrammarLanguageMetaData={languageId:"langium",fileExtensions:[".langium"],caseInsensitive:!1};Gn.LangiumGrammarGeneratedSharedModule={AstReflection:()=>new IS.LangiumGrammarAstReflection};Gn.LangiumGrammarGeneratedModule={Grammar:()=>(0,OS.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 Cu=fn();function Iv(){return new Promise(r=>{typeof setImmediate>"u"?setTimeout(r,0):setImmediate(r)})}Rt.delayNextTick=Iv;var Mf=0,Ov=10;function $S(){return Mf=Date.now(),new Cu.CancellationTokenSource}Rt.startCancelableOperation=$S;function MS(r){Ov=r}Rt.setInterruptionPeriod=MS;Rt.OperationCancelled=Symbol("OperationCancelled");function $v(r){return r===Rt.OperationCancelled}Rt.isOperationCancelled=$v;async function LS(r){if(r===Cu.CancellationToken.None)return;let e=Date.now();if(e-Mf>=Ov&&(Mf=e,await Iv()),r.isCancellationRequested)throw Rt.OperationCancelled}Rt.interruptAndCheck=LS;var Lf=class{constructor(){this.previousAction=Promise.resolve(),this.previousTokenSource=new Cu.CancellationTokenSource}lock(e){this.cancel();let t=new Cu.CancellationTokenSource;return this.previousTokenSource=t,this.previousAction=this.previousAction.then(()=>e(t.token).catch(n=>{$v(n)||console.error("Error: ",n)}))}cancel(){this.previousTokenSource.cancel()}};Rt.MutexLock=Lf;var Ff=class{constructor(){this.promise=new Promise((e,t)=>{this.resolve=n=>(e(n),this),this.reject=n=>(t(n),this)})}};Rt.Deferred=Ff});var ku=C(Pu=>{"use strict";Object.defineProperty(Pu,"__esModule",{value:!0});Pu.DefaultScopeComputation=void 0;var qf=fn(),Mv=Re(),FS=kr(),Lv=Yr(),jf=class{constructor(e){this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider}async computeExports(e,t=qf.CancellationToken.None){return this.computeExportsForNode(e.parseResult.value,e,void 0,t)}async computeExportsForNode(e,t,n=Mv.streamContents,i=qf.CancellationToken.None){let o=[];this.exportNode(e,o,t);for(let a of n(e))await(0,Lv.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=qf.CancellationToken.None){let n=e.parseResult.value,i=new FS.MultiMap;for(let o of(0,Mv.streamAllContents)(n))await(0,Lv.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`.")}};Pu.DefaultScopeComputation=jf});var Su=C(fi=>{"use strict";Object.defineProperty(fi,"__esModule",{value:!0});fi.DefaultScopeProvider=fi.EMPTY_SCOPE=fi.StreamScope=void 0;var qS=Re(),xu=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 xu.EMPTY_STREAM}};var Gf=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,qS.getDocument)(e.container).precomputedScopes;if(i){let a=e.container;do{let s=i.get(a);s.length>0&&t.push((0,xu.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,xu.stream)(e),t,n)}createScopeForNodes(e,t,n){let i=(0,xu.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=Gf});var gn=C((xa,Uf)=>{(function(r,e){if(typeof xa=="object"&&typeof Uf=="object")Uf.exports=e();else if(typeof define=="function"&&define.amd)define([],e);else{var t=e();for(var n in t)(typeof xa=="object"?xa:r)[n]=t[n]}})(xa,()=>(()=>{"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,h=-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(!(h===A-1||p===1))if(h!==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("/"),h=A,p=0;continue}}else if(d.length===2||d.length===1){d="",g=0,h=A,p=0;continue}}c&&(d.length>0?d+="/..":d="..",g=2)}else d.length>0?d+="/"+u.slice(h+1,A):d=u.slice(h+1,A),g=A-h-1;h=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,h=1;h<c.length&&c.charCodeAt(h)===47;++h);for(var p=c.length-h,A=g<p?g:p,x=-1,k=0;k<=A;++k){if(k===A){if(p>A){if(c.charCodeAt(h+k)===47)return c.slice(h+k+1);if(k===0)return c.slice(h+k)}else g>A&&(u.charCodeAt(l+k)===47?x=k:k===0&&(x=0));break}var _=u.charCodeAt(l+k);if(_!==c.charCodeAt(h+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(h+x):(h+=x,c.charCodeAt(h)===47&&++h,c.slice(h))},_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,h=u.length-1;h>=1;--h)if((c=u.charCodeAt(h))===47){if(!g){d=h;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,h=!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(!h){d=l+1;break}}else A===-1&&(h=!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(!h){d=l+1;break}}else g===-1&&(h=!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,h=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:h!==1&&(h=1):c!==-1&&(h=-1);else if(!g){l=p+1;break}}return c===-1||d===-1||h===0||h===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 h=-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?h===-1?h=k:_!==1&&(_=1):h!==-1&&(_=-1);else if(!x){p=k+1;break}return h===-1||A===-1||_===0||_===1&&h===A-1&&h===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,h),c.base=u.slice(1,A)):(c.name=u.slice(p,h),c.base=u.slice(p,A)),c.ext=u.slice(h,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=/^\//,h=/^\/\//,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(h.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,h,p){if(p||arguments.length===2)for(var A,x=0,k=h.length;x<k;x++)!A&&x in h||(A||(A=Array.prototype.slice.call(h,0,x)),A[x]=h[x]);return g.concat(A||Array.prototype.slice.call(h))};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 h=[],p=1;p<arguments.length;p++)h[p-1]=arguments[p];return g.with({path:l.join.apply(l,s([g.path],h,!1))})},u.resolvePath=function(g){for(var h=[],p=1;p<arguments.length;p++)h[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],h,!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 h=l.dirname(g.path);return h.length===1&&h.charCodeAt(0)===46&&(h=""),g.with({path:h})},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 wu=C(xr=>{"use strict";Object.defineProperty(xr,"__esModule",{value:!0});xr.NLEmpty=xr.NL=xr.NewLineNode=xr.IndentNode=xr.CompositeGeneratorNode=void 0;var jS=typeof process>"u"?`
|
|
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"?`
|
|
3570
3570
|
`:process.platform==="win32"?`\r
|
|
3571
3571
|
`:`
|
|
3572
|
-
`,
|
|
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(`
|
|
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
|
|
3581
|
-
`&&(this.multiline=!0),e.quantifier)this.isStarting=!1,this.endRegexStack=[];else{let n=
|
|
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)}}},Mi=new Xf;function VS(r){try{typeof r!="string"&&(r=r.source),r=`/${r}/`;let e=Jv.pattern(r),t=[];for(let n of e.value.value)Mi.reset(r),Mi.visit(n),t.push({start:Mi.startRegex,end:Mi.endRegex});return t}catch{return[]}}Bt.getTerminalParts=VS;function YS(r){try{return typeof r!="string"&&(r=r.source),r=`/${r}/`,Mi.reset(r),Mi.visit(Jv.pattern(r)),Mi.multiline}catch{return!1}}Bt.isMultilineComment=YS;function XS(r){return(typeof r=="string"?new RegExp(r):r).test(" ")}Bt.isWhitespaceRegExp=XS;function Jf(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}Bt.escapeRegExp=Jf;function JS(r){return Array.prototype.map.call(r,e=>/\w/.test(e)?`[${e.toLowerCase()}${e.toUpperCase()}]`:Jf(e)).join("")}Bt.getCaseInsensitivePattern=JS;function ZS(r,e){let t=Zv(r),n=e.match(t);return!!n&&n[0].length>0}Bt.partialMatches=ZS;function Zv(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=Zv});var Ft=C(ae=>{"use strict";var QS=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]}),eN=ae&&ae.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),tN=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)&&QS(e,r,t);return eN(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=tN(ze()),Qf=gn(),Li=Re(),rN=kr(),nN=mi(),iN=So();function oN(r){return r==="?"||r==="*"}ae.isOptionalCardinality=oN;function aN(r){return r==="*"||r==="+"}ae.isArrayCardinality=aN;function sN(r){return r==="+="}ae.isArrayOperator=sN;function tp(r){return Qv(r,new Set)}ae.isDataTypeRule=tp;function Qv(r,e){if(e.has(r))return!0;e.add(r);for(let t of(0,Li.streamAllContents)(r))if(fe.isRuleCall(t)&&fe.isParserRule(t.rule.ref)){if(!Qv(t.rule.ref,e))return!1}else{if(fe.isAssignment(t))return!1;if(fe.isAction(t))return!1}return!0}function eT(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,Li.streamAllContents)(t[i]).find(fe.isAction);if(a)return a}}}if(fe.isAbstractElement(e))return eT(e)}ae.getActionAtElement=eT;function tT(r){var e;if(fe.isParserRule(r))return tp(r)?r.name:(e=rp(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=rT(r);if(t)return t}else if(fe.isInferredType(r))return r.name;throw new nN.TypeResolutionError("Cannot get name of Unknown Type",r.$cstNode)}ae.getTypeName=tT;function rp(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=rp;function rT(r){var e;if(r.inferredType)return r.inferredType.name;if(!((e=r.type)===null||e===void 0)&&e.ref)return tT(r.type.ref)}function uN(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":tp(r)?r.name:(n=rp(r))!==null&&n!==void 0?n:r.name}ae.getRuleType=uN;function nT(r){return wa(r.definition)}ae.terminalRegex=nT;var np=/[\s\S]/.source;function wa(r){if(fe.isTerminalAlternatives(r))return cN(r);if(fe.isTerminalGroup(r))return lN(r);if(fe.isCharacterRange(r))return pN(r);if(fe.isTerminalRuleCall(r)){let e=r.rule.ref;if(!e)throw new Error("Missing rule reference.");return Un(nT(e),r.cardinality)}else{if(fe.isNegatedToken(r))return fN(r);if(fe.isUntilToken(r))return dN(r);if(fe.isRegexToken(r))return Un(r.regex,r.cardinality,!1);if(fe.isWildcard(r))return Un(np,r.cardinality);throw new Error("Invalid terminal element.")}}function cN(r){return Un(r.elements.map(wa).join("|"),r.cardinality)}function lN(r){return Un(r.elements.map(wa).join(""),r.cardinality)}function dN(r){return Un(`${np}*?${wa(r.terminal)}`,r.cardinality)}function fN(r){return Un(`(?!${wa(r.terminal)})${np}*?`,r.cardinality)}function pN(r){return r.right?Un(`[${Zf(r.left)}-${Zf(r.right)}]`,r.cardinality,!1):Un(Zf(r.left),r.cardinality,!1)}function Zf(r){return(0,iN.escapeRegExp)(r.value)}function Un(r,e,t=!0){return t&&(r=`(${r})`),e?`${r}${e}`:r}function ip(r,e){if(e.path===void 0||e.path.length===0)return;let t=Qf.Utils.dirname((0,Li.getDocument)(e).uri),n=e.path;n.endsWith(".langium")||(n+=".langium");let i=Qf.Utils.resolvePath(t,n);try{let a=r.getOrCreateDocument(i).parseResult.value;if(fe.isGrammar(a))return a}catch{}}ae.resolveImport=ip;function mN(r,e){if(fe.isGrammarImport(e)){let t=ip(r,e);if(t){let n=ep(r,t);return n.push(t),n}return[]}else return ep(r,e)}ae.resolveTransitiveImports=mN;function ep(r,e,t=e,n=new Set,i=new Set){let o=(0,Li.getDocument)(e);if(t!==e&&i.add(e),!n.has(o.uri)){n.add(o.uri);for(let a of e.imports){let s=ip(r,a);s&&ep(r,s,t,n,i)}}return Array.from(i)}function hN(r,e){let t=e,n=r.shared.workspace.LangiumDocumentFactory.fromModel(e,Qf.URI.parse("memory://grammar.langium"));return t.$document=n,n.precomputedScopes=yN(r,e),e}ae.prepareGrammar=hN;function yN(r,e){let t=r.references.NameProvider,n=r.workspace.AstNodeDescriptionProvider,i=(0,Li.getDocument)(e),o=new rN.MultiMap,a=iT(r.workspace.AstNodeLocator),s=oT(n);for(let u of(0,Li.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 iT(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=iT;function oT(r){return(e,t,n)=>{let i=(0,Li.findRootNode)(e);if(i&&fe.isAction(e)&&e.inferredType){let o=rT(e);o&&n.add(i,r.createDescription(e,o,t))}}}ae.processActionNodeWithNodeDescriptionProvider=oT;function aT(r){return fe.isAssignment(r)?[r]:fe.isAlternatives(r)||fe.isGroup(r)||fe.isUnorderedGroup(r)?r.elements.flatMap(e=>aT(e)):[]}ae.extractAssignments=aT});var cT=C(No=>{"use strict";Object.defineProperty(No,"__esModule",{value:!0});No.LangiumGrammarScopeComputation=No.LangiumGrammarScopeProvider=void 0;var gN=ku(),vN=Su(),sT=Re(),TN=Ct(),RN=ze(),uT=Ft(),op=class extends vN.DefaultScopeProvider{constructor(e){super(e)}getScope(e){let t=this.reflection.getReferenceType(e);if(t!=="AbstractType")return super.getScope(e);let n=[],i=(0,sT.getDocument)(e.container).precomputedScopes,o=(0,sT.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,TN.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=op;var ap=class extends gN.DefaultScopeComputation{constructor(e){super(e),this.processTypeNode=(0,uT.processTypeNodeWithNodeLocator)(e.workspace.AstNodeLocator),this.processActionNode=(0,uT.processActionNodeWithNodeDescriptionProvider)(e.workspace.AstNodeDescriptionProvider)}processNode(e,t,n){(0,RN.isReturnType)(e)||(this.processTypeNode(e,t,n),this.processActionNode(e,t,n),super.processNode(e,t,n))}};No.LangiumGrammarScopeComputation=ap});var hi=C(Do=>{"use strict";Object.defineProperty(Do,"__esModule",{value:!0});Do.relativeURI=Do.equalURI=void 0;function _N(r,e){return r?.toString()===e?.toString()}Do.equalURI=_N;function AN(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=AN});var Mu=C($u=>{"use strict";Object.defineProperty($u,"__esModule",{value:!0});$u.ValidationRegistry=void 0;var bN=kr(),EN=Yr(),sp=class{constructor(e){this.validationChecks=new bN.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,EN.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)}};$u.ValidationRegistry=sp});var cp=C(Lu=>{"use strict";Object.defineProperty(Lu,"__esModule",{value:!0});Lu.collectDeclaredTypes=void 0;var up=Ft(),lT=mi(),CN=kr();function PN(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,up.getTypeName)(l.ref)),c=s.attributes.map(l=>({name:l.name,optional:l.isOptional===!0,typeAlternatives:l.typeAlternatives.map(dT)}));o.interfaces.push(new lT.InterfaceType(s.name,u,c))}let a=new CN.MultiMap;for(let s of e){let u=s.typeAlternatives.map(dT),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 lT.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,up.getTypeName)(l.refType.ref),s.name)}for(let s of a.keys())i(s,t),i(s,o);return o}Lu.collectDeclaredTypes=PN;function dT(r){var e,t;let n=[];return r.refType?n=[r.refType.ref?(0,up.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 kN=Pt();function fT(r){return typeof r.name=="string"}wo.isNamed=fT;var lp=class{getName(e){if(fT(e))return e.name}getNameNode(e){return(0,kN.findNodeForProperty)(e.$cstNode,"name")}};wo.DefaultNameProvider=lp});var mp=C(Fu=>{"use strict";Object.defineProperty(Fu,"__esModule",{value:!0});Fu.collectInferredTypes=void 0;var Dt=ze(),xN=Io(),SN=Ct(),Oo=mi(),mT=kr(),Hn=Ft();function pT(r){return JSON.parse(JSON.stringify(r))}function dp(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?dp(n,n,t):n.name!==void 0&&n.name!==r.name?t.add(n.name):dp(r,n,t);e.parents.length===0&&e.name&&t.add(e.name)}var fp=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:pT(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(pT(e));return n}getSuperTypes(e){let t=new Set;return dp(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=Ia();t.parents=e;for(let n of e)n.children.push(t);return t}};function NN(r,e){var t;let n=[],i={fragments:new Map};for(let u of r)n.push(...hT(i,u));let o=gT(n);GN(o);let a=DN(o),s=WN(o,a);for(let u of e){let c=(0,Dt.isAlternatives)(u.definition)&&u.definition.elements.every(l=>(0,Dt.isKeyword)(l))?(0,SN.stream)(u.definition.elements).filter(Dt.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,Oa(!1,!1,c)))}return s}Fu.collectInferredTypes=NN;function DN(r){let e=[],t=new mT.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,Oa(!1,!1,i),{reflection:!0}));return e}function hT(r,e){let t=Ia(e),n=new fp(r,t);return pp(n,n.root,e.definition),n.getTypes()}function Ia(r){return{name:(0,Dt.isParserRule)(r)?(0,Hn.getTypeName)(r):r,properties:[],ruleCalls:[],children:[],parents:[],actionWithAssignment:!1}}function pp(r,e,t){let n=(0,Hn.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,Ia());i.push(pp(r,a,o))}return r.merge(...i)}else if((0,Dt.isGroup)(t)||(0,Dt.isUnorderedGroup)(t)){let i=n?r.connect(e,Ia()):e;for(let o of t.elements)i=pp(r,i,o);return n?r.merge(e,i):i}else{if((0,Dt.isAction)(t))return wN(r,e,t);(0,Dt.isAssignment)(t)?IN(e,t):(0,Dt.isRuleCall)(t)&&$N(r,e,t)}return e}function wN(r,e,t){var n,i;let o=r.connect(e,Ia((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,xN.isNamed)(a)&&(o.name=a.name)}return t.feature&&t.operator&&(o.actionWithAssignment=!0,o.properties.push({name:t.feature,optional:!1,typeAlternatives:Oa(t.operator==="+=",!1,r.root.ruleCalls.length!==0?r.root.ruleCalls:r.getSuperTypes(o))})),o}function IN(r,e){let t={types:new Set,reference:!1};yT(e.terminal,t);let n=Oa(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 yT(r,e){(0,Dt.isAlternatives)(r)||(0,Dt.isUnorderedGroup)(r)||(0,Dt.isGroup)(r)?ON(r,e):(0,Dt.isKeyword)(r)?e.types.add(`'${r.value}'`):(0,Dt.isRuleCall)(r)&&r.rule.ref?e.types.add((0,Hn.getRuleType)(r.rule.ref)):(0,Dt.isCrossReference)(r)&&r.type.ref&&(e.types.add((0,Hn.getTypeName)(r.type.ref)),e.reference=!0)}function ON(r,e){for(let t of r.elements)yT(t,e)}function $N(r,e,t){let n=t.rule.ref;if((0,Dt.isParserRule)(n)&&n.fragment){let i=MN(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,Dt.isParserRule)(n)&&e.ruleCalls.push((0,Hn.getRuleType)(n))}function MN(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=hT(e,r),s=gT(o).find(u=>u.name===i);return s&&n.push(...s.properties),n}function gT(r){let e=new Map,t=[],n=LN(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 LN(r){let e=r.reduce((n,i)=>n.add(i.name,i),new mT.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(h=>h.name===d.name);g?d.typeAlternatives.filter(FN(g.typeAlternatives)).forEach(h=>g.typeAlternatives.push(h)):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 FN(r){return e=>!r.some(t=>qN(t,e))}function qN(r,e){return r.array===e.array&&r.reference===e.reference&&jN(r.types,e.types)}function jN(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 GN(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=[];UN(n,r),HN(n)}function UN(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 HN(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 WN(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=Oa(!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 Oa(r,e,t){return r||e?[{array:r,reference:e,types:t}]:t.map(n=>({array:r,reference:e,types:[n]}))}});var PT=C(vn=>{"use strict";Object.defineProperty(vn,"__esModule",{value:!0});vn.collectAllInterfaces=vn.collectValidationResources=vn.applyErrorToAssignment=vn.validateTypesConsistency=void 0;var hp=kr(),RT=cp(),_T=mp(),Ma=mi(),La=Ct(),yp=Ft();function KN(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,yp.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=bT(r),o=new hp.MultiMap;for(let[a,s]of i.entries())"declared"in s&&$a(s.declared)&&o.addAll(a,qu(s.declared,"declared",i).values());for(let[a,s]of i.entries()){if("declared"in s&&BN(s,o,e),!YN(s))continue;let u=t(s.nodes,a),c=n(s.nodes,a),l=AT(s.nodes,e);if(vT(s.inferred)&&vT(s.declared))JN(s.inferred.union,s.declared.union,u);else if($a(s.inferred)&&$a(s.declared)){let d=qu(s.inferred,"inferred",i),g=qu(s.declared,"declared",i);ZN(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"})}}}vn.validateTypesConsistency=KN;function BN(r,e,t){let n=r.declared;if(!$a(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(h=>"'"+h+"'").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&&!VN(n,i)&&t.push(n.name)}return t}function VN(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 qu(r,e,t,n=new hp.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];$a(u)&&qu(u,e,t,n,i)}return n}function AT(r,e){let t=r.flatMap(n=>(0,yp.extractAssignments)(n.definition));return(n,i)=>{let o=t.find(a=>a.feature===n);o&&e("error",i,{node:o,property:"feature"})}}vn.applyErrorToAssignment=AT;function vT(r){return r&&"union"in r}function $a(r){return r&&"properties"in r}function YN(r){return r&&"inferred"in r&&"declared"in r}function bT(r){let e=(0,Ma.collectAllAstResources)([r]),t=(0,_T.collectInferredTypes)(Array.from(e.parserRules),Array.from(e.datatypeRules)),n=(0,RT.collectDeclaredTypes)(Array.from(e.interfaces),Array.from(e.types),t),i=ET(e),o=TT(t).reduce((s,u)=>s.set(u.name,{inferred:u,nodes:i.get(u.name)}),new Map);return TT(n).reduce((s,u)=>{var c;let l=(c=(0,La.stream)(e.types).find(d=>d.name===u.name))!==null&&c!==void 0?c:(0,La.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)}vn.collectValidationResources=bT;function ET(r){return(0,La.stream)(r.parserRules).concat(r.datatypeRules).reduce((e,t)=>e.add((0,yp.getRuleType)(t),t),new hp.MultiMap)}function TT(r){return r.interfaces.concat(r.unions)}var XN=(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 CT(r,e){let t=a=>a.reduce((s,u)=>s.set((0,Ma.distinctAndSorted)(u.types).join(" | "),u),new Map),n=t(r),i=t(e),o=[];for(let[a,s]of(0,La.stream)(n)){let u=i.get(a);u?(u.array!==s.array||u.reference!==s.reference)&&o.push({typeString:a,errorMessage:XN(s,u)}):o.push({typeString:a,errorMessage:"is not expected"})}return o}function JN(r,e,t){let n=CT(r,e);for(let i of n)t(`A type '${i.typeString}' ${i.errorMessage}`)}function ZN(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,Ma.propertyTypeArrayToString)(c.typeAlternatives),h=(0,Ma.propertyTypeArrayToString)(d.typeAlternatives);if(g!==h){let p=CT(c.typeAlternatives,d.typeAlternatives);if(p.length>0){let A=o(c.name,g,h);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 QN(r){let e=(0,Ma.collectAllAstResources)([r]),t=(0,_T.collectInferredTypes)(Array.from(e.parserRules),Array.from(e.datatypeRules)),n=(0,RT.collectDeclaredTypes)(Array.from(e.interfaces),Array.from(e.types),t),i=ET(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,La.stream)(e.interfaces).find(c=>c.name===s.name);u&&a.set(s.name,{type:s,node:u})}return a},o)}vn.collectAllInterfaces=QN});var bp=C(or=>{"use strict";var eD=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]}),tD=or&&or.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),rD=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)&&eD(e,r,t);return tD(e,r),e};Object.defineProperty(or,"__esModule",{value:!0});or.LangiumGrammarValidator=or.IssueCodes=or.LangiumGrammarValidationRegistry=void 0;var gp=lo(),nD=gn(),yi=Re(),ju=kr(),vp=et(),Wn=Pt(),Tp=Ct(),iD=hi(),oD=Mu(),Ve=rD(ze()),kT=ze(),qt=Ft(),Rp=PT(),_p=class extends oD.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=_p;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 Ap=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,Tp.stream)(i.rules).filter(o=>!Fa(o));this.checkUniqueName(e,t,n,"rule")}checkUniqueTypeName(e,t){let n=i=>(0,Tp.stream)(i.types).concat(i.interfaces);this.checkUniqueName(e,t,n,"type")}checkUniqueName(e,t,n,i){let o=new ju.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 ju.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:[gp.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 ju.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,Tp.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(Fa(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,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,vp.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,vp.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,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,vp.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,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,iD.relativeURI)(nD.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,Rp.validateTypesConsistency)(e,t)}checkPropertyNameDuplication(e,t){if(e.interfaces.length===0)return;let n=(0,Rp.collectAllInterfaces)(e);for(let i of e.interfaces.map(o=>o.name)){let o=new ju.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,Rp.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||Fa(i)||n.has(i)||t("hint","This rule is declared but never referenced.",{node:i,property:"name",tags:[gp.DiagnosticTag.Unnecessary]})}checkRuleName(e,t){if(e.name&&!Fa(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:[gp.DiagnosticTag.Unnecessary]})}}checkParserRuleDataType(e,t){if(Fa(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,kT.isRuleCall)(e.terminal)&&(0,kT.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)&&!sD(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,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=Ap;var aD=["string","number","boolean","Date","bigint"];function sD(r){return aD.includes(r)}function Fa(r){return!r.definition||!r.definition.$cstNode||r.definition.$cstNode.length===0}});var Hu=C(Xr=>{"use strict";Object.defineProperty(Xr,"__esModule",{value:!0});Xr.DocumentValidator=Xr.toDiagnosticSeverity=Xr.getDiagnosticRange=Xr.DefaultDocumentValidator=void 0;var Sr=Ne(),xT=Pt(),uD=Re(),cD=et(),Gu=Yr(),Ep=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,Gu.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:Uu.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,cD.tokenToRange)(o.token);if(a){let s={severity:Sr.DiagnosticSeverity.Error,range:a,message:o.message,code:Uu.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:Uu.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,Gu.isOperationCancelled)(o))throw o;console.error("An error occurred during validation:",o)}return await(0,Gu.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,uD.streamAst)(e).map(async a=>{await(0,Gu.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:ST(n),severity:NT(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=Ep;function ST(r){if(Sr.Range.is(r.range))return r.range;let e;return typeof r.property=="string"?e=(0,xT.findNodeForProperty)(r.node.$cstNode,r.property,r.index):typeof r.keyword=="string"&&(e=(0,xT.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=ST;function NT(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=NT;var Uu;(function(r){r.LexingError="lexing-error",r.ParsingError="parsing-error",r.LinkingError="linking-error"})(Uu=Xr.DocumentValidator||(Xr.DocumentValidator={}))});var OT=C(Tn=>{"use strict";var lD=Tn&&Tn.__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]}),dD=Tn&&Tn.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),fD=Tn&&Tn.__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 dD(e,r),e};Object.defineProperty(Tn,"__esModule",{value:!0});Tn.LangiumGrammarCodeActionProvider=void 0;var Jr=Ne(),DT=Re(),wT=et(),pD=Pt(),IT=So(),mD=Hu(),Cp=fD(ze()),Nr=bp(),Pp=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 mD.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,
|
|
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:`
|
|
3584
3584
|
|
|
3585
3585
|
`+t.refText+`:
|
|
3586
|
-
/* TODO implement rule */ {infer `+t.refText+"};"}]}}}}}};
|
|
3587
|
-
`);A[0]=c+A[0];for(let x=0;x<A.length;x++){let k=a+x,_={character:0,line:k};if(
|
|
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:`${`
|
|
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 qa.TreeStreamImpl(i,o=>this.iterateCst(o,t)):qa.EMPTY_STREAM}iterateCst(e,t){if(!(0,Np.isCompositeCstNode)(e))return qa.EMPTY_STREAM;let n=t.indentation;return new qa.StreamImpl(()=>({index:0}),i=>i.index<e.children.length?{done:!1,value:e.children[i.index++]}:(t.indentation=n,qa.DONE_RESULT))}};Zr.AbstractFormatter=Dp;var Vu=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,zu.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,zu.findNodesForProperty)(this.astNode.$cstNode,n);t.push(...i)}return new cr(t,this.collector)}keyword(e,t){let n=(0,zu.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,zu.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,MT.getInteriorNodes)(o,a),this.collector)}};Zr.DefaultNodeFormatter=Vu;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 RD;(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,h,p,A,x,k;let _=(g=l.lines)!==null&&g!==void 0?g:0,R=(h=d.lines)!==null&&h!==void 0?h: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}})(RD=Zr.Formatting||(Zr.Formatting={}))});var LT=C(Rn=>{"use strict";var _D=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]}),AD=Rn&&Rn.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),bD=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)&&_D(e,r,t);return AD(e,r),e};Object.defineProperty(Rn,"__esModule",{value:!0});Rn.LangiumGrammarFormatter=void 0;var Ee=wp(),gi=bD(ze()),Ip=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())}};Rn.LangiumGrammarFormatter=Ip});var Ju=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(),Yu=Pt(),ED=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 Xu=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=Xu;var Op=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 Xu;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,ED.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 h=d;d=this.currentDocument.textDocument.offsetAt({line:g+1,character:0}),this.currentTokensBuilder.push(g,0,d-h-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,Yu.findNodeForProperty)(e.node.$cstNode,e.property,e.index);o&&t.push(o)}else t.push(...(0,Yu.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,Yu.findNodeForKeyword)(t.$cstNode,n,o);u&&s.push(u)}else s.push(...(0,Yu.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=Op;var CD;(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}})(CD=_t.SemanticTokensDecoder||(_t.SemanticTokensDecoder={}))});var FT=C(Zu=>{"use strict";Object.defineProperty(Zu,"__esModule",{value:!0});Zu.LangiumGrammarSemanticTokenProvider=void 0;var Fi=Ne(),PD=Ju(),qi=ze(),$p=class extends PD.AbstractSemanticTokenProvider{highlightElement(e,t){var n;(0,qi.isAssignment)(e)?t({node:e,property:"feature",type:Fi.SemanticTokenTypes.property}):(0,qi.isAction)(e)?e.feature&&t({node:e,property:"feature",type:Fi.SemanticTokenTypes.property}):(0,qi.isReturnType)(e)?t({node:e,property:"name",type:Fi.SemanticTokenTypes.type}):(0,qi.isAtomType)(e)?(e.primitiveType||e.refType)&&t({node:e,property:e.primitiveType?"primitiveType":"refType",type:Fi.SemanticTokenTypes.type}):(0,qi.isParameter)(e)?t({node:e,property:"name",type:Fi.SemanticTokenTypes.parameter}):(0,qi.isParameterReference)(e)?t({node:e,property:"parameter",type:Fi.SemanticTokenTypes.parameter}):(0,qi.isRuleCall)(e)&&!((n=e.rule.ref)===null||n===void 0)&&n.fragment&&t({node:e,property:"rule",type:Fi.SemanticTokenTypes.type})}};Zu.LangiumGrammarSemanticTokenProvider=$p});var jT=C(Qu=>{"use strict";Object.defineProperty(Qu,"__esModule",{value:!0});Qu.LangiumGrammarNameProvider=void 0;var kD=Io(),xD=Pt(),qT=ze(),Mp=class extends kD.DefaultNameProvider{getName(e){return(0,qT.isAssignment)(e)?e.feature:super.getName(e)}getNameNode(e){return(0,qT.isAssignment)(e)?(0,xD.findNodeForProperty)(e.$cstNode,"feature"):super.getNameNode(e)}};Qu.LangiumGrammarNameProvider=Mp});var Fp=C(ec=>{"use strict";Object.defineProperty(ec,"__esModule",{value:!0});ec.DefaultReferences=void 0;var SD=Pt(),_n=Re(),GT=et(),UT=Ct(),ND=hi(),Lp=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,SD.findAssignment)(e),n=e.element;if(t&&n){let i=n[t.feature];if((0,_n.isReference)(i))return i.ref;if(Array.isArray(i)){for(let o of i)if((0,_n.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,UT.stream)(n)}findLocalReferences(e,t=!1){let i=(0,_n.getDocument)(e).parseResult.value,o=[];if(t){let s=this.getReferenceToSelf(e);s&&o.push(s)}let a=[];return(0,_n.streamAst)(i).forEach(s=>{(0,_n.streamReferences)(s).forEach(u=>{u.reference.ref===e&&a.push(u.reference)})}),a.forEach(s=>{o.push({sourceUri:(0,_n.getDocument)(s.$refNode.element).uri,sourcePath:this.nodeLocator.getAstNodePath(s.$refNode.element),targetUri:(0,_n.getDocument)(e).uri,targetPath:this.nodeLocator.getAstNodePath(e),segment:(0,GT.toDocumentSegment)(s.$refNode),local:(0,ND.equalURI)((0,_n.getDocument)(s.$refNode.element).uri,(0,_n.getDocument)(e).uri)})}),(0,UT.stream)(o)}getReferenceToSelf(e){let t=this.nameProvider.getNameNode(e);if(t){let n=(0,_n.getDocument)(e),i=this.nodeLocator.getAstNodePath(e);return{sourceUri:n.uri,sourcePath:i,targetUri:n.uri,targetPath:i,segment:(0,GT.toDocumentSegment)(t),local:!0}}}};ec.DefaultReferences=Lp});var zT=C(rc=>{"use strict";Object.defineProperty(rc,"__esModule",{value:!0});rc.LangiumGrammarReferences=void 0;var DD=Fp(),Vt=Re(),HT=et(),WT=Pt(),KT=Ct(),qp=hi(),jt=ze(),BT=Ft(),tc=mi(),jp=class extends DD.DefaultReferences{constructor(e){super(e),this.documents=e.shared.workspace.LangiumDocuments}findDeclaration(e){let t=e.element,n=(0,WT.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,tc.collectChildrenTypes)(o,this,this.documents,this.nodeLocator),s=[];if(a.forEach(u=>{let c=this.findLocalRulesWithReturnType(u,t);s.push(...c)}),(0,qp.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,KT.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,tc.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,KT.stream)(n)}createReferencesToAttribute(e,t){let n=[];if((0,jt.isParserRule)(e)){let i=(0,BT.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,HT.toDocumentSegment)(o),local:(0,qp.equalURI)((0,Vt.getDocument)(i).uri,(0,Vt.getDocument)(t).uri)})}}else{if(e.feature===t.name){let o=(0,WT.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,HT.toDocumentSegment)(o),local:(0,qp.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,BT.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,tc.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,tc.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}};rc.LangiumGrammarReferences=jp});var Hp=C(Dr=>{"use strict";var wD=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]}),ID=Dr&&Dr.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),OD=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)&&wD(e,r,t);return ID(e,r),e};Object.defineProperty(Dr,"__esModule",{value:!0});Dr.findFirstFeatures=Dr.findNextFeatures=void 0;var Yt=OD(ze()),Kn=Ft(),VT=Re(),$D=Pt();function MD(r,e){let t={stacks:r,tokens:e};return LD(t),t.stacks.flat().forEach(i=>{i.property=void 0}),JT(t.stacks).map(i=>i[i.length-1])}Dr.findNextFeatures=MD;function Gp(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(...XT({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(...Gp({next:{feature:s,type:e.type,new:!1},cardinalities:t,visited:n,plus:i}))}return o}function YT(r){return(0,VT.isAstNode)(r)&&(r={feature:r}),$o({next:r,cardinalities:new Map,visited:new Set,plus:new Set})}Dr.findFirstFeatures=YT;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 XT(i,0,o,a,s).map(l=>nc(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=>nc(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=>nc(d,u.cardinality,o))}else{if(Yt.isAction(u))return Gp({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=>nc(g,u.cardinality,o))}else return[i]}}function nc(r,e,t){return t.set(r.feature,e),r}function XT(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 LD(r){for(let e of r.tokens){let t=JT(r.stacks,e);r.stacks=t}}function JT(r,e){let t=[];for(let n of r)t.push(...FD(n,e));return t}function FD(r,e){let t=new Map,n=new Set(r.map(o=>o.feature).filter(qD)),i=[];for(;r.length>0;){let o=r.pop(),a=Gp({next:o,cardinalities:t,plus:n,visited:new Set}).filter(s=>e?Up(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 qD(r){if(r.cardinality==="+")return!0;let e=(0,VT.getContainerOfType)(r,Yt.isAssignment);return!!(e&&e.cardinality==="+")}function Up(r,e){if(Yt.isKeyword(r))return r.value===e.image;if(Yt.isRuleCall(r))return jD(r.rule.ref,e);if(Yt.isCrossReference(r)){let t=(0,$D.getCrossReferenceTerminal)(r);if(t)return Up(t,e)}return!1}function jD(r,e){return Yt.isParserRule(r)?YT(r.definition).some(n=>Up(n.feature,e)):Yt.isTerminalRule(r)?new RegExp((0,Kn.terminalRegex)(r)).test(e.image):!1}});var Bp=C(An=>{"use strict";var GD=An&&An.__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]}),UD=An&&An.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),HD=An&&An.__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)&&GD(e,r,t);return UD(e,r),e};Object.defineProperty(An,"__esModule",{value:!0});An.DefaultCompletionProvider=void 0;var ja=Ne(),Ga=HD(ze()),WD=Ft(),Wp=Re(),KD=et(),ZT=Pt(),QT=Ct(),ic=Hp(),Kp=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,KD.findLeafNodeAtOffset)(i,this.backtrackToAnyToken(s,u));if(!l){let x=(0,ZT.getEntryRule)(this.grammar);return await this.completionForRule(void 0,x,c),ja.CompletionList.create(o,!0)}let d=this.backtrackToTokenStart(s,u),g=this.findFeaturesAt(a,d),h=[],p=u!==d;p&&(h=this.findFeaturesAt(a,u));let A=x=>Ga.isKeyword(x.feature)?x.feature.value:x.feature;if(await Promise.all((0,QT.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,QT.stream)(h).exclude(g,A).distinct(A).map(k=>this.completionFor(l.element,k,c)))}return ja.CompletionList.create(o,!0)}findFeaturesAt(e,t){let n=e.getText({start:ja.Position.create(0,0),end:e.positionAt(t)}),i=this.completionParser.parse(n),o=i.tokens;if(i.tokenIndex===0){let u=(0,ZT.getEntryRule)(this.grammar),c=(0,ic.findFirstFeatures)({feature:u.definition,new:!0,type:(0,WD.getExplicitRuleType)(u)});return o.length>0?(o.shift(),(0,ic.findNextFeatures)(c.map(l=>[l]),o)):c}let a=[...o].splice(i.tokenIndex);return(0,ic.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(Ga.isParserRule(t)){let i=(0,ic.findFirstFeatures)(t.definition);await Promise.all(i.map(o=>this.completionFor(e,o,n)))}}completionFor(e,t,n){if(Ga.isKeyword(t.feature))return this.completionForKeyword(t.feature,e,n);if(Ga.isCrossReference(t.feature)&&e)return this.completionForCrossReference(t,e,n)}completionForCrossReference(e,t,n){let i=(0,Wp.getContainerOfType)(e.feature,Ga.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:ja.CompletionItemKind.Reference,detail:e.type,sortText:"0"}}filterCrossReference(e){return!0}completionForKeyword(e,t,n){!e.value.match(/[\w]+/)||n(e.value,{kind:ja.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,Wp.isAstNode)(n)){let u=this.nameProvider.getName(n);if(!u)return;o=u}else if(!(0,Wp.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))}};An.DefaultCompletionProvider=Kp});var tR=C(eR=>{"use strict";Object.defineProperty(eR,"__esModule",{value:!0})});var Vp=C(oc=>{"use strict";Object.defineProperty(oc,"__esModule",{value:!0});oc.DefaultDocumentHighlightProvider=void 0;var BD=Ne(),zD=Re(),VD=et(),YD=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,VD.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,YD.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 BD.DocumentHighlight.create(e.segment.range)}};oc.DefaultDocumentHighlightProvider=zp});var nR=C(rR=>{"use strict";Object.defineProperty(rR,"__esModule",{value:!0})});var Xp=C(ac=>{"use strict";Object.defineProperty(ac,"__esModule",{value:!0});ac.DefaultDocumentSymbolProvider=void 0;var XD=Ne(),JD=Re(),Yp=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,JD.streamContents)(t)){let o=this.getSymbol(e,i);n.push(...o)}if(n.length>0)return n}getSymbolKind(e){return XD.SymbolKind.Field}};ac.DefaultDocumentSymbolProvider=Yp});var iR=C(sc=>{"use strict";Object.defineProperty(sc,"__esModule",{value:!0});sc.AbstractExecuteCommandHandler=void 0;var ZD=Ne(),Jp=class{constructor(){this.registeredCommands=new Map,this.registerCommands(this.createCommandAcceptor())}get commands(){return Array.from(this.registeredCommands.keys())}async executeCommand(e,t,n=ZD.CancellationToken.None){let i=this.registeredCommands.get(e);if(i)return i(t,n)}createCommandAcceptor(){return(e,t)=>this.registeredCommands.set(e,t)}};sc.AbstractExecuteCommandHandler=Jp});var Qp=C(uc=>{"use strict";Object.defineProperty(uc,"__esModule",{value:!0});uc.DefaultDefinitionProvider=void 0;var QD=Ne(),ew=Re(),tw=et(),Zp=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,tw.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[QD.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,ew.getDocument)(t.element);if(t&&n)return{source:e,target:t,targetDocument:n}}}};uc.DefaultDefinitionProvider=Zp});var tm=C(Mo=>{"use strict";Object.defineProperty(Mo,"__esModule",{value:!0});Mo.MultilineCommentHoverProvider=Mo.AstNodeHoverProvider=void 0;var oR=et(),cc=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,oR.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=cc;var em=class extends cc{constructor(){super(...arguments),this.commentContentRegex=/\/\*([\s\S]*?)\*\//}getAstNodeHoverContent(e){let t=(0,oR.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=em});var aR=C(lc=>{"use strict";Object.defineProperty(lc,"__esModule",{value:!0});lc.AbstractGoToImplementationProvider=void 0;var rw=Ne(),nw=et(),rm=class{constructor(e){this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}getImplementation(e,t,n=rw.CancellationToken.None){let i=e.parseResult.value;if(i.$cstNode){let o=(0,nw.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)}}}};lc.AbstractGoToImplementationProvider=rm});var ji=C(Qr=>{"use strict";Object.defineProperty(Qr,"__esModule",{value:!0});Qr.DefaultLangiumDocuments=Qr.DefaultLangiumDocumentFactory=Qr.DefaultTextDocumentFactory=Qr.DocumentState=void 0;var sR=yu(),iw=gn(),ow=Ct(),am;(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"})(am=Qr.DocumentState||(Qr.DocumentState={}));var nm=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 sR.TextDocument.create(e.toString(),n.LanguageMetaData.languageId,0,t)}getContent(e){return this.fileSystemProvider.readFileSync(e)}};Qr.DefaultTextDocumentFactory=nm;var im=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=iw.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:am.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 sR.TextDocument.create(e.uri.toString(),e.languageId,0,(t=e.text)!==null&&t!==void 0?t:"")}};Qr.DefaultLangiumDocumentFactory=im;var om=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,ow.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=am.Changed,this.documentMap.delete(t))}};Qr.DefaultLangiumDocuments=om});var um=C(Lo=>{"use strict";Object.defineProperty(Lo,"__esModule",{value:!0});Lo.mergeSignatureHelpOptions=Lo.AbstractSignatureHelpProvider=void 0;var aw=Ne(),sw=et(),sm=class{provideSignatureHelp(e,t,n=aw.CancellationToken.None){let o=e.parseResult.value.$cstNode;if(o){let a=(0,sw.findLeafNodeAtOffset)(o,e.textDocument.offsetAt(t.position));if(a)return this.getSignatureFromElement(a.element,n)}}get signatureHelpOptions(){return{triggerCharacters:["("],retriggerCharacters:[","]}}};Lo.AbstractSignatureHelpProvider=sm;function uw(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=uw});var dm=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=gn(),uR=ka(),cw=Yr(),lw=ji(),dw=Ju(),fw=um(),cm=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,uR.eagerLoad)(this.services),this.services.ServiceRegistry.all.forEach(e=>(0,uR.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,fw.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),h=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:h?{}: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?dw.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=cm;function pw(r){let e=r.lsp.Connection;if(!e)throw new Error("Starting a language server requires the languageServer.Connection service to be set.");cR(e,r),lR(e,r),dR(e,r),fR(e,r),mR(e,r),hR(e,r),yR(e,r),gR(e,r),vR(e,r),RR(e,r),_R(e,r),pR(e,r),AR(e,r),TR(e,r),bR(e,r),CR(e,r),kR(e,r),xR(e,r),PR(e,r),ER(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=pw;function cR(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=cR;function lR(r,e){e.workspace.DocumentBuilder.onBuildPhase(lw.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=lR;function dR(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=dR;function fR(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=fR;function pR(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=pR;function mR(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=mR;function hR(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=hR;function yR(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=yR;function gR(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=gR;function vR(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=vR;function TR(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=TR;function RR(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=RR;function _R(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=_R;function AR(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=AR;function bR(r,e){let t="No semantic token provider registered";r.languages.semanticTokens.on(Gi((n,i,o,a)=>n.lsp.SemanticTokenProvider?n.lsp.SemanticTokenProvider.semanticHighlight(i,o,a):new lr.ResponseError(0,t),e)),r.languages.semanticTokens.onDelta(Gi((n,i,o,a)=>n.lsp.SemanticTokenProvider?n.lsp.SemanticTokenProvider.semanticHighlightDelta(i,o,a):new lr.ResponseError(0,t),e)),r.languages.semanticTokens.onRange(Gi((n,i,o,a)=>n.lsp.SemanticTokenProvider?n.lsp.SemanticTokenProvider.semanticHighlightRange(i,o,a):new lr.ResponseError(0,t),e))}X.addSemanticTokenHandler=bR;function ER(r,e){r.onDidChangeConfiguration(t=>{t.settings&&e.workspace.ConfigurationProvider.updateConfiguration(t)})}X.addConfigurationChangeHandler=ER;function CR(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 Ua(a)}})}X.addExecuteCommandHandler=CR;function PR(r,e){var t;let n=e.lsp.DocumentLinkProvider;if(n){r.onDocumentLinks(Gi((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 Ua(s)}})}}X.addDocumentLinkHandler=PR;function kR(r,e){r.onSignatureHelp(Gi((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=kR;function xR(r,e){let t="No call hierarchy provider registered";r.languages.callHierarchy.onPrepare(Gi((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(lm((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(lm((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=xR;function lm(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 Ua(s)}}}X.createCallHierarchyRequestHandler=lm;function Gi(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 Ua(c)}}}X.createServerRequestHandler=Gi;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 Ua(c)}}}X.createRequestHandler=Xt;function Ua(r){if((0,cw.isOperationCancelled)(r))return new lr.ResponseError(lr.LSPErrorCodes.RequestCancelled,"The request has been cancelled.");if(r instanceof lr.ResponseError)return r;throw r}});var pm=C(dc=>{"use strict";Object.defineProperty(dc,"__esModule",{value:!0});dc.DefaultReferencesProvider=void 0;var SR=Ne(),mw=Re(),hw=et(),fm=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,hw.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,mw.isReference)(s)?i.push(SR.Location.create(n.uri.toString(),s.$refNode.range)):i.push(SR.Location.create(s.sourceUri.toString(),s.segment.range))})}return i}};dc.DefaultReferencesProvider=fm});var hm=C(fc=>{"use strict";Object.defineProperty(fc,"__esModule",{value:!0});fc.DefaultRenameProvider=void 0;var yw=Ne(),gw=Io(),NR=et(),mm=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,NR.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=yw.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,NR.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,gw.isNamed)(e.element)&&e===this.nameProvider.getNameNode(e.element)}};fc.DefaultRenameProvider=mm});var DR=C(pc=>{"use strict";Object.defineProperty(pc,"__esModule",{value:!0});pc.AbstractTypeDefinitionProvider=void 0;var vw=Ne(),Tw=et(),ym=class{constructor(e){this.references=e.references.References}getTypeDefinition(e,t,n=vw.CancellationToken.None){let i=e.parseResult.value;if(i.$cstNode){let o=(0,Tw.findDeclarationNodeAtOffset)(i.$cstNode,e.textDocument.offsetAt(t.position));if(o){let a=this.references.findDeclaration(o);if(a)return this.collectGoToTypeLocationLinks(a,n)}}}};pc.AbstractTypeDefinitionProvider=ym});var gm=C(tt=>{"use strict";var Rw=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)&&Rw(e,r,t)};Object.defineProperty(tt,"__esModule",{value:!0});wt(Bp(),tt);wt(Hp(),tt);wt(tR(),tt);wt(Vp(),tt);wt(nR(),tt);wt(Xp(),tt);wt(iR(),tt);wt(Ku(),tt);wt(Qp(),tt);wt(tm(),tt);wt(wp(),tt);wt(aR(),tt);wt(dm(),tt);wt(pm(),tt);wt(hm(),tt);wt(Ju(),tt);wt(um(),tt);wt(DR(),tt)});var wR=C(mc=>{"use strict";Object.defineProperty(mc,"__esModule",{value:!0});mc.LangiumGrammarDefinitionProvider=void 0;var vm=Ne(),_w=gm(),Aw=Re(),bw=Pt(),Ew=ze(),Cw=Ft(),Tm=class extends _w.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,Ew.isGrammarImport)(e.element)&&((n=(0,bw.findAssignment)(e))===null||n===void 0?void 0:n.feature)===c){let l=(0,Cw.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:vm.Range.create(0,0,0,0),h=(u=(s=d.$cstNode)===null||s===void 0?void 0:s.range)!==null&&u!==void 0?u:vm.Range.create(0,0,0,0);return[vm.LocationLink.create(l.$document.uri.toString(),h,g,e.range)]}return}return super.collectLocationLinks(e,t)}findTargetObject(e){return e.isDeclared?e:(0,Aw.streamContents)(e).head()}};mc.LangiumGrammarDefinitionProvider=Tm});var OR=C(hc=>{"use strict";Object.defineProperty(hc,"__esModule",{value:!0});hc.AbstractCallHierarchyProvider=void 0;var Pw=Ne(),IR=gn(),Rm=et(),_m=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,Rm.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:Pw.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(IR.URI.parse(e.item.uri)),n=t.parseResult.value,i=(0,Rm.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(IR.URI.parse(e.item.uri)),n=t.parseResult.value,i=(0,Rm.findDeclarationNodeAtOffset)(n.$cstNode,t.textDocument.offsetAt(e.item.range.start),this.grammarConfig.nameRegexp);if(!!i)return this.getOutgoingCalls(i.element)}};hc.AbstractCallHierarchyProvider=_m});var MR=C(gc=>{"use strict";Object.defineProperty(gc,"__esModule",{value:!0});gc.LangiumGrammarCallHierarchyProvider=void 0;var $R=Ne(),kw=OR(),Am=Re(),xw=et(),yc=ze(),bm=class extends kw.AbstractCallHierarchyProvider{getIncomingCalls(e,t){if(!(0,yc.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,xw.findLeafNodeAtOffset)(a.$cstNode,i.segment.offset);if(!s)return;let u=(0,Am.getContainerOfType)(s.element,yc.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:$R.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,yc.isParserRule)(e))return;let t=(0,Am.streamAllContents)(e).filter(yc.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,Am.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:$R.SymbolKind.Method,name:i.to.text,range:i.refCstNode.range,selectionRange:i.to.range,uri:i.docUri},fromRanges:i.from}))}};gc.LangiumGrammarCallHierarchyProvider=bm});var vc=C(Ui=>{"use strict";Object.defineProperty(Ui,"__esModule",{value:!0});Ui.createLangiumGrammarServices=Ui.LangiumGrammarModule=void 0;var LR=Tc(),FR=ka(),qR=wv(),jR=cT(),GR=bp(),Sw=OT(),Nw=$T(),Dw=LT(),ww=FT(),Iw=jT(),Ow=zT(),$w=wR(),Mw=MR();Ui.LangiumGrammarModule={validation:{ValidationRegistry:r=>new GR.LangiumGrammarValidationRegistry(r),LangiumGrammarValidator:r=>new GR.LangiumGrammarValidator(r)},lsp:{FoldingRangeProvider:r=>new Nw.LangiumGrammarFoldingRangeProvider(r),CodeActionProvider:()=>new Sw.LangiumGrammarCodeActionProvider,SemanticTokenProvider:r=>new ww.LangiumGrammarSemanticTokenProvider(r),Formatter:()=>new Dw.LangiumGrammarFormatter,DefinitionProvider:r=>new $w.LangiumGrammarDefinitionProvider(r),CallHierarchyProvider:r=>new Mw.LangiumGrammarCallHierarchyProvider(r)},references:{ScopeComputation:r=>new jR.LangiumGrammarScopeComputation(r),ScopeProvider:r=>new jR.LangiumGrammarScopeProvider(r),References:r=>new Ow.LangiumGrammarReferences(r),NameProvider:()=>new Iw.LangiumGrammarNameProvider}};function Lw(r,e){let t=(0,FR.inject)((0,LR.createDefaultSharedModule)(r),qR.LangiumGrammarGeneratedSharedModule,e),n=(0,FR.inject)((0,LR.createDefaultModule)({shared:t}),qR.LangiumGrammarGeneratedModule,Ui.LangiumGrammarModule);return t.ServiceRegistry.register(n),{shared:t,grammar:n}}Ui.createLangiumGrammarServices=Lw});var HR=C(Rc=>{"use strict";Object.defineProperty(Rc,"__esModule",{value:!0});Rc.collectAst=void 0;var UR=Ct(),Fw=mp(),qw=cp(),jw=mi();function Gw(r,e){let t=(0,jw.collectAllAstResources)(e,r),n=(0,Fw.collectInferredTypes)(Array.from(t.parserRules),Array.from(t.datatypeRules)),i=(0,qw.collectDeclaredTypes)(Array.from(t.interfaces),Array.from(t.types),n),o=n.interfaces.concat(i.interfaces),a=n.unions.concat(i.unions);return Uw(o),a.sort((s,u)=>s.name.localeCompare(u.name)),{interfaces:(0,UR.stream)(o).distinct(s=>s.name).toArray(),unions:(0,UR.stream)(a).distinct(s=>s.name).toArray()}}Rc.collectAst=Gw;function Uw(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 Cm=C(_c=>{"use strict";Object.defineProperty(_c,"__esModule",{value:!0});_c.interpretAstReflection=void 0;var Hw=Re(),Ww=kr(),Kw=_u(),Bw=ze(),zw=vc(),Vw=HR(),Yw=mi(),Em;function Xw(r,e){let t;(0,Bw.isGrammar)(r)?(!Em&&!e&&(Em=(0,zw.createLangiumGrammarServices)(Kw.EmptyFileSystem).shared.workspace.LangiumDocuments),t=(0,Vw.collectAst)(e??Em,[r])):t=r;let n=t.interfaces.map(s=>s.name).concat(t.unions.map(s=>s.name)),i=Jw(t),o=Zw(t),a=eI(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,Hw.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}}}_c.interpretAstReflection=Xw;function Jw(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 Zw(r){let e=new Map,t=(0,Yw.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:Qw(o,a)})}return e}function Qw(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 eI(r){let e=new Ww.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 tI=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]}),rI=he&&he.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),nI=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)&&tI(e,r,t);return rI(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 WR=Tc(),KR=ka(),iI=Cm(),ar=nI(ze()),km=Ft(),BR=vc(),oI=_o(),Ha=Re(),aI=et(),Pm=_u();function zR(r){return r.rules.find(e=>ar.isParserRule(e)&&e.entry)}he.getEntryRule=zR;function sI(r,e){let t=new Set,n=zR(r);if(!n)return new Set(r.rules);VR(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=sI;function VR(r,e,t){e.add(r.name),(0,Ha.streamAllContents)(r).forEach(n=>{if(ar.isRuleCall(n)||t&&ar.isTerminalRuleCall(n)){let i=n.rule.ref;i&&!e.has(i.name)&&VR(i,e,t)}})}function uI(r){if(r.terminal)return r.terminal;if(r.type.ref){let e=YR(r.type.ref);return e?.terminal}}he.getCrossReferenceTerminal=uI;function cI(r){return r.hidden&&!" ".match((0,km.terminalRegex)(r))}he.isCommentTerminal=cI;function lI(r,e){return!r||!e?[]:xm(r,e,r.element,!0)}he.findNodesForProperty=lI;function dI(r,e,t){if(!r||!e)return;let n=xm(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=dI;function xm(r,e,t,n){if(!n){let i=(0,Ha.getContainerOfType)(r.feature,ar.isAssignment);if(i&&i.feature===e)return[r]}return(0,oI.isCompositeCstNode)(r)&&r.element===t?r.children.flatMap(i=>xm(i,e,t,!1)):[]}function fI(r,e){return r?Sm(r,e,r?.element):[]}he.findNodesForKeyword=fI;function pI(r,e,t){if(!r)return;let n=Sm(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=pI;function Sm(r,e,t){if(r.element!==t)return[];if(ar.isKeyword(r.feature)&&r.feature.value===e)return[r];let n=(0,aI.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=Sm;function mI(r){let e=r;do{let t=(0,Ha.getContainerOfType)(e.feature,ar.isAssignment);if(t)return t;e=e.parent}while(e)}he.findAssignment=mI;function YR(r){return ar.isInferredType(r)&&(r=r.$container),XR(r,new Map)}he.findNameAssignment=YR;function XR(r,e){var t;function n(i,o){let a;return(0,Ha.getContainerOfType)(i,ar.isAssignment)||(a=XR(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,Ha.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 hI(r){let e=(0,BR.createLangiumGrammarServices)(Pm.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,km.prepareGrammar)(e,t)}he.loadGrammarFromJson=hI;function yI(r){var e,t,n,i,o,a;let s=(e=r.grammarServices)!==null&&e!==void 0?e:(0,BR.createLangiumGrammarServices)(Pm.EmptyFileSystem).grammar,u=typeof r.grammar=="string"?s.parser.LangiumParser.parse(r.grammar).value:r.grammar;(0,km.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,iI.interpretAstReflection)(u)},g={Grammar:()=>u,LanguageMetaData:()=>l,parser:{ParserConfig:()=>c}},h=(0,KR.inject)((0,WR.createDefaultSharedModule)(Pm.EmptyFileSystem),d,r.sharedModule),p=(0,KR.inject)((0,WR.createDefaultModule)({shared:h}),g,r.module);return h.ServiceRegistry.register(p),p}he.createServicesForGrammar=yI});var JR=C(Ac=>{"use strict";Object.defineProperty(Ac,"__esModule",{value:!0});Ac.createGrammarConfig=void 0;var gI=et(),vI=Pt(),TI=So(),RI=ze(),_I=Ft();function AI(r){let e=[],t=r.Grammar;for(let n of t.rules)(0,RI.isTerminalRule)(n)&&(0,vI.isCommentTerminal)(n)&&(0,TI.isMultilineComment)((0,_I.terminalRegex)(n))&&e.push(n.name);return{multilineCommentRules:e,nameRegexp:gI.DefaultNameRegexp}}Ac.createGrammarConfig=AI});var Nm=C(bc=>{"use strict";Object.defineProperty(bc,"__esModule",{value:!0});bc.VERSION=void 0;bc.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 Cc=C(qo=>{"use strict";Object.defineProperty(qo,"__esModule",{value:!0});qo.clearRegExpParserCache=qo.getRegExpAst=void 0;var bI=Da(),Ec={},EI=new bI.RegExpParser;function CI(r){var e=r.toString();if(Ec.hasOwnProperty(e))return Ec[e];var t=EI.pattern(e);return Ec[e]=t,t}qo.getRegExpAst=CI;function PI(){Ec={}}qo.clearRegExpParserCache=PI});var r_=C(dr=>{"use strict";var kI=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 QR=Da(),wr=_e(),e_=Cc(),Bn=wm(),t_="Complement Sets are not supported for first char optimization";dr.failedOptimizationPrefixMsg=`Unable to use "first char" lexer optimizations:
|
|
3591
|
-
`;function
|
|
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()+` >
|
|
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: "+
|
|
3599
|
-
`)+" Please open an issue at: https://github.com/bd82/regexp-to-ast/issues"+i)}}return[]}dr.getOptimizedStartCodesIndices=
|
|
3600
|
-
`],tracer:function(_,R){return R()}});var t=e.tracer;t("initCharCodeToOptimizedIndexMap",function(){
|
|
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.
|
|
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){
|
|
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.
|
|
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=
|
|
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:
|
|
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=
|
|
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:
|
|
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=
|
|
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.
|
|
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=
|
|
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
|
|
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=
|
|
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.
|
|
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=
|
|
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.
|
|
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=
|
|
3625
|
-
`,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:
|
|
3626
|
-
a boolean 2nd argument is no longer supported`);this.config=(0,Le.merge)(
|
|
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,
|
|
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.
|
|
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(`-----------------------
|
|
3628
3628
|
`);throw new Error(`Errors detected in definition of Lexer:
|
|
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,
|
|
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,
|
|
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(`-----------------------
|
|
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,
|
|
3634
|
-
See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return(0,tn.has)(r,k_)&&(t.CATEGORIES=r[k_]),(0,Gm.augmentTokenTypes)([t]),(0,tn.has)(r,x_)&&(t.LABEL=r[x_]),(0,tn.has)(r,S_)&&(t.GROUP=r[S_]),(0,tn.has)(r,D_)&&(t.POP_MODE=r[D_]),(0,tn.has)(r,N_)&&(t.PUSH_MODE=r[N_]),(0,tn.has)(r,w_)&&(t.LONGER_ALT=r[w_]),(0,tn.has)(r,I_)&&(t.LINE_BREAKS=r[I_]),(0,tn.has)(r,O_)&&(t.START_CHARS_HINT=r[O_]),t}Gt.EOF=M_({name:"EOF",pattern:eO.Lexer.NA});(0,Gm.augmentTokenTypes)([Gt.EOF]);function oO(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=oO;function aO(r,e){return(0,Gm.tokenStructuredMatcher)(r,e)}Gt.tokenMatcher=aO});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(),sO=vi(),En=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=En;var L_=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}(En);ke.NonTerminal=L_;var F_=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}(En);ke.Rule=F_;var q_=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}(En);ke.Alternative=q_;var j_=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}(En);ke.Option=j_;var G_=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}(En);ke.RepetitionMandatory=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}(En);ke.RepetitionMandatoryWithSeparator=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}(En);ke.Repetition=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}(En);ke.RepetitionWithSeparator=W_;var K_=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}(En);ke.Alternation=K_;var Nc=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=Nc;function uO(r){return(0,Ye.map)(r,Ba)}ke.serializeGrammar=uO;function Ba(r){function e(o){return(0,Ye.map)(o,Ba)}if(r instanceof L_){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 q_)return{type:"Alternative",definition:e(r.definition)};if(r instanceof j_)return{type:"Option",idx:r.idx,definition:e(r.definition)};if(r instanceof G_)return{type:"RepetitionMandatory",idx:r.idx,definition:e(r.definition)};if(r instanceof U_)return{type:"RepetitionMandatoryWithSeparator",idx:r.idx,separator:Ba(new Nc({terminalType:r.separator})),definition:e(r.definition)};if(r instanceof W_)return{type:"RepetitionWithSeparator",idx:r.idx,separator:Ba(new Nc({terminalType:r.separator})),definition:e(r.definition)};if(r instanceof H_)return{type:"Repetition",idx:r.idx,definition:e(r.definition)};if(r instanceof K_)return{type:"Alternation",idx:r.idx,definition:e(r.definition)};if(r instanceof Nc){var n={type:"Terminal",name:r.terminalType.name,label:(0,sO.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 F_)return{type:"Rule",name:r.name,orgText:r.orgText,definition:e(r.definition)};throw Error("non exhaustive match")}}}ke.serializeProduction=Ba});var wc=C(Dc=>{"use strict";Object.defineProperty(Dc,"__esModule",{value:!0});Dc.RestWalker=void 0;var Um=_e(),pr=fr(),cO=function(){function r(){}return r.prototype.walk=function(e,t){var n=this;t===void 0&&(t=[]),(0,Um.forEach)(e.definition,function(i,o){var a=(0,Um.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=B_(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=B_(e,t,n);this.walk(e,i)},r.prototype.walkOr=function(e,t,n){var i=this,o=t.concat(n);(0,Um.forEach)(e.definition,function(a){var s=new pr.Alternative({definition:[a]});i.walk(s,o)})},r}();Dc.RestWalker=cO;function B_(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(Ic=>{"use strict";Object.defineProperty(Ic,"__esModule",{value:!0});Ic.GAstVisitor=void 0;var Cn=fr(),lO=function(){function r(){}return r.prototype.visit=function(e){var t=e;switch(t.constructor){case Cn.NonTerminal:return this.visitNonTerminal(t);case Cn.Alternative:return this.visitAlternative(t);case Cn.Option:return this.visitOption(t);case Cn.RepetitionMandatory:return this.visitRepetitionMandatory(t);case Cn.RepetitionMandatoryWithSeparator:return this.visitRepetitionMandatoryWithSeparator(t);case Cn.RepetitionWithSeparator:return this.visitRepetitionWithSeparator(t);case Cn.Repetition:return this.visitRepetition(t);case Cn.Alternation:return this.visitAlternation(t);case Cn.Terminal:return this.visitTerminal(t);case Cn.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}();Ic.GAstVisitor=lO});var Va=C(Jt=>{"use strict";var dO=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 za=_e(),rt=fr(),fO=Uo();function pO(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=pO;function Hm(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,za.some)(r.definition,function(n){return Hm(n,e)}):r instanceof rt.NonTerminal&&(0,za.contains)(e,r)?!1:r instanceof rt.AbstractProduction?(r instanceof rt.NonTerminal&&e.push(r),(0,za.every)(r.definition,function(n){return Hm(n,e)})):!1}Jt.isOptionalProd=Hm;function mO(r){return r instanceof rt.Alternation}Jt.isBranchingProd=mO;function hO(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=hO;var z_=function(r){dO(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,za.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,za.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}(fO.GAstVisitor);Jt.DslMethodsCollectorVisitor=z_;var Oc=new z_;function yO(r){Oc.reset(),r.accept(Oc);var e=Oc.dslMethods;return Oc.reset(),e}Jt.collectMethods=yO});var Km=C(Pn=>{"use strict";Object.defineProperty(Pn,"__esModule",{value:!0});Pn.firstForTerminal=Pn.firstForBranching=Pn.firstForSequence=Pn.first=void 0;var $c=_e(),V_=fr(),Wm=Va();function Mc(r){if(r instanceof V_.NonTerminal)return Mc(r.referencedRule);if(r instanceof V_.Terminal)return J_(r);if((0,Wm.isSequenceProd)(r))return Y_(r);if((0,Wm.isBranchingProd)(r))return X_(r);throw Error("non exhaustive match")}Pn.first=Mc;function Y_(r){for(var e=[],t=r.definition,n=0,i=t.length>n,o,a=!0;i&&a;)o=t[n],a=(0,Wm.isOptionalProd)(o),e=e.concat(Mc(o)),n=n+1,i=t.length>n;return(0,$c.uniq)(e)}Pn.firstForSequence=Y_;function X_(r){var e=(0,$c.map)(r.definition,function(t){return Mc(t)});return(0,$c.uniq)((0,$c.flatten)(e))}Pn.firstForBranching=X_;function J_(r){return[r.terminalType]}Pn.firstForTerminal=J_});var Bm=C(Lc=>{"use strict";Object.defineProperty(Lc,"__esModule",{value:!0});Lc.IN=void 0;Lc.IN="_~IN~_"});var rA=C(Ir=>{"use strict";var gO=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 vO=wc(),TO=Km(),Z_=_e(),Q_=Bm(),RO=fr(),eA=function(r){gO(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=tA(t.referencedRule,t.idx)+this.topProd.name,a=n.concat(i),s=new RO.Alternative({definition:a}),u=(0,TO.first)(s);this.follows[o]=u},e}(vO.RestWalker);Ir.ResyncFollowsWalker=eA;function _O(r){var e={};return(0,Z_.forEach)(r,function(t){var n=new eA(t).startWalking();(0,Z_.assign)(e,n)}),e}Ir.computeAllProdsFollows=_O;function tA(r,e){return r.name+e+Q_.IN}Ir.buildBetweenProdsFollowPrefix=tA;function AO(r){var e=r.terminalType.name;return e+r.idx+Q_.IN}Ir.buildInProdFollowPrefix=AO});var Ya=C(Vn=>{"use strict";Object.defineProperty(Vn,"__esModule",{value:!0});Vn.defaultGrammarValidatorErrorProvider=Vn.defaultGrammarResolverErrorProvider=Vn.defaultParserErrorProvider=void 0;var Ho=vi(),bO=_e(),rn=_e(),zm=fr(),nA=Va();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
|
-
but found: '`+s+"'";if(i)return a+i+u;var c=(0,rn.reduce)(e,function(
|
|
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=`
|
|
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(
|
|
3640
|
-
inside top level rule: ->`+r.name+"<-";return t}};
|
|
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+"<-":"")+`
|
|
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,
|
|
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.
|
|
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=
|
|
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.
|
|
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 aA=C(Ti=>{"use strict";var EO=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 CO=vr(),iA=_e(),PO=Uo();function kO(r,e){var t=new oA(r,e);return t.resolveRefs(),t.errors}Ti.resolveGrammar=kO;var oA=function(r){EO(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,iA.forEach)((0,iA.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:CO.ParserDefinitionErrorType.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:t.nonTerminalName})}},e}(PO.GAstVisitor);Ti.GastRefResolverVisitor=oA});var Ja=C(dt=>{"use strict";var Wi=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 sA=wc(),ye=_e(),xO=Km(),se=fr(),uA=function(r){Wi(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}(sA.RestWalker);dt.AbstractNextPossibleTokensWalker=uA;var SO=function(r){Wi(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,xO.first)(a),this.found=!0}},e}(uA);dt.NextAfterTokenWalker=SO;var Xa=function(r){Wi(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}(sA.RestWalker);dt.AbstractNextTerminalAfterProductionWalker=Xa;var NO=function(r){Wi(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}(Xa);dt.NextTerminalAfterManyWalker=NO;var DO=function(r){Wi(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}(Xa);dt.NextTerminalAfterManySepWalker=DO;var wO=function(r){Wi(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}(Xa);dt.NextTerminalAfterAtLeastOneWalker=wO;var IO=function(r){Wi(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}(Xa);dt.NextTerminalAfterAtLeastOneSepWalker=IO;function cA(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=cA(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=cA;function OO(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 h=g.def,p=g.idx,A=g.ruleStack,x=g.occurrenceStack;if(!(0,ye.isEmpty)(h)){var k=h[0];if(k===i){var _={idx:p,def:(0,ye.drop)(h),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)(h),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)(h)),ruleStack:B,occurrenceStack:V};d.push(_)}else if(k instanceof se.Option){var G={idx:p,def:(0,ye.drop)(h),ruleStack:A,occurrenceStack:x};d.push(G),d.push(a);var ge={idx:p,def:k.definition.concat((0,ye.drop)(h)),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)(h)),_={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)(h)),_={idx:p,def:Ze,ruleStack:A,occurrenceStack:x};d.push(_)}else if(k instanceof se.RepetitionWithSeparator){var G={idx:p,def:(0,ye.drop)(h),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)(h)),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)(h),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)(h)),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)(h)),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)(h)),ruleStack:A,occurrenceStack:x});else if(k instanceof se.Rule)d.push($O(k,p,A,x));else throw Error("non exhaustive match")}}return l}dt.nextPossibleTokensAfter=OO;function $O(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 Za=C(we=>{"use strict";var fA=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(),lA=Ja(),MO=wc(),Fc=Go(),Ri=fr(),LO=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 FO(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=FO;function qO(r,e,t,n,i,o){var a=mA(r,e,t),s=Xm(a)?Fc.tokenStructuredMatcherNoCategories:Fc.tokenStructuredMatcher;return o(a,n,s,i)}we.buildLookaheadFuncForOr=qO;function jO(r,e,t,n,i,o){var a=hA(r,e,i,t),s=Xm(a)?Fc.tokenStructuredMatcherNoCategories:Fc.tokenStructuredMatcher;return o(a[0],s,n)}we.buildLookaheadFuncForOptionalProd=jO;function GO(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,h=c[l];if(h!==void 0&&h.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],h=g.length,p=0;p<h;p++){var A=this.LA(p+1);if(t(A,g[p])===!1)continue e}return u}}}}we.buildAlternativesLookAheadFunc=GO;function UO(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 h=this.LA(g+1);if(e(h,l[g])===!1)continue e}return!0}return!1}}we.buildSingleAlternativeLookaheadFunction=UO;var HO=function(r){fA(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}(MO.RestWalker),pA=function(r){fA(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}(LO.GAstVisitor);function dA(r){for(var e=new Array(r),t=0;t<r;t++)e[t]=[];return e}function Vm(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 WO(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 Ym(r,e){for(var t=(0,Fe.map)(r,function(l){return(0,lA.possiblePathsFrom)([l],1)}),n=dA(t.length),i=(0,Fe.map)(t,function(l){var d={};return(0,Fe.forEach)(l,function(g){var h=Vm(g.partialPath);(0,Fe.forEach)(h,function(p){d[p]=!0})}),d}),o=t,a=1;a<=e;a++){var s=o;o=dA(s.length);for(var u=function(l){for(var d=s[l],g=0;g<d.length;g++){var h=d[g].partialPath,p=d[g].suffixDef,A=Vm(h),x=WO(i,A,l);if(x||(0,Fe.isEmpty)(p)||h.length===e){var k=n[l];if(yA(k,h)===!1){k.push(h);for(var _=0;_<A.length;_++){var R=A[_];i[l][R]=!0}}}else{var D=(0,lA.possiblePathsFrom)(p,a+1,h);o[l]=o[l].concat(D),(0,Fe.forEach)(D,function(B){var V=Vm(B.partialPath);(0,Fe.forEach)(V,function(G){i[l][G]=!0})})}}},c=0;c<s.length;c++)u(c)}return n}we.lookAheadSequenceFromAlternatives=Ym;function mA(r,e,t,n){var i=new pA(r,kt.ALTERNATION,n);return e.accept(i),Ym(i.result,t)}we.getLookaheadPathsForOr=mA;function hA(r,e,t,n){var i=new pA(r,t);e.accept(i);var o=i.result,a=new HO(e,r,t),s=a.startWalking(),u=new Ri.Alternative({definition:o}),c=new Ri.Alternative({definition:s});return Ym([u,c],n)}we.getLookaheadPathsForOptionalProd=hA;function yA(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=yA;function KO(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=KO;function Xm(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=Xm});var rh=C(xe=>{"use strict";var Jm=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(),kn=vr(),Zm=Va(),Wo=Za(),BO=Ja(),nn=fr(),Qm=Uo();function zO(r,e,t,n,i){var o=Ie.map(r,function(h){return VO(h,n)}),a=Ie.map(r,function(h){return eh(h,h,n)}),s=[],u=[],c=[];(0,nt.every)(a,nt.isEmpty)&&(s=(0,nt.map)(r,function(h){return _A(h,n)}),u=(0,nt.map)(r,function(h){return AA(h,e,n)}),c=CA(r,e,n));var l=JO(r,t,n),d=(0,nt.map)(r,function(h){return EA(h,n)}),g=(0,nt.map)(r,function(h){return RA(h,r,i,n)});return Ie.flatten(o.concat(c,a,s,u,l,d,g))}xe.validateGrammar=zO;function VO(r,e){var t=new TA;r.accept(t);var n=t.allProductions,i=Ie.groupBy(n,gA),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,Zm.getProductionDslName)(u),d={message:c,type:kn.ParserDefinitionErrorType.DUPLICATE_PRODUCTIONS,ruleName:r.name,dslName:l,occurrence:u.idx},g=vA(u);return g&&(d.parameter=g),d});return a}function gA(r){return(0,Zm.getProductionDslName)(r)+"_#_"+r.idx+"_#_"+vA(r)}xe.identifyProductionForDuplicates=gA;function vA(r){return r instanceof nn.Terminal?r.terminalType.name:r instanceof nn.NonTerminal?r.nonTerminalName:""}var TA=function(r){Jm(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}(Qm.GAstVisitor);xe.OccurrenceValidationCollector=TA;function RA(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:kn.ParserDefinitionErrorType.DUPLICATE_RULE_NAME,ruleName:r.name})}return i}xe.validateRuleDoesNotAlreadyExist=RA;function YO(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:kn.ParserDefinitionErrorType.INVALID_RULE_OVERRIDE,ruleName:r})),n}xe.validateRuleIsOverridden=YO;function eh(r,e,t,n){n===void 0&&(n=[]);var i=[],o=Qa(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:kn.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),eh(r,l,t,d)});return i.concat(Ie.flatten(c))}xe.validateNoLeftRecursion=eh;function Qa(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(Qa(t.definition));else if(t instanceof nn.Alternation)e=Ie.flatten(Ie.map(t.definition,function(a){return Qa(a.definition)}));else if(!(t instanceof nn.Terminal))throw Error("non exhaustive match");var n=(0,Zm.isOptionalProd)(t),i=r.length>1;if(n&&i){var o=Ie.drop(r);return e.concat(Qa(o))}else return e}xe.getFirstNoneTerminal=Qa;var th=function(r){Jm(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}(Qm.GAstVisitor);function _A(r,e){var t=new th;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,BO.nextPossibleTokensAfter)([c],[],null,1);return Ie.isEmpty(d)?{message:e.buildEmptyAlternationError({topLevelRule:r,alternation:a,emptyChoiceIdx:l}),type:kn.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=_A;function AA(r,e,t){var n=new th;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=XO(l,s,r,t),g=PA(l,s,r,t);return a.concat(d,g)},[]);return o}xe.validateAmbiguousAlternationAlternatives=AA;var bA=function(r){Jm(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}(Qm.GAstVisitor);xe.RepetionCollector=bA;function EA(r,e){var t=new th;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:kn.ParserDefinitionErrorType.TOO_MANY_ALTS,ruleName:r.name,occurrence:a.idx}),o},[]);return i}xe.validateTooManyAlts=EA;function CA(r,e,t){var n=[];return(0,nt.forEach)(r,function(i){var o=new bA;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 h=t.buildEmptyRepetitionError({topLevelRule:i,repetition:s});n.push({message:h,type:kn.ParserDefinitionErrorType.NO_NON_EMPTY_LOOKAHEAD,ruleName:i.name})}})}),n}xe.validateSomeNonEmptyLookaheadPath=CA;function XO(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,h){c!==h&&(0,Wo.containsPath)(g,l)&&e.definition[h].ignoreAmbiguities!==!0&&d.push(h)}),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:kn.ParserDefinitionErrorType.AMBIGUOUS_ALTS,ruleName:t.name,occurrence:e.idx,alternatives:[s.alts]}});return a}function PA(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 h=[g.idx+1,u+1],p=e.idx===0?"":e.idx,A=n.buildAlternationPrefixAmbiguityError({topLevelRule:t,alternation:e,ambiguityIndices:h,prefixPath:g.path});return{message:A,type:kn.ParserDefinitionErrorType.AMBIGUOUS_PREFIX_ALTS,ruleName:t.name,occurrence:p,alternatives:h}});i=i.concat(d)}}),i}xe.checkPrefixAlternativesAmbiguities=PA;function JO(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:kn.ParserDefinitionErrorType.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:a})}}),n}});var xA=C(Ko=>{"use strict";Object.defineProperty(Ko,"__esModule",{value:!0});Ko.validateGrammar=Ko.resolveGrammar=void 0;var nh=_e(),ZO=aA(),QO=rh(),kA=Ya();function e$(r){r=(0,nh.defaults)(r,{errMsgProvider:kA.defaultGrammarResolverErrorProvider});var e={};return(0,nh.forEach)(r.rules,function(t){e[t.name]=t}),(0,ZO.resolveGrammar)(e,r.errMsgProvider)}Ko.resolveGrammar=e$;function t$(r){return r=(0,nh.defaults)(r,{errMsgProvider:kA.defaultGrammarValidatorErrorProvider}),(0,QO.validateGrammar)(r.rules,r.maxLookahead,r.tokenTypes,r.errMsgProvider,r.grammarName)}Ko.validateGrammar=t$});var Bo=C(mr=>{"use strict";var es=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 r$=_e(),SA="MismatchedTokenException",NA="NoViableAltException",DA="EarlyExitException",wA="NotAllInputParsedException",IA=[SA,NA,DA,wA];Object.freeze(IA);function n$(r){return(0,r$.contains)(IA,r.name)}mr.isRecognitionException=n$;var qc=function(r){es(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),i$=function(r){es(e,r);function e(t,n,i){var o=r.call(this,t,n)||this;return o.previousToken=i,o.name=SA,o}return e}(qc);mr.MismatchedTokenException=i$;var o$=function(r){es(e,r);function e(t,n,i){var o=r.call(this,t,n)||this;return o.previousToken=i,o.name=NA,o}return e}(qc);mr.NoViableAltException=o$;var a$=function(r){es(e,r);function e(t,n){var i=r.call(this,t,n)||this;return i.name=wA,i}return e}(qc);mr.NotAllInputParsedException=a$;var s$=function(r){es(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}(qc);mr.EarlyExitException=s$});var oh=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 jc=vi(),Or=_e(),u$=Bo(),c$=Bm(),l$=vr();Zt.EOF_FOLLOW_KEY={};Zt.IN_RULE_RECOVERY_EXCEPTION="InRuleRecoveryException";function ih(r){this.name=Zt.IN_RULE_RECOVERY_EXCEPTION,this.message=r}Zt.InRuleRecoveryException=ih;ih.prototype=Error.prototype;var d$=function(){function r(){}return r.prototype.initRecoverable=function(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=(0,Or.has)(e,"recoveryEnabled")?e.recoveryEnabled:l$.DEFAULT_PARSER_CONFIG.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=OA)},r.prototype.getTokenToInsert=function(e){var t=(0,jc.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 h=o.LA(0),p=o.errorMessageProvider.buildMismatchTokenMessage({expected:i,actual:l,previous:h,ruleName:o.getCurrRuleFullName()}),A=new u$.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 ih("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[jc.EOF];var t=e.ruleName+e.idxInCallingRule+c$.IN+e.inRule;return this.resyncFollows[t]},r.prototype.addToResyncTokens=function(e,t){return this.tokenMatcher(e,jc.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=d$;function OA(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,h=u.occurrence,p=u.isEndOfRule;this.RULE_STACK.length===1&&p&&g===void 0&&(g=jc.EOF,h=1),this.shouldInRepetitionRecoveryBeTried(g,h,a)&&this.tryInRepetitionRecovery(r,e,t,g)}Zt.attemptInRepetitionRecovery=OA});var Gc=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 f$(r,e,t){return t|e|r}Ce.getKeyForAutomaticLookahead=f$;var uj=32-Ce.BITS_FOR_ALT_IDX});var MA=C(Uc=>{"use strict";Object.defineProperty(Uc,"__esModule",{value:!0});Uc.LooksAhead=void 0;var Yn=Za(),on=_e(),$A=vr(),Xn=Gc(),Ki=Va(),p$=function(){function r(){}return r.prototype.initLooksAhead=function(e){this.dynamicTokensEnabled=(0,on.has)(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:$A.DEFAULT_PARSER_CONFIG.dynamicTokensEnabled,this.maxLookahead=(0,on.has)(e,"maxLookahead")?e.maxLookahead:$A.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,Ki.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,Ki.getProductionDslName)(d)+g,function(){var h=(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,h)})}),(0,on.forEach)(a,function(d){t.computeLookaheadFunc(n,d.idx,Xn.MANY_IDX,Yn.PROD_TYPE.REPETITION,d.maxLookahead,(0,Ki.getProductionDslName)(d))}),(0,on.forEach)(s,function(d){t.computeLookaheadFunc(n,d.idx,Xn.OPTION_IDX,Yn.PROD_TYPE.OPTION,d.maxLookahead,(0,Ki.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,Ki.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,Ki.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,Ki.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}();Uc.LooksAhead=p$});var LA=C(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});xn.addNoneTerminalToCst=xn.addTerminalToCst=xn.setNodeLocationFull=xn.setNodeLocationOnlyOffset=void 0;function m$(r,e){isNaN(r.startOffset)===!0?(r.startOffset=e.startOffset,r.endOffset=e.endOffset):r.endOffset<e.endOffset&&(r.endOffset=e.endOffset)}xn.setNodeLocationOnlyOffset=m$;function h$(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)}xn.setNodeLocationFull=h$;function y$(r,e,t){r.children[t]===void 0?r.children[t]=[e]:r.children[t].push(e)}xn.addTerminalToCst=y$;function g$(r,e,t){r.children[e]===void 0?r.children[e]=[t]:r.children[e].push(t)}xn.addNoneTerminalToCst=g$});var ah=C(_i=>{"use strict";Object.defineProperty(_i,"__esModule",{value:!0});_i.defineNameProp=_i.functionName=_i.classNameFromInstance=void 0;var v$=_e();function T$(r){return qA(r.constructor)}_i.classNameFromInstance=T$;var FA="name";function qA(r){var e=r.name;return e||"anonymous"}_i.functionName=qA;function R$(r,e){var t=Object.getOwnPropertyDescriptor(r,FA);return(0,v$.isUndefined)(t)||t.configurable?(Object.defineProperty(r,FA,{enumerable:!1,configurable:!0,writable:!1,value:e}),!0):!1}_i.defineNameProp=R$});var WA=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(),ts=ah();function jA(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=jA;function _$(r,e){var t=function(){};(0,ts.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=GA(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,ts.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 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)+`>:
|
|
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=
|
|
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
|
|
3669
3669
|
There is no Grammar Rule corresponding to this method's name.
|
|
3670
|
-
`,type:sh.REDUNDANT_METHOD,methodName:n});return t}Ut.validateRedundantMethods=HA});var BA=C(Hc=>{"use strict";Object.defineProperty(Hc,"__esModule",{value:!0});Hc.TreeBuilder=void 0;var zo=LA(),bt=_e(),KA=WA(),E$=vr(),C$=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:E$.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,KA.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,KA.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}();Hc.TreeBuilder=C$});var VA=C(Wc=>{"use strict";Object.defineProperty(Wc,"__esModule",{value:!0});Wc.LexerAdapter=void 0;var zA=vr(),P$=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)):zA.END_OF_FILE},r.prototype.LA=function(e){var t=this.currIdx+e;return t<0||this.tokVectorLength<=t?zA.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}();Wc.LexerAdapter=P$});var XA=C(Kc=>{"use strict";Object.defineProperty(Kc,"__esModule",{value:!0});Kc.RecognizerApi=void 0;var YA=_e(),k$=Bo(),uh=vr(),x$=Ya(),S$=rh(),N$=fr(),D$=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=uh.DEFAULT_RULE_CONFIG),(0,YA.contains)(this.definedRulesNames,e)){var i=x$.defaultGrammarValidatorErrorProvider.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),o={message:i,type:uh.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=uh.DEFAULT_RULE_CONFIG);var i=[];i=i.concat((0,S$.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,k$.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,N$.serializeGrammar)((0,YA.values)(this.gastProductionsCache))},r}();Kc.RecognizerApi=D$});var eb=C(zc=>{"use strict";Object.defineProperty(zc,"__esModule",{value:!0});zc.RecognizerEngine=void 0;var at=_e(),Tr=Gc(),Bc=Bo(),JA=Za(),Vo=Ja(),ZA=vr(),w$=oh(),QA=vi(),rs=Go(),I$=ah(),O$=function(){function r(){}return r.prototype.initRecognizerEngine=function(e,t){if(this.className=(0,I$.classNameFromInstance)(this),this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=rs.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: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.
|
|
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)),
|
|
3677
|
-
Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);var i=(0,at.has)(n,"resyncEnabled")?n.resyncEnabled:ZA.DEFAULT_RULE_CONFIG.resyncEnabled,o=(0,at.has)(n,"recoveryValueFunc")?n.recoveryValueFunc:ZA.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,Bc.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,JA.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,JA.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 Bc.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,Bc.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 Bc.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===w$.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),QA.EOF)},r.prototype.reset=function(){this.resetLexerState(),this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]},r}();zc.RecognizerEngine=O$});var rb=C(Vc=>{"use strict";Object.defineProperty(Vc,"__esModule",{value:!0});Vc.ErrorHandler=void 0;var ch=Bo(),lh=_e(),tb=Za(),$$=vr(),M$=function(){function r(){}return r.prototype.initErrorHandler=function(e){this._errors=[],this.errorMessageProvider=(0,lh.has)(e,"errorMessageProvider")?e.errorMessageProvider:$$.DEFAULT_PARSER_CONFIG.errorMessageProvider},r.prototype.SAVE_ERROR=function(e){if((0,ch.isRecognitionException)(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:(0,lh.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,lh.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,tb.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 ch.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,tb.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 ch.NoViableAltException(c,this.LA(1),u))},r}();Vc.ErrorHandler=M$});var ob=C(Yc=>{"use strict";Object.defineProperty(Yc,"__esModule",{value:!0});Yc.ContentAssist=void 0;var nb=Ja(),ib=_e(),L$=function(){function r(){}return r.prototype.initContentAssist=function(){},r.prototype.computeContentAssist=function(e,t){var n=this.gastProductionsCache[e];if((0,ib.isUndefined)(n))throw Error("Rule ->"+e+"<- does not exist in this grammar.");return(0,nb.nextPossibleTokensAfter)([n],t,this.tokenMatcher,this.maxLookahead)},r.prototype.getNextPossibleTokenTypes=function(e){var t=(0,ib.first)(e.ruleStack),n=this.getGAstProductions(),i=n[t],o=new nb.NextAfterTokenWalker(i,e).startWalking();return o},r}();Yc.ContentAssist=L$});var pb=C(Zc=>{"use strict";Object.defineProperty(Zc,"__esModule",{value:!0});Zc.GastRecorder=void 0;var hr=_e(),Sn=fr(),F$=Wa(),cb=Go(),lb=vi(),q$=vr(),j$=Gc(),Jc={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(Jc);var ab=!0,sb=Math.pow(2,j$.BITS_FOR_OCCURRENCE_IDX)-1,db=(0,lb.createToken)({name:"RECORDING_PHASE_TOKEN",pattern:F$.Lexer.NA});(0,cb.augmentTokenTypes)([db]);var fb=(0,lb.createTokenInstance)(db,`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(
|
|
3679
|
-
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}},
|
|
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+`
|
|
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
|
|
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
|
|
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
|
|
3684
|
-
`+("Idx value must be a none negative value smaller than "+(
|
|
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.
|
|
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,
|
|
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:
|
|
3688
3688
|
`+t.join(`
|
|
3689
3689
|
-------------------------------
|
|
3690
|
-
`))})},r.DEFER_DEFINITION_ERRORS_HANDLING=!1,r}();Je.Parser=
|
|
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=`
|
|
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}
|
|
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.
|
|
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=
|
|
3721
|
-
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_7-0-0`)}return r}();H.Parser=yM});var kb=C(Mr=>{"use strict";Object.defineProperty(Mr,"__esModule",{value:!0});Mr.RootCstNodeImpl=Mr.CompositeCstNodeImpl=Mr.LeafCstNodeImpl=Mr.AbstractCstNode=Mr.CstNodeBuilder=void 0;var Cb=lo(),gM=_o(),Pb=et(),dh=class{constructor(){this.nodeStack=[]}get current(){return this.nodeStack[this.nodeStack.length-1]}buildRootNode(e){return this.rootNode=new ol(e),this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(e){let t=new ss;return t.feature=e,t.root=this.rootNode,this.current.children.push(t),this.nodeStack.push(t),t}buildLeafNode(e,t){let n=new as(e.startOffset,e.image.length,(0,Pb.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 as(t.startOffset,t.image.length,(0,Pb.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,gM.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=dh;var os=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=os;var as=class extends os{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=as;var ss=class extends os{constructor(){super(...arguments),this.children=new us(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:Cb.Position.create(0,0),end:Cb.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=ss;var us=class extends Array{constructor(e){super(),this.parent=e,Object.setPrototypeOf(this,us.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}},ol=class extends ss{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=ol});var ls=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 sl=il(),al=ze(),xb=Ft(),Sb=Re(),vM=kb();mt.DatatypeSymbol=Symbol("Datatype");function fh(r){return r.$type===mt.DatatypeSymbol}var cs=class{constructor(e,t){this._unorderedGroups=new Map,this.lexer=new sl.Lexer(wb(t)?Object.values(t):t),this.wrapper=new hh(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=cs;var ph=class extends cs{constructor(e,t){super(e,t),this.nodeBuilder=new vM.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,xb.isDataTypeRule)(e)?mt.DatatypeSymbol:(0,xb.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,al.isKeyword)(n)?i.image:this.converter.convert(i.image,o);this.assign(a.operator,a.feature,c,o,s)}else if(fh(u)){let c=i.image;(0,al.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(fh(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,Sb.linkContentToContainer)(t),this.nodeBuilder.construct(t),e&&this.stack.pop(),fh(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,Sb.getContainerOfType)(e,al.isAssignment);this.assignmentMap.set(e,{assignment:t,isCrossRef:t?(0,al.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=ph;var ul=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 sl.defaultParserErrorProvider.buildNoViableAltMessage(e)}buildEarlyExitMessage(e){return sl.defaultParserErrorProvider.buildEarlyExitMessage(e)}};mt.LangiumParserErrorMessageProvider=ul;var mh=class extends cs{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=mh;var TM={recoveryEnabled:!0,nodeLocationTracking:"full",skipValidations:!0,errorMessageProvider:new ul},hh=class extends sl.EmbeddedActionsParser{constructor(e,t){super(e,Object.assign(Object.assign({},TM),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 Nb(r){return Array.isArray(r)&&(r.length===0||"name"in r[0])}mt.isTokenTypeArray=Nb;function Db(r){return r&&"modes"in r&&"defaultMode"in r}mt.isIMultiModeLexerDefinition=Db;function wb(r){return!Nb(r)&&!Db(r)}mt.isTokenTypeDictionary=wb});var Ib=C(Xo=>{"use strict";Object.defineProperty(Xo,"__esModule",{value:!0});Xo.assertUnreachable=Xo.ErrorWithLocation=void 0;var yh=class extends Error{constructor(e,t){super(e?`${t} at ${e.range.start.line}:${e.range.start.character}`:t)}};Xo.ErrorWithLocation=yh;function RM(r){throw new Error("Error! The input value was not handled.")}Xo.assertUnreachable=RM});var vh=C(ll=>{"use strict";Object.defineProperty(ll,"__esModule",{value:!0});ll.createParser=void 0;var Ob=il(),qe=ze(),$b=ls(),ds=Ib(),_M=Ct(),Mb=Ft(),Lb=Pt();function AM(r,e,t){let n=DM(t);return bM({parser:e,tokens:n,rules:new Map,ruleNames:new Map},r),e}ll.createParser=AM;function bM(r,e){let t=(0,Lb.getAllReachableRules)(e,!1),n=(0,_M.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,Bi(o,i.definition)))}}function Bi(r,e,t=!1){let n;if((0,qe.isKeyword)(e))n=NM(r,e);else if((0,qe.isAction)(e))n=EM(r,e);else if((0,qe.isAssignment)(e))n=Bi(r,e.terminal);else if((0,qe.isCrossReference)(e))n=Fb(r,e);else if((0,qe.isRuleCall)(e))n=CM(r,e);else if((0,qe.isAlternatives)(e))n=kM(r,e);else if((0,qe.isUnorderedGroup)(e))n=xM(r,e);else if((0,qe.isGroup)(e))n=SM(r,e);else throw new ds.ErrorWithLocation(e.$cstNode,`Unexpected element type: ${e.$type}`);return jb(r,t?void 0:cl(e),n,e.cardinality)}function EM(r,e){let t=(0,Mb.getTypeName)(e);return()=>r.parser.action(t,e)}function CM(r,e){let t=e.rule.ref;if((0,qe.isParserRule)(t)){let n=r.subrule++,i=e.arguments.length>0?PM(t,e.arguments):()=>({});return o=>r.parser.subrule(n,Gb(r,t),e,i(o))}else if((0,qe.isTerminalRule)(t)){let n=r.consume++,i=gh(r,t.name);return()=>r.parser.consume(n,i,e)}else if(t)(0,ds.assertUnreachable)(t);else throw new ds.ErrorWithLocation(e.$cstNode,`Undefined rule type: ${e.$type}`)}function PM(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,ds.assertUnreachable)(r)}function kM(r,e){if(e.elements.length===1)return Bi(r,e.elements[0]);{let t=[];for(let i of e.elements){let o={ALT:Bi(r,i,!0)},a=cl(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 xM(r,e){if(e.elements.length===1)return Bi(r,e.elements[0]);let t=[];for(let s of e.elements){let u={ALT:Bi(r,s,!0)},c=cl(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 h=i(n,d);d.unorderedGroups.get(h)||d.unorderedGroups.set(h,[]);let p=d.unorderedGroups.get(h);typeof p?.[c]>"u"&&(p[c]=!0)}};let g=u.GATE;return g?l.GATE=()=>g(s):l.GATE=()=>{let h=d.unorderedGroups.get(i(n,d));return!h?.[c]},l})),a=jb(r,cl(e),o,"*");return s=>{a(s),r.parser.isRecording()||r.parser.unorderedGroups.delete(i(n,r.parser))}}function SM(r,e){let t=e.elements.map(n=>Bi(r,n));return n=>t.forEach(i=>i(n))}function cl(r){if((0,qe.isGroup)(r))return r.guardCondition}function Fb(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,Gb(r,t.rule.ref),e,i)}else if((0,qe.isRuleCall)(t)&&(0,qe.isTerminalRule)(t.rule.ref)){let n=r.consume++,i=gh(r,t.rule.ref.name);return()=>r.parser.consume(n,i,e)}else if((0,qe.isKeyword)(t)){let n=r.consume++,i=gh(r,t.value);return i.name=qb(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,Lb.findNameAssignment)(e.type.ref),i=n?.terminal;if(!i)throw new Error("Could not find name assignment for type: "+(0,Mb.getTypeName)(e.type.ref));return Fb(r,e,i)}}var qb=r=>r.endsWith(":KW")?r:r+":KW";function NM(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=qb(n.name),()=>r.parser.consume(t,n,e)}function jb(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,Ob.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,Ob.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,ds.assertUnreachable)(n)}function DM(r){if((0,$b.isTokenTypeDictionary)(r))return r;let e=(0,$b.isIMultiModeLexerDefinition)(r)?Object.values(r.modes).flat():r,t={};return e.forEach(n=>t[n.name]=n),t}function Gb(r,e){let t=wM(r,e),n=r.rules.get(t);if(!n)throw new Error(`Rule "${t}" not found."`);return n}function wM(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 gh(r,e){let t=r.tokens[e];if(!t)throw new Error(`Token "${e}" not found."`);return t}});var Ub=C(dl=>{"use strict";Object.defineProperty(dl,"__esModule",{value:!0});dl.createCompletionParser=void 0;var IM=ls(),OM=vh();function $M(r){let e=r.Grammar,t=r.parser.TokenBuilder.buildTokens(e,{caseInsensitive:r.LanguageMetaData.caseInsensitive}),n=new IM.LangiumCompletionParser(r,t);return(0,OM.createParser)(e,n,t),n.finalize(),n}dl.createCompletionParser=$M});var Th=C(Jo=>{"use strict";Object.defineProperty(Jo,"__esModule",{value:!0});Jo.prepareLangiumParser=Jo.createLangiumParser=void 0;var MM=ls(),LM=vh();function FM(r){let e=Hb(r);return e.finalize(),e}Jo.createLangiumParser=FM;function Hb(r){let e=r.Grammar,t=r.parser.TokenBuilder.buildTokens(e,{caseInsensitive:r.LanguageMetaData.caseInsensitive}),n=new MM.LangiumParser(r,t);return(0,LM.createParser)(e,n,t)}Jo.prepareLangiumParser=Hb});var Ah=C(pl=>{"use strict";Object.defineProperty(pl,"__esModule",{value:!0});pl.DefaultTokenBuilder=void 0;var qM=il(),Rh=ze(),jM=Ft(),GM=Re(),UM=Pt(),fl=So(),HM=Ct(),_h=class{buildTokens(e,t){let n=(0,HM.stream)((0,UM.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,fl.isWhitespaceRegExp)(s)?o.unshift(a):o.push(a)}),o}buildTerminalTokens(e){return e.filter(Rh.isTerminalRule).filter(t=>!t.fragment).map(t=>this.buildTerminalToken(t)).toArray()}buildTerminalToken(e){let t=(0,jM.terminalRegex)(e),n={name:e.name,PATTERN:new RegExp(t)};return e.hidden&&(n.GROUP=(0,fl.isWhitespaceRegExp)(t)?qM.Lexer.SKIPPED:"hidden"),n}buildKeywordTokens(e,t,n){return e.filter(Rh.isParserRule).flatMap(i=>(0,GM.streamAllContents)(i).filter(Rh.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,fl.getCaseInsensitivePattern)(e.value)):e.value}findLongerAlt(e,t){return t.reduce((n,i)=>{let o=i?.PATTERN;return o?.source&&(0,fl.partialMatches)("^"+o.source+"$",e.value)&&n.push(i),n},[])}};pl.DefaultTokenBuilder=_h});var Ch=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 Wb=ze(),WM=Ft(),KM=Pt(),bh=class{convert(e,t){let n=t.feature;if((0,Wb.isCrossReference)(n)&&(n=(0,KM.getCrossReferenceTerminal)(n)),(0,Wb.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 Bb(t);case"STRING":return Eh(t);case"ID":return Kb(t);case"REGEXLITERAL":return Eh(t)}switch((i=(0,WM.getRuleType)(e))===null||i===void 0?void 0:i.toLowerCase()){case"number":return Yb(t);case"boolean":return Xb(t);case"bigint":return zb(t);case"date":return Vb(t);default:return t}}};It.DefaultValueConverter=bh;function Eh(r){return r.substring(1,r.length-1)}It.convertString=Eh;function Kb(r){return r.charAt(0)==="^"?r.substring(1):r}It.convertID=Kb;function Bb(r){return parseInt(r)}It.convertInt=Bb;function zb(r){return BigInt(r)}It.convertBigint=zb;function Vb(r){return new Date(r)}It.convertDate=Vb;function Yb(r){return Number(r)}It.convertNumber=Yb;function Xb(r){return r.toLowerCase()==="true"}It.convertBoolean=Xb});var kh=C(ml=>{"use strict";Object.defineProperty(ml,"__esModule",{value:!0});ml.DefaultLinker=void 0;var BM=Ne(),Zn=Re(),zM=Yr(),Jb=ji(),Ph=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=BM.CancellationToken.None){for(let n of(0,Zn.streamAst)(e.parseResult.value))await(0,zM.interruptAndCheck)(t),(0,Zn.streamReferences)(n).forEach(i=>this.doLink(i,e));e.state=Jb.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<Jb.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})}};ml.DefaultLinker=Ph});var Sh=C(yl=>{"use strict";Object.defineProperty(yl,"__esModule",{value:!0});yl.DefaultJsonSerializer=void 0;var hl=Re(),xh=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,hl.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,hl.isReference)(s)&&(0,hl.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,hl.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}};yl.DefaultJsonSerializer=xh});var Dh=C(gl=>{"use strict";Object.defineProperty(gl,"__esModule",{value:!0});gl.DefaultServiceRegistry=void 0;var VM=gn(),Nh=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=VM.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):[]}};gl.DefaultServiceRegistry=Nh});var Oh=C(Zo=>{"use strict";Object.defineProperty(Zo,"__esModule",{value:!0});Zo.DefaultReferenceDescriptionProvider=Zo.DefaultAstNodeDescriptionProvider=void 0;var YM=Ne(),fs=Re(),XM=et(),JM=Yr(),ZM=hi(),wh=class{constructor(e){this.astNodeLocator=e.workspace.AstNodeLocator}createDescription(e,t,n=(0,fs.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=wh;var Ih=class{constructor(e){this.nodeLocator=e.workspace.AstNodeLocator}async createDescriptions(e,t=YM.CancellationToken.None){let n=[],i=e.parseResult.value;for(let o of(0,fs.streamAst)(i))await(0,JM.interruptAndCheck)(t),(0,fs.streamReferences)(o).filter(a=>!(0,fs.isLinkingError)(a)).forEach(a=>{let s=a.reference.$nodeDescription;s&&n.push(this.createDescription(a,s))});return n}createDescription(e,t){let n=(0,fs.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,XM.toDocumentSegment)(i),local:(0,ZM.equalURI)(t.documentUri,n)}}};Zo.DefaultReferenceDescriptionProvider=Ih});var Zb=C(vl=>{"use strict";Object.defineProperty(vl,"__esModule",{value:!0});vl.DefaultAstNodeLocator=void 0;var $h=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)}};vl.DefaultAstNodeLocator=$h});var Lh=C(Tl=>{"use strict";Object.defineProperty(Tl,"__esModule",{value:!0});Tl.DefaultConfigurationProvider=void 0;var QM=Tt(),Mh=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(QM.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}`}};Tl.DefaultConfigurationProvider=Mh});var jh=C(_l=>{"use strict";Object.defineProperty(_l,"__esModule",{value:!0});_l.DefaultDocumentBuilder=void 0;var Rl=Ne(),eL=kr(),Fh=Yr(),Qn=ji(),qh=class{constructor(e){this.updateListeners=[],this.buildPhaseListeners=new eL.MultiMap,this.langiumDocuments=e.workspace.LangiumDocuments,this.indexManager=e.workspace.IndexManager,this.serviceRegistry=e.ServiceRegistry}async build(e,t={},n=Rl.CancellationToken.None){await this.buildDocuments(e,t,n)}async update(e,t,n=Rl.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,Fh.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),Rl.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,Fh.interruptAndCheck)(n),await i(a);await this.notifyBuildPhase(o,t,n)}onBuildPhase(e,t){return this.buildPhaseListeners.add(e,t),Rl.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,Fh.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}};_l.DefaultDocumentBuilder=qh});var Wh=C(Al=>{"use strict";Object.defineProperty(Al,"__esModule",{value:!0});Al.DefaultIndexManager=void 0;var Qb=Ne(),tL=Re(),Gh=Ct(),Uh=hi(),eE=ji(),Hh=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,tL.getDocument)(e).uri,i=[];return this.referenceIndex.forEach(o=>{o.forEach(a=>{(0,Uh.equalURI)(a.targetUri,n)&&a.targetPath===t&&i.push(a)})}),(0,Gh.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,Gh.stream)(t);{let n=this.globalScopeCache.get("").filter(i=>this.astReflection.isSubtype(i.type,e));return this.globalScopeCache.set(e,n),(0,Gh.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=Qb.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=eE.DocumentState.IndexedContent}async updateReferences(e,t=Qb.CancellationToken.None){let i=await this.serviceRegistry.getServices(e.uri).workspace.ReferenceDescriptionProvider.createDescriptions(e,t);this.referenceIndex.set(e.uri.toString(),i),e.state=eE.DocumentState.IndexedReferences}getAffectedDocuments(e){return this.langiumDocuments().all.filter(t=>{if(e.some(n=>(0,Uh.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,Uh.equalURI)(a.targetUri,n)):!1}};Al.DefaultIndexManager=Hh});var zh=C(bl=>{"use strict";Object.defineProperty(bl,"__esModule",{value:!0});bl.DefaultWorkspaceManager=void 0;var rL=Ne(),Kh=gn(),nL=Yr(),Bh=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=rL.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,nL.interruptAndCheck)(t),await this.documentBuilder.build(i,void 0,t)}loadAdditionalDocuments(e,t){return Promise.resolve()}getRootFolder(e){return Kh.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=Kh.Utils.basename(t.uri);if(i.startsWith("."))return!1;if(t.isDirectory)return i!=="node_modules"&&i!=="out";if(t.isFile){let o=Kh.Utils.extname(t.uri);return n.includes(o)}return!1}};bl.DefaultWorkspaceManager=Bh});var Tc=C(Qo=>{"use strict";Object.defineProperty(Qo,"__esModule",{value:!0});Qo.createDefaultSharedModule=Qo.createDefaultModule=void 0;var iL=Ne(),oL=yu(),aL=JR(),sL=Ub(),uL=Bp(),cL=Vp(),lL=Xp(),dL=Ku(),fL=Qp(),pL=tm(),mL=dm(),hL=pm(),yL=hm(),gL=Th(),vL=Ah(),TL=Ch(),RL=kh(),_L=Io(),AL=Fp(),bL=ku(),EL=Su(),CL=Sh(),PL=Dh(),kL=Yr(),xL=Hu(),SL=Mu(),tE=Oh(),NL=Zb(),DL=Lh(),wL=jh(),Vh=ji(),IL=Wh(),OL=zh();function $L(r){return{parser:{GrammarConfig:e=>(0,aL.createGrammarConfig)(e),LangiumParser:e=>(0,gL.createLangiumParser)(e),CompletionParser:e=>(0,sL.createCompletionParser)(e),ValueConverter:()=>new TL.DefaultValueConverter,TokenBuilder:()=>new vL.DefaultTokenBuilder},lsp:{CompletionProvider:e=>new uL.DefaultCompletionProvider(e),DocumentSymbolProvider:e=>new lL.DefaultDocumentSymbolProvider(e),HoverProvider:e=>new pL.MultilineCommentHoverProvider(e),FoldingRangeProvider:e=>new dL.DefaultFoldingRangeProvider(e),ReferencesProvider:e=>new hL.DefaultReferencesProvider(e),DefinitionProvider:e=>new fL.DefaultDefinitionProvider(e),DocumentHighlightProvider:e=>new cL.DefaultDocumentHighlightProvider(e),RenameProvider:e=>new yL.DefaultRenameProvider(e)},workspace:{AstNodeLocator:()=>new NL.DefaultAstNodeLocator,AstNodeDescriptionProvider:e=>new tE.DefaultAstNodeDescriptionProvider(e),ReferenceDescriptionProvider:e=>new tE.DefaultReferenceDescriptionProvider(e)},references:{Linker:e=>new RL.DefaultLinker(e),NameProvider:()=>new _L.DefaultNameProvider,ScopeProvider:e=>new EL.DefaultScopeProvider(e),ScopeComputation:e=>new bL.DefaultScopeComputation(e),References:e=>new AL.DefaultReferences(e)},serializer:{JsonSerializer:e=>new CL.DefaultJsonSerializer(e)},validation:{DocumentValidator:e=>new xL.DefaultDocumentValidator(e),ValidationRegistry:e=>new SL.ValidationRegistry(e)},shared:()=>r.shared}}Qo.createDefaultModule=$L;function ML(r){return{ServiceRegistry:()=>new PL.DefaultServiceRegistry,lsp:{Connection:()=>r.connection,LanguageServer:e=>new mL.DefaultLanguageServer(e)},workspace:{LangiumDocuments:e=>new Vh.DefaultLangiumDocuments(e),LangiumDocumentFactory:e=>new Vh.DefaultLangiumDocumentFactory(e),DocumentBuilder:e=>new wL.DefaultDocumentBuilder(e),TextDocuments:()=>new iL.TextDocuments(oL.TextDocument),TextDocumentFactory:e=>new Vh.DefaultTextDocumentFactory(e),IndexManager:e=>new IL.DefaultIndexManager(e),WorkspaceManager:e=>new OL.DefaultWorkspaceManager(e),FileSystemProvider:e=>r.fileSystemProvider(e),MutexLock:()=>new kL.MutexLock,ConfigurationProvider:e=>new DL.DefaultConfigurationProvider(e)}}}Qo.createDefaultSharedModule=ML});var rE=C(El=>{"use strict";Object.defineProperty(El,"__esModule",{value:!0});El.s=void 0;var LL=/^(s*\n)+/,FL=/\n/g,qL=/\S|$/;function jL(r,...e){let t=e.reduce((i,o,a)=>i+GL(String(o),i)+r[a+1],r[0]).split(`
|
|
3722
|
-
`).map(i=>i.trimRight()),n=
|
|
3723
|
-
`).trimRight().replace(
|
|
3724
|
-
`)-1),n=" ".repeat(t);return r.replace(
|
|
3725
|
-
`+n)}function UL(r){let e=r.filter(n=>n.length>0).map(n=>n.search(qL)),t=e.length===0?0:Math.min(...e);return Math.max(0,t)}});var iE=C(nE=>{"use strict";Object.defineProperty(nE,"__esModule",{value:!0})});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 Dn=C(Z=>{"use strict";var cE=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]}),HL=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)&&cE(e,r,t)},WL=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)&&cE(e,r,t);return HL(e,r),e};Object.defineProperty(Z,"__esModule",{value:!0});Z.GrammarAST=void 0;oe(Tc(),Z);oe(ka(),Z);oe(wu(),Z);oe(Wf(),Z);oe(rE(),Z);oe(Cm(),Z);oe(vc(),Z);oe(iE(),Z);oe(gm(),Z);oe(ls(),Z);oe(Th(),Z);oe(aE(),Z);oe(Ah(),Z);oe(Ch(),Z);oe(kh(),Z);oe(Io(),Z);oe(ku(),Z);oe(Su(),Z);oe(Sh(),Z);oe(Dh(),Z);oe(uE(),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(Hu(),Z);oe(Mu(),Z);oe(Oh(),Z);oe(jh(),Z);oe(ji(),Z);oe(Wh(),Z);oe(_u(),Z);oe(zh(),Z);oe(Lh(),Z);var KL=WL(ze());Z.GrammarAST=KL});var lE=C(Ai=>{"use strict";var BL=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 Yh=BL(require("fs")),zL=gn(),Cl=class{constructor(){this.encoding="utf-8"}readFile(e){return Yh.default.promises.readFile(e.fsPath,this.encoding)}readFileSync(e){return Yh.default.readFileSync(e.fsPath,this.encoding)}async readDirectory(e){return(await Yh.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=Cl;Ai.NodeFileSystem={fileSystemProvider:()=>new Cl}});var dE=C(zi=>{"use strict";var VL=zi&&zi.__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]}),YL=zi&&zi.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&VL(e,r,t)};Object.defineProperty(zi,"__esModule",{value:!0});YL(lE(),zi)});var pE=C((Jj,fE)=>{fE.exports=dE()});var hE=C((Zj,mE)=>{"use strict";mE.exports=Ne()});var $E=C((oy,ay)=>{(function(r,e){typeof require=="function"&&typeof oy=="object"&&typeof ay=="object"?ay.exports=e():typeof define=="function"&&define.amd?define(function(){return e()}):r.pluralize=e()})(oy,function(){var r=[],e=[],t={},n={},i={};function o(h){return typeof h=="string"?new RegExp("^"+h+"$","i"):h}function a(h,p){return h===p?p:h===h.toLowerCase()?p.toLowerCase():h===h.toUpperCase()?p.toUpperCase():h[0]===h[0].toUpperCase()?p.charAt(0).toUpperCase()+p.substr(1).toLowerCase():p.toLowerCase()}function s(h,p){return h.replace(/\$(\d{1,2})/g,function(A,x){return p[x]||""})}function u(h,p){return h.replace(p[0],function(A,x){var k=s(p[1],arguments);return a(A===""?h[x-1]:A,k)})}function c(h,p,A){if(!h.length||t.hasOwnProperty(h))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(h,p,A){return function(x){var k=x.toLowerCase();return p.hasOwnProperty(k)?a(x,k):h.hasOwnProperty(k)?a(x,h[k]):c(k,x,A)}}function d(h,p,A,x){return function(k){var _=k.toLowerCase();return p.hasOwnProperty(_)?!0:h.hasOwnProperty(_)?!1:c(_,_,A)===_}}function g(h,p,A){var x=p===1?g.singular(h):g.plural(h);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(h,p){r.push([o(h),p])},g.addSingularRule=function(h,p){e.push([o(h),p])},g.addUncountableRule=function(h){if(typeof h=="string"){t[h.toLowerCase()]=!0;return}g.addPluralRule(h,"$0"),g.addSingularRule(h,"$0")},g.addIrregularRule=function(h,p){p=p.toLowerCase(),h=h.toLowerCase(),i[h]=p,n[p]=h},[["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(h){return g.addIrregularRule(h[0],h[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(h){return g.addPluralRule(h[0],h[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(h){return g.addSingularRule(h[0],h[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 KE=St(Dn()),BE=St(pE()),jl=St(hE());var st=St(Dn());var TE=St(Dn()),yE="AbstractDeclaration";var XL="Expression";var gE="ReferenceTarget";var Pl="TypeDeclaration";var kl="ArrayExpr";function RE(r){return ei.isInstance(r,kl)}var ps="Attribute";function _E(r){return ei.isInstance(r,ps)}var AE="AttributeArg";var Jh="BinaryExpr";var bE="DataModel";function Vi(r){return ei.isInstance(r,bE)}var Xh="DataModelField";function ea(r){return ei.isInstance(r,Xh)}var EE="DataSource";function CE(r){return ei.isInstance(r,EE)}var JL="Enum";var xl="EnumField";function PE(r){return ei.isInstance(r,xl)}var vE="Function";var ZL="FunctionParam";var Sl="InvocationExpr";function kE(r){return ei.isInstance(r,Sl)}var Nl="LiteralExpr";function Dl(r){return ei.isInstance(r,Nl)}var Zh="MemberAccessExpr";var Qh="NullExpr";var wl="ReferenceExpr";function ey(r){return ei.isInstance(r,wl)}var ty="ThisExpr";var ry="UnaryExpr";var ms=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,TE.isAstNode)(e)&&this.isSubtype(e.$type,t)}isSubtype(e,t){if(e===t)return!0;switch(e){case kl:case Jh:case Sl:case Nl:case Zh:case Qh:case wl:case ty:case ry:return this.isSubtype(XL,t);case ps:case EE:case vE:return this.isSubtype(yE,t);case bE:case JL:return this.isSubtype(yE,t)||this.isSubtype(Pl,t);case Xh:case xl:case ZL:return this.isSubtype(gE,t);default:return!1}}getReferenceType(e){let t=`${e.container.$type}:${e.property}`;switch(t){case"AttributeAttribute:decl":return ps;case"AttributeParamType:reference":return Pl;case"DataModelAttribute:decl":return ps;case"DataModelFieldAttribute:decl":return ps;case"DataModelFieldType:reference":return Pl;case"FunctionParamType:reference":return Pl;case"InvocationExpr:function":return vE;case"MemberAccessExpr:member":return Xh;case"ReferenceExpr:target":return gE;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:[]}}}},ei=new ms;var xE=St(Dn()),Il,SE=()=>Il!=null?Il:Il=(0,xE.loadGrammarFromJson)(`{
|
|
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)(`{
|
|
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 QL={languageId:"zmodel",fileExtensions:[".zmodel"],caseInsensitive:!1},NE={AstReflection:()=>new ms},DE={Grammar:()=>SE(),LanguageMetaData:()=>QL,parser:{}};var an=St(Dn()),IE=St(fn());function bi(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 Ol(r){if(Dl(r)&&typeof r.value=="string")return r.value}function eF(r,e){switch(r){case"Any":return!0;case"Float":return e==="Any"||e==="Int"||e==="Float";default:return e==="Any"||e===r}}function ny(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 wE(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?RE(r.value)&&!r.value.items.find(c=>!ey(c)||!ea(c.target.ref)):ey(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=ny(t.$container.type.type)}else i="Any";return eF(i,n.decl)&&o===n.array}else return(a==null?void 0:a.ref)===n.decl&&o===n.array}var $l=class extends an.DefaultLinker{constructor(t){super(t);this.descriptions=t.workspace.AstNodeDescriptionProvider}link(i){return no(this,arguments,function*(t,n=IE.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,an.streamContents)(t.parseResult.value))yield(0,an.interruptAndCheck)(n),this.resolve(s,t);t.state=an.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 Nl:this.resolveLiteral(t);break;case Sl:this.resolveInvocation(t,n,i);break;case kl:this.resolveArray(t,n,i);break;case wl:this.resolveReference(t,n,i);break;case Zh:this.resolveMemberAccess(t,n,i);break;case ry:this.resolveUnary(t,n,i);break;case Jh:this.resolveBinary(t,n,i);break;case ty:this.resolveThis(t,n,i);break;case Qh:this.resolveNull(t,n,i);break;case AE: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===xl?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;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&&Vi(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&&Vi(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")}else console.warn("Unresolved collection predicate")}resolveThis(t,n,i){let o=t.$container;for(;o&&!Vi(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,an.isReference)(a)&&this.linkReference(t,o,n,i);for(let o of(0,an.streamContents)(t))this.resolve(o,n,i)}resolveToDeclaredType(t,n){if(n.type){let i=ny(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 ra=St(Dn());var ta=class extends ra.DefaultScopeComputation{constructor(t){super(t);this.services=t}computeExports(t,n){return no(this,null,function*(){let i=yield As(ta.prototype,this,"computeExports").call(this,t,n);for(let o of(0,ra.streamAllContents)(t.parseResult.value))if(n&&(yield(0,ra.interruptAndCheck)(n)),PE(o)){let a=this.services.workspace.AstNodeDescriptionProvider.createDescription(o,o.name,t);i.push(a)}return i})}};var LE=St(Dn());var iy=["sqlite","postgresql","mysql","sqlserver","cockroachdb"],OE=["String","Int","Float","Decimal","BigInt","Boolean","Bytes","DateTime"],Ml="stdlib.zmodel";var hs=class{validate(e,t){var n;bi(e.declarations,t),(n=e.$document)!=null&&n.uri.path.endsWith(Ml)||this.validateDataSources(e,t)}validateDataSources(e,t){let n=e.declarations.filter(i=>CE(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 tF=["provider","url","shadowDatabaseUrl","relationMode"],ys=class{validate(e,t){bi(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=>{tF.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=Ol(n.value);i?iy.includes(i)||t("error",`Provider "${i}" is not supported. Choose from ${iy.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;!Ol(a.value)&&!(kE(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=Ol(n.value);(!i||!["foreignKeys","prisma"].includes(i))&&t("error",'"relationMode" must be set to "foreignKeys" or "prisma"',{node:n.value})}}};var ME=St($E()),gs=class{validate(e,t){bi(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||!OE.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)),Vi((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"&&!_E(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(!wE(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,ME.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||Vi((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"?Dl(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;let n=this.parseRelation(e,t);if(!n.valid)return;let i=e.type.reference.ref,o=i.fields.filter(h=>{var p;return((p=h.type.reference)==null?void 0:p.ref)===e.$container});if(o=o.filter(h=>{let p=this.parseRelation(h);return p.valid&&p.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(h=>t("error",`Fields ${o.map(p=>'"'+p.name+'"').join(", ")} on model "${i.name}" refer to the same relation to model "${e.$container.name}"`,{node:h}));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(h=>t("error",'Field for one side of relation must carry @relation attribute with both "fields" and "references" fields',{node:h}));return}if(!u.type.array&&!u.type.optional){t("error","Relation field needs to be list or optional",{node:u});return}}};var vs=class{validate(e,t){}};var Ts=class{validate(e,t){bi(e.fields,t)}};var Ll=class extends LE.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};this.register(n,t)}},Fl=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 hs().validate(e,t)}checkDataSource(e,t){this.shouldCheck(e)&&new ys().validate(e,t)}checkDataModel(e,t){this.shouldCheck(e)&&new gs().validate(e,t)}checkEnum(e,t){this.shouldCheck(e)&&new Ts().validate(e,t)}checkAttribute(e,t){this.shouldCheck(e)&&new vs().validate(e,t)}};var UE=St(Ne()),HE=St(yu());var FE=St(Dn()),qE=St(require("path")),jE=St(gn());var Yi=class extends FE.DefaultWorkspaceManager{loadAdditionalDocuments(e,t){return no(this,null,function*(){yield As(Yi.prototype,this,"loadAdditionalDocuments").call(this,e,t);let n=jE.URI.file(qE.default.join(__dirname,"../res",Ml));console.log(`Adding stdlib document from ${n}`);let i=this.langiumDocuments.getOrCreateDocument(n);t(i)})}};var ql=St(Dn()),GE=St(Ne()),Rs=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,ql.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[GE.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,ql.getDocument)(t.element);if(t&&n)return{source:e,target:t,targetDocument:n}}}};var rF={references:{ScopeComputation:r=>new ta(r),Linker:r=>new $l(r)},validation:{ValidationRegistry:r=>new Ll(r),ZModelValidator:()=>new Fl},lsp:{DefinitionProvider:r=>new Rs(r)}};function nF(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 UE.TextDocuments(HE.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 WE(r){let e=(0,st.inject)(nF(r),NE),t=(0,st.inject)((0,st.createDefaultModule)({shared:e}),DE,rF);return e.ServiceRegistry.register(t),{shared:e,ZModel:t}}var iF=(0,jl.createConnection)(jl.ProposedFeatures.all),{shared:oF}=WE(fy({connection:iF},BE.NodeFileSystem));(0,KE.startLanguageServer)(oF);
|
|
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);
|