UNPKG

flink-cdc-language-server

Version:

A LSP-based language server for Apache Flink CDC

1 lines 1.38 MB
var serverExportVar;(()=>{var e=[,function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.languageSettings=t.updateCustomOptions=t.customOptions=t.documentSiteHref=t.languageServiceOptions=void 0;const i=r(n(2));t.languageServiceOptions={schemaRequestService:async e=>fetch(e).then((e=>e.text())),workspaceContext:{resolveRelativePath:(e,t)=>String(new URL(e,t))}},t.documentSiteHref="https://nightlies.apache.org/flink/flink-cdc-docs-release-3.1/",t.customOptions={documentHref:"https://nightlies.apache.org/flink/flink-cdc-docs-release-3.1/docs/core-concept/data-pipeline/"};t.updateCustomOptions=(e={})=>{Object.keys(t.customOptions).forEach((n=>{const r=e[n];null!=r&&(t.customOptions[n]=r)}))},t.languageSettings={validate:!0,hover:!0,completion:!0,format:!0,isKubernetes:!1,yamlVersion:"1.2",customTags:[],schemas:[{uri:t.documentSiteHref,schema:i.default,fileMatch:["*"]}]}},e=>{"use strict";e.exports=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"source":{"type":"object","description":"**Data Source** is used to access metadata and read the changed data from external systems. \\nA Data Source can read data from multiple tables simultaneously.","properties":{"type":{"type":"string","description":"The type of the source, such as mysql."},"name":{"type":"string","description":"The name of the source, which is user-defined (a default value provided)."}},"additionalProperties":true,"required":["type"]},"sink":{"type":"object","description":"**Data Sink** is used to apply schema changes and write change data to external systems.\\nA Data Sink can write to multiple tables simultaneously.","properties":{"type":{"type":"string","description":"The type of the sink, such as doris or starrocks."},"name":{"type":"string","description":"The name of the sink, which is user-defined (a default value provided)."}},"additionalProperties":true,"required":["type"]},"pipeline":{"type":"object","properties":{"name":{"type":"string","description":"The name of the pipeline, which will be submitted to the Flink cluster as the job name.","default":"Flink CDC Pipeline Job"},"schema.change.behavior":{"type":"string","description":"Behavior for handling schema change events.","enum":["EVOLVE","TRY_EVOLVE","IGNORE","LENIENT","EXCEPTION"],"default":"LENIENT"},"local-time-zone":{"type":"string","description":"The local time zone defines current session time zone id."}}},"route":{"type":"array","description":"**Route** specifies the rule of matching a list of source-table and mapping to sink-table. The most typical scenario is the merge of sub-databases and sub-tables, routing multiple upstream source tables to the same sink table.","items":{"type":"object","properties":{"source-table":{"type":"string","description":"Source table id, supports regular expressions."},"sink-table":{"type":"string","description":"Sink table id, supports regular expressions."},"replace-symbol":{"type":"string","description":"Special symbol in sink-table for pattern replacing, will be replaced by original table name."},"description":{"type":"string","description":"Routing rule description(a default value provided)."}},"required":["source-table","sink-table"]}},"transform":{"type":"array","description":"**Transform** module helps users delete and expand data columns based on the data columns in the table.\\nWhat’s more, it also helps users filter some unnecessary data during the synchronization process.","items":{"type":"object","properties":{"source-table":{"type":"string","description":"Source table id, supports regular expressions."},"projection":{"type":"string","description":"Projection rule, supports syntax similar to the select clause in SQL."},"filter":{"type":"string","description":"Filter rule, supports syntax similar to the where clause in SQL."},"primary-keys":{"type":"string","description":"Sink table primary keys, separated by commas."},"partition-keys":{"type":"string","description":"Sink table partition keys, separated by commas."},"table-options":{"type":"string","description":"Used to the configure table creation statement when automatically creating tables."},"description":{"type":"string","description":"Transform rule description."}},"required":["source-table"]}}},"required":["source","sink"]}')},function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.createConnection=void 0;const o=n(4);i(n(70),t),i(n(4),t);let s=!1;const a={initialize:e=>{},get shutdownReceived(){return s},set shutdownReceived(e){s=e},exit:e=>{}};t.createConnection=function(e,t,n,r){let i,s,u,c;return void 0!==e&&"features"===e.__brand&&(i=e,e=t,t=n,n=r),o.ConnectionStrategy.is(e)||o.ConnectionOptions.is(e)?c=e:(s=e,u=t,c=n),(0,o.createConnection)((e=>(0,o.createProtocolConnection)(s,u,e,c)),a,i)}},function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.ProposedFeatures=t.NotebookDocuments=t.TextDocuments=t.SemanticTokensBuilder=void 0;const o=n(5);Object.defineProperty(t,"SemanticTokensBuilder",{enumerable:!0,get:function(){return o.SemanticTokensBuilder}});const s=n(51);i(n(6),t);const a=n(52);Object.defineProperty(t,"TextDocuments",{enumerable:!0,get:function(){return a.TextDocuments}});const u=n(53);var c;Object.defineProperty(t,"NotebookDocuments",{enumerable:!0,get:function(){return u.NotebookDocuments}}),i(n(54),t),function(e){e.all={__brand:"features",languages:s.InlineCompletionFeature}}(c||(t.ProposedFeatures=c={}))},(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SemanticTokensBuilder=t.SemanticTokensDiff=t.SemanticTokensFeature=void 0;const r=n(6);t.SemanticTokensFeature=e=>class extends e{get semanticTokens(){return{refresh:()=>this.connection.sendRequest(r.SemanticTokensRefreshRequest.type),on:e=>{const t=r.SemanticTokensRequest.type;return this.connection.onRequest(t,((n,r)=>e(n,r,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(t,n))))},onDelta:e=>{const t=r.SemanticTokensDeltaRequest.type;return this.connection.onRequest(t,((n,r)=>e(n,r,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(t,n))))},onRange:e=>{const t=r.SemanticTokensRangeRequest.type;return this.connection.onRequest(t,((n,r)=>e(n,r,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(t,n))))}}}};class i{constructor(e,t){this.originalSequence=e,this.modifiedSequence=t}computeDiff(){const e=this.originalSequence.length,t=this.modifiedSequence.length;let n=0;for(;n<t&&n<e&&this.originalSequence[n]===this.modifiedSequence[n];)n++;if(n<t&&n<e){let r=e-1,i=t-1;for(;r>=n&&i>=n&&this.originalSequence[r]===this.modifiedSequence[i];)r--,i--;(r<n||i<n)&&(r++,i++);const o=r-n+1,s=this.modifiedSequence.slice(n,i+1);return 1===s.length&&s[0]===this.originalSequence[r]?[{start:n,deleteCount:o-1}]:[{start:n,deleteCount:o,data:s}]}return n<t?[{start:n,deleteCount:0,data:this.modifiedSequence.slice(n)}]:n<e?[{start:n,deleteCount:e-n}]:[]}}t.SemanticTokensDiff=i;t.SemanticTokensBuilder=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,r,i){let o=e,s=t;this._dataLen>0&&(o-=this._prevLine,0===o&&(s-=this._prevChar)),this._data[this._dataLen++]=o,this._data[this._dataLen++]=s,this._data[this._dataLen++]=n,this._data[this._dataLen++]=r,this._data[this._dataLen++]=i,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 void 0!==this._prevData}buildEdits(){return void 0!==this._prevData?{resultId:this.id,edits:new i(this._prevData,this._data).computeDiff()}:this.build()}}},function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.createProtocolConnection=void 0;const o=n(7);i(n(7),t),i(n(24),t),t.createProtocolConnection=function(e,t,n,r){return(0,o.createMessageConnection)(e,t,n,r)}},(e,t,n)=>{"use strict";e.exports=n(8)},function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.createMessageConnection=t.BrowserMessageWriter=t.BrowserMessageReader=void 0;n(9).default.install();const o=n(10);i(n(10),t);class s extends o.AbstractMessageReader{constructor(e){super(),this._onData=new o.Emitter,this._messageListener=e=>{this._onData.fire(e.data)},e.addEventListener("error",(e=>this.fireError(e))),e.onmessage=this._messageListener}listen(e){return this._onData.event(e)}}t.BrowserMessageReader=s;class a extends o.AbstractMessageWriter{constructor(e){super(),this.port=e,this.errorCount=0,e.addEventListener("error",(e=>this.fireError(e)))}write(e){try{return this.port.postMessage(e),Promise.resolve()}catch(t){return this.handleError(t,e),Promise.reject(t)}}handleError(e,t){this.errorCount++,this.fireError(e,t,this.errorCount)}end(){}}t.BrowserMessageWriter=a,t.createMessageConnection=function(e,t,n,r){return void 0===n&&(n=o.NullLogger),o.ConnectionStrategy.is(r)&&(r={connectionStrategy:r}),(0,o.createMessageConnection)(e,t,n,r)}},(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(10);class i extends r.AbstractMessageBuffer{constructor(e="utf-8"){super(e),this.asciiDecoder=new TextDecoder("ascii")}emptyBuffer(){return i.emptyBuffer}fromString(e,t){return(new TextEncoder).encode(e)}toString(e,t){return"ascii"===t?this.asciiDecoder.decode(e):new TextDecoder(t).decode(e)}asNative(e,t){return void 0===t?e:e.slice(0,t)}allocNative(e){return new Uint8Array(e)}}i.emptyBuffer=new Uint8Array(0);class o{constructor(e){this.socket=e,this._onData=new r.Emitter,this._messageListener=e=>{e.data.arrayBuffer().then((e=>{this._onData.fire(new Uint8Array(e))}),(()=>{(0,r.RAL)().console.error("Converting blob to array buffer failed.")}))},this.socket.addEventListener("message",this._messageListener)}onClose(e){return this.socket.addEventListener("close",e),r.Disposable.create((()=>this.socket.removeEventListener("close",e)))}onError(e){return this.socket.addEventListener("error",e),r.Disposable.create((()=>this.socket.removeEventListener("error",e)))}onEnd(e){return this.socket.addEventListener("end",e),r.Disposable.create((()=>this.socket.removeEventListener("end",e)))}onData(e){return this._onData.event(e)}}class s{constructor(e){this.socket=e}onClose(e){return this.socket.addEventListener("close",e),r.Disposable.create((()=>this.socket.removeEventListener("close",e)))}onError(e){return this.socket.addEventListener("error",e),r.Disposable.create((()=>this.socket.removeEventListener("error",e)))}onEnd(e){return this.socket.addEventListener("end",e),r.Disposable.create((()=>this.socket.removeEventListener("end",e)))}write(e,t){if("string"==typeof e){if(void 0!==t&&"utf-8"!==t)throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${t}`);this.socket.send(e)}else this.socket.send(e);return Promise.resolve()}end(){this.socket.close()}}const a=new TextEncoder,u=Object.freeze({messageBuffer:Object.freeze({create:e=>new i(e)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(e,t)=>{if("utf-8"!==t.charset)throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${t.charset}`);return Promise.resolve(a.encode(JSON.stringify(e,void 0,0)))}}),decoder:Object.freeze({name:"application/json",decode:(e,t)=>{if(!(e instanceof Uint8Array))throw new Error("In a Browser environments only Uint8Arrays are supported.");return Promise.resolve(JSON.parse(new TextDecoder(t.charset).decode(e)))}})}),stream:Object.freeze({asReadableStream:e=>new o(e),asWritableStream:e=>new s(e)}),console,timer:Object.freeze({setTimeout(e,t,...n){const r=setTimeout(e,t,...n);return{dispose:()=>clearTimeout(r)}},setImmediate(e,...t){const n=setTimeout(e,0,...t);return{dispose:()=>clearTimeout(n)}},setInterval(e,t,...n){const r=setInterval(e,t,...n);return{dispose:()=>clearInterval(r)}}})});function c(){return u}!function(e){e.install=function(){r.RAL.install(u)}}(c||(c={})),t.default=c},(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ProgressType=t.ProgressToken=t.createMessageConnection=t.NullLogger=t.ConnectionOptions=t.ConnectionStrategy=t.AbstractMessageBuffer=t.WriteableStreamMessageWriter=t.AbstractMessageWriter=t.MessageWriter=t.ReadableStreamMessageReader=t.AbstractMessageReader=t.MessageReader=t.SharedArrayReceiverStrategy=t.SharedArraySenderStrategy=t.CancellationToken=t.CancellationTokenSource=t.Emitter=t.Event=t.Disposable=t.LRUCache=t.Touch=t.LinkedMap=t.ParameterStructures=t.NotificationType9=t.NotificationType8=t.NotificationType7=t.NotificationType6=t.NotificationType5=t.NotificationType4=t.NotificationType3=t.NotificationType2=t.NotificationType1=t.NotificationType0=t.NotificationType=t.ErrorCodes=t.ResponseError=t.RequestType9=t.RequestType8=t.RequestType7=t.RequestType6=t.RequestType5=t.RequestType4=t.RequestType3=t.RequestType2=t.RequestType1=t.RequestType0=t.RequestType=t.Message=t.RAL=void 0,t.MessageStrategy=t.CancellationStrategy=t.CancellationSenderStrategy=t.CancellationReceiverStrategy=t.ConnectionError=t.ConnectionErrors=t.LogTraceNotification=t.SetTraceNotification=t.TraceFormat=t.TraceValues=t.Trace=void 0;const r=n(11);Object.defineProperty(t,"Message",{enumerable:!0,get:function(){return r.Message}}),Object.defineProperty(t,"RequestType",{enumerable:!0,get:function(){return r.RequestType}}),Object.defineProperty(t,"RequestType0",{enumerable:!0,get:function(){return r.RequestType0}}),Object.defineProperty(t,"RequestType1",{enumerable:!0,get:function(){return r.RequestType1}}),Object.defineProperty(t,"RequestType2",{enumerable:!0,get:function(){return r.RequestType2}}),Object.defineProperty(t,"RequestType3",{enumerable:!0,get:function(){return r.RequestType3}}),Object.defineProperty(t,"RequestType4",{enumerable:!0,get:function(){return r.RequestType4}}),Object.defineProperty(t,"RequestType5",{enumerable:!0,get:function(){return r.RequestType5}}),Object.defineProperty(t,"RequestType6",{enumerable:!0,get:function(){return r.RequestType6}}),Object.defineProperty(t,"RequestType7",{enumerable:!0,get:function(){return r.RequestType7}}),Object.defineProperty(t,"RequestType8",{enumerable:!0,get:function(){return r.RequestType8}}),Object.defineProperty(t,"RequestType9",{enumerable:!0,get:function(){return r.RequestType9}}),Object.defineProperty(t,"ResponseError",{enumerable:!0,get:function(){return r.ResponseError}}),Object.defineProperty(t,"ErrorCodes",{enumerable:!0,get:function(){return r.ErrorCodes}}),Object.defineProperty(t,"NotificationType",{enumerable:!0,get:function(){return r.NotificationType}}),Object.defineProperty(t,"NotificationType0",{enumerable:!0,get:function(){return r.NotificationType0}}),Object.defineProperty(t,"NotificationType1",{enumerable:!0,get:function(){return r.NotificationType1}}),Object.defineProperty(t,"NotificationType2",{enumerable:!0,get:function(){return r.NotificationType2}}),Object.defineProperty(t,"NotificationType3",{enumerable:!0,get:function(){return r.NotificationType3}}),Object.defineProperty(t,"NotificationType4",{enumerable:!0,get:function(){return r.NotificationType4}}),Object.defineProperty(t,"NotificationType5",{enumerable:!0,get:function(){return r.NotificationType5}}),Object.defineProperty(t,"NotificationType6",{enumerable:!0,get:function(){return r.NotificationType6}}),Object.defineProperty(t,"NotificationType7",{enumerable:!0,get:function(){return r.NotificationType7}}),Object.defineProperty(t,"NotificationType8",{enumerable:!0,get:function(){return r.NotificationType8}}),Object.defineProperty(t,"NotificationType9",{enumerable:!0,get:function(){return r.NotificationType9}}),Object.defineProperty(t,"ParameterStructures",{enumerable:!0,get:function(){return r.ParameterStructures}});const i=n(13);Object.defineProperty(t,"LinkedMap",{enumerable:!0,get:function(){return i.LinkedMap}}),Object.defineProperty(t,"LRUCache",{enumerable:!0,get:function(){return i.LRUCache}}),Object.defineProperty(t,"Touch",{enumerable:!0,get:function(){return i.Touch}});const o=n(14);Object.defineProperty(t,"Disposable",{enumerable:!0,get:function(){return o.Disposable}});const s=n(15);Object.defineProperty(t,"Event",{enumerable:!0,get:function(){return s.Event}}),Object.defineProperty(t,"Emitter",{enumerable:!0,get:function(){return s.Emitter}});const a=n(17);Object.defineProperty(t,"CancellationTokenSource",{enumerable:!0,get:function(){return a.CancellationTokenSource}}),Object.defineProperty(t,"CancellationToken",{enumerable:!0,get:function(){return a.CancellationToken}});const u=n(18);Object.defineProperty(t,"SharedArraySenderStrategy",{enumerable:!0,get:function(){return u.SharedArraySenderStrategy}}),Object.defineProperty(t,"SharedArrayReceiverStrategy",{enumerable:!0,get:function(){return u.SharedArrayReceiverStrategy}});const c=n(19);Object.defineProperty(t,"MessageReader",{enumerable:!0,get:function(){return c.MessageReader}}),Object.defineProperty(t,"AbstractMessageReader",{enumerable:!0,get:function(){return c.AbstractMessageReader}}),Object.defineProperty(t,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return c.ReadableStreamMessageReader}});const l=n(21);Object.defineProperty(t,"MessageWriter",{enumerable:!0,get:function(){return l.MessageWriter}}),Object.defineProperty(t,"AbstractMessageWriter",{enumerable:!0,get:function(){return l.AbstractMessageWriter}}),Object.defineProperty(t,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return l.WriteableStreamMessageWriter}});const p=n(22);Object.defineProperty(t,"AbstractMessageBuffer",{enumerable:!0,get:function(){return p.AbstractMessageBuffer}});const d=n(23);Object.defineProperty(t,"ConnectionStrategy",{enumerable:!0,get:function(){return d.ConnectionStrategy}}),Object.defineProperty(t,"ConnectionOptions",{enumerable:!0,get:function(){return d.ConnectionOptions}}),Object.defineProperty(t,"NullLogger",{enumerable:!0,get:function(){return d.NullLogger}}),Object.defineProperty(t,"createMessageConnection",{enumerable:!0,get:function(){return d.createMessageConnection}}),Object.defineProperty(t,"ProgressToken",{enumerable:!0,get:function(){return d.ProgressToken}}),Object.defineProperty(t,"ProgressType",{enumerable:!0,get:function(){return d.ProgressType}}),Object.defineProperty(t,"Trace",{enumerable:!0,get:function(){return d.Trace}}),Object.defineProperty(t,"TraceValues",{enumerable:!0,get:function(){return d.TraceValues}}),Object.defineProperty(t,"TraceFormat",{enumerable:!0,get:function(){return d.TraceFormat}}),Object.defineProperty(t,"SetTraceNotification",{enumerable:!0,get:function(){return d.SetTraceNotification}}),Object.defineProperty(t,"LogTraceNotification",{enumerable:!0,get:function(){return d.LogTraceNotification}}),Object.defineProperty(t,"ConnectionErrors",{enumerable:!0,get:function(){return d.ConnectionErrors}}),Object.defineProperty(t,"ConnectionError",{enumerable:!0,get:function(){return d.ConnectionError}}),Object.defineProperty(t,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return d.CancellationReceiverStrategy}}),Object.defineProperty(t,"CancellationSenderStrategy",{enumerable:!0,get:function(){return d.CancellationSenderStrategy}}),Object.defineProperty(t,"CancellationStrategy",{enumerable:!0,get:function(){return d.CancellationStrategy}}),Object.defineProperty(t,"MessageStrategy",{enumerable:!0,get:function(){return d.MessageStrategy}});const f=n(16);t.RAL=f.default},(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Message=t.NotificationType9=t.NotificationType8=t.NotificationType7=t.NotificationType6=t.NotificationType5=t.NotificationType4=t.NotificationType3=t.NotificationType2=t.NotificationType1=t.NotificationType0=t.NotificationType=t.RequestType9=t.RequestType8=t.RequestType7=t.RequestType6=t.RequestType5=t.RequestType4=t.RequestType3=t.RequestType2=t.RequestType1=t.RequestType=t.RequestType0=t.AbstractMessageSignature=t.ParameterStructures=t.ResponseError=t.ErrorCodes=void 0;const r=n(12);var i,o;!function(e){e.ParseError=-32700,e.InvalidRequest=-32600,e.MethodNotFound=-32601,e.InvalidParams=-32602,e.InternalError=-32603,e.jsonrpcReservedErrorRangeStart=-32099,e.serverErrorStart=-32099,e.MessageWriteError=-32099,e.MessageReadError=-32098,e.PendingResponseRejected=-32097,e.ConnectionInactive=-32096,e.ServerNotInitialized=-32002,e.UnknownErrorCode=-32001,e.jsonrpcReservedErrorRangeEnd=-32e3,e.serverErrorEnd=-32e3}(i||(t.ErrorCodes=i={}));class s extends Error{constructor(e,t,n){super(t),this.code=r.number(e)?e:i.UnknownErrorCode,this.data=n,Object.setPrototypeOf(this,s.prototype)}toJson(){const e={code:this.code,message:this.message};return void 0!==this.data&&(e.data=this.data),e}}t.ResponseError=s;class a{constructor(e){this.kind=e}static is(e){return e===a.auto||e===a.byName||e===a.byPosition}toString(){return this.kind}}t.ParameterStructures=a,a.auto=new a("auto"),a.byPosition=new a("byPosition"),a.byName=new a("byName");class u{constructor(e,t){this.method=e,this.numberOfParams=t}get parameterStructures(){return a.auto}}t.AbstractMessageSignature=u;t.RequestType0=class extends u{constructor(e){super(e,0)}};t.RequestType=class extends u{constructor(e,t=a.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};t.RequestType1=class extends u{constructor(e,t=a.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};t.RequestType2=class extends u{constructor(e){super(e,2)}};t.RequestType3=class extends u{constructor(e){super(e,3)}};t.RequestType4=class extends u{constructor(e){super(e,4)}};t.RequestType5=class extends u{constructor(e){super(e,5)}};t.RequestType6=class extends u{constructor(e){super(e,6)}};t.RequestType7=class extends u{constructor(e){super(e,7)}};t.RequestType8=class extends u{constructor(e){super(e,8)}};t.RequestType9=class extends u{constructor(e){super(e,9)}};t.NotificationType=class extends u{constructor(e,t=a.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};t.NotificationType0=class extends u{constructor(e){super(e,0)}};t.NotificationType1=class extends u{constructor(e,t=a.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};t.NotificationType2=class extends u{constructor(e){super(e,2)}};t.NotificationType3=class extends u{constructor(e){super(e,3)}};t.NotificationType4=class extends u{constructor(e){super(e,4)}};t.NotificationType5=class extends u{constructor(e){super(e,5)}};t.NotificationType6=class extends u{constructor(e){super(e,6)}};t.NotificationType7=class extends u{constructor(e){super(e,7)}};t.NotificationType8=class extends u{constructor(e){super(e,8)}};t.NotificationType9=class extends u{constructor(e){super(e,9)}},function(e){e.isRequest=function(e){const t=e;return t&&r.string(t.method)&&(r.string(t.id)||r.number(t.id))},e.isNotification=function(e){const t=e;return t&&r.string(t.method)&&void 0===e.id},e.isResponse=function(e){const t=e;return t&&(void 0!==t.result||!!t.error)&&(r.string(t.id)||r.number(t.id)||null===t.id)}}(o||(t.Message=o={}))},(e,t)=>{"use strict";function n(e){return"string"==typeof e||e instanceof String}function r(e){return Array.isArray(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.stringArray=t.array=t.func=t.error=t.number=t.string=t.boolean=void 0,t.boolean=function(e){return!0===e||!1===e},t.string=n,t.number=function(e){return"number"==typeof e||e instanceof Number},t.error=function(e){return e instanceof Error},t.func=function(e){return"function"==typeof e},t.array=r,t.stringArray=function(e){return r(e)&&e.every((e=>n(e)))}},(e,t)=>{"use strict";var n,r;Object.defineProperty(t,"__esModule",{value:!0}),t.LRUCache=t.LinkedMap=t.Touch=void 0,function(e){e.None=0,e.First=1,e.AsOld=e.First,e.Last=2,e.AsNew=e.Last}(r||(t.Touch=r={}));class i{constructor(){this[n]="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=r.None){const n=this._map.get(e);if(n)return t!==r.None&&this.touch(n,t),n.value}set(e,t,n=r.None){let i=this._map.get(e);if(i)i.value=t,n!==r.None&&this.touch(i,n);else{switch(i={key:e,value:t,next:void 0,previous:void 0},n){case r.None:this.addItemLast(i);break;case r.First:this.addItemFirst(i);break;case r.Last:default:this.addItemLast(i)}this._map.set(e,i),this._size++}return this}delete(e){return!!this.remove(e)}remove(e){const 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");const e=this._head;return this._map.delete(e.key),this.removeItem(e),this._size--,e.value}forEach(e,t){const n=this._state;let r=this._head;for(;r;){if(t?e.bind(t)(r.value,r.key,this):e(r.value,r.key,this),this._state!==n)throw new Error("LinkedMap got modified during iteration.");r=r.next}}keys(){const e=this._state;let t=this._head;const n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){const e={value:t.key,done:!1};return t=t.next,e}return{value:void 0,done:!0}}};return n}values(){const e=this._state;let t=this._head;const n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){const e={value:t.value,done:!1};return t=t.next,e}return{value:void 0,done:!0}}};return n}entries(){const e=this._state;let t=this._head;const n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){const e={value:[t.key,t.value],done:!1};return t=t.next,e}return{value:void 0,done:!0}}};return n}[(n=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(e){if(e>=this.size)return;if(0===e)return void this.clear();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){if(!this._head)throw new Error("Invalid list");e.next=this._head,this._head.previous=e}else this._tail=e;this._head=e,this._state++}addItemLast(e){if(this._head||this._tail){if(!this._tail)throw new Error("Invalid list");e.previous=this._tail,this._tail.next=e}else this._head=e;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{const 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===r.First||t===r.Last)if(t===r.First){if(e===this._head)return;const t=e.next,n=e.previous;e===this._tail?(n.next=void 0,this._tail=n):(t.previous=n,n.next=t),e.previous=void 0,e.next=this._head,this._head.previous=e,this._head=e,this._state++}else if(t===r.Last){if(e===this._tail)return;const t=e.next,n=e.previous;e===this._head?(t.previous=void 0,this._head=t):(t.previous=n,n.next=t),e.next=void 0,e.previous=this._tail,this._tail.next=e,this._tail=e,this._state++}}toJSON(){const e=[];return this.forEach(((t,n)=>{e.push([n,t])})),e}fromJSON(e){this.clear();for(const[t,n]of e)this.set(t,n)}}t.LinkedMap=i;t.LRUCache=class extends i{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=r.AsNew){return super.get(e,t)}peek(e){return super.get(e,r.None)}set(e,t){return super.set(e,t,r.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}}},(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.Disposable=void 0,function(e){e.create=function(e){return{dispose:e}}}(n||(t.Disposable=n={}))},(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Emitter=t.Event=void 0;const r=n(16);var i;!function(e){const t={dispose(){}};e.None=function(){return t}}(i||(t.Event=i={}));class o{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 r=0,i=this._callbacks.length;r<i;r++)if(this._callbacks[r]===e){if(this._contexts[r]===t)return this._callbacks.splice(r,1),void this._contexts.splice(r,1);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[];const t=[],n=this._callbacks.slice(0),i=this._contexts.slice(0);for(let o=0,s=n.length;o<s;o++)try{t.push(n[o].apply(i[o],e))}catch(e){(0,r.default)().console.error(e)}return t}isEmpty(){return!this._callbacks||0===this._callbacks.length}dispose(){this._callbacks=void 0,this._contexts=void 0}}class s{constructor(e){this._options=e}get event(){return this._event||(this._event=(e,t,n)=>{this._callbacks||(this._callbacks=new o),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(e,t);const r={dispose:()=>{this._callbacks&&(this._callbacks.remove(e,t),r.dispose=s._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(n)&&n.push(r),r}),this._event}fire(e){this._callbacks&&this._callbacks.invoke.call(this._callbacks,e)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}}t.Emitter=s,s._noop=function(){}},(e,t)=>{"use strict";let n;function r(){if(void 0===n)throw new Error("No runtime abstraction layer installed");return n}Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.install=function(e){if(void 0===e)throw new Error("No runtime abstraction layer provided");n=e}}(r||(r={})),t.default=r},(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CancellationTokenSource=t.CancellationToken=void 0;const r=n(16),i=n(12),o=n(15);var s;!function(e){e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:o.Event.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:o.Event.None}),e.is=function(t){const n=t;return n&&(n===e.None||n===e.Cancelled||i.boolean(n.isCancellationRequested)&&!!n.onCancellationRequested)}}(s||(t.CancellationToken=s={}));const a=Object.freeze((function(e,t){const n=(0,r.default)().timer.setTimeout(e.bind(t),0);return{dispose(){n.dispose()}}}));class u{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?a:(this._emitter||(this._emitter=new o.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}}t.CancellationTokenSource=class{get token(){return this._token||(this._token=new u),this._token}cancel(){this._token?this._token.cancel():this._token=s.Cancelled}dispose(){this._token?this._token instanceof u&&this._token.dispose():this._token=s.None}}},(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SharedArrayReceiverStrategy=t.SharedArraySenderStrategy=void 0;const r=n(17);var i;!function(e){e.Continue=0,e.Cancelled=1}(i||(i={}));t.SharedArraySenderStrategy=class{constructor(){this.buffers=new Map}enableCancellation(e){if(null===e.id)return;const t=new SharedArrayBuffer(4);new Int32Array(t,0,1)[0]=i.Continue,this.buffers.set(e.id,t),e.$cancellationData=t}async sendCancellation(e,t){const n=this.buffers.get(t);if(void 0===n)return;const r=new Int32Array(n,0,1);Atomics.store(r,0,i.Cancelled)}cleanup(e){this.buffers.delete(e)}dispose(){this.buffers.clear()}};class o{constructor(e){this.data=new Int32Array(e,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===i.Cancelled}get onCancellationRequested(){throw new Error("Cancellation over SharedArrayBuffer doesn't support cancellation events")}}class s{constructor(e){this.token=new o(e)}cancel(){}dispose(){}}t.SharedArrayReceiverStrategy=class{constructor(){this.kind="request"}createCancellationTokenSource(e){const t=e.$cancellationData;return void 0===t?new r.CancellationTokenSource:new s(t)}}},(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ReadableStreamMessageReader=t.AbstractMessageReader=t.MessageReader=void 0;const r=n(16),i=n(12),o=n(15),s=n(20);var a,u;!function(e){e.is=function(e){let t=e;return t&&i.func(t.listen)&&i.func(t.dispose)&&i.func(t.onError)&&i.func(t.onClose)&&i.func(t.onPartialMessage)}}(a||(t.MessageReader=a={}));class c{constructor(){this.errorEmitter=new o.Emitter,this.closeEmitter=new o.Emitter,this.partialMessageEmitter=new o.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: ${i.string(e.message)?e.message:"unknown"}`)}}t.AbstractMessageReader=c,function(e){e.fromOptions=function(e){let t,n;const i=new Map;let o;const s=new Map;if(void 0===e||"string"==typeof e)t=e??"utf-8";else{if(t=e.charset??"utf-8",void 0!==e.contentDecoder&&(n=e.contentDecoder,i.set(n.name,n)),void 0!==e.contentDecoders)for(const t of e.contentDecoders)i.set(t.name,t);if(void 0!==e.contentTypeDecoder&&(o=e.contentTypeDecoder,s.set(o.name,o)),void 0!==e.contentTypeDecoders)for(const t of e.contentTypeDecoders)s.set(t.name,t)}return void 0===o&&(o=(0,r.default)().applicationJson.decoder,s.set(o.name,o)),{charset:t,contentDecoder:n,contentDecoders:i,contentTypeDecoder:o,contentTypeDecoders:s}}}(u||(u={}));t.ReadableStreamMessageReader=class extends c{constructor(e,t){super(),this.readable=e,this.options=u.fromOptions(t),this.buffer=(0,r.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new s.Semaphore(1)}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;const t=this.readable.onData((e=>{this.onData(e)}));return this.readable.onError((e=>this.fireError(e))),this.readable.onClose((()=>this.fireClose())),t}onData(e){try{for(this.buffer.append(e);;){if(-1===this.nextMessageLength){const e=this.buffer.tryReadHeaders(!0);if(!e)return;const t=e.get("content-length");if(!t)return void this.fireError(new Error(`Header must provide a Content-Length property.\n${JSON.stringify(Object.fromEntries(e))}`));const n=parseInt(t);if(isNaN(n))return void this.fireError(new Error(`Content-Length value must be a number. Got ${t}`));this.nextMessageLength=n}const e=this.buffer.tryReadBody(this.nextMessageLength);if(void 0===e)return void this.setPartialMessageTimer();this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock((async()=>{const t=void 0!==this.options.contentDecoder?await this.options.contentDecoder.decode(e):e,n=await this.options.contentTypeDecoder.decode(t,this.options);this.callback(n)})).catch((e=>{this.fireError(e)}))}}catch(e){this.fireError(e)}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),this._partialMessageTimeout<=0||(this.partialMessageTimer=(0,r.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))}}},(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Semaphore=void 0;const r=n(16);t.Semaphore=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(){0!==this._waiting.length&&this._active!==this._capacity&&(0,r.default)().timer.setImmediate((()=>this.doRunNext()))}doRunNext(){if(0===this._waiting.length||this._active===this._capacity)return;const e=this._waiting.shift();if(this._active++,this._active>this._capacity)throw new Error("To many thunks active");try{const t=e.thunk();t instanceof Promise?t.then((t=>{this._active--,e.resolve(t),this.runNext()}),(t=>{this._active--,e.reject(t),this.runNext()})):(this._active--,e.resolve(t),this.runNext())}catch(t){this._active--,e.reject(t),this.runNext()}}}},(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WriteableStreamMessageWriter=t.AbstractMessageWriter=t.MessageWriter=void 0;const r=n(16),i=n(12),o=n(20),s=n(15);var a,u;!function(e){e.is=function(e){let t=e;return t&&i.func(t.dispose)&&i.func(t.onClose)&&i.func(t.onError)&&i.func(t.write)}}(a||(t.MessageWriter=a={}));class c{constructor(){this.errorEmitter=new s.Emitter,this.closeEmitter=new s.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: ${i.string(e.message)?e.message:"unknown"}`)}}t.AbstractMessageWriter=c,function(e){e.fromOptions=function(e){return void 0===e||"string"==typeof e?{charset:e??"utf-8",contentTypeEncoder:(0,r.default)().applicationJson.encoder}:{charset:e.charset??"utf-8",contentEncoder:e.contentEncoder,contentTypeEncoder:e.contentTypeEncoder??(0,r.default)().applicationJson.encoder}}}(u||(u={}));t.WriteableStreamMessageWriter=class extends c{constructor(e,t){super(),this.writable=e,this.options=u.fromOptions(t),this.errorCount=0,this.writeSemaphore=new o.Semaphore(1),this.writable.onError((e=>this.fireError(e))),this.writable.onClose((()=>this.fireClose()))}async write(e){return this.writeSemaphore.lock((async()=>this.options.contentTypeEncoder.encode(e,this.options).then((e=>void 0!==this.options.contentEncoder?this.options.contentEncoder.encode(e):e)).then((t=>{const n=[];return n.push("Content-Length: ",t.byteLength.toString(),"\r\n"),n.push("\r\n"),this.doWrite(e,n,t)}),(e=>{throw this.fireError(e),e}))))}async doWrite(e,t,n){try{return await this.writable.write(t.join(""),"ascii"),this.writable.write(n)}catch(t){return this.handleError(t,e),Promise.reject(t)}}handleError(e,t){this.errorCount++,this.fireError(e,t,this.errorCount)}end(){this.writable.end()}}},(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AbstractMessageBuffer=void 0;t.AbstractMessageBuffer=class{constructor(e="utf-8"){this._encoding=e,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(e){const t="string"==typeof e?this.fromString(e,this._encoding):e;this._chunks.push(t),this._totalLength+=t.byteLength}tryReadHeaders(e=!1){if(0===this._chunks.length)return;let t=0,n=0,r=0,i=0;e:for(;n<this._chunks.length;){const e=this._chunks[n];for(r=0;r<e.length;){switch(e[r]){case 13:switch(t){case 0:t=1;break;case 2:t=3;break;default:t=0}break;case 10:switch(t){case 1:t=2;break;case 3:t=4,r++;break e;default:t=0}break;default:t=0}r++}i+=e.byteLength,n++}if(4!==t)return;const o=this._read(i+r),s=new Map,a=this.toString(o,"ascii").split("\r\n");if(a.length<2)return s;for(let t=0;t<a.length-2;t++){const n=a[t],r=n.indexOf(":");if(-1===r)throw new Error(`Message header must separate key and value using ':'\n${n}`);const i=n.substr(0,r),o=n.substr(r+1).trim();s.set(e?i.toLowerCase():i,o)}return s}tryReadBody(e){if(!(this._totalLength<e))return this._read(e)}get numberOfBytes(){return this._totalLength}_read(e){if(0===e)return this.emptyBuffer();if(e>this._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===e){const t=this._chunks[0];return this._chunks.shift(),this._totalLength-=e,this.asNative(t)}if(this._chunks[0].byteLength>e){const t=this._chunks[0],n=this.asNative(t,e);return this._chunks[0]=t.slice(e),this._totalLength-=e,n}const t=this.allocNative(e);let n=0;for(;e>0;){const r=this._chunks[0];if(r.byteLength>e){const i=r.slice(0,e);t.set(i,n),n+=e,this._chunks[0]=r.slice(e),this._totalLength-=e,e-=e}else t.set(r,n),n+=r.byteLength,this._chunks.shift(),this._totalLength-=r.byteLength,e-=r.byteLength}return t}}},(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createMessageConnection=t.ConnectionOptions=t.MessageStrategy=t.CancellationStrategy=t.CancellationSenderStrategy=t.CancellationReceiverStrategy=t.RequestCancellationReceiverStrategy=t.IdCancellationReceiverStrategy=t.ConnectionStrategy=t.ConnectionError=t.ConnectionErrors=t.LogTraceNotification=t.SetTraceNotification=t.TraceFormat=t.TraceValues=t.Trace=t.NullLogger=t.ProgressType=t.ProgressToken=void 0;const r=n(16),i=n(12),o=n(11),s=n(13),a=n(15),u=n(17);var c,l,p,d,f,h,m,g,y,v,D,b,E,C,S,w,x,A,T;!function(e){e.type=new o.NotificationType("$/cancelRequest")}(c||(c={})),function(e){e.is=function(e){return"string"==typeof e||"number"==typeof e}}(l||(t.ProgressToken=l={})),function(e){e.type=new o.NotificationType("$/progress")}(p||(p={}));t.ProgressType=class{constructor(){}},function(e){e.is=function(e){return i.func(e)}}(d||(d={})),t.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}}),function(e){e[e.Off=0]="Off",e[e.Messages=1]="Messages",e[e.Compact=2]="Compact",e[e.Verbose=3]="Verbose"}(f||(t.Trace=f={})),function(e){e.Off="off",e.Messages="messages",e.Compact="compact",e.Verbose="verbose"}(h||(t.TraceValues=h={})),function(e){e.fromString=function(t){if(!i.string(t))return e.Off;switch(t=t.toLowerCase()){case"off":default:return e.Off;case"messages":return e.Messages;case"compact":return e.Compact;case"verbose":return e.Verbose}},e.toString=function(t){switch(t){case e.Off:return"off";case e.Messages:return"messages";case e.Compact:return"compact";case e.Verbose:return"verbose";default:return"off"}}}(f||(t.Trace=f={})),function(e){e.Text="text",e.JSON="json"}(m||(t.TraceFormat=m={})),function(e){e.fromString=function(t){return i.string(t)&&"json"===(t=t.toLowerCase())?e.JSON:e.Text}}(m||(t.TraceFormat=m={})),function(e){e.type=new o.NotificationType("$/setTrace")}(g||(t.SetTraceNotification=g={})),function(e){e.type=new o.NotificationType("$/logTrace")}(y||(t.LogTraceNotification=y={})),function(e){e[e.Closed=1]="Closed",e[e.Disposed=2]="Disposed",e[e.AlreadyListening=3]="AlreadyListening"}(v||(t.ConnectionErrors=v={}));class _ extends Error{constructor(e,t){super(t),this.code=e,Object.setPrototypeOf(this,_.prototype)}}t.ConnectionError=_,function(e){e.is=function(e){const t=e;return t&&i.func(t.cancelUndispatched)}}(D||(t.ConnectionStrategy=D={})),function(e){e.is=function(e){const t=e;return t&&(void 0===t.kind||"id"===t.kind)&&i.func(t.createCancellationTokenSource)&&(void 0===t.dispose||i.func(t.dispose))}}(b||(t.IdCancellationReceiverStrategy=b={})),function(e){e.is=function(e){const t=e;return t&&"request"===t.kind&&i.func(t.createCancellationTokenSource)&&(void 0===t.dispose||i.func(t.dispose))}}(E||(t.RequestCancellationReceiverStrategy=E={})),function(e){e.Message=Object.freeze({createCancellationTokenSource:e=>new u.CancellationTokenSource}),e.is=function(e){return b.is(e)||E.is(e)}}(C||(t.CancellationReceiverStrategy=C={})),function(e){e.Message=Object.freeze({sendCancellation:(e,t)=>e.sendNotification(c.type,{id:t}),cleanup(e){}}),e.is=function(e){const t=e;return t&&i.func(t.sendCancellation)&&i.func(t.cleanup)}}(S||(t.CancellationSenderStrategy=S={})),function(e){e.Message=Object.freeze({receiver:C.Message,sender:S.Message}),e.is=function(e){const t=e;return t&&C.is(t.receiver)&&S.is(t.sender)}}(w||(t.CancellationStrategy=w={})),function(e){e.is=function(e){const t=e;return t&&i.func(t.handleMessage)}}(x||(t.MessageStrategy=x={})),function(e){e.is=function(e){const t=e;return t&&(w.is(t.cancellationStrategy)||D.is(t.connectionStrategy)||x.is(t.messageStrategy))}}(A||(t.ConnectionOptions=A={})),function(e){e[e.New=1]="New",e[e.Listening=2]="Listening",e[e.Closed=3]="Closed",e[e.Disposed=4]="Disposed"}(T||(T={})),t.createMessageConnection=function(e,n,h,D){const E=void 0!==h?h:t.NullLogger;let C=0,S=0,A=0;const k="2.0";let F;const N=new Map;let P;const O=new Map,R=new Map;let j,M,I=new s.LinkedMap,L=new Map,$=new Set,B=new Map,q=f.Off,V=m.Text,W=T.New;const U=new a.Emitter,K=new a.Emitter,H=new a.Emitter,z=new a.Emitter,J=new a.Emitter,Y=D&&D.cancellationStrategy?D.cancellationStrategy:w.Message;function G(e){if(null===e)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+e.toString()}function Q(e,t){var n;o.Message.isRequest(t)?e.set(G(t.id),t):o.Message.isResponse(t)?e.set(null===(n=t.id)?"res-unknown-"+(++A).toString():"res-"+n.toString(),t):e.set("not-"+(++S).toString(),t)}function X(e){}function Z(){return W===T.Listening}function ee(){return W===T.Closed}function te(){return W===T.Disposed}function ne(){W!==T.New&&W!==T.Listening||(W=T.Closed,K.fire(void 0))}function re(){j||0===I.size||(j=(0,r.default)().timer.setImmediate((()=>{j=void 0,function(){if(0===I.size)return;const e=I.shift();try{const t=D?.messageStrategy;x.is(t)?t.handleMessage(e,ie):ie(e)}finally{re()}}()})))}function ie(e){o.Message.isRequest(e)?function(e){if(te())return;function t(t,r,i){const s={jsonrpc:k,id:e.id};t instanceof o.ResponseError?s.error=t.toJson():s.result=void 0===t?null:t,ae(s,r,i),n.write(s).catch((()=>E.error("Sending response failed.")))}function r(t,r,i){const o={jsonrpc:k,id:e.id,error:t.toJson()};ae(o,r,i),n.write(o).catch((()=>E.error("Sending response failed.")))}function s(t,r,i){void 0===t&&(t=null);const o={jsonrpc:k,id:e.id,result:t};ae(o,r,i),n.write(o).catch((()=>E.error("Sending response failed.")))}!function(e){if(q===f.Off||!M)return;if(V===m.Text){let t;q!==f.Verbose&&q!==f.Compact||!e.params||(t=`Params: ${se(e.params)}\n\n`),M.log(`Received request '${e.method} - (${e.id})'.`,t)}else ce("receive-request",e)}(e);const a=N.get(e.method);let u,c;a&&(u=a.type,c=a.handler);const l=Date.now();if(c||F){const n=e.id??String(Date.now()),a=b.is(Y.receiver)?Y.receiver.createCancellationTokenSource(n):Y.receiver.createCancellationTokenSource(e);null!==e.id&&$.has(e.id)&&a.cancel(),null!==e.id&&B.set(n,a);try{let p;if(c)if(void 0===e.params){if(void 0!==u&&0!==u.numberOfParams)return void r(new o.ResponseError(o.ErrorCodes.InvalidParams,`Request ${e.method} defines ${u.numberOfParams} params but received none.`),e.method,l);p=c(a.token)}else if(Array.isArray(e.params)){if(void 0!==u&&u.parameterStructures===o.ParameterStructures.byName)return void r(new o.ResponseError(o.ErrorCodes.InvalidParams,`Request ${e.method} defines parameters by name but received parameters by position`),e.method,l);p=c(...e.params,a.token)}else{if(void 0!==u&&u.parameterS