factoriomod-debug 2.0.6 → 2.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/{chunk-M5LZ6CNU.js → chunk-USWMQ2GW.js} +43 -41
- package/dist/fmtk-cli.js +61 -61
- package/dist/fmtk-vscode.js +16 -16
- package/package.json +42 -36
package/dist/fmtk-vscode.js
CHANGED
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
import {createRequire} from 'module'
|
|
3
3
|
const require = createRequire(import.meta.url)
|
|
4
4
|
|
|
5
|
-
import{E as qa,F as Ia,H as cn,I as Pr,J as Rr,K as Ea,L as Ma,b as Yn,g as ft,h as Pe,i as an,j as Tr,k as L,l as Fa,n as kr,o as Od,p as Ad,q as Ld}from"./chunk-M5LZ6CNU.js";import{a as I,c as F,e as br}from"./chunk-ZLQDNPPN.js";var La=F((bp,Aa)=>{"use strict";function St(s,e){var t,n;if(typeof e=="function")n=e(s),n!==void 0&&(s=n);else if(Array.isArray(e))for(t=0;t<e.length;t++)n=e[t](s),n!==void 0&&(s=n);return s}function Ud(s,e){return s[0]==="-"&&Array.isArray(e)&&/^-\d+$/.test(s)?e.length+parseInt(s,10):s}function Nd(s){return/^\d+$/.test(s)}function Zn(s){return Object.prototype.toString.call(s)==="[object Object]"}function dn(s){return Object(s)===s}function ei(s){return Object.keys(s).length===0}var Kd=["__proto__","prototype","constructor"],Hd=function(s){return Kd.indexOf(s)===-1};function ti(s,e){s.indexOf("[")>=0&&(s=s.replace(/\[/g,e).replace(/]/g,""));var t=s.split(e),n=t.filter(Hd);if(n.length!==t.length)throw Error("Refusing to update blacklisted property "+s);return t}var Oa=Object.prototype.hasOwnProperty;function $(s,e,t,n){if(!(this instanceof $))return new $(s,e,t,n);typeof e>"u"&&(e=!1),typeof t>"u"&&(t=!0),typeof n>"u"&&(n=!0),this.separator=s||".",this.override=e,this.useArray=t,this.useBrackets=n,this.keepArray=!1,this.cleanup=[]}var Ut=new $(".",!1,!0,!0);function Ke(s){return function(){return Ut[s].apply(Ut,arguments)}}$.prototype._fill=function(s,e,t,n){var i=s.shift();if(s.length>0){if(e[i]=e[i]||(this.useArray&&Nd(s[0])?[]:{}),!dn(e[i]))if(this.override)e[i]={};else{if(!(dn(t)&&ei(t)))throw new Error("Trying to redefine `"+i+"` which is a "+typeof e[i]);return}this._fill(s,e[i],t,n)}else{if(!this.override&&dn(e[i])&&!ei(e[i])){if(!(dn(t)&&ei(t)))throw new Error("Trying to redefine non-empty obj['"+i+"']");return}e[i]=St(t,n)}};$.prototype.object=function(s,e){var t=this;return Object.keys(s).forEach(function(n){var i=e===void 0?null:e[n],r=ti(n,t.separator).join(t.separator);r.indexOf(t.separator)!==-1?(t._fill(r.split(t.separator),s,s[n],i),delete s[n]):s[n]=St(s[n],i)}),s};$.prototype.str=function(s,e,t,n){var i=ti(s,this.separator).join(this.separator);return s.indexOf(this.separator)!==-1?this._fill(i.split(this.separator),t,e,n):t[s]=St(e,n),t};$.prototype.pick=function(s,e,t,n){var i,r,o,c,d;for(r=ti(s,this.separator),i=0;i<r.length;i++)if(c=Ud(r[i],e),e&&typeof e=="object"&&c in e){if(i===r.length-1)return t?(o=e[c],n&&Array.isArray(e)?e.splice(c,1):delete e[c],Array.isArray(e)&&(d=r.slice(0,-1).join("."),this.cleanup.indexOf(d)===-1&&this.cleanup.push(d)),o):e[c];e=e[c]}else return;return t&&Array.isArray(e)&&(e=e.filter(function(l){return l!==void 0})),e};$.prototype.delete=function(s,e){return this.remove(s,e,!0)};$.prototype.remove=function(s,e,t){var n;if(this.cleanup=[],Array.isArray(s)){for(n=0;n<s.length;n++)this.pick(s[n],e,!0,t);return t||this._cleanup(e),e}else return this.pick(s,e,!0,t)};$.prototype._cleanup=function(s){var e,t,n,i;if(this.cleanup.length){for(t=0;t<this.cleanup.length;t++)n=this.cleanup[t].split("."),i=n.splice(0,-1).join("."),e=i?this.pick(i,s):s,e=e[n[0]].filter(function(r){return r!==void 0}),this.set(this.cleanup[t],e,s);this.cleanup=[]}};$.prototype.del=$.prototype.remove;$.prototype.move=function(s,e,t,n,i){return typeof n=="function"||Array.isArray(n)?this.set(e,St(this.pick(s,t,!0),n),t,i):(i=n,this.set(e,this.pick(s,t,!0),t,i)),t};$.prototype.transfer=function(s,e,t,n,i,r){return typeof i=="function"||Array.isArray(i)?this.set(e,St(this.pick(s,t,!0),i),n,r):(r=i,this.set(e,this.pick(s,t,!0),n,r)),n};$.prototype.copy=function(s,e,t,n,i,r){return typeof i=="function"||Array.isArray(i)?this.set(e,St(JSON.parse(JSON.stringify(this.pick(s,t,!1))),i),n,r):(r=i,this.set(e,this.pick(s,t,!1),n,r)),n};$.prototype.set=function(s,e,t,n){var i,r,o,c;if(typeof e>"u")return t;for(o=ti(s,this.separator),i=0;i<o.length;i++){if(c=o[i],i===o.length-1)if(n&&Zn(e)&&Zn(t[c]))for(r in e)Oa.call(e,r)&&(t[c][r]=e[r]);else if(n&&Array.isArray(t[c])&&Array.isArray(e))for(var d=0;d<e.length;d++)t[o[i]].push(e[d]);else t[c]=e;else(!Oa.call(t,c)||!Zn(t[c])&&!Array.isArray(t[c]))&&(/^\d+$/.test(o[i+1])?t[c]=[]:t[c]={});t=t[c]}return t};$.prototype.transform=function(s,e,t){return e=e||{},t=t||{},Object.keys(s).forEach(function(n){this.set(s[n],this.pick(n,e),t)}.bind(this)),t};$.prototype.dot=function(s,e,t){e=e||{},t=t||[];var n=Array.isArray(s);return Object.keys(s).forEach(function(i){var r=n&&this.useBrackets?"["+i+"]":i;if(dn(s[i])&&(Zn(s[i])&&!ei(s[i])||Array.isArray(s[i])&&!this.keepArray&&s[i].length!==0))if(n&&this.useBrackets){var o=t[t.length-1]||"";return this.dot(s[i],e,t.slice(0,-1).concat(o+r))}else return this.dot(s[i],e,t.concat(r));else n&&this.useBrackets?e[t.join(this.separator).concat("["+i+"]")]=s[i]:e[t.concat(r).join(this.separator)]=s[i]}.bind(this)),e};$.pick=Ke("pick");$.move=Ke("move");$.transfer=Ke("transfer");$.transform=Ke("transform");$.copy=Ke("copy");$.object=Ke("object");$.str=Ke("str");$.set=Ke("set");$.delete=Ke("delete");$.del=$.remove=Ke("remove");$.dot=Ke("dot");["override","overwrite"].forEach(function(s){Object.defineProperty($,s,{get:function(){return Ut.override},set:function(e){Ut.override=!!e}})});["useArray","keepArray","useBrackets"].forEach(function(s){Object.defineProperty($,s,{get:function(){return Ut[s]},set:function(e){Ut[s]=e}})});$._process=St;Aa.exports=$});var Ee=F(oe=>{"use strict";Object.defineProperty(oe,"__esModule",{value:!0});oe.asPromise=oe.thenable=oe.typedArray=oe.stringArray=oe.array=oe.func=oe.error=oe.number=oe.string=oe.boolean=void 0;function Jd(s){return s===!0||s===!1}oe.boolean=Jd;function ja(s){return typeof s=="string"||s instanceof String}oe.string=ja;function Qd(s){return typeof s=="number"||s instanceof Number}oe.number=Qd;function Gd(s){return s instanceof Error}oe.error=Gd;function za(s){return typeof s=="function"}oe.func=za;function Va(s){return Array.isArray(s)}oe.array=Va;function Yd(s){return Va(s)&&s.every(e=>ja(e))}oe.stringArray=Yd;function Xd(s,e){return Array.isArray(s)&&s.every(e)}oe.typedArray=Xd;function Ba(s){return s&&za(s.then)}oe.thenable=Ba;function Zd(s){return s instanceof Promise?s:Ba(s)?new Promise((e,t)=>{s.then(n=>e(n),n=>t(n))}):Promise.resolve(s)}oe.asPromise=Zd});var ui=F(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.forEach=Ce.mapAsync=Ce.map=Ce.clearTestMode=Ce.setTestMode=Ce.Semaphore=Ce.Delayer=void 0;var ln=L(),Lr=class{constructor(e){this.defaultDelay=e,this.timeout=void 0,this.completionPromise=void 0,this.onSuccess=void 0,this.task=void 0}trigger(e,t=this.defaultDelay){return this.task=e,t>=0&&this.cancelTimeout(),this.completionPromise||(this.completionPromise=new Promise(n=>{this.onSuccess=n}).then(()=>{this.completionPromise=void 0,this.onSuccess=void 0;var n=this.task();return this.task=void 0,n})),(t>=0||this.timeout===void 0)&&(this.timeout=(0,ln.RAL)().timer.setTimeout(()=>{this.timeout=void 0,this.onSuccess(void 0)},t>=0?t:this.defaultDelay)),this.completionPromise}forceDelivery(){if(!this.completionPromise)return;this.cancelTimeout();let e=this.task();return this.completionPromise=void 0,this.onSuccess=void 0,this.task=void 0,e}isTriggered(){return this.timeout!==void 0}cancel(){this.cancelTimeout(),this.completionPromise=void 0}cancelTimeout(){this.timeout!==void 0&&(this.timeout.dispose(),this.timeout=void 0)}};Ce.Delayer=Lr;var Ur=class{constructor(e=1){if(e<=0)throw new Error("Capacity must be greater than 0");this._capacity=e,this._active=0,this._waiting=[]}lock(e){return new Promise((t,n)=>{this._waiting.push({thunk:e,resolve:t,reject:n}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length===0||this._active===this._capacity||(0,ln.RAL)().timer.setImmediate(()=>this.doRunNext())}doRunNext(){if(this._waiting.length===0||this._active===this._capacity)return;let e=this._waiting.shift();if(this._active++,this._active>this._capacity)throw new Error("To many thunks active");try{let t=e.thunk();t instanceof Promise?t.then(n=>{this._active--,e.resolve(n),this.runNext()},n=>{this._active--,e.reject(n),this.runNext()}):(this._active--,e.resolve(t),this.runNext())}catch(t){this._active--,e.reject(t),this.runNext()}}};Ce.Semaphore=Ur;var Nr=!1;function eu(){Nr=!0}Ce.setTestMode=eu;function tu(){Nr=!1}Ce.clearTestMode=tu;var Ja=15,un=class{constructor(e=Ja){this.yieldAfter=Nr===!0?Math.max(e,2):Math.max(e,Ja),this.startTime=Date.now(),this.counter=0,this.total=0,this.counterInterval=1}start(){this.counter=0,this.total=0,this.counterInterval=1,this.startTime=Date.now()}shouldYield(){if(++this.counter>=this.counterInterval){let e=Date.now()-this.startTime,t=Math.max(0,this.yieldAfter-e);if(this.total+=this.counter,this.counter=0,e>=this.yieldAfter||t<=1)return this.counterInterval=1,this.total=0,!0;switch(e){case 0:case 1:this.counterInterval=this.total*2;break}}return!1}};async function nu(s,e,t,n){if(s.length===0)return[];let i=new Array(s.length),r=new un(n?.yieldAfter);function o(d){r.start();for(let l=d;l<s.length;l++)if(i[l]=e(s[l]),r.shouldYield())return n?.yieldCallback&&n.yieldCallback(),l+1;return-1}let c=o(0);for(;c!==-1&&!(t!==void 0&&t.isCancellationRequested);)c=await new Promise(d=>{(0,ln.RAL)().timer.setImmediate(()=>{d(o(c))})});return i}Ce.map=nu;async function iu(s,e,t,n){if(s.length===0)return[];let i=new Array(s.length),r=new un(n?.yieldAfter);async function o(d){r.start();for(let l=d;l<s.length;l++)if(i[l]=await e(s[l],t),r.shouldYield())return n?.yieldCallback&&n.yieldCallback(),l+1;return-1}let c=await o(0);for(;c!==-1&&!(t!==void 0&&t.isCancellationRequested);)c=await new Promise(d=>{(0,ln.RAL)().timer.setImmediate(()=>{d(o(c))})});return i}Ce.mapAsync=iu;async function ru(s,e,t,n){if(s.length===0)return;let i=new un(n?.yieldAfter);function r(c){i.start();for(let d=c;d<s.length;d++)if(e(s[d]),i.shouldYield())return n?.yieldCallback&&n.yieldCallback(),d+1;return-1}let o=r(0);for(;o!==-1&&!(t!==void 0&&t.isCancellationRequested);)o=await new Promise(c=>{(0,ln.RAL)().timer.setImmediate(()=>{c(r(o))})})}Ce.forEach=ru});var $r=F(Hr=>{"use strict";Object.defineProperty(Hr,"__esModule",{value:!0});var su=I("vscode"),Kr=class extends su.CompletionItem{constructor(e){super(e)}};Hr.default=Kr});var zr=F(jr=>{"use strict";Object.defineProperty(jr,"__esModule",{value:!0});var ou=I("vscode"),Wr=class extends ou.CodeLens{constructor(e){super(e)}};jr.default=Wr});var Jr=F(Br=>{"use strict";Object.defineProperty(Br,"__esModule",{value:!0});var au=I("vscode"),Vr=class extends au.DocumentLink{constructor(e,t){super(e,t)}};Br.default=Vr});var Yr=F(Gr=>{"use strict";Object.defineProperty(Gr,"__esModule",{value:!0});var cu=I("vscode"),Qr=class extends cu.CodeAction{constructor(e,t){super(e),this.data=t}};Gr.default=Qr});var es=F($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.ProtocolDiagnostic=$t.DiagnosticCode=void 0;var du=I("vscode"),Xr=Ee(),Qa;(function(s){function e(t){let n=t;return n!=null&&(Xr.number(n.value)||Xr.string(n.value))&&Xr.string(n.target)}s.is=e})(Qa||($t.DiagnosticCode=Qa={}));var Zr=class extends du.Diagnostic{constructor(e,t,n,i){super(e,t,n),this.data=i,this.hasDiagnosticCode=!1}};$t.ProtocolDiagnostic=Zr});var is=F(ns=>{"use strict";Object.defineProperty(ns,"__esModule",{value:!0});var uu=I("vscode"),ts=class extends uu.CallHierarchyItem{constructor(e,t,n,i,r,o,c){super(e,t,n,i,r,o),c!==void 0&&(this.data=c)}};ns.default=ts});var os=F(ss=>{"use strict";Object.defineProperty(ss,"__esModule",{value:!0});var lu=I("vscode"),rs=class extends lu.TypeHierarchyItem{constructor(e,t,n,i,r,o,c){super(e,t,n,i,r,o),c!==void 0&&(this.data=c)}};ss.default=rs});var ds=F(cs=>{"use strict";Object.defineProperty(cs,"__esModule",{value:!0});var li=I("vscode"),as=class extends li.SymbolInformation{constructor(e,t,n,i,r){let o=!(i instanceof li.Uri);super(e,t,n,o?i:new li.Location(i,new li.Range(0,0,0,0))),this.hasRange=o,r!==void 0&&(this.data=r)}};cs.default=as});var ps=F(ls=>{"use strict";Object.defineProperty(ls,"__esModule",{value:!0});var pu=I("vscode"),us=class extends pu.InlayHint{constructor(e,t,n){super(e,t,n)}};ls.default=us});var Za=F(pi=>{"use strict";Object.defineProperty(pi,"__esModule",{value:!0});pi.createConverter=void 0;var de=I("vscode"),A=L(),bt=Ee(),Ga=ui(),fu=$r(),hu=zr(),gu=Jr(),Ya=Yr(),Xa=es(),mu=is(),vu=os(),yu=ds(),Cu=ps(),fs;(function(s){function e(t){let n=t;return n&&!!n.inserting&&!!n.replacing}s.is=e})(fs||(fs={}));function wu(s){let t=s||(u=>u.toString());function n(u){return t(u)}function i(u){return{uri:t(u.uri)}}function r(u){return{uri:t(u.uri),languageId:u.languageId,version:u.version,text:u.getText()}}function o(u){return{uri:t(u.uri),version:u.version}}function c(u){return{textDocument:r(u)}}function d(u){let C=u;return!!C.document&&!!C.contentChanges}function l(u){let C=u;return!!C.uri&&!!C.version}function p(u,C,R){if(l(u))return{textDocument:{uri:t(u.uri),version:u.version},contentChanges:[{text:u.getText()}]};if(d(u)){let B=C,G=R;return{textDocument:{uri:t(B),version:G},contentChanges:u.contentChanges.map(ke=>{let ze=ke.range;return{range:{start:{line:ze.start.line,character:ze.start.character},end:{line:ze.end.line,character:ze.end.character}},rangeLength:ke.rangeLength,text:ke.text}})}}else throw Error("Unsupported text document change parameter")}function g(u){return{textDocument:i(u)}}function h(u,C=!1){let R={textDocument:i(u)};return C&&(R.text=u.getText()),R}function v(u){switch(u){case de.TextDocumentSaveReason.Manual:return A.TextDocumentSaveReason.Manual;case de.TextDocumentSaveReason.AfterDelay:return A.TextDocumentSaveReason.AfterDelay;case de.TextDocumentSaveReason.FocusOut:return A.TextDocumentSaveReason.FocusOut}return A.TextDocumentSaveReason.Manual}function f(u){return{textDocument:i(u.document),reason:v(u.reason)}}function y(u){return{files:u.files.map(C=>({uri:t(C)}))}}function w(u){return{files:u.files.map(C=>({oldUri:t(C.oldUri),newUri:t(C.newUri)}))}}function b(u){return{files:u.files.map(C=>({uri:t(C)}))}}function T(u){return{files:u.files.map(C=>({uri:t(C)}))}}function P(u){return{files:u.files.map(C=>({oldUri:t(C.oldUri),newUri:t(C.newUri)}))}}function q(u){return{files:u.files.map(C=>({uri:t(C)}))}}function ce(u,C){return{textDocument:i(u),position:dt(C)}}function V(u){switch(u){case de.CompletionTriggerKind.TriggerCharacter:return A.CompletionTriggerKind.TriggerCharacter;case de.CompletionTriggerKind.TriggerForIncompleteCompletions:return A.CompletionTriggerKind.TriggerForIncompleteCompletions;default:return A.CompletionTriggerKind.Invoked}}function Z(u,C,R){return{textDocument:i(u),position:dt(C),context:{triggerKind:V(R.triggerKind),triggerCharacter:R.triggerCharacter}}}function Ye(u){switch(u){case de.SignatureHelpTriggerKind.Invoke:return A.SignatureHelpTriggerKind.Invoked;case de.SignatureHelpTriggerKind.TriggerCharacter:return A.SignatureHelpTriggerKind.TriggerCharacter;case de.SignatureHelpTriggerKind.ContentChange:return A.SignatureHelpTriggerKind.ContentChange}}function ot(u){return{label:u.label}}function Xe(u){return u.map(ot)}function at(u){return{label:u.label,parameters:Xe(u.parameters)}}function Et(u){return u.map(at)}function Mt(u){return u===void 0?u:{signatures:Et(u.signatures),activeSignature:u.activeSignature,activeParameter:u.activeParameter}}function ct(u,C,R){return{textDocument:i(u),position:dt(C),context:{isRetrigger:R.isRetrigger,triggerCharacter:R.triggerCharacter,triggerKind:Ye(R.triggerKind),activeSignatureHelp:Mt(R.activeSignatureHelp)}}}function dt(u){return{line:u.line,character:u.character}}function Ue(u){return u==null?u:{line:u.line>A.uinteger.MAX_VALUE?A.uinteger.MAX_VALUE:u.line,character:u.character>A.uinteger.MAX_VALUE?A.uinteger.MAX_VALUE:u.character}}function cr(u,C){return Ga.map(u,Ue,C)}function Mn(u){return u.map(Ue)}function pe(u){return u==null?u:{start:Ue(u.start),end:Ue(u.end)}}function On(u){return u.map(pe)}function ut(u){return u==null?u:A.Location.create(n(u.uri),pe(u.range))}function Ze(u){switch(u){case de.DiagnosticSeverity.Error:return A.DiagnosticSeverity.Error;case de.DiagnosticSeverity.Warning:return A.DiagnosticSeverity.Warning;case de.DiagnosticSeverity.Information:return A.DiagnosticSeverity.Information;case de.DiagnosticSeverity.Hint:return A.DiagnosticSeverity.Hint}}function dr(u){if(!u)return;let C=[];for(let R of u){let B=An(R);B!==void 0&&C.push(B)}return C.length>0?C:void 0}function An(u){switch(u){case de.DiagnosticTag.Unnecessary:return A.DiagnosticTag.Unnecessary;case de.DiagnosticTag.Deprecated:return A.DiagnosticTag.Deprecated;default:return}}function Ln(u){return{message:u.message,location:ut(u.location)}}function Un(u){return u.map(Ln)}function ur(u){if(u!=null)return bt.number(u)||bt.string(u)?u:{value:u.value,target:n(u.target)}}function en(u){let C=A.Diagnostic.create(pe(u.range),u.message),R=u instanceof Xa.ProtocolDiagnostic?u:void 0;R!==void 0&&R.data!==void 0&&(C.data=R.data);let B=ur(u.code);return Xa.DiagnosticCode.is(B)?R!==void 0&&R.hasDiagnosticCode?C.code=B:(C.code=B.value,C.codeDescription={href:B.target}):C.code=B,bt.number(u.severity)&&(C.severity=Ze(u.severity)),Array.isArray(u.tags)&&(C.tags=dr(u.tags)),u.relatedInformation&&(C.relatedInformation=Un(u.relatedInformation)),u.source&&(C.source=u.source),C}function Ot(u,C){return u==null?u:Ga.map(u,en,C)}function At(u){return u==null?u:u.map(en)}function lr(u,C){switch(u){case"$string":return C;case A.MarkupKind.PlainText:return{kind:u,value:C};case A.MarkupKind.Markdown:return{kind:u,value:C.value};default:return`Unsupported Markup content received. Kind is: ${u}`}}function lt(u){switch(u){case de.CompletionItemTag.Deprecated:return A.CompletionItemTag.Deprecated}}function Nn(u){if(u===void 0)return u;let C=[];for(let R of u){let B=lt(R);B!==void 0&&C.push(B)}return C}function Lt(u,C){return C!==void 0?C:u+1}function Kn(u,C=!1){let R,B;bt.string(u.label)?R=u.label:(R=u.label.label,C&&(u.label.detail!==void 0||u.label.description!==void 0)&&(B={detail:u.label.detail,description:u.label.description}));let G={label:R};B!==void 0&&(G.labelDetails=B);let fe=u instanceof fu.default?u:void 0;u.detail&&(G.detail=u.detail),u.documentation&&(!fe||fe.documentationFormat==="$string"?G.documentation=u.documentation:G.documentation=lr(fe.documentationFormat,u.documentation)),u.filterText&&(G.filterText=u.filterText),pr(G,u),bt.number(u.kind)&&(G.kind=Lt(u.kind,fe&&fe.originalItemKind)),u.sortText&&(G.sortText=u.sortText),u.additionalTextEdits&&(G.additionalTextEdits=Ne(u.additionalTextEdits)),u.commitCharacters&&(G.commitCharacters=u.commitCharacters.slice()),u.command&&(G.command=et(u.command)),(u.preselect===!0||u.preselect===!1)&&(G.preselect=u.preselect);let ke=Nn(u.tags);if(fe){if(fe.data!==void 0&&(G.data=fe.data),fe.deprecated===!0||fe.deprecated===!1){if(fe.deprecated===!0&&ke!==void 0&&ke.length>0){let ze=ke.indexOf(de.CompletionItemTag.Deprecated);ze!==-1&&ke.splice(ze,1)}G.deprecated=fe.deprecated}fe.insertTextMode!==void 0&&(G.insertTextMode=fe.insertTextMode)}return ke!==void 0&&ke.length>0&&(G.tags=ke),G.insertTextMode===void 0&&u.keepWhitespace===!0&&(G.insertTextMode=A.InsertTextMode.adjustIndentation),G}function pr(u,C){let R=A.InsertTextFormat.PlainText,B,G;C.textEdit?(B=C.textEdit.newText,G=C.textEdit.range):C.insertText instanceof de.SnippetString?(R=A.InsertTextFormat.Snippet,B=C.insertText.value):B=C.insertText,C.range&&(G=C.range),u.insertTextFormat=R,C.fromEdit&&B!==void 0&&G!==void 0?u.textEdit=tn(B,G):u.insertText=B}function tn(u,C){return fs.is(C)?A.InsertReplaceEdit.create(u,pe(C.inserting),pe(C.replacing)):{newText:u,range:pe(C)}}function nn(u){return{range:pe(u.range),newText:u.newText}}function Ne(u){return u==null?u:u.map(nn)}function Dt(u){return u<=de.SymbolKind.TypeParameter?u+1:A.SymbolKind.Property}function Ie(u){return u}function pt(u){return u.map(Ie)}function fr(u,C,R){return{textDocument:i(u),position:dt(C),context:{includeDeclaration:R.includeDeclaration}}}async function Hn(u,C){let R=A.CodeAction.create(u.title);if(u instanceof Ya.default&&u.data!==void 0&&(R.data=u.data),u.kind!==void 0&&(R.kind=Wn(u.kind)),u.diagnostics!==void 0&&(R.diagnostics=await Ot(u.diagnostics,C)),u.edit!==void 0)throw new Error("VS Code code actions can only be converted to a protocol code action without an edit.");return u.command!==void 0&&(R.command=et(u.command)),u.isPreferred!==void 0&&(R.isPreferred=u.isPreferred),u.disabled!==void 0&&(R.disabled={reason:u.disabled.reason}),R}function hr(u){let C=A.CodeAction.create(u.title);if(u instanceof Ya.default&&u.data!==void 0&&(C.data=u.data),u.kind!==void 0&&(C.kind=Wn(u.kind)),u.diagnostics!==void 0&&(C.diagnostics=At(u.diagnostics)),u.edit!==void 0)throw new Error("VS Code code actions can only be converted to a protocol code action without an edit.");return u.command!==void 0&&(C.command=et(u.command)),u.isPreferred!==void 0&&(C.isPreferred=u.isPreferred),u.disabled!==void 0&&(C.disabled={reason:u.disabled.reason}),C}async function $n(u,C){if(u==null)return u;let R;return u.only&&bt.string(u.only.value)&&(R=[u.only.value]),A.CodeActionContext.create(await Ot(u.diagnostics,C),R,rn(u.triggerKind))}function gr(u){if(u==null)return u;let C;return u.only&&bt.string(u.only.value)&&(C=[u.only.value]),A.CodeActionContext.create(At(u.diagnostics),C,rn(u.triggerKind))}function rn(u){switch(u){case de.CodeActionTriggerKind.Invoke:return A.CodeActionTriggerKind.Invoked;case de.CodeActionTriggerKind.Automatic:return A.CodeActionTriggerKind.Automatic;default:return}}function Wn(u){if(u!=null)return u.value}function jn(u){return u==null?u:A.InlineValueContext.create(u.frameId,pe(u.stoppedLocation))}function mr(u,C,R){return{context:A.InlineCompletionContext.create(R.triggerKind,R.selectedCompletionInfo),textDocument:i(u),position:Ue(C)}}function et(u){let C=A.Command.create(u.title,u.command);return u.arguments&&(C.arguments=u.arguments),C}function zn(u){let C=A.CodeLens.create(pe(u.range));return u.command&&(C.command=et(u.command)),u instanceof hu.default&&u.data&&(C.data=u.data),C}function vr(u,C){let R={tabSize:u.tabSize,insertSpaces:u.insertSpaces};return C.trimTrailingWhitespace&&(R.trimTrailingWhitespace=!0),C.trimFinalNewlines&&(R.trimFinalNewlines=!0),C.insertFinalNewline&&(R.insertFinalNewline=!0),R}function Vn(u){return{textDocument:i(u)}}function yr(u){return{textDocument:i(u)}}function Bn(u){let C=A.DocumentLink.create(pe(u.range));u.target&&(C.target=n(u.target)),u.tooltip!==void 0&&(C.tooltip=u.tooltip);let R=u instanceof gu.default?u:void 0;return R&&R.data&&(C.data=R.data),C}function Jn(u){return{textDocument:i(u)}}function Cr(u){let C={name:u.name,kind:Dt(u.kind),uri:n(u.uri),range:pe(u.range),selectionRange:pe(u.selectionRange)};return u.detail!==void 0&&u.detail.length>0&&(C.detail=u.detail),u.tags!==void 0&&(C.tags=pt(u.tags)),u instanceof mu.default&&u.data!==void 0&&(C.data=u.data),C}function sn(u){let C={name:u.name,kind:Dt(u.kind),uri:n(u.uri),range:pe(u.range),selectionRange:pe(u.selectionRange)};return u.detail!==void 0&&u.detail.length>0&&(C.detail=u.detail),u.tags!==void 0&&(C.tags=pt(u.tags)),u instanceof vu.default&&u.data!==void 0&&(C.data=u.data),C}function wr(u){let C=u instanceof yu.default?{name:u.name,kind:Dt(u.kind),location:u.hasRange?ut(u.location):{uri:t(u.location.uri)},data:u.data}:{name:u.name,kind:Dt(u.kind),location:ut(u.location)};return u.tags!==void 0&&(C.tags=pt(u.tags)),u.containerName!==""&&(C.containerName=u.containerName),C}function Qn(u){let C=typeof u.label=="string"?u.label:u.label.map(Dr),R=A.InlayHint.create(Ue(u.position),C);return u.kind!==void 0&&(R.kind=u.kind),u.textEdits!==void 0&&(R.textEdits=Ne(u.textEdits)),u.tooltip!==void 0&&(R.tooltip=on(u.tooltip)),u.paddingLeft!==void 0&&(R.paddingLeft=u.paddingLeft),u.paddingRight!==void 0&&(R.paddingRight=u.paddingRight),u instanceof Cu.default&&u.data!==void 0&&(R.data=u.data),R}function Dr(u){let C=A.InlayHintLabelPart.create(u.value);return u.location!==void 0&&(C.location=ut(u.location)),u.command!==void 0&&(C.command=et(u.command)),u.tooltip!==void 0&&(C.tooltip=on(u.tooltip)),C}function on(u){return typeof u=="string"?u:{kind:A.MarkupKind.Markdown,value:u.value}}return{asUri:n,asTextDocumentIdentifier:i,asTextDocumentItem:r,asVersionedTextDocumentIdentifier:o,asOpenTextDocumentParams:c,asChangeTextDocumentParams:p,asCloseTextDocumentParams:g,asSaveTextDocumentParams:h,asWillSaveTextDocumentParams:f,asDidCreateFilesParams:y,asDidRenameFilesParams:w,asDidDeleteFilesParams:b,asWillCreateFilesParams:T,asWillRenameFilesParams:P,asWillDeleteFilesParams:q,asTextDocumentPositionParams:ce,asCompletionParams:Z,asSignatureHelpParams:ct,asWorkerPosition:dt,asRange:pe,asRanges:On,asPosition:Ue,asPositions:cr,asPositionsSync:Mn,asLocation:ut,asDiagnosticSeverity:Ze,asDiagnosticTag:An,asDiagnostic:en,asDiagnostics:Ot,asDiagnosticsSync:At,asCompletionItem:Kn,asTextEdit:nn,asSymbolKind:Dt,asSymbolTag:Ie,asSymbolTags:pt,asReferenceParams:fr,asCodeAction:Hn,asCodeActionSync:hr,asCodeActionContext:$n,asCodeActionContextSync:gr,asInlineValueContext:jn,asCommand:et,asCodeLens:zn,asFormattingOptions:vr,asDocumentSymbolParams:Vn,asCodeLensParams:yr,asDocumentLink:Bn,asDocumentLinkParams:Jn,asCallHierarchyItem:Cr,asTypeHierarchyItem:sn,asInlayHint:Qn,asWorkspaceSymbol:wr,asInlineCompletionParams:mr}}pi.createConverter=wu});var nc=F(hi=>{"use strict";Object.defineProperty(hi,"__esModule",{value:!0});hi.createConverter=void 0;var k=I("vscode"),E=L(),Me=Ee(),j=ui(),Du=$r(),Su=zr(),_u=Jr(),bu=Yr(),ec=es(),Tu=is(),ku=os(),Pu=ds(),Ru=ps(),tc=L(),fi;(function(s){function e(t){let n=t;return n&&Me.string(n.language)&&Me.string(n.value)}s.is=e})(fi||(fi={}));function xu(s,e,t){let i=s||(a=>k.Uri.parse(a));function r(a){return i(a)}function o(a){let m=[];for(let D of a)if(typeof D=="string")m.push(D);else if(tc.NotebookCellTextDocumentFilter.is(D))if(typeof D.notebook=="string")m.push({notebookType:D.notebook,language:D.language});else{let x=D.notebook.notebookType??"*";m.push({notebookType:x,scheme:D.notebook.scheme,pattern:D.notebook.pattern,language:D.language})}else tc.TextDocumentFilter.is(D)&&m.push({language:D.language,scheme:D.scheme,pattern:D.pattern});return m}async function c(a,m){return j.map(a,l,m)}function d(a){let m=new Array(a.length);for(let D=0;D<a.length;D++)m[D]=l(a[D]);return m}function l(a){let m=new ec.ProtocolDiagnostic(f(a.range),a.message,w(a.severity),a.data);if(a.code!==void 0){if(typeof a.code=="string"||typeof a.code=="number")E.CodeDescription.is(a.codeDescription)?m.code={value:a.code,target:r(a.codeDescription.href)}:m.code=a.code;else if(ec.DiagnosticCode.is(a.code)){m.hasDiagnosticCode=!0;let D=a.code;m.code={value:D.value,target:r(D.target)}}}return a.source&&(m.source=a.source),a.relatedInformation&&(m.relatedInformation=p(a.relatedInformation)),Array.isArray(a.tags)&&(m.tags=g(a.tags)),m}function p(a){let m=new Array(a.length);for(let D=0;D<a.length;D++){let x=a[D];m[D]=new k.DiagnosticRelatedInformation(Ze(x.location),x.message)}return m}function g(a){if(!a)return;let m=[];for(let D of a){let x=h(D);x!==void 0&&m.push(x)}return m.length>0?m:void 0}function h(a){switch(a){case E.DiagnosticTag.Unnecessary:return k.DiagnosticTag.Unnecessary;case E.DiagnosticTag.Deprecated:return k.DiagnosticTag.Deprecated;default:return}}function v(a){return a?new k.Position(a.line,a.character):void 0}function f(a){return a?new k.Range(a.start.line,a.start.character,a.end.line,a.end.character):void 0}async function y(a,m){return j.map(a,D=>new k.Range(D.start.line,D.start.character,D.end.line,D.end.character),m)}function w(a){if(a==null)return k.DiagnosticSeverity.Error;switch(a){case E.DiagnosticSeverity.Error:return k.DiagnosticSeverity.Error;case E.DiagnosticSeverity.Warning:return k.DiagnosticSeverity.Warning;case E.DiagnosticSeverity.Information:return k.DiagnosticSeverity.Information;case E.DiagnosticSeverity.Hint:return k.DiagnosticSeverity.Hint}return k.DiagnosticSeverity.Error}function b(a){if(Me.string(a))return P(a);if(fi.is(a))return P().appendCodeblock(a.value,a.language);if(Array.isArray(a)){let m=[];for(let D of a){let x=P();fi.is(D)?x.appendCodeblock(D.value,D.language):x.appendMarkdown(D),m.push(x)}return m}else return P(a)}function T(a){if(Me.string(a))return a;switch(a.kind){case E.MarkupKind.Markdown:return P(a.value);case E.MarkupKind.PlainText:return a.value;default:return`Unsupported Markup content received. Kind is: ${a.kind}`}}function P(a){let m;if(a===void 0||typeof a=="string")m=new k.MarkdownString(a);else switch(a.kind){case E.MarkupKind.Markdown:m=new k.MarkdownString(a.value);break;case E.MarkupKind.PlainText:m=new k.MarkdownString,m.appendText(a.value);break;default:m=new k.MarkdownString,m.appendText(`Unsupported Markup content received. Kind is: ${a.kind}`);break}return m.isTrusted=e,m.supportHtml=t,m}function q(a){if(a)return new k.Hover(b(a.contents),f(a.range))}async function ce(a,m,D){if(!a)return;if(Array.isArray(a))return j.map(a,Ve=>Xe(Ve,m),D);let x=a,{defaultRange:he,commitCharacters:ye}=V(x,m),Q=await j.map(x.items,Ve=>Xe(Ve,ye,he,x.itemDefaults?.insertTextMode,x.itemDefaults?.insertTextFormat,x.itemDefaults?.data),D);return new k.CompletionList(Q,x.isIncomplete)}function V(a,m){let D=a.itemDefaults?.editRange,x=a.itemDefaults?.commitCharacters??m;return E.Range.is(D)?{defaultRange:f(D),commitCharacters:x}:D!==void 0?{defaultRange:{inserting:f(D.insert),replacing:f(D.replace)},commitCharacters:x}:{defaultRange:void 0,commitCharacters:x}}function Z(a){return E.CompletionItemKind.Text<=a&&a<=E.CompletionItemKind.TypeParameter?[a-1,void 0]:[k.CompletionItemKind.Text,a]}function Ye(a){switch(a){case E.CompletionItemTag.Deprecated:return k.CompletionItemTag.Deprecated}}function ot(a){if(a==null)return[];let m=[];for(let D of a){let x=Ye(D);x!==void 0&&m.push(x)}return m}function Xe(a,m,D,x,he,ye){let Q=ot(a.tags),Ve=at(a),Y=new Du.default(Ve);a.detail&&(Y.detail=a.detail),a.documentation&&(Y.documentation=T(a.documentation),Y.documentationFormat=Me.string(a.documentation)?"$string":a.documentation.kind),a.filterText&&(Y.filterText=a.filterText);let Gn=Et(a,D,he);if(Gn&&(Y.insertText=Gn.text,Y.range=Gn.range,Y.fromEdit=Gn.fromEdit),Me.number(a.kind)){let[Md,xa]=Z(a.kind);Y.kind=Md,xa&&(Y.originalItemKind=xa)}a.sortText&&(Y.sortText=a.sortText),a.additionalTextEdits&&(Y.additionalTextEdits=Ue(a.additionalTextEdits));let Pa=a.commitCharacters!==void 0?Me.stringArray(a.commitCharacters)?a.commitCharacters:void 0:m;Pa&&(Y.commitCharacters=Pa.slice()),a.command&&(Y.command=Ne(a.command)),(a.deprecated===!0||a.deprecated===!1)&&(Y.deprecated=a.deprecated,a.deprecated===!0&&Q.push(k.CompletionItemTag.Deprecated)),(a.preselect===!0||a.preselect===!1)&&(Y.preselect=a.preselect);let Ra=a.data??ye;Ra!==void 0&&(Y.data=Ra),Q.length>0&&(Y.tags=Q);let _r=a.insertTextMode??x;return _r!==void 0&&(Y.insertTextMode=_r,_r===E.InsertTextMode.asIs&&(Y.keepWhitespace=!0)),Y}function at(a){return E.CompletionItemLabelDetails.is(a.labelDetails)?{label:a.label,detail:a.labelDetails.detail,description:a.labelDetails.description}:a.label}function Et(a,m,D){let x=a.insertTextFormat??D;if(a.textEdit!==void 0||m!==void 0){let[he,ye]=a.textEdit!==void 0?Mt(a.textEdit):[m,a.textEditText??a.label];return x===E.InsertTextFormat.Snippet?{text:new k.SnippetString(ye),range:he,fromEdit:!0}:{text:ye,range:he,fromEdit:!0}}else return a.insertText?x===E.InsertTextFormat.Snippet?{text:new k.SnippetString(a.insertText),fromEdit:!1}:{text:a.insertText,fromEdit:!1}:void 0}function Mt(a){return E.InsertReplaceEdit.is(a)?[{inserting:f(a.insert),replacing:f(a.replace)},a.newText]:[f(a.range),a.newText]}function ct(a){if(a)return new k.TextEdit(f(a.range),a.newText)}async function dt(a,m){if(a)return j.map(a,ct,m)}function Ue(a){if(!a)return;let m=new Array(a.length);for(let D=0;D<a.length;D++)m[D]=ct(a[D]);return m}async function cr(a,m){if(!a)return;let D=new k.SignatureHelp;return Me.number(a.activeSignature)?D.activeSignature=a.activeSignature:D.activeSignature=0,Me.number(a.activeParameter)?D.activeParameter=a.activeParameter:D.activeParameter=0,a.signatures&&(D.signatures=await Mn(a.signatures,m)),D}async function Mn(a,m){return j.mapAsync(a,pe,m)}async function pe(a,m){let D=new k.SignatureInformation(a.label);return a.documentation!==void 0&&(D.documentation=T(a.documentation)),a.parameters!==void 0&&(D.parameters=await On(a.parameters,m)),a.activeParameter!==void 0&&(D.activeParameter=a.activeParameter),D}function On(a,m){return j.map(a,ut,m)}function ut(a){let m=new k.ParameterInformation(a.label);return a.documentation&&(m.documentation=T(a.documentation)),m}function Ze(a){return a?new k.Location(i(a.uri),f(a.range)):void 0}async function dr(a,m){if(a)return Un(a,m)}async function An(a,m){if(a)return Un(a,m)}function Ln(a){if(!a)return;let m={targetUri:i(a.targetUri),targetRange:f(a.targetRange),originSelectionRange:f(a.originSelectionRange),targetSelectionRange:f(a.targetSelectionRange)};if(!m.targetSelectionRange)throw new Error("targetSelectionRange must not be undefined or null");return m}async function Un(a,m){if(a)if(Me.array(a)){if(a.length===0)return[];if(E.LocationLink.is(a[0])){let D=a;return j.map(D,Ln,m)}else{let D=a;return j.map(D,Ze,m)}}else return E.LocationLink.is(a)?[Ln(a)]:Ze(a)}async function ur(a,m){if(a)return j.map(a,Ze,m)}async function en(a,m){if(a)return j.map(a,Ot,m)}function Ot(a){let m=new k.DocumentHighlight(f(a.range));return Me.number(a.kind)&&(m.kind=At(a.kind)),m}function At(a){switch(a){case E.DocumentHighlightKind.Text:return k.DocumentHighlightKind.Text;case E.DocumentHighlightKind.Read:return k.DocumentHighlightKind.Read;case E.DocumentHighlightKind.Write:return k.DocumentHighlightKind.Write}return k.DocumentHighlightKind.Text}async function lr(a,m){if(a)return j.map(a,Kn,m)}function lt(a){return a<=E.SymbolKind.TypeParameter?a-1:k.SymbolKind.Property}function Nn(a){switch(a){case E.SymbolTag.Deprecated:return k.SymbolTag.Deprecated;default:return}}function Lt(a){if(a==null)return;let m=[];for(let D of a){let x=Nn(D);x!==void 0&&m.push(x)}return m.length===0?void 0:m}function Kn(a){let m=a.data,D=a.location,x=D.range===void 0||m!==void 0?new Pu.default(a.name,lt(a.kind),a.containerName??"",D.range===void 0?i(D.uri):new k.Location(i(a.location.uri),f(D.range)),m):new k.SymbolInformation(a.name,lt(a.kind),a.containerName??"",new k.Location(i(a.location.uri),f(D.range)));return nn(x,a),x}async function pr(a,m){if(a!=null)return j.map(a,tn,m)}function tn(a){let m=new k.DocumentSymbol(a.name,a.detail||"",lt(a.kind),f(a.range),f(a.selectionRange));if(nn(m,a),a.children!==void 0&&a.children.length>0){let D=[];for(let x of a.children)D.push(tn(x));m.children=D}return m}function nn(a,m){a.tags=Lt(m.tags),m.deprecated&&(a.tags?a.tags.includes(k.SymbolTag.Deprecated)||(a.tags=a.tags.concat(k.SymbolTag.Deprecated)):a.tags=[k.SymbolTag.Deprecated])}function Ne(a){let m={title:a.title,command:a.command};return a.arguments&&(m.arguments=a.arguments),m}async function Dt(a,m){if(a)return j.map(a,Ne,m)}let Ie=new Map;Ie.set(E.CodeActionKind.Empty,k.CodeActionKind.Empty),Ie.set(E.CodeActionKind.QuickFix,k.CodeActionKind.QuickFix),Ie.set(E.CodeActionKind.Refactor,k.CodeActionKind.Refactor),Ie.set(E.CodeActionKind.RefactorExtract,k.CodeActionKind.RefactorExtract),Ie.set(E.CodeActionKind.RefactorInline,k.CodeActionKind.RefactorInline),Ie.set(E.CodeActionKind.RefactorRewrite,k.CodeActionKind.RefactorRewrite),Ie.set(E.CodeActionKind.Source,k.CodeActionKind.Source),Ie.set(E.CodeActionKind.SourceOrganizeImports,k.CodeActionKind.SourceOrganizeImports);function pt(a){if(a==null)return;let m=Ie.get(a);if(m)return m;let D=a.split(".");m=k.CodeActionKind.Empty;for(let x of D)m=m.append(x);return m}function fr(a){if(a!=null)return a.map(m=>pt(m))}async function Hn(a,m){if(a==null)return;let D=new bu.default(a.title,a.data);return a.kind!==void 0&&(D.kind=pt(a.kind)),a.diagnostics!==void 0&&(D.diagnostics=d(a.diagnostics)),a.edit!==void 0&&(D.edit=await rn(a.edit,m)),a.command!==void 0&&(D.command=Ne(a.command)),a.isPreferred!==void 0&&(D.isPreferred=a.isPreferred),a.disabled!==void 0&&(D.disabled={reason:a.disabled.reason}),D}function hr(a,m){return j.mapAsync(a,async D=>E.Command.is(D)?Ne(D):Hn(D,m),m)}function $n(a){if(!a)return;let m=new Su.default(f(a.range));return a.command&&(m.command=Ne(a.command)),a.data!==void 0&&a.data!==null&&(m.data=a.data),m}async function gr(a,m){if(a)return j.map(a,$n,m)}async function rn(a,m){if(!a)return;let D=new Map;if(a.changeAnnotations!==void 0){let ye=a.changeAnnotations;await j.forEach(Object.keys(ye),Q=>{let Ve=Wn(ye[Q]);D.set(Q,Ve)},m)}let x=ye=>{if(ye!==void 0)return D.get(ye)},he=new k.WorkspaceEdit;if(a.documentChanges){let ye=a.documentChanges;await j.forEach(ye,Q=>{if(E.CreateFile.is(Q))he.createFile(i(Q.uri),Q.options,x(Q.annotationId));else if(E.RenameFile.is(Q))he.renameFile(i(Q.oldUri),i(Q.newUri),Q.options,x(Q.annotationId));else if(E.DeleteFile.is(Q))he.deleteFile(i(Q.uri),Q.options,x(Q.annotationId));else if(E.TextDocumentEdit.is(Q)){let Ve=i(Q.textDocument.uri);for(let Y of Q.edits)E.AnnotatedTextEdit.is(Y)?he.replace(Ve,f(Y.range),Y.newText,x(Y.annotationId)):he.replace(Ve,f(Y.range),Y.newText)}else throw new Error(`Unknown workspace edit change received:
|
|
6
|
-
${JSON.stringify(Q,void 0,4)}`)},m)}else if(a.changes){let ye=a.changes;await j.forEach(Object.keys(ye),Q=>{he.set(i(Q),Ue(ye[Q]))},m)}return he}function Wn(a){if(a!==void 0)return{label:a.label,needsConfirmation:!!a.needsConfirmation,description:a.description}}function jn(a){let m=f(a.range),D=a.target?r(a.target):void 0,x=new _u.default(m,D);return a.tooltip!==void 0&&(x.tooltip=a.tooltip),a.data!==void 0&&a.data!==null&&(x.data=a.data),x}async function mr(a,m){if(a)return j.map(a,jn,m)}function et(a){return new k.Color(a.red,a.green,a.blue,a.alpha)}function zn(a){return new k.ColorInformation(f(a.range),et(a.color))}async function vr(a,m){if(a)return j.map(a,zn,m)}function Vn(a){let m=new k.ColorPresentation(a.label);return m.additionalTextEdits=Ue(a.additionalTextEdits),a.textEdit&&(m.textEdit=ct(a.textEdit)),m}async function yr(a,m){if(a)return j.map(a,Vn,m)}function Bn(a){if(a)switch(a){case E.FoldingRangeKind.Comment:return k.FoldingRangeKind.Comment;case E.FoldingRangeKind.Imports:return k.FoldingRangeKind.Imports;case E.FoldingRangeKind.Region:return k.FoldingRangeKind.Region}}function Jn(a){return new k.FoldingRange(a.startLine,a.endLine,Bn(a.kind))}async function Cr(a,m){if(a)return j.map(a,Jn,m)}function sn(a){return new k.SelectionRange(f(a.range),a.parent?sn(a.parent):void 0)}async function wr(a,m){return Array.isArray(a)?j.map(a,sn,m):[]}function Qn(a){return E.InlineValueText.is(a)?new k.InlineValueText(f(a.range),a.text):E.InlineValueVariableLookup.is(a)?new k.InlineValueVariableLookup(f(a.range),a.variableName,a.caseSensitiveLookup):new k.InlineValueEvaluatableExpression(f(a.range),a.expression)}async function Dr(a,m){return Array.isArray(a)?j.map(a,Qn,m):[]}async function on(a,m){let D=typeof a.label=="string"?a.label:await j.map(a.label,u,m),x=new Ru.default(v(a.position),D);return a.kind!==void 0&&(x.kind=a.kind),a.textEdits!==void 0&&(x.textEdits=await dt(a.textEdits,m)),a.tooltip!==void 0&&(x.tooltip=C(a.tooltip)),a.paddingLeft!==void 0&&(x.paddingLeft=a.paddingLeft),a.paddingRight!==void 0&&(x.paddingRight=a.paddingRight),a.data!==void 0&&(x.data=a.data),x}function u(a){let m=new k.InlayHintLabelPart(a.value);return a.location!==void 0&&(m.location=Ze(a.location)),a.tooltip!==void 0&&(m.tooltip=C(a.tooltip)),a.command!==void 0&&(m.command=Ne(a.command)),m}function C(a){return typeof a=="string"?a:P(a)}async function R(a,m){if(Array.isArray(a))return j.mapAsync(a,on,m)}function B(a){if(a===null)return;let m=new Tu.default(lt(a.kind),a.name,a.detail||"",r(a.uri),f(a.range),f(a.selectionRange),a.data);return a.tags!==void 0&&(m.tags=Lt(a.tags)),m}async function G(a,m){if(a!==null)return j.map(a,B,m)}async function fe(a,m){return new k.CallHierarchyIncomingCall(B(a.from),await y(a.fromRanges,m))}async function ke(a,m){if(a!==null)return j.mapAsync(a,fe,m)}async function ze(a,m){return new k.CallHierarchyOutgoingCall(B(a.to),await y(a.fromRanges,m))}async function Td(a,m){if(a!==null)return j.mapAsync(a,ze,m)}async function kd(a,m){if(a!=null)return new k.SemanticTokens(new Uint32Array(a.data),a.resultId)}function Ta(a){return new k.SemanticTokensEdit(a.start,a.deleteCount,a.data!==void 0?new Uint32Array(a.data):void 0)}async function Pd(a,m){if(a!=null)return new k.SemanticTokensEdits(a.edits.map(Ta),a.resultId)}function Rd(a){return a}async function xd(a,m){if(a!=null)return new k.LinkedEditingRanges(await y(a.ranges,m),Fd(a.wordPattern))}function Fd(a){if(a!=null)return new RegExp(a)}function ka(a){if(a===null)return;let m=new ku.default(lt(a.kind),a.name,a.detail||"",r(a.uri),f(a.range),f(a.selectionRange),a.data);return a.tags!==void 0&&(m.tags=Lt(a.tags)),m}async function qd(a,m){if(a!==null)return j.map(a,ka,m)}function Id(a){if(Me.string(a))return a;if(E.RelativePattern.is(a)){if(E.URI.is(a.baseUri))return new k.RelativePattern(r(a.baseUri),a.pattern);if(E.WorkspaceFolder.is(a.baseUri)){let m=k.workspace.getWorkspaceFolder(r(a.baseUri.uri));return m!==void 0?new k.RelativePattern(m,a.pattern):void 0}}}async function Ed(a,m){if(!a)return;if(Array.isArray(a))return j.map(a,he=>Sr(he),m);let D=a,x=await j.map(D.items,he=>Sr(he),m);return new k.InlineCompletionList(x)}function Sr(a){let m;typeof a.insertText=="string"?m=a.insertText:m=new k.SnippetString(a.insertText.value);let D;a.command&&(D=Ne(a.command));let x=new k.InlineCompletionItem(m,f(a.range),D);return a.filterText&&(x.filterText=a.filterText),x}return{asUri:r,asDocumentSelector:o,asDiagnostics:c,asDiagnostic:l,asRange:f,asRanges:y,asPosition:v,asDiagnosticSeverity:w,asDiagnosticTag:h,asHover:q,asCompletionResult:ce,asCompletionItem:Xe,asTextEdit:ct,asTextEdits:dt,asSignatureHelp:cr,asSignatureInformations:Mn,asSignatureInformation:pe,asParameterInformations:On,asParameterInformation:ut,asDeclarationResult:dr,asDefinitionResult:An,asLocation:Ze,asReferences:ur,asDocumentHighlights:en,asDocumentHighlight:Ot,asDocumentHighlightKind:At,asSymbolKind:lt,asSymbolTag:Nn,asSymbolTags:Lt,asSymbolInformations:lr,asSymbolInformation:Kn,asDocumentSymbols:pr,asDocumentSymbol:tn,asCommand:Ne,asCommands:Dt,asCodeAction:Hn,asCodeActionKind:pt,asCodeActionKinds:fr,asCodeActionResult:hr,asCodeLens:$n,asCodeLenses:gr,asWorkspaceEdit:rn,asDocumentLink:jn,asDocumentLinks:mr,asFoldingRangeKind:Bn,asFoldingRange:Jn,asFoldingRanges:Cr,asColor:et,asColorInformation:zn,asColorInformations:vr,asColorPresentation:Vn,asColorPresentations:yr,asSelectionRange:sn,asSelectionRanges:wr,asInlineValue:Qn,asInlineValues:Dr,asInlayHint:on,asInlayHints:R,asSemanticTokensLegend:Rd,asSemanticTokens:kd,asSemanticTokensEdit:Ta,asSemanticTokensEdits:Pd,asCallHierarchyItem:B,asCallHierarchyItems:G,asCallHierarchyIncomingCall:fe,asCallHierarchyIncomingCalls:ke,asCallHierarchyOutgoingCall:ze,asCallHierarchyOutgoingCalls:Td,asLinkedEditingRanges:xd,asTypeHierarchyItem:ka,asTypeHierarchyItems:qd,asGlobPattern:Id,asInlineCompletionResult:Ed,asInlineCompletionItem:Sr}}hi.createConverter=xu});var te=F(Oe=>{"use strict";Object.defineProperty(Oe,"__esModule",{value:!0});Oe.generateUuid=Oe.parse=Oe.isUUID=Oe.v4=Oe.empty=void 0;var pn=class{constructor(e){this._value=e}asHex(){return this._value}equals(e){return this.asHex()===e.asHex()}},fn=class s extends pn{static _oneOf(e){return e[Math.floor(e.length*Math.random())]}static _randomHex(){return s._oneOf(s._chars)}constructor(){super([s._randomHex(),s._randomHex(),s._randomHex(),s._randomHex(),s._randomHex(),s._randomHex(),s._randomHex(),s._randomHex(),"-",s._randomHex(),s._randomHex(),s._randomHex(),s._randomHex(),"-","4",s._randomHex(),s._randomHex(),s._randomHex(),"-",s._oneOf(s._timeHighBits),s._randomHex(),s._randomHex(),s._randomHex(),"-",s._randomHex(),s._randomHex(),s._randomHex(),s._randomHex(),s._randomHex(),s._randomHex(),s._randomHex(),s._randomHex(),s._randomHex(),s._randomHex(),s._randomHex(),s._randomHex()].join(""))}};fn._chars=["0","1","2","3","4","5","6","6","7","8","9","a","b","c","d","e","f"];fn._timeHighBits=["8","9","a","b"];Oe.empty=new pn("00000000-0000-0000-0000-000000000000");function ic(){return new fn}Oe.v4=ic;var Fu=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function rc(s){return Fu.test(s)}Oe.isUUID=rc;function qu(s){if(!rc(s))throw new Error("invalid uuid");return new pn(s)}Oe.parse=qu;function Iu(){return ic().asHex()}Oe.generateUuid=Iu});var gs=F(gi=>{"use strict";Object.defineProperty(gi,"__esModule",{value:!0});gi.ProgressPart=void 0;var sc=I("vscode"),oc=L(),ac=Ee(),hs=class{constructor(e,t,n){this._client=e,this._token=t,this._reported=0,this._infinite=!1,this._lspProgressDisposable=this._client.onProgress(oc.WorkDoneProgress.type,this._token,i=>{switch(i.kind){case"begin":this.begin(i);break;case"report":this.report(i);break;case"end":this.done(),n&&n(this);break}})}begin(e){this._infinite=e.percentage===void 0,this._lspProgressDisposable!==void 0&&sc.window.withProgress({location:sc.ProgressLocation.Window,cancellable:e.cancellable,title:e.title},async(t,n)=>{if(this._lspProgressDisposable!==void 0)return this._progress=t,this._cancellationToken=n,this._tokenDisposable=this._cancellationToken.onCancellationRequested(()=>{this._client.sendNotification(oc.WorkDoneProgressCancelNotification.type,{token:this._token})}),this.report(e),new Promise((i,r)=>{this._resolve=i,this._reject=r})})}report(e){if(this._infinite&&ac.string(e.message))this._progress!==void 0&&this._progress.report({message:e.message});else if(ac.number(e.percentage)){let t=Math.max(0,Math.min(e.percentage,100)),n=Math.max(0,t-this._reported);this._reported+=n,this._progress!==void 0&&this._progress.report({message:e.message,increment:n})}}cancel(){this.cleanup(),this._reject!==void 0&&(this._reject(),this._resolve=void 0,this._reject=void 0)}done(){this.cleanup(),this._resolve!==void 0&&(this._resolve(),this._resolve=void 0,this._reject=void 0)}cleanup(){this._lspProgressDisposable!==void 0&&(this._lspProgressDisposable.dispose(),this._lspProgressDisposable=void 0),this._tokenDisposable!==void 0&&(this._tokenDisposable.dispose(),this._tokenDisposable=void 0),this._progress=void 0,this._cancellationToken=void 0}};gi.ProgressPart=hs});var W=F(ge=>{"use strict";Object.defineProperty(ge,"__esModule",{value:!0});ge.WorkspaceFeature=ge.TextDocumentLanguageFeature=ge.TextDocumentEventFeature=ge.DynamicDocumentFeature=ge.DynamicFeature=ge.StaticFeature=ge.ensure=ge.LSPCancellationError=void 0;var Tt=I("vscode"),ms=L(),Se=Ee(),cc=te(),vs=class extends Tt.CancellationError{constructor(e){super(),this.data=e}};ge.LSPCancellationError=vs;function Eu(s,e){return s[e]===void 0&&(s[e]={}),s[e]}ge.ensure=Eu;var dc;(function(s){function e(t){let n=t;return n!=null&&Se.func(n.fillClientCapabilities)&&Se.func(n.initialize)&&Se.func(n.getState)&&Se.func(n.clear)&&(n.fillInitializeParams===void 0||Se.func(n.fillInitializeParams))}s.is=e})(dc||(ge.StaticFeature=dc={}));var uc;(function(s){function e(t){let n=t;return n!=null&&Se.func(n.fillClientCapabilities)&&Se.func(n.initialize)&&Se.func(n.getState)&&Se.func(n.clear)&&(n.fillInitializeParams===void 0||Se.func(n.fillInitializeParams))&&Se.func(n.register)&&Se.func(n.unregister)&&n.registrationType!==void 0}s.is=e})(uc||(ge.DynamicFeature=uc={}));var hn=class{constructor(e){this._client=e}getState(){let e=this.getDocumentSelectors(),t=0;for(let i of e){t++;for(let r of Tt.workspace.textDocuments)if(Tt.languages.match(i,r)>0)return{kind:"document",id:this.registrationType.method,registrations:!0,matches:!0}}let n=t>0;return{kind:"document",id:this.registrationType.method,registrations:n,matches:!1}}};ge.DynamicDocumentFeature=hn;var ys=class extends hn{static textDocumentFilter(e,t){for(let n of e)if(Tt.languages.match(n,t)>0)return!0;return!1}constructor(e,t,n,i,r,o,c){super(e),this._event=t,this._type=n,this._middleware=i,this._createParams=r,this._textDocument=o,this._selectorFilter=c,this._selectors=new Map,this._onNotificationSent=new Tt.EventEmitter}getStateInfo(){return[this._selectors.values(),!1]}getDocumentSelectors(){return this._selectors.values()}register(e){e.registerOptions.documentSelector&&(this._listener||(this._listener=this._event(t=>{this.callback(t).catch(n=>{this._client.error(`Sending document notification ${this._type.method} failed.`,n)})})),this._selectors.set(e.id,this._client.protocol2CodeConverter.asDocumentSelector(e.registerOptions.documentSelector)))}async callback(e){let t=async n=>{let i=this._createParams(n);await this._client.sendNotification(this._type,i),this.notificationSent(this.getTextDocument(n),this._type,i)};if(this.matches(e)){let n=this._middleware();return n?n(e,i=>t(i)):t(e)}}matches(e){return this._client.hasDedicatedTextSynchronizationFeature(this._textDocument(e))?!1:!this._selectorFilter||this._selectorFilter(this._selectors.values(),e)}get onNotificationSent(){return this._onNotificationSent.event}notificationSent(e,t,n){this._onNotificationSent.fire({textDocument:e,type:t,params:n})}unregister(e){this._selectors.delete(e),this._selectors.size===0&&this._listener&&(this._listener.dispose(),this._listener=void 0)}clear(){this._selectors.clear(),this._onNotificationSent.dispose(),this._listener&&(this._listener.dispose(),this._listener=void 0)}getProvider(e){for(let t of this._selectors.values())if(Tt.languages.match(t,e)>0)return{send:n=>this.callback(n)}}};ge.TextDocumentEventFeature=ys;var Cs=class extends hn{constructor(e,t){super(e),this._registrationType=t,this._registrations=new Map}*getDocumentSelectors(){for(let e of this._registrations.values()){let t=e.data.registerOptions.documentSelector;t!==null&&(yield this._client.protocol2CodeConverter.asDocumentSelector(t))}}get registrationType(){return this._registrationType}register(e){if(!e.registerOptions.documentSelector)return;let t=this.registerLanguageProvider(e.registerOptions,e.id);this._registrations.set(e.id,{disposable:t[0],data:e,provider:t[1]})}unregister(e){let t=this._registrations.get(e);t!==void 0&&t.disposable.dispose()}clear(){this._registrations.forEach(e=>{e.disposable.dispose()}),this._registrations.clear()}getRegistration(e,t){if(t){if(ms.TextDocumentRegistrationOptions.is(t)){let n=ms.StaticRegistrationOptions.hasId(t)?t.id:cc.generateUuid(),i=t.documentSelector??e;if(i)return[n,Object.assign({},t,{documentSelector:i})]}else if(Se.boolean(t)&&t===!0||ms.WorkDoneProgressOptions.is(t)){if(!e)return[void 0,void 0];let n=Se.boolean(t)&&t===!0?{documentSelector:e}:Object.assign({},t,{documentSelector:e});return[cc.generateUuid(),n]}}else return[void 0,void 0];return[void 0,void 0]}getRegistrationOptions(e,t){if(!(!e||!t))return Se.boolean(t)&&t===!0?{documentSelector:e}:Object.assign({},t,{documentSelector:e})}getProvider(e){for(let t of this._registrations.values()){let n=t.data.registerOptions.documentSelector;if(n!==null&&Tt.languages.match(this._client.protocol2CodeConverter.asDocumentSelector(n),e)>0)return t.provider}}getAllProviders(){let e=[];for(let t of this._registrations.values())e.push(t.provider);return e}};ge.TextDocumentLanguageFeature=Cs;var ws=class{constructor(e,t){this._client=e,this._registrationType=t,this._registrations=new Map}getState(){let e=this._registrations.size>0;return{kind:"workspace",id:this._registrationType.method,registrations:e}}get registrationType(){return this._registrationType}register(e){let t=this.registerLanguageProvider(e.registerOptions);this._registrations.set(e.id,{disposable:t[0],provider:t[1]})}unregister(e){let t=this._registrations.get(e);t!==void 0&&t.disposable.dispose()}clear(){this._registrations.forEach(e=>{e.disposable.dispose()}),this._registrations.clear()}getProviders(){let e=[];for(let t of this._registrations.values())e.push(t.provider);return e}};ge.WorkspaceFeature=ws});var Rs=F(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.DiagnosticFeature=gt.DiagnosticPullMode=gt.vsdiag=void 0;var Mu=kr(),K=I("vscode"),ae=L(),Ou=te(),Ds=W();function mi(s,e){return s[e]===void 0&&(s[e]={}),s[e]}var Ae;(function(s){let e;(function(t){t.full="full",t.unChanged="unChanged"})(e=s.DocumentDiagnosticReportKind||(s.DocumentDiagnosticReportKind={}))})(Ae||(gt.vsdiag=Ae={}));var vi;(function(s){s.onType="onType",s.onSave="onSave"})(vi||(gt.DiagnosticPullMode=vi={}));var we;(function(s){s.active="open",s.reschedule="reschedule",s.outDated="drop"})(we||(we={}));var Ss=class s{constructor(){this.open=new Set,this._onOpen=new K.EventEmitter,this._onClose=new K.EventEmitter,s.fillTabResources(this.open);let e=t=>{if(t.closed.length===0&&t.opened.length===0)return;let n=this.open,i=new Set;s.fillTabResources(i);let r=new Set,o=new Set(i);for(let c of n.values())i.has(c)?o.delete(c):r.add(c);if(this.open=i,r.size>0){let c=new Set;for(let d of r)c.add(K.Uri.parse(d));this._onClose.fire(c)}if(o.size>0){let c=new Set;for(let d of o)c.add(K.Uri.parse(d));this._onOpen.fire(c)}};K.window.tabGroups.onDidChangeTabs!==void 0?this.disposable=K.window.tabGroups.onDidChangeTabs(e):this.disposable={dispose:()=>{}}}get onClose(){return this._onClose.event}get onOpen(){return this._onOpen.event}dispose(){this.disposable.dispose()}isActive(e){return e instanceof K.Uri?K.window.activeTextEditor?.document.uri===e:K.window.activeTextEditor?.document===e}isVisible(e){let t=e instanceof K.Uri?e:e.uri;return this.open.has(t.toString())}getTabResources(){let e=new Set;return s.fillTabResources(new Set,e),e}static fillTabResources(e,t){let n=e??new Set;for(let i of K.window.tabGroups.all)for(let r of i.tabs){let o=r.input,c;o instanceof K.TabInputText?c=o.uri:o instanceof K.TabInputTextDiff?c=o.modified:o instanceof K.TabInputCustom&&(c=o.uri),c!==void 0&&!n.has(c.toString())&&(n.add(c.toString()),t!==void 0&&t.add(c))}}},le;(function(s){s[s.document=1]="document",s[s.workspace=2]="workspace"})(le||(le={}));var tt;(function(s){function e(t){return t instanceof K.Uri?t.toString():t.uri.toString()}s.asKey=e})(tt||(tt={}));var _s=class{constructor(){this.documentPullStates=new Map,this.workspacePullStates=new Map}track(e,t,n){let i=e===le.document?this.documentPullStates:this.workspacePullStates,[r,o,c]=t instanceof K.Uri?[t.toString(),t,n]:[t.uri.toString(),t.uri,t.version],d=i.get(r);return d===void 0&&(d={document:o,pulledVersion:c,resultId:void 0},i.set(r,d)),d}update(e,t,n,i){let r=e===le.document?this.documentPullStates:this.workspacePullStates,[o,c,d,l]=t instanceof K.Uri?[t.toString(),t,n,i]:[t.uri.toString(),t.uri,t.version,n],p=r.get(o);p===void 0?(p={document:c,pulledVersion:d,resultId:l},r.set(o,p)):(p.pulledVersion=d,p.resultId=l)}unTrack(e,t){let n=tt.asKey(t);(e===le.document?this.documentPullStates:this.workspacePullStates).delete(n)}tracks(e,t){let n=tt.asKey(t);return(e===le.document?this.documentPullStates:this.workspacePullStates).has(n)}getResultId(e,t){let n=tt.asKey(t);return(e===le.document?this.documentPullStates:this.workspacePullStates).get(n)?.resultId}getAllResultIds(){let e=[];for(let[t,n]of this.workspacePullStates)this.documentPullStates.has(t)&&(n=this.documentPullStates.get(t)),n.resultId!==void 0&&e.push({uri:t,value:n.resultId});return e}},bs=class{constructor(e,t,n){this.client=e,this.tabs=t,this.options=n,this.isDisposed=!1,this.onDidChangeDiagnosticsEmitter=new K.EventEmitter,this.provider=this.createProvider(),this.diagnostics=K.languages.createDiagnosticCollection(n.identifier),this.openRequests=new Map,this.documentStates=new _s,this.workspaceErrorCounter=0}knows(e,t){let n=t instanceof K.Uri?t:t.uri;return this.documentStates.tracks(e,t)||this.openRequests.has(n.toString())}forget(e,t){this.documentStates.unTrack(e,t)}pull(e,t){if(this.isDisposed)return;let n=e instanceof K.Uri?e:e.uri;this.pullAsync(e).then(()=>{t&&t()},i=>{this.client.error(`Document pull failed for text document ${n.toString()}`,i,!1)})}async pullAsync(e,t){if(this.isDisposed)return;let n=e instanceof K.Uri,i=n?e:e.uri,r=i.toString();t=n?t:e.version;let o=this.openRequests.get(r),c=n?this.documentStates.track(le.document,e,t):this.documentStates.track(le.document,e);if(o===void 0){let d=new K.CancellationTokenSource;this.openRequests.set(r,{state:we.active,document:e,version:t,tokenSource:d});let l,p;try{l=await this.provider.provideDiagnostics(e,c.resultId,d.token)??{kind:Ae.DocumentDiagnosticReportKind.full,items:[]}}catch(g){if(g instanceof Ds.LSPCancellationError&&ae.DiagnosticServerCancellationData.is(g.data)&&g.data.retriggerRequest===!1&&(p={state:we.outDated,document:e}),p===void 0&&g instanceof K.CancellationError)p={state:we.reschedule,document:e};else throw g}if(p=p??this.openRequests.get(r),p===void 0){this.client.error(`Lost request state in diagnostic pull model. Clearing diagnostics for ${r}`),this.diagnostics.delete(i);return}if(this.openRequests.delete(r),!this.tabs.isVisible(e)){this.documentStates.unTrack(le.document,e);return}if(p.state===we.outDated)return;l!==void 0&&(l.kind===Ae.DocumentDiagnosticReportKind.full&&this.diagnostics.set(i,l.items),c.pulledVersion=t,c.resultId=l.resultId),p.state===we.reschedule&&this.pull(e)}else o.state===we.active?(o.tokenSource.cancel(),this.openRequests.set(r,{state:we.reschedule,document:o.document})):o.state===we.outDated&&this.openRequests.set(r,{state:we.reschedule,document:o.document})}forgetDocument(e){let t=e instanceof K.Uri?e:e.uri,n=t.toString(),i=this.openRequests.get(n);this.options.workspaceDiagnostics?i!==void 0?this.openRequests.set(n,{state:we.reschedule,document:e}):this.pull(e,()=>{this.forget(le.document,e)}):(i!==void 0&&(i.state===we.active&&i.tokenSource.cancel(),this.openRequests.set(n,{state:we.outDated,document:e})),this.diagnostics.delete(t),this.forget(le.document,e))}pullWorkspace(){this.isDisposed||this.pullWorkspaceAsync().then(()=>{this.workspaceTimeout=(0,ae.RAL)().timer.setTimeout(()=>{this.pullWorkspace()},2e3)},e=>{!(e instanceof Ds.LSPCancellationError)&&!ae.DiagnosticServerCancellationData.is(e.data)&&(this.client.error("Workspace diagnostic pull failed.",e,!1),this.workspaceErrorCounter++),this.workspaceErrorCounter<=5&&(this.workspaceTimeout=(0,ae.RAL)().timer.setTimeout(()=>{this.pullWorkspace()},2e3))})}async pullWorkspaceAsync(){if(!this.provider.provideWorkspaceDiagnostics||this.isDisposed)return;this.workspaceCancellation!==void 0&&(this.workspaceCancellation.cancel(),this.workspaceCancellation=void 0),this.workspaceCancellation=new K.CancellationTokenSource;let e=this.documentStates.getAllResultIds().map(t=>({uri:this.client.protocol2CodeConverter.asUri(t.uri),value:t.value}));await this.provider.provideWorkspaceDiagnostics(e,this.workspaceCancellation.token,t=>{if(!(!t||this.isDisposed))for(let n of t.items)n.kind===Ae.DocumentDiagnosticReportKind.full&&(this.documentStates.tracks(le.document,n.uri)||this.diagnostics.set(n.uri,n.items)),this.documentStates.update(le.workspace,n.uri,n.version??void 0,n.resultId)})}createProvider(){let e={onDidChangeDiagnostics:this.onDidChangeDiagnosticsEmitter.event,provideDiagnostics:(t,n,i)=>{let r=(c,d,l)=>{let p={identifier:this.options.identifier,textDocument:{uri:this.client.code2ProtocolConverter.asUri(c instanceof K.Uri?c:c.uri)},previousResultId:d};return this.isDisposed===!0||!this.client.isRunning()?{kind:Ae.DocumentDiagnosticReportKind.full,items:[]}:this.client.sendRequest(ae.DocumentDiagnosticRequest.type,p,l).then(async g=>g==null||this.isDisposed||l.isCancellationRequested?{kind:Ae.DocumentDiagnosticReportKind.full,items:[]}:g.kind===ae.DocumentDiagnosticReportKind.Full?{kind:Ae.DocumentDiagnosticReportKind.full,resultId:g.resultId,items:await this.client.protocol2CodeConverter.asDiagnostics(g.items,l)}:{kind:Ae.DocumentDiagnosticReportKind.unChanged,resultId:g.resultId},g=>this.client.handleFailedRequest(ae.DocumentDiagnosticRequest.type,l,g,{kind:Ae.DocumentDiagnosticReportKind.full,items:[]}))},o=this.client.middleware;return o.provideDiagnostics?o.provideDiagnostics(t,n,i,r):r(t,n,i)}};return this.options.workspaceDiagnostics&&(e.provideWorkspaceDiagnostics=(t,n,i)=>{let r=async l=>l.kind===ae.DocumentDiagnosticReportKind.Full?{kind:Ae.DocumentDiagnosticReportKind.full,uri:this.client.protocol2CodeConverter.asUri(l.uri),resultId:l.resultId,version:l.version,items:await this.client.protocol2CodeConverter.asDiagnostics(l.items,n)}:{kind:Ae.DocumentDiagnosticReportKind.unChanged,uri:this.client.protocol2CodeConverter.asUri(l.uri),resultId:l.resultId,version:l.version},o=l=>{let p=[];for(let g of l)p.push({uri:this.client.code2ProtocolConverter.asUri(g.uri),value:g.value});return p},c=(l,p)=>{let g=(0,Ou.generateUuid)(),h=this.client.onProgress(ae.WorkspaceDiagnosticRequest.partialResult,g,async f=>{if(f==null){i(null);return}let y={items:[]};for(let w of f.items)try{y.items.push(await r(w))}catch(b){this.client.error("Converting workspace diagnostics failed.",b)}i(y)}),v={identifier:this.options.identifier,previousResultIds:o(l),partialResultToken:g};return this.isDisposed===!0||!this.client.isRunning()?{items:[]}:this.client.sendRequest(ae.WorkspaceDiagnosticRequest.type,v,p).then(async f=>{if(p.isCancellationRequested)return{items:[]};let y={items:[]};for(let w of f.items)y.items.push(await r(w));return h.dispose(),i(y),{items:[]}},f=>(h.dispose(),this.client.handleFailedRequest(ae.DocumentDiagnosticRequest.type,p,f,{items:[]})))},d=this.client.middleware;return d.provideWorkspaceDiagnostics?d.provideWorkspaceDiagnostics(t,n,i,c):c(t,n,i)}),e}dispose(){this.isDisposed=!0,this.workspaceCancellation?.cancel(),this.workspaceTimeout?.dispose();for(let[e,t]of this.openRequests)t.state===we.active&&t.tokenSource.cancel(),this.openRequests.set(e,{state:we.outDated,document:t.document});this.diagnostics.dispose()}},Ts=class{constructor(e){this.diagnosticRequestor=e,this.documents=new ae.LinkedMap,this.isDisposed=!1}add(e){if(this.isDisposed===!0)return;let t=tt.asKey(e);this.documents.has(t)||(this.documents.set(t,e,ae.Touch.Last),this.trigger())}remove(e){let t=tt.asKey(e);this.documents.delete(t),this.documents.size===0?this.stop():t===this.endDocumentKey()&&(this.endDocument=this.documents.last)}trigger(){if(this.isDisposed!==!0){if(this.intervalHandle!==void 0){this.endDocument=this.documents.last;return}this.endDocument=this.documents.last,this.intervalHandle=(0,ae.RAL)().timer.setInterval(()=>{let e=this.documents.first;if(e!==void 0){let t=tt.asKey(e);this.diagnosticRequestor.pull(e),this.documents.set(t,e,ae.Touch.Last),t===this.endDocumentKey()&&this.stop()}},200)}}dispose(){this.isDisposed=!0,this.stop(),this.documents.clear()}stop(){this.intervalHandle?.dispose(),this.intervalHandle=void 0,this.endDocument=void 0}endDocumentKey(){return this.endDocument!==void 0?tt.asKey(this.endDocument):void 0}},ks=class{constructor(e,t,n){let i=e.clientOptions.diagnosticPullOptions??{onChange:!0,onSave:!1},r=e.protocol2CodeConverter.asDocumentSelector(n.documentSelector),o=[],c=f=>{let y=n.documentSelector;if(i.match!==void 0)return i.match(y,f);for(let w of y)if(ae.TextDocumentFilter.is(w)){if(typeof w=="string"||w.language!==void 0&&w.language!=="*"||w.scheme!==void 0&&w.scheme!=="*"&&w.scheme!==f.scheme)return!1;if(w.pattern!==void 0){let b=new Mu.Minimatch(w.pattern,{noext:!0});if(!b.makeRe()||!b.match(f.fsPath))return!1}}return!0},d=f=>f instanceof K.Uri?c(f):K.languages.match(r,f)>0&&t.isVisible(f),l=f=>f instanceof K.Uri?this.activeTextDocument?.uri.toString()===f.toString():this.activeTextDocument===f;this.diagnosticRequestor=new bs(e,t,n),this.backgroundScheduler=new Ts(this.diagnosticRequestor);let p=f=>{!d(f)||!n.interFileDependencies||l(f)||this.backgroundScheduler.add(f)};this.activeTextDocument=K.window.activeTextEditor?.document,K.window.onDidChangeActiveTextEditor(f=>{let y=this.activeTextDocument;this.activeTextDocument=f?.document,y!==void 0&&p(y),this.activeTextDocument!==void 0&&this.backgroundScheduler.remove(this.activeTextDocument)});let g=e.getFeature(ae.DidOpenTextDocumentNotification.method);o.push(g.onNotificationSent(f=>{let y=f.textDocument;this.diagnosticRequestor.knows(le.document,y)||d(y)&&this.diagnosticRequestor.pull(y,()=>{p(y)})})),o.push(t.onOpen(f=>{for(let y of f){if(this.diagnosticRequestor.knows(le.document,y))continue;let w=y.toString(),b;for(let T of K.workspace.textDocuments)if(w===T.uri.toString()){b=T;break}b!==void 0&&d(b)&&this.diagnosticRequestor.pull(b,()=>{p(b)})}}));let h=new Set;for(let f of K.workspace.textDocuments)d(f)&&(this.diagnosticRequestor.pull(f,()=>{p(f)}),h.add(f.uri.toString()));if(i.onTabs===!0)for(let f of t.getTabResources())!h.has(f.toString())&&d(f)&&this.diagnosticRequestor.pull(f,()=>{p(f)});if(i.onChange===!0){let f=e.getFeature(ae.DidChangeTextDocumentNotification.method);o.push(f.onNotificationSent(async y=>{let w=y.textDocument;(i.filter===void 0||!i.filter(w,vi.onType))&&this.diagnosticRequestor.knows(le.document,w)&&this.diagnosticRequestor.pull(w,()=>{this.backgroundScheduler.trigger()})}))}if(i.onSave===!0){let f=e.getFeature(ae.DidSaveTextDocumentNotification.method);o.push(f.onNotificationSent(y=>{let w=y.textDocument;(i.filter===void 0||!i.filter(w,vi.onSave))&&this.diagnosticRequestor.knows(le.document,w)&&this.diagnosticRequestor.pull(y.textDocument,()=>{this.backgroundScheduler.trigger()})}))}let v=e.getFeature(ae.DidCloseTextDocumentNotification.method);o.push(v.onNotificationSent(f=>{this.cleanUpDocument(f.textDocument)})),t.onClose(f=>{for(let y of f)this.cleanUpDocument(y)}),this.diagnosticRequestor.onDidChangeDiagnosticsEmitter.event(()=>{for(let f of K.workspace.textDocuments)d(f)&&this.diagnosticRequestor.pull(f)}),n.workspaceDiagnostics===!0&&n.identifier!=="da348dc5-c30a-4515-9d98-31ff3be38d14"&&this.diagnosticRequestor.pullWorkspace(),this.disposable=K.Disposable.from(...o,this.backgroundScheduler,this.diagnosticRequestor)}get onDidChangeDiagnosticsEmitter(){return this.diagnosticRequestor.onDidChangeDiagnosticsEmitter}get diagnostics(){return this.diagnosticRequestor.provider}cleanUpDocument(e){this.diagnosticRequestor.knows(le.document,e)&&(this.diagnosticRequestor.forgetDocument(e),this.backgroundScheduler.remove(e))}},Ps=class extends Ds.TextDocumentLanguageFeature{constructor(e){super(e,ae.DocumentDiagnosticRequest.type)}fillClientCapabilities(e){let t=mi(mi(e,"textDocument"),"diagnostic");t.dynamicRegistration=!0,t.relatedDocumentSupport=!1,mi(mi(e,"workspace"),"diagnostics").refreshSupport=!0}initialize(e,t){this._client.onRequest(ae.DiagnosticRefreshRequest.type,async()=>{for(let o of this.getAllProviders())o.onDidChangeDiagnosticsEmitter.fire()});let[i,r]=this.getRegistration(t,e.diagnosticProvider);!i||!r||this.register({id:i,registerOptions:r})}clear(){this.tabs!==void 0&&(this.tabs.dispose(),this.tabs=void 0),super.clear()}registerLanguageProvider(e){this.tabs===void 0&&(this.tabs=new Ss);let t=new ks(this._client,this.tabs,e);return[t.disposable,t]}};gt.DiagnosticFeature=Ps});var fc=F(Di=>{"use strict";Object.defineProperty(Di,"__esModule",{value:!0});Di.NotebookDocumentSyncFeature=void 0;var De=I("vscode"),Au=kr(),nt=L(),Lu=te(),lc=Ee();function pc(s,e){return s[e]===void 0&&(s[e]={}),s[e]}var Wt;(function(s){let e;(function(t){function n(h,v){return{version:h.version,uri:v.asUri(h.uri)}}t.asVersionedNotebookDocumentIdentifier=n;function i(h,v,f){let y=nt.NotebookDocument.create(f.asUri(h.uri),h.notebookType,h.version,r(v,f));return Object.keys(h.metadata).length>0&&(y.metadata=o(h.metadata)),y}t.asNotebookDocument=i;function r(h,v){return h.map(f=>c(f,v))}t.asNotebookCells=r;function o(h){return l(new Set,h)}t.asMetadata=o;function c(h,v){let f=nt.NotebookCell.create(d(h.kind),v.asUri(h.document.uri));return Object.keys(h.metadata).length>0&&(f.metadata=o(h.metadata)),h.executionSummary!==void 0&&lc.number(h.executionSummary.executionOrder)&&lc.boolean(h.executionSummary.success)&&(f.executionSummary={executionOrder:h.executionSummary.executionOrder,success:h.executionSummary.success}),f}t.asNotebookCell=c;function d(h){switch(h){case De.NotebookCellKind.Markup:return nt.NotebookCellKind.Markup;case De.NotebookCellKind.Code:return nt.NotebookCellKind.Code}}function l(h,v){if(h.has(v))throw new Error("Can't deep copy cyclic structures.");if(Array.isArray(v)){let f=[];for(let y of v)if(y!==null&&typeof y=="object"||Array.isArray(y))f.push(l(h,y));else{if(y instanceof RegExp)throw new Error("Can't transfer regular expressions to the server");f.push(y)}return f}else{let f=Object.keys(v),y=Object.create(null);for(let w of f){let b=v[w];if(b!==null&&typeof b=="object"||Array.isArray(b))y[w]=l(h,b);else{if(b instanceof RegExp)throw new Error("Can't transfer regular expressions to the server");y[w]=b}}return y}}function p(h,v){let f=v.asChangeTextDocumentParams(h,h.document.uri,h.document.version);return{document:f.textDocument,changes:f.contentChanges}}t.asTextContentChange=p;function g(h,v){let f=Object.create(null);if(h.metadata&&(f.metadata=s.c2p.asMetadata(h.metadata)),h.cells!==void 0){let y=Object.create(null),w=h.cells;w.structure&&(y.structure={array:{start:w.structure.array.start,deleteCount:w.structure.array.deleteCount,cells:w.structure.array.cells!==void 0?w.structure.array.cells.map(b=>s.c2p.asNotebookCell(b,v)):void 0},didOpen:w.structure.didOpen!==void 0?w.structure.didOpen.map(b=>v.asOpenTextDocumentParams(b.document).textDocument):void 0,didClose:w.structure.didClose!==void 0?w.structure.didClose.map(b=>v.asCloseTextDocumentParams(b.document).textDocument):void 0}),w.data!==void 0&&(y.data=w.data.map(b=>s.c2p.asNotebookCell(b,v))),w.textContent!==void 0&&(y.textContent=w.textContent.map(b=>s.c2p.asTextContentChange(b,v))),Object.keys(y).length>0&&(f.cells=y)}return f}t.asNotebookDocumentChangeEvent=g})(e=s.c2p||(s.c2p={}))})(Wt||(Wt={}));var xs;(function(s){function e(c,d,l){let p=c.length,g=d.length,h=0;for(;h<g&&h<p&&t(c[h],d[h],l);)h++;if(h<g&&h<p){let v=p-1,f=g-1;for(;v>=0&&f>=0&&t(c[v],d[f],l);)v--,f--;let y=v+1-h,w=h===f+1?void 0:d.slice(h,f+1);return w!==void 0?{start:h,deleteCount:y,cells:w}:{start:h,deleteCount:y}}else return h<g?{start:h,deleteCount:0,cells:d.slice(h)}:h<p?{start:h,deleteCount:p-h}:void 0}s.computeDiff=e;function t(c,d,l=!0){return c.kind!==d.kind||c.document.uri.toString()!==d.document.uri.toString()||c.document.languageId!==d.document.languageId||!n(c.executionSummary,d.executionSummary)?!1:!l||l&&r(c.metadata,d.metadata)}function n(c,d){return c===d?!0:c===void 0||d===void 0?!1:c.executionOrder===d.executionOrder&&c.success===d.success&&i(c.timing,d.timing)}function i(c,d){return c===d?!0:c===void 0||d===void 0?!1:c.startTime===d.startTime&&c.endTime===d.endTime}function r(c,d){if(c===d)return!0;if(c==null||d===null||d===void 0||typeof c!=typeof d||typeof c!="object")return!1;let l=Array.isArray(c),p=Array.isArray(d);if(l!==p)return!1;if(l&&p){if(c.length!==d.length)return!1;for(let g=0;g<c.length;g++)if(!r(c[g],d[g]))return!1}if(o(c)&&o(d)){let g=Object.keys(c),h=Object.keys(d);if(g.length!==h.length||(g.sort(),h.sort(),!r(g,h)))return!1;for(let v=0;v<g.length;v++){let f=g[v];if(!r(c[f],d[f]))return!1}return!0}return!1}function o(c){return c!==null&&typeof c=="object"}s.isObjectLiteral=o})(xs||(xs={}));var Fs;(function(s){function e(t,n){if(typeof t=="string")return t==="*"||n.notebookType===t;if(t.notebookType!==void 0&&t.notebookType!=="*"&&n.notebookType!==t.notebookType)return!1;let i=n.uri;if(t.scheme!==void 0&&t.scheme!=="*"&&i.scheme!==t.scheme)return!1;if(t.pattern!==void 0){let r=new Au.Minimatch(t.pattern,{noext:!0});if(!r.makeRe()||!r.match(i.fsPath))return!1}return!0}s.matchNotebook=e})(Fs||(Fs={}));var yi;(function(s){function e(n){let i=n.notebookSelector,r=[];for(let o of i){let c=(typeof o.notebook=="string"?o.notebook:o.notebook?.notebookType)??"*",d=typeof o.notebook=="string"?void 0:o.notebook?.scheme,l=typeof o.notebook=="string"?void 0:o.notebook?.pattern;if(o.cells!==void 0)for(let p of o.cells)r.push(t(c,d,l,p.language));else r.push(t(c,d,l,void 0))}return r}s.asDocumentSelector=e;function t(n,i,r,o){return i===void 0&&r===void 0?{notebook:n,language:o}:{notebook:{notebookType:n,scheme:i,pattern:r},language:o}}})(yi||(yi={}));var Ci;(function(s){function e(t){return{cells:t,uris:new Set(t.map(n=>n.document.uri.toString()))}}s.create=e})(Ci||(Ci={}));var jt=class{constructor(e,t){this.client=e,this.options=t,this.notebookSyncInfo=new Map,this.notebookDidOpen=new Set,this.disposables=[],this.selector=e.protocol2CodeConverter.asDocumentSelector(yi.asDocumentSelector(t)),De.workspace.onDidOpenNotebookDocument(n=>{this.notebookDidOpen.add(n.uri.toString()),this.didOpen(n)},void 0,this.disposables);for(let n of De.workspace.notebookDocuments)this.notebookDidOpen.add(n.uri.toString()),this.didOpen(n);De.workspace.onDidChangeNotebookDocument(n=>this.didChangeNotebookDocument(n),void 0,this.disposables),this.options.save===!0&&De.workspace.onDidSaveNotebookDocument(n=>this.didSave(n),void 0,this.disposables),De.workspace.onDidCloseNotebookDocument(n=>{this.didClose(n),this.notebookDidOpen.delete(n.uri.toString())},void 0,this.disposables)}getState(){for(let e of De.workspace.notebookDocuments)if(this.getMatchingCells(e)!==void 0)return{kind:"document",id:"$internal",registrations:!0,matches:!0};return{kind:"document",id:"$internal",registrations:!0,matches:!1}}get mode(){return"notebook"}handles(e){return De.languages.match(this.selector,e)>0}didOpenNotebookCellTextDocument(e,t){if(De.languages.match(this.selector,t.document)===0||!this.notebookDidOpen.has(e.uri.toString()))return;let n=this.notebookSyncInfo.get(e.uri.toString()),i=this.cellMatches(e,t);if(n!==void 0){let r=n.uris.has(t.document.uri.toString());if(i&&r||!i&&!r)return;if(i){let o=this.getMatchingCells(e);if(o!==void 0){let c=this.asNotebookDocumentChangeEvent(e,void 0,n,o);c!==void 0&&this.doSendChange(c,o).catch(()=>{})}}}else i&&this.doSendOpen(e,[t]).catch(()=>{})}didChangeNotebookCellTextDocument(e,t){De.languages.match(this.selector,t.document)!==0&&this.doSendChange({notebook:e,cells:{textContent:[t]}},void 0).catch(()=>{})}didCloseNotebookCellTextDocument(e,t){let n=this.notebookSyncInfo.get(e.uri.toString());if(n===void 0)return;let i=t.document.uri,r=n.cells.findIndex(o=>o.document.uri.toString()===i.toString());if(r!==-1)if(r===0&&n.cells.length===1)this.doSendClose(e,n.cells).catch(()=>{});else{let o=n.cells.slice(),c=o.splice(r,1);this.doSendChange({notebook:e,cells:{structure:{array:{start:r,deleteCount:1},didClose:c}}},o).catch(()=>{})}}dispose(){for(let e of this.disposables)e.dispose()}didOpen(e,t=this.getMatchingCells(e),n=this.notebookSyncInfo.get(e.uri.toString())){if(n!==void 0)if(t!==void 0){let i=this.asNotebookDocumentChangeEvent(e,void 0,n,t);i!==void 0&&this.doSendChange(i,t).catch(()=>{})}else this.doSendClose(e,[]).catch(()=>{});else{if(t===void 0)return;this.doSendOpen(e,t).catch(()=>{})}}didChangeNotebookDocument(e){let t=e.notebook,n=this.notebookSyncInfo.get(t.uri.toString());if(n===void 0){if(e.contentChanges.length===0)return;let i=this.getMatchingCells(t);if(i===void 0)return;this.didOpen(t,i,n)}else{let i=this.getMatchingCells(t);if(i===void 0){this.didClose(t,n);return}let r=this.asNotebookDocumentChangeEvent(e.notebook,e,n,i);r!==void 0&&this.doSendChange(r,i).catch(()=>{})}}didSave(e){this.notebookSyncInfo.get(e.uri.toString())!==void 0&&this.doSendSave(e).catch(()=>{})}didClose(e,t=this.notebookSyncInfo.get(e.uri.toString())){if(t===void 0)return;let n=e.getCells().filter(i=>t.uris.has(i.document.uri.toString()));this.doSendClose(e,n).catch(()=>{})}async sendDidOpenNotebookDocument(e){let t=this.getMatchingCells(e);if(t!==void 0)return this.doSendOpen(e,t)}async doSendOpen(e,t){let n=async(r,o)=>{let c=Wt.c2p.asNotebookDocument(r,o,this.client.code2ProtocolConverter),d=o.map(l=>this.client.code2ProtocolConverter.asTextDocumentItem(l.document));try{await this.client.sendNotification(nt.DidOpenNotebookDocumentNotification.type,{notebookDocument:c,cellTextDocuments:d})}catch(l){throw this.client.error("Sending DidOpenNotebookDocumentNotification failed",l),l}},i=this.client.middleware?.notebooks;return this.notebookSyncInfo.set(e.uri.toString(),Ci.create(t)),i?.didOpen!==void 0?i.didOpen(e,t,n):n(e,t)}async sendDidChangeNotebookDocument(e){return this.doSendChange(e,void 0)}async doSendChange(e,t=this.getMatchingCells(e.notebook)){let n=async r=>{try{await this.client.sendNotification(nt.DidChangeNotebookDocumentNotification.type,{notebookDocument:Wt.c2p.asVersionedNotebookDocumentIdentifier(r.notebook,this.client.code2ProtocolConverter),change:Wt.c2p.asNotebookDocumentChangeEvent(r,this.client.code2ProtocolConverter)})}catch(o){throw this.client.error("Sending DidChangeNotebookDocumentNotification failed",o),o}},i=this.client.middleware?.notebooks;return e.cells?.structure!==void 0&&this.notebookSyncInfo.set(e.notebook.uri.toString(),Ci.create(t??[])),i?.didChange!==void 0?i?.didChange(e,n):n(e)}async sendDidSaveNotebookDocument(e){return this.doSendSave(e)}async doSendSave(e){let t=async i=>{try{await this.client.sendNotification(nt.DidSaveNotebookDocumentNotification.type,{notebookDocument:{uri:this.client.code2ProtocolConverter.asUri(i.uri)}})}catch(r){throw this.client.error("Sending DidSaveNotebookDocumentNotification failed",r),r}},n=this.client.middleware?.notebooks;return n?.didSave!==void 0?n.didSave(e,t):t(e)}async sendDidCloseNotebookDocument(e){return this.doSendClose(e,this.getMatchingCells(e)??[])}async doSendClose(e,t){let n=async(r,o)=>{try{await this.client.sendNotification(nt.DidCloseNotebookDocumentNotification.type,{notebookDocument:{uri:this.client.code2ProtocolConverter.asUri(r.uri)},cellTextDocuments:o.map(c=>this.client.code2ProtocolConverter.asTextDocumentIdentifier(c.document))})}catch(c){throw this.client.error("Sending DidCloseNotebookDocumentNotification failed",c),c}},i=this.client.middleware?.notebooks;return this.notebookSyncInfo.delete(e.uri.toString()),i?.didClose!==void 0?i.didClose(e,t,n):n(e,t)}asNotebookDocumentChangeEvent(e,t,n,i){if(t!==void 0&&t.notebook!==e)throw new Error("Notebook must be identical");let r={notebook:e};t?.metadata!==void 0&&(r.metadata=Wt.c2p.asMetadata(t.metadata));let o;if(t?.cellChanges!==void 0&&t.cellChanges.length>0){let c=[];o=new Set(i.map(d=>d.document.uri.toString()));for(let d of t.cellChanges)o.has(d.cell.document.uri.toString())&&(d.executionSummary!==void 0||d.metadata!==void 0)&&c.push(d.cell);c.length>0&&(r.cells=r.cells??{},r.cells.data=c)}if((t?.contentChanges!==void 0&&t.contentChanges.length>0||t===void 0)&&n!==void 0&&i!==void 0){let c=n.cells,d=i,l=xs.computeDiff(c,d,!1),p,g;if(l!==void 0){p=l.cells===void 0?new Map:new Map(l.cells.map(f=>[f.document.uri.toString(),f])),g=l.deleteCount===0?new Map:new Map(c.slice(l.start,l.start+l.deleteCount).map(f=>[f.document.uri.toString(),f]));for(let f of Array.from(g.keys()))p.has(f)&&(g.delete(f),p.delete(f));r.cells=r.cells??{};let h=[],v=[];if(p.size>0||g.size>0){for(let f of p.values())h.push(f);for(let f of g.values())v.push(f)}r.cells.structure={array:l,didOpen:h,didClose:v}}}return Object.keys(r).length>1?r:void 0}getMatchingCells(e,t=e.getCells()){if(this.options.notebookSelector!==void 0){for(let n of this.options.notebookSelector)if(n.notebook===void 0||Fs.matchNotebook(n.notebook,e)){let i=this.filterCells(e,t,n.cells);return i.length===0?void 0:i}}}cellMatches(e,t){let n=this.getMatchingCells(e,[t]);return n!==void 0&&n[0]===t}filterCells(e,t,n){let i=n!==void 0?t.filter(r=>{let o=r.document.languageId;return n.some(c=>c.language==="*"||o===c.language)}):t;return typeof this.client.clientOptions.notebookDocumentOptions?.filterCells=="function"?this.client.clientOptions.notebookDocumentOptions.filterCells(e,i):i}},wi=class s{constructor(e){this.client=e,this.registrations=new Map,this.registrationType=nt.NotebookDocumentSyncRegistrationType.type,De.workspace.onDidOpenTextDocument(t=>{if(t.uri.scheme!==s.CellScheme)return;let[n,i]=this.findNotebookDocumentAndCell(t);if(!(n===void 0||i===void 0))for(let r of this.registrations.values())r instanceof jt&&r.didOpenNotebookCellTextDocument(n,i)}),De.workspace.onDidChangeTextDocument(t=>{if(t.contentChanges.length===0)return;let n=t.document;if(n.uri.scheme!==s.CellScheme)return;let[i]=this.findNotebookDocumentAndCell(n);if(i!==void 0)for(let r of this.registrations.values())r instanceof jt&&r.didChangeNotebookCellTextDocument(i,t)}),De.workspace.onDidCloseTextDocument(t=>{if(t.uri.scheme!==s.CellScheme)return;let[n,i]=this.findNotebookDocumentAndCell(t);if(!(n===void 0||i===void 0))for(let r of this.registrations.values())r instanceof jt&&r.didCloseNotebookCellTextDocument(n,i)})}getState(){if(this.registrations.size===0)return{kind:"document",id:this.registrationType.method,registrations:!1,matches:!1};for(let e of this.registrations.values()){let t=e.getState();if(t.kind==="document"&&t.registrations===!0&&t.matches===!0)return{kind:"document",id:this.registrationType.method,registrations:!0,matches:!0}}return{kind:"document",id:this.registrationType.method,registrations:!0,matches:!1}}fillClientCapabilities(e){let t=pc(pc(e,"notebookDocument"),"synchronization");t.dynamicRegistration=!0,t.executionSummarySupport=!0}preInitialize(e){let t=e.notebookDocumentSync;t!==void 0&&(this.dedicatedChannel=this.client.protocol2CodeConverter.asDocumentSelector(yi.asDocumentSelector(t)))}initialize(e){let t=e.notebookDocumentSync;if(t===void 0)return;let n=t.id??Lu.generateUuid();this.register({id:n,registerOptions:t})}register(e){let t=new jt(this.client,e.registerOptions);this.registrations.set(e.id,t)}unregister(e){let t=this.registrations.get(e);t&&t.dispose()}clear(){for(let e of this.registrations.values())e.dispose();this.registrations.clear()}handles(e){if(e.uri.scheme!==s.CellScheme)return!1;if(this.dedicatedChannel!==void 0&&De.languages.match(this.dedicatedChannel,e)>0)return!0;for(let t of this.registrations.values())if(t.handles(e))return!0;return!1}getProvider(e){for(let t of this.registrations.values())if(t.handles(e.document))return t}findNotebookDocumentAndCell(e){let t=e.uri.toString();for(let n of De.workspace.notebookDocuments)for(let i of n.getCells())if(i.document.uri.toString()===t)return[n,i];return[void 0,void 0]}};Di.NotebookDocumentSyncFeature=wi;wi.CellScheme="vscode-notebook-cell"});var gc=F(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.SyncConfigurationFeature=mt.toJSONObject=mt.ConfigurationFeature=void 0;var zt=I("vscode"),gn=L(),Uu=Ee(),Nu=te(),hc=W(),qs=class{constructor(e){this._client=e}getState(){return{kind:"static"}}fillClientCapabilities(e){e.workspace=e.workspace||{},e.workspace.configuration=!0}initialize(){let e=this._client;e.onRequest(gn.ConfigurationRequest.type,(t,n)=>{let i=o=>{let c=[];for(let d of o.items){let l=d.scopeUri!==void 0&&d.scopeUri!==null?this._client.protocol2CodeConverter.asUri(d.scopeUri):void 0;c.push(this.getConfiguration(l,d.section!==null?d.section:void 0))}return c},r=e.middleware.workspace;return r&&r.configuration?r.configuration(t,n,i):i(t,n)})}getConfiguration(e,t){let n=null;if(t){let i=t.lastIndexOf(".");if(i===-1)n=kt(zt.workspace.getConfiguration(void 0,e).get(t));else{let r=zt.workspace.getConfiguration(t.substr(0,i),e);r&&(n=kt(r.get(t.substr(i+1))))}}else{let i=zt.workspace.getConfiguration(void 0,e);n={};for(let r of Object.keys(i))i.has(r)&&(n[r]=kt(i.get(r)))}return n===void 0&&(n=null),n}clear(){}};mt.ConfigurationFeature=qs;function kt(s){if(s){if(Array.isArray(s))return s.map(kt);if(typeof s=="object"){let e=Object.create(null);for(let t in s)Object.prototype.hasOwnProperty.call(s,t)&&(e[t]=kt(s[t]));return e}}return s}mt.toJSONObject=kt;var Is=class{constructor(e){this._client=e,this.isCleared=!1,this._listeners=new Map}getState(){return{kind:"workspace",id:this.registrationType.method,registrations:this._listeners.size>0}}get registrationType(){return gn.DidChangeConfigurationNotification.type}fillClientCapabilities(e){(0,hc.ensure)((0,hc.ensure)(e,"workspace"),"didChangeConfiguration").dynamicRegistration=!0}initialize(){this.isCleared=!1;let e=this._client.clientOptions.synchronize?.configurationSection;e!==void 0&&this.register({id:Nu.generateUuid(),registerOptions:{section:e}})}register(e){let t=zt.workspace.onDidChangeConfiguration(n=>{this.onDidChangeConfiguration(e.registerOptions.section,n)});this._listeners.set(e.id,t),e.registerOptions.section!==void 0&&this.onDidChangeConfiguration(e.registerOptions.section,void 0)}unregister(e){let t=this._listeners.get(e);t&&(this._listeners.delete(e),t.dispose())}clear(){for(let e of this._listeners.values())e.dispose();this._listeners.clear(),this.isCleared=!0}onDidChangeConfiguration(e,t){if(this.isCleared)return;let n;if(Uu.string(e)?n=[e]:n=e,n!==void 0&&t!==void 0&&!n.some(c=>t.affectsConfiguration(c)))return;let i=async o=>o===void 0?this._client.sendNotification(gn.DidChangeConfigurationNotification.type,{settings:null}):this._client.sendNotification(gn.DidChangeConfigurationNotification.type,{settings:this.extractSettingsInformation(o)}),r=this._client.middleware.workspace?.didChangeConfiguration;(r?r(n,i):i(n)).catch(o=>{this._client.error(`Sending notification ${gn.DidChangeConfigurationNotification.type.method} failed`,o)})}extractSettingsInformation(e){function t(r,o){let c=r;for(let d=0;d<o.length-1;d++){let l=c[o[d]];l||(l=Object.create(null),c[o[d]]=l),c=l}return c}let n=this._client.clientOptions.workspaceFolder?this._client.clientOptions.workspaceFolder.uri:void 0,i=Object.create(null);for(let r=0;r<e.length;r++){let o=e[r],c=o.indexOf("."),d=null;if(c>=0?d=zt.workspace.getConfiguration(o.substr(0,c),n).get(o.substr(c+1)):d=zt.workspace.getConfiguration(void 0,n).get(o),d){let l=e[r].split(".");t(i,l)[l[l.length-1]]=kt(d)}}return i}};mt.SyncConfigurationFeature=Is});var mc=F(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.DidSaveTextDocumentFeature=_e.WillSaveWaitUntilFeature=_e.WillSaveFeature=_e.DidChangeTextDocumentFeature=_e.DidCloseTextDocumentFeature=_e.DidOpenTextDocumentFeature=void 0;var Re=I("vscode"),X=L(),ie=W(),Vt=te(),Es=class extends ie.TextDocumentEventFeature{constructor(e,t){super(e,Re.workspace.onDidOpenTextDocument,X.DidOpenTextDocumentNotification.type,()=>e.middleware.didOpen,n=>e.code2ProtocolConverter.asOpenTextDocumentParams(n),n=>n,ie.TextDocumentEventFeature.textDocumentFilter),this._syncedDocuments=t}get openDocuments(){return this._syncedDocuments.values()}fillClientCapabilities(e){(0,ie.ensure)((0,ie.ensure)(e,"textDocument"),"synchronization").dynamicRegistration=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;t&&n&&n.openClose&&this.register({id:Vt.generateUuid(),registerOptions:{documentSelector:t}})}get registrationType(){return X.DidOpenTextDocumentNotification.type}register(e){if(super.register(e),!e.registerOptions.documentSelector)return;let t=this._client.protocol2CodeConverter.asDocumentSelector(e.registerOptions.documentSelector);Re.workspace.textDocuments.forEach(n=>{let i=n.uri.toString();if(!this._syncedDocuments.has(i)&&Re.languages.match(t,n)>0&&!this._client.hasDedicatedTextSynchronizationFeature(n)){let r=this._client.middleware,o=c=>this._client.sendNotification(this._type,this._createParams(c));(r.didOpen?r.didOpen(n,o):o(n)).catch(c=>{this._client.error(`Sending document notification ${this._type.method} failed`,c)}),this._syncedDocuments.set(i,n)}})}getTextDocument(e){return e}notificationSent(e,t,n){this._syncedDocuments.set(e.uri.toString(),e),super.notificationSent(e,t,n)}};_e.DidOpenTextDocumentFeature=Es;var Ms=class extends ie.TextDocumentEventFeature{constructor(e,t,n){super(e,Re.workspace.onDidCloseTextDocument,X.DidCloseTextDocumentNotification.type,()=>e.middleware.didClose,i=>e.code2ProtocolConverter.asCloseTextDocumentParams(i),i=>i,ie.TextDocumentEventFeature.textDocumentFilter),this._syncedDocuments=t,this._pendingTextDocumentChanges=n}get registrationType(){return X.DidCloseTextDocumentNotification.type}fillClientCapabilities(e){(0,ie.ensure)((0,ie.ensure)(e,"textDocument"),"synchronization").dynamicRegistration=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;t&&n&&n.openClose&&this.register({id:Vt.generateUuid(),registerOptions:{documentSelector:t}})}async callback(e){await super.callback(e),this._pendingTextDocumentChanges.delete(e.uri.toString())}getTextDocument(e){return e}notificationSent(e,t,n){this._syncedDocuments.delete(e.uri.toString()),super.notificationSent(e,t,n)}unregister(e){let t=this._selectors.get(e);super.unregister(e);let n=this._selectors.values();this._syncedDocuments.forEach(i=>{if(Re.languages.match(t,i)>0&&!this._selectorFilter(n,i)&&!this._client.hasDedicatedTextSynchronizationFeature(i)){let r=this._client.middleware,o=c=>this._client.sendNotification(this._type,this._createParams(c));this._syncedDocuments.delete(i.uri.toString()),(r.didClose?r.didClose(i,o):o(i)).catch(c=>{this._client.error(`Sending document notification ${this._type.method} failed`,c)})}})}};_e.DidCloseTextDocumentFeature=Ms;var Os=class extends ie.DynamicDocumentFeature{constructor(e,t){super(e),this._changeData=new Map,this._onNotificationSent=new Re.EventEmitter,this._onPendingChangeAdded=new Re.EventEmitter,this._pendingTextDocumentChanges=t,this._syncKind=X.TextDocumentSyncKind.None}get onNotificationSent(){return this._onNotificationSent.event}get onPendingChangeAdded(){return this._onPendingChangeAdded.event}get syncKind(){return this._syncKind}get registrationType(){return X.DidChangeTextDocumentNotification.type}fillClientCapabilities(e){(0,ie.ensure)((0,ie.ensure)(e,"textDocument"),"synchronization").dynamicRegistration=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;t&&n&&n.change!==void 0&&n.change!==X.TextDocumentSyncKind.None&&this.register({id:Vt.generateUuid(),registerOptions:Object.assign({},{documentSelector:t},{syncKind:n.change})})}register(e){e.registerOptions.documentSelector&&(this._listener||(this._listener=Re.workspace.onDidChangeTextDocument(this.callback,this)),this._changeData.set(e.id,{syncKind:e.registerOptions.syncKind,documentSelector:this._client.protocol2CodeConverter.asDocumentSelector(e.registerOptions.documentSelector)}),this.updateSyncKind(e.registerOptions.syncKind))}*getDocumentSelectors(){for(let e of this._changeData.values())yield e.documentSelector}async callback(e){if(e.contentChanges.length===0)return;let t=e.document.uri,n=e.document.version,i=[];for(let r of this._changeData.values())if(Re.languages.match(r.documentSelector,e.document)>0&&!this._client.hasDedicatedTextSynchronizationFeature(e.document)){let o=this._client.middleware;if(r.syncKind===X.TextDocumentSyncKind.Incremental){let c=async d=>{let l=this._client.code2ProtocolConverter.asChangeTextDocumentParams(d,t,n);await this._client.sendNotification(X.DidChangeTextDocumentNotification.type,l),this.notificationSent(d.document,X.DidChangeTextDocumentNotification.type,l)};i.push(o.didChange?o.didChange(e,d=>c(d)):c(e))}else if(r.syncKind===X.TextDocumentSyncKind.Full){let c=async d=>{let l=d.document.uri.toString();this._pendingTextDocumentChanges.set(l,d.document),this._onPendingChangeAdded.fire()};i.push(o.didChange?o.didChange(e,d=>c(d)):c(e))}}return Promise.all(i).then(void 0,r=>{throw this._client.error(`Sending document notification ${X.DidChangeTextDocumentNotification.type.method} failed`,r),r})}notificationSent(e,t,n){this._onNotificationSent.fire({textDocument:e,type:t,params:n})}unregister(e){if(this._changeData.delete(e),this._changeData.size===0)this._listener&&(this._listener.dispose(),this._listener=void 0),this._syncKind=X.TextDocumentSyncKind.None;else{this._syncKind=X.TextDocumentSyncKind.None;for(let t of this._changeData.values())if(this.updateSyncKind(t.syncKind),this._syncKind===X.TextDocumentSyncKind.Full)break}}clear(){this._pendingTextDocumentChanges.clear(),this._changeData.clear(),this._syncKind=X.TextDocumentSyncKind.None,this._listener&&(this._listener.dispose(),this._listener=void 0)}getPendingDocumentChanges(e){if(this._pendingTextDocumentChanges.size===0)return[];let t;if(e.size===0)t=Array.from(this._pendingTextDocumentChanges.values()),this._pendingTextDocumentChanges.clear();else{t=[];for(let n of this._pendingTextDocumentChanges)e.has(n[0])||(t.push(n[1]),this._pendingTextDocumentChanges.delete(n[0]))}return t}getProvider(e){for(let t of this._changeData.values())if(Re.languages.match(t.documentSelector,e)>0)return{send:n=>this.callback(n)}}updateSyncKind(e){if(this._syncKind!==X.TextDocumentSyncKind.Full)switch(e){case X.TextDocumentSyncKind.Full:this._syncKind=e;break;case X.TextDocumentSyncKind.Incremental:this._syncKind===X.TextDocumentSyncKind.None&&(this._syncKind=X.TextDocumentSyncKind.Incremental);break}}};_e.DidChangeTextDocumentFeature=Os;var As=class extends ie.TextDocumentEventFeature{constructor(e){super(e,Re.workspace.onWillSaveTextDocument,X.WillSaveTextDocumentNotification.type,()=>e.middleware.willSave,t=>e.code2ProtocolConverter.asWillSaveTextDocumentParams(t),t=>t.document,(t,n)=>ie.TextDocumentEventFeature.textDocumentFilter(t,n.document))}get registrationType(){return X.WillSaveTextDocumentNotification.type}fillClientCapabilities(e){let t=(0,ie.ensure)((0,ie.ensure)(e,"textDocument"),"synchronization");t.willSave=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;t&&n&&n.willSave&&this.register({id:Vt.generateUuid(),registerOptions:{documentSelector:t}})}getTextDocument(e){return e.document}};_e.WillSaveFeature=As;var Ls=class extends ie.DynamicDocumentFeature{constructor(e){super(e),this._selectors=new Map}getDocumentSelectors(){return this._selectors.values()}get registrationType(){return X.WillSaveTextDocumentWaitUntilRequest.type}fillClientCapabilities(e){let t=(0,ie.ensure)((0,ie.ensure)(e,"textDocument"),"synchronization");t.willSaveWaitUntil=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;t&&n&&n.willSaveWaitUntil&&this.register({id:Vt.generateUuid(),registerOptions:{documentSelector:t}})}register(e){e.registerOptions.documentSelector&&(this._listener||(this._listener=Re.workspace.onWillSaveTextDocument(this.callback,this)),this._selectors.set(e.id,this._client.protocol2CodeConverter.asDocumentSelector(e.registerOptions.documentSelector)))}callback(e){if(ie.TextDocumentEventFeature.textDocumentFilter(this._selectors.values(),e.document)&&!this._client.hasDedicatedTextSynchronizationFeature(e.document)){let t=this._client.middleware,n=i=>this._client.sendRequest(X.WillSaveTextDocumentWaitUntilRequest.type,this._client.code2ProtocolConverter.asWillSaveTextDocumentParams(i)).then(async r=>{let o=await this._client.protocol2CodeConverter.asTextEdits(r);return o===void 0?[]:o});e.waitUntil(t.willSaveWaitUntil?t.willSaveWaitUntil(e,n):n(e))}}unregister(e){this._selectors.delete(e),this._selectors.size===0&&this._listener&&(this._listener.dispose(),this._listener=void 0)}clear(){this._selectors.clear(),this._listener&&(this._listener.dispose(),this._listener=void 0)}};_e.WillSaveWaitUntilFeature=Ls;var Us=class extends ie.TextDocumentEventFeature{constructor(e){super(e,Re.workspace.onDidSaveTextDocument,X.DidSaveTextDocumentNotification.type,()=>e.middleware.didSave,t=>e.code2ProtocolConverter.asSaveTextDocumentParams(t,this._includeText),t=>t,ie.TextDocumentEventFeature.textDocumentFilter),this._includeText=!1}get registrationType(){return X.DidSaveTextDocumentNotification.type}fillClientCapabilities(e){(0,ie.ensure)((0,ie.ensure)(e,"textDocument"),"synchronization").didSave=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;if(t&&n&&n.save){let i=typeof n.save=="boolean"?{includeText:!1}:{includeText:!!n.save.includeText};this.register({id:Vt.generateUuid(),registerOptions:Object.assign({},{documentSelector:t},i)})}}register(e){this._includeText=!!e.registerOptions.includeText,super.register(e)}getTextDocument(e){return e}};_e.DidSaveTextDocumentFeature=Us});var vc=F(Si=>{"use strict";Object.defineProperty(Si,"__esModule",{value:!0});Si.CompletionItemFeature=void 0;var Ku=I("vscode"),H=L(),Ns=W(),Hu=te(),$u=[H.CompletionItemKind.Text,H.CompletionItemKind.Method,H.CompletionItemKind.Function,H.CompletionItemKind.Constructor,H.CompletionItemKind.Field,H.CompletionItemKind.Variable,H.CompletionItemKind.Class,H.CompletionItemKind.Interface,H.CompletionItemKind.Module,H.CompletionItemKind.Property,H.CompletionItemKind.Unit,H.CompletionItemKind.Value,H.CompletionItemKind.Enum,H.CompletionItemKind.Keyword,H.CompletionItemKind.Snippet,H.CompletionItemKind.Color,H.CompletionItemKind.File,H.CompletionItemKind.Reference,H.CompletionItemKind.Folder,H.CompletionItemKind.EnumMember,H.CompletionItemKind.Constant,H.CompletionItemKind.Struct,H.CompletionItemKind.Event,H.CompletionItemKind.Operator,H.CompletionItemKind.TypeParameter],Ks=class extends Ns.TextDocumentLanguageFeature{constructor(e){super(e,H.CompletionRequest.type),this.labelDetailsSupport=new Map}fillClientCapabilities(e){let t=(0,Ns.ensure)((0,Ns.ensure)(e,"textDocument"),"completion");t.dynamicRegistration=!0,t.contextSupport=!0,t.completionItem={snippetSupport:!0,commitCharactersSupport:!0,documentationFormat:[H.MarkupKind.Markdown,H.MarkupKind.PlainText],deprecatedSupport:!0,preselectSupport:!0,tagSupport:{valueSet:[H.CompletionItemTag.Deprecated]},insertReplaceSupport:!0,resolveSupport:{properties:["documentation","detail","additionalTextEdits"]},insertTextModeSupport:{valueSet:[H.InsertTextMode.asIs,H.InsertTextMode.adjustIndentation]},labelDetailsSupport:!0},t.insertTextMode=H.InsertTextMode.adjustIndentation,t.completionItemKind={valueSet:$u},t.completionList={itemDefaults:["commitCharacters","editRange","insertTextFormat","insertTextMode","data"]}}initialize(e,t){let n=this.getRegistrationOptions(t,e.completionProvider);n&&this.register({id:Hu.generateUuid(),registerOptions:n})}registerLanguageProvider(e,t){this.labelDetailsSupport.set(t,!!e.completionItem?.labelDetailsSupport);let n=e.triggerCharacters??[],i=e.allCommitCharacters,r=e.documentSelector,o={provideCompletionItems:(c,d,l,p)=>{let g=this._client,h=this._client.middleware,v=(f,y,w,b)=>g.sendRequest(H.CompletionRequest.type,g.code2ProtocolConverter.asCompletionParams(f,y,w),b).then(T=>b.isCancellationRequested?null:g.protocol2CodeConverter.asCompletionResult(T,i,b),T=>g.handleFailedRequest(H.CompletionRequest.type,b,T,null));return h.provideCompletionItem?h.provideCompletionItem(c,d,p,l,v):v(c,d,p,l)},resolveCompletionItem:e.resolveProvider?(c,d)=>{let l=this._client,p=this._client.middleware,g=(h,v)=>l.sendRequest(H.CompletionResolveRequest.type,l.code2ProtocolConverter.asCompletionItem(h,!!this.labelDetailsSupport.get(t)),v).then(f=>v.isCancellationRequested?null:l.protocol2CodeConverter.asCompletionItem(f),f=>l.handleFailedRequest(H.CompletionResolveRequest.type,v,f,h));return p.resolveCompletionItem?p.resolveCompletionItem(c,d,g):g(c,d)}:void 0};return[Ku.languages.registerCompletionItemProvider(this._client.protocol2CodeConverter.asDocumentSelector(r),o,...n),o]}};Si.CompletionItemFeature=Ks});var yc=F(_i=>{"use strict";Object.defineProperty(_i,"__esModule",{value:!0});_i.HoverFeature=void 0;var Wu=I("vscode"),mn=L(),Hs=W(),ju=te(),$s=class extends Hs.TextDocumentLanguageFeature{constructor(e){super(e,mn.HoverRequest.type)}fillClientCapabilities(e){let t=(0,Hs.ensure)((0,Hs.ensure)(e,"textDocument"),"hover");t.dynamicRegistration=!0,t.contentFormat=[mn.MarkupKind.Markdown,mn.MarkupKind.PlainText]}initialize(e,t){let n=this.getRegistrationOptions(t,e.hoverProvider);n&&this.register({id:ju.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideHover:(i,r,o)=>{let c=this._client,d=(p,g,h)=>c.sendRequest(mn.HoverRequest.type,c.code2ProtocolConverter.asTextDocumentPositionParams(p,g),h).then(v=>h.isCancellationRequested?null:c.protocol2CodeConverter.asHover(v),v=>c.handleFailedRequest(mn.HoverRequest.type,h,v,null)),l=c.middleware;return l.provideHover?l.provideHover(i,r,o,d):d(i,r,o)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return Wu.languages.registerHoverProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};_i.HoverFeature=$s});var Cc=F(bi=>{"use strict";Object.defineProperty(bi,"__esModule",{value:!0});bi.DefinitionFeature=void 0;var zu=I("vscode"),Ws=L(),js=W(),Vu=te(),zs=class extends js.TextDocumentLanguageFeature{constructor(e){super(e,Ws.DefinitionRequest.type)}fillClientCapabilities(e){let t=(0,js.ensure)((0,js.ensure)(e,"textDocument"),"definition");t.dynamicRegistration=!0,t.linkSupport=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.definitionProvider);n&&this.register({id:Vu.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDefinition:(i,r,o)=>{let c=this._client,d=(p,g,h)=>c.sendRequest(Ws.DefinitionRequest.type,c.code2ProtocolConverter.asTextDocumentPositionParams(p,g),h).then(v=>h.isCancellationRequested?null:c.protocol2CodeConverter.asDefinitionResult(v,h),v=>c.handleFailedRequest(Ws.DefinitionRequest.type,h,v,null)),l=c.middleware;return l.provideDefinition?l.provideDefinition(i,r,o,d):d(i,r,o)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return zu.languages.registerDefinitionProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};bi.DefinitionFeature=zs});var Dc=F(Ti=>{"use strict";Object.defineProperty(Ti,"__esModule",{value:!0});Ti.SignatureHelpFeature=void 0;var wc=I("vscode"),vn=L(),Vs=W(),Bu=te(),Bs=class extends Vs.TextDocumentLanguageFeature{constructor(e){super(e,vn.SignatureHelpRequest.type)}fillClientCapabilities(e){let t=(0,Vs.ensure)((0,Vs.ensure)(e,"textDocument"),"signatureHelp");t.dynamicRegistration=!0,t.signatureInformation={documentationFormat:[vn.MarkupKind.Markdown,vn.MarkupKind.PlainText]},t.signatureInformation.parameterInformation={labelOffsetSupport:!0},t.signatureInformation.activeParameterSupport=!0,t.contextSupport=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.signatureHelpProvider);n&&this.register({id:Bu.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t={provideSignatureHelp:(n,i,r,o)=>{let c=this._client,d=(p,g,h,v)=>c.sendRequest(vn.SignatureHelpRequest.type,c.code2ProtocolConverter.asSignatureHelpParams(p,g,h),v).then(f=>v.isCancellationRequested?null:c.protocol2CodeConverter.asSignatureHelp(f,v),f=>c.handleFailedRequest(vn.SignatureHelpRequest.type,v,f,null)),l=c.middleware;return l.provideSignatureHelp?l.provideSignatureHelp(n,i,o,r,d):d(n,i,o,r)}};return[this.registerProvider(e,t),t]}registerProvider(e,t){let n=this._client.protocol2CodeConverter.asDocumentSelector(e.documentSelector);if(e.retriggerCharacters===void 0){let i=e.triggerCharacters||[];return wc.languages.registerSignatureHelpProvider(n,t,...i)}else{let i={triggerCharacters:e.triggerCharacters||[],retriggerCharacters:e.retriggerCharacters||[]};return wc.languages.registerSignatureHelpProvider(n,t,i)}}};Ti.SignatureHelpFeature=Bs});var Sc=F(ki=>{"use strict";Object.defineProperty(ki,"__esModule",{value:!0});ki.DocumentHighlightFeature=void 0;var Ju=I("vscode"),Js=L(),Qs=W(),Qu=te(),Gs=class extends Qs.TextDocumentLanguageFeature{constructor(e){super(e,Js.DocumentHighlightRequest.type)}fillClientCapabilities(e){(0,Qs.ensure)((0,Qs.ensure)(e,"textDocument"),"documentHighlight").dynamicRegistration=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentHighlightProvider);n&&this.register({id:Qu.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDocumentHighlights:(i,r,o)=>{let c=this._client,d=(p,g,h)=>c.sendRequest(Js.DocumentHighlightRequest.type,c.code2ProtocolConverter.asTextDocumentPositionParams(p,g),h).then(v=>h.isCancellationRequested?null:c.protocol2CodeConverter.asDocumentHighlights(v,h),v=>c.handleFailedRequest(Js.DocumentHighlightRequest.type,h,v,null)),l=c.middleware;return l.provideDocumentHighlights?l.provideDocumentHighlights(i,r,o,d):d(i,r,o)}};return[Ju.languages.registerDocumentHighlightProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};ki.DocumentHighlightFeature=Gs});var Zs=F(Ge=>{"use strict";Object.defineProperty(Ge,"__esModule",{value:!0});Ge.DocumentSymbolFeature=Ge.SupportedSymbolTags=Ge.SupportedSymbolKinds=void 0;var Gu=I("vscode"),z=L(),Ys=W(),Yu=te();Ge.SupportedSymbolKinds=[z.SymbolKind.File,z.SymbolKind.Module,z.SymbolKind.Namespace,z.SymbolKind.Package,z.SymbolKind.Class,z.SymbolKind.Method,z.SymbolKind.Property,z.SymbolKind.Field,z.SymbolKind.Constructor,z.SymbolKind.Enum,z.SymbolKind.Interface,z.SymbolKind.Function,z.SymbolKind.Variable,z.SymbolKind.Constant,z.SymbolKind.String,z.SymbolKind.Number,z.SymbolKind.Boolean,z.SymbolKind.Array,z.SymbolKind.Object,z.SymbolKind.Key,z.SymbolKind.Null,z.SymbolKind.EnumMember,z.SymbolKind.Struct,z.SymbolKind.Event,z.SymbolKind.Operator,z.SymbolKind.TypeParameter];Ge.SupportedSymbolTags=[z.SymbolTag.Deprecated];var Xs=class extends Ys.TextDocumentLanguageFeature{constructor(e){super(e,z.DocumentSymbolRequest.type)}fillClientCapabilities(e){let t=(0,Ys.ensure)((0,Ys.ensure)(e,"textDocument"),"documentSymbol");t.dynamicRegistration=!0,t.symbolKind={valueSet:Ge.SupportedSymbolKinds},t.hierarchicalDocumentSymbolSupport=!0,t.tagSupport={valueSet:Ge.SupportedSymbolTags},t.labelSupport=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentSymbolProvider);n&&this.register({id:Yu.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDocumentSymbols:(r,o)=>{let c=this._client,d=async(p,g)=>{try{let h=await c.sendRequest(z.DocumentSymbolRequest.type,c.code2ProtocolConverter.asDocumentSymbolParams(p),g);if(g.isCancellationRequested||h===void 0||h===null)return null;if(h.length===0)return[];{let v=h[0];return z.DocumentSymbol.is(v)?await c.protocol2CodeConverter.asDocumentSymbols(h,g):await c.protocol2CodeConverter.asSymbolInformations(h,g)}}catch(h){return c.handleFailedRequest(z.DocumentSymbolRequest.type,g,h,null)}},l=c.middleware;return l.provideDocumentSymbols?l.provideDocumentSymbols(r,o,d):d(r,o)}},i=e.label!==void 0?{label:e.label}:void 0;return[Gu.languages.registerDocumentSymbolProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n,i),n]}};Ge.DocumentSymbolFeature=Xs});var bc=F(Pi=>{"use strict";Object.defineProperty(Pi,"__esModule",{value:!0});Pi.WorkspaceSymbolFeature=void 0;var Xu=I("vscode"),yn=L(),eo=W(),_c=Zs(),Zu=te(),to=class extends eo.WorkspaceFeature{constructor(e){super(e,yn.WorkspaceSymbolRequest.type)}fillClientCapabilities(e){let t=(0,eo.ensure)((0,eo.ensure)(e,"workspace"),"symbol");t.dynamicRegistration=!0,t.symbolKind={valueSet:_c.SupportedSymbolKinds},t.tagSupport={valueSet:_c.SupportedSymbolTags},t.resolveSupport={properties:["location.range"]}}initialize(e){e.workspaceSymbolProvider&&this.register({id:Zu.generateUuid(),registerOptions:e.workspaceSymbolProvider===!0?{workDoneProgress:!1}:e.workspaceSymbolProvider})}registerLanguageProvider(e){let t={provideWorkspaceSymbols:(n,i)=>{let r=this._client,o=(d,l)=>r.sendRequest(yn.WorkspaceSymbolRequest.type,{query:d},l).then(p=>l.isCancellationRequested?null:r.protocol2CodeConverter.asSymbolInformations(p,l),p=>r.handleFailedRequest(yn.WorkspaceSymbolRequest.type,l,p,null)),c=r.middleware;return c.provideWorkspaceSymbols?c.provideWorkspaceSymbols(n,i,o):o(n,i)},resolveWorkspaceSymbol:e.resolveProvider===!0?(n,i)=>{let r=this._client,o=(d,l)=>r.sendRequest(yn.WorkspaceSymbolResolveRequest.type,r.code2ProtocolConverter.asWorkspaceSymbol(d),l).then(p=>l.isCancellationRequested?null:r.protocol2CodeConverter.asSymbolInformation(p),p=>r.handleFailedRequest(yn.WorkspaceSymbolResolveRequest.type,l,p,null)),c=r.middleware;return c.resolveWorkspaceSymbol?c.resolveWorkspaceSymbol(n,i,o):o(n,i)}:void 0};return[Xu.languages.registerWorkspaceSymbolProvider(t),t]}};Pi.WorkspaceSymbolFeature=to});var Tc=F(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});Ri.ReferencesFeature=void 0;var el=I("vscode"),no=L(),io=W(),tl=te(),ro=class extends io.TextDocumentLanguageFeature{constructor(e){super(e,no.ReferencesRequest.type)}fillClientCapabilities(e){(0,io.ensure)((0,io.ensure)(e,"textDocument"),"references").dynamicRegistration=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.referencesProvider);n&&this.register({id:tl.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideReferences:(i,r,o,c)=>{let d=this._client,l=(g,h,v,f)=>d.sendRequest(no.ReferencesRequest.type,d.code2ProtocolConverter.asReferenceParams(g,h,v),f).then(y=>f.isCancellationRequested?null:d.protocol2CodeConverter.asReferences(y,f),y=>d.handleFailedRequest(no.ReferencesRequest.type,f,y,null)),p=d.middleware;return p.provideReferences?p.provideReferences(i,r,o,c,l):l(i,r,o,c)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return el.languages.registerReferenceProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Ri.ReferencesFeature=ro});var kc=F(xi=>{"use strict";Object.defineProperty(xi,"__esModule",{value:!0});xi.CodeActionFeature=void 0;var nl=I("vscode"),xe=L(),il=te(),so=W(),oo=class extends so.TextDocumentLanguageFeature{constructor(e){super(e,xe.CodeActionRequest.type)}fillClientCapabilities(e){let t=(0,so.ensure)((0,so.ensure)(e,"textDocument"),"codeAction");t.dynamicRegistration=!0,t.isPreferredSupport=!0,t.disabledSupport=!0,t.dataSupport=!0,t.resolveSupport={properties:["edit"]},t.codeActionLiteralSupport={codeActionKind:{valueSet:[xe.CodeActionKind.Empty,xe.CodeActionKind.QuickFix,xe.CodeActionKind.Refactor,xe.CodeActionKind.RefactorExtract,xe.CodeActionKind.RefactorInline,xe.CodeActionKind.RefactorRewrite,xe.CodeActionKind.Source,xe.CodeActionKind.SourceOrganizeImports]}},t.honorsChangeAnnotations=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.codeActionProvider);n&&this.register({id:il.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideCodeActions:(i,r,o,c)=>{let d=this._client,l=async(g,h,v,f)=>{let y={textDocument:d.code2ProtocolConverter.asTextDocumentIdentifier(g),range:d.code2ProtocolConverter.asRange(h),context:d.code2ProtocolConverter.asCodeActionContextSync(v)};return d.sendRequest(xe.CodeActionRequest.type,y,f).then(w=>f.isCancellationRequested||w===null||w===void 0?null:d.protocol2CodeConverter.asCodeActionResult(w,f),w=>d.handleFailedRequest(xe.CodeActionRequest.type,f,w,null))},p=d.middleware;return p.provideCodeActions?p.provideCodeActions(i,r,o,c,l):l(i,r,o,c)},resolveCodeAction:e.resolveProvider?(i,r)=>{let o=this._client,c=this._client.middleware,d=async(l,p)=>o.sendRequest(xe.CodeActionResolveRequest.type,o.code2ProtocolConverter.asCodeActionSync(l),p).then(g=>p.isCancellationRequested?l:o.protocol2CodeConverter.asCodeAction(g,p),g=>o.handleFailedRequest(xe.CodeActionResolveRequest.type,p,g,l));return c.resolveCodeAction?c.resolveCodeAction(i,r,d):d(i,r)}:void 0};return[nl.languages.registerCodeActionsProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n,e.codeActionKinds?{providedCodeActionKinds:this._client.protocol2CodeConverter.asCodeActionKinds(e.codeActionKinds)}:void 0),n]}};xi.CodeActionFeature=oo});var Rc=F(Fi=>{"use strict";Object.defineProperty(Fi,"__esModule",{value:!0});Fi.CodeLensFeature=void 0;var Pc=I("vscode"),Bt=L(),rl=te(),Cn=W(),ao=class extends Cn.TextDocumentLanguageFeature{constructor(e){super(e,Bt.CodeLensRequest.type)}fillClientCapabilities(e){(0,Cn.ensure)((0,Cn.ensure)(e,"textDocument"),"codeLens").dynamicRegistration=!0,(0,Cn.ensure)((0,Cn.ensure)(e,"workspace"),"codeLens").refreshSupport=!0}initialize(e,t){this._client.onRequest(Bt.CodeLensRefreshRequest.type,async()=>{for(let r of this.getAllProviders())r.onDidChangeCodeLensEmitter.fire()});let i=this.getRegistrationOptions(t,e.codeLensProvider);i&&this.register({id:rl.generateUuid(),registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n=new Pc.EventEmitter,i={onDidChangeCodeLenses:n.event,provideCodeLenses:(r,o)=>{let c=this._client,d=(p,g)=>c.sendRequest(Bt.CodeLensRequest.type,c.code2ProtocolConverter.asCodeLensParams(p),g).then(h=>g.isCancellationRequested?null:c.protocol2CodeConverter.asCodeLenses(h,g),h=>c.handleFailedRequest(Bt.CodeLensRequest.type,g,h,null)),l=c.middleware;return l.provideCodeLenses?l.provideCodeLenses(r,o,d):d(r,o)},resolveCodeLens:e.resolveProvider?(r,o)=>{let c=this._client,d=(p,g)=>c.sendRequest(Bt.CodeLensResolveRequest.type,c.code2ProtocolConverter.asCodeLens(p),g).then(h=>g.isCancellationRequested?p:c.protocol2CodeConverter.asCodeLens(h),h=>c.handleFailedRequest(Bt.CodeLensResolveRequest.type,g,h,p)),l=c.middleware;return l.resolveCodeLens?l.resolveCodeLens(r,o,d):d(r,o)}:void 0};return[Pc.languages.registerCodeLensProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),i),{provider:i,onDidChangeCodeLensEmitter:n}]}};Fi.CodeLensFeature=ao});var xc=F(vt=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});vt.DocumentOnTypeFormattingFeature=vt.DocumentRangeFormattingFeature=vt.DocumentFormattingFeature=void 0;var qi=I("vscode"),$e=L(),po=te(),it=W(),Jt;(function(s){function e(t){let n=qi.workspace.getConfiguration("files",t);return{trimTrailingWhitespace:n.get("trimTrailingWhitespace"),trimFinalNewlines:n.get("trimFinalNewlines"),insertFinalNewline:n.get("insertFinalNewline")}}s.fromConfiguration=e})(Jt||(Jt={}));var co=class extends it.TextDocumentLanguageFeature{constructor(e){super(e,$e.DocumentFormattingRequest.type)}fillClientCapabilities(e){(0,it.ensure)((0,it.ensure)(e,"textDocument"),"formatting").dynamicRegistration=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentFormattingProvider);n&&this.register({id:po.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDocumentFormattingEdits:(i,r,o)=>{let c=this._client,d=(p,g,h)=>{let v={textDocument:c.code2ProtocolConverter.asTextDocumentIdentifier(p),options:c.code2ProtocolConverter.asFormattingOptions(g,Jt.fromConfiguration(p))};return c.sendRequest($e.DocumentFormattingRequest.type,v,h).then(f=>h.isCancellationRequested?null:c.protocol2CodeConverter.asTextEdits(f,h),f=>c.handleFailedRequest($e.DocumentFormattingRequest.type,h,f,null))},l=c.middleware;return l.provideDocumentFormattingEdits?l.provideDocumentFormattingEdits(i,r,o,d):d(i,r,o)}};return[qi.languages.registerDocumentFormattingEditProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};vt.DocumentFormattingFeature=co;var uo=class extends it.TextDocumentLanguageFeature{constructor(e){super(e,$e.DocumentRangeFormattingRequest.type)}fillClientCapabilities(e){let t=(0,it.ensure)((0,it.ensure)(e,"textDocument"),"rangeFormatting");t.dynamicRegistration=!0,t.rangesSupport=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentRangeFormattingProvider);n&&this.register({id:po.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDocumentRangeFormattingEdits:(i,r,o,c)=>{let d=this._client,l=(g,h,v,f)=>{let y={textDocument:d.code2ProtocolConverter.asTextDocumentIdentifier(g),range:d.code2ProtocolConverter.asRange(h),options:d.code2ProtocolConverter.asFormattingOptions(v,Jt.fromConfiguration(g))};return d.sendRequest($e.DocumentRangeFormattingRequest.type,y,f).then(w=>f.isCancellationRequested?null:d.protocol2CodeConverter.asTextEdits(w,f),w=>d.handleFailedRequest($e.DocumentRangeFormattingRequest.type,f,w,null))},p=d.middleware;return p.provideDocumentRangeFormattingEdits?p.provideDocumentRangeFormattingEdits(i,r,o,c,l):l(i,r,o,c)}};return e.rangesSupport&&(n.provideDocumentRangesFormattingEdits=(i,r,o,c)=>{let d=this._client,l=(g,h,v,f)=>{let y={textDocument:d.code2ProtocolConverter.asTextDocumentIdentifier(g),ranges:d.code2ProtocolConverter.asRanges(h),options:d.code2ProtocolConverter.asFormattingOptions(v,Jt.fromConfiguration(g))};return d.sendRequest($e.DocumentRangesFormattingRequest.type,y,f).then(w=>f.isCancellationRequested?null:d.protocol2CodeConverter.asTextEdits(w,f),w=>d.handleFailedRequest($e.DocumentRangesFormattingRequest.type,f,w,null))},p=d.middleware;return p.provideDocumentRangesFormattingEdits?p.provideDocumentRangesFormattingEdits(i,r,o,c,l):l(i,r,o,c)}),[qi.languages.registerDocumentRangeFormattingEditProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};vt.DocumentRangeFormattingFeature=uo;var lo=class extends it.TextDocumentLanguageFeature{constructor(e){super(e,$e.DocumentOnTypeFormattingRequest.type)}fillClientCapabilities(e){(0,it.ensure)((0,it.ensure)(e,"textDocument"),"onTypeFormatting").dynamicRegistration=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentOnTypeFormattingProvider);n&&this.register({id:po.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideOnTypeFormattingEdits:(r,o,c,d,l)=>{let p=this._client,g=(v,f,y,w,b)=>{let T={textDocument:p.code2ProtocolConverter.asTextDocumentIdentifier(v),position:p.code2ProtocolConverter.asPosition(f),ch:y,options:p.code2ProtocolConverter.asFormattingOptions(w,Jt.fromConfiguration(v))};return p.sendRequest($e.DocumentOnTypeFormattingRequest.type,T,b).then(P=>b.isCancellationRequested?null:p.protocol2CodeConverter.asTextEdits(P,b),P=>p.handleFailedRequest($e.DocumentOnTypeFormattingRequest.type,b,P,null))},h=p.middleware;return h.provideOnTypeFormattingEdits?h.provideOnTypeFormattingEdits(r,o,c,d,l,g):g(r,o,c,d,l)}},i=e.moreTriggerCharacter||[];return[qi.languages.registerOnTypeFormattingEditProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n,e.firstTriggerCharacter,...i),n]}};vt.DocumentOnTypeFormattingFeature=lo});var qc=F(Ii=>{"use strict";Object.defineProperty(Ii,"__esModule",{value:!0});Ii.RenameFeature=void 0;var sl=I("vscode"),Pt=L(),ol=te(),Fc=Ee(),fo=W(),ho=class extends fo.TextDocumentLanguageFeature{constructor(e){super(e,Pt.RenameRequest.type)}fillClientCapabilities(e){let t=(0,fo.ensure)((0,fo.ensure)(e,"textDocument"),"rename");t.dynamicRegistration=!0,t.prepareSupport=!0,t.prepareSupportDefaultBehavior=Pt.PrepareSupportDefaultBehavior.Identifier,t.honorsChangeAnnotations=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.renameProvider);n&&(Fc.boolean(e.renameProvider)&&(n.prepareProvider=!1),this.register({id:ol.generateUuid(),registerOptions:n}))}registerLanguageProvider(e){let t=e.documentSelector,n={provideRenameEdits:(i,r,o,c)=>{let d=this._client,l=(g,h,v,f)=>{let y={textDocument:d.code2ProtocolConverter.asTextDocumentIdentifier(g),position:d.code2ProtocolConverter.asPosition(h),newName:v};return d.sendRequest(Pt.RenameRequest.type,y,f).then(w=>f.isCancellationRequested?null:d.protocol2CodeConverter.asWorkspaceEdit(w,f),w=>d.handleFailedRequest(Pt.RenameRequest.type,f,w,null,!1))},p=d.middleware;return p.provideRenameEdits?p.provideRenameEdits(i,r,o,c,l):l(i,r,o,c)},prepareRename:e.prepareProvider?(i,r,o)=>{let c=this._client,d=(p,g,h)=>{let v={textDocument:c.code2ProtocolConverter.asTextDocumentIdentifier(p),position:c.code2ProtocolConverter.asPosition(g)};return c.sendRequest(Pt.PrepareRenameRequest.type,v,h).then(f=>h.isCancellationRequested?null:Pt.Range.is(f)?c.protocol2CodeConverter.asRange(f):this.isDefaultBehavior(f)?f.defaultBehavior===!0?null:Promise.reject(new Error("The element can't be renamed.")):f&&Pt.Range.is(f.range)?{range:c.protocol2CodeConverter.asRange(f.range),placeholder:f.placeholder}:Promise.reject(new Error("The element can't be renamed.")),f=>{throw typeof f.message=="string"?new Error(f.message):new Error("The element can't be renamed.")})},l=c.middleware;return l.prepareRename?l.prepareRename(i,r,o,d):d(i,r,o)}:void 0};return[this.registerProvider(t,n),n]}registerProvider(e,t){return sl.languages.registerRenameProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}isDefaultBehavior(e){let t=e;return t&&Fc.boolean(t.defaultBehavior)}};Ii.RenameFeature=ho});var Ic=F(Ei=>{"use strict";Object.defineProperty(Ei,"__esModule",{value:!0});Ei.DocumentLinkFeature=void 0;var al=I("vscode"),wn=L(),go=W(),cl=te(),mo=class extends go.TextDocumentLanguageFeature{constructor(e){super(e,wn.DocumentLinkRequest.type)}fillClientCapabilities(e){let t=(0,go.ensure)((0,go.ensure)(e,"textDocument"),"documentLink");t.dynamicRegistration=!0,t.tooltipSupport=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentLinkProvider);n&&this.register({id:cl.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDocumentLinks:(i,r)=>{let o=this._client,c=(l,p)=>o.sendRequest(wn.DocumentLinkRequest.type,o.code2ProtocolConverter.asDocumentLinkParams(l),p).then(g=>p.isCancellationRequested?null:o.protocol2CodeConverter.asDocumentLinks(g,p),g=>o.handleFailedRequest(wn.DocumentLinkRequest.type,p,g,null)),d=o.middleware;return d.provideDocumentLinks?d.provideDocumentLinks(i,r,c):c(i,r)},resolveDocumentLink:e.resolveProvider?(i,r)=>{let o=this._client,c=(l,p)=>o.sendRequest(wn.DocumentLinkResolveRequest.type,o.code2ProtocolConverter.asDocumentLink(l),p).then(g=>p.isCancellationRequested?l:o.protocol2CodeConverter.asDocumentLink(g),g=>o.handleFailedRequest(wn.DocumentLinkResolveRequest.type,p,g,l)),d=o.middleware;return d.resolveDocumentLink?d.resolveDocumentLink(i,r,c):c(i,r)}:void 0};return[al.languages.registerDocumentLinkProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};Ei.DocumentLinkFeature=mo});var Mc=F(Mi=>{"use strict";Object.defineProperty(Mi,"__esModule",{value:!0});Mi.ExecuteCommandFeature=void 0;var dl=I("vscode"),vo=L(),ul=te(),Ec=W(),yo=class{constructor(e){this._client=e,this._commands=new Map}getState(){return{kind:"workspace",id:this.registrationType.method,registrations:this._commands.size>0}}get registrationType(){return vo.ExecuteCommandRequest.type}fillClientCapabilities(e){(0,Ec.ensure)((0,Ec.ensure)(e,"workspace"),"executeCommand").dynamicRegistration=!0}initialize(e){e.executeCommandProvider&&this.register({id:ul.generateUuid(),registerOptions:Object.assign({},e.executeCommandProvider)})}register(e){let t=this._client,n=t.middleware,i=(r,o)=>{let c={command:r,arguments:o};return t.sendRequest(vo.ExecuteCommandRequest.type,c).then(void 0,d=>t.handleFailedRequest(vo.ExecuteCommandRequest.type,void 0,d,void 0))};if(e.registerOptions.commands){let r=[];for(let o of e.registerOptions.commands)r.push(dl.commands.registerCommand(o,(...c)=>n.executeCommand?n.executeCommand(o,c,i):i(o,c)));this._commands.set(e.id,r)}}unregister(e){let t=this._commands.get(e);t&&t.forEach(n=>n.dispose())}clear(){this._commands.forEach(e=>{e.forEach(t=>t.dispose())}),this._commands.clear()}};Mi.ExecuteCommandFeature=yo});var Oc=F(Ai=>{"use strict";Object.defineProperty(Ai,"__esModule",{value:!0});Ai.FileSystemWatcherFeature=void 0;var ll=I("vscode"),Rt=L(),Oi=W(),Co=class{constructor(e,t){this._client=e,this._notifyFileEvent=t,this._watchers=new Map}getState(){return{kind:"workspace",id:this.registrationType.method,registrations:this._watchers.size>0}}get registrationType(){return Rt.DidChangeWatchedFilesNotification.type}fillClientCapabilities(e){(0,Oi.ensure)((0,Oi.ensure)(e,"workspace"),"didChangeWatchedFiles").dynamicRegistration=!0,(0,Oi.ensure)((0,Oi.ensure)(e,"workspace"),"didChangeWatchedFiles").relativePatternSupport=!0}initialize(e,t){}register(e){if(!Array.isArray(e.registerOptions.watchers))return;let t=[];for(let n of e.registerOptions.watchers){let i=this._client.protocol2CodeConverter.asGlobPattern(n.globPattern);if(i===void 0)continue;let r=!0,o=!0,c=!0;n.kind!==void 0&&n.kind!==null&&(r=(n.kind&Rt.WatchKind.Create)!==0,o=(n.kind&Rt.WatchKind.Change)!==0,c=(n.kind&Rt.WatchKind.Delete)!==0);let d=ll.workspace.createFileSystemWatcher(i,!r,!o,!c);this.hookListeners(d,r,o,c,t),t.push(d)}this._watchers.set(e.id,t)}registerRaw(e,t){let n=[];for(let i of t)this.hookListeners(i,!0,!0,!0,n);this._watchers.set(e,n)}hookListeners(e,t,n,i,r){t&&e.onDidCreate(o=>this._notifyFileEvent({uri:this._client.code2ProtocolConverter.asUri(o),type:Rt.FileChangeType.Created}),null,r),n&&e.onDidChange(o=>this._notifyFileEvent({uri:this._client.code2ProtocolConverter.asUri(o),type:Rt.FileChangeType.Changed}),null,r),i&&e.onDidDelete(o=>this._notifyFileEvent({uri:this._client.code2ProtocolConverter.asUri(o),type:Rt.FileChangeType.Deleted}),null,r)}unregister(e){let t=this._watchers.get(e);if(t)for(let n of t)n.dispose()}clear(){this._watchers.forEach(e=>{for(let t of e)t.dispose()}),this._watchers.clear()}};Ai.FileSystemWatcherFeature=Co});var Ac=F(Li=>{"use strict";Object.defineProperty(Li,"__esModule",{value:!0});Li.ColorProviderFeature=void 0;var pl=I("vscode"),Dn=L(),wo=W(),Do=class extends wo.TextDocumentLanguageFeature{constructor(e){super(e,Dn.DocumentColorRequest.type)}fillClientCapabilities(e){(0,wo.ensure)((0,wo.ensure)(e,"textDocument"),"colorProvider").dynamicRegistration=!0}initialize(e,t){let[n,i]=this.getRegistration(t,e.colorProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n={provideColorPresentations:(i,r,o)=>{let c=this._client,d=(p,g,h)=>{let v={color:p,textDocument:c.code2ProtocolConverter.asTextDocumentIdentifier(g.document),range:c.code2ProtocolConverter.asRange(g.range)};return c.sendRequest(Dn.ColorPresentationRequest.type,v,h).then(f=>h.isCancellationRequested?null:this._client.protocol2CodeConverter.asColorPresentations(f,h),f=>c.handleFailedRequest(Dn.ColorPresentationRequest.type,h,f,null))},l=c.middleware;return l.provideColorPresentations?l.provideColorPresentations(i,r,o,d):d(i,r,o)},provideDocumentColors:(i,r)=>{let o=this._client,c=(l,p)=>{let g={textDocument:o.code2ProtocolConverter.asTextDocumentIdentifier(l)};return o.sendRequest(Dn.DocumentColorRequest.type,g,p).then(h=>p.isCancellationRequested?null:this._client.protocol2CodeConverter.asColorInformations(h,p),h=>o.handleFailedRequest(Dn.DocumentColorRequest.type,p,h,null))},d=o.middleware;return d.provideDocumentColors?d.provideDocumentColors(i,r,c):c(i,r)}};return[pl.languages.registerColorProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};Li.ColorProviderFeature=Do});var Lc=F(Ui=>{"use strict";Object.defineProperty(Ui,"__esModule",{value:!0});Ui.ImplementationFeature=void 0;var fl=I("vscode"),So=L(),_o=W(),bo=class extends _o.TextDocumentLanguageFeature{constructor(e){super(e,So.ImplementationRequest.type)}fillClientCapabilities(e){let t=(0,_o.ensure)((0,_o.ensure)(e,"textDocument"),"implementation");t.dynamicRegistration=!0,t.linkSupport=!0}initialize(e,t){let[n,i]=this.getRegistration(t,e.implementationProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n={provideImplementation:(i,r,o)=>{let c=this._client,d=(p,g,h)=>c.sendRequest(So.ImplementationRequest.type,c.code2ProtocolConverter.asTextDocumentPositionParams(p,g),h).then(v=>h.isCancellationRequested?null:c.protocol2CodeConverter.asDefinitionResult(v,h),v=>c.handleFailedRequest(So.ImplementationRequest.type,h,v,null)),l=c.middleware;return l.provideImplementation?l.provideImplementation(i,r,o,d):d(i,r,o)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return fl.languages.registerImplementationProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Ui.ImplementationFeature=bo});var Uc=F(Ni=>{"use strict";Object.defineProperty(Ni,"__esModule",{value:!0});Ni.TypeDefinitionFeature=void 0;var hl=I("vscode"),To=L(),Sn=W(),ko=class extends Sn.TextDocumentLanguageFeature{constructor(e){super(e,To.TypeDefinitionRequest.type)}fillClientCapabilities(e){(0,Sn.ensure)((0,Sn.ensure)(e,"textDocument"),"typeDefinition").dynamicRegistration=!0;let t=(0,Sn.ensure)((0,Sn.ensure)(e,"textDocument"),"typeDefinition");t.dynamicRegistration=!0,t.linkSupport=!0}initialize(e,t){let[n,i]=this.getRegistration(t,e.typeDefinitionProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n={provideTypeDefinition:(i,r,o)=>{let c=this._client,d=(p,g,h)=>c.sendRequest(To.TypeDefinitionRequest.type,c.code2ProtocolConverter.asTextDocumentPositionParams(p,g),h).then(v=>h.isCancellationRequested?null:c.protocol2CodeConverter.asDefinitionResult(v,h),v=>c.handleFailedRequest(To.TypeDefinitionRequest.type,h,v,null)),l=c.middleware;return l.provideTypeDefinition?l.provideTypeDefinition(i,r,o,d):d(i,r,o)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return hl.languages.registerTypeDefinitionProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Ni.TypeDefinitionFeature=ko});var Nc=F(Qt=>{"use strict";Object.defineProperty(Qt,"__esModule",{value:!0});Qt.WorkspaceFoldersFeature=Qt.arrayDiff=void 0;var gl=te(),Ki=I("vscode"),_n=L();function Po(s,e){if(s!=null)return s[e]}function Ro(s,e){return s.filter(t=>e.indexOf(t)<0)}Qt.arrayDiff=Ro;var xo=class{constructor(e){this._client=e,this._listeners=new Map}getState(){return{kind:"workspace",id:this.registrationType.method,registrations:this._listeners.size>0}}get registrationType(){return _n.DidChangeWorkspaceFoldersNotification.type}fillInitializeParams(e){let t=Ki.workspace.workspaceFolders;this.initializeWithFolders(t),t===void 0?e.workspaceFolders=null:e.workspaceFolders=t.map(n=>this.asProtocol(n))}initializeWithFolders(e){this._initialFolders=e}fillClientCapabilities(e){e.workspace=e.workspace||{},e.workspace.workspaceFolders=!0}initialize(e){let t=this._client;t.onRequest(_n.WorkspaceFoldersRequest.type,r=>{let o=()=>{let d=Ki.workspace.workspaceFolders;return d===void 0?null:d.map(p=>this.asProtocol(p))},c=t.middleware.workspace;return c&&c.workspaceFolders?c.workspaceFolders(r,o):o(r)});let n=Po(Po(Po(e,"workspace"),"workspaceFolders"),"changeNotifications"),i;typeof n=="string"?i=n:n===!0&&(i=gl.generateUuid()),i&&this.register({id:i,registerOptions:void 0})}sendInitialEvent(e){let t;if(this._initialFolders&&e){let n=Ro(this._initialFolders,e),i=Ro(e,this._initialFolders);(i.length>0||n.length>0)&&(t=this.doSendEvent(i,n))}else this._initialFolders?t=this.doSendEvent([],this._initialFolders):e&&(t=this.doSendEvent(e,[]));t!==void 0&&t.catch(n=>{this._client.error(`Sending notification ${_n.DidChangeWorkspaceFoldersNotification.type.method} failed`,n)})}doSendEvent(e,t){let n={event:{added:e.map(i=>this.asProtocol(i)),removed:t.map(i=>this.asProtocol(i))}};return this._client.sendNotification(_n.DidChangeWorkspaceFoldersNotification.type,n)}register(e){let t=e.id,n=this._client,i=Ki.workspace.onDidChangeWorkspaceFolders(r=>{let o=l=>this.doSendEvent(l.added,l.removed),c=n.middleware.workspace;(c&&c.didChangeWorkspaceFolders?c.didChangeWorkspaceFolders(r,o):o(r)).catch(l=>{this._client.error(`Sending notification ${_n.DidChangeWorkspaceFoldersNotification.type.method} failed`,l)})});this._listeners.set(t,i),this.sendInitialEvent(Ki.workspace.workspaceFolders)}unregister(e){let t=this._listeners.get(e);t!==void 0&&(this._listeners.delete(e),t.dispose())}clear(){for(let e of this._listeners.values())e.dispose();this._listeners.clear()}asProtocol(e){return e===void 0?null:{uri:this._client.code2ProtocolConverter.asUri(e.uri),name:e.name}}};Qt.WorkspaceFoldersFeature=xo});var Hc=F(Hi=>{"use strict";Object.defineProperty(Hi,"__esModule",{value:!0});Hi.FoldingRangeFeature=void 0;var Kc=I("vscode"),xt=L(),bn=W(),Fo=class extends bn.TextDocumentLanguageFeature{constructor(e){super(e,xt.FoldingRangeRequest.type)}fillClientCapabilities(e){let t=(0,bn.ensure)((0,bn.ensure)(e,"textDocument"),"foldingRange");t.dynamicRegistration=!0,t.rangeLimit=5e3,t.lineFoldingOnly=!0,t.foldingRangeKind={valueSet:[xt.FoldingRangeKind.Comment,xt.FoldingRangeKind.Imports,xt.FoldingRangeKind.Region]},t.foldingRange={collapsedText:!1},(0,bn.ensure)((0,bn.ensure)(e,"workspace"),"foldingRange").refreshSupport=!0}initialize(e,t){this._client.onRequest(xt.FoldingRangeRefreshRequest.type,async()=>{for(let r of this.getAllProviders())r.onDidChangeFoldingRange.fire()});let[n,i]=this.getRegistration(t,e.foldingRangeProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n=new Kc.EventEmitter,i={onDidChangeFoldingRanges:n.event,provideFoldingRanges:(r,o,c)=>{let d=this._client,l=(g,h,v)=>{let f={textDocument:d.code2ProtocolConverter.asTextDocumentIdentifier(g)};return d.sendRequest(xt.FoldingRangeRequest.type,f,v).then(y=>v.isCancellationRequested?null:d.protocol2CodeConverter.asFoldingRanges(y,v),y=>d.handleFailedRequest(xt.FoldingRangeRequest.type,v,y,null))},p=d.middleware;return p.provideFoldingRanges?p.provideFoldingRanges(r,o,c,l):l(r,o,c)}};return[Kc.languages.registerFoldingRangeProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),i),{provider:i,onDidChangeFoldingRange:n}]}};Hi.FoldingRangeFeature=Fo});var $c=F($i=>{"use strict";Object.defineProperty($i,"__esModule",{value:!0});$i.DeclarationFeature=void 0;var ml=I("vscode"),qo=L(),Io=W(),Eo=class extends Io.TextDocumentLanguageFeature{constructor(e){super(e,qo.DeclarationRequest.type)}fillClientCapabilities(e){let t=(0,Io.ensure)((0,Io.ensure)(e,"textDocument"),"declaration");t.dynamicRegistration=!0,t.linkSupport=!0}initialize(e,t){let[n,i]=this.getRegistration(t,e.declarationProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDeclaration:(i,r,o)=>{let c=this._client,d=(p,g,h)=>c.sendRequest(qo.DeclarationRequest.type,c.code2ProtocolConverter.asTextDocumentPositionParams(p,g),h).then(v=>h.isCancellationRequested?null:c.protocol2CodeConverter.asDeclarationResult(v,h),v=>c.handleFailedRequest(qo.DeclarationRequest.type,h,v,null)),l=c.middleware;return l.provideDeclaration?l.provideDeclaration(i,r,o,d):d(i,r,o)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return ml.languages.registerDeclarationProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};$i.DeclarationFeature=Eo});var Wc=F(Wi=>{"use strict";Object.defineProperty(Wi,"__esModule",{value:!0});Wi.SelectionRangeFeature=void 0;var vl=I("vscode"),Mo=L(),Oo=W(),Ao=class extends Oo.TextDocumentLanguageFeature{constructor(e){super(e,Mo.SelectionRangeRequest.type)}fillClientCapabilities(e){let t=(0,Oo.ensure)((0,Oo.ensure)(e,"textDocument"),"selectionRange");t.dynamicRegistration=!0}initialize(e,t){let[n,i]=this.getRegistration(t,e.selectionRangeProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n={provideSelectionRanges:(i,r,o)=>{let c=this._client,d=async(p,g,h)=>{let v={textDocument:c.code2ProtocolConverter.asTextDocumentIdentifier(p),positions:c.code2ProtocolConverter.asPositionsSync(g,h)};return c.sendRequest(Mo.SelectionRangeRequest.type,v,h).then(f=>h.isCancellationRequested?null:c.protocol2CodeConverter.asSelectionRanges(f,h),f=>c.handleFailedRequest(Mo.SelectionRangeRequest.type,h,f,null))},l=c.middleware;return l.provideSelectionRanges?l.provideSelectionRanges(i,r,o,d):d(i,r,o)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return vl.languages.registerSelectionRangeProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Wi.SelectionRangeFeature=Ao});var zc=F(ji=>{"use strict";Object.defineProperty(ji,"__esModule",{value:!0});ji.ProgressFeature=void 0;var jc=L(),yl=gs();function Cl(s,e){return s[e]===void 0&&(s[e]=Object.create(null)),s[e]}var Lo=class{constructor(e){this._client=e,this.activeParts=new Set}getState(){return{kind:"window",id:jc.WorkDoneProgressCreateRequest.method,registrations:this.activeParts.size>0}}fillClientCapabilities(e){Cl(e,"window").workDoneProgress=!0}initialize(){let e=this._client,t=i=>{this.activeParts.delete(i)},n=i=>{this.activeParts.add(new yl.ProgressPart(this._client,i.token,t))};e.onRequest(jc.WorkDoneProgressCreateRequest.type,n)}clear(){for(let e of this.activeParts)e.done();this.activeParts.clear()}};ji.ProgressFeature=Lo});var Vc=F(zi=>{"use strict";Object.defineProperty(zi,"__esModule",{value:!0});zi.CallHierarchyFeature=void 0;var wl=I("vscode"),Ft=L(),Uo=W(),No=class{constructor(e){this.client=e,this.middleware=e.middleware}prepareCallHierarchy(e,t,n){let i=this.client,r=this.middleware,o=(c,d,l)=>{let p=i.code2ProtocolConverter.asTextDocumentPositionParams(c,d);return i.sendRequest(Ft.CallHierarchyPrepareRequest.type,p,l).then(g=>l.isCancellationRequested?null:i.protocol2CodeConverter.asCallHierarchyItems(g,l),g=>i.handleFailedRequest(Ft.CallHierarchyPrepareRequest.type,l,g,null))};return r.prepareCallHierarchy?r.prepareCallHierarchy(e,t,n,o):o(e,t,n)}provideCallHierarchyIncomingCalls(e,t){let n=this.client,i=this.middleware,r=(o,c)=>{let d={item:n.code2ProtocolConverter.asCallHierarchyItem(o)};return n.sendRequest(Ft.CallHierarchyIncomingCallsRequest.type,d,c).then(l=>c.isCancellationRequested?null:n.protocol2CodeConverter.asCallHierarchyIncomingCalls(l,c),l=>n.handleFailedRequest(Ft.CallHierarchyIncomingCallsRequest.type,c,l,null))};return i.provideCallHierarchyIncomingCalls?i.provideCallHierarchyIncomingCalls(e,t,r):r(e,t)}provideCallHierarchyOutgoingCalls(e,t){let n=this.client,i=this.middleware,r=(o,c)=>{let d={item:n.code2ProtocolConverter.asCallHierarchyItem(o)};return n.sendRequest(Ft.CallHierarchyOutgoingCallsRequest.type,d,c).then(l=>c.isCancellationRequested?null:n.protocol2CodeConverter.asCallHierarchyOutgoingCalls(l,c),l=>n.handleFailedRequest(Ft.CallHierarchyOutgoingCallsRequest.type,c,l,null))};return i.provideCallHierarchyOutgoingCalls?i.provideCallHierarchyOutgoingCalls(e,t,r):r(e,t)}},Ko=class extends Uo.TextDocumentLanguageFeature{constructor(e){super(e,Ft.CallHierarchyPrepareRequest.type)}fillClientCapabilities(e){let t=e,n=(0,Uo.ensure)((0,Uo.ensure)(t,"textDocument"),"callHierarchy");n.dynamicRegistration=!0}initialize(e,t){let[n,i]=this.getRegistration(t,e.callHierarchyProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=this._client,n=new No(t);return[wl.languages.registerCallHierarchyProvider(this._client.protocol2CodeConverter.asDocumentSelector(e.documentSelector),n),n]}};zi.CallHierarchyFeature=Ko});var Bc=F(Bi=>{"use strict";Object.defineProperty(Bi,"__esModule",{value:!0});Bi.SemanticTokensFeature=void 0;var Vi=I("vscode"),U=L(),Tn=W(),Dl=Ee(),Ho=class extends Tn.TextDocumentLanguageFeature{constructor(e){super(e,U.SemanticTokensRegistrationType.type)}fillClientCapabilities(e){let t=(0,Tn.ensure)((0,Tn.ensure)(e,"textDocument"),"semanticTokens");t.dynamicRegistration=!0,t.tokenTypes=[U.SemanticTokenTypes.namespace,U.SemanticTokenTypes.type,U.SemanticTokenTypes.class,U.SemanticTokenTypes.enum,U.SemanticTokenTypes.interface,U.SemanticTokenTypes.struct,U.SemanticTokenTypes.typeParameter,U.SemanticTokenTypes.parameter,U.SemanticTokenTypes.variable,U.SemanticTokenTypes.property,U.SemanticTokenTypes.enumMember,U.SemanticTokenTypes.event,U.SemanticTokenTypes.function,U.SemanticTokenTypes.method,U.SemanticTokenTypes.macro,U.SemanticTokenTypes.keyword,U.SemanticTokenTypes.modifier,U.SemanticTokenTypes.comment,U.SemanticTokenTypes.string,U.SemanticTokenTypes.number,U.SemanticTokenTypes.regexp,U.SemanticTokenTypes.operator,U.SemanticTokenTypes.decorator],t.tokenModifiers=[U.SemanticTokenModifiers.declaration,U.SemanticTokenModifiers.definition,U.SemanticTokenModifiers.readonly,U.SemanticTokenModifiers.static,U.SemanticTokenModifiers.deprecated,U.SemanticTokenModifiers.abstract,U.SemanticTokenModifiers.async,U.SemanticTokenModifiers.modification,U.SemanticTokenModifiers.documentation,U.SemanticTokenModifiers.defaultLibrary],t.formats=[U.TokenFormat.Relative],t.requests={range:!0,full:{delta:!0}},t.multilineTokenSupport=!1,t.overlappingTokenSupport=!1,t.serverCancelSupport=!0,t.augmentsSyntaxTokens=!0,(0,Tn.ensure)((0,Tn.ensure)(e,"workspace"),"semanticTokens").refreshSupport=!0}initialize(e,t){this._client.onRequest(U.SemanticTokensRefreshRequest.type,async()=>{for(let o of this.getAllProviders())o.onDidChangeSemanticTokensEmitter.fire()});let[i,r]=this.getRegistration(t,e.semanticTokensProvider);!i||!r||this.register({id:i,registerOptions:r})}registerLanguageProvider(e){let t=e.documentSelector,n=Dl.boolean(e.full)?e.full:e.full!==void 0,i=e.full!==void 0&&typeof e.full!="boolean"&&e.full.delta===!0,r=new Vi.EventEmitter,o=n?{onDidChangeSemanticTokens:r.event,provideDocumentSemanticTokens:(v,f)=>{let y=this._client,w=y.middleware,b=(T,P)=>{let q={textDocument:y.code2ProtocolConverter.asTextDocumentIdentifier(T)};return y.sendRequest(U.SemanticTokensRequest.type,q,P).then(ce=>P.isCancellationRequested?null:y.protocol2CodeConverter.asSemanticTokens(ce,P),ce=>y.handleFailedRequest(U.SemanticTokensRequest.type,P,ce,null))};return w.provideDocumentSemanticTokens?w.provideDocumentSemanticTokens(v,f,b):b(v,f)},provideDocumentSemanticTokensEdits:i?(v,f,y)=>{let w=this._client,b=w.middleware,T=(P,q,ce)=>{let V={textDocument:w.code2ProtocolConverter.asTextDocumentIdentifier(P),previousResultId:q};return w.sendRequest(U.SemanticTokensDeltaRequest.type,V,ce).then(async Z=>ce.isCancellationRequested?null:U.SemanticTokens.is(Z)?await w.protocol2CodeConverter.asSemanticTokens(Z,ce):await w.protocol2CodeConverter.asSemanticTokensEdits(Z,ce),Z=>w.handleFailedRequest(U.SemanticTokensDeltaRequest.type,ce,Z,null))};return b.provideDocumentSemanticTokensEdits?b.provideDocumentSemanticTokensEdits(v,f,y,T):T(v,f,y)}:void 0}:void 0,d=e.range===!0?{provideDocumentRangeSemanticTokens:(v,f,y)=>{let w=this._client,b=w.middleware,T=(P,q,ce)=>{let V={textDocument:w.code2ProtocolConverter.asTextDocumentIdentifier(P),range:w.code2ProtocolConverter.asRange(q)};return w.sendRequest(U.SemanticTokensRangeRequest.type,V,ce).then(Z=>ce.isCancellationRequested?null:w.protocol2CodeConverter.asSemanticTokens(Z,ce),Z=>w.handleFailedRequest(U.SemanticTokensRangeRequest.type,ce,Z,null))};return b.provideDocumentRangeSemanticTokens?b.provideDocumentRangeSemanticTokens(v,f,y,T):T(v,f,y)}}:void 0,l=[],p=this._client,g=p.protocol2CodeConverter.asSemanticTokensLegend(e.legend),h=p.protocol2CodeConverter.asDocumentSelector(t);return o!==void 0&&l.push(Vi.languages.registerDocumentSemanticTokensProvider(h,o,g)),d!==void 0&&l.push(Vi.languages.registerDocumentRangeSemanticTokensProvider(h,d,g)),[new Vi.Disposable(()=>l.forEach(v=>v.dispose())),{range:d,full:o,onDidChangeSemanticTokensEmitter:r}]}};Bi.SemanticTokensFeature=Ho});var Gc=F(be=>{"use strict";Object.defineProperty(be,"__esModule",{value:!0});be.WillDeleteFilesFeature=be.WillRenameFilesFeature=be.WillCreateFilesFeature=be.DidDeleteFilesFeature=be.DidRenameFilesFeature=be.DidCreateFilesFeature=void 0;var Le=I("vscode"),Sl=kr(),rt=L(),_l=te();function Jc(s,e){return s[e]===void 0&&(s[e]={}),s[e]}function bl(s,e){return s[e]}function Qc(s,e,t){s[e]=t}var kn=class s{constructor(e,t,n,i,r){this._client=e,this._event=t,this._registrationType=n,this._clientCapability=i,this._serverCapability=r,this._filters=new Map}getState(){return{kind:"workspace",id:this._registrationType.method,registrations:this._filters.size>0}}filterSize(){return this._filters.size}get registrationType(){return this._registrationType}fillClientCapabilities(e){let t=Jc(Jc(e,"workspace"),"fileOperations");Qc(t,"dynamicRegistration",!0),Qc(t,this._clientCapability,!0)}initialize(e){let t=e.workspace?.fileOperations,n=t!==void 0?bl(t,this._serverCapability):void 0;if(n?.filters!==void 0)try{this.register({id:_l.generateUuid(),registerOptions:{filters:n.filters}})}catch(i){this._client.warn(`Ignoring invalid glob pattern for ${this._serverCapability} registration: ${i}`)}}register(e){this._listener||(this._listener=this._event(this.send,this));let t=e.registerOptions.filters.map(n=>{let i=new Sl.Minimatch(n.pattern.glob,s.asMinimatchOptions(n.pattern.options));if(!i.makeRe())throw new Error(`Invalid pattern ${n.pattern.glob}!`);return{scheme:n.scheme,matcher:i,kind:n.pattern.matches}});this._filters.set(e.id,t)}unregister(e){this._filters.delete(e),this._filters.size===0&&this._listener&&(this._listener.dispose(),this._listener=void 0)}clear(){this._filters.clear(),this._listener&&(this._listener.dispose(),this._listener=void 0)}getFileType(e){return s.getFileType(e)}async filter(e,t){let n=await Promise.all(e.files.map(async r=>{let o=t(r),c=o.fsPath.replace(/\\/g,"/");for(let d of this._filters.values())for(let l of d)if(!(l.scheme!==void 0&&l.scheme!==o.scheme)){if(l.matcher.match(c)){if(l.kind===void 0)return!0;let p=await this.getFileType(o);if(p===void 0)return this._client.error(`Failed to determine file type for ${o.toString()}.`),!0;if(p===Le.FileType.File&&l.kind===rt.FileOperationPatternKind.file||p===Le.FileType.Directory&&l.kind===rt.FileOperationPatternKind.folder)return!0}else if(l.kind===rt.FileOperationPatternKind.folder&&await s.getFileType(o)===Le.FileType.Directory&&l.matcher.match(`${c}/`))return!0}return!1})),i=e.files.filter((r,o)=>n[o]);return{...e,files:i}}static async getFileType(e){try{return(await Le.workspace.fs.stat(e)).type}catch{return}}static asMinimatchOptions(e){let t={dot:!0};return e?.ignoreCase===!0&&(t.nocase=!0),t}},Ji=class extends kn{constructor(e,t,n,i,r,o,c){super(e,t,n,i,r),this._notificationType=n,this._accessUri=o,this._createParams=c}async send(e){let t=await this.filter(e,this._accessUri);if(t.files.length){let n=async i=>this._client.sendNotification(this._notificationType,this._createParams(i));return this.doSend(t,n)}}},Qi=class extends Ji{constructor(){super(...arguments),this._fsPathFileTypes=new Map}async getFileType(e){let t=e.fsPath;if(this._fsPathFileTypes.has(t))return this._fsPathFileTypes.get(t);let n=await kn.getFileType(e);return n&&this._fsPathFileTypes.set(t,n),n}async cacheFileTypes(e,t){await this.filter(e,t)}clearFileTypeCache(){this._fsPathFileTypes.clear()}unregister(e){super.unregister(e),this.filterSize()===0&&this._willListener&&(this._willListener.dispose(),this._willListener=void 0)}clear(){super.clear(),this._willListener&&(this._willListener.dispose(),this._willListener=void 0)}},$o=class extends Ji{constructor(e){super(e,Le.workspace.onDidCreateFiles,rt.DidCreateFilesNotification.type,"didCreate","didCreate",t=>t,e.code2ProtocolConverter.asDidCreateFilesParams)}doSend(e,t){let n=this._client.middleware.workspace;return n?.didCreateFiles?n.didCreateFiles(e,t):t(e)}};be.DidCreateFilesFeature=$o;var Wo=class extends Qi{constructor(e){super(e,Le.workspace.onDidRenameFiles,rt.DidRenameFilesNotification.type,"didRename","didRename",t=>t.oldUri,e.code2ProtocolConverter.asDidRenameFilesParams)}register(e){this._willListener||(this._willListener=Le.workspace.onWillRenameFiles(this.willRename,this)),super.register(e)}willRename(e){e.waitUntil(this.cacheFileTypes(e,t=>t.oldUri))}doSend(e,t){this.clearFileTypeCache();let n=this._client.middleware.workspace;return n?.didRenameFiles?n.didRenameFiles(e,t):t(e)}};be.DidRenameFilesFeature=Wo;var jo=class extends Qi{constructor(e){super(e,Le.workspace.onDidDeleteFiles,rt.DidDeleteFilesNotification.type,"didDelete","didDelete",t=>t,e.code2ProtocolConverter.asDidDeleteFilesParams)}register(e){this._willListener||(this._willListener=Le.workspace.onWillDeleteFiles(this.willDelete,this)),super.register(e)}willDelete(e){e.waitUntil(this.cacheFileTypes(e,t=>t))}doSend(e,t){this.clearFileTypeCache();let n=this._client.middleware.workspace;return n?.didDeleteFiles?n.didDeleteFiles(e,t):t(e)}};be.DidDeleteFilesFeature=jo;var Pn=class extends kn{constructor(e,t,n,i,r,o,c){super(e,t,n,i,r),this._requestType=n,this._accessUri=o,this._createParams=c}async send(e){let t=this.waitUntil(e);e.waitUntil(t)}async waitUntil(e){let t=await this.filter(e,this._accessUri);if(t.files.length){let n=i=>this._client.sendRequest(this._requestType,this._createParams(i),i.token).then(this._client.protocol2CodeConverter.asWorkspaceEdit);return this.doSend(t,n)}else return}},zo=class extends Pn{constructor(e){super(e,Le.workspace.onWillCreateFiles,rt.WillCreateFilesRequest.type,"willCreate","willCreate",t=>t,e.code2ProtocolConverter.asWillCreateFilesParams)}doSend(e,t){let n=this._client.middleware.workspace;return n?.willCreateFiles?n.willCreateFiles(e,t):t(e)}};be.WillCreateFilesFeature=zo;var Vo=class extends Pn{constructor(e){super(e,Le.workspace.onWillRenameFiles,rt.WillRenameFilesRequest.type,"willRename","willRename",t=>t.oldUri,e.code2ProtocolConverter.asWillRenameFilesParams)}doSend(e,t){let n=this._client.middleware.workspace;return n?.willRenameFiles?n.willRenameFiles(e,t):t(e)}};be.WillRenameFilesFeature=Vo;var Bo=class extends Pn{constructor(e){super(e,Le.workspace.onWillDeleteFiles,rt.WillDeleteFilesRequest.type,"willDelete","willDelete",t=>t,e.code2ProtocolConverter.asWillDeleteFilesParams)}doSend(e,t){let n=this._client.middleware.workspace;return n?.willDeleteFiles?n.willDeleteFiles(e,t):t(e)}};be.WillDeleteFilesFeature=Bo});var Yc=F(Gi=>{"use strict";Object.defineProperty(Gi,"__esModule",{value:!0});Gi.LinkedEditingFeature=void 0;var Tl=I("vscode"),Jo=L(),Qo=W(),Go=class extends Qo.TextDocumentLanguageFeature{constructor(e){super(e,Jo.LinkedEditingRangeRequest.type)}fillClientCapabilities(e){let t=(0,Qo.ensure)((0,Qo.ensure)(e,"textDocument"),"linkedEditingRange");t.dynamicRegistration=!0}initialize(e,t){let[n,i]=this.getRegistration(t,e.linkedEditingRangeProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n={provideLinkedEditingRanges:(i,r,o)=>{let c=this._client,d=(p,g,h)=>c.sendRequest(Jo.LinkedEditingRangeRequest.type,c.code2ProtocolConverter.asTextDocumentPositionParams(p,g),h).then(v=>h.isCancellationRequested?null:c.protocol2CodeConverter.asLinkedEditingRanges(v,h),v=>c.handleFailedRequest(Jo.LinkedEditingRangeRequest.type,h,v,null)),l=c.middleware;return l.provideLinkedEditingRange?l.provideLinkedEditingRange(i,r,o,d):d(i,r,o)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return Tl.languages.registerLinkedEditingRangeProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Gi.LinkedEditingFeature=Go});var Xc=F(Yi=>{"use strict";Object.defineProperty(Yi,"__esModule",{value:!0});Yi.TypeHierarchyFeature=void 0;var kl=I("vscode"),qt=L(),Yo=W(),Xo=class{constructor(e){this.client=e,this.middleware=e.middleware}prepareTypeHierarchy(e,t,n){let i=this.client,r=this.middleware,o=(c,d,l)=>{let p=i.code2ProtocolConverter.asTextDocumentPositionParams(c,d);return i.sendRequest(qt.TypeHierarchyPrepareRequest.type,p,l).then(g=>l.isCancellationRequested?null:i.protocol2CodeConverter.asTypeHierarchyItems(g,l),g=>i.handleFailedRequest(qt.TypeHierarchyPrepareRequest.type,l,g,null))};return r.prepareTypeHierarchy?r.prepareTypeHierarchy(e,t,n,o):o(e,t,n)}provideTypeHierarchySupertypes(e,t){let n=this.client,i=this.middleware,r=(o,c)=>{let d={item:n.code2ProtocolConverter.asTypeHierarchyItem(o)};return n.sendRequest(qt.TypeHierarchySupertypesRequest.type,d,c).then(l=>c.isCancellationRequested?null:n.protocol2CodeConverter.asTypeHierarchyItems(l,c),l=>n.handleFailedRequest(qt.TypeHierarchySupertypesRequest.type,c,l,null))};return i.provideTypeHierarchySupertypes?i.provideTypeHierarchySupertypes(e,t,r):r(e,t)}provideTypeHierarchySubtypes(e,t){let n=this.client,i=this.middleware,r=(o,c)=>{let d={item:n.code2ProtocolConverter.asTypeHierarchyItem(o)};return n.sendRequest(qt.TypeHierarchySubtypesRequest.type,d,c).then(l=>c.isCancellationRequested?null:n.protocol2CodeConverter.asTypeHierarchyItems(l,c),l=>n.handleFailedRequest(qt.TypeHierarchySubtypesRequest.type,c,l,null))};return i.provideTypeHierarchySubtypes?i.provideTypeHierarchySubtypes(e,t,r):r(e,t)}},Zo=class extends Yo.TextDocumentLanguageFeature{constructor(e){super(e,qt.TypeHierarchyPrepareRequest.type)}fillClientCapabilities(e){let t=(0,Yo.ensure)((0,Yo.ensure)(e,"textDocument"),"typeHierarchy");t.dynamicRegistration=!0}initialize(e,t){let[n,i]=this.getRegistration(t,e.typeHierarchyProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=this._client,n=new Xo(t);return[kl.languages.registerTypeHierarchyProvider(t.protocol2CodeConverter.asDocumentSelector(e.documentSelector),n),n]}};Yi.TypeHierarchyFeature=Zo});var ed=F(Zi=>{"use strict";Object.defineProperty(Zi,"__esModule",{value:!0});Zi.InlineValueFeature=void 0;var Zc=I("vscode"),Xi=L(),Rn=W(),ea=class extends Rn.TextDocumentLanguageFeature{constructor(e){super(e,Xi.InlineValueRequest.type)}fillClientCapabilities(e){(0,Rn.ensure)((0,Rn.ensure)(e,"textDocument"),"inlineValue").dynamicRegistration=!0,(0,Rn.ensure)((0,Rn.ensure)(e,"workspace"),"inlineValue").refreshSupport=!0}initialize(e,t){this._client.onRequest(Xi.InlineValueRefreshRequest.type,async()=>{for(let r of this.getAllProviders())r.onDidChangeInlineValues.fire()});let[n,i]=this.getRegistration(t,e.inlineValueProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n=new Zc.EventEmitter,i={onDidChangeInlineValues:n.event,provideInlineValues:(r,o,c,d)=>{let l=this._client,p=(h,v,f,y)=>{let w={textDocument:l.code2ProtocolConverter.asTextDocumentIdentifier(h),range:l.code2ProtocolConverter.asRange(v),context:l.code2ProtocolConverter.asInlineValueContext(f)};return l.sendRequest(Xi.InlineValueRequest.type,w,y).then(b=>y.isCancellationRequested?null:l.protocol2CodeConverter.asInlineValues(b,y),b=>l.handleFailedRequest(Xi.InlineValueRequest.type,y,b,null))},g=l.middleware;return g.provideInlineValues?g.provideInlineValues(r,o,c,d,p):p(r,o,c,d)}};return[this.registerProvider(t,i),{provider:i,onDidChangeInlineValues:n}]}registerProvider(e,t){return Zc.languages.registerInlineValuesProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Zi.InlineValueFeature=ea});var nd=F(er=>{"use strict";Object.defineProperty(er,"__esModule",{value:!0});er.InlayHintsFeature=void 0;var td=I("vscode"),Gt=L(),xn=W(),ta=class extends xn.TextDocumentLanguageFeature{constructor(e){super(e,Gt.InlayHintRequest.type)}fillClientCapabilities(e){let t=(0,xn.ensure)((0,xn.ensure)(e,"textDocument"),"inlayHint");t.dynamicRegistration=!0,t.resolveSupport={properties:["tooltip","textEdits","label.tooltip","label.location","label.command"]},(0,xn.ensure)((0,xn.ensure)(e,"workspace"),"inlayHint").refreshSupport=!0}initialize(e,t){this._client.onRequest(Gt.InlayHintRefreshRequest.type,async()=>{for(let r of this.getAllProviders())r.onDidChangeInlayHints.fire()});let[n,i]=this.getRegistration(t,e.inlayHintProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n=new td.EventEmitter,i={onDidChangeInlayHints:n.event,provideInlayHints:(r,o,c)=>{let d=this._client,l=async(g,h,v)=>{let f={textDocument:d.code2ProtocolConverter.asTextDocumentIdentifier(g),range:d.code2ProtocolConverter.asRange(h)};try{let y=await d.sendRequest(Gt.InlayHintRequest.type,f,v);return v.isCancellationRequested?null:d.protocol2CodeConverter.asInlayHints(y,v)}catch(y){return d.handleFailedRequest(Gt.InlayHintRequest.type,v,y,null)}},p=d.middleware;return p.provideInlayHints?p.provideInlayHints(r,o,c,l):l(r,o,c)}};return i.resolveInlayHint=e.resolveProvider===!0?(r,o)=>{let c=this._client,d=async(p,g)=>{try{let h=await c.sendRequest(Gt.InlayHintResolveRequest.type,c.code2ProtocolConverter.asInlayHint(p),g);if(g.isCancellationRequested)return null;let v=c.protocol2CodeConverter.asInlayHint(h,g);return g.isCancellationRequested?null:v}catch(h){return c.handleFailedRequest(Gt.InlayHintResolveRequest.type,g,h,null)}},l=c.middleware;return l.resolveInlayHint?l.resolveInlayHint(r,o,d):d(r,o)}:void 0,[this.registerProvider(t,i),{provider:i,onDidChangeInlayHints:n}]}registerProvider(e,t){return td.languages.registerInlayHintsProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};er.InlayHintsFeature=ta});var id=F(tr=>{"use strict";Object.defineProperty(tr,"__esModule",{value:!0});tr.InlineCompletionItemFeature=void 0;var Pl=I("vscode"),na=L(),ia=W(),Rl=te(),ra=class extends ia.TextDocumentLanguageFeature{constructor(e){super(e,na.InlineCompletionRequest.type)}fillClientCapabilities(e){let t=(0,ia.ensure)((0,ia.ensure)(e,"textDocument"),"inlineCompletion");t.dynamicRegistration=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.inlineCompletionProvider);n&&this.register({id:Rl.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideInlineCompletionItems:(i,r,o,c)=>{let d=this._client,l=this._client.middleware,p=(g,h,v,f)=>d.sendRequest(na.InlineCompletionRequest.type,d.code2ProtocolConverter.asInlineCompletionParams(g,h,v),f).then(y=>f.isCancellationRequested?null:d.protocol2CodeConverter.asInlineCompletionResult(y,f),y=>d.handleFailedRequest(na.InlineCompletionRequest.type,f,y,null));return l.provideInlineCompletionItems?l.provideInlineCompletionItems(i,r,o,c,p):p(i,r,o,c)}};return[Pl.languages.registerInlineCompletionItemProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};tr.InlineCompletionItemFeature=ra});var ua=F(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.ProposedFeatures=me.BaseLanguageClient=me.MessageTransports=me.SuspendMode=me.State=me.CloseAction=me.ErrorAction=me.RevealOutputChannelOn=void 0;var J=I("vscode"),_=L(),xl=Za(),Fl=nc(),je=Ee(),nr=ui(),rd=te(),ql=gs(),We=W(),Il=Rs(),sd=fc(),od=gc(),Yt=mc(),El=vc(),Ml=yc(),Ol=Cc(),Al=Dc(),Ll=Sc(),Ul=Zs(),Nl=bc(),Kl=Tc(),Hl=kc(),$l=Rc(),sa=xc(),Wl=qc(),jl=Ic(),zl=Mc(),Vl=Oc(),Bl=Ac(),Jl=Lc(),Ql=Uc(),Gl=Nc(),Yl=Hc(),Xl=$c(),Zl=Wc(),ep=zc(),tp=Vc(),np=Bc(),Xt=Gc(),ip=Yc(),rp=Xc(),sp=ed(),op=nd(),ap=id(),It;(function(s){s[s.Debug=0]="Debug",s[s.Info=1]="Info",s[s.Warn=2]="Warn",s[s.Error=3]="Error",s[s.Never=4]="Never"})(It||(me.RevealOutputChannelOn=It={}));var qn;(function(s){s[s.Continue=1]="Continue",s[s.Shutdown=2]="Shutdown"})(qn||(me.ErrorAction=qn={}));var yt;(function(s){s[s.DoNotRestart=1]="DoNotRestart",s[s.Restart=2]="Restart"})(yt||(me.CloseAction=yt={}));var Fn;(function(s){s[s.Stopped=1]="Stopped",s[s.Starting=3]="Starting",s[s.Running=2]="Running"})(Fn||(me.State=Fn={}));var ad;(function(s){s.off="off",s.on="on"})(ad||(me.SuspendMode=ad={}));var oa;(function(s){function e(t){return t==null?!1:typeof t=="boolean"||typeof t=="object"&&t!==null&&je.stringArray(t.enabledCommands)?t:!1}s.sanitizeIsTrusted=e})(oa||(oa={}));var aa=class{constructor(e,t){this.client=e,this.maxRestartCount=t,this.restarts=[]}error(e,t,n){return n&&n<=3?{action:qn.Continue}:{action:qn.Shutdown}}closed(){return this.restarts.push(Date.now()),this.restarts.length<=this.maxRestartCount?{action:yt.Restart}:this.restarts[this.restarts.length-1]-this.restarts[0]<=3*60*1e3?{action:yt.DoNotRestart,message:`The ${this.client.name} server crashed ${this.maxRestartCount+1} times in the last 3 minutes. The server will not be restarted. See the output for more information.`}:(this.restarts.shift(),{action:yt.Restart})}},N;(function(s){s.Initial="initial",s.Starting="starting",s.StartFailed="startFailed",s.Running="running",s.Stopping="stopping",s.Stopped="stopped"})(N||(N={}));var cd;(function(s){function e(t){return t&&_.MessageReader.is(t.reader)&&_.MessageWriter.is(t.writer)}s.is=e})(cd||(me.MessageTransports=cd={}));var In=class s{constructor(e,t,n){this._traceFormat=_.TraceFormat.Text,this._diagnosticQueue=new Map,this._diagnosticQueueState={state:"idle"},this._features=[],this._dynamicFeatures=new Map,this.workspaceEditLock=new nr.Semaphore(1),this._id=e,this._name=t,n=n||{};let i={isTrusted:!1,supportHtml:!1};n.markdown!==void 0&&(i.isTrusted=oa.sanitizeIsTrusted(n.markdown.isTrusted),i.supportHtml=n.markdown.supportHtml===!0),this._clientOptions={documentSelector:n.documentSelector??[],synchronize:n.synchronize??{},diagnosticCollectionName:n.diagnosticCollectionName,outputChannelName:n.outputChannelName??this._name,revealOutputChannelOn:n.revealOutputChannelOn??It.Error,stdioEncoding:n.stdioEncoding??"utf8",initializationOptions:n.initializationOptions,initializationFailedHandler:n.initializationFailedHandler,progressOnInitialization:!!n.progressOnInitialization,errorHandler:n.errorHandler??this.createDefaultErrorHandler(n.connectionOptions?.maxRestartCount),middleware:n.middleware??{},uriConverters:n.uriConverters,workspaceFolder:n.workspaceFolder,connectionOptions:n.connectionOptions,markdown:i,diagnosticPullOptions:n.diagnosticPullOptions??{onChange:!0,onSave:!1},notebookDocumentOptions:n.notebookDocumentOptions??{}},this._clientOptions.synchronize=this._clientOptions.synchronize||{},this._state=N.Initial,this._ignoredRegistrations=new Set,this._listeners=[],this._notificationHandlers=new Map,this._pendingNotificationHandlers=new Map,this._notificationDisposables=new Map,this._requestHandlers=new Map,this._pendingRequestHandlers=new Map,this._requestDisposables=new Map,this._progressHandlers=new Map,this._pendingProgressHandlers=new Map,this._progressDisposables=new Map,this._connection=void 0,this._initializeResult=void 0,n.outputChannel?(this._outputChannel=n.outputChannel,this._disposeOutputChannel=!1):(this._outputChannel=void 0,this._disposeOutputChannel=!0),this._traceOutputChannel=n.traceOutputChannel,this._diagnostics=void 0,this._pendingOpenNotifications=new Set,this._pendingChangeSemaphore=new nr.Semaphore(1),this._pendingChangeDelayer=new nr.Delayer(250),this._fileEvents=[],this._fileEventDelayer=new nr.Delayer(250),this._onStop=void 0,this._telemetryEmitter=new _.Emitter,this._stateChangeEmitter=new _.Emitter,this._trace=_.Trace.Off,this._tracer={log:(r,o)=>{je.string(r)?this.logTrace(r,o):this.logObjectTrace(r)}},this._c2p=xl.createConverter(n.uriConverters?n.uriConverters.code2Protocol:void 0),this._p2c=Fl.createConverter(n.uriConverters?n.uriConverters.protocol2Code:void 0,this._clientOptions.markdown.isTrusted,this._clientOptions.markdown.supportHtml),this._syncedDocuments=new Map,this.registerBuiltinFeatures()}get name(){return this._name}get middleware(){return this._clientOptions.middleware??Object.create(null)}get clientOptions(){return this._clientOptions}get protocol2CodeConverter(){return this._p2c}get code2ProtocolConverter(){return this._c2p}get onTelemetry(){return this._telemetryEmitter.event}get onDidChangeState(){return this._stateChangeEmitter.event}get outputChannel(){return this._outputChannel||(this._outputChannel=J.window.createOutputChannel(this._clientOptions.outputChannelName?this._clientOptions.outputChannelName:this._name)),this._outputChannel}get traceOutputChannel(){return this._traceOutputChannel?this._traceOutputChannel:this.outputChannel}get diagnostics(){return this._diagnostics}get state(){return this.getPublicState()}get $state(){return this._state}set $state(e){let t=this.getPublicState();this._state=e;let n=this.getPublicState();n!==t&&this._stateChangeEmitter.fire({oldState:t,newState:n})}getPublicState(){switch(this.$state){case N.Starting:return Fn.Starting;case N.Running:return Fn.Running;default:return Fn.Stopped}}get initializeResult(){return this._initializeResult}async sendRequest(e,...t){if(this.$state===N.StartFailed||this.$state===N.Stopping||this.$state===N.Stopped)return Promise.reject(new _.ResponseError(_.ErrorCodes.ConnectionInactive,"Client is not running"));let n=await this.$start();this._didChangeTextDocumentFeature.syncKind===_.TextDocumentSyncKind.Full&&await this.sendPendingFullTextDocumentChanges(n);let i=this._clientOptions.middleware?.sendRequest;if(i!==void 0){let r,o;return t.length===1?_.CancellationToken.is(t[0])?o=t[0]:r=t[0]:t.length===2&&(r=t[0],o=t[1]),i(e,r,o,(c,d,l)=>{let p=[];return d!==void 0&&p.push(d),l!==void 0&&p.push(l),n.sendRequest(c,...p)})}else return n.sendRequest(e,...t)}onRequest(e,t){let n=typeof e=="string"?e:e.method;this._requestHandlers.set(n,t);let i=this.activeConnection(),r;return i!==void 0?(this._requestDisposables.set(n,i.onRequest(e,t)),r={dispose:()=>{let o=this._requestDisposables.get(n);o!==void 0&&(o.dispose(),this._requestDisposables.delete(n))}}):(this._pendingRequestHandlers.set(n,t),r={dispose:()=>{this._pendingRequestHandlers.delete(n);let o=this._requestDisposables.get(n);o!==void 0&&(o.dispose(),this._requestDisposables.delete(n))}}),{dispose:()=>{this._requestHandlers.delete(n),r.dispose()}}}async sendNotification(e,t){if(this.$state===N.StartFailed||this.$state===N.Stopping||this.$state===N.Stopped)return Promise.reject(new _.ResponseError(_.ErrorCodes.ConnectionInactive,"Client is not running"));let n=this._didChangeTextDocumentFeature.syncKind===_.TextDocumentSyncKind.Full,i;n&&typeof e!="string"&&e.method===_.DidOpenTextDocumentNotification.method&&(i=t?.textDocument.uri,this._pendingOpenNotifications.add(i));let r=await this.$start();n&&await this.sendPendingFullTextDocumentChanges(r),i!==void 0&&this._pendingOpenNotifications.delete(i);let o=this._clientOptions.middleware?.sendNotification;return o?o(e,r.sendNotification.bind(r),t):r.sendNotification(e,t)}onNotification(e,t){let n=typeof e=="string"?e:e.method;this._notificationHandlers.set(n,t);let i=this.activeConnection(),r;return i!==void 0?(this._notificationDisposables.set(n,i.onNotification(e,t)),r={dispose:()=>{let o=this._notificationDisposables.get(n);o!==void 0&&(o.dispose(),this._notificationDisposables.delete(n))}}):(this._pendingNotificationHandlers.set(n,t),r={dispose:()=>{this._pendingNotificationHandlers.delete(n);let o=this._notificationDisposables.get(n);o!==void 0&&(o.dispose(),this._notificationDisposables.delete(n))}}),{dispose:()=>{this._notificationHandlers.delete(n),r.dispose()}}}async sendProgress(e,t,n){if(this.$state===N.StartFailed||this.$state===N.Stopping||this.$state===N.Stopped)return Promise.reject(new _.ResponseError(_.ErrorCodes.ConnectionInactive,"Client is not running"));try{return(await this.$start()).sendProgress(e,t,n)}catch(i){throw this.error(`Sending progress for token ${t} failed.`,i),i}}onProgress(e,t,n){this._progressHandlers.set(t,{type:e,handler:n});let i=this.activeConnection(),r,o=this._clientOptions.middleware?.handleWorkDoneProgress,c=_.WorkDoneProgress.is(e)&&o!==void 0?d=>{o(t,d,()=>n(d))}:n;return i!==void 0?(this._progressDisposables.set(t,i.onProgress(e,t,c)),r={dispose:()=>{let d=this._progressDisposables.get(t);d!==void 0&&(d.dispose(),this._progressDisposables.delete(t))}}):(this._pendingProgressHandlers.set(t,{type:e,handler:n}),r={dispose:()=>{this._pendingProgressHandlers.delete(t);let d=this._progressDisposables.get(t);d!==void 0&&(d.dispose(),this._progressDisposables.delete(t))}}),{dispose:()=>{this._progressHandlers.delete(t),r.dispose()}}}createDefaultErrorHandler(e){if(e!==void 0&&e<0)throw new Error(`Invalid maxRestartCount: ${e}`);return new aa(this,e??4)}async setTrace(e){this._trace=e;let t=this.activeConnection();t!==void 0&&await t.trace(this._trace,this._tracer,{sendNotification:!1,traceFormat:this._traceFormat})}data2String(e){if(e instanceof _.ResponseError){let t=e;return` Message: ${t.message}
|
|
5
|
+
import{E as Ea,F as Ma,H as cn,I as Pr,J as Rr,K as Oa,L as Aa,b as Yn,g as ft,h as Pe,i as an,j as Tr,k as L,l as Ia,n as kr,o as Ld,p as Ud,q as Kd}from"./chunk-USWMQ2GW.js";import{a as I,c as F,e as br}from"./chunk-ZLQDNPPN.js";var Ka=F((kp,Ua)=>{"use strict";function St(s,e){var t,n;if(typeof e=="function")n=e(s),n!==void 0&&(s=n);else if(Array.isArray(e))for(t=0;t<e.length;t++)n=e[t](s),n!==void 0&&(s=n);return s}function Nd(s,e){return s[0]==="-"&&Array.isArray(e)&&/^-\d+$/.test(s)?e.length+parseInt(s,10):s}function Hd(s){return/^\d+$/.test(s)}function Zn(s){return Object.prototype.toString.call(s)==="[object Object]"}function dn(s){return Object(s)===s}function ei(s){return Object.keys(s).length===0}var $d=["__proto__","prototype","constructor"],Wd=function(s){return $d.indexOf(s)===-1};function ti(s,e){s.indexOf("[")>=0&&(s=s.replace(/\[/g,e).replace(/]/g,""));var t=s.split(e),n=t.filter(Wd);if(n.length!==t.length)throw Error("Refusing to update blacklisted property "+s);return t}var La=Object.prototype.hasOwnProperty;function $(s,e,t,n){if(!(this instanceof $))return new $(s,e,t,n);typeof e>"u"&&(e=!1),typeof t>"u"&&(t=!0),typeof n>"u"&&(n=!0),this.separator=s||".",this.override=e,this.useArray=t,this.useBrackets=n,this.keepArray=!1,this.cleanup=[]}var Ut=new $(".",!1,!0,!0);function Ne(s){return function(){return Ut[s].apply(Ut,arguments)}}$.prototype._fill=function(s,e,t,n){var i=s.shift();if(s.length>0){if(e[i]=e[i]||(this.useArray&&Hd(s[0])?[]:{}),!dn(e[i]))if(this.override)e[i]={};else{if(!(dn(t)&&ei(t)))throw new Error("Trying to redefine `"+i+"` which is a "+typeof e[i]);return}this._fill(s,e[i],t,n)}else{if(!this.override&&dn(e[i])&&!ei(e[i])){if(!(dn(t)&&ei(t)))throw new Error("Trying to redefine non-empty obj['"+i+"']");return}e[i]=St(t,n)}};$.prototype.object=function(s,e){var t=this;return Object.keys(s).forEach(function(n){var i=e===void 0?null:e[n],r=ti(n,t.separator).join(t.separator);r.indexOf(t.separator)!==-1?(t._fill(r.split(t.separator),s,s[n],i),delete s[n]):s[n]=St(s[n],i)}),s};$.prototype.str=function(s,e,t,n){var i=ti(s,this.separator).join(this.separator);return s.indexOf(this.separator)!==-1?this._fill(i.split(this.separator),t,e,n):t[s]=St(e,n),t};$.prototype.pick=function(s,e,t,n){var i,r,a,c,u;for(r=ti(s,this.separator),i=0;i<r.length;i++)if(c=Nd(r[i],e),e&&typeof e=="object"&&c in e){if(i===r.length-1)return t?(a=e[c],n&&Array.isArray(e)?e.splice(c,1):delete e[c],Array.isArray(e)&&(u=r.slice(0,-1).join("."),this.cleanup.indexOf(u)===-1&&this.cleanup.push(u)),a):e[c];e=e[c]}else return;return t&&Array.isArray(e)&&(e=e.filter(function(l){return l!==void 0})),e};$.prototype.delete=function(s,e){return this.remove(s,e,!0)};$.prototype.remove=function(s,e,t){var n;if(this.cleanup=[],Array.isArray(s)){for(n=0;n<s.length;n++)this.pick(s[n],e,!0,t);return t||this._cleanup(e),e}else return this.pick(s,e,!0,t)};$.prototype._cleanup=function(s){var e,t,n,i;if(this.cleanup.length){for(t=0;t<this.cleanup.length;t++)n=this.cleanup[t].split("."),i=n.splice(0,-1).join("."),e=i?this.pick(i,s):s,e=e[n[0]].filter(function(r){return r!==void 0}),this.set(this.cleanup[t],e,s);this.cleanup=[]}};$.prototype.del=$.prototype.remove;$.prototype.move=function(s,e,t,n,i){return typeof n=="function"||Array.isArray(n)?this.set(e,St(this.pick(s,t,!0),n),t,i):(i=n,this.set(e,this.pick(s,t,!0),t,i)),t};$.prototype.transfer=function(s,e,t,n,i,r){return typeof i=="function"||Array.isArray(i)?this.set(e,St(this.pick(s,t,!0),i),n,r):(r=i,this.set(e,this.pick(s,t,!0),n,r)),n};$.prototype.copy=function(s,e,t,n,i,r){return typeof i=="function"||Array.isArray(i)?this.set(e,St(JSON.parse(JSON.stringify(this.pick(s,t,!1))),i),n,r):(r=i,this.set(e,this.pick(s,t,!1),n,r)),n};$.prototype.set=function(s,e,t,n){var i,r,a,c;if(typeof e>"u")return t;for(a=ti(s,this.separator),i=0;i<a.length;i++){if(c=a[i],i===a.length-1)if(n&&Zn(e)&&Zn(t[c]))for(r in e)La.call(e,r)&&(t[c][r]=e[r]);else if(n&&Array.isArray(t[c])&&Array.isArray(e))for(var u=0;u<e.length;u++)t[a[i]].push(e[u]);else t[c]=e;else(!La.call(t,c)||!Zn(t[c])&&!Array.isArray(t[c]))&&(/^\d+$/.test(a[i+1])?t[c]=[]:t[c]={});t=t[c]}return t};$.prototype.transform=function(s,e,t){return e=e||{},t=t||{},Object.keys(s).forEach(function(n){this.set(s[n],this.pick(n,e),t)}.bind(this)),t};$.prototype.dot=function(s,e,t){e=e||{},t=t||[];var n=Array.isArray(s);return Object.keys(s).forEach(function(i){var r=n&&this.useBrackets?"["+i+"]":i;if(dn(s[i])&&(Zn(s[i])&&!ei(s[i])||Array.isArray(s[i])&&!this.keepArray&&s[i].length!==0))if(n&&this.useBrackets){var a=t[t.length-1]||"";return this.dot(s[i],e,t.slice(0,-1).concat(a+r))}else return this.dot(s[i],e,t.concat(r));else n&&this.useBrackets?e[t.join(this.separator).concat("["+i+"]")]=s[i]:e[t.concat(r).join(this.separator)]=s[i]}.bind(this)),e};$.pick=Ne("pick");$.move=Ne("move");$.transfer=Ne("transfer");$.transform=Ne("transform");$.copy=Ne("copy");$.object=Ne("object");$.str=Ne("str");$.set=Ne("set");$.delete=Ne("delete");$.del=$.remove=Ne("remove");$.dot=Ne("dot");["override","overwrite"].forEach(function(s){Object.defineProperty($,s,{get:function(){return Ut.override},set:function(e){Ut.override=!!e}})});["useArray","keepArray","useBrackets"].forEach(function(s){Object.defineProperty($,s,{get:function(){return Ut[s]},set:function(e){Ut[s]=e}})});$._process=St;Ua.exports=$});var Ee=F(oe=>{"use strict";Object.defineProperty(oe,"__esModule",{value:!0});oe.asPromise=oe.thenable=oe.typedArray=oe.stringArray=oe.array=oe.func=oe.error=oe.number=oe.string=oe.boolean=void 0;function Gd(s){return s===!0||s===!1}oe.boolean=Gd;function Va(s){return typeof s=="string"||s instanceof String}oe.string=Va;function Yd(s){return typeof s=="number"||s instanceof Number}oe.number=Yd;function Xd(s){return s instanceof Error}oe.error=Xd;function Ba(s){return typeof s=="function"}oe.func=Ba;function Ja(s){return Array.isArray(s)}oe.array=Ja;function Zd(s){return Ja(s)&&s.every(e=>Va(e))}oe.stringArray=Zd;function eu(s,e){return Array.isArray(s)&&s.every(e)}oe.typedArray=eu;function Qa(s){return s&&Ba(s.then)}oe.thenable=Qa;function tu(s){return s instanceof Promise?s:Qa(s)?new Promise((e,t)=>{s.then(n=>e(n),n=>t(n))}):Promise.resolve(s)}oe.asPromise=tu});var ui=F(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.forEach=Ce.mapAsync=Ce.map=Ce.clearTestMode=Ce.setTestMode=Ce.Semaphore=Ce.Delayer=void 0;var ln=L(),Kr=class{constructor(e){this.defaultDelay=e,this.timeout=void 0,this.completionPromise=void 0,this.onSuccess=void 0,this.task=void 0}trigger(e,t=this.defaultDelay){return this.task=e,t>=0&&this.cancelTimeout(),this.completionPromise||(this.completionPromise=new Promise(n=>{this.onSuccess=n}).then(()=>{this.completionPromise=void 0,this.onSuccess=void 0;var n=this.task();return this.task=void 0,n})),(t>=0||this.timeout===void 0)&&(this.timeout=(0,ln.RAL)().timer.setTimeout(()=>{this.timeout=void 0,this.onSuccess(void 0)},t>=0?t:this.defaultDelay)),this.completionPromise}forceDelivery(){if(!this.completionPromise)return;this.cancelTimeout();let e=this.task();return this.completionPromise=void 0,this.onSuccess=void 0,this.task=void 0,e}isTriggered(){return this.timeout!==void 0}cancel(){this.cancelTimeout(),this.completionPromise=void 0}cancelTimeout(){this.timeout!==void 0&&(this.timeout.dispose(),this.timeout=void 0)}};Ce.Delayer=Kr;var Nr=class{constructor(e=1){if(e<=0)throw new Error("Capacity must be greater than 0");this._capacity=e,this._active=0,this._waiting=[]}lock(e){return new Promise((t,n)=>{this._waiting.push({thunk:e,resolve:t,reject:n}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length===0||this._active===this._capacity||(0,ln.RAL)().timer.setImmediate(()=>this.doRunNext())}doRunNext(){if(this._waiting.length===0||this._active===this._capacity)return;let e=this._waiting.shift();if(this._active++,this._active>this._capacity)throw new Error("To many thunks active");try{let t=e.thunk();t instanceof Promise?t.then(n=>{this._active--,e.resolve(n),this.runNext()},n=>{this._active--,e.reject(n),this.runNext()}):(this._active--,e.resolve(t),this.runNext())}catch(t){this._active--,e.reject(t),this.runNext()}}};Ce.Semaphore=Nr;var Hr=!1;function nu(){Hr=!0}Ce.setTestMode=nu;function iu(){Hr=!1}Ce.clearTestMode=iu;var Ga=15,un=class{constructor(e=Ga){this.yieldAfter=Hr===!0?Math.max(e,2):Math.max(e,Ga),this.startTime=Date.now(),this.counter=0,this.total=0,this.counterInterval=1}start(){this.counter=0,this.total=0,this.counterInterval=1,this.startTime=Date.now()}shouldYield(){if(++this.counter>=this.counterInterval){let e=Date.now()-this.startTime,t=Math.max(0,this.yieldAfter-e);if(this.total+=this.counter,this.counter=0,e>=this.yieldAfter||t<=1)return this.counterInterval=1,this.total=0,!0;switch(e){case 0:case 1:this.counterInterval=this.total*2;break}}return!1}};async function ru(s,e,t,n){if(s.length===0)return[];let i=new Array(s.length),r=new un(n?.yieldAfter);function a(u){r.start();for(let l=u;l<s.length;l++)if(i[l]=e(s[l]),r.shouldYield())return n?.yieldCallback&&n.yieldCallback(),l+1;return-1}let c=a(0);for(;c!==-1&&!(t!==void 0&&t.isCancellationRequested);)c=await new Promise(u=>{(0,ln.RAL)().timer.setImmediate(()=>{u(a(c))})});return i}Ce.map=ru;async function su(s,e,t,n){if(s.length===0)return[];let i=new Array(s.length),r=new un(n?.yieldAfter);async function a(u){r.start();for(let l=u;l<s.length;l++)if(i[l]=await e(s[l],t),r.shouldYield())return n?.yieldCallback&&n.yieldCallback(),l+1;return-1}let c=await a(0);for(;c!==-1&&!(t!==void 0&&t.isCancellationRequested);)c=await new Promise(u=>{(0,ln.RAL)().timer.setImmediate(()=>{u(a(c))})});return i}Ce.mapAsync=su;async function ou(s,e,t,n){if(s.length===0)return;let i=new un(n?.yieldAfter);function r(c){i.start();for(let u=c;u<s.length;u++)if(e(s[u]),i.shouldYield())return n?.yieldCallback&&n.yieldCallback(),u+1;return-1}let a=r(0);for(;a!==-1&&!(t!==void 0&&t.isCancellationRequested);)a=await new Promise(c=>{(0,ln.RAL)().timer.setImmediate(()=>{c(r(a))})})}Ce.forEach=ou});var jr=F(Wr=>{"use strict";Object.defineProperty(Wr,"__esModule",{value:!0});var au=I("vscode"),$r=class extends au.CompletionItem{constructor(e){super(e)}};Wr.default=$r});var Br=F(Vr=>{"use strict";Object.defineProperty(Vr,"__esModule",{value:!0});var cu=I("vscode"),zr=class extends cu.CodeLens{constructor(e){super(e)}};Vr.default=zr});var Gr=F(Qr=>{"use strict";Object.defineProperty(Qr,"__esModule",{value:!0});var du=I("vscode"),Jr=class extends du.DocumentLink{constructor(e,t){super(e,t)}};Qr.default=Jr});var Zr=F(Xr=>{"use strict";Object.defineProperty(Xr,"__esModule",{value:!0});var uu=I("vscode"),Yr=class extends uu.CodeAction{constructor(e,t){super(e),this.data=t}};Xr.default=Yr});var ns=F($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.ProtocolDiagnostic=$t.DiagnosticCode=void 0;var lu=I("vscode"),es=Ee(),Ya;(function(s){function e(t){let n=t;return n!=null&&(es.number(n.value)||es.string(n.value))&&es.string(n.target)}s.is=e})(Ya||($t.DiagnosticCode=Ya={}));var ts=class extends lu.Diagnostic{constructor(e,t,n,i){super(e,t,n),this.data=i,this.hasDiagnosticCode=!1}};$t.ProtocolDiagnostic=ts});var ss=F(rs=>{"use strict";Object.defineProperty(rs,"__esModule",{value:!0});var pu=I("vscode"),is=class extends pu.CallHierarchyItem{constructor(e,t,n,i,r,a,c){super(e,t,n,i,r,a),c!==void 0&&(this.data=c)}};rs.default=is});var cs=F(as=>{"use strict";Object.defineProperty(as,"__esModule",{value:!0});var fu=I("vscode"),os=class extends fu.TypeHierarchyItem{constructor(e,t,n,i,r,a,c){super(e,t,n,i,r,a),c!==void 0&&(this.data=c)}};as.default=os});var ls=F(us=>{"use strict";Object.defineProperty(us,"__esModule",{value:!0});var li=I("vscode"),ds=class extends li.SymbolInformation{constructor(e,t,n,i,r){let a=!(i instanceof li.Uri);super(e,t,n,a?i:new li.Location(i,new li.Range(0,0,0,0))),this.hasRange=a,r!==void 0&&(this.data=r)}};us.default=ds});var hs=F(fs=>{"use strict";Object.defineProperty(fs,"__esModule",{value:!0});var hu=I("vscode"),ps=class extends hu.InlayHint{constructor(e,t,n){super(e,t,n)}};fs.default=ps});var tc=F(pi=>{"use strict";Object.defineProperty(pi,"__esModule",{value:!0});pi.createConverter=void 0;var de=I("vscode"),A=L(),bt=Ee(),Xa=ui(),gu=jr(),mu=Br(),vu=Gr(),Za=Zr(),ec=ns(),yu=ss(),Cu=cs(),wu=ls(),Du=hs(),gs;(function(s){function e(t){let n=t;return n&&!!n.inserting&&!!n.replacing}s.is=e})(gs||(gs={}));function Su(s){let t=s||(d=>d.toString());function n(d){return t(d)}function i(d){return{uri:t(d.uri)}}function r(d){return{uri:t(d.uri),languageId:d.languageId,version:d.version,text:d.getText()}}function a(d){return{uri:t(d.uri),version:d.version}}function c(d){return{textDocument:r(d)}}function u(d){let w=d;return!!w.document&&!!w.contentChanges}function l(d){let w=d;return!!w.uri&&!!w.version}function g(d,w,R){if(l(d))return{textDocument:{uri:t(d.uri),version:d.version},contentChanges:[{text:d.getText()}]};if(u(d)){let B=w,G=R;return{textDocument:{uri:t(B),version:G},contentChanges:d.contentChanges.map(ke=>{let ze=ke.range;return{range:{start:{line:ze.start.line,character:ze.start.character},end:{line:ze.end.line,character:ze.end.character}},rangeLength:ke.rangeLength,text:ke.text}})}}else throw Error("Unsupported text document change parameter")}function h(d){return{textDocument:i(d)}}function f(d,w=!1){let R={textDocument:i(d)};return w&&(R.text=d.getText()),R}function v(d){switch(d){case de.TextDocumentSaveReason.Manual:return A.TextDocumentSaveReason.Manual;case de.TextDocumentSaveReason.AfterDelay:return A.TextDocumentSaveReason.AfterDelay;case de.TextDocumentSaveReason.FocusOut:return A.TextDocumentSaveReason.FocusOut}return A.TextDocumentSaveReason.Manual}function p(d){return{textDocument:i(d.document),reason:v(d.reason)}}function C(d){return{files:d.files.map(w=>({uri:t(w)}))}}function y(d){return{files:d.files.map(w=>({oldUri:t(w.oldUri),newUri:t(w.newUri)}))}}function b(d){return{files:d.files.map(w=>({uri:t(w)}))}}function T(d){return{files:d.files.map(w=>({uri:t(w)}))}}function P(d){return{files:d.files.map(w=>({oldUri:t(w.oldUri),newUri:t(w.newUri)}))}}function q(d){return{files:d.files.map(w=>({uri:t(w)}))}}function ce(d,w){return{textDocument:i(d),position:dt(w)}}function V(d){switch(d){case de.CompletionTriggerKind.TriggerCharacter:return A.CompletionTriggerKind.TriggerCharacter;case de.CompletionTriggerKind.TriggerForIncompleteCompletions:return A.CompletionTriggerKind.TriggerForIncompleteCompletions;default:return A.CompletionTriggerKind.Invoked}}function Z(d,w,R){return{textDocument:i(d),position:dt(w),context:{triggerKind:V(R.triggerKind),triggerCharacter:R.triggerCharacter}}}function Ye(d){switch(d){case de.SignatureHelpTriggerKind.Invoke:return A.SignatureHelpTriggerKind.Invoked;case de.SignatureHelpTriggerKind.TriggerCharacter:return A.SignatureHelpTriggerKind.TriggerCharacter;case de.SignatureHelpTriggerKind.ContentChange:return A.SignatureHelpTriggerKind.ContentChange}}function ot(d){return{label:d.label}}function Xe(d){return d.map(ot)}function at(d){return{label:d.label,parameters:Xe(d.parameters)}}function Et(d){return d.map(at)}function Mt(d){return d===void 0?d:{signatures:Et(d.signatures),activeSignature:d.activeSignature,activeParameter:d.activeParameter}}function ct(d,w,R){return{textDocument:i(d),position:dt(w),context:{isRetrigger:R.isRetrigger,triggerCharacter:R.triggerCharacter,triggerKind:Ye(R.triggerKind),activeSignatureHelp:Mt(R.activeSignatureHelp)}}}function dt(d){return{line:d.line,character:d.character}}function Ue(d){return d==null?d:{line:d.line>A.uinteger.MAX_VALUE?A.uinteger.MAX_VALUE:d.line,character:d.character>A.uinteger.MAX_VALUE?A.uinteger.MAX_VALUE:d.character}}function cr(d,w){return Xa.map(d,Ue,w)}function Mn(d){return d.map(Ue)}function pe(d){return d==null?d:{start:Ue(d.start),end:Ue(d.end)}}function On(d){return d.map(pe)}function ut(d){return d==null?d:A.Location.create(n(d.uri),pe(d.range))}function Ze(d){switch(d){case de.DiagnosticSeverity.Error:return A.DiagnosticSeverity.Error;case de.DiagnosticSeverity.Warning:return A.DiagnosticSeverity.Warning;case de.DiagnosticSeverity.Information:return A.DiagnosticSeverity.Information;case de.DiagnosticSeverity.Hint:return A.DiagnosticSeverity.Hint}}function dr(d){if(!d)return;let w=[];for(let R of d){let B=An(R);B!==void 0&&w.push(B)}return w.length>0?w:void 0}function An(d){switch(d){case de.DiagnosticTag.Unnecessary:return A.DiagnosticTag.Unnecessary;case de.DiagnosticTag.Deprecated:return A.DiagnosticTag.Deprecated;default:return}}function Ln(d){return{message:d.message,location:ut(d.location)}}function Un(d){return d.map(Ln)}function ur(d){if(d!=null)return bt.number(d)||bt.string(d)?d:{value:d.value,target:n(d.target)}}function en(d){let w=A.Diagnostic.create(pe(d.range),d.message),R=d instanceof ec.ProtocolDiagnostic?d:void 0;R!==void 0&&R.data!==void 0&&(w.data=R.data);let B=ur(d.code);return ec.DiagnosticCode.is(B)?R!==void 0&&R.hasDiagnosticCode?w.code=B:(w.code=B.value,w.codeDescription={href:B.target}):w.code=B,bt.number(d.severity)&&(w.severity=Ze(d.severity)),Array.isArray(d.tags)&&(w.tags=dr(d.tags)),d.relatedInformation&&(w.relatedInformation=Un(d.relatedInformation)),d.source&&(w.source=d.source),w}function Ot(d,w){return d==null?d:Xa.map(d,en,w)}function At(d){return d==null?d:d.map(en)}function lr(d,w){switch(d){case"$string":return w;case A.MarkupKind.PlainText:return{kind:d,value:w};case A.MarkupKind.Markdown:return{kind:d,value:w.value};default:return`Unsupported Markup content received. Kind is: ${d}`}}function lt(d){switch(d){case de.CompletionItemTag.Deprecated:return A.CompletionItemTag.Deprecated}}function Kn(d){if(d===void 0)return d;let w=[];for(let R of d){let B=lt(R);B!==void 0&&w.push(B)}return w}function Lt(d,w){return w!==void 0?w:d+1}function Nn(d,w=!1){let R,B;bt.string(d.label)?R=d.label:(R=d.label.label,w&&(d.label.detail!==void 0||d.label.description!==void 0)&&(B={detail:d.label.detail,description:d.label.description}));let G={label:R};B!==void 0&&(G.labelDetails=B);let fe=d instanceof gu.default?d:void 0;d.detail&&(G.detail=d.detail),d.documentation&&(!fe||fe.documentationFormat==="$string"?G.documentation=d.documentation:G.documentation=lr(fe.documentationFormat,d.documentation)),d.filterText&&(G.filterText=d.filterText),pr(G,d),bt.number(d.kind)&&(G.kind=Lt(d.kind,fe&&fe.originalItemKind)),d.sortText&&(G.sortText=d.sortText),d.additionalTextEdits&&(G.additionalTextEdits=Ke(d.additionalTextEdits)),d.commitCharacters&&(G.commitCharacters=d.commitCharacters.slice()),d.command&&(G.command=et(d.command)),(d.preselect===!0||d.preselect===!1)&&(G.preselect=d.preselect);let ke=Kn(d.tags);if(fe){if(fe.data!==void 0&&(G.data=fe.data),fe.deprecated===!0||fe.deprecated===!1){if(fe.deprecated===!0&&ke!==void 0&&ke.length>0){let ze=ke.indexOf(de.CompletionItemTag.Deprecated);ze!==-1&&ke.splice(ze,1)}G.deprecated=fe.deprecated}fe.insertTextMode!==void 0&&(G.insertTextMode=fe.insertTextMode)}return ke!==void 0&&ke.length>0&&(G.tags=ke),G.insertTextMode===void 0&&d.keepWhitespace===!0&&(G.insertTextMode=A.InsertTextMode.adjustIndentation),G}function pr(d,w){let R=A.InsertTextFormat.PlainText,B,G;w.textEdit?(B=w.textEdit.newText,G=w.textEdit.range):w.insertText instanceof de.SnippetString?(R=A.InsertTextFormat.Snippet,B=w.insertText.value):B=w.insertText,w.range&&(G=w.range),d.insertTextFormat=R,w.fromEdit&&B!==void 0&&G!==void 0?d.textEdit=tn(B,G):d.insertText=B}function tn(d,w){return gs.is(w)?A.InsertReplaceEdit.create(d,pe(w.inserting),pe(w.replacing)):{newText:d,range:pe(w)}}function nn(d){return{range:pe(d.range),newText:d.newText}}function Ke(d){return d==null?d:d.map(nn)}function Dt(d){return d<=de.SymbolKind.TypeParameter?d+1:A.SymbolKind.Property}function Ie(d){return d}function pt(d){return d.map(Ie)}function fr(d,w,R){return{textDocument:i(d),position:dt(w),context:{includeDeclaration:R.includeDeclaration}}}async function Hn(d,w){let R=A.CodeAction.create(d.title);if(d instanceof Za.default&&d.data!==void 0&&(R.data=d.data),d.kind!==void 0&&(R.kind=Wn(d.kind)),d.diagnostics!==void 0&&(R.diagnostics=await Ot(d.diagnostics,w)),d.edit!==void 0)throw new Error("VS Code code actions can only be converted to a protocol code action without an edit.");return d.command!==void 0&&(R.command=et(d.command)),d.isPreferred!==void 0&&(R.isPreferred=d.isPreferred),d.disabled!==void 0&&(R.disabled={reason:d.disabled.reason}),R}function hr(d){let w=A.CodeAction.create(d.title);if(d instanceof Za.default&&d.data!==void 0&&(w.data=d.data),d.kind!==void 0&&(w.kind=Wn(d.kind)),d.diagnostics!==void 0&&(w.diagnostics=At(d.diagnostics)),d.edit!==void 0)throw new Error("VS Code code actions can only be converted to a protocol code action without an edit.");return d.command!==void 0&&(w.command=et(d.command)),d.isPreferred!==void 0&&(w.isPreferred=d.isPreferred),d.disabled!==void 0&&(w.disabled={reason:d.disabled.reason}),w}async function $n(d,w){if(d==null)return d;let R;return d.only&&bt.string(d.only.value)&&(R=[d.only.value]),A.CodeActionContext.create(await Ot(d.diagnostics,w),R,rn(d.triggerKind))}function gr(d){if(d==null)return d;let w;return d.only&&bt.string(d.only.value)&&(w=[d.only.value]),A.CodeActionContext.create(At(d.diagnostics),w,rn(d.triggerKind))}function rn(d){switch(d){case de.CodeActionTriggerKind.Invoke:return A.CodeActionTriggerKind.Invoked;case de.CodeActionTriggerKind.Automatic:return A.CodeActionTriggerKind.Automatic;default:return}}function Wn(d){if(d!=null)return d.value}function jn(d){return d==null?d:A.InlineValueContext.create(d.frameId,pe(d.stoppedLocation))}function mr(d,w,R){return{context:A.InlineCompletionContext.create(R.triggerKind,R.selectedCompletionInfo),textDocument:i(d),position:Ue(w)}}function et(d){let w=A.Command.create(d.title,d.command);return d.arguments&&(w.arguments=d.arguments),w}function zn(d){let w=A.CodeLens.create(pe(d.range));return d.command&&(w.command=et(d.command)),d instanceof mu.default&&d.data&&(w.data=d.data),w}function vr(d,w){let R={tabSize:d.tabSize,insertSpaces:d.insertSpaces};return w.trimTrailingWhitespace&&(R.trimTrailingWhitespace=!0),w.trimFinalNewlines&&(R.trimFinalNewlines=!0),w.insertFinalNewline&&(R.insertFinalNewline=!0),R}function Vn(d){return{textDocument:i(d)}}function yr(d){return{textDocument:i(d)}}function Bn(d){let w=A.DocumentLink.create(pe(d.range));d.target&&(w.target=n(d.target)),d.tooltip!==void 0&&(w.tooltip=d.tooltip);let R=d instanceof vu.default?d:void 0;return R&&R.data&&(w.data=R.data),w}function Jn(d){return{textDocument:i(d)}}function Cr(d){let w={name:d.name,kind:Dt(d.kind),uri:n(d.uri),range:pe(d.range),selectionRange:pe(d.selectionRange)};return d.detail!==void 0&&d.detail.length>0&&(w.detail=d.detail),d.tags!==void 0&&(w.tags=pt(d.tags)),d instanceof yu.default&&d.data!==void 0&&(w.data=d.data),w}function sn(d){let w={name:d.name,kind:Dt(d.kind),uri:n(d.uri),range:pe(d.range),selectionRange:pe(d.selectionRange)};return d.detail!==void 0&&d.detail.length>0&&(w.detail=d.detail),d.tags!==void 0&&(w.tags=pt(d.tags)),d instanceof Cu.default&&d.data!==void 0&&(w.data=d.data),w}function wr(d){let w=d instanceof wu.default?{name:d.name,kind:Dt(d.kind),location:d.hasRange?ut(d.location):{uri:t(d.location.uri)},data:d.data}:{name:d.name,kind:Dt(d.kind),location:ut(d.location)};return d.tags!==void 0&&(w.tags=pt(d.tags)),d.containerName!==""&&(w.containerName=d.containerName),w}function Qn(d){let w=typeof d.label=="string"?d.label:d.label.map(Dr),R=A.InlayHint.create(Ue(d.position),w);return d.kind!==void 0&&(R.kind=d.kind),d.textEdits!==void 0&&(R.textEdits=Ke(d.textEdits)),d.tooltip!==void 0&&(R.tooltip=on(d.tooltip)),d.paddingLeft!==void 0&&(R.paddingLeft=d.paddingLeft),d.paddingRight!==void 0&&(R.paddingRight=d.paddingRight),d instanceof Du.default&&d.data!==void 0&&(R.data=d.data),R}function Dr(d){let w=A.InlayHintLabelPart.create(d.value);return d.location!==void 0&&(w.location=ut(d.location)),d.command!==void 0&&(w.command=et(d.command)),d.tooltip!==void 0&&(w.tooltip=on(d.tooltip)),w}function on(d){return typeof d=="string"?d:{kind:A.MarkupKind.Markdown,value:d.value}}return{asUri:n,asTextDocumentIdentifier:i,asTextDocumentItem:r,asVersionedTextDocumentIdentifier:a,asOpenTextDocumentParams:c,asChangeTextDocumentParams:g,asCloseTextDocumentParams:h,asSaveTextDocumentParams:f,asWillSaveTextDocumentParams:p,asDidCreateFilesParams:C,asDidRenameFilesParams:y,asDidDeleteFilesParams:b,asWillCreateFilesParams:T,asWillRenameFilesParams:P,asWillDeleteFilesParams:q,asTextDocumentPositionParams:ce,asCompletionParams:Z,asSignatureHelpParams:ct,asWorkerPosition:dt,asRange:pe,asRanges:On,asPosition:Ue,asPositions:cr,asPositionsSync:Mn,asLocation:ut,asDiagnosticSeverity:Ze,asDiagnosticTag:An,asDiagnostic:en,asDiagnostics:Ot,asDiagnosticsSync:At,asCompletionItem:Nn,asTextEdit:nn,asSymbolKind:Dt,asSymbolTag:Ie,asSymbolTags:pt,asReferenceParams:fr,asCodeAction:Hn,asCodeActionSync:hr,asCodeActionContext:$n,asCodeActionContextSync:gr,asInlineValueContext:jn,asCommand:et,asCodeLens:zn,asFormattingOptions:vr,asDocumentSymbolParams:Vn,asCodeLensParams:yr,asDocumentLink:Bn,asDocumentLinkParams:Jn,asCallHierarchyItem:Cr,asTypeHierarchyItem:sn,asInlayHint:Qn,asWorkspaceSymbol:wr,asInlineCompletionParams:mr}}pi.createConverter=Su});var rc=F(hi=>{"use strict";Object.defineProperty(hi,"__esModule",{value:!0});hi.createConverter=void 0;var k=I("vscode"),M=L(),Me=Ee(),j=ui(),_u=jr(),bu=Br(),Tu=Gr(),ku=Zr(),nc=ns(),Pu=ss(),Ru=cs(),xu=ls(),Fu=hs(),ic=L(),fi;(function(s){function e(t){let n=t;return n&&Me.string(n.language)&&Me.string(n.value)}s.is=e})(fi||(fi={}));function qu(s,e,t){let i=s||(o=>k.Uri.parse(o));function r(o){return i(o)}function a(o){let m=[];for(let D of o)if(typeof D=="string")m.push(D);else if(ic.NotebookCellTextDocumentFilter.is(D))if(typeof D.notebook=="string")m.push({notebookType:D.notebook,language:D.language});else{let x=D.notebook.notebookType??"*";m.push({notebookType:x,scheme:D.notebook.scheme,pattern:D.notebook.pattern,language:D.language})}else ic.TextDocumentFilter.is(D)&&m.push({language:D.language,scheme:D.scheme,pattern:D.pattern});return m}async function c(o,m){return j.map(o,l,m)}function u(o){let m=new Array(o.length);for(let D=0;D<o.length;D++)m[D]=l(o[D]);return m}function l(o){let m=new nc.ProtocolDiagnostic(p(o.range),o.message,y(o.severity),o.data);if(o.code!==void 0){if(typeof o.code=="string"||typeof o.code=="number")M.CodeDescription.is(o.codeDescription)?m.code={value:o.code,target:r(o.codeDescription.href)}:m.code=o.code;else if(nc.DiagnosticCode.is(o.code)){m.hasDiagnosticCode=!0;let D=o.code;m.code={value:D.value,target:r(D.target)}}}return o.source&&(m.source=o.source),o.relatedInformation&&(m.relatedInformation=g(o.relatedInformation)),Array.isArray(o.tags)&&(m.tags=h(o.tags)),m}function g(o){let m=new Array(o.length);for(let D=0;D<o.length;D++){let x=o[D];m[D]=new k.DiagnosticRelatedInformation(Ze(x.location),x.message)}return m}function h(o){if(!o)return;let m=[];for(let D of o){let x=f(D);x!==void 0&&m.push(x)}return m.length>0?m:void 0}function f(o){switch(o){case M.DiagnosticTag.Unnecessary:return k.DiagnosticTag.Unnecessary;case M.DiagnosticTag.Deprecated:return k.DiagnosticTag.Deprecated;default:return}}function v(o){return o?new k.Position(o.line,o.character):void 0}function p(o){return o?new k.Range(o.start.line,o.start.character,o.end.line,o.end.character):void 0}async function C(o,m){return j.map(o,D=>new k.Range(D.start.line,D.start.character,D.end.line,D.end.character),m)}function y(o){if(o==null)return k.DiagnosticSeverity.Error;switch(o){case M.DiagnosticSeverity.Error:return k.DiagnosticSeverity.Error;case M.DiagnosticSeverity.Warning:return k.DiagnosticSeverity.Warning;case M.DiagnosticSeverity.Information:return k.DiagnosticSeverity.Information;case M.DiagnosticSeverity.Hint:return k.DiagnosticSeverity.Hint}return k.DiagnosticSeverity.Error}function b(o){if(Me.string(o))return P(o);if(fi.is(o))return P().appendCodeblock(o.value,o.language);if(Array.isArray(o)){let m=[];for(let D of o){let x=P();fi.is(D)?x.appendCodeblock(D.value,D.language):x.appendMarkdown(D),m.push(x)}return m}else return P(o)}function T(o){if(Me.string(o))return o;switch(o.kind){case M.MarkupKind.Markdown:return P(o.value);case M.MarkupKind.PlainText:return o.value;default:return`Unsupported Markup content received. Kind is: ${o.kind}`}}function P(o){let m;if(o===void 0||typeof o=="string")m=new k.MarkdownString(o);else switch(o.kind){case M.MarkupKind.Markdown:m=new k.MarkdownString(o.value);break;case M.MarkupKind.PlainText:m=new k.MarkdownString,m.appendText(o.value);break;default:m=new k.MarkdownString,m.appendText(`Unsupported Markup content received. Kind is: ${o.kind}`);break}return m.isTrusted=e,m.supportHtml=t,m}function q(o){if(o)return new k.Hover(b(o.contents),p(o.range))}async function ce(o,m,D){if(!o)return;if(Array.isArray(o))return j.map(o,Ve=>Xe(Ve,m),D);let x=o,{defaultRange:he,commitCharacters:ye}=V(x,m),Q=await j.map(x.items,Ve=>Xe(Ve,ye,he,x.itemDefaults?.insertTextMode,x.itemDefaults?.insertTextFormat,x.itemDefaults?.data),D);return new k.CompletionList(Q,x.isIncomplete)}function V(o,m){let D=o.itemDefaults?.editRange,x=o.itemDefaults?.commitCharacters??m;return M.Range.is(D)?{defaultRange:p(D),commitCharacters:x}:D!==void 0?{defaultRange:{inserting:p(D.insert),replacing:p(D.replace)},commitCharacters:x}:{defaultRange:void 0,commitCharacters:x}}function Z(o){return M.CompletionItemKind.Text<=o&&o<=M.CompletionItemKind.TypeParameter?[o-1,void 0]:[k.CompletionItemKind.Text,o]}function Ye(o){switch(o){case M.CompletionItemTag.Deprecated:return k.CompletionItemTag.Deprecated}}function ot(o){if(o==null)return[];let m=[];for(let D of o){let x=Ye(D);x!==void 0&&m.push(x)}return m}function Xe(o,m,D,x,he,ye){let Q=ot(o.tags),Ve=at(o),Y=new _u.default(Ve);o.detail&&(Y.detail=o.detail),o.documentation&&(Y.documentation=T(o.documentation),Y.documentationFormat=Me.string(o.documentation)?"$string":o.documentation.kind),o.filterText&&(Y.filterText=o.filterText);let Gn=Et(o,D,he);if(Gn&&(Y.insertText=Gn.text,Y.range=Gn.range,Y.fromEdit=Gn.fromEdit),Me.number(o.kind)){let[Ad,qa]=Z(o.kind);Y.kind=Ad,qa&&(Y.originalItemKind=qa)}o.sortText&&(Y.sortText=o.sortText),o.additionalTextEdits&&(Y.additionalTextEdits=Ue(o.additionalTextEdits));let xa=o.commitCharacters!==void 0?Me.stringArray(o.commitCharacters)?o.commitCharacters:void 0:m;xa&&(Y.commitCharacters=xa.slice()),o.command&&(Y.command=Ke(o.command)),(o.deprecated===!0||o.deprecated===!1)&&(Y.deprecated=o.deprecated,o.deprecated===!0&&Q.push(k.CompletionItemTag.Deprecated)),(o.preselect===!0||o.preselect===!1)&&(Y.preselect=o.preselect);let Fa=o.data??ye;Fa!==void 0&&(Y.data=Fa),Q.length>0&&(Y.tags=Q);let _r=o.insertTextMode??x;return _r!==void 0&&(Y.insertTextMode=_r,_r===M.InsertTextMode.asIs&&(Y.keepWhitespace=!0)),Y}function at(o){return M.CompletionItemLabelDetails.is(o.labelDetails)?{label:o.label,detail:o.labelDetails.detail,description:o.labelDetails.description}:o.label}function Et(o,m,D){let x=o.insertTextFormat??D;if(o.textEdit!==void 0||m!==void 0){let[he,ye]=o.textEdit!==void 0?Mt(o.textEdit):[m,o.textEditText??o.label];return x===M.InsertTextFormat.Snippet?{text:new k.SnippetString(ye),range:he,fromEdit:!0}:{text:ye,range:he,fromEdit:!0}}else return o.insertText?x===M.InsertTextFormat.Snippet?{text:new k.SnippetString(o.insertText),fromEdit:!1}:{text:o.insertText,fromEdit:!1}:void 0}function Mt(o){return M.InsertReplaceEdit.is(o)?[{inserting:p(o.insert),replacing:p(o.replace)},o.newText]:[p(o.range),o.newText]}function ct(o){if(o)return new k.TextEdit(p(o.range),o.newText)}async function dt(o,m){if(o)return j.map(o,ct,m)}function Ue(o){if(!o)return;let m=new Array(o.length);for(let D=0;D<o.length;D++)m[D]=ct(o[D]);return m}async function cr(o,m){if(!o)return;let D=new k.SignatureHelp;return Me.number(o.activeSignature)?D.activeSignature=o.activeSignature:D.activeSignature=0,Me.number(o.activeParameter)?D.activeParameter=o.activeParameter:D.activeParameter=0,o.signatures&&(D.signatures=await Mn(o.signatures,m)),D}async function Mn(o,m){return j.mapAsync(o,pe,m)}async function pe(o,m){let D=new k.SignatureInformation(o.label);return o.documentation!==void 0&&(D.documentation=T(o.documentation)),o.parameters!==void 0&&(D.parameters=await On(o.parameters,m)),o.activeParameter!==void 0&&(D.activeParameter=o.activeParameter),D}function On(o,m){return j.map(o,ut,m)}function ut(o){let m=new k.ParameterInformation(o.label);return o.documentation&&(m.documentation=T(o.documentation)),m}function Ze(o){return o?new k.Location(i(o.uri),p(o.range)):void 0}async function dr(o,m){if(o)return Un(o,m)}async function An(o,m){if(o)return Un(o,m)}function Ln(o){if(!o)return;let m={targetUri:i(o.targetUri),targetRange:p(o.targetRange),originSelectionRange:p(o.originSelectionRange),targetSelectionRange:p(o.targetSelectionRange)};if(!m.targetSelectionRange)throw new Error("targetSelectionRange must not be undefined or null");return m}async function Un(o,m){if(o)if(Me.array(o)){if(o.length===0)return[];if(M.LocationLink.is(o[0])){let D=o;return j.map(D,Ln,m)}else{let D=o;return j.map(D,Ze,m)}}else return M.LocationLink.is(o)?[Ln(o)]:Ze(o)}async function ur(o,m){if(o)return j.map(o,Ze,m)}async function en(o,m){if(o)return j.map(o,Ot,m)}function Ot(o){let m=new k.DocumentHighlight(p(o.range));return Me.number(o.kind)&&(m.kind=At(o.kind)),m}function At(o){switch(o){case M.DocumentHighlightKind.Text:return k.DocumentHighlightKind.Text;case M.DocumentHighlightKind.Read:return k.DocumentHighlightKind.Read;case M.DocumentHighlightKind.Write:return k.DocumentHighlightKind.Write}return k.DocumentHighlightKind.Text}async function lr(o,m){if(o)return j.map(o,Nn,m)}function lt(o){return o<=M.SymbolKind.TypeParameter?o-1:k.SymbolKind.Property}function Kn(o){switch(o){case M.SymbolTag.Deprecated:return k.SymbolTag.Deprecated;default:return}}function Lt(o){if(o==null)return;let m=[];for(let D of o){let x=Kn(D);x!==void 0&&m.push(x)}return m.length===0?void 0:m}function Nn(o){let m=o.data,D=o.location,x=D.range===void 0||m!==void 0?new xu.default(o.name,lt(o.kind),o.containerName??"",D.range===void 0?i(D.uri):new k.Location(i(o.location.uri),p(D.range)),m):new k.SymbolInformation(o.name,lt(o.kind),o.containerName??"",new k.Location(i(o.location.uri),p(D.range)));return nn(x,o),x}async function pr(o,m){if(o!=null)return j.map(o,tn,m)}function tn(o){let m=new k.DocumentSymbol(o.name,o.detail||"",lt(o.kind),p(o.range),p(o.selectionRange));if(nn(m,o),o.children!==void 0&&o.children.length>0){let D=[];for(let x of o.children)D.push(tn(x));m.children=D}return m}function nn(o,m){o.tags=Lt(m.tags),m.deprecated&&(o.tags?o.tags.includes(k.SymbolTag.Deprecated)||(o.tags=o.tags.concat(k.SymbolTag.Deprecated)):o.tags=[k.SymbolTag.Deprecated])}function Ke(o){let m={title:o.title,command:o.command};return o.arguments&&(m.arguments=o.arguments),m}async function Dt(o,m){if(o)return j.map(o,Ke,m)}let Ie=new Map;Ie.set(M.CodeActionKind.Empty,k.CodeActionKind.Empty),Ie.set(M.CodeActionKind.QuickFix,k.CodeActionKind.QuickFix),Ie.set(M.CodeActionKind.Refactor,k.CodeActionKind.Refactor),Ie.set(M.CodeActionKind.RefactorExtract,k.CodeActionKind.RefactorExtract),Ie.set(M.CodeActionKind.RefactorInline,k.CodeActionKind.RefactorInline),Ie.set(M.CodeActionKind.RefactorRewrite,k.CodeActionKind.RefactorRewrite),Ie.set(M.CodeActionKind.Source,k.CodeActionKind.Source),Ie.set(M.CodeActionKind.SourceOrganizeImports,k.CodeActionKind.SourceOrganizeImports);function pt(o){if(o==null)return;let m=Ie.get(o);if(m)return m;let D=o.split(".");m=k.CodeActionKind.Empty;for(let x of D)m=m.append(x);return m}function fr(o){if(o!=null)return o.map(m=>pt(m))}async function Hn(o,m){if(o==null)return;let D=new ku.default(o.title,o.data);return o.kind!==void 0&&(D.kind=pt(o.kind)),o.diagnostics!==void 0&&(D.diagnostics=u(o.diagnostics)),o.edit!==void 0&&(D.edit=await rn(o.edit,m)),o.command!==void 0&&(D.command=Ke(o.command)),o.isPreferred!==void 0&&(D.isPreferred=o.isPreferred),o.disabled!==void 0&&(D.disabled={reason:o.disabled.reason}),D}function hr(o,m){return j.mapAsync(o,async D=>M.Command.is(D)?Ke(D):Hn(D,m),m)}function $n(o){if(!o)return;let m=new bu.default(p(o.range));return o.command&&(m.command=Ke(o.command)),o.data!==void 0&&o.data!==null&&(m.data=o.data),m}async function gr(o,m){if(o)return j.map(o,$n,m)}async function rn(o,m){if(!o)return;let D=new Map;if(o.changeAnnotations!==void 0){let ye=o.changeAnnotations;await j.forEach(Object.keys(ye),Q=>{let Ve=Wn(ye[Q]);D.set(Q,Ve)},m)}let x=ye=>{if(ye!==void 0)return D.get(ye)},he=new k.WorkspaceEdit;if(o.documentChanges){let ye=o.documentChanges;await j.forEach(ye,Q=>{if(M.CreateFile.is(Q))he.createFile(i(Q.uri),Q.options,x(Q.annotationId));else if(M.RenameFile.is(Q))he.renameFile(i(Q.oldUri),i(Q.newUri),Q.options,x(Q.annotationId));else if(M.DeleteFile.is(Q))he.deleteFile(i(Q.uri),Q.options,x(Q.annotationId));else if(M.TextDocumentEdit.is(Q)){let Ve=i(Q.textDocument.uri);for(let Y of Q.edits)M.AnnotatedTextEdit.is(Y)?he.replace(Ve,p(Y.range),Y.newText,x(Y.annotationId)):he.replace(Ve,p(Y.range),Y.newText)}else throw new Error(`Unknown workspace edit change received:
|
|
6
|
+
${JSON.stringify(Q,void 0,4)}`)},m)}else if(o.changes){let ye=o.changes;await j.forEach(Object.keys(ye),Q=>{he.set(i(Q),Ue(ye[Q]))},m)}return he}function Wn(o){if(o!==void 0)return{label:o.label,needsConfirmation:!!o.needsConfirmation,description:o.description}}function jn(o){let m=p(o.range),D=o.target?r(o.target):void 0,x=new Tu.default(m,D);return o.tooltip!==void 0&&(x.tooltip=o.tooltip),o.data!==void 0&&o.data!==null&&(x.data=o.data),x}async function mr(o,m){if(o)return j.map(o,jn,m)}function et(o){return new k.Color(o.red,o.green,o.blue,o.alpha)}function zn(o){return new k.ColorInformation(p(o.range),et(o.color))}async function vr(o,m){if(o)return j.map(o,zn,m)}function Vn(o){let m=new k.ColorPresentation(o.label);return m.additionalTextEdits=Ue(o.additionalTextEdits),o.textEdit&&(m.textEdit=ct(o.textEdit)),m}async function yr(o,m){if(o)return j.map(o,Vn,m)}function Bn(o){if(o)switch(o){case M.FoldingRangeKind.Comment:return k.FoldingRangeKind.Comment;case M.FoldingRangeKind.Imports:return k.FoldingRangeKind.Imports;case M.FoldingRangeKind.Region:return k.FoldingRangeKind.Region}}function Jn(o){return new k.FoldingRange(o.startLine,o.endLine,Bn(o.kind))}async function Cr(o,m){if(o)return j.map(o,Jn,m)}function sn(o){return new k.SelectionRange(p(o.range),o.parent?sn(o.parent):void 0)}async function wr(o,m){return Array.isArray(o)?j.map(o,sn,m):[]}function Qn(o){return M.InlineValueText.is(o)?new k.InlineValueText(p(o.range),o.text):M.InlineValueVariableLookup.is(o)?new k.InlineValueVariableLookup(p(o.range),o.variableName,o.caseSensitiveLookup):new k.InlineValueEvaluatableExpression(p(o.range),o.expression)}async function Dr(o,m){return Array.isArray(o)?j.map(o,Qn,m):[]}async function on(o,m){let D=typeof o.label=="string"?o.label:await j.map(o.label,d,m),x=new Fu.default(v(o.position),D);return o.kind!==void 0&&(x.kind=o.kind),o.textEdits!==void 0&&(x.textEdits=await dt(o.textEdits,m)),o.tooltip!==void 0&&(x.tooltip=w(o.tooltip)),o.paddingLeft!==void 0&&(x.paddingLeft=o.paddingLeft),o.paddingRight!==void 0&&(x.paddingRight=o.paddingRight),o.data!==void 0&&(x.data=o.data),x}function d(o){let m=new k.InlayHintLabelPart(o.value);return o.location!==void 0&&(m.location=Ze(o.location)),o.tooltip!==void 0&&(m.tooltip=w(o.tooltip)),o.command!==void 0&&(m.command=Ke(o.command)),m}function w(o){return typeof o=="string"?o:P(o)}async function R(o,m){if(Array.isArray(o))return j.mapAsync(o,on,m)}function B(o){if(o===null)return;let m=new Pu.default(lt(o.kind),o.name,o.detail||"",r(o.uri),p(o.range),p(o.selectionRange),o.data);return o.tags!==void 0&&(m.tags=Lt(o.tags)),m}async function G(o,m){if(o!==null)return j.map(o,B,m)}async function fe(o,m){return new k.CallHierarchyIncomingCall(B(o.from),await C(o.fromRanges,m))}async function ke(o,m){if(o!==null)return j.mapAsync(o,fe,m)}async function ze(o,m){return new k.CallHierarchyOutgoingCall(B(o.to),await C(o.fromRanges,m))}async function Pd(o,m){if(o!==null)return j.mapAsync(o,ze,m)}async function Rd(o,m){if(o!=null)return new k.SemanticTokens(new Uint32Array(o.data),o.resultId)}function Pa(o){return new k.SemanticTokensEdit(o.start,o.deleteCount,o.data!==void 0?new Uint32Array(o.data):void 0)}async function xd(o,m){if(o!=null)return new k.SemanticTokensEdits(o.edits.map(Pa),o.resultId)}function Fd(o){return o}async function qd(o,m){if(o!=null)return new k.LinkedEditingRanges(await C(o.ranges,m),Id(o.wordPattern))}function Id(o){if(o!=null)return new RegExp(o)}function Ra(o){if(o===null)return;let m=new Ru.default(lt(o.kind),o.name,o.detail||"",r(o.uri),p(o.range),p(o.selectionRange),o.data);return o.tags!==void 0&&(m.tags=Lt(o.tags)),m}async function Ed(o,m){if(o!==null)return j.map(o,Ra,m)}function Md(o){if(Me.string(o))return o;if(M.RelativePattern.is(o)){if(M.URI.is(o.baseUri))return new k.RelativePattern(r(o.baseUri),o.pattern);if(M.WorkspaceFolder.is(o.baseUri)){let m=k.workspace.getWorkspaceFolder(r(o.baseUri.uri));return m!==void 0?new k.RelativePattern(m,o.pattern):void 0}}}async function Od(o,m){if(!o)return;if(Array.isArray(o))return j.map(o,he=>Sr(he),m);let D=o,x=await j.map(D.items,he=>Sr(he),m);return new k.InlineCompletionList(x)}function Sr(o){let m;typeof o.insertText=="string"?m=o.insertText:m=new k.SnippetString(o.insertText.value);let D;o.command&&(D=Ke(o.command));let x=new k.InlineCompletionItem(m,p(o.range),D);return o.filterText&&(x.filterText=o.filterText),x}return{asUri:r,asDocumentSelector:a,asDiagnostics:c,asDiagnostic:l,asRange:p,asRanges:C,asPosition:v,asDiagnosticSeverity:y,asDiagnosticTag:f,asHover:q,asCompletionResult:ce,asCompletionItem:Xe,asTextEdit:ct,asTextEdits:dt,asSignatureHelp:cr,asSignatureInformations:Mn,asSignatureInformation:pe,asParameterInformations:On,asParameterInformation:ut,asDeclarationResult:dr,asDefinitionResult:An,asLocation:Ze,asReferences:ur,asDocumentHighlights:en,asDocumentHighlight:Ot,asDocumentHighlightKind:At,asSymbolKind:lt,asSymbolTag:Kn,asSymbolTags:Lt,asSymbolInformations:lr,asSymbolInformation:Nn,asDocumentSymbols:pr,asDocumentSymbol:tn,asCommand:Ke,asCommands:Dt,asCodeAction:Hn,asCodeActionKind:pt,asCodeActionKinds:fr,asCodeActionResult:hr,asCodeLens:$n,asCodeLenses:gr,asWorkspaceEdit:rn,asDocumentLink:jn,asDocumentLinks:mr,asFoldingRangeKind:Bn,asFoldingRange:Jn,asFoldingRanges:Cr,asColor:et,asColorInformation:zn,asColorInformations:vr,asColorPresentation:Vn,asColorPresentations:yr,asSelectionRange:sn,asSelectionRanges:wr,asInlineValue:Qn,asInlineValues:Dr,asInlayHint:on,asInlayHints:R,asSemanticTokensLegend:Fd,asSemanticTokens:Rd,asSemanticTokensEdit:Pa,asSemanticTokensEdits:xd,asCallHierarchyItem:B,asCallHierarchyItems:G,asCallHierarchyIncomingCall:fe,asCallHierarchyIncomingCalls:ke,asCallHierarchyOutgoingCall:ze,asCallHierarchyOutgoingCalls:Pd,asLinkedEditingRanges:qd,asTypeHierarchyItem:Ra,asTypeHierarchyItems:Ed,asGlobPattern:Md,asInlineCompletionResult:Od,asInlineCompletionItem:Sr}}hi.createConverter=qu});var te=F(Oe=>{"use strict";Object.defineProperty(Oe,"__esModule",{value:!0});Oe.generateUuid=Oe.parse=Oe.isUUID=Oe.v4=Oe.empty=void 0;var pn=class{constructor(e){this._value=e}asHex(){return this._value}equals(e){return this.asHex()===e.asHex()}},fn=class s extends pn{static _oneOf(e){return e[Math.floor(e.length*Math.random())]}static _randomHex(){return s._oneOf(s._chars)}constructor(){super([s._randomHex(),s._randomHex(),s._randomHex(),s._randomHex(),s._randomHex(),s._randomHex(),s._randomHex(),s._randomHex(),"-",s._randomHex(),s._randomHex(),s._randomHex(),s._randomHex(),"-","4",s._randomHex(),s._randomHex(),s._randomHex(),"-",s._oneOf(s._timeHighBits),s._randomHex(),s._randomHex(),s._randomHex(),"-",s._randomHex(),s._randomHex(),s._randomHex(),s._randomHex(),s._randomHex(),s._randomHex(),s._randomHex(),s._randomHex(),s._randomHex(),s._randomHex(),s._randomHex(),s._randomHex()].join(""))}};fn._chars=["0","1","2","3","4","5","6","6","7","8","9","a","b","c","d","e","f"];fn._timeHighBits=["8","9","a","b"];Oe.empty=new pn("00000000-0000-0000-0000-000000000000");function sc(){return new fn}Oe.v4=sc;var Iu=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function oc(s){return Iu.test(s)}Oe.isUUID=oc;function Eu(s){if(!oc(s))throw new Error("invalid uuid");return new pn(s)}Oe.parse=Eu;function Mu(){return sc().asHex()}Oe.generateUuid=Mu});var vs=F(gi=>{"use strict";Object.defineProperty(gi,"__esModule",{value:!0});gi.ProgressPart=void 0;var ac=I("vscode"),cc=L(),dc=Ee(),ms=class{constructor(e,t,n){this._client=e,this._token=t,this._reported=0,this._infinite=!1,this._lspProgressDisposable=this._client.onProgress(cc.WorkDoneProgress.type,this._token,i=>{switch(i.kind){case"begin":this.begin(i);break;case"report":this.report(i);break;case"end":this.done(),n&&n(this);break}})}begin(e){this._infinite=e.percentage===void 0,this._lspProgressDisposable!==void 0&&ac.window.withProgress({location:ac.ProgressLocation.Window,cancellable:e.cancellable,title:e.title},async(t,n)=>{if(this._lspProgressDisposable!==void 0)return this._progress=t,this._cancellationToken=n,this._tokenDisposable=this._cancellationToken.onCancellationRequested(()=>{this._client.sendNotification(cc.WorkDoneProgressCancelNotification.type,{token:this._token})}),this.report(e),new Promise((i,r)=>{this._resolve=i,this._reject=r})})}report(e){if(this._infinite&&dc.string(e.message))this._progress!==void 0&&this._progress.report({message:e.message});else if(dc.number(e.percentage)){let t=Math.max(0,Math.min(e.percentage,100)),n=Math.max(0,t-this._reported);this._reported+=n,this._progress!==void 0&&this._progress.report({message:e.message,increment:n})}}cancel(){this.cleanup(),this._reject!==void 0&&(this._reject(),this._resolve=void 0,this._reject=void 0)}done(){this.cleanup(),this._resolve!==void 0&&(this._resolve(),this._resolve=void 0,this._reject=void 0)}cleanup(){this._lspProgressDisposable!==void 0&&(this._lspProgressDisposable.dispose(),this._lspProgressDisposable=void 0),this._tokenDisposable!==void 0&&(this._tokenDisposable.dispose(),this._tokenDisposable=void 0),this._progress=void 0,this._cancellationToken=void 0}};gi.ProgressPart=ms});var W=F(ge=>{"use strict";Object.defineProperty(ge,"__esModule",{value:!0});ge.WorkspaceFeature=ge.TextDocumentLanguageFeature=ge.TextDocumentEventFeature=ge.DynamicDocumentFeature=ge.DynamicFeature=ge.StaticFeature=ge.ensure=ge.LSPCancellationError=void 0;var Tt=I("vscode"),ys=L(),Se=Ee(),uc=te(),Cs=class extends Tt.CancellationError{constructor(e){super(),this.data=e}};ge.LSPCancellationError=Cs;function Ou(s,e){return s[e]===void 0&&(s[e]={}),s[e]}ge.ensure=Ou;var lc;(function(s){function e(t){let n=t;return n!=null&&Se.func(n.fillClientCapabilities)&&Se.func(n.initialize)&&Se.func(n.getState)&&Se.func(n.clear)&&(n.fillInitializeParams===void 0||Se.func(n.fillInitializeParams))}s.is=e})(lc||(ge.StaticFeature=lc={}));var pc;(function(s){function e(t){let n=t;return n!=null&&Se.func(n.fillClientCapabilities)&&Se.func(n.initialize)&&Se.func(n.getState)&&Se.func(n.clear)&&(n.fillInitializeParams===void 0||Se.func(n.fillInitializeParams))&&Se.func(n.register)&&Se.func(n.unregister)&&n.registrationType!==void 0}s.is=e})(pc||(ge.DynamicFeature=pc={}));var hn=class{constructor(e){this._client=e}getState(){let e=this.getDocumentSelectors(),t=0;for(let i of e){t++;for(let r of Tt.workspace.textDocuments)if(Tt.languages.match(i,r)>0)return{kind:"document",id:this.registrationType.method,registrations:!0,matches:!0}}let n=t>0;return{kind:"document",id:this.registrationType.method,registrations:n,matches:!1}}};ge.DynamicDocumentFeature=hn;var ws=class extends hn{static textDocumentFilter(e,t){for(let n of e)if(Tt.languages.match(n,t)>0)return!0;return!1}constructor(e,t,n,i,r,a,c){super(e),this._event=t,this._type=n,this._middleware=i,this._createParams=r,this._textDocument=a,this._selectorFilter=c,this._selectors=new Map,this._onNotificationSent=new Tt.EventEmitter}getStateInfo(){return[this._selectors.values(),!1]}getDocumentSelectors(){return this._selectors.values()}register(e){e.registerOptions.documentSelector&&(this._listener||(this._listener=this._event(t=>{this.callback(t).catch(n=>{this._client.error(`Sending document notification ${this._type.method} failed.`,n)})})),this._selectors.set(e.id,this._client.protocol2CodeConverter.asDocumentSelector(e.registerOptions.documentSelector)))}async callback(e){let t=async n=>{let i=this._createParams(n);await this._client.sendNotification(this._type,i),this.notificationSent(this.getTextDocument(n),this._type,i)};if(this.matches(e)){let n=this._middleware();return n?n(e,i=>t(i)):t(e)}}matches(e){return this._client.hasDedicatedTextSynchronizationFeature(this._textDocument(e))?!1:!this._selectorFilter||this._selectorFilter(this._selectors.values(),e)}get onNotificationSent(){return this._onNotificationSent.event}notificationSent(e,t,n){this._onNotificationSent.fire({textDocument:e,type:t,params:n})}unregister(e){this._selectors.delete(e),this._selectors.size===0&&this._listener&&(this._listener.dispose(),this._listener=void 0)}clear(){this._selectors.clear(),this._onNotificationSent.dispose(),this._listener&&(this._listener.dispose(),this._listener=void 0)}getProvider(e){for(let t of this._selectors.values())if(Tt.languages.match(t,e)>0)return{send:n=>this.callback(n)}}};ge.TextDocumentEventFeature=ws;var Ds=class extends hn{constructor(e,t){super(e),this._registrationType=t,this._registrations=new Map}*getDocumentSelectors(){for(let e of this._registrations.values()){let t=e.data.registerOptions.documentSelector;t!==null&&(yield this._client.protocol2CodeConverter.asDocumentSelector(t))}}get registrationType(){return this._registrationType}register(e){if(!e.registerOptions.documentSelector)return;let t=this.registerLanguageProvider(e.registerOptions,e.id);this._registrations.set(e.id,{disposable:t[0],data:e,provider:t[1]})}unregister(e){let t=this._registrations.get(e);t!==void 0&&t.disposable.dispose()}clear(){this._registrations.forEach(e=>{e.disposable.dispose()}),this._registrations.clear()}getRegistration(e,t){if(t){if(ys.TextDocumentRegistrationOptions.is(t)){let n=ys.StaticRegistrationOptions.hasId(t)?t.id:uc.generateUuid(),i=t.documentSelector??e;if(i)return[n,Object.assign({},t,{documentSelector:i})]}else if(Se.boolean(t)&&t===!0||ys.WorkDoneProgressOptions.is(t)){if(!e)return[void 0,void 0];let n=Se.boolean(t)&&t===!0?{documentSelector:e}:Object.assign({},t,{documentSelector:e});return[uc.generateUuid(),n]}}else return[void 0,void 0];return[void 0,void 0]}getRegistrationOptions(e,t){if(!(!e||!t))return Se.boolean(t)&&t===!0?{documentSelector:e}:Object.assign({},t,{documentSelector:e})}getProvider(e){for(let t of this._registrations.values()){let n=t.data.registerOptions.documentSelector;if(n!==null&&Tt.languages.match(this._client.protocol2CodeConverter.asDocumentSelector(n),e)>0)return t.provider}}getAllProviders(){let e=[];for(let t of this._registrations.values())e.push(t.provider);return e}};ge.TextDocumentLanguageFeature=Ds;var Ss=class{constructor(e,t){this._client=e,this._registrationType=t,this._registrations=new Map}getState(){let e=this._registrations.size>0;return{kind:"workspace",id:this._registrationType.method,registrations:e}}get registrationType(){return this._registrationType}register(e){let t=this.registerLanguageProvider(e.registerOptions);this._registrations.set(e.id,{disposable:t[0],provider:t[1]})}unregister(e){let t=this._registrations.get(e);t!==void 0&&t.disposable.dispose()}clear(){this._registrations.forEach(e=>{e.disposable.dispose()}),this._registrations.clear()}getProviders(){let e=[];for(let t of this._registrations.values())e.push(t.provider);return e}};ge.WorkspaceFeature=Ss});var Fs=F(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.DiagnosticFeature=gt.DiagnosticPullMode=gt.vsdiag=void 0;var Au=kr(),N=I("vscode"),ae=L(),Lu=te(),_s=W();function mi(s,e){return s[e]===void 0&&(s[e]={}),s[e]}var Ae;(function(s){let e;(function(t){t.full="full",t.unChanged="unChanged"})(e=s.DocumentDiagnosticReportKind||(s.DocumentDiagnosticReportKind={}))})(Ae||(gt.vsdiag=Ae={}));var vi;(function(s){s.onType="onType",s.onSave="onSave"})(vi||(gt.DiagnosticPullMode=vi={}));var we;(function(s){s.active="open",s.reschedule="reschedule",s.outDated="drop"})(we||(we={}));var bs=class s{constructor(){this.open=new Set,this._onOpen=new N.EventEmitter,this._onClose=new N.EventEmitter,s.fillTabResources(this.open);let e=t=>{if(t.closed.length===0&&t.opened.length===0)return;let n=this.open,i=new Set;s.fillTabResources(i);let r=new Set,a=new Set(i);for(let c of n.values())i.has(c)?a.delete(c):r.add(c);if(this.open=i,r.size>0){let c=new Set;for(let u of r)c.add(N.Uri.parse(u));this._onClose.fire(c)}if(a.size>0){let c=new Set;for(let u of a)c.add(N.Uri.parse(u));this._onOpen.fire(c)}};N.window.tabGroups.onDidChangeTabs!==void 0?this.disposable=N.window.tabGroups.onDidChangeTabs(e):this.disposable={dispose:()=>{}}}get onClose(){return this._onClose.event}get onOpen(){return this._onOpen.event}dispose(){this.disposable.dispose()}isActive(e){return e instanceof N.Uri?N.window.activeTextEditor?.document.uri===e:N.window.activeTextEditor?.document===e}isVisible(e){let t=e instanceof N.Uri?e:e.uri;return this.open.has(t.toString())}getTabResources(){let e=new Set;return s.fillTabResources(new Set,e),e}static fillTabResources(e,t){let n=e??new Set;for(let i of N.window.tabGroups.all)for(let r of i.tabs){let a=r.input,c;a instanceof N.TabInputText?c=a.uri:a instanceof N.TabInputTextDiff?c=a.modified:a instanceof N.TabInputCustom&&(c=a.uri),c!==void 0&&!n.has(c.toString())&&(n.add(c.toString()),t!==void 0&&t.add(c))}}},le;(function(s){s[s.document=1]="document",s[s.workspace=2]="workspace"})(le||(le={}));var tt;(function(s){function e(t){return t instanceof N.Uri?t.toString():t.uri.toString()}s.asKey=e})(tt||(tt={}));var Ts=class{constructor(){this.documentPullStates=new Map,this.workspacePullStates=new Map}track(e,t,n){let i=e===le.document?this.documentPullStates:this.workspacePullStates,[r,a,c]=t instanceof N.Uri?[t.toString(),t,n]:[t.uri.toString(),t.uri,t.version],u=i.get(r);return u===void 0&&(u={document:a,pulledVersion:c,resultId:void 0},i.set(r,u)),u}update(e,t,n,i){let r=e===le.document?this.documentPullStates:this.workspacePullStates,[a,c,u,l]=t instanceof N.Uri?[t.toString(),t,n,i]:[t.uri.toString(),t.uri,t.version,n],g=r.get(a);g===void 0?(g={document:c,pulledVersion:u,resultId:l},r.set(a,g)):(g.pulledVersion=u,g.resultId=l)}unTrack(e,t){let n=tt.asKey(t);(e===le.document?this.documentPullStates:this.workspacePullStates).delete(n)}tracks(e,t){let n=tt.asKey(t);return(e===le.document?this.documentPullStates:this.workspacePullStates).has(n)}getResultId(e,t){let n=tt.asKey(t);return(e===le.document?this.documentPullStates:this.workspacePullStates).get(n)?.resultId}getAllResultIds(){let e=[];for(let[t,n]of this.workspacePullStates)this.documentPullStates.has(t)&&(n=this.documentPullStates.get(t)),n.resultId!==void 0&&e.push({uri:t,value:n.resultId});return e}},ks=class{constructor(e,t,n){this.client=e,this.tabs=t,this.options=n,this.isDisposed=!1,this.onDidChangeDiagnosticsEmitter=new N.EventEmitter,this.provider=this.createProvider(),this.diagnostics=N.languages.createDiagnosticCollection(n.identifier),this.openRequests=new Map,this.documentStates=new Ts,this.workspaceErrorCounter=0}knows(e,t){let n=t instanceof N.Uri?t:t.uri;return this.documentStates.tracks(e,t)||this.openRequests.has(n.toString())}forget(e,t){this.documentStates.unTrack(e,t)}pull(e,t){if(this.isDisposed)return;let n=e instanceof N.Uri?e:e.uri;this.pullAsync(e).then(()=>{t&&t()},i=>{this.client.error(`Document pull failed for text document ${n.toString()}`,i,!1)})}async pullAsync(e,t){if(this.isDisposed)return;let n=e instanceof N.Uri,i=n?e:e.uri,r=i.toString();t=n?t:e.version;let a=this.openRequests.get(r),c=n?this.documentStates.track(le.document,e,t):this.documentStates.track(le.document,e);if(a===void 0){let u=new N.CancellationTokenSource;this.openRequests.set(r,{state:we.active,document:e,version:t,tokenSource:u});let l,g;try{l=await this.provider.provideDiagnostics(e,c.resultId,u.token)??{kind:Ae.DocumentDiagnosticReportKind.full,items:[]}}catch(h){if(h instanceof _s.LSPCancellationError&&ae.DiagnosticServerCancellationData.is(h.data)&&h.data.retriggerRequest===!1&&(g={state:we.outDated,document:e}),g===void 0&&h instanceof N.CancellationError)g={state:we.reschedule,document:e};else throw h}if(g=g??this.openRequests.get(r),g===void 0){this.client.error(`Lost request state in diagnostic pull model. Clearing diagnostics for ${r}`),this.diagnostics.delete(i);return}if(this.openRequests.delete(r),!this.tabs.isVisible(e)){this.documentStates.unTrack(le.document,e);return}if(g.state===we.outDated)return;l!==void 0&&(l.kind===Ae.DocumentDiagnosticReportKind.full&&this.diagnostics.set(i,l.items),c.pulledVersion=t,c.resultId=l.resultId),g.state===we.reschedule&&this.pull(e)}else a.state===we.active?(a.tokenSource.cancel(),this.openRequests.set(r,{state:we.reschedule,document:a.document})):a.state===we.outDated&&this.openRequests.set(r,{state:we.reschedule,document:a.document})}forgetDocument(e){let t=e instanceof N.Uri?e:e.uri,n=t.toString(),i=this.openRequests.get(n);this.options.workspaceDiagnostics?i!==void 0?this.openRequests.set(n,{state:we.reschedule,document:e}):this.pull(e,()=>{this.forget(le.document,e)}):(i!==void 0&&(i.state===we.active&&i.tokenSource.cancel(),this.openRequests.set(n,{state:we.outDated,document:e})),this.diagnostics.delete(t),this.forget(le.document,e))}pullWorkspace(){this.isDisposed||this.pullWorkspaceAsync().then(()=>{this.workspaceTimeout=(0,ae.RAL)().timer.setTimeout(()=>{this.pullWorkspace()},2e3)},e=>{!(e instanceof _s.LSPCancellationError)&&!ae.DiagnosticServerCancellationData.is(e.data)&&(this.client.error("Workspace diagnostic pull failed.",e,!1),this.workspaceErrorCounter++),this.workspaceErrorCounter<=5&&(this.workspaceTimeout=(0,ae.RAL)().timer.setTimeout(()=>{this.pullWorkspace()},2e3))})}async pullWorkspaceAsync(){if(!this.provider.provideWorkspaceDiagnostics||this.isDisposed)return;this.workspaceCancellation!==void 0&&(this.workspaceCancellation.cancel(),this.workspaceCancellation=void 0),this.workspaceCancellation=new N.CancellationTokenSource;let e=this.documentStates.getAllResultIds().map(t=>({uri:this.client.protocol2CodeConverter.asUri(t.uri),value:t.value}));await this.provider.provideWorkspaceDiagnostics(e,this.workspaceCancellation.token,t=>{if(!(!t||this.isDisposed))for(let n of t.items)n.kind===Ae.DocumentDiagnosticReportKind.full&&(this.documentStates.tracks(le.document,n.uri)||this.diagnostics.set(n.uri,n.items)),this.documentStates.update(le.workspace,n.uri,n.version??void 0,n.resultId)})}createProvider(){let e={onDidChangeDiagnostics:this.onDidChangeDiagnosticsEmitter.event,provideDiagnostics:(t,n,i)=>{let r=(c,u,l)=>{let g={identifier:this.options.identifier,textDocument:{uri:this.client.code2ProtocolConverter.asUri(c instanceof N.Uri?c:c.uri)},previousResultId:u};return this.isDisposed===!0||!this.client.isRunning()?{kind:Ae.DocumentDiagnosticReportKind.full,items:[]}:this.client.sendRequest(ae.DocumentDiagnosticRequest.type,g,l).then(async h=>h==null||this.isDisposed||l.isCancellationRequested?{kind:Ae.DocumentDiagnosticReportKind.full,items:[]}:h.kind===ae.DocumentDiagnosticReportKind.Full?{kind:Ae.DocumentDiagnosticReportKind.full,resultId:h.resultId,items:await this.client.protocol2CodeConverter.asDiagnostics(h.items,l)}:{kind:Ae.DocumentDiagnosticReportKind.unChanged,resultId:h.resultId},h=>this.client.handleFailedRequest(ae.DocumentDiagnosticRequest.type,l,h,{kind:Ae.DocumentDiagnosticReportKind.full,items:[]}))},a=this.client.middleware;return a.provideDiagnostics?a.provideDiagnostics(t,n,i,r):r(t,n,i)}};return this.options.workspaceDiagnostics&&(e.provideWorkspaceDiagnostics=(t,n,i)=>{let r=async l=>l.kind===ae.DocumentDiagnosticReportKind.Full?{kind:Ae.DocumentDiagnosticReportKind.full,uri:this.client.protocol2CodeConverter.asUri(l.uri),resultId:l.resultId,version:l.version,items:await this.client.protocol2CodeConverter.asDiagnostics(l.items,n)}:{kind:Ae.DocumentDiagnosticReportKind.unChanged,uri:this.client.protocol2CodeConverter.asUri(l.uri),resultId:l.resultId,version:l.version},a=l=>{let g=[];for(let h of l)g.push({uri:this.client.code2ProtocolConverter.asUri(h.uri),value:h.value});return g},c=(l,g)=>{let h=(0,Lu.generateUuid)(),f=this.client.onProgress(ae.WorkspaceDiagnosticRequest.partialResult,h,async p=>{if(p==null){i(null);return}let C={items:[]};for(let y of p.items)try{C.items.push(await r(y))}catch(b){this.client.error("Converting workspace diagnostics failed.",b)}i(C)}),v={identifier:this.options.identifier,previousResultIds:a(l),partialResultToken:h};return this.isDisposed===!0||!this.client.isRunning()?{items:[]}:this.client.sendRequest(ae.WorkspaceDiagnosticRequest.type,v,g).then(async p=>{if(g.isCancellationRequested)return{items:[]};let C={items:[]};for(let y of p.items)C.items.push(await r(y));return f.dispose(),i(C),{items:[]}},p=>(f.dispose(),this.client.handleFailedRequest(ae.DocumentDiagnosticRequest.type,g,p,{items:[]})))},u=this.client.middleware;return u.provideWorkspaceDiagnostics?u.provideWorkspaceDiagnostics(t,n,i,c):c(t,n,i)}),e}dispose(){this.isDisposed=!0,this.workspaceCancellation?.cancel(),this.workspaceTimeout?.dispose();for(let[e,t]of this.openRequests)t.state===we.active&&t.tokenSource.cancel(),this.openRequests.set(e,{state:we.outDated,document:t.document});this.diagnostics.dispose()}},Ps=class{constructor(e){this.diagnosticRequestor=e,this.documents=new ae.LinkedMap,this.isDisposed=!1}add(e){if(this.isDisposed===!0)return;let t=tt.asKey(e);this.documents.has(t)||(this.documents.set(t,e,ae.Touch.Last),this.trigger())}remove(e){let t=tt.asKey(e);this.documents.delete(t),this.documents.size===0?this.stop():t===this.endDocumentKey()&&(this.endDocument=this.documents.last)}trigger(){if(this.isDisposed!==!0){if(this.intervalHandle!==void 0){this.endDocument=this.documents.last;return}this.endDocument=this.documents.last,this.intervalHandle=(0,ae.RAL)().timer.setInterval(()=>{let e=this.documents.first;if(e!==void 0){let t=tt.asKey(e);this.diagnosticRequestor.pull(e),this.documents.set(t,e,ae.Touch.Last),t===this.endDocumentKey()&&this.stop()}},200)}}dispose(){this.isDisposed=!0,this.stop(),this.documents.clear()}stop(){this.intervalHandle?.dispose(),this.intervalHandle=void 0,this.endDocument=void 0}endDocumentKey(){return this.endDocument!==void 0?tt.asKey(this.endDocument):void 0}},Rs=class{constructor(e,t,n){let i=e.clientOptions.diagnosticPullOptions??{onChange:!0,onSave:!1},r=e.protocol2CodeConverter.asDocumentSelector(n.documentSelector),a=[],c=p=>{let C=n.documentSelector;if(i.match!==void 0)return i.match(C,p);for(let y of C)if(ae.TextDocumentFilter.is(y)){if(typeof y=="string"||y.language!==void 0&&y.language!=="*"||y.scheme!==void 0&&y.scheme!=="*"&&y.scheme!==p.scheme)return!1;if(y.pattern!==void 0){let b=new Au.Minimatch(y.pattern,{noext:!0});if(!b.makeRe()||!b.match(p.fsPath))return!1}}return!0},u=p=>p instanceof N.Uri?c(p):N.languages.match(r,p)>0&&t.isVisible(p),l=p=>p instanceof N.Uri?this.activeTextDocument?.uri.toString()===p.toString():this.activeTextDocument===p;this.diagnosticRequestor=new ks(e,t,n),this.backgroundScheduler=new Ps(this.diagnosticRequestor);let g=p=>{!u(p)||!n.interFileDependencies||l(p)||this.backgroundScheduler.add(p)};this.activeTextDocument=N.window.activeTextEditor?.document,N.window.onDidChangeActiveTextEditor(p=>{let C=this.activeTextDocument;this.activeTextDocument=p?.document,C!==void 0&&g(C),this.activeTextDocument!==void 0&&this.backgroundScheduler.remove(this.activeTextDocument)});let h=e.getFeature(ae.DidOpenTextDocumentNotification.method);a.push(h.onNotificationSent(p=>{let C=p.textDocument;this.diagnosticRequestor.knows(le.document,C)||u(C)&&this.diagnosticRequestor.pull(C,()=>{g(C)})})),a.push(t.onOpen(p=>{for(let C of p){if(this.diagnosticRequestor.knows(le.document,C))continue;let y=C.toString(),b;for(let T of N.workspace.textDocuments)if(y===T.uri.toString()){b=T;break}b!==void 0&&u(b)&&this.diagnosticRequestor.pull(b,()=>{g(b)})}}));let f=new Set;for(let p of N.workspace.textDocuments)u(p)&&(this.diagnosticRequestor.pull(p,()=>{g(p)}),f.add(p.uri.toString()));if(i.onTabs===!0)for(let p of t.getTabResources())!f.has(p.toString())&&u(p)&&this.diagnosticRequestor.pull(p,()=>{g(p)});if(i.onChange===!0){let p=e.getFeature(ae.DidChangeTextDocumentNotification.method);a.push(p.onNotificationSent(async C=>{let y=C.textDocument;(i.filter===void 0||!i.filter(y,vi.onType))&&this.diagnosticRequestor.knows(le.document,y)&&this.diagnosticRequestor.pull(y,()=>{this.backgroundScheduler.trigger()})}))}if(i.onSave===!0){let p=e.getFeature(ae.DidSaveTextDocumentNotification.method);a.push(p.onNotificationSent(C=>{let y=C.textDocument;(i.filter===void 0||!i.filter(y,vi.onSave))&&this.diagnosticRequestor.knows(le.document,y)&&this.diagnosticRequestor.pull(C.textDocument,()=>{this.backgroundScheduler.trigger()})}))}let v=e.getFeature(ae.DidCloseTextDocumentNotification.method);a.push(v.onNotificationSent(p=>{this.cleanUpDocument(p.textDocument)})),t.onClose(p=>{for(let C of p)this.cleanUpDocument(C)}),this.diagnosticRequestor.onDidChangeDiagnosticsEmitter.event(()=>{for(let p of N.workspace.textDocuments)u(p)&&this.diagnosticRequestor.pull(p)}),n.workspaceDiagnostics===!0&&n.identifier!=="da348dc5-c30a-4515-9d98-31ff3be38d14"&&this.diagnosticRequestor.pullWorkspace(),this.disposable=N.Disposable.from(...a,this.backgroundScheduler,this.diagnosticRequestor)}get onDidChangeDiagnosticsEmitter(){return this.diagnosticRequestor.onDidChangeDiagnosticsEmitter}get diagnostics(){return this.diagnosticRequestor.provider}cleanUpDocument(e){this.diagnosticRequestor.knows(le.document,e)&&(this.diagnosticRequestor.forgetDocument(e),this.backgroundScheduler.remove(e))}},xs=class extends _s.TextDocumentLanguageFeature{constructor(e){super(e,ae.DocumentDiagnosticRequest.type)}fillClientCapabilities(e){let t=mi(mi(e,"textDocument"),"diagnostic");t.dynamicRegistration=!0,t.relatedDocumentSupport=!1,mi(mi(e,"workspace"),"diagnostics").refreshSupport=!0}initialize(e,t){this._client.onRequest(ae.DiagnosticRefreshRequest.type,async()=>{for(let a of this.getAllProviders())a.onDidChangeDiagnosticsEmitter.fire()});let[i,r]=this.getRegistration(t,e.diagnosticProvider);!i||!r||this.register({id:i,registerOptions:r})}clear(){this.tabs!==void 0&&(this.tabs.dispose(),this.tabs=void 0),super.clear()}registerLanguageProvider(e){this.tabs===void 0&&(this.tabs=new bs);let t=new Rs(this._client,this.tabs,e);return[t.disposable,t]}};gt.DiagnosticFeature=xs});var gc=F(Di=>{"use strict";Object.defineProperty(Di,"__esModule",{value:!0});Di.NotebookDocumentSyncFeature=void 0;var De=I("vscode"),Uu=kr(),nt=L(),Ku=te(),fc=Ee();function hc(s,e){return s[e]===void 0&&(s[e]={}),s[e]}var Wt;(function(s){let e;(function(t){function n(f,v){return{version:f.version,uri:v.asUri(f.uri)}}t.asVersionedNotebookDocumentIdentifier=n;function i(f,v,p){let C=nt.NotebookDocument.create(p.asUri(f.uri),f.notebookType,f.version,r(v,p));return Object.keys(f.metadata).length>0&&(C.metadata=a(f.metadata)),C}t.asNotebookDocument=i;function r(f,v){return f.map(p=>c(p,v))}t.asNotebookCells=r;function a(f){return l(new Set,f)}t.asMetadata=a;function c(f,v){let p=nt.NotebookCell.create(u(f.kind),v.asUri(f.document.uri));return Object.keys(f.metadata).length>0&&(p.metadata=a(f.metadata)),f.executionSummary!==void 0&&fc.number(f.executionSummary.executionOrder)&&fc.boolean(f.executionSummary.success)&&(p.executionSummary={executionOrder:f.executionSummary.executionOrder,success:f.executionSummary.success}),p}t.asNotebookCell=c;function u(f){switch(f){case De.NotebookCellKind.Markup:return nt.NotebookCellKind.Markup;case De.NotebookCellKind.Code:return nt.NotebookCellKind.Code}}function l(f,v){if(f.has(v))throw new Error("Can't deep copy cyclic structures.");if(Array.isArray(v)){let p=[];for(let C of v)if(C!==null&&typeof C=="object"||Array.isArray(C))p.push(l(f,C));else{if(C instanceof RegExp)throw new Error("Can't transfer regular expressions to the server");p.push(C)}return p}else{let p=Object.keys(v),C=Object.create(null);for(let y of p){let b=v[y];if(b!==null&&typeof b=="object"||Array.isArray(b))C[y]=l(f,b);else{if(b instanceof RegExp)throw new Error("Can't transfer regular expressions to the server");C[y]=b}}return C}}function g(f,v){let p=v.asChangeTextDocumentParams(f,f.document.uri,f.document.version);return{document:p.textDocument,changes:p.contentChanges}}t.asTextContentChange=g;function h(f,v){let p=Object.create(null);if(f.metadata&&(p.metadata=s.c2p.asMetadata(f.metadata)),f.cells!==void 0){let C=Object.create(null),y=f.cells;y.structure&&(C.structure={array:{start:y.structure.array.start,deleteCount:y.structure.array.deleteCount,cells:y.structure.array.cells!==void 0?y.structure.array.cells.map(b=>s.c2p.asNotebookCell(b,v)):void 0},didOpen:y.structure.didOpen!==void 0?y.structure.didOpen.map(b=>v.asOpenTextDocumentParams(b.document).textDocument):void 0,didClose:y.structure.didClose!==void 0?y.structure.didClose.map(b=>v.asCloseTextDocumentParams(b.document).textDocument):void 0}),y.data!==void 0&&(C.data=y.data.map(b=>s.c2p.asNotebookCell(b,v))),y.textContent!==void 0&&(C.textContent=y.textContent.map(b=>s.c2p.asTextContentChange(b,v))),Object.keys(C).length>0&&(p.cells=C)}return p}t.asNotebookDocumentChangeEvent=h})(e=s.c2p||(s.c2p={}))})(Wt||(Wt={}));var qs;(function(s){function e(c,u,l){let g=c.length,h=u.length,f=0;for(;f<h&&f<g&&t(c[f],u[f],l);)f++;if(f<h&&f<g){let v=g-1,p=h-1;for(;v>=0&&p>=0&&t(c[v],u[p],l);)v--,p--;let C=v+1-f,y=f===p+1?void 0:u.slice(f,p+1);return y!==void 0?{start:f,deleteCount:C,cells:y}:{start:f,deleteCount:C}}else return f<h?{start:f,deleteCount:0,cells:u.slice(f)}:f<g?{start:f,deleteCount:g-f}:void 0}s.computeDiff=e;function t(c,u,l=!0){return c.kind!==u.kind||c.document.uri.toString()!==u.document.uri.toString()||c.document.languageId!==u.document.languageId||!n(c.executionSummary,u.executionSummary)?!1:!l||l&&r(c.metadata,u.metadata)}function n(c,u){return c===u?!0:c===void 0||u===void 0?!1:c.executionOrder===u.executionOrder&&c.success===u.success&&i(c.timing,u.timing)}function i(c,u){return c===u?!0:c===void 0||u===void 0?!1:c.startTime===u.startTime&&c.endTime===u.endTime}function r(c,u){if(c===u)return!0;if(c==null||u===null||u===void 0||typeof c!=typeof u||typeof c!="object")return!1;let l=Array.isArray(c),g=Array.isArray(u);if(l!==g)return!1;if(l&&g){if(c.length!==u.length)return!1;for(let h=0;h<c.length;h++)if(!r(c[h],u[h]))return!1}if(a(c)&&a(u)){let h=Object.keys(c),f=Object.keys(u);if(h.length!==f.length||(h.sort(),f.sort(),!r(h,f)))return!1;for(let v=0;v<h.length;v++){let p=h[v];if(!r(c[p],u[p]))return!1}return!0}return!1}function a(c){return c!==null&&typeof c=="object"}s.isObjectLiteral=a})(qs||(qs={}));var Is;(function(s){function e(t,n){if(typeof t=="string")return t==="*"||n.notebookType===t;if(t.notebookType!==void 0&&t.notebookType!=="*"&&n.notebookType!==t.notebookType)return!1;let i=n.uri;if(t.scheme!==void 0&&t.scheme!=="*"&&i.scheme!==t.scheme)return!1;if(t.pattern!==void 0){let r=new Uu.Minimatch(t.pattern,{noext:!0});if(!r.makeRe()||!r.match(i.fsPath))return!1}return!0}s.matchNotebook=e})(Is||(Is={}));var yi;(function(s){function e(n){let i=n.notebookSelector,r=[];for(let a of i){let c=(typeof a.notebook=="string"?a.notebook:a.notebook?.notebookType)??"*",u=typeof a.notebook=="string"?void 0:a.notebook?.scheme,l=typeof a.notebook=="string"?void 0:a.notebook?.pattern;if(a.cells!==void 0)for(let g of a.cells)r.push(t(c,u,l,g.language));else r.push(t(c,u,l,void 0))}return r}s.asDocumentSelector=e;function t(n,i,r,a){return i===void 0&&r===void 0?{notebook:n,language:a}:{notebook:{notebookType:n,scheme:i,pattern:r},language:a}}})(yi||(yi={}));var Ci;(function(s){function e(t){return{cells:t,uris:new Set(t.map(n=>n.document.uri.toString()))}}s.create=e})(Ci||(Ci={}));var jt=class{constructor(e,t){this.client=e,this.options=t,this.notebookSyncInfo=new Map,this.notebookDidOpen=new Set,this.disposables=[],this.selector=e.protocol2CodeConverter.asDocumentSelector(yi.asDocumentSelector(t)),De.workspace.onDidOpenNotebookDocument(n=>{this.notebookDidOpen.add(n.uri.toString()),this.didOpen(n)},void 0,this.disposables);for(let n of De.workspace.notebookDocuments)this.notebookDidOpen.add(n.uri.toString()),this.didOpen(n);De.workspace.onDidChangeNotebookDocument(n=>this.didChangeNotebookDocument(n),void 0,this.disposables),this.options.save===!0&&De.workspace.onDidSaveNotebookDocument(n=>this.didSave(n),void 0,this.disposables),De.workspace.onDidCloseNotebookDocument(n=>{this.didClose(n),this.notebookDidOpen.delete(n.uri.toString())},void 0,this.disposables)}getState(){for(let e of De.workspace.notebookDocuments)if(this.getMatchingCells(e)!==void 0)return{kind:"document",id:"$internal",registrations:!0,matches:!0};return{kind:"document",id:"$internal",registrations:!0,matches:!1}}get mode(){return"notebook"}handles(e){return De.languages.match(this.selector,e)>0}didOpenNotebookCellTextDocument(e,t){if(De.languages.match(this.selector,t.document)===0||!this.notebookDidOpen.has(e.uri.toString()))return;let n=this.notebookSyncInfo.get(e.uri.toString()),i=this.cellMatches(e,t);if(n!==void 0){let r=n.uris.has(t.document.uri.toString());if(i&&r||!i&&!r)return;if(i){let a=this.getMatchingCells(e);if(a!==void 0){let c=this.asNotebookDocumentChangeEvent(e,void 0,n,a);c!==void 0&&this.doSendChange(c,a).catch(()=>{})}}}else i&&this.doSendOpen(e,[t]).catch(()=>{})}didChangeNotebookCellTextDocument(e,t){De.languages.match(this.selector,t.document)!==0&&this.doSendChange({notebook:e,cells:{textContent:[t]}},void 0).catch(()=>{})}didCloseNotebookCellTextDocument(e,t){let n=this.notebookSyncInfo.get(e.uri.toString());if(n===void 0)return;let i=t.document.uri,r=n.cells.findIndex(a=>a.document.uri.toString()===i.toString());if(r!==-1)if(r===0&&n.cells.length===1)this.doSendClose(e,n.cells).catch(()=>{});else{let a=n.cells.slice(),c=a.splice(r,1);this.doSendChange({notebook:e,cells:{structure:{array:{start:r,deleteCount:1},didClose:c}}},a).catch(()=>{})}}dispose(){for(let e of this.disposables)e.dispose()}didOpen(e,t=this.getMatchingCells(e),n=this.notebookSyncInfo.get(e.uri.toString())){if(n!==void 0)if(t!==void 0){let i=this.asNotebookDocumentChangeEvent(e,void 0,n,t);i!==void 0&&this.doSendChange(i,t).catch(()=>{})}else this.doSendClose(e,[]).catch(()=>{});else{if(t===void 0)return;this.doSendOpen(e,t).catch(()=>{})}}didChangeNotebookDocument(e){let t=e.notebook,n=this.notebookSyncInfo.get(t.uri.toString());if(n===void 0){if(e.contentChanges.length===0)return;let i=this.getMatchingCells(t);if(i===void 0)return;this.didOpen(t,i,n)}else{let i=this.getMatchingCells(t);if(i===void 0){this.didClose(t,n);return}let r=this.asNotebookDocumentChangeEvent(e.notebook,e,n,i);r!==void 0&&this.doSendChange(r,i).catch(()=>{})}}didSave(e){this.notebookSyncInfo.get(e.uri.toString())!==void 0&&this.doSendSave(e).catch(()=>{})}didClose(e,t=this.notebookSyncInfo.get(e.uri.toString())){if(t===void 0)return;let n=e.getCells().filter(i=>t.uris.has(i.document.uri.toString()));this.doSendClose(e,n).catch(()=>{})}async sendDidOpenNotebookDocument(e){let t=this.getMatchingCells(e);if(t!==void 0)return this.doSendOpen(e,t)}async doSendOpen(e,t){let n=async(r,a)=>{let c=Wt.c2p.asNotebookDocument(r,a,this.client.code2ProtocolConverter),u=a.map(l=>this.client.code2ProtocolConverter.asTextDocumentItem(l.document));try{await this.client.sendNotification(nt.DidOpenNotebookDocumentNotification.type,{notebookDocument:c,cellTextDocuments:u})}catch(l){throw this.client.error("Sending DidOpenNotebookDocumentNotification failed",l),l}},i=this.client.middleware?.notebooks;return this.notebookSyncInfo.set(e.uri.toString(),Ci.create(t)),i?.didOpen!==void 0?i.didOpen(e,t,n):n(e,t)}async sendDidChangeNotebookDocument(e){return this.doSendChange(e,void 0)}async doSendChange(e,t=this.getMatchingCells(e.notebook)){let n=async r=>{try{await this.client.sendNotification(nt.DidChangeNotebookDocumentNotification.type,{notebookDocument:Wt.c2p.asVersionedNotebookDocumentIdentifier(r.notebook,this.client.code2ProtocolConverter),change:Wt.c2p.asNotebookDocumentChangeEvent(r,this.client.code2ProtocolConverter)})}catch(a){throw this.client.error("Sending DidChangeNotebookDocumentNotification failed",a),a}},i=this.client.middleware?.notebooks;return e.cells?.structure!==void 0&&this.notebookSyncInfo.set(e.notebook.uri.toString(),Ci.create(t??[])),i?.didChange!==void 0?i?.didChange(e,n):n(e)}async sendDidSaveNotebookDocument(e){return this.doSendSave(e)}async doSendSave(e){let t=async i=>{try{await this.client.sendNotification(nt.DidSaveNotebookDocumentNotification.type,{notebookDocument:{uri:this.client.code2ProtocolConverter.asUri(i.uri)}})}catch(r){throw this.client.error("Sending DidSaveNotebookDocumentNotification failed",r),r}},n=this.client.middleware?.notebooks;return n?.didSave!==void 0?n.didSave(e,t):t(e)}async sendDidCloseNotebookDocument(e){return this.doSendClose(e,this.getMatchingCells(e)??[])}async doSendClose(e,t){let n=async(r,a)=>{try{await this.client.sendNotification(nt.DidCloseNotebookDocumentNotification.type,{notebookDocument:{uri:this.client.code2ProtocolConverter.asUri(r.uri)},cellTextDocuments:a.map(c=>this.client.code2ProtocolConverter.asTextDocumentIdentifier(c.document))})}catch(c){throw this.client.error("Sending DidCloseNotebookDocumentNotification failed",c),c}},i=this.client.middleware?.notebooks;return this.notebookSyncInfo.delete(e.uri.toString()),i?.didClose!==void 0?i.didClose(e,t,n):n(e,t)}asNotebookDocumentChangeEvent(e,t,n,i){if(t!==void 0&&t.notebook!==e)throw new Error("Notebook must be identical");let r={notebook:e};t?.metadata!==void 0&&(r.metadata=Wt.c2p.asMetadata(t.metadata));let a;if(t?.cellChanges!==void 0&&t.cellChanges.length>0){let c=[];a=new Set(i.map(u=>u.document.uri.toString()));for(let u of t.cellChanges)a.has(u.cell.document.uri.toString())&&(u.executionSummary!==void 0||u.metadata!==void 0)&&c.push(u.cell);c.length>0&&(r.cells=r.cells??{},r.cells.data=c)}if((t?.contentChanges!==void 0&&t.contentChanges.length>0||t===void 0)&&n!==void 0&&i!==void 0){let c=n.cells,u=i,l=qs.computeDiff(c,u,!1),g,h;if(l!==void 0){g=l.cells===void 0?new Map:new Map(l.cells.map(p=>[p.document.uri.toString(),p])),h=l.deleteCount===0?new Map:new Map(c.slice(l.start,l.start+l.deleteCount).map(p=>[p.document.uri.toString(),p]));for(let p of Array.from(h.keys()))g.has(p)&&(h.delete(p),g.delete(p));r.cells=r.cells??{};let f=[],v=[];if(g.size>0||h.size>0){for(let p of g.values())f.push(p);for(let p of h.values())v.push(p)}r.cells.structure={array:l,didOpen:f,didClose:v}}}return Object.keys(r).length>1?r:void 0}getMatchingCells(e,t=e.getCells()){if(this.options.notebookSelector!==void 0){for(let n of this.options.notebookSelector)if(n.notebook===void 0||Is.matchNotebook(n.notebook,e)){let i=this.filterCells(e,t,n.cells);return i.length===0?void 0:i}}}cellMatches(e,t){let n=this.getMatchingCells(e,[t]);return n!==void 0&&n[0]===t}filterCells(e,t,n){let i=n!==void 0?t.filter(r=>{let a=r.document.languageId;return n.some(c=>c.language==="*"||a===c.language)}):t;return typeof this.client.clientOptions.notebookDocumentOptions?.filterCells=="function"?this.client.clientOptions.notebookDocumentOptions.filterCells(e,i):i}},wi=class s{constructor(e){this.client=e,this.registrations=new Map,this.registrationType=nt.NotebookDocumentSyncRegistrationType.type,De.workspace.onDidOpenTextDocument(t=>{if(t.uri.scheme!==s.CellScheme)return;let[n,i]=this.findNotebookDocumentAndCell(t);if(!(n===void 0||i===void 0))for(let r of this.registrations.values())r instanceof jt&&r.didOpenNotebookCellTextDocument(n,i)}),De.workspace.onDidChangeTextDocument(t=>{if(t.contentChanges.length===0)return;let n=t.document;if(n.uri.scheme!==s.CellScheme)return;let[i]=this.findNotebookDocumentAndCell(n);if(i!==void 0)for(let r of this.registrations.values())r instanceof jt&&r.didChangeNotebookCellTextDocument(i,t)}),De.workspace.onDidCloseTextDocument(t=>{if(t.uri.scheme!==s.CellScheme)return;let[n,i]=this.findNotebookDocumentAndCell(t);if(!(n===void 0||i===void 0))for(let r of this.registrations.values())r instanceof jt&&r.didCloseNotebookCellTextDocument(n,i)})}getState(){if(this.registrations.size===0)return{kind:"document",id:this.registrationType.method,registrations:!1,matches:!1};for(let e of this.registrations.values()){let t=e.getState();if(t.kind==="document"&&t.registrations===!0&&t.matches===!0)return{kind:"document",id:this.registrationType.method,registrations:!0,matches:!0}}return{kind:"document",id:this.registrationType.method,registrations:!0,matches:!1}}fillClientCapabilities(e){let t=hc(hc(e,"notebookDocument"),"synchronization");t.dynamicRegistration=!0,t.executionSummarySupport=!0}preInitialize(e){let t=e.notebookDocumentSync;t!==void 0&&(this.dedicatedChannel=this.client.protocol2CodeConverter.asDocumentSelector(yi.asDocumentSelector(t)))}initialize(e){let t=e.notebookDocumentSync;if(t===void 0)return;let n=t.id??Ku.generateUuid();this.register({id:n,registerOptions:t})}register(e){let t=new jt(this.client,e.registerOptions);this.registrations.set(e.id,t)}unregister(e){let t=this.registrations.get(e);t&&t.dispose()}clear(){for(let e of this.registrations.values())e.dispose();this.registrations.clear()}handles(e){if(e.uri.scheme!==s.CellScheme)return!1;if(this.dedicatedChannel!==void 0&&De.languages.match(this.dedicatedChannel,e)>0)return!0;for(let t of this.registrations.values())if(t.handles(e))return!0;return!1}getProvider(e){for(let t of this.registrations.values())if(t.handles(e.document))return t}findNotebookDocumentAndCell(e){let t=e.uri.toString();for(let n of De.workspace.notebookDocuments)for(let i of n.getCells())if(i.document.uri.toString()===t)return[n,i];return[void 0,void 0]}};Di.NotebookDocumentSyncFeature=wi;wi.CellScheme="vscode-notebook-cell"});var vc=F(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.SyncConfigurationFeature=mt.toJSONObject=mt.ConfigurationFeature=void 0;var zt=I("vscode"),gn=L(),Nu=Ee(),Hu=te(),mc=W(),Es=class{constructor(e){this._client=e}getState(){return{kind:"static"}}fillClientCapabilities(e){e.workspace=e.workspace||{},e.workspace.configuration=!0}initialize(){let e=this._client;e.onRequest(gn.ConfigurationRequest.type,(t,n)=>{let i=a=>{let c=[];for(let u of a.items){let l=u.scopeUri!==void 0&&u.scopeUri!==null?this._client.protocol2CodeConverter.asUri(u.scopeUri):void 0;c.push(this.getConfiguration(l,u.section!==null?u.section:void 0))}return c},r=e.middleware.workspace;return r&&r.configuration?r.configuration(t,n,i):i(t,n)})}getConfiguration(e,t){let n=null;if(t){let i=t.lastIndexOf(".");if(i===-1)n=kt(zt.workspace.getConfiguration(void 0,e).get(t));else{let r=zt.workspace.getConfiguration(t.substr(0,i),e);r&&(n=kt(r.get(t.substr(i+1))))}}else{let i=zt.workspace.getConfiguration(void 0,e);n={};for(let r of Object.keys(i))i.has(r)&&(n[r]=kt(i.get(r)))}return n===void 0&&(n=null),n}clear(){}};mt.ConfigurationFeature=Es;function kt(s){if(s){if(Array.isArray(s))return s.map(kt);if(typeof s=="object"){let e=Object.create(null);for(let t in s)Object.prototype.hasOwnProperty.call(s,t)&&(e[t]=kt(s[t]));return e}}return s}mt.toJSONObject=kt;var Ms=class{constructor(e){this._client=e,this.isCleared=!1,this._listeners=new Map}getState(){return{kind:"workspace",id:this.registrationType.method,registrations:this._listeners.size>0}}get registrationType(){return gn.DidChangeConfigurationNotification.type}fillClientCapabilities(e){(0,mc.ensure)((0,mc.ensure)(e,"workspace"),"didChangeConfiguration").dynamicRegistration=!0}initialize(){this.isCleared=!1;let e=this._client.clientOptions.synchronize?.configurationSection;e!==void 0&&this.register({id:Hu.generateUuid(),registerOptions:{section:e}})}register(e){let t=zt.workspace.onDidChangeConfiguration(n=>{this.onDidChangeConfiguration(e.registerOptions.section,n)});this._listeners.set(e.id,t),e.registerOptions.section!==void 0&&this.onDidChangeConfiguration(e.registerOptions.section,void 0)}unregister(e){let t=this._listeners.get(e);t&&(this._listeners.delete(e),t.dispose())}clear(){for(let e of this._listeners.values())e.dispose();this._listeners.clear(),this.isCleared=!0}onDidChangeConfiguration(e,t){if(this.isCleared)return;let n;if(Nu.string(e)?n=[e]:n=e,n!==void 0&&t!==void 0&&!n.some(c=>t.affectsConfiguration(c)))return;let i=async a=>a===void 0?this._client.sendNotification(gn.DidChangeConfigurationNotification.type,{settings:null}):this._client.sendNotification(gn.DidChangeConfigurationNotification.type,{settings:this.extractSettingsInformation(a)}),r=this._client.middleware.workspace?.didChangeConfiguration;(r?r(n,i):i(n)).catch(a=>{this._client.error(`Sending notification ${gn.DidChangeConfigurationNotification.type.method} failed`,a)})}extractSettingsInformation(e){function t(r,a){let c=r;for(let u=0;u<a.length-1;u++){let l=c[a[u]];l||(l=Object.create(null),c[a[u]]=l),c=l}return c}let n=this._client.clientOptions.workspaceFolder?this._client.clientOptions.workspaceFolder.uri:void 0,i=Object.create(null);for(let r=0;r<e.length;r++){let a=e[r],c=a.indexOf("."),u=null;if(c>=0?u=zt.workspace.getConfiguration(a.substr(0,c),n).get(a.substr(c+1)):u=zt.workspace.getConfiguration(void 0,n).get(a),u){let l=e[r].split(".");t(i,l)[l[l.length-1]]=kt(u)}}return i}};mt.SyncConfigurationFeature=Ms});var yc=F(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.DidSaveTextDocumentFeature=_e.WillSaveWaitUntilFeature=_e.WillSaveFeature=_e.DidChangeTextDocumentFeature=_e.DidCloseTextDocumentFeature=_e.DidOpenTextDocumentFeature=void 0;var Re=I("vscode"),X=L(),ie=W(),Vt=te(),Os=class extends ie.TextDocumentEventFeature{constructor(e,t){super(e,Re.workspace.onDidOpenTextDocument,X.DidOpenTextDocumentNotification.type,()=>e.middleware.didOpen,n=>e.code2ProtocolConverter.asOpenTextDocumentParams(n),n=>n,ie.TextDocumentEventFeature.textDocumentFilter),this._syncedDocuments=t}get openDocuments(){return this._syncedDocuments.values()}fillClientCapabilities(e){(0,ie.ensure)((0,ie.ensure)(e,"textDocument"),"synchronization").dynamicRegistration=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;t&&n&&n.openClose&&this.register({id:Vt.generateUuid(),registerOptions:{documentSelector:t}})}get registrationType(){return X.DidOpenTextDocumentNotification.type}register(e){if(super.register(e),!e.registerOptions.documentSelector)return;let t=this._client.protocol2CodeConverter.asDocumentSelector(e.registerOptions.documentSelector);Re.workspace.textDocuments.forEach(n=>{let i=n.uri.toString();if(!this._syncedDocuments.has(i)&&Re.languages.match(t,n)>0&&!this._client.hasDedicatedTextSynchronizationFeature(n)){let r=this._client.middleware,a=c=>this._client.sendNotification(this._type,this._createParams(c));(r.didOpen?r.didOpen(n,a):a(n)).catch(c=>{this._client.error(`Sending document notification ${this._type.method} failed`,c)}),this._syncedDocuments.set(i,n)}})}getTextDocument(e){return e}notificationSent(e,t,n){this._syncedDocuments.set(e.uri.toString(),e),super.notificationSent(e,t,n)}};_e.DidOpenTextDocumentFeature=Os;var As=class extends ie.TextDocumentEventFeature{constructor(e,t,n){super(e,Re.workspace.onDidCloseTextDocument,X.DidCloseTextDocumentNotification.type,()=>e.middleware.didClose,i=>e.code2ProtocolConverter.asCloseTextDocumentParams(i),i=>i,ie.TextDocumentEventFeature.textDocumentFilter),this._syncedDocuments=t,this._pendingTextDocumentChanges=n}get registrationType(){return X.DidCloseTextDocumentNotification.type}fillClientCapabilities(e){(0,ie.ensure)((0,ie.ensure)(e,"textDocument"),"synchronization").dynamicRegistration=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;t&&n&&n.openClose&&this.register({id:Vt.generateUuid(),registerOptions:{documentSelector:t}})}async callback(e){await super.callback(e),this._pendingTextDocumentChanges.delete(e.uri.toString())}getTextDocument(e){return e}notificationSent(e,t,n){this._syncedDocuments.delete(e.uri.toString()),super.notificationSent(e,t,n)}unregister(e){let t=this._selectors.get(e);super.unregister(e);let n=this._selectors.values();this._syncedDocuments.forEach(i=>{if(Re.languages.match(t,i)>0&&!this._selectorFilter(n,i)&&!this._client.hasDedicatedTextSynchronizationFeature(i)){let r=this._client.middleware,a=c=>this._client.sendNotification(this._type,this._createParams(c));this._syncedDocuments.delete(i.uri.toString()),(r.didClose?r.didClose(i,a):a(i)).catch(c=>{this._client.error(`Sending document notification ${this._type.method} failed`,c)})}})}};_e.DidCloseTextDocumentFeature=As;var Ls=class extends ie.DynamicDocumentFeature{constructor(e,t){super(e),this._changeData=new Map,this._onNotificationSent=new Re.EventEmitter,this._onPendingChangeAdded=new Re.EventEmitter,this._pendingTextDocumentChanges=t,this._syncKind=X.TextDocumentSyncKind.None}get onNotificationSent(){return this._onNotificationSent.event}get onPendingChangeAdded(){return this._onPendingChangeAdded.event}get syncKind(){return this._syncKind}get registrationType(){return X.DidChangeTextDocumentNotification.type}fillClientCapabilities(e){(0,ie.ensure)((0,ie.ensure)(e,"textDocument"),"synchronization").dynamicRegistration=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;t&&n&&n.change!==void 0&&n.change!==X.TextDocumentSyncKind.None&&this.register({id:Vt.generateUuid(),registerOptions:Object.assign({},{documentSelector:t},{syncKind:n.change})})}register(e){e.registerOptions.documentSelector&&(this._listener||(this._listener=Re.workspace.onDidChangeTextDocument(this.callback,this)),this._changeData.set(e.id,{syncKind:e.registerOptions.syncKind,documentSelector:this._client.protocol2CodeConverter.asDocumentSelector(e.registerOptions.documentSelector)}),this.updateSyncKind(e.registerOptions.syncKind))}*getDocumentSelectors(){for(let e of this._changeData.values())yield e.documentSelector}async callback(e){if(e.contentChanges.length===0)return;let t=e.document.uri,n=e.document.version,i=[];for(let r of this._changeData.values())if(Re.languages.match(r.documentSelector,e.document)>0&&!this._client.hasDedicatedTextSynchronizationFeature(e.document)){let a=this._client.middleware;if(r.syncKind===X.TextDocumentSyncKind.Incremental){let c=async u=>{let l=this._client.code2ProtocolConverter.asChangeTextDocumentParams(u,t,n);await this._client.sendNotification(X.DidChangeTextDocumentNotification.type,l),this.notificationSent(u.document,X.DidChangeTextDocumentNotification.type,l)};i.push(a.didChange?a.didChange(e,u=>c(u)):c(e))}else if(r.syncKind===X.TextDocumentSyncKind.Full){let c=async u=>{let l=u.document.uri.toString();this._pendingTextDocumentChanges.set(l,u.document),this._onPendingChangeAdded.fire()};i.push(a.didChange?a.didChange(e,u=>c(u)):c(e))}}return Promise.all(i).then(void 0,r=>{throw this._client.error(`Sending document notification ${X.DidChangeTextDocumentNotification.type.method} failed`,r),r})}notificationSent(e,t,n){this._onNotificationSent.fire({textDocument:e,type:t,params:n})}unregister(e){if(this._changeData.delete(e),this._changeData.size===0)this._listener&&(this._listener.dispose(),this._listener=void 0),this._syncKind=X.TextDocumentSyncKind.None;else{this._syncKind=X.TextDocumentSyncKind.None;for(let t of this._changeData.values())if(this.updateSyncKind(t.syncKind),this._syncKind===X.TextDocumentSyncKind.Full)break}}clear(){this._pendingTextDocumentChanges.clear(),this._changeData.clear(),this._syncKind=X.TextDocumentSyncKind.None,this._listener&&(this._listener.dispose(),this._listener=void 0)}getPendingDocumentChanges(e){if(this._pendingTextDocumentChanges.size===0)return[];let t;if(e.size===0)t=Array.from(this._pendingTextDocumentChanges.values()),this._pendingTextDocumentChanges.clear();else{t=[];for(let n of this._pendingTextDocumentChanges)e.has(n[0])||(t.push(n[1]),this._pendingTextDocumentChanges.delete(n[0]))}return t}getProvider(e){for(let t of this._changeData.values())if(Re.languages.match(t.documentSelector,e)>0)return{send:n=>this.callback(n)}}updateSyncKind(e){if(this._syncKind!==X.TextDocumentSyncKind.Full)switch(e){case X.TextDocumentSyncKind.Full:this._syncKind=e;break;case X.TextDocumentSyncKind.Incremental:this._syncKind===X.TextDocumentSyncKind.None&&(this._syncKind=X.TextDocumentSyncKind.Incremental);break}}};_e.DidChangeTextDocumentFeature=Ls;var Us=class extends ie.TextDocumentEventFeature{constructor(e){super(e,Re.workspace.onWillSaveTextDocument,X.WillSaveTextDocumentNotification.type,()=>e.middleware.willSave,t=>e.code2ProtocolConverter.asWillSaveTextDocumentParams(t),t=>t.document,(t,n)=>ie.TextDocumentEventFeature.textDocumentFilter(t,n.document))}get registrationType(){return X.WillSaveTextDocumentNotification.type}fillClientCapabilities(e){let t=(0,ie.ensure)((0,ie.ensure)(e,"textDocument"),"synchronization");t.willSave=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;t&&n&&n.willSave&&this.register({id:Vt.generateUuid(),registerOptions:{documentSelector:t}})}getTextDocument(e){return e.document}};_e.WillSaveFeature=Us;var Ks=class extends ie.DynamicDocumentFeature{constructor(e){super(e),this._selectors=new Map}getDocumentSelectors(){return this._selectors.values()}get registrationType(){return X.WillSaveTextDocumentWaitUntilRequest.type}fillClientCapabilities(e){let t=(0,ie.ensure)((0,ie.ensure)(e,"textDocument"),"synchronization");t.willSaveWaitUntil=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;t&&n&&n.willSaveWaitUntil&&this.register({id:Vt.generateUuid(),registerOptions:{documentSelector:t}})}register(e){e.registerOptions.documentSelector&&(this._listener||(this._listener=Re.workspace.onWillSaveTextDocument(this.callback,this)),this._selectors.set(e.id,this._client.protocol2CodeConverter.asDocumentSelector(e.registerOptions.documentSelector)))}callback(e){if(ie.TextDocumentEventFeature.textDocumentFilter(this._selectors.values(),e.document)&&!this._client.hasDedicatedTextSynchronizationFeature(e.document)){let t=this._client.middleware,n=i=>this._client.sendRequest(X.WillSaveTextDocumentWaitUntilRequest.type,this._client.code2ProtocolConverter.asWillSaveTextDocumentParams(i)).then(async r=>{let a=await this._client.protocol2CodeConverter.asTextEdits(r);return a===void 0?[]:a});e.waitUntil(t.willSaveWaitUntil?t.willSaveWaitUntil(e,n):n(e))}}unregister(e){this._selectors.delete(e),this._selectors.size===0&&this._listener&&(this._listener.dispose(),this._listener=void 0)}clear(){this._selectors.clear(),this._listener&&(this._listener.dispose(),this._listener=void 0)}};_e.WillSaveWaitUntilFeature=Ks;var Ns=class extends ie.TextDocumentEventFeature{constructor(e){super(e,Re.workspace.onDidSaveTextDocument,X.DidSaveTextDocumentNotification.type,()=>e.middleware.didSave,t=>e.code2ProtocolConverter.asSaveTextDocumentParams(t,this._includeText),t=>t,ie.TextDocumentEventFeature.textDocumentFilter),this._includeText=!1}get registrationType(){return X.DidSaveTextDocumentNotification.type}fillClientCapabilities(e){(0,ie.ensure)((0,ie.ensure)(e,"textDocument"),"synchronization").didSave=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;if(t&&n&&n.save){let i=typeof n.save=="boolean"?{includeText:!1}:{includeText:!!n.save.includeText};this.register({id:Vt.generateUuid(),registerOptions:Object.assign({},{documentSelector:t},i)})}}register(e){this._includeText=!!e.registerOptions.includeText,super.register(e)}getTextDocument(e){return e}};_e.DidSaveTextDocumentFeature=Ns});var Cc=F(Si=>{"use strict";Object.defineProperty(Si,"__esModule",{value:!0});Si.CompletionItemFeature=void 0;var $u=I("vscode"),H=L(),Hs=W(),Wu=te(),ju=[H.CompletionItemKind.Text,H.CompletionItemKind.Method,H.CompletionItemKind.Function,H.CompletionItemKind.Constructor,H.CompletionItemKind.Field,H.CompletionItemKind.Variable,H.CompletionItemKind.Class,H.CompletionItemKind.Interface,H.CompletionItemKind.Module,H.CompletionItemKind.Property,H.CompletionItemKind.Unit,H.CompletionItemKind.Value,H.CompletionItemKind.Enum,H.CompletionItemKind.Keyword,H.CompletionItemKind.Snippet,H.CompletionItemKind.Color,H.CompletionItemKind.File,H.CompletionItemKind.Reference,H.CompletionItemKind.Folder,H.CompletionItemKind.EnumMember,H.CompletionItemKind.Constant,H.CompletionItemKind.Struct,H.CompletionItemKind.Event,H.CompletionItemKind.Operator,H.CompletionItemKind.TypeParameter],$s=class extends Hs.TextDocumentLanguageFeature{constructor(e){super(e,H.CompletionRequest.type),this.labelDetailsSupport=new Map}fillClientCapabilities(e){let t=(0,Hs.ensure)((0,Hs.ensure)(e,"textDocument"),"completion");t.dynamicRegistration=!0,t.contextSupport=!0,t.completionItem={snippetSupport:!0,commitCharactersSupport:!0,documentationFormat:[H.MarkupKind.Markdown,H.MarkupKind.PlainText],deprecatedSupport:!0,preselectSupport:!0,tagSupport:{valueSet:[H.CompletionItemTag.Deprecated]},insertReplaceSupport:!0,resolveSupport:{properties:["documentation","detail","additionalTextEdits"]},insertTextModeSupport:{valueSet:[H.InsertTextMode.asIs,H.InsertTextMode.adjustIndentation]},labelDetailsSupport:!0},t.insertTextMode=H.InsertTextMode.adjustIndentation,t.completionItemKind={valueSet:ju},t.completionList={itemDefaults:["commitCharacters","editRange","insertTextFormat","insertTextMode","data"]}}initialize(e,t){let n=this.getRegistrationOptions(t,e.completionProvider);n&&this.register({id:Wu.generateUuid(),registerOptions:n})}registerLanguageProvider(e,t){this.labelDetailsSupport.set(t,!!e.completionItem?.labelDetailsSupport);let n=e.triggerCharacters??[],i=e.allCommitCharacters,r=e.documentSelector,a={provideCompletionItems:(c,u,l,g)=>{let h=this._client,f=this._client.middleware,v=(p,C,y,b)=>h.sendRequest(H.CompletionRequest.type,h.code2ProtocolConverter.asCompletionParams(p,C,y),b).then(T=>b.isCancellationRequested?null:h.protocol2CodeConverter.asCompletionResult(T,i,b),T=>h.handleFailedRequest(H.CompletionRequest.type,b,T,null));return f.provideCompletionItem?f.provideCompletionItem(c,u,g,l,v):v(c,u,g,l)},resolveCompletionItem:e.resolveProvider?(c,u)=>{let l=this._client,g=this._client.middleware,h=(f,v)=>l.sendRequest(H.CompletionResolveRequest.type,l.code2ProtocolConverter.asCompletionItem(f,!!this.labelDetailsSupport.get(t)),v).then(p=>v.isCancellationRequested?null:l.protocol2CodeConverter.asCompletionItem(p),p=>l.handleFailedRequest(H.CompletionResolveRequest.type,v,p,f));return g.resolveCompletionItem?g.resolveCompletionItem(c,u,h):h(c,u)}:void 0};return[$u.languages.registerCompletionItemProvider(this._client.protocol2CodeConverter.asDocumentSelector(r),a,...n),a]}};Si.CompletionItemFeature=$s});var wc=F(_i=>{"use strict";Object.defineProperty(_i,"__esModule",{value:!0});_i.HoverFeature=void 0;var zu=I("vscode"),mn=L(),Ws=W(),Vu=te(),js=class extends Ws.TextDocumentLanguageFeature{constructor(e){super(e,mn.HoverRequest.type)}fillClientCapabilities(e){let t=(0,Ws.ensure)((0,Ws.ensure)(e,"textDocument"),"hover");t.dynamicRegistration=!0,t.contentFormat=[mn.MarkupKind.Markdown,mn.MarkupKind.PlainText]}initialize(e,t){let n=this.getRegistrationOptions(t,e.hoverProvider);n&&this.register({id:Vu.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideHover:(i,r,a)=>{let c=this._client,u=(g,h,f)=>c.sendRequest(mn.HoverRequest.type,c.code2ProtocolConverter.asTextDocumentPositionParams(g,h),f).then(v=>f.isCancellationRequested?null:c.protocol2CodeConverter.asHover(v),v=>c.handleFailedRequest(mn.HoverRequest.type,f,v,null)),l=c.middleware;return l.provideHover?l.provideHover(i,r,a,u):u(i,r,a)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return zu.languages.registerHoverProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};_i.HoverFeature=js});var Dc=F(bi=>{"use strict";Object.defineProperty(bi,"__esModule",{value:!0});bi.DefinitionFeature=void 0;var Bu=I("vscode"),zs=L(),Vs=W(),Ju=te(),Bs=class extends Vs.TextDocumentLanguageFeature{constructor(e){super(e,zs.DefinitionRequest.type)}fillClientCapabilities(e){let t=(0,Vs.ensure)((0,Vs.ensure)(e,"textDocument"),"definition");t.dynamicRegistration=!0,t.linkSupport=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.definitionProvider);n&&this.register({id:Ju.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDefinition:(i,r,a)=>{let c=this._client,u=(g,h,f)=>c.sendRequest(zs.DefinitionRequest.type,c.code2ProtocolConverter.asTextDocumentPositionParams(g,h),f).then(v=>f.isCancellationRequested?null:c.protocol2CodeConverter.asDefinitionResult(v,f),v=>c.handleFailedRequest(zs.DefinitionRequest.type,f,v,null)),l=c.middleware;return l.provideDefinition?l.provideDefinition(i,r,a,u):u(i,r,a)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return Bu.languages.registerDefinitionProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};bi.DefinitionFeature=Bs});var _c=F(Ti=>{"use strict";Object.defineProperty(Ti,"__esModule",{value:!0});Ti.SignatureHelpFeature=void 0;var Sc=I("vscode"),vn=L(),Js=W(),Qu=te(),Qs=class extends Js.TextDocumentLanguageFeature{constructor(e){super(e,vn.SignatureHelpRequest.type)}fillClientCapabilities(e){let t=(0,Js.ensure)((0,Js.ensure)(e,"textDocument"),"signatureHelp");t.dynamicRegistration=!0,t.signatureInformation={documentationFormat:[vn.MarkupKind.Markdown,vn.MarkupKind.PlainText]},t.signatureInformation.parameterInformation={labelOffsetSupport:!0},t.signatureInformation.activeParameterSupport=!0,t.contextSupport=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.signatureHelpProvider);n&&this.register({id:Qu.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t={provideSignatureHelp:(n,i,r,a)=>{let c=this._client,u=(g,h,f,v)=>c.sendRequest(vn.SignatureHelpRequest.type,c.code2ProtocolConverter.asSignatureHelpParams(g,h,f),v).then(p=>v.isCancellationRequested?null:c.protocol2CodeConverter.asSignatureHelp(p,v),p=>c.handleFailedRequest(vn.SignatureHelpRequest.type,v,p,null)),l=c.middleware;return l.provideSignatureHelp?l.provideSignatureHelp(n,i,a,r,u):u(n,i,a,r)}};return[this.registerProvider(e,t),t]}registerProvider(e,t){let n=this._client.protocol2CodeConverter.asDocumentSelector(e.documentSelector);if(e.retriggerCharacters===void 0){let i=e.triggerCharacters||[];return Sc.languages.registerSignatureHelpProvider(n,t,...i)}else{let i={triggerCharacters:e.triggerCharacters||[],retriggerCharacters:e.retriggerCharacters||[]};return Sc.languages.registerSignatureHelpProvider(n,t,i)}}};Ti.SignatureHelpFeature=Qs});var bc=F(ki=>{"use strict";Object.defineProperty(ki,"__esModule",{value:!0});ki.DocumentHighlightFeature=void 0;var Gu=I("vscode"),Gs=L(),Ys=W(),Yu=te(),Xs=class extends Ys.TextDocumentLanguageFeature{constructor(e){super(e,Gs.DocumentHighlightRequest.type)}fillClientCapabilities(e){(0,Ys.ensure)((0,Ys.ensure)(e,"textDocument"),"documentHighlight").dynamicRegistration=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentHighlightProvider);n&&this.register({id:Yu.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDocumentHighlights:(i,r,a)=>{let c=this._client,u=(g,h,f)=>c.sendRequest(Gs.DocumentHighlightRequest.type,c.code2ProtocolConverter.asTextDocumentPositionParams(g,h),f).then(v=>f.isCancellationRequested?null:c.protocol2CodeConverter.asDocumentHighlights(v,f),v=>c.handleFailedRequest(Gs.DocumentHighlightRequest.type,f,v,null)),l=c.middleware;return l.provideDocumentHighlights?l.provideDocumentHighlights(i,r,a,u):u(i,r,a)}};return[Gu.languages.registerDocumentHighlightProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};ki.DocumentHighlightFeature=Xs});var to=F(Ge=>{"use strict";Object.defineProperty(Ge,"__esModule",{value:!0});Ge.DocumentSymbolFeature=Ge.SupportedSymbolTags=Ge.SupportedSymbolKinds=void 0;var Xu=I("vscode"),z=L(),Zs=W(),Zu=te();Ge.SupportedSymbolKinds=[z.SymbolKind.File,z.SymbolKind.Module,z.SymbolKind.Namespace,z.SymbolKind.Package,z.SymbolKind.Class,z.SymbolKind.Method,z.SymbolKind.Property,z.SymbolKind.Field,z.SymbolKind.Constructor,z.SymbolKind.Enum,z.SymbolKind.Interface,z.SymbolKind.Function,z.SymbolKind.Variable,z.SymbolKind.Constant,z.SymbolKind.String,z.SymbolKind.Number,z.SymbolKind.Boolean,z.SymbolKind.Array,z.SymbolKind.Object,z.SymbolKind.Key,z.SymbolKind.Null,z.SymbolKind.EnumMember,z.SymbolKind.Struct,z.SymbolKind.Event,z.SymbolKind.Operator,z.SymbolKind.TypeParameter];Ge.SupportedSymbolTags=[z.SymbolTag.Deprecated];var eo=class extends Zs.TextDocumentLanguageFeature{constructor(e){super(e,z.DocumentSymbolRequest.type)}fillClientCapabilities(e){let t=(0,Zs.ensure)((0,Zs.ensure)(e,"textDocument"),"documentSymbol");t.dynamicRegistration=!0,t.symbolKind={valueSet:Ge.SupportedSymbolKinds},t.hierarchicalDocumentSymbolSupport=!0,t.tagSupport={valueSet:Ge.SupportedSymbolTags},t.labelSupport=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentSymbolProvider);n&&this.register({id:Zu.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDocumentSymbols:(r,a)=>{let c=this._client,u=async(g,h)=>{try{let f=await c.sendRequest(z.DocumentSymbolRequest.type,c.code2ProtocolConverter.asDocumentSymbolParams(g),h);if(h.isCancellationRequested||f===void 0||f===null)return null;if(f.length===0)return[];{let v=f[0];return z.DocumentSymbol.is(v)?await c.protocol2CodeConverter.asDocumentSymbols(f,h):await c.protocol2CodeConverter.asSymbolInformations(f,h)}}catch(f){return c.handleFailedRequest(z.DocumentSymbolRequest.type,h,f,null)}},l=c.middleware;return l.provideDocumentSymbols?l.provideDocumentSymbols(r,a,u):u(r,a)}},i=e.label!==void 0?{label:e.label}:void 0;return[Xu.languages.registerDocumentSymbolProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n,i),n]}};Ge.DocumentSymbolFeature=eo});var kc=F(Pi=>{"use strict";Object.defineProperty(Pi,"__esModule",{value:!0});Pi.WorkspaceSymbolFeature=void 0;var el=I("vscode"),yn=L(),no=W(),Tc=to(),tl=te(),io=class extends no.WorkspaceFeature{constructor(e){super(e,yn.WorkspaceSymbolRequest.type)}fillClientCapabilities(e){let t=(0,no.ensure)((0,no.ensure)(e,"workspace"),"symbol");t.dynamicRegistration=!0,t.symbolKind={valueSet:Tc.SupportedSymbolKinds},t.tagSupport={valueSet:Tc.SupportedSymbolTags},t.resolveSupport={properties:["location.range"]}}initialize(e){e.workspaceSymbolProvider&&this.register({id:tl.generateUuid(),registerOptions:e.workspaceSymbolProvider===!0?{workDoneProgress:!1}:e.workspaceSymbolProvider})}registerLanguageProvider(e){let t={provideWorkspaceSymbols:(n,i)=>{let r=this._client,a=(u,l)=>r.sendRequest(yn.WorkspaceSymbolRequest.type,{query:u},l).then(g=>l.isCancellationRequested?null:r.protocol2CodeConverter.asSymbolInformations(g,l),g=>r.handleFailedRequest(yn.WorkspaceSymbolRequest.type,l,g,null)),c=r.middleware;return c.provideWorkspaceSymbols?c.provideWorkspaceSymbols(n,i,a):a(n,i)},resolveWorkspaceSymbol:e.resolveProvider===!0?(n,i)=>{let r=this._client,a=(u,l)=>r.sendRequest(yn.WorkspaceSymbolResolveRequest.type,r.code2ProtocolConverter.asWorkspaceSymbol(u),l).then(g=>l.isCancellationRequested?null:r.protocol2CodeConverter.asSymbolInformation(g),g=>r.handleFailedRequest(yn.WorkspaceSymbolResolveRequest.type,l,g,null)),c=r.middleware;return c.resolveWorkspaceSymbol?c.resolveWorkspaceSymbol(n,i,a):a(n,i)}:void 0};return[el.languages.registerWorkspaceSymbolProvider(t),t]}};Pi.WorkspaceSymbolFeature=io});var Pc=F(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});Ri.ReferencesFeature=void 0;var nl=I("vscode"),ro=L(),so=W(),il=te(),oo=class extends so.TextDocumentLanguageFeature{constructor(e){super(e,ro.ReferencesRequest.type)}fillClientCapabilities(e){(0,so.ensure)((0,so.ensure)(e,"textDocument"),"references").dynamicRegistration=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.referencesProvider);n&&this.register({id:il.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideReferences:(i,r,a,c)=>{let u=this._client,l=(h,f,v,p)=>u.sendRequest(ro.ReferencesRequest.type,u.code2ProtocolConverter.asReferenceParams(h,f,v),p).then(C=>p.isCancellationRequested?null:u.protocol2CodeConverter.asReferences(C,p),C=>u.handleFailedRequest(ro.ReferencesRequest.type,p,C,null)),g=u.middleware;return g.provideReferences?g.provideReferences(i,r,a,c,l):l(i,r,a,c)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return nl.languages.registerReferenceProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Ri.ReferencesFeature=oo});var Rc=F(xi=>{"use strict";Object.defineProperty(xi,"__esModule",{value:!0});xi.CodeActionFeature=void 0;var rl=I("vscode"),xe=L(),sl=te(),ao=W(),co=class extends ao.TextDocumentLanguageFeature{constructor(e){super(e,xe.CodeActionRequest.type)}fillClientCapabilities(e){let t=(0,ao.ensure)((0,ao.ensure)(e,"textDocument"),"codeAction");t.dynamicRegistration=!0,t.isPreferredSupport=!0,t.disabledSupport=!0,t.dataSupport=!0,t.resolveSupport={properties:["edit"]},t.codeActionLiteralSupport={codeActionKind:{valueSet:[xe.CodeActionKind.Empty,xe.CodeActionKind.QuickFix,xe.CodeActionKind.Refactor,xe.CodeActionKind.RefactorExtract,xe.CodeActionKind.RefactorInline,xe.CodeActionKind.RefactorRewrite,xe.CodeActionKind.Source,xe.CodeActionKind.SourceOrganizeImports]}},t.honorsChangeAnnotations=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.codeActionProvider);n&&this.register({id:sl.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideCodeActions:(i,r,a,c)=>{let u=this._client,l=async(h,f,v,p)=>{let C={textDocument:u.code2ProtocolConverter.asTextDocumentIdentifier(h),range:u.code2ProtocolConverter.asRange(f),context:u.code2ProtocolConverter.asCodeActionContextSync(v)};return u.sendRequest(xe.CodeActionRequest.type,C,p).then(y=>p.isCancellationRequested||y===null||y===void 0?null:u.protocol2CodeConverter.asCodeActionResult(y,p),y=>u.handleFailedRequest(xe.CodeActionRequest.type,p,y,null))},g=u.middleware;return g.provideCodeActions?g.provideCodeActions(i,r,a,c,l):l(i,r,a,c)},resolveCodeAction:e.resolveProvider?(i,r)=>{let a=this._client,c=this._client.middleware,u=async(l,g)=>a.sendRequest(xe.CodeActionResolveRequest.type,a.code2ProtocolConverter.asCodeActionSync(l),g).then(h=>g.isCancellationRequested?l:a.protocol2CodeConverter.asCodeAction(h,g),h=>a.handleFailedRequest(xe.CodeActionResolveRequest.type,g,h,l));return c.resolveCodeAction?c.resolveCodeAction(i,r,u):u(i,r)}:void 0};return[rl.languages.registerCodeActionsProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n,e.codeActionKinds?{providedCodeActionKinds:this._client.protocol2CodeConverter.asCodeActionKinds(e.codeActionKinds)}:void 0),n]}};xi.CodeActionFeature=co});var Fc=F(Fi=>{"use strict";Object.defineProperty(Fi,"__esModule",{value:!0});Fi.CodeLensFeature=void 0;var xc=I("vscode"),Bt=L(),ol=te(),Cn=W(),uo=class extends Cn.TextDocumentLanguageFeature{constructor(e){super(e,Bt.CodeLensRequest.type)}fillClientCapabilities(e){(0,Cn.ensure)((0,Cn.ensure)(e,"textDocument"),"codeLens").dynamicRegistration=!0,(0,Cn.ensure)((0,Cn.ensure)(e,"workspace"),"codeLens").refreshSupport=!0}initialize(e,t){this._client.onRequest(Bt.CodeLensRefreshRequest.type,async()=>{for(let r of this.getAllProviders())r.onDidChangeCodeLensEmitter.fire()});let i=this.getRegistrationOptions(t,e.codeLensProvider);i&&this.register({id:ol.generateUuid(),registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n=new xc.EventEmitter,i={onDidChangeCodeLenses:n.event,provideCodeLenses:(r,a)=>{let c=this._client,u=(g,h)=>c.sendRequest(Bt.CodeLensRequest.type,c.code2ProtocolConverter.asCodeLensParams(g),h).then(f=>h.isCancellationRequested?null:c.protocol2CodeConverter.asCodeLenses(f,h),f=>c.handleFailedRequest(Bt.CodeLensRequest.type,h,f,null)),l=c.middleware;return l.provideCodeLenses?l.provideCodeLenses(r,a,u):u(r,a)},resolveCodeLens:e.resolveProvider?(r,a)=>{let c=this._client,u=(g,h)=>c.sendRequest(Bt.CodeLensResolveRequest.type,c.code2ProtocolConverter.asCodeLens(g),h).then(f=>h.isCancellationRequested?g:c.protocol2CodeConverter.asCodeLens(f),f=>c.handleFailedRequest(Bt.CodeLensResolveRequest.type,h,f,g)),l=c.middleware;return l.resolveCodeLens?l.resolveCodeLens(r,a,u):u(r,a)}:void 0};return[xc.languages.registerCodeLensProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),i),{provider:i,onDidChangeCodeLensEmitter:n}]}};Fi.CodeLensFeature=uo});var qc=F(vt=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});vt.DocumentOnTypeFormattingFeature=vt.DocumentRangeFormattingFeature=vt.DocumentFormattingFeature=void 0;var qi=I("vscode"),$e=L(),ho=te(),it=W(),Jt;(function(s){function e(t){let n=qi.workspace.getConfiguration("files",t);return{trimTrailingWhitespace:n.get("trimTrailingWhitespace"),trimFinalNewlines:n.get("trimFinalNewlines"),insertFinalNewline:n.get("insertFinalNewline")}}s.fromConfiguration=e})(Jt||(Jt={}));var lo=class extends it.TextDocumentLanguageFeature{constructor(e){super(e,$e.DocumentFormattingRequest.type)}fillClientCapabilities(e){(0,it.ensure)((0,it.ensure)(e,"textDocument"),"formatting").dynamicRegistration=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentFormattingProvider);n&&this.register({id:ho.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDocumentFormattingEdits:(i,r,a)=>{let c=this._client,u=(g,h,f)=>{let v={textDocument:c.code2ProtocolConverter.asTextDocumentIdentifier(g),options:c.code2ProtocolConverter.asFormattingOptions(h,Jt.fromConfiguration(g))};return c.sendRequest($e.DocumentFormattingRequest.type,v,f).then(p=>f.isCancellationRequested?null:c.protocol2CodeConverter.asTextEdits(p,f),p=>c.handleFailedRequest($e.DocumentFormattingRequest.type,f,p,null))},l=c.middleware;return l.provideDocumentFormattingEdits?l.provideDocumentFormattingEdits(i,r,a,u):u(i,r,a)}};return[qi.languages.registerDocumentFormattingEditProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};vt.DocumentFormattingFeature=lo;var po=class extends it.TextDocumentLanguageFeature{constructor(e){super(e,$e.DocumentRangeFormattingRequest.type)}fillClientCapabilities(e){let t=(0,it.ensure)((0,it.ensure)(e,"textDocument"),"rangeFormatting");t.dynamicRegistration=!0,t.rangesSupport=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentRangeFormattingProvider);n&&this.register({id:ho.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDocumentRangeFormattingEdits:(i,r,a,c)=>{let u=this._client,l=(h,f,v,p)=>{let C={textDocument:u.code2ProtocolConverter.asTextDocumentIdentifier(h),range:u.code2ProtocolConverter.asRange(f),options:u.code2ProtocolConverter.asFormattingOptions(v,Jt.fromConfiguration(h))};return u.sendRequest($e.DocumentRangeFormattingRequest.type,C,p).then(y=>p.isCancellationRequested?null:u.protocol2CodeConverter.asTextEdits(y,p),y=>u.handleFailedRequest($e.DocumentRangeFormattingRequest.type,p,y,null))},g=u.middleware;return g.provideDocumentRangeFormattingEdits?g.provideDocumentRangeFormattingEdits(i,r,a,c,l):l(i,r,a,c)}};return e.rangesSupport&&(n.provideDocumentRangesFormattingEdits=(i,r,a,c)=>{let u=this._client,l=(h,f,v,p)=>{let C={textDocument:u.code2ProtocolConverter.asTextDocumentIdentifier(h),ranges:u.code2ProtocolConverter.asRanges(f),options:u.code2ProtocolConverter.asFormattingOptions(v,Jt.fromConfiguration(h))};return u.sendRequest($e.DocumentRangesFormattingRequest.type,C,p).then(y=>p.isCancellationRequested?null:u.protocol2CodeConverter.asTextEdits(y,p),y=>u.handleFailedRequest($e.DocumentRangesFormattingRequest.type,p,y,null))},g=u.middleware;return g.provideDocumentRangesFormattingEdits?g.provideDocumentRangesFormattingEdits(i,r,a,c,l):l(i,r,a,c)}),[qi.languages.registerDocumentRangeFormattingEditProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};vt.DocumentRangeFormattingFeature=po;var fo=class extends it.TextDocumentLanguageFeature{constructor(e){super(e,$e.DocumentOnTypeFormattingRequest.type)}fillClientCapabilities(e){(0,it.ensure)((0,it.ensure)(e,"textDocument"),"onTypeFormatting").dynamicRegistration=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentOnTypeFormattingProvider);n&&this.register({id:ho.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideOnTypeFormattingEdits:(r,a,c,u,l)=>{let g=this._client,h=(v,p,C,y,b)=>{let T={textDocument:g.code2ProtocolConverter.asTextDocumentIdentifier(v),position:g.code2ProtocolConverter.asPosition(p),ch:C,options:g.code2ProtocolConverter.asFormattingOptions(y,Jt.fromConfiguration(v))};return g.sendRequest($e.DocumentOnTypeFormattingRequest.type,T,b).then(P=>b.isCancellationRequested?null:g.protocol2CodeConverter.asTextEdits(P,b),P=>g.handleFailedRequest($e.DocumentOnTypeFormattingRequest.type,b,P,null))},f=g.middleware;return f.provideOnTypeFormattingEdits?f.provideOnTypeFormattingEdits(r,a,c,u,l,h):h(r,a,c,u,l)}},i=e.moreTriggerCharacter||[];return[qi.languages.registerOnTypeFormattingEditProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n,e.firstTriggerCharacter,...i),n]}};vt.DocumentOnTypeFormattingFeature=fo});var Ec=F(Ii=>{"use strict";Object.defineProperty(Ii,"__esModule",{value:!0});Ii.RenameFeature=void 0;var al=I("vscode"),Pt=L(),cl=te(),Ic=Ee(),go=W(),mo=class extends go.TextDocumentLanguageFeature{constructor(e){super(e,Pt.RenameRequest.type)}fillClientCapabilities(e){let t=(0,go.ensure)((0,go.ensure)(e,"textDocument"),"rename");t.dynamicRegistration=!0,t.prepareSupport=!0,t.prepareSupportDefaultBehavior=Pt.PrepareSupportDefaultBehavior.Identifier,t.honorsChangeAnnotations=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.renameProvider);n&&(Ic.boolean(e.renameProvider)&&(n.prepareProvider=!1),this.register({id:cl.generateUuid(),registerOptions:n}))}registerLanguageProvider(e){let t=e.documentSelector,n={provideRenameEdits:(i,r,a,c)=>{let u=this._client,l=(h,f,v,p)=>{let C={textDocument:u.code2ProtocolConverter.asTextDocumentIdentifier(h),position:u.code2ProtocolConverter.asPosition(f),newName:v};return u.sendRequest(Pt.RenameRequest.type,C,p).then(y=>p.isCancellationRequested?null:u.protocol2CodeConverter.asWorkspaceEdit(y,p),y=>u.handleFailedRequest(Pt.RenameRequest.type,p,y,null,!1))},g=u.middleware;return g.provideRenameEdits?g.provideRenameEdits(i,r,a,c,l):l(i,r,a,c)},prepareRename:e.prepareProvider?(i,r,a)=>{let c=this._client,u=(g,h,f)=>{let v={textDocument:c.code2ProtocolConverter.asTextDocumentIdentifier(g),position:c.code2ProtocolConverter.asPosition(h)};return c.sendRequest(Pt.PrepareRenameRequest.type,v,f).then(p=>f.isCancellationRequested?null:Pt.Range.is(p)?c.protocol2CodeConverter.asRange(p):this.isDefaultBehavior(p)?p.defaultBehavior===!0?null:Promise.reject(new Error("The element can't be renamed.")):p&&Pt.Range.is(p.range)?{range:c.protocol2CodeConverter.asRange(p.range),placeholder:p.placeholder}:Promise.reject(new Error("The element can't be renamed.")),p=>{throw typeof p.message=="string"?new Error(p.message):new Error("The element can't be renamed.")})},l=c.middleware;return l.prepareRename?l.prepareRename(i,r,a,u):u(i,r,a)}:void 0};return[this.registerProvider(t,n),n]}registerProvider(e,t){return al.languages.registerRenameProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}isDefaultBehavior(e){let t=e;return t&&Ic.boolean(t.defaultBehavior)}};Ii.RenameFeature=mo});var Mc=F(Ei=>{"use strict";Object.defineProperty(Ei,"__esModule",{value:!0});Ei.DocumentLinkFeature=void 0;var dl=I("vscode"),wn=L(),vo=W(),ul=te(),yo=class extends vo.TextDocumentLanguageFeature{constructor(e){super(e,wn.DocumentLinkRequest.type)}fillClientCapabilities(e){let t=(0,vo.ensure)((0,vo.ensure)(e,"textDocument"),"documentLink");t.dynamicRegistration=!0,t.tooltipSupport=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentLinkProvider);n&&this.register({id:ul.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDocumentLinks:(i,r)=>{let a=this._client,c=(l,g)=>a.sendRequest(wn.DocumentLinkRequest.type,a.code2ProtocolConverter.asDocumentLinkParams(l),g).then(h=>g.isCancellationRequested?null:a.protocol2CodeConverter.asDocumentLinks(h,g),h=>a.handleFailedRequest(wn.DocumentLinkRequest.type,g,h,null)),u=a.middleware;return u.provideDocumentLinks?u.provideDocumentLinks(i,r,c):c(i,r)},resolveDocumentLink:e.resolveProvider?(i,r)=>{let a=this._client,c=(l,g)=>a.sendRequest(wn.DocumentLinkResolveRequest.type,a.code2ProtocolConverter.asDocumentLink(l),g).then(h=>g.isCancellationRequested?l:a.protocol2CodeConverter.asDocumentLink(h),h=>a.handleFailedRequest(wn.DocumentLinkResolveRequest.type,g,h,l)),u=a.middleware;return u.resolveDocumentLink?u.resolveDocumentLink(i,r,c):c(i,r)}:void 0};return[dl.languages.registerDocumentLinkProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};Ei.DocumentLinkFeature=yo});var Ac=F(Mi=>{"use strict";Object.defineProperty(Mi,"__esModule",{value:!0});Mi.ExecuteCommandFeature=void 0;var ll=I("vscode"),Co=L(),pl=te(),Oc=W(),wo=class{constructor(e){this._client=e,this._commands=new Map}getState(){return{kind:"workspace",id:this.registrationType.method,registrations:this._commands.size>0}}get registrationType(){return Co.ExecuteCommandRequest.type}fillClientCapabilities(e){(0,Oc.ensure)((0,Oc.ensure)(e,"workspace"),"executeCommand").dynamicRegistration=!0}initialize(e){e.executeCommandProvider&&this.register({id:pl.generateUuid(),registerOptions:Object.assign({},e.executeCommandProvider)})}register(e){let t=this._client,n=t.middleware,i=(r,a)=>{let c={command:r,arguments:a};return t.sendRequest(Co.ExecuteCommandRequest.type,c).then(void 0,u=>t.handleFailedRequest(Co.ExecuteCommandRequest.type,void 0,u,void 0))};if(e.registerOptions.commands){let r=[];for(let a of e.registerOptions.commands)r.push(ll.commands.registerCommand(a,(...c)=>n.executeCommand?n.executeCommand(a,c,i):i(a,c)));this._commands.set(e.id,r)}}unregister(e){let t=this._commands.get(e);t&&t.forEach(n=>n.dispose())}clear(){this._commands.forEach(e=>{e.forEach(t=>t.dispose())}),this._commands.clear()}};Mi.ExecuteCommandFeature=wo});var Lc=F(Ai=>{"use strict";Object.defineProperty(Ai,"__esModule",{value:!0});Ai.FileSystemWatcherFeature=void 0;var fl=I("vscode"),Rt=L(),Oi=W(),Do=class{constructor(e,t){this._client=e,this._notifyFileEvent=t,this._watchers=new Map}getState(){return{kind:"workspace",id:this.registrationType.method,registrations:this._watchers.size>0}}get registrationType(){return Rt.DidChangeWatchedFilesNotification.type}fillClientCapabilities(e){(0,Oi.ensure)((0,Oi.ensure)(e,"workspace"),"didChangeWatchedFiles").dynamicRegistration=!0,(0,Oi.ensure)((0,Oi.ensure)(e,"workspace"),"didChangeWatchedFiles").relativePatternSupport=!0}initialize(e,t){}register(e){if(!Array.isArray(e.registerOptions.watchers))return;let t=[];for(let n of e.registerOptions.watchers){let i=this._client.protocol2CodeConverter.asGlobPattern(n.globPattern);if(i===void 0)continue;let r=!0,a=!0,c=!0;n.kind!==void 0&&n.kind!==null&&(r=(n.kind&Rt.WatchKind.Create)!==0,a=(n.kind&Rt.WatchKind.Change)!==0,c=(n.kind&Rt.WatchKind.Delete)!==0);let u=fl.workspace.createFileSystemWatcher(i,!r,!a,!c);this.hookListeners(u,r,a,c,t),t.push(u)}this._watchers.set(e.id,t)}registerRaw(e,t){let n=[];for(let i of t)this.hookListeners(i,!0,!0,!0,n);this._watchers.set(e,n)}hookListeners(e,t,n,i,r){t&&e.onDidCreate(a=>this._notifyFileEvent({uri:this._client.code2ProtocolConverter.asUri(a),type:Rt.FileChangeType.Created}),null,r),n&&e.onDidChange(a=>this._notifyFileEvent({uri:this._client.code2ProtocolConverter.asUri(a),type:Rt.FileChangeType.Changed}),null,r),i&&e.onDidDelete(a=>this._notifyFileEvent({uri:this._client.code2ProtocolConverter.asUri(a),type:Rt.FileChangeType.Deleted}),null,r)}unregister(e){let t=this._watchers.get(e);if(t)for(let n of t)n.dispose()}clear(){this._watchers.forEach(e=>{for(let t of e)t.dispose()}),this._watchers.clear()}};Ai.FileSystemWatcherFeature=Do});var Uc=F(Li=>{"use strict";Object.defineProperty(Li,"__esModule",{value:!0});Li.ColorProviderFeature=void 0;var hl=I("vscode"),Dn=L(),So=W(),_o=class extends So.TextDocumentLanguageFeature{constructor(e){super(e,Dn.DocumentColorRequest.type)}fillClientCapabilities(e){(0,So.ensure)((0,So.ensure)(e,"textDocument"),"colorProvider").dynamicRegistration=!0}initialize(e,t){let[n,i]=this.getRegistration(t,e.colorProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n={provideColorPresentations:(i,r,a)=>{let c=this._client,u=(g,h,f)=>{let v={color:g,textDocument:c.code2ProtocolConverter.asTextDocumentIdentifier(h.document),range:c.code2ProtocolConverter.asRange(h.range)};return c.sendRequest(Dn.ColorPresentationRequest.type,v,f).then(p=>f.isCancellationRequested?null:this._client.protocol2CodeConverter.asColorPresentations(p,f),p=>c.handleFailedRequest(Dn.ColorPresentationRequest.type,f,p,null))},l=c.middleware;return l.provideColorPresentations?l.provideColorPresentations(i,r,a,u):u(i,r,a)},provideDocumentColors:(i,r)=>{let a=this._client,c=(l,g)=>{let h={textDocument:a.code2ProtocolConverter.asTextDocumentIdentifier(l)};return a.sendRequest(Dn.DocumentColorRequest.type,h,g).then(f=>g.isCancellationRequested?null:this._client.protocol2CodeConverter.asColorInformations(f,g),f=>a.handleFailedRequest(Dn.DocumentColorRequest.type,g,f,null))},u=a.middleware;return u.provideDocumentColors?u.provideDocumentColors(i,r,c):c(i,r)}};return[hl.languages.registerColorProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};Li.ColorProviderFeature=_o});var Kc=F(Ui=>{"use strict";Object.defineProperty(Ui,"__esModule",{value:!0});Ui.ImplementationFeature=void 0;var gl=I("vscode"),bo=L(),To=W(),ko=class extends To.TextDocumentLanguageFeature{constructor(e){super(e,bo.ImplementationRequest.type)}fillClientCapabilities(e){let t=(0,To.ensure)((0,To.ensure)(e,"textDocument"),"implementation");t.dynamicRegistration=!0,t.linkSupport=!0}initialize(e,t){let[n,i]=this.getRegistration(t,e.implementationProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n={provideImplementation:(i,r,a)=>{let c=this._client,u=(g,h,f)=>c.sendRequest(bo.ImplementationRequest.type,c.code2ProtocolConverter.asTextDocumentPositionParams(g,h),f).then(v=>f.isCancellationRequested?null:c.protocol2CodeConverter.asDefinitionResult(v,f),v=>c.handleFailedRequest(bo.ImplementationRequest.type,f,v,null)),l=c.middleware;return l.provideImplementation?l.provideImplementation(i,r,a,u):u(i,r,a)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return gl.languages.registerImplementationProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Ui.ImplementationFeature=ko});var Nc=F(Ki=>{"use strict";Object.defineProperty(Ki,"__esModule",{value:!0});Ki.TypeDefinitionFeature=void 0;var ml=I("vscode"),Po=L(),Sn=W(),Ro=class extends Sn.TextDocumentLanguageFeature{constructor(e){super(e,Po.TypeDefinitionRequest.type)}fillClientCapabilities(e){(0,Sn.ensure)((0,Sn.ensure)(e,"textDocument"),"typeDefinition").dynamicRegistration=!0;let t=(0,Sn.ensure)((0,Sn.ensure)(e,"textDocument"),"typeDefinition");t.dynamicRegistration=!0,t.linkSupport=!0}initialize(e,t){let[n,i]=this.getRegistration(t,e.typeDefinitionProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n={provideTypeDefinition:(i,r,a)=>{let c=this._client,u=(g,h,f)=>c.sendRequest(Po.TypeDefinitionRequest.type,c.code2ProtocolConverter.asTextDocumentPositionParams(g,h),f).then(v=>f.isCancellationRequested?null:c.protocol2CodeConverter.asDefinitionResult(v,f),v=>c.handleFailedRequest(Po.TypeDefinitionRequest.type,f,v,null)),l=c.middleware;return l.provideTypeDefinition?l.provideTypeDefinition(i,r,a,u):u(i,r,a)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return ml.languages.registerTypeDefinitionProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Ki.TypeDefinitionFeature=Ro});var Hc=F(Qt=>{"use strict";Object.defineProperty(Qt,"__esModule",{value:!0});Qt.WorkspaceFoldersFeature=Qt.arrayDiff=void 0;var vl=te(),Ni=I("vscode"),_n=L();function xo(s,e){if(s!=null)return s[e]}function Fo(s,e){return s.filter(t=>e.indexOf(t)<0)}Qt.arrayDiff=Fo;var qo=class{constructor(e){this._client=e,this._listeners=new Map}getState(){return{kind:"workspace",id:this.registrationType.method,registrations:this._listeners.size>0}}get registrationType(){return _n.DidChangeWorkspaceFoldersNotification.type}fillInitializeParams(e){let t=Ni.workspace.workspaceFolders;this.initializeWithFolders(t),t===void 0?e.workspaceFolders=null:e.workspaceFolders=t.map(n=>this.asProtocol(n))}initializeWithFolders(e){this._initialFolders=e}fillClientCapabilities(e){e.workspace=e.workspace||{},e.workspace.workspaceFolders=!0}initialize(e){let t=this._client;t.onRequest(_n.WorkspaceFoldersRequest.type,r=>{let a=()=>{let u=Ni.workspace.workspaceFolders;return u===void 0?null:u.map(g=>this.asProtocol(g))},c=t.middleware.workspace;return c&&c.workspaceFolders?c.workspaceFolders(r,a):a(r)});let n=xo(xo(xo(e,"workspace"),"workspaceFolders"),"changeNotifications"),i;typeof n=="string"?i=n:n===!0&&(i=vl.generateUuid()),i&&this.register({id:i,registerOptions:void 0})}sendInitialEvent(e){let t;if(this._initialFolders&&e){let n=Fo(this._initialFolders,e),i=Fo(e,this._initialFolders);(i.length>0||n.length>0)&&(t=this.doSendEvent(i,n))}else this._initialFolders?t=this.doSendEvent([],this._initialFolders):e&&(t=this.doSendEvent(e,[]));t!==void 0&&t.catch(n=>{this._client.error(`Sending notification ${_n.DidChangeWorkspaceFoldersNotification.type.method} failed`,n)})}doSendEvent(e,t){let n={event:{added:e.map(i=>this.asProtocol(i)),removed:t.map(i=>this.asProtocol(i))}};return this._client.sendNotification(_n.DidChangeWorkspaceFoldersNotification.type,n)}register(e){let t=e.id,n=this._client,i=Ni.workspace.onDidChangeWorkspaceFolders(r=>{let a=l=>this.doSendEvent(l.added,l.removed),c=n.middleware.workspace;(c&&c.didChangeWorkspaceFolders?c.didChangeWorkspaceFolders(r,a):a(r)).catch(l=>{this._client.error(`Sending notification ${_n.DidChangeWorkspaceFoldersNotification.type.method} failed`,l)})});this._listeners.set(t,i),this.sendInitialEvent(Ni.workspace.workspaceFolders)}unregister(e){let t=this._listeners.get(e);t!==void 0&&(this._listeners.delete(e),t.dispose())}clear(){for(let e of this._listeners.values())e.dispose();this._listeners.clear()}asProtocol(e){return e===void 0?null:{uri:this._client.code2ProtocolConverter.asUri(e.uri),name:e.name}}};Qt.WorkspaceFoldersFeature=qo});var Wc=F(Hi=>{"use strict";Object.defineProperty(Hi,"__esModule",{value:!0});Hi.FoldingRangeFeature=void 0;var $c=I("vscode"),xt=L(),bn=W(),Io=class extends bn.TextDocumentLanguageFeature{constructor(e){super(e,xt.FoldingRangeRequest.type)}fillClientCapabilities(e){let t=(0,bn.ensure)((0,bn.ensure)(e,"textDocument"),"foldingRange");t.dynamicRegistration=!0,t.rangeLimit=5e3,t.lineFoldingOnly=!0,t.foldingRangeKind={valueSet:[xt.FoldingRangeKind.Comment,xt.FoldingRangeKind.Imports,xt.FoldingRangeKind.Region]},t.foldingRange={collapsedText:!1},(0,bn.ensure)((0,bn.ensure)(e,"workspace"),"foldingRange").refreshSupport=!0}initialize(e,t){this._client.onRequest(xt.FoldingRangeRefreshRequest.type,async()=>{for(let r of this.getAllProviders())r.onDidChangeFoldingRange.fire()});let[n,i]=this.getRegistration(t,e.foldingRangeProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n=new $c.EventEmitter,i={onDidChangeFoldingRanges:n.event,provideFoldingRanges:(r,a,c)=>{let u=this._client,l=(h,f,v)=>{let p={textDocument:u.code2ProtocolConverter.asTextDocumentIdentifier(h)};return u.sendRequest(xt.FoldingRangeRequest.type,p,v).then(C=>v.isCancellationRequested?null:u.protocol2CodeConverter.asFoldingRanges(C,v),C=>u.handleFailedRequest(xt.FoldingRangeRequest.type,v,C,null))},g=u.middleware;return g.provideFoldingRanges?g.provideFoldingRanges(r,a,c,l):l(r,a,c)}};return[$c.languages.registerFoldingRangeProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),i),{provider:i,onDidChangeFoldingRange:n}]}};Hi.FoldingRangeFeature=Io});var jc=F($i=>{"use strict";Object.defineProperty($i,"__esModule",{value:!0});$i.DeclarationFeature=void 0;var yl=I("vscode"),Eo=L(),Mo=W(),Oo=class extends Mo.TextDocumentLanguageFeature{constructor(e){super(e,Eo.DeclarationRequest.type)}fillClientCapabilities(e){let t=(0,Mo.ensure)((0,Mo.ensure)(e,"textDocument"),"declaration");t.dynamicRegistration=!0,t.linkSupport=!0}initialize(e,t){let[n,i]=this.getRegistration(t,e.declarationProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDeclaration:(i,r,a)=>{let c=this._client,u=(g,h,f)=>c.sendRequest(Eo.DeclarationRequest.type,c.code2ProtocolConverter.asTextDocumentPositionParams(g,h),f).then(v=>f.isCancellationRequested?null:c.protocol2CodeConverter.asDeclarationResult(v,f),v=>c.handleFailedRequest(Eo.DeclarationRequest.type,f,v,null)),l=c.middleware;return l.provideDeclaration?l.provideDeclaration(i,r,a,u):u(i,r,a)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return yl.languages.registerDeclarationProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};$i.DeclarationFeature=Oo});var zc=F(Wi=>{"use strict";Object.defineProperty(Wi,"__esModule",{value:!0});Wi.SelectionRangeFeature=void 0;var Cl=I("vscode"),Ao=L(),Lo=W(),Uo=class extends Lo.TextDocumentLanguageFeature{constructor(e){super(e,Ao.SelectionRangeRequest.type)}fillClientCapabilities(e){let t=(0,Lo.ensure)((0,Lo.ensure)(e,"textDocument"),"selectionRange");t.dynamicRegistration=!0}initialize(e,t){let[n,i]=this.getRegistration(t,e.selectionRangeProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n={provideSelectionRanges:(i,r,a)=>{let c=this._client,u=async(g,h,f)=>{let v={textDocument:c.code2ProtocolConverter.asTextDocumentIdentifier(g),positions:c.code2ProtocolConverter.asPositionsSync(h,f)};return c.sendRequest(Ao.SelectionRangeRequest.type,v,f).then(p=>f.isCancellationRequested?null:c.protocol2CodeConverter.asSelectionRanges(p,f),p=>c.handleFailedRequest(Ao.SelectionRangeRequest.type,f,p,null))},l=c.middleware;return l.provideSelectionRanges?l.provideSelectionRanges(i,r,a,u):u(i,r,a)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return Cl.languages.registerSelectionRangeProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Wi.SelectionRangeFeature=Uo});var Bc=F(ji=>{"use strict";Object.defineProperty(ji,"__esModule",{value:!0});ji.ProgressFeature=void 0;var Vc=L(),wl=vs();function Dl(s,e){return s[e]===void 0&&(s[e]=Object.create(null)),s[e]}var Ko=class{constructor(e){this._client=e,this.activeParts=new Set}getState(){return{kind:"window",id:Vc.WorkDoneProgressCreateRequest.method,registrations:this.activeParts.size>0}}fillClientCapabilities(e){Dl(e,"window").workDoneProgress=!0}initialize(){let e=this._client,t=i=>{this.activeParts.delete(i)},n=i=>{this.activeParts.add(new wl.ProgressPart(this._client,i.token,t))};e.onRequest(Vc.WorkDoneProgressCreateRequest.type,n)}clear(){for(let e of this.activeParts)e.done();this.activeParts.clear()}};ji.ProgressFeature=Ko});var Jc=F(zi=>{"use strict";Object.defineProperty(zi,"__esModule",{value:!0});zi.CallHierarchyFeature=void 0;var Sl=I("vscode"),Ft=L(),No=W(),Ho=class{constructor(e){this.client=e,this.middleware=e.middleware}prepareCallHierarchy(e,t,n){let i=this.client,r=this.middleware,a=(c,u,l)=>{let g=i.code2ProtocolConverter.asTextDocumentPositionParams(c,u);return i.sendRequest(Ft.CallHierarchyPrepareRequest.type,g,l).then(h=>l.isCancellationRequested?null:i.protocol2CodeConverter.asCallHierarchyItems(h,l),h=>i.handleFailedRequest(Ft.CallHierarchyPrepareRequest.type,l,h,null))};return r.prepareCallHierarchy?r.prepareCallHierarchy(e,t,n,a):a(e,t,n)}provideCallHierarchyIncomingCalls(e,t){let n=this.client,i=this.middleware,r=(a,c)=>{let u={item:n.code2ProtocolConverter.asCallHierarchyItem(a)};return n.sendRequest(Ft.CallHierarchyIncomingCallsRequest.type,u,c).then(l=>c.isCancellationRequested?null:n.protocol2CodeConverter.asCallHierarchyIncomingCalls(l,c),l=>n.handleFailedRequest(Ft.CallHierarchyIncomingCallsRequest.type,c,l,null))};return i.provideCallHierarchyIncomingCalls?i.provideCallHierarchyIncomingCalls(e,t,r):r(e,t)}provideCallHierarchyOutgoingCalls(e,t){let n=this.client,i=this.middleware,r=(a,c)=>{let u={item:n.code2ProtocolConverter.asCallHierarchyItem(a)};return n.sendRequest(Ft.CallHierarchyOutgoingCallsRequest.type,u,c).then(l=>c.isCancellationRequested?null:n.protocol2CodeConverter.asCallHierarchyOutgoingCalls(l,c),l=>n.handleFailedRequest(Ft.CallHierarchyOutgoingCallsRequest.type,c,l,null))};return i.provideCallHierarchyOutgoingCalls?i.provideCallHierarchyOutgoingCalls(e,t,r):r(e,t)}},$o=class extends No.TextDocumentLanguageFeature{constructor(e){super(e,Ft.CallHierarchyPrepareRequest.type)}fillClientCapabilities(e){let t=e,n=(0,No.ensure)((0,No.ensure)(t,"textDocument"),"callHierarchy");n.dynamicRegistration=!0}initialize(e,t){let[n,i]=this.getRegistration(t,e.callHierarchyProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=this._client,n=new Ho(t);return[Sl.languages.registerCallHierarchyProvider(this._client.protocol2CodeConverter.asDocumentSelector(e.documentSelector),n),n]}};zi.CallHierarchyFeature=$o});var Qc=F(Bi=>{"use strict";Object.defineProperty(Bi,"__esModule",{value:!0});Bi.SemanticTokensFeature=void 0;var Vi=I("vscode"),U=L(),Tn=W(),_l=Ee(),Wo=class extends Tn.TextDocumentLanguageFeature{constructor(e){super(e,U.SemanticTokensRegistrationType.type)}fillClientCapabilities(e){let t=(0,Tn.ensure)((0,Tn.ensure)(e,"textDocument"),"semanticTokens");t.dynamicRegistration=!0,t.tokenTypes=[U.SemanticTokenTypes.namespace,U.SemanticTokenTypes.type,U.SemanticTokenTypes.class,U.SemanticTokenTypes.enum,U.SemanticTokenTypes.interface,U.SemanticTokenTypes.struct,U.SemanticTokenTypes.typeParameter,U.SemanticTokenTypes.parameter,U.SemanticTokenTypes.variable,U.SemanticTokenTypes.property,U.SemanticTokenTypes.enumMember,U.SemanticTokenTypes.event,U.SemanticTokenTypes.function,U.SemanticTokenTypes.method,U.SemanticTokenTypes.macro,U.SemanticTokenTypes.keyword,U.SemanticTokenTypes.modifier,U.SemanticTokenTypes.comment,U.SemanticTokenTypes.string,U.SemanticTokenTypes.number,U.SemanticTokenTypes.regexp,U.SemanticTokenTypes.operator,U.SemanticTokenTypes.decorator],t.tokenModifiers=[U.SemanticTokenModifiers.declaration,U.SemanticTokenModifiers.definition,U.SemanticTokenModifiers.readonly,U.SemanticTokenModifiers.static,U.SemanticTokenModifiers.deprecated,U.SemanticTokenModifiers.abstract,U.SemanticTokenModifiers.async,U.SemanticTokenModifiers.modification,U.SemanticTokenModifiers.documentation,U.SemanticTokenModifiers.defaultLibrary],t.formats=[U.TokenFormat.Relative],t.requests={range:!0,full:{delta:!0}},t.multilineTokenSupport=!1,t.overlappingTokenSupport=!1,t.serverCancelSupport=!0,t.augmentsSyntaxTokens=!0,(0,Tn.ensure)((0,Tn.ensure)(e,"workspace"),"semanticTokens").refreshSupport=!0}initialize(e,t){this._client.onRequest(U.SemanticTokensRefreshRequest.type,async()=>{for(let a of this.getAllProviders())a.onDidChangeSemanticTokensEmitter.fire()});let[i,r]=this.getRegistration(t,e.semanticTokensProvider);!i||!r||this.register({id:i,registerOptions:r})}registerLanguageProvider(e){let t=e.documentSelector,n=_l.boolean(e.full)?e.full:e.full!==void 0,i=e.full!==void 0&&typeof e.full!="boolean"&&e.full.delta===!0,r=new Vi.EventEmitter,a=n?{onDidChangeSemanticTokens:r.event,provideDocumentSemanticTokens:(v,p)=>{let C=this._client,y=C.middleware,b=(T,P)=>{let q={textDocument:C.code2ProtocolConverter.asTextDocumentIdentifier(T)};return C.sendRequest(U.SemanticTokensRequest.type,q,P).then(ce=>P.isCancellationRequested?null:C.protocol2CodeConverter.asSemanticTokens(ce,P),ce=>C.handleFailedRequest(U.SemanticTokensRequest.type,P,ce,null))};return y.provideDocumentSemanticTokens?y.provideDocumentSemanticTokens(v,p,b):b(v,p)},provideDocumentSemanticTokensEdits:i?(v,p,C)=>{let y=this._client,b=y.middleware,T=(P,q,ce)=>{let V={textDocument:y.code2ProtocolConverter.asTextDocumentIdentifier(P),previousResultId:q};return y.sendRequest(U.SemanticTokensDeltaRequest.type,V,ce).then(async Z=>ce.isCancellationRequested?null:U.SemanticTokens.is(Z)?await y.protocol2CodeConverter.asSemanticTokens(Z,ce):await y.protocol2CodeConverter.asSemanticTokensEdits(Z,ce),Z=>y.handleFailedRequest(U.SemanticTokensDeltaRequest.type,ce,Z,null))};return b.provideDocumentSemanticTokensEdits?b.provideDocumentSemanticTokensEdits(v,p,C,T):T(v,p,C)}:void 0}:void 0,u=e.range===!0?{provideDocumentRangeSemanticTokens:(v,p,C)=>{let y=this._client,b=y.middleware,T=(P,q,ce)=>{let V={textDocument:y.code2ProtocolConverter.asTextDocumentIdentifier(P),range:y.code2ProtocolConverter.asRange(q)};return y.sendRequest(U.SemanticTokensRangeRequest.type,V,ce).then(Z=>ce.isCancellationRequested?null:y.protocol2CodeConverter.asSemanticTokens(Z,ce),Z=>y.handleFailedRequest(U.SemanticTokensRangeRequest.type,ce,Z,null))};return b.provideDocumentRangeSemanticTokens?b.provideDocumentRangeSemanticTokens(v,p,C,T):T(v,p,C)}}:void 0,l=[],g=this._client,h=g.protocol2CodeConverter.asSemanticTokensLegend(e.legend),f=g.protocol2CodeConverter.asDocumentSelector(t);return a!==void 0&&l.push(Vi.languages.registerDocumentSemanticTokensProvider(f,a,h)),u!==void 0&&l.push(Vi.languages.registerDocumentRangeSemanticTokensProvider(f,u,h)),[new Vi.Disposable(()=>l.forEach(v=>v.dispose())),{range:u,full:a,onDidChangeSemanticTokensEmitter:r}]}};Bi.SemanticTokensFeature=Wo});var Xc=F(be=>{"use strict";Object.defineProperty(be,"__esModule",{value:!0});be.WillDeleteFilesFeature=be.WillRenameFilesFeature=be.WillCreateFilesFeature=be.DidDeleteFilesFeature=be.DidRenameFilesFeature=be.DidCreateFilesFeature=void 0;var Le=I("vscode"),bl=kr(),rt=L(),Tl=te();function Gc(s,e){return s[e]===void 0&&(s[e]={}),s[e]}function kl(s,e){return s[e]}function Yc(s,e,t){s[e]=t}var kn=class s{constructor(e,t,n,i,r){this._client=e,this._event=t,this._registrationType=n,this._clientCapability=i,this._serverCapability=r,this._filters=new Map}getState(){return{kind:"workspace",id:this._registrationType.method,registrations:this._filters.size>0}}filterSize(){return this._filters.size}get registrationType(){return this._registrationType}fillClientCapabilities(e){let t=Gc(Gc(e,"workspace"),"fileOperations");Yc(t,"dynamicRegistration",!0),Yc(t,this._clientCapability,!0)}initialize(e){let t=e.workspace?.fileOperations,n=t!==void 0?kl(t,this._serverCapability):void 0;if(n?.filters!==void 0)try{this.register({id:Tl.generateUuid(),registerOptions:{filters:n.filters}})}catch(i){this._client.warn(`Ignoring invalid glob pattern for ${this._serverCapability} registration: ${i}`)}}register(e){this._listener||(this._listener=this._event(this.send,this));let t=e.registerOptions.filters.map(n=>{let i=new bl.Minimatch(n.pattern.glob,s.asMinimatchOptions(n.pattern.options));if(!i.makeRe())throw new Error(`Invalid pattern ${n.pattern.glob}!`);return{scheme:n.scheme,matcher:i,kind:n.pattern.matches}});this._filters.set(e.id,t)}unregister(e){this._filters.delete(e),this._filters.size===0&&this._listener&&(this._listener.dispose(),this._listener=void 0)}clear(){this._filters.clear(),this._listener&&(this._listener.dispose(),this._listener=void 0)}getFileType(e){return s.getFileType(e)}async filter(e,t){let n=await Promise.all(e.files.map(async r=>{let a=t(r),c=a.fsPath.replace(/\\/g,"/");for(let u of this._filters.values())for(let l of u)if(!(l.scheme!==void 0&&l.scheme!==a.scheme)){if(l.matcher.match(c)){if(l.kind===void 0)return!0;let g=await this.getFileType(a);if(g===void 0)return this._client.error(`Failed to determine file type for ${a.toString()}.`),!0;if(g===Le.FileType.File&&l.kind===rt.FileOperationPatternKind.file||g===Le.FileType.Directory&&l.kind===rt.FileOperationPatternKind.folder)return!0}else if(l.kind===rt.FileOperationPatternKind.folder&&await s.getFileType(a)===Le.FileType.Directory&&l.matcher.match(`${c}/`))return!0}return!1})),i=e.files.filter((r,a)=>n[a]);return{...e,files:i}}static async getFileType(e){try{return(await Le.workspace.fs.stat(e)).type}catch{return}}static asMinimatchOptions(e){let t={dot:!0};return e?.ignoreCase===!0&&(t.nocase=!0),t}},Ji=class extends kn{constructor(e,t,n,i,r,a,c){super(e,t,n,i,r),this._notificationType=n,this._accessUri=a,this._createParams=c}async send(e){let t=await this.filter(e,this._accessUri);if(t.files.length){let n=async i=>this._client.sendNotification(this._notificationType,this._createParams(i));return this.doSend(t,n)}}},Qi=class extends Ji{constructor(){super(...arguments),this._fsPathFileTypes=new Map}async getFileType(e){let t=e.fsPath;if(this._fsPathFileTypes.has(t))return this._fsPathFileTypes.get(t);let n=await kn.getFileType(e);return n&&this._fsPathFileTypes.set(t,n),n}async cacheFileTypes(e,t){await this.filter(e,t)}clearFileTypeCache(){this._fsPathFileTypes.clear()}unregister(e){super.unregister(e),this.filterSize()===0&&this._willListener&&(this._willListener.dispose(),this._willListener=void 0)}clear(){super.clear(),this._willListener&&(this._willListener.dispose(),this._willListener=void 0)}},jo=class extends Ji{constructor(e){super(e,Le.workspace.onDidCreateFiles,rt.DidCreateFilesNotification.type,"didCreate","didCreate",t=>t,e.code2ProtocolConverter.asDidCreateFilesParams)}doSend(e,t){let n=this._client.middleware.workspace;return n?.didCreateFiles?n.didCreateFiles(e,t):t(e)}};be.DidCreateFilesFeature=jo;var zo=class extends Qi{constructor(e){super(e,Le.workspace.onDidRenameFiles,rt.DidRenameFilesNotification.type,"didRename","didRename",t=>t.oldUri,e.code2ProtocolConverter.asDidRenameFilesParams)}register(e){this._willListener||(this._willListener=Le.workspace.onWillRenameFiles(this.willRename,this)),super.register(e)}willRename(e){e.waitUntil(this.cacheFileTypes(e,t=>t.oldUri))}doSend(e,t){this.clearFileTypeCache();let n=this._client.middleware.workspace;return n?.didRenameFiles?n.didRenameFiles(e,t):t(e)}};be.DidRenameFilesFeature=zo;var Vo=class extends Qi{constructor(e){super(e,Le.workspace.onDidDeleteFiles,rt.DidDeleteFilesNotification.type,"didDelete","didDelete",t=>t,e.code2ProtocolConverter.asDidDeleteFilesParams)}register(e){this._willListener||(this._willListener=Le.workspace.onWillDeleteFiles(this.willDelete,this)),super.register(e)}willDelete(e){e.waitUntil(this.cacheFileTypes(e,t=>t))}doSend(e,t){this.clearFileTypeCache();let n=this._client.middleware.workspace;return n?.didDeleteFiles?n.didDeleteFiles(e,t):t(e)}};be.DidDeleteFilesFeature=Vo;var Pn=class extends kn{constructor(e,t,n,i,r,a,c){super(e,t,n,i,r),this._requestType=n,this._accessUri=a,this._createParams=c}async send(e){let t=this.waitUntil(e);e.waitUntil(t)}async waitUntil(e){let t=await this.filter(e,this._accessUri);if(t.files.length){let n=i=>this._client.sendRequest(this._requestType,this._createParams(i),i.token).then(this._client.protocol2CodeConverter.asWorkspaceEdit);return this.doSend(t,n)}else return}},Bo=class extends Pn{constructor(e){super(e,Le.workspace.onWillCreateFiles,rt.WillCreateFilesRequest.type,"willCreate","willCreate",t=>t,e.code2ProtocolConverter.asWillCreateFilesParams)}doSend(e,t){let n=this._client.middleware.workspace;return n?.willCreateFiles?n.willCreateFiles(e,t):t(e)}};be.WillCreateFilesFeature=Bo;var Jo=class extends Pn{constructor(e){super(e,Le.workspace.onWillRenameFiles,rt.WillRenameFilesRequest.type,"willRename","willRename",t=>t.oldUri,e.code2ProtocolConverter.asWillRenameFilesParams)}doSend(e,t){let n=this._client.middleware.workspace;return n?.willRenameFiles?n.willRenameFiles(e,t):t(e)}};be.WillRenameFilesFeature=Jo;var Qo=class extends Pn{constructor(e){super(e,Le.workspace.onWillDeleteFiles,rt.WillDeleteFilesRequest.type,"willDelete","willDelete",t=>t,e.code2ProtocolConverter.asWillDeleteFilesParams)}doSend(e,t){let n=this._client.middleware.workspace;return n?.willDeleteFiles?n.willDeleteFiles(e,t):t(e)}};be.WillDeleteFilesFeature=Qo});var Zc=F(Gi=>{"use strict";Object.defineProperty(Gi,"__esModule",{value:!0});Gi.LinkedEditingFeature=void 0;var Pl=I("vscode"),Go=L(),Yo=W(),Xo=class extends Yo.TextDocumentLanguageFeature{constructor(e){super(e,Go.LinkedEditingRangeRequest.type)}fillClientCapabilities(e){let t=(0,Yo.ensure)((0,Yo.ensure)(e,"textDocument"),"linkedEditingRange");t.dynamicRegistration=!0}initialize(e,t){let[n,i]=this.getRegistration(t,e.linkedEditingRangeProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n={provideLinkedEditingRanges:(i,r,a)=>{let c=this._client,u=(g,h,f)=>c.sendRequest(Go.LinkedEditingRangeRequest.type,c.code2ProtocolConverter.asTextDocumentPositionParams(g,h),f).then(v=>f.isCancellationRequested?null:c.protocol2CodeConverter.asLinkedEditingRanges(v,f),v=>c.handleFailedRequest(Go.LinkedEditingRangeRequest.type,f,v,null)),l=c.middleware;return l.provideLinkedEditingRange?l.provideLinkedEditingRange(i,r,a,u):u(i,r,a)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return Pl.languages.registerLinkedEditingRangeProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Gi.LinkedEditingFeature=Xo});var ed=F(Yi=>{"use strict";Object.defineProperty(Yi,"__esModule",{value:!0});Yi.TypeHierarchyFeature=void 0;var Rl=I("vscode"),qt=L(),Zo=W(),ea=class{constructor(e){this.client=e,this.middleware=e.middleware}prepareTypeHierarchy(e,t,n){let i=this.client,r=this.middleware,a=(c,u,l)=>{let g=i.code2ProtocolConverter.asTextDocumentPositionParams(c,u);return i.sendRequest(qt.TypeHierarchyPrepareRequest.type,g,l).then(h=>l.isCancellationRequested?null:i.protocol2CodeConverter.asTypeHierarchyItems(h,l),h=>i.handleFailedRequest(qt.TypeHierarchyPrepareRequest.type,l,h,null))};return r.prepareTypeHierarchy?r.prepareTypeHierarchy(e,t,n,a):a(e,t,n)}provideTypeHierarchySupertypes(e,t){let n=this.client,i=this.middleware,r=(a,c)=>{let u={item:n.code2ProtocolConverter.asTypeHierarchyItem(a)};return n.sendRequest(qt.TypeHierarchySupertypesRequest.type,u,c).then(l=>c.isCancellationRequested?null:n.protocol2CodeConverter.asTypeHierarchyItems(l,c),l=>n.handleFailedRequest(qt.TypeHierarchySupertypesRequest.type,c,l,null))};return i.provideTypeHierarchySupertypes?i.provideTypeHierarchySupertypes(e,t,r):r(e,t)}provideTypeHierarchySubtypes(e,t){let n=this.client,i=this.middleware,r=(a,c)=>{let u={item:n.code2ProtocolConverter.asTypeHierarchyItem(a)};return n.sendRequest(qt.TypeHierarchySubtypesRequest.type,u,c).then(l=>c.isCancellationRequested?null:n.protocol2CodeConverter.asTypeHierarchyItems(l,c),l=>n.handleFailedRequest(qt.TypeHierarchySubtypesRequest.type,c,l,null))};return i.provideTypeHierarchySubtypes?i.provideTypeHierarchySubtypes(e,t,r):r(e,t)}},ta=class extends Zo.TextDocumentLanguageFeature{constructor(e){super(e,qt.TypeHierarchyPrepareRequest.type)}fillClientCapabilities(e){let t=(0,Zo.ensure)((0,Zo.ensure)(e,"textDocument"),"typeHierarchy");t.dynamicRegistration=!0}initialize(e,t){let[n,i]=this.getRegistration(t,e.typeHierarchyProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=this._client,n=new ea(t);return[Rl.languages.registerTypeHierarchyProvider(t.protocol2CodeConverter.asDocumentSelector(e.documentSelector),n),n]}};Yi.TypeHierarchyFeature=ta});var nd=F(Zi=>{"use strict";Object.defineProperty(Zi,"__esModule",{value:!0});Zi.InlineValueFeature=void 0;var td=I("vscode"),Xi=L(),Rn=W(),na=class extends Rn.TextDocumentLanguageFeature{constructor(e){super(e,Xi.InlineValueRequest.type)}fillClientCapabilities(e){(0,Rn.ensure)((0,Rn.ensure)(e,"textDocument"),"inlineValue").dynamicRegistration=!0,(0,Rn.ensure)((0,Rn.ensure)(e,"workspace"),"inlineValue").refreshSupport=!0}initialize(e,t){this._client.onRequest(Xi.InlineValueRefreshRequest.type,async()=>{for(let r of this.getAllProviders())r.onDidChangeInlineValues.fire()});let[n,i]=this.getRegistration(t,e.inlineValueProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n=new td.EventEmitter,i={onDidChangeInlineValues:n.event,provideInlineValues:(r,a,c,u)=>{let l=this._client,g=(f,v,p,C)=>{let y={textDocument:l.code2ProtocolConverter.asTextDocumentIdentifier(f),range:l.code2ProtocolConverter.asRange(v),context:l.code2ProtocolConverter.asInlineValueContext(p)};return l.sendRequest(Xi.InlineValueRequest.type,y,C).then(b=>C.isCancellationRequested?null:l.protocol2CodeConverter.asInlineValues(b,C),b=>l.handleFailedRequest(Xi.InlineValueRequest.type,C,b,null))},h=l.middleware;return h.provideInlineValues?h.provideInlineValues(r,a,c,u,g):g(r,a,c,u)}};return[this.registerProvider(t,i),{provider:i,onDidChangeInlineValues:n}]}registerProvider(e,t){return td.languages.registerInlineValuesProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Zi.InlineValueFeature=na});var rd=F(er=>{"use strict";Object.defineProperty(er,"__esModule",{value:!0});er.InlayHintsFeature=void 0;var id=I("vscode"),Gt=L(),xn=W(),ia=class extends xn.TextDocumentLanguageFeature{constructor(e){super(e,Gt.InlayHintRequest.type)}fillClientCapabilities(e){let t=(0,xn.ensure)((0,xn.ensure)(e,"textDocument"),"inlayHint");t.dynamicRegistration=!0,t.resolveSupport={properties:["tooltip","textEdits","label.tooltip","label.location","label.command"]},(0,xn.ensure)((0,xn.ensure)(e,"workspace"),"inlayHint").refreshSupport=!0}initialize(e,t){this._client.onRequest(Gt.InlayHintRefreshRequest.type,async()=>{for(let r of this.getAllProviders())r.onDidChangeInlayHints.fire()});let[n,i]=this.getRegistration(t,e.inlayHintProvider);!n||!i||this.register({id:n,registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n=new id.EventEmitter,i={onDidChangeInlayHints:n.event,provideInlayHints:(r,a,c)=>{let u=this._client,l=async(h,f,v)=>{let p={textDocument:u.code2ProtocolConverter.asTextDocumentIdentifier(h),range:u.code2ProtocolConverter.asRange(f)};try{let C=await u.sendRequest(Gt.InlayHintRequest.type,p,v);return v.isCancellationRequested?null:u.protocol2CodeConverter.asInlayHints(C,v)}catch(C){return u.handleFailedRequest(Gt.InlayHintRequest.type,v,C,null)}},g=u.middleware;return g.provideInlayHints?g.provideInlayHints(r,a,c,l):l(r,a,c)}};return i.resolveInlayHint=e.resolveProvider===!0?(r,a)=>{let c=this._client,u=async(g,h)=>{try{let f=await c.sendRequest(Gt.InlayHintResolveRequest.type,c.code2ProtocolConverter.asInlayHint(g),h);if(h.isCancellationRequested)return null;let v=c.protocol2CodeConverter.asInlayHint(f,h);return h.isCancellationRequested?null:v}catch(f){return c.handleFailedRequest(Gt.InlayHintResolveRequest.type,h,f,null)}},l=c.middleware;return l.resolveInlayHint?l.resolveInlayHint(r,a,u):u(r,a)}:void 0,[this.registerProvider(t,i),{provider:i,onDidChangeInlayHints:n}]}registerProvider(e,t){return id.languages.registerInlayHintsProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};er.InlayHintsFeature=ia});var sd=F(tr=>{"use strict";Object.defineProperty(tr,"__esModule",{value:!0});tr.InlineCompletionItemFeature=void 0;var xl=I("vscode"),ra=L(),sa=W(),Fl=te(),oa=class extends sa.TextDocumentLanguageFeature{constructor(e){super(e,ra.InlineCompletionRequest.type)}fillClientCapabilities(e){let t=(0,sa.ensure)((0,sa.ensure)(e,"textDocument"),"inlineCompletion");t.dynamicRegistration=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.inlineCompletionProvider);n&&this.register({id:Fl.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideInlineCompletionItems:(i,r,a,c)=>{let u=this._client,l=this._client.middleware,g=(h,f,v,p)=>u.sendRequest(ra.InlineCompletionRequest.type,u.code2ProtocolConverter.asInlineCompletionParams(h,f,v),p).then(C=>p.isCancellationRequested?null:u.protocol2CodeConverter.asInlineCompletionResult(C,p),C=>u.handleFailedRequest(ra.InlineCompletionRequest.type,p,C,null));return l.provideInlineCompletionItems?l.provideInlineCompletionItems(i,r,a,c,g):g(i,r,a,c)}};return[xl.languages.registerInlineCompletionItemProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};tr.InlineCompletionItemFeature=oa});var pa=F(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.ProposedFeatures=me.BaseLanguageClient=me.MessageTransports=me.SuspendMode=me.State=me.CloseAction=me.ErrorAction=me.RevealOutputChannelOn=void 0;var J=I("vscode"),_=L(),ql=tc(),Il=rc(),je=Ee(),nr=ui(),od=te(),El=vs(),We=W(),Ml=Fs(),ad=gc(),cd=vc(),Yt=yc(),Ol=Cc(),Al=wc(),Ll=Dc(),Ul=_c(),Kl=bc(),Nl=to(),Hl=kc(),$l=Pc(),Wl=Rc(),jl=Fc(),aa=qc(),zl=Ec(),Vl=Mc(),Bl=Ac(),Jl=Lc(),Ql=Uc(),Gl=Kc(),Yl=Nc(),Xl=Hc(),Zl=Wc(),ep=jc(),tp=zc(),np=Bc(),ip=Jc(),rp=Qc(),Xt=Xc(),sp=Zc(),op=ed(),ap=nd(),cp=rd(),dp=sd(),It;(function(s){s[s.Debug=0]="Debug",s[s.Info=1]="Info",s[s.Warn=2]="Warn",s[s.Error=3]="Error",s[s.Never=4]="Never"})(It||(me.RevealOutputChannelOn=It={}));var qn;(function(s){s[s.Continue=1]="Continue",s[s.Shutdown=2]="Shutdown"})(qn||(me.ErrorAction=qn={}));var yt;(function(s){s[s.DoNotRestart=1]="DoNotRestart",s[s.Restart=2]="Restart"})(yt||(me.CloseAction=yt={}));var Fn;(function(s){s[s.Stopped=1]="Stopped",s[s.Starting=3]="Starting",s[s.Running=2]="Running"})(Fn||(me.State=Fn={}));var dd;(function(s){s.off="off",s.on="on"})(dd||(me.SuspendMode=dd={}));var ca;(function(s){function e(t){return t==null?!1:typeof t=="boolean"||typeof t=="object"&&t!==null&&je.stringArray(t.enabledCommands)?t:!1}s.sanitizeIsTrusted=e})(ca||(ca={}));var da=class{constructor(e,t){this.client=e,this.maxRestartCount=t,this.restarts=[]}error(e,t,n){return n&&n<=3?{action:qn.Continue}:{action:qn.Shutdown}}closed(){return this.restarts.push(Date.now()),this.restarts.length<=this.maxRestartCount?{action:yt.Restart}:this.restarts[this.restarts.length-1]-this.restarts[0]<=3*60*1e3?{action:yt.DoNotRestart,message:`The ${this.client.name} server crashed ${this.maxRestartCount+1} times in the last 3 minutes. The server will not be restarted. See the output for more information.`}:(this.restarts.shift(),{action:yt.Restart})}},K;(function(s){s.Initial="initial",s.Starting="starting",s.StartFailed="startFailed",s.Running="running",s.Stopping="stopping",s.Stopped="stopped"})(K||(K={}));var ud;(function(s){function e(t){return t&&_.MessageReader.is(t.reader)&&_.MessageWriter.is(t.writer)}s.is=e})(ud||(me.MessageTransports=ud={}));var In=class s{constructor(e,t,n){this._traceFormat=_.TraceFormat.Text,this._diagnosticQueue=new Map,this._diagnosticQueueState={state:"idle"},this._features=[],this._dynamicFeatures=new Map,this.workspaceEditLock=new nr.Semaphore(1),this._id=e,this._name=t,n=n||{};let i={isTrusted:!1,supportHtml:!1};n.markdown!==void 0&&(i.isTrusted=ca.sanitizeIsTrusted(n.markdown.isTrusted),i.supportHtml=n.markdown.supportHtml===!0),this._clientOptions={documentSelector:n.documentSelector??[],synchronize:n.synchronize??{},diagnosticCollectionName:n.diagnosticCollectionName,outputChannelName:n.outputChannelName??this._name,revealOutputChannelOn:n.revealOutputChannelOn??It.Error,stdioEncoding:n.stdioEncoding??"utf8",initializationOptions:n.initializationOptions,initializationFailedHandler:n.initializationFailedHandler,progressOnInitialization:!!n.progressOnInitialization,errorHandler:n.errorHandler??this.createDefaultErrorHandler(n.connectionOptions?.maxRestartCount),middleware:n.middleware??{},uriConverters:n.uriConverters,workspaceFolder:n.workspaceFolder,connectionOptions:n.connectionOptions,markdown:i,diagnosticPullOptions:n.diagnosticPullOptions??{onChange:!0,onSave:!1},notebookDocumentOptions:n.notebookDocumentOptions??{}},this._clientOptions.synchronize=this._clientOptions.synchronize||{},this._state=K.Initial,this._ignoredRegistrations=new Set,this._listeners=[],this._notificationHandlers=new Map,this._pendingNotificationHandlers=new Map,this._notificationDisposables=new Map,this._requestHandlers=new Map,this._pendingRequestHandlers=new Map,this._requestDisposables=new Map,this._progressHandlers=new Map,this._pendingProgressHandlers=new Map,this._progressDisposables=new Map,this._connection=void 0,this._initializeResult=void 0,n.outputChannel?(this._outputChannel=n.outputChannel,this._disposeOutputChannel=!1):(this._outputChannel=void 0,this._disposeOutputChannel=!0),this._traceOutputChannel=n.traceOutputChannel,this._diagnostics=void 0,this._pendingOpenNotifications=new Set,this._pendingChangeSemaphore=new nr.Semaphore(1),this._pendingChangeDelayer=new nr.Delayer(250),this._fileEvents=[],this._fileEventDelayer=new nr.Delayer(250),this._onStop=void 0,this._telemetryEmitter=new _.Emitter,this._stateChangeEmitter=new _.Emitter,this._trace=_.Trace.Off,this._tracer={log:(r,a)=>{je.string(r)?this.logTrace(r,a):this.logObjectTrace(r)}},this._c2p=ql.createConverter(n.uriConverters?n.uriConverters.code2Protocol:void 0),this._p2c=Il.createConverter(n.uriConverters?n.uriConverters.protocol2Code:void 0,this._clientOptions.markdown.isTrusted,this._clientOptions.markdown.supportHtml),this._syncedDocuments=new Map,this.registerBuiltinFeatures()}get name(){return this._name}get middleware(){return this._clientOptions.middleware??Object.create(null)}get clientOptions(){return this._clientOptions}get protocol2CodeConverter(){return this._p2c}get code2ProtocolConverter(){return this._c2p}get onTelemetry(){return this._telemetryEmitter.event}get onDidChangeState(){return this._stateChangeEmitter.event}get outputChannel(){return this._outputChannel||(this._outputChannel=J.window.createOutputChannel(this._clientOptions.outputChannelName?this._clientOptions.outputChannelName:this._name)),this._outputChannel}get traceOutputChannel(){return this._traceOutputChannel?this._traceOutputChannel:this.outputChannel}get diagnostics(){return this._diagnostics}get state(){return this.getPublicState()}get $state(){return this._state}set $state(e){let t=this.getPublicState();this._state=e;let n=this.getPublicState();n!==t&&this._stateChangeEmitter.fire({oldState:t,newState:n})}getPublicState(){switch(this.$state){case K.Starting:return Fn.Starting;case K.Running:return Fn.Running;default:return Fn.Stopped}}get initializeResult(){return this._initializeResult}async sendRequest(e,...t){if(this.$state===K.StartFailed||this.$state===K.Stopping||this.$state===K.Stopped)return Promise.reject(new _.ResponseError(_.ErrorCodes.ConnectionInactive,"Client is not running"));let n=await this.$start();this._didChangeTextDocumentFeature.syncKind===_.TextDocumentSyncKind.Full&&await this.sendPendingFullTextDocumentChanges(n);let i=this._clientOptions.middleware?.sendRequest;if(i!==void 0){let r,a;return t.length===1?_.CancellationToken.is(t[0])?a=t[0]:r=t[0]:t.length===2&&(r=t[0],a=t[1]),i(e,r,a,(c,u,l)=>{let g=[];return u!==void 0&&g.push(u),l!==void 0&&g.push(l),n.sendRequest(c,...g)})}else return n.sendRequest(e,...t)}onRequest(e,t){let n=typeof e=="string"?e:e.method;this._requestHandlers.set(n,t);let i=this.activeConnection(),r;return i!==void 0?(this._requestDisposables.set(n,i.onRequest(e,t)),r={dispose:()=>{let a=this._requestDisposables.get(n);a!==void 0&&(a.dispose(),this._requestDisposables.delete(n))}}):(this._pendingRequestHandlers.set(n,t),r={dispose:()=>{this._pendingRequestHandlers.delete(n);let a=this._requestDisposables.get(n);a!==void 0&&(a.dispose(),this._requestDisposables.delete(n))}}),{dispose:()=>{this._requestHandlers.delete(n),r.dispose()}}}async sendNotification(e,t){if(this.$state===K.StartFailed||this.$state===K.Stopping||this.$state===K.Stopped)return Promise.reject(new _.ResponseError(_.ErrorCodes.ConnectionInactive,"Client is not running"));let n=this._didChangeTextDocumentFeature.syncKind===_.TextDocumentSyncKind.Full,i;n&&typeof e!="string"&&e.method===_.DidOpenTextDocumentNotification.method&&(i=t?.textDocument.uri,this._pendingOpenNotifications.add(i));let r=await this.$start();n&&await this.sendPendingFullTextDocumentChanges(r),i!==void 0&&this._pendingOpenNotifications.delete(i);let a=this._clientOptions.middleware?.sendNotification;return a?a(e,r.sendNotification.bind(r),t):r.sendNotification(e,t)}onNotification(e,t){let n=typeof e=="string"?e:e.method;this._notificationHandlers.set(n,t);let i=this.activeConnection(),r;return i!==void 0?(this._notificationDisposables.set(n,i.onNotification(e,t)),r={dispose:()=>{let a=this._notificationDisposables.get(n);a!==void 0&&(a.dispose(),this._notificationDisposables.delete(n))}}):(this._pendingNotificationHandlers.set(n,t),r={dispose:()=>{this._pendingNotificationHandlers.delete(n);let a=this._notificationDisposables.get(n);a!==void 0&&(a.dispose(),this._notificationDisposables.delete(n))}}),{dispose:()=>{this._notificationHandlers.delete(n),r.dispose()}}}async sendProgress(e,t,n){if(this.$state===K.StartFailed||this.$state===K.Stopping||this.$state===K.Stopped)return Promise.reject(new _.ResponseError(_.ErrorCodes.ConnectionInactive,"Client is not running"));try{return(await this.$start()).sendProgress(e,t,n)}catch(i){throw this.error(`Sending progress for token ${t} failed.`,i),i}}onProgress(e,t,n){this._progressHandlers.set(t,{type:e,handler:n});let i=this.activeConnection(),r,a=this._clientOptions.middleware?.handleWorkDoneProgress,c=_.WorkDoneProgress.is(e)&&a!==void 0?u=>{a(t,u,()=>n(u))}:n;return i!==void 0?(this._progressDisposables.set(t,i.onProgress(e,t,c)),r={dispose:()=>{let u=this._progressDisposables.get(t);u!==void 0&&(u.dispose(),this._progressDisposables.delete(t))}}):(this._pendingProgressHandlers.set(t,{type:e,handler:n}),r={dispose:()=>{this._pendingProgressHandlers.delete(t);let u=this._progressDisposables.get(t);u!==void 0&&(u.dispose(),this._progressDisposables.delete(t))}}),{dispose:()=>{this._progressHandlers.delete(t),r.dispose()}}}createDefaultErrorHandler(e){if(e!==void 0&&e<0)throw new Error(`Invalid maxRestartCount: ${e}`);return new da(this,e??4)}async setTrace(e){this._trace=e;let t=this.activeConnection();t!==void 0&&await t.trace(this._trace,this._tracer,{sendNotification:!1,traceFormat:this._traceFormat})}data2String(e){if(e instanceof _.ResponseError){let t=e;return` Message: ${t.message}
|
|
7
7
|
Code: ${t.code} ${t.data?`
|
|
8
|
-
`+t.data.toString():""}`}return e instanceof Error?je.string(e.stack)?e.stack:e.message:je.string(e)?e:e.toString()}debug(e,t,n=!0){this.logOutputMessage(_.MessageType.Debug,It.Debug,"Debug",e,t,n)}info(e,t,n=!0){this.logOutputMessage(_.MessageType.Info,It.Info,"Info",e,t,n)}warn(e,t,n=!0){this.logOutputMessage(_.MessageType.Warning,It.Warn,"Warn",e,t,n)}error(e,t,n=!0){this.logOutputMessage(_.MessageType.Error,It.Error,"Error",e,t,n)}logOutputMessage(e,t,n,i,r,o){this.outputChannel.appendLine(`[${n.padEnd(5)} - ${new Date().toLocaleTimeString()}] ${i}`),r!=null&&this.outputChannel.appendLine(this.data2String(r)),(o==="force"||o&&this._clientOptions.revealOutputChannelOn<=t)&&this.showNotificationMessage(e,i)}showNotificationMessage(e,t){t=t??"A request has failed. See the output for more information.",(e===_.MessageType.Error?J.window.showErrorMessage:e===_.MessageType.Warning?J.window.showWarningMessage:J.window.showInformationMessage)(t,"Go to output").then(i=>{i!==void 0&&this.outputChannel.show(!0)})}logTrace(e,t){this.traceOutputChannel.appendLine(`[Trace - ${new Date().toLocaleTimeString()}] ${e}`),t&&this.traceOutputChannel.appendLine(this.data2String(t))}logObjectTrace(e){e.isLSPMessage&&e.type?this.traceOutputChannel.append(`[LSP - ${new Date().toLocaleTimeString()}] `):this.traceOutputChannel.append(`[Trace - ${new Date().toLocaleTimeString()}] `),e&&this.traceOutputChannel.appendLine(`${JSON.stringify(e)}`)}needsStart(){return this.$state===N.Initial||this.$state===N.Stopping||this.$state===N.Stopped}needsStop(){return this.$state===N.Starting||this.$state===N.Running}activeConnection(){return this.$state===N.Running&&this._connection!==void 0?this._connection:void 0}isRunning(){return this.$state===N.Running}async start(){if(this._disposed==="disposing"||this._disposed==="disposed")throw new Error("Client got disposed and can't be restarted.");if(this.$state===N.Stopping)throw new Error("Client is currently stopping. Can only restart a full stopped client");if(this._onStart!==void 0)return this._onStart;let[e,t,n]=this.createOnStartPromise();this._onStart=e,this._diagnostics===void 0&&(this._diagnostics=this._clientOptions.diagnosticCollectionName?J.languages.createDiagnosticCollection(this._clientOptions.diagnosticCollectionName):J.languages.createDiagnosticCollection());for(let[i,r]of this._notificationHandlers)this._pendingNotificationHandlers.has(i)||this._pendingNotificationHandlers.set(i,r);for(let[i,r]of this._requestHandlers)this._pendingRequestHandlers.has(i)||this._pendingRequestHandlers.set(i,r);for(let[i,r]of this._progressHandlers)this._pendingProgressHandlers.has(i)||this._pendingProgressHandlers.set(i,r);this.$state=N.Starting;try{let i=await this.createConnection();i.onNotification(_.LogMessageNotification.type,r=>{switch(r.type){case _.MessageType.Error:this.error(r.message,void 0,!1);break;case _.MessageType.Warning:this.warn(r.message,void 0,!1);break;case _.MessageType.Info:this.info(r.message,void 0,!1);break;case _.MessageType.Debug:this.debug(r.message,void 0,!1);break;default:this.outputChannel.appendLine(r.message)}}),i.onNotification(_.ShowMessageNotification.type,r=>{switch(r.type){case _.MessageType.Error:J.window.showErrorMessage(r.message);break;case _.MessageType.Warning:J.window.showWarningMessage(r.message);break;case _.MessageType.Info:J.window.showInformationMessage(r.message);break;default:J.window.showInformationMessage(r.message)}}),i.onRequest(_.ShowMessageRequest.type,r=>{let o;switch(r.type){case _.MessageType.Error:o=J.window.showErrorMessage;break;case _.MessageType.Warning:o=J.window.showWarningMessage;break;case _.MessageType.Info:o=J.window.showInformationMessage;break;default:o=J.window.showInformationMessage}let c=r.actions||[];return o(r.message,...c)}),i.onNotification(_.TelemetryEventNotification.type,r=>{this._telemetryEmitter.fire(r)}),i.onRequest(_.ShowDocumentRequest.type,async r=>{let o=async d=>{let l=this.protocol2CodeConverter.asUri(d.uri);try{if(d.external===!0)return{success:await J.env.openExternal(l)};{let p={};return d.selection!==void 0&&(p.selection=this.protocol2CodeConverter.asRange(d.selection)),d.takeFocus===void 0||d.takeFocus===!1?p.preserveFocus=!0:d.takeFocus===!0&&(p.preserveFocus=!1),await J.window.showTextDocument(l,p),{success:!0}}}catch{return{success:!1}}},c=this._clientOptions.middleware.window?.showDocument;return c!==void 0?c(r,o):o(r)}),i.listen(),await this.initialize(i),t()}catch(i){this.$state=N.StartFailed,this.error(`${this._name} client: couldn't create connection to server.`,i,"force"),n(i)}return this._onStart}createOnStartPromise(){let e,t;return[new Promise((i,r)=>{e=i,t=r}),e,t]}async initialize(e){this.refreshTrace(e,!1);let t=this._clientOptions.initializationOptions,[n,i]=this._clientOptions.workspaceFolder!==void 0?[this._clientOptions.workspaceFolder.uri.fsPath,[{uri:this._c2p.asUri(this._clientOptions.workspaceFolder.uri),name:this._clientOptions.workspaceFolder.name}]]:[this._clientGetRootPath(),null],r={processId:null,clientInfo:{name:J.env.appName,version:J.version},locale:this.getLocale(),rootPath:n||null,rootUri:n?this._c2p.asUri(J.Uri.file(n)):null,capabilities:this.computeClientCapabilities(),initializationOptions:je.func(t)?t():t,trace:_.Trace.toString(this._trace),workspaceFolders:i};if(this.fillInitializeParams(r),this._clientOptions.progressOnInitialization){let o=rd.generateUuid(),c=new ql.ProgressPart(e,o);r.workDoneToken=o;try{let d=await this.doInitialize(e,r);return c.done(),d}catch(d){throw c.cancel(),d}}else return this.doInitialize(e,r)}async doInitialize(e,t){try{let n=await e.initialize(t);if(n.capabilities.positionEncoding!==void 0&&n.capabilities.positionEncoding!==_.PositionEncodingKind.UTF16)throw new Error(`Unsupported position encoding (${n.capabilities.positionEncoding}) received from server ${this.name}`);this._initializeResult=n,this.$state=N.Running;let i;je.number(n.capabilities.textDocumentSync)?n.capabilities.textDocumentSync===_.TextDocumentSyncKind.None?i={openClose:!1,change:_.TextDocumentSyncKind.None,save:void 0}:i={openClose:!0,change:n.capabilities.textDocumentSync,save:{includeText:!1}}:n.capabilities.textDocumentSync!==void 0&&n.capabilities.textDocumentSync!==null&&(i=n.capabilities.textDocumentSync),this._capabilities=Object.assign({},n.capabilities,{resolvedTextDocumentSync:i}),e.onNotification(_.PublishDiagnosticsNotification.type,r=>this.handleDiagnostics(r)),e.onRequest(_.RegistrationRequest.type,r=>this.handleRegistrationRequest(r)),e.onRequest("client/registerFeature",r=>this.handleRegistrationRequest(r)),e.onRequest(_.UnregistrationRequest.type,r=>this.handleUnregistrationRequest(r)),e.onRequest("client/unregisterFeature",r=>this.handleUnregistrationRequest(r)),e.onRequest(_.ApplyWorkspaceEditRequest.type,r=>this.handleApplyWorkspaceEdit(r));for(let[r,o]of this._pendingNotificationHandlers)this._notificationDisposables.set(r,e.onNotification(r,o));this._pendingNotificationHandlers.clear();for(let[r,o]of this._pendingRequestHandlers)this._requestDisposables.set(r,e.onRequest(r,o));this._pendingRequestHandlers.clear();for(let[r,o]of this._pendingProgressHandlers)this._progressDisposables.set(r,e.onProgress(o.type,r,o.handler));return this._pendingProgressHandlers.clear(),await e.sendNotification(_.InitializedNotification.type,{}),this.hookFileEvents(e),this.hookConfigurationChanged(e),this.initializeFeatures(e),n}catch(n){throw this._clientOptions.initializationFailedHandler?this._clientOptions.initializationFailedHandler(n)?this.initialize(e):this.stop():n instanceof _.ResponseError&&n.data&&n.data.retry?J.window.showErrorMessage(n.message,{title:"Retry",id:"retry"}).then(i=>{i&&i.id==="retry"?this.initialize(e):this.stop()}):(n&&n.message&&J.window.showErrorMessage(n.message),this.error("Server initialization failed.",n),this.stop()),n}}_clientGetRootPath(){let e=J.workspace.workspaceFolders;if(!e||e.length===0)return;let t=e[0];if(t.uri.scheme==="file")return t.uri.fsPath}stop(e=2e3){return this.shutdown("stop",e)}dispose(e=2e3){try{return this._disposed="disposing",this.stop(e)}finally{this._disposed="disposed"}}async shutdown(e,t){if(this.$state===N.Stopped||this.$state===N.Initial)return;if(this.$state===N.Stopping){if(this._onStop!==void 0)return this._onStop;throw new Error("Client is stopping but no stop promise available.")}let n=this.activeConnection();if(n===void 0||this.$state!==N.Running)throw new Error(`Client is not running and can't be stopped. It's current state is: ${this.$state}`);this._initializeResult=void 0,this.$state=N.Stopping,this.cleanUp(e);let i=new Promise(o=>{(0,_.RAL)().timer.setTimeout(o,t)}),r=(async o=>(await o.shutdown(),await o.exit(),o))(n);return this._onStop=Promise.race([i,r]).then(o=>{if(o!==void 0)o.end(),o.dispose();else throw this.error("Stopping server timed out",void 0,!1),new Error("Stopping the server timed out")},o=>{throw this.error("Stopping server failed",o,!1),o}).finally(()=>{this.$state=N.Stopped,e==="stop"&&this.cleanUpChannel(),this._onStart=void 0,this._onStop=void 0,this._connection=void 0,this._ignoredRegistrations.clear()})}cleanUp(e){this._fileEvents=[],this._fileEventDelayer.cancel();let t=this._listeners.splice(0,this._listeners.length);for(let n of t)n.dispose();this._syncedDocuments&&this._syncedDocuments.clear();for(let n of Array.from(this._features.entries()).map(i=>i[1]).reverse())n.clear();e==="stop"&&this._diagnostics!==void 0&&(this._diagnostics.dispose(),this._diagnostics=void 0),this._idleInterval!==void 0&&(this._idleInterval.dispose(),this._idleInterval=void 0)}cleanUpChannel(){this._outputChannel!==void 0&&this._disposeOutputChannel&&(this._outputChannel.dispose(),this._outputChannel=void 0)}notifyFileEvent(e){let t=this;async function n(r){return t._fileEvents.push(r),t._fileEventDelayer.trigger(async()=>{await t.sendNotification(_.DidChangeWatchedFilesNotification.type,{changes:t._fileEvents}),t._fileEvents=[]})}let i=this.clientOptions.middleware?.workspace;(i?.didChangeWatchedFile?i.didChangeWatchedFile(e,n):n(e)).catch(r=>{t.error("Notify file events failed.",r)})}async sendPendingFullTextDocumentChanges(e){return this._pendingChangeSemaphore.lock(async()=>{try{let t=this._didChangeTextDocumentFeature.getPendingDocumentChanges(this._pendingOpenNotifications);if(t.length===0)return;for(let n of t){let i=this.code2ProtocolConverter.asChangeTextDocumentParams(n);await e.sendNotification(_.DidChangeTextDocumentNotification.type,i),this._didChangeTextDocumentFeature.notificationSent(n,_.DidChangeTextDocumentNotification.type,i)}}catch(t){throw this.error("Sending pending changes failed",t,!1),t}})}triggerPendingChangeDelivery(){this._pendingChangeDelayer.trigger(async()=>{let e=this.activeConnection();if(e===void 0){this.triggerPendingChangeDelivery();return}await this.sendPendingFullTextDocumentChanges(e)}).catch(e=>this.error("Delivering pending changes failed",e,!1))}handleDiagnostics(e){if(!this._diagnostics)return;let t=e.uri;this._diagnosticQueueState.state==="busy"&&this._diagnosticQueueState.document===t&&this._diagnosticQueueState.tokenSource.cancel(),this._diagnosticQueue.set(e.uri,e.diagnostics),this.triggerDiagnosticQueue()}triggerDiagnosticQueue(){(0,_.RAL)().timer.setImmediate(()=>{this.workDiagnosticQueue()})}workDiagnosticQueue(){if(this._diagnosticQueueState.state==="busy")return;let e=this._diagnosticQueue.entries().next();if(e.done===!0)return;let[t,n]=e.value;this._diagnosticQueue.delete(t);let i=new J.CancellationTokenSource;this._diagnosticQueueState={state:"busy",document:t,tokenSource:i},this._p2c.asDiagnostics(n,i.token).then(r=>{if(!i.token.isCancellationRequested){let o=this._p2c.asUri(t),c=this.clientOptions.middleware;c.handleDiagnostics?c.handleDiagnostics(o,r,(d,l)=>this.setDiagnostics(d,l)):this.setDiagnostics(o,r)}}).finally(()=>{this._diagnosticQueueState={state:"idle"},this.triggerDiagnosticQueue()})}setDiagnostics(e,t){this._diagnostics&&this._diagnostics.set(e,t)}getLocale(){return J.env.language}async $start(){if(this.$state===N.StartFailed)throw new Error("Previous start failed. Can't restart server.");await this.start();let e=this.activeConnection();if(e===void 0)throw new Error("Starting server failed");return e}async createConnection(){let e=(i,r,o)=>{this.handleConnectionError(i,r,o).catch(c=>this.error("Handling connection error failed",c))},t=()=>{this.handleConnectionClosed().catch(i=>this.error("Handling connection close failed",i))},n=await this.createMessageTransports(this._clientOptions.stdioEncoding||"utf8");return this._connection=cp(n.reader,n.writer,e,t,this._clientOptions.connectionOptions),this._connection}async handleConnectionClosed(){if(this.$state===N.Stopped)return;try{this._connection!==void 0&&this._connection.dispose()}catch{}let e={action:yt.DoNotRestart};if(this.$state!==N.Stopping)try{e=await this._clientOptions.errorHandler.closed()}catch{}this._connection=void 0,e.action===yt.DoNotRestart?(this.error(e.message??"Connection to server got closed. Server will not be restarted.",void 0,e.handled===!0?!1:"force"),this.cleanUp("stop"),this.$state===N.Starting?this.$state=N.StartFailed:this.$state=N.Stopped,this._onStop=Promise.resolve(),this._onStart=void 0):e.action===yt.Restart&&(this.info(e.message??"Connection to server got closed. Server will restart.",!e.handled),this.cleanUp("restart"),this.$state=N.Initial,this._onStop=Promise.resolve(),this._onStart=void 0,this.start().catch(t=>this.error("Restarting server failed",t,"force")))}async handleConnectionError(e,t,n){let i=await this._clientOptions.errorHandler.error(e,t,n);i.action===qn.Shutdown?(this.error(i.message??`Client ${this._name}: connection to server is erroring.
|
|
8
|
+
`+t.data.toString():""}`}return e instanceof Error?je.string(e.stack)?e.stack:e.message:je.string(e)?e:e.toString()}debug(e,t,n=!0){this.logOutputMessage(_.MessageType.Debug,It.Debug,"Debug",e,t,n)}info(e,t,n=!0){this.logOutputMessage(_.MessageType.Info,It.Info,"Info",e,t,n)}warn(e,t,n=!0){this.logOutputMessage(_.MessageType.Warning,It.Warn,"Warn",e,t,n)}error(e,t,n=!0){this.logOutputMessage(_.MessageType.Error,It.Error,"Error",e,t,n)}logOutputMessage(e,t,n,i,r,a){this.outputChannel.appendLine(`[${n.padEnd(5)} - ${new Date().toLocaleTimeString()}] ${i}`),r!=null&&this.outputChannel.appendLine(this.data2String(r)),(a==="force"||a&&this._clientOptions.revealOutputChannelOn<=t)&&this.showNotificationMessage(e,i)}showNotificationMessage(e,t){t=t??"A request has failed. See the output for more information.",(e===_.MessageType.Error?J.window.showErrorMessage:e===_.MessageType.Warning?J.window.showWarningMessage:J.window.showInformationMessage)(t,"Go to output").then(i=>{i!==void 0&&this.outputChannel.show(!0)})}logTrace(e,t){this.traceOutputChannel.appendLine(`[Trace - ${new Date().toLocaleTimeString()}] ${e}`),t&&this.traceOutputChannel.appendLine(this.data2String(t))}logObjectTrace(e){e.isLSPMessage&&e.type?this.traceOutputChannel.append(`[LSP - ${new Date().toLocaleTimeString()}] `):this.traceOutputChannel.append(`[Trace - ${new Date().toLocaleTimeString()}] `),e&&this.traceOutputChannel.appendLine(`${JSON.stringify(e)}`)}needsStart(){return this.$state===K.Initial||this.$state===K.Stopping||this.$state===K.Stopped}needsStop(){return this.$state===K.Starting||this.$state===K.Running}activeConnection(){return this.$state===K.Running&&this._connection!==void 0?this._connection:void 0}isRunning(){return this.$state===K.Running}async start(){if(this._disposed==="disposing"||this._disposed==="disposed")throw new Error("Client got disposed and can't be restarted.");if(this.$state===K.Stopping)throw new Error("Client is currently stopping. Can only restart a full stopped client");if(this._onStart!==void 0)return this._onStart;let[e,t,n]=this.createOnStartPromise();this._onStart=e,this._diagnostics===void 0&&(this._diagnostics=this._clientOptions.diagnosticCollectionName?J.languages.createDiagnosticCollection(this._clientOptions.diagnosticCollectionName):J.languages.createDiagnosticCollection());for(let[i,r]of this._notificationHandlers)this._pendingNotificationHandlers.has(i)||this._pendingNotificationHandlers.set(i,r);for(let[i,r]of this._requestHandlers)this._pendingRequestHandlers.has(i)||this._pendingRequestHandlers.set(i,r);for(let[i,r]of this._progressHandlers)this._pendingProgressHandlers.has(i)||this._pendingProgressHandlers.set(i,r);this.$state=K.Starting;try{let i=await this.createConnection();i.onNotification(_.LogMessageNotification.type,r=>{switch(r.type){case _.MessageType.Error:this.error(r.message,void 0,!1);break;case _.MessageType.Warning:this.warn(r.message,void 0,!1);break;case _.MessageType.Info:this.info(r.message,void 0,!1);break;case _.MessageType.Debug:this.debug(r.message,void 0,!1);break;default:this.outputChannel.appendLine(r.message)}}),i.onNotification(_.ShowMessageNotification.type,r=>{switch(r.type){case _.MessageType.Error:J.window.showErrorMessage(r.message);break;case _.MessageType.Warning:J.window.showWarningMessage(r.message);break;case _.MessageType.Info:J.window.showInformationMessage(r.message);break;default:J.window.showInformationMessage(r.message)}}),i.onRequest(_.ShowMessageRequest.type,r=>{let a;switch(r.type){case _.MessageType.Error:a=J.window.showErrorMessage;break;case _.MessageType.Warning:a=J.window.showWarningMessage;break;case _.MessageType.Info:a=J.window.showInformationMessage;break;default:a=J.window.showInformationMessage}let c=r.actions||[];return a(r.message,...c)}),i.onNotification(_.TelemetryEventNotification.type,r=>{this._telemetryEmitter.fire(r)}),i.onRequest(_.ShowDocumentRequest.type,async r=>{let a=async u=>{let l=this.protocol2CodeConverter.asUri(u.uri);try{if(u.external===!0)return{success:await J.env.openExternal(l)};{let g={};return u.selection!==void 0&&(g.selection=this.protocol2CodeConverter.asRange(u.selection)),u.takeFocus===void 0||u.takeFocus===!1?g.preserveFocus=!0:u.takeFocus===!0&&(g.preserveFocus=!1),await J.window.showTextDocument(l,g),{success:!0}}}catch{return{success:!1}}},c=this._clientOptions.middleware.window?.showDocument;return c!==void 0?c(r,a):a(r)}),i.listen(),await this.initialize(i),t()}catch(i){this.$state=K.StartFailed,this.error(`${this._name} client: couldn't create connection to server.`,i,"force"),n(i)}return this._onStart}createOnStartPromise(){let e,t;return[new Promise((i,r)=>{e=i,t=r}),e,t]}async initialize(e){this.refreshTrace(e,!1);let t=this._clientOptions.initializationOptions,[n,i]=this._clientOptions.workspaceFolder!==void 0?[this._clientOptions.workspaceFolder.uri.fsPath,[{uri:this._c2p.asUri(this._clientOptions.workspaceFolder.uri),name:this._clientOptions.workspaceFolder.name}]]:[this._clientGetRootPath(),null],r={processId:null,clientInfo:{name:J.env.appName,version:J.version},locale:this.getLocale(),rootPath:n||null,rootUri:n?this._c2p.asUri(J.Uri.file(n)):null,capabilities:this.computeClientCapabilities(),initializationOptions:je.func(t)?t():t,trace:_.Trace.toString(this._trace),workspaceFolders:i};if(this.fillInitializeParams(r),this._clientOptions.progressOnInitialization){let a=od.generateUuid(),c=new El.ProgressPart(e,a);r.workDoneToken=a;try{let u=await this.doInitialize(e,r);return c.done(),u}catch(u){throw c.cancel(),u}}else return this.doInitialize(e,r)}async doInitialize(e,t){try{let n=await e.initialize(t);if(n.capabilities.positionEncoding!==void 0&&n.capabilities.positionEncoding!==_.PositionEncodingKind.UTF16)throw new Error(`Unsupported position encoding (${n.capabilities.positionEncoding}) received from server ${this.name}`);this._initializeResult=n,this.$state=K.Running;let i;je.number(n.capabilities.textDocumentSync)?n.capabilities.textDocumentSync===_.TextDocumentSyncKind.None?i={openClose:!1,change:_.TextDocumentSyncKind.None,save:void 0}:i={openClose:!0,change:n.capabilities.textDocumentSync,save:{includeText:!1}}:n.capabilities.textDocumentSync!==void 0&&n.capabilities.textDocumentSync!==null&&(i=n.capabilities.textDocumentSync),this._capabilities=Object.assign({},n.capabilities,{resolvedTextDocumentSync:i}),e.onNotification(_.PublishDiagnosticsNotification.type,r=>this.handleDiagnostics(r)),e.onRequest(_.RegistrationRequest.type,r=>this.handleRegistrationRequest(r)),e.onRequest("client/registerFeature",r=>this.handleRegistrationRequest(r)),e.onRequest(_.UnregistrationRequest.type,r=>this.handleUnregistrationRequest(r)),e.onRequest("client/unregisterFeature",r=>this.handleUnregistrationRequest(r)),e.onRequest(_.ApplyWorkspaceEditRequest.type,r=>this.handleApplyWorkspaceEdit(r));for(let[r,a]of this._pendingNotificationHandlers)this._notificationDisposables.set(r,e.onNotification(r,a));this._pendingNotificationHandlers.clear();for(let[r,a]of this._pendingRequestHandlers)this._requestDisposables.set(r,e.onRequest(r,a));this._pendingRequestHandlers.clear();for(let[r,a]of this._pendingProgressHandlers)this._progressDisposables.set(r,e.onProgress(a.type,r,a.handler));return this._pendingProgressHandlers.clear(),await e.sendNotification(_.InitializedNotification.type,{}),this.hookFileEvents(e),this.hookConfigurationChanged(e),this.initializeFeatures(e),n}catch(n){throw this._clientOptions.initializationFailedHandler?this._clientOptions.initializationFailedHandler(n)?this.initialize(e):this.stop():n instanceof _.ResponseError&&n.data&&n.data.retry?J.window.showErrorMessage(n.message,{title:"Retry",id:"retry"}).then(i=>{i&&i.id==="retry"?this.initialize(e):this.stop()}):(n&&n.message&&J.window.showErrorMessage(n.message),this.error("Server initialization failed.",n),this.stop()),n}}_clientGetRootPath(){let e=J.workspace.workspaceFolders;if(!e||e.length===0)return;let t=e[0];if(t.uri.scheme==="file")return t.uri.fsPath}stop(e=2e3){return this.shutdown("stop",e)}dispose(e=2e3){try{return this._disposed="disposing",this.stop(e)}finally{this._disposed="disposed"}}async shutdown(e,t){if(this.$state===K.Stopped||this.$state===K.Initial)return;if(this.$state===K.Stopping){if(this._onStop!==void 0)return this._onStop;throw new Error("Client is stopping but no stop promise available.")}let n=this.activeConnection();if(n===void 0||this.$state!==K.Running)throw new Error(`Client is not running and can't be stopped. It's current state is: ${this.$state}`);this._initializeResult=void 0,this.$state=K.Stopping,this.cleanUp(e);let i=new Promise(a=>{(0,_.RAL)().timer.setTimeout(a,t)}),r=(async a=>(await a.shutdown(),await a.exit(),a))(n);return this._onStop=Promise.race([i,r]).then(a=>{if(a!==void 0)a.end(),a.dispose();else throw this.error("Stopping server timed out",void 0,!1),new Error("Stopping the server timed out")},a=>{throw this.error("Stopping server failed",a,!1),a}).finally(()=>{this.$state=K.Stopped,e==="stop"&&this.cleanUpChannel(),this._onStart=void 0,this._onStop=void 0,this._connection=void 0,this._ignoredRegistrations.clear()})}cleanUp(e){this._fileEvents=[],this._fileEventDelayer.cancel();let t=this._listeners.splice(0,this._listeners.length);for(let n of t)n.dispose();this._syncedDocuments&&this._syncedDocuments.clear();for(let n of Array.from(this._features.entries()).map(i=>i[1]).reverse())n.clear();e==="stop"&&this._diagnostics!==void 0&&(this._diagnostics.dispose(),this._diagnostics=void 0),this._idleInterval!==void 0&&(this._idleInterval.dispose(),this._idleInterval=void 0)}cleanUpChannel(){this._outputChannel!==void 0&&this._disposeOutputChannel&&(this._outputChannel.dispose(),this._outputChannel=void 0)}notifyFileEvent(e){let t=this;async function n(r){return t._fileEvents.push(r),t._fileEventDelayer.trigger(async()=>{await t.sendNotification(_.DidChangeWatchedFilesNotification.type,{changes:t._fileEvents}),t._fileEvents=[]})}let i=this.clientOptions.middleware?.workspace;(i?.didChangeWatchedFile?i.didChangeWatchedFile(e,n):n(e)).catch(r=>{t.error("Notify file events failed.",r)})}async sendPendingFullTextDocumentChanges(e){return this._pendingChangeSemaphore.lock(async()=>{try{let t=this._didChangeTextDocumentFeature.getPendingDocumentChanges(this._pendingOpenNotifications);if(t.length===0)return;for(let n of t){let i=this.code2ProtocolConverter.asChangeTextDocumentParams(n);await e.sendNotification(_.DidChangeTextDocumentNotification.type,i),this._didChangeTextDocumentFeature.notificationSent(n,_.DidChangeTextDocumentNotification.type,i)}}catch(t){throw this.error("Sending pending changes failed",t,!1),t}})}triggerPendingChangeDelivery(){this._pendingChangeDelayer.trigger(async()=>{let e=this.activeConnection();if(e===void 0){this.triggerPendingChangeDelivery();return}await this.sendPendingFullTextDocumentChanges(e)}).catch(e=>this.error("Delivering pending changes failed",e,!1))}handleDiagnostics(e){if(!this._diagnostics)return;let t=e.uri;this._diagnosticQueueState.state==="busy"&&this._diagnosticQueueState.document===t&&this._diagnosticQueueState.tokenSource.cancel(),this._diagnosticQueue.set(e.uri,e.diagnostics),this.triggerDiagnosticQueue()}triggerDiagnosticQueue(){(0,_.RAL)().timer.setImmediate(()=>{this.workDiagnosticQueue()})}workDiagnosticQueue(){if(this._diagnosticQueueState.state==="busy")return;let e=this._diagnosticQueue.entries().next();if(e.done===!0)return;let[t,n]=e.value;this._diagnosticQueue.delete(t);let i=new J.CancellationTokenSource;this._diagnosticQueueState={state:"busy",document:t,tokenSource:i},this._p2c.asDiagnostics(n,i.token).then(r=>{if(!i.token.isCancellationRequested){let a=this._p2c.asUri(t),c=this.clientOptions.middleware;c.handleDiagnostics?c.handleDiagnostics(a,r,(u,l)=>this.setDiagnostics(u,l)):this.setDiagnostics(a,r)}}).finally(()=>{this._diagnosticQueueState={state:"idle"},this.triggerDiagnosticQueue()})}setDiagnostics(e,t){this._diagnostics&&this._diagnostics.set(e,t)}getLocale(){return J.env.language}async $start(){if(this.$state===K.StartFailed)throw new Error("Previous start failed. Can't restart server.");await this.start();let e=this.activeConnection();if(e===void 0)throw new Error("Starting server failed");return e}async createConnection(){let e=(i,r,a)=>{this.handleConnectionError(i,r,a).catch(c=>this.error("Handling connection error failed",c))},t=()=>{this.handleConnectionClosed().catch(i=>this.error("Handling connection close failed",i))},n=await this.createMessageTransports(this._clientOptions.stdioEncoding||"utf8");return this._connection=up(n.reader,n.writer,e,t,this._clientOptions.connectionOptions),this._connection}async handleConnectionClosed(){if(this.$state===K.Stopped)return;try{this._connection!==void 0&&this._connection.dispose()}catch{}let e={action:yt.DoNotRestart};if(this.$state!==K.Stopping)try{e=await this._clientOptions.errorHandler.closed()}catch{}this._connection=void 0,e.action===yt.DoNotRestart?(this.error(e.message??"Connection to server got closed. Server will not be restarted.",void 0,e.handled===!0?!1:"force"),this.cleanUp("stop"),this.$state===K.Starting?this.$state=K.StartFailed:this.$state=K.Stopped,this._onStop=Promise.resolve(),this._onStart=void 0):e.action===yt.Restart&&(this.info(e.message??"Connection to server got closed. Server will restart.",!e.handled),this.cleanUp("restart"),this.$state=K.Initial,this._onStop=Promise.resolve(),this._onStart=void 0,this.start().catch(t=>this.error("Restarting server failed",t,"force")))}async handleConnectionError(e,t,n){let i=await this._clientOptions.errorHandler.error(e,t,n);i.action===qn.Shutdown?(this.error(i.message??`Client ${this._name}: connection to server is erroring.
|
|
9
9
|
${e.message}
|
|
10
10
|
Shutting down server.`,void 0,i.handled===!0?!1:"force"),this.stop().catch(r=>{this.error("Stopping server failed",r,!1)})):this.error(i.message??`Client ${this._name}: connection to server is erroring.
|
|
11
|
-
${e.message}`,void 0,i.handled===!0?!1:"force")}hookConfigurationChanged(e){this._listeners.push(J.workspace.onDidChangeConfiguration(()=>{this.refreshTrace(e,!0)}))}refreshTrace(e,t=!1){let n=J.workspace.getConfiguration(this._id),i=_.Trace.Off,r=_.TraceFormat.Text;if(n){let o=n.get("trace.server","off");typeof o=="string"?i=_.Trace.fromString(o):(i=_.Trace.fromString(n.get("trace.server.verbosity","off")),r=_.TraceFormat.fromString(n.get("trace.server.format","text")))}this._trace=i,this._traceFormat=r,e.trace(this._trace,this._tracer,{sendNotification:t,traceFormat:this._traceFormat}).catch(o=>{this.error("Updating trace failed with error",o,!1)})}hookFileEvents(e){let t=this._clientOptions.synchronize.fileEvents;if(!t)return;let n;je.array(t)?n=t:n=[t],n&&this._dynamicFeatures.get(_.DidChangeWatchedFilesNotification.type.method).registerRaw(rd.generateUuid(),n)}registerFeatures(e){for(let t of e)this.registerFeature(t)}registerFeature(e){if(this._features.push(e),We.DynamicFeature.is(e)){let t=e.registrationType;this._dynamicFeatures.set(t.method,e)}}getFeature(e){return this._dynamicFeatures.get(e)}hasDedicatedTextSynchronizationFeature(e){let t=this.getFeature(_.NotebookDocumentSyncRegistrationType.method);return t===void 0||!(t instanceof sd.NotebookDocumentSyncFeature)?!1:t.handles(e)}registerBuiltinFeatures(){let e=new Map;this.registerFeature(new od.ConfigurationFeature(this)),this.registerFeature(new Yt.DidOpenTextDocumentFeature(this,this._syncedDocuments)),this._didChangeTextDocumentFeature=new Yt.DidChangeTextDocumentFeature(this,e),this._didChangeTextDocumentFeature.onPendingChangeAdded(()=>{this.triggerPendingChangeDelivery()}),this.registerFeature(this._didChangeTextDocumentFeature),this.registerFeature(new Yt.WillSaveFeature(this)),this.registerFeature(new Yt.WillSaveWaitUntilFeature(this)),this.registerFeature(new Yt.DidSaveTextDocumentFeature(this)),this.registerFeature(new Yt.DidCloseTextDocumentFeature(this,this._syncedDocuments,e)),this.registerFeature(new Vl.FileSystemWatcherFeature(this,t=>this.notifyFileEvent(t))),this.registerFeature(new El.CompletionItemFeature(this)),this.registerFeature(new Ml.HoverFeature(this)),this.registerFeature(new Al.SignatureHelpFeature(this)),this.registerFeature(new Ol.DefinitionFeature(this)),this.registerFeature(new Kl.ReferencesFeature(this)),this.registerFeature(new Ll.DocumentHighlightFeature(this)),this.registerFeature(new Ul.DocumentSymbolFeature(this)),this.registerFeature(new Nl.WorkspaceSymbolFeature(this)),this.registerFeature(new Hl.CodeActionFeature(this)),this.registerFeature(new $l.CodeLensFeature(this)),this.registerFeature(new sa.DocumentFormattingFeature(this)),this.registerFeature(new sa.DocumentRangeFormattingFeature(this)),this.registerFeature(new sa.DocumentOnTypeFormattingFeature(this)),this.registerFeature(new Wl.RenameFeature(this)),this.registerFeature(new jl.DocumentLinkFeature(this)),this.registerFeature(new zl.ExecuteCommandFeature(this)),this.registerFeature(new od.SyncConfigurationFeature(this)),this.registerFeature(new Ql.TypeDefinitionFeature(this)),this.registerFeature(new Jl.ImplementationFeature(this)),this.registerFeature(new Bl.ColorProviderFeature(this)),this.clientOptions.workspaceFolder===void 0&&this.registerFeature(new Gl.WorkspaceFoldersFeature(this)),this.registerFeature(new Yl.FoldingRangeFeature(this)),this.registerFeature(new Xl.DeclarationFeature(this)),this.registerFeature(new Zl.SelectionRangeFeature(this)),this.registerFeature(new ep.ProgressFeature(this)),this.registerFeature(new tp.CallHierarchyFeature(this)),this.registerFeature(new np.SemanticTokensFeature(this)),this.registerFeature(new ip.LinkedEditingFeature(this)),this.registerFeature(new Xt.DidCreateFilesFeature(this)),this.registerFeature(new Xt.DidRenameFilesFeature(this)),this.registerFeature(new Xt.DidDeleteFilesFeature(this)),this.registerFeature(new Xt.WillCreateFilesFeature(this)),this.registerFeature(new Xt.WillRenameFilesFeature(this)),this.registerFeature(new Xt.WillDeleteFilesFeature(this)),this.registerFeature(new rp.TypeHierarchyFeature(this)),this.registerFeature(new sp.InlineValueFeature(this)),this.registerFeature(new op.InlayHintsFeature(this)),this.registerFeature(new Il.DiagnosticFeature(this)),this.registerFeature(new sd.NotebookDocumentSyncFeature(this))}registerProposedFeatures(){this.registerFeatures(da.createAll(this))}fillInitializeParams(e){for(let t of this._features)je.func(t.fillInitializeParams)&&t.fillInitializeParams(e)}computeClientCapabilities(){let e={};(0,We.ensure)(e,"workspace").applyEdit=!0;let t=(0,We.ensure)((0,We.ensure)(e,"workspace"),"workspaceEdit");t.documentChanges=!0,t.resourceOperations=[_.ResourceOperationKind.Create,_.ResourceOperationKind.Rename,_.ResourceOperationKind.Delete],t.failureHandling=_.FailureHandlingKind.TextOnlyTransactional,t.normalizesLineEndings=!0,t.changeAnnotationSupport={groupsOnLabel:!0};let n=(0,We.ensure)((0,We.ensure)(e,"textDocument"),"publishDiagnostics");n.relatedInformation=!0,n.versionSupport=!1,n.tagSupport={valueSet:[_.DiagnosticTag.Unnecessary,_.DiagnosticTag.Deprecated]},n.codeDescriptionSupport=!0,n.dataSupport=!0;let i=(0,We.ensure)(e,"window"),r=(0,We.ensure)(i,"showMessage");r.messageActionItem={additionalPropertiesSupport:!0};let o=(0,We.ensure)(i,"showDocument");o.support=!0;let c=(0,We.ensure)(e,"general");c.staleRequestSupport={cancel:!0,retryOnContentModified:Array.from(s.RequestsToCancelOnContentModified)},c.regularExpressions={engine:"ECMAScript",version:"ES2020"},c.markdown={parser:"marked",version:"1.1.0"},c.positionEncodings=["utf-16"],this._clientOptions.markdown.supportHtml&&(c.markdown.allowedTags=["ul","li","p","code","blockquote","ol","h1","h2","h3","h4","h5","h6","hr","em","pre","table","thead","tbody","tr","th","td","div","del","a","strong","br","img","span"]);for(let d of this._features)d.fillClientCapabilities(e);return e}initializeFeatures(e){let t=this._clientOptions.documentSelector;for(let n of this._features)je.func(n.preInitialize)&&n.preInitialize(this._capabilities,t);for(let n of this._features)n.initialize(this._capabilities,t)}async handleRegistrationRequest(e){let t=this.clientOptions.middleware?.handleRegisterCapability;return t?t(e,n=>this.doRegisterCapability(n)):this.doRegisterCapability(e)}async doRegisterCapability(e){if(!this.isRunning()){for(let t of e.registrations)this._ignoredRegistrations.add(t.id);return}for(let t of e.registrations){let n=this._dynamicFeatures.get(t.method);if(n===void 0)return Promise.reject(new Error(`No feature implementation for ${t.method} found. Registration failed.`));let i=t.registerOptions??{};i.documentSelector=i.documentSelector??this._clientOptions.documentSelector;let r={id:t.id,registerOptions:i};try{n.register(r)}catch(o){return Promise.reject(o)}}}async handleUnregistrationRequest(e){let t=this.clientOptions.middleware?.handleUnregisterCapability;return t?t(e,n=>this.doUnregisterCapability(n)):this.doUnregisterCapability(e)}async doUnregisterCapability(e){for(let t of e.unregisterations){if(this._ignoredRegistrations.has(t.id))continue;let n=this._dynamicFeatures.get(t.method);if(!n)return Promise.reject(new Error(`No feature implementation for ${t.method} found. Unregistration failed.`));n.unregister(t.id)}}async handleApplyWorkspaceEdit(e){let t=e.edit,n=await this.workspaceEditLock.lock(()=>this._p2c.asWorkspaceEdit(t)),i=new Map;J.workspace.textDocuments.forEach(o=>i.set(o.uri.toString(),o));let r=!1;if(t.documentChanges){for(let o of t.documentChanges)if(_.TextDocumentEdit.is(o)&&o.textDocument.version&&o.textDocument.version>=0){let c=this._p2c.asUri(o.textDocument.uri).toString(),d=i.get(c);if(d&&d.version!==o.textDocument.version){r=!0;break}}}return r?Promise.resolve({applied:!1}):je.asPromise(J.workspace.applyEdit(n).then(o=>({applied:o})))}handleFailedRequest(e,t,n,i,r=!0){if(n instanceof _.ResponseError){if(n.code===_.ErrorCodes.PendingResponseRejected||n.code===_.ErrorCodes.ConnectionInactive)return i;if(n.code===_.LSPErrorCodes.RequestCancelled||n.code===_.LSPErrorCodes.ServerCancelled){if(t!==void 0&&t.isCancellationRequested)return i;throw n.data!==void 0?new We.LSPCancellationError(n.data):new J.CancellationError}else if(n.code===_.LSPErrorCodes.ContentModified){if(s.RequestsToCancelOnContentModified.has(e.method)||s.CancellableResolveCalls.has(e.method))throw new J.CancellationError;return i}}throw this.error(`Request ${e.method} failed.`,n,r),n}};me.BaseLanguageClient=In;In.RequestsToCancelOnContentModified=new Set([_.SemanticTokensRequest.method,_.SemanticTokensRangeRequest.method,_.SemanticTokensDeltaRequest.method]);In.CancellableResolveCalls=new Set([_.CompletionResolveRequest.method,_.CodeLensResolveRequest.method,_.CodeActionResolveRequest.method,_.InlayHintResolveRequest.method,_.DocumentLinkResolveRequest.method,_.WorkspaceSymbolResolveRequest.method]);var ca=class{error(e){(0,_.RAL)().console.error(e)}warn(e){(0,_.RAL)().console.warn(e)}info(e){(0,_.RAL)().console.info(e)}log(e){(0,_.RAL)().console.log(e)}};function cp(s,e,t,n,i){let r=new ca,o=(0,_.createProtocolConnection)(s,e,r,i);return o.onError(d=>{t(d[0],d[1],d[2])}),o.onClose(n),{listen:()=>o.listen(),sendRequest:o.sendRequest,onRequest:o.onRequest,hasPendingResponse:o.hasPendingResponse,sendNotification:o.sendNotification,onNotification:o.onNotification,onProgress:o.onProgress,sendProgress:o.sendProgress,trace:(d,l,p)=>{let g={sendNotification:!1,traceFormat:_.TraceFormat.Text};return p===void 0?o.trace(d,l,g):(je.boolean(p),o.trace(d,l,p))},initialize:d=>o.sendRequest(_.InitializeRequest.type,d),shutdown:()=>o.sendRequest(_.ShutdownRequest.type,void 0),exit:()=>o.sendNotification(_.ExitNotification.type),end:()=>o.end(),dispose:()=>o.dispose()}}var da;(function(s){function e(t){return[new ap.InlineCompletionItemFeature(t)]}s.createAll=e})(da||(me.ProposedFeatures=da={}))});var ud=F(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.terminate=void 0;var dd=I("child_process"),dp=I("path"),up=process.platform==="win32",lp=process.platform==="darwin",pp=process.platform==="linux";function fp(s,e){if(up)try{let i={stdio:["pipe","pipe","ignore"]};return e&&(i.cwd=e),dd.execFileSync("taskkill",["/T","/F","/PID",s.pid.toString()],i),!0}catch{return!1}else if(pp||lp)try{var t=(0,dp.join)(__dirname,"terminateProcess.sh"),n=dd.spawnSync(t,[s.pid.toString()]);return!n.error}catch{return!1}else return s.kill("SIGKILL"),!0}ir.terminate=fp});var pd=F(Fe=>{"use strict";var hp=Fe&&Fe.__createBinding||(Object.create?function(s,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,n,i)}:function(s,e,t,n){n===void 0&&(n=t),s[n]=e[t]}),la=Fe&&Fe.__exportStar||function(s,e){for(var t in s)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&hp(e,s,t)};Object.defineProperty(Fe,"__esModule",{value:!0});Fe.DiagnosticPullMode=Fe.vsdiag=void 0;la(L(),Fe);la(W(),Fe);var ld=Rs();Object.defineProperty(Fe,"vsdiag",{enumerable:!0,get:function(){return ld.vsdiag}});Object.defineProperty(Fe,"DiagnosticPullMode",{enumerable:!0,get:function(){return ld.DiagnosticPullMode}});la(ua(),Fe)});var md=F(Te=>{"use strict";var gp=Te&&Te.__createBinding||(Object.create?function(s,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,n,i)}:function(s,e,t,n){n===void 0&&(n=t),s[n]=e[t]}),gd=Te&&Te.__exportStar||function(s,e){for(var t in s)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&gp(e,s,t)};Object.defineProperty(Te,"__esModule",{value:!0});Te.SettingMonitor=Te.LanguageClient=Te.TransportKind=void 0;var st=I("child_process"),pa=I("fs"),fa=I("path"),wt=I("vscode"),ne=Ee(),fd=ua(),mp=ud(),re=Fa(),vp=Od(),yp=Ad();gd(Fa(),Te);gd(pd(),Te);var hd="^1.82.0",se;(function(s){s[s.stdio=0]="stdio",s[s.ipc=1]="ipc",s[s.pipe=2]="pipe",s[s.socket=3]="socket"})(se||(Te.TransportKind=se={}));var Ct;(function(s){function e(t){let n=t;return n&&n.kind===se.socket&&ne.number(n.port)}s.isSocket=e})(Ct||(Ct={}));var ha;(function(s){function e(t){return ne.string(t.command)}s.is=e})(ha||(ha={}));var ga;(function(s){function e(t){return ne.string(t.module)}s.is=e})(ga||(ga={}));var ma;(function(s){function e(t){let n=t;return n&&n.writer!==void 0&&n.reader!==void 0}s.is=e})(ma||(ma={}));var va;(function(s){function e(t){let n=t;return n&&n.process!==void 0&&typeof n.detached=="boolean"}s.is=e})(va||(va={}));var ya=class extends fd.BaseLanguageClient{constructor(e,t,n,i,r){let o,c,d,l,p;ne.string(t)?(o=e,c=t,d=n,l=i,p=!!r):(o=e.toLowerCase(),c=e,d=t,l=n,p=i),p===void 0&&(p=!1),super(o,c,l),this._serverOptions=d,this._forceDebug=p,this._isInDebugMode=p;try{this.checkVersion()}catch(g){throw ne.string(g.message)&&this.outputChannel.appendLine(g.message),g}}checkVersion(){let e=vp(wt.version);if(!e)throw new Error(`No valid VS Code version detected. Version string is: ${wt.version}`);if(e.prerelease&&e.prerelease.length>0&&(e.prerelease=[]),!yp(e,hd))throw new Error(`The language client requires VS Code version ${hd} but received version ${wt.version}`)}get isInDebugMode(){return this._isInDebugMode}async restart(){await this.stop(),this.isInDebugMode?(await new Promise(e=>setTimeout(e,1e3)),await this.start()):await this.start()}stop(e=2e3){return super.stop(e).finally(()=>{if(this._serverProcess){let t=this._serverProcess;this._serverProcess=void 0,(this._isDetached===void 0||!this._isDetached)&&this.checkProcessDied(t),this._isDetached=void 0}})}checkProcessDied(e){!e||e.pid===void 0||setTimeout(()=>{try{e.pid!==void 0&&(process.kill(e.pid,0),(0,mp.terminate)(e))}catch{}},2e3)}handleConnectionClosed(){return this._serverProcess=void 0,super.handleConnectionClosed()}fillInitializeParams(e){super.fillInitializeParams(e),e.processId===null&&(e.processId=process.pid)}createMessageTransports(e){function t(p,g){if(!p&&!g)return;let h=Object.create(null);return Object.keys(process.env).forEach(v=>h[v]=process.env[v]),g&&(h.ELECTRON_RUN_AS_NODE="1",h.ELECTRON_NO_ASAR="1"),p&&Object.keys(p).forEach(v=>h[v]=p[v]),h}let n=["--debug=","--debug-brk=","--inspect=","--inspect-brk="],i=["--debug","--debug-brk","--inspect","--inspect-brk"];function r(){let p=process.execArgv;return p?p.some(g=>n.some(h=>g.startsWith(h))||i.some(h=>g===h)):!1}function o(p){if(p.stdin===null||p.stdout===null||p.stderr===null)throw new Error("Process created without stdio streams")}let c=this._serverOptions;if(ne.func(c))return c().then(p=>{if(fd.MessageTransports.is(p))return this._isDetached=!!p.detached,p;if(ma.is(p))return this._isDetached=!!p.detached,{reader:new re.StreamMessageReader(p.reader),writer:new re.StreamMessageWriter(p.writer)};{let g;return va.is(p)?(g=p.process,this._isDetached=p.detached):(g=p,this._isDetached=!1),g.stderr.on("data",h=>this.outputChannel.append(ne.string(h)?h:h.toString(e))),{reader:new re.StreamMessageReader(g.stdout),writer:new re.StreamMessageWriter(g.stdin)}}});let d,l=c;return l.run||l.debug?this._forceDebug||r()?(d=l.debug,this._isInDebugMode=!0):(d=l.run,this._isInDebugMode=!1):d=c,this._getServerWorkingDir(d.options).then(p=>{if(ga.is(d)&&d.module){let g=d,h=g.transport||se.stdio;if(g.runtime){let v=[],f=g.options??Object.create(null);f.execArgv&&f.execArgv.forEach(T=>v.push(T)),v.push(g.module),g.args&&g.args.forEach(T=>v.push(T));let y=Object.create(null);y.cwd=p,y.env=t(f.env,!1);let w=this._getRuntimePath(g.runtime,p),b;if(h===se.ipc?(y.stdio=[null,null,null,"ipc"],v.push("--node-ipc")):h===se.stdio?v.push("--stdio"):h===se.pipe?(b=(0,re.generateRandomPipeName)(),v.push(`--pipe=${b}`)):Ct.isSocket(h)&&v.push(`--socket=${h.port}`),v.push(`--clientProcessId=${process.pid.toString()}`),h===se.ipc||h===se.stdio){let T=st.spawn(w,v,y);return!T||!T.pid?Zt(T,`Launching server using runtime ${w} failed.`):(this._serverProcess=T,T.stderr.on("data",P=>this.outputChannel.append(ne.string(P)?P:P.toString(e))),h===se.ipc?(T.stdout.on("data",P=>this.outputChannel.append(ne.string(P)?P:P.toString(e))),Promise.resolve({reader:new re.IPCMessageReader(T),writer:new re.IPCMessageWriter(T)})):Promise.resolve({reader:new re.StreamMessageReader(T.stdout),writer:new re.StreamMessageWriter(T.stdin)}))}else{if(h===se.pipe)return(0,re.createClientPipeTransport)(b).then(T=>{let P=st.spawn(w,v,y);return!P||!P.pid?Zt(P,`Launching server using runtime ${w} failed.`):(this._serverProcess=P,P.stderr.on("data",q=>this.outputChannel.append(ne.string(q)?q:q.toString(e))),P.stdout.on("data",q=>this.outputChannel.append(ne.string(q)?q:q.toString(e))),T.onConnected().then(q=>({reader:q[0],writer:q[1]})))});if(Ct.isSocket(h))return(0,re.createClientSocketTransport)(h.port).then(T=>{let P=st.spawn(w,v,y);return!P||!P.pid?Zt(P,`Launching server using runtime ${w} failed.`):(this._serverProcess=P,P.stderr.on("data",q=>this.outputChannel.append(ne.string(q)?q:q.toString(e))),P.stdout.on("data",q=>this.outputChannel.append(ne.string(q)?q:q.toString(e))),T.onConnected().then(q=>({reader:q[0],writer:q[1]})))})}}else{let v;return new Promise((f,y)=>{let w=(g.args&&g.args.slice())??[];h===se.ipc?w.push("--node-ipc"):h===se.stdio?w.push("--stdio"):h===se.pipe?(v=(0,re.generateRandomPipeName)(),w.push(`--pipe=${v}`)):Ct.isSocket(h)&&w.push(`--socket=${h.port}`),w.push(`--clientProcessId=${process.pid.toString()}`);let b=g.options??Object.create(null);if(b.env=t(b.env,!0),b.execArgv=b.execArgv||[],b.cwd=p,b.silent=!0,h===se.ipc||h===se.stdio){let T=st.fork(g.module,w||[],b);o(T),this._serverProcess=T,T.stderr.on("data",P=>this.outputChannel.append(ne.string(P)?P:P.toString(e))),h===se.ipc?(T.stdout.on("data",P=>this.outputChannel.append(ne.string(P)?P:P.toString(e))),f({reader:new re.IPCMessageReader(this._serverProcess),writer:new re.IPCMessageWriter(this._serverProcess)})):f({reader:new re.StreamMessageReader(T.stdout),writer:new re.StreamMessageWriter(T.stdin)})}else h===se.pipe?(0,re.createClientPipeTransport)(v).then(T=>{let P=st.fork(g.module,w||[],b);o(P),this._serverProcess=P,P.stderr.on("data",q=>this.outputChannel.append(ne.string(q)?q:q.toString(e))),P.stdout.on("data",q=>this.outputChannel.append(ne.string(q)?q:q.toString(e))),T.onConnected().then(q=>{f({reader:q[0],writer:q[1]})},y)},y):Ct.isSocket(h)&&(0,re.createClientSocketTransport)(h.port).then(T=>{let P=st.fork(g.module,w||[],b);o(P),this._serverProcess=P,P.stderr.on("data",q=>this.outputChannel.append(ne.string(q)?q:q.toString(e))),P.stdout.on("data",q=>this.outputChannel.append(ne.string(q)?q:q.toString(e))),T.onConnected().then(q=>{f({reader:q[0],writer:q[1]})},y)},y)})}}else if(ha.is(d)&&d.command){let g=d,h=d.args!==void 0?d.args.slice(0):[],v,f=d.transport;if(f===se.stdio)h.push("--stdio");else if(f===se.pipe)v=(0,re.generateRandomPipeName)(),h.push(`--pipe=${v}`);else if(Ct.isSocket(f))h.push(`--socket=${f.port}`);else if(f===se.ipc)throw new Error("Transport kind ipc is not support for command executable");let y=Object.assign({},g.options);if(y.cwd=y.cwd||p,f===void 0||f===se.stdio){let w=st.spawn(g.command,h,y);return!w||!w.pid?Zt(w,`Launching server using command ${g.command} failed.`):(w.stderr.on("data",b=>this.outputChannel.append(ne.string(b)?b:b.toString(e))),this._serverProcess=w,this._isDetached=!!y.detached,Promise.resolve({reader:new re.StreamMessageReader(w.stdout),writer:new re.StreamMessageWriter(w.stdin)}))}else{if(f===se.pipe)return(0,re.createClientPipeTransport)(v).then(w=>{let b=st.spawn(g.command,h,y);return!b||!b.pid?Zt(b,`Launching server using command ${g.command} failed.`):(this._serverProcess=b,this._isDetached=!!y.detached,b.stderr.on("data",T=>this.outputChannel.append(ne.string(T)?T:T.toString(e))),b.stdout.on("data",T=>this.outputChannel.append(ne.string(T)?T:T.toString(e))),w.onConnected().then(T=>({reader:T[0],writer:T[1]})))});if(Ct.isSocket(f))return(0,re.createClientSocketTransport)(f.port).then(w=>{let b=st.spawn(g.command,h,y);return!b||!b.pid?Zt(b,`Launching server using command ${g.command} failed.`):(this._serverProcess=b,this._isDetached=!!y.detached,b.stderr.on("data",T=>this.outputChannel.append(ne.string(T)?T:T.toString(e))),b.stdout.on("data",T=>this.outputChannel.append(ne.string(T)?T:T.toString(e))),w.onConnected().then(T=>({reader:T[0],writer:T[1]})))})}}return Promise.reject(new Error("Unsupported server configuration "+JSON.stringify(c,null,4)))}).finally(()=>{this._serverProcess!==void 0&&this._serverProcess.on("exit",(p,g)=>{p!==null&&this.error(`Server process exited with code ${p}.`,void 0,!1),g!==null&&this.error(`Server process exited with signal ${g}.`,void 0,!1)})})}_getRuntimePath(e,t){if(fa.isAbsolute(e))return e;let n=this._mainGetRootPath();if(n!==void 0){let i=fa.join(n,e);if(pa.existsSync(i))return i}if(t!==void 0){let i=fa.join(t,e);if(pa.existsSync(i))return i}return e}_mainGetRootPath(){let e=wt.workspace.workspaceFolders;if(!e||e.length===0)return;let t=e[0];if(t.uri.scheme==="file")return t.uri.fsPath}_getServerWorkingDir(e){let t=e&&e.cwd;return t||(t=this.clientOptions.workspaceFolder?this.clientOptions.workspaceFolder.uri.fsPath:this._mainGetRootPath()),t?new Promise(n=>{pa.lstat(t,(i,r)=>{n(!i&&r.isDirectory()?t:void 0)})}):Promise.resolve(void 0)}};Te.LanguageClient=ya;var Ca=class{constructor(e,t){this._client=e,this._setting=t,this._listeners=[]}start(){return wt.workspace.onDidChangeConfiguration(this.onDidChangeConfiguration,this,this._listeners),this.onDidChangeConfiguration(),new wt.Disposable(()=>{this._client.needsStop()&&this._client.stop()})}onDidChangeConfiguration(){let e=this._setting.indexOf("."),t=e>=0?this._setting.substr(0,e):this._setting,n=e>=0?this._setting.substr(e+1):void 0,i=n?wt.workspace.getConfiguration(t).get(n,!1):wt.workspace.getConfiguration(t);i&&this._client.needsStart()?this._client.start().catch(r=>this._client.error("Start failed after configuration change",r,"force")):!i&&this._client.needsStop()&&this._client.stop().catch(r=>this._client.error("Stop failed after configuration change",r,"force"))}};Te.SettingMonitor=Ca;function Zt(s,e){return s===null?Promise.reject(e):new Promise((t,n)=>{s.on("error",i=>{n(`${e} ${i}`)}),setImmediate(()=>n(e))})}});var yd=F((Vf,vd)=>{"use strict";vd.exports=md()});import*as ue from"vscode";var qr=br(Ld(),1);import*as S from"vscode";import*as Nt from"path";import{fork as $d}from"child_process";import*as xr from"vscode";var Xn=class{constructor(e){this.secrets=e}async ReadyAPIKey(e){if(process.env.FACTORIO_UPLOAD_API_KEY)return{from:"env"};try{let t=await this.secrets.get("factorio-uploadmods");if(t&&(e&&(e=await xr.window.showInformationMessage("Key already present. Replace it?",{modal:!0},"Yes","No")==="Yes"),!e))return{from:"secrets",key:t};if(t=await xr.window.showInputBox({prompt:"Mod Portal API Key:",ignoreFocusOut:!0,password:!0}),t)return t=t.trim(),await this.secrets.store("factorio-uploadmods",t),{from:"new",key:t}}catch{}return!1}async ClearApiKey(){return this.secrets.delete("factorio-uploadmods")}};var Ua=br(La(),1);import{platform as Wd,tmpdir as jd}from"os";var ni;function zd(s){if(ni)switch(Wd()){case"win32":return`${s};${S.Uri.joinPath(ni,"bin").fsPath}`;default:return`${s}:${S.Uri.joinPath(ni,"bin").fsPath}`}return s}function Na(s){if(S.workspace.workspaceFolders){let e=new Xn(s.secrets);s.subscriptions.push(S.commands.registerCommand("factorio.clearApiKey",async()=>{await e.ClearApiKey()})),s.subscriptions.push(S.commands.registerCommand("factorio.setApiKey",async()=>{await e.ReadyAPIKey(!0)}));let t=new Er(s,e);s.subscriptions.push(t);let n=S.window.createTreeView("factoriomods",{treeDataProvider:t});s.subscriptions.push(n),ni=s.extensionUri}}var Ir=class{constructor(e,t){this.context=e;this.modPackages=t}provideTasks(e){let t=[],n=Je.latestPackages(this.modPackages.values());for(let i of this.modPackages.values())n.has(i)&&(t.push(new S.Task({label:`${i.label}.datestamp`,type:"factorio",modname:i.label,command:"datestamp"},S.workspace.getWorkspaceFolder(i.resourceUri)||S.TaskScope.Workspace,`${i.label}.datestamp`,"factorio",i.DateStampTask(),[])),t.push(new S.Task({label:`${i.label}.package`,type:"factorio",modname:i.label,command:"package"},S.workspace.getWorkspaceFolder(i.resourceUri)||S.TaskScope.Workspace,`${i.label}.package`,"factorio",i.PackageTask(),[])),t.push(new S.Task({label:`${i.label}.version`,type:"factorio",modname:i.label,command:"version"},S.workspace.getWorkspaceFolder(i.resourceUri)||S.TaskScope.Workspace,`${i.label}.version`,"factorio",i.IncrementTask(),[])),t.push(new S.Task({label:`${i.label}.upload`,type:"factorio",modname:i.label,command:"upload"},S.workspace.getWorkspaceFolder(i.resourceUri)||S.TaskScope.Workspace,`${i.label}.upload`,"factorio",i.PostToPortalTask(),[])),t.push(new S.Task({label:`${i.label}.details`,type:"factorio",modname:i.label,command:"details"},S.workspace.getWorkspaceFolder(i.resourceUri)||S.TaskScope.Workspace,`${i.label}.details`,"factorio",i.DetailsTask(),[])),t.push(new S.Task({label:`${i.label}.publish`,type:"factorio",modname:i.label,command:"publish"},S.workspace.getWorkspaceFolder(i.resourceUri)||S.TaskScope.Workspace,`${i.label}.publish`,"factorio",i.PublishTask(),[])));return t}resolveTaskExecution(e,t){if(e.definition.command==="adjustMods")return e.definition.adjustMods?e.definition.modsPath?this.AdjustModsTask(e.definition):this.ConfigErrorTask(e.definition,"missing `modsPath`"):this.ConfigErrorTask(e.definition,"missing `adjustMods`");if(!e.definition.modname)return this.ConfigErrorTask(e.definition,"missing `modname`");if(e.definition.command==="run"&&!e.definition.script)return this.ConfigErrorTask(e.definition,"missing `script`");let n=Je.latestPackages(this.modPackages.values());for(let i of this.modPackages.values())if(i.label===e.definition.modname&&n.has(i)){let r=i;switch(e.definition.command){case"run":return r.RunTask(e.definition.script,e.definition.scriptArgs);case"compile":return r.RunTask("compile");case"datestamp":return r.DateStampTask();case"package":return r.PackageTask();case"version":return r.IncrementTask();case"upload":return r.PostToPortalTask();case"details":return r.DetailsTask();case"publish":return r.PublishTask();default:return this.ConfigErrorTask(e.definition,`unknown \`command\` "${e.definition.command}"`)}}return this.ConfigErrorTask(e.definition,`mod "${e.definition.modname}" not found`)}resolveTask(e,t){if(e.definition.type==="factorio"){let n=this.resolveTaskExecution(e,t);return new S.Task(e.definition,e.scope||S.TaskScope.Workspace,e.name,e.source,n,[])}}ConfigErrorTask(e,t){return new S.CustomExecution(async()=>new He(n=>{n.write(t+`
|
|
12
|
-
`),n.write(JSON.stringify(e,void 0,2)),n.close()}))}getFMTKCLIPath(){return this.context.asAbsolutePath("./dist/fmtk-cli.js")}AdjustModsTask(e){let t=["mods","--modsPath",e.modsPath,"adjust"];e.allowDisableBaseMod&&t.push("--allowDisableBase"),e.disableExtraMods&&t.push("--disableExtra");for(let n in e.adjustMods)t.push(`${n}=${e.adjustMods[n]}`);return new S.CustomExecution(async()=>new He(async n=>{await Be(n,this.getFMTKCLIPath(),t,process.cwd()),n.close()}))}},Je=class extends S.TreeItem{constructor(t,n,i,r){super(t);this.resourceUri=t;this.keychain=i;this.context=r;this.label=n.name,this.description=n.version,this.tooltip=n.title,this.command={title:"Open",command:"vscode.open",arguments:[t]},this.scripts=n.package?.scripts}label;description;scripts;static sort(t,n){let i=t.label.toLowerCase().localeCompare(n.label.toLowerCase());if(i!==0)return i*100;let r=qr.compare(t.description,n.description,{loose:!0});return r!==0?-r*10:t.resourceUri<n.resourceUri?-1:t.resourceUri>n.resourceUri?1:0}static latestPackages(t){let n=new Map;for(let r of t)n.has(r.label)?n.get(r.label).push(r):n.set(r.label,[r]);let i=new Set;for(let r of n.values())i.add(r.reduce((
|
|
13
|
-
`)).on("segment",
|
|
14
|
-
`)}),new Rr(
|
|
15
|
-
`)).on("segment",
|
|
16
|
-
`)}),
|
|
17
|
-
`)}),
|
|
18
|
-
`)),close:()=>n.fire()},this.tokensource.token);i?i.finally(()=>{n.fire()}):n.fire()}close(){this.tokensource.cancel()}};import*as M from"vscode";import*as Mr from"os";import*as Ka from"path";var Qe=M.workspace.fs,Vd=[{name:"Steam",factorioPath:"C:\\Program Files (x86)\\Steam\\steamapps\\common\\Factorio\\bin\\x64\\factorio.exe"},{name:"System",factorioPath:"C:\\Program Files\\Factorio\\bin\\x64\\factorio.exe"},{name:"Steam",factorioPath:"~/Library/Application Support/Steam/steamapps/common/Factorio/factorio.app/Contents/MacOS/factorio"},{name:"System",factorioPath:"/Applications/factorio.app/Contents/MacOS/factorio"},{name:"Home",factorioPath:"~/.factorio/bin/x64/factorio"}],ii=class{constructor(e,t,n){this.context=e;this.output=t;this.fsprovider=n;this.bar=M.window.createStatusBarItem("factorio-version",M.StatusBarAlignment.Left,10),this.bar.name="Factorio Version Selector",this.bar.text="Factorio (unselected)",this.bar.command="factorio.selectVersion",this.bar.show(),e.subscriptions.push(this.bar),e.subscriptions.push(M.commands.registerCommand("factorio.selectVersion",()=>this.selectVersionCommand())),e.subscriptions.push(M.commands.registerCommand("factorio.checkConfig",()=>this.checkConfigCommand())),e.subscriptions.push(M.commands.registerCommand("factorio.disablePrototypeCache",()=>this.disablePrototypeCacheCommand())),e.subscriptions.push(M.commands.registerCommand("factorio.disableMouseAutoCapture",()=>this.disableMouseAutoCaptureCommand())),this.loadActiveVersion(),e.subscriptions.push(M.workspace.onDidChangeConfiguration(i=>{i.affectsConfiguration("factorio.versions")&&this.loadActiveVersion()}))}bar;async loadActiveVersion(){let e=M.workspace.getConfiguration("factorio"),t=e.get("versions",[]),n=t.find(r=>r.active);if(!n||this._active_version&&this._active_version.is(n))return;let i=await this.tryJsonDocs(n);if(!i){delete n.active,e.update("versions",t);return}this.bar.text=`Factorio ${i.application_version} (${n.name})`,this._active_version=new Pr(M.workspace.fs,n,i,M.workspace.workspaceFolders),this.output.info(`Active Factorio version: ${n.name} (${i.application_version})`),await this.checkDocs()}async checkConfigCommand(){this.output.info("Check Config:"),this.output.show();let e=await this.getActiveVersion();if(!e){this.output.error("No Active Factorio Version");return}this.output.info("Active Factorio Version:"),this.output.info(`Binary: ${await e.getBinaryVersion().catch(h=>h.toString())}`),this.output.info(`Runtime JSON: ${e.docs.application_version}`),await e.isPrototypeCacheEnabled()&&this.output.warn("Prototype Cache is enabled!"),await e.isMouseAutoCaptureDisabled()&&this.output.info("Mouse Auto Capture is disabled");let t=this.context.storageUri;if(!t){this.output.error("No Workspace");return}try{let h=(await Qe.readFile(Pe.joinPath(t,"sumneko-3rd/factorio/config.json"))).toString(),v=JSON.parse(h);this.output.info(`Library bundle found in ${t.fsPath}, generated from Factorio ${v.factorioVersion} with FMTK ${v.bundleVersion}`);for(let f of Ia())try{(await Qe.readFile(Pe.joinPath(t,"sumneko-3rd",f.name))).toString()!==f.content&&this.output.info(`file ${f.name} content mismatch!`)}catch(y){this.output.error(`file ${f.name} ${y}`)}}catch(h){this.output.error(`Missing or damaged library bundle info ${h}`)}let n=M.extensions.getExtension("sumneko.lua");if(!n){this.output.warn("LuaLS (sumneko.lua) not present!");return}this.output.info(`LuaLS ${n.packageJSON.version} ${n.isActive?"Activated":"Not Yet Activated"}`);let i=M.workspace.getConfiguration("Lua"),r=M.workspace.getConfiguration("factorio"),o=i.get("workspace.userThirdParty");if(!o)this.output.warn("Lua.workspace.userThirdParty not present!");else{let h=Pe.joinPath(t,"sumneko-3rd").fsPath;o.includes(h)?this.output.info(`Lua.workspace.userThirdParty: workspace link OK (${h})`):this.output.warn(`Lua.workspace.userThirdParty: workspace link missing! (${h})`);let v=o.filter(f=>f!==h);for(let f of v)f.match(/justarandomgeek\.factoriomod\-debug[\\\/]sumneko\-3rd$/)?this.output.warn(`Lua.workspace.userThirdParty: stale workspace link? (${f})`):this.output.info(`Lua.workspace.userThirdParty: other library (${f})`)}let c=i.get("workspace.checkThirdParty"),d=c==="ApplyInMemory";c===!1||c==="Disable"?this.output.warn(`Lua.workspace.checkThirdParty = ${c}`):this.output.info(`Lua.workspace.checkThirdParty = ${c}`);let l=r.get("workspace.manageLibraryDataLinks",!1),p=i.get("workspace.library");if(!p)this.output.warn("Lua.workspace.library not present!");else{let h=ft.file(await e.dataPath()).fsPath;p.includes(h)?this.output.info(`Lua.workspace.library: /data link OK (${h})`):l&&this.output.warn(`Lua.workspace.library: /data link missing! (${h})`);let v=Pe.joinPath(t,"sumneko-3rd/factorio/library").fsPath,f=p.find(w=>ft.file(w).fsPath===v);f?d?this.output.warn(`Lua.workspace.library: redundant workspace library link (${f})`):this.output.info(`Lua.workspace.library: workspace library link OK (${f})`):d||this.output.warn(`Lua.workspace.library: workspace library link missing! (${v})`);let y=p.filter(w=>![h,f].includes(w));for(let w of y)w.match(/justarandomgeek\.factoriomod\-debug[\\\/]sumneko\-3rd[\\\/]factorio[\\\/]library$/)?this.output.warn(`Lua.workspace.library: stale workspace link? (${w})`):w.endsWith("data")?this.output.warn(`Lua.workspace.library: stale data link? (${w})`):this.output.info(`Lua.workspace.library: other library (${w})`)}let g=i.get("runtime.plugin");if(!g)d||this.output.warn("Lua.runtime.plugin not present!");else{let h=Pe.joinPath(t,"sumneko-3rd/factorio/plugin.lua").fsPath.replace(/[\\]/g,"/");g===h?d?this.output.warn(`Lua.runtime.plugin: redundant workspace link (${g})`):this.output.info(`Lua.runtime.plugin: OK (${g})`):this.output.warn(`Lua.runtime.plugin: wrong plugin? (${g})`)}}async disablePrototypeCacheCommand(){return(await this.getActiveVersion())?.disablePrototypeCache()}async disableMouseAutoCaptureCommand(){return(await this.getActiveVersion())?.disableMouseAutoCapture()}async selectVersionCommand(){if(M.debug.activeDebugSession?.type==="factoriomod"){M.window.showErrorMessage("Cannot select Factorio version while debugging.");return}let e=M.workspace.getConfiguration("factorio"),t=e.get("versions",[]),n=t.map(p=>p.factorioPath),i=(await Promise.all(Vd.filter(p=>!n.includes(p.factorioPath)).map(async p=>{try{return(await Qe.stat(ft.file(cn(p.factorioPath,M.workspace.workspaceFolders)))).type&M.FileType.File?p:void 0}catch{return}}))).filter(p=>!!p),r=async p=>p.onlineDocs===!0?"latest":p.onlineDocs?p.onlineDocs:(await this.tryJsonDocs(p,!1))?.application_version??"unknown",o=await M.window.showQuickPick(Promise.all([...t.map(async p=>({fv:p,label:p.name,description:await r(p),detail:p.factorioPath,picked:p.active})),...i.map(async p=>({fv:p,label:`${p.name} (autodetected)`,description:await r(p),detail:p.factorioPath})),{fv:void 0,label:"Select other version..."}]),{title:"Select Factorio Version"});if(!o)return;let c=o.fv;if(c){let p=!1;try{(await Qe.stat(ft.file(cn(c.factorioPath,M.workspace.workspaceFolders)))).type&M.FileType.File&&(p=!0)}catch{}if(!p)switch(await M.window.showErrorMessage("The selected factorio version is no longer present at the specified location","Remove from settings","Cancel")){case"Remove from settings":e.update("versions",t.filter(h=>h!==c));return;default:return}}if(!c){let p=await M.window.showOpenDialog({canSelectFiles:!0,canSelectFolders:!1,openLabel:"Select Factorio binary",filters:Mr.platform()==="win32"?{"":["exe"]}:void 0});if(!p)return;let g=await M.window.showInputBox({prompt:"Display Name for this version",placeHolder:"Enter a display name to be used in the Version Selector for this version",ignoreFocusOut:!0});if(!g)return;c={name:g,factorioPath:p[0].fsPath}}let d;try{d=await this.tryJsonDocs(c,!0)}catch(p){if(await M.window.showErrorMessage(`Unable to read JSON docs: ${p}`,"Select alternate location","Cancel")!=="Select alternate location")return;let g=await M.window.showOpenDialog({canSelectFiles:!0,canSelectFolders:!1,openLabel:"Select Runtime JSON Docs",title:"Select Runtime JSON Docs",filters:{"JSON Docs":["json"]}});if(!g)return;c.docsPath=Ka.relative(cn(c.factorioPath,M.workspace.workspaceFolders),g[0].fsPath);try{d=await this.tryJsonDocs(c,!0)}catch(h){M.window.showErrorMessage(`Unable to read JSON docs: ${h}`);return}}t.includes(c)||t.push(c),t.forEach(p=>delete p.active),c.active=!0,e.update("versions",t),this.bar.text=`Factorio ${d.application_version} (${c.name})`;let l=this._active_version;this._active_version=new Pr(M.workspace.fs,c,d,M.workspace.workspaceFolders),this.output.info(`Active Factorio version: ${c.name} (${d.application_version})`),await this.generateDocs(l)}_active_version;async getActiveVersion(){return this._active_version||await this.selectVersionCommand(),this._active_version}async tryJsonDocs(e,t){let n;if(e.onlineDocs){let r=`https://lua-api.factorio.com/${e.onlineDocs===!0?"latest":e.onlineDocs}/runtime-api.json`,o=await fetch(r);if(!o.ok){if(!t)return;throw new Error(`Error fetching ${r} : ${o.statusText}`)}n=await o.text()}else{let i=Pe.joinPath(ft.file(cn(e.factorioPath,M.workspace.workspaceFolders)),e.docsPath?e.docsPath:Mr.platform()==="darwin"?"../../doc-html/runtime-api.json":"../../../doc-html/runtime-api.json");try{n=(await Qe.readFile(i)).toString()}catch(r){if(!t)return;throw r}}try{return new qa(n)}catch(i){if(!t)return;throw i}}async checkDocs(){let e=await this.getActiveVersion();if(!e)return;let t=this.context.storageUri;if(t)try{let n=(await Qe.readFile(Pe.joinPath(t,"sumneko-3rd/factorio/config.json"))).toString(),i=JSON.parse(n);if(i.factorioVersion!==e.docs.application_version||i.bundleVersion!==Yn)return this.generateDocs()}catch{return this.generateDocs()}}async generateDocs(e){if(!M.workspace.getConfiguration("factorio").get("docs.generateDocs",!0))return;let t=await this.getActiveVersion();if(!t)return;let n=this.context.storageUri;if(!n){M.window.showErrorMessage("Unable to generate docs: no open workspace");return}let i=Pe.joinPath(n,"sumneko-3rd");await Qe.createDirectory(i);try{await Promise.allSettled([Qe.delete(Pe.joinPath(i,"factorio","library"),{recursive:!0}),Qe.delete(Pe.joinPath(i,"factorio","factorio-plugin"),{recursive:!0})])}catch{}await Be({close(){},write(v){}},this.context.asAbsolutePath("./dist/fmtk-cli.js"),t.docArgs,i.fsPath);let r=M.workspace.getConfiguration("Lua"),o=r.get("workspace.library",[]),c=(v,...f)=>{if(v){let y=Pe.joinPath(v,...f),w=o.indexOf(y.fsPath);w!==-1&&o.splice(w,1)}},d=async(v,...f)=>{try{let y=Pe.joinPath(v,...f);!o.includes(y.fsPath)&&(await Qe.stat(y)).type&M.FileType.Directory&&o.push(y.fsPath)}catch{}},l=M.workspace.getConfiguration("factorio");if(e){let v=ft.file(await e.dataPath());c(v)}if(o.length===0?await r.update("workspace.library",void 0):await r.update("workspace.library",o),l.get("workspace.manageLibraryDataLinks",!1)){let v=ft.file(await t.dataPath());await d(v)}o.length===0?await r.update("workspace.library",void 0):await r.update("workspace.library",o);let p=r.get("workspace.userThirdParty",[]);p=p.filter(v=>!v.includes("justarandomgeek.factoriomod-debug")),await r.update("workspace.userThirdParty",p),p.push(i.fsPath),await r.update("workspace.userThirdParty",p);let g=r.get("workspace.checkThirdParty");g&&["Ask","Apply","ApplyInMemory"].includes(g)||await r.update("workspace.checkThirdParty","ApplyInMemory");let h=M.extensions.getExtension("sumneko.lua");h&&(h.isActive||await h.activate())}};import*as ht from"path";import*as ee from"vscode";var ri=class{type;ctime;mtime;size;name;data;constructor(e){this.type=ee.FileType.File,this.ctime=Date.now(),this.mtime=Date.now(),this.size=0,this.name=e}},_t=class{type;ctime;mtime;size;name;entries;constructor(e){this.type=ee.FileType.Directory,this.ctime=Date.now(),this.mtime=Date.now(),this.size=0,this.name=e,this.entries=new Map}},si=class{root=new _t("");stat(e){return this._lookup(e,!1)}readDirectory(e){let t=this._lookupAsDirectory(e,!1),n=[];for(let[i,r]of t.entries)n.push([i,r.type]);return n}readFile(e){let t=this._lookupAsFile(e,!1).data;if(t)return t;throw ee.FileSystemError.FileNotFound()}writeFile(e,t,n){let i=ht.posix.basename(e.path),r=this._lookupParentDirectory(e),o=r.entries.get(i);if(o instanceof _t)throw ee.FileSystemError.FileIsADirectory(e);if(!o&&!n.create)throw ee.FileSystemError.FileNotFound(e);if(o&&n.create&&!n.overwrite)throw ee.FileSystemError.FileExists(e);o||(o=new ri(i),r.entries.set(i,o),this._fireSoon({type:ee.FileChangeType.Created,uri:e})),o.mtime=Date.now(),o.size=t.byteLength,o.data=t,this._fireSoon({type:ee.FileChangeType.Changed,uri:e})}rename(e,t,n){if(!n.overwrite&&this._lookup(t,!0))throw ee.FileSystemError.FileExists(t);let i=this._lookup(e,!1),r=this._lookupParentDirectory(e),o=this._lookupParentDirectory(t),c=ht.posix.basename(t.path);r.entries.delete(i.name),i.name=c,o.entries.set(c,i),this._fireSoon({type:ee.FileChangeType.Deleted,uri:e},{type:ee.FileChangeType.Created,uri:t})}delete(e,t){let n=e.with({path:ht.posix.dirname(e.path)}),i=ht.posix.basename(e.path),r=this._lookupAsDirectory(n,t?.silent??!1);if(!r||!r.entries.has(i)){if(t?.silent)return;throw ee.FileSystemError.FileNotFound(e)}r.entries.delete(i),r.mtime=Date.now(),r.size-=1,this._fireSoon({type:ee.FileChangeType.Changed,uri:n},{uri:e,type:ee.FileChangeType.Deleted})}createDirectory(e){let t=ht.posix.basename(e.path),n=e.with({path:ht.posix.dirname(e.path)}),i=this._lookupAsDirectory(n,!1),r=new _t(t);i.entries.set(r.name,r),i.mtime=Date.now(),i.size+=1,this._fireSoon({type:ee.FileChangeType.Changed,uri:n},{type:ee.FileChangeType.Created,uri:e})}_lookup(e,t){let n=e.path.split("/"),i=this.root;for(let r of n){if(!r)continue;let o;if(i instanceof _t&&(o=i.entries.get(r)),!o){if(t)return;throw ee.FileSystemError.FileNotFound(e)}i=o}return i}_lookupAsDirectory(e,t){let n=this._lookup(e,t);if(n instanceof _t)return n;throw ee.FileSystemError.FileNotADirectory(e)}_lookupAsFile(e,t){let n=this._lookup(e,t);if(n instanceof ri)return n;throw ee.FileSystemError.FileIsADirectory(e)}_lookupParentDirectory(e){let t=e.with({path:ht.posix.dirname(e.path)});return this._lookupAsDirectory(t,!1)}_emitter=new ee.EventEmitter;_bufferedEvents=[];_fireSoonHandle;onDidChangeFile=this._emitter.event;watch(e){return new ee.Disposable(()=>{})}_fireSoon(...e){this._bufferedEvents.push(...e),this._fireSoonHandle&&clearTimeout(this._fireSoonHandle),this._fireSoonHandle=setTimeout(()=>{this._emitter.fire(this._bufferedEvents),this._bufferedEvents.length=0},5)}};import*as Wa from"vscode";import*as O from"vscode";import{assert as $a}from"console";var Ha=`<!DOCTYPE html>\r
|
|
11
|
+
${e.message}`,void 0,i.handled===!0?!1:"force")}hookConfigurationChanged(e){this._listeners.push(J.workspace.onDidChangeConfiguration(()=>{this.refreshTrace(e,!0)}))}refreshTrace(e,t=!1){let n=J.workspace.getConfiguration(this._id),i=_.Trace.Off,r=_.TraceFormat.Text;if(n){let a=n.get("trace.server","off");typeof a=="string"?i=_.Trace.fromString(a):(i=_.Trace.fromString(n.get("trace.server.verbosity","off")),r=_.TraceFormat.fromString(n.get("trace.server.format","text")))}this._trace=i,this._traceFormat=r,e.trace(this._trace,this._tracer,{sendNotification:t,traceFormat:this._traceFormat}).catch(a=>{this.error("Updating trace failed with error",a,!1)})}hookFileEvents(e){let t=this._clientOptions.synchronize.fileEvents;if(!t)return;let n;je.array(t)?n=t:n=[t],n&&this._dynamicFeatures.get(_.DidChangeWatchedFilesNotification.type.method).registerRaw(od.generateUuid(),n)}registerFeatures(e){for(let t of e)this.registerFeature(t)}registerFeature(e){if(this._features.push(e),We.DynamicFeature.is(e)){let t=e.registrationType;this._dynamicFeatures.set(t.method,e)}}getFeature(e){return this._dynamicFeatures.get(e)}hasDedicatedTextSynchronizationFeature(e){let t=this.getFeature(_.NotebookDocumentSyncRegistrationType.method);return t===void 0||!(t instanceof ad.NotebookDocumentSyncFeature)?!1:t.handles(e)}registerBuiltinFeatures(){let e=new Map;this.registerFeature(new cd.ConfigurationFeature(this)),this.registerFeature(new Yt.DidOpenTextDocumentFeature(this,this._syncedDocuments)),this._didChangeTextDocumentFeature=new Yt.DidChangeTextDocumentFeature(this,e),this._didChangeTextDocumentFeature.onPendingChangeAdded(()=>{this.triggerPendingChangeDelivery()}),this.registerFeature(this._didChangeTextDocumentFeature),this.registerFeature(new Yt.WillSaveFeature(this)),this.registerFeature(new Yt.WillSaveWaitUntilFeature(this)),this.registerFeature(new Yt.DidSaveTextDocumentFeature(this)),this.registerFeature(new Yt.DidCloseTextDocumentFeature(this,this._syncedDocuments,e)),this.registerFeature(new Jl.FileSystemWatcherFeature(this,t=>this.notifyFileEvent(t))),this.registerFeature(new Ol.CompletionItemFeature(this)),this.registerFeature(new Al.HoverFeature(this)),this.registerFeature(new Ul.SignatureHelpFeature(this)),this.registerFeature(new Ll.DefinitionFeature(this)),this.registerFeature(new $l.ReferencesFeature(this)),this.registerFeature(new Kl.DocumentHighlightFeature(this)),this.registerFeature(new Nl.DocumentSymbolFeature(this)),this.registerFeature(new Hl.WorkspaceSymbolFeature(this)),this.registerFeature(new Wl.CodeActionFeature(this)),this.registerFeature(new jl.CodeLensFeature(this)),this.registerFeature(new aa.DocumentFormattingFeature(this)),this.registerFeature(new aa.DocumentRangeFormattingFeature(this)),this.registerFeature(new aa.DocumentOnTypeFormattingFeature(this)),this.registerFeature(new zl.RenameFeature(this)),this.registerFeature(new Vl.DocumentLinkFeature(this)),this.registerFeature(new Bl.ExecuteCommandFeature(this)),this.registerFeature(new cd.SyncConfigurationFeature(this)),this.registerFeature(new Yl.TypeDefinitionFeature(this)),this.registerFeature(new Gl.ImplementationFeature(this)),this.registerFeature(new Ql.ColorProviderFeature(this)),this.clientOptions.workspaceFolder===void 0&&this.registerFeature(new Xl.WorkspaceFoldersFeature(this)),this.registerFeature(new Zl.FoldingRangeFeature(this)),this.registerFeature(new ep.DeclarationFeature(this)),this.registerFeature(new tp.SelectionRangeFeature(this)),this.registerFeature(new np.ProgressFeature(this)),this.registerFeature(new ip.CallHierarchyFeature(this)),this.registerFeature(new rp.SemanticTokensFeature(this)),this.registerFeature(new sp.LinkedEditingFeature(this)),this.registerFeature(new Xt.DidCreateFilesFeature(this)),this.registerFeature(new Xt.DidRenameFilesFeature(this)),this.registerFeature(new Xt.DidDeleteFilesFeature(this)),this.registerFeature(new Xt.WillCreateFilesFeature(this)),this.registerFeature(new Xt.WillRenameFilesFeature(this)),this.registerFeature(new Xt.WillDeleteFilesFeature(this)),this.registerFeature(new op.TypeHierarchyFeature(this)),this.registerFeature(new ap.InlineValueFeature(this)),this.registerFeature(new cp.InlayHintsFeature(this)),this.registerFeature(new Ml.DiagnosticFeature(this)),this.registerFeature(new ad.NotebookDocumentSyncFeature(this))}registerProposedFeatures(){this.registerFeatures(la.createAll(this))}fillInitializeParams(e){for(let t of this._features)je.func(t.fillInitializeParams)&&t.fillInitializeParams(e)}computeClientCapabilities(){let e={};(0,We.ensure)(e,"workspace").applyEdit=!0;let t=(0,We.ensure)((0,We.ensure)(e,"workspace"),"workspaceEdit");t.documentChanges=!0,t.resourceOperations=[_.ResourceOperationKind.Create,_.ResourceOperationKind.Rename,_.ResourceOperationKind.Delete],t.failureHandling=_.FailureHandlingKind.TextOnlyTransactional,t.normalizesLineEndings=!0,t.changeAnnotationSupport={groupsOnLabel:!0};let n=(0,We.ensure)((0,We.ensure)(e,"textDocument"),"publishDiagnostics");n.relatedInformation=!0,n.versionSupport=!1,n.tagSupport={valueSet:[_.DiagnosticTag.Unnecessary,_.DiagnosticTag.Deprecated]},n.codeDescriptionSupport=!0,n.dataSupport=!0;let i=(0,We.ensure)(e,"window"),r=(0,We.ensure)(i,"showMessage");r.messageActionItem={additionalPropertiesSupport:!0};let a=(0,We.ensure)(i,"showDocument");a.support=!0;let c=(0,We.ensure)(e,"general");c.staleRequestSupport={cancel:!0,retryOnContentModified:Array.from(s.RequestsToCancelOnContentModified)},c.regularExpressions={engine:"ECMAScript",version:"ES2020"},c.markdown={parser:"marked",version:"1.1.0"},c.positionEncodings=["utf-16"],this._clientOptions.markdown.supportHtml&&(c.markdown.allowedTags=["ul","li","p","code","blockquote","ol","h1","h2","h3","h4","h5","h6","hr","em","pre","table","thead","tbody","tr","th","td","div","del","a","strong","br","img","span"]);for(let u of this._features)u.fillClientCapabilities(e);return e}initializeFeatures(e){let t=this._clientOptions.documentSelector;for(let n of this._features)je.func(n.preInitialize)&&n.preInitialize(this._capabilities,t);for(let n of this._features)n.initialize(this._capabilities,t)}async handleRegistrationRequest(e){let t=this.clientOptions.middleware?.handleRegisterCapability;return t?t(e,n=>this.doRegisterCapability(n)):this.doRegisterCapability(e)}async doRegisterCapability(e){if(!this.isRunning()){for(let t of e.registrations)this._ignoredRegistrations.add(t.id);return}for(let t of e.registrations){let n=this._dynamicFeatures.get(t.method);if(n===void 0)return Promise.reject(new Error(`No feature implementation for ${t.method} found. Registration failed.`));let i=t.registerOptions??{};i.documentSelector=i.documentSelector??this._clientOptions.documentSelector;let r={id:t.id,registerOptions:i};try{n.register(r)}catch(a){return Promise.reject(a)}}}async handleUnregistrationRequest(e){let t=this.clientOptions.middleware?.handleUnregisterCapability;return t?t(e,n=>this.doUnregisterCapability(n)):this.doUnregisterCapability(e)}async doUnregisterCapability(e){for(let t of e.unregisterations){if(this._ignoredRegistrations.has(t.id))continue;let n=this._dynamicFeatures.get(t.method);if(!n)return Promise.reject(new Error(`No feature implementation for ${t.method} found. Unregistration failed.`));n.unregister(t.id)}}async handleApplyWorkspaceEdit(e){let t=e.edit,n=await this.workspaceEditLock.lock(()=>this._p2c.asWorkspaceEdit(t)),i=new Map;J.workspace.textDocuments.forEach(a=>i.set(a.uri.toString(),a));let r=!1;if(t.documentChanges){for(let a of t.documentChanges)if(_.TextDocumentEdit.is(a)&&a.textDocument.version&&a.textDocument.version>=0){let c=this._p2c.asUri(a.textDocument.uri).toString(),u=i.get(c);if(u&&u.version!==a.textDocument.version){r=!0;break}}}return r?Promise.resolve({applied:!1}):je.asPromise(J.workspace.applyEdit(n).then(a=>({applied:a})))}handleFailedRequest(e,t,n,i,r=!0){if(n instanceof _.ResponseError){if(n.code===_.ErrorCodes.PendingResponseRejected||n.code===_.ErrorCodes.ConnectionInactive)return i;if(n.code===_.LSPErrorCodes.RequestCancelled||n.code===_.LSPErrorCodes.ServerCancelled){if(t!==void 0&&t.isCancellationRequested)return i;throw n.data!==void 0?new We.LSPCancellationError(n.data):new J.CancellationError}else if(n.code===_.LSPErrorCodes.ContentModified){if(s.RequestsToCancelOnContentModified.has(e.method)||s.CancellableResolveCalls.has(e.method))throw new J.CancellationError;return i}}throw this.error(`Request ${e.method} failed.`,n,r),n}};me.BaseLanguageClient=In;In.RequestsToCancelOnContentModified=new Set([_.SemanticTokensRequest.method,_.SemanticTokensRangeRequest.method,_.SemanticTokensDeltaRequest.method]);In.CancellableResolveCalls=new Set([_.CompletionResolveRequest.method,_.CodeLensResolveRequest.method,_.CodeActionResolveRequest.method,_.InlayHintResolveRequest.method,_.DocumentLinkResolveRequest.method,_.WorkspaceSymbolResolveRequest.method]);var ua=class{error(e){(0,_.RAL)().console.error(e)}warn(e){(0,_.RAL)().console.warn(e)}info(e){(0,_.RAL)().console.info(e)}log(e){(0,_.RAL)().console.log(e)}};function up(s,e,t,n,i){let r=new ua,a=(0,_.createProtocolConnection)(s,e,r,i);return a.onError(u=>{t(u[0],u[1],u[2])}),a.onClose(n),{listen:()=>a.listen(),sendRequest:a.sendRequest,onRequest:a.onRequest,hasPendingResponse:a.hasPendingResponse,sendNotification:a.sendNotification,onNotification:a.onNotification,onProgress:a.onProgress,sendProgress:a.sendProgress,trace:(u,l,g)=>{let h={sendNotification:!1,traceFormat:_.TraceFormat.Text};return g===void 0?a.trace(u,l,h):(je.boolean(g),a.trace(u,l,g))},initialize:u=>a.sendRequest(_.InitializeRequest.type,u),shutdown:()=>a.sendRequest(_.ShutdownRequest.type,void 0),exit:()=>a.sendNotification(_.ExitNotification.type),end:()=>a.end(),dispose:()=>a.dispose()}}var la;(function(s){function e(t){return[new dp.InlineCompletionItemFeature(t)]}s.createAll=e})(la||(me.ProposedFeatures=la={}))});var pd=F(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.terminate=void 0;var ld=I("child_process"),lp=I("path"),pp=process.platform==="win32",fp=process.platform==="darwin",hp=process.platform==="linux";function gp(s,e){if(pp)try{let i={stdio:["pipe","pipe","ignore"]};return e&&(i.cwd=e),ld.execFileSync("taskkill",["/T","/F","/PID",s.pid.toString()],i),!0}catch{return!1}else if(hp||fp)try{var t=(0,lp.join)(__dirname,"terminateProcess.sh"),n=ld.spawnSync(t,[s.pid.toString()]);return!n.error}catch{return!1}else return s.kill("SIGKILL"),!0}ir.terminate=gp});var hd=F(Fe=>{"use strict";var mp=Fe&&Fe.__createBinding||(Object.create?function(s,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,n,i)}:function(s,e,t,n){n===void 0&&(n=t),s[n]=e[t]}),fa=Fe&&Fe.__exportStar||function(s,e){for(var t in s)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&mp(e,s,t)};Object.defineProperty(Fe,"__esModule",{value:!0});Fe.DiagnosticPullMode=Fe.vsdiag=void 0;fa(L(),Fe);fa(W(),Fe);var fd=Fs();Object.defineProperty(Fe,"vsdiag",{enumerable:!0,get:function(){return fd.vsdiag}});Object.defineProperty(Fe,"DiagnosticPullMode",{enumerable:!0,get:function(){return fd.DiagnosticPullMode}});fa(pa(),Fe)});var yd=F(Te=>{"use strict";var vp=Te&&Te.__createBinding||(Object.create?function(s,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,n,i)}:function(s,e,t,n){n===void 0&&(n=t),s[n]=e[t]}),vd=Te&&Te.__exportStar||function(s,e){for(var t in s)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&vp(e,s,t)};Object.defineProperty(Te,"__esModule",{value:!0});Te.SettingMonitor=Te.LanguageClient=Te.TransportKind=void 0;var st=I("child_process"),ha=I("fs"),ga=I("path"),wt=I("vscode"),ne=Ee(),gd=pa(),yp=pd(),re=Ia(),Cp=Ld(),wp=Ud();vd(Ia(),Te);vd(hd(),Te);var md="^1.82.0",se;(function(s){s[s.stdio=0]="stdio",s[s.ipc=1]="ipc",s[s.pipe=2]="pipe",s[s.socket=3]="socket"})(se||(Te.TransportKind=se={}));var Ct;(function(s){function e(t){let n=t;return n&&n.kind===se.socket&&ne.number(n.port)}s.isSocket=e})(Ct||(Ct={}));var ma;(function(s){function e(t){return ne.string(t.command)}s.is=e})(ma||(ma={}));var va;(function(s){function e(t){return ne.string(t.module)}s.is=e})(va||(va={}));var ya;(function(s){function e(t){let n=t;return n&&n.writer!==void 0&&n.reader!==void 0}s.is=e})(ya||(ya={}));var Ca;(function(s){function e(t){let n=t;return n&&n.process!==void 0&&typeof n.detached=="boolean"}s.is=e})(Ca||(Ca={}));var wa=class extends gd.BaseLanguageClient{constructor(e,t,n,i,r){let a,c,u,l,g;ne.string(t)?(a=e,c=t,u=n,l=i,g=!!r):(a=e.toLowerCase(),c=e,u=t,l=n,g=i),g===void 0&&(g=!1),super(a,c,l),this._serverOptions=u,this._forceDebug=g,this._isInDebugMode=g;try{this.checkVersion()}catch(h){throw ne.string(h.message)&&this.outputChannel.appendLine(h.message),h}}checkVersion(){let e=Cp(wt.version);if(!e)throw new Error(`No valid VS Code version detected. Version string is: ${wt.version}`);if(e.prerelease&&e.prerelease.length>0&&(e.prerelease=[]),!wp(e,md))throw new Error(`The language client requires VS Code version ${md} but received version ${wt.version}`)}get isInDebugMode(){return this._isInDebugMode}async restart(){await this.stop(),this.isInDebugMode?(await new Promise(e=>setTimeout(e,1e3)),await this.start()):await this.start()}stop(e=2e3){return super.stop(e).finally(()=>{if(this._serverProcess){let t=this._serverProcess;this._serverProcess=void 0,(this._isDetached===void 0||!this._isDetached)&&this.checkProcessDied(t),this._isDetached=void 0}})}checkProcessDied(e){!e||e.pid===void 0||setTimeout(()=>{try{e.pid!==void 0&&(process.kill(e.pid,0),(0,yp.terminate)(e))}catch{}},2e3)}handleConnectionClosed(){return this._serverProcess=void 0,super.handleConnectionClosed()}fillInitializeParams(e){super.fillInitializeParams(e),e.processId===null&&(e.processId=process.pid)}createMessageTransports(e){function t(g,h){if(!g&&!h)return;let f=Object.create(null);return Object.keys(process.env).forEach(v=>f[v]=process.env[v]),h&&(f.ELECTRON_RUN_AS_NODE="1",f.ELECTRON_NO_ASAR="1"),g&&Object.keys(g).forEach(v=>f[v]=g[v]),f}let n=["--debug=","--debug-brk=","--inspect=","--inspect-brk="],i=["--debug","--debug-brk","--inspect","--inspect-brk"];function r(){let g=process.execArgv;return g?g.some(h=>n.some(f=>h.startsWith(f))||i.some(f=>h===f)):!1}function a(g){if(g.stdin===null||g.stdout===null||g.stderr===null)throw new Error("Process created without stdio streams")}let c=this._serverOptions;if(ne.func(c))return c().then(g=>{if(gd.MessageTransports.is(g))return this._isDetached=!!g.detached,g;if(ya.is(g))return this._isDetached=!!g.detached,{reader:new re.StreamMessageReader(g.reader),writer:new re.StreamMessageWriter(g.writer)};{let h;return Ca.is(g)?(h=g.process,this._isDetached=g.detached):(h=g,this._isDetached=!1),h.stderr.on("data",f=>this.outputChannel.append(ne.string(f)?f:f.toString(e))),{reader:new re.StreamMessageReader(h.stdout),writer:new re.StreamMessageWriter(h.stdin)}}});let u,l=c;return l.run||l.debug?this._forceDebug||r()?(u=l.debug,this._isInDebugMode=!0):(u=l.run,this._isInDebugMode=!1):u=c,this._getServerWorkingDir(u.options).then(g=>{if(va.is(u)&&u.module){let h=u,f=h.transport||se.stdio;if(h.runtime){let v=[],p=h.options??Object.create(null);p.execArgv&&p.execArgv.forEach(T=>v.push(T)),v.push(h.module),h.args&&h.args.forEach(T=>v.push(T));let C=Object.create(null);C.cwd=g,C.env=t(p.env,!1);let y=this._getRuntimePath(h.runtime,g),b;if(f===se.ipc?(C.stdio=[null,null,null,"ipc"],v.push("--node-ipc")):f===se.stdio?v.push("--stdio"):f===se.pipe?(b=(0,re.generateRandomPipeName)(),v.push(`--pipe=${b}`)):Ct.isSocket(f)&&v.push(`--socket=${f.port}`),v.push(`--clientProcessId=${process.pid.toString()}`),f===se.ipc||f===se.stdio){let T=st.spawn(y,v,C);return!T||!T.pid?Zt(T,`Launching server using runtime ${y} failed.`):(this._serverProcess=T,T.stderr.on("data",P=>this.outputChannel.append(ne.string(P)?P:P.toString(e))),f===se.ipc?(T.stdout.on("data",P=>this.outputChannel.append(ne.string(P)?P:P.toString(e))),Promise.resolve({reader:new re.IPCMessageReader(T),writer:new re.IPCMessageWriter(T)})):Promise.resolve({reader:new re.StreamMessageReader(T.stdout),writer:new re.StreamMessageWriter(T.stdin)}))}else{if(f===se.pipe)return(0,re.createClientPipeTransport)(b).then(T=>{let P=st.spawn(y,v,C);return!P||!P.pid?Zt(P,`Launching server using runtime ${y} failed.`):(this._serverProcess=P,P.stderr.on("data",q=>this.outputChannel.append(ne.string(q)?q:q.toString(e))),P.stdout.on("data",q=>this.outputChannel.append(ne.string(q)?q:q.toString(e))),T.onConnected().then(q=>({reader:q[0],writer:q[1]})))});if(Ct.isSocket(f))return(0,re.createClientSocketTransport)(f.port).then(T=>{let P=st.spawn(y,v,C);return!P||!P.pid?Zt(P,`Launching server using runtime ${y} failed.`):(this._serverProcess=P,P.stderr.on("data",q=>this.outputChannel.append(ne.string(q)?q:q.toString(e))),P.stdout.on("data",q=>this.outputChannel.append(ne.string(q)?q:q.toString(e))),T.onConnected().then(q=>({reader:q[0],writer:q[1]})))})}}else{let v;return new Promise((p,C)=>{let y=(h.args&&h.args.slice())??[];f===se.ipc?y.push("--node-ipc"):f===se.stdio?y.push("--stdio"):f===se.pipe?(v=(0,re.generateRandomPipeName)(),y.push(`--pipe=${v}`)):Ct.isSocket(f)&&y.push(`--socket=${f.port}`),y.push(`--clientProcessId=${process.pid.toString()}`);let b=h.options??Object.create(null);if(b.env=t(b.env,!0),b.execArgv=b.execArgv||[],b.cwd=g,b.silent=!0,f===se.ipc||f===se.stdio){let T=st.fork(h.module,y||[],b);a(T),this._serverProcess=T,T.stderr.on("data",P=>this.outputChannel.append(ne.string(P)?P:P.toString(e))),f===se.ipc?(T.stdout.on("data",P=>this.outputChannel.append(ne.string(P)?P:P.toString(e))),p({reader:new re.IPCMessageReader(this._serverProcess),writer:new re.IPCMessageWriter(this._serverProcess)})):p({reader:new re.StreamMessageReader(T.stdout),writer:new re.StreamMessageWriter(T.stdin)})}else f===se.pipe?(0,re.createClientPipeTransport)(v).then(T=>{let P=st.fork(h.module,y||[],b);a(P),this._serverProcess=P,P.stderr.on("data",q=>this.outputChannel.append(ne.string(q)?q:q.toString(e))),P.stdout.on("data",q=>this.outputChannel.append(ne.string(q)?q:q.toString(e))),T.onConnected().then(q=>{p({reader:q[0],writer:q[1]})},C)},C):Ct.isSocket(f)&&(0,re.createClientSocketTransport)(f.port).then(T=>{let P=st.fork(h.module,y||[],b);a(P),this._serverProcess=P,P.stderr.on("data",q=>this.outputChannel.append(ne.string(q)?q:q.toString(e))),P.stdout.on("data",q=>this.outputChannel.append(ne.string(q)?q:q.toString(e))),T.onConnected().then(q=>{p({reader:q[0],writer:q[1]})},C)},C)})}}else if(ma.is(u)&&u.command){let h=u,f=u.args!==void 0?u.args.slice(0):[],v,p=u.transport;if(p===se.stdio)f.push("--stdio");else if(p===se.pipe)v=(0,re.generateRandomPipeName)(),f.push(`--pipe=${v}`);else if(Ct.isSocket(p))f.push(`--socket=${p.port}`);else if(p===se.ipc)throw new Error("Transport kind ipc is not support for command executable");let C=Object.assign({},h.options);if(C.cwd=C.cwd||g,p===void 0||p===se.stdio){let y=st.spawn(h.command,f,C);return!y||!y.pid?Zt(y,`Launching server using command ${h.command} failed.`):(y.stderr.on("data",b=>this.outputChannel.append(ne.string(b)?b:b.toString(e))),this._serverProcess=y,this._isDetached=!!C.detached,Promise.resolve({reader:new re.StreamMessageReader(y.stdout),writer:new re.StreamMessageWriter(y.stdin)}))}else{if(p===se.pipe)return(0,re.createClientPipeTransport)(v).then(y=>{let b=st.spawn(h.command,f,C);return!b||!b.pid?Zt(b,`Launching server using command ${h.command} failed.`):(this._serverProcess=b,this._isDetached=!!C.detached,b.stderr.on("data",T=>this.outputChannel.append(ne.string(T)?T:T.toString(e))),b.stdout.on("data",T=>this.outputChannel.append(ne.string(T)?T:T.toString(e))),y.onConnected().then(T=>({reader:T[0],writer:T[1]})))});if(Ct.isSocket(p))return(0,re.createClientSocketTransport)(p.port).then(y=>{let b=st.spawn(h.command,f,C);return!b||!b.pid?Zt(b,`Launching server using command ${h.command} failed.`):(this._serverProcess=b,this._isDetached=!!C.detached,b.stderr.on("data",T=>this.outputChannel.append(ne.string(T)?T:T.toString(e))),b.stdout.on("data",T=>this.outputChannel.append(ne.string(T)?T:T.toString(e))),y.onConnected().then(T=>({reader:T[0],writer:T[1]})))})}}return Promise.reject(new Error("Unsupported server configuration "+JSON.stringify(c,null,4)))}).finally(()=>{this._serverProcess!==void 0&&this._serverProcess.on("exit",(g,h)=>{g!==null&&this.error(`Server process exited with code ${g}.`,void 0,!1),h!==null&&this.error(`Server process exited with signal ${h}.`,void 0,!1)})})}_getRuntimePath(e,t){if(ga.isAbsolute(e))return e;let n=this._mainGetRootPath();if(n!==void 0){let i=ga.join(n,e);if(ha.existsSync(i))return i}if(t!==void 0){let i=ga.join(t,e);if(ha.existsSync(i))return i}return e}_mainGetRootPath(){let e=wt.workspace.workspaceFolders;if(!e||e.length===0)return;let t=e[0];if(t.uri.scheme==="file")return t.uri.fsPath}_getServerWorkingDir(e){let t=e&&e.cwd;return t||(t=this.clientOptions.workspaceFolder?this.clientOptions.workspaceFolder.uri.fsPath:this._mainGetRootPath()),t?new Promise(n=>{ha.lstat(t,(i,r)=>{n(!i&&r.isDirectory()?t:void 0)})}):Promise.resolve(void 0)}};Te.LanguageClient=wa;var Da=class{constructor(e,t){this._client=e,this._setting=t,this._listeners=[]}start(){return wt.workspace.onDidChangeConfiguration(this.onDidChangeConfiguration,this,this._listeners),this.onDidChangeConfiguration(),new wt.Disposable(()=>{this._client.needsStop()&&this._client.stop()})}onDidChangeConfiguration(){let e=this._setting.indexOf("."),t=e>=0?this._setting.substr(0,e):this._setting,n=e>=0?this._setting.substr(e+1):void 0,i=n?wt.workspace.getConfiguration(t).get(n,!1):wt.workspace.getConfiguration(t);i&&this._client.needsStart()?this._client.start().catch(r=>this._client.error("Start failed after configuration change",r,"force")):!i&&this._client.needsStop()&&this._client.stop().catch(r=>this._client.error("Stop failed after configuration change",r,"force"))}};Te.SettingMonitor=Da;function Zt(s,e){return s===null?Promise.reject(e):new Promise((t,n)=>{s.on("error",i=>{n(`${e} ${i}`)}),setImmediate(()=>n(e))})}});var wd=F((Jf,Cd)=>{"use strict";Cd.exports=yd()});import*as ue from"vscode";var qr=br(Kd(),1);import*as S from"vscode";import*as Kt from"path";import{fork as jd}from"child_process";import*as xr from"vscode";var Xn=class{constructor(e){this.secrets=e}async ReadyAPIKey(e){if(process.env.FACTORIO_UPLOAD_API_KEY)return{from:"env"};try{let t=await this.secrets.get("factorio-uploadmods");if(t&&(e&&(e=await xr.window.showInformationMessage("Key already present. Replace it?",{modal:!0},"Yes","No")==="Yes"),!e))return{from:"secrets",key:t};if(t=await xr.window.showInputBox({prompt:"Mod Portal API Key:",ignoreFocusOut:!0,password:!0}),t)return t=t.trim(),await this.secrets.store("factorio-uploadmods",t),{from:"new",key:t}}catch{}return!1}async ClearApiKey(){return this.secrets.delete("factorio-uploadmods")}};var Na=br(Ka(),1);import{platform as zd,tmpdir as Vd}from"os";var ni;function Bd(s){if(ni)switch(zd()){case"win32":return`${s};${S.Uri.joinPath(ni,"bin").fsPath}`;default:return`${s}:${S.Uri.joinPath(ni,"bin").fsPath}`}return s}function Ha(s){if(S.workspace.workspaceFolders){let e=new Xn(s.secrets);s.subscriptions.push(S.commands.registerCommand("factorio.clearApiKey",async()=>{await e.ClearApiKey()})),s.subscriptions.push(S.commands.registerCommand("factorio.setApiKey",async()=>{await e.ReadyAPIKey(!0)}));let t=new Er(s,e);s.subscriptions.push(t);let n=S.window.createTreeView("factoriomods",{treeDataProvider:t});s.subscriptions.push(n),ni=s.extensionUri}}var Ir=class{constructor(e,t){this.context=e;this.modPackages=t}provideTasks(e){let t=[],n=Je.latestPackages(this.modPackages.values());for(let i of this.modPackages.values())n.has(i)&&(t.push(new S.Task({label:`${i.label}.datestamp`,type:"factorio",modname:i.label,command:"datestamp"},S.workspace.getWorkspaceFolder(i.resourceUri)||S.TaskScope.Workspace,`${i.label}.datestamp`,"factorio",i.DateStampTask(),[])),t.push(new S.Task({label:`${i.label}.package`,type:"factorio",modname:i.label,command:"package"},S.workspace.getWorkspaceFolder(i.resourceUri)||S.TaskScope.Workspace,`${i.label}.package`,"factorio",i.PackageTask(),[])),t.push(new S.Task({label:`${i.label}.version`,type:"factorio",modname:i.label,command:"version"},S.workspace.getWorkspaceFolder(i.resourceUri)||S.TaskScope.Workspace,`${i.label}.version`,"factorio",i.IncrementTask(),[])),t.push(new S.Task({label:`${i.label}.upload`,type:"factorio",modname:i.label,command:"upload"},S.workspace.getWorkspaceFolder(i.resourceUri)||S.TaskScope.Workspace,`${i.label}.upload`,"factorio",i.PostToPortalTask(),[])),t.push(new S.Task({label:`${i.label}.details`,type:"factorio",modname:i.label,command:"details"},S.workspace.getWorkspaceFolder(i.resourceUri)||S.TaskScope.Workspace,`${i.label}.details`,"factorio",i.DetailsTask(),[])),t.push(new S.Task({label:`${i.label}.publish`,type:"factorio",modname:i.label,command:"publish"},S.workspace.getWorkspaceFolder(i.resourceUri)||S.TaskScope.Workspace,`${i.label}.publish`,"factorio",i.PublishTask(),[])));return t}resolveTaskExecution(e,t){if(e.definition.command==="adjustMods")return e.definition.adjustMods?e.definition.modsPath?this.AdjustModsTask(e.definition):this.ConfigErrorTask(e.definition,"missing `modsPath`"):this.ConfigErrorTask(e.definition,"missing `adjustMods`");if(!e.definition.modname)return this.ConfigErrorTask(e.definition,"missing `modname`");if(e.definition.command==="run"&&!e.definition.script)return this.ConfigErrorTask(e.definition,"missing `script`");let n=Je.latestPackages(this.modPackages.values());for(let i of this.modPackages.values())if(i.label===e.definition.modname&&n.has(i)){let r=i;switch(e.definition.command){case"run":return r.RunTask(e.definition.script,e.definition.scriptArgs);case"compile":return r.RunTask("compile");case"datestamp":return r.DateStampTask();case"package":return r.PackageTask();case"version":return r.IncrementTask();case"upload":return r.PostToPortalTask();case"details":return r.DetailsTask();case"publish":return r.PublishTask();default:return this.ConfigErrorTask(e.definition,`unknown \`command\` "${e.definition.command}"`)}}return this.ConfigErrorTask(e.definition,`mod "${e.definition.modname}" not found`)}resolveTask(e,t){if(e.definition.type==="factorio"){let n=this.resolveTaskExecution(e,t);return new S.Task(e.definition,e.scope||S.TaskScope.Workspace,e.name,e.source,n,[])}}ConfigErrorTask(e,t){return new S.CustomExecution(async()=>new He(n=>{n.write(t+`
|
|
12
|
+
`),n.write(JSON.stringify(e,void 0,2)),n.close()}))}getFMTKCLIPath(){return this.context.asAbsolutePath("./dist/fmtk-cli.js")}AdjustModsTask(e){let t=["mods","--modsPath",e.modsPath,"adjust"];e.allowDisableBaseMod&&t.push("--allowDisableBase"),e.disableExtraMods&&t.push("--disableExtra");for(let n in e.adjustMods)t.push(`${n}=${e.adjustMods[n]}`);return new S.CustomExecution(async()=>new He(async n=>{await Be(n,this.getFMTKCLIPath(),t,process.cwd()),n.close()}))}},Je=class extends S.TreeItem{constructor(t,n,i,r){super(t);this.resourceUri=t;this.keychain=i;this.context=r;this.label=n.name,this.description=n.version,this.tooltip=n.title,this.command={title:"Open",command:"vscode.open",arguments:[t]},this.scripts=n.package?.scripts}label;description;scripts;static sort(t,n){let i=t.label.toLowerCase().localeCompare(n.label.toLowerCase());if(i!==0)return i*100;let r=qr.compare(t.description,n.description,{loose:!0});return r!==0?-r*10:t.resourceUri<n.resourceUri?-1:t.resourceUri>n.resourceUri?1:0}static latestPackages(t){let n=new Map;for(let r of t)n.has(r.label)?n.get(r.label).push(r):n.set(r.label,[r]);let i=new Set;for(let r of n.values())i.add(r.reduce((a,c)=>qr.compare(a.description,c.description,{loose:!0})<0?c:a));return i}async Update(){let n=(await S.workspace.openTextDocument(this.resourceUri)).getText(),i=JSON.parse(n);this.label=i.name,this.description=i.version,this.tooltip=i.title,this.scripts=i.package?.scripts}getFMTKCLIPath(){return this.context.asAbsolutePath("./dist/fmtk-cli.js")}RunTask(t,n){return new S.CustomExecution(async()=>new He(async i=>{await Be(i,this.getFMTKCLIPath(),["run",t,...n??[]],S.Uri.joinPath(this.resourceUri,"..").fsPath),await this.Update(),i.close()}))}DateStampTask(){return new S.CustomExecution(async()=>new He(async t=>{await Be(t,this.getFMTKCLIPath(),["datestamp"],S.Uri.joinPath(this.resourceUri,"..").fsPath),await this.Update(),t.close()}))}PackageTask(){let t=["package"];return S.workspace.getConfiguration(void 0,this.resourceUri).get("factorio.package.zipLocation","inside")==="outside"&&(t.push("--outdir"),t.push("..")),new S.CustomExecution(async()=>new He(async i=>{await Be(i,this.getFMTKCLIPath(),t,S.Uri.joinPath(this.resourceUri,"..").fsPath),await this.Update(),i.close()}))}IncrementTask(){return new S.CustomExecution(async()=>new He(async t=>{await Be(t,this.getFMTKCLIPath(),["version"],S.Uri.joinPath(this.resourceUri,"..").fsPath),await this.Update(),t.close()}))}PostToPortalTask(){return new S.CustomExecution(async()=>new He(async t=>{await this.Update();let n=S.workspace.getConfiguration(void 0,this.resourceUri),i=Kt.dirname(this.resourceUri.path);switch(n.get("factorio.package.zipLocation","inside")){case"outside":i=Kt.dirname(i);break;case"inside":default:break}let r=this.resourceUri.with({path:i}),c=(await S.workspace.fs.readDirectory(r)).filter(([h,f])=>f===S.FileType.File&&h.startsWith(this.label)&&h.match(/_\d+\.\d+\.\d+\.zip$/)).map(([h,f])=>h).sort().reverse(),u=await S.window.showQuickPick(c,{placeHolder:"Select Package to upload"});if(!u){t.close();return}let l=Kt.join(r.fsPath,u),g=await this.keychain.ReadyAPIKey();g&&await Be(t,this.getFMTKCLIPath(),["upload",l,this.label],S.Uri.joinPath(this.resourceUri,"..").fsPath,g.from!=="env"?{FACTORIO_UPLOAD_API_KEY:g.key}:void 0),await this.Update(),t.close()}))}DetailsTask(){return new S.CustomExecution(async()=>new He(async t=>{await Be(t,this.getFMTKCLIPath(),["details"],S.Uri.joinPath(this.resourceUri,"..").fsPath),await this.Update(),t.close()}))}PublishTask(){return new S.CustomExecution(async()=>new He(async t=>{let n=await this.keychain.ReadyAPIKey();n&&await Be(t,this.getFMTKCLIPath(),["publish"],S.Uri.joinPath(this.resourceUri,"..").fsPath,n.from!=="env"?{FACTORIO_UPLOAD_API_KEY:n.key}:void 0),await this.Update(),t.close()}))}},Er=class{constructor(e,t){this.context=e;this.keychain=t;this.modPackages=new Map,S.workspace.findFiles("**/info.json").then(i=>{i.forEach(r=>void this.updateInfoJson(r))});let n=S.workspace.createFileSystemWatcher("**/info.json");this.subscriptions.push(n.onDidChange(i=>this.updateInfoJson(i))),this.subscriptions.push(n.onDidCreate(i=>this.updateInfoJson(i))),this.subscriptions.push(n.onDidDelete(i=>this.removeInfoJson(i))),this.subscriptions.push(n),this.subscriptions.push(S.tasks.registerTaskProvider("factorio",new Ir(this.context,this.modPackages))),this.subscriptions.push(S.commands.registerCommand("factorio.openchangelog",async i=>S.window.showTextDocument(S.Uri.joinPath(i.resourceUri,"../changelog.txt")))),this.subscriptions.push(S.commands.registerCommand("factorio.datestamp",async i=>{let r=(await S.tasks.fetchTasks({type:"factorio"})).find(a=>a.definition.command==="datestamp"&&a.definition.modname===i.label);await S.tasks.executeTask(r)})),this.subscriptions.push(S.commands.registerCommand("factorio.package",async i=>{let r=(await S.tasks.fetchTasks({type:"factorio"})).find(a=>a.definition.command==="package"&&a.definition.modname===i.label);await S.tasks.executeTask(r)})),this.subscriptions.push(S.commands.registerCommand("factorio.version",async i=>{let r=(await S.tasks.fetchTasks({type:"factorio"})).find(a=>a.definition.command==="version"&&a.definition.modname===i.label);await S.tasks.executeTask(r)})),this.subscriptions.push(S.commands.registerCommand("factorio.upload",async i=>{let r=(await S.tasks.fetchTasks({type:"factorio"})).find(a=>a.definition.command==="upload"&&a.definition.modname===i.label);await S.tasks.executeTask(r)})),this.subscriptions.push(S.commands.registerCommand("factorio.publish",async i=>{let r=(await S.tasks.fetchTasks({type:"factorio"})).find(a=>a.definition.command==="publish"&&a.definition.modname===i.label);await S.tasks.executeTask(r)}))}_onDidChangeTreeData=new S.EventEmitter;onDidChangeTreeData=this._onDidChangeTreeData.event;modPackages;subscriptions=[this._onDidChangeTreeData];dispose(){this.subscriptions.forEach(e=>e.dispose())}async updateInfoJson(e){if(e.scheme==="file"){let n=(await S.workspace.openTextDocument(e)).getText();if(n){let i=JSON.parse(n);i&&i.name?this.modPackages.has(e.toString())?await this.modPackages.get(e.toString())?.Update():this.modPackages.set(e.toString(),new Je(e,i,this.keychain,this.context)):this.modPackages.delete(e.toString())}else this.modPackages.delete(e.toString())}else this.modPackages.delete(e.toString());this._onDidChangeTreeData.fire(void 0)}removeInfoJson(e){this.modPackages.delete(e.toString()),this._onDidChangeTreeData.fire(void 0)}getTreeItem(e){return e}async getChildren(e){if(e)if(e instanceof Je){let t=[];if(this.modPackages){let n=Je.latestPackages(this.modPackages.values());n.has(e)&&this.modPackages.forEach((i,r)=>{i.label===e.label&&!n.has(i)&&(t.push(i),i.contextValue="older")})}return t.sort(Je.sort)}else return[];else{let t=[];if(this.modPackages){let n=Je.latestPackages(this.modPackages.values());for(let i of this.modPackages.values())if(n.has(i)){t.push(i);let r=["latest"];try{await S.workspace.fs.stat(S.Uri.joinPath(i.resourceUri,"../changelog.txt")),r.push("haschangelog")}catch{}i.contextValue=r.join(" "),i.collapsibleState=(()=>{for(let a of this.modPackages.values())if(i.label===a.label&&!n.has(a))return S.TreeItemCollapsibleState.Collapsed;return S.TreeItemCollapsibleState.None})()}}return t.sort(Je.sort)}}},Fr=S.Uri.file(Kt.join(Vd(),`vscode-${process.pid}-fmtk-config.json`));async function Be(s,e,t,n,i,r){let a=S.workspace.getConfiguration("factorio");await S.workspace.fs.writeFile(Fr,Buffer.from(JSON.stringify(Na.dot({docs:await a.get("docs"),package:await a.get("package")}))));let c=Object.assign({},process.env,i,{FMTK_CONFIG:Fr.fsPath});return c.Path=Bd(c.Path??""),new Promise((u,l)=>{let g=a.get("inspect",!1),h=jd(e,t,{cwd:n,execArgv:g?["--nolazy","--inspect-brk=34200"]:void 0,env:c,stdio:"pipe"});new Rr(h.stdout,Buffer.from(`
|
|
13
|
+
`)).on("segment",p=>{s.write(p.toString()+`\r
|
|
14
|
+
`)}),new Rr(h.stderr,Buffer.from(`
|
|
15
|
+
`)).on("segment",p=>{p.toString().match(/^Debugger listening/)&&console.log(p.toString()),s.write(p.toString()+`\r
|
|
16
|
+
`)}),h.on("error",p=>{s.write(`${p.message}\r
|
|
17
|
+
`)}),h.on("exit",(p,C)=>{S.workspace.fs.delete(Fr),u(p??-1)}),r&&h.stdin.write(r),h.stdin.end()})}var He=class{constructor(e){this.runner=e}writeEmitter=new S.EventEmitter;onDidWrite=this.writeEmitter.event;closeEmitter=new S.EventEmitter;onDidClose=this.closeEmitter.event;tokensource=new S.CancellationTokenSource;open(e){let t=this.writeEmitter,n=this.closeEmitter,i=this.runner({write:r=>t.fire(r.replace(/\r?\n/g,`\r
|
|
18
|
+
`)),close:()=>n.fire()},this.tokensource.token);i?i.finally(()=>{n.fire()}):n.fire()}close(){this.tokensource.cancel()}};import*as E from"vscode";import*as Ar from"os";import*as $a from"path";var Qe=E.workspace.fs,Jd=[{name:"Steam",factorioPath:"C:\\Program Files (x86)\\Steam\\steamapps\\common\\Factorio\\bin\\x64\\factorio.exe"},{name:"System",factorioPath:"C:\\Program Files\\Factorio\\bin\\x64\\factorio.exe"},{name:"Steam",factorioPath:"~/Library/Application Support/Steam/steamapps/common/Factorio/factorio.app/Contents/MacOS/factorio"},{name:"System",factorioPath:"/Applications/factorio.app/Contents/MacOS/factorio"},{name:"Home",factorioPath:"~/.factorio/bin/x64/factorio"}],Mr={name:"Online Latest",onlineDocs:!0},Or={name:"Online Stable",onlineDocs:"stable"},ii=class{constructor(e,t,n){this.context=e;this.output=t;this.fsprovider=n;this.bar=E.window.createStatusBarItem("factorio-version",E.StatusBarAlignment.Left,10),this.bar.name="Factorio Version Selector",this.bar.text="Factorio (unselected)",this.bar.command="factorio.selectVersion",this.bar.show(),e.subscriptions.push(this.bar),e.subscriptions.push(E.commands.registerCommand("factorio.selectVersion",()=>this.selectVersionCommand())),e.subscriptions.push(E.commands.registerCommand("factorio.checkConfig",()=>this.checkConfigCommand())),e.subscriptions.push(E.commands.registerCommand("factorio.disablePrototypeCache",()=>this.disablePrototypeCacheCommand())),e.subscriptions.push(E.commands.registerCommand("factorio.disableMouseAutoCapture",()=>this.disableMouseAutoCaptureCommand())),this.migrateActiveVersion().then(()=>this.loadActiveVersion())}bar;async migrateActiveVersion(){if(this.context.workspaceState.get("active_version"))return;let e=E.workspace.getConfiguration("factorio"),t=e.get("versions",[]),n=t.find(i=>i.active);n&&(t.forEach(i=>delete i.active),await this.context.workspaceState.update("active_version",n),await e.update("versions",t))}async loadActiveVersion(){let e=this.context.workspaceState.get("active_version");if(!e)return;let t=await this.tryJsonDocs(e).catch(()=>{});if(!t){await this.context.workspaceState.update("active_version",void 0);return}this.bar.text=`Factorio ${t.application_version} (${e.name})`,this._active_version=new Pr(E.workspace.fs,e,t,E.workspace.workspaceFolders),this.output.info(`Active Factorio version: ${e.name} (${t.application_version})`),await this.checkDocs()}async checkConfigCommand(){this.output.info("Check Config:"),this.output.show();let e=await this.getActiveVersion();if(!e){this.output.error("No Active Factorio Version");return}this.output.info("Active Factorio Version:"),e.onlineOnly?this.output.info("Online Only"):this.output.info(`Binary: ${await e.getBinaryVersion().catch(f=>f.toString())}`),this.output.info(`Runtime JSON: ${e.docs.application_version}`),e.onlineOnly||(await e.isPrototypeCacheEnabled()&&this.output.warn("Prototype Cache is enabled!"),await e.isMouseAutoCaptureDisabled()&&this.output.info("Mouse Auto Capture is disabled"));let t=this.context.storageUri;if(!t){this.output.error("No Workspace");return}try{let f=(await Qe.readFile(Pe.joinPath(t,"sumneko-3rd/factorio/config.json"))).toString(),v=JSON.parse(f);this.output.info(`Library bundle found in ${t.fsPath}, generated from Factorio ${v.factorioVersion} with FMTK ${v.bundleVersion}`);for(let p of Ma())try{(await Qe.readFile(Pe.joinPath(t,"sumneko-3rd",p.name))).toString()!==p.content&&this.output.info(`file ${p.name} content mismatch!`)}catch(C){this.output.error(`file ${p.name} ${C}`)}}catch(f){this.output.error(`Missing or damaged library bundle info ${f}`)}let n=E.extensions.getExtension("sumneko.lua");if(!n){this.output.warn("LuaLS (sumneko.lua) not present!");return}this.output.info(`LuaLS ${n.packageJSON.version} ${n.isActive?"Activated":"Not Yet Activated"}`);let i=E.workspace.getConfiguration("Lua"),r=E.workspace.getConfiguration("factorio"),a=i.get("workspace.userThirdParty");if(!a)this.output.warn("Lua.workspace.userThirdParty not present!");else{let f=Pe.joinPath(t,"sumneko-3rd").fsPath;a.includes(f)?this.output.info(`Lua.workspace.userThirdParty: workspace link OK (${f})`):this.output.warn(`Lua.workspace.userThirdParty: workspace link missing! (${f})`);let v=a.filter(p=>p!==f);for(let p of v)p.match(/justarandomgeek\.factoriomod\-debug[\\\/]sumneko\-3rd$/)?this.output.warn(`Lua.workspace.userThirdParty: stale workspace link? (${p})`):this.output.info(`Lua.workspace.userThirdParty: other library (${p})`)}let c=i.get("workspace.checkThirdParty"),u=c==="ApplyInMemory";c===!1||c==="Disable"?this.output.warn(`Lua.workspace.checkThirdParty = ${c}`):this.output.info(`Lua.workspace.checkThirdParty = ${c}`);let l=r.get("workspace.manageLibraryDataLinks",!1),g=i.get("workspace.library");if(!g)this.output.warn("Lua.workspace.library not present!");else{let f=[];if(!e.onlineOnly){let y=ft.file(await e.dataPath()).fsPath;f.push(y),g.includes(y)?this.output.info(`Lua.workspace.library: /data link OK (${y})`):l&&this.output.warn(`Lua.workspace.library: /data link missing! (${y})`)}let v=Pe.joinPath(t,"sumneko-3rd/factorio/library").fsPath,p=g.find(y=>ft.file(y).fsPath===v);p?(f.push(p),u?this.output.warn(`Lua.workspace.library: redundant workspace library link (${p})`):this.output.info(`Lua.workspace.library: workspace library link OK (${p})`)):u||this.output.warn(`Lua.workspace.library: workspace library link missing! (${v})`);let C=g.filter(y=>!f.includes(y));for(let y of C)y.match(/justarandomgeek\.factoriomod\-debug[\\\/]sumneko\-3rd[\\\/]factorio[\\\/]library$/)?this.output.warn(`Lua.workspace.library: stale workspace link? (${y})`):y.endsWith("data")?this.output.warn(`Lua.workspace.library: stale data link? (${y})`):this.output.info(`Lua.workspace.library: other library (${y})`)}let h=i.get("runtime.plugin");if(!h)u||this.output.warn("Lua.runtime.plugin not present!");else{let f=Pe.joinPath(t,"sumneko-3rd/factorio/plugin.lua").fsPath.replace(/[\\]/g,"/");h===f?u?this.output.warn(`Lua.runtime.plugin: redundant workspace link (${h})`):this.output.info(`Lua.runtime.plugin: OK (${h})`):this.output.warn(`Lua.runtime.plugin: wrong plugin? (${h})`)}}async disablePrototypeCacheCommand(){let e=await this.getActiveVersion();if(e?.onlineOnly)throw new Error("Select a local Factorio install to edit config");return e?.disablePrototypeCache()}async disableMouseAutoCaptureCommand(){let e=await this.getActiveVersion();if(e?.onlineOnly)throw new Error("Select a local Factorio install to edit config");return e?.disableMouseAutoCapture()}async selectVersionCommand(){if(E.debug.activeDebugSession?.type==="factoriomod"){E.window.showErrorMessage("Cannot select Factorio version while debugging.");return}let e=E.workspace.getConfiguration("factorio"),t=e.get("versions",[]),n=t.map(h=>h.factorioPath),i=(await Promise.all(Jd.filter(h=>!n.includes(h.factorioPath)).map(async h=>{try{return(await Qe.stat(ft.file(cn(h.factorioPath,E.workspace.workspaceFolders)))).type&E.FileType.File?h:void 0}catch{return}}))).filter(h=>!!h),r=async h=>h.onlineDocs===!0?"latest":h.onlineDocs?h.onlineDocs:(await this.tryJsonDocs(h).catch(()=>{}))?.application_version??"unknown",a=await E.window.showQuickPick(Promise.all([{kind:E.QuickPickItemKind.Separator,label:"settings"},...t.map(async h=>({fv:h,label:h.name,description:await r(h),detail:h.factorioPath})),{kind:E.QuickPickItemKind.Separator,label:"autodetected"},...i.map(async h=>({fv:h,label:h.name,description:await r(h),detail:h.factorioPath})),{fv:Mr,label:Mr.name,description:await r(Mr)},{fv:Or,label:Or.name,description:await r(Or)},{kind:E.QuickPickItemKind.Separator,label:""},{fv:void 0,label:"Select another install locaton...",picked:!1}]),{title:"Select Factorio Version"});if(!a)return;let c=a.fv;if(c?.factorioPath){let h=!1;try{(await Qe.stat(ft.file(cn(c.factorioPath,E.workspace.workspaceFolders)))).type&E.FileType.File&&(h=!0)}catch{}if(!h)switch(await E.window.showErrorMessage("The selected factorio version is no longer present at the specified location","Remove from settings","Cancel")){case"Remove from settings":e.update("versions",t.filter(v=>v!==c));return;default:return}}let u=!1;if(!c){let h=await E.window.showOpenDialog({canSelectFiles:!0,canSelectFolders:!1,openLabel:"Select Factorio binary",filters:Ar.platform()==="win32"?{"":["exe"]}:void 0});if(!h)return;let f=await E.window.showInputBox({prompt:"Display Name for this version",placeHolder:"Enter a display name to be used in the Version Selector for this version",ignoreFocusOut:!0});if(!f)return;c={name:f,factorioPath:h[0].fsPath},u=!0}let l;try{l=await this.tryJsonDocs(c)}catch(h){if(!c.factorioPath){E.window.showErrorMessage(`Unable to read online docs: ${h}`);return}if(await E.window.showErrorMessage(`Unable to read JSON docs: ${h}`,"Select alternate location","Cancel")!=="Select alternate location")return;let f=await E.window.showOpenDialog({canSelectFiles:!0,canSelectFolders:!1,openLabel:"Select Runtime JSON Docs",title:"Select Runtime JSON Docs",filters:{"JSON Docs":["json"]}});if(!f)return;c.docsPath=$a.relative(cn(c.factorioPath,E.workspace.workspaceFolders),f[0].fsPath);try{l=await this.tryJsonDocs(c)}catch(v){E.window.showErrorMessage(`Unable to read JSON docs: ${v}`);return}}await this.context.workspaceState.update("active_version",c),u&&(t.push(c),e.update("versions",t)),this.bar.text=`Factorio ${l.application_version} (${c.name})`;let g=this._active_version;this._active_version=new Pr(E.workspace.fs,c,l,E.workspace.workspaceFolders),this.output.info(`Active Factorio version: ${c.name} (${l.application_version})`),await this.generateDocs(g)}_active_version;async getActiveVersion(){return this._active_version||await this.selectVersionCommand(),this._active_version}async tryJsonDocs(e){let t;if(e.onlineDocs){let i=`https://lua-api.factorio.com/${e.onlineDocs===!0?"latest":e.onlineDocs}/runtime-api.json`,r=await fetch(i);if(!r.ok)throw new Error(`Error fetching ${i} : ${r.statusText}`);t=await r.text()}else{if(!e.factorioPath)throw new Error(`Invalid Config: requires at least one of factorioPath or onlineDocs in ${e.name}`);let n=Pe.joinPath(ft.file(cn(e.factorioPath,E.workspace.workspaceFolders)),e.docsPath?e.docsPath:Ar.platform()==="darwin"?"../../doc-html/runtime-api.json":"../../../doc-html/runtime-api.json");t=(await Qe.readFile(n)).toString()}return new Ea(t)}async checkDocs(){let e=await this.getActiveVersion();if(!e)return;let t=this.context.storageUri;if(t)try{let n=(await Qe.readFile(Pe.joinPath(t,"sumneko-3rd/factorio/config.json"))).toString(),i=JSON.parse(n);if(i.factorioVersion!==e.docs.application_version||i.bundleVersion!==Yn)return this.generateDocs()}catch{return this.generateDocs()}}async generateDocs(e){if(!E.workspace.getConfiguration("factorio").get("docs.generateDocs",!0))return;let t=await this.getActiveVersion();if(!t)return;let n=this.context.storageUri;if(!n){E.window.showErrorMessage("Unable to generate docs: no open workspace");return}let i=Pe.joinPath(n,"sumneko-3rd");await Qe.createDirectory(i);try{await Promise.allSettled([Qe.delete(Pe.joinPath(i,"factorio","library"),{recursive:!0}),Qe.delete(Pe.joinPath(i,"factorio","factorio-plugin"),{recursive:!0})])}catch{}await Be({close(){},write(v){}},this.context.asAbsolutePath("./dist/fmtk-cli.js"),t.docArgs,i.fsPath);let r=E.workspace.getConfiguration("Lua"),a=r.get("workspace.library",[]),c=(v,...p)=>{if(v){let C=Pe.joinPath(v,...p),y=a.indexOf(C.fsPath);y!==-1&&a.splice(y,1)}},u=async(v,...p)=>{try{let C=Pe.joinPath(v,...p);!a.includes(C.fsPath)&&(await Qe.stat(C)).type&E.FileType.Directory&&a.push(C.fsPath)}catch{}},l=E.workspace.getConfiguration("factorio");if(e&&!e.onlineOnly){let v=ft.file(await e.dataPath());c(v)}if(a.length===0?await r.update("workspace.library",void 0):await r.update("workspace.library",a),l.get("workspace.manageLibraryDataLinks",!1)){let v=ft.file(await t.dataPath());await u(v)}a.length===0?await r.update("workspace.library",void 0):await r.update("workspace.library",a);let g=r.get("workspace.userThirdParty",[]);g=g.filter(v=>!v.includes("justarandomgeek.factoriomod-debug")),await r.update("workspace.userThirdParty",g),g.push(i.fsPath),await r.update("workspace.userThirdParty",g);let h=r.get("workspace.checkThirdParty");h&&["Ask","Apply","ApplyInMemory"].includes(h)||await r.update("workspace.checkThirdParty","ApplyInMemory");let f=E.extensions.getExtension("sumneko.lua");f&&(f.isActive||await f.activate())}};import*as ht from"path";import*as ee from"vscode";var ri=class{type;ctime;mtime;size;name;data;constructor(e){this.type=ee.FileType.File,this.ctime=Date.now(),this.mtime=Date.now(),this.size=0,this.name=e}},_t=class{type;ctime;mtime;size;name;entries;constructor(e){this.type=ee.FileType.Directory,this.ctime=Date.now(),this.mtime=Date.now(),this.size=0,this.name=e,this.entries=new Map}},si=class{root=new _t("");stat(e){return this._lookup(e,!1)}readDirectory(e){let t=this._lookupAsDirectory(e,!1),n=[];for(let[i,r]of t.entries)n.push([i,r.type]);return n}readFile(e){let t=this._lookupAsFile(e,!1).data;if(t)return t;throw ee.FileSystemError.FileNotFound()}writeFile(e,t,n){let i=ht.posix.basename(e.path),r=this._lookupParentDirectory(e),a=r.entries.get(i);if(a instanceof _t)throw ee.FileSystemError.FileIsADirectory(e);if(!a&&!n.create)throw ee.FileSystemError.FileNotFound(e);if(a&&n.create&&!n.overwrite)throw ee.FileSystemError.FileExists(e);a||(a=new ri(i),r.entries.set(i,a),this._fireSoon({type:ee.FileChangeType.Created,uri:e})),a.mtime=Date.now(),a.size=t.byteLength,a.data=t,this._fireSoon({type:ee.FileChangeType.Changed,uri:e})}rename(e,t,n){if(!n.overwrite&&this._lookup(t,!0))throw ee.FileSystemError.FileExists(t);let i=this._lookup(e,!1),r=this._lookupParentDirectory(e),a=this._lookupParentDirectory(t),c=ht.posix.basename(t.path);r.entries.delete(i.name),i.name=c,a.entries.set(c,i),this._fireSoon({type:ee.FileChangeType.Deleted,uri:e},{type:ee.FileChangeType.Created,uri:t})}delete(e,t){let n=e.with({path:ht.posix.dirname(e.path)}),i=ht.posix.basename(e.path),r=this._lookupAsDirectory(n,t?.silent??!1);if(!r||!r.entries.has(i)){if(t?.silent)return;throw ee.FileSystemError.FileNotFound(e)}r.entries.delete(i),r.mtime=Date.now(),r.size-=1,this._fireSoon({type:ee.FileChangeType.Changed,uri:n},{uri:e,type:ee.FileChangeType.Deleted})}createDirectory(e){let t=ht.posix.basename(e.path),n=e.with({path:ht.posix.dirname(e.path)}),i=this._lookupAsDirectory(n,!1),r=new _t(t);i.entries.set(r.name,r),i.mtime=Date.now(),i.size+=1,this._fireSoon({type:ee.FileChangeType.Changed,uri:n},{type:ee.FileChangeType.Created,uri:e})}_lookup(e,t){let n=e.path.split("/"),i=this.root;for(let r of n){if(!r)continue;let a;if(i instanceof _t&&(a=i.entries.get(r)),!a){if(t)return;throw ee.FileSystemError.FileNotFound(e)}i=a}return i}_lookupAsDirectory(e,t){let n=this._lookup(e,t);if(n instanceof _t)return n;throw ee.FileSystemError.FileNotADirectory(e)}_lookupAsFile(e,t){let n=this._lookup(e,t);if(n instanceof ri)return n;throw ee.FileSystemError.FileIsADirectory(e)}_lookupParentDirectory(e){let t=e.with({path:ht.posix.dirname(e.path)});return this._lookupAsDirectory(t,!1)}_emitter=new ee.EventEmitter;_bufferedEvents=[];_fireSoonHandle;onDidChangeFile=this._emitter.event;watch(e){return new ee.Disposable(()=>{})}_fireSoon(...e){this._bufferedEvents.push(...e),this._fireSoonHandle&&clearTimeout(this._fireSoonHandle),this._fireSoonHandle=setTimeout(()=>{this._emitter.fire(this._bufferedEvents),this._bufferedEvents.length=0},5)}};import*as za from"vscode";import*as O from"vscode";import{assert as ja}from"console";var Wa=`<!DOCTYPE html>\r
|
|
19
19
|
<html lang="en">\r
|
|
20
20
|
<head>\r
|
|
21
21
|
<link rel="stylesheet" type="text/css" href="$Flamegraph.css$">\r
|
|
@@ -24,10 +24,10 @@ ${e.message}`,void 0,i.handled===!0?!1:"force")}hookConfigurationChanged(e){this
|
|
|
24
24
|
<div id="chart"></div>\r
|
|
25
25
|
<script type="module" src="$Flamegraph.js$"></script>\r
|
|
26
26
|
</body>\r
|
|
27
|
-
</html>`;function
|
|
27
|
+
</html>`;function Nt(s,e){return isNaN(s)?e:isNaN(e)?s:Math.max(s,e)}var Ht=class s{constructor(e=0,t=0){this.timer=e;this.count=t}add(e){return e?new s(this.timer+e.timer,this.count+e.count):this}avg(){return this.timer/this.count}},oi=class{functions=new Map;lines=new Map;add(e){e.functions.forEach((t,n)=>{this.functions.set(n,t.add(this.functions.get(n)))}),e.lines.forEach((t,n)=>{this.lines.set(n,t.add(this.lines.get(n)))})}max(){let e={func:{timer:0,count:0,average:0},line:{timer:0,count:0,average:0}};return this.functions.forEach(t=>{e.func.timer=Nt(e.func.timer,t.timer),e.func.count=Nt(e.func.count,t.count),e.func.average=Nt(e.func.average,t.avg())}),this.lines.forEach(t=>{e.line.timer=Nt(e.line.timer,t.timer),e.line.count=Nt(e.line.count,t.count),e.line.average=Nt(e.line.average,t.avg())}),e}},Lr=class{totalTime=0;file=new Map},ai=class s{constructor(e,t,n,i){this.name=e;this.value=t;this.filename=n;this.line=i}children=[];ToStringInner(e){return`${e}${this.name} : ${this.value}
|
|
28
28
|
${this.children.map(t=>t.ToStringInner(e+" ")).join(`
|
|
29
|
-
`)}`}ToString(){return this.ToStringInner("")}AddToChild(e,t,n,i){let r=this.children.find(
|
|
30
|
-
`),n,i,r=[new ai("root",0)],
|
|
29
|
+
`)}`}ToString(){return this.ToStringInner("")}AddToChild(e,t,n,i){let r=this.children.find(a=>a.name===e);return r?r.value+=t:(r=new s(e,t,n,i),this.children.push(r)),r}Merge(e){this.value+=e.value,e.children.forEach(t=>{let n=this.children.find(i=>i.name===t.name);n?n.Merge(t):this.children.push(t)})}},Ur=class{totalTime=0;mod=new Map;getMod(e){let t=this.mod.get(e);return t||(t=new Lr,this.mod.set(e,t)),t}getFile(e,t){let n=this.getMod(e),i=n.file.get(t);return i||(i=new oi,n.file.set(t,i)),i}AddModTime(e,t){this.totalTime+=t,this.getMod(e).totalTime+=t}AddLineTime(e,t,n,i,r){let a=this.getFile(e,t),c=new Ht(i,r),u=a.lines.get(n);a.lines.set(n,c.add(u))}AddFuncTime(e,t,n,i,r){let a=this.getFile(e,t),c=new Ht(i,r),u=a.functions.get(n);a.functions.set(n,c.add(u))}Report(e){let t=new oi;return this.mod.forEach(n=>{let i=n.file.get(e);i&&t.add(i)}),{totalTime:this.totalTime,fileData:t}}},ci=class{constructor(e,t,n){this.context=t;this.debug=n;this._disposables.push(O.debug.onDidReceiveDebugSessionCustomEvent(r=>this.onCustomEvent(r),this)),this._disposables.push(O.debug.onDidTerminateDebugSession(r=>this.onTerminate(r),this)),this.timeDecorationType=O.window.createTextEditorDecorationType({before:{contentText:"",color:new O.ThemeColor("factorio.ProfileTimerForeground")}}),this.funcDecorationType=O.window.createTextEditorDecorationType({after:{contentText:"",color:new O.ThemeColor("factorio.ProfileFunctionTimerForeground"),borderColor:new O.ThemeColor("factorio.ProfileFunctionTimerForeground"),border:"1px solid",margin:"0 0 0 3ch"}});let i=O.workspace.getConfiguration().get("factorio.profile.rulers",[]);this.rulerDecorationTypes=i.filter(r=>r.color||r.themeColor).map(r=>{let a=O.OverviewRulerLane.Right;switch(r.lane){case"Right":a=O.OverviewRulerLane.Right;break;case"Center":a=O.OverviewRulerLane.Center;break;case"Left":a=O.OverviewRulerLane.Left;break;case"Full":a=O.OverviewRulerLane.Full;break;default:break}return{type:O.window.createTextEditorDecorationType({overviewRulerColor:r.color??new O.ThemeColor(r.themeColor),overviewRulerLane:a}),threshold:r.threshold}}),this.statusBar=O.window.createStatusBarItem(),this._disposables.push(O.window.onDidChangeActiveTextEditor(r=>{r&&r.document.uri.scheme==="file"&&this.render(r)})),e&&this.createFlamePanel()}profileData=new Ur;profileTreeRoot=new ai("root",0);profileOverhead=new Ht(0,0);timeDecorationType;funcDecorationType;rulerDecorationTypes;statusBar;flamePanel;_disposables=[];onTerminate(e){e===this.debug&&this.dispose()}dispose(){this._disposables.forEach(e=>e.dispose()),this.timeDecorationType.dispose(),this.funcDecorationType.dispose(),this.rulerDecorationTypes.forEach(e=>{e.type.dispose()}),this.statusBar.dispose(),this.flamePanel&&this.flamePanel.dispose()}async onCustomEvent(e){if(e.session===this.debug&&e.event==="x-Factorio-Profile"){await this.parse(e.body);let t=O.window.activeTextEditor;t&&t.document.uri.scheme==="file"&&this.render(t)}}createFlamePanel(){if(this.flamePanel)return;this.flamePanel=O.window.createWebviewPanel("factorioProfile","Factorio Profile",O.ViewColumn.Two,{enableScripts:!0,localResourceRoots:[this.context.extensionUri]});let e=this.flamePanel.webview;e.html=Wa.replace("$Flamegraph.css$",e.asWebviewUri(O.Uri.joinPath(this.context.extensionUri,"/dist/Flamegraph.css")).toString()).replace("$Flamegraph.js$",e.asWebviewUri(O.Uri.joinPath(this.context.extensionUri,"/dist/Flamegraph.js")).toString()),e.onDidReceiveMessage(t=>{switch(t.command){case"init":e.postMessage({command:"update",data:this.profileTreeRoot});break;case"click":t.line&&t.line>0&&t.filename&&t.line&&O.window.showTextDocument(O.Uri.parse(t.filename),{selection:new O.Range(t.line,0,t.line,0),viewColumn:O.ViewColumn.One});break;default:break}}),this.flamePanel.onDidDispose(()=>this.flamePanel=void 0)}async parse(e){let t=e.split(`
|
|
30
|
+
`),n,i,r=[new ai("root",0)],a;for(let c of t){let u=c.split(":");switch(u[0]){case"PROFILE":break;case"PMN":{n=u[1].replace(/[\r\n]*/g,"");let l=parseFloat(u[3]);this.profileData.AddModTime(n,l)}break;case"PFN":n&&(i=await this.debug.customRequest("x-Factorio-ConvertPath",{path:u[1].replace(/[\r\n]*/g,"")}));break;case"PLN":if(n&&i){let l=parseInt(u[1]),g=parseFloat(u[3]),h=parseInt(u[4]);this.profileData.AddLineTime(n,i,l,g,h)}break;case"PFT":if(n&&i){let l=parseInt(u[1]),g=parseFloat(u[3]),h=parseInt(u[4]);this.profileData.AddFuncTime(n,i,l,g,h)}break;case"POV":{let l=parseFloat(u[2]);this.profileOverhead=this.profileOverhead.add(new Ht(l,1))}break;case"PROOT":n&&(ja(r.length===1),a=r[0].AddToChild(n,0));break;case"PTREE":if(a){let l=u[1],g=await this.debug.customRequest("x-Factorio-ConvertPath",{path:u[2]}),h=u[3],f=l+":"+g+":"+h,v=parseFloat(u[5]);r.push(a),a=a.AddToChild(f,v,g,parseInt(h))}break;case"PTEND":a&&(r.length===1?a=void 0:a=r.pop());break}}ja(r.length===1),this.flamePanel&&this.flamePanel.visible&&this.flamePanel.webview.postMessage({command:"merge",data:r[0]}),this.profileTreeRoot.Merge(r[0])}render(e){let t=this.profileData.Report(e.document.uri.fsPath),n=t.fileData.max(),i=n.line.timer,r=n.line.average,a=n.line.count,c=new Array,u=new Array,l=this.rulerDecorationTypes.map((V,Z)=>({type:V.type,threshold:V.threshold,decs:new Array})),g=O.workspace.getConfiguration().get("factorio.profile.displayAverageTime"),h=O.workspace.getConfiguration().get("factorio.profile.colorBy","totaltime"),f=O.workspace.getConfiguration().get("factorio.profile.timerHighlightColor"),v={count:a,totaltime:i,averagetime:r}[h],p=Math.max(Number.MIN_VALUE,O.workspace.getConfiguration().get("factorio.profile.colorScaleFactor",1)),C={boost:V=>Math.log1p(V*p)/Math.log1p(v*p),linear:V=>V/v,mute:V=>(Math.pow(1+v,V*p/v)-1)/(v*p)}[O.workspace.getConfiguration().get("factorio.profile.colorScaleMode","boost")],y=a.toFixed(0).length+1,b=g?6:3,T=i.toFixed(b).length+1,P=y+T+3,q=t.fileData.lines.size>0,ce=t.fileData.functions.size>0;for(let V=1;V<=e.document.lineCount;V++){if(q){let Z=t.fileData.lines.get(V);if(Z){let Ye=Z.timer,ot=Z.count,Xe=g?Z.avg():Ye,at=C({count:ot,totaltime:Ye,averagetime:Z.avg()}[h]),Et=e.document.validateRange(new O.Range(V-1,0,V-1,1/0));c.push({range:Et,hoverMessage:g?`total: ${Ye}`:`avg: ${Z.avg()}`,renderOptions:{before:{backgroundColor:`${f}${Math.floor(255*at).toString(16)}`,contentText:`${ot.toFixed(0).padStart(y,"\xA0")}${Xe.toFixed(b).padStart(T,"\xA0")}\xA0ms`,width:`${P+1}ch`}}});let Mt=l.find(ct=>at>=ct.threshold);Mt&&Mt.decs.push({range:Et})}else c.push({range:e.document.validateRange(new O.Range(V-1,0,V-1,1/0)),renderOptions:{before:{width:`${P+1}ch`}}})}if(ce){let Z=t.fileData.functions.get(V);if(Z){let Ye=Z.timer,ot=Z.count,Xe=g?Z.avg():Ye,at=e.document.validateRange(new O.Range(V-1,0,V-1,1/0));u.push({range:at,renderOptions:{after:{contentText:`\xA0${ot.toFixed(0)}\xA0|\xA0${Xe.toFixed(b)}\xA0ms\xA0`,color:new O.ThemeColor("factorio.ProfileFunctionTimerForeground"),borderColor:new O.ThemeColor("factorio.ProfileFunctionTimerForeground"),margin:"0 0 0 3ch"}}})}}}e.setDecorations(this.timeDecorationType,c),e.setDecorations(this.funcDecorationType,u),l.forEach(V=>{e.setDecorations(V.type,V.decs)}),this.statusBar.text=`Profile Dump Avg ${this.profileOverhead.avg().toFixed(3)} ms`,this.statusBar.show()}clear(){O.window.visibleTextEditors.forEach(e=>{e.setDecorations(this.timeDecorationType,[]),e.setDecorations(this.funcDecorationType,[]),this.rulerDecorationTypes.forEach(t=>{e.setDecorations(t.type,[])})}),this.statusBar.hide()}};var di=class{constructor(e){this.context=e;e.subscriptions.push(za.debug.onDidStartDebugSession(t=>this.onDidStartDebugSession(t),this))}onDidStartDebugSession(e){e.type==="factoriomod"&&e.configuration.hookMode==="profile"&&new ci(e.configuration.profileTree??!0,this.context,e)}};var En=br(wd(),1);import*as Sd from"path";import{workspace as Dd}from"vscode";function _d(s){let e=s.asAbsolutePath(Sd.join("dist","fmtk-cli.js")),t={execArgv:["--nolazy","--inspect-brk=34199"]},n={run:{module:e,transport:En.TransportKind.ipc,args:["lsp"]},debug:{module:e,transport:En.TransportKind.ipc,args:["lsp"],options:t}},i={documentSelector:[{language:"factorio-locale"},{language:"factorio-changelog"},{language:"lua"}],synchronize:{fileEvents:[Dd.createFileSystemWatcher("**/locale/*/*.cfg"),Dd.createFileSystemWatcher("**/changelog.txt")]}},r=new En.LanguageClient("factorioLanguageServer","Factorio Language Server",n,i);r.start(),s.subscriptions.push({dispose(){return r.stop()}})}import*as ve from"vscode";function bd(s){return s.type==="int"?{type:"int",value:Sp("",s.value)}:s}function Sa(s,e){return typeof e=="bigint"?`jsonbigint ${e}n`:e}function Sp(s,e){if(typeof e=="string"){let t=e.match(/^jsonbigint\x01\x02 (\d+)n$/);if(t)return BigInt(t[1])}return e}function rr(){let s="",e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let t=0;t<32;t++)s+=e.charAt(Math.floor(Math.random()*e.length));return s}var Td=`<!DOCTYPE html>\r
|
|
31
31
|
<html lang="en">\r
|
|
32
32
|
<head>\r
|
|
33
33
|
<meta charset="UTF-8">\r
|
|
@@ -150,7 +150,7 @@ ${this.children.map(t=>t.ToStringInner(e+" ")).join(`
|
|
|
150
150
|
\r
|
|
151
151
|
<script type="module" nonce="$nonce$" src="$ModSettingsWebview.js$" defer/></script>\r
|
|
152
152
|
</body>\r
|
|
153
|
-
</html>`;var sr=class{constructor(e){this.context=e;this.context.subscriptions.push(ve.window.registerCustomEditorProvider("fmtk.modsettings",this,{supportsMultipleEditorsPerDocument:!1,webviewOptions:{retainContextWhenHidden:!0}}))}webviews=new Map;_onDidChangeCustomDocument=new ve.EventEmitter;onDidChangeCustomDocument=this._onDidChangeCustomDocument.event;async saveCustomDocument(e,t){return e.save(t)}async saveCustomDocumentAs(e,t,n){return e.saveAs(t,n)}async revertCustomDocument(e,t){return e.revert(t)}async backupCustomDocument(e,t,n){return e.backup(t.destination,n)}async openCustomDocument(e,t,n){let i=await
|
|
153
|
+
</html>`;var sr=class{constructor(e){this.context=e;this.context.subscriptions.push(ve.window.registerCustomEditorProvider("fmtk.modsettings",this,{supportsMultipleEditorsPerDocument:!1,webviewOptions:{retainContextWhenHidden:!0}}))}webviews=new Map;_onDidChangeCustomDocument=new ve.EventEmitter;onDidChangeCustomDocument=this._onDidChangeCustomDocument.event;async saveCustomDocument(e,t){return e.save(t)}async saveCustomDocumentAs(e,t,n){return e.saveAs(t,n)}async revertCustomDocument(e,t){return e.revert(t)}async backupCustomDocument(e,t,n){return e.backup(t.destination,n)}async openCustomDocument(e,t,n){let i=await _a.create(e,t.backupId),r=[];return r.push(i.onDidChange(a=>{this._onDidChangeCustomDocument.fire({document:i,...a})})),r.push(i.onDidChangeContent(a=>{let c=this.webviews.get(i.uri.toString());c&&this.postMessage(c,"init",{version:i.version,saves_ints:i.saves_ints,settings:JSON.stringify(i.settings,Sa),editable:ve.workspace.fs.isWritableFileSystem(i.uri.scheme)!==!1})})),i.onDidDispose(()=>r.forEach(a=>a.dispose())),i}resolveCustomEditor(e,t,n){let i=t.webview;this.webviews.set(e.uri.toString(),t),i.options={enableScripts:!0},i.html=Td.replace(/\$cspSource\$/g,i.cspSource).replace(/\$nonce\$/g,rr()).replace(/\$ModSettingsWebview\.css\$/g,i.asWebviewUri(ve.Uri.joinPath(this.context.extensionUri,"/dist/ModSettingsWebview.css")).toString()).replace(/\$ModSettingsWebview\.js\$/g,i.asWebviewUri(ve.Uri.joinPath(this.context.extensionUri,"/dist/ModSettingsWebview.js")).toString()),t.webview.onDidReceiveMessage(r=>this.onMessage(e,r)),t.webview.onDidReceiveMessage(r=>{r.type==="ready"&&this.postMessage(t,"init",{version:e.version,saves_ints:e.saves_ints,settings:JSON.stringify(e.settings,Sa),editable:ve.workspace.fs.isWritableFileSystem(e.uri.scheme)!==!1})})}postMessage(e,t,n){e.webview.postMessage({type:t,body:n})}onMessage(e,t){switch(t.type){case"edit":{e.edit(t.body);return}}}},_a=class s{constructor(e,t){this.uri=e;this._settings=new Tr(new an(t))}static async create(e,t){let n=typeof t=="string"?ve.Uri.parse(t):e,i=await ve.workspace.fs.readFile(n);return new s(e,i)}_settings;get version(){return this._settings.version.format()}get saves_ints(){return this._settings.version.isBeyond(1,2)}get settings(){return this._settings.settings}async save(e){return this.saveAs(this.uri,e)}async saveAs(e,t){return ve.workspace.fs.writeFile(e,this._settings.save())}async revert(e){this._settings=new Tr(new an(await ve.workspace.fs.readFile(this.uri))),this._onDidChangeDocument.fire({})}async backup(e,t){return await this.saveAs(e,t),{id:e.toString(),delete:()=>{ve.workspace.fs.delete(e)}}}edit(e){e.value.type==="none"?this._settings.set(e.scope,e.name,void 0):this._settings.set(e.scope,e.name,bd(e.value)),this._onDidChange.fire({})}_onDidDispose=new ve.EventEmitter;onDidDispose=this._onDidDispose.event;_onDidChangeDocument=new ve.EventEmitter;onDidChangeContent=this._onDidChangeDocument.event;_onDidChange=new ve.EventEmitter;onDidChange=this._onDidChange.event;disposables=[this._onDidDispose,this._onDidChangeDocument,this._onDidChange];dispose(){this._onDidDispose.fire(),this.disposables.forEach(e=>e.dispose())}};import*as qe from"vscode";function or(s){switch(s.type){case"Table":case"TableWithMeta":return Object.assign({},s,{values:void 0});default:return s}}var kd=`<!DOCTYPE html>\r
|
|
154
154
|
<html lang="en">\r
|
|
155
155
|
<head>\r
|
|
156
156
|
<meta charset="UTF-8">\r
|
|
@@ -177,5 +177,5 @@ ${this.children.map(t=>t.ToStringInner(e+" ")).join(`
|
|
|
177
177
|
\r
|
|
178
178
|
<script type="module" nonce="$nonce$" src="$ScriptDatWebview.js$" defer/></script>\r
|
|
179
179
|
</body>\r
|
|
180
|
-
</html>`;var ar=class{constructor(e){this.context=e;this.context.subscriptions.push(qe.window.registerCustomEditorProvider("fmtk.scriptdat",this,{supportsMultipleEditorsPerDocument:!1,webviewOptions:{retainContextWhenHidden:!0}}))}webviews=new Map;_onDidChangeCustomDocument=new qe.EventEmitter;onDidChangeCustomDocument=this._onDidChangeCustomDocument.event;async openCustomDocument(e,t,n){let i=await
|
|
180
|
+
</html>`;var ar=class{constructor(e){this.context=e;this.context.subscriptions.push(qe.window.registerCustomEditorProvider("fmtk.scriptdat",this,{supportsMultipleEditorsPerDocument:!1,webviewOptions:{retainContextWhenHidden:!0}}))}webviews=new Map;_onDidChangeCustomDocument=new qe.EventEmitter;onDidChangeCustomDocument=this._onDidChangeCustomDocument.event;async openCustomDocument(e,t,n){let i=await ba.create(e,t.backupId),r=[];return r.push(i.onDidChange(a=>{this._onDidChangeCustomDocument.fire({document:i,...a})})),r.push(i.onDidChangeContent(a=>{let c=this.webviews.get(i.uri.toString());c&&this.postMessage(c,"init",{version:i.version,data:i.rootdata})})),i.onDidDispose(()=>r.forEach(a=>a.dispose())),i}resolveCustomEditor(e,t,n){let i=t.webview;this.webviews.set(e.uri.toString(),t),i.options={enableScripts:!0},i.html=kd.replace(/\$cspSource\$/g,i.cspSource).replace(/\$nonce\$/g,rr()).replace(/\$ScriptDatWebview\.css\$/g,i.asWebviewUri(qe.Uri.joinPath(this.context.extensionUri,"/dist/ScriptDatWebview.css")).toString()).replace(/\$ScriptDatWebview\.js\$/g,i.asWebviewUri(qe.Uri.joinPath(this.context.extensionUri,"/dist/ScriptDatWebview.js")).toString()),t.webview.onDidReceiveMessage(r=>this.onMessage(e,r)),t.webview.onDidReceiveMessage(r=>{r.type==="ready"&&this.postMessage(t,"init",{version:e.version,data:e.rootdata})})}postMessage(e,t,n){e.webview.postMessage({type:t,body:n})}onMessage(e,t){switch(t.type){case"fetch":let n=t.body,i=e.find(n.modname,n.gcid);this.postMessage(this.webviews.get(e.uri.toString()),"values",{...n,values:i.values.map(r=>({key:or(r.key),value:or(r.value)}))});break}}},ba=class s{constructor(e,t){this.uri=e;this._data=new Aa(new an(t))}static async create(e,t){let n=typeof t=="string"?qe.Uri.parse(t):e,i=await qe.workspace.fs.readFile(n);return new s(e,i)}_data;get version(){return this._data.version.format()}get rootdata(){let e={};for(let t in this._data.data)e[t]=or(this._data.data[t]);return e}find(e,t){return this._data.find(e,t)}_onDidDispose=new qe.EventEmitter;onDidDispose=this._onDidDispose.event;_onDidChangeDocument=new qe.EventEmitter;onDidChangeContent=this._onDidChangeDocument.event;_onDidChange=new qe.EventEmitter;onDidChange=this._onDidChange.event;disposables=[this._onDidDispose,this._onDidChangeDocument,this._onDidChange];dispose(){this._onDidDispose.fire(),this.disposables.forEach(e=>e.dispose())}};function Dh(s){let e=ue.window.createOutputChannel("FMTK",{log:!0});e.info(`FMTK ${Yn}`);try{e.info("Registering FS Provider...");let t=new si;s.subscriptions.push(ue.workspace.registerFileSystemProvider("fmtk",t,{isCaseSensitive:!0})),e.info("Registering Version Selector...");let n=new ii(s,e,t);e.info("Registering Debug Provider...");let i=new Ta(n);s.subscriptions.push(ue.debug.registerDebugConfigurationProvider("factoriomod",i));let r=new ka(n);s.subscriptions.push(ue.debug.registerDebugAdapterDescriptorFactory("factoriomod",r)),s.subscriptions.push(r),e.info("Registering Language Client..."),_d(s),e.info("Registering Mod Package Provider..."),Ha(s),e.info("Registering Profile Renderer..."),new di(s),e.info("Registering Custom Editors..."),new sr(s),new ar(s),e.info("Activate Complete")}catch(t){e.error(`Error while activating: ${t}`)}}var Ta=class{constructor(e){this.versionSelector=e}async resolveDebugConfigurationWithSubstitutedVariables(e,t,n){let i=await this.versionSelector.getActiveVersion();if(!i)return;if(await i.isPrototypeCacheEnabled()){let a=await ue.window.showWarningMessage("Prototype Caching is enabled, which usually conflicts with the final portion of debugger initialization (which occurs in settings stage).",{modal:!0},"Disable in config.ini","Continue anyway");if(a==="Disable in config.ini")await i.disablePrototypeCache();else if(a===void 0)return}let r=ue.workspace.getConfiguration("factorio.debug").get("env",{});return Object.keys(r).length>0&&(t.env=Object.assign({},r,t.env)),t}},ka=class{constructor(e){this.versionSelector=e}async createDebugAdapterDescriptor(e,t){let n=await this.versionSelector.getActiveVersion();if(!n)return;if(n.onlineOnly)throw new Error("Select a local Factorio install to debug");if(n.nativeDAP)return new ue.DebugAdapterExecutable(n.factorioPath,["--dap"]);let i=ue.workspace.getConfiguration("factorio");switch(i.get("debug.runMode","inline")){case"inline":default:return new ue.DebugAdapterInlineImplementation(new Oa(n,ue.workspace.fs,{findWorkspaceFiles:ue.workspace.findFiles,getExtension:ue.extensions.getExtension,executeCommand:ue.commands.executeCommand}));case"external":return i.get("inspect",!1)&&t.args.unshift("--nolazy","--inspect-brk=34198"),t.args.push(...await n.debugLaunchArgs()),t}}dispose(){}};export{Dh as activate};
|
|
181
181
|
//# sourceMappingURL=fmtk-vscode.js.map
|