nvim/pack/acp/opt/coc.nvim/build/index.js

325 lines
1.1 MiB
JavaScript
Raw Normal View History

2021-03-09 22:15:52 +00:00
var _J=Object.create,Zu=Object.defineProperty,PJ=Object.getPrototypeOf,TJ=Object.prototype.hasOwnProperty,RJ=Object.getOwnPropertyNames,NP=Object.getOwnPropertyDescriptor;var qP=r=>Zu(r,"__esModule",{value:!0});var g=(r,e)=>()=>(e||(e={exports:{}},r(e.exports,e)),e.exports),fo=(r,e)=>{qP(r);for(var t in e)Zu(r,t,{get:e[t],enumerable:!0})},kJ=(r,e,t)=>{if(qP(r),e&&typeof e=="object"||typeof e=="function")for(let i of RJ(e))!TJ.call(r,i)&&i!=="default"&&Zu(r,i,{get:()=>e[i],enumerable:!(t=NP(e,i))||t.enumerable});return r},S=r=>r&&r.__esModule?r:kJ(Zu(r!=null?_J(PJ(r)):{},"default",{value:r,enumerable:!0}),r),Ty=(r,e,t,i)=>{for(var n=i>1?void 0:i?NP(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(n=(i?s(e,t,n):s(n))||n);return i&&n&&Zu(e,t,n),n};var BP=g((cSe,$P)=>{"use strict";var IJ="Function.prototype.bind called on incompatible ",Ry=Array.prototype.slice,FJ=Object.prototype.toString,AJ="[object Function]";$P.exports=function(e){var t=this;if(typeof t!="function"||FJ.call(t)!==AJ)throw new TypeError(IJ+t);for(var i=Ry.call(arguments,1),n,o=function(){if(this instanceof n){var c=t.apply(this,i.concat(Ry.call(arguments)));return Object(c)===c?c:this}else return t.apply(e,i.concat(Ry.call(arguments)))},s=Math.max(0,t.length-i.length),a=[],l=0;l<s;l++)a.push("$"+l);if(n=Function("binder","return function ("+a.join(",")+"){ return binder.apply(this,arguments); }")(o),t.prototype){var u=function(){};u.prototype=t.prototype,n.prototype=new u,u.prototype=null}return n}});var un=g((fSe,jP)=>{"use strict";var OJ=BP();jP.exports=Function.prototype.bind||OJ});var ky=g((pSe,UP)=>{"use strict";var WP=Object.prototype.toString;UP.exports=function(e){var t=WP.call(e),i=t==="[object Arguments]";return i||(i=t!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&WP.call(e.callee)==="[object Function]"),i}});var ZP=g((dSe,HP)=>{"use strict";var zP;Object.keys||(Qu=Object.prototype.hasOwnProperty,Iy=Object.prototype.toString,GP=ky(),Fy=Object.prototype.propertyIsEnumerable,VP=!Fy.call({toString:null},"toString"),KP=Fy.call(function(){},"prototype"),ec=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],Ed=function(r){var e=r.constructor;return e&&e.prototype===r},JP={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},YP=function(){if(typeof window=="undefined")return!1;for(var r in window)try{if(!JP["$"+r]&&Qu.call(window,r)&&window[r]!==null&&typeof window[r]=="object")try{Ed(window[r])}catch(e){return!0}}catch(e){return!0}return!1}(),XP=function(r){if(typeof window=="undefined"||!YP)return Ed(r);try{return Ed(r)}catch(e){return!1}},zP=function(e){var t=e!==null&&typeof e=="object",i=Iy.call(e)==="[object Function]",n=GP(e),o=t&&Iy.call(e)==="[object String]",s=[];if(!t&&!i&&!n)throw new TypeError("Object.keys called on a non-object");var a=KP&&i;if(o&&e.length>0&&!Qu.call(e,0))for(var l=0;l<e.length;++l)s.push(String(l));if(n&&e.length>0)for(var u=0;u<e.length;++u)s.push(String(u));else for(var c in e)!(a&&c==="prototype")&&Qu.call(e,c)&&s.push(String(c));if(VP)for(var f=XP(e),p=0;p<ec.length;++p)!(f&&ec[p]==="constructor")&&Qu.call(e,ec[p])&&s.push(ec[p]);return s});var Qu,Iy,GP,Fy,VP,KP,ec,Ed,JP,YP,XP;HP.exports=zP});var rT=g((hSe,QP)=>{"use strict";var LJ=Array.prototype.slice,MJ=ky(),eT=Object.keys,Cd=eT?function(e){return eT(e)}:ZP(),tT=Object.keys;Cd.shim=function(){if(Object.keys){var e=function(){var t=Object.keys(arguments);return t&&t.length===arguments.length}(1,2);e||(Object.keys=function(i){return MJ(i)?tT(LJ.call(i)):tT(i)})}else Object.keys=Cd;return Object.keys||Cd};QP.exports=Cd});var Fn=g((mSe,iT)=>{"use strict";var NJ=rT(),qJ=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",$J=Object.prototype.toString,BJ=Array.prototype.c
`).join(`
`+o),r.push(n+"m+"+kd.exports.humanize(this.diff)+"")}else r[0]=WY()+e+" "+r[0]}function WY(){return Qt.inspectOpts.hideDate?"":new Date().toISOString()+" "}function qY(...r){return process.stderr.write(Xy.format(...r)+`
`)}function BY(r){r?process.env.DEBUG=r:delete process.env.DEBUG}function jY(){return process.env.DEBUG}function NY(r){r.inspectOpts={};let e=Object.keys(Qt.inspectOpts);for(let t=0;t<e.length;t++)r.inspectOpts[e[t]]=Qt.inspectOpts[e[t]]}kd.exports=Ky()(Qt);var{formatters:KT}=kd.exports;KT.o=function(r){return this.inspectOpts.colors=this.useColors,Xy.inspect(r,this.inspectOpts).replace(/\s*\n\s*/g," ")};KT.O=function(r){return this.inspectOpts.colors=this.useColors,Xy.inspect(r,this.inspectOpts)}});var gt=g((OSe,Zy)=>{typeof process=="undefined"||process.type==="renderer"||process.browser===!0||process.__nwjs?Zy.exports=UT():Zy.exports=JT()});var XT=g((LSe,YT)=>{"use strict";YT.exports=HY;function HY(r){if(r=r||{},r.circles)return zY(r);return r.proto?i:t;function e(n,o){for(var s=Object.keys(n),a=new Array(s.length),l=0;l<s.length;l++){var u=s[l],c=n[u];typeof c!="object"||c===null?a[u]=c:c instanceof Date?a[u]=new Date(c):a[u]=o(c)}return a}function t(n){if(typeof n!="object"||n===null)return n;if(n instanceof Date)return new Date(n);if(Array.isArray(n))return e(n,t);var o={};for(var s in n)if(Object.hasOwnProperty.call(n,s)!==!1){var a=n[s];typeof a!="object"||a===null?o[s]=a:a instanceof Date?o[s]=new Date(a):o[s]=t(a)}return o}function i(n){if(typeof n!="object"||n===null)return n;if(n instanceof Date)return new Date(n);if(Array.isArray(n))return e(n,i);var o={};for(var s in n){var a=n[s];typeof a!="object"||a===null?o[s]=a:a instanceof Date?o[s]=new Date(a):o[s]=i(a)}return o}}function zY(r){var e=[],t=[];return r.proto?o:n;function i(s,a){for(var l=Object.keys(s),u=new Array(l.length),c=0;c<l.length;c++){var f=l[c],p=s[f];if(typeof p!="object"||p===null)u[f]=p;else if(p instanceof Date)u[f]=new Date(p);else{var d=e.indexOf(p);d!==-1?u[f]=t[d]:u[f]=a(p)}}return u}function n(s){if(typeof s!="object"||s===null)return s;if(s instanceof Date)return new Date(s);if(Array.isArray(s))return i(s,n);var a={};e.push(s),t.push(a);for(var l in s)if(Object.hasOwnProperty.call(s,l)!==!1){var u=s[l];if(typeof u!="object"||u===null)a[l]=u;else if(u instanceof Date)a[l]=new Date(u);else{var c=e.indexOf(u);c!==-1?a[l]=t[c]:a[l]=n(u)}}return e.pop(),t.pop(),a}function o(s){if(typeof s!="object"||s===null)return s;if(s instanceof Date)return new Date(s);if(Array.isArray(s))return i(s,o);var a={};e.push(s),t.push(a);for(var l in s){var u=s[l];if(typeof u!="object"||u===null)a[l]=u;else if(u instanceof Date)a[l]=new Date(u);else{var c=e.indexOf(u);c!==-1?a[l]=t[c]:a[l]=o(u)}}return e.pop(),t.pop(),a}}});var bs=g((MSe,ZT)=>{var GY=require("util"),ys=gt()("log4js:configuration"),Id=[],Fd=[],QT=r=>!r,eR=r=>r&&typeof r=="object"&&!Array.isArray(r),VY=r=>/^[A-Za-z][A-Za-z0-9_]*$/g.test(r),KY=r=>r&&typeof r=="number"&&Number.isInteger(r),JY=r=>{Fd.push(r),ys(`Added listener, now ${Fd.length} listeners`)},YY=r=>{Id.push(r),ys(`Added pre-processing listener, now ${Id.length} listeners`)},tR=(r,e,t)=>{(Array.isArray(e)?e:[e]).forEach(n=>{if(n)throw new Error(`Problem with log4js configuration: (${GY.inspect(r,{depth:5})}) - ${t}`)})},XY=r=>{ys("New configuration to be validated: ",r),tR(r,QT(eR(r)),"must be an object."),ys(`Calling pre-processing listeners (${Id.length})`),Id.forEach(e=>e(r)),ys("Configuration pre-processing finished."),ys(`Calling configuration listeners (${Fd.length})`),Fd.forEach(e=>e(r)),ys("Configuration finished.")};ZT.exports={configure:XY,addListener:JY,addPreProcessingListener:YY,throwExceptionIf:tR,anObject:eR,anInteger:KY,validIdentifier:VY,not:QT}});var nR=g((NSe,ui)=>{"use strict";function rR(r,e){for(var t=r.toString();t.length<e;)t="0"+t;return t}function ws(r){return rR(r,2)}function ZY(r){var e=Math.abs(r),t=String(Math.floor(e/60)),i=String(e%60);return t.length===1&&(t="0"+t),i.length===1&&(i="0"+i),r<0?"+"+t+i:"-"+t+i}function iR(r,e){typeof r!="string"&&(e=r,r=ui.exports.ISO8601_FORMAT),e||(e=ui.exports.now());var t=ws(e.getDate()),i=ws(e.getMonth()+1),n=ws(e.getFullYear()),o=ws(n.substring(2,4)),s=r.indexOf("yyyy")>-1?n:o,a=ws(e.getHours()),l=ws(e.getMinutes()),u=ws(e.getSeconds()),c=rR(e.getMilliseconds()
`)}}function mX(r,e){let t=e.colouredLayout;return r.layout&&(t=e.layout(r.layout.type,r.layout)),hX(t,r.timezoneOffset)}IR.configure=mX});var OR=g((GSe,AR)=>{function gX(r,e){return t=>{process.stderr.write(`${r(t,e)}
`)}}function vX(r,e){let t=e.colouredLayout;return r.layout&&(t=e.layout(r.layout.type,r.layout)),gX(t,r.timezoneOffset)}AR.exports.configure=vX});var MR=g((VSe,LR)=>{function yX(r,e,t,i){let n=i.getLevel(r),o=i.getLevel(e,i.FATAL);return s=>{let a=s.level;a.isGreaterThanOrEqualTo(n)&&a.isLessThanOrEqualTo(o)&&t(s)}}function bX(r,e,t,i){let n=t(r.appender);return yX(r.level,r.maxLevel,n,i)}LR.exports.configure=bX});var $R=g((KSe,NR)=>{var qR=gt()("log4js:categoryFilter");function wX(r,e){return typeof r=="string"&&(r=[r]),t=>{qR(`Checking ${t.categoryName} against ${r}`),r.indexOf(t.categoryName)===-1&&(qR("Not excluded, sending to appender"),e(t))}}function xX(r,e,t){let i=t(r.appender);return wX(r.exclude,i)}NR.exports.configure=xX});var UR=g((JSe,BR)=>{var jR=gt()("log4js:noLogFilter");function DX(r){return r.filter(t=>t!=null&&t!=="")}function SX(r,e){return t=>{jR(`Checking data: ${t.data} against filters: ${r}`),typeof r=="string"&&(r=[r]),r=DX(r);let i=new RegExp(r.join("|"),"i");(r.length===0||t.data.findIndex(n=>i.test(n))<0)&&(jR("Not excluded, sending to appender"),e(t))}}function EX(r,e,t){let i=t(r.appender);return SX(r.exclude,i)}BR.exports.configure=EX});var Er=g(ob=>{"use strict";ob.fromCallback=function(r){return Object.defineProperty(function(){if(typeof arguments[arguments.length-1]=="function")r.apply(this,arguments);else return new Promise((e,t)=>{arguments[arguments.length]=(i,n)=>{if(i)return t(i);e(n)},arguments.length++,r.apply(this,arguments)})},"name",{value:r.name})};ob.fromPromise=function(r){return Object.defineProperty(function(){let e=arguments[arguments.length-1];if(typeof e!="function")return r.apply(this,arguments);r.apply(this,arguments).then(t=>e(null,t),e)},"name",{value:r.name})}});var HR=g((XSe,WR)=>{var go=require("constants"),CX=process.cwd,Md=null,_X=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return Md||(Md=CX.call(process)),Md};try{process.cwd()}catch(r){}var PX=process.chdir;process.chdir=function(r){Md=null,PX.call(process,r)};WR.exports=TX;function TX(r){go.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&e(r),r.lutimes||t(r),r.chown=o(r.chown),r.fchown=o(r.fchown),r.lchown=o(r.lchown),r.chmod=i(r.chmod),r.fchmod=i(r.fchmod),r.lchmod=i(r.lchmod),r.chownSync=s(r.chownSync),r.fchownSync=s(r.fchownSync),r.lchownSync=s(r.lchownSync),r.chmodSync=n(r.chmodSync),r.fchmodSync=n(r.fchmodSync),r.lchmodSync=n(r.lchmodSync),r.stat=a(r.stat),r.fstat=a(r.fstat),r.lstat=a(r.lstat),r.statSync=l(r.statSync),r.fstatSync=l(r.fstatSync),r.lstatSync=l(r.lstatSync),r.lchmod||(r.lchmod=function(c,f,p){p&&process.nextTick(p)},r.lchmodSync=function(){}),r.lchown||(r.lchown=function(c,f,p,d){d&&process.nextTick(d)},r.lchownSync=function(){}),_X==="win32"&&(r.rename=function(c){return function(f,p,d){var h=Date.now(),m=0;c(f,p,function y(v){if(v&&(v.code==="EACCES"||v.code==="EPERM")&&Date.now()-h<6e4){setTimeout(function(){r.stat(p,function(x,w){x&&x.code==="ENOENT"?c(f,p,y):d(v)})},m),m<100&&(m+=10);return}d&&d(v)})}}(r.rename)),r.read=function(c){function f(p,d,h,m,y,v){var x;if(v&&typeof v=="function"){var w=0;x=function(E,P,k){if(E&&E.code==="EAGAIN"&&w<10)return w++,c.call(r,p,d,h,m,y,x);v.apply(this,arguments)}}return c.call(r,p,d,h,m,y,x)}return f.__proto__=c,f}(r.read),r.readSync=function(c){return function(f,p,d,h,m){for(var y=0;;)try{return c.call(r,f,p,d,h,m)}catch(v){if(v.code==="EAGAIN"&&y<10){y++;continue}throw v}}}(r.readSync);function e(c){c.lchmod=function(f,p,d){c.open(f,go.O_WRONLY|go.O_SYMLINK,p,function(h,m){if(h){d&&d(h);return}c.fchmod(m,p,function(y){c.close(m,function(v){d&&d(y||v)})})})},c.lchmodSync=function(f,p){var d=c.openSync(f,go.O_WRONLY|go.O_SYMLINK,p),h=!0,m;try{m=c.fchmodSync(d,p),h=!1}finally{if(h)try{c.closeSync(d)}catch(y){}else c.closeSync(d)}return m}}function t(c){go.hasOwnProperty("O_SYMLINK")?(c.lutimes=function(f,p,d,h){c.open(f,go.O_SYMLINK,function(m,y){if(m){h&&h(m);return}c.futimes(y,p,d,function(v){c.close(y,function(x){h&&h(v||x)})})})},c.lutimesSync=function(f,p,d){var h=c.openSync(f,go.O_
GFS4: `),console.error(r)});$t[Ni]||(XR=global[Ni]||[],YR($t,XR),$t.close=function(r){function e(t,i){return r.call($t,t,function(n){n||Ss(),typeof i=="function"&&i.apply(this,arguments)})}return Object.defineProperty(e,qd,{value:r}),e}($t.close),$t.closeSync=function(r){function e(t){r.apply($t,arguments),Ss()}return Object.defineProperty(e,qd,{value:r}),e}($t.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){ac($t[Ni]),require("assert").equal($t[Ni].length,0)}));var XR;global[Ni]||YR(global,$t[Ni]);sb.exports=ab(AX($t));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!$t.__patched&&(sb.exports=ab($t),$t.__patched=!0);function ab(r){IX(r),r.gracefulify=ab,r.createReadStream=w,r.createWriteStream=E;var e=r.readFile;r.readFile=t;function t(_,O,I){return typeof O=="function"&&(I=O,O=null),L(_,O,I);function L(R,F,q){return e(R,F,function(K){K&&(K.code==="EMFILE"||K.code==="ENFILE")?lc([L,[R,F,q]]):(typeof q=="function"&&q.apply(this,arguments),Ss())})}}var i=r.writeFile;r.writeFile=n;function n(_,O,I,L){return typeof I=="function"&&(L=I,I=null),R(_,O,I,L);function R(F,q,K,ae){return i(F,q,K,function(Pe){Pe&&(Pe.code==="EMFILE"||Pe.code==="ENFILE")?lc([R,[F,q,K,ae]]):(typeof ae=="function"&&ae.apply(this,arguments),Ss())})}}var o=r.appendFile;o&&(r.appendFile=s);function s(_,O,I,L){return typeof I=="function"&&(L=I,I=null),R(_,O,I,L);function R(F,q,K,ae){return o(F,q,K,function(Pe){Pe&&(Pe.code==="EMFILE"||Pe.code==="ENFILE")?lc([R,[F,q,K,ae]]):(typeof ae=="function"&&ae.apply(this,arguments),Ss())})}}var a=r.readdir;r.readdir=l;function l(_,O,I){var L=[_];return typeof O!="function"?L.push(O):I=O,L.push(R),u(L);function R(F,q){q&&q.sort&&q.sort(),F&&(F.code==="EMFILE"||F.code==="ENFILE")?lc([u,[L]]):(typeof I=="function"&&I.apply(this,arguments),Ss())}}function u(_){return a.apply(r,_)}if(process.version.substr(0,4)==="v0.8"){var c=FX(r);m=c.ReadStream,v=c.WriteStream}var f=r.ReadStream;f&&(m.prototype=Object.create(f.prototype),m.prototype.open=y);var p=r.WriteStream;p&&(v.prototype=Object.create(p.prototype),v.prototype.open=x),Object.defineProperty(r,"ReadStream",{get:function(){return m},set:function(_){m=_},enumerable:!0,configurable:!0}),Object.defineProperty(r,"WriteStream",{get:function(){return v},set:function(_){v=_},enumerable:!0,configurable:!0});var d=m;Object.defineProperty(r,"FileReadStream",{get:function(){return d},set:function(_){d=_},enumerable:!0,configurable:!0});var h=v;Object.defineProperty(r,"FileWriteStream",{get:function(){return h},set:function(_){h=_},enumerable:!0,configurable:!0});function m(_,O){return this instanceof m?(f.apply(this,arguments),this):m.apply(Object.create(m.prototype),arguments)}function y(){var _=this;k(_.path,_.flags,_.mode,function(O,I){O?(_.autoClose&&_.destroy(),_.emit("error",O)):(_.fd=I,_.emit("open",I),_.read())})}function v(_,O){return this instanceof v?(p.apply(this,arguments),this):v.apply(Object.create(v.prototype),arguments)}function x(){var _=this;k(_.path,_.flags,_.mode,function(O,I){O?(_.destroy(),_.emit("error",O)):(_.fd=I,_.emit("open",I))})}function w(_,O){return new r.ReadStream(_,O)}function E(_,O){return new r.WriteStream(_,O)}var P=r.open;r.open=k;function k(_,O,I,L){return typeof I=="function"&&(L=I,I=null),R(_,O,I,L);function R(F,q,K,ae){return P(F,q,K,function(Pe,We){Pe&&(Pe.code==="EMFILE"||Pe.code==="ENFILE")?lc([R,[F,q,K,ae]]):(typeof ae=="function"&&ae.apply(this,arguments),Ss())})}}return r}function lc(r){ac("ENQUEUE",r[0].name,r[1]),$t[Ni].push(r)}function Ss(){var r=$t[Ni].shift();r&&(ac("RETRY",r[0].name,r[1]),r[0].apply(null,r[1]))}});var lb=g(Es=>{"use strict";var ZR=Er().fromCallback,fi=Ce(),LX=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchown","lchmod","link","lstat","mkdir","mkdtemp","open","readFile","readdir","readlink","realpath","rename","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter(r=>typeof fi[r]=="function");Object.keys(fi).forEach(r=>{r!=="promises"&&(Es[r]=fi[r])});LX.forEach(r=>{Es[r]=ZR
see https://github.com/jprichardson/node-fs-extra/issues/269`);let{srcStat:i,destStat:n}=dc.checkPathsSync(r,e,"copy");return dc.checkParentPathsSync(r,i,e,"copy"),nZ(n,r,e,t)}function nZ(r,e,t,i){if(i.filter&&!i.filter(e,t))return;let n=pc.dirname(t);return it.existsSync(n)||rZ(n),v1(r,e,t,i)}function v1(r,e,t,i){if(!(i.filter&&!i.filter(e,t)))return sZ(r,e,t,i)}function sZ(r,e,t,i){let o=(i.dereference?it.statSync:it.lstatSync)(e);if(o.isDirectory())return lZ(o,r,e,t,i);if(o.isFile()||o.isCharacterDevice()||o.isBlockDevice())return aZ(o,r,e,t,i);if(o.isSymbolicLink())return uZ(r,e,t,i)}function aZ(r,e,t,i,n){return e?cZ(r,t,i,n):y1(r,t,i,n)}function cZ(r,e,t,i){if(i.overwrite)return it.unlinkSync(t),y1(r,e,t,i);if(i.errorOnExist)throw new Error(`'${t}' already exists`)}function y1(r,e,t,i){return typeof it.copyFileSync=="function"?(it.copyFileSync(e,t),it.chmodSync(t,r.mode),i.preserveTimestamps?iZ(t,r.atime,r.mtime):void 0):fZ(r,e,t,i)}function fZ(r,e,t,i){let n=64*1024,o=m1()(n),s=it.openSync(e,"r"),a=it.openSync(t,"w",r.mode),l=0;for(;l<r.size;){let u=it.readSync(s,o,0,n,l);it.writeSync(a,o,0,u),l+=u}i.preserveTimestamps&&it.futimesSync(a,r.atime,r.mtime),it.closeSync(s),it.closeSync(a)}function lZ(r,e,t,i,n){if(!e)return pZ(r,t,i,n);if(e&&!e.isDirectory())throw new Error(`Cannot overwrite non-directory '${i}' with directory '${t}'.`);return b1(t,i,n)}function pZ(r,e,t,i){return it.mkdirSync(t),b1(e,t,i),it.chmodSync(t,r.mode)}function b1(r,e,t){it.readdirSync(r).forEach(i=>dZ(i,r,e,t))}function dZ(r,e,t,i){let n=pc.join(e,r),o=pc.join(t,r),{destStat:s}=dc.checkPathsSync(n,o,"copy");return v1(s,n,o,i)}function uZ(r,e,t,i){let n=it.readlinkSync(e);if(i.dereference&&(n=pc.resolve(process.cwd(),n)),r){let o;try{o=it.readlinkSync(t)}catch(s){if(s.code==="EINVAL"||s.code==="UNKNOWN")return it.symlinkSync(n,t);throw s}if(i.dereference&&(o=pc.resolve(process.cwd(),o)),dc.isSrcSubdir(n,o))throw new Error(`Cannot copy '${n}' to a subdirectory of itself, '${o}'.`);if(it.statSync(t).isDirectory()&&dc.isSrcSubdir(o,n))throw new Error(`Cannot overwrite '${o}' with '${n}'.`);return hZ(n,t)}else return it.symlinkSync(n,t)}function hZ(r,e){return it.unlinkSync(e),it.symlinkSync(r,e)}g1.exports=oZ});var xb=g((cEe,x1)=>{"use strict";x1.exports={copySync:w1()}});var fn=g((fEe,D1)=>{"use strict";var mZ=Er().fromPromise,S1=lb();function gZ(r){return S1.access(r).then(()=>!0).catch(()=>!1)}D1.exports={pathExists:mZ(gZ),pathExistsSync:S1.existsSync}});var F1=g((pEe,E1)=>{"use strict";var Bt=Ce(),hc=require("path"),vZ=Br().mkdirs,yZ=fn().pathExists,bZ=vb().utimesMillis,mc=fc();function wZ(r,e,t,i){typeof t=="function"&&!i?(i=t,t={}):typeof t=="function"&&(t={filter:t}),i=i||function(){},t=t||{},t.clobber="clobber"in t?!!t.clobber:!0,t.overwrite="overwrite"in t?!!t.overwrite:t.clobber,t.preserveTimestamps&&process.arch==="ia32"&&console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;
see https://github.com/jprichardson/node-fs-extra/issues/269`),mc.checkPaths(r,e,"copy",(n,o)=>{if(n)return i(n);let{srcStat:s,destStat:a}=o;mc.checkParentPaths(r,s,e,"copy",l=>l?i(l):t.filter?_1(C1,a,r,e,t,i):C1(a,r,e,t,i))})}function C1(r,e,t,i,n){let o=hc.dirname(t);yZ(o,(s,a)=>{if(s)return n(s);if(a)return Db(r,e,t,i,n);vZ(o,l=>l?n(l):Db(r,e,t,i,n))})}function _1(r,e,t,i,n,o){Promise.resolve(n.filter(t,i)).then(s=>s?r(e,t,i,n,o):o(),s=>o(s))}function Db(r,e,t,i,n){return i.filter?_1(P1,r,e,t,i,n):P1(r,e,t,i,n)}function P1(r,e,t,i,n){(i.dereference?Bt.stat:Bt.lstat)(e,(s,a)=>{if(s)return n(s);if(a.isDirectory())return DZ(a,r,e,t,i,n);if(a.isFile()||a.isCharacterDevice()||a.isBlockDevice())return xZ(a,r,e,t,i,n);if(a.isSymbolicLink())return SZ(r,e,t,i,n)})}function xZ(r,e,t,i,n,o){return e?EZ(r,t,i,n,o):T1(r,t,i,n,o)}function EZ(r,e,t,i,n){if(i.overwrite)Bt.unlink(t,o=>o?n(o):T1(r,e,t,i,n));else return i.errorOnExist?n(new Error(`'${t}' already exists`)):n()}function T1(r,e,t,i,n){return typeof Bt.copyFile=="function"?Bt.copyFile(e,t,o=>o?n(o):R1(r,t,i,n)):CZ(r,e,t,i,n)}function CZ(r,e,t,i,n){let o=Bt.createReadStream(e);o.on("error",s=>n(s)).once("open",()=>{let s=Bt.createWriteStream(t,{mode:r.mode});s.on("error",a=>n(a)).on("open",()=>o.pipe(s)).once("close",()=>R1(r,t,i,n))})}function R1(r,e,t,i){Bt.chmod(e,r.mode,n=>n?i(n):t.preserveTimestamps?bZ(e,r.atime,r.mtime,i):i())}function DZ(r,e,t,i,n,o){return e?e&&!e.isDirectory()?o(new Error(`Cannot overwrite non-directory '${i}' with directory '${t}'.`)):k1(t,i,n,o):_Z(r,t,i,n,o)}function _Z(r,e,t,i,n){Bt.mkdir(t,o=>{if(o)return n(o);k1(e,t,i,s=>s?n(s):Bt.chmod(t,r.mode,n))})}function k1(r,e,t,i){Bt.readdir(r,(n,o)=>n?i(n):I1(o,r,e,t,i))}function I1(r,e,t,i,n){let o=r.pop();return o?PZ(r,o,e,t,i,n):n()}function PZ(r,e,t,i,n,o){let s=hc.join(t,e),a=hc.join(i,e);mc.checkPaths(s,a,"copy",(l,u)=>{if(l)return o(l);let{destStat:c}=u;Db(c,s,a,n,f=>f?o(f):I1(r,t,i,n,o))})}function SZ(r,e,t,i,n){Bt.readlink(e,(o,s)=>{if(o)return n(o);if(i.dereference&&(s=hc.resolve(process.cwd(),s)),r)Bt.readlink(t,(a,l)=>a?a.code==="EINVAL"||a.code==="UNKNOWN"?Bt.symlink(s,t,n):n(a):(i.dereference&&(l=hc.resolve(process.cwd(),l)),mc.isSrcSubdir(s,l)?n(new Error(`Cannot copy '${s}' to a subdirectory of itself, '${l}'.`)):r.isDirectory()&&mc.isSrcSubdir(l,s)?n(new Error(`Cannot overwrite '${l}' with '${s}'.`)):TZ(s,t,n)));else return Bt.symlink(s,t,n)})}function TZ(r,e,t){Bt.unlink(e,i=>i?t(i):Bt.symlink(r,e,t))}E1.exports=wZ});var Sb=g((dEe,A1)=>{"use strict";var RZ=Er().fromCallback;A1.exports={copy:RZ(F1())}});var U1=g((hEe,O1)=>{"use strict";var L1=Ce(),M1=require("path"),Oe=require("assert"),gc=process.platform==="win32";function N1(r){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach(t=>{r[t]=r[t]||L1[t],t=t+"Sync",r[t]=r[t]||L1[t]}),r.maxBusyTries=r.maxBusyTries||3}function Eb(r,e,t){let i=0;typeof e=="function"&&(t=e,e={}),Oe(r,"rimraf: missing path"),Oe.strictEqual(typeof r,"string","rimraf: path should be a string"),Oe.strictEqual(typeof t,"function","rimraf: callback function required"),Oe(e,"rimraf: invalid options argument provided"),Oe.strictEqual(typeof e,"object","rimraf: options should be object"),N1(e),q1(r,e,function n(o){if(o){if((o.code==="EBUSY"||o.code==="ENOTEMPTY"||o.code==="EPERM")&&i<e.maxBusyTries){i++;let s=i*100;return setTimeout(()=>q1(r,e,n),s)}o.code==="ENOENT"&&(o=null)}t(o)})}function q1(r,e,t){Oe(r),Oe(e),Oe(typeof t=="function"),e.lstat(r,(i,n)=>{if(i&&i.code==="ENOENT")return t(null);if(i&&i.code==="EPERM"&&gc)return $1(r,e,i,t);if(n&&n.isDirectory())return Bd(r,e,i,t);e.unlink(r,o=>{if(o){if(o.code==="ENOENT")return t(null);if(o.code==="EPERM")return gc?$1(r,e,o,t):Bd(r,e,o,t);if(o.code==="EISDIR")return Bd(r,e,o,t)}return t(o)})})}function $1(r,e,t,i){Oe(r),Oe(e),Oe(typeof i=="function"),t&&Oe(t instanceof Error),e.chmod(r,438,n=>{n?i(n.code==="ENOENT"?null:t):e.stat(r,(o,s)=>{o?i(o.code==="ENOENT"?null:t):s.isDirectory()?Bd(r,e,t,i):e.unlink(r,i)})})}function B1(r,e,t){let i;Oe(r),Oe(e),t&&Oe(t instanceof Error);try{e.chmodSync(r,438)}catc
`;typeof e=="object"&&e!==null&&(e.spaces&&(t=e.spaces),e.EOL&&(i=e.EOL));var n=JSON.stringify(r,e?e.replacer:null,t);return n.replace(/\n/g,i)+i}function iQ(r,e,t,i){i==null&&(i=t,t={}),t=t||{};var n=t.fs||ja,o="";try{o=Ek(e,t)}catch(s){i&&i(s,null);return}n.writeFile(r,o,t,i)}function nQ(r,e,t){t=t||{};var i=t.fs||ja,n=Ek(e,t);return i.writeFileSync(r,n,t)}function Sk(r){return Buffer.isBuffer(r)&&(r=r.toString("utf8")),r=r.replace(/^\uFEFF/,""),r}var oQ={readFile:tQ,readFileSync:rQ,writeFile:iQ,writeFileSync:nQ};Dk.exports=oQ});var Gd=g((EEe,_k)=>{"use strict";var Pk=Er().fromCallback,zd=Ck();_k.exports={readJson:Pk(zd.readFile),readJsonSync:zd.readFileSync,writeJson:Pk(zd.writeFile),writeJsonSync:zd.writeFileSync}});var kk=g((CEe,Tk)=>{"use strict";var sQ=require("path"),aQ=Br(),lQ=fn().pathExists,Rk=Gd();function uQ(r,e,t,i){typeof t=="function"&&(i=t,t={});let n=sQ.dirname(r);lQ(n,(o,s)=>{if(o)return i(o);if(s)return Rk.writeJson(r,e,t,i);aQ.mkdirs(n,a=>{if(a)return i(a);Rk.writeJson(r,e,t,i)})})}Tk.exports=uQ});var Fk=g((_Ee,Ik)=>{"use strict";var cQ=Ce(),fQ=require("path"),pQ=Br(),dQ=Gd();function hQ(r,e,t){let i=fQ.dirname(r);cQ.existsSync(i)||pQ.mkdirsSync(i),dQ.writeJsonSync(r,e,t)}Ik.exports=hQ});var Ok=g((PEe,Ak)=>{"use strict";var mQ=Er().fromCallback,mr=Gd();mr.outputJson=mQ(kk());mr.outputJsonSync=Fk();mr.outputJSON=mr.outputJson;mr.outputJSONSync=mr.outputJsonSync;mr.writeJSON=mr.writeJson;mr.writeJSONSync=mr.writeJsonSync;mr.readJSON=mr.readJson;mr.readJSONSync=mr.readJsonSync;Ak.exports=mr});var Bk=g((TEe,Lk)=>{"use strict";var Mk=Ce(),gQ=require("path"),vQ=xb().copySync,Nk=vc().removeSync,yQ=Br().mkdirpSync,qk=fc();function wQ(r,e,t){t=t||{};let i=t.overwrite||t.clobber||!1,{srcStat:n}=qk.checkPathsSync(r,e,"move");return qk.checkParentPathsSync(r,n,e,"move"),yQ(gQ.dirname(e)),bQ(r,e,i)}function bQ(r,e,t){if(t)return Nk(e),$k(r,e,t);if(Mk.existsSync(e))throw new Error("dest already exists.");return $k(r,e,t)}function $k(r,e,t){try{Mk.renameSync(r,e)}catch(i){if(i.code!=="EXDEV")throw i;return xQ(r,e,t)}}function xQ(r,e,t){return vQ(r,e,{overwrite:t,errorOnExist:!0}),Nk(r)}Lk.exports=wQ});var Uk=g((REe,jk)=>{"use strict";jk.exports={moveSync:Bk()}});var Vk=g((kEe,Wk)=>{"use strict";var DQ=Ce(),SQ=require("path"),EQ=Sb().copy,Hk=vc().remove,CQ=Br().mkdirp,_Q=fn().pathExists,zk=fc();function TQ(r,e,t,i){typeof t=="function"&&(i=t,t={});let n=t.overwrite||t.clobber||!1;zk.checkPaths(r,e,"move",(o,s)=>{if(o)return i(o);let{srcStat:a}=s;zk.checkParentPaths(r,a,e,"move",l=>{if(l)return i(l);CQ(SQ.dirname(e),u=>u?i(u):PQ(r,e,n,i))})})}function PQ(r,e,t,i){if(t)return Hk(e,n=>n?i(n):Gk(r,e,t,i));_Q(e,(n,o)=>n?i(n):o?i(new Error("dest already exists.")):Gk(r,e,t,i))}function Gk(r,e,t,i){DQ.rename(r,e,n=>n?n.code!=="EXDEV"?i(n):RQ(r,e,t,i):i())}function RQ(r,e,t,i){EQ(r,e,{overwrite:t,errorOnExist:!0},o=>o?i(o):Hk(r,i))}Wk.exports=TQ});var Jk=g((IEe,Kk)=>{"use strict";var kQ=Er().fromCallback;Kk.exports={move:kQ(Vk())}});var Qk=g((FEe,Yk)=>{"use strict";var IQ=Er().fromCallback,wc=Ce(),Xk=require("path"),Zk=Br(),FQ=fn().pathExists;function AQ(r,e,t,i){typeof t=="function"&&(i=t,t="utf8");let n=Xk.dirname(r);FQ(n,(o,s)=>{if(o)return i(o);if(s)return wc.writeFile(r,e,t,i);Zk.mkdirs(n,a=>{if(a)return i(a);wc.writeFile(r,e,t,i)})})}function OQ(r,...e){let t=Xk.dirname(r);if(wc.existsSync(t))return wc.writeFileSync(r,...e);Zk.mkdirsSync(t),wc.writeFileSync(r,...e)}Yk.exports={outputFile:IQ(AQ),outputFileSync:OQ}});var _b=g((AEe,Cb)=>{"use strict";Cb.exports=Object.assign({},lb(),xb(),Sb(),Z1(),xk(),Ok(),Br(),Uk(),Jk(),Qk(),fn(),vc());var eI=require("fs");Object.getOwnPropertyDescriptor(eI,"promises")&&Object.defineProperty(Cb.exports,"promises",{get(){return eI.promises}})});var rI=g((OEe,tI)=>{tI.exports=()=>new Date});var Pb=g((LEe,di)=>{"use strict";function iI(r,e){for(var t=r.toString();t.length<e;)t="0"+t;return t}function _s(r){return iI(r,2)}function LQ(r){var e=Math.abs(r),t=String(Math.floor(e/60)),i=String(e%60);return t.length===1&&(t="0"+t),i.length===1&&(i="0"+i),r<0?"+"+t+i:"-"+t+i}function Ps(r,e,t){
`;function kI(r,e){if(On.existsSync(r))return;let t=On.openSync(r,e.flags,e.mode);On.closeSync(t)}var II=class{constructor(e,t,i,n){An("In RollingFileStream");function o(){if(!e||!t||t<=0)throw new Error("You must specify a filename and file size")}o(),this.filename=e,this.size=t,this.backups=i||1,this.options=n,this.currentSize=0;function s(a){let l=0;try{l=On.statSync(a).size}catch(u){kI(a,n)}return l}this.currentSize=s(this.filename)}shouldRoll(){return An("should roll with current size %d, and max size %d",this.currentSize,this.size),this.currentSize>=this.size}roll(e){let t=this,i=new RegExp(`^${Ua.basename(e)}`);function n(u){return i.test(u)}function o(u){return parseInt(u.substring(`${Ua.basename(e)}.`.length),10)||0}function s(u,c){return o(u)>o(c)?1:o(u)<o(c)?-1:0}function a(u){let c=o(u);if(An(`Index of ${u} is ${c}`),c<t.backups){try{On.unlinkSync(`${e}.${c+1}`)}catch(f){}An(`Renaming ${u} -> ${e}.${c+1}`),On.renameSync(Ua.join(Ua.dirname(e),u),`${e}.${c+1}`)}}function l(){An("Renaming the old files"),On.readdirSync(Ua.dirname(e)).filter(n).sort(s).reverse().forEach(a)}An("Rolling, rolling, rolling"),l()}write(e,t){let i=this;function n(){An("writing the chunk to the file"),i.currentSize+=e.length,On.appendFileSync(i.filename,e)}An("in write"),this.shouldRoll()&&(this.currentSize=0,this.roll(this.filename)),n()}};function fee(r,e,t,i,n,o){An("fileSync appender created"),r=Ua.normalize(r),i=i===void 0?5:i,i=i===0?1:i;function s(l,u,c){let f;return u?f=new II(l,u,c,o):f=(p=>(kI(p,o),{write(d){On.appendFileSync(p,d)}}))(l),f}let a=s(r,t,i);return l=>{a.write(e(l,n)+cee)}}function pee(r,e){let t=e.basicLayout;r.layout&&(t=e.layout(r.layout.type,r.layout));let i={flags:r.flags||"a",encoding:r.encoding||"utf8",mode:r.mode||420};return fee(r.filename,t,r.maxLogSize,r.backups,r.timezoneOffset,i)}RI.exports.configure=pee});var kb=g((GEe,AI)=>{var dee=require("path"),ks=gt()("log4js:appenders"),hi=bs(),OI=Ld(),hee=Ds(),mee=eb(),gee=TR(),pn=new Map;pn.set("console",kR());pn.set("stdout",FR());pn.set("stderr",OR());pn.set("logLevelFilter",MR());pn.set("categoryFilter",$R());pn.set("noLogFilter",UR());pn.set("file",_I());pn.set("dateFile",TI());pn.set("fileSync",FI());var Dc=new Map,Rb=(r,e)=>{ks("Loading module from ",r);try{return require(r)}catch(t){hi.throwExceptionIf(e,t.code!=="MODULE_NOT_FOUND",`appender "${r}" could not be loaded (error was: ${t})`);return}},vee=(r,e)=>pn.get(r)||Rb(`./${r}`,e)||Rb(r,e)||""||Rb(dee.join(process.cwd(),r),e),Xd=new Set,LI=(r,e)=>{if(Dc.has(r))return Dc.get(r);if(!e.appenders[r])return!1;if(Xd.has(r))throw new Error(`Dependency loop detected for appender ${r}.`);Xd.add(r),ks(`Creating appender ${r}`);let t=yee(r,e);return Xd.delete(r),Dc.set(r,t),t},yee=(r,e)=>{let t=e.appenders[r],i=t.type.configure?t.type:vee(t.type,e);return hi.throwExceptionIf(e,hi.not(i),`appender "${r}" is not valid (type "${t.type}" could not be found)`),i.appender&&ks(`DEPRECATION: Appender ${t.type} exports an appender function.`),i.shutdown&&ks(`DEPRECATION: Appender ${t.type} exports a shutdown function.`),ks(`${r}: clustering.isMaster ? ${OI.isMaster()}`),ks(`${r}: appenderModule is ${require("util").inspect(i)}`),OI.onlyOnMaster(()=>(ks(`calling appenderModule.configure for ${r} / ${t.type}`),i.configure(gee.modifyConfig(t),mee,n=>LI(n,e),hee)),()=>{})},MI=r=>{Dc.clear(),Xd.clear();let e=[];Object.values(r.categories).forEach(t=>{e.push(...t.appenders)}),Object.keys(r.appenders).forEach(t=>{(e.includes(t)||r.appenders[t].type==="tcp-server")&&LI(t,r)})};MI({appenders:{out:{type:"stdout"}},categories:{default:{appenders:["out"],level:"trace"}}});hi.addListener(r=>{hi.throwExceptionIf(r,hi.not(hi.anObject(r.appenders)),'must have a property "appenders" of type object.');let e=Object.keys(r.appenders);hi.throwExceptionIf(r,hi.not(e.length),"must define at least one appender."),e.forEach(t=>{hi.throwExceptionIf(r,hi.not(r.appenders[t].type),`appender "${t}" is not valid (must be an object with property "type")`)})});hi.addListener(MI);AI.exports=Dc});var Fb=g((VEe,NI)=>{var Is=gt()("log4js:categories"),at=b
`).slice(e),i=Tee.exec(t[0]);return i&&i.length===6?{functionName:i[1],fileName:i[2],lineNumber:parseInt(i[3],10),columnNumber:parseInt(i[4],10),callStack:t.join(`
`)}:null}var Qd=class{constructor(e){if(!e)throw new Error("No category provided.");this.category=e,this.context={},this.parseCallStack=Ree,UI(`Logger created (${this.category}, ${this.level})`)}get level(){return bo.getLevel(Zd.getLevelForCategory(this.category),bo.TRACE)}set level(e){Zd.setLevelForCategory(this.category,bo.getLevel(e,this.level))}get useCallStack(){return Zd.getEnableCallStackForCategory(this.category)}set useCallStack(e){Zd.setEnableCallStackForCategory(this.category,e===!0)}log(e,...t){let i=bo.getLevel(e,bo.INFO);this.isLevelEnabled(i)&&this._log(i,t)}isLevelEnabled(e){return this.level.isLessThanOrEqualTo(e)}_log(e,t){UI(`sending log data (${e}) to appenders`);let i=new Cee(this.category,e,t,this.context,this.useCallStack&&this.parseCallStack(new Error));_ee.send(i)}addContext(e,t){this.context[e]=t}removeContext(e){delete this.context[e]}clearContext(){this.context={}}setParseCallStackFunction(e){this.parseCallStack=e}};function WI(r){let e=bo.getLevel(r),i=e.toString().toLowerCase().replace(/_([a-z])/g,o=>o[1].toUpperCase()),n=i[0].toUpperCase()+i.slice(1);Qd.prototype[`is${n}Enabled`]=function(){return this.isLevelEnabled(e)},Qd.prototype[i]=function(...o){this.log(e,...o)}}bo.levels.forEach(WI);Pee.addListener(()=>{bo.levels.forEach(WI)});jI.exports=Qd});var VI=g((JEe,zI)=>{var Ha=Ds(),kee=':remote-addr - - ":method :url HTTP/:http-version" :status :content-length ":referrer" ":user-agent"';function Iee(r){return r.originalUrl||r.url}function Fee(r,e,t){let i=o=>{let s=o.concat();for(let a=0;a<s.length;++a)for(let l=a+1;l<s.length;++l)s[a].token==s[l].token&&s.splice(l--,1);return s},n=[];return n.push({token:":url",replacement:Iee(r)}),n.push({token:":protocol",replacement:r.protocol}),n.push({token:":hostname",replacement:r.hostname}),n.push({token:":method",replacement:r.method}),n.push({token:":status",replacement:e.__statusCode||e.statusCode}),n.push({token:":response-time",replacement:e.responseTime}),n.push({token:":date",replacement:new Date().toUTCString()}),n.push({token:":referrer",replacement:r.headers.referer||r.headers.referrer||""}),n.push({token:":http-version",replacement:`${r.httpVersionMajor}.${r.httpVersionMinor}`}),n.push({token:":remote-addr",replacement:r.headers["x-forwarded-for"]||r.ip||r._remoteAddress||r.socket&&(r.socket.remoteAddress||r.socket.socket&&r.socket.socket.remoteAddress)}),n.push({token:":user-agent",replacement:r.headers["user-agent"]}),n.push({token:":content-length",replacement:e.getHeader("content-length")||e.__headers&&e.__headers["Content-Length"]||"-"}),n.push({token:/:req\[([^\]]+)]/g,replacement(o,s){return r.headers[s.toLowerCase()]}}),n.push({token:/:res\[([^\]]+)]/g,replacement(o,s){return e.getHeader(s.toLowerCase())||e.__headers&&e.__headers[s]}}),i(t.concat(n))}function GI(r,e){for(let t=0;t<e.length;t++)r=r.replace(e[t].token,e[t].replacement);return r}function Aee(r){let e=null;if(r instanceof RegExp&&(e=r),typeof r=="string"&&(e=new RegExp(r)),Array.isArray(r)){let t=r.map(i=>i.source?i.source:i);e=new RegExp(t.join("|"))}return e}function Oee(r,e,t){let i=e;if(t){let n=t.find(o=>{let s=!1;return o.from&&o.to?s=r>=o.from&&r<=o.to:s=o.codes.indexOf(r)!==-1,s});n&&(i=Ha.getLevel(n.level,i))}return i}zI.exports=function(e,t){typeof t=="string"||typeof t=="function"?t={format:t}:t=t||{};let i=e,n=Ha.getLevel(t.level,Ha.INFO),o=t.format||kee,s=Aee(t.nolog);return(a,l,u)=>{if(a._logging||s&&s.test(a.originalUrl))return u();if(i.isLevelEnabled(n)||t.level==="auto"){let c=new Date,{writeHead:f}=l;a._logging=!0,l.writeHead=(p,d)=>{l.writeHead=f,l.writeHead(p,d),l.__statusCode=p,l.__headers=d||{}},l.on("finish",()=>{l.responseTime=new Date-c,l.statusCode&&t.level==="auto"&&(n=Ha.INFO,l.statusCode>=300&&(n=Ha.WARN),l.statusCode>=400&&(n=Ha.ERROR)),n=Oee(l.statusCode,n,t.statusRules);let p=Fee(a,l,t.tokens||[]);if(t.context&&i.addContext("res",l),typeof o=="function"){let d=o(a,l,h=>GI(h,p));d&&i.log(n,d)}else i.log(n,GI(o,p));t.context&&i.removeContext("res")})}return u()}}});var Ab=g((YEe,KI)=>{var wo=gt()("log4js:main"),Lee=require("fs"),Mee=XT(
see https://github.com/jprichardson/node-fs-extra/issues/269`);let{srcStat:i,destStat:n}=_c.checkPathsSync(r,e,"copy");return _c.checkParentPathsSync(r,i,e,"copy"),ute(n,r,e,t)}function ute(r,e,t,i){if(i.filter&&!i.filter(e,t))return;let n=Cc.dirname(t);return tr.existsSync(n)||ate(n),fF(r,e,t,i)}function fF(r,e,t,i){if(!(i.filter&&!i.filter(e,t)))return fte(r,e,t,i)}function fte(r,e,t,i){let o=(i.dereference?tr.statSync:tr.lstatSync)(e);if(o.isDirectory())return dte(o,r,e,t,i);if(o.isFile()||o.isCharacterDevice()||o.isBlockDevice())return pte(o,r,e,t,i);if(o.isSymbolicLink())return hte(r,e,t,i)}function pte(r,e,t,i,n){return e?mte(r,t,i,n):pF(r,t,i,n)}function mte(r,e,t,i){if(i.overwrite)return tr.unlinkSync(t),pF(r,e,t,i);if(i.errorOnExist)throw new Error(`'${t}' already exists`)}function pF(r,e,t,i){return tr.copyFileSync(e,t),i.preserveTimestamps&&gte(r.mode,e,t),Ub(t,r.mode)}function gte(r,e,t){return vte(r)&&yte(t,r),bte(e,t)}function vte(r){return(r&128)==0}function yte(r,e){return Ub(r,e|128)}function Ub(r,e){return tr.chmodSync(r,e)}function bte(r,e){let t=tr.statSync(r);return lte(e,t.atime,t.mtime)}function dte(r,e,t,i,n){if(!e)return wte(r.mode,t,i,n);if(e&&!e.isDirectory())throw new Error(`Cannot overwrite non-directory '${i}' with directory '${t}'.`);return dF(t,i,n)}function wte(r,e,t,i){return tr.mkdirSync(t),dF(e,t,i),Ub(t,r)}function dF(r,e,t){tr.readdirSync(r).forEach(i=>xte(i,r,e,t))}function xte(r,e,t,i){let n=Cc.join(e,r),o=Cc.join(t,r),{destStat:s}=_c.checkPathsSync(n,o,"copy");return fF(s,n,o,i)}function hte(r,e,t,i){let n=tr.readlinkSync(e);if(i.dereference&&(n=Cc.resolve(process.cwd(),n)),r){let o;try{o=tr.readlinkSync(t)}catch(s){if(s.code==="EINVAL"||s.code==="UNKNOWN")return tr.symlinkSync(n,t);throw s}if(i.dereference&&(o=Cc.resolve(process.cwd(),o)),_c.isSrcSubdir(n,o))throw new Error(`Cannot copy '${n}' to a subdirectory of itself, '${o}'.`);if(tr.statSync(t).isDirectory()&&_c.isSrcSubdir(o,n))throw new Error(`Cannot overwrite '${o}' with '${n}'.`);return Dte(n,t)}else return tr.symlinkSync(n,t)}function Dte(r,e){return tr.unlinkSync(e),tr.symlinkSync(r,e)}cF.exports=cte});var Wb=g((oCe,mF)=>{"use strict";mF.exports={copySync:hF()}});var Do=g((sCe,gF)=>{"use strict";var Ste=Ur().fromPromise,vF=Sc();function Ete(r){return vF.access(r).then(()=>!0).catch(()=>!1)}gF.exports={pathExists:Ste(Ete),pathExistsSync:vF.existsSync}});var _F=g((aCe,yF)=>{"use strict";var Pr=Ce(),Pc=require("path"),Cte=qi().mkdirs,_te=Do().pathExists,Pte=$b().utimesMillis,Tc=Ec();function Tte(r,e,t,i){typeof t=="function"&&!i?(i=t,t={}):typeof t=="function"&&(t={filter:t}),i=i||function(){},t=t||{},t.clobber="clobber"in t?!!t.clobber:!0,t.overwrite="overwrite"in t?!!t.overwrite:t.clobber,t.preserveTimestamps&&process.arch==="ia32"&&console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;
see https://github.com/jprichardson/node-fs-extra/issues/269`),Tc.checkPaths(r,e,"copy",(n,o)=>{if(n)return i(n);let{srcStat:s,destStat:a}=o;Tc.checkParentPaths(r,s,e,"copy",l=>l?i(l):t.filter?wF(bF,a,r,e,t,i):bF(a,r,e,t,i))})}function bF(r,e,t,i,n){let o=Pc.dirname(t);_te(o,(s,a)=>{if(s)return n(s);if(a)return Hb(r,e,t,i,n);Cte(o,l=>l?n(l):Hb(r,e,t,i,n))})}function wF(r,e,t,i,n,o){Promise.resolve(n.filter(t,i)).then(s=>s?r(e,t,i,n,o):o(),s=>o(s))}function Hb(r,e,t,i,n){return i.filter?wF(xF,r,e,t,i,n):xF(r,e,t,i,n)}function xF(r,e,t,i,n){(i.dereference?Pr.stat:Pr.lstat)(e,(s,a)=>{if(s)return n(s);if(a.isDirectory())return kte(a,r,e,t,i,n);if(a.isFile()||a.isCharacterDevice()||a.isBlockDevice())return Rte(a,r,e,t,i,n);if(a.isSymbolicLink())return Ite(r,e,t,i,n)})}function Rte(r,e,t,i,n,o){return e?Fte(r,t,i,n,o):DF(r,t,i,n,o)}function Fte(r,e,t,i,n){if(i.overwrite)Pr.unlink(t,o=>o?n(o):DF(r,e,t,i,n));else return i.errorOnExist?n(new Error(`'${t}' already exists`)):n()}function DF(r,e,t,i,n){Pr.copyFile(e,t,o=>o?n(o):i.preserveTimestamps?Ate(r.mode,e,t,n):nh(t,r.mode,n))}function Ate(r,e,t,i){return Ote(r)?Lte(t,r,n=>n?i(n):SF(r,e,t,i)):SF(r,e,t,i)}function Ote(r){return(r&128)==0}function Lte(r,e,t){return nh(r,e|128,t)}function SF(r,e,t,i){Mte(e,t,n=>n?i(n):nh(t,r,i))}function nh(r,e,t){return Pr.chmod(r,e,t)}function Mte(r,e,t){Pr.stat(r,(i,n)=>i?t(i):Pte(e,n.atime,n.mtime,t))}function kte(r,e,t,i,n,o){return e?e&&!e.isDirectory()?o(new Error(`Cannot overwrite non-directory '${i}' with directory '${t}'.`)):EF(t,i,n,o):Nte(r.mode,t,i,n,o)}function Nte(r,e,t,i,n){Pr.mkdir(t,o=>{if(o)return n(o);EF(e,t,i,s=>s?n(s):nh(t,r,n))})}function EF(r,e,t,i){Pr.readdir(r,(n,o)=>n?i(n):CF(o,r,e,t,i))}function CF(r,e,t,i,n){let o=r.pop();return o?qte(r,o,e,t,i,n):n()}function qte(r,e,t,i,n,o){let s=Pc.join(t,e),a=Pc.join(i,e);Tc.checkPaths(s,a,"copy",(l,u)=>{if(l)return o(l);let{destStat:c}=u;Hb(c,s,a,n,f=>f?o(f):CF(r,t,i,n,o))})}function Ite(r,e,t,i,n){Pr.readlink(e,(o,s)=>{if(o)return n(o);if(i.dereference&&(s=Pc.resolve(process.cwd(),s)),r)Pr.readlink(t,(a,l)=>a?a.code==="EINVAL"||a.code==="UNKNOWN"?Pr.symlink(s,t,n):n(a):(i.dereference&&(l=Pc.resolve(process.cwd(),l)),Tc.isSrcSubdir(s,l)?n(new Error(`Cannot copy '${s}' to a subdirectory of itself, '${l}'.`)):r.isDirectory()&&Tc.isSrcSubdir(l,s)?n(new Error(`Cannot overwrite '${l}' with '${s}'.`)):$te(s,t,n)));else return Pr.symlink(s,t,n)})}function $te(r,e,t){Pr.unlink(e,i=>i?t(i):Pr.symlink(r,e,t))}yF.exports=Tte});var zb=g((lCe,PF)=>{"use strict";var Bte=Ur().fromCallback;PF.exports={copy:Bte(_F())}});var MF=g((uCe,TF)=>{"use strict";var RF=Ce(),kF=require("path"),Ve=require("assert"),Rc=process.platform==="win32";function IF(r){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach(t=>{r[t]=r[t]||RF[t],t=t+"Sync",r[t]=r[t]||RF[t]}),r.maxBusyTries=r.maxBusyTries||3}function Gb(r,e,t){let i=0;typeof e=="function"&&(t=e,e={}),Ve(r,"rimraf: missing path"),Ve.strictEqual(typeof r,"string","rimraf: path should be a string"),Ve.strictEqual(typeof t,"function","rimraf: callback function required"),Ve(e,"rimraf: invalid options argument provided"),Ve.strictEqual(typeof e,"object","rimraf: options should be object"),IF(e),FF(r,e,function n(o){if(o){if((o.code==="EBUSY"||o.code==="ENOTEMPTY"||o.code==="EPERM")&&i<e.maxBusyTries){i++;let s=i*100;return setTimeout(()=>FF(r,e,n),s)}o.code==="ENOENT"&&(o=null)}t(o)})}function FF(r,e,t){Ve(r),Ve(e),Ve(typeof t=="function"),e.lstat(r,(i,n)=>{if(i&&i.code==="ENOENT")return t(null);if(i&&i.code==="EPERM"&&Rc)return AF(r,e,i,t);if(n&&n.isDirectory())return oh(r,e,i,t);e.unlink(r,o=>{if(o){if(o.code==="ENOENT")return t(null);if(o.code==="EPERM")return Rc?AF(r,e,o,t):oh(r,e,o,t);if(o.code==="EISDIR")return oh(r,e,o,t)}return t(o)})})}function AF(r,e,t,i){Ve(r),Ve(e),Ve(typeof i=="function"),e.chmod(r,438,n=>{n?i(n.code==="ENOENT"?null:t):e.stat(r,(o,s)=>{o?i(o.code==="ENOENT"?null:t):s.isDirectory()?oh(r,e,t,i):e.unlink(r,i)})})}function OF(r,e,t){let i;Ve(r),Ve(e);try{e.chmodSync(r,438)}catch(n){if(n.code==="ENOENT")return;throw t}try{i=
`,finalEOL:t=!0,replacer:i=null,spaces:n}={}){let o=t?e:"";return JSON.stringify(r,i,n).replace(/\n/g,e)+o}function pre(r){return Buffer.isBuffer(r)&&(r=r.toString("utf8")),r.replace(/^\uFEFF/,"")}vA.exports={stringify:fre,stripBom:pre}});var xA=g((wCe,yA)=>{var Ja;try{Ja=Ce()}catch(r){Ja=require("fs")}var fh=gA(),{stringify:bA,stripBom:wA}=ch();async function dre(r,e={}){typeof e=="string"&&(e={encoding:e});let t=e.fs||Ja,i="throws"in e?e.throws:!0,n=await fh.fromCallback(t.readFile)(r,e);n=wA(n);let o;try{o=JSON.parse(n,e?e.reviver:null)}catch(s){if(i)throw s.message=`${r}: ${s.message}`,s;return null}return o}var hre=fh.fromPromise(dre);function mre(r,e={}){typeof e=="string"&&(e={encoding:e});let t=e.fs||Ja,i="throws"in e?e.throws:!0;try{let n=t.readFileSync(r,e);return n=wA(n),JSON.parse(n,e.reviver)}catch(n){if(i)throw n.message=`${r}: ${n.message}`,n;return null}}async function gre(r,e,t={}){let i=t.fs||Ja,n=bA(e,t);await fh.fromCallback(i.writeFile)(r,n,t)}var vre=fh.fromPromise(gre);function yre(r,e,t={}){let i=t.fs||Ja,n=bA(e,t);return i.writeFileSync(r,n,t)}var bre={readFile:hre,readFileSync:mre,writeFile:vre,writeFileSync:yre};yA.exports=bre});var SA=g((xCe,DA)=>{"use strict";var ph=xA();DA.exports={readJson:ph.readFile,readJsonSync:ph.readFileSync,writeJson:ph.writeFile,writeJsonSync:ph.writeFileSync}});var dh=g((DCe,EA)=>{"use strict";var wre=Ur().fromCallback,Fc=Ce(),CA=require("path"),_A=qi(),xre=Do().pathExists;function Dre(r,e,t,i){typeof t=="function"&&(i=t,t="utf8");let n=CA.dirname(r);xre(n,(o,s)=>{if(o)return i(o);if(s)return Fc.writeFile(r,e,t,i);_A.mkdirs(n,a=>{if(a)return i(a);Fc.writeFile(r,e,t,i)})})}function Sre(r,...e){let t=CA.dirname(r);if(Fc.existsSync(t))return Fc.writeFileSync(r,...e);_A.mkdirsSync(t),Fc.writeFileSync(r,...e)}EA.exports={outputFile:wre(Dre),outputFileSync:Sre}});var TA=g((SCe,PA)=>{"use strict";var{stringify:Ere}=ch(),{outputFile:Cre}=dh();async function _re(r,e,t={}){let i=Ere(e,t);await Cre(r,i,t)}PA.exports=_re});var kA=g((ECe,RA)=>{"use strict";var{stringify:Pre}=ch(),{outputFileSync:Tre}=dh();function Rre(r,e,t){let i=Pre(e,t);Tre(r,i,t)}RA.exports=Rre});var FA=g((CCe,IA)=>{"use strict";var kre=Ur().fromPromise,vr=SA();vr.outputJson=kre(TA());vr.outputJsonSync=kA();vr.outputJSON=vr.outputJson;vr.outputJSONSync=vr.outputJsonSync;vr.writeJSON=vr.writeJson;vr.writeJSONSync=vr.writeJsonSync;vr.readJSON=vr.readJson;vr.readJSONSync=vr.readJsonSync;IA.exports=vr});var qA=g((_Ce,AA)=>{"use strict";var OA=Ce(),Ire=require("path"),Fre=Wb().copySync,LA=kc().removeSync,Are=qi().mkdirpSync,MA=Ec();function Lre(r,e,t){t=t||{};let i=t.overwrite||t.clobber||!1,{srcStat:n}=MA.checkPathsSync(r,e,"move");return MA.checkParentPathsSync(r,n,e,"move"),Are(Ire.dirname(e)),Ore(r,e,i)}function Ore(r,e,t){if(t)return LA(e),NA(r,e,t);if(OA.existsSync(e))throw new Error("dest already exists.");return NA(r,e,t)}function NA(r,e,t){try{OA.renameSync(r,e)}catch(i){if(i.code!=="EXDEV")throw i;return Mre(r,e,t)}}function Mre(r,e,t){return Fre(r,e,{overwrite:t,errorOnExist:!0}),LA(r)}AA.exports=Lre});var BA=g((PCe,$A)=>{"use strict";$A.exports={moveSync:qA()}});var zA=g((TCe,jA)=>{"use strict";var Nre=Ce(),qre=require("path"),$re=zb().copy,UA=kc().remove,Bre=qi().mkdirp,jre=Do().pathExists,WA=Ec();function Wre(r,e,t,i){typeof t=="function"&&(i=t,t={});let n=t.overwrite||t.clobber||!1;WA.checkPaths(r,e,"move",(o,s)=>{if(o)return i(o);let{srcStat:a}=s;WA.checkParentPaths(r,a,e,"move",l=>{if(l)return i(l);Bre(qre.dirname(e),u=>u?i(u):Ure(r,e,n,i))})})}function Ure(r,e,t,i){if(t)return UA(e,n=>n?i(n):HA(r,e,t,i));jre(e,(n,o)=>n?i(n):o?i(new Error("dest already exists.")):HA(r,e,t,i))}function HA(r,e,t,i){Nre.rename(r,e,n=>n?n.code!=="EXDEV"?i(n):Hre(r,e,t,i):i())}function Hre(r,e,t,i){$re(r,e,{overwrite:t,errorOnExist:!0},o=>o?i(o):UA(r,i))}jA.exports=Wre});var VA=g((RCe,GA)=>{"use strict";var zre=Ur().fromCallback;GA.exports={move:zre(zA())}});var $i=g((kCe,Kb)=>{"use strict";Kb.exports={...Sc(),...Wb(),...zb(),...GF(),...mA(),...FA(),...qi(),...BA(),...VA(),...dh(),...Do(),...kc()};var KA=require("fs"
`}debug(e,...t){ML!="debug"||this.stream==null||this.stream.write(this.getText("debug",e,t))}info(e,...t){this.stream!=null&&this.stream.write(this.getText("info",e,t))}error(e,...t){this.stream!=null&&this.stream.write(this.getText("error",e,t))}trace(e,...t){ML!="trace"||this.stream==null||this.stream.write(this.getText("trace",e,t))}};function moe(r){return new qL(r)}ll.createLogger=moe});var Iw=g(kw=>{"use strict";Object.defineProperty(kw,"__esModule",{value:!0});var goe=require("events"),voe=zc(),$L=process.env.NODE_CLIENT_LOG_LEVEL=="debug",Gc=voe.createLogger("transport"),BL=class extends goe.EventEmitter{constructor(e){super();this.logger=e,this.pauseLevel=0,this.paused=new Map}debug(e,...t){!$L||Gc.debug(e,...t)}info(e,...t){Gc.info(e,...t)}debugMessage(e){if(!$L)return;let t=e[0];t==0?Gc.debug("receive request:",e.slice(1)):t==1||(t==2?Gc.debug("receive notification:",e.slice(1)):Gc.debug("unknown message:",e))}pauseNotification(){this.pauseLevel=this.pauseLevel+1,this.paused.set(this.pauseLevel,[])}cancelNotification(){let{pauseLevel:e}=this;e>0&&(this.paused.delete(e),this.pauseLevel=e-1)}resumeNotification(e=!1){let{pauseLevel:t}=this;if(t==0)return e?null:Promise.resolve([null,null]);let i=Error().stack;this.pauseLevel=t-1;let n=this.paused.get(t);return this.paused.delete(t),n&&n.length?new Promise((o,s)=>{if(!e)return this.request("nvim_call_atomic",[n],(a,l)=>{if(a){let u=new Error(`call_atomic error: ${a[1]}`);return u.stack=i,s(u)}if(Array.isArray(l)&&l[1]!=null){let[u,c,f]=l[1],[p,d]=n[u];this.logger.error(`request error ${c} on "${p}"`,d,f,i)}o(l)});this.notify("nvim_call_atomic",[n]),o()}):e?null:Promise.resolve([[],void 0])}};kw.default=BL});var WL=g(vi=>{"use strict";var yoe=vi&&vi.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),boe=vi&&vi.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),woe=vi&&vi.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&yoe(e,r,t);return boe(e,r),e},jL=vi&&vi.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(vi,"__esModule",{value:!0});vi.NvimTransport=void 0;var $n=woe(TL()),xoe=jL(kL()),Doe=LL(),Soe=jL(Iw()),UL=class extends Soe.default{constructor(e){super(e);this.pending=new Map,this.nextRequestId=1,this.attached=!1;let t=this.setupCodec();this.encodeStream=$n.createEncodeStream({codec:t}),this.decodeStream=$n.createDecodeStream({codec:t}),this.decodeStream.on("data",i=>{this.parseMessage(i)}),this.decodeStream.on("end",()=>{this.detach(),this.emit("detach")})}parseMessage(e){let t=e[0];if(this.debugMessage(e),t===0)this.emit("request",e[2].toString(),e[3],this.createResponse(e[1]));else if(t===1){let i=e[1],n=this.pending.get(i);if(n){this.pending.delete(i);let o=e[2];o&&o.length!=2&&(o=[0,o instanceof Error?o.message:o]),n(o,e[3])}}else t===2?this.emit("notification",e[1].toString(),e[2]):console.error(`Invalid message type ${t}`)}setupCodec(){let e=$n.createCodec();return Doe.Metadata.forEach(({constructor:t},i)=>{e.addExtPacker(i,t,n=>$n.encode(n.data)),e.addExtUnpacker(i,n=>new t({transport:this,client:this.client,data:$n.decode(n)}))}),this.codec=e,this.codec}attach(e,t,i){this.encodeStream=this.encodeStream.pipe(e);let n=new xoe.default;t.pipe(n).pipe(this.decodeStream),this.writer=e,this.reader=t,this.client=i,this.attached=!0}detach(){!this.attached||(this.attached=!1,this.encodeStream.unpipe(this.writer),this.reader.unpipe(this.decodeStream))}request(e,t,i){if(!this.attached)return;let n=this.nextRequestId;this.nextRequestId=this.nextRequestId+1;let o=Date.now();this.debug("request to nvim:",n,e,t),this.encodeStream.write($n.encode([0,n,e,t],{codec:this.codec}));let s=Error().stack,a=setTimeout(()=>{this.debug(`request to vim blocked more than 1s: ${e}`,t,s)},1e3);this.pending.set(n,(l,u)=>{clearTi
`)}catch(t){ul.error("Send error:",e)}}redraw(e=!1){this.send(["redraw",e?"force":""])}commmand(e){this.send(["ex",e])}expr(e){this.send(["expr",e])}call(e,t,i){if(!i){this.send(["call",e,t]);return}this.send(["call",e,t,i])}dispose(){this.removeAllListeners()}};Vc.default=zL});var KL=g(Fw=>{"use strict";Object.defineProperty(Fw,"__esModule",{value:!0});var Poe=zc(),Toe=Poe.createLogger("request"),Roe=process.env.NODE_CLIENT_LOG_LEVEL=="debug",koe=process.env.COC_NVIM=="1"?"coc#api#call":"nvim#api#call",VL=class{constructor(e,t,i){this.connection=e,this.cb=t,this.id=i}request(e,t=[]){this.method=e,this.args=t,this.connection.call(koe,[e.slice(5),t],this.id)}callback(e,t,i){let{method:n,cb:o}=this;if(Roe&&t&&Toe.debug(`request ${this.method} error:`,t,this.args),t)return o([0,t.toString()]);switch(n){case"nvim_list_wins":case"nvim_tabpage_list_wins":return o(null,i.map(s=>e.createWindow(s)));case"nvim_tabpage_get_win":case"nvim_get_current_win":case"nvim_open_win":return o(null,e.createWindow(i));case"nvim_list_bufs":return o(null,i.map(s=>e.createBuffer(s)));case"nvim_win_get_buf":case"nvim_create_buf":case"nvim_get_current_buf":return o(null,e.createBuffer(i));case"nvim_list_tabpages":return o(null,i.map(s=>e.createTabpage(s)));case"nvim_get_current_tabpage":return o(null,e.createTabpage(i));default:return o(null,i)}}};Fw.default=VL});var YL=g(cl=>{"use strict";var Aw=cl&&cl.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(cl,"__esModule",{value:!0});cl.VimTransport=void 0;var Ioe=Aw(Iw()),Foe=Aw(GL()),Aoe=Aw(KL()),JL=class extends Ioe.default{constructor(e){super(e);this.pending=new Map,this.nextRequestId=-1,this.attached=!1,this.notifyMethod=process.env.COC_NVIM=="1"?"coc#api#notify":"nvim#api#notify"}attach(e,t,i){let n=this.connection=new Foe.default(t,e);this.attached=!0,this.client=i,n.on("request",(o,s)=>{let[a,l]=s;this.emit("request",a,l,this.createResponse(o))}),n.on("notification",o=>{let[s,a]=o;this.emit("notification",s.toString(),a)}),n.on("response",(o,s)=>{let a=this.pending.get(o);if(a){this.pending.delete(o);let l=null,u=null;Array.isArray(s)?(l=s[0],u=s[1]):l=s,a.callback(this.client,l,u)}})}send(e){this.connection.send(e)}detach(){!this.attached||(this.attached=!1,this.connection.dispose())}request(e,t,i){if(!this.attached)return i([0,"transport disconnected"]);let n=this.nextRequestId;this.nextRequestId=this.nextRequestId-1;let o=Date.now();this.debug("request to vim:",n,e,t);let s=setTimeout(()=>{this.debug("request to vim cost more than 1s",e,t)},1e3),a=new Aoe.default(this.connection,(l,u)=>{clearTimeout(s),this.debug("response from vim cost:",n,`${Date.now()-o}ms`),i(l,u)},n);this.pending.set(n,a),a.request(e,t)}notify(e,t){if(!!this.attached){if(this.pauseLevel!=0){let i=this.paused.get(this.pauseLevel);if(i){i.push([e,t]);return}}this.connection.call(this.notifyMethod,[e.slice(5),t])}}createResponse(e){let t=!1,{connection:i}=this,n=Date.now(),o=setTimeout(()=>{this.debug("request to client cost more than 1s",e)},1e3);return{send:(s,a)=>{if(clearTimeout(o),t||!this.attached)return;t=!0;let l=null;a&&(l=typeof s=="string"?s:s.toString()),this.debug("response of client cost:",e,`${Date.now()-n}ms`),i.response(e,[l,a?null:s])}}}};cl.VimTransport=JL});var ZL=g(Mh=>{"use strict";Object.defineProperty(Mh,"__esModule",{value:!0});Mh.Neovim=void 0;var Ooe=jc(),Loe=Uc(),Moe=Hc(),Noe=Wc(),qoe=process.env.VIM_NODE_RPC=="1",XL=class extends Ooe.BaseApi{constructor(){super(...arguments);this.prefix="nvim_",this.Buffer=Loe.Buffer,this.Window=Noe.Window,this.Tabpage=Moe.Tabpage}getArgs(e){return e?Array.isArray(e)?e:[e]:[]}get apiInfo(){return this.request(`${this.prefix}get_api_info`)}get buffers(){return this.request(`${this.prefix}list_bufs`)}get buffer(){return this.request(`${this.prefix}get_current_buf`)}async setBuffer(e){await this.request(`${this.prefix}set_current_buf`,[e])}get chans(){return this.request(`${this.prefix}list_chans`)}getChanInfo(e){return this.request(`${this.prefix}get_chan_info`,[e])}createNamespace(e=""){return this.request(`${this.prefix}
`)}errWrite(e){this.notify(`${this.prefix}err_write`,[e])}errWriteLine(e){this.notify(`${this.prefix}err_writeln`,[e])}get uis(){return this.request(`${this.prefix}list_uis`)}uiAttach(e,t,i){return this.request(`${this.prefix}ui_attach`,[e,t,i])}uiDetach(){return this.request(`${this.prefix}ui_detach`,[])}uiTryResize(e,t){return this.request(`${this.prefix}ui_try_resize`,[e,t])}uiSetOption(e,t){return this.request(`${this.prefix}ui_set_option`,[e,t])}subscribe(e){return this.request(`${this.prefix}subscribe`,[e])}unsubscribe(e){return this.request(`${this.prefix}unsubscribe`,[e])}setClientInfo(e,t,i,n,o){this.notify(`${this.prefix}set_client_info`,[e,t,i,n,o])}async quit(){this.command("qa!",!0),this.transport&&this.transport.detach()}};Mh.Neovim=XL});var Nh=g(fl=>{"use strict";Object.defineProperty(fl,"__esModule",{value:!0});fl.NeovimClient=fl.AsyncResponse=void 0;var $oe=WL(),Boe=YL(),joe=ZL(),Uoe=Uc(),Woe=Wc(),Hoe=Hc(),zoe=zc(),QL=zoe.createLogger("client"),Goe=process.env.VIM_NODE_RPC=="1",Ow=class{constructor(e,t){this.requestId=e,this.cb=t,this.finished=!1}finish(e,t){if(!this.finished){if(this.finished=!0,e){this.cb(new Error(e));return}this.cb(null,t)}}};fl.AsyncResponse=Ow;var eM=class extends joe.Neovim{constructor(e){super({});this.logger=e,this.requestId=1,this.responses=new Map,this.attachedBuffers=new Map,Object.defineProperty(this,"client",{value:this});let t=Goe?new Boe.VimTransport(e):new $oe.NvimTransport(e);this.setTransport(t),this.transportAttached=!1,this.handleRequest=this.handleRequest.bind(this),this.handleNotification=this.handleNotification.bind(this)}logError(e,...t){!this.logger||this.logger.error(e,...t)}createBuffer(e){return new Uoe.Buffer({transport:this.transport,data:e,client:this})}createWindow(e){return new Woe.Window({transport:this.transport,data:e,client:this})}createTabpage(e){return new Hoe.Tabpage({transport:this.transport,data:e,client:this})}send(e){this.transport.send(e)}attach({reader:e,writer:t},i=!0){this.transport.attach(t,e,this),this.transportAttached=!0,this.setupTransport(i)}detach(){this.transport.detach(),this.transportAttached=!1}get isApiReady(){return this.transportAttached&&typeof this._channelId!="undefined"}get channelId(){return this._isReady.then(()=>this._channelId)}isAttached(e){return this.attachedBuffers.has(e)}handleRequest(e,t,i){this.emit("request",e,t,i)}sendAsyncRequest(e,t){let i=this.requestId;return this.requestId=i+1,this.notify("nvim_call_function",["coc#rpc#async_request",[i,e,t||[]]]),new Promise((n,o)=>{let s=new Ow(i,(a,l)=>{if(a)return o(a);n(l)});this.responses.set(i,s)})}emitNotification(e,t){if(e.endsWith("_event")){if(e.startsWith("nvim_buf_")){let i=e.replace(/nvim_buf_(.*)_event/,"$1"),{id:n}=t[0];if(!this.attachedBuffers.has(n))return;(this.attachedBuffers.get(n).get(i)||[]).forEach(a=>a(...t)),i==="detach"&&this.attachedBuffers.delete(n);return}if(e.startsWith("nvim_async_request")){let[i,n,o]=t;this.handleRequest(n,o,{send:(s,a)=>{this.notify("nvim_call_function",["coc#rpc#async_response",[i,s,a]])}})}if(e.startsWith("nvim_async_response")){let[i,n,o]=t,s=this.responses.get(i);if(!s){console.error(`Response not found for request ${i}`);return}this.responses.delete(i),s.finish(n,o);return}}else this.emit("notification",e,t)}handleNotification(e,t){this.emitNotification(e,t)}setupTransport(e=!0){if(!this.transportAttached)throw new Error("Not attached to input/output");this.transport.on("request",this.handleRequest),this.transport.on("notification",this.handleNotification),this.transport.on("detach",()=>{this.emit("disconnect"),this.transport.removeAllListeners("request"),this.transport.removeAllListeners("notification"),this.transport.removeAllListeners("detach")}),e?this._isReady=this.generateApi():(this._channelId=0,this._isReady=Promise.resolve(!0))}requestApi(){return new Promise((e,t)=>{this.transport.request("nvim_get_api_info",[],(i,n)=>{i?t(new Error(Array.isArray(i)?i[1]:i.message||i.toString())):e(n)})})}async generateApi(){let e;try{e=await this.requestApi()}catch(t){console.error("Could not get vim api results"),QL.er
`,"ascii")[0],pse=`\r
`,FM=class{constructor(e="utf8"){this.encoding=e,this.index=0,this.buffer=Buffer.allocUnsafe(Nw)}append(e){var t=e;if(typeof e=="string"){var i=e,n=Buffer.byteLength(i,this.encoding);t=Buffer.allocUnsafe(n),t.write(i,0,n,this.encoding)}if(this.buffer.length-this.index>=t.length)t.copy(this.buffer,this.index,0,t.length);else{var o=(Math.ceil((this.index+t.length)/Nw)+1)*Nw;this.index===0?(this.buffer=Buffer.allocUnsafe(o),t.copy(this.buffer,0,0,t.length)):this.buffer=Buffer.concat([this.buffer.slice(0,this.index),t],o)}this.index+=t.length}tryReadHeaders(){let e,t=0;for(;t+3<this.index&&(this.buffer[t]!==kM||this.buffer[t+1]!==IM||this.buffer[t+2]!==kM||this.buffer[t+3]!==IM);)t++;if(t+3>=this.index)return e;e=Object.create(null),this.buffer.toString("ascii",0,t).split(pse).forEach(o=>{let s=o.indexOf(":");if(s===-1)throw new Error("Message header must separate key and value using :");let a=o.substr(0,s),l=o.substr(s+1).trim();e[a]=l});let n=t+4;return this.buffer=this.buffer.slice(n),this.index=this.index-n,e}tryReadContent(e){if(this.index<e)return null;let t=this.buffer.toString(this.encoding,0,e),i=e;return this.buffer.copy(this.buffer,0,i),this.index=this.index-i,t}get numberOfBytes(){return this.index}},dse;(function(r){function e(t){let i=t;return i&&dl.func(i.listen)&&dl.func(i.dispose)&&dl.func(i.onError)&&dl.func(i.onClose)&&dl.func(i.onPartialMessage)}r.is=e})(dse=To.MessageReader||(To.MessageReader={}));var Bh=class{constructor(){this.errorEmitter=new Mw.Emitter,this.closeEmitter=new Mw.Emitter,this.partialMessageEmitter=new Mw.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e){this.errorEmitter.fire(this.asError(e))}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}get onPartialMessage(){return this.partialMessageEmitter.event}firePartialMessage(e){this.partialMessageEmitter.fire(e)}asError(e){return e instanceof Error?e:new Error(`Reader received error. Reason: ${dl.string(e.message)?e.message:"unknown"}`)}};To.AbstractMessageReader=Bh;var qw=class extends Bh{constructor(e,t="utf8"){super();this.readable=e,this.buffer=new FM(t),this._partialMessageTimeout=1e4}set partialMessageTimeout(e){this._partialMessageTimeout=e}get partialMessageTimeout(){return this._partialMessageTimeout}listen(e){this.nextMessageLength=-1,this.messageToken=0,this.partialMessageTimer=void 0,this.callback=e,this.readable.on("data",t=>{this.onData(t)}),this.readable.on("error",t=>this.fireError(t)),this.readable.on("close",()=>this.fireClose())}onData(e){for(this.buffer.append(e);;){if(this.nextMessageLength===-1){let n=this.buffer.tryReadHeaders();if(!n)return;let o=n["Content-Length"];if(!o)throw new Error("Header must provide a Content-Length property.");let s=parseInt(o);if(isNaN(s))throw new Error("Content-Length value must be a number.");this.nextMessageLength=s}var t=this.buffer.tryReadContent(this.nextMessageLength);if(t===null){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.messageToken++;var i=JSON.parse(t);this.callback(i)}}clearPartialMessageTimer(){this.partialMessageTimer&&(clearTimeout(this.partialMessageTimer),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=setTimeout((e,t)=>{this.partialMessageTimer=void 0,e===this.messageToken&&(this.firePartialMessage({messageToken:e,waitingTime:t}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}};To.StreamMessageReader=qw;var AM=class extends Bh{constructor(e){super();this.process=e;let t=this.process;t.on("error",i=>this.fireError(i)),t.on("close",()=>this.fireClose())}listen(e){this.process.on("message",e)}};To.IPCMessageReader=AM;var OM=class extends qw{constructor(e,t="utf-8"){super(e,t)}};To.SocketMessageReader=OM});var Wh=g(Ro=>{"use strict";Object.defineProperty(Ro,"__esModule",{value:!0});var LM=Yc(),Xc=pl(),MM="Content-Length: ",Uh=`\r
`,hse;(function(r){function e(t){let i=t;return i&&Xc.func(i.dispose)&&Xc.func(i.onClose)&&Xc.func(i.onError)&&Xc.func(i.write)}r.is=e})(hse=Ro.MessageWriter||(Ro.MessageWriter={}));var Zc=class{constructor(){this.errorEmitter=new LM.Emitter,this.closeEmitter=new LM.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e,t,i){this.errorEmitter.fire([this.asError(e),t,i])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(e){return e instanceof Error?e:new Error(`Writer received error. Reason: ${Xc.string(e.message)?e.message:"unknown"}`)}};Ro.AbstractMessageWriter=Zc;var NM=class extends Zc{constructor(e,t="utf8"){super();this.writable=e,this.encoding=t,this.errorCount=0,this.writable.on("error",i=>this.fireError(i)),this.writable.on("close",()=>this.fireClose())}write(e){let t=JSON.stringify(e),i=Buffer.byteLength(t,this.encoding),n=[MM,i.toString(),Uh,Uh];try{this.writable.write(n.join(""),"ascii"),this.writable.write(t,this.encoding),this.errorCount=0}catch(o){this.errorCount++,this.fireError(o,e,this.errorCount)}}};Ro.StreamMessageWriter=NM;var qM=class extends Zc{constructor(e){super();this.process=e,this.errorCount=0,this.queue=[],this.sending=!1;let t=this.process;t.on("error",i=>this.fireError(i)),t.on("close",()=>this.fireClose)}write(e){!this.sending&&this.queue.length===0?this.doWriteMessage(e):this.queue.push(e)}doWriteMessage(e){try{this.process.send&&(this.sending=!0,this.process.send(e,void 0,void 0,t=>{this.sending=!1,t?(this.errorCount++,this.fireError(t,e,this.errorCount)):this.errorCount=0,this.queue.length>0&&this.doWriteMessage(this.queue.shift())}))}catch(t){this.errorCount++,this.fireError(t,e,this.errorCount)}}};Ro.IPCMessageWriter=qM;var $M=class extends Zc{constructor(e,t="utf8"){super();this.socket=e,this.queue=[],this.sending=!1,this.encoding=t,this.errorCount=0,this.socket.on("error",i=>this.fireError(i)),this.socket.on("close",()=>this.fireClose())}dispose(){super.dispose(),this.socket.destroy()}write(e){!this.sending&&this.queue.length===0?this.doWriteMessage(e):this.queue.push(e)}doWriteMessage(e){let t=JSON.stringify(e),i=Buffer.byteLength(t,this.encoding),n=[MM,i.toString(),Uh,Uh];try{this.sending=!0,this.socket.write(n.join(""),"ascii",o=>{o&&this.handleError(o,e);try{this.socket.write(t,this.encoding,s=>{this.sending=!1,s?this.handleError(s,e):this.errorCount=0,this.queue.length>0&&this.doWriteMessage(this.queue.shift())})}catch(s){this.handleError(s,e)}})}catch(o){this.handleError(o,e)}}handleError(e,t){this.errorCount++,this.fireError(e,t,this.errorCount)}};Ro.SocketMessageWriter=$M});var jM=g(Qc=>{"use strict";Object.defineProperty(Qc,"__esModule",{value:!0});var $w=Yc(),mse=pl(),Bw;(function(r){r.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:$w.Event.None}),r.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:$w.Event.None});function e(t){let i=t;return i&&(i===r.None||i===r.Cancelled||mse.boolean(i.isCancellationRequested)&&!!i.onCancellationRequested)}r.is=e})(Bw=Qc.CancellationToken||(Qc.CancellationToken={}));var gse=Object.freeze(function(r,e){let t=setTimeout(r.bind(e),0);return{dispose(){clearTimeout(t)}}}),jw=class{constructor(){this._isCancelled=!1}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?gse:(this._emitter||(this._emitter=new $w.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}},BM=class{get token(){return this._token||(this._token=new jw),this._token}cancel(){this._token?this._token.cancel():this._token=Bw.Cancelled}dispose(){this._token?this._token instanceof jw&&this._token.dispose():this._token=Bw.None}};Qc.CancellationTokenSource=BM});var WM=g(ef=>{"use strict";Object.defineProperty(ef,"__esModule",{value:!0});var dn;(function(r){r.None=0,r.First=1,r.Last=2})(dn=ef.Touch|
${JSON.stringify(T.error,void 0,4)}`):t.error("Received response message without id. No further error information provided.");else{let B=String(T.id),V=m[B];if(Oi(T,V),V){delete m[B];try{if(T.error){let te=T.error;V.reject(new ne.ResponseError(te.code,te.message,te.data))}else if(T.result!==void 0)V.resolve(T.result);else throw new Error("Should never happen.")}catch(te){te.message?t.error(`Response handler '${V.method}' failed with message: ${te.message}`):t.error(`Response handler '${V.method}' failed unexpectedly.`)}}}}function Fa(T){if(We())return;let B,V;if(T.method===of.type.method)V=te=>{let Qe=te.id,si=y[String(Qe)];si&&si.cancel()};else{let te=f[T.method];te&&(V=te.handler,B=te.type)}if(V||c)try{Ct(T),T.params===void 0||B!==void 0&&B.numberOfParams===0?V?V():c(T.method):jt.array(T.params)&&(B===void 0||B.numberOfParams>1)?V?V(...T.params):c(T.method,...T.params):V?V(T.params):c(T.method,T.params)}catch(te){te.message?t.error(`Notification handler '${T.method}' failed with message: ${te.message}`):t.error(`Notification handler '${T.method}' failed unexpectedly.`)}else _.fire(T)}function Aa(T){if(!T){t.error("Received empty message.");return}t.error(`Received message which is neither a response nor a notification message:
${JSON.stringify(T,null,4)}`);let B=T;if(jt.string(B.id)||jt.number(B.id)){let V=String(B.id),te=m[V];te&&te.reject(new Error("The received response has neither a result nor an error property."))}}function Se(T){if(!(v===yt.Off||!w))if(x===ji.Text){let B;v===yt.Verbose&&T.params&&(B=`Params: ${JSON.stringify(T.params,null,4)}
`),w.log(`Sending request '${T.method} - (${T.id})'.`,B)}else Xt("send-request",T)}function ve(T){if(!(v===yt.Off||!w))if(x===ji.Text){let B;v===yt.Verbose&&(T.params?B=`Params: ${JSON.stringify(T.params,null,4)}
`:B=`No parameters provided.
`),w.log(`Sending notification '${T.method}'.`,B)}else Xt("send-notification",T)}function fe(T,B,V){if(!(v===yt.Off||!w))if(x===ji.Text){let te;v===yt.Verbose&&(T.error&&T.error.data?te=`Error data: ${JSON.stringify(T.error.data,null,4)}
`:T.result?te=`Result: ${JSON.stringify(T.result,null,4)}
`:T.error===void 0&&(te=`No result returned.
`)),w.log(`Sending response '${B} - (${T.id})'. Processing request took ${Date.now()-V}ms`,te)}else Xt("send-response",T)}function Ee(T){if(!(v===yt.Off||!w))if(x===ji.Text){let B;v===yt.Verbose&&T.params&&(B=`Params: ${JSON.stringify(T.params,null,4)}
`),w.log(`Received request '${T.method} - (${T.id})'.`,B)}else Xt("receive-request",T)}function Ct(T){if(!(v===yt.Off||!w||T.method===Uw.type.method))if(x===ji.Text){let B;v===yt.Verbose&&(T.params?B=`Params: ${JSON.stringify(T.params,null,4)}
`:B=`No parameters provided.
`),w.log(`Received notification '${T.method}'.`,B)}else Xt("receive-notification",T)}function Oi(T,B){if(!(v===yt.Off||!w))if(x===ji.Text){let V;if(v===yt.Verbose&&(T.error&&T.error.data?V=`Error data: ${JSON.stringify(T.error.data,null,4)}
`:T.result?V=`Result: ${JSON.stringify(T.result,null,4)}
`:T.error===void 0&&(V=`No result returned.
`)),B){let te=T.error?` Request failed: ${T.error.message} (${T.error.code}).`:"";w.log(`Received response '${B.method} - (${T.id})' in ${Date.now()-B.timerStart}ms.${te}`,V)}else w.log(`Received response ${T.id} without active response promise.`,V)}else Xt("receive-response",T)}function Xt(T,B){if(!w||v===yt.Off)return;let V={isLSPMessage:!0,type:T,message:B,timestamp:Date.now()};w.log(V)}function qt(){if(Pe())throw new Ws(Gh.Closed,"Connection is closed.");if(We())throw new Ws(Gh.Disposed,"Connection is disposed.")}function Py(){if(ae())throw new Ws(Gh.AlreadyListening,"Connection is already listening")}function Sd(){if(!ae())throw new Error("Call listen() first.")}function Oa(T){return T===void 0?null:T}function MP(T,B){let V,te=T.numberOfParams;switch(te){case 0:V=null;break;case 1:V=Oa(B[0]);break;default:V=[];for(let Qe=0;Qe<B.length&&Qe<te;Qe++)V.push(Oa(B[Qe]));if(B.length<te)for(let Qe=B.length;Qe<te;Qe++)V.push(null);break}return V}let La={sendNotification:(T,...B)=>{qt();let V,te;if(jt.string(T))switch(V=T,B.length){case 0:te=null;break;case 1:te=B[0];break;default:te=B;break}else V=T.method,te=MP(T,B);let Qe={jsonrpc:a,method:V,params:te};ve(Qe),e.write(Qe)},onNotification:(T,B)=>{qt(),jt.func(T)?c=T:B&&(jt.string(T)?f[T]={type:void 0,handler:B}:f[T.method]={type:T,handler:B})},onProgress:(T,B,V)=>{if(p.has(B))throw new Error(`Progress handler for token ${B} already registered`);return p.set(B,V),{dispose:()=>{p.delete(B)}}},sendProgress:(T,B,V)=>{La.sendNotification(zh.type,{token:B,value:V})},onUnhandledProgress:O.event,sendRequest:(T,...B)=>{qt(),Sd();let V,te,Qe;if(jt.string(T))switch(V=T,B.length){case 0:te=null;break;case 1:hl.CancellationToken.is(B[0])?(te=null,Qe=B[0]):te=Oa(B[0]);break;default:let _t=B.length-1;hl.CancellationToken.is(B[_t])?(Qe=B[_t],B.length===2?te=Oa(B[0]):te=B.slice(0,_t).map(tt=>Oa(tt))):te=B.map(tt=>Oa(tt));break}else{V=T.method,te=MP(T,B);let _t=T.numberOfParams;Qe=hl.CancellationToken.is(B[_t])?B[_t]:void 0}let si=n++,ln=new Promise((_t,tt)=>{let hr={jsonrpc:a,id:si,method:V,params:te},rt={method:V,timerStart:Date.now(),resolve:_t,reject:tt};Se(hr);try{e.write(hr)}catch(Zt){rt.reject(new ne.ResponseError(ne.ErrorCodes.MessageWriteError,Zt.message?Zt.message:"Unknown reason")),rt=null}rt&&(m[String(si)]=rt)});return Qe&&Qe.onCancellationRequested(()=>{La.sendNotification(of.type,{id:si})}),ln},onRequest:(T,B)=>{qt(),jt.func(T)?l=T:B&&(jt.string(T)?u[T]={type:void 0,handler:B}:u[T.method]={type:T,handler:B})},trace:(T,B,V)=>{let te=!1,Qe=ji.Text;V!==void 0&&(jt.boolean(V)?te=V:(te=V.sendNotification||!1,Qe=V.traceFormat||ji.Text)),v=T,x=Qe,v===yt.Off?w=void 0:w=B,te&&!Pe()&&!We()&&La.sendNotification(tN.type,{value:yt.toString(T)})},onError:P.event,onClose:k.event,onUnhandledNotification:_.event,onDispose:I.event,dispose:()=>{if(We())return;E=Ui.Disposed,I.fire(void 0);let T=new Error("Connection got disposed.");Object.keys(m).forEach(B=>{m[B].reject(T)}),m=Object.create(null),y=Object.create(null),h=new QM.LinkedMap,jt.func(e.dispose)&&e.dispose(),jt.func(r.dispose)&&r.dispose()},listen:()=>{qt(),Py(),E=Ui.Listening,r.listen(Cy)},inspect:()=>{console.log("inspect")}};return La.onNotification(Uw.type,T=>{v===yt.Off||!w||w.log(T.message,v===yt.Verbose?T.verbose:void 0)}),La.onNotification(zh.type,T=>{let B=p.get(T.token);B?B(T.value):O.fire(T)}),La}function Pse(r){return r.listen!==void 0&&r.read===void 0}function Tse(r){return r.write!==void 0&&r.end===void 0}function Rse(r,e,t,i){t||(t=Q.NullLogger);let n=Pse(r)?r:new rf.StreamMessageReader(r),o=Tse(e)?e:new nf.StreamMessageWriter(e);return _se(n,o,t,i)}Q.createMessageConnection=Rse});var jn=g(kse=>{fo(kse,{CodeAction:()=>hx,CodeActionContext:()=>dx,CodeActionKind:()=>px,CodeLens:()=>mx,Color:()=>Kh,ColorInformation:()=>Hw,ColorPresentation:()=>zw,Command:()=>ml,CompletionItem:()=>tx,CompletionItemKind:()=>Zw,CompletionItemTag:()=>ex,CompletionList:()=>rx,CreateFile:()=>uf,DeleteFile:()=>ff,Diagnostic:()=>sf,DiagnosticRelatedInformation:()=>Jh,DiagnosticSeverity:()=>Kw,DiagnosticTag:()=>Jw,DocumentHighlight:()=>ax,DocumentHig
`,`\r
`,"\r"],bx;(function(r){function e(o,s,a,l){return new Ase(o,s,a,l)}r.create=e;function t(o){var s=o;return!!(N.defined(s)&&N.string(s.uri)&&(N.undefined(s.languageId)||N.string(s.languageId))&&N.number(s.lineCount)&&N.func(s.getText)&&N.func(s.positionAt)&&N.func(s.offsetAt))}r.is=t;function i(o,s){for(var a=o.getText(),l=n(s,function(h,m){var y=h.range.start.line-m.range.start.line;return y===0?h.range.start.character-m.range.start.character:y}),u=a.length,c=l.length-1;c>=0;c--){var f=l[c],p=o.offsetAt(f.range.start),d=o.offsetAt(f.range.end);if(d<=u)a=a.substring(0,p)+f.newText+a.substring(d,a.length);else throw new Error("Overlapping edit");u=p}return a}r.applyEdits=i;function n(o,s){if(o.length<=1)return o;var a=o.length/2|0,l=o.slice(0,a),u=o.slice(a);n(l,s),n(u,s);for(var c=0,f=0,p=0;c<l.length&&f<u.length;){var d=s(l[c],u[f]);d<=0?o[p++]=l[c++]:o[p++]=u[f++]}for(;c<l.length;)o[p++]=l[c++];for(;f<u.length;)o[p++]=u[f++];return o}})(bx||(bx={}));var Ase=function(){function r(e,t,i,n){this._uri=e,this._languageId=t,this._version=i,this._content=n,this._lineOffsets=void 0}return Object.defineProperty(r.prototype,"uri",{get:function(){return this._uri},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"languageId",{get:function(){return this._languageId},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"version",{get:function(){return this._version},enumerable:!0,configurable:!0}),r.prototype.getText=function(e){if(e){var t=this.offsetAt(e.start),i=this.offsetAt(e.end);return this._content.substring(t,i)}return this._content},r.prototype.update=function(e,t){this._content=e.text,this._version=t,this._lineOffsets=void 0},r.prototype.getLineOffsets=function(){if(this._lineOffsets===void 0){for(var e=[],t=this._content,i=!0,n=0;n<t.length;n++){i&&(e.push(n),i=!1);var o=t.charAt(n);i=o==="\r"||o===`
`,o==="\r"&&n+1<t.length&&t.charAt(n+1)===`
`&&n++}i&&t.length>0&&e.push(t.length),this._lineOffsets=e}return this._lineOffsets},r.prototype.positionAt=function(e){e=Math.max(Math.min(e,this._content.length),0);var t=this.getLineOffsets(),i=0,n=t.length;if(n===0)return Wi.create(0,e);for(;i<n;){var o=Math.floor((i+n)/2);t[o]>e?n=o:i=o+1}var s=i-1;return Wi.create(s,e-t[s])},r.prototype.offsetAt=function(e){var t=this.getLineOffsets();if(e.line>=t.length)return this._content.length;if(e.line<0)return 0;var i=t[e.line],n=e.line+1<t.length?t[e.line+1]:this._content.length;return Math.max(Math.min(i+e.character,n),i)},Object.defineProperty(r.prototype,"lineCount",{get:function(){return this.getLineOffsets().length},enumerable:!0,configurable:!0}),r}(),N;(function(r){var e=Object.prototype.toString;function t(c){return typeof c!="undefined"}r.defined=t;function i(c){return typeof c=="undefined"}r.undefined=i;function n(c){return c===!0||c===!1}r.boolean=n;function o(c){return e.call(c)==="[object String]"}r.string=o;function s(c){return e.call(c)==="[object Number]"}r.number=s;function a(c){return e.call(c)==="[object Function]"}r.func=a;function l(c){return c!==null&&typeof c=="object"}r.objectLiteral=l;function u(c,f){return Array.isArray(c)&&c.every(f)}r.typedArray=u})(N||(N={}))});var nN=g(Hi=>{"use strict";Object.defineProperty(Hi,"__esModule",{value:!0});function Ose(r){return r===!0||r===!1}Hi.boolean=Ose;function rN(r){return typeof r=="string"||r instanceof String}Hi.string=rN;function Lse(r){return typeof r=="number"||r instanceof Number}Hi.number=Lse;function Mse(r){return r instanceof Error}Hi.error=Mse;function Nse(r){return typeof r=="function"}Hi.func=Nse;function iN(r){return Array.isArray(r)}Hi.array=iN;function qse(r){return iN(r)&&r.every(e=>rN(e))}Hi.stringArray=qse;function $se(r,e){return Array.isArray(r)&&r.every(e)}Hi.typedArray=$se;function Bse(r){return r!==null&&typeof r=="object"}Hi.objectLiteral=Bse});var zr=g(vl=>{"use strict";Object.defineProperty(vl,"__esModule",{value:!0});var Qh=bi(),oN=class extends Qh.RequestType0{constructor(e){super(e)}};vl.ProtocolRequestType0=oN;var sN=class extends Qh.RequestType{constructor(e){super(e)}};vl.ProtocolRequestType=sN;var aN=class extends Qh.NotificationType{constructor(e){super(e)}};vl.ProtocolNotificationType=aN;var lN=class extends Qh.NotificationType0{constructor(e){super(e)}};vl.ProtocolNotificationType0=lN});var uN=g(em=>{"use strict";Object.defineProperty(em,"__esModule",{value:!0});var jse=bi(),Use=zr(),Wse;(function(r){r.method="textDocument/implementation",r.type=new Use.ProtocolRequestType(r.method),r.resultType=new jse.ProgressType})(Wse=em.ImplementationRequest||(em.ImplementationRequest={}))});var cN=g(tm=>{"use strict";Object.defineProperty(tm,"__esModule",{value:!0});var Hse=bi(),zse=zr(),Gse;(function(r){r.method="textDocument/typeDefinition",r.type=new zse.ProtocolRequestType(r.method),r.resultType=new Hse.ProgressType})(Gse=tm.TypeDefinitionRequest||(tm.TypeDefinitionRequest={}))});var pN=g(yl=>{"use strict";Object.defineProperty(yl,"__esModule",{value:!0});var fN=zr(),Vse;(function(r){r.type=new fN.ProtocolRequestType0("workspace/workspaceFolders")})(Vse=yl.WorkspaceFoldersRequest||(yl.WorkspaceFoldersRequest={}));var Kse;(function(r){r.type=new fN.ProtocolNotificationType("workspace/didChangeWorkspaceFolders")})(Kse=yl.DidChangeWorkspaceFoldersNotification||(yl.DidChangeWorkspaceFoldersNotification={}))});var dN=g(rm=>{"use strict";Object.defineProperty(rm,"__esModule",{value:!0});var Jse=zr(),Yse;(function(r){r.type=new Jse.ProtocolRequestType("workspace/configuration")})(Yse=rm.ConfigurationRequest||(rm.ConfigurationRequest={}))});var mN=g(bl=>{"use strict";Object.defineProperty(bl,"__esModule",{value:!0});var Xse=bi(),hN=zr(),Zse;(function(r){r.method="textDocument/documentColor",r.type=new hN.ProtocolRequestType(r.method),r.resultType=new Xse.ProgressType})(Zse=bl.DocumentColorRequest||(bl.DocumentColorRequest={}));var Qse;(function(r){r.type=new hN.ProtocolRequestType("textDocument/colorPresentation")})(Qse=bl.ColorPresentationRequest||(bl.ColorPresentationRequest={}))});v
`).map(n=>{let o=n.match(/^\s+/);if(o===null)return n;let[s]=o;return s.length>=i.length?n.slice(i.length):n}).join(`
`)}r$.exports=class{constructor(e){this.options=e||Sfe}space(e){let t=this.rules.block.newline.exec(e);if(t)return t[0].length>1?{type:"space",raw:t[0]}:{raw:`
`}}code(e,t){let i=this.rules.block.code.exec(e);if(i){let n=t[t.length-1];if(n&&n.type==="paragraph")return{raw:i[0],text:i[0].trimRight()};let o=i[0].replace(/^ {4}/gm,"");return{type:"code",raw:i[0],codeBlockStyle:"indented",text:this.options.pedantic?o:Efe(o,`
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let i=t[0],n=_fe(i,t[3]||"");return{type:"code",raw:i,lang:t[2]?t[2].trim():t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[1].length,text:t[2]}}nptable(e){let t=this.rules.block.nptable.exec(e);if(t){let i={type:"table",header:Em(t[1].replace(/^ *| *\| *$/g,"")),align:t[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:t[3]?t[3].replace(/\n$/,"").split(`
`):[],raw:t[0]};if(i.header.length===i.align.length){let n=i.align.length,o;for(o=0;o<n;o++)/^ *-+: *$/.test(i.align[o])?i.align[o]="right":/^ *:-+: *$/.test(i.align[o])?i.align[o]="center":/^ *:-+ *$/.test(i.align[o])?i.align[o]="left":i.align[o]=null;for(n=i.cells.length,o=0;o<n;o++)i.cells[o]=Em(i.cells[o],i.header.length);return i}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let i=t[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:t[0],text:i}}}list(e){let t=this.rules.block.list.exec(e);if(t){let i=t[0],n=t[2],o=n.length>1,s={type:"list",raw:i,ordered:o,start:o?+n.slice(0,-1):"",loose:!1,items:[]},a=t[0].match(this.rules.block.item),l=!1,u,c,f,p,d,h,m,y,v=a.length;f=this.rules.block.listItemStart.exec(a[0]);for(let x=0;x<v;x++){if(u=a[x],i=u,x!==v-1){if(p=this.rules.block.listItemStart.exec(a[x+1]),p[1].length>f[0].length||p[1].length>3){a.splice(x,2,a[x]+`
`+a[x+1]),x--,v--;continue}else(!this.options.pedantic||this.options.smartLists?p[2][p[2].length-1]!==n[n.length-1]:o===(p[2].length===1))&&(d=a.slice(x+1).join(`
`),s.raw=s.raw.substring(0,s.raw.length-d.length),x=v-1);f=p}c=u.length,u=u.replace(/^ *([*+-]|\d+[.)]) ?/,""),~u.indexOf(`
`)&&(c-=u.length,u=this.options.pedantic?u.replace(/^ {1,4}/gm,""):u.replace(new RegExp("^ {1,"+c+"}","gm"),"")),h=l||/\n\n(?!\s*$)/.test(u),x!==v-1&&(l=u.charAt(u.length-1)===`
`,h||(h=l)),h&&(s.loose=!0),this.options.gfm&&(m=/^\[[ xX]\] /.test(u),y=void 0,m&&(y=u[1]!==" ",u=u.replace(/^\[[ xX]\] +/,""))),s.items.push({type:"list_item",raw:i,task:m,checked:y,loose:h,text:u})}return s}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:this.options.sanitize?"paragraph":"html",raw:t[0],pre:!this.options.sanitizer&&(t[1]==="pre"||t[1]==="script"||t[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(t[0]):Si(t[0]):t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t)return t[3]&&(t[3]=t[3].substring(1,t[3].length-1)),{tag:t[1].toLowerCase().replace(/\s+/g," "),raw:t[0],href:t[2],title:t[3]}}table(e){let t=this.rules.block.table.exec(e);if(t){let i={type:"table",header:Em(t[1].replace(/^ *| *\| *$/g,"")),align:t[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:t[3]?t[3].replace(/\n$/,"").split(`
`):[]};if(i.header.length===i.align.length){i.raw=t[0];let n=i.align.length,o;for(o=0;o<n;o++)/^ *-+: *$/.test(i.align[o])?i.align[o]="right":/^ *:-+: *$/.test(i.align[o])?i.align[o]="center":/^ *:-+ *$/.test(i.align[o])?i.align[o]="left":i.align[o]=null;for(n=i.cells.length,o=0;o<n;o++)i.cells[o]=Em(i.cells[o].replace(/^ *\| *| *\| *$/g,""),i.header.length);return i}}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1]}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t)return{type:"paragraph",raw:t[0],text:t[1].charAt(t[1].length-1)===`
`?t[1].slice(0,-1):t[1]}}text(e,t){let i=this.rules.block.text.exec(e);if(i){let n=t[t.length-1];return n&&n.type==="text"?{raw:i[0],text:i[0]}:{type:"text",raw:i[0],text:i[0]}}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:Si(t[1])}}tag(e,t,i){let n=this.rules.inline.tag.exec(e);if(n)return!t&&/^<a /i.test(n[0])?t=!0:t&&/^<\/a>/i.test(n[0])&&(t=!1),!i&&/^<(pre|code|kbd|script)(\s|>)/i.test(n[0])?i=!0:i&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(n[0])&&(i=!1),{type:this.options.sanitize?"text":"html",raw:n[0],inLink:t,inRawBlock:i,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(n[0]):Si(n[0]):n[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let i=Cfe(t[2],"()");if(i>-1){let l=(t[0].indexOf("!")===0?5:4)+t[1].length+i;t[2]=t[2].substring(0,i),t[0]=t[0].substring(0,l).trim(),t[3]=""}let n=t[2],o="";if(this.options.pedantic){let a=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(n);a?(n=a[1],o=a[3]):o=""}else o=t[3]?t[3].slice(1,-1):"";return n=n.trim().replace(/^<([\s\S]*)>$/,"$1"),i$(t,{href:n&&n.replace(this.rules.inline._escapes,"$1"),title:o&&o.replace(this.rules.inline._escapes,"$1")},t[0])}}reflink(e,t){let i;if((i=this.rules.inline.reflink.exec(e))||(i=this.rules.inline.nolink.exec(e))){let n=(i[2]||i[1]).replace(/\s+/g," ");if(n=t[n.toLowerCase()],!n||!n.href){let s=i[0].charAt(0);return{type:"text",raw:s,text:s}}return i$(i,n,i[0])}}strong(e,t,i=""){let n=this.rules.inline.strong.start.exec(e);if(n&&(!n[1]||n[1]&&(i===""||this.rules.inline.punctuation.exec(i)))){t=t.slice(-1*e.length);let o=n[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;o.lastIndex=0;let s;for(;(n=o.exec(t))!=null;)if(s=this.rules.inline.strong.middle.exec(t.slice(0,n.index+3)),s)return{type:"strong",raw:e.slice(0,s[0].length),text:e.slice(2,s[0].length-2)}}}em(e,t,i=""){let n=this.rules.inline.em.start.exec(e);if(n&&(!n[1]||n[1]&&(i===""||this.rules.inline.punctuation.exec(i)))){t=t.slice(-1*e.length);let o=n[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;o.lastIndex=0;let s;for(;(n=o.exec(t))!=null;)if(s=this.rules.inline.em.middle.exec(t.slice(0,n.index+2)),s)return{type:"em",raw:e.slice(0,s[0].length),text:e.slice(1,s[0].length-1)}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let i=t[2].replace(/\n/g," "),n=/[^ ]/.test(i),o=i.startsWith(" ")&&i.endsWith(" ");return n&&o&&(i=i.substring(1,i.length-1)),i=Si(i,!0),{type:"codespan",raw:t[0],text:i}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2]}}autolink(e,t){let i=this.rules.inline.autolink.exec(e);if(i){let n,o;return i[2]==="@"?(n=Si(this.options.mangle?t(i[1]):i[1]),o="mailto:"+n):(n=Si(i[1]),o=n),{type:"link",raw:i[0],text:n,href:o,tokens:[{type:"text",raw:n,text:n}]}}}url(e,t){let i;if(i=this.rules.inline.url.exec(e)){let n,o;if(i[2]==="@")n=Si(this.options.mangle?t(i[0]):i[0]),o="mailto:"+n;else{let s;do s=i[0],i[0]=this.rules.inline._backpedal.exec(i[0])[0];while(s!==i[0]);n=Si(i[0]),i[1]==="www."?o="http://"+n:o=n}return{type:"link",raw:i[0],text:n,href:o,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e,t,i){let n=this.rules.inline.text.exec(e);if(n){let o;return t?o=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(n[0]):Si(n[0]):n[0]:o=Si(this.options.smartypants?i(n[0]):n[0]),{type:"text",raw:n[0],text:o}}}}});var o$=g((pTe,n$)=>{var{noopTest:Tf,edit:Te,merge:Ks}=Vs(),se={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?! {0,3}bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>
]`).replace("lheading",se.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var H={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Tf,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation_\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation*\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation_\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation*\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:Tf,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\s*punctuation])/};H._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~";H.punctuation=Te(H.punctuation).replace(/punctuation/g,H._punctuation).getRegex();H._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>";H._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*";H._comment=Te(se._comment).replace("(?:-->|$)","-->").getRegex();H.em.start=Te(H.em.start).replace(/punctuation/g,H._punctuation).getRegex();H.em.middle=Te(H.em.middle).replace(/punctuation/g,H._punctuation).replace(/overlapSkip/g,H._overlapSkip).getRegex();H.em.endAst=Te(H.em.endAst,"g").replace(/punctuation/g,H._punctuation).getRegex();H.em.endUnd=Te(H.em.endUnd,"g").replace(/punctuation/g,H._punctuation).getRegex();H.strong.start=Te(H.strong.start).replace(/punctuation/g,H._punctuation).getRegex();H.strong.middle=Te(H.strong.middle).replace(/punctuation/g,H._punctuation).replace(/overlapSkip/g,H._overlapSkip).getRegex();H.strong.endAst=Te(H.strong.endAst,"g").replace(/punctuation/g,H._punctuation).getRegex();H.strong.endUnd=Te(H.strong.endUnd,"g").replace(/punctuation/g,H._punctuation).getRegex();H.blockSkip=Te(H._blockSkip,"g").getRegex();H.overlapSkip=Te(H._overlapSkip,"g").getRegex();H._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;H._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;H._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;H.autolink=Te(H.autolink).replace("scheme",H._scheme).replace("email",H._email).getRegex();H._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;H.tag=Te(H.tag).replace("comment",H._comment).replace("attribute",H._attribute).getRegex();H._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;H._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/;H._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;H.link=Te(H.link).replace("label",H._label).replace("href",H._href).replace("title",H._title).getRegex();H.reflink=Te(H.reflink).replace("label",H._label).getRegex();H.reflinkSearch=Te(H.reflinkSearch,"g").replace("reflink",H.reflink).replace("nolink",H.nolink).getRegex();H.normal=Ks({},H);H.pedantic=Ks({},H.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!
`).replace(/\t/g," "),this.blockTokens(e,this.tokens,!0),this.inline(this.tokens),this.tokens}blockTokens(e,t=[],i=!0){e=e.replace(/^ +$/gm,"");let n,o,s,a;for(;e;){if(n=this.tokenizer.space(e)){e=e.substring(n.raw.length),n.type&&t.push(n);continue}if(n=this.tokenizer.code(e,t)){e=e.substring(n.raw.length),n.type?t.push(n):(a=t[t.length-1],a.raw+=`
`+n.raw,a.text+=`
`+n.text);continue}if(n=this.tokenizer.fences(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.heading(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.nptable(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.hr(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.blockquote(e)){e=e.substring(n.raw.length),n.tokens=this.blockTokens(n.text,[],i),t.push(n);continue}if(n=this.tokenizer.list(e)){for(e=e.substring(n.raw.length),s=n.items.length,o=0;o<s;o++)n.items[o].tokens=this.blockTokens(n.items[o].text,[],!1);t.push(n);continue}if(n=this.tokenizer.html(e)){e=e.substring(n.raw.length),t.push(n);continue}if(i&&(n=this.tokenizer.def(e))){e=e.substring(n.raw.length),this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title});continue}if(n=this.tokenizer.table(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.lheading(e)){e=e.substring(n.raw.length),t.push(n);continue}if(i&&(n=this.tokenizer.paragraph(e))){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.text(e,t)){e=e.substring(n.raw.length),n.type?t.push(n):(a=t[t.length-1],a.raw+=`
`+n.raw,a.text+=`
`+n.text);continue}if(e){let l="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(l);break}else throw new Error(l)}}return t}inline(e){let t,i,n,o,s,a,l=e.length;for(t=0;t<l;t++)switch(a=e[t],a.type){case"paragraph":case"text":case"heading":{a.tokens=[],this.inlineTokens(a.text,a.tokens);break}case"table":{for(a.tokens={header:[],cells:[]},o=a.header.length,i=0;i<o;i++)a.tokens.header[i]=[],this.inlineTokens(a.header[i],a.tokens.header[i]);for(o=a.cells.length,i=0;i<o;i++)for(s=a.cells[i],a.tokens.cells[i]=[],n=0;n<s.length;n++)a.tokens.cells[i][n]=[],this.inlineTokens(s[n],a.tokens.cells[i][n]);break}case"blockquote":{this.inline(a.tokens);break}case"list":{for(o=a.items.length,i=0;i<o;i++)this.inline(a.items[i].tokens);break}default:}return e}inlineTokens(e,t=[],i=!1,n=!1){let o,s=e,a,l,u;if(this.tokens.links){let c=Object.keys(this.tokens.links);if(c.length>0)for(;(a=this.tokenizer.rules.inline.reflinkSearch.exec(s))!=null;)c.includes(a[0].slice(a[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,a.index)+"["+a$("a",a[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(a=this.tokenizer.rules.inline.blockSkip.exec(s))!=null;)s=s.slice(0,a.index)+"["+a$("a",a[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;e;){if(l||(u=""),l=!1,o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e,i,n)){e=e.substring(o.raw.length),i=o.inLink,n=o.inRawBlock,t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),o.type==="link"&&(o.tokens=this.inlineTokens(o.text,[],!0,n)),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length),o.type==="link"&&(o.tokens=this.inlineTokens(o.text,[],!0,n)),t.push(o);continue}if(o=this.tokenizer.strong(e,s,u)){e=e.substring(o.raw.length),o.tokens=this.inlineTokens(o.text,[],i,n),t.push(o);continue}if(o=this.tokenizer.em(e,s,u)){e=e.substring(o.raw.length),o.tokens=this.inlineTokens(o.text,[],i,n),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e)){e=e.substring(o.raw.length),o.tokens=this.inlineTokens(o.text,[],i,n),t.push(o);continue}if(o=this.tokenizer.autolink(e,l$)){e=e.substring(o.raw.length),t.push(o);continue}if(!i&&(o=this.tokenizer.url(e,l$))){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.inlineText(e,n,Rfe)){e=e.substring(o.raw.length),u=o.raw.slice(-1),l=!0,t.push(o);continue}if(e){let c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return t}}});var Vx=g((mTe,c$)=>{var{defaults:kfe}=kl(),{cleanUrl:f$,escape:_m}=Vs();c$.exports=class{constructor(e){this.options=e||kfe}code(e,t,i){let n=(t||"").match(/\S*/)[0];if(this.options.highlight){let o=this.options.highlight(e,n);o!=null&&o!==e&&(i=!0,e=o)}return n?'<pre><code class="'+this.options.langPrefix+_m(n,!0)+'">'+(i?e:_m(e,!0))+`</code></pre>
`:"<pre><code>"+(i?e:_m(e,!0))+`</code></pre>
`}blockquote(e){return`<blockquote>
`+e+`</blockquote>
`}html(e){return e}heading(e,t,i,n){return this.options.headerIds?"<h"+t+' id="'+this.options.headerPrefix+n.slug(i)+'">'+e+"</h"+t+`>
`:"<h"+t+">"+e+"</h"+t+`>
`}hr(){return this.options.xhtml?`<hr/>
`:`<hr>
`}list(e,t,i){let n=t?"ol":"ul",o=t&&i!==1?' start="'+i+'"':"";return"<"+n+o+`>
`+e+"</"+n+`>
`}listitem(e){return"<li>"+e+`</li>
`}checkbox(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "}paragraph(e){return"<p>"+e+`</p>
`}table(e,t){return t&&(t="<tbody>"+t+"</tbody>"),`<table>
<thead>
`+e+`</thead>
`+t+`</table>
`}tablerow(e){return`<tr>
`+e+`</tr>
`}tablecell(e,t){let i=t.header?"th":"td";return(t.align?"<"+i+' align="'+t.align+'">':"<"+i+">")+e+"</"+i+`>
`}strong(e){return"<strong>"+e+"</strong>"}em(e){return"<em>"+e+"</em>"}codespan(e){return"<code>"+e+"</code>"}br(){return this.options.xhtml?"<br/>":"<br>"}del(e){return"<del>"+e+"</del>"}link(e,t,i){if(e=f$(this.options.sanitize,this.options.baseUrl,e),e===null)return i;let n='<a href="'+_m(e)+'"';return t&&(n+=' title="'+t+'"'),n+=">"+i+"</a>",n}image(e,t,i){if(e=f$(this.options.sanitize,this.options.baseUrl,e),e===null)return i;let n='<img src="'+e+'" alt="'+i+'"';return t&&(n+=' title="'+t+'"'),n+=this.options.xhtml?"/>":">",n}text(e){return e}}});var Kx=g((vTe,p$)=>{p$.exports=class{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,t,i){return""+i}image(e,t,i){return""+i}br(){return""}}});var Jx=g((bTe,d$)=>{d$.exports=class{constructor(){this.seen={}}serialize(e){return e.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")}getNextSafeSlug(e,t){let i=e,n=0;if(this.seen.hasOwnProperty(i)){n=this.seen[e];do n++,i=e+"-"+n;while(this.seen.hasOwnProperty(i))}return t||(this.seen[e]=n,this.seen[i]=0),i}slug(e,t={}){let i=this.serialize(e);return this.getNextSafeSlug(i,t.dryrun)}}});var m$=g((wTe,h$)=>{var Ife=Vx(),Ffe=Kx(),Afe=Jx(),{defaults:Ofe}=kl(),{unescape:Lfe}=Vs();h$.exports=class Yx{constructor(e){this.options=e||Ofe,this.options.renderer=this.options.renderer||new Ife,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ffe,this.slugger=new Afe}static parse(e,t){return new Yx(t).parse(e)}static parseInline(e,t){return new Yx(t).parseInline(e)}parse(e,t=!0){let i="",n,o,s,a,l,u,c,f,p,d,h,m,y,v,x,w,E,P,k=e.length;for(n=0;n<k;n++)switch(d=e[n],d.type){case"space":continue;case"hr":{i+=this.renderer.hr();continue}case"heading":{i+=this.renderer.heading(this.parseInline(d.tokens),d.depth,Lfe(this.parseInline(d.tokens,this.textRenderer)),this.slugger);continue}case"code":{i+=this.renderer.code(d.text,d.lang,d.escaped);continue}case"table":{for(f="",c="",a=d.header.length,o=0;o<a;o++)c+=this.renderer.tablecell(this.parseInline(d.tokens.header[o]),{header:!0,align:d.align[o]});for(f+=this.renderer.tablerow(c),p="",a=d.cells.length,o=0;o<a;o++){for(u=d.tokens.cells[o],c="",l=u.length,s=0;s<l;s++)c+=this.renderer.tablecell(this.parseInline(u[s]),{header:!1,align:d.align[s]});p+=this.renderer.tablerow(c)}i+=this.renderer.table(f,p);continue}case"blockquote":{p=this.parse(d.tokens),i+=this.renderer.blockquote(p);continue}case"list":{for(h=d.ordered,m=d.start,y=d.loose,a=d.items.length,p="",o=0;o<a;o++)x=d.items[o],w=x.checked,E=x.task,v="",x.task&&(P=this.renderer.checkbox(w),y?x.tokens.length>0&&x.tokens[0].type==="text"?(x.tokens[0].text=P+" "+x.tokens[0].text,x.tokens[0].tokens&&x.tokens[0].tokens.length>0&&x.tokens[0].tokens[0].type==="text"&&(x.tokens[0].tokens[0].text=P+" "+x.tokens[0].tokens[0].text)):x.tokens.unshift({type:"text",text:P}):v+=P),v+=this.parse(x.tokens,y),p+=this.renderer.listitem(v,E,w);i+=this.renderer.list(p,h,m);continue}case"html":{i+=this.renderer.html(d.text);continue}case"paragraph":{i+=this.renderer.paragraph(this.parseInline(d.tokens));continue}case"text":{for(p=d.tokens?this.parseInline(d.tokens):d.text;n+1<k&&e[n+1].type==="text";)d=e[++n],p+=`
`+(d.tokens?this.parseInline(d.tokens):d.text);i+=t?this.renderer.paragraph(p):p;continue}default:{let _='Token with "'+d.type+'" type was not found.';if(this.options.silent){console.error(_);return}else throw new Error(_)}}return i}parseInline(e,t){t=t||this.renderer;let i="",n,o,s=e.length;for(n=0;n<s;n++)switch(o=e[n],o.type){case"escape":{i+=t.text(o.text);break}case"html":{i+=t.html(o.text);break}case"link":{i+=t.link(o.href,o.title,this.parseInline(o.tokens,t));break}case"image":{i+=t.image(o.href,o.title,o.text);break}case"strong":{i+=t.strong(this.parseInline(o.tokens,t));break}case"em":{i+=t.em(this.parseInline(o.tokens,t));break}case"codespan":{i+=t.codespan(o.text);break}case"br":{i+=t.br();break}case"del":{i+=t.del(this.parseInline(o.tokens,t));break}case"text":{i+=t.text(o.text);break}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent){console.error(a);return}else throw new Error(a)}}return i}}});var x$=g((xTe,g$)=>{var kf=u$(),If=m$(),v$=zx(),y$=Vx(),Mfe=Kx(),Nfe=Jx(),{merge:Pm,checkSanitizeDeprecation:b$,escape:w$}=Vs(),{getDefaults:qfe,changeDefaults:$fe,defaults:Bfe}=kl();function Re(r,e,t){if(typeof r=="undefined"||r===null)throw new Error("marked(): input parameter is undefined or null");if(typeof r!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected");if(typeof e=="function"&&(t=e,e=null),e=Pm({},Re.defaults,e||{}),b$(e),t){let i=e.highlight,n;try{n=kf.lex(r,e)}catch(a){return t(a)}let o=function(a){let l;if(!a)try{l=If.parse(n,e)}catch(u){a=u}return e.highlight=i,a?t(a):t(null,l)};if(!i||i.length<3||(delete e.highlight,!n.length))return o();let s=0;Re.walkTokens(n,function(a){a.type==="code"&&(s++,setTimeout(()=>{i(a.text,a.lang,function(l,u){if(l)return o(l);u!=null&&u!==a.text&&(a.text=u,a.escaped=!0),s--,s===0&&o()})},0))}),s===0&&o();return}try{let i=kf.lex(r,e);return e.walkTokens&&Re.walkTokens(i,e.walkTokens),If.parse(i,e)}catch(i){if(i.message+=`
Please report this to https://github.com/markedjs/marked.`,e.silent)return"<p>An error occurred:</p><pre>"+w$(i.message+"",!0)+"</pre>";throw i}}Re.options=Re.setOptions=function(r){return Pm(Re.defaults,r),$fe(Re.defaults),Re};Re.getDefaults=qfe;Re.defaults=Bfe;Re.use=function(r){let e=Pm({},r);if(r.renderer){let t=Re.defaults.renderer||new y$;for(let i in r.renderer){let n=t[i];t[i]=(...o)=>{let s=r.renderer[i].apply(t,o);return s===!1&&(s=n.apply(t,o)),s}}e.renderer=t}if(r.tokenizer){let t=Re.defaults.tokenizer||new v$;for(let i in r.tokenizer){let n=t[i];t[i]=(...o)=>{let s=r.tokenizer[i].apply(t,o);return s===!1&&(s=n.apply(t,o)),s}}e.tokenizer=t}if(r.walkTokens){let t=Re.defaults.walkTokens;e.walkTokens=i=>{r.walkTokens(i),t&&t(i)}}Re.setOptions(e)};Re.walkTokens=function(r,e){for(let t of r)switch(e(t),t.type){case"table":{for(let i of t.tokens.header)Re.walkTokens(i,e);for(let i of t.tokens.cells)for(let n of i)Re.walkTokens(n,e);break}case"list":{Re.walkTokens(t.items,e);break}default:t.tokens&&Re.walkTokens(t.tokens,e)}};Re.parseInline=function(r,e){if(typeof r=="undefined"||r===null)throw new Error("marked.parseInline(): input parameter is undefined or null");if(typeof r!="string")throw new Error("marked.parseInline(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected");e=Pm({},Re.defaults,e||{}),b$(e);try{let t=kf.lexInline(r,e);return e.walkTokens&&Re.walkTokens(t,e.walkTokens),If.parseInline(t,e)}catch(t){if(t.message+=`
Please report this to https://github.com/markedjs/marked.`,e.silent)return"<p>An error occurred:</p><pre>"+w$(t.message+"",!0)+"</pre>";throw t}};Re.Parser=If;Re.parser=If.parse;Re.Renderer=y$;Re.TextRenderer=Mfe;Re.Lexer=kf;Re.lexer=kf.lex;Re.Tokenizer=v$;Re.Slugger=Nfe;Re.parse=Re;g$.exports=Re});var S$=g((DTe,D$)=>{"use strict";var jfe=/[|\\{}()[\]^$+*?.]/g;D$.exports=function(r){if(typeof r!="string")throw new TypeError("Expected a string");return r.replace(jfe,"\\$&")}});var C$=g((STe,E$)=>{"use strict";E$.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var Zx=g((ETe,_$)=>{var Js=C$(),P$={};for(var Xx in Js)Js.hasOwnProperty(Xx)&&(P$[Js[Xx]]=Xx);var ee=_$.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"}
`],["r","\r"],["t"," "],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e",""],["a","\x07"]]);function U$(r){return r[0]==="u"&&r.length===5||r[0]==="x"&&r.length===3?String.fromCharCode(parseInt(r.slice(1),16)):npe.get(r)||r}function ope(r,e){let t=[],i=e.trim().split(/\s*,\s*/g),n;for(let o of i)if(!isNaN(o))t.push(Number(o));else if(n=o.match(rpe))t.push(n[2].replace(ipe,(s,a,l)=>a?U$(a):l));else throw new Error(`Invalid Chalk template style argument: ${o} (in style '${r}')`);return t}function spe(r){j$.lastIndex=0;let e=[],t;for(;(t=j$.exec(r))!==null;){let i=t[1];if(t[2]){let n=ope(i,t[2]);e.push([i].concat(n))}else e.push([i])}return e}function W$(r,e){let t={};for(let n of e)for(let o of n.styles)t[o[0]]=n.inverse?null:o.slice(1);let i=r;for(let n of Object.keys(t))if(Array.isArray(t[n])){if(!(n in i))throw new Error(`Unknown Chalk style: ${n}`);t[n].length>0?i=i[n].apply(i,t[n]):i=i[n]}return i}B$.exports=(r,e)=>{let t=[],i=[],n=[];if(e.replace(tpe,(o,s,a,l,u,c)=>{if(s)n.push(U$(s));else if(l){let f=n.join("");n=[],i.push(t.length===0?f:W$(r,t)(f)),t.push({inverse:a,styles:spe(l)})}else if(u){if(t.length===0)throw new Error("Found extraneous } in Chalk template literal");i.push(W$(r,t)(n.join(""))),n=[],t.pop()}else n.push(c)}),i.push(n.join("")),t.length>0){let o=`Chalk template literal is missing ${t.length} closing bracket${t.length===1?"":"s"} (\`}\`)`;throw new Error(o)}return i.join("")}});var J$=g((ITe,Ff)=>{"use strict";var tD=S$(),xt=L$(),rD=$$().stdout,ape=H$(),z$=process.platform==="win32"&&!(process.env.TERM||"").toLowerCase().startsWith("xterm"),G$=["ansi","ansi","ansi256","ansi16m"],V$=new Set(["gray"]),Ol=Object.create(null);function K$(r,e){e=e||{};let t=rD?rD.level:0;r.level=e.level===void 0?t:e.level,r.enabled="enabled"in e?e.enabled:r.level>0}function Af(r){if(!this||!(this instanceof Af)||this.template){let e={};return K$(e,r),e.template=function(){let t=[].slice.call(arguments);return lpe.apply(null,[e.template].concat(t))},Object.setPrototypeOf(e,Af.prototype),Object.setPrototypeOf(e.template,e),e.template.constructor=Af,e.template}K$(this,r)}z$&&(xt.blue.open="");for(let r of Object.keys(xt))xt[r].closeRe=new RegExp(tD(xt[r].close),"g"),Ol[r]={get(){let e=xt[r];return Fm.call(this,this._styles?this._styles.concat(e):[e],this._empty,r)}};Ol.visible={get(){return Fm.call(this,this._styles||[],!0,"visible")}};xt.color.closeRe=new RegExp(tD(xt.color.close),"g");for(let r of Object.keys(xt.color.ansi))V$.has(r)||(Ol[r]={get(){let e=this.level;return function(){let i={open:xt.color[G$[e]][r].apply(null,arguments),close:xt.color.close,closeRe:xt.color.closeRe};return Fm.call(this,this._styles?this._styles.concat(i):[i],this._empty,r)}}});xt.bgColor.closeRe=new RegExp(tD(xt.bgColor.close),"g");for(let r of Object.keys(xt.bgColor.ansi)){if(V$.has(r))continue;let e="bg"+r[0].toUpperCase()+r.slice(1);Ol[e]={get(){let t=this.level;return function(){let n={open:xt.bgColor[G$[t]][r].apply(null,arguments),close:xt.bgColor.close,closeRe:xt.bgColor.closeRe};return Fm.call(this,this._styles?this._styles.concat(n):[n],this._empty,r)}}}}var upe=Object.defineProperties(()=>{},Ol);function Fm(r,e,t){let i=function(){return cpe.apply(i,arguments)};i._styles=r,i._empty=e;let n=this;return Object.defineProperty(i,"level",{enumerable:!0,get(){return n.level},set(o){n.level=o}}),Object.defineProperty(i,"enabled",{enumerable:!0,get(){return n.enabled},set(o){n.enabled=o}}),i.hasGrey=this.hasGrey||t==="gray"||t==="grey",i.__proto__=upe,i}function cpe(){let r=arguments,e=r.length,t=String(arguments[0]);if(e===0)return"";if(e>1)for(let n=1;n<e;n++)t+=" "+r[n];if(!this.enabled||this.level<=0||!t)return this._empty?"":t;let i=xt.dim.open;z$&&this.hasGrey&&(xt.dim.open="");for(let n of this._styles.slice().reverse())t=n.open+t.replace(n.closeRe,n.open)+n.close,t=t.replace(/\r?\n/g,`${n.close}$&${n.open}`);return xt.dim.open=i,t}function lpe(r,e){if(!Array.isArray(e))return[].slice.call(arguments,1).join(" ");let t=[].slice.call(arguments,2),i=[e.raw[0]];for(let n=1;n<e.length;n++)i.push(String(t[n-1]).repla
`);return i.reduce(function(n,o){var s=mpe(o);return s>n?s:n},0)}});var lB=g((qTe,aB)=>{aB.exports={name:"cli-table",description:"Pretty unicode tables for the CLI",version:"0.3.4",license:"MIT",author:"Guillermo Rauch <guillermo@learnboost.com>",contributors:["Sonny Michaud <michaud.sonny@gmail.com> (http://github.com/sonnym)","Gabriel Sambarino <gabriel.sambarino@gmail.com> (http://github.com/chrean)"],repository:{type:"git",url:"https://github.com/Automattic/cli-table.git"},keywords:["cli","colors","table"],dependencies:{chalk:"^2.4.1","string-width":"^4.2.0"},devDependencies:{"@babel/core":"^7.12.9","@babel/preset-env":"^7.12.7","@babel/preset-typescript":"^7.12.7","babel-jest":"^26.6.3",expect:"^26.6.2",expresso:"~0.9",jest:"^26.6.3","jest-mock":"^26.6.2","publish-please":"^5.5.2","ts-node":"^9.1.0",typescript:"^4.1.2"},main:"lib",files:["lib"],scripts:{test:"jest","publish-please":"publish-please --access public"},engines:{node:">= 10.0.0"}}});var uB=g(($Te,sD)=>{var gpe=J$(),Ys=sB(),aD=Ys.repeat,vpe=Ys.truncate,ype=Ys.pad;function Of(r){this.options=Ys.options({chars:{top:"\u2500","top-mid":"\u252C","top-left":"\u250C","top-right":"\u2510",bottom:"\u2500","bottom-mid":"\u2534","bottom-left":"\u2514","bottom-right":"\u2518",left:"\u2502","left-mid":"\u251C",mid:"\u2500","mid-mid":"\u253C",right:"\u2502","right-mid":"\u2524",middle:"\u2502"},truncate:"\u2026",colors:!0,colWidths:[],colAligns:[],style:{"padding-left":1,"padding-right":1,head:["red"],border:["white"],compact:!1},head:[]},r)}Of.prototype.__proto__=Array.prototype;Of.prototype.__defineGetter__("width",function(){var r=this.toString().split(`
`);return r.length?r[0].length:0});Of.prototype.render;Of.prototype.toString=function(){var r="",e=this.options,t=e.style,i=e.head,n=e.chars,o=e.truncate,s=e.colWidths||new Array(this.head.length),a=0;if(!i.length&&!this.length)return"";if(!s.length){var l=this.slice(0);i.length&&(l=l.concat([i])),l.forEach(function(v){if(Array.isArray(v)&&v.length)u(v);else{var x=Object.keys(v)[0],w=v[x];s[0]=Math.max(s[0]||0,c(x)||0),Array.isArray(w)&&w.length?u(w,1):s[1]=Math.max(s[1]||0,c(w)||0)}})}a=(s.length==1?s[0]:s.reduce(function(v,x){return v+x}))+s.length+1;function u(v,x){var x=x||0;v.forEach(function(w,E){s[E+x]=Math.max(s[E+x]||0,c(w)||0)})}function c(v){return typeof v=="object"&&v&&v.width!=null?v.width:(typeof v=="object"&&v!==null?Ys.strlen(v.text):Ys.strlen(v))+(t["padding-left"]||0)+(t["padding-right"]||0)}function f(v,x,w,E){var P=0,v=x+aD(v,a-2)+w;return s.forEach(function(k,_){_!=s.length-1&&(P+=k+1,v=v.substr(0,P)+E+v.substr(P+1))}),h(e.style.border,v)}function p(){var v=f(n.top,n["top-left"]||n.top,n["top-right"]||n.top,n["top-mid"]);v&&(r+=v+`
`)}function d(v,x){var w=[],E=0;if(!Array.isArray(v)&&typeof v=="object"){var P=Object.keys(v)[0],k=v[P],_=!0;Array.isArray(k)?(v=k,v.unshift(P)):v=[P,k]}v.forEach(function(L,R){var F=(L==null?"":L).toString().split(`
`).reduce(function(K,ae){return K.push(m(ae,R)),K},[]),q=F.length;q>E&&(E=q),w.push({contents:F,height:q})});var O=new Array(E);w.forEach(function(L,R){L.contents.forEach(function(K,ae){O[ae]||(O[ae]=[]),(x||_&&R===0&&e.style.head)&&(K=h(e.style.head,K)),O[ae].push(K)});for(var F=L.height,q=E;F<q;F++)O[F]||(O[F]=[]),O[F].push(m("",R))});var I="";return O.forEach(function(L,R){I.length>0&&(I+=`
`+h(e.style.border,n.left)),I+=L.join(h(e.style.border,n.middle))+h(e.style.border,n.right)}),h(e.style.border,n.left)+I}function h(v,x){return x?(e.colors&&v.forEach(function(w){x=gpe[w](x)}),x):""}function m(v,x){var v=String(typeof v=="object"&&v.text?v.text:v),w=Ys.strlen(v),E=s[x]-(t["padding-left"]||0)-(t["padding-right"]||0),P=e.colAligns[x]||"left";return aD(" ",t["padding-left"]||0)+(w==E?v:w<E?ype(v,E+(v.length-w)," ",P=="left"?"right":P=="middle"?"both":"left"):o?vpe(v,E,o):v)+aD(" ",t["padding-right"]||0)}i.length&&(p(),r+=d(i,t.head)+`
`),this.length&&this.forEach(function(v,x){if(!i.length&&x==0)p();else if(!t.compact||x<!!i.length?1:v.length==0){var w=f(n.mid,n["left-mid"],n["right-mid"],n["mid-mid"]);w&&(r+=w+`
`)}Array.isArray(v)&&!v.length||(r+=d(v)+`
`)});var y=f(n.bottom,n["bottom-left"]||n.bottom,n["bottom-right"]||n.bottom,n["bottom-mid"]);return y?r+=y:r=r.slice(0,-1),r};sD.exports=Of;sD.exports.version=lB().version});var hB=g((BTe,cB)=>{"use strict";var fB=10,pB=(r=0)=>e=>`[${38+r};5;${e}m`,dB=(r=0)=>(e,t,i)=>`[${38+r};2;${e};${t};${i}m`;function bpe(){let r=new Map,e={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};e.color.gray=e.color.blackBright,e.bgColor.bgGray=e.bgColor.bgBlackBright,e.color.grey=e.color.blackBright,e.bgColor.bgGrey=e.bgColor.bgBlackBright;for(let[t,i]of Object.entries(e)){for(let[n,o]of Object.entries(i))e[n]={open:`[${o[0]}m`,close:`[${o[1]}m`},i[n]=e[n],r.set(o[0],o[1]);Object.defineProperty(e,t,{value:i,enumerable:!1})}return Object.defineProperty(e,"codes",{value:r,enumerable:!1}),e.color.close="",e.bgColor.close="",e.color.ansi256=pB(),e.color.ansi16m=dB(),e.bgColor.ansi256=pB(fB),e.bgColor.ansi16m=dB(fB),e.rgbToAnsi256=(t,i,n)=>t===i&&i===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(i/255*5)+Math.round(n/255*5),e.hexToRgb=t=>{let i=/(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(t.toString(16));if(!i)return[0,0,0];let{colorString:n}=i.groups;n.length===3&&(n=n.split("").map(s=>s+s).join(""));let o=Number.parseInt(n,16);return[o>>16&255,o>>8&255,o&255]},e.hexToAnsi256=t=>e.rgbToAnsi256(...e.hexToRgb(t)),e}Object.defineProperty(cB,"exports",{enumerable:!0,get:bpe})});var o3=g((ZRe,jm)=>{"use strict";jm.exports=Vpe;jm.exports.format=i3;jm.exports.parse=n3;var Kpe=/\B(?=(\d{3})+(?!\d))/g,Jpe=/(?:\.0*|(\.[^0]+)0+)$/,$o={b:1,kb:1<<10,mb:1<<20,gb:1<<30,tb:Math.pow(1024,4),pb:Math.pow(1024,5)},Ype=/^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i;function Vpe(r,e){return typeof r=="string"?n3(r):typeof r=="number"?i3(r,e):null}function i3(r,e){if(!Number.isFinite(r))return null;var t=Math.abs(r),i=e&&e.thousandsSeparator||"",n=e&&e.unitSeparator||"",o=e&&e.decimalPlaces!==void 0?e.decimalPlaces:2,s=Boolean(e&&e.fixedDecimals),a=e&&e.unit||"";(!a||!$o[a.toLowerCase()])&&(t>=$o.pb?a="PB":t>=$o.tb?a="TB":t>=$o.gb?a="GB":t>=$o.mb?a="MB":t>=$o.kb?a="KB":a="B");var l=r/$o[a.toLowerCase()],u=l.toFixed(o);return s||(u=u.replace(Jpe,"$1")),i&&(u=u.replace(Kpe,i)),u+n+a}function n3(r){if(typeof r=="number"&&!isNaN(r))return r;if(typeof r!="string")return null;var e=Ype.exec(r),t,i="b";return e?(t=parseFloat(e[1]),i=e[4].toLowerCase()):(t=parseInt(r,10),i="b"),Math.floor($o[i]*t)}});var Bl=g((QRe,s3)=>{var vn=-1,Yi=1,Ir=0;function Bf(r,e,t,i){if(r===e)return r?[[Ir,r]]:[];if(t!=null){var n=Zpe(r,e,t);if(n)return n}var o=RD(r,e),s=r.substring(0,o);r=r.substring(o),e=e.substring(o),o=kD(r,e);var a=r.substring(r.length-o);r=r.substring(0,r.length-o),e=e.substring(0,e.length-o);var l=Xpe(r,e);return s&&l.unshift([Ir,s]),a&&l.push([Ir,a]),a3(l,i),l}function Xpe(r,e){var t;if(!r)return[[Yi,e]];if(!e)return[[vn,r]];var i=r.length>e.length?r:e,n=r.length>e.length?e:r,o=i.indexOf(n);if(o!==-1)return t=[[Yi,i.substring(0,o)],[Ir,n],[Yi,i.substring(o+n.length)]],r.length>e.length&&(t[0][0]=t[2][0]=vn),t;if(n.length===1)return[[vn,r],[Yi,e]];var s=ede(r,e);if(s){var a=s[0],l=s[1],u=s[2],c=s[3],f=s[4],p=Bf(a,u),d=Bf(l,c);return p.concat([[Ir,f]],d)}return Qpe(r,e)}function Qpe(r,e){for(var t=r.length,i=e.length,n=Math.ceil((t+i)/2),o=n,s=2*n,a=new Array(s),l=new Array(s),u=0;u<s;u++)a[u]=-1,l[u]=-1;a[o+1]=0,l[o+1]=0;for(var c=t-i,f=c%2!=0,p=0,d=0,h
%s`,P,P,x,i);var k=x.type==="*"?WD:x.type==="?"?UD:"\\"+x.type;n=!0,i=i.slice(0,x.reStart)+k+"\\("+P}h(),o&&(i+="\\\\");var _=!1;switch(i.charAt(0)){case".":case"[":case"(":_=!0}for(var O=a.length-1;O>-1;O--){var I=a[O],L=i.slice(0,I.reStart),R=i.slice(I.reStart,I.reEnd-8),F=i.slice(I.reEnd-8,I.reEnd),q=i.slice(I.reEnd);F+=q;var K=L.split("(").length-1,ae=q;for(m=0;m<K;m++)ae=ae.replace(/\)[+*?]?/,"");q=ae;var Pe="";q===""&&e!==Km&&(Pe="$");var We=L+R+q+Pe+F;i=We}if(i!==""&&n&&(i="(?=.)"+i),_&&(i=p+i),e===Km)return[i,n];if(!n)return Pde(r);var Yt=t.nocase?"i":"";try{var Nt=new RegExp("^"+i+"$",Yt)}catch(dr){return new RegExp("$.")}return Nt._glob=r,Nt._src=i,Nt}Ei.makeRe=function(r,e){return new At(r,e||{}).makeRe()};At.prototype.makeRe=Tde;function Tde(){if(this.regexp||this.regexp===!1)return this.regexp;var r=this.set;if(!r.length)return this.regexp=!1,this.regexp;var e=this.options,t=e.noglobstar?WD:e.dot?wde:xde,i=e.nocase?"i":"",n=r.map(function(o){return o.map(function(s){return s===jD?t:typeof s=="string"?Rde(s):s._src}).join("\\/")}).join("|");n="^(?:"+n+")$",this.negate&&(n="^(?!"+n+").*$");try{this.regexp=new RegExp(n,i)}catch(o){this.regexp=!1}return this.regexp}Ei.match=function(r,e,t){t=t||{};var i=new At(e,t);return r=r.filter(function(n){return i.match(n)}),i.options.nonull&&!r.length&&r.push(e),r};At.prototype.match=kde;function kde(r,e){if(this.debug("match",r,this.pattern),this.comment)return!1;if(this.empty)return r==="";if(r==="/"&&e)return!0;var t=this.options;Vf.sep!=="/"&&(r=r.split(Vf.sep).join("/")),r=r.split(H3),this.debug(this.pattern,"split",r);var i=this.set;this.debug(this.pattern,"set",i);var n,o;for(o=r.length-1;o>=0&&(n=r[o],!n);o--);for(o=0;o<i.length;o++){var s=i[o],a=r;t.matchBase&&s.length===1&&(a=[n]);var l=this.matchOne(a,s,e);if(l)return t.flipNegate?!0:!this.negate}return t.flipNegate?!1:this.negate}At.prototype.matchOne=function(r,e,t){var i=this.options;this.debug("matchOne",{this:this,file:r,pattern:e}),this.debug("matchOne",r.length,e.length);for(var n=0,o=0,s=r.length,a=e.length;n<s&&o<a;n++,o++){this.debug("matchOne loop");var l=e[o],u=r[n];if(this.debug(e,l,u),l===!1)return!1;if(l===jD){this.debug("GLOBSTAR",[e,l,u]);var c=n,f=o+1;if(f===a){for(this.debug("** at the end");n<s;n++)if(r[n]==="."||r[n]===".."||!i.dot&&r[n].charAt(0)===".")return!1;return!0}for(;c<s;){var p=r[c];if(this.debug(`
globstar while`,r,c,e,f,p),this.matchOne(r.slice(c),e.slice(f),t))return this.debug("globstar found match!",c,s,p),!0;if(p==="."||p===".."||!i.dot&&p.charAt(0)==="."){this.debug("dot detected!",r,c,e,f);break}this.debug("globstar swallow a segment, and continue"),c++}return!!(t&&(this.debug(`
>>> no match, partial?`,r,c,e,f),c===s))}var d;if(typeof l=="string"?(i.nocase?d=u.toLowerCase()===l.toLowerCase():d=u===l,this.debug("string match",l,u,d)):(d=u.match(l),this.debug("pattern match",l,u,d)),!d)return!1}if(n===s&&o===a)return!0;if(n===s)return t;if(o===a){var h=n===s-1&&r[n]==="";return h}throw new Error("wtf?")};function Pde(r){return r.replace(/\\(.)/g,"$1")}function Rde(r){return r.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}});var gj=g((sIe,hj)=>{var p0=4294967296,mj=[];for(var ep=0;ep<256;ep++)mj[ep]=(ep>15?"":"0")+ep.toString(16);var tp=hj.exports=function(r,e){r instanceof Buffer?(this.buffer=r,this.offset=e||0):Object.prototype.toString.call(r)=="[object Uint8Array]"?(this.buffer=new Buffer(r),this.offset=e||0):(this.buffer=this.buffer||new Buffer(8),this.offset=0,this.setValue.apply(this,arguments))};tp.MAX_INT=Math.pow(2,53);tp.MIN_INT=-Math.pow(2,53);tp.prototype={constructor:tp,_2scomp:function(){for(var r=this.buffer,e=this.offset,t=1,i=e+7;i>=e;i--){var n=(r[i]^255)+t;r[i]=n&255,t=n>>8}},setValue:function(r,e){var t=!1;if(arguments.length==1)if(typeof r=="number"){if(t=r<0,r=Math.abs(r),e=r%p0,r=r/p0,r>p0)throw new RangeError(r+" is outside Int64 range");r=r|0}else if(typeof r=="string")r=(r+"").replace(/^0x/,""),e=r.substr(-8),r=r.length>8?r.substr(0,r.length-8):"",r=parseInt(r,16),e=parseInt(e,16);else throw new Error(r+" must be a Number or String");for(var i=this.buffer,n=this.offset,o=7;o>=0;o--)i[n+o]=e&255,e=o==4?r:e>>>8;t&&this._2scomp()},toNumber:function(r){for(var e=this.buffer,t=this.offset,i=e[t]&128,n=0,o=1,s=7,a=1;s>=0;s--,a*=256){var l=e[t+s];i&&(l=(l^255)+o,o=l>>8,l=l&255),n+=l*a}return!r&&n>=tp.MAX_INT?i?-Infinity:Infinity:i?-n:n},valueOf:function(){return this.toNumber(!1)},toString:function(r){return this.valueOf().toString(r||10)},toOctetString:function(r){for(var e=new Array(8),t=this.buffer,i=this.offset,n=0;n<8;n++)e[n]=mj[t[i+n]];return e.join(r||"")},toBuffer:function(r){if(r&&this.offset===0)return this.buffer;var e=new Buffer(8);return this.buffer.copy(e,0,this.offset,this.offset+8),e},copy:function(r,e){this.buffer.copy(r,e||0,this.offset,this.offset+8)},compare:function(r){if((this.buffer[this.offset]&128)!=(r.buffer[r.offset]&128))return r.buffer[r.offset]-this.buffer[this.offset];for(var e=0;e<8;e++)if(this.buffer[this.offset+e]!==r.buffer[r.offset+e])return this.buffer[this.offset+e]-r.buffer[r.offset+e];return 0},equals:function(r){return this.compare(r)===0},inspect:function(){return"[Int64 value:"+this+" octets:"+this.toOctetString(" ")+"]"}}});var Pj=g(rp=>{var vj=require("events").EventEmitter,Mde=require("util"),Nde=require("os"),aIe=require("assert"),ip=gj(),Wo=Nde.endianness()=="BE";function yj(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function Ot(r){this.buf=Buffer.alloc(yj(r||8192)),this.readOffset=0,this.writeOffset=0}rp.Accumulator=Ot;Ot.prototype.writeAvail=function(){return this.buf.length-this.writeOffset};Ot.prototype.readAvail=function(){return this.writeOffset-this.readOffset};Ot.prototype.reserve=function(r){if(!(r<this.writeAvail())&&(this.readOffset>0&&(this.buf.copy(this.buf,0,this.readOffset,this.writeOffset),this.writeOffset-=this.readOffset,this.readOffset=0),!(r<this.writeAvail()))){var e=Buffer.alloc(yj(this.buf.length+r-this.writeAvail()));this.buf.copy(e),this.buf=e}};Ot.prototype.append=function(r){if(Buffer.isBuffer(r))this.reserve(r.length),r.copy(this.buf,this.writeOffset,0,r.length),this.writeOffset+=r.length;else{var e=Buffer.byteLength(r);this.reserve(e),this.buf.write(r,this.writeOffset),this.writeOffset+=e}};Ot.prototype.assertReadableSize=function(r){if(this.readAvail()<r)throw new Error("wanted to read "+r+" bytes but only have "+this.readAvail())};Ot.prototype.peekString=function(r){return this.assertReadableSize(r),this.buf.toString("utf-8",this.readOffset,this.readOffset+r)};Ot.prototype.readString=function(r){var e=this.peekString(r);return this.readOffset+=r,e};Ot.prototype.peekInt=function(r){switch(this.assertReadableSize(r),r){case 1:return this.buf.readInt8(this.readOffset,r);case 2:return Wo?this.bu
`:`
`;function rU(r,e){var t=[],i="";typeof e=="string"?e={section:e,whitespace:!1}:(e=e||{},e.whitespace=e.whitespace===!0);var n=e.whitespace?" = ":"=";return Object.keys(r).forEach(function(o,s,a){var l=r[o];l&&Array.isArray(l)?l.forEach(function(u){i+=Yl(o+"[]")+n+Yl(u)+`
`}):l&&typeof l=="object"?t.push(o):i+=Yl(o)+n+Yl(l)+k0}),e.section&&i.length&&(i="["+Yl(e.section)+"]"+k0+i),t.forEach(function(o,s,a){var l=iU(o).join("\\."),u=(e.section?e.section+".":"")+l,c=rU(r[o],{section:u,whitespace:e.whitespace});i.length&&c.length&&(i+=k0),i+=c}),i}function iU(r){return r.replace(/\1/g,"LITERAL\\1LITERAL").replace(/\\\./g,"").split(/\./).map(function(e){return e.replace(/\1/g,"\\.").replace(/\2LITERAL\\1LITERAL\2/g,"")})}function ihe(r){var e={},t=e,i=null,n=/^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i,o=r.split(/[\r\n]+/g);return o.forEach(function(s,a,l){if(!(!s||s.match(/^\s*[;#]/))){var u=s.match(n);if(!!u){if(u[1]!==void 0){i=hg(u[1]),t=e[i]=e[i]||{};return}var c=hg(u[2]),f=u[3]?hg(u[4]):!0;switch(f){case"true":case"false":case"null":f=JSON.parse(f)}c.length>2&&c.slice(-2)==="[]"&&(c=c.substring(0,c.length-2),t[c]?Array.isArray(t[c])||(t[c]=[t[c]]):t[c]=[]),Array.isArray(t[c])?t[c].push(f):t[c]=f}}}),Object.keys(e).filter(function(s,a,l){if(!e[s]||typeof e[s]!="object"||Array.isArray(e[s]))return!1;var u=iU(s),c=e,f=u.pop(),p=f.replace(/\\\./g,".");return u.forEach(function(d,h,m){(!c[d]||typeof c[d]!="object")&&(c[d]={}),c=c[d]}),c===e&&p===f?!1:(c[p]=e[s],!0)}).forEach(function(s,a,l){delete e[s]}),e}function nU(r){return r.charAt(0)==='"'&&r.slice(-1)==='"'||r.charAt(0)==="'"&&r.slice(-1)==="'"}function Yl(r){return typeof r!="string"||r.match(/[=\r\n]/)||r.match(/^\[/)||r.length>1&&nU(r)||r!==r.trim()?JSON.stringify(r):r.replace(/;/g,"\\;").replace(/#/g,"\\#")}function hg(r,e){if(r=(r||"").trim(),nU(r)){r.charAt(0)==="'"&&(r=r.substr(1,r.length-2));try{r=JSON.parse(r)}catch(a){}}else{for(var t=!1,i="",n=0,o=r.length;n<o;n++){var s=r.charAt(n);if(t)"\\;#".indexOf(s)!==-1?i+=s:i+="\\"+s,t=!1;else{if(";#".indexOf(s)!==-1)break;s==="\\"?t=!0:i+=s}}return t&&(i+="\\"),i.trim()}return r}});var lU=g((FAe,sU)=>{"use strict";var I0=1,aU=2;function nhe(){return""}function ohe(r,e,t){return r.slice(e,t).replace(/\S/g," ")}sU.exports=function(r,e){e=e||{};for(var t,i,n=!1,o=!1,s=0,a="",l=e.whitespace===!1?nhe:ohe,u=0;u<r.length;u++){if(t=r[u],i=r[u+1],!o&&t==='"'){var c=r[u-1]==="\\"&&r[u-2]!=="\\";c||(n=!n)}if(!n){if(!o&&t+i==="//")a+=r.slice(s,u),s=u,o=I0,u++;else if(o===I0&&t+i===`\r
`){u++,o=!1,a+=l(r,s,u),s=u;continue}else if(o===I0&&t===`
`)o=!1,a+=l(r,s,u),s=u;else if(!o&&t+i==="/*"){a+=r.slice(s,u),s=u,o=aU,u++;continue}else if(o===aU&&t+i==="*/"){u++,o=!1,a+=l(r,s,u+1),s=u+1;continue}}}return a+(o?l(r.substr(s)):r.substr(s))}});var cU=g(Xl=>{"use strict";var uU=require("fs"),she=oU(),up=require("path"),ahe=lU(),lhe=Xl.parse=function(r){return/^\s*{/.test(r)?JSON.parse(ahe(r)):she.parse(r)},uhe=Xl.file=function(){var r=[].slice.call(arguments).filter(function(n){return n!=null});for(var e in r)if(typeof r[e]!="string")return;var t=up.join.apply(null,r),i;try{return uU.readFileSync(t,"utf-8")}catch(n){return}},AAe=Xl.json=function(){var r=uhe.apply(null,arguments);return r?lhe(r):null},OAe=Xl.env=function(r,e){e=e||process.env;var t={},i=r.length;for(var n in e)if(n.toLowerCase().indexOf(r.toLowerCase())===0){for(var o=n.substring(i).split("__"),s;(s=o.indexOf(""))>-1;)o.splice(s,1);var a=t;o.forEach(function(u,c){!u||typeof a!="object"||(c===o.length-1&&(a[u]=e[n]),a[u]===void 0&&(a[u]={}),a=a[u])})}return t},LAe=Xl.find=function(){var r=up.join.apply(null,[].slice.call(arguments));function e(t,i){var n=up.join(t,i);try{return uU.statSync(n),n}catch(o){if(up.dirname(t)!==t)return e(up.dirname(t),i)}}return e(process.cwd(),r)}});var gU=g((NAe,fU)=>{"use strict";function pU(r){return r instanceof Buffer||r instanceof Date||r instanceof RegExp}function dU(r){if(r instanceof Buffer){var e=Buffer.alloc?Buffer.alloc(r.length):new Buffer(r.length);return r.copy(e),e}else{if(r instanceof Date)return new Date(r.getTime());if(r instanceof RegExp)return new RegExp(r);throw new Error("Unexpected situation")}}function hU(r){var e=[];return r.forEach(function(t,i){typeof t=="object"&&t!==null?Array.isArray(t)?e[i]=hU(t):pU(t)?e[i]=dU(t):e[i]=F0({},t):e[i]=t}),e}function mU(r,e){return e==="__proto__"?void 0:r[e]}var F0=fU.exports=function(){if(arguments.length<1||typeof arguments[0]!="object")return!1;if(arguments.length<2)return arguments[0];var r=arguments[0],e=Array.prototype.slice.call(arguments,1),t,i,n;return e.forEach(function(o){typeof o!="object"||o===null||Array.isArray(o)||Object.keys(o).forEach(function(s){if(i=mU(r,s),t=mU(o,s),t!==r)if(typeof t!="object"||t===null){r[s]=t;return}else if(Array.isArray(t)){r[s]=hU(t);return}else if(pU(t)){r[s]=dU(t);return}else if(typeof i!="object"||i===null||Array.isArray(i)){r[s]=F0({},t);return}else{r[s]=F0(i,t);return}})}),r}});var bU=g((qAe,vU)=>{vU.exports=function(r,e){e||(e={});var t={bools:{},strings:{},unknownFn:null};typeof e.unknown=="function"&&(t.unknownFn=e.unknown),typeof e.boolean=="boolean"&&e.boolean?t.allBools=!0:[].concat(e.boolean).filter(Boolean).forEach(function(E){t.bools[E]=!0});var i={};Object.keys(e.alias||{}).forEach(function(E){i[E]=[].concat(e.alias[E]),i[E].forEach(function(P){i[P]=[E].concat(i[E].filter(function(k){return P!==k}))})}),[].concat(e.string).filter(Boolean).forEach(function(E){t.strings[E]=!0,i[E]&&(t.strings[i[E]]=!0)});var n=e.default||{},o={_:[]};Object.keys(t.bools).forEach(function(E){l(E,n[E]===void 0?!1:n[E])});var s=[];r.indexOf("--")!==-1&&(s=r.slice(r.indexOf("--")+1),r=r.slice(0,r.indexOf("--")));function a(E,P){return t.allBools&&/^--[^=]+$/.test(P)||t.strings[E]||t.bools[E]||i[E]}function l(E,P,k){if(!(k&&t.unknownFn&&!a(E,k)&&t.unknownFn(k)===!1)){var _=!t.strings[E]&&yU(P)?Number(P):P;u(o,E.split("."),_),(i[E]||[]).forEach(function(O){u(o,O.split("."),_)})}}function u(E,P,k){for(var _=E,O=0;O<P.length-1;O++){var I=P[O];if(I==="__proto__")return;_[I]===void 0&&(_[I]={}),(_[I]===Object.prototype||_[I]===Number.prototype||_[I]===String.prototype)&&(_[I]={}),_[I]===Array.prototype&&(_[I]=[]),_=_[I]}var I=P[P.length-1];I!=="__proto__"&&((_===Object.prototype||_===Number.prototype||_===String.prototype)&&(_={}),_===Array.prototype&&(_=[]),_[I]===void 0||t.bools[I]||typeof _[I]=="boolean"?_[I]=k:Array.isArray(_[I])?_[I].push(k):_[I]=[_[I],k])}function c(E){return i[E].some(function(P){return t.bools[P]})}for(var f=0;f<r.length;f++){var p=r[f];if(/^--.+=/.test(p)){var d=p.match(/^--([^=]+)=([\s\S]*)$/),h=d[1],m=d[2];t.bools[h]&&(m=m!=="false"),l(h,m,p)}else if(/^--no-
`,n=Buffer.byteLength(i),o=Math.floor(Math.log(n)/Math.log(10))+1;return n+o>=Math.pow(10,o)&&(o+=1),o+n+i}};Sg.parse=(r,e,t)=>new Sg(pme(dme(r),e),t);var pme=(r,e)=>e?Object.keys(r).reduce((t,i)=>(t[i]=r[i],t),e):r,dme=r=>r.replace(/\n$/,"").split(`
`).reduce(hme,Object.create(null)),hme=(r,e)=>{let t=parseInt(e,10);if(t!==Buffer.byteLength(e)+1)return r;e=e.substr((t+" ").length);let i=e.split("="),n=i.shift().replace(/^SCHILY\.(dev|ino|nlink)/,"$1");if(!n)return r;let o=i.join("=");return r[n]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(n)?new Date(o*1e3):/^[0-9]+$/.test(o)?+o:o,r};S6.exports=Sg});var Cg=g((sOe,E6)=>{"use strict";E6.exports=r=>class extends r{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 nS=g((aOe,C6)=>{"use strict";var _g=["|","<",">","?",":"],iS=_g.map(r=>String.fromCharCode(61440+r.charCodeAt(0))),mme=new Map(_g.map((r,e)=>[r,iS[e]])),gme=new Map(iS.map((r,e)=>[r,_g[e]]));C6.exports={encode:r=>_g.reduce((e,t)=>e.split(t).join(mme.get(t)),r),decode:r=>iS.reduce((e,t)=>e.split(t).join(gme.get(t)),r)}});var P6=g((lOe,_6)=>{"use strict";_6.exports=(r,e,t)=>(r&=4095,t&&(r=(r|384)&~18),e&&(r&256&&(r|=64),r&32&&(r|=8),r&4&&(r|=1)),r)});var fS=g((dOe,T6)=>{"use strict";var R6=ru(),k6=Eg(),I6=ou(),uOe=bp(),bn=require("fs"),su=require("path"),cOe=yp(),vme=16*1024*1024,F6=Symbol("process"),A6=Symbol("file"),O6=Symbol("directory"),oS=Symbol("symlink"),L6=Symbol("hardlink"),wp=Symbol("header"),Pg=Symbol("read"),sS=Symbol("lstat"),Tg=Symbol("onlstat"),aS=Symbol("onread"),lS=Symbol("onreadlink"),uS=Symbol("openfile"),cS=Symbol("onopenfile"),ua=Symbol("close"),Rg=Symbol("mode"),M6=Cg(),yme=nS(),N6=P6(),kg=M6(class extends R6{constructor(e,t){if(t=t||{},super(t),typeof e!="string")throw new TypeError("path is required");this.path=e,this.portable=!!t.portable,this.myuid=process.getuid&&process.getuid(),this.myuser=process.env.USER||"",this.maxReadSize=t.maxReadSize||vme,this.linkCache=t.linkCache||new Map,this.statCache=t.statCache||new Map,this.preservePaths=!!t.preservePaths,this.cwd=t.cwd||process.cwd(),this.strict=!!t.strict,this.noPax=!!t.noPax,this.noMtime=!!t.noMtime,this.mtime=t.mtime||null,typeof t.onwarn=="function"&&this.on("warn",t.onwarn);let i=!1;if(!this.preservePaths&&su.win32.isAbsolute(e)){let n=su.win32.parse(e);this.path=e.substr(n.root.length),i=n.root}this.win32=!!t.win32||process.platform==="win32",this.win32&&(this.path=yme.decode(this.path.replace(/\\/g,"/")),e=e.replace(/\\/g,"/")),this.absolute=t.absolute||su.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[Tg](this.statCache.get(this.absolute)):this[sS]()}[sS](){bn.lstat(this.absolute,(e,t)=>{if(e)return this.emit("error",e);this[Tg](t)})}[Tg](e){this.statCache.set(this.absolute,e),this.stat=e,e.isFile()||(e.size=0),this.type=bme(e),this.emit("stat",e),this[F6]()}[F6](){switch(this.type){case"File":return this[A6]();case"Directory":return this[O6]();case"SymbolicLink":return this[oS]();default:return this.end()}}[Rg](e){return N6(e,this.type==="Directory",this.portable)}[wp](){this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.header=new I6({path:this.path,linkpath:this.linkpath,mode:this[Rg](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&&this.write(new k6({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.path,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.d
`).some(e=>e.indexOf("(https.js:")!==-1||e.indexOf("node:https:")!==-1)}function lv(r,e){return new lv.Agent(r,e)}(function(r){class e extends Dve.EventEmitter{constructor(i,n){super();let o=n;typeof i=="function"?this.callback=i:i&&(o=i),this.timeout=null,o&&typeof o.timeout=="number"&&(this.timeout=o.timeout),this.maxFreeSockets=1,this.maxSockets=1,this.maxTotalSockets=Infinity,this.sockets={},this.freeSockets={},this.requests={},this.options={}}get defaultPort(){return typeof this.explicitDefaultPort=="number"?this.explicitDefaultPort:nE()?443:80}set defaultPort(i){this.explicitDefaultPort=i}get protocol(){return typeof this.explicitProtocol=="string"?this.explicitProtocol:nE()?"https:":"http:"}set protocol(i){this.explicitProtocol=i}callback(i,n,o){throw new Error('"agent-base" has no default implementation, you must subclass and override `callback()`')}addRequest(i,n){let o=Object.assign({},n);typeof o.secureEndpoint!="boolean"&&(o.secureEndpoint=nE()),o.host==null&&(o.host="localhost"),o.port==null&&(o.port=o.secureEndpoint?443:80),o.protocol==null&&(o.protocol=o.secureEndpoint?"https:":"http:"),o.host&&o.path&&delete o.path,delete o.agent,delete o.hostname,delete o._defaultAgent,delete o.defaultPort,delete o.createConnection,i._last=!0,i.shouldKeepAlive=!1;let s=!1,a=null,l=o.timeout||this.timeout,u=d=>{i._hadError||(i.emit("error",d),i._hadError=!0)},c=()=>{a=null,s=!0;let d=new Error(`A "socket" was not created for HTTP request before ${l}ms`);d.code="ETIMEOUT",u(d)},f=d=>{s||(a!==null&&(clearTimeout(a),a=null),u(d))},p=d=>{if(s)return;if(a!=null&&(clearTimeout(a),a=null),Cve(d)){Op("Callback returned another Agent instance %o",d.constructor.name),d.addRequest(i,o);return}if(d){d.once("free",()=>{this.freeSocket(d,o)}),i.onSocket(d);return}let h=new Error(`no Duplex stream was returned to agent-base for \`${i.method} ${i.path}\``);u(h)};if(typeof this.callback!="function"){u(new Error("`callback` is not defined"));return}this.promisifiedCallback||(this.callback.length>=3?(Op("Converting legacy callback function to promise"),this.promisifiedCallback=Eve.default(this.callback)):this.promisifiedCallback=this.callback),typeof l=="number"&&l>0&&(a=setTimeout(c,l)),"port"in o&&typeof o.port!="number"&&(o.port=Number(o.port));try{Op("Resolving socket for %o request: %o",o.protocol,`${i.method} ${i.path}`),Promise.resolve(this.promisifiedCallback(i,o)).then(p,f)}catch(d){Promise.reject(d).catch(f)}}freeSocket(i,n){Op("Freeing socket %o %o",i.constructor.name,n),i.destroy()}destroy(){Op("Destroying agent %o",this.constructor.name)}}r.Agent=e,r.prototype=r.Agent.prototype})(lv||(lv={}));h5.exports=lv});var v5=g(ba=>{"use strict";var _ve=ba&&ba.__awaiter||function(r,e,t,i){function n(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(c){try{u(i.next(c))}catch(f){s(f)}}function l(c){try{u(i.throw(c))}catch(f){s(f)}}function u(c){c.done?o(c.value):n(c.value).then(a,l)}u((i=i.apply(r,e||[])).next())})},Lp=ba&&ba.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(ba,"__esModule",{value:!0});var Pve=Lp(require("net")),Tve=Lp(require("tls")),sE=Lp(require("url")),Rve=Lp(gt()),kve=Lp(p5()),Ive=oE(),os=Rve.default("http-proxy-agent");function Fve(r){return typeof r=="string"?/^https:?$/i.test(r):!1}var g5=class extends Ive.Agent{constructor(e){let t;if(typeof e=="string"?t=sE.default.parse(e):t=e,!t)throw new Error("an HTTP(S) proxy server `host` and `port` must be specified!");os("Creating new HttpProxyAgent instance: %o",t),super(t);let i=Object.assign({},t);this.secureProxy=t.secureProxy||Fve(i.protocol),i.host=i.hostname||i.host,typeof i.port=="string"&&(i.port=parseInt(i.port,10)),!i.port&&i.host&&(i.port=this.secureProxy?443:80),i.host&&i.path&&(delete i.path,delete i.pathname),this.proxy=i}callback(e,t){return _ve(this,void 0,void 0,function*(){let{proxy:i,secureProxy:n}=this,o=sE.default.parse(e.path);o.protocol||(o.protocol="http:"),o.hostname||(o.hostname=t.hostname||t.host||null),o.port==null&&typeof t.port&&(o.port=String(t.port
\r
`)+4,e.output[0]=e._header+a.substring(l),os("Output buffer: %o",e.output)):e.outputData&&e.outputData.length>0&&(os("Patching connection write() output buffer with updated header"),a=e.outputData[0].data,l=a.indexOf(`\r
\r
`)+4,e.outputData[0].data=e._header+a.substring(l),os("Output buffer: %o",e.outputData[0].data))}return yield kve.default(s,"connect"),s})}};ba.default=g5});var b5=g((aE,y5)=>{"use strict";var Ave=aE&&aE.__importDefault||function(r){return r&&r.__esModule?r:{default:r}},lE=Ave(v5());function uE(r){return new lE.default(r)}(function(r){r.HttpProxyAgent=lE.default,r.prototype=lE.default.prototype})(uE||(uE={}));y5.exports=uE});var w5=g(Mp=>{"use strict";var Ove=Mp&&Mp.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Mp,"__esModule",{value:!0});var Lve=Ove(gt()),Np=Lve.default("https-proxy-agent:parse-proxy-response");function Mve(r){return new Promise((e,t)=>{let i=0,n=[];function o(){let f=r.read();f?c(f):r.once("readable",o)}function s(){r.removeListener("end",l),r.removeListener("error",u),r.removeListener("close",a),r.removeListener("readable",o)}function a(f){Np("onclose had error %o",f)}function l(){Np("onend")}function u(f){s(),Np("onerror %o",f),t(f)}function c(f){n.push(f),i+=f.length;let p=Buffer.concat(n,i);if(p.indexOf(`\r
\r
`)===-1){Np("have not received end of HTTP headers yet..."),o();return}let h=p.toString("ascii",0,p.indexOf(`\r
`)),m=+h.split(" ")[1];Np("got proxy server response: %o",h),e({statusCode:m,buffered:p})}r.on("error",u),r.on("close",a),r.on("end",l),o()})}Mp.default=Mve});var E5=g(wa=>{"use strict";var Nve=wa&&wa.__awaiter||function(r,e,t,i){function n(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(c){try{u(i.next(c))}catch(f){s(f)}}function l(c){try{u(i.throw(c))}catch(f){s(f)}}function u(c){c.done?o(c.value):n(c.value).then(a,l)}u((i=i.apply(r,e||[])).next())})},Eu=wa&&wa.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(wa,"__esModule",{value:!0});var x5=Eu(require("net")),D5=Eu(require("tls")),qve=Eu(require("url")),$ve=Eu(require("assert")),Bve=Eu(gt()),jve=oE(),Uve=Eu(w5()),qp=Bve.default("https-proxy-agent:agent"),S5=class extends jve.Agent{constructor(e){let t;if(typeof e=="string"?t=qve.default.parse(e):t=e,!t)throw new Error("an HTTP(S) proxy server `host` and `port` must be specified!");qp("creating new HttpsProxyAgent instance: %o",t),super(t);let i=Object.assign({},t);this.secureProxy=t.secureProxy||zve(i.protocol),i.host=i.hostname||i.host,typeof i.port=="string"&&(i.port=parseInt(i.port,10)),!i.port&&i.host&&(i.port=this.secureProxy?443:80),this.secureProxy&&!("ALPNProtocols"in i)&&(i.ALPNProtocols=["http 1.1"]),i.host&&i.path&&(delete i.path,delete i.pathname),this.proxy=i}callback(e,t){return Nve(this,void 0,void 0,function*(){let{proxy:i,secureProxy:n}=this,o;n?(qp("Creating `tls.Socket`: %o",i),o=D5.default.connect(i)):(qp("Creating `net.Socket`: %o",i),o=x5.default.connect(i));let s=Object.assign({},i.headers),l=`CONNECT ${`${t.host}:${t.port}`} HTTP/1.1\r
`;i.auth&&(s["Proxy-Authorization"]=`Basic ${Buffer.from(i.auth).toString("base64")}`);let{host:u,port:c,secureEndpoint:f}=t;Hve(c,f)||(u+=`:${c}`),s.Host=u,s.Connection="close";for(let y of Object.keys(s))l+=`${y}: ${s[y]}\r
`;let p=Uve.default(o);o.write(`${l}\r
`);let{statusCode:d,buffered:h}=yield p;if(d===200){if(e.once("socket",Wve),t.secureEndpoint){let y=t.servername||t.host;if(!y)throw new Error('Could not determine "servername"');return qp("Upgrading socket connection to TLS"),D5.default.connect(Object.assign(Object.assign({},Gve(t,"host","hostname","path","port")),{socket:o,servername:y}))}return o}o.destroy();let m=new x5.default.Socket;return m.readable=!0,e.once("socket",y=>{qp("replaying proxy buffer for failed request"),$ve.default(y.listenerCount("data")>0),y.push(h),y.push(null)}),m})}};wa.default=S5;function Wve(r){r.resume()}function Hve(r,e){return Boolean(!e&&r===80||e&&r===443)}function zve(r){return typeof r=="string"?/^https:?$/i.test(r):!1}function Gve(r,...e){let t={},i;for(i in r)e.includes(i)||(t[i]=r[i]);return t}});var _5=g((cE,C5)=>{"use strict";var Vve=cE&&cE.__importDefault||function(r){return r&&r.__esModule?r:{default:r}},fE=Vve(E5());function pE(r){return new fE.default(r)}(function(r){r.HttpsProxyAgent=fE.default,r.prototype=fE.default.prototype})(pE||(pE={}));C5.exports=pE});var T5=g((pLe,P5)=>{"use strict";var Kve=["aborted","complete","headers","httpVersion","httpVersionMinor","httpVersionMajor","method","rawHeaders","rawTrailers","setTimeout","socket","statusCode","statusMessage","trailers","url"];P5.exports=(r,e)=>{if(e._readableState.autoDestroy)throw new Error("The second stream must have the `autoDestroy` option set to `false`");let t=new Set(Object.keys(r).concat(Kve)),i={};for(let n of t)n in e||(i[n]={get(){let o=r[n];return typeof o=="function"?o.bind(r):o},set(o){r[n]=o},enumerable:!0,configurable:!1});return Object.defineProperties(e,i),r.once("aborted",()=>{e.destroy(),e.emit("aborted")}),r.once("close",()=>{r.complete&&e.readable?e.once("end",()=>{e.emit("close")}):e.emit("close")}),e}});var k5=g((dLe,R5)=>{"use strict";var{Transform:Jve,PassThrough:Yve}=require("stream"),dE=require("zlib"),Xve=T5();R5.exports=r=>{let e=(r.headers["content-encoding"]||"").toLowerCase();if(!["gzip","deflate","br"].includes(e))return r;let t=e==="br";if(t&&typeof dE.createBrotliDecompress!="function")return r.destroy(new Error("Brotli is not supported on Node.js < 12")),r;let i=!0,n=new Jve({transform(a,l,u){i=!1,u(null,a)},flush(a){a()}}),o=new Yve({autoDestroy:!1,destroy(a,l){r.destroy(),l(a)}}),s=t?dE.createBrotliDecompress():dE.createUnzip();return s.once("error",a=>{if(i&&!r.readable){o.end();return}o.destroy(a)}),Xve(r,o),r.pipe(n).pipe(s).pipe(o),o}});var Uz=g(Uye=>{fo(Uye,{BaseLanguageClient:()=>yv,BasicList:()=>Mt,Buffer:()=>Ou.Buffer,CancellationToken:()=>ie.CancellationToken,CancellationTokenSource:()=>ie.CancellationTokenSource,ClientState:()=>be,CloseAction:()=>ro,CodeActionKind:()=>ie.CodeActionKind,CompletionItemKind:()=>ie.CompletionItemKind,CompletionTriggerKind:()=>ie.CompletionTriggerKind,ConfigurationTarget:()=>pt,Diagnostic:()=>ie.Diagnostic,DiagnosticSeverity:()=>ie.DiagnosticSeverity,DiagnosticTag:()=>ie.DiagnosticTag,Disposable:()=>ie.Disposable,Document:()=>Zm,DocumentHighlightKind:()=>ie.DocumentHighlightKind,Emitter:()=>ie.Emitter,ErrorAction:()=>Tu,Event:()=>ie.Event,ExtensionType:()=>Jr,FileChangeType:()=>ie.FileChangeType,FileSystemWatcher:()=>tg,FloatFactory:()=>mn,Highligher:()=>ss,InsertTextFormat:()=>ie.InsertTextFormat,LanguageClient:()=>Cv,Location:()=>ie.Location,LocationLink:()=>ie.LocationLink,MarkupKind:()=>ie.MarkupKind,MessageLevel:()=>gn,MessageTransports:()=>Hp,Mru:()=>Gl,Mutex:()=>ar,Neovim:()=>Ou.Neovim,NotificationType:()=>ie.NotificationType,NotificationType0:()=>ie.NotificationType0,NullLogger:()=>tH,PatternType:()=>Kr,Position:()=>ie.Position,ProgressType:()=>jz.ProgressType,ProposedFeatures:()=>_v,Range:()=>ie.Range,RequestType:()=>ie.RequestType,RequestType0:()=>ie.RequestType0,RevealOutputChannelOn:()=>ii,ServiceStat:()=>ye,SettingMonitor:()=>$H,SignatureHelpTriggerKind:()=>ie.SignatureHelpTriggerKind,SourceType:()=>Yr,State:()=>ni,SymbolKind:()=>ie.SymbolKind,TextDocumentFeature:()=>Ge,TextEdit:()=>ie.TextEdit,TransportKind:()=>Gt,Uri:()=>$,Watchman:()=>ta,Window:()=>Ou.Window,ansiparse:()=>N
`)>=0)return!1;return!0}function owe(r,e){var t;if(r.indent===" ")t=" ";else if(typeof r.indent=="number"&&r.indent>0)t=Array(r.indent+1).join(" ");else return null;return{base:t,prev:Array(e+1).join(t)}}function b_(r,e){if(r.length===0)return"";var t=`
`+e.prev+e.base;return t+r.join(","+t)+`
`+e.prev}function ty(r,e){var t=y_(r),i=[];if(t){i.length=r.length;for(var n=0;n<r.length;n++)i[n]=ka(r,n)?e(r[n],r):""}for(var o in r)!ka(r,o)||t&&String(Number(o))===o&&o<r.length||(/[^\w$]/.test(o)?i.push(e(o,r)+": "+e(r[o],r)):i.push(o+": "+e(r[o],r)));if(typeof e7=="function")for(var s=e7(r),a=0;a<s.length;a++)Wbe.call(r,s[a])&&i.push("["+e(s[a])+"]: "+e(r[s[a]],r));return i}});var Hu=g((q9e,a7)=>{"use strict";a7.exports=function(e){return typeof e=="string"||typeof e=="symbol"}});var u7=g(($9e,l7)=>{"use strict";l7.exports=function(e){if(e===null)return"Null";if(typeof e=="undefined")return"Undefined";if(typeof e=="function"||typeof e=="object")return"Object";if(typeof e=="number")return"Number";if(typeof e=="boolean")return"Boolean";if(typeof e=="string")return"String"}});var pr=g((B9e,c7)=>{"use strict";var lwe=u7();c7.exports=function(e){return typeof e=="symbol"?"Symbol":typeof e=="bigint"?"BigInt":lwe(e)}});var fd=g((j9e,f7)=>{"use strict";var uwe=Ae(),p7=uwe("%TypeError%"),cwe=w_(),fwe=Hu(),pwe=pr();f7.exports=function(e,t){if(pwe(e)!=="Object")throw new p7("Assertion failed: Type(O) is not Object");if(!fwe(t))throw new p7("Assertion failed: IsPropertyKey(P) is not true, got "+cwe(t));return e[t]}});var h7=g((U9e,d7)=>{"use strict";var dwe=Ae(),hwe=dwe("%TypeError%");d7.exports=function(e,t){if(e==null)throw new hwe(t||"Cannot call method on "+e);return e}});var x_=g((W9e,m7)=>{"use strict";m7.exports=h7()});var v7=g((H9e,g7)=>{"use strict";var mwe=Ae(),gwe=mwe("%Object%"),vwe=x_();g7.exports=function(e){return vwe(e),gwe(e)}});var b7=g((z9e,y7)=>{"use strict";var ywe=Ae(),bwe=ywe("%TypeError%"),wwe=Hu(),xwe=v7();y7.exports=function(e,t){if(!wwe(t))throw new bwe("Assertion failed: IsPropertyKey(P) is not true");var i=xwe(e);return i[t]}});var D7=g((G9e,w7)=>{"use strict";var x7=Function.prototype.toString,zu=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,D_,ry;if(typeof zu=="function"&&typeof Object.defineProperty=="function")try{D_=Object.defineProperty({},"length",{get:function(){throw ry}}),ry={},zu(function(){throw 42},null,D_)}catch(r){r!==ry&&(zu=null)}else zu=null;var Dwe=/^\s*class\b/,S_=function(e){try{var t=x7.call(e);return Dwe.test(t)}catch(i){return!1}},Swe=function(e){try{return S_(e)?!1:(x7.call(e),!0)}catch(t){return!1}},Ewe=Object.prototype.toString,Cwe="[object Function]",_we="[object GeneratorFunction]",Pwe=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol";w7.exports=zu?function(e){if(!e||typeof e!="function"&&typeof e!="object")return!1;if(typeof e=="function"&&!e.prototype)return!0;try{zu(e,null,D_)}catch(t){if(t!==ry)return!1}return!S_(e)}:function(e){if(!e||typeof e!="function"&&typeof e!="object")return!1;if(typeof e=="function"&&!e.prototype)return!0;if(Pwe)return Swe(e);if(S_(e))return!1;var t=Ewe.call(e);return t===Cwe||t===_we}});var iy=g((V9e,S7)=>{"use strict";S7.exports=D7()});var _7=g((K9e,E7)=>{"use strict";var Twe=Ae(),C7=Twe("%TypeError%"),Rwe=b7(),kwe=iy(),Iwe=Hu();E7.exports=function(e,t){if(!Iwe(t))throw new C7("Assertion failed: IsPropertyKey(P) is not true");var i=Rwe(e,t);if(i!=null){if(!kwe(i))throw new C7(t+"is not a function");return i}}});var I7=g((J9e,P7)=>{"use strict";var Fwe=Li()(),T7=Fwe&&typeof Symbol.toStringTag=="symbol",R7,k7,E_,C_;T7&&(R7=Function.call.bind(Object.prototype.hasOwnProperty),k7=Function.call.bind(RegExp.prototype.exec),E_={},ny=function(){throw E_},C_={toString:ny,valueOf:ny},typeof Symbol.toPrimitive=="symbol"&&(C_[Symbol.toPrimitive]=ny));var ny,Awe=Object.prototype.toString,Owe=Object.getOwnPropertyDescriptor,Lwe="[object RegExp]";P7.exports=T7?function(e){if(!e||typeof e!="object")return!1;var t=Owe(e,"lastIndex"),i=t&&R7(t,"value");if(!i)return!1;try{k7(e,C_)}catch(n){return n===E_}}:function(e){return!e||typeof e!="object"&&typeof e!="function"?!1:Awe.call(e)===Lwe}});var __=g((Y9e,F7)=>{"use strict";F7.exports=function(e){return!!e}});var L7=g((X9e,A7)=>{"use strict";var Mwe=Ae(),O7=Mwe("%Symbol.match%",!0),Nwe=I7(),qwe=__();A7.exports=function(e){if(!e||typeof e!="object")return!1;if(O7){var t=e[O7];if(typeof
\v\f\r \xA0\u1680\u180E\u2000\u2001\u2002\u2003`,"\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028","\u2029\uFEFF"].join(""),vDe=new RegExp("(^["+DV+"]+)|(["+DV+"]+$)","g"),yDe=wV("String.prototype.replace"),bDe=function(r){return yDe(r,vDe,"")},wDe=gV();vV.exports=function r(e){var t=cDe(e)?e:wDe(e,yV);if(typeof t=="symbol")throw new lDe("Cannot convert a Symbol value to a number");if(typeof t=="string"){if(fDe(t))return r(bV(xV(t,2),2));if(pDe(t))return r(bV(xV(t,2),8));if(gDe(t)||dDe(t))return NaN;var i=bDe(t);if(i!==t)return r(i)}return yV(t)}});var CV=g((O7e,EV)=>{"use strict";var xDe=XG(),DDe=SV();EV.exports=function(e){var t=DDe(e);return t!==0&&(t=xDe(t)),t===0?0:t}});var eP=g((L7e,_V)=>{"use strict";var PV=Y_(),SDe=CV();_V.exports=function(e){var t=SDe(e);return t<=0?0:t>PV?PV:t}});var tP=g((M7e,TV)=>{"use strict";TV.exports=function(e){return typeof e=="number"&&e>=55296&&e<=56319}});var rP=g((N7e,RV)=>{"use strict";RV.exports=function(e){return typeof e=="number"&&e>=56320&&e<=57343}});var AV=g((q7e,kV)=>{"use strict";var IV=Ae(),EDe=IV("%TypeError%"),FV=IV("%String.fromCharCode%"),CDe=tP(),_De=rP();kV.exports=function(e,t){if(!CDe(e)||!_De(t))throw new EDe("Assertion failed: `lead` must be a leading surrogate char code, and `trail` must be a trailing surrogate char code");return FV(e)+FV(t)}});var $V=g(($7e,OV)=>{"use strict";var PDe=Ae(),LV=PDe("%TypeError%"),MV=Ra(),TDe=tP(),NV=rP(),RDe=pr(),kDe=AV(),IDe=MV("String.prototype.charAt"),qV=MV("String.prototype.charCodeAt");OV.exports=function(e,t){if(RDe(e)!=="String")throw new LV("Assertion failed: `string` must be a String");var i=e.length;if(t<0||t>=i)throw new LV("Assertion failed: `position` must be >= 0, and < the length of `string`");var n=qV(e,t),o=IDe(e,t),s=TDe(n),a=NV(n);if(!s&&!a)return{"[[CodePoint]]":o,"[[CodeUnitCount]]":1,"[[IsUnpairedSurrogate]]":!1};if(a||t+1===i)return{"[[CodePoint]]":o,"[[CodeUnitCount]]":1,"[[IsUnpairedSurrogate]]":!0};var l=qV(e,t+1);return NV(l)?{"[[CodePoint]]":kDe(n,l),"[[CodeUnitCount]]":2,"[[IsUnpairedSurrogate]]":!1}:{"[[CodePoint]]":o,"[[CodeUnitCount]]":1,"[[IsUnpairedSurrogate]]":!0}}});var jV=g((B7e,BV)=>{"use strict";var FDe=Ae(),ADe=FDe("%Math.abs%");BV.exports=function(e){return ADe(e)}});var WV=g((j7e,UV)=>{"use strict";var ODe=Math.floor;UV.exports=function(e){return ODe(e)}});var zV=g((U7e,HV)=>{"use strict";var LDe=jV(),MDe=WV(),NDe=uy(),qDe=X_();HV.exports=function(e){if(typeof e!="number"||NDe(e)||!qDe(e))return!1;var t=LDe(e);return MDe(t)===t}});var KV=g((W7e,GV)=>{"use strict";var $De=Ae(),BDe=$V(),jDe=zV(),VV=pr(),UDe=Y_(),iP=$De("%TypeError%");GV.exports=function(e,t,i){if(VV(e)!=="String")throw new iP("Assertion failed: `S` must be a String");if(!jDe(t)||t<0||t>UDe)throw new iP("Assertion failed: `length` must be an integer >= 0 and <= 2**53");if(VV(i)!=="Boolean")throw new iP("Assertion failed: `unicode` must be a Boolean");if(!i)return t+1;var n=e.length;if(t+1>=n)return t+1;var o=BDe(e,t);return t+o["[[CodeUnitCount]]"]}});var YV=g((H7e,JV)=>{"use strict";var WDe=Ae(),HDe=WDe("%TypeError%"),zDe=pr();JV.exports=function(e,t){if(zDe(t)!=="Boolean")throw new HDe("Assertion failed: Type(done) is not Boolean");return{value:e,done:t}}});var QV=g((z7e,XV)=>{"use strict";var GDe=Ae(),ZV=GDe("%Array%"),VDe=!ZV.isArray&&Ra()("Object.prototype.toString");XV.exports=ZV.isArray||function(e){return VDe(e)==="[object Array]"}});var nK=g((G7e,eK)=>{"use strict";var nP=Ae(),tK=nP("%Object.create%",!0),rK=nP("%TypeError%"),iK=nP("%SyntaxError%"),KDe=QV(),JDe=pr(),YDe=!({__proto__:null}instanceof Object);eK.exports=function(e){if(e!==null&&JDe(e)!=="Object")throw new rK("Assertion failed: `proto` must be null or an object");var t=arguments.length<2?[]:arguments[1];if(!KDe(t))throw new rK("Assertion failed: `additionalInternalSlotsList` must be an Array");if(t.length>0)throw new iK("es-abstract does not yet support internal slots");if(tK)return tK(e);if(YDe)return{__proto__:e};if(e===null)throw new iK("native Object.create support is required to create null objects");var i=function(){};return i.
${s}
${l}`));return}i(a)})})}function Pl(r,e){let t=oq.default(e,100);try{let i=sq.default.watch(r,{persistent:!0,recursive:!1,encoding:"utf8"},()=>{t()});return Ix.Disposable.create(()=>{t.clear(),i.close()})}catch(i){return Ix.Disposable.create(()=>{t.clear()})}}function cq(r){try{return process.kill(r,0)==!0}catch(e){return e.code==="EPERM"}}function Fx(r){return r=="n"||r=="o"||r=="x"||r=="v"?"<C-U>":r=="i"?"<C-o>":r=="s"?"<Esc>":""}function vf(r,e,t=3){if(r.length==0)return Promise.resolve();let i=0,n=r.length,o=r.slice();return new Promise(s=>{let a=l=>{let u=()=>{if(i=i+1,i==n)s();else if(o.length){let c=o.shift();a(c)}};e(l).then(u,u)};for(let l=0;l<Math.min(t,o.length);l++){let u=o.shift();a(u)}})}var rue=Object.prototype.hasOwnProperty;function Tl(r){return typeof r=="boolean"}function bt(r){return typeof r=="string"}function cm(r){return typeof r=="number"}function Lo(r){return typeof r=="function"}function wt(r){return r!=null&&typeof r=="object"&&!Array.isArray(r)&&!(r instanceof RegExp)&&!(r instanceof Date)}function fm(r){if(!wt(r))return!1;for(let e in r)if(rue.call(r,e))return!1;return!0}function zn(r){if(!r||typeof r!="object"||r instanceof RegExp)return r;let e=Array.isArray(r)?[]:{};return Object.keys(r).forEach(t=>{r[t]&&typeof r[t]=="object"?e[t]=zn(r[t]):e[t]=r[t]}),e}var iue=Object.prototype.hasOwnProperty;function fq(r){if(!r||typeof r!="object")return r;let e=[r];for(;e.length>0;){let t=e.shift();Object.freeze(t);for(let i in t)if(iue.call(t,i)){let n=t[i];typeof n=="object"&&!Object.isFrozen(n)&&e.push(n)}}return r}function Ax(r,e,t=!0){return wt(r)?(wt(e)&&Object.keys(e).forEach(i=>{i in r?t&&(wt(r[i])&&wt(e[i])?Ax(r[i],e[i],t):r[i]=e[i]):r[i]=e[i]}),r):e}function Ne(r,e){if(r===e)return!0;if(r==null||e===null||e===void 0||typeof r!=typeof e||typeof r!="object"||Array.isArray(r)!==Array.isArray(e))return!1;let t,i;if(Array.isArray(r)){if(r.length!==e.length)return!1;for(t=0;t<r.length;t++)if(!Ne(r[t],e[t]))return!1}else{let n=[];for(i in r)n.push(i);n.sort();let o=[];for(i in e)o.push(i);if(o.sort(),!Ne(n,o))return!1;for(t=0;t<n.length;t++)if(!Ne(r[n[t]],e[n[t]]))return!1}return!0}var pq=j()("events"),dq=class{constructor(){this.handlers=new Map;this.insertMode=!1}get cursor(){return this._cursor}async fire(e,t){let i=this.handlers.get(e);if(e=="InsertEnter"?this.insertMode=!0:e=="InsertLeave"?this.insertMode=!1:!this.insertMode&&(e=="CursorHoldI"||e=="CursorMovedI")?(this.insertMode=!0,await this.fire("InsertEnter",[t[0]])):this.insertMode&&(e=="CursorHold"||e=="CursorMoved")&&(this.insertMode=!1,await this.fire("InsertLeave",[t[0]])),e=="CursorMoved"||e=="CursorMovedI"){let n={bufnr:t[0],lnum:t[1][0],col:t[1][1],insert:e=="CursorMovedI"};if(this._cursor&&Ne(this._cursor,n))return;this._cursor=n}if(i)try{await Promise.all(i.map(n=>n(t)))}catch(n){n.message&&n.message.indexOf("transport disconnected")==-1&&console.error(`Error on ${e}: ${n.message}${n.stack?`
`+n.stack:""} `),pq.error(`Handler Error on ${e}`,n.stack)}}on(e,t,i,n){if(Array.isArray(e)){let o=n||[];for(let s of e)this.on(s,t,i,o);return Ox.Disposable.create(()=>{z(o)})}else{let o=this.handlers.get(e)||[],s=Error().stack,a=u=>new Promise((c,f)=>{let p;try{Promise.resolve(t.apply(i||null,u)).then(()=>{p&&clearTimeout(p),c(void 0)},d=>{p&&clearTimeout(p),f(d)}),p=setTimeout(()=>{pq.warn(`Handler of ${e} blocked more than 2s:`,s)},2e3)}catch(d){f(d)}});o.push(a),this.handlers.set(e,o);let l=Ox.Disposable.create(()=>{let u=o.indexOf(a);u!==-1&&o.splice(u,1)});return n&&n.push(l),l}}},A=new dq;var bJ=S(require("events")),wJ=S(require("path")),AP=S(require("fs")),xd=S(W());var Wv=S(W());var Xj=S(Gr()),Zj=S(Pf()),dt=S(W());var LB=S(Gr()),Lm=S(W());var hD=S(x$());var bB=S(uB());var wr=S(hB());function mB(r){return`${wr.default.gray.open}${r}${wr.default.gray.close}`}function lD(r){return`${wr.default.magenta.open}${r}${wr.default.magenta.close}`}function gB(r){return`${wr.default.bold.open}${r}${wr.default.bold.close}`}function Am(r){return`${wr.default.underline.open}${r}${wr.default.underline.close}`}function vB(r){return`${wr.default.italic.open}${r}${wr.default.italic.close}`}function yB(r){return`${wr.default.yellow.open}${r}${wr.default.yellow.close}`}function uD(r){return`${wr.default.blue.open}${r}${wr.default.blue.close}`}var HTe=j()("markdown-renderer"),wB="^*||*^",cD="*|*|*|*",wpe=new RegExp(xB(cD),"g"),DB="*#COLON|*",xpe=new RegExp(xB(DB),"g"),Dpe=[" "],Spe="\r",SB={code:Ki,blockquote:Ki,html:mB,heading:lD,firstHeading:lD,hr:Ki,listitem:Ki,list:Epe,table:Ki,paragraph:Ki,strong:gB,em:vB,codespan:yB,del:Am,link:Am,href:Am,text:Ki,unescape:!0,emoji:!1,width:80,showSectionPrefix:!0,tab:2,tableOptions:{}};function EB(r,e){return e?r.replace(Spe,/\n/g):r}function _pe(r,e){return typeof r=="number"?new Array(r+1).join(" "):typeof r=="string"&&Cpe(r)?r:new Array(e+1).join(" ")}function Cpe(r){return Dpe.some(function(e){return r.match("^("+e+")+$")})}function Ppe(r,e){return e.replace(/(^|\n)(.+)/g,"$1"+r+"$2")}function Tpe(r,e){return e&&r+e.split(`
`).join(`
`+r)}var Rpe="\\*",kpe="\\d+\\.",CB="(?:"+[Rpe,kpe].join("|")+")";function Ipe(r,e){let t=new RegExp("(\\S(?: | )?)((?:"+e+")+)("+CB+"(?:.*)+)$","gm");return r.replace(t,`$1
`+e+"$2$3")}var _B=function(r,e){return r.match("^(?:"+e+")*"+CB)};function PB(r){return" ".repeat(r.length)}var fD="* ";function Fpe(r,e){return _B(e,r)?e:PB(fD)+e}function Ape(r,e){let t=Fpe.bind(null,e);return r.split(`
`).filter(Ki).map(t).join(`
`)}var TB=function(r){return r+". "};function Ope(r,e,t){return _B(e,r)?{num:t+1,line:e.replace(fD,TB(t+1))}:{num:t,line:PB(TB(t))+e}}function Lpe(r,e){let t=Ope.bind(null,e),i=0;return r.split(`
`).filter(Ki).map(n=>{let o=t(n,i);return i=o.num,o.line}).join(`
`)}function Epe(r,e,t){return r=r.trim(),r=e?Lpe(r,t):Ape(r,t),r}function Lf(r){return r+`
`}function Mpe(r){return r.replace(xpe,":")}function RB(r,e=null){if(!r)return[];e=e||Ki;let t=e(r).split(`
`),i=[];return t.forEach(function(n){if(!n)return;let o=n.replace(wpe,"").split(wB);i.push(o.splice(0,o.length-1))}),i}function xB(r){return r.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}function Npe(r){return r.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'")}function Ki(r){return r}var pD=new Map,kB=class{constructor(e={},t={}){this.options=e;this.highlightOptions=t;this.o=Object.assign({},SB,e),this.tab=_pe(this.o.tab,SB.tab),this.tableSettings=this.o.tableOptions,this.unescape=this.o.unescape?Npe:Ki,this.highlightOptions=t||{},this.transform=this.compose(Mpe,this.unescape)}textLength(e){return e.replace(/\u001b\[(?:\d{1,3})(?:;\d{1,3})*m/g,"").length}text(e){return this.o.text(e)}code(e,t,i){return"``` "+t+`
`+e+"\n```\n"}blockquote(e){return Lf(this.o.blockquote(Tpe(this.tab,e.trim())))}html(e){return this.o.html(e)}heading(e,t,i){return e=this.transform(e),e=(this.o.showSectionPrefix?new Array(t+1).join("#")+" ":"")+e,Lf(t===1?this.o.firstHeading(e):this.o.heading(e))}hr(){return`---
`}list(e,t){return e=this.o.list(e,t,this.tab),Lf(Ipe(Ppe(this.tab,e),this.tab))}listitem(e){let t=this.compose(this.o.listitem,this.transform);return e.indexOf(`
`)!==-1&&(e=e.trim()),`
`+fD+t(e)}checkbox(e){return"["+(e?"X":" ")+"] "}paragraph(e){return e=this.compose(this.o.paragraph,this.transform)(e),Lf(e)}table(e,t){let i=new bB.default(Object.assign({},{head:RB(e)[0]},this.tableSettings));return RB(t,this.transform).forEach(function(n){i.push(n)}),Lf(this.o.table(i.toString()))}tablerow(e){return cD+e+cD+`
`}tablecell(e,t){return e+wB}strong(e){return this.o.strong(e)}em(e){return e=EB(e,this.o.reflowText),this.o.em(e)}codespan(e){return e=EB(e,this.o.reflowText),this.o.codespan(e.replace(/:/g,DB))}br(){return`
`}del(e){return this.o.del(e)}link(e,t,i){let n;if(this.options.sanitize){try{n=decodeURIComponent(unescape(e)).replace(/[^\w:]/g,"").toLowerCase()}catch(s){return""}if(n.startsWith("javascript:"))return""}if(i&&e&&i!=e&&pD.set(i,e),i&&i!=e)return uD(i);let o=this.o.href(e);return this.o.link(o)}image(e,t,i){if(typeof this.o.image=="function")return this.o.image(e,t,i);let n="!["+i;return t&&(n+=" \u2013 "+t),n+"]("+e+`)
`}compose(...e){return(...t)=>{for(let i=e.length;i-- >0;)t=[e[i].apply(this,t)];return t[0]}}static getLinks(){let e=[];for(let[t,i]of pD.entries())e.push(`${uD(t)}: ${i}`);return pD.clear(),e}},dD=kB;function ue(r){return Buffer.byteLength(r)}function Ml(r){return r?r[0].toUpperCase()+r.slice(1):""}function Vr(r,e){let t=r.slice(0,e);return Buffer.byteLength(t)}function Mf(r,e){return Buffer.from(r,"utf8").slice(0,e).toString("utf8").length}function Rt(r,e,t){return Buffer.from(r,"utf8").slice(e,t).toString("utf8")}function IB(r){let e=r.charCodeAt(0);return e>128?!1:e==95||e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122}var FB={30:"black",31:"red",32:"green",33:"yellow",34:"blue",35:"magenta",36:"cyan",37:"white",90:"grey"},AB={40:"black",41:"red",42:"green",43:"yellow",44:"blue",45:"magenta",46:"cyan",47:"white"},OB={1:"bold",3:"italic",4:"underline"};function Nl(r,e=!1){let t=Nf(r),i=[],n="";for(let o of t){if(!o.text)continue;let{foreground:s,background:a,bold:l,italic:u,underline:c}=o,f=ue(n);if(s||a||l||u||c){let p=[f,f+ue(o.text)],d="";s&&a?d=`CocList${Ml(s)}${Ml(a)}`:s?e?s=="yellow"?d="CocMarkdownCode":s=="blue"?d="CocMarkdownLink":s=="magenta"?d="CocMarkdownHeader":d=`CocListFg${Ml(s)}`:d=`CocListFg${Ml(s)}`:a?d=`CocListBg${Ml(a)}`:l?d="CocBold":u?d="CocItalic":c&&(d="CocUnderline"),i.push({span:p,hlGroup:d})}n=n+o.text}return{line:n,highlights:i}}function Nf(r){let e=null,t=null,i="",n=[],o=[],s={},a;a=()=>{let l,u;i.length?i=i.substr(0,i.length-1):o.length&&(l=o.length-1,u=o[l].text,u.length===1?o.pop():o[l].text=u.substr(0,u.length-1))};for(let l=0;l<r.length;l++){if(e!=null){e==""&&r[l]=="["?(i&&(s.text=i,o.push(s),s={},i=""),i==""&&(r[l+1]=="m"||r[l+1]=="K")&&((s.foreground||s.background)&&(s.text="",o.push(s)),s={}),e=null,t=""):(i+=e+r[l],e=null);continue}else if(t!=null){r[l]==";"?(n.push(t),t=""):r[l]=="m"||r[l]=="K"?(n.push(t),t=null,i="",n.forEach(u=>{FB[u]?s.foreground=FB[u]:AB[u]?s.background=AB[u]:u==39?delete s.foreground:u==49?delete s.background:OB[u]?s[OB[u]]=!0:u==22?s.bold=!1:u==23?s.italic=!1:u==24&&(s.underline=!1)}),n=[]):t+=r[l];continue}r[l]==""?e=r[l]:r[l]=="\b"?a():i+=r[l]}return i&&(s.text=i+(e||""),o.push(s)),o}var qpe=["Error","Warning","Info","Hint"],ZTe=j()("markdown-index");hD.default.setOptions({renderer:new dD});function Om(r){let e=[],t=[],i=[],n=0;for(let o of r){let s=e.length,{content:a,filetype:l}=o;if(l=="markdown"){let u=Bpe(a);i.push(...u.codes.map(c=>(c.startLine=c.startLine+s,c.endLine=c.endLine+s,c))),t.push(...u.highlights.map(c=>(c.lnum=c.lnum+s,c))),e.push(...u.lines)}else{let u=a.trim().split(/\r?\n/);qpe.includes(o.filetype)?i.push({hlGroup:`Coc${l}Float`,startLine:s,endLine:s+u.length}):i.push({filetype:o.filetype,startLine:s,endLine:s+u.length}),e.push(...u)}if(o.active){let u=$pe(a,s,o.active);u.length&&t.push(...u)}n!=r.length-1&&e.push("\u2014"),n=n+1}return{lines:e,highlights:t,codes:i}}function $pe(r,e,t){let i=[],[n,o]=t,s=r.split(/\r?\n/),a=0,l=!1;for(let u=0;u<s.length;u++){let c=s[u];if(l)if(a+c.length>o){let f=ue(c.slice(0,o-a));i.push({colStart:0,colEnd:f,lnum:u+e,hlGroup:"CocUnderline"}),l=!1;break}else{let f=ue(c);i.push({colStart:0,colEnd:f,lnum:u+e,hlGroup:"CocUnderline"})}else if(a+c.length>n){l=!0;let f=ue(c.slice(0,n-a));if(a+c.length>o){let p=ue(c.slice(0,o-a));l=!1,i.push({colStart:f,colEnd:p,lnum:u+e,hlGroup:"CocUnderline"});break}else{let p=ue(c);i.push({colStart:f,colEnd:p,lnum:u+e,hlGroup:"CocUnderline"})}}a=a+c.length+1}return i}function Bpe(r){let e=[],t=[],i=[],n=0,o=!1,s,a=0,l=hD.default(r),u=dD.getLinks();u.length&&(l=l+`
`+u.join(`
`));for(let c of l.replace(/\s*$/,"").split(/\n/)){if(!c.length){let p=e[e.length-1];p&&p.length&&(e.push(c),n++);continue}if(/\s*```\s*([A-Za-z0-9_,]+)?$/.test(c)){let p=e[e.length-1];o?(o=!1,i.push({filetype:s,startLine:a,endLine:n})):(o=!0,s=c.replace(/^\s*```\s*/,""),s=="js"&&(s="javascript"),s=="ts"&&(s="typescript"),s=="bash"&&(s="sh"),a=n),p&&p.length&&(e.push(""),n++);continue}if(o){e.push(c),n++;continue}let f=Nl(c,!0);if(f.highlights)for(let p of f.highlights){let{hlGroup:d,span:h}=p;t.push({hlGroup:d,lnum:n,colStart:h[0],colEnd:h[1]})}e.push(f.line),n++}return{lines:e,highlights:t,codes:i}}var ar=class{constructor(){this.tasks=[];this.count=1}sched(){this.count>0&&this.tasks.length>0&&(this.count--,this.tasks.shift()())}get busy(){return this.count==0}acquire(){return new Promise(e=>{let t=()=>{let i=!1;e(()=>{i||(i=!0,this.count++,this.sched())})};this.tasks.push(t),process.nextTick(this.sched.bind(this))})}use(e){return this.acquire().then(t=>e().then(i=>(t(),i)).catch(i=>{throw t(),i}))}};var MB=process.env.VIM_NODE_RPC=="1",NB=j()("model-float"),mD=class{constructor(e){this.nvim=e;this.winid=0;this._bufnr=0;this.mutex=new ar;this.disposables=[];this.alignTop=!1;this.pumAlignTop=!1;this.autoHide=!0;this.mutex=new ar,A.on("BufEnter",t=>{t==this._bufnr||t==this.targetBufnr||this.close()},null,this.disposables),A.on("InsertEnter",t=>{t==this._bufnr||!this.autoHide||this.close()},null,this.disposables),A.on("InsertLeave",()=>{this.close()},null,this.disposables),A.on("MenuPopupChanged",(t,i)=>{(this.pumAlignTop=i>t.row)==this.alignTop&&this.close()},null,this.disposables),this.onCursorMoved=LB.default(this._onCursorMoved.bind(this),300),A.on("CursorMoved",this.onCursorMoved.bind(this,!1),null,this.disposables),A.on("CursorMovedI",this.onCursorMoved.bind(this,!0),null,this.disposables),this.disposables.push(Lm.Disposable.create(()=>{this.onCursorMoved.clear(),this.cancel()}))}_onCursorMoved(e,t,i){if(t!=this._bufnr&&!(t==this.targetBufnr&&Ne(i,this.cursor))){if(this.autoHide){this.close();return}if(!e||t!=this.targetBufnr){this.close();return}}}async create(e,t=!1,i=0){if(this.onCursorMoved.clear(),e.length==0||e.every(o=>o.content.length==0)){this.close();return}let n=await this.mutex.acquire();try{await this.createPopup(e,{offsetX:i}),n()}catch(o){n(),NB.error("Error on create popup:",o.message),this.close()}}async show(e,t={}){if(this.onCursorMoved.clear(),e.length==0||e.every(n=>n.content.length==0)){this.close();return}let i=await this.mutex.acquire();try{await this.createPopup(e,t),i()}catch(n){i(),NB.error("Error on create popup:",n.message),this.close()}}async createPopup(e,t){let n=(this.tokenSource=new Lm.CancellationTokenSource).token;e=e.filter(m=>m.content.trim().length>0);let{lines:o,codes:s,highlights:a}=Om(e),l={pumAlignTop:this.pumAlignTop,preferTop:typeof t.preferTop=="boolean"?t.preferTop:!1,offsetX:t.offsetX||0,title:t.title||"",close:t.close?1:0,codes:s,highlights:a,modes:t.modes||["n","i","ic","s"]};t.maxHeight&&(l.maxHeight=t.maxHeight),t.maxWidth&&(l.maxWidth=t.maxWidth),t.border&&!t.border.every(m=>m==0)&&(l.border=t.border),t.title&&!l.border&&(l.border=[1,1,1,1]),t.highlight&&(l.highlight=t.highlight),t.borderhighlight&&(l.borderhighlight=[t.borderhighlight]),t.cursorline&&(l.cursorline=1),this.autoHide=t.autoHide!=!1,this.autoHide&&(l.autohide=1);let u=await this.nvim.call("coc#float#create_cursor_float",[this.winid,this._bufnr,o,l]);if(MB&&this.nvim.command("redraw",!0),!u||u.length==0){this.winid=null;return}let[c,f,p,d]=u;if(this.winid=p,n.isCancellationRequested){this.close();return}let h=await this.nvim.call("coc#float#cursor_relative",[p]);h&&(this.alignTop=h.row<0),this._bufnr=d,this.tokenSource.dispose(),this.tokenSource=null,this.targetBufnr=c,this.cursor=f,this.onCursorMoved.clear()}close(){let{winid:e,nvim:t}=this;this.cancel(),e&&(this.winid=0,t.pauseNotification(),t.call("coc#float#close",[e],!0),MB&&this.nvim.command("redraw",!0),t.resumeNotification(!1,!0))}cancel(){let{tokenSource:e}=this;e&&(e.cancel(),this.tokenSource=null)}dispose(){z(this.disposables)}get bufnr(){
`),o=n.length-(t.end.line-t.start.line)-1,s=0;if(t.end.line==r.line){let a=jpe(t)&&o==0,l=a?t.end.character-t.start.character:t.end.character;s=(a?i.length:n[n.length-1].length)-l}return{line:o,character:s}}return{line:0,character:0}}function $B(r,e){let{range:t,newText:i}=e;if(Me(t.start,r)>1)return r;let{start:n,end:o}=t,s=i.split(`
`),a=o.line-n.line-s.length+1,l=s[s.length-1],u=r.line-a;if(r.line!=o.line)return{line:u,character:r.character};let c=s.length==1&&n.line!=o.line?n.character:0,f=n.line==o.line&&s.length==1?o.character-n.character:o.character,p=c+r.character+l.length-f;return{line:u,character:p}}function BB(r,e,t){let i=0;for(let n=0;n<=e;n++)n==e?i+=t:i+=r[n].length+1;return i}function jB(r,e,t){if(!Ji(t.range,r))return e;let{start:i,end:n}=t.range,o=e.split(`
`),s=i.line==r.start.line?i.character-r.start.character:i.character,a=BB(o,i.line-r.start.line,s);s=n.line==r.start.line?n.character-r.start.character:n.character;let l=BB(o,n.line-r.start.line,s);return`${e.slice(0,a)}${t.newText}${e.slice(l,e.length)}`}function $l(r,e){let t={line:0,character:0};for(let i of e){let n=gD(r,i);t={line:t.line+n.line,character:t.character+n.character}}return t.line==0&&t.character==0?null:t}var x0=S(require("fs")),Wj=S(require("os")),D0=S(require("path")),Hj=S(W());var uRe=j()("outpubChannel"),vD=class{constructor(e,t){this.name=e;this.nvim=t;this._disposed=!1;this.lines=[""];this.disposables=[]}get content(){return this.lines.join(`
`)}_append(e){let{nvim:t}=this,i=this.lines.length-1,n=e.split(/\r?\n/),o=this.lines[i]+n[0];this.lines[i]=o;let s=n.slice(1);this.lines=this.lines.concat(s),t.pauseNotification(),t.call("setbufline",[this.bufname,"$",o],!0),s.length&&t.call("appendbufline",[this.bufname,"$",s],!0),t.resumeNotification(!1,!0)}append(e){!this.validate()||this._append(e)}appendLine(e){!this.validate()||this._append(e+`
`)}clear(e){if(!this.validate())return;let{nvim:t}=this;this.lines=e?this.lines.slice(-e):[],t.pauseNotification(),t.call("deletebufline",[this.bufname,1,"$"],!0),this.lines.length&&t.call("appendbufline",[this.bufname,"$",this.lines],!0),t.resumeNotification(!1,!0)}hide(){this.nvim.command(`exe 'silent! bd! '.fnameescape('${this.bufname}')`,!0)}get bufname(){return`output:///${this.name}`}show(e){let{nvim:t}=this;t.pauseNotification(),t.command(`exe 'vsplit '.fnameescape('${this.bufname}')`,!0),e&&t.command("wincmd p",!0),t.command("redraw",!0),t.resumeNotification(!1,!0)}validate(){return!this._disposed}dispose(){this._disposed||(this._disposed=!0,this.hide(),this.lines=[],z(this.disposables))}},UB=vD;var No=new Map,WB=class{getProvider(e){return{onDidChange:null,provideTextDocumentContent:async i=>{let n=this.get(i.path.slice(1));return n?(e.pauseNotification(),e.command("setlocal nospell nofoldenable nowrap noswapfile",!0),e.command("setlocal buftype=nofile bufhidden=hide",!0),e.command("setfiletype log",!0),await e.resumeNotification(),n.content):""}}}get names(){return Array.from(No.keys())}get(e){return No.get(e)}create(e,t){if(No.has(e))return No.get(e);if(!/^[\w\s-.]+$/.test(e))throw new Error(`Invalid channel name "${e}", only word characters and white space allowed.`);let i=new UB(e,t);return No.set(e,i),i}show(e,t){let i=No.get(e);!i||i.show(t)}dispose(){for(let e of No.values())e.dispose();No.clear()}},Xs=new WB;var mRe=j()("model-dialog"),yD=class{constructor(e,t){this.nvim=e;this.config=t;this.disposables=[];A.on("BufWinLeave",i=>{i==this.bufnr&&(this.dispose(),t.callback&&t.callback(-1))},null,this.disposables),A.on("FloatBtnClick",(i,n)=>{if(i==this.bufnr){this.dispose();let o=t==null?void 0:t.buttons.filter(s=>s.disabled!=!0);t.callback&&t.callback(o[n].index)}},null,this.disposables)}get lines(){return[...this.config.content.split(/\r?\n/)]}async show(e){let{nvim:t}=this,{title:i,close:n,buttons:o}=this.config,s=this.config.borderhighlight||e.floatBorderHighlight,a=this.config.highlight||e.floatHighlight,l={maxwidth:e.maxWidth||80};i&&(l.title=i),(n||typeof n=="undefined")&&(l.close=1),e.maxHeight&&(l.maxHeight=e.maxHeight),e.maxWidth&&(l.maxWidth=e.maxWidth),a&&(l.highlight=a),s&&(l.borderhighlight=[s]),o&&(l.buttons=o.filter(c=>!c.disabled).map(c=>c.text));let u=await t.call("coc#float#create_dialog",[this.lines,l]);!u[1]||(this.bufnr=u[1],t.command("redraw",!0))}get winid(){return this.bufnr?this.nvim.call("bufwinid",[this.bufnr]):Promise.resolve(null)}dispose(){this.bufnr=void 0,z(this.disposables),this.disposables=[]}},HB=yD;var zB=S(W());var Nm=process.env.VIM_NODE_RPC=="1",bD=class{constructor(e,t,i){this.nvim=e;this.winid=t;this.bufnr=i}get valid(){return this.nvim.call("coc#float#valid",[this.winid]).then(e=>!!e)}close(){this.nvim.call("coc#float#close",[this.winid],!0)}refreshScrollbar(){Nm||this.nvim.call("coc#float#nvim_scrollbar",[this.winid],!0)}execute(e){this.nvim.call("coc#float#execute",[this.winid,e],!0)}click(e,t){let{nvim:i}=this;i.call("win_gotoid",[this.winid],!0),i.call("cursor",[e,t],!0),i.call("coc#float#nvim_float_click",[],!0)}async scrollForward(){let{nvim:e,bufnr:t,winid:i}=this,o=await e.createBuffer(t).length,s;if(Nm)s=await e.eval(`get(popup_getpos(${i}), 'lastline', 0)`);else{let a=await e.call("getwininfo",[i]);if(!a||!a.length)return;s=a[0].botline}s>=o||s==0||(e.pauseNotification(),this.setCursor(s-1),this.execute(`normal! ${s}Gzt`),this.refreshScrollbar(),e.command("redraw",!0),e.resumeNotification(!1,!0))}async scrollBackward(){let{nvim:e,winid:t}=this,i;if(Nm)i=await e.eval(`get(popup_getpos(${t}), 'firstline', 0)`);else{let n=await e.call("getwininfo",[t]);if(!n||!n.length)return;i=n[0].topline}i!=1&&(e.pauseNotification(),this.setCursor(i-1),this.execute(`normal! ${i}Gzb`),this.refreshScrollbar(),e.command("redraw",!0),e.resumeNotification(!1,!0))}setCursor(e){let{nvim:t,bufnr:i,winid:n}=this;Nm?t.call("win_execute",[n,`exe ${e+1}`],!0):(t.createWindow(n).notify("nvim_win_set_cursor",[[e+1,0]]),t.command(`sign unplace 6 buffer=${i}`,!0),t.command(`sign place 6
`,close:t.cancellable==!0,title:t.title},!1);this.option=t;A.on("BufWinLeave",i=>{i==this.bufnr&&(this.tokenSource&&this.tokenSource.cancel(),this.dispose())},null,this.disposables)}async show(e){let{task:t}=this.option,i=this.tokenSource=new XB.CancellationTokenSource;this.disposables.push(i);let n=0;return await new Promise((s,a)=>{i.token.onCancellationRequested(()=>{s(void 0)}),super.show(Object.assign({minWidth:e.minProgressWidth||30,progress:1},e)).then(l=>{l||a(new Error("Failed to create float window"))}).catch(a),t({report:l=>{if(!this.bufnr)return;let u="";l.message&&(u+=l.message.replace(/\r?\n/g," ")),l.increment&&(n+=l.increment,u=u+(u.length?` ${n}%`:`${n}%`)),this.nvim.call("setbufline",[this.bufnr,2,u],!0)}},i.token).then(l=>{this._disposed||(setTimeout(()=>{this.dispose()},100),s(l))},l=>{this._disposed||(this.dispose(),l instanceof Error?a(l):s(void 0))})})}dispose(){super.dispose(),this.tokenSource=void 0}},ZB=SD;var QB=S(require("crypto"));function $f(){return QB.default.randomBytes(16)}var e3=[];for(var $m=0;$m<256;++$m)e3[$m]=($m+256).toString(16).substr(1);function Hpe(r,e){var t=e||0,i=e3;return[i[r[t++]],i[r[t++]],i[r[t++]],i[r[t++]],"-",i[r[t++]],i[r[t++]],"-",i[r[t++]],i[r[t++]],"-",i[r[t++]],i[r[t++]],"-",i[r[t++]],i[r[t++]],i[r[t++]],i[r[t++]],i[r[t++]],i[r[t++]]].join("")}var Bm=Hpe;var t3,ED,CD=0,_D=0;function zpe(r,e,t){var i=e&&t||0,n=e||[];r=r||{};var o=r.node||t3,s=r.clockseq!==void 0?r.clockseq:ED;if(o==null||s==null){var a=r.random||(r.rng||$f)();o==null&&(o=t3=[a[0]|1,a[1],a[2],a[3],a[4],a[5]]),s==null&&(s=ED=(a[6]<<8|a[7])&16383)}var l=r.msecs!==void 0?r.msecs:new Date().getTime(),u=r.nsecs!==void 0?r.nsecs:_D+1,c=l-CD+(u-_D)/1e4;if(c<0&&r.clockseq===void 0&&(s=s+1&16383),(c<0||l>CD)&&r.nsecs===void 0&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");CD=l,_D=u,ED=s,l+=122192928e5;var f=((l&268435455)*1e4+u)%4294967296;n[i++]=f>>>24&255,n[i++]=f>>>16&255,n[i++]=f>>>8&255,n[i++]=f&255;var p=l/4294967296*1e4&268435455;n[i++]=p>>>8&255,n[i++]=p&255,n[i++]=p>>>24&15|16,n[i++]=p>>>16&255,n[i++]=s>>>8|128,n[i++]=s&255;for(var d=0;d<6;++d)n[i+d]=o[d];return e||Bm(n)}var qo=zpe;function Gpe(r,e,t){var i=e&&t||0;typeof r=="string"&&(e=r==="binary"?new Array(16):null,r=null),r=r||{};var n=r.random||(r.rng||$f)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e)for(var o=0;o<16;++o)e[i+o]=n[o];return e||Bm(n)}var he=Gpe;var YRe=j()("model-status"),PD=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],TD=class{constructor(e){this.nvim=e;this.items=new Map;this.shownIds=new Set;this._text="";this.interval=setInterval(()=>{this.setStatusText().logError()},100)}dispose(){clearInterval(this.interval)}createStatusBarItem(e=0,t=!1){let i=qo(),n={text:"",priority:e,isProgress:t,show:()=>{this.shownIds.add(i)},hide:()=>{this.shownIds.delete(i)},dispose:()=>{this.shownIds.delete(i),this.items.delete(i)}};return this.items.set(i,n),n}getText(){if(this.shownIds.size==0)return"";let e=new Date,t=Math.floor(e.getMilliseconds()/100),i="",n=[];for(let[o,s]of this.items)this.shownIds.has(o)&&n.push(s);n.sort((o,s)=>o.priority-s.priority);for(let o of n)o.isProgress?i=`${i} ${PD[t]} ${o.text}`:i=`${i} ${o.text}`;return i}async setStatusText(){let e=this.getText(),{nvim:t}=this;e!=this._text&&(this._text=e,t.pauseNotification(),this.nvim.setVar("coc_status",e,!0),this.nvim.call("coc#util#do_autocmd",["CocStatusChange"],!0),await t.resumeNotification(!1,!0))}},r3=TD;var Kr;(function(r){r[r.Buffer=0]="Buffer",r[r.LanguageServer=1]="LanguageServer",r[r.Global=2]="Global"})(Kr||(Kr={}));var Jr;(function(r){r[r.Global=0]="Global",r[r.Local=1]="Local",r[r.SingleFile=2]="SingleFile",r[r.Internal=3]="Internal"})(Jr||(Jr={}));var Yr;(function(r){r[r.Native=0]="Native",r[r.Remote=1]="Remote",r[r.Service=2]="Service"})(Yr||(Yr={}));var gn;(function(r){r[r.More=0]="More",r[r.Warning=1]="Warning",r[r.Error=2]="Error"})(gn||(gn={}));var pt;(function(r){r[r.Global=0]="Global",r[r.User=1]="User",r[r.Workspace=2]="Workspace"})(pt||(pt={}));var ye;(function(r){r[r.Initi
`;break;case 114:w+="\r";break;case 116:w+=" ";break;case 117:var _=p(4,!0);_>=0?w+=String.fromCharCode(_):f=4;break;default:f=5}E=i;continue}if(P>=0&&P<=31)if(jf(P)){w+=r.substring(E,i),f=2;break}else f=6;i++}return w}function y(){if(n="",f=0,o=i,l=a,c=u,i>=t)return o=t,s=17;var w=r.charCodeAt(i);if(AD(w)){do i++,n+=String.fromCharCode(w),w=r.charCodeAt(i);while(AD(w));return s=15}if(jf(w))return i++,n+=String.fromCharCode(w),w===13&&r.charCodeAt(i)===10&&(i++,n+=`
`),a++,u=i,s=14;switch(w){case 123:return i++,s=1;case 125:return i++,s=2;case 91:return i++,s=3;case 93:return i++,s=4;case 58:return i++,s=6;case 44:return i++,s=5;case 34:return i++,n=m(),s=10;case 47:var E=i-1;if(r.charCodeAt(i+1)===47){for(i+=2;i<t&&!jf(r.charCodeAt(i));)i++;return n=r.substring(E,i),s=12}if(r.charCodeAt(i+1)===42){i+=2;for(var P=t-1,k=!1;i<P;){var _=r.charCodeAt(i);if(_===42&&r.charCodeAt(i+1)===47){i+=2,k=!0;break}i++,jf(_)&&(_===13&&r.charCodeAt(i)===10&&i++,a++,u=i)}return k||(i++,f=1),n=r.substring(E,i),s=13}return n+=String.fromCharCode(w),i++,s=16;case 45:if(n+=String.fromCharCode(w),i++,i===t||!jl(r.charCodeAt(i)))return s=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return n+=h(),s=11;default:for(;i<t&&v(w);)i++,w=r.charCodeAt(i);if(o!==i){switch(n=r.substring(o,i),n){case"true":return s=8;case"false":return s=9;case"null":return s=7}return s=16}return n+=String.fromCharCode(w),i++,s=16}}function v(w){if(AD(w)||jf(w))return!1;switch(w){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function x(){var w;do w=y();while(w>=12&&w<=15);return w}return{setPosition:d,getPosition:function(){return i},scan:e?x:y,getToken:function(){return s},getTokenValue:function(){return n},getTokenOffset:function(){return o},getTokenLength:function(){return i-o},getTokenStartLine:function(){return l},getTokenStartCharacter:function(){return o-c},getTokenError:function(){return f}}}function AD(r){return r===32||r===9||r===11||r===12||r===160||r===5760||r>=8192&&r<=8203||r===8239||r===8287||r===12288||r===65279}function jf(r){return r===10||r===13||r===8232||r===8233}function jl(r){return r>=48&&r<=57}"use strict";function LD(r,e,t){var i,n,o,s,a;if(e){for(s=e.offset,a=s+e.length,o=s;o>0&&!Wf(r,o-1);)o--;for(var l=a;l<r.length&&!Wf(r,l);)l++;n=r.substring(o,l),i=ide(n,t)}else n=r,i=0,o=0,s=0,a=r.length;var u=nde(t,r),c=!1,f=0,p;t.insertSpaces?p=OD(" ",t.tabSize||4):p=" ";var d=Uf(n,!1),h=!1;function m(){return u+OD(p,i+f)}function y(){var R=d.scan();for(c=!1;R===15||R===14;)c=c||R===14,R=d.scan();return h=R===16||d.getTokenError()!==0,R}var v=[];function x(R,F,q){!h&&F<a&&q>s&&r.substring(F,q)!==R&&v.push({offset:F,length:q-F,content:R})}var w=y();if(w!==17){var E=d.getTokenOffset()+o,P=OD(p,i);x(P,o,E)}for(;w!==17;){for(var k=d.getTokenOffset()+d.getTokenLength()+o,_=y(),O="";!c&&(_===12||_===13);){var I=d.getTokenOffset()+o;x(" ",k,I),k=d.getTokenOffset()+d.getTokenLength()+o,O=_===12?m():"",_=y()}if(_===2)w!==1&&(f--,O=m());else if(_===4)w!==3&&(f--,O=m());else{switch(w){case 3:case 1:f++,O=m();break;case 5:case 12:O=m();break;case 13:c?O=m():O=" ";break;case 6:O=" ";break;case 10:if(_===6){O="";break}case 7:case 8:case 9:case 11:case 2:case 4:_===12||_===13?O=" ":_!==5&&_!==17&&(h=!0);break;case 16:h=!0;break}c&&(_===12||_===13)&&(O=m())}var L=d.getTokenOffset()+o;x(O,k,L),w=_}return v}function OD(r,e){for(var t="",i=0;i<e;i++)t+=r;return t}function ide(r,e){for(var t=0,i=0,n=e.tabSize||4;t<r.length;){var o=r.charAt(t);if(o===" ")i++;else if(o===" ")i+=n;else break;t++}return Math.floor(i/n)}function nde(r,e){for(var t=0;t<e.length;t++){var i=e.charAt(t);if(i==="\r")return t+1<e.length&&e.charAt(t+1)===`
`?`\r
`:"\r";if(i===`
`)return`
`}return r&&r.eol||`
`}function Wf(r,e){return`\r
`.indexOf(r.charAt(e))!==-1}"use strict";var Hf;(function(r){r.DEFAULT={allowTrailingComma:!1}})(Hf||(Hf={}));function g3(r,e,t){e===void 0&&(e=[]),t===void 0&&(t=Hf.DEFAULT);var i=null,n=[],o=[];function s(l){Array.isArray(n)?n.push(l):i!==null&&(n[i]=l)}var a={onObjectBegin:function(){var l={};s(l),o.push(n),n=l,i=null},onObjectProperty:function(l){i=l},onObjectEnd:function(){n=o.pop()},onArrayBegin:function(){var l=[];s(l),o.push(n),n=l,i=null},onArrayEnd:function(){n=o.pop()},onLiteralValue:s,onError:function(l,u,c){e.push({error:l,offset:u,length:c})}};return MD(r,a,t),n[0]}function ND(r,e,t){e===void 0&&(e=[]),t===void 0&&(t=Hf.DEFAULT);var i={type:"array",offset:-1,length:-1,children:[],parent:void 0};function n(l){i.type==="property"&&(i.length=l-i.offset,i=i.parent)}function o(l){return i.children.push(l),l}var s={onObjectBegin:function(l){i=o({type:"object",offset:l,length:-1,parent:i,children:[]})},onObjectProperty:function(l,u,c){i=o({type:"property",offset:u,length:-1,parent:i,children:[]}),i.children.push({type:"string",value:l,offset:u,length:c,parent:i})},onObjectEnd:function(l,u){n(l+u),i.length=l+u-i.offset,i=i.parent,n(l+u)},onArrayBegin:function(l,u){i=o({type:"array",offset:l,length:-1,parent:i,children:[]})},onArrayEnd:function(l,u){i.length=l+u-i.offset,i=i.parent,n(l+u)},onLiteralValue:function(l,u,c){o({type:ode(l),offset:u,length:c,parent:i,value:l}),n(u+c)},onSeparator:function(l,u,c){i.type==="property"&&(l===":"?i.colonOffset=u:l===","&&n(u))},onError:function(l,u,c){e.push({error:l,offset:u,length:c})}};MD(r,s,t);var a=i.children[0];return a&&delete a.parent,a}function Wm(r,e){if(!!r){for(var t=r,i=0,n=e;i<n.length;i++){var o=n[i];if(typeof o=="string"){if(t.type!=="object"||!Array.isArray(t.children))return;for(var s=!1,a=0,l=t.children;a<l.length;a++){var u=l[a];if(Array.isArray(u.children)&&u.children[0].value===o){t=u.children[1],s=!0;break}}if(!s)return}else{var c=o;if(t.type!=="array"||c<0||!Array.isArray(t.children)||c>=t.children.length)return;t=t.children[c]}}return t}}function MD(r,e,t){t===void 0&&(t=Hf.DEFAULT);var i=Uf(r,!1);function n(I){return I?function(){return I(i.getTokenOffset(),i.getTokenLength(),i.getTokenStartLine(),i.getTokenStartCharacter())}:function(){return!0}}function o(I){return I?function(L){return I(L,i.getTokenOffset(),i.getTokenLength(),i.getTokenStartLine(),i.getTokenStartCharacter())}:function(){return!0}}var s=n(e.onObjectBegin),a=o(e.onObjectProperty),l=n(e.onObjectEnd),u=n(e.onArrayBegin),c=n(e.onArrayEnd),f=o(e.onLiteralValue),p=o(e.onSeparator),d=n(e.onComment),h=o(e.onError),m=t&&t.disallowComments,y=t&&t.allowTrailingComma;function v(){for(;;){var I=i.scan();switch(i.getTokenError()){case 4:x(14);break;case 5:x(15);break;case 3:x(13);break;case 1:m||x(11);break;case 2:x(12);break;case 6:x(16);break}switch(I){case 12:case 13:m?x(10):d();break;case 16:x(1);break;case 15:case 14:break;default:return I}}}function x(I,L,R){if(L===void 0&&(L=[]),R===void 0&&(R=[]),h(I),L.length+R.length>0)for(var F=i.getToken();F!==17;){if(L.indexOf(F)!==-1){v();break}else if(R.indexOf(F)!==-1)break;F=v()}}function w(I){var L=i.getTokenValue();return I?f(L):a(L),v(),!0}function E(){switch(i.getToken()){case 11:var I=i.getTokenValue(),L=Number(I);isNaN(L)&&(x(2),L=0),f(L);break;case 7:f(null);break;case 8:f(!0);break;case 9:f(!1);break;default:return!1}return v(),!0}function P(){return i.getToken()!==10?(x(3,[],[2,5]),!1):(w(!1),i.getToken()===6?(p(":"),v(),O()||x(4,[],[2,5])):x(5,[],[2,5]),!0)}function k(){s(),v();for(var I=!1;i.getToken()!==2&&i.getToken()!==17;){if(i.getToken()===5){if(I||x(4,[],[]),p(","),v(),i.getToken()===2&&y)break}else I&&x(6,[],[]);P()||x(4,[],[2,5]),I=!0}return l(),i.getToken()!==2?x(7,[2],[]):v(),!0}function _(){u(),v();for(var I=!1;i.getToken()!==4&&i.getToken()!==17;){if(i.getToken()===5){if(I||x(4,[],[]),p(","),v(),i.getToken()===4&&y)break}else I&&x(6,[],[]);O()||x(4,[],[4,5]),I=!0}return c(),i.getToken()!==4?x(8,[4],[]):v(),!0}function O(){switch(i.getToken()){case 3:return _();case 1:return k();case 10:return w(!0);default:return E()}}ret
`&&r[a]==`
`&&s.startsWith(`
`))return{start:a+1,end:f+1,newText:s.slice(1)+`
`}}return{start:a,end:f,newText:s}}function ij(r,e,t=" "){if(r==e)return e;let i=e.indexOf(r);if(i!==-1)return t.repeat(i)+r;let n=Xm.default(r,e),o="";for(let s of n){if(s[0]==Xm.default.DELETE)return e;s[0]==Xm.default.INSERT?o=o+t.repeat(ue(s[1])):o=o+s[1]}return o}var mke=j()("model-chars"),_i=class{constructor(e,t){this.start=e,this.end=t||e}static fromKeywordOption(e){let t=e.split(","),i=[];for(let n of t)if(n=="@")i.push(new _i(65,90)),i.push(new _i(97,122));else if(n=="@-@")i.push(new _i(64));else if(/^([A-Za-z])-([A-Za-z])$/.test(n)){let o=n.match(/^([A-Za-z])-([A-Za-z])$/);i.push(new _i(o[1].charCodeAt(0),o[2].charCodeAt(0)))}else if(/^\d+-\d+$/.test(n)){let o=n.match(/^(\d+)-(\d+)$/);i.push(new _i(Number(o[1]),Number(o[2])))}else if(/^\d+$/.test(n))i.push(new _i(Number(n)));else{let o=n.charCodeAt(0);i.some(s=>s.contains(o))||i.push(new _i(o))}return i}contains(e){return e>=this.start&&e<=this.end}},Xf=class{constructor(e){this.ranges=[];e&&(this.ranges=_i.fromKeywordOption(e))}addKeyword(e){let t=e.charCodeAt(0),{ranges:i}=this;i.some(n=>n.contains(t))||i.push(new _i(t))}clone(){let e=new Xf;return e.ranges=this.ranges.slice(),e}setKeywordOption(e){this.ranges=_i.fromKeywordOption(e)}matchKeywords(e,t=3){let i=e.length;if(i==0)return[];let n=new Set,o="",s=0;for(let a=0;a<i;a++){let l=e[a],u=l.codePointAt(0);if(s==0&&u==45)continue;if(this.isKeywordCode(u)){if(s==48)continue;o=o+l,s=s+1}else s>=t&&s<48&&n.add(o),o="",s=0}return s!=0&&n.add(o),Array.from(n)}isKeywordCode(e){return e>255?!0:e<33?!1:this.ranges.some(t=>t.contains(e))}isKeywordChar(e){let{ranges:t}=this,i=e.charCodeAt(0);return i>255?!0:i<33?!1:t.some(n=>n.contains(i))}isKeyword(e){let{ranges:t}=this;for(let i=0,n=e.length;i<n;i++){let o=e.charCodeAt(i);if(o>255)return!1;if(!t.some(s=>s.contains(o)))return!1}return!0}};function Lde(r,e,t=0){let i=e?[t]:[];for(let n=0;n<r.length;n++){let o=r.charCodeAt(n);(o===13||o===10)&&(o===13&&n+1<r.length&&r.charCodeAt(n+1)===10&&n++,i.push(t+n+1))}return i}var e0=class{constructor(e,t,i,n,o){this.uri=e;this.languageId=t;this.version=i;this.lines=n;this.eol=o}get _content(){return this.lines.join(`
`)+(this.eol?`
`:"")}get lineCount(){return this.lines.length+(this.eol?1:0)}getText(e){if(e){let t=this.offsetAt(e.start),i=this.offsetAt(e.end);return this._content.substring(t,i)}return this._content}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let t=this.getLineOffsets(),i=0,n=t.length;if(n===0)return{line:0,character:e};for(;i<n;){let s=Math.floor((i+n)/2);t[s]>e?n=s:i=s+1}let o=i-1;return{line:o,character:e-t[o]}}offsetAt(e){let t=this.getLineOffsets();if(e.line>=t.length)return this._content.length;if(e.line<0)return 0;let i=t[e.line],n=e.line+1<t.length?t[e.line+1]:this._content.length;return Math.max(Math.min(i+e.character,n),i)}getLineOffsets(){return this._lineOffsets===void 0&&(this._lineOffsets=Lde(this._content,!0)),this._lineOffsets}};var nj=j()("model-document"),r0=class{constructor(e,t,i){this.buffer=e;this.env=t;this.maxFileSize=i;this.isIgnored=!1;this.mutex=new ar;this._version=1;this.size=0;this.eol=!0;this.lines=[];this.syncLines=[];this._attached=!1;this._previewwindow=!1;this._winid=-1;this._words=[];this._onDocumentChange=new Zi.Emitter;this._onDocumentDetach=new Zi.Emitter;this.disposables=[];this.onDocumentChange=this._onDocumentChange.event;this.onDocumentDetach=this._onDocumentDetach.event;this.fireContentChanges=t0.default(()=>{this._fireContentChanges()},100),this.fetchContent=t0.default(()=>{this._fetchContent().logError()},100)}get content(){return this.syncLines.join(`
`)+(this.eol?`
`:"")}get version(){return this._version}get bufnr(){return this.buffer.id}get filetype(){return this._filetype}get uri(){return this._uri}get shouldAttach(){let{buftype:e,maxFileSize:t}=this;return this.getVar("enabled",!0)?this.uri.endsWith("%5BCommand%20Line%5D")?!0:this.size==-2||t&&this.size>t?!1:e==""||e=="acwrite":!1}get isCommandLine(){return this.uri&&this.uri.endsWith("%5BCommand%20Line%5D")}get enabled(){return this.getVar("enabled",!0)}get words(){return this._words}convertFiletype(e){let t=this.env.filetypeMap;return e=="javascript.jsx"?"javascriptreact":e=="typescript.jsx"||e=="typescript.tsx"?"typescriptreact":t[e]||e}get changedtick(){return this._changedtick}get schema(){return $.parse(this.uri).scheme}get lineCount(){return this.lines.length}get winid(){return this._winid}get previewwindow(){return this._previewwindow}async init(e,t){this.nvim=e;let i=await e.call("coc#util#get_bufoptions",[this.bufnr,this.maxFileSize]);if(i==null)return!1;let n=this.buftype=i.buftype;if(this._previewwindow=i.previewwindow,this._winid=i.winid,this.size=typeof i.size=="number"?i.size:0,this.variables=i.variables||{},this._changedtick=i.changedtick,this.eol=i.eol==1,this._uri=uq(i.fullpath,this.bufnr,n,this.env.isCygwin),t.isCancellationRequested)return!1;if(this.shouldAttach){if(this.lines=i.lines,this.syncLines=this.lines,!await this.attach())return!1;this._attached=!0}return this._filetype=this.convertFiletype(i.filetype),this.setIskeyword(i.iskeyword),t.isCancellationRequested?(this.detach(),!1):!0}async attach(){return await this.buffer.attach(!0)?(this.buffer.listen("lines",this.onChange.bind(this),this.disposables),this.buffer.listen("detach",async t=>{this._onDocumentDetach.fire(t.id)},this.disposables),!0):!1}async onChange(e,t,i,n,o){e.id!==this.bufnr||!this._attached||t==null||this.mutex.busy||t>this._changedtick&&(this._changedtick=t,this.lines=[...this.lines.slice(0,i),...o,...this.lines.slice(n)],this.fireContentChanges())}async checkDocument(){let{buffer:e}=this,t=await this.mutex.acquire();this.fireContentChanges.clear(),this._changedtick=await e.changedtick,this.lines=await e.lines,this._fireContentChanges()&&await He(30),t()}get dirty(){return this.lines===this.syncLines?!1:!Ne(this.lines,this.syncLines)}_fireContentChanges(){let{cursor:e}=A,{textDocument:t}=this;try{let i=null;e&&e.bufnr==this.bufnr&&(i=this.getEndOffset(e.lnum,e.col,e.insert));let n=this.getDocumentContent(),o=rj(t.getText(),n,i);if(o==null)return;let s=t.positionAt(o.start),a=t.positionAt(o.end),l=t.getText(Zi.Range.create(s,a));this._version=this._version+1,this.syncLines=this.lines;let u=[{range:{start:s,end:a},rangeLength:o.end-o.start,text:o.newText}];return this._onDocumentChange.fire({bufnr:this.bufnr,original:l,textDocument:{version:this.version,uri:this.uri},contentChanges:u}),this._words=this.chars.matchKeywords(n),!0}catch(i){nj.error(i.message)}return!1}async applyEdits(e){if(!Array.isArray(arguments[0])&&Array.isArray(arguments[1])&&(e=arguments[1]),e.length==0)return;let t=this.getDocumentContent(),i=kt.create(this.uri,this.filetype,1,t),n=kt.applyEdits(i,e);if(Hn&&(n=n.replace(/\r\n/g,`
`)),t!==n){let o=(this.eol&&n.endsWith(`
`)?n.slice(0,-1):n).split(`
`),s=tj(this.lines,o),a=await this.mutex.acquire();try{let l=await this.nvim.call("coc#util#set_lines",[this.bufnr,s.replacement,s.start,s.end]);this._changedtick=l.changedtick,this.lines=o,this.fireContentChanges.clear(),this._fireContentChanges(),Ne(o,l.lines)||process.nextTick(()=>{this.lines=l.lines,this.fireContentChanges.clear(),this._fireContentChanges()}),a()}catch(l){nj.error("Error on applyEdits: ",l),a()}}}async changeLines(e){let t=[],i=this.lines.slice();for(let[o,s]of e)i[o]!=s&&(t.push([o,s]),i[o]=s);if(!t.length)return;let n=await this.mutex.acquire();try{let o=await this.nvim.call("coc#util#change_lines",[this.bufnr,t]);o!=null&&(this.lines=i,this._changedtick=o.changedtick,this.fireContentChanges.clear(),this._fireContentChanges(),Ne(i,o.lines)||process.nextTick(()=>{this.lines=o.lines,this.fireContentChanges.clear(),this._fireContentChanges()})),n()}catch(o){n()}}forceSync(){this.mutex.busy||(this.fireContentChanges.clear(),this._fireContentChanges())}getOffset(e,t){return this.textDocument.offsetAt({line:e-1,character:t})}isWord(e){return this.chars.isKeyword(e)}getMoreWords(){let e=[],{words:t,chars:i}=this;if(!i.isKeywordChar("-"))return e;for(let n of t)if(n=n.replace(/^-+/,""),n.includes("-")){let o=n.split("-");for(let s of o)s.length>2&&!e.includes(s)&&!t.includes(s)&&e.push(s)}return e}getWordRangeAtPosition(e,t,i=!0){let n=this.chars.clone();if(t&&t.length)for(let l of t)n.addKeyword(l);let o=this.getline(e.line,i);if(o.length==0||e.character>=o.length||!n.isKeywordChar(o[e.character]))return null;let s=e.character,a=e.character+1;if(!n.isKeywordChar(o[s]))return Zi.Range.create(e,{line:e.line,character:e.character+1});for(;s>=0;){let l=o[s-1];if(!l||!n.isKeyword(l))break;s=s-1}for(;a<=o.length;){let l=o[a];if(!l||!n.isKeywordChar(l))break;a=a+1}return Zi.Range.create(e.line,s,e.line,a)}get textDocument(){let{version:e,filetype:t,uri:i}=this;return new e0(i,t,e,this.syncLines,this.eol)}async _fetchContent(){if(!this.env.isVim||!this._attached)return;let{nvim:e,bufnr:t,changedtick:i}=this,n=await this.mutex.acquire(),o=await e.call("coc#util#get_buf_lines",[t,i]);o&&o.changedtick>=this._changedtick&&(this._changedtick=o.changedtick,this.lines=o.lines,this.fireContentChanges.clear(),this._fireContentChanges()),n()}async patchChange(e){if(!!this._attached)if(this.env.isVim)if(e){let t=await this.nvim.call("coc#util#get_changeinfo",[]);if(t.changedtick<this._changedtick)return;let{lnum:i,line:n,changedtick:o}=t,s=this.lines.slice();if(this._changedtick=o,s[i-1]==n)return;s[i-1]=n,this.lines=s,this.forceSync()}else this.fetchContent.clear(),await this._fetchContent();else this.forceSync()}getSymbolRanges(e){this.forceSync();let t=[],{textDocument:i}=this,n=i.getText(),o="";for(let s=0,a=n.length;s<a;s++){let l=n[s];if(l=="-"&&o.length==0)continue;let u=this.chars.isKeywordChar(l);u&&(o=o+l),o.length>0&&!u&&o==e&&t.push(Zi.Range.create(i.positionAt(s-o.length),i.positionAt(s))),u||(o="")}return t}fixStartcol(e,t){let i=this.getline(e.line);if(!i)return null;let{character:n}=e,o=i.slice(0,n),s=ue(o),{chars:a}=this;for(let l=o.length-1;l>=0;l--){let u=o[l];if(u==" "||!a.isKeywordChar(u)&&!t.includes(u))break;s=s-ue(u)}return s}getline(e,t=!0){return t?this.lines[e]||"":this.syncLines[e]||""}getLines(e,t){return this.lines.slice(e,t)}getDocumentContent(){let e=this.lines.join(`
`);return this.eol?e+`
`:e}getVar(e,t){let i=this.variables[`coc_${e}`];return i===void 0?t:i}getPosition(e,t){let i=this.getline(e-1);if(!i||t==0)return{line:e-1,character:0};let n=Rt(i,0,t-1);return{line:e-1,character:n.length}}getEndOffset(e,t,i){let n=0,o=this.lines.length;for(let s=e-1;s<o;s++){let a=this.lines[s],l=a.length;if(s==e-1&&l!=0){let u=global.Buffer.from(a,"utf8");u.byteLength<=t-1||(n=n+u.slice(t-1,u.length).toString("utf8").length,i||(n=n-1))}else n=n+l;if(!this.eol&&s==o-1)break;n=n+1}return n}setFiletype(e){this._filetype=this.convertFiletype(e),this._version=this._version+1}setIskeyword(e){let t=this.chars=new Xf(e),i=this.getVar("additional_keywords",[]);if(i&&Array.isArray(i))for(let o of i)t.addKeyword(o);let n=this.lines.length>3e4?this.lines.slice(0,3e4):this.lines;this._words=this.chars.matchKeywords(n.join(`
`))}get attached(){return this._attached}detach(){this._attached=!1,z(this.disposables),this.disposables=[],this.fetchContent.clear(),this.fireContentChanges.clear(),this._onDocumentChange.dispose(),this._onDocumentDetach.dispose()}getLocalifyBonus(e,t){let i=new Map,{chars:n}=this,o=Math.max(0,e.line-100),s=Math.min(this.lineCount,e.line+100),a=this.lines.slice(o,s).join(`
`);e=Zi.Position.create(e.line-o,e.character),t=Zi.Position.create(t.line-o,t.character);let l=kt.create(this.uri,this.filetype,1,a),u=l.offsetAt(e),c=a.length,f=c-l.offsetAt(t),p=0,d=!1;for(let h=0;h<u;h++){let m=n.isKeyword(a[h]);if(!d&&m)p=h;else if(d&&(!m||h==u-1)&&h-p>1){let y=a.slice(p,h);i.set(y,h/u)}d=m}p=c-f,d=!1;for(let h=p;h<a.length;h++){let m=n.isKeyword(a[h]);if(!d&&m)p=h;else if(d&&(!m||h==c-1)&&h-p>1){let y=h==c-1?h+1:h,v=a.slice(p,y),x=i.get(v)||0;i.set(v,Math.max(x,(c-h+(y-p))/f))}d=m}return i}},Zm=r0;var Zf=S(W());var sj=S(Qs()),zl=S(require("path"));function Qm(r,e){let t=[[],[]];for(let i of r)e(i)?t[0].push(i):t[1].push(i);return t}function oj(r,e){let t=r.length,i=[];for(let n=0;n<Math.ceil(t/e);n++)i.push(r.slice(n*e,(n+1)*e));return i}function eg(r,e){if(!e)return r.filter((i,n)=>r.indexOf(i)===n);let t=Object.create(null);return r.filter(i=>{let n=e(i);return t[n]?!1:(t[n]=!0,!0)})}var aj=j()("filesystem-watcher"),i0=class{constructor(e,t,i,n,o){this.globPattern=t;this.ignoreCreateEvents=i;this.ignoreChangeEvents=n;this.ignoreDeleteEvents=o;this._onDidCreate=new Zf.Emitter;this._onDidChange=new Zf.Emitter;this._onDidDelete=new Zf.Emitter;this._onDidRename=new Zf.Emitter;this.onDidCreate=this._onDidCreate.event;this.onDidChange=this._onDidChange.event;this.onDidDelete=this._onDidDelete.event;this.onDidRename=this._onDidRename.event;this.disposables=[];!e||e.then(s=>{if(s)return this.listen(s)}).catch(s=>{aj.error("watchman initialize failed"),aj.error(s.stack)})}async listen(e){let{globPattern:t,ignoreCreateEvents:i,ignoreChangeEvents:n,ignoreDeleteEvents:o}=this,s=await e.subscribe(t,a=>{let{root:l,files:u}=a;u=u.filter(c=>c.type=="f"&&sj.default(c.name,t,{dot:!0}));for(let c of u){let f=$.file(zl.default.join(l,c.name));c.exists?c.new===!0?i||this._onDidCreate.fire(f):n||this._onDidChange.fire(f):o||this._onDidDelete.fire(f)}if(u.length==2&&!u[0].exists&&u[1].exists){let c=u[0],f=u[1];c.size==f.size&&this._onDidRename.fire({oldUri:$.file(zl.default.join(l,c.name)),newUri:$.file(zl.default.join(l,f.name))})}if(u.length>=2){let[c,f]=Qm(u,p=>p.exists===!1);if(c.length==f.length)for(let p of c){let d=f.find(h=>h.size==p.size&&h.mtime_ms==p.mtime_ms);d&&this._onDidRename.fire({oldUri:$.file(zl.default.join(l,p.name)),newUri:$.file(zl.default.join(l,d.name))})}}});return this.disposables.push(s),s}dispose(){z(this.disposables)}},tg=i0;var n0=S(require("path")),Uo=S($i()),o0=class{constructor(e,t){this.name=e;this.file=n0.default.join(t||process.env.COC_DATA_HOME,e)}async load(){let e=n0.default.dirname(this.file);try{Uo.default.mkdirpSync(e),Uo.default.existsSync(this.file)||Uo.default.writeFileSync(this.file,"","utf8");let t=await Uo.default.readFile(this.file,"utf8");return t=t.trim(),t.length?t.trim().split(`
`):[]}catch(t){return[]}}async add(e){let t=await this.load(),i=t.indexOf(e);i!==-1&&t.splice(i,1),t.unshift(e),Uo.default.writeFileSync(this.file,t.join(`
`),"utf8")}async remove(e){let t=await this.load(),i=t.indexOf(e);i!==-1&&(t.splice(i,1),Uo.default.writeFileSync(this.file,t.join(`
`),"utf8"))}async clean(){try{await Uo.default.unlink(this.file)}catch(e){}}},Gl=o0;var Vl=S(require("path")),lj=S(require("fs"));var Uke=j()("util-decorator");function s0(r,e,t){let i=t.value;if(typeof i!="function")return;let n="$"+e;t.value=function(...o){return this.hasOwnProperty(n)?Promise.resolve(this[n]):new Promise((s,a)=>{Promise.resolve(i.apply(this,o)).then(l=>{this[n]=l,s(l)},l=>{a(l)})})}}var a0=S(iD()),Vke=j()("model-resolver"),Qf=class{get nodeFolder(){return gf("npm")?hn("npm --loglevel silent root -g",{},3e3).then(e=>a0.default(e).trim()):Promise.resolve("")}get yarnFolder(){return gf("yarnpkg")?hn("yarnpkg global dir",{},3e3).then(e=>{let t=Vl.default.join(a0.default(e).trim(),"node_modules");return lj.default.existsSync(t)?t:""}):Promise.resolve("")}async resolveModule(e){let t=await this.nodeFolder,i=await this.yarnFolder;if(i){let n=await Ht(Vl.default.join(i,e,"package.json"));if(n&&n.isFile())return Vl.default.join(i,e)}if(t){let n=await Ht(Vl.default.join(t,e,"package.json"));if(n&&n.isFile())return Vl.default.join(t,e)}return null}};Ty([s0],Qf.prototype,"nodeFolder",1),Ty([s0],Qf.prototype,"yarnFolder",1);var uj=Qf;var rg=S(W());var l0=class{constructor(e,t){this.nvim=e;this.id=t;this.disposables=[];this._onExit=new rg.Emitter;this._onStderr=new rg.Emitter;this._onStdout=new rg.Emitter;this.onExit=this._onExit.event;this.onStdout=this._onStdout.event;this.onStderr=this._onStderr.event;A.on("TaskExit",(o,s)=>{o==this.id&&this._onExit.fire(s)},null,this.disposables),A.on("TaskStderr",(o,s)=>{o==this.id&&this._onStderr.fire(s)},null,this.disposables);let i=[],n;A.on("TaskStdout",(o,s)=>{o==this.id&&(n&&clearTimeout(n),i.push(...s),n=setTimeout(()=>{this._onStdout.fire(i),i=[]},100))},null,this.disposables)}async start(e){let{nvim:t}=this;return await t.call("coc#task#start",[this.id,e])}async stop(){let{nvim:e}=this;await e.call("coc#task#stop",[this.id])}get running(){let{nvim:e}=this;return e.call("coc#task#running",[this.id])}dispose(){let{nvim:e}=this;e.call("coc#task#stop",[this.id],!0),this._onStdout.dispose(),this._onStderr.dispose(),this._onExit.dispose(),z(this.disposables)}},cj=l0;var eIe=j()("model-terminal"),u0=class{constructor(e,t,i,n){this.cmd=e;this.args=t;this.nvim=i;this._name=n;this.pid=0}async start(e,t){let{nvim:i}=this,n=[this.cmd,...this.args],[o,s]=await i.call("coc#terminal#start",[n,e,t||{}]);this.bufnr=o,this.pid=s}get name(){return this._name||this.cmd}get processId(){return Promise.resolve(this.pid)}sendText(e,t=!0){!this.bufnr||this.nvim.call("coc#terminal#send",[this.bufnr,e,t],!0)}async show(e){let{bufnr:t,nvim:i}=this;if(!t)return;let[n,o,s]=await i.eval(`[bufloaded(${t}),bufwinid(${t}),win_getid()]`);return n?(s==o||(i.pauseNotification(),o==-1?(i.command(`below ${t}sb`,!0),i.command("resize 8",!0),i.call("coc#util#do_autocmd",["CocTerminalOpen"],!0)):i.call("win_gotoid",[o],!0),i.command("normal! G",!0),e&&i.command("wincmd p",!0),await i.resumeNotification()),!0):!1}async hide(){let{bufnr:e,nvim:t}=this;if(!e)return;let i=await t.call("bufwinnr",e);i!=-1&&await t.command(`${i}close!`)}dispose(){let{bufnr:e,nvim:t}=this;!e||t.call("coc#terminal#close",[e],!0)}},fj=u0;var c0=class{constructor(e,t){this._create=e;this.workspace=t;this.disposables=[];this.itemsMap=new Map;let{disposables:i}=this;for(let n of t.documents)this.create(n);t.onDidOpenTextDocument(n=>{let o=t.getDocument(n.bufnr);o&&this.create(o)},null,i),t.onDidChangeTextDocument(n=>{this.onChange(n)},null,i),t.onDidCloseTextDocument(n=>{this.delete(n.bufnr)},null,i)}get items(){return Array.from(this.itemsMap.values()).map(e=>e.item)}getItem(e){var i;if(typeof e=="number")return(i=this.itemsMap.get(e))==null?void 0:i.item;let t=Array.from(this.itemsMap.values()).find(n=>n.uri==e);return t?t.item:void 0}create(e){if(!e||e.isCommandLine||!e.attached)return;let t=this.itemsMap.get(e.bufnr);t&&t.item.dispose();let i=this._create(e);i&&this.itemsMap.set(e.bufnr,{uri:e.uri,item:i})}onChange(e){let t=this.itemsMap.get(e.bufnr);t&&typeof t.item.onChange=="function"&&t.item.onChange(e)}delete(e){let t=this.item
`)+`
`}get document(){return new Promise((e,t)=>{this.nvim.buffer.then(i=>{let n=i.id;if(this.bufnr=n,this.buffers.has(n)){e(this.buffers.get(n));return}this.onBufCreate(n).catch(t);let o=this.onDidOpenTextDocument(s=>{o.dispose(),e(this.getDocument(s.uri))})},t)})}async getCurrentState(){let e=await this.document,t=await C.getCursorPosition();return{document:e.textDocument,position:t}}async getFormatOptions(e){let t;e&&(t=this.getDocument(e));let i=t?t.bufnr:0,[n,o]=await this.nvim.call("coc#util#get_format_opts",[i]);return{tabSize:n,insertSpaces:o==1}}async jumpTo(e,t,i){let n=this.getConfiguration("coc.preferences"),o=i||n.get("jumpCommand","edit"),{nvim:s}=this,a=this.getDocument(e),l=a?a.bufnr:-1;if(l!=-1&&o=="edit"){if(s.pauseNotification(),s.command("silent! normal! m'",!0),s.command(`buffer ${l}`,!0),t){let u=a.getline(t.line),c=ue(u.slice(0,t.character))+1;s.call("cursor",[t.line+1,c],!0)}this.isVim&&s.command("redraw",!0),await s.resumeNotification()}else{let{fsPath:u,scheme:c}=$.parse(e),f=t==null?null:[t.line,t.character];if(c=="file"){let p=Kf(ke.default.normalize(u));await this.nvim.call("coc#util#jump",[o,p,f])}else Qi.default.platform()=="win32"&&(e=e.replace(/\/?/,"?")),await this.nvim.call("coc#util#jump",[o,e,f])}}async createFile(e,t={}){let i=await Ht(e);if(i&&!t.overwrite&&!t.ignoreIfExists){C.showMessage(`${e} already exists!`,"error");return}if(!i||t.overwrite)if(e.endsWith("/"))try{e=this.expand(e),await Dt.default.mkdirp(e)}catch(n){C.showMessage(`Can't create ${e}: ${n.message}`,"error")}else{let n=$.file(e).toString();if(this.getDocument(n))return;Dt.default.existsSync(ke.default.dirname(e))||Dt.default.mkdirpSync(ke.default.dirname(e)),Dt.default.writeFileSync(e,"","utf8"),await this.loadFile(n)}}async loadFile(e){let t=this.getDocument(e);if(t)return t;let{nvim:i}=this,n=e.startsWith("file")?$.parse(e).fsPath:e;return i.call("coc#util#open_files",[[n]],!0),await new Promise((o,s)=>{let a=this.onDidOpenTextDocument(u=>{let c=$.parse(u.uri).fsPath;(u.uri==e||c==n)&&(clearTimeout(l),a.dispose(),o(this.getDocument(e)))}),l=setTimeout(()=>{a.dispose(),s(new Error(`Create document ${e} timeout after 1s.`))},1e3)})}async loadFiles(e){if(e=e.filter(n=>this.getDocument(n)==null),!(!e.length||!(await this.nvim.call("coc#util#open_files",[e.map(n=>$.parse(n).fsPath)])).filter(n=>this.getDocument(n)==null).length))return new Promise((n,o)=>{let s=setTimeout(()=>{a.dispose(),o(new Error("Create document timeout after 2s."))},2e3),a=this.onDidOpenTextDocument(()=>{e.every(l=>this.getDocument(l)!=null)&&(clearTimeout(s),a.dispose(),n())})})}async renameFile(e,t,i={}){let{overwrite:n,ignoreIfExists:o}=i,{nvim:s}=this;try{let a=await Ht(t);if(a&&!n&&!o)throw new Error(`${t} already exists`);if(!a||n){let l=$.file(e).toString(),u=$.file(t).toString(),c=this.getDocument(l);if(c!=null){let f=c.bufnr==this.bufnr,p=this.getDocument(u);p&&await this.nvim.command(`silent ${p.bufnr}bwipeout!`);let d=c.getDocumentContent();if(await Dt.default.writeFile(t,d,"utf8"),!f)await s.call("coc#util#open_files",[[t]]),await s.command(`silent ${c.bufnr}bwipeout!`);else{let h=await s.call("winsaveview");s.pauseNotification(),s.call("coc#util#open_file",["keepalt edit",t],!0),s.command(`silent ${c.bufnr}bwipeout!`,!0),s.call("winrestview",[h],!0),await s.resumeNotification()}await Dt.default.unlink(e)}else await K3(e,t)}}catch(a){C.showMessage(`Rename error: ${a.message}`,"error")}}async deleteFile(e,t={}){let{ignoreIfNotExists:i,recursive:n}=t,o=await Ht(e.replace(/\/$/,"")),s=o&&o.isDirectory();if(e.endsWith("/")&&!s){C.showMessage(`${e} is not directory`,"error");return}if(!o&&!i){C.showMessage(`${e} not exists`,"error");return}if(o!=null){if(s&&!n){C.showMessage("Can't remove directory, recursive not set","error");return}try{if(s&&n?await Dt.default.remove(e):s?await Dt.default.rmdir(e):await Dt.default.unlink(e),!s){let a=$.file(e).toString(),l=this.getDocument(a);l&&await this.nvim.command(`silent! bwipeout! ${l.bufnr}`)}}catch(a){C.showMessage(`Error on delete ${e}: ${a.message}`,"error")}}}async openResource(e){let{nvim:t}=t
augroup coc_dynamic_autocmd
autocmd!
${i.join(`
`)}
augroup end`;try{let o=ke.default.join(process.env.TMPDIR,`coc.nvim-${process.pid}`);Dt.default.existsSync(o)||Dt.default.mkdirpSync(o);let s=ke.default.join(o,`coc-${process.pid}.vim`);Dt.default.writeFileSync(s,n,"utf8");let a=`source ${s}`;this.env.isCygwin&&Cl.isWindows&&(a=`execute "source" . substitute(system('cygpath ${s.replace(/\\/g,"/")}'), '\\n', '', 'g')`),this.nvim.command(a).logError()}catch(o){C.showMessage(`Can't create tmp file: ${o.message}`,"error")}}async onBufReadCmd(e,t){let i=this.schemeProviderMap.get(e);if(!i){C.showMessage(`Provider for ${e} not found`,"error");return}let n=new le.CancellationTokenSource,o=await Promise.resolve(i.provideTextDocumentContent($.parse(t),n.token)),s=await this.nvim.buffer;await s.setLines(o.split(/\r?\n/),{start:0,end:-1,strictIndexing:!1}),setTimeout(async()=>{await A.fire("BufCreate",[s.id])},30)}async attach(){if(this._attached)return;this._attached=!0;let[e,t,i]=await this.nvim.eval(`[map(getbufinfo({'bufloaded': 1}),'v:val["bufnr"]'),bufnr('%'),win_getid()]`);this.bufnr=t,await Promise.all(e.map(n=>this.onBufCreate(n))),this._initialized||(this._onDidWorkspaceInitialized.fire(void 0),this._initialized=!0),await A.fire("BufEnter",[t]),await A.fire("BufWinEnter",[t,i])}getChangedUris(e){let t=new Set,i=new Set;for(let n of e)if(le.TextDocumentEdit.is(n)){let{textDocument:o}=n,{uri:s,version:a}=o;if(t.add(s),a!=null&&a>0){let l=this.getDocument(s);if(!l)throw new Error(`${s} not loaded`);if(l.version!=a)throw new Error(`${s} changed before apply edit`)}}else if(le.CreateFile.is(n)||le.DeleteFile.is(n)){if(!Jm(n.uri))throw new Error(`change of scheme ${n.uri} not supported`);i.add(n.uri),t.add(n.uri)}else if(le.RenameFile.is(n)){if(!Jm(n.oldUri)||!Jm(n.newUri))throw new Error(`change of scheme ${n.oldUri} not supported`);let o=$.parse(n.newUri).fsPath;if(Dt.default.existsSync(o))throw new Error(`file "${o}" already exists for rename`);t.add(n.oldUri)}else throw new Error(`Invalid document change: ${JSON.stringify(n,null,2)}`);return Array.from(t)}createConfigurations(){let e=ke.default.normalize(process.env.COC_VIMCONFIG)||ke.default.join(Qi.default.homedir(),".vim"),t=ke.default.join(e,Gi);return new Q3(t,new ej(this))}attachChangedEvents(){if(this.isVim){let e=t=>{let i=this.getDocument(t);i&&i.attached&&i.fetchContent()};A.on("TextChangedI",e,null,this.disposables),A.on("TextChanged",e,null,this.disposables)}}async onBufCreate(e){let t=typeof e=="number"?this.nvim.createBuffer(e):e,i=t.id;if(this.creatingSources.has(i))return;let n=this.getDocument(i),o=new le.CancellationTokenSource;try{n&&this.onBufUnload(i,!0),n=new Zm(t,this._env,this.maxFileSize);let s=o.token;this.creatingSources.set(i,o),await n.init(this.nvim,s)||(n=null)}catch(s){op.error("Error on create buffer:",s),n=null}if(this.creatingSources.get(i)==o&&(o.dispose(),this.creatingSources.delete(i)),!(!n||!n.textDocument)){if(this.buffers.set(i,n),n.attached&&n.onDocumentDetach(s=>{let a=this.getDocument(s);a&&this.onBufUnload(a.bufnr)}),n.buftype==""&&n.schema=="file"&&(this.configurations.checkFolderConfiguration(n.uri),!this.getConfiguration("workspace").get("ignoredFiletypes",[]).includes(n.filetype))){let l=this.resolveRoot(n);l&&(this.addWorkspaceFolder(l),this.bufnr==t.id&&(this._root=l))}if(n.enabled){let s=Object.assign(n.textDocument,{bufnr:i});this._onDidOpenDocument.fire(s),n.onDocumentChange(a=>this._onDidChangeDocument.fire(a))}op.debug("buffer created",t.id)}}onBufEnter(e){this.bufnr=e;let t=this.getDocument(e);if(t){this.configurations.setFolderConfiguration(t.uri);let i=this.getWorkspaceFolder(t.uri);i&&(this._root=$.parse(i.uri).fsPath)}}async checkCurrentBuffer(e){this.bufnr=e,await this.checkBuffer(e)}onBufWritePost(e){let t=this.buffers.get(e);!t||this._onDidSaveDocument.fire(t.textDocument)}onBufUnload(e,t=!1){if(op.debug("buffer unload",e),!t){let n=this.creatingSources.get(e);n&&(n.cancel(),this.creatingSources.delete(e))}if(this.terminals.has(e)){let n=this.terminals.get(e);this._onDidCloseTerminal.fire(n),this.terminals.delete(e)}let i=this.buffers.get(e);if(i){let n=Object
`)!=`
`&&(e.call("append",[0,a],!0),e.command("normal! Gdd",!0)),e.call("winrestview",[c],!0),await e.resumeNotification()}get folderPaths(){return this.workspaceFolders.map(e=>$.parse(e.uri).fsPath)}get floatSupported(){let{env:e}=this;return e.floating||e.textprop}removeWorkspaceFolder(e){let t=this._workspaceFolders.findIndex(i=>$.parse(i.uri).fsPath==e);if(t!=-1){let i=this._workspaceFolders[t];this._workspaceFolders.splice(t,1),this._onDidChangeWorkspaceFolders.fire({removed:[i],added:[]})}}renameWorkspaceFolder(e,t){let i=this._workspaceFolders.findIndex(s=>$.parse(s.uri).fsPath==e);if(i==-1)return;let n=this._workspaceFolders[i],o={uri:$.file(t).toString(),name:ke.default.dirname(t)};this._workspaceFolders.splice(i,1),this._workspaceFolders.push(o),this._onDidChangeWorkspaceFolders.fire({removed:[n],added:[o]})}addRootPattern(e,t){let i=this.rootPatterns.get(e)||[];for(let n of t)i.includes(n)||i.push(n);this.rootPatterns.set(e,i)}get insertMode(){return this._insertMode}async detach(){if(!!this._attached){this._attached=!1,Xs.dispose();for(let e of this.buffers.keys())await A.fire("BufUnload",[e])}}dispose(){this._disposed=!0;for(let e of this.documents)e.detach();z(this.disposables),ta.dispose(),this.configurations.dispose(),this.buffers.clear()}addWorkspaceFolder(e){if(e==Qi.default.homedir())return;let{_workspaceFolders:t}=this,i=$.file(e).toString(),n={uri:i,name:ke.default.basename(e)};return t.findIndex(o=>o.uri==i)==-1&&(t.push(n),this._initialized&&this._onDidChangeWorkspaceFolders.fire({added:[n],removed:[]})),n}getServerRootPatterns(e){let t=this.getConfiguration().get("languageserver",{}),i=[];for(let n of Object.keys(t)){let o=t[n],{filetypes:s,rootPatterns:a}=o;s&&a&&s.includes(e)&&i.push(...a)}return i=i.concat(this.rootPatterns.get(e)||[]),i.length?eg(i):null}},b=new Uj;var Kl=j()("window"),zj=class{constructor(){this.mutex=new ar}get nvim(){return b.nvim}dispose(){var e;(e=this.statusLine)==null||e.dispose()}showMessage(e,t="more"){if(this.mutex.busy||!this.nvim)return;let{messageLevel:i}=this,n=process.env.VIM_NODE_RPC=="1"?"callTimer":"call";global.hasOwnProperty("__TEST__")&&Kl.info(e);let o="Error",s=gn.Error;switch(t){case"more":s=gn.More,o="MoreMsg";break;case"warning":s=gn.Warning,o="WarningMsg";break}s>=i&&this.nvim[n]("coc#util#echo_messages",[o,("[coc.nvim] "+e).split(`
`)],!0)}async runTerminalCommand(e,t,i=!1){return t=t||b.cwd,await this.nvim.callAsync("coc#util#run_terminal",{cmd:e,cwd:t,keepfocus:i?1:0})}async openTerminal(e,t={}){return await this.nvim.call("coc#util#open_terminal",{cmd:e,...t})}async showQuickpick(e,t="Choose by number"){let i=await this.mutex.acquire();try{let n=t+":";e=e.map((a,l)=>`${l+1}. ${a}`);let o=await this.nvim.callAsync("coc#util#quickpick",[n,e.map(a=>a.trim())]);i();let s=parseInt(o,10);return isNaN(s)||s<=0||s>e.length?-1:s-1}catch(n){return i(),-1}}async showMenuPicker(e,t,i){if(b.env.dialog){let n=await this.mutex.acquire();if(i&&i.isCancellationRequested){n();return}try{let o=new GB(this.nvim,{items:e.map(l=>l.trim()),title:t},i),s=new Promise(l=>{o.onDidClose(u=>{l(u)})});await o.show(this.dialogPreference);let a=await s;return n(),a}catch(o){Kl.error("Error on showMenuPicker:",o),n()}}return await this.showQuickpick(e)}async openLocalConfig(){let{root:e}=b;if(e==Wj.default.homedir()){this.showMessage("Can't create local config in home directory","warning");return}let t=D0.default.join(e,".vim");if(!x0.default.existsSync(t)){if(!await this.showPrompt(`Would you like to create folder'${e}/.vim'?`))return;x0.default.mkdirSync(t)}await b.jumpTo($.file(D0.default.join(t,Gi)).toString())}async showPrompt(e){let t=await this.mutex.acquire();try{let i=await this.nvim.callAsync("coc#float#prompt_confirm",[e]);return t(),i==1}catch(i){return t(),!1}}async showDialog(e){if(!this.checkDialog())return null;let t=new HB(this.nvim,e);return await t.show(this.dialogPreference),t}async requestInput(e,t){let{nvim:i}=this,n=b.getConfiguration("coc.preferences");if(b.env.dialog&&n.get("promptInput",!0)&&!Hn){let o=await this.mutex.acquire(),s=this.dialogPreference;try{let a={};s.floatHighlight&&(a.highlight=s.floatHighlight),s.floatBorderHighlight&&(a.borderhighlight=s.floatBorderHighlight);let l=await i.call("coc#float#create_prompt_win",[e,t||"",a]),[u,c]=l,f=await new Promise(p=>{let d=[];A.on("BufWinLeave",h=>{h==u&&(z(d),p(null))},null,d),A.on("PromptInsert",async h=>{z(d),await i.call("coc#float#close",[c]),h?p(h):(this.showMessage("Empty word, canceled","warning"),p(null))},null,d)});return o(),f}catch(a){Kl.error("Error on requestInput:",a),o()}}else{let o=await b.callAsync("input",[e+": ",t||""]);return i.command("normal! :<C-u>",!0),o||(this.showMessage("Empty word, canceled","warning"),null)}}createStatusBarItem(e=0,t={}){if(!b.env){let i=()=>{};return{text:"",show:i,dispose:i,hide:i,priority:0,isProgress:!1}}return this.statusLine||(this.statusLine=new r3(this.nvim)),this.statusLine.createStatusBarItem(e,t.progress||!1)}createOutputChannel(e){return Xs.create(e,this.nvim)}showOutputChannel(e,t){Xs.show(e,t)}async echoLines(e,t=!1){let{nvim:i}=this,n=b.env.cmdheight;e.length>n&&t&&(e=e.slice(0,n));let o=b.env.columns-12;if(e=e.map(s=>(s=s.replace(/\n/g," "),t&&(s=s.slice(0,o)),s)),t&&e.length==n){let s=e[e.length-1];e[n-1]=`${s.length==o?s.slice(0,-4):s} ...`}await i.call("coc#util#echo_lines",[e])}async getCursorPosition(){let[e,t]=await this.nvim.eval("[line('.')-1, strpart(getline('.'), 0, col('.') - 1)]");return Hj.Position.create(e,t.length)}async moveTo(e){await this.nvim.call("coc#util#jumpTo",[e.line,e.character]),b.env.isVim&&this.nvim.command("redraw",!0)}async getOffset(){return await this.nvim.call("coc#util#get_offset")}async getCursorScreenPosition(){let[e,t]=await this.nvim.call("coc#util#cursor_pos");return{row:e,col:t}}async showPickerDialog(e,t,i){if(!this.checkDialog())return;let n=await this.mutex.acquire();if(i&&i.isCancellationRequested){n();return}try{let o=typeof e[0]=="string",s=new YB(this.nvim,{title:t,items:o?e.map(c=>({label:c})):e},i),a=new Promise(c=>{s.onDidClose(f=>{c(f)})});await s.show(this.dialogPreference);let l=await a,u=l==null?void 0:e.filter((c,f)=>l.includes(f));return n(),u}catch(o){Kl.error("Error on showPickerDialog:",o),n()}}async showInformationMessage(e,...t){if(!this.enableMessageDialog)return await this.showConfirm(e,t,"Info");let i=typeof t[0]=="string"?t:t.map(o=>o.title),n=await this.createNotificati
`),0,i]]);return t[s-1]}async withProgress(e,t){return this.checkDialog()?await new ZB(this.nvim,{task:t,title:e.title,cancellable:e.cancellable}).show(this.notificationPreference):void 0}createNotification(e,t,i){return new Promise(n=>{let o={content:t,borderhighlight:e,close:!0,buttons:i.map((a,l)=>({text:a,index:l})),callback:a=>{n(a)}};new qf(this.nvim,o).show(this.notificationPreference).then(a=>{a||(Kl.error("Unable to open notification window"),n(-1)),i.length||n(-1)},a=>{Kl.error("Unable to open notification window",a),n(-1)})})}get dialogPreference(){let e=b.getConfiguration("dialog");return{maxWidth:e.get("maxWidth"),maxHeight:e.get("maxHeight"),floatHighlight:e.get("floatHighlight"),floatBorderHighlight:e.get("floatBorderHighlight"),pickerButtons:e.get("pickerButtons"),pickerButtonShortcut:e.get("pickerButtonShortcut"),confirmKey:e.get("confirmKey")}}get notificationPreference(){let e=b.getConfiguration("notification");return{top:e.get("marginTop"),right:e.get("marginRight"),maxWidth:e.get("maxWidth"),maxHeight:e.get("maxHeight"),highlight:e.get("highlightGroup"),minProgressWidth:e.get("minProgressWidth")}}checkDialog(){return b.env.dialog?!0:(this.showMessage("Dialog requires vim >= 8.2.0750 or neovim >= 0.4.0, please upgrade your vim","warning"),!1)}get enableMessageDialog(){return b.env.dialog?b.getConfiguration("coc.preferences").get("enableMessageDialog",!1):!1}get messageLevel(){switch(b.getConfiguration("coc.preferences").get("messageLevel","more")){case"error":return gn.Error;case"warning":return gn.Warning;default:return gn.More}}},C=new zj;var Vj=S(Gr()),Qr=S(W());var Lt=S(W());function sp(r){switch(r){case Lt.DiagnosticSeverity.Error:return"Error";case Lt.DiagnosticSeverity.Warning:return"Warning";case Lt.DiagnosticSeverity.Information:return"Information";case Lt.DiagnosticSeverity.Hint:return"Hint";default:return"Error"}}function Gj(r){switch(r){case Lt.DiagnosticSeverity.Error:return"E";case Lt.DiagnosticSeverity.Warning:return"W";case Lt.DiagnosticSeverity.Information:return"I";case Lt.DiagnosticSeverity.Hint:return"I";default:return"Error"}}function S0(r){switch(r){case"hint":return Lt.DiagnosticSeverity.Hint;case"information":return Lt.DiagnosticSeverity.Information;case"warning":return Lt.DiagnosticSeverity.Warning;case"error":return Lt.DiagnosticSeverity.Error;default:return Lt.DiagnosticSeverity.Hint}}function fg(r){switch(r){case Lt.DiagnosticSeverity.Error:return"CocError";case Lt.DiagnosticSeverity.Warning:return"CocWarning";case Lt.DiagnosticSeverity.Information:return"CocInfo";case Lt.DiagnosticSeverity.Hint:return"CocHint";default:return"CocError"}}function pg(r,e){let{start:t}=e.range,i=e.source||"coc.nvim",n=e.message.split(`
`)[0],o=sp(e.severity).slice(0,1).toUpperCase();return{bufnr:r,lnum:t.line+1,col:t.character+1,text:`[${i}${e.code?" "+e.code:""}] ${n} [${o}]`,type:o}}var Xde=j()("diagnostic-buffer"),Kj="CocDiagnostic",Zde=Symbol("CocError"),Qde=Symbol("CocWarning"),ehe=Symbol("CocInformation"),the=Symbol("CocHint"),E0=class{constructor(e,t,i,n,o){this.nvim=e;this.bufnr=t;this.uri=i;this.config=n;this.onRefresh=o;this.diagnostics=[];this._disposed=!1;this.refresh=Vj.default(s=>{this._refresh(s).logError()},300)}get displayByAle(){return this.config.displayByAle}onChange(){this.refresh.clear()}forceRefresh(e){this.refresh.clear(),this._refresh(e).logError()}refreshAle(e){let t=Jj(this.diagnostics);this.diagnostics=e;let i=new Map;e.forEach(n=>{let o=i.get(n.collection)||[];o.push(n),i.set(n.collection,o)});for(let n of t)i.has(n)||i.set(n,[]);this.nvim.pauseNotification();for(let[n,o]of i.entries()){let s=o.map(l=>{let u=l.range||Qr.Range.create(0,0,1,0);return{text:l.message,code:l.code,lnum:u.start.line+1,col:u.start.character+1,end_lnum:u.end.line+1,end_col:u.end.character,type:Gj(l.severity)}}),a=global.hasOwnProperty("__TEST__")?"MockAleResults":"ale#other_source#ShowResults";this.nvim.call(a,[this.bufnr,n,s],!0)}this.nvim.resumeNotification().then(n=>{Array.isArray(n)&&n[1]!=null&&Xde.error("Error on displayByAle:",n[1][2])}).logError()}async _refresh(e){if(Ne(this.diagnostics,e))return;let{refreshOnInsertMode:t}=this.config,{nvim:i}=this,n=await i.eval(`[coc#util#check_refresh(${this.bufnr}),mode(),line("."),getloclist(bufwinid(${this.bufnr}),{'title':1})]`);if(n[0]==0||this._disposed)return;let o=n[1];if(!(!t&&o.startsWith("i")&&e.length)){if(this.displayByAle)this.refreshAle(e);else{this.diagnostics=e;let s=n[2];i.pauseNotification(),this.setDiagnosticInfo(e),this.addSigns(e),this.addHighlight(e),this.updateLocationList(n[3],e),this.showVirtualText(e,s),this.nvim.command("redraw",!0);let a=await this.nvim.resumeNotification();if(Array.isArray(a)&&a[1])throw new Error(a[1])}this.onRefresh(e)}}updateLocationList(e,t){if(!this.config.locationlistUpdate||!e||e.title!=="Diagnostics of coc")return;let i=[];for(let n of t){let o=pg(this.bufnr,n);i.push(o)}this.nvim.call("setloclist",[0,[],"r",{title:"Diagnostics of coc",items:i}],!0)}addSigns(e){if(!this.config.enableSign)return;this.clearSigns();let{nvim:t,bufnr:i}=this,n=new Map;for(let o of e){let{range:s,severity:a}=o,l=s.start.line,u=fg(a),c=n.get(l)||[],f=rhe(a);c.includes(f)||(c.push(f),n.set(l,c),t.call("sign_place",[0,Kj,u,i,{lnum:l+1,priority:14-(a||0)}],!0))}}clearSigns(){let{nvim:e,bufnr:t}=this;e.call("sign_unplace",[Kj,{buffer:t}],!0)}setDiagnosticInfo(e){let t=[0,0,0,0],i={error:0,warning:0,information:0,hint:0,lnums:t};for(let n of e)switch(n.severity){case Qr.DiagnosticSeverity.Warning:i.warning=i.warning+1,t[1]=t[1]||n.range.start.line+1;break;case Qr.DiagnosticSeverity.Information:i.information=i.information+1,t[2]=t[2]||n.range.start.line+1;break;case Qr.DiagnosticSeverity.Hint:i.hint=i.hint+1,t[3]=t[3]||n.range.start.line+1;break;default:t[0]=t[0]||n.range.start.line+1,i.error=i.error+1}this.nvim.call("coc#util#set_buf_var",[this.bufnr,"coc_diagnostic_info",i],!0),this.nvim.call("coc#util#do_autocmd",["CocDiagnosticChange"],!0)}showVirtualText(e,t){let{buffer:i,config:n}=this;if(!n.virtualText)return;let o=this.config.virtualTextSrcId,s=this.config.virtualTextPrefix;this.config.virtualTextCurrentLineOnly&&(e=e.filter(a=>{let{start:l,end:u}=a.range;return l.line<=t-1&&u.line>=t-1})),i.clearNamespace(o);for(let a of[...e].reverse()){let{line:l}=a.range.start,u=fg(a.severity)+"VirtualText",c=a.message.split(/\n/).map(f=>f.trim()).filter(f=>f.length>0).slice(0,this.config.virtualTextLines).join(this.config.virtualTextLineSeparator);i.setVirtualText(o,l,[[s+c,u]],{}).logError()}}addHighlight(e){if(this.clearHighlight(),e.length==0)return;let t=new Map;for(let i of e){let{range:n,severity:o}=i,s=t.get(o)||[];s.push(n),t.set(o,s)}for(let i of[Qr.DiagnosticSeverity.Hint,Qr.DiagnosticSeverity.Information,Qr.DiagnosticSeverity.Warning,Qr.DiagnosticSeverity.Error]){let n=t.
`).split(/\r?\n/);f.length&&(await this.nvim.command('echo ""'),this.lastMessage=f[0].slice(0,30),await C.echoLines(f,e))}}async jumpRelated(){let e=await this.getCurrentDiagnostics();if(!e)return;let t=e.find(n=>n.relatedInformation!=null);if(!t)return;let i=t.relatedInformation.map(n=>n.location);i.length==1?await b.jumpTo(i[0].uri,i[0].range.start):i.length>1&&await b.showLocations(i)}reset(){this.timer&&clearTimeout(this.timer),this.buffers.reset();for(let e of this.collections)e.dispose();this.collections=[]}dispose(){var e;this.buffers.dispose(),this.timer&&clearTimeout(this.timer);for(let t of this.collections)t.dispose();(e=this.floatFactory)==null||e.close(),this.collections=[],z(this.disposables)}get nvim(){return b.nvim}setConfiguration(e){if(e&&!e.affectsConfiguration("diagnostic"))return;let t=b.getConfiguration("diagnostic"),i=t.get("messageTarget","float");i=="float"&&!b.env.floating&&!b.env.textprop&&(i="echo");let n=t.get("enableHighlightLineNumber",!0);(!b.isNvim||Zj.default.lt(b.env.version,"v0.3.2"))&&(n=!1),this.config={messageTarget:i,enableHighlightLineNumber:n,virtualTextSrcId:b.createNameSpace("diagnostic-virtualText"),checkCurrentLine:t.get("checkCurrentLine",!1),enableSign:b.env.sign&&t.get("enableSign",!0),locationlistUpdate:t.get("locationlistUpdate",!0),maxWindowHeight:t.get("maxWindowHeight",10),maxWindowWidth:t.get("maxWindowWidth",80),enableMessage:t.get("enableMessage","always"),messageDelay:t.get("messageDelay",200),virtualText:t.get("virtualText",!1)&&this.nvim.hasFunction("nvim_buf_set_virtual_text"),virtualTextCurrentLineOnly:t.get("virtualTextCurrentLineOnly",!0),virtualTextPrefix:t.get("virtualTextPrefix"," "),virtualTextLineSeparator:t.get("virtualTextLineSeparator"," \\ "),virtualTextLines:t.get("virtualTextLines",3),displayByAle:t.get("displayByAle",!1),level:S0(t.get("level","hint")),signPriority:t.get("signPriority",10),errorSign:t.get("errorSign",">>"),warningSign:t.get("warningSign",">>"),infoSign:t.get("infoSign",">>"),hintSign:t.get("hintSign",">>"),refreshOnInsertMode:t.get("refreshOnInsertMode",!1),filetypeMap:t.get("filetypeMap",{}),showUnused:t.get("showUnused",!0),showDeprecated:t.get("showDeprecated",!0),format:t.get("format","[%source%code] [%severity] %message")},this.enabled=t.get("enable",!0),this.defineSigns()}getCollectionByName(e){return this.collections.find(t=>t.name==e)}getCollections(e){return this.collections.filter(t=>t.has(e))}toggleDiagnostic(){let{enabled:e}=this;this.enabled=!e;for(let t of this.buffers.items)if(this.enabled){let i=this.getDiagnostics(t.uri);t.forceRefresh(i)}else t.clear()}refreshBuffer(e,t=!1){if(!this.enabled)return!1;let i=this.buffers.getItem(e);if(!i)return!1;let n=this.getDiagnostics(i.uri);return t?i.forceRefresh(n):i.refresh(n),!0}},St=new Qj;var ht;(function(r){r[r.Null=0]="Null",r[r.Backspace=8]="Backspace",r[r.Tab=9]="Tab",r[r.LineFeed=10]="LineFeed",r[r.CarriageReturn=13]="CarriageReturn",r[r.Space=32]="Space",r[r.ExclamationMark=33]="ExclamationMark",r[r.DoubleQuote=34]="DoubleQuote",r[r.Hash=35]="Hash",r[r.DollarSign=36]="DollarSign",r[r.PercentSign=37]="PercentSign",r[r.Ampersand=38]="Ampersand",r[r.SingleQuote=39]="SingleQuote",r[r.OpenParen=40]="OpenParen",r[r.CloseParen=41]="CloseParen",r[r.Asterisk=42]="Asterisk",r[r.Plus=43]="Plus",r[r.Comma=44]="Comma",r[r.Dash=45]="Dash",r[r.Period=46]="Period",r[r.Slash=47]="Slash",r[r.Digit0=48]="Digit0",r[r.Digit1=49]="Digit1",r[r.Digit2=50]="Digit2",r[r.Digit3=51]="Digit3",r[r.Digit4=52]="Digit4",r[r.Digit5=53]="Digit5",r[r.Digit6=54]="Digit6",r[r.Digit7=55]="Digit7",r[r.Digit8=56]="Digit8",r[r.Digit9=57]="Digit9",r[r.Colon=58]="Colon",r[r.Semicolon=59]="Semicolon",r[r.LessThan=60]="LessThan",r[r.Equals=61]="Equals",r[r.GreaterThan=62]="GreaterThan",r[r.QuestionMark=63]="QuestionMark",r[r.AtSign=64]="AtSign",r[r.A=65]="A",r[r.B=66]="B",r[r.C=67]="C",r[r.D=68]="D",r[r.E=69]="E",r[r.F=70]="F",r[r.G=71]="G",r[r.H=72]="H",r[r.I=73]="I",r[r.J=74]="J",r[r.K=75]="K",r[r.L=76]="L",r[r.M=77]="M",r[r.N=78]="N",r[r.O=79]="O",r[r.P=80]="P",r[r.Q=81]="Q",r[r.R=82]="R",r[r.S=83]="S",r[r
`)){let i="";this.snippet.walk(l=>{if(l==this)return!1;if(l instanceof ut){let u=l.toString().split(/\r?\n/);i=u[u.length-1].match(/^\s*/)[0]}return!0});let n=t.split(`
`),o=n.filter(l=>l.length>0).map(l=>l.match(/^\s*/)[0]),s=o.length==0?"":o.reduce((l,u)=>l.length<u.length?l:u);t=n.map((l,u)=>u==0||l.length==0||!l.startsWith(s)?l:i+l.slice(s.length)).join(`
`)}return this.transform&&(t=this.transform.resolve(t||"")),t!==void 0?(this._children=[new ut(t)],!0):!1}toTextmateString(){let e="";return this.transform&&(e=this.transform.toTextmateString()),this.children.length===0?`\${${this.name}${e}}`:`\${${this.name}:${this.children.map(t=>t.toTextmateString()).join("")}${e}}`}clone(){let e=new yn(this.name);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map(t=>t.clone()),e}};function eU(r,e){let t=[...r];for(;t.length>0;){let i=t.shift();if(!e(i))break;t.unshift(...i.children)}}var ap=class extends ra{get placeholderInfo(){if(!this._placeholders){this._variables=[];let e=[],t;this.walk(i=>{if(i instanceof ei)e.push(i),t=!t||t.index<i.index?i:t;else if(i instanceof yn){let n=i.name.charCodeAt(0);(n<65||n>90)&&this._variables.push(i)}return!0}),this._placeholders={all:e,last:t}}return this._placeholders}get variables(){return this._variables}get placeholders(){let{all:e}=this.placeholderInfo;return e}get maxIndexNumber(){let{placeholders:e}=this;return e.reduce((t,i)=>Math.max(t,i.index),0)}get minIndexNumber(){let{placeholders:e}=this,t=e.map(i=>i.index);return t.sort((i,n)=>i-n),t.length>1&&t[0]==0?t[1]:t[0]||0}insertSnippet(e,t,i){let n=this.placeholders[t];if(!n)return;let{index:o}=n,s=kt.create("untitled:/1","snippet",0,n.toString());e=kt.applyEdits(s,[{range:i,newText:e}]);let a=new Ho().parse(e,!0),l=a.maxIndexNumber+1,u=[];for(let c of a.placeholders)c.isFinalTabstop?c.index=l+o:c.index=c.index+o,u.push(c.index);return this.walk(c=>(c instanceof ei&&c.index>o&&(c.index=c.index+l),!0)),this.replace(n,a.children),Math.min.apply(null,u)}updatePlaceholder(e,t){let i=this.placeholders[e];for(let n of this.placeholders)if(n.index==i.index){let o=n.children[0],s=n.transform?n.transform.resolve(t):t;o?n.setOnlyChild(new ut(s)):n.appendChild(new ut(s))}this._placeholders=void 0}updateVariable(e,t){let i=this.variables[e-this.maxIndexNumber-1];if(i){let n=this.variables.filter(o=>o.name==i.name);for(let o of n){let s=o.transform?o.transform.resolve(t):t;o.setOnlyChild(new ut(s))}}}getPlaceholderText(e,t){let i=this.placeholders[e];return i&&i.transform?i.transform.resolve(t):t}offset(e){let t=0,i=!1;return this.walk(n=>n===e?(i=!0,!1):(t+=n.len(),!0)),i?t:-1}fullLen(e){let t=0;return eU([e],i=>(t+=i.len(),!0)),t}enclosingPlaceholders(e){let t=[],{parent:i}=e;for(;i;)i instanceof ei&&t.push(i),i=i.parent;return t}async resolveVariables(e){let t=[];this.walk(i=>(i instanceof yn&&t.push(i),!0)),await Promise.all(t.map(i=>i.resolve(e)))}appendChild(e){return this._placeholders=void 0,super.appendChild(e)}replace(e,t){return this._placeholders=void 0,super.replace(e,t)}toTextmateString(){return this.children.reduce((e,t)=>e+t.toTextmateString(),"")}clone(){let e=new ap;return this._children=this.children.map(t=>t.clone()),e}walk(e){eU(this.children,e)}},Ho=class{constructor(){this._scanner=new _0}static escape(e){return e.replace(/\$|}|\\/g,"\\$&")}text(e){return this.parse(e).toString()}parse(e,t){this._scanner.text(e),this._token=this._scanner.next();let i=new ap;for(;this._parse(i););let n=new Map,o=[];i.walk(s=>(s instanceof ei&&(s.isFinalTabstop?n.set(0,void 0):!n.has(s.index)&&s.children.length>0?n.set(s.index,s.children):o.push(s)),!0));for(let s of o)if(n.has(s.index)){let a=new ei(s.index);a.transform=s.transform;for(let l of n.get(s.index)){let u=l.clone();if(a.transform){if(u instanceof ut)u=new ut(a.transform.resolve(u.value));else for(let c of u.children)if(c instanceof ut){u.replace(c,[new ut(a.transform.resolve(c.value))]);break}}a.appendChild(u)}i.replace(s,[a])}return!n.has(0)&&t&&i.appendChild(new ei(0)),i}_accept(e,t){if(e===void 0||this._token.type===e){let i=t?this._scanner.tokenText(this._token):!0;return this._token=this._scanner.next(),i}return!1}_backTo(e){return this._scanner.pos=e.pos+e.len,this._token=e,!1}_until(e){if(this._token.type===14)return!1;let t=this._token;for(;this._token.type!==e;)if(this._token=this._scanner.next(),this._token.type===14)return!1;let i=this._scanner.value.substring(t.pos,this._token.pos);re
`));continue}return!1}for(;!this._accept(4);){if(this._token.type!==14){n+=this._accept(void 0,!0);continue}return!1}try{t.regexp=new RegExp(i,n)}catch(o){return!1}return e.transform=t,!0}_parseFormatString(e){let t=this._token;if(!this._accept(0))return!1;let i=!1;this._accept(3)&&(i=!0);let n=this._accept(8,!0);if(n)if(i){if(this._accept(4))return e.appendChild(new Pi(Number(n))),!0;if(!this._accept(1))return this._backTo(t),!1}else return e.appendChild(new Pi(Number(n))),!0;else return this._backTo(t),!1;if(this._accept(6)){let o=this._accept(9,!0);return!o||!this._accept(4)?(this._backTo(t),!1):(e.appendChild(new Pi(Number(n),o)),!0)}else if(this._accept(11)){let o=this._until(4);if(o)return e.appendChild(new Pi(Number(n),void 0,o,void 0)),!0}else if(this._accept(12)){let o=this._until(4);if(o)return e.appendChild(new Pi(Number(n),void 0,void 0,o)),!0}else if(this._accept(13)){let o=this._until(1);if(o){let s=this._until(4);if(s)return e.appendChild(new Pi(Number(n),void 0,o,s)),!0}}else{let o=this._until(4);if(o)return e.appendChild(new Pi(Number(n),void 0,void 0,o)),!0}return this._backTo(t),!1}_parseAnything(e){if(this._token.type!==14){let t=this._scanner.tokenText(this._token);return e.appendChild(new ut(t)),this._accept(void 0),!0}return!1}};var Lu=S(W());var $C=S(W());var l9=S(Bl()),u9=S(require("fs")),jv=S(require("path")),c9=S(require("util")),f9=S(W());var Vz=S(Gr());var st=S($i()),Kz=S(Ex()),Fe=S(require("path")),Jz=S(Pf()),Mv=S(W());var Yz=S(El());var tU=S(require("events"));var kAe=j()("model-installBuffer"),tn;(function(r){r[r.Waiting=0]="Waiting",r[r.Faild=1]="Faild",r[r.Progressing=2]="Progressing",r[r.Success=3]="Success"})(tn||(tn={}));var T0=class extends tU.EventEmitter{constructor(e=!1,t=!1,i=void 0){super();this.isUpdate=e;this.isSync=t;this.channel=i;this.statMap=new Map;this.messagesMap=new Map;this.names=[]}setExtensions(e){this.statMap.clear(),this.names=e;for(let t of e)this.statMap.set(t,0)}addMessage(e,t,i=!1){if(i&&this.channel)return;let n=this.messagesMap.get(e)||[];this.messagesMap.set(e,n.concat(t.trim().split(/\r?\n/))),this.channel&&this.channel.appendLine(`[${e}] ${t}`)}startProgress(e){for(let t of e)this.statMap.set(t,2)}finishProgress(e,t=!0){this.channel&&(t?this.channel.appendLine(`[${e}] install succeed!`):this.channel.appendLine(`[${e}] install failed!`)),this.statMap.set(e,t?3:1)}get remains(){let e=0;for(let t of this.names){let i=this.statMap.get(t);[3,1].includes(i)||(e=e+1)}return e}getLines(){let e=[];for(let t of this.names){let i=this.statMap.get(t),n="*";switch(i){case 2:{let s=new Date,a=Math.floor(s.getMilliseconds()/100);n=PD[a];break}case 1:n="\u2717";break;case 3:n="\u2713";break}let o=this.messagesMap.get(t)||[];e.push(`- ${n} ${t} ${o.length?o[o.length-1]:""}`)}return e}getMessages(e){if(e<=1)return[];let t=this.names[e-2];return t?this.messagesMap.get(t):[]}draw(e,t){let{remains:i}=this,o=[i==0?`${this.isUpdate?"Update":"Install"} finished`:`Installing, ${i} remains...`,"",...this.getLines()];t.setLines(o,{start:0,end:-1,strictIndexing:!1},!0),i==0&&this.interval&&(clearInterval(this.interval),this.interval=null),process.env.VIM_NODE_RPC&&e.command("redraw",!0)}highlight(e){e.call("matchadd",["CocListFgCyan","^\\-\\s\\zs\\*"],!0),e.call("matchadd",["CocListFgGreen","^\\-\\s\\zs\u2713"],!0),e.call("matchadd",["CocListFgRed","^\\-\\s\\zs\u2717"],!0),e.call("matchadd",["CocListFgYellow","^-.\\{3\\}\\zs\\S\\+"],!0)}async show(e){let{isSync:t}=this;if(this.channel)return;e.pauseNotification(),e.command(t?"enew":"vs +enew",!0),e.call("bufnr",["%"],!0),e.command("setl buftype=nofile bufhidden=wipe noswapfile nobuflisted wrap undolevels=-1",!0),t||e.command("nnoremap <silent><nowait><buffer> q :q<CR>",!0),this.highlight(e);let i=await e.resumeNotification(),n=i&&i[1]==null?i[0][1]:null;if(!n)return;this.bufnr=n;let o=e.createBuffer(n);this.interval=setInterval(()=>{this.draw(e,o)},100)}dispose(){this.interval&&clearInterval(this.interval)}},R0=T0;var B5=S(require("events")),j5=S(require("child_process"));var U5=S(require("readline")),fr=S($i()),W5=S(require("os"))
`])}}hasFormatProvider(e){return!!(this.formatManager.hasProvider(e)||this.formatRangeManager.hasProvider(e))}registerOnTypeFormattingEditProvider(e,t,i){return this.onTypeFormatManager.register(e,t,i)}registerCompletionItemProvider(e,t,i,n,o=[],s,a){i=typeof i=="string"?[i]:i;let l=this.createCompleteSource(e,t,n,i,o,a||[],s);return Ze.addSource(l),mv.debug("created service source",e),{dispose:()=>{Ze.removeSource(l)}}}registerCodeActionProvider(e,t,i,n){return this.codeActionManager.register(e,t,i,n)}registerHoverProvider(e,t){return this.hoverManager.register(e,t)}registerSelectionRangeProvider(e,t){return this.selectionRangeManager.register(e,t)}registerSignatureHelpProvider(e,t,i){return this.signatureManager.register(e,t,i)}registerDocumentSymbolProvider(e,t){return this.documentSymbolManager.register(e,t)}registerFoldingRangeProvider(e,t){return this.foldingRangeManager.register(e,t)}registerDocumentHighlightProvider(e,t){return this.documentHighlightManager.register(e,t)}registerCodeLensProvider(e,t){return this.codeLensManager.register(e,t)}registerDocumentLinkProvider(e,t){return this.documentLinkManager.register(e,t)}registerDocumentColorProvider(e,t){return this.documentColorManager.register(e,t)}registerDefinitionProvider(e,t){return this.definitionManager.register(e,t)}registerDeclarationProvider(e,t){return this.declarationManager.register(e,t)}registerTypeDefinitionProvider(e,t){return this.typeDefinitionManager.register(e,t)}registerImplementationProvider(e,t){return this.implementationManager.register(e,t)}registerReferencesProvider(e,t){return this.referenceManager.register(e,t)}registerRenameProvider(e,t){return this.renameManager.register(e,t)}registerWorkspaceSymbolProvider(e){return arguments.length>1&&typeof arguments[1].provideWorkspaceSymbols=="function"&&(e=arguments[1]),this.workspaceSymbolsManager.register(e)}registerDocumentFormatProvider(e,t,i=0){return this.formatManager.register(e,t,i)}registerDocumentRangeFormatProvider(e,t,i=0){return this.formatRangeManager.register(e,t,i)}shouldTriggerSignatureHelp(e,t){return this.signatureManager.shouldTrigger(e,t)}async getHover(e,t,i){return await this.hoverManager.provideHover(e,t,i)}async getSignatureHelp(e,t,i,n){return await this.signatureManager.provideSignatureHelp(e,t,i,n)}async getDefinition(e,t,i){return this.definitionManager.hasProvider(e)?await this.definitionManager.provideDefinition(e,t,i):null}async getDeclaration(e,t,i){return this.declarationManager.hasProvider(e)?await this.declarationManager.provideDeclaration(e,t,i):null}async getTypeDefinition(e,t,i){return this.typeDefinitionManager.hasProvider(e)?await this.typeDefinitionManager.provideTypeDefinition(e,t,i):null}async getImplementation(e,t,i){return this.implementationManager.hasProvider(e)?await this.implementationManager.provideReferences(e,t,i):null}async getReferences(e,t,i,n){return this.referenceManager.hasProvider(e)?await this.referenceManager.provideReferences(e,i,t,n):null}async getDocumentSymbol(e,t){return await this.documentSymbolManager.provideDocumentSymbols(e,t)}async getSelectionRanges(e,t,i){return await this.selectionRangeManager.provideSelectionRanges(e,t,i)}async getWorkspaceSymbols(e,t){return e=e||"",await this.workspaceSymbolsManager.provideWorkspaceSymbols(e,t)}async resolveWorkspaceSymbol(e,t){return await this.workspaceSymbolsManager.resolveWorkspaceSymbol(e,t)}async prepareRename(e,t,i){return await this.renameManager.prepareRename(e,t,i)}async provideRenameEdits(e,t,i,n){return await this.renameManager.provideRenameEdits(e,t,i,n)}async provideDocumentFormattingEdits(e,t,i){if(!this.formatManager.hasProvider(e)){if(!this.formatRangeManager.hasProvider(e))return null;let o=e.positionAt(e.getText().length),s=ce.Range.create(ce.Position.create(0,0),o);return await this.provideDocumentRangeFormattingEdits(e,s,t,i)}return await this.formatManager.provideDocumentFormattingEdits(e,t,i)}async provideDocumentRangeFormattingEdits(e,t,i,n){return this.formatRangeManager.hasProvider(e)?await this.formatRangeManager.provideDocumentRangeFormattingEdits(e,t,i,n
`)){for(let i of e.split(/\r?\n/))this.addLine(i,t);return}if(t&&this.highlights.push({line:this.lines.length,colStart:e.match(/^\s*/)[0].length,colEnd:ue(e),hlGroup:t}),e.includes("")){let i=Nl(e);for(let n of i.highlights){let{span:o,hlGroup:s}=n;o[0]!=o[1]&&this.highlights.push({line:this.lines.length,colStart:o[0],colEnd:o[1],hlGroup:s})}this.lines.push(i.line)}else this.lines.push(e)}addLines(e){this.lines.push(...e)}addText(e,t){let{lines:i}=this,n=i[i.length-1]||"";if(t){let o=ue(n);this.highlights.push({line:i.length?i.length-1:0,colStart:o,colEnd:o+ue(e),hlGroup:t})}i.length?i[i.length-1]=`${n}${e}`:i.push(e)}get length(){return this.lines.length}getline(e){return this.lines[e]||""}render(e,t=0,i=-1){e.setLines(this.lines,{start:t,end:i,strictIndexing:!1},!0);for(let n of this.highlights)e.addHighlight({hlGroup:n.hlGroup,colStart:n.colStart,colEnd:n.colEnd==null?-1:n.colEnd,line:t+n.line,srcId:this.srcId}).logError()}},ss=$E;var BH=S(require("events")),jH=S(require("fs")),UH=S(require("net")),Ru=S(W());var Sa=S(require("child_process")),qH=S(require("fs")),nC=S(require("path")),Et=S(W());var jp=S(require("child_process")),gv=S(require("path")),j4=S(require("fs"));var oye=process.platform==="win32",sye=process.platform==="darwin",aye=process.platform==="linux",lye=gv.dirname(__dirname);function U4(r,e){if(!r.killed)if(oye)try{let t={stdio:["pipe","pipe","ignore"]};return e&&(t.cwd=e),jp.execFileSync("taskkill",["/T","/F","/PID",r.pid.toString()],t),!0}catch(t){return!1}else if(aye||sye)try{let t=gv.join(lye,"bin/terminateProcess.sh");return j4.default.existsSync(t)?!jp.spawnSync(t,[r.pid.toString()]).error:(console.error(`"${t}" not found`),!1)}catch(t){return!1}else return r.kill("SIGKILL"),!0}var WE=S(require("path")),D=S(W());var W4=S(W());"use strict";var g$e=j()("language-client-progressPart"),Up=class{constructor(e,t,i){this.client=e;this.token=t;this.disposables=[];this._cancelled=!1;this.statusBarItem=C.createStatusBarItem(99,{progress:!0}),this.disposables.push(e.onProgress(W4.WorkDoneProgress.type,this.token,n=>{switch(n.kind){case"begin":this.begin(n);break;case"report":this.report(n);break;case"end":this.done(n.message),i&&i(this);break}}))}begin(e){typeof this.title!="string"&&(this.title=e.title,this.report(e))}report(e){let t=this.statusBarItem,i=[];this.title&&i.push(this.title),typeof e.percentage=="number"&&i.push(e.percentage.toFixed(0)+"%"),e.message&&i.push(e.message),t.text=i.join(" "),t.show()}cancel(){this._cancelled||(this._cancelled=!0,z(this.disposables))}done(e){if(this._cancelled)return;let t=this.statusBarItem;t.text=`${this.title} ${e||"finished"}`,setTimeout(()=>{t.dispose()},300),this.cancel()}};var BE=class{constructor(e){this.defaultDelay=e;this.timeout=null,this.completionPromise=null,this.doResolve=null,this.task=null}trigger(e,t=this.defaultDelay){return this.task=e,this.cancelTimeout(),this.completionPromise||(this.completionPromise=new Promise((i,n)=>{this.doResolve=i,this.doReject=n}).then(()=>{this.completionPromise=null,this.doResolve=null;let i=this.task;return this.task=null,i()})),this.timeout=setTimeout(()=>{this.timeout=null,this.doResolve(null)},t),this.completionPromise}isTriggered(){return this.timeout!==null}cancel(){this.cancelTimeout(),this.completionPromise&&(this.doReject(new Error("Canceled")),this.completionPromise=null)}cancelTimeout(){this.timeout!==null&&(clearTimeout(this.timeout),this.timeout=null)}dispose(){this.cancelTimeout()}};function H4(r){let e=r.map(t=>typeof t=="string"?t:t.language);return e=e.filter(t=>t!=null),e.length==0?null:e}function z4(r){return{uri:r.uri,languageId:r.languageId,version:r.version,text:r.getText()}}function G4(r){return{textDocument:{uri:r.uri}}}function V4(r){return{textDocument:{uri:r.uri,version:r.version},contentChanges:[{text:r.getText()}]}}function jE(r){return{textDocument:vv(r.document),reason:r.reason}}function vv(r){return{uri:r.uri,version:r.version}}function K4(r,e){let t={textDocument:vv(r)};return e&&(t.text=r.getText()),t}function Wp(r){return r.toString()}function J4(r,e,t){return{textDocument:{uri:r.
Code: ${t.code} ${t.data?`
`+t.data.toString():""}`}return e instanceof Error?bt(e.stack)?e.stack:e.message:bt(e)?e:e.toString()}_appendOutput(e,t,i){let n=3;switch(e){case"Info":n=1;break;case"Warn":n=2;break}this.outputChannel.appendLine(`[${e} - ${new Date().toLocaleTimeString()}] ${t}`);let o;i&&(o=this.data2String(i),this.outputChannel.appendLine(o)),this._clientOptions.revealOutputChannelOn<=n&&this.outputChannel.show(!0)}info(e,t){this._appendOutput("Info",e,t)}warn(e,t){this._appendOutput("Warn",e,t)}error(e,t){this._appendOutput("Error",e,t)}logTrace(e,t){this.outputChannel.appendLine(`[Trace - ${new Date().toLocaleTimeString()}] ${e}`),t&&this.outputChannel.appendLine(this.data2String(t))}needsStart(){return this.state===0||this.state===4||this.state===5}needsStop(){return this.state===1||this.state===3}onReady(){return this._onReady}get started(){return this.state!=0}isConnectionActive(){return this.state===3&&!!this._resolvedConnection}start(){if(this._onReadyCallbacks.isUsed&&(this._onReady=new Promise((e,t)=>{this._onReadyCallbacks=new GE(e,t)})),this._listeners=[],this._providers=[],!this._diagnostics){let e=this._clientOptions,t=e.diagnosticCollectionName?e.diagnosticCollectionName:this._id;this._diagnostics=U.createDiagnosticCollection(t)}return this.state=1,this.resolveConnection().then(e=>(e.onLogMessage(t=>{let i;switch(t.type){case D.MessageType.Error:i="error",this.error(t.message);break;case D.MessageType.Warning:i="warning",this.warn(t.message);break;case D.MessageType.Info:i="info",this.info(t.message);break;default:i="log",this.outputChannel.appendLine(t.message)}if(global.hasOwnProperty("__TEST__")){console.log(`[${i}] ${t.message}`);return}}),e.onShowMessage(t=>{switch(t.type){case D.MessageType.Error:C.showErrorMessage(t.message);break;case D.MessageType.Warning:C.showWarningMessage(t.message);break;case D.MessageType.Info:C.showInformationMessage(t.message);break;default:C.showInformationMessage(t.message)}}),e.onRequest(D.ShowMessageRequest.type,t=>{let i;switch(t.type){case D.MessageType.Error:i=C.showErrorMessage.bind(C);break;case D.MessageType.Warning:i=C.showWarningMessage.bind(C);break;case D.MessageType.Info:i=C.showInformationMessage.bind(C);break;default:i=C.showInformationMessage.bind(C)}let n=t.actions||[];return i(t.message,...n)}),e.onTelemetry(t=>{}),e.listen(),this.initialize(e))).then(void 0,e=>{this.state=2,this._onReadyCallbacks.reject(e),this.error("Starting client failed ",e)}),D.Disposable.create(()=>{this.needsStop()&&this.stop()})}resolveConnection(){return this._connectionPromise||(this._connectionPromise=this.createConnection()),this._connectionPromise}resolveRootPath(){if(this._clientOptions.workspaceFolder)return $.parse(this._clientOptions.workspaceFolder.uri).fsPath;let{ignoredRootPaths:e}=this._clientOptions,t=b.getConfiguration(this.id),i=t.get("rootPatterns",[]),n=t.get("requireRootPattern",!1),o;if(i&&i.length){let a=b.getDocument(b.bufnr);if(a&&a.schema=="file"){let l=WE.default.dirname($.parse(a.uri).fsPath);o=Jf(l,i,b.cwd)}}if(n&&!o)return null;let s=o||b.rootPath||b.cwd;return e&&e.indexOf(s)!==-1?(C.showMessage(`Ignored rootPath ${s} of client "${this._id}"`,"warning"),null):s}initialize(e){this.refreshTrace(e,!1);let{initializationOptions:t,progressOnInitialization:i}=this._clientOptions,n=this.resolveRootPath();if(!n)return;let o={processId:process.pid,rootPath:n||null,rootUri:n?Wp($.file(n)):null,capabilities:this.computeClientCapabilities(),initializationOptions:Lo(t)?t():t,trace:D.Trace.toString(this._trace),workspaceFolders:null,clientInfo:{name:"coc.nvim",version:b.version}};if(this.fillInitializeParams(o),i){let s=$e();o.workDoneToken=s;let a=new Up(e,s);return a.begin({title:`initializing ${this.id}`,kind:"begin"}),this.doInitialize(e,o).then(l=>(a.done(),l),l=>{throw a.cancel(),l})}else return this.doInitialize(e,o)}doInitialize(e,t){return e.initialize(t).then(i=>{this._resolvedConnection=e,this._initializeResult=i,this.state=3;let n;return cm(i.capabilities.textDocumentSync)?i.capabilities.textDocumentSync===D.TextDocumentSyncKind.None?n={openClose:!1,change:D.TextD
Related diagnostics:
`;for(let l of s.relatedInformation){let u=WE.default.basename($.parse(l.location.uri).fsPath),c=l.location.range.start.line;a=`${a}
${u}(line ${c+1}): ${l.message}`;let f=o.get(l.location.uri)||[];f.push(D.Diagnostic.create(l.location.range,l.message,D.DiagnosticSeverity.Hint,s.code,s.source)),o.set(l.location.uri,f)}s.message=a}this._diagnostics.set(Array.from(o))}}else this._diagnostics.set(e,t)}createConnection(){let e=(i,n,o)=>{as.error("connection error:",i,n),this.handleConnectionError(i,n,o)},t=()=>{this.handleConnectionClosed()};return this.createMessageTransports(this._clientOptions.stdioEncoding||"utf8").then(i=>uye(i.reader,i.writer,e,t))}handleConnectionClosed(){if(this.state===4||this.state===5)return;try{this._resolvedConnection&&this._resolvedConnection.dispose()}catch(t){}let e=1;try{e=this._clientOptions.errorHandler.closed()}catch(t){}this._connectionPromise=void 0,this._resolvedConnection=void 0,e===1?(this.error("Connection to server got closed. Server will not be restarted."),this.state=5,this.cleanUp(!1,!0)):e===2&&(this.info("Connection to server got closed. Server will restart."),this.cleanUp(!1,!0),this.state=0,this.start())}restart(){this.cleanUp(!0,!1),this.start()}handleConnectionError(e,t,i){this._clientOptions.errorHandler.error(e,t,i)===2&&(this.error("Connection to server is erroring. Shutting down server."),this.stop())}hookConfigurationChanged(e){b.onDidChangeConfiguration(()=>{this.refreshTrace(e,!0)})}refreshTrace(e,t=!1){let i=b.getConfiguration(this._id),n=D.Trace.Off,o=D.TraceFormat.Text;if(i){let s=i.get("trace.server","off");typeof s=="string"?n=D.Trace.fromString(s):(n=D.Trace.fromString(i.get("trace.server.verbosity","off")),o=D.TraceFormat.fromString(i.get("trace.server.format","text")))}this._trace=n,this._traceFormat=o,e.trace(this._trace,this._tracer,{sendNotification:t,traceFormat:this._traceFormat})}hookFileEvents(e){let t=this._clientOptions.synchronize.fileEvents;if(!t)return;let i;Array.isArray(t)?i=t:i=[t],!!i&&this._dynamicFeatures.get(D.DidChangeWatchedFilesNotification.type.method).registerRaw($e(),i)}registerFeatures(e){for(let t of e)this.registerFeature(t)}registerFeature(e){if(this._features.push(e),zE.is(e)){let t=e.messages;if(Array.isArray(t))for(let i of t)this._method2Message.set(i.method,i),this._dynamicFeatures.set(i.method,e);else this._method2Message.set(t.method,t),this._dynamicFeatures.set(t.method,e)}}getFeature(e){return this._dynamicFeatures.get(e)}registerBuiltinFeatures(){this.registerFeature(new PH(this)),this.registerFeature(new nH(this,this._syncedDocuments)),this.registerFeature(new sH(this)),this.registerFeature(new aH(this)),this.registerFeature(new lH(this)),this.registerFeature(new uH(this)),this.registerFeature(new oH(this,this._syncedDocuments)),this.registerFeature(new cH(this,e=>this.notifyFileEvent(e))),this._clientOptions.disableCompletion||this.registerFeature(new pH(this)),this.registerFeature(new dH(this)),this.registerFeature(new hH(this)),this.registerFeature(new mH(this)),this.registerFeature(new gH(this)),this.registerFeature(new vH(this)),this.registerFeature(new yH(this)),this.registerFeature(new bH(this)),this.registerFeature(new wH(this)),this.registerFeature(new xH(this)),this.registerFeature(new DH(this)),this.registerFeature(new SH(this)),this.registerFeature(new EH(this)),this.registerFeature(new CH(this)),this.registerFeature(new _H(this)),this.registerFeature(new TH(this))}fillInitializeParams(e){for(let t of this._features)Lo(t.fillInitializeParams)&&t.fillInitializeParams(e)}computeClientCapabilities(){let e={};re(e,"workspace").applyEdit=!0;let t=re(re(e,"workspace"),"workspaceEdit");t.documentChanges=!0,t.resourceOperations=[D.ResourceOperationKind.Create,D.ResourceOperationKind.Rename,D.ResourceOperationKind.Delete],t.failureHandling=D.FailureHandlingKind.TextOnlyTransactional;let i=re(re(e,"textDocument"),"publishDiagnostics");i.relatedInformation=!0,i.versionSupport=!1,i.tagSupport={valueSet:[D.DiagnosticTag.Unnecessary,D.DiagnosticTag.Deprecated]};for(let n of this._features)n.fillClientCapabilities(e);return e}initializeFeatures(e){let t=this._clientOptions.documentSelector;for(let i of this._features)i.initialize(this._capabilities,t)
`)?i:i+`
`)}},$H=class{constructor(e,t){this._client=e;this._setting=t;this._listeners=[]}start(){return b.onDidChangeConfiguration(e=>{e.affectsConfiguration(this._setting)&&this.onDidChangeConfiguration()},null,this._listeners),this.onDidChangeConfiguration(),{dispose:()=>{z(this._listeners),this._client.needsStop()&&this._client.stop()}}}onDidChangeConfiguration(){let e=this._setting.indexOf("."),t=e>=0?this._setting.substr(0,e):this._setting,i=e>=0?this._setting.substr(e+1):void 0,n=i?b.getConfiguration(t).get(i,!0):b.getConfiguration(t);n&&this._client.needsStart()?this._client.start():!n&&this._client.needsStop()&&this._client.stop()}},_v;(function(e){function r(t){return[]}e.createAll=r})(_v||(_v={}));var Ea=j()("services");function pye(r){switch(r){case ye.Initial:return"init";case ye.Running:return"running";case ye.Starting:return"starting";case ye.StartFailed:return"startFailed";case ye.Stopping:return"stopping";case ye.Stopped:return"stopped";default:return"unknown"}}var WH=class extends BH.EventEmitter{constructor(){super(...arguments);this.registered=new Map;this.disposables=[]}init(){b.onDidOpenTextDocument(e=>{this.start(e)},null,this.disposables),b.onDidChangeConfiguration(e=>{e.affectsConfiguration("languageserver")&&this.createCustomServices()},null,this.disposables),this.createCustomServices()}dispose(){this.removeAllListeners(),z(this.disposables);for(let e of this.registered.values())e.dispose()}regist(e){let{id:t}=e;if(t||Ea.error("invalid service configuration. ",e.name),!this.registered.get(t))return this.registered.set(t,e),Ea.info(`registered service "${t}"`),this.shouldStart(e)&&e.start(),e.state==ye.Running&&this.emit("ready",t),e.onServiceReady(()=>{Ea.info(`service ${t} started`),this.emit("ready",t)},null,this.disposables),Ru.Disposable.create(()=>{e.stop(),e.dispose(),this.registered.delete(t)})}getService(e){let t=this.registered.get(e);return t||(t=this.registered.get(`languageserver.${e}`)),t}shouldStart(e){if(e.state!=ye.Initial)return!1;let t=e.selector;for(let i of b.documents)if(b.match(t,i.textDocument))return!0;return!1}start(e){let t=this.getServices(e);for(let i of t)i.state==ye.Initial&&i.start()}getServices(e){let t=[];for(let i of this.registered.values())b.match(i.selector,e)>0&&t.push(i);return t}stop(e){let t=this.registered.get(e);if(!t){C.showMessage(`Service ${e} not found`,"error");return}return Promise.resolve(t.stop())}stopAll(){for(let e of this.registered.values())e.stop()}async toggle(e){let t=this.registered.get(e);if(!t){C.showMessage(`Service ${e} not found`,"error");return}let{state:i}=t;try{i==ye.Running?await Promise.resolve(t.stop()):i==ye.Initial?await t.start():i==ye.Stopped&&await t.restart()}catch(n){C.showMessage(`Service error: ${n.message}`,"error")}}getServiceStats(){let e=[];for(let[t,i]of this.registered)e.push({id:t,languageIds:dye(i.selector),state:pye(i.state)});return e}createCustomServices(){let e=b.getConfiguration().get("languageserver",{});for(let t of Object.keys(e)){let i=e[t];this.registLanguageClient(t,i)}}waitClient(e){let t=this.getService(e);return t&&t.state==ye.Running?Promise.resolve():t?new Promise(i=>{t.onServiceReady(()=>{i()})}):new Promise(i=>{let n=o=>{(o==e||o==`languageserver.${e}`)&&(this.off("ready",n),i())};this.on("ready",n)})}async registNotification(e,t){await this.waitClient(e);let i=this.getService(e);if(!i.client){C.showMessage(`Not a language client: ${e}`,"error");return}i.client.onNotification(t,async o=>{await b.nvim.call("coc#do_notify",[e,t,o])})}async sendNotification(e,t,i){if(!t)throw new Error("method required for ontification");let n=this.getService(e);if(!n||!n.client)throw new Error(`Language server ${e} not found`);if(n.state==ye.Starting&&await n.client.onReady(),n.state!=ye.Running)throw new Error(`Language server ${e} not running`);await Promise.resolve(n.client.sendNotification(t,i))}async sendRequest(e,t,i,n){if(!t)throw new Error("method required for sendRequest");let o=this.getService(e);if(o||await He(100),o=this.getService(e),!o||!o.client)throw new Error(`Language server ${e} not found`);if(o.stat
`).join(" "),e.slice(0,t*2)}dispose(){this.stop()}},oz=mC;function Rv(r){return r.filterText!=null?ij(r.filterText,r.label):r.label}function Aye(r){let e=[],t=0,i=0,n="";for(;i<r.length;i++){let o=r[i];o.charCodeAt(0)===32&&n&&n!="\\"&&t!=i&&(e.push(r.slice(t,i)),t=i+1),n=o}return t!=r.length&&e.push(r.slice(t,r.length)),e.map(o=>o.replace(/\\\s/g," ").trim()).filter(o=>o.length>0)}var Oye=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],az=j()("list-session"),vC=class{constructor(e,t,i,n,o=[],s){this.nvim=e;this.prompt=t;this.list=i;this.listOptions=n;this.listArgs=o;this.config=s;this.loadingFrame="";this.hidden=!1;this.disposables=[];this.args=[];this.ui=new ZH(e,i.name,n,s),this.history=new YH(t,i.name),this.worker=new oz(e,i,t,n,{interactiveDebounceTime:s.get("interactiveDebounceTime",100),extendedSearchMode:s.get("extendedSearchMode",!0)}),this.interactiveDebounceTime=s.get("interactiveDebounceTime",100);let a=gC.default(async()=>{let[u,c,f]=await e.eval('[coc#list#has_preview(),win_getid(),line(".")]');u&&c==this.winid&&await this.doPreview(f-1)},50);this.disposables.push({dispose:()=>{a.clear()}}),this.ui.onDidChangeLine(a,null,this.disposables),this.ui.onDidChangeLine(this.resolveItem,this,this.disposables),this.ui.onDidLineChange(this.resolveItem,this,this.disposables);let l=gC.default(async()=>{let{autoPreview:u}=this.listOptions;if(!u){let[c,f]=await e.eval("[coc#list#has_preview(),mode()]");if(!c||f!="n")return}await this.doAction("preview")},50);this.disposables.push({dispose:()=>{l.clear()}}),this.ui.onDidLineChange(l,null,this.disposables),this.ui.onDidLineChange(()=>{this.updateStatus()},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(async()=>{await this.hide()},null,this.disposables),this.ui.onDidDoubleClick(async()=>{await this.doAction()},null,this.disposables),this.worker.onDidChangeItems(async({items:u,reload:c,append:f,finished:p})=>{if(!this.hidden)if(f)await this.ui.appendItems(u);else{let d=this.config.get("height",10);p&&!n.interactive&&n.input.length==0&&(d=Math.min(u.length,d));let h=this.uiTokenSource=new sz.CancellationTokenSource;await this.ui.drawItems(u,Math.max(1,d),c,h.token)}},null,this.disposables),this.worker.onDidChangeLoading(u=>{this.hidden||(u?this.interval=setInterval(()=>{let c=Math.floor(new Date().getMilliseconds()/100);this.loadingFrame=Oye[c],this.updateStatus()},100):(this.interval&&(this.loadingFrame="",clearInterval(this.interval),this.interval=null),this.updateStatus()))},null,this.disposables)}async start(e){this.args=e,this.cwd=b.cwd,this.hidden=!1;let{listOptions:t,listArgs:i}=this,n=await this.nvim.eval('[win_getid(),bufnr("%"),winheight("%")]');this.listArgs=i,this.history.load(t.input||""),this.window=this.nvim.createWindow(n[0]),this.buffer=this.nvim.createBuffer(n[1]),this.savedHeight=n[2],await this.worker.loadItems(this.context)}async reloadItems(){if(!this.window)return;let e=await this.nvim.call("winbufnr",[this.window.id]);e!=-1&&(this.buffer=this.nvim.createBuffer(e),await this.worker.loadItems(this.context,!0))}async call(e){var o,s;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:(o=this.window)==null?void 0:o.id,bufnr:(s=this.buffer)==null?void 0:s.id,targets:t},n=await this.nvim.call(e,[i]);return this.prompt.start(),n}async chooseAction(){let{nvim:e}=this,{actions:t,defaultAction:i}=this.list,n=t.map(c=>c.name),o=n.indexOf(i);o!=-1&&(n.splice(o,1),n.unshift(i));let s=new Set,a=[],l=[];for(let c of n){let f=0;for(let p of c){if(!s.has(p)){s.add(p),a.push(`${c.slice(0,f)}&${c.slice(f)}`);break}f++}f==c.length&&l.push(c)}l.length&&(az.error(`Can't create shortcut for actions: ${l.join(",")} of "${this.name}" list`),n=n.filter(c=>!l.includes(c))),await e.call("coc#prompt#stop_prompt",["list"]);let u=await e.call("confirm",["Choose action:",a.join(`
`)]);await He(10),this.prompt.start(),u&&await this.doAction(n[u-1])}async doAction(e){let{list:t}=this;e=e||t.defaultAction;let i=t.actions.find(o=>o.name==e);if(!i){C.showMessage(`Action ${e} not found`,"error");return}let n;if(e=="preview"){let o=await this.ui.item;n=o?[o]:[]}else n=await this.ui.getItems();n.length&&await this.doItemAction(n,i)}async doPreview(e){let t=this.ui.getItem(e),i=this.list.actions.find(n=>n.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||(t.index=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}=this.list,i=t.find(n=>n.name==e);if(!i)throw new Error(`default action "${e}" not found`);return i}async hide(){if(this.hidden)return;this.uiTokenSource&&(this.uiTokenSource.cancel(),this.uiTokenSource.dispose(),this.uiTokenSource=null);let{nvim:e,interval:t}=this;t&&clearInterval(t),this.hidden=!0,this.worker.stop(),this.history.add();let{winid:i}=this.ui;this.ui.reset(),this.window&&i&&(await e.call("coc#list#hide",[this.window.id,this.savedHeight,i]),b.isVim&&(e.command("redraw",!0),await He(10))),e.call("coc#prompt#stop_prompt",["list"],!0)}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 n=await Promise.resolve(i.resolveItem(t));n&&e==this.ui.index&&await this.ui.updateItem(n,e)}}async showHelp(){await this.hide();let{list:e,nvim:t}=this;if(!e)return;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,n=await t.buffer,o=new ss;if(o.addLine("NAME","Label"),o.addLine(` ${e.name} - ${e.description||""}
`),o.addLine("SYNOPSIS","Label"),o.addLine(` :CocList [LIST OPTIONS] ${e.name}${i?" [ARGUMENTS]":""}
`),e.detail){o.addLine("DESCRIPTION","Label");let a=e.detail.split(`
`).map(l=>" "+l);o.addLine(a.join(`
`)+`
`)}if(i){o.addLine("ARGUMENTS","Label"),o.addLine("");for(let a of e.options)o.addLine(a.name,"Special"),o.addLine(` ${a.description}`),o.addLine("");o.addLine("")}let s=b.getConfiguration(`list.source.${e.name}`);if(Object.keys(s).length){o.addLine("CONFIGURATIONS","Label"),o.addLine("");let a={};ge.all.forEach(l=>{let{packageJSON:u}=l,{contributes:c}=u;if(!c)return;let{configuration:f}=c;if(f){let{properties:p}=f;if(p)for(let d of Object.keys(p))a[d]=p[d]}});for(let l of Object.keys(s)){let u=s[l],c=`list.source.${e.name}.${l}`,f=a[c]&&a[c].description?a[c].description:l;o.addLine(` "${c}"`,"MoreMsg"),o.addText(` - ${f}, current value: `),o.addText(JSON.stringify(u),"Special")}o.addLine("")}o.addLine("ACTIONS","Label"),o.addLine(` ${e.actions.map(a=>a.name).join(", ")}`),o.addLine(""),o.addLine("see ':h coc-list-options' for available list options.","Comment"),t.pauseNotification(),o.render(n,0,-1),t.command("setl nomod",!0),t.command("setl nomodifiable",!0),t.command("normal! gg",!0),t.command("nnoremap <buffer> q :bd!<CR>",!0),await t.resumeNotification()}switchMatcher(){let{matcher:e,interactive:t}=this.listOptions;if(t)return;let i=["fuzzy","strict","regex"],n=i.indexOf(e)+1;n>=i.length&&(n=0),this.listOptions.matcher=i[n],this.prompt.matcher=i[n],this.worker.drawItems()}updateStatus(){let{ui:e,list:t,nvim:i}=this;if(!e.winid)return;let n=i.createBuffer(e.bufnr),o={mode:this.prompt.mode.toUpperCase(),args:this.args.join(" "),name:t.name,cwd:this.cwd,loading:this.loadingFrame,total:this.worker.length};i.pauseNotification(),n.setVar("list_status",o,!0),i.command("redraws",!0),i.resumeNotification(!1,!0).logError()}get context(){let{winid:e}=this.ui;return{options:this.listOptions,args:this.listArgs,input:this.prompt.input,cwd:b.cwd,window:this.window,buffer:this.buffer,listWindow:e?this.nvim.createWindow(e):void 0}}redrawItems(){this.worker.drawItems()}onMouseEvent(e){switch(e){case"<LeftMouse>":return this.ui.onMouse("mouseDown");case"<LeftDrag>":return this.ui.onMouse("mouseDrag");case"<LeftRelease>":return this.ui.onMouse("mouseUp");case"<2-LeftMouse>":return this.ui.onMouse("doubleClick")}}async doNumberSelect(e){if(!this.listOptions.numberSelect)return!1;let t=e.charCodeAt(0);if(t>=48&&t<=57){let i=Number(e);return i==0&&(i=10),this.ui.length>=i&&(this.nvim.pauseNotification(),this.ui.setCursor(Number(e),0),await this.nvim.resumeNotification(),await this.doAction()),!0}return!1}jumpBack(){let{window:e,nvim:t}=this;e&&(t.pauseNotification(),t.call("coc#prompt#stop_prompt",["list"],!0),this.nvim.call("win_gotoid",[e.id],!0),t.resumeNotification(!1,!0).logError())}async resume(){this.winid&&await this.hide();let e=await this.nvim.eval('[win_getid(),bufnr("%"),winheight("%")]');this.hidden=!1,this.window=this.nvim.createWindow(e[0]),this.buffer=this.nvim.createBuffer(e[1]),this.savedHeight=e[2],this.prompt.start(),await this.ui.resume(),this.listOptions.autoPreview&&await this.doAction("preview")}async doItemAction(e,t){let{noQuit:i}=this.listOptions,{nvim:n}=this,o=t.persist===!0||t.name=="preview",s=this.winid&&(o||i);try{if(s?o||(n.pauseNotification(),n.call("coc#prompt#stop_prompt",["list"],!0),n.call("win_gotoid",[this.context.window.id],!0),await n.resumeNotification()):await this.hide(),t.multiple)await Promise.resolve(t.execute(e,this.context));else if(t.parallel)await Promise.all(e.map(a=>Promise.resolve(t.execute(a,this.context))));else for(let a of e)await Promise.resolve(t.execute(a,this.context));s&&this.ui.restoreWindow(),t.reload&&s&&await this.worker.loadItems(this.context,!0)}catch(a){C.showMessage(a.message,"error"),az.error(`Error on action "${t.name}"`,a)}}onInputChange(){this.timer&&clearTimeout(this.timer);let e=this.worker.length;if(this.listOptions.input=this.prompt.input,this.listOptions.interactive)this.worker.stop(),this.timer=setTimeout(async()=>{await this.worker.loadItems(this.context)},this.interactiveDebounceTime);else if(e){let t=Math.max(Math.min(Math.floor(e/200),300),50);this.timer=setTimeout(()=>{this.worker.drawItems()},t)}}dispose(){if(!this.hidden){this.hidden=!0,this.uiTo
`),filetype:"txt"}]:[];await e.show(l,{modes:["n"]})}},500)),global.hasOwnProperty("__TEST__"))return;this.checkExtensions().logError();let t=b.getConfiguration("coc.preferences"),i=t.get("extensionUpdateCheck","never"),n=t.get("silentAutoupdate",!0);if(i!="never"){let o=new Date,s=new Date(o.getFullYear(),o.getMonth(),o.getDate()-(i=="daily"?0:7)),a=this.db.fetch("lastUpdate");if(a&&Number(a)>s.getTime())return;this.outputChannel.appendLine("Start auto update..."),this.updateExtensions(!1,n).logError()}}async updateExtensions(e,t=!1){if(!this.npm)return;let i=await this.getLockedList(),n=await this.globalExtensionStats();n=n.filter(l=>![...i,...this.disabled].includes(l.id)),this.db.push("lastUpdate",Date.now()),t&&C.showMessage("Updating extensions, checkout output:///extensions for details.","more");let o=this.installBuffer=new R0(!0,e,t?this.outputChannel:void 0);o.setExtensions(n.map(l=>l.id)),await o.show(b.nvim);let s=dv(this.npm,this.modulesFolder);await vf(n,l=>{let{id:u}=l;o.startProgress([u]);let c=l.exotic?l.uri:null,f=s(u);return f.on("message",(p,d)=>{o.addMessage(u,p,d)}),f.update(c).then(p=>{o.finishProgress(u,!0),p&&this.loadExtension(p).logError()},p=>{o.addMessage(u,p.message),o.finishProgress(u,!1)})},t?1:3)}async checkExtensions(){let{globalExtensions:e}=b.env;if(e&&e.length){let t=this.filterGlobalExtensions(e);this.installExtensions(t).logError()}}get installer(){return dv(this.npm,this.modulesFolder)}async installExtensions(e=[]){let{npm:t}=this;if(!t||!e.length)return;e=eg(e);let i=this.installBuffer=new R0;i.setExtensions(e),await i.show(b.nvim);let n=dv(this.npm,this.modulesFolder);await vf(e,s=>{i.startProgress([s]);let a=n(s);return a.on("message",(l,u)=>{i.addMessage(s,l,u)}),a.install().then(l=>{i.finishProgress(s,!0);let u=Fe.default.join(this.modulesFolder,l);this.loadExtension(u).logError()},l=>{i.addMessage(s,l.message),i.finishProgress(s,!1),Sr.error(`Error on install ${s}`,l)})})}getMissingExtensions(){let e=this.loadJson()||{dependencies:{}},t=[];for(let i of Object.keys(e.dependencies)){let n=Fe.default.join(this.modulesFolder,i);if(!st.default.existsSync(n)){let o=e.dependencies[i];o.startsWith("http")?t.push(o):t.push(i)}}return t}get npm(){let e=b.getConfiguration("npm").get("binPath","npm");e=b.expand(e);for(let t of[e,"yarnpkg","yarn","npm"])try{return Yz.default.sync(t)}catch(i){continue}return C.showMessage("Can't find npm or yarn in your $PATH","error"),null}get all(){return Array.from(this.extensions.values()).map(e=>e.extension).filter(e=>!this.isDisabled(e.id))}getExtension(e){return this.extensions.get(e)}getExtensionState(e){if(this.isDisabled(e))return"disabled";let i=this.extensions.get(e);if(!i)return"unknown";let{extension:n}=i;return n.isActive?"activated":"loaded"}async getExtensionStates(){let e=await this.localExtensionStats([]),t=await this.globalExtensionStats();return e.concat(t.filter(i=>e.find(n=>n.id==i.id)==null))}async getLockedList(){let e=await this.db.fetch("extension");return e=e||{},Object.keys(e).filter(t=>e[t].locked===!0)}async toggleLock(e){let t=`extension.${e}.locked`;await this.db.fetch(t)?this.db.delete(t):this.db.push(t,!0)}async toggleExtension(e){let t=this.getExtensionState(e);if(t==null)return;t=="activated"&&await this.deactivate(e);let i=`extension.${e}.disabled`;if(this.db.push(i,t!="disabled"),t!="disabled")this.disabled.add(e),await this.unloadExtension(e);else{this.disabled.delete(e);let n=Fe.default.join(this.modulesFolder,e);st.default.existsSync(n)&&await this.loadExtension(n)}await He(200)}async reloadExtension(e){let t=this.extensions.get(e);if(!t){C.showMessage(`Extension ${e} not registered`,"error");return}if(t.type==Jr.Internal){C.showMessage(`Can't reload internal extension "${t.id}"`,"warning");return}t.type==Jr.SingleFile?await this.loadExtensionFile(t.filepath):t.directory?await this.loadExtension(t.directory):C.showMessage(`Can't reload extension ${t.id}`,"warning")}async cleanExtensions(){let e=this.modulesFolder;if(!st.default.existsSync(e))return[];let t=this.globalExtensions,i=[];for(let n of t){let o=Fe.default
${s.message}
${s.stack}`)});return}let n=[],o=()=>(z(n),new Promise(s=>{if(!this.canActivate(e))return this.outputChannel.appendLine(`Extension ${e} is disabled or not loaded.`),s();let a=setTimeout(()=>{this.outputChannel.appendLine(`Extension ${e} activate cost more than 1s`),s()},1e3);this.activate(e).then(()=>{clearTimeout(a),s()},l=>{clearTimeout(a),C.showMessage(`Error on activate extension ${e}: ${l.message}`),this.outputChannel.appendLine(`Error on activate extension ${e}:${l.message}
${l.stack}`),s()})}));for(let s of i){let a=s.split(":"),l=a[0];if(l=="onLanguage"){if(b.filetypes.has(a[1])){await o();return}b.onDidOpenTextDocument(u=>{u.languageId==a[1]&&o()},null,n)}else if(l=="onCommand")me.onCommandList.push(a[1]),A.on("Command",async u=>{u==a[1]&&(await o(),await He(500))},null,n);else if(l=="workspaceContains"){let u=async()=>{let f=b.workspaceFolders.map(p=>$.parse(p.uri).fsPath);for(let p of f)if(Bo(p,a[1].split(/\s+/)))return await o(),!0};if(await u())return;b.onDidChangeWorkspaceFolders(u,null,n)}else if(l=="onFileSystem"){for(let u of b.documents)if($.parse(u.uri).scheme==a[1]){await o();return}b.onDidOpenTextDocument(u=>{$.parse(u.uri).scheme==a[1]&&o()},null,n)}else C.showMessage(`Unsupported event ${s} of ${e}`,"error")}}createExtension(e,t,i){let n=t.name,o=!1,s=null,a=Fe.default.join(e,t.main||"index.js"),l,u=[],c={activate:async()=>{if(o)return s;let p={subscriptions:u,extensionPath:e,globalState:this.memos.createMemento(`${n}|global`),workspaceState:this.memos.createMemento(`${n}|${b.rootPath}`),asAbsolutePath:d=>Fe.default.join(e,d),storagePath:Fe.default.join(this.root,`${n}-data`),logger:Xz(n)};if(o=!0,!l)try{let d=!(t.engines||{}).hasOwnProperty("coc");l=Gz(n,a,d)}catch(d){Sr.error(`Error on createExtension ${n} from ${a}`,d);return}try{s=await Promise.resolve(l.activate(p)),Sr.debug("activate:",n)}catch(d){o=!1,Sr.error(`Error on active extension ${n}: ${d.stack}`,d)}return s}};Object.defineProperties(c,{id:{get:()=>n,enumerable:!0},packageJSON:{get:()=>t,enumerable:!0},extensionPath:{get:()=>e,enumerable:!0},isActive:{get:()=>o,enumerable:!0},exports:{get:()=>s,enumerable:!0}}),this.extensions.set(n,{id:n,type:i,isLocal:i==Jr.Local,extension:c,directory:e,filepath:a,deactivate:()=>{if(!!o&&(o=!1,z(u),u.splice(0,u.length),u=[],l&&l.deactivate))try{return Promise.resolve(l.deactivate()).catch(p=>{Sr.error(`Error on ${n} deactivate: `,p)})}catch(p){Sr.error(`Error on ${n} deactivate: `,p)}}});let{contributes:f}=t;if(f){let{configuration:p,rootPatterns:d,commands:h}=f;if(p&&p.properties){let{properties:m}=p,y={};for(let v of Object.keys(m)){let x=m[v].default;x!=null&&(y[v]=x)}b.configurations.extendsDefaults(y)}if(d&&d.length)for(let m of d)b.addRootPattern(m.filetype,m.patterns);if(h&&h.length)for(let m of h)me.titles.set(m.command,m.title)}this._onDidLoadExtension.fire(c),this.activated&&this.setupActiveEvents(n,t).logError()}filterGlobalExtensions(e){e=e.map(s=>s.replace(/@.*$/,""));let t=e.filter(s=>!this.disabled.has(s));t=t.filter(s=>!this.extensions.has(s));let i=this.loadJson(),n=[],o=[];if(i&&i.dependencies)for(let s of Object.keys(i.dependencies)){let a=i.dependencies[s];typeof a=="string"&&st.default.existsSync(Fe.default.join(this.modulesFolder,s,"package.json"))&&(o.push(s),/^https?:/.test(a)&&n.push(a))}return t=t.filter(s=>/^https?:/.test(s)?!n.some(a=>a.startsWith(s)):!o.includes(s)),t}get modulesFolder(){return Fe.default.join(this.root,global.hasOwnProperty("__TEST__")?"":"node_modules")}canActivate(e){return!this.disabled.has(e)&&this.extensions.has(e)}async unloadExtension(e){this.extensions.get(e)&&(await this.deactivate(e),this.extensions.delete(e),this._onDidUnloadExtension.fire(e))}checkDirectory(e){try{let t=Fe.default.join(e,"package.json");if(!st.default.existsSync(t))throw new Error("package.json not found");let i=JSON.parse(st.default.readFileSync(t,"utf8")),{name:n,engines:o,main:s}=i;if(!n||!o)throw new Error("can't find name & engines in package.json");if(!o||!wt(o))throw new Error(`invalid engines in ${t}`);if(s&&!st.default.existsSync(Fe.default.join(e,s)))throw new Error(`main file ${s} not found, you may need to build the project.`);let a=Object.keys(o);if(!a.includes("coc")&&!a.includes("vscode"))throw new Error("Engines in package.json doesn't have coc or vscode");if(a.includes("coc")){let l=o.coc.replace(/^\^/,">=");if(!Jz.default.satisfies(b.version,l))throw new Error(`Please update coc.nvim, ${i.name} requires coc.nvim ${o.coc}`)}return!0}catch(t){return t}}dispose(){z(this.disposables)}},ge=new Zz;var K4e=j()("model-source"),OC=class{c
`)&&Me(t.start,t.end)==0&&Me(this.range.start,t.start)==0&&this._placeholders.findIndex(s=>Me(s.range.start,t.start)==0)!==-1)return!1;let n=gD(this.range.start,e);return n.line==0&&n.character==0||this.adjustPosition(n.character,n.line),!0}get isPlainText(){return this._placeholders.length>1?!1:this._placeholders.every(e=>e.value=="")}get finalCount(){return this._placeholders.filter(e=>e.isFinalTabstop).length}toString(){return this.tmSnippet.toString()}get range(){let{position:e}=this,t=this.tmSnippet.toString(),n=kt.create("untitled:/1","snippet",0,t).positionAt(t.length),o=n.line==0?e.character+n.character:n.character;return oo.Range.create(e,oo.Position.create(e.line+n.line,o))}get firstPlaceholder(){let e=0;for(let t of this._placeholders)t.index!=0&&(e==0||t.index<e)&&(e=t.index);return this.getPlaceholder(e)}get lastPlaceholder(){let e=0;for(let t of this._placeholders)(e==0||t.index>e)&&(e=t.index);return this.getPlaceholder(e)}getPlaceholderById(e){return this._placeholders.find(t=>t.id==e)}getPlaceholder(e){let t=this._placeholders.filter(n=>n.index==e),i=t.filter(n=>!n.transform);return i.length?i[0]:t[0]}getPrevPlaceholder(e){if(e==0)return this.lastPlaceholder;let t=this.getPlaceholder(e-1);return t||this.getPrevPlaceholder(e-1)}getNextPlaceholder(e){let t=this._placeholders.map(o=>o.index),i=Math.max.apply(null,t);if(e>=i)return this.finalPlaceholder;let n=this.getPlaceholder(e+1);return n||this.getNextPlaceholder(e+1)}get finalPlaceholder(){return this._placeholders.find(e=>e.isFinalTabstop)}getPlaceholderByRange(e){return this._placeholders.find(t=>Ji(e,t.range))}insertSnippet(e,t,i){let{start:n}=e.range,o=oo.Position.create(i.start.line-n.line,i.start.line==n.line?i.start.character-n.character:i.start.character),s=oo.Position.create(i.end.line-n.line,i.end.line==n.line?i.end.character-n.character:i.end.character),a=oo.Range.create(o,s),l=this.tmSnippet.insertSnippet(t,e.id,a);return this.update(),l}updatePlaceholder(e,t){let{start:i,end:n}=t.range,{range:o}=this,{value:s,id:a,index:l}=e,u=jB(e.range,s,t),c=0;if(!u.includes(`
`)){for(let d of this._placeholders)if(d.index==l&&d.id<a&&d.line==e.range.start.line){let h=this.tmSnippet.getPlaceholderText(d.id,u);c=c+ue(h)-ue(d.value)}}e.isVariable?this.tmSnippet.updateVariable(a,u):this.tmSnippet.updatePlaceholder(a,u);let f=$B(o.end,t),p={range:oo.Range.create(o.start,f),newText:this.tmSnippet.toString()};return this.update(),{edits:[p],delta:c}}update(){let e=this.tmSnippet,{line:t,character:i}=this.position,n=kt.create("untitled:/1","snippet",0,e.toString()),{placeholders:o,variables:s,maxIndexNumber:a}=e,l=new Map,u=a+1;this._placeholders=[...o,...s].map((c,f)=>{let p=e.offset(c),d=n.positionAt(p),h={line:t+d.line,character:d.line==0?i+d.character:d.character},m;if(c instanceof yn){let w=c.name;l.has(w)?m=l.get(w):(l.set(w,u),m=u,u=u+1)}else m=c.index;let y=c.toString(),v=y.split(/\r?\n/),x={range:oo.Range.create(h,{line:h.line+v.length-1,character:v.length==1?h.character+y.length:v[v.length-1].length}),transform:c.transform!=null,line:h.line,id:f,index:m,value:y,isVariable:c instanceof yn,isFinalTabstop:c.index===0};if(Object.defineProperty(x,"snippet",{enumerable:!1}),c instanceof ei&&c.choice){let{options:w}=c.choice;w&&w.length&&(x.choice=w.map(E=>E.value))}return x})}};var Qp=S(require("path"));var uze=j()("snippets-variable"),ed=class{constructor(){this._variableToValue={};let e=new Date;Object.assign(this._variableToValue,{CURRENT_YEAR:e.getFullYear().toString(),CURRENT_YEAR_SHORT:e.getFullYear().toString().slice(-2),CURRENT_MONTH:(e.getMonth()+1).toString(),CURRENT_DATE:e.getDate().toString(),CURRENT_HOUR:e.getHours().toString(),CURRENT_MINUTE:e.getMinutes().toString(),CURRENT_SECOND:e.getSeconds().toString(),CURRENT_DAY_NAME:e.toLocaleString("en-US",{weekday:"long"}),CURRENT_DAY_NAME_SHORT:e.toLocaleString("en-US",{weekday:"short"}),CURRENT_MONTH_NAME:e.toLocaleString("en-US",{month:"long"}),CURRENT_MONTH_NAME_SHORT:e.toLocaleString("en-US",{month:"short"}),TM_FILENAME:null,TM_FILENAME_BASE:null,TM_DIRECTORY:null,TM_FILEPATH:null,YANK:null,TM_LINE_INDEX:null,TM_LINE_NUMBER:null,TM_CURRENT_LINE:null,TM_CURRENT_WORD:null,TM_SELECTED_TEXT:null,CLIPBOARD:null})}async resovleValue(e){let{nvim:t}=C;if(["TM_FILENAME","TM_FILENAME_BASE","TM_DIRECTORY","TM_FILEPATH"].includes(e)){let i=await t.eval('expand("%:p")');if(e=="TM_FILENAME")return Qp.default.basename(i);if(e=="TM_FILENAME_BASE")return Qp.default.basename(i,Qp.default.extname(i));if(e=="TM_DIRECTORY")return Qp.default.dirname(i);if(e=="TM_FILEPATH")return i}if(e=="YANK")return await t.call("getreg",['""']);if(e=="TM_LINE_INDEX")return(await t.call("line",["."])-1).toString();if(e=="TM_LINE_NUMBER")return(await t.call("line",["."])).toString();if(e=="TM_CURRENT_LINE")return await t.call("getline",["."]);if(e=="TM_CURRENT_WORD")return await t.eval("expand('<cword>')");if(e=="TM_SELECTED_TEXT")return await t.eval("get(g:,'coc_selected_text', '')");if(e=="CLIPBOARD")return await t.eval("@*")}async resolve(e){let t=e.name,i=this._variableToValue[t];if(i!=null)return i.toString();let n=await this.resovleValue(t);return n||(e.children&&e.children.length?e.toString():this._variableToValue.hasOwnProperty(t)?"":t)}};var Mu=j()("snippets-session"),jC=class{constructor(e,t){this.nvim=e;this.bufnr=t;this._isActive=!1;this._currId=0;this.applying=!1;this.preferComplete=!1;this._snippet=null;this._onCancelEvent=new Lu.Emitter;this.onCancel=this._onCancelEvent.event;let i=b.getConfiguration("coc.preferences"),n=b.getConfiguration("suggest");this.preferComplete=i.get("preferCompleteThanJumpPlaceholder",n.get("preferCompleteThanJumpPlaceholder",!1))}async start(e,t=!0,i){let{document:n}=this;if(!n||!n.attached)return!1;if(A.fire("InsertSnippet",[]).logError(),!i){let d=await C.getCursorPosition();i=Lu.Range.create(d,d)}let o=i.start,s=await b.getFormatOptions(this.document.uri);await n.patchChange(!0);let a=n.getline(o.line),l=a.match(/^\s*/)[0],u=lbe(e,l,s),c=new ed,f=new BC(u,o,c);await f.init();let p=Lu.TextEdit.replace(i,f.toString());if(e.endsWith(`
`)&&a.slice(o.character).length&&(p.newText=p.newText+l,u=u+l),this.applying=!0,await n.applyEdits([p]),this.applying=!1,this._isActive){let d=this.findPlaceholder(i);if(d&&!d.isFinalTabstop){let h=this.snippet.insertSnippet(d,u,i),m=this.snippet.getPlaceholder(h);return this._currId=m.id,t&&await this.selectPlaceholder(m),!0}}if(f.isPlainText){this.deactivate();let d=f.finalPlaceholder;return await C.moveTo(d.range.start),!1}return this._snippet=f,this._currId=f.firstPlaceholder.id,t&&await this.selectPlaceholder(f.firstPlaceholder),this.activate(),!0}activate(){this._isActive||(this._isActive=!0,this.nvim.call("coc#snippet#enable",[],!0))}deactivate(){this._isActive&&(this._isActive=!1,this._snippet=null,this.nvim.call("coc#snippet#disable",[],!0),Mu.debug("[SnippetManager::cancel]")),this._onCancelEvent.fire(void 0),this._onCancelEvent.dispose()}get isActive(){return this._isActive}async nextPlaceholder(){if(!this.isActive)return;await this.document.patchChange();let e=this.placeholder,t=this.snippet.getNextPlaceholder(e.index);await this.selectPlaceholder(t)}async previousPlaceholder(){if(!this.isActive)return;await this.document.patchChange();let e=this.placeholder,t=this.snippet.getPrevPlaceholder(e.index);await this.selectPlaceholder(t)}async synchronizeUpdatedPlaceholders(e){if(!this.isActive||!this.document||this.applying)return;let t={range:e.range,newText:e.text},{snippet:i}=this;if(i.adjustTextEdit(t))return;if(Me(t.range.start,i.range.end)>0){if(!t.newText)return;Mu.info("Content change after snippet, cancelling snippet session"),this.deactivate();return}let o=this.findPlaceholder(t.range);if(!o){Mu.info("Change outside placeholder, cancelling snippet session"),this.deactivate();return}if(o.isFinalTabstop&&i.finalCount<=1){Mu.info("Change final placeholder, cancelling snippet session"),this.deactivate();return}this._currId=o.id;let{edits:s,delta:a}=i.updatePlaceholder(o,t);!s.length||(this.applying=!0,await this.document.applyEdits(s),this.applying=!1,a&&await this.nvim.call("coc#util#move_cursor",a))}async selectCurrentPlaceholder(e=!0){let t=this.snippet.getPlaceholderById(this._currId);t&&await this.selectPlaceholder(t,e)}async selectPlaceholder(e,t=!0){let{nvim:i,document:n}=this;if(!n||!e)return;let{start:o,end:s}=e.range,a=s.character-o.character,l=ue(n.getline(o.line).slice(0,o.character))+1;this._currId=e.id,e.choice?(await i.call("coc#snippet#show_choices",[o.line+1,l,a,e.choice]),t&&i.call("coc#util#do_autocmd",["CocJumpPlaceholder"],!0)):await this.select(e,t)}async select(e,t=!0){let{range:i,value:n,isFinalTabstop:o}=e,{document:s,nvim:a}=this,{start:l,end:u}=i,{textDocument:c}=s,f=c.offsetAt(u)-c.offsetAt(l),p=s.getline(l.line),d=p?ue(p.slice(0,l.character)):0,h=s.getline(u.line),m=h?ue(h.slice(0,u.character)):0;a.setVar("coc_last_placeholder",{current_text:n,start:{line:l.line,col:d},end:{line:u.line,col:m}},!0);let[y,v,x,w]=await a.eval("[&virtualedit, &selection, pumvisible(), mode()]"),E="";if(x&&this.preferComplete){let P=cs.hasSelected()?"":"\\<C-n>";await a.eval(`feedkeys("${P}\\<C-y>", 'in')`);return}w!="n"&&(E+="\\<Esc>"),f==0?d==0||!w.startsWith("i")&&d<ue(p)?E+="i":E+="a":(E+="v",m=await this.getVirtualCol(u.line+1,m),v=="inclusive"?u.character==0?E+=`${u.line}G`:E+=`${u.line+1}G${m}|`:v=="old"?E+=`${u.line+1}G${m}|`:E+=`${u.line+1}G${m+1}|`,d=await this.getVirtualCol(l.line+1,d),E+=`o${l.line+1}G${d+1}|o\\<c-g>`),w=="i"&&E=="\\<Esc>a"&&(E=""),a.pauseNotification(),a.setOption("virtualedit","onemore",!0),a.call("cursor",[l.line+1,d+(E=="a"?0:1)],!0),E&&a.call("eval",[`feedkeys("${E}", 'in')`],!0),w=="i"&&a.call("coc#_cancel",[],!0),a.setOption("virtualedit",y,!0),o&&(this.snippet.finalCount==1?(Mu.info("Jump to final placeholder, cancelling snippet session"),this.deactivate()):a.call("coc#snippet#disable",[],!0)),b.env.isVim&&a.command("redraw",!0),await a.resumeNotification(),t&&a.call("coc#util#do_autocmd",["CocJumpPlaceholder"],!0)}async getVirtualCol(e,t){let{nvim:i}=this;return await i.eval(`virtcol([${e}, ${t}])`)}async checkPosition(){if(!this.isActive)return;let e=await C.get
`)}var Rze=j()("snippets-manager"),w9=class{constructor(){this.sessionMap=new Map;this.disposables=[];b.onDidChangeTextDocument(async e=>{let t=this.getSession(e.bufnr);t&&await t.synchronizeUpdatedPlaceholders(e.contentChanges[0])},null,this.disposables),b.onDidCloseTextDocument(e=>{let t=b.getDocument(e.uri);if(!t)return;let i=this.getSession(t.bufnr);i&&i.deactivate()},null,this.disposables),A.on("BufEnter",async e=>{let t=this.getSession(e);!this.statusItem||(t&&t.isActive?this.statusItem.show():this.statusItem.hide())},null,this.disposables),A.on("InsertEnter",async()=>{let{session:e}=this;!e||await e.checkPosition()},null,this.disposables)}init(){let e=b.getConfiguration("coc.preferences");this.statusItem=C.createStatusBarItem(0),this.statusItem.text=e.get("snippetStatusText","SNIP")}async insertSnippet(e,t=!0,i){let{bufnr:n}=b,o=this.getSession(n);o||(o=new jC(b.nvim,n),this.sessionMap.set(n,o),o.onCancel(()=>{this.sessionMap.delete(n),b.bufnr==n&&this.statusItem.hide()}));let s=await o.start(e,t,i);return s&&this.statusItem.show(),s}async selectCurrentPlaceholder(e=!0){let{session:t}=this;if(t)return await t.selectCurrentPlaceholder(e)}async nextPlaceholder(){let{session:e}=this;if(e)return await e.nextPlaceholder();b.nvim.call("coc#snippet#disable",[],!0),this.statusItem.hide()}async previousPlaceholder(){let{session:e}=this;if(e)return await e.previousPlaceholder();b.nvim.call("coc#snippet#disable",[],!0),this.statusItem.hide()}cancel(){let e=this.getSession(b.bufnr);if(e)return e.deactivate();b.nvim.call("coc#snippet#disable",[],!0),this.statusItem&&this.statusItem.hide()}get session(){let e=this.getSession(b.bufnr);return e&&e.isActive?e:null}isActived(e){let t=this.getSession(e);return t&&t.isActive}jumpable(){let{session:e}=this;if(!e)return!1;let t=e.placeholder;return!!(t&&!t.isFinalTabstop)}getSession(e){return this.sessionMap.get(e)}async resolveSnippet(e){let i=new Ho().parse(e,!0),n=new ed;return await i.resolveVariables(n),i}dispose(){this.cancel();for(let e of this.disposables)e.dispose()}},Ft=new w9;var Wze=j()("commands"),x9=class{constructor(e,t,i,n=!1){this.id=e;this.impl=t;this.thisArg=i;this.internal=n}execute(...e){let{impl:t,thisArg:i}=this;return t.apply(i,e||[])}dispose(){this.thisArg=null,this.impl=null}},D9=class{constructor(){this.commands=new Map;this.titles=new Map;this.onCommandList=[]}init(e,t){this.mru=b.createMru("commands"),this.register({id:"vscode.open",execute:async i=>{e.call("coc#util#open_url",i.toString(),!0)}},!0),this.register({id:"workbench.action.reloadWindow",execute:async()=>{await e.command("edit")}},!0),this.register({id:"editor.action.insertSnippet",execute:async i=>(e.call("coc#_cancel",[],!0),await Ft.insertSnippet(i.newText,!0,i.range))},!0),this.register({id:"editor.action.doCodeAction",execute:async i=>{await t.cocAction("doCodeAction",i)}},!0),this.register({id:"editor.action.triggerSuggest",execute:async()=>{await He(60),e.call("coc#start",[],!0)}},!0),this.register({id:"editor.action.triggerParameterHints",execute:async()=>{await He(60),await t.cocAction("showSignatureHelp")}},!0),this.register({id:"editor.action.addRanges",execute:async i=>{await t.cocAction("addRanges",i)}},!0),this.register({id:"editor.action.restart",execute:async()=>{await He(30),e.command("CocRestart",!0)}},!0),this.register({id:"editor.action.showReferences",execute:async(i,n,o)=>{await b.showLocations(o)}},!0),this.register({id:"editor.action.rename",execute:async(i,n)=>{await b.jumpTo(i,n),await t.cocAction("rename")}},!0),this.register({id:"editor.action.format",execute:async()=>{await t.cocAction("format")}},!0),this.register({id:"workspace.diffDocument",execute:async()=>{let i=await b.document;!i||await e.call("coc#util#diff_content",[i.getLines()])}}),this.register({id:"workspace.clearWatchman",execute:async()=>{(await C.runTerminalCommand("watchman watch-del-all")).success&&C.showMessage("Cleared watchman watching directories.")}},!1,"run watch-del-all for watchman to free up memory."),this.register({id:"workspace.workspaceFolders",execute:async()=>{let n=b.workspaceFolders.
`),o=n.length-(t.end.line-t.start.line+1);if(this.line=this.line+o,t.end.line==this.line){let s=t.start.line==t.end.line?t.end.character-t.start.character:t.end.character;n.length>1&&t.start.line==t.end.line&&(s=s+t.start.character);let a=0;n.length>1?a=n[n.length-1].length:t.start.line==t.end.line?a=i.length:a=t.start.character+i.length;let l=a-s;for(let u of["start","end","currStart","currEnd"])this[u]+=l}}sync(){this.start=this.currStart,this.end=this.currEnd}get textEdit(){return{range:this.range,newText:this.text}}},WC=UC;var rd=S(W());function HC(r,e){let t=[];for(let i=e.start.line;i<=e.end.line;i++){let n=r.getline(i)||"",o=i==e.start.line?e.start.character:0,s=i==e.end.line?e.end.character:n.length;o!=s&&t.push(rd.Range.create(i,o,i,s))}return t}function S9(r,e){let{start:t,end:i}=e;t.line>i.line&&([t,i]=[i,t]);let n=t.character<i.character?t.character:i.character,o=t.character<i.character?i.character:t.character,s=[];for(let a=t.line;a<=i.line;a++){let l=r.getline(a);s.push(rd.Range.create(a,n,a,Math.min(l.length,o)))}return s}function zC(r,e){let{line:t,character:i}=e;return rd.Position.create(r.line+t,t==0?r.character+i:i)}function E9(r,e){if(r.newText.length!=e.newText.length)return!1;let{range:t}=r;return t.end.character-t.start.character==e.range.end.character-e.range.start.character}var a9e=j()("cursors-session"),GC=class{constructor(e,t,i){this.nvim=e;this.doc=t;this.config=i;this._onDidCancel=new qu.Emitter;this.onDidCancel=this._onDidCancel.event;this.disposables=[];this.ranges=[];this.activated=!0;this.changing=!1;this.changed=!1;this.doc.forceSync(),this.textDocument=this.doc.textDocument,this.buffer.setVar("coc_cursors_activated",1,!0);let{cancelKey:n,nextKey:o,previousKey:s}=this.config;this.disposables.push(b.registerLocalKeymap("n",n,()=>{this.cancel()},!0)),this.disposables.push(b.registerLocalKeymap("n",o,async()=>{if(!this.activated)return;let a=this.ranges.map(u=>u.currRange),l=await C.getCursorPosition();for(let u of a)if(Me(u.start,l)>0){await C.moveTo(u.start);return}a.length&&await C.moveTo(a[0].start)},!0)),this.disposables.push(b.registerLocalKeymap("n",s,async()=>{if(!this.activated)return;let a=this.ranges.map(u=>u.currRange);a.reverse();let l=await C.getCursorPosition();for(let u of a)if(Me(u.end,l)<0){await C.moveTo(u.start);return}a.length&&await C.moveTo(a[a.length-1].start)},!0)),this.doc.onDocumentChange(this.onChange,this,this.disposables)}async onChange(e){if(!this.activated||this.ranges.length==0||this.changing)return;let t=e.contentChanges[0],{text:i,range:n}=t,o=this.ranges.some(l=>ql(n,l.currRange)),s=this.ranges[0].currRange.start;if(i.endsWith(`
`)&&Me(s,n.end)==0&&(o=!1),!o){this.ranges.forEach(l=>{l.adjustFromEdit({range:n,newText:i})}),this.doHighlights(),this.textDocument=this.doc.textDocument;return}this.changed=!0;let a=this.getTextRange(n,i);a?await this.applySingleEdit(a,{range:n,newText:i}):(this.applyComposedEdit(e.original,{range:n,newText:i}),this.activated&&(this.ranges.forEach(l=>{l.sync()}),this.textDocument=this.doc.textDocument))}doHighlights(){let{nvim:e,buffer:t,ranges:i}=this;t.clearNamespace("cursors");let n=i.map(o=>o.currRange);t.highlightRanges("cursors","CocCursorRange",n),e.command("redraw",!0)}addRanges(e){let{nvim:t,doc:i}=this;if(this.changed)return C.showMessage("Can't add ranges after range change."),!1;this.ranges=this.ranges.filter(a=>{let{currRange:l}=a;return!e.some(u=>Mm(u,l))});let{textDocument:n}=i;for(let a of e){let{line:l}=a.start,u=new WC(l,a.start.character,a.end.character,n.getText(a),0);this.ranges.push(u)}this.ranges.sort((a,l)=>Me(a.range.start,l.range.start));let o=0,s=-1;for(let a of this.ranges){let{line:l}=a;l!=s&&(o=0),a.preCount=o,o=o+1,s=l}return t.pauseNotification(),this.doHighlights(),t.resumeNotification(!1,!0),!0}cancel(){if(!this.activated)return;let{nvim:e}=this;this.activated=!1;let{cancelKey:t,nextKey:i,previousKey:n}=this.config;e.pauseNotification(),this.buffer.clearNamespace("cursors"),this.buffer.setVar("coc_cursors_activated",0,!0),e.command("redraw",!0),e.resumeNotification(!1,!0),this._onDidCancel.fire()}dispose(){if(!!this.doc){this._onDidCancel.dispose();for(let e of this.disposables)e.dispose();this.ranges=[],this.doc=null,this.textDocument=null}}get buffer(){return this.nvim.createBuffer(this.doc.bufnr)}getTextRange(e,t){let{ranges:i}=this;if(t.indexOf(`
`)!==-1||e.start.line!=e.end.line)return null;i.sort((n,o)=>n.line!=o.line?n.line-o.line:n.currRange.start.character-o.currRange.start.character);for(let n=0;n<i.length;n++){let o=i[n];if(Ji(e,o.currRange))return o;if(o.line==e.start.line&&t.length&&e.start.character==o.currRange.end.character){let s=i[n+1];return s&&Wt(s.currRange.start,e)?null:o}}return null}adjustRanges(e,t,i){let{ranges:n}=this;if(t.start.character==t.end.character)if(e.currRange.end.character==t.start.character)n.forEach(s=>{s.add(s.text.length,i)});else{let s=t.start.character-e.currRange.start.character;n.forEach(a=>{a.add(Math.min(a.text.length,s),i)})}else{let o=t.end.character-t.start.character;if(e.currRange.end.character==t.end.character)if(e.currRange.start.character==t.start.character)if(i.includes(e.text)){let a=i.indexOf(e.text),l=a==0?"":i.slice(0,a),u=i.slice(a+e.text.length);l&&n.forEach(c=>c.add(0,l)),u&&n.forEach(c=>c.add(c.text.length,u))}else if(e.text.includes(i)){let a=e.text.indexOf(i),l=e.text.length-(a+i.length);a!=0&&n.forEach(u=>u.replace(0,a)),l>0&&n.forEach(u=>u.replace(u.text.length-l,u.text.length))}else this.cancel();else n.forEach(a=>{let l=a.text.length;a.replace(Math.max(0,l-o),l,i)});else{let a=t.start.character-e.currRange.start.character;n.forEach(l=>{let u=l.text.length;l.replace(a,Math.min(a+o,u),i)})}}}addRange(e,t){if(this.changed){C.showMessage("Can't add range after range change.");return}let{ranges:i}=this,n=i.findIndex(o=>ql(o.range,e));if(n!==-1){i.splice(n,1);for(let o of i)o.line==e.start.line&&o.start>e.start.character&&(o.preCount=o.preCount-1)}else{let o=0,s=0,{line:a}=e.start;for(let u of i){if(u.line>a||u.line==a&&u.start>e.end.character)break;u.line==a&&o++,s++}let l=new WC(a,e.start.character,e.end.character,t,o);i.splice(s,0,l);for(let u of i)u.line==e.start.line&&u.start>e.start.character&&(u.preCount=u.preCount+1)}this.ranges.length==0?this.cancel():this.doHighlights()}async applySingleEdit(e,t){let{range:i,newText:n}=t,{doc:o}=this;if(this.adjustRanges(e,i,n),this.ranges.length==1){this.doHighlights();return}let s=this.ranges.map(d=>d.textEdit),l=kt.applyEdits(this.textDocument,s).split(`
`),u=new Set,c=[];for(let d of this.ranges)u.has(d.line)||(u.add(d.line),c.push([d.line,l[d.line]]));let{nvim:f}=this;this.changing=!0,await o.changeLines(c),this.changing=!1,this.activated&&(this.ranges.forEach(d=>{d.sync()}),this.textDocument=this.doc.textDocument),f.pauseNotification();let{cursor:p}=A;if(e.preCount>0&&p.bufnr==o.bufnr&&e.line+1==p.lnum){let d=e.preCount*(n.length-(i.end.character-i.start.character));f.call("cursor",[p.lnum,p.col+d],!0)}this.doHighlights(),f.resumeNotification(!1,!0)}applyComposedEdit(e,t){let{range:i,newText:n}=t,{ranges:o}=this,s=kt.create("file:///1","",0,e),a=[],l=Nu.default(e,n),u=0;for(let c=0;c<l.length;c++){let f=l[c],p=zC(i.start,s.positionAt(u));if(f[0]==Nu.default.EQUAL)u=u+f[1].length;else if(f[0]==Nu.default.DELETE){let d=zC(i.start,s.positionAt(u+f[1].length));l[c+1]&&l[c+1][0]==Nu.default.INSERT?(a.push({range:qu.Range.create(p,d),newText:l[c+1][1]}),c=c+1):a.push({range:qu.Range.create(p,d),newText:""}),u=u+f[1].length}else f[0]==Nu.default.INSERT&&a.push({range:qu.Range.create(p,p),newText:f[1]})}if(a.some(c=>c.newText.includes(`
`)||c.range.start.line!=c.range.end.line)){this.cancel();return}if(a.length==o.length){let c;for(let f=0;f<a.length;f++){let p=a[f],d=this.ranges[f];if(!ql(d.currRange,p.range)){this.cancel();return}if(c&&!E9(p,c)){this.cancel();return}d.applyEdit(p),c=p}}else if(a.length==o.length*2)for(let c=0;c<a.length-1;c=c+2){let f=a[c],p=a[c+1];if(f.newText.length==0&&p.newText.length==0){let d=this.ranges[c/2];if(Me(d.currRange.end,p.range.end)!=0){this.cancel();return}let h=f.range.start.character-d.currRange.start.character;d.replace(h,f.range.end.character-f.range.start.character,"");let m=p.range.end.character-p.range.start.character,y=d.text.length;d.replace(y-m,y)}else if(Gn(f.range)&&Gn(p.range)){let d=this.ranges[c/2];if(Me(d.currRange.end,p.range.start)!=0){this.cancel();return}let h=f.range.start.character-d.currRange.start.character;d.add(h,f.newText);let m=d.text.length;d.add(m,p.newText)}else{this.cancel();return}}else{this.cancel();return}this.doHighlights()}},C9=GC;var m9e=j()("cursors"),VC=class{constructor(e){this.nvim=e;this.sessionsMap=new Map;this.disposables=[];this.loadConfig(),b.onDidChangeConfiguration(t=>{t.affectsConfiguration("cursors")&&this.loadConfig()},null,this.disposables),A.on("BufUnload",t=>{let i=this.getSession(t);!i||(i.dispose(),this.sessionsMap.delete(t))},null,this.disposables)}loadConfig(){let e=b.getConfiguration("cursors");this.config={nextKey:e.get("nextKey","<C-n>"),previousKey:e.get("previousKey","<C-p>"),cancelKey:e.get("cancelKey","<esc>")}}getSession(e){return this.sessionsMap.get(e)}async isActivated(){let e=await this.nvim.call("bufnr",["%"]);return this.sessionsMap.get(e)!=null}async select(e,t,i){let n=b.getDocument(e);if(!n||!n.attached){C.showMessage(`buffer ${e} not attached.`);return}let{nvim:o}=this,s=this.createSession(n),a=await C.getCursorPosition(),l;if(t=="operator"){await o.command(`normal! ${i=="line"?"'[":"`["}`);let u=await C.getCursorPosition();await o.command(`normal! ${i=="line"?"']":"`]"}`);let c=await C.getCursorPosition();await C.moveTo(a);let f=Me(u,c);if(f==0)return;f>=0&&([u,c]=[c,u]);let p=n.getline(c.line);c.character<p.length&&(c.character=c.character+1);let d=HC(n,$u.Range.create(u,c));for(let h of d){let m=n.textDocument.getText(h);s.addRange(h,m)}}else if(t=="word"){if(l=n.getWordRangeAtPosition(a),!l){let f=n.getline(a.line);a.character==f.length?l=$u.Range.create(a.line,Math.max(0,f.length-1),a.line,f.length):l=$u.Range.create(a.line,a.character,a.line,a.character+1)}let c=n.getline(a.line).slice(l.start.character,l.end.character);s.addRange(l,c)}else if(t=="position"){let u=n.getline(a.line);a.character>=u.length?l=$u.Range.create(a.line,u.length-1,a.line,u.length):l=$u.Range.create(a.line,a.character,a.line,a.character+1),s.addRange(l,u.slice(l.start.character,l.end.character))}else if(t=="range"){await o.call("eval",'feedkeys("\\<esc>", "in")');let u=await b.getSelectedRange(i,n);if(!u||Me(u.start,u.end)==0)return;let c=i==""?S9(n,u):HC(n,u);for(let f of c){let p=n.textDocument.getText(f);s.addRange(f,p)}}else{C.showMessage(`${t} not supported`,"error");return}(t=="word"||t=="position")&&await o.command(`silent! call repeat#set("\\<Plug>(coc-cursors-${t})", -1)`)}createSession(e){let t=this.getSession(e.bufnr);return t||(t=new C9(this.nvim,e,this.config),this.sessionsMap.set(e.bufnr,t),t.onDidCancel(()=>{t.dispose(),this.sessionsMap.delete(e.bufnr)}),t)}async addRanges(e){let{nvim:t}=this,i=await t.call("bufnr",["%"]),n=b.getDocument(i);return!n||!n.attached?(C.showMessage("Document not attached","error"),!1):this.createSession(n).addRanges(e)}reset(){for(let e of this.sessionsMap.values())e.cancel();this.sessionsMap.clear()}dispose(){for(let e of this.sessionsMap.values())e.dispose();this.sessionsMap.clear();for(let e of this.disposables)e.dispose()}},_9=VC;var Ue=S(W());var KC=S(Gr()),JC=S(W());var ube=j()("codelens-buffer"),YC=class{constructor(e,t,i){this.nvim=e;this.bufnr=t;this.config=i;this._disposed=!1;this.fetchCodelenses=KC.default(()=>{this._fetchCodeLenses().logError()},global.hasOwnProperty("__TEST__")?10:100),this.resolveCodeLe
`+n+"\n```"),r.push({content:n,filetype:t}))}async function mt(r){let{changedtick:e}=r;await r.patchChange(),e!=r.changedtick&&await He(50)}function yd(r){let e=vd(r);return`${xP(e.red.toString(16))}${xP(e.green.toString(16))}${xP(e.blue.toString(16))}`}function xP(r){return r.length==1?`0${r}`:r}function vd(r){let{red:e,green:t,blue:i}=r;return{red:Math.round(e*255),green:Math.round(t*255),blue:Math.round(i*255)}}function HK(r){let e=[r.red,r.green,r.blue],t=[];for(let n=0;n<e.length;n++){let o=e[n];t[n]=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4)}return .2126*t[0]+.7152*t[1]+.0722*t[2]<=.5}var zK=S(Gr()),GK=S(W());var VK=j()("colors-buffer"),DP=class{constructor(e,t,i,n){this.nvim=e;this.bufnr=t;this.enabled=i;this.usedColors=n;this._colors=[];this.highlight=zK.default(()=>{this.doHighlight().catch(o=>{VK.error("Error on color highlight:",o.stack)})},global.hasOwnProperty("__TEST__")?10:500)}onChange(){this.cancel(),this.highlight()}get buffer(){return this.nvim.createBuffer(this.bufnr)}get colors(){return this._colors}hasColor(){return this._colors.length>0}setState(e){this.enabled=e,e?this.highlight():this.clearHighlight()}async doHighlight(){let e=b.getDocument(this.bufnr);if(!(!e||!this.enabled))try{this.tokenSource=new GK.CancellationTokenSource;let{token:t}=this.tokenSource;if(this.version&&e.version==this.version)return;let{version:i}=e,n;if(n=await U.provideDocumentColors(e.textDocument,t),n=n||[],t.isCancellationRequested)return;this.version=i,await this.addHighlight(n,t)}catch(t){VK.error("Error on highlight:",t)}}async addHighlight(e,t){if(e=e||[],Ne(this._colors,e))return;let{nvim:i}=this;this._colors=e;let n=oj(e,100);i.pauseNotification(),this.buffer.clearNamespace("color"),this.defineColors(e),i.resumeNotification(!1,!0);for(let o of n){if(t.isCancellationRequested){this._colors=[];return}i.pauseNotification();let s=this.getColorRanges(o);for(let a of s)this.highlightColor(a.ranges,a.color);i.resumeNotification(!1,!0)}b.isVim&&this.nvim.command("redraw",!0)}highlightColor(e,t){let{red:i,green:n,blue:o}=vd(t),s=`BG${yd(t)}`;this.buffer.highlightRanges("color",s,e)}defineColors(e){for(let t of e){let i=yd(t.color);this.usedColors.has(i)||(this.nvim.command(`hi BG${i} guibg=#${i} guifg=#${HK(t.color)?"ffffff":"000000"}`,!0),this.usedColors.add(i))}}getColorRanges(e){let t=[];for(let i of e){let{color:n,range:o}=i,s=t.findIndex(a=>Ne(vd(a.color),vd(n)));s==-1?t.push({color:n,ranges:[o]}):t[s].ranges.push(o)}return t}clearHighlight(){this.highlight.clear(),this._colors=[],this.version=null,this.buffer.clearNamespace("color")}hasColorAtPostion(e){let{colors:t}=this;return t.some(i=>Wt(e,i.range)==0)}cancel(){this.tokenSource&&(this.tokenSource.cancel(),this.tokenSource=null)}dispose(){this.highlight.clear(),this.cancel()}},KK=DP;var AGe=j()("colors"),SP=class{constructor(e){this.nvim=e;this._enabled=!0;this.disposables=[];let t=b.getConfiguration("coc.preferences");this._enabled=t.get("colorSupport",!0),b.isVim&&!b.env.textprop&&(this._enabled=!1);let i=new Set;this.highlighters=b.registerBufferSync(n=>{let o=new KK(this.nvim,n.bufnr,this._enabled,i);return o.highlight(),o}),ge.onDidActiveExtension(()=>{this.highlightAll()},null,this.disposables),b.onDidChangeConfiguration(async n=>{if(!(b.isVim&&!b.env.textprop)&&n.affectsConfiguration("coc.preferences.colorSupport")){let s=b.getConfiguration("coc.preferences").get("colorSupport",!0);if(s!=this._enabled){this._enabled=s;for(let a of this.highlighters.items)a.setState(s)}}},null,this.disposables)}async pickPresentation(){let e=await this.currentColorInfomation();if(!e)return C.showMessage("Color not found at current position","warning");let t=await b.document,i=new JK.CancellationTokenSource,n=await U.provideColorPresentations(e,t.textDocument,i.token);if(!n||n.length==0)return;let o=await C.showMenuPicker(n.map(c=>c.label),"choose color:");if(o==-1)return;let s=n[o],{textEdit:a,additionalTextEdits:l,label:u}=s;a||(a={range:e.range,newText:u}),await t.applyEdits([a]),l&&await t.applyEdits(l)}async pickColor(){let e=await this.currentColorInfomation();if(!e
`,s),a){let l=await e.call("line",".")-1,u=b.getDocument(s);if(!u)return;await u.patchChange();let c=u.getline(l-1),f=u.getline(l),p=c[c.length-1];if(p&&XK.has(p)){let d=f.trim()[0];if(d&&XK.get(p)==d){let h=[],m=await b.getFormatOptions(u.uri),y=m.insertSpaces?" ".repeat(m.tabSize):" ",v=f.match(/^\s*/)[0],x=sn.Position.create(l-1,c.length);if(u.filetype=="vim"){let w=`
`+v+y;h.push({range:sn.Range.create(l,v.length,l,v.length),newText:" \\ "}),w=w+"\\ ",h.push({range:sn.Range.create(x,x),newText:w}),await u.applyEdits(h),await C.moveTo(sn.Position.create(l,w.length-1))}else await e.eval(`feedkeys("\\<Esc>O", 'in')`)}}}},null,this.disposables);let t,i;A.on("InsertCharPre",async()=>{i=Date.now()},null,this.disposables),A.on("TextChangedI",async(s,a)=>{if(t=Date.now(),!i||t-i>300)return;i=null;let l=b.getDocument(s);if(!l)return;let u=a.pre[a.pre.length-1];!u||!U.hasProvider("onTypeEdit",l.textDocument)||await this.tryFormatOnType(u,s)},null,this.disposables);let n,o;A.on("InsertEnter",s=>{n=s,o=Date.now()}),A.on("TextChangedI",async(s,a)=>{!this.preferences.formatOnType&&!/^\s*$/.test(a.pre)||n!=s||!o||Date.now()-o>30||await this.tryFormatOnType(`
`,s,!0)})}loadPreferences(e){if(!e||e.affectsConfiguration("coc.preferences")){let t=b.getConfiguration("coc.preferences");this.preferences={formatOnType:t.get("formatOnType",!1),formatOnSaveFiletypes:t.get("formatOnSaveFiletypes",[]),formatOnTypeFiletypes:t.get("formatOnTypeFiletypes",[]),bracketEnterImprove:t.get("bracketEnterImprove",!0)}}}async withRequestToken(e,t){this.requestTokenSource&&(this.requestTokenSource.cancel(),this.requestTokenSource.dispose());let i=this.requestStatusItem;this.requestTokenSource=new sn.CancellationTokenSource;let{token:n}=this.requestTokenSource;n.onCancellationRequested(()=>{i.text=`${e} request canceled`,i.isProgress=!1,i.hide()}),i.isProgress=!0,i.text=`requesting ${e}`,i.show();let o;try{o=await Promise.resolve(t(n))}catch(s){C.showMessage(s.message,"error"),EP.error(`Error on ${e}`,s)}return this.requestTokenSource&&(this.requestTokenSource.dispose(),this.requestTokenSource=void 0),n.isCancellationRequested?null:(i.hide(),o==null&&EP.warn(`${e} provider not found!`),o)}async tryFormatOnType(e,t,i=!1){if(!e||IB(e)||!this.preferences.formatOnType||Ft.getSession(t)!=null)return;let n=b.getDocument(t);if(!n||!n.attached||n.isCommandLine)return;let o=this.preferences.formatOnTypeFiletypes;if(o.length&&!o.includes(n.filetype)||!U.hasOnTypeProvider(e,n.textDocument))return;let s,a=await this.withRequestToken("onTypeFormat ",async c=>{s=await C.getCursorPosition();let f=n.getline(s.line-1);if(i&&/^\s*$/.test(f))return;let p=i?{line:s.line-1,character:f.length}:s;return await mt(n),await U.provideDocumentOnTypeEdits(e,n.textDocument,p,c)});if(!a||!a.length)return;let l=$l(s,a);await n.applyEdits(a);let u=l?sn.Position.create(s.line+l.line,s.character+l.character):null;u&&!i&&await C.moveTo(u)}async documentFormat(e){await mt(e);let t=await b.getFormatOptions(e.uri),i=await this.withRequestToken("format",n=>U.provideDocumentFormattingEdits(e.textDocument,t,n));return i&&i.length>0?(await e.applyEdits(i),!0):!1}async documentRangeFormat(e,t){await mt(e);let i;if(t){if(i=await b.getSelectedRange(t,e),!i)return-1}else{let[s,a,l]=await this.nvim.eval("[v:lnum,v:count,mode()]");if(a==0||l=="i"||l=="R")return-1;i=sn.Range.create(s-1,0,s-1+a,0)}let n=await b.getFormatOptions(e.uri),o=await this.withRequestToken("format",s=>U.provideDocumentRangeFormattingEdits(e.textDocument,i,n,s));return o&&o.length>0?(await e.applyEdits(o),0):-1}dispose(){z(this.disposables)}},ZK=CP;var bd=S(W());var J0e=j()("documentHighlight"),_P=class{constructor(e){this.nvim=e;this.disposables=[];this.highlights=new Map;A.on(["TextChanged","TextChangedI","CursorMoved","CursorMovedI"],()=>{this.cancel(),this.clearHighlights()},null,this.disposables)}clearHighlights(){if(this.highlights.size==0)return;let{nvim:e}=b;for(let t of this.highlights.keys())e.createWindow(t).clearMatchGroup("^CocHighlight");this.highlights.clear()}async highlight(){let{nvim:e}=this;this.cancel();let[t,i,n]=await e.eval("[bufnr('%'),win_getid(),get(b:,'coc_cursors_activated',0)]"),o=b.getDocument(t);if(!o||!o.attached||!U.hasProvider("documentHighlight",o.textDocument)||n)return;let s=await C.getCursorPosition(),a=await this.getHighlights(o,s);if(!a)return;let l={};for(let f of a){if(!f.range)continue;let p=f.kind==bd.DocumentHighlightKind.Text?"CocHighlightText":f.kind==bd.DocumentHighlightKind.Read?"CocHighlightRead":"CocHighlightWrite";l[p]=l[p]||[],l[p].push(f.range)}let u=e.createWindow(i);e.pauseNotification(),u.clearMatchGroup("^CocHighlight");for(let f of Object.keys(l))u.highlightRanges(f,l[f],-1,!0);b.isVim&&e.command("redraw",!0);let c=this.nvim.resumeNotification();Array.isArray(c)&&c[1]!=null?J0e.error("Error on highlight",c[1][2]):this.highlights.set(i,a)}hasHighlights(e){return this.highlights.get(e)!=null}async getHighlights(e,t){if(!e||!e.attached||e.isCommandLine)return null;let n=e.getline(t.line)[t.character];if(!n||!e.isWord(n))return null;try{this.tokenSource=new bd.CancellationTokenSource,e.forceSync();let{token:o}=this.tokenSource,s=await U.getDocumentHighLight(e.textDocument,t,o);return this.tokenSource=null,o.isCancellation
`).length-(a.end.line-a.start.line)-1;if(c==0)return;let f=[];if(l.includes("\u3000")){let d=a.start.line,h=Ku.default(s,l),m=0,y=kt.create("file:///1","",0,s);for(let v=0;v<h.length;v++){let x=h[v],w=y.positionAt(m);if(x[0]==Ku.default.EQUAL)m=m+x[1].length;else if(x[0]==Ku.default.DELETE){let E=y.positionAt(m+x[1].length);if(h[v+1]&&h[v+1][0]==Ku.default.INSERT){let P=h[v+1][1].split(`
`).length-(E.line-w.line)-1;P!=0&&f.push({delta:P,lnum:w.line+d}),v=v+1}else{let P=-(E.line-w.line);P!=0&&f.push({delta:P,lnum:w.line+d})}m=m+x[1].length}else if(x[0]==Ku.default.INSERT){let E=x[1].split(`
`).length-1;E!=0&&f.push({delta:E,lnum:w.line+d})}}}else f=[{delta:c,lnum:a.start.line}];let p=!1;for(let d of n)for(let h of d.ranges){let m=f.filter(y=>y.lnum<h.lnum-1);if(m.length){let y=m.reduce((v,x)=>v+x.delta,0);h.lnum=h.lnum+y,p=!0}}!p||(i.pauseNotification(),this.highlightLineNr(),i.resumeNotification().then(d=>{Array.isArray(d)&&d[1]!=null&&lJ.error("Error on highlightLineNr:",d[1])}).logError())}async onDocumentChange(e){if(e.bufnr==this.bufnr||this.changing)return;let{uri:t}=e.textDocument,{range:i,text:n}=e.contentChanges[0],o=$.parse(t).fsPath,s=this._fileItems.find(u=>u.filepath==o);if(!s)return;let a=n.split(`
`).length-(i.end.line-i.start.line)-1,l=[];for(let u=0;u<s.ranges.length;u++){let c=s.ranges[u];if(!(i.start.line>=c.end))if(i.end.line<c.start){if(a==0)continue;c.start=c.start+a,c.end=c.end+a}else{let p=b.getDocument(t).getLines(c.start,c.end);p.length?(c.end=c.start+p.length,l.push({range:this.getFileRangeRange(c,!0),newText:p.join(`
`)+`
`})):(s.ranges.splice(u,1),l.push({range:this.getFileRangeRange(c,!1),newText:""}))}}this._fileItems=this._fileItems.filter(u=>u.ranges&&u.ranges.length>0),l.length&&(this.changing=!0,await this.document.applyEdits(l),this.changing=!1),this.nvim.pauseNotification(),this.highlightLineNr(),this.buffer.setOption("modified",!1,!0),await this.nvim.resumeNotification()}async getFileChanges(){if(this._disposed)return[];let e=[],t=await this.buffer.lines;t.push(Ju);let i=[],n,o;for(let s=0;s<t.length;s++){let a=t[s];if(a.startsWith(Ju)){if(n&&(e.push({filepath:n,lines:i.slice(),lnum:o}),n=void 0,i=[]),a.length>1){let l=a.match(/^\u3000(.*)/);l&&(n=this.getAbsolutePath(l[1].replace(/\s+$/,"")),o=s+1,i=[])}}else i.push(a)}return e}async splitOpen(){let{nvim:e}=this,i=await e.createWindow(this.opts.fromWinid).valid,n=await e.eval('getline(1,line("."))'),o=n.length;for(let s=0;s<o;s++){let l=n[o-s-1].match(/^\u3000(.+)/);if(l){let u=l[1].trim(),c=this.getLinesRange(o-s);if(!c)return;let f=c[0]+s-1,p=this.getAbsolutePath(u);e.pauseNotification(),i?(e.call("win_gotoid",[this.opts.fromWinid],!0),this.nvim.call("coc#util#jump",["edit",p,[f,1]],!0)):this.nvim.call("coc#util#jump",["belowright vs",p,[f,1]],!0),e.command("normal! zz",!0);let[,d]=await e.resumeNotification();d&&C.showMessage(`Error on open ${u}: ${d}`,"error"),i||(this.opts.fromWinid=await e.call("win_getid"));break}}}async addFileItems(e){if(this._disposed)return;let{cwd:t}=this.opts,{document:i}=this,n=await this.mutex.acquire();try{i.dirty&&i.forceSync();for(let f of e){let p=this._fileItems.find(d=>d.filepath==f.filepath);p?p.ranges.push(...f.ranges):this._fileItems.push(f)}let o=i.lineCount,s=new ss,a=[];for(let f of e)for(let p of f.ranges){s.addLine(Ju),s.addLine(Ju),p.lnum=o+s.length,s.addText(`${Ye(t,f.filepath)?wd.default.relative(t,f.filepath):f.filepath}`);let d=String(p.start+1).length+String(p.end).length+4;this.srcId||s.addText(" ".repeat(d));let h=0-s.length-o;p.highlights&&a.push(...p.highlights.map(y=>Q0e(y,h)));let{lines:m}=p;m||(m=await this.getLines(f.filepath,p.start,p.end),p.lines=m),s.addLines(m)}let{nvim:l,buffer:u}=this;if(this.changing=!0,l.pauseNotification(),s.render(u,o),this.highlightLineNr(),u.setOption("modified",!1,!0),u.setOption("undolevels",1e3,!0),o==2&&a.length){let f=a[0].start;l.call("coc#util#jumpTo",[f.line,f.character],!0)}b.isVim&&l.command("redraw",!0);let[,c]=await l.resumeNotification();if(c)throw new Error(c[2]);await i.patchChange(),this.changing=!1,await me.executeCommand("editor.action.addRanges",a)}catch(o){this.changing=!1,lJ.error("Error on add file item:",o)}n()}async save(){let{nvim:e}=this,t=this.document,{buffer:i}=t;await t.patchChange();let n=await this.getFileChanges();if(!n)return;n.sort((l,u)=>l.lnum-u.lnum);let o=[],s=new Map;for(let l=0;l<n.length;l++){let u=n[l],{filepath:c,lnum:f}=u,p=s.get(c)||0,d=this._fileItems.find(m=>m.filepath==c),h=d?d.ranges.find(m=>m.lnum==f):null;if(!h||Ne(h.lines,u.lines)){o.push(l),p&&h&&(h.start=h.start+p,h.end=h.end+p);continue}if(u.start=h.start,u.end=h.end,p!=0&&(h.start=h.start+p),u.lines.length!=h.lines.length){let y=u.lines.length-h.lines.length+p;s.set(c,y),h.end=h.end+y}else h.end=h.end+p;h.lines=u.lines}if(o.length&&(n=n.filter((l,u)=>!o.includes(u))),n.length==0)return C.showMessage("No change.","more"),await i.setOption("modified",!1),!1;let a={};for(let l of n){let u=$.file(l.filepath).toString(),c=a[u]||[];c.push({range:Ey.Range.create(l.start,0,l.end,0),newText:l.lines.join(`
`)+`
`}),a[u]=c}return this.changing=!0,await b.applyEdit({changes:a}),this.changing=!1,e.pauseNotification(),i.setOption("modified",!1,!0),this.config.saveToFile&&e.command("silent noa wa",!0),this.highlightLineNr(),await e.resumeNotification(),!0}getFileRange(e){for(let t of this._fileItems)for(let i of t.ranges)if(i.lnum==e)return i;return null}getLinesRange(e){for(let t of this._fileItems)for(let i of t.ranges)if(i.lnum==e)return[i.start,i.end];return null}async getLines(e,t,i){let n=$.file(e).toString(),o=b.getDocument(n);return o?o.getLines(t,i):await Y3(e,t,i-1)}getAbsolutePath(e){return wd.default.isAbsolute(e)?e:wd.default.join(this.opts.cwd,e)}getFileRangeRange(e,t=!0){let{document:i}=this;if(!i)return null;let{lnum:n}=e;if(!i.getline(n-1).startsWith("\u3000"))return null;let s=t?n:n-1,a=i.lineCount;for(let l=n;l<i.lineCount;l++)if(i.getline(l).startsWith("\u3000")){a=t?l:l+1;break}return Ey.Range.create(s,0,a,0)}highlightLineNr(){let{_fileItems:e,nvim:t,srcId:i,bufnr:n}=this,{winid:o,cwd:s}=this.opts,a={};if(i){t.call("nvim_buf_clear_namespace",[n,i,0,-1],!0);for(let l of e)for(let u of l.ranges){let c=`${u.start+1}:${u.end}`;a[u.lnum]=[u.start+1,u.end],t.call("nvim_buf_set_virtual_text",[n,i,u.lnum-1,[[c,"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?wd.default.relative(s,u.filepath):u.filepath}`,f=ue(c)+1;for(let p of u.ranges){let d=`:${p.start+1}:${p.end}`;for(let h=0;h<d.length;h++){let m=d[h];this.matchIds.add(l),a[p.lnum]=[p.start+1,p.end],t.call("matchaddpos",["Conceal",[[p.lnum,f+h]],99,l,{conceal:m,window:o}],!0),l++}}}}this.buffer.setVar("line_infos",a,!0)}get valid(){return this.buffer.valid}get buffer(){return this.nvim.createBuffer(this.bufnr)}get document(){return this._disposed?null:b.getDocument(this.bufnr)}dispose(){this._disposed=!0,z(this.disposables)}},uJ=TP;function Q0e(r,e){let{start:t,end:i}=r;return Ey.Range.create(t.line-e,t.character,i.line-e,i.character)}var eSe=j()("handler-refactor"),tSe="__coc_refactor__",rSe=0;var RP=class{constructor(){this.buffers=new Map;this.disposables=[];this._onCreate=new Yu.Emitter;this.onCreate=this._onCreate.event;this.nvim=b.nvim,b.isNvim&&this.nvim.hasFunction("nvim_buf_set_virtual_text")&&(this.srcId=b.createNameSpace("coc-refactor")),this.setConfiguration(),b.onDidChangeConfiguration(this.setConfiguration,this,this.disposables),b.onDidCloseTextDocument(e=>{this.buffers.get(e.bufnr)&&this.buffers.delete(e.bufnr)},null,this.disposables),b.onDidChangeTextDocument(e=>{let t=this.buffers.get(e.bufnr);t&&t.onChange(e)},null,this.disposables)}setConfiguration(e){if(e&&!e.affectsConfiguration("refactor"))return;let t=b.getConfiguration("refactor");this.config=Object.assign(this.config||{},{afterContext:t.get("afterContext",3),beforeContext:t.get("beforeContext",3),openCommand:t.get("openCommand","edit"),saveToFile:t.get("saveToFile",!0)})}getBuffer(e){return this.buffers.get(e)}async search(e){let t=await this.createRefactorBuffer();if(!t)return;let i=await this.nvim.call("getcwd",[]);await new aJ(this.nvim).run(e,i,t)}async createRefactorBuffer(e){let{nvim:t}=this,[i,n]=await t.eval("[win_getid(),getcwd()]"),{openCommand:o}=this.config;t.pauseNotification(),t.command(`${o} ${tSe}${rSe++}`,!0),t.command("setl buftype=acwrite nobuflisted bufhidden=wipe nofen wrap conceallevel=2 concealcursor=n",!0),t.command("setl undolevels=-1 nolist nospell noswapfile foldmethod=expr foldexpr=coc#util#refactor_foldlevel(v:lnum)",!0),t.command("setl foldtext=coc#util#refactor_fold_text(v:foldstart)",!0),t.call("setline",[1,["Save current buffer to make changes",Ju]],!0),t.call("matchadd",["Comment","\\%1l"],!0),t.call("matchadd",["Conceal","^\\%u3000"],!0),t.call("matchadd",["Label","^\\%u3000\\zs\\S\\+"],!0),t.command("setl nomod",!0),e&&t.command(`runtime! syntax/${e}.vim`,!0),t.call("coc#util#do_autocmd",["CocRefactorOpen"],!0);let[,s]=await t.resumeNotification();if(s){eSe.error(s),C.showMessage(`Error on open refactor window: ${s}`,"error");ret
`)||(s+=d.length),this.signaturePosition=an.Position.create(t.line,t.character-d.length)}else this.signaturePosition=t;let{preferAbove:c,maxWindowHeight:f,maxWindowWidth:p}=this.config;await this.signatureFactory.show(l,{maxWidth:p,maxHeight:f,preferTop:c,autoHide:!1,offsetX:s,modes:["i","ic","s"]})}echoSignature(e){var s;let{signatures:t,activeParameter:i}=e,n=b.env.columns;t=t.slice(0,b.env.cmdheight);let o=[];for(let a of t){let l=[],{label:u}=a;u=u.replace(/\n/g," "),u.length>=n-16&&(u=u.slice(0,n-16)+"...");let c=u.indexOf("(");if(c==-1)l=[{text:u,type:"Normal"}];else{l.push({text:u.slice(0,c),type:"Label"});let f=u.slice(c);if(o.length==0&&i!=null){let p=(s=a.parameters)==null?void 0:s[i];if(p){let d,h;if(typeof p.label=="string"){let m=f.slice(0),y=m.match(new RegExp("\\b"+p.label.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")+"\\b")),v=y?y.index:m.indexOf(p.label);v==-1?l.push({text:f,type:"Normal"}):(d=v,h=v+p.label.length)}else[d,h]=p.label,d=d-c,h=h-c;d!=null&&h!=null&&(l.push({text:f.slice(0,d),type:"Normal"}),l.push({text:f.slice(d,h),type:"MoreMsg"}),l.push({text:f.slice(h),type:"Normal"}))}}else l.push({text:f,type:"Normal"})}o.push(l)}this.nvim.callTimer("coc#util#echo_signatures",[o],!0)}dispose(){z(this.disposables),this.timer&&clearTimeout(this.timer),this.tokenSource&&(this.tokenSource.cancel(),this.tokenSource.dispose())}},dJ=kP;function pJ(r){return!!(an.MarkupContent.is(r)&&r.kind==an.MarkupKind.Markdown)}var hJ=S(Gr()),uo=S(W());var IP=class{constructor(e){this.nvim=e;this.disposables=[];this.buffers=b.registerBufferSync(t=>{if(t.buftype!="")return;let i=new mJ(t.bufnr);return i.onDidUpdate(async n=>{await A.fire("SymbolsUpdate",[i.bufnr,n])}),i}),A.on("CursorHold",async t=>{!this.functionUpdate||this.buffers.getItem(t)==null||await this.getCurrentFunctionSymbol(t)},null,this.disposables)}get functionUpdate(){return b.getConfiguration("coc.preferences").get("currentFunctionSymbolAutoUpdate",!1)}get labels(){return b.getConfiguration("suggest").get("completionItemKindLabels",{})}async getDocumentSymbols(e){let t=this.buffers.getItem(e);return t==null?void 0:t.getSymbols()}async getCurrentFunctionSymbol(e){e||(e=await this.nvim.call("bufnr",["%"]));let t=await C.getCursorPosition(),i=await this.getDocumentSymbols(e),n=this.nvim.createBuffer(e);if(!i||i.length===0)return n.setVar("coc_current_function","",!0),this.nvim.call("coc#util#do_autocmd",["CocStatusChange"],!0),"";i=i.filter(s=>["Class","Method","Function","Struct"].includes(s.kind));let o="";for(let s of i.reverse())if(s.range&&Wt(t,s.range)==0&&!s.text.endsWith(") callback")){o=s.text;let a=this.labels[s.kind.toLowerCase()];a&&(o=`${a} ${o}`);break}return this.functionUpdate&&(n.setVar("coc_current_function",o,!0),this.nvim.call("coc#util#do_autocmd",["CocStatusChange"],!0)),o}async selectSymbolRange(e,t,i){let n=await this.nvim.call("bufnr",["%"]),o=b.getDocument(n);if(!o||!o.attached)return;let s;if(t)s=await b.getSelectedRange(t,o);else{let c=await C.getCursorPosition();s=uo.Range.create(c,c)}let a=await this.getDocumentSymbols(n);if(!a||a.length===0){C.showMessage("No symbols found","warning");return}let l=a.filter(c=>c.kind=="Property");a=a.filter(c=>i.includes(c.kind));let u;for(let c of a.reverse())if(c.range&&!Ne(c.range,s)&&Ji(s,c.range)){u=c.range;break}if(!u){for(let c of l)if(c.range&&!Ne(c.range,s)&&Ji(s,c.range)){u=c.range;break}}if(e&&u){let{start:c,end:f}=u,p=o.getline(c.line+1),d=o.getline(f.line-1);u=uo.Range.create(c.line+1,p.match(/^\s*/)[0].length,f.line-1,d.length)}u&&await b.selectRange(u)}dispose(){this.buffers.dispose(),z(this.disposables)}},gJ=IP,mJ=class{constructor(e){this.bufnr=e;this.disposables=[];this.autoUpdate=!1;this.symbols=[];this._onDidUpdate=new uo.Emitter;this.onDidUpdate=this._onDidUpdate.event;this.fetchSymbols=hJ.default(()=>{this._fetchSymbols().logError()},global.hasOwnProperty("__TEST__")?10:500)}async getSymbols(){let e=b.getDocument(this.bufnr);return e?(e.forceSync(),this.autoUpdate=!0,e.version==this.version?this.symbols:(this.cancel(),await this._fetchSymbols(),this.symbols)):[]}onChange(){this.can
`))};this.disposables.push(b.registerTextDocumentContentProvider("coc",t)),this.disposables.push(me.registerCommand("editor.action.pickColor",()=>this.pickColor())),me.titles.set("editor.action.pickColor","pick color from system color picker when possible."),this.disposables.push(me.registerCommand("editor.action.colorPresentation",()=>this.pickPresentation())),me.titles.set("editor.action.colorPresentation","change color presentation."),this.disposables.push(me.registerCommand("editor.action.organizeImport",async i=>{await this.organizeImport(i)})),me.titles.set("editor.action.organizeImport","run organize import code action.")}async organizeImport(e){e||(e=await this.nvim.call("bufnr",["%"]));let t=b.getDocument(e);if(!t||!t.attached)throw new Error(`buffer ${e} not attached`);await mt(t);let i=await this.getCodeActions(t,void 0,[Ue.CodeActionKind.SourceOrganizeImports]);if(i&&i.length){await this.applyCodeAction(i[0]);return}throw new Error("Organize import action not found.")}checkProvier(e,t){if(!U.hasProvider(e,t))throw new Error(`${e} provider not found for current buffer, your language server don't support it.`)}async withRequestToken(e,t,i){this.requestTokenSource&&(this.requestTokenSource.cancel(),this.requestTokenSource.dispose()),this.requestTimer&&clearTimeout(this.requestTimer);let n=this.requestStatusItem;this.requestTokenSource=new Ue.CancellationTokenSource;let{token:o}=this.requestTokenSource;o.onCancellationRequested(()=>{n.text=`${e} request canceled`,n.isProgress=!1,this.requestTimer=setTimeout(()=>{n.hide()},500)}),n.isProgress=!0,n.text=`requesting ${e}`,n.show();let s;try{s=await Promise.resolve(t(o))}catch(a){C.showMessage(a.message,"error"),vJ.error(`Error on ${e}`,a)}return this.requestTokenSource&&(this.requestTokenSource.dispose(),this.requestTokenSource=void 0),o.isCancellationRequested?null:(n.hide(),i&&(!s||Array.isArray(s)&&s.length==0)?(C.showMessage(`${e} not found`,"warning"),null):s)}async getCurrentFunctionSymbol(){let{doc:e}=await this.getCurrentState();return this.checkProvier("documentSymbol",e.textDocument),await this.symbols.getCurrentFunctionSymbol()}async selectSymbolRange(e,t,i){let{doc:n}=await this.getCurrentState();return this.checkProvier("documentSymbol",n.textDocument),await this.symbols.selectSymbolRange(e,t,i)}async getDocumentSymbols(e){let t=b.getDocument(e);if(!t||!t.attached)throw new Error(`buffer ${e} not attached`);return this.checkProvier("documentSymbol",t.textDocument),await this.symbols.getDocumentSymbols(e)}async hasProvider(e){let t=await this.nvim.call("bufnr","%"),i=b.getDocument(t);return i?U.hasProvider(e,i.textDocument):!1}async onHover(e){let{doc:t,position:i,winid:n}=await this.getCurrentState();this.checkProvier("hover",t.textDocument);let o=e!=null?e:this.preferences.hoverTarget;o=="float"&&this.hoverFactory.close(),await mt(t);let s=await this.withRequestToken("hover",l=>U.getHover(t.textDocument,i,l),!0);if(s==null)return!1;let a=s.find(l=>Ue.Range.is(l.range));if(a==null?void 0:a.range){let l=this.nvim.createWindow(n),u=await l.highlightRanges("CocHoverRange",[a.range],99);setTimeout(()=>{u.length&&l.clearMatches(u),b.isVim&&this.nvim.command("redraw",!0)},1e3)}return await this.previewHover(s,o),!0}async getHover(){let e=[],{doc:t,position:i}=await this.getCurrentState();this.checkProvier("hover",t.textDocument),await mt(t);let n=new Ue.CancellationTokenSource,o=await U.getHover(t.textDocument,i,n.token);if(Array.isArray(o))for(let s of o){let{contents:a}=s;Array.isArray(a)?a.forEach(l=>{e.push(typeof l=="string"?l:l.value)}):Ue.MarkupContent.is(a)?e.push(a.value):e.push(typeof a=="string"?a:a.value)}return e=e.filter(s=>s!=null&&s.length>0),e}async gotoDefinition(e){let{doc:t,position:i}=await this.getCurrentState();this.checkProvier("definition",t.textDocument),await mt(t);let n=await this.withRequestToken("definition",o=>U.getDefinition(t.textDocument,i,o),!0);return n==null?!1:(await this.handleLocations(n,e),!0)}async gotoDeclaration(e){let{doc:t,position:i}=await this.getCurrentState();this.checkProvier("declaration",t.textDocument),aw
`).trim();s.length&&await this.nvim.call("coc#util#echo_hover",s)}else this.documentLines=o,await this.nvim.command("noswapfile pedit coc://document")}getPreferences(){let e=b.getConfiguration("coc.preferences"),t=e.get("hoverTarget","float");t=="float"&&!b.floatSupported&&(t="preview"),this.preferences={hoverTarget:t,previewMaxHeight:e.get("previewMaxHeight",12),previewAutoClose:e.get("previewAutoClose",!1),floatActions:e.get("floatActions",!0)}}async getCurrentState(){let{nvim:e}=this,[t,[i,n],o]=await e.eval("[bufnr('%'),coc#util#cursor(),win_getid()]"),s=b.getDocument(t);if(!s||!s.attached)throw new Error(`current buffer ${t} not attached`);return{doc:s,position:Ue.Position.create(i,n),winid:o}}dispose(){this.requestTimer&&(clearTimeout(this.requestTimer),this.requestTimer=void 0),this.refactor.dispose(),this.signature.dispose(),this.symbols.dispose(),this.hoverFactory.dispose(),this.colors.dispose(),this.format.dispose(),this.documentHighlighter.dispose(),z(this.disposables)}},yJ=FP;var Xu=j()("plugin"),OP=class extends bJ.EventEmitter{constructor(e){super();this.nvim=e;this._ready=!1;this.actions=new Map;Object.defineProperty(b,"nvim",{get:()=>this.nvim}),this.cursors=new _9(e),this.addAction("hasProvider",t=>this.handler.hasProvider(t)),this.addAction("getTagList",async()=>await this.handler.getTagList()),this.addAction("hasSelected",()=>cs.hasSelected()),this.addAction("listNames",()=>Kt.names),this.addAction("listDescriptions",()=>Kt.descriptions),this.addAction("listLoadItems",async t=>await Kt.loadItems(t)),this.addAction("search",(...t)=>this.handler.search(t)),this.addAction("cursorsSelect",(t,i,n)=>this.cursors.select(t,i,n)),this.addAction("fillDiagnostics",t=>St.setLocationlist(t)),this.addAction("getConfig",async t=>{let i=await b.document;return b.getConfiguration(t,i?i.uri:void 0)}),this.addAction("rootPatterns",t=>{let i=b.getDocument(t);return i?{buffer:b.getRootPatterns(i,Kr.Buffer),server:b.getRootPatterns(i,Kr.LanguageServer),global:b.getRootPatterns(i,Kr.Global)}:null}),this.addAction("installExtensions",async(...t)=>{await ge.installExtensions(t)}),this.addAction("saveRefactor",async t=>{await this.handler.saveRefactor(t)}),this.addAction("updateExtensions",async t=>{await ge.updateExtensions(t)}),this.addAction("commandList",()=>me.commandList.map(t=>t.id)),this.addAction("openList",async(...t)=>{await this.ready,await Kt.start(t)}),this.addAction("selectSymbolRange",(t,i,n)=>this.handler.selectSymbolRange(t,i,n)),this.addAction("listResume",t=>Kt.resume(t)),this.addAction("listCancel",()=>Kt.cancel(!0)),this.addAction("listPrev",t=>Kt.previous(t)),this.addAction("listNext",t=>Kt.next(t)),this.addAction("listFirst",t=>Kt.first(t)),this.addAction("listLast",t=>Kt.last(t)),this.addAction("sendRequest",(t,i,n)=>Vt.sendRequest(t,i,n)),this.addAction("sendNotification",(t,i,n)=>Vt.sendNotification(t,i,n)),this.addAction("registNotification",(t,i)=>Vt.registNotification(t,i)),this.addAction("doAutocmd",async(t,...i)=>{let n=b.autocmds.get(t);if(n)try{await Promise.resolve(n.callback.apply(n.thisArg,i))}catch(o){Xu.error(`Error on autocmd ${n.event}`,o),C.showMessage(`Error on autocmd ${n.event}: ${o.message}`)}}),this.addAction("updateConfig",(t,i)=>{b.configurations.updateUserConfig({[t]:i})}),this.addAction("snippetNext",async()=>(await Ft.nextPlaceholder(),"")),this.addAction("snippetPrev",async()=>(await Ft.previousPlaceholder(),"")),this.addAction("snippetCancel",()=>{Ft.cancel()}),this.addAction("openLocalConfig",async()=>{await C.openLocalConfig()}),this.addAction("openLog",async()=>{let t=Xu.getLogFile();await b.jumpTo($.file(t).toString())}),this.addAction("attach",()=>b.attach()),this.addAction("detach",()=>b.detach()),this.addAction("doKeymap",async(t,i="",n)=>{let o=b.keymaps.get(t);if(!o)return Xu.error(`keymap for ${t} not found`),this.nvim.command(`silent! unmap <buffer> ${n.startsWith("{")&&n.endsWith("}")?`<${n.slice(1,-1)}>`:n}`,!0),i;let[s,a]=o,l=await Promise.resolve(s());return a&&await e.command(`silent! call repeat#set("\\<Plug>(coc-${t})", -1)`),l!=null?l:i}),this.addAction("
`+r.stack):console.error("UnhandledRejection: "+r),LP.error("unhandledRejection ",e,r)});
/*!
* @description Recursive object extending
* @author Viacheslav Lotsmanov <lotsmanov89@gmail.com>
* @license MIT
*
2021-03-09 22:15:52 +00:00
* The MIT License (MIT)
*
* Copyright (c) 2013-2018 Viacheslav Lotsmanov
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
2021-03-09 22:15:52 +00:00
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
2021-03-09 22:15:52 +00:00
/*!
* ISC License
*
* Copyright (c) 2018, Andrea Giammarchi, @WebReflection
*
2021-03-09 22:15:52 +00:00
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*!
* bytes
* Copyright(c) 2012-2014 TJ Holowaychuk
* Copyright(c) 2015 Jed Watson
* MIT Licensed
*/
/*!
* content-disposition
* Copyright(c) 2014-2017 Douglas Christopher Wilson
* MIT Licensed
*/
/**
2021-03-09 22:15:52 +00:00
* event-lite.js - Light-weight EventEmitter (less than 1KB when gzipped)
*
* @copyright Yusuke Kawasaki
* @license MIT
* @constructor
* @see https://github.com/kawanet/event-lite
* @see http://kawanet.github.io/event-lite/EventLite.html
* @example
* var EventLite = require("event-lite");
*
* function MyClass() {...} // your class
*
* EventLite.mixin(MyClass.prototype); // import event methods
*
* var obj = new MyClass();
* obj.on("foo", function() {...}); // add event listener
* obj.once("bar", function() {...}); // add one-time event listener
* obj.emit("foo"); // dispatch event
* obj.emit("bar"); // dispatch another event
* obj.off("foo"); // remove event listener
*/