diff --git a/copilot/js/assets/agents/Plan.agent.md b/copilot/js/assets/agents/Plan.agent.md index d23282b3..25f907c3 100644 --- a/copilot/js/assets/agents/Plan.agent.md +++ b/copilot/js/assets/agents/Plan.agent.md @@ -2,7 +2,7 @@ name: Plan description: Researches and outlines multi-step plans argument-hint: Outline the goal or problem to research -x-github-copilot-invoke-policy: ["user", "model"] +x-github-copilot-invoke-policy: ["user"] tools: ['read_file', 'list_dir', 'semantic_search', 'grep_search', 'file_search', 'get_errors'] handoffs: - label: Start Implementation diff --git a/copilot/js/diffWorker.js b/copilot/js/diffWorker.js index 5e78adf9..5810d31c 100644 --- a/copilot/js/diffWorker.js +++ b/copilot/js/diffWorker.js @@ -40,4 +40,3 @@ ${f.join(` `).length>=15&&Mn(m,d=>d.length>=2)>=2}),u=qn(i,u),u}s(sn,"computeMovedLines");function Mn(i,e){let t=0;for(let n of i)e(n)&&t++;return t}s(Mn,"countWhere");function Un(i,e,t,n){let r=[],o=i.filter(l=>l.modified.isEmpty&&l.original.length>=3).map(l=>new we(l.original,e,l)),u=new Set(i.filter(l=>l.original.isEmpty&&l.modified.length>=3).map(l=>new we(l.modified,t,l))),a=new Set;for(let l of o){let c=-1,f;for(let m of u){let p=l.computeSimilarity(m);p>c&&(c=p,f=m)}if(c>.9&&f&&(u.delete(f),r.push(new H(l.range,f.range)),a.add(l.source),a.add(f.source)),!n.isValid())return{moves:r,excludedChanges:a}}return{moves:r,excludedChanges:a}}s(Un,"computeMovesFromSimpleDeletionsToSimpleInsertions");function kn(i,e,t,n,r,o){let u=[],a=new le;for(let p of i)for(let d=p.original.startLineNumber;d
n.length||L>r.length||c.contains(L)||f.contains(_)||!rn(n[_-1],r[L-1],o))break}T>0&&(f.addRange(new O(d.original.endLineNumberExclusive,d.original.endLineNumberExclusive+T)),c.addRange(new O(d.modified.endLineNumberExclusive,d.modified.endLineNumberExclusive+T))),(b>0||T>0)&&(u[p]=new H(new O(d.original.startLineNumber-b,d.original.endLineNumberExclusive+T),new O(d.modified.startLineNumber-b,d.modified.endLineNumberExclusive+T)))}return u}s(kn,"computeUnchangedMoves");function rn(i,e,t){if(i.trim()===e.trim())return!0;if(i.length>300&&e.length>300)return!1;let r=new he().compute(new ne([i],new y(1,1,1,i.length),!1),new ne([e],new y(1,1,1,e.length),!1),t),o=0,u=q.invert(r.diffs,i.length);for(let f of u)f.seq1Range.forEach(m=>{Ne(i.charCodeAt(m))||o++});function a(f){let m=0;for(let p=0;p {f();(function(t,e){typeof xNe=="object"?q1r.exports=xNe=e(Es()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(xNe,function(t){return(function(){if(typeof ArrayBuffer=="function"){var e=t,r=e.lib,n=r.WordArray,o=n.init,s=n.init=function(c){if(c instanceof ArrayBuffer&&(c=new Uint8Array(c)),(c instanceof Int8Array||typeof Uint8ClampedArray<"u"&&c instanceof Uint8ClampedArray||c instanceof Int16Array||c instanceof Uint16Array||c instanceof Int32Array||c instanceof Uint32Array||c instanceof Float32Array||c instanceof Float64Array)&&(c=new Uint8Array(c.buffer,c.byteOffset,c.byteLength)),c instanceof Uint8Array){for(var l=c.byteLength,u=[],d=0;d >>2]>>>24-g%4*8&255,y=d[g+1>>>2]>>>24-(g+1)%4*8&255,E=d[g+2>>>2]>>>24-(g+2)%4*8&255,_=A<<16|y<<8|E,v=0;v<4&&g+v*.75 >>6*(3-v)&63));var b=h.charAt(64);if(b)for(;m.length%4;)m.push(b);return m.join("")},"stringify"),parse:a(function(l,u){u===void 0&&(u=!0);var d=l.length,p=u?this._safe_map:this._map,h=this._reverseMap;if(!h){h=this._reverseMap=[];for(var m=0;m {f();(function(t,e,r){typeof GNe=="object"?avr.exports=GNe=e(Es(),MNe(),qNe()):typeof define=="function"&&define.amd?define(["./core","./sha256","./hmac"],e):e(t.CryptoJS)})(GNe,function(t){return(function(){var e=t,r=e.lib,n=r.Base,o=r.WordArray,s=e.algo,c=s.SHA256,l=s.HMAC,u=s.PBKDF2=n.extend({cfg:n.extend({keySize:128/32,hasher:c,iterations:25e4}),init:a(function(d){this.cfg=this.cfg.extend(d)},"init"),compute:a(function(d,p){for(var h=this.cfg,m=l.create(h.hasher,d),g=o.create(),A=o.create([1]),y=g.words,E=A.words,_=h.keySize,v=h.iterations;y.length<_;){var b=m.update(p).finalize(A);m.reset();for(var I=b.words,x=I.length,R=b,w=1;w {f();(function(t,e){typeof Tke=="object"?svr.exports=Tke=e(ms()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Tke,function(t){return(function(){if(typeof ArrayBuffer=="function"){var e=t,r=e.lib,n=r.WordArray,o=n.init,s=n.init=function(c){if(c instanceof ArrayBuffer&&(c=new Uint8Array(c)),(c instanceof Int8Array||typeof Uint8ClampedArray<"u"&&c instanceof Uint8ClampedArray||c instanceof Int16Array||c instanceof Uint16Array||c instanceof Int32Array||c instanceof Uint32Array||c instanceof Float32Array||c instanceof Float64Array)&&(c=new Uint8Array(c.buffer,c.byteOffset,c.byteLength)),c instanceof Uint8Array){for(var l=c.byteLength,u=[],d=0;d >>2]>>>24-g%4*8&255,y=d[g+1>>>2]>>>24-(g+1)%4*8&255,E=d[g+2>>>2]>>>24-(g+2)%4*8&255,_=A<<16|y<<8|E,v=0;v<4&&g+v*.75 >>6*(3-v)&63));var b=h.charAt(64);if(b)for(;m.length%4;)m.push(b);return m.join("")},"stringify"),parse:a(function(l,u){u===void 0&&(u=!0);var d=l.length,p=u?this._safe_map:this._map,h=this._reverseMap;if(!h){h=this._reverseMap=[];for(var m=0;m {f();(function(t,e,r){typeof Uke=="object"?Ivr.exports=Uke=e(ms(),kke(),Fke()):typeof define=="function"&&define.amd?define(["./core","./sha256","./hmac"],e):e(t.CryptoJS)})(Uke,function(t){return(function(){var e=t,r=e.lib,n=r.Base,o=r.WordArray,s=e.algo,c=s.SHA256,l=s.HMAC,u=s.PBKDF2=n.extend({cfg:n.extend({keySize:128/32,hasher:c,iterations:25e4}),init:a(function(d){this.cfg=this.cfg.extend(d)},"init"),compute:a(function(d,p){for(var h=this.cfg,m=l.create(h.hasher,d),g=o.create(),A=o.create([1]),y=g.words,E=A.words,_=h.keySize,v=h.iterations;y.length<_;){var b=m.update(p).finalize(A);m.reset();for(var I=b.words,x=I.length,w=b,R=1;R=0)return r}else{var n=Kht.toSetString(e);if(Jht.call(this._set,n))return this._set[n]}throw new Error('"'+e+'" is not in the set.')},"ArraySet_indexOf");T5.prototype.at=a(function(e){if(e>=0&&e=0)return r}else{var n=iht.toSetString(e);if(oht.call(this._set,n))return this._set[n]}throw new Error('"'+e+'" is not in the set.')},"ArraySet_indexOf");fN.prototype.at=a(function(e){if(e>=0&&e{f();(function(t,e,r){typeof VNe=="object"?pvr.exports=VNe=e(Es(),tp()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(VNe,function(t){return t.mode.CTR=(function(){var e=t.lib.BlockCipherMode.extend(),r=e.Encryptor=e.extend({processBlock:a(function(n,o){var s=this._cipher,c=s.blockSize,l=this._iv,u=this._counter;l&&(u=this._counter=l.slice(0),this._iv=void 0);var d=u.slice(0);s.encryptBlock(d,0),u[c-1]=u[c-1]+1|0;for(var p=0;p1;--I)_=_^A.pbox[I],v=d(A,_)^v,b=_,_=v,v=b;return b=_,_=v,v=b,v=v^A.pbox[1],_=_^A.pbox[0],{left:_,right:v}}a(h,"BlowFish_Decrypt");function m(A,y,E){for(let x=0;x<4;x++){A.sbox[x]=[];for(let R=0;R<256;R++)A.sbox[x][R]=l[x][R]}let _=0;for(let x=0;x=E&&(_=0);let v=0,b=0,I=0;for(let x=0;x{f();(function(t,e,r){typeof cDe=="object"?$vr.exports=cDe=e(Es(),Tpe(),G1r(),j1r(),oL(),W1r(),sL(),gmt(),MNe(),X1r(),Amt(),tvr(),nvr(),ovr(),qNe(),cvr(),I5(),tp(),fvr(),hvr(),gvr(),yvr(),Cvr(),vvr(),Tvr(),Ivr(),wvr(),Pvr(),Nvr(),Mvr(),Bvr(),Fvr(),Qvr(),Gvr(),jvr()):typeof define=="function"&&define.amd?define(["./core","./x64-core","./lib-typedarrays","./enc-utf16","./enc-base64","./enc-base64url","./md5","./sha1","./sha256","./sha224","./sha512","./sha384","./sha3","./ripemd160","./hmac","./pbkdf2","./evpkdf","./cipher-core","./mode-cfb","./mode-ctr","./mode-ctr-gladman","./mode-ofb","./mode-ecb","./pad-ansix923","./pad-iso10126","./pad-iso97971","./pad-zeropadding","./pad-nopadding","./format-hex","./aes","./tripledes","./rc4","./rabbit","./rabbit-legacy","./blowfish"],e):t.CryptoJS=e(t.CryptoJS)})(cDe,function(t){return t})});var TZ=T(bg=>{"use strict";f();Object.defineProperty(bg,"__esModule",{value:!0});bg.stringArray=bg.array=bg.func=bg.error=bg.number=bg.string=bg.boolean=void 0;function bRi(t){return t===!0||t===!1}a(bRi,"boolean");bg.boolean=bRi;function LSr(t){return typeof t=="string"||t instanceof String}a(LSr,"string");bg.string=LSr;function TRi(t){return typeof t=="number"||t instanceof Number}a(TRi,"number");bg.number=TRi;function SRi(t){return t instanceof Error}a(SRi,"error");bg.error=SRi;function IRi(t){return typeof t=="function"}a(IRi,"func");bg.func=IRi;function FSr(t){return Array.isArray(t)}a(FSr,"array");bg.array=FSr;function xRi(t){return FSr(t)&&t.every(e=>LSr(e))}a(xRi,"stringArray");bg.stringArray=xRi});var Ygt=T(qn=>{"use strict";f();Object.defineProperty(qn,"__esModule",{value:!0});qn.Message=qn.NotificationType9=qn.NotificationType8=qn.NotificationType7=qn.NotificationType6=qn.NotificationType5=qn.NotificationType4=qn.NotificationType3=qn.NotificationType2=qn.NotificationType1=qn.NotificationType0=qn.NotificationType=qn.RequestType9=qn.RequestType8=qn.RequestType7=qn.RequestType6=qn.RequestType5=qn.RequestType4=qn.RequestType3=qn.RequestType2=qn.RequestType1=qn.RequestType=qn.RequestType0=qn.AbstractMessageSignature=qn.ParameterStructures=qn.ResponseError=qn.ErrorCodes=void 0;var Wq=TZ(),Sgt;(function(t){t.ParseError=-32700,t.InvalidRequest=-32600,t.MethodNotFound=-32601,t.InvalidParams=-32602,t.InternalError=-32603,t.jsonrpcReservedErrorRangeStart=-32099,t.serverErrorStart=-32099,t.MessageWriteError=-32099,t.MessageReadError=-32098,t.PendingResponseRejected=-32097,t.ConnectionInactive=-32096,t.ServerNotInitialized=-32002,t.UnknownErrorCode=-32001,t.jsonrpcReservedErrorRangeEnd=-32e3,t.serverErrorEnd=-32e3})(Sgt||(qn.ErrorCodes=Sgt={}));var Igt=class t extends Error{static{a(this,"ResponseError")}constructor(e,r,n){super(r),this.code=Wq.number(e)?e:Sgt.UnknownErrorCode,this.data=n,Object.setPrototypeOf(this,t.prototype)}toJson(){let e={code:this.code,message:this.message};return this.data!==void 0&&(e.data=this.data),e}};qn.ResponseError=Igt;var vE=class t{static{a(this,"ParameterStructures")}constructor(e){this.kind=e}static is(e){return e===t.auto||e===t.byName||e===t.byPosition}toString(){return this.kind}};qn.ParameterStructures=vE;vE.auto=new vE("auto");vE.byPosition=new vE("byPosition");vE.byName=new vE("byName");var Bl=class{static{a(this,"AbstractMessageSignature")}constructor(e,r){this.method=e,this.numberOfParams=r}get parameterStructures(){return vE.auto}};qn.AbstractMessageSignature=Bl;var xgt=class extends Bl{static{a(this,"RequestType0")}constructor(e){super(e,0)}};qn.RequestType0=xgt;var wgt=class extends Bl{static{a(this,"RequestType")}constructor(e,r=vE.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};qn.RequestType=wgt;var Rgt=class extends Bl{static{a(this,"RequestType1")}constructor(e,r=vE.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};qn.RequestType1=Rgt;var Pgt=class extends Bl{static{a(this,"RequestType2")}constructor(e){super(e,2)}};qn.RequestType2=Pgt;var kgt=class extends Bl{static{a(this,"RequestType3")}constructor(e){super(e,3)}};qn.RequestType3=kgt;var Ngt=class extends Bl{static{a(this,"RequestType4")}constructor(e){super(e,4)}};qn.RequestType4=Ngt;var Dgt=class extends Bl{static{a(this,"RequestType5")}constructor(e){super(e,5)}};qn.RequestType5=Dgt;var Mgt=class extends Bl{static{a(this,"RequestType6")}constructor(e){super(e,6)}};qn.RequestType6=Mgt;var Ogt=class extends Bl{static{a(this,"RequestType7")}constructor(e){super(e,7)}};qn.RequestType7=Ogt;var Bgt=class extends Bl{static{a(this,"RequestType8")}constructor(e){super(e,8)}};qn.RequestType8=Bgt;var Lgt=class extends Bl{static{a(this,"RequestType9")}constructor(e){super(e,9)}};qn.RequestType9=Lgt;var Fgt=class extends Bl{static{a(this,"NotificationType")}constructor(e,r=vE.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};qn.NotificationType=Fgt;var Ugt=class extends Bl{static{a(this,"NotificationType0")}constructor(e){super(e,0)}};qn.NotificationType0=Ugt;var Qgt=class extends Bl{static{a(this,"NotificationType1")}constructor(e,r=vE.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};qn.NotificationType1=Qgt;var qgt=class extends Bl{static{a(this,"NotificationType2")}constructor(e){super(e,2)}};qn.NotificationType2=qgt;var Ggt=class extends Bl{static{a(this,"NotificationType3")}constructor(e){super(e,3)}};qn.NotificationType3=Ggt;var Hgt=class extends Bl{static{a(this,"NotificationType4")}constructor(e){super(e,4)}};qn.NotificationType4=Hgt;var jgt=class extends Bl{static{a(this,"NotificationType5")}constructor(e){super(e,5)}};qn.NotificationType5=jgt;var $gt=class extends Bl{static{a(this,"NotificationType6")}constructor(e){super(e,6)}};qn.NotificationType6=$gt;var Vgt=class extends Bl{static{a(this,"NotificationType7")}constructor(e){super(e,7)}};qn.NotificationType7=Vgt;var Wgt=class extends Bl{static{a(this,"NotificationType8")}constructor(e){super(e,8)}};qn.NotificationType8=Wgt;var zgt=class extends Bl{static{a(this,"NotificationType9")}constructor(e){super(e,9)}};qn.NotificationType9=zgt;var USr;(function(t){function e(o){let s=o;return s&&Wq.string(s.method)&&(Wq.string(s.id)||Wq.number(s.id))}a(e,"isRequest"),t.isRequest=e;function r(o){let s=o;return s&&Wq.string(s.method)&&o.id===void 0}a(r,"isNotification"),t.isNotification=r;function n(o){let s=o;return s&&(s.result!==void 0||!!s.error)&&(Wq.string(s.id)||Wq.number(s.id)||s.id===null)}a(n,"isResponse"),t.isResponse=n})(USr||(qn.Message=USr={}))});var Jgt=T(vL=>{"use strict";f();var QSr;Object.defineProperty(vL,"__esModule",{value:!0});vL.LRUCache=vL.LinkedMap=vL.Touch=void 0;var Tg;(function(t){t.None=0,t.First=1,t.AsOld=t.First,t.Last=2,t.AsNew=t.Last})(Tg||(vL.Touch=Tg={}));var KDe=class{static{a(this,"LinkedMap")}constructor(){this[QSr]="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,r=Tg.None){let n=this._map.get(e);if(n)return r!==Tg.None&&this.touch(n,r),n.value}set(e,r,n=Tg.None){let o=this._map.get(e);if(o)o.value=r,n!==Tg.None&&this.touch(o,n);else{switch(o={key:e,value:r,next:void 0,previous:void 0},n){case Tg.None:this.addItemLast(o);break;case Tg.First:this.addItemFirst(o);break;case Tg.Last:this.addItemLast(o);break;default:this.addItemLast(o);break}this._map.set(e,o),this._size++}return this}delete(e){return!!this.remove(e)}remove(e){let r=this._map.get(e);if(r)return this._map.delete(e),this.removeItem(r),this._size--,r.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");let e=this._head;return this._map.delete(e.key),this.removeItem(e),this._size--,e.value}forEach(e,r){let n=this._state,o=this._head;for(;o;){if(r?e.bind(r)(o.value,o.key,this):e(o.value,o.key,this),this._state!==n)throw new Error("LinkedMap got modified during iteration.");o=o.next}}keys(){let e=this._state,r=this._head,n={[Symbol.iterator]:()=>n,next:a(()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(r){let o={value:r.key,done:!1};return r=r.next,o}else return{value:void 0,done:!0}},"next")};return n}values(){let e=this._state,r=this._head,n={[Symbol.iterator]:()=>n,next:a(()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(r){let o={value:r.value,done:!1};return r=r.next,o}else return{value:void 0,done:!0}},"next")};return n}entries(){let e=this._state,r=this._head,n={[Symbol.iterator]:()=>n,next:a(()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(r){let o={value:[r.key,r.value],done:!1};return r=r.next,o}else return{value:void 0,done:!0}},"next")};return n}[(QSr=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(e){if(e>=this.size)return;if(e===0){this.clear();return}let r=this._head,n=this.size;for(;r&&n>e;)this._map.delete(r.key),r=r.next,n--;this._head=r,this._size=n,r&&(r.previous=void 0),this._state++}addItemFirst(e){if(!this._head&&!this._tail)this._tail=e;else if(this._head)e.next=this._head,this._head.previous=e;else throw new Error("Invalid list");this._head=e,this._state++}addItemLast(e){if(!this._head&&!this._tail)this._head=e;else if(this._tail)e.previous=this._tail,this._tail.next=e;else throw new Error("Invalid list");this._tail=e,this._state++}removeItem(e){if(e===this._head&&e===this._tail)this._head=void 0,this._tail=void 0;else if(e===this._head){if(!e.next)throw new Error("Invalid list");e.next.previous=void 0,this._head=e.next}else if(e===this._tail){if(!e.previous)throw new Error("Invalid list");e.previous.next=void 0,this._tail=e.previous}else{let r=e.next,n=e.previous;if(!r||!n)throw new Error("Invalid list");r.previous=n,n.next=r}e.next=void 0,e.previous=void 0,this._state++}touch(e,r){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(r!==Tg.First&&r!==Tg.Last)){if(r===Tg.First){if(e===this._head)return;let n=e.next,o=e.previous;e===this._tail?(o.next=void 0,this._tail=o):(n.previous=o,o.next=n),e.previous=void 0,e.next=this._head,this._head.previous=e,this._head=e,this._state++}else if(r===Tg.Last){if(e===this._tail)return;let n=e.next,o=e.previous;e===this._head?(n.previous=void 0,this._head=n):(n.previous=o,o.next=n),e.next=void 0,e.previous=this._tail,this._tail.next=e,this._tail=e,this._state++}}}toJSON(){let e=[];return this.forEach((r,n)=>{e.push([n,r])}),e}fromJSON(e){this.clear();for(let[r,n]of e)this.set(r,n)}};vL.LinkedMap=KDe;var Kgt=class extends KDe{static{a(this,"LRUCache")}constructor(e,r=1){super(),this._limit=e,this._ratio=Math.min(Math.max(0,r),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,r=Tg.AsNew){return super.get(e,r)}peek(e){return super.get(e,Tg.None)}set(e,r){return super.set(e,r,Tg.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}};vL.LRUCache=Kgt});var GSr=T(JDe=>{"use strict";f();Object.defineProperty(JDe,"__esModule",{value:!0});JDe.Disposable=void 0;var qSr;(function(t){function e(r){return{dispose:r}}a(e,"create"),t.create=e})(qSr||(JDe.Disposable=qSr={}))});var bL=T(eAt=>{"use strict";f();Object.defineProperty(eAt,"__esModule",{value:!0});var Xgt;function Zgt(){if(Xgt===void 0)throw new Error("No runtime abstraction layer installed");return Xgt}a(Zgt,"RAL");(function(t){function e(r){if(r===void 0)throw new Error("No runtime abstraction layer provided");Xgt=r}a(e,"install"),t.install=e})(Zgt||(Zgt={}));eAt.default=Zgt});var IZ=T(SZ=>{"use strict";f();Object.defineProperty(SZ,"__esModule",{value:!0});SZ.Emitter=SZ.Event=void 0;var wRi=bL(),HSr;(function(t){let e={dispose(){}};t.None=function(){return e}})(HSr||(SZ.Event=HSr={}));var tAt=class{static{a(this,"CallbackList")}add(e,r=null,n){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(e),this._contexts.push(r),Array.isArray(n)&&n.push({dispose:a(()=>this.remove(e,r),"dispose")})}remove(e,r=null){if(!this._callbacks)return;let n=!1;for(let o=0,s=this._callbacks.length;o{this._callbacks||(this._callbacks=new tAt),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(e,r);let o={dispose:a(()=>{this._callbacks&&(this._callbacks.remove(e,r),o.dispose=t._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))},"dispose")};return Array.isArray(n)&&n.push(o),o}),this._event}fire(e){this._callbacks&&this._callbacks.invoke.call(this._callbacks,e)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}};SZ.Emitter=XDe;XDe._noop=function(){}});var t5e=T(xZ=>{"use strict";f();Object.defineProperty(xZ,"__esModule",{value:!0});xZ.CancellationTokenSource=xZ.CancellationToken=void 0;var RRi=bL(),PRi=TZ(),rAt=IZ(),ZDe;(function(t){t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:rAt.Event.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:rAt.Event.None});function e(r){let n=r;return n&&(n===t.None||n===t.Cancelled||PRi.boolean(n.isCancellationRequested)&&!!n.onCancellationRequested)}a(e,"is"),t.is=e})(ZDe||(xZ.CancellationToken=ZDe={}));var kRi=Object.freeze(function(t,e){let r=(0,RRi.default)().timer.setTimeout(t.bind(e),0);return{dispose(){r.dispose()}}}),e5e=class{static{a(this,"MutableToken")}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?kRi:(this._emitter||(this._emitter=new rAt.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}},nAt=class{static{a(this,"CancellationTokenSource")}get token(){return this._token||(this._token=new e5e),this._token}cancel(){this._token?this._token.cancel():this._token=ZDe.Cancelled}dispose(){this._token?this._token instanceof e5e&&this._token.dispose():this._token=ZDe.None}};xZ.CancellationTokenSource=nAt});var jSr=T(wZ=>{"use strict";f();Object.defineProperty(wZ,"__esModule",{value:!0});wZ.SharedArrayReceiverStrategy=wZ.SharedArraySenderStrategy=void 0;var NRi=t5e(),$pe;(function(t){t.Continue=0,t.Cancelled=1})($pe||($pe={}));var iAt=class{static{a(this,"SharedArraySenderStrategy")}constructor(){this.buffers=new Map}enableCancellation(e){if(e.id===null)return;let r=new SharedArrayBuffer(4),n=new Int32Array(r,0,1);n[0]=$pe.Continue,this.buffers.set(e.id,r),e.$cancellationData=r}async sendCancellation(e,r){let n=this.buffers.get(r);if(n===void 0)return;let o=new Int32Array(n,0,1);Atomics.store(o,0,$pe.Cancelled)}cleanup(e){this.buffers.delete(e)}dispose(){this.buffers.clear()}};wZ.SharedArraySenderStrategy=iAt;var oAt=class{static{a(this,"SharedArrayBufferCancellationToken")}constructor(e){this.data=new Int32Array(e,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===$pe.Cancelled}get onCancellationRequested(){throw new Error("Cancellation over SharedArrayBuffer doesn't support cancellation events")}},sAt=class{static{a(this,"SharedArrayBufferCancellationTokenSource")}constructor(e){this.token=new oAt(e)}cancel(){}dispose(){}},aAt=class{static{a(this,"SharedArrayReceiverStrategy")}constructor(){this.kind="request"}createCancellationTokenSource(e){let r=e.$cancellationData;return r===void 0?new NRi.CancellationTokenSource:new sAt(r)}};wZ.SharedArrayReceiverStrategy=aAt});var lAt=T(r5e=>{"use strict";f();Object.defineProperty(r5e,"__esModule",{value:!0});r5e.Semaphore=void 0;var DRi=bL(),cAt=class{static{a(this,"Semaphore")}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((r,n)=>{this._waiting.push({thunk:e,resolve:r,reject:n}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length===0||this._active===this._capacity||(0,DRi.default)().timer.setImmediate(()=>this.doRunNext())}doRunNext(){if(this._waiting.length===0||this._active===this._capacity)return;let e=this._waiting.shift();if(this._active++,this._active>this._capacity)throw new Error("To many thunks active");try{let r=e.thunk();r instanceof Promise?r.then(n=>{this._active--,e.resolve(n),this.runNext()},n=>{this._active--,e.reject(n),this.runNext()}):(this._active--,e.resolve(r),this.runNext())}catch(r){this._active--,e.reject(r),this.runNext()}}};r5e.Semaphore=cAt});var VSr=T(TL=>{"use strict";f();Object.defineProperty(TL,"__esModule",{value:!0});TL.ReadableStreamMessageReader=TL.AbstractMessageReader=TL.MessageReader=void 0;var dAt=bL(),RZ=TZ(),uAt=IZ(),MRi=lAt(),$Sr;(function(t){function e(r){let n=r;return n&&RZ.func(n.listen)&&RZ.func(n.dispose)&&RZ.func(n.onError)&&RZ.func(n.onClose)&&RZ.func(n.onPartialMessage)}a(e,"is"),t.is=e})($Sr||(TL.MessageReader=$Sr={}));var n5e=class{static{a(this,"AbstractMessageReader")}constructor(){this.errorEmitter=new uAt.Emitter,this.closeEmitter=new uAt.Emitter,this.partialMessageEmitter=new uAt.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: ${RZ.string(e.message)?e.message:"unknown"}`)}};TL.AbstractMessageReader=n5e;var fAt;(function(t){function e(r){let n,o,s,c=new Map,l,u=new Map;if(r===void 0||typeof r=="string")n=r??"utf-8";else{if(n=r.charset??"utf-8",r.contentDecoder!==void 0&&(s=r.contentDecoder,c.set(s.name,s)),r.contentDecoders!==void 0)for(let d of r.contentDecoders)c.set(d.name,d);if(r.contentTypeDecoder!==void 0&&(l=r.contentTypeDecoder,u.set(l.name,l)),r.contentTypeDecoders!==void 0)for(let d of r.contentTypeDecoders)u.set(d.name,d)}return l===void 0&&(l=(0,dAt.default)().applicationJson.decoder,u.set(l.name,l)),{charset:n,contentDecoder:s,contentDecoders:c,contentTypeDecoder:l,contentTypeDecoders:u}}a(e,"fromOptions"),t.fromOptions=e})(fAt||(fAt={}));var pAt=class extends n5e{static{a(this,"ReadableStreamMessageReader")}constructor(e,r){super(),this.readable=e,this.options=fAt.fromOptions(r),this.buffer=(0,dAt.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new MRi.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;let r=this.readable.onData(n=>{this.onData(n)});return this.readable.onError(n=>this.fireError(n)),this.readable.onClose(()=>this.fireClose()),r}onData(e){try{for(this.buffer.append(e);;){if(this.nextMessageLength===-1){let n=this.buffer.tryReadHeaders(!0);if(!n)return;let o=n.get("content-length");if(!o){this.fireError(new Error(`Header must provide a Content-Length property.
-${JSON.stringify(Object.fromEntries(n))}`));return}let s=parseInt(o);if(isNaN(s)){this.fireError(new Error(`Content-Length value must be a number. Got ${o}`));return}this.nextMessageLength=s}let r=this.buffer.tryReadBody(this.nextMessageLength);if(r===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock(async()=>{let n=this.options.contentDecoder!==void 0?await this.options.contentDecoder.decode(r):r,o=await this.options.contentTypeDecoder.decode(n,this.options);this.callback(o)}).catch(n=>{this.fireError(n)})}}catch(r){this.fireError(r)}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=(0,dAt.default)().timer.setTimeout((e,r)=>{this.partialMessageTimer=void 0,e===this.messageToken&&(this.firePartialMessage({messageToken:e,waitingTime:r}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}};TL.ReadableStreamMessageReader=pAt});var JSr=T(SL=>{"use strict";f();Object.defineProperty(SL,"__esModule",{value:!0});SL.WriteableStreamMessageWriter=SL.AbstractMessageWriter=SL.MessageWriter=void 0;var WSr=bL(),Vpe=TZ(),ORi=lAt(),zSr=IZ(),BRi="Content-Length: ",YSr=`\r
-`,KSr;(function(t){function e(r){let n=r;return n&&Vpe.func(n.dispose)&&Vpe.func(n.onClose)&&Vpe.func(n.onError)&&Vpe.func(n.write)}a(e,"is"),t.is=e})(KSr||(SL.MessageWriter=KSr={}));var i5e=class{static{a(this,"AbstractMessageWriter")}constructor(){this.errorEmitter=new zSr.Emitter,this.closeEmitter=new zSr.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e,r,n){this.errorEmitter.fire([this.asError(e),r,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: ${Vpe.string(e.message)?e.message:"unknown"}`)}};SL.AbstractMessageWriter=i5e;var hAt;(function(t){function e(r){return r===void 0||typeof r=="string"?{charset:r??"utf-8",contentTypeEncoder:(0,WSr.default)().applicationJson.encoder}:{charset:r.charset??"utf-8",contentEncoder:r.contentEncoder,contentTypeEncoder:r.contentTypeEncoder??(0,WSr.default)().applicationJson.encoder}}a(e,"fromOptions"),t.fromOptions=e})(hAt||(hAt={}));var mAt=class extends i5e{static{a(this,"WriteableStreamMessageWriter")}constructor(e,r){super(),this.writable=e,this.options=hAt.fromOptions(r),this.errorCount=0,this.writeSemaphore=new ORi.Semaphore(1),this.writable.onError(n=>this.fireError(n)),this.writable.onClose(()=>this.fireClose())}async write(e){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(e,this.options).then(n=>this.options.contentEncoder!==void 0?this.options.contentEncoder.encode(n):n).then(n=>{let o=[];return o.push(BRi,n.byteLength.toString(),YSr),o.push(YSr),this.doWrite(e,o,n)},n=>{throw this.fireError(n),n}))}async doWrite(e,r,n){try{return await this.writable.write(r.join(""),"ascii"),this.writable.write(n)}catch(o){return this.handleError(o,e),Promise.reject(o)}}handleError(e,r){this.errorCount++,this.fireError(e,r,this.errorCount)}end(){this.writable.end()}};SL.WriteableStreamMessageWriter=mAt});var XSr=T(o5e=>{"use strict";f();Object.defineProperty(o5e,"__esModule",{value:!0});o5e.AbstractMessageBuffer=void 0;var LRi=13,FRi=10,URi=`\r
-`,gAt=class{static{a(this,"AbstractMessageBuffer")}constructor(e="utf-8"){this._encoding=e,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(e){let r=typeof e=="string"?this.fromString(e,this._encoding):e;this._chunks.push(r),this._totalLength+=r.byteLength}tryReadHeaders(e=!1){if(this._chunks.length===0)return;let r=0,n=0,o=0,s=0;e:for(;n{f();(function(t,e,r){typeof Hke=="object"?Dvr.exports=Hke=e(ms(),K0()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Hke,function(t){return t.mode.CTR=(function(){var e=t.lib.BlockCipherMode.extend(),r=e.Encryptor=e.extend({processBlock:a(function(n,o){var s=this._cipher,c=s.blockSize,l=this._iv,u=this._counter;l&&(u=this._counter=l.slice(0),this._iv=void 0);var d=u.slice(0);s.encryptBlock(d,0),u[c-1]=u[c-1]+1|0;for(var p=0;p1;--I)_=_^A.pbox[I],v=d(A,_)^v,b=_,_=v,v=b;return b=_,_=v,v=b,v=v^A.pbox[1],_=_^A.pbox[0],{left:_,right:v}}a(h,"BlowFish_Decrypt");function m(A,y,E){for(let x=0;x<4;x++){A.sbox[x]=[];for(let w=0;w<256;w++)A.sbox[x][w]=l[x][w]}let _=0;for(let x=0;x=E&&(_=0);let v=0,b=0,I=0;for(let x=0;x{f();(function(t,e,r){typeof o5e=="object"?ubr.exports=o5e=e(ms(),F0e(),avr(),lvr(),q3(),fvr(),G3(),Tht(),kke(),Avr(),Sht(),_vr(),vvr(),Tvr(),Fke(),xvr(),hN(),K0(),kvr(),Nvr(),Ovr(),Lvr(),Uvr(),qvr(),Hvr(),$vr(),Wvr(),Yvr(),Jvr(),Zvr(),tbr(),nbr(),obr(),abr(),lbr()):typeof define=="function"&&define.amd?define(["./core","./x64-core","./lib-typedarrays","./enc-utf16","./enc-base64","./enc-base64url","./md5","./sha1","./sha256","./sha224","./sha512","./sha384","./sha3","./ripemd160","./hmac","./pbkdf2","./evpkdf","./cipher-core","./mode-cfb","./mode-ctr","./mode-ctr-gladman","./mode-ofb","./mode-ecb","./pad-ansix923","./pad-iso10126","./pad-iso97971","./pad-zeropadding","./pad-nopadding","./format-hex","./aes","./tripledes","./rc4","./rabbit","./rabbit-legacy","./blowfish"],e):t.CryptoJS=e(t.CryptoJS)})(o5e,function(t){return t})});var kX=T(pg=>{"use strict";f();Object.defineProperty(pg,"__esModule",{value:!0});pg.stringArray=pg.array=pg.func=pg.error=pg.number=pg.string=pg.boolean=void 0;function b2i(t){return t===!0||t===!1}a(b2i,"boolean");pg.boolean=b2i;function rIr(t){return typeof t=="string"||t instanceof String}a(rIr,"string");pg.string=rIr;function T2i(t){return typeof t=="number"||t instanceof Number}a(T2i,"number");pg.number=T2i;function S2i(t){return t instanceof Error}a(S2i,"error");pg.error=S2i;function I2i(t){return typeof t=="function"}a(I2i,"func");pg.func=I2i;function nIr(t){return Array.isArray(t)}a(nIr,"array");pg.array=nIr;function x2i(t){return nIr(t)&&t.every(e=>rIr(e))}a(x2i,"stringArray");pg.stringArray=x2i});var ngt=T(qn=>{"use strict";f();Object.defineProperty(qn,"__esModule",{value:!0});qn.Message=qn.NotificationType9=qn.NotificationType8=qn.NotificationType7=qn.NotificationType6=qn.NotificationType5=qn.NotificationType4=qn.NotificationType3=qn.NotificationType2=qn.NotificationType1=qn.NotificationType0=qn.NotificationType=qn.RequestType9=qn.RequestType8=qn.RequestType7=qn.RequestType6=qn.RequestType5=qn.RequestType4=qn.RequestType3=qn.RequestType2=qn.RequestType1=qn.RequestType=qn.RequestType0=qn.AbstractMessageSignature=qn.ParameterStructures=qn.ResponseError=qn.ErrorCodes=void 0;var _q=kX(),Nmt;(function(t){t.ParseError=-32700,t.InvalidRequest=-32600,t.MethodNotFound=-32601,t.InvalidParams=-32602,t.InternalError=-32603,t.jsonrpcReservedErrorRangeStart=-32099,t.serverErrorStart=-32099,t.MessageWriteError=-32099,t.MessageReadError=-32098,t.PendingResponseRejected=-32097,t.ConnectionInactive=-32096,t.ServerNotInitialized=-32002,t.UnknownErrorCode=-32001,t.jsonrpcReservedErrorRangeEnd=-32e3,t.serverErrorEnd=-32e3})(Nmt||(qn.ErrorCodes=Nmt={}));var Mmt=class t extends Error{static{a(this,"ResponseError")}constructor(e,r,n){super(r),this.code=_q.number(e)?e:Nmt.UnknownErrorCode,this.data=n,Object.setPrototypeOf(this,t.prototype)}toJson(){let e={code:this.code,message:this.message};return this.data!==void 0&&(e.data=this.data),e}};qn.ResponseError=Mmt;var pE=class t{static{a(this,"ParameterStructures")}constructor(e){this.kind=e}static is(e){return e===t.auto||e===t.byName||e===t.byPosition}toString(){return this.kind}};qn.ParameterStructures=pE;pE.auto=new pE("auto");pE.byPosition=new pE("byPosition");pE.byName=new pE("byName");var Rl=class{static{a(this,"AbstractMessageSignature")}constructor(e,r){this.method=e,this.numberOfParams=r}get parameterStructures(){return pE.auto}};qn.AbstractMessageSignature=Rl;var Omt=class extends Rl{static{a(this,"RequestType0")}constructor(e){super(e,0)}};qn.RequestType0=Omt;var Bmt=class extends Rl{static{a(this,"RequestType")}constructor(e,r=pE.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};qn.RequestType=Bmt;var Lmt=class extends Rl{static{a(this,"RequestType1")}constructor(e,r=pE.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};qn.RequestType1=Lmt;var Fmt=class extends Rl{static{a(this,"RequestType2")}constructor(e){super(e,2)}};qn.RequestType2=Fmt;var Umt=class extends Rl{static{a(this,"RequestType3")}constructor(e){super(e,3)}};qn.RequestType3=Umt;var Qmt=class extends Rl{static{a(this,"RequestType4")}constructor(e){super(e,4)}};qn.RequestType4=Qmt;var qmt=class extends Rl{static{a(this,"RequestType5")}constructor(e){super(e,5)}};qn.RequestType5=qmt;var Gmt=class extends Rl{static{a(this,"RequestType6")}constructor(e){super(e,6)}};qn.RequestType6=Gmt;var Hmt=class extends Rl{static{a(this,"RequestType7")}constructor(e){super(e,7)}};qn.RequestType7=Hmt;var jmt=class extends Rl{static{a(this,"RequestType8")}constructor(e){super(e,8)}};qn.RequestType8=jmt;var $mt=class extends Rl{static{a(this,"RequestType9")}constructor(e){super(e,9)}};qn.RequestType9=$mt;var Vmt=class extends Rl{static{a(this,"NotificationType")}constructor(e,r=pE.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};qn.NotificationType=Vmt;var Wmt=class extends Rl{static{a(this,"NotificationType0")}constructor(e){super(e,0)}};qn.NotificationType0=Wmt;var zmt=class extends Rl{static{a(this,"NotificationType1")}constructor(e,r=pE.auto){super(e,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};qn.NotificationType1=zmt;var Ymt=class extends Rl{static{a(this,"NotificationType2")}constructor(e){super(e,2)}};qn.NotificationType2=Ymt;var Kmt=class extends Rl{static{a(this,"NotificationType3")}constructor(e){super(e,3)}};qn.NotificationType3=Kmt;var Jmt=class extends Rl{static{a(this,"NotificationType4")}constructor(e){super(e,4)}};qn.NotificationType4=Jmt;var Xmt=class extends Rl{static{a(this,"NotificationType5")}constructor(e){super(e,5)}};qn.NotificationType5=Xmt;var Zmt=class extends Rl{static{a(this,"NotificationType6")}constructor(e){super(e,6)}};qn.NotificationType6=Zmt;var egt=class extends Rl{static{a(this,"NotificationType7")}constructor(e){super(e,7)}};qn.NotificationType7=egt;var tgt=class extends Rl{static{a(this,"NotificationType8")}constructor(e){super(e,8)}};qn.NotificationType8=tgt;var rgt=class extends Rl{static{a(this,"NotificationType9")}constructor(e){super(e,9)}};qn.NotificationType9=rgt;var iIr;(function(t){function e(o){let s=o;return s&&_q.string(s.method)&&(_q.string(s.id)||_q.number(s.id))}a(e,"isRequest"),t.isRequest=e;function r(o){let s=o;return s&&_q.string(s.method)&&o.id===void 0}a(r,"isNotification"),t.isNotification=r;function n(o){let s=o;return s&&(s.result!==void 0||!!s.error)&&(_q.string(s.id)||_q.number(s.id)||s.id===null)}a(n,"isResponse"),t.isResponse=n})(iIr||(qn.Message=iIr={}))});var ogt=T(iL=>{"use strict";f();var oIr;Object.defineProperty(iL,"__esModule",{value:!0});iL.LRUCache=iL.LinkedMap=iL.Touch=void 0;var hg;(function(t){t.None=0,t.First=1,t.AsOld=t.First,t.Last=2,t.AsNew=t.Last})(hg||(iL.Touch=hg={}));var W5e=class{static{a(this,"LinkedMap")}constructor(){this[oIr]="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,r=hg.None){let n=this._map.get(e);if(n)return r!==hg.None&&this.touch(n,r),n.value}set(e,r,n=hg.None){let o=this._map.get(e);if(o)o.value=r,n!==hg.None&&this.touch(o,n);else{switch(o={key:e,value:r,next:void 0,previous:void 0},n){case hg.None:this.addItemLast(o);break;case hg.First:this.addItemFirst(o);break;case hg.Last:this.addItemLast(o);break;default:this.addItemLast(o);break}this._map.set(e,o),this._size++}return this}delete(e){return!!this.remove(e)}remove(e){let r=this._map.get(e);if(r)return this._map.delete(e),this.removeItem(r),this._size--,r.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");let e=this._head;return this._map.delete(e.key),this.removeItem(e),this._size--,e.value}forEach(e,r){let n=this._state,o=this._head;for(;o;){if(r?e.bind(r)(o.value,o.key,this):e(o.value,o.key,this),this._state!==n)throw new Error("LinkedMap got modified during iteration.");o=o.next}}keys(){let e=this._state,r=this._head,n={[Symbol.iterator]:()=>n,next:a(()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(r){let o={value:r.key,done:!1};return r=r.next,o}else return{value:void 0,done:!0}},"next")};return n}values(){let e=this._state,r=this._head,n={[Symbol.iterator]:()=>n,next:a(()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(r){let o={value:r.value,done:!1};return r=r.next,o}else return{value:void 0,done:!0}},"next")};return n}entries(){let e=this._state,r=this._head,n={[Symbol.iterator]:()=>n,next:a(()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(r){let o={value:[r.key,r.value],done:!1};return r=r.next,o}else return{value:void 0,done:!0}},"next")};return n}[(oIr=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(e){if(e>=this.size)return;if(e===0){this.clear();return}let r=this._head,n=this.size;for(;r&&n>e;)this._map.delete(r.key),r=r.next,n--;this._head=r,this._size=n,r&&(r.previous=void 0),this._state++}addItemFirst(e){if(!this._head&&!this._tail)this._tail=e;else if(this._head)e.next=this._head,this._head.previous=e;else throw new Error("Invalid list");this._head=e,this._state++}addItemLast(e){if(!this._head&&!this._tail)this._head=e;else if(this._tail)e.previous=this._tail,this._tail.next=e;else throw new Error("Invalid list");this._tail=e,this._state++}removeItem(e){if(e===this._head&&e===this._tail)this._head=void 0,this._tail=void 0;else if(e===this._head){if(!e.next)throw new Error("Invalid list");e.next.previous=void 0,this._head=e.next}else if(e===this._tail){if(!e.previous)throw new Error("Invalid list");e.previous.next=void 0,this._tail=e.previous}else{let r=e.next,n=e.previous;if(!r||!n)throw new Error("Invalid list");r.previous=n,n.next=r}e.next=void 0,e.previous=void 0,this._state++}touch(e,r){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(r!==hg.First&&r!==hg.Last)){if(r===hg.First){if(e===this._head)return;let n=e.next,o=e.previous;e===this._tail?(o.next=void 0,this._tail=o):(n.previous=o,o.next=n),e.previous=void 0,e.next=this._head,this._head.previous=e,this._head=e,this._state++}else if(r===hg.Last){if(e===this._tail)return;let n=e.next,o=e.previous;e===this._head?(n.previous=void 0,this._head=n):(n.previous=o,o.next=n),e.next=void 0,e.previous=this._tail,this._tail.next=e,this._tail=e,this._state++}}}toJSON(){let e=[];return this.forEach((r,n)=>{e.push([n,r])}),e}fromJSON(e){this.clear();for(let[r,n]of e)this.set(r,n)}};iL.LinkedMap=W5e;var igt=class extends W5e{static{a(this,"LRUCache")}constructor(e,r=1){super(),this._limit=e,this._ratio=Math.min(Math.max(0,r),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,r=hg.AsNew){return super.get(e,r)}peek(e){return super.get(e,hg.None)}set(e,r){return super.set(e,r,hg.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}};iL.LRUCache=igt});var aIr=T(z5e=>{"use strict";f();Object.defineProperty(z5e,"__esModule",{value:!0});z5e.Disposable=void 0;var sIr;(function(t){function e(r){return{dispose:r}}a(e,"create"),t.create=e})(sIr||(z5e.Disposable=sIr={}))});var oL=T(cgt=>{"use strict";f();Object.defineProperty(cgt,"__esModule",{value:!0});var sgt;function agt(){if(sgt===void 0)throw new Error("No runtime abstraction layer installed");return sgt}a(agt,"RAL");(function(t){function e(r){if(r===void 0)throw new Error("No runtime abstraction layer provided");sgt=r}a(e,"install"),t.install=e})(agt||(agt={}));cgt.default=agt});var NX=T(DX=>{"use strict";f();Object.defineProperty(DX,"__esModule",{value:!0});DX.Emitter=DX.Event=void 0;var w2i=oL(),cIr;(function(t){let e={dispose(){}};t.None=function(){return e}})(cIr||(DX.Event=cIr={}));var lgt=class{static{a(this,"CallbackList")}add(e,r=null,n){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(e),this._contexts.push(r),Array.isArray(n)&&n.push({dispose:a(()=>this.remove(e,r),"dispose")})}remove(e,r=null){if(!this._callbacks)return;let n=!1;for(let o=0,s=this._callbacks.length;o{this._callbacks||(this._callbacks=new lgt),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(e,r);let o={dispose:a(()=>{this._callbacks&&(this._callbacks.remove(e,r),o.dispose=t._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))},"dispose")};return Array.isArray(n)&&n.push(o),o}),this._event}fire(e){this._callbacks&&this._callbacks.invoke.call(this._callbacks,e)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}};DX.Emitter=Y5e;Y5e._noop=function(){}});var X5e=T(MX=>{"use strict";f();Object.defineProperty(MX,"__esModule",{value:!0});MX.CancellationTokenSource=MX.CancellationToken=void 0;var R2i=oL(),P2i=kX(),ugt=NX(),K5e;(function(t){t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:ugt.Event.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:ugt.Event.None});function e(r){let n=r;return n&&(n===t.None||n===t.Cancelled||P2i.boolean(n.isCancellationRequested)&&!!n.onCancellationRequested)}a(e,"is"),t.is=e})(K5e||(MX.CancellationToken=K5e={}));var k2i=Object.freeze(function(t,e){let r=(0,R2i.default)().timer.setTimeout(t.bind(e),0);return{dispose(){r.dispose()}}}),J5e=class{static{a(this,"MutableToken")}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?k2i:(this._emitter||(this._emitter=new ugt.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}},dgt=class{static{a(this,"CancellationTokenSource")}get token(){return this._token||(this._token=new J5e),this._token}cancel(){this._token?this._token.cancel():this._token=K5e.Cancelled}dispose(){this._token?this._token instanceof J5e&&this._token.dispose():this._token=K5e.None}};MX.CancellationTokenSource=dgt});var lIr=T(OX=>{"use strict";f();Object.defineProperty(OX,"__esModule",{value:!0});OX.SharedArrayReceiverStrategy=OX.SharedArraySenderStrategy=void 0;var D2i=X5e(),ope;(function(t){t.Continue=0,t.Cancelled=1})(ope||(ope={}));var fgt=class{static{a(this,"SharedArraySenderStrategy")}constructor(){this.buffers=new Map}enableCancellation(e){if(e.id===null)return;let r=new SharedArrayBuffer(4),n=new Int32Array(r,0,1);n[0]=ope.Continue,this.buffers.set(e.id,r),e.$cancellationData=r}async sendCancellation(e,r){let n=this.buffers.get(r);if(n===void 0)return;let o=new Int32Array(n,0,1);Atomics.store(o,0,ope.Cancelled)}cleanup(e){this.buffers.delete(e)}dispose(){this.buffers.clear()}};OX.SharedArraySenderStrategy=fgt;var pgt=class{static{a(this,"SharedArrayBufferCancellationToken")}constructor(e){this.data=new Int32Array(e,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===ope.Cancelled}get onCancellationRequested(){throw new Error("Cancellation over SharedArrayBuffer doesn't support cancellation events")}},hgt=class{static{a(this,"SharedArrayBufferCancellationTokenSource")}constructor(e){this.token=new pgt(e)}cancel(){}dispose(){}},mgt=class{static{a(this,"SharedArrayReceiverStrategy")}constructor(){this.kind="request"}createCancellationTokenSource(e){let r=e.$cancellationData;return r===void 0?new D2i.CancellationTokenSource:new hgt(r)}};OX.SharedArrayReceiverStrategy=mgt});var Agt=T(Z5e=>{"use strict";f();Object.defineProperty(Z5e,"__esModule",{value:!0});Z5e.Semaphore=void 0;var N2i=oL(),ggt=class{static{a(this,"Semaphore")}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((r,n)=>{this._waiting.push({thunk:e,resolve:r,reject:n}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length===0||this._active===this._capacity||(0,N2i.default)().timer.setImmediate(()=>this.doRunNext())}doRunNext(){if(this._waiting.length===0||this._active===this._capacity)return;let e=this._waiting.shift();if(this._active++,this._active>this._capacity)throw new Error("To many thunks active");try{let r=e.thunk();r instanceof Promise?r.then(n=>{this._active--,e.resolve(n),this.runNext()},n=>{this._active--,e.reject(n),this.runNext()}):(this._active--,e.resolve(r),this.runNext())}catch(r){this._active--,e.reject(r),this.runNext()}}};Z5e.Semaphore=ggt});var dIr=T(sL=>{"use strict";f();Object.defineProperty(sL,"__esModule",{value:!0});sL.ReadableStreamMessageReader=sL.AbstractMessageReader=sL.MessageReader=void 0;var Egt=oL(),BX=kX(),ygt=NX(),M2i=Agt(),uIr;(function(t){function e(r){let n=r;return n&&BX.func(n.listen)&&BX.func(n.dispose)&&BX.func(n.onError)&&BX.func(n.onClose)&&BX.func(n.onPartialMessage)}a(e,"is"),t.is=e})(uIr||(sL.MessageReader=uIr={}));var eDe=class{static{a(this,"AbstractMessageReader")}constructor(){this.errorEmitter=new ygt.Emitter,this.closeEmitter=new ygt.Emitter,this.partialMessageEmitter=new ygt.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: ${BX.string(e.message)?e.message:"unknown"}`)}};sL.AbstractMessageReader=eDe;var _gt;(function(t){function e(r){let n,o,s,c=new Map,l,u=new Map;if(r===void 0||typeof r=="string")n=r??"utf-8";else{if(n=r.charset??"utf-8",r.contentDecoder!==void 0&&(s=r.contentDecoder,c.set(s.name,s)),r.contentDecoders!==void 0)for(let d of r.contentDecoders)c.set(d.name,d);if(r.contentTypeDecoder!==void 0&&(l=r.contentTypeDecoder,u.set(l.name,l)),r.contentTypeDecoders!==void 0)for(let d of r.contentTypeDecoders)u.set(d.name,d)}return l===void 0&&(l=(0,Egt.default)().applicationJson.decoder,u.set(l.name,l)),{charset:n,contentDecoder:s,contentDecoders:c,contentTypeDecoder:l,contentTypeDecoders:u}}a(e,"fromOptions"),t.fromOptions=e})(_gt||(_gt={}));var Cgt=class extends eDe{static{a(this,"ReadableStreamMessageReader")}constructor(e,r){super(),this.readable=e,this.options=_gt.fromOptions(r),this.buffer=(0,Egt.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new M2i.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;let r=this.readable.onData(n=>{this.onData(n)});return this.readable.onError(n=>this.fireError(n)),this.readable.onClose(()=>this.fireClose()),r}onData(e){try{for(this.buffer.append(e);;){if(this.nextMessageLength===-1){let n=this.buffer.tryReadHeaders(!0);if(!n)return;let o=n.get("content-length");if(!o){this.fireError(new Error(`Header must provide a Content-Length property.
+${JSON.stringify(Object.fromEntries(n))}`));return}let s=parseInt(o);if(isNaN(s)){this.fireError(new Error(`Content-Length value must be a number. Got ${o}`));return}this.nextMessageLength=s}let r=this.buffer.tryReadBody(this.nextMessageLength);if(r===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock(async()=>{let n=this.options.contentDecoder!==void 0?await this.options.contentDecoder.decode(r):r,o=await this.options.contentTypeDecoder.decode(n,this.options);this.callback(o)}).catch(n=>{this.fireError(n)})}}catch(r){this.fireError(r)}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=(0,Egt.default)().timer.setTimeout((e,r)=>{this.partialMessageTimer=void 0,e===this.messageToken&&(this.firePartialMessage({messageToken:e,waitingTime:r}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}};sL.ReadableStreamMessageReader=Cgt});var gIr=T(aL=>{"use strict";f();Object.defineProperty(aL,"__esModule",{value:!0});aL.WriteableStreamMessageWriter=aL.AbstractMessageWriter=aL.MessageWriter=void 0;var fIr=oL(),spe=kX(),O2i=Agt(),pIr=NX(),B2i="Content-Length: ",hIr=`\r
+`,mIr;(function(t){function e(r){let n=r;return n&&spe.func(n.dispose)&&spe.func(n.onClose)&&spe.func(n.onError)&&spe.func(n.write)}a(e,"is"),t.is=e})(mIr||(aL.MessageWriter=mIr={}));var tDe=class{static{a(this,"AbstractMessageWriter")}constructor(){this.errorEmitter=new pIr.Emitter,this.closeEmitter=new pIr.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e,r,n){this.errorEmitter.fire([this.asError(e),r,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: ${spe.string(e.message)?e.message:"unknown"}`)}};aL.AbstractMessageWriter=tDe;var vgt;(function(t){function e(r){return r===void 0||typeof r=="string"?{charset:r??"utf-8",contentTypeEncoder:(0,fIr.default)().applicationJson.encoder}:{charset:r.charset??"utf-8",contentEncoder:r.contentEncoder,contentTypeEncoder:r.contentTypeEncoder??(0,fIr.default)().applicationJson.encoder}}a(e,"fromOptions"),t.fromOptions=e})(vgt||(vgt={}));var bgt=class extends tDe{static{a(this,"WriteableStreamMessageWriter")}constructor(e,r){super(),this.writable=e,this.options=vgt.fromOptions(r),this.errorCount=0,this.writeSemaphore=new O2i.Semaphore(1),this.writable.onError(n=>this.fireError(n)),this.writable.onClose(()=>this.fireClose())}async write(e){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(e,this.options).then(n=>this.options.contentEncoder!==void 0?this.options.contentEncoder.encode(n):n).then(n=>{let o=[];return o.push(B2i,n.byteLength.toString(),hIr),o.push(hIr),this.doWrite(e,o,n)},n=>{throw this.fireError(n),n}))}async doWrite(e,r,n){try{return await this.writable.write(r.join(""),"ascii"),this.writable.write(n)}catch(o){return this.handleError(o,e),Promise.reject(o)}}handleError(e,r){this.errorCount++,this.fireError(e,r,this.errorCount)}end(){this.writable.end()}};aL.WriteableStreamMessageWriter=bgt});var AIr=T(rDe=>{"use strict";f();Object.defineProperty(rDe,"__esModule",{value:!0});rDe.AbstractMessageBuffer=void 0;var L2i=13,F2i=10,U2i=`\r
+`,Tgt=class{static{a(this,"AbstractMessageBuffer")}constructor(e="utf-8"){this._encoding=e,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(e){let r=typeof e=="string"?this.fromString(e,this._encoding):e;this._chunks.push(r),this._totalLength+=r.byteLength}tryReadHeaders(e=!1){if(this._chunks.length===0)return;let r=0,n=0,o=0,s=0;e:for(;n