UNPKG

cloudstudio

Version:

Run VS Code on a remote server.

1 lines 325 kB
(()=>{var e={838:e=>{"use strict";function t(e,t,o){e instanceof RegExp&&(e=n(e,o)),t instanceof RegExp&&(t=n(t,o));var r=i(e,t,o);return r&&{start:r[0],end:r[1],pre:o.slice(0,r[0]),body:o.slice(r[0]+e.length,r[1]),post:o.slice(r[1]+t.length)}}function n(e,t){var n=t.match(e);return n?n[0]:null}function i(e,t,n){var i,o,r,s,a,c=n.indexOf(e),u=n.indexOf(t,c+1),l=c;if(c>=0&&u>0){for(i=[],r=n.length;l>=0&&!a;)l==c?(i.push(l),c=n.indexOf(e,l+1)):1==i.length?a=[i.pop(),u]:((o=i.pop())<r&&(r=o,s=u),u=n.indexOf(t,l+1)),l=c<u&&c>=0?c:u;i.length&&(a=[r,s])}return a}e.exports=t,t.range=i},5457:(e,t,n)=>{var i=n(4044),o=n(838);e.exports=function(e){return e?("{}"===e.substr(0,2)&&(e="\\{\\}"+e.substr(2)),v(function(e){return e.split("\\\\").join(r).split("\\{").join(s).split("\\}").join(a).split("\\,").join(c).split("\\.").join(u)}(e),!0).map(d)):[]};var r="\0SLASH"+Math.random()+"\0",s="\0OPEN"+Math.random()+"\0",a="\0CLOSE"+Math.random()+"\0",c="\0COMMA"+Math.random()+"\0",u="\0PERIOD"+Math.random()+"\0";function l(e){return parseInt(e,10)==e?parseInt(e,10):e.charCodeAt(0)}function d(e){return e.split(r).join("\\").split(s).join("{").split(a).join("}").split(c).join(",").split(u).join(".")}function h(e){if(!e)return[""];var t=[],n=o("{","}",e);if(!n)return e.split(",");var i=n.pre,r=n.body,s=n.post,a=i.split(",");a[a.length-1]+="{"+r+"}";var c=h(s);return s.length&&(a[a.length-1]+=c.shift(),a.push.apply(a,c)),t.push.apply(t,a),t}function p(e){return"{"+e+"}"}function g(e){return/^-?0\d/.test(e)}function f(e,t){return e<=t}function m(e,t){return e>=t}function v(e,t){var n=[],r=o("{","}",e);if(!r||/\$$/.test(r.pre))return[e];var s,c=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(r.body),u=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(r.body),d=c||u,y=r.body.indexOf(",")>=0;if(!d&&!y)return r.post.match(/,.*\}/)?v(e=r.pre+"{"+r.body+a+r.post):[e];if(d)s=r.body.split(/\.\./);else if(1===(s=h(r.body)).length&&1===(s=v(s[0],!1).map(p)).length)return(R=r.post.length?v(r.post,!1):[""]).map((function(e){return r.pre+s[0]+e}));var C,b=r.pre,R=r.post.length?v(r.post,!1):[""];if(d){var D=l(s[0]),w=l(s[1]),S=Math.max(s[0].length,s[1].length),_=3==s.length?Math.abs(l(s[2])):1,T=f;w<D&&(_*=-1,T=m);var k=s.some(g);C=[];for(var P=D;T(P,w);P+=_){var x;if(u)"\\"===(x=String.fromCharCode(P))&&(x="");else if(x=String(P),k){var q=S-x.length;if(q>0){var F=new Array(q+1).join("0");x=P<0?"-"+F+x.slice(1):F+x}}C.push(x)}}else C=i(s,(function(e){return v(e,!1)}));for(var O=0;O<C.length;O++)for(var E=0;E<R.length;E++){var N=b+C[O]+R[E];(!t||d||N)&&n.push(N)}return n}},4044:e=>{e.exports=function(e,n){for(var i=[],o=0;o<e.length;o++){var r=n(e[o],o);t(r)?i.push.apply(i,r):i.push(r)}return i};var t=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},3707:(e,t,n)=>{e.exports=h,h.Minimatch=p;var i={sep:"/"};try{i=n(4043)}catch(e){}var o=h.GLOBSTAR=p.GLOBSTAR={},r=n(5457),s={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},a="[^/]",c="[^/]*?",u="().*{}+?[]^$\\!".split("").reduce((function(e,t){return e[t]=!0,e}),{}),l=/\/+/;function d(e,t){e=e||{},t=t||{};var n={};return Object.keys(t).forEach((function(e){n[e]=t[e]})),Object.keys(e).forEach((function(t){n[t]=e[t]})),n}function h(e,t,n){if("string"!=typeof t)throw new TypeError("glob pattern string required");return n||(n={}),!(!n.nocomment&&"#"===t.charAt(0))&&(""===t.trim()?""===e:new p(t,n).match(e))}function p(e,t){if(!(this instanceof p))return new p(e,t);if("string"!=typeof e)throw new TypeError("glob pattern string required");t||(t={}),e=e.trim(),"/"!==i.sep&&(e=e.split(i.sep).join("/")),this.options=t,this.set=[],this.pattern=e,this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.make()}function g(e,t){if(t||(t=this instanceof p?this.options:{}),void 0===(e=void 0===e?this.pattern:e))throw new TypeError("undefined pattern");return t.nobrace||!e.match(/\{.*\}/)?[e]:r(e)}h.filter=function(e,t){return t=t||{},function(n,i,o){return h(n,e,t)}},h.defaults=function(e){if(!e||!Object.keys(e).length)return h;var t=h,n=function(n,i,o){return t.minimatch(n,i,d(e,o))};return n.Minimatch=function(n,i){return new t.Minimatch(n,d(e,i))},n},p.defaults=function(e){return e&&Object.keys(e).length?h.defaults(e).Minimatch:p},p.prototype.debug=function(){},p.prototype.make=function(){if(!this._made){var e=this.pattern,t=this.options;if(t.nocomment||"#"!==e.charAt(0))if(e){this.parseNegate();var n=this.globSet=this.braceExpand();t.debug&&(this.debug=console.error),this.debug(this.pattern,n),n=this.globParts=n.map((function(e){return e.split(l)})),this.debug(this.pattern,n),n=n.map((function(e,t,n){return e.map(this.parse,this)}),this),this.debug(this.pattern,n),n=n.filter((function(e){return-1===e.indexOf(!1)})),this.debug(this.pattern,n),this.set=n}else this.empty=!0;else this.comment=!0}},p.prototype.parseNegate=function(){var e=this.pattern,t=!1,n=0;if(!this.options.nonegate){for(var i=0,o=e.length;i<o&&"!"===e.charAt(i);i++)t=!t,n++;n&&(this.pattern=e.substr(n)),this.negate=t}},h.braceExpand=function(e,t){return g(e,t)},p.prototype.braceExpand=g,p.prototype.parse=function(e,t){if(e.length>65536)throw new TypeError("pattern is too long");var n=this.options;if(!n.noglobstar&&"**"===e)return o;if(""===e)return"";var i,r="",l=!!n.nocase,d=!1,h=[],p=[],g=!1,m=-1,v=-1,y="."===e.charAt(0)?"":n.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",C=this;function b(){if(i){switch(i){case"*":r+=c,l=!0;break;case"?":r+=a,l=!0;break;default:r+="\\"+i}C.debug("clearStateChar %j %j",i,r),i=!1}}for(var R,D=0,w=e.length;D<w&&(R=e.charAt(D));D++)if(this.debug("%s\t%s %s %j",e,D,r,R),d&&u[R])r+="\\"+R,d=!1;else switch(R){case"/":return!1;case"\\":b(),d=!0;continue;case"?":case"*":case"+":case"@":case"!":if(this.debug("%s\t%s %s %j <-- stateChar",e,D,r,R),g){this.debug(" in class"),"!"===R&&D===v+1&&(R="^"),r+=R;continue}C.debug("call clearStateChar %j",i),b(),i=R,n.noext&&b();continue;case"(":if(g){r+="(";continue}if(!i){r+="\\(";continue}h.push({type:i,start:D-1,reStart:r.length,open:s[i].open,close:s[i].close}),r+="!"===i?"(?:(?!(?:":"(?:",this.debug("plType %j %j",i,r),i=!1;continue;case")":if(g||!h.length){r+="\\)";continue}b(),l=!0;var S=h.pop();r+=S.close,"!"===S.type&&p.push(S),S.reEnd=r.length;continue;case"|":if(g||!h.length||d){r+="\\|",d=!1;continue}b(),r+="|";continue;case"[":if(b(),g){r+="\\"+R;continue}g=!0,v=D,m=r.length,r+=R;continue;case"]":if(D===v+1||!g){r+="\\"+R,d=!1;continue}if(g){var _=e.substring(v+1,D);try{RegExp("["+_+"]")}catch(e){var T=this.parse(_,f);r=r.substr(0,m)+"\\["+T[0]+"\\]",l=l||T[1],g=!1;continue}}l=!0,g=!1,r+=R;continue;default:b(),d?d=!1:!u[R]||"^"===R&&g||(r+="\\"),r+=R}for(g&&(_=e.substr(v+1),T=this.parse(_,f),r=r.substr(0,m)+"\\["+T[0],l=l||T[1]),S=h.pop();S;S=h.pop()){var k=r.slice(S.reStart+S.open.length);this.debug("setting tail",r,S),k=k.replace(/((?:\\{2}){0,64})(\\?)\|/g,(function(e,t,n){return n||(n="\\"),t+t+n+"|"})),this.debug("tail=%j\n %s",k,k,S,r);var P="*"===S.type?c:"?"===S.type?a:"\\"+S.type;l=!0,r=r.slice(0,S.reStart)+P+"\\("+k}b(),d&&(r+="\\\\");var x=!1;switch(r.charAt(0)){case".":case"[":case"(":x=!0}for(var q=p.length-1;q>-1;q--){var F=p[q],O=r.slice(0,F.reStart),E=r.slice(F.reStart,F.reEnd-8),N=r.slice(F.reEnd-8,F.reEnd),I=r.slice(F.reEnd);N+=I;var M=O.split("(").length-1,L=I;for(D=0;D<M;D++)L=L.replace(/\)[+*?]?/,"");var A="";""===(I=L)&&t!==f&&(A="$"),r=O+E+I+A+N}if(""!==r&&l&&(r="(?=.)"+r),x&&(r=y+r),t===f)return[r,l];if(!l)return e.replace(/\\(.)/g,"$1");var j=n.nocase?"i":"";try{var H=new RegExp("^"+r+"$",j)}catch(e){return new RegExp("$.")}return H._glob=e,H._src=r,H};var f={};h.makeRe=function(e,t){return new p(e,t||{}).makeRe()},p.prototype.makeRe=function(){if(this.regexp||!1===this.regexp)return this.regexp;var e=this.set;if(!e.length)return this.regexp=!1,this.regexp;var t=this.options,n=t.noglobstar?c:t.dot?"(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?":"(?:(?!(?:\\/|^)\\.).)*?",i=t.nocase?"i":"",r=e.map((function(e){return e.map((function(e){return e===o?n:"string"==typeof e?e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"):e._src})).join("\\/")})).join("|");r="^(?:"+r+")$",this.negate&&(r="^(?!"+r+").*$");try{this.regexp=new RegExp(r,i)}catch(e){this.regexp=!1}return this.regexp},h.match=function(e,t,n){var i=new p(t,n=n||{});return e=e.filter((function(e){return i.match(e)})),i.options.nonull&&!e.length&&e.push(t),e},p.prototype.match=function(e,t){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return""===e;if("/"===e&&t)return!0;var n=this.options;"/"!==i.sep&&(e=e.split(i.sep).join("/")),e=e.split(l),this.debug(this.pattern,"split",e);var o,r,s=this.set;for(this.debug(this.pattern,"set",s),r=e.length-1;r>=0&&!(o=e[r]);r--);for(r=0;r<s.length;r++){var a=s[r],c=e;if(n.matchBase&&1===a.length&&(c=[o]),this.matchOne(c,a,t))return!!n.flipNegate||!this.negate}return!n.flipNegate&&this.negate},p.prototype.matchOne=function(e,t,n){var i=this.options;this.debug("matchOne",{this:this,file:e,pattern:t}),this.debug("matchOne",e.length,t.length);for(var r=0,s=0,a=e.length,c=t.length;r<a&&s<c;r++,s++){this.debug("matchOne loop");var u,l=t[s],d=e[r];if(this.debug(t,l,d),!1===l)return!1;if(l===o){this.debug("GLOBSTAR",[t,l,d]);var h=r,p=s+1;if(p===c){for(this.debug("** at the end");r<a;r++)if("."===e[r]||".."===e[r]||!i.dot&&"."===e[r].charAt(0))return!1;return!0}for(;h<a;){var g=e[h];if(this.debug("\nglobstar while",e,h,t,p,g),this.matchOne(e.slice(h),t.slice(p),n))return this.debug("globstar found match!",h,a,g),!0;if("."===g||".."===g||!i.dot&&"."===g.charAt(0)){this.debug("dot detected!",e,h,t,p);break}this.debug("globstar swallow a segment, and continue"),h++}return!(!n||(this.debug("\n>>> no match, partial?",e,h,t,p),h!==a))}if("string"==typeof l?(u=i.nocase?d.toLowerCase()===l.toLowerCase():d===l,this.debug("string match",l,d,u)):(u=d.match(l),this.debug("pattern match",l,d,u)),!u)return!1}if(r===a&&s===c)return!0;if(r===a)return n;if(s===c)return r===a-1&&""===e[r];throw new Error("wtf?")}},9838:(e,t,n)=>{"use strict";e.exports=n(9406)},9406:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.createMessageConnection=t.BrowserMessageWriter=t.BrowserMessageReader=void 0,n(6028).default.install();const r=n(5748);o(n(5748),t);class s extends r.AbstractMessageReader{constructor(e){super(),this._onData=new r.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 r.AbstractMessageWriter{constructor(e){super(),this.context=e,this.errorCount=0,e.addEventListener("error",(e=>this.fireError(e)))}write(e){try{return this.context.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,i){return void 0===n&&(n=r.NullLogger),r.ConnectionStrategy.is(i)&&(i={connectionStrategy:i}),(0,r.createMessageConnection)(e,t,n,i)}},6028:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(8094),o=n(8159),r=n(345),s=n(5506);class a extends s.AbstractMessageBuffer{constructor(e="utf-8"){super(e),this.asciiDecoder=new TextDecoder("ascii")}emptyBuffer(){return a.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)}}a.emptyBuffer=new Uint8Array(0);class c{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,i.default)().console.error("Converting blob to array buffer failed.")}))},this.socket.addEventListener("message",this._messageListener)}onClose(e){return this.socket.addEventListener("close",e),o.Disposable.create((()=>this.socket.removeEventListener("close",e)))}onError(e){return this.socket.addEventListener("error",e),o.Disposable.create((()=>this.socket.removeEventListener("error",e)))}onEnd(e){return this.socket.addEventListener("end",e),o.Disposable.create((()=>this.socket.removeEventListener("end",e)))}onData(e){return this._onData.event(e)}}class u{constructor(e){this.socket=e}onClose(e){return this.socket.addEventListener("close",e),o.Disposable.create((()=>this.socket.removeEventListener("close",e)))}onError(e){return this.socket.addEventListener("error",e),o.Disposable.create((()=>this.socket.removeEventListener("error",e)))}onEnd(e){return this.socket.addEventListener("end",e),o.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 l=new TextEncoder,d=Object.freeze({messageBuffer:Object.freeze({create:e=>new a(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(l.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 c(e),asWritableStream:e=>new u(e)}),console,timer:Object.freeze({setTimeout(e,t,...n){const i=setTimeout(e,t,...n);return{dispose:()=>clearTimeout(i)}},setImmediate(e,...t){const n=setTimeout(e,0,...t);return{dispose:()=>clearTimeout(n)}},setInterval(e,t,...n){const i=setInterval(e,t,...n);return{dispose:()=>clearInterval(i)}}})});function h(){return d}!function(e){e.install=function(){i.default.install(d)}}(h||(h={})),t.default=h},5748:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TraceFormat=t.TraceValues=t.Trace=t.ProgressType=t.ProgressToken=t.createMessageConnection=t.NullLogger=t.ConnectionOptions=t.ConnectionStrategy=t.WriteableStreamMessageWriter=t.AbstractMessageWriter=t.MessageWriter=t.ReadableStreamMessageReader=t.AbstractMessageReader=t.MessageReader=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.CancellationStrategy=t.CancellationSenderStrategy=t.CancellationReceiverStrategy=t.ConnectionError=t.ConnectionErrors=t.LogTraceNotification=t.SetTraceNotification=void 0;const i=n(5285);Object.defineProperty(t,"Message",{enumerable:!0,get:function(){return i.Message}}),Object.defineProperty(t,"RequestType",{enumerable:!0,get:function(){return i.RequestType}}),Object.defineProperty(t,"RequestType0",{enumerable:!0,get:function(){return i.RequestType0}}),Object.defineProperty(t,"RequestType1",{enumerable:!0,get:function(){return i.RequestType1}}),Object.defineProperty(t,"RequestType2",{enumerable:!0,get:function(){return i.RequestType2}}),Object.defineProperty(t,"RequestType3",{enumerable:!0,get:function(){return i.RequestType3}}),Object.defineProperty(t,"RequestType4",{enumerable:!0,get:function(){return i.RequestType4}}),Object.defineProperty(t,"RequestType5",{enumerable:!0,get:function(){return i.RequestType5}}),Object.defineProperty(t,"RequestType6",{enumerable:!0,get:function(){return i.RequestType6}}),Object.defineProperty(t,"RequestType7",{enumerable:!0,get:function(){return i.RequestType7}}),Object.defineProperty(t,"RequestType8",{enumerable:!0,get:function(){return i.RequestType8}}),Object.defineProperty(t,"RequestType9",{enumerable:!0,get:function(){return i.RequestType9}}),Object.defineProperty(t,"ResponseError",{enumerable:!0,get:function(){return i.ResponseError}}),Object.defineProperty(t,"ErrorCodes",{enumerable:!0,get:function(){return i.ErrorCodes}}),Object.defineProperty(t,"NotificationType",{enumerable:!0,get:function(){return i.NotificationType}}),Object.defineProperty(t,"NotificationType0",{enumerable:!0,get:function(){return i.NotificationType0}}),Object.defineProperty(t,"NotificationType1",{enumerable:!0,get:function(){return i.NotificationType1}}),Object.defineProperty(t,"NotificationType2",{enumerable:!0,get:function(){return i.NotificationType2}}),Object.defineProperty(t,"NotificationType3",{enumerable:!0,get:function(){return i.NotificationType3}}),Object.defineProperty(t,"NotificationType4",{enumerable:!0,get:function(){return i.NotificationType4}}),Object.defineProperty(t,"NotificationType5",{enumerable:!0,get:function(){return i.NotificationType5}}),Object.defineProperty(t,"NotificationType6",{enumerable:!0,get:function(){return i.NotificationType6}}),Object.defineProperty(t,"NotificationType7",{enumerable:!0,get:function(){return i.NotificationType7}}),Object.defineProperty(t,"NotificationType8",{enumerable:!0,get:function(){return i.NotificationType8}}),Object.defineProperty(t,"NotificationType9",{enumerable:!0,get:function(){return i.NotificationType9}}),Object.defineProperty(t,"ParameterStructures",{enumerable:!0,get:function(){return i.ParameterStructures}});const o=n(5164);Object.defineProperty(t,"LinkedMap",{enumerable:!0,get:function(){return o.LinkedMap}}),Object.defineProperty(t,"LRUCache",{enumerable:!0,get:function(){return o.LRUCache}}),Object.defineProperty(t,"Touch",{enumerable:!0,get:function(){return o.Touch}});const r=n(8159);Object.defineProperty(t,"Disposable",{enumerable:!0,get:function(){return r.Disposable}});const s=n(345);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(7770);Object.defineProperty(t,"CancellationTokenSource",{enumerable:!0,get:function(){return a.CancellationTokenSource}}),Object.defineProperty(t,"CancellationToken",{enumerable:!0,get:function(){return a.CancellationToken}});const c=n(4806);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 u=n(9248);Object.defineProperty(t,"MessageWriter",{enumerable:!0,get:function(){return u.MessageWriter}}),Object.defineProperty(t,"AbstractMessageWriter",{enumerable:!0,get:function(){return u.AbstractMessageWriter}}),Object.defineProperty(t,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return u.WriteableStreamMessageWriter}});const l=n(6336);Object.defineProperty(t,"ConnectionStrategy",{enumerable:!0,get:function(){return l.ConnectionStrategy}}),Object.defineProperty(t,"ConnectionOptions",{enumerable:!0,get:function(){return l.ConnectionOptions}}),Object.defineProperty(t,"NullLogger",{enumerable:!0,get:function(){return l.NullLogger}}),Object.defineProperty(t,"createMessageConnection",{enumerable:!0,get:function(){return l.createMessageConnection}}),Object.defineProperty(t,"ProgressToken",{enumerable:!0,get:function(){return l.ProgressToken}}),Object.defineProperty(t,"ProgressType",{enumerable:!0,get:function(){return l.ProgressType}}),Object.defineProperty(t,"Trace",{enumerable:!0,get:function(){return l.Trace}}),Object.defineProperty(t,"TraceValues",{enumerable:!0,get:function(){return l.TraceValues}}),Object.defineProperty(t,"TraceFormat",{enumerable:!0,get:function(){return l.TraceFormat}}),Object.defineProperty(t,"SetTraceNotification",{enumerable:!0,get:function(){return l.SetTraceNotification}}),Object.defineProperty(t,"LogTraceNotification",{enumerable:!0,get:function(){return l.LogTraceNotification}}),Object.defineProperty(t,"ConnectionErrors",{enumerable:!0,get:function(){return l.ConnectionErrors}}),Object.defineProperty(t,"ConnectionError",{enumerable:!0,get:function(){return l.ConnectionError}}),Object.defineProperty(t,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return l.CancellationReceiverStrategy}}),Object.defineProperty(t,"CancellationSenderStrategy",{enumerable:!0,get:function(){return l.CancellationSenderStrategy}}),Object.defineProperty(t,"CancellationStrategy",{enumerable:!0,get:function(){return l.CancellationStrategy}});const d=n(8094);t.RAL=d.default},7770:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CancellationTokenSource=t.CancellationToken=void 0;const i=n(8094),o=n(8472),r=n(345);var s;!function(e){e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:r.Event.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:r.Event.None}),e.is=function(t){const n=t;return n&&(n===e.None||n===e.Cancelled||o.boolean(n.isCancellationRequested)&&!!n.onCancellationRequested)}}(s=t.CancellationToken||(t.CancellationToken={}));const a=Object.freeze((function(e,t){const n=(0,i.default)().timer.setTimeout(e.bind(t),0);return{dispose(){n.dispose()}}}));class c{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 r.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 c),this._token}cancel(){this._token?this._token.cancel():this._token=s.Cancelled}dispose(){this._token?this._token instanceof c&&this._token.dispose():this._token=s.None}}},6336:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createMessageConnection=t.ConnectionOptions=t.CancellationStrategy=t.CancellationSenderStrategy=t.CancellationReceiverStrategy=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 i=n(8094),o=n(8472),r=n(5285),s=n(5164),a=n(345),c=n(7770);var u,l,d,h,p,g,f,m,v,y,C,b,R,D,w;!function(e){e.type=new r.NotificationType("$/cancelRequest")}(u||(u={})),function(e){e.is=function(e){return"string"==typeof e||"number"==typeof e}}(l=t.ProgressToken||(t.ProgressToken={})),function(e){e.type=new r.NotificationType("$/progress")}(d||(d={})),t.ProgressType=class{constructor(){}},function(e){e.is=function(e){return o.func(e)}}(h||(h={})),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"}(p=t.Trace||(t.Trace={})),(w=t.TraceValues||(t.TraceValues={})).Off="off",w.Messages="messages",w.Compact="compact",w.Verbose="verbose",function(e){e.fromString=function(t){if(!o.string(t))return e.Off;switch(t=t.toLowerCase()){case"off":return e.Off;case"messages":return e.Messages;case"compact":return e.Compact;case"verbose":return e.Verbose;default:return e.Off}},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"}}}(p=t.Trace||(t.Trace={})),function(e){e.Text="text",e.JSON="json"}(t.TraceFormat||(t.TraceFormat={})),function(e){e.fromString=function(t){return o.string(t)&&"json"===(t=t.toLowerCase())?e.JSON:e.Text}}(g=t.TraceFormat||(t.TraceFormat={})),function(e){e.type=new r.NotificationType("$/setTrace")}(f=t.SetTraceNotification||(t.SetTraceNotification={})),function(e){e.type=new r.NotificationType("$/logTrace")}(m=t.LogTraceNotification||(t.LogTraceNotification={})),function(e){e[e.Closed=1]="Closed",e[e.Disposed=2]="Disposed",e[e.AlreadyListening=3]="AlreadyListening"}(v=t.ConnectionErrors||(t.ConnectionErrors={}));class S extends Error{constructor(e,t){super(t),this.code=e,Object.setPrototypeOf(this,S.prototype)}}t.ConnectionError=S,function(e){e.is=function(e){const t=e;return t&&o.func(t.cancelUndispatched)}}(y=t.ConnectionStrategy||(t.ConnectionStrategy={})),function(e){e.Message=Object.freeze({createCancellationTokenSource:e=>new c.CancellationTokenSource}),e.is=function(e){const t=e;return t&&o.func(t.createCancellationTokenSource)}}(C=t.CancellationReceiverStrategy||(t.CancellationReceiverStrategy={})),function(e){e.Message=Object.freeze({sendCancellation:(e,t)=>e.sendNotification(u.type,{id:t}),cleanup(e){}}),e.is=function(e){const t=e;return t&&o.func(t.sendCancellation)&&o.func(t.cleanup)}}(b=t.CancellationSenderStrategy||(t.CancellationSenderStrategy={})),function(e){e.Message=Object.freeze({receiver:C.Message,sender:b.Message}),e.is=function(e){const t=e;return t&&C.is(t.receiver)&&b.is(t.sender)}}(R=t.CancellationStrategy||(t.CancellationStrategy={})),(t.ConnectionOptions||(t.ConnectionOptions={})).is=function(e){const t=e;return t&&(R.is(t.cancellationStrategy)||y.is(t.connectionStrategy))},function(e){e[e.New=1]="New",e[e.Listening=2]="Listening",e[e.Closed=3]="Closed",e[e.Disposed=4]="Disposed"}(D||(D={})),t.createMessageConnection=function(e,n,y,C){const b=void 0!==y?y:t.NullLogger;let w=0,_=0,T=0;const k="2.0";let P;const x=new Map;let q;const F=new Map,O=new Map;let E,N,I=new s.LinkedMap,M=new Map,L=new Set,A=new Map,j=p.Off,H=g.Text,W=D.New;const K=new a.Emitter,U=new a.Emitter,z=new a.Emitter,$=new a.Emitter,V=new a.Emitter,B=C&&C.cancellationStrategy?C.cancellationStrategy:R.Message;function J(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){}function G(){return W===D.Listening}function X(){return W===D.Closed}function Y(){return W===D.Disposed}function Z(){W!==D.New&&W!==D.Listening||(W=D.Closed,U.fire(void 0))}function ee(){E||0===I.size||(E=(0,i.default)().timer.setImmediate((()=>{E=void 0,function(){if(0===I.size)return;const e=I.shift();try{r.Message.isRequest(e)?function(e){if(Y())return;function t(t,i,o){const s={jsonrpc:k,id:e.id};t instanceof r.ResponseError?s.error=t.toJson():s.result=void 0===t?null:t,ie(s,i,o),n.write(s).catch((()=>b.error("Sending response failed.")))}function i(t,i,o){const r={jsonrpc:k,id:e.id,error:t.toJson()};ie(r,i,o),n.write(r).catch((()=>b.error("Sending response failed.")))}!function(e){if(j!==p.Off&&N)if(H===g.Text){let t;j!==p.Verbose&&j!==p.Compact||!e.params||(t=`Params: ${ne(e.params)}\n\n`),N.log(`Received request '${e.method} - (${e.id})'.`,t)}else re("receive-request",e)}(e);const s=x.get(e.method);let a,c;s&&(a=s.type,c=s.handler);const u=Date.now();if(c||P){const s=e.id??String(Date.now()),l=B.receiver.createCancellationTokenSource(s);null!==e.id&&L.has(e.id)&&l.cancel(),null!==e.id&&A.set(s,l);try{let d;if(c)if(void 0===e.params){if(void 0!==a&&0!==a.numberOfParams)return void i(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${e.method} defines ${a.numberOfParams} params but received none.`),e.method,u);d=c(l.token)}else if(Array.isArray(e.params)){if(void 0!==a&&a.parameterStructures===r.ParameterStructures.byName)return void i(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${e.method} defines parameters by name but received parameters by position`),e.method,u);d=c(...e.params,l.token)}else{if(void 0!==a&&a.parameterStructures===r.ParameterStructures.byPosition)return void i(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${e.method} defines parameters by position but received parameters by name`),e.method,u);d=c(e.params,l.token)}else P&&(d=P(e.method,e.params,l.token));const h=d;d?h.then?h.then((n=>{A.delete(s),t(n,e.method,u)}),(t=>{A.delete(s),t instanceof r.ResponseError?i(t,e.method,u):t&&o.string(t.message)?i(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${e.method} failed with message: ${t.message}`),e.method,u):i(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${e.method} failed unexpectedly without providing any details.`),e.method,u)})):(A.delete(s),t(d,e.method,u)):(A.delete(s),function(t,i,o){void 0===t&&(t=null);const r={jsonrpc:k,id:e.id,result:t};ie(r,i,o),n.write(r).catch((()=>b.error("Sending response failed.")))}(d,e.method,u))}catch(n){A.delete(s),n instanceof r.ResponseError?t(n,e.method,u):n&&o.string(n.message)?i(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${e.method} failed with message: ${n.message}`),e.method,u):i(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${e.method} failed unexpectedly without providing any details.`),e.method,u)}}else i(new r.ResponseError(r.ErrorCodes.MethodNotFound,`Unhandled method ${e.method}`),e.method,u)}(e):r.Message.isNotification(e)?function(e){if(Y())return;let t,n;if(e.method===u.type.method){const t=e.params.id;return L.delete(t),void oe(e)}{const i=F.get(e.method);i&&(n=i.handler,t=i.type)}if(n||q)try{if(oe(e),n)if(void 0===e.params)void 0!==t&&0!==t.numberOfParams&&t.parameterStructures!==r.ParameterStructures.byName&&b.error(`Notification ${e.method} defines ${t.numberOfParams} params but received none.`),n();else if(Array.isArray(e.params)){const i=e.params;e.method===d.type.method&&2===i.length&&l.is(i[0])?n({token:i[0],value:i[1]}):(void 0!==t&&(t.parameterStructures===r.ParameterStructures.byName&&b.error(`Notification ${e.method} defines parameters by name but received parameters by position`),t.numberOfParams!==e.params.length&&b.error(`Notification ${e.method} defines ${t.numberOfParams} params but received ${i.length} arguments`)),n(...i))}else void 0!==t&&t.parameterStructures===r.ParameterStructures.byPosition&&b.error(`Notification ${e.method} defines parameters by position but received parameters by name`),n(e.params);else q&&q(e.method,e.params)}catch(t){t.message?b.error(`Notification handler '${e.method}' failed with message: ${t.message}`):b.error(`Notification handler '${e.method}' failed unexpectedly.`)}else z.fire(e)}(e):r.Message.isResponse(e)?function(e){if(!Y())if(null===e.id)e.error?b.error(`Received response message without id: Error is: \n${JSON.stringify(e.error,void 0,4)}`):b.error("Received response message without id. No further error information provided.");else{const t=e.id,n=M.get(t);if(function(e,t){if(j!==p.Off&&N)if(H===g.Text){let n;if(j!==p.Verbose&&j!==p.Compact||(e.error&&e.error.data?n=`Error data: ${ne(e.error.data)}\n\n`:e.result?n=`Result: ${ne(e.result)}\n\n`:void 0===e.error&&(n="No result returned.\n\n")),t){const i=e.error?` Request failed: ${e.error.message} (${e.error.code}).`:"";N.log(`Received response '${t.method} - (${e.id})' in ${Date.now()-t.timerStart}ms.${i}`,n)}else N.log(`Received response ${e.id} without active response promise.`,n)}else re("receive-response",e)}(e,n),void 0!==n){M.delete(t);try{if(e.error){const t=e.error;n.reject(new r.ResponseError(t.code,t.message,t.data))}else{if(void 0===e.result)throw new Error("Should never happen.");n.resolve(e.result)}}catch(e){e.message?b.error(`Response handler '${n.method}' failed with message: ${e.message}`):b.error(`Response handler '${n.method}' failed unexpectedly.`)}}}}(e):function(e){if(!e)return void b.error("Received empty message.");b.error(`Received message which is neither a response nor a notification message:\n${JSON.stringify(e,null,4)}`);const t=e;if(o.string(t.id)||o.number(t.id)){const e=t.id,n=M.get(e);n&&n.reject(new Error("The received response has neither a result nor an error property."))}}(e)}finally{ee()}}()})))}e.onClose(Z),e.onError((function(e){K.fire([e,void 0,void 0])})),n.onClose(Z),n.onError((function(e){K.fire(e)}));const te=e=>{try{if(r.Message.isNotification(e)&&e.method===u.type.method){const t=e.params.id,i=J(t),o=I.get(i);if(r.Message.isRequest(o)){const r=C?.connectionStrategy,s=r&&r.cancelUndispatched?r.cancelUndispatched(o,Q):void 0;if(s&&(void 0!==s.error||void 0!==s.result))return I.delete(i),A.delete(t),s.id=o.id,ie(s,e.method,Date.now()),void n.write(s).catch((()=>b.error("Sending response for canceled message failed.")))}const s=A.get(t);if(void 0!==s)return s.cancel(),void oe(e);L.add(t)}!function(e,t){var n;r.Message.isRequest(t)?e.set(J(t.id),t):r.Message.isResponse(t)?e.set(null===(n=t.id)?"res-unknown-"+(++T).toString():"res-"+n.toString(),t):e.set("not-"+(++_).toString(),t)}(I,e)}finally{ee()}};function ne(e){if(null!=e)switch(j){case p.Verbose:return JSON.stringify(e,null,4);case p.Compact:return JSON.stringify(e);default:return}}function ie(e,t,n){if(j!==p.Off&&N)if(H===g.Text){let i;j!==p.Verbose&&j!==p.Compact||(e.error&&e.error.data?i=`Error data: ${ne(e.error.data)}\n\n`:e.result?i=`Result: ${ne(e.result)}\n\n`:void 0===e.error&&(i="No result returned.\n\n")),N.log(`Sending response '${t} - (${e.id})'. Processing request took ${Date.now()-n}ms`,i)}else re("send-response",e)}function oe(e){if(j!==p.Off&&N&&e.method!==m.type.method)if(H===g.Text){let t;j!==p.Verbose&&j!==p.Compact||(t=e.params?`Params: ${ne(e.params)}\n\n`:"No parameters provided.\n\n"),N.log(`Received notification '${e.method}'.`,t)}else re("receive-notification",e)}function re(e,t){if(!N||j===p.Off)return;const n={isLSPMessage:!0,type:e,message:t,timestamp:Date.now()};N.log(n)}function se(){if(X())throw new S(v.Closed,"Connection is closed.");if(Y())throw new S(v.Disposed,"Connection is disposed.")}function ae(e){return void 0===e?null:e}function ce(e){return null===e?void 0:e}function ue(e){return null!=e&&!Array.isArray(e)&&"object"==typeof e}function le(e,t){switch(e){case r.ParameterStructures.auto:return ue(t)?ce(t):[ae(t)];case r.ParameterStructures.byName:if(!ue(t))throw new Error("Received parameters by name but param is not an object literal.");return ce(t);case r.ParameterStructures.byPosition:return[ae(t)];default:throw new Error(`Unknown parameter structure ${e.toString()}`)}}function de(e,t){let n;const i=e.numberOfParams;switch(i){case 0:n=void 0;break;case 1:n=le(e.parameterStructures,t[0]);break;default:n=[];for(let e=0;e<t.length&&e<i;e++)n.push(ae(t[e]));if(t.length<i)for(let e=t.length;e<i;e++)n.push(null)}return n}const he={sendNotification:(e,...t)=>{let i,s;if(se(),o.string(e)){i=e;const n=t[0];let o=0,a=r.ParameterStructures.auto;r.ParameterStructures.is(n)&&(o=1,a=n);let c=t.length;const u=c-o;switch(u){case 0:s=void 0;break;case 1:s=le(a,t[o]);break;default:if(a===r.ParameterStructures.byName)throw new Error(`Received ${u} parameters for 'by Name' notification parameter structure.`);s=t.slice(o,c).map((e=>ae(e)))}}else{const n=t;i=e.method,s=de(e,n)}const a={jsonrpc:k,method:i,params:s};return function(e){if(j!==p.Off&&N)if(H===g.Text){let t;j!==p.Verbose&&j!==p.Compact||(t=e.params?`Params: ${ne(e.params)}\n\n`:"No parameters provided.\n\n"),N.log(`Sending notification '${e.method}'.`,t)}else re("send-notification",e)}(a),n.write(a).catch((()=>b.error("Sending notification failed.")))},onNotification:(e,t)=>{let n;return se(),o.func(e)?q=e:t&&(o.string(e)?(n=e,F.set(e,{type:void 0,handler:t})):(n=e.method,F.set(e.method,{type:e,handler:t}))),{dispose:()=>{void 0!==n?F.delete(n):q=void 0}}},onProgress:(e,t,n)=>{if(O.has(t))throw new Error(`Progress handler for token ${t} already registered`);return O.set(t,n),{dispose:()=>{O.delete(t)}}},sendProgress:(e,t,n)=>he.sendNotification(d.type,{token:t,value:n}),onUnhandledProgress:$.event,sendRequest:(e,...t)=>{let i,s,a;if(se(),function(){if(!G())throw new Error("Call listen() first.")}(),o.string(e)){i=e;const n=t[0],o=t[t.length-1];let u=0,l=r.ParameterStructures.auto;r.ParameterStructures.is(n)&&(u=1,l=n);let d=t.length;c.CancellationToken.is(o)&&(d-=1,a=o);const h=d-u;switch(h){case 0:s=void 0;break;case 1:s=le(l,t[u]);break;default:if(l===r.ParameterStructures.byName)throw new Error(`Received ${h} parameters for 'by Name' request parameter structure.`);s=t.slice(u,d).map((e=>ae(e)))}}else{const n=t;i=e.method,s=de(e,n);const o=e.numberOfParams;a=c.CancellationToken.is(n[o])?n[o]:void 0}const u=w++;let l;return a&&(l=a.onCancellationRequested((()=>{const e=B.sender.sendCancellation(he,u);return void 0===e?(b.log(`Received no promise from cancellation strategy when cancelling id ${u}`),Promise.resolve()):e.catch((()=>{b.log(`Sending cancellation messages for id ${u} failed`)}))}))),new Promise(((e,t)=>{const o={jsonrpc:k,id:u,method:i,params:s};let a={method:i,timerStart:Date.now(),resolve:t=>{e(t),B.sender.cleanup(u),l?.dispose()},reject:e=>{t(e),B.sender.cleanup(u),l?.dispose()}};!function(e){if(j!==p.Off&&N)if(H===g.Text){let t;j!==p.Verbose&&j!==p.Compact||!e.params||(t=`Params: ${ne(e.params)}\n\n`),N.log(`Sending request '${e.method} - (${e.id})'.`,t)}else re("send-request",e)}(o);try{n.write(o).catch((()=>b.error("Sending request failed.")))}catch(e){a.reject(new r.ResponseError(r.ErrorCodes.MessageWriteError,e.message?e.message:"Unknown reason")),a=null}a&&M.set(u,a)}))},onRequest:(e,t)=>{se();let n=null;return h.is(e)?(n=void 0,P=e):o.string(e)?(n=null,void 0!==t&&(n=e,x.set(e,{handler:t,type:void 0}))):void 0!==t&&(n=e.method,x.set(e.method,{type:e,handler:t})),{dispose:()=>{null!==n&&(void 0!==n?x.delete(n):P=void 0)}}},hasPendingResponse:()=>M.size>0,trace:async(e,t,n)=>{let i=!1,r=g.Text;void 0!==n&&(o.boolean(n)?i=n:(i=n.sendNotification||!1,r=n.traceFormat||g.Text)),j=e,H=r,N=j===p.Off?void 0:t,!i||X()||Y()||await he.sendNotification(f.type,{value:p.toString(e)})},onError:K.event,onClose:U.event,onUnhandledNotification:z.event,onDispose:V.event,end:()=>{n.end()},dispose:()=>{if(Y())return;W=D.Disposed,V.fire(void 0);const t=new r.ResponseError(r.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(const e of M.values())e.reject(t);M=new Map,A=new Map,L=new Set,I=new s.LinkedMap,o.func(n.dispose)&&n.dispose(),o.func(e.dispose)&&e.dispose()},listen:()=>{se(),function(){if(G())throw new S(v.AlreadyListening,"Connection is already listening")}(),W=D.Listening,e.listen(te)},inspect:()=>{(0,i.default)().console.log("inspect")}};return he.onNotification(m.type,(e=>{if(j===p.Off||!N)return;const t=j===p.Verbose||j===p.Compact;N.log(e.message,t?e.verbose:void 0)})),he.onNotification(d.type,(e=>{const t=O.get(e.token);t?t(e.value):$.fire(e)})),he}},8159:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Disposable=void 0,(t.Disposable||(t.Disposable={})).create=function(e){return{dispose:e}}},345:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Emitter=t.Event=void 0;const i=n(8094);!function(e){const t={dispose(){}};e.None=function(){return t}}(t.Event||(t.Event={}));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 i=0,o=this._callbacks.length;i<o;i++)if(this._callbacks[i]===e){if(this._contexts[i]===t)return this._callbacks.splice(i,1),void this._contexts.splice(i,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),o=this._contexts.slice(0);for(let r=0,s=n.length;r<s;r++)try{t.push(n[r].apply(o[r],e))}catch(e){(0,i.default)().console.error(e)}return t}isEmpty(){return!this._callbacks||0===this._callbacks.length}dispose(){this._callbacks=void 0,this._contexts=void 0}}class r{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 i={dispose:()=>{this._callbacks&&(this._callbacks.remove(e,t),i.dispose=r._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)}}t.Emitter=r,r._noop=function(){}},8472:(e,t)=>{"use strict";function n(e){return"string"==typeof e||e instanceof String}function i(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=i,t.stringArray=function(e){return i(e)&&e.every((e=>n(e)))}},5164:(e,t)=>{"use strict";var n,i;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}(i=t.Touch||(t.Touch={}));class o{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=i.None){const n=this._map.get(e);if(n)return t!==i.None&&this.touch(n,t),n.value}set(e,t,n=i.None){let o=this._map.get(e);if(o)o.value=t,n!==i.None&&this.touch(o,n);else{switch(o={key:e,value:t,next:void 0,previous:void 0},n){case i.None:this.addItemLast(o);break;case i.First:this.addItemFirst(o);break;case i.Last:default:this.addItemLast(o)}this._map.set(e,o),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 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(){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===i.First||t===i.Last)if(t===i.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===i.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=o,t.LRUCache=class extends o{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=i.AsNew){return super.get(e,t)}peek(e){return super.get(e,i.None)}set(e,t){return super.set(e,t,i.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}}},5506:(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(){if(0===this._chunks.length)return;let e=0,t=0,n=0,i=0;e:for(;t<this._chunks.length;){const o=this._chunks[t];for(n=0;n<o.length;){switch(o[n]){case 13:switch(e){case 0:e=1;break;case 2:e=3;break;default:e=0}break;case 10:switch(e){case 1:e=2;break;case 3:e=4,n++;break e;default:e=0}break;default:e=0}n++}i+=o.byteLength,t++}if(4!==e)return;const o=this._read(i+n),r=new Map,s=this.toString(o,"ascii").split("\r\n");if(s.length<2)return r;for(let e=0;e<s.length-2;e++){const t=s[e],n=t.indexOf(":");if(-1===n)throw new Error("Message header must separate key and value using :");const i=t.substr(0,n),o=t.substr(n+1).trim();r.set(i,o)}return r}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 i=this._chunks[0];if(i.byteLength>e){const o=i.slice(0,e);t.set(o,n),n+=e,this._chunks[0]=i.slice(e),this._totalLength-=e,e-=e}else t.set(i,n),n+=i.byteLength,this._chunks.shift(),this._totalLength-=i.byteLength,e-=i.byteLength}return t}}},4806:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ReadableStreamMessageReader=t.AbstractMessageReader=t.MessageReader=void 0;const i=n(8094),o=n(8472),r=n(345);var s;(t.MessageReader||(t.MessageReader={})).is=function(e){let t=e;return t&&o.func(t.listen)&&o.func(t.dispose)&&o.func(t.onError)&&o.func(t.onClose)&&o.func(t.onPartialMessage)};class a{constructor(){this.errorEmitter=new r.Emitter,this.closeEmitter=new r.Emitter,this.partialMessageEmitter=new r.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: ${o.string(e.message)?e.message:"unknown"}`)}}t.AbstractMessageReader=a,function(e){e.fromOptions=function(e){let t,n;const o=new Map;let r;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,o.set(n.name,n)),void 0!==e.contentDecoders)for(const t of e.contentDecoders)o.set(t.name,t);if(void 0!==e.contentTypeDecoder&&(r=e.contentTypeDecoder,s.set(r.name,r)),void 0!==e.contentTypeDecoders)for(const t of e.contentTypeDecoders)s.set(t.name,t)}return void 0===r&&(r=(0,i.default)().applicationJson.decoder,s.set(r.name,r)),{charset:t,contentDecoder:n,contentDecoders:o,contentTypeDecoder:r,contentTypeDecoders:s}}}(s||(s={})),t.ReadableStreamMessageReader=class extends a{constructor(e,t){super(),this.readable=e,this.options=s.fromOptions(t),this.buffer=(