From e159d0b26277c579552fd7e171c2bf1712f0f00e Mon Sep 17 00:00:00 2001 From: Heyward Fann Date: Tue, 23 Apr 2024 09:11:14 +0800 Subject: [PATCH] commit 2ec3166653f76acd42b0d9f62161c4db2673c204 2ec31666 fix(extension): quote cmd on windows (#4988) --- build/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/index.js b/build/index.js index b1bf26e7429..f3c03f10075 100644 --- a/build/index.js +++ b/build/index.js @@ -232,7 +232,7 @@ ${e.join(` `;let d=Pbe.default(o);o.write(`${l}\r `);let{statusCode:g,buffered:f}=yield d;if(g===200){if(e.once("socket",_be),t.secureEndpoint){Hf("Upgrading socket connection to TLS");let b=t.servername||t.host;return oz.default.connect(Object.assign(Object.assign({},Lbe(t,"host","hostname","path","port")),{socket:o,servername:b}))}return o}o.destroy();let m=new rz.default.Socket({writable:!1});return m.readable=!0,e.once("socket",b=>{Hf("replaying proxy buffer for failed request"),Dbe.default(b.listenerCount("data")>0),b.push(f),b.push(null)}),m})}};Du.default=L1;function _be(n){n.resume()}function Rbe(n,e){return!!(!e&&n===80||e&&n===443)}function Ebe(n){return typeof n=="string"?/^https:?$/i.test(n):!1}function Lbe(n,...e){let t={},i;for(i in n)e.includes(i)||(t[i]=n[i]);return t}});var lz=v((M1,az)=>{"use strict";var Ibe=M1&&M1.__importDefault||function(n){return n&&n.__esModule?n:{default:n}},I1=Ibe(sz());function F1(n){return new I1.default(n)}(function(n){n.HttpsProxyAgent=I1.default,n.prototype=I1.default.prototype})(F1||(F1={}));az.exports=F1});function O1(n){return n.protocol==="https:"?BC.https:BC.http}function Fbe(n){return typeof n=="string"||Buffer.isBuffer(n)?n:JSON.stringify(n)}function A1(n){if(n instanceof HC.URL)return n;let e=new HC.URL(n);if(!["https:","http:"].includes(e.protocol))throw new Error(`Not valid protocol with ${n}, should be http: or https:`);return e}function N1(n,e){return n&&(n=typeof n=="number"?n:parseInt(n,10),!isNaN(n))?n:e.startsWith("https")?443:80}function Mbe(n){return n===null?"null":n===void 0?"undefined":typeof n=="string"?"string":Buffer.isBuffer(n)?"buffer":Array.isArray(n)||Et(n)?"object":"unknown"}function jbe(n,e=process.env){let t=e.NO_PROXY??e.no_proxy;if(t==="*")return null;if(t){let r=n.hostname.replace(/^\.*/,".").toLowerCase(),o=N1(n.port,n.protocol).toString(),s=t.split(",");for(let a=0,l=s.length;a{if(i){let u=i.onCancellationRequested(()=>{u.dispose(),l.destroy(new Ot)})}let a,l=r.request(t,u=>{let c=u;if(u.statusCode>=200&&u.statusCode<300||u.statusCode===1223){let h=u.headers,d=[],g=de(h["content-type"]);c=(0,uz.default)(u),c.on("data",f=>{d.push(f)}),c.on("end",()=>{clearTimeout(a);let f=Buffer.concat(d);if(!t.buffer&&(g.startsWith("application/json")||g.startsWith("text/"))){let m=g.match(/charset=(\S+)/),b=m?m[1]:"utf8",w=f.toString(b);if(!g.includes("application/json"))o(w);else try{let x=JSON.parse(w);o(x)}catch(x){s(new Error(`Parse response error: ${x}`))}}else o(f)}),c.on("error",f=>{s(new Error(`Connection error to ${n}: ${f.message}`))})}else s(new Error(`Bad response from ${n}: ${u.statusCode}`))});l.on("error",u=>{t.agent&&u.code=="ECONNRESET"?a=setTimeout(()=>{s(u)},j1):s(u)}),l.on("timeout",()=>{l.destroy(new Error(`Request timeout after ${t.timeout}ms`))}),e&&l.write(Fbe(e)),t.timeout&&l.setTimeout(t.timeout),l.end()})}function Bf(n,e={},t){let i=A1(n),r=H1(i,e);return Abe(i,e.data,r,t).catch(o=>{if(gz.error(`Fetch error for ${i}:`,r,o),r.agent&&r.agent.proxy){let{proxy:s}=r.agent;throw new Error(`Request failed using proxy ${s.host}: ${o.message}`)}else throw o})}var uz,BC,cz,hz,dz,HC,gz,j1,WC=k(()=>{"use strict";uz=co(L9()),BC=co(G9()),cz=co(iz()),hz=co(lz()),dz=require("querystring"),HC=require("url");Ee();qi();ze();fe();be();Ce();se();gz=te("model-fetch"),j1=ve(500,50)});var mz=v((B1,fz)=>{var qC=require("buffer"),ts=qC.Buffer;function pz(n,e){for(var t in n)e[t]=n[t]}ts.from&&ts.alloc&&ts.allocUnsafe&&ts.allocUnsafeSlow?fz.exports=qC:(pz(qC,B1),B1.Buffer=Tu);function Tu(n,e,t){return ts(n,e,t)}Tu.prototype=Object.create(ts.prototype);pz(ts,Tu);Tu.from=function(n,e,t){if(typeof n=="number")throw new TypeError("Argument must not be a number");return ts(n,e,t)};Tu.alloc=function(n,e,t){if(typeof n!="number")throw new TypeError("Argument must be a number");var i=ts(n);return e!==void 0?typeof t=="string"?i.fill(e,t):i.fill(e):i.fill(0),i};Tu.allocUnsafe=function(n){if(typeof n!="number")throw new TypeError("Argument must be a number");return ts(n)};Tu.allocUnsafeSlow=function(n){if(typeof n!="number")throw new TypeError("Argument must be a number");return qC.SlowBuffer(n)}});var Cz=v((JYe,W1)=>{"use strict";W1.exports=Xbe;W1.exports.parse=Qbe;var bz=require("path").basename,Nbe=mz().Buffer,Hbe=/[\x00-\x20"'()*,/:;<=>?@[\\\]{}\x7f]/g,Bbe=/%[0-9A-Fa-f]{2}/,Wbe=/%([0-9A-Fa-f]{2})/g,vz=/[^\x20-\x7e\xa0-\xff]/g,qbe=/\\([\u0000-\u007f])/g,Ybe=/([\\"])/g,yz=/;[\x09\x20]*([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*=[\x09\x20]*("(?:[\x20!\x23-\x5b\x5d-\x7e\x80-\xff]|\\[\x20-\x7e])*"|[!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*/g,Ube=/^[\x20-\x7e\x80-\xff]+$/,Zbe=/^[!#$%&'*+.0-9A-Z^_`a-z|~-]+$/,Jbe=/^([A-Za-z0-9!#$%&+\-^_`{}~]+)'(?:[A-Za-z]{2,3}(?:-[A-Za-z]{3}){0,3}|[A-Za-z]{4,8}|)'((?:%[0-9A-Fa-f]{2}|[A-Za-z0-9!#$&+.^_`|~-])+)$/,$be=/^([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*(?:$|;)/;function Xbe(n,e){var t=e||{},i=t.type||"attachment",r=Gbe(n,t.fallback);return zbe(new xz(i,r))}function Gbe(n,e){if(n!==void 0){var t={};if(typeof n!="string")throw new TypeError("filename must be a string");if(e===void 0&&(e=!0),typeof e!="string"&&typeof e!="boolean")throw new TypeError("fallback must be a string or boolean");if(typeof e=="string"&&vz.test(e))throw new TypeError("fallback must be ISO-8859-1 string");var i=bz(n),r=Ube.test(i),o=typeof e!="string"?e&&wz(i):bz(e),s=typeof o=="string"&&o!==i;return(s||!r||Bbe.test(i))&&(t["filename*"]=i),(r||s)&&(t.filename=s?o:i),t}}function zbe(n){var e=n.parameters,t=n.type;if(!t||typeof t!="string"||!Zbe.test(t))throw new TypeError("invalid type");var i=String(t).toLowerCase();if(e&&typeof e=="object")for(var r,o=Object.keys(e).sort(),s=0;s{"use strict";var Sz=new Map([["C","cwd"],["f","file"],["z","gzip"],["P","preservePaths"],["U","unlink"],["strip-components","strip"],["stripComponents","strip"],["keep-newer","newer"],["keepNewer","newer"],["keep-newer-files","newer"],["keepNewerFiles","newer"],["k","keep"],["keep-existing","keep"],["keepExisting","keep"],["m","noMtime"],["no-mtime","noMtime"],["p","preserveOwner"],["L","follow"],["h","follow"]]);Dz.exports=n=>n?Object.keys(n).map(e=>[Sz.has(e)?Sz.get(e):e,n[e]]).reduce((e,t)=>(e[t[0]]=t[1],e),Object.create(null)):{}});var GC=v(Mz=>{"use strict";var Tz=typeof process=="object"&&process?process:{stdout:null,stderr:null},nye=require("events"),kz=require("stream"),rye=require("string_decoder"),Pz=rye.StringDecoder,qs=Symbol("EOF"),Ys=Symbol("maybeEmitEnd"),Va=Symbol("emittedEnd"),YC=Symbol("emittingEnd"),Wf=Symbol("emittedError"),UC=Symbol("closed"),_z=Symbol("read"),ZC=Symbol("flush"),Rz=Symbol("flushChunk"),lr=Symbol("encoding"),Us=Symbol("decoder"),JC=Symbol("flowing"),qf=Symbol("paused"),Yh=Symbol("resume"),Ri=Symbol("buffer"),is=Symbol("pipes"),rn=Symbol("bufferLength"),q1=Symbol("bufferPush"),Y1=Symbol("bufferShift"),yn=Symbol("objectMode"),Ei=Symbol("destroyed"),U1=Symbol("error"),Z1=Symbol("emitData"),Ez=Symbol("emitEnd"),J1=Symbol("emitEnd2"),Zs=Symbol("async"),$1=Symbol("abort"),$C=Symbol("aborted"),ku=Symbol("signal"),Yf=n=>Promise.resolve().then(n),Fz=global._MP_NO_ITERATOR_SYMBOLS_!=="1",Lz=Fz&&Symbol.asyncIterator||Symbol("asyncIterator not implemented"),Iz=Fz&&Symbol.iterator||Symbol("iterator not implemented"),oye=n=>n==="end"||n==="finish"||n==="prefinish",sye=n=>n instanceof ArrayBuffer||typeof n=="object"&&n.constructor&&n.constructor.name==="ArrayBuffer"&&n.byteLength>=0,aye=n=>!Buffer.isBuffer(n)&&ArrayBuffer.isView(n),XC=class{constructor(e,t,i){this.src=e,this.dest=t,this.opts=i,this.ondrain=()=>e[Yh](),t.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},X1=class extends XC{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,t,i){super(e,t,i),this.proxyErrors=r=>t.emit("error",r),e.on("error",this.proxyErrors)}},G1=class n extends kz{constructor(e){super(),this[JC]=!1,this[qf]=!1,this[is]=[],this[Ri]=[],this[yn]=e&&e.objectMode||!1,this[yn]?this[lr]=null:this[lr]=e&&e.encoding||null,this[lr]==="buffer"&&(this[lr]=null),this[Zs]=e&&!!e.async||!1,this[Us]=this[lr]?new Pz(this[lr]):null,this[qs]=!1,this[Va]=!1,this[YC]=!1,this[UC]=!1,this[Wf]=null,this.writable=!0,this.readable=!0,this[rn]=0,this[Ei]=!1,e&&e.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[Ri]}),e&&e.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[is]}),this[ku]=e&&e.signal,this[$C]=!1,this[ku]&&(this[ku].addEventListener("abort",()=>this[$1]()),this[ku].aborted&&this[$1]())}get bufferLength(){return this[rn]}get encoding(){return this[lr]}set encoding(e){if(this[yn])throw new Error("cannot set encoding in objectMode");if(this[lr]&&e!==this[lr]&&(this[Us]&&this[Us].lastNeed||this[rn]))throw new Error("cannot change encoding");this[lr]!==e&&(this[Us]=e?new Pz(e):null,this[Ri].length&&(this[Ri]=this[Ri].map(t=>this[Us].write(t)))),this[lr]=e}setEncoding(e){this.encoding=e}get objectMode(){return this[yn]}set objectMode(e){this[yn]=this[yn]||!!e}get async(){return this[Zs]}set async(e){this[Zs]=this[Zs]||!!e}[$1](){this[$C]=!0,this.emit("abort",this[ku].reason),this.destroy(this[ku].reason)}get aborted(){return this[$C]}set aborted(e){}write(e,t,i){if(this[$C])return!1;if(this[qs])throw new Error("write after end");if(this[Ei])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof t=="function"&&(i=t,t="utf8"),t||(t="utf8");let r=this[Zs]?Yf:o=>o();return!this[yn]&&!Buffer.isBuffer(e)&&(aye(e)?e=Buffer.from(e.buffer,e.byteOffset,e.byteLength):sye(e)?e=Buffer.from(e):typeof e!="string"&&(this.objectMode=!0)),this[yn]?(this.flowing&&this[rn]!==0&&this[ZC](!0),this.flowing?this.emit("data",e):this[q1](e),this[rn]!==0&&this.emit("readable"),i&&r(i),this.flowing):e.length?(typeof e=="string"&&!(t===this[lr]&&!this[Us].lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[lr]&&(e=this[Us].write(e)),this.flowing&&this[rn]!==0&&this[ZC](!0),this.flowing?this.emit("data",e):this[q1](e),this[rn]!==0&&this.emit("readable"),i&&r(i),this.flowing):(this[rn]!==0&&this.emit("readable"),i&&r(i),this.flowing)}read(e){if(this[Ei])return null;if(this[rn]===0||e===0||e>this[rn])return this[Ys](),null;this[yn]&&(e=null),this[Ri].length>1&&!this[yn]&&(this.encoding?this[Ri]=[this[Ri].join("")]:this[Ri]=[Buffer.concat(this[Ri],this[rn])]);let t=this[_z](e||null,this[Ri][0]);return this[Ys](),t}[_z](e,t){return e===t.length||e===null?this[Y1]():(this[Ri][0]=t.slice(e),t=t.slice(0,e),this[rn]-=e),this.emit("data",t),!this[Ri].length&&!this[qs]&&this.emit("drain"),t}end(e,t,i){return typeof e=="function"&&(i=e,e=null),typeof t=="function"&&(i=t,t="utf8"),e&&this.write(e,t),i&&this.once("end",i),this[qs]=!0,this.writable=!1,(this.flowing||!this[qf])&&this[Ys](),this}[Yh](){this[Ei]||(this[qf]=!1,this[JC]=!0,this.emit("resume"),this[Ri].length?this[ZC]():this[qs]?this[Ys]():this.emit("drain"))}resume(){return this[Yh]()}pause(){this[JC]=!1,this[qf]=!0}get destroyed(){return this[Ei]}get flowing(){return this[JC]}get paused(){return this[qf]}[q1](e){this[yn]?this[rn]+=1:this[rn]+=e.length,this[Ri].push(e)}[Y1](){return this[yn]?this[rn]-=1:this[rn]-=this[Ri][0].length,this[Ri].shift()}[ZC](e){do;while(this[Rz](this[Y1]())&&this[Ri].length);!e&&!this[Ri].length&&!this[qs]&&this.emit("drain")}[Rz](e){return this.emit("data",e),this.flowing}pipe(e,t){if(this[Ei])return;let i=this[Va];return t=t||{},e===Tz.stdout||e===Tz.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,i?t.end&&e.end():(this[is].push(t.proxyErrors?new X1(this,e,t):new XC(this,e,t)),this[Zs]?Yf(()=>this[Yh]()):this[Yh]()),e}unpipe(e){let t=this[is].find(i=>i.dest===e);t&&(this[is].splice(this[is].indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){let i=super.on(e,t);return e==="data"&&!this[is].length&&!this.flowing?this[Yh]():e==="readable"&&this[rn]!==0?super.emit("readable"):oye(e)&&this[Va]?(super.emit(e),this.removeAllListeners(e)):e==="error"&&this[Wf]&&(this[Zs]?Yf(()=>t.call(this,this[Wf])):t.call(this,this[Wf])),i}get emittedEnd(){return this[Va]}[Ys](){!this[YC]&&!this[Va]&&!this[Ei]&&this[Ri].length===0&&this[qs]&&(this[YC]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[UC]&&this.emit("close"),this[YC]=!1)}emit(e,t,...i){if(e!=="error"&&e!=="close"&&e!==Ei&&this[Ei])return;if(e==="data")return!this[yn]&&!t?!1:this[Zs]?Yf(()=>this[Z1](t)):this[Z1](t);if(e==="end")return this[Ez]();if(e==="close"){if(this[UC]=!0,!this[Va]&&!this[Ei])return;let o=super.emit("close");return this.removeAllListeners("close"),o}else if(e==="error"){this[Wf]=t,super.emit(U1,t);let o=!this[ku]||this.listeners("error").length?super.emit("error",t):!1;return this[Ys](),o}else if(e==="resume"){let o=super.emit("resume");return this[Ys](),o}else if(e==="finish"||e==="prefinish"){let o=super.emit(e);return this.removeAllListeners(e),o}let r=super.emit(e,t,...i);return this[Ys](),r}[Z1](e){for(let i of this[is])i.dest.write(e)===!1&&this.pause();let t=super.emit("data",e);return this[Ys](),t}[Ez](){this[Va]||(this[Va]=!0,this.readable=!1,this[Zs]?Yf(()=>this[J1]()):this[J1]())}[J1](){if(this[Us]){let t=this[Us].end();if(t){for(let i of this[is])i.dest.write(t);super.emit("data",t)}}for(let t of this[is])t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}collect(){let e=[];this[yn]||(e.dataLength=0);let t=this.promise();return this.on("data",i=>{e.push(i),this[yn]||(e.dataLength+=i.length)}),t.then(()=>e)}concat(){return this[yn]?Promise.reject(new Error("cannot concat in objectMode")):this.collect().then(e=>this[yn]?Promise.reject(new Error("cannot concat in objectMode")):this[lr]?e.join(""):Buffer.concat(e,e.dataLength))}promise(){return new Promise((e,t)=>{this.on(Ei,()=>t(new Error("stream destroyed"))),this.on("error",i=>t(i)),this.on("end",()=>e())})}[Lz](){let e=!1,t=()=>(this.pause(),e=!0,Promise.resolve({done:!0}));return{next:()=>{if(e)return t();let r=this.read();if(r!==null)return Promise.resolve({done:!1,value:r});if(this[qs])return t();let o=null,s=null,a=h=>{this.removeListener("data",l),this.removeListener("end",u),this.removeListener(Ei,c),t(),s(h)},l=h=>{this.removeListener("error",a),this.removeListener("end",u),this.removeListener(Ei,c),this.pause(),o({value:h,done:!!this[qs]})},u=()=>{this.removeListener("error",a),this.removeListener("data",l),this.removeListener(Ei,c),t(),o({done:!0})},c=()=>a(new Error("stream destroyed"));return new Promise((h,d)=>{s=d,o=h,this.once(Ei,c),this.once("error",a),this.once("end",u),this.once("data",l)})},throw:t,return:t,[Lz](){return this}}}[Iz](){let e=!1,t=()=>(this.pause(),this.removeListener(U1,t),this.removeListener(Ei,t),this.removeListener("end",t),e=!0,{done:!0}),i=()=>{if(e)return t();let r=this.read();return r===null?t():{value:r}};return this.once("end",t),this.once(U1,t),this.once(Ei,t),{next:i,throw:t,return:t,[Iz](){return this}}}destroy(e){return this[Ei]?(e?this.emit("error",e):this.emit(Ei),this):(this[Ei]=!0,this[Ri].length=0,this[rn]=0,typeof this.close=="function"&&!this[UC]&&this.close(),e?this.emit("error",e):this.emit(Ei),this)}static isStream(e){return!!e&&(e instanceof n||e instanceof kz||e instanceof nye&&(typeof e.pipe=="function"||typeof e.write=="function"&&typeof e.end=="function"))}};Mz.Minipass=G1});var Oz=v((GYe,jz)=>{var lye=require("zlib").constants||{ZLIB_VERNUM:4736};jz.exports=Object.freeze(Object.assign(Object.create(null),{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_VERSION_ERROR:-6,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,DEFLATE:1,INFLATE:2,GZIP:3,GUNZIP:4,DEFLATERAW:5,INFLATERAW:6,UNZIP:7,BROTLI_DECODE:8,BROTLI_ENCODE:9,Z_MIN_WINDOWBITS:8,Z_MAX_WINDOWBITS:15,Z_DEFAULT_WINDOWBITS:15,Z_MIN_CHUNK:64,Z_MAX_CHUNK:1/0,Z_DEFAULT_CHUNK:16384,Z_MIN_MEMLEVEL:1,Z_MAX_MEMLEVEL:9,Z_DEFAULT_MEMLEVEL:8,Z_MIN_LEVEL:-1,Z_MAX_LEVEL:9,Z_DEFAULT_LEVEL:-1,BROTLI_OPERATION_PROCESS:0,BROTLI_OPERATION_FLUSH:1,BROTLI_OPERATION_FINISH:2,BROTLI_OPERATION_EMIT_METADATA:3,BROTLI_MODE_GENERIC:0,BROTLI_MODE_TEXT:1,BROTLI_MODE_FONT:2,BROTLI_DEFAULT_MODE:0,BROTLI_MIN_QUALITY:0,BROTLI_MAX_QUALITY:11,BROTLI_DEFAULT_QUALITY:11,BROTLI_MIN_WINDOW_BITS:10,BROTLI_MAX_WINDOW_BITS:24,BROTLI_LARGE_MAX_WINDOW_BITS:30,BROTLI_DEFAULT_WINDOW:22,BROTLI_MIN_INPUT_BLOCK_BITS:16,BROTLI_MAX_INPUT_BLOCK_BITS:24,BROTLI_PARAM_MODE:0,BROTLI_PARAM_QUALITY:1,BROTLI_PARAM_LGWIN:2,BROTLI_PARAM_LGBLOCK:3,BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING:4,BROTLI_PARAM_SIZE_HINT:5,BROTLI_PARAM_LARGE_WINDOW:6,BROTLI_PARAM_NPOSTFIX:7,BROTLI_PARAM_NDIRECT:8,BROTLI_DECODER_RESULT_ERROR:0,BROTLI_DECODER_RESULT_SUCCESS:1,BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:2,BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION:0,BROTLI_DECODER_PARAM_LARGE_WINDOW:1,BROTLI_DECODER_NO_ERROR:0,BROTLI_DECODER_SUCCESS:1,BROTLI_DECODER_NEEDS_MORE_INPUT:2,BROTLI_DECODER_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE:-1,BROTLI_DECODER_ERROR_FORMAT_RESERVED:-2,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE:-3,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET:-4,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME:-5,BROTLI_DECODER_ERROR_FORMAT_CL_SPACE:-6,BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE:-7,BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT:-8,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1:-9,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2:-10,BROTLI_DECODER_ERROR_FORMAT_TRANSFORM:-11,BROTLI_DECODER_ERROR_FORMAT_DICTIONARY:-12,BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS:-13,BROTLI_DECODER_ERROR_FORMAT_PADDING_1:-14,BROTLI_DECODER_ERROR_FORMAT_PADDING_2:-15,BROTLI_DECODER_ERROR_FORMAT_DISTANCE:-16,BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET:-19,BROTLI_DECODER_ERROR_INVALID_ARGUMENTS:-20,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES:-21,BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS:-22,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP:-25,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1:-26,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2:-27,BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES:-30,BROTLI_DECODER_ERROR_UNREACHABLE:-31},lye))});var Jz=v((zYe,Zz)=>{"use strict";var Az=typeof process=="object"&&process?process:{stdout:null,stderr:null},uye=require("events"),Nz=require("stream"),Hz=require("string_decoder").StringDecoder,Js=Symbol("EOF"),$s=Symbol("maybeEmitEnd"),el=Symbol("emittedEnd"),zC=Symbol("emittingEnd"),Uf=Symbol("emittedError"),KC=Symbol("closed"),Bz=Symbol("read"),QC=Symbol("flush"),Wz=Symbol("flushChunk"),ur=Symbol("encoding"),Xs=Symbol("decoder"),VC=Symbol("flowing"),Zf=Symbol("paused"),Uh=Symbol("resume"),on=Symbol("bufferLength"),z1=Symbol("bufferPush"),K1=Symbol("bufferShift"),En=Symbol("objectMode"),Ln=Symbol("destroyed"),Q1=Symbol("emitData"),qz=Symbol("emitEnd"),V1=Symbol("emitEnd2"),Gs=Symbol("async"),Jf=n=>Promise.resolve().then(n),Yz=global._MP_NO_ITERATOR_SYMBOLS_!=="1",cye=Yz&&Symbol.asyncIterator||Symbol("asyncIterator not implemented"),hye=Yz&&Symbol.iterator||Symbol("iterator not implemented"),dye=n=>n==="end"||n==="finish"||n==="prefinish",gye=n=>n instanceof ArrayBuffer||typeof n=="object"&&n.constructor&&n.constructor.name==="ArrayBuffer"&&n.byteLength>=0,pye=n=>!Buffer.isBuffer(n)&&ArrayBuffer.isView(n),eS=class{constructor(e,t,i){this.src=e,this.dest=t,this.opts=i,this.ondrain=()=>e[Uh](),t.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},eL=class extends eS{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,t,i){super(e,t,i),this.proxyErrors=r=>t.emit("error",r),e.on("error",this.proxyErrors)}};Zz.exports=class Uz extends Nz{constructor(e){super(),this[VC]=!1,this[Zf]=!1,this.pipes=[],this.buffer=[],this[En]=e&&e.objectMode||!1,this[En]?this[ur]=null:this[ur]=e&&e.encoding||null,this[ur]==="buffer"&&(this[ur]=null),this[Gs]=e&&!!e.async||!1,this[Xs]=this[ur]?new Hz(this[ur]):null,this[Js]=!1,this[el]=!1,this[zC]=!1,this[KC]=!1,this[Uf]=null,this.writable=!0,this.readable=!0,this[on]=0,this[Ln]=!1}get bufferLength(){return this[on]}get encoding(){return this[ur]}set encoding(e){if(this[En])throw new Error("cannot set encoding in objectMode");if(this[ur]&&e!==this[ur]&&(this[Xs]&&this[Xs].lastNeed||this[on]))throw new Error("cannot change encoding");this[ur]!==e&&(this[Xs]=e?new Hz(e):null,this.buffer.length&&(this.buffer=this.buffer.map(t=>this[Xs].write(t)))),this[ur]=e}setEncoding(e){this.encoding=e}get objectMode(){return this[En]}set objectMode(e){this[En]=this[En]||!!e}get async(){return this[Gs]}set async(e){this[Gs]=this[Gs]||!!e}write(e,t,i){if(this[Js])throw new Error("write after end");if(this[Ln])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof t=="function"&&(i=t,t="utf8"),t||(t="utf8");let r=this[Gs]?Jf:o=>o();return!this[En]&&!Buffer.isBuffer(e)&&(pye(e)?e=Buffer.from(e.buffer,e.byteOffset,e.byteLength):gye(e)?e=Buffer.from(e):typeof e!="string"&&(this.objectMode=!0)),this[En]?(this.flowing&&this[on]!==0&&this[QC](!0),this.flowing?this.emit("data",e):this[z1](e),this[on]!==0&&this.emit("readable"),i&&r(i),this.flowing):e.length?(typeof e=="string"&&!(t===this[ur]&&!this[Xs].lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[ur]&&(e=this[Xs].write(e)),this.flowing&&this[on]!==0&&this[QC](!0),this.flowing?this.emit("data",e):this[z1](e),this[on]!==0&&this.emit("readable"),i&&r(i),this.flowing):(this[on]!==0&&this.emit("readable"),i&&r(i),this.flowing)}read(e){if(this[Ln])return null;if(this[on]===0||e===0||e>this[on])return this[$s](),null;this[En]&&(e=null),this.buffer.length>1&&!this[En]&&(this.encoding?this.buffer=[this.buffer.join("")]:this.buffer=[Buffer.concat(this.buffer,this[on])]);let t=this[Bz](e||null,this.buffer[0]);return this[$s](),t}[Bz](e,t){return e===t.length||e===null?this[K1]():(this.buffer[0]=t.slice(e),t=t.slice(0,e),this[on]-=e),this.emit("data",t),!this.buffer.length&&!this[Js]&&this.emit("drain"),t}end(e,t,i){return typeof e=="function"&&(i=e,e=null),typeof t=="function"&&(i=t,t="utf8"),e&&this.write(e,t),i&&this.once("end",i),this[Js]=!0,this.writable=!1,(this.flowing||!this[Zf])&&this[$s](),this}[Uh](){this[Ln]||(this[Zf]=!1,this[VC]=!0,this.emit("resume"),this.buffer.length?this[QC]():this[Js]?this[$s]():this.emit("drain"))}resume(){return this[Uh]()}pause(){this[VC]=!1,this[Zf]=!0}get destroyed(){return this[Ln]}get flowing(){return this[VC]}get paused(){return this[Zf]}[z1](e){this[En]?this[on]+=1:this[on]+=e.length,this.buffer.push(e)}[K1](){return this.buffer.length&&(this[En]?this[on]-=1:this[on]-=this.buffer[0].length),this.buffer.shift()}[QC](e){do;while(this[Wz](this[K1]()));!e&&!this.buffer.length&&!this[Js]&&this.emit("drain")}[Wz](e){return e?(this.emit("data",e),this.flowing):!1}pipe(e,t){if(this[Ln])return;let i=this[el];return t=t||{},e===Az.stdout||e===Az.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,i?t.end&&e.end():(this.pipes.push(t.proxyErrors?new eL(this,e,t):new eS(this,e,t)),this[Gs]?Jf(()=>this[Uh]()):this[Uh]()),e}unpipe(e){let t=this.pipes.find(i=>i.dest===e);t&&(this.pipes.splice(this.pipes.indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){let i=super.on(e,t);return e==="data"&&!this.pipes.length&&!this.flowing?this[Uh]():e==="readable"&&this[on]!==0?super.emit("readable"):dye(e)&&this[el]?(super.emit(e),this.removeAllListeners(e)):e==="error"&&this[Uf]&&(this[Gs]?Jf(()=>t.call(this,this[Uf])):t.call(this,this[Uf])),i}get emittedEnd(){return this[el]}[$s](){!this[zC]&&!this[el]&&!this[Ln]&&this.buffer.length===0&&this[Js]&&(this[zC]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[KC]&&this.emit("close"),this[zC]=!1)}emit(e,t,...i){if(e!=="error"&&e!=="close"&&e!==Ln&&this[Ln])return;if(e==="data")return t?this[Gs]?Jf(()=>this[Q1](t)):this[Q1](t):!1;if(e==="end")return this[qz]();if(e==="close"){if(this[KC]=!0,!this[el]&&!this[Ln])return;let o=super.emit("close");return this.removeAllListeners("close"),o}else if(e==="error"){this[Uf]=t;let o=super.emit("error",t);return this[$s](),o}else if(e==="resume"){let o=super.emit("resume");return this[$s](),o}else if(e==="finish"||e==="prefinish"){let o=super.emit(e);return this.removeAllListeners(e),o}let r=super.emit(e,t,...i);return this[$s](),r}[Q1](e){for(let i of this.pipes)i.dest.write(e)===!1&&this.pause();let t=super.emit("data",e);return this[$s](),t}[qz](){this[el]||(this[el]=!0,this.readable=!1,this[Gs]?Jf(()=>this[V1]()):this[V1]())}[V1](){if(this[Xs]){let t=this[Xs].end();if(t){for(let i of this.pipes)i.dest.write(t);super.emit("data",t)}}for(let t of this.pipes)t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}collect(){let e=[];this[En]||(e.dataLength=0);let t=this.promise();return this.on("data",i=>{e.push(i),this[En]||(e.dataLength+=i.length)}),t.then(()=>e)}concat(){return this[En]?Promise.reject(new Error("cannot concat in objectMode")):this.collect().then(e=>this[En]?Promise.reject(new Error("cannot concat in objectMode")):this[ur]?e.join(""):Buffer.concat(e,e.dataLength))}promise(){return new Promise((e,t)=>{this.on(Ln,()=>t(new Error("stream destroyed"))),this.on("error",i=>t(i)),this.on("end",()=>e())})}[cye](){return{next:()=>{let t=this.read();if(t!==null)return Promise.resolve({done:!1,value:t});if(this[Js])return Promise.resolve({done:!0});let i=null,r=null,o=u=>{this.removeListener("data",s),this.removeListener("end",a),r(u)},s=u=>{this.removeListener("error",o),this.removeListener("end",a),this.pause(),i({value:u,done:!!this[Js]})},a=()=>{this.removeListener("error",o),this.removeListener("data",s),i({done:!0})},l=()=>o(new Error("stream destroyed"));return new Promise((u,c)=>{r=c,i=u,this.once(Ln,l),this.once("error",o),this.once("end",a),this.once("data",s)})}}}[hye](){return{next:()=>{let t=this.read();return{value:t,done:t===null}}}}destroy(e){return this[Ln]?(e?this.emit("error",e):this.emit(Ln),this):(this[Ln]=!0,this.buffer.length=0,this[on]=0,typeof this.close=="function"&&!this[KC]&&this.close(),e?this.emit("error",e):this.emit(Ln),this)}static isStream(e){return!!e&&(e instanceof Uz||e instanceof Nz||e instanceof uye&&(typeof e.pipe=="function"||typeof e.write=="function"&&typeof e.end=="function"))}}});var mL=v(Tr=>{"use strict";var oL=require("assert"),tl=require("buffer").Buffer,Gz=require("zlib"),Pu=Tr.constants=Oz(),fye=Jz(),$z=tl.concat,_u=Symbol("_superWrite"),Jh=class extends Error{constructor(e){super("zlib: "+e.message),this.code=e.code,this.errno=e.errno,this.code||(this.code="ZLIB_ERROR"),this.message="zlib: "+e.message,Error.captureStackTrace(this,this.constructor)}get name(){return"ZlibError"}},mye=Symbol("opts"),$f=Symbol("flushFlag"),Xz=Symbol("finishFlushFlag"),fL=Symbol("fullFlushFlag"),Vt=Symbol("handle"),tS=Symbol("onError"),Zh=Symbol("sawError"),tL=Symbol("level"),iL=Symbol("strategy"),nL=Symbol("ended"),KYe=Symbol("_defaultFullFlush"),iS=class extends fye{constructor(e,t){if(!e||typeof e!="object")throw new TypeError("invalid options for ZlibBase constructor");super(e),this[Zh]=!1,this[nL]=!1,this[mye]=e,this[$f]=e.flush,this[Xz]=e.finishFlush;try{this[Vt]=new Gz[t](e)}catch(i){throw new Jh(i)}this[tS]=i=>{this[Zh]||(this[Zh]=!0,this.close(),this.emit("error",i))},this[Vt].on("error",i=>this[tS](new Jh(i))),this.once("end",()=>this.close)}close(){this[Vt]&&(this[Vt].close(),this[Vt]=null,this.emit("close"))}reset(){if(!this[Zh])return oL(this[Vt],"zlib binding closed"),this[Vt].reset()}flush(e){this.ended||(typeof e!="number"&&(e=this[fL]),this.write(Object.assign(tl.alloc(0),{[$f]:e})))}end(e,t,i){return e&&this.write(e,t),this.flush(this[Xz]),this[nL]=!0,super.end(null,null,i)}get ended(){return this[nL]}write(e,t,i){if(typeof t=="function"&&(i=t,t="utf8"),typeof e=="string"&&(e=tl.from(e,t)),this[Zh])return;oL(this[Vt],"zlib binding closed");let r=this[Vt]._handle,o=r.close;r.close=()=>{};let s=this[Vt].close;this[Vt].close=()=>{},tl.concat=u=>u;let a;try{let u=typeof e[$f]=="number"?e[$f]:this[$f];a=this[Vt]._processChunk(e,u),tl.concat=$z}catch(u){tl.concat=$z,this[tS](new Jh(u))}finally{this[Vt]&&(this[Vt]._handle=r,r.close=o,this[Vt].close=s,this[Vt].removeAllListeners("error"))}this[Vt]&&this[Vt].on("error",u=>this[tS](new Jh(u)));let l;if(a)if(Array.isArray(a)&&a.length>0){l=this[_u](tl.from(a[0]));for(let u=1;u{this.flush(r),o()};try{this[Vt].params(e,t)}finally{this[Vt].flush=i}this[Vt]&&(this[tL]=e,this[iL]=t)}}}},sL=class extends zs{constructor(e){super(e,"Deflate")}},aL=class extends zs{constructor(e){super(e,"Inflate")}},rL=Symbol("_portable"),lL=class extends zs{constructor(e){super(e,"Gzip"),this[rL]=e&&!!e.portable}[_u](e){return this[rL]?(this[rL]=!1,e[9]=255,super[_u](e)):super[_u](e)}},uL=class extends zs{constructor(e){super(e,"Gunzip")}},cL=class extends zs{constructor(e){super(e,"DeflateRaw")}},hL=class extends zs{constructor(e){super(e,"InflateRaw")}},dL=class extends zs{constructor(e){super(e,"Unzip")}},nS=class extends iS{constructor(e,t){e=e||{},e.flush=e.flush||Pu.BROTLI_OPERATION_PROCESS,e.finishFlush=e.finishFlush||Pu.BROTLI_OPERATION_FINISH,super(e,t),this[fL]=Pu.BROTLI_OPERATION_FLUSH}},gL=class extends nS{constructor(e){super(e,"BrotliCompress")}},pL=class extends nS{constructor(e){super(e,"BrotliDecompress")}};Tr.Deflate=sL;Tr.Inflate=aL;Tr.Gzip=lL;Tr.Gunzip=uL;Tr.DeflateRaw=cL;Tr.InflateRaw=hL;Tr.Unzip=dL;typeof Gz.BrotliCompress=="function"?(Tr.BrotliCompress=gL,Tr.BrotliDecompress=pL):Tr.BrotliCompress=Tr.BrotliDecompress=class{constructor(){throw new Error("Brotli is not supported in this version of Node.js")}}});var $h=v((e4e,zz)=>{var bye=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform;zz.exports=bye!=="win32"?n=>n:n=>n&&n.replace(/\\/g,"/")});var rS=v((i4e,Kz)=>{"use strict";var{Minipass:yye}=GC(),bL=$h(),yL=Symbol("slurp");Kz.exports=class extends yye{constructor(e,t,i){switch(super(),this.pause(),this.extended=t,this.globalExtended=i,this.header=e,this.startBlockSize=512*Math.ceil(e.size/512),this.blockRemain=this.startBlockSize,this.remain=e.size,this.type=e.type,this.meta=!1,this.ignore=!1,this.type){case"File":case"OldFile":case"Link":case"SymbolicLink":case"CharacterDevice":case"BlockDevice":case"Directory":case"FIFO":case"ContiguousFile":case"GNUDumpDir":break;case"NextFileHasLongLinkpath":case"NextFileHasLongPath":case"OldGnuLongPath":case"GlobalExtendedHeader":case"ExtendedHeader":case"OldExtendedHeader":this.meta=!0;break;default:this.ignore=!0}this.path=bL(e.path),this.mode=e.mode,this.mode&&(this.mode=this.mode&4095),this.uid=e.uid,this.gid=e.gid,this.uname=e.uname,this.gname=e.gname,this.size=e.size,this.mtime=e.mtime,this.atime=e.atime,this.ctime=e.ctime,this.linkpath=bL(e.linkpath),this.uname=e.uname,this.gname=e.gname,t&&this[yL](t),i&&this[yL](i,!0)}write(e){let t=e.length;if(t>this.blockRemain)throw new Error("writing more to entry than is appropriate");let i=this.remain,r=this.blockRemain;return this.remain=Math.max(0,i-t),this.blockRemain=Math.max(0,r-t),this.ignore?!0:i>=t?super.write(e):super.write(e.slice(0,i))}[yL](e,t){for(let i in e)e[i]!==null&&e[i]!==void 0&&!(t&&i==="path")&&(this[i]=i==="path"||i==="linkpath"?bL(e[i]):e[i])}}});var vL=v(oS=>{"use strict";oS.name=new Map([["0","File"],["","OldFile"],["1","Link"],["2","SymbolicLink"],["3","CharacterDevice"],["4","BlockDevice"],["5","Directory"],["6","FIFO"],["7","ContiguousFile"],["g","GlobalExtendedHeader"],["x","ExtendedHeader"],["A","SolarisACL"],["D","GNUDumpDir"],["I","Inode"],["K","NextFileHasLongLinkpath"],["L","NextFileHasLongPath"],["M","ContinuationFile"],["N","OldGnuLongPath"],["S","SparseFile"],["V","TapeVolumeHeader"],["X","OldExtendedHeader"]]);oS.code=new Map(Array.from(oS.name).map(n=>[n[1],n[0]]))});var tK=v((r4e,eK)=>{"use strict";var vye=(n,e)=>{if(Number.isSafeInteger(n))n<0?xye(n,e):wye(n,e);else throw Error("cannot encode number outside of javascript safe integer range");return e},wye=(n,e)=>{e[0]=128;for(var t=e.length;t>1;t--)e[t-1]=n&255,n=Math.floor(n/256)},xye=(n,e)=>{e[0]=255;var t=!1;n=n*-1;for(var i=e.length;i>1;i--){var r=n&255;n=Math.floor(n/256),t?e[i-1]=Qz(r):r===0?e[i-1]=0:(t=!0,e[i-1]=Vz(r))}},Cye=n=>{let e=n[0],t=e===128?Dye(n.slice(1,n.length)):e===255?Sye(n):null;if(t===null)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(t))throw Error("parsed number outside of javascript safe integer range");return t},Sye=n=>{for(var e=n.length,t=0,i=!1,r=e-1;r>-1;r--){var o=n[r],s;i?s=Qz(o):o===0?s=o:(i=!0,s=Vz(o)),s!==0&&(t-=s*Math.pow(256,e-r-1))}return t},Dye=n=>{for(var e=n.length,t=0,i=e-1;i>-1;i--){var r=n[i];r!==0&&(t+=r*Math.pow(256,e-i-1))}return t},Qz=n=>(255^n)&255,Vz=n=>(255^n)+1&255;eK.exports={encode:vye,parse:Cye}});var Gh=v((o4e,nK)=>{"use strict";var wL=vL(),Xh=require("path").posix,iK=tK(),xL=Symbol("slurp"),kr=Symbol("type"),DL=class{constructor(e,t,i,r){this.cksumValid=!1,this.needPax=!1,this.nullBlock=!1,this.block=null,this.path=null,this.mode=null,this.uid=null,this.gid=null,this.size=null,this.mtime=null,this.cksum=null,this[kr]="0",this.linkpath=null,this.uname=null,this.gname=null,this.devmaj=0,this.devmin=0,this.atime=null,this.ctime=null,Buffer.isBuffer(e)?this.decode(e,t||0,i,r):e&&this.set(e)}decode(e,t,i,r){if(t||(t=0),!e||!(e.length>=t+512))throw new Error("need 512 bytes for header");if(this.path=Ru(e,t,100),this.mode=il(e,t+100,8),this.uid=il(e,t+108,8),this.gid=il(e,t+116,8),this.size=il(e,t+124,12),this.mtime=CL(e,t+136,12),this.cksum=il(e,t+148,12),this[xL](i),this[xL](r,!0),this[kr]=Ru(e,t+156,1),this[kr]===""&&(this[kr]="0"),this[kr]==="0"&&this.path.slice(-1)==="/"&&(this[kr]="5"),this[kr]==="5"&&(this.size=0),this.linkpath=Ru(e,t+157,100),e.slice(t+257,t+265).toString()==="ustar\x0000")if(this.uname=Ru(e,t+265,32),this.gname=Ru(e,t+297,32),this.devmaj=il(e,t+329,8),this.devmin=il(e,t+337,8),e[t+475]!==0){let s=Ru(e,t+345,155);this.path=s+"/"+this.path}else{let s=Ru(e,t+345,130);s&&(this.path=s+"/"+this.path),this.atime=CL(e,t+476,12),this.ctime=CL(e,t+488,12)}let o=8*32;for(let s=t;s=t+512))throw new Error("need 512 bytes for header");let i=this.ctime||this.atime?130:155,r=Tye(this.path||"",i),o=r[0],s=r[1];this.needPax=r[2],this.needPax=Eu(e,t,100,o)||this.needPax,this.needPax=nl(e,t+100,8,this.mode)||this.needPax,this.needPax=nl(e,t+108,8,this.uid)||this.needPax,this.needPax=nl(e,t+116,8,this.gid)||this.needPax,this.needPax=nl(e,t+124,12,this.size)||this.needPax,this.needPax=SL(e,t+136,12,this.mtime)||this.needPax,e[t+156]=this[kr].charCodeAt(0),this.needPax=Eu(e,t+157,100,this.linkpath)||this.needPax,e.write("ustar\x0000",t+257,8),this.needPax=Eu(e,t+265,32,this.uname)||this.needPax,this.needPax=Eu(e,t+297,32,this.gname)||this.needPax,this.needPax=nl(e,t+329,8,this.devmaj)||this.needPax,this.needPax=nl(e,t+337,8,this.devmin)||this.needPax,this.needPax=Eu(e,t+345,i,s)||this.needPax,e[t+475]!==0?this.needPax=Eu(e,t+345,155,s)||this.needPax:(this.needPax=Eu(e,t+345,130,s)||this.needPax,this.needPax=SL(e,t+476,12,this.atime)||this.needPax,this.needPax=SL(e,t+488,12,this.ctime)||this.needPax);let a=8*32;for(let l=t;l{let i=n,r="",o,s=Xh.parse(n).root||".";if(Buffer.byteLength(i)<100)o=[i,r,!1];else{r=Xh.dirname(i),i=Xh.basename(i);do Buffer.byteLength(i)<=100&&Buffer.byteLength(r)<=e?o=[i,r,!1]:Buffer.byteLength(i)>100&&Buffer.byteLength(r)<=e?o=[i.slice(0,99),r,!0]:(i=Xh.join(Xh.basename(r),i),r=Xh.dirname(r));while(r!==s&&!o);o||(o=[n.slice(0,99),"",!0])}return o},Ru=(n,e,t)=>n.slice(e,e+t).toString("utf8").replace(/\0.*/,""),CL=(n,e,t)=>kye(il(n,e,t)),kye=n=>n===null?null:new Date(n*1e3),il=(n,e,t)=>n[e]&128?iK.parse(n.slice(e,e+t)):_ye(n,e,t),Pye=n=>isNaN(n)?null:n,_ye=(n,e,t)=>Pye(parseInt(n.slice(e,e+t).toString("utf8").replace(/\0.*$/,"").trim(),8)),Rye={12:8589934591,8:2097151},nl=(n,e,t,i)=>i===null?!1:i>Rye[t]||i<0?(iK.encode(i,n.slice(e,e+t)),!0):(Eye(n,e,t,i),!1),Eye=(n,e,t,i)=>n.write(Lye(i,t),e,t,"ascii"),Lye=(n,e)=>Iye(Math.floor(n).toString(8),e),Iye=(n,e)=>(n.length===e-1?n:new Array(e-n.length-1).join("0")+n+" ")+"\0",SL=(n,e,t,i)=>i===null?!1:nl(n,e,t,i.getTime()/1e3),Fye=new Array(156).join("\0"),Eu=(n,e,t,i)=>i===null?!1:(n.write(i+Fye,e,t,"utf8"),i.length!==Buffer.byteLength(i)||i.length>t);nK.exports=DL});var sS=v((s4e,rK)=>{"use strict";var Mye=Gh(),jye=require("path"),Xf=class{constructor(e,t){this.atime=e.atime||null,this.charset=e.charset||null,this.comment=e.comment||null,this.ctime=e.ctime||null,this.gid=e.gid||null,this.gname=e.gname||null,this.linkpath=e.linkpath||null,this.mtime=e.mtime||null,this.path=e.path||null,this.size=e.size||null,this.uid=e.uid||null,this.uname=e.uname||null,this.dev=e.dev||null,this.ino=e.ino||null,this.nlink=e.nlink||null,this.global=t||!1}encode(){let e=this.encodeBody();if(e==="")return null;let t=Buffer.byteLength(e),i=512*Math.ceil(1+t/512),r=Buffer.allocUnsafe(i);for(let o=0;o<512;o++)r[o]=0;new Mye({path:("PaxHeader/"+jye.basename(this.path)).slice(0,99),mode:this.mode||420,uid:this.uid||null,gid:this.gid||null,size:t,mtime:this.mtime||null,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime||null,ctime:this.ctime||null}).encode(r),r.write(e,512,t,"utf8");for(let o=t+512;o=Math.pow(10,o)&&(o+=1),o+r+i}};Xf.parse=(n,e,t)=>new Xf(Oye(Aye(n),e),t);var Oye=(n,e)=>e?Object.keys(n).reduce((t,i)=>(t[i]=n[i],t),e):n,Aye=n=>n.replace(/\n$/,"").split(` -`).reduce(Nye,Object.create(null)),Nye=(n,e)=>{let t=parseInt(e,10);if(t!==Buffer.byteLength(e)+1)return n;e=e.slice((t+" ").length);let i=e.split("="),r=i.shift().replace(/^SCHILY\.(dev|ino|nlink)/,"$1");if(!r)return n;let o=i.join("=");return n[r]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(r)?new Date(o*1e3):/^[0-9]+$/.test(o)?+o:o,n};rK.exports=Xf});var zh=v((a4e,oK)=>{oK.exports=n=>{let e=n.length-1,t=-1;for(;e>-1&&n.charAt(e)==="/";)t=e,e--;return t===-1?n:n.slice(0,t)}});var aS=v((l4e,sK)=>{"use strict";sK.exports=n=>class extends n{warn(e,t,i={}){this.file&&(i.file=this.file),this.cwd&&(i.cwd=this.cwd),i.code=t instanceof Error&&t.code||e,i.tarCode=e,!this.strict&&i.recoverable!==!1?(t instanceof Error&&(i=Object.assign(t,i),t=t.message),this.emit("warn",i.tarCode,t,i)):t instanceof Error?this.emit("error",Object.assign(t,i)):this.emit("error",Object.assign(new Error(`${e}: ${t}`),i))}}});var kL=v((c4e,aK)=>{"use strict";var lS=["|","<",">","?",":"],TL=lS.map(n=>String.fromCharCode(61440+n.charCodeAt(0))),Hye=new Map(lS.map((n,e)=>[n,TL[e]])),Bye=new Map(TL.map((n,e)=>[n,lS[e]]));aK.exports={encode:n=>lS.reduce((e,t)=>e.split(t).join(Hye.get(t)),n),decode:n=>TL.reduce((e,t)=>e.split(t).join(Bye.get(t)),n)}});var PL=v((h4e,uK)=>{var{isAbsolute:Wye,parse:lK}=require("path").win32;uK.exports=n=>{let e="",t=lK(n);for(;Wye(n)||t.root;){let i=n.charAt(0)==="/"&&n.slice(0,4)!=="//?/"?"/":t.root;n=n.slice(i.length),e+=i,t=lK(n)}return[e,n]}});var hK=v((d4e,cK)=>{"use strict";cK.exports=(n,e,t)=>(n&=4095,t&&(n=(n|384)&-19),e&&(n&256&&(n|=64),n&32&&(n|=8),n&4&&(n|=1)),n)});var AL=v((f4e,TK)=>{"use strict";var{Minipass:yK}=GC(),vK=sS(),wK=Gh(),rs=require("fs"),dK=require("path"),ns=$h(),qye=zh(),xK=(n,e)=>e?(n=ns(n).replace(/^\.(\/|$)/,""),qye(e)+"/"+n):ns(n),Yye=16*1024*1024,gK=Symbol("process"),pK=Symbol("file"),fK=Symbol("directory"),RL=Symbol("symlink"),mK=Symbol("hardlink"),Gf=Symbol("header"),uS=Symbol("read"),EL=Symbol("lstat"),cS=Symbol("onlstat"),LL=Symbol("onread"),IL=Symbol("onreadlink"),FL=Symbol("openfile"),ML=Symbol("onopenfile"),rl=Symbol("close"),hS=Symbol("mode"),jL=Symbol("awaitDrain"),_L=Symbol("ondrain"),os=Symbol("prefix"),bK=Symbol("hadError"),CK=aS(),Uye=kL(),SK=PL(),DK=hK(),dS=CK(class extends yK{constructor(e,t){if(t=t||{},super(t),typeof e!="string")throw new TypeError("path is required");this.path=ns(e),this.portable=!!t.portable,this.myuid=process.getuid&&process.getuid()||0,this.myuser=process.env.USER||"",this.maxReadSize=t.maxReadSize||Yye,this.linkCache=t.linkCache||new Map,this.statCache=t.statCache||new Map,this.preservePaths=!!t.preservePaths,this.cwd=ns(t.cwd||process.cwd()),this.strict=!!t.strict,this.noPax=!!t.noPax,this.noMtime=!!t.noMtime,this.mtime=t.mtime||null,this.prefix=t.prefix?ns(t.prefix):null,this.fd=null,this.blockLen=null,this.blockRemain=null,this.buf=null,this.offset=null,this.length=null,this.pos=null,this.remain=null,typeof t.onwarn=="function"&&this.on("warn",t.onwarn);let i=!1;if(!this.preservePaths){let[r,o]=SK(this.path);r&&(this.path=o,i=r)}this.win32=!!t.win32||process.platform==="win32",this.win32&&(this.path=Uye.decode(this.path.replace(/\\/g,"/")),e=e.replace(/\\/g,"/")),this.absolute=ns(t.absolute||dK.resolve(this.cwd,e)),this.path===""&&(this.path="./"),i&&this.warn("TAR_ENTRY_INFO",`stripping ${i} from absolute path`,{entry:this,path:i+this.path}),this.statCache.has(this.absolute)?this[cS](this.statCache.get(this.absolute)):this[EL]()}emit(e,...t){return e==="error"&&(this[bK]=!0),super.emit(e,...t)}[EL](){rs.lstat(this.absolute,(e,t)=>{if(e)return this.emit("error",e);this[cS](t)})}[cS](e){this.statCache.set(this.absolute,e),this.stat=e,e.isFile()||(e.size=0),this.type=Jye(e),this.emit("stat",e),this[gK]()}[gK](){switch(this.type){case"File":return this[pK]();case"Directory":return this[fK]();case"SymbolicLink":return this[RL]();default:return this.end()}}[hS](e){return DK(e,this.type==="Directory",this.portable)}[os](e){return xK(e,this.prefix)}[Gf](){this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.header=new wK({path:this[os](this.path),linkpath:this.type==="Link"?this[os](this.linkpath):this.linkpath,mode:this[hS](this.stat.mode),uid:this.portable?null:this.stat.uid,gid:this.portable?null:this.stat.gid,size:this.stat.size,mtime:this.noMtime?null:this.mtime||this.stat.mtime,type:this.type,uname:this.portable?null:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?null:this.stat.atime,ctime:this.portable?null:this.stat.ctime}),this.header.encode()&&!this.noPax&&super.write(new vK({atime:this.portable?null:this.header.atime,ctime:this.portable?null:this.header.ctime,gid:this.portable?null:this.header.gid,mtime:this.noMtime?null:this.mtime||this.header.mtime,path:this[os](this.path),linkpath:this.type==="Link"?this[os](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?null:this.header.uid,uname:this.portable?null:this.header.uname,dev:this.portable?null:this.stat.dev,ino:this.portable?null:this.stat.ino,nlink:this.portable?null:this.stat.nlink}).encode()),super.write(this.header.block)}[fK](){this.path.slice(-1)!=="/"&&(this.path+="/"),this.stat.size=0,this[Gf](),this.end()}[RL](){rs.readlink(this.absolute,(e,t)=>{if(e)return this.emit("error",e);this[IL](t)})}[IL](e){this.linkpath=ns(e),this[Gf](),this.end()}[mK](e){this.type="Link",this.linkpath=ns(dK.relative(this.cwd,e)),this.stat.size=0,this[Gf](),this.end()}[pK](){if(this.stat.nlink>1){let e=this.stat.dev+":"+this.stat.ino;if(this.linkCache.has(e)){let t=this.linkCache.get(e);if(t.indexOf(this.cwd)===0)return this[mK](t)}this.linkCache.set(e,this.absolute)}if(this[Gf](),this.stat.size===0)return this.end();this[FL]()}[FL](){rs.open(this.absolute,"r",(e,t)=>{if(e)return this.emit("error",e);this[ML](t)})}[ML](e){if(this.fd=e,this[bK])return this[rl]();this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;let t=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(t),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[uS]()}[uS](){let{fd:e,buf:t,offset:i,length:r,pos:o}=this;rs.read(e,t,i,r,o,(s,a)=>{if(s)return this[rl](()=>this.emit("error",s));this[LL](a)})}[rl](e){rs.close(this.fd,e)}[LL](e){if(e<=0&&this.remain>0){let r=new Error("encountered unexpected EOF");return r.path=this.absolute,r.syscall="read",r.code="EOF",this[rl](()=>this.emit("error",r))}if(e>this.remain){let r=new Error("did not encounter expected EOF");return r.path=this.absolute,r.syscall="read",r.code="EOF",this[rl](()=>this.emit("error",r))}if(e===this.remain)for(let r=e;rthis[_L]())}[jL](e){this.once("drain",e)}write(e){if(this.blockRemaine?this.emit("error",e):this.end());this.offset>=this.length&&(this.buf=Buffer.allocUnsafe(Math.min(this.blockRemain,this.buf.length)),this.offset=0),this.length=this.buf.length-this.offset,this[uS]()}}),OL=class extends dS{[EL](){this[cS](rs.lstatSync(this.absolute))}[RL](){this[IL](rs.readlinkSync(this.absolute))}[FL](){this[ML](rs.openSync(this.absolute,"r"))}[uS](){let e=!0;try{let{fd:t,buf:i,offset:r,length:o,pos:s}=this,a=rs.readSync(t,i,r,o,s);this[LL](a),e=!1}finally{if(e)try{this[rl](()=>{})}catch{}}}[jL](e){e()}[rl](e){rs.closeSync(this.fd),e()}},Zye=CK(class extends yK{constructor(e,t){t=t||{},super(t),this.preservePaths=!!t.preservePaths,this.portable=!!t.portable,this.strict=!!t.strict,this.noPax=!!t.noPax,this.noMtime=!!t.noMtime,this.readEntry=e,this.type=e.type,this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.prefix=t.prefix||null,this.path=ns(e.path),this.mode=this[hS](e.mode),this.uid=this.portable?null:e.uid,this.gid=this.portable?null:e.gid,this.uname=this.portable?null:e.uname,this.gname=this.portable?null:e.gname,this.size=e.size,this.mtime=this.noMtime?null:t.mtime||e.mtime,this.atime=this.portable?null:e.atime,this.ctime=this.portable?null:e.ctime,this.linkpath=ns(e.linkpath),typeof t.onwarn=="function"&&this.on("warn",t.onwarn);let i=!1;if(!this.preservePaths){let[r,o]=SK(this.path);r&&(this.path=o,i=r)}this.remain=e.size,this.blockRemain=e.startBlockSize,this.header=new wK({path:this[os](this.path),linkpath:this.type==="Link"?this[os](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?null:this.uid,gid:this.portable?null:this.gid,size:this.size,mtime:this.noMtime?null:this.mtime,type:this.type,uname:this.portable?null:this.uname,atime:this.portable?null:this.atime,ctime:this.portable?null:this.ctime}),i&&this.warn("TAR_ENTRY_INFO",`stripping ${i} from absolute path`,{entry:this,path:i+this.path}),this.header.encode()&&!this.noPax&&super.write(new vK({atime:this.portable?null:this.atime,ctime:this.portable?null:this.ctime,gid:this.portable?null:this.gid,mtime:this.noMtime?null:this.mtime,path:this[os](this.path),linkpath:this.type==="Link"?this[os](this.linkpath):this.linkpath,size:this.size,uid:this.portable?null:this.uid,uname:this.portable?null:this.uname,dev:this.portable?null:this.readEntry.dev,ino:this.portable?null:this.readEntry.ino,nlink:this.portable?null:this.readEntry.nlink}).encode()),super.write(this.header.block),e.pipe(this)}[os](e){return xK(e,this.prefix)}[hS](e){return DK(e,this.type==="Directory",this.portable)}write(e){let t=e.length;if(t>this.blockRemain)throw new Error("writing more to entry than is appropriate");return this.blockRemain-=t,super.write(e)}end(){return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),super.end()}});dS.Sync=OL;dS.Tar=Zye;var Jye=n=>n.isFile()?"File":n.isDirectory()?"Directory":n.isSymbolicLink()?"SymbolicLink":"Unsupported";TK.exports=dS});var PK=v((m4e,kK)=>{"use strict";kK.exports=function(n){n.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}});var NL=v((b4e,_K)=>{"use strict";_K.exports=Tt;Tt.Node=Lu;Tt.create=Tt;function Tt(n){var e=this;if(e instanceof Tt||(e=new Tt),e.tail=null,e.head=null,e.length=0,n&&typeof n.forEach=="function")n.forEach(function(r){e.push(r)});else if(arguments.length>0)for(var t=0,i=arguments.length;t1)t=e;else if(this.head)i=this.head.next,t=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var r=0;i!==null;r++)t=n(t,i.value,r),i=i.next;return t};Tt.prototype.reduceReverse=function(n,e){var t,i=this.tail;if(arguments.length>1)t=e;else if(this.tail)i=this.tail.prev,t=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var r=this.length-1;i!==null;r--)t=n(t,i.value,r),i=i.prev;return t};Tt.prototype.toArray=function(){for(var n=new Array(this.length),e=0,t=this.head;t!==null;e++)n[e]=t.value,t=t.next;return n};Tt.prototype.toArrayReverse=function(){for(var n=new Array(this.length),e=0,t=this.tail;t!==null;e++)n[e]=t.value,t=t.prev;return n};Tt.prototype.slice=function(n,e){e=e||this.length,e<0&&(e+=this.length),n=n||0,n<0&&(n+=this.length);var t=new Tt;if(ethis.length&&(e=this.length);for(var i=0,r=this.head;r!==null&&ithis.length&&(e=this.length);for(var i=this.length,r=this.tail;r!==null&&i>e;i--)r=r.prev;for(;r!==null&&i>n;i--,r=r.prev)t.push(r.value);return t};Tt.prototype.splice=function(n,e,...t){n>this.length&&(n=this.length-1),n<0&&(n=this.length+n);for(var i=0,r=this.head;r!==null&&i{"use strict";var vS=class{constructor(e,t){this.path=e||"./",this.absolute=t,this.entry=null,this.stat=null,this.readdir=null,this.pending=!1,this.ignore=!1,this.piped=!1}},{Minipass:zye}=GC(),RK=mL(),Kye=rS(),$L=AL(),Qye=$L.Sync,Vye=$L.Tar,eve=NL(),EK=Buffer.alloc(1024),fS=Symbol("onStat"),gS=Symbol("ended"),ss=Symbol("queue"),Kh=Symbol("current"),Iu=Symbol("process"),pS=Symbol("processing"),LK=Symbol("processJob"),as=Symbol("jobs"),HL=Symbol("jobDone"),mS=Symbol("addFSEntry"),IK=Symbol("addTarEntry"),YL=Symbol("stat"),UL=Symbol("readdir"),bS=Symbol("onreaddir"),yS=Symbol("pipe"),FK=Symbol("entry"),BL=Symbol("entryOpt"),ZL=Symbol("writeEntryClass"),jK=Symbol("write"),WL=Symbol("ondrain"),wS=require("fs"),MK=require("path"),tve=aS(),qL=$h(),XL=tve(class extends zye{constructor(e){if(super(e),e=e||Object.create(null),this.opt=e,this.file=e.file||"",this.cwd=e.cwd||process.cwd(),this.maxReadSize=e.maxReadSize,this.preservePaths=!!e.preservePaths,this.strict=!!e.strict,this.noPax=!!e.noPax,this.prefix=qL(e.prefix||""),this.linkCache=e.linkCache||new Map,this.statCache=e.statCache||new Map,this.readdirCache=e.readdirCache||new Map,this[ZL]=$L,typeof e.onwarn=="function"&&this.on("warn",e.onwarn),this.portable=!!e.portable,this.zip=null,e.gzip||e.brotli){if(e.gzip&&e.brotli)throw new TypeError("gzip and brotli are mutually exclusive");e.gzip&&(typeof e.gzip!="object"&&(e.gzip={}),this.portable&&(e.gzip.portable=!0),this.zip=new RK.Gzip(e.gzip)),e.brotli&&(typeof e.brotli!="object"&&(e.brotli={}),this.zip=new RK.BrotliCompress(e.brotli)),this.zip.on("data",t=>super.write(t)),this.zip.on("end",t=>super.end()),this.zip.on("drain",t=>this[WL]()),this.on("resume",t=>this.zip.resume())}else this.on("drain",this[WL]);this.noDirRecurse=!!e.noDirRecurse,this.follow=!!e.follow,this.noMtime=!!e.noMtime,this.mtime=e.mtime||null,this.filter=typeof e.filter=="function"?e.filter:t=>!0,this[ss]=new eve,this[as]=0,this.jobs=+e.jobs||4,this[pS]=!1,this[gS]=!1}[jK](e){return super.write(e)}add(e){return this.write(e),this}end(e){return e&&this.write(e),this[gS]=!0,this[Iu](),this}write(e){if(this[gS])throw new Error("write after end");return e instanceof Kye?this[IK](e):this[mS](e),this.flowing}[IK](e){let t=qL(MK.resolve(this.cwd,e.path));if(!this.filter(e.path,e))e.resume();else{let i=new vS(e.path,t,!1);i.entry=new Vye(e,this[BL](i)),i.entry.on("end",r=>this[HL](i)),this[as]+=1,this[ss].push(i)}this[Iu]()}[mS](e){let t=qL(MK.resolve(this.cwd,e));this[ss].push(new vS(e,t)),this[Iu]()}[YL](e){e.pending=!0,this[as]+=1;let t=this.follow?"stat":"lstat";wS[t](e.absolute,(i,r)=>{e.pending=!1,this[as]-=1,i?this.emit("error",i):this[fS](e,r)})}[fS](e,t){this.statCache.set(e.absolute,t),e.stat=t,this.filter(e.path,t)||(e.ignore=!0),this[Iu]()}[UL](e){e.pending=!0,this[as]+=1,wS.readdir(e.absolute,(t,i)=>{if(e.pending=!1,this[as]-=1,t)return this.emit("error",t);this[bS](e,i)})}[bS](e,t){this.readdirCache.set(e.absolute,t),e.readdir=t,this[Iu]()}[Iu](){if(!this[pS]){this[pS]=!0;for(let e=this[ss].head;e!==null&&this[as]this.warn(t,i,r),noPax:this.noPax,cwd:this.cwd,absolute:e.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime,prefix:this.prefix}}[FK](e){this[as]+=1;try{return new this[ZL](e.path,this[BL](e)).on("end",()=>this[HL](e)).on("error",t=>this.emit("error",t))}catch(t){this.emit("error",t)}}[WL](){this[Kh]&&this[Kh].entry&&this[Kh].entry.resume()}[yS](e){e.piped=!0,e.readdir&&e.readdir.forEach(r=>{let o=e.path,s=o==="./"?"":o.replace(/\/*$/,"/");this[mS](s+r)});let t=e.entry,i=this.zip;i?t.on("data",r=>{i.write(r)||t.pause()}):t.on("data",r=>{super.write(r)||t.pause()})}pause(){return this.zip&&this.zip.pause(),super.pause()}}),JL=class extends XL{constructor(e){super(e),this[ZL]=Qye}pause(){}resume(){}[YL](e){let t=this.follow?"statSync":"lstatSync";this[fS](e,wS[t](e.absolute))}[UL](e,t){this[bS](e,wS.readdirSync(e.absolute))}[yS](e){let t=e.entry,i=this.zip;e.readdir&&e.readdir.forEach(r=>{let o=e.path,s=o==="./"?"":o.replace(/\/*$/,"/");this[mS](s+r)}),i?t.on("data",r=>{i.write(r)}):t.on("data",r=>{super[jK](r)})}};XL.Sync=JL;OK.exports=XL});var JK=v((w4e,ZK)=>{"use strict";var AK=typeof process=="object"&&process?process:{stdout:null,stderr:null},ive=require("events"),NK=require("stream"),HK=require("string_decoder").StringDecoder,Ks=Symbol("EOF"),Qs=Symbol("maybeEmitEnd"),ol=Symbol("emittedEnd"),CS=Symbol("emittingEnd"),zf=Symbol("emittedError"),SS=Symbol("closed"),BK=Symbol("read"),DS=Symbol("flush"),WK=Symbol("flushChunk"),cr=Symbol("encoding"),Vs=Symbol("decoder"),TS=Symbol("flowing"),Kf=Symbol("paused"),Qh=Symbol("resume"),sn=Symbol("bufferLength"),GL=Symbol("bufferPush"),zL=Symbol("bufferShift"),In=Symbol("objectMode"),Fn=Symbol("destroyed"),KL=Symbol("emitData"),qK=Symbol("emitEnd"),QL=Symbol("emitEnd2"),ea=Symbol("async"),Qf=n=>Promise.resolve().then(n),YK=global._MP_NO_ITERATOR_SYMBOLS_!=="1",nve=YK&&Symbol.asyncIterator||Symbol("asyncIterator not implemented"),rve=YK&&Symbol.iterator||Symbol("iterator not implemented"),ove=n=>n==="end"||n==="finish"||n==="prefinish",sve=n=>n instanceof ArrayBuffer||typeof n=="object"&&n.constructor&&n.constructor.name==="ArrayBuffer"&&n.byteLength>=0,ave=n=>!Buffer.isBuffer(n)&&ArrayBuffer.isView(n),kS=class{constructor(e,t,i){this.src=e,this.dest=t,this.opts=i,this.ondrain=()=>e[Qh](),t.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},VL=class extends kS{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,t,i){super(e,t,i),this.proxyErrors=r=>t.emit("error",r),e.on("error",this.proxyErrors)}};ZK.exports=class UK extends NK{constructor(e){super(),this[TS]=!1,this[Kf]=!1,this.pipes=[],this.buffer=[],this[In]=e&&e.objectMode||!1,this[In]?this[cr]=null:this[cr]=e&&e.encoding||null,this[cr]==="buffer"&&(this[cr]=null),this[ea]=e&&!!e.async||!1,this[Vs]=this[cr]?new HK(this[cr]):null,this[Ks]=!1,this[ol]=!1,this[CS]=!1,this[SS]=!1,this[zf]=null,this.writable=!0,this.readable=!0,this[sn]=0,this[Fn]=!1}get bufferLength(){return this[sn]}get encoding(){return this[cr]}set encoding(e){if(this[In])throw new Error("cannot set encoding in objectMode");if(this[cr]&&e!==this[cr]&&(this[Vs]&&this[Vs].lastNeed||this[sn]))throw new Error("cannot change encoding");this[cr]!==e&&(this[Vs]=e?new HK(e):null,this.buffer.length&&(this.buffer=this.buffer.map(t=>this[Vs].write(t)))),this[cr]=e}setEncoding(e){this.encoding=e}get objectMode(){return this[In]}set objectMode(e){this[In]=this[In]||!!e}get async(){return this[ea]}set async(e){this[ea]=this[ea]||!!e}write(e,t,i){if(this[Ks])throw new Error("write after end");if(this[Fn])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof t=="function"&&(i=t,t="utf8"),t||(t="utf8");let r=this[ea]?Qf:o=>o();return!this[In]&&!Buffer.isBuffer(e)&&(ave(e)?e=Buffer.from(e.buffer,e.byteOffset,e.byteLength):sve(e)?e=Buffer.from(e):typeof e!="string"&&(this.objectMode=!0)),this[In]?(this.flowing&&this[sn]!==0&&this[DS](!0),this.flowing?this.emit("data",e):this[GL](e),this[sn]!==0&&this.emit("readable"),i&&r(i),this.flowing):e.length?(typeof e=="string"&&!(t===this[cr]&&!this[Vs].lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[cr]&&(e=this[Vs].write(e)),this.flowing&&this[sn]!==0&&this[DS](!0),this.flowing?this.emit("data",e):this[GL](e),this[sn]!==0&&this.emit("readable"),i&&r(i),this.flowing):(this[sn]!==0&&this.emit("readable"),i&&r(i),this.flowing)}read(e){if(this[Fn])return null;if(this[sn]===0||e===0||e>this[sn])return this[Qs](),null;this[In]&&(e=null),this.buffer.length>1&&!this[In]&&(this.encoding?this.buffer=[this.buffer.join("")]:this.buffer=[Buffer.concat(this.buffer,this[sn])]);let t=this[BK](e||null,this.buffer[0]);return this[Qs](),t}[BK](e,t){return e===t.length||e===null?this[zL]():(this.buffer[0]=t.slice(e),t=t.slice(0,e),this[sn]-=e),this.emit("data",t),!this.buffer.length&&!this[Ks]&&this.emit("drain"),t}end(e,t,i){return typeof e=="function"&&(i=e,e=null),typeof t=="function"&&(i=t,t="utf8"),e&&this.write(e,t),i&&this.once("end",i),this[Ks]=!0,this.writable=!1,(this.flowing||!this[Kf])&&this[Qs](),this}[Qh](){this[Fn]||(this[Kf]=!1,this[TS]=!0,this.emit("resume"),this.buffer.length?this[DS]():this[Ks]?this[Qs]():this.emit("drain"))}resume(){return this[Qh]()}pause(){this[TS]=!1,this[Kf]=!0}get destroyed(){return this[Fn]}get flowing(){return this[TS]}get paused(){return this[Kf]}[GL](e){this[In]?this[sn]+=1:this[sn]+=e.length,this.buffer.push(e)}[zL](){return this.buffer.length&&(this[In]?this[sn]-=1:this[sn]-=this.buffer[0].length),this.buffer.shift()}[DS](e){do;while(this[WK](this[zL]()));!e&&!this.buffer.length&&!this[Ks]&&this.emit("drain")}[WK](e){return e?(this.emit("data",e),this.flowing):!1}pipe(e,t){if(this[Fn])return;let i=this[ol];return t=t||{},e===AK.stdout||e===AK.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,i?t.end&&e.end():(this.pipes.push(t.proxyErrors?new VL(this,e,t):new kS(this,e,t)),this[ea]?Qf(()=>this[Qh]()):this[Qh]()),e}unpipe(e){let t=this.pipes.find(i=>i.dest===e);t&&(this.pipes.splice(this.pipes.indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){let i=super.on(e,t);return e==="data"&&!this.pipes.length&&!this.flowing?this[Qh]():e==="readable"&&this[sn]!==0?super.emit("readable"):ove(e)&&this[ol]?(super.emit(e),this.removeAllListeners(e)):e==="error"&&this[zf]&&(this[ea]?Qf(()=>t.call(this,this[zf])):t.call(this,this[zf])),i}get emittedEnd(){return this[ol]}[Qs](){!this[CS]&&!this[ol]&&!this[Fn]&&this.buffer.length===0&&this[Ks]&&(this[CS]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[SS]&&this.emit("close"),this[CS]=!1)}emit(e,t,...i){if(e!=="error"&&e!=="close"&&e!==Fn&&this[Fn])return;if(e==="data")return t?this[ea]?Qf(()=>this[KL](t)):this[KL](t):!1;if(e==="end")return this[qK]();if(e==="close"){if(this[SS]=!0,!this[ol]&&!this[Fn])return;let o=super.emit("close");return this.removeAllListeners("close"),o}else if(e==="error"){this[zf]=t;let o=super.emit("error",t);return this[Qs](),o}else if(e==="resume"){let o=super.emit("resume");return this[Qs](),o}else if(e==="finish"||e==="prefinish"){let o=super.emit(e);return this.removeAllListeners(e),o}let r=super.emit(e,t,...i);return this[Qs](),r}[KL](e){for(let i of this.pipes)i.dest.write(e)===!1&&this.pause();let t=super.emit("data",e);return this[Qs](),t}[qK](){this[ol]||(this[ol]=!0,this.readable=!1,this[ea]?Qf(()=>this[QL]()):this[QL]())}[QL](){if(this[Vs]){let t=this[Vs].end();if(t){for(let i of this.pipes)i.dest.write(t);super.emit("data",t)}}for(let t of this.pipes)t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}collect(){let e=[];this[In]||(e.dataLength=0);let t=this.promise();return this.on("data",i=>{e.push(i),this[In]||(e.dataLength+=i.length)}),t.then(()=>e)}concat(){return this[In]?Promise.reject(new Error("cannot concat in objectMode")):this.collect().then(e=>this[In]?Promise.reject(new Error("cannot concat in objectMode")):this[cr]?e.join(""):Buffer.concat(e,e.dataLength))}promise(){return new Promise((e,t)=>{this.on(Fn,()=>t(new Error("stream destroyed"))),this.on("error",i=>t(i)),this.on("end",()=>e())})}[nve](){return{next:()=>{let t=this.read();if(t!==null)return Promise.resolve({done:!1,value:t});if(this[Ks])return Promise.resolve({done:!0});let i=null,r=null,o=u=>{this.removeListener("data",s),this.removeListener("end",a),r(u)},s=u=>{this.removeListener("error",o),this.removeListener("end",a),this.pause(),i({value:u,done:!!this[Ks]})},a=()=>{this.removeListener("error",o),this.removeListener("data",s),i({done:!0})},l=()=>o(new Error("stream destroyed"));return new Promise((u,c)=>{r=c,i=u,this.once(Fn,l),this.once("error",o),this.once("end",a),this.once("data",s)})}}}[rve](){return{next:()=>{let t=this.read();return{value:t,done:t===null}}}}destroy(e){return this[Fn]?(e?this.emit("error",e):this.emit(Fn),this):(this[Fn]=!0,this.buffer.length=0,this[sn]=0,typeof this.close=="function"&&!this[SS]&&this.close(),e?this.emit("error",e):this.emit(Fn),this)}static isStream(e){return!!e&&(e instanceof UK||e instanceof NK||e instanceof ive&&(typeof e.pipe=="function"||typeof e.write=="function"&&typeof e.end=="function"))}}});var sd=v(em=>{"use strict";var lve=JK(),uve=require("events").EventEmitter,hr=require("fs"),iI=hr.writev;if(!iI){let n=process.binding("fs"),e=n.FSReqWrap||n.FSReqCallback;iI=(t,i,r,o)=>{let s=(l,u)=>o(l,u,i),a=new e;a.oncomplete=s,n.writeBuffers(t,i,r,a)}}var rd=Symbol("_autoClose"),_o=Symbol("_close"),Vf=Symbol("_ended"),Ut=Symbol("_fd"),$K=Symbol("_finished"),al=Symbol("_flags"),eI=Symbol("_flush"),nI=Symbol("_handleChunk"),rI=Symbol("_makeBuf"),LS=Symbol("_mode"),PS=Symbol("_needDrain"),id=Symbol("_onerror"),od=Symbol("_onopen"),tI=Symbol("_onread"),ed=Symbol("_onwrite"),ll=Symbol("_open"),ta=Symbol("_path"),Fu=Symbol("_pos"),ls=Symbol("_queue"),td=Symbol("_read"),XK=Symbol("_readSize"),sl=Symbol("_reading"),_S=Symbol("_remain"),GK=Symbol("_size"),RS=Symbol("_write"),Vh=Symbol("_writing"),ES=Symbol("_defaultFlag"),nd=Symbol("_errored"),IS=class extends lve{constructor(e,t){if(t=t||{},super(t),this.readable=!0,this.writable=!1,typeof e!="string")throw new TypeError("path must be a string");this[nd]=!1,this[Ut]=typeof t.fd=="number"?t.fd:null,this[ta]=e,this[XK]=t.readSize||16*1024*1024,this[sl]=!1,this[GK]=typeof t.size=="number"?t.size:1/0,this[_S]=this[GK],this[rd]=typeof t.autoClose=="boolean"?t.autoClose:!0,typeof this[Ut]=="number"?this[td]():this[ll]()}get fd(){return this[Ut]}get path(){return this[ta]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[ll](){hr.open(this[ta],"r",(e,t)=>this[od](e,t))}[od](e,t){e?this[id](e):(this[Ut]=t,this.emit("open",t),this[td]())}[rI](){return Buffer.allocUnsafe(Math.min(this[XK],this[_S]))}[td](){if(!this[sl]){this[sl]=!0;let e=this[rI]();if(e.length===0)return process.nextTick(()=>this[tI](null,0,e));hr.read(this[Ut],e,0,e.length,null,(t,i,r)=>this[tI](t,i,r))}}[tI](e,t,i){this[sl]=!1,e?this[id](e):this[nI](t,i)&&this[td]()}[_o](){if(this[rd]&&typeof this[Ut]=="number"){let e=this[Ut];this[Ut]=null,hr.close(e,t=>t?this.emit("error",t):this.emit("close"))}}[id](e){this[sl]=!0,this[_o](),this.emit("error",e)}[nI](e,t){let i=!1;return this[_S]-=e,e>0&&(i=super.write(ethis[od](e,t))}[od](e,t){this[ES]&&this[al]==="r+"&&e&&e.code==="ENOENT"?(this[al]="w",this[ll]()):e?this[id](e):(this[Ut]=t,this.emit("open",t),this[eI]())}end(e,t){return e&&this.write(e,t),this[Vf]=!0,!this[Vh]&&!this[ls].length&&typeof this[Ut]=="number"&&this[ed](null,0),this}write(e,t){return typeof e=="string"&&(e=Buffer.from(e,t)),this[Vf]?(this.emit("error",new Error("write() after end()")),!1):this[Ut]===null||this[Vh]||this[ls].length?(this[ls].push(e),this[PS]=!0,!1):(this[Vh]=!0,this[RS](e),!0)}[RS](e){hr.write(this[Ut],e,0,e.length,this[Fu],(t,i)=>this[ed](t,i))}[ed](e,t){e?this[id](e):(this[Fu]!==null&&(this[Fu]+=t),this[ls].length?this[eI]():(this[Vh]=!1,this[Vf]&&!this[$K]?(this[$K]=!0,this[_o](),this.emit("finish")):this[PS]&&(this[PS]=!1,this.emit("drain"))))}[eI](){if(this[ls].length===0)this[Vf]&&this[ed](null,0);else if(this[ls].length===1)this[RS](this[ls].pop());else{let e=this[ls];this[ls]=[],iI(this[Ut],e,this[Fu],(t,i)=>this[ed](t,i))}}[_o](){if(this[rd]&&typeof this[Ut]=="number"){let e=this[Ut];this[Ut]=null,hr.close(e,t=>t?this.emit("error",t):this.emit("close"))}}},sI=class extends FS{[ll](){let e;if(this[ES]&&this[al]==="r+")try{e=hr.openSync(this[ta],this[al],this[LS])}catch(t){if(t.code==="ENOENT")return this[al]="w",this[ll]();throw t}else e=hr.openSync(this[ta],this[al],this[LS]);this[od](null,e)}[_o](){if(this[rd]&&typeof this[Ut]=="number"){let e=this[Ut];this[Ut]=null,hr.closeSync(e),this.emit("close")}}[RS](e){let t=!0;try{this[ed](null,hr.writeSync(this[Ut],e,0,e.length,this[Fu])),t=!1}finally{if(t)try{this[_o]()}catch{}}}};em.ReadStream=IS;em.ReadStreamSync=oI;em.WriteStream=FS;em.WriteStreamSync=sI});var BS=v((S4e,o7)=>{"use strict";var cve=aS(),zK=Gh(),hve=require("events"),dve=NL(),gve=1024*1024,pve=rS(),KK=sS(),QK=mL(),{nextTick:fve}=require("process"),aI=Buffer.from([31,139]),Vr=Symbol("state"),Mu=Symbol("writeEntry"),ia=Symbol("readEntry"),lI=Symbol("nextEntry"),VK=Symbol("processEntry"),eo=Symbol("extendedHeader"),tm=Symbol("globalExtendedHeader"),ul=Symbol("meta"),e7=Symbol("emitMeta"),ei=Symbol("buffer"),na=Symbol("queue"),cl=Symbol("ended"),t7=Symbol("emittedEnd"),ju=Symbol("emit"),an=Symbol("unzip"),MS=Symbol("consumeChunk"),jS=Symbol("consumeChunkSub"),uI=Symbol("consumeBody"),i7=Symbol("consumeMeta"),n7=Symbol("consumeHeader"),OS=Symbol("consuming"),cI=Symbol("bufferConcat"),hI=Symbol("maybeEnd"),im=Symbol("writing"),hl=Symbol("aborted"),AS=Symbol("onDone"),Ou=Symbol("sawValidEntry"),NS=Symbol("sawNullBlock"),HS=Symbol("sawEOF"),r7=Symbol("closeStream"),mve=n=>!0;o7.exports=cve(class extends hve{constructor(e){e=e||{},super(e),this.file=e.file||"",this[Ou]=null,this.on(AS,i=>{(this[Vr]==="begin"||this[Ou]===!1)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),e.ondone?this.on(AS,e.ondone):this.on(AS,i=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")}),this.strict=!!e.strict,this.maxMetaEntrySize=e.maxMetaEntrySize||gve,this.filter=typeof e.filter=="function"?e.filter:mve;let t=e.file&&(e.file.endsWith(".tar.br")||e.file.endsWith(".tbr"));this.brotli=!e.gzip&&e.brotli!==void 0?e.brotli:t?void 0:!1,this.writable=!0,this.readable=!1,this[na]=new dve,this[ei]=null,this[ia]=null,this[Mu]=null,this[Vr]="begin",this[ul]="",this[eo]=null,this[tm]=null,this[cl]=!1,this[an]=null,this[hl]=!1,this[NS]=!1,this[HS]=!1,this.on("end",()=>this[r7]()),typeof e.onwarn=="function"&&this.on("warn",e.onwarn),typeof e.onentry=="function"&&this.on("entry",e.onentry)}[n7](e,t){this[Ou]===null&&(this[Ou]=!1);let i;try{i=new zK(e,t,this[eo],this[tm])}catch(r){return this.warn("TAR_ENTRY_INVALID",r)}if(i.nullBlock)this[NS]?(this[HS]=!0,this[Vr]==="begin"&&(this[Vr]="header"),this[ju]("eof")):(this[NS]=!0,this[ju]("nullBlock"));else if(this[NS]=!1,!i.cksumValid)this.warn("TAR_ENTRY_INVALID","checksum failure",{header:i});else if(!i.path)this.warn("TAR_ENTRY_INVALID","path is required",{header:i});else{let r=i.type;if(/^(Symbolic)?Link$/.test(r)&&!i.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:i});else if(!/^(Symbolic)?Link$/.test(r)&&i.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:i});else{let o=this[Mu]=new pve(i,this[eo],this[tm]);if(!this[Ou])if(o.remain){let s=()=>{o.invalid||(this[Ou]=!0)};o.on("end",s)}else this[Ou]=!0;o.meta?o.size>this.maxMetaEntrySize?(o.ignore=!0,this[ju]("ignoredEntry",o),this[Vr]="ignore",o.resume()):o.size>0&&(this[ul]="",o.on("data",s=>this[ul]+=s),this[Vr]="meta"):(this[eo]=null,o.ignore=o.ignore||!this.filter(o.path,o),o.ignore?(this[ju]("ignoredEntry",o),this[Vr]=o.remain?"ignore":"header",o.resume()):(o.remain?this[Vr]="body":(this[Vr]="header",o.end()),this[ia]?this[na].push(o):(this[na].push(o),this[lI]())))}}}[r7](){fve(()=>this.emit("close"))}[VK](e){let t=!0;return e?Array.isArray(e)?this.emit.apply(this,e):(this[ia]=e,this.emit("entry",e),e.emittedEnd||(e.on("end",i=>this[lI]()),t=!1)):(this[ia]=null,t=!1),t}[lI](){do;while(this[VK](this[na].shift()));if(!this[na].length){let e=this[ia];!e||e.flowing||e.size===e.remain?this[im]||this.emit("drain"):e.once("drain",i=>this.emit("drain"))}}[uI](e,t){let i=this[Mu],r=i.blockRemain,o=r>=e.length&&t===0?e:e.slice(t,t+r);return i.write(o),i.blockRemain||(this[Vr]="header",this[Mu]=null,i.end()),o.length}[i7](e,t){let i=this[Mu],r=this[uI](e,t);return this[Mu]||this[e7](i),r}[ju](e,t,i){!this[na].length&&!this[ia]?this.emit(e,t,i):this[na].push([e,t,i])}[e7](e){switch(this[ju]("meta",this[ul]),e.type){case"ExtendedHeader":case"OldExtendedHeader":this[eo]=KK.parse(this[ul],this[eo],!1);break;case"GlobalExtendedHeader":this[tm]=KK.parse(this[ul],this[tm],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":this[eo]=this[eo]||Object.create(null),this[eo].path=this[ul].replace(/\0.*/,"");break;case"NextFileHasLongLinkpath":this[eo]=this[eo]||Object.create(null),this[eo].linkpath=this[ul].replace(/\0.*/,"");break;default:throw new Error("unknown meta: "+e.type)}}abort(e){this[hl]=!0,this.emit("abort",e),this.warn("TAR_ABORT",e,{recoverable:!1})}write(e){if(this[hl])return;if((this[an]===null||this.brotli===void 0&&this[an]===!1)&&e){if(this[ei]&&(e=Buffer.concat([this[ei],e]),this[ei]=null),e.lengththis[MS](a)),this[an].on("error",a=>this.abort(a)),this[an].on("end",a=>{this[cl]=!0,this[MS]()}),this[im]=!0;let s=this[an][o?"end":"write"](e);return this[im]=!1,s}}this[im]=!0,this[an]?this[an].write(e):this[MS](e),this[im]=!1;let i=this[na].length?!1:this[ia]?this[ia].flowing:!0;return!i&&!this[na].length&&this[ia].once("drain",r=>this.emit("drain")),i}[cI](e){e&&!this[hl]&&(this[ei]=this[ei]?Buffer.concat([this[ei],e]):e)}[hI](){if(this[cl]&&!this[t7]&&!this[hl]&&!this[OS]){this[t7]=!0;let e=this[Mu];if(e&&e.blockRemain){let t=this[ei]?this[ei].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${e.blockRemain} more bytes, only ${t} available)`,{entry:e}),this[ei]&&e.write(this[ei]),e.end()}this[ju](AS)}}[MS](e){if(this[OS])this[cI](e);else if(!e&&!this[ei])this[hI]();else{if(this[OS]=!0,this[ei]){this[cI](e);let t=this[ei];this[ei]=null,this[jS](t)}else this[jS](e);for(;this[ei]&&this[ei].length>=512&&!this[hl]&&!this[HS];){let t=this[ei];this[ei]=null,this[jS](t)}this[OS]=!1}(!this[ei]||this[cl])&&this[hI]()}[jS](e){let t=0,i=e.length;for(;t+512<=i&&!this[hl]&&!this[HS];)switch(this[Vr]){case"begin":case"header":this[n7](e,t),t+=512;break;case"ignore":case"body":t+=this[uI](e,t);break;case"meta":t+=this[i7](e,t);break;default:throw new Error("invalid state: "+this[Vr])}t{"use strict";var bve=qh(),a7=BS(),ad=require("fs"),yve=sd(),s7=require("path"),dI=zh();u7.exports=(n,e,t)=>{typeof n=="function"?(t=n,e=null,n={}):Array.isArray(n)&&(e=n,n={}),typeof e=="function"&&(t=e,e=null),e?e=Array.from(e):e=[];let i=bve(n);if(i.sync&&typeof t=="function")throw new TypeError("callback not supported for sync tar functions");if(!i.file&&typeof t=="function")throw new TypeError("callback only supported with file option");return e.length&&wve(i,e),i.noResume||vve(i),i.file&&i.sync?xve(i):i.file?Cve(i,t):l7(i)};var vve=n=>{let e=n.onentry;n.onentry=e?t=>{e(t),t.resume()}:t=>t.resume()},wve=(n,e)=>{let t=new Map(e.map(o=>[dI(o),!0])),i=n.filter,r=(o,s)=>{let a=s||s7.parse(o).root||".",l=o===a?!1:t.has(o)?t.get(o):r(s7.dirname(o),a);return t.set(o,l),l};n.filter=i?(o,s)=>i(o,s)&&r(dI(o)):o=>r(dI(o))},xve=n=>{let e=l7(n),t=n.file,i=!0,r;try{let o=ad.statSync(t),s=n.maxReadSize||16*1024*1024;if(o.size{let t=new a7(n),i=n.maxReadSize||16*1024*1024,r=n.file,o=new Promise((s,a)=>{t.on("error",a),t.on("end",s),ad.stat(r,(l,u)=>{if(l)a(l);else{let c=new yve.ReadStream(r,{readSize:i,size:u.size});c.on("error",a),c.pipe(t)}})});return e?o.then(e,e):o},l7=n=>new a7(n)});var f7=v((T4e,p7)=>{"use strict";var Sve=qh(),qS=xS(),c7=sd(),h7=WS(),d7=require("path");p7.exports=(n,e,t)=>{if(typeof e=="function"&&(t=e),Array.isArray(n)&&(e=n,n={}),!e||!Array.isArray(e)||!e.length)throw new TypeError("no files or directories specified");e=Array.from(e);let i=Sve(n);if(i.sync&&typeof t=="function")throw new TypeError("callback not supported for sync tar functions");if(!i.file&&typeof t=="function")throw new TypeError("callback only supported with file option");return i.file&&i.sync?Dve(i,e):i.file?Tve(i,e,t):i.sync?kve(i,e):Pve(i,e)};var Dve=(n,e)=>{let t=new qS.Sync(n),i=new c7.WriteStreamSync(n.file,{mode:n.mode||438});t.pipe(i),g7(t,e)},Tve=(n,e,t)=>{let i=new qS(n),r=new c7.WriteStream(n.file,{mode:n.mode||438});i.pipe(r);let o=new Promise((s,a)=>{r.on("error",a),r.on("close",s),i.on("error",a)});return gI(i,e),t?o.then(t,t):o},g7=(n,e)=>{e.forEach(t=>{t.charAt(0)==="@"?h7({file:d7.resolve(n.cwd,t.slice(1)),sync:!0,noResume:!0,onentry:i=>n.add(i)}):n.add(t)}),n.end()},gI=(n,e)=>{for(;e.length;){let t=e.shift();if(t.charAt(0)==="@")return h7({file:d7.resolve(n.cwd,t.slice(1)),noResume:!0,onentry:i=>n.add(i)}).then(i=>gI(n,e));n.add(t)}n.end()},kve=(n,e)=>{let t=new qS.Sync(n);return g7(t,e),t},Pve=(n,e)=>{let t=new qS(n);return gI(t,e),t}});var pI=v((k4e,C7)=>{"use strict";var _ve=qh(),m7=xS(),Pr=require("fs"),b7=sd(),y7=WS(),v7=require("path"),w7=Gh();C7.exports=(n,e,t)=>{let i=_ve(n);if(!i.file)throw new TypeError("file is required");if(i.gzip||i.brotli||i.file.endsWith(".br")||i.file.endsWith(".tbr"))throw new TypeError("cannot append to compressed archives");if(!e||!Array.isArray(e)||!e.length)throw new TypeError("no files or directories specified");return e=Array.from(e),i.sync?Rve(i,e):Lve(i,e,t)};var Rve=(n,e)=>{let t=new m7.Sync(n),i=!0,r,o;try{try{r=Pr.openSync(n.file,"r+")}catch(l){if(l.code==="ENOENT")r=Pr.openSync(n.file,"w+");else throw l}let s=Pr.fstatSync(r),a=Buffer.alloc(512);e:for(o=0;os.size)break;o+=u,n.mtimeCache&&n.mtimeCache.set(l.path,l.mtime)}i=!1,Eve(n,t,o,r,e)}finally{if(i)try{Pr.closeSync(r)}catch{}}},Eve=(n,e,t,i,r)=>{let o=new b7.WriteStreamSync(n.file,{fd:i,start:t});e.pipe(o),Ive(e,r)},Lve=(n,e,t)=>{e=Array.from(e);let i=new m7(n),r=(s,a,l)=>{let u=(f,m)=>{f?Pr.close(s,b=>l(f)):l(null,m)},c=0;if(a===0)return u(null,0);let h=0,d=Buffer.alloc(512),g=(f,m)=>{if(f)return u(f);if(h+=m,h<512&&m)return Pr.read(s,d,h,d.length-h,c+h,g);if(c===0&&d[0]===31&&d[1]===139)return u(new Error("cannot append to compressed archives"));if(h<512)return u(null,c);let b=new w7(d);if(!b.cksumValid)return u(null,c);let w=512*Math.ceil(b.size/512);if(c+w+512>a||(c+=w+512,c>=a))return u(null,c);n.mtimeCache&&n.mtimeCache.set(b.path,b.mtime),h=0,Pr.read(s,d,0,512,c,g)};Pr.read(s,d,0,512,c,g)},o=new Promise((s,a)=>{i.on("error",a);let l="r+",u=(c,h)=>{if(c&&c.code==="ENOENT"&&l==="r+")return l="w+",Pr.open(n.file,l,u);if(c)return a(c);Pr.fstat(h,(d,g)=>{if(d)return Pr.close(h,()=>a(d));r(h,g.size,(f,m)=>{if(f)return a(f);let b=new b7.WriteStream(n.file,{fd:h,start:m});i.pipe(b),b.on("error",a),b.on("close",s),x7(i,e)})})};Pr.open(n.file,l,u)});return t?o.then(t,t):o},Ive=(n,e)=>{e.forEach(t=>{t.charAt(0)==="@"?y7({file:v7.resolve(n.cwd,t.slice(1)),sync:!0,noResume:!0,onentry:i=>n.add(i)}):n.add(t)}),n.end()},x7=(n,e)=>{for(;e.length;){let t=e.shift();if(t.charAt(0)==="@")return y7({file:v7.resolve(n.cwd,t.slice(1)),noResume:!0,onentry:i=>n.add(i)}).then(i=>x7(n,e));n.add(t)}n.end()}});var D7=v((P4e,S7)=>{"use strict";var Fve=qh(),Mve=pI();S7.exports=(n,e,t)=>{let i=Fve(n);if(!i.file)throw new TypeError("file is required");if(i.gzip||i.brotli||i.file.endsWith(".br")||i.file.endsWith(".tbr"))throw new TypeError("cannot append to compressed archives");if(!e||!Array.isArray(e)||!e.length)throw new TypeError("no files or directories specified");return e=Array.from(e),jve(i),Mve(i,e,t)};var jve=n=>{let e=n.filter;n.mtimeCache||(n.mtimeCache=new Map),n.filter=e?(t,i)=>e(t,i)&&!(n.mtimeCache.get(t)>i.mtime):(t,i)=>!(n.mtimeCache.get(t)>i.mtime)}});var P7=v((_4e,k7)=>{var{promisify:T7}=require("util"),dl=require("fs"),Ove=n=>{if(!n)n={mode:511,fs:dl};else if(typeof n=="object")n={mode:511,fs:dl,...n};else if(typeof n=="number")n={mode:n,fs:dl};else if(typeof n=="string")n={mode:parseInt(n,8),fs:dl};else throw new TypeError("invalid options argument");return n.mkdir=n.mkdir||n.fs.mkdir||dl.mkdir,n.mkdirAsync=T7(n.mkdir),n.stat=n.stat||n.fs.stat||dl.stat,n.statAsync=T7(n.stat),n.statSync=n.statSync||n.fs.statSync||dl.statSync,n.mkdirSync=n.mkdirSync||n.fs.mkdirSync||dl.mkdirSync,n};k7.exports=Ove});var R7=v((R4e,_7)=>{var Ave=process.env.__TESTING_MKDIRP_PLATFORM__||process.platform,{resolve:Nve,parse:Hve}=require("path"),Bve=n=>{if(/\0/.test(n))throw Object.assign(new TypeError("path must be a string without null bytes"),{path:n,code:"ERR_INVALID_ARG_VALUE"});if(n=Nve(n),Ave==="win32"){let e=/[*|"<>?:]/,{root:t}=Hve(n);if(e.test(n.substr(t.length)))throw Object.assign(new Error("Illegal characters in path."),{path:n,code:"EINVAL"})}return n};_7.exports=Bve});var M7=v((E4e,F7)=>{var{dirname:E7}=require("path"),L7=(n,e,t=void 0)=>t===e?Promise.resolve():n.statAsync(e).then(i=>i.isDirectory()?t:void 0,i=>i.code==="ENOENT"?L7(n,E7(e),e):void 0),I7=(n,e,t=void 0)=>{if(t!==e)try{return n.statSync(e).isDirectory()?t:void 0}catch(i){return i.code==="ENOENT"?I7(n,E7(e),e):void 0}};F7.exports={findMade:L7,findMadeSync:I7}});var bI=v((L4e,O7)=>{var{dirname:j7}=require("path"),fI=(n,e,t)=>{e.recursive=!1;let i=j7(n);return i===n?e.mkdirAsync(n,e).catch(r=>{if(r.code!=="EISDIR")throw r}):e.mkdirAsync(n,e).then(()=>t||n,r=>{if(r.code==="ENOENT")return fI(i,e).then(o=>fI(n,e,o));if(r.code!=="EEXIST"&&r.code!=="EROFS")throw r;return e.statAsync(n).then(o=>{if(o.isDirectory())return t;throw r},()=>{throw r})})},mI=(n,e,t)=>{let i=j7(n);if(e.recursive=!1,i===n)try{return e.mkdirSync(n,e)}catch(r){if(r.code!=="EISDIR")throw r;return}try{return e.mkdirSync(n,e),t||n}catch(r){if(r.code==="ENOENT")return mI(n,e,mI(i,e,t));if(r.code!=="EEXIST"&&r.code!=="EROFS")throw r;try{if(!e.statSync(n).isDirectory())throw r}catch{throw r}}};O7.exports={mkdirpManual:fI,mkdirpManualSync:mI}});var H7=v((I4e,N7)=>{var{dirname:A7}=require("path"),{findMade:Wve,findMadeSync:qve}=M7(),{mkdirpManual:Yve,mkdirpManualSync:Uve}=bI(),Zve=(n,e)=>(e.recursive=!0,A7(n)===n?e.mkdirAsync(n,e):Wve(e,n).then(i=>e.mkdirAsync(n,e).then(()=>i).catch(r=>{if(r.code==="ENOENT")return Yve(n,e);throw r}))),Jve=(n,e)=>{if(e.recursive=!0,A7(n)===n)return e.mkdirSync(n,e);let i=qve(e,n);try{return e.mkdirSync(n,e),i}catch(r){if(r.code==="ENOENT")return Uve(n,e);throw r}};N7.exports={mkdirpNative:Zve,mkdirpNativeSync:Jve}});var Y7=v((F4e,q7)=>{var B7=require("fs"),$ve=process.env.__TESTING_MKDIRP_NODE_VERSION__||process.version,yI=$ve.replace(/^v/,"").split("."),W7=+yI[0]>10||+yI[0]==10&&+yI[1]>=12,Xve=W7?n=>n.mkdir===B7.mkdir:()=>!1,Gve=W7?n=>n.mkdirSync===B7.mkdirSync:()=>!1;q7.exports={useNative:Xve,useNativeSync:Gve}});var G7=v((M4e,X7)=>{var ld=P7(),ud=R7(),{mkdirpNative:U7,mkdirpNativeSync:Z7}=H7(),{mkdirpManual:J7,mkdirpManualSync:$7}=bI(),{useNative:zve,useNativeSync:Kve}=Y7(),cd=(n,e)=>(n=ud(n),e=ld(e),zve(e)?U7(n,e):J7(n,e)),Qve=(n,e)=>(n=ud(n),e=ld(e),Kve(e)?Z7(n,e):$7(n,e));cd.sync=Qve;cd.native=(n,e)=>U7(ud(n),ld(e));cd.manual=(n,e)=>J7(ud(n),ld(e));cd.nativeSync=(n,e)=>Z7(ud(n),ld(e));cd.manualSync=(n,e)=>$7(ud(n),ld(e));X7.exports=cd});var iQ=v((j4e,tQ)=>{"use strict";var to=require("fs"),Au=require("path"),Vve=to.lchown?"lchown":"chown",ewe=to.lchownSync?"lchownSync":"chownSync",K7=to.lchown&&!process.version.match(/v1[1-9]+\./)&&!process.version.match(/v10\.[6-9]/),z7=(n,e,t)=>{try{return to[ewe](n,e,t)}catch(i){if(i.code!=="ENOENT")throw i}},twe=(n,e,t)=>{try{return to.chownSync(n,e,t)}catch(i){if(i.code!=="ENOENT")throw i}},iwe=K7?(n,e,t,i)=>r=>{!r||r.code!=="EISDIR"?i(r):to.chown(n,e,t,i)}:(n,e,t,i)=>i,vI=K7?(n,e,t)=>{try{return z7(n,e,t)}catch(i){if(i.code!=="EISDIR")throw i;twe(n,e,t)}}:(n,e,t)=>z7(n,e,t),nwe=process.version,Q7=(n,e,t)=>to.readdir(n,e,t),rwe=(n,e)=>to.readdirSync(n,e);/^v4\./.test(nwe)&&(Q7=(n,e,t)=>to.readdir(n,t));var YS=(n,e,t,i)=>{to[Vve](n,e,t,iwe(n,e,t,r=>{i(r&&r.code!=="ENOENT"?r:null)}))},V7=(n,e,t,i,r)=>{if(typeof e=="string")return to.lstat(Au.resolve(n,e),(o,s)=>{if(o)return r(o.code!=="ENOENT"?o:null);s.name=e,V7(n,s,t,i,r)});if(e.isDirectory())wI(Au.resolve(n,e.name),t,i,o=>{if(o)return r(o);let s=Au.resolve(n,e.name);YS(s,t,i,r)});else{let o=Au.resolve(n,e.name);YS(o,t,i,r)}},wI=(n,e,t,i)=>{Q7(n,{withFileTypes:!0},(r,o)=>{if(r){if(r.code==="ENOENT")return i();if(r.code!=="ENOTDIR"&&r.code!=="ENOTSUP")return i(r)}if(r||!o.length)return YS(n,e,t,i);let s=o.length,a=null,l=u=>{if(!a){if(u)return i(a=u);if(--s===0)return YS(n,e,t,i)}};o.forEach(u=>V7(n,u,e,t,l))})},owe=(n,e,t,i)=>{if(typeof e=="string")try{let r=to.lstatSync(Au.resolve(n,e));r.name=e,e=r}catch(r){if(r.code==="ENOENT")return;throw r}e.isDirectory()&&eQ(Au.resolve(n,e.name),t,i),vI(Au.resolve(n,e.name),t,i)},eQ=(n,e,t)=>{let i;try{i=rwe(n,{withFileTypes:!0})}catch(r){if(r.code==="ENOENT")return;if(r.code==="ENOTDIR"||r.code==="ENOTSUP")return vI(n,e,t);throw r}return i&&i.length&&i.forEach(r=>owe(n,r,e,t)),vI(n,e,t)};tQ.exports=wI;wI.sync=eQ});var sQ=v((O4e,xI)=>{"use strict";var nQ=G7(),io=require("fs"),US=require("path"),rQ=iQ(),Ro=$h(),ZS=class extends Error{constructor(e,t){super("Cannot extract through symbolic link"),this.path=t,this.symlink=e}get name(){return"SylinkError"}},JS=class extends Error{constructor(e,t){super(t+": Cannot cd into '"+e+"'"),this.path=e,this.code=t}get name(){return"CwdError"}},$S=(n,e)=>n.get(Ro(e)),nm=(n,e,t)=>n.set(Ro(e),t),swe=(n,e)=>{io.stat(n,(t,i)=>{(t||!i.isDirectory())&&(t=new JS(n,t&&t.code||"ENOTDIR")),e(t)})};xI.exports=(n,e,t)=>{n=Ro(n);let i=e.umask,r=e.mode|448,o=(r&i)!==0,s=e.uid,a=e.gid,l=typeof s=="number"&&typeof a=="number"&&(s!==e.processUid||a!==e.processGid),u=e.preserve,c=e.unlink,h=e.cache,d=Ro(e.cwd),g=(b,w)=>{b?t(b):(nm(h,n,!0),w&&l?rQ(w,s,a,x=>g(x)):o?io.chmod(n,r,t):t())};if(h&&$S(h,n)===!0)return g();if(n===d)return swe(n,g);if(u)return nQ(n,{mode:r}).then(b=>g(null,b),g);let m=Ro(US.relative(d,n)).split("/");XS(d,m,r,h,c,d,null,g)};var XS=(n,e,t,i,r,o,s,a)=>{if(!e.length)return a(null,s);let l=e.shift(),u=Ro(US.resolve(n+"/"+l));if($S(i,u))return XS(u,e,t,i,r,o,s,a);io.mkdir(u,t,oQ(u,e,t,i,r,o,s,a))},oQ=(n,e,t,i,r,o,s,a)=>l=>{l?io.lstat(n,(u,c)=>{if(u)u.path=u.path&&Ro(u.path),a(u);else if(c.isDirectory())XS(n,e,t,i,r,o,s,a);else if(r)io.unlink(n,h=>{if(h)return a(h);io.mkdir(n,t,oQ(n,e,t,i,r,o,s,a))});else{if(c.isSymbolicLink())return a(new ZS(n,n+"/"+e.join("/")));a(l)}}):(s=s||n,XS(n,e,t,i,r,o,s,a))},awe=n=>{let e=!1,t="ENOTDIR";try{e=io.statSync(n).isDirectory()}catch(i){t=i.code}finally{if(!e)throw new JS(n,t)}};xI.exports.sync=(n,e)=>{n=Ro(n);let t=e.umask,i=e.mode|448,r=(i&t)!==0,o=e.uid,s=e.gid,a=typeof o=="number"&&typeof s=="number"&&(o!==e.processUid||s!==e.processGid),l=e.preserve,u=e.unlink,c=e.cache,h=Ro(e.cwd),d=b=>{nm(c,n,!0),b&&a&&rQ.sync(b,o,s),r&&io.chmodSync(n,i)};if(c&&$S(c,n)===!0)return d();if(n===h)return awe(h),d();if(l)return d(nQ.sync(n,i));let f=Ro(US.relative(h,n)).split("/"),m=null;for(let b=f.shift(),w=h;b&&(w+="/"+b);b=f.shift())if(w=Ro(US.resolve(w)),!$S(c,w))try{io.mkdirSync(w,i),m=m||w,nm(c,w,!0)}catch{let D=io.lstatSync(w);if(D.isDirectory()){nm(c,w,!0);continue}else if(u){io.unlinkSync(w),io.mkdirSync(w,i),m=m||w,nm(c,w,!0);continue}else if(D.isSymbolicLink())return new ZS(w,w+"/"+f.join("/"))}return d(m)}});var SI=v((A4e,aQ)=>{var CI=Object.create(null),{hasOwnProperty:lwe}=Object.prototype;aQ.exports=n=>(lwe.call(CI,n)||(CI[n]=n.normalize("NFD")),CI[n])});var hQ=v((N4e,cQ)=>{var lQ=require("assert"),uwe=SI(),cwe=zh(),{join:uQ}=require("path"),hwe=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,dwe=hwe==="win32";cQ.exports=()=>{let n=new Map,e=new Map,t=u=>u.split("/").slice(0,-1).reduce((h,d)=>(h.length&&(d=uQ(h[h.length-1],d)),h.push(d||"/"),h),[]),i=new Set,r=u=>{let c=e.get(u);if(!c)throw new Error("function does not have any path reservations");return{paths:c.paths.map(h=>n.get(h)),dirs:[...c.dirs].map(h=>n.get(h))}},o=u=>{let{paths:c,dirs:h}=r(u);return c.every(d=>d[0]===u)&&h.every(d=>d[0]instanceof Set&&d[0].has(u))},s=u=>i.has(u)||!o(u)?!1:(i.add(u),u(()=>a(u)),!0),a=u=>{if(!i.has(u))return!1;let{paths:c,dirs:h}=e.get(u),d=new Set;return c.forEach(g=>{let f=n.get(g);lQ.equal(f[0],u),f.length===1?n.delete(g):(f.shift(),typeof f[0]=="function"?d.add(f[0]):f[0].forEach(m=>d.add(m)))}),h.forEach(g=>{let f=n.get(g);lQ(f[0]instanceof Set),f[0].size===1&&f.length===1?n.delete(g):f[0].size===1?(f.shift(),d.add(f[0])):f[0].delete(u)}),i.delete(u),d.forEach(g=>s(g)),!0};return{check:o,reserve:(u,c)=>{u=dwe?["win32 parallelization disabled"]:u.map(d=>cwe(uQ(uwe(d))).toLowerCase());let h=new Set(u.map(d=>t(d)).reduce((d,g)=>d.concat(g)));return e.set(c,{dirs:h,paths:u}),u.forEach(d=>{let g=n.get(d);g?g.push(c):n.set(d,[c])}),h.forEach(d=>{let g=n.get(d);g?g[g.length-1]instanceof Set?g[g.length-1].add(c):g.push(new Set([c])):n.set(d,[new Set([c])])}),s(c)}}}});var pQ=v((H4e,gQ)=>{var gwe=process.env.__FAKE_PLATFORM__||process.platform,pwe=gwe==="win32",fwe=global.__FAKE_TESTING_FS__||require("fs"),{O_CREAT:mwe,O_TRUNC:bwe,O_WRONLY:ywe,UV_FS_O_FILEMAP:dQ=0}=fwe.constants,vwe=pwe&&!!dQ,wwe=512*1024,xwe=dQ|bwe|mwe|ywe;gQ.exports=vwe?n=>n"w"});var II=v((B4e,_Q)=>{"use strict";var Cwe=require("assert"),Swe=BS(),kt=require("fs"),Dwe=sd(),ra=require("path"),TQ=sQ(),fQ=kL(),Twe=hQ(),kwe=PL(),no=$h(),Pwe=zh(),_we=SI(),mQ=Symbol("onEntry"),kI=Symbol("checkFs"),bQ=Symbol("checkFs2"),KS=Symbol("pruneCache"),PI=Symbol("isReusable"),ro=Symbol("makeFs"),_I=Symbol("file"),RI=Symbol("directory"),QS=Symbol("link"),yQ=Symbol("symlink"),vQ=Symbol("hardlink"),wQ=Symbol("unsupported"),xQ=Symbol("checkPath"),gl=Symbol("mkdir"),Mn=Symbol("onError"),GS=Symbol("pending"),CQ=Symbol("pend"),hd=Symbol("unpend"),DI=Symbol("ended"),TI=Symbol("maybeClose"),EI=Symbol("skip"),rm=Symbol("doChown"),om=Symbol("uid"),sm=Symbol("gid"),am=Symbol("checkedCwd"),kQ=require("crypto"),PQ=pQ(),Rwe=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,lm=Rwe==="win32",Ewe=1024,Lwe=(n,e)=>{if(!lm)return kt.unlink(n,e);let t=n+".DELETE."+kQ.randomBytes(16).toString("hex");kt.rename(n,t,i=>{if(i)return e(i);kt.unlink(t,e)})},Iwe=n=>{if(!lm)return kt.unlinkSync(n);let e=n+".DELETE."+kQ.randomBytes(16).toString("hex");kt.renameSync(n,e),kt.unlinkSync(e)},SQ=(n,e,t)=>n===n>>>0?n:e===e>>>0?e:t,DQ=n=>Pwe(no(_we(n))).toLowerCase(),Fwe=(n,e)=>{e=DQ(e);for(let t of n.keys()){let i=DQ(t);(i===e||i.indexOf(e+"/")===0)&&n.delete(t)}},Mwe=n=>{for(let e of n.keys())n.delete(e)},um=class extends Swe{constructor(e){if(e||(e={}),e.ondone=t=>{this[DI]=!0,this[TI]()},super(e),this[am]=!1,this.reservations=Twe(),this.transform=typeof e.transform=="function"?e.transform:null,this.writable=!0,this.readable=!1,this[GS]=0,this[DI]=!1,this.dirCache=e.dirCache||new Map,typeof e.uid=="number"||typeof e.gid=="number"){if(typeof e.uid!="number"||typeof e.gid!="number")throw new TypeError("cannot set owner without number uid and gid");if(e.preserveOwner)throw new TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=e.uid,this.gid=e.gid,this.setOwner=!0}else this.uid=null,this.gid=null,this.setOwner=!1;e.preserveOwner===void 0&&typeof e.uid!="number"?this.preserveOwner=process.getuid&&process.getuid()===0:this.preserveOwner=!!e.preserveOwner,this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():null,this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():null,this.maxDepth=typeof e.maxDepth=="number"?e.maxDepth:Ewe,this.forceChown=e.forceChown===!0,this.win32=!!e.win32||lm,this.newer=!!e.newer,this.keep=!!e.keep,this.noMtime=!!e.noMtime,this.preservePaths=!!e.preservePaths,this.unlink=!!e.unlink,this.cwd=no(ra.resolve(e.cwd||process.cwd())),this.strip=+e.strip||0,this.processUmask=e.noChmod?0:process.umask(),this.umask=typeof e.umask=="number"?e.umask:this.processUmask,this.dmode=e.dmode||511&~this.umask,this.fmode=e.fmode||438&~this.umask,this.on("entry",t=>this[mQ](t))}warn(e,t,i={}){return(e==="TAR_BAD_ARCHIVE"||e==="TAR_ABORT")&&(i.recoverable=!1),super.warn(e,t,i)}[TI](){this[DI]&&this[GS]===0&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"))}[xQ](e){let t=no(e.path),i=t.split("/");if(this.strip){if(i.length=this.strip)e.linkpath=r.slice(this.strip).join("/");else return!1}i.splice(0,this.strip),e.path=i.join("/")}if(isFinite(this.maxDepth)&&i.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:e,path:t,depth:i.length,maxDepth:this.maxDepth}),!1;if(!this.preservePaths){if(i.includes("..")||lm&&/^[a-z]:\.\.$/i.test(i[0]))return this.warn("TAR_ENTRY_ERROR","path contains '..'",{entry:e,path:t}),!1;let[r,o]=kwe(t);r&&(e.path=o,this.warn("TAR_ENTRY_INFO",`stripping ${r} from absolute path`,{entry:e,path:t}))}if(ra.isAbsolute(e.path)?e.absolute=no(ra.resolve(e.path)):e.absolute=no(ra.resolve(this.cwd,e.path)),!this.preservePaths&&e.absolute.indexOf(this.cwd+"/")!==0&&e.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:e,path:no(e.path),resolvedPath:e.absolute,cwd:this.cwd}),!1;if(e.absolute===this.cwd&&e.type!=="Directory"&&e.type!=="GNUDumpDir")return!1;if(this.win32){let{root:r}=ra.win32.parse(e.absolute);e.absolute=r+fQ.encode(e.absolute.slice(r.length));let{root:o}=ra.win32.parse(e.path);e.path=o+fQ.encode(e.path.slice(o.length))}return!0}[mQ](e){if(!this[xQ](e))return e.resume();switch(Cwe.equal(typeof e.absolute,"string"),e.type){case"Directory":case"GNUDumpDir":e.mode&&(e.mode=e.mode|448);case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[kI](e);case"CharacterDevice":case"BlockDevice":case"FIFO":default:return this[wQ](e)}}[Mn](e,t){e.name==="CwdError"?this.emit("error",e):(this.warn("TAR_ENTRY_ERROR",e,{entry:t}),this[hd](),t.resume())}[gl](e,t,i){TQ(no(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:t,noChmod:this.noChmod},i)}[rm](e){return this.forceChown||this.preserveOwner&&(typeof e.uid=="number"&&e.uid!==this.processUid||typeof e.gid=="number"&&e.gid!==this.processGid)||typeof this.uid=="number"&&this.uid!==this.processUid||typeof this.gid=="number"&&this.gid!==this.processGid}[om](e){return SQ(this.uid,e.uid,this.processUid)}[sm](e){return SQ(this.gid,e.gid,this.processGid)}[_I](e,t){let i=e.mode&4095||this.fmode,r=new Dwe.WriteStream(e.absolute,{flags:PQ(e.size),mode:i,autoClose:!1});r.on("error",l=>{r.fd&&kt.close(r.fd,()=>{}),r.write=()=>!0,this[Mn](l,e),t()});let o=1,s=l=>{if(l){r.fd&&kt.close(r.fd,()=>{}),this[Mn](l,e),t();return}--o===0&&kt.close(r.fd,u=>{u?this[Mn](u,e):this[hd](),t()})};r.on("finish",l=>{let u=e.absolute,c=r.fd;if(e.mtime&&!this.noMtime){o++;let h=e.atime||new Date,d=e.mtime;kt.futimes(c,h,d,g=>g?kt.utimes(u,h,d,f=>s(f&&g)):s())}if(this[rm](e)){o++;let h=this[om](e),d=this[sm](e);kt.fchown(c,h,d,g=>g?kt.chown(u,h,d,f=>s(f&&g)):s())}s()});let a=this.transform&&this.transform(e)||e;a!==e&&(a.on("error",l=>{this[Mn](l,e),t()}),e.pipe(a)),a.pipe(r)}[RI](e,t){let i=e.mode&4095||this.dmode;this[gl](e.absolute,i,r=>{if(r){this[Mn](r,e),t();return}let o=1,s=a=>{--o===0&&(t(),this[hd](),e.resume())};e.mtime&&!this.noMtime&&(o++,kt.utimes(e.absolute,e.atime||new Date,e.mtime,s)),this[rm](e)&&(o++,kt.chown(e.absolute,this[om](e),this[sm](e),s)),s()})}[wQ](e){e.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${e.type}`,{entry:e}),e.resume()}[yQ](e,t){this[QS](e,e.linkpath,"symlink",t)}[vQ](e,t){let i=no(ra.resolve(this.cwd,e.linkpath));this[QS](e,i,"link",t)}[CQ](){this[GS]++}[hd](){this[GS]--,this[TI]()}[EI](e){this[hd](),e.resume()}[PI](e,t){return e.type==="File"&&!this.unlink&&t.isFile()&&t.nlink<=1&&!lm}[kI](e){this[CQ]();let t=[e.path];e.linkpath&&t.push(e.linkpath),this.reservations.reserve(t,i=>this[bQ](e,i))}[KS](e){e.type==="SymbolicLink"?Mwe(this.dirCache):e.type!=="Directory"&&Fwe(this.dirCache,e.absolute)}[bQ](e,t){this[KS](e);let i=a=>{this[KS](e),t(a)},r=()=>{this[gl](this.cwd,this.dmode,a=>{if(a){this[Mn](a,e),i();return}this[am]=!0,o()})},o=()=>{if(e.absolute!==this.cwd){let a=no(ra.dirname(e.absolute));if(a!==this.cwd)return this[gl](a,this.dmode,l=>{if(l){this[Mn](l,e),i();return}s()})}s()},s=()=>{kt.lstat(e.absolute,(a,l)=>{if(l&&(this.keep||this.newer&&l.mtime>e.mtime)){this[EI](e),i();return}if(a||this[PI](e,l))return this[ro](null,e,i);if(l.isDirectory()){if(e.type==="Directory"){let u=!this.noChmod&&e.mode&&(l.mode&4095)!==e.mode,c=h=>this[ro](h,e,i);return u?kt.chmod(e.absolute,e.mode,c):c()}if(e.absolute!==this.cwd)return kt.rmdir(e.absolute,u=>this[ro](u,e,i))}if(e.absolute===this.cwd)return this[ro](null,e,i);Lwe(e.absolute,u=>this[ro](u,e,i))})};this[am]?o():r()}[ro](e,t,i){if(e){this[Mn](e,t),i();return}switch(t.type){case"File":case"OldFile":case"ContiguousFile":return this[_I](t,i);case"Link":return this[vQ](t,i);case"SymbolicLink":return this[yQ](t,i);case"Directory":case"GNUDumpDir":return this[RI](t,i)}}[QS](e,t,i,r){kt[i](t,e.absolute,o=>{o?this[Mn](o,e):(this[hd](),e.resume()),r()})}},zS=n=>{try{return[null,n()]}catch(e){return[e,null]}},LI=class extends um{[ro](e,t){return super[ro](e,t,()=>{})}[kI](e){if(this[KS](e),!this[am]){let o=this[gl](this.cwd,this.dmode);if(o)return this[Mn](o,e);this[am]=!0}if(e.absolute!==this.cwd){let o=no(ra.dirname(e.absolute));if(o!==this.cwd){let s=this[gl](o,this.dmode);if(s)return this[Mn](s,e)}}let[t,i]=zS(()=>kt.lstatSync(e.absolute));if(i&&(this.keep||this.newer&&i.mtime>e.mtime))return this[EI](e);if(t||this[PI](e,i))return this[ro](null,e);if(i.isDirectory()){if(e.type==="Directory"){let s=!this.noChmod&&e.mode&&(i.mode&4095)!==e.mode,[a]=s?zS(()=>{kt.chmodSync(e.absolute,e.mode)}):[];return this[ro](a,e)}let[o]=zS(()=>kt.rmdirSync(e.absolute));this[ro](o,e)}let[r]=e.absolute===this.cwd?[]:zS(()=>Iwe(e.absolute));this[ro](r,e)}[_I](e,t){let i=e.mode&4095||this.fmode,r=a=>{let l;try{kt.closeSync(o)}catch(u){l=u}(a||l)&&this[Mn](a||l,e),t()},o;try{o=kt.openSync(e.absolute,PQ(e.size),i)}catch(a){return r(a)}let s=this.transform&&this.transform(e)||e;s!==e&&(s.on("error",a=>this[Mn](a,e)),e.pipe(s)),s.on("data",a=>{try{kt.writeSync(o,a,0,a.length)}catch(l){r(l)}}),s.on("end",a=>{let l=null;if(e.mtime&&!this.noMtime){let u=e.atime||new Date,c=e.mtime;try{kt.futimesSync(o,u,c)}catch(h){try{kt.utimesSync(e.absolute,u,c)}catch{l=h}}}if(this[rm](e)){let u=this[om](e),c=this[sm](e);try{kt.fchownSync(o,u,c)}catch(h){try{kt.chownSync(e.absolute,u,c)}catch{l=l||h}}}r(l)})}[RI](e,t){let i=e.mode&4095||this.dmode,r=this[gl](e.absolute,i);if(r){this[Mn](r,e),t();return}if(e.mtime&&!this.noMtime)try{kt.utimesSync(e.absolute,e.atime||new Date,e.mtime)}catch{}if(this[rm](e))try{kt.chownSync(e.absolute,this[om](e),this[sm](e))}catch{}t(),e.resume()}[gl](e,t){try{return TQ.sync(no(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:t})}catch(i){return i}}[QS](e,t,i,r){try{kt[i+"Sync"](t,e.absolute),r(),e.resume()}catch(o){return this[Mn](o,e)}}};um.Sync=LI;_Q.exports=um});var FQ=v((W4e,IQ)=>{"use strict";var jwe=qh(),VS=II(),EQ=require("fs"),LQ=sd(),RQ=require("path"),FI=zh();IQ.exports=(n,e,t)=>{typeof n=="function"?(t=n,e=null,n={}):Array.isArray(n)&&(e=n,n={}),typeof e=="function"&&(t=e,e=null),e?e=Array.from(e):e=[];let i=jwe(n);if(i.sync&&typeof t=="function")throw new TypeError("callback not supported for sync tar functions");if(!i.file&&typeof t=="function")throw new TypeError("callback only supported with file option");return e.length&&Owe(i,e),i.file&&i.sync?Awe(i):i.file?Nwe(i,t):i.sync?Hwe(i):Bwe(i)};var Owe=(n,e)=>{let t=new Map(e.map(o=>[FI(o),!0])),i=n.filter,r=(o,s)=>{let a=s||RQ.parse(o).root||".",l=o===a?!1:t.has(o)?t.get(o):r(RQ.dirname(o),a);return t.set(o,l),l};n.filter=i?(o,s)=>i(o,s)&&r(FI(o)):o=>r(FI(o))},Awe=n=>{let e=new VS.Sync(n),t=n.file,i=EQ.statSync(t),r=n.maxReadSize||16*1024*1024;new LQ.ReadStreamSync(t,{readSize:r,size:i.size}).pipe(e)},Nwe=(n,e)=>{let t=new VS(n),i=n.maxReadSize||16*1024*1024,r=n.file,o=new Promise((s,a)=>{t.on("error",a),t.on("close",s),EQ.stat(r,(l,u)=>{if(l)a(l);else{let c=new LQ.ReadStream(r,{readSize:i,size:u.size});c.on("error",a),c.pipe(t)}})});return e?o.then(e,e):o},Hwe=n=>new VS.Sync(n),Bwe=n=>new VS(n)});var MQ=v(Yi=>{"use strict";Yi.c=Yi.create=f7();Yi.r=Yi.replace=pI();Yi.t=Yi.list=WS();Yi.u=Yi.update=D7();Yi.x=Yi.extract=FQ();Yi.Pack=xS();Yi.Unpack=II();Yi.Parse=BS();Yi.ReadEntry=rS();Yi.WriteEntry=AL();Yi.Header=Gh();Yi.Pax=sS();Yi.types=vL()});var NQ=v((Y4e,AQ)=>{AQ.exports=jn;function jn(n){if(!(this instanceof jn))return new jn(n);this.value=n}jn.prototype.get=function(n){for(var e=this.value,t=0;t{var Wwe=NQ(),qwe=require("events").EventEmitter;HQ.exports=dd;function dd(n){var e=dd.saw(n,{}),t=n.call(e.handlers,e);return t!==void 0&&(e.handlers=t),e.record(),e.chain()}dd.light=function(e){var t=dd.saw(e,{}),i=e.call(t.handlers,t);return i!==void 0&&(t.handlers=i),t.chain()};dd.saw=function(n,e){var t=new qwe;return t.handlers=e,t.actions=[],t.chain=function(){var i=Wwe(t.handlers).map(function(r){if(this.isRoot)return r;var o=this.path;typeof r=="function"&&this.update(function(){return t.actions.push({path:o,args:[].slice.call(arguments)}),i})});return process.nextTick(function(){t.emit("begin"),t.next()}),i},t.pop=function(){return t.actions.shift()},t.next=function(){var i=t.pop();if(!i)t.emit("end");else if(!i.trap){var r=t.handlers;i.path.forEach(function(o){r=r[o]}),r.apply(t.handlers,i.args)}},t.nest=function(i){var r=[].slice.call(arguments,1),o=!0;if(typeof i=="boolean"){var o=i;i=r.shift()}var s=dd.saw(n,{}),a=n.call(s.handlers,s);a!==void 0&&(s.handlers=a),typeof t.step<"u"&&s.record(),i.apply(s.chain(),r),o!==!1&&s.on("end",t.next)},t.record=function(){Ywe(t)},["trap","down","jump"].forEach(function(i){t[i]=function(){throw new Error("To use the trap, down and jump features, please call record() first to start recording actions.")}}),t};function Ywe(n){n.step=0,n.pop=function(){return n.actions[n.step++]},n.trap=function(e,t){var i=Array.isArray(e)?e:[e];n.actions.push({path:i,step:n.step,cb:t,trap:!0})},n.down=function(e){var t=(Array.isArray(e)?e:[e]).join("/"),i=n.actions.slice(n.step).map(function(o){return o.trap&&o.step<=n.step?!1:o.path.join("/")==t}).indexOf(!0);i>=0?n.step+=i:n.step=n.actions.length;var r=n.actions[n.step-1];r&&r.trap?(n.step=r.step,r.cb()):n.next()},n.jump=function(e){n.step=e,n.next()}}});var qQ=v((Z4e,WQ)=>{WQ.exports=Xn;function Xn(n){if(!(this instanceof Xn))return new Xn(n);this.buffers=n||[],this.length=this.buffers.reduce(function(e,t){return e+t.length},0)}Xn.prototype.push=function(){for(var n=0;n=0?n:this.length-n,r=[].slice.call(arguments,2);e===void 0?e=this.length-i:e>this.length-i&&(e=this.length-i);for(var n=0;n0){var u=i-a;if(u+e0){var g=r.slice();g.unshift(h),g.push(d),t.splice.apply(t,[l,1].concat(g)),l+=g.length,r=[]}else t.splice(l,1,h,d),l+=2}else o.push(t[l].slice(u)),t[l]=t[l].slice(0,u),l++}for(r.length>0&&(t.splice.apply(t,[l,0].concat(r)),l+=r.length);o.lengththis.length&&(e=this.length);for(var i=0,r=0;r=e-n?Math.min(u+(e-n)-s,l):l;t[a].copy(o,s,u,c),s+=c-u}return o};Xn.prototype.pos=function(n){if(n<0||n>=this.length)throw new Error("oob");for(var e=n,t=0,i=null;;){if(i=this.buffers[t],e=this.buffers[t].length;)if(i=0,t++,t>=this.buffers.length)return-1;var l=this.buffers[t][i];if(l==n[r]){if(r==0&&(o={i:t,j:i,pos:s}),r++,r==n.length)return o.pos}else r!=0&&(t=o.i,i=o.j,s=o.pos,r=0);i++,s++}};Xn.prototype.toBuffer=function(){return this.slice()};Xn.prototype.toString=function(n,e,t){return this.slice(e,t).toString(n)}});var UQ=v((J4e,YQ)=>{YQ.exports=function(n){function e(i,r){var o=t.store,s=i.split(".");s.slice(0,-1).forEach(function(l){o[l]===void 0&&(o[l]={}),o=o[l]});var a=s[s.length-1];return arguments.length==1?o[a]:o[a]=r}var t={get:function(i){return e(i)},set:function(i,r){return e(i,r)},store:n||{}};return t}});var zQ=v((Nu,GQ)=>{var Uwe=BQ(),ZQ=require("events").EventEmitter,Zwe=qQ(),e0=UQ(),Jwe=require("stream").Stream;Nu=GQ.exports=function(n,e){if(Buffer.isBuffer(n))return Nu.parse(n);var t=Nu.stream();return n&&n.pipe?n.pipe(t):n&&(n.on(e||"data",function(i){t.write(i)}),n.on("end",function(){t.end()})),t};Nu.stream=function(n){if(n)return Nu.apply(null,arguments);var e=null;function t(h,d,g){e={bytes:h,skip:g,cb:function(f){e=null,d(f)}},r()}var i=null;function r(){if(!e){c&&(u=!0);return}if(typeof e=="function")e();else{var h=i+e.bytes;if(a.length>=h){var d;i==null?(d=a.splice(0,h),e.skip||(d=d.slice())):(e.skip||(d=a.slice(i,h)),i=h),e.skip?e.cb():e.cb(d)}}}function o(h){function d(){u||h.next()}var g=XQ(function(f,m){return function(b){t(f,function(w){l.set(b,m(w)),d()})}});return g.tap=function(f){h.nest(f,l.store)},g.into=function(f,m){l.get(f)||l.set(f,{});var b=l;l=e0(b.get(f)),h.nest(function(){m.apply(this,arguments),this.tap(function(){l=b})},l.store)},g.flush=function(){l.store={},d()},g.loop=function(f){var m=!1;h.nest(!1,function b(){this.vars=l.store,f.call(this,function(){m=!0,d()},l.store),this.tap(function(){m?h.next():b.call(this)}.bind(this))},l.store)},g.buffer=function(f,m){typeof m=="string"&&(m=l.get(m)),t(m,function(b){l.set(f,b),d()})},g.skip=function(f){typeof f=="string"&&(f=l.get(f)),t(f,function(){d()})},g.scan=function(m,b){if(typeof b=="string")b=new Buffer(b);else if(!Buffer.isBuffer(b))throw new Error("search must be a Buffer or a string");var w=0;e=function(){var x=a.indexOf(b,i+w),D=x-i-w;x!==-1?(e=null,i!=null?(l.set(m,a.slice(i,i+w+D)),i+=w+D+b.length):(l.set(m,a.slice(0,w+D)),a.splice(0,w+D+b.length)),d(),r()):D=Math.max(a.length-b.length-i-w,0),w+=D},r()},g.peek=function(f){i=0,h.nest(function(){f.call(this,l.store),this.tap(function(){i=null})})},g}var s=Uwe.light(o);s.writable=!0;var a=Zwe();s.write=function(h){a.push(h),r()};var l=e0(),u=!1,c=!1;return s.end=function(){c=!0},s.pipe=Jwe.prototype.pipe,Object.getOwnPropertyNames(ZQ.prototype).forEach(function(h){s[h]=ZQ.prototype[h]}),s};Nu.parse=function(e){var t=XQ(function(o,s){return function(a){if(i+o<=e.length){var l=e.slice(i,i+o);i+=o,r.set(a,s(l))}else r.set(a,null);return t}}),i=0,r=e0();return t.vars=r.store,t.tap=function(o){return o.call(t,r.store),t},t.into=function(o,s){r.get(o)||r.set(o,{});var a=r;return r=e0(a.get(o)),s.call(t,r.store),r=a,t},t.loop=function(o){for(var s=!1,a=function(){s=!0};s===!1;)o.call(t,a,r.store);return t},t.buffer=function(o,s){typeof s=="string"&&(s=r.get(s));var a=e.slice(i,Math.min(e.length,i+s));return i+=s,r.set(o,a),t},t.skip=function(o){return typeof o=="string"&&(o=r.get(o)),i+=o,t},t.scan=function(o,s){if(typeof s=="string")s=new Buffer(s);else if(!Buffer.isBuffer(s))throw new Error("search must be a Buffer or a string");r.set(o,null);for(var a=0;a+i<=e.length-s.length+1;a++){for(var l=0;l=e.length},t};function JQ(n){for(var e=0,t=0;t{var KQ=require("stream").Transform,Gwe=require("util");function Hu(n,e){if(!(this instanceof Hu))return new Hu;KQ.call(this);var t=typeof n=="object"?n.pattern:n;this.pattern=Buffer.isBuffer(t)?t:Buffer.from(t),this.requiredLength=this.pattern.length,n.requiredExtraSize&&(this.requiredLength+=n.requiredExtraSize),this.data=new Buffer(""),this.bytesSoFar=0,this.matchFn=e}Gwe.inherits(Hu,KQ);Hu.prototype.checkDataChunk=function(n){var e=this.data.length>=this.requiredLength;if(e){var t=this.data.indexOf(this.pattern,n?1:0);if(t>=0&&t+this.requiredLength>this.data.length){if(t>0){var i=this.data.slice(0,t);this.push(i),this.bytesSoFar+=t,this.data=this.data.slice(t)}return}if(t===-1){var r=this.data.length-this.requiredLength+1,i=this.data.slice(0,r);this.push(i),this.bytesSoFar+=r,this.data=this.data.slice(r);return}if(t>0){var i=this.data.slice(0,t);this.data=this.data.slice(t),this.push(i),this.bytesSoFar+=t}var o=this.matchFn?this.matchFn(this.data,this.bytesSoFar):!0;if(o){this.data=new Buffer("");return}return!0}};Hu.prototype._transform=function(n,e,t){this.data=Buffer.concat([this.data,n]);for(var i=!0;this.checkDataChunk(!i);)i=!1;t()};Hu.prototype._flush=function(n){if(this.data.length>0)for(var e=!0;this.checkDataChunk(!e);)e=!1;this.data.length>0&&(this.push(this.data),this.data=null),n()};QQ.exports=Hu});var tV=v((X4e,eV)=>{"use strict";var MI=require("stream"),zwe=require("util").inherits;function cm(){if(!(this instanceof cm))return new cm;MI.PassThrough.call(this),this.path=null,this.type=null,this.isDirectory=!1}zwe(cm,MI.PassThrough);cm.prototype.autodrain=function(){return this.pipe(new MI.Transform({transform:function(n,e,t){t()}}))};eV.exports=cm});var OI=v((G4e,nV)=>{"use strict";var pl=zQ(),jI=require("stream"),Kwe=require("util"),Qwe=require("zlib"),Vwe=VQ(),iV=tV(),We={STREAM_START:0,START:1,LOCAL_FILE_HEADER:2,LOCAL_FILE_HEADER_SUFFIX:3,FILE_DATA:4,FILE_DATA_END:5,DATA_DESCRIPTOR:6,CENTRAL_DIRECTORY_FILE_HEADER:7,CENTRAL_DIRECTORY_FILE_HEADER_SUFFIX:8,CDIR64_END:9,CDIR64_END_DATA_SECTOR:10,CDIR64_LOCATOR:11,CENTRAL_DIRECTORY_END:12,CENTRAL_DIRECTORY_END_COMMENT:13,TRAILING_JUNK:14,ERROR:99},hm=4294967296,exe=67324752,txe=134695760,ixe=33639248,nxe=101075792,rxe=117853008,oxe=101010256;function vn(n){if(!(this instanceof vn))return new vn(n);jI.Transform.call(this),this.options=n||{},this.data=new Buffer(""),this.state=We.STREAM_START,this.skippedBytes=0,this.parsedEntity=null,this.outStreamInfo={}}Kwe.inherits(vn,jI.Transform);vn.prototype.processDataChunk=function(n){var e;switch(this.state){case We.STREAM_START:case We.START:e=4;break;case We.LOCAL_FILE_HEADER:e=26;break;case We.LOCAL_FILE_HEADER_SUFFIX:e=this.parsedEntity.fileNameLength+this.parsedEntity.extraFieldLength;break;case We.DATA_DESCRIPTOR:e=12;break;case We.CENTRAL_DIRECTORY_FILE_HEADER:e=42;break;case We.CENTRAL_DIRECTORY_FILE_HEADER_SUFFIX:e=this.parsedEntity.fileNameLength+this.parsedEntity.extraFieldLength+this.parsedEntity.fileCommentLength;break;case We.CDIR64_END:e=52;break;case We.CDIR64_END_DATA_SECTOR:e=this.parsedEntity.centralDirectoryRecordSize-44;break;case We.CDIR64_LOCATOR:e=16;break;case We.CENTRAL_DIRECTORY_END:e=18;break;case We.CENTRAL_DIRECTORY_END_COMMENT:e=this.parsedEntity.commentLength;break;case We.FILE_DATA:return 0;case We.FILE_DATA_END:return 0;case We.TRAILING_JUNK:return this.options.debug&&console.log("found",n.length,"bytes of TRAILING_JUNK"),n.length;default:return n.length}var t=n.length;if(t>>8,(o&255)===80){s=a;break}return this.skippedBytes+=s,this.options.debug&&console.log("Skipped",this.skippedBytes,"bytes"),s}this.state=We.ERROR;var l=r?"Not a valid zip file":"Invalid signature in zip file";if(this.options.debug){var u=n.readUInt32LE(0),c;try{c=n.slice(0,4).toString()}catch{}console.log("Unexpected signature in zip file: 0x"+u.toString(16),'"'+c+'", skipped',this.skippedBytes,"bytes")}return this.emit("error",new Error(l)),n.length}return this.skippedBytes=0,e;case We.LOCAL_FILE_HEADER:return this.parsedEntity=this._readFile(n),this.state=We.LOCAL_FILE_HEADER_SUFFIX,e;case We.LOCAL_FILE_HEADER_SUFFIX:var h=new iV,d=(this.parsedEntity.flags&2048)!==0;h.path=this._decodeString(n.slice(0,this.parsedEntity.fileNameLength),d);var f=n.slice(this.parsedEntity.fileNameLength,this.parsedEntity.fileNameLength+this.parsedEntity.extraFieldLength),m=this._readExtraFields(f);if(m&&m.parsed&&(m.parsed.path&&!d&&(h.path=m.parsed.path),Number.isFinite(m.parsed.uncompressedSize)&&this.parsedEntity.uncompressedSize===hm-1&&(this.parsedEntity.uncompressedSize=m.parsed.uncompressedSize),Number.isFinite(m.parsed.compressedSize)&&this.parsedEntity.compressedSize===hm-1&&(this.parsedEntity.compressedSize=m.parsed.compressedSize)),this.parsedEntity.extra=m.parsed||{},this.options.debug){let M=Object.assign({},this.parsedEntity,{path:h.path,flags:"0x"+this.parsedEntity.flags.toString(16),extraFields:m&&m.debug});console.log("decoded LOCAL_FILE_HEADER:",JSON.stringify(M,null,2))}return this._prepareOutStream(this.parsedEntity,h),this.emit("entry",h),this.state=We.FILE_DATA,e;case We.CENTRAL_DIRECTORY_FILE_HEADER:return this.parsedEntity=this._readCentralDirectoryEntry(n),this.state=We.CENTRAL_DIRECTORY_FILE_HEADER_SUFFIX,e;case We.CENTRAL_DIRECTORY_FILE_HEADER_SUFFIX:var d=(this.parsedEntity.flags&2048)!==0,g=this._decodeString(n.slice(0,this.parsedEntity.fileNameLength),d),f=n.slice(this.parsedEntity.fileNameLength,this.parsedEntity.fileNameLength+this.parsedEntity.extraFieldLength),m=this._readExtraFields(f);m&&m.parsed&&m.parsed.path&&!d&&(g=m.parsed.path),this.parsedEntity.extra=m.parsed;var b=(this.parsedEntity.versionMadeBy&65280)>>8===3,w,x;if(b){w=this.parsedEntity.externalFileAttributes>>>16;var D=w>>>12;x=(D&10)===10}if(this.options.debug){let M=Object.assign({},this.parsedEntity,{path:g,flags:"0x"+this.parsedEntity.flags.toString(16),unixAttrs:w&&"0"+w.toString(8),isSymlink:x,extraFields:m.debug});console.log("decoded CENTRAL_DIRECTORY_FILE_HEADER:",JSON.stringify(M,null,2))}return this.state=We.START,e;case We.CDIR64_END:return this.parsedEntity=this._readEndOfCentralDirectory64(n),this.options.debug&&console.log("decoded CDIR64_END_RECORD:",this.parsedEntity),this.state=We.CDIR64_END_DATA_SECTOR,e;case We.CDIR64_END_DATA_SECTOR:return this.state=We.START,e;case We.CDIR64_LOCATOR:return this.state=We.START,e;case We.CENTRAL_DIRECTORY_END:return this.parsedEntity=this._readEndOfCentralDirectory(n),this.options.debug&&console.log("decoded CENTRAL_DIRECTORY_END:",this.parsedEntity),this.state=We.CENTRAL_DIRECTORY_END_COMMENT,e;case We.CENTRAL_DIRECTORY_END_COMMENT:return this.options.debug&&console.log("decoded CENTRAL_DIRECTORY_END_COMMENT:",n.slice(0,e).toString()),this.state=We.TRAILING_JUNK,e;case We.ERROR:return n.length;default:return console.log("didn't handle state #",this.state,"discarding"),n.length}};vn.prototype._prepareOutStream=function(n,e){var t=this,i=n.uncompressedSize===0&&/[\/\\]$/.test(e.path);e.path=e.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/,""),e.type=i?"Directory":"File",e.isDirectory=i;var r=!(n.flags&8);r&&(e.size=n.uncompressedSize);var o=n.versionsNeededToExtract<=45;if(this.outStreamInfo={stream:null,limit:r?n.compressedSize:-1,written:0},r)this.outStreamInfo.stream=new jI.PassThrough;else{var s=new Buffer(4);s.writeUInt32LE(txe,0);var a=n.extra.zip64Mode,l=a?20:12,u={pattern:s,requiredExtraSize:l},c=new Vwe(u,function(m,b){var w=t._readDataDescriptor(m,a),x=w.compressedSize===b;if(!a&&!x&&b>=hm)for(var D=b-hm;D>=0&&(x=w.compressedSize===D,!x);)D-=hm;if(x){t.state=We.FILE_DATA_END;var M=a?24:16;return t.data.length>0?t.data=Buffer.concat([m.slice(M),t.data]):t.data=m.slice(M),!0}});this.outStreamInfo.stream=c}var h=n.flags&1||n.flags&64;if(h||!o){var d=h?"Encrypted files are not supported!":"Zip version "+Math.floor(n.versionsNeededToExtract/10)+"."+n.versionsNeededToExtract%10+" is not supported";e.skip=!0,setImmediate(()=>{e.emit("error",new Error(d))}),this.outStreamInfo.stream.pipe(new iV().autodrain());return}var g=n.compressionMethod>0;if(g){var f=Qwe.createInflateRaw();f.on("error",function(m){t.state=We.ERROR,t.emit("error",m)}),this.outStreamInfo.stream.pipe(f).pipe(e)}else this.outStreamInfo.stream.pipe(e);this._drainAllEntries&&e.autodrain()};vn.prototype._readFile=function(n){var e=pl.parse(n).word16lu("versionsNeededToExtract").word16lu("flags").word16lu("compressionMethod").word16lu("lastModifiedTime").word16lu("lastModifiedDate").word32lu("crc32").word32lu("compressedSize").word32lu("uncompressedSize").word16lu("fileNameLength").word16lu("extraFieldLength").vars;return e};vn.prototype._readExtraFields=function(n){var e={},t={parsed:e};this.options.debug&&(t.debug=[]);for(var i=0;i=x+4&&a&1&&(e.mtime=new Date(n.readUInt32LE(i+x)*1e3),x+=4),r.extraSize>=x+4&&a&2&&(e.atime=new Date(n.readUInt32LE(i+x)*1e3),x+=4),r.extraSize>=x+4&&a&4&&(e.ctime=new Date(n.readUInt32LE(i+x)*1e3));break;case 28789:o="Info-ZIP Unicode Path Extra Field";var l=n.readUInt8(i);if(l===1){var x=1,u=n.readUInt32LE(i+x);x+=4;var c=n.slice(i+x);e.path=c.toString()}break;case 13:case 22613:o=r.extraId===13?"PKWARE Unix":"Info-ZIP UNIX (type 1)";var x=0;if(r.extraSize>=8){var h=new Date(n.readUInt32LE(i+x)*1e3);x+=4;var d=new Date(n.readUInt32LE(i+x)*1e3);if(x+=4,e.atime=h,e.mtime=d,r.extraSize>=12){var g=n.readUInt16LE(i+x);x+=2;var f=n.readUInt16LE(i+x);x+=2,e.uid=g,e.gid=f}}break;case 30805:o="Info-ZIP UNIX (type 2)";var x=0;if(r.extraSize>=4){var g=n.readUInt16LE(i+x);x+=2;var f=n.readUInt16LE(i+x);x+=2,e.uid=g,e.gid=f}break;case 30837:o="Info-ZIP New Unix";var x=0,m=n.readUInt8(i);if(x+=1,m===1){var b=n.readUInt8(i+x);x+=1,b<=6&&(e.uid=n.readUIntLE(i+x,b)),x+=b;var w=n.readUInt8(i+x);x+=1,w<=6&&(e.gid=n.readUIntLE(i+x,w))}break;case 30062:o="ASi Unix";var x=0;if(r.extraSize>=14){var D=n.readUInt32LE(i+x);x+=4;var M=n.readUInt16LE(i+x);x+=2;var L=n.readUInt32LE(i+x);x+=4;var g=n.readUInt16LE(i+x);x+=2;var f=n.readUInt16LE(i+x);if(x+=2,e.mode=M,e.uid=g,e.gid=f,r.extraSize>14){var W=i+x,N=i+r.extraSize-14,V=this._decodeString(n.slice(W,N));e.symlink=V}}break}this.options.debug&&t.debug.push({extraId:"0x"+r.extraId.toString(16),description:o,data:n.slice(i,i+r.extraSize).inspect()}),i+=r.extraSize}return t};vn.prototype._readDataDescriptor=function(n,e){if(e){var t=pl.parse(n).word32lu("dataDescriptorSignature").word32lu("crc32").word64lu("compressedSize").word64lu("uncompressedSize").vars;return t}var t=pl.parse(n).word32lu("dataDescriptorSignature").word32lu("crc32").word32lu("compressedSize").word32lu("uncompressedSize").vars;return t};vn.prototype._readCentralDirectoryEntry=function(n){var e=pl.parse(n).word16lu("versionMadeBy").word16lu("versionsNeededToExtract").word16lu("flags").word16lu("compressionMethod").word16lu("lastModifiedTime").word16lu("lastModifiedDate").word32lu("crc32").word32lu("compressedSize").word32lu("uncompressedSize").word16lu("fileNameLength").word16lu("extraFieldLength").word16lu("fileCommentLength").word16lu("diskNumber").word16lu("internalFileAttributes").word32lu("externalFileAttributes").word32lu("offsetToLocalFileHeader").vars;return e};vn.prototype._readEndOfCentralDirectory64=function(n){var e=pl.parse(n).word64lu("centralDirectoryRecordSize").word16lu("versionMadeBy").word16lu("versionsNeededToExtract").word32lu("diskNumber").word32lu("diskNumberWithCentralDirectoryStart").word64lu("centralDirectoryEntries").word64lu("totalCentralDirectoryEntries").word64lu("sizeOfCentralDirectory").word64lu("offsetToStartOfCentralDirectory").vars;return e};vn.prototype._readEndOfCentralDirectory=function(n){var e=pl.parse(n).word16lu("diskNumber").word16lu("diskStart").word16lu("centralDirectoryEntries").word16lu("totalCentralDirectoryEntries").word32lu("sizeOfCentralDirectory").word32lu("offsetToStartOfCentralDirectory").word16lu("commentLength").vars;return e};var sxe="\0\u263A\u263B\u2665\u2666\u2663\u2660\u2022\u25D8\u25CB\u25D9\u2642\u2640\u266A\u266B\u263C\u25BA\u25C4\u2195\u203C\xB6\xA7\u25AC\u21A8\u2191\u2193\u2192\u2190\u221F\u2194\u25B2\u25BC !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u2302\xC7\xFC\xE9\xE2\xE4\xE0\xE5\xE7\xEA\xEB\xE8\xEF\xEE\xEC\xC4\xC5\xC9\xE6\xC6\xF4\xF6\xF2\xFB\xF9\xFF\xD6\xDC\xA2\xA3\xA5\u20A7\u0192\xE1\xED\xF3\xFA\xF1\xD1\xAA\xBA\xBF\u2310\xAC\xBD\xBC\xA1\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\xDF\u0393\u03C0\u03A3\u03C3\xB5\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229\u2261\xB1\u2265\u2264\u2320\u2321\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0 ";vn.prototype._decodeString=function(n,e){if(e)return n.toString("utf8");if(this.options.decodeString)return this.options.decodeString(n);let t="";for(var i=0;i0&&(this.data=this.data.slice(t),this.data.length!==0););if(this.state===We.FILE_DATA){if(this.outStreamInfo.limit>=0){var i=this.outStreamInfo.limit-this.outStreamInfo.written,r;i{if(this.state===We.FILE_DATA_END)return this.state=We.START,o.end(e);e()})}return}e()};vn.prototype.drainAll=function(){this._drainAllEntries=!0};vn.prototype._transform=function(n,e,t){var i=this;i.data.length>0?i.data=Buffer.concat([i.data,n]):i.data=n;var r=i.data.length,o=function(){if(i.data.length>0&&i.data.length0){e._parseOrOutput("buffer",function(){if(e.data.length>0)return setImmediate(function(){e._flush(n)});n()});return}if(e.state===We.FILE_DATA)return n(new Error("Stream finished in an invalid state, uncompression failed"));setImmediate(n)};nV.exports=vn});var oV=v((z4e,rV)=>{var dm=require("stream").Transform,axe=require("util"),lxe=OI();function fl(n){if(!(this instanceof fl))return new fl(n);var e=n||{};dm.call(this,{readableObjectMode:!0}),this.opts=n||{},this.unzipStream=new lxe(this.opts);var t=this;this.unzipStream.on("entry",function(i){t.push(i)}),this.unzipStream.on("error",function(i){t.emit("error",i)})}axe.inherits(fl,dm);fl.prototype._transform=function(n,e,t){this.unzipStream.write(n,e,t)};fl.prototype._flush=function(n){var e=this;this.unzipStream.end(function(){process.nextTick(function(){e.emit("close")}),n()})};fl.prototype.on=function(n,e){return n==="entry"?dm.prototype.on.call(this,"data",e):dm.prototype.on.call(this,n,e)};fl.prototype.drainAll=function(){return this.unzipStream.drainAll(),this.pipe(new dm({objectMode:!0,transform:function(n,e,t){t()}}))};rV.exports=fl});var uV=v((K4e,lV)=>{var gm=require("path"),sV=require("fs"),aV=parseInt("0777",8);lV.exports=gd.mkdirp=gd.mkdirP=gd;function gd(n,e,t,i){typeof e=="function"?(t=e,e={}):(!e||typeof e!="object")&&(e={mode:e});var r=e.mode,o=e.fs||sV;r===void 0&&(r=aV),i||(i=null);var s=t||function(){};n=gm.resolve(n),o.mkdir(n,r,function(a){if(!a)return i=i||n,s(null,i);switch(a.code){case"ENOENT":if(gm.dirname(n)===n)return s(a);gd(gm.dirname(n),e,function(l,u){l?s(l,u):gd(n,e,s,u)});break;default:o.stat(n,function(l,u){l||!u.isDirectory()?s(a,i):s(null,i)});break}})}gd.sync=function n(e,t,i){(!t||typeof t!="object")&&(t={mode:t});var r=t.mode,o=t.fs||sV;r===void 0&&(r=aV),i||(i=null),e=gm.resolve(e);try{o.mkdirSync(e,r),i=i||e}catch(a){switch(a.code){case"ENOENT":i=n(gm.dirname(e),t,i),n(e,t,i);break;default:var s;try{s=o.statSync(e)}catch{throw a}if(!s.isDirectory())throw a;break}}return i}});var gV=v((Q4e,dV)=>{var uxe=require("fs"),cV=require("path"),cxe=require("util"),hxe=uV(),hV=require("stream").Transform,dxe=OI();function ml(n){if(!(this instanceof ml))return new ml(n);hV.call(this),this.opts=n||{},this.unzipStream=new dxe(this.opts),this.unfinishedEntries=0,this.afterFlushWait=!1,this.createdDirectories={};var e=this;this.unzipStream.on("entry",this._processEntry.bind(this)),this.unzipStream.on("error",function(t){e.emit("error",t)})}cxe.inherits(ml,hV);ml.prototype._transform=function(n,e,t){this.unzipStream.write(n,e,t)};ml.prototype._flush=function(n){var e=this,t=function(){process.nextTick(function(){e.emit("close")}),n()};this.unzipStream.end(function(){if(e.unfinishedEntries>0)return e.afterFlushWait=!0,e.on("await-finished",t);t()})};ml.prototype._processEntry=function(n){var e=this,t=cV.join(this.opts.path,n.path),i=n.isDirectory?t:cV.dirname(t);this.unfinishedEntries++;var r=function(){var o=uxe.createWriteStream(t);o.on("close",function(){e.unfinishedEntries--,e._notifyAwaiter()}),o.on("error",function(s){e.emit("error",s)}),n.pipe(o)};if(this.createdDirectories[i]||i===".")return r();hxe(i,function(o){if(o)return e.emit("error",o);if(e.createdDirectories[i]=!0,n.isDirectory){e.unfinishedEntries--,e._notifyAwaiter();return}r()})};ml.prototype._notifyAwaiter=function(){this.afterFlushWait&&this.unfinishedEntries===0&&(this.emit("await-finished"),this.afterFlushWait=!1)};dV.exports=ml});var pV=v(AI=>{"use strict";AI.Parse=oV();AI.Extract=gV()});function gxe(n){let e=n.etag;if(typeof e=="string"&&(e=e.replace(/^W\//,""),!(!e.startsWith('"')||!e.endsWith('"'))))return e.slice(1,-1)}function pxe(n){let i=Cz().parse(n).parameters.filename;if(i)return E.extname(i)}function pm(n,e,t){let i=A1(n),{etagAlgorithm:r}=e,{dest:o,onProgress:s,extract:a}=e;if(!o||!E.isAbsolute(o))throw new Error(`Invalid dest path: ${o}`);if(!B.existsSync(o))B.mkdirSync(o,{recursive:!0});else{let h=B.statSync(o);if(h&&!h.isDirectory())throw new Error(`${o} exists, but not directory!`)}let l=O1(i),u=H1(i,e);!u.agent&&e.agent&&(u.agent=e.agent);let c=E.extname(i.pathname);return new Promise((h,d)=>{if(t){let m=t.onCancellationRequested(()=>{m.dispose(),f.destroy(new Error("request aborted"))})}let g,f=l.request(u,m=>{if(m.statusCode>=200&&m.statusCode<300||m.statusCode===1223){let b=m.headers,w=b["content-disposition"],x=gxe(b),D=x&&typeof r=="string";if(!c&&w&&(c=pxe(w)),a===!0)if(c===".zip"||b["content-type"]=="application/zip")a="unzip";else if(c==".tgz")a="untar";else{d(new Error(`Unable to detect extract method for ${i}`));return}let M=Number(b["content-length"]),L=!isNaN(M),W=0;m.on("error",he=>{d(new Error(`Unable to connect ${i}: ${he.message}`))});let N=D?Uy.createHash(r):void 0;m.on("data",he=>{if(W+=he.length,N&&N.update(he),L){let re=(W/M*100).toFixed(1);typeof s=="function"?s(re):NI.info(`Download ${i} progress ${re}%`)}}),m.on("end",()=>{clearTimeout(g),g=void 0,NI.info("Download completed:",i)});let V;if(a==="untar"){let he=MQ();V=m.pipe(he.x({strip:e.strip??1,C:o}))}else if(a==="unzip"){let he=pV();V=m.pipe(he.Extract({path:o}))}else o=E.join(o,`${mu()}${c}`),V=m.pipe(B.createWriteStream(o));V.on("finish",()=>{if(N&&N.digest("hex")!==x){d(new Error(`Etag check failed by ${r}, content not match.`));return}NI.info(`Downloaded ${i} => ${o}`),setTimeout(()=>{h(o)},100)}),V.on("error",d)}else d(new Error(`Invalid response from ${i}: ${m.statusCode}`))});f.on("error",m=>{if(u.agent&&m.code=="ECONNRESET")g=setTimeout(()=>{d(m)},j1);else{if(clearTimeout(g),u.agent&&u.agent.proxy){d(new Error(`Request failed using proxy ${u.agent.proxy.host}: ${m.message}`));return}d(m)}}),f.on("timeout",()=>{f.destroy(new Error(`request timeout after ${e.timeout}ms`))}),typeof e.timeout=="number"&&e.timeout&&f.setTimeout(e.timeout),f.end()})}var NI,HI=k(()=>{"use strict";gt();Ee();fe();WC();NI=te("model-download")});function mxe(n=Bt.homedir()){let e,t=E.join(n,".npmrc");if(B.existsSync(t))try{let i=B.readFileSync(t,"utf8"),r;for(let o of i.split(/\r?\n/)){if(o.startsWith("#"))continue;let s=o.match(/^(.*?)=(.*)$/);s&&s[1]==="coc.nvim:registry"&&(r=s[2])}r&&(e=new t0.URL(r))}catch(i){bV.debug("Error on parse .npmrc:",i)}return e??new t0.URL("https://registry.npmjs.org")}function bxe(n){let e=E.basename(n);return e==="npm"||e==="npm.CMD"}function yxe(n){let e=E.basename(n);return["yarn","yarn.CMD","yarnpkg","yarnpkg.CMD"].includes(e)}function vxe(n){let e=E.basename(n);return e==="pnpm"||e==="pnpm.CMD"}function fV(n){return!!(B.existsSync(n)&&B.lstatSync(n).isSymbolicLink())}function wxe(n){return Object.keys(n.dependencies??{}).filter(e=>!fxe.includes(e))}var mV,t0,bV,fxe,i0,yV=k(()=>{"use strict";mV=require("events"),t0=require("url");gt();Ee();HI();WC();pt();fe();Ce();be();bV=te("extension-installer"),fxe=["coc.nvim","esbuild","webpack","@types/node"];i0=class extends mV.EventEmitter{constructor(t,i,r){super();this.root=t;this.npm=i;this.def=r;if(/^https?:/.test(r))this.url=r;else{let o=r.match(/(.+)@([^/]+)$/);o?(this.name=o[1],this.version=o[2]):this.name=r}}get info(){return{name:this.name,version:this.version}}async getInfo(){if(this.url)return await this.getInfoFromUri();let t=mxe();this.log(`Get info from ${t}`);let i=await this.fetch(new t0.URL(this.name,t),{timeout:1e4,buffer:!0}),r=JSON.parse(i.toString());this.version||(this.version=r["dist-tags"].latest);let o=r.versions[this.version];if(!o)throw new Error(`${this.def} doesn't exists in ${t}.`);let s=o.engines&&o.engines.coc;if(!s)throw new Error(`${this.def} is not a valid coc extension, "engines" field with coc property required.`);return{"dist.tarball":o.dist.tarball,"engines.coc":s,version:o.version,name:r.name}}async getInfoFromUri(){let{url:t}=this;if(!t.startsWith("https://github.com"))throw new Error(`"${t}" is not supported, coc.nvim support github.com only`);t=t.replace(/\/$/,"");let i="master";if(t.includes("@")){let a=t.indexOf("@");i=t.substr(a+1),t=t.substring(0,a)}let r=t.replace("github.com","raw.githubusercontent.com")+`/${i}/package.json`;this.log(`Get info from ${r}`);let o=await this.fetch(r,{timeout:1e4}),s=typeof o=="string"?JSON.parse(o):o;return this.name=s.name,{"dist.tarball":`${t}/archive/${i}.tar.gz`,"engines.coc":s.engines?s.engines.coc:null,name:s.name,version:s.version}}log(t,i=!1){this.emit("message",t,i)}async install(){this.log(`Using npm from: ${this.npm}`);let t=await this.getInfo();bV.info(`Fetched info of ${this.def}`,t);let{name:i,version:r}=t,o=de(t["engines.coc"]).replace(/^\^/,">=");if(o&&!Mr.satisfies(y.version,o))throw new Error(`${i} ${t.version} requires coc.nvim >= ${o}, please update coc.nvim.`);let s=await this.doInstall(t);return{name:i,updated:s,version:r,url:this.url,folder:E.join(this.root,t.name)}}async update(t){t&&(this.url=t);let i;if(this.name){let l=E.join(this.root,this.name);if(fV(l)){this.log("Skipped update for symbol link");return}i=So(E.join(l,"package.json")).version}this.log(`Using npm from: ${this.npm}`);let r=await this.getInfo();if(i&&r.version&&Mr.gte(i,r.version)){this.log(`Current version ${i} is up to date.`);return}let o=r["engines.coc"]?r["engines.coc"].replace(/^\^/,">="):"";if(o&&!Mr.satisfies(y.version,o))throw new Error(`${r.version} requires coc.nvim ${o}, please update coc.nvim.`);if(!await this.doInstall(r))return;let a=E.join(this.root,r.name,"package.json");return this.log(`Updated to v${r.version}`),E.dirname(a)}getInstallArguments(t,i){let r=["install","--ignore-scripts","--no-lockfile"];return i&&i.startsWith("https://github.com")&&(r=["install"]),bxe(t)&&(r.push("--omit=dev"),r.push("--legacy-peer-deps"),r.push("--no-global")),yxe(t)&&(r.push("--production"),r.push("--ignore-engines")),vxe(t)&&(r.push("--production"),r.push("--config.strict-peer-dependencies=false")),r}readLines(t,i){Bo.createInterface({input:i}).on("line",o=>{this.log(`${t} ${o}`,!0)})}installDependencies(t,i){return i.length==0?Promise.resolve():new Promise((r,o)=>{let s=this.getInstallArguments(this.npm,this.url);this.log(`Installing dependencies by: ${this.npm} ${s.join(" ")}.`);let a=qn.spawn(this.npm,s,{cwd:t,shell:process.platform==="win32",env:Object.assign(process.env,{NODE_ENV:"production"})});this.readLines("[npm stdout]",a.stdout),this.readLines("[npm stderr]",a.stderr),a.stderr.setEncoding("utf8"),a.stdout.setEncoding("utf8"),a.on("error",o),a.on("exit",l=>{if(l){o(new Error(`${this.npm} install exited with ${l}`));return}r()})})}async doInstall(t){let i=E.join(this.root,t.name);if(fV(i))return!1;let r=t.name.replace(/\//g,"_"),o=E.join(this.root,`${r}-${Te()}`),s=t["dist.tarball"];this.log(`Downloading from ${s}`);let a=s.startsWith("https://registry.npmjs.org")?"md5":void 0;try{await this.download(s,{dest:o,etagAlgorithm:a,extract:"untar",onProgress:u=>this.log(`Download progress ${u}%`,!0)}),this.log(`Extension download at ${o}`);let l=So(E.join(o,"package.json"));await this.installDependencies(o,wxe(l))}catch(l){throw B.rmSync(o,{recursive:!0,force:!0}),l}return this.log(`Download extension ${t.name}@${t.version} at ${o}`),B.mkdirSync(E.dirname(i),{recursive:!0}),B.existsSync(i)&&B.rmSync(i,{force:!0,recursive:!0}),B.renameSync(o,i),this.log(`Move extension ${t.name}@${t.version} to ${i}`),!0}async download(t,i){return await pm(t,i)}async fetch(t,i={}){return await Bf(t,i)}}});var fm,vV=k(()=>{"use strict";pt();fe();Ye();fm=class{constructor(e){this.filepath=e;B.existsSync(e)||B.writeFileSync(e,"{}","utf8")}merge(e){if(!B.existsSync(e))return;let t=So(e),i=So(this.filepath);Object.assign(i,t),Ea(this.filepath,i),B.unlinkSync(e)}fetchContent(e,t){let r=So(this.filepath)[e];if(r)return r[t]}async update(e,t,i){let{filepath:r}=this,o=So(r);o[e]=o[e]||{},i!==void 0?o[e][t]=Ki(i):delete o[e][t],Ea(r,o)}createMemento(e){return{get:(t,i)=>{let r=this.fetchContent(e,t);return r===void 0?i:r},update:async(t,i)=>{await this.update(e,t,i)}}}}});var wV,xxe,Cxe,mm,xV=k(()=>{"use strict";wV=require("events");Ee();se();fe();be();xxe=qn.spawn,Cxe=te("list-commandTask"),mm=class extends wV.EventEmitter{constructor(t){super();this.opt=t;this.disposables=[];this.start()}start(){let{cmd:t,args:i,cwd:r,onLine:o}=this.opt,s=xxe(t,i,{cwd:r||y.cwd,windowsHide:!0,shell:process.platform==="win32"});this.disposables.push({dispose:()=>{s.kill()}}),s.on("error",l=>{this.emit("error",l.message)}),s.stderr.on("data",l=>{Cxe.error(`[${t} Error]`,l.toString("utf8"))});let a=Bo.createInterface(s.stdout);a.on("line",l=>{let u=o(l);u&&this.emit("data",u)}),a.on("close",()=>{this.emit("end")})}dispose(){z(this.disposables)}}});var Bu,BI,bt,bl=k(()=>{"use strict";Ze();be();Bu=["","","","","","","","","","","","","","","","","","","","<2-LeftMouse>","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""],BI=class{get debounceTime(){return this.get("interactiveDebounceTime",100)}get extendedSearchMode(){return this.get("extendedSearchMode",!0)}get smartcase(){return this.get("smartCase",!1)}get signOffset(){return this.get("signOffset",900)}get(e,t){return y.initialConfiguration.get("list."+e,t)}get previousKey(){return this.fixKey(this.get("previousKeymap",""))}get nextKey(){return this.fixKey(this.get("nextKeymap",""))}fixKey(e){if(Bu.includes(e))return e;let t=Bu.find(i=>i.toLowerCase()==e.toLowerCase());return t||(R.showErrorMessage(`Configured key "${e}" not supported.`),null)}},bt=new BI});function Sxe(n){switch(n){case"latex":return"tex";default:return n}}var Li,us=k(()=>{"use strict";ye();$e();se();pt();Nt();Ce();be();xV();bl();Li=class{constructor(){this.defaultAction="open";this.actions=[];this.options=[];this.disposables=[];this.nvim=y.nvim,this.config=bt}get alignColumns(){return bt.get("alignColumns",!1)}get floatPreview(){return bt.get("floatPreview",!1)}get hlGroup(){return bt.get("previewHighlightGroup","Search")}get previewHeight(){return bt.get("maxPreviewHeight",12)}get splitRight(){return bt.get("previewSplitRight",!1)}get toplineStyle(){return bt.get("previewToplineStyle","offset")}get toplineOffset(){return bt.get("previewToplineOffset",3)}parseArguments(e){if(!this.optionMap){this.optionMap=new Map;for(let i of this.options){let r=i.name.split(/,\s*/g).map(s=>s.replace(/\s+.*/g,"")),o=i.key?i.key:r[r.length-1].replace(/^-/,"");for(let s of r)this.optionMap.set(s,{name:o,hasValue:i.hasValue})}}let t={};for(let i=0;i{let r=await this.convertLocation(t.location);await this.previewLocation(r,i)}});let{nvim:e}=this;this.createAction({name:"quickfix",multiple:!0,execute:async t=>{let i=await Promise.all(t.map(o=>this.convertLocation(o.location).then(s=>y.getQuickfixItem(s))));await e.call("setqflist",[i]);let r=await e.getVar("coc_quickfix_open_command");e.command(typeof r=="string"?r:"copen",!0)}});for(let t of["open","tabe","drop","vsplit","split"])this.createAction({name:t,execute:async(i,r)=>{await this.jumpTo(i.location,t=="open"?null:t,r)},tabPersist:t==="open"})}async convertLocation(e){if(typeof e=="string")return Xe.create(e,q.create(0,0,0,0));if(Xe.is(e))return e;let t=Y.parse(e.uri);return t.scheme!="file"?Xe.create(e.uri,q.create(0,0,0,0)):await aJ(t.fsPath,e.line,e.text)}async jumpTo(e,t,i){if(t==null&&i&&i.options.position==="tab"&&(t="tabe"),typeof e=="string"){await y.jumpTo(e,null,t);return}let{range:r,uri:o}=await this.convertLocation(e),s=r.start;s.line==0&&s.character==0&&it(s,r.end)==0&&(s=null),await y.jumpTo(o,s,t)}createAction(e){let{name:t}=e,i=this.actions.findIndex(r=>r.name==t);i!==-1&&this.actions.splice(i,1),this.actions.push(e)}async previewLocation(e,t){let{uri:i,range:r}=e,o=y.getDocument(e.uri),s=Y.parse(i),a=await y.documentsManager.getLines(i),l={bufnr:o?o.bufnr:void 0,winid:t.window.id,range:Qt(r)?null:r,lnum:r.start.line+1,name:s.scheme=="file"?s.fsPath:i,filetype:Sxe(o?o.languageId:y.documentsManager.getLanguageId(s.fsPath)),position:t.options.position,maxHeight:this.previewHeight,splitRight:this.splitRight,hlGroup:this.hlGroup,scheme:s.scheme,toplineStyle:this.toplineStyle,toplineOffset:this.toplineOffset,targetRange:e.targetRange};await this.openPreview(a,l)}async preview(e,t){let{bufname:i,filetype:r,range:o,lines:s,lnum:a}=e,l={winid:t.window.id,lnum:o?o.start.line+1:a||1,filetype:r,position:t.options.position,maxHeight:this.previewHeight,splitRight:this.splitRight,hlGroup:this.hlGroup,toplineStyle:this.toplineStyle,toplineOffset:this.toplineOffset};i&&(l.name=i),o&&(l.range=o),await this.openPreview(s,l)}async openPreview(e,t){let{nvim:i}=this;this.floatPreview&&t.position!=="tab"?await i.call("coc#list#float_preview",[e,t]):await i.call("coc#list#preview",[e,t]),i.command("redraw",!0)}doHighlight(){}dispose(){z(this.disposables)}}});function pd(n){let e=n.length,t=new Uint16Array(e);for(let i=0,r=e;i=97&&n<=122&&e+32===n||t&&(n<=90&&n+32===e||WI(n)===e))return!0}else{let i=WI(e);if(i===n||t&&WI(n)===i)return!0}return!1}function WI(n){return String.fromCharCode(n).toLowerCase().charCodeAt(0)}function fd(n,e,t=!1){let i=n.length,r=e.length;if(i>r)return!1;let o=0,s=n[0];for(let a=0;a{"use strict";oi()});var Dxe,YI,bm,UI,ZI=k(()=>{"use strict";fe();Ee();Ce();oi();Dxe=te("list-db"),YI=E.join(Cr,"list_history.dat"),bm=class{constructor(){this.folders=[];this.names=[];this.items=[];this._changed=!1;try{this.load()}catch(e){Dxe.error("Error on load db",e)}}get currItems(){return this.items}getHistory(e,t){let i=this.names.indexOf(e),r=this.folders.indexOf(t);return i==-1||r==-1?[]:this.items.reduce((o,s)=>(s[1]==i&&s[2]==r&&o.push(s[0]),o),[])}addItem(e,t,i){let{folders:r,names:o}=this;me(t)>255&&(t=hi(t,0,255)),r.includes(i)||r.push(i),o.includes(e)||o.push(e);let s=o.indexOf(e),a=r.indexOf(i),l=this.items.findIndex(u=>u[0]==t&&u[1]==s&&u[2]==a);l!=-1&&this.items.splice(l,1),this.items.push([t,s,a]),this._changed=!0}save(){let{folders:e,items:t,names:i}=this;if(!this._changed)return;let r=e.reduce((u,c)=>(u.push(Buffer.from(c,"utf8"),Buffer.alloc(1)),u),[]),o=Buffer.concat(r);r=i.reduce((u,c)=>(u.push(Buffer.from(c,"utf8"),Buffer.alloc(1)),u),[]);let s=Buffer.concat(r),a=Buffer.allocUnsafe(9);a.writeUInt8(2,0),a.writeUInt32BE(o.byteLength,1),a.writeUInt32BE(s.byteLength,5),r=t.reduce((u,c)=>{let h=Buffer.from(c[0],"utf8");return u.push(Buffer.from([h.byteLength]),h,Buffer.from([c[1],c[2]])),u},[]);let l=Buffer.concat([a,o,s,...r]);B.writeFileSync(YI,l),this._changed=!1}load(){if(!B.existsSync(YI))return;let e=B.readFileSync(YI),t=e.readUInt32BE(1),i=e.readUInt32BE(5),r=e.slice(9,9+t),o=0,s=[],a=[];for(let d=0;d{"use strict";fe();Ee();Le();n0();ZI();Ce();Txe=te("list-history"),Wu=class{constructor(e,t,i,r){this.prompt=e;this.name=t;this.db=i;this.cwd=r;this._index=-1;this._filtered=[]}get loaded(){return this.db.getHistory(this.name,this.cwd)}get filtered(){return this._filtered}get index(){return this._index}static migrate(e){try{let t=B.readdirSync(e);if(t=t.filter(r=>r.startsWith("list-")&&r.endsWith("-history.json")&&B.statSync(E.join(e,r)).isFile()),t.length===0)return;let i=new bm;for(let r of t){let o=r.match(/^list-(.*)-history.json$/)[1],s=B.readFileSync(E.join(e,r),"utf8"),a=JSON.parse(s);for(let[l,u]of Object.entries(a)){let c=Buffer.from(l,"base64").toString("utf8");Array.isArray(u)&&u.forEach(h=>{i.addItem(o,h,c)})}}t.forEach(r=>{B.unlinkSync(E.join(e,r))}),i.save()}catch(t){Txe.error("Error on migrate history:",t)}}get curr(){return this._index==-1||this._filtered==null?null:this._filtered[this._index]}filter(){let{input:e}=this.prompt;if(e!==this.curr){if(this.historyInput="",e.length>0){let t=pd(e);this._filtered=this.loaded.filter(i=>fd(t,i))}else this._filtered=this.loaded;this._index=-1}}add(){let{db:e,prompt:t,cwd:i}=this,{input:r}=t;!r||r.length<2||r==this.historyInput||e.addItem(this.name,r,i)}previous(){let{_filtered:e,_index:t}=this;le(e)||(t<=0?this._index=e.length-1:this._index=t-1,this.historyInput=this.prompt.input=de(e[this._index]))}next(){let{_filtered:e,_index:t}=this;le(e)||(t==e.length-1?this._index=0:this._index=t+1,this.historyInput=this.prompt.input=de(e[this._index]))}}});var ym,CV=k(()=>{"use strict";Ze();bl();ym=class{constructor(e,t){this.manager=e;this.nvim=t;this.insertMappings=new Map;this.normalMappings=new Map;this.userInsertMappings=new Map;this.userNormalMappings=new Map;this.actions=new Map;let{prompt:i}=e;this.addAction("do:switch",async()=>{await e.switchMatcher()}),this.addAction("do:selectall",async()=>{await e.session?.ui.selectAll()}),this.addAction("do:help",async()=>{await e.session?.showHelp()}),this.addAction("do:refresh",async()=>{await e.session?.reloadItems()}),this.addAction("do:exit",async()=>{await e.cancel()}),this.addAction("do:stop",()=>{e.stop()}),this.addAction("do:cancel",async()=>{await e.cancel(!1)}),this.addAction("do:toggle",async()=>{await e.session?.ui.toggleSelection()}),this.addAction("do:jumpback",()=>{e.session?.jumpBack()}),this.addAction("do:previous",async()=>{await this.navigate(!0)}),this.addAction("do:next",async()=>{await this.navigate(!1)}),this.addAction("do:defaultaction",async()=>{await e.doAction()}),this.addAction("do:chooseaction",async()=>{await e.chooseAction()}),this.addAction("do:togglemode",()=>{e.toggleMode()}),this.addAction("do:previewtoggle",async()=>{await e.togglePreview()}),this.addAction("do:previewup",()=>{this.scrollPreview("up")}),this.addAction("do:previewdown",()=>{this.scrollPreview("down")}),this.addAction("do:command",async()=>{await e.cancel(!1),await t.eval('feedkeys(":")')}),this.addAction("prompt:previous",()=>{e.session?.history.previous()}),this.addAction("prompt:next",()=>{e.session?.history.next()}),this.addAction("prompt:start",()=>{i.moveToStart()}),this.addAction("prompt:end",()=>{i.moveToEnd()}),this.addAction("prompt:left",()=>{i.moveLeft()}),this.addAction("prompt:right",()=>{i.moveRight()}),this.addAction("prompt:leftword",()=>{i.moveLeftWord()}),this.addAction("prompt:rightword",()=>{i.moveRightWord()}),this.addAction("prompt:deleteforward",()=>{i.onBackspace()}),this.addAction("prompt:deletebackward",()=>{i.removeNext()}),this.addAction("prompt:removetail",()=>{i.removeTail()}),this.addAction("prompt:removeahead",()=>{i.removeAhead()}),this.addAction("prompt:removeword",()=>{i.removeWord()}),this.addAction("prompt:insertregister",()=>{i.insertRegister()}),this.addAction("prompt:paste",async()=>{await i.paste()}),this.addAction("eval",async r=>{await i.eval(r)}),this.addAction("command",async r=>{await e.command(r)}),this.addAction("action",async r=>{await e.doAction(r)}),this.addAction("feedkeys",async r=>{await e.feedkeys(r)}),this.addAction("feedkeys!",async r=>{await e.feedkeys(r,!1)}),this.addAction("normal",async r=>{await e.normal(r,!1)}),this.addAction("normal!",async r=>{await e.normal(r,!0)}),this.addAction("call",async r=>{await e.call(r)}),this.addAction("expr",async r=>{let o=await e.call(r);await e.doAction(o)}),this.addKeyMapping("insert","","do:switch"),this.addKeyMapping("insert","","prompt:next"),this.addKeyMapping("insert","","prompt:previous"),this.addKeyMapping("insert","","prompt:paste"),this.addKeyMapping("insert",["",""],"do:defaultaction"),this.addKeyMapping("insert",["",""," "],"do:chooseaction"),this.addKeyMapping("insert","","do:togglemode"),this.addKeyMapping("insert","","do:stop"),this.addKeyMapping("insert","","do:refresh"),this.addKeyMapping("insert","","prompt:left"),this.addKeyMapping("insert","","prompt:right"),this.addKeyMapping("insert",["",""],"prompt:end"),this.addKeyMapping("insert",["",""],"prompt:start"),this.addKeyMapping("insert",["","",""],"prompt:deleteforward"),this.addKeyMapping("insert","","prompt:removeword"),this.addKeyMapping("insert","","prompt:removeahead"),this.addKeyMapping("insert","","prompt:insertregister"),this.addKeyMapping("normal","t","action:tabe"),this.addKeyMapping("normal","s","action:split"),this.addKeyMapping("normal","d","action:drop"),this.addKeyMapping("normal",["","","\r"],"do:defaultaction"),this.addKeyMapping("normal","","do:selectall"),this.addKeyMapping("normal"," ","do:toggle"),this.addKeyMapping("normal","p","do:previewtoggle"),this.addKeyMapping("normal",[""," ",""],"do:chooseaction"),this.addKeyMapping("normal","","do:stop"),this.addKeyMapping("normal","","do:refresh"),this.addKeyMapping("normal","","do:jumpback"),this.addKeyMapping("normal","","do:previewdown"),this.addKeyMapping("normal","","do:previewup"),this.addKeyMapping("normal",["i","I","o","O","a","A"],"do:togglemode"),this.addKeyMapping("normal","?","do:help"),this.addKeyMapping("normal",":","do:command"),this.createMappings()}createMappings(){let e=bt.get("insertMappings",{});this.userInsertMappings=this.fixUserMappings(e,"list.insertMappings");let t=bt.get("normalMappings",{});this.userNormalMappings=this.fixUserMappings(t,"list.normalMappings")}hasUserMapping(e,t){return(e=="insert"?this.userInsertMappings:this.userNormalMappings).has(t)}isValidAction(e){if(this.actions.has(e))return!0;let[t,i]=e.split(":",2);return!(!i||!this.actions.has(t))}fixUserMappings(e,t){let i=new Map;for(let[r,o]of Object.entries(e)){if(!this.isValidAction(o)){R.showWarningMessage(`Invalid configuration - unable to support action "${o}" in "${t}"`);continue}if(r.length==1)i.set(r,o);else if(r.startsWith("<")&&r.endsWith(">"))if(r.toLowerCase()=="")i.set(" ",o);else if(r.toLowerCase()=="")i.set("",o);else if(Bu.includes(r))i.set(r,o);else{let s=!1;for(let a=0;athis.doAction(e);let[t,i]=e.split(":",2);if(!i||!this.actions.has(t))throw new Error(`Invalid action ${e}`);return()=>this.doAction(t,i)}async doAction(e,t){let i=this.actions.get(e);if(!i)throw new Error(`Action ${e} doesn't exist`);await Promise.resolve(i(t))}scrollPreview(e){let t=bt.get("floatPreview",!1),{nvim:i}=this;i.pauseNotification(),i.call("coc#list#scroll_preview",[e,t],!0),i.command("redraw",!0),i.resumeNotification(!1,!0)}}});var vm,SV=k(()=>{"use strict";ie();bl();vm=class{constructor(e){this.nvim=e;this.cusorIndex=0;this._input="";this._mode="insert";this.interactive=!1;this.requestInput=!1;this._onDidChangeInput=new p.Emitter;this.onDidChangeInput=this._onDidChangeInput.event}get input(){return this._input}set input(e){this._input!=e&&(this.cusorIndex=e.length,this._input=e,this.drawPrompt(),this._onDidChangeInput.fire(this._input))}get mode(){return this._mode}set mode(e){e!=this._mode&&(this._mode=e,this.drawPrompt())}set matcher(e){this._matcher=e,this.drawPrompt()}start(e){e&&(this.interactive=e.interactive,this.cusorIndex=e.input.length,this._input=e.input,this._mode=e.mode,this._matcher=e.interactive?"":e.matcher),this.nvim.call("coc#prompt#start_prompt",["list"],!0),this.drawPrompt()}cancel(){let{nvim:e}=this;e.call("coc#prompt#stop_prompt",["list"],!0)}reset(){this._input="",this.cusorIndex=0}drawPrompt(){let e=bt.get("indicator",">"),{cusorIndex:t,interactive:i,input:r,_matcher:o}=this,s=['echo ""'];if(this.mode=="insert")if(i?s.push("echohl MoreMsg | echon 'INTERACTIVE ' | echohl None"):o&&s.push(`echohl MoreMsg | echon '${o.toUpperCase()} ' | echohl None`),s.push(`echohl Special | echon '${e} ' | echohl None`),t==r.length)s.push(`echon '${r.replace(/'/g,"''")}'`),s.push("echohl Cursor | echon ' ' | echohl None");else{let l=r.slice(0,t);l&&s.push(`echon '${l.replace(/'/g,"''")}'`),s.push(`echohl Cursor | echon '${r[t].replace(/'/,"''")}' | echohl None`);let u=r.slice(t+1);s.push(`echon '${u.replace(/'/g,"''")}'`)}else s.push('echohl MoreMsg | echo "" | echohl None');s.push("redraw");let a=s.join("|");this.nvim.command(a,!0)}moveLeft(){this.cusorIndex!=0&&(this.cusorIndex=this.cusorIndex-1,this.drawPrompt())}moveRight(){this.cusorIndex!=this._input.length&&(this.cusorIndex=this.cusorIndex+1,this.drawPrompt())}moveLeftWord(){let{cusorIndex:e,input:t}=this;if(e==0)return;let i=t.slice(0,e),r=i.replace(/[\w$]+([^\w$]+)?$/,"");this.cusorIndex=e-(i.length-r.length),this.drawPrompt(),this._onDidChangeInput.fire(this._input)}moveRightWord(){let{cusorIndex:e,input:t}=this;if(e==t.length)return;let i=t.slice(e),r=i.match(/[\w$]+ */).at(0)??i;this.cusorIndex=e+r.length,this.drawPrompt(),this._onDidChangeInput.fire(this._input)}moveToEnd(){this.cusorIndex!=this._input.length&&(this.cusorIndex=this._input.length,this.drawPrompt())}moveToStart(){this.cusorIndex!=0&&(this.cusorIndex=0,this.drawPrompt())}onBackspace(){let{cusorIndex:e,input:t}=this;if(e==0)return;let i=t.slice(0,e),r=t.slice(e);this.cusorIndex=e-1,this._input=`${i.slice(0,i.length-1)}${r}`,this.drawPrompt(),this._onDidChangeInput.fire(this._input)}removeNext(){let{cusorIndex:e,input:t}=this;if(e==t.length)return;let i=t.slice(0,e),r=t.slice(e+1);this._input=`${i}${r}`,this.drawPrompt(),this._onDidChangeInput.fire(this._input)}removeWord(){let{cusorIndex:e,input:t}=this;if(e==0)return;let i=t.slice(0,e),r=t.slice(e),o=i.replace(/[\w$]+([^\w$]+)?$/,"");this.cusorIndex=e-(i.length-o.length),this._input=`${o}${r}`,this.drawPrompt(),this._onDidChangeInput.fire(this._input)}removeTail(){let{cusorIndex:e,input:t}=this;if(e==t.length)return;let i=t.slice(0,e);this._input=i,this.drawPrompt(),this._onDidChangeInput.fire(this._input)}removeAhead(){let{cusorIndex:e,input:t}=this;if(e==0)return;let i=t.slice(e);this.cusorIndex=0,this._input=i,this.drawPrompt(),this._onDidChangeInput.fire(this._input)}async acceptCharacter(e){if(this.requestInput){if(this.requestInput=!1,/^[0-9a-z"%#*+/:\-.]$/.test(e)){let t=await this.nvim.call("getreg",e);t=t.replace(/\n/g," "),this.addText(t)}}else this.addText(e)}insertRegister(){this.requestInput=!0}async paste(){let e=await this.nvim.eval("@*");e=e.replace(/\n/g,""),e&&this.addText(e)}async eval(e){let t=await this.nvim.call("eval",[e]);t=t.replace(/\n/g,""),this.addText(t)}addText(e){let{cusorIndex:t,input:i}=this;this.cusorIndex=t+e.length;let r=i.slice(0,t),o=i.slice(t);this._input=`${r}${e}${o}`,this.drawPrompt(),this._onDidChangeInput.fire(this._input)}}});var r0,DV=k(()=>{"use strict";r0=class{constructor(){this._busy=!1;this._fns=[];this._resolves=[]}run(e){this._busy?this._fns.push(e):(this._busy=!0,e().finally(()=>{this.next()}))}waitFinish(){return this._busy?new Promise(e=>{this._resolves.push(e)}):Promise.resolve()}next(){let e=this._fns.shift();e?e().finally(()=>{this.next()}):this.finish()}finish(){this._busy=!1;let e;for(;(e=this._resolves.pop())!=null;)e()}cancel(){this._fns=[],this.finish()}}});var kxe,wm,TV=k(()=>{"use strict";je();se();Le();fe();ie();DV();Ce();be();bl();kxe=ve(100,20),wm=class{constructor(e,t,i){this.nvim=e;this.name=t;this.listOptions=i;this.newTab=!1;this.reversed=!1;this.currIndex=0;this.items=[];this.disposables=[];this.selected=new Set;this.sequence=new r0;this._onDidChangeLine=new p.Emitter;this._onDidOpen=new p.Emitter;this._onDidClose=new p.Emitter;this._onDidLineChange=new p.Emitter;this._onDoubleClick=new p.Emitter;this.onDidChangeLine=this._onDidChangeLine.event;this.onDidLineChange=this._onDidLineChange.event;this.onDidOpen=this._onDidOpen.event;this.onDidClose=this._onDidClose.event;this.onDidDoubleClick=this._onDoubleClick.event;this.newTab=i.position=="tab",this.reversed=i.reverse===!0,F.on("BufWinLeave",async o=>{o!=this.bufnr||this.window==null||(this.window=null,this._onDidClose.fire(o))},null,this.disposables),F.on("CursorMoved",async(o,s)=>{if(o!=this.bufnr)return;let a=this.lnumToIndex(s[0]);this.onLineChange(a)},null,this.disposables);let r=wt(async o=>{if(o!=this.bufnr)return;let[s,a,l]=await e.eval('[win_getid(),line("w0"),line("w$")]');if(l<300||s!=this.winid)return;let u=l-a+1,c=this.lnumToIndex(a),h=this.lnumToIndex(a+u*2);e.pauseNotification(),this.doHighlight(c,h),e.command("redraw",!0),e.resumeNotification(!1,!0)},kxe);this.disposables.push({dispose:()=>{r.clear()}}),F.on("CursorMoved",r,null,this.disposables)}onDidChangeItems(e){e.append||this.clearSelection(),this.sequence.run(async()=>{let{items:t,reload:i,append:r,finished:o,sorted:s}=e;this.shouldSort&&!s&&(t=r?this.items.concat(t):t,i=r==!0,r=!1,t.sort((a,l)=>a.score!=l.score?l.score-a.score:a.sortText>l.sortText?1:-1)),r?await this.appendItems(t):await this.drawItems(t,o,i)})}lnumToIndex(e){let{reversed:t,length:i}=this;return t?Math.max(0,i-e):e-1}indexToLnum(e){let{reversed:t,length:i}=this;return t?Math.max(Math.min(i,i-e),1):Math.min(e+1,i)}get bufnr(){return this.buffer?.id}get winid(){return this.window?.id}get limitLines(){return bt.get("limitLines",1/0)}onLineChange(e){this.currIndex!=e&&(this.currIndex=e,this._onDidChangeLine.fire(e))}get index(){return this.currIndex}getItem(e){return this.items[e]}get item(){let{window:e}=this;return e?e.cursor.then(t=>(this.currIndex=this.lnumToIndex(t[0]),this.items[this.currIndex])):Promise.resolve(null)}async echoMessage(e){let{items:t}=this,r=`[${t.indexOf(e)+1}/${t.length}] ${de(e.label)}`;this.nvim.callTimer("coc#ui#echo_lines",[[r]],!0)}updateItem(e,t){if(!this.buffer||t>=this.length)return;let{nvim:i}=this,r=this.indexToLnum(t);i.pauseNotification(),this.buffer.setOption("modifiable",!0,!0),i.call("setbufline",[this.bufnr,r,e.label],!0),this.doHighlight(t,t+1),this.buffer.setOption("modifiable",!1,!0),i.resumeNotification(!0,!0)}async getItems(){if(this.length==0||!this.window)return[];let e=await this.nvim.call("mode");if(e=="v"||e=="V"){let[r,o]=await this.getSelectedRange(),s=[];for(let a=r;a<=o;a++){let l=this.lnumToIndex(a),u=this.items[l];u&&s.push(u)}return s}let{selectedItems:t}=this;if(t.length)return t;let i=await this.item;return pe(i)}async onMouse(e){let{nvim:t,window:i}=this;if(!i)return;let[r,o,s]=await t.eval("[v:mouse_winid,v:mouse_lnum,v:mouse_col]");if(e=="mouseDown"){this.mouseDown={winid:r,lnum:o,col:s,current:r==i.id};return}let a=r==i.id;if(a&&e=="doubleClick"&&(this.setCursor(o),this._onDoubleClick.fire()),a&&e=="mouseDrag"){if(!this.mouseDown)return;await this.selectLines(this.mouseDown.lnum,o)}else if(a&&e=="mouseUp"){if(!this.mouseDown)return;this.mouseDown.lnum==o?(this.setCursor(o),t.command("redraw",!0)):await this.selectLines(this.mouseDown.lnum,o)}else!a&&e=="mouseUp"&&(t.pauseNotification(),t.call("win_gotoid",r,!0),t.call("cursor",[o,s],!0),t.command("redraw",!0),t.resumeNotification(!1,!0))}async resume(){let{items:e,selected:t,nvim:i}=this;if(await this.drawItems(e,!0,!0),!(!t.size||!this.buffer)){i.pauseNotification();for(let r of t)this.buffer.placeSign({lnum:r,id:bt.signOffset+r,name:"CocSelected",group:"coc-list"});i.command("redraw",!0),i.resumeNotification(!1,!0)}}async toggleSelection(){let{nvim:e,reversed:t}=this;await e.call("win_gotoid",[this.winid]);let i=await e.call("line","."),r=await e.call("mode");if(r=="v"||r=="V"){let[o,s]=await this.getSelectedRange();o>s&&([o,s]=[s,o]);for(let l=o;l<=s;l++)this.toggleLine(l);this.setCursor(s),e.command("redraw",!0),await e.resumeNotification();return}e.pauseNotification(),this.toggleLine(i),this.setCursor(t?i-1:i+1),e.command("redraw",!0),await e.resumeNotification()}toggleLine(e){let{selected:t,buffer:i}=this,r=t.has(e),o=bt.signOffset;r?(t.delete(e),i.unplaceSign({id:o+e,group:"coc-list"})):(t.add(e),i.placeSign({lnum:e,id:o+e,name:"CocSelected",group:"coc-list"}))}async selectLines(e,t){let{nvim:i,buffer:r,length:o}=this,s=bt.signOffset;this.clearSelection();let{selected:a}=this;i.pauseNotification(),e>t&&([e,t]=[t,e]);for(let u=e;u<=t&&!(u>o);u++)a.add(u),r.placeSign({lnum:u,id:s+u,name:"CocSelected",group:"coc-list"});this.setCursor(t),i.command("redraw",!0),await i.resumeNotification()}async selectAll(){let{length:e}=this;e>0&&await this.selectLines(1,e)}clearSelection(){let{selected:e,buffer:t}=this;t&&e.size>0&&(t.unplaceSign({group:"coc-list"}),this.selected.clear())}get ready(){return this.window?Promise.resolve():new Promise(e=>{let t=this.onDidLineChange(()=>{t.dispose(),e()})})}getHeight(e,t){let{listOptions:i}=this;if(typeof i.height=="number")return i.height;let r=bt.get("height",10);return t&&!i.interactive&&i.input.length==0&&(r=Math.min(e,r)),Math.max(1,r)}async drawItems(e,t,i=!1){let{nvim:r,name:o,listOptions:s}=this;if(this.items=e.length>this.limitLines?e.slice(0,this.limitLines):e,!this.window){let c=this.getHeight(e.length,t),{position:h,numberSelect:d}=s,[g,f,m]=await r.call("coc#list#create",[h,c,o,d]);this.tabnr=m,this.height=c,this.buffer=r.createBuffer(g);let b=this.window=r.createWindow(f),w=bt.get("statusLineSegments");w&&b.setOption("statusline",w.join(" "),!0),this._onDidOpen.fire(this.bufnr)}let a=[],l=0;this.items.forEach((c,h)=>{a.push(c.label),!i&&l==0&&c.preselect&&(l=h)});let u=i?this.currIndex:l;this.setLines(a,0,u),this._onDidLineChange.fire()}async appendItems(e){if(!this.window||e.length===0)return;let t=this.items.length,i=this.limitLines-t;if(i>0){let r=io.label),r.length,this.currIndex)}}get shouldSort(){let{matcher:e,interactive:t}=this.listOptions;return!(t||e!=="fuzzy")}setLines(e,t,i){let{nvim:r,buffer:o,window:s,reversed:a,newTab:l}=this;if(!(!o||!s)){if(r.pauseNotification(),t||(r.call("coc#compat#clear_matches",[s.id],!0),e.length||(e=["No results, press ? on normal mode to get help."],r.call("coc#compat#matchaddpos",["Comment",[[1]],99,s.id],!0))),o.setOption("modifiable",!0,!0),a){let u=e.reverse();t?r.call("coc#compat#prepend_lines",[o.id,u],!0):o.setLines(u,{start:0,end:-1,strictIndexing:!1},!0)}else o.setLines(e,{start:t?-1:0,end:-1,strictIndexing:!1},!0);if(o.setOption("modifiable",!1,!0),a&&!l){let u=bt.get("height",10);r.call("coc#window#set_height",[s.id,Math.max(Math.min(u,this.length),1)],!0)}if(i>this.items.length-1&&(i=0),i==0)if(t==0)this.doHighlight(0,299);else{let u=this.length-t-1;u<300&&this.doHighlight(u,Math.min(299,this.length-1))}else{let u=l?y.env.lines:this.height;this.doHighlight(Math.max(0,i-u),Math.min(i+u+1,this.length-1))}if(!t){this.currIndex=i;let u=this.indexToLnum(i);s.setCursor([u,0],!0),r.call("coc#list#select",[o.id,u],!0)}a&&r.command("normal! zb",!0),r.command("redraws",!0),r.resumeNotification(!0,!0)}}restoreWindow(){if(this.newTab)return;let{winid:e,height:t}=this;e&&t&&this.nvim.call("coc#window#set_height",[e,t],!0)}get length(){return this.items.length}get selectedItems(){let{selected:e,items:t}=this,i=[];for(let r of e){let o=this.lnumToIndex(r);t[r-1]&&i.push(t[o])}return i}doHighlight(e,t){let{items:i,reversed:r,length:o,buffer:s}=this,a=[],l=u=>{let c=this.indexToLnum(u)-1,{ansiHighlights:h}=i[u];if(h)for(let d of h){let{span:g,hlGroup:f}=d;a.push({hlGroup:f,lnum:c,colStart:g[0],colEnd:g[1]})}};if(r)for(let u=Math.min(t,o-1);u>=e;u--)l(u);else for(let u=e;u<=Math.min(t,o-1);u++)l(u);e=this.indexToLnum(e)-1,t=this.indexToLnum(t)-1,e>t&&([e,t]=[t,e]),!(!s||a.length==0)&&s.updateHighlights("list",a,{start:e,end:t+1,priority:99})}setCursor(e,t=0,i){let{items:r}=this,o=r.length==0?1:r.length;e>o||(i=i??this.lnumToIndex(e),this.onLineChange(i),this.window?.setCursor([e,t],!0),this.nvim.call("coc#list#select",[this.bufnr,e],!0))}async setIndex(e){if(e<0||e>=this.items.length)return;let{nvim:t}=this,i=this.indexToLnum(e);t.pauseNotification(),this.setCursor(i,0,e),t.command("redraw",!0),await t.resumeNotification(!1)}async moveCursor(e){let{index:t,reversed:i}=this;await this.setIndex(i?t-e:t+e)}async getSelectedRange(){let{nvim:e}=this;await e.call("coc#prompt#stop_prompt",["list"]),await e.eval('feedkeys("\\", "in")');let[,t]=await e.call("getpos","'<"),[,i]=await e.call("getpos","'>");return this.nvim.call("coc#prompt#start_prompt",["list"],!0),[t,i]}cancel(){this.sequence.cancel()}reset(){this.cancel(),this.window&&(this.window=null,this.buffer=null,this.tabnr=void 0)}dispose(){z(this.disposables),this.nvim.call("coc#window#close",[Pe(this.winid,-1)],!0),this.reset(),this.items=[],this._onDidChangeLine.dispose(),this._onDidOpen.dispose(),this._onDidClose.dispose(),this._onDidLineChange.dispose(),this._onDoubleClick.dispose()}}});async function o0(n,e,t,i){if(n.length===0)return;let r=new $I,o=n.length;function s(l){let u=[];r.start();for(let c=l;c{setImmediate(()=>{l(s(a))})})}var kV,$I,PV=k(()=>{"use strict";kV=15,$I=class{constructor(e=kV){this.yieldAfter=Math.max(e,kV),this.startTime=Date.now(),this.counter=0,this.total=0,this.counterInterval=1}start(){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}}});function s0(n){return n.filterText!=null?sX(n.filterText,n.label):n.label}function _V(n,e){return e?Exe(n):[n]}function xm(n){let{label:e,converted:t}=n;if(t)return n;if(e.includes(` +`).reduce(Nye,Object.create(null)),Nye=(n,e)=>{let t=parseInt(e,10);if(t!==Buffer.byteLength(e)+1)return n;e=e.slice((t+" ").length);let i=e.split("="),r=i.shift().replace(/^SCHILY\.(dev|ino|nlink)/,"$1");if(!r)return n;let o=i.join("=");return n[r]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(r)?new Date(o*1e3):/^[0-9]+$/.test(o)?+o:o,n};rK.exports=Xf});var zh=v((a4e,oK)=>{oK.exports=n=>{let e=n.length-1,t=-1;for(;e>-1&&n.charAt(e)==="/";)t=e,e--;return t===-1?n:n.slice(0,t)}});var aS=v((l4e,sK)=>{"use strict";sK.exports=n=>class extends n{warn(e,t,i={}){this.file&&(i.file=this.file),this.cwd&&(i.cwd=this.cwd),i.code=t instanceof Error&&t.code||e,i.tarCode=e,!this.strict&&i.recoverable!==!1?(t instanceof Error&&(i=Object.assign(t,i),t=t.message),this.emit("warn",i.tarCode,t,i)):t instanceof Error?this.emit("error",Object.assign(t,i)):this.emit("error",Object.assign(new Error(`${e}: ${t}`),i))}}});var kL=v((c4e,aK)=>{"use strict";var lS=["|","<",">","?",":"],TL=lS.map(n=>String.fromCharCode(61440+n.charCodeAt(0))),Hye=new Map(lS.map((n,e)=>[n,TL[e]])),Bye=new Map(TL.map((n,e)=>[n,lS[e]]));aK.exports={encode:n=>lS.reduce((e,t)=>e.split(t).join(Hye.get(t)),n),decode:n=>TL.reduce((e,t)=>e.split(t).join(Bye.get(t)),n)}});var PL=v((h4e,uK)=>{var{isAbsolute:Wye,parse:lK}=require("path").win32;uK.exports=n=>{let e="",t=lK(n);for(;Wye(n)||t.root;){let i=n.charAt(0)==="/"&&n.slice(0,4)!=="//?/"?"/":t.root;n=n.slice(i.length),e+=i,t=lK(n)}return[e,n]}});var hK=v((d4e,cK)=>{"use strict";cK.exports=(n,e,t)=>(n&=4095,t&&(n=(n|384)&-19),e&&(n&256&&(n|=64),n&32&&(n|=8),n&4&&(n|=1)),n)});var AL=v((f4e,TK)=>{"use strict";var{Minipass:yK}=GC(),vK=sS(),wK=Gh(),rs=require("fs"),dK=require("path"),ns=$h(),qye=zh(),xK=(n,e)=>e?(n=ns(n).replace(/^\.(\/|$)/,""),qye(e)+"/"+n):ns(n),Yye=16*1024*1024,gK=Symbol("process"),pK=Symbol("file"),fK=Symbol("directory"),RL=Symbol("symlink"),mK=Symbol("hardlink"),Gf=Symbol("header"),uS=Symbol("read"),EL=Symbol("lstat"),cS=Symbol("onlstat"),LL=Symbol("onread"),IL=Symbol("onreadlink"),FL=Symbol("openfile"),ML=Symbol("onopenfile"),rl=Symbol("close"),hS=Symbol("mode"),jL=Symbol("awaitDrain"),_L=Symbol("ondrain"),os=Symbol("prefix"),bK=Symbol("hadError"),CK=aS(),Uye=kL(),SK=PL(),DK=hK(),dS=CK(class extends yK{constructor(e,t){if(t=t||{},super(t),typeof e!="string")throw new TypeError("path is required");this.path=ns(e),this.portable=!!t.portable,this.myuid=process.getuid&&process.getuid()||0,this.myuser=process.env.USER||"",this.maxReadSize=t.maxReadSize||Yye,this.linkCache=t.linkCache||new Map,this.statCache=t.statCache||new Map,this.preservePaths=!!t.preservePaths,this.cwd=ns(t.cwd||process.cwd()),this.strict=!!t.strict,this.noPax=!!t.noPax,this.noMtime=!!t.noMtime,this.mtime=t.mtime||null,this.prefix=t.prefix?ns(t.prefix):null,this.fd=null,this.blockLen=null,this.blockRemain=null,this.buf=null,this.offset=null,this.length=null,this.pos=null,this.remain=null,typeof t.onwarn=="function"&&this.on("warn",t.onwarn);let i=!1;if(!this.preservePaths){let[r,o]=SK(this.path);r&&(this.path=o,i=r)}this.win32=!!t.win32||process.platform==="win32",this.win32&&(this.path=Uye.decode(this.path.replace(/\\/g,"/")),e=e.replace(/\\/g,"/")),this.absolute=ns(t.absolute||dK.resolve(this.cwd,e)),this.path===""&&(this.path="./"),i&&this.warn("TAR_ENTRY_INFO",`stripping ${i} from absolute path`,{entry:this,path:i+this.path}),this.statCache.has(this.absolute)?this[cS](this.statCache.get(this.absolute)):this[EL]()}emit(e,...t){return e==="error"&&(this[bK]=!0),super.emit(e,...t)}[EL](){rs.lstat(this.absolute,(e,t)=>{if(e)return this.emit("error",e);this[cS](t)})}[cS](e){this.statCache.set(this.absolute,e),this.stat=e,e.isFile()||(e.size=0),this.type=Jye(e),this.emit("stat",e),this[gK]()}[gK](){switch(this.type){case"File":return this[pK]();case"Directory":return this[fK]();case"SymbolicLink":return this[RL]();default:return this.end()}}[hS](e){return DK(e,this.type==="Directory",this.portable)}[os](e){return xK(e,this.prefix)}[Gf](){this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.header=new wK({path:this[os](this.path),linkpath:this.type==="Link"?this[os](this.linkpath):this.linkpath,mode:this[hS](this.stat.mode),uid:this.portable?null:this.stat.uid,gid:this.portable?null:this.stat.gid,size:this.stat.size,mtime:this.noMtime?null:this.mtime||this.stat.mtime,type:this.type,uname:this.portable?null:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?null:this.stat.atime,ctime:this.portable?null:this.stat.ctime}),this.header.encode()&&!this.noPax&&super.write(new vK({atime:this.portable?null:this.header.atime,ctime:this.portable?null:this.header.ctime,gid:this.portable?null:this.header.gid,mtime:this.noMtime?null:this.mtime||this.header.mtime,path:this[os](this.path),linkpath:this.type==="Link"?this[os](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?null:this.header.uid,uname:this.portable?null:this.header.uname,dev:this.portable?null:this.stat.dev,ino:this.portable?null:this.stat.ino,nlink:this.portable?null:this.stat.nlink}).encode()),super.write(this.header.block)}[fK](){this.path.slice(-1)!=="/"&&(this.path+="/"),this.stat.size=0,this[Gf](),this.end()}[RL](){rs.readlink(this.absolute,(e,t)=>{if(e)return this.emit("error",e);this[IL](t)})}[IL](e){this.linkpath=ns(e),this[Gf](),this.end()}[mK](e){this.type="Link",this.linkpath=ns(dK.relative(this.cwd,e)),this.stat.size=0,this[Gf](),this.end()}[pK](){if(this.stat.nlink>1){let e=this.stat.dev+":"+this.stat.ino;if(this.linkCache.has(e)){let t=this.linkCache.get(e);if(t.indexOf(this.cwd)===0)return this[mK](t)}this.linkCache.set(e,this.absolute)}if(this[Gf](),this.stat.size===0)return this.end();this[FL]()}[FL](){rs.open(this.absolute,"r",(e,t)=>{if(e)return this.emit("error",e);this[ML](t)})}[ML](e){if(this.fd=e,this[bK])return this[rl]();this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;let t=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(t),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[uS]()}[uS](){let{fd:e,buf:t,offset:i,length:r,pos:o}=this;rs.read(e,t,i,r,o,(s,a)=>{if(s)return this[rl](()=>this.emit("error",s));this[LL](a)})}[rl](e){rs.close(this.fd,e)}[LL](e){if(e<=0&&this.remain>0){let r=new Error("encountered unexpected EOF");return r.path=this.absolute,r.syscall="read",r.code="EOF",this[rl](()=>this.emit("error",r))}if(e>this.remain){let r=new Error("did not encounter expected EOF");return r.path=this.absolute,r.syscall="read",r.code="EOF",this[rl](()=>this.emit("error",r))}if(e===this.remain)for(let r=e;rthis[_L]())}[jL](e){this.once("drain",e)}write(e){if(this.blockRemaine?this.emit("error",e):this.end());this.offset>=this.length&&(this.buf=Buffer.allocUnsafe(Math.min(this.blockRemain,this.buf.length)),this.offset=0),this.length=this.buf.length-this.offset,this[uS]()}}),OL=class extends dS{[EL](){this[cS](rs.lstatSync(this.absolute))}[RL](){this[IL](rs.readlinkSync(this.absolute))}[FL](){this[ML](rs.openSync(this.absolute,"r"))}[uS](){let e=!0;try{let{fd:t,buf:i,offset:r,length:o,pos:s}=this,a=rs.readSync(t,i,r,o,s);this[LL](a),e=!1}finally{if(e)try{this[rl](()=>{})}catch{}}}[jL](e){e()}[rl](e){rs.closeSync(this.fd),e()}},Zye=CK(class extends yK{constructor(e,t){t=t||{},super(t),this.preservePaths=!!t.preservePaths,this.portable=!!t.portable,this.strict=!!t.strict,this.noPax=!!t.noPax,this.noMtime=!!t.noMtime,this.readEntry=e,this.type=e.type,this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.prefix=t.prefix||null,this.path=ns(e.path),this.mode=this[hS](e.mode),this.uid=this.portable?null:e.uid,this.gid=this.portable?null:e.gid,this.uname=this.portable?null:e.uname,this.gname=this.portable?null:e.gname,this.size=e.size,this.mtime=this.noMtime?null:t.mtime||e.mtime,this.atime=this.portable?null:e.atime,this.ctime=this.portable?null:e.ctime,this.linkpath=ns(e.linkpath),typeof t.onwarn=="function"&&this.on("warn",t.onwarn);let i=!1;if(!this.preservePaths){let[r,o]=SK(this.path);r&&(this.path=o,i=r)}this.remain=e.size,this.blockRemain=e.startBlockSize,this.header=new wK({path:this[os](this.path),linkpath:this.type==="Link"?this[os](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?null:this.uid,gid:this.portable?null:this.gid,size:this.size,mtime:this.noMtime?null:this.mtime,type:this.type,uname:this.portable?null:this.uname,atime:this.portable?null:this.atime,ctime:this.portable?null:this.ctime}),i&&this.warn("TAR_ENTRY_INFO",`stripping ${i} from absolute path`,{entry:this,path:i+this.path}),this.header.encode()&&!this.noPax&&super.write(new vK({atime:this.portable?null:this.atime,ctime:this.portable?null:this.ctime,gid:this.portable?null:this.gid,mtime:this.noMtime?null:this.mtime,path:this[os](this.path),linkpath:this.type==="Link"?this[os](this.linkpath):this.linkpath,size:this.size,uid:this.portable?null:this.uid,uname:this.portable?null:this.uname,dev:this.portable?null:this.readEntry.dev,ino:this.portable?null:this.readEntry.ino,nlink:this.portable?null:this.readEntry.nlink}).encode()),super.write(this.header.block),e.pipe(this)}[os](e){return xK(e,this.prefix)}[hS](e){return DK(e,this.type==="Directory",this.portable)}write(e){let t=e.length;if(t>this.blockRemain)throw new Error("writing more to entry than is appropriate");return this.blockRemain-=t,super.write(e)}end(){return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),super.end()}});dS.Sync=OL;dS.Tar=Zye;var Jye=n=>n.isFile()?"File":n.isDirectory()?"Directory":n.isSymbolicLink()?"SymbolicLink":"Unsupported";TK.exports=dS});var PK=v((m4e,kK)=>{"use strict";kK.exports=function(n){n.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}});var NL=v((b4e,_K)=>{"use strict";_K.exports=Tt;Tt.Node=Lu;Tt.create=Tt;function Tt(n){var e=this;if(e instanceof Tt||(e=new Tt),e.tail=null,e.head=null,e.length=0,n&&typeof n.forEach=="function")n.forEach(function(r){e.push(r)});else if(arguments.length>0)for(var t=0,i=arguments.length;t1)t=e;else if(this.head)i=this.head.next,t=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var r=0;i!==null;r++)t=n(t,i.value,r),i=i.next;return t};Tt.prototype.reduceReverse=function(n,e){var t,i=this.tail;if(arguments.length>1)t=e;else if(this.tail)i=this.tail.prev,t=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var r=this.length-1;i!==null;r--)t=n(t,i.value,r),i=i.prev;return t};Tt.prototype.toArray=function(){for(var n=new Array(this.length),e=0,t=this.head;t!==null;e++)n[e]=t.value,t=t.next;return n};Tt.prototype.toArrayReverse=function(){for(var n=new Array(this.length),e=0,t=this.tail;t!==null;e++)n[e]=t.value,t=t.prev;return n};Tt.prototype.slice=function(n,e){e=e||this.length,e<0&&(e+=this.length),n=n||0,n<0&&(n+=this.length);var t=new Tt;if(ethis.length&&(e=this.length);for(var i=0,r=this.head;r!==null&&ithis.length&&(e=this.length);for(var i=this.length,r=this.tail;r!==null&&i>e;i--)r=r.prev;for(;r!==null&&i>n;i--,r=r.prev)t.push(r.value);return t};Tt.prototype.splice=function(n,e,...t){n>this.length&&(n=this.length-1),n<0&&(n=this.length+n);for(var i=0,r=this.head;r!==null&&i{"use strict";var vS=class{constructor(e,t){this.path=e||"./",this.absolute=t,this.entry=null,this.stat=null,this.readdir=null,this.pending=!1,this.ignore=!1,this.piped=!1}},{Minipass:zye}=GC(),RK=mL(),Kye=rS(),$L=AL(),Qye=$L.Sync,Vye=$L.Tar,eve=NL(),EK=Buffer.alloc(1024),fS=Symbol("onStat"),gS=Symbol("ended"),ss=Symbol("queue"),Kh=Symbol("current"),Iu=Symbol("process"),pS=Symbol("processing"),LK=Symbol("processJob"),as=Symbol("jobs"),HL=Symbol("jobDone"),mS=Symbol("addFSEntry"),IK=Symbol("addTarEntry"),YL=Symbol("stat"),UL=Symbol("readdir"),bS=Symbol("onreaddir"),yS=Symbol("pipe"),FK=Symbol("entry"),BL=Symbol("entryOpt"),ZL=Symbol("writeEntryClass"),jK=Symbol("write"),WL=Symbol("ondrain"),wS=require("fs"),MK=require("path"),tve=aS(),qL=$h(),XL=tve(class extends zye{constructor(e){if(super(e),e=e||Object.create(null),this.opt=e,this.file=e.file||"",this.cwd=e.cwd||process.cwd(),this.maxReadSize=e.maxReadSize,this.preservePaths=!!e.preservePaths,this.strict=!!e.strict,this.noPax=!!e.noPax,this.prefix=qL(e.prefix||""),this.linkCache=e.linkCache||new Map,this.statCache=e.statCache||new Map,this.readdirCache=e.readdirCache||new Map,this[ZL]=$L,typeof e.onwarn=="function"&&this.on("warn",e.onwarn),this.portable=!!e.portable,this.zip=null,e.gzip||e.brotli){if(e.gzip&&e.brotli)throw new TypeError("gzip and brotli are mutually exclusive");e.gzip&&(typeof e.gzip!="object"&&(e.gzip={}),this.portable&&(e.gzip.portable=!0),this.zip=new RK.Gzip(e.gzip)),e.brotli&&(typeof e.brotli!="object"&&(e.brotli={}),this.zip=new RK.BrotliCompress(e.brotli)),this.zip.on("data",t=>super.write(t)),this.zip.on("end",t=>super.end()),this.zip.on("drain",t=>this[WL]()),this.on("resume",t=>this.zip.resume())}else this.on("drain",this[WL]);this.noDirRecurse=!!e.noDirRecurse,this.follow=!!e.follow,this.noMtime=!!e.noMtime,this.mtime=e.mtime||null,this.filter=typeof e.filter=="function"?e.filter:t=>!0,this[ss]=new eve,this[as]=0,this.jobs=+e.jobs||4,this[pS]=!1,this[gS]=!1}[jK](e){return super.write(e)}add(e){return this.write(e),this}end(e){return e&&this.write(e),this[gS]=!0,this[Iu](),this}write(e){if(this[gS])throw new Error("write after end");return e instanceof Kye?this[IK](e):this[mS](e),this.flowing}[IK](e){let t=qL(MK.resolve(this.cwd,e.path));if(!this.filter(e.path,e))e.resume();else{let i=new vS(e.path,t,!1);i.entry=new Vye(e,this[BL](i)),i.entry.on("end",r=>this[HL](i)),this[as]+=1,this[ss].push(i)}this[Iu]()}[mS](e){let t=qL(MK.resolve(this.cwd,e));this[ss].push(new vS(e,t)),this[Iu]()}[YL](e){e.pending=!0,this[as]+=1;let t=this.follow?"stat":"lstat";wS[t](e.absolute,(i,r)=>{e.pending=!1,this[as]-=1,i?this.emit("error",i):this[fS](e,r)})}[fS](e,t){this.statCache.set(e.absolute,t),e.stat=t,this.filter(e.path,t)||(e.ignore=!0),this[Iu]()}[UL](e){e.pending=!0,this[as]+=1,wS.readdir(e.absolute,(t,i)=>{if(e.pending=!1,this[as]-=1,t)return this.emit("error",t);this[bS](e,i)})}[bS](e,t){this.readdirCache.set(e.absolute,t),e.readdir=t,this[Iu]()}[Iu](){if(!this[pS]){this[pS]=!0;for(let e=this[ss].head;e!==null&&this[as]this.warn(t,i,r),noPax:this.noPax,cwd:this.cwd,absolute:e.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime,prefix:this.prefix}}[FK](e){this[as]+=1;try{return new this[ZL](e.path,this[BL](e)).on("end",()=>this[HL](e)).on("error",t=>this.emit("error",t))}catch(t){this.emit("error",t)}}[WL](){this[Kh]&&this[Kh].entry&&this[Kh].entry.resume()}[yS](e){e.piped=!0,e.readdir&&e.readdir.forEach(r=>{let o=e.path,s=o==="./"?"":o.replace(/\/*$/,"/");this[mS](s+r)});let t=e.entry,i=this.zip;i?t.on("data",r=>{i.write(r)||t.pause()}):t.on("data",r=>{super.write(r)||t.pause()})}pause(){return this.zip&&this.zip.pause(),super.pause()}}),JL=class extends XL{constructor(e){super(e),this[ZL]=Qye}pause(){}resume(){}[YL](e){let t=this.follow?"statSync":"lstatSync";this[fS](e,wS[t](e.absolute))}[UL](e,t){this[bS](e,wS.readdirSync(e.absolute))}[yS](e){let t=e.entry,i=this.zip;e.readdir&&e.readdir.forEach(r=>{let o=e.path,s=o==="./"?"":o.replace(/\/*$/,"/");this[mS](s+r)}),i?t.on("data",r=>{i.write(r)}):t.on("data",r=>{super[jK](r)})}};XL.Sync=JL;OK.exports=XL});var JK=v((w4e,ZK)=>{"use strict";var AK=typeof process=="object"&&process?process:{stdout:null,stderr:null},ive=require("events"),NK=require("stream"),HK=require("string_decoder").StringDecoder,Ks=Symbol("EOF"),Qs=Symbol("maybeEmitEnd"),ol=Symbol("emittedEnd"),CS=Symbol("emittingEnd"),zf=Symbol("emittedError"),SS=Symbol("closed"),BK=Symbol("read"),DS=Symbol("flush"),WK=Symbol("flushChunk"),cr=Symbol("encoding"),Vs=Symbol("decoder"),TS=Symbol("flowing"),Kf=Symbol("paused"),Qh=Symbol("resume"),sn=Symbol("bufferLength"),GL=Symbol("bufferPush"),zL=Symbol("bufferShift"),In=Symbol("objectMode"),Fn=Symbol("destroyed"),KL=Symbol("emitData"),qK=Symbol("emitEnd"),QL=Symbol("emitEnd2"),ea=Symbol("async"),Qf=n=>Promise.resolve().then(n),YK=global._MP_NO_ITERATOR_SYMBOLS_!=="1",nve=YK&&Symbol.asyncIterator||Symbol("asyncIterator not implemented"),rve=YK&&Symbol.iterator||Symbol("iterator not implemented"),ove=n=>n==="end"||n==="finish"||n==="prefinish",sve=n=>n instanceof ArrayBuffer||typeof n=="object"&&n.constructor&&n.constructor.name==="ArrayBuffer"&&n.byteLength>=0,ave=n=>!Buffer.isBuffer(n)&&ArrayBuffer.isView(n),kS=class{constructor(e,t,i){this.src=e,this.dest=t,this.opts=i,this.ondrain=()=>e[Qh](),t.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},VL=class extends kS{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,t,i){super(e,t,i),this.proxyErrors=r=>t.emit("error",r),e.on("error",this.proxyErrors)}};ZK.exports=class UK extends NK{constructor(e){super(),this[TS]=!1,this[Kf]=!1,this.pipes=[],this.buffer=[],this[In]=e&&e.objectMode||!1,this[In]?this[cr]=null:this[cr]=e&&e.encoding||null,this[cr]==="buffer"&&(this[cr]=null),this[ea]=e&&!!e.async||!1,this[Vs]=this[cr]?new HK(this[cr]):null,this[Ks]=!1,this[ol]=!1,this[CS]=!1,this[SS]=!1,this[zf]=null,this.writable=!0,this.readable=!0,this[sn]=0,this[Fn]=!1}get bufferLength(){return this[sn]}get encoding(){return this[cr]}set encoding(e){if(this[In])throw new Error("cannot set encoding in objectMode");if(this[cr]&&e!==this[cr]&&(this[Vs]&&this[Vs].lastNeed||this[sn]))throw new Error("cannot change encoding");this[cr]!==e&&(this[Vs]=e?new HK(e):null,this.buffer.length&&(this.buffer=this.buffer.map(t=>this[Vs].write(t)))),this[cr]=e}setEncoding(e){this.encoding=e}get objectMode(){return this[In]}set objectMode(e){this[In]=this[In]||!!e}get async(){return this[ea]}set async(e){this[ea]=this[ea]||!!e}write(e,t,i){if(this[Ks])throw new Error("write after end");if(this[Fn])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof t=="function"&&(i=t,t="utf8"),t||(t="utf8");let r=this[ea]?Qf:o=>o();return!this[In]&&!Buffer.isBuffer(e)&&(ave(e)?e=Buffer.from(e.buffer,e.byteOffset,e.byteLength):sve(e)?e=Buffer.from(e):typeof e!="string"&&(this.objectMode=!0)),this[In]?(this.flowing&&this[sn]!==0&&this[DS](!0),this.flowing?this.emit("data",e):this[GL](e),this[sn]!==0&&this.emit("readable"),i&&r(i),this.flowing):e.length?(typeof e=="string"&&!(t===this[cr]&&!this[Vs].lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[cr]&&(e=this[Vs].write(e)),this.flowing&&this[sn]!==0&&this[DS](!0),this.flowing?this.emit("data",e):this[GL](e),this[sn]!==0&&this.emit("readable"),i&&r(i),this.flowing):(this[sn]!==0&&this.emit("readable"),i&&r(i),this.flowing)}read(e){if(this[Fn])return null;if(this[sn]===0||e===0||e>this[sn])return this[Qs](),null;this[In]&&(e=null),this.buffer.length>1&&!this[In]&&(this.encoding?this.buffer=[this.buffer.join("")]:this.buffer=[Buffer.concat(this.buffer,this[sn])]);let t=this[BK](e||null,this.buffer[0]);return this[Qs](),t}[BK](e,t){return e===t.length||e===null?this[zL]():(this.buffer[0]=t.slice(e),t=t.slice(0,e),this[sn]-=e),this.emit("data",t),!this.buffer.length&&!this[Ks]&&this.emit("drain"),t}end(e,t,i){return typeof e=="function"&&(i=e,e=null),typeof t=="function"&&(i=t,t="utf8"),e&&this.write(e,t),i&&this.once("end",i),this[Ks]=!0,this.writable=!1,(this.flowing||!this[Kf])&&this[Qs](),this}[Qh](){this[Fn]||(this[Kf]=!1,this[TS]=!0,this.emit("resume"),this.buffer.length?this[DS]():this[Ks]?this[Qs]():this.emit("drain"))}resume(){return this[Qh]()}pause(){this[TS]=!1,this[Kf]=!0}get destroyed(){return this[Fn]}get flowing(){return this[TS]}get paused(){return this[Kf]}[GL](e){this[In]?this[sn]+=1:this[sn]+=e.length,this.buffer.push(e)}[zL](){return this.buffer.length&&(this[In]?this[sn]-=1:this[sn]-=this.buffer[0].length),this.buffer.shift()}[DS](e){do;while(this[WK](this[zL]()));!e&&!this.buffer.length&&!this[Ks]&&this.emit("drain")}[WK](e){return e?(this.emit("data",e),this.flowing):!1}pipe(e,t){if(this[Fn])return;let i=this[ol];return t=t||{},e===AK.stdout||e===AK.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,i?t.end&&e.end():(this.pipes.push(t.proxyErrors?new VL(this,e,t):new kS(this,e,t)),this[ea]?Qf(()=>this[Qh]()):this[Qh]()),e}unpipe(e){let t=this.pipes.find(i=>i.dest===e);t&&(this.pipes.splice(this.pipes.indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){let i=super.on(e,t);return e==="data"&&!this.pipes.length&&!this.flowing?this[Qh]():e==="readable"&&this[sn]!==0?super.emit("readable"):ove(e)&&this[ol]?(super.emit(e),this.removeAllListeners(e)):e==="error"&&this[zf]&&(this[ea]?Qf(()=>t.call(this,this[zf])):t.call(this,this[zf])),i}get emittedEnd(){return this[ol]}[Qs](){!this[CS]&&!this[ol]&&!this[Fn]&&this.buffer.length===0&&this[Ks]&&(this[CS]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[SS]&&this.emit("close"),this[CS]=!1)}emit(e,t,...i){if(e!=="error"&&e!=="close"&&e!==Fn&&this[Fn])return;if(e==="data")return t?this[ea]?Qf(()=>this[KL](t)):this[KL](t):!1;if(e==="end")return this[qK]();if(e==="close"){if(this[SS]=!0,!this[ol]&&!this[Fn])return;let o=super.emit("close");return this.removeAllListeners("close"),o}else if(e==="error"){this[zf]=t;let o=super.emit("error",t);return this[Qs](),o}else if(e==="resume"){let o=super.emit("resume");return this[Qs](),o}else if(e==="finish"||e==="prefinish"){let o=super.emit(e);return this.removeAllListeners(e),o}let r=super.emit(e,t,...i);return this[Qs](),r}[KL](e){for(let i of this.pipes)i.dest.write(e)===!1&&this.pause();let t=super.emit("data",e);return this[Qs](),t}[qK](){this[ol]||(this[ol]=!0,this.readable=!1,this[ea]?Qf(()=>this[QL]()):this[QL]())}[QL](){if(this[Vs]){let t=this[Vs].end();if(t){for(let i of this.pipes)i.dest.write(t);super.emit("data",t)}}for(let t of this.pipes)t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}collect(){let e=[];this[In]||(e.dataLength=0);let t=this.promise();return this.on("data",i=>{e.push(i),this[In]||(e.dataLength+=i.length)}),t.then(()=>e)}concat(){return this[In]?Promise.reject(new Error("cannot concat in objectMode")):this.collect().then(e=>this[In]?Promise.reject(new Error("cannot concat in objectMode")):this[cr]?e.join(""):Buffer.concat(e,e.dataLength))}promise(){return new Promise((e,t)=>{this.on(Fn,()=>t(new Error("stream destroyed"))),this.on("error",i=>t(i)),this.on("end",()=>e())})}[nve](){return{next:()=>{let t=this.read();if(t!==null)return Promise.resolve({done:!1,value:t});if(this[Ks])return Promise.resolve({done:!0});let i=null,r=null,o=u=>{this.removeListener("data",s),this.removeListener("end",a),r(u)},s=u=>{this.removeListener("error",o),this.removeListener("end",a),this.pause(),i({value:u,done:!!this[Ks]})},a=()=>{this.removeListener("error",o),this.removeListener("data",s),i({done:!0})},l=()=>o(new Error("stream destroyed"));return new Promise((u,c)=>{r=c,i=u,this.once(Fn,l),this.once("error",o),this.once("end",a),this.once("data",s)})}}}[rve](){return{next:()=>{let t=this.read();return{value:t,done:t===null}}}}destroy(e){return this[Fn]?(e?this.emit("error",e):this.emit(Fn),this):(this[Fn]=!0,this.buffer.length=0,this[sn]=0,typeof this.close=="function"&&!this[SS]&&this.close(),e?this.emit("error",e):this.emit(Fn),this)}static isStream(e){return!!e&&(e instanceof UK||e instanceof NK||e instanceof ive&&(typeof e.pipe=="function"||typeof e.write=="function"&&typeof e.end=="function"))}}});var sd=v(em=>{"use strict";var lve=JK(),uve=require("events").EventEmitter,hr=require("fs"),iI=hr.writev;if(!iI){let n=process.binding("fs"),e=n.FSReqWrap||n.FSReqCallback;iI=(t,i,r,o)=>{let s=(l,u)=>o(l,u,i),a=new e;a.oncomplete=s,n.writeBuffers(t,i,r,a)}}var rd=Symbol("_autoClose"),_o=Symbol("_close"),Vf=Symbol("_ended"),Ut=Symbol("_fd"),$K=Symbol("_finished"),al=Symbol("_flags"),eI=Symbol("_flush"),nI=Symbol("_handleChunk"),rI=Symbol("_makeBuf"),LS=Symbol("_mode"),PS=Symbol("_needDrain"),id=Symbol("_onerror"),od=Symbol("_onopen"),tI=Symbol("_onread"),ed=Symbol("_onwrite"),ll=Symbol("_open"),ta=Symbol("_path"),Fu=Symbol("_pos"),ls=Symbol("_queue"),td=Symbol("_read"),XK=Symbol("_readSize"),sl=Symbol("_reading"),_S=Symbol("_remain"),GK=Symbol("_size"),RS=Symbol("_write"),Vh=Symbol("_writing"),ES=Symbol("_defaultFlag"),nd=Symbol("_errored"),IS=class extends lve{constructor(e,t){if(t=t||{},super(t),this.readable=!0,this.writable=!1,typeof e!="string")throw new TypeError("path must be a string");this[nd]=!1,this[Ut]=typeof t.fd=="number"?t.fd:null,this[ta]=e,this[XK]=t.readSize||16*1024*1024,this[sl]=!1,this[GK]=typeof t.size=="number"?t.size:1/0,this[_S]=this[GK],this[rd]=typeof t.autoClose=="boolean"?t.autoClose:!0,typeof this[Ut]=="number"?this[td]():this[ll]()}get fd(){return this[Ut]}get path(){return this[ta]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[ll](){hr.open(this[ta],"r",(e,t)=>this[od](e,t))}[od](e,t){e?this[id](e):(this[Ut]=t,this.emit("open",t),this[td]())}[rI](){return Buffer.allocUnsafe(Math.min(this[XK],this[_S]))}[td](){if(!this[sl]){this[sl]=!0;let e=this[rI]();if(e.length===0)return process.nextTick(()=>this[tI](null,0,e));hr.read(this[Ut],e,0,e.length,null,(t,i,r)=>this[tI](t,i,r))}}[tI](e,t,i){this[sl]=!1,e?this[id](e):this[nI](t,i)&&this[td]()}[_o](){if(this[rd]&&typeof this[Ut]=="number"){let e=this[Ut];this[Ut]=null,hr.close(e,t=>t?this.emit("error",t):this.emit("close"))}}[id](e){this[sl]=!0,this[_o](),this.emit("error",e)}[nI](e,t){let i=!1;return this[_S]-=e,e>0&&(i=super.write(ethis[od](e,t))}[od](e,t){this[ES]&&this[al]==="r+"&&e&&e.code==="ENOENT"?(this[al]="w",this[ll]()):e?this[id](e):(this[Ut]=t,this.emit("open",t),this[eI]())}end(e,t){return e&&this.write(e,t),this[Vf]=!0,!this[Vh]&&!this[ls].length&&typeof this[Ut]=="number"&&this[ed](null,0),this}write(e,t){return typeof e=="string"&&(e=Buffer.from(e,t)),this[Vf]?(this.emit("error",new Error("write() after end()")),!1):this[Ut]===null||this[Vh]||this[ls].length?(this[ls].push(e),this[PS]=!0,!1):(this[Vh]=!0,this[RS](e),!0)}[RS](e){hr.write(this[Ut],e,0,e.length,this[Fu],(t,i)=>this[ed](t,i))}[ed](e,t){e?this[id](e):(this[Fu]!==null&&(this[Fu]+=t),this[ls].length?this[eI]():(this[Vh]=!1,this[Vf]&&!this[$K]?(this[$K]=!0,this[_o](),this.emit("finish")):this[PS]&&(this[PS]=!1,this.emit("drain"))))}[eI](){if(this[ls].length===0)this[Vf]&&this[ed](null,0);else if(this[ls].length===1)this[RS](this[ls].pop());else{let e=this[ls];this[ls]=[],iI(this[Ut],e,this[Fu],(t,i)=>this[ed](t,i))}}[_o](){if(this[rd]&&typeof this[Ut]=="number"){let e=this[Ut];this[Ut]=null,hr.close(e,t=>t?this.emit("error",t):this.emit("close"))}}},sI=class extends FS{[ll](){let e;if(this[ES]&&this[al]==="r+")try{e=hr.openSync(this[ta],this[al],this[LS])}catch(t){if(t.code==="ENOENT")return this[al]="w",this[ll]();throw t}else e=hr.openSync(this[ta],this[al],this[LS]);this[od](null,e)}[_o](){if(this[rd]&&typeof this[Ut]=="number"){let e=this[Ut];this[Ut]=null,hr.closeSync(e),this.emit("close")}}[RS](e){let t=!0;try{this[ed](null,hr.writeSync(this[Ut],e,0,e.length,this[Fu])),t=!1}finally{if(t)try{this[_o]()}catch{}}}};em.ReadStream=IS;em.ReadStreamSync=oI;em.WriteStream=FS;em.WriteStreamSync=sI});var BS=v((S4e,o7)=>{"use strict";var cve=aS(),zK=Gh(),hve=require("events"),dve=NL(),gve=1024*1024,pve=rS(),KK=sS(),QK=mL(),{nextTick:fve}=require("process"),aI=Buffer.from([31,139]),Vr=Symbol("state"),Mu=Symbol("writeEntry"),ia=Symbol("readEntry"),lI=Symbol("nextEntry"),VK=Symbol("processEntry"),eo=Symbol("extendedHeader"),tm=Symbol("globalExtendedHeader"),ul=Symbol("meta"),e7=Symbol("emitMeta"),ei=Symbol("buffer"),na=Symbol("queue"),cl=Symbol("ended"),t7=Symbol("emittedEnd"),ju=Symbol("emit"),an=Symbol("unzip"),MS=Symbol("consumeChunk"),jS=Symbol("consumeChunkSub"),uI=Symbol("consumeBody"),i7=Symbol("consumeMeta"),n7=Symbol("consumeHeader"),OS=Symbol("consuming"),cI=Symbol("bufferConcat"),hI=Symbol("maybeEnd"),im=Symbol("writing"),hl=Symbol("aborted"),AS=Symbol("onDone"),Ou=Symbol("sawValidEntry"),NS=Symbol("sawNullBlock"),HS=Symbol("sawEOF"),r7=Symbol("closeStream"),mve=n=>!0;o7.exports=cve(class extends hve{constructor(e){e=e||{},super(e),this.file=e.file||"",this[Ou]=null,this.on(AS,i=>{(this[Vr]==="begin"||this[Ou]===!1)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),e.ondone?this.on(AS,e.ondone):this.on(AS,i=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")}),this.strict=!!e.strict,this.maxMetaEntrySize=e.maxMetaEntrySize||gve,this.filter=typeof e.filter=="function"?e.filter:mve;let t=e.file&&(e.file.endsWith(".tar.br")||e.file.endsWith(".tbr"));this.brotli=!e.gzip&&e.brotli!==void 0?e.brotli:t?void 0:!1,this.writable=!0,this.readable=!1,this[na]=new dve,this[ei]=null,this[ia]=null,this[Mu]=null,this[Vr]="begin",this[ul]="",this[eo]=null,this[tm]=null,this[cl]=!1,this[an]=null,this[hl]=!1,this[NS]=!1,this[HS]=!1,this.on("end",()=>this[r7]()),typeof e.onwarn=="function"&&this.on("warn",e.onwarn),typeof e.onentry=="function"&&this.on("entry",e.onentry)}[n7](e,t){this[Ou]===null&&(this[Ou]=!1);let i;try{i=new zK(e,t,this[eo],this[tm])}catch(r){return this.warn("TAR_ENTRY_INVALID",r)}if(i.nullBlock)this[NS]?(this[HS]=!0,this[Vr]==="begin"&&(this[Vr]="header"),this[ju]("eof")):(this[NS]=!0,this[ju]("nullBlock"));else if(this[NS]=!1,!i.cksumValid)this.warn("TAR_ENTRY_INVALID","checksum failure",{header:i});else if(!i.path)this.warn("TAR_ENTRY_INVALID","path is required",{header:i});else{let r=i.type;if(/^(Symbolic)?Link$/.test(r)&&!i.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:i});else if(!/^(Symbolic)?Link$/.test(r)&&i.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:i});else{let o=this[Mu]=new pve(i,this[eo],this[tm]);if(!this[Ou])if(o.remain){let s=()=>{o.invalid||(this[Ou]=!0)};o.on("end",s)}else this[Ou]=!0;o.meta?o.size>this.maxMetaEntrySize?(o.ignore=!0,this[ju]("ignoredEntry",o),this[Vr]="ignore",o.resume()):o.size>0&&(this[ul]="",o.on("data",s=>this[ul]+=s),this[Vr]="meta"):(this[eo]=null,o.ignore=o.ignore||!this.filter(o.path,o),o.ignore?(this[ju]("ignoredEntry",o),this[Vr]=o.remain?"ignore":"header",o.resume()):(o.remain?this[Vr]="body":(this[Vr]="header",o.end()),this[ia]?this[na].push(o):(this[na].push(o),this[lI]())))}}}[r7](){fve(()=>this.emit("close"))}[VK](e){let t=!0;return e?Array.isArray(e)?this.emit.apply(this,e):(this[ia]=e,this.emit("entry",e),e.emittedEnd||(e.on("end",i=>this[lI]()),t=!1)):(this[ia]=null,t=!1),t}[lI](){do;while(this[VK](this[na].shift()));if(!this[na].length){let e=this[ia];!e||e.flowing||e.size===e.remain?this[im]||this.emit("drain"):e.once("drain",i=>this.emit("drain"))}}[uI](e,t){let i=this[Mu],r=i.blockRemain,o=r>=e.length&&t===0?e:e.slice(t,t+r);return i.write(o),i.blockRemain||(this[Vr]="header",this[Mu]=null,i.end()),o.length}[i7](e,t){let i=this[Mu],r=this[uI](e,t);return this[Mu]||this[e7](i),r}[ju](e,t,i){!this[na].length&&!this[ia]?this.emit(e,t,i):this[na].push([e,t,i])}[e7](e){switch(this[ju]("meta",this[ul]),e.type){case"ExtendedHeader":case"OldExtendedHeader":this[eo]=KK.parse(this[ul],this[eo],!1);break;case"GlobalExtendedHeader":this[tm]=KK.parse(this[ul],this[tm],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":this[eo]=this[eo]||Object.create(null),this[eo].path=this[ul].replace(/\0.*/,"");break;case"NextFileHasLongLinkpath":this[eo]=this[eo]||Object.create(null),this[eo].linkpath=this[ul].replace(/\0.*/,"");break;default:throw new Error("unknown meta: "+e.type)}}abort(e){this[hl]=!0,this.emit("abort",e),this.warn("TAR_ABORT",e,{recoverable:!1})}write(e){if(this[hl])return;if((this[an]===null||this.brotli===void 0&&this[an]===!1)&&e){if(this[ei]&&(e=Buffer.concat([this[ei],e]),this[ei]=null),e.lengththis[MS](a)),this[an].on("error",a=>this.abort(a)),this[an].on("end",a=>{this[cl]=!0,this[MS]()}),this[im]=!0;let s=this[an][o?"end":"write"](e);return this[im]=!1,s}}this[im]=!0,this[an]?this[an].write(e):this[MS](e),this[im]=!1;let i=this[na].length?!1:this[ia]?this[ia].flowing:!0;return!i&&!this[na].length&&this[ia].once("drain",r=>this.emit("drain")),i}[cI](e){e&&!this[hl]&&(this[ei]=this[ei]?Buffer.concat([this[ei],e]):e)}[hI](){if(this[cl]&&!this[t7]&&!this[hl]&&!this[OS]){this[t7]=!0;let e=this[Mu];if(e&&e.blockRemain){let t=this[ei]?this[ei].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${e.blockRemain} more bytes, only ${t} available)`,{entry:e}),this[ei]&&e.write(this[ei]),e.end()}this[ju](AS)}}[MS](e){if(this[OS])this[cI](e);else if(!e&&!this[ei])this[hI]();else{if(this[OS]=!0,this[ei]){this[cI](e);let t=this[ei];this[ei]=null,this[jS](t)}else this[jS](e);for(;this[ei]&&this[ei].length>=512&&!this[hl]&&!this[HS];){let t=this[ei];this[ei]=null,this[jS](t)}this[OS]=!1}(!this[ei]||this[cl])&&this[hI]()}[jS](e){let t=0,i=e.length;for(;t+512<=i&&!this[hl]&&!this[HS];)switch(this[Vr]){case"begin":case"header":this[n7](e,t),t+=512;break;case"ignore":case"body":t+=this[uI](e,t);break;case"meta":t+=this[i7](e,t);break;default:throw new Error("invalid state: "+this[Vr])}t{"use strict";var bve=qh(),a7=BS(),ad=require("fs"),yve=sd(),s7=require("path"),dI=zh();u7.exports=(n,e,t)=>{typeof n=="function"?(t=n,e=null,n={}):Array.isArray(n)&&(e=n,n={}),typeof e=="function"&&(t=e,e=null),e?e=Array.from(e):e=[];let i=bve(n);if(i.sync&&typeof t=="function")throw new TypeError("callback not supported for sync tar functions");if(!i.file&&typeof t=="function")throw new TypeError("callback only supported with file option");return e.length&&wve(i,e),i.noResume||vve(i),i.file&&i.sync?xve(i):i.file?Cve(i,t):l7(i)};var vve=n=>{let e=n.onentry;n.onentry=e?t=>{e(t),t.resume()}:t=>t.resume()},wve=(n,e)=>{let t=new Map(e.map(o=>[dI(o),!0])),i=n.filter,r=(o,s)=>{let a=s||s7.parse(o).root||".",l=o===a?!1:t.has(o)?t.get(o):r(s7.dirname(o),a);return t.set(o,l),l};n.filter=i?(o,s)=>i(o,s)&&r(dI(o)):o=>r(dI(o))},xve=n=>{let e=l7(n),t=n.file,i=!0,r;try{let o=ad.statSync(t),s=n.maxReadSize||16*1024*1024;if(o.size{let t=new a7(n),i=n.maxReadSize||16*1024*1024,r=n.file,o=new Promise((s,a)=>{t.on("error",a),t.on("end",s),ad.stat(r,(l,u)=>{if(l)a(l);else{let c=new yve.ReadStream(r,{readSize:i,size:u.size});c.on("error",a),c.pipe(t)}})});return e?o.then(e,e):o},l7=n=>new a7(n)});var f7=v((T4e,p7)=>{"use strict";var Sve=qh(),qS=xS(),c7=sd(),h7=WS(),d7=require("path");p7.exports=(n,e,t)=>{if(typeof e=="function"&&(t=e),Array.isArray(n)&&(e=n,n={}),!e||!Array.isArray(e)||!e.length)throw new TypeError("no files or directories specified");e=Array.from(e);let i=Sve(n);if(i.sync&&typeof t=="function")throw new TypeError("callback not supported for sync tar functions");if(!i.file&&typeof t=="function")throw new TypeError("callback only supported with file option");return i.file&&i.sync?Dve(i,e):i.file?Tve(i,e,t):i.sync?kve(i,e):Pve(i,e)};var Dve=(n,e)=>{let t=new qS.Sync(n),i=new c7.WriteStreamSync(n.file,{mode:n.mode||438});t.pipe(i),g7(t,e)},Tve=(n,e,t)=>{let i=new qS(n),r=new c7.WriteStream(n.file,{mode:n.mode||438});i.pipe(r);let o=new Promise((s,a)=>{r.on("error",a),r.on("close",s),i.on("error",a)});return gI(i,e),t?o.then(t,t):o},g7=(n,e)=>{e.forEach(t=>{t.charAt(0)==="@"?h7({file:d7.resolve(n.cwd,t.slice(1)),sync:!0,noResume:!0,onentry:i=>n.add(i)}):n.add(t)}),n.end()},gI=(n,e)=>{for(;e.length;){let t=e.shift();if(t.charAt(0)==="@")return h7({file:d7.resolve(n.cwd,t.slice(1)),noResume:!0,onentry:i=>n.add(i)}).then(i=>gI(n,e));n.add(t)}n.end()},kve=(n,e)=>{let t=new qS.Sync(n);return g7(t,e),t},Pve=(n,e)=>{let t=new qS(n);return gI(t,e),t}});var pI=v((k4e,C7)=>{"use strict";var _ve=qh(),m7=xS(),Pr=require("fs"),b7=sd(),y7=WS(),v7=require("path"),w7=Gh();C7.exports=(n,e,t)=>{let i=_ve(n);if(!i.file)throw new TypeError("file is required");if(i.gzip||i.brotli||i.file.endsWith(".br")||i.file.endsWith(".tbr"))throw new TypeError("cannot append to compressed archives");if(!e||!Array.isArray(e)||!e.length)throw new TypeError("no files or directories specified");return e=Array.from(e),i.sync?Rve(i,e):Lve(i,e,t)};var Rve=(n,e)=>{let t=new m7.Sync(n),i=!0,r,o;try{try{r=Pr.openSync(n.file,"r+")}catch(l){if(l.code==="ENOENT")r=Pr.openSync(n.file,"w+");else throw l}let s=Pr.fstatSync(r),a=Buffer.alloc(512);e:for(o=0;os.size)break;o+=u,n.mtimeCache&&n.mtimeCache.set(l.path,l.mtime)}i=!1,Eve(n,t,o,r,e)}finally{if(i)try{Pr.closeSync(r)}catch{}}},Eve=(n,e,t,i,r)=>{let o=new b7.WriteStreamSync(n.file,{fd:i,start:t});e.pipe(o),Ive(e,r)},Lve=(n,e,t)=>{e=Array.from(e);let i=new m7(n),r=(s,a,l)=>{let u=(f,m)=>{f?Pr.close(s,b=>l(f)):l(null,m)},c=0;if(a===0)return u(null,0);let h=0,d=Buffer.alloc(512),g=(f,m)=>{if(f)return u(f);if(h+=m,h<512&&m)return Pr.read(s,d,h,d.length-h,c+h,g);if(c===0&&d[0]===31&&d[1]===139)return u(new Error("cannot append to compressed archives"));if(h<512)return u(null,c);let b=new w7(d);if(!b.cksumValid)return u(null,c);let w=512*Math.ceil(b.size/512);if(c+w+512>a||(c+=w+512,c>=a))return u(null,c);n.mtimeCache&&n.mtimeCache.set(b.path,b.mtime),h=0,Pr.read(s,d,0,512,c,g)};Pr.read(s,d,0,512,c,g)},o=new Promise((s,a)=>{i.on("error",a);let l="r+",u=(c,h)=>{if(c&&c.code==="ENOENT"&&l==="r+")return l="w+",Pr.open(n.file,l,u);if(c)return a(c);Pr.fstat(h,(d,g)=>{if(d)return Pr.close(h,()=>a(d));r(h,g.size,(f,m)=>{if(f)return a(f);let b=new b7.WriteStream(n.file,{fd:h,start:m});i.pipe(b),b.on("error",a),b.on("close",s),x7(i,e)})})};Pr.open(n.file,l,u)});return t?o.then(t,t):o},Ive=(n,e)=>{e.forEach(t=>{t.charAt(0)==="@"?y7({file:v7.resolve(n.cwd,t.slice(1)),sync:!0,noResume:!0,onentry:i=>n.add(i)}):n.add(t)}),n.end()},x7=(n,e)=>{for(;e.length;){let t=e.shift();if(t.charAt(0)==="@")return y7({file:v7.resolve(n.cwd,t.slice(1)),noResume:!0,onentry:i=>n.add(i)}).then(i=>x7(n,e));n.add(t)}n.end()}});var D7=v((P4e,S7)=>{"use strict";var Fve=qh(),Mve=pI();S7.exports=(n,e,t)=>{let i=Fve(n);if(!i.file)throw new TypeError("file is required");if(i.gzip||i.brotli||i.file.endsWith(".br")||i.file.endsWith(".tbr"))throw new TypeError("cannot append to compressed archives");if(!e||!Array.isArray(e)||!e.length)throw new TypeError("no files or directories specified");return e=Array.from(e),jve(i),Mve(i,e,t)};var jve=n=>{let e=n.filter;n.mtimeCache||(n.mtimeCache=new Map),n.filter=e?(t,i)=>e(t,i)&&!(n.mtimeCache.get(t)>i.mtime):(t,i)=>!(n.mtimeCache.get(t)>i.mtime)}});var P7=v((_4e,k7)=>{var{promisify:T7}=require("util"),dl=require("fs"),Ove=n=>{if(!n)n={mode:511,fs:dl};else if(typeof n=="object")n={mode:511,fs:dl,...n};else if(typeof n=="number")n={mode:n,fs:dl};else if(typeof n=="string")n={mode:parseInt(n,8),fs:dl};else throw new TypeError("invalid options argument");return n.mkdir=n.mkdir||n.fs.mkdir||dl.mkdir,n.mkdirAsync=T7(n.mkdir),n.stat=n.stat||n.fs.stat||dl.stat,n.statAsync=T7(n.stat),n.statSync=n.statSync||n.fs.statSync||dl.statSync,n.mkdirSync=n.mkdirSync||n.fs.mkdirSync||dl.mkdirSync,n};k7.exports=Ove});var R7=v((R4e,_7)=>{var Ave=process.env.__TESTING_MKDIRP_PLATFORM__||process.platform,{resolve:Nve,parse:Hve}=require("path"),Bve=n=>{if(/\0/.test(n))throw Object.assign(new TypeError("path must be a string without null bytes"),{path:n,code:"ERR_INVALID_ARG_VALUE"});if(n=Nve(n),Ave==="win32"){let e=/[*|"<>?:]/,{root:t}=Hve(n);if(e.test(n.substr(t.length)))throw Object.assign(new Error("Illegal characters in path."),{path:n,code:"EINVAL"})}return n};_7.exports=Bve});var M7=v((E4e,F7)=>{var{dirname:E7}=require("path"),L7=(n,e,t=void 0)=>t===e?Promise.resolve():n.statAsync(e).then(i=>i.isDirectory()?t:void 0,i=>i.code==="ENOENT"?L7(n,E7(e),e):void 0),I7=(n,e,t=void 0)=>{if(t!==e)try{return n.statSync(e).isDirectory()?t:void 0}catch(i){return i.code==="ENOENT"?I7(n,E7(e),e):void 0}};F7.exports={findMade:L7,findMadeSync:I7}});var bI=v((L4e,O7)=>{var{dirname:j7}=require("path"),fI=(n,e,t)=>{e.recursive=!1;let i=j7(n);return i===n?e.mkdirAsync(n,e).catch(r=>{if(r.code!=="EISDIR")throw r}):e.mkdirAsync(n,e).then(()=>t||n,r=>{if(r.code==="ENOENT")return fI(i,e).then(o=>fI(n,e,o));if(r.code!=="EEXIST"&&r.code!=="EROFS")throw r;return e.statAsync(n).then(o=>{if(o.isDirectory())return t;throw r},()=>{throw r})})},mI=(n,e,t)=>{let i=j7(n);if(e.recursive=!1,i===n)try{return e.mkdirSync(n,e)}catch(r){if(r.code!=="EISDIR")throw r;return}try{return e.mkdirSync(n,e),t||n}catch(r){if(r.code==="ENOENT")return mI(n,e,mI(i,e,t));if(r.code!=="EEXIST"&&r.code!=="EROFS")throw r;try{if(!e.statSync(n).isDirectory())throw r}catch{throw r}}};O7.exports={mkdirpManual:fI,mkdirpManualSync:mI}});var H7=v((I4e,N7)=>{var{dirname:A7}=require("path"),{findMade:Wve,findMadeSync:qve}=M7(),{mkdirpManual:Yve,mkdirpManualSync:Uve}=bI(),Zve=(n,e)=>(e.recursive=!0,A7(n)===n?e.mkdirAsync(n,e):Wve(e,n).then(i=>e.mkdirAsync(n,e).then(()=>i).catch(r=>{if(r.code==="ENOENT")return Yve(n,e);throw r}))),Jve=(n,e)=>{if(e.recursive=!0,A7(n)===n)return e.mkdirSync(n,e);let i=qve(e,n);try{return e.mkdirSync(n,e),i}catch(r){if(r.code==="ENOENT")return Uve(n,e);throw r}};N7.exports={mkdirpNative:Zve,mkdirpNativeSync:Jve}});var Y7=v((F4e,q7)=>{var B7=require("fs"),$ve=process.env.__TESTING_MKDIRP_NODE_VERSION__||process.version,yI=$ve.replace(/^v/,"").split("."),W7=+yI[0]>10||+yI[0]==10&&+yI[1]>=12,Xve=W7?n=>n.mkdir===B7.mkdir:()=>!1,Gve=W7?n=>n.mkdirSync===B7.mkdirSync:()=>!1;q7.exports={useNative:Xve,useNativeSync:Gve}});var G7=v((M4e,X7)=>{var ld=P7(),ud=R7(),{mkdirpNative:U7,mkdirpNativeSync:Z7}=H7(),{mkdirpManual:J7,mkdirpManualSync:$7}=bI(),{useNative:zve,useNativeSync:Kve}=Y7(),cd=(n,e)=>(n=ud(n),e=ld(e),zve(e)?U7(n,e):J7(n,e)),Qve=(n,e)=>(n=ud(n),e=ld(e),Kve(e)?Z7(n,e):$7(n,e));cd.sync=Qve;cd.native=(n,e)=>U7(ud(n),ld(e));cd.manual=(n,e)=>J7(ud(n),ld(e));cd.nativeSync=(n,e)=>Z7(ud(n),ld(e));cd.manualSync=(n,e)=>$7(ud(n),ld(e));X7.exports=cd});var iQ=v((j4e,tQ)=>{"use strict";var to=require("fs"),Au=require("path"),Vve=to.lchown?"lchown":"chown",ewe=to.lchownSync?"lchownSync":"chownSync",K7=to.lchown&&!process.version.match(/v1[1-9]+\./)&&!process.version.match(/v10\.[6-9]/),z7=(n,e,t)=>{try{return to[ewe](n,e,t)}catch(i){if(i.code!=="ENOENT")throw i}},twe=(n,e,t)=>{try{return to.chownSync(n,e,t)}catch(i){if(i.code!=="ENOENT")throw i}},iwe=K7?(n,e,t,i)=>r=>{!r||r.code!=="EISDIR"?i(r):to.chown(n,e,t,i)}:(n,e,t,i)=>i,vI=K7?(n,e,t)=>{try{return z7(n,e,t)}catch(i){if(i.code!=="EISDIR")throw i;twe(n,e,t)}}:(n,e,t)=>z7(n,e,t),nwe=process.version,Q7=(n,e,t)=>to.readdir(n,e,t),rwe=(n,e)=>to.readdirSync(n,e);/^v4\./.test(nwe)&&(Q7=(n,e,t)=>to.readdir(n,t));var YS=(n,e,t,i)=>{to[Vve](n,e,t,iwe(n,e,t,r=>{i(r&&r.code!=="ENOENT"?r:null)}))},V7=(n,e,t,i,r)=>{if(typeof e=="string")return to.lstat(Au.resolve(n,e),(o,s)=>{if(o)return r(o.code!=="ENOENT"?o:null);s.name=e,V7(n,s,t,i,r)});if(e.isDirectory())wI(Au.resolve(n,e.name),t,i,o=>{if(o)return r(o);let s=Au.resolve(n,e.name);YS(s,t,i,r)});else{let o=Au.resolve(n,e.name);YS(o,t,i,r)}},wI=(n,e,t,i)=>{Q7(n,{withFileTypes:!0},(r,o)=>{if(r){if(r.code==="ENOENT")return i();if(r.code!=="ENOTDIR"&&r.code!=="ENOTSUP")return i(r)}if(r||!o.length)return YS(n,e,t,i);let s=o.length,a=null,l=u=>{if(!a){if(u)return i(a=u);if(--s===0)return YS(n,e,t,i)}};o.forEach(u=>V7(n,u,e,t,l))})},owe=(n,e,t,i)=>{if(typeof e=="string")try{let r=to.lstatSync(Au.resolve(n,e));r.name=e,e=r}catch(r){if(r.code==="ENOENT")return;throw r}e.isDirectory()&&eQ(Au.resolve(n,e.name),t,i),vI(Au.resolve(n,e.name),t,i)},eQ=(n,e,t)=>{let i;try{i=rwe(n,{withFileTypes:!0})}catch(r){if(r.code==="ENOENT")return;if(r.code==="ENOTDIR"||r.code==="ENOTSUP")return vI(n,e,t);throw r}return i&&i.length&&i.forEach(r=>owe(n,r,e,t)),vI(n,e,t)};tQ.exports=wI;wI.sync=eQ});var sQ=v((O4e,xI)=>{"use strict";var nQ=G7(),io=require("fs"),US=require("path"),rQ=iQ(),Ro=$h(),ZS=class extends Error{constructor(e,t){super("Cannot extract through symbolic link"),this.path=t,this.symlink=e}get name(){return"SylinkError"}},JS=class extends Error{constructor(e,t){super(t+": Cannot cd into '"+e+"'"),this.path=e,this.code=t}get name(){return"CwdError"}},$S=(n,e)=>n.get(Ro(e)),nm=(n,e,t)=>n.set(Ro(e),t),swe=(n,e)=>{io.stat(n,(t,i)=>{(t||!i.isDirectory())&&(t=new JS(n,t&&t.code||"ENOTDIR")),e(t)})};xI.exports=(n,e,t)=>{n=Ro(n);let i=e.umask,r=e.mode|448,o=(r&i)!==0,s=e.uid,a=e.gid,l=typeof s=="number"&&typeof a=="number"&&(s!==e.processUid||a!==e.processGid),u=e.preserve,c=e.unlink,h=e.cache,d=Ro(e.cwd),g=(b,w)=>{b?t(b):(nm(h,n,!0),w&&l?rQ(w,s,a,x=>g(x)):o?io.chmod(n,r,t):t())};if(h&&$S(h,n)===!0)return g();if(n===d)return swe(n,g);if(u)return nQ(n,{mode:r}).then(b=>g(null,b),g);let m=Ro(US.relative(d,n)).split("/");XS(d,m,r,h,c,d,null,g)};var XS=(n,e,t,i,r,o,s,a)=>{if(!e.length)return a(null,s);let l=e.shift(),u=Ro(US.resolve(n+"/"+l));if($S(i,u))return XS(u,e,t,i,r,o,s,a);io.mkdir(u,t,oQ(u,e,t,i,r,o,s,a))},oQ=(n,e,t,i,r,o,s,a)=>l=>{l?io.lstat(n,(u,c)=>{if(u)u.path=u.path&&Ro(u.path),a(u);else if(c.isDirectory())XS(n,e,t,i,r,o,s,a);else if(r)io.unlink(n,h=>{if(h)return a(h);io.mkdir(n,t,oQ(n,e,t,i,r,o,s,a))});else{if(c.isSymbolicLink())return a(new ZS(n,n+"/"+e.join("/")));a(l)}}):(s=s||n,XS(n,e,t,i,r,o,s,a))},awe=n=>{let e=!1,t="ENOTDIR";try{e=io.statSync(n).isDirectory()}catch(i){t=i.code}finally{if(!e)throw new JS(n,t)}};xI.exports.sync=(n,e)=>{n=Ro(n);let t=e.umask,i=e.mode|448,r=(i&t)!==0,o=e.uid,s=e.gid,a=typeof o=="number"&&typeof s=="number"&&(o!==e.processUid||s!==e.processGid),l=e.preserve,u=e.unlink,c=e.cache,h=Ro(e.cwd),d=b=>{nm(c,n,!0),b&&a&&rQ.sync(b,o,s),r&&io.chmodSync(n,i)};if(c&&$S(c,n)===!0)return d();if(n===h)return awe(h),d();if(l)return d(nQ.sync(n,i));let f=Ro(US.relative(h,n)).split("/"),m=null;for(let b=f.shift(),w=h;b&&(w+="/"+b);b=f.shift())if(w=Ro(US.resolve(w)),!$S(c,w))try{io.mkdirSync(w,i),m=m||w,nm(c,w,!0)}catch{let D=io.lstatSync(w);if(D.isDirectory()){nm(c,w,!0);continue}else if(u){io.unlinkSync(w),io.mkdirSync(w,i),m=m||w,nm(c,w,!0);continue}else if(D.isSymbolicLink())return new ZS(w,w+"/"+f.join("/"))}return d(m)}});var SI=v((A4e,aQ)=>{var CI=Object.create(null),{hasOwnProperty:lwe}=Object.prototype;aQ.exports=n=>(lwe.call(CI,n)||(CI[n]=n.normalize("NFD")),CI[n])});var hQ=v((N4e,cQ)=>{var lQ=require("assert"),uwe=SI(),cwe=zh(),{join:uQ}=require("path"),hwe=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,dwe=hwe==="win32";cQ.exports=()=>{let n=new Map,e=new Map,t=u=>u.split("/").slice(0,-1).reduce((h,d)=>(h.length&&(d=uQ(h[h.length-1],d)),h.push(d||"/"),h),[]),i=new Set,r=u=>{let c=e.get(u);if(!c)throw new Error("function does not have any path reservations");return{paths:c.paths.map(h=>n.get(h)),dirs:[...c.dirs].map(h=>n.get(h))}},o=u=>{let{paths:c,dirs:h}=r(u);return c.every(d=>d[0]===u)&&h.every(d=>d[0]instanceof Set&&d[0].has(u))},s=u=>i.has(u)||!o(u)?!1:(i.add(u),u(()=>a(u)),!0),a=u=>{if(!i.has(u))return!1;let{paths:c,dirs:h}=e.get(u),d=new Set;return c.forEach(g=>{let f=n.get(g);lQ.equal(f[0],u),f.length===1?n.delete(g):(f.shift(),typeof f[0]=="function"?d.add(f[0]):f[0].forEach(m=>d.add(m)))}),h.forEach(g=>{let f=n.get(g);lQ(f[0]instanceof Set),f[0].size===1&&f.length===1?n.delete(g):f[0].size===1?(f.shift(),d.add(f[0])):f[0].delete(u)}),i.delete(u),d.forEach(g=>s(g)),!0};return{check:o,reserve:(u,c)=>{u=dwe?["win32 parallelization disabled"]:u.map(d=>cwe(uQ(uwe(d))).toLowerCase());let h=new Set(u.map(d=>t(d)).reduce((d,g)=>d.concat(g)));return e.set(c,{dirs:h,paths:u}),u.forEach(d=>{let g=n.get(d);g?g.push(c):n.set(d,[c])}),h.forEach(d=>{let g=n.get(d);g?g[g.length-1]instanceof Set?g[g.length-1].add(c):g.push(new Set([c])):n.set(d,[new Set([c])])}),s(c)}}}});var pQ=v((H4e,gQ)=>{var gwe=process.env.__FAKE_PLATFORM__||process.platform,pwe=gwe==="win32",fwe=global.__FAKE_TESTING_FS__||require("fs"),{O_CREAT:mwe,O_TRUNC:bwe,O_WRONLY:ywe,UV_FS_O_FILEMAP:dQ=0}=fwe.constants,vwe=pwe&&!!dQ,wwe=512*1024,xwe=dQ|bwe|mwe|ywe;gQ.exports=vwe?n=>n"w"});var II=v((B4e,_Q)=>{"use strict";var Cwe=require("assert"),Swe=BS(),kt=require("fs"),Dwe=sd(),ra=require("path"),TQ=sQ(),fQ=kL(),Twe=hQ(),kwe=PL(),no=$h(),Pwe=zh(),_we=SI(),mQ=Symbol("onEntry"),kI=Symbol("checkFs"),bQ=Symbol("checkFs2"),KS=Symbol("pruneCache"),PI=Symbol("isReusable"),ro=Symbol("makeFs"),_I=Symbol("file"),RI=Symbol("directory"),QS=Symbol("link"),yQ=Symbol("symlink"),vQ=Symbol("hardlink"),wQ=Symbol("unsupported"),xQ=Symbol("checkPath"),gl=Symbol("mkdir"),Mn=Symbol("onError"),GS=Symbol("pending"),CQ=Symbol("pend"),hd=Symbol("unpend"),DI=Symbol("ended"),TI=Symbol("maybeClose"),EI=Symbol("skip"),rm=Symbol("doChown"),om=Symbol("uid"),sm=Symbol("gid"),am=Symbol("checkedCwd"),kQ=require("crypto"),PQ=pQ(),Rwe=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,lm=Rwe==="win32",Ewe=1024,Lwe=(n,e)=>{if(!lm)return kt.unlink(n,e);let t=n+".DELETE."+kQ.randomBytes(16).toString("hex");kt.rename(n,t,i=>{if(i)return e(i);kt.unlink(t,e)})},Iwe=n=>{if(!lm)return kt.unlinkSync(n);let e=n+".DELETE."+kQ.randomBytes(16).toString("hex");kt.renameSync(n,e),kt.unlinkSync(e)},SQ=(n,e,t)=>n===n>>>0?n:e===e>>>0?e:t,DQ=n=>Pwe(no(_we(n))).toLowerCase(),Fwe=(n,e)=>{e=DQ(e);for(let t of n.keys()){let i=DQ(t);(i===e||i.indexOf(e+"/")===0)&&n.delete(t)}},Mwe=n=>{for(let e of n.keys())n.delete(e)},um=class extends Swe{constructor(e){if(e||(e={}),e.ondone=t=>{this[DI]=!0,this[TI]()},super(e),this[am]=!1,this.reservations=Twe(),this.transform=typeof e.transform=="function"?e.transform:null,this.writable=!0,this.readable=!1,this[GS]=0,this[DI]=!1,this.dirCache=e.dirCache||new Map,typeof e.uid=="number"||typeof e.gid=="number"){if(typeof e.uid!="number"||typeof e.gid!="number")throw new TypeError("cannot set owner without number uid and gid");if(e.preserveOwner)throw new TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=e.uid,this.gid=e.gid,this.setOwner=!0}else this.uid=null,this.gid=null,this.setOwner=!1;e.preserveOwner===void 0&&typeof e.uid!="number"?this.preserveOwner=process.getuid&&process.getuid()===0:this.preserveOwner=!!e.preserveOwner,this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():null,this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():null,this.maxDepth=typeof e.maxDepth=="number"?e.maxDepth:Ewe,this.forceChown=e.forceChown===!0,this.win32=!!e.win32||lm,this.newer=!!e.newer,this.keep=!!e.keep,this.noMtime=!!e.noMtime,this.preservePaths=!!e.preservePaths,this.unlink=!!e.unlink,this.cwd=no(ra.resolve(e.cwd||process.cwd())),this.strip=+e.strip||0,this.processUmask=e.noChmod?0:process.umask(),this.umask=typeof e.umask=="number"?e.umask:this.processUmask,this.dmode=e.dmode||511&~this.umask,this.fmode=e.fmode||438&~this.umask,this.on("entry",t=>this[mQ](t))}warn(e,t,i={}){return(e==="TAR_BAD_ARCHIVE"||e==="TAR_ABORT")&&(i.recoverable=!1),super.warn(e,t,i)}[TI](){this[DI]&&this[GS]===0&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"))}[xQ](e){let t=no(e.path),i=t.split("/");if(this.strip){if(i.length=this.strip)e.linkpath=r.slice(this.strip).join("/");else return!1}i.splice(0,this.strip),e.path=i.join("/")}if(isFinite(this.maxDepth)&&i.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:e,path:t,depth:i.length,maxDepth:this.maxDepth}),!1;if(!this.preservePaths){if(i.includes("..")||lm&&/^[a-z]:\.\.$/i.test(i[0]))return this.warn("TAR_ENTRY_ERROR","path contains '..'",{entry:e,path:t}),!1;let[r,o]=kwe(t);r&&(e.path=o,this.warn("TAR_ENTRY_INFO",`stripping ${r} from absolute path`,{entry:e,path:t}))}if(ra.isAbsolute(e.path)?e.absolute=no(ra.resolve(e.path)):e.absolute=no(ra.resolve(this.cwd,e.path)),!this.preservePaths&&e.absolute.indexOf(this.cwd+"/")!==0&&e.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:e,path:no(e.path),resolvedPath:e.absolute,cwd:this.cwd}),!1;if(e.absolute===this.cwd&&e.type!=="Directory"&&e.type!=="GNUDumpDir")return!1;if(this.win32){let{root:r}=ra.win32.parse(e.absolute);e.absolute=r+fQ.encode(e.absolute.slice(r.length));let{root:o}=ra.win32.parse(e.path);e.path=o+fQ.encode(e.path.slice(o.length))}return!0}[mQ](e){if(!this[xQ](e))return e.resume();switch(Cwe.equal(typeof e.absolute,"string"),e.type){case"Directory":case"GNUDumpDir":e.mode&&(e.mode=e.mode|448);case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[kI](e);case"CharacterDevice":case"BlockDevice":case"FIFO":default:return this[wQ](e)}}[Mn](e,t){e.name==="CwdError"?this.emit("error",e):(this.warn("TAR_ENTRY_ERROR",e,{entry:t}),this[hd](),t.resume())}[gl](e,t,i){TQ(no(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:t,noChmod:this.noChmod},i)}[rm](e){return this.forceChown||this.preserveOwner&&(typeof e.uid=="number"&&e.uid!==this.processUid||typeof e.gid=="number"&&e.gid!==this.processGid)||typeof this.uid=="number"&&this.uid!==this.processUid||typeof this.gid=="number"&&this.gid!==this.processGid}[om](e){return SQ(this.uid,e.uid,this.processUid)}[sm](e){return SQ(this.gid,e.gid,this.processGid)}[_I](e,t){let i=e.mode&4095||this.fmode,r=new Dwe.WriteStream(e.absolute,{flags:PQ(e.size),mode:i,autoClose:!1});r.on("error",l=>{r.fd&&kt.close(r.fd,()=>{}),r.write=()=>!0,this[Mn](l,e),t()});let o=1,s=l=>{if(l){r.fd&&kt.close(r.fd,()=>{}),this[Mn](l,e),t();return}--o===0&&kt.close(r.fd,u=>{u?this[Mn](u,e):this[hd](),t()})};r.on("finish",l=>{let u=e.absolute,c=r.fd;if(e.mtime&&!this.noMtime){o++;let h=e.atime||new Date,d=e.mtime;kt.futimes(c,h,d,g=>g?kt.utimes(u,h,d,f=>s(f&&g)):s())}if(this[rm](e)){o++;let h=this[om](e),d=this[sm](e);kt.fchown(c,h,d,g=>g?kt.chown(u,h,d,f=>s(f&&g)):s())}s()});let a=this.transform&&this.transform(e)||e;a!==e&&(a.on("error",l=>{this[Mn](l,e),t()}),e.pipe(a)),a.pipe(r)}[RI](e,t){let i=e.mode&4095||this.dmode;this[gl](e.absolute,i,r=>{if(r){this[Mn](r,e),t();return}let o=1,s=a=>{--o===0&&(t(),this[hd](),e.resume())};e.mtime&&!this.noMtime&&(o++,kt.utimes(e.absolute,e.atime||new Date,e.mtime,s)),this[rm](e)&&(o++,kt.chown(e.absolute,this[om](e),this[sm](e),s)),s()})}[wQ](e){e.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${e.type}`,{entry:e}),e.resume()}[yQ](e,t){this[QS](e,e.linkpath,"symlink",t)}[vQ](e,t){let i=no(ra.resolve(this.cwd,e.linkpath));this[QS](e,i,"link",t)}[CQ](){this[GS]++}[hd](){this[GS]--,this[TI]()}[EI](e){this[hd](),e.resume()}[PI](e,t){return e.type==="File"&&!this.unlink&&t.isFile()&&t.nlink<=1&&!lm}[kI](e){this[CQ]();let t=[e.path];e.linkpath&&t.push(e.linkpath),this.reservations.reserve(t,i=>this[bQ](e,i))}[KS](e){e.type==="SymbolicLink"?Mwe(this.dirCache):e.type!=="Directory"&&Fwe(this.dirCache,e.absolute)}[bQ](e,t){this[KS](e);let i=a=>{this[KS](e),t(a)},r=()=>{this[gl](this.cwd,this.dmode,a=>{if(a){this[Mn](a,e),i();return}this[am]=!0,o()})},o=()=>{if(e.absolute!==this.cwd){let a=no(ra.dirname(e.absolute));if(a!==this.cwd)return this[gl](a,this.dmode,l=>{if(l){this[Mn](l,e),i();return}s()})}s()},s=()=>{kt.lstat(e.absolute,(a,l)=>{if(l&&(this.keep||this.newer&&l.mtime>e.mtime)){this[EI](e),i();return}if(a||this[PI](e,l))return this[ro](null,e,i);if(l.isDirectory()){if(e.type==="Directory"){let u=!this.noChmod&&e.mode&&(l.mode&4095)!==e.mode,c=h=>this[ro](h,e,i);return u?kt.chmod(e.absolute,e.mode,c):c()}if(e.absolute!==this.cwd)return kt.rmdir(e.absolute,u=>this[ro](u,e,i))}if(e.absolute===this.cwd)return this[ro](null,e,i);Lwe(e.absolute,u=>this[ro](u,e,i))})};this[am]?o():r()}[ro](e,t,i){if(e){this[Mn](e,t),i();return}switch(t.type){case"File":case"OldFile":case"ContiguousFile":return this[_I](t,i);case"Link":return this[vQ](t,i);case"SymbolicLink":return this[yQ](t,i);case"Directory":case"GNUDumpDir":return this[RI](t,i)}}[QS](e,t,i,r){kt[i](t,e.absolute,o=>{o?this[Mn](o,e):(this[hd](),e.resume()),r()})}},zS=n=>{try{return[null,n()]}catch(e){return[e,null]}},LI=class extends um{[ro](e,t){return super[ro](e,t,()=>{})}[kI](e){if(this[KS](e),!this[am]){let o=this[gl](this.cwd,this.dmode);if(o)return this[Mn](o,e);this[am]=!0}if(e.absolute!==this.cwd){let o=no(ra.dirname(e.absolute));if(o!==this.cwd){let s=this[gl](o,this.dmode);if(s)return this[Mn](s,e)}}let[t,i]=zS(()=>kt.lstatSync(e.absolute));if(i&&(this.keep||this.newer&&i.mtime>e.mtime))return this[EI](e);if(t||this[PI](e,i))return this[ro](null,e);if(i.isDirectory()){if(e.type==="Directory"){let s=!this.noChmod&&e.mode&&(i.mode&4095)!==e.mode,[a]=s?zS(()=>{kt.chmodSync(e.absolute,e.mode)}):[];return this[ro](a,e)}let[o]=zS(()=>kt.rmdirSync(e.absolute));this[ro](o,e)}let[r]=e.absolute===this.cwd?[]:zS(()=>Iwe(e.absolute));this[ro](r,e)}[_I](e,t){let i=e.mode&4095||this.fmode,r=a=>{let l;try{kt.closeSync(o)}catch(u){l=u}(a||l)&&this[Mn](a||l,e),t()},o;try{o=kt.openSync(e.absolute,PQ(e.size),i)}catch(a){return r(a)}let s=this.transform&&this.transform(e)||e;s!==e&&(s.on("error",a=>this[Mn](a,e)),e.pipe(s)),s.on("data",a=>{try{kt.writeSync(o,a,0,a.length)}catch(l){r(l)}}),s.on("end",a=>{let l=null;if(e.mtime&&!this.noMtime){let u=e.atime||new Date,c=e.mtime;try{kt.futimesSync(o,u,c)}catch(h){try{kt.utimesSync(e.absolute,u,c)}catch{l=h}}}if(this[rm](e)){let u=this[om](e),c=this[sm](e);try{kt.fchownSync(o,u,c)}catch(h){try{kt.chownSync(e.absolute,u,c)}catch{l=l||h}}}r(l)})}[RI](e,t){let i=e.mode&4095||this.dmode,r=this[gl](e.absolute,i);if(r){this[Mn](r,e),t();return}if(e.mtime&&!this.noMtime)try{kt.utimesSync(e.absolute,e.atime||new Date,e.mtime)}catch{}if(this[rm](e))try{kt.chownSync(e.absolute,this[om](e),this[sm](e))}catch{}t(),e.resume()}[gl](e,t){try{return TQ.sync(no(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:t})}catch(i){return i}}[QS](e,t,i,r){try{kt[i+"Sync"](t,e.absolute),r(),e.resume()}catch(o){return this[Mn](o,e)}}};um.Sync=LI;_Q.exports=um});var FQ=v((W4e,IQ)=>{"use strict";var jwe=qh(),VS=II(),EQ=require("fs"),LQ=sd(),RQ=require("path"),FI=zh();IQ.exports=(n,e,t)=>{typeof n=="function"?(t=n,e=null,n={}):Array.isArray(n)&&(e=n,n={}),typeof e=="function"&&(t=e,e=null),e?e=Array.from(e):e=[];let i=jwe(n);if(i.sync&&typeof t=="function")throw new TypeError("callback not supported for sync tar functions");if(!i.file&&typeof t=="function")throw new TypeError("callback only supported with file option");return e.length&&Owe(i,e),i.file&&i.sync?Awe(i):i.file?Nwe(i,t):i.sync?Hwe(i):Bwe(i)};var Owe=(n,e)=>{let t=new Map(e.map(o=>[FI(o),!0])),i=n.filter,r=(o,s)=>{let a=s||RQ.parse(o).root||".",l=o===a?!1:t.has(o)?t.get(o):r(RQ.dirname(o),a);return t.set(o,l),l};n.filter=i?(o,s)=>i(o,s)&&r(FI(o)):o=>r(FI(o))},Awe=n=>{let e=new VS.Sync(n),t=n.file,i=EQ.statSync(t),r=n.maxReadSize||16*1024*1024;new LQ.ReadStreamSync(t,{readSize:r,size:i.size}).pipe(e)},Nwe=(n,e)=>{let t=new VS(n),i=n.maxReadSize||16*1024*1024,r=n.file,o=new Promise((s,a)=>{t.on("error",a),t.on("close",s),EQ.stat(r,(l,u)=>{if(l)a(l);else{let c=new LQ.ReadStream(r,{readSize:i,size:u.size});c.on("error",a),c.pipe(t)}})});return e?o.then(e,e):o},Hwe=n=>new VS.Sync(n),Bwe=n=>new VS(n)});var MQ=v(Yi=>{"use strict";Yi.c=Yi.create=f7();Yi.r=Yi.replace=pI();Yi.t=Yi.list=WS();Yi.u=Yi.update=D7();Yi.x=Yi.extract=FQ();Yi.Pack=xS();Yi.Unpack=II();Yi.Parse=BS();Yi.ReadEntry=rS();Yi.WriteEntry=AL();Yi.Header=Gh();Yi.Pax=sS();Yi.types=vL()});var NQ=v((Y4e,AQ)=>{AQ.exports=jn;function jn(n){if(!(this instanceof jn))return new jn(n);this.value=n}jn.prototype.get=function(n){for(var e=this.value,t=0;t{var Wwe=NQ(),qwe=require("events").EventEmitter;HQ.exports=dd;function dd(n){var e=dd.saw(n,{}),t=n.call(e.handlers,e);return t!==void 0&&(e.handlers=t),e.record(),e.chain()}dd.light=function(e){var t=dd.saw(e,{}),i=e.call(t.handlers,t);return i!==void 0&&(t.handlers=i),t.chain()};dd.saw=function(n,e){var t=new qwe;return t.handlers=e,t.actions=[],t.chain=function(){var i=Wwe(t.handlers).map(function(r){if(this.isRoot)return r;var o=this.path;typeof r=="function"&&this.update(function(){return t.actions.push({path:o,args:[].slice.call(arguments)}),i})});return process.nextTick(function(){t.emit("begin"),t.next()}),i},t.pop=function(){return t.actions.shift()},t.next=function(){var i=t.pop();if(!i)t.emit("end");else if(!i.trap){var r=t.handlers;i.path.forEach(function(o){r=r[o]}),r.apply(t.handlers,i.args)}},t.nest=function(i){var r=[].slice.call(arguments,1),o=!0;if(typeof i=="boolean"){var o=i;i=r.shift()}var s=dd.saw(n,{}),a=n.call(s.handlers,s);a!==void 0&&(s.handlers=a),typeof t.step<"u"&&s.record(),i.apply(s.chain(),r),o!==!1&&s.on("end",t.next)},t.record=function(){Ywe(t)},["trap","down","jump"].forEach(function(i){t[i]=function(){throw new Error("To use the trap, down and jump features, please call record() first to start recording actions.")}}),t};function Ywe(n){n.step=0,n.pop=function(){return n.actions[n.step++]},n.trap=function(e,t){var i=Array.isArray(e)?e:[e];n.actions.push({path:i,step:n.step,cb:t,trap:!0})},n.down=function(e){var t=(Array.isArray(e)?e:[e]).join("/"),i=n.actions.slice(n.step).map(function(o){return o.trap&&o.step<=n.step?!1:o.path.join("/")==t}).indexOf(!0);i>=0?n.step+=i:n.step=n.actions.length;var r=n.actions[n.step-1];r&&r.trap?(n.step=r.step,r.cb()):n.next()},n.jump=function(e){n.step=e,n.next()}}});var qQ=v((Z4e,WQ)=>{WQ.exports=Xn;function Xn(n){if(!(this instanceof Xn))return new Xn(n);this.buffers=n||[],this.length=this.buffers.reduce(function(e,t){return e+t.length},0)}Xn.prototype.push=function(){for(var n=0;n=0?n:this.length-n,r=[].slice.call(arguments,2);e===void 0?e=this.length-i:e>this.length-i&&(e=this.length-i);for(var n=0;n0){var u=i-a;if(u+e0){var g=r.slice();g.unshift(h),g.push(d),t.splice.apply(t,[l,1].concat(g)),l+=g.length,r=[]}else t.splice(l,1,h,d),l+=2}else o.push(t[l].slice(u)),t[l]=t[l].slice(0,u),l++}for(r.length>0&&(t.splice.apply(t,[l,0].concat(r)),l+=r.length);o.lengththis.length&&(e=this.length);for(var i=0,r=0;r=e-n?Math.min(u+(e-n)-s,l):l;t[a].copy(o,s,u,c),s+=c-u}return o};Xn.prototype.pos=function(n){if(n<0||n>=this.length)throw new Error("oob");for(var e=n,t=0,i=null;;){if(i=this.buffers[t],e=this.buffers[t].length;)if(i=0,t++,t>=this.buffers.length)return-1;var l=this.buffers[t][i];if(l==n[r]){if(r==0&&(o={i:t,j:i,pos:s}),r++,r==n.length)return o.pos}else r!=0&&(t=o.i,i=o.j,s=o.pos,r=0);i++,s++}};Xn.prototype.toBuffer=function(){return this.slice()};Xn.prototype.toString=function(n,e,t){return this.slice(e,t).toString(n)}});var UQ=v((J4e,YQ)=>{YQ.exports=function(n){function e(i,r){var o=t.store,s=i.split(".");s.slice(0,-1).forEach(function(l){o[l]===void 0&&(o[l]={}),o=o[l]});var a=s[s.length-1];return arguments.length==1?o[a]:o[a]=r}var t={get:function(i){return e(i)},set:function(i,r){return e(i,r)},store:n||{}};return t}});var zQ=v((Nu,GQ)=>{var Uwe=BQ(),ZQ=require("events").EventEmitter,Zwe=qQ(),e0=UQ(),Jwe=require("stream").Stream;Nu=GQ.exports=function(n,e){if(Buffer.isBuffer(n))return Nu.parse(n);var t=Nu.stream();return n&&n.pipe?n.pipe(t):n&&(n.on(e||"data",function(i){t.write(i)}),n.on("end",function(){t.end()})),t};Nu.stream=function(n){if(n)return Nu.apply(null,arguments);var e=null;function t(h,d,g){e={bytes:h,skip:g,cb:function(f){e=null,d(f)}},r()}var i=null;function r(){if(!e){c&&(u=!0);return}if(typeof e=="function")e();else{var h=i+e.bytes;if(a.length>=h){var d;i==null?(d=a.splice(0,h),e.skip||(d=d.slice())):(e.skip||(d=a.slice(i,h)),i=h),e.skip?e.cb():e.cb(d)}}}function o(h){function d(){u||h.next()}var g=XQ(function(f,m){return function(b){t(f,function(w){l.set(b,m(w)),d()})}});return g.tap=function(f){h.nest(f,l.store)},g.into=function(f,m){l.get(f)||l.set(f,{});var b=l;l=e0(b.get(f)),h.nest(function(){m.apply(this,arguments),this.tap(function(){l=b})},l.store)},g.flush=function(){l.store={},d()},g.loop=function(f){var m=!1;h.nest(!1,function b(){this.vars=l.store,f.call(this,function(){m=!0,d()},l.store),this.tap(function(){m?h.next():b.call(this)}.bind(this))},l.store)},g.buffer=function(f,m){typeof m=="string"&&(m=l.get(m)),t(m,function(b){l.set(f,b),d()})},g.skip=function(f){typeof f=="string"&&(f=l.get(f)),t(f,function(){d()})},g.scan=function(m,b){if(typeof b=="string")b=new Buffer(b);else if(!Buffer.isBuffer(b))throw new Error("search must be a Buffer or a string");var w=0;e=function(){var x=a.indexOf(b,i+w),D=x-i-w;x!==-1?(e=null,i!=null?(l.set(m,a.slice(i,i+w+D)),i+=w+D+b.length):(l.set(m,a.slice(0,w+D)),a.splice(0,w+D+b.length)),d(),r()):D=Math.max(a.length-b.length-i-w,0),w+=D},r()},g.peek=function(f){i=0,h.nest(function(){f.call(this,l.store),this.tap(function(){i=null})})},g}var s=Uwe.light(o);s.writable=!0;var a=Zwe();s.write=function(h){a.push(h),r()};var l=e0(),u=!1,c=!1;return s.end=function(){c=!0},s.pipe=Jwe.prototype.pipe,Object.getOwnPropertyNames(ZQ.prototype).forEach(function(h){s[h]=ZQ.prototype[h]}),s};Nu.parse=function(e){var t=XQ(function(o,s){return function(a){if(i+o<=e.length){var l=e.slice(i,i+o);i+=o,r.set(a,s(l))}else r.set(a,null);return t}}),i=0,r=e0();return t.vars=r.store,t.tap=function(o){return o.call(t,r.store),t},t.into=function(o,s){r.get(o)||r.set(o,{});var a=r;return r=e0(a.get(o)),s.call(t,r.store),r=a,t},t.loop=function(o){for(var s=!1,a=function(){s=!0};s===!1;)o.call(t,a,r.store);return t},t.buffer=function(o,s){typeof s=="string"&&(s=r.get(s));var a=e.slice(i,Math.min(e.length,i+s));return i+=s,r.set(o,a),t},t.skip=function(o){return typeof o=="string"&&(o=r.get(o)),i+=o,t},t.scan=function(o,s){if(typeof s=="string")s=new Buffer(s);else if(!Buffer.isBuffer(s))throw new Error("search must be a Buffer or a string");r.set(o,null);for(var a=0;a+i<=e.length-s.length+1;a++){for(var l=0;l=e.length},t};function JQ(n){for(var e=0,t=0;t{var KQ=require("stream").Transform,Gwe=require("util");function Hu(n,e){if(!(this instanceof Hu))return new Hu;KQ.call(this);var t=typeof n=="object"?n.pattern:n;this.pattern=Buffer.isBuffer(t)?t:Buffer.from(t),this.requiredLength=this.pattern.length,n.requiredExtraSize&&(this.requiredLength+=n.requiredExtraSize),this.data=new Buffer(""),this.bytesSoFar=0,this.matchFn=e}Gwe.inherits(Hu,KQ);Hu.prototype.checkDataChunk=function(n){var e=this.data.length>=this.requiredLength;if(e){var t=this.data.indexOf(this.pattern,n?1:0);if(t>=0&&t+this.requiredLength>this.data.length){if(t>0){var i=this.data.slice(0,t);this.push(i),this.bytesSoFar+=t,this.data=this.data.slice(t)}return}if(t===-1){var r=this.data.length-this.requiredLength+1,i=this.data.slice(0,r);this.push(i),this.bytesSoFar+=r,this.data=this.data.slice(r);return}if(t>0){var i=this.data.slice(0,t);this.data=this.data.slice(t),this.push(i),this.bytesSoFar+=t}var o=this.matchFn?this.matchFn(this.data,this.bytesSoFar):!0;if(o){this.data=new Buffer("");return}return!0}};Hu.prototype._transform=function(n,e,t){this.data=Buffer.concat([this.data,n]);for(var i=!0;this.checkDataChunk(!i);)i=!1;t()};Hu.prototype._flush=function(n){if(this.data.length>0)for(var e=!0;this.checkDataChunk(!e);)e=!1;this.data.length>0&&(this.push(this.data),this.data=null),n()};QQ.exports=Hu});var tV=v((X4e,eV)=>{"use strict";var MI=require("stream"),zwe=require("util").inherits;function cm(){if(!(this instanceof cm))return new cm;MI.PassThrough.call(this),this.path=null,this.type=null,this.isDirectory=!1}zwe(cm,MI.PassThrough);cm.prototype.autodrain=function(){return this.pipe(new MI.Transform({transform:function(n,e,t){t()}}))};eV.exports=cm});var OI=v((G4e,nV)=>{"use strict";var pl=zQ(),jI=require("stream"),Kwe=require("util"),Qwe=require("zlib"),Vwe=VQ(),iV=tV(),We={STREAM_START:0,START:1,LOCAL_FILE_HEADER:2,LOCAL_FILE_HEADER_SUFFIX:3,FILE_DATA:4,FILE_DATA_END:5,DATA_DESCRIPTOR:6,CENTRAL_DIRECTORY_FILE_HEADER:7,CENTRAL_DIRECTORY_FILE_HEADER_SUFFIX:8,CDIR64_END:9,CDIR64_END_DATA_SECTOR:10,CDIR64_LOCATOR:11,CENTRAL_DIRECTORY_END:12,CENTRAL_DIRECTORY_END_COMMENT:13,TRAILING_JUNK:14,ERROR:99},hm=4294967296,exe=67324752,txe=134695760,ixe=33639248,nxe=101075792,rxe=117853008,oxe=101010256;function vn(n){if(!(this instanceof vn))return new vn(n);jI.Transform.call(this),this.options=n||{},this.data=new Buffer(""),this.state=We.STREAM_START,this.skippedBytes=0,this.parsedEntity=null,this.outStreamInfo={}}Kwe.inherits(vn,jI.Transform);vn.prototype.processDataChunk=function(n){var e;switch(this.state){case We.STREAM_START:case We.START:e=4;break;case We.LOCAL_FILE_HEADER:e=26;break;case We.LOCAL_FILE_HEADER_SUFFIX:e=this.parsedEntity.fileNameLength+this.parsedEntity.extraFieldLength;break;case We.DATA_DESCRIPTOR:e=12;break;case We.CENTRAL_DIRECTORY_FILE_HEADER:e=42;break;case We.CENTRAL_DIRECTORY_FILE_HEADER_SUFFIX:e=this.parsedEntity.fileNameLength+this.parsedEntity.extraFieldLength+this.parsedEntity.fileCommentLength;break;case We.CDIR64_END:e=52;break;case We.CDIR64_END_DATA_SECTOR:e=this.parsedEntity.centralDirectoryRecordSize-44;break;case We.CDIR64_LOCATOR:e=16;break;case We.CENTRAL_DIRECTORY_END:e=18;break;case We.CENTRAL_DIRECTORY_END_COMMENT:e=this.parsedEntity.commentLength;break;case We.FILE_DATA:return 0;case We.FILE_DATA_END:return 0;case We.TRAILING_JUNK:return this.options.debug&&console.log("found",n.length,"bytes of TRAILING_JUNK"),n.length;default:return n.length}var t=n.length;if(t>>8,(o&255)===80){s=a;break}return this.skippedBytes+=s,this.options.debug&&console.log("Skipped",this.skippedBytes,"bytes"),s}this.state=We.ERROR;var l=r?"Not a valid zip file":"Invalid signature in zip file";if(this.options.debug){var u=n.readUInt32LE(0),c;try{c=n.slice(0,4).toString()}catch{}console.log("Unexpected signature in zip file: 0x"+u.toString(16),'"'+c+'", skipped',this.skippedBytes,"bytes")}return this.emit("error",new Error(l)),n.length}return this.skippedBytes=0,e;case We.LOCAL_FILE_HEADER:return this.parsedEntity=this._readFile(n),this.state=We.LOCAL_FILE_HEADER_SUFFIX,e;case We.LOCAL_FILE_HEADER_SUFFIX:var h=new iV,d=(this.parsedEntity.flags&2048)!==0;h.path=this._decodeString(n.slice(0,this.parsedEntity.fileNameLength),d);var f=n.slice(this.parsedEntity.fileNameLength,this.parsedEntity.fileNameLength+this.parsedEntity.extraFieldLength),m=this._readExtraFields(f);if(m&&m.parsed&&(m.parsed.path&&!d&&(h.path=m.parsed.path),Number.isFinite(m.parsed.uncompressedSize)&&this.parsedEntity.uncompressedSize===hm-1&&(this.parsedEntity.uncompressedSize=m.parsed.uncompressedSize),Number.isFinite(m.parsed.compressedSize)&&this.parsedEntity.compressedSize===hm-1&&(this.parsedEntity.compressedSize=m.parsed.compressedSize)),this.parsedEntity.extra=m.parsed||{},this.options.debug){let M=Object.assign({},this.parsedEntity,{path:h.path,flags:"0x"+this.parsedEntity.flags.toString(16),extraFields:m&&m.debug});console.log("decoded LOCAL_FILE_HEADER:",JSON.stringify(M,null,2))}return this._prepareOutStream(this.parsedEntity,h),this.emit("entry",h),this.state=We.FILE_DATA,e;case We.CENTRAL_DIRECTORY_FILE_HEADER:return this.parsedEntity=this._readCentralDirectoryEntry(n),this.state=We.CENTRAL_DIRECTORY_FILE_HEADER_SUFFIX,e;case We.CENTRAL_DIRECTORY_FILE_HEADER_SUFFIX:var d=(this.parsedEntity.flags&2048)!==0,g=this._decodeString(n.slice(0,this.parsedEntity.fileNameLength),d),f=n.slice(this.parsedEntity.fileNameLength,this.parsedEntity.fileNameLength+this.parsedEntity.extraFieldLength),m=this._readExtraFields(f);m&&m.parsed&&m.parsed.path&&!d&&(g=m.parsed.path),this.parsedEntity.extra=m.parsed;var b=(this.parsedEntity.versionMadeBy&65280)>>8===3,w,x;if(b){w=this.parsedEntity.externalFileAttributes>>>16;var D=w>>>12;x=(D&10)===10}if(this.options.debug){let M=Object.assign({},this.parsedEntity,{path:g,flags:"0x"+this.parsedEntity.flags.toString(16),unixAttrs:w&&"0"+w.toString(8),isSymlink:x,extraFields:m.debug});console.log("decoded CENTRAL_DIRECTORY_FILE_HEADER:",JSON.stringify(M,null,2))}return this.state=We.START,e;case We.CDIR64_END:return this.parsedEntity=this._readEndOfCentralDirectory64(n),this.options.debug&&console.log("decoded CDIR64_END_RECORD:",this.parsedEntity),this.state=We.CDIR64_END_DATA_SECTOR,e;case We.CDIR64_END_DATA_SECTOR:return this.state=We.START,e;case We.CDIR64_LOCATOR:return this.state=We.START,e;case We.CENTRAL_DIRECTORY_END:return this.parsedEntity=this._readEndOfCentralDirectory(n),this.options.debug&&console.log("decoded CENTRAL_DIRECTORY_END:",this.parsedEntity),this.state=We.CENTRAL_DIRECTORY_END_COMMENT,e;case We.CENTRAL_DIRECTORY_END_COMMENT:return this.options.debug&&console.log("decoded CENTRAL_DIRECTORY_END_COMMENT:",n.slice(0,e).toString()),this.state=We.TRAILING_JUNK,e;case We.ERROR:return n.length;default:return console.log("didn't handle state #",this.state,"discarding"),n.length}};vn.prototype._prepareOutStream=function(n,e){var t=this,i=n.uncompressedSize===0&&/[\/\\]$/.test(e.path);e.path=e.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/,""),e.type=i?"Directory":"File",e.isDirectory=i;var r=!(n.flags&8);r&&(e.size=n.uncompressedSize);var o=n.versionsNeededToExtract<=45;if(this.outStreamInfo={stream:null,limit:r?n.compressedSize:-1,written:0},r)this.outStreamInfo.stream=new jI.PassThrough;else{var s=new Buffer(4);s.writeUInt32LE(txe,0);var a=n.extra.zip64Mode,l=a?20:12,u={pattern:s,requiredExtraSize:l},c=new Vwe(u,function(m,b){var w=t._readDataDescriptor(m,a),x=w.compressedSize===b;if(!a&&!x&&b>=hm)for(var D=b-hm;D>=0&&(x=w.compressedSize===D,!x);)D-=hm;if(x){t.state=We.FILE_DATA_END;var M=a?24:16;return t.data.length>0?t.data=Buffer.concat([m.slice(M),t.data]):t.data=m.slice(M),!0}});this.outStreamInfo.stream=c}var h=n.flags&1||n.flags&64;if(h||!o){var d=h?"Encrypted files are not supported!":"Zip version "+Math.floor(n.versionsNeededToExtract/10)+"."+n.versionsNeededToExtract%10+" is not supported";e.skip=!0,setImmediate(()=>{e.emit("error",new Error(d))}),this.outStreamInfo.stream.pipe(new iV().autodrain());return}var g=n.compressionMethod>0;if(g){var f=Qwe.createInflateRaw();f.on("error",function(m){t.state=We.ERROR,t.emit("error",m)}),this.outStreamInfo.stream.pipe(f).pipe(e)}else this.outStreamInfo.stream.pipe(e);this._drainAllEntries&&e.autodrain()};vn.prototype._readFile=function(n){var e=pl.parse(n).word16lu("versionsNeededToExtract").word16lu("flags").word16lu("compressionMethod").word16lu("lastModifiedTime").word16lu("lastModifiedDate").word32lu("crc32").word32lu("compressedSize").word32lu("uncompressedSize").word16lu("fileNameLength").word16lu("extraFieldLength").vars;return e};vn.prototype._readExtraFields=function(n){var e={},t={parsed:e};this.options.debug&&(t.debug=[]);for(var i=0;i=x+4&&a&1&&(e.mtime=new Date(n.readUInt32LE(i+x)*1e3),x+=4),r.extraSize>=x+4&&a&2&&(e.atime=new Date(n.readUInt32LE(i+x)*1e3),x+=4),r.extraSize>=x+4&&a&4&&(e.ctime=new Date(n.readUInt32LE(i+x)*1e3));break;case 28789:o="Info-ZIP Unicode Path Extra Field";var l=n.readUInt8(i);if(l===1){var x=1,u=n.readUInt32LE(i+x);x+=4;var c=n.slice(i+x);e.path=c.toString()}break;case 13:case 22613:o=r.extraId===13?"PKWARE Unix":"Info-ZIP UNIX (type 1)";var x=0;if(r.extraSize>=8){var h=new Date(n.readUInt32LE(i+x)*1e3);x+=4;var d=new Date(n.readUInt32LE(i+x)*1e3);if(x+=4,e.atime=h,e.mtime=d,r.extraSize>=12){var g=n.readUInt16LE(i+x);x+=2;var f=n.readUInt16LE(i+x);x+=2,e.uid=g,e.gid=f}}break;case 30805:o="Info-ZIP UNIX (type 2)";var x=0;if(r.extraSize>=4){var g=n.readUInt16LE(i+x);x+=2;var f=n.readUInt16LE(i+x);x+=2,e.uid=g,e.gid=f}break;case 30837:o="Info-ZIP New Unix";var x=0,m=n.readUInt8(i);if(x+=1,m===1){var b=n.readUInt8(i+x);x+=1,b<=6&&(e.uid=n.readUIntLE(i+x,b)),x+=b;var w=n.readUInt8(i+x);x+=1,w<=6&&(e.gid=n.readUIntLE(i+x,w))}break;case 30062:o="ASi Unix";var x=0;if(r.extraSize>=14){var D=n.readUInt32LE(i+x);x+=4;var M=n.readUInt16LE(i+x);x+=2;var L=n.readUInt32LE(i+x);x+=4;var g=n.readUInt16LE(i+x);x+=2;var f=n.readUInt16LE(i+x);if(x+=2,e.mode=M,e.uid=g,e.gid=f,r.extraSize>14){var W=i+x,N=i+r.extraSize-14,V=this._decodeString(n.slice(W,N));e.symlink=V}}break}this.options.debug&&t.debug.push({extraId:"0x"+r.extraId.toString(16),description:o,data:n.slice(i,i+r.extraSize).inspect()}),i+=r.extraSize}return t};vn.prototype._readDataDescriptor=function(n,e){if(e){var t=pl.parse(n).word32lu("dataDescriptorSignature").word32lu("crc32").word64lu("compressedSize").word64lu("uncompressedSize").vars;return t}var t=pl.parse(n).word32lu("dataDescriptorSignature").word32lu("crc32").word32lu("compressedSize").word32lu("uncompressedSize").vars;return t};vn.prototype._readCentralDirectoryEntry=function(n){var e=pl.parse(n).word16lu("versionMadeBy").word16lu("versionsNeededToExtract").word16lu("flags").word16lu("compressionMethod").word16lu("lastModifiedTime").word16lu("lastModifiedDate").word32lu("crc32").word32lu("compressedSize").word32lu("uncompressedSize").word16lu("fileNameLength").word16lu("extraFieldLength").word16lu("fileCommentLength").word16lu("diskNumber").word16lu("internalFileAttributes").word32lu("externalFileAttributes").word32lu("offsetToLocalFileHeader").vars;return e};vn.prototype._readEndOfCentralDirectory64=function(n){var e=pl.parse(n).word64lu("centralDirectoryRecordSize").word16lu("versionMadeBy").word16lu("versionsNeededToExtract").word32lu("diskNumber").word32lu("diskNumberWithCentralDirectoryStart").word64lu("centralDirectoryEntries").word64lu("totalCentralDirectoryEntries").word64lu("sizeOfCentralDirectory").word64lu("offsetToStartOfCentralDirectory").vars;return e};vn.prototype._readEndOfCentralDirectory=function(n){var e=pl.parse(n).word16lu("diskNumber").word16lu("diskStart").word16lu("centralDirectoryEntries").word16lu("totalCentralDirectoryEntries").word32lu("sizeOfCentralDirectory").word32lu("offsetToStartOfCentralDirectory").word16lu("commentLength").vars;return e};var sxe="\0\u263A\u263B\u2665\u2666\u2663\u2660\u2022\u25D8\u25CB\u25D9\u2642\u2640\u266A\u266B\u263C\u25BA\u25C4\u2195\u203C\xB6\xA7\u25AC\u21A8\u2191\u2193\u2192\u2190\u221F\u2194\u25B2\u25BC !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u2302\xC7\xFC\xE9\xE2\xE4\xE0\xE5\xE7\xEA\xEB\xE8\xEF\xEE\xEC\xC4\xC5\xC9\xE6\xC6\xF4\xF6\xF2\xFB\xF9\xFF\xD6\xDC\xA2\xA3\xA5\u20A7\u0192\xE1\xED\xF3\xFA\xF1\xD1\xAA\xBA\xBF\u2310\xAC\xBD\xBC\xA1\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\xDF\u0393\u03C0\u03A3\u03C3\xB5\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229\u2261\xB1\u2265\u2264\u2320\u2321\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0 ";vn.prototype._decodeString=function(n,e){if(e)return n.toString("utf8");if(this.options.decodeString)return this.options.decodeString(n);let t="";for(var i=0;i0&&(this.data=this.data.slice(t),this.data.length!==0););if(this.state===We.FILE_DATA){if(this.outStreamInfo.limit>=0){var i=this.outStreamInfo.limit-this.outStreamInfo.written,r;i{if(this.state===We.FILE_DATA_END)return this.state=We.START,o.end(e);e()})}return}e()};vn.prototype.drainAll=function(){this._drainAllEntries=!0};vn.prototype._transform=function(n,e,t){var i=this;i.data.length>0?i.data=Buffer.concat([i.data,n]):i.data=n;var r=i.data.length,o=function(){if(i.data.length>0&&i.data.length0){e._parseOrOutput("buffer",function(){if(e.data.length>0)return setImmediate(function(){e._flush(n)});n()});return}if(e.state===We.FILE_DATA)return n(new Error("Stream finished in an invalid state, uncompression failed"));setImmediate(n)};nV.exports=vn});var oV=v((z4e,rV)=>{var dm=require("stream").Transform,axe=require("util"),lxe=OI();function fl(n){if(!(this instanceof fl))return new fl(n);var e=n||{};dm.call(this,{readableObjectMode:!0}),this.opts=n||{},this.unzipStream=new lxe(this.opts);var t=this;this.unzipStream.on("entry",function(i){t.push(i)}),this.unzipStream.on("error",function(i){t.emit("error",i)})}axe.inherits(fl,dm);fl.prototype._transform=function(n,e,t){this.unzipStream.write(n,e,t)};fl.prototype._flush=function(n){var e=this;this.unzipStream.end(function(){process.nextTick(function(){e.emit("close")}),n()})};fl.prototype.on=function(n,e){return n==="entry"?dm.prototype.on.call(this,"data",e):dm.prototype.on.call(this,n,e)};fl.prototype.drainAll=function(){return this.unzipStream.drainAll(),this.pipe(new dm({objectMode:!0,transform:function(n,e,t){t()}}))};rV.exports=fl});var uV=v((K4e,lV)=>{var gm=require("path"),sV=require("fs"),aV=parseInt("0777",8);lV.exports=gd.mkdirp=gd.mkdirP=gd;function gd(n,e,t,i){typeof e=="function"?(t=e,e={}):(!e||typeof e!="object")&&(e={mode:e});var r=e.mode,o=e.fs||sV;r===void 0&&(r=aV),i||(i=null);var s=t||function(){};n=gm.resolve(n),o.mkdir(n,r,function(a){if(!a)return i=i||n,s(null,i);switch(a.code){case"ENOENT":if(gm.dirname(n)===n)return s(a);gd(gm.dirname(n),e,function(l,u){l?s(l,u):gd(n,e,s,u)});break;default:o.stat(n,function(l,u){l||!u.isDirectory()?s(a,i):s(null,i)});break}})}gd.sync=function n(e,t,i){(!t||typeof t!="object")&&(t={mode:t});var r=t.mode,o=t.fs||sV;r===void 0&&(r=aV),i||(i=null),e=gm.resolve(e);try{o.mkdirSync(e,r),i=i||e}catch(a){switch(a.code){case"ENOENT":i=n(gm.dirname(e),t,i),n(e,t,i);break;default:var s;try{s=o.statSync(e)}catch{throw a}if(!s.isDirectory())throw a;break}}return i}});var gV=v((Q4e,dV)=>{var uxe=require("fs"),cV=require("path"),cxe=require("util"),hxe=uV(),hV=require("stream").Transform,dxe=OI();function ml(n){if(!(this instanceof ml))return new ml(n);hV.call(this),this.opts=n||{},this.unzipStream=new dxe(this.opts),this.unfinishedEntries=0,this.afterFlushWait=!1,this.createdDirectories={};var e=this;this.unzipStream.on("entry",this._processEntry.bind(this)),this.unzipStream.on("error",function(t){e.emit("error",t)})}cxe.inherits(ml,hV);ml.prototype._transform=function(n,e,t){this.unzipStream.write(n,e,t)};ml.prototype._flush=function(n){var e=this,t=function(){process.nextTick(function(){e.emit("close")}),n()};this.unzipStream.end(function(){if(e.unfinishedEntries>0)return e.afterFlushWait=!0,e.on("await-finished",t);t()})};ml.prototype._processEntry=function(n){var e=this,t=cV.join(this.opts.path,n.path),i=n.isDirectory?t:cV.dirname(t);this.unfinishedEntries++;var r=function(){var o=uxe.createWriteStream(t);o.on("close",function(){e.unfinishedEntries--,e._notifyAwaiter()}),o.on("error",function(s){e.emit("error",s)}),n.pipe(o)};if(this.createdDirectories[i]||i===".")return r();hxe(i,function(o){if(o)return e.emit("error",o);if(e.createdDirectories[i]=!0,n.isDirectory){e.unfinishedEntries--,e._notifyAwaiter();return}r()})};ml.prototype._notifyAwaiter=function(){this.afterFlushWait&&this.unfinishedEntries===0&&(this.emit("await-finished"),this.afterFlushWait=!1)};dV.exports=ml});var pV=v(AI=>{"use strict";AI.Parse=oV();AI.Extract=gV()});function gxe(n){let e=n.etag;if(typeof e=="string"&&(e=e.replace(/^W\//,""),!(!e.startsWith('"')||!e.endsWith('"'))))return e.slice(1,-1)}function pxe(n){let i=Cz().parse(n).parameters.filename;if(i)return E.extname(i)}function pm(n,e,t){let i=A1(n),{etagAlgorithm:r}=e,{dest:o,onProgress:s,extract:a}=e;if(!o||!E.isAbsolute(o))throw new Error(`Invalid dest path: ${o}`);if(!B.existsSync(o))B.mkdirSync(o,{recursive:!0});else{let h=B.statSync(o);if(h&&!h.isDirectory())throw new Error(`${o} exists, but not directory!`)}let l=O1(i),u=H1(i,e);!u.agent&&e.agent&&(u.agent=e.agent);let c=E.extname(i.pathname);return new Promise((h,d)=>{if(t){let m=t.onCancellationRequested(()=>{m.dispose(),f.destroy(new Error("request aborted"))})}let g,f=l.request(u,m=>{if(m.statusCode>=200&&m.statusCode<300||m.statusCode===1223){let b=m.headers,w=b["content-disposition"],x=gxe(b),D=x&&typeof r=="string";if(!c&&w&&(c=pxe(w)),a===!0)if(c===".zip"||b["content-type"]=="application/zip")a="unzip";else if(c==".tgz")a="untar";else{d(new Error(`Unable to detect extract method for ${i}`));return}let M=Number(b["content-length"]),L=!isNaN(M),W=0;m.on("error",he=>{d(new Error(`Unable to connect ${i}: ${he.message}`))});let N=D?Uy.createHash(r):void 0;m.on("data",he=>{if(W+=he.length,N&&N.update(he),L){let re=(W/M*100).toFixed(1);typeof s=="function"?s(re):NI.info(`Download ${i} progress ${re}%`)}}),m.on("end",()=>{clearTimeout(g),g=void 0,NI.info("Download completed:",i)});let V;if(a==="untar"){let he=MQ();V=m.pipe(he.x({strip:e.strip??1,C:o}))}else if(a==="unzip"){let he=pV();V=m.pipe(he.Extract({path:o}))}else o=E.join(o,`${mu()}${c}`),V=m.pipe(B.createWriteStream(o));V.on("finish",()=>{if(N&&N.digest("hex")!==x){d(new Error(`Etag check failed by ${r}, content not match.`));return}NI.info(`Downloaded ${i} => ${o}`),setTimeout(()=>{h(o)},100)}),V.on("error",d)}else d(new Error(`Invalid response from ${i}: ${m.statusCode}`))});f.on("error",m=>{if(u.agent&&m.code=="ECONNRESET")g=setTimeout(()=>{d(m)},j1);else{if(clearTimeout(g),u.agent&&u.agent.proxy){d(new Error(`Request failed using proxy ${u.agent.proxy.host}: ${m.message}`));return}d(m)}}),f.on("timeout",()=>{f.destroy(new Error(`request timeout after ${e.timeout}ms`))}),typeof e.timeout=="number"&&e.timeout&&f.setTimeout(e.timeout),f.end()})}var NI,HI=k(()=>{"use strict";gt();Ee();fe();WC();NI=te("model-download")});function mxe(n=Bt.homedir()){let e,t=E.join(n,".npmrc");if(B.existsSync(t))try{let i=B.readFileSync(t,"utf8"),r;for(let o of i.split(/\r?\n/)){if(o.startsWith("#"))continue;let s=o.match(/^(.*?)=(.*)$/);s&&s[1]==="coc.nvim:registry"&&(r=s[2])}r&&(e=new t0.URL(r))}catch(i){bV.debug("Error on parse .npmrc:",i)}return e??new t0.URL("https://registry.npmjs.org")}function bxe(n){let e=E.basename(n);return e==="npm"||e==="npm.CMD"}function yxe(n){let e=E.basename(n);return["yarn","yarn.CMD","yarnpkg","yarnpkg.CMD"].includes(e)}function vxe(n){let e=E.basename(n);return e==="pnpm"||e==="pnpm.CMD"}function fV(n){return!!(B.existsSync(n)&&B.lstatSync(n).isSymbolicLink())}function wxe(n){return Object.keys(n.dependencies??{}).filter(e=>!fxe.includes(e))}var mV,t0,bV,fxe,i0,yV=k(()=>{"use strict";mV=require("events"),t0=require("url");gt();Ee();HI();WC();pt();fe();Ce();be();bV=te("extension-installer"),fxe=["coc.nvim","esbuild","webpack","@types/node"];i0=class extends mV.EventEmitter{constructor(t,i,r){super();this.root=t;this.npm=i;this.def=r;if(/^https?:/.test(r))this.url=r;else{let o=r.match(/(.+)@([^/]+)$/);o?(this.name=o[1],this.version=o[2]):this.name=r}}get info(){return{name:this.name,version:this.version}}async getInfo(){if(this.url)return await this.getInfoFromUri();let t=mxe();this.log(`Get info from ${t}`);let i=await this.fetch(new t0.URL(this.name,t),{timeout:1e4,buffer:!0}),r=JSON.parse(i.toString());this.version||(this.version=r["dist-tags"].latest);let o=r.versions[this.version];if(!o)throw new Error(`${this.def} doesn't exists in ${t}.`);let s=o.engines&&o.engines.coc;if(!s)throw new Error(`${this.def} is not a valid coc extension, "engines" field with coc property required.`);return{"dist.tarball":o.dist.tarball,"engines.coc":s,version:o.version,name:r.name}}async getInfoFromUri(){let{url:t}=this;if(!t.startsWith("https://github.com"))throw new Error(`"${t}" is not supported, coc.nvim support github.com only`);t=t.replace(/\/$/,"");let i="master";if(t.includes("@")){let a=t.indexOf("@");i=t.substr(a+1),t=t.substring(0,a)}let r=t.replace("github.com","raw.githubusercontent.com")+`/${i}/package.json`;this.log(`Get info from ${r}`);let o=await this.fetch(r,{timeout:1e4}),s=typeof o=="string"?JSON.parse(o):o;return this.name=s.name,{"dist.tarball":`${t}/archive/${i}.tar.gz`,"engines.coc":s.engines?s.engines.coc:null,name:s.name,version:s.version}}log(t,i=!1){this.emit("message",t,i)}async install(){this.log(`Using npm from: ${this.npm}`);let t=await this.getInfo();bV.info(`Fetched info of ${this.def}`,t);let{name:i,version:r}=t,o=de(t["engines.coc"]).replace(/^\^/,">=");if(o&&!Mr.satisfies(y.version,o))throw new Error(`${i} ${t.version} requires coc.nvim >= ${o}, please update coc.nvim.`);let s=await this.doInstall(t);return{name:i,updated:s,version:r,url:this.url,folder:E.join(this.root,t.name)}}async update(t){t&&(this.url=t);let i;if(this.name){let l=E.join(this.root,this.name);if(fV(l)){this.log("Skipped update for symbol link");return}i=So(E.join(l,"package.json")).version}this.log(`Using npm from: ${this.npm}`);let r=await this.getInfo();if(i&&r.version&&Mr.gte(i,r.version)){this.log(`Current version ${i} is up to date.`);return}let o=r["engines.coc"]?r["engines.coc"].replace(/^\^/,">="):"";if(o&&!Mr.satisfies(y.version,o))throw new Error(`${r.version} requires coc.nvim ${o}, please update coc.nvim.`);if(!await this.doInstall(r))return;let a=E.join(this.root,r.name,"package.json");return this.log(`Updated to v${r.version}`),E.dirname(a)}getInstallArguments(t,i){let r=["install","--ignore-scripts","--no-lockfile"];return i&&i.startsWith("https://github.com")&&(r=["install"]),bxe(t)&&(r.push("--omit=dev"),r.push("--legacy-peer-deps"),r.push("--no-global")),yxe(t)&&(r.push("--production"),r.push("--ignore-engines")),vxe(t)&&(r.push("--production"),r.push("--config.strict-peer-dependencies=false")),r}readLines(t,i){Bo.createInterface({input:i}).on("line",o=>{this.log(`${t} ${o}`,!0)})}installDependencies(t,i){return i.length==0?Promise.resolve():new Promise((r,o)=>{let s=this.getInstallArguments(this.npm,this.url);this.log(`Installing dependencies by: ${this.npm} ${s.join(" ")}.`);let a=process.platform==="win32"&&this.npm.includes(" ")?`"${this.npm}"`:this.npm,l=qn.spawn(a,s,{cwd:t,shell:process.platform==="win32",env:Object.assign(process.env,{NODE_ENV:"production"})});this.readLines("[npm stdout]",l.stdout),this.readLines("[npm stderr]",l.stderr),l.stderr.setEncoding("utf8"),l.stdout.setEncoding("utf8"),l.on("error",o),l.on("exit",u=>{if(u){o(new Error(`${this.npm} install exited with ${u}`));return}r()})})}async doInstall(t){let i=E.join(this.root,t.name);if(fV(i))return!1;let r=t.name.replace(/\//g,"_"),o=E.join(this.root,`${r}-${Te()}`),s=t["dist.tarball"];this.log(`Downloading from ${s}`);let a=s.startsWith("https://registry.npmjs.org")?"md5":void 0;try{await this.download(s,{dest:o,etagAlgorithm:a,extract:"untar",onProgress:u=>this.log(`Download progress ${u}%`,!0)}),this.log(`Extension download at ${o}`);let l=So(E.join(o,"package.json"));await this.installDependencies(o,wxe(l))}catch(l){throw B.rmSync(o,{recursive:!0,force:!0}),l}return this.log(`Download extension ${t.name}@${t.version} at ${o}`),B.mkdirSync(E.dirname(i),{recursive:!0}),B.existsSync(i)&&B.rmSync(i,{force:!0,recursive:!0}),B.renameSync(o,i),this.log(`Move extension ${t.name}@${t.version} to ${i}`),!0}async download(t,i){return await pm(t,i)}async fetch(t,i={}){return await Bf(t,i)}}});var fm,vV=k(()=>{"use strict";pt();fe();Ye();fm=class{constructor(e){this.filepath=e;B.existsSync(e)||B.writeFileSync(e,"{}","utf8")}merge(e){if(!B.existsSync(e))return;let t=So(e),i=So(this.filepath);Object.assign(i,t),Ea(this.filepath,i),B.unlinkSync(e)}fetchContent(e,t){let r=So(this.filepath)[e];if(r)return r[t]}async update(e,t,i){let{filepath:r}=this,o=So(r);o[e]=o[e]||{},i!==void 0?o[e][t]=Ki(i):delete o[e][t],Ea(r,o)}createMemento(e){return{get:(t,i)=>{let r=this.fetchContent(e,t);return r===void 0?i:r},update:async(t,i)=>{await this.update(e,t,i)}}}}});var wV,xxe,Cxe,mm,xV=k(()=>{"use strict";wV=require("events");Ee();se();fe();be();xxe=qn.spawn,Cxe=te("list-commandTask"),mm=class extends wV.EventEmitter{constructor(t){super();this.opt=t;this.disposables=[];this.start()}start(){let{cmd:t,args:i,cwd:r,onLine:o}=this.opt,s=xxe(t,i,{cwd:r||y.cwd,windowsHide:!0,shell:process.platform==="win32"});this.disposables.push({dispose:()=>{s.kill()}}),s.on("error",l=>{this.emit("error",l.message)}),s.stderr.on("data",l=>{Cxe.error(`[${t} Error]`,l.toString("utf8"))});let a=Bo.createInterface(s.stdout);a.on("line",l=>{let u=o(l);u&&this.emit("data",u)}),a.on("close",()=>{this.emit("end")})}dispose(){z(this.disposables)}}});var Bu,BI,bt,bl=k(()=>{"use strict";Ze();be();Bu=["","","","","","","","","","","","","","","","","","","","<2-LeftMouse>","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""],BI=class{get debounceTime(){return this.get("interactiveDebounceTime",100)}get extendedSearchMode(){return this.get("extendedSearchMode",!0)}get smartcase(){return this.get("smartCase",!1)}get signOffset(){return this.get("signOffset",900)}get(e,t){return y.initialConfiguration.get("list."+e,t)}get previousKey(){return this.fixKey(this.get("previousKeymap",""))}get nextKey(){return this.fixKey(this.get("nextKeymap",""))}fixKey(e){if(Bu.includes(e))return e;let t=Bu.find(i=>i.toLowerCase()==e.toLowerCase());return t||(R.showErrorMessage(`Configured key "${e}" not supported.`),null)}},bt=new BI});function Sxe(n){switch(n){case"latex":return"tex";default:return n}}var Li,us=k(()=>{"use strict";ye();$e();se();pt();Nt();Ce();be();xV();bl();Li=class{constructor(){this.defaultAction="open";this.actions=[];this.options=[];this.disposables=[];this.nvim=y.nvim,this.config=bt}get alignColumns(){return bt.get("alignColumns",!1)}get floatPreview(){return bt.get("floatPreview",!1)}get hlGroup(){return bt.get("previewHighlightGroup","Search")}get previewHeight(){return bt.get("maxPreviewHeight",12)}get splitRight(){return bt.get("previewSplitRight",!1)}get toplineStyle(){return bt.get("previewToplineStyle","offset")}get toplineOffset(){return bt.get("previewToplineOffset",3)}parseArguments(e){if(!this.optionMap){this.optionMap=new Map;for(let i of this.options){let r=i.name.split(/,\s*/g).map(s=>s.replace(/\s+.*/g,"")),o=i.key?i.key:r[r.length-1].replace(/^-/,"");for(let s of r)this.optionMap.set(s,{name:o,hasValue:i.hasValue})}}let t={};for(let i=0;i{let r=await this.convertLocation(t.location);await this.previewLocation(r,i)}});let{nvim:e}=this;this.createAction({name:"quickfix",multiple:!0,execute:async t=>{let i=await Promise.all(t.map(o=>this.convertLocation(o.location).then(s=>y.getQuickfixItem(s))));await e.call("setqflist",[i]);let r=await e.getVar("coc_quickfix_open_command");e.command(typeof r=="string"?r:"copen",!0)}});for(let t of["open","tabe","drop","vsplit","split"])this.createAction({name:t,execute:async(i,r)=>{await this.jumpTo(i.location,t=="open"?null:t,r)},tabPersist:t==="open"})}async convertLocation(e){if(typeof e=="string")return Xe.create(e,q.create(0,0,0,0));if(Xe.is(e))return e;let t=Y.parse(e.uri);return t.scheme!="file"?Xe.create(e.uri,q.create(0,0,0,0)):await aJ(t.fsPath,e.line,e.text)}async jumpTo(e,t,i){if(t==null&&i&&i.options.position==="tab"&&(t="tabe"),typeof e=="string"){await y.jumpTo(e,null,t);return}let{range:r,uri:o}=await this.convertLocation(e),s=r.start;s.line==0&&s.character==0&&it(s,r.end)==0&&(s=null),await y.jumpTo(o,s,t)}createAction(e){let{name:t}=e,i=this.actions.findIndex(r=>r.name==t);i!==-1&&this.actions.splice(i,1),this.actions.push(e)}async previewLocation(e,t){let{uri:i,range:r}=e,o=y.getDocument(e.uri),s=Y.parse(i),a=await y.documentsManager.getLines(i),l={bufnr:o?o.bufnr:void 0,winid:t.window.id,range:Qt(r)?null:r,lnum:r.start.line+1,name:s.scheme=="file"?s.fsPath:i,filetype:Sxe(o?o.languageId:y.documentsManager.getLanguageId(s.fsPath)),position:t.options.position,maxHeight:this.previewHeight,splitRight:this.splitRight,hlGroup:this.hlGroup,scheme:s.scheme,toplineStyle:this.toplineStyle,toplineOffset:this.toplineOffset,targetRange:e.targetRange};await this.openPreview(a,l)}async preview(e,t){let{bufname:i,filetype:r,range:o,lines:s,lnum:a}=e,l={winid:t.window.id,lnum:o?o.start.line+1:a||1,filetype:r,position:t.options.position,maxHeight:this.previewHeight,splitRight:this.splitRight,hlGroup:this.hlGroup,toplineStyle:this.toplineStyle,toplineOffset:this.toplineOffset};i&&(l.name=i),o&&(l.range=o),await this.openPreview(s,l)}async openPreview(e,t){let{nvim:i}=this;this.floatPreview&&t.position!=="tab"?await i.call("coc#list#float_preview",[e,t]):await i.call("coc#list#preview",[e,t]),i.command("redraw",!0)}doHighlight(){}dispose(){z(this.disposables)}}});function pd(n){let e=n.length,t=new Uint16Array(e);for(let i=0,r=e;i=97&&n<=122&&e+32===n||t&&(n<=90&&n+32===e||WI(n)===e))return!0}else{let i=WI(e);if(i===n||t&&WI(n)===i)return!0}return!1}function WI(n){return String.fromCharCode(n).toLowerCase().charCodeAt(0)}function fd(n,e,t=!1){let i=n.length,r=e.length;if(i>r)return!1;let o=0,s=n[0];for(let a=0;a{"use strict";oi()});var Dxe,YI,bm,UI,ZI=k(()=>{"use strict";fe();Ee();Ce();oi();Dxe=te("list-db"),YI=E.join(Cr,"list_history.dat"),bm=class{constructor(){this.folders=[];this.names=[];this.items=[];this._changed=!1;try{this.load()}catch(e){Dxe.error("Error on load db",e)}}get currItems(){return this.items}getHistory(e,t){let i=this.names.indexOf(e),r=this.folders.indexOf(t);return i==-1||r==-1?[]:this.items.reduce((o,s)=>(s[1]==i&&s[2]==r&&o.push(s[0]),o),[])}addItem(e,t,i){let{folders:r,names:o}=this;me(t)>255&&(t=hi(t,0,255)),r.includes(i)||r.push(i),o.includes(e)||o.push(e);let s=o.indexOf(e),a=r.indexOf(i),l=this.items.findIndex(u=>u[0]==t&&u[1]==s&&u[2]==a);l!=-1&&this.items.splice(l,1),this.items.push([t,s,a]),this._changed=!0}save(){let{folders:e,items:t,names:i}=this;if(!this._changed)return;let r=e.reduce((u,c)=>(u.push(Buffer.from(c,"utf8"),Buffer.alloc(1)),u),[]),o=Buffer.concat(r);r=i.reduce((u,c)=>(u.push(Buffer.from(c,"utf8"),Buffer.alloc(1)),u),[]);let s=Buffer.concat(r),a=Buffer.allocUnsafe(9);a.writeUInt8(2,0),a.writeUInt32BE(o.byteLength,1),a.writeUInt32BE(s.byteLength,5),r=t.reduce((u,c)=>{let h=Buffer.from(c[0],"utf8");return u.push(Buffer.from([h.byteLength]),h,Buffer.from([c[1],c[2]])),u},[]);let l=Buffer.concat([a,o,s,...r]);B.writeFileSync(YI,l),this._changed=!1}load(){if(!B.existsSync(YI))return;let e=B.readFileSync(YI),t=e.readUInt32BE(1),i=e.readUInt32BE(5),r=e.slice(9,9+t),o=0,s=[],a=[];for(let d=0;d{"use strict";fe();Ee();Le();n0();ZI();Ce();Txe=te("list-history"),Wu=class{constructor(e,t,i,r){this.prompt=e;this.name=t;this.db=i;this.cwd=r;this._index=-1;this._filtered=[]}get loaded(){return this.db.getHistory(this.name,this.cwd)}get filtered(){return this._filtered}get index(){return this._index}static migrate(e){try{let t=B.readdirSync(e);if(t=t.filter(r=>r.startsWith("list-")&&r.endsWith("-history.json")&&B.statSync(E.join(e,r)).isFile()),t.length===0)return;let i=new bm;for(let r of t){let o=r.match(/^list-(.*)-history.json$/)[1],s=B.readFileSync(E.join(e,r),"utf8"),a=JSON.parse(s);for(let[l,u]of Object.entries(a)){let c=Buffer.from(l,"base64").toString("utf8");Array.isArray(u)&&u.forEach(h=>{i.addItem(o,h,c)})}}t.forEach(r=>{B.unlinkSync(E.join(e,r))}),i.save()}catch(t){Txe.error("Error on migrate history:",t)}}get curr(){return this._index==-1||this._filtered==null?null:this._filtered[this._index]}filter(){let{input:e}=this.prompt;if(e!==this.curr){if(this.historyInput="",e.length>0){let t=pd(e);this._filtered=this.loaded.filter(i=>fd(t,i))}else this._filtered=this.loaded;this._index=-1}}add(){let{db:e,prompt:t,cwd:i}=this,{input:r}=t;!r||r.length<2||r==this.historyInput||e.addItem(this.name,r,i)}previous(){let{_filtered:e,_index:t}=this;le(e)||(t<=0?this._index=e.length-1:this._index=t-1,this.historyInput=this.prompt.input=de(e[this._index]))}next(){let{_filtered:e,_index:t}=this;le(e)||(t==e.length-1?this._index=0:this._index=t+1,this.historyInput=this.prompt.input=de(e[this._index]))}}});var ym,CV=k(()=>{"use strict";Ze();bl();ym=class{constructor(e,t){this.manager=e;this.nvim=t;this.insertMappings=new Map;this.normalMappings=new Map;this.userInsertMappings=new Map;this.userNormalMappings=new Map;this.actions=new Map;let{prompt:i}=e;this.addAction("do:switch",async()=>{await e.switchMatcher()}),this.addAction("do:selectall",async()=>{await e.session?.ui.selectAll()}),this.addAction("do:help",async()=>{await e.session?.showHelp()}),this.addAction("do:refresh",async()=>{await e.session?.reloadItems()}),this.addAction("do:exit",async()=>{await e.cancel()}),this.addAction("do:stop",()=>{e.stop()}),this.addAction("do:cancel",async()=>{await e.cancel(!1)}),this.addAction("do:toggle",async()=>{await e.session?.ui.toggleSelection()}),this.addAction("do:jumpback",()=>{e.session?.jumpBack()}),this.addAction("do:previous",async()=>{await this.navigate(!0)}),this.addAction("do:next",async()=>{await this.navigate(!1)}),this.addAction("do:defaultaction",async()=>{await e.doAction()}),this.addAction("do:chooseaction",async()=>{await e.chooseAction()}),this.addAction("do:togglemode",()=>{e.toggleMode()}),this.addAction("do:previewtoggle",async()=>{await e.togglePreview()}),this.addAction("do:previewup",()=>{this.scrollPreview("up")}),this.addAction("do:previewdown",()=>{this.scrollPreview("down")}),this.addAction("do:command",async()=>{await e.cancel(!1),await t.eval('feedkeys(":")')}),this.addAction("prompt:previous",()=>{e.session?.history.previous()}),this.addAction("prompt:next",()=>{e.session?.history.next()}),this.addAction("prompt:start",()=>{i.moveToStart()}),this.addAction("prompt:end",()=>{i.moveToEnd()}),this.addAction("prompt:left",()=>{i.moveLeft()}),this.addAction("prompt:right",()=>{i.moveRight()}),this.addAction("prompt:leftword",()=>{i.moveLeftWord()}),this.addAction("prompt:rightword",()=>{i.moveRightWord()}),this.addAction("prompt:deleteforward",()=>{i.onBackspace()}),this.addAction("prompt:deletebackward",()=>{i.removeNext()}),this.addAction("prompt:removetail",()=>{i.removeTail()}),this.addAction("prompt:removeahead",()=>{i.removeAhead()}),this.addAction("prompt:removeword",()=>{i.removeWord()}),this.addAction("prompt:insertregister",()=>{i.insertRegister()}),this.addAction("prompt:paste",async()=>{await i.paste()}),this.addAction("eval",async r=>{await i.eval(r)}),this.addAction("command",async r=>{await e.command(r)}),this.addAction("action",async r=>{await e.doAction(r)}),this.addAction("feedkeys",async r=>{await e.feedkeys(r)}),this.addAction("feedkeys!",async r=>{await e.feedkeys(r,!1)}),this.addAction("normal",async r=>{await e.normal(r,!1)}),this.addAction("normal!",async r=>{await e.normal(r,!0)}),this.addAction("call",async r=>{await e.call(r)}),this.addAction("expr",async r=>{let o=await e.call(r);await e.doAction(o)}),this.addKeyMapping("insert","","do:switch"),this.addKeyMapping("insert","","prompt:next"),this.addKeyMapping("insert","","prompt:previous"),this.addKeyMapping("insert","","prompt:paste"),this.addKeyMapping("insert",["",""],"do:defaultaction"),this.addKeyMapping("insert",["",""," "],"do:chooseaction"),this.addKeyMapping("insert","","do:togglemode"),this.addKeyMapping("insert","","do:stop"),this.addKeyMapping("insert","","do:refresh"),this.addKeyMapping("insert","","prompt:left"),this.addKeyMapping("insert","","prompt:right"),this.addKeyMapping("insert",["",""],"prompt:end"),this.addKeyMapping("insert",["",""],"prompt:start"),this.addKeyMapping("insert",["","",""],"prompt:deleteforward"),this.addKeyMapping("insert","","prompt:removeword"),this.addKeyMapping("insert","","prompt:removeahead"),this.addKeyMapping("insert","","prompt:insertregister"),this.addKeyMapping("normal","t","action:tabe"),this.addKeyMapping("normal","s","action:split"),this.addKeyMapping("normal","d","action:drop"),this.addKeyMapping("normal",["","","\r"],"do:defaultaction"),this.addKeyMapping("normal","","do:selectall"),this.addKeyMapping("normal"," ","do:toggle"),this.addKeyMapping("normal","p","do:previewtoggle"),this.addKeyMapping("normal",[""," ",""],"do:chooseaction"),this.addKeyMapping("normal","","do:stop"),this.addKeyMapping("normal","","do:refresh"),this.addKeyMapping("normal","","do:jumpback"),this.addKeyMapping("normal","","do:previewdown"),this.addKeyMapping("normal","","do:previewup"),this.addKeyMapping("normal",["i","I","o","O","a","A"],"do:togglemode"),this.addKeyMapping("normal","?","do:help"),this.addKeyMapping("normal",":","do:command"),this.createMappings()}createMappings(){let e=bt.get("insertMappings",{});this.userInsertMappings=this.fixUserMappings(e,"list.insertMappings");let t=bt.get("normalMappings",{});this.userNormalMappings=this.fixUserMappings(t,"list.normalMappings")}hasUserMapping(e,t){return(e=="insert"?this.userInsertMappings:this.userNormalMappings).has(t)}isValidAction(e){if(this.actions.has(e))return!0;let[t,i]=e.split(":",2);return!(!i||!this.actions.has(t))}fixUserMappings(e,t){let i=new Map;for(let[r,o]of Object.entries(e)){if(!this.isValidAction(o)){R.showWarningMessage(`Invalid configuration - unable to support action "${o}" in "${t}"`);continue}if(r.length==1)i.set(r,o);else if(r.startsWith("<")&&r.endsWith(">"))if(r.toLowerCase()=="")i.set(" ",o);else if(r.toLowerCase()=="")i.set("",o);else if(Bu.includes(r))i.set(r,o);else{let s=!1;for(let a=0;athis.doAction(e);let[t,i]=e.split(":",2);if(!i||!this.actions.has(t))throw new Error(`Invalid action ${e}`);return()=>this.doAction(t,i)}async doAction(e,t){let i=this.actions.get(e);if(!i)throw new Error(`Action ${e} doesn't exist`);await Promise.resolve(i(t))}scrollPreview(e){let t=bt.get("floatPreview",!1),{nvim:i}=this;i.pauseNotification(),i.call("coc#list#scroll_preview",[e,t],!0),i.command("redraw",!0),i.resumeNotification(!1,!0)}}});var vm,SV=k(()=>{"use strict";ie();bl();vm=class{constructor(e){this.nvim=e;this.cusorIndex=0;this._input="";this._mode="insert";this.interactive=!1;this.requestInput=!1;this._onDidChangeInput=new p.Emitter;this.onDidChangeInput=this._onDidChangeInput.event}get input(){return this._input}set input(e){this._input!=e&&(this.cusorIndex=e.length,this._input=e,this.drawPrompt(),this._onDidChangeInput.fire(this._input))}get mode(){return this._mode}set mode(e){e!=this._mode&&(this._mode=e,this.drawPrompt())}set matcher(e){this._matcher=e,this.drawPrompt()}start(e){e&&(this.interactive=e.interactive,this.cusorIndex=e.input.length,this._input=e.input,this._mode=e.mode,this._matcher=e.interactive?"":e.matcher),this.nvim.call("coc#prompt#start_prompt",["list"],!0),this.drawPrompt()}cancel(){let{nvim:e}=this;e.call("coc#prompt#stop_prompt",["list"],!0)}reset(){this._input="",this.cusorIndex=0}drawPrompt(){let e=bt.get("indicator",">"),{cusorIndex:t,interactive:i,input:r,_matcher:o}=this,s=['echo ""'];if(this.mode=="insert")if(i?s.push("echohl MoreMsg | echon 'INTERACTIVE ' | echohl None"):o&&s.push(`echohl MoreMsg | echon '${o.toUpperCase()} ' | echohl None`),s.push(`echohl Special | echon '${e} ' | echohl None`),t==r.length)s.push(`echon '${r.replace(/'/g,"''")}'`),s.push("echohl Cursor | echon ' ' | echohl None");else{let l=r.slice(0,t);l&&s.push(`echon '${l.replace(/'/g,"''")}'`),s.push(`echohl Cursor | echon '${r[t].replace(/'/,"''")}' | echohl None`);let u=r.slice(t+1);s.push(`echon '${u.replace(/'/g,"''")}'`)}else s.push('echohl MoreMsg | echo "" | echohl None');s.push("redraw");let a=s.join("|");this.nvim.command(a,!0)}moveLeft(){this.cusorIndex!=0&&(this.cusorIndex=this.cusorIndex-1,this.drawPrompt())}moveRight(){this.cusorIndex!=this._input.length&&(this.cusorIndex=this.cusorIndex+1,this.drawPrompt())}moveLeftWord(){let{cusorIndex:e,input:t}=this;if(e==0)return;let i=t.slice(0,e),r=i.replace(/[\w$]+([^\w$]+)?$/,"");this.cusorIndex=e-(i.length-r.length),this.drawPrompt(),this._onDidChangeInput.fire(this._input)}moveRightWord(){let{cusorIndex:e,input:t}=this;if(e==t.length)return;let i=t.slice(e),r=i.match(/[\w$]+ */).at(0)??i;this.cusorIndex=e+r.length,this.drawPrompt(),this._onDidChangeInput.fire(this._input)}moveToEnd(){this.cusorIndex!=this._input.length&&(this.cusorIndex=this._input.length,this.drawPrompt())}moveToStart(){this.cusorIndex!=0&&(this.cusorIndex=0,this.drawPrompt())}onBackspace(){let{cusorIndex:e,input:t}=this;if(e==0)return;let i=t.slice(0,e),r=t.slice(e);this.cusorIndex=e-1,this._input=`${i.slice(0,i.length-1)}${r}`,this.drawPrompt(),this._onDidChangeInput.fire(this._input)}removeNext(){let{cusorIndex:e,input:t}=this;if(e==t.length)return;let i=t.slice(0,e),r=t.slice(e+1);this._input=`${i}${r}`,this.drawPrompt(),this._onDidChangeInput.fire(this._input)}removeWord(){let{cusorIndex:e,input:t}=this;if(e==0)return;let i=t.slice(0,e),r=t.slice(e),o=i.replace(/[\w$]+([^\w$]+)?$/,"");this.cusorIndex=e-(i.length-o.length),this._input=`${o}${r}`,this.drawPrompt(),this._onDidChangeInput.fire(this._input)}removeTail(){let{cusorIndex:e,input:t}=this;if(e==t.length)return;let i=t.slice(0,e);this._input=i,this.drawPrompt(),this._onDidChangeInput.fire(this._input)}removeAhead(){let{cusorIndex:e,input:t}=this;if(e==0)return;let i=t.slice(e);this.cusorIndex=0,this._input=i,this.drawPrompt(),this._onDidChangeInput.fire(this._input)}async acceptCharacter(e){if(this.requestInput){if(this.requestInput=!1,/^[0-9a-z"%#*+/:\-.]$/.test(e)){let t=await this.nvim.call("getreg",e);t=t.replace(/\n/g," "),this.addText(t)}}else this.addText(e)}insertRegister(){this.requestInput=!0}async paste(){let e=await this.nvim.eval("@*");e=e.replace(/\n/g,""),e&&this.addText(e)}async eval(e){let t=await this.nvim.call("eval",[e]);t=t.replace(/\n/g,""),this.addText(t)}addText(e){let{cusorIndex:t,input:i}=this;this.cusorIndex=t+e.length;let r=i.slice(0,t),o=i.slice(t);this._input=`${r}${e}${o}`,this.drawPrompt(),this._onDidChangeInput.fire(this._input)}}});var r0,DV=k(()=>{"use strict";r0=class{constructor(){this._busy=!1;this._fns=[];this._resolves=[]}run(e){this._busy?this._fns.push(e):(this._busy=!0,e().finally(()=>{this.next()}))}waitFinish(){return this._busy?new Promise(e=>{this._resolves.push(e)}):Promise.resolve()}next(){let e=this._fns.shift();e?e().finally(()=>{this.next()}):this.finish()}finish(){this._busy=!1;let e;for(;(e=this._resolves.pop())!=null;)e()}cancel(){this._fns=[],this.finish()}}});var kxe,wm,TV=k(()=>{"use strict";je();se();Le();fe();ie();DV();Ce();be();bl();kxe=ve(100,20),wm=class{constructor(e,t,i){this.nvim=e;this.name=t;this.listOptions=i;this.newTab=!1;this.reversed=!1;this.currIndex=0;this.items=[];this.disposables=[];this.selected=new Set;this.sequence=new r0;this._onDidChangeLine=new p.Emitter;this._onDidOpen=new p.Emitter;this._onDidClose=new p.Emitter;this._onDidLineChange=new p.Emitter;this._onDoubleClick=new p.Emitter;this.onDidChangeLine=this._onDidChangeLine.event;this.onDidLineChange=this._onDidLineChange.event;this.onDidOpen=this._onDidOpen.event;this.onDidClose=this._onDidClose.event;this.onDidDoubleClick=this._onDoubleClick.event;this.newTab=i.position=="tab",this.reversed=i.reverse===!0,F.on("BufWinLeave",async o=>{o!=this.bufnr||this.window==null||(this.window=null,this._onDidClose.fire(o))},null,this.disposables),F.on("CursorMoved",async(o,s)=>{if(o!=this.bufnr)return;let a=this.lnumToIndex(s[0]);this.onLineChange(a)},null,this.disposables);let r=wt(async o=>{if(o!=this.bufnr)return;let[s,a,l]=await e.eval('[win_getid(),line("w0"),line("w$")]');if(l<300||s!=this.winid)return;let u=l-a+1,c=this.lnumToIndex(a),h=this.lnumToIndex(a+u*2);e.pauseNotification(),this.doHighlight(c,h),e.command("redraw",!0),e.resumeNotification(!1,!0)},kxe);this.disposables.push({dispose:()=>{r.clear()}}),F.on("CursorMoved",r,null,this.disposables)}onDidChangeItems(e){e.append||this.clearSelection(),this.sequence.run(async()=>{let{items:t,reload:i,append:r,finished:o,sorted:s}=e;this.shouldSort&&!s&&(t=r?this.items.concat(t):t,i=r==!0,r=!1,t.sort((a,l)=>a.score!=l.score?l.score-a.score:a.sortText>l.sortText?1:-1)),r?await this.appendItems(t):await this.drawItems(t,o,i)})}lnumToIndex(e){let{reversed:t,length:i}=this;return t?Math.max(0,i-e):e-1}indexToLnum(e){let{reversed:t,length:i}=this;return t?Math.max(Math.min(i,i-e),1):Math.min(e+1,i)}get bufnr(){return this.buffer?.id}get winid(){return this.window?.id}get limitLines(){return bt.get("limitLines",1/0)}onLineChange(e){this.currIndex!=e&&(this.currIndex=e,this._onDidChangeLine.fire(e))}get index(){return this.currIndex}getItem(e){return this.items[e]}get item(){let{window:e}=this;return e?e.cursor.then(t=>(this.currIndex=this.lnumToIndex(t[0]),this.items[this.currIndex])):Promise.resolve(null)}async echoMessage(e){let{items:t}=this,r=`[${t.indexOf(e)+1}/${t.length}] ${de(e.label)}`;this.nvim.callTimer("coc#ui#echo_lines",[[r]],!0)}updateItem(e,t){if(!this.buffer||t>=this.length)return;let{nvim:i}=this,r=this.indexToLnum(t);i.pauseNotification(),this.buffer.setOption("modifiable",!0,!0),i.call("setbufline",[this.bufnr,r,e.label],!0),this.doHighlight(t,t+1),this.buffer.setOption("modifiable",!1,!0),i.resumeNotification(!0,!0)}async getItems(){if(this.length==0||!this.window)return[];let e=await this.nvim.call("mode");if(e=="v"||e=="V"){let[r,o]=await this.getSelectedRange(),s=[];for(let a=r;a<=o;a++){let l=this.lnumToIndex(a),u=this.items[l];u&&s.push(u)}return s}let{selectedItems:t}=this;if(t.length)return t;let i=await this.item;return pe(i)}async onMouse(e){let{nvim:t,window:i}=this;if(!i)return;let[r,o,s]=await t.eval("[v:mouse_winid,v:mouse_lnum,v:mouse_col]");if(e=="mouseDown"){this.mouseDown={winid:r,lnum:o,col:s,current:r==i.id};return}let a=r==i.id;if(a&&e=="doubleClick"&&(this.setCursor(o),this._onDoubleClick.fire()),a&&e=="mouseDrag"){if(!this.mouseDown)return;await this.selectLines(this.mouseDown.lnum,o)}else if(a&&e=="mouseUp"){if(!this.mouseDown)return;this.mouseDown.lnum==o?(this.setCursor(o),t.command("redraw",!0)):await this.selectLines(this.mouseDown.lnum,o)}else!a&&e=="mouseUp"&&(t.pauseNotification(),t.call("win_gotoid",r,!0),t.call("cursor",[o,s],!0),t.command("redraw",!0),t.resumeNotification(!1,!0))}async resume(){let{items:e,selected:t,nvim:i}=this;if(await this.drawItems(e,!0,!0),!(!t.size||!this.buffer)){i.pauseNotification();for(let r of t)this.buffer.placeSign({lnum:r,id:bt.signOffset+r,name:"CocSelected",group:"coc-list"});i.command("redraw",!0),i.resumeNotification(!1,!0)}}async toggleSelection(){let{nvim:e,reversed:t}=this;await e.call("win_gotoid",[this.winid]);let i=await e.call("line","."),r=await e.call("mode");if(r=="v"||r=="V"){let[o,s]=await this.getSelectedRange();o>s&&([o,s]=[s,o]);for(let l=o;l<=s;l++)this.toggleLine(l);this.setCursor(s),e.command("redraw",!0),await e.resumeNotification();return}e.pauseNotification(),this.toggleLine(i),this.setCursor(t?i-1:i+1),e.command("redraw",!0),await e.resumeNotification()}toggleLine(e){let{selected:t,buffer:i}=this,r=t.has(e),o=bt.signOffset;r?(t.delete(e),i.unplaceSign({id:o+e,group:"coc-list"})):(t.add(e),i.placeSign({lnum:e,id:o+e,name:"CocSelected",group:"coc-list"}))}async selectLines(e,t){let{nvim:i,buffer:r,length:o}=this,s=bt.signOffset;this.clearSelection();let{selected:a}=this;i.pauseNotification(),e>t&&([e,t]=[t,e]);for(let u=e;u<=t&&!(u>o);u++)a.add(u),r.placeSign({lnum:u,id:s+u,name:"CocSelected",group:"coc-list"});this.setCursor(t),i.command("redraw",!0),await i.resumeNotification()}async selectAll(){let{length:e}=this;e>0&&await this.selectLines(1,e)}clearSelection(){let{selected:e,buffer:t}=this;t&&e.size>0&&(t.unplaceSign({group:"coc-list"}),this.selected.clear())}get ready(){return this.window?Promise.resolve():new Promise(e=>{let t=this.onDidLineChange(()=>{t.dispose(),e()})})}getHeight(e,t){let{listOptions:i}=this;if(typeof i.height=="number")return i.height;let r=bt.get("height",10);return t&&!i.interactive&&i.input.length==0&&(r=Math.min(e,r)),Math.max(1,r)}async drawItems(e,t,i=!1){let{nvim:r,name:o,listOptions:s}=this;if(this.items=e.length>this.limitLines?e.slice(0,this.limitLines):e,!this.window){let c=this.getHeight(e.length,t),{position:h,numberSelect:d}=s,[g,f,m]=await r.call("coc#list#create",[h,c,o,d]);this.tabnr=m,this.height=c,this.buffer=r.createBuffer(g);let b=this.window=r.createWindow(f),w=bt.get("statusLineSegments");w&&b.setOption("statusline",w.join(" "),!0),this._onDidOpen.fire(this.bufnr)}let a=[],l=0;this.items.forEach((c,h)=>{a.push(c.label),!i&&l==0&&c.preselect&&(l=h)});let u=i?this.currIndex:l;this.setLines(a,0,u),this._onDidLineChange.fire()}async appendItems(e){if(!this.window||e.length===0)return;let t=this.items.length,i=this.limitLines-t;if(i>0){let r=io.label),r.length,this.currIndex)}}get shouldSort(){let{matcher:e,interactive:t}=this.listOptions;return!(t||e!=="fuzzy")}setLines(e,t,i){let{nvim:r,buffer:o,window:s,reversed:a,newTab:l}=this;if(!(!o||!s)){if(r.pauseNotification(),t||(r.call("coc#compat#clear_matches",[s.id],!0),e.length||(e=["No results, press ? on normal mode to get help."],r.call("coc#compat#matchaddpos",["Comment",[[1]],99,s.id],!0))),o.setOption("modifiable",!0,!0),a){let u=e.reverse();t?r.call("coc#compat#prepend_lines",[o.id,u],!0):o.setLines(u,{start:0,end:-1,strictIndexing:!1},!0)}else o.setLines(e,{start:t?-1:0,end:-1,strictIndexing:!1},!0);if(o.setOption("modifiable",!1,!0),a&&!l){let u=bt.get("height",10);r.call("coc#window#set_height",[s.id,Math.max(Math.min(u,this.length),1)],!0)}if(i>this.items.length-1&&(i=0),i==0)if(t==0)this.doHighlight(0,299);else{let u=this.length-t-1;u<300&&this.doHighlight(u,Math.min(299,this.length-1))}else{let u=l?y.env.lines:this.height;this.doHighlight(Math.max(0,i-u),Math.min(i+u+1,this.length-1))}if(!t){this.currIndex=i;let u=this.indexToLnum(i);s.setCursor([u,0],!0),r.call("coc#list#select",[o.id,u],!0)}a&&r.command("normal! zb",!0),r.command("redraws",!0),r.resumeNotification(!0,!0)}}restoreWindow(){if(this.newTab)return;let{winid:e,height:t}=this;e&&t&&this.nvim.call("coc#window#set_height",[e,t],!0)}get length(){return this.items.length}get selectedItems(){let{selected:e,items:t}=this,i=[];for(let r of e){let o=this.lnumToIndex(r);t[r-1]&&i.push(t[o])}return i}doHighlight(e,t){let{items:i,reversed:r,length:o,buffer:s}=this,a=[],l=u=>{let c=this.indexToLnum(u)-1,{ansiHighlights:h}=i[u];if(h)for(let d of h){let{span:g,hlGroup:f}=d;a.push({hlGroup:f,lnum:c,colStart:g[0],colEnd:g[1]})}};if(r)for(let u=Math.min(t,o-1);u>=e;u--)l(u);else for(let u=e;u<=Math.min(t,o-1);u++)l(u);e=this.indexToLnum(e)-1,t=this.indexToLnum(t)-1,e>t&&([e,t]=[t,e]),!(!s||a.length==0)&&s.updateHighlights("list",a,{start:e,end:t+1,priority:99})}setCursor(e,t=0,i){let{items:r}=this,o=r.length==0?1:r.length;e>o||(i=i??this.lnumToIndex(e),this.onLineChange(i),this.window?.setCursor([e,t],!0),this.nvim.call("coc#list#select",[this.bufnr,e],!0))}async setIndex(e){if(e<0||e>=this.items.length)return;let{nvim:t}=this,i=this.indexToLnum(e);t.pauseNotification(),this.setCursor(i,0,e),t.command("redraw",!0),await t.resumeNotification(!1)}async moveCursor(e){let{index:t,reversed:i}=this;await this.setIndex(i?t-e:t+e)}async getSelectedRange(){let{nvim:e}=this;await e.call("coc#prompt#stop_prompt",["list"]),await e.eval('feedkeys("\\", "in")');let[,t]=await e.call("getpos","'<"),[,i]=await e.call("getpos","'>");return this.nvim.call("coc#prompt#start_prompt",["list"],!0),[t,i]}cancel(){this.sequence.cancel()}reset(){this.cancel(),this.window&&(this.window=null,this.buffer=null,this.tabnr=void 0)}dispose(){z(this.disposables),this.nvim.call("coc#window#close",[Pe(this.winid,-1)],!0),this.reset(),this.items=[],this._onDidChangeLine.dispose(),this._onDidOpen.dispose(),this._onDidClose.dispose(),this._onDidLineChange.dispose(),this._onDoubleClick.dispose()}}});async function o0(n,e,t,i){if(n.length===0)return;let r=new $I,o=n.length;function s(l){let u=[];r.start();for(let c=l;c{setImmediate(()=>{l(s(a))})})}var kV,$I,PV=k(()=>{"use strict";kV=15,$I=class{constructor(e=kV){this.yieldAfter=Math.max(e,kV),this.startTime=Date.now(),this.counter=0,this.total=0,this.counterInterval=1}start(){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}}});function s0(n){return n.filterText!=null?sX(n.filterText,n.label):n.label}function _V(n,e){return e?Exe(n):[n]}function xm(n){let{label:e,converted:t}=n;if(t)return n;if(e.includes(` `)&&(e=n.label=e.replace(/\r?\n.*/gm,"")),e.includes(_xe)){let{line:i,highlights:r}=Ch(e);n.label=i,Array.isArray(n.ansiHighlights)||(n.ansiHighlights=r)}return n.converted=!0,n}function Rxe(n,e,t,i){return t?OZ(e,n):i?n.toLowerCase().indexOf(e.toLowerCase()):n.indexOf(e)}function Exe(n){let e=[],t=0,i=0,r="";for(;io.replace(/\\\s/g," ").trim()).filter(o=>o.length>0)}var Pxe,_xe,RV,yl,Cm,EV=k(()=>{"use strict";Ee();se();Sh();Le();PV();uE();n0();Go();ie();Ce();be();bl();Pxe=te("list-worker"),_xe="\x1B",RV=[32,9],yl="CocListSearch",Cm=class{constructor(e,t,i){this.list=e;this.prompt=t;this.listOptions=i;this._loading=!1;this._finished=!1;this.mutex=new Ai;this.totalItems=[];this._onDidChangeItems=new p.Emitter;this._onDidChangeLoading=new p.Emitter;this.onDidChangeItems=this._onDidChangeItems.event;this.onDidChangeLoading=this._onDidChangeLoading.event;this.fuzzyMatch=y.createFuzzyMatch()}set loading(e){this._loading!=e&&(this._loading=e,this._onDidChangeLoading.fire(e))}get isLoading(){return this._loading}async loadItems(e,t=!1){this.cancelFilter(),this.filteredCount=0,this._finished=!1;let{list:i,listOptions:r}=this;this.loading=!0;let{interactive:o}=r;this.tokenSource=new p.CancellationTokenSource;let s=this.tokenSource.token,a=await i.loadItems(e,s);if(!s.isCancellationRequested)if(a=a??[],Array.isArray(a)){this.tokenSource=null,this.totalItems=a,this.loading=!1,this._finished=!0;let l;o?(l=this.convertToHighlightItems(a),this._onDidChangeItems.fire({sorted:!0,items:l,reload:t,finished:!0})):(this.filterTokenSource=new p.CancellationTokenSource,await this.mutex.use(async()=>{await this.filterItems(a,{reload:t},s)}))}else{let l=a,u=this.totalItems=[],c=0,h=e.input;this.filterTokenSource=new p.CancellationTokenSource;let d=async w=>{await this.mutex.use(async()=>{if(this.input!=h&&(h=this.input,c=Pe(this.filteredCount,0)),c>=u.length)return;let D=c>0,M=u.slice(c);if(c=u.length,o){let L=this.convertToHighlightItems(M);this._onDidChangeItems.fire({items:L,append:D,reload:t,sorted:!0,finished:w})}else{let L=this.filterTokenSource;await this.filterItems(M,{append:D,reload:t},L.token)}})},g=setInterval(async()=>{await d()},50);l.on("data",w=>{u.push(w)});let f=async()=>{if(l!=null&&(clearInterval(g),this.tokenSource=null,l=null,this.loading=!1,this._finished=!0,m.dispose(),!s.isCancellationRequested)){if(u.length==0){this._onDidChangeItems.fire({items:[],append:!1,sorted:!0,reload:t,finished:!0});return}await d(!0)}},m=s.onCancellationRequested(()=>{this.mutex.reset(),l?.dispose(),f()}),b=l;l.on("error",async w=>{l!=null&&(l=null,b.dispose(),this.tokenSource=null,this.loading=!1,m.dispose(),clearInterval(g),y.nvim.call("coc#prompt#stop_prompt",["list"],!0),y.nvim.echoError(`Task error: ${w.toString()}`),Pxe.error("List task error:",w))}),l.on("end",f)}}async drawItems(){let{totalItems:e}=this;if(e.length===0)return;this.cancelFilter();let t=this.filterTokenSource=new p.CancellationTokenSource,i=t.token;await this.mutex.use(async()=>{if(i.isCancellationRequested)return;let{totalItems:r}=this;this.filteredCount=r.length,await this.filterItems(r,{},t.token)})}cancelFilter(){this.filterTokenSource&&(this.filterTokenSource.cancel(),this.filterTokenSource=null)}stop(){this.cancelFilter(),this.tokenSource&&(this.tokenSource.cancel(),this.tokenSource=null),this.loading=!1}get length(){return this.totalItems.length}get input(){return this.prompt.input}convertToHighlightItems(e){let t=de(this.input);t.length>0&&this.fuzzyMatch.setPattern(t);let i=e.map(r=>{if(xm(r),t.length>0&&r.filterText!==""){let s=s0(r),a=this.fuzzyMatch.matchHighlights(s,yl);r.ansiHighlights=Array.isArray(r.ansiHighlights)?r.ansiHighlights.filter(l=>l.hlGroup!==yl):[],a&&r.ansiHighlights.push(...a.highlights)}return r});return this.fuzzyMatch.free(),i}async filterItemsByInclude(e,t,i,r){let{ignorecase:o}=this.listOptions,s=bt.smartcase,a=_V(e,bt.extendedSearchMode);o&&(a=a.map(l=>l.toLowerCase())),await o0(t,l=>{xm(l);let u=[],c=s0(l),h=Ra(c),d=0;l.ansiHighlights=pe(l.ansiHighlights).filter(g=>g.hlGroup!==yl);for(let g of a){let f=c.slice(d),m=Rxe(f,g,s,o);if(m===-1)break;let b=m+d+g.length;u.push([h(m+d),h(b)]),d=b}return u.length!==a.length?!1:(l.ansiHighlights.push(...u.map(g=>({span:g,hlGroup:yl}))),!0)},r,i)}async filterItemsByRegex(e,t,i,r){let{ignorecase:o}=this.listOptions,s=o?"iu":"u",a=_V(e,bt.extendedSearchMode),l=a.reduce((u,c)=>{try{u.push(new RegExp(c,s))}catch{}return u},[]);await o0(t,u=>{xm(u),u.ansiHighlights=pe(u.ansiHighlights).filter(f=>f.hlGroup!==yl);let c=[],h=s0(u),d=Ra(h),g=0;for(let f of l){let m=h.slice(g).match(f);if(m==null)break;let b=m.index+g+m[0].length;c.push([d(m.index+g),d(b)]),g=b}return c.length!==a.length?!1:(u.ansiHighlights.push(...c.map(f=>({span:f,hlGroup:yl}))),!0)},r,i)}async filterItemsByFuzzyMatch(e,t,i,r){let{extendedSearchMode:o,smartcase:s}=bt,{sort:a}=this.listOptions,l=0;this.fuzzyMatch.setPattern(e,!o);let u=pd(e);o&&(u=u.filter(c=>!RV.includes(c))),await o0(t,c=>{xm(c);let h=s0(c),d=this.fuzzyMatch.matchHighlights(h,yl);if(!d||s&&!fd(u,h))return!1;let g=Array.isArray(c.ansiHighlights)?c.ansiHighlights.filter(f=>f.hlGroup!=yl):[];return g.push(...d.highlights),{sortText:typeof c.sortText=="string"?c.sortText:String.fromCharCode(l),score:d.score,ansiHighlights:g}},(c,h)=>{r(c,h,a)},i)}async filterItems(e,t,i){let{input:r}=this;if(r.length===0){let l=e.map(u=>xm(u));this._onDidChangeItems.fire({items:l,sorted:!0,finished:this._finished,...t});return}let o=!1,s=[],a=(l,u,c)=>{let h=u&&this._finished;if(!(i.isCancellationRequested||!h&&l.length==0))if(c)s.push(...l),u&&this._onDidChangeItems.fire({items:s,append:!1,sorted:!1,reload:t.reload,finished:h});else{let d=t.append===!0||o;o=!0,this._onDidChangeItems.fire({items:l,append:d,sorted:!0,reload:t.reload,finished:h})}};switch(this.listOptions.matcher){case"strict":await this.filterItemsByInclude(r,e,i,a);break;case"regex":await this.filterItemsByRegex(r,e,i,a);break;default:await this.filterItemsByFuzzyMatch(r,e,i,a)}}dispose(){this.stop()}}});var Lxe,Ixe,Sm,LV=k(()=>{"use strict";$a();se();fe();ie();Ze();be();bl();ZI();JI();TV();EV();Lxe=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],Ixe=ve(50,1),Sm=class{constructor(e,t,i,r,o){this.nvim=e;this.prompt=t;this.list=i;this.listOptions=r;this.listArgs=o;this.loadingFrame="";this.hidden=!1;this.disposables=[];this.args=[];this.ui=new wm(e,i.name,r),this.history=new Wu(t,i.name,UI,y.cwd),this.worker=new Cm(i,t,r);let s=wt(async()=>{let[h,d,g]=await e.eval('[coc#list#has_preview(),win_getid(),line(".")]');if(h&&d==this.winid){let f=this.ui.lnumToIndex(g);await this.doPreview(f)}},Ixe);this.disposables.push({dispose:()=>{s.clear()}}),this.ui.onDidChangeLine(s,null,this.disposables),this.ui.onDidChangeLine(this.resolveItem,this,this.disposables),this.ui.onDidLineChange(this.resolveItem,this,this.disposables);let a=wt(async()=>{this.updateStatus();let{autoPreview:h}=this.listOptions;if(!h){let[d,g]=await e.eval("[coc#list#has_preview(),mode()]");if(g!="n"||!d)return}await this.doAction("preview")},50);this.disposables.push({dispose:()=>{a.clear()}}),this.ui.onDidLineChange(a,null,this.disposables),this.ui.onDidOpen(async()=>{typeof this.list.doHighlight=="function"&&this.list.doHighlight(),this.listOptions.first&&await this.doAction()},null,this.disposables),this.ui.onDidClose(this.hide,this,this.disposables),this.ui.onDidDoubleClick(this.doAction,this,this.disposables),this.worker.onDidChangeItems(h=>{this.hidden||this.ui.onDidChangeItems(h)},null,this.disposables);let l=0,u,c;this.disposables.push(p.Disposable.create(()=>{clearTimeout(u),clearInterval(c)})),this.worker.onDidChangeLoading(h=>{this.hidden||(u&&clearTimeout(u),h?(l=Date.now(),c&&clearInterval(c),c=setInterval(()=>{let d=Math.floor((Date.now()-l)%1e3/100);this.loadingFrame=Lxe[d],this.updateStatus()},100)):u=setTimeout(()=>{this.loadingFrame="",c&&clearInterval(c),c=null,this.updateStatus()},Math.max(0,200-(Date.now()-l))))},null,this.disposables)}async start(e){this.args=e,this.cwd=y.cwd,this.hidden=!1;let{listArgs:t}=this,i=await this.nvim.eval(`[win_getid(),bufnr("%"),${y.isVim?'winheight("%")':"nvim_win_get_height(0)"}]`);this.listArgs=t,this.history.filter(),this.targetWinid=i[0],this.targetBufnr=i[1],this.savedHeight=i[2],await this.worker.loadItems(this.context)}async reloadItems(){this.ui.winid&&await this.worker.loadItems(this.context,!0)}async call(e){await this.nvim.call("coc#prompt#stop_prompt",["list"]);let t=await this.ui.getItems(),i={name:this.name,args:this.listArgs,input:this.prompt.input,winid:this.targetWinid,bufnr:this.targetBufnr,targets:t},r=await this.nvim.call(e,[i]);return this.prompt.start(),r}async chooseAction(){let{nvim:e,defaultAction:t}=this,{actions:i}=this.list,r=i.map(h=>h.name),o=r.indexOf(t.name);o!=-1&&(r.splice(o,1),r.unshift(t.name));let s=new Set,a=[],l=[],u=y.env.dialog&&bt.get("menuAction",!1);for(let h of r){let d=0;for(let g of h){if(!s.has(g)){s.add(g),a.push(`${h.slice(0,d)}&${h.slice(d)}`);break}d++}d==h.length&&l.push(h)}l.length&&!u&&(r=r.filter(h=>!l.includes(h)));let c;u?(e.call("coc#prompt#stop_prompt",["list"],!0),c=await R.showMenuPicker(r,{title:"Choose action",shortcuts:!0}),c=c+1,this.prompt.start()):(await e.call("coc#prompt#stop_prompt",["list"]),c=await e.call("confirm",["Choose action:",a.join(` `)]),await dn(10),this.prompt.start()),c&&await this.doAction(r[c-1])}async doAction(e){let{list:t}=this,i;if(e!=null){if(i=t.actions.find(o=>o.name==e),!i){R.showErrorMessage(`Action ${e} not found`);return}}else i=this.defaultAction;let r;if(e=="preview"){let o=await this.ui.item;r=o?[o]:[]}else r=await this.ui.getItems();r.length&&await this.doItemAction(r,i)}async doPreview(e){let t=this.ui.getItem(e),i=this.list.actions.find(r=>r.name=="preview");!t||!i||await this.doItemAction([t],i)}async first(){await this.doDefaultAction(0)}async last(){await this.doDefaultAction(this.ui.length-1)}async previous(){await this.doDefaultAction(this.ui.index-1)}async next(){await this.doDefaultAction(this.ui.index+1)}async doDefaultAction(e){let{ui:t}=this,i=t.getItem(e);i&&(await this.ui.setIndex(e),await this.doItemAction([i],this.defaultAction),await t.echoMessage(i))}get name(){return this.list.name}get winid(){return this.ui.winid}get length(){return this.ui.length}get defaultAction(){let{defaultAction:e,actions:t,name:i}=this.list,r=y.getConfiguration(`list.source.${i}`),o;if(r.defaultAction&&(o=t.find(s=>s.name==r.defaultAction)),o||(o=t.find(s=>s.name==e)),o||(o=t[0]),!o)throw new Error(`default action "${e}" not found`);return o}async hide(e=!1,t=y.isVim){if(this.hidden)return;let{nvim:i,timer:r,targetWinid:o,context:s}=this,{winid:a}=this.ui;if(r&&clearTimeout(r),this.worker.stop(),this.history.add(),this.ui.reset(),UI.save(),this.hidden=!0,i.pauseNotification(),t||i.call("coc#prompt#stop_prompt",["list"],!0),a&&i.call("coc#list#close",[a,s.options.position,o,this.savedHeight],!0),e)return i.resumeNotification(!0,!0);await i.resumeNotification(!1),t&&(await dn(10),i.call("coc#prompt#stop_prompt",["list"],!0),i.redrawVim())}toggleMode(){let e=this.prompt.mode=="normal"?"insert":"normal";this.prompt.mode=e,this.listOptions.mode=e,this.updateStatus()}stop(){this.worker.stop()}async resolveItem(){let e=this.ui.index,t=this.ui.getItem(e);if(!t||t.resolved)return;let{list:i}=this;if(typeof i.resolveItem=="function"){let r=t.label,o=await Promise.resolve(i.resolveItem(t));if(o&&e==this.ui.index){if(Object.assign(t,o,{resolved:!0}),r==o.label)return;this.ui.updateItem(t,e)}}}async showHelp(){await this.hide();let{list:e,nvim:t}=this;t.pauseNotification(),t.command("tabe +setl\\ previewwindow [LIST HELP]",!0),t.command("setl nobuflisted noswapfile buftype=nofile bufhidden=wipe",!0),await t.resumeNotification();let i=e.options&&e.options.length,r=await t.buffer,o=new fn;if(o.addLine("NAME","Label"),o.addLine(` ${e.name} - ${e.description||""} `),o.addLine("SYNOPSIS","Label"),o.addLine(` :CocList [LIST OPTIONS] ${e.name}${i?" [ARGUMENTS]":""} @@ -281,7 +281,7 @@ ${l}(line ${u+1}): ${a.message}`;let c=r.get(a.location.uri)||[];c.push(qo.creat `)+` `}),s[l]=u}this.changing=!0,await y.applyEdit({changes:s}),this.changing=!1;for(let a of this.fileItems){let l=Y.file(this.getAbsolutePath(a.filepath)).toString(),u=s[l];u&&u.length>0&&a.ranges.forEach(c=>{c.start+=dE(oe.create(c.start,0),u)})}return e.pauseNotification(),i.setOption("modified",!1,!0),this.config.saveToFile&&e.command("silent noa wa",!0),this.highlightLineNr(),await e.resumeNotification(),!0}async getLines(e,t,i){let r=Y.file(e).toString(),o=y.getDocument(r);return o?o.getLines(t,i):await Ia(e,t,i-1)}getAbsolutePath(e){return E.isAbsolute(e)?e:E.join(this.opts.cwd,e)}highlightLineNr(){let{fileItems:e,nvim:t,srcId:i,bufnr:r}=this,{winid:o,cwd:s}=this.opts,a={};if(i){t.call("nvim_buf_clear_namespace",[r,i,0,-1],!0);for(let l of e)for(let u of l.ranges){let c=u.start+u.lines.length,h=`${u.start+1}:${c}`;a[u.lnum]=[u.start+1,c],t.call("nvim_buf_set_virtual_text",[r,i,u.lnum-1,[[h,"LineNr"]],{}],!0)}}else{this.matchIds.size&&(t.call("coc#highlight#clear_matches",[o,Array.from(this.matchIds)],!0),this.matchIds.clear());let l=2e3;for(let u of e){let c=`${s?E.relative(s,u.filepath):u.filepath}`,h=me(c)+1;for(let d of u.ranges){let g=d.start+d.lines.length,f=`:${d.start+1}:${g}`;for(let m=0;m{"use strict";_ie=require("child_process"),Rie=require("events");ye();Ee();$a();Sh();Go();fe();Ze();NSe=te("handler-search"),HSe=["--color","ansi","--colors","path:fg:black","--colors","line:fg:green","--colors","match:fg:red","--no-messages","--heading","-n"],BSe="\x1B",$F=class extends Rie.EventEmitter{start(e,t,i){this.process=(0,_ie.spawn)(e,t,{cwd:i,shell:process.platform==="win32"}),this.process.on("error",c=>{this.emit("error",c.message)});let r=Bo.createInterface(this.process.stdout),o,s,a=[],l=[],u=!0;r.on("line",c=>{if(c.includes(BSe)){let h=up(c);if(h.length==0)return;if(h[0].foreground=="black"){s={filepath:E.join(i,h[0].text),ranges:[]};return}if(h[0].foreground=="green"){let g=parseInt(h[0].text,10)-1,f=h[0].text.length+1;u&&(o=g,u=!1);let m="";for(let w of h){if(w.foreground=="red"){let x=g-o,D=m.length-f;l.push(q.create(x,D,x,D+w.text.length))}m+=w.text}let b=m.slice(f);a.push(b)}}else{let h=c.trim().length==0;s&&(h||c.trim()=="--")&&s.ranges.push({lines:a,highlights:l,start:o}),h&&(this.emit("item",s),s=null),a=[],l=[],u=!0}}),r.on("close",()=>{s&&(a.length&&s.ranges.push({lines:a,highlights:l,start:o}),this.emit("item",s)),a=l=s=null,this.emit("end")})}dispose(){this.process&&this.process.kill()}},_b=class{constructor(e,t="rg"){this.nvim=e;this.cmd=t}run(e,t,i){let{nvim:r,cmd:o}=this,{afterContext:s,beforeContext:a}=i.config,l=["-A",s.toString(),"-B",a.toString()].concat(HSe,e),u=WSe(e);u&&l.pop(),l.push("--",u?E.isAbsolute(u)?u:`./${u.replace(/^\.\//,"")}`:"./"),this.task=new $F,this.task.start(o,l,t);let c=new Ai,h=0,d=0,g=Date.now(),f=[],m=async()=>{if(f.length==0)return;let b=f.slice();f=[];let w=await c.acquire();try{await i.addFileItems(b)}catch(x){NSe.error(x)}w()};return new Promise((b,w)=>{let x=setInterval(m,300);this.task.on("item",async D=>{h++,d=d+D.ranges.reduce((M,L)=>M+L.highlights.length,0),f.push(D)}),this.task.on("error",D=>{clearInterval(x),R.showErrorMessage(`Error on command "${o}": ${D}`),this.task=null,w(new Error(D))}),this.task.on("end",async()=>{clearInterval(x);try{await m(),(await c.acquire())(),this.task.removeAllListeners(),this.task=null;let M=i.buffer;if(M){if(r.pauseNotification(),h==0)M.setLines(["No match found"],{start:1,end:2,strictIndexing:!1},!0),M.addHighlight({line:1,srcId:-1,colEnd:-1,colStart:0,hlGroup:"Error"}),M.setOption("modified",!1,!0);else{let L=new fn;L.addText("Files","MoreMsg"),L.addText(": "),L.addText(`${h} `,"Number"),L.addText("Matches","MoreMsg"),L.addText(": "),L.addText(`${d} `,"Number"),L.addText("Duration","MoreMsg"),L.addText(": "),L.addText(`${Date.now()-g}ms`,"Number"),L.render(M,1,2)}M.setOption("modified",!1,!0),r.resumeNotification(!1,!0)}}catch(D){w(D);return}b()})})}abort(){this.task?.dispose()}}});function Lie(n,e){let{start:t,end:i}=n;return q.create(t.line-e,t.character,i.line-e,i.character)}var qSe,YSe,XF,Rb,Iie=k(()=>{"use strict";ye();$e();je();Ie();se();pt();ie();Kr();be();Pie();Eie();qSe="__coc_refactor__",YSe=0,Rb=class{constructor(e,t){this.nvim=e;this.handler=t;this.buffers=new Map;this.disposables=[];this._onCreate=new p.Emitter;this.onCreate=this._onCreate.event;this.setConfiguration(),y.onDidChangeConfiguration(this.setConfiguration,this,this.disposables),F.on("BufUnload",i=>{let r=this.buffers.get(i);r&&(r.dispose(),this.buffers.delete(i))},null,this.disposables),y.onDidChangeTextDocument(i=>{let r=this.buffers.get(i.bufnr);r&&r.onChange(i)},null,this.disposables)}has(e){return this.buffers.has(e)}setConfiguration(e){if(e&&!e.affectsConfiguration("refactor"))return;let t=y.getConfiguration("refactor",null);this.config=Object.assign(this.config||{},{afterContext:t.get("afterContext",3),beforeContext:t.get("beforeContext",3),openCommand:t.get("openCommand","vsplit"),saveToFile:t.get("saveToFile",!0),showMenu:t.get("showMenu","")})}async doRefactor(){let{doc:e,position:t}=await this.handler.getCurrentState();if(!A.hasProvider("rename",e.textDocument))throw new Error("Rename provider not found for current buffer");await e.synchronize();let i=await this.handler.withRequestToken("refactor",async r=>{let o=await A.prepareRename(e.textDocument,t,r);if(r.isCancellationRequested)return null;if(o===!1)throw new Error("Provider returns null on prepare, unable to rename at current position");let s=await A.provideRenameEdits(e.textDocument,t,"NewName",r);if(r.isCancellationRequested)return null;if(!s)throw new Error("Provider returns null for rename edits.");return s});i&&await this.fromWorkspaceEdit(i,e.filetype)}async search(e){let t=await this.createRefactorBuffer(),i=await this.nvim.call("getcwd",[]);await new _b(this.nvim).run(e,i,t)}async save(e){let t=this.buffers.get(e);if(t)return await t.save()}getBuffer(e){return this.buffers.get(e)}async createRefactorBuffer(e,t=!1){let{nvim:i}=this,[r,o]=await i.eval("[win_getid(),getcwd()]"),{openCommand:s}=this.config;!i.isVim&&!XF&&(XF=await this.nvim.createNamespace("coc-refactor")),i.pauseNotification(),i.command(`${s} ${qSe}${YSe++}`,!0),i.command("setl buftype=acwrite nobuflisted bufhidden=wipe nofen wrap conceallevel=2 concealcursor=n",!0),i.command("setl undolevels=-1 nolist nospell noswapfile foldmethod=expr foldexpr=coc#util#refactor_foldlevel(v:lnum)",!0),i.command("setl foldtext=coc#util#refactor_fold_text(v:foldstart)",!0),i.call("setline",[1,["Save current buffer to make changes",Fo]],!0),i.call("matchadd",["Comment","\\%1l"],!0),i.call("matchadd",["Conceal","^\\%u3000"],!0),i.call("matchadd",["Label","^\\%u3000\\zs\\S\\+"],!0),i.command("setl nomod",!0),e&&i.command(`runtime! syntax/${e}.vim`,!0),i.call("coc#util#do_autocmd",["CocRefactorOpen"],!0),await i.resumeNotification();let[a,l]=await i.eval('[bufnr("%"),win_getid()]'),u={fromWinid:r,winid:l,cwd:o};await y.document;let c=new Pb(a,t?void 0:XF,this.nvim,this.config,u);return this.buffers.set(a,c),c}async fromLines(e){let t=await this.createRefactorBuffer();return await t.buffer.setLines(e,{start:0,end:-1,strictIndexing:!1}),t}async fromLocations(e,t){if(!e||e.length==0)return;let i={},r={changes:i};for(let o of e){let s=i[o.uri]||[];s.push({range:o.range,newText:""}),i[o.uri]=s}return await this.fromWorkspaceEdit(r,t)}async fromWorkspaceEdit(e,t){if(!e||pX(e))return;let i=[],{beforeContext:r,afterContext:o}=this.config,{changes:s,documentChanges:a}=e;if(!s){s={};for(let u of a||[])if(xi.is(u)){let{textDocument:c,edits:h}=u;s[c.uri]=h}}for(let u of Object.keys(s)){let c=await this.getLineCount(u),h=s[u],d=[],g=null,f=null,m=[];h.sort((b,w)=>b.range.start.line-w.range.start.line);for(let b of h){let{line:w}=b.range.start,x=Math.max(0,w-r);g!=null&&x{"use strict";ye();Ie();Nt();ie();Ze();be();Eb=class{constructor(e,t){this.nvim=e;this.handler=t}async getWordEdit(){let{doc:e,position:t}=await this.handler.getCurrentState(),i=e.getWordRangeAtPosition(t);if(!i||Qt(i))return null;let r=e.textDocument.getText(i);if(A.hasProvider("rename",e.textDocument)){await e.synchronize();let s=new p.CancellationTokenSource;if(await A.prepareRename(e.textDocument,t,s.token)!==!1){let l=r.startsWith("a")?"b":"a",u=await A.provideRenameEdits(e.textDocument,t,l,s.token);if(u)return u}}R.showInformationMessage("Rename provider not found, extract word ranges from current buffer");let o=e.getSymbolRanges(r);return{changes:{[e.uri]:o.map(s=>({range:s,newText:r}))}}}async rename(e){let{doc:t,position:i}=await this.handler.getCurrentState();this.handler.checkProvider("rename",t.textDocument),await t.synchronize();let r=new p.CancellationTokenSource().token,o=await A.prepareRename(t.textDocument,i,r);if(o===!1)return R.showWarningMessage("Invalid position for rename"),!1;let s;if(!e){q.is(o)?(s=t.textDocument.getText(o),await R.moveTo(o.start)):o&&typeof o.placeholder=="string"?s=o.placeholder:s=await this.nvim.eval('expand("")');let l=y.getConfiguration("coc.preferences",null);e=await R.requestInput("New name",l.get("renameFillCurrent",!0)?s:"")}if(e===""&&R.showWarningMessage("Empty word, rename canceled"),!e)return!1;let a=await A.provideRenameEdits(t.textDocument,i,e,r);return r.isCancellationRequested||!a?!1:(await y.applyEdit(a),this.nvim.redrawVim(),!0)}}});var Lb,Mie=k(()=>{"use strict";ye();Ie();Le();Ye();Nt();Ze();Lb=class{constructor(e,t){this.nvim=e;this.handler=t;this.selectionRange=null}async getSelectionRanges(){let{doc:e,position:t}=await this.handler.getCurrentState();return this.handler.checkProvider("selectionRange",e.textDocument),await e.synchronize(),await this.handler.withRequestToken("selection ranges",r=>A.getSelectionRanges(e.textDocument,[t],r))}async selectRange(e,t){let{doc:i}=await this.handler.getCurrentState();this.handler.checkProvider("selectionRange",i.textDocument);let r=[];if(!t&&(!this.selectionRange||!e))return;if(e){let a=await R.getSelectedRange(e);r.push(a.start,a.end)}else{let a=await R.getCursorPosition();r.push(a)}if(!t){let a=q.create(r[0],r[1]),{selectionRange:l}=this;for(;l&&l.parent&&!Be(l.parent.range,a);)l=l.parent;l&&l.parent&&await R.selectRange(l.range);return}await i.synchronize();let o=await this.handler.withRequestToken("selection ranges",a=>A.getSelectionRanges(i.textDocument,r,a));if(le(o))return!1;let s;if(o.length==1)s=o[0];else{let a=r[1]??r[0],l=q.create(r[0],a);for(s=o[0];s;){if(Be(l,s.range)){s=s.parent;continue}if($t(r[0],s.range)==0&&$t(a,s.range)==0)break;s=s.parent}}return s?(this.selectionRange=o[0],await R.selectRange(s.range),!0):!1}}});function Ib(n){if(!n)return"";if(GF.has(n))return GF.get(n);let e=[];for(let i=0;i{"use strict";ye();Ie();Ee();UF();se();Le();qi();se();Fa();ie();Ce();Ze();be();USe=te("semanticTokens-buffer"),ZSe=ve(15,5),ID="CocSem",hs="semanticTokens",jie=ve(100,20),JSe=ve(500,20),GF=new Map,Fb=class{constructor(e,t,i){this.nvim=e;this.doc=t;this.staticConfig=i;this._dirty=!1;this.regions=new xl;this._onDidRefresh=new p.Emitter;this.onDidRefresh=this._onDidRefresh.event;this.highlight=Gy(()=>{this.doHighlight()},jie),this.hasProvider&&this.highlight()}get config(){return this._config?this._config:(this.loadConfiguration(),this._config)}loadConfiguration(){let e=y.getConfiguration("semanticTokens",this.doc),t=this._config!=null&&this._config.enable!=e.enable;this._config={enable:e.get("enable"),highlightPriority:e.get("highlightPriority"),incrementTypes:e.get("incrementTypes"),combinedModifiers:e.get("combinedModifiers")},t&&(this._config.enable?this.highlight():this.clearHighlight())}get configEnabled(){let{enable:e}=this.config,{filetypes:t}=this.staticConfig;return Array.isArray(t)?t.includes("*")||t.includes(this.doc.filetype):e}get bufnr(){return this.doc.bufnr}onChange(){this.highlight()}onTextChange(){this.cancel()}async forceHighlight(){this.clearHighlight(),this.cancel(),await this.doHighlight(!0)}async onShown(){if(this.shouldRangeHighlight)return;let{doc:e}=this;e.dirty||e.version===this._version||await this.doHighlight(!1,!0)}get hasProvider(){return A.hasProvider("semanticTokens",this.doc)||A.hasProvider("semanticTokensRange",this.doc)}get hasLegend(){let{textDocument:e}=this.doc;return A.getLegend(e)!=null||A.getLegend(e,!0)!=null}get rangeProviderOnly(){return!A.hasProvider("semanticTokens",this.doc)&&A.hasProvider("semanticTokensRange",this.doc)}get shouldRangeHighlight(){let{textDocument:e}=this.doc;return A.hasProvider("semanticTokensRange",e)&&this.previousResults==null}get lineCount(){return this.doc.lineCount}get highlights(){if(this._highlights)return this._highlights[1]}get buffer(){return this.nvim.createBuffer(this.bufnr)}get enabled(){return!this.configEnabled||!y.env.updateHighlight||!this.hasLegend?!1:this.hasProvider}checkState(){if(!y.env.updateHighlight)throw new Error("Can't perform highlight update, highlight update requires vim >= 8.1.1719 or neovim >= 0.5.0");if(!this.configEnabled)throw new Error(`Semantic tokens highlight not enabled for current filetype: ${this.doc.filetype}`);if(!this.hasProvider||!this.hasLegend)throw new Error(`SemanticTokens provider not found for ${this.doc.uri}`)}async getTokenRanges(e,t,i){let r=0,o=0,s=[],a,l=this.doc.textDocument,u=Date.now();for(let c=0;cZSe){if(await jr(),i.isCancellationRequested)break;u=Date.now()}let h=e[c],d=e[c+1],g=e[c+2],f=t.tokenTypes[e[c+3]],m=t.tokenModifiers.filter((D,M)=>e[c+4]&1<=i))continue;let u={lnum:l,hlGroup:a.hlGroup,colStart:a.range[1],colEnd:a.range[2],combine:a.combine};r.includes(a.tokenType)&&(u.end_incl=!0,u.start_incl=!0),s.push(u)}return s}async doHighlight(e=!1,t=!1){if(this.cancel(),!this.enabled||!t&&!y.editors.isVisible(this.bufnr))return;let r=(this.tokenSource=new p.CancellationTokenSource).token;if(this.shouldRangeHighlight){let u=(this.rangeTokenSource=new p.CancellationTokenSource).token;if(await this.doRangeHighlight(u),u.isCancellationRequested||(this.rangeTokenSource=void 0),u.isCancellationRequested&&this.rangeProviderOnly)return}if(r.isCancellationRequested)return;let{doc:o}=this,s=o.version,a;if(s===this.previousResults?.version)if(this._highlights&&this._highlights[0]==s)a=this._highlights[1];else{let l=this.previousResults.tokens,u=A.getLegend(o.textDocument);a=await this.getTokenRanges(l,u,r)}else a=await this.sendRequest(()=>this.requestAllHighlights(r,e),r);if(!(r.isCancellationRequested||!a)){if(this._highlights=[s,a],!this._dirty||a.length<200){let l=this.toHighlightItems(a),u=await R.diffHighlights(this.bufnr,hs,l,void 0,r);if(r.isCancellationRequested||!u)return;this._dirty=!0,this._version=s;let c=this.config.highlightPriority;await R.applyDiffHighlights(this.bufnr,hs,c,u)}else this.regions.clear(),await this.highlightRegions(r);r.isCancellationRequested||(this.tokenSource=void 0),this._onDidRefresh.fire()}}async sendRequest(e,t){try{return await e()}catch(i){t.isCancellationRequested||(i instanceof Ot?this.highlight(JSe):USe.error("Error on request semanticTokens: ",i));return}}async doRangeHighlight(e){let{version:t}=this.doc,i=await this.sendRequest(()=>this.requestRangeHighlights(e),e);if(i==null||e.isCancellationRequested)return;let{highlights:r,start:o,end:s}=i;if(this.rangeProviderOnly||!this.previousResults){(!this._highlights||t!==this._highlights[0])&&(this._highlights=[t,[]]);let u=this._highlights[1],c=u.reduce((h,d)=>h.add(d.range[0]),new Set);r.forEach(h=>{c.has(h.range[0])||u.push(h)})}let a=this.toHighlightItems(r),l=await R.diffHighlights(this.bufnr,hs,a,[o,s],e);if(l){let u=this.config.highlightPriority;await R.applyDiffHighlights(this.bufnr,hs,u,l,!0),this._dirty=!0}}async highlightRegions(e,t=!1){let{regions:i,highlights:r,config:o,lineCount:s,bufnr:a}=this;if(!r)return;let l=await this.nvim.call("coc#window#visible_ranges",[a]);if(e.isCancellationRequested||l.length===0)return;let u=y.env.lines;l.forEach(c=>{let h=c[0];c[0]=Math.max(0,Math.floor(h-u*1.5)),c[1]=Math.min(s,Math.ceil(c[1]+u*1.5),h+u*2)});for(let[c,h]of xl.mergeSpans(l)){if(!t&&i.has(c,h))continue;let d=this.toHighlightItems(r,c,h),g=await R.diffHighlights(a,hs,d,[c,h],e);if(e.isCancellationRequested)break;i.add(c,h);let f=o.highlightPriority;g&&R.applyDiffHighlights(a,hs,f,g,!0)}}async onCursorMoved(){if(this.cancel(!0),!this.enabled||this.doc.dirty)return;let t=(this.rangeTokenSource=new p.CancellationTokenSource).token;await dn(jie),!t.isCancellationRequested&&(this.shouldRangeHighlight?await this.doRangeHighlight(t):await this.highlightRegions(t),t.isCancellationRequested||(this.rangeTokenSource=void 0))}async requestRangeHighlights(e){let{nvim:t,doc:i}=this,r=await t.call("coc#window#visible_range",[this.bufnr]);if(!r||e.isCancellationRequested)return null;let o=Math.min(r[0]+y.env.lines*2,r[1]+y.env.lines,i.lineCount),s=q.create(r[0]-1,0,o,0),a=await A.provideDocumentRangeSemanticTokens(i.textDocument,s,e);if(!a||!Wl.is(a)||e.isCancellationRequested)return null;let l=A.getLegend(i.textDocument,!0),u=await this.getTokenRanges(a.data,l,e);return u?{highlights:u,start:r[0]-1,end:r[1]}:null}async requestAllHighlights(e,t){let i=this.doc.textDocument,r=A.getLegend(i),o=A.hasSemanticTokensEdits(i),s=t?null:this.previousResults,a=i.version,l;if(o&&s?.resultId?l=await A.provideDocumentSemanticTokensEdits(i,s.resultId,e):l=await A.provideDocumentSemanticTokens(i,e),e.isCancellationRequested||l==null)return;let u=[];return Wl.is(l)?u=l.data:s&&Array.isArray(l.edits)&&(u=s.tokens,l.edits.forEach(c=>{u.splice(c.start,Pn(c.deleteCount),...pe(c.data))})),this.previousResults={resultId:l.resultId,tokens:u,version:a},await this.getTokenRanges(u,r,e)}clearHighlight(){this.previousResults=void 0,this._highlights=void 0,this.regions.clear(),this.buffer.clearNamespace(hs)}abandonResult(){this.previousResults=void 0}cancel(e=!1){this.rangeTokenSource&&(this.rangeTokenSource.cancel(),this.rangeTokenSource=null),!e&&(this.regions.clear(),this.highlight.clear(),this.tokenSource&&(this.tokenSource.cancel(),this.tokenSource=null))}dispose(){this.cancel(),this.clearHighlight(),this._onDidRefresh.dispose()}}});function Aie(){return y.initialConfiguration.get("semanticTokens.filetypes",null)}var zF,FD,Mb,Nie=k(()=>{"use strict";At();je();Ie();$a();se();Le();Ce();Ze();be();Oie();zF="Statement";Mb=class{constructor(e){this.nvim=e;this.disposables=[];this.staticConfig={filetypes:Aie()},y.onDidChangeConfiguration(t=>{if(t.affectsConfiguration("semanticTokens")){this.staticConfig.filetypes=Aie();for(let i of this.highlighters.items)i.loadConfiguration()}},this,this.disposables),ae.register({id:"semanticTokens.checkCurrent",execute:async()=>{await this.showHighlightInfo()}},!1,"show semantic tokens highlight information of current buffer"),ae.register({id:"semanticTokens.refreshCurrent",execute:()=>this.highlightCurrent()},!1,"refresh semantic tokens highlight of current buffer."),ae.register({id:"semanticTokens.inspect",execute:()=>this.inspectSemanticToken()},!1,"Inspect semantic token information at cursor position."),ae.register({id:"semanticTokens.clearCurrent",execute:async()=>{(await e.buffer).clearNamespace(hs,0,-1)}},!1,"clear semantic tokens highlight of current buffer"),ae.register({id:"semanticTokens.clearAll",execute:async()=>{let t=await e.buffers;for(let i of t)i.clearNamespace(hs,0,-1)}},!1,"clear semantic tokens highlight of all buffers"),this.highlighters=y.registerBufferSync(t=>new Fb(this.nvim,t,this.staticConfig)),A.onDidSemanticTokensRefresh(async t=>{let i=R.visibleTextEditors.map(r=>r.document.bufnr);for(let r of this.highlighters.items)y.match(t,r.doc)&&(r.hasProvider?(r.abandonResult(),i.includes(r.bufnr)&&r.highlight()):r.clearHighlight())},null,this.disposables),F.on("BufWinEnter",async t=>{let i=this.highlighters.getItem(t);i&&await i.onShown()},null,this.disposables),F.on("CursorMoved",async t=>{let i=this.highlighters.getItem(t);i&&await i.onCursorMoved()},null,this.disposables)}async inspectSemanticToken(){let e=await this.getCurrentItem();if(!e||!e.enabled){if(e)try{e.checkState()}catch(a){R.showErrorMessage(a.message)}else{let a=await y.document;R.showErrorMessage(`Document not attached, ${a.notAttachReason}`)}this.closeFloat();return}let[t,i,r]=await this.nvim.call("getcurpos",[]),s=pe(e.highlights).find(a=>{let l=r-1;return a.range[0]===i-1&&l>=a.range[1]&&lc.hlGroup!=null).map(({hlGroup:c})=>c));for(let c of a)r.addTexts([{text:"-",hlGroup:"Comment"},{text:" "},{text:c,hlGroup:c}]);r.addLine(""),r.addLine("Tokens types that current Language Server supported:",zF),r.addLine("");let l=y.getDocument(i.bufnr),u=A.getLegend(l.textDocument)??A.getLegend(l.textDocument,!0);if(u.tokenTypes.length){for(let c of[...new Set(u.tokenTypes)]){let h=ID+"Type"+Ib(c);r.addTexts([{text:"-",hlGroup:"Comment"},{text:" "},{text:h,hlGroup:h}])}r.addLine("")}else r.addLine("No token types supported","Comment"),r.addLine("")}catch(s){r.addLine(Jr(s))}t.pauseNotification(),r.render(t.createBuffer(o[0][2])),t.resumeNotification(!0,!0)}dispose(){this.highlighters.dispose(),z(this.disposables)}}});var $Se,jb,Hie=k(()=>{"use strict";je();Ie();se();Le();fe();ie();Ce();Ze();be();LD();$Se=ve(100,10),jb=class{constructor(e,t){this.nvim=e;this.handler=t;this.disposables=[];this.loadConfiguration(),this.signatureFactory=R.createFloatFactory(Object.assign({preferTop:this.config.preferAbove,autoHide:!1,modes:["i","ic","s"]},this.config.floatConfig)),this.disposables.push(this.signatureFactory),y.onDidChangeConfiguration(this.loadConfiguration,this,this.disposables),F.on("CursorMovedI",wt(this.checkCurosr.bind(this),$Se),null,this.disposables),F.on(["InsertLeave","BufEnter"],()=>{this.tokenSource?.cancel()},null,this.disposables),F.on("TextChangedI",()=>{this.config.hideOnChange&&this.signatureFactory.close()},null,this.disposables),F.on("TextInsert",async(i,r,o)=>{if(!this.config.enableTrigger)return;let s=y.getDocument(i);!s||!s.attached||!A.shouldTriggerSignatureHelp(s.textDocument,o)||await this._triggerSignatureHelp(s,{line:r.lnum-1,character:r.pre.length},!1)},null,this.disposables),R.onDidChangeActiveTextEditor(()=>{this.loadConfiguration()},null,this.disposables)}checkCurosr(e,t){let i=this.lastPosition,r=this.signatureFactory;if(!i||e!==i.bufnr||r.window==null)return;let o=y.getDocument(e);if(!o||t[0]!=i.lnum||t[1]{o.dispose(),this.tokenSource=void 0});let{target:a}=this.config,l=this.timer=setTimeout(()=>{o.cancel()},this.config.wait);await e.patchChange(!0);let u=await A.getSignatureHelp(e.textDocument,t,s,{isRetrigger:this.signatureFactory.checkRetrigger(e.bufnr),triggerKind:i?p.SignatureHelpTriggerKind.Invoked:p.SignatureHelpTriggerKind.TriggerCharacter});if(clearTimeout(l),s.isCancellationRequested)return!1;if(!u||u.signatures.length==0)return this.signatureFactory.close(),!1;let{activeSignature:c,signatures:h}=u;if(c){let[d]=h.splice(c,1);d&&h.unshift(d)}return a=="echo"?this.echoSignature(u):await this.showSignatureHelp(e,t,u,r),!0}async showSignatureHelp(e,t,i,r){let{signatures:o,activeParameter:s}=i;s=typeof s=="number"?s:void 0;let a=null,l=r,u=o.reduce((h,d,g)=>{let f=null,m=d.activeParameter??s;m===void 0&&!le(d.parameters)&&(m=0);let b=d.label.indexOf("(");if(g==0&&typeof m=="number"){let w=d.parameters?.[m];if(w){let x=d.label.slice(b==-1?0:b);if(a=w.documentation,typeof w.label=="string"){let D=x.slice(0),M=D.match(new RegExp("\\b"+w.label.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")+"\\b")),L=M?M.index:D.indexOf(w.label);L!=-1&&(f=[L+b,L+w.label.length+b])}else f=w.label}}return f==null&&(f=[b+1,b+1]),r==l&&(r=r+f[0]+1),h.push({content:d.label,filetype:e.filetype,active:f}),a&&h.push(HF(a)),g==0&&d.documentation&&h.push(HF(d.documentation)),h},[]),c=e.getline(t.line,!1).slice(0,t.character);this.lastPosition={bufnr:e.bufnr,lnum:t.line+1,col:me(c)+1},await this.signatureFactory.show(u,{offsetX:r})}echoSignature(e){let{signatures:t,activeParameter:i}=e,r=y.env.columns;t=t.slice(0,y.env.cmdheight);let o=[];for(let s of t){let a=[],{label:l}=s;l=l.replace(/\n/g," "),l.length>=r-16&&(l=l.slice(0,r-16)+"...");let u=l.indexOf("(");if(u==-1)a=[{text:l,type:"Normal"}];else{a.push({text:l.slice(0,u),type:"Label"});let c=l.slice(u);if(o.length==0&&i!=null){let h=s.parameters?.[i];if(h){let d,g;if(typeof h.label=="string"){let f=c.slice(0),m=f.match(new RegExp("\\b"+h.label.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")+"\\b")),b=m?m.index:f.indexOf(h.label);b==-1?a.push({text:c,type:"Normal"}):(d=b,g=b+h.label.length)}else[d,g]=h.label,d=d-u,g=g-u;d!=null&&g!=null&&(a.push({text:c.slice(0,d),type:"Normal"}),a.push({text:c.slice(d,g),type:"MoreMsg"}),a.push({text:c.slice(g),type:"Normal"}))}}else a.push({text:c,type:"Normal"})}o.push(a)}this.nvim.callTimer("coc#ui#echo_signatures",[o],!0)}dispose(){z(this.disposables),this.timer&&clearTimeout(this.timer)}}});var Bct,XSe,Ob,Bie=k(()=>{"use strict";Ie();Ee();se();fe();ie();LD();Bct=te("symbols-buffer"),XSe=ve(500,10),Ob=class{constructor(e,t){this.doc=e;this.autoUpdateBufnrs=t;this.disposables=[];this._onDidUpdate=new p.Emitter;this.onDidUpdate=this._onDidUpdate.event;this.fetchSymbols=wt(()=>{this._fetchSymbols().catch(Cd)},XSe)}async getSymbols(){let{doc:e}=this;return await e.patchChange(),this.autoUpdateBufnrs.add(e.bufnr),e.version==this.version&&this.symbols?.length?this.symbols:(this.cancel(),await this._fetchSymbols(),this.symbols)}onChange(e){e.contentChanges.length!==0&&(this.cancel(),this.autoUpdateBufnrs.has(this.doc.bufnr)&&this.fetchSymbols())}async _fetchSymbols(){let{textDocument:e}=this.doc,{version:t}=e,i=this.tokenSource=new p.CancellationTokenSource,{token:r}=i,o=await A.getDocumentSymbol(e,r);this.tokenSource=void 0,!(o==null||r.isCancellationRequested)&&(this.version=t,this.symbols=o,this._onDidUpdate.fire(o))}cancel(){this.fetchSymbols.clear(),this.tokenSource&&(this.tokenSource.cancel(),this.tokenSource.dispose(),this.tokenSource=null)}dispose(){this.cancel(),this.symbols=void 0,this._onDidUpdate.dispose(),z(this.disposables)}}});function GSe(n){return n?typeof n.text=="string"&&typeof n.hlGroup=="string":!1}function zSe(n,e){return n.label===e.label&&n.deprecated===e.deprecated&&n.key===e.key}function KSe(n,e){return n.length!==e.length?!1:n.every((t,i)=>zSe(t,e[i]))}var Ab,Wie=k(()=>{"use strict";gt();ie();At();se();Jp();Le();Ab=class{constructor(e){this.opts=e;this.disposables=[];this._onDidChangeTreeData=new p.Emitter;this.onDidChangeTreeData=this._onDidChangeTreeData.event;this.invokeCommand=`_invoke_${Te()}`,this.disposables.push(ae.registerCommand(this.invokeCommand,async t=>{await e.handleClick(t)},null,!0)),typeof e.resolveActions=="function"&&(this.resolveActions=e.resolveActions.bind(this))}iterate(e,t,i,r){let o=r(e,t,i);if(o===!1)return!1;if(Array.isArray(e.children)){for(let s of e.children)if(this.iterate(s,e,i+1,r)===!1)return!1}return o}updateNodes(e,t,i,r=!0){let o=KSe(e,t),s=(a,l,u)=>{let c=!1;for(let h of Object.keys(l))["children","key"].includes(h)||(a[h]=l[h]);if(a.children?.length&&!l.children?.length&&(delete a.children,c=!0),!a.children?.length&&l.children?.length&&(a.children=l.children,c=!0),c){u&&this._onDidChangeTreeData.fire(a);return}pe(a.children).length>0&&pe(l.children).length>0&&this.updateNodes(a.children,l.children,a,u)};if(o)for(let a=0;a!l.has(g)&&d.key==c.key):h=a.findIndex((d,g)=>!l.has(g)&&d.label==c.label),h===-1)e[u]=c;else{l.add(h);let d=a[h];s(d,c,!1),e[u]=d}}r&&this._onDidChangeTreeData.fire(i)}}update(e,t){if(this.data)return t?(this.data=pe(e),this._onDidChangeTreeData.fire(void 0)):this.updateNodes(this.data,pe(e),void 0),this.data}getTreeItem(e){let t=e.label,{expandLevel:i}=this.opts,r;if(!e.children?.length)r=new ko(t);else if(i&&i>0){let o=this.getLevel(e),s=o&&o<=i?2:1;r=new ko(t,s)}else r=new ko(t,1);if(r.description=e.description,e.deprecated&&(r.deprecated=!0),e.tooltip&&(r.tooltip=e.tooltip),GSe(e.icon))r.icon=e.icon;else if(typeof this.opts.resolveIcon=="function"){let o=this.opts.resolveIcon(e);o&&(r.icon=o)}return r}async getChildren(e){if(e)return e.children??[];if(this.data)return this.data;let t=await Promise.resolve(this.opts.provideData());if(!Array.isArray(t))throw new Error("Unable to fetch data");return this.data=t,t}getParent(e){if(!this.data)return;let t;for(let i of this.data)if(this.iterate(i,null,0,(o,s)=>{if(o===e)return t=s,!1})===!1)break;return t}getLevel(e){if(!this.data)return 0;let t=0;for(let i of pe(this.data))if(this.iterate(i,null,1,(o,s,a)=>{if(o===e)return t=a,!1})===!1)break;return t}async resolveTreeItem(e,t,i){if(typeof this.opts.resolveItem=="function"){let r=await Promise.resolve(this.opts.resolveItem(e,t,i));r&&Object.assign(e,r)}return e.command||(e.command={title:`invoke ${t.label}`,command:this.invokeCommand,arguments:[t]}),e}dispose(){this.data=[],this._onDidChangeTreeData.dispose(),typeof this.opts.onDispose=="function"&&this.opts.onDispose(),z(this.disposables)}}});function VSe(n,e){let t,i=r=>{for(let o of r)if($t(n,o.range)==0){t=o,Array.isArray(o.children)&&i(o.children);break}};return i(e),t}var QSe,Nb,qie=k(()=>{"use strict";ye();je();Ie();Wie();$p();se();Nt();Ze();be();QSe=ve(300,10),Nb=class{constructor(e,t,i){this.nvim=e;this.buffers=t;this.handler=i;this.treeViewList=[];this.providersMap=new Map;this.sortByMap=new Map;this.disposables=[];this.loadConfiguration(),y.onDidChangeConfiguration(this.loadConfiguration,this,this.disposables),y.onDidCloseTextDocument(async r=>{let{bufnr:o}=r,s=this.providersMap.get(o);!s||await e.call("bufloaded",[o])||(this.providersMap.delete(o),s.dispose())},null,this.disposables),R.onDidChangeActiveTextEditor(async r=>{if(!this.config.checkBufferSwitch)return;this.treeViewList.find(s=>s.visible&&s.targetTabId==r.tabpageid)&&(await this.showOutline(r.document.bufnr,r.tabpageid),await e.command(`noa call win_gotoid(${r.winid})`))},null,this.disposables),F.on("CursorHold",async(r,o)=>{if(!this.config.followCursor||!this.providersMap.get(r))return;let a=await e.tabpage,l=this.treeViewList.find(u=>u.visible&&u.targetBufnr==r&&u.targetTabId==a.id);l&&await this.revealPosition(r,l,oe.create(o[0]-1,o[1]-1))},null,this.disposables)}async revealPosition(e,t,i){let r=this.providersMap.get(e),o=await Promise.resolve(r.getChildren()),s=VSe(i,o);s&&await t.reveal(s)}loadConfiguration(e){if(!e||e.affectsConfiguration("outline")){let t=y.getConfiguration("outline",null);this.config={splitCommand:t.get("splitCommand"),switchSortKey:t.get("switchSortKey"),togglePreviewKey:t.get("togglePreviewKey"),followCursor:t.get("followCursor"),keepWindow:t.get("keepWindow"),expandLevel:t.get("expandLevel"),autoWidth:t.get("autoWidth"),checkBufferSwitch:t.get("checkBufferSwitch"),detailAsDescription:t.get("detailAsDescription"),sortBy:t.get("sortBy"),showLineNumber:t.get("showLineNumber"),codeActionKinds:t.get("codeActionKinds"),autoHide:t.get("autoHide"),autoPreview:t.get("autoPreview"),previewMaxWidth:t.get("previewMaxWidth"),previewBorder:t.get("previewBorder"),previewBorderRounded:t.get("previewBorderRounded"),previewHighlightGroup:t.get("previewHighlightGroup"),previewBorderHighlightGroup:t.get("previewBorderHighlightGroup"),previewWinblend:t.get("previewWinblend")}}}convertSymbolToNode(e,t){let i=[],{detailAsDescription:r,showLineNumber:o}=this.config;return r&&e.detail&&i.push(e.detail),o&&i.push(`${e.selectionRange.start.line+1}`),{label:e.name,tooltip:r?void 0:e.detail,description:i.join(" "),icon:this.handler.getIcon(e.kind),deprecated:e.tags?.includes(Sn.Deprecated),kind:e.kind,range:e.range,selectRange:e.selectionRange,children:Array.isArray(e.children)?e.children.map(s=>this.convertSymbolToNode(s,t)).sort(t):void 0}}setMessage(e,t){this.treeViewList.forEach(i=>{i.valid&&i.targetBufnr==e&&(i.message=t)})}convertSymbols(e,t){let i=this.getSortBy(e),r=(o,s)=>i==="name"?o.labelthis.convertSymbolToNode(o,r)).sort(r)}onSymbolsUpdate(e,t){let i=this.providersMap.get(e);i&&i.update(this.convertSymbols(e,t))}createProvider(e){let{nvim:t}=this,i=new Ab({expandLevel:this.config.expandLevel,provideData:async()=>{let r=this.buffers.getItem(e);if(!r)throw new Error("Document not attached");let o=y.getDocument(e);if(!A.hasProvider("documentSymbol",o.textDocument))throw new Error("Document symbol provider not found");let s=A.getDocumentSymbolMetadata(o.textDocument);s&&s.label&&this.treeViewList.filter(u=>u.valid&&u.targetBufnr==e).forEach(u=>u.description=s.label),this.setMessage(e,"Loading document symbols");let a=await r.getSymbols();if(!a||a.length==0)throw new Error("Empty symbols returned from language server. ");return this.setMessage(e,void 0),this.convertSymbols(e,a)},handleClick:async r=>{let o=await t.call("bufwinnr",[e]);if(o==-1)return;t.pauseNotification(),t.command(`${o}wincmd w`,!0);let s=r.selectRange.start;t.call("coc#cursor#move_to",[s.line,s.character],!0),t.command("normal! zz",!0);let a=t.createBuffer(e);a.highlightRanges("outline-hover","CocHoverRange",[r.selectRange]),t.command("redraw",!0),await t.resumeNotification(),setTimeout(()=>{a.clearNamespace("outline-hover"),t.command("redraw",!0)},QSe),this.config.autoHide&&await this.hide()},resolveActions:async(r,o)=>{let s=await t.call("bufwinnr",[e]);if(s==-1)return;let a=y.getDocument(e);return[...(await this.handler.getCodeActions(a,o.range,this.config.codeActionKinds)).map(c=>({title:c.title,handler:async()=>{let h=o.range.start;await t.command(`${s}wincmd w`),await this.nvim.call("coc#cursor#move_to",[h.line,h.character]),await this.handler.applyCodeAction(c)}})),{title:"Visual Select",handler:async c=>{await t.command(`${s}wincmd w`),await R.selectRange(c.range)}}]},onDispose:()=>{for(let r of this.treeViewList.slice())r.provider===i&&r.dispose()}});return i}getSortBy(e){return this.sortByMap.get(e)??this.config.sortBy}async showOutline(e,t){this.providersMap.has(e)||this.providersMap.set(e,this.createProvider(e));let i=this.treeViewList.find(r=>r.valid&&r.targetBufnr==e&&r.targetTabId==t);if(!i){let{switchSortKey:r,togglePreviewKey:o}=this.config,s=this.config.autoPreview,a;i=new Vo("OUTLINE",{autoWidth:this.config.autoWidth,bufhidden:"hide",enableFilter:!0,treeDataProvider:this.providersMap.get(e)});let l=this.getSortBy(e),u;i.description=`${l[0].toUpperCase()}${l.slice(1)}`,this.treeViewList.push(i);let c=F.on("BufEnter",h=>{a&&h!==a&&(u=void 0,this.closePreview())});i.onDispose(()=>{let h=this.treeViewList.findIndex(d=>d===i);h!==-1&&this.treeViewList.splice(h,1),c.dispose(),this.closePreview()}),i.onDidChangeVisibility(h=>{this.nvim.isVim&&h&&a&&(u=void 0,this.closePreview())}),i.onDidCursorMoved(async h=>{s&&u!==h&&(u=h,a=await this.doPreview(e,h))}),i.registerLocalKeymap("n",r,async()=>{let h=["category","name","position"],d=this.getSortBy(e),g=h.map(x=>({text:x,disabled:x===d})),f=await R.showMenuPicker(g,{title:"Choose sort method"});if(f<0)return;let m=h[f];this.sortByMap.set(e,m),this.treeViewList.filter(x=>x.targetBufnr==e).forEach(x=>{x.description=`${m[0].toUpperCase()}${m.slice(1)}`});let w=this.buffers.getItem(e);this.onSymbolsUpdate(e,w.symbols)},!0),i.registerLocalKeymap("n",o,async h=>{s=!s,s?a=await this.doPreview(e,h):(u=void 0,this.closePreview())},!0)}return await i.show(this.config.splitCommand,!1),i}async doPreview(e,t){if(!t){this.closePreview();return}let i={bufnr:e,range:t.range,border:this.config.previewBorder,rounded:this.config.previewBorderRounded,maxWidth:this.config.previewMaxWidth,highlight:this.config.previewHighlightGroup,borderhighlight:this.config.previewBorderHighlightGroup,winblend:this.config.previewWinblend};return await this.nvim.call("coc#ui#outline_preview",[i])}closePreview(){this.nvim.call("coc#ui#outline_close_preview",[],!0)}async show(e){let[t,i]=await this.nvim.eval('[bufnr("%"),win_getid()]'),r=await this.nvim.tabpage,o=y.getDocument(t);if(o&&!o.attached){R.showErrorMessage(`Unable to show outline, ${o.notAttachReason}`);return}let s=await R.getCursorPosition(),a=await this.showOutline(t,r.id);if(e==1||e===void 0&&this.config.keepWindow)await this.nvim.command(`noa call win_gotoid(${i})`);else if(this.config.followCursor){let l=a.onDidRefrash(async()=>{l.dispose(),await this.nvim.eval('bufnr("%")')==t&&a.visible&&await this.revealPosition(t,a,s)})}}has(e){return this.providersMap.has(e)}async hide(){let e=await this.nvim.call("coc#window#find",["cocViewId","OUTLINE"]);e!=-1&&await this.nvim.call("coc#window#close",[e])}dispose(){for(let e of this.treeViewList)e.dispose();this.treeViewList=[];for(let e of this.providersMap.values())e.dispose();this.providersMap.clear(),z(this.disposables)}}});function Yie(n){let e=[],t=n.slice();return t.sort(Uie),t.forEach(i=>Zie(e,i,0)),e}function Uie(n,e){let t=n.selectionRange,i=e.selectionRange;return it(t.start,i.start)}function Zie(n,e,t){let{name:i,selectionRange:r,detail:o,kind:s,children:a,range:l,tags:u}=e,{start:c}=Pe(r,l),h={col:c.character+1,lnum:c.line+1,text:i,level:t,kind:oa(s),range:l,selectionRange:r};if(o&&(h.detail=o),u&&u.includes(Sn.Deprecated)&&(h.deprecated=!0),n.push(h),a&&a.length){a.sort(Uie);for(let d of a)Zie(n,d,t+1)}}var Jie=k(()=>{"use strict";ye();se();Im();Nt()});var Hb,$ie=k(()=>{"use strict";ye();je();Ie();se();fe();Ye();Nt();ie();Ce();Ze();be();Bie();qie();Jie();Hb=class{constructor(e,t){this.nvim=e;this.handler=t;this.disposables=[];this.autoUpdateBufnrs=new Set;this.buffers=y.registerBufferSync(o=>{let{bufnr:s}=o,a=new Ob(o,this.autoUpdateBufnrs);return a.onDidUpdate(l=>{this.outline&&this.outline.onSymbolsUpdate(s,l)}),a}),this.outline=new Nb(e,this.buffers,t);let i=y.initialConfiguration.get("coc.preferences.currentFunctionSymbolDebounceTime",300),r=wt(async(o,s)=>{if(!this.buffers.getItem(o)||!this.autoUpdate(o))return;let a=y.getDocument(o),l=Jt(a.getline(s[0]-1),s[1]-1),u=oe.create(s[0]-1,l),c=await this.getFunctionSymbol(o,u);e.createBuffer(o).setVar("coc_current_function",c??"",!0),this.nvim.call("coc#util#do_autocmd",["CocStatusChange"],!0)},ve(i,0));F.on("CursorMoved",r,this,this.disposables),this.disposables.push(p.Disposable.create(()=>{r.clear()})),F.on("InsertEnter",o=>{let s=this.buffers.getItem(o);s&&s.cancel()},null,this.disposables)}autoUpdate(e){let t=y.getDocument(e);return y.getConfiguration("coc.preferences",t).get("currentFunctionSymbolAutoUpdate",!1)}get labels(){return y.getConfiguration("suggest").get("completionItemKindLabels",{})}async getWorkspaceSymbols(e){this.handler.checkProvider("workspaceSymbols",null);let t=new p.CancellationTokenSource;return await A.getWorkspaceSymbols(e,t.token)}async resolveWorkspaceSymbol(e){if(e.location?.uri)return e;let t=new p.CancellationTokenSource;return await A.resolveWorkspaceSymbol(e,t.token)}async getDocumentSymbols(e){if(!e){e=await this.nvim.call("bufnr",["%"]);let r=y.getDocument(e);if(!r||!r.attached)return}let t=this.buffers.getItem(e);if(!t)return;let i=await t.getSymbols();return i?Yie(i):void 0}async getFunctionSymbol(e,t){let i=await this.getDocumentSymbols(e),r=this.nvim.createBuffer(e);if(!i||i.length===0)return r.setVar("coc_current_function","",!0),this.nvim.call("coc#util#do_autocmd",["CocStatusChange"],!0),"";i=i.filter(a=>["Class","Method","Function","Struct"].includes(a.kind));let o="",s=this.labels;for(let a of i.reverse())if(a.range&&$t(t,a.range)==0&&!a.text.endsWith(") callback")){o=a.text;let l=s[a.kind.toLowerCase()];l&&(o=`${l} ${o}`);break}return o}async getCurrentFunctionSymbol(){let e=await this.nvim.call("bufnr",["%"]),t=y.getDocument(e);if(!t||!t.attached||!A.hasProvider("documentSymbol",t.textDocument))return;let i=await R.getCursorPosition();return await this.getFunctionSymbol(e,i)}async selectSymbolRange(e,t,i){let{doc:r}=await this.handler.getCurrentState();this.handler.checkProvider("documentSymbol",r.textDocument);let o;if(t)o=await R.getSelectedRange(t);else{let l=await R.getCursorPosition();o=q.create(l,l)}let s=await this.getDocumentSymbols(r.bufnr);if(!s||s.length===0){R.showWarningMessage("No symbols found");return}s=s.filter(l=>i.includes(l.kind));let a;for(let l of s.reverse())if(l.range&&!Be(l.range,o)&&mi(o,l.range)){a=l.range;break}if(e&&a){let{start:l,end:u}=a,c=r.getline(l.line+1),h=r.filetype==="python"?0:1,d=r.getline(u.line-h);a=q.create(l.line+1,c.match(/^\s*/)[0].length,u.line-h,d.length)}a?await R.selectRange(a):["v","V",""].includes(t)&&await this.nvim.command("normal! gv")}async showOutline(e){await this.outline.show(e)}async hideOutline(){await this.outline.hide()}hasOutline(e){return this.outline.has(e)}dispose(){this.outline.dispose(),this.buffers.dispose(),z(this.disposables)}}});function e0e(n){return fi(n,["children","parent"])}function Xie(n){return n==="supertypes"?"Super types":"Sub types"}var Bb,Gie=k(()=>{"use strict";At();je();Ie();NF();$p();se();Le();zr();Ze();be();Bb=class n{constructor(e,t){this.nvim=e;this.handler=t;this.disposables=[];this.highlightWinids=new Set;this.loadConfiguration(),y.onDidChangeConfiguration(this.loadConfiguration,this,this.disposables),F.on("BufWinEnter",(i,r)=>{this.highlightWinids.has(r)&&(this.highlightWinids.delete(r),e.createWindow(r).clearMatchGroup(n.rangesHighlight))},null,this.disposables),this.disposables.push(ae.registerCommand(n.commandId,async(i,r,o)=>{let{nvim:s}=this;await s.call("win_gotoid",[i]),await y.jumpTo(r.uri,r.range.start,o);let a=await s.window;a.clearMatchGroup(n.rangesHighlight),a.highlightRanges(n.rangesHighlight,[r.selectionRange],10,!0),this.highlightWinids.add(a.id)},null,!0))}static{this.rangesHighlight="CocSelectedRange"}static{this.commandId="typeHierarchy.reveal"}loadConfiguration(e){if(!e||e.affectsConfiguration("typeHierarchy")){let t=y.getConfiguration("typeHierarchy",null);this.config={splitCommand:t.get("splitCommand"),openCommand:t.get("openCommand"),enableTooltip:t.get("enableTooltip")}}}createProvider(e,t,i){let r=new Ku(i,t,this.config,n.commandId,e,o=>this.handler.getIcon(o),(o,s,a)=>this.getChildren(o,s,a));return r.addAction("Show Super Types",o=>{r.meta="supertypes";let s=[fi(o,["children","parent"])];r.reset(s)}),r.addAction("Show Sub Types",o=>{r.meta="subtypes";let s=[fi(o,["children","parent"])];r.reset(s)}),r}async getChildren(e,t,i){let r=[],o=e0e(e);return t=="supertypes"?r=await A.provideTypeHierarchySupertypes(o,i):r=await A.provideTypeHierarchySubtypes(o,i),r}async prepare(e,t){return this.handler.checkProvider("typeHierarchy",e),await this.handler.withRequestToken("typeHierarchy",async i=>await A.prepareTypeHierarchy(e,t,i),!1)}async showTypeHierarchyTree(e){let{doc:t,position:i,winid:r}=await this.handler.getCurrentState();await t.synchronize();let o=await this.prepare(t.textDocument,i);if(le(o)){R.showWarningMessage("Unable to get TypeHierarchyItems at cursor position.");return}let s=this.createProvider(o,r,e),a=new Vo("types",{treeDataProvider:s});a.title=Xie(e),s.onDidChangeTreeData(l=>{l||(a.title=Xie(s.meta))}),a.onDidChangeVisibility(l=>{l.visible||s.dispose()}),this.disposables.push(a),await a.show(this.config.splitCommand)}dispose(){this.highlightWinids.clear(),z(this.disposables)}}});var zie,Wb,Kie=k(()=>{"use strict";gt();zie=require("v8");$e();At();vC();qu();Ie();Ee();$a();Xu();se();oi();qi();pt();ze();fe();Ce();Ze();be();Wb=class{constructor(e){this.nvim=e;Object.defineProperty(R,"openLocalConfig",{get:()=>this.openLocalConfig.bind(this)}),ae.register({id:"workspace.openLocation",execute:async(t,i,r)=>{await e.call("win_gotoid",[t]),await y.jumpTo(i.uri,i.range.start,r)}},!0),ae.register({id:"workspace.undo",execute:async()=>{await y.files.undoWorkspaceEdit()}},!1,"Undo previous this.workspace edit"),ae.register({id:"workspace.redo",execute:async()=>{await y.files.redoWorkspaceEdit()}},!1,"Redo previous this.workspace edit"),ae.register({id:"workspace.inspectEdit",execute:async()=>{await y.files.inspectEdit()}},!1,"Inspect previous this.workspace edit in new tab"),ae.register({id:"workspace.renameCurrentFile",execute:async()=>{await this.renameCurrent()}},!1,"change current filename to a new name and reload it."),ae.register({id:"document.checkBuffer",execute:async()=>{await this.bufferCheck()}},!1,"Check providers for current buffer."),ae.register({id:"document.echoFiletype",execute:async()=>{let t=await e.call("bufnr","%"),i=y.getAttachedDocument(t);await R.echoLines([i.filetype])}},!1,"echo the mapped filetype of the current buffer"),ae.register({id:"workspace.workspaceFolders",execute:async()=>{let i=y.workspaceFolders.map(r=>Y.parse(r.uri).fsPath);await R.echoLines(i)}},!1,"show opened workspaceFolders."),ae.register({id:"workspace.writeHeapSnapshot",execute:async()=>{let t=E.join(Bt.homedir(),`${Te()}-${process.pid}.heapsnapshot`);return(0,zie.writeHeapSnapshot)(t),R.showInformationMessage(`Create heapdump at: ${t}`),t}},!1,"Generates a snapshot of the current V8 heap and writes it to a JSON file."),ae.register({id:"workspace.showOutput",execute:async t=>{t||(t=await R.showQuickPick(y.channelNames,{title:"Choose output name"})),R.showOutputChannel(de(t))}},!1,"open output buffer to show output from languageservers or extensions."),ae.register({id:"workspace.clearWatchman",execute:async()=>{let t=await R.runTerminalCommand("watchman watch-del-all");return t.success&&R.showInformationMessage("Cleared watchman watching directories."),t.success}},!1,"run watch-del-all for watchman to free up memory.")}async openLog(){let e=zy();await y.jumpTo(Y.file(e).toString())}async openLocalConfig(){let e=await this.nvim.call("expand",["%:p"]),t=await this.nvim.eval("&filetype");if(!e||!E.isAbsolute(e)){R.showWarningMessage("Current buffer doesn't have valid file path.");return}let i=y.getWorkspaceFolder(Y.file(e).toString());if(!i){let s=y.initialConfiguration.get("workspace"),a=Pe(s.rootPatterns,[]),l=Pe(s.ignoredFiletypes,[]),u;l.includes(t)&&(u=`Filetype '${t}' is ignored for workspace folder resolve.`),u||(u=`Can't resolve workspace folder for file '${e}, consider create one of ${a.join(", ")} in your project root.'.`),R.showWarningMessage(u);return}let r=Y.parse(i.uri).fsPath,o=E.join(r,".vim");if(!B.existsSync(o)){if(!await R.showPrompt(`Would you like to create folder'${r}/.vim'?`))return;B.mkdirSync(o)}await y.jumpTo(Y.file(E.join(o,Wg)))}async renameCurrent(){let{nvim:e}=this,t=await e.call("expand",["%:p"]),i=await e.callAsync("coc#util#with_callback",["input",["New path: ",t,"file"]]);i=i.trim(),!(i===t||!i)&&(t.toLowerCase()!=i.toLowerCase()&&B.existsSync(i)&&!await R.showPrompt(`${i} exists, overwrite?`)||await y.renameFile(t,i,{overwrite:!0}))}addWorkspaceFolder(e){if(!Ge(e))throw TypeError("folder should be string");if(e=y.expand(e),!La(e))throw N4(e);y.workspaceFolderControl.addWorkspaceFolder(e,!0)}async bufferCheck(){let e=await y.document;if(!e.attached){await R.showDialog({title:"Buffer check result",content:`Document not attached, ${e.notAttachReason}`,highlight:"WarningMsg"});return}let t=new fn;t.addLine("Provider state","Title"),t.addLine("");for(let i of Object.values(Gt)){if(i==="onTypeEdit")continue;let r=A.hasProvider(i,e.textDocument);t.addTexts([{text:"-",hlGroup:"Comment"},{text:" "},r?{text:"\u2713",hlGroup:"CocListFgGreen"}:{text:"\u2717",hlGroup:"CocListFgRed"},{text:" "},{text:i,hlGroup:r?"Normal":"CocFadeOut"}])}await R.showDialog({title:"Buffer check result",content:t.content,highlights:t.highlights})}async doAutocmd(e,t){await y.autocmds.doAutocmd(e,t)}async getConfiguration(e){let t=await y.document;return y.getConfiguration(e,t)}getRootPatterns(e){let t=y.getDocument(e);return t?{buffer:y.workspaceFolderControl.getRootPatterns(t,0),server:y.workspaceFolderControl.getRootPatterns(t,1),global:y.workspaceFolderControl.getRootPatterns(t,2)}:null}async ensureDocument(){let e=await y.document;return e&&e.attached}async doKeymap(e,t=""){return await y.keymaps.doKeymap(e,t)}async snippetCheck(e,t){return!!(t&&Fi.jumpable()||e&&await Promise.resolve(ti.manager.call("coc-snippets","expandable",[])))}async showInfo(){let e=[],t=y.version+"-77ae2d43 2024-04-19 18:15:40 +0800";e.push("## versions"),e.push("");let r=(await this.nvim.call("execute",["version"])).trim().split(/\r?\n/,2)[0].replace(/\(.*\)/,"").trim();e.push("vim version: "+r+`${Si?" "+y.env.version:""}`),e.push("node version: "+process.version),e.push("coc.nvim version: "+t),e.push("coc.nvim directory: "+E.dirname(__dirname)),e.push("term: "+Pe(process.env.TERM_PROGRAM,process.env.TERM)),e.push("platform: "+process.platform),e.push(""),e.push("## Log of coc.nvim"),e.push("");let o=zy(),s=Wy();if(B.existsSync(o)){let l=B.readFileSync(o,{encoding:"utf8"});e.push(...l.split(/\r?\n/).map(u=>s(u)))}await this.nvim.command("vnew +setl\\ buftype=nofile\\ bufhidden=wipe\\ nobuflisted"),await(await this.nvim.buffer).setLines(e,{start:0,end:-1,strictIndexing:!1})}}});var t0e,i0e,qb,Qie=k(()=>{"use strict";ye();At();je();Ie();Ee();se();Im();Ye();ie();Kr();Ze();be();nie();rie();aie();hie();die();gie();pie();mie();bie();wie();xie();Die();Tie();Iie();Fie();Mie();Nie();Hie();$ie();Gie();Kie();t0e=te("Handler"),i0e=ve(500,10),qb=class{constructor(e){this.nvim=e;this.disposables=[];F.on(["CursorMoved","CursorMovedI","InsertEnter","InsertSnippet","InsertLeave"],()=>{this.requestTokenSource&&(this.requestTokenSource.cancel(),this.requestTokenSource=null)},null,this.disposables),this.fold=new mb(e,this),this.links=new Db(e,this),this.codeLens=new hb(e),this.colors=new pb(e,this),this.format=new bb(e,this),this.symbols=new Hb(e,this),this.refactor=new Rb(e,this),this.hover=new wb(e,this),this.locations=new Tb(e,this),this.signature=new jb(e,this),this.rename=new Eb(e,this),this.workspace=new Wb(e),this.codeActions=new ub(e,this),this.commands=new fb(e),this.callHierarchy=new lb(e,this),this.typeHierarchy=new Bb(e,this),this.documentHighlighter=new yb(e,this),this.semanticHighlighter=new Mb(e),this.selectionRange=new Lb(e,this),this.linkedEditingHandler=new Sb(e,this),this.inlayHintHandler=new Cb(e,this),this.disposables.push({dispose:()=>{this.callHierarchy.dispose(),this.typeHierarchy.dispose(),this.codeLens.dispose(),this.links.dispose(),this.refactor.dispose(),this.signature.dispose(),this.symbols.dispose(),this.hover.dispose(),this.colors.dispose(),this.documentHighlighter.dispose(),this.semanticHighlighter.dispose()}}),this.registerCommands()}registerCommands(){ae.register({id:"document.renameCurrentWord",execute:async()=>{let e=await y.document,t=await this.rename.getWordEdit(),i=fX(e.uri,Ke(t));if(!i)return R.showWarningMessage("Invalid position");await ae.executeCommand("editor.action.addRanges",i)}},!1,"rename word under cursor in current buffer by multiple cursors."),ae.register({id:["workbench.action.reloadWindow","editor.action.restart"],execute:()=>{this.nvim.command("CocRestart",!0)}},!0),this.register("vscode.open",async e=>{await y.openResource(e.toString())}),this.register("editor.action.doCodeAction",async e=>{await this.codeActions.applyCodeAction(e)}),this.register("editor.action.triggerParameterHints",async()=>{await this.signature.triggerSignatureHelp()}),this.register("editor.action.showReferences",async(e,t,i)=>{await y.jumpTo(e,t),await y.showLocations(i)}),this.register("editor.action.rename",async(e,t,i)=>(Array.isArray(e)&&(t=e[1],e=e[0]),await y.jumpTo(e,t),await this.rename.rename(i))),this.register("editor.action.format",async()=>{await this.format.formatCurrentBuffer()}),this.register("editor.action.showRefactor",async e=>{let t=e.filter(i=>Xe.is(i));return await this.refactor.fromLocations(t)})}register(e,t){this.disposables.push(ae.registerCommand(e,t,null,!0))}get requestStatusItem(){return this._requestStatusItem?this._requestStatusItem:(this._requestStatusItem=R.createStatusBarItem(0,{progress:!0}),this._requestStatusItem)}get labels(){return y.initialConfiguration.get("suggest.completionItemKindLabels",{})}get uri(){return R.activeTextEditor?.document.uri}async getCurrentState(){let{nvim:e}=this,[t,[i,r],o,s]=await e.eval("[bufnr('%'),coc#cursor#position(),win_getid(),mode()]");return{doc:y.getAttachedDocument(t),mode:s,position:oe.create(i,r),winid:o}}addDisposable(e){this.disposables.push(e)}checkProvider(e,t){if(!A.hasProvider(e,t))throw new Error(`${e} provider not found for current buffer, your language server doesn't support it.`)}async withRequestToken(e,t,i){this.requestTokenSource&&(this.requestTokenSource.cancel(),this.requestTokenSource.dispose()),clearTimeout(this.requestTimer);let r=this.requestStatusItem;this.requestTokenSource=new p.CancellationTokenSource;let{token:o}=this.requestTokenSource;o.onCancellationRequested(()=>{r.text=`${e} request canceled`,r.isProgress=!1,this.requestTimer=setTimeout(()=>{r.hide()},i0e)}),r.isProgress=!0,r.text=`requesting ${e}`,r.show();let s;try{s=await Promise.resolve(t(o))}catch(a){t0e.error(`Error on request ${e}`,a),this.nvim.errWriteLine(`Error on ${e}: ${a}`)}return this.requestTokenSource&&(this.requestTokenSource.dispose(),this.requestTokenSource=void 0),o.isCancellationRequested?null:(r.hide(),i&&(!s||Array.isArray(s)&&s.length==0)?(R.showWarningMessage(`${e} not found`),null):s)}getIcon(e){let{labels:t}=this,i=oa(e),r=typeof t.default=="string"?t.default:i[0].toLowerCase(),o=i=="Unknown"?"":t[i[0].toLowerCase()+i.slice(1)];return o||(o=r),{text:o,hlGroup:i=="Unknown"?"CocSymbolDefault":`CocSymbol${i}`}}async getCodeActions(e,t,i){return(await this.codeActions.getCodeActions(e,t,i)).filter(o=>!o.disabled)}async applyCodeAction(e){await this.codeActions.applyCodeAction(e)}async hasProvider(e,t){t||(t=await this.nvim.call("bufnr","%"));let i=y.getDocument(t);return!i||!i.attached?!1:A.hasProvider(e,i.textDocument)}dispose(){this.requestTimer&&clearTimeout(this.requestTimer),z(this.disposables)}}});var n0e,Yb,Vie=k(()=>{"use strict";ye();At();Gte();$u();Qte();Oh();je();qu();Qie();pD();Ee();Hm();Xu();se();Ze();be();n0e=te("plugin"),Yb=class{constructor(e){this.nvim=e;this.ready=!1;this.initialized=!1;this.actions=new Map;this.disposables=[];Object.defineProperty(R,"workspace",{get:()=>y}),Object.defineProperty(y,"nvim",{get:()=>this.nvim}),Object.defineProperty(R,"nvim",{get:()=>this.nvim}),Object.defineProperty(R,"cursors",{get:()=>this.cursors}),Object.defineProperty(ae,"nvim",{get:()=>this.nvim}),this.cursors=new sb(e),un.init(e),this.addAction("checkJsonExtension",()=>{ti.has("coc-json")||R.showInformationMessage("Run :CocInstall coc-json for json intellisense")}),this.addAction("rootPatterns",t=>this.handler.workspace.getRootPatterns(t)),this.addAction("ensureDocument",()=>this.handler.workspace.ensureDocument()),this.addAction("addWorkspaceFolder",t=>this.handler.workspace.addWorkspaceFolder(t)),this.addAction("getConfig",t=>this.handler.workspace.getConfiguration(t)),this.addAction("doAutocmd",(t,...i)=>this.handler.workspace.doAutocmd(t,i)),this.addAction("openLog",()=>this.handler.workspace.openLog()),this.addAction("attach",()=>y.attach()),this.addAction("detach",()=>y.detach()),this.addAction("doKeymap",(t,i)=>this.handler.workspace.doKeymap(t,i)),this.addAction("registerExtensions",(...t)=>ti.manager.loadExtension(t),"registExtensions"),this.addAction("snippetCheck",(t,i)=>this.handler.workspace.snippetCheck(t,i)),this.addAction("snippetInsert",(t,i,r,o)=>Fi.insertSnippet(i,!0,t,r,o,!0)),this.addAction("snippetNext",()=>Fi.nextPlaceholder()),this.addAction("snippetPrev",()=>Fi.previousPlaceholder()),this.addAction("snippetCancel",()=>Fi.cancel()),this.addAction("openLocalConfig",()=>this.handler.workspace.openLocalConfig()),this.addAction("bufferCheck",()=>this.handler.workspace.bufferCheck()),this.addAction("showInfo",()=>this.handler.workspace.showInfo()),this.addAction("hasProvider",(t,i)=>this.handler.hasProvider(t,i)),this.addAction("cursorsSelect",(t,i,r)=>this.cursors.select(t,i,r)),this.addAction("fillDiagnostics",t=>_i.setLocationlist(t)),this.addAction("commandList",()=>this.handler.commands.getCommandList()),this.addAction("selectSymbolRange",(t,i,r)=>this.handler.symbols.selectSymbolRange(t,i,r)),this.addAction("openList",(...t)=>un.start(t)),this.addAction("listNames",()=>un.names),this.addAction("listDescriptions",()=>un.descriptions),this.addAction("listLoadItems",t=>un.loadItems(t)),this.addAction("listResume",t=>un.resume(t)),this.addAction("listCancel",()=>un.cancel(!0)),this.addAction("listPrev",t=>un.previous(t)),this.addAction("listNext",t=>un.next(t)),this.addAction("listFirst",t=>un.first(t)),this.addAction("listLast",t=>un.last(t)),this.addAction("sendRequest",(t,i,r)=>Gn.sendRequest(t,i,r)),this.addAction("sendNotification",(t,i,r)=>Gn.sendNotification(t,i,r)),this.addAction("registerNotification",(t,i)=>Gn.registerNotification(t,i),"registNotification"),this.addAction("updateConfig",(t,i)=>y.configurations.updateMemoryConfig({[t]:i})),this.addAction("links",()=>this.handler.links.getLinks()),this.addAction("openLink",()=>this.handler.links.openCurrentLink()),this.addAction("pickColor",()=>this.handler.colors.pickColor()),this.addAction("colorPresentation",()=>this.handler.colors.pickPresentation()),this.addAction("highlight",()=>this.handler.documentHighlighter.highlight()),this.addAction("fold",t=>this.handler.fold.fold(t)),this.addAction("startCompletion",t=>eb.startCompletion(t)),this.addAction("sourceStat",()=>Ui.sourceStats()),this.addAction("refreshSource",t=>Ui.refresh(t)),this.addAction("toggleSource",t=>Ui.toggleSource(t)),this.addAction("diagnosticRefresh",t=>_i.refresh(t)),this.addAction("diagnosticInfo",t=>_i.echoCurrentMessage(t)),this.addAction("diagnosticToggle",t=>_i.toggleDiagnostic(t)),this.addAction("diagnosticToggleBuffer",(t,i)=>_i.toggleDiagnosticBuffer(t,i)),this.addAction("diagnosticNext",t=>_i.jumpNext(t)),this.addAction("diagnosticPrevious",t=>_i.jumpPrevious(t)),this.addAction("diagnosticPreview",()=>_i.preview()),this.addAction("diagnosticList",()=>_i.getDiagnosticList()),this.addAction("findLocations",(t,i,r,o)=>this.handler.locations.findLocations(t,i,r,o)),this.addAction("getTagList",()=>this.handler.locations.getTagList()),this.addAction("definitions",()=>this.handler.locations.definitions()),this.addAction("declarations",()=>this.handler.locations.declarations()),this.addAction("implementations",()=>this.handler.locations.implementations()),this.addAction("typeDefinitions",()=>this.handler.locations.typeDefinitions()),this.addAction("references",t=>this.handler.locations.references(t)),this.addAction("jumpUsed",t=>this.handler.locations.gotoReferences(t,!1)),this.addAction("jumpDefinition",t=>this.handler.locations.gotoDefinition(t)),this.addAction("jumpReferences",t=>this.handler.locations.gotoReferences(t)),this.addAction("jumpTypeDefinition",t=>this.handler.locations.gotoTypeDefinition(t)),this.addAction("jumpDeclaration",t=>this.handler.locations.gotoDeclaration(t)),this.addAction("jumpImplementation",t=>this.handler.locations.gotoImplementation(t)),this.addAction("doHover",t=>this.handler.hover.onHover(t)),this.addAction("definitionHover",t=>this.handler.hover.definitionHover(t)),this.addAction("getHover",t=>this.handler.hover.getHover(t)),this.addAction("showSignatureHelp",()=>this.handler.signature.triggerSignatureHelp()),this.addAction("documentSymbols",t=>this.handler.symbols.getDocumentSymbols(t)),this.addAction("symbolRanges",()=>this.handler.documentHighlighter.getSymbolsRanges()),this.addAction("selectionRanges",()=>this.handler.selectionRange.getSelectionRanges()),this.addAction("rangeSelect",(t,i)=>this.handler.selectionRange.selectRange(t,i)),this.addAction("rename",t=>this.handler.rename.rename(t)),this.addAction("getWorkspaceSymbols",t=>this.handler.symbols.getWorkspaceSymbols(t)),this.addAction("resolveWorkspaceSymbol",t=>this.handler.symbols.resolveWorkspaceSymbol(t)),this.addAction("formatSelected",t=>this.handler.format.formatCurrentRange(t)),this.addAction("format",()=>this.handler.format.formatCurrentBuffer()),this.addAction("commands",()=>ae.commandList),this.addAction("services",()=>Gn.getServiceStats()),this.addAction("toggleService",t=>Gn.toggle(t)),this.addAction("codeAction",(t,i,r)=>this.handler.codeActions.doCodeAction(t,i,r)),this.addAction("organizeImport",()=>this.handler.codeActions.organizeImport()),this.addAction("fixAll",()=>this.handler.codeActions.doCodeAction(null,[gi.SourceFixAll])),this.addAction("doCodeAction",t=>this.handler.codeActions.applyCodeAction(t)),this.addAction("codeActions",(t,i)=>this.handler.codeActions.getCurrentCodeActions(t,i)),this.addAction("quickfixes",t=>this.handler.codeActions.getCurrentCodeActions(t,[gi.QuickFix])),this.addAction("codeLensAction",()=>this.handler.codeLens.doAction()),this.addAction("doQuickfix",()=>this.handler.codeActions.doQuickfix()),this.addAction("search",(...t)=>this.handler.refactor.search(t)),this.addAction("saveRefactor",t=>this.handler.refactor.save(t)),this.addAction("refactor",()=>this.handler.refactor.doRefactor()),this.addAction("runCommand",(...t)=>this.handler.commands.runCommand(...t)),this.addAction("repeatCommand",()=>this.handler.commands.repeat()),this.addAction("installExtensions",(...t)=>ti.installExtensions(t)),this.addAction("updateExtensions",t=>ti.updateExtensions(t)),this.addAction("extensionStats",()=>ti.getExtensionStates()),this.addAction("loadedExtensions",()=>ti.manager.loadedExtensions),this.addAction("watchExtension",t=>ti.manager.watchExtension(t)),this.addAction("activeExtension",t=>ti.manager.activate(t)),this.addAction("deactivateExtension",t=>ti.manager.deactivate(t)),this.addAction("reloadExtension",t=>ti.manager.reloadExtension(t)),this.addAction("toggleExtension",t=>ti.manager.toggleExtension(t)),this.addAction("uninstallExtension",(...t)=>ti.manager.uninstallExtensions(t)),this.addAction("getCurrentFunctionSymbol",()=>this.handler.symbols.getCurrentFunctionSymbol()),this.addAction("showOutline",t=>this.handler.symbols.showOutline(t)),this.addAction("hideOutline",()=>this.handler.symbols.hideOutline()),this.addAction("getWordEdit",()=>this.handler.rename.getWordEdit()),this.addAction("addCommand",t=>this.handler.commands.addVimCommand(t)),this.addAction("addRanges",t=>this.cursors.addRanges(t)),this.addAction("currentWorkspacePath",()=>y.rootPath),this.addAction("selectCurrentPlaceholder",t=>Fi.selectCurrentPlaceholder(!!t)),this.addAction("codeActionRange",(t,i,r)=>this.handler.codeActions.codeActionRange(t,i,r)),this.addAction("incomingCalls",t=>this.handler.callHierarchy.getIncoming(t)),this.addAction("outgoingCalls",t=>this.handler.callHierarchy.getOutgoing(t)),this.addAction("showIncomingCalls",()=>this.handler.callHierarchy.showCallHierarchyTree("incoming")),this.addAction("showOutgoingCalls",()=>this.handler.callHierarchy.showCallHierarchyTree("outgoing")),this.addAction("showSuperTypes",()=>this.handler.typeHierarchy.showTypeHierarchyTree("supertypes")),this.addAction("showSubTypes",()=>this.handler.typeHierarchy.showTypeHierarchyTree("subtypes")),this.addAction("inspectSemanticToken",()=>this.handler.semanticHighlighter.inspectSemanticToken()),this.addAction("semanticHighlight",()=>this.handler.semanticHighlighter.highlightCurrent()),this.addAction("showSemanticHighlightInfo",()=>this.handler.semanticHighlighter.showHighlightInfo())}get workspace(){return y}get completion(){return eb}addAction(e,t,i){if(this.actions.has(e))throw new Error(`Action ${e} already exists`);this.actions.set(e,t),i&&this.actions.set(i,t)}async init(e){if(this.initialized)return;this.initialized=!0;let{nvim:t}=this;await ti.init(e),await y.init(R),t.setVar("coc_workspace_initialized",!0,!0),Fi.init(),Gn.init(),Ui.init(),eb.init(),_i.init(),this.handler=new qb(t),this.disposables.push(this.handler),un.registerLists(),await ti.activateExtensions(),y.configurations.flushConfigurations(),t.pauseNotification(),t.setVar("coc_service_initialized",1,!0),t.call("coc#util#do_autocmd",["CocNvimInit"],!0),t.resumeNotification(!1,!0),n0e.info(`coc.nvim initialized with node: ${process.version} after`,Date.now()-ve(global.__starttime,Date.now())),this.ready=!0,await F.fire("ready",[])}get isReady(){return this.ready}hasAction(e){return this.actions.has(e)}async cocAction(e,...t){let i=this.actions.get(e);if(!i)throw new Error(`Action "${e}" not exist`);return await Promise.resolve(i.apply(null,t))}getHandler(){return this.handler}dispose(){z(this.disposables),ti.dispose(),un.dispose(),y.dispose(),R.dispose(),Ui.dispose(),Gn.dispose(),Fi.dispose(),ae.dispose(),eb.dispose(),_i.dispose()}}});var VF={};Sl(VF,{default:()=>o0e,pathReplace:()=>tne});function tne(n){if(Et(n)){let e=Y.file;Y.file=t=>(t=t.replace(/\\/g,"/"),Object.keys(n).forEach(i=>t=t.replace(new RegExp("^"+i),n[i])),e(t))}}var ene,Mo,r0e,KF,QF,o0e,eM=k(()=>{"use strict";ene=co(j4());$e();je();Ee();Vie();oi();ze();fe();Ce();DF();Mo=te("attach"),r0e=["installExtensions","updateExtensions"],KF=Mr.parse(Xl),QF=[];o0e=(n,e=!1)=>{let t=(0,ene.attach)(n,te("node-client"),e);t.setVar("coc_process_pid",process.pid,!0),t.setClientInfo("coc",{major:KF.major,minor:KF.minor,patch:KF.patch},"remote",{},{});let i=new Yb(t),r=F.on("ready",()=>{r.dispose();for(let[s,a]of QF)i.cocAction(s,...a).catch(l=>{console.error(`Error on notification "${s}": ${l}`),Mo.error(`Error on notification ${s}`,l)});QF=[]});t.on("notification",async(s,a)=>{switch(s){case"VimEnter":{tne(a[0]),await i.init(a[1]);break}case"Log":{Mo.debug("Vim log",...a);break}case"TaskExit":case"TaskStderr":case"TaskStdout":case"GlobalChange":case"PromptInsert":case"InputChar":case"MenuInput":case"OptionSet":case"PromptKeyPress":case"FloatBtnClick":case"CompleteStop":case"PumInsert":case"PumNavigate":Mo.trace("Event: ",s,...a),await F.fire(s,a);break;case"CocAutocmd":Mo.trace("Notification autocmd:",...a),await F.fire(a[0],a.slice(1));break;case"redraw":break;default:try{if(Mo.info("receive notification:",s,a),!i.isReady){QF.push([s,a]);return}await i.cocAction(s,...a)}catch(l){console.error(`Error on notification "${s}": ${Jr(l)}`),Mo.error(`Error on notification ${s}`,l)}}});let o=mD("Request",3e3);return t.on("request",async(s,a,l)=>{o.start(s);try{if(F.requesting=!0,s=="CompleteStop")Mo.trace("Event: ",s,...a),await F.fire(s,a),l.send(void 0);else if(s=="CocAutocmd")Mo.trace("Request autocmd:",...a),await F.fire(a[0],a.slice(1)),l.send(void 0);else if(!i.isReady&&!r0e.includes(s))Mo.warn(`Plugin not ready on request "${s}"`,a),l.send("Plugin not ready",!0);else{Mo.info("Request action:",s,a);let u=await i.cocAction(s,...a);l.send(u)}F.requesting=!1}catch(u){F.requesting=!1,l.send(Jr(u),!0),Mo.error("Request error:",s,a,u)}o.stop()}),i}});if(global.__isMain){Object.defineProperty(console,"log",{value(){e&&e.info(...arguments)}});let{createLogger:n}=(Ee(),ic(WT)),e=n("server");process.on("uncaughtException",function(i){let r="Uncaught exception: "+i.message;console.error(r),e.error("uncaughtException",i.stack)}),process.on("unhandledRejection",function(i,r){if(i instanceof Error)if(typeof i.code=="number"){let o="Unhandled response error "+i.code+" from language server: "+i.message;i.data!=null?console.error(o,i.data):console.error(o)}else console.error("UnhandledRejection: "+i.message+` +Highlight group: ${de(s.hlGroup)}`,highlights:l}];FD||(FD=R.createFloatFactory({title:"Semantic token info",highlight:"Normal",borderhighlight:"MoreMsg",border:[1,1,1,1]})),await FD.show(u,{winblend:0})}else this.closeFloat()}closeFloat(){FD?.close()}async getCurrentItem(){let e=await this.nvim.buffer;return this.getItem(e.id)}getItem(e){return this.highlighters.getItem(e)}async highlightCurrent(){let e=await this.getCurrentItem();if(!e||!e.enabled)throw new Error("Unable to perform semantic highlights for current buffer.");await e.forceHighlight()}async showHighlightInfo(){let e=await this.nvim.call("bufnr",["%"]);y.getAttachedDocument(e);let{nvim:t}=this,i=this.highlighters.getItem(e),r=new fn;t.pauseNotification(),t.command(`vs +setl\\ buftype=nofile __coc_semantic_highlights_${e}__`,!0),t.command("setl bufhidden=wipe noswapfile nobuflisted wrap undolevels=-1",!0),t.call("bufnr",["%"],!0);let o=await t.resumeNotification();r.addLine("Semantic highlights info",zF),r.addLine("");try{i.checkState();let s=i.highlights??[];r.addLine("The number of semantic tokens: "),r.addText(String(s.length),"Number"),r.addLine(""),r.addLine("Semantic highlight groups used by current buffer",zF),r.addLine("");let a=Oi(s.filter(c=>c.hlGroup!=null).map(({hlGroup:c})=>c));for(let c of a)r.addTexts([{text:"-",hlGroup:"Comment"},{text:" "},{text:c,hlGroup:c}]);r.addLine(""),r.addLine("Tokens types that current Language Server supported:",zF),r.addLine("");let l=y.getDocument(i.bufnr),u=A.getLegend(l.textDocument)??A.getLegend(l.textDocument,!0);if(u.tokenTypes.length){for(let c of[...new Set(u.tokenTypes)]){let h=ID+"Type"+Ib(c);r.addTexts([{text:"-",hlGroup:"Comment"},{text:" "},{text:h,hlGroup:h}])}r.addLine("")}else r.addLine("No token types supported","Comment"),r.addLine("")}catch(s){r.addLine(Jr(s))}t.pauseNotification(),r.render(t.createBuffer(o[0][2])),t.resumeNotification(!0,!0)}dispose(){this.highlighters.dispose(),z(this.disposables)}}});var $Se,jb,Hie=k(()=>{"use strict";je();Ie();se();Le();fe();ie();Ce();Ze();be();LD();$Se=ve(100,10),jb=class{constructor(e,t){this.nvim=e;this.handler=t;this.disposables=[];this.loadConfiguration(),this.signatureFactory=R.createFloatFactory(Object.assign({preferTop:this.config.preferAbove,autoHide:!1,modes:["i","ic","s"]},this.config.floatConfig)),this.disposables.push(this.signatureFactory),y.onDidChangeConfiguration(this.loadConfiguration,this,this.disposables),F.on("CursorMovedI",wt(this.checkCurosr.bind(this),$Se),null,this.disposables),F.on(["InsertLeave","BufEnter"],()=>{this.tokenSource?.cancel()},null,this.disposables),F.on("TextChangedI",()=>{this.config.hideOnChange&&this.signatureFactory.close()},null,this.disposables),F.on("TextInsert",async(i,r,o)=>{if(!this.config.enableTrigger)return;let s=y.getDocument(i);!s||!s.attached||!A.shouldTriggerSignatureHelp(s.textDocument,o)||await this._triggerSignatureHelp(s,{line:r.lnum-1,character:r.pre.length},!1)},null,this.disposables),R.onDidChangeActiveTextEditor(()=>{this.loadConfiguration()},null,this.disposables)}checkCurosr(e,t){let i=this.lastPosition,r=this.signatureFactory;if(!i||e!==i.bufnr||r.window==null)return;let o=y.getDocument(e);if(!o||t[0]!=i.lnum||t[1]{o.dispose(),this.tokenSource=void 0});let{target:a}=this.config,l=this.timer=setTimeout(()=>{o.cancel()},this.config.wait);await e.patchChange(!0);let u=await A.getSignatureHelp(e.textDocument,t,s,{isRetrigger:this.signatureFactory.checkRetrigger(e.bufnr),triggerKind:i?p.SignatureHelpTriggerKind.Invoked:p.SignatureHelpTriggerKind.TriggerCharacter});if(clearTimeout(l),s.isCancellationRequested)return!1;if(!u||u.signatures.length==0)return this.signatureFactory.close(),!1;let{activeSignature:c,signatures:h}=u;if(c){let[d]=h.splice(c,1);d&&h.unshift(d)}return a=="echo"?this.echoSignature(u):await this.showSignatureHelp(e,t,u,r),!0}async showSignatureHelp(e,t,i,r){let{signatures:o,activeParameter:s}=i;s=typeof s=="number"?s:void 0;let a=null,l=r,u=o.reduce((h,d,g)=>{let f=null,m=d.activeParameter??s;m===void 0&&!le(d.parameters)&&(m=0);let b=d.label.indexOf("(");if(g==0&&typeof m=="number"){let w=d.parameters?.[m];if(w){let x=d.label.slice(b==-1?0:b);if(a=w.documentation,typeof w.label=="string"){let D=x.slice(0),M=D.match(new RegExp("\\b"+w.label.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")+"\\b")),L=M?M.index:D.indexOf(w.label);L!=-1&&(f=[L+b,L+w.label.length+b])}else f=w.label}}return f==null&&(f=[b+1,b+1]),r==l&&(r=r+f[0]+1),h.push({content:d.label,filetype:e.filetype,active:f}),a&&h.push(HF(a)),g==0&&d.documentation&&h.push(HF(d.documentation)),h},[]),c=e.getline(t.line,!1).slice(0,t.character);this.lastPosition={bufnr:e.bufnr,lnum:t.line+1,col:me(c)+1},await this.signatureFactory.show(u,{offsetX:r})}echoSignature(e){let{signatures:t,activeParameter:i}=e,r=y.env.columns;t=t.slice(0,y.env.cmdheight);let o=[];for(let s of t){let a=[],{label:l}=s;l=l.replace(/\n/g," "),l.length>=r-16&&(l=l.slice(0,r-16)+"...");let u=l.indexOf("(");if(u==-1)a=[{text:l,type:"Normal"}];else{a.push({text:l.slice(0,u),type:"Label"});let c=l.slice(u);if(o.length==0&&i!=null){let h=s.parameters?.[i];if(h){let d,g;if(typeof h.label=="string"){let f=c.slice(0),m=f.match(new RegExp("\\b"+h.label.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")+"\\b")),b=m?m.index:f.indexOf(h.label);b==-1?a.push({text:c,type:"Normal"}):(d=b,g=b+h.label.length)}else[d,g]=h.label,d=d-u,g=g-u;d!=null&&g!=null&&(a.push({text:c.slice(0,d),type:"Normal"}),a.push({text:c.slice(d,g),type:"MoreMsg"}),a.push({text:c.slice(g),type:"Normal"}))}}else a.push({text:c,type:"Normal"})}o.push(a)}this.nvim.callTimer("coc#ui#echo_signatures",[o],!0)}dispose(){z(this.disposables),this.timer&&clearTimeout(this.timer)}}});var Bct,XSe,Ob,Bie=k(()=>{"use strict";Ie();Ee();se();fe();ie();LD();Bct=te("symbols-buffer"),XSe=ve(500,10),Ob=class{constructor(e,t){this.doc=e;this.autoUpdateBufnrs=t;this.disposables=[];this._onDidUpdate=new p.Emitter;this.onDidUpdate=this._onDidUpdate.event;this.fetchSymbols=wt(()=>{this._fetchSymbols().catch(Cd)},XSe)}async getSymbols(){let{doc:e}=this;return await e.patchChange(),this.autoUpdateBufnrs.add(e.bufnr),e.version==this.version&&this.symbols?.length?this.symbols:(this.cancel(),await this._fetchSymbols(),this.symbols)}onChange(e){e.contentChanges.length!==0&&(this.cancel(),this.autoUpdateBufnrs.has(this.doc.bufnr)&&this.fetchSymbols())}async _fetchSymbols(){let{textDocument:e}=this.doc,{version:t}=e,i=this.tokenSource=new p.CancellationTokenSource,{token:r}=i,o=await A.getDocumentSymbol(e,r);this.tokenSource=void 0,!(o==null||r.isCancellationRequested)&&(this.version=t,this.symbols=o,this._onDidUpdate.fire(o))}cancel(){this.fetchSymbols.clear(),this.tokenSource&&(this.tokenSource.cancel(),this.tokenSource.dispose(),this.tokenSource=null)}dispose(){this.cancel(),this.symbols=void 0,this._onDidUpdate.dispose(),z(this.disposables)}}});function GSe(n){return n?typeof n.text=="string"&&typeof n.hlGroup=="string":!1}function zSe(n,e){return n.label===e.label&&n.deprecated===e.deprecated&&n.key===e.key}function KSe(n,e){return n.length!==e.length?!1:n.every((t,i)=>zSe(t,e[i]))}var Ab,Wie=k(()=>{"use strict";gt();ie();At();se();Jp();Le();Ab=class{constructor(e){this.opts=e;this.disposables=[];this._onDidChangeTreeData=new p.Emitter;this.onDidChangeTreeData=this._onDidChangeTreeData.event;this.invokeCommand=`_invoke_${Te()}`,this.disposables.push(ae.registerCommand(this.invokeCommand,async t=>{await e.handleClick(t)},null,!0)),typeof e.resolveActions=="function"&&(this.resolveActions=e.resolveActions.bind(this))}iterate(e,t,i,r){let o=r(e,t,i);if(o===!1)return!1;if(Array.isArray(e.children)){for(let s of e.children)if(this.iterate(s,e,i+1,r)===!1)return!1}return o}updateNodes(e,t,i,r=!0){let o=KSe(e,t),s=(a,l,u)=>{let c=!1;for(let h of Object.keys(l))["children","key"].includes(h)||(a[h]=l[h]);if(a.children?.length&&!l.children?.length&&(delete a.children,c=!0),!a.children?.length&&l.children?.length&&(a.children=l.children,c=!0),c){u&&this._onDidChangeTreeData.fire(a);return}pe(a.children).length>0&&pe(l.children).length>0&&this.updateNodes(a.children,l.children,a,u)};if(o)for(let a=0;a!l.has(g)&&d.key==c.key):h=a.findIndex((d,g)=>!l.has(g)&&d.label==c.label),h===-1)e[u]=c;else{l.add(h);let d=a[h];s(d,c,!1),e[u]=d}}r&&this._onDidChangeTreeData.fire(i)}}update(e,t){if(this.data)return t?(this.data=pe(e),this._onDidChangeTreeData.fire(void 0)):this.updateNodes(this.data,pe(e),void 0),this.data}getTreeItem(e){let t=e.label,{expandLevel:i}=this.opts,r;if(!e.children?.length)r=new ko(t);else if(i&&i>0){let o=this.getLevel(e),s=o&&o<=i?2:1;r=new ko(t,s)}else r=new ko(t,1);if(r.description=e.description,e.deprecated&&(r.deprecated=!0),e.tooltip&&(r.tooltip=e.tooltip),GSe(e.icon))r.icon=e.icon;else if(typeof this.opts.resolveIcon=="function"){let o=this.opts.resolveIcon(e);o&&(r.icon=o)}return r}async getChildren(e){if(e)return e.children??[];if(this.data)return this.data;let t=await Promise.resolve(this.opts.provideData());if(!Array.isArray(t))throw new Error("Unable to fetch data");return this.data=t,t}getParent(e){if(!this.data)return;let t;for(let i of this.data)if(this.iterate(i,null,0,(o,s)=>{if(o===e)return t=s,!1})===!1)break;return t}getLevel(e){if(!this.data)return 0;let t=0;for(let i of pe(this.data))if(this.iterate(i,null,1,(o,s,a)=>{if(o===e)return t=a,!1})===!1)break;return t}async resolveTreeItem(e,t,i){if(typeof this.opts.resolveItem=="function"){let r=await Promise.resolve(this.opts.resolveItem(e,t,i));r&&Object.assign(e,r)}return e.command||(e.command={title:`invoke ${t.label}`,command:this.invokeCommand,arguments:[t]}),e}dispose(){this.data=[],this._onDidChangeTreeData.dispose(),typeof this.opts.onDispose=="function"&&this.opts.onDispose(),z(this.disposables)}}});function VSe(n,e){let t,i=r=>{for(let o of r)if($t(n,o.range)==0){t=o,Array.isArray(o.children)&&i(o.children);break}};return i(e),t}var QSe,Nb,qie=k(()=>{"use strict";ye();je();Ie();Wie();$p();se();Nt();Ze();be();QSe=ve(300,10),Nb=class{constructor(e,t,i){this.nvim=e;this.buffers=t;this.handler=i;this.treeViewList=[];this.providersMap=new Map;this.sortByMap=new Map;this.disposables=[];this.loadConfiguration(),y.onDidChangeConfiguration(this.loadConfiguration,this,this.disposables),y.onDidCloseTextDocument(async r=>{let{bufnr:o}=r,s=this.providersMap.get(o);!s||await e.call("bufloaded",[o])||(this.providersMap.delete(o),s.dispose())},null,this.disposables),R.onDidChangeActiveTextEditor(async r=>{if(!this.config.checkBufferSwitch)return;this.treeViewList.find(s=>s.visible&&s.targetTabId==r.tabpageid)&&(await this.showOutline(r.document.bufnr,r.tabpageid),await e.command(`noa call win_gotoid(${r.winid})`))},null,this.disposables),F.on("CursorHold",async(r,o)=>{if(!this.config.followCursor||!this.providersMap.get(r))return;let a=await e.tabpage,l=this.treeViewList.find(u=>u.visible&&u.targetBufnr==r&&u.targetTabId==a.id);l&&await this.revealPosition(r,l,oe.create(o[0]-1,o[1]-1))},null,this.disposables)}async revealPosition(e,t,i){let r=this.providersMap.get(e),o=await Promise.resolve(r.getChildren()),s=VSe(i,o);s&&await t.reveal(s)}loadConfiguration(e){if(!e||e.affectsConfiguration("outline")){let t=y.getConfiguration("outline",null);this.config={splitCommand:t.get("splitCommand"),switchSortKey:t.get("switchSortKey"),togglePreviewKey:t.get("togglePreviewKey"),followCursor:t.get("followCursor"),keepWindow:t.get("keepWindow"),expandLevel:t.get("expandLevel"),autoWidth:t.get("autoWidth"),checkBufferSwitch:t.get("checkBufferSwitch"),detailAsDescription:t.get("detailAsDescription"),sortBy:t.get("sortBy"),showLineNumber:t.get("showLineNumber"),codeActionKinds:t.get("codeActionKinds"),autoHide:t.get("autoHide"),autoPreview:t.get("autoPreview"),previewMaxWidth:t.get("previewMaxWidth"),previewBorder:t.get("previewBorder"),previewBorderRounded:t.get("previewBorderRounded"),previewHighlightGroup:t.get("previewHighlightGroup"),previewBorderHighlightGroup:t.get("previewBorderHighlightGroup"),previewWinblend:t.get("previewWinblend")}}}convertSymbolToNode(e,t){let i=[],{detailAsDescription:r,showLineNumber:o}=this.config;return r&&e.detail&&i.push(e.detail),o&&i.push(`${e.selectionRange.start.line+1}`),{label:e.name,tooltip:r?void 0:e.detail,description:i.join(" "),icon:this.handler.getIcon(e.kind),deprecated:e.tags?.includes(Sn.Deprecated),kind:e.kind,range:e.range,selectRange:e.selectionRange,children:Array.isArray(e.children)?e.children.map(s=>this.convertSymbolToNode(s,t)).sort(t):void 0}}setMessage(e,t){this.treeViewList.forEach(i=>{i.valid&&i.targetBufnr==e&&(i.message=t)})}convertSymbols(e,t){let i=this.getSortBy(e),r=(o,s)=>i==="name"?o.labelthis.convertSymbolToNode(o,r)).sort(r)}onSymbolsUpdate(e,t){let i=this.providersMap.get(e);i&&i.update(this.convertSymbols(e,t))}createProvider(e){let{nvim:t}=this,i=new Ab({expandLevel:this.config.expandLevel,provideData:async()=>{let r=this.buffers.getItem(e);if(!r)throw new Error("Document not attached");let o=y.getDocument(e);if(!A.hasProvider("documentSymbol",o.textDocument))throw new Error("Document symbol provider not found");let s=A.getDocumentSymbolMetadata(o.textDocument);s&&s.label&&this.treeViewList.filter(u=>u.valid&&u.targetBufnr==e).forEach(u=>u.description=s.label),this.setMessage(e,"Loading document symbols");let a=await r.getSymbols();if(!a||a.length==0)throw new Error("Empty symbols returned from language server. ");return this.setMessage(e,void 0),this.convertSymbols(e,a)},handleClick:async r=>{let o=await t.call("bufwinnr",[e]);if(o==-1)return;t.pauseNotification(),t.command(`${o}wincmd w`,!0);let s=r.selectRange.start;t.call("coc#cursor#move_to",[s.line,s.character],!0),t.command("normal! zz",!0);let a=t.createBuffer(e);a.highlightRanges("outline-hover","CocHoverRange",[r.selectRange]),t.command("redraw",!0),await t.resumeNotification(),setTimeout(()=>{a.clearNamespace("outline-hover"),t.command("redraw",!0)},QSe),this.config.autoHide&&await this.hide()},resolveActions:async(r,o)=>{let s=await t.call("bufwinnr",[e]);if(s==-1)return;let a=y.getDocument(e);return[...(await this.handler.getCodeActions(a,o.range,this.config.codeActionKinds)).map(c=>({title:c.title,handler:async()=>{let h=o.range.start;await t.command(`${s}wincmd w`),await this.nvim.call("coc#cursor#move_to",[h.line,h.character]),await this.handler.applyCodeAction(c)}})),{title:"Visual Select",handler:async c=>{await t.command(`${s}wincmd w`),await R.selectRange(c.range)}}]},onDispose:()=>{for(let r of this.treeViewList.slice())r.provider===i&&r.dispose()}});return i}getSortBy(e){return this.sortByMap.get(e)??this.config.sortBy}async showOutline(e,t){this.providersMap.has(e)||this.providersMap.set(e,this.createProvider(e));let i=this.treeViewList.find(r=>r.valid&&r.targetBufnr==e&&r.targetTabId==t);if(!i){let{switchSortKey:r,togglePreviewKey:o}=this.config,s=this.config.autoPreview,a;i=new Vo("OUTLINE",{autoWidth:this.config.autoWidth,bufhidden:"hide",enableFilter:!0,treeDataProvider:this.providersMap.get(e)});let l=this.getSortBy(e),u;i.description=`${l[0].toUpperCase()}${l.slice(1)}`,this.treeViewList.push(i);let c=F.on("BufEnter",h=>{a&&h!==a&&(u=void 0,this.closePreview())});i.onDispose(()=>{let h=this.treeViewList.findIndex(d=>d===i);h!==-1&&this.treeViewList.splice(h,1),c.dispose(),this.closePreview()}),i.onDidChangeVisibility(h=>{this.nvim.isVim&&h&&a&&(u=void 0,this.closePreview())}),i.onDidCursorMoved(async h=>{s&&u!==h&&(u=h,a=await this.doPreview(e,h))}),i.registerLocalKeymap("n",r,async()=>{let h=["category","name","position"],d=this.getSortBy(e),g=h.map(x=>({text:x,disabled:x===d})),f=await R.showMenuPicker(g,{title:"Choose sort method"});if(f<0)return;let m=h[f];this.sortByMap.set(e,m),this.treeViewList.filter(x=>x.targetBufnr==e).forEach(x=>{x.description=`${m[0].toUpperCase()}${m.slice(1)}`});let w=this.buffers.getItem(e);this.onSymbolsUpdate(e,w.symbols)},!0),i.registerLocalKeymap("n",o,async h=>{s=!s,s?a=await this.doPreview(e,h):(u=void 0,this.closePreview())},!0)}return await i.show(this.config.splitCommand,!1),i}async doPreview(e,t){if(!t){this.closePreview();return}let i={bufnr:e,range:t.range,border:this.config.previewBorder,rounded:this.config.previewBorderRounded,maxWidth:this.config.previewMaxWidth,highlight:this.config.previewHighlightGroup,borderhighlight:this.config.previewBorderHighlightGroup,winblend:this.config.previewWinblend};return await this.nvim.call("coc#ui#outline_preview",[i])}closePreview(){this.nvim.call("coc#ui#outline_close_preview",[],!0)}async show(e){let[t,i]=await this.nvim.eval('[bufnr("%"),win_getid()]'),r=await this.nvim.tabpage,o=y.getDocument(t);if(o&&!o.attached){R.showErrorMessage(`Unable to show outline, ${o.notAttachReason}`);return}let s=await R.getCursorPosition(),a=await this.showOutline(t,r.id);if(e==1||e===void 0&&this.config.keepWindow)await this.nvim.command(`noa call win_gotoid(${i})`);else if(this.config.followCursor){let l=a.onDidRefrash(async()=>{l.dispose(),await this.nvim.eval('bufnr("%")')==t&&a.visible&&await this.revealPosition(t,a,s)})}}has(e){return this.providersMap.has(e)}async hide(){let e=await this.nvim.call("coc#window#find",["cocViewId","OUTLINE"]);e!=-1&&await this.nvim.call("coc#window#close",[e])}dispose(){for(let e of this.treeViewList)e.dispose();this.treeViewList=[];for(let e of this.providersMap.values())e.dispose();this.providersMap.clear(),z(this.disposables)}}});function Yie(n){let e=[],t=n.slice();return t.sort(Uie),t.forEach(i=>Zie(e,i,0)),e}function Uie(n,e){let t=n.selectionRange,i=e.selectionRange;return it(t.start,i.start)}function Zie(n,e,t){let{name:i,selectionRange:r,detail:o,kind:s,children:a,range:l,tags:u}=e,{start:c}=Pe(r,l),h={col:c.character+1,lnum:c.line+1,text:i,level:t,kind:oa(s),range:l,selectionRange:r};if(o&&(h.detail=o),u&&u.includes(Sn.Deprecated)&&(h.deprecated=!0),n.push(h),a&&a.length){a.sort(Uie);for(let d of a)Zie(n,d,t+1)}}var Jie=k(()=>{"use strict";ye();se();Im();Nt()});var Hb,$ie=k(()=>{"use strict";ye();je();Ie();se();fe();Ye();Nt();ie();Ce();Ze();be();Bie();qie();Jie();Hb=class{constructor(e,t){this.nvim=e;this.handler=t;this.disposables=[];this.autoUpdateBufnrs=new Set;this.buffers=y.registerBufferSync(o=>{let{bufnr:s}=o,a=new Ob(o,this.autoUpdateBufnrs);return a.onDidUpdate(l=>{this.outline&&this.outline.onSymbolsUpdate(s,l)}),a}),this.outline=new Nb(e,this.buffers,t);let i=y.initialConfiguration.get("coc.preferences.currentFunctionSymbolDebounceTime",300),r=wt(async(o,s)=>{if(!this.buffers.getItem(o)||!this.autoUpdate(o))return;let a=y.getDocument(o),l=Jt(a.getline(s[0]-1),s[1]-1),u=oe.create(s[0]-1,l),c=await this.getFunctionSymbol(o,u);e.createBuffer(o).setVar("coc_current_function",c??"",!0),this.nvim.call("coc#util#do_autocmd",["CocStatusChange"],!0)},ve(i,0));F.on("CursorMoved",r,this,this.disposables),this.disposables.push(p.Disposable.create(()=>{r.clear()})),F.on("InsertEnter",o=>{let s=this.buffers.getItem(o);s&&s.cancel()},null,this.disposables)}autoUpdate(e){let t=y.getDocument(e);return y.getConfiguration("coc.preferences",t).get("currentFunctionSymbolAutoUpdate",!1)}get labels(){return y.getConfiguration("suggest").get("completionItemKindLabels",{})}async getWorkspaceSymbols(e){this.handler.checkProvider("workspaceSymbols",null);let t=new p.CancellationTokenSource;return await A.getWorkspaceSymbols(e,t.token)}async resolveWorkspaceSymbol(e){if(e.location?.uri)return e;let t=new p.CancellationTokenSource;return await A.resolveWorkspaceSymbol(e,t.token)}async getDocumentSymbols(e){if(!e){e=await this.nvim.call("bufnr",["%"]);let r=y.getDocument(e);if(!r||!r.attached)return}let t=this.buffers.getItem(e);if(!t)return;let i=await t.getSymbols();return i?Yie(i):void 0}async getFunctionSymbol(e,t){let i=await this.getDocumentSymbols(e),r=this.nvim.createBuffer(e);if(!i||i.length===0)return r.setVar("coc_current_function","",!0),this.nvim.call("coc#util#do_autocmd",["CocStatusChange"],!0),"";i=i.filter(a=>["Class","Method","Function","Struct"].includes(a.kind));let o="",s=this.labels;for(let a of i.reverse())if(a.range&&$t(t,a.range)==0&&!a.text.endsWith(") callback")){o=a.text;let l=s[a.kind.toLowerCase()];l&&(o=`${l} ${o}`);break}return o}async getCurrentFunctionSymbol(){let e=await this.nvim.call("bufnr",["%"]),t=y.getDocument(e);if(!t||!t.attached||!A.hasProvider("documentSymbol",t.textDocument))return;let i=await R.getCursorPosition();return await this.getFunctionSymbol(e,i)}async selectSymbolRange(e,t,i){let{doc:r}=await this.handler.getCurrentState();this.handler.checkProvider("documentSymbol",r.textDocument);let o;if(t)o=await R.getSelectedRange(t);else{let l=await R.getCursorPosition();o=q.create(l,l)}let s=await this.getDocumentSymbols(r.bufnr);if(!s||s.length===0){R.showWarningMessage("No symbols found");return}s=s.filter(l=>i.includes(l.kind));let a;for(let l of s.reverse())if(l.range&&!Be(l.range,o)&&mi(o,l.range)){a=l.range;break}if(e&&a){let{start:l,end:u}=a,c=r.getline(l.line+1),h=r.filetype==="python"?0:1,d=r.getline(u.line-h);a=q.create(l.line+1,c.match(/^\s*/)[0].length,u.line-h,d.length)}a?await R.selectRange(a):["v","V",""].includes(t)&&await this.nvim.command("normal! gv")}async showOutline(e){await this.outline.show(e)}async hideOutline(){await this.outline.hide()}hasOutline(e){return this.outline.has(e)}dispose(){this.outline.dispose(),this.buffers.dispose(),z(this.disposables)}}});function e0e(n){return fi(n,["children","parent"])}function Xie(n){return n==="supertypes"?"Super types":"Sub types"}var Bb,Gie=k(()=>{"use strict";At();je();Ie();NF();$p();se();Le();zr();Ze();be();Bb=class n{constructor(e,t){this.nvim=e;this.handler=t;this.disposables=[];this.highlightWinids=new Set;this.loadConfiguration(),y.onDidChangeConfiguration(this.loadConfiguration,this,this.disposables),F.on("BufWinEnter",(i,r)=>{this.highlightWinids.has(r)&&(this.highlightWinids.delete(r),e.createWindow(r).clearMatchGroup(n.rangesHighlight))},null,this.disposables),this.disposables.push(ae.registerCommand(n.commandId,async(i,r,o)=>{let{nvim:s}=this;await s.call("win_gotoid",[i]),await y.jumpTo(r.uri,r.range.start,o);let a=await s.window;a.clearMatchGroup(n.rangesHighlight),a.highlightRanges(n.rangesHighlight,[r.selectionRange],10,!0),this.highlightWinids.add(a.id)},null,!0))}static{this.rangesHighlight="CocSelectedRange"}static{this.commandId="typeHierarchy.reveal"}loadConfiguration(e){if(!e||e.affectsConfiguration("typeHierarchy")){let t=y.getConfiguration("typeHierarchy",null);this.config={splitCommand:t.get("splitCommand"),openCommand:t.get("openCommand"),enableTooltip:t.get("enableTooltip")}}}createProvider(e,t,i){let r=new Ku(i,t,this.config,n.commandId,e,o=>this.handler.getIcon(o),(o,s,a)=>this.getChildren(o,s,a));return r.addAction("Show Super Types",o=>{r.meta="supertypes";let s=[fi(o,["children","parent"])];r.reset(s)}),r.addAction("Show Sub Types",o=>{r.meta="subtypes";let s=[fi(o,["children","parent"])];r.reset(s)}),r}async getChildren(e,t,i){let r=[],o=e0e(e);return t=="supertypes"?r=await A.provideTypeHierarchySupertypes(o,i):r=await A.provideTypeHierarchySubtypes(o,i),r}async prepare(e,t){return this.handler.checkProvider("typeHierarchy",e),await this.handler.withRequestToken("typeHierarchy",async i=>await A.prepareTypeHierarchy(e,t,i),!1)}async showTypeHierarchyTree(e){let{doc:t,position:i,winid:r}=await this.handler.getCurrentState();await t.synchronize();let o=await this.prepare(t.textDocument,i);if(le(o)){R.showWarningMessage("Unable to get TypeHierarchyItems at cursor position.");return}let s=this.createProvider(o,r,e),a=new Vo("types",{treeDataProvider:s});a.title=Xie(e),s.onDidChangeTreeData(l=>{l||(a.title=Xie(s.meta))}),a.onDidChangeVisibility(l=>{l.visible||s.dispose()}),this.disposables.push(a),await a.show(this.config.splitCommand)}dispose(){this.highlightWinids.clear(),z(this.disposables)}}});var zie,Wb,Kie=k(()=>{"use strict";gt();zie=require("v8");$e();At();vC();qu();Ie();Ee();$a();Xu();se();oi();qi();pt();ze();fe();Ce();Ze();be();Wb=class{constructor(e){this.nvim=e;Object.defineProperty(R,"openLocalConfig",{get:()=>this.openLocalConfig.bind(this)}),ae.register({id:"workspace.openLocation",execute:async(t,i,r)=>{await e.call("win_gotoid",[t]),await y.jumpTo(i.uri,i.range.start,r)}},!0),ae.register({id:"workspace.undo",execute:async()=>{await y.files.undoWorkspaceEdit()}},!1,"Undo previous this.workspace edit"),ae.register({id:"workspace.redo",execute:async()=>{await y.files.redoWorkspaceEdit()}},!1,"Redo previous this.workspace edit"),ae.register({id:"workspace.inspectEdit",execute:async()=>{await y.files.inspectEdit()}},!1,"Inspect previous this.workspace edit in new tab"),ae.register({id:"workspace.renameCurrentFile",execute:async()=>{await this.renameCurrent()}},!1,"change current filename to a new name and reload it."),ae.register({id:"document.checkBuffer",execute:async()=>{await this.bufferCheck()}},!1,"Check providers for current buffer."),ae.register({id:"document.echoFiletype",execute:async()=>{let t=await e.call("bufnr","%"),i=y.getAttachedDocument(t);await R.echoLines([i.filetype])}},!1,"echo the mapped filetype of the current buffer"),ae.register({id:"workspace.workspaceFolders",execute:async()=>{let i=y.workspaceFolders.map(r=>Y.parse(r.uri).fsPath);await R.echoLines(i)}},!1,"show opened workspaceFolders."),ae.register({id:"workspace.writeHeapSnapshot",execute:async()=>{let t=E.join(Bt.homedir(),`${Te()}-${process.pid}.heapsnapshot`);return(0,zie.writeHeapSnapshot)(t),R.showInformationMessage(`Create heapdump at: ${t}`),t}},!1,"Generates a snapshot of the current V8 heap and writes it to a JSON file."),ae.register({id:"workspace.showOutput",execute:async t=>{t||(t=await R.showQuickPick(y.channelNames,{title:"Choose output name"})),R.showOutputChannel(de(t))}},!1,"open output buffer to show output from languageservers or extensions."),ae.register({id:"workspace.clearWatchman",execute:async()=>{let t=await R.runTerminalCommand("watchman watch-del-all");return t.success&&R.showInformationMessage("Cleared watchman watching directories."),t.success}},!1,"run watch-del-all for watchman to free up memory.")}async openLog(){let e=zy();await y.jumpTo(Y.file(e).toString())}async openLocalConfig(){let e=await this.nvim.call("expand",["%:p"]),t=await this.nvim.eval("&filetype");if(!e||!E.isAbsolute(e)){R.showWarningMessage("Current buffer doesn't have valid file path.");return}let i=y.getWorkspaceFolder(Y.file(e).toString());if(!i){let s=y.initialConfiguration.get("workspace"),a=Pe(s.rootPatterns,[]),l=Pe(s.ignoredFiletypes,[]),u;l.includes(t)&&(u=`Filetype '${t}' is ignored for workspace folder resolve.`),u||(u=`Can't resolve workspace folder for file '${e}, consider create one of ${a.join(", ")} in your project root.'.`),R.showWarningMessage(u);return}let r=Y.parse(i.uri).fsPath,o=E.join(r,".vim");if(!B.existsSync(o)){if(!await R.showPrompt(`Would you like to create folder'${r}/.vim'?`))return;B.mkdirSync(o)}await y.jumpTo(Y.file(E.join(o,Wg)))}async renameCurrent(){let{nvim:e}=this,t=await e.call("expand",["%:p"]),i=await e.callAsync("coc#util#with_callback",["input",["New path: ",t,"file"]]);i=i.trim(),!(i===t||!i)&&(t.toLowerCase()!=i.toLowerCase()&&B.existsSync(i)&&!await R.showPrompt(`${i} exists, overwrite?`)||await y.renameFile(t,i,{overwrite:!0}))}addWorkspaceFolder(e){if(!Ge(e))throw TypeError("folder should be string");if(e=y.expand(e),!La(e))throw N4(e);y.workspaceFolderControl.addWorkspaceFolder(e,!0)}async bufferCheck(){let e=await y.document;if(!e.attached){await R.showDialog({title:"Buffer check result",content:`Document not attached, ${e.notAttachReason}`,highlight:"WarningMsg"});return}let t=new fn;t.addLine("Provider state","Title"),t.addLine("");for(let i of Object.values(Gt)){if(i==="onTypeEdit")continue;let r=A.hasProvider(i,e.textDocument);t.addTexts([{text:"-",hlGroup:"Comment"},{text:" "},r?{text:"\u2713",hlGroup:"CocListFgGreen"}:{text:"\u2717",hlGroup:"CocListFgRed"},{text:" "},{text:i,hlGroup:r?"Normal":"CocFadeOut"}])}await R.showDialog({title:"Buffer check result",content:t.content,highlights:t.highlights})}async doAutocmd(e,t){await y.autocmds.doAutocmd(e,t)}async getConfiguration(e){let t=await y.document;return y.getConfiguration(e,t)}getRootPatterns(e){let t=y.getDocument(e);return t?{buffer:y.workspaceFolderControl.getRootPatterns(t,0),server:y.workspaceFolderControl.getRootPatterns(t,1),global:y.workspaceFolderControl.getRootPatterns(t,2)}:null}async ensureDocument(){let e=await y.document;return e&&e.attached}async doKeymap(e,t=""){return await y.keymaps.doKeymap(e,t)}async snippetCheck(e,t){return!!(t&&Fi.jumpable()||e&&await Promise.resolve(ti.manager.call("coc-snippets","expandable",[])))}async showInfo(){let e=[],t=y.version+"-2ec31666 2024-04-23 09:10:14 +0800";e.push("## versions"),e.push("");let r=(await this.nvim.call("execute",["version"])).trim().split(/\r?\n/,2)[0].replace(/\(.*\)/,"").trim();e.push("vim version: "+r+`${Si?" "+y.env.version:""}`),e.push("node version: "+process.version),e.push("coc.nvim version: "+t),e.push("coc.nvim directory: "+E.dirname(__dirname)),e.push("term: "+Pe(process.env.TERM_PROGRAM,process.env.TERM)),e.push("platform: "+process.platform),e.push(""),e.push("## Log of coc.nvim"),e.push("");let o=zy(),s=Wy();if(B.existsSync(o)){let l=B.readFileSync(o,{encoding:"utf8"});e.push(...l.split(/\r?\n/).map(u=>s(u)))}await this.nvim.command("vnew +setl\\ buftype=nofile\\ bufhidden=wipe\\ nobuflisted"),await(await this.nvim.buffer).setLines(e,{start:0,end:-1,strictIndexing:!1})}}});var t0e,i0e,qb,Qie=k(()=>{"use strict";ye();At();je();Ie();Ee();se();Im();Ye();ie();Kr();Ze();be();nie();rie();aie();hie();die();gie();pie();mie();bie();wie();xie();Die();Tie();Iie();Fie();Mie();Nie();Hie();$ie();Gie();Kie();t0e=te("Handler"),i0e=ve(500,10),qb=class{constructor(e){this.nvim=e;this.disposables=[];F.on(["CursorMoved","CursorMovedI","InsertEnter","InsertSnippet","InsertLeave"],()=>{this.requestTokenSource&&(this.requestTokenSource.cancel(),this.requestTokenSource=null)},null,this.disposables),this.fold=new mb(e,this),this.links=new Db(e,this),this.codeLens=new hb(e),this.colors=new pb(e,this),this.format=new bb(e,this),this.symbols=new Hb(e,this),this.refactor=new Rb(e,this),this.hover=new wb(e,this),this.locations=new Tb(e,this),this.signature=new jb(e,this),this.rename=new Eb(e,this),this.workspace=new Wb(e),this.codeActions=new ub(e,this),this.commands=new fb(e),this.callHierarchy=new lb(e,this),this.typeHierarchy=new Bb(e,this),this.documentHighlighter=new yb(e,this),this.semanticHighlighter=new Mb(e),this.selectionRange=new Lb(e,this),this.linkedEditingHandler=new Sb(e,this),this.inlayHintHandler=new Cb(e,this),this.disposables.push({dispose:()=>{this.callHierarchy.dispose(),this.typeHierarchy.dispose(),this.codeLens.dispose(),this.links.dispose(),this.refactor.dispose(),this.signature.dispose(),this.symbols.dispose(),this.hover.dispose(),this.colors.dispose(),this.documentHighlighter.dispose(),this.semanticHighlighter.dispose()}}),this.registerCommands()}registerCommands(){ae.register({id:"document.renameCurrentWord",execute:async()=>{let e=await y.document,t=await this.rename.getWordEdit(),i=fX(e.uri,Ke(t));if(!i)return R.showWarningMessage("Invalid position");await ae.executeCommand("editor.action.addRanges",i)}},!1,"rename word under cursor in current buffer by multiple cursors."),ae.register({id:["workbench.action.reloadWindow","editor.action.restart"],execute:()=>{this.nvim.command("CocRestart",!0)}},!0),this.register("vscode.open",async e=>{await y.openResource(e.toString())}),this.register("editor.action.doCodeAction",async e=>{await this.codeActions.applyCodeAction(e)}),this.register("editor.action.triggerParameterHints",async()=>{await this.signature.triggerSignatureHelp()}),this.register("editor.action.showReferences",async(e,t,i)=>{await y.jumpTo(e,t),await y.showLocations(i)}),this.register("editor.action.rename",async(e,t,i)=>(Array.isArray(e)&&(t=e[1],e=e[0]),await y.jumpTo(e,t),await this.rename.rename(i))),this.register("editor.action.format",async()=>{await this.format.formatCurrentBuffer()}),this.register("editor.action.showRefactor",async e=>{let t=e.filter(i=>Xe.is(i));return await this.refactor.fromLocations(t)})}register(e,t){this.disposables.push(ae.registerCommand(e,t,null,!0))}get requestStatusItem(){return this._requestStatusItem?this._requestStatusItem:(this._requestStatusItem=R.createStatusBarItem(0,{progress:!0}),this._requestStatusItem)}get labels(){return y.initialConfiguration.get("suggest.completionItemKindLabels",{})}get uri(){return R.activeTextEditor?.document.uri}async getCurrentState(){let{nvim:e}=this,[t,[i,r],o,s]=await e.eval("[bufnr('%'),coc#cursor#position(),win_getid(),mode()]");return{doc:y.getAttachedDocument(t),mode:s,position:oe.create(i,r),winid:o}}addDisposable(e){this.disposables.push(e)}checkProvider(e,t){if(!A.hasProvider(e,t))throw new Error(`${e} provider not found for current buffer, your language server doesn't support it.`)}async withRequestToken(e,t,i){this.requestTokenSource&&(this.requestTokenSource.cancel(),this.requestTokenSource.dispose()),clearTimeout(this.requestTimer);let r=this.requestStatusItem;this.requestTokenSource=new p.CancellationTokenSource;let{token:o}=this.requestTokenSource;o.onCancellationRequested(()=>{r.text=`${e} request canceled`,r.isProgress=!1,this.requestTimer=setTimeout(()=>{r.hide()},i0e)}),r.isProgress=!0,r.text=`requesting ${e}`,r.show();let s;try{s=await Promise.resolve(t(o))}catch(a){t0e.error(`Error on request ${e}`,a),this.nvim.errWriteLine(`Error on ${e}: ${a}`)}return this.requestTokenSource&&(this.requestTokenSource.dispose(),this.requestTokenSource=void 0),o.isCancellationRequested?null:(r.hide(),i&&(!s||Array.isArray(s)&&s.length==0)?(R.showWarningMessage(`${e} not found`),null):s)}getIcon(e){let{labels:t}=this,i=oa(e),r=typeof t.default=="string"?t.default:i[0].toLowerCase(),o=i=="Unknown"?"":t[i[0].toLowerCase()+i.slice(1)];return o||(o=r),{text:o,hlGroup:i=="Unknown"?"CocSymbolDefault":`CocSymbol${i}`}}async getCodeActions(e,t,i){return(await this.codeActions.getCodeActions(e,t,i)).filter(o=>!o.disabled)}async applyCodeAction(e){await this.codeActions.applyCodeAction(e)}async hasProvider(e,t){t||(t=await this.nvim.call("bufnr","%"));let i=y.getDocument(t);return!i||!i.attached?!1:A.hasProvider(e,i.textDocument)}dispose(){this.requestTimer&&clearTimeout(this.requestTimer),z(this.disposables)}}});var n0e,Yb,Vie=k(()=>{"use strict";ye();At();Gte();$u();Qte();Oh();je();qu();Qie();pD();Ee();Hm();Xu();se();Ze();be();n0e=te("plugin"),Yb=class{constructor(e){this.nvim=e;this.ready=!1;this.initialized=!1;this.actions=new Map;this.disposables=[];Object.defineProperty(R,"workspace",{get:()=>y}),Object.defineProperty(y,"nvim",{get:()=>this.nvim}),Object.defineProperty(R,"nvim",{get:()=>this.nvim}),Object.defineProperty(R,"cursors",{get:()=>this.cursors}),Object.defineProperty(ae,"nvim",{get:()=>this.nvim}),this.cursors=new sb(e),un.init(e),this.addAction("checkJsonExtension",()=>{ti.has("coc-json")||R.showInformationMessage("Run :CocInstall coc-json for json intellisense")}),this.addAction("rootPatterns",t=>this.handler.workspace.getRootPatterns(t)),this.addAction("ensureDocument",()=>this.handler.workspace.ensureDocument()),this.addAction("addWorkspaceFolder",t=>this.handler.workspace.addWorkspaceFolder(t)),this.addAction("getConfig",t=>this.handler.workspace.getConfiguration(t)),this.addAction("doAutocmd",(t,...i)=>this.handler.workspace.doAutocmd(t,i)),this.addAction("openLog",()=>this.handler.workspace.openLog()),this.addAction("attach",()=>y.attach()),this.addAction("detach",()=>y.detach()),this.addAction("doKeymap",(t,i)=>this.handler.workspace.doKeymap(t,i)),this.addAction("registerExtensions",(...t)=>ti.manager.loadExtension(t),"registExtensions"),this.addAction("snippetCheck",(t,i)=>this.handler.workspace.snippetCheck(t,i)),this.addAction("snippetInsert",(t,i,r,o)=>Fi.insertSnippet(i,!0,t,r,o,!0)),this.addAction("snippetNext",()=>Fi.nextPlaceholder()),this.addAction("snippetPrev",()=>Fi.previousPlaceholder()),this.addAction("snippetCancel",()=>Fi.cancel()),this.addAction("openLocalConfig",()=>this.handler.workspace.openLocalConfig()),this.addAction("bufferCheck",()=>this.handler.workspace.bufferCheck()),this.addAction("showInfo",()=>this.handler.workspace.showInfo()),this.addAction("hasProvider",(t,i)=>this.handler.hasProvider(t,i)),this.addAction("cursorsSelect",(t,i,r)=>this.cursors.select(t,i,r)),this.addAction("fillDiagnostics",t=>_i.setLocationlist(t)),this.addAction("commandList",()=>this.handler.commands.getCommandList()),this.addAction("selectSymbolRange",(t,i,r)=>this.handler.symbols.selectSymbolRange(t,i,r)),this.addAction("openList",(...t)=>un.start(t)),this.addAction("listNames",()=>un.names),this.addAction("listDescriptions",()=>un.descriptions),this.addAction("listLoadItems",t=>un.loadItems(t)),this.addAction("listResume",t=>un.resume(t)),this.addAction("listCancel",()=>un.cancel(!0)),this.addAction("listPrev",t=>un.previous(t)),this.addAction("listNext",t=>un.next(t)),this.addAction("listFirst",t=>un.first(t)),this.addAction("listLast",t=>un.last(t)),this.addAction("sendRequest",(t,i,r)=>Gn.sendRequest(t,i,r)),this.addAction("sendNotification",(t,i,r)=>Gn.sendNotification(t,i,r)),this.addAction("registerNotification",(t,i)=>Gn.registerNotification(t,i),"registNotification"),this.addAction("updateConfig",(t,i)=>y.configurations.updateMemoryConfig({[t]:i})),this.addAction("links",()=>this.handler.links.getLinks()),this.addAction("openLink",()=>this.handler.links.openCurrentLink()),this.addAction("pickColor",()=>this.handler.colors.pickColor()),this.addAction("colorPresentation",()=>this.handler.colors.pickPresentation()),this.addAction("highlight",()=>this.handler.documentHighlighter.highlight()),this.addAction("fold",t=>this.handler.fold.fold(t)),this.addAction("startCompletion",t=>eb.startCompletion(t)),this.addAction("sourceStat",()=>Ui.sourceStats()),this.addAction("refreshSource",t=>Ui.refresh(t)),this.addAction("toggleSource",t=>Ui.toggleSource(t)),this.addAction("diagnosticRefresh",t=>_i.refresh(t)),this.addAction("diagnosticInfo",t=>_i.echoCurrentMessage(t)),this.addAction("diagnosticToggle",t=>_i.toggleDiagnostic(t)),this.addAction("diagnosticToggleBuffer",(t,i)=>_i.toggleDiagnosticBuffer(t,i)),this.addAction("diagnosticNext",t=>_i.jumpNext(t)),this.addAction("diagnosticPrevious",t=>_i.jumpPrevious(t)),this.addAction("diagnosticPreview",()=>_i.preview()),this.addAction("diagnosticList",()=>_i.getDiagnosticList()),this.addAction("findLocations",(t,i,r,o)=>this.handler.locations.findLocations(t,i,r,o)),this.addAction("getTagList",()=>this.handler.locations.getTagList()),this.addAction("definitions",()=>this.handler.locations.definitions()),this.addAction("declarations",()=>this.handler.locations.declarations()),this.addAction("implementations",()=>this.handler.locations.implementations()),this.addAction("typeDefinitions",()=>this.handler.locations.typeDefinitions()),this.addAction("references",t=>this.handler.locations.references(t)),this.addAction("jumpUsed",t=>this.handler.locations.gotoReferences(t,!1)),this.addAction("jumpDefinition",t=>this.handler.locations.gotoDefinition(t)),this.addAction("jumpReferences",t=>this.handler.locations.gotoReferences(t)),this.addAction("jumpTypeDefinition",t=>this.handler.locations.gotoTypeDefinition(t)),this.addAction("jumpDeclaration",t=>this.handler.locations.gotoDeclaration(t)),this.addAction("jumpImplementation",t=>this.handler.locations.gotoImplementation(t)),this.addAction("doHover",t=>this.handler.hover.onHover(t)),this.addAction("definitionHover",t=>this.handler.hover.definitionHover(t)),this.addAction("getHover",t=>this.handler.hover.getHover(t)),this.addAction("showSignatureHelp",()=>this.handler.signature.triggerSignatureHelp()),this.addAction("documentSymbols",t=>this.handler.symbols.getDocumentSymbols(t)),this.addAction("symbolRanges",()=>this.handler.documentHighlighter.getSymbolsRanges()),this.addAction("selectionRanges",()=>this.handler.selectionRange.getSelectionRanges()),this.addAction("rangeSelect",(t,i)=>this.handler.selectionRange.selectRange(t,i)),this.addAction("rename",t=>this.handler.rename.rename(t)),this.addAction("getWorkspaceSymbols",t=>this.handler.symbols.getWorkspaceSymbols(t)),this.addAction("resolveWorkspaceSymbol",t=>this.handler.symbols.resolveWorkspaceSymbol(t)),this.addAction("formatSelected",t=>this.handler.format.formatCurrentRange(t)),this.addAction("format",()=>this.handler.format.formatCurrentBuffer()),this.addAction("commands",()=>ae.commandList),this.addAction("services",()=>Gn.getServiceStats()),this.addAction("toggleService",t=>Gn.toggle(t)),this.addAction("codeAction",(t,i,r)=>this.handler.codeActions.doCodeAction(t,i,r)),this.addAction("organizeImport",()=>this.handler.codeActions.organizeImport()),this.addAction("fixAll",()=>this.handler.codeActions.doCodeAction(null,[gi.SourceFixAll])),this.addAction("doCodeAction",t=>this.handler.codeActions.applyCodeAction(t)),this.addAction("codeActions",(t,i)=>this.handler.codeActions.getCurrentCodeActions(t,i)),this.addAction("quickfixes",t=>this.handler.codeActions.getCurrentCodeActions(t,[gi.QuickFix])),this.addAction("codeLensAction",()=>this.handler.codeLens.doAction()),this.addAction("doQuickfix",()=>this.handler.codeActions.doQuickfix()),this.addAction("search",(...t)=>this.handler.refactor.search(t)),this.addAction("saveRefactor",t=>this.handler.refactor.save(t)),this.addAction("refactor",()=>this.handler.refactor.doRefactor()),this.addAction("runCommand",(...t)=>this.handler.commands.runCommand(...t)),this.addAction("repeatCommand",()=>this.handler.commands.repeat()),this.addAction("installExtensions",(...t)=>ti.installExtensions(t)),this.addAction("updateExtensions",t=>ti.updateExtensions(t)),this.addAction("extensionStats",()=>ti.getExtensionStates()),this.addAction("loadedExtensions",()=>ti.manager.loadedExtensions),this.addAction("watchExtension",t=>ti.manager.watchExtension(t)),this.addAction("activeExtension",t=>ti.manager.activate(t)),this.addAction("deactivateExtension",t=>ti.manager.deactivate(t)),this.addAction("reloadExtension",t=>ti.manager.reloadExtension(t)),this.addAction("toggleExtension",t=>ti.manager.toggleExtension(t)),this.addAction("uninstallExtension",(...t)=>ti.manager.uninstallExtensions(t)),this.addAction("getCurrentFunctionSymbol",()=>this.handler.symbols.getCurrentFunctionSymbol()),this.addAction("showOutline",t=>this.handler.symbols.showOutline(t)),this.addAction("hideOutline",()=>this.handler.symbols.hideOutline()),this.addAction("getWordEdit",()=>this.handler.rename.getWordEdit()),this.addAction("addCommand",t=>this.handler.commands.addVimCommand(t)),this.addAction("addRanges",t=>this.cursors.addRanges(t)),this.addAction("currentWorkspacePath",()=>y.rootPath),this.addAction("selectCurrentPlaceholder",t=>Fi.selectCurrentPlaceholder(!!t)),this.addAction("codeActionRange",(t,i,r)=>this.handler.codeActions.codeActionRange(t,i,r)),this.addAction("incomingCalls",t=>this.handler.callHierarchy.getIncoming(t)),this.addAction("outgoingCalls",t=>this.handler.callHierarchy.getOutgoing(t)),this.addAction("showIncomingCalls",()=>this.handler.callHierarchy.showCallHierarchyTree("incoming")),this.addAction("showOutgoingCalls",()=>this.handler.callHierarchy.showCallHierarchyTree("outgoing")),this.addAction("showSuperTypes",()=>this.handler.typeHierarchy.showTypeHierarchyTree("supertypes")),this.addAction("showSubTypes",()=>this.handler.typeHierarchy.showTypeHierarchyTree("subtypes")),this.addAction("inspectSemanticToken",()=>this.handler.semanticHighlighter.inspectSemanticToken()),this.addAction("semanticHighlight",()=>this.handler.semanticHighlighter.highlightCurrent()),this.addAction("showSemanticHighlightInfo",()=>this.handler.semanticHighlighter.showHighlightInfo())}get workspace(){return y}get completion(){return eb}addAction(e,t,i){if(this.actions.has(e))throw new Error(`Action ${e} already exists`);this.actions.set(e,t),i&&this.actions.set(i,t)}async init(e){if(this.initialized)return;this.initialized=!0;let{nvim:t}=this;await ti.init(e),await y.init(R),t.setVar("coc_workspace_initialized",!0,!0),Fi.init(),Gn.init(),Ui.init(),eb.init(),_i.init(),this.handler=new qb(t),this.disposables.push(this.handler),un.registerLists(),await ti.activateExtensions(),y.configurations.flushConfigurations(),t.pauseNotification(),t.setVar("coc_service_initialized",1,!0),t.call("coc#util#do_autocmd",["CocNvimInit"],!0),t.resumeNotification(!1,!0),n0e.info(`coc.nvim initialized with node: ${process.version} after`,Date.now()-ve(global.__starttime,Date.now())),this.ready=!0,await F.fire("ready",[])}get isReady(){return this.ready}hasAction(e){return this.actions.has(e)}async cocAction(e,...t){let i=this.actions.get(e);if(!i)throw new Error(`Action "${e}" not exist`);return await Promise.resolve(i.apply(null,t))}getHandler(){return this.handler}dispose(){z(this.disposables),ti.dispose(),un.dispose(),y.dispose(),R.dispose(),Ui.dispose(),Gn.dispose(),Fi.dispose(),ae.dispose(),eb.dispose(),_i.dispose()}}});var VF={};Sl(VF,{default:()=>o0e,pathReplace:()=>tne});function tne(n){if(Et(n)){let e=Y.file;Y.file=t=>(t=t.replace(/\\/g,"/"),Object.keys(n).forEach(i=>t=t.replace(new RegExp("^"+i),n[i])),e(t))}}var ene,Mo,r0e,KF,QF,o0e,eM=k(()=>{"use strict";ene=co(j4());$e();je();Ee();Vie();oi();ze();fe();Ce();DF();Mo=te("attach"),r0e=["installExtensions","updateExtensions"],KF=Mr.parse(Xl),QF=[];o0e=(n,e=!1)=>{let t=(0,ene.attach)(n,te("node-client"),e);t.setVar("coc_process_pid",process.pid,!0),t.setClientInfo("coc",{major:KF.major,minor:KF.minor,patch:KF.patch},"remote",{},{});let i=new Yb(t),r=F.on("ready",()=>{r.dispose();for(let[s,a]of QF)i.cocAction(s,...a).catch(l=>{console.error(`Error on notification "${s}": ${l}`),Mo.error(`Error on notification ${s}`,l)});QF=[]});t.on("notification",async(s,a)=>{switch(s){case"VimEnter":{tne(a[0]),await i.init(a[1]);break}case"Log":{Mo.debug("Vim log",...a);break}case"TaskExit":case"TaskStderr":case"TaskStdout":case"GlobalChange":case"PromptInsert":case"InputChar":case"MenuInput":case"OptionSet":case"PromptKeyPress":case"FloatBtnClick":case"CompleteStop":case"PumInsert":case"PumNavigate":Mo.trace("Event: ",s,...a),await F.fire(s,a);break;case"CocAutocmd":Mo.trace("Notification autocmd:",...a),await F.fire(a[0],a.slice(1));break;case"redraw":break;default:try{if(Mo.info("receive notification:",s,a),!i.isReady){QF.push([s,a]);return}await i.cocAction(s,...a)}catch(l){console.error(`Error on notification "${s}": ${Jr(l)}`),Mo.error(`Error on notification ${s}`,l)}}});let o=mD("Request",3e3);return t.on("request",async(s,a,l)=>{o.start(s);try{if(F.requesting=!0,s=="CompleteStop")Mo.trace("Event: ",s,...a),await F.fire(s,a),l.send(void 0);else if(s=="CocAutocmd")Mo.trace("Request autocmd:",...a),await F.fire(a[0],a.slice(1)),l.send(void 0);else if(!i.isReady&&!r0e.includes(s))Mo.warn(`Plugin not ready on request "${s}"`,a),l.send("Plugin not ready",!0);else{Mo.info("Request action:",s,a);let u=await i.cocAction(s,...a);l.send(u)}F.requesting=!1}catch(u){F.requesting=!1,l.send(Jr(u),!0),Mo.error("Request error:",s,a,u)}o.stop()}),i}});if(global.__isMain){Object.defineProperty(console,"log",{value(){e&&e.info(...arguments)}});let{createLogger:n}=(Ee(),ic(WT)),e=n("server");process.on("uncaughtException",function(i){let r="Uncaught exception: "+i.message;console.error(r),e.error("uncaughtException",i.stack)}),process.on("unhandledRejection",function(i,r){if(i instanceof Error)if(typeof i.code=="number"){let o="Unhandled response error "+i.code+" from language server: "+i.message;i.data!=null?console.error(o,i.data):console.error(o)}else console.error("UnhandledRejection: "+i.message+` `+i.stack);else console.error("UnhandledRejection: "+i);e.error("unhandledRejection ",r,i)});let t=(eM(),ic(VF)).default;t({reader:process.stdin,writer:process.stdout})}else{let n=CF(),e=(Ee(),ic(WT)).logger,t=(eM(),ic(VF)).default;module.exports={attach:t,exports:n,logger:e,loadExtension:(i,r)=>n.extensions.manager.load(i,r)}} /*! Bundled license information: