factoriomod-debug 2.1.2 → 2.1.3
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 +11 -0
- package/dist/{chunk-W6FPGVXO.js → chunk-XEN7L2DC.js} +27 -26
- package/dist/fmtk-cli.js +32 -32
- package/dist/fmtk-vscode.js +10 -10
- package/package.json +5 -5
- package/schema/datainfo.json +14 -5
package/dist/fmtk-vscode.js
CHANGED
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
import {createRequire} from 'module'
|
|
3
3
|
const require = createRequire(import.meta.url)
|
|
4
4
|
|
|
5
|
-
import{H as
|
|
5
|
+
import{H as Sc,I as Dc,J as hs,L as Pc,M as Tc,a as I,b as M,d as Yn,e as nd,g as $i,h as Re,i as _e,j as Qn,k as fs,l as N,m as Sn,n as Dn,o as id,p as rd,q as sd,s as od,t as ad}from"./chunk-XEN7L2DC.js";var kc=M((bv,Mc)=>{"use strict";var{hasOwnProperty:_s}=Object.prototype,ws=(r,e={})=>{typeof e=="string"&&(e={section:e}),e.align=e.align===!0,e.newline=e.newline===!0,e.sort=e.sort===!0,e.whitespace=e.whitespace===!0||e.align===!0,e.platform=e.platform||typeof process<"u"&&process.platform,e.bracketedArray=e.bracketedArray!==!1;let t=e.platform==="win32"?`\r
|
|
6
6
|
`:`
|
|
7
|
-
`,n=e.whitespace?" = ":"=",i=[],s=e.sort?Object.keys(r).sort():Object.keys(r),o=0;e.align&&(o=Pt(s.filter(l=>r[l]===null||Array.isArray(r[l])||typeof r[l]!="object").map(l=>Array.isArray(r[l])?`${l}[]`:l).concat([""]).reduce((l,p)=>Pt(l).length>=Pt(p).length?l:p)).length);let a="",u=e.bracketedArray?"[]":"";for(let l of s){let p=r[l];if(p&&Array.isArray(p))for(let h of p)a+=Pt(`${l}${u}`).padEnd(o," ")+n+Pt(h)+t;else p&&typeof p=="object"?i.push(l):a+=Pt(l).padEnd(o," ")+n+Pt(p)+t}e.section&&a.length&&(a="["+Pt(e.section)+"]"+(e.newline?t+t:t)+a);for(let l of i){let p=Oc(l,".").join("\\."),h=(e.section?e.section+".":"")+p,f=_s(r[l],{...e,section:h});a.length&&f.length&&(a+=t),a+=f}return a};function Oc(r,e){var t=0,n=0,i=0,s=[];do if(i=r.indexOf(e,t),i!==-1){if(t=i+e.length,i>0&&r[i-1]==="\\")continue;s.push(r.slice(n,i)),n=i+e.length}while(i!==-1);return s.push(r.slice(n)),s}var Rc=(r,e={})=>{e.bracketedArray=e.bracketedArray!==!1;let t=Object.create(null),n=t,i=null,s=/^\[([^\]]*)\]\s*$|^([^=]+)(=(.*))?$/i,o=r.split(/[\r\n]+/g),a={};for(let l of o){if(!l||l.match(/^\s*[;#]/)||l.match(/^\s*$/))continue;let p=l.match(s);if(!p)continue;if(p[1]!==void 0){if(i=Vi(p[1]),i==="__proto__"){n=Object.create(null);continue}n=t[i]=t[i]||Object.create(null);continue}let h=Vi(p[2]),f;e.bracketedArray?f=h.length>2&&h.slice(-2)==="[]":(a[h]=(a?.[h]||0)+1,f=a[h]>1);let m=f&&h.endsWith("[]")?h.slice(0,-2):h;if(m==="__proto__")continue;let g=p[3]?Vi(p[4]):!0,v=g==="true"||g==="false"||g==="null"?JSON.parse(g):g;f&&(ys.call(n,m)?Array.isArray(n[m])||(n[m]=[n[m]]):n[m]=[]),Array.isArray(n[m])?n[m].push(v):n[m]=v}let u=[];for(let l of Object.keys(t)){if(!ys.call(t,l)||typeof t[l]!="object"||Array.isArray(t[l]))continue;let p=Oc(l,".");n=t;let h=p.pop(),f=h.replace(/\\\./g,".");for(let m of p)m!=="__proto__"&&((!ys.call(n,m)||typeof n[m]!="object")&&(n[m]=Object.create(null)),n=n[m]);n===t&&f===h||(n[f]=t[l],u.push(l))}for(let l of u)delete t[l];return t},Fc=r=>r.startsWith('"')&&r.endsWith('"')||r.startsWith("'")&&r.endsWith("'"),Pt=r=>typeof r!="string"||r.match(/[=\r\n]/)||r.match(/^\[/)||r.length>1&&Fc(r)||r!==r.trim()?JSON.stringify(r):r.split(";").join("\\;").split("#").join("\\#"),Vi=r=>{if(r=(r||"").trim(),Fc(r)){r.charAt(0)==="'"&&(r=r.slice(1,-1));try{r=JSON.parse(r)}catch{}}else{let e=!1,t="";for(let n=0,i=r.length;n<i;n++){let s=r.charAt(n);if(e)"\\;#".indexOf(s)!==-1?t+=s:t+="\\"+s,e=!1;else{if(";#".indexOf(s)!==-1)break;s==="\\"?e=!0:t+=s}}return e&&(t+="\\"),t.trim()}return r};xc.exports={parse:Rc,decode:Rc,stringify:_s,encode:_s,safe:Pt,unsafe:Vi}});var He=M(Ke=>{"use strict";Object.defineProperty(Ke,"__esModule",{value:!0});Ke.boolean=pd;Ke.string=Ec;Ke.number=gd;Ke.error=md;Ke.func=qc;Ke.array=Ic;Ke.stringArray=vd;Ke.typedArray=yd;Ke.thenable=Ac;Ke.asPromise=_d;function pd(r){return r===!0||r===!1}function Ec(r){return typeof r=="string"||r instanceof String}function gd(r){return typeof r=="number"||r instanceof Number}function md(r){return r instanceof Error}function qc(r){return typeof r=="function"}function Ic(r){return Array.isArray(r)}function vd(r){return Ic(r)&&r.every(e=>Ec(e))}function yd(r,e){return Array.isArray(r)&&r.every(e)}function Ac(r){return r&&qc(r.then)}function _d(r){return r instanceof Promise?r:Ac(r)?new Promise((e,t)=>{r.then(n=>e(n),n=>t(n))}):Promise.resolve(r)}});var Qi=M(Je=>{"use strict";Object.defineProperty(Je,"__esModule",{value:!0});Je.Semaphore=Je.Delayer=void 0;Je.setTestMode=wd;Je.clearTestMode=Cd;Je.map=bd;Je.mapAsync=Sd;Je.forEach=Dd;var ni=N(),Ds=class{defaultDelay;timeout;completionPromise;onSuccess;task;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;let n=this.task();return this.task=void 0,n})),(t>=0||this.timeout===void 0)&&(this.timeout=(0,ni.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)}};Je.Delayer=Ds;var Ps=class{_capacity;_active;_waiting;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,ni.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()}}};Je.Semaphore=Ps;var Ts=!1;function wd(){Ts=!0}function Cd(){Ts=!1}var jc=15,ti=class{yieldAfter;startTime;counter;total;counterInterval;constructor(e=jc){this.yieldAfter=Ts===!0?Math.max(e,2):Math.max(e,jc),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 bd(r,e,t,n){if(r.length===0)return[];let i=new Array(r.length),s=new ti(n?.yieldAfter);function o(u){s.start();for(let l=u;l<r.length;l++)if(i[l]=e(r[l]),s.shouldYield())return n?.yieldCallback&&n.yieldCallback(),l+1;return-1}let a=o(0);for(;a!==-1&&!(t!==void 0&&t.isCancellationRequested);)a=await new Promise(u=>{(0,ni.RAL)().timer.setImmediate(()=>{t!==void 0&&t.isCancellationRequested?u(-1):u(o(a))})});return i}async function Sd(r,e,t,n){if(r.length===0)return[];let i=new Array(r.length),s=new ti(n?.yieldAfter);async function o(u){s.start();for(let l=u;l<r.length;l++)if(i[l]=await e(r[l],t),s.shouldYield())return n?.yieldCallback&&n.yieldCallback(),l+1;return-1}let a=await o(0);for(;a!==-1&&!(t!==void 0&&t.isCancellationRequested);)a=await new Promise(u=>{(0,ni.RAL)().timer.setImmediate(()=>{t!==void 0&&t.isCancellationRequested?u(-1):u(o(a))})});return i}async function Dd(r,e,t,n){if(r.length===0)return;let i=new ti(n?.yieldAfter);function s(a){i.start();for(let u=a;u<r.length;u++)if(e(r[u]),i.shouldYield())return n?.yieldCallback&&n.yieldCallback(),u+1;return-1}let o=s(0);for(;o!==-1&&!(t!==void 0&&t.isCancellationRequested);)o=await new Promise(a=>{(0,ni.RAL)().timer.setImmediate(()=>{t!==void 0&&t.isCancellationRequested?a(-1):a(s(o))})})}});var Os=M(Tt=>{"use strict";var Pd=Tt&&Tt.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Td=Tt&&Tt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Rd=Tt&&Tt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Pd(t,e,n[i]);return Td(t,e),t}})();Object.defineProperty(Tt,"__esModule",{value:!0});var Od=Rd(I("vscode")),Rs=class extends Od.CompletionItem{data;fromEdit;documentationFormat;originalItemKind;deprecated;insertTextMode;constructor(e){super(e)}};Tt.default=Rs});var xs=M(Rt=>{"use strict";var Fd=Rt&&Rt.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),xd=Rt&&Rt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Md=Rt&&Rt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Fd(t,e,n[i]);return xd(t,e),t}})();Object.defineProperty(Rt,"__esModule",{value:!0});var kd=Md(I("vscode")),Fs=class extends kd.CodeLens{data;constructor(e){super(e)}};Rt.default=Fs});var ks=M(Ot=>{"use strict";var Ed=Ot&&Ot.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),qd=Ot&&Ot.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Id=Ot&&Ot.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Ed(t,e,n[i]);return qd(t,e),t}})();Object.defineProperty(Ot,"__esModule",{value:!0});var Ad=Id(I("vscode")),Ms=class extends Ad.DocumentLink{data;constructor(e,t){super(e,t)}};Ot.default=Ms});var qs=M(Ft=>{"use strict";var jd=Ft&&Ft.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Ld=Ft&&Ft.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Nd=Ft&&Ft.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&jd(t,e,n[i]);return Ld(t,e),t}})();Object.defineProperty(Ft,"__esModule",{value:!0});var Ud=Nd(I("vscode")),Es=class extends Ud.CodeAction{data;constructor(e,t){super(e),this.data=t}};Ft.default=Es});var js=M(We=>{"use strict";var Kd=We&&We.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Hd=We&&We.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Nc=We&&We.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Kd(t,e,n[i]);return Hd(t,e),t}})();Object.defineProperty(We,"__esModule",{value:!0});We.ProtocolDiagnostic=We.DiagnosticCode=void 0;var Wd=Nc(I("vscode")),Is=Nc(He()),Lc;(function(r){function e(t){let n=t;return n!=null&&(Is.number(n.value)||Is.string(n.value))&&Is.string(n.target)}r.is=e})(Lc||(We.DiagnosticCode=Lc={}));var As=class extends Wd.Diagnostic{data;hasDiagnosticCode;constructor(e,t,n,i){super(e,t,n),this.data=i,this.hasDiagnosticCode=!1}};We.ProtocolDiagnostic=As});var Ns=M(xt=>{"use strict";var $d=xt&&xt.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Bd=xt&&xt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),zd=xt&&xt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&$d(t,e,n[i]);return Bd(t,e),t}})();Object.defineProperty(xt,"__esModule",{value:!0});var Vd=zd(I("vscode")),Ls=class extends Vd.CallHierarchyItem{data;constructor(e,t,n,i,s,o,a){super(e,t,n,i,s,o),a!==void 0&&(this.data=a)}};xt.default=Ls});var Ks=M(Mt=>{"use strict";var Gd=Mt&&Mt.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Jd=Mt&&Mt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Yd=Mt&&Mt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Gd(t,e,n[i]);return Jd(t,e),t}})();Object.defineProperty(Mt,"__esModule",{value:!0});var Qd=Yd(I("vscode")),Us=class extends Qd.TypeHierarchyItem{data;constructor(e,t,n,i,s,o,a){super(e,t,n,i,s,o),a!==void 0&&(this.data=a)}};Mt.default=Us});var Ws=M(kt=>{"use strict";var Zd=kt&&kt.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Xd=kt&&kt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),ef=kt&&kt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Zd(t,e,n[i]);return Xd(t,e),t}})();Object.defineProperty(kt,"__esModule",{value:!0});var Zi=ef(I("vscode")),Hs=class extends Zi.SymbolInformation{data;hasRange;constructor(e,t,n,i,s){let o=!(i instanceof Zi.Uri);super(e,t,n,o?i:new Zi.Location(i,new Zi.Range(0,0,0,0))),this.hasRange=o,s!==void 0&&(this.data=s)}};kt.default=Hs});var Bs=M(Et=>{"use strict";var tf=Et&&Et.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),nf=Et&&Et.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),rf=Et&&Et.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&tf(t,e,n[i]);return nf(t,e),t}})();Object.defineProperty(Et,"__esModule",{value:!0});var sf=rf(I("vscode")),$s=class extends sf.InlayHint{data;constructor(e,t,n){super(e,t,n)}};Et.default=$s});var Wc=M(Ye=>{"use strict";var of=Ye&&Ye.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),af=Ye&&Ye.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Xi=Ye&&Ye.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&of(t,e,n[i]);return af(t,e),t}})(),Vt=Ye&&Ye.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ye,"__esModule",{value:!0});Ye.createConverter=gf;var de=Xi(I("vscode")),L=Xi(N()),an=Xi(He()),Uc=Xi(Qi()),cf=Vt(Os()),uf=Vt(xs()),lf=Vt(ks()),Kc=Vt(qs()),Hc=js(),df=Vt(Ns()),ff=Vt(Ks()),hf=Vt(Ws()),pf=Vt(Bs()),zs;(function(r){function e(t){let n=t;return n&&!!n.inserting&&!!n.replacing}r.is=e})(zs||(zs={}));function gf(r){let t=r||(d=>d.toString());function n(d){return t(d)}function i(d){return{uri:t(d.uri)}}function s(d){return{uri:t(d.uri),languageId:d.languageId,version:d.version,text:d.getText()}}function o(d){return{uri:t(d.uri),version:d.version}}function a(d){return{textDocument:s(d)}}function u(d){let w=d;return!!w.document&&!!w.contentChanges}function l(d){let w=d;return!!w.uri&&!!w.version}function p(d,w,x){if(l(d))return{textDocument:{uri:t(d.uri),version:d.version},contentChanges:[{text:d.getText()}]};if(u(d)){let Z=w,V=x;return{textDocument:{uri:t(Z),version:V},contentChanges:d.contentChanges.map(ke=>{let St=ke.range;return{range:{start:{line:St.start.line,character:St.start.character},end:{line:St.end.line,character:St.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 x={textDocument:i(d)};return w&&(x.text=d.getText()),x}function m(d){switch(d){case de.TextDocumentSaveReason.Manual:return L.TextDocumentSaveReason.Manual;case de.TextDocumentSaveReason.AfterDelay:return L.TextDocumentSaveReason.AfterDelay;case de.TextDocumentSaveReason.FocusOut:return L.TextDocumentSaveReason.FocusOut}return L.TextDocumentSaveReason.Manual}function g(d){return{textDocument:i(d.document),reason:m(d.reason)}}function v(d){return{files:d.files.map(w=>({uri:t(w)}))}}function _(d){return{files:d.files.map(w=>({oldUri:t(w.oldUri),newUri:t(w.newUri)}))}}function T(d){return{files:d.files.map(w=>({uri:t(w)}))}}function C(d){return{files:d.files.map(w=>({uri:t(w)}))}}function D(d){return{files:d.files.map(w=>({oldUri:t(w.oldUri),newUri:t(w.newUri)}))}}function F(d){return{files:d.files.map(w=>({uri:t(w)}))}}function E(d,w){return{textDocument:i(d),position:rn(w)}}function Q(d){switch(d){case de.CompletionTriggerKind.TriggerCharacter:return L.CompletionTriggerKind.TriggerCharacter;case de.CompletionTriggerKind.TriggerForIncompleteCompletions:return L.CompletionTriggerKind.TriggerForIncompleteCompletions;default:return L.CompletionTriggerKind.Invoked}}function we(d,w,x){return{textDocument:i(d),position:rn(w),context:{triggerKind:Q(x.triggerKind),triggerCharacter:x.triggerCharacter}}}function xe(d){switch(d){case de.SignatureHelpTriggerKind.Invoke:return L.SignatureHelpTriggerKind.Invoked;case de.SignatureHelpTriggerKind.TriggerCharacter:return L.SignatureHelpTriggerKind.TriggerCharacter;case de.SignatureHelpTriggerKind.ContentChange:return L.SignatureHelpTriggerKind.ContentChange}}function Un(d){return{label:d.label}}function $r(d){return d.map(Un)}function Kn(d){return{label:d.label,parameters:$r(d.parameters)}}function Br(d){return d.map(Kn)}function zr(d){return d===void 0?d:{signatures:Br(d.signatures),activeSignature:d.activeSignature,activeParameter:d.activeParameter}}function Vr(d,w,x){return{textDocument:i(d),position:rn(w),context:{isRetrigger:x.isRetrigger,triggerCharacter:x.triggerCharacter,triggerKind:xe(x.triggerKind),activeSignatureHelp:zr(x.activeSignatureHelp)}}}function rn(d){return{line:d.line,character:d.character}}function Ct(d){return d==null?d:{line:d.line>L.uinteger.MAX_VALUE?L.uinteger.MAX_VALUE:d.line,character:d.character>L.uinteger.MAX_VALUE?L.uinteger.MAX_VALUE:d.character}}function yn(d,w){return Uc.map(d,Ct,w)}function Ri(d){return d.map(Ct)}function he(d){return d==null?d:{start:Ct(d.start),end:Ct(d.end)}}function Gr(d){return d.map(he)}function Kt(d){return d==null?d:L.Location.create(n(d.uri),he(d.range))}function Hn(d){switch(d){case de.DiagnosticSeverity.Error:return L.DiagnosticSeverity.Error;case de.DiagnosticSeverity.Warning:return L.DiagnosticSeverity.Warning;case de.DiagnosticSeverity.Information:return L.DiagnosticSeverity.Information;case de.DiagnosticSeverity.Hint:return L.DiagnosticSeverity.Hint}}function Oi(d){if(!d)return;let w=[];for(let x of d){let Z=Wn(x);Z!==void 0&&w.push(Z)}return w.length>0?w:void 0}function Wn(d){switch(d){case de.DiagnosticTag.Unnecessary:return L.DiagnosticTag.Unnecessary;case de.DiagnosticTag.Deprecated:return L.DiagnosticTag.Deprecated;default:return}}function Ht(d){return{message:d.message,location:Kt(d.location)}}function Jr(d){return d.map(Ht)}function Yr(d){if(d!=null)return an.number(d)||an.string(d)?d:{value:d.value,target:n(d.target)}}function _n(d){let w=L.Diagnostic.create(he(d.range),d.message),x=d instanceof Hc.ProtocolDiagnostic?d:void 0;x!==void 0&&x.data!==void 0&&(w.data=x.data);let Z=Yr(d.code);return Hc.DiagnosticCode.is(Z)?x!==void 0&&x.hasDiagnosticCode?w.code=Z:(w.code=Z.value,w.codeDescription={href:Z.target}):w.code=Z,an.number(d.severity)&&(w.severity=Hn(d.severity)),Array.isArray(d.tags)&&(w.tags=Oi(d.tags)),d.relatedInformation&&(w.relatedInformation=Jr(d.relatedInformation)),d.source&&(w.source=d.source),w}function wn(d,w){return d==null?d:Uc.map(d,_n,w)}function $n(d){return d==null?d:d.map(_n)}function Qr(d,w){switch(d){case"$string":return w;case L.MarkupKind.PlainText:return{kind:d,value:w};case L.MarkupKind.Markdown:return{kind:d,value:w.value};default:return`Unsupported Markup content received. Kind is: ${d}`}}function Fi(d){if(d===de.CompletionItemTag.Deprecated)return L.CompletionItemTag.Deprecated}function xi(d){if(d===void 0)return d;let w=[];for(let x of d){let Z=Fi(x);Z!==void 0&&w.push(Z)}return w}function Zr(d,w){return w!==void 0?w:d+1}function Wt(d,w=!1){let x,Z;an.string(d.label)?x=d.label:(x=d.label.label,w&&(d.label.detail!==void 0||d.label.description!==void 0)&&(Z={detail:d.label.detail,description:d.label.description}));let V={label:x};Z!==void 0&&(V.labelDetails=Z);let De=d instanceof cf.default?d:void 0;d.detail&&(V.detail=d.detail),d.documentation&&(!De||De.documentationFormat==="$string"?V.documentation=d.documentation:V.documentation=Qr(De.documentationFormat,d.documentation)),d.filterText&&(V.filterText=d.filterText),Mi(V,d),an.number(d.kind)&&(V.kind=Zr(d.kind,De&&De.originalItemKind)),d.sortText&&(V.sortText=d.sortText),d.additionalTextEdits&&(V.additionalTextEdits=ki(d.additionalTextEdits)),d.commitCharacters&&(V.commitCharacters=d.commitCharacters.slice()),d.command&&(V.command=$t(d.command)),(d.preselect===!0||d.preselect===!1)&&(V.preselect=d.preselect);let ke=xi(d.tags);if(De){if(De.data!==void 0&&(V.data=De.data),De.deprecated===!0||De.deprecated===!1){if(De.deprecated===!0&&ke!==void 0&&ke.length>0){let St=ke.indexOf(de.CompletionItemTag.Deprecated);St!==-1&&ke.splice(St,1)}V.deprecated=De.deprecated}De.insertTextMode!==void 0&&(V.insertTextMode=De.insertTextMode)}return ke!==void 0&&ke.length>0&&(V.tags=ke),V.insertTextMode===void 0&&d.keepWhitespace===!0&&(V.insertTextMode=L.InsertTextMode.adjustIndentation),V}function Mi(d,w){let x=L.InsertTextFormat.PlainText,Z,V;w.textEdit?(Z=w.textEdit.newText,V=w.textEdit.range):w.insertText instanceof de.SnippetString?(x=L.InsertTextFormat.Snippet,Z=w.insertText.value):Z=w.insertText,w.range&&(V=w.range),d.insertTextFormat=x,w.fromEdit&&Z!==void 0&&V!==void 0?d.textEdit=Cn(Z,V):d.insertText=Z}function Cn(d,w){return zs.is(w)?L.InsertReplaceEdit.create(d,he(w.inserting),he(w.replacing)):{newText:d,range:he(w)}}function Bn(d){return{range:he(d.range),newText:d.newText}}function ki(d){return d==null?d:d.map(Bn)}function bt(d){return d<=de.SymbolKind.TypeParameter?d+1:L.SymbolKind.Property}function zn(d){return d}function Me(d){return d.map(zn)}function Xr(d,w,x){return{textDocument:i(d),position:rn(w),context:{includeDeclaration:x.includeDeclaration}}}async function Ve(d,w){let x=L.CodeAction.create(d.title);if(d instanceof Kc.default&&d.data!==void 0&&(x.data=d.data),d.kind!==void 0&&(x.kind=Ei(d.kind)),d.diagnostics!==void 0&&(x.diagnostics=await wn(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&&(x.command=$t(d.command)),d.isPreferred!==void 0&&(x.isPreferred=d.isPreferred),d.disabled!==void 0&&(x.disabled={reason:d.disabled.reason}),d.isAI&&(x.tags??=[],x.tags.push(L.CodeActionTag.LLMGenerated)),x}function bn(d){let w=L.CodeAction.create(d.title);if(d instanceof Kc.default&&d.data!==void 0&&(w.data=d.data),d.kind!==void 0&&(w.kind=Ei(d.kind)),d.diagnostics!==void 0&&(w.diagnostics=$n(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=$t(d.command)),d.isPreferred!==void 0&&(w.isPreferred=d.isPreferred),d.disabled!==void 0&&(w.disabled={reason:d.disabled.reason}),d.isAI&&(w.tags??=[],w.tags.push(L.CodeActionTag.LLMGenerated)),w}async function es(d,w){if(d==null)return d;let x;return d.only&&an.string(d.only.value)&&(x=[d.only.value]),L.CodeActionContext.create(await wn(d.diagnostics,w),x,Vn(d.triggerKind))}function ts(d){if(d==null)return d;let w;return d.only&&an.string(d.only.value)&&(w=[d.only.value]),L.CodeActionContext.create($n(d.diagnostics),w,Vn(d.triggerKind))}function Vn(d){switch(d){case de.CodeActionTriggerKind.Invoke:return L.CodeActionTriggerKind.Invoked;case de.CodeActionTriggerKind.Automatic:return L.CodeActionTriggerKind.Automatic;default:return}}function Ei(d){if(d!=null)return d.value}function qi(d){return L.InlineValueContext.create(d.frameId,he(d.stoppedLocation))}function ns(d,w,x){return{textDocument:i(d),position:Ct(w),context:Gn(x)}}function Gn(d){return{triggerKind:is(d.triggerKind),selectedCompletionInfo:Ii(d.selectedCompletionInfo)}}function is(d){switch(d){case de.InlineCompletionTriggerKind.Invoke:return L.InlineCompletionTriggerKind.Invoked;case de.InlineCompletionTriggerKind.Automatic:return L.InlineCompletionTriggerKind.Automatic}}function Ii(d){if(d!=null)return{range:he(d.range),text:d.text}}function $t(d){let w=L.Command.create(d.title,d.command);return d.tooltip&&(w.tooltip=d.tooltip),d.arguments&&(w.arguments=d.arguments),w}function Ai(d){let w=L.CodeLens.create(he(d.range));return d.command&&(w.command=$t(d.command)),d instanceof uf.default&&d.data&&(w.data=d.data),w}function ji(d,w){let x={tabSize:d.tabSize,insertSpaces:d.insertSpaces};return w.trimTrailingWhitespace&&(x.trimTrailingWhitespace=!0),w.trimFinalNewlines&&(x.trimFinalNewlines=!0),w.insertFinalNewline&&(x.insertFinalNewline=!0),x}function rs(d){return{textDocument:i(d)}}function Li(d){return{textDocument:i(d)}}function ss(d){let w=L.DocumentLink.create(he(d.range));d.target&&(w.target=n(d.target)),d.tooltip!==void 0&&(w.tooltip=d.tooltip);let x=d instanceof lf.default?d:void 0;return x&&x.data&&(w.data=x.data),w}function Ni(d){return{textDocument:i(d)}}function Ui(d){let w={name:d.name,kind:bt(d.kind),uri:n(d.uri),range:he(d.range),selectionRange:he(d.selectionRange)};return d.detail!==void 0&&d.detail.length>0&&(w.detail=d.detail),d.tags!==void 0&&(w.tags=Me(d.tags)),d instanceof df.default&&d.data!==void 0&&(w.data=d.data),w}function os(d){let w={name:d.name,kind:bt(d.kind),uri:n(d.uri),range:he(d.range),selectionRange:he(d.selectionRange)};return d.detail!==void 0&&d.detail.length>0&&(w.detail=d.detail),d.tags!==void 0&&(w.tags=Me(d.tags)),d instanceof ff.default&&d.data!==void 0&&(w.data=d.data),w}function Jn(d){let w=d instanceof hf.default?{name:d.name,kind:bt(d.kind),location:d.hasRange?Kt(d.location):{uri:t(d.location.uri)},data:d.data}:{name:d.name,kind:bt(d.kind),location:Kt(d.location)};return d.tags!==void 0&&(w.tags=Me(d.tags)),d.containerName!==""&&(w.containerName=d.containerName),w}function as(d){let w=typeof d.label=="string"?d.label:d.label.map(Ki),x=L.InlayHint.create(Ct(d.position),w);return d.kind!==void 0&&(x.kind=d.kind),d.textEdits!==void 0&&(x.textEdits=ki(d.textEdits)),d.tooltip!==void 0&&(x.tooltip=Hi(d.tooltip)),d.paddingLeft!==void 0&&(x.paddingLeft=d.paddingLeft),d.paddingRight!==void 0&&(x.paddingRight=d.paddingRight),d instanceof pf.default&&d.data!==void 0&&(x.data=d.data),x}function Ki(d){let w=L.InlayHintLabelPart.create(d.value);return d.location!==void 0&&(w.location=Kt(d.location)),d.command!==void 0&&(w.command=$t(d.command)),d.tooltip!==void 0&&(w.tooltip=Hi(d.tooltip)),w}function Hi(d){return typeof d=="string"?d:{kind:L.MarkupKind.Markdown,value:d.value}}return{asUri:n,asTextDocumentIdentifier:i,asTextDocumentItem:s,asVersionedTextDocumentIdentifier:o,asOpenTextDocumentParams:a,asChangeTextDocumentParams:p,asCloseTextDocumentParams:h,asSaveTextDocumentParams:f,asWillSaveTextDocumentParams:g,asDidCreateFilesParams:v,asDidRenameFilesParams:_,asDidDeleteFilesParams:T,asWillCreateFilesParams:C,asWillRenameFilesParams:D,asWillDeleteFilesParams:F,asTextDocumentPositionParams:E,asCompletionParams:we,asSignatureHelpParams:Vr,asWorkerPosition:rn,asRange:he,asRanges:Gr,asPosition:Ct,asPositions:yn,asPositionsSync:Ri,asLocation:Kt,asDiagnosticSeverity:Hn,asDiagnosticTag:Wn,asDiagnostic:_n,asDiagnostics:wn,asDiagnosticsSync:$n,asCompletionItem:Wt,asTextEdit:Bn,asSymbolKind:bt,asSymbolTag:zn,asSymbolTags:Me,asReferenceParams:Xr,asCodeAction:Ve,asCodeActionSync:bn,asCodeActionContext:es,asCodeActionContextSync:ts,asInlineValueContext:qi,asCommand:$t,asCodeLens:Ai,asFormattingOptions:ji,asDocumentSymbolParams:rs,asCodeLensParams:Li,asDocumentLink:ss,asDocumentLinkParams:Ni,asCallHierarchyItem:Ui,asTypeHierarchyItem:os,asInlayHint:as,asWorkspaceSymbol:Jn,asInlineCompletionParams:ns,asInlineCompletionContext:Gn}}});var zc=M(Qe=>{"use strict";var mf=Qe&&Qe.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),vf=Qe&&Qe.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),tr=Qe&&Qe.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&mf(t,e,n[i]);return vf(t,e),t}})(),Gt=Qe&&Qe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Qe,"__esModule",{value:!0});Qe.createConverter=Tf;var R=tr(I("vscode")),A=tr(N()),Ae=tr(He()),z=tr(Qi()),yf=Gt(Os()),_f=Gt(xs()),wf=Gt(ks()),Cf=Gt(qs()),$c=js(),bf=Gt(Ns()),Sf=Gt(Ks()),Df=Gt(Ws()),Pf=Gt(Bs()),Bc=N(),er;(function(r){function e(t){let n=t;return n&&Ae.string(n.language)&&Ae.string(n.value)}r.is=e})(er||(er={}));function Tf(r,e,t,n){let s=r||(c=>R.Uri.parse(c));function o(c){return s(c)}function a(c){let y=[];for(let b of c)if(typeof b=="string")y.push(b);else if(Bc.NotebookCellTextDocumentFilter.is(b))if(typeof b.notebook=="string")y.push({notebookType:b.notebook,language:b.language});else{let O=b.notebook.notebookType??"*";y.push({notebookType:O,scheme:b.notebook.scheme,pattern:cs(b.notebook.pattern),language:b.language})}else Bc.TextDocumentFilter.is(b)&&y.push({language:b.language,scheme:b.scheme,pattern:cs(b.pattern)});return y}async function u(c,y){return z.map(c,p,y)}function l(c){let y=new Array(c.length);for(let b=0;b<c.length;b++)y[b]=p(c[b]);return y}function p(c){let y=typeof c.message=="string"?c.message:c.message.kind==="plaintext"?c.message.value:"Received a markup diagnostic message but the client does not support it.",b=new $c.ProtocolDiagnostic(v(c.range),y,T(c.severity),c.data);if(c.code!==void 0){if(typeof c.code=="string"||typeof c.code=="number")A.CodeDescription.is(c.codeDescription)?b.code={value:c.code,target:o(c.codeDescription.href)}:b.code=c.code;else if($c.DiagnosticCode.is(c.code)){b.hasDiagnosticCode=!0;let O=c.code;b.code={value:O.value,target:o(O.target)}}}return c.source&&(b.source=c.source),c.relatedInformation&&(b.relatedInformation=h(c.relatedInformation)),Array.isArray(c.tags)&&(b.tags=f(c.tags)),b}function h(c){let y=new Array(c.length);for(let b=0;b<c.length;b++){let O=c[b];y[b]=new R.DiagnosticRelatedInformation(Ht(O.location),O.message)}return y}function f(c){if(!c)return;let y=[];for(let b of c){let O=m(b);O!==void 0&&y.push(O)}return y.length>0?y:void 0}function m(c){switch(c){case A.DiagnosticTag.Unnecessary:return R.DiagnosticTag.Unnecessary;case A.DiagnosticTag.Deprecated:return R.DiagnosticTag.Deprecated;default:return}}function g(c){return c?new R.Position(c.line,c.character):void 0}function v(c){return c?new R.Range(c.start.line,c.start.character,c.end.line,c.end.character):void 0}async function _(c,y){return z.map(c,b=>new R.Range(b.start.line,b.start.character,b.end.line,b.end.character),y)}function T(c){if(c==null)return R.DiagnosticSeverity.Error;switch(c){case A.DiagnosticSeverity.Error:return R.DiagnosticSeverity.Error;case A.DiagnosticSeverity.Warning:return R.DiagnosticSeverity.Warning;case A.DiagnosticSeverity.Information:return R.DiagnosticSeverity.Information;case A.DiagnosticSeverity.Hint:return R.DiagnosticSeverity.Hint}return R.DiagnosticSeverity.Error}function C(c){if(Ae.string(c))return F(c);if(er.is(c))return F().appendCodeblock(c.value,c.language);if(Array.isArray(c)){let y=[];for(let b of c){let O=F();er.is(b)?O.appendCodeblock(b.value,b.language):O.appendMarkdown(b),y.push(O)}return y}else return F(c)}function D(c){if(Ae.string(c))return c;switch(c.kind){case A.MarkupKind.Markdown:return F(c.value);case A.MarkupKind.PlainText:return c.value;default:return`Unsupported Markup content received. Kind is: ${c.kind}`}}function F(c){let y;if(c===void 0||typeof c=="string")y=new R.MarkdownString(c);else switch(c.kind){case A.MarkupKind.Markdown:y=new R.MarkdownString(c.value);break;case A.MarkupKind.PlainText:y=new R.MarkdownString,y.appendText(c.value);break;default:y=new R.MarkdownString,y.appendText(`Unsupported Markup content received. Kind is: ${c.kind}`);break}return y.isTrusted=e,y.supportHtml=t,y.supportThemeIcons=n,y}function E(c){if(c)return new R.Hover(C(c.contents),v(c.range))}async function Q(c,y,b){if(!c)return;if(Array.isArray(c))return z.map(c,Dt=>Kn(Dt,y),b);let O=c,{defaultRange:oe,commitCharacters:fe}=we(O,y),X=await z.map(O.items,Dt=>Kn(Dt,fe,O.applyKind?.commitCharacters,oe,O.itemDefaults?.insertTextMode,O.itemDefaults?.insertTextFormat,O.itemDefaults?.data,O.applyKind?.data),b);return new R.CompletionList(X,O.isIncomplete)}function we(c,y){let b=c.itemDefaults?.editRange,O=c.itemDefaults?.commitCharacters??y;return A.Range.is(b)?{defaultRange:v(b),commitCharacters:O}:b!==void 0?{defaultRange:{inserting:v(b.insert),replacing:v(b.replace)},commitCharacters:O}:{defaultRange:void 0,commitCharacters:O}}function xe(c){return A.CompletionItemKind.Text<=c&&c<=A.CompletionItemKind.TypeParameter?[c-1,void 0]:[R.CompletionItemKind.Text,c]}function Un(c){if(c===A.CompletionItemTag.Deprecated)return R.CompletionItemTag.Deprecated}function $r(c){if(c==null)return[];let y=[];for(let b of c){let O=Un(b);O!==void 0&&y.push(O)}return y}function Kn(c,y,b,O,oe,fe,X,Dt){let Bt=$r(c.tags),Ue=Vr(c),pe=new yf.default(Ue);c.detail&&(pe.detail=c.detail),c.documentation&&(pe.documentation=D(c.documentation),pe.documentationFormat=Ae.string(c.documentation)?"$string":c.documentation.kind),c.filterText&&(pe.filterText=c.filterText);let Wi=rn(c,O,fe);if(Wi&&(pe.insertText=Wi.text,pe.range=Wi.range,pe.fromEdit=Wi.fromEdit),Ae.number(c.kind)){let[ed,Cc]=xe(c.kind);pe.kind=ed,Cc&&(pe.originalItemKind=Cc)}c.sortText&&(pe.sortText=c.sortText),c.additionalTextEdits&&(pe.additionalTextEdits=he(c.additionalTextEdits));let _c=Br(c,y,b);_c&&(pe.commitCharacters=_c.slice()),c.command&&(pe.command=Me(c.command)),(c.deprecated===!0||c.deprecated===!1)&&(pe.deprecated=c.deprecated,c.deprecated===!0&&Bt.push(R.CompletionItemTag.Deprecated)),(c.preselect===!0||c.preselect===!1)&&(pe.preselect=c.preselect);let wc=zr(c,X,Dt);wc!==void 0&&(pe.data=wc),Bt.length>0&&(pe.tags=Bt);let ls=c.insertTextMode??oe;return ls!==void 0&&(pe.insertTextMode=ls,ls===A.InsertTextMode.asIs&&(pe.keepWhitespace=!0)),pe}function Br(c,y,b){if(b===A.ApplyKind.Merge){if(!y&&!c.commitCharacters)return;let O=new Set;if(y)for(let oe of y)O.add(oe);if(Ae.stringArray(c.commitCharacters))for(let oe of c.commitCharacters)O.add(oe);return Array.from(O)}return c.commitCharacters!==void 0?Ae.stringArray(c.commitCharacters)?c.commitCharacters:void 0:y}function zr(c,y,b){if(b===A.ApplyKind.Merge){let O={...y};return c.data&&Object.entries(c.data).forEach(([oe,fe])=>{fe!=null&&(O[oe]=fe)}),O}return c.data??y}function Vr(c){return A.CompletionItemLabelDetails.is(c.labelDetails)?{label:c.label,detail:c.labelDetails.detail,description:c.labelDetails.description}:c.label}function rn(c,y,b){let O=c.insertTextFormat??b;if(c.textEdit!==void 0||y!==void 0){let[oe,fe]=c.textEdit!==void 0?Ct(c.textEdit):[y,c.textEditText??c.label];return O===A.InsertTextFormat.Snippet?{text:new R.SnippetString(fe),range:oe,fromEdit:!0}:{text:fe,range:oe,fromEdit:!0}}else return c.insertText?O===A.InsertTextFormat.Snippet?{text:new R.SnippetString(c.insertText),fromEdit:!1}:{text:c.insertText,fromEdit:!1}:void 0}function Ct(c){return A.InsertReplaceEdit.is(c)?[{inserting:v(c.insert),replacing:v(c.replace)},c.newText]:[v(c.range),c.newText]}function yn(c){if(c)return new R.TextEdit(v(c.range),c.newText)}async function Ri(c,y){if(c)return z.map(c,yn,y)}function he(c){if(!c)return;let y=new Array(c.length);for(let b=0;b<c.length;b++)y[b]=yn(c[b]);return y}async function Gr(c,y){if(!c)return;let b=new R.SignatureHelp;return Ae.number(c.activeSignature)?b.activeSignature=c.activeSignature:b.activeSignature=0,Ae.number(c.activeParameter)?b.activeParameter=c.activeParameter:c.activeParameter===null?b.activeParameter=-1:b.activeParameter=0,c.signatures&&(b.signatures=await Kt(c.signatures,y)),b}async function Kt(c,y){return z.mapAsync(c,Hn,y)}async function Hn(c,y){let b=new R.SignatureInformation(c.label);return c.documentation!==void 0&&(b.documentation=D(c.documentation)),c.parameters!==void 0&&(b.parameters=await Oi(c.parameters,y)),c.activeParameter!==void 0&&(b.activeParameter=c.activeParameter??-1),b}function Oi(c,y){return z.map(c,Wn,y)}function Wn(c){let y=new R.ParameterInformation(c.label);return c.documentation&&(y.documentation=D(c.documentation)),y}function Ht(c){return c?new R.Location(s(c.uri),v(c.range)):void 0}async function Jr(c,y){if(c)return wn(c,y)}async function Yr(c,y){if(c)return wn(c,y)}function _n(c){if(!c)return;let y={targetUri:s(c.targetUri),targetRange:v(c.targetRange),originSelectionRange:v(c.originSelectionRange),targetSelectionRange:v(c.targetSelectionRange)};if(!y.targetSelectionRange)throw new Error("targetSelectionRange must not be undefined or null");return y}async function wn(c,y){if(c)if(Ae.array(c)){if(c.length===0)return[];if(A.LocationLink.is(c[0])){let b=c;return z.map(b,_n,y)}else{let b=c;return z.map(b,Ht,y)}}else return A.LocationLink.is(c)?[_n(c)]:Ht(c)}async function $n(c,y){if(c)return z.map(c,Ht,y)}async function Qr(c,y){if(c)return z.map(c,Fi,y)}function Fi(c){let y=new R.DocumentHighlight(v(c.range));return Ae.number(c.kind)&&(y.kind=xi(c.kind)),y}function xi(c){switch(c){case A.DocumentHighlightKind.Text:return R.DocumentHighlightKind.Text;case A.DocumentHighlightKind.Read:return R.DocumentHighlightKind.Read;case A.DocumentHighlightKind.Write:return R.DocumentHighlightKind.Write}return R.DocumentHighlightKind.Text}async function Zr(c,y){if(c)return z.map(c,Bn,y)}function Wt(c){return c<=A.SymbolKind.TypeParameter?c-1:R.SymbolKind.Property}function Mi(c){if(c===A.SymbolTag.Deprecated)return R.SymbolTag.Deprecated}function Cn(c){if(c==null)return;let y=[];for(let b of c){let O=Mi(b);O!==void 0&&y.push(O)}return y.length===0?void 0:y}function Bn(c){let y=c.data,b=c.location,O=b.range===void 0||y!==void 0?new Df.default(c.name,Wt(c.kind),c.containerName??"",b.range===void 0?s(b.uri):new R.Location(s(c.location.uri),v(b.range)),y):new R.SymbolInformation(c.name,Wt(c.kind),c.containerName??"",new R.Location(s(c.location.uri),v(b.range)));return zn(O,c),O}async function ki(c,y){if(c!=null)return z.map(c,bt,y)}function bt(c){let y=new R.DocumentSymbol(c.name,c.detail||"",Wt(c.kind),v(c.range),v(c.selectionRange));if(zn(y,c),c.children!==void 0&&c.children.length>0){let b=[];for(let O of c.children)b.push(bt(O));y.children=b}return y}function zn(c,y){c.tags=Cn(y.tags),y.deprecated&&(c.tags?c.tags.includes(R.SymbolTag.Deprecated)||(c.tags=c.tags.concat(R.SymbolTag.Deprecated)):c.tags=[R.SymbolTag.Deprecated])}function Me(c){let y={title:c.title,command:c.command};return c.tooltip&&(y.tooltip=c.tooltip),c.arguments&&(y.arguments=c.arguments),y}async function Xr(c,y){if(c)return z.map(c,Me,y)}let Ve=new Map;Ve.set(A.CodeActionKind.Empty,R.CodeActionKind.Empty),Ve.set(A.CodeActionKind.QuickFix,R.CodeActionKind.QuickFix),Ve.set(A.CodeActionKind.Refactor,R.CodeActionKind.Refactor),Ve.set(A.CodeActionKind.RefactorExtract,R.CodeActionKind.RefactorExtract),Ve.set(A.CodeActionKind.RefactorInline,R.CodeActionKind.RefactorInline),Ve.set(A.CodeActionKind.RefactorRewrite,R.CodeActionKind.RefactorRewrite),Ve.set(A.CodeActionKind.Source,R.CodeActionKind.Source),Ve.set(A.CodeActionKind.SourceOrganizeImports,R.CodeActionKind.SourceOrganizeImports);function bn(c){if(c==null)return;let y=Ve.get(c);if(y)return y;let b=c.split(".");y=R.CodeActionKind.Empty;for(let O of b)y=y.append(O);return y}function es(c){if(c!=null)return c.map(y=>bn(y))}function ts(c){if(c!=null)return c.map(y=>({kind:bn(y.kind),command:Me(y.command)}))}async function Vn(c,y){if(c==null)return;let b=new Cf.default(c.title,c.data);return c.kind!==void 0&&(b.kind=bn(c.kind)),c.diagnostics!==void 0&&(b.diagnostics=l(c.diagnostics)),c.edit!==void 0&&(b.edit=await Gn(c.edit,y)),c.command!==void 0&&(b.command=Me(c.command)),c.isPreferred!==void 0&&(b.isPreferred=c.isPreferred),c.disabled!==void 0&&(b.disabled={reason:c.disabled.reason}),c.tags?.includes(A.CodeActionTag.LLMGenerated)&&(b.isAI=!0),b}function Ei(c,y){return z.mapAsync(c,async b=>A.Command.is(b)?Me(b):Vn(b,y),y)}function qi(c){if(!c)return;let y=new _f.default(v(c.range));return c.command&&(y.command=Me(c.command)),c.data!==void 0&&c.data!==null&&(y.data=c.data),y}async function ns(c,y){if(c)return z.map(c,qi,y)}async function Gn(c,y){if(!c)return;let b=new Map;if(c.changeAnnotations!==void 0){let fe=c.changeAnnotations;await z.forEach(Object.keys(fe),X=>{let Dt=is(fe[X]);b.set(X,Dt)},y)}let O=fe=>{if(fe!==void 0)return b.get(fe)},oe=new R.WorkspaceEdit;if(c.documentChanges){let fe=c.documentChanges;await z.forEach(fe,X=>{if(A.CreateFile.is(X))oe.createFile(s(X.uri),X.options,O(X.annotationId));else if(A.RenameFile.is(X))oe.renameFile(s(X.oldUri),s(X.newUri),X.options,O(X.annotationId));else if(A.DeleteFile.is(X))oe.deleteFile(s(X.uri),X.options,O(X.annotationId));else if(A.TextDocumentEdit.is(X)){let Dt=s(X.textDocument.uri),Bt=[];for(let Ue of X.edits)A.AnnotatedTextEdit.is(Ue)?Bt.push([new R.TextEdit(v(Ue.range),Ue.newText),O(Ue.annotationId)]):A.SnippetTextEdit.is(Ue)?Bt.push([new R.SnippetTextEdit(v(Ue.range),new R.SnippetString(Ue.snippet.value)),O(Ue.annotationId)]):Bt.push([new R.TextEdit(v(Ue.range),Ue.newText),void 0]);oe.set(Dt,Bt)}else throw new Error(`Unknown workspace edit change received:
|
|
8
|
-
${JSON.stringify(X,void 0,4)}`)},y)}else if(c.changes){let fe=c.changes;await z.forEach(Object.keys(fe),X=>{oe.set(s(X),he(fe[X]))},y)}return oe}function is(c){if(c!==void 0)return{label:c.label,needsConfirmation:!!c.needsConfirmation,description:c.description}}function Ii(c){let y=v(c.range),b=c.target?o(c.target):void 0,O=new wf.default(y,b);return c.tooltip!==void 0&&(O.tooltip=c.tooltip),c.data!==void 0&&c.data!==null&&(O.data=c.data),O}async function $t(c,y){if(c)return z.map(c,Ii,y)}function Ai(c){return new R.Color(c.red,c.green,c.blue,c.alpha)}function ji(c){return new R.ColorInformation(v(c.range),Ai(c.color))}async function rs(c,y){if(c)return z.map(c,ji,y)}function Li(c){let y=new R.ColorPresentation(c.label);return y.additionalTextEdits=he(c.additionalTextEdits),c.textEdit&&(y.textEdit=yn(c.textEdit)),y}async function ss(c,y){if(c)return z.map(c,Li,y)}function Ni(c){if(c)switch(c){case A.FoldingRangeKind.Comment:return R.FoldingRangeKind.Comment;case A.FoldingRangeKind.Imports:return R.FoldingRangeKind.Imports;case A.FoldingRangeKind.Region:return R.FoldingRangeKind.Region}}function Ui(c){return new R.FoldingRange(c.startLine,c.endLine,Ni(c.kind))}async function os(c,y){if(c)return z.map(c,Ui,y)}function Jn(c){return new R.SelectionRange(v(c.range),c.parent?Jn(c.parent):void 0)}async function as(c,y){return Array.isArray(c)?z.map(c,Jn,y):[]}function Ki(c){return A.InlineValueText.is(c)?new R.InlineValueText(v(c.range),c.text):A.InlineValueVariableLookup.is(c)?new R.InlineValueVariableLookup(v(c.range),c.variableName,c.caseSensitiveLookup):new R.InlineValueEvaluatableExpression(v(c.range),c.expression)}async function Hi(c,y){return Array.isArray(c)?z.map(c,Ki,y):[]}async function d(c,y){let b=typeof c.label=="string"?c.label:await z.map(c.label,w,y),O=new Pf.default(g(c.position),b);return c.kind!==void 0&&(O.kind=c.kind),c.textEdits!==void 0&&(O.textEdits=await Ri(c.textEdits,y)),c.tooltip!==void 0&&(O.tooltip=x(c.tooltip)),c.paddingLeft!==void 0&&(O.paddingLeft=c.paddingLeft),c.paddingRight!==void 0&&(O.paddingRight=c.paddingRight),c.data!==void 0&&(O.data=c.data),O}function w(c){let y=new R.InlayHintLabelPart(c.value);return c.location!==void 0&&(y.location=Ht(c.location)),c.tooltip!==void 0&&(y.tooltip=x(c.tooltip)),c.command!==void 0&&(y.command=Me(c.command)),y}function x(c){return typeof c=="string"?c:F(c)}async function Z(c,y){if(Array.isArray(c))return z.mapAsync(c,d,y)}function V(c){if(c===null)return;let y=new bf.default(Wt(c.kind),c.name,c.detail||"",o(c.uri),v(c.range),v(c.selectionRange),c.data);return c.tags!==void 0&&(y.tags=Cn(c.tags)),y}async function De(c,y){if(c!==null)return z.map(c,V,y)}async function ke(c,y){return new R.CallHierarchyIncomingCall(V(c.from),await _(c.fromRanges,y))}async function St(c,y){if(c!==null)return z.mapAsync(c,ke,y)}async function mc(c,y){return new R.CallHierarchyOutgoingCall(V(c.to),await _(c.fromRanges,y))}async function zl(c,y){if(c!==null)return z.mapAsync(c,mc,y)}async function Vl(c,y){if(c!=null)return new R.SemanticTokens(new Uint32Array(c.data),c.resultId)}function vc(c){return new R.SemanticTokensEdit(c.start,c.deleteCount,c.data!==void 0?new Uint32Array(c.data):void 0)}async function Gl(c,y){if(c!=null)return new R.SemanticTokensEdits(c.edits.map(vc),c.resultId)}function Jl(c){return c}async function Yl(c,y){if(c!=null)return new R.LinkedEditingRanges(await _(c.ranges,y),Ql(c.wordPattern))}function Ql(c){if(c!=null)return new RegExp(c)}function yc(c){if(c===null)return;let y=new Sf.default(Wt(c.kind),c.name,c.detail||"",o(c.uri),v(c.range),v(c.selectionRange),c.data);return c.tags!==void 0&&(y.tags=Cn(c.tags)),y}async function Zl(c,y){if(c!==null)return z.map(c,yc,y)}function cs(c){if(Ae.string(c))return c;if(A.RelativePattern.is(c)){if(A.URI.is(c.baseUri))return new R.RelativePattern(o(c.baseUri),c.pattern);if(A.WorkspaceFolder.is(c.baseUri)){let y=R.workspace.getWorkspaceFolder(o(c.baseUri.uri));return y!==void 0?new R.RelativePattern(y,c.pattern):void 0}}}async function Xl(c,y){if(!c)return;if(Array.isArray(c))return z.map(c,oe=>us(oe),y);let b=c,O=await z.map(b.items,oe=>us(oe),y);return new R.InlineCompletionList(O)}function us(c){let y;typeof c.insertText=="string"?y=c.insertText:y=new R.SnippetString(c.insertText.value);let b;c.command&&(b=Me(c.command));let O=new R.InlineCompletionItem(y,v(c.range),b);return c.filterText&&(O.filterText=c.filterText),O}return{asUri:o,asDocumentSelector:a,asDiagnostics:u,asDiagnostic:p,asRange:v,asRanges:_,asPosition:g,asDiagnosticSeverity:T,asDiagnosticTag:m,asHover:E,asCompletionResult:Q,asCompletionItem:Kn,asTextEdit:yn,asTextEdits:Ri,asSignatureHelp:Gr,asSignatureInformations:Kt,asSignatureInformation:Hn,asParameterInformations:Oi,asParameterInformation:Wn,asDeclarationResult:Jr,asDefinitionResult:Yr,asLocation:Ht,asReferences:$n,asDocumentHighlights:Qr,asDocumentHighlight:Fi,asDocumentHighlightKind:xi,asSymbolKind:Wt,asSymbolTag:Mi,asSymbolTags:Cn,asSymbolInformations:Zr,asSymbolInformation:Bn,asDocumentSymbols:ki,asDocumentSymbol:bt,asCommand:Me,asCommands:Xr,asCodeAction:Vn,asCodeActionKind:bn,asCodeActionKinds:es,asCodeActionDocumentations:ts,asCodeActionResult:Ei,asCodeLens:qi,asCodeLenses:ns,asWorkspaceEdit:Gn,asDocumentLink:Ii,asDocumentLinks:$t,asFoldingRangeKind:Ni,asFoldingRange:Ui,asFoldingRanges:os,asColor:Ai,asColorInformation:ji,asColorInformations:rs,asColorPresentation:Li,asColorPresentations:ss,asSelectionRange:Jn,asSelectionRanges:as,asInlineValue:Ki,asInlineValues:Hi,asInlayHint:d,asInlayHints:Z,asSemanticTokensLegend:Jl,asSemanticTokens:Vl,asSemanticTokensEdit:vc,asSemanticTokensEdits:Gl,asCallHierarchyItem:V,asCallHierarchyItems:De,asCallHierarchyIncomingCall:ke,asCallHierarchyIncomingCalls:St,asCallHierarchyOutgoingCall:mc,asCallHierarchyOutgoingCalls:zl,asLinkedEditingRanges:Yl,asTypeHierarchyItem:yc,asTypeHierarchyItems:Zl,asGlobPattern:cs,asInlineCompletionResult:Xl,asInlineCompletionItem:us}}});var ne=M(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Jt.empty=void 0;Jt.v4=Vc;Jt.isUUID=Gc;Jt.parse=Of;Jt.generateUuid=Ff;var ii=class{_value;constructor(e){this._value=e}asHex(){return this._value}equals(e){return this.asHex()===e.asHex()}},Vs=class r extends ii{static _chars=["0","1","2","3","4","5","6","6","7","8","9","a","b","c","d","e","f"];static _timeHighBits=["8","9","a","b"];static _oneOf(e){return e[Math.floor(e.length*Math.random())]}static _randomHex(){return r._oneOf(r._chars)}constructor(){super([r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),"-",r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),"-","4",r._randomHex(),r._randomHex(),r._randomHex(),"-",r._oneOf(r._timeHighBits),r._randomHex(),r._randomHex(),r._randomHex(),"-",r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex()].join(""))}};Jt.empty=new ii("00000000-0000-0000-0000-000000000000");function Vc(){return new Vs}var Rf=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Gc(r){return Rf.test(r)}function Of(r){if(!Gc(r))throw new Error("invalid uuid");return new ii(r)}function Ff(){return Vc().asHex()}});var Js=M(it=>{"use strict";var xf=it&&it.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Mf=it&&it.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),kf=it&&it.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&xf(t,e,n[i]);return Mf(t,e),t}})();Object.defineProperty(it,"__esModule",{value:!0});it.ProgressPart=void 0;var Jc=I("vscode"),Yc=N(),Qc=kf(He()),Gs=class{_client;_token;_infinite;_reported;_lspProgressDisposable;_progress;_cancellationToken;_tokenDisposable;_resolve;_reject;constructor(e,t,n){this._client=e,this._token=t,this._reported=0,this._infinite=!1,this._lspProgressDisposable=this._client.onProgress(Yc.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&&Jc.window.withProgress({location:Jc.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(Yc.WorkDoneProgressCancelNotification.type,{token:this._token})}),this.report(e),new Promise((i,s)=>{this._resolve=i,this._reject=s})})}report(e){if(this._infinite&&Qc.string(e.message))this._progress!==void 0&&this._progress.report({message:e.message});else if(Qc.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}};it.ProgressPart=Gs});var B=M(ae=>{"use strict";var Ef=ae&&ae.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),qf=ae&&ae.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),tu=ae&&ae.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Ef(t,e,n[i]);return qf(t,e),t}})();Object.defineProperty(ae,"__esModule",{value:!0});ae.WorkspaceFeature=ae.TextDocumentLanguageFeature=ae.TextDocumentEventFeature=ae.DynamicDocumentFeature=ae.DynamicFeature=ae.StaticFeature=ae.LSPCancellationError=void 0;ae.ensure=If;var Yt=I("vscode"),Ys=N(),Fe=tu(He()),Zc=tu(ne()),Qs=class extends Yt.CancellationError{data;constructor(e){super(),this.data=e}};ae.LSPCancellationError=Qs;function If(r,e){return r[e]===void 0&&(r[e]={}),r[e]}var Xc;(function(r){function e(t){let n=t;return n!=null&&Fe.func(n.fillClientCapabilities)&&Fe.func(n.initialize)&&Fe.func(n.getState)&&Fe.func(n.clear)&&(n.fillInitializeParams===void 0||Fe.func(n.fillInitializeParams))}r.is=e})(Xc||(ae.StaticFeature=Xc={}));var eu;(function(r){function e(t){let n=t;return n!=null&&Fe.func(n.fillClientCapabilities)&&Fe.func(n.initialize)&&Fe.func(n.getState)&&Fe.func(n.clear)&&(n.fillInitializeParams===void 0||Fe.func(n.fillInitializeParams))&&Fe.func(n.register)&&Fe.func(n.unregister)&&n.registrationType!==void 0}r.is=e})(eu||(ae.DynamicFeature=eu={}));var ri=class{_client;constructor(e){this._client=e}getState(){let e=this.getDocumentSelectors(),t=0;for(let i of e){t++;for(let s of Yt.workspace.textDocuments)if(Yt.languages.match(i,s)>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}}};ae.DynamicDocumentFeature=ri;var Zs=class extends ri{_event;_type;_middleware;_createParams;_textDocument;_selectorFilter;_listener;_selectors;_onNotificationSent;static textDocumentFilter(e,t){for(let n of e)if(Yt.languages.match(n,t)>0)return!0;return!1}constructor(e,t,n,i,s,o,a){super(e),this._event=t,this._type=n,this._middleware=i,this._createParams=s,this._textDocument=o,this._selectorFilter=a,this._selectors=new Map,this._onNotificationSent=new Yt.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._onNotificationSent=new Yt.EventEmitter,this._listener&&(this._listener.dispose(),this._listener=void 0)}getProvider(e){for(let t of this._selectors.values())if(Yt.languages.match(t,e)>0)return{send:n=>this.callback(n)}}};ae.TextDocumentEventFeature=Zs;var Xs=class extends ri{_registrationType;_registrations;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&&(this._registrations.delete(e),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:Zc.generateUuid(),i=t.documentSelector??e;if(i)return[n,Object.assign({},t,{documentSelector:i})]}else if(Fe.boolean(t)&&t===!0||Ys.WorkDoneProgressOptions.is(t)){if(!e)return[void 0,void 0];let n=Fe.boolean(t)&&t===!0?{documentSelector:e}:Object.assign({},t,{documentSelector:e});return[Zc.generateUuid(),n]}}else return[void 0,void 0];return[void 0,void 0]}getRegistrationOptions(e,t){if(!(!e||!t))return Fe.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&&Yt.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}};ae.TextDocumentLanguageFeature=Xs;var eo=class{_client;_registrationType;_registrations;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&&(this._registrations.delete(e),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}};ae.WorkspaceFeature=eo});var iu=M(cn=>{"use strict";Object.defineProperty(cn,"__esModule",{value:!0});cn.range=cn.balanced=void 0;var Af=(r,e,t)=>{let n=r instanceof RegExp?nu(r,t):r,i=e instanceof RegExp?nu(e,t):e,s=n!==null&&i!=null&&(0,cn.range)(n,i,t);return s&&{start:s[0],end:s[1],pre:t.slice(0,s[0]),body:t.slice(s[0]+n.length,s[1]),post:t.slice(s[1]+i.length)}};cn.balanced=Af;var nu=(r,e)=>{let t=e.match(r);return t?t[0]:null},jf=(r,e,t)=>{let n,i,s,o,a,u=t.indexOf(r),l=t.indexOf(e,u+1),p=u;if(u>=0&&l>0){if(r===e)return[u,l];for(n=[],s=t.length;p>=0&&!a;){if(p===u)n.push(p),u=t.indexOf(r,p+1);else if(n.length===1){let h=n.pop();h!==void 0&&(a=[h,l])}else i=n.pop(),i!==void 0&&i<s&&(s=i,o=l),l=t.indexOf(e,p+1);p=u<l&&u>=0?u:l}n.length&&o!==void 0&&(a=[s,o])}return a};cn.range=jf});var lu=M(Tn=>{"use strict";Object.defineProperty(Tn,"__esModule",{value:!0});Tn.EXPANSION_MAX=void 0;Tn.expand=Yf;var ru=iu(),su="\0SLASH"+Math.random()+"\0",ou="\0OPEN"+Math.random()+"\0",no="\0CLOSE"+Math.random()+"\0",au="\0COMMA"+Math.random()+"\0",cu="\0PERIOD"+Math.random()+"\0",Lf=new RegExp(su,"g"),Nf=new RegExp(ou,"g"),Uf=new RegExp(no,"g"),Kf=new RegExp(au,"g"),Hf=new RegExp(cu,"g"),Wf=/\\\\/g,$f=/\\{/g,Bf=/\\}/g,zf=/\\,/g,Vf=/\\\./g;Tn.EXPANSION_MAX=1e5;function to(r){return isNaN(r)?r.charCodeAt(0):parseInt(r,10)}function Gf(r){return r.replace(Wf,su).replace($f,ou).replace(Bf,no).replace(zf,au).replace(Vf,cu)}function Jf(r){return r.replace(Lf,"\\").replace(Nf,"{").replace(Uf,"}").replace(Kf,",").replace(Hf,".")}function uu(r){if(!r)return[""];let e=[],t=(0,ru.balanced)("{","}",r);if(!t)return r.split(",");let{pre:n,body:i,post:s}=t,o=n.split(",");o[o.length-1]+="{"+i+"}";let a=uu(s);return s.length&&(o[o.length-1]+=a.shift(),o.push.apply(o,a)),e.push.apply(e,o),e}function Yf(r,e={}){if(!r)return[];let{max:t=Tn.EXPANSION_MAX}=e;return r.slice(0,2)==="{}"&&(r="\\{\\}"+r.slice(2)),si(Gf(r),t,!0).map(Jf)}function Qf(r){return"{"+r+"}"}function Zf(r){return/^-?0\d/.test(r)}function Xf(r,e){return r<=e}function eh(r,e){return r>=e}function si(r,e,t){let n=[],i=(0,ru.balanced)("{","}",r);if(!i)return[r];let s=i.pre,o=i.post.length?si(i.post,e,!1):[""];if(/\$$/.test(i.pre))for(let a=0;a<o.length&&a<e;a++){let u=s+"{"+i.body+"}"+o[a];n.push(u)}else{let a=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),u=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),l=a||u,p=i.body.indexOf(",")>=0;if(!l&&!p)return i.post.match(/,(?!,).*\}/)?(r=i.pre+"{"+i.body+no+i.post,si(r,e,!0)):[r];let h;if(l)h=i.body.split(/\.\./);else if(h=uu(i.body),h.length===1&&h[0]!==void 0&&(h=si(h[0],e,!1).map(Qf),h.length===1))return o.map(m=>i.pre+h[0]+m);let f;if(l&&h[0]!==void 0&&h[1]!==void 0){let m=to(h[0]),g=to(h[1]),v=Math.max(h[0].length,h[1].length),_=h.length===3&&h[2]!==void 0?Math.max(Math.abs(to(h[2])),1):1,T=Xf;g<m&&(_*=-1,T=eh);let D=h.some(Zf);f=[];for(let F=m;T(F,g)&&f.length<e;F+=_){let E;if(u)E=String.fromCharCode(F),E==="\\"&&(E="");else if(E=String(F),D){let Q=v-E.length;if(Q>0){let we=new Array(Q+1).join("0");F<0?E="-"+we+E.slice(1):E=we+E}}f.push(E)}}else{f=[];for(let m=0;m<h.length;m++)f.push.apply(f,si(h[m],e,!1))}for(let m=0;m<f.length;m++)for(let g=0;g<o.length&&n.length<e;g++){let v=s+f[m]+o[g];(!t||l||v)&&n.push(v)}}return n}});var du=M(nr=>{"use strict";Object.defineProperty(nr,"__esModule",{value:!0});nr.assertValidPattern=void 0;var th=1024*64,nh=r=>{if(typeof r!="string")throw new TypeError("invalid pattern");if(r.length>th)throw new TypeError("pattern is too long")};nr.assertValidPattern=nh});var hu=M(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.parseClass=void 0;var ih={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},oi=r=>r.replace(/[[\]\\-]/g,"\\$&"),rh=r=>r.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),fu=r=>r.join(""),sh=(r,e)=>{let t=e;if(r.charAt(t)!=="[")throw new Error("not in a brace expression");let n=[],i=[],s=t+1,o=!1,a=!1,u=!1,l=!1,p=t,h="";e:for(;s<r.length;){let v=r.charAt(s);if((v==="!"||v==="^")&&s===t+1){l=!0,s++;continue}if(v==="]"&&o&&!u){p=s+1;break}if(o=!0,v==="\\"&&!u){u=!0,s++;continue}if(v==="["&&!u){for(let[_,[T,C,D]]of Object.entries(ih))if(r.startsWith(_,s)){if(h)return["$.",!1,r.length-t,!0];s+=_.length,D?i.push(T):n.push(T),a=a||C;continue e}}if(u=!1,h){v>h?n.push(oi(h)+"-"+oi(v)):v===h&&n.push(oi(v)),h="",s++;continue}if(r.startsWith("-]",s+1)){n.push(oi(v+"-")),s+=2;continue}if(r.startsWith("-",s+1)){h=v,s+=2;continue}n.push(oi(v)),s++}if(p<s)return["",!1,0,!1];if(!n.length&&!i.length)return["$.",!1,r.length-t,!0];if(i.length===0&&n.length===1&&/^\\?.$/.test(n[0])&&!l){let v=n[0].length===2?n[0].slice(-1):n[0];return[rh(v),!1,p-t,!1]}let f="["+(l?"^":"")+fu(n)+"]",m="["+(l?"":"^")+fu(i)+"]";return[n.length&&i.length?"("+f+"|"+m+")":n.length?f:m,a,p-t,!0]};ir.parseClass=sh});var sr=M(rr=>{"use strict";Object.defineProperty(rr,"__esModule",{value:!0});rr.unescape=void 0;var oh=(r,{windowsPathsNoEscape:e=!1,magicalBraces:t=!0}={})=>t?e?r.replace(/\[([^/\\])\]/g,"$1"):r.replace(/((?!\\).|^)\[([^/\\])\]/g,"$1$2").replace(/\\([^/])/g,"$1"):e?r.replace(/\[([^/\\{}])\]/g,"$1"):r.replace(/((?!\\).|^)\[([^/\\{}])\]/g,"$1$2").replace(/\\([^/{}])/g,"$1");rr.unescape=oh});var so=M(ur=>{"use strict";var Ee;Object.defineProperty(ur,"__esModule",{value:!0});ur.AST=void 0;var ah=hu(),or=sr(),ch=new Set(["!","?","+","*","@"]),io=r=>ch.has(r),pu=r=>io(r.type),uh=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),lh=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),dh=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),gu=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),fh="(?!(?:^|/)\\.\\.?(?:$|/))",ar="(?!\\.)",hh=new Set(["[","."]),ph=new Set(["..","."]),gh=new Set("().*{}+?[]^$\\!"),mh=r=>r.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),ro="[^/]",mu=ro+"*?",vu=ro+"+?",vh=0,cr=class{type;#n;#i;#r=!1;#e=[];#t;#a;#u;#c=!1;#s;#o;#l=!1;id=++vh;get depth(){return(this.#t?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#n.id,parent:this.#t?.id,depth:this.depth,partsLength:this.#e.length,parts:this.#e}}constructor(e,t,n={}){this.type=e,e&&(this.#i=!0),this.#t=t,this.#n=this.#t?this.#t.#n:this,this.#s=this.#n===this?n:this.#n.#s,this.#u=this.#n===this?[]:this.#n.#u,e==="!"&&!this.#n.#c&&this.#u.push(this),this.#a=this.#t?this.#t.#e.length:0}get hasMagic(){if(this.#i!==void 0)return this.#i;for(let e of this.#e)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#i=!0;return this.#i}toString(){return this.#o!==void 0?this.#o:this.type?this.#o=this.type+"("+this.#e.map(e=>String(e)).join("|")+")":this.#o=this.#e.map(e=>String(e)).join("")}#v(){if(this!==this.#n)throw new Error("should only call on root");if(this.#c)return this;this.toString(),this.#c=!0;let e;for(;e=this.#u.pop();){if(e.type!=="!")continue;let t=e,n=t.#t;for(;n;){for(let i=t.#a+1;!n.type&&i<n.#e.length;i++)for(let s of e.#e){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(n.#e[i])}t=n,n=t.#t}}return this}push(...e){for(let t of e)if(t!==""){if(typeof t!="string"&&!(t instanceof Ee&&t.#t===this))throw new Error("invalid part: "+t);this.#e.push(t)}}toJSON(){let e=this.type===null?this.#e.slice().map(t=>typeof t=="string"?t:t.toJSON()):[this.type,...this.#e.map(t=>t.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#n||this.#n.#c&&this.#t?.type==="!")&&e.push({}),e}isStart(){if(this.#n===this)return!0;if(!this.#t?.isStart())return!1;if(this.#a===0)return!0;let e=this.#t;for(let t=0;t<this.#a;t++){let n=e.#e[t];if(!(n instanceof Ee&&n.type==="!"))return!1}return!0}isEnd(){if(this.#n===this||this.#t?.type==="!")return!0;if(!this.#t?.isEnd())return!1;if(!this.type)return this.#t?.isEnd();let e=this.#t?this.#t.#e.length:0;return this.#a===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let t=new Ee(this.type,e);for(let n of this.#e)t.copyIn(n);return t}static#d(e,t,n,i,s){let o=i.maxExtglobRecursion??2,a=!1,u=!1,l=-1,p=!1;if(t.type===null){let v=n,_="";for(;v<e.length;){let T=e.charAt(v++);if(a||T==="\\"){a=!a,_+=T;continue}if(u){v===l+1?(T==="^"||T==="!")&&(p=!0):T==="]"&&!(v===l+2&&p)&&(u=!1),_+=T;continue}else if(T==="["){u=!0,l=v,p=!1,_+=T;continue}if(!i.noext&&io(T)&&e.charAt(v)==="("&&s<=o){t.push(_),_="";let D=new Ee(T,t);v=Ee.#d(e,D,v,i,s+1),t.push(D);continue}_+=T}return t.push(_),v}let h=n+1,f=new Ee(null,t),m=[],g="";for(;h<e.length;){let v=e.charAt(h++);if(a||v==="\\"){a=!a,g+=v;continue}if(u){h===l+1?(v==="^"||v==="!")&&(p=!0):v==="]"&&!(h===l+2&&p)&&(u=!1),g+=v;continue}else if(v==="["){u=!0,l=h,p=!1,g+=v;continue}if(!i.noext&&io(v)&&e.charAt(h)==="("&&(s<=o||t&&t.#f(v))){let T=t&&t.#f(v)?0:1;f.push(g),g="";let C=new Ee(v,f);f.push(C),h=Ee.#d(e,C,h,i,s+T);continue}if(v==="|"){f.push(g),g="",m.push(f),f=new Ee(null,t);continue}if(v===")")return g===""&&t.#e.length===0&&(t.#l=!0),f.push(g),g="",t.push(...m,f),h;g+=v}return t.type=null,t.#i=void 0,t.#e=[e.substring(n-1)],h}#y(e){return this.#p(e,lh)}#p(e,t=uh){if(!e||typeof e!="object"||e.type!==null||e.#e.length!==1||this.type===null)return!1;let n=e.#e[0];return!n||typeof n!="object"||n.type===null?!1:this.#f(n.type,t)}#f(e,t=dh){return!!t.get(this.type)?.includes(e)}#_(e,t){let n=e.#e[0],i=new Ee(null,n,this.options);i.#e.push(""),n.push(i),this.#g(e,t)}#g(e,t){let n=e.#e[0];this.#e.splice(t,1,...n.#e);for(let i of n.#e)typeof i=="object"&&(i.#t=this);this.#o=void 0}#w(e){return!!gu.get(this.type)?.has(e)}#C(e){if(!e||typeof e!="object"||e.type!==null||e.#e.length!==1||this.type===null||this.#e.length!==1)return!1;let t=e.#e[0];return!t||typeof t!="object"||t.type===null?!1:this.#w(t.type)}#b(e){let t=gu.get(this.type),n=e.#e[0],i=t?.get(n.type);if(!i)return!1;this.#e=n.#e;for(let s of this.#e)typeof s=="object"&&(s.#t=this);this.type=i,this.#o=void 0,this.#l=!1}static fromGlob(e,t={}){let n=new Ee(null,void 0,t);return Ee.#d(e,n,0,t,0),n}toMMPattern(){if(this!==this.#n)return this.#n.toMMPattern();let e=this.toString(),[t,n,i,s]=this.toRegExpSource();if(!(i||this.#i||this.#s.nocase&&!this.#s.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return n;let a=(this.#s.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${t}$`,a),{_src:t,_glob:e})}get options(){return this.#s}toRegExpSource(e){let t=e??!!this.#s.dot;if(this.#n===this&&(this.#h(),this.#v()),!pu(this)){let u=this.isStart()&&this.isEnd()&&!this.#e.some(m=>typeof m!="string"),l=this.#e.map(m=>{let[g,v,_,T]=typeof m=="string"?Ee.#S(m,this.#i,u):m.toRegExpSource(e);return this.#i=this.#i||_,this.#r=this.#r||T,g}).join(""),p="";if(this.isStart()&&typeof this.#e[0]=="string"&&!(this.#e.length===1&&ph.has(this.#e[0]))){let g=hh,v=t&&g.has(l.charAt(0))||l.startsWith("\\.")&&g.has(l.charAt(2))||l.startsWith("\\.\\.")&&g.has(l.charAt(4)),_=!t&&!e&&g.has(l.charAt(0));p=v?fh:_?ar:""}let h="";return this.isEnd()&&this.#n.#c&&this.#t?.type==="!"&&(h="(?:$|\\/)"),[p+l+h,(0,or.unescape)(l),this.#i=!!this.#i,this.#r]}let n=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#m(t);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let u=this.toString(),l=this;return l.#e=[u],l.type=null,l.#i=void 0,[u,(0,or.unescape)(this.toString()),!1,!1]}let o=!n||e||t||!ar?"":this.#m(!0);o===s&&(o=""),o&&(s=`(?:${s})(?:${o})*?`);let a="";if(this.type==="!"&&this.#l)a=(this.isStart()&&!t?ar:"")+vu;else{let u=this.type==="!"?"))"+(this.isStart()&&!t&&!e?ar:"")+mu+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;a=i+s+u}return[a,(0,or.unescape)(s),this.#i=!!this.#i,this.#r]}#h(){if(pu(this)){let e=0,t=!1;do{t=!0;for(let n=0;n<this.#e.length;n++){let i=this.#e[n];typeof i=="object"&&(i.#h(),this.#p(i)?(t=!1,this.#g(i,n)):this.#y(i)?(t=!1,this.#_(i,n)):this.#C(i)&&(t=!1,this.#b(i)))}}while(!t&&++e<10)}else for(let e of this.#e)typeof e=="object"&&e.#h();this.#o=void 0}#m(e){return this.#e.map(t=>{if(typeof t=="string")throw new Error("string type in extglob ast??");let[n,i,s,o]=t.toRegExpSource(e);return this.#r=this.#r||o,n}).filter(t=>!(this.isStart()&&this.isEnd())||!!t).join("|")}static#S(e,t,n=!1){let i=!1,s="",o=!1,a=!1;for(let u=0;u<e.length;u++){let l=e.charAt(u);if(i){i=!1,s+=(gh.has(l)?"\\":"")+l;continue}if(l==="*"){if(a)continue;a=!0,s+=n&&/^[*]+$/.test(e)?vu:mu,t=!0;continue}else a=!1;if(l==="\\"){u===e.length-1?s+="\\\\":i=!0;continue}if(l==="["){let[p,h,f,m]=(0,ah.parseClass)(e,u);if(f){s+=p,o=o||h,u+=f-1,t=t||m;continue}}if(l==="?"){s+=ro,t=!0;continue}s+=mh(l)}return[s,(0,or.unescape)(e),!!t,o]}};ur.AST=cr;Ee=cr});var oo=M(lr=>{"use strict";Object.defineProperty(lr,"__esModule",{value:!0});lr.escape=void 0;var yh=(r,{windowsPathsNoEscape:e=!1,magicalBraces:t=!1}={})=>t?e?r.replace(/[?*()[\]{}]/g,"[$&]"):r.replace(/[?*()[\]\\{}]/g,"\\$&"):e?r.replace(/[?*()[\]]/g,"[$&]"):r.replace(/[?*()[\]\\]/g,"\\$&");lr.escape=yh});var ao=M(k=>{"use strict";Object.defineProperty(k,"__esModule",{value:!0});k.unescape=k.escape=k.AST=k.Minimatch=k.match=k.makeRe=k.braceExpand=k.defaults=k.filter=k.GLOBSTAR=k.sep=k.minimatch=void 0;var _h=lu(),dr=du(),wu=so(),wh=oo(),Ch=sr(),bh=(r,e,t={})=>((0,dr.assertValidPattern)(e),!t.nocomment&&e.charAt(0)==="#"?!1:new un(e,t).match(r));k.minimatch=bh;var Sh=/^\*+([^+@!?*[(]*)$/,Dh=r=>e=>!e.startsWith(".")&&e.endsWith(r),Ph=r=>e=>e.endsWith(r),Th=r=>(r=r.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(r)),Rh=r=>(r=r.toLowerCase(),e=>e.toLowerCase().endsWith(r)),Oh=/^\*+\.\*+$/,Fh=r=>!r.startsWith(".")&&r.includes("."),xh=r=>r!=="."&&r!==".."&&r.includes("."),Mh=/^\.\*+$/,kh=r=>r!=="."&&r!==".."&&r.startsWith("."),Eh=/^\*+$/,qh=r=>r.length!==0&&!r.startsWith("."),Ih=r=>r.length!==0&&r!=="."&&r!=="..",Ah=/^\?+([^+@!?*[(]*)?$/,jh=([r,e=""])=>{let t=Cu([r]);return e?(e=e.toLowerCase(),n=>t(n)&&n.toLowerCase().endsWith(e)):t},Lh=([r,e=""])=>{let t=bu([r]);return e?(e=e.toLowerCase(),n=>t(n)&&n.toLowerCase().endsWith(e)):t},Nh=([r,e=""])=>{let t=bu([r]);return e?n=>t(n)&&n.endsWith(e):t},Uh=([r,e=""])=>{let t=Cu([r]);return e?n=>t(n)&&n.endsWith(e):t},Cu=([r])=>{let e=r.length;return t=>t.length===e&&!t.startsWith(".")},bu=([r])=>{let e=r.length;return t=>t.length===e&&t!=="."&&t!==".."},Su=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",yu={win32:{sep:"\\"},posix:{sep:"/"}};k.sep=Su==="win32"?yu.win32.sep:yu.posix.sep;k.minimatch.sep=k.sep;k.GLOBSTAR=Symbol("globstar **");k.minimatch.GLOBSTAR=k.GLOBSTAR;var Kh="[^/]",Hh=Kh+"*?",Wh="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",$h="(?:(?!(?:\\/|^)\\.).)*?",Bh=(r,e={})=>t=>(0,k.minimatch)(t,r,e);k.filter=Bh;k.minimatch.filter=k.filter;var $e=(r,e={})=>Object.assign({},r,e),zh=r=>{if(!r||typeof r!="object"||!Object.keys(r).length)return k.minimatch;let e=k.minimatch;return Object.assign((n,i,s={})=>e(n,i,$e(r,s)),{Minimatch:class extends e.Minimatch{constructor(i,s={}){super(i,$e(r,s))}static defaults(i){return e.defaults($e(r,i)).Minimatch}},AST:class extends e.AST{constructor(i,s,o={}){super(i,s,$e(r,o))}static fromGlob(i,s={}){return e.AST.fromGlob(i,$e(r,s))}},unescape:(n,i={})=>e.unescape(n,$e(r,i)),escape:(n,i={})=>e.escape(n,$e(r,i)),filter:(n,i={})=>e.filter(n,$e(r,i)),defaults:n=>e.defaults($e(r,n)),makeRe:(n,i={})=>e.makeRe(n,$e(r,i)),braceExpand:(n,i={})=>e.braceExpand(n,$e(r,i)),match:(n,i,s={})=>e.match(n,i,$e(r,s)),sep:e.sep,GLOBSTAR:k.GLOBSTAR})};k.defaults=zh;k.minimatch.defaults=k.defaults;var Vh=(r,e={})=>((0,dr.assertValidPattern)(r),e.nobrace||!/\{(?:(?!\{).)*\}/.test(r)?[r]:(0,_h.expand)(r,{max:e.braceExpandMax}));k.braceExpand=Vh;k.minimatch.braceExpand=k.braceExpand;var Gh=(r,e={})=>new un(r,e).makeRe();k.makeRe=Gh;k.minimatch.makeRe=k.makeRe;var Jh=(r,e,t={})=>{let n=new un(e,t);return r=r.filter(i=>n.match(i)),n.options.nonull&&!r.length&&r.push(e),r};k.match=Jh;k.minimatch.match=k.match;var _u=/[?*]|[+@!]\(.*?\)|\[|\]/,Yh=r=>r.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),un=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){(0,dr.assertValidPattern)(e),t=t||{},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||Su,this.isWindows=this.platform==="win32";let n="allowWindowsEscape";this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t[n]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot!==void 0?t.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let t of e)if(typeof t!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let i=this.globParts.map((s,o,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let u=s[0]===""&&s[1]===""&&(s[2]==="?"||!_u.test(s[2]))&&!_u.test(s[3]),l=/^[a-z]:/i.test(s[0]);if(u)return[...s.slice(0,4),...s.slice(4).map(p=>this.parse(p))];if(l)return[s[0],...s.slice(1).map(p=>this.parse(p))]}return s.map(u=>this.parse(u))});if(this.debug(this.pattern,i),this.set=i.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s<this.set.length;s++){let o=this.set[s];o[0]===""&&o[1]===""&&this.globParts[s][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let n of e)for(let i=0;i<n.length;i++)n[i]==="**"&&(n[i]="*");let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):t>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(t=>{let n=-1;for(;(n=t.indexOf("**",n+1))!==-1;){let i=n;for(;t[i+1]==="**";)i++;i!==n&&t.splice(n,i-n)}return t})}levelOneOptimize(e){return e.map(t=>(t=t.reduce((n,i)=>{let s=n[n.length-1];return i==="**"&&s==="**"?n:i===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(n.pop(),n):(n.push(i),n)},[]),t.length===0?[""]:t))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let i=1;i<e.length-1;i++){let s=e[i];i===1&&s===""&&e[0]===""||(s==="."||s==="")&&(t=!0,e.splice(i,1),i--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(t=!0,e.pop())}let n=0;for(;(n=e.indexOf("..",n+1))!==-1;){let i=e[n-1];i&&i!=="."&&i!==".."&&i!=="**"&&!(this.isWindows&&/^[a-z]:$/i.test(i))&&(t=!0,e.splice(n-1,2),n-=2)}}while(t);return e.length===0?[""]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let n of e){let i=-1;for(;(i=n.indexOf("**",i+1))!==-1;){let o=i;for(;n[o+1]==="**";)o++;o>i&&n.splice(i+1,o-i);let a=n[i+1],u=n[i+2],l=n[i+3];if(a!==".."||!u||u==="."||u===".."||!l||l==="."||l==="..")continue;t=!0,n.splice(i,1);let p=n.slice(0);p[i]="**",e.push(p),i--}if(!this.preserveMultipleSlashes){for(let o=1;o<n.length-1;o++){let a=n[o];o===1&&a===""&&n[0]===""||(a==="."||a==="")&&(t=!0,n.splice(o,1),o--)}n[0]==="."&&n.length===2&&(n[1]==="."||n[1]==="")&&(t=!0,n.pop())}let s=0;for(;(s=n.indexOf("..",s+1))!==-1;){let o=n[s-1];if(o&&o!=="."&&o!==".."&&o!=="**"){t=!0;let u=s===1&&n[s+1]==="**"?["."]:[];n.splice(s-1,2,...u),n.length===0&&n.push(""),s-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let n=t+1;n<e.length;n++){let i=this.partsMatch(e[t],e[n],!this.preserveMultipleSlashes);if(i){e[t]=[],e[n]=i;break}}return e.filter(t=>t.length)}partsMatch(e,t,n=!1){let i=0,s=0,o=[],a="";for(;i<e.length&&s<t.length;)if(e[i]===t[s])o.push(a==="b"?t[s]:e[i]),i++,s++;else if(n&&e[i]==="**"&&t[s]===e[i+1])o.push(e[i]),i++;else if(n&&t[s]==="**"&&e[i]===t[s+1])o.push(t[s]),s++;else if(e[i]==="*"&&t[s]&&(this.options.dot||!t[s].startsWith("."))&&t[s]!=="**"){if(a==="b")return!1;a="a",o.push(e[i]),i++,s++}else if(t[s]==="*"&&e[i]&&(this.options.dot||!e[i].startsWith("."))&&e[i]!=="**"){if(a==="a")return!1;a="b",o.push(t[s]),i++,s++}else return!1;return e.length===t.length&&o}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,n=0;for(let i=0;i<e.length&&e.charAt(i)==="!";i++)t=!t,n++;n&&(this.pattern=e.slice(n)),this.negate=t}matchOne(e,t,n=!1){let i=0,s=0;if(this.isWindows){let a=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),u=!a&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),l=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),p=!l&&t[0]===""&&t[1]===""&&t[2]==="?"&&typeof t[3]=="string"&&/^[a-z]:$/i.test(t[3]),h=u?3:a?0:void 0,f=p?3:l?0:void 0;if(typeof h=="number"&&typeof f=="number"){let[m,g]=[e[h],t[f]];m.toLowerCase()===g.toLowerCase()&&(t[f]=m,s=f,i=h)}}let{optimizationLevel:o=1}=this.options;return o>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(k.GLOBSTAR)?this.#n(e,t,n,i,s):this.#r(e,t,n,i,s)}#n(e,t,n,i,s){let o=t.indexOf(k.GLOBSTAR,s),a=t.lastIndexOf(k.GLOBSTAR),[u,l,p]=n?[t.slice(s,o),t.slice(o+1),[]]:[t.slice(s,o),t.slice(o+1,a),t.slice(a+1)];if(u.length){let C=e.slice(i,i+u.length);if(!this.#r(C,u,n,0,0))return!1;i+=u.length,s+=u.length}let h=0;if(p.length){if(p.length+i>e.length)return!1;let C=e.length-p.length;if(this.#r(e,p,n,C,0))h=p.length;else{if(e[e.length-1]!==""||i+p.length===e.length||(C--,!this.#r(e,p,n,C,0)))return!1;h=p.length+1}}if(!l.length){let C=!!h;for(let D=i;D<e.length-h;D++){let F=String(e[D]);if(C=!0,F==="."||F===".."||!this.options.dot&&F.startsWith("."))return!1}return n||C}let f=[[[],0]],m=f[0],g=0,v=[0];for(let C of l)C===k.GLOBSTAR?(v.push(g),m=[[],0],f.push(m)):(m[0].push(C),g++);let _=f.length-1,T=e.length-h;for(let C of f)C[1]=T-(v[_--]+C[0].length);return!!this.#i(e,f,i,0,n,0,!!h)}#i(e,t,n,i,s,o,a){let u=t[i];if(!u){for(let h=n;h<e.length;h++){a=!0;let f=e[h];if(f==="."||f===".."||!this.options.dot&&f.startsWith("."))return!1}return a}let[l,p]=u;for(;n<=p;){if(this.#r(e.slice(0,n+l.length),l,s,n,0)&&o<this.maxGlobstarRecursion){let m=this.#i(e,t,n+l.length,i+1,s,o+1,a);if(m!==!1)return m}let f=e[n];if(f==="."||f===".."||!this.options.dot&&f.startsWith("."))return!1;n++}return s||null}#r(e,t,n,i,s){let o,a,u,l;for(o=i,a=s,l=e.length,u=t.length;o<l&&a<u;o++,a++){this.debug("matchOne loop");let p=t[a],h=e[o];if(this.debug(t,p,h),p===!1||p===k.GLOBSTAR)return!1;let f;if(typeof p=="string"?(f=h===p,this.debug("string match",p,h,f)):(f=p.test(h),this.debug("pattern match",p,h,f)),!f)return!1}if(o===l&&a===u)return!0;if(o===l)return n;if(a===u)return o===l-1&&e[o]==="";throw new Error("wtf?")}braceExpand(){return(0,k.braceExpand)(this.pattern,this.options)}parse(e){(0,dr.assertValidPattern)(e);let t=this.options;if(e==="**")return k.GLOBSTAR;if(e==="")return"";let n,i=null;(n=e.match(Eh))?i=t.dot?Ih:qh:(n=e.match(Sh))?i=(t.nocase?t.dot?Rh:Th:t.dot?Ph:Dh)(n[1]):(n=e.match(Ah))?i=(t.nocase?t.dot?Lh:jh:t.dot?Nh:Uh)(n):(n=e.match(Oh))?i=t.dot?xh:Fh:(n=e.match(Mh))&&(i=kh);let s=wu.AST.fromGlob(e,this.options).toMMPattern();return i&&typeof s=="object"&&Reflect.defineProperty(s,"test",{value:i}),s}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,n=t.noglobstar?Hh:t.dot?Wh:$h,i=new Set(t.nocase?["i"]:[]),s=e.map(u=>{let l=u.map(h=>{if(h instanceof RegExp)for(let f of h.flags.split(""))i.add(f);return typeof h=="string"?Yh(h):h===k.GLOBSTAR?k.GLOBSTAR:h._src});l.forEach((h,f)=>{let m=l[f+1],g=l[f-1];h!==k.GLOBSTAR||g===k.GLOBSTAR||(g===void 0?m!==void 0&&m!==k.GLOBSTAR?l[f+1]="(?:\\/|"+n+"\\/)?"+m:l[f]=n:m===void 0?l[f-1]=g+"(?:\\/|\\/"+n+")?":m!==k.GLOBSTAR&&(l[f-1]=g+"(?:\\/|\\/"+n+"\\/)"+m,l[f+1]=k.GLOBSTAR))});let p=l.filter(h=>h!==k.GLOBSTAR);if(this.partial&&p.length>=1){let h=[];for(let f=1;f<=p.length;f++)h.push(p.slice(0,f).join("/"));return"(?:"+h.join("|")+")"}return p.join("/")}).join("|"),[o,a]=e.length>1?["(?:",")"]:["",""];s="^"+o+s+a+"$",this.partial&&(s="^(?:\\/|"+o+s.slice(1,-1)+a+")$"),this.negate&&(s="^(?!"+s+").+$");try{this.regexp=new RegExp(s,[...i].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&t)return!0;let n=this.options;this.isWindows&&(e=e.split("\\").join("/"));let i=this.slashSplit(e);this.debug(this.pattern,"split",i);let s=this.set;this.debug(this.pattern,"set",s);let o=i[i.length-1];if(!o)for(let a=i.length-2;!o&&a>=0;a--)o=i[a];for(let a of s){let u=i;if(n.matchBase&&a.length===1&&(u=[o]),this.matchOne(u,a,t))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(e){return k.minimatch.defaults(e).Minimatch}};k.Minimatch=un;var Qh=so();Object.defineProperty(k,"AST",{enumerable:!0,get:function(){return Qh.AST}});var Zh=oo();Object.defineProperty(k,"escape",{enumerable:!0,get:function(){return Zh.escape}});var Xh=sr();Object.defineProperty(k,"unescape",{enumerable:!0,get:function(){return Xh.unescape}});k.minimatch.AST=wu.AST;k.minimatch.Minimatch=un;k.minimatch.escape=wh.escape;k.minimatch.unescape=Ch.unescape});var co=M(qt=>{"use strict";var ep=qt&&qt.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),tp=qt&&qt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),np=qt&&qt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&ep(t,e,n[i]);return tp(t,e),t}})();Object.defineProperty(qt,"__esModule",{value:!0});qt.matchGlobPattern=sp;var ip=np(ao()),rp=I("vscode");function sp(r,e){let t;if(typeof r=="string")t=r.replace(/\\/g,"/");else try{let i=rp.Uri.parse(typeof r.baseUri=="string"?r.baseUri:r.baseUri.uri);t=i.with({path:i.path+"/"+r.pattern}).fsPath.replace(/\\/g,"/")}catch{return!1}let n=new ip.Minimatch(t,{noext:!0});return n.makeRe()?n.match(e.fsPath):!1}});var mo=M(Qt=>{"use strict";Object.defineProperty(Qt,"__esModule",{value:!0});Qt.DiagnosticFeature=Qt.DiagnosticPullMode=Qt.vsdiag=void 0;var re=I("vscode"),ie=N(),op=ne(),ap=co(),uo=B();function fr(r,e){return r[e]===void 0&&(r[e]={}),r[e]}var Be;(function(r){let e;(function(t){t.full="full",t.unChanged="unChanged"})(e=r.DocumentDiagnosticReportKind||(r.DocumentDiagnosticReportKind={}))})(Be||(Qt.vsdiag=Be={}));var ai;(function(r){r.onType="onType",r.onSave="onSave",r.onFocus="onFocus"})(ai||(Qt.DiagnosticPullMode=ai={}));var Ce;(function(r){r.active="open",r.reschedule="reschedule",r.outDated="drop"})(Ce||(Ce={}));var ge;(function(r){r[r.document=1]="document",r[r.workspace=2]="workspace"})(ge||(ge={}));var It;(function(r){function e(t){return t instanceof re.Uri?t.toString():t.uri.toString()}r.asKey=e})(It||(It={}));var lo=class{documentPullStates;workspacePullStates;constructor(){this.documentPullStates=new Map,this.workspacePullStates=new Map}track(e,t,n){let i=e===ge.document?this.documentPullStates:this.workspacePullStates,[s,o,a]=t instanceof re.Uri?[t.toString(),t,n]:[t.uri.toString(),t.uri,t.version],u=i.get(s);return u===void 0&&(u={document:o,pulledVersion:a,resultId:void 0},i.set(s,u)),u}update(e,t,n,i){let s=e===ge.document?this.documentPullStates:this.workspacePullStates,[o,a,u,l]=t instanceof re.Uri?[t.toString(),t,n,i]:[t.uri.toString(),t.uri,t.version,n],p=s.get(o);p===void 0?(p={document:a,pulledVersion:u,resultId:l},s.set(o,p)):(p.pulledVersion=u,p.resultId=l)}unTrack(e,t){let n=It.asKey(t);(e===ge.document?this.documentPullStates:this.workspacePullStates).delete(n)}tracks(e,t){let n=It.asKey(t);return(e===ge.document?this.documentPullStates:this.workspacePullStates).has(n)}tracksSameVersion(e,t){let n=t.uri.toString(),s=(e===ge.document?this.documentPullStates:this.workspacePullStates).get(n);return s!==void 0&&s.pulledVersion===t.version}getResultId(e,t){let n=It.asKey(t);return(e===ge.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}},fo=class{isDisposed;client;visibleDocuments;options;onDidChangeDiagnosticsEmitter;provider;diagnostics;openRequests;documentStates;workspaceErrorCounter;workspaceCancellation;workspaceTimeout;constructor(e,t,n){this.client=e,this.visibleDocuments=t,this.options=n,this.isDisposed=!1,this.onDidChangeDiagnosticsEmitter=new re.EventEmitter,this.provider=this.createProvider(),this.diagnostics=re.languages.createDiagnosticCollection(n.identifier),this.openRequests=new Map,this.documentStates=new lo,this.workspaceErrorCounter=0}knows(e,t){let n=t instanceof re.Uri?t:t.uri;return this.documentStates.tracks(e,t)||this.openRequests.has(n.toString())}knowsSameVersion(e,t){let n=this.openRequests.get(t.uri.toString());return n===void 0?this.documentStates.tracksSameVersion(e,t):n.state===Ce.reschedule?!0:n.state===Ce.outDated?!1:n.version===t.version}forget(e,t){this.documentStates.unTrack(e,t)}pull(e,t){if(this.isDisposed)return;let n=e instanceof re.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 re.Uri,i=n?e:e.uri,s=i.toString();t=n?t:e.version;let o=this.openRequests.get(s),a=n?this.documentStates.track(ge.document,e,t):this.documentStates.track(ge.document,e);if(o===void 0){let u=new re.CancellationTokenSource;this.openRequests.set(s,{state:Ce.active,document:e,version:t,tokenSource:u});let l,p;try{l=await this.provider.provideDiagnostics(e,a.resultId,u.token)??{kind:Be.DocumentDiagnosticReportKind.full,items:[]}}catch(h){if(h instanceof uo.LSPCancellationError&&ie.DiagnosticServerCancellationData.is(h.data)&&h.data.retriggerRequest===!1&&(p={state:Ce.outDated,document:e}),p===void 0&&h instanceof re.CancellationError)p={state:Ce.reschedule,document:e};else throw h}if(p=p??this.openRequests.get(s),p===void 0){this.client.error(`Lost request state in diagnostic pull model. Clearing diagnostics for ${s}`),this.diagnostics.delete(i);return}if(this.openRequests.delete(s),!this.visibleDocuments.isVisible(e)){this.documentStates.unTrack(ge.document,e);return}if(p.state===Ce.outDated)return;l!==void 0&&(l.kind===Be.DocumentDiagnosticReportKind.full&&this.diagnostics.set(i,l.items),a.pulledVersion=t,a.resultId=l.resultId),p.state===Ce.reschedule&&this.pull(e)}else o.state===Ce.active?(o.tokenSource.cancel(),this.openRequests.set(s,{state:Ce.reschedule,document:o.document})):o.state===Ce.outDated&&this.openRequests.set(s,{state:Ce.reschedule,document:o.document})}forgetDocument(e){if(this.isDisposed)return;let t=e instanceof re.Uri?e:e.uri,n=t.toString(),i=this.openRequests.get(n);this.options.workspaceDiagnostics&&t.scheme!=="untitled"?(i!==void 0?this.openRequests.set(n,{state:Ce.reschedule,document:e}):this.pull(e,()=>{this.forget(ge.document,e)}),this.forget(ge.workspace,e)):(i!==void 0&&(i.state===Ce.active&&i.tokenSource.cancel(),this.openRequests.set(n,{state:Ce.outDated,document:e})),this.diagnostics.delete(t),this.forget(ge.document,e))}pullWorkspace(){this.isDisposed||this.pullWorkspaceAsync().then(()=>{this.workspaceTimeout=(0,ie.RAL)().timer.setTimeout(()=>{this.pullWorkspace()},2e3)},e=>{!(e instanceof uo.LSPCancellationError)&&!ie.DiagnosticServerCancellationData.is(e.data)&&(this.client.error("Workspace diagnostic pull failed.",e,!1),this.workspaceErrorCounter++),this.workspaceErrorCounter<=5&&(this.workspaceTimeout=(0,ie.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 re.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===Be.DocumentDiagnosticReportKind.full&&(this.documentStates.tracks(ge.document,n.uri)||this.diagnostics.set(n.uri,n.items)),this.documentStates.update(ge.workspace,n.uri,n.version??void 0,n.resultId)})}createProvider(){let e={onDidChangeDiagnostics:this.onDidChangeDiagnosticsEmitter.event,provideDiagnostics:(t,n,i)=>{let s=(a,u,l)=>{let p={identifier:this.options.identifier,textDocument:{uri:this.client.code2ProtocolConverter.asUri(a instanceof re.Uri?a:a.uri)},previousResultId:u};return this.isDisposed===!0||!this.client.isRunning()?{kind:Be.DocumentDiagnosticReportKind.full,items:[]}:this.client.sendRequest(ie.DocumentDiagnosticRequest.type,p,l).then(async h=>h==null||this.isDisposed||l.isCancellationRequested?{kind:Be.DocumentDiagnosticReportKind.full,items:[]}:h.kind===ie.DocumentDiagnosticReportKind.Full?{kind:Be.DocumentDiagnosticReportKind.full,resultId:h.resultId,items:await this.client.protocol2CodeConverter.asDiagnostics(h.items,l)}:{kind:Be.DocumentDiagnosticReportKind.unChanged,resultId:h.resultId},h=>this.client.handleFailedRequest(ie.DocumentDiagnosticRequest.type,l,h,{kind:Be.DocumentDiagnosticReportKind.full,items:[]},!0,!0))},o=this.client.middleware;return o.provideDiagnostics?o.provideDiagnostics(t,n,i,s):s(t,n,i)}};return this.options.workspaceDiagnostics&&(e.provideWorkspaceDiagnostics=(t,n,i)=>{let s=async l=>l.kind===ie.DocumentDiagnosticReportKind.Full?{kind:Be.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:Be.DocumentDiagnosticReportKind.unChanged,uri:this.client.protocol2CodeConverter.asUri(l.uri),resultId:l.resultId,version:l.version},o=l=>{let p=[];for(let h of l)p.push({uri:this.client.code2ProtocolConverter.asUri(h.uri),value:h.value});return p},a=(l,p,h)=>{let f=(0,op.generateUuid)(),m=this.client.onProgress(ie.WorkspaceDiagnosticRequest.partialResult,f,async v=>{if(v==null){h(null);return}let _={items:[]};for(let T of v.items)try{_.items.push(await s(T))}catch(C){this.client.error("Converting workspace diagnostics failed.",C)}h(_)}),g={identifier:this.options.identifier,previousResultIds:o(l),partialResultToken:f};return this.isDisposed===!0||!this.client.isRunning()?{items:[]}:this.client.sendRequest(ie.WorkspaceDiagnosticRequest.type,g,p).then(async v=>{if(p.isCancellationRequested)return{items:[]};let _={items:[]};for(let T of v.items)_.items.push(await s(T));return m.dispose(),h(_),{items:[]}},v=>(m.dispose(),this.client.handleFailedRequest(ie.DocumentDiagnosticRequest.type,p,v,{items:[]})))},u=this.client.middleware;return u.provideWorkspaceDiagnostics?u.provideWorkspaceDiagnostics(t,n,i,a):a(t,n,i)}),e}dispose(){this.isDisposed=!0,this.workspaceCancellation?.cancel(),this.workspaceTimeout?.dispose();for(let[e,t]of this.openRequests)t.state===Ce.active&&t.tokenSource.cancel(),this.openRequests.set(e,{state:Ce.outDated,document:t.document});this.diagnostics.dispose()}},ho=class{client;diagnosticRequestor;lastDocumentToPull;documents;timeoutHandle;isDisposed;constructor(e,t){this.client=e,this.diagnosticRequestor=t,this.documents=new ie.LinkedMap,this.isDisposed=!1}add(e){if(this.isDisposed===!0)return;let t=It.asKey(e);this.documents.has(t)||(this.documents.set(t,e,ie.Touch.Last),this.lastDocumentToPull=e)}remove(e){let t=It.asKey(e);if(this.documents.delete(t),this.documents.size===0){this.stop();return}else if(t===this.lastDocumentToPullKey()){let n=this.documents.before(t);n===void 0?this.stop():this.lastDocumentToPull=n}}trigger(){this.lastDocumentToPull=this.documents.last,this.runLoop()}runLoop(){if(this.isDisposed!==!0){if(this.documents.size===0){this.stop();return}this.lastDocumentToPull!==void 0&&this.timeoutHandle===void 0&&(this.timeoutHandle=(0,ie.RAL)().timer.setTimeout(()=>{let e=this.documents.first;if(e===void 0)return;let t=It.asKey(e);this.diagnosticRequestor.pullAsync(e).catch(n=>{this.client.error(`Document pull failed for text document ${t}`,n,!1)}).finally(()=>{this.timeoutHandle=void 0,this.documents.set(t,e,ie.Touch.Last),t!==this.lastDocumentToPullKey()&&this.runLoop()})},500))}}dispose(){this.isDisposed=!0,this.stop(),this.documents.clear(),this.lastDocumentToPull=void 0}stop(){this.timeoutHandle?.dispose(),this.timeoutHandle=void 0,this.lastDocumentToPull=void 0}lastDocumentToPullKey(){return this.lastDocumentToPull!==void 0?It.asKey(this.lastDocumentToPull):void 0}},po=class{disposable;diagnosticRequestor;activeTextDocument;backgroundScheduler;constructor(e,t,n){let i=Object.assign({onChange:!1,onSave:!1,onFocus:!1},e.clientOptions.diagnosticPullOptions),s=e.protocol2CodeConverter.asDocumentSelector(n.documentSelector),o=[],a=(C,D)=>!(typeof C=="string"||C.language!==void 0&&C.language!=="*"||C.scheme!==void 0&&C.scheme!=="*"&&C.scheme!==D.scheme||C.pattern!==void 0&&!(0,ap.matchGlobPattern)(C.pattern,D)),u=C=>{let D=n.documentSelector;if(i.match!==void 0)return i.match(D,C);for(let F of D)if(ie.TextDocumentFilter.is(F)&&a(F,C))return!0;return!1},l=C=>C instanceof re.Uri?u(C):re.languages.match(s,C)>0&&t.isVisible(C),p=C=>re.languages.match(s,C.document)>0&&t.isVisible(C.notebook.uri),h=C=>C instanceof re.Uri?this.activeTextDocument?.uri.toString()===C.toString():this.activeTextDocument===C;this.diagnosticRequestor=new fo(e,t,n),this.backgroundScheduler=new ho(e,this.diagnosticRequestor);let f=C=>{!l(C)||!n.interFileDependencies||h(C)||i.onChange===!1||this.backgroundScheduler.add(C)},m=(C,D)=>(i.filter===void 0||!i.filter(C,D))&&this.diagnosticRequestor.knows(ge.document,C);this.activeTextDocument=re.window.activeTextEditor?.document,o.push(re.window.onDidChangeActiveTextEditor(C=>{let D=this.activeTextDocument;this.activeTextDocument=C?.document,D!==void 0&&f(D),this.activeTextDocument!==void 0&&(this.backgroundScheduler.remove(this.activeTextDocument),i.onFocus===!0&&l(this.activeTextDocument)&&m(this.activeTextDocument,ai.onFocus)&&this.diagnosticRequestor.pull(this.activeTextDocument))}));let g=e.getFeature(ie.DidOpenTextDocumentNotification.method);o.push(g.onNotificationSent(C=>{let D=C.textDocument;this.diagnosticRequestor.knowsSameVersion(ge.document,D)||l(D)&&this.diagnosticRequestor.pull(D,()=>{f(D)})}));let v=e.getFeature(ie.NotebookDocumentSyncRegistrationType.method);o.push(v.onOpenNotificationSent(C=>{for(let D of C.getCells())p(D)&&this.diagnosticRequestor.pull(D.document,()=>{f(D.document)})})),o.push(t.onOpen(C=>{for(let D of C){if(this.diagnosticRequestor.knows(ge.document,D))continue;let F=D.toString(),E;for(let Q of re.workspace.textDocuments)if(F===Q.uri.toString()){E=Q;break}E!==void 0&&l(E)&&this.diagnosticRequestor.pull(E,()=>{f(E)})}}));let _=new Set;for(let C of re.workspace.textDocuments)l(C)&&(this.diagnosticRequestor.pull(C,()=>{f(C)}),_.add(C.uri.toString()));for(let C of re.workspace.notebookDocuments)for(let D of C.getCells())p(D)&&(this.diagnosticRequestor.pull(D.document,()=>{f(D.document)}),_.add(D.document.uri.toString()));if(i.onTabs===!0)for(let C of t.getResources())!_.has(C.toString())&&l(C)&&this.diagnosticRequestor.pull(C,()=>{f(C)});if(i.onChange===!0){let C=e.getFeature(ie.DidChangeTextDocumentNotification.method);o.push(C.onNotificationSent(async D=>{let F=D.textDocument;m(F,ai.onType)&&this.diagnosticRequestor.pull(F,()=>{this.backgroundScheduler.trigger()})})),o.push(v.onChangeNotificationSent(async D=>{let E=(D.cells?.textContent||[]).map(xe=>D.notebook.getCells().find(Un=>Un.document.uri.toString()===xe.document.uri.toString()));for(let xe of E)xe&&p(xe)&&this.diagnosticRequestor.pull(xe.document,()=>{this.backgroundScheduler.trigger()});let Q=D.cells?.structure?.didClose||[];for(let xe of Q)this.diagnosticRequestor.forgetDocument(xe.document);let we=D.cells?.structure?.didOpen||[];for(let xe of we)p(xe)&&this.diagnosticRequestor.pull(xe.document,()=>{this.backgroundScheduler.trigger()})}))}if(i.onSave===!0){let C=e.getFeature(ie.DidSaveTextDocumentNotification.method);o.push(C.onNotificationSent(D=>{let F=D.textDocument;m(F,ai.onSave)&&this.diagnosticRequestor.pull(D.textDocument)})),o.push(v.onSaveNotificationSent(D=>{for(let F of D.getCells())p(F)&&this.diagnosticRequestor.pull(F.document)}))}let T=e.getFeature(ie.DidCloseTextDocumentNotification.method);o.push(T.onNotificationSent(C=>{this.cleanUpDocument(C.textDocument)})),o.push(v.onCloseNotificationSent(C=>{for(let D of C.getCells())this.cleanUpDocument(D.document)})),o.push(t.onClose(C=>{for(let D of C)this.cleanUpDocument(D)})),this.diagnosticRequestor.onDidChangeDiagnosticsEmitter.event(()=>{for(let C of re.workspace.textDocuments)l(C)&&this.diagnosticRequestor.pull(C)}),n.workspaceDiagnostics===!0&&n.identifier!=="da348dc5-c30a-4515-9d98-31ff3be38d14"&&this.diagnosticRequestor.pullWorkspace(),this.disposable=re.Disposable.from(...o,this.backgroundScheduler,this.diagnosticRequestor)}get onDidChangeDiagnosticsEmitter(){return this.diagnosticRequestor.onDidChangeDiagnosticsEmitter}get diagnostics(){return this.diagnosticRequestor.provider}forget(e){this.cleanUpDocument(e)}cleanUpDocument(e){this.backgroundScheduler.remove(e),this.diagnosticRequestor.knows(ge.document,e)&&this.diagnosticRequestor.forgetDocument(e)}},go=class extends uo.TextDocumentLanguageFeature{constructor(e){super(e,ie.DocumentDiagnosticRequest.type)}fillClientCapabilities(e){let t=fr(fr(e,"textDocument"),"diagnostic");t.relatedInformation=!0,t.tagSupport={valueSet:[ie.DiagnosticTag.Unnecessary,ie.DiagnosticTag.Deprecated]},t.codeDescriptionSupport=!0,t.dataSupport=!0,t.dynamicRegistration=!0,t.relatedDocumentSupport=!1,t.markupMessageSupport=!1,fr(fr(e,"workspace"),"diagnostics").refreshSupport=!0}initialize(e,t){this._client.onRequest(ie.DiagnosticRefreshRequest.type,async()=>{for(let o of this.getAllProviders())o.onDidChangeDiagnosticsEmitter.fire()});let[i,s]=this.getRegistration(t,e.diagnosticProvider);!i||!s||this.register({id:i,registerOptions:s})}clear(){super.clear()}refresh(){for(let e of this.getAllProviders())e.onDidChangeDiagnosticsEmitter.fire()}registerLanguageProvider(e){let t=new po(this._client,this._client.visibleDocuments,e);return[t.disposable,t]}};Qt.DiagnosticFeature=go});var Tu=M(rt=>{"use strict";var cp=rt&&rt.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),up=rt&&rt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),mr=rt&&rt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&cp(t,e,n[i]);return up(t,e),t}})();Object.defineProperty(rt,"__esModule",{value:!0});rt.NotebookDocumentSyncFeature=void 0;var se=mr(I("vscode")),At=mr(N()),lp=mr(ne()),Du=mr(He()),dp=co();function Pu(r,e){return r[e]===void 0&&(r[e]={}),r[e]}var Rn;(function(r){let e;(function(t){function n(f,m){return{version:f.version,uri:m.asUri(f.uri)}}t.asVersionedNotebookDocumentIdentifier=n;function i(f,m,g){let v=At.NotebookDocument.create(g.asUri(f.uri),f.notebookType,f.version,s(m,g));return Object.keys(f.metadata).length>0&&(v.metadata=o(f.metadata)),v}t.asNotebookDocument=i;function s(f,m){return f.map(g=>a(g,m))}t.asNotebookCells=s;function o(f){return l(new Set,f)}t.asMetadata=o;function a(f,m){let g=At.NotebookCell.create(u(f.kind),m.asUri(f.document.uri));return Object.keys(f.metadata).length>0&&(g.metadata=o(f.metadata)),f.executionSummary!==void 0&&Du.number(f.executionSummary.executionOrder)&&Du.boolean(f.executionSummary.success)&&(g.executionSummary={executionOrder:f.executionSummary.executionOrder,success:f.executionSummary.success}),g}t.asNotebookCell=a;function u(f){switch(f){case se.NotebookCellKind.Markup:return At.NotebookCellKind.Markup;case se.NotebookCellKind.Code:return At.NotebookCellKind.Code}}function l(f,m){if(f.has(m))throw new Error("Can't deep copy cyclic structures.");if(Array.isArray(m)){let g=[];for(let v of m)if(v!==null&&typeof v=="object"||Array.isArray(v))g.push(l(f,v));else{if(v instanceof RegExp)throw new Error("Can't transfer regular expressions to the server");g.push(v)}return g}else{let g=Object.keys(m),v=Object.create(null);for(let _ of g){let T=m[_];if(T!==null&&typeof T=="object"||Array.isArray(T))v[_]=l(f,T);else{if(T instanceof RegExp)throw new Error("Can't transfer regular expressions to the server");v[_]=T}}return v}}function p(f,m){let g=m.asChangeTextDocumentParams(f,f.document.uri,f.document.version);return{document:g.textDocument,changes:g.contentChanges}}t.asTextContentChange=p;function h(f,m){let g=Object.create(null);if(f.metadata&&(g.metadata=r.c2p.asMetadata(f.metadata)),f.cells!==void 0){let v=Object.create(null),_=f.cells;_.structure&&(v.structure={array:{start:_.structure.array.start,deleteCount:_.structure.array.deleteCount,cells:_.structure.array.cells!==void 0?_.structure.array.cells.map(T=>r.c2p.asNotebookCell(T,m)):void 0},didOpen:_.structure.didOpen!==void 0?_.structure.didOpen.map(T=>m.asOpenTextDocumentParams(T.document).textDocument):void 0,didClose:_.structure.didClose!==void 0?_.structure.didClose.map(T=>m.asCloseTextDocumentParams(T.document).textDocument):void 0}),_.data!==void 0&&(v.data=_.data.map(T=>r.c2p.asNotebookCell(T,m))),_.textContent!==void 0&&(v.textContent=_.textContent.map(T=>r.c2p.asTextContentChange(T,m))),Object.keys(v).length>0&&(g.cells=v)}return g}t.asNotebookDocumentChangeEvent=h})(e=r.c2p||(r.c2p={}))})(Rn||(Rn={}));var vo;(function(r){function e(a,u,l){let p=a.length,h=u.length,f=0;for(;f<h&&f<p&&t(a[f],u[f],l);)f++;if(f<h&&f<p){let m=p-1,g=h-1;for(;m>=0&&g>=0&&t(a[m],u[g],l);)m--,g--;let v=m+1-f,_=f===g+1?void 0:u.slice(f,g+1);return _!==void 0?{start:f,deleteCount:v,cells:_}:{start:f,deleteCount:v}}else return f<h?{start:f,deleteCount:0,cells:u.slice(f)}:f<p?{start:f,deleteCount:p-f}:void 0}r.computeDiff=e;function t(a,u,l=!0){return a.kind!==u.kind||a.document.uri.toString()!==u.document.uri.toString()||a.document.languageId!==u.document.languageId||!n(a.executionSummary,u.executionSummary)?!1:!l||l&&s(a.metadata,u.metadata)}function n(a,u){return a===u?!0:a===void 0||u===void 0?!1:a.executionOrder===u.executionOrder&&a.success===u.success&&i(a.timing,u.timing)}function i(a,u){return a===u?!0:a===void 0||u===void 0?!1:a.startTime===u.startTime&&a.endTime===u.endTime}function s(a,u){if(a===u)return!0;if(a==null||u===null||u===void 0||typeof a!=typeof u||typeof a!="object")return!1;let l=Array.isArray(a),p=Array.isArray(u);if(l!==p)return!1;if(l&&p){if(a.length!==u.length)return!1;for(let h=0;h<a.length;h++)if(!s(a[h],u[h]))return!1}if(o(a)&&o(u)){let h=Object.keys(a),f=Object.keys(u);if(h.length!==f.length||(h.sort(),f.sort(),!s(h,f)))return!1;for(let m=0;m<h.length;m++){let g=h[m];if(!s(a[g],u[g]))return!1}return!0}return!1}function o(a){return a!==null&&typeof a=="object"}r.isObjectLiteral=o})(vo||(vo={}));var hr;(function(r){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;return!(t.scheme!==void 0&&t.scheme!=="*"&&i.scheme!==t.scheme||t.pattern!==void 0&&!(0,dp.matchGlobPattern)(t.pattern,i))}r.matchNotebook=e})(hr||(hr={}));var pr;(function(r){function e(n){let i=n.notebookSelector,s=[];for(let o of i){let a=(typeof o.notebook=="string"?o.notebook:o.notebook?.notebookType)??"*",u=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)s.push(t(a,u,l,p.language));else s.push(t(a,u,l,void 0))}return s}r.asDocumentSelector=e;function t(n,i,s,o){return i===void 0&&s===void 0?{notebook:n,language:o}:{notebook:{notebookType:n,scheme:i,pattern:s},language:o}}})(pr||(pr={}));var gr;(function(r){function e(t){return{cells:t,uris:new Set(t.map(n=>n.document.uri.toString()))}}r.create=e})(gr||(gr={}));var On=class{client;options;notebookSyncInfo;notebookDidOpen;disposables;selector;onChangeNotificationSent;onOpenNotificationSent;onCloseNotificationSent;onSaveNotificationSent;constructor(e,t,n,i,s,o){this.client=e,this.options=t,this.notebookSyncInfo=new Map,this.notebookDidOpen=new Set,this.disposables=[],this.selector=e.protocol2CodeConverter.asDocumentSelector(pr.asDocumentSelector(t)),this.onChangeNotificationSent=n,this.onOpenNotificationSent=i,this.onCloseNotificationSent=s,this.onSaveNotificationSent=o,se.workspace.onDidOpenNotebookDocument(a=>{this.notebookDidOpen.add(a.uri.toString()),this.didOpen(a)},void 0,this.disposables);for(let a of se.workspace.notebookDocuments)this.notebookDidOpen.add(a.uri.toString()),this.didOpen(a);se.workspace.onDidChangeNotebookDocument(a=>this.didChangeNotebookDocument(a),void 0,this.disposables),this.options.save===!0&&se.workspace.onDidSaveNotebookDocument(a=>this.didSave(a),void 0,this.disposables),se.workspace.onDidCloseNotebookDocument(a=>{this.didClose(a),this.notebookDidOpen.delete(a.uri.toString())},void 0,this.disposables)}getState(){for(let e of se.workspace.notebookDocuments)if(this.getMatchingCellsConsideringSyncInfo(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){if(se.languages.match(this.selector,e)>0)return!0;let t=e.uri.toString();for(let n of this.notebookSyncInfo.values())if(n.uris.has(t))return!0;return!1}didOpenNotebookCellTextDocument(e,t){if(se.languages.match(this.selector,t.document)===0||!this.notebookDidOpen.has(e.uri.toString()))return;let n=this.getSyncInfo(e),i=this.cellMatches(e,t);if(n!==void 0){let s=n.uris.has(t.document.uri.toString());if(i&&s||!i&&!s)return;if(i){let o=this.mergeCells(e,n,[t]);if(o!==void 0){let a=this.asNotebookDocumentChangeEvent(e,void 0,n,o);a!==void 0&&this.doSendChange(a,o).catch(()=>{})}}}else i&&this.doSendOpen(e,[t]).catch(()=>{})}didChangeNotebookCellTextDocument(e,t,n){if(se.languages.match(this.selector,n.document)===0)return;let i=this.getSyncInfo(e);i===void 0||!i.uris.has(t.document.uri.toString())||this.doSendChange({notebook:e,cells:{textContent:[n]}},i.cells).catch(()=>{})}didCloseNotebookCellTextDocument(e,t){let n=this.getSyncInfo(e);if(n===void 0)return;let i=t.document.uri,s=n.cells.findIndex(o=>o.document.uri.toString()===i.toString());if(s!==-1)if(s===0&&n.cells.length===1)this.doSendClose(e,n.cells).catch(()=>{});else{let o=n.cells.slice(),a=o.splice(s,1);this.doSendChange({notebook:e,cells:{structure:{array:{start:s,deleteCount:1},didClose:a}}},o).catch(()=>{})}}dispose(){for(let e of this.disposables)e.dispose()}didOpen(e,t,n=this.getSyncInfo(e)){if(n!==void 0)if(t===void 0&&(t=n.cells.slice()),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=this.getMatchingCells(e),t===void 0)return;this.doSendOpen(e,t).catch(()=>{})}}didChangeNotebookDocument(e){let t=e.notebook,n=this.getSyncInfo(t);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.getMatchingCellsFromEvent(t,n,e);if(i===void 0){this.didClose(t,n);return}let s=this.asNotebookDocumentChangeEvent(e.notebook,e,n,i);s!==void 0&&this.doSendChange(s,i).catch(()=>{})}}didSave(e){this.getSyncInfo(e)!==void 0&&this.doSendSave(e).catch(()=>{})}didClose(e,t=this.getSyncInfo(e)){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){if(this.getSyncInfo(e)!==void 0)throw new Error(`Notebook document ${e.uri.toString()} is already open`);let n=this.getMatchingCells(e);if(n!==void 0)return this.doSendOpen(e,n)}async doSendOpen(e,t){let n=async(s,o)=>{let a=o.map(u=>this.client.code2ProtocolConverter.asTextDocumentItem(u.document));try{await this.client.sendNotification(At.DidOpenNotebookDocumentNotification.type,{notebookDocument:Rn.c2p.asNotebookDocument(s,o,this.client.code2ProtocolConverter),cellTextDocuments:a}),this.onOpenNotificationSent.fire(s)}catch(u){throw this.client.error("Sending DidOpenNotebookDocumentNotification failed",u),u}},i=this.client.middleware?.notebooks;return this.notebookSyncInfo.set(e.uri.toString(),gr.create(t)),i?.didOpen!==void 0?i.didOpen(e,t,n):n(e,t)}async sendDidChangeNotebookDocument(e){let t=this.getMatchingCellsFromSyncInfo(e.notebook);if(t===void 0)throw new Error(`Received changed event for un-synced notebook ${e.notebook.uri.toString()}`);return this.doSendChange(e,t)}async doSendChange(e,t){let n=async s=>{try{await this.client.sendNotification(At.DidChangeNotebookDocumentNotification.type,{notebookDocument:Rn.c2p.asVersionedNotebookDocumentIdentifier(s.notebook,this.client.code2ProtocolConverter),change:Rn.c2p.asNotebookDocumentChangeEvent(s,this.client.code2ProtocolConverter)}),this.onChangeNotificationSent.fire(s)}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(),gr.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(At.DidSaveNotebookDocumentNotification.type,{notebookDocument:{uri:this.client.code2ProtocolConverter.asUri(i.uri)}}),this.onSaveNotificationSent.fire(i)}catch(s){throw this.client.error("Sending DidSaveNotebookDocumentNotification failed",s),s}},n=this.client.middleware?.notebooks;return n?.didSave!==void 0?n.didSave(e,t):t(e)}async sendDidCloseNotebookDocument(e){let t=this.getMatchingCellsFromSyncInfo(e);if(t===void 0)throw new Error(`Received close event for un-synced notebook ${e.uri.toString()}`);return this.doSendClose(e,t)}async doSendClose(e,t){let n=async(s,o)=>{try{await this.client.sendNotification(At.DidCloseNotebookDocumentNotification.type,{notebookDocument:{uri:this.client.code2ProtocolConverter.asUri(s.uri)},cellTextDocuments:o.map(a=>this.client.code2ProtocolConverter.asTextDocumentIdentifier(a.document))}),this.onCloseNotificationSent.fire(s)}catch(a){throw this.client.error("Sending DidCloseNotebookDocumentNotification failed",a),a}},i=this.client.middleware?.notebooks;return this.notebookSyncInfo.delete(e.uri.toString()),i?.didClose!==void 0?i.didClose(e,t,n):n(e,t)}getSynchronizedCells(e){return this.getSyncInfo(e)?.cells}asNotebookDocumentChangeEvent(e,t,n,i){if(t!==void 0&&t.notebook!==e)throw new Error("Notebook must be identical");let s={notebook:e};t?.metadata!==void 0&&(s.metadata=Rn.c2p.asMetadata(t.metadata));let o;if(t?.cellChanges!==void 0&&t.cellChanges.length>0){let a=[];o=new Set(i.map(u=>u.document.uri.toString()));for(let u of t.cellChanges)o.has(u.cell.document.uri.toString())&&(u.executionSummary!==void 0||u.metadata!==void 0)&&a.push(u.cell);a.length>0&&(s.cells=s.cells??{},s.cells.data=a)}if((t?.contentChanges!==void 0&&t.contentChanges.length>0||t===void 0)&&n!==void 0&&i!==void 0){let a=n.cells,u=i,l=vo.computeDiff(a,u,!1),p,h;if(l!==void 0){p=l.cells===void 0?new Map:new Map(l.cells.map(g=>[g.document.uri.toString(),g])),h=l.deleteCount===0?new Map:new Map(a.slice(l.start,l.start+l.deleteCount).map(g=>[g.document.uri.toString(),g]));for(let g of Array.from(h.keys()))p.has(g)&&(h.delete(g),p.delete(g));s.cells=s.cells??{};let f=[],m=[];if(p.size>0||h.size>0){for(let g of p.values())f.push(g);for(let g of h.values())m.push(g)}s.cells.structure={array:l,didOpen:f,didClose:m}}}return Object.keys(s).length>1?s: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||hr.matchNotebook(n.notebook,e)){let i=this.filterCells(e,t,n.cells);return i.length===0?void 0:i}}}getMatchingCellsFromEvent(e,t,n){if(this.options.notebookSelector===void 0)return;let i;for(let u of this.options.notebookSelector)if(u.notebook===void 0||hr.matchNotebook(u.notebook,e)){i=u;break}if(i===void 0)return;if((n.cellChanges===void 0||n.cellChanges.length===0)&&(n.contentChanges===void 0||n.contentChanges.length===0))return t.cells;let s;if(n.cellChanges!==void 0&&n.cellChanges.length>0){let u=n.cellChanges.map(p=>p.cell),l=this.filterCells(e,u,i.cells);if(l.length!==u.length){s=new Set(t.uris);for(let p of u)s.delete(p.document.uri.toString());for(let p of l)s.add(p.document.uri.toString())}}if(n.contentChanges!==void 0&&n.contentChanges.length>0){s===void 0&&(s=new Set(t.uris));for(let u of n.contentChanges){for(let p of u.removedCells)s.delete(p.document.uri.toString());let l=this.filterCells(e,new Array(...u.addedCells),i.cells);for(let p of l)s.add(p.document.uri.toString())}}if(s===void 0)return t.cells;let o=[],a=e.getCells();for(let u of a)s.has(u.document.uri.toString())&&o.push(u);return o}getMatchingCellsFromSyncInfo(e){let t=this.getSyncInfo(e);return t!==void 0?t.cells:void 0}getMatchingCellsConsideringSyncInfo(e){let t=this.getSyncInfo(e);return t!==void 0?t.cells:this.getMatchingCells(e)}mergeCells(e,t,n){let i=[],s=new Set(t.uris);for(let o of n)s.add(o.document.uri.toString());for(let o of e.getCells())s.has(o.document.uri.toString())&&i.push(o);return 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(s=>{let o=s.document.languageId;return n.some((a=>a.language==="*"||o===a.language))}):t;return typeof this.client.clientOptions.notebookDocumentOptions?.filterCells=="function"?this.client.clientOptions.notebookDocumentOptions.filterCells(e,i):i}getSyncInfo(e){return this.notebookSyncInfo.get(e.uri.toString())}},yo=class r{static CellScheme="vscode-notebook-cell";client;registrations;dedicatedChannel;_onChangeNotificationSent;_onOpenNotificationSent;_onCloseNotificationSent;_onSaveNotificationSent;constructor(e){this.client=e,this.registrations=new Map,this.registrationType=At.NotebookDocumentSyncRegistrationType.type,this._onChangeNotificationSent=new se.EventEmitter,this._onOpenNotificationSent=new se.EventEmitter,this._onCloseNotificationSent=new se.EventEmitter,this._onSaveNotificationSent=new se.EventEmitter,se.workspace.onDidOpenTextDocument(t=>{if(t.uri.scheme!==r.CellScheme)return;let[n,i]=this.findNotebookDocumentAndCell(t);if(!(n===void 0||i===void 0))for(let s of this.registrations.values())s instanceof On&&s.didOpenNotebookCellTextDocument(n,i)}),se.workspace.onDidChangeTextDocument(t=>{if(t.contentChanges.length===0)return;let n=t.document;if(n.uri.scheme!==r.CellScheme)return;let[i,s]=this.findNotebookDocumentAndCell(n);if(!(i===void 0||s===void 0))for(let o of this.registrations.values())o instanceof On&&o.didChangeNotebookCellTextDocument(i,s,t)}),se.workspace.onDidCloseTextDocument(t=>{if(t.uri.scheme!==r.CellScheme)return;let[n,i]=this.findNotebookDocumentAndCell(t);if(!(n===void 0||i===void 0))for(let s of this.registrations.values())s instanceof On&&s.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}}registrationType;get onOpenNotificationSent(){return this._onOpenNotificationSent.event}get onChangeNotificationSent(){return this._onChangeNotificationSent.event}get onCloseNotificationSent(){return this._onCloseNotificationSent.event}get onSaveNotificationSent(){return this._onSaveNotificationSent.event}fillClientCapabilities(e){let t=Pu(Pu(e,"notebookDocument"),"synchronization");t.dynamicRegistration=!0,t.executionSummarySupport=!0}preInitialize(e){let t=e.notebookDocumentSync;t!==void 0&&(this.dedicatedChannel=this.client.protocol2CodeConverter.asDocumentSelector(pr.asDocumentSelector(t)))}initialize(e){let t=e.notebookDocumentSync;if(t===void 0)return;let n=t.id??lp.generateUuid();this.register({id:n,registerOptions:t})}register(e){let t=new On(this.client,e.registerOptions,this._onChangeNotificationSent,this._onOpenNotificationSent,this._onCloseNotificationSent,this._onSaveNotificationSent);this.registrations.set(e.id,t)}unregister(e){let t=this.registrations.get(e);t!==void 0&&(this.registrations.delete(e),t.dispose())}clear(){for(let e of this.registrations.values())e.dispose();this.registrations.clear(),this._onChangeNotificationSent.dispose(),this._onChangeNotificationSent=new se.EventEmitter,this._onOpenNotificationSent.dispose(),this._onOpenNotificationSent=new se.EventEmitter,this._onCloseNotificationSent.dispose(),this._onCloseNotificationSent=new se.EventEmitter,this._onSaveNotificationSent.dispose(),this._onSaveNotificationSent=new se.EventEmitter}handles(e){if(e.uri.scheme!==r.CellScheme)return!1;if(this.dedicatedChannel!==void 0&&se.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 se.workspace.notebookDocuments)for(let i of n.getCells())if(i.document.uri.toString()===t)return[n,i];return[void 0,void 0]}};rt.NotebookDocumentSyncFeature=yo});var Fu=M(je=>{"use strict";var fp=je&&je.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),hp=je&&je.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Ou=je&&je.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&fp(t,e,n[i]);return hp(t,e),t}})();Object.defineProperty(je,"__esModule",{value:!0});je.SyncConfigurationFeature=je.ConfigurationFeature=void 0;je.toJSONObject=ln;var Fn=I("vscode"),ci=N(),pp=Ou(He()),gp=Ou(ne()),Ru=B(),_o=class{_client;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(ci.ConfigurationRequest.type,(t,n)=>{let i=o=>{let a=[];for(let u of o.items){let l=u.scopeUri!==void 0&&u.scopeUri!==null?this._client.protocol2CodeConverter.asUri(u.scopeUri):void 0;a.push(this.getConfiguration(l,u.section!==null?u.section:void 0))}return a},s=e.middleware.workspace;return s&&s.configuration?s.configuration(t,n,i):i(t,n)})}getConfiguration(e,t){let n=null;if(t){let i=t.lastIndexOf(".");if(i===-1)n=ln(Fn.workspace.getConfiguration(void 0,e).get(t));else{let s=Fn.workspace.getConfiguration(t.substr(0,i),e);s&&(n=ln(s.get(t.substr(i+1))))}}else{let i=Fn.workspace.getConfiguration(void 0,e);n={};for(let s of Object.keys(i))i.has(s)&&(n[s]=ln(i.get(s)))}return n===void 0&&(n=null),n}clear(){}};je.ConfigurationFeature=_o;function ln(r){if(r){if(Array.isArray(r))return r.map(ln);if(typeof r=="object"){let e=Object.create(null);for(let t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=ln(r[t]));return e}}return r}var wo=class{_client;isCleared;_listeners;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 ci.DidChangeConfigurationNotification.type}fillClientCapabilities(e){(0,Ru.ensure)((0,Ru.ensure)(e,"workspace"),"didChangeConfiguration").dynamicRegistration=!0}initialize(){this.isCleared=!1;let e=this._client.clientOptions.synchronize?.configurationSection;e!==void 0&&this.register({id:gp.generateUuid(),registerOptions:{section:e}})}register(e){let t=Fn.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(pp.string(e)?n=[e]:n=e,n!==void 0&&t!==void 0&&!n.some(a=>t.affectsConfiguration(a)))return;let i=async o=>o===void 0?this._client.sendNotification(ci.DidChangeConfigurationNotification.type,{settings:null}):this._client.sendNotification(ci.DidChangeConfigurationNotification.type,{settings:this.extractSettingsInformation(o)}),s=this._client.middleware.workspace?.didChangeConfiguration;(s?s(n,i):i(n)).catch(o=>{this._client.error(`Sending notification ${ci.DidChangeConfigurationNotification.type.method} failed`,o)})}extractSettingsInformation(e){function t(s,o){let a=s;for(let u=0;u<o.length-1;u++){let l=a[o[u]];l||(l=Object.create(null),a[o[u]]=l),a=l}return a}let n=this._client.clientOptions.workspaceFolder?this._client.clientOptions.workspaceFolder.uri:void 0,i=Object.create(null);for(let s=0;s<e.length;s++){let o=e[s],a=o.indexOf("."),u=null;if(a>=0?u=Fn.workspace.getConfiguration(o.substr(0,a),n).get(o.substr(a+1)):u=Fn.workspace.getConfiguration(void 0,n).get(o),u){let l=e[s].split(".");t(i,l)[l[l.length-1]]=ln(u)}}return i}};je.SyncConfigurationFeature=wo});var xu=M(ve=>{"use strict";var mp=ve&&ve.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),vp=ve&&ve.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),yp=ve&&ve.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&mp(t,e,n[i]);return vp(t,e),t}})();Object.defineProperty(ve,"__esModule",{value:!0});ve.DidSaveTextDocumentFeature=ve.WillSaveWaitUntilFeature=ve.WillSaveFeature=ve.DidChangeTextDocumentFeature=ve.DidCloseTextDocumentFeature=ve.DidOpenTextDocumentFeature=void 0;var me=I("vscode"),ee=N(),ce=B(),xn=yp(ne()),_p=(od(),td(sd)),Co=class extends ce.TextDocumentEventFeature{_syncedDocuments;_pendingOpenNotifications;_delayOpen;_pendingOpenListeners;constructor(e,t){super(e,me.workspace.onDidOpenTextDocument,ee.DidOpenTextDocumentNotification.type,()=>e.middleware.didOpen,n=>e.code2ProtocolConverter.asOpenTextDocumentParams(n),n=>n,ce.TextDocumentEventFeature.textDocumentFilter),this._syncedDocuments=t,this._pendingOpenNotifications=new Map,this._delayOpen=e.clientOptions.textSynchronization?.delayOpenNotifications??!1}async callback(e){if(this._delayOpen){if(!this.matches(e))return;if(this._client.visibleDocuments.isVisible(e))return super.callback(e);{let n=new Ro(e);this._pendingOpenNotifications.set(n.uri.toString(),n)}}else return super.callback(e)}get openDocuments(){return this._syncedDocuments.values()}fillClientCapabilities(e){(0,ce.ensure)((0,ce.ensure)(e,"textDocument"),"synchronization").dynamicRegistration=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;t&&n&&n.openClose&&this.register({id:xn.generateUuid(),registerOptions:{documentSelector:t}})}get registrationType(){return ee.DidOpenTextDocumentNotification.type}register(e){if(super.register(e),!e.registerOptions.documentSelector)return;let t=this._client.protocol2CodeConverter.asDocumentSelector(e.registerOptions.documentSelector);if(me.workspace.textDocuments.forEach(n=>{let i=n.uri.toString();if(!this._syncedDocuments.has(i)&&me.languages.match(t,n)>0&&!this._client.hasDedicatedTextSynchronizationFeature(n))if(this._client.visibleDocuments.isVisible(n)){let o=this._client.middleware,a=u=>this._client.sendNotification(this._type,this._createParams(u));(o.didOpen?o.didOpen(n,a):a(n)).catch(u=>{this._client.error(`Sending document notification ${this._type.method} failed`,u)}),this._syncedDocuments.set(i,n)}else this._pendingOpenNotifications.set(i,n)}),this._delayOpen&&this._pendingOpenListeners===void 0){this._pendingOpenListeners=[];let n=this._client.visibleDocuments;this._pendingOpenListeners.push(n.onClose(i=>{for(let s of i)this._pendingOpenNotifications.delete(s.toString())})),this._pendingOpenListeners.push(n.onOpen(i=>{for(let s of i){let o=this._pendingOpenNotifications.get(s.toString());o!==void 0&&(super.callback(o).catch((a=>{this._client.error(`Sending document notification ${this._type.method} failed`,a)})),this._pendingOpenNotifications.delete(s.toString()))}})),this._pendingOpenListeners.push(me.workspace.onDidCloseTextDocument(i=>{this._pendingOpenNotifications.delete(i.uri.toString())}))}}async sendPendingOpenNotifications(e){let t=Array.from(this._pendingOpenNotifications.values());this._pendingOpenNotifications.clear();let n=!1;for(let i of t){if(e!==void 0&&i.uri.toString()===e){n=!0;continue}await super.callback(i)}return n}getTextDocument(e){return e}notificationSent(e,t,n){this._syncedDocuments.set(e.uri.toString(),e),super.notificationSent(e,t,n)}clear(){if(this._pendingOpenNotifications.clear(),this._pendingOpenListeners!==void 0){for(let e of this._pendingOpenListeners)e.dispose();this._pendingOpenListeners=void 0}super.clear()}};ve.DidOpenTextDocumentFeature=Co;var bo=class extends ce.TextDocumentEventFeature{_syncedDocuments;_pendingTextDocumentChanges;constructor(e,t,n){super(e,me.workspace.onDidCloseTextDocument,ee.DidCloseTextDocumentNotification.type,()=>e.middleware.didClose,i=>e.code2ProtocolConverter.asCloseTextDocumentParams(i),i=>i,ce.TextDocumentEventFeature.textDocumentFilter),this._syncedDocuments=t,this._pendingTextDocumentChanges=n}get registrationType(){return ee.DidCloseTextDocumentNotification.type}fillClientCapabilities(e){(0,ce.ensure)((0,ce.ensure)(e,"textDocument"),"synchronization").dynamicRegistration=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;t&&n&&n.openClose&&this.register({id:xn.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);if(t===void 0)return;super.unregister(e);let n=this._selectors.values();this._syncedDocuments.forEach(i=>{if(me.languages.match(t,i)>0&&!this._selectorFilter(n,i)&&!this._client.hasDedicatedTextSynchronizationFeature(i)){let s=this._client.middleware,o=a=>this._client.sendNotification(this._type,this._createParams(a));this._syncedDocuments.delete(i.uri.toString()),(s.didClose?s.didClose(i,o):o(i)).catch(a=>{this._client.error(`Sending document notification ${this._type.method} failed`,a)})}})}};ve.DidCloseTextDocumentFeature=bo;var So=class extends ce.DynamicDocumentFeature{_listener;_changeData;_onNotificationSent;_onPendingChangeAdded;_pendingTextDocumentChanges;_syncKind;constructor(e,t){super(e),this._changeData=new Map,this._onNotificationSent=new me.EventEmitter,this._onPendingChangeAdded=new me.EventEmitter,this._pendingTextDocumentChanges=t,this._syncKind=ee.TextDocumentSyncKind.None}get onNotificationSent(){return this._onNotificationSent.event}get onPendingChangeAdded(){return this._onPendingChangeAdded.event}get syncKind(){return this._syncKind}get registrationType(){return ee.DidChangeTextDocumentNotification.type}fillClientCapabilities(e){(0,ce.ensure)((0,ce.ensure)(e,"textDocument"),"synchronization").dynamicRegistration=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;t&&n&&n.change!==void 0&&n.change!==ee.TextDocumentSyncKind.None&&this.register({id:xn.generateUuid(),registerOptions:Object.assign({},{documentSelector:t},{syncKind:n.change})})}register(e){e.registerOptions.documentSelector&&(this._listener||(this._listener=me.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 s of this._changeData.values())if(me.languages.match(s.documentSelector,e.document)>0&&!this._client.hasDedicatedTextSynchronizationFeature(e.document)){let o=this._client.middleware;if(s.syncKind===ee.TextDocumentSyncKind.Incremental){let a=async u=>{let l=this._client.code2ProtocolConverter.asChangeTextDocumentParams(u,t,n);await this._client.sendNotification(ee.DidChangeTextDocumentNotification.type,l),this.notificationSent(u.document,ee.DidChangeTextDocumentNotification.type,l)};i.push(o.didChange?o.didChange(e,u=>a(u)):a(e))}else if(s.syncKind===ee.TextDocumentSyncKind.Full){let a=async u=>{let l=u.document.uri.toString();this._pendingTextDocumentChanges.set(l,u.document),this._onPendingChangeAdded.fire()};i.push(o.didChange?o.didChange(e,u=>a(u)):a(e))}}return Promise.all(i).then(void 0,s=>{throw this._client.error(`Sending document notification ${ee.DidChangeTextDocumentNotification.type.method} failed`,s),s})}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=ee.TextDocumentSyncKind.None;else{this._syncKind=ee.TextDocumentSyncKind.None;for(let t of this._changeData.values())if(this.updateSyncKind(t.syncKind),this._syncKind===ee.TextDocumentSyncKind.Full)break}}clear(){this._pendingTextDocumentChanges.clear(),this._changeData.clear(),this._syncKind=ee.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(me.languages.match(t.documentSelector,e)>0)return{send:n=>this.callback(n)}}updateSyncKind(e){if(this._syncKind!==ee.TextDocumentSyncKind.Full)switch(e){case ee.TextDocumentSyncKind.Full:this._syncKind=e;break;case ee.TextDocumentSyncKind.Incremental:this._syncKind===ee.TextDocumentSyncKind.None&&(this._syncKind=ee.TextDocumentSyncKind.Incremental);break}}};ve.DidChangeTextDocumentFeature=So;var Do=class extends ce.TextDocumentEventFeature{constructor(e){super(e,me.workspace.onWillSaveTextDocument,ee.WillSaveTextDocumentNotification.type,()=>e.middleware.willSave,t=>e.code2ProtocolConverter.asWillSaveTextDocumentParams(t),t=>t.document,(t,n)=>ce.TextDocumentEventFeature.textDocumentFilter(t,n.document))}get registrationType(){return ee.WillSaveTextDocumentNotification.type}fillClientCapabilities(e){let t=(0,ce.ensure)((0,ce.ensure)(e,"textDocument"),"synchronization");t.willSave=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;t&&n&&n.willSave&&this.register({id:xn.generateUuid(),registerOptions:{documentSelector:t}})}getTextDocument(e){return e.document}};ve.WillSaveFeature=Do;var Po=class extends ce.DynamicDocumentFeature{_listener;_selectors;constructor(e){super(e),this._selectors=new Map}getDocumentSelectors(){return this._selectors.values()}get registrationType(){return ee.WillSaveTextDocumentWaitUntilRequest.type}fillClientCapabilities(e){let t=(0,ce.ensure)((0,ce.ensure)(e,"textDocument"),"synchronization");t.willSaveWaitUntil=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;t&&n&&n.willSaveWaitUntil&&this.register({id:xn.generateUuid(),registerOptions:{documentSelector:t}})}register(e){e.registerOptions.documentSelector&&(this._listener||(this._listener=me.workspace.onWillSaveTextDocument(this.callback,this)),this._selectors.set(e.id,this._client.protocol2CodeConverter.asDocumentSelector(e.registerOptions.documentSelector)))}callback(e){if(ce.TextDocumentEventFeature.textDocumentFilter(this._selectors.values(),e.document)&&!this._client.hasDedicatedTextSynchronizationFeature(e.document)){let t=this._client.middleware,n=i=>this._client.sendRequest(ee.WillSaveTextDocumentWaitUntilRequest.type,this._client.code2ProtocolConverter.asWillSaveTextDocumentParams(i)).then(async s=>{let o=await this._client.protocol2CodeConverter.asTextEdits(s);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)}};ve.WillSaveWaitUntilFeature=Po;var To=class extends ce.TextDocumentEventFeature{_includeText;constructor(e){super(e,me.workspace.onDidSaveTextDocument,ee.DidSaveTextDocumentNotification.type,()=>e.middleware.didSave,t=>e.code2ProtocolConverter.asSaveTextDocumentParams(t,this._includeText),t=>t,ce.TextDocumentEventFeature.textDocumentFilter),this._includeText=!1}get registrationType(){return ee.DidSaveTextDocumentNotification.type}fillClientCapabilities(e){(0,ce.ensure)((0,ce.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:xn.generateUuid(),registerOptions:Object.assign({},{documentSelector:t},i)})}}register(e){this._includeText=!!e.registerOptions.includeText,super.register(e)}getTextDocument(e){return e}};ve.DidSaveTextDocumentFeature=To;var wp="`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?";function Cp(r=""){let e="(-?\\d*\\.\\d\\w*)|([^";for(let t of wp)r.indexOf(t)>=0||(e+="\\"+t);return e+="\\s]+)",new RegExp(e,"g")}var bp=Cp(),Ro=class r{_extTextDocument;_capturedTextDocument;_content;_uri;_fileName;_languageId;_version;_eol;_isUntitled;_encoding;_isDirty;_isClosed;constructor(e){this._extTextDocument=e,this._content=e.getText(),this._uri=e.uri,this._fileName=e.fileName,this._languageId=e.languageId,this._version=e.version,this._eol=e.eol,this._isUntitled=e.isUntitled,this._encoding=e.encoding,this._isDirty=e.isDirty,this._isClosed=e.isClosed,this._capturedTextDocument=_p.TextDocument.create(this._uri.toString(),this._languageId,this._version,this._content)}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}get eol(){return this._eol}get isUntitled(){return this._isUntitled}get encoding(){return this._encoding}get fileName(){return this._fileName}get isDirty(){return this._isDirty}get isClosed(){return this._isClosed}save(){return this.version===this._extTextDocument.version?this._extTextDocument.save():Promise.resolve(!1)}get lineCount(){return this._capturedTextDocument.lineCount}offsetAt(e){return this._capturedTextDocument.offsetAt(e)}positionAt(e){let t=this._capturedTextDocument.positionAt(e);return new me.Position(t.line,t.character)}getText(e){return this._capturedTextDocument.getText(e)}lineAt(e){let t=typeof e=="number"?e:this.validatePosition(e).line;if(t<0||t>=this.lineCount)throw new RangeError(`Illegal value for line: ${t}`);let n=this._capturedTextDocument.getLineRange(t),i=this._capturedTextDocument.getText(n),s=i.search(/\S/),o=new me.Range(n.start.line,n.start.character,n.end.line,n.end.character),a=t+1<this.lineCount?new me.Range(o.start.line,o.start.character,t+1,0):o;return{lineNumber:t,text:i,range:o,rangeIncludingLineBreak:a,firstNonWhitespaceCharacterIndex:s===-1?i.length:s,isEmptyOrWhitespace:s===-1}}getWordRangeAtPosition(e,t){let n=this.validatePosition(e).line,i=this.lineAt(n).text,s=r.getWordRegExp(t),o;for(s.lastIndex=0;(o=s.exec(i))!==null;)if(o.index<=e.character&&s.lastIndex>=e.character)return new me.Range(n,o.index,n,s.lastIndex)}validateRange(e){let t=this.validatePosition(e.start),n=this.validatePosition(e.end);return t===e.start&&n===e.end?e:new me.Range(t.line,t.character,n.line,n.character)}validatePosition(e){let t=Math.min(Math.max(e.line,0),this.lineCount-1),n=this._capturedTextDocument.getLineRange(t),i=Math.min(Math.max(e.character,0),n.end.character);return t===e.line&&i===e.character?e:new me.Position(t,i)}static getWordRegExp(e){let t=e??bp;if(t.flags.includes("g"))return t;let n=`${t.flags}g`;return new RegExp(t.source,n)}}});var Mu=M(st=>{"use strict";var Sp=st&&st.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Dp=st&&st.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Pp=st&&st.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Sp(t,e,n[i]);return Dp(t,e),t}})();Object.defineProperty(st,"__esModule",{value:!0});st.CompletionItemFeature=void 0;var Tp=I("vscode"),H=N(),Oo=B(),Rp=Pp(ne()),Op=[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],Fo=class extends Oo.TextDocumentLanguageFeature{labelDetailsSupport;constructor(e){super(e,H.CompletionRequest.type),this.labelDetailsSupport=new Map}fillClientCapabilities(e){let t=(0,Oo.ensure)((0,Oo.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:Op},t.completionList={itemDefaults:["commitCharacters","editRange","insertTextFormat","insertTextMode","data"],applyKindSupport:!0}}initialize(e,t){let n=this.getRegistrationOptions(t,e.completionProvider);n&&this.register({id:Rp.generateUuid(),registerOptions:n})}registerLanguageProvider(e,t){this.labelDetailsSupport.set(t,!!e.completionItem?.labelDetailsSupport);let n=e.triggerCharacters??[],i=e.allCommitCharacters,s=e.documentSelector,o={provideCompletionItems:(a,u,l,p)=>{let h=this._client,f=this._client.middleware,m=(g,v,_,T)=>h.sendRequest(H.CompletionRequest.type,h.code2ProtocolConverter.asCompletionParams(g,v,_),T).then(C=>T.isCancellationRequested?null:h.protocol2CodeConverter.asCompletionResult(C,i,T),C=>h.handleFailedRequest(H.CompletionRequest.type,T,C,null));return f.provideCompletionItem?f.provideCompletionItem(a,u,p,l,m):m(a,u,p,l)},resolveCompletionItem:e.resolveProvider?(a,u)=>{let l=this._client,p=this._client.middleware,h=(f,m)=>l.sendRequest(H.CompletionResolveRequest.type,l.code2ProtocolConverter.asCompletionItem(f,!!this.labelDetailsSupport.get(t)),m).then(g=>m.isCancellationRequested?null:l.protocol2CodeConverter.asCompletionItem(g),g=>l.handleFailedRequest(H.CompletionResolveRequest.type,m,g,f));return p.resolveCompletionItem?p.resolveCompletionItem(a,u,h):h(a,u)}:void 0};return[Tp.languages.registerCompletionItemProvider(this._client.protocol2CodeConverter.asDocumentSelector(s),o,...n),o]}};st.CompletionItemFeature=Fo});var ku=M(ot=>{"use strict";var Fp=ot&&ot.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),xp=ot&&ot.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Mp=ot&&ot.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Fp(t,e,n[i]);return xp(t,e),t}})();Object.defineProperty(ot,"__esModule",{value:!0});ot.HoverFeature=void 0;var kp=I("vscode"),ui=N(),xo=B(),Ep=Mp(ne()),Mo=class extends xo.TextDocumentLanguageFeature{constructor(e){super(e,ui.HoverRequest.type)}fillClientCapabilities(e){let t=(0,xo.ensure)((0,xo.ensure)(e,"textDocument"),"hover");t.dynamicRegistration=!0,t.contentFormat=[ui.MarkupKind.Markdown,ui.MarkupKind.PlainText]}initialize(e,t){let n=this.getRegistrationOptions(t,e.hoverProvider);n&&this.register({id:Ep.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideHover:(i,s,o)=>{let a=this._client,u=(p,h,f)=>a.sendRequest(ui.HoverRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(p,h),f).then(m=>f.isCancellationRequested?null:a.protocol2CodeConverter.asHover(m),m=>a.handleFailedRequest(ui.HoverRequest.type,f,m,null)),l=a.middleware;return l.provideHover?l.provideHover(i,s,o,u):u(i,s,o)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return kp.languages.registerHoverProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};ot.HoverFeature=Mo});var Eu=M(at=>{"use strict";var qp=at&&at.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Ip=at&&at.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Ap=at&&at.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&qp(t,e,n[i]);return Ip(t,e),t}})();Object.defineProperty(at,"__esModule",{value:!0});at.DefinitionFeature=void 0;var jp=I("vscode"),ko=N(),Eo=B(),Lp=Ap(ne()),qo=class extends Eo.TextDocumentLanguageFeature{constructor(e){super(e,ko.DefinitionRequest.type)}fillClientCapabilities(e){let t=(0,Eo.ensure)((0,Eo.ensure)(e,"textDocument"),"definition");t.dynamicRegistration=!0,t.linkSupport=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.definitionProvider);n&&this.register({id:Lp.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDefinition:(i,s,o)=>{let a=this._client,u=(p,h,f)=>a.sendRequest(ko.DefinitionRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(p,h),f).then(m=>f.isCancellationRequested?null:a.protocol2CodeConverter.asDefinitionResult(m,f),m=>a.handleFailedRequest(ko.DefinitionRequest.type,f,m,null)),l=a.middleware;return l.provideDefinition?l.provideDefinition(i,s,o,u):u(i,s,o)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return jp.languages.registerDefinitionProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};at.DefinitionFeature=qo});var Iu=M(ct=>{"use strict";var Np=ct&&ct.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Up=ct&&ct.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Kp=ct&&ct.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Np(t,e,n[i]);return Up(t,e),t}})();Object.defineProperty(ct,"__esModule",{value:!0});ct.SignatureHelpFeature=void 0;var qu=I("vscode"),li=N(),Io=B(),Hp=Kp(ne()),Ao=class extends Io.TextDocumentLanguageFeature{constructor(e){super(e,li.SignatureHelpRequest.type)}fillClientCapabilities(e){let t=(0,Io.ensure)((0,Io.ensure)(e,"textDocument"),"signatureHelp");t.dynamicRegistration=!0,t.signatureInformation={documentationFormat:[li.MarkupKind.Markdown,li.MarkupKind.PlainText]},t.signatureInformation.parameterInformation={labelOffsetSupport:!0},t.signatureInformation.activeParameterSupport=!0,t.signatureInformation.noActiveParameterSupport=!0,t.contextSupport=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.signatureHelpProvider);n&&this.register({id:Hp.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t={provideSignatureHelp:(n,i,s,o)=>{let a=this._client,u=(p,h,f,m)=>a.sendRequest(li.SignatureHelpRequest.type,a.code2ProtocolConverter.asSignatureHelpParams(p,h,f),m).then(g=>m.isCancellationRequested?null:a.protocol2CodeConverter.asSignatureHelp(g,m),g=>a.handleFailedRequest(li.SignatureHelpRequest.type,m,g,null)),l=a.middleware;return l.provideSignatureHelp?l.provideSignatureHelp(n,i,o,s,u):u(n,i,o,s)}};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 qu.languages.registerSignatureHelpProvider(n,t,...i)}else{let i={triggerCharacters:e.triggerCharacters||[],retriggerCharacters:e.retriggerCharacters||[]};return qu.languages.registerSignatureHelpProvider(n,t,i)}}};ct.SignatureHelpFeature=Ao});var Au=M(ut=>{"use strict";var Wp=ut&&ut.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),$p=ut&&ut.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Bp=ut&&ut.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Wp(t,e,n[i]);return $p(t,e),t}})();Object.defineProperty(ut,"__esModule",{value:!0});ut.DocumentHighlightFeature=void 0;var zp=I("vscode"),jo=N(),Lo=B(),Vp=Bp(ne()),No=class extends Lo.TextDocumentLanguageFeature{constructor(e){super(e,jo.DocumentHighlightRequest.type)}fillClientCapabilities(e){(0,Lo.ensure)((0,Lo.ensure)(e,"textDocument"),"documentHighlight").dynamicRegistration=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentHighlightProvider);n&&this.register({id:Vp.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDocumentHighlights:(i,s,o)=>{let a=this._client,u=(p,h,f)=>a.sendRequest(jo.DocumentHighlightRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(p,h),f).then(m=>f.isCancellationRequested?null:a.protocol2CodeConverter.asDocumentHighlights(m,f),m=>a.handleFailedRequest(jo.DocumentHighlightRequest.type,f,m,null)),l=a.middleware;return l.provideDocumentHighlights?l.provideDocumentHighlights(i,s,o,u):u(i,s,o)}};return[zp.languages.registerDocumentHighlightProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};ut.DocumentHighlightFeature=No});var Ho=M(Pe=>{"use strict";var Gp=Pe&&Pe.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Jp=Pe&&Pe.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Yp=Pe&&Pe.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Gp(t,e,n[i]);return Jp(t,e),t}})();Object.defineProperty(Pe,"__esModule",{value:!0});Pe.DocumentSymbolFeature=Pe.SupportedSymbolTags=Pe.SupportedSymbolKinds=void 0;var Qp=I("vscode"),J=N(),Uo=B(),Zp=Yp(ne());Pe.SupportedSymbolKinds=[J.SymbolKind.File,J.SymbolKind.Module,J.SymbolKind.Namespace,J.SymbolKind.Package,J.SymbolKind.Class,J.SymbolKind.Method,J.SymbolKind.Property,J.SymbolKind.Field,J.SymbolKind.Constructor,J.SymbolKind.Enum,J.SymbolKind.Interface,J.SymbolKind.Function,J.SymbolKind.Variable,J.SymbolKind.Constant,J.SymbolKind.String,J.SymbolKind.Number,J.SymbolKind.Boolean,J.SymbolKind.Array,J.SymbolKind.Object,J.SymbolKind.Key,J.SymbolKind.Null,J.SymbolKind.EnumMember,J.SymbolKind.Struct,J.SymbolKind.Event,J.SymbolKind.Operator,J.SymbolKind.TypeParameter];Pe.SupportedSymbolTags=[J.SymbolTag.Deprecated];var Ko=class extends Uo.TextDocumentLanguageFeature{constructor(e){super(e,J.DocumentSymbolRequest.type)}fillClientCapabilities(e){let t=(0,Uo.ensure)((0,Uo.ensure)(e,"textDocument"),"documentSymbol");t.dynamicRegistration=!0,t.symbolKind={valueSet:Pe.SupportedSymbolKinds},t.hierarchicalDocumentSymbolSupport=!0,t.tagSupport={valueSet:Pe.SupportedSymbolTags},t.labelSupport=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentSymbolProvider);n&&this.register({id:Zp.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDocumentSymbols:(s,o)=>{let a=this._client,u=async(p,h)=>{try{let f=await a.sendRequest(J.DocumentSymbolRequest.type,a.code2ProtocolConverter.asDocumentSymbolParams(p),h);if(h.isCancellationRequested||f===void 0||f===null)return null;if(f.length===0)return[];{let m=f[0];return J.DocumentSymbol.is(m)?await a.protocol2CodeConverter.asDocumentSymbols(f,h):await a.protocol2CodeConverter.asSymbolInformations(f,h)}}catch(f){return a.handleFailedRequest(J.DocumentSymbolRequest.type,h,f,null)}},l=a.middleware;return l.provideDocumentSymbols?l.provideDocumentSymbols(s,o,u):u(s,o)}},i=e.label!==void 0?{label:e.label}:void 0;return[Qp.languages.registerDocumentSymbolProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n,i),n]}};Pe.DocumentSymbolFeature=Ko});var Lu=M(lt=>{"use strict";var Xp=lt&<.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),eg=lt&<.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),tg=lt&<.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Xp(t,e,n[i]);return eg(t,e),t}})();Object.defineProperty(lt,"__esModule",{value:!0});lt.WorkspaceSymbolFeature=void 0;var ng=I("vscode"),di=N(),Wo=B(),ju=Ho(),ig=tg(ne()),$o=class extends Wo.WorkspaceFeature{constructor(e){super(e,di.WorkspaceSymbolRequest.type)}fillClientCapabilities(e){let t=(0,Wo.ensure)((0,Wo.ensure)(e,"workspace"),"symbol");t.dynamicRegistration=!0,t.symbolKind={valueSet:ju.SupportedSymbolKinds},t.tagSupport={valueSet:ju.SupportedSymbolTags},t.resolveSupport={properties:["location.range"]}}initialize(e){e.workspaceSymbolProvider&&this.register({id:ig.generateUuid(),registerOptions:e.workspaceSymbolProvider===!0?{workDoneProgress:!1}:e.workspaceSymbolProvider})}registerLanguageProvider(e){let t={provideWorkspaceSymbols:(n,i)=>{let s=this._client,o=(u,l)=>s.sendRequest(di.WorkspaceSymbolRequest.type,{query:u},l).then(p=>l.isCancellationRequested?null:s.protocol2CodeConverter.asSymbolInformations(p,l),p=>s.handleFailedRequest(di.WorkspaceSymbolRequest.type,l,p,null)),a=s.middleware;return a.provideWorkspaceSymbols?a.provideWorkspaceSymbols(n,i,o):o(n,i)},resolveWorkspaceSymbol:e.resolveProvider===!0?(n,i)=>{let s=this._client,o=(u,l)=>s.sendRequest(di.WorkspaceSymbolResolveRequest.type,s.code2ProtocolConverter.asWorkspaceSymbol(u),l).then(p=>l.isCancellationRequested?null:s.protocol2CodeConverter.asSymbolInformation(p),p=>s.handleFailedRequest(di.WorkspaceSymbolResolveRequest.type,l,p,null)),a=s.middleware;return a.resolveWorkspaceSymbol?a.resolveWorkspaceSymbol(n,i,o):o(n,i)}:void 0};return[ng.languages.registerWorkspaceSymbolProvider(t),t]}};lt.WorkspaceSymbolFeature=$o});var Nu=M(dt=>{"use strict";var rg=dt&&dt.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),sg=dt&&dt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),og=dt&&dt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&rg(t,e,n[i]);return sg(t,e),t}})();Object.defineProperty(dt,"__esModule",{value:!0});dt.ReferencesFeature=void 0;var ag=I("vscode"),Bo=N(),zo=B(),cg=og(ne()),Vo=class extends zo.TextDocumentLanguageFeature{constructor(e){super(e,Bo.ReferencesRequest.type)}fillClientCapabilities(e){(0,zo.ensure)((0,zo.ensure)(e,"textDocument"),"references").dynamicRegistration=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.referencesProvider);n&&this.register({id:cg.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideReferences:(i,s,o,a)=>{let u=this._client,l=(h,f,m,g)=>u.sendRequest(Bo.ReferencesRequest.type,u.code2ProtocolConverter.asReferenceParams(h,f,m),g).then(v=>g.isCancellationRequested?null:u.protocol2CodeConverter.asReferences(v,g),v=>u.handleFailedRequest(Bo.ReferencesRequest.type,g,v,null)),p=u.middleware;return p.provideReferences?p.provideReferences(i,s,o,a,l):l(i,s,o,a)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return ag.languages.registerReferenceProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};dt.ReferencesFeature=Vo});var Uu=M(vr=>{"use strict";Object.defineProperty(vr,"__esModule",{value:!0});vr.TypeDefinitionFeature=void 0;var ug=I("vscode"),Go=N(),fi=B(),Jo=class extends fi.TextDocumentLanguageFeature{constructor(e){super(e,Go.TypeDefinitionRequest.type)}fillClientCapabilities(e){(0,fi.ensure)((0,fi.ensure)(e,"textDocument"),"typeDefinition").dynamicRegistration=!0;let t=(0,fi.ensure)((0,fi.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,s,o)=>{let a=this._client,u=(p,h,f)=>a.sendRequest(Go.TypeDefinitionRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(p,h),f).then(m=>f.isCancellationRequested?null:a.protocol2CodeConverter.asDefinitionResult(m,f),m=>a.handleFailedRequest(Go.TypeDefinitionRequest.type,f,m,null)),l=a.middleware;return l.provideTypeDefinition?l.provideTypeDefinition(i,s,o,u):u(i,s,o)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return ug.languages.registerTypeDefinitionProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};vr.TypeDefinitionFeature=Jo});var Ku=M(yr=>{"use strict";Object.defineProperty(yr,"__esModule",{value:!0});yr.ImplementationFeature=void 0;var lg=I("vscode"),Yo=N(),Qo=B(),Zo=class extends Qo.TextDocumentLanguageFeature{constructor(e){super(e,Yo.ImplementationRequest.type)}fillClientCapabilities(e){let t=(0,Qo.ensure)((0,Qo.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,s,o)=>{let a=this._client,u=(p,h,f)=>a.sendRequest(Yo.ImplementationRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(p,h),f).then(m=>f.isCancellationRequested?null:a.protocol2CodeConverter.asDefinitionResult(m,f),m=>a.handleFailedRequest(Yo.ImplementationRequest.type,f,m,null)),l=a.middleware;return l.provideImplementation?l.provideImplementation(i,s,o,u):u(i,s,o)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return lg.languages.registerImplementationProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};yr.ImplementationFeature=Zo});var Hu=M(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});_r.ColorProviderFeature=void 0;var dg=I("vscode"),hi=N(),Xo=B(),ea=class extends Xo.TextDocumentLanguageFeature{constructor(e){super(e,hi.DocumentColorRequest.type)}fillClientCapabilities(e){(0,Xo.ensure)((0,Xo.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,s,o)=>{let a=this._client,u=(p,h,f)=>{let m={color:p,textDocument:a.code2ProtocolConverter.asTextDocumentIdentifier(h.document),range:a.code2ProtocolConverter.asRange(h.range)};return a.sendRequest(hi.ColorPresentationRequest.type,m,f).then(g=>f.isCancellationRequested?null:this._client.protocol2CodeConverter.asColorPresentations(g,f),g=>a.handleFailedRequest(hi.ColorPresentationRequest.type,f,g,null))},l=a.middleware;return l.provideColorPresentations?l.provideColorPresentations(i,s,o,u):u(i,s,o)},provideDocumentColors:(i,s)=>{let o=this._client,a=(l,p)=>{let h={textDocument:o.code2ProtocolConverter.asTextDocumentIdentifier(l)};return o.sendRequest(hi.DocumentColorRequest.type,h,p).then(f=>p.isCancellationRequested?null:this._client.protocol2CodeConverter.asColorInformations(f,p),f=>o.handleFailedRequest(hi.DocumentColorRequest.type,p,f,null))},u=o.middleware;return u.provideDocumentColors?u.provideDocumentColors(i,s,a):a(i,s)}};return[dg.languages.registerColorProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};_r.ColorProviderFeature=ea});var Wu=M(ft=>{"use strict";var fg=ft&&ft.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),hg=ft&&ft.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),pg=ft&&ft.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&fg(t,e,n[i]);return hg(t,e),t}})();Object.defineProperty(ft,"__esModule",{value:!0});ft.CodeActionFeature=void 0;var gg=I("vscode"),Te=N(),mg=pg(ne()),ta=B(),na=class extends ta.TextDocumentLanguageFeature{constructor(e){super(e,Te.CodeActionRequest.type)}fillClientCapabilities(e){let t=(0,ta.ensure)((0,ta.ensure)(e,"textDocument"),"codeAction");t.dynamicRegistration=!0,t.isPreferredSupport=!0,t.disabledSupport=!0,t.dataSupport=!0,t.resolveSupport={properties:["edit","command"]},t.codeActionLiteralSupport={codeActionKind:{valueSet:[Te.CodeActionKind.Empty,Te.CodeActionKind.QuickFix,Te.CodeActionKind.Refactor,Te.CodeActionKind.RefactorExtract,Te.CodeActionKind.RefactorInline,Te.CodeActionKind.RefactorMove,Te.CodeActionKind.RefactorRewrite,Te.CodeActionKind.Source,Te.CodeActionKind.SourceOrganizeImports,Te.CodeActionKind.Notebook]}},t.honorsChangeAnnotations=!0,t.documentationSupport=!0,t.tagSupport={valueSet:[Te.CodeActionTag.LLMGenerated]}}initialize(e,t){let n=this.getRegistrationOptions(t,e.codeActionProvider);n&&this.register({id:mg.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideCodeActions:(i,s,o,a)=>{let u=this._client,l=async(h,f,m,g)=>{let v={textDocument:u.code2ProtocolConverter.asTextDocumentIdentifier(h),range:u.code2ProtocolConverter.asRange(f),context:u.code2ProtocolConverter.asCodeActionContextSync(m)};return u.sendRequest(Te.CodeActionRequest.type,v,g).then(_=>g.isCancellationRequested||_===null||_===void 0?null:u.protocol2CodeConverter.asCodeActionResult(_,g),_=>u.handleFailedRequest(Te.CodeActionRequest.type,g,_,null))},p=u.middleware;return p.provideCodeActions?p.provideCodeActions(i,s,o,a,l):l(i,s,o,a)},resolveCodeAction:e.resolveProvider?(i,s)=>{let o=this._client,a=this._client.middleware,u=async(l,p)=>o.sendRequest(Te.CodeActionResolveRequest.type,o.code2ProtocolConverter.asCodeActionSync(l),p).then(h=>p.isCancellationRequested?l:o.protocol2CodeConverter.asCodeAction(h,p),h=>o.handleFailedRequest(Te.CodeActionResolveRequest.type,p,h,l));return a.resolveCodeAction?a.resolveCodeAction(i,s,u):u(i,s)}:void 0};return[gg.languages.registerCodeActionsProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n,this.getMetadata(e)),n]}getMetadata(e){if(!(e.codeActionKinds===void 0&&e.documentation===void 0))return{providedCodeActionKinds:this._client.protocol2CodeConverter.asCodeActionKinds(e.codeActionKinds),documentation:this._client.protocol2CodeConverter.asCodeActionDocumentations(e.documentation)}}};ft.CodeActionFeature=na});var Bu=M(ht=>{"use strict";var vg=ht&&ht.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),yg=ht&&ht.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),_g=ht&&ht.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&vg(t,e,n[i]);return yg(t,e),t}})();Object.defineProperty(ht,"__esModule",{value:!0});ht.CodeLensFeature=void 0;var $u=I("vscode"),Mn=N(),wg=_g(ne()),pi=B(),ia=class extends pi.TextDocumentLanguageFeature{constructor(e){super(e,Mn.CodeLensRequest.type)}fillClientCapabilities(e){let t=(0,pi.ensure)((0,pi.ensure)(e,"textDocument"),"codeLens");t.dynamicRegistration=!0,t.resolveSupport={properties:["command"]},(0,pi.ensure)((0,pi.ensure)(e,"workspace"),"codeLens").refreshSupport=!0}initialize(e,t){this._client.onRequest(Mn.CodeLensRefreshRequest.type,async()=>{for(let s of this.getAllProviders())s.onDidChangeCodeLensEmitter.fire()});let i=this.getRegistrationOptions(t,e.codeLensProvider);i&&this.register({id:wg.generateUuid(),registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n=new $u.EventEmitter,i={onDidChangeCodeLenses:n.event,provideCodeLenses:(s,o)=>{let a=this._client,u=(p,h)=>a.sendRequest(Mn.CodeLensRequest.type,a.code2ProtocolConverter.asCodeLensParams(p),h).then(f=>h.isCancellationRequested?null:a.protocol2CodeConverter.asCodeLenses(f,h),f=>a.handleFailedRequest(Mn.CodeLensRequest.type,h,f,null)),l=a.middleware;return l.provideCodeLenses?l.provideCodeLenses(s,o,u):u(s,o)},resolveCodeLens:e.resolveProvider?(s,o)=>{let a=this._client,u=(p,h)=>a.sendRequest(Mn.CodeLensResolveRequest.type,a.code2ProtocolConverter.asCodeLens(p),h).then(f=>h.isCancellationRequested?p:a.protocol2CodeConverter.asCodeLens(f),f=>a.handleFailedRequest(Mn.CodeLensResolveRequest.type,h,f,p)),l=a.middleware;return l.resolveCodeLens?l.resolveCodeLens(s,o,u):u(s,o)}:void 0};return[$u.languages.registerCodeLensProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),i),{provider:i,onDidChangeCodeLensEmitter:n}]}};ht.CodeLensFeature=ia});var zu=M(qe=>{"use strict";var Cg=qe&&qe.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),bg=qe&&qe.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Sg=qe&&qe.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Cg(t,e,n[i]);return bg(t,e),t}})();Object.defineProperty(qe,"__esModule",{value:!0});qe.DocumentOnTypeFormattingFeature=qe.DocumentRangeFormattingFeature=qe.DocumentFormattingFeature=void 0;var wr=I("vscode"),Ze=N(),aa=Sg(ne()),jt=B(),kn;(function(r){function e(t){let n=wr.workspace.getConfiguration("files",t);return{trimTrailingWhitespace:n.get("trimTrailingWhitespace"),trimFinalNewlines:n.get("trimFinalNewlines"),insertFinalNewline:n.get("insertFinalNewline")}}r.fromConfiguration=e})(kn||(kn={}));var ra=class extends jt.TextDocumentLanguageFeature{constructor(e){super(e,Ze.DocumentFormattingRequest.type)}fillClientCapabilities(e){(0,jt.ensure)((0,jt.ensure)(e,"textDocument"),"formatting").dynamicRegistration=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentFormattingProvider);n&&this.register({id:aa.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDocumentFormattingEdits:(i,s,o)=>{let a=this._client,u=(p,h,f)=>{let m={textDocument:a.code2ProtocolConverter.asTextDocumentIdentifier(p),options:a.code2ProtocolConverter.asFormattingOptions(h,kn.fromConfiguration(p))};return a.sendRequest(Ze.DocumentFormattingRequest.type,m,f).then(g=>f.isCancellationRequested?null:a.protocol2CodeConverter.asTextEdits(g,f),g=>a.handleFailedRequest(Ze.DocumentFormattingRequest.type,f,g,null))},l=a.middleware;return l.provideDocumentFormattingEdits?l.provideDocumentFormattingEdits(i,s,o,u):u(i,s,o)}};return[wr.languages.registerDocumentFormattingEditProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};qe.DocumentFormattingFeature=ra;var sa=class extends jt.TextDocumentLanguageFeature{constructor(e){super(e,Ze.DocumentRangeFormattingRequest.type)}fillClientCapabilities(e){let t=(0,jt.ensure)((0,jt.ensure)(e,"textDocument"),"rangeFormatting");t.dynamicRegistration=!0,t.rangesSupport=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentRangeFormattingProvider);n&&this.register({id:aa.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDocumentRangeFormattingEdits:(i,s,o,a)=>{let u=this._client,l=(h,f,m,g)=>{let v={textDocument:u.code2ProtocolConverter.asTextDocumentIdentifier(h),range:u.code2ProtocolConverter.asRange(f),options:u.code2ProtocolConverter.asFormattingOptions(m,kn.fromConfiguration(h))};return u.sendRequest(Ze.DocumentRangeFormattingRequest.type,v,g).then(_=>g.isCancellationRequested?null:u.protocol2CodeConverter.asTextEdits(_,g),_=>u.handleFailedRequest(Ze.DocumentRangeFormattingRequest.type,g,_,null))},p=u.middleware;return p.provideDocumentRangeFormattingEdits?p.provideDocumentRangeFormattingEdits(i,s,o,a,l):l(i,s,o,a)}};return e.rangesSupport&&(n.provideDocumentRangesFormattingEdits=(i,s,o,a)=>{let u=this._client,l=(h,f,m,g)=>{let v={textDocument:u.code2ProtocolConverter.asTextDocumentIdentifier(h),ranges:u.code2ProtocolConverter.asRanges(f),options:u.code2ProtocolConverter.asFormattingOptions(m,kn.fromConfiguration(h))};return u.sendRequest(Ze.DocumentRangesFormattingRequest.type,v,g).then(_=>g.isCancellationRequested?null:u.protocol2CodeConverter.asTextEdits(_,g),_=>u.handleFailedRequest(Ze.DocumentRangesFormattingRequest.type,g,_,null))},p=u.middleware;return p.provideDocumentRangesFormattingEdits?p.provideDocumentRangesFormattingEdits(i,s,o,a,l):l(i,s,o,a)}),[wr.languages.registerDocumentRangeFormattingEditProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};qe.DocumentRangeFormattingFeature=sa;var oa=class extends jt.TextDocumentLanguageFeature{constructor(e){super(e,Ze.DocumentOnTypeFormattingRequest.type)}fillClientCapabilities(e){(0,jt.ensure)((0,jt.ensure)(e,"textDocument"),"onTypeFormatting").dynamicRegistration=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentOnTypeFormattingProvider);n&&this.register({id:aa.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideOnTypeFormattingEdits:(s,o,a,u,l)=>{let p=this._client,h=(m,g,v,_,T)=>{let C={textDocument:p.code2ProtocolConverter.asTextDocumentIdentifier(m),position:p.code2ProtocolConverter.asPosition(g),ch:v,options:p.code2ProtocolConverter.asFormattingOptions(_,kn.fromConfiguration(m))};return p.sendRequest(Ze.DocumentOnTypeFormattingRequest.type,C,T).then(D=>T.isCancellationRequested?null:p.protocol2CodeConverter.asTextEdits(D,T),D=>p.handleFailedRequest(Ze.DocumentOnTypeFormattingRequest.type,T,D,null))},f=p.middleware;return f.provideOnTypeFormattingEdits?f.provideOnTypeFormattingEdits(s,o,a,u,l,h):h(s,o,a,u,l)}},i=e.moreTriggerCharacter||[];return[wr.languages.registerOnTypeFormattingEditProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n,e.firstTriggerCharacter,...i),n]}};qe.DocumentOnTypeFormattingFeature=oa});var Ju=M(pt=>{"use strict";var Dg=pt&&pt.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Pg=pt&&pt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Gu=pt&&pt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Dg(t,e,n[i]);return Pg(t,e),t}})();Object.defineProperty(pt,"__esModule",{value:!0});pt.RenameFeature=void 0;var Tg=I("vscode"),dn=N(),Rg=Gu(ne()),Vu=Gu(He()),ca=B(),ua=class extends ca.TextDocumentLanguageFeature{constructor(e){super(e,dn.RenameRequest.type)}fillClientCapabilities(e){let t=(0,ca.ensure)((0,ca.ensure)(e,"textDocument"),"rename");t.dynamicRegistration=!0,t.prepareSupport=!0,t.prepareSupportDefaultBehavior=dn.PrepareSupportDefaultBehavior.Identifier,t.honorsChangeAnnotations=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.renameProvider);n&&(Vu.boolean(e.renameProvider)&&(n.prepareProvider=!1),this.register({id:Rg.generateUuid(),registerOptions:n}))}registerLanguageProvider(e){let t=e.documentSelector,n={provideRenameEdits:(i,s,o,a)=>{let u=this._client,l=async(h,f,m,g)=>{let v={textDocument:u.code2ProtocolConverter.asTextDocumentIdentifier(h),position:u.code2ProtocolConverter.asPosition(f),newName:m},_=null;try{_=await u.sendRequest(dn.RenameRequest.type,v,g)}catch(C){return u.handleFailedRequest(dn.RenameRequest.type,g,C,null,!1)}if(g.isCancellationRequested||_===null)return null;let T=await u.protocol2CodeConverter.asWorkspaceEdit(_,g);if(g.isCancellationRequested)return null;if(!u.validateWorkspaceEdit(_))throw new Error("The rename edit returned from the server is not valid anymore and cannot be applied.");return T},p=u.middleware;return p.provideRenameEdits?p.provideRenameEdits(i,s,o,a,l):l(i,s,o,a)},prepareRename:e.prepareProvider?(i,s,o)=>{let a=this._client,u=(p,h,f)=>{let m={textDocument:a.code2ProtocolConverter.asTextDocumentIdentifier(p),position:a.code2ProtocolConverter.asPosition(h)};return a.sendRequest(dn.PrepareRenameRequest.type,m,f).then(g=>f.isCancellationRequested?null:dn.Range.is(g)?a.protocol2CodeConverter.asRange(g):this.isDefaultBehavior(g)?g.defaultBehavior===!0?null:Promise.reject(new Error("The element can't be renamed.")):g&&dn.Range.is(g.range)?{range:a.protocol2CodeConverter.asRange(g.range),placeholder:g.placeholder}:Promise.reject(new Error("The element can't be renamed.")),g=>{throw typeof g.message=="string"?new Error(g.message):new Error("The element can't be renamed.")})},l=a.middleware;return l.prepareRename?l.prepareRename(i,s,o,u):u(i,s,o)}:void 0};return[this.registerProvider(t,n),n]}registerProvider(e,t){return Tg.languages.registerRenameProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}isDefaultBehavior(e){let t=e;return t&&Vu.boolean(t.defaultBehavior)}};pt.RenameFeature=ua});var Yu=M(gt=>{"use strict";var Og=gt&>.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Fg=gt&>.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),xg=gt&>.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Og(t,e,n[i]);return Fg(t,e),t}})();Object.defineProperty(gt,"__esModule",{value:!0});gt.DocumentLinkFeature=void 0;var Mg=I("vscode"),gi=N(),la=B(),kg=xg(ne()),da=class extends la.TextDocumentLanguageFeature{constructor(e){super(e,gi.DocumentLinkRequest.type)}fillClientCapabilities(e){let t=(0,la.ensure)((0,la.ensure)(e,"textDocument"),"documentLink");t.dynamicRegistration=!0,t.tooltipSupport=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentLinkProvider);n&&this.register({id:kg.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDocumentLinks:(i,s)=>{let o=this._client,a=(l,p)=>o.sendRequest(gi.DocumentLinkRequest.type,o.code2ProtocolConverter.asDocumentLinkParams(l),p).then(h=>p.isCancellationRequested?null:o.protocol2CodeConverter.asDocumentLinks(h,p),h=>o.handleFailedRequest(gi.DocumentLinkRequest.type,p,h,null)),u=o.middleware;return u.provideDocumentLinks?u.provideDocumentLinks(i,s,a):a(i,s)},resolveDocumentLink:e.resolveProvider?(i,s)=>{let o=this._client,a=(l,p)=>o.sendRequest(gi.DocumentLinkResolveRequest.type,o.code2ProtocolConverter.asDocumentLink(l),p).then(h=>p.isCancellationRequested?l:o.protocol2CodeConverter.asDocumentLink(h),h=>o.handleFailedRequest(gi.DocumentLinkResolveRequest.type,p,h,l)),u=o.middleware;return u.resolveDocumentLink?u.resolveDocumentLink(i,s,a):a(i,s)}:void 0};return[Mg.languages.registerDocumentLinkProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};gt.DocumentLinkFeature=da});var Zu=M(mt=>{"use strict";var Eg=mt&&mt.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),qg=mt&&mt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Ig=mt&&mt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Eg(t,e,n[i]);return qg(t,e),t}})();Object.defineProperty(mt,"__esModule",{value:!0});mt.ExecuteCommandFeature=void 0;var Ag=I("vscode"),fa=N(),jg=Ig(ne()),Qu=B(),ha=class{_client;_commands;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 fa.ExecuteCommandRequest.type}fillClientCapabilities(e){(0,Qu.ensure)((0,Qu.ensure)(e,"workspace"),"executeCommand").dynamicRegistration=!0}initialize(e){e.executeCommandProvider&&this.register({id:jg.generateUuid(),registerOptions:Object.assign({},e.executeCommandProvider)})}register(e){let t=this._client,n=t.middleware,i=(s,o)=>{let a={command:s,arguments:o};return t.sendRequest(fa.ExecuteCommandRequest.type,a).then(void 0,u=>t.handleFailedRequest(fa.ExecuteCommandRequest.type,void 0,u,void 0))};if(e.registerOptions.commands){let s=[];for(let o of e.registerOptions.commands)s.push(Ag.commands.registerCommand(o,(...a)=>n.executeCommand?n.executeCommand(o,a,i):i(o,a)));this._commands.set(e.id,s)}}unregister(e){let t=this._commands.get(e);t&&(this._commands.delete(e),t.forEach(n=>n.dispose()))}clear(){this._commands.forEach(e=>{e.forEach(t=>t.dispose())}),this._commands.clear()}};mt.ExecuteCommandFeature=ha});var el=M(Cr=>{"use strict";Object.defineProperty(Cr,"__esModule",{value:!0});Cr.FoldingRangeFeature=void 0;var Xu=I("vscode"),fn=N(),mi=B(),pa=class extends mi.TextDocumentLanguageFeature{constructor(e){super(e,fn.FoldingRangeRequest.type)}fillClientCapabilities(e){let t=(0,mi.ensure)((0,mi.ensure)(e,"textDocument"),"foldingRange");t.dynamicRegistration=!0,t.rangeLimit=5e3,t.lineFoldingOnly=!0,t.foldingRangeKind={valueSet:[fn.FoldingRangeKind.Comment,fn.FoldingRangeKind.Imports,fn.FoldingRangeKind.Region]},t.foldingRange={collapsedText:!1},(0,mi.ensure)((0,mi.ensure)(e,"workspace"),"foldingRange").refreshSupport=!0}initialize(e,t){this._client.onRequest(fn.FoldingRangeRefreshRequest.type,async()=>{for(let s of this.getAllProviders())s.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 Xu.EventEmitter,i={onDidChangeFoldingRanges:n.event,provideFoldingRanges:(s,o,a)=>{let u=this._client,l=(h,f,m)=>{let g={textDocument:u.code2ProtocolConverter.asTextDocumentIdentifier(h)};return u.sendRequest(fn.FoldingRangeRequest.type,g,m).then(v=>m.isCancellationRequested?null:u.protocol2CodeConverter.asFoldingRanges(v,m),v=>u.handleFailedRequest(fn.FoldingRangeRequest.type,m,v,null))},p=u.middleware;return p.provideFoldingRanges?p.provideFoldingRanges(s,o,a,l):l(s,o,a)}};return[Xu.languages.registerFoldingRangeProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),i),{provider:i,onDidChangeFoldingRange:n}]}};Cr.FoldingRangeFeature=pa});var tl=M(br=>{"use strict";Object.defineProperty(br,"__esModule",{value:!0});br.DeclarationFeature=void 0;var Lg=I("vscode"),ga=N(),ma=B(),va=class extends ma.TextDocumentLanguageFeature{constructor(e){super(e,ga.DeclarationRequest.type)}fillClientCapabilities(e){let t=(0,ma.ensure)((0,ma.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,s,o)=>{let a=this._client,u=(p,h,f)=>a.sendRequest(ga.DeclarationRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(p,h),f).then(m=>f.isCancellationRequested?null:a.protocol2CodeConverter.asDeclarationResult(m,f),m=>a.handleFailedRequest(ga.DeclarationRequest.type,f,m,null)),l=a.middleware;return l.provideDeclaration?l.provideDeclaration(i,s,o,u):u(i,s,o)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return Lg.languages.registerDeclarationProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};br.DeclarationFeature=va});var nl=M(Sr=>{"use strict";Object.defineProperty(Sr,"__esModule",{value:!0});Sr.SelectionRangeFeature=void 0;var Ng=I("vscode"),ya=N(),_a=B(),wa=class extends _a.TextDocumentLanguageFeature{constructor(e){super(e,ya.SelectionRangeRequest.type)}fillClientCapabilities(e){let t=(0,_a.ensure)((0,_a.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,s,o)=>{let a=this._client,u=async(p,h,f)=>{let m={textDocument:a.code2ProtocolConverter.asTextDocumentIdentifier(p),positions:a.code2ProtocolConverter.asPositionsSync(h,f)};return a.sendRequest(ya.SelectionRangeRequest.type,m,f).then(g=>f.isCancellationRequested?null:a.protocol2CodeConverter.asSelectionRanges(g,f),g=>a.handleFailedRequest(ya.SelectionRangeRequest.type,f,g,null))},l=a.middleware;return l.provideSelectionRanges?l.provideSelectionRanges(i,s,o,u):u(i,s,o)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return Ng.languages.registerSelectionRangeProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Sr.SelectionRangeFeature=wa});var il=M(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});Dr.CallHierarchyFeature=void 0;var Ug=I("vscode"),hn=N(),Ca=B(),ba=class{client;middleware;constructor(e){this.client=e,this.middleware=e.middleware}prepareCallHierarchy(e,t,n){let i=this.client,s=this.middleware,o=(a,u,l)=>{let p=i.code2ProtocolConverter.asTextDocumentPositionParams(a,u);return i.sendRequest(hn.CallHierarchyPrepareRequest.type,p,l).then(h=>l.isCancellationRequested?null:i.protocol2CodeConverter.asCallHierarchyItems(h,l),h=>i.handleFailedRequest(hn.CallHierarchyPrepareRequest.type,l,h,null))};return s.prepareCallHierarchy?s.prepareCallHierarchy(e,t,n,o):o(e,t,n)}provideCallHierarchyIncomingCalls(e,t){let n=this.client,i=this.middleware,s=(o,a)=>{let u={item:n.code2ProtocolConverter.asCallHierarchyItem(o)};return n.sendRequest(hn.CallHierarchyIncomingCallsRequest.type,u,a).then(l=>a.isCancellationRequested?null:n.protocol2CodeConverter.asCallHierarchyIncomingCalls(l,a),l=>n.handleFailedRequest(hn.CallHierarchyIncomingCallsRequest.type,a,l,null))};return i.provideCallHierarchyIncomingCalls?i.provideCallHierarchyIncomingCalls(e,t,s):s(e,t)}provideCallHierarchyOutgoingCalls(e,t){let n=this.client,i=this.middleware,s=(o,a)=>{let u={item:n.code2ProtocolConverter.asCallHierarchyItem(o)};return n.sendRequest(hn.CallHierarchyOutgoingCallsRequest.type,u,a).then(l=>a.isCancellationRequested?null:n.protocol2CodeConverter.asCallHierarchyOutgoingCalls(l,a),l=>n.handleFailedRequest(hn.CallHierarchyOutgoingCallsRequest.type,a,l,null))};return i.provideCallHierarchyOutgoingCalls?i.provideCallHierarchyOutgoingCalls(e,t,s):s(e,t)}},Sa=class extends Ca.TextDocumentLanguageFeature{constructor(e){super(e,hn.CallHierarchyPrepareRequest.type)}fillClientCapabilities(e){let t=e,n=(0,Ca.ensure)((0,Ca.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 ba(t);return[Ug.languages.registerCallHierarchyProvider(this._client.protocol2CodeConverter.asDocumentSelector(e.documentSelector),n),n]}};Dr.CallHierarchyFeature=Sa});var sl=M(vt=>{"use strict";var Kg=vt&&vt.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Hg=vt&&vt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),rl=vt&&vt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Kg(t,e,n[i]);return Hg(t,e),t}})();Object.defineProperty(vt,"__esModule",{value:!0});vt.SemanticTokensFeature=void 0;var Pr=rl(I("vscode")),U=N(),vi=B(),Wg=rl(He()),Da=class extends vi.TextDocumentLanguageFeature{constructor(e){super(e,U.SemanticTokensRegistrationType.type)}fillClientCapabilities(e){let t=(0,vi.ensure)((0,vi.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.comment,U.SemanticTokenTypes.string,U.SemanticTokenTypes.number,U.SemanticTokenTypes.regexp,U.SemanticTokenTypes.operator,U.SemanticTokenTypes.decorator,U.SemanticTokenTypes.label],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,vi.ensure)((0,vi.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,s]=this.getRegistration(t,e.semanticTokensProvider);!i||!s||this.register({id:i,registerOptions:s})}registerLanguageProvider(e){let t=e.documentSelector,n=Wg.boolean(e.full)?e.full:e.full!==void 0,i=e.full!==void 0&&typeof e.full!="boolean"&&e.full.delta===!0,s=new Pr.EventEmitter,o=n?{onDidChangeSemanticTokens:s.event,provideDocumentSemanticTokens:(m,g)=>{let v=this._client,_=v.middleware,T=(C,D)=>{let F={textDocument:v.code2ProtocolConverter.asTextDocumentIdentifier(C)};return v.sendRequest(U.SemanticTokensRequest.type,F,D).then(E=>D.isCancellationRequested?null:v.protocol2CodeConverter.asSemanticTokens(E,D),E=>v.handleFailedRequest(U.SemanticTokensRequest.type,D,E,null))};return _.provideDocumentSemanticTokens?_.provideDocumentSemanticTokens(m,g,T):T(m,g)},provideDocumentSemanticTokensEdits:i?(m,g,v)=>{let _=this._client,T=_.middleware,C=(D,F,E)=>{let Q={textDocument:_.code2ProtocolConverter.asTextDocumentIdentifier(D),previousResultId:F};return _.sendRequest(U.SemanticTokensDeltaRequest.type,Q,E).then(async we=>E.isCancellationRequested?null:U.SemanticTokens.is(we)?await _.protocol2CodeConverter.asSemanticTokens(we,E):await _.protocol2CodeConverter.asSemanticTokensEdits(we,E),we=>_.handleFailedRequest(U.SemanticTokensDeltaRequest.type,E,we,null))};return T.provideDocumentSemanticTokensEdits?T.provideDocumentSemanticTokensEdits(m,g,v,C):C(m,g,v)}:void 0}:void 0,u=e.range===!0?{onDidChangeSemanticTokens:s.event,provideDocumentRangeSemanticTokens:(m,g,v)=>{let _=this._client,T=_.middleware,C=(D,F,E)=>{let Q={textDocument:_.code2ProtocolConverter.asTextDocumentIdentifier(D),range:_.code2ProtocolConverter.asRange(F)};return _.sendRequest(U.SemanticTokensRangeRequest.type,Q,E).then(we=>E.isCancellationRequested?null:_.protocol2CodeConverter.asSemanticTokens(we,E),we=>_.handleFailedRequest(U.SemanticTokensRangeRequest.type,E,we,null))};return T.provideDocumentRangeSemanticTokens?T.provideDocumentRangeSemanticTokens(m,g,v,C):C(m,g,v)}}:void 0,l=[],p=this._client,h=p.protocol2CodeConverter.asSemanticTokensLegend(e.legend),f=p.protocol2CodeConverter.asDocumentSelector(t);return o!==void 0&&l.push(Pr.languages.registerDocumentSemanticTokensProvider(f,o,h)),u!==void 0&&l.push(Pr.languages.registerDocumentRangeSemanticTokensProvider(f,u,h)),[new Pr.Disposable(()=>l.forEach(m=>m.dispose())),{range:u,full:o,onDidChangeSemanticTokensEmitter:s}]}};vt.SemanticTokensFeature=Da});var al=M(yt=>{"use strict";var $g=yt&&yt.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Bg=yt&&yt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),ol=yt&&yt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&$g(t,e,n[i]);return Bg(t,e),t}})();Object.defineProperty(yt,"__esModule",{value:!0});yt.LinkedEditingFeature=void 0;var zg=ol(I("vscode")),Pa=ol(N()),Ta=B(),Ra=class extends Ta.TextDocumentLanguageFeature{constructor(e){super(e,Pa.LinkedEditingRangeRequest.type)}fillClientCapabilities(e){let t=(0,Ta.ensure)((0,Ta.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,s,o)=>{let a=this._client,u=(p,h,f)=>a.sendRequest(Pa.LinkedEditingRangeRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(p,h),f).then(m=>f.isCancellationRequested?null:a.protocol2CodeConverter.asLinkedEditingRanges(m,f),m=>a.handleFailedRequest(Pa.LinkedEditingRangeRequest.type,f,m,null)),l=a.middleware;return l.provideLinkedEditingRange?l.provideLinkedEditingRange(i,s,o,u):u(i,s,o)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return zg.languages.registerLinkedEditingRangeProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};yt.LinkedEditingFeature=Ra});var cl=M(Tr=>{"use strict";Object.defineProperty(Tr,"__esModule",{value:!0});Tr.TypeHierarchyFeature=void 0;var Vg=I("vscode"),pn=N(),Oa=B(),Fa=class{client;middleware;constructor(e){this.client=e,this.middleware=e.middleware}prepareTypeHierarchy(e,t,n){let i=this.client,s=this.middleware,o=(a,u,l)=>{let p=i.code2ProtocolConverter.asTextDocumentPositionParams(a,u);return i.sendRequest(pn.TypeHierarchyPrepareRequest.type,p,l).then(h=>l.isCancellationRequested?null:i.protocol2CodeConverter.asTypeHierarchyItems(h,l),h=>i.handleFailedRequest(pn.TypeHierarchyPrepareRequest.type,l,h,null))};return s.prepareTypeHierarchy?s.prepareTypeHierarchy(e,t,n,o):o(e,t,n)}provideTypeHierarchySupertypes(e,t){let n=this.client,i=this.middleware,s=(o,a)=>{let u={item:n.code2ProtocolConverter.asTypeHierarchyItem(o)};return n.sendRequest(pn.TypeHierarchySupertypesRequest.type,u,a).then(l=>a.isCancellationRequested?null:n.protocol2CodeConverter.asTypeHierarchyItems(l,a),l=>n.handleFailedRequest(pn.TypeHierarchySupertypesRequest.type,a,l,null))};return i.provideTypeHierarchySupertypes?i.provideTypeHierarchySupertypes(e,t,s):s(e,t)}provideTypeHierarchySubtypes(e,t){let n=this.client,i=this.middleware,s=(o,a)=>{let u={item:n.code2ProtocolConverter.asTypeHierarchyItem(o)};return n.sendRequest(pn.TypeHierarchySubtypesRequest.type,u,a).then(l=>a.isCancellationRequested?null:n.protocol2CodeConverter.asTypeHierarchyItems(l,a),l=>n.handleFailedRequest(pn.TypeHierarchySubtypesRequest.type,a,l,null))};return i.provideTypeHierarchySubtypes?i.provideTypeHierarchySubtypes(e,t,s):s(e,t)}},xa=class extends Oa.TextDocumentLanguageFeature{constructor(e){super(e,pn.TypeHierarchyPrepareRequest.type)}fillClientCapabilities(e){let t=(0,Oa.ensure)((0,Oa.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 Fa(t);return[Vg.languages.registerTypeHierarchyProvider(t.protocol2CodeConverter.asDocumentSelector(e.documentSelector),n),n]}};Tr.TypeHierarchyFeature=xa});var ll=M(Or=>{"use strict";Object.defineProperty(Or,"__esModule",{value:!0});Or.InlineValueFeature=void 0;var ul=I("vscode"),Rr=N(),yi=B(),Ma=class extends yi.TextDocumentLanguageFeature{constructor(e){super(e,Rr.InlineValueRequest.type)}fillClientCapabilities(e){(0,yi.ensure)((0,yi.ensure)(e,"textDocument"),"inlineValue").dynamicRegistration=!0,(0,yi.ensure)((0,yi.ensure)(e,"workspace"),"inlineValue").refreshSupport=!0}initialize(e,t){this._client.onRequest(Rr.InlineValueRefreshRequest.type,async()=>{for(let s of this.getAllProviders())s.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 ul.EventEmitter,i={onDidChangeInlineValues:n.event,provideInlineValues:(s,o,a,u)=>{let l=this._client,p=(f,m,g,v)=>{let _={textDocument:l.code2ProtocolConverter.asTextDocumentIdentifier(f),range:l.code2ProtocolConverter.asRange(m),context:l.code2ProtocolConverter.asInlineValueContext(g)};return l.sendRequest(Rr.InlineValueRequest.type,_,v).then(T=>v.isCancellationRequested?null:l.protocol2CodeConverter.asInlineValues(T,v),T=>l.handleFailedRequest(Rr.InlineValueRequest.type,v,T,null))},h=l.middleware;return h.provideInlineValues?h.provideInlineValues(s,o,a,u,p):p(s,o,a,u)}};return[this.registerProvider(t,i),{provider:i,onDidChangeInlineValues:n}]}registerProvider(e,t){return ul.languages.registerInlineValuesProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Or.InlineValueFeature=Ma});var fl=M(Fr=>{"use strict";Object.defineProperty(Fr,"__esModule",{value:!0});Fr.InlayHintsFeature=void 0;var dl=I("vscode"),En=N(),_i=B(),ka=class extends _i.TextDocumentLanguageFeature{constructor(e){super(e,En.InlayHintRequest.type)}fillClientCapabilities(e){let t=(0,_i.ensure)((0,_i.ensure)(e,"textDocument"),"inlayHint");t.dynamicRegistration=!0,t.resolveSupport={properties:["tooltip","textEdits","label.tooltip","label.location","label.command"]},(0,_i.ensure)((0,_i.ensure)(e,"workspace"),"inlayHint").refreshSupport=!0}initialize(e,t){this._client.onRequest(En.InlayHintRefreshRequest.type,async()=>{for(let s of this.getAllProviders())s.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 dl.EventEmitter,i={onDidChangeInlayHints:n.event,provideInlayHints:(s,o,a)=>{let u=this._client,l=async(h,f,m)=>{let g={textDocument:u.code2ProtocolConverter.asTextDocumentIdentifier(h),range:u.code2ProtocolConverter.asRange(f)};try{let v=await u.sendRequest(En.InlayHintRequest.type,g,m);return m.isCancellationRequested?null:u.protocol2CodeConverter.asInlayHints(v,m)}catch(v){return u.handleFailedRequest(En.InlayHintRequest.type,m,v,null)}},p=u.middleware;return p.provideInlayHints?p.provideInlayHints(s,o,a,l):l(s,o,a)}};return i.resolveInlayHint=e.resolveProvider===!0?(s,o)=>{let a=this._client,u=async(p,h)=>{try{let f=await a.sendRequest(En.InlayHintResolveRequest.type,a.code2ProtocolConverter.asInlayHint(p),h);if(h.isCancellationRequested)return null;let m=a.protocol2CodeConverter.asInlayHint(f,h);return h.isCancellationRequested?null:m}catch(f){return a.handleFailedRequest(En.InlayHintResolveRequest.type,h,f,null)}},l=a.middleware;return l.resolveInlayHint?l.resolveInlayHint(s,o,u):u(s,o)}:void 0,[this.registerProvider(t,i),{provider:i,onDidChangeInlayHints:n}]}registerProvider(e,t){return dl.languages.registerInlayHintsProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Fr.InlayHintsFeature=ka});var hl=M(Xe=>{"use strict";var Gg=Xe&&Xe.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Jg=Xe&&Xe.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Yg=Xe&&Xe.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Gg(t,e,n[i]);return Jg(t,e),t}})();Object.defineProperty(Xe,"__esModule",{value:!0});Xe.WorkspaceFoldersFeature=void 0;Xe.arrayDiff=qa;var Qg=Yg(ne()),xr=I("vscode"),wi=N();function Ea(r,e){if(r!=null)return r[e]}function qa(r,e){return r.filter(t=>e.indexOf(t)<0)}var Ia=class{_client;_listeners;_initialFolders;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 wi.DidChangeWorkspaceFoldersNotification.type}fillInitializeParams(e){let t=xr.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(wi.WorkspaceFoldersRequest.type,s=>{let o=()=>{let u=xr.workspace.workspaceFolders;return u===void 0?null:u.map(p=>this.asProtocol(p))},a=t.middleware.workspace;return a&&a.workspaceFolders?a.workspaceFolders(s,o):o(s)});let n=Ea(Ea(Ea(e,"workspace"),"workspaceFolders"),"changeNotifications"),i;typeof n=="string"?i=n:n===!0&&(i=Qg.generateUuid()),i&&this.register({id:i,registerOptions:void 0})}sendInitialEvent(e){let t;if(this._initialFolders&&e){let n=qa(this._initialFolders,e),i=qa(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 ${wi.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(wi.DidChangeWorkspaceFoldersNotification.type,n)}register(e){let t=e.id,n=this._client,i=xr.workspace.onDidChangeWorkspaceFolders(s=>{let o=l=>this.doSendEvent(l.added,l.removed),a=n.middleware.workspace;(a&&a.didChangeWorkspaceFolders?a.didChangeWorkspaceFolders(s,o):o(s)).catch(l=>{this._client.error(`Sending notification ${wi.DidChangeWorkspaceFoldersNotification.type.method} failed`,l)})});this._listeners.set(t,i),this.sendInitialEvent(xr.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}}};Xe.WorkspaceFoldersFeature=Ia});var ml=M(ye=>{"use strict";var Zg=ye&&ye.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Xg=ye&&ye.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Er=ye&&ye.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Zg(t,e,n[i]);return Xg(t,e),t}})();Object.defineProperty(ye,"__esModule",{value:!0});ye.WillDeleteFilesFeature=ye.WillRenameFilesFeature=ye.WillCreateFilesFeature=ye.DidDeleteFilesFeature=ye.DidRenameFilesFeature=ye.DidCreateFilesFeature=void 0;var ze=Er(I("vscode")),em=Er(ao()),Lt=Er(N()),tm=Er(ne());function pl(r,e){return r[e]===void 0&&(r[e]={}),r[e]}function nm(r,e){return r[e]}function gl(r,e,t){r[e]=t}var Ci=class r{_client;_event;_registrationType;_clientCapability;_serverCapability;_listener;_filters;constructor(e,t,n,i,s){this._client=e,this._event=t,this._registrationType=n,this._clientCapability=i,this._serverCapability=s,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=pl(pl(e,"workspace"),"fileOperations");gl(t,"dynamicRegistration",!0),gl(t,this._clientCapability,!0)}initialize(e){let t=e.workspace?.fileOperations,n=t!==void 0?nm(t,this._serverCapability):void 0;if(n?.filters!==void 0)try{this.register({id:tm.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 em.Minimatch(n.pattern.glob,r.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 r.getFileType(e)}async filter(e,t){let n=await Promise.all(e.files.map(async s=>{let o=t(s),a=o.fsPath.replace(/\\/g,"/");for(let u of this._filters.values())for(let l of u)if(!(l.scheme!==void 0&&l.scheme!==o.scheme)){if(l.matcher.match(a)){if(l.kind===void 0)return!0;let p=await this.getFileType(o);if(p===void 0)return this._client.info(`Unable to determine file type for ${o.toString()}. Treating as a match.`),!0;if(p===ze.FileType.File&&l.kind===Lt.FileOperationPatternKind.file||p===ze.FileType.Directory&&l.kind===Lt.FileOperationPatternKind.folder)return!0}else if(l.kind===Lt.FileOperationPatternKind.folder&&await r.getFileType(o)===ze.FileType.Directory&&l.matcher.match(`${a}/`))return!0}return!1})),i=e.files.filter((s,o)=>n[o]);return{...e,files:i}}static async getFileType(e){try{return(await ze.workspace.fs.stat(e)).type}catch{return}}static asMinimatchOptions(e){let t={dot:!0};return e?.ignoreCase===!0&&(t.nocase=!0),t}},Mr=class extends Ci{_notificationType;_accessUri;_createParams;constructor(e,t,n,i,s,o,a){super(e,t,n,i,s),this._notificationType=n,this._accessUri=o,this._createParams=a}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)}}},kr=class extends Mr{_willListener;_fsPathFileTypes=new Map;async getFileType(e){let t=e.fsPath;if(this._fsPathFileTypes.has(t))return this._fsPathFileTypes.get(t);let n=await Ci.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)}},Aa=class extends Mr{constructor(e){super(e,ze.workspace.onDidCreateFiles,Lt.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)}};ye.DidCreateFilesFeature=Aa;var ja=class extends kr{constructor(e){super(e,ze.workspace.onDidRenameFiles,Lt.DidRenameFilesNotification.type,"didRename","didRename",t=>t.oldUri,e.code2ProtocolConverter.asDidRenameFilesParams)}register(e){this._willListener||(this._willListener=ze.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)}};ye.DidRenameFilesFeature=ja;var La=class extends kr{constructor(e){super(e,ze.workspace.onDidDeleteFiles,Lt.DidDeleteFilesNotification.type,"didDelete","didDelete",t=>t,e.code2ProtocolConverter.asDidDeleteFilesParams)}register(e){this._willListener||(this._willListener=ze.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)}};ye.DidDeleteFilesFeature=La;var bi=class extends Ci{_requestType;_accessUri;_createParams;constructor(e,t,n,i,s,o,a){super(e,t,n,i,s),this._requestType=n,this._accessUri=o,this._createParams=a}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}},Na=class extends bi{constructor(e){super(e,ze.workspace.onWillCreateFiles,Lt.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)}};ye.WillCreateFilesFeature=Na;var Ua=class extends bi{constructor(e){super(e,ze.workspace.onWillRenameFiles,Lt.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)}};ye.WillRenameFilesFeature=Ua;var Ka=class extends bi{constructor(e){super(e,ze.workspace.onWillDeleteFiles,Lt.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)}};ye.WillDeleteFilesFeature=Ka});var vl=M(_t=>{"use strict";var im=_t&&_t.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),rm=_t&&_t.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),sm=_t&&_t.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&im(t,e,n[i]);return rm(t,e),t}})();Object.defineProperty(_t,"__esModule",{value:!0});_t.InlineCompletionItemFeature=void 0;var om=I("vscode"),Ha=N(),Wa=B(),am=sm(ne()),$a=class extends Wa.TextDocumentLanguageFeature{constructor(e){super(e,Ha.InlineCompletionRequest.type)}fillClientCapabilities(e){let t=(0,Wa.ensure)((0,Wa.ensure)(e,"textDocument"),"inlineCompletion");t.dynamicRegistration=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.inlineCompletionProvider);n&&this.register({id:am.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideInlineCompletionItems:(i,s,o,a)=>{let u=this._client,l=this._client.middleware,p=(h,f,m,g)=>u.sendRequest(Ha.InlineCompletionRequest.type,u.code2ProtocolConverter.asInlineCompletionParams(h,f,m),g).then(v=>g.isCancellationRequested?null:u.protocol2CodeConverter.asInlineCompletionResult(v,g),v=>u.handleFailedRequest(Ha.InlineCompletionRequest.type,g,v,null));return l.provideInlineCompletionItems?l.provideInlineCompletionItems(i,s,o,a,p):p(i,s,o,a)}};return[om.languages.registerInlineCompletionItemProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};_t.InlineCompletionItemFeature=$a});var wl=M(wt=>{"use strict";var cm=wt&&wt.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),um=wt&&wt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),_l=wt&&wt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&cm(t,e,n[i]);return um(t,e),t}})();Object.defineProperty(wt,"__esModule",{value:!0});wt.TextDocumentContentFeature=void 0;var Ba=_l(I("vscode")),qn=N(),yl=B(),lm=_l(ne()),za=class{_client;_registrations=new Map;constructor(e){this._client=e}getState(){let e=this._registrations.size>0;return{kind:"workspace",id:qn.TextDocumentContentRequest.method,registrations:e}}get registrationType(){return qn.TextDocumentContentRequest.type}getProviders(){let e=[];for(let t of this._registrations.values())e.push(...t.providers);return e}fillClientCapabilities(e){let t=(0,yl.ensure)((0,yl.ensure)(e,"workspace"),"textDocumentContent");t.dynamicRegistration=!0}initialize(e){let t=this._client;if(t.onRequest(qn.TextDocumentContentRefreshRequest.type,async s=>{let o=t.protocol2CodeConverter.asUri(s.uri);for(let a of this._registrations.values())for(let u of a.providers)u.scheme===o.scheme&&u.onDidChangeEmitter.fire(o)}),!e?.workspace?.textDocumentContent)return;let n=e.workspace.textDocumentContent,i=qn.StaticRegistrationOptions.hasId(n)?n.id:lm.generateUuid();this.register({id:i,registerOptions:n})}register(e){let t=[],n=[];for(let i of e.registerOptions.schemes){let[s,o]=this.registerTextDocumentContentProvider(i);t.push(o),n.push(s)}this._registrations.set(e.id,{disposable:Ba.Disposable.from(...n),providers:t})}registerTextDocumentContentProvider(e){let t=new Ba.EventEmitter,n={onDidChange:t.event,provideTextDocumentContent:(i,s)=>{let o=this._client,a=(l,p)=>{let h={uri:o.code2ProtocolConverter.asUri(l)};return o.sendRequest(qn.TextDocumentContentRequest.type,h,p).then(f=>p.isCancellationRequested?null:f.text,f=>o.handleFailedRequest(qn.TextDocumentContentRequest.type,p,f,null))},u=o.middleware;return u.provideTextDocumentContent?u.provideTextDocumentContent(i,s,a):a(i,s)}};return[Ba.workspace.registerTextDocumentContentProvider(e,n),{scheme:e,onDidChangeEmitter:t,provider:n}]}unregister(e){let t=this._registrations.get(e);t!==void 0&&(this._registrations.delete(e),t.disposable.dispose())}clear(){this._registrations.forEach(e=>{e.disposable.dispose()}),this._registrations.clear()}};wt.TextDocumentContentFeature=za});var Cl=M(Ir=>{"use strict";Object.defineProperty(Ir,"__esModule",{value:!0});Ir.FileSystemWatcherFeature=void 0;var dm=I("vscode"),gn=N(),qr=B(),Va=class{_client;_notifyFileEvent;_watchers;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 gn.DidChangeWatchedFilesNotification.type}fillClientCapabilities(e){(0,qr.ensure)((0,qr.ensure)(e,"workspace"),"didChangeWatchedFiles").dynamicRegistration=!0,(0,qr.ensure)((0,qr.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 s=!0,o=!0,a=!0;n.kind!==void 0&&n.kind!==null&&(s=(n.kind&gn.WatchKind.Create)!==0,o=(n.kind&gn.WatchKind.Change)!==0,a=(n.kind&gn.WatchKind.Delete)!==0);let u=dm.workspace.createFileSystemWatcher(i,!s,!o,!a);this.hookListeners(u,s,o,a,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,s){t&&e.onDidCreate(o=>this._notifyFileEvent({uri:this._client.code2ProtocolConverter.asUri(o),type:gn.FileChangeType.Created}),null,s),n&&e.onDidChange(o=>this._notifyFileEvent({uri:this._client.code2ProtocolConverter.asUri(o),type:gn.FileChangeType.Changed}),null,s),i&&e.onDidDelete(o=>this._notifyFileEvent({uri:this._client.code2ProtocolConverter.asUri(o),type:gn.FileChangeType.Deleted}),null,s)}unregister(e){let t=this._watchers.get(e);if(t){this._watchers.delete(e);for(let n of t)n.dispose()}}clear(){this._watchers.forEach(e=>{for(let t of e)t.dispose()}),this._watchers.clear()}};Ir.FileSystemWatcherFeature=Va});var Sl=M(Ar=>{"use strict";Object.defineProperty(Ar,"__esModule",{value:!0});Ar.ProgressFeature=void 0;var bl=N(),fm=Js();function hm(r,e){return r[e]===void 0&&(r[e]=Object.create(null)),r[e]}var Ga=class{_client;activeParts;constructor(e){this._client=e,this.activeParts=new Set}getState(){return{kind:"window",id:bl.WorkDoneProgressCreateRequest.method,registrations:this.activeParts.size>0}}fillClientCapabilities(e){hm(e,"window").workDoneProgress=!0}initialize(){let e=this._client,t=i=>{this.activeParts.delete(i)},n=i=>{this.activeParts.add(new fm.ProgressPart(this._client,i.token,t))};e.onRequest(bl.WorkDoneProgressCreateRequest.type,n)}clear(){for(let e of this.activeParts)e.done();this.activeParts.clear()}};Ar.ProgressFeature=Ga});var ic=M(Y=>{"use strict";var pm=Y&&Y.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),gm=Y&&Y.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Nr=Y&&Y.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&pm(t,e,n[i]);return gm(t,e),t}})();Object.defineProperty(Y,"__esModule",{value:!0});Y.ProposedFeatures=Y.LanguageClient=Y.BaseLanguageClient=Y.ShutdownMode=Y.MessageTransports=Y.SuspendMode=Y.State=Y.CloseAction=Y.ErrorAction=Y.RevealOutputChannelOn=void 0;var j=I("vscode"),S=N(),mm=Nr(Wc()),vm=Nr(zc()),et=Nr(He()),jr=Qi(),Dl=Nr(ne()),ym=Js(),Le=B(),_m=mo(),Ya=Tu(),Pl=Fu(),In=xu(),wm=Mu(),Cm=ku(),bm=Eu(),Sm=Iu(),Dm=Au(),Pm=Ho(),Tm=Lu(),Rm=Nu(),Om=Uu(),Fm=Ku(),xm=Hu(),Mm=Wu(),km=Bu(),Ja=zu(),Em=Ju(),qm=Yu(),Im=Zu(),Am=el(),jm=tl(),Lm=nl(),Nm=il(),Um=sl(),Km=al(),Hm=cl(),Wm=ll(),$m=fl(),Bm=hl(),An=ml(),zm=vl(),Vm=wl(),Gm=Cl(),Jm=Sl(),mn;(function(r){r[r.Debug=0]="Debug",r[r.Info=1]="Info",r[r.Warn=2]="Warn",r[r.Error=3]="Error",r[r.Never=4]="Never"})(mn||(Y.RevealOutputChannelOn=mn={}));var Si;(function(r){r[r.Continue=1]="Continue",r[r.Shutdown=2]="Shutdown"})(Si||(Y.ErrorAction=Si={}));var Xt;(function(r){r[r.DoNotRestart=1]="DoNotRestart",r[r.Restart=2]="Restart"})(Xt||(Y.CloseAction=Xt={}));var jn;(function(r){r[r.Stopped=1]="Stopped",r[r.Starting=3]="Starting",r[r.StartFailed=4]="StartFailed",r[r.Running=2]="Running"})(jn||(Y.State=jn={}));var Tl;(function(r){r.off="off",r.on="on"})(Tl||(Y.SuspendMode=Tl={}));var Qa;(function(r){function e(t){return t==null?!1:typeof t=="boolean"||typeof t=="object"&&t!==null&&et.stringArray(t.enabledCommands)?t:!1}r.sanitizeIsTrusted=e})(Qa||(Qa={}));var Za=class{client;maxRestartCount;restarts;constructor(e,t){this.client=e,this.maxRestartCount=t,this.restarts=[]}error(e,t,n){return n&&n<=3?{action:Si.Continue}:{action:Si.Shutdown}}closed(){return this.restarts.push(Date.now()),this.restarts.length<=this.maxRestartCount?{action:Xt.Restart}:this.restarts[this.restarts.length-1]-this.restarts[0]<=180*1e3?{action:Xt.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:Xt.Restart})}},K;(function(r){r.Initial="initial",r.Starting="starting",r.StartFailed="startFailed",r.Running="running",r.Stopping="stopping",r.Stopped="stopped"})(K||(K={}));var Rl;(function(r){function e(t){return t&&S.MessageReader.is(t.reader)&&S.MessageWriter.is(t.writer)}r.is=e})(Rl||(Y.MessageTransports=Rl={}));var Zt;(function(r){r.Restart="restart",r.Stop="stop"})(Zt||(Y.ShutdownMode=Zt={}));var Xa=class r{open;_onOpen;_onClose;disposables;constructor(){this.disposables=[],this.open=new Set,this._onOpen=new j.EventEmitter,this._onClose=new j.EventEmitter,r.fillVisibleResources(this.open);let e=()=>{let t=this.open,n=new Set;r.fillVisibleResources(n);let i=new Set,s=new Set(n);for(let o of t.values())n.has(o)?s.delete(o):i.add(o);if(this.open=n,i.size>0){let o=new Set;for(let a of i)o.add(j.Uri.parse(a));this._onClose.fire(o)}if(s.size>0){let o=new Set;for(let a of s)o.add(j.Uri.parse(a));this._onOpen.fire(o)}};this.disposables.push(j.window.tabGroups.onDidChangeTabs(t=>{t.closed.length===0&&t.opened.length===0||e()})),this.disposables.push(j.window.onDidChangeVisibleTextEditors(t=>{e()}))}get onClose(){return this._onClose.event}get onOpen(){return this._onOpen.event}dispose(){this.disposables.forEach(e=>e.dispose())}isActive(e){return e instanceof j.Uri?j.window.activeTextEditor?.document.uri===e:j.window.activeTextEditor?.document===e}isVisible(e){let t=e instanceof j.Uri?e:e.uri;return t.scheme===Ya.NotebookDocumentSyncFeature.CellScheme?j.workspace.notebookDocuments.some(n=>this.open.has(n.uri.toString())?n.getCells().find(s=>s.document.uri.toString()===t.toString())!==void 0:!1):this.open.has(t.toString())}getResources(){let e=new Set;return r.fillVisibleResources(new Set,e),e}static fillVisibleResources(e,t){let n=e??new Set;for(let i of j.window.tabGroups.all)for(let s of i.tabs){let o=s.input,a;o instanceof j.TabInputText?a=o.uri:o instanceof j.TabInputTextDiff?a=o.modified:(o instanceof j.TabInputCustom||o instanceof j.TabInputNotebook)&&(a=o.uri),a!==void 0&&!n.has(a.toString())&&(n.add(a.toString()),t!==void 0&&t.add(a))}for(let i of j.window.visibleTextEditors){let s=i.document.uri;n.has(s.toString())||(n.add(s.toString()),t!==void 0&&t.add(s))}}},Lr=class r{_id;_name;_clientOptions;_state;_onStart;_onStop;_connection;_idleInterval;_ignoredRegistrations;_listeners;_disposed;_notificationHandlers;_notificationDisposables;_pendingNotificationHandlers;_requestHandlers;_requestDisposables;_pendingRequestHandlers;_progressHandlers;_pendingProgressHandlers;_progressDisposables;_initializeResult;_outputChannel;_disposeOutputChannel;_traceOutputChannel;_traceLogLevel;_capabilities;_diagnostics;_syncedDocuments;_didChangeTextDocumentFeature;_inFlightOpenNotifications;_pendingChangeSemaphore;_pendingChangeDelayer;_didOpenTextDocumentFeature;_fileEvents;_fileEventDelayer;_telemetryEmitter;_stateChangeEmitter;_trace;_traceFormat=S.TraceFormat.Text;_tracer;_c2p;_p2c;_visibleDocuments;constructor(e,t,n){this._id=e,this._name=t,n=n||{};let i={isTrusted:!1,supportHtml:!1,supportThemeIcons:!1};n.markdown!==void 0&&(i.isTrusted=Qa.sanitizeIsTrusted(n.markdown.isTrusted),i.supportHtml=n.markdown.supportHtml===!0,i.supportThemeIcons=n.markdown.supportThemeIcons===!0),this._clientOptions={documentSelector:n.documentSelector??[],synchronize:n.synchronize??{},diagnosticCollectionName:n.diagnosticCollectionName,outputChannelName:n.outputChannelName??this._name,revealOutputChannelOn:n.revealOutputChannelOn??mn.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??{},textSynchronization:this.createTextSynchronizationOptions(n.textSynchronization)},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._traceLogLevel=this._outputChannel.logLevel):(this._outputChannel=void 0,this._disposeOutputChannel=!0,this._traceLogLevel=j.LogLevel.Info),this._traceOutputChannel=n.traceOutputChannel,this._traceOutputChannel!==void 0&&(this._traceLogLevel=this._traceOutputChannel.logLevel),this._diagnostics=void 0,this._inFlightOpenNotifications=new Set,this._pendingChangeSemaphore=new jr.Semaphore(1),this._pendingChangeDelayer=new jr.Delayer(250),this._fileEvents=[],this._fileEventDelayer=new jr.Delayer(250),this._onStop=void 0,this._telemetryEmitter=new S.Emitter,this._stateChangeEmitter=new S.Emitter,this._trace=S.Trace.Off,this._tracer={log:(s,o)=>{et.string(s)?this.trace(s,o):this.traceObject(s)}},this._c2p=mm.createConverter(n.uriConverters?n.uriConverters.code2Protocol:void 0),this._p2c=vm.createConverter(n.uriConverters?n.uriConverters.protocol2Code:void 0,this._clientOptions.markdown.isTrusted,this._clientOptions.markdown.supportHtml,this._clientOptions.markdown.supportThemeIcons),this._syncedDocuments=new Map,this.registerBuiltinFeatures()}createTextSynchronizationOptions(e){return e?typeof e.delayOpenNotifications=="boolean"?{delayOpenNotifications:e.delayOpenNotifications}:{delayOpenNotifications:!1}:{delayOpenNotifications:!1}}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 visibleDocuments(){return this._visibleDocuments===void 0&&(this._visibleDocuments=new Xa),this._visibleDocuments}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,{log:!0}),this._traceOutputChannel===void 0&&(this._traceLogLevel=this._outputChannel.logLevel)),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 jn.Starting;case K.Running:return jn.Running;case K.StartFailed:return jn.StartFailed;default:return jn.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 S.ResponseError(S.ErrorCodes.ConnectionInactive,"Client is not running"));let n=await this.$start();await this._didOpenTextDocumentFeature.sendPendingOpenNotifications(),this._didChangeTextDocumentFeature.syncKind===S.TextDocumentSyncKind.Full&&await this.sendPendingFullTextDocumentChanges(n);let i,s;if(t.length===1?S.CancellationToken.is(t[0])?s=t[0]:i=t[0]:t.length===2&&(i=t[0],s=t[1]),s!==void 0&&s.isCancellationRequested)return Promise.reject(new S.ResponseError(S.LSPErrorCodes.RequestCancelled,"Request got cancelled"));let o=this._clientOptions.middleware?.sendRequest;return o!==void 0?o(e,i,s,(a,u,l)=>{let p=[];return u!==void 0&&p.push(u),l!==void 0&&p.push(l),n.sendRequest(a,...p)}):n.sendRequest(e,...t)}onRequest(e,t){let n=typeof e=="string"?e:e.method;this._requestHandlers.set(n,t);let i=this.activeConnection(),s;return i!==void 0?(this._requestDisposables.set(n,i.onRequest(e,t)),s={dispose:()=>{let o=this._requestDisposables.get(n);o!==void 0&&(o.dispose(),this._requestDisposables.delete(n))}}):(this._pendingRequestHandlers.set(n,t),s={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),s.dispose()}}}async sendNotification(e,t){if(this.$state===K.StartFailed||this.$state===K.Stopping||this.$state===K.Stopped)return Promise.reject(new S.ResponseError(S.ErrorCodes.ConnectionInactive,"Client is not running"));let n=this._didChangeTextDocumentFeature.syncKind===S.TextDocumentSyncKind.Full,i;n&&typeof e!="string"&&e.method===S.DidOpenTextDocumentNotification.method&&(i=t?.textDocument.uri,this._inFlightOpenNotifications.add(i));let s;typeof e!="string"&&e.method===S.DidCloseTextDocumentNotification.method&&(s=t.textDocument.uri);let o=await this.$start();if(await this._didOpenTextDocumentFeature.sendPendingOpenNotifications(s))return;n&&await this.sendPendingFullTextDocumentChanges(o),i!==void 0&&this._inFlightOpenNotifications.delete(i);let u=this._clientOptions.middleware?.sendNotification;return u?u(e,o.sendNotification.bind(o),t):o.sendNotification(e,t)}onNotification(e,t){let n=typeof e=="string"?e:e.method;this._notificationHandlers.set(n,t);let i=this.activeConnection(),s;return i!==void 0?(this._notificationDisposables.set(n,i.onNotification(e,t)),s={dispose:()=>{let o=this._notificationDisposables.get(n);o!==void 0&&(o.dispose(),this._notificationDisposables.delete(n))}}):(this._pendingNotificationHandlers.set(n,t),s={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),s.dispose()}}}async sendProgress(e,t,n){if(this.$state===K.StartFailed||this.$state===K.Stopping||this.$state===K.Stopped)return Promise.reject(new S.ResponseError(S.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(),s,o=this._clientOptions.middleware?.handleWorkDoneProgress,a=S.WorkDoneProgress.is(e)&&o!==void 0?u=>{o(t,u,()=>n(u))}:n;return i!==void 0?(this._progressDisposables.set(t,i.onProgress(e,t,a)),s={dispose:()=>{let u=this._progressDisposables.get(t);u!==void 0&&(u.dispose(),this._progressDisposables.delete(t))}}):(this._pendingProgressHandlers.set(t,{type:e,handler:n}),s={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),s.dispose()}}}createDefaultErrorHandler(e){if(e!==void 0&&e<0)throw new Error(`Invalid maxRestartCount: ${e}`);return new Za(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 S.ResponseError){let t=e;return` Message: ${t.message}
|
|
7
|
+
`,n=e.whitespace?" = ":"=",i=[],s=e.sort?Object.keys(r).sort():Object.keys(r),o=0;e.align&&(o=Pt(s.filter(l=>r[l]===null||Array.isArray(r[l])||typeof r[l]!="object").map(l=>Array.isArray(r[l])?`${l}[]`:l).concat([""]).reduce((l,p)=>Pt(l).length>=Pt(p).length?l:p)).length);let a="",u=e.bracketedArray?"[]":"";for(let l of s){let p=r[l];if(p&&Array.isArray(p))for(let h of p)a+=Pt(`${l}${u}`).padEnd(o," ")+n+Pt(h)+t;else p&&typeof p=="object"?i.push(l):a+=Pt(l).padEnd(o," ")+n+Pt(p)+t}e.section&&a.length&&(a="["+Pt(e.section)+"]"+(e.newline?t+t:t)+a);for(let l of i){let p=Fc(l,".").join("\\."),h=(e.section?e.section+".":"")+p,f=ws(r[l],{...e,section:h});a.length&&f.length&&(a+=t),a+=f}return a};function Fc(r,e){var t=0,n=0,i=0,s=[];do if(i=r.indexOf(e,t),i!==-1){if(t=i+e.length,i>0&&r[i-1]==="\\")continue;s.push(r.slice(n,i)),n=i+e.length}while(i!==-1);return s.push(r.slice(n)),s}var Oc=(r,e={})=>{e.bracketedArray=e.bracketedArray!==!1;let t=Object.create(null),n=t,i=null,s=/^\[([^\]]*)\]\s*$|^([^=]+)(=(.*))?$/i,o=r.split(/[\r\n]+/g),a={};for(let l of o){if(!l||l.match(/^\s*[;#]/)||l.match(/^\s*$/))continue;let p=l.match(s);if(!p)continue;if(p[1]!==void 0){if(i=Vi(p[1]),i==="__proto__"){n=Object.create(null);continue}n=t[i]=t[i]||Object.create(null);continue}let h=Vi(p[2]),f;e.bracketedArray?f=h.length>2&&h.slice(-2)==="[]":(a[h]=(a?.[h]||0)+1,f=a[h]>1);let m=f&&h.endsWith("[]")?h.slice(0,-2):h;if(m==="__proto__")continue;let g=p[3]?Vi(p[4]):!0,v=g==="true"||g==="false"||g==="null"?JSON.parse(g):g;f&&(_s.call(n,m)?Array.isArray(n[m])||(n[m]=[n[m]]):n[m]=[]),Array.isArray(n[m])?n[m].push(v):n[m]=v}let u=[];for(let l of Object.keys(t)){if(!_s.call(t,l)||typeof t[l]!="object"||Array.isArray(t[l]))continue;let p=Fc(l,".");n=t;let h=p.pop(),f=h.replace(/\\\./g,".");for(let m of p)m!=="__proto__"&&((!_s.call(n,m)||typeof n[m]!="object")&&(n[m]=Object.create(null)),n=n[m]);n===t&&f===h||(n[f]=t[l],u.push(l))}for(let l of u)delete t[l];return t},xc=r=>r.startsWith('"')&&r.endsWith('"')||r.startsWith("'")&&r.endsWith("'"),Pt=r=>typeof r!="string"||r.match(/[=\r\n]/)||r.match(/^\[/)||r.length>1&&xc(r)||r!==r.trim()?JSON.stringify(r):r.split(";").join("\\;").split("#").join("\\#"),Vi=r=>{if(r=(r||"").trim(),xc(r)){r.charAt(0)==="'"&&(r=r.slice(1,-1));try{r=JSON.parse(r)}catch{}}else{let e=!1,t="";for(let n=0,i=r.length;n<i;n++){let s=r.charAt(n);if(e)"\\;#".indexOf(s)!==-1?t+=s:t+="\\"+s,e=!1;else{if(";#".indexOf(s)!==-1)break;s==="\\"?e=!0:t+=s}}return e&&(t+="\\"),t.trim()}return r};Mc.exports={parse:Oc,decode:Oc,stringify:ws,encode:ws,safe:Pt,unsafe:Vi}});var He=M(Ke=>{"use strict";Object.defineProperty(Ke,"__esModule",{value:!0});Ke.boolean=gd;Ke.string=qc;Ke.number=md;Ke.error=vd;Ke.func=Ic;Ke.array=Ac;Ke.stringArray=yd;Ke.typedArray=_d;Ke.thenable=jc;Ke.asPromise=wd;function gd(r){return r===!0||r===!1}function qc(r){return typeof r=="string"||r instanceof String}function md(r){return typeof r=="number"||r instanceof Number}function vd(r){return r instanceof Error}function Ic(r){return typeof r=="function"}function Ac(r){return Array.isArray(r)}function yd(r){return Ac(r)&&r.every(e=>qc(e))}function _d(r,e){return Array.isArray(r)&&r.every(e)}function jc(r){return r&&Ic(r.then)}function wd(r){return r instanceof Promise?r:jc(r)?new Promise((e,t)=>{r.then(n=>e(n),n=>t(n))}):Promise.resolve(r)}});var Qi=M(Je=>{"use strict";Object.defineProperty(Je,"__esModule",{value:!0});Je.Semaphore=Je.Delayer=void 0;Je.setTestMode=Cd;Je.clearTestMode=bd;Je.map=Sd;Je.mapAsync=Dd;Je.forEach=Pd;var ni=N(),Ps=class{defaultDelay;timeout;completionPromise;onSuccess;task;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;let n=this.task();return this.task=void 0,n})),(t>=0||this.timeout===void 0)&&(this.timeout=(0,ni.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)}};Je.Delayer=Ps;var Ts=class{_capacity;_active;_waiting;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,ni.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()}}};Je.Semaphore=Ts;var Rs=!1;function Cd(){Rs=!0}function bd(){Rs=!1}var Lc=15,ti=class{yieldAfter;startTime;counter;total;counterInterval;constructor(e=Lc){this.yieldAfter=Rs===!0?Math.max(e,2):Math.max(e,Lc),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 Sd(r,e,t,n){if(r.length===0)return[];let i=new Array(r.length),s=new ti(n?.yieldAfter);function o(u){s.start();for(let l=u;l<r.length;l++)if(i[l]=e(r[l]),s.shouldYield())return n?.yieldCallback&&n.yieldCallback(),l+1;return-1}let a=o(0);for(;a!==-1&&!(t!==void 0&&t.isCancellationRequested);)a=await new Promise(u=>{(0,ni.RAL)().timer.setImmediate(()=>{t!==void 0&&t.isCancellationRequested?u(-1):u(o(a))})});return i}async function Dd(r,e,t,n){if(r.length===0)return[];let i=new Array(r.length),s=new ti(n?.yieldAfter);async function o(u){s.start();for(let l=u;l<r.length;l++)if(i[l]=await e(r[l],t),s.shouldYield())return n?.yieldCallback&&n.yieldCallback(),l+1;return-1}let a=await o(0);for(;a!==-1&&!(t!==void 0&&t.isCancellationRequested);)a=await new Promise(u=>{(0,ni.RAL)().timer.setImmediate(()=>{t!==void 0&&t.isCancellationRequested?u(-1):u(o(a))})});return i}async function Pd(r,e,t,n){if(r.length===0)return;let i=new ti(n?.yieldAfter);function s(a){i.start();for(let u=a;u<r.length;u++)if(e(r[u]),i.shouldYield())return n?.yieldCallback&&n.yieldCallback(),u+1;return-1}let o=s(0);for(;o!==-1&&!(t!==void 0&&t.isCancellationRequested);)o=await new Promise(a=>{(0,ni.RAL)().timer.setImmediate(()=>{t!==void 0&&t.isCancellationRequested?a(-1):a(s(o))})})}});var Fs=M(Tt=>{"use strict";var Td=Tt&&Tt.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Rd=Tt&&Tt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Od=Tt&&Tt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Td(t,e,n[i]);return Rd(t,e),t}})();Object.defineProperty(Tt,"__esModule",{value:!0});var Fd=Od(I("vscode")),Os=class extends Fd.CompletionItem{data;fromEdit;documentationFormat;originalItemKind;deprecated;insertTextMode;constructor(e){super(e)}};Tt.default=Os});var Ms=M(Rt=>{"use strict";var xd=Rt&&Rt.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Md=Rt&&Rt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),kd=Rt&&Rt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&xd(t,e,n[i]);return Md(t,e),t}})();Object.defineProperty(Rt,"__esModule",{value:!0});var Ed=kd(I("vscode")),xs=class extends Ed.CodeLens{data;constructor(e){super(e)}};Rt.default=xs});var Es=M(Ot=>{"use strict";var qd=Ot&&Ot.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Id=Ot&&Ot.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Ad=Ot&&Ot.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&qd(t,e,n[i]);return Id(t,e),t}})();Object.defineProperty(Ot,"__esModule",{value:!0});var jd=Ad(I("vscode")),ks=class extends jd.DocumentLink{data;constructor(e,t){super(e,t)}};Ot.default=ks});var Is=M(Ft=>{"use strict";var Ld=Ft&&Ft.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Nd=Ft&&Ft.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Ud=Ft&&Ft.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Ld(t,e,n[i]);return Nd(t,e),t}})();Object.defineProperty(Ft,"__esModule",{value:!0});var Kd=Ud(I("vscode")),qs=class extends Kd.CodeAction{data;constructor(e,t){super(e),this.data=t}};Ft.default=qs});var Ls=M(We=>{"use strict";var Hd=We&&We.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Wd=We&&We.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Uc=We&&We.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Hd(t,e,n[i]);return Wd(t,e),t}})();Object.defineProperty(We,"__esModule",{value:!0});We.ProtocolDiagnostic=We.DiagnosticCode=void 0;var $d=Uc(I("vscode")),As=Uc(He()),Nc;(function(r){function e(t){let n=t;return n!=null&&(As.number(n.value)||As.string(n.value))&&As.string(n.target)}r.is=e})(Nc||(We.DiagnosticCode=Nc={}));var js=class extends $d.Diagnostic{data;hasDiagnosticCode;constructor(e,t,n,i){super(e,t,n),this.data=i,this.hasDiagnosticCode=!1}};We.ProtocolDiagnostic=js});var Us=M(xt=>{"use strict";var Bd=xt&&xt.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),zd=xt&&xt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Vd=xt&&xt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Bd(t,e,n[i]);return zd(t,e),t}})();Object.defineProperty(xt,"__esModule",{value:!0});var Gd=Vd(I("vscode")),Ns=class extends Gd.CallHierarchyItem{data;constructor(e,t,n,i,s,o,a){super(e,t,n,i,s,o),a!==void 0&&(this.data=a)}};xt.default=Ns});var Hs=M(Mt=>{"use strict";var Jd=Mt&&Mt.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Yd=Mt&&Mt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Qd=Mt&&Mt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Jd(t,e,n[i]);return Yd(t,e),t}})();Object.defineProperty(Mt,"__esModule",{value:!0});var Zd=Qd(I("vscode")),Ks=class extends Zd.TypeHierarchyItem{data;constructor(e,t,n,i,s,o,a){super(e,t,n,i,s,o),a!==void 0&&(this.data=a)}};Mt.default=Ks});var $s=M(kt=>{"use strict";var Xd=kt&&kt.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),ef=kt&&kt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),tf=kt&&kt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Xd(t,e,n[i]);return ef(t,e),t}})();Object.defineProperty(kt,"__esModule",{value:!0});var Zi=tf(I("vscode")),Ws=class extends Zi.SymbolInformation{data;hasRange;constructor(e,t,n,i,s){let o=!(i instanceof Zi.Uri);super(e,t,n,o?i:new Zi.Location(i,new Zi.Range(0,0,0,0))),this.hasRange=o,s!==void 0&&(this.data=s)}};kt.default=Ws});var zs=M(Et=>{"use strict";var nf=Et&&Et.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),rf=Et&&Et.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),sf=Et&&Et.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&nf(t,e,n[i]);return rf(t,e),t}})();Object.defineProperty(Et,"__esModule",{value:!0});var of=sf(I("vscode")),Bs=class extends of.InlayHint{data;constructor(e,t,n){super(e,t,n)}};Et.default=Bs});var $c=M(Ye=>{"use strict";var af=Ye&&Ye.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),cf=Ye&&Ye.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Xi=Ye&&Ye.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&af(t,e,n[i]);return cf(t,e),t}})(),Vt=Ye&&Ye.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ye,"__esModule",{value:!0});Ye.createConverter=mf;var de=Xi(I("vscode")),L=Xi(N()),an=Xi(He()),Kc=Xi(Qi()),uf=Vt(Fs()),lf=Vt(Ms()),df=Vt(Es()),Hc=Vt(Is()),Wc=Ls(),ff=Vt(Us()),hf=Vt(Hs()),pf=Vt($s()),gf=Vt(zs()),Vs;(function(r){function e(t){let n=t;return n&&!!n.inserting&&!!n.replacing}r.is=e})(Vs||(Vs={}));function mf(r){let t=r||(d=>d.toString());function n(d){return t(d)}function i(d){return{uri:t(d.uri)}}function s(d){return{uri:t(d.uri),languageId:d.languageId,version:d.version,text:d.getText()}}function o(d){return{uri:t(d.uri),version:d.version}}function a(d){return{textDocument:s(d)}}function u(d){let w=d;return!!w.document&&!!w.contentChanges}function l(d){let w=d;return!!w.uri&&!!w.version}function p(d,w,x){if(l(d))return{textDocument:{uri:t(d.uri),version:d.version},contentChanges:[{text:d.getText()}]};if(u(d)){let Z=w,V=x;return{textDocument:{uri:t(Z),version:V},contentChanges:d.contentChanges.map(ke=>{let St=ke.range;return{range:{start:{line:St.start.line,character:St.start.character},end:{line:St.end.line,character:St.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 x={textDocument:i(d)};return w&&(x.text=d.getText()),x}function m(d){switch(d){case de.TextDocumentSaveReason.Manual:return L.TextDocumentSaveReason.Manual;case de.TextDocumentSaveReason.AfterDelay:return L.TextDocumentSaveReason.AfterDelay;case de.TextDocumentSaveReason.FocusOut:return L.TextDocumentSaveReason.FocusOut}return L.TextDocumentSaveReason.Manual}function g(d){return{textDocument:i(d.document),reason:m(d.reason)}}function v(d){return{files:d.files.map(w=>({uri:t(w)}))}}function _(d){return{files:d.files.map(w=>({oldUri:t(w.oldUri),newUri:t(w.newUri)}))}}function T(d){return{files:d.files.map(w=>({uri:t(w)}))}}function C(d){return{files:d.files.map(w=>({uri:t(w)}))}}function D(d){return{files:d.files.map(w=>({oldUri:t(w.oldUri),newUri:t(w.newUri)}))}}function F(d){return{files:d.files.map(w=>({uri:t(w)}))}}function E(d,w){return{textDocument:i(d),position:rn(w)}}function Q(d){switch(d){case de.CompletionTriggerKind.TriggerCharacter:return L.CompletionTriggerKind.TriggerCharacter;case de.CompletionTriggerKind.TriggerForIncompleteCompletions:return L.CompletionTriggerKind.TriggerForIncompleteCompletions;default:return L.CompletionTriggerKind.Invoked}}function we(d,w,x){return{textDocument:i(d),position:rn(w),context:{triggerKind:Q(x.triggerKind),triggerCharacter:x.triggerCharacter}}}function xe(d){switch(d){case de.SignatureHelpTriggerKind.Invoke:return L.SignatureHelpTriggerKind.Invoked;case de.SignatureHelpTriggerKind.TriggerCharacter:return L.SignatureHelpTriggerKind.TriggerCharacter;case de.SignatureHelpTriggerKind.ContentChange:return L.SignatureHelpTriggerKind.ContentChange}}function Un(d){return{label:d.label}}function Br(d){return d.map(Un)}function Kn(d){return{label:d.label,parameters:Br(d.parameters)}}function zr(d){return d.map(Kn)}function Vr(d){return d===void 0?d:{signatures:zr(d.signatures),activeSignature:d.activeSignature,activeParameter:d.activeParameter}}function Gr(d,w,x){return{textDocument:i(d),position:rn(w),context:{isRetrigger:x.isRetrigger,triggerCharacter:x.triggerCharacter,triggerKind:xe(x.triggerKind),activeSignatureHelp:Vr(x.activeSignatureHelp)}}}function rn(d){return{line:d.line,character:d.character}}function Ct(d){return d==null?d:{line:d.line>L.uinteger.MAX_VALUE?L.uinteger.MAX_VALUE:d.line,character:d.character>L.uinteger.MAX_VALUE?L.uinteger.MAX_VALUE:d.character}}function yn(d,w){return Kc.map(d,Ct,w)}function Ri(d){return d.map(Ct)}function he(d){return d==null?d:{start:Ct(d.start),end:Ct(d.end)}}function Jr(d){return d.map(he)}function Kt(d){return d==null?d:L.Location.create(n(d.uri),he(d.range))}function Hn(d){switch(d){case de.DiagnosticSeverity.Error:return L.DiagnosticSeverity.Error;case de.DiagnosticSeverity.Warning:return L.DiagnosticSeverity.Warning;case de.DiagnosticSeverity.Information:return L.DiagnosticSeverity.Information;case de.DiagnosticSeverity.Hint:return L.DiagnosticSeverity.Hint}}function Oi(d){if(!d)return;let w=[];for(let x of d){let Z=Wn(x);Z!==void 0&&w.push(Z)}return w.length>0?w:void 0}function Wn(d){switch(d){case de.DiagnosticTag.Unnecessary:return L.DiagnosticTag.Unnecessary;case de.DiagnosticTag.Deprecated:return L.DiagnosticTag.Deprecated;default:return}}function Ht(d){return{message:d.message,location:Kt(d.location)}}function Yr(d){return d.map(Ht)}function Qr(d){if(d!=null)return an.number(d)||an.string(d)?d:{value:d.value,target:n(d.target)}}function _n(d){let w=L.Diagnostic.create(he(d.range),d.message),x=d instanceof Wc.ProtocolDiagnostic?d:void 0;x!==void 0&&x.data!==void 0&&(w.data=x.data);let Z=Qr(d.code);return Wc.DiagnosticCode.is(Z)?x!==void 0&&x.hasDiagnosticCode?w.code=Z:(w.code=Z.value,w.codeDescription={href:Z.target}):w.code=Z,an.number(d.severity)&&(w.severity=Hn(d.severity)),Array.isArray(d.tags)&&(w.tags=Oi(d.tags)),d.relatedInformation&&(w.relatedInformation=Yr(d.relatedInformation)),d.source&&(w.source=d.source),w}function wn(d,w){return d==null?d:Kc.map(d,_n,w)}function $n(d){return d==null?d:d.map(_n)}function Zr(d,w){switch(d){case"$string":return w;case L.MarkupKind.PlainText:return{kind:d,value:w};case L.MarkupKind.Markdown:return{kind:d,value:w.value};default:return`Unsupported Markup content received. Kind is: ${d}`}}function Fi(d){if(d===de.CompletionItemTag.Deprecated)return L.CompletionItemTag.Deprecated}function xi(d){if(d===void 0)return d;let w=[];for(let x of d){let Z=Fi(x);Z!==void 0&&w.push(Z)}return w}function Xr(d,w){return w!==void 0?w:d+1}function Wt(d,w=!1){let x,Z;an.string(d.label)?x=d.label:(x=d.label.label,w&&(d.label.detail!==void 0||d.label.description!==void 0)&&(Z={detail:d.label.detail,description:d.label.description}));let V={label:x};Z!==void 0&&(V.labelDetails=Z);let De=d instanceof uf.default?d:void 0;d.detail&&(V.detail=d.detail),d.documentation&&(!De||De.documentationFormat==="$string"?V.documentation=d.documentation:V.documentation=Zr(De.documentationFormat,d.documentation)),d.filterText&&(V.filterText=d.filterText),Mi(V,d),an.number(d.kind)&&(V.kind=Xr(d.kind,De&&De.originalItemKind)),d.sortText&&(V.sortText=d.sortText),d.additionalTextEdits&&(V.additionalTextEdits=ki(d.additionalTextEdits)),d.commitCharacters&&(V.commitCharacters=d.commitCharacters.slice()),d.command&&(V.command=$t(d.command)),(d.preselect===!0||d.preselect===!1)&&(V.preselect=d.preselect);let ke=xi(d.tags);if(De){if(De.data!==void 0&&(V.data=De.data),De.deprecated===!0||De.deprecated===!1){if(De.deprecated===!0&&ke!==void 0&&ke.length>0){let St=ke.indexOf(de.CompletionItemTag.Deprecated);St!==-1&&ke.splice(St,1)}V.deprecated=De.deprecated}De.insertTextMode!==void 0&&(V.insertTextMode=De.insertTextMode)}return ke!==void 0&&ke.length>0&&(V.tags=ke),V.insertTextMode===void 0&&d.keepWhitespace===!0&&(V.insertTextMode=L.InsertTextMode.adjustIndentation),V}function Mi(d,w){let x=L.InsertTextFormat.PlainText,Z,V;w.textEdit?(Z=w.textEdit.newText,V=w.textEdit.range):w.insertText instanceof de.SnippetString?(x=L.InsertTextFormat.Snippet,Z=w.insertText.value):Z=w.insertText,w.range&&(V=w.range),d.insertTextFormat=x,w.fromEdit&&Z!==void 0&&V!==void 0?d.textEdit=Cn(Z,V):d.insertText=Z}function Cn(d,w){return Vs.is(w)?L.InsertReplaceEdit.create(d,he(w.inserting),he(w.replacing)):{newText:d,range:he(w)}}function Bn(d){return{range:he(d.range),newText:d.newText}}function ki(d){return d==null?d:d.map(Bn)}function bt(d){return d<=de.SymbolKind.TypeParameter?d+1:L.SymbolKind.Property}function zn(d){return d}function Me(d){return d.map(zn)}function es(d,w,x){return{textDocument:i(d),position:rn(w),context:{includeDeclaration:x.includeDeclaration}}}async function Ve(d,w){let x=L.CodeAction.create(d.title);if(d instanceof Hc.default&&d.data!==void 0&&(x.data=d.data),d.kind!==void 0&&(x.kind=Ei(d.kind)),d.diagnostics!==void 0&&(x.diagnostics=await wn(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&&(x.command=$t(d.command)),d.isPreferred!==void 0&&(x.isPreferred=d.isPreferred),d.disabled!==void 0&&(x.disabled={reason:d.disabled.reason}),d.isAI&&(x.tags??=[],x.tags.push(L.CodeActionTag.LLMGenerated)),x}function bn(d){let w=L.CodeAction.create(d.title);if(d instanceof Hc.default&&d.data!==void 0&&(w.data=d.data),d.kind!==void 0&&(w.kind=Ei(d.kind)),d.diagnostics!==void 0&&(w.diagnostics=$n(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=$t(d.command)),d.isPreferred!==void 0&&(w.isPreferred=d.isPreferred),d.disabled!==void 0&&(w.disabled={reason:d.disabled.reason}),d.isAI&&(w.tags??=[],w.tags.push(L.CodeActionTag.LLMGenerated)),w}async function ts(d,w){if(d==null)return d;let x;return d.only&&an.string(d.only.value)&&(x=[d.only.value]),L.CodeActionContext.create(await wn(d.diagnostics,w),x,Vn(d.triggerKind))}function ns(d){if(d==null)return d;let w;return d.only&&an.string(d.only.value)&&(w=[d.only.value]),L.CodeActionContext.create($n(d.diagnostics),w,Vn(d.triggerKind))}function Vn(d){switch(d){case de.CodeActionTriggerKind.Invoke:return L.CodeActionTriggerKind.Invoked;case de.CodeActionTriggerKind.Automatic:return L.CodeActionTriggerKind.Automatic;default:return}}function Ei(d){if(d!=null)return d.value}function qi(d){return L.InlineValueContext.create(d.frameId,he(d.stoppedLocation))}function is(d,w,x){return{textDocument:i(d),position:Ct(w),context:Gn(x)}}function Gn(d){return{triggerKind:rs(d.triggerKind),selectedCompletionInfo:Ii(d.selectedCompletionInfo)}}function rs(d){switch(d){case de.InlineCompletionTriggerKind.Invoke:return L.InlineCompletionTriggerKind.Invoked;case de.InlineCompletionTriggerKind.Automatic:return L.InlineCompletionTriggerKind.Automatic}}function Ii(d){if(d!=null)return{range:he(d.range),text:d.text}}function $t(d){let w=L.Command.create(d.title,d.command);return d.tooltip&&(w.tooltip=d.tooltip),d.arguments&&(w.arguments=d.arguments),w}function Ai(d){let w=L.CodeLens.create(he(d.range));return d.command&&(w.command=$t(d.command)),d instanceof lf.default&&d.data&&(w.data=d.data),w}function ji(d,w){let x={tabSize:d.tabSize,insertSpaces:d.insertSpaces};return w.trimTrailingWhitespace&&(x.trimTrailingWhitespace=!0),w.trimFinalNewlines&&(x.trimFinalNewlines=!0),w.insertFinalNewline&&(x.insertFinalNewline=!0),x}function ss(d){return{textDocument:i(d)}}function Li(d){return{textDocument:i(d)}}function os(d){let w=L.DocumentLink.create(he(d.range));d.target&&(w.target=n(d.target)),d.tooltip!==void 0&&(w.tooltip=d.tooltip);let x=d instanceof df.default?d:void 0;return x&&x.data&&(w.data=x.data),w}function Ni(d){return{textDocument:i(d)}}function Ui(d){let w={name:d.name,kind:bt(d.kind),uri:n(d.uri),range:he(d.range),selectionRange:he(d.selectionRange)};return d.detail!==void 0&&d.detail.length>0&&(w.detail=d.detail),d.tags!==void 0&&(w.tags=Me(d.tags)),d instanceof ff.default&&d.data!==void 0&&(w.data=d.data),w}function as(d){let w={name:d.name,kind:bt(d.kind),uri:n(d.uri),range:he(d.range),selectionRange:he(d.selectionRange)};return d.detail!==void 0&&d.detail.length>0&&(w.detail=d.detail),d.tags!==void 0&&(w.tags=Me(d.tags)),d instanceof hf.default&&d.data!==void 0&&(w.data=d.data),w}function Jn(d){let w=d instanceof pf.default?{name:d.name,kind:bt(d.kind),location:d.hasRange?Kt(d.location):{uri:t(d.location.uri)},data:d.data}:{name:d.name,kind:bt(d.kind),location:Kt(d.location)};return d.tags!==void 0&&(w.tags=Me(d.tags)),d.containerName!==""&&(w.containerName=d.containerName),w}function cs(d){let w=typeof d.label=="string"?d.label:d.label.map(Ki),x=L.InlayHint.create(Ct(d.position),w);return d.kind!==void 0&&(x.kind=d.kind),d.textEdits!==void 0&&(x.textEdits=ki(d.textEdits)),d.tooltip!==void 0&&(x.tooltip=Hi(d.tooltip)),d.paddingLeft!==void 0&&(x.paddingLeft=d.paddingLeft),d.paddingRight!==void 0&&(x.paddingRight=d.paddingRight),d instanceof gf.default&&d.data!==void 0&&(x.data=d.data),x}function Ki(d){let w=L.InlayHintLabelPart.create(d.value);return d.location!==void 0&&(w.location=Kt(d.location)),d.command!==void 0&&(w.command=$t(d.command)),d.tooltip!==void 0&&(w.tooltip=Hi(d.tooltip)),w}function Hi(d){return typeof d=="string"?d:{kind:L.MarkupKind.Markdown,value:d.value}}return{asUri:n,asTextDocumentIdentifier:i,asTextDocumentItem:s,asVersionedTextDocumentIdentifier:o,asOpenTextDocumentParams:a,asChangeTextDocumentParams:p,asCloseTextDocumentParams:h,asSaveTextDocumentParams:f,asWillSaveTextDocumentParams:g,asDidCreateFilesParams:v,asDidRenameFilesParams:_,asDidDeleteFilesParams:T,asWillCreateFilesParams:C,asWillRenameFilesParams:D,asWillDeleteFilesParams:F,asTextDocumentPositionParams:E,asCompletionParams:we,asSignatureHelpParams:Gr,asWorkerPosition:rn,asRange:he,asRanges:Jr,asPosition:Ct,asPositions:yn,asPositionsSync:Ri,asLocation:Kt,asDiagnosticSeverity:Hn,asDiagnosticTag:Wn,asDiagnostic:_n,asDiagnostics:wn,asDiagnosticsSync:$n,asCompletionItem:Wt,asTextEdit:Bn,asSymbolKind:bt,asSymbolTag:zn,asSymbolTags:Me,asReferenceParams:es,asCodeAction:Ve,asCodeActionSync:bn,asCodeActionContext:ts,asCodeActionContextSync:ns,asInlineValueContext:qi,asCommand:$t,asCodeLens:Ai,asFormattingOptions:ji,asDocumentSymbolParams:ss,asCodeLensParams:Li,asDocumentLink:os,asDocumentLinkParams:Ni,asCallHierarchyItem:Ui,asTypeHierarchyItem:as,asInlayHint:cs,asWorkspaceSymbol:Jn,asInlineCompletionParams:is,asInlineCompletionContext:Gn}}});var Vc=M(Qe=>{"use strict";var vf=Qe&&Qe.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),yf=Qe&&Qe.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),tr=Qe&&Qe.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&vf(t,e,n[i]);return yf(t,e),t}})(),Gt=Qe&&Qe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Qe,"__esModule",{value:!0});Qe.createConverter=Rf;var R=tr(I("vscode")),A=tr(N()),Ae=tr(He()),z=tr(Qi()),_f=Gt(Fs()),wf=Gt(Ms()),Cf=Gt(Es()),bf=Gt(Is()),Bc=Ls(),Sf=Gt(Us()),Df=Gt(Hs()),Pf=Gt($s()),Tf=Gt(zs()),zc=N(),er;(function(r){function e(t){let n=t;return n&&Ae.string(n.language)&&Ae.string(n.value)}r.is=e})(er||(er={}));function Rf(r,e,t,n){let s=r||(c=>R.Uri.parse(c));function o(c){return s(c)}function a(c){let y=[];for(let b of c)if(typeof b=="string")y.push(b);else if(zc.NotebookCellTextDocumentFilter.is(b))if(typeof b.notebook=="string")y.push({notebookType:b.notebook,language:b.language});else{let O=b.notebook.notebookType??"*";y.push({notebookType:O,scheme:b.notebook.scheme,pattern:us(b.notebook.pattern),language:b.language})}else zc.TextDocumentFilter.is(b)&&y.push({language:b.language,scheme:b.scheme,pattern:us(b.pattern)});return y}async function u(c,y){return z.map(c,p,y)}function l(c){let y=new Array(c.length);for(let b=0;b<c.length;b++)y[b]=p(c[b]);return y}function p(c){let y=typeof c.message=="string"?c.message:c.message.kind==="plaintext"?c.message.value:"Received a markup diagnostic message but the client does not support it.",b=new Bc.ProtocolDiagnostic(v(c.range),y,T(c.severity),c.data);if(c.code!==void 0){if(typeof c.code=="string"||typeof c.code=="number")A.CodeDescription.is(c.codeDescription)?b.code={value:c.code,target:o(c.codeDescription.href)}:b.code=c.code;else if(Bc.DiagnosticCode.is(c.code)){b.hasDiagnosticCode=!0;let O=c.code;b.code={value:O.value,target:o(O.target)}}}return c.source&&(b.source=c.source),c.relatedInformation&&(b.relatedInformation=h(c.relatedInformation)),Array.isArray(c.tags)&&(b.tags=f(c.tags)),b}function h(c){let y=new Array(c.length);for(let b=0;b<c.length;b++){let O=c[b];y[b]=new R.DiagnosticRelatedInformation(Ht(O.location),O.message)}return y}function f(c){if(!c)return;let y=[];for(let b of c){let O=m(b);O!==void 0&&y.push(O)}return y.length>0?y:void 0}function m(c){switch(c){case A.DiagnosticTag.Unnecessary:return R.DiagnosticTag.Unnecessary;case A.DiagnosticTag.Deprecated:return R.DiagnosticTag.Deprecated;default:return}}function g(c){return c?new R.Position(c.line,c.character):void 0}function v(c){return c?new R.Range(c.start.line,c.start.character,c.end.line,c.end.character):void 0}async function _(c,y){return z.map(c,b=>new R.Range(b.start.line,b.start.character,b.end.line,b.end.character),y)}function T(c){if(c==null)return R.DiagnosticSeverity.Error;switch(c){case A.DiagnosticSeverity.Error:return R.DiagnosticSeverity.Error;case A.DiagnosticSeverity.Warning:return R.DiagnosticSeverity.Warning;case A.DiagnosticSeverity.Information:return R.DiagnosticSeverity.Information;case A.DiagnosticSeverity.Hint:return R.DiagnosticSeverity.Hint}return R.DiagnosticSeverity.Error}function C(c){if(Ae.string(c))return F(c);if(er.is(c))return F().appendCodeblock(c.value,c.language);if(Array.isArray(c)){let y=[];for(let b of c){let O=F();er.is(b)?O.appendCodeblock(b.value,b.language):O.appendMarkdown(b),y.push(O)}return y}else return F(c)}function D(c){if(Ae.string(c))return c;switch(c.kind){case A.MarkupKind.Markdown:return F(c.value);case A.MarkupKind.PlainText:return c.value;default:return`Unsupported Markup content received. Kind is: ${c.kind}`}}function F(c){let y;if(c===void 0||typeof c=="string")y=new R.MarkdownString(c);else switch(c.kind){case A.MarkupKind.Markdown:y=new R.MarkdownString(c.value);break;case A.MarkupKind.PlainText:y=new R.MarkdownString,y.appendText(c.value);break;default:y=new R.MarkdownString,y.appendText(`Unsupported Markup content received. Kind is: ${c.kind}`);break}return y.isTrusted=e,y.supportHtml=t,y.supportThemeIcons=n,y}function E(c){if(c)return new R.Hover(C(c.contents),v(c.range))}async function Q(c,y,b){if(!c)return;if(Array.isArray(c))return z.map(c,Dt=>Kn(Dt,y),b);let O=c,{defaultRange:oe,commitCharacters:fe}=we(O,y),X=await z.map(O.items,Dt=>Kn(Dt,fe,O.applyKind?.commitCharacters,oe,O.itemDefaults?.insertTextMode,O.itemDefaults?.insertTextFormat,O.itemDefaults?.data,O.applyKind?.data),b);return new R.CompletionList(X,O.isIncomplete)}function we(c,y){let b=c.itemDefaults?.editRange,O=c.itemDefaults?.commitCharacters??y;return A.Range.is(b)?{defaultRange:v(b),commitCharacters:O}:b!==void 0?{defaultRange:{inserting:v(b.insert),replacing:v(b.replace)},commitCharacters:O}:{defaultRange:void 0,commitCharacters:O}}function xe(c){return A.CompletionItemKind.Text<=c&&c<=A.CompletionItemKind.TypeParameter?[c-1,void 0]:[R.CompletionItemKind.Text,c]}function Un(c){if(c===A.CompletionItemTag.Deprecated)return R.CompletionItemTag.Deprecated}function Br(c){if(c==null)return[];let y=[];for(let b of c){let O=Un(b);O!==void 0&&y.push(O)}return y}function Kn(c,y,b,O,oe,fe,X,Dt){let Bt=Br(c.tags),Ue=Gr(c),pe=new _f.default(Ue);c.detail&&(pe.detail=c.detail),c.documentation&&(pe.documentation=D(c.documentation),pe.documentationFormat=Ae.string(c.documentation)?"$string":c.documentation.kind),c.filterText&&(pe.filterText=c.filterText);let Wi=rn(c,O,fe);if(Wi&&(pe.insertText=Wi.text,pe.range=Wi.range,pe.fromEdit=Wi.fromEdit),Ae.number(c.kind)){let[td,bc]=xe(c.kind);pe.kind=td,bc&&(pe.originalItemKind=bc)}c.sortText&&(pe.sortText=c.sortText),c.additionalTextEdits&&(pe.additionalTextEdits=he(c.additionalTextEdits));let wc=zr(c,y,b);wc&&(pe.commitCharacters=wc.slice()),c.command&&(pe.command=Me(c.command)),(c.deprecated===!0||c.deprecated===!1)&&(pe.deprecated=c.deprecated,c.deprecated===!0&&Bt.push(R.CompletionItemTag.Deprecated)),(c.preselect===!0||c.preselect===!1)&&(pe.preselect=c.preselect);let Cc=Vr(c,X,Dt);Cc!==void 0&&(pe.data=Cc),Bt.length>0&&(pe.tags=Bt);let ds=c.insertTextMode??oe;return ds!==void 0&&(pe.insertTextMode=ds,ds===A.InsertTextMode.asIs&&(pe.keepWhitespace=!0)),pe}function zr(c,y,b){if(b===A.ApplyKind.Merge){if(!y&&!c.commitCharacters)return;let O=new Set;if(y)for(let oe of y)O.add(oe);if(Ae.stringArray(c.commitCharacters))for(let oe of c.commitCharacters)O.add(oe);return Array.from(O)}return c.commitCharacters!==void 0?Ae.stringArray(c.commitCharacters)?c.commitCharacters:void 0:y}function Vr(c,y,b){if(b===A.ApplyKind.Merge){let O={...y};return c.data&&Object.entries(c.data).forEach(([oe,fe])=>{fe!=null&&(O[oe]=fe)}),O}return c.data??y}function Gr(c){return A.CompletionItemLabelDetails.is(c.labelDetails)?{label:c.label,detail:c.labelDetails.detail,description:c.labelDetails.description}:c.label}function rn(c,y,b){let O=c.insertTextFormat??b;if(c.textEdit!==void 0||y!==void 0){let[oe,fe]=c.textEdit!==void 0?Ct(c.textEdit):[y,c.textEditText??c.label];return O===A.InsertTextFormat.Snippet?{text:new R.SnippetString(fe),range:oe,fromEdit:!0}:{text:fe,range:oe,fromEdit:!0}}else return c.insertText?O===A.InsertTextFormat.Snippet?{text:new R.SnippetString(c.insertText),fromEdit:!1}:{text:c.insertText,fromEdit:!1}:void 0}function Ct(c){return A.InsertReplaceEdit.is(c)?[{inserting:v(c.insert),replacing:v(c.replace)},c.newText]:[v(c.range),c.newText]}function yn(c){if(c)return new R.TextEdit(v(c.range),c.newText)}async function Ri(c,y){if(c)return z.map(c,yn,y)}function he(c){if(!c)return;let y=new Array(c.length);for(let b=0;b<c.length;b++)y[b]=yn(c[b]);return y}async function Jr(c,y){if(!c)return;let b=new R.SignatureHelp;return Ae.number(c.activeSignature)?b.activeSignature=c.activeSignature:b.activeSignature=0,Ae.number(c.activeParameter)?b.activeParameter=c.activeParameter:c.activeParameter===null?b.activeParameter=-1:b.activeParameter=0,c.signatures&&(b.signatures=await Kt(c.signatures,y)),b}async function Kt(c,y){return z.mapAsync(c,Hn,y)}async function Hn(c,y){let b=new R.SignatureInformation(c.label);return c.documentation!==void 0&&(b.documentation=D(c.documentation)),c.parameters!==void 0&&(b.parameters=await Oi(c.parameters,y)),c.activeParameter!==void 0&&(b.activeParameter=c.activeParameter??-1),b}function Oi(c,y){return z.map(c,Wn,y)}function Wn(c){let y=new R.ParameterInformation(c.label);return c.documentation&&(y.documentation=D(c.documentation)),y}function Ht(c){return c?new R.Location(s(c.uri),v(c.range)):void 0}async function Yr(c,y){if(c)return wn(c,y)}async function Qr(c,y){if(c)return wn(c,y)}function _n(c){if(!c)return;let y={targetUri:s(c.targetUri),targetRange:v(c.targetRange),originSelectionRange:v(c.originSelectionRange),targetSelectionRange:v(c.targetSelectionRange)};if(!y.targetSelectionRange)throw new Error("targetSelectionRange must not be undefined or null");return y}async function wn(c,y){if(c)if(Ae.array(c)){if(c.length===0)return[];if(A.LocationLink.is(c[0])){let b=c;return z.map(b,_n,y)}else{let b=c;return z.map(b,Ht,y)}}else return A.LocationLink.is(c)?[_n(c)]:Ht(c)}async function $n(c,y){if(c)return z.map(c,Ht,y)}async function Zr(c,y){if(c)return z.map(c,Fi,y)}function Fi(c){let y=new R.DocumentHighlight(v(c.range));return Ae.number(c.kind)&&(y.kind=xi(c.kind)),y}function xi(c){switch(c){case A.DocumentHighlightKind.Text:return R.DocumentHighlightKind.Text;case A.DocumentHighlightKind.Read:return R.DocumentHighlightKind.Read;case A.DocumentHighlightKind.Write:return R.DocumentHighlightKind.Write}return R.DocumentHighlightKind.Text}async function Xr(c,y){if(c)return z.map(c,Bn,y)}function Wt(c){return c<=A.SymbolKind.TypeParameter?c-1:R.SymbolKind.Property}function Mi(c){if(c===A.SymbolTag.Deprecated)return R.SymbolTag.Deprecated}function Cn(c){if(c==null)return;let y=[];for(let b of c){let O=Mi(b);O!==void 0&&y.push(O)}return y.length===0?void 0:y}function Bn(c){let y=c.data,b=c.location,O=b.range===void 0||y!==void 0?new Pf.default(c.name,Wt(c.kind),c.containerName??"",b.range===void 0?s(b.uri):new R.Location(s(c.location.uri),v(b.range)),y):new R.SymbolInformation(c.name,Wt(c.kind),c.containerName??"",new R.Location(s(c.location.uri),v(b.range)));return zn(O,c),O}async function ki(c,y){if(c!=null)return z.map(c,bt,y)}function bt(c){let y=new R.DocumentSymbol(c.name,c.detail||"",Wt(c.kind),v(c.range),v(c.selectionRange));if(zn(y,c),c.children!==void 0&&c.children.length>0){let b=[];for(let O of c.children)b.push(bt(O));y.children=b}return y}function zn(c,y){c.tags=Cn(y.tags),y.deprecated&&(c.tags?c.tags.includes(R.SymbolTag.Deprecated)||(c.tags=c.tags.concat(R.SymbolTag.Deprecated)):c.tags=[R.SymbolTag.Deprecated])}function Me(c){let y={title:c.title,command:c.command};return c.tooltip&&(y.tooltip=c.tooltip),c.arguments&&(y.arguments=c.arguments),y}async function es(c,y){if(c)return z.map(c,Me,y)}let Ve=new Map;Ve.set(A.CodeActionKind.Empty,R.CodeActionKind.Empty),Ve.set(A.CodeActionKind.QuickFix,R.CodeActionKind.QuickFix),Ve.set(A.CodeActionKind.Refactor,R.CodeActionKind.Refactor),Ve.set(A.CodeActionKind.RefactorExtract,R.CodeActionKind.RefactorExtract),Ve.set(A.CodeActionKind.RefactorInline,R.CodeActionKind.RefactorInline),Ve.set(A.CodeActionKind.RefactorRewrite,R.CodeActionKind.RefactorRewrite),Ve.set(A.CodeActionKind.Source,R.CodeActionKind.Source),Ve.set(A.CodeActionKind.SourceOrganizeImports,R.CodeActionKind.SourceOrganizeImports);function bn(c){if(c==null)return;let y=Ve.get(c);if(y)return y;let b=c.split(".");y=R.CodeActionKind.Empty;for(let O of b)y=y.append(O);return y}function ts(c){if(c!=null)return c.map(y=>bn(y))}function ns(c){if(c!=null)return c.map(y=>({kind:bn(y.kind),command:Me(y.command)}))}async function Vn(c,y){if(c==null)return;let b=new bf.default(c.title,c.data);return c.kind!==void 0&&(b.kind=bn(c.kind)),c.diagnostics!==void 0&&(b.diagnostics=l(c.diagnostics)),c.edit!==void 0&&(b.edit=await Gn(c.edit,y)),c.command!==void 0&&(b.command=Me(c.command)),c.isPreferred!==void 0&&(b.isPreferred=c.isPreferred),c.disabled!==void 0&&(b.disabled={reason:c.disabled.reason}),c.tags?.includes(A.CodeActionTag.LLMGenerated)&&(b.isAI=!0),b}function Ei(c,y){return z.mapAsync(c,async b=>A.Command.is(b)?Me(b):Vn(b,y),y)}function qi(c){if(!c)return;let y=new wf.default(v(c.range));return c.command&&(y.command=Me(c.command)),c.data!==void 0&&c.data!==null&&(y.data=c.data),y}async function is(c,y){if(c)return z.map(c,qi,y)}async function Gn(c,y){if(!c)return;let b=new Map;if(c.changeAnnotations!==void 0){let fe=c.changeAnnotations;await z.forEach(Object.keys(fe),X=>{let Dt=rs(fe[X]);b.set(X,Dt)},y)}let O=fe=>{if(fe!==void 0)return b.get(fe)},oe=new R.WorkspaceEdit;if(c.documentChanges){let fe=c.documentChanges;await z.forEach(fe,X=>{if(A.CreateFile.is(X))oe.createFile(s(X.uri),X.options,O(X.annotationId));else if(A.RenameFile.is(X))oe.renameFile(s(X.oldUri),s(X.newUri),X.options,O(X.annotationId));else if(A.DeleteFile.is(X))oe.deleteFile(s(X.uri),X.options,O(X.annotationId));else if(A.TextDocumentEdit.is(X)){let Dt=s(X.textDocument.uri),Bt=[];for(let Ue of X.edits)A.AnnotatedTextEdit.is(Ue)?Bt.push([new R.TextEdit(v(Ue.range),Ue.newText),O(Ue.annotationId)]):A.SnippetTextEdit.is(Ue)?Bt.push([new R.SnippetTextEdit(v(Ue.range),new R.SnippetString(Ue.snippet.value)),O(Ue.annotationId)]):Bt.push([new R.TextEdit(v(Ue.range),Ue.newText),void 0]);oe.set(Dt,Bt)}else throw new Error(`Unknown workspace edit change received:
|
|
8
|
+
${JSON.stringify(X,void 0,4)}`)},y)}else if(c.changes){let fe=c.changes;await z.forEach(Object.keys(fe),X=>{oe.set(s(X),he(fe[X]))},y)}return oe}function rs(c){if(c!==void 0)return{label:c.label,needsConfirmation:!!c.needsConfirmation,description:c.description}}function Ii(c){let y=v(c.range),b=c.target?o(c.target):void 0,O=new Cf.default(y,b);return c.tooltip!==void 0&&(O.tooltip=c.tooltip),c.data!==void 0&&c.data!==null&&(O.data=c.data),O}async function $t(c,y){if(c)return z.map(c,Ii,y)}function Ai(c){return new R.Color(c.red,c.green,c.blue,c.alpha)}function ji(c){return new R.ColorInformation(v(c.range),Ai(c.color))}async function ss(c,y){if(c)return z.map(c,ji,y)}function Li(c){let y=new R.ColorPresentation(c.label);return y.additionalTextEdits=he(c.additionalTextEdits),c.textEdit&&(y.textEdit=yn(c.textEdit)),y}async function os(c,y){if(c)return z.map(c,Li,y)}function Ni(c){if(c)switch(c){case A.FoldingRangeKind.Comment:return R.FoldingRangeKind.Comment;case A.FoldingRangeKind.Imports:return R.FoldingRangeKind.Imports;case A.FoldingRangeKind.Region:return R.FoldingRangeKind.Region}}function Ui(c){return new R.FoldingRange(c.startLine,c.endLine,Ni(c.kind))}async function as(c,y){if(c)return z.map(c,Ui,y)}function Jn(c){return new R.SelectionRange(v(c.range),c.parent?Jn(c.parent):void 0)}async function cs(c,y){return Array.isArray(c)?z.map(c,Jn,y):[]}function Ki(c){return A.InlineValueText.is(c)?new R.InlineValueText(v(c.range),c.text):A.InlineValueVariableLookup.is(c)?new R.InlineValueVariableLookup(v(c.range),c.variableName,c.caseSensitiveLookup):new R.InlineValueEvaluatableExpression(v(c.range),c.expression)}async function Hi(c,y){return Array.isArray(c)?z.map(c,Ki,y):[]}async function d(c,y){let b=typeof c.label=="string"?c.label:await z.map(c.label,w,y),O=new Tf.default(g(c.position),b);return c.kind!==void 0&&(O.kind=c.kind),c.textEdits!==void 0&&(O.textEdits=await Ri(c.textEdits,y)),c.tooltip!==void 0&&(O.tooltip=x(c.tooltip)),c.paddingLeft!==void 0&&(O.paddingLeft=c.paddingLeft),c.paddingRight!==void 0&&(O.paddingRight=c.paddingRight),c.data!==void 0&&(O.data=c.data),O}function w(c){let y=new R.InlayHintLabelPart(c.value);return c.location!==void 0&&(y.location=Ht(c.location)),c.tooltip!==void 0&&(y.tooltip=x(c.tooltip)),c.command!==void 0&&(y.command=Me(c.command)),y}function x(c){return typeof c=="string"?c:F(c)}async function Z(c,y){if(Array.isArray(c))return z.mapAsync(c,d,y)}function V(c){if(c===null)return;let y=new Sf.default(Wt(c.kind),c.name,c.detail||"",o(c.uri),v(c.range),v(c.selectionRange),c.data);return c.tags!==void 0&&(y.tags=Cn(c.tags)),y}async function De(c,y){if(c!==null)return z.map(c,V,y)}async function ke(c,y){return new R.CallHierarchyIncomingCall(V(c.from),await _(c.fromRanges,y))}async function St(c,y){if(c!==null)return z.mapAsync(c,ke,y)}async function vc(c,y){return new R.CallHierarchyOutgoingCall(V(c.to),await _(c.fromRanges,y))}async function Vl(c,y){if(c!==null)return z.mapAsync(c,vc,y)}async function Gl(c,y){if(c!=null)return new R.SemanticTokens(new Uint32Array(c.data),c.resultId)}function yc(c){return new R.SemanticTokensEdit(c.start,c.deleteCount,c.data!==void 0?new Uint32Array(c.data):void 0)}async function Jl(c,y){if(c!=null)return new R.SemanticTokensEdits(c.edits.map(yc),c.resultId)}function Yl(c){return c}async function Ql(c,y){if(c!=null)return new R.LinkedEditingRanges(await _(c.ranges,y),Zl(c.wordPattern))}function Zl(c){if(c!=null)return new RegExp(c)}function _c(c){if(c===null)return;let y=new Df.default(Wt(c.kind),c.name,c.detail||"",o(c.uri),v(c.range),v(c.selectionRange),c.data);return c.tags!==void 0&&(y.tags=Cn(c.tags)),y}async function Xl(c,y){if(c!==null)return z.map(c,_c,y)}function us(c){if(Ae.string(c))return c;if(A.RelativePattern.is(c)){if(A.URI.is(c.baseUri))return new R.RelativePattern(o(c.baseUri),c.pattern);if(A.WorkspaceFolder.is(c.baseUri)){let y=R.workspace.getWorkspaceFolder(o(c.baseUri.uri));return y!==void 0?new R.RelativePattern(y,c.pattern):void 0}}}async function ed(c,y){if(!c)return;if(Array.isArray(c))return z.map(c,oe=>ls(oe),y);let b=c,O=await z.map(b.items,oe=>ls(oe),y);return new R.InlineCompletionList(O)}function ls(c){let y;typeof c.insertText=="string"?y=c.insertText:y=new R.SnippetString(c.insertText.value);let b;c.command&&(b=Me(c.command));let O=new R.InlineCompletionItem(y,v(c.range),b);return c.filterText&&(O.filterText=c.filterText),O}return{asUri:o,asDocumentSelector:a,asDiagnostics:u,asDiagnostic:p,asRange:v,asRanges:_,asPosition:g,asDiagnosticSeverity:T,asDiagnosticTag:m,asHover:E,asCompletionResult:Q,asCompletionItem:Kn,asTextEdit:yn,asTextEdits:Ri,asSignatureHelp:Jr,asSignatureInformations:Kt,asSignatureInformation:Hn,asParameterInformations:Oi,asParameterInformation:Wn,asDeclarationResult:Yr,asDefinitionResult:Qr,asLocation:Ht,asReferences:$n,asDocumentHighlights:Zr,asDocumentHighlight:Fi,asDocumentHighlightKind:xi,asSymbolKind:Wt,asSymbolTag:Mi,asSymbolTags:Cn,asSymbolInformations:Xr,asSymbolInformation:Bn,asDocumentSymbols:ki,asDocumentSymbol:bt,asCommand:Me,asCommands:es,asCodeAction:Vn,asCodeActionKind:bn,asCodeActionKinds:ts,asCodeActionDocumentations:ns,asCodeActionResult:Ei,asCodeLens:qi,asCodeLenses:is,asWorkspaceEdit:Gn,asDocumentLink:Ii,asDocumentLinks:$t,asFoldingRangeKind:Ni,asFoldingRange:Ui,asFoldingRanges:as,asColor:Ai,asColorInformation:ji,asColorInformations:ss,asColorPresentation:Li,asColorPresentations:os,asSelectionRange:Jn,asSelectionRanges:cs,asInlineValue:Ki,asInlineValues:Hi,asInlayHint:d,asInlayHints:Z,asSemanticTokensLegend:Yl,asSemanticTokens:Gl,asSemanticTokensEdit:yc,asSemanticTokensEdits:Jl,asCallHierarchyItem:V,asCallHierarchyItems:De,asCallHierarchyIncomingCall:ke,asCallHierarchyIncomingCalls:St,asCallHierarchyOutgoingCall:vc,asCallHierarchyOutgoingCalls:Vl,asLinkedEditingRanges:Ql,asTypeHierarchyItem:_c,asTypeHierarchyItems:Xl,asGlobPattern:us,asInlineCompletionResult:ed,asInlineCompletionItem:ls}}});var ne=M(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Jt.empty=void 0;Jt.v4=Gc;Jt.isUUID=Jc;Jt.parse=Ff;Jt.generateUuid=xf;var ii=class{_value;constructor(e){this._value=e}asHex(){return this._value}equals(e){return this.asHex()===e.asHex()}},Gs=class r extends ii{static _chars=["0","1","2","3","4","5","6","6","7","8","9","a","b","c","d","e","f"];static _timeHighBits=["8","9","a","b"];static _oneOf(e){return e[Math.floor(e.length*Math.random())]}static _randomHex(){return r._oneOf(r._chars)}constructor(){super([r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),"-",r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),"-","4",r._randomHex(),r._randomHex(),r._randomHex(),"-",r._oneOf(r._timeHighBits),r._randomHex(),r._randomHex(),r._randomHex(),"-",r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex(),r._randomHex()].join(""))}};Jt.empty=new ii("00000000-0000-0000-0000-000000000000");function Gc(){return new Gs}var Of=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Jc(r){return Of.test(r)}function Ff(r){if(!Jc(r))throw new Error("invalid uuid");return new ii(r)}function xf(){return Gc().asHex()}});var Ys=M(it=>{"use strict";var Mf=it&&it.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),kf=it&&it.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Ef=it&&it.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Mf(t,e,n[i]);return kf(t,e),t}})();Object.defineProperty(it,"__esModule",{value:!0});it.ProgressPart=void 0;var Yc=I("vscode"),Qc=N(),Zc=Ef(He()),Js=class{_client;_token;_infinite;_reported;_lspProgressDisposable;_progress;_cancellationToken;_tokenDisposable;_resolve;_reject;constructor(e,t,n){this._client=e,this._token=t,this._reported=0,this._infinite=!1,this._lspProgressDisposable=this._client.onProgress(Qc.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&&Yc.window.withProgress({location:Yc.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(Qc.WorkDoneProgressCancelNotification.type,{token:this._token})}),this.report(e),new Promise((i,s)=>{this._resolve=i,this._reject=s})})}report(e){if(this._infinite&&Zc.string(e.message))this._progress!==void 0&&this._progress.report({message:e.message});else if(Zc.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}};it.ProgressPart=Js});var B=M(ae=>{"use strict";var qf=ae&&ae.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),If=ae&&ae.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),nu=ae&&ae.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&qf(t,e,n[i]);return If(t,e),t}})();Object.defineProperty(ae,"__esModule",{value:!0});ae.WorkspaceFeature=ae.TextDocumentLanguageFeature=ae.TextDocumentEventFeature=ae.DynamicDocumentFeature=ae.DynamicFeature=ae.StaticFeature=ae.LSPCancellationError=void 0;ae.ensure=Af;var Yt=I("vscode"),Qs=N(),Fe=nu(He()),Xc=nu(ne()),Zs=class extends Yt.CancellationError{data;constructor(e){super(),this.data=e}};ae.LSPCancellationError=Zs;function Af(r,e){return r[e]===void 0&&(r[e]={}),r[e]}var eu;(function(r){function e(t){let n=t;return n!=null&&Fe.func(n.fillClientCapabilities)&&Fe.func(n.initialize)&&Fe.func(n.getState)&&Fe.func(n.clear)&&(n.fillInitializeParams===void 0||Fe.func(n.fillInitializeParams))}r.is=e})(eu||(ae.StaticFeature=eu={}));var tu;(function(r){function e(t){let n=t;return n!=null&&Fe.func(n.fillClientCapabilities)&&Fe.func(n.initialize)&&Fe.func(n.getState)&&Fe.func(n.clear)&&(n.fillInitializeParams===void 0||Fe.func(n.fillInitializeParams))&&Fe.func(n.register)&&Fe.func(n.unregister)&&n.registrationType!==void 0}r.is=e})(tu||(ae.DynamicFeature=tu={}));var ri=class{_client;constructor(e){this._client=e}getState(){let e=this.getDocumentSelectors(),t=0;for(let i of e){t++;for(let s of Yt.workspace.textDocuments)if(Yt.languages.match(i,s)>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}}};ae.DynamicDocumentFeature=ri;var Xs=class extends ri{_event;_type;_middleware;_createParams;_textDocument;_selectorFilter;_listener;_selectors;_onNotificationSent;static textDocumentFilter(e,t){for(let n of e)if(Yt.languages.match(n,t)>0)return!0;return!1}constructor(e,t,n,i,s,o,a){super(e),this._event=t,this._type=n,this._middleware=i,this._createParams=s,this._textDocument=o,this._selectorFilter=a,this._selectors=new Map,this._onNotificationSent=new Yt.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._onNotificationSent=new Yt.EventEmitter,this._listener&&(this._listener.dispose(),this._listener=void 0)}getProvider(e){for(let t of this._selectors.values())if(Yt.languages.match(t,e)>0)return{send:n=>this.callback(n)}}};ae.TextDocumentEventFeature=Xs;var eo=class extends ri{_registrationType;_registrations;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&&(this._registrations.delete(e),t.disposable.dispose())}clear(){this._registrations.forEach(e=>{e.disposable.dispose()}),this._registrations.clear()}getRegistration(e,t){if(t){if(Qs.TextDocumentRegistrationOptions.is(t)){let n=Qs.StaticRegistrationOptions.hasId(t)?t.id:Xc.generateUuid(),i=t.documentSelector??e;if(i)return[n,Object.assign({},t,{documentSelector:i})]}else if(Fe.boolean(t)&&t===!0||Qs.WorkDoneProgressOptions.is(t)){if(!e)return[void 0,void 0];let n=Fe.boolean(t)&&t===!0?{documentSelector:e}:Object.assign({},t,{documentSelector:e});return[Xc.generateUuid(),n]}}else return[void 0,void 0];return[void 0,void 0]}getRegistrationOptions(e,t){if(!(!e||!t))return Fe.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&&Yt.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}};ae.TextDocumentLanguageFeature=eo;var to=class{_client;_registrationType;_registrations;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&&(this._registrations.delete(e),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}};ae.WorkspaceFeature=to});var ru=M(cn=>{"use strict";Object.defineProperty(cn,"__esModule",{value:!0});cn.range=cn.balanced=void 0;var jf=(r,e,t)=>{let n=r instanceof RegExp?iu(r,t):r,i=e instanceof RegExp?iu(e,t):e,s=n!==null&&i!=null&&(0,cn.range)(n,i,t);return s&&{start:s[0],end:s[1],pre:t.slice(0,s[0]),body:t.slice(s[0]+n.length,s[1]),post:t.slice(s[1]+i.length)}};cn.balanced=jf;var iu=(r,e)=>{let t=e.match(r);return t?t[0]:null},Lf=(r,e,t)=>{let n,i,s,o,a,u=t.indexOf(r),l=t.indexOf(e,u+1),p=u;if(u>=0&&l>0){if(r===e)return[u,l];for(n=[],s=t.length;p>=0&&!a;){if(p===u)n.push(p),u=t.indexOf(r,p+1);else if(n.length===1){let h=n.pop();h!==void 0&&(a=[h,l])}else i=n.pop(),i!==void 0&&i<s&&(s=i,o=l),l=t.indexOf(e,p+1);p=u<l&&u>=0?u:l}n.length&&o!==void 0&&(a=[s,o])}return a};cn.range=Lf});var du=M(Tn=>{"use strict";Object.defineProperty(Tn,"__esModule",{value:!0});Tn.EXPANSION_MAX=void 0;Tn.expand=Qf;var su=ru(),ou="\0SLASH"+Math.random()+"\0",au="\0OPEN"+Math.random()+"\0",io="\0CLOSE"+Math.random()+"\0",cu="\0COMMA"+Math.random()+"\0",uu="\0PERIOD"+Math.random()+"\0",Nf=new RegExp(ou,"g"),Uf=new RegExp(au,"g"),Kf=new RegExp(io,"g"),Hf=new RegExp(cu,"g"),Wf=new RegExp(uu,"g"),$f=/\\\\/g,Bf=/\\{/g,zf=/\\}/g,Vf=/\\,/g,Gf=/\\\./g;Tn.EXPANSION_MAX=1e5;function no(r){return isNaN(r)?r.charCodeAt(0):parseInt(r,10)}function Jf(r){return r.replace($f,ou).replace(Bf,au).replace(zf,io).replace(Vf,cu).replace(Gf,uu)}function Yf(r){return r.replace(Nf,"\\").replace(Uf,"{").replace(Kf,"}").replace(Hf,",").replace(Wf,".")}function lu(r){if(!r)return[""];let e=[],t=(0,su.balanced)("{","}",r);if(!t)return r.split(",");let{pre:n,body:i,post:s}=t,o=n.split(",");o[o.length-1]+="{"+i+"}";let a=lu(s);return s.length&&(o[o.length-1]+=a.shift(),o.push.apply(o,a)),e.push.apply(e,o),e}function Qf(r,e={}){if(!r)return[];let{max:t=Tn.EXPANSION_MAX}=e;return r.slice(0,2)==="{}"&&(r="\\{\\}"+r.slice(2)),si(Jf(r),t,!0).map(Yf)}function Zf(r){return"{"+r+"}"}function Xf(r){return/^-?0\d/.test(r)}function eh(r,e){return r<=e}function th(r,e){return r>=e}function si(r,e,t){let n=[],i=(0,su.balanced)("{","}",r);if(!i)return[r];let s=i.pre,o=i.post.length?si(i.post,e,!1):[""];if(/\$$/.test(i.pre))for(let a=0;a<o.length&&a<e;a++){let u=s+"{"+i.body+"}"+o[a];n.push(u)}else{let a=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),u=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),l=a||u,p=i.body.indexOf(",")>=0;if(!l&&!p)return i.post.match(/,(?!,).*\}/)?(r=i.pre+"{"+i.body+io+i.post,si(r,e,!0)):[r];let h;if(l)h=i.body.split(/\.\./);else if(h=lu(i.body),h.length===1&&h[0]!==void 0&&(h=si(h[0],e,!1).map(Zf),h.length===1))return o.map(m=>i.pre+h[0]+m);let f;if(l&&h[0]!==void 0&&h[1]!==void 0){let m=no(h[0]),g=no(h[1]),v=Math.max(h[0].length,h[1].length),_=h.length===3&&h[2]!==void 0?Math.max(Math.abs(no(h[2])),1):1,T=eh;g<m&&(_*=-1,T=th);let D=h.some(Xf);f=[];for(let F=m;T(F,g)&&f.length<e;F+=_){let E;if(u)E=String.fromCharCode(F),E==="\\"&&(E="");else if(E=String(F),D){let Q=v-E.length;if(Q>0){let we=new Array(Q+1).join("0");F<0?E="-"+we+E.slice(1):E=we+E}}f.push(E)}}else{f=[];for(let m=0;m<h.length;m++)f.push.apply(f,si(h[m],e,!1))}for(let m=0;m<f.length;m++)for(let g=0;g<o.length&&n.length<e;g++){let v=s+f[m]+o[g];(!t||l||v)&&n.push(v)}}return n}});var fu=M(nr=>{"use strict";Object.defineProperty(nr,"__esModule",{value:!0});nr.assertValidPattern=void 0;var nh=1024*64,ih=r=>{if(typeof r!="string")throw new TypeError("invalid pattern");if(r.length>nh)throw new TypeError("pattern is too long")};nr.assertValidPattern=ih});var pu=M(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.parseClass=void 0;var rh={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},oi=r=>r.replace(/[[\]\\-]/g,"\\$&"),sh=r=>r.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),hu=r=>r.join(""),oh=(r,e)=>{let t=e;if(r.charAt(t)!=="[")throw new Error("not in a brace expression");let n=[],i=[],s=t+1,o=!1,a=!1,u=!1,l=!1,p=t,h="";e:for(;s<r.length;){let v=r.charAt(s);if((v==="!"||v==="^")&&s===t+1){l=!0,s++;continue}if(v==="]"&&o&&!u){p=s+1;break}if(o=!0,v==="\\"&&!u){u=!0,s++;continue}if(v==="["&&!u){for(let[_,[T,C,D]]of Object.entries(rh))if(r.startsWith(_,s)){if(h)return["$.",!1,r.length-t,!0];s+=_.length,D?i.push(T):n.push(T),a=a||C;continue e}}if(u=!1,h){v>h?n.push(oi(h)+"-"+oi(v)):v===h&&n.push(oi(v)),h="",s++;continue}if(r.startsWith("-]",s+1)){n.push(oi(v+"-")),s+=2;continue}if(r.startsWith("-",s+1)){h=v,s+=2;continue}n.push(oi(v)),s++}if(p<s)return["",!1,0,!1];if(!n.length&&!i.length)return["$.",!1,r.length-t,!0];if(i.length===0&&n.length===1&&/^\\?.$/.test(n[0])&&!l){let v=n[0].length===2?n[0].slice(-1):n[0];return[sh(v),!1,p-t,!1]}let f="["+(l?"^":"")+hu(n)+"]",m="["+(l?"":"^")+hu(i)+"]";return[n.length&&i.length?"("+f+"|"+m+")":n.length?f:m,a,p-t,!0]};ir.parseClass=oh});var sr=M(rr=>{"use strict";Object.defineProperty(rr,"__esModule",{value:!0});rr.unescape=void 0;var ah=(r,{windowsPathsNoEscape:e=!1,magicalBraces:t=!0}={})=>t?e?r.replace(/\[([^/\\])\]/g,"$1"):r.replace(/((?!\\).|^)\[([^/\\])\]/g,"$1$2").replace(/\\([^/])/g,"$1"):e?r.replace(/\[([^/\\{}])\]/g,"$1"):r.replace(/((?!\\).|^)\[([^/\\{}])\]/g,"$1$2").replace(/\\([^/{}])/g,"$1");rr.unescape=ah});var oo=M(ur=>{"use strict";var Ee;Object.defineProperty(ur,"__esModule",{value:!0});ur.AST=void 0;var ch=pu(),or=sr(),uh=new Set(["!","?","+","*","@"]),ro=r=>uh.has(r),gu=r=>ro(r.type),lh=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),dh=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),fh=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),mu=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),hh="(?!(?:^|/)\\.\\.?(?:$|/))",ar="(?!\\.)",ph=new Set(["[","."]),gh=new Set(["..","."]),mh=new Set("().*{}+?[]^$\\!"),vh=r=>r.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),so="[^/]",vu=so+"*?",yu=so+"+?",yh=0,cr=class{type;#n;#i;#r=!1;#e=[];#t;#a;#u;#c=!1;#s;#o;#l=!1;id=++yh;get depth(){return(this.#t?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#n.id,parent:this.#t?.id,depth:this.depth,partsLength:this.#e.length,parts:this.#e}}constructor(e,t,n={}){this.type=e,e&&(this.#i=!0),this.#t=t,this.#n=this.#t?this.#t.#n:this,this.#s=this.#n===this?n:this.#n.#s,this.#u=this.#n===this?[]:this.#n.#u,e==="!"&&!this.#n.#c&&this.#u.push(this),this.#a=this.#t?this.#t.#e.length:0}get hasMagic(){if(this.#i!==void 0)return this.#i;for(let e of this.#e)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#i=!0;return this.#i}toString(){return this.#o!==void 0?this.#o:this.type?this.#o=this.type+"("+this.#e.map(e=>String(e)).join("|")+")":this.#o=this.#e.map(e=>String(e)).join("")}#v(){if(this!==this.#n)throw new Error("should only call on root");if(this.#c)return this;this.toString(),this.#c=!0;let e;for(;e=this.#u.pop();){if(e.type!=="!")continue;let t=e,n=t.#t;for(;n;){for(let i=t.#a+1;!n.type&&i<n.#e.length;i++)for(let s of e.#e){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(n.#e[i])}t=n,n=t.#t}}return this}push(...e){for(let t of e)if(t!==""){if(typeof t!="string"&&!(t instanceof Ee&&t.#t===this))throw new Error("invalid part: "+t);this.#e.push(t)}}toJSON(){let e=this.type===null?this.#e.slice().map(t=>typeof t=="string"?t:t.toJSON()):[this.type,...this.#e.map(t=>t.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#n||this.#n.#c&&this.#t?.type==="!")&&e.push({}),e}isStart(){if(this.#n===this)return!0;if(!this.#t?.isStart())return!1;if(this.#a===0)return!0;let e=this.#t;for(let t=0;t<this.#a;t++){let n=e.#e[t];if(!(n instanceof Ee&&n.type==="!"))return!1}return!0}isEnd(){if(this.#n===this||this.#t?.type==="!")return!0;if(!this.#t?.isEnd())return!1;if(!this.type)return this.#t?.isEnd();let e=this.#t?this.#t.#e.length:0;return this.#a===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let t=new Ee(this.type,e);for(let n of this.#e)t.copyIn(n);return t}static#d(e,t,n,i,s){let o=i.maxExtglobRecursion??2,a=!1,u=!1,l=-1,p=!1;if(t.type===null){let v=n,_="";for(;v<e.length;){let T=e.charAt(v++);if(a||T==="\\"){a=!a,_+=T;continue}if(u){v===l+1?(T==="^"||T==="!")&&(p=!0):T==="]"&&!(v===l+2&&p)&&(u=!1),_+=T;continue}else if(T==="["){u=!0,l=v,p=!1,_+=T;continue}if(!i.noext&&ro(T)&&e.charAt(v)==="("&&s<=o){t.push(_),_="";let D=new Ee(T,t);v=Ee.#d(e,D,v,i,s+1),t.push(D);continue}_+=T}return t.push(_),v}let h=n+1,f=new Ee(null,t),m=[],g="";for(;h<e.length;){let v=e.charAt(h++);if(a||v==="\\"){a=!a,g+=v;continue}if(u){h===l+1?(v==="^"||v==="!")&&(p=!0):v==="]"&&!(h===l+2&&p)&&(u=!1),g+=v;continue}else if(v==="["){u=!0,l=h,p=!1,g+=v;continue}if(!i.noext&&ro(v)&&e.charAt(h)==="("&&(s<=o||t&&t.#f(v))){let T=t&&t.#f(v)?0:1;f.push(g),g="";let C=new Ee(v,f);f.push(C),h=Ee.#d(e,C,h,i,s+T);continue}if(v==="|"){f.push(g),g="",m.push(f),f=new Ee(null,t);continue}if(v===")")return g===""&&t.#e.length===0&&(t.#l=!0),f.push(g),g="",t.push(...m,f),h;g+=v}return t.type=null,t.#i=void 0,t.#e=[e.substring(n-1)],h}#y(e){return this.#p(e,dh)}#p(e,t=lh){if(!e||typeof e!="object"||e.type!==null||e.#e.length!==1||this.type===null)return!1;let n=e.#e[0];return!n||typeof n!="object"||n.type===null?!1:this.#f(n.type,t)}#f(e,t=fh){return!!t.get(this.type)?.includes(e)}#_(e,t){let n=e.#e[0],i=new Ee(null,n,this.options);i.#e.push(""),n.push(i),this.#g(e,t)}#g(e,t){let n=e.#e[0];this.#e.splice(t,1,...n.#e);for(let i of n.#e)typeof i=="object"&&(i.#t=this);this.#o=void 0}#w(e){return!!mu.get(this.type)?.has(e)}#C(e){if(!e||typeof e!="object"||e.type!==null||e.#e.length!==1||this.type===null||this.#e.length!==1)return!1;let t=e.#e[0];return!t||typeof t!="object"||t.type===null?!1:this.#w(t.type)}#b(e){let t=mu.get(this.type),n=e.#e[0],i=t?.get(n.type);if(!i)return!1;this.#e=n.#e;for(let s of this.#e)typeof s=="object"&&(s.#t=this);this.type=i,this.#o=void 0,this.#l=!1}static fromGlob(e,t={}){let n=new Ee(null,void 0,t);return Ee.#d(e,n,0,t,0),n}toMMPattern(){if(this!==this.#n)return this.#n.toMMPattern();let e=this.toString(),[t,n,i,s]=this.toRegExpSource();if(!(i||this.#i||this.#s.nocase&&!this.#s.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return n;let a=(this.#s.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${t}$`,a),{_src:t,_glob:e})}get options(){return this.#s}toRegExpSource(e){let t=e??!!this.#s.dot;if(this.#n===this&&(this.#h(),this.#v()),!gu(this)){let u=this.isStart()&&this.isEnd()&&!this.#e.some(m=>typeof m!="string"),l=this.#e.map(m=>{let[g,v,_,T]=typeof m=="string"?Ee.#S(m,this.#i,u):m.toRegExpSource(e);return this.#i=this.#i||_,this.#r=this.#r||T,g}).join(""),p="";if(this.isStart()&&typeof this.#e[0]=="string"&&!(this.#e.length===1&&gh.has(this.#e[0]))){let g=ph,v=t&&g.has(l.charAt(0))||l.startsWith("\\.")&&g.has(l.charAt(2))||l.startsWith("\\.\\.")&&g.has(l.charAt(4)),_=!t&&!e&&g.has(l.charAt(0));p=v?hh:_?ar:""}let h="";return this.isEnd()&&this.#n.#c&&this.#t?.type==="!"&&(h="(?:$|\\/)"),[p+l+h,(0,or.unescape)(l),this.#i=!!this.#i,this.#r]}let n=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#m(t);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let u=this.toString(),l=this;return l.#e=[u],l.type=null,l.#i=void 0,[u,(0,or.unescape)(this.toString()),!1,!1]}let o=!n||e||t||!ar?"":this.#m(!0);o===s&&(o=""),o&&(s=`(?:${s})(?:${o})*?`);let a="";if(this.type==="!"&&this.#l)a=(this.isStart()&&!t?ar:"")+yu;else{let u=this.type==="!"?"))"+(this.isStart()&&!t&&!e?ar:"")+vu+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;a=i+s+u}return[a,(0,or.unescape)(s),this.#i=!!this.#i,this.#r]}#h(){if(gu(this)){let e=0,t=!1;do{t=!0;for(let n=0;n<this.#e.length;n++){let i=this.#e[n];typeof i=="object"&&(i.#h(),this.#p(i)?(t=!1,this.#g(i,n)):this.#y(i)?(t=!1,this.#_(i,n)):this.#C(i)&&(t=!1,this.#b(i)))}}while(!t&&++e<10)}else for(let e of this.#e)typeof e=="object"&&e.#h();this.#o=void 0}#m(e){return this.#e.map(t=>{if(typeof t=="string")throw new Error("string type in extglob ast??");let[n,i,s,o]=t.toRegExpSource(e);return this.#r=this.#r||o,n}).filter(t=>!(this.isStart()&&this.isEnd())||!!t).join("|")}static#S(e,t,n=!1){let i=!1,s="",o=!1,a=!1;for(let u=0;u<e.length;u++){let l=e.charAt(u);if(i){i=!1,s+=(mh.has(l)?"\\":"")+l;continue}if(l==="*"){if(a)continue;a=!0,s+=n&&/^[*]+$/.test(e)?yu:vu,t=!0;continue}else a=!1;if(l==="\\"){u===e.length-1?s+="\\\\":i=!0;continue}if(l==="["){let[p,h,f,m]=(0,ch.parseClass)(e,u);if(f){s+=p,o=o||h,u+=f-1,t=t||m;continue}}if(l==="?"){s+=so,t=!0;continue}s+=vh(l)}return[s,(0,or.unescape)(e),!!t,o]}};ur.AST=cr;Ee=cr});var ao=M(lr=>{"use strict";Object.defineProperty(lr,"__esModule",{value:!0});lr.escape=void 0;var _h=(r,{windowsPathsNoEscape:e=!1,magicalBraces:t=!1}={})=>t?e?r.replace(/[?*()[\]{}]/g,"[$&]"):r.replace(/[?*()[\]\\{}]/g,"\\$&"):e?r.replace(/[?*()[\]]/g,"[$&]"):r.replace(/[?*()[\]\\]/g,"\\$&");lr.escape=_h});var co=M(k=>{"use strict";Object.defineProperty(k,"__esModule",{value:!0});k.unescape=k.escape=k.AST=k.Minimatch=k.match=k.makeRe=k.braceExpand=k.defaults=k.filter=k.GLOBSTAR=k.sep=k.minimatch=void 0;var wh=du(),dr=fu(),Cu=oo(),Ch=ao(),bh=sr(),Sh=(r,e,t={})=>((0,dr.assertValidPattern)(e),!t.nocomment&&e.charAt(0)==="#"?!1:new un(e,t).match(r));k.minimatch=Sh;var Dh=/^\*+([^+@!?*[(]*)$/,Ph=r=>e=>!e.startsWith(".")&&e.endsWith(r),Th=r=>e=>e.endsWith(r),Rh=r=>(r=r.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(r)),Oh=r=>(r=r.toLowerCase(),e=>e.toLowerCase().endsWith(r)),Fh=/^\*+\.\*+$/,xh=r=>!r.startsWith(".")&&r.includes("."),Mh=r=>r!=="."&&r!==".."&&r.includes("."),kh=/^\.\*+$/,Eh=r=>r!=="."&&r!==".."&&r.startsWith("."),qh=/^\*+$/,Ih=r=>r.length!==0&&!r.startsWith("."),Ah=r=>r.length!==0&&r!=="."&&r!=="..",jh=/^\?+([^+@!?*[(]*)?$/,Lh=([r,e=""])=>{let t=bu([r]);return e?(e=e.toLowerCase(),n=>t(n)&&n.toLowerCase().endsWith(e)):t},Nh=([r,e=""])=>{let t=Su([r]);return e?(e=e.toLowerCase(),n=>t(n)&&n.toLowerCase().endsWith(e)):t},Uh=([r,e=""])=>{let t=Su([r]);return e?n=>t(n)&&n.endsWith(e):t},Kh=([r,e=""])=>{let t=bu([r]);return e?n=>t(n)&&n.endsWith(e):t},bu=([r])=>{let e=r.length;return t=>t.length===e&&!t.startsWith(".")},Su=([r])=>{let e=r.length;return t=>t.length===e&&t!=="."&&t!==".."},Du=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",_u={win32:{sep:"\\"},posix:{sep:"/"}};k.sep=Du==="win32"?_u.win32.sep:_u.posix.sep;k.minimatch.sep=k.sep;k.GLOBSTAR=Symbol("globstar **");k.minimatch.GLOBSTAR=k.GLOBSTAR;var Hh="[^/]",Wh=Hh+"*?",$h="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",Bh="(?:(?!(?:\\/|^)\\.).)*?",zh=(r,e={})=>t=>(0,k.minimatch)(t,r,e);k.filter=zh;k.minimatch.filter=k.filter;var $e=(r,e={})=>Object.assign({},r,e),Vh=r=>{if(!r||typeof r!="object"||!Object.keys(r).length)return k.minimatch;let e=k.minimatch;return Object.assign((n,i,s={})=>e(n,i,$e(r,s)),{Minimatch:class extends e.Minimatch{constructor(i,s={}){super(i,$e(r,s))}static defaults(i){return e.defaults($e(r,i)).Minimatch}},AST:class extends e.AST{constructor(i,s,o={}){super(i,s,$e(r,o))}static fromGlob(i,s={}){return e.AST.fromGlob(i,$e(r,s))}},unescape:(n,i={})=>e.unescape(n,$e(r,i)),escape:(n,i={})=>e.escape(n,$e(r,i)),filter:(n,i={})=>e.filter(n,$e(r,i)),defaults:n=>e.defaults($e(r,n)),makeRe:(n,i={})=>e.makeRe(n,$e(r,i)),braceExpand:(n,i={})=>e.braceExpand(n,$e(r,i)),match:(n,i,s={})=>e.match(n,i,$e(r,s)),sep:e.sep,GLOBSTAR:k.GLOBSTAR})};k.defaults=Vh;k.minimatch.defaults=k.defaults;var Gh=(r,e={})=>((0,dr.assertValidPattern)(r),e.nobrace||!/\{(?:(?!\{).)*\}/.test(r)?[r]:(0,wh.expand)(r,{max:e.braceExpandMax}));k.braceExpand=Gh;k.minimatch.braceExpand=k.braceExpand;var Jh=(r,e={})=>new un(r,e).makeRe();k.makeRe=Jh;k.minimatch.makeRe=k.makeRe;var Yh=(r,e,t={})=>{let n=new un(e,t);return r=r.filter(i=>n.match(i)),n.options.nonull&&!r.length&&r.push(e),r};k.match=Yh;k.minimatch.match=k.match;var wu=/[?*]|[+@!]\(.*?\)|\[|\]/,Qh=r=>r.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),un=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){(0,dr.assertValidPattern)(e),t=t||{},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||Du,this.isWindows=this.platform==="win32";let n="allowWindowsEscape";this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t[n]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot!==void 0?t.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let t of e)if(typeof t!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let i=this.globParts.map((s,o,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let u=s[0]===""&&s[1]===""&&(s[2]==="?"||!wu.test(s[2]))&&!wu.test(s[3]),l=/^[a-z]:/i.test(s[0]);if(u)return[...s.slice(0,4),...s.slice(4).map(p=>this.parse(p))];if(l)return[s[0],...s.slice(1).map(p=>this.parse(p))]}return s.map(u=>this.parse(u))});if(this.debug(this.pattern,i),this.set=i.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s<this.set.length;s++){let o=this.set[s];o[0]===""&&o[1]===""&&this.globParts[s][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let n of e)for(let i=0;i<n.length;i++)n[i]==="**"&&(n[i]="*");let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):t>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(t=>{let n=-1;for(;(n=t.indexOf("**",n+1))!==-1;){let i=n;for(;t[i+1]==="**";)i++;i!==n&&t.splice(n,i-n)}return t})}levelOneOptimize(e){return e.map(t=>(t=t.reduce((n,i)=>{let s=n[n.length-1];return i==="**"&&s==="**"?n:i===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(n.pop(),n):(n.push(i),n)},[]),t.length===0?[""]:t))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let i=1;i<e.length-1;i++){let s=e[i];i===1&&s===""&&e[0]===""||(s==="."||s==="")&&(t=!0,e.splice(i,1),i--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(t=!0,e.pop())}let n=0;for(;(n=e.indexOf("..",n+1))!==-1;){let i=e[n-1];i&&i!=="."&&i!==".."&&i!=="**"&&!(this.isWindows&&/^[a-z]:$/i.test(i))&&(t=!0,e.splice(n-1,2),n-=2)}}while(t);return e.length===0?[""]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let n of e){let i=-1;for(;(i=n.indexOf("**",i+1))!==-1;){let o=i;for(;n[o+1]==="**";)o++;o>i&&n.splice(i+1,o-i);let a=n[i+1],u=n[i+2],l=n[i+3];if(a!==".."||!u||u==="."||u===".."||!l||l==="."||l==="..")continue;t=!0,n.splice(i,1);let p=n.slice(0);p[i]="**",e.push(p),i--}if(!this.preserveMultipleSlashes){for(let o=1;o<n.length-1;o++){let a=n[o];o===1&&a===""&&n[0]===""||(a==="."||a==="")&&(t=!0,n.splice(o,1),o--)}n[0]==="."&&n.length===2&&(n[1]==="."||n[1]==="")&&(t=!0,n.pop())}let s=0;for(;(s=n.indexOf("..",s+1))!==-1;){let o=n[s-1];if(o&&o!=="."&&o!==".."&&o!=="**"){t=!0;let u=s===1&&n[s+1]==="**"?["."]:[];n.splice(s-1,2,...u),n.length===0&&n.push(""),s-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let n=t+1;n<e.length;n++){let i=this.partsMatch(e[t],e[n],!this.preserveMultipleSlashes);if(i){e[t]=[],e[n]=i;break}}return e.filter(t=>t.length)}partsMatch(e,t,n=!1){let i=0,s=0,o=[],a="";for(;i<e.length&&s<t.length;)if(e[i]===t[s])o.push(a==="b"?t[s]:e[i]),i++,s++;else if(n&&e[i]==="**"&&t[s]===e[i+1])o.push(e[i]),i++;else if(n&&t[s]==="**"&&e[i]===t[s+1])o.push(t[s]),s++;else if(e[i]==="*"&&t[s]&&(this.options.dot||!t[s].startsWith("."))&&t[s]!=="**"){if(a==="b")return!1;a="a",o.push(e[i]),i++,s++}else if(t[s]==="*"&&e[i]&&(this.options.dot||!e[i].startsWith("."))&&e[i]!=="**"){if(a==="a")return!1;a="b",o.push(t[s]),i++,s++}else return!1;return e.length===t.length&&o}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,n=0;for(let i=0;i<e.length&&e.charAt(i)==="!";i++)t=!t,n++;n&&(this.pattern=e.slice(n)),this.negate=t}matchOne(e,t,n=!1){let i=0,s=0;if(this.isWindows){let a=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),u=!a&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),l=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),p=!l&&t[0]===""&&t[1]===""&&t[2]==="?"&&typeof t[3]=="string"&&/^[a-z]:$/i.test(t[3]),h=u?3:a?0:void 0,f=p?3:l?0:void 0;if(typeof h=="number"&&typeof f=="number"){let[m,g]=[e[h],t[f]];m.toLowerCase()===g.toLowerCase()&&(t[f]=m,s=f,i=h)}}let{optimizationLevel:o=1}=this.options;return o>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(k.GLOBSTAR)?this.#n(e,t,n,i,s):this.#r(e,t,n,i,s)}#n(e,t,n,i,s){let o=t.indexOf(k.GLOBSTAR,s),a=t.lastIndexOf(k.GLOBSTAR),[u,l,p]=n?[t.slice(s,o),t.slice(o+1),[]]:[t.slice(s,o),t.slice(o+1,a),t.slice(a+1)];if(u.length){let C=e.slice(i,i+u.length);if(!this.#r(C,u,n,0,0))return!1;i+=u.length,s+=u.length}let h=0;if(p.length){if(p.length+i>e.length)return!1;let C=e.length-p.length;if(this.#r(e,p,n,C,0))h=p.length;else{if(e[e.length-1]!==""||i+p.length===e.length||(C--,!this.#r(e,p,n,C,0)))return!1;h=p.length+1}}if(!l.length){let C=!!h;for(let D=i;D<e.length-h;D++){let F=String(e[D]);if(C=!0,F==="."||F===".."||!this.options.dot&&F.startsWith("."))return!1}return n||C}let f=[[[],0]],m=f[0],g=0,v=[0];for(let C of l)C===k.GLOBSTAR?(v.push(g),m=[[],0],f.push(m)):(m[0].push(C),g++);let _=f.length-1,T=e.length-h;for(let C of f)C[1]=T-(v[_--]+C[0].length);return!!this.#i(e,f,i,0,n,0,!!h)}#i(e,t,n,i,s,o,a){let u=t[i];if(!u){for(let h=n;h<e.length;h++){a=!0;let f=e[h];if(f==="."||f===".."||!this.options.dot&&f.startsWith("."))return!1}return a}let[l,p]=u;for(;n<=p;){if(this.#r(e.slice(0,n+l.length),l,s,n,0)&&o<this.maxGlobstarRecursion){let m=this.#i(e,t,n+l.length,i+1,s,o+1,a);if(m!==!1)return m}let f=e[n];if(f==="."||f===".."||!this.options.dot&&f.startsWith("."))return!1;n++}return s||null}#r(e,t,n,i,s){let o,a,u,l;for(o=i,a=s,l=e.length,u=t.length;o<l&&a<u;o++,a++){this.debug("matchOne loop");let p=t[a],h=e[o];if(this.debug(t,p,h),p===!1||p===k.GLOBSTAR)return!1;let f;if(typeof p=="string"?(f=h===p,this.debug("string match",p,h,f)):(f=p.test(h),this.debug("pattern match",p,h,f)),!f)return!1}if(o===l&&a===u)return!0;if(o===l)return n;if(a===u)return o===l-1&&e[o]==="";throw new Error("wtf?")}braceExpand(){return(0,k.braceExpand)(this.pattern,this.options)}parse(e){(0,dr.assertValidPattern)(e);let t=this.options;if(e==="**")return k.GLOBSTAR;if(e==="")return"";let n,i=null;(n=e.match(qh))?i=t.dot?Ah:Ih:(n=e.match(Dh))?i=(t.nocase?t.dot?Oh:Rh:t.dot?Th:Ph)(n[1]):(n=e.match(jh))?i=(t.nocase?t.dot?Nh:Lh:t.dot?Uh:Kh)(n):(n=e.match(Fh))?i=t.dot?Mh:xh:(n=e.match(kh))&&(i=Eh);let s=Cu.AST.fromGlob(e,this.options).toMMPattern();return i&&typeof s=="object"&&Reflect.defineProperty(s,"test",{value:i}),s}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,n=t.noglobstar?Wh:t.dot?$h:Bh,i=new Set(t.nocase?["i"]:[]),s=e.map(u=>{let l=u.map(h=>{if(h instanceof RegExp)for(let f of h.flags.split(""))i.add(f);return typeof h=="string"?Qh(h):h===k.GLOBSTAR?k.GLOBSTAR:h._src});l.forEach((h,f)=>{let m=l[f+1],g=l[f-1];h!==k.GLOBSTAR||g===k.GLOBSTAR||(g===void 0?m!==void 0&&m!==k.GLOBSTAR?l[f+1]="(?:\\/|"+n+"\\/)?"+m:l[f]=n:m===void 0?l[f-1]=g+"(?:\\/|\\/"+n+")?":m!==k.GLOBSTAR&&(l[f-1]=g+"(?:\\/|\\/"+n+"\\/)"+m,l[f+1]=k.GLOBSTAR))});let p=l.filter(h=>h!==k.GLOBSTAR);if(this.partial&&p.length>=1){let h=[];for(let f=1;f<=p.length;f++)h.push(p.slice(0,f).join("/"));return"(?:"+h.join("|")+")"}return p.join("/")}).join("|"),[o,a]=e.length>1?["(?:",")"]:["",""];s="^"+o+s+a+"$",this.partial&&(s="^(?:\\/|"+o+s.slice(1,-1)+a+")$"),this.negate&&(s="^(?!"+s+").+$");try{this.regexp=new RegExp(s,[...i].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&t)return!0;let n=this.options;this.isWindows&&(e=e.split("\\").join("/"));let i=this.slashSplit(e);this.debug(this.pattern,"split",i);let s=this.set;this.debug(this.pattern,"set",s);let o=i[i.length-1];if(!o)for(let a=i.length-2;!o&&a>=0;a--)o=i[a];for(let a of s){let u=i;if(n.matchBase&&a.length===1&&(u=[o]),this.matchOne(u,a,t))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(e){return k.minimatch.defaults(e).Minimatch}};k.Minimatch=un;var Zh=oo();Object.defineProperty(k,"AST",{enumerable:!0,get:function(){return Zh.AST}});var Xh=ao();Object.defineProperty(k,"escape",{enumerable:!0,get:function(){return Xh.escape}});var ep=sr();Object.defineProperty(k,"unescape",{enumerable:!0,get:function(){return ep.unescape}});k.minimatch.AST=Cu.AST;k.minimatch.Minimatch=un;k.minimatch.escape=Ch.escape;k.minimatch.unescape=bh.unescape});var uo=M(qt=>{"use strict";var tp=qt&&qt.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),np=qt&&qt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),ip=qt&&qt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&tp(t,e,n[i]);return np(t,e),t}})();Object.defineProperty(qt,"__esModule",{value:!0});qt.matchGlobPattern=op;var rp=ip(co()),sp=I("vscode");function op(r,e){let t;if(typeof r=="string")t=r.replace(/\\/g,"/");else try{let i=sp.Uri.parse(typeof r.baseUri=="string"?r.baseUri:r.baseUri.uri);t=i.with({path:i.path+"/"+r.pattern}).fsPath.replace(/\\/g,"/")}catch{return!1}let n=new rp.Minimatch(t,{noext:!0});return n.makeRe()?n.match(e.fsPath):!1}});var vo=M(Qt=>{"use strict";Object.defineProperty(Qt,"__esModule",{value:!0});Qt.DiagnosticFeature=Qt.DiagnosticPullMode=Qt.vsdiag=void 0;var re=I("vscode"),ie=N(),ap=ne(),cp=uo(),lo=B();function fr(r,e){return r[e]===void 0&&(r[e]={}),r[e]}var Be;(function(r){let e;(function(t){t.full="full",t.unChanged="unChanged"})(e=r.DocumentDiagnosticReportKind||(r.DocumentDiagnosticReportKind={}))})(Be||(Qt.vsdiag=Be={}));var ai;(function(r){r.onType="onType",r.onSave="onSave",r.onFocus="onFocus"})(ai||(Qt.DiagnosticPullMode=ai={}));var Ce;(function(r){r.active="open",r.reschedule="reschedule",r.outDated="drop"})(Ce||(Ce={}));var ge;(function(r){r[r.document=1]="document",r[r.workspace=2]="workspace"})(ge||(ge={}));var It;(function(r){function e(t){return t instanceof re.Uri?t.toString():t.uri.toString()}r.asKey=e})(It||(It={}));var fo=class{documentPullStates;workspacePullStates;constructor(){this.documentPullStates=new Map,this.workspacePullStates=new Map}track(e,t,n){let i=e===ge.document?this.documentPullStates:this.workspacePullStates,[s,o,a]=t instanceof re.Uri?[t.toString(),t,n]:[t.uri.toString(),t.uri,t.version],u=i.get(s);return u===void 0&&(u={document:o,pulledVersion:a,resultId:void 0},i.set(s,u)),u}update(e,t,n,i){let s=e===ge.document?this.documentPullStates:this.workspacePullStates,[o,a,u,l]=t instanceof re.Uri?[t.toString(),t,n,i]:[t.uri.toString(),t.uri,t.version,n],p=s.get(o);p===void 0?(p={document:a,pulledVersion:u,resultId:l},s.set(o,p)):(p.pulledVersion=u,p.resultId=l)}unTrack(e,t){let n=It.asKey(t);(e===ge.document?this.documentPullStates:this.workspacePullStates).delete(n)}tracks(e,t){let n=It.asKey(t);return(e===ge.document?this.documentPullStates:this.workspacePullStates).has(n)}tracksSameVersion(e,t){let n=t.uri.toString(),s=(e===ge.document?this.documentPullStates:this.workspacePullStates).get(n);return s!==void 0&&s.pulledVersion===t.version}getResultId(e,t){let n=It.asKey(t);return(e===ge.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}},ho=class{isDisposed;client;visibleDocuments;options;onDidChangeDiagnosticsEmitter;provider;diagnostics;openRequests;documentStates;workspaceErrorCounter;workspaceCancellation;workspaceTimeout;constructor(e,t,n){this.client=e,this.visibleDocuments=t,this.options=n,this.isDisposed=!1,this.onDidChangeDiagnosticsEmitter=new re.EventEmitter,this.provider=this.createProvider(),this.diagnostics=re.languages.createDiagnosticCollection(n.identifier),this.openRequests=new Map,this.documentStates=new fo,this.workspaceErrorCounter=0}knows(e,t){let n=t instanceof re.Uri?t:t.uri;return this.documentStates.tracks(e,t)||this.openRequests.has(n.toString())}knowsSameVersion(e,t){let n=this.openRequests.get(t.uri.toString());return n===void 0?this.documentStates.tracksSameVersion(e,t):n.state===Ce.reschedule?!0:n.state===Ce.outDated?!1:n.version===t.version}forget(e,t){this.documentStates.unTrack(e,t)}pull(e,t){if(this.isDisposed)return;let n=e instanceof re.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 re.Uri,i=n?e:e.uri,s=i.toString();t=n?t:e.version;let o=this.openRequests.get(s),a=n?this.documentStates.track(ge.document,e,t):this.documentStates.track(ge.document,e);if(o===void 0){let u=new re.CancellationTokenSource;this.openRequests.set(s,{state:Ce.active,document:e,version:t,tokenSource:u});let l,p;try{l=await this.provider.provideDiagnostics(e,a.resultId,u.token)??{kind:Be.DocumentDiagnosticReportKind.full,items:[]}}catch(h){if(h instanceof lo.LSPCancellationError&&ie.DiagnosticServerCancellationData.is(h.data)&&h.data.retriggerRequest===!1&&(p={state:Ce.outDated,document:e}),p===void 0&&h instanceof re.CancellationError)p={state:Ce.reschedule,document:e};else throw h}if(p=p??this.openRequests.get(s),p===void 0){this.client.error(`Lost request state in diagnostic pull model. Clearing diagnostics for ${s}`),this.diagnostics.delete(i);return}if(this.openRequests.delete(s),!this.visibleDocuments.isVisible(e)){this.documentStates.unTrack(ge.document,e);return}if(p.state===Ce.outDated)return;l!==void 0&&(l.kind===Be.DocumentDiagnosticReportKind.full&&this.diagnostics.set(i,l.items),a.pulledVersion=t,a.resultId=l.resultId),p.state===Ce.reschedule&&this.pull(e)}else o.state===Ce.active?(o.tokenSource.cancel(),this.openRequests.set(s,{state:Ce.reschedule,document:o.document})):o.state===Ce.outDated&&this.openRequests.set(s,{state:Ce.reschedule,document:o.document})}forgetDocument(e){if(this.isDisposed)return;let t=e instanceof re.Uri?e:e.uri,n=t.toString(),i=this.openRequests.get(n);this.options.workspaceDiagnostics&&t.scheme!=="untitled"?(i!==void 0?this.openRequests.set(n,{state:Ce.reschedule,document:e}):this.pull(e,()=>{this.forget(ge.document,e)}),this.forget(ge.workspace,e)):(i!==void 0&&(i.state===Ce.active&&i.tokenSource.cancel(),this.openRequests.set(n,{state:Ce.outDated,document:e})),this.diagnostics.delete(t),this.forget(ge.document,e))}pullWorkspace(){this.isDisposed||this.pullWorkspaceAsync().then(()=>{this.workspaceTimeout=(0,ie.RAL)().timer.setTimeout(()=>{this.pullWorkspace()},2e3)},e=>{!(e instanceof lo.LSPCancellationError)&&!ie.DiagnosticServerCancellationData.is(e.data)&&(this.client.error("Workspace diagnostic pull failed.",e,!1),this.workspaceErrorCounter++),this.workspaceErrorCounter<=5&&(this.workspaceTimeout=(0,ie.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 re.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===Be.DocumentDiagnosticReportKind.full&&(this.documentStates.tracks(ge.document,n.uri)||this.diagnostics.set(n.uri,n.items)),this.documentStates.update(ge.workspace,n.uri,n.version??void 0,n.resultId)})}createProvider(){let e={onDidChangeDiagnostics:this.onDidChangeDiagnosticsEmitter.event,provideDiagnostics:(t,n,i)=>{let s=(a,u,l)=>{let p={identifier:this.options.identifier,textDocument:{uri:this.client.code2ProtocolConverter.asUri(a instanceof re.Uri?a:a.uri)},previousResultId:u};return this.isDisposed===!0||!this.client.isRunning()?{kind:Be.DocumentDiagnosticReportKind.full,items:[]}:this.client.sendRequest(ie.DocumentDiagnosticRequest.type,p,l).then(async h=>h==null||this.isDisposed||l.isCancellationRequested?{kind:Be.DocumentDiagnosticReportKind.full,items:[]}:h.kind===ie.DocumentDiagnosticReportKind.Full?{kind:Be.DocumentDiagnosticReportKind.full,resultId:h.resultId,items:await this.client.protocol2CodeConverter.asDiagnostics(h.items,l)}:{kind:Be.DocumentDiagnosticReportKind.unChanged,resultId:h.resultId},h=>this.client.handleFailedRequest(ie.DocumentDiagnosticRequest.type,l,h,{kind:Be.DocumentDiagnosticReportKind.full,items:[]},!0,!0))},o=this.client.middleware;return o.provideDiagnostics?o.provideDiagnostics(t,n,i,s):s(t,n,i)}};return this.options.workspaceDiagnostics&&(e.provideWorkspaceDiagnostics=(t,n,i)=>{let s=async l=>l.kind===ie.DocumentDiagnosticReportKind.Full?{kind:Be.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:Be.DocumentDiagnosticReportKind.unChanged,uri:this.client.protocol2CodeConverter.asUri(l.uri),resultId:l.resultId,version:l.version},o=l=>{let p=[];for(let h of l)p.push({uri:this.client.code2ProtocolConverter.asUri(h.uri),value:h.value});return p},a=(l,p,h)=>{let f=(0,ap.generateUuid)(),m=this.client.onProgress(ie.WorkspaceDiagnosticRequest.partialResult,f,async v=>{if(v==null){h(null);return}let _={items:[]};for(let T of v.items)try{_.items.push(await s(T))}catch(C){this.client.error("Converting workspace diagnostics failed.",C)}h(_)}),g={identifier:this.options.identifier,previousResultIds:o(l),partialResultToken:f};return this.isDisposed===!0||!this.client.isRunning()?{items:[]}:this.client.sendRequest(ie.WorkspaceDiagnosticRequest.type,g,p).then(async v=>{if(p.isCancellationRequested)return{items:[]};let _={items:[]};for(let T of v.items)_.items.push(await s(T));return m.dispose(),h(_),{items:[]}},v=>(m.dispose(),this.client.handleFailedRequest(ie.DocumentDiagnosticRequest.type,p,v,{items:[]})))},u=this.client.middleware;return u.provideWorkspaceDiagnostics?u.provideWorkspaceDiagnostics(t,n,i,a):a(t,n,i)}),e}dispose(){this.isDisposed=!0,this.workspaceCancellation?.cancel(),this.workspaceTimeout?.dispose();for(let[e,t]of this.openRequests)t.state===Ce.active&&t.tokenSource.cancel(),this.openRequests.set(e,{state:Ce.outDated,document:t.document});this.diagnostics.dispose()}},po=class{client;diagnosticRequestor;lastDocumentToPull;documents;timeoutHandle;isDisposed;constructor(e,t){this.client=e,this.diagnosticRequestor=t,this.documents=new ie.LinkedMap,this.isDisposed=!1}add(e){if(this.isDisposed===!0)return;let t=It.asKey(e);this.documents.has(t)||(this.documents.set(t,e,ie.Touch.Last),this.lastDocumentToPull=e)}remove(e){let t=It.asKey(e);if(this.documents.delete(t),this.documents.size===0){this.stop();return}else if(t===this.lastDocumentToPullKey()){let n=this.documents.before(t);n===void 0?this.stop():this.lastDocumentToPull=n}}trigger(){this.lastDocumentToPull=this.documents.last,this.runLoop()}runLoop(){if(this.isDisposed!==!0){if(this.documents.size===0){this.stop();return}this.lastDocumentToPull!==void 0&&this.timeoutHandle===void 0&&(this.timeoutHandle=(0,ie.RAL)().timer.setTimeout(()=>{let e=this.documents.first;if(e===void 0)return;let t=It.asKey(e);this.diagnosticRequestor.pullAsync(e).catch(n=>{this.client.error(`Document pull failed for text document ${t}`,n,!1)}).finally(()=>{this.timeoutHandle=void 0,this.documents.set(t,e,ie.Touch.Last),t!==this.lastDocumentToPullKey()&&this.runLoop()})},500))}}dispose(){this.isDisposed=!0,this.stop(),this.documents.clear(),this.lastDocumentToPull=void 0}stop(){this.timeoutHandle?.dispose(),this.timeoutHandle=void 0,this.lastDocumentToPull=void 0}lastDocumentToPullKey(){return this.lastDocumentToPull!==void 0?It.asKey(this.lastDocumentToPull):void 0}},go=class{disposable;diagnosticRequestor;activeTextDocument;backgroundScheduler;constructor(e,t,n){let i=Object.assign({onChange:!1,onSave:!1,onFocus:!1},e.clientOptions.diagnosticPullOptions),s=e.protocol2CodeConverter.asDocumentSelector(n.documentSelector),o=[],a=(C,D)=>!(typeof C=="string"||C.language!==void 0&&C.language!=="*"||C.scheme!==void 0&&C.scheme!=="*"&&C.scheme!==D.scheme||C.pattern!==void 0&&!(0,cp.matchGlobPattern)(C.pattern,D)),u=C=>{let D=n.documentSelector;if(i.match!==void 0)return i.match(D,C);for(let F of D)if(ie.TextDocumentFilter.is(F)&&a(F,C))return!0;return!1},l=C=>C instanceof re.Uri?u(C):re.languages.match(s,C)>0&&t.isVisible(C),p=C=>re.languages.match(s,C.document)>0&&t.isVisible(C.notebook.uri),h=C=>C instanceof re.Uri?this.activeTextDocument?.uri.toString()===C.toString():this.activeTextDocument===C;this.diagnosticRequestor=new ho(e,t,n),this.backgroundScheduler=new po(e,this.diagnosticRequestor);let f=C=>{!l(C)||!n.interFileDependencies||h(C)||i.onChange===!1||this.backgroundScheduler.add(C)},m=(C,D)=>(i.filter===void 0||!i.filter(C,D))&&this.diagnosticRequestor.knows(ge.document,C);this.activeTextDocument=re.window.activeTextEditor?.document,o.push(re.window.onDidChangeActiveTextEditor(C=>{let D=this.activeTextDocument;this.activeTextDocument=C?.document,D!==void 0&&f(D),this.activeTextDocument!==void 0&&(this.backgroundScheduler.remove(this.activeTextDocument),i.onFocus===!0&&l(this.activeTextDocument)&&m(this.activeTextDocument,ai.onFocus)&&this.diagnosticRequestor.pull(this.activeTextDocument))}));let g=e.getFeature(ie.DidOpenTextDocumentNotification.method);o.push(g.onNotificationSent(C=>{let D=C.textDocument;this.diagnosticRequestor.knowsSameVersion(ge.document,D)||l(D)&&this.diagnosticRequestor.pull(D,()=>{f(D)})}));let v=e.getFeature(ie.NotebookDocumentSyncRegistrationType.method);o.push(v.onOpenNotificationSent(C=>{for(let D of C.getCells())p(D)&&this.diagnosticRequestor.pull(D.document,()=>{f(D.document)})})),o.push(t.onOpen(C=>{for(let D of C){if(this.diagnosticRequestor.knows(ge.document,D))continue;let F=D.toString(),E;for(let Q of re.workspace.textDocuments)if(F===Q.uri.toString()){E=Q;break}E!==void 0&&l(E)&&this.diagnosticRequestor.pull(E,()=>{f(E)})}}));let _=new Set;for(let C of re.workspace.textDocuments)l(C)&&(this.diagnosticRequestor.pull(C,()=>{f(C)}),_.add(C.uri.toString()));for(let C of re.workspace.notebookDocuments)for(let D of C.getCells())p(D)&&(this.diagnosticRequestor.pull(D.document,()=>{f(D.document)}),_.add(D.document.uri.toString()));if(i.onTabs===!0)for(let C of t.getResources())!_.has(C.toString())&&l(C)&&this.diagnosticRequestor.pull(C,()=>{f(C)});if(i.onChange===!0){let C=e.getFeature(ie.DidChangeTextDocumentNotification.method);o.push(C.onNotificationSent(async D=>{let F=D.textDocument;m(F,ai.onType)&&this.diagnosticRequestor.pull(F,()=>{this.backgroundScheduler.trigger()})})),o.push(v.onChangeNotificationSent(async D=>{let E=(D.cells?.textContent||[]).map(xe=>D.notebook.getCells().find(Un=>Un.document.uri.toString()===xe.document.uri.toString()));for(let xe of E)xe&&p(xe)&&this.diagnosticRequestor.pull(xe.document,()=>{this.backgroundScheduler.trigger()});let Q=D.cells?.structure?.didClose||[];for(let xe of Q)this.diagnosticRequestor.forgetDocument(xe.document);let we=D.cells?.structure?.didOpen||[];for(let xe of we)p(xe)&&this.diagnosticRequestor.pull(xe.document,()=>{this.backgroundScheduler.trigger()})}))}if(i.onSave===!0){let C=e.getFeature(ie.DidSaveTextDocumentNotification.method);o.push(C.onNotificationSent(D=>{let F=D.textDocument;m(F,ai.onSave)&&this.diagnosticRequestor.pull(D.textDocument)})),o.push(v.onSaveNotificationSent(D=>{for(let F of D.getCells())p(F)&&this.diagnosticRequestor.pull(F.document)}))}let T=e.getFeature(ie.DidCloseTextDocumentNotification.method);o.push(T.onNotificationSent(C=>{this.cleanUpDocument(C.textDocument)})),o.push(v.onCloseNotificationSent(C=>{for(let D of C.getCells())this.cleanUpDocument(D.document)})),o.push(t.onClose(C=>{for(let D of C)this.cleanUpDocument(D)})),this.diagnosticRequestor.onDidChangeDiagnosticsEmitter.event(()=>{for(let C of re.workspace.textDocuments)l(C)&&this.diagnosticRequestor.pull(C)}),n.workspaceDiagnostics===!0&&n.identifier!=="da348dc5-c30a-4515-9d98-31ff3be38d14"&&this.diagnosticRequestor.pullWorkspace(),this.disposable=re.Disposable.from(...o,this.backgroundScheduler,this.diagnosticRequestor)}get onDidChangeDiagnosticsEmitter(){return this.diagnosticRequestor.onDidChangeDiagnosticsEmitter}get diagnostics(){return this.diagnosticRequestor.provider}forget(e){this.cleanUpDocument(e)}cleanUpDocument(e){this.backgroundScheduler.remove(e),this.diagnosticRequestor.knows(ge.document,e)&&this.diagnosticRequestor.forgetDocument(e)}},mo=class extends lo.TextDocumentLanguageFeature{constructor(e){super(e,ie.DocumentDiagnosticRequest.type)}fillClientCapabilities(e){let t=fr(fr(e,"textDocument"),"diagnostic");t.relatedInformation=!0,t.tagSupport={valueSet:[ie.DiagnosticTag.Unnecessary,ie.DiagnosticTag.Deprecated]},t.codeDescriptionSupport=!0,t.dataSupport=!0,t.dynamicRegistration=!0,t.relatedDocumentSupport=!1,t.markupMessageSupport=!1,fr(fr(e,"workspace"),"diagnostics").refreshSupport=!0}initialize(e,t){this._client.onRequest(ie.DiagnosticRefreshRequest.type,async()=>{for(let o of this.getAllProviders())o.onDidChangeDiagnosticsEmitter.fire()});let[i,s]=this.getRegistration(t,e.diagnosticProvider);!i||!s||this.register({id:i,registerOptions:s})}clear(){super.clear()}refresh(){for(let e of this.getAllProviders())e.onDidChangeDiagnosticsEmitter.fire()}registerLanguageProvider(e){let t=new go(this._client,this._client.visibleDocuments,e);return[t.disposable,t]}};Qt.DiagnosticFeature=mo});var Ru=M(rt=>{"use strict";var up=rt&&rt.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),lp=rt&&rt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),mr=rt&&rt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&up(t,e,n[i]);return lp(t,e),t}})();Object.defineProperty(rt,"__esModule",{value:!0});rt.NotebookDocumentSyncFeature=void 0;var se=mr(I("vscode")),At=mr(N()),dp=mr(ne()),Pu=mr(He()),fp=uo();function Tu(r,e){return r[e]===void 0&&(r[e]={}),r[e]}var Rn;(function(r){let e;(function(t){function n(f,m){return{version:f.version,uri:m.asUri(f.uri)}}t.asVersionedNotebookDocumentIdentifier=n;function i(f,m,g){let v=At.NotebookDocument.create(g.asUri(f.uri),f.notebookType,f.version,s(m,g));return Object.keys(f.metadata).length>0&&(v.metadata=o(f.metadata)),v}t.asNotebookDocument=i;function s(f,m){return f.map(g=>a(g,m))}t.asNotebookCells=s;function o(f){return l(new Set,f)}t.asMetadata=o;function a(f,m){let g=At.NotebookCell.create(u(f.kind),m.asUri(f.document.uri));return Object.keys(f.metadata).length>0&&(g.metadata=o(f.metadata)),f.executionSummary!==void 0&&Pu.number(f.executionSummary.executionOrder)&&Pu.boolean(f.executionSummary.success)&&(g.executionSummary={executionOrder:f.executionSummary.executionOrder,success:f.executionSummary.success}),g}t.asNotebookCell=a;function u(f){switch(f){case se.NotebookCellKind.Markup:return At.NotebookCellKind.Markup;case se.NotebookCellKind.Code:return At.NotebookCellKind.Code}}function l(f,m){if(f.has(m))throw new Error("Can't deep copy cyclic structures.");if(Array.isArray(m)){let g=[];for(let v of m)if(v!==null&&typeof v=="object"||Array.isArray(v))g.push(l(f,v));else{if(v instanceof RegExp)throw new Error("Can't transfer regular expressions to the server");g.push(v)}return g}else{let g=Object.keys(m),v=Object.create(null);for(let _ of g){let T=m[_];if(T!==null&&typeof T=="object"||Array.isArray(T))v[_]=l(f,T);else{if(T instanceof RegExp)throw new Error("Can't transfer regular expressions to the server");v[_]=T}}return v}}function p(f,m){let g=m.asChangeTextDocumentParams(f,f.document.uri,f.document.version);return{document:g.textDocument,changes:g.contentChanges}}t.asTextContentChange=p;function h(f,m){let g=Object.create(null);if(f.metadata&&(g.metadata=r.c2p.asMetadata(f.metadata)),f.cells!==void 0){let v=Object.create(null),_=f.cells;_.structure&&(v.structure={array:{start:_.structure.array.start,deleteCount:_.structure.array.deleteCount,cells:_.structure.array.cells!==void 0?_.structure.array.cells.map(T=>r.c2p.asNotebookCell(T,m)):void 0},didOpen:_.structure.didOpen!==void 0?_.structure.didOpen.map(T=>m.asOpenTextDocumentParams(T.document).textDocument):void 0,didClose:_.structure.didClose!==void 0?_.structure.didClose.map(T=>m.asCloseTextDocumentParams(T.document).textDocument):void 0}),_.data!==void 0&&(v.data=_.data.map(T=>r.c2p.asNotebookCell(T,m))),_.textContent!==void 0&&(v.textContent=_.textContent.map(T=>r.c2p.asTextContentChange(T,m))),Object.keys(v).length>0&&(g.cells=v)}return g}t.asNotebookDocumentChangeEvent=h})(e=r.c2p||(r.c2p={}))})(Rn||(Rn={}));var yo;(function(r){function e(a,u,l){let p=a.length,h=u.length,f=0;for(;f<h&&f<p&&t(a[f],u[f],l);)f++;if(f<h&&f<p){let m=p-1,g=h-1;for(;m>=0&&g>=0&&t(a[m],u[g],l);)m--,g--;let v=m+1-f,_=f===g+1?void 0:u.slice(f,g+1);return _!==void 0?{start:f,deleteCount:v,cells:_}:{start:f,deleteCount:v}}else return f<h?{start:f,deleteCount:0,cells:u.slice(f)}:f<p?{start:f,deleteCount:p-f}:void 0}r.computeDiff=e;function t(a,u,l=!0){return a.kind!==u.kind||a.document.uri.toString()!==u.document.uri.toString()||a.document.languageId!==u.document.languageId||!n(a.executionSummary,u.executionSummary)?!1:!l||l&&s(a.metadata,u.metadata)}function n(a,u){return a===u?!0:a===void 0||u===void 0?!1:a.executionOrder===u.executionOrder&&a.success===u.success&&i(a.timing,u.timing)}function i(a,u){return a===u?!0:a===void 0||u===void 0?!1:a.startTime===u.startTime&&a.endTime===u.endTime}function s(a,u){if(a===u)return!0;if(a==null||u===null||u===void 0||typeof a!=typeof u||typeof a!="object")return!1;let l=Array.isArray(a),p=Array.isArray(u);if(l!==p)return!1;if(l&&p){if(a.length!==u.length)return!1;for(let h=0;h<a.length;h++)if(!s(a[h],u[h]))return!1}if(o(a)&&o(u)){let h=Object.keys(a),f=Object.keys(u);if(h.length!==f.length||(h.sort(),f.sort(),!s(h,f)))return!1;for(let m=0;m<h.length;m++){let g=h[m];if(!s(a[g],u[g]))return!1}return!0}return!1}function o(a){return a!==null&&typeof a=="object"}r.isObjectLiteral=o})(yo||(yo={}));var hr;(function(r){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;return!(t.scheme!==void 0&&t.scheme!=="*"&&i.scheme!==t.scheme||t.pattern!==void 0&&!(0,fp.matchGlobPattern)(t.pattern,i))}r.matchNotebook=e})(hr||(hr={}));var pr;(function(r){function e(n){let i=n.notebookSelector,s=[];for(let o of i){let a=(typeof o.notebook=="string"?o.notebook:o.notebook?.notebookType)??"*",u=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)s.push(t(a,u,l,p.language));else s.push(t(a,u,l,void 0))}return s}r.asDocumentSelector=e;function t(n,i,s,o){return i===void 0&&s===void 0?{notebook:n,language:o}:{notebook:{notebookType:n,scheme:i,pattern:s},language:o}}})(pr||(pr={}));var gr;(function(r){function e(t){return{cells:t,uris:new Set(t.map(n=>n.document.uri.toString()))}}r.create=e})(gr||(gr={}));var On=class{client;options;notebookSyncInfo;notebookDidOpen;disposables;selector;onChangeNotificationSent;onOpenNotificationSent;onCloseNotificationSent;onSaveNotificationSent;constructor(e,t,n,i,s,o){this.client=e,this.options=t,this.notebookSyncInfo=new Map,this.notebookDidOpen=new Set,this.disposables=[],this.selector=e.protocol2CodeConverter.asDocumentSelector(pr.asDocumentSelector(t)),this.onChangeNotificationSent=n,this.onOpenNotificationSent=i,this.onCloseNotificationSent=s,this.onSaveNotificationSent=o,se.workspace.onDidOpenNotebookDocument(a=>{this.notebookDidOpen.add(a.uri.toString()),this.didOpen(a)},void 0,this.disposables);for(let a of se.workspace.notebookDocuments)this.notebookDidOpen.add(a.uri.toString()),this.didOpen(a);se.workspace.onDidChangeNotebookDocument(a=>this.didChangeNotebookDocument(a),void 0,this.disposables),this.options.save===!0&&se.workspace.onDidSaveNotebookDocument(a=>this.didSave(a),void 0,this.disposables),se.workspace.onDidCloseNotebookDocument(a=>{this.didClose(a),this.notebookDidOpen.delete(a.uri.toString())},void 0,this.disposables)}getState(){for(let e of se.workspace.notebookDocuments)if(this.getMatchingCellsConsideringSyncInfo(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){if(se.languages.match(this.selector,e)>0)return!0;let t=e.uri.toString();for(let n of this.notebookSyncInfo.values())if(n.uris.has(t))return!0;return!1}didOpenNotebookCellTextDocument(e,t){if(se.languages.match(this.selector,t.document)===0||!this.notebookDidOpen.has(e.uri.toString()))return;let n=this.getSyncInfo(e),i=this.cellMatches(e,t);if(n!==void 0){let s=n.uris.has(t.document.uri.toString());if(i&&s||!i&&!s)return;if(i){let o=this.mergeCells(e,n,[t]);if(o!==void 0){let a=this.asNotebookDocumentChangeEvent(e,void 0,n,o);a!==void 0&&this.doSendChange(a,o).catch(()=>{})}}}else i&&this.doSendOpen(e,[t]).catch(()=>{})}didChangeNotebookCellTextDocument(e,t,n){if(se.languages.match(this.selector,n.document)===0)return;let i=this.getSyncInfo(e);i===void 0||!i.uris.has(t.document.uri.toString())||this.doSendChange({notebook:e,cells:{textContent:[n]}},i.cells).catch(()=>{})}didCloseNotebookCellTextDocument(e,t){let n=this.getSyncInfo(e);if(n===void 0)return;let i=t.document.uri,s=n.cells.findIndex(o=>o.document.uri.toString()===i.toString());if(s!==-1)if(s===0&&n.cells.length===1)this.doSendClose(e,n.cells).catch(()=>{});else{let o=n.cells.slice(),a=o.splice(s,1);this.doSendChange({notebook:e,cells:{structure:{array:{start:s,deleteCount:1},didClose:a}}},o).catch(()=>{})}}dispose(){for(let e of this.disposables)e.dispose()}didOpen(e,t,n=this.getSyncInfo(e)){if(n!==void 0)if(t===void 0&&(t=n.cells.slice()),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=this.getMatchingCells(e),t===void 0)return;this.doSendOpen(e,t).catch(()=>{})}}didChangeNotebookDocument(e){let t=e.notebook,n=this.getSyncInfo(t);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.getMatchingCellsFromEvent(t,n,e);if(i===void 0){this.didClose(t,n);return}let s=this.asNotebookDocumentChangeEvent(e.notebook,e,n,i);s!==void 0&&this.doSendChange(s,i).catch(()=>{})}}didSave(e){this.getSyncInfo(e)!==void 0&&this.doSendSave(e).catch(()=>{})}didClose(e,t=this.getSyncInfo(e)){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){if(this.getSyncInfo(e)!==void 0)throw new Error(`Notebook document ${e.uri.toString()} is already open`);let n=this.getMatchingCells(e);if(n!==void 0)return this.doSendOpen(e,n)}async doSendOpen(e,t){let n=async(s,o)=>{let a=o.map(u=>this.client.code2ProtocolConverter.asTextDocumentItem(u.document));try{await this.client.sendNotification(At.DidOpenNotebookDocumentNotification.type,{notebookDocument:Rn.c2p.asNotebookDocument(s,o,this.client.code2ProtocolConverter),cellTextDocuments:a}),this.onOpenNotificationSent.fire(s)}catch(u){throw this.client.error("Sending DidOpenNotebookDocumentNotification failed",u),u}},i=this.client.middleware?.notebooks;return this.notebookSyncInfo.set(e.uri.toString(),gr.create(t)),i?.didOpen!==void 0?i.didOpen(e,t,n):n(e,t)}async sendDidChangeNotebookDocument(e){let t=this.getMatchingCellsFromSyncInfo(e.notebook);if(t===void 0)throw new Error(`Received changed event for un-synced notebook ${e.notebook.uri.toString()}`);return this.doSendChange(e,t)}async doSendChange(e,t){let n=async s=>{try{await this.client.sendNotification(At.DidChangeNotebookDocumentNotification.type,{notebookDocument:Rn.c2p.asVersionedNotebookDocumentIdentifier(s.notebook,this.client.code2ProtocolConverter),change:Rn.c2p.asNotebookDocumentChangeEvent(s,this.client.code2ProtocolConverter)}),this.onChangeNotificationSent.fire(s)}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(),gr.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(At.DidSaveNotebookDocumentNotification.type,{notebookDocument:{uri:this.client.code2ProtocolConverter.asUri(i.uri)}}),this.onSaveNotificationSent.fire(i)}catch(s){throw this.client.error("Sending DidSaveNotebookDocumentNotification failed",s),s}},n=this.client.middleware?.notebooks;return n?.didSave!==void 0?n.didSave(e,t):t(e)}async sendDidCloseNotebookDocument(e){let t=this.getMatchingCellsFromSyncInfo(e);if(t===void 0)throw new Error(`Received close event for un-synced notebook ${e.uri.toString()}`);return this.doSendClose(e,t)}async doSendClose(e,t){let n=async(s,o)=>{try{await this.client.sendNotification(At.DidCloseNotebookDocumentNotification.type,{notebookDocument:{uri:this.client.code2ProtocolConverter.asUri(s.uri)},cellTextDocuments:o.map(a=>this.client.code2ProtocolConverter.asTextDocumentIdentifier(a.document))}),this.onCloseNotificationSent.fire(s)}catch(a){throw this.client.error("Sending DidCloseNotebookDocumentNotification failed",a),a}},i=this.client.middleware?.notebooks;return this.notebookSyncInfo.delete(e.uri.toString()),i?.didClose!==void 0?i.didClose(e,t,n):n(e,t)}getSynchronizedCells(e){return this.getSyncInfo(e)?.cells}asNotebookDocumentChangeEvent(e,t,n,i){if(t!==void 0&&t.notebook!==e)throw new Error("Notebook must be identical");let s={notebook:e};t?.metadata!==void 0&&(s.metadata=Rn.c2p.asMetadata(t.metadata));let o;if(t?.cellChanges!==void 0&&t.cellChanges.length>0){let a=[];o=new Set(i.map(u=>u.document.uri.toString()));for(let u of t.cellChanges)o.has(u.cell.document.uri.toString())&&(u.executionSummary!==void 0||u.metadata!==void 0)&&a.push(u.cell);a.length>0&&(s.cells=s.cells??{},s.cells.data=a)}if((t?.contentChanges!==void 0&&t.contentChanges.length>0||t===void 0)&&n!==void 0&&i!==void 0){let a=n.cells,u=i,l=yo.computeDiff(a,u,!1),p,h;if(l!==void 0){p=l.cells===void 0?new Map:new Map(l.cells.map(g=>[g.document.uri.toString(),g])),h=l.deleteCount===0?new Map:new Map(a.slice(l.start,l.start+l.deleteCount).map(g=>[g.document.uri.toString(),g]));for(let g of Array.from(h.keys()))p.has(g)&&(h.delete(g),p.delete(g));s.cells=s.cells??{};let f=[],m=[];if(p.size>0||h.size>0){for(let g of p.values())f.push(g);for(let g of h.values())m.push(g)}s.cells.structure={array:l,didOpen:f,didClose:m}}}return Object.keys(s).length>1?s: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||hr.matchNotebook(n.notebook,e)){let i=this.filterCells(e,t,n.cells);return i.length===0?void 0:i}}}getMatchingCellsFromEvent(e,t,n){if(this.options.notebookSelector===void 0)return;let i;for(let u of this.options.notebookSelector)if(u.notebook===void 0||hr.matchNotebook(u.notebook,e)){i=u;break}if(i===void 0)return;if((n.cellChanges===void 0||n.cellChanges.length===0)&&(n.contentChanges===void 0||n.contentChanges.length===0))return t.cells;let s;if(n.cellChanges!==void 0&&n.cellChanges.length>0){let u=n.cellChanges.map(p=>p.cell),l=this.filterCells(e,u,i.cells);if(l.length!==u.length){s=new Set(t.uris);for(let p of u)s.delete(p.document.uri.toString());for(let p of l)s.add(p.document.uri.toString())}}if(n.contentChanges!==void 0&&n.contentChanges.length>0){s===void 0&&(s=new Set(t.uris));for(let u of n.contentChanges){for(let p of u.removedCells)s.delete(p.document.uri.toString());let l=this.filterCells(e,new Array(...u.addedCells),i.cells);for(let p of l)s.add(p.document.uri.toString())}}if(s===void 0)return t.cells;let o=[],a=e.getCells();for(let u of a)s.has(u.document.uri.toString())&&o.push(u);return o}getMatchingCellsFromSyncInfo(e){let t=this.getSyncInfo(e);return t!==void 0?t.cells:void 0}getMatchingCellsConsideringSyncInfo(e){let t=this.getSyncInfo(e);return t!==void 0?t.cells:this.getMatchingCells(e)}mergeCells(e,t,n){let i=[],s=new Set(t.uris);for(let o of n)s.add(o.document.uri.toString());for(let o of e.getCells())s.has(o.document.uri.toString())&&i.push(o);return 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(s=>{let o=s.document.languageId;return n.some((a=>a.language==="*"||o===a.language))}):t;return typeof this.client.clientOptions.notebookDocumentOptions?.filterCells=="function"?this.client.clientOptions.notebookDocumentOptions.filterCells(e,i):i}getSyncInfo(e){return this.notebookSyncInfo.get(e.uri.toString())}},_o=class r{static CellScheme="vscode-notebook-cell";client;registrations;dedicatedChannel;_onChangeNotificationSent;_onOpenNotificationSent;_onCloseNotificationSent;_onSaveNotificationSent;constructor(e){this.client=e,this.registrations=new Map,this.registrationType=At.NotebookDocumentSyncRegistrationType.type,this._onChangeNotificationSent=new se.EventEmitter,this._onOpenNotificationSent=new se.EventEmitter,this._onCloseNotificationSent=new se.EventEmitter,this._onSaveNotificationSent=new se.EventEmitter,se.workspace.onDidOpenTextDocument(t=>{if(t.uri.scheme!==r.CellScheme)return;let[n,i]=this.findNotebookDocumentAndCell(t);if(!(n===void 0||i===void 0))for(let s of this.registrations.values())s instanceof On&&s.didOpenNotebookCellTextDocument(n,i)}),se.workspace.onDidChangeTextDocument(t=>{if(t.contentChanges.length===0)return;let n=t.document;if(n.uri.scheme!==r.CellScheme)return;let[i,s]=this.findNotebookDocumentAndCell(n);if(!(i===void 0||s===void 0))for(let o of this.registrations.values())o instanceof On&&o.didChangeNotebookCellTextDocument(i,s,t)}),se.workspace.onDidCloseTextDocument(t=>{if(t.uri.scheme!==r.CellScheme)return;let[n,i]=this.findNotebookDocumentAndCell(t);if(!(n===void 0||i===void 0))for(let s of this.registrations.values())s instanceof On&&s.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}}registrationType;get onOpenNotificationSent(){return this._onOpenNotificationSent.event}get onChangeNotificationSent(){return this._onChangeNotificationSent.event}get onCloseNotificationSent(){return this._onCloseNotificationSent.event}get onSaveNotificationSent(){return this._onSaveNotificationSent.event}fillClientCapabilities(e){let t=Tu(Tu(e,"notebookDocument"),"synchronization");t.dynamicRegistration=!0,t.executionSummarySupport=!0}preInitialize(e){let t=e.notebookDocumentSync;t!==void 0&&(this.dedicatedChannel=this.client.protocol2CodeConverter.asDocumentSelector(pr.asDocumentSelector(t)))}initialize(e){let t=e.notebookDocumentSync;if(t===void 0)return;let n=t.id??dp.generateUuid();this.register({id:n,registerOptions:t})}register(e){let t=new On(this.client,e.registerOptions,this._onChangeNotificationSent,this._onOpenNotificationSent,this._onCloseNotificationSent,this._onSaveNotificationSent);this.registrations.set(e.id,t)}unregister(e){let t=this.registrations.get(e);t!==void 0&&(this.registrations.delete(e),t.dispose())}clear(){for(let e of this.registrations.values())e.dispose();this.registrations.clear(),this._onChangeNotificationSent.dispose(),this._onChangeNotificationSent=new se.EventEmitter,this._onOpenNotificationSent.dispose(),this._onOpenNotificationSent=new se.EventEmitter,this._onCloseNotificationSent.dispose(),this._onCloseNotificationSent=new se.EventEmitter,this._onSaveNotificationSent.dispose(),this._onSaveNotificationSent=new se.EventEmitter}handles(e){if(e.uri.scheme!==r.CellScheme)return!1;if(this.dedicatedChannel!==void 0&&se.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 se.workspace.notebookDocuments)for(let i of n.getCells())if(i.document.uri.toString()===t)return[n,i];return[void 0,void 0]}};rt.NotebookDocumentSyncFeature=_o});var xu=M(je=>{"use strict";var hp=je&&je.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),pp=je&&je.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Fu=je&&je.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&hp(t,e,n[i]);return pp(t,e),t}})();Object.defineProperty(je,"__esModule",{value:!0});je.SyncConfigurationFeature=je.ConfigurationFeature=void 0;je.toJSONObject=ln;var Fn=I("vscode"),ci=N(),gp=Fu(He()),mp=Fu(ne()),Ou=B(),wo=class{_client;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(ci.ConfigurationRequest.type,(t,n)=>{let i=o=>{let a=[];for(let u of o.items){let l=u.scopeUri!==void 0&&u.scopeUri!==null?this._client.protocol2CodeConverter.asUri(u.scopeUri):void 0;a.push(this.getConfiguration(l,u.section!==null?u.section:void 0))}return a},s=e.middleware.workspace;return s&&s.configuration?s.configuration(t,n,i):i(t,n)})}getConfiguration(e,t){let n=null;if(t){let i=t.lastIndexOf(".");if(i===-1)n=ln(Fn.workspace.getConfiguration(void 0,e).get(t));else{let s=Fn.workspace.getConfiguration(t.substr(0,i),e);s&&(n=ln(s.get(t.substr(i+1))))}}else{let i=Fn.workspace.getConfiguration(void 0,e);n={};for(let s of Object.keys(i))i.has(s)&&(n[s]=ln(i.get(s)))}return n===void 0&&(n=null),n}clear(){}};je.ConfigurationFeature=wo;function ln(r){if(r){if(Array.isArray(r))return r.map(ln);if(typeof r=="object"){let e=Object.create(null);for(let t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=ln(r[t]));return e}}return r}var Co=class{_client;isCleared;_listeners;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 ci.DidChangeConfigurationNotification.type}fillClientCapabilities(e){(0,Ou.ensure)((0,Ou.ensure)(e,"workspace"),"didChangeConfiguration").dynamicRegistration=!0}initialize(){this.isCleared=!1;let e=this._client.clientOptions.synchronize?.configurationSection;e!==void 0&&this.register({id:mp.generateUuid(),registerOptions:{section:e}})}register(e){let t=Fn.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(gp.string(e)?n=[e]:n=e,n!==void 0&&t!==void 0&&!n.some(a=>t.affectsConfiguration(a)))return;let i=async o=>o===void 0?this._client.sendNotification(ci.DidChangeConfigurationNotification.type,{settings:null}):this._client.sendNotification(ci.DidChangeConfigurationNotification.type,{settings:this.extractSettingsInformation(o)}),s=this._client.middleware.workspace?.didChangeConfiguration;(s?s(n,i):i(n)).catch(o=>{this._client.error(`Sending notification ${ci.DidChangeConfigurationNotification.type.method} failed`,o)})}extractSettingsInformation(e){function t(s,o){let a=s;for(let u=0;u<o.length-1;u++){let l=a[o[u]];l||(l=Object.create(null),a[o[u]]=l),a=l}return a}let n=this._client.clientOptions.workspaceFolder?this._client.clientOptions.workspaceFolder.uri:void 0,i=Object.create(null);for(let s=0;s<e.length;s++){let o=e[s],a=o.indexOf("."),u=null;if(a>=0?u=Fn.workspace.getConfiguration(o.substr(0,a),n).get(o.substr(a+1)):u=Fn.workspace.getConfiguration(void 0,n).get(o),u){let l=e[s].split(".");t(i,l)[l[l.length-1]]=ln(u)}}return i}};je.SyncConfigurationFeature=Co});var Mu=M(ve=>{"use strict";var vp=ve&&ve.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),yp=ve&&ve.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),_p=ve&&ve.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&vp(t,e,n[i]);return yp(t,e),t}})();Object.defineProperty(ve,"__esModule",{value:!0});ve.DidSaveTextDocumentFeature=ve.WillSaveWaitUntilFeature=ve.WillSaveFeature=ve.DidChangeTextDocumentFeature=ve.DidCloseTextDocumentFeature=ve.DidOpenTextDocumentFeature=void 0;var me=I("vscode"),ee=N(),ce=B(),xn=_p(ne()),wp=(ad(),nd(od)),bo=class extends ce.TextDocumentEventFeature{_syncedDocuments;_pendingOpenNotifications;_delayOpen;_pendingOpenListeners;constructor(e,t){super(e,me.workspace.onDidOpenTextDocument,ee.DidOpenTextDocumentNotification.type,()=>e.middleware.didOpen,n=>e.code2ProtocolConverter.asOpenTextDocumentParams(n),n=>n,ce.TextDocumentEventFeature.textDocumentFilter),this._syncedDocuments=t,this._pendingOpenNotifications=new Map,this._delayOpen=e.clientOptions.textSynchronization?.delayOpenNotifications??!1}async callback(e){if(this._delayOpen){if(!this.matches(e))return;if(this._client.visibleDocuments.isVisible(e))return super.callback(e);{let n=new Oo(e);this._pendingOpenNotifications.set(n.uri.toString(),n)}}else return super.callback(e)}get openDocuments(){return this._syncedDocuments.values()}fillClientCapabilities(e){(0,ce.ensure)((0,ce.ensure)(e,"textDocument"),"synchronization").dynamicRegistration=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;t&&n&&n.openClose&&this.register({id:xn.generateUuid(),registerOptions:{documentSelector:t}})}get registrationType(){return ee.DidOpenTextDocumentNotification.type}register(e){if(super.register(e),!e.registerOptions.documentSelector)return;let t=this._client.protocol2CodeConverter.asDocumentSelector(e.registerOptions.documentSelector);if(me.workspace.textDocuments.forEach(n=>{let i=n.uri.toString();if(!this._syncedDocuments.has(i)&&me.languages.match(t,n)>0&&!this._client.hasDedicatedTextSynchronizationFeature(n))if(this._client.visibleDocuments.isVisible(n)){let o=this._client.middleware,a=u=>this._client.sendNotification(this._type,this._createParams(u));(o.didOpen?o.didOpen(n,a):a(n)).catch(u=>{this._client.error(`Sending document notification ${this._type.method} failed`,u)}),this._syncedDocuments.set(i,n)}else this._pendingOpenNotifications.set(i,n)}),this._delayOpen&&this._pendingOpenListeners===void 0){this._pendingOpenListeners=[];let n=this._client.visibleDocuments;this._pendingOpenListeners.push(n.onClose(i=>{for(let s of i)this._pendingOpenNotifications.delete(s.toString())})),this._pendingOpenListeners.push(n.onOpen(i=>{for(let s of i){let o=this._pendingOpenNotifications.get(s.toString());o!==void 0&&(super.callback(o).catch((a=>{this._client.error(`Sending document notification ${this._type.method} failed`,a)})),this._pendingOpenNotifications.delete(s.toString()))}})),this._pendingOpenListeners.push(me.workspace.onDidCloseTextDocument(i=>{this._pendingOpenNotifications.delete(i.uri.toString())}))}}async sendPendingOpenNotifications(e){let t=Array.from(this._pendingOpenNotifications.values());this._pendingOpenNotifications.clear();let n=!1;for(let i of t){if(e!==void 0&&i.uri.toString()===e){n=!0;continue}await super.callback(i)}return n}getTextDocument(e){return e}notificationSent(e,t,n){this._syncedDocuments.set(e.uri.toString(),e),super.notificationSent(e,t,n)}clear(){if(this._pendingOpenNotifications.clear(),this._pendingOpenListeners!==void 0){for(let e of this._pendingOpenListeners)e.dispose();this._pendingOpenListeners=void 0}super.clear()}};ve.DidOpenTextDocumentFeature=bo;var So=class extends ce.TextDocumentEventFeature{_syncedDocuments;_pendingTextDocumentChanges;constructor(e,t,n){super(e,me.workspace.onDidCloseTextDocument,ee.DidCloseTextDocumentNotification.type,()=>e.middleware.didClose,i=>e.code2ProtocolConverter.asCloseTextDocumentParams(i),i=>i,ce.TextDocumentEventFeature.textDocumentFilter),this._syncedDocuments=t,this._pendingTextDocumentChanges=n}get registrationType(){return ee.DidCloseTextDocumentNotification.type}fillClientCapabilities(e){(0,ce.ensure)((0,ce.ensure)(e,"textDocument"),"synchronization").dynamicRegistration=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;t&&n&&n.openClose&&this.register({id:xn.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);if(t===void 0)return;super.unregister(e);let n=this._selectors.values();this._syncedDocuments.forEach(i=>{if(me.languages.match(t,i)>0&&!this._selectorFilter(n,i)&&!this._client.hasDedicatedTextSynchronizationFeature(i)){let s=this._client.middleware,o=a=>this._client.sendNotification(this._type,this._createParams(a));this._syncedDocuments.delete(i.uri.toString()),(s.didClose?s.didClose(i,o):o(i)).catch(a=>{this._client.error(`Sending document notification ${this._type.method} failed`,a)})}})}};ve.DidCloseTextDocumentFeature=So;var Do=class extends ce.DynamicDocumentFeature{_listener;_changeData;_onNotificationSent;_onPendingChangeAdded;_pendingTextDocumentChanges;_syncKind;constructor(e,t){super(e),this._changeData=new Map,this._onNotificationSent=new me.EventEmitter,this._onPendingChangeAdded=new me.EventEmitter,this._pendingTextDocumentChanges=t,this._syncKind=ee.TextDocumentSyncKind.None}get onNotificationSent(){return this._onNotificationSent.event}get onPendingChangeAdded(){return this._onPendingChangeAdded.event}get syncKind(){return this._syncKind}get registrationType(){return ee.DidChangeTextDocumentNotification.type}fillClientCapabilities(e){(0,ce.ensure)((0,ce.ensure)(e,"textDocument"),"synchronization").dynamicRegistration=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;t&&n&&n.change!==void 0&&n.change!==ee.TextDocumentSyncKind.None&&this.register({id:xn.generateUuid(),registerOptions:Object.assign({},{documentSelector:t},{syncKind:n.change})})}register(e){e.registerOptions.documentSelector&&(this._listener||(this._listener=me.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 s of this._changeData.values())if(me.languages.match(s.documentSelector,e.document)>0&&!this._client.hasDedicatedTextSynchronizationFeature(e.document)){let o=this._client.middleware;if(s.syncKind===ee.TextDocumentSyncKind.Incremental){let a=async u=>{let l=this._client.code2ProtocolConverter.asChangeTextDocumentParams(u,t,n);await this._client.sendNotification(ee.DidChangeTextDocumentNotification.type,l),this.notificationSent(u.document,ee.DidChangeTextDocumentNotification.type,l)};i.push(o.didChange?o.didChange(e,u=>a(u)):a(e))}else if(s.syncKind===ee.TextDocumentSyncKind.Full){let a=async u=>{let l=u.document.uri.toString();this._pendingTextDocumentChanges.set(l,u.document),this._onPendingChangeAdded.fire()};i.push(o.didChange?o.didChange(e,u=>a(u)):a(e))}}return Promise.all(i).then(void 0,s=>{throw this._client.error(`Sending document notification ${ee.DidChangeTextDocumentNotification.type.method} failed`,s),s})}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=ee.TextDocumentSyncKind.None;else{this._syncKind=ee.TextDocumentSyncKind.None;for(let t of this._changeData.values())if(this.updateSyncKind(t.syncKind),this._syncKind===ee.TextDocumentSyncKind.Full)break}}clear(){this._pendingTextDocumentChanges.clear(),this._changeData.clear(),this._syncKind=ee.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(me.languages.match(t.documentSelector,e)>0)return{send:n=>this.callback(n)}}updateSyncKind(e){if(this._syncKind!==ee.TextDocumentSyncKind.Full)switch(e){case ee.TextDocumentSyncKind.Full:this._syncKind=e;break;case ee.TextDocumentSyncKind.Incremental:this._syncKind===ee.TextDocumentSyncKind.None&&(this._syncKind=ee.TextDocumentSyncKind.Incremental);break}}};ve.DidChangeTextDocumentFeature=Do;var Po=class extends ce.TextDocumentEventFeature{constructor(e){super(e,me.workspace.onWillSaveTextDocument,ee.WillSaveTextDocumentNotification.type,()=>e.middleware.willSave,t=>e.code2ProtocolConverter.asWillSaveTextDocumentParams(t),t=>t.document,(t,n)=>ce.TextDocumentEventFeature.textDocumentFilter(t,n.document))}get registrationType(){return ee.WillSaveTextDocumentNotification.type}fillClientCapabilities(e){let t=(0,ce.ensure)((0,ce.ensure)(e,"textDocument"),"synchronization");t.willSave=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;t&&n&&n.willSave&&this.register({id:xn.generateUuid(),registerOptions:{documentSelector:t}})}getTextDocument(e){return e.document}};ve.WillSaveFeature=Po;var To=class extends ce.DynamicDocumentFeature{_listener;_selectors;constructor(e){super(e),this._selectors=new Map}getDocumentSelectors(){return this._selectors.values()}get registrationType(){return ee.WillSaveTextDocumentWaitUntilRequest.type}fillClientCapabilities(e){let t=(0,ce.ensure)((0,ce.ensure)(e,"textDocument"),"synchronization");t.willSaveWaitUntil=!0}initialize(e,t){let n=e.resolvedTextDocumentSync;t&&n&&n.willSaveWaitUntil&&this.register({id:xn.generateUuid(),registerOptions:{documentSelector:t}})}register(e){e.registerOptions.documentSelector&&(this._listener||(this._listener=me.workspace.onWillSaveTextDocument(this.callback,this)),this._selectors.set(e.id,this._client.protocol2CodeConverter.asDocumentSelector(e.registerOptions.documentSelector)))}callback(e){if(ce.TextDocumentEventFeature.textDocumentFilter(this._selectors.values(),e.document)&&!this._client.hasDedicatedTextSynchronizationFeature(e.document)){let t=this._client.middleware,n=i=>this._client.sendRequest(ee.WillSaveTextDocumentWaitUntilRequest.type,this._client.code2ProtocolConverter.asWillSaveTextDocumentParams(i)).then(async s=>{let o=await this._client.protocol2CodeConverter.asTextEdits(s);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)}};ve.WillSaveWaitUntilFeature=To;var Ro=class extends ce.TextDocumentEventFeature{_includeText;constructor(e){super(e,me.workspace.onDidSaveTextDocument,ee.DidSaveTextDocumentNotification.type,()=>e.middleware.didSave,t=>e.code2ProtocolConverter.asSaveTextDocumentParams(t,this._includeText),t=>t,ce.TextDocumentEventFeature.textDocumentFilter),this._includeText=!1}get registrationType(){return ee.DidSaveTextDocumentNotification.type}fillClientCapabilities(e){(0,ce.ensure)((0,ce.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:xn.generateUuid(),registerOptions:Object.assign({},{documentSelector:t},i)})}}register(e){this._includeText=!!e.registerOptions.includeText,super.register(e)}getTextDocument(e){return e}};ve.DidSaveTextDocumentFeature=Ro;var Cp="`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?";function bp(r=""){let e="(-?\\d*\\.\\d\\w*)|([^";for(let t of Cp)r.indexOf(t)>=0||(e+="\\"+t);return e+="\\s]+)",new RegExp(e,"g")}var Sp=bp(),Oo=class r{_extTextDocument;_capturedTextDocument;_content;_uri;_fileName;_languageId;_version;_eol;_isUntitled;_encoding;_isDirty;_isClosed;constructor(e){this._extTextDocument=e,this._content=e.getText(),this._uri=e.uri,this._fileName=e.fileName,this._languageId=e.languageId,this._version=e.version,this._eol=e.eol,this._isUntitled=e.isUntitled,this._encoding=e.encoding,this._isDirty=e.isDirty,this._isClosed=e.isClosed,this._capturedTextDocument=wp.TextDocument.create(this._uri.toString(),this._languageId,this._version,this._content)}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}get eol(){return this._eol}get isUntitled(){return this._isUntitled}get encoding(){return this._encoding}get fileName(){return this._fileName}get isDirty(){return this._isDirty}get isClosed(){return this._isClosed}save(){return this.version===this._extTextDocument.version?this._extTextDocument.save():Promise.resolve(!1)}get lineCount(){return this._capturedTextDocument.lineCount}offsetAt(e){return this._capturedTextDocument.offsetAt(e)}positionAt(e){let t=this._capturedTextDocument.positionAt(e);return new me.Position(t.line,t.character)}getText(e){return this._capturedTextDocument.getText(e)}lineAt(e){let t=typeof e=="number"?e:this.validatePosition(e).line;if(t<0||t>=this.lineCount)throw new RangeError(`Illegal value for line: ${t}`);let n=this._capturedTextDocument.getLineRange(t),i=this._capturedTextDocument.getText(n),s=i.search(/\S/),o=new me.Range(n.start.line,n.start.character,n.end.line,n.end.character),a=t+1<this.lineCount?new me.Range(o.start.line,o.start.character,t+1,0):o;return{lineNumber:t,text:i,range:o,rangeIncludingLineBreak:a,firstNonWhitespaceCharacterIndex:s===-1?i.length:s,isEmptyOrWhitespace:s===-1}}getWordRangeAtPosition(e,t){let n=this.validatePosition(e).line,i=this.lineAt(n).text,s=r.getWordRegExp(t),o;for(s.lastIndex=0;(o=s.exec(i))!==null;)if(o.index<=e.character&&s.lastIndex>=e.character)return new me.Range(n,o.index,n,s.lastIndex)}validateRange(e){let t=this.validatePosition(e.start),n=this.validatePosition(e.end);return t===e.start&&n===e.end?e:new me.Range(t.line,t.character,n.line,n.character)}validatePosition(e){let t=Math.min(Math.max(e.line,0),this.lineCount-1),n=this._capturedTextDocument.getLineRange(t),i=Math.min(Math.max(e.character,0),n.end.character);return t===e.line&&i===e.character?e:new me.Position(t,i)}static getWordRegExp(e){let t=e??Sp;if(t.flags.includes("g"))return t;let n=`${t.flags}g`;return new RegExp(t.source,n)}}});var ku=M(st=>{"use strict";var Dp=st&&st.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Pp=st&&st.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Tp=st&&st.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Dp(t,e,n[i]);return Pp(t,e),t}})();Object.defineProperty(st,"__esModule",{value:!0});st.CompletionItemFeature=void 0;var Rp=I("vscode"),W=N(),Fo=B(),Op=Tp(ne()),Fp=[W.CompletionItemKind.Text,W.CompletionItemKind.Method,W.CompletionItemKind.Function,W.CompletionItemKind.Constructor,W.CompletionItemKind.Field,W.CompletionItemKind.Variable,W.CompletionItemKind.Class,W.CompletionItemKind.Interface,W.CompletionItemKind.Module,W.CompletionItemKind.Property,W.CompletionItemKind.Unit,W.CompletionItemKind.Value,W.CompletionItemKind.Enum,W.CompletionItemKind.Keyword,W.CompletionItemKind.Snippet,W.CompletionItemKind.Color,W.CompletionItemKind.File,W.CompletionItemKind.Reference,W.CompletionItemKind.Folder,W.CompletionItemKind.EnumMember,W.CompletionItemKind.Constant,W.CompletionItemKind.Struct,W.CompletionItemKind.Event,W.CompletionItemKind.Operator,W.CompletionItemKind.TypeParameter],xo=class extends Fo.TextDocumentLanguageFeature{labelDetailsSupport;constructor(e){super(e,W.CompletionRequest.type),this.labelDetailsSupport=new Map}fillClientCapabilities(e){let t=(0,Fo.ensure)((0,Fo.ensure)(e,"textDocument"),"completion");t.dynamicRegistration=!0,t.contextSupport=!0,t.completionItem={snippetSupport:!0,commitCharactersSupport:!0,documentationFormat:[W.MarkupKind.Markdown,W.MarkupKind.PlainText],deprecatedSupport:!0,preselectSupport:!0,tagSupport:{valueSet:[W.CompletionItemTag.Deprecated]},insertReplaceSupport:!0,resolveSupport:{properties:["documentation","detail","additionalTextEdits"]},insertTextModeSupport:{valueSet:[W.InsertTextMode.asIs,W.InsertTextMode.adjustIndentation]},labelDetailsSupport:!0},t.insertTextMode=W.InsertTextMode.adjustIndentation,t.completionItemKind={valueSet:Fp},t.completionList={itemDefaults:["commitCharacters","editRange","insertTextFormat","insertTextMode","data"],applyKindSupport:!0}}initialize(e,t){let n=this.getRegistrationOptions(t,e.completionProvider);n&&this.register({id:Op.generateUuid(),registerOptions:n})}registerLanguageProvider(e,t){this.labelDetailsSupport.set(t,!!e.completionItem?.labelDetailsSupport);let n=e.triggerCharacters??[],i=e.allCommitCharacters,s=e.documentSelector,o={provideCompletionItems:(a,u,l,p)=>{let h=this._client,f=this._client.middleware,m=(g,v,_,T)=>h.sendRequest(W.CompletionRequest.type,h.code2ProtocolConverter.asCompletionParams(g,v,_),T).then(C=>T.isCancellationRequested?null:h.protocol2CodeConverter.asCompletionResult(C,i,T),C=>h.handleFailedRequest(W.CompletionRequest.type,T,C,null));return f.provideCompletionItem?f.provideCompletionItem(a,u,p,l,m):m(a,u,p,l)},resolveCompletionItem:e.resolveProvider?(a,u)=>{let l=this._client,p=this._client.middleware,h=(f,m)=>l.sendRequest(W.CompletionResolveRequest.type,l.code2ProtocolConverter.asCompletionItem(f,!!this.labelDetailsSupport.get(t)),m).then(g=>m.isCancellationRequested?null:l.protocol2CodeConverter.asCompletionItem(g),g=>l.handleFailedRequest(W.CompletionResolveRequest.type,m,g,f));return p.resolveCompletionItem?p.resolveCompletionItem(a,u,h):h(a,u)}:void 0};return[Rp.languages.registerCompletionItemProvider(this._client.protocol2CodeConverter.asDocumentSelector(s),o,...n),o]}};st.CompletionItemFeature=xo});var Eu=M(ot=>{"use strict";var xp=ot&&ot.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Mp=ot&&ot.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),kp=ot&&ot.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&xp(t,e,n[i]);return Mp(t,e),t}})();Object.defineProperty(ot,"__esModule",{value:!0});ot.HoverFeature=void 0;var Ep=I("vscode"),ui=N(),Mo=B(),qp=kp(ne()),ko=class extends Mo.TextDocumentLanguageFeature{constructor(e){super(e,ui.HoverRequest.type)}fillClientCapabilities(e){let t=(0,Mo.ensure)((0,Mo.ensure)(e,"textDocument"),"hover");t.dynamicRegistration=!0,t.contentFormat=[ui.MarkupKind.Markdown,ui.MarkupKind.PlainText]}initialize(e,t){let n=this.getRegistrationOptions(t,e.hoverProvider);n&&this.register({id:qp.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideHover:(i,s,o)=>{let a=this._client,u=(p,h,f)=>a.sendRequest(ui.HoverRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(p,h),f).then(m=>f.isCancellationRequested?null:a.protocol2CodeConverter.asHover(m),m=>a.handleFailedRequest(ui.HoverRequest.type,f,m,null)),l=a.middleware;return l.provideHover?l.provideHover(i,s,o,u):u(i,s,o)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return Ep.languages.registerHoverProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};ot.HoverFeature=ko});var qu=M(at=>{"use strict";var Ip=at&&at.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Ap=at&&at.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),jp=at&&at.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Ip(t,e,n[i]);return Ap(t,e),t}})();Object.defineProperty(at,"__esModule",{value:!0});at.DefinitionFeature=void 0;var Lp=I("vscode"),Eo=N(),qo=B(),Np=jp(ne()),Io=class extends qo.TextDocumentLanguageFeature{constructor(e){super(e,Eo.DefinitionRequest.type)}fillClientCapabilities(e){let t=(0,qo.ensure)((0,qo.ensure)(e,"textDocument"),"definition");t.dynamicRegistration=!0,t.linkSupport=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.definitionProvider);n&&this.register({id:Np.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDefinition:(i,s,o)=>{let a=this._client,u=(p,h,f)=>a.sendRequest(Eo.DefinitionRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(p,h),f).then(m=>f.isCancellationRequested?null:a.protocol2CodeConverter.asDefinitionResult(m,f),m=>a.handleFailedRequest(Eo.DefinitionRequest.type,f,m,null)),l=a.middleware;return l.provideDefinition?l.provideDefinition(i,s,o,u):u(i,s,o)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return Lp.languages.registerDefinitionProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};at.DefinitionFeature=Io});var Au=M(ct=>{"use strict";var Up=ct&&ct.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Kp=ct&&ct.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Hp=ct&&ct.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Up(t,e,n[i]);return Kp(t,e),t}})();Object.defineProperty(ct,"__esModule",{value:!0});ct.SignatureHelpFeature=void 0;var Iu=I("vscode"),li=N(),Ao=B(),Wp=Hp(ne()),jo=class extends Ao.TextDocumentLanguageFeature{constructor(e){super(e,li.SignatureHelpRequest.type)}fillClientCapabilities(e){let t=(0,Ao.ensure)((0,Ao.ensure)(e,"textDocument"),"signatureHelp");t.dynamicRegistration=!0,t.signatureInformation={documentationFormat:[li.MarkupKind.Markdown,li.MarkupKind.PlainText]},t.signatureInformation.parameterInformation={labelOffsetSupport:!0},t.signatureInformation.activeParameterSupport=!0,t.signatureInformation.noActiveParameterSupport=!0,t.contextSupport=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.signatureHelpProvider);n&&this.register({id:Wp.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t={provideSignatureHelp:(n,i,s,o)=>{let a=this._client,u=(p,h,f,m)=>a.sendRequest(li.SignatureHelpRequest.type,a.code2ProtocolConverter.asSignatureHelpParams(p,h,f),m).then(g=>m.isCancellationRequested?null:a.protocol2CodeConverter.asSignatureHelp(g,m),g=>a.handleFailedRequest(li.SignatureHelpRequest.type,m,g,null)),l=a.middleware;return l.provideSignatureHelp?l.provideSignatureHelp(n,i,o,s,u):u(n,i,o,s)}};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 Iu.languages.registerSignatureHelpProvider(n,t,...i)}else{let i={triggerCharacters:e.triggerCharacters||[],retriggerCharacters:e.retriggerCharacters||[]};return Iu.languages.registerSignatureHelpProvider(n,t,i)}}};ct.SignatureHelpFeature=jo});var ju=M(ut=>{"use strict";var $p=ut&&ut.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Bp=ut&&ut.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),zp=ut&&ut.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&$p(t,e,n[i]);return Bp(t,e),t}})();Object.defineProperty(ut,"__esModule",{value:!0});ut.DocumentHighlightFeature=void 0;var Vp=I("vscode"),Lo=N(),No=B(),Gp=zp(ne()),Uo=class extends No.TextDocumentLanguageFeature{constructor(e){super(e,Lo.DocumentHighlightRequest.type)}fillClientCapabilities(e){(0,No.ensure)((0,No.ensure)(e,"textDocument"),"documentHighlight").dynamicRegistration=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentHighlightProvider);n&&this.register({id:Gp.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDocumentHighlights:(i,s,o)=>{let a=this._client,u=(p,h,f)=>a.sendRequest(Lo.DocumentHighlightRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(p,h),f).then(m=>f.isCancellationRequested?null:a.protocol2CodeConverter.asDocumentHighlights(m,f),m=>a.handleFailedRequest(Lo.DocumentHighlightRequest.type,f,m,null)),l=a.middleware;return l.provideDocumentHighlights?l.provideDocumentHighlights(i,s,o,u):u(i,s,o)}};return[Vp.languages.registerDocumentHighlightProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};ut.DocumentHighlightFeature=Uo});var Wo=M(Pe=>{"use strict";var Jp=Pe&&Pe.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Yp=Pe&&Pe.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Qp=Pe&&Pe.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Jp(t,e,n[i]);return Yp(t,e),t}})();Object.defineProperty(Pe,"__esModule",{value:!0});Pe.DocumentSymbolFeature=Pe.SupportedSymbolTags=Pe.SupportedSymbolKinds=void 0;var Zp=I("vscode"),J=N(),Ko=B(),Xp=Qp(ne());Pe.SupportedSymbolKinds=[J.SymbolKind.File,J.SymbolKind.Module,J.SymbolKind.Namespace,J.SymbolKind.Package,J.SymbolKind.Class,J.SymbolKind.Method,J.SymbolKind.Property,J.SymbolKind.Field,J.SymbolKind.Constructor,J.SymbolKind.Enum,J.SymbolKind.Interface,J.SymbolKind.Function,J.SymbolKind.Variable,J.SymbolKind.Constant,J.SymbolKind.String,J.SymbolKind.Number,J.SymbolKind.Boolean,J.SymbolKind.Array,J.SymbolKind.Object,J.SymbolKind.Key,J.SymbolKind.Null,J.SymbolKind.EnumMember,J.SymbolKind.Struct,J.SymbolKind.Event,J.SymbolKind.Operator,J.SymbolKind.TypeParameter];Pe.SupportedSymbolTags=[J.SymbolTag.Deprecated];var Ho=class extends Ko.TextDocumentLanguageFeature{constructor(e){super(e,J.DocumentSymbolRequest.type)}fillClientCapabilities(e){let t=(0,Ko.ensure)((0,Ko.ensure)(e,"textDocument"),"documentSymbol");t.dynamicRegistration=!0,t.symbolKind={valueSet:Pe.SupportedSymbolKinds},t.hierarchicalDocumentSymbolSupport=!0,t.tagSupport={valueSet:Pe.SupportedSymbolTags},t.labelSupport=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentSymbolProvider);n&&this.register({id:Xp.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDocumentSymbols:(s,o)=>{let a=this._client,u=async(p,h)=>{try{let f=await a.sendRequest(J.DocumentSymbolRequest.type,a.code2ProtocolConverter.asDocumentSymbolParams(p),h);if(h.isCancellationRequested||f===void 0||f===null)return null;if(f.length===0)return[];{let m=f[0];return J.DocumentSymbol.is(m)?await a.protocol2CodeConverter.asDocumentSymbols(f,h):await a.protocol2CodeConverter.asSymbolInformations(f,h)}}catch(f){return a.handleFailedRequest(J.DocumentSymbolRequest.type,h,f,null)}},l=a.middleware;return l.provideDocumentSymbols?l.provideDocumentSymbols(s,o,u):u(s,o)}},i=e.label!==void 0?{label:e.label}:void 0;return[Zp.languages.registerDocumentSymbolProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n,i),n]}};Pe.DocumentSymbolFeature=Ho});var Nu=M(lt=>{"use strict";var eg=lt&<.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),tg=lt&<.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),ng=lt&<.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&eg(t,e,n[i]);return tg(t,e),t}})();Object.defineProperty(lt,"__esModule",{value:!0});lt.WorkspaceSymbolFeature=void 0;var ig=I("vscode"),di=N(),$o=B(),Lu=Wo(),rg=ng(ne()),Bo=class extends $o.WorkspaceFeature{constructor(e){super(e,di.WorkspaceSymbolRequest.type)}fillClientCapabilities(e){let t=(0,$o.ensure)((0,$o.ensure)(e,"workspace"),"symbol");t.dynamicRegistration=!0,t.symbolKind={valueSet:Lu.SupportedSymbolKinds},t.tagSupport={valueSet:Lu.SupportedSymbolTags},t.resolveSupport={properties:["location.range"]}}initialize(e){e.workspaceSymbolProvider&&this.register({id:rg.generateUuid(),registerOptions:e.workspaceSymbolProvider===!0?{workDoneProgress:!1}:e.workspaceSymbolProvider})}registerLanguageProvider(e){let t={provideWorkspaceSymbols:(n,i)=>{let s=this._client,o=(u,l)=>s.sendRequest(di.WorkspaceSymbolRequest.type,{query:u},l).then(p=>l.isCancellationRequested?null:s.protocol2CodeConverter.asSymbolInformations(p,l),p=>s.handleFailedRequest(di.WorkspaceSymbolRequest.type,l,p,null)),a=s.middleware;return a.provideWorkspaceSymbols?a.provideWorkspaceSymbols(n,i,o):o(n,i)},resolveWorkspaceSymbol:e.resolveProvider===!0?(n,i)=>{let s=this._client,o=(u,l)=>s.sendRequest(di.WorkspaceSymbolResolveRequest.type,s.code2ProtocolConverter.asWorkspaceSymbol(u),l).then(p=>l.isCancellationRequested?null:s.protocol2CodeConverter.asSymbolInformation(p),p=>s.handleFailedRequest(di.WorkspaceSymbolResolveRequest.type,l,p,null)),a=s.middleware;return a.resolveWorkspaceSymbol?a.resolveWorkspaceSymbol(n,i,o):o(n,i)}:void 0};return[ig.languages.registerWorkspaceSymbolProvider(t),t]}};lt.WorkspaceSymbolFeature=Bo});var Uu=M(dt=>{"use strict";var sg=dt&&dt.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),og=dt&&dt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),ag=dt&&dt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&sg(t,e,n[i]);return og(t,e),t}})();Object.defineProperty(dt,"__esModule",{value:!0});dt.ReferencesFeature=void 0;var cg=I("vscode"),zo=N(),Vo=B(),ug=ag(ne()),Go=class extends Vo.TextDocumentLanguageFeature{constructor(e){super(e,zo.ReferencesRequest.type)}fillClientCapabilities(e){(0,Vo.ensure)((0,Vo.ensure)(e,"textDocument"),"references").dynamicRegistration=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.referencesProvider);n&&this.register({id:ug.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideReferences:(i,s,o,a)=>{let u=this._client,l=(h,f,m,g)=>u.sendRequest(zo.ReferencesRequest.type,u.code2ProtocolConverter.asReferenceParams(h,f,m),g).then(v=>g.isCancellationRequested?null:u.protocol2CodeConverter.asReferences(v,g),v=>u.handleFailedRequest(zo.ReferencesRequest.type,g,v,null)),p=u.middleware;return p.provideReferences?p.provideReferences(i,s,o,a,l):l(i,s,o,a)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return cg.languages.registerReferenceProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};dt.ReferencesFeature=Go});var Ku=M(vr=>{"use strict";Object.defineProperty(vr,"__esModule",{value:!0});vr.TypeDefinitionFeature=void 0;var lg=I("vscode"),Jo=N(),fi=B(),Yo=class extends fi.TextDocumentLanguageFeature{constructor(e){super(e,Jo.TypeDefinitionRequest.type)}fillClientCapabilities(e){(0,fi.ensure)((0,fi.ensure)(e,"textDocument"),"typeDefinition").dynamicRegistration=!0;let t=(0,fi.ensure)((0,fi.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,s,o)=>{let a=this._client,u=(p,h,f)=>a.sendRequest(Jo.TypeDefinitionRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(p,h),f).then(m=>f.isCancellationRequested?null:a.protocol2CodeConverter.asDefinitionResult(m,f),m=>a.handleFailedRequest(Jo.TypeDefinitionRequest.type,f,m,null)),l=a.middleware;return l.provideTypeDefinition?l.provideTypeDefinition(i,s,o,u):u(i,s,o)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return lg.languages.registerTypeDefinitionProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};vr.TypeDefinitionFeature=Yo});var Hu=M(yr=>{"use strict";Object.defineProperty(yr,"__esModule",{value:!0});yr.ImplementationFeature=void 0;var dg=I("vscode"),Qo=N(),Zo=B(),Xo=class extends Zo.TextDocumentLanguageFeature{constructor(e){super(e,Qo.ImplementationRequest.type)}fillClientCapabilities(e){let t=(0,Zo.ensure)((0,Zo.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,s,o)=>{let a=this._client,u=(p,h,f)=>a.sendRequest(Qo.ImplementationRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(p,h),f).then(m=>f.isCancellationRequested?null:a.protocol2CodeConverter.asDefinitionResult(m,f),m=>a.handleFailedRequest(Qo.ImplementationRequest.type,f,m,null)),l=a.middleware;return l.provideImplementation?l.provideImplementation(i,s,o,u):u(i,s,o)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return dg.languages.registerImplementationProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};yr.ImplementationFeature=Xo});var Wu=M(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});_r.ColorProviderFeature=void 0;var fg=I("vscode"),hi=N(),ea=B(),ta=class extends ea.TextDocumentLanguageFeature{constructor(e){super(e,hi.DocumentColorRequest.type)}fillClientCapabilities(e){(0,ea.ensure)((0,ea.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,s,o)=>{let a=this._client,u=(p,h,f)=>{let m={color:p,textDocument:a.code2ProtocolConverter.asTextDocumentIdentifier(h.document),range:a.code2ProtocolConverter.asRange(h.range)};return a.sendRequest(hi.ColorPresentationRequest.type,m,f).then(g=>f.isCancellationRequested?null:this._client.protocol2CodeConverter.asColorPresentations(g,f),g=>a.handleFailedRequest(hi.ColorPresentationRequest.type,f,g,null))},l=a.middleware;return l.provideColorPresentations?l.provideColorPresentations(i,s,o,u):u(i,s,o)},provideDocumentColors:(i,s)=>{let o=this._client,a=(l,p)=>{let h={textDocument:o.code2ProtocolConverter.asTextDocumentIdentifier(l)};return o.sendRequest(hi.DocumentColorRequest.type,h,p).then(f=>p.isCancellationRequested?null:this._client.protocol2CodeConverter.asColorInformations(f,p),f=>o.handleFailedRequest(hi.DocumentColorRequest.type,p,f,null))},u=o.middleware;return u.provideDocumentColors?u.provideDocumentColors(i,s,a):a(i,s)}};return[fg.languages.registerColorProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};_r.ColorProviderFeature=ta});var $u=M(ft=>{"use strict";var hg=ft&&ft.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),pg=ft&&ft.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),gg=ft&&ft.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&hg(t,e,n[i]);return pg(t,e),t}})();Object.defineProperty(ft,"__esModule",{value:!0});ft.CodeActionFeature=void 0;var mg=I("vscode"),Te=N(),vg=gg(ne()),na=B(),ia=class extends na.TextDocumentLanguageFeature{constructor(e){super(e,Te.CodeActionRequest.type)}fillClientCapabilities(e){let t=(0,na.ensure)((0,na.ensure)(e,"textDocument"),"codeAction");t.dynamicRegistration=!0,t.isPreferredSupport=!0,t.disabledSupport=!0,t.dataSupport=!0,t.resolveSupport={properties:["edit","command"]},t.codeActionLiteralSupport={codeActionKind:{valueSet:[Te.CodeActionKind.Empty,Te.CodeActionKind.QuickFix,Te.CodeActionKind.Refactor,Te.CodeActionKind.RefactorExtract,Te.CodeActionKind.RefactorInline,Te.CodeActionKind.RefactorMove,Te.CodeActionKind.RefactorRewrite,Te.CodeActionKind.Source,Te.CodeActionKind.SourceOrganizeImports,Te.CodeActionKind.Notebook]}},t.honorsChangeAnnotations=!0,t.documentationSupport=!0,t.tagSupport={valueSet:[Te.CodeActionTag.LLMGenerated]}}initialize(e,t){let n=this.getRegistrationOptions(t,e.codeActionProvider);n&&this.register({id:vg.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideCodeActions:(i,s,o,a)=>{let u=this._client,l=async(h,f,m,g)=>{let v={textDocument:u.code2ProtocolConverter.asTextDocumentIdentifier(h),range:u.code2ProtocolConverter.asRange(f),context:u.code2ProtocolConverter.asCodeActionContextSync(m)};return u.sendRequest(Te.CodeActionRequest.type,v,g).then(_=>g.isCancellationRequested||_===null||_===void 0?null:u.protocol2CodeConverter.asCodeActionResult(_,g),_=>u.handleFailedRequest(Te.CodeActionRequest.type,g,_,null))},p=u.middleware;return p.provideCodeActions?p.provideCodeActions(i,s,o,a,l):l(i,s,o,a)},resolveCodeAction:e.resolveProvider?(i,s)=>{let o=this._client,a=this._client.middleware,u=async(l,p)=>o.sendRequest(Te.CodeActionResolveRequest.type,o.code2ProtocolConverter.asCodeActionSync(l),p).then(h=>p.isCancellationRequested?l:o.protocol2CodeConverter.asCodeAction(h,p),h=>o.handleFailedRequest(Te.CodeActionResolveRequest.type,p,h,l));return a.resolveCodeAction?a.resolveCodeAction(i,s,u):u(i,s)}:void 0};return[mg.languages.registerCodeActionsProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n,this.getMetadata(e)),n]}getMetadata(e){if(!(e.codeActionKinds===void 0&&e.documentation===void 0))return{providedCodeActionKinds:this._client.protocol2CodeConverter.asCodeActionKinds(e.codeActionKinds),documentation:this._client.protocol2CodeConverter.asCodeActionDocumentations(e.documentation)}}};ft.CodeActionFeature=ia});var zu=M(ht=>{"use strict";var yg=ht&&ht.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),_g=ht&&ht.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),wg=ht&&ht.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&yg(t,e,n[i]);return _g(t,e),t}})();Object.defineProperty(ht,"__esModule",{value:!0});ht.CodeLensFeature=void 0;var Bu=I("vscode"),Mn=N(),Cg=wg(ne()),pi=B(),ra=class extends pi.TextDocumentLanguageFeature{constructor(e){super(e,Mn.CodeLensRequest.type)}fillClientCapabilities(e){let t=(0,pi.ensure)((0,pi.ensure)(e,"textDocument"),"codeLens");t.dynamicRegistration=!0,t.resolveSupport={properties:["command"]},(0,pi.ensure)((0,pi.ensure)(e,"workspace"),"codeLens").refreshSupport=!0}initialize(e,t){this._client.onRequest(Mn.CodeLensRefreshRequest.type,async()=>{for(let s of this.getAllProviders())s.onDidChangeCodeLensEmitter.fire()});let i=this.getRegistrationOptions(t,e.codeLensProvider);i&&this.register({id:Cg.generateUuid(),registerOptions:i})}registerLanguageProvider(e){let t=e.documentSelector,n=new Bu.EventEmitter,i={onDidChangeCodeLenses:n.event,provideCodeLenses:(s,o)=>{let a=this._client,u=(p,h)=>a.sendRequest(Mn.CodeLensRequest.type,a.code2ProtocolConverter.asCodeLensParams(p),h).then(f=>h.isCancellationRequested?null:a.protocol2CodeConverter.asCodeLenses(f,h),f=>a.handleFailedRequest(Mn.CodeLensRequest.type,h,f,null)),l=a.middleware;return l.provideCodeLenses?l.provideCodeLenses(s,o,u):u(s,o)},resolveCodeLens:e.resolveProvider?(s,o)=>{let a=this._client,u=(p,h)=>a.sendRequest(Mn.CodeLensResolveRequest.type,a.code2ProtocolConverter.asCodeLens(p),h).then(f=>h.isCancellationRequested?p:a.protocol2CodeConverter.asCodeLens(f),f=>a.handleFailedRequest(Mn.CodeLensResolveRequest.type,h,f,p)),l=a.middleware;return l.resolveCodeLens?l.resolveCodeLens(s,o,u):u(s,o)}:void 0};return[Bu.languages.registerCodeLensProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),i),{provider:i,onDidChangeCodeLensEmitter:n}]}};ht.CodeLensFeature=ra});var Vu=M(qe=>{"use strict";var bg=qe&&qe.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Sg=qe&&qe.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Dg=qe&&qe.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&bg(t,e,n[i]);return Sg(t,e),t}})();Object.defineProperty(qe,"__esModule",{value:!0});qe.DocumentOnTypeFormattingFeature=qe.DocumentRangeFormattingFeature=qe.DocumentFormattingFeature=void 0;var wr=I("vscode"),Ze=N(),ca=Dg(ne()),jt=B(),kn;(function(r){function e(t){let n=wr.workspace.getConfiguration("files",t);return{trimTrailingWhitespace:n.get("trimTrailingWhitespace"),trimFinalNewlines:n.get("trimFinalNewlines"),insertFinalNewline:n.get("insertFinalNewline")}}r.fromConfiguration=e})(kn||(kn={}));var sa=class extends jt.TextDocumentLanguageFeature{constructor(e){super(e,Ze.DocumentFormattingRequest.type)}fillClientCapabilities(e){(0,jt.ensure)((0,jt.ensure)(e,"textDocument"),"formatting").dynamicRegistration=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentFormattingProvider);n&&this.register({id:ca.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDocumentFormattingEdits:(i,s,o)=>{let a=this._client,u=(p,h,f)=>{let m={textDocument:a.code2ProtocolConverter.asTextDocumentIdentifier(p),options:a.code2ProtocolConverter.asFormattingOptions(h,kn.fromConfiguration(p))};return a.sendRequest(Ze.DocumentFormattingRequest.type,m,f).then(g=>f.isCancellationRequested?null:a.protocol2CodeConverter.asTextEdits(g,f),g=>a.handleFailedRequest(Ze.DocumentFormattingRequest.type,f,g,null))},l=a.middleware;return l.provideDocumentFormattingEdits?l.provideDocumentFormattingEdits(i,s,o,u):u(i,s,o)}};return[wr.languages.registerDocumentFormattingEditProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};qe.DocumentFormattingFeature=sa;var oa=class extends jt.TextDocumentLanguageFeature{constructor(e){super(e,Ze.DocumentRangeFormattingRequest.type)}fillClientCapabilities(e){let t=(0,jt.ensure)((0,jt.ensure)(e,"textDocument"),"rangeFormatting");t.dynamicRegistration=!0,t.rangesSupport=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentRangeFormattingProvider);n&&this.register({id:ca.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDocumentRangeFormattingEdits:(i,s,o,a)=>{let u=this._client,l=(h,f,m,g)=>{let v={textDocument:u.code2ProtocolConverter.asTextDocumentIdentifier(h),range:u.code2ProtocolConverter.asRange(f),options:u.code2ProtocolConverter.asFormattingOptions(m,kn.fromConfiguration(h))};return u.sendRequest(Ze.DocumentRangeFormattingRequest.type,v,g).then(_=>g.isCancellationRequested?null:u.protocol2CodeConverter.asTextEdits(_,g),_=>u.handleFailedRequest(Ze.DocumentRangeFormattingRequest.type,g,_,null))},p=u.middleware;return p.provideDocumentRangeFormattingEdits?p.provideDocumentRangeFormattingEdits(i,s,o,a,l):l(i,s,o,a)}};return e.rangesSupport&&(n.provideDocumentRangesFormattingEdits=(i,s,o,a)=>{let u=this._client,l=(h,f,m,g)=>{let v={textDocument:u.code2ProtocolConverter.asTextDocumentIdentifier(h),ranges:u.code2ProtocolConverter.asRanges(f),options:u.code2ProtocolConverter.asFormattingOptions(m,kn.fromConfiguration(h))};return u.sendRequest(Ze.DocumentRangesFormattingRequest.type,v,g).then(_=>g.isCancellationRequested?null:u.protocol2CodeConverter.asTextEdits(_,g),_=>u.handleFailedRequest(Ze.DocumentRangesFormattingRequest.type,g,_,null))},p=u.middleware;return p.provideDocumentRangesFormattingEdits?p.provideDocumentRangesFormattingEdits(i,s,o,a,l):l(i,s,o,a)}),[wr.languages.registerDocumentRangeFormattingEditProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};qe.DocumentRangeFormattingFeature=oa;var aa=class extends jt.TextDocumentLanguageFeature{constructor(e){super(e,Ze.DocumentOnTypeFormattingRequest.type)}fillClientCapabilities(e){(0,jt.ensure)((0,jt.ensure)(e,"textDocument"),"onTypeFormatting").dynamicRegistration=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentOnTypeFormattingProvider);n&&this.register({id:ca.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideOnTypeFormattingEdits:(s,o,a,u,l)=>{let p=this._client,h=(m,g,v,_,T)=>{let C={textDocument:p.code2ProtocolConverter.asTextDocumentIdentifier(m),position:p.code2ProtocolConverter.asPosition(g),ch:v,options:p.code2ProtocolConverter.asFormattingOptions(_,kn.fromConfiguration(m))};return p.sendRequest(Ze.DocumentOnTypeFormattingRequest.type,C,T).then(D=>T.isCancellationRequested?null:p.protocol2CodeConverter.asTextEdits(D,T),D=>p.handleFailedRequest(Ze.DocumentOnTypeFormattingRequest.type,T,D,null))},f=p.middleware;return f.provideOnTypeFormattingEdits?f.provideOnTypeFormattingEdits(s,o,a,u,l,h):h(s,o,a,u,l)}},i=e.moreTriggerCharacter||[];return[wr.languages.registerOnTypeFormattingEditProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n,e.firstTriggerCharacter,...i),n]}};qe.DocumentOnTypeFormattingFeature=aa});var Yu=M(pt=>{"use strict";var Pg=pt&&pt.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Tg=pt&&pt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Ju=pt&&pt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Pg(t,e,n[i]);return Tg(t,e),t}})();Object.defineProperty(pt,"__esModule",{value:!0});pt.RenameFeature=void 0;var Rg=I("vscode"),dn=N(),Og=Ju(ne()),Gu=Ju(He()),ua=B(),la=class extends ua.TextDocumentLanguageFeature{constructor(e){super(e,dn.RenameRequest.type)}fillClientCapabilities(e){let t=(0,ua.ensure)((0,ua.ensure)(e,"textDocument"),"rename");t.dynamicRegistration=!0,t.prepareSupport=!0,t.prepareSupportDefaultBehavior=dn.PrepareSupportDefaultBehavior.Identifier,t.honorsChangeAnnotations=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.renameProvider);n&&(Gu.boolean(e.renameProvider)&&(n.prepareProvider=!1),this.register({id:Og.generateUuid(),registerOptions:n}))}registerLanguageProvider(e){let t=e.documentSelector,n={provideRenameEdits:(i,s,o,a)=>{let u=this._client,l=async(h,f,m,g)=>{let v={textDocument:u.code2ProtocolConverter.asTextDocumentIdentifier(h),position:u.code2ProtocolConverter.asPosition(f),newName:m},_=null;try{_=await u.sendRequest(dn.RenameRequest.type,v,g)}catch(C){return u.handleFailedRequest(dn.RenameRequest.type,g,C,null,!1)}if(g.isCancellationRequested||_===null)return null;let T=await u.protocol2CodeConverter.asWorkspaceEdit(_,g);if(g.isCancellationRequested)return null;if(!u.validateWorkspaceEdit(_))throw new Error("The rename edit returned from the server is not valid anymore and cannot be applied.");return T},p=u.middleware;return p.provideRenameEdits?p.provideRenameEdits(i,s,o,a,l):l(i,s,o,a)},prepareRename:e.prepareProvider?(i,s,o)=>{let a=this._client,u=(p,h,f)=>{let m={textDocument:a.code2ProtocolConverter.asTextDocumentIdentifier(p),position:a.code2ProtocolConverter.asPosition(h)};return a.sendRequest(dn.PrepareRenameRequest.type,m,f).then(g=>f.isCancellationRequested?null:dn.Range.is(g)?a.protocol2CodeConverter.asRange(g):this.isDefaultBehavior(g)?g.defaultBehavior===!0?null:Promise.reject(new Error("The element can't be renamed.")):g&&dn.Range.is(g.range)?{range:a.protocol2CodeConverter.asRange(g.range),placeholder:g.placeholder}:Promise.reject(new Error("The element can't be renamed.")),g=>{throw typeof g.message=="string"?new Error(g.message):new Error("The element can't be renamed.")})},l=a.middleware;return l.prepareRename?l.prepareRename(i,s,o,u):u(i,s,o)}:void 0};return[this.registerProvider(t,n),n]}registerProvider(e,t){return Rg.languages.registerRenameProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}isDefaultBehavior(e){let t=e;return t&&Gu.boolean(t.defaultBehavior)}};pt.RenameFeature=la});var Qu=M(gt=>{"use strict";var Fg=gt&>.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),xg=gt&>.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Mg=gt&>.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Fg(t,e,n[i]);return xg(t,e),t}})();Object.defineProperty(gt,"__esModule",{value:!0});gt.DocumentLinkFeature=void 0;var kg=I("vscode"),gi=N(),da=B(),Eg=Mg(ne()),fa=class extends da.TextDocumentLanguageFeature{constructor(e){super(e,gi.DocumentLinkRequest.type)}fillClientCapabilities(e){let t=(0,da.ensure)((0,da.ensure)(e,"textDocument"),"documentLink");t.dynamicRegistration=!0,t.tooltipSupport=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.documentLinkProvider);n&&this.register({id:Eg.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideDocumentLinks:(i,s)=>{let o=this._client,a=(l,p)=>o.sendRequest(gi.DocumentLinkRequest.type,o.code2ProtocolConverter.asDocumentLinkParams(l),p).then(h=>p.isCancellationRequested?null:o.protocol2CodeConverter.asDocumentLinks(h,p),h=>o.handleFailedRequest(gi.DocumentLinkRequest.type,p,h,null)),u=o.middleware;return u.provideDocumentLinks?u.provideDocumentLinks(i,s,a):a(i,s)},resolveDocumentLink:e.resolveProvider?(i,s)=>{let o=this._client,a=(l,p)=>o.sendRequest(gi.DocumentLinkResolveRequest.type,o.code2ProtocolConverter.asDocumentLink(l),p).then(h=>p.isCancellationRequested?l:o.protocol2CodeConverter.asDocumentLink(h),h=>o.handleFailedRequest(gi.DocumentLinkResolveRequest.type,p,h,l)),u=o.middleware;return u.resolveDocumentLink?u.resolveDocumentLink(i,s,a):a(i,s)}:void 0};return[kg.languages.registerDocumentLinkProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};gt.DocumentLinkFeature=fa});var Xu=M(mt=>{"use strict";var qg=mt&&mt.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Ig=mt&&mt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Ag=mt&&mt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&qg(t,e,n[i]);return Ig(t,e),t}})();Object.defineProperty(mt,"__esModule",{value:!0});mt.ExecuteCommandFeature=void 0;var jg=I("vscode"),ha=N(),Lg=Ag(ne()),Zu=B(),pa=class{_client;_commands;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 ha.ExecuteCommandRequest.type}fillClientCapabilities(e){(0,Zu.ensure)((0,Zu.ensure)(e,"workspace"),"executeCommand").dynamicRegistration=!0}initialize(e){e.executeCommandProvider&&this.register({id:Lg.generateUuid(),registerOptions:Object.assign({},e.executeCommandProvider)})}register(e){let t=this._client,n=t.middleware,i=(s,o)=>{let a={command:s,arguments:o};return t.sendRequest(ha.ExecuteCommandRequest.type,a).then(void 0,u=>t.handleFailedRequest(ha.ExecuteCommandRequest.type,void 0,u,void 0))};if(e.registerOptions.commands){let s=[];for(let o of e.registerOptions.commands)s.push(jg.commands.registerCommand(o,(...a)=>n.executeCommand?n.executeCommand(o,a,i):i(o,a)));this._commands.set(e.id,s)}}unregister(e){let t=this._commands.get(e);t&&(this._commands.delete(e),t.forEach(n=>n.dispose()))}clear(){this._commands.forEach(e=>{e.forEach(t=>t.dispose())}),this._commands.clear()}};mt.ExecuteCommandFeature=pa});var tl=M(Cr=>{"use strict";Object.defineProperty(Cr,"__esModule",{value:!0});Cr.FoldingRangeFeature=void 0;var el=I("vscode"),fn=N(),mi=B(),ga=class extends mi.TextDocumentLanguageFeature{constructor(e){super(e,fn.FoldingRangeRequest.type)}fillClientCapabilities(e){let t=(0,mi.ensure)((0,mi.ensure)(e,"textDocument"),"foldingRange");t.dynamicRegistration=!0,t.rangeLimit=5e3,t.lineFoldingOnly=!0,t.foldingRangeKind={valueSet:[fn.FoldingRangeKind.Comment,fn.FoldingRangeKind.Imports,fn.FoldingRangeKind.Region]},t.foldingRange={collapsedText:!1},(0,mi.ensure)((0,mi.ensure)(e,"workspace"),"foldingRange").refreshSupport=!0}initialize(e,t){this._client.onRequest(fn.FoldingRangeRefreshRequest.type,async()=>{for(let s of this.getAllProviders())s.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 el.EventEmitter,i={onDidChangeFoldingRanges:n.event,provideFoldingRanges:(s,o,a)=>{let u=this._client,l=(h,f,m)=>{let g={textDocument:u.code2ProtocolConverter.asTextDocumentIdentifier(h)};return u.sendRequest(fn.FoldingRangeRequest.type,g,m).then(v=>m.isCancellationRequested?null:u.protocol2CodeConverter.asFoldingRanges(v,m),v=>u.handleFailedRequest(fn.FoldingRangeRequest.type,m,v,null))},p=u.middleware;return p.provideFoldingRanges?p.provideFoldingRanges(s,o,a,l):l(s,o,a)}};return[el.languages.registerFoldingRangeProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),i),{provider:i,onDidChangeFoldingRange:n}]}};Cr.FoldingRangeFeature=ga});var nl=M(br=>{"use strict";Object.defineProperty(br,"__esModule",{value:!0});br.DeclarationFeature=void 0;var Ng=I("vscode"),ma=N(),va=B(),ya=class extends va.TextDocumentLanguageFeature{constructor(e){super(e,ma.DeclarationRequest.type)}fillClientCapabilities(e){let t=(0,va.ensure)((0,va.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,s,o)=>{let a=this._client,u=(p,h,f)=>a.sendRequest(ma.DeclarationRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(p,h),f).then(m=>f.isCancellationRequested?null:a.protocol2CodeConverter.asDeclarationResult(m,f),m=>a.handleFailedRequest(ma.DeclarationRequest.type,f,m,null)),l=a.middleware;return l.provideDeclaration?l.provideDeclaration(i,s,o,u):u(i,s,o)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return Ng.languages.registerDeclarationProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};br.DeclarationFeature=ya});var il=M(Sr=>{"use strict";Object.defineProperty(Sr,"__esModule",{value:!0});Sr.SelectionRangeFeature=void 0;var Ug=I("vscode"),_a=N(),wa=B(),Ca=class extends wa.TextDocumentLanguageFeature{constructor(e){super(e,_a.SelectionRangeRequest.type)}fillClientCapabilities(e){let t=(0,wa.ensure)((0,wa.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,s,o)=>{let a=this._client,u=async(p,h,f)=>{let m={textDocument:a.code2ProtocolConverter.asTextDocumentIdentifier(p),positions:a.code2ProtocolConverter.asPositionsSync(h,f)};return a.sendRequest(_a.SelectionRangeRequest.type,m,f).then(g=>f.isCancellationRequested?null:a.protocol2CodeConverter.asSelectionRanges(g,f),g=>a.handleFailedRequest(_a.SelectionRangeRequest.type,f,g,null))},l=a.middleware;return l.provideSelectionRanges?l.provideSelectionRanges(i,s,o,u):u(i,s,o)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return Ug.languages.registerSelectionRangeProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Sr.SelectionRangeFeature=Ca});var rl=M(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});Dr.CallHierarchyFeature=void 0;var Kg=I("vscode"),hn=N(),ba=B(),Sa=class{client;middleware;constructor(e){this.client=e,this.middleware=e.middleware}prepareCallHierarchy(e,t,n){let i=this.client,s=this.middleware,o=(a,u,l)=>{let p=i.code2ProtocolConverter.asTextDocumentPositionParams(a,u);return i.sendRequest(hn.CallHierarchyPrepareRequest.type,p,l).then(h=>l.isCancellationRequested?null:i.protocol2CodeConverter.asCallHierarchyItems(h,l),h=>i.handleFailedRequest(hn.CallHierarchyPrepareRequest.type,l,h,null))};return s.prepareCallHierarchy?s.prepareCallHierarchy(e,t,n,o):o(e,t,n)}provideCallHierarchyIncomingCalls(e,t){let n=this.client,i=this.middleware,s=(o,a)=>{let u={item:n.code2ProtocolConverter.asCallHierarchyItem(o)};return n.sendRequest(hn.CallHierarchyIncomingCallsRequest.type,u,a).then(l=>a.isCancellationRequested?null:n.protocol2CodeConverter.asCallHierarchyIncomingCalls(l,a),l=>n.handleFailedRequest(hn.CallHierarchyIncomingCallsRequest.type,a,l,null))};return i.provideCallHierarchyIncomingCalls?i.provideCallHierarchyIncomingCalls(e,t,s):s(e,t)}provideCallHierarchyOutgoingCalls(e,t){let n=this.client,i=this.middleware,s=(o,a)=>{let u={item:n.code2ProtocolConverter.asCallHierarchyItem(o)};return n.sendRequest(hn.CallHierarchyOutgoingCallsRequest.type,u,a).then(l=>a.isCancellationRequested?null:n.protocol2CodeConverter.asCallHierarchyOutgoingCalls(l,a),l=>n.handleFailedRequest(hn.CallHierarchyOutgoingCallsRequest.type,a,l,null))};return i.provideCallHierarchyOutgoingCalls?i.provideCallHierarchyOutgoingCalls(e,t,s):s(e,t)}},Da=class extends ba.TextDocumentLanguageFeature{constructor(e){super(e,hn.CallHierarchyPrepareRequest.type)}fillClientCapabilities(e){let t=e,n=(0,ba.ensure)((0,ba.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 Sa(t);return[Kg.languages.registerCallHierarchyProvider(this._client.protocol2CodeConverter.asDocumentSelector(e.documentSelector),n),n]}};Dr.CallHierarchyFeature=Da});var ol=M(vt=>{"use strict";var Hg=vt&&vt.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Wg=vt&&vt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),sl=vt&&vt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Hg(t,e,n[i]);return Wg(t,e),t}})();Object.defineProperty(vt,"__esModule",{value:!0});vt.SemanticTokensFeature=void 0;var Pr=sl(I("vscode")),U=N(),vi=B(),$g=sl(He()),Pa=class extends vi.TextDocumentLanguageFeature{constructor(e){super(e,U.SemanticTokensRegistrationType.type)}fillClientCapabilities(e){let t=(0,vi.ensure)((0,vi.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.comment,U.SemanticTokenTypes.string,U.SemanticTokenTypes.number,U.SemanticTokenTypes.regexp,U.SemanticTokenTypes.operator,U.SemanticTokenTypes.decorator,U.SemanticTokenTypes.label],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,vi.ensure)((0,vi.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,s]=this.getRegistration(t,e.semanticTokensProvider);!i||!s||this.register({id:i,registerOptions:s})}registerLanguageProvider(e){let t=e.documentSelector,n=$g.boolean(e.full)?e.full:e.full!==void 0,i=e.full!==void 0&&typeof e.full!="boolean"&&e.full.delta===!0,s=new Pr.EventEmitter,o=n?{onDidChangeSemanticTokens:s.event,provideDocumentSemanticTokens:(m,g)=>{let v=this._client,_=v.middleware,T=(C,D)=>{let F={textDocument:v.code2ProtocolConverter.asTextDocumentIdentifier(C)};return v.sendRequest(U.SemanticTokensRequest.type,F,D).then(E=>D.isCancellationRequested?null:v.protocol2CodeConverter.asSemanticTokens(E,D),E=>v.handleFailedRequest(U.SemanticTokensRequest.type,D,E,null))};return _.provideDocumentSemanticTokens?_.provideDocumentSemanticTokens(m,g,T):T(m,g)},provideDocumentSemanticTokensEdits:i?(m,g,v)=>{let _=this._client,T=_.middleware,C=(D,F,E)=>{let Q={textDocument:_.code2ProtocolConverter.asTextDocumentIdentifier(D),previousResultId:F};return _.sendRequest(U.SemanticTokensDeltaRequest.type,Q,E).then(async we=>E.isCancellationRequested?null:U.SemanticTokens.is(we)?await _.protocol2CodeConverter.asSemanticTokens(we,E):await _.protocol2CodeConverter.asSemanticTokensEdits(we,E),we=>_.handleFailedRequest(U.SemanticTokensDeltaRequest.type,E,we,null))};return T.provideDocumentSemanticTokensEdits?T.provideDocumentSemanticTokensEdits(m,g,v,C):C(m,g,v)}:void 0}:void 0,u=e.range===!0?{onDidChangeSemanticTokens:s.event,provideDocumentRangeSemanticTokens:(m,g,v)=>{let _=this._client,T=_.middleware,C=(D,F,E)=>{let Q={textDocument:_.code2ProtocolConverter.asTextDocumentIdentifier(D),range:_.code2ProtocolConverter.asRange(F)};return _.sendRequest(U.SemanticTokensRangeRequest.type,Q,E).then(we=>E.isCancellationRequested?null:_.protocol2CodeConverter.asSemanticTokens(we,E),we=>_.handleFailedRequest(U.SemanticTokensRangeRequest.type,E,we,null))};return T.provideDocumentRangeSemanticTokens?T.provideDocumentRangeSemanticTokens(m,g,v,C):C(m,g,v)}}:void 0,l=[],p=this._client,h=p.protocol2CodeConverter.asSemanticTokensLegend(e.legend),f=p.protocol2CodeConverter.asDocumentSelector(t);return o!==void 0&&l.push(Pr.languages.registerDocumentSemanticTokensProvider(f,o,h)),u!==void 0&&l.push(Pr.languages.registerDocumentRangeSemanticTokensProvider(f,u,h)),[new Pr.Disposable(()=>l.forEach(m=>m.dispose())),{range:u,full:o,onDidChangeSemanticTokensEmitter:s}]}};vt.SemanticTokensFeature=Pa});var cl=M(yt=>{"use strict";var Bg=yt&&yt.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),zg=yt&&yt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),al=yt&&yt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Bg(t,e,n[i]);return zg(t,e),t}})();Object.defineProperty(yt,"__esModule",{value:!0});yt.LinkedEditingFeature=void 0;var Vg=al(I("vscode")),Ta=al(N()),Ra=B(),Oa=class extends Ra.TextDocumentLanguageFeature{constructor(e){super(e,Ta.LinkedEditingRangeRequest.type)}fillClientCapabilities(e){let t=(0,Ra.ensure)((0,Ra.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,s,o)=>{let a=this._client,u=(p,h,f)=>a.sendRequest(Ta.LinkedEditingRangeRequest.type,a.code2ProtocolConverter.asTextDocumentPositionParams(p,h),f).then(m=>f.isCancellationRequested?null:a.protocol2CodeConverter.asLinkedEditingRanges(m,f),m=>a.handleFailedRequest(Ta.LinkedEditingRangeRequest.type,f,m,null)),l=a.middleware;return l.provideLinkedEditingRange?l.provideLinkedEditingRange(i,s,o,u):u(i,s,o)}};return[this.registerProvider(t,n),n]}registerProvider(e,t){return Vg.languages.registerLinkedEditingRangeProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};yt.LinkedEditingFeature=Oa});var ul=M(Tr=>{"use strict";Object.defineProperty(Tr,"__esModule",{value:!0});Tr.TypeHierarchyFeature=void 0;var Gg=I("vscode"),pn=N(),Fa=B(),xa=class{client;middleware;constructor(e){this.client=e,this.middleware=e.middleware}prepareTypeHierarchy(e,t,n){let i=this.client,s=this.middleware,o=(a,u,l)=>{let p=i.code2ProtocolConverter.asTextDocumentPositionParams(a,u);return i.sendRequest(pn.TypeHierarchyPrepareRequest.type,p,l).then(h=>l.isCancellationRequested?null:i.protocol2CodeConverter.asTypeHierarchyItems(h,l),h=>i.handleFailedRequest(pn.TypeHierarchyPrepareRequest.type,l,h,null))};return s.prepareTypeHierarchy?s.prepareTypeHierarchy(e,t,n,o):o(e,t,n)}provideTypeHierarchySupertypes(e,t){let n=this.client,i=this.middleware,s=(o,a)=>{let u={item:n.code2ProtocolConverter.asTypeHierarchyItem(o)};return n.sendRequest(pn.TypeHierarchySupertypesRequest.type,u,a).then(l=>a.isCancellationRequested?null:n.protocol2CodeConverter.asTypeHierarchyItems(l,a),l=>n.handleFailedRequest(pn.TypeHierarchySupertypesRequest.type,a,l,null))};return i.provideTypeHierarchySupertypes?i.provideTypeHierarchySupertypes(e,t,s):s(e,t)}provideTypeHierarchySubtypes(e,t){let n=this.client,i=this.middleware,s=(o,a)=>{let u={item:n.code2ProtocolConverter.asTypeHierarchyItem(o)};return n.sendRequest(pn.TypeHierarchySubtypesRequest.type,u,a).then(l=>a.isCancellationRequested?null:n.protocol2CodeConverter.asTypeHierarchyItems(l,a),l=>n.handleFailedRequest(pn.TypeHierarchySubtypesRequest.type,a,l,null))};return i.provideTypeHierarchySubtypes?i.provideTypeHierarchySubtypes(e,t,s):s(e,t)}},Ma=class extends Fa.TextDocumentLanguageFeature{constructor(e){super(e,pn.TypeHierarchyPrepareRequest.type)}fillClientCapabilities(e){let t=(0,Fa.ensure)((0,Fa.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 xa(t);return[Gg.languages.registerTypeHierarchyProvider(t.protocol2CodeConverter.asDocumentSelector(e.documentSelector),n),n]}};Tr.TypeHierarchyFeature=Ma});var dl=M(Or=>{"use strict";Object.defineProperty(Or,"__esModule",{value:!0});Or.InlineValueFeature=void 0;var ll=I("vscode"),Rr=N(),yi=B(),ka=class extends yi.TextDocumentLanguageFeature{constructor(e){super(e,Rr.InlineValueRequest.type)}fillClientCapabilities(e){(0,yi.ensure)((0,yi.ensure)(e,"textDocument"),"inlineValue").dynamicRegistration=!0,(0,yi.ensure)((0,yi.ensure)(e,"workspace"),"inlineValue").refreshSupport=!0}initialize(e,t){this._client.onRequest(Rr.InlineValueRefreshRequest.type,async()=>{for(let s of this.getAllProviders())s.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 ll.EventEmitter,i={onDidChangeInlineValues:n.event,provideInlineValues:(s,o,a,u)=>{let l=this._client,p=(f,m,g,v)=>{let _={textDocument:l.code2ProtocolConverter.asTextDocumentIdentifier(f),range:l.code2ProtocolConverter.asRange(m),context:l.code2ProtocolConverter.asInlineValueContext(g)};return l.sendRequest(Rr.InlineValueRequest.type,_,v).then(T=>v.isCancellationRequested?null:l.protocol2CodeConverter.asInlineValues(T,v),T=>l.handleFailedRequest(Rr.InlineValueRequest.type,v,T,null))},h=l.middleware;return h.provideInlineValues?h.provideInlineValues(s,o,a,u,p):p(s,o,a,u)}};return[this.registerProvider(t,i),{provider:i,onDidChangeInlineValues:n}]}registerProvider(e,t){return ll.languages.registerInlineValuesProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Or.InlineValueFeature=ka});var hl=M(Fr=>{"use strict";Object.defineProperty(Fr,"__esModule",{value:!0});Fr.InlayHintsFeature=void 0;var fl=I("vscode"),En=N(),_i=B(),Ea=class extends _i.TextDocumentLanguageFeature{constructor(e){super(e,En.InlayHintRequest.type)}fillClientCapabilities(e){let t=(0,_i.ensure)((0,_i.ensure)(e,"textDocument"),"inlayHint");t.dynamicRegistration=!0,t.resolveSupport={properties:["tooltip","textEdits","label.tooltip","label.location","label.command"]},(0,_i.ensure)((0,_i.ensure)(e,"workspace"),"inlayHint").refreshSupport=!0}initialize(e,t){this._client.onRequest(En.InlayHintRefreshRequest.type,async()=>{for(let s of this.getAllProviders())s.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 fl.EventEmitter,i={onDidChangeInlayHints:n.event,provideInlayHints:(s,o,a)=>{let u=this._client,l=async(h,f,m)=>{let g={textDocument:u.code2ProtocolConverter.asTextDocumentIdentifier(h),range:u.code2ProtocolConverter.asRange(f)};try{let v=await u.sendRequest(En.InlayHintRequest.type,g,m);return m.isCancellationRequested?null:u.protocol2CodeConverter.asInlayHints(v,m)}catch(v){return u.handleFailedRequest(En.InlayHintRequest.type,m,v,null)}},p=u.middleware;return p.provideInlayHints?p.provideInlayHints(s,o,a,l):l(s,o,a)}};return i.resolveInlayHint=e.resolveProvider===!0?(s,o)=>{let a=this._client,u=async(p,h)=>{try{let f=await a.sendRequest(En.InlayHintResolveRequest.type,a.code2ProtocolConverter.asInlayHint(p),h);if(h.isCancellationRequested)return null;let m=a.protocol2CodeConverter.asInlayHint(f,h);return h.isCancellationRequested?null:m}catch(f){return a.handleFailedRequest(En.InlayHintResolveRequest.type,h,f,null)}},l=a.middleware;return l.resolveInlayHint?l.resolveInlayHint(s,o,u):u(s,o)}:void 0,[this.registerProvider(t,i),{provider:i,onDidChangeInlayHints:n}]}registerProvider(e,t){return fl.languages.registerInlayHintsProvider(this._client.protocol2CodeConverter.asDocumentSelector(e),t)}};Fr.InlayHintsFeature=Ea});var pl=M(Xe=>{"use strict";var Jg=Xe&&Xe.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Yg=Xe&&Xe.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Qg=Xe&&Xe.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Jg(t,e,n[i]);return Yg(t,e),t}})();Object.defineProperty(Xe,"__esModule",{value:!0});Xe.WorkspaceFoldersFeature=void 0;Xe.arrayDiff=Ia;var Zg=Qg(ne()),xr=I("vscode"),wi=N();function qa(r,e){if(r!=null)return r[e]}function Ia(r,e){return r.filter(t=>e.indexOf(t)<0)}var Aa=class{_client;_listeners;_initialFolders;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 wi.DidChangeWorkspaceFoldersNotification.type}fillInitializeParams(e){let t=xr.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(wi.WorkspaceFoldersRequest.type,s=>{let o=()=>{let u=xr.workspace.workspaceFolders;return u===void 0?null:u.map(p=>this.asProtocol(p))},a=t.middleware.workspace;return a&&a.workspaceFolders?a.workspaceFolders(s,o):o(s)});let n=qa(qa(qa(e,"workspace"),"workspaceFolders"),"changeNotifications"),i;typeof n=="string"?i=n:n===!0&&(i=Zg.generateUuid()),i&&this.register({id:i,registerOptions:void 0})}sendInitialEvent(e){let t;if(this._initialFolders&&e){let n=Ia(this._initialFolders,e),i=Ia(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 ${wi.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(wi.DidChangeWorkspaceFoldersNotification.type,n)}register(e){let t=e.id,n=this._client,i=xr.workspace.onDidChangeWorkspaceFolders(s=>{let o=l=>this.doSendEvent(l.added,l.removed),a=n.middleware.workspace;(a&&a.didChangeWorkspaceFolders?a.didChangeWorkspaceFolders(s,o):o(s)).catch(l=>{this._client.error(`Sending notification ${wi.DidChangeWorkspaceFoldersNotification.type.method} failed`,l)})});this._listeners.set(t,i),this.sendInitialEvent(xr.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}}};Xe.WorkspaceFoldersFeature=Aa});var vl=M(ye=>{"use strict";var Xg=ye&&ye.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),em=ye&&ye.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Er=ye&&ye.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Xg(t,e,n[i]);return em(t,e),t}})();Object.defineProperty(ye,"__esModule",{value:!0});ye.WillDeleteFilesFeature=ye.WillRenameFilesFeature=ye.WillCreateFilesFeature=ye.DidDeleteFilesFeature=ye.DidRenameFilesFeature=ye.DidCreateFilesFeature=void 0;var ze=Er(I("vscode")),tm=Er(co()),Lt=Er(N()),nm=Er(ne());function gl(r,e){return r[e]===void 0&&(r[e]={}),r[e]}function im(r,e){return r[e]}function ml(r,e,t){r[e]=t}var Ci=class r{_client;_event;_registrationType;_clientCapability;_serverCapability;_listener;_filters;constructor(e,t,n,i,s){this._client=e,this._event=t,this._registrationType=n,this._clientCapability=i,this._serverCapability=s,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=gl(gl(e,"workspace"),"fileOperations");ml(t,"dynamicRegistration",!0),ml(t,this._clientCapability,!0)}initialize(e){let t=e.workspace?.fileOperations,n=t!==void 0?im(t,this._serverCapability):void 0;if(n?.filters!==void 0)try{this.register({id:nm.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 tm.Minimatch(n.pattern.glob,r.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 r.getFileType(e)}async filter(e,t){let n=await Promise.all(e.files.map(async s=>{let o=t(s),a=o.fsPath.replace(/\\/g,"/");for(let u of this._filters.values())for(let l of u)if(!(l.scheme!==void 0&&l.scheme!==o.scheme)){if(l.matcher.match(a)){if(l.kind===void 0)return!0;let p=await this.getFileType(o);if(p===void 0)return this._client.info(`Unable to determine file type for ${o.toString()}. Treating as a match.`),!0;if(p===ze.FileType.File&&l.kind===Lt.FileOperationPatternKind.file||p===ze.FileType.Directory&&l.kind===Lt.FileOperationPatternKind.folder)return!0}else if(l.kind===Lt.FileOperationPatternKind.folder&&await r.getFileType(o)===ze.FileType.Directory&&l.matcher.match(`${a}/`))return!0}return!1})),i=e.files.filter((s,o)=>n[o]);return{...e,files:i}}static async getFileType(e){try{return(await ze.workspace.fs.stat(e)).type}catch{return}}static asMinimatchOptions(e){let t={dot:!0};return e?.ignoreCase===!0&&(t.nocase=!0),t}},Mr=class extends Ci{_notificationType;_accessUri;_createParams;constructor(e,t,n,i,s,o,a){super(e,t,n,i,s),this._notificationType=n,this._accessUri=o,this._createParams=a}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)}}},kr=class extends Mr{_willListener;_fsPathFileTypes=new Map;async getFileType(e){let t=e.fsPath;if(this._fsPathFileTypes.has(t))return this._fsPathFileTypes.get(t);let n=await Ci.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)}},ja=class extends Mr{constructor(e){super(e,ze.workspace.onDidCreateFiles,Lt.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)}};ye.DidCreateFilesFeature=ja;var La=class extends kr{constructor(e){super(e,ze.workspace.onDidRenameFiles,Lt.DidRenameFilesNotification.type,"didRename","didRename",t=>t.oldUri,e.code2ProtocolConverter.asDidRenameFilesParams)}register(e){this._willListener||(this._willListener=ze.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)}};ye.DidRenameFilesFeature=La;var Na=class extends kr{constructor(e){super(e,ze.workspace.onDidDeleteFiles,Lt.DidDeleteFilesNotification.type,"didDelete","didDelete",t=>t,e.code2ProtocolConverter.asDidDeleteFilesParams)}register(e){this._willListener||(this._willListener=ze.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)}};ye.DidDeleteFilesFeature=Na;var bi=class extends Ci{_requestType;_accessUri;_createParams;constructor(e,t,n,i,s,o,a){super(e,t,n,i,s),this._requestType=n,this._accessUri=o,this._createParams=a}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}},Ua=class extends bi{constructor(e){super(e,ze.workspace.onWillCreateFiles,Lt.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)}};ye.WillCreateFilesFeature=Ua;var Ka=class extends bi{constructor(e){super(e,ze.workspace.onWillRenameFiles,Lt.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)}};ye.WillRenameFilesFeature=Ka;var Ha=class extends bi{constructor(e){super(e,ze.workspace.onWillDeleteFiles,Lt.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)}};ye.WillDeleteFilesFeature=Ha});var yl=M(_t=>{"use strict";var rm=_t&&_t.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),sm=_t&&_t.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),om=_t&&_t.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&rm(t,e,n[i]);return sm(t,e),t}})();Object.defineProperty(_t,"__esModule",{value:!0});_t.InlineCompletionItemFeature=void 0;var am=I("vscode"),Wa=N(),$a=B(),cm=om(ne()),Ba=class extends $a.TextDocumentLanguageFeature{constructor(e){super(e,Wa.InlineCompletionRequest.type)}fillClientCapabilities(e){let t=(0,$a.ensure)((0,$a.ensure)(e,"textDocument"),"inlineCompletion");t.dynamicRegistration=!0}initialize(e,t){let n=this.getRegistrationOptions(t,e.inlineCompletionProvider);n&&this.register({id:cm.generateUuid(),registerOptions:n})}registerLanguageProvider(e){let t=e.documentSelector,n={provideInlineCompletionItems:(i,s,o,a)=>{let u=this._client,l=this._client.middleware,p=(h,f,m,g)=>u.sendRequest(Wa.InlineCompletionRequest.type,u.code2ProtocolConverter.asInlineCompletionParams(h,f,m),g).then(v=>g.isCancellationRequested?null:u.protocol2CodeConverter.asInlineCompletionResult(v,g),v=>u.handleFailedRequest(Wa.InlineCompletionRequest.type,g,v,null));return l.provideInlineCompletionItems?l.provideInlineCompletionItems(i,s,o,a,p):p(i,s,o,a)}};return[am.languages.registerInlineCompletionItemProvider(this._client.protocol2CodeConverter.asDocumentSelector(t),n),n]}};_t.InlineCompletionItemFeature=Ba});var Cl=M(wt=>{"use strict";var um=wt&&wt.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),lm=wt&&wt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),wl=wt&&wt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&um(t,e,n[i]);return lm(t,e),t}})();Object.defineProperty(wt,"__esModule",{value:!0});wt.TextDocumentContentFeature=void 0;var za=wl(I("vscode")),qn=N(),_l=B(),dm=wl(ne()),Va=class{_client;_registrations=new Map;constructor(e){this._client=e}getState(){let e=this._registrations.size>0;return{kind:"workspace",id:qn.TextDocumentContentRequest.method,registrations:e}}get registrationType(){return qn.TextDocumentContentRequest.type}getProviders(){let e=[];for(let t of this._registrations.values())e.push(...t.providers);return e}fillClientCapabilities(e){let t=(0,_l.ensure)((0,_l.ensure)(e,"workspace"),"textDocumentContent");t.dynamicRegistration=!0}initialize(e){let t=this._client;if(t.onRequest(qn.TextDocumentContentRefreshRequest.type,async s=>{let o=t.protocol2CodeConverter.asUri(s.uri);for(let a of this._registrations.values())for(let u of a.providers)u.scheme===o.scheme&&u.onDidChangeEmitter.fire(o)}),!e?.workspace?.textDocumentContent)return;let n=e.workspace.textDocumentContent,i=qn.StaticRegistrationOptions.hasId(n)?n.id:dm.generateUuid();this.register({id:i,registerOptions:n})}register(e){let t=[],n=[];for(let i of e.registerOptions.schemes){let[s,o]=this.registerTextDocumentContentProvider(i);t.push(o),n.push(s)}this._registrations.set(e.id,{disposable:za.Disposable.from(...n),providers:t})}registerTextDocumentContentProvider(e){let t=new za.EventEmitter,n={onDidChange:t.event,provideTextDocumentContent:(i,s)=>{let o=this._client,a=(l,p)=>{let h={uri:o.code2ProtocolConverter.asUri(l)};return o.sendRequest(qn.TextDocumentContentRequest.type,h,p).then(f=>p.isCancellationRequested?null:f.text,f=>o.handleFailedRequest(qn.TextDocumentContentRequest.type,p,f,null))},u=o.middleware;return u.provideTextDocumentContent?u.provideTextDocumentContent(i,s,a):a(i,s)}};return[za.workspace.registerTextDocumentContentProvider(e,n),{scheme:e,onDidChangeEmitter:t,provider:n}]}unregister(e){let t=this._registrations.get(e);t!==void 0&&(this._registrations.delete(e),t.disposable.dispose())}clear(){this._registrations.forEach(e=>{e.disposable.dispose()}),this._registrations.clear()}};wt.TextDocumentContentFeature=Va});var bl=M(Ir=>{"use strict";Object.defineProperty(Ir,"__esModule",{value:!0});Ir.FileSystemWatcherFeature=void 0;var fm=I("vscode"),gn=N(),qr=B(),Ga=class{_client;_notifyFileEvent;_watchers;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 gn.DidChangeWatchedFilesNotification.type}fillClientCapabilities(e){(0,qr.ensure)((0,qr.ensure)(e,"workspace"),"didChangeWatchedFiles").dynamicRegistration=!0,(0,qr.ensure)((0,qr.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 s=!0,o=!0,a=!0;n.kind!==void 0&&n.kind!==null&&(s=(n.kind&gn.WatchKind.Create)!==0,o=(n.kind&gn.WatchKind.Change)!==0,a=(n.kind&gn.WatchKind.Delete)!==0);let u=fm.workspace.createFileSystemWatcher(i,!s,!o,!a);this.hookListeners(u,s,o,a,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,s){t&&e.onDidCreate(o=>this._notifyFileEvent({uri:this._client.code2ProtocolConverter.asUri(o),type:gn.FileChangeType.Created}),null,s),n&&e.onDidChange(o=>this._notifyFileEvent({uri:this._client.code2ProtocolConverter.asUri(o),type:gn.FileChangeType.Changed}),null,s),i&&e.onDidDelete(o=>this._notifyFileEvent({uri:this._client.code2ProtocolConverter.asUri(o),type:gn.FileChangeType.Deleted}),null,s)}unregister(e){let t=this._watchers.get(e);if(t){this._watchers.delete(e);for(let n of t)n.dispose()}}clear(){this._watchers.forEach(e=>{for(let t of e)t.dispose()}),this._watchers.clear()}};Ir.FileSystemWatcherFeature=Ga});var Dl=M(Ar=>{"use strict";Object.defineProperty(Ar,"__esModule",{value:!0});Ar.ProgressFeature=void 0;var Sl=N(),hm=Ys();function pm(r,e){return r[e]===void 0&&(r[e]=Object.create(null)),r[e]}var Ja=class{_client;activeParts;constructor(e){this._client=e,this.activeParts=new Set}getState(){return{kind:"window",id:Sl.WorkDoneProgressCreateRequest.method,registrations:this.activeParts.size>0}}fillClientCapabilities(e){pm(e,"window").workDoneProgress=!0}initialize(){let e=this._client,t=i=>{this.activeParts.delete(i)},n=i=>{this.activeParts.add(new hm.ProgressPart(this._client,i.token,t))};e.onRequest(Sl.WorkDoneProgressCreateRequest.type,n)}clear(){for(let e of this.activeParts)e.done();this.activeParts.clear()}};Ar.ProgressFeature=Ja});var rc=M(Y=>{"use strict";var gm=Y&&Y.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),mm=Y&&Y.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Nr=Y&&Y.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&gm(t,e,n[i]);return mm(t,e),t}})();Object.defineProperty(Y,"__esModule",{value:!0});Y.ProposedFeatures=Y.LanguageClient=Y.BaseLanguageClient=Y.ShutdownMode=Y.MessageTransports=Y.SuspendMode=Y.State=Y.CloseAction=Y.ErrorAction=Y.RevealOutputChannelOn=void 0;var j=I("vscode"),S=N(),vm=Nr($c()),ym=Nr(Vc()),et=Nr(He()),jr=Qi(),Pl=Nr(ne()),_m=Ys(),Le=B(),wm=vo(),Qa=Ru(),Tl=xu(),In=Mu(),Cm=ku(),bm=Eu(),Sm=qu(),Dm=Au(),Pm=ju(),Tm=Wo(),Rm=Nu(),Om=Uu(),Fm=Ku(),xm=Hu(),Mm=Wu(),km=$u(),Em=zu(),Ya=Vu(),qm=Yu(),Im=Qu(),Am=Xu(),jm=tl(),Lm=nl(),Nm=il(),Um=rl(),Km=ol(),Hm=cl(),Wm=ul(),$m=dl(),Bm=hl(),zm=pl(),An=vl(),Vm=yl(),Gm=Cl(),Jm=bl(),Ym=Dl(),mn;(function(r){r[r.Debug=0]="Debug",r[r.Info=1]="Info",r[r.Warn=2]="Warn",r[r.Error=3]="Error",r[r.Never=4]="Never"})(mn||(Y.RevealOutputChannelOn=mn={}));var Si;(function(r){r[r.Continue=1]="Continue",r[r.Shutdown=2]="Shutdown"})(Si||(Y.ErrorAction=Si={}));var Xt;(function(r){r[r.DoNotRestart=1]="DoNotRestart",r[r.Restart=2]="Restart"})(Xt||(Y.CloseAction=Xt={}));var jn;(function(r){r[r.Stopped=1]="Stopped",r[r.Starting=3]="Starting",r[r.StartFailed=4]="StartFailed",r[r.Running=2]="Running"})(jn||(Y.State=jn={}));var Rl;(function(r){r.off="off",r.on="on"})(Rl||(Y.SuspendMode=Rl={}));var Za;(function(r){function e(t){return t==null?!1:typeof t=="boolean"||typeof t=="object"&&t!==null&&et.stringArray(t.enabledCommands)?t:!1}r.sanitizeIsTrusted=e})(Za||(Za={}));var Xa=class{client;maxRestartCount;restarts;constructor(e,t){this.client=e,this.maxRestartCount=t,this.restarts=[]}error(e,t,n){return n&&n<=3?{action:Si.Continue}:{action:Si.Shutdown}}closed(){return this.restarts.push(Date.now()),this.restarts.length<=this.maxRestartCount?{action:Xt.Restart}:this.restarts[this.restarts.length-1]-this.restarts[0]<=180*1e3?{action:Xt.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:Xt.Restart})}},K;(function(r){r.Initial="initial",r.Starting="starting",r.StartFailed="startFailed",r.Running="running",r.Stopping="stopping",r.Stopped="stopped"})(K||(K={}));var Ol;(function(r){function e(t){return t&&S.MessageReader.is(t.reader)&&S.MessageWriter.is(t.writer)}r.is=e})(Ol||(Y.MessageTransports=Ol={}));var Zt;(function(r){r.Restart="restart",r.Stop="stop"})(Zt||(Y.ShutdownMode=Zt={}));var ec=class r{open;_onOpen;_onClose;disposables;constructor(){this.disposables=[],this.open=new Set,this._onOpen=new j.EventEmitter,this._onClose=new j.EventEmitter,r.fillVisibleResources(this.open);let e=()=>{let t=this.open,n=new Set;r.fillVisibleResources(n);let i=new Set,s=new Set(n);for(let o of t.values())n.has(o)?s.delete(o):i.add(o);if(this.open=n,i.size>0){let o=new Set;for(let a of i)o.add(j.Uri.parse(a));this._onClose.fire(o)}if(s.size>0){let o=new Set;for(let a of s)o.add(j.Uri.parse(a));this._onOpen.fire(o)}};this.disposables.push(j.window.tabGroups.onDidChangeTabs(t=>{t.closed.length===0&&t.opened.length===0||e()})),this.disposables.push(j.window.onDidChangeVisibleTextEditors(t=>{e()}))}get onClose(){return this._onClose.event}get onOpen(){return this._onOpen.event}dispose(){this.disposables.forEach(e=>e.dispose())}isActive(e){return e instanceof j.Uri?j.window.activeTextEditor?.document.uri===e:j.window.activeTextEditor?.document===e}isVisible(e){let t=e instanceof j.Uri?e:e.uri;return t.scheme===Qa.NotebookDocumentSyncFeature.CellScheme?j.workspace.notebookDocuments.some(n=>this.open.has(n.uri.toString())?n.getCells().find(s=>s.document.uri.toString()===t.toString())!==void 0:!1):this.open.has(t.toString())}getResources(){let e=new Set;return r.fillVisibleResources(new Set,e),e}static fillVisibleResources(e,t){let n=e??new Set;for(let i of j.window.tabGroups.all)for(let s of i.tabs){let o=s.input,a;o instanceof j.TabInputText?a=o.uri:o instanceof j.TabInputTextDiff?a=o.modified:(o instanceof j.TabInputCustom||o instanceof j.TabInputNotebook)&&(a=o.uri),a!==void 0&&!n.has(a.toString())&&(n.add(a.toString()),t!==void 0&&t.add(a))}for(let i of j.window.visibleTextEditors){let s=i.document.uri;n.has(s.toString())||(n.add(s.toString()),t!==void 0&&t.add(s))}}},Lr=class r{_id;_name;_clientOptions;_state;_onStart;_onStop;_connection;_idleInterval;_ignoredRegistrations;_listeners;_disposed;_notificationHandlers;_notificationDisposables;_pendingNotificationHandlers;_requestHandlers;_requestDisposables;_pendingRequestHandlers;_progressHandlers;_pendingProgressHandlers;_progressDisposables;_initializeResult;_outputChannel;_disposeOutputChannel;_traceOutputChannel;_traceLogLevel;_capabilities;_diagnostics;_syncedDocuments;_didChangeTextDocumentFeature;_inFlightOpenNotifications;_pendingChangeSemaphore;_pendingChangeDelayer;_didOpenTextDocumentFeature;_fileEvents;_fileEventDelayer;_telemetryEmitter;_stateChangeEmitter;_trace;_traceFormat=S.TraceFormat.Text;_tracer;_c2p;_p2c;_visibleDocuments;constructor(e,t,n){this._id=e,this._name=t,n=n||{};let i={isTrusted:!1,supportHtml:!1,supportThemeIcons:!1};n.markdown!==void 0&&(i.isTrusted=Za.sanitizeIsTrusted(n.markdown.isTrusted),i.supportHtml=n.markdown.supportHtml===!0,i.supportThemeIcons=n.markdown.supportThemeIcons===!0),this._clientOptions={documentSelector:n.documentSelector??[],synchronize:n.synchronize??{},diagnosticCollectionName:n.diagnosticCollectionName,outputChannelName:n.outputChannelName??this._name,revealOutputChannelOn:n.revealOutputChannelOn??mn.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??{},textSynchronization:this.createTextSynchronizationOptions(n.textSynchronization)},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._traceLogLevel=this._outputChannel.logLevel):(this._outputChannel=void 0,this._disposeOutputChannel=!0,this._traceLogLevel=j.LogLevel.Info),this._traceOutputChannel=n.traceOutputChannel,this._traceOutputChannel!==void 0&&(this._traceLogLevel=this._traceOutputChannel.logLevel),this._diagnostics=void 0,this._inFlightOpenNotifications=new Set,this._pendingChangeSemaphore=new jr.Semaphore(1),this._pendingChangeDelayer=new jr.Delayer(250),this._fileEvents=[],this._fileEventDelayer=new jr.Delayer(250),this._onStop=void 0,this._telemetryEmitter=new S.Emitter,this._stateChangeEmitter=new S.Emitter,this._trace=S.Trace.Off,this._tracer={log:(s,o)=>{et.string(s)?this.trace(s,o):this.traceObject(s)}},this._c2p=vm.createConverter(n.uriConverters?n.uriConverters.code2Protocol:void 0),this._p2c=ym.createConverter(n.uriConverters?n.uriConverters.protocol2Code:void 0,this._clientOptions.markdown.isTrusted,this._clientOptions.markdown.supportHtml,this._clientOptions.markdown.supportThemeIcons),this._syncedDocuments=new Map,this.registerBuiltinFeatures()}createTextSynchronizationOptions(e){return e?typeof e.delayOpenNotifications=="boolean"?{delayOpenNotifications:e.delayOpenNotifications}:{delayOpenNotifications:!1}:{delayOpenNotifications:!1}}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 visibleDocuments(){return this._visibleDocuments===void 0&&(this._visibleDocuments=new ec),this._visibleDocuments}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,{log:!0}),this._traceOutputChannel===void 0&&(this._traceLogLevel=this._outputChannel.logLevel)),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 jn.Starting;case K.Running:return jn.Running;case K.StartFailed:return jn.StartFailed;default:return jn.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 S.ResponseError(S.ErrorCodes.ConnectionInactive,"Client is not running"));let n=await this.$start();await this._didOpenTextDocumentFeature.sendPendingOpenNotifications(),this._didChangeTextDocumentFeature.syncKind===S.TextDocumentSyncKind.Full&&await this.sendPendingFullTextDocumentChanges(n);let i,s;if(t.length===1?S.CancellationToken.is(t[0])?s=t[0]:i=t[0]:t.length===2&&(i=t[0],s=t[1]),s!==void 0&&s.isCancellationRequested)return Promise.reject(new S.ResponseError(S.LSPErrorCodes.RequestCancelled,"Request got cancelled"));let o=this._clientOptions.middleware?.sendRequest;return o!==void 0?o(e,i,s,(a,u,l)=>{let p=[];return u!==void 0&&p.push(u),l!==void 0&&p.push(l),n.sendRequest(a,...p)}):n.sendRequest(e,...t)}onRequest(e,t){let n=typeof e=="string"?e:e.method;this._requestHandlers.set(n,t);let i=this.activeConnection(),s;return i!==void 0?(this._requestDisposables.set(n,i.onRequest(e,t)),s={dispose:()=>{let o=this._requestDisposables.get(n);o!==void 0&&(o.dispose(),this._requestDisposables.delete(n))}}):(this._pendingRequestHandlers.set(n,t),s={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),s.dispose()}}}async sendNotification(e,t){if(this.$state===K.StartFailed||this.$state===K.Stopping||this.$state===K.Stopped)return Promise.reject(new S.ResponseError(S.ErrorCodes.ConnectionInactive,"Client is not running"));let n=this._didChangeTextDocumentFeature.syncKind===S.TextDocumentSyncKind.Full,i;n&&typeof e!="string"&&e.method===S.DidOpenTextDocumentNotification.method&&(i=t?.textDocument.uri,this._inFlightOpenNotifications.add(i));let s;typeof e!="string"&&e.method===S.DidCloseTextDocumentNotification.method&&(s=t.textDocument.uri);let o=await this.$start();if(await this._didOpenTextDocumentFeature.sendPendingOpenNotifications(s))return;n&&await this.sendPendingFullTextDocumentChanges(o),i!==void 0&&this._inFlightOpenNotifications.delete(i);let u=this._clientOptions.middleware?.sendNotification;return u?u(e,o.sendNotification.bind(o),t):o.sendNotification(e,t)}onNotification(e,t){let n=typeof e=="string"?e:e.method;this._notificationHandlers.set(n,t);let i=this.activeConnection(),s;return i!==void 0?(this._notificationDisposables.set(n,i.onNotification(e,t)),s={dispose:()=>{let o=this._notificationDisposables.get(n);o!==void 0&&(o.dispose(),this._notificationDisposables.delete(n))}}):(this._pendingNotificationHandlers.set(n,t),s={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),s.dispose()}}}async sendProgress(e,t,n){if(this.$state===K.StartFailed||this.$state===K.Stopping||this.$state===K.Stopped)return Promise.reject(new S.ResponseError(S.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(),s,o=this._clientOptions.middleware?.handleWorkDoneProgress,a=S.WorkDoneProgress.is(e)&&o!==void 0?u=>{o(t,u,()=>n(u))}:n;return i!==void 0?(this._progressDisposables.set(t,i.onProgress(e,t,a)),s={dispose:()=>{let u=this._progressDisposables.get(t);u!==void 0&&(u.dispose(),this._progressDisposables.delete(t))}}):(this._pendingProgressHandlers.set(t,{type:e,handler:n}),s={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),s.dispose()}}}createDefaultErrorHandler(e){if(e!==void 0&&e<0)throw new Error(`Invalid maxRestartCount: ${e}`);return new Xa(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 S.ResponseError){let t=e;return` Message: ${t.message}
|
|
9
9
|
Code: ${t.code} ${t.data?`
|
|
10
10
|
`+t.data.toString():""}`}return e instanceof Error?et.string(e.stack)?e.stack:e.message:et.string(e)?e:e.toString()}shouldLogToOutputChannel(){return this.$state!==K.Stopped?!0:this._outputChannel!==void 0}error(e,t,n=!0){this.shouldLogToOutputChannel()&&this.outputChannel.error(this.getLogMessage(e,t)),(n==="force"||n&&this._clientOptions.revealOutputChannelOn<=mn.Error)&&this.showNotificationMessage(S.MessageType.Error,e,t)}warn(e,t,n=!0){this.shouldLogToOutputChannel()&&this.outputChannel.warn(this.getLogMessage(e,t)),n&&this._clientOptions.revealOutputChannelOn<=mn.Warn&&this.showNotificationMessage(S.MessageType.Warning,e,t)}info(e,t,n=!0){this.shouldLogToOutputChannel()&&this.outputChannel.info(this.getLogMessage(e,t)),n&&this._clientOptions.revealOutputChannelOn<=mn.Info&&this.showNotificationMessage(S.MessageType.Info,e,t)}debug(e,t,n=!0){this.shouldLogToOutputChannel()&&this.outputChannel.debug(this.getLogMessage(e,t)),n&&this._clientOptions.revealOutputChannelOn<=mn.Debug&&this.showNotificationMessage(S.MessageType.Debug,e,t)}trace(e,t){this.traceOutputChannel.trace(this.getLogMessage(e,t))}traceObject(e){this.traceOutputChannel.trace(JSON.stringify(e))}showNotificationMessage(e,t,n){t=t??"A request has failed. See the output for more information.",n&&(t+=`
|
|
11
11
|
`+this.data2String(n)),(e===S.MessageType.Error?j.window.showErrorMessage:e===S.MessageType.Warning?j.window.showWarningMessage:j.window.showInformationMessage)(t,"Go to output").then(s=>{s!==void 0&&this.outputChannel.show(!0)})}getLogMessage(e,t){return t!=null?`${e}
|
|
12
|
-
${this.data2String(t)}`: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=j.languages.createDiagnosticCollection(this._clientOptions.diagnosticCollectionName??this._id));for(let[i,s]of this._notificationHandlers)this._pendingNotificationHandlers.has(i)||this._pendingNotificationHandlers.set(i,s);for(let[i,s]of this._requestHandlers)this._pendingRequestHandlers.has(i)||this._pendingRequestHandlers.set(i,s);for(let[i,s]of this._progressHandlers)this._pendingProgressHandlers.has(i)||this._pendingProgressHandlers.set(i,s);this.$state=K.Starting;try{let i=await this.createConnection();i.onNotification(S.LogMessageNotification.type,s=>{switch(s.type){case S.MessageType.Error:this.error(s.message,void 0,!1);break;case S.MessageType.Warning:this.warn(s.message,void 0,!1);break;case S.MessageType.Info:this.info(s.message,void 0,!1);break;case S.MessageType.Debug:this.debug(s.message,void 0,!1);break;default:this.outputChannel.appendLine(s.message)}}),i.onNotification(S.ShowMessageNotification.type,s=>{switch(s.type){case S.MessageType.Error:j.window.showErrorMessage(s.message);break;case S.MessageType.Warning:j.window.showWarningMessage(s.message);break;case S.MessageType.Info:j.window.showInformationMessage(s.message);break;default:j.window.showInformationMessage(s.message)}}),i.onRequest(S.ShowMessageRequest.type,s=>{let o;switch(s.type){case S.MessageType.Error:o=j.window.showErrorMessage;break;case S.MessageType.Warning:o=j.window.showWarningMessage;break;case S.MessageType.Info:o=j.window.showInformationMessage;break;default:o=j.window.showInformationMessage}let a=s.actions||[];return o(s.message,...a)}),i.onNotification(S.TelemetryEventNotification.type,s=>{this._telemetryEmitter.fire(s)}),i.onRequest(S.ShowDocumentRequest.type,async(s,o)=>{let a=async l=>{let p=this.protocol2CodeConverter.asUri(l.uri);try{if(l.external===!0)return{success:await j.env.openExternal(p)};{let h={};return l.selection!==void 0&&(h.selection=this.protocol2CodeConverter.asRange(l.selection)),l.takeFocus===void 0||l.takeFocus===!1?h.preserveFocus=!0:l.takeFocus===!0&&(h.preserveFocus=!1),await j.window.showTextDocument(p,h),{success:!0}}}catch{return{success:!1}}},u=this._clientOptions.middleware.window?.showDocument;return u!==void 0?u(s,o,a):a(s)}),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,s)=>{e=i,t=s}),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],s={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:et.func(t)?t():t,trace:S.Trace.toString(this._trace),workspaceFolders:i};if(this.fillInitializeParams(s),this._clientOptions.progressOnInitialization){let o=Dl.generateUuid(),a=new ym.ProgressPart(e,o);s.workDoneToken=o;try{let u=await this.doInitialize(e,s);return a.done(),u}catch(u){throw a.cancel(),u}}else return this.doInitialize(e,s)}async doInitialize(e,t){try{let n=await e.initialize(t);if(n.capabilities.positionEncoding!==void 0&&n.capabilities.positionEncoding!==S.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;et.number(n.capabilities.textDocumentSync)?n.capabilities.textDocumentSync===S.TextDocumentSyncKind.None?i={openClose:!1,change:S.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(S.PublishDiagnosticsNotification.type,s=>this.handleDiagnostics(s)),e.onRequest(S.RegistrationRequest.type,s=>this.handleRegistrationRequest(s)),e.onRequest("client/registerFeature",s=>this.handleRegistrationRequest(s)),e.onRequest(S.UnregistrationRequest.type,s=>this.handleUnregistrationRequest(s)),e.onRequest("client/unregisterFeature",s=>this.handleUnregistrationRequest(s)),e.onRequest(S.ApplyWorkspaceEditRequest.type,s=>this.handleApplyWorkspaceEdit(s));for(let[s,o]of this._pendingNotificationHandlers)this._notificationDisposables.set(s,e.onNotification(s,o));this._pendingNotificationHandlers.clear();for(let[s,o]of this._pendingRequestHandlers)this._requestDisposables.set(s,e.onRequest(s,o));this._pendingRequestHandlers.clear();for(let[s,o]of this._pendingProgressHandlers)this._progressDisposables.set(s,e.onProgress(o.type,s,o.handler));return this._pendingProgressHandlers.clear(),await e.sendNotification(S.InitializedNotification.type,{}),this.hookFileEvents(e),this.hookLogLevelChanged(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 S.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(Zt.Stop,e)}dispose(e=2e3){try{return this._disposed="disposing",this.stop(e)}finally{this._disposed="disposed"}}async shutdown(e,t=2e3){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(o=>{(0,S.RAL)().timer.setTimeout(o,t)}),s=(async o=>(await o.shutdown(),await o.exit(),o))(n);return this._onStop=Promise.race([i,s]).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=K.Stopped,e===Zt.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===Zt.Stop||e===Zt.Restart)&&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(s){return t._fileEvents.push(s),t._fileEventDelayer.trigger(async()=>{let o=t._fileEvents;t._fileEvents=[];try{await t.sendNotification(S.DidChangeWatchedFilesNotification.type,{changes:o})}catch(a){throw t._fileEvents.push(...o),a}})}let i=this.clientOptions.middleware?.workspace;(i?.didChangeWatchedFile?i.didChangeWatchedFile(e,n):n(e)).catch(s=>{t.error("Notifying file events failed.",s)})}async sendPendingFullTextDocumentChanges(e){return this._pendingChangeSemaphore.lock(async()=>{try{let t=this._didChangeTextDocumentFeature.getPendingDocumentChanges(this._inFlightOpenNotifications);if(t.length===0)return;for(let n of t){let i=this.code2ProtocolConverter.asChangeTextDocumentParams(n);await e.sendNotification(S.DidChangeTextDocumentNotification.type,i),this._didChangeTextDocumentFeature.notificationSent(n,S.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))}_diagnosticQueue=new Map;_diagnosticQueueState={state:"idle"};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,S.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(s=>{if(!i.token.isCancellationRequested){let o=this._p2c.asUri(t),a=this.clientOptions.middleware;a.handleDiagnostics?a.handleDiagnostics(o,s,(u,l)=>this.setDiagnostics(u,l)):this.setDiagnostics(o,s)}}).catch(s=>{this.error("Processing diagnostic queue failed.",s)}).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,s,o)=>{this.handleConnectionError(i,s,o).catch(a=>this.error("Handling connection error failed",a))},t=()=>{this.handleConnectionClosed().catch(i=>this.error("Handling connection close failed",i))},n=await this.createMessageTransports(this._clientOptions.stdioEncoding||"utf8");return this._connection=Ym(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:Xt.DoNotRestart};if(this.$state!==K.Stopping)try{e=await this._clientOptions.errorHandler.closed()}catch{}this._connection=void 0,e.action===Xt.DoNotRestart?(this.error(e.message??"Connection to server got closed. Server will not be restarted.",void 0,e.handled===!0?!1:"force"),this.cleanUp(Zt.Stop),this.$state===K.Starting?this.$state=K.StartFailed:this.$state=K.Stopped,this._onStop=Promise.resolve(),this._onStart=void 0):e.action===Xt.Restart&&(this.info(e.message??"Connection to server got closed. Server will restart.",void 0,!e.handled),this.cleanUp(Zt.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===Si.Shutdown?(this.error(i.message??`Client ${this._name}: connection to server is erroring.
|
|
12
|
+
${this.data2String(t)}`: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=j.languages.createDiagnosticCollection(this._clientOptions.diagnosticCollectionName??this._id));for(let[i,s]of this._notificationHandlers)this._pendingNotificationHandlers.has(i)||this._pendingNotificationHandlers.set(i,s);for(let[i,s]of this._requestHandlers)this._pendingRequestHandlers.has(i)||this._pendingRequestHandlers.set(i,s);for(let[i,s]of this._progressHandlers)this._pendingProgressHandlers.has(i)||this._pendingProgressHandlers.set(i,s);this.$state=K.Starting;try{let i=await this.createConnection();i.onNotification(S.LogMessageNotification.type,s=>{switch(s.type){case S.MessageType.Error:this.error(s.message,void 0,!1);break;case S.MessageType.Warning:this.warn(s.message,void 0,!1);break;case S.MessageType.Info:this.info(s.message,void 0,!1);break;case S.MessageType.Debug:this.debug(s.message,void 0,!1);break;default:this.outputChannel.appendLine(s.message)}}),i.onNotification(S.ShowMessageNotification.type,s=>{switch(s.type){case S.MessageType.Error:j.window.showErrorMessage(s.message);break;case S.MessageType.Warning:j.window.showWarningMessage(s.message);break;case S.MessageType.Info:j.window.showInformationMessage(s.message);break;default:j.window.showInformationMessage(s.message)}}),i.onRequest(S.ShowMessageRequest.type,s=>{let o;switch(s.type){case S.MessageType.Error:o=j.window.showErrorMessage;break;case S.MessageType.Warning:o=j.window.showWarningMessage;break;case S.MessageType.Info:o=j.window.showInformationMessage;break;default:o=j.window.showInformationMessage}let a=s.actions||[];return o(s.message,...a)}),i.onNotification(S.TelemetryEventNotification.type,s=>{this._telemetryEmitter.fire(s)}),i.onRequest(S.ShowDocumentRequest.type,async(s,o)=>{let a=async l=>{let p=this.protocol2CodeConverter.asUri(l.uri);try{if(l.external===!0)return{success:await j.env.openExternal(p)};{let h={};return l.selection!==void 0&&(h.selection=this.protocol2CodeConverter.asRange(l.selection)),l.takeFocus===void 0||l.takeFocus===!1?h.preserveFocus=!0:l.takeFocus===!0&&(h.preserveFocus=!1),await j.window.showTextDocument(p,h),{success:!0}}}catch{return{success:!1}}},u=this._clientOptions.middleware.window?.showDocument;return u!==void 0?u(s,o,a):a(s)}),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,s)=>{e=i,t=s}),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],s={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:et.func(t)?t():t,trace:S.Trace.toString(this._trace),workspaceFolders:i};if(this.fillInitializeParams(s),this._clientOptions.progressOnInitialization){let o=Pl.generateUuid(),a=new _m.ProgressPart(e,o);s.workDoneToken=o;try{let u=await this.doInitialize(e,s);return a.done(),u}catch(u){throw a.cancel(),u}}else return this.doInitialize(e,s)}async doInitialize(e,t){try{let n=await e.initialize(t);if(n.capabilities.positionEncoding!==void 0&&n.capabilities.positionEncoding!==S.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;et.number(n.capabilities.textDocumentSync)?n.capabilities.textDocumentSync===S.TextDocumentSyncKind.None?i={openClose:!1,change:S.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(S.PublishDiagnosticsNotification.type,s=>this.handleDiagnostics(s)),e.onRequest(S.RegistrationRequest.type,s=>this.handleRegistrationRequest(s)),e.onRequest("client/registerFeature",s=>this.handleRegistrationRequest(s)),e.onRequest(S.UnregistrationRequest.type,s=>this.handleUnregistrationRequest(s)),e.onRequest("client/unregisterFeature",s=>this.handleUnregistrationRequest(s)),e.onRequest(S.ApplyWorkspaceEditRequest.type,s=>this.handleApplyWorkspaceEdit(s));for(let[s,o]of this._pendingNotificationHandlers)this._notificationDisposables.set(s,e.onNotification(s,o));this._pendingNotificationHandlers.clear();for(let[s,o]of this._pendingRequestHandlers)this._requestDisposables.set(s,e.onRequest(s,o));this._pendingRequestHandlers.clear();for(let[s,o]of this._pendingProgressHandlers)this._progressDisposables.set(s,e.onProgress(o.type,s,o.handler));return this._pendingProgressHandlers.clear(),await e.sendNotification(S.InitializedNotification.type,{}),this.hookFileEvents(e),this.hookLogLevelChanged(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 S.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(Zt.Stop,e)}dispose(e=2e3){try{return this._disposed="disposing",this.stop(e)}finally{this._disposed="disposed"}}async shutdown(e,t=2e3){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(o=>{(0,S.RAL)().timer.setTimeout(o,t)}),s=(async o=>(await o.shutdown(),await o.exit(),o))(n);return this._onStop=Promise.race([i,s]).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=K.Stopped,e===Zt.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===Zt.Stop||e===Zt.Restart)&&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(s){return t._fileEvents.push(s),t._fileEventDelayer.trigger(async()=>{let o=t._fileEvents;t._fileEvents=[];try{await t.sendNotification(S.DidChangeWatchedFilesNotification.type,{changes:o})}catch(a){throw t._fileEvents.push(...o),a}})}let i=this.clientOptions.middleware?.workspace;(i?.didChangeWatchedFile?i.didChangeWatchedFile(e,n):n(e)).catch(s=>{t.error("Notifying file events failed.",s)})}async sendPendingFullTextDocumentChanges(e){return this._pendingChangeSemaphore.lock(async()=>{try{let t=this._didChangeTextDocumentFeature.getPendingDocumentChanges(this._inFlightOpenNotifications);if(t.length===0)return;for(let n of t){let i=this.code2ProtocolConverter.asChangeTextDocumentParams(n);await e.sendNotification(S.DidChangeTextDocumentNotification.type,i),this._didChangeTextDocumentFeature.notificationSent(n,S.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))}_diagnosticQueue=new Map;_diagnosticQueueState={state:"idle"};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,S.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(s=>{if(!i.token.isCancellationRequested){let o=this._p2c.asUri(t),a=this.clientOptions.middleware;a.handleDiagnostics?a.handleDiagnostics(o,s,(u,l)=>this.setDiagnostics(u,l)):this.setDiagnostics(o,s)}}).catch(s=>{this.error("Processing diagnostic queue failed.",s)}).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,s,o)=>{this.handleConnectionError(i,s,o).catch(a=>this.error("Handling connection error failed",a))},t=()=>{this.handleConnectionClosed().catch(i=>this.error("Handling connection close failed",i))},n=await this.createMessageTransports(this._clientOptions.stdioEncoding||"utf8");return this._connection=Qm(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:Xt.DoNotRestart};if(this.$state!==K.Stopping)try{e=await this._clientOptions.errorHandler.closed()}catch{}this._connection=void 0,e.action===Xt.DoNotRestart?(this.error(e.message??"Connection to server got closed. Server will not be restarted.",void 0,e.handled===!0?!1:"force"),this.cleanUp(Zt.Stop),this.$state===K.Starting?this.$state=K.StartFailed:this.$state=K.Stopped,this._onStop=Promise.resolve(),this._onStart=void 0):e.action===Xt.Restart&&(this.info(e.message??"Connection to server got closed. Server will restart.",void 0,!e.handled),this.cleanUp(Zt.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===Si.Shutdown?(this.error(i.message??`Client ${this._name}: connection to server is erroring.
|
|
13
13
|
${e.message}
|
|
14
14
|
Shutting down server.`,void 0,i.handled===!0?!1:"force"),this.stop().catch(s=>{this.error("Stopping server failed",s,!1)})):this.error(i.message??`Client ${this._name}: connection to server is erroring.
|
|
15
|
-
${e.message}`,void 0,i.handled===!0?!1:"force")}hookConfigurationChanged(e){this._listeners.push(j.workspace.onDidChangeConfiguration(()=>{this.refreshTrace(e,!0)}))}hookLogLevelChanged(e){this._listeners.push(this.traceOutputChannel.onDidChangeLogLevel(t=>{this._traceLogLevel=t,this.refreshTrace(e,!0)}))}refreshTrace(e,t=!1){let n=j.workspace.getConfiguration(this._id),i=this._traceLogLevel!==j.LogLevel.Trace?S.Trace.Off:S.Trace.Messages,s=S.TraceFormat.Text;if(n&&i!==S.Trace.Off){let o=n.get("trace.server","messages");typeof o=="string"?(i=S.Trace.fromString(o),i===S.Trace.Off&&(i=S.Trace.Messages)):(i=S.Trace.fromString(n.get("trace.server.verbosity","messages")),i===S.Trace.Off&&(i=S.Trace.Messages),s=S.TraceFormat.fromString(n.get("trace.server.format","text")))}this._trace=i,this._traceFormat=s,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;et.array(t)?n=t:n=[t],n&&this._dynamicFeatures.get(S.DidChangeWatchedFilesNotification.type.method).registerRaw(Dl.generateUuid(),n)}_features=[];_dynamicFeatures=new Map;registerFeatures(e){for(let t of e)this.registerFeature(t)}registerFeature(e){if(this._features.push(e),Le.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(S.NotebookDocumentSyncRegistrationType.method);return t===void 0||!(t instanceof Ya.NotebookDocumentSyncFeature)?!1:t.handles(e)}registerBuiltinFeatures(){let e=new Map;this.registerFeature(new Pl.ConfigurationFeature(this)),this._didOpenTextDocumentFeature=new In.DidOpenTextDocumentFeature(this,this._syncedDocuments),this.registerFeature(this._didOpenTextDocumentFeature),this._didChangeTextDocumentFeature=new In.DidChangeTextDocumentFeature(this,e),this._didChangeTextDocumentFeature.onPendingChangeAdded(()=>{this.triggerPendingChangeDelivery()}),this.registerFeature(this._didChangeTextDocumentFeature),this.registerFeature(new In.WillSaveFeature(this)),this.registerFeature(new In.WillSaveWaitUntilFeature(this)),this.registerFeature(new In.DidSaveTextDocumentFeature(this)),this.registerFeature(new In.DidCloseTextDocumentFeature(this,this._syncedDocuments,e)),this.registerFeature(new Gm.FileSystemWatcherFeature(this,t=>this.notifyFileEvent(t))),this.registerFeature(new wm.CompletionItemFeature(this)),this.registerFeature(new Cm.HoverFeature(this)),this.registerFeature(new Sm.SignatureHelpFeature(this)),this.registerFeature(new bm.DefinitionFeature(this)),this.registerFeature(new Rm.ReferencesFeature(this)),this.registerFeature(new Dm.DocumentHighlightFeature(this)),this.registerFeature(new Pm.DocumentSymbolFeature(this)),this.registerFeature(new Tm.WorkspaceSymbolFeature(this)),this.registerFeature(new Mm.CodeActionFeature(this)),this.registerFeature(new km.CodeLensFeature(this)),this.registerFeature(new Ja.DocumentFormattingFeature(this)),this.registerFeature(new Ja.DocumentRangeFormattingFeature(this)),this.registerFeature(new Ja.DocumentOnTypeFormattingFeature(this)),this.registerFeature(new Em.RenameFeature(this)),this.registerFeature(new qm.DocumentLinkFeature(this)),this.registerFeature(new Im.ExecuteCommandFeature(this)),this.registerFeature(new Pl.SyncConfigurationFeature(this)),this.registerFeature(new Om.TypeDefinitionFeature(this)),this.registerFeature(new Fm.ImplementationFeature(this)),this.registerFeature(new xm.ColorProviderFeature(this)),this.clientOptions.workspaceFolder===void 0&&this.registerFeature(new Bm.WorkspaceFoldersFeature(this)),this.registerFeature(new Am.FoldingRangeFeature(this)),this.registerFeature(new jm.DeclarationFeature(this)),this.registerFeature(new Lm.SelectionRangeFeature(this)),this.registerFeature(new Jm.ProgressFeature(this)),this.registerFeature(new Nm.CallHierarchyFeature(this)),this.registerFeature(new Um.SemanticTokensFeature(this)),this.registerFeature(new Km.LinkedEditingFeature(this)),this.registerFeature(new An.DidCreateFilesFeature(this)),this.registerFeature(new An.DidRenameFilesFeature(this)),this.registerFeature(new An.DidDeleteFilesFeature(this)),this.registerFeature(new An.WillCreateFilesFeature(this)),this.registerFeature(new An.WillRenameFilesFeature(this)),this.registerFeature(new An.WillDeleteFilesFeature(this)),this.registerFeature(new Hm.TypeHierarchyFeature(this)),this.registerFeature(new Wm.InlineValueFeature(this)),this.registerFeature(new $m.InlayHintsFeature(this)),this.registerFeature(new _m.DiagnosticFeature(this)),this.registerFeature(new Ya.NotebookDocumentSyncFeature(this))}registerProposedFeatures(){this.registerFeatures(nc.createAll(this))}fillInitializeParams(e){for(let t of this._features)et.func(t.fillInitializeParams)&&t.fillInitializeParams(e)}computeClientCapabilities(){let e={};(0,Le.ensure)(e,"workspace").applyEdit=!0;let t=(0,Le.ensure)((0,Le.ensure)(e,"workspace"),"workspaceEdit");t.documentChanges=!0,t.resourceOperations=[S.ResourceOperationKind.Create,S.ResourceOperationKind.Rename,S.ResourceOperationKind.Delete],t.failureHandling=S.FailureHandlingKind.TextOnlyTransactional,t.normalizesLineEndings=!0,t.changeAnnotationSupport={groupsOnLabel:!0},t.metadataSupport=!0,t.snippetEditSupport=!0;let n=(0,Le.ensure)((0,Le.ensure)(e,"textDocument"),"publishDiagnostics");n.relatedInformation=!0,n.versionSupport=!1,n.tagSupport={valueSet:[S.DiagnosticTag.Unnecessary,S.DiagnosticTag.Deprecated]},n.codeDescriptionSupport=!0,n.dataSupport=!0;let i=(0,Le.ensure)((0,Le.ensure)(e,"textDocument"),"filters");i.relativePatternSupport=!0;let s=(0,Le.ensure)(e,"window"),o=(0,Le.ensure)(s,"showMessage");o.messageActionItem={additionalPropertiesSupport:!0};let a=(0,Le.ensure)(s,"showDocument");a.support=!0;let u=(0,Le.ensure)(e,"general");u.staleRequestSupport={cancel:!0,retryOnContentModified:Array.from(r.RequestsToCancelOnContentModified)},u.regularExpressions={engine:"ECMAScript",version:"ES2020"},u.markdown={parser:"marked",version:"1.1.0"},u.positionEncodings=["utf-16"],this._clientOptions.markdown.supportHtml&&(u.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 l of this._features)l.fillClientCapabilities(e);return e}initializeFeatures(e){let t=this._clientOptions.documentSelector;for(let n of this._features)et.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 s={id:t.id,registerOptions:i};try{n.register(s)}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=this.clientOptions.middleware?.workspace?.handleApplyEdit;if(t){let n=await t(e,i=>this.doHandleApplyWorkspaceEdit(i));return n instanceof S.ResponseError?Promise.reject(n):n}else return this.doHandleApplyWorkspaceEdit(e)}workspaceEditLock=new jr.Semaphore(1);async doHandleApplyWorkspaceEdit(e){let t=e.edit,n=await this.workspaceEditLock.lock(()=>this._p2c.asWorkspaceEdit(t));return this.validateWorkspaceEdit(t)?et.asPromise(j.workspace.applyEdit(n,{isRefactoring:e.metadata?.isRefactoring}).then(s=>({applied:s}))):Promise.resolve({applied:!1})}validateWorkspaceEdit(e){let t=new Map;if(j.workspace.textDocuments.forEach(n=>t.set(n.uri.toString(),n)),e.documentChanges){for(let n of e.documentChanges)if(S.TextDocumentEdit.is(n)&&n.textDocument.version!==null&&n.textDocument.version>=0){let i=this._p2c.asUri(n.textDocument.uri).toString(),s=t.get(i);if(s&&s.version!==n.textDocument.version)return!1}}return!0}static RequestsToCancelOnContentModified=new Set([S.SemanticTokensRequest.method,S.SemanticTokensRangeRequest.method,S.SemanticTokensDeltaRequest.method]);static CancellableResolveCalls=new Set([S.CompletionResolveRequest.method,S.CodeLensResolveRequest.method,S.CodeActionResolveRequest.method,S.InlayHintResolveRequest.method,S.DocumentLinkResolveRequest.method,S.WorkspaceSymbolResolveRequest.method]);handleFailedRequest(e,t,n,i,s=!0,o=!1){if(n instanceof S.ResponseError){if(n.code===S.ErrorCodes.PendingResponseRejected||n.code===S.ErrorCodes.ConnectionInactive)return i;if(n.code===S.LSPErrorCodes.RequestCancelled||n.code===S.LSPErrorCodes.ServerCancelled){if(t!==void 0&&t.isCancellationRequested&&!o)return i;throw n.data!==void 0?new Le.LSPCancellationError(n.data):new j.CancellationError}else if(n.code===S.LSPErrorCodes.ContentModified){if(r.RequestsToCancelOnContentModified.has(e.method)||r.CancellableResolveCalls.has(e.method))throw new j.CancellationError;return i}}throw this.error(`Request ${e.method} failed.`,n,s),n}};Y.BaseLanguageClient=Lr;var ec=class extends Lr{serverOptions;constructor(e,t,n,i){super(e,t,i),this.serverOptions=n}async createMessageTransports(e){return this.serverOptions()}};Y.LanguageClient=ec;var tc=class{error(e){(0,S.RAL)().console.error(e)}warn(e){(0,S.RAL)().console.warn(e)}info(e){(0,S.RAL)().console.info(e)}log(e){(0,S.RAL)().console.log(e)}};function Ym(r,e,t,n,i){let s=new tc,o=(0,S.createProtocolConnection)(r,e,s,i);return o.onError(u=>{t(u[0],u[1],u[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:(u,l,p)=>{let h={sendNotification:!1,traceFormat:S.TraceFormat.Text};return p===void 0?o.trace(u,l,h):(et.boolean(p),o.trace(u,l,p))},initialize:u=>o.sendRequest(S.InitializeRequest.type,u),shutdown:()=>o.sendRequest(S.ShutdownRequest.type,void 0),exit:()=>o.sendNotification(S.ExitNotification.type),end:()=>o.end(),dispose:()=>o.dispose()}}var nc;(function(r){function e(t){return[new zm.InlineCompletionItemFeature(t),new Vm.TextDocumentContentFeature(t)]}r.createAll=e})(nc||(Y.ProposedFeatures=nc={}))});var Fl=M(Nt=>{"use strict";var Qm=Nt&&Nt.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Zm=Nt&&Nt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Xm=Nt&&Nt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Qm(t,e,n[i]);return Zm(t,e),t}})();Object.defineProperty(Nt,"__esModule",{value:!0});Nt.terminate=iv;var Ol=Xm(I("child_process")),ev=process.platform==="win32",tv=process.platform==="darwin",nv=process.platform==="linux";function iv(r,e){if(ev)try{let t={stdio:["pipe","pipe","ignore"]};return e&&(t.cwd=e),Ol.execFileSync("taskkill",["/T","/F","/PID",r.pid.toString()],t),!0}catch{return!1}else if(nv||tv)try{let t=r.pid.toString();if(!/^\d+$/.test(t))return!1;let n=`
|
|
15
|
+
${e.message}`,void 0,i.handled===!0?!1:"force")}hookConfigurationChanged(e){this._listeners.push(j.workspace.onDidChangeConfiguration(()=>{this.refreshTrace(e,!0)}))}hookLogLevelChanged(e){this._listeners.push(this.traceOutputChannel.onDidChangeLogLevel(t=>{this._traceLogLevel=t,this.refreshTrace(e,!0)}))}refreshTrace(e,t=!1){let n=j.workspace.getConfiguration(this._id),i=this._traceLogLevel!==j.LogLevel.Trace?S.Trace.Off:S.Trace.Messages,s=S.TraceFormat.Text;if(n&&i!==S.Trace.Off){let o=n.get("trace.server","messages");typeof o=="string"?(i=S.Trace.fromString(o),i===S.Trace.Off&&(i=S.Trace.Messages)):(i=S.Trace.fromString(n.get("trace.server.verbosity","messages")),i===S.Trace.Off&&(i=S.Trace.Messages),s=S.TraceFormat.fromString(n.get("trace.server.format","text")))}this._trace=i,this._traceFormat=s,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;et.array(t)?n=t:n=[t],n&&this._dynamicFeatures.get(S.DidChangeWatchedFilesNotification.type.method).registerRaw(Pl.generateUuid(),n)}_features=[];_dynamicFeatures=new Map;registerFeatures(e){for(let t of e)this.registerFeature(t)}registerFeature(e){if(this._features.push(e),Le.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(S.NotebookDocumentSyncRegistrationType.method);return t===void 0||!(t instanceof Qa.NotebookDocumentSyncFeature)?!1:t.handles(e)}registerBuiltinFeatures(){let e=new Map;this.registerFeature(new Tl.ConfigurationFeature(this)),this._didOpenTextDocumentFeature=new In.DidOpenTextDocumentFeature(this,this._syncedDocuments),this.registerFeature(this._didOpenTextDocumentFeature),this._didChangeTextDocumentFeature=new In.DidChangeTextDocumentFeature(this,e),this._didChangeTextDocumentFeature.onPendingChangeAdded(()=>{this.triggerPendingChangeDelivery()}),this.registerFeature(this._didChangeTextDocumentFeature),this.registerFeature(new In.WillSaveFeature(this)),this.registerFeature(new In.WillSaveWaitUntilFeature(this)),this.registerFeature(new In.DidSaveTextDocumentFeature(this)),this.registerFeature(new In.DidCloseTextDocumentFeature(this,this._syncedDocuments,e)),this.registerFeature(new Jm.FileSystemWatcherFeature(this,t=>this.notifyFileEvent(t))),this.registerFeature(new Cm.CompletionItemFeature(this)),this.registerFeature(new bm.HoverFeature(this)),this.registerFeature(new Dm.SignatureHelpFeature(this)),this.registerFeature(new Sm.DefinitionFeature(this)),this.registerFeature(new Om.ReferencesFeature(this)),this.registerFeature(new Pm.DocumentHighlightFeature(this)),this.registerFeature(new Tm.DocumentSymbolFeature(this)),this.registerFeature(new Rm.WorkspaceSymbolFeature(this)),this.registerFeature(new km.CodeActionFeature(this)),this.registerFeature(new Em.CodeLensFeature(this)),this.registerFeature(new Ya.DocumentFormattingFeature(this)),this.registerFeature(new Ya.DocumentRangeFormattingFeature(this)),this.registerFeature(new Ya.DocumentOnTypeFormattingFeature(this)),this.registerFeature(new qm.RenameFeature(this)),this.registerFeature(new Im.DocumentLinkFeature(this)),this.registerFeature(new Am.ExecuteCommandFeature(this)),this.registerFeature(new Tl.SyncConfigurationFeature(this)),this.registerFeature(new Fm.TypeDefinitionFeature(this)),this.registerFeature(new xm.ImplementationFeature(this)),this.registerFeature(new Mm.ColorProviderFeature(this)),this.clientOptions.workspaceFolder===void 0&&this.registerFeature(new zm.WorkspaceFoldersFeature(this)),this.registerFeature(new jm.FoldingRangeFeature(this)),this.registerFeature(new Lm.DeclarationFeature(this)),this.registerFeature(new Nm.SelectionRangeFeature(this)),this.registerFeature(new Ym.ProgressFeature(this)),this.registerFeature(new Um.CallHierarchyFeature(this)),this.registerFeature(new Km.SemanticTokensFeature(this)),this.registerFeature(new Hm.LinkedEditingFeature(this)),this.registerFeature(new An.DidCreateFilesFeature(this)),this.registerFeature(new An.DidRenameFilesFeature(this)),this.registerFeature(new An.DidDeleteFilesFeature(this)),this.registerFeature(new An.WillCreateFilesFeature(this)),this.registerFeature(new An.WillRenameFilesFeature(this)),this.registerFeature(new An.WillDeleteFilesFeature(this)),this.registerFeature(new Wm.TypeHierarchyFeature(this)),this.registerFeature(new $m.InlineValueFeature(this)),this.registerFeature(new Bm.InlayHintsFeature(this)),this.registerFeature(new wm.DiagnosticFeature(this)),this.registerFeature(new Qa.NotebookDocumentSyncFeature(this)),this.registerFeature(new Vm.InlineCompletionItemFeature(this)),this.registerFeature(new Gm.TextDocumentContentFeature(this))}registerProposedFeatures(){this.registerFeatures(ic.createAll(this))}fillInitializeParams(e){for(let t of this._features)et.func(t.fillInitializeParams)&&t.fillInitializeParams(e)}computeClientCapabilities(){let e={};(0,Le.ensure)(e,"workspace").applyEdit=!0;let t=(0,Le.ensure)((0,Le.ensure)(e,"workspace"),"workspaceEdit");t.documentChanges=!0,t.resourceOperations=[S.ResourceOperationKind.Create,S.ResourceOperationKind.Rename,S.ResourceOperationKind.Delete],t.failureHandling=S.FailureHandlingKind.TextOnlyTransactional,t.normalizesLineEndings=!0,t.changeAnnotationSupport={groupsOnLabel:!0},t.metadataSupport=!0,t.snippetEditSupport=!0;let n=(0,Le.ensure)((0,Le.ensure)(e,"textDocument"),"publishDiagnostics");n.relatedInformation=!0,n.versionSupport=!1,n.tagSupport={valueSet:[S.DiagnosticTag.Unnecessary,S.DiagnosticTag.Deprecated]},n.codeDescriptionSupport=!0,n.dataSupport=!0;let i=(0,Le.ensure)((0,Le.ensure)(e,"textDocument"),"filters");i.relativePatternSupport=!0;let s=(0,Le.ensure)(e,"window"),o=(0,Le.ensure)(s,"showMessage");o.messageActionItem={additionalPropertiesSupport:!0};let a=(0,Le.ensure)(s,"showDocument");a.support=!0;let u=(0,Le.ensure)(e,"general");u.staleRequestSupport={cancel:!0,retryOnContentModified:Array.from(r.RequestsToCancelOnContentModified)},u.regularExpressions={engine:"ECMAScript",version:"ES2020"},u.markdown={parser:"marked",version:"1.1.0"},u.positionEncodings=["utf-16"],this._clientOptions.markdown.supportHtml&&(u.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 l of this._features)l.fillClientCapabilities(e);return e}initializeFeatures(e){let t=this._clientOptions.documentSelector;for(let n of this._features)et.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 s={id:t.id,registerOptions:i};try{n.register(s)}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=this.clientOptions.middleware?.workspace?.handleApplyEdit;if(t){let n=await t(e,i=>this.doHandleApplyWorkspaceEdit(i));return n instanceof S.ResponseError?Promise.reject(n):n}else return this.doHandleApplyWorkspaceEdit(e)}workspaceEditLock=new jr.Semaphore(1);async doHandleApplyWorkspaceEdit(e){let t=e.edit,n=await this.workspaceEditLock.lock(()=>this._p2c.asWorkspaceEdit(t));return this.validateWorkspaceEdit(t)?et.asPromise(j.workspace.applyEdit(n,{isRefactoring:e.metadata?.isRefactoring}).then(s=>({applied:s}))):Promise.resolve({applied:!1})}validateWorkspaceEdit(e){let t=new Map;if(j.workspace.textDocuments.forEach(n=>t.set(n.uri.toString(),n)),e.documentChanges){for(let n of e.documentChanges)if(S.TextDocumentEdit.is(n)&&n.textDocument.version!==null&&n.textDocument.version>=0){let i=this._p2c.asUri(n.textDocument.uri).toString(),s=t.get(i);if(s&&s.version!==n.textDocument.version)return!1}}return!0}static RequestsToCancelOnContentModified=new Set([S.SemanticTokensRequest.method,S.SemanticTokensRangeRequest.method,S.SemanticTokensDeltaRequest.method]);static CancellableResolveCalls=new Set([S.CompletionResolveRequest.method,S.CodeLensResolveRequest.method,S.CodeActionResolveRequest.method,S.InlayHintResolveRequest.method,S.DocumentLinkResolveRequest.method,S.WorkspaceSymbolResolveRequest.method]);handleFailedRequest(e,t,n,i,s=!0,o=!1){if(n instanceof S.ResponseError){if(n.code===S.ErrorCodes.PendingResponseRejected||n.code===S.ErrorCodes.ConnectionInactive)return i;if(n.code===S.LSPErrorCodes.RequestCancelled||n.code===S.LSPErrorCodes.ServerCancelled){if(t!==void 0&&t.isCancellationRequested&&!o)return i;throw n.data!==void 0?new Le.LSPCancellationError(n.data):new j.CancellationError}else if(n.code===S.LSPErrorCodes.ContentModified){if(r.RequestsToCancelOnContentModified.has(e.method)||r.CancellableResolveCalls.has(e.method))throw new j.CancellationError;return i}}throw this.error(`Request ${e.method} failed.`,n,s),n}};Y.BaseLanguageClient=Lr;var tc=class extends Lr{serverOptions;constructor(e,t,n,i){super(e,t,i),this.serverOptions=n}async createMessageTransports(e){return this.serverOptions()}};Y.LanguageClient=tc;var nc=class{error(e){(0,S.RAL)().console.error(e)}warn(e){(0,S.RAL)().console.warn(e)}info(e){(0,S.RAL)().console.info(e)}log(e){(0,S.RAL)().console.log(e)}};function Qm(r,e,t,n,i){let s=new nc,o=(0,S.createProtocolConnection)(r,e,s,i);return o.onError(u=>{t(u[0],u[1],u[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:(u,l,p)=>{let h={sendNotification:!1,traceFormat:S.TraceFormat.Text};return p===void 0?o.trace(u,l,h):(et.boolean(p),o.trace(u,l,p))},initialize:u=>o.sendRequest(S.InitializeRequest.type,u),shutdown:()=>o.sendRequest(S.ShutdownRequest.type,void 0),exit:()=>o.sendNotification(S.ExitNotification.type),end:()=>o.end(),dispose:()=>o.dispose()}}var ic;(function(r){function e(t){return[]}r.createAll=e})(ic||(Y.ProposedFeatures=ic={}))});var xl=M(Nt=>{"use strict";var Zm=Nt&&Nt.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Xm=Nt&&Nt.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),ev=Nt&&Nt.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Zm(t,e,n[i]);return Xm(t,e),t}})();Object.defineProperty(Nt,"__esModule",{value:!0});Nt.terminate=rv;var Fl=ev(I("child_process")),tv=process.platform==="win32",nv=process.platform==="darwin",iv=process.platform==="linux";function rv(r,e){if(tv)try{let t={stdio:["pipe","pipe","ignore"]};return e&&(t.cwd=e),Fl.execFileSync("taskkill",["/T","/F","/PID",r.pid.toString()],t),!0}catch{return!1}else if(iv||nv)try{let t=r.pid.toString();if(!/^\d+$/.test(t))return!1;let n=`
|
|
16
16
|
terminateTree() {
|
|
17
17
|
for cpid in $(pgrep -P "$1"); do
|
|
18
18
|
terminateTree "$cpid"
|
|
@@ -21,18 +21,18 @@ terminateTree() {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
terminateTree "${t}"
|
|
24
|
-
`;return!Ol.spawnSync("/bin/sh",[],{input:n,stdio:["pipe","inherit","inherit"]}).error}catch{return!1}else return r.kill("SIGKILL"),!0}});var Ml=M(Ne=>{"use strict";var rv=Ne&&Ne.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),rc=Ne&&Ne.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&rv(e,r,t)};Object.defineProperty(Ne,"__esModule",{value:!0});Ne.DiagnosticPullMode=Ne.vsdiag=void 0;rc(N(),Ne);rc(B(),Ne);var xl=mo();Object.defineProperty(Ne,"vsdiag",{enumerable:!0,get:function(){return xl.vsdiag}});Object.defineProperty(Ne,"DiagnosticPullMode",{enumerable:!0,get:function(){return xl.DiagnosticPullMode}});rc(ic(),Ne)});var jl=M(be=>{"use strict";var Il=be&&be.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),sv=be&&be.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Di=be&&be.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Il(t,e,n[i]);return sv(t,e),t}})(),Al=be&&be.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Il(e,r,t)};Object.defineProperty(be,"__esModule",{value:!0});be.SettingMonitor=be.LanguageClient=be.TransportKind=void 0;var Ut=Di(I("child_process")),sc=Di(I("fs")),oc=Di(I("path")),kl=Di(I("readline")),tn=I("vscode"),Nn=Di(He()),El=ic(),ov=Fl(),ue=Dc(),av=nd(),cv=id();Al(Dc(),be);Al(Ml(),be);var ql="^1.91.0",le;(function(r){r[r.stdio=0]="stdio",r[r.ipc=1]="ipc",r[r.pipe=2]="pipe",r[r.socket=3]="socket"})(le||(be.TransportKind=le={}));var en;(function(r){function e(t){let n=t;return n&&n.kind===le.socket&&Nn.number(n.port)}r.isSocket=e})(en||(en={}));var ac;(function(r){function e(t){return Nn.string(t.command)}r.is=e})(ac||(ac={}));var cc;(function(r){function e(t){return Nn.string(t.module)}r.is=e})(cc||(cc={}));var uc;(function(r){function e(t){let n=t;return n&&n.writer!==void 0&&n.reader!==void 0}r.is=e})(uc||(uc={}));var lc;(function(r){function e(t){let n=t;return n&&n.process!==void 0&&typeof n.detached=="boolean"}r.is=e})(lc||(lc={}));var dc=class extends El.BaseLanguageClient{_serverOptions;_forceDebug;_serverProcess;_isDetached;_isInDebugMode;constructor(e,t,n,i,s){let o,a,u,l,p;Nn.string(t)?(o=e,a=t,u=n,l=i,p=!!s):(o=e.toLowerCase(),a=e,u=t,l=n,p=i),p===void 0&&(p=!1),super(o,a,l),this._serverOptions=u,this._forceDebug=p,this._isInDebugMode=p;try{this.checkVersion()}catch(h){throw Nn.string(h.message)&&this.outputChannel.appendLine(h.message),h}}checkVersion(){let e=av(tn.version);if(!e)throw new Error(`No valid VS Code version detected. Version string is: ${tn.version}`);if(e.prerelease&&e.prerelease.length>0&&(e.prerelease=[]),!cv(e,ql))throw new Error(`The language client requires VS Code version ${ql} but received version ${tn.version}`)}get isInDebugMode(){return this._isInDebugMode}get serverProcess(){return this._serverProcess}async restart(){await this.stop(),this.isInDebugMode?(await new Promise(e=>setTimeout(e,1e3)),await this.start()):await this.start()}shutdown(e,t=2e3){return super.shutdown(e,t).finally(()=>{if(this._serverProcess){let n=this._serverProcess;this._serverProcess=void 0,(this._isDetached===void 0||!this._isDetached)&&this.checkProcessDied(n),this._isDetached=void 0}})}checkProcessDied(e){!e||e.pid===void 0||setTimeout(()=>{try{e.pid!==void 0&&(process.kill(e.pid,0),(0,ov.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(f,m){if(!f&&!m)return;let g=Object.create(null);return Object.keys(process.env).forEach(v=>g[v]=process.env[v]),m&&(g.ELECTRON_RUN_AS_NODE="1",g.ELECTRON_NO_ASAR="1"),f&&Object.keys(f).forEach(v=>g[v]=f[v]),g}let n=["--debug=","--debug-brk=","--inspect=","--inspect-brk="],i=["--debug","--debug-brk","--inspect","--inspect-brk"];function s(){let f=process.execArgv;return f?f.some(m=>n.some(g=>m.startsWith(g))||i.some(g=>m===g)):!1}function o(f){if(f.stdin===null||f.stdout===null||f.stderr===null)throw new Error("Process created without stdio streams")}function a(f,m){kl.createInterface({input:f,crlfDelay:1/0,terminal:!1,historySize:0}).on("line",g=>m.info(g))}function u(f,m){kl.createInterface({input:f,crlfDelay:1/0,terminal:!1,historySize:0}).on("line",g=>m.error(g))}let l=this._serverOptions;if(Nn.func(l))return l().then(f=>{if(El.MessageTransports.is(f))return this._isDetached=!!f.detached,f;if(uc.is(f))return this._isDetached=!!f.detached,{reader:new ue.StreamMessageReader(f.reader),writer:new ue.StreamMessageWriter(f.writer)};{let m;return lc.is(f)?(m=f.process,this._isDetached=f.detached):(m=f,this._isDetached=!1),u(m.stderr,this.outputChannel),{reader:new ue.StreamMessageReader(m.stdout),writer:new ue.StreamMessageWriter(m.stdin)}}});let p,h=l;return h.run||h.debug?this._forceDebug||s()?(p=h.debug,this._isInDebugMode=!0):(p=h.run,this._isInDebugMode=!1):p=l,this._getServerWorkingDir(p.options).then(f=>{if(cc.is(p)&&p.module){let m=p,g=m.transport||le.stdio;if(m.runtime){let v=[],_=m.options??Object.create(null);_.execArgv&&_.execArgv.forEach(F=>v.push(F)),v.push(m.module),m.args&&m.args.forEach(F=>v.push(F));let T=Object.create(null);T.cwd=f,T.env=t(_.env,!1);let C=this._getRuntimePath(m.runtime,f),D;if(g===le.ipc?(T.stdio=[null,null,null,"ipc"],v.push("--node-ipc")):g===le.stdio?v.push("--stdio"):g===le.pipe?(D=(0,ue.generateRandomPipeName)(),v.push(`--pipe=${D}`)):en.isSocket(g)&&v.push(`--socket=${g.port}`),v.push(`--clientProcessId=${process.pid.toString()}`),g===le.ipc||g===le.stdio){let F=Ut.spawn(C,v,T);return!F||!F.pid?Ln(F,`Launching server using runtime ${C} failed.`):(this._serverProcess=F,u(F.stderr,this.outputChannel),g===le.ipc?(a(F.stdout,this.outputChannel),Promise.resolve({reader:new ue.IPCMessageReader(F),writer:new ue.IPCMessageWriter(F)})):Promise.resolve({reader:new ue.StreamMessageReader(F.stdout),writer:new ue.StreamMessageWriter(F.stdin)}))}else{if(g===le.pipe)return(0,ue.createClientPipeTransport)(D).then(F=>{let E=Ut.spawn(C,v,T);return!E||!E.pid?Ln(E,`Launching server using runtime ${C} failed.`):(this._serverProcess=E,u(E.stderr,this.outputChannel),a(E.stdout,this.outputChannel),F.onConnected().then(Q=>({reader:Q[0],writer:Q[1]})))});if(en.isSocket(g))return(0,ue.createClientSocketTransport)(g.port).then(F=>{let E=Ut.spawn(C,v,T);return!E||!E.pid?Ln(E,`Launching server using runtime ${C} failed.`):(this._serverProcess=E,u(E.stderr,this.outputChannel),a(E.stdout,this.outputChannel),F.onConnected().then(Q=>({reader:Q[0],writer:Q[1]})))})}}else{let v;return new Promise((_,T)=>{let C=(m.args&&m.args.slice())??[];g===le.ipc?C.push("--node-ipc"):g===le.stdio?C.push("--stdio"):g===le.pipe?(v=(0,ue.generateRandomPipeName)(),C.push(`--pipe=${v}`)):en.isSocket(g)&&C.push(`--socket=${g.port}`),C.push(`--clientProcessId=${process.pid.toString()}`);let D=m.options?{...m.options}:Object.create(null);if(D.env=t(D.env,!0),D.execArgv=D.execArgv||[],D.cwd=f,D.silent=!0,g===le.ipc||g===le.stdio){let F=Ut.fork(m.module,C||[],D);o(F),this._serverProcess=F,u(F.stderr,this.outputChannel),g===le.ipc?(a(F.stdout,this.outputChannel),_({reader:new ue.IPCMessageReader(this._serverProcess),writer:new ue.IPCMessageWriter(this._serverProcess)})):_({reader:new ue.StreamMessageReader(F.stdout),writer:new ue.StreamMessageWriter(F.stdin)})}else g===le.pipe?(0,ue.createClientPipeTransport)(v).then(F=>{let E=Ut.fork(m.module,C||[],D);o(E),this._serverProcess=E,u(E.stderr,this.outputChannel),a(E.stdout,this.outputChannel),F.onConnected().then(Q=>{_({reader:Q[0],writer:Q[1]})},T)},T):en.isSocket(g)&&(0,ue.createClientSocketTransport)(g.port).then(F=>{let E=Ut.fork(m.module,C||[],D);o(E),this._serverProcess=E,u(E.stderr,this.outputChannel),a(E.stdout,this.outputChannel),F.onConnected().then(Q=>{_({reader:Q[0],writer:Q[1]})},T)},T)})}}else if(ac.is(p)&&p.command){let m=p,g=p.args!==void 0?p.args.slice(0):[],v,_=p.transport;if(_===le.stdio)g.push("--stdio");else if(_===le.pipe)v=(0,ue.generateRandomPipeName)(),g.push(`--pipe=${v}`);else if(en.isSocket(_))g.push(`--socket=${_.port}`);else if(_===le.ipc)throw new Error("Transport kind ipc is not support for command executable");let T=Object.assign({},m.options);if(T.cwd=T.cwd||f,_===void 0||_===le.stdio){let C=Ut.spawn(m.command,g,T);return!C||!C.pid?Ln(C,`Launching server using command ${m.command} failed.`):(u(C.stderr,this.outputChannel),this._serverProcess=C,this._isDetached=!!T.detached,Promise.resolve({reader:new ue.StreamMessageReader(C.stdout),writer:new ue.StreamMessageWriter(C.stdin)}))}else{if(_===le.pipe)return(0,ue.createClientPipeTransport)(v).then(C=>{let D=Ut.spawn(m.command,g,T);return!D||!D.pid?Ln(D,`Launching server using command ${m.command} failed.`):(this._serverProcess=D,this._isDetached=!!T.detached,u(D.stderr,this.outputChannel),a(D.stdout,this.outputChannel),C.onConnected().then(F=>({reader:F[0],writer:F[1]})))});if(en.isSocket(_))return(0,ue.createClientSocketTransport)(_.port).then(C=>{let D=Ut.spawn(m.command,g,T);return!D||!D.pid?Ln(D,`Launching server using command ${m.command} failed.`):(this._serverProcess=D,this._isDetached=!!T.detached,u(D.stderr,this.outputChannel),a(D.stdout,this.outputChannel),C.onConnected().then(F=>({reader:F[0],writer:F[1]})))})}}return Promise.reject(new Error("Unsupported server configuration "+JSON.stringify(l,null,4)))}).finally(()=>{this._serverProcess!==void 0&&this._serverProcess.on("exit",(f,m)=>{f===0?this.info("Server process exited successfully",void 0,!1):f!==null&&this.error(`Server process exited with code ${f}.`,void 0,!1),m!==null&&this.error(`Server process exited with signal ${m}.`,void 0,!1)})})}_getRuntimePath(e,t){if(oc.isAbsolute(e))return e;let n=this._mainGetRootPath();if(n!==void 0){let i=oc.join(n,e);if(sc.existsSync(i))return i}if(t!==void 0){let i=oc.join(t,e);if(sc.existsSync(i))return i}return e}_mainGetRootPath(){let e=tn.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=>{sc.lstat(t,(i,s)=>{n(!i&&s.isDirectory()?t:void 0)})}):Promise.resolve(void 0)}};be.LanguageClient=dc;var fc=class{_client;_setting;_listeners;constructor(e,t){this._client=e,this._setting=t,this._listeners=[]}start(){return tn.workspace.onDidChangeConfiguration(this.onDidChangeConfiguration,this,this._listeners),this.onDidChangeConfiguration(),new tn.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?tn.workspace.getConfiguration(t).get(n,!1):tn.workspace.getConfiguration(t);i&&this._client.needsStart()?this._client.start().catch(s=>this._client.error("Start failed after configuration change",s,"force")):!i&&this._client.needsStop()&&this._client.stop().catch(s=>this._client.error("Stop failed after configuration change",s,"force"))}};be.SettingMonitor=fc;function Ln(r,e){return r===null?Promise.reject(e):new Promise((t,n)=>{r.on("error",i=>{n(`${e} ${i}`)}),setImmediate(()=>n(e))})}});import*as W from"vscode";var gs=Yn(rd(),1);import*as P from"vscode";import*as Pn from"path";import{fork as cd}from"child_process";import{EventEmitter as ad}from"events";var Zn=class extends ad{buf;matchers;constructor(e,t){super(),this.buf=Buffer.alloc(0),this.matchers=t instanceof Buffer?[t]:t,e.on("close",()=>{this.emit("close")}),e.on("end",()=>{this.emit("end")}),e.on("data",n=>{for(this.buf=Buffer.concat([this.buf,n]);this.buf.length>0;){let i=this.matchers.map(o=>this.buf.indexOf(o instanceof Buffer?o:o.start)),s=i.reduce((o,a)=>o===-1?a:a===-1?o:Math.min(o,a));if(s!==-1){let o=this.matchers[i.indexOf(s)];if(o instanceof Buffer)s>0&&this.emit("segment",this.buf.subarray(0,s)),this.buf=this.buf.subarray(s+o.length);else{let a=o;s>0&&(this.emit("segment",this.buf.subarray(0,s)),this.buf=this.buf.subarray(s));let u=this.buf.indexOf(a.end,a.start.length);if(u!==-1)this.emit("segment",this.buf.subarray(a.start.length,u)),this.buf=this.buf.subarray(u+a.end.length);else return}}else return}})}};import*as hs from"vscode";var Bi=class{constructor(e){this.secrets=e}secrets;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 hs.window.showInformationMessage("Key already present. Replace it?",{modal:!0},"Yes","No")==="Yes"),!e))return{from:"secrets",key:t};if(t=await hs.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")}};import{platform as ud,tmpdir as ld}from"os";var $={valTypes:{none:"NONE",primitive:"PRIM",object:"OBJECT",array:"ARRAY"},getValType:function(r){return r&&typeof r=="object"||Array.isArray(r)?Array.isArray(r)?$.valTypes.array:typeof r=="object"?$.valTypes.object:void 0:$.valTypes.primitive},getPathType:function(r){var e=[];for(var t in r){var n=r[t];n?$.isNumber(n)?e.push($.valTypes.array):e.push($.valTypes.object):e.push($.valTypes.none)}return e},isUndefined:function(r){return r===void 0},isNumber:function(r){return!isNaN(parseFloat(r))&&isFinite(r)&&r.indexOf(".")===-1},isEmptyObj:function(r){for(var e in r)if(Object.hasOwnProperty.call(r,e))return!1;return JSON.stringify(r)===JSON.stringify({})},isNotObject:function(r){return!r||typeof r!="object"},isEmptyArray:function(r){return Array.isArray(r)&&r.length==0},isNotArray:function(r){return Array.isArray(r)==0},removeEmptyArrayItem:function(r){return r.filter(function(e){return e!=null&&e!=""})},getFieldName:function(r,e,t,n,i){return i?(e||"")+($.isNumber(r)?"["+r+"]":(t&&!e?"":".")+r):n?(e||"")+"["+r+"]":(e?e+".":"")+r},startsWith:function(r,e){return r.indexOf(e)==0},convert:function(r,e){var t={};return $.isNotObject(r)&&$.isNotArray(r)?e?(t[e]=r,t):r:$.isEmptyArray(r)?r:(function n(i,s,o){var a=Array.isArray(i);for(var u in i){var l=i[u];l&&typeof l=="object"?Array.isArray(l)?$.isEmptyArray(l)?t[$.getFieldName(u,s,o,!1,!0)]=l:t=n(l,$.getFieldName(u,s,o,!1,!0),a):a&&$.isEmptyObj(l)==0?t=n(l,$.getFieldName(u,s,o,!0)):$.isEmptyObj(l)==0?t=n(l,$.getFieldName(u,s,o)):$.isEmptyObj(l)&&(t[$.getFieldName(u,s,o,a)]=l):a||$.isNumber(u)?t[$.getFieldName(u,s,o,!0)]=l:t[$.getFieldName(u,s,o)]=l}return t})(r,e,!0)},backward:function(r,e){var t={},n=/\[(\d+)\]/g;if($.isNotObject(r)&&$.isNotArray(r))return e?r[e]:r;if($.isEmptyArray(r))return r;for(var i in r){var s=r[i];if(e){var o=new RegExp("^"+e);i=i.replace(o,"")}i=i.replace(n,".$1"),$.startsWith(i,".")&&(i=i.replace(/^\./,""));var a=i.split("."),u=$.getPathType(a);$.isUndefined(u)||u[0]!=$.valTypes.array||Array.isArray(t)!=0||(t=[]),(function l(p,h,f,m){var g=a.shift(),v=u.shift();if(g!==void 0&&g!=""){if(g=$.isNumber(g)?parseInt(g):g,a.length>0)return h[g]===void 0&&(h[g]=u[0]==$.valTypes.array?[]:{}),void l(p,h[g],g,h);v==$.valTypes.array&&f&&m?(Array.isArray(m[f])==0&&(m[f]=[]),m[f].push(p)):h[g]=p}else t=p})(s,t)}return t}};var zi;function dd(r){return zi?ud()==="win32"?`${r};${P.Uri.joinPath(zi,"bin").fsPath}`:`${r}:${P.Uri.joinPath(zi,"bin").fsPath}`:r}async function Tc(r){if(P.workspace.workspaceFolders){let e=new Bi(r.secrets);r.subscriptions.push(P.commands.registerCommand("factorio.clearApiKey",async()=>{await e.ClearApiKey()})),r.subscriptions.push(P.commands.registerCommand("factorio.setApiKey",async()=>{await e.ReadyAPIKey(!0)}));let t=P.extensions.getExtension("vscode.git");t&&!t.isActive&&await t.activate();let n=new vs(r,e,t?.exports.getAPI(1));r.subscriptions.push(n);let i=P.window.createTreeView("factoriomods",{treeDataProvider:n});r.subscriptions.push(i),zi=r.extensionUri}}var ms=class{constructor(e,t){this.context=e;this.modPackages=t}context;modPackages;provideTasks(e){let t=[],n=nt.latestPackages(this.modPackages.values());for(let i of this.modPackages.values())n.has(i)&&(t.push(new P.Task({label:`${i.name}.datestamp`,type:"factorio",modname:i.label,command:"datestamp"},P.workspace.getWorkspaceFolder(i.resourceUri)||P.TaskScope.Workspace,`${i.name}.datestamp`,"factorio",i.DateStampTask(),[])),t.push(new P.Task({label:`${i.name}.package`,type:"factorio",modname:i.label,command:"package"},P.workspace.getWorkspaceFolder(i.resourceUri)||P.TaskScope.Workspace,`${i.name}.package`,"factorio",i.PackageTask(),[])),t.push(new P.Task({label:`${i.name}.version`,type:"factorio",modname:i.label,command:"version"},P.workspace.getWorkspaceFolder(i.resourceUri)||P.TaskScope.Workspace,`${i.name}.version`,"factorio",i.IncrementTask(),[])),t.push(new P.Task({label:`${i.name}.upload`,type:"factorio",modname:i.label,command:"upload"},P.workspace.getWorkspaceFolder(i.resourceUri)||P.TaskScope.Workspace,`${i.name}.upload`,"factorio",i.PostToPortalTask(),[])),t.push(new P.Task({label:`${i.name}.details`,type:"factorio",modname:i.label,command:"details"},P.workspace.getWorkspaceFolder(i.resourceUri)||P.TaskScope.Workspace,`${i.name}.details`,"factorio",i.DetailsTask(),[])),t.push(new P.Task({label:`${i.name}.publish`,type:"factorio",modname:i.label,command:"publish"},P.workspace.getWorkspaceFolder(i.resourceUri)||P.TaskScope.Workspace,`${i.name}.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=nt.latestPackages(this.modPackages.values());for(let i of this.modPackages.values())if(i.label===e.definition.modname&&n.has(i)){let s=i;switch(e.definition.command){case"run":return s.RunTask(e.definition.script,e.definition.scriptArgs);case"compile":return s.RunTask("compile");case"datestamp":return s.DateStampTask();case"package":return s.PackageTask();case"version":return s.IncrementTask();case"upload":return s.PostToPortalTask();case"details":return s.DetailsTask();case"publish":return s.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 P.Task(e.definition,e.scope||P.TaskScope.Workspace,e.name,e.source,n,[])}}ConfigErrorTask(e,t){return new P.CustomExecution(async()=>new Ge(n=>{n.write(t+`
|
|
25
|
-
`),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 P.CustomExecution(async()=>new Ge(async n=>{await tt(n,this.getFMTKCLIPath(),t,process.cwd()),n.close()}))}},nt=class extends P.TreeItem{constructor(t,n,i,s,o,a){super(t);this.resourceUri=t;this.modinfo=n;this.keychain=i;this.context=s;this._onDidChange=o;this.gitapi=a;this.command={title:"Open",command:"vscode.open",arguments:[t]},this.UpdateTreeItemFields()}resourceUri;modinfo;keychain;context;_onDidChange;gitapi;get name(){return this.modinfo.name}get title(){return this.modinfo.title}get version(){return this.modinfo.version}get scripts(){return this.modinfo.package?.scripts}static sort(t,n){let i=t.name.toLowerCase().localeCompare(n.name.toLowerCase());if(i!==0)return i*100;let s=
|
|
24
|
+
`;return!Fl.spawnSync("/bin/sh",[],{input:n,stdio:["pipe","inherit","inherit"]}).error}catch{return!1}else return r.kill("SIGKILL"),!0}});var kl=M(Ne=>{"use strict";var sv=Ne&&Ne.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),sc=Ne&&Ne.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&sv(e,r,t)};Object.defineProperty(Ne,"__esModule",{value:!0});Ne.DiagnosticPullMode=Ne.vsdiag=void 0;sc(N(),Ne);sc(B(),Ne);var Ml=vo();Object.defineProperty(Ne,"vsdiag",{enumerable:!0,get:function(){return Ml.vsdiag}});Object.defineProperty(Ne,"DiagnosticPullMode",{enumerable:!0,get:function(){return Ml.DiagnosticPullMode}});sc(rc(),Ne)});var Ll=M(be=>{"use strict";var Al=be&&be.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,i)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),ov=be&&be.__setModuleDefault||(Object.create?(function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}):function(r,e){r.default=e}),Di=be&&be.__importStar||(function(){var r=function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[n.length]=i);return n},r(e)};return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),i=0;i<n.length;i++)n[i]!=="default"&&Al(t,e,n[i]);return ov(t,e),t}})(),jl=be&&be.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Al(e,r,t)};Object.defineProperty(be,"__esModule",{value:!0});be.SettingMonitor=be.LanguageClient=be.TransportKind=void 0;var Ut=Di(I("child_process")),oc=Di(I("fs")),ac=Di(I("path")),El=Di(I("readline")),tn=I("vscode"),Nn=Di(He()),ql=rc(),av=xl(),ue=Pc(),cv=id(),uv=rd();jl(Pc(),be);jl(kl(),be);var Il="^1.91.0",le;(function(r){r[r.stdio=0]="stdio",r[r.ipc=1]="ipc",r[r.pipe=2]="pipe",r[r.socket=3]="socket"})(le||(be.TransportKind=le={}));var en;(function(r){function e(t){let n=t;return n&&n.kind===le.socket&&Nn.number(n.port)}r.isSocket=e})(en||(en={}));var cc;(function(r){function e(t){return Nn.string(t.command)}r.is=e})(cc||(cc={}));var uc;(function(r){function e(t){return Nn.string(t.module)}r.is=e})(uc||(uc={}));var lc;(function(r){function e(t){let n=t;return n&&n.writer!==void 0&&n.reader!==void 0}r.is=e})(lc||(lc={}));var dc;(function(r){function e(t){let n=t;return n&&n.process!==void 0&&typeof n.detached=="boolean"}r.is=e})(dc||(dc={}));var fc=class extends ql.BaseLanguageClient{_serverOptions;_forceDebug;_serverProcess;_isDetached;_isInDebugMode;constructor(e,t,n,i,s){let o,a,u,l,p;Nn.string(t)?(o=e,a=t,u=n,l=i,p=!!s):(o=e.toLowerCase(),a=e,u=t,l=n,p=i),p===void 0&&(p=!1),super(o,a,l),this._serverOptions=u,this._forceDebug=p,this._isInDebugMode=p;try{this.checkVersion()}catch(h){throw Nn.string(h.message)&&this.outputChannel.appendLine(h.message),h}}checkVersion(){let e=cv(tn.version);if(!e)throw new Error(`No valid VS Code version detected. Version string is: ${tn.version}`);if(e.prerelease&&e.prerelease.length>0&&(e.prerelease=[]),!uv(e,Il))throw new Error(`The language client requires VS Code version ${Il} but received version ${tn.version}`)}get isInDebugMode(){return this._isInDebugMode}get serverProcess(){return this._serverProcess}async restart(){await this.stop(),this.isInDebugMode?(await new Promise(e=>setTimeout(e,1e3)),await this.start()):await this.start()}shutdown(e,t=2e3){return super.shutdown(e,t).finally(()=>{if(this._serverProcess){let n=this._serverProcess;this._serverProcess=void 0,(this._isDetached===void 0||!this._isDetached)&&this.checkProcessDied(n),this._isDetached=void 0}})}checkProcessDied(e){!e||e.pid===void 0||setTimeout(()=>{try{e.pid!==void 0&&(process.kill(e.pid,0),(0,av.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(f,m){if(!f&&!m)return;let g=Object.create(null);return Object.keys(process.env).forEach(v=>g[v]=process.env[v]),m&&(g.ELECTRON_RUN_AS_NODE="1",g.ELECTRON_NO_ASAR="1"),f&&Object.keys(f).forEach(v=>g[v]=f[v]),g}let n=["--debug=","--debug-brk=","--inspect=","--inspect-brk="],i=["--debug","--debug-brk","--inspect","--inspect-brk"];function s(){let f=process.execArgv;return f?f.some(m=>n.some(g=>m.startsWith(g))||i.some(g=>m===g)):!1}function o(f){if(f.stdin===null||f.stdout===null||f.stderr===null)throw new Error("Process created without stdio streams")}function a(f,m){El.createInterface({input:f,crlfDelay:1/0,terminal:!1,historySize:0}).on("line",g=>m.info(g))}function u(f,m){El.createInterface({input:f,crlfDelay:1/0,terminal:!1,historySize:0}).on("line",g=>m.error(g))}let l=this._serverOptions;if(Nn.func(l))return l().then(f=>{if(ql.MessageTransports.is(f))return this._isDetached=!!f.detached,f;if(lc.is(f))return this._isDetached=!!f.detached,{reader:new ue.StreamMessageReader(f.reader),writer:new ue.StreamMessageWriter(f.writer)};{let m;return dc.is(f)?(m=f.process,this._isDetached=f.detached):(m=f,this._isDetached=!1),u(m.stderr,this.outputChannel),{reader:new ue.StreamMessageReader(m.stdout),writer:new ue.StreamMessageWriter(m.stdin)}}});let p,h=l;return h.run||h.debug?this._forceDebug||s()?(p=h.debug,this._isInDebugMode=!0):(p=h.run,this._isInDebugMode=!1):p=l,this._getServerWorkingDir(p.options).then(f=>{if(uc.is(p)&&p.module){let m=p,g=m.transport||le.stdio;if(m.runtime){let v=[],_=m.options??Object.create(null);_.execArgv&&_.execArgv.forEach(F=>v.push(F)),v.push(m.module),m.args&&m.args.forEach(F=>v.push(F));let T=Object.create(null);T.cwd=f,T.env=t(_.env,!1);let C=this._getRuntimePath(m.runtime,f),D;if(g===le.ipc?(T.stdio=[null,null,null,"ipc"],v.push("--node-ipc")):g===le.stdio?v.push("--stdio"):g===le.pipe?(D=(0,ue.generateRandomPipeName)(),v.push(`--pipe=${D}`)):en.isSocket(g)&&v.push(`--socket=${g.port}`),v.push(`--clientProcessId=${process.pid.toString()}`),g===le.ipc||g===le.stdio){let F=Ut.spawn(C,v,T);return!F||!F.pid?Ln(F,`Launching server using runtime ${C} failed.`):(this._serverProcess=F,u(F.stderr,this.outputChannel),g===le.ipc?(a(F.stdout,this.outputChannel),Promise.resolve({reader:new ue.IPCMessageReader(F),writer:new ue.IPCMessageWriter(F)})):Promise.resolve({reader:new ue.StreamMessageReader(F.stdout),writer:new ue.StreamMessageWriter(F.stdin)}))}else{if(g===le.pipe)return(0,ue.createClientPipeTransport)(D).then(F=>{let E=Ut.spawn(C,v,T);return!E||!E.pid?Ln(E,`Launching server using runtime ${C} failed.`):(this._serverProcess=E,u(E.stderr,this.outputChannel),a(E.stdout,this.outputChannel),F.onConnected().then(Q=>({reader:Q[0],writer:Q[1]})))});if(en.isSocket(g))return(0,ue.createClientSocketTransport)(g.port).then(F=>{let E=Ut.spawn(C,v,T);return!E||!E.pid?Ln(E,`Launching server using runtime ${C} failed.`):(this._serverProcess=E,u(E.stderr,this.outputChannel),a(E.stdout,this.outputChannel),F.onConnected().then(Q=>({reader:Q[0],writer:Q[1]})))})}}else{let v;return new Promise((_,T)=>{let C=(m.args&&m.args.slice())??[];g===le.ipc?C.push("--node-ipc"):g===le.stdio?C.push("--stdio"):g===le.pipe?(v=(0,ue.generateRandomPipeName)(),C.push(`--pipe=${v}`)):en.isSocket(g)&&C.push(`--socket=${g.port}`),C.push(`--clientProcessId=${process.pid.toString()}`);let D=m.options?{...m.options}:Object.create(null);if(D.env=t(D.env,!0),D.execArgv=D.execArgv||[],D.cwd=f,D.silent=!0,g===le.ipc||g===le.stdio){let F=Ut.fork(m.module,C||[],D);o(F),this._serverProcess=F,u(F.stderr,this.outputChannel),g===le.ipc?(a(F.stdout,this.outputChannel),_({reader:new ue.IPCMessageReader(this._serverProcess),writer:new ue.IPCMessageWriter(this._serverProcess)})):_({reader:new ue.StreamMessageReader(F.stdout),writer:new ue.StreamMessageWriter(F.stdin)})}else g===le.pipe?(0,ue.createClientPipeTransport)(v).then(F=>{let E=Ut.fork(m.module,C||[],D);o(E),this._serverProcess=E,u(E.stderr,this.outputChannel),a(E.stdout,this.outputChannel),F.onConnected().then(Q=>{_({reader:Q[0],writer:Q[1]})},T)},T):en.isSocket(g)&&(0,ue.createClientSocketTransport)(g.port).then(F=>{let E=Ut.fork(m.module,C||[],D);o(E),this._serverProcess=E,u(E.stderr,this.outputChannel),a(E.stdout,this.outputChannel),F.onConnected().then(Q=>{_({reader:Q[0],writer:Q[1]})},T)},T)})}}else if(cc.is(p)&&p.command){let m=p,g=p.args!==void 0?p.args.slice(0):[],v,_=p.transport;if(_===le.stdio)g.push("--stdio");else if(_===le.pipe)v=(0,ue.generateRandomPipeName)(),g.push(`--pipe=${v}`);else if(en.isSocket(_))g.push(`--socket=${_.port}`);else if(_===le.ipc)throw new Error("Transport kind ipc is not support for command executable");let T=Object.assign({},m.options);if(T.cwd=T.cwd||f,_===void 0||_===le.stdio){let C=Ut.spawn(m.command,g,T);return!C||!C.pid?Ln(C,`Launching server using command ${m.command} failed.`):(u(C.stderr,this.outputChannel),this._serverProcess=C,this._isDetached=!!T.detached,Promise.resolve({reader:new ue.StreamMessageReader(C.stdout),writer:new ue.StreamMessageWriter(C.stdin)}))}else{if(_===le.pipe)return(0,ue.createClientPipeTransport)(v).then(C=>{let D=Ut.spawn(m.command,g,T);return!D||!D.pid?Ln(D,`Launching server using command ${m.command} failed.`):(this._serverProcess=D,this._isDetached=!!T.detached,u(D.stderr,this.outputChannel),a(D.stdout,this.outputChannel),C.onConnected().then(F=>({reader:F[0],writer:F[1]})))});if(en.isSocket(_))return(0,ue.createClientSocketTransport)(_.port).then(C=>{let D=Ut.spawn(m.command,g,T);return!D||!D.pid?Ln(D,`Launching server using command ${m.command} failed.`):(this._serverProcess=D,this._isDetached=!!T.detached,u(D.stderr,this.outputChannel),a(D.stdout,this.outputChannel),C.onConnected().then(F=>({reader:F[0],writer:F[1]})))})}}return Promise.reject(new Error("Unsupported server configuration "+JSON.stringify(l,null,4)))}).finally(()=>{this._serverProcess!==void 0&&this._serverProcess.on("exit",(f,m)=>{f===0?this.info("Server process exited successfully",void 0,!1):f!==null&&this.error(`Server process exited with code ${f}.`,void 0,!1),m!==null&&this.error(`Server process exited with signal ${m}.`,void 0,!1)})})}_getRuntimePath(e,t){if(ac.isAbsolute(e))return e;let n=this._mainGetRootPath();if(n!==void 0){let i=ac.join(n,e);if(oc.existsSync(i))return i}if(t!==void 0){let i=ac.join(t,e);if(oc.existsSync(i))return i}return e}_mainGetRootPath(){let e=tn.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=>{oc.lstat(t,(i,s)=>{n(!i&&s.isDirectory()?t:void 0)})}):Promise.resolve(void 0)}};be.LanguageClient=fc;var hc=class{_client;_setting;_listeners;constructor(e,t){this._client=e,this._setting=t,this._listeners=[]}start(){return tn.workspace.onDidChangeConfiguration(this.onDidChangeConfiguration,this,this._listeners),this.onDidChangeConfiguration(),new tn.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?tn.workspace.getConfiguration(t).get(n,!1):tn.workspace.getConfiguration(t);i&&this._client.needsStart()?this._client.start().catch(s=>this._client.error("Start failed after configuration change",s,"force")):!i&&this._client.needsStop()&&this._client.stop().catch(s=>this._client.error("Stop failed after configuration change",s,"force"))}};be.SettingMonitor=hc;function Ln(r,e){return r===null?Promise.reject(e):new Promise((t,n)=>{r.on("error",i=>{n(`${e} ${i}`)}),setImmediate(()=>n(e))})}});import*as H from"vscode";import*as $r from"path";var ms=Yn(sd(),1);import*as P from"vscode";import*as Pn from"path";import{fork as ud}from"child_process";import{EventEmitter as cd}from"events";var Zn=class extends cd{buf;matchers;constructor(e,t){super(),this.buf=Buffer.alloc(0),this.matchers=t instanceof Buffer?[t]:t,e.on("close",()=>{this.emit("close")}),e.on("end",()=>{this.emit("end")}),e.on("data",n=>{for(this.buf=Buffer.concat([this.buf,n]);this.buf.length>0;){let i=this.matchers.map(o=>this.buf.indexOf(o instanceof Buffer?o:o.start)),s=i.reduce((o,a)=>o===-1?a:a===-1?o:Math.min(o,a));if(s!==-1){let o=this.matchers[i.indexOf(s)];if(o instanceof Buffer)s>0&&this.emit("segment",this.buf.subarray(0,s)),this.buf=this.buf.subarray(s+o.length);else{let a=o;s>0&&(this.emit("segment",this.buf.subarray(0,s)),this.buf=this.buf.subarray(s));let u=this.buf.indexOf(a.end,a.start.length);if(u!==-1)this.emit("segment",this.buf.subarray(a.start.length,u)),this.buf=this.buf.subarray(u+a.end.length);else return}}else return}})}};import*as ps from"vscode";var Bi=class{constructor(e){this.secrets=e}secrets;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 ps.window.showInformationMessage("Key already present. Replace it?",{modal:!0},"Yes","No")==="Yes"),!e))return{from:"secrets",key:t};if(t=await ps.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")}};import{platform as ld,tmpdir as dd}from"os";var $={valTypes:{none:"NONE",primitive:"PRIM",object:"OBJECT",array:"ARRAY"},getValType:function(r){return r&&typeof r=="object"||Array.isArray(r)?Array.isArray(r)?$.valTypes.array:typeof r=="object"?$.valTypes.object:void 0:$.valTypes.primitive},getPathType:function(r){var e=[];for(var t in r){var n=r[t];n?$.isNumber(n)?e.push($.valTypes.array):e.push($.valTypes.object):e.push($.valTypes.none)}return e},isUndefined:function(r){return r===void 0},isNumber:function(r){return!isNaN(parseFloat(r))&&isFinite(r)&&r.indexOf(".")===-1},isEmptyObj:function(r){for(var e in r)if(Object.hasOwnProperty.call(r,e))return!1;return JSON.stringify(r)===JSON.stringify({})},isNotObject:function(r){return!r||typeof r!="object"},isEmptyArray:function(r){return Array.isArray(r)&&r.length==0},isNotArray:function(r){return Array.isArray(r)==0},removeEmptyArrayItem:function(r){return r.filter(function(e){return e!=null&&e!=""})},getFieldName:function(r,e,t,n,i){return i?(e||"")+($.isNumber(r)?"["+r+"]":(t&&!e?"":".")+r):n?(e||"")+"["+r+"]":(e?e+".":"")+r},startsWith:function(r,e){return r.indexOf(e)==0},convert:function(r,e){var t={};return $.isNotObject(r)&&$.isNotArray(r)?e?(t[e]=r,t):r:$.isEmptyArray(r)?r:(function n(i,s,o){var a=Array.isArray(i);for(var u in i){var l=i[u];l&&typeof l=="object"?Array.isArray(l)?$.isEmptyArray(l)?t[$.getFieldName(u,s,o,!1,!0)]=l:t=n(l,$.getFieldName(u,s,o,!1,!0),a):a&&$.isEmptyObj(l)==0?t=n(l,$.getFieldName(u,s,o,!0)):$.isEmptyObj(l)==0?t=n(l,$.getFieldName(u,s,o)):$.isEmptyObj(l)&&(t[$.getFieldName(u,s,o,a)]=l):a||$.isNumber(u)?t[$.getFieldName(u,s,o,!0)]=l:t[$.getFieldName(u,s,o)]=l}return t})(r,e,!0)},backward:function(r,e){var t={},n=/\[(\d+)\]/g;if($.isNotObject(r)&&$.isNotArray(r))return e?r[e]:r;if($.isEmptyArray(r))return r;for(var i in r){var s=r[i];if(e){var o=new RegExp("^"+e);i=i.replace(o,"")}i=i.replace(n,".$1"),$.startsWith(i,".")&&(i=i.replace(/^\./,""));var a=i.split("."),u=$.getPathType(a);$.isUndefined(u)||u[0]!=$.valTypes.array||Array.isArray(t)!=0||(t=[]),(function l(p,h,f,m){var g=a.shift(),v=u.shift();if(g!==void 0&&g!=""){if(g=$.isNumber(g)?parseInt(g):g,a.length>0)return h[g]===void 0&&(h[g]=u[0]==$.valTypes.array?[]:{}),void l(p,h[g],g,h);v==$.valTypes.array&&f&&m?(Array.isArray(m[f])==0&&(m[f]=[]),m[f].push(p)):h[g]=p}else t=p})(s,t)}return t}};var zi;function fd(r){return zi?ld()==="win32"?`${r};${P.Uri.joinPath(zi,"bin").fsPath}`:`${r}:${P.Uri.joinPath(zi,"bin").fsPath}`:r}async function Rc(r){if(P.workspace.workspaceFolders){let e=new Bi(r.secrets);r.subscriptions.push(P.commands.registerCommand("factorio.clearApiKey",async()=>{await e.ClearApiKey()})),r.subscriptions.push(P.commands.registerCommand("factorio.setApiKey",async()=>{await e.ReadyAPIKey(!0)}));let t=P.extensions.getExtension("vscode.git");t&&!t.isActive&&await t.activate();let n=new ys(r,e,t?.exports.getAPI(1));r.subscriptions.push(n);let i=P.window.createTreeView("factoriomods",{treeDataProvider:n});r.subscriptions.push(i),zi=r.extensionUri}}var vs=class{constructor(e,t){this.context=e;this.modPackages=t}context;modPackages;provideTasks(e){let t=[],n=nt.latestPackages(this.modPackages.values());for(let i of this.modPackages.values())n.has(i)&&(t.push(new P.Task({label:`${i.name}.datestamp`,type:"factorio",modname:i.label,command:"datestamp"},P.workspace.getWorkspaceFolder(i.resourceUri)||P.TaskScope.Workspace,`${i.name}.datestamp`,"factorio",i.DateStampTask(),[])),t.push(new P.Task({label:`${i.name}.package`,type:"factorio",modname:i.label,command:"package"},P.workspace.getWorkspaceFolder(i.resourceUri)||P.TaskScope.Workspace,`${i.name}.package`,"factorio",i.PackageTask(),[])),t.push(new P.Task({label:`${i.name}.version`,type:"factorio",modname:i.label,command:"version"},P.workspace.getWorkspaceFolder(i.resourceUri)||P.TaskScope.Workspace,`${i.name}.version`,"factorio",i.IncrementTask(),[])),t.push(new P.Task({label:`${i.name}.upload`,type:"factorio",modname:i.label,command:"upload"},P.workspace.getWorkspaceFolder(i.resourceUri)||P.TaskScope.Workspace,`${i.name}.upload`,"factorio",i.PostToPortalTask(),[])),t.push(new P.Task({label:`${i.name}.details`,type:"factorio",modname:i.label,command:"details"},P.workspace.getWorkspaceFolder(i.resourceUri)||P.TaskScope.Workspace,`${i.name}.details`,"factorio",i.DetailsTask(),[])),t.push(new P.Task({label:`${i.name}.publish`,type:"factorio",modname:i.label,command:"publish"},P.workspace.getWorkspaceFolder(i.resourceUri)||P.TaskScope.Workspace,`${i.name}.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=nt.latestPackages(this.modPackages.values());for(let i of this.modPackages.values())if(i.label===e.definition.modname&&n.has(i)){let s=i;switch(e.definition.command){case"run":return s.RunTask(e.definition.script,e.definition.scriptArgs);case"compile":return s.RunTask("compile");case"datestamp":return s.DateStampTask();case"package":return s.PackageTask();case"version":return s.IncrementTask();case"upload":return s.PostToPortalTask();case"details":return s.DetailsTask();case"publish":return s.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 P.Task(e.definition,e.scope||P.TaskScope.Workspace,e.name,e.source,n,[])}}ConfigErrorTask(e,t){return new P.CustomExecution(async()=>new Ge(n=>{n.write(t+`
|
|
25
|
+
`),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 P.CustomExecution(async()=>new Ge(async n=>{await tt(n,this.getFMTKCLIPath(),t,process.cwd()),n.close()}))}},nt=class extends P.TreeItem{constructor(t,n,i,s,o,a){super(t);this.resourceUri=t;this.modinfo=n;this.keychain=i;this.context=s;this._onDidChange=o;this.gitapi=a;this.command={title:"Open",command:"vscode.open",arguments:[t]},this.UpdateTreeItemFields()}resourceUri;modinfo;keychain;context;_onDidChange;gitapi;get name(){return this.modinfo.name}get title(){return this.modinfo.title}get version(){return this.modinfo.version}get scripts(){return this.modinfo.package?.scripts}static sort(t,n){let i=t.name.toLowerCase().localeCompare(n.name.toLowerCase());if(i!==0)return i*100;let s=ms.compare(t.version,n.version,{loose:!0});return s!==0?-s*10:t.resourceUri<n.resourceUri?-1:t.resourceUri>n.resourceUri?1:0}static latestPackages(t){let n=new Map;for(let s of t)n.has(s.name)?n.get(s.name).push(s):n.set(s.name,[s]);let i=new Set;for(let s of n.values())i.add(s.reduce((o,a)=>ms.compare(o.version,a.version,{loose:!0})<0?a:o));return i}async gitLabel(){let t=this.gitapi?.getRepository(this.resourceUri);if(t){let n=await t.log({}),i=0;for(;i<n.length;i++){let s=n[i];if("refNames"in s&&s.refNames.some(u=>u.match(/^tag:/)))return`+${i}`}}}async ReloadInfo(){let n=(await P.workspace.openTextDocument(this.resourceUri)).getText();this.modinfo=JSON.parse(n);let i=await this.gitLabel();this.UpdateTreeItemFields(i),this._onDidChange(this)}UpdateTreeItemFields(t){this.label=this.name,this.description=t?`${this.version} (${t})`:this.version,this.tooltip=this.title}getFMTKCLIPath(){return this.context.asAbsolutePath("./dist/fmtk-cli.js")}RunTask(t,n){return new P.CustomExecution(async()=>new Ge(async i=>{await tt(i,this.getFMTKCLIPath(),["run",t,...n??[]],P.Uri.joinPath(this.resourceUri,"..").fsPath),await this.ReloadInfo(),i.close()}))}DateStampTask(){return new P.CustomExecution(async()=>new Ge(async t=>{await tt(t,this.getFMTKCLIPath(),["datestamp"],P.Uri.joinPath(this.resourceUri,"..").fsPath),await this.ReloadInfo(),t.close()}))}PackageTask(){let t=["package"];return P.workspace.getConfiguration(void 0,this.resourceUri).get("factorio.package.zipLocation","inside")==="outside"&&(t.push("--outdir"),t.push("..")),new P.CustomExecution(async()=>new Ge(async i=>{await tt(i,this.getFMTKCLIPath(),t,P.Uri.joinPath(this.resourceUri,"..").fsPath),await this.ReloadInfo(),i.close()}))}IncrementTask(){return new P.CustomExecution(async()=>new Ge(async t=>{await tt(t,this.getFMTKCLIPath(),["version"],P.Uri.joinPath(this.resourceUri,"..").fsPath),await this.ReloadInfo(),t.close()}))}PostToPortalTask(){return new P.CustomExecution(async()=>new Ge(async t=>{await this.ReloadInfo();let n=P.workspace.getConfiguration(void 0,this.resourceUri),i=Pn.dirname(this.resourceUri.path);n.get("factorio.package.zipLocation","inside")==="outside"&&(i=Pn.dirname(i));let s=this.resourceUri.with({path:i}),a=(await P.workspace.fs.readDirectory(s)).filter(([h,f])=>f===P.FileType.File&&h.startsWith(this.name)&&h.match(/_\d+\.\d+\.\d+\.zip$/)).map(([h,f])=>h).sort().reverse(),u=await P.window.showQuickPick(a,{placeHolder:"Select Package to upload"});if(!u){t.close();return}let l=Pn.join(s.fsPath,u),p=await this.keychain.ReadyAPIKey();p&&await tt(t,this.getFMTKCLIPath(),["upload",l,this.name],P.Uri.joinPath(this.resourceUri,"..").fsPath,p.from!=="env"?{FACTORIO_UPLOAD_API_KEY:p.key}:void 0),await this.ReloadInfo(),t.close()}))}DetailsTask(){return new P.CustomExecution(async()=>new Ge(async t=>{let n=await this.keychain.ReadyAPIKey();n&&await tt(t,this.getFMTKCLIPath(),["details"],P.Uri.joinPath(this.resourceUri,"..").fsPath,n.from!=="env"?{FACTORIO_UPLOAD_API_KEY:n.key}:void 0),await this.ReloadInfo(),t.close()}))}PublishTask(){return new P.CustomExecution(async()=>new Ge(async t=>{let n=await this.keychain.ReadyAPIKey();n&&await tt(t,this.getFMTKCLIPath(),["publish"],P.Uri.joinPath(this.resourceUri,"..").fsPath,n.from!=="env"?{FACTORIO_UPLOAD_API_KEY:n.key}:void 0),await this.ReloadInfo(),t.close()}))}},ys=class{constructor(e,t,n){this.context=e;this.keychain=t;this.gitapi=n;this.modPackages=new Map,P.workspace.findFiles("**/info.json").then(s=>{s.forEach(o=>{this.updateInfoJson(o)})});let i=P.workspace.createFileSystemWatcher("**/info.json");this.subscriptions.push(i.onDidChange(s=>this.updateInfoJson(s))),this.subscriptions.push(i.onDidCreate(s=>this.updateInfoJson(s))),this.subscriptions.push(i.onDidDelete(s=>this.removeInfoJson(s))),this.subscriptions.push(i),n&&this.subscriptions.push(n.onDidOpenRepository(async s=>{for(let o of this.modPackages.values()){let a=n.getRepository(o.resourceUri);s.rootUri.toString()===a?.rootUri?.toString()&&(await o.ReloadInfo(),this.subscriptions.push(s.onDidCommit(async()=>{await o.ReloadInfo()})),this.subscriptions.push(s.onDidCheckout(async()=>{await o.ReloadInfo()})))}})),this.subscriptions.push(P.tasks.registerTaskProvider("factorio",new vs(this.context,this.modPackages))),this.subscriptions.push(P.commands.registerCommand("factorio.openchangelog",async s=>P.window.showTextDocument(P.Uri.joinPath(s.resourceUri,"../changelog.txt")))),this.subscriptions.push(P.commands.registerCommand("factorio.datestamp",async s=>{let o=(await P.tasks.fetchTasks({type:"factorio"})).find(a=>a.definition.command==="datestamp"&&a.definition.modname===s.label);await P.tasks.executeTask(o)})),this.subscriptions.push(P.commands.registerCommand("factorio.package",async s=>{let o=(await P.tasks.fetchTasks({type:"factorio"})).find(a=>a.definition.command==="package"&&a.definition.modname===s.label);await P.tasks.executeTask(o)})),this.subscriptions.push(P.commands.registerCommand("factorio.version",async s=>{let o=(await P.tasks.fetchTasks({type:"factorio"})).find(a=>a.definition.command==="version"&&a.definition.modname===s.label);await P.tasks.executeTask(o)})),this.subscriptions.push(P.commands.registerCommand("factorio.upload",async s=>{let o=(await P.tasks.fetchTasks({type:"factorio"})).find(a=>a.definition.command==="upload"&&a.definition.modname===s.label);await P.tasks.executeTask(o)})),this.subscriptions.push(P.commands.registerCommand("factorio.details",async s=>{let o=(await P.tasks.fetchTasks({type:"factorio"})).find(a=>a.definition.command==="details"&&a.definition.modname===s.label);await P.tasks.executeTask(o)})),this.subscriptions.push(P.commands.registerCommand("factorio.publish",async s=>{let o=(await P.tasks.fetchTasks({type:"factorio"})).find(a=>a.definition.command==="publish"&&a.definition.modname===s.label);await P.tasks.executeTask(o)}))}context;keychain;gitapi;_onDidChangeTreeData=new P.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 P.workspace.openTextDocument(e)).getText();if(n){let i=JSON.parse(n);if(i&&i.name)if(this.modPackages.has(e.toString()))await this.modPackages.get(e.toString())?.ReloadInfo();else{let s=new nt(e,i,this.keychain,this.context,o=>{this._onDidChangeTreeData.fire(o)},this.gitapi);this.modPackages.set(e.toString(),s),await s.ReloadInfo()}else 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 nt){let t=[];if(this.modPackages){let n=nt.latestPackages(this.modPackages.values());n.has(e)&&this.modPackages.forEach((i,s)=>{i.label===e.label&&!n.has(i)&&(t.push(i),i.contextValue="older")})}return t.sort(nt.sort)}else return[];else{let t=[];if(this.modPackages){let n=nt.latestPackages(this.modPackages.values());for(let i of this.modPackages.values())if(n.has(i)){t.push(i);let s=["latest"];try{await P.workspace.fs.stat(P.Uri.joinPath(i.resourceUri,"../changelog.txt")),s.push("haschangelog")}catch{}i.contextValue=s.join(" "),i.collapsibleState=(()=>{for(let o of this.modPackages.values())if(i.label===o.label&&!n.has(o))return P.TreeItemCollapsibleState.Collapsed;return P.TreeItemCollapsibleState.None})()}}return t.sort(nt.sort)}}},gs=P.Uri.file(Pn.join(dd(),`vscode-${process.pid}-fmtk-config.json`));async function tt(r,e,t,n,i,s){let o=P.workspace.getConfiguration("factorio");await P.workspace.fs.writeFile(gs,Buffer.from(JSON.stringify($.convert({docs:await o.get("docs"),package:await o.get("package")}))));let a=Object.assign({},process.env,i,{FMTK_CONFIG:gs.fsPath}),u=process.execArgv;for(let l of o.get("tasks.execArgvOptions",[]))switch(l){case"clear":u=[];break;case"stripjsflags":u=u.filter(p=>!p.match(/^--js-flags/));break;case"stripinspect":u=u.filter(p=>!p.match(/^--inspect/));break}return u=[...u,...o.get("tasks.execArgvExtra",[])],a.Path=fd(a.Path??""),new Promise((l,p)=>{let h=ud(e,t,{cwd:n,execArgv:u,env:a,stdio:"pipe"});new Zn(h.stdout,Buffer.from(`
|
|
26
26
|
`)).on("segment",g=>{r.write(g.toString()+`\r
|
|
27
27
|
`)}),new Zn(h.stderr,Buffer.from(`
|
|
28
28
|
`)).on("segment",g=>{g.toString().match(/^Debugger listening/)&&console.log(g.toString()),r.write(g.toString()+`\r
|
|
29
29
|
`)}),h.on("error",g=>{r.write(`${g.message}\r
|
|
30
|
-
`)}),h.on("exit",(g,v)=>{P.workspace.fs.delete(
|
|
31
|
-
`)),close:()=>n.fire()},this.tokensource.token);i?i.finally(()=>{n.fire()}):n.fire()}close(){this.tokensource.cancel()}};import*as q from"vscode";import*as
|
|
30
|
+
`)}),h.on("exit",(g,v)=>{P.workspace.fs.delete(gs),l(g??-1)}),s&&h.stdin.write(s),h.stdin.end()})}var Ge=class{constructor(e){this.runner=e}runner;writeEmitter=new P.EventEmitter;onDidWrite=this.writeEmitter.event;closeEmitter=new P.EventEmitter;onDidClose=this.closeEmitter.event;tokensource=new P.CancellationTokenSource;open(e){let t=this.writeEmitter,n=this.closeEmitter,i=this.runner({write:s=>t.fire(s.replace(/\r?\n/g,`\r
|
|
31
|
+
`)),close:()=>n.fire()},this.tokensource.token);i?i.finally(()=>{n.fire()}):n.fire()}close(){this.tokensource.cancel()}};import*as q from"vscode";import*as Ds from"os";import*as Ec from"path";var Xn=Yn(kc(),1);import*as Ie from"os";import*as G from"path";import{execFile as hd}from"child_process";function sn(r,e){return r.match(/^~[\\\/]/)&&(r=G.posix.join(Ie.homedir().replace(/\\/g,"/"),r.replace(/^~[\\\/]/,""))),r=r.replace("${userHome}",Ie.homedir()),e?.[0]&&(r=r.replace("${workspaceFolder}",e[0].uri.fsPath)),r=r.replace(/\$\{env:(\w+)}/g,(t,n)=>process.env[n]??t),r}var ei=class{constructor(e,t,n,i){this.fs=e;this.fv=t;this.docs=n;this.workspaceFolders=i}fs;fv;docs;workspaceFolders;async getBinaryVersion(){return new Promise((e,t)=>{hd(this.factorioPath,["--version"],{env:Object.assign({},process.env,{SteamAppId:"427520"})},(n,i,s)=>{n&&t(new Error(n.message));let o=i?.match(/^Version: ([0-9\.]+) /m);o&&e(o[1]),t(new Error(`Unable to read version:
|
|
32
32
|
stdout: ${i}
|
|
33
33
|
stderr: ${s}`))})})}get name(){return this.fv.name}get onlineOnly(){return!this.fv.factorioPath}get factorioPath(){if(!this.fv.factorioPath)throw new Error("No factorioPath");return sn(this.fv.factorioPath,this.workspaceFolders)}get isLocal(){return!!this.fv.factorioPath}async docArgs(e){let t=["luals-addon"];if(this.fv.onlineDocs?t.push("-o",this.fv.onlineDocs===!0?"latest":this.fv.onlineDocs):t.push("-d",this.docsPath,"-p",this.protosPath),e&&this.isLocal){try{let n=G.join(await this.scriptOutputPath(),"mod-settings-dump.json");await this.fs.stat(Re.file(n)),t.push("--sdump",n)}catch{}try{let n=G.join(await this.scriptOutputPath(),"data-raw-dump.json");await this.fs.stat(Re.file(n)),t.push("--pdump",n)}catch{}}return t}get docsPath(){return G.join(this.factorioPath,this.fv.docsPath?this.fv.docsPath:Ie.platform()==="darwin"?"../../doc-html/runtime-api.json":"../../../doc-html/runtime-api.json")}get protosPath(){return G.join(this.factorioPath,this.fv.protosPath?this.fv.protosPath:this.fv.docsPath?G.join(this.fv.docsPath,"../prototype-api.json"):Ie.platform()==="darwin"?"../../doc-html/prototype-api.json":"../../../doc-html/prototype-api.json")}configPathIsOverriden(){return!!this.fv.configPath}async configPath(){if(this.fv.configPath)return sn(this.fv.configPath,this.workspaceFolders);let e=G.resolve(G.dirname(this.factorioPath),"../../config-path.cfg");try{let t=Xn.parse((await this.fs.readFile(Re.file(e))).toString());return G.resolve(this.translatePath(t["config-path"]),"./config.ini")}catch{}return this.translatePath("__PATH__system-write-data__/config/config.ini")}iniData;async configIni(){return this.iniData||(this.iniData=this.fs.readFile(Re.file(await this.configPath())).then(e=>Xn.parse(e.toString()))),this.iniData}async isPrototypeCacheEnabled(){try{return(await this.configIni()).other?.["cache-prototype-data"]}catch{return}}async disablePrototypeCache(){this.iniData=void 0;let e=Re.file(await this.configPath()),t=(await this.fs.readFile(e)).toString();t=t.replace("cache-prototype-data=","; cache-prototype-data="),await this.fs.writeFile(e,Buffer.from(t)),this.iniData=Xn.parse(t)}async isMouseAutoCaptureDisabled(){try{return(await this.configIni()).other?.["disable-mouse-auto-capture"]}catch{return}}async disableMouseAutoCapture(){this.iniData=void 0;let e=Re.file(await this.configPath()),t=(await this.fs.readFile(e)).toString(),n=t.match(/^;? *disable-mouse-auto-capture=.*$/m);if(n)t=t.slice(0,n.index)+`
|
|
34
34
|
disable-mouse-auto-capture=true
|
|
35
35
|
`+t.slice(n.index+n[0].length);else{let i=t.match(/^\[other\]$/m);t=t.slice(0,i.index+i[0].length)+`
|
|
36
36
|
disable-mouse-auto-capture=true
|
|
37
|
-
`+t.slice(i.index+i[0].length)}await this.fs.writeFile(e,Buffer.from(t)),this.iniData=Xn.parse(t)}async defaultModsPath(){let e=(await this.configIni())?.path?.["write-data"];if(!e)throw new Error("path.write-data missing in config.ini");return G.posix.normalize(G.resolve(this.translatePath(e),"mods"))}async dataPath(){let e=(await this.configIni().catch(()=>({path:{"read-data":"__PATH__executable__/../../data"}}))).path?.["read-data"];if(!e)throw new Error("path.read-data missing in config.ini");return G.posix.normalize(this.translatePath(e))}async lualibPath(){return G.posix.normalize(G.resolve(await this.dataPath(),"core","lualib"))}async writeDataPath(){let e=(await this.configIni()).path?.["write-data"];if(!e)throw new Error("path.write-data missing in config.ini");return G.posix.normalize(this.translatePath(e))}async scriptOutputPath(){return G.posix.join(await this.writeDataPath(),"script-output")}translatePath(e){if(e.startsWith("__PATH__executable__"))return G.join(G.dirname(this.factorioPath),e.replace("__PATH__executable__",""));if(e.startsWith("__PATH__system-write-data__")){let t=Ie.platform()==="win32"?G.resolve(process.env.APPDATA,"Factorio"):Ie.platform()==="linux"?G.resolve(Ie.homedir(),".factorio"):Ie.platform()==="darwin"?G.resolve(Ie.homedir(),"Library/Application Support/factorio"):"??";return G.join(t,e.replace("__PATH__system-write-data__",""))}if(e.startsWith("__PATH__system-read-data__")){let t=Ie.platform()==="linux"?"/usr/share/factorio":Ie.platform()==="darwin"?G.resolve(G.dirname(this.factorioPath),"../data"):G.resolve(G.dirname(this.factorioPath),"../../data");return G.join(t,e.replace("__PATH__system-read-data__",""))}return e}is(e){let t=this.fv;return t.name===e.name&&t.factorioPath===e.factorioPath&&t.configPath===e.configPath&&t.onlineDocs===e.onlineDocs&&t.docsPath===e.docsPath&&t.protosPath===e.protosPath}};var Oe=q.workspace.fs,hd=[{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:"Steam",factorioPath:"~/.local/share/Steam/steamapps/common/Factorio/bin/x64/factorio"},{name:"Home",factorioPath:"~/.factorio/bin/x64/factorio"}],ws={name:"Online Latest",onlineDocs:!0},Cs={name:"Online Stable",onlineDocs:"stable"},bs=["tangzx.emmylua","xuhuanzy.emmylua-luals","theo.emmylua"],Gi=class{constructor(e,t,n){this.context=e;this.output=t;this.fsprovider=n;this.bar=q.window.createStatusBarItem("factorio-version",q.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(q.commands.registerCommand("factorio.selectVersion",()=>this.selectVersionCommand())),e.subscriptions.push(q.commands.registerCommand("factorio.checkConfig",()=>this.checkConfigCommand())),e.subscriptions.push(q.commands.registerCommand("factorio.disablePrototypeCache",()=>this.disablePrototypeCacheCommand())),e.subscriptions.push(q.commands.registerCommand("factorio.disableMouseAutoCapture",()=>this.disableMouseAutoCaptureCommand())),this.migrateActiveVersion().then(()=>this.loadActiveVersion())}context;output;fsprovider;bar;async migrateActiveVersion(){if(this.context.workspaceState.get("active_version"))return;let e=q.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 ei(q.workspace.fs,e,t,q.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(i=>i.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")),this.output.info(`Workspace Trusted: ${q.workspace.isTrusted}`),q.workspace.workspaceFolders?.forEach(i=>this.output.info(`Workspace folder: ${i.uri.toString()}`));let t=q.workspace.getConfiguration("factorio");this.output.info(`execArgv: ${JSON.stringify(process.execArgv)}`),this.output.info(`execArgvOptions: ${JSON.stringify(t.get("tasks.execArgvOptions",[]))}`),this.output.info(`execArgvExtras: ${JSON.stringify(t.get("tasks.execArgvExtras",[]))}`);let n=q.extensions.getExtension("sumneko.lua");n?await this.checkLuaLSConfig(n,e,t):this.output.info("LuaLS (sumneko.lua) not present");for(let i of bs){let s=q.extensions.getExtension(i);s?await this.checkEmmyLuaConfig(s,e,t):this.output.info(`EmmyLua (${i}) not present`)}}async checkEmmyLuaConfig(e,t,n){this.output.info(`EmmyLua (${e.id}) ${e.packageJSON.version} ${e.isActive?"Activated":"Not Yet Activated"}`);let i=this.context.storageUri;if(!i){this.output.error("No Workspace");return}try{let s=(await Oe.readFile(_e.joinPath(i,"emmylua/factorio/config.json"))).toString(),o=JSON.parse(s);this.output.info(`Library bundle found in ${i.fsPath}, generated from Factorio ${o.factorioVersion} with FMTK ${o.bundleVersion}`);for(let a of fs())try{(await Oe.readFile(_e.joinPath(i,"emmylua",a.name))).toString()!==a.content&&this.output.info(`file ${a.name} content mismatch!`)}catch(u){this.output.error(`file ${a.name} ${u}`)}}catch(s){this.output.error(`Missing or damaged library bundle info ${s}`)}}async checkLuaLSConfig(e,t,n){this.output.info(`LuaLS (${e.id}) ${e.packageJSON.version} ${e.isActive?"Activated":"Not Yet Activated"}`);let i=q.workspace.getConfiguration("Lua"),s=this.context.storageUri;if(!s){this.output.error("No Workspace");return}try{let f=(await Oe.readFile(_e.joinPath(s,"sumneko-3rd/factorio/config.json"))).toString(),m=JSON.parse(f);this.output.info(`Library bundle found in ${s.fsPath}, generated from Factorio ${m.factorioVersion} with FMTK ${m.bundleVersion}`);for(let g of fs())try{(await Oe.readFile(_e.joinPath(s,"sumneko-3rd",g.name))).toString()!==g.content&&this.output.info(`file ${g.name} content mismatch!`)}catch(v){this.output.error(`file ${g.name} ${v}`)}}catch(f){this.output.error(`Missing or damaged library bundle info ${f}`)}let o=i.get("workspace.userThirdParty");if(!o)this.output.warn("Lua.workspace.userThirdParty not present!");else{let f=_e.joinPath(s,"sumneko-3rd").fsPath;o.includes(f)?this.output.info(`Lua.workspace.userThirdParty: workspace link OK (${f})`):this.output.warn(`Lua.workspace.userThirdParty: workspace link missing! (${f})`);let m=o.filter(g=>g!==f);for(let g of m)g.match(/justarandomgeek\.factoriomod\-debug[\\\/]sumneko\-3rd$/)?this.output.warn(`Lua.workspace.userThirdParty: stale workspace link? (${g})`):this.output.info(`Lua.workspace.userThirdParty: other library (${g})`)}let a=i.get("workspace.checkThirdParty"),u=a==="ApplyInMemory";a===!1||a==="Disable"?this.output.warn(`Lua.workspace.checkThirdParty = ${a}`):this.output.info(`Lua.workspace.checkThirdParty = ${a}`);let l=n.get("workspace.manageLibraryDataLinks",!1),p=i.get("workspace.library");if(!p)this.output.warn("Lua.workspace.library not present!");else{let f=[];if(!t.onlineOnly){let _=Re.file(await t.dataPath()).fsPath;f.push(_),p.includes(_)?this.output.info(`Lua.workspace.library: /data link OK (${_})`):l&&this.output.warn(`Lua.workspace.library: /data link missing! (${_})`)}let m=_e.joinPath(s,"sumneko-3rd/factorio/library").fsPath,g=p.find(_=>Re.file(_).fsPath===m);g?(f.push(g),u?this.output.warn(`Lua.workspace.library: redundant workspace library link (${g})`):this.output.info(`Lua.workspace.library: workspace library link OK (${g})`)):u||this.output.warn(`Lua.workspace.library: workspace library link missing! (${m})`);let v=p.filter(_=>!f.includes(_));for(let _ of v)_.match(/justarandomgeek\.factoriomod\-debug[\\\/]sumneko\-3rd[\\\/]factorio[\\\/]library$/)?this.output.warn(`Lua.workspace.library: stale workspace link? (${_})`):_.endsWith("data")?this.output.warn(`Lua.workspace.library: stale data link? (${_})`):this.output.info(`Lua.workspace.library: other library (${_})`)}let h=i.get("runtime.plugin");if(!h)u||this.output.warn("Lua.runtime.plugin not present!");else{let f=_e.joinPath(s,"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(q.debug.activeDebugSession?.type==="factoriomod"){q.window.showErrorMessage("Cannot select Factorio version while debugging.");return}let e=q.workspace.getConfiguration("factorio"),t=e.get("versions",[]),n=t.map(h=>h.factorioPath),i=(await Promise.all(hd.filter(h=>!n.includes(h.factorioPath)).map(async h=>{try{return(await Oe.stat(Re.file(sn(h.factorioPath,q.workspace.workspaceFolders)))).type&q.FileType.File?h:void 0}catch{return}}))).filter(h=>!!h),s=async h=>h.onlineDocs===!0?"latest":h.onlineDocs?h.onlineDocs:(await this.tryJsonDocs(h).catch(()=>{}))?.application_version??"unknown",o=await q.window.showQuickPick([{kind:q.QuickPickItemKind.Separator,label:"settings"},...await Promise.all(t.map(async h=>({fv:h,label:h.name,description:await s(h),detail:h.factorioPath}))),{kind:q.QuickPickItemKind.Separator,label:"autodetected"},...await Promise.all(i.map(async h=>({fv:h,label:h.name,description:await s(h),detail:h.factorioPath}))),{fv:ws,label:ws.name,description:await s(ws)},{fv:Cs,label:Cs.name,description:await s(Cs)},{kind:q.QuickPickItemKind.Separator,label:""},{fv:void 0,label:"Select another install locaton...",picked:!1}],{title:"Select Factorio Version"});if(!o)return;let a=o.fv;if(a?.factorioPath){let h=!1;try{(await Oe.stat(Re.file(sn(a.factorioPath,q.workspace.workspaceFolders)))).type&q.FileType.File&&(h=!0)}catch{}if(!h)if(await q.window.showErrorMessage("The selected factorio version is no longer present at the specified location","Remove from settings","Cancel")==="Remove from settings"){e.update("versions",t.filter(m=>m!==a));return}else return}let u=!1;if(!a){let h=await q.window.showOpenDialog({canSelectFiles:!0,canSelectFolders:!1,openLabel:"Select Factorio binary",filters:Ss.platform()==="win32"?{"":["exe"]}:void 0});if(!h)return;let f=await q.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;a={name:f,factorioPath:h[0].fsPath},u=!0}let l;try{l=await this.tryJsonDocs(a)}catch(h){if(!a.factorioPath){q.window.showErrorMessage(`Unable to read online docs: ${h}`);return}if(await q.window.showErrorMessage(`Unable to read JSON docs: ${h}`,"Select alternate location","Cancel")!=="Select alternate location")return;let f=await q.window.showOpenDialog({canSelectFiles:!0,canSelectFolders:!1,openLabel:"Select Runtime JSON Docs",title:"Select Runtime JSON Docs",filters:{"JSON Docs":["json"]}});if(!f)return;a.docsPath=kc.relative(sn(a.factorioPath,q.workspace.workspaceFolders),f[0].fsPath);try{l=await this.tryJsonDocs(a)}catch(m){q.window.showErrorMessage(`Unable to read JSON docs: ${m}`);return}}await this.context.workspaceState.update("active_version",a),u&&(t.push(a),e.update("versions",t)),this.bar.text=`Factorio ${l.application_version} (${a.name})`;let p=this._active_version;this._active_version=new ei(q.workspace.fs,a,l,q.workspace.workspaceFolders),this.output.info(`Active Factorio version: ${a.name} (${l.application_version})`),await this.generateDocs(p)}_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||e.onlineDocs==="throw"?"latest":e.onlineDocs}/runtime-api.json`,s=await fetch(i);if(!s.ok)throw new Error(`Error fetching ${i} : ${s.statusText}`);t=await s.text()}else{if(!e.factorioPath)throw new Error(`Invalid Config: requires at least one of factorioPath or onlineDocs in ${e.name}`);let n=_e.joinPath(Re.file(sn(e.factorioPath,q.workspace.workspaceFolders)),e.docsPath?e.docsPath:Ss.platform()==="darwin"?"../../doc-html/runtime-api.json":"../../../doc-html/runtime-api.json");t=(await Oe.readFile(n)).toString()}return new bc(t)}async wantsRegenFromConfigFileVersion(e,t){try{let n=(await Oe.readFile(e)).toString(),i=JSON.parse(n);return i.factorioVersion!==t.docs.application_version||i.bundleVersion!==$i}catch{return!0}}async checkDocs(){let e=await this.getActiveVersion();if(!e)return;let t=this.context.storageUri;if(!t)return;let n=!1;if(bs.some(o=>q.extensions.getExtension(o))&&(n||=await this.wantsRegenFromConfigFileVersion(_e.joinPath(t,"emmylua/factorio/config.json"),e)),q.extensions.getExtension("sumneko.lua")&&(n||=await this.wantsRegenFromConfigFileVersion(_e.joinPath(t,"sumneko-3rd/factorio/config.json"),e)),n)return this.generateDocs()}async generateDocs(e){if(!q.workspace.getConfiguration("factorio").get("docs.generateDocs",!0))return;let t=await this.getActiveVersion();if(!t)return;let n=this.context.storageUri;if(!n){q.window.showErrorMessage("Unable to generate docs: no open workspace");return}let i=bs.map(o=>q.extensions.getExtension(o)).find(o=>!!o);if(i){this.output.appendLine(`Generating EmmyLua bundle for ${i.id}`);let o=q.workspace.getConfiguration("factorio"),a=_e.joinPath(n,"emmylua");await this.refreshDocFiles(a,t);let u=await q.workspace.findFiles(".luarc.json"),l="{}";u.length>0&&(l=(await Oe.readFile(u[0])).toString()),l=Dn(l,Sn(l,["$schema"],"https://raw.githubusercontent.com/EmmyLuaLs/emmylua-analyzer-rust/refs/heads/main/crates/emmylua_code_analysis/resources/schema.json",{})),l=Dn(l,Sn(l,["runtime","version"],"Lua5.2",{})),l=Dn(l,Sn(l,["runtime","requirePattern"],["?","?.lua"],{}));let p=[_e.joinPath(a,"factorio","library").fsPath];o.get("workspace.manageLibraryDataLinks")!==!1&&(p.push(await t.dataPath()),p.push(await t.lualibPath())),l=Dn(l,Sn(l,["workspace","library"],p,{})),l=Dn(l,Sn(l,["diagnostics","disable"],["unnecessary-if"],{})),u.length>0?await Oe.writeFile(u[0],Buffer.from(l)):await Oe.writeFile(_e.joinPath(q.workspace.workspaceFolders[0].uri,".luarc.json"),Buffer.from(l))}let s=q.extensions.getExtension("sumneko.lua");if(s){this.output.appendLine(`Generating LuaLS bundle for ${s.id}`);let o=_e.joinPath(n,"sumneko-3rd");await this.refreshDocFiles(o,t);let a=q.workspace.getConfiguration("Lua"),u=a.get("workspace.library",[]),l=(g,...v)=>{if(g){let _=_e.joinPath(g,...v),T=u.indexOf(_.fsPath);T!==-1&&u.splice(T,1)}},p=async(g,...v)=>{try{let _=_e.joinPath(g,...v);!u.includes(_.fsPath)&&(await Oe.stat(_)).type&q.FileType.Directory&&u.push(_.fsPath)}catch{}},h=q.workspace.getConfiguration("factorio");if(e&&!e.onlineOnly){let g=Re.file(await e.dataPath());l(g)}if(u.length===0?await a.update("workspace.library",void 0):await a.update("workspace.library",u),h.get("workspace.manageLibraryDataLinks")===!0){let g=Re.file(await t.dataPath());await p(g)}u.length===0?await a.update("workspace.library",void 0):await a.update("workspace.library",u);let f=a.get("workspace.userThirdParty",[]);f=f.filter(g=>!g.includes("justarandomgeek.factoriomod-debug")),await a.update("workspace.userThirdParty",f),f.push(o.fsPath),await a.update("workspace.userThirdParty",f);let m=a.get("workspace.checkThirdParty");m&&["Ask","Apply","ApplyInMemory"].includes(m)||await a.update("workspace.checkThirdParty","ApplyInMemory"),s.isActive||await s.activate()}}async refreshDocFiles(e,t){await Oe.createDirectory(e);try{await Promise.allSettled([Oe.delete(_e.joinPath(e,"factorio","library"),{recursive:!0}),Oe.delete(_e.joinPath(e,"factorio","factorio-plugin"),{recursive:!0})])}catch{}let n=this.output,i=await tt({close(){},write(s){n.info(`docgen: ${s.trimEnd()}`)}},this.context.asAbsolutePath("./dist/fmtk-cli.js"),await t.docArgs(q.workspace.getConfiguration("factorio").get("docs.usePrototypeDumps",!1)),e.fsPath);if(i!==0){this.output.warn(`docgen return code ${i}`),await q.window.showErrorMessage("Error while generating docs","Show Output")==="Show Output"&&this.output.show();return}}};import*as zt from"path";import*as te from"vscode";var Ji=class{type;ctime;mtime;size;name;data;constructor(e){this.type=te.FileType.File,this.ctime=Date.now(),this.mtime=Date.now(),this.size=0,this.name=e}},on=class{type;ctime;mtime;size;name;entries;constructor(e){this.type=te.FileType.Directory,this.ctime=Date.now(),this.mtime=Date.now(),this.size=0,this.name=e,this.entries=new Map}},Yi=class{root=new on("");stat(e){return this._lookup(e,!1)}readDirectory(e){let t=this._lookupAsDirectory(e,!1),n=[];for(let[i,s]of t.entries)n.push([i,s.type]);return n}readFile(e){let t=this._lookupAsFile(e,!1).data;if(t)return t;throw te.FileSystemError.FileNotFound()}writeFile(e,t,n){let i=zt.posix.basename(e.path),s=this._lookupParentDirectory(e),o=s.entries.get(i);if(o instanceof on)throw te.FileSystemError.FileIsADirectory(e);if(!o&&!n.create)throw te.FileSystemError.FileNotFound(e);if(o&&n.create&&!n.overwrite)throw te.FileSystemError.FileExists(e);o||(o=new Ji(i),s.entries.set(i,o),this._fireSoon({type:te.FileChangeType.Created,uri:e})),o.mtime=Date.now(),o.size=t.byteLength,o.data=t,this._fireSoon({type:te.FileChangeType.Changed,uri:e})}rename(e,t,n){if(!n.overwrite&&this._lookup(t,!0))throw te.FileSystemError.FileExists(t);let i=this._lookup(e,!1),s=this._lookupParentDirectory(e),o=this._lookupParentDirectory(t),a=zt.posix.basename(t.path);s.entries.delete(i.name),i.name=a,o.entries.set(a,i),this._fireSoon({type:te.FileChangeType.Deleted,uri:e},{type:te.FileChangeType.Created,uri:t})}delete(e,t){let n=e.with({path:zt.posix.dirname(e.path)}),i=zt.posix.basename(e.path),s=this._lookupAsDirectory(n,t?.silent??!1);if(!s||!s.entries.has(i)){if(t?.silent)return;throw te.FileSystemError.FileNotFound(e)}s.entries.delete(i),s.mtime=Date.now(),s.size-=1,this._fireSoon({type:te.FileChangeType.Changed,uri:n},{uri:e,type:te.FileChangeType.Deleted})}createDirectory(e){let t=zt.posix.basename(e.path),n=e.with({path:zt.posix.dirname(e.path)}),i=this._lookupAsDirectory(n,!1),s=new on(t);i.entries.set(s.name,s),i.mtime=Date.now(),i.size+=1,this._fireSoon({type:te.FileChangeType.Changed,uri:n},{type:te.FileChangeType.Created,uri:e})}_lookup(e,t){let n=e.path.split("/"),i=this.root;for(let s of n){if(!s)continue;let o;if(i instanceof on&&(o=i.entries.get(s)),!o){if(t)return;throw te.FileSystemError.FileNotFound(e)}i=o}return i}_lookupAsDirectory(e,t){let n=this._lookup(e,t);if(n instanceof on)return n;throw te.FileSystemError.FileNotADirectory(e)}_lookupAsFile(e,t){let n=this._lookup(e,t);if(n instanceof Ji)return n;throw te.FileSystemError.FileIsADirectory(e)}_lookupParentDirectory(e){let t=e.with({path:zt.posix.dirname(e.path)});return this._lookupAsDirectory(t,!1)}_emitter=new te.EventEmitter;_bufferedEvents=[];_fireSoonHandle;onDidChangeFile=this._emitter.event;watch(e){return new te.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)}};var Pi=Yn(jl(),1);import*as Nl from"path";import{workspace as Ll}from"vscode";function Ul(r){let e=r.asAbsolutePath(Nl.join("dist","fmtk-cli.js")),t={execArgv:["--nolazy","--inspect-brk=34199"]},n={run:{module:e,transport:Pi.TransportKind.ipc,args:["lsp"]},debug:{module:e,transport:Pi.TransportKind.ipc,args:["lsp"],options:t}},i={documentSelector:[{language:"factorio-locale"},{language:"factorio-changelog"},{language:"lua"}],synchronize:{fileEvents:[Ll.createFileSystemWatcher("**/locale/*/*.cfg"),Ll.createFileSystemWatcher("**/changelog.txt")]}},s=new Pi.LanguageClient("factorioLanguageServer","Factorio Language Server",n,i);s.start(),r.subscriptions.push({dispose(){return s.stop()}})}import*as Se from"vscode";function Kl(r){return r.type==="int"?{type:"int",value:lv("",r.value)}:r}function hc(r,e){return typeof e=="bigint"?`jsonbigint ${e}n`:e}function lv(r,e){if(typeof e=="string"){let t=e.match(/^jsonbigint\x01\x02 (\d+)n$/);if(t)return BigInt(t[1])}return e}function Ur(){let r="",e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let t=0;t<32;t++)r+=e.charAt(Math.floor(Math.random()*e.length));return r}var Hl=Yn(Sc()),Wl=(0,Hl.decompressFromBase64)("DwQgIg8gwgKgmgBQKIAIAWAXAtgGwHwCwAUMJrijgIYB2A5gLwBEAptY4SWs5QCYcCQwLMwyUUAYzSUATgGcRTAKowAYgFoAHO2KCQatTsXyUY8QHtqGVhhTzxAV2kBLDAE8UABzM4n49xjMUCxx3ShwcMwB3CjNeJzoUJyxKWmZZFAAzaTMsdAwMD3SzaUzs3LNHFGYADytqWScLFB4naWZxAOlXABodGh4g6hCTcKjbcWcPDHSMKRspADdmE1sPdqcM3xRqC3FmADodfQEhETFMArVmAEd7JwWmKAs6jDUAZXbHF1c1BG9fVyMCTPaxMHjMDKUew4V6yaTiFAAch21GYiIA3IksLQ1HCEQAScSyDxvCrw5j4zGyNw4Zi4+EoQnE0mOPaUzLPekEokkslsqkTJxTLlIlF7NT4sUUjHaIiCYSibaUYRMBZOZiRLzSDBA8yWUGMSJOHizejgtXio0mtDdRLUFxOMK48RhZj0ACM+wADLLBD5qABrdBtDJMfEAWTMPA++XitFkAHVmAAjNUa/ZE2T4oFtHBMamuWmyLgiIEAehOGBctLwkYGMardFkwDLVYwNeILa4vA4wGTUdcJzsVYsAkEaHdeAAasw5I1qF3JzpBC0FokeKrZw0LOwW6uTmXh/OODpgAtZOZwWoPDRmDh0jJHWoqMm70wG3HZL7BOfL3Sb6iOBqKIybrkwIFqO67BvKI2r2B4La/lG/63kBIFjmeF7IdeqHAZQoHGuB+FqAATOwABK9iWEkywAOIRMmYSIVhV4AXeeHJhhSGsbhIFgYwEEAMwUVRVbCCgCCzigRizsxf44YBHFcSxKGKWm0SEYw6mQd+gggR2cr8EZwAYP2PDuJp1IyBg8G7q2ZmDsugitvhBnGWW3Gqex6nKfJbFAep/HaWRY56a5zChXpDn8dIok0WotAMWEdmmQOoUtvpEXLnJ2H+WoPnZZ5CneeqGkblppVqMJ6WZZFJnRZpsXUcI16zmo9jyNIKUOelLnJm5zlFXlBVyjlPGAbIJ6jVYWAeFQVj8fIsZ0LiGDOHQ34mdINUDOIVCyLI+YiI2OLUMqzApXwTkmVdhnGUVVi1Gomx3rt+2HYwS0nflYT2BdeBjXSj2vC9OC3UZzkYODxlQxI71HctOJ6mt3hfnVRXJvY+RNHtlAHQj33grSVhApQHhrDINB7Ewvg7iYziUM++FvowYB3iI/1OcZxI0HDeMfZetPUMCLR6sB0h42gdk89QdUeSpaiY9jsvXa20MZdtp6tsws3zVlRCnjNc2UAtlnHXGajUPYWCvl1GFrTtfP4595srWdwiXTt6MK8Dz3qmDTsfV9FsLL9F0oG4axMFbNuznZD01CD/vQ5DKc3YHBMW8j2T3rpP4K0rATC7jzvBytRMc6T5PcBL1DU4wQukwzTOvnmrPsyTkWCDLGeMILeoi0L4uS9LAFyxjWNF71UMYa2mujdrusm/rhs68bpvlWXOL9t4m0O9dsMl0HrunednsHyn+fyZI7QBv21S91vP04H98cKzf4h32Y1TT2nh/wy7RGahs6ozzpheShccYAKfhXEmJhq6Uzrm6Bueom5PhfCzNmxNOZ3W5gBXu/ccZRiHmtEeANDxjy5oDRWk9RyqxntlOeB4jZ6ymnpNeetFon2Ad4Yoe954Q3TkfTObsz7kIYXdG6dUMH4CeBEaQAAuFsMi6rxA8FjCOrgo5914V1R+3DQ4v2WE/cw8jn6vwrFQlRABBHAHgpBKLLCoqhCcnqgzevzEROJDF/VsNwxmPjw6R2QTHW2b95K+3cb/R2wjAHfRAbnb2EDaHF2gdw2B4cyYU1rvXRu9N0HMzblgyuXdgA91iYQ4uxCxakOLKPGg48C4pOiYw/eC8WHLzYSZDhy8uFAN4DwfhXsXE+0Tn7V6+j+k8B4JbMR1DInJxaZIiREMr7YR4NkDwPAoipM8XEi2AzgJaJwastZV4zBTGPNSdatBqEXJHCrXBZy6T3OPDvHAdzLl0KeeA7CrzRyhNkvLeS/zHmnN+ecr5ws0DGnBLLeIGBPkPNKUVUFeBTHFCRceKhwL1mbO2ZEMF7kVkww8aXbhCS0YjOScrSZ30BnJgwGweB2SqbILyY+RmMimDWOmXnbu+CKnVKIaLCwagBn1KJe5CeyslnEoERlHpVgukXkmDYYJTAsBRmhOHKUYYpTZlsPCMMdYPxNiTKmUq+wABWWYgTggyLOCsLZVVCgwL2MsPVOxljIPgIAA===");var Kr=class{constructor(e){this.context=e;this.context.subscriptions.push(Se.window.registerCustomEditorProvider("fmtk.modsettings",this,{supportsMultipleEditorsPerDocument:!1,webviewOptions:{retainContextWhenHidden:!0}}))}context;webviews=new Map;_onDidChangeCustomDocument=new Se.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 pc.create(e,t.backupId),s=[];return s.push(i.onDidChange(o=>{this._onDidChangeCustomDocument.fire({document:i,...o})})),s.push(i.onDidChangeContent(o=>{let a=this.webviews.get(i.uri.toString());a&&this.postMessage(a,"init",{version:i.version,saves_ints:i.saves_ints,settings:JSON.stringify(i.settings,hc),editable:Se.workspace.fs.isWritableFileSystem(i.uri.scheme)!==!1})})),i.onDidDispose(()=>s.forEach(o=>o.dispose())),i}resolveCustomEditor(e,t,n){let i=t.webview;this.webviews.set(e.uri.toString(),t),i.options={enableScripts:!0},i.html=Wl.replace(/\$cspSource\$/g,i.cspSource).replace(/\$nonce\$/g,Ur()).replace(/\$ModSettingsWebview\.css\$/g,i.asWebviewUri(Se.Uri.joinPath(this.context.extensionUri,"/dist/ModSettingsWebview.css")).toString()).replace(/\$ModSettingsWebview\.js\$/g,i.asWebviewUri(Se.Uri.joinPath(this.context.extensionUri,"/dist/ModSettingsWebview.js")).toString()),t.webview.onDidReceiveMessage(s=>this.onMessage(e,s)),t.webview.onDidReceiveMessage(s=>{s.type==="ready"&&this.postMessage(t,"init",{version:e.version,saves_ints:e.saves_ints,settings:JSON.stringify(e.settings,hc),editable:Se.workspace.fs.isWritableFileSystem(e.uri.scheme)!==!1})})}postMessage(e,t,n){e.webview.postMessage({type:t,body:n})}onMessage(e,t){if(t.type==="edit"){e.edit(t.body);return}}},pc=class r{constructor(e,t){this.uri=e;this._settings=new ds(new Qn(t))}uri;static async create(e,t){let n=typeof t=="string"?Se.Uri.parse(t):e,i=await Se.workspace.fs.readFile(n);return new r(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 Se.workspace.fs.writeFile(e,this._settings.save())}async revert(e){this._settings=new ds(new Qn(await Se.workspace.fs.readFile(this.uri))),this._onDidChangeDocument.fire({})}async backup(e,t){return await this.saveAs(e,t),{id:e.toString(),delete:()=>{Se.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,Kl(e.value)),this._onDidChange.fire({})}_onDidDispose=new Se.EventEmitter;onDidDispose=this._onDidDispose.event;_onDidChangeDocument=new Se.EventEmitter;onDidChangeContent=this._onDidChangeDocument.event;_onDidChange=new Se.EventEmitter;onDidChange=this._onDidChange.event;disposables=[this._onDidDispose,this._onDidChangeDocument,this._onDidChange];dispose(){this._onDidDispose.fire(),this.disposables.forEach(e=>e.dispose())}};import*as vn from"vscode";function Ti(r){switch(r.type){case"Table":case"TableWithMeta":return Object.assign({},r,{values:void 0,values_count:r.values.length});default:return r}}var $l=Yn(Sc()),Bl=(0,$l.decompressFromBase64)("DwQgIg8gwgKgmgBQKIAIAWAXAtgGwHwCwAUMJrijgIYB2A5gLwBEAptY4SWs5QCYcCQwLMwyUUAYzSUATgGcRTAKowAYgFoAHO2KCQatTsXyUY8QHtqGVhhTzxAV2kBLDAE8UABzM4n49xjMUCxx3ShwcMwB3CjNeJzoUJyxKWmZZFAAzaTMsdAwMD3SzaUzs3LNHFGYADytqWScLFB4naWZxAOlXABodGh4g6hCTcKjbcWcPDHSMKRspADdmE1sPdqcM3xRqC3FmADodfQEhETFMArVmAEd7JwWmKAs6jDUAZXbHF1c1BG9fVyMCTPaxMHjMDKUew4V6yaTiFAAch21GYiIA3IksLQ1HCEQAScSyDxvCrw5j4zGyNw4Zi4+EoQnE0mOPaUzLPekEokkslsqkTJxTLlIlF7NT4sUUjHaIiCYSibaUYRMBZOZiRLzSDBA8yWUGMSJOHizejgtXio0mtDdRLUFxOMK48RhZj0ACM+wADLLBD5qABrdBtDJMfFvQVTMCUDAAdWYACM1Rr9kTZPigW0cExqa5abIuCIgQB6E4YFy0vARyYYfbRjDAYvljCV4iNri8DjABNmHiuE52csWASCNDuvAANWYcka1Hb450ghaC0SPFV04aFnYjeXJ2Lg9nHB0wAPw8XpHH9co85HwGXq6Y2TMOtvxd3x/37SH1CPcpPkZsNw1iYLBe2hZggSlMMpQzWx4TDashQwet4yTdVIn2AArdMgXBDJp1LRtZAArtix7PtSLIfAgA===");import*as nn from"vscode";var Hr=class r{constructor(e,t){this.uri=e;this._data=new Pc(new Qn(t))}uri;static async create(e,t){let n=typeof t=="string"?nn.Uri.parse(t):e,i=await nn.workspace.fs.readFile(n);return new r(e,i)}_data;get version(){return this._data.version.format()}get rootdata(){let e={};for(let t in this._data.data)e[t]=Ti(this._data.data[t]);return e}find(e,t){return this._data.find(e,t)}_onDidDispose=new nn.EventEmitter;onDidDispose=this._onDidDispose.event;_onDidChangeDocument=new nn.EventEmitter;onDidChangeContent=this._onDidChangeDocument.event;_onDidChange=new nn.EventEmitter;onDidChange=this._onDidChange.event;disposables=[this._onDidDispose,this._onDidChangeDocument,this._onDidChange];dispose(){this._onDidDispose.fire(),this.disposables.forEach(e=>e.dispose())}};var Wr=class{constructor(e){this.context=e;this.context.subscriptions.push(vn.window.registerCustomEditorProvider("fmtk.scriptdat",this,{supportsMultipleEditorsPerDocument:!1,webviewOptions:{retainContextWhenHidden:!0}}))}context;webviews=new Map;_onDidChangeCustomDocument=new vn.EventEmitter;onDidChangeCustomDocument=this._onDidChangeCustomDocument.event;async openCustomDocument(e,t,n){let i=await Hr.create(e,t.backupId),s=[];return s.push(i.onDidChange(o=>{this._onDidChangeCustomDocument.fire({document:i,...o})})),s.push(i.onDidChangeContent(o=>{let a=this.webviews.get(i.uri.toString());a&&this.postMessage(a,"init",{version:i.version,data:i.rootdata})})),i.onDidDispose(()=>s.forEach(o=>o.dispose())),i}resolveCustomEditor(e,t,n){let i=t.webview;this.webviews.set(e.uri.toString(),t),i.options={enableScripts:!0},i.html=Bl.replace(/\$cspSource\$/g,i.cspSource).replace(/\$nonce\$/g,Ur()).replace(/\$ScriptDatWebview\.css\$/g,i.asWebviewUri(vn.Uri.joinPath(this.context.extensionUri,"/dist/ScriptDatWebview.css")).toString()).replace(/\$ScriptDatWebview\.js\$/g,i.asWebviewUri(vn.Uri.joinPath(this.context.extensionUri,"/dist/ScriptDatWebview.js")).toString()),t.webview.onDidReceiveMessage(s=>this.onMessage(e,s)),t.webview.onDidReceiveMessage(s=>{s.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){if(t.type==="fetch"){let n=t.body,i=e.find(n.modname,n.gcid),s;n.index!==void 0&&n.count!==void 0?s=i.values.slice(n.index,n.index+n.count):s=i.values,this.postMessage(this.webviews.get(e.uri.toString()),"values",{...n,values:s.map(o=>({key:Ti(o.key),value:Ti(o.value)}))})}}};async function w_(r){let e=W.window.createOutputChannel("FMTK",{log:!0});e.info(`FMTK ${$i}`);try{e.info("Registering FS Provider...");let t=new Yi;r.subscriptions.push(W.workspace.registerFileSystemProvider("fmtk",t,{isCaseSensitive:!0})),e.info("Registering Version Selector...");let n=new Gi(r,e,t);e.info("Registering Native Debug Provider...");let i=new gc(n);r.subscriptions.push(W.debug.registerDebugConfigurationProvider("factorio",i)),r.subscriptions.push(W.debug.registerDebugAdapterDescriptorFactory("factorio",i)),r.subscriptions.push(i),e.info("Registering Language Client..."),Ul(r),e.info("Registering Mod Package Provider..."),await Tc(r),e.info("Registering Custom Editors..."),new Kr(r),new Wr(r),e.info("Activate Complete")}catch(t){e.error(`Error while activating: ${t}`)}}var gc=class{constructor(e){this.versionSelector=e;this.disposables.push(W.debug.onDidReceiveDebugSessionCustomEvent(async t=>{if(t.session.type==="factorio")switch(t.event){case"profileRunning":await W.commands.executeCommand("setContext","factorio.debugProfileStarting",!1),await W.commands.executeCommand("setContext","factorio.debugProfileStopping",!1),await W.commands.executeCommand("setContext","factorio.debugProfileIsRunning",!0);break;case"profileComplete":await W.commands.executeCommand("setContext","factorio.debugProfileStarting",!1),await W.commands.executeCommand("setContext","factorio.debugProfileStopping",!1),await W.commands.executeCommand("setContext","factorio.debugProfileIsRunning",!1),await W.commands.executeCommand("vscode.open",W.Uri.file(t.body.path));break;default:break}})),this.disposables.push(W.commands.registerCommand("factorio.startProfile",async()=>{let t=W.debug.activeDebugSession;t&&(await W.commands.executeCommand("setContext","factorio.debugProfileStarting",!0),await W.commands.executeCommand("setContext","factorio.debugProfileStopping",!1),await W.commands.executeCommand("setContext","factorio.debugProfileIsRunning",!1),await t.customRequest("startProfile",{}))})),this.disposables.push(W.commands.registerCommand("factorio.stopProfile",async()=>{let t=W.debug.activeDebugSession;t&&(await W.commands.executeCommand("setContext","factorio.debugProfileStarting",!1),await W.commands.executeCommand("setContext","factorio.debugProfileStopping",!0),await W.commands.executeCommand("setContext","factorio.debugProfileIsRunning",!0),await t.customRequest("stopProfile",{}))}))}versionSelector;async resolveDebugConfigurationWithSubstitutedVariables(e,t,n){if(!await this.versionSelector.getActiveVersion())return;let s=W.workspace.getConfiguration("factorio.debug").get("env",{});return t.env={...s,...t.env,SteamAppId:"427520"},t}async createDebugAdapterDescriptor(e,t){let n=await this.versionSelector.getActiveVersion();if(!n)return;if(n.onlineOnly)throw new Error("Cannot debug online docs. Select a local Factorio install to debug.");await W.commands.executeCommand("setContext","factorio.debugProfileStarting",!1),await W.commands.executeCommand("setContext","factorio.debugProfileStopping",!1),await W.commands.executeCommand("setContext","factorio.debugProfileIsRunning",!1);let s=W.workspace.getConfiguration("factorio.debug").get("shim");return s?new W.DebugAdapterExecutable(s,[n.factorioPath,"--dap"],{env:e.configuration.env}):new W.DebugAdapterExecutable(n.factorioPath,["--dap"],{env:e.configuration.env})}disposables=[];dispose(){this.disposables.forEach(e=>e.dispose())}};export{w_ as activate};
|
|
37
|
+
`+t.slice(i.index+i[0].length)}await this.fs.writeFile(e,Buffer.from(t)),this.iniData=Xn.parse(t)}async defaultModsPath(){let e=(await this.configIni())?.path?.["write-data"];if(!e)throw new Error("path.write-data missing in config.ini");return G.posix.normalize(G.resolve(this.translatePath(e),"mods"))}async dataPath(){let e=(await this.configIni().catch(()=>({path:{"read-data":"__PATH__executable__/../../data"}}))).path?.["read-data"];if(!e)throw new Error("path.read-data missing in config.ini");return G.posix.normalize(this.translatePath(e))}async lualibPath(){return G.posix.normalize(G.resolve(await this.dataPath(),"core","lualib"))}async writeDataPath(){let e=(await this.configIni()).path?.["write-data"];if(!e)throw new Error("path.write-data missing in config.ini");return G.posix.normalize(this.translatePath(e))}async scriptOutputPath(){return G.posix.join(await this.writeDataPath(),"script-output")}translatePath(e){if(e.startsWith("__PATH__executable__"))return G.join(G.dirname(this.factorioPath),e.replace("__PATH__executable__",""));if(e.startsWith("__PATH__system-write-data__")){let t=Ie.platform()==="win32"?G.resolve(process.env.APPDATA,"Factorio"):Ie.platform()==="linux"?G.resolve(Ie.homedir(),".factorio"):Ie.platform()==="darwin"?G.resolve(Ie.homedir(),"Library/Application Support/factorio"):"??";return G.join(t,e.replace("__PATH__system-write-data__",""))}if(e.startsWith("__PATH__system-read-data__")){let t=Ie.platform()==="linux"?"/usr/share/factorio":Ie.platform()==="darwin"?G.resolve(G.dirname(this.factorioPath),"../data"):G.resolve(G.dirname(this.factorioPath),"../../data");return G.join(t,e.replace("__PATH__system-read-data__",""))}return e}is(e){let t=this.fv;return t.name===e.name&&t.factorioPath===e.factorioPath&&t.configPath===e.configPath&&t.onlineDocs===e.onlineDocs&&t.docsPath===e.docsPath&&t.protosPath===e.protosPath}};var Oe=q.workspace.fs,pd=[{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:"Steam",factorioPath:"~/.local/share/Steam/steamapps/common/Factorio/bin/x64/factorio"},{name:"Home",factorioPath:"~/.factorio/bin/x64/factorio"}],Cs={name:"Online Latest",onlineDocs:!0},bs={name:"Online Stable",onlineDocs:"stable"},Ss=["tangzx.emmylua","xuhuanzy.emmylua-luals","theo.emmylua"],Gi=class{constructor(e,t,n){this.context=e;this.output=t;this.fsprovider=n;this.bar=q.window.createStatusBarItem("factorio-version",q.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(q.commands.registerCommand("factorio.selectVersion",()=>this.selectVersionCommand())),e.subscriptions.push(q.commands.registerCommand("factorio.checkConfig",()=>this.checkConfigCommand())),e.subscriptions.push(q.commands.registerCommand("factorio.disablePrototypeCache",()=>this.disablePrototypeCacheCommand())),e.subscriptions.push(q.commands.registerCommand("factorio.disableMouseAutoCapture",()=>this.disableMouseAutoCaptureCommand())),this.migrateActiveVersion().then(()=>this.loadActiveVersion())}context;output;fsprovider;bar;async migrateActiveVersion(){if(this.context.workspaceState.get("active_version"))return;let e=q.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 ei(q.workspace.fs,e,t,q.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(i=>i.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")),this.output.info(`Workspace Trusted: ${q.workspace.isTrusted}`),q.workspace.workspaceFolders?.forEach(i=>this.output.info(`Workspace folder: ${i.uri.toString()}`));let t=q.workspace.getConfiguration("factorio");this.output.info(`execArgv: ${JSON.stringify(process.execArgv)}`),this.output.info(`execArgvOptions: ${JSON.stringify(t.get("tasks.execArgvOptions",[]))}`),this.output.info(`execArgvExtras: ${JSON.stringify(t.get("tasks.execArgvExtras",[]))}`);let n=q.extensions.getExtension("sumneko.lua");n?await this.checkLuaLSConfig(n,e,t):this.output.info("LuaLS (sumneko.lua) not present");for(let i of Ss){let s=q.extensions.getExtension(i);s?await this.checkEmmyLuaConfig(s,e,t):this.output.info(`EmmyLua (${i}) not present`)}}async checkEmmyLuaConfig(e,t,n){this.output.info(`EmmyLua (${e.id}) ${e.packageJSON.version} ${e.isActive?"Activated":"Not Yet Activated"}`);let i=this.context.storageUri;if(!i){this.output.error("No Workspace");return}try{let s=(await Oe.readFile(_e.joinPath(i,"emmylua/factorio/config.json"))).toString(),o=JSON.parse(s);this.output.info(`Library bundle found in ${i.fsPath}, generated from Factorio ${o.factorioVersion} with FMTK ${o.bundleVersion}`);for(let a of hs())try{(await Oe.readFile(_e.joinPath(i,"emmylua",a.name))).toString()!==a.content&&this.output.info(`file ${a.name} content mismatch!`)}catch(u){this.output.error(`file ${a.name} ${u}`)}}catch(s){this.output.error(`Missing or damaged library bundle info ${s}`)}}async checkLuaLSConfig(e,t,n){this.output.info(`LuaLS (${e.id}) ${e.packageJSON.version} ${e.isActive?"Activated":"Not Yet Activated"}`);let i=q.workspace.getConfiguration("Lua"),s=this.context.storageUri;if(!s){this.output.error("No Workspace");return}try{let f=(await Oe.readFile(_e.joinPath(s,"sumneko-3rd/factorio/config.json"))).toString(),m=JSON.parse(f);this.output.info(`Library bundle found in ${s.fsPath}, generated from Factorio ${m.factorioVersion} with FMTK ${m.bundleVersion}`);for(let g of hs())try{(await Oe.readFile(_e.joinPath(s,"sumneko-3rd",g.name))).toString()!==g.content&&this.output.info(`file ${g.name} content mismatch!`)}catch(v){this.output.error(`file ${g.name} ${v}`)}}catch(f){this.output.error(`Missing or damaged library bundle info ${f}`)}let o=i.get("workspace.userThirdParty");if(!o)this.output.warn("Lua.workspace.userThirdParty not present!");else{let f=_e.joinPath(s,"sumneko-3rd").fsPath;o.includes(f)?this.output.info(`Lua.workspace.userThirdParty: workspace link OK (${f})`):this.output.warn(`Lua.workspace.userThirdParty: workspace link missing! (${f})`);let m=o.filter(g=>g!==f);for(let g of m)g.match(/justarandomgeek\.factoriomod\-debug[\\\/]sumneko\-3rd$/)?this.output.warn(`Lua.workspace.userThirdParty: stale workspace link? (${g})`):this.output.info(`Lua.workspace.userThirdParty: other library (${g})`)}let a=i.get("workspace.checkThirdParty"),u=a==="ApplyInMemory";a===!1||a==="Disable"?this.output.warn(`Lua.workspace.checkThirdParty = ${a}`):this.output.info(`Lua.workspace.checkThirdParty = ${a}`);let l=n.get("workspace.manageLibraryDataLinks",!1),p=i.get("workspace.library");if(!p)this.output.warn("Lua.workspace.library not present!");else{let f=[];if(!t.onlineOnly){let _=Re.file(await t.dataPath()).fsPath;f.push(_),p.includes(_)?this.output.info(`Lua.workspace.library: /data link OK (${_})`):l&&this.output.warn(`Lua.workspace.library: /data link missing! (${_})`)}let m=_e.joinPath(s,"sumneko-3rd/factorio/library").fsPath,g=p.find(_=>Re.file(_).fsPath===m);g?(f.push(g),u?this.output.warn(`Lua.workspace.library: redundant workspace library link (${g})`):this.output.info(`Lua.workspace.library: workspace library link OK (${g})`)):u||this.output.warn(`Lua.workspace.library: workspace library link missing! (${m})`);let v=p.filter(_=>!f.includes(_));for(let _ of v)_.match(/justarandomgeek\.factoriomod\-debug[\\\/]sumneko\-3rd[\\\/]factorio[\\\/]library$/)?this.output.warn(`Lua.workspace.library: stale workspace link? (${_})`):_.endsWith("data")?this.output.warn(`Lua.workspace.library: stale data link? (${_})`):this.output.info(`Lua.workspace.library: other library (${_})`)}let h=i.get("runtime.plugin");if(!h)u||this.output.warn("Lua.runtime.plugin not present!");else{let f=_e.joinPath(s,"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(q.debug.activeDebugSession?.type==="factoriomod"){q.window.showErrorMessage("Cannot select Factorio version while debugging.");return}let e=q.workspace.getConfiguration("factorio"),t=e.get("versions",[]),n=t.map(h=>h.factorioPath),i=(await Promise.all(pd.filter(h=>!n.includes(h.factorioPath)).map(async h=>{try{return(await Oe.stat(Re.file(sn(h.factorioPath,q.workspace.workspaceFolders)))).type&q.FileType.File?h:void 0}catch{return}}))).filter(h=>!!h),s=async h=>h.onlineDocs===!0?"latest":h.onlineDocs?h.onlineDocs:(await this.tryJsonDocs(h).catch(()=>{}))?.application_version??"unknown",o=await q.window.showQuickPick([{kind:q.QuickPickItemKind.Separator,label:"settings"},...await Promise.all(t.map(async h=>({fv:h,label:h.name,description:await s(h),detail:h.factorioPath}))),{kind:q.QuickPickItemKind.Separator,label:"autodetected"},...await Promise.all(i.map(async h=>({fv:h,label:h.name,description:await s(h),detail:h.factorioPath}))),{fv:Cs,label:Cs.name,description:await s(Cs)},{fv:bs,label:bs.name,description:await s(bs)},{kind:q.QuickPickItemKind.Separator,label:""},{fv:void 0,label:"Select another install locaton...",picked:!1}],{title:"Select Factorio Version"});if(!o)return;let a=o.fv;if(a?.factorioPath){let h=!1;try{(await Oe.stat(Re.file(sn(a.factorioPath,q.workspace.workspaceFolders)))).type&q.FileType.File&&(h=!0)}catch{}if(!h)if(await q.window.showErrorMessage("The selected factorio version is no longer present at the specified location","Remove from settings","Cancel")==="Remove from settings"){e.update("versions",t.filter(m=>m!==a));return}else return}let u=!1;if(!a){let h=await q.window.showOpenDialog({canSelectFiles:!0,canSelectFolders:!1,openLabel:"Select Factorio binary",filters:Ds.platform()==="win32"?{"":["exe"]}:void 0});if(!h)return;let f=await q.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;a={name:f,factorioPath:h[0].fsPath},u=!0}let l;try{l=await this.tryJsonDocs(a)}catch(h){if(!a.factorioPath){q.window.showErrorMessage(`Unable to read online docs: ${h}`);return}if(await q.window.showErrorMessage(`Unable to read JSON docs: ${h}`,"Select alternate location","Cancel")!=="Select alternate location")return;let f=await q.window.showOpenDialog({canSelectFiles:!0,canSelectFolders:!1,openLabel:"Select Runtime JSON Docs",title:"Select Runtime JSON Docs",filters:{"JSON Docs":["json"]}});if(!f)return;a.docsPath=Ec.relative(sn(a.factorioPath,q.workspace.workspaceFolders),f[0].fsPath);try{l=await this.tryJsonDocs(a)}catch(m){q.window.showErrorMessage(`Unable to read JSON docs: ${m}`);return}}await this.context.workspaceState.update("active_version",a),u&&(t.push(a),e.update("versions",t)),this.bar.text=`Factorio ${l.application_version} (${a.name})`;let p=this._active_version;this._active_version=new ei(q.workspace.fs,a,l,q.workspace.workspaceFolders),this.output.info(`Active Factorio version: ${a.name} (${l.application_version})`),await this.generateDocs(p)}_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||e.onlineDocs==="throw"?"latest":e.onlineDocs}/runtime-api.json`,s=await fetch(i);if(!s.ok)throw new Error(`Error fetching ${i} : ${s.statusText}`);t=await s.text()}else{if(!e.factorioPath)throw new Error(`Invalid Config: requires at least one of factorioPath or onlineDocs in ${e.name}`);let n=_e.joinPath(Re.file(sn(e.factorioPath,q.workspace.workspaceFolders)),e.docsPath?e.docsPath:Ds.platform()==="darwin"?"../../doc-html/runtime-api.json":"../../../doc-html/runtime-api.json");t=(await Oe.readFile(n)).toString()}return new Sc(t)}async wantsRegenFromConfigFileVersion(e,t){try{let n=(await Oe.readFile(e)).toString(),i=JSON.parse(n);return i.factorioVersion!==t.docs.application_version||i.bundleVersion!==$i}catch{return!0}}async checkDocs(){let e=await this.getActiveVersion();if(!e)return;let t=this.context.storageUri;if(!t)return;let n=!1;if(Ss.some(o=>q.extensions.getExtension(o))&&(n||=await this.wantsRegenFromConfigFileVersion(_e.joinPath(t,"emmylua/factorio/config.json"),e)),q.extensions.getExtension("sumneko.lua")&&(n||=await this.wantsRegenFromConfigFileVersion(_e.joinPath(t,"sumneko-3rd/factorio/config.json"),e)),n)return this.generateDocs()}async generateDocs(e){if(!q.workspace.getConfiguration("factorio").get("docs.generateDocs",!0))return;let t=await this.getActiveVersion();if(!t)return;let n=this.context.storageUri;if(!n){q.window.showErrorMessage("Unable to generate docs: no open workspace");return}let i=Ss.map(o=>q.extensions.getExtension(o)).find(o=>!!o);if(i){this.output.appendLine(`Generating EmmyLua bundle for ${i.id}`);let o=q.workspace.getConfiguration("factorio"),a=_e.joinPath(n,"emmylua");await this.refreshDocFiles(a,t);let u=await q.workspace.findFiles(".luarc.json"),l="{}";u.length>0&&(l=(await Oe.readFile(u[0])).toString()),l=Dn(l,Sn(l,["$schema"],"https://raw.githubusercontent.com/EmmyLuaLs/emmylua-analyzer-rust/refs/heads/main/crates/emmylua_code_analysis/resources/schema.json",{})),l=Dn(l,Sn(l,["runtime","version"],"Lua5.2",{})),l=Dn(l,Sn(l,["runtime","requirePattern"],["?","?.lua"],{}));let p=[_e.joinPath(a,"factorio","library").fsPath];o.get("workspace.manageLibraryDataLinks")!==!1&&(p.push(await t.dataPath()),p.push(await t.lualibPath())),l=Dn(l,Sn(l,["workspace","library"],p,{})),l=Dn(l,Sn(l,["diagnostics","disable"],["unnecessary-if"],{})),u.length>0?await Oe.writeFile(u[0],Buffer.from(l)):await Oe.writeFile(_e.joinPath(q.workspace.workspaceFolders[0].uri,".luarc.json"),Buffer.from(l))}let s=q.extensions.getExtension("sumneko.lua");if(s){this.output.appendLine(`Generating LuaLS bundle for ${s.id}`);let o=_e.joinPath(n,"sumneko-3rd");await this.refreshDocFiles(o,t);let a=q.workspace.getConfiguration("Lua"),u=a.get("workspace.library",[]),l=(g,...v)=>{if(g){let _=_e.joinPath(g,...v),T=u.indexOf(_.fsPath);T!==-1&&u.splice(T,1)}},p=async(g,...v)=>{try{let _=_e.joinPath(g,...v);!u.includes(_.fsPath)&&(await Oe.stat(_)).type&q.FileType.Directory&&u.push(_.fsPath)}catch{}},h=q.workspace.getConfiguration("factorio");if(e&&!e.onlineOnly){let g=Re.file(await e.dataPath());l(g)}if(u.length===0?await a.update("workspace.library",void 0):await a.update("workspace.library",u),h.get("workspace.manageLibraryDataLinks")===!0){let g=Re.file(await t.dataPath());await p(g)}u.length===0?await a.update("workspace.library",void 0):await a.update("workspace.library",u);let f=a.get("workspace.userThirdParty",[]);f=f.filter(g=>!g.includes("justarandomgeek.factoriomod-debug")),await a.update("workspace.userThirdParty",f),f.push(o.fsPath),await a.update("workspace.userThirdParty",f);let m=a.get("workspace.checkThirdParty");m&&["Ask","Apply","ApplyInMemory"].includes(m)||await a.update("workspace.checkThirdParty","ApplyInMemory"),s.isActive||await s.activate()}}async refreshDocFiles(e,t){await Oe.createDirectory(e);try{await Promise.allSettled([Oe.delete(_e.joinPath(e,"factorio","library"),{recursive:!0}),Oe.delete(_e.joinPath(e,"factorio","factorio-plugin"),{recursive:!0})])}catch{}let n=this.output,i=await tt({close(){},write(s){n.info(`docgen: ${s.trimEnd()}`)}},this.context.asAbsolutePath("./dist/fmtk-cli.js"),await t.docArgs(q.workspace.getConfiguration("factorio").get("docs.usePrototypeDumps",!1)),e.fsPath);if(i!==0){this.output.warn(`docgen return code ${i}`),await q.window.showErrorMessage("Error while generating docs","Show Output")==="Show Output"&&this.output.show();return}}};import*as zt from"path";import*as te from"vscode";var Ji=class{type;ctime;mtime;size;name;data;constructor(e){this.type=te.FileType.File,this.ctime=Date.now(),this.mtime=Date.now(),this.size=0,this.name=e}},on=class{type;ctime;mtime;size;name;entries;constructor(e){this.type=te.FileType.Directory,this.ctime=Date.now(),this.mtime=Date.now(),this.size=0,this.name=e,this.entries=new Map}},Yi=class{root=new on("");stat(e){return this._lookup(e,!1)}readDirectory(e){let t=this._lookupAsDirectory(e,!1),n=[];for(let[i,s]of t.entries)n.push([i,s.type]);return n}readFile(e){let t=this._lookupAsFile(e,!1).data;if(t)return t;throw te.FileSystemError.FileNotFound()}writeFile(e,t,n){let i=zt.posix.basename(e.path),s=this._lookupParentDirectory(e),o=s.entries.get(i);if(o instanceof on)throw te.FileSystemError.FileIsADirectory(e);if(!o&&!n.create)throw te.FileSystemError.FileNotFound(e);if(o&&n.create&&!n.overwrite)throw te.FileSystemError.FileExists(e);o||(o=new Ji(i),s.entries.set(i,o),this._fireSoon({type:te.FileChangeType.Created,uri:e})),o.mtime=Date.now(),o.size=t.byteLength,o.data=t,this._fireSoon({type:te.FileChangeType.Changed,uri:e})}rename(e,t,n){if(!n.overwrite&&this._lookup(t,!0))throw te.FileSystemError.FileExists(t);let i=this._lookup(e,!1),s=this._lookupParentDirectory(e),o=this._lookupParentDirectory(t),a=zt.posix.basename(t.path);s.entries.delete(i.name),i.name=a,o.entries.set(a,i),this._fireSoon({type:te.FileChangeType.Deleted,uri:e},{type:te.FileChangeType.Created,uri:t})}delete(e,t){let n=e.with({path:zt.posix.dirname(e.path)}),i=zt.posix.basename(e.path),s=this._lookupAsDirectory(n,t?.silent??!1);if(!s||!s.entries.has(i)){if(t?.silent)return;throw te.FileSystemError.FileNotFound(e)}s.entries.delete(i),s.mtime=Date.now(),s.size-=1,this._fireSoon({type:te.FileChangeType.Changed,uri:n},{uri:e,type:te.FileChangeType.Deleted})}createDirectory(e){let t=zt.posix.basename(e.path),n=e.with({path:zt.posix.dirname(e.path)}),i=this._lookupAsDirectory(n,!1),s=new on(t);i.entries.set(s.name,s),i.mtime=Date.now(),i.size+=1,this._fireSoon({type:te.FileChangeType.Changed,uri:n},{type:te.FileChangeType.Created,uri:e})}_lookup(e,t){let n=e.path.split("/"),i=this.root;for(let s of n){if(!s)continue;let o;if(i instanceof on&&(o=i.entries.get(s)),!o){if(t)return;throw te.FileSystemError.FileNotFound(e)}i=o}return i}_lookupAsDirectory(e,t){let n=this._lookup(e,t);if(n instanceof on)return n;throw te.FileSystemError.FileNotADirectory(e)}_lookupAsFile(e,t){let n=this._lookup(e,t);if(n instanceof Ji)return n;throw te.FileSystemError.FileIsADirectory(e)}_lookupParentDirectory(e){let t=e.with({path:zt.posix.dirname(e.path)});return this._lookupAsDirectory(t,!1)}_emitter=new te.EventEmitter;_bufferedEvents=[];_fireSoonHandle;onDidChangeFile=this._emitter.event;watch(e){return new te.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)}};var Pi=Yn(Ll(),1);import*as Ul from"path";import{workspace as Nl}from"vscode";function Kl(r){let e=r.asAbsolutePath(Ul.join("dist","fmtk-cli.js")),t={execArgv:["--nolazy","--inspect-brk=34199"]},n={run:{module:e,transport:Pi.TransportKind.ipc,args:["lsp"]},debug:{module:e,transport:Pi.TransportKind.ipc,args:["lsp"],options:t}},i={documentSelector:[{language:"factorio-locale"},{language:"factorio-changelog"},{language:"lua"}],synchronize:{fileEvents:[Nl.createFileSystemWatcher("**/locale/*/*.cfg"),Nl.createFileSystemWatcher("**/changelog.txt")]}},s=new Pi.LanguageClient("factorioLanguageServer","Factorio Language Server",n,i);s.start(),r.subscriptions.push({dispose(){return s.stop()}})}import*as Se from"vscode";function Hl(r){return r.type==="int"?{type:"int",value:dv("",r.value)}:r}function pc(r,e){return typeof e=="bigint"?`jsonbigint ${e}n`:e}function dv(r,e){if(typeof e=="string"){let t=e.match(/^jsonbigint\x01\x02 (\d+)n$/);if(t)return BigInt(t[1])}return e}function Ur(){let r="",e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let t=0;t<32;t++)r+=e.charAt(Math.floor(Math.random()*e.length));return r}var Wl=Yn(Dc()),$l=(0,Wl.decompressFromBase64)("DwQgIg8gwgKgmgBQKIAIAWAXAtgGwHwCwAUMJrijgIYB2A5gLwBEAptY4SWs5QCYcCQwLMwyUUAYzSUATgGcRTAKowAYgFoAHO2KCQatTsXyUY8QHtqGVhhTzxAV2kBLDAE8UABzM4n49xjMUCxx3ShwcMwB3CjNeJzoUJyxKWmZZFAAzaTMsdAwMD3SzaUzs3LNHFGYADytqWScLFB4naWZxAOlXABodGh4g6hCTcKjbcWcPDHSMKRspADdmE1sPdqcM3xRqC3FmADodfQEhETFMArVmAEd7JwWmKAs6jDUAZXbHF1c1BG9fVyMCTPaxMHjMDKUew4V6yaTiFAAch21GYiIA3IksLQ1HCEQAScSyDxvCrw5j4zGyNw4Zi4+EoQnE0mOPaUzLPekEokkslsqkTJxTLlIlF7NT4sUUjHaIiCYSibaUYRMBZOZiRLzSDBA8yWUGMSJOHizejgtXio0mtDdRLUFxOMK48RhZj0ACM+wADLLBD5qABrdBtDJMfEAWTMPA++XitFkAHVmAAjNUa/ZE2T4oFtHBMamuWmyLgiIEAehOGBctLwkYGMardFkwDLVYwNeILa4vA4wGTUdcJzsVYsAkEaHdeAAasw5I1qF3JzpBC0FokeKrZw0LOwW6uTmXh/OODpgAtZOZwWoPDRmDh0jJHWoqMm70wG3HZL7BOfL3Sb6iOBqKIybrkwIFqO67BvKI2r2B4La/lG/63kBIFjmeF7IdeqHAZQoHGuB+FqAATOwABK9iWEkywAOIRMmYSIVhV4AXeeHJhhSGsbhIFgYwEEAMwUVRVbCCgCCzigRizsxf44YBHFcSxKGKWm0SEYw6mQd+gggR2cr8EZwAYP2PDuJp1IyBg8G7q2ZmDsugitvhBnGWW3Gqex6nKfJbFAep/HaWRY56a5zChXpDn8dIok0WotAMWEdmmQOoUtvpEXLnJ2H+WoPnZZ5CneeqGkblppVqMJ6WZZFJnRZpsXUcI16zmo9jyNIKUOelLnJm5zlFXlBVyjlPGAbIJ6jVYWAeFQVj8fIsZ0LiGDOHQ34mdINUDOIVCyLI+YiI2OLUMqzApXwTkmVdhnGUVVi1Gomx3rt+2HYwS0nflYT2BdeBjXSj2vC9OC3UZzkYODxlQxI71HctOJ6mt3hfnVRXJvY+RNHtlAHQj33grSVhApQHhrDINB7Ewvg7iYziUM++FvowYB3iI/1OcZxI0HDeMfZetPUMCLR6sB0h42gdk89QdUeSpaiY9jsvXa20MZdtp6tsws3zVlRCnjNc2UAtlnHXGajUPYWCvl1GFrTtfP4595srWdwiXTt6MK8Dz3qmDTsfV9FsLL9F0oG4axMFbNuznZD01CD/vQ5DKc3YHBMW8j2T3rpP4K0rATC7jzvBytRMc6T5PcBL1DU4wQukwzTOvnmrPsyTkWCDLGeMILeoi0L4uS9LAFyxjWNF71UMYa2mujdrusm/rhs68bpvlWXOL9t4m0O9dsMl0HrunednsHyn+fyZI7QBv21S91vP04H98cKzf4h32Y1TT2nh/wy7RGahs6ozzpheShccYAKfhXEmJhq6Uzrm6Bueom5PhfCzNmxNOZ3W5gBXu/ccZRiHmtEeANDxjy5oDRWk9RyqxntlOeB4jZ6ymnpNeetFon2Ad4Yoe954Q3TkfTObsz7kIYXdG6dUMH4CeBEaQAAuFsMi6rxA8FjCOrgo5914V1R+3DQ4v2WE/cw8jn6vwrFQlRABBHAHgpBKLLCoqhCcnqgzevzEROJDF/VsNwxmPjw6R2QTHW2b95K+3cb/R2wjAHfRAbnb2EDaHF2gdw2B4cyYU1rvXRu9N0HMzblgyuXdgA91iYQ4uxCxakOLKPGg48C4pOiYw/eC8WHLzYSZDhy8uFAN4DwfhXsXE+0Tn7V6+j+k8B4JbMR1DInJxaZIiREMr7YR4NkDwPAoipM8XEi2AzgJaJwastZV4zBTGPNSdatBqEXJHCrXBZy6T3OPDvHAdzLl0KeeA7CrzRyhNkvLeS/zHmnN+ecr5ws0DGnBLLeIGBPkPNKUVUFeBTHFCRceKhwL1mbO2ZEMF7kVkww8aXbhCS0YjOScrSZ30BnJgwGweB2SqbILyY+RmMimDWOmXnbu+CKnVKIaLCwagBn1KJe5CeyslnEoERlHpVgukXkmDYYJTAsBRmhOHKUYYpTZlsPCMMdYPxNiTKmUq+wABWWYgTggyLOCsLZVVCgwL2MsPVOxljIPgIAA===");var Kr=class{constructor(e){this.context=e;this.context.subscriptions.push(Se.window.registerCustomEditorProvider("fmtk.modsettings",this,{supportsMultipleEditorsPerDocument:!1,webviewOptions:{retainContextWhenHidden:!0}}))}context;webviews=new Map;_onDidChangeCustomDocument=new Se.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 gc.create(e,t.backupId),s=[];return s.push(i.onDidChange(o=>{this._onDidChangeCustomDocument.fire({document:i,...o})})),s.push(i.onDidChangeContent(o=>{let a=this.webviews.get(i.uri.toString());a&&this.postMessage(a,"init",{version:i.version,saves_ints:i.saves_ints,settings:JSON.stringify(i.settings,pc),editable:Se.workspace.fs.isWritableFileSystem(i.uri.scheme)!==!1})})),i.onDidDispose(()=>s.forEach(o=>o.dispose())),i}resolveCustomEditor(e,t,n){let i=t.webview;this.webviews.set(e.uri.toString(),t),i.options={enableScripts:!0},i.html=$l.replace(/\$cspSource\$/g,i.cspSource).replace(/\$nonce\$/g,Ur()).replace(/\$ModSettingsWebview\.css\$/g,i.asWebviewUri(Se.Uri.joinPath(this.context.extensionUri,"/dist/ModSettingsWebview.css")).toString()).replace(/\$ModSettingsWebview\.js\$/g,i.asWebviewUri(Se.Uri.joinPath(this.context.extensionUri,"/dist/ModSettingsWebview.js")).toString()),t.webview.onDidReceiveMessage(s=>this.onMessage(e,s)),t.webview.onDidReceiveMessage(s=>{s.type==="ready"&&this.postMessage(t,"init",{version:e.version,saves_ints:e.saves_ints,settings:JSON.stringify(e.settings,pc),editable:Se.workspace.fs.isWritableFileSystem(e.uri.scheme)!==!1})})}postMessage(e,t,n){e.webview.postMessage({type:t,body:n})}onMessage(e,t){if(t.type==="edit"){e.edit(t.body);return}}},gc=class r{constructor(e,t){this.uri=e;this._settings=new fs(new Qn(t))}uri;static async create(e,t){let n=typeof t=="string"?Se.Uri.parse(t):e,i=await Se.workspace.fs.readFile(n);return new r(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 Se.workspace.fs.writeFile(e,this._settings.save())}async revert(e){this._settings=new fs(new Qn(await Se.workspace.fs.readFile(this.uri))),this._onDidChangeDocument.fire({})}async backup(e,t){return await this.saveAs(e,t),{id:e.toString(),delete:()=>{Se.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,Hl(e.value)),this._onDidChange.fire({})}_onDidDispose=new Se.EventEmitter;onDidDispose=this._onDidDispose.event;_onDidChangeDocument=new Se.EventEmitter;onDidChangeContent=this._onDidChangeDocument.event;_onDidChange=new Se.EventEmitter;onDidChange=this._onDidChange.event;disposables=[this._onDidDispose,this._onDidChangeDocument,this._onDidChange];dispose(){this._onDidDispose.fire(),this.disposables.forEach(e=>e.dispose())}};import*as vn from"vscode";function Ti(r){switch(r.type){case"Table":case"TableWithMeta":return Object.assign({},r,{values:void 0,values_count:r.values.length});default:return r}}var Bl=Yn(Dc()),zl=(0,Bl.decompressFromBase64)("DwQgIg8gwgKgmgBQKIAIAWAXAtgGwHwCwAUMJrijgIYB2A5gLwBEAptY4SWs5QCYcCQwLMwyUUAYzSUATgGcRTAKowAYgFoAHO2KCQatTsXyUY8QHtqGVhhTzxAV2kBLDAE8UABzM4n49xjMUCxx3ShwcMwB3CjNeJzoUJyxKWmZZFAAzaTMsdAwMD3SzaUzs3LNHFGYADytqWScLFB4naWZxAOlXABodGh4g6hCTcKjbcWcPDHSMKRspADdmE1sPdqcM3xRqC3FmADodfQEhETFMArVmAEd7JwWmKAs6jDUAZXbHF1c1BG9fVyMCTPaxMHjMDKUew4V6yaTiFAAch21GYiIA3IksLQ1HCEQAScSyDxvCrw5j4zGyNw4Zi4+EoQnE0mOPaUzLPekEokkslsqkTJxTLlIlF7NT4sUUjHaIiCYSibaUYRMBZOZiRLzSDBA8yWUGMSJOHizejgtXio0mtDdRLUFxOMK48RhZj0ACM+wADLLBD5qABrdBtDJMfFvQVTMCUDAAdWYACM1Rr9kTZPigW0cExqa5abIuCIgQB6E4YFy0vARyYYfbRjDAYvljCV4iNri8DjABNmHiuE52csWASCNDuvAANWYcka1Hb450ghaC0SPFV04aFnYjeXJ2Lg9nHB0wAPw8XpHH9co85HwGXq6Y2TMOtvxd3x/37SH1CPcpPkZsNw1iYLBe2hZggSlMMpQzWx4TDashQwet4yTdVIn2AArdMgXBDJp1LRtZAArtix7PtSLIfAgA===");import*as nn from"vscode";var Hr=class r{constructor(e,t){this.uri=e;this._data=new Tc(new Qn(t))}uri;static async create(e,t){let n=typeof t=="string"?nn.Uri.parse(t):e,i=await nn.workspace.fs.readFile(n);return new r(e,i)}_data;get version(){return this._data.version.format()}get rootdata(){let e={};for(let t in this._data.data)e[t]=Ti(this._data.data[t]);return e}find(e,t){return this._data.find(e,t)}_onDidDispose=new nn.EventEmitter;onDidDispose=this._onDidDispose.event;_onDidChangeDocument=new nn.EventEmitter;onDidChangeContent=this._onDidChangeDocument.event;_onDidChange=new nn.EventEmitter;onDidChange=this._onDidChange.event;disposables=[this._onDidDispose,this._onDidChangeDocument,this._onDidChange];dispose(){this._onDidDispose.fire(),this.disposables.forEach(e=>e.dispose())}};var Wr=class{constructor(e){this.context=e;this.context.subscriptions.push(vn.window.registerCustomEditorProvider("fmtk.scriptdat",this,{supportsMultipleEditorsPerDocument:!1,webviewOptions:{retainContextWhenHidden:!0}}))}context;webviews=new Map;_onDidChangeCustomDocument=new vn.EventEmitter;onDidChangeCustomDocument=this._onDidChangeCustomDocument.event;async openCustomDocument(e,t,n){let i=await Hr.create(e,t.backupId),s=[];return s.push(i.onDidChange(o=>{this._onDidChangeCustomDocument.fire({document:i,...o})})),s.push(i.onDidChangeContent(o=>{let a=this.webviews.get(i.uri.toString());a&&this.postMessage(a,"init",{version:i.version,data:i.rootdata})})),i.onDidDispose(()=>s.forEach(o=>o.dispose())),i}resolveCustomEditor(e,t,n){let i=t.webview;this.webviews.set(e.uri.toString(),t),i.options={enableScripts:!0},i.html=zl.replace(/\$cspSource\$/g,i.cspSource).replace(/\$nonce\$/g,Ur()).replace(/\$ScriptDatWebview\.css\$/g,i.asWebviewUri(vn.Uri.joinPath(this.context.extensionUri,"/dist/ScriptDatWebview.css")).toString()).replace(/\$ScriptDatWebview\.js\$/g,i.asWebviewUri(vn.Uri.joinPath(this.context.extensionUri,"/dist/ScriptDatWebview.js")).toString()),t.webview.onDidReceiveMessage(s=>this.onMessage(e,s)),t.webview.onDidReceiveMessage(s=>{s.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){if(t.type==="fetch"){let n=t.body,i=e.find(n.modname,n.gcid),s;n.index!==void 0&&n.count!==void 0?s=i.values.slice(n.index,n.index+n.count):s=i.values,this.postMessage(this.webviews.get(e.uri.toString()),"values",{...n,values:s.map(o=>({key:Ti(o.key),value:Ti(o.value)}))})}}};async function C_(r){let e=H.window.createOutputChannel("FMTK",{log:!0});e.info(`FMTK ${$i}`);try{e.info("Registering FS Provider...");let t=new Yi;r.subscriptions.push(H.workspace.registerFileSystemProvider("fmtk",t,{isCaseSensitive:!0})),e.info("Registering Version Selector...");let n=new Gi(r,e,t);e.info("Registering Native Debug Provider...");let i=new mc(n);r.subscriptions.push(H.debug.registerDebugConfigurationProvider("factorio",i)),r.subscriptions.push(H.debug.registerDebugAdapterDescriptorFactory("factorio",i)),r.subscriptions.push(i),e.info("Registering Language Client..."),Kl(r),e.info("Registering Mod Package Provider..."),await Rc(r),e.info("Registering Custom Editors..."),new Kr(r),new Wr(r),e.info("Activate Complete")}catch(t){e.error(`Error while activating: ${t}`)}}var mc=class{constructor(e){this.versionSelector=e;this.disposables.push(H.debug.onDidReceiveDebugSessionCustomEvent(async t=>{if(t.session.type==="factorio")switch(t.event){case"profileRunning":await H.commands.executeCommand("setContext","factorio.debugProfileStarting",!1),await H.commands.executeCommand("setContext","factorio.debugProfileStopping",!1),await H.commands.executeCommand("setContext","factorio.debugProfileIsRunning",!0);break;case"profileComplete":await H.commands.executeCommand("setContext","factorio.debugProfileStarting",!1),await H.commands.executeCommand("setContext","factorio.debugProfileStopping",!1),await H.commands.executeCommand("setContext","factorio.debugProfileIsRunning",!1),await H.commands.executeCommand("vscode.open",H.Uri.file(t.body.path));break;default:break}})),this.disposables.push(H.commands.registerCommand("factorio.startProfile",async()=>{let t=H.debug.activeDebugSession;t&&(await H.commands.executeCommand("setContext","factorio.debugProfileStarting",!0),await H.commands.executeCommand("setContext","factorio.debugProfileStopping",!1),await H.commands.executeCommand("setContext","factorio.debugProfileIsRunning",!1),await t.customRequest("startProfile",{}))})),this.disposables.push(H.commands.registerCommand("factorio.stopProfile",async()=>{let t=H.debug.activeDebugSession;t&&(await H.commands.executeCommand("setContext","factorio.debugProfileStarting",!1),await H.commands.executeCommand("setContext","factorio.debugProfileStopping",!0),await H.commands.executeCommand("setContext","factorio.debugProfileIsRunning",!0),await t.customRequest("stopProfile",{}))}))}versionSelector;async resolveDebugConfigurationWithSubstitutedVariables(e,t,n){let i=await this.versionSelector.getActiveVersion();if(!i)return;if(!t.factorioArgs||!t.factorioArgs.includes("--mod-directory")){let o=await H.workspace.findFiles("**/mod-list.json");if(o.length===1){let a=$r.posix.normalize($r.resolve(H.Uri.joinPath(o[0],"..").fsPath)),u=await i.defaultModsPath();a!==u&&(t.factorioArgs=[...t.factorioArgs,"--mod-directory",a])}else if(o.length>1)throw new Error("Cannot automatically select mod directory, multiple mod-list.json in workspace")}let s=H.workspace.getConfiguration("factorio.debug").get("env",{});return t.env={...s,...t.env,SteamAppId:"427520"},t}async createDebugAdapterDescriptor(e,t){let n=await this.versionSelector.getActiveVersion();if(!n)return;if(n.onlineOnly)throw new Error("Cannot debug online docs. Select a local Factorio install to debug.");await H.commands.executeCommand("setContext","factorio.debugProfileStarting",!1),await H.commands.executeCommand("setContext","factorio.debugProfileStopping",!1),await H.commands.executeCommand("setContext","factorio.debugProfileIsRunning",!1);let s=H.workspace.getConfiguration("factorio.debug").get("shim");return s?new H.DebugAdapterExecutable(s,[n.factorioPath,"--dap"],{env:e.configuration.env}):new H.DebugAdapterExecutable(n.factorioPath,["--dap"],{env:e.configuration.env})}disposables=[];dispose(){this.disposables.forEach(e=>e.dispose())}};export{C_ as activate};
|
|
38
38
|
//# sourceMappingURL=fmtk-vscode.js.map
|