UNPKG

pyright

Version:

Type checker for the Python language

6 lines 748 kB
exports.ids=[474],exports.modules={7694(A,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AliasFS=void 0;let r=t(7243);class o extends r.ProxiedFS{constructor(A,{baseFs:e,pathUtils:t}){super(t),this.target=A,this.baseFs=e}getRealPath(){return this.target}getBaseFs(){return this.baseFs}mapFromBase(A){return A}mapToBase(A){return A}}e.AliasFS=o},676(A,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CwdFS=void 0;let r=t(1182),o=t(7243),i=t(7486);class n extends o.ProxiedFS{constructor(A,{baseFs:e=new r.NodeFS}={}){super(i.ppath),this.target=this.pathUtils.normalize(A),this.baseFs=e}getRealPath(){return this.pathUtils.resolve(this.baseFs.getRealPath(),this.target)}resolve(A){return this.pathUtils.isAbsolute(A)?i.ppath.normalize(A):this.baseFs.resolve(i.ppath.join(this.target,A))}mapFromBase(A){return A}mapToBase(A){return this.pathUtils.isAbsolute(A)?A:this.pathUtils.join(this.target,A)}}e.CwdFS=n},5903(A,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.normalizeLineEndings=e.BasePortableFakeFS=e.FakeFS=void 0;let r=t(857),o=t(3038),i=t(7486);class n{constructor(A){this.pathUtils=A}async *genTraversePromise(A,{stableSort:e=!1}={}){let t=[A];for(;t.length>0;){let A=t.shift();if((await this.lstatPromise(A)).isDirectory()){let r=await this.readdirPromise(A);if(e)for(let e of r.sort())t.push(this.pathUtils.join(A,e));else throw Error("Not supported")}else yield A}}async removePromise(A,{recursive:e=!0,maxRetries:t=5}={}){let r;try{r=await this.lstatPromise(A)}catch(A){if("ENOENT"===A.code)return;throw A}if(r.isDirectory()){if(e){let e=await this.readdirPromise(A);await Promise.all(e.map(e=>this.removePromise(this.pathUtils.resolve(A,e))))}for(let e=0;e<=t;e++)try{await this.rmdirPromise(A);break}catch(A){if("EBUSY"!==A.code&&"ENOTEMPTY"!==A.code)throw A;e<t&&await new Promise(A=>setTimeout(A,100*e))}}else await this.unlinkPromise(A)}removeSync(A,{recursive:e=!0}={}){let t;try{t=this.lstatSync(A)}catch(A){if("ENOENT"===A.code)return;throw A}if(t.isDirectory()){if(e)for(let e of this.readdirSync(A))this.removeSync(this.pathUtils.resolve(A,e));this.rmdirSync(A)}else this.unlinkSync(A)}async mkdirpPromise(A,{chmod:e,utimes:t}={}){let r;if((A=this.resolve(A))===this.pathUtils.dirname(A))return;let o=A.split(this.pathUtils.sep);for(let A=2;A<=o.length;++A){let i=o.slice(0,A).join(this.pathUtils.sep);if(!this.existsSync(i)){try{await this.mkdirPromise(i)}catch(A){if("EEXIST"===A.code)continue;throw A}if(null!=r||(r=i),null!=e&&await this.chmodPromise(i,e),null!=t)await this.utimesPromise(i,t[0],t[1]);else{let A=await this.statPromise(this.pathUtils.dirname(i));await this.utimesPromise(i,A.atime,A.mtime)}}}return r}mkdirpSync(A,{chmod:e,utimes:t}={}){let r;if((A=this.resolve(A))===this.pathUtils.dirname(A))return;let o=A.split(this.pathUtils.sep);for(let A=2;A<=o.length;++A){let i=o.slice(0,A).join(this.pathUtils.sep);if(!this.existsSync(i)){try{this.mkdirSync(i)}catch(A){if("EEXIST"===A.code)continue;throw A}if(null!=r||(r=i),null!=e&&this.chmodSync(i,e),null!=t)this.utimesSync(i,t[0],t[1]);else{let A=this.statSync(this.pathUtils.dirname(i));this.utimesSync(i,A.atime,A.mtime)}}}return r}async copyPromise(A,e,{baseFs:t=this,overwrite:r=!0,stableSort:i=!1,stableTime:n=!1,linkStrategy:g=null}={}){return await (0,o.copyPromise)(this,A,t,e,{overwrite:r,stableSort:i,stableTime:n,linkStrategy:g})}copySync(A,e,{baseFs:t=this,overwrite:r=!0}={}){let o=t.lstatSync(e),n=this.existsSync(A);if(o.isDirectory())for(let o of(this.mkdirpSync(A),t.readdirSync(e)))this.copySync(this.pathUtils.join(A,o),t.pathUtils.join(e,o),{baseFs:t,overwrite:r});else if(o.isFile()){if(!n||r){n&&this.removeSync(A);let r=t.readFileSync(e);this.writeFileSync(A,r)}}else if(o.isSymbolicLink()){if(!n||r){n&&this.removeSync(A);let r=t.readlinkSync(e);this.symlinkSync((0,i.convertPath)(this.pathUtils,r),A)}}else throw Error(`Unsupported file type (file: ${e}, mode: 0o${o.mode.toString(8).padStart(6,"0")})`);let g=511&o.mode;this.chmodSync(A,g)}async changeFilePromise(A,e,t={}){return Buffer.isBuffer(e)?this.changeFileBufferPromise(A,e,t):this.changeFileTextPromise(A,e,t)}async changeFileBufferPromise(A,e,{mode:t}={}){let r=Buffer.alloc(0);try{r=await this.readFilePromise(A)}catch(A){}0!==Buffer.compare(r,e)&&await this.writeFilePromise(A,e,{mode:t})}async changeFileTextPromise(A,e,{automaticNewlines:t,mode:r}={}){let o="";try{o=await this.readFilePromise(A,"utf8")}catch(A){}let i=t?g(o,e):e;o!==i&&await this.writeFilePromise(A,i,{mode:r})}changeFileSync(A,e,t={}){return Buffer.isBuffer(e)?this.changeFileBufferSync(A,e,t):this.changeFileTextSync(A,e,t)}changeFileBufferSync(A,e,{mode:t}={}){let r=Buffer.alloc(0);try{r=this.readFileSync(A)}catch(A){}0!==Buffer.compare(r,e)&&this.writeFileSync(A,e,{mode:t})}changeFileTextSync(A,e,{automaticNewlines:t=!1,mode:r}={}){let o="";try{o=this.readFileSync(A,"utf8")}catch(A){}let i=t?g(o,e):e;o!==i&&this.writeFileSync(A,i,{mode:r})}async movePromise(A,e){try{await this.renamePromise(A,e)}catch(t){if("EXDEV"===t.code)await this.copyPromise(e,A),await this.removePromise(A);else throw t}}moveSync(A,e){try{this.renameSync(A,e)}catch(t){if("EXDEV"===t.code)this.copySync(e,A),this.removeSync(A);else throw t}}async lockPromise(A,e){let t=`${A}.flock`,r=1e3/60,o=Date.now(),i=null,n=async()=>{let A;try{[A]=await this.readJsonPromise(t)}catch(A){return Date.now()-o<500}try{return process.kill(A,0),!0}catch(A){return!1}};for(;null===i;)try{i=await this.openPromise(t,"wx")}catch(A){if("EEXIST"===A.code){if(!await n())try{await this.unlinkPromise(t);continue}catch(A){}if(Date.now()-o<6e4)await new Promise(A=>setTimeout(A,r));else throw Error(`Couldn't acquire a lock in a reasonable time (via ${t})`)}else throw A}await this.writePromise(i,JSON.stringify([process.pid]));try{return await e()}finally{try{await this.closePromise(i),await this.unlinkPromise(t)}catch(A){}}}async readJsonPromise(A){let e=await this.readFilePromise(A,"utf8");try{return JSON.parse(e)}catch(e){throw e.message+=` (in ${A})`,e}}readJsonSync(A){let e=this.readFileSync(A,"utf8");try{return JSON.parse(e)}catch(e){throw e.message+=` (in ${A})`,e}}async writeJsonPromise(A,e){return await this.writeFilePromise(A,`${JSON.stringify(e,null,2)} `)}writeJsonSync(A,e){return this.writeFileSync(A,`${JSON.stringify(e,null,2)} `)}async preserveTimePromise(A,e){let t=await this.lstatPromise(A),r=await e();void 0!==r&&(A=r),this.lutimesPromise?await this.lutimesPromise(A,t.atime,t.mtime):t.isSymbolicLink()||await this.utimesPromise(A,t.atime,t.mtime)}async preserveTimeSync(A,e){let t=this.lstatSync(A),r=e();void 0!==r&&(A=r),this.lutimesSync?this.lutimesSync(A,t.atime,t.mtime):t.isSymbolicLink()||this.utimesSync(A,t.atime,t.mtime)}}function g(A,e){return e.replace(/\r?\n/g,function(A){let e=A.match(/\r?\n/g);if(null===e)return r.EOL;let t=e.filter(A=>A===`\r `).length,o=e.length-t;return t>o?`\r `:` `}(A))}e.FakeFS=n,e.BasePortableFakeFS=class extends n{constructor(){super(i.ppath)}},e.normalizeLineEndings=g},686(A,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.JailFS=void 0;let r=t(1182),o=t(7243),i=t(7486),n=i.PortablePath.root;class g extends o.ProxiedFS{constructor(A,{baseFs:e=new r.NodeFS}={}){super(i.ppath),this.target=this.pathUtils.resolve(i.PortablePath.root,A),this.baseFs=e}getRealPath(){return this.pathUtils.resolve(this.baseFs.getRealPath(),this.pathUtils.relative(i.PortablePath.root,this.target))}getTarget(){return this.target}getBaseFs(){return this.baseFs}mapToBase(A){let e=this.pathUtils.normalize(A);if(this.pathUtils.isAbsolute(A))return this.pathUtils.resolve(this.target,this.pathUtils.relative(n,A));if(e.match(/^\.\.\/?/))throw Error(`Resolving this path (${A}) would escape the jail`);return this.pathUtils.resolve(this.target,A)}mapFromBase(A){return this.pathUtils.resolve(n,this.pathUtils.relative(this.target,A))}}e.JailFS=g},3364(A,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.LazyFS=void 0;let r=t(7243);class o extends r.ProxiedFS{constructor(A,e){super(e),this.instance=null,this.factory=A}get baseFs(){return this.instance||(this.instance=this.factory()),this.instance}set baseFs(A){this.instance=A}mapFromBase(A){return A}mapToBase(A){return A}}e.LazyFS=o},2729(A,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.NoFS=void 0;let r=t(5903),o=t(7486),i=()=>Object.assign(Error("ENOSYS: unsupported filesystem access"),{code:"ENOSYS"});class n extends r.FakeFS{constructor(){super(o.ppath)}getExtractHint(){throw i()}getRealPath(){throw i()}resolve(){throw i()}async openPromise(){throw i()}openSync(){throw i()}async opendirPromise(){throw i()}opendirSync(){throw i()}async readPromise(){throw i()}readSync(){throw i()}async writePromise(){throw i()}writeSync(){throw i()}async closePromise(){throw i()}closeSync(){throw i()}createWriteStream(){throw i()}createReadStream(){throw i()}async realpathPromise(){throw i()}realpathSync(){throw i()}async readdirPromise(){throw i()}readdirSync(){throw i()}async existsPromise(A){throw i()}existsSync(A){throw i()}async accessPromise(){throw i()}accessSync(){throw i()}async statPromise(){throw i()}statSync(){throw i()}async fstatPromise(A){throw i()}fstatSync(A){throw i()}async lstatPromise(A){throw i()}lstatSync(A){throw i()}async fchmodPromise(){throw i()}fchmodSync(){throw i()}async chmodPromise(){throw i()}chmodSync(){throw i()}async fchownPromise(){throw i()}fchownSync(){throw i()}async chownPromise(){throw i()}chownSync(){throw i()}async mkdirPromise(){throw i()}mkdirSync(){throw i()}async rmdirPromise(){throw i()}rmdirSync(){throw i()}async linkPromise(){throw i()}linkSync(){throw i()}async symlinkPromise(){throw i()}symlinkSync(){throw i()}async renamePromise(){throw i()}renameSync(){throw i()}async copyFilePromise(){throw i()}copyFileSync(){throw i()}async appendFilePromise(){throw i()}appendFileSync(){throw i()}async writeFilePromise(){throw i()}writeFileSync(){throw i()}async unlinkPromise(){throw i()}unlinkSync(){throw i()}async utimesPromise(){throw i()}utimesSync(){throw i()}async readFilePromise(){throw i()}readFileSync(){throw i()}async readlinkPromise(){throw i()}readlinkSync(){throw i()}async truncatePromise(){throw i()}truncateSync(){throw i()}async ftruncatePromise(A,e){throw i()}ftruncateSync(A,e){throw i()}watch(){throw i()}watchFile(){throw i()}unwatchFile(){throw i()}}e.NoFS=n,n.instance=new n},1182(A,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.NodeFS=void 0;let r=t(8663).__importDefault(t(9896)),o=t(5903),i=t(9658),n=t(7486);class g extends o.BasePortableFakeFS{constructor(A=r.default){super(),this.realFs=A,void 0!==this.realFs.lutimes&&(this.lutimesPromise=this.lutimesPromiseImpl,this.lutimesSync=this.lutimesSyncImpl)}getExtractHint(){return!1}getRealPath(){return n.PortablePath.root}resolve(A){return n.ppath.resolve(A)}async openPromise(A,e,t){return await new Promise((r,o)=>{this.realFs.open(n.npath.fromPortablePath(A),e,t,this.makeCallback(r,o))})}openSync(A,e,t){return this.realFs.openSync(n.npath.fromPortablePath(A),e,t)}async opendirPromise(A,e){return await new Promise((t,r)=>{void 0!==e?this.realFs.opendir(n.npath.fromPortablePath(A),e,this.makeCallback(t,r)):this.realFs.opendir(n.npath.fromPortablePath(A),this.makeCallback(t,r))}).then(e=>Object.defineProperty(e,"path",{value:A,configurable:!0,writable:!0}))}opendirSync(A,e){return Object.defineProperty(void 0!==e?this.realFs.opendirSync(n.npath.fromPortablePath(A),e):this.realFs.opendirSync(n.npath.fromPortablePath(A)),"path",{value:A,configurable:!0,writable:!0})}async readPromise(A,e,t=0,r=0,o=-1){return await new Promise((i,n)=>{this.realFs.read(A,e,t,r,o,(A,e)=>{A?n(A):i(e)})})}readSync(A,e,t,r,o){return this.realFs.readSync(A,e,t,r,o)}async writePromise(A,e,t,r,o){return await new Promise((i,n)=>"string"==typeof e?this.realFs.write(A,e,t,this.makeCallback(i,n)):this.realFs.write(A,e,t,r,o,this.makeCallback(i,n)))}writeSync(A,e,t,r,o){return"string"==typeof e?this.realFs.writeSync(A,e,t):this.realFs.writeSync(A,e,t,r,o)}async closePromise(A){await new Promise((e,t)=>{this.realFs.close(A,this.makeCallback(e,t))})}closeSync(A){this.realFs.closeSync(A)}createReadStream(A,e){let t=null!==A?n.npath.fromPortablePath(A):A;return this.realFs.createReadStream(t,e)}createWriteStream(A,e){let t=null!==A?n.npath.fromPortablePath(A):A;return this.realFs.createWriteStream(t,e)}async realpathPromise(A){return await new Promise((e,t)=>{this.realFs.realpath(n.npath.fromPortablePath(A),{},this.makeCallback(e,t))}).then(A=>n.npath.toPortablePath(A))}realpathSync(A){return n.npath.toPortablePath(this.realFs.realpathSync(n.npath.fromPortablePath(A),{}))}async existsPromise(A){return await new Promise(e=>{this.realFs.exists(n.npath.fromPortablePath(A),e)})}accessSync(A,e){return this.realFs.accessSync(n.npath.fromPortablePath(A),e)}async accessPromise(A,e){return await new Promise((t,r)=>{this.realFs.access(n.npath.fromPortablePath(A),e,this.makeCallback(t,r))})}existsSync(A){return this.realFs.existsSync(n.npath.fromPortablePath(A))}async statPromise(A,e){return await new Promise((t,r)=>{e?this.realFs.stat(n.npath.fromPortablePath(A),e,this.makeCallback(t,r)):this.realFs.stat(n.npath.fromPortablePath(A),this.makeCallback(t,r))})}statSync(A,e){return e?this.realFs.statSync(n.npath.fromPortablePath(A),e):this.realFs.statSync(n.npath.fromPortablePath(A))}async fstatPromise(A,e){return await new Promise((t,r)=>{e?this.realFs.fstat(A,e,this.makeCallback(t,r)):this.realFs.fstat(A,this.makeCallback(t,r))})}fstatSync(A,e){return e?this.realFs.fstatSync(A,e):this.realFs.fstatSync(A)}async lstatPromise(A,e){return await new Promise((t,r)=>{e?this.realFs.lstat(n.npath.fromPortablePath(A),e,this.makeCallback(t,r)):this.realFs.lstat(n.npath.fromPortablePath(A),this.makeCallback(t,r))})}lstatSync(A,e){return e?this.realFs.lstatSync(n.npath.fromPortablePath(A),e):this.realFs.lstatSync(n.npath.fromPortablePath(A))}async fchmodPromise(A,e){return await new Promise((t,r)=>{this.realFs.fchmod(A,e,this.makeCallback(t,r))})}fchmodSync(A,e){return this.realFs.fchmodSync(A,e)}async chmodPromise(A,e){return await new Promise((t,r)=>{this.realFs.chmod(n.npath.fromPortablePath(A),e,this.makeCallback(t,r))})}chmodSync(A,e){return this.realFs.chmodSync(n.npath.fromPortablePath(A),e)}async fchownPromise(A,e,t){return await new Promise((r,o)=>{this.realFs.fchown(A,e,t,this.makeCallback(r,o))})}fchownSync(A,e,t){return this.realFs.fchownSync(A,e,t)}async chownPromise(A,e,t){return await new Promise((r,o)=>{this.realFs.chown(n.npath.fromPortablePath(A),e,t,this.makeCallback(r,o))})}chownSync(A,e,t){return this.realFs.chownSync(n.npath.fromPortablePath(A),e,t)}async renamePromise(A,e){return await new Promise((t,r)=>{this.realFs.rename(n.npath.fromPortablePath(A),n.npath.fromPortablePath(e),this.makeCallback(t,r))})}renameSync(A,e){return this.realFs.renameSync(n.npath.fromPortablePath(A),n.npath.fromPortablePath(e))}async copyFilePromise(A,e,t=0){return await new Promise((r,o)=>{this.realFs.copyFile(n.npath.fromPortablePath(A),n.npath.fromPortablePath(e),t,this.makeCallback(r,o))})}copyFileSync(A,e,t=0){return this.realFs.copyFileSync(n.npath.fromPortablePath(A),n.npath.fromPortablePath(e),t)}async appendFilePromise(A,e,t){return await new Promise((r,o)=>{let i="string"==typeof A?n.npath.fromPortablePath(A):A;t?this.realFs.appendFile(i,e,t,this.makeCallback(r,o)):this.realFs.appendFile(i,e,this.makeCallback(r,o))})}appendFileSync(A,e,t){let r="string"==typeof A?n.npath.fromPortablePath(A):A;t?this.realFs.appendFileSync(r,e,t):this.realFs.appendFileSync(r,e)}async writeFilePromise(A,e,t){return await new Promise((r,o)=>{let i="string"==typeof A?n.npath.fromPortablePath(A):A;t?this.realFs.writeFile(i,e,t,this.makeCallback(r,o)):this.realFs.writeFile(i,e,this.makeCallback(r,o))})}writeFileSync(A,e,t){let r="string"==typeof A?n.npath.fromPortablePath(A):A;t?this.realFs.writeFileSync(r,e,t):this.realFs.writeFileSync(r,e)}async unlinkPromise(A){return await new Promise((e,t)=>{this.realFs.unlink(n.npath.fromPortablePath(A),this.makeCallback(e,t))})}unlinkSync(A){return this.realFs.unlinkSync(n.npath.fromPortablePath(A))}async utimesPromise(A,e,t){return await new Promise((r,o)=>{this.realFs.utimes(n.npath.fromPortablePath(A),e,t,this.makeCallback(r,o))})}utimesSync(A,e,t){this.realFs.utimesSync(n.npath.fromPortablePath(A),e,t)}async lutimesPromiseImpl(A,e,t){let r=this.realFs.lutimes;if(void 0===r)throw(0,i.ENOSYS)("unavailable Node binding",`lutimes '${A}'`);return await new Promise((o,i)=>{r.call(this.realFs,n.npath.fromPortablePath(A),e,t,this.makeCallback(o,i))})}lutimesSyncImpl(A,e,t){let r=this.realFs.lutimesSync;if(void 0===r)throw(0,i.ENOSYS)("unavailable Node binding",`lutimes '${A}'`);r.call(this.realFs,n.npath.fromPortablePath(A),e,t)}async mkdirPromise(A,e){return await new Promise((t,r)=>{this.realFs.mkdir(n.npath.fromPortablePath(A),e,this.makeCallback(t,r))})}mkdirSync(A,e){return this.realFs.mkdirSync(n.npath.fromPortablePath(A),e)}async rmdirPromise(A,e){return await new Promise((t,r)=>{e?this.realFs.rmdir(n.npath.fromPortablePath(A),e,this.makeCallback(t,r)):this.realFs.rmdir(n.npath.fromPortablePath(A),this.makeCallback(t,r))})}rmdirSync(A,e){return this.realFs.rmdirSync(n.npath.fromPortablePath(A),e)}async linkPromise(A,e){return await new Promise((t,r)=>{this.realFs.link(n.npath.fromPortablePath(A),n.npath.fromPortablePath(e),this.makeCallback(t,r))})}linkSync(A,e){return this.realFs.linkSync(n.npath.fromPortablePath(A),n.npath.fromPortablePath(e))}async symlinkPromise(A,e,t){return await new Promise((r,o)=>{this.realFs.symlink(n.npath.fromPortablePath(A.replace(/\/+$/,"")),n.npath.fromPortablePath(e),t,this.makeCallback(r,o))})}symlinkSync(A,e,t){return this.realFs.symlinkSync(n.npath.fromPortablePath(A.replace(/\/+$/,"")),n.npath.fromPortablePath(e),t)}async readFilePromise(A,e){return await new Promise((t,r)=>{let o="string"==typeof A?n.npath.fromPortablePath(A):A;this.realFs.readFile(o,e,this.makeCallback(t,r))})}readFileSync(A,e){let t="string"==typeof A?n.npath.fromPortablePath(A):A;return this.realFs.readFileSync(t,e)}async readdirPromise(A,e){return await new Promise((t,r)=>{(null==e?void 0:e.withFileTypes)?this.realFs.readdir(n.npath.fromPortablePath(A),{withFileTypes:!0},this.makeCallback(t,r)):this.realFs.readdir(n.npath.fromPortablePath(A),this.makeCallback(A=>t(A),r))})}readdirSync(A,e){return(null==e?void 0:e.withFileTypes)?this.realFs.readdirSync(n.npath.fromPortablePath(A),{withFileTypes:!0}):this.realFs.readdirSync(n.npath.fromPortablePath(A))}async readlinkPromise(A){return await new Promise((e,t)=>{this.realFs.readlink(n.npath.fromPortablePath(A),this.makeCallback(e,t))}).then(A=>n.npath.toPortablePath(A))}readlinkSync(A){return n.npath.toPortablePath(this.realFs.readlinkSync(n.npath.fromPortablePath(A)))}async truncatePromise(A,e){return await new Promise((t,r)=>{this.realFs.truncate(n.npath.fromPortablePath(A),e,this.makeCallback(t,r))})}truncateSync(A,e){return this.realFs.truncateSync(n.npath.fromPortablePath(A),e)}async ftruncatePromise(A,e){return await new Promise((t,r)=>{this.realFs.ftruncate(A,e,this.makeCallback(t,r))})}ftruncateSync(A,e){return this.realFs.ftruncateSync(A,e)}watch(A,e,t){return this.realFs.watch(n.npath.fromPortablePath(A),e,t)}watchFile(A,e,t){return this.realFs.watchFile(n.npath.fromPortablePath(A),e,t)}unwatchFile(A,e){return this.realFs.unwatchFile(n.npath.fromPortablePath(A),e)}makeCallback(A,e){return(t,r)=>{t?e(t):A(r)}}}e.NodeFS=g},3021(A,e,t){"use strict";e.NodePathFS=void 0;let r=t(7016),o=t(9023),i=t(7243),n=t(7486);class g extends i.ProxiedFS{constructor(A){super(n.npath),this.baseFs=A}mapFromBase(A){return A}mapToBase(A){if("string"==typeof A)return A;if(A instanceof r.URL)return(0,r.fileURLToPath)(A);if(Buffer.isBuffer(A)){let e=A.toString();if(Buffer.byteLength(e)!==A.byteLength)throw Error("Non-utf8 buffers are not supported at the moment. Please upvote the following issue if you encounter this error: https://github.com/yarnpkg/berry/issues/4942");return e}throw Error(`Unsupported path type: ${(0,o.inspect)(A)}`)}}e.NodePathFS=g},3913(A,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PosixFS=void 0;let r=t(7243),o=t(7486);class i extends r.ProxiedFS{constructor(A){super(o.npath),this.baseFs=A}mapFromBase(A){return o.npath.fromPortablePath(A)}mapToBase(A){return o.npath.toPortablePath(A)}}e.PosixFS=i},7243(A,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ProxiedFS=void 0;let r=t(5903);class o extends r.FakeFS{getExtractHint(A){return this.baseFs.getExtractHint(A)}resolve(A){return this.mapFromBase(this.baseFs.resolve(this.mapToBase(A)))}getRealPath(){return this.mapFromBase(this.baseFs.getRealPath())}async openPromise(A,e,t){return this.baseFs.openPromise(this.mapToBase(A),e,t)}openSync(A,e,t){return this.baseFs.openSync(this.mapToBase(A),e,t)}async opendirPromise(A,e){return Object.assign(await this.baseFs.opendirPromise(this.mapToBase(A),e),{path:A})}opendirSync(A,e){return Object.assign(this.baseFs.opendirSync(this.mapToBase(A),e),{path:A})}async readPromise(A,e,t,r,o){return await this.baseFs.readPromise(A,e,t,r,o)}readSync(A,e,t,r,o){return this.baseFs.readSync(A,e,t,r,o)}async writePromise(A,e,t,r,o){return"string"==typeof e?await this.baseFs.writePromise(A,e,t):await this.baseFs.writePromise(A,e,t,r,o)}writeSync(A,e,t,r,o){return"string"==typeof e?this.baseFs.writeSync(A,e,t):this.baseFs.writeSync(A,e,t,r,o)}async closePromise(A){return this.baseFs.closePromise(A)}closeSync(A){this.baseFs.closeSync(A)}createReadStream(A,e){return this.baseFs.createReadStream(null!==A?this.mapToBase(A):A,e)}createWriteStream(A,e){return this.baseFs.createWriteStream(null!==A?this.mapToBase(A):A,e)}async realpathPromise(A){return this.mapFromBase(await this.baseFs.realpathPromise(this.mapToBase(A)))}realpathSync(A){return this.mapFromBase(this.baseFs.realpathSync(this.mapToBase(A)))}async existsPromise(A){return this.baseFs.existsPromise(this.mapToBase(A))}existsSync(A){return this.baseFs.existsSync(this.mapToBase(A))}accessSync(A,e){return this.baseFs.accessSync(this.mapToBase(A),e)}async accessPromise(A,e){return this.baseFs.accessPromise(this.mapToBase(A),e)}async statPromise(A,e){return this.baseFs.statPromise(this.mapToBase(A),e)}statSync(A,e){return this.baseFs.statSync(this.mapToBase(A),e)}async fstatPromise(A,e){return this.baseFs.fstatPromise(A,e)}fstatSync(A,e){return this.baseFs.fstatSync(A,e)}lstatPromise(A,e){return this.baseFs.lstatPromise(this.mapToBase(A),e)}lstatSync(A,e){return this.baseFs.lstatSync(this.mapToBase(A),e)}async fchmodPromise(A,e){return this.baseFs.fchmodPromise(A,e)}fchmodSync(A,e){return this.baseFs.fchmodSync(A,e)}async chmodPromise(A,e){return this.baseFs.chmodPromise(this.mapToBase(A),e)}chmodSync(A,e){return this.baseFs.chmodSync(this.mapToBase(A),e)}async fchownPromise(A,e,t){return this.baseFs.fchownPromise(A,e,t)}fchownSync(A,e,t){return this.baseFs.fchownSync(A,e,t)}async chownPromise(A,e,t){return this.baseFs.chownPromise(this.mapToBase(A),e,t)}chownSync(A,e,t){return this.baseFs.chownSync(this.mapToBase(A),e,t)}async renamePromise(A,e){return this.baseFs.renamePromise(this.mapToBase(A),this.mapToBase(e))}renameSync(A,e){return this.baseFs.renameSync(this.mapToBase(A),this.mapToBase(e))}async copyFilePromise(A,e,t=0){return this.baseFs.copyFilePromise(this.mapToBase(A),this.mapToBase(e),t)}copyFileSync(A,e,t=0){return this.baseFs.copyFileSync(this.mapToBase(A),this.mapToBase(e),t)}async appendFilePromise(A,e,t){return this.baseFs.appendFilePromise(this.fsMapToBase(A),e,t)}appendFileSync(A,e,t){return this.baseFs.appendFileSync(this.fsMapToBase(A),e,t)}async writeFilePromise(A,e,t){return this.baseFs.writeFilePromise(this.fsMapToBase(A),e,t)}writeFileSync(A,e,t){return this.baseFs.writeFileSync(this.fsMapToBase(A),e,t)}async unlinkPromise(A){return this.baseFs.unlinkPromise(this.mapToBase(A))}unlinkSync(A){return this.baseFs.unlinkSync(this.mapToBase(A))}async utimesPromise(A,e,t){return this.baseFs.utimesPromise(this.mapToBase(A),e,t)}utimesSync(A,e,t){return this.baseFs.utimesSync(this.mapToBase(A),e,t)}async mkdirPromise(A,e){return this.baseFs.mkdirPromise(this.mapToBase(A),e)}mkdirSync(A,e){return this.baseFs.mkdirSync(this.mapToBase(A),e)}async rmdirPromise(A,e){return this.baseFs.rmdirPromise(this.mapToBase(A),e)}rmdirSync(A,e){return this.baseFs.rmdirSync(this.mapToBase(A),e)}async linkPromise(A,e){return this.baseFs.linkPromise(this.mapToBase(A),this.mapToBase(e))}linkSync(A,e){return this.baseFs.linkSync(this.mapToBase(A),this.mapToBase(e))}async symlinkPromise(A,e,t){let r=this.mapToBase(e);if(this.pathUtils.isAbsolute(A))return this.baseFs.symlinkPromise(this.mapToBase(A),r,t);let o=this.mapToBase(this.pathUtils.join(this.pathUtils.dirname(e),A)),i=this.baseFs.pathUtils.relative(this.baseFs.pathUtils.dirname(r),o);return this.baseFs.symlinkPromise(i,r,t)}symlinkSync(A,e,t){let r=this.mapToBase(e);if(this.pathUtils.isAbsolute(A))return this.baseFs.symlinkSync(this.mapToBase(A),r,t);let o=this.mapToBase(this.pathUtils.join(this.pathUtils.dirname(e),A)),i=this.baseFs.pathUtils.relative(this.baseFs.pathUtils.dirname(r),o);return this.baseFs.symlinkSync(i,r,t)}async readFilePromise(A,e){return this.baseFs.readFilePromise(this.fsMapToBase(A),e)}readFileSync(A,e){return this.baseFs.readFileSync(this.fsMapToBase(A),e)}async readdirPromise(A,e){return this.baseFs.readdirPromise(this.mapToBase(A),e)}readdirSync(A,e){return this.baseFs.readdirSync(this.mapToBase(A),e)}async readlinkPromise(A){return this.mapFromBase(await this.baseFs.readlinkPromise(this.mapToBase(A)))}readlinkSync(A){return this.mapFromBase(this.baseFs.readlinkSync(this.mapToBase(A)))}async truncatePromise(A,e){return this.baseFs.truncatePromise(this.mapToBase(A),e)}truncateSync(A,e){return this.baseFs.truncateSync(this.mapToBase(A),e)}async ftruncatePromise(A,e){return this.baseFs.ftruncatePromise(A,e)}ftruncateSync(A,e){return this.baseFs.ftruncateSync(A,e)}watch(A,e,t){return this.baseFs.watch(this.mapToBase(A),e,t)}watchFile(A,e,t){return this.baseFs.watchFile(this.mapToBase(A),e,t)}unwatchFile(A,e){return this.baseFs.unwatchFile(this.mapToBase(A),e)}fsMapToBase(A){return"number"==typeof A?A:this.mapToBase(A)}}e.ProxiedFS=o},2929(A,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.VirtualFS=void 0;let r=t(1182),o=t(7243),i=t(7486),n=/^[0-9]+$/,g=/^(\/(?:[^/]+\/)*?(?:\$\$virtual|__virtual__))((?:\/((?:[^/]+-)?[a-f0-9]+)(?:\/([^/]+))?)?((?:\/.*)?))$/,s=/^([^/]+-)?[a-f0-9]+$/;class C extends o.ProxiedFS{static makeVirtualPath(A,e,t){if("__virtual__"!==i.ppath.basename(A))throw Error('Assertion failed: Virtual folders must be named "__virtual__"');if(!i.ppath.basename(e).match(s))throw Error("Assertion failed: Virtual components must be ended by an hexadecimal hash");let r=i.ppath.relative(i.ppath.dirname(A),t).split("/"),o=0;for(;o<r.length&&".."===r[o];)o+=1;let n=r.slice(o);return i.ppath.join(A,e,String(o),...n)}static resolveVirtual(A){let e=A.match(g);if(!e||!e[3]&&e[5])return A;let t=i.ppath.dirname(e[1]);if(!e[3]||!e[4])return t;if(!n.test(e[4]))return A;let r=Number(e[4]),o="../".repeat(r),s=e[5]||".";return C.resolveVirtual(i.ppath.join(t,o,s))}constructor({baseFs:A=new r.NodeFS}={}){super(i.ppath),this.baseFs=A}getExtractHint(A){return this.baseFs.getExtractHint(A)}getRealPath(){return this.baseFs.getRealPath()}realpathSync(A){let e=A.match(g);if(!e)return this.baseFs.realpathSync(A);if(!e[5])return A;let t=this.baseFs.realpathSync(this.mapToBase(A));return C.makeVirtualPath(e[1],e[3],t)}async realpathPromise(A){let e=A.match(g);if(!e)return await this.baseFs.realpathPromise(A);if(!e[5])return A;let t=await this.baseFs.realpathPromise(this.mapToBase(A));return C.makeVirtualPath(e[1],e[3],t)}mapToBase(A){if(""===A)return A;if(this.pathUtils.isAbsolute(A))return C.resolveVirtual(A);let e=C.resolveVirtual(this.baseFs.resolve(i.PortablePath.dot)),t=C.resolveVirtual(this.baseFs.resolve(A));return i.ppath.relative(e,t)||i.PortablePath.dot}mapFromBase(A){return A}}e.VirtualFS=C},7585(A,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ZipFS=e.makeEmptyArchive=e.DEFAULT_COMPRESSION_LEVEL=void 0;let r=t(8663),o=t(9896),i=t(2203),n=t(9023),g=r.__importDefault(t(3106)),s=t(5903),C=t(1182),a=t(1703),I=t(4785),c=t(7324),E=r.__importStar(t(9658)),l=t(7486),Q=r.__importStar(t(2666));function B(){return Buffer.from([80,75,5,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])}e.DEFAULT_COMPRESSION_LEVEL="mixed",e.makeEmptyArchive=B;class h extends s.BasePortableFakeFS{constructor(A,t){if(super(),this.lzSource=null,this.listings=new Map,this.entries=new Map,this.fileSources=new Map,this.fds=new Map,this.nextFd=0,this.ready=!1,this.readOnly=!1,this.libzip=t.libzip,this.level=void 0!==t.level?t.level:e.DEFAULT_COMPRESSION_LEVEL,null!=A||(A=B()),"string"==typeof A){const{baseFs:e=new C.NodeFS}=t;this.baseFs=e,this.path=A}else this.path=null,this.baseFs=null;if(t.stats)this.stats=t.stats;else if("string"==typeof A)try{this.stats=this.baseFs.statSync(A)}catch(A){if("ENOENT"===A.code&&t.create)this.stats=Q.makeDefaultStats();else throw A}else this.stats=Q.makeDefaultStats();const r=this.libzip.malloc(4);try{let e=0;if("string"==typeof A&&t.create&&(e|=this.libzip.ZIP_CREATE|this.libzip.ZIP_TRUNCATE),t.readOnly&&(e|=this.libzip.ZIP_RDONLY,this.readOnly=!0),"string"==typeof A)this.zip=this.libzip.open(l.npath.fromPortablePath(A),e,r);else{const t=this.allocateUnattachedSource(A);try{this.zip=this.libzip.openFromSource(t,e,r),this.lzSource=t}catch(A){throw this.libzip.source.free(t),A}}if(0===this.zip){const A=this.libzip.struct.errorS();throw this.libzip.error.initWithCode(A,this.libzip.getValue(r,"i32")),this.makeLibzipError(A)}}finally{this.libzip.free(r)}this.listings.set(l.PortablePath.root,new Set);const o=this.libzip.getNumEntries(this.zip,0);for(let A=0;A<o;++A){const e=this.libzip.getName(this.zip,A,0);if(l.ppath.isAbsolute(e))continue;const t=l.ppath.resolve(l.PortablePath.root,e);this.registerEntry(t,A),e.endsWith("/")&&this.registerListing(t)}if(this.symlinkCount=this.libzip.ext.countSymlinks(this.zip),-1===this.symlinkCount)throw this.makeLibzipError(this.libzip.getError(this.zip));this.ready=!0}makeLibzipError(A){let e=this.libzip.struct.errorCodeZip(A),t=this.libzip.error.strerror(A),r=new E.LibzipError(t,this.libzip.errors[e]);if(e===this.libzip.errors.ZIP_ER_CHANGED)throw Error(`Assertion failed: Unexpected libzip error: ${r.message}`);return r}getExtractHint(A){for(let e of this.entries.keys()){let t=this.pathUtils.extname(e);if(A.relevantExtensions.has(t))return!0}return!1}getAllFiles(){return Array.from(this.entries.keys())}getRealPath(){if(!this.path)throw Error("ZipFS don't have real paths when loaded from a buffer");return this.path}getBufferAndClose(){if(this.prepareClose(),!this.lzSource)throw Error("ZipFS was not created from a Buffer");if(0===this.entries.size)return this.discardAndClose(),B();try{if(this.libzip.source.keep(this.lzSource),-1===this.libzip.close(this.zip))throw this.makeLibzipError(this.libzip.getError(this.zip));if(-1===this.libzip.source.open(this.lzSource)||-1===this.libzip.source.seek(this.lzSource,0,0,this.libzip.SEEK_END))throw this.makeLibzipError(this.libzip.source.error(this.lzSource));let A=this.libzip.source.tell(this.lzSource);if(-1===A||-1===this.libzip.source.seek(this.lzSource,0,0,this.libzip.SEEK_SET))throw this.makeLibzipError(this.libzip.source.error(this.lzSource));let e=this.libzip.malloc(A);if(!e)throw Error("Couldn't allocate enough memory");try{let t=this.libzip.source.read(this.lzSource,e,A);if(-1===t)throw this.makeLibzipError(this.libzip.source.error(this.lzSource));if(t<A)throw Error("Incomplete read");if(t>A)throw Error("Overread");let r=this.libzip.HEAPU8.subarray(e,e+A);return Buffer.from(r)}finally{this.libzip.free(e)}}finally{this.libzip.source.close(this.lzSource),this.libzip.source.free(this.lzSource),this.ready=!1}}prepareClose(){if(!this.ready)throw E.EBUSY("archive closed, close");(0,I.unwatchAllFiles)(this)}saveAndClose(){if(!this.path||!this.baseFs)throw Error("ZipFS cannot be saved and must be discarded when loaded from a buffer");if(this.prepareClose(),this.readOnly)return void this.discardAndClose();let A=this.baseFs.existsSync(this.path)||this.stats.mode===Q.DEFAULT_MODE?void 0:this.stats.mode;if(0===this.entries.size)this.discardAndClose(),this.baseFs.writeFileSync(this.path,B(),{mode:A});else{if(-1===this.libzip.close(this.zip))throw this.makeLibzipError(this.libzip.getError(this.zip));void 0!==A&&this.baseFs.chmodSync(this.path,A)}this.ready=!1}discardAndClose(){this.prepareClose(),this.libzip.discard(this.zip),this.ready=!1}resolve(A){return l.ppath.resolve(l.PortablePath.root,A)}async openPromise(A,e,t){return this.openSync(A,e,t)}openSync(A,e,t){let r=this.nextFd++;return this.fds.set(r,{cursor:0,p:A}),r}hasOpenFileHandles(){return!!this.fds.size}async opendirPromise(A,e){return this.opendirSync(A,e)}opendirSync(A,e={}){let t=this.resolveFilename(`opendir '${A}'`,A);if(!this.entries.has(t)&&!this.listings.has(t))throw E.ENOENT(`opendir '${A}'`);let r=this.listings.get(t);if(!r)throw E.ENOTDIR(`opendir '${A}'`);let o=[...r],i=this.openSync(t,"r"),n=()=>{this.closeSync(i)};return(0,a.opendir)(this,t,o,{onClose:n})}async readPromise(A,e,t,r,o){return this.readSync(A,e,t,r,o)}readSync(A,e,t=0,r=e.byteLength,o=-1){let i=this.fds.get(A);if(void 0===i)throw E.EBADF("read");let n=-1===o||null===o?i.cursor:o,g=this.readFileSync(i.p);g.copy(e,t,n,n+r);let s=Math.max(0,Math.min(g.length-n,r));return(-1===o||null===o)&&(i.cursor+=s),s}async writePromise(A,e,t,r,o){return"string"==typeof e?this.writeSync(A,e,o):this.writeSync(A,e,t,r,o)}writeSync(A,e,t,r,o){if(void 0===this.fds.get(A))throw E.EBADF("read");throw Error("Unimplemented")}async closePromise(A){return this.closeSync(A)}closeSync(A){if(void 0===this.fds.get(A))throw E.EBADF("read");this.fds.delete(A)}createReadStream(A,{encoding:e}={}){if(null===A)throw Error("Unimplemented");let t=this.openSync(A,"r"),r=Object.assign(new i.PassThrough({emitClose:!0,autoDestroy:!0,destroy:(A,e)=>{clearImmediate(o),this.closeSync(t),e(A)}}),{close(){r.destroy()},bytesRead:0,path:A,pending:!1}),o=setImmediate(async()=>{try{let t=await this.readFilePromise(A,e);r.bytesRead=t.length,r.end(t)}catch(A){r.destroy(A)}});return r}createWriteStream(A,{encoding:e}={}){if(this.readOnly)throw E.EROFS(`open '${A}'`);if(null===A)throw Error("Unimplemented");let t=[],r=this.openSync(A,"w"),o=Object.assign(new i.PassThrough({autoDestroy:!0,emitClose:!0,destroy:(o,i)=>{try{o?i(o):(this.writeFileSync(A,Buffer.concat(t),e),i(null))}catch(A){i(A)}finally{this.closeSync(r)}}}),{close(){o.destroy()},bytesWritten:0,path:A,pending:!1});return o.on("data",A=>{let e=Buffer.from(A);o.bytesWritten+=e.length,t.push(e)}),o}async realpathPromise(A){return this.realpathSync(A)}realpathSync(A){let e=this.resolveFilename(`lstat '${A}'`,A);if(!this.entries.has(e)&&!this.listings.has(e))throw E.ENOENT(`lstat '${A}'`);return e}async existsPromise(A){return this.existsSync(A)}existsSync(A){let e;if(!this.ready)throw E.EBUSY(`archive closed, existsSync '${A}'`);if(0===this.symlinkCount){let e=l.ppath.resolve(l.PortablePath.root,A);return this.entries.has(e)||this.listings.has(e)}try{e=this.resolveFilename(`stat '${A}'`,A,void 0,!1)}catch(A){return!1}return void 0!==e&&(this.entries.has(e)||this.listings.has(e))}async accessPromise(A,e){return this.accessSync(A,e)}accessSync(A,e=o.constants.F_OK){let t=this.resolveFilename(`access '${A}'`,A);if(!this.entries.has(t)&&!this.listings.has(t))throw E.ENOENT(`access '${A}'`);if(this.readOnly&&e&o.constants.W_OK)throw E.EROFS(`access '${A}'`)}async statPromise(A,e={bigint:!1}){return e.bigint?this.statSync(A,{bigint:!0}):this.statSync(A)}statSync(A,e={bigint:!1,throwIfNoEntry:!0}){let t=this.resolveFilename(`stat '${A}'`,A,void 0,e.throwIfNoEntry);if(void 0!==t){if(!this.entries.has(t)&&!this.listings.has(t)){if(!1===e.throwIfNoEntry)return;throw E.ENOENT(`stat '${A}'`)}if("/"===A[A.length-1]&&!this.listings.has(t))throw E.ENOTDIR(`stat '${A}'`);return this.statImpl(`stat '${A}'`,t,e)}}async fstatPromise(A,e){return this.fstatSync(A,e)}fstatSync(A,e){let t=this.fds.get(A);if(void 0===t)throw E.EBADF("fstatSync");let{p:r}=t,o=this.resolveFilename(`stat '${r}'`,r);if(!this.entries.has(o)&&!this.listings.has(o))throw E.ENOENT(`stat '${r}'`);if("/"===r[r.length-1]&&!this.listings.has(o))throw E.ENOTDIR(`stat '${r}'`);return this.statImpl(`fstat '${r}'`,o,e)}async lstatPromise(A,e={bigint:!1}){return e.bigint?this.lstatSync(A,{bigint:!0}):this.lstatSync(A)}lstatSync(A,e={bigint:!1,throwIfNoEntry:!0}){let t=this.resolveFilename(`lstat '${A}'`,A,!1,e.throwIfNoEntry);if(void 0!==t){if(!this.entries.has(t)&&!this.listings.has(t)){if(!1===e.throwIfNoEntry)return;throw E.ENOENT(`lstat '${A}'`)}if("/"===A[A.length-1]&&!this.listings.has(t))throw E.ENOTDIR(`lstat '${A}'`);return this.statImpl(`lstat '${A}'`,t,e)}}statImpl(A,e,t={}){let r=this.entries.get(e);if(void 0!==r){let A=this.libzip.struct.statS();if(-1===this.libzip.statIndex(this.zip,r,0,0,A))throw this.makeLibzipError(this.libzip.getError(this.zip));let o=this.stats.uid,i=this.stats.gid,n=this.libzip.struct.statSize(A)>>>0,g=Math.ceil(n/512),s=(this.libzip.struct.statMtime(A)>>>0)*1e3,C=new Date(s),a=new Date(s),I=new Date(s),E=new Date(s),l=this.listings.has(e)?c.S_IFDIR:this.isSymbolicLink(r)?c.S_IFLNK:c.S_IFREG,B=l===c.S_IFDIR?493:420,h=l|511&this.getUnixMode(r,B),u=this.libzip.struct.statCrc(A),d=Object.assign(new Q.StatEntry,{uid:o,gid:i,size:n,blksize:512,blocks:g,atime:C,birthtime:a,ctime:I,mtime:E,atimeMs:s,birthtimeMs:s,ctimeMs:s,mtimeMs:s,mode:h,crc:u});return!0===t.bigint?Q.convertToBigIntStats(d):d}if(this.listings.has(e)){let A=this.stats.uid,e=this.stats.gid,r=this.stats.mtimeMs,o=this.stats.mtimeMs,i=this.stats.mtimeMs,n=this.stats.mtimeMs,g=new Date(r),s=new Date(o),C=new Date(i),a=new Date(n),I=493|c.S_IFDIR,E=Object.assign(new Q.StatEntry,{uid:A,gid:e,size:0,blksize:512,blocks:0,atime:g,birthtime:s,ctime:C,mtime:a,atimeMs:r,birthtimeMs:o,ctimeMs:i,mtimeMs:n,mode:I,crc:0});return!0===t.bigint?Q.convertToBigIntStats(E):E}throw Error("Unreachable")}getUnixMode(A,e){if(-1===this.libzip.file.getExternalAttributes(this.zip,A,0,0,this.libzip.uint08S,this.libzip.uint32S))throw this.makeLibzipError(this.libzip.getError(this.zip));return this.libzip.getValue(this.libzip.uint08S,"i8")>>>0!==this.libzip.ZIP_OPSYS_UNIX?e:this.libzip.getValue(this.libzip.uint32S,"i32")>>>16}registerListing(A){let e=this.listings.get(A);if(e)return e;this.registerListing(l.ppath.dirname(A)).add(l.ppath.basename(A));let t=new Set;return this.listings.set(A,t),t}registerEntry(A,e){this.registerListing(l.ppath.dirname(A)).add(l.ppath.basename(A)),this.entries.set(A,e)}unregisterListing(A){this.listings.delete(A);let e=this.listings.get(l.ppath.dirname(A));null==e||e.delete(l.ppath.basename(A))}unregisterEntry(A){this.unregisterListing(A);let e=this.entries.get(A);this.entries.delete(A),void 0!==e&&(this.fileSources.delete(e),this.isSymbolicLink(e)&&this.symlinkCount--)}deleteEntry(A,e){if(this.unregisterEntry(A),-1===this.libzip.delete(this.zip,e))throw this.makeLibzipError(this.libzip.getError(this.zip))}resolveFilename(A,e,t=!0,r=!0){if(!this.ready)throw E.EBUSY(`archive closed, ${A}`);let o=l.ppath.resolve(l.PortablePath.root,e);if("/"===o)return l.PortablePath.root;let i=this.entries.get(o);if(t&&void 0!==i)if(!(0!==this.symlinkCount&&this.isSymbolicLink(i)))return o;else{let e=this.getFileSource(i).toString();return this.resolveFilename(A,l.ppath.resolve(l.ppath.dirname(o),e),!0,r)}for(;;){let e=this.resolveFilename(A,l.ppath.dirname(o),!0,r);if(void 0===e)return e;let i=this.listings.has(e),n=this.entries.has(e);if(!i&&!n){if(!1===r)return;throw E.ENOENT(A)}if(!i)throw E.ENOTDIR(A);if(o=l.ppath.resolve(e,l.ppath.basename(o)),!t||0===this.symlinkCount)break;let g=this.libzip.name.locate(this.zip,o.slice(1),0);if(-1===g)break;if(this.isSymbolicLink(g)){let A=this.getFileSource(g).toString();o=l.ppath.resolve(l.ppath.dirname(o),A)}else break}return o}allocateBuffer(A){Buffer.isBuffer(A)||(A=Buffer.from(A));let e=this.libzip.malloc(A.byteLength);if(!e)throw Error("Couldn't allocate enough memory");return new Uint8Array(this.libzip.HEAPU8.buffer,e,A.byteLength).set(A),{buffer:e,byteLength:A.byteLength}}allocateUnattachedSource(A){let e=this.libzip.struct.errorS(),{buffer:t,byteLength:r}=this.allocateBuffer(A),o=this.libzip.source.fromUnattachedBuffer(t,r,0,1,e);if(0===o)throw this.libzip.free(e),this.makeLibzipError(e);return o}allocateSource(A){let{buffer:e,byteLength:t}=this.allocateBuffer(A),r=this.libzip.source.fromBuffer(this.zip,e,t,0,1);if(0===r)throw this.libzip.free(e),this.makeLibzipError(this.libzip.getError(this.zip));return r}setFileSource(A,e){let t=Buffer.isBuffer(e)?e:Buffer.from(e),r=l.ppath.relative(l.PortablePath.root,A),o=this.allocateSource(e);try{let A=this.libzip.file.add(this.zip,r,o,this.libzip.ZIP_FL_OVERWRITE);if(-1===A)throw this.makeLibzipError(this.libzip.getError(this.zip));if("mixed"!==this.level){let e=0===this.level?this.libzip.ZIP_CM_STORE:this.libzip.ZIP_CM_DEFLATE,t=this.libzip.file.setCompression(this.zip,A,0,e,this.level);if(-1===t)throw this.makeLibzipError(this.libzip.getError(this.zip))}return this.fileSources.set(A,t),A}catch(A){throw this.libzip.source.free(o),A}}isSymbolicLink(A){if(0===this.symlinkCount)return!1;if(-1===this.libzip.file.getExternalAttributes(this.zip,A,0,0,this.libzip.uint08S,this.libzip.uint32S))throw this.makeLibzipError(this.libzip.getError(this.zip));return this.libzip.getValue(this.libzip.uint08S,"i8")>>>0===this.libzip.ZIP_OPSYS_UNIX&&(this.libzip.getValue(this.libzip.uint32S,"i32")>>>16&c.S_IFMT)===c.S_IFLNK}getFileSource(A,e={asyncDecompress:!1}){let t=this.fileSources.get(A);if(void 0!==t)return t;let r=this.libzip.struct.statS();if(-1===this.libzip.statIndex(this.zip,A,0,0,r))throw this.makeLibzipError(this.libzip.getError(this.zip));let o=this.libzip.struct.statCompSize(r),i=this.libzip.struct.statCompMethod(r),n=this.libzip.malloc(o);try{let t=this.libzip.fopenIndex(this.zip,A,0,this.libzip.ZIP_FL_COMPRESSED);if(0===t)throw this.makeLibzipError(this.libzip.getError(this.zip));try{let r=this.libzip.fread(t,n,o,0);if(-1===r)throw this.makeLibzipError(this.libzip.file.getError(t));if(r<o)throw Error("Incomplete read");if(r>o)throw Error("Overread");let s=this.libzip.HEAPU8.subarray(n,n+o),C=Buffer.from(s);if(0===i)return this.fileSources.set(A,C),C;{if(e.asyncDecompress)return new Promise((e,t)=>{g.default.inflateRaw(C,(r,o)=>{r?t(r):(this.fileSources.set(A,o),e(o))})});let t=g.default.inflateRawSync(C);return this.fileSources.set(A,t),t}}finally{this.libzip.fclose(t)}}finally{this.libzip.free(n)}}async fchmodPromise(A,e){return this.chmodPromise(this.fdToPath(A,"fchmod"),e)}fchmodSync(A,e){return this.chmodSync(this.fdToPath(A,"fchmodSync"),e)}async chmodPromise(A,e){return this.chmodSync(A,e)}chmodSync(A,e){if(this.readOnly)throw E.EROFS(`chmod '${A}'`);e&=493;let t=this.resolveFilename(`chmod '${A}'`,A,!1),r=this.entries.get(t);if(void 0===r)throw Error(`Assertion failed: The entry should have been registered (${t})`);let o=-512&this.getUnixMode(r,0|c.S_IFREG)|e;if(-1===this.libzip.file.setExternalAttributes(this.zip,r,0,0,this.libzip.ZIP_OPSYS_UNIX,o<<16))throw this.makeLibzipError(this.libzip.getError(this.zip))}async fchownPromise(A,e,t){return this.chownPromise(this.fdToPath(A,"fchown"),e,t)}fchownSync(A,e,t){return this.chownSync(this.fdToPath(A,"fchownSync"),e,t)}async chownPromise(A,e,t){return this.chownSync(A,e,t)}chownSync(A,e,t){throw Error("Unimplemented")}async renamePromise(A,e){return this.renameSync(A,e)}renameSync(A,e){throw Error("Unimplemented")}async copyFilePromise(A,e,t){let{indexSource:r,indexDest:o,resolvedDestP:i}=this.prepareCopyFile(A,e,t),n=await this.getFileSource(r,{asyncDecompress:!0}),g=this.setFileSource(i,n);g!==o&&this.registerEntry(i,g)}copyFileSync(A,e,t=0){let{indexSource:r,indexDest:o,resolvedDestP:i}=this.prepareCopyFile(A,e,t),n=this.getFileSource(r),g=this.setFileSource(i,n);g!==o&&this.registerEntry(i,g)}prepareCopyFile(A,e,t=0){if(this.readOnly)throw E.EROFS(`copyfile '${A} -> '${e}'`);if((t&o.constants.COPYFILE_FICLONE_FORCE)!=0)throw E.ENOSYS("unsupported clone operation",`copyfile '${A}' -> ${e}'`);let r=this.resolveFilename(`copyfile '${A} -> ${e}'`,A),i=this.entries.get(r);if(void 0===i)throw E.EINVAL(`copyfile '${A}' -> '${e}'`);let n=this.resolveFilename(`copyfile '${A}' -> ${e}'`,e),g=this.entries.get(n);if((t&(o.constants.COPYFILE_EXCL|o.constants.COPYFILE_FICLONE_FORCE))!=0&&void 0!==g)throw E.EEXIST(`copyfile '${A}' -> '${e}'`);return{indexSource:i,resolvedDestP:n,indexDest:g}}async appendFilePromise(A,e,t){if(this.readOnly)throw E.EROFS(`open '${A}'`);return void 0===t?t={flag:"a"}:"string"==typeof t?t={flag:"a",encoding:t}:void 0===t.flag&&(t={flag:"a",...t}),this.writeFilePromise(A,e,t)}appendFileSync(A,e,t={}){if(this.readOnly)throw E.EROFS(`open '${A}'`);return void 0===t?t={flag:"a"}:"string"==typeof t?t={flag:"a",encoding:t}:void 0===t.flag&&(t={flag:"a",...t}),this.writeFileSync(A,e,t)}fdToPath(A,e){var t;let r=null==(t=this.fds.get(A))?void 0:t.p;if(void 0===r)throw E.EBADF(e);return r}async writeFilePromise(A,e,t){let{encoding:r,mode:o,index:i,resolvedP:n}=this.prepareWriteFile(A,t);void 0!==i&&"object"==typeof t&&t.flag&&t.flag.includes("a")&&(e=Buffer.concat([await this.getFileSource(i,{asyncDecompress:!0}),Buffer.from(e)])),null!==r&&(e=e.toString(r));let g=this.setFileSource(n,e);g!==i&&this.registerEntry(n,g),null!==o&&await this.chmodPromise(n,o)}writeFileSync(A,e,t){let{encoding:r,mode:o,index:i,resolvedP:n}=this.prepareWriteFile(A,t);void 0!==i&&"object"==typeof t&&t.flag&&t.flag.includes("a")&&(e=Buffer.concat([this.getFileSource(i),Buffer.from(e)])),null!==r&&(e=e.toString(r));let g=this.setFileSource(n,e);g!==i&&this.registerEntry(n,g),null!==o&&this.chmodSync(n,o)}prepareWriteFile(A,e){if("number"==typeof A&&(A=this.fdToPath(A,"read")),this.readOnly)throw E.EROFS(`open '${A}'`);let t=this.resolveFilename(`open '${A}'`,A);if(this.listings.has(t))throw E.EISDIR(`open '${A}'`);let r=null,o=null;"string"==typeof e?r=e:"object"==typeof e&&({encoding:r=null,mode:o=null}=e);let i=this.entries.get(t);return{encoding:r,mode:o,resolvedP:t,index:i}}async unlinkPromise(A){return this.unlinkSync(A)}unlinkSync(A){if(this.readOnly)throw E.EROFS(`unlink '${A}'`);let e=this.resolveFilename(`unlink '${A}'`,A);if(this.listings.has(e))throw E.EISDIR(`unlink '${A}'`);let t=this.entries.get(e);if(void 0===t)throw E.EINVAL(`unlink '${A}'`);this.deleteEntry(e,t)}async utimesPromise(A,e,t){return this.utimesSync(A,e,t)}utimesSync(A,e,t){if(this.readOnly)throw E.EROFS(`utimes '${A}'`);let r=this.resolveFilename(`utimes '${A}'`,A);this.utimesImpl(r,t)}async lutimesPromise(A,e,t){return this.lutimesSync(A,e,t)}lutimesSync(A,e,t){if(this.readOnly)throw E.EROFS(`lutimes '${A}'`);let r=this.resolveFilename(`utimes '${A}'`,A,!1);this.utimesImpl(r,t)}utimesImpl(A,e){this.listings.has(A)&&!this.entries.has(A)&&this.hydrateDirectory(A);let t=this.entries.get(A);if(void 0===t)throw Error("Unreachable");if(-1===this.libzip.file.setMtime(this.zip,t,0,function(A){if("string"==typeof A&&String(+A)===A)return+A;if("number"==typeof A&&Number.isFinite(A))if(A<0)return Date.now()/1e3;else return A;if(n.types.isDate(A))return A.getTime()/1e3;throw Error("Invalid time")}(e),0))throw this.makeLibzipError(this.libzip.getError(this.zip))}async mkdirPromise(A,e){return this.mkdirSync(A,e)}mkdirSync(A,{mode:e=493,recursive:t=!1}={}){if(t)return this.mkdirpSync(A,{chmod:e});if(this.readOnly)throw E.EROFS(`mkdir '${A}'`);let r=this.resolveFilename(`mkdir '${A}'`,A);if(this.entries.has(r)||this.listings.has(r))throw E.EEXIST(`mkdir '${A}'`);this.hydrateDirectory(r),this.chmodSync(r,e)}async rmdirPromise(A,e){return this.rmdirSync(A,e)}rmdirSync(A,{recursive:e=!1}={}){if(this.readOnly)throw E.EROFS(`rmdir '${A}'`);if(e)return void this.removeSync(A);let t=this.resolveFilename(`rmdir '${A}'`,A),r=this.listings.get(t);if(!r)throw E.ENOTDIR(`rmdir '${A}'`);if(r.size>0)throw E.ENOTEMPTY(`rmdir '${A}'`);let o=this.entries.get(t);if(void 0===o)throw E.EINVAL(`rmdir '${A}'`);this.deleteEntry(A,o)}hydrateDirectory(A){let e=this.libzip.dir.add(this.zip,l.ppath.relative(l.PortablePath.root,A));if(-1===e)throw this.makeLibzipError(this.libzip.getError(this.zip));return this.registerListing(A),this.registerEntry(A,e),e}async linkPromise(A,e){return this.linkSync(A,e)}linkSync(A,e){throw E.EOPNOTSUPP(`link '${A}' -> '${e}'`)}async symlinkPromise(A,e){return this.symlinkSync(A,e)}symlinkSync(A,e){if(this.readOnly)throw E.EROFS(`symlink '${A}' -> '${e}'`);let t=this.resolveFilename(`symlink '${A}' -> '${e}'`,e);if(this.listings.has(t))throw E.EISDIR(`symlink '${A}' -> '${e}'`);if(this.entries.has(t))throw E.EEXIST(`symlink '${A}' -> '${e}'`);let r=this.setFileSource(t,A);if(this.registerEntry(t,r),-1===this.libzip.file.setExternalAttributes(this.zip,r,0,0,this.libzip.ZIP_OPSYS_UNIX,(511|c.S_IFLNK)<<16))throw this.makeLibzipError(this.libzip.getError(this.zip));this.symlinkCount+=1}async readFilePromise(A,e){"object"==typeof e&&(e=e?e.encoding:void 0);let t=await this.readFileBuffer(A,{asyncDecompress:!0});return e?t.toString(e):t}readFileSync(A,e){"object"==typeof e&&(e=e?e.encoding:void 0);let t=this.readFileBuffer(A);return e?t.toString(e):t}readFileBuffer(A,e={asyncDecompress:!1}){"number"==typeof A&&(A=this.fdToPath(A,"read"));let t=this.resolveFilename(`open '${A}'`,A);if(!this.entries.has(t)&&!this.listings.has(t))throw E.ENOENT(`open '${A}'`);if("/"===A[A.length-1]&&!this.listings.has(t))throw E.ENOTDIR(`open '${A}'`);if(this.listings.has(t))throw E.EISDIR("read");let r=this.entries.get(t);if(void 0===r)throw Error("Unreachable");return this.getFileSource(r,e)}async readdirPromise(A,e){return this.rea