@flexkit/cli 0.0.9 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -38,7 +38,7 @@ For details on how to use Flexkit CLI, check out our [documentation](https://fle
38
38
 
39
39
  ## Contributing
40
40
 
41
- Contributions to Flexkit are welcome and highly appreciated. However, before you jump right into it, we would like you to review our [Contribution Guidelines](/contributing.md) to make sure you have a smooth experience contributing to Flexkit.
41
+ Contributions to Flexkit are welcome and highly appreciated. However, before you jump right into it, we would like you to review our [Contribution Guidelines](/CONTRIBUTING.md) to make sure you have a smooth experience contributing to Flexkit.
42
42
 
43
43
  ## Reporting Issues
44
44
 
@@ -62,4 +62,4 @@ See [LICENSE](https://github.com/flexkit-io/flexkit/blob/main/LICENSE) for more
62
62
 
63
63
  If you believe you have found a security vulnerability in Flexkit, we encourage you to **_responsibly disclose this and NOT open a public issue_**.
64
64
 
65
- Please email us at security@flexkit.io to report any security vulnerabilities.
65
+ See [SECURITY.md](/SECURITY.md) for how to report.
package/dist/index.js CHANGED
@@ -206,7 +206,7 @@ etc`,value:"something unique",short:"generally the first line of `name`"}],pageS
206
206
  `);else if(o.length>0){let u=[["ID","Filename","Size","Deduped"],...o.map(Q=>[Q._id,Q.originalFilename??"",(0, EN.default)(Q.size??0)??"",Q.deduped?"yes":"no"])];g.print(`${ur(u)}
207
207
  `);}let B=o.filter(u=>u.deduped).length;g.log(`Uploaded ${o.length-B}, deduped ${B}, failed ${a.length}${i.tag?`, tagged with "${i.tag}"`:""}.`);for(let u of a)g.error(`${u.source}: ${u.message}`);return a.length>0?1:0}var nO=Object.defineProperty,IO=(e,A)=>{for(var t in A)nO(e,t,{get:A[t],enumerable:true});},aN=typeof process=="object"&&process?process:{stdout:null,stderr:null},oO=e=>!!e&&typeof e=="object"&&(e instanceof kr||e instanceof VN__default.default||BO(e)||QO(e)),BO=e=>!!e&&typeof e=="object"&&e instanceof sO.EventEmitter&&typeof e.pipe=="function"&&e.pipe!==VN__default.default.Writable.prototype.pipe,QO=e=>!!e&&typeof e=="object"&&e instanceof sO.EventEmitter&&typeof e.write=="function"&&typeof e.end=="function",Wi=Symbol("EOF"),ji=Symbol("maybeEmitEnd"),Fg=Symbol("emittedEnd"),cQ=Symbol("emittingEnd"),bs=Symbol("emittedError"),lQ=Symbol("closed"),uN=Symbol("read"),hQ=Symbol("flush"),cN=Symbol("flushChunk"),$t=Symbol("encoding"),II=Symbol("decoder"),we=Symbol("flowing"),Ls=Symbol("paused"),QI=Symbol("resume"),ye=Symbol("buffer"),ze=Symbol("pipes"),Fe=Symbol("bufferLength"),nh=Symbol("bufferPush"),DQ=Symbol("bufferShift"),Je=Symbol("objectMode"),ge=Symbol("destroyed"),Ih=Symbol("error"),sh=Symbol("emitData"),lN=Symbol("emitEnd"),Ch=Symbol("emitEnd2"),yi=Symbol("async"),oh=Symbol("abort"),fQ=Symbol("aborted"),xs=Symbol("signal"),lr=Symbol("dataListeners"),ut=Symbol("discarded"),vs=e=>Promise.resolve().then(e),EO=e=>e(),aO=e=>e==="end"||e==="finish"||e==="prefinish",uO=e=>e instanceof ArrayBuffer||!!e&&typeof e=="object"&&e.constructor&&e.constructor.name==="ArrayBuffer"&&e.byteLength>=0,cO=e=>!Buffer.isBuffer(e)&&ArrayBuffer.isView(e),ZN=class{src;dest;opts;ondrain;constructor(e,A,t){this.src=e,this.dest=A,this.opts=t,this.ondrain=()=>e[QI](),this.dest.on("drain",this.ondrain);}unpipe(){this.dest.removeListener("drain",this.ondrain);}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end();}},lO=class extends ZN{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe();}constructor(e,A,t){super(e,A,t),this.proxyErrors=i=>this.dest.emit("error",i),e.on("error",this.proxyErrors);}},hO=e=>!!e.objectMode,DO=e=>!e.objectMode&&!!e.encoding&&e.encoding!=="buffer",kr=class extends sO.EventEmitter{[we]=false;[Ls]=false;[ze]=[];[ye]=[];[Je];[$t];[yi];[II];[Wi]=false;[Fg]=false;[cQ]=false;[lQ]=false;[bs]=null;[Fe]=0;[ge]=false;[xs];[fQ]=false;[lr]=0;[ut]=false;writable=true;readable=true;constructor(...e){let A=e[0]||{};if(super(),A.objectMode&&typeof A.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");hO(A)?(this[Je]=true,this[$t]=null):DO(A)?(this[$t]=A.encoding,this[Je]=false):(this[Je]=false,this[$t]=null),this[yi]=!!A.async,this[II]=this[$t]?new string_decoder.StringDecoder(this[$t]):null,A&&A.debugExposeBuffer===true&&Object.defineProperty(this,"buffer",{get:()=>this[ye]}),A&&A.debugExposePipes===true&&Object.defineProperty(this,"pipes",{get:()=>this[ze]});let{signal:t}=A;t&&(this[xs]=t,t.aborted?this[oh]():t.addEventListener("abort",()=>this[oh]()));}get bufferLength(){return this[Fe]}get encoding(){return this[$t]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[Je]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[yi]}set async(e){this[yi]=this[yi]||!!e;}[oh](){this[fQ]=true,this.emit("abort",this[xs]?.reason),this.destroy(this[xs]?.reason);}get aborted(){return this[fQ]}set aborted(e){}write(e,A,t){if(this[fQ])return false;if(this[Wi])throw new Error("write after end");if(this[ge])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),true;typeof A=="function"&&(t=A,A="utf8"),A||(A="utf8");let i=this[yi]?vs:EO;if(!this[Je]&&!Buffer.isBuffer(e)){if(cO(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(uO(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[Je]?(this[we]&&this[Fe]!==0&&this[hQ](true),this[we]?this.emit("data",e):this[nh](e),this[Fe]!==0&&this.emit("readable"),t&&i(t),this[we]):e.length?(typeof e=="string"&&!(A===this[$t]&&!this[II]?.lastNeed)&&(e=Buffer.from(e,A)),Buffer.isBuffer(e)&&this[$t]&&(e=this[II].write(e)),this[we]&&this[Fe]!==0&&this[hQ](true),this[we]?this.emit("data",e):this[nh](e),this[Fe]!==0&&this.emit("readable"),t&&i(t),this[we]):(this[Fe]!==0&&this.emit("readable"),t&&i(t),this[we])}read(e){if(this[ge])return null;if(this[ut]=false,this[Fe]===0||e===0||e&&e>this[Fe])return this[ji](),null;this[Je]&&(e=null),this[ye].length>1&&!this[Je]&&(this[ye]=[this[$t]?this[ye].join(""):Buffer.concat(this[ye],this[Fe])]);let A=this[uN](e||null,this[ye][0]);return this[ji](),A}[uN](e,A){if(this[Je])this[DQ]();else {let t=A;e===t.length||e===null?this[DQ]():typeof t=="string"?(this[ye][0]=t.slice(e),A=t.slice(0,e),this[Fe]-=e):(this[ye][0]=t.subarray(e),A=t.subarray(0,e),this[Fe]-=e);}return this.emit("data",A),!this[ye].length&&!this[Wi]&&this.emit("drain"),A}end(e,A,t){return typeof e=="function"&&(t=e,e=void 0),typeof A=="function"&&(t=A,A="utf8"),e!==void 0&&this.write(e,A),t&&this.once("end",t),this[Wi]=true,this.writable=false,(this[we]||!this[Ls])&&this[ji](),this}[QI](){this[ge]||(!this[lr]&&!this[ze].length&&(this[ut]=true),this[Ls]=false,this[we]=true,this.emit("resume"),this[ye].length?this[hQ]():this[Wi]?this[ji]():this.emit("drain"));}resume(){return this[QI]()}pause(){this[we]=false,this[Ls]=true,this[ut]=false;}get destroyed(){return this[ge]}get flowing(){return this[we]}get paused(){return this[Ls]}[nh](e){this[Je]?this[Fe]+=1:this[Fe]+=e.length,this[ye].push(e);}[DQ](){return this[Je]?this[Fe]-=1:this[Fe]-=this[ye][0].length,this[ye].shift()}[hQ](e=false){do;while(this[cN](this[DQ]())&&this[ye].length);!e&&!this[ye].length&&!this[Wi]&&this.emit("drain");}[cN](e){return this.emit("data",e),this[we]}pipe(e,A){if(this[ge])return e;this[ut]=false;let t=this[Fg];return A=A||{},e===aN.stdout||e===aN.stderr?A.end=false:A.end=A.end!==false,A.proxyErrors=!!A.proxyErrors,t?A.end&&e.end():(this[ze].push(A.proxyErrors?new lO(this,e,A):new ZN(this,e,A)),this[yi]?vs(()=>this[QI]()):this[QI]()),e}unpipe(e){let A=this[ze].find(t=>t.dest===e);A&&(this[ze].length===1?(this[we]&&this[lr]===0&&(this[we]=false),this[ze]=[]):this[ze].splice(this[ze].indexOf(A),1),A.unpipe());}addListener(e,A){return this.on(e,A)}on(e,A){let t=super.on(e,A);if(e==="data")this[ut]=false,this[lr]++,!this[ze].length&&!this[we]&&this[QI]();else if(e==="readable"&&this[Fe]!==0)super.emit("readable");else if(aO(e)&&this[Fg])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[bs]){let i=A;this[yi]?vs(()=>i.call(this,this[bs])):i.call(this,this[bs]);}return t}removeListener(e,A){return this.off(e,A)}off(e,A){let t=super.off(e,A);return e==="data"&&(this[lr]=this.listeners("data").length,this[lr]===0&&!this[ut]&&!this[ze].length&&(this[we]=false)),t}removeAllListeners(e){let A=super.removeAllListeners(e);return (e==="data"||e===void 0)&&(this[lr]=0,!this[ut]&&!this[ze].length&&(this[we]=false)),A}get emittedEnd(){return this[Fg]}[ji](){!this[cQ]&&!this[Fg]&&!this[ge]&&this[ye].length===0&&this[Wi]&&(this[cQ]=true,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[lQ]&&this.emit("close"),this[cQ]=false);}emit(e,...A){let t=A[0];if(e!=="error"&&e!=="close"&&e!==ge&&this[ge])return false;if(e==="data")return !this[Je]&&!t?false:this[yi]?(vs(()=>this[sh](t)),true):this[sh](t);if(e==="end")return this[lN]();if(e==="close"){if(this[lQ]=true,!this[Fg]&&!this[ge])return false;let g=super.emit("close");return this.removeAllListeners("close"),g}else if(e==="error"){this[bs]=t,super.emit(Ih,t);let g=!this[xs]||this.listeners("error").length?super.emit("error",t):false;return this[ji](),g}else if(e==="resume"){let g=super.emit("resume");return this[ji](),g}else if(e==="finish"||e==="prefinish"){let g=super.emit(e);return this.removeAllListeners(e),g}let i=super.emit(e,...A);return this[ji](),i}[sh](e){for(let t of this[ze])t.dest.write(e)===false&&this.pause();let A=this[ut]?false:super.emit("data",e);return this[ji](),A}[lN](){return this[Fg]?false:(this[Fg]=true,this.readable=false,this[yi]?(vs(()=>this[Ch]()),true):this[Ch]())}[Ch](){if(this[II]){let A=this[II].end();if(A){for(let t of this[ze])t.dest.write(A);this[ut]||super.emit("data",A);}}for(let A of this[ze])A.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[Je]||(e.dataLength=0);let A=this.promise();return this.on("data",t=>{e.push(t),this[Je]||(e.dataLength+=t.length);}),await A,e}async concat(){if(this[Je])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[$t]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,A)=>{this.on(ge,()=>A(new Error("stream destroyed"))),this.on("error",t=>A(t)),this.on("end",()=>e());})}[Symbol.asyncIterator](){this[ut]=false;let e=false,A=async()=>(this.pause(),e=true,{value:void 0,done:true});return {next:()=>{if(e)return A();let t=this.read();if(t!==null)return Promise.resolve({done:false,value:t});if(this[Wi])return A();let i,g,r=a=>{this.off("data",n),this.off("end",s),this.off(ge,o),A(),g(a);},n=a=>{this.off("error",r),this.off("end",s),this.off(ge,o),this.pause(),i({value:a,done:!!this[Wi]});},s=()=>{this.off("error",r),this.off("data",n),this.off(ge,o),A(),i({done:true,value:void 0});},o=()=>r(new Error("stream destroyed"));return new Promise((a,B)=>{g=B,i=a,this.once(ge,o),this.once("error",r),this.once("end",s),this.once("data",n);})},throw:A,return:A,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[ut]=false;let e=false,A=()=>(this.pause(),this.off(Ih,A),this.off(ge,A),this.off("end",A),e=true,{done:true,value:void 0}),t=()=>{if(e)return A();let i=this.read();return i===null?A():{done:false,value:i}};return this.once("end",A),this.once(Ih,A),this.once(ge,A),{next:t,throw:A,return:A,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(e){if(this[ge])return e?this.emit("error",e):this.emit(ge),this;this[ge]=true,this[ut]=true,this[ye].length=0,this[Fe]=0;let A=this;return typeof A.close=="function"&&!this[lQ]&&A.close(),e?this.emit("error",e):this.emit(ge),this}static get isStream(){return oO}},fO=RA__default.default.writev,bg=Symbol("_autoClose"),ii=Symbol("_close"),Js=Symbol("_ended"),NA=Symbol("_fd"),Bh=Symbol("_finished"),zi=Symbol("_flags"),Qh=Symbol("_flush"),Uh=Symbol("_handleChunk"),bh=Symbol("_makeBuf"),Zs=Symbol("_mode"),dQ=Symbol("_needDrain"),lI=Symbol("_onerror"),hI=Symbol("_onopen"),Eh=Symbol("_onread"),EI=Symbol("_onwrite"),Lg=Symbol("_open"),ti=Symbol("_path"),kg=Symbol("_pos"),Fi=Symbol("_queue"),aI=Symbol("_read"),ah=Symbol("_readSize"),Xi=Symbol("_reading"),Ks=Symbol("_remain"),uh=Symbol("_size"),NQ=Symbol("_write"),hr=Symbol("_writing"),GQ=Symbol("_defaultFlag"),Fr=Symbol("_errored"),eD=class extends kr{[Fr]=false;[NA];[ti];[ah];[Xi]=false;[uh];[Ks];[bg];constructor(e,A){if(A=A||{},super(A),this.readable=true,this.writable=false,typeof e!="string")throw new TypeError("path must be a string");this[Fr]=false,this[NA]=typeof A.fd=="number"?A.fd:void 0,this[ti]=e,this[ah]=A.readSize||16*1024*1024,this[Xi]=false,this[uh]=typeof A.size=="number"?A.size:1/0,this[Ks]=this[uh],this[bg]=typeof A.autoClose=="boolean"?A.autoClose:true,typeof this[NA]=="number"?this[aI]():this[Lg]();}get fd(){return this[NA]}get path(){return this[ti]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[Lg](){RA__default.default.open(this[ti],"r",(e,A)=>this[hI](e,A));}[hI](e,A){e?this[lI](e):(this[NA]=A,this.emit("open",A),this[aI]());}[bh](){return Buffer.allocUnsafe(Math.min(this[ah],this[Ks]))}[aI](){if(!this[Xi]){this[Xi]=true;let e=this[bh]();if(e.length===0)return process.nextTick(()=>this[Eh](null,0,e));RA__default.default.read(this[NA],e,0,e.length,null,(A,t,i)=>this[Eh](A,t,i));}}[Eh](e,A,t){this[Xi]=false,e?this[lI](e):this[Uh](A,t)&&this[aI]();}[ii](){if(this[bg]&&typeof this[NA]=="number"){let e=this[NA];this[NA]=void 0,RA__default.default.close(e,A=>A?this.emit("error",A):this.emit("close"));}}[lI](e){this[Xi]=true,this[ii](),this.emit("error",e);}[Uh](e,A){let t=false;return this[Ks]-=e,e>0&&(t=super.write(e<A.length?A.subarray(0,e):A)),(e===0||this[Ks]<=0)&&(t=false,this[ii](),super.end()),t}emit(e,...A){switch(e){case "prefinish":case "finish":return false;case "drain":return typeof this[NA]=="number"&&this[aI](),false;case "error":return this[Fr]?false:(this[Fr]=true,super.emit(e,...A));default:return super.emit(e,...A)}}},dO=class extends eD{[Lg](){let e=true;try{this[hI](null,RA__default.default.openSync(this[ti],"r")),e=!1;}finally{e&&this[ii]();}}[aI](){let e=true;try{if(!this[Xi]){this[Xi]=!0;do{let A=this[bh](),t=A.length===0?0:RA__default.default.readSync(this[NA],A,0,A.length,null);if(!this[Uh](t,A))break}while(!0);this[Xi]=!1;}e=!1;}finally{e&&this[ii]();}}[ii](){if(this[bg]&&typeof this[NA]=="number"){let e=this[NA];this[NA]=void 0,RA__default.default.closeSync(e),this.emit("close");}}},WQ=class extends sO__default.default{readable=false;writable=true;[Fr]=false;[hr]=false;[Js]=false;[Fi]=[];[dQ]=false;[ti];[Zs];[bg];[NA];[GQ];[zi];[Bh]=false;[kg];constructor(e,A){A=A||{},super(A),this[ti]=e,this[NA]=typeof A.fd=="number"?A.fd:void 0,this[Zs]=A.mode===void 0?438:A.mode,this[kg]=typeof A.start=="number"?A.start:void 0,this[bg]=typeof A.autoClose=="boolean"?A.autoClose:true;let t=this[kg]!==void 0?"r+":"w";this[GQ]=A.flags===void 0,this[zi]=A.flags===void 0?t:A.flags,this[NA]===void 0&&this[Lg]();}emit(e,...A){if(e==="error"){if(this[Fr])return false;this[Fr]=true;}return super.emit(e,...A)}get fd(){return this[NA]}get path(){return this[ti]}[lI](e){this[ii](),this[hr]=true,this.emit("error",e);}[Lg](){RA__default.default.open(this[ti],this[zi],this[Zs],(e,A)=>this[hI](e,A));}[hI](e,A){this[GQ]&&this[zi]==="r+"&&e&&e.code==="ENOENT"?(this[zi]="w",this[Lg]()):e?this[lI](e):(this[NA]=A,this.emit("open",A),this[hr]||this[Qh]());}end(e,A){return e&&this.write(e,A),this[Js]=true,!this[hr]&&!this[Fi].length&&typeof this[NA]=="number"&&this[EI](null,0),this}write(e,A){return typeof e=="string"&&(e=Buffer.from(e,A)),this[Js]?(this.emit("error",new Error("write() after end()")),false):this[NA]===void 0||this[hr]||this[Fi].length?(this[Fi].push(e),this[dQ]=true,false):(this[hr]=true,this[NQ](e),true)}[NQ](e){RA__default.default.write(this[NA],e,0,e.length,this[kg],(A,t)=>this[EI](A,t));}[EI](e,A){e?this[lI](e):(this[kg]!==void 0&&typeof A=="number"&&(this[kg]+=A),this[Fi].length?this[Qh]():(this[hr]=false,this[Js]&&!this[Bh]?(this[Bh]=true,this[ii](),this.emit("finish")):this[dQ]&&(this[dQ]=false,this.emit("drain"))));}[Qh](){if(this[Fi].length===0)this[Js]&&this[EI](null,0);else if(this[Fi].length===1)this[NQ](this[Fi].pop());else {let e=this[Fi];this[Fi]=[],fO(this[NA],e,this[kg],(A,t)=>this[EI](A,t));}}[ii](){if(this[bg]&&typeof this[NA]=="number"){let e=this[NA];this[NA]=void 0,RA__default.default.close(e,A=>A?this.emit("error",A):this.emit("close"));}}},XN=class extends WQ{[Lg](){let e;if(this[GQ]&&this[zi]==="r+")try{e=RA__default.default.openSync(this[ti],this[zi],this[Zs]);}catch(A){if(A?.code==="ENOENT")return this[zi]="w",this[Lg]();throw A}else e=RA__default.default.openSync(this[ti],this[zi],this[Zs]);this[hI](null,e);}[ii](){if(this[bg]&&typeof this[NA]=="number"){let e=this[NA];this[NA]=void 0,RA__default.default.closeSync(e),this.emit("close");}}[NQ](e){let A=true;try{this[EI](null,RA__default.default.writeSync(this[NA],e,0,e.length,this[kg])),A=!1;}finally{if(A)try{this[ii]();}catch{}}}},yO=new Map([["C","cwd"],["f","file"],["z","gzip"],["P","preservePaths"],["U","unlink"],["strip-components","strip"],["stripComponents","strip"],["keep-newer","newer"],["keepNewer","newer"],["keep-newer-files","newer"],["keepNewerFiles","newer"],["k","keep"],["keep-existing","keep"],["keepExisting","keep"],["m","noMtime"],["no-mtime","noMtime"],["p","preserveOwner"],["L","follow"],["h","follow"],["onentry","onReadEntry"]]),FO=e=>!!e.sync&&!!e.file,mO=e=>!e.sync&&!!e.file,SO=e=>!!e.sync&&!e.file,RO=e=>!e.sync&&!e.file,kO=e=>!!e.file,MO=e=>yO.get(e)||e,tD=(e={})=>{if(!e)return {};let A={};for(let[t,i]of Object.entries(e)){let g=MO(t);A[g]=i;}return A.chmod===void 0&&A.noChmod===false&&(A.chmod=true),delete A.noChmod,A},rC=(e,A,t,i,g)=>Object.assign((r=[],n,s)=>{Array.isArray(r)&&(n=r,r={}),typeof n=="function"&&(s=n,n=void 0),n=n?Array.from(n):[];let o=tD(r);if(g?.(o,n),FO(o)){if(typeof s=="function")throw new TypeError("callback not supported for sync tar functions");return e(o,n)}else if(mO(o)){let a=A(o,n);return s?a.then(()=>s(),s):a}else if(SO(o)){if(typeof s=="function")throw new TypeError("callback not supported for sync tar functions");return t(o,n)}else if(RO(o)){if(typeof s=="function")throw new TypeError("callback only supported with file option");return i(o,n)}throw new Error("impossible options??")},{syncFile:e,asyncFile:A,syncNoFile:t,asyncNoFile:i,validate:g}),UO=hN__namespace.default.constants||{ZLIB_VERNUM:4736},Mi=Object.freeze(Object.assign(Object.create(null),{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_VERSION_ERROR:-6,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,DEFLATE:1,INFLATE:2,GZIP:3,GUNZIP:4,DEFLATERAW:5,INFLATERAW:6,UNZIP:7,BROTLI_DECODE:8,BROTLI_ENCODE:9,Z_MIN_WINDOWBITS:8,Z_MAX_WINDOWBITS:15,Z_DEFAULT_WINDOWBITS:15,Z_MIN_CHUNK:64,Z_MAX_CHUNK:1/0,Z_DEFAULT_CHUNK:16384,Z_MIN_MEMLEVEL:1,Z_MAX_MEMLEVEL:9,Z_DEFAULT_MEMLEVEL:8,Z_MIN_LEVEL:-1,Z_MAX_LEVEL:9,Z_DEFAULT_LEVEL:-1,BROTLI_OPERATION_PROCESS:0,BROTLI_OPERATION_FLUSH:1,BROTLI_OPERATION_FINISH:2,BROTLI_OPERATION_EMIT_METADATA:3,BROTLI_MODE_GENERIC:0,BROTLI_MODE_TEXT:1,BROTLI_MODE_FONT:2,BROTLI_DEFAULT_MODE:0,BROTLI_MIN_QUALITY:0,BROTLI_MAX_QUALITY:11,BROTLI_DEFAULT_QUALITY:11,BROTLI_MIN_WINDOW_BITS:10,BROTLI_MAX_WINDOW_BITS:24,BROTLI_LARGE_MAX_WINDOW_BITS:30,BROTLI_DEFAULT_WINDOW:22,BROTLI_MIN_INPUT_BLOCK_BITS:16,BROTLI_MAX_INPUT_BLOCK_BITS:24,BROTLI_PARAM_MODE:0,BROTLI_PARAM_QUALITY:1,BROTLI_PARAM_LGWIN:2,BROTLI_PARAM_LGBLOCK:3,BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING:4,BROTLI_PARAM_SIZE_HINT:5,BROTLI_PARAM_LARGE_WINDOW:6,BROTLI_PARAM_NPOSTFIX:7,BROTLI_PARAM_NDIRECT:8,BROTLI_DECODER_RESULT_ERROR:0,BROTLI_DECODER_RESULT_SUCCESS:1,BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:2,BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION:0,BROTLI_DECODER_PARAM_LARGE_WINDOW:1,BROTLI_DECODER_NO_ERROR:0,BROTLI_DECODER_SUCCESS:1,BROTLI_DECODER_NEEDS_MORE_INPUT:2,BROTLI_DECODER_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE:-1,BROTLI_DECODER_ERROR_FORMAT_RESERVED:-2,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE:-3,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET:-4,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME:-5,BROTLI_DECODER_ERROR_FORMAT_CL_SPACE:-6,BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE:-7,BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT:-8,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1:-9,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2:-10,BROTLI_DECODER_ERROR_FORMAT_TRANSFORM:-11,BROTLI_DECODER_ERROR_FORMAT_DICTIONARY:-12,BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS:-13,BROTLI_DECODER_ERROR_FORMAT_PADDING_1:-14,BROTLI_DECODER_ERROR_FORMAT_PADDING_2:-15,BROTLI_DECODER_ERROR_FORMAT_DISTANCE:-16,BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET:-19,BROTLI_DECODER_ERROR_INVALID_ARGUMENTS:-20,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES:-21,BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS:-22,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP:-25,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1:-26,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2:-27,BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES:-30,BROTLI_DECODER_ERROR_UNREACHABLE:-31},UO)),bO=buffer.Buffer.concat,DN=Object.getOwnPropertyDescriptor(buffer.Buffer,"concat"),LO=e=>e,ch=DN?.writable===true||DN?.set!==void 0?e=>{buffer.Buffer.concat=e?LO:bO;}:e=>{},Sr=Symbol("_superWrite"),pQ=class extends Error{code;errno;constructor(e,A){super("zlib: "+e.message,{cause:e}),this.code=e.code,this.errno=e.errno,this.code||(this.code="ZLIB_ERROR"),this.message="zlib: "+e.message,Error.captureStackTrace(this,A??this.constructor);}get name(){return "ZlibError"}},lh=Symbol("flushFlag"),iD=class extends kr{#A=false;#t=false;#e;#n;#r;#i;#g;get sawError(){return this.#A}get handle(){return this.#i}get flushFlag(){return this.#e}constructor(e,A){if(!e||typeof e!="object")throw new TypeError("invalid options for ZlibBase constructor");if(super(e),this.#e=e.flush??0,this.#n=e.finishFlush??0,this.#r=e.fullFlushFlag??0,typeof hN__namespace[A]!="function")throw new TypeError("Compression method not supported: "+A);try{this.#i=new hN__namespace[A](e);}catch(t){throw new pQ(t,this.constructor)}this.#g=t=>{this.#A||(this.#A=true,this.close(),this.emit("error",t));},this.#i?.on("error",t=>this.#g(new pQ(t))),this.once("end",()=>this.close);}close(){this.#i&&(this.#i.close(),this.#i=void 0,this.emit("close"));}reset(){if(!this.#A)return Lh__default.default(this.#i,"zlib binding closed"),this.#i.reset?.()}flush(e){this.ended||(typeof e!="number"&&(e=this.#r),this.write(Object.assign(buffer.Buffer.alloc(0),{[lh]:e})));}end(e,A,t){return typeof e=="function"&&(t=e,A=void 0,e=void 0),typeof A=="function"&&(t=A,A=void 0),e&&(A?this.write(e,A):this.write(e)),this.flush(this.#n),this.#t=true,super.end(t)}get ended(){return this.#t}[Sr](e){return super.write(e)}write(e,A,t){if(typeof A=="function"&&(t=A,A="utf8"),typeof e=="string"&&(e=buffer.Buffer.from(e,A)),this.#A)return;Lh__default.default(this.#i,"zlib binding closed");let i=this.#i._handle,g=i.close;i.close=()=>{};let r=this.#i.close;this.#i.close=()=>{},ch(true);let n;try{let o=typeof e[lh]=="number"?e[lh]:this.#e;n=this.#i._processChunk(e,o),ch(!1);}catch(o){ch(false),this.#g(new pQ(o,this.write));}finally{this.#i&&(this.#i._handle=i,i.close=g,this.#i.close=r,this.#i.removeAllListeners("error"));}this.#i&&this.#i.on("error",o=>this.#g(new pQ(o,this.write)));let s;if(n)if(Array.isArray(n)&&n.length>0){let o=n[0];s=this[Sr](buffer.Buffer.from(o));for(let a=1;a<n.length;a++)s=this[Sr](n[a]);}else s=this[Sr](buffer.Buffer.from(n));return t&&t(),s}},$N=class extends iD{#A;#t;constructor(e,A){e=e||{},e.flush=e.flush||Mi.Z_NO_FLUSH,e.finishFlush=e.finishFlush||Mi.Z_FINISH,e.fullFlushFlag=Mi.Z_FULL_FLUSH,super(e,A),this.#A=e.level,this.#t=e.strategy;}params(e,A){if(!this.sawError){if(!this.handle)throw new Error("cannot switch params when binding is closed");if(!this.handle.params)throw new Error("not supported in this implementation");if(this.#A!==e||this.#t!==A){this.flush(Mi.Z_SYNC_FLUSH),Lh__default.default(this.handle,"zlib binding closed");let t=this.handle.flush;this.handle.flush=(i,g)=>{typeof i=="function"&&(g=i,i=this.flushFlag),this.flush(i),g?.();};try{this.handle.params(e,A);}finally{this.handle.flush=t;}this.handle&&(this.#A=e,this.#t=A);}}}},xO=class extends $N{#A;constructor(e){super(e,"Gzip"),this.#A=e&&!!e.portable;}[Sr](e){return this.#A?(this.#A=false,e[9]=255,super[Sr](e)):super[Sr](e)}},vO=class extends $N{constructor(e){super(e,"Unzip");}},AG=class extends iD{constructor(e,A){e=e||{},e.flush=e.flush||Mi.BROTLI_OPERATION_PROCESS,e.finishFlush=e.finishFlush||Mi.BROTLI_OPERATION_FINISH,e.fullFlushFlag=Mi.BROTLI_OPERATION_FLUSH,super(e,A);}},JO=class extends AG{constructor(e){super(e,"BrotliCompress");}},KO=class extends AG{constructor(e){super(e,"BrotliDecompress");}},eG=class extends iD{constructor(e,A){e=e||{},e.flush=e.flush||Mi.ZSTD_e_continue,e.finishFlush=e.finishFlush||Mi.ZSTD_e_end,e.fullFlushFlag=Mi.ZSTD_e_flush,super(e,A);}},HO=class extends eG{constructor(e){super(e,"ZstdCompress");}},YO=class extends eG{constructor(e){super(e,"ZstdDecompress");}},TO=(e,A)=>{if(Number.isSafeInteger(e))e<0?OO(e,A):PO(e,A);else throw Error("cannot encode number outside of javascript safe integer range");return A},PO=(e,A)=>{A[0]=128;for(var t=A.length;t>1;t--)A[t-1]=e&255,e=Math.floor(e/256);},OO=(e,A)=>{A[0]=255;var t=false;e=e*-1;for(var i=A.length;i>1;i--){var g=e&255;e=Math.floor(e/256),t?A[i-1]=tG(g):g===0?A[i-1]=0:(t=true,A[i-1]=iG(g));}},_O=e=>{let A=e[0],t=A===128?WO(e.subarray(1,e.length)):A===255?qO(e):null;if(t===null)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(t))throw Error("parsed number outside of javascript safe integer range");return t},qO=e=>{for(var A=e.length,t=0,i=false,g=A-1;g>-1;g--){var r=Number(e[g]),n;i?n=tG(r):r===0?n=r:(i=true,n=iG(r)),n!==0&&(t-=n*Math.pow(256,A-g-1));}return t},WO=e=>{for(var A=e.length,t=0,i=A-1;i>-1;i--){var g=Number(e[i]);g!==0&&(t+=g*Math.pow(256,A-i-1));}return t},tG=e=>(255^e)&255,iG=e=>(255^e)+1&255,jO={};IO(jO,{code:()=>gD,isCode:()=>UQ,isName:()=>VO,name:()=>jQ,normalFsTypes:()=>gG});var UQ=e=>jQ.has(e),VO=e=>gD.has(e),gG=new Set(["0","","1","2","3","4","5","6","7","D"]),jQ=new Map([["0","File"],["","OldFile"],["1","Link"],["2","SymbolicLink"],["3","CharacterDevice"],["4","BlockDevice"],["5","Directory"],["6","FIFO"],["7","ContiguousFile"],["g","GlobalExtendedHeader"],["x","ExtendedHeader"],["A","SolarisACL"],["D","GNUDumpDir"],["I","Inode"],["K","NextFileHasLongLinkpath"],["L","NextFileHasLongPath"],["M","ContinuationFile"],["N","OldGnuLongPath"],["S","SparseFile"],["V","TapeVolumeHeader"],["X","OldExtendedHeader"]]),gD=new Map(Array.from(jQ).map(e=>[e[1],e[0]])),ZO=e=>e===void 0||e<0?void 0:e,Rr=class{cksumValid=false;needPax=false;nullBlock=false;block;path;mode;uid;gid;size;cksum;#A="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor(e,A=0,t,i){Buffer.isBuffer(e)?this.decode(e,A||0,t,i):e&&this.#t(e);}decode(e,A,t,i){if(A||(A=0),!e||!(e.length>=A+512))throw new Error("need 512 bytes for header");let g=Dr(e,A+156,1),r=gG.has(g),n=r?t:void 0,s=r?i:void 0;if(this.path=n?.path??Dr(e,A,100),this.mode=n?.mode??s?.mode??Mg(e,A+100,8),this.uid=n?.uid??s?.uid??Mg(e,A+108,8),this.gid=n?.gid??s?.gid??Mg(e,A+116,8),this.size=ZO(n?.size??s?.size??Mg(e,A+124,12)),this.mtime=n?.mtime??s?.mtime??hh(e,A+136,12),this.cksum=Mg(e,A+148,12),s&&this.#t(s,true),n&&this.#t(n),UQ(g)&&(this.#A=g||"0"),this.#A==="0"&&this.path.slice(-1)==="/"&&(this.#A="5"),this.#A==="5"&&(this.size=0),this.linkpath=Dr(e,A+157,100),e.subarray(A+257,A+265).toString()==="ustar\x0000")if(this.uname=n?.uname??s?.uname??Dr(e,A+265,32),this.gname=n?.gname??s?.gname??Dr(e,A+297,32),this.devmaj=n?.devmaj??s?.devmaj??Mg(e,A+329,8)??0,this.devmin=n?.devmin??s?.devmin??Mg(e,A+337,8)??0,e[A+475]!==0){let a=Dr(e,A+345,155);this.path=a+"/"+this.path;}else {let a=Dr(e,A+345,130);a&&(this.path=a+"/"+this.path),this.atime=t?.atime??i?.atime??hh(e,A+476,12),this.ctime=t?.ctime??i?.ctime??hh(e,A+488,12);}let o=256;for(let a=A;a<A+148;a++)o+=e[a];for(let a=A+156;a<A+512;a++)o+=e[a];this.cksumValid=o===this.cksum,this.cksum===void 0&&o===256&&(this.nullBlock=true);}#t(e,A=false){Object.assign(this,Object.fromEntries(Object.entries(e).filter(([t,i])=>!(i==null||t==="size"&&Number(i)<0||t==="path"&&A||t==="linkpath"&&A||t==="global"))));}encode(e,A=0){if(e||(e=this.block=Buffer.alloc(512)),this.#A==="Unsupported"&&(this.#A="0"),!(e.length>=A+512))throw new Error("need 512 bytes for header");let t=this.ctime||this.atime?130:155,i=XO(this.path||"",t),g=i[0],r=i[1];this.needPax=!!i[2],this.needPax=fr(e,A,100,g)||this.needPax,this.needPax=Ng(e,A+100,8,this.mode)||this.needPax,this.needPax=Ng(e,A+108,8,this.uid)||this.needPax,this.needPax=Ng(e,A+116,8,this.gid)||this.needPax,this.needPax=Ng(e,A+124,12,this.size)||this.needPax,this.needPax=Dh(e,A+136,12,this.mtime)||this.needPax,e[A+156]=Number(this.#A.codePointAt(0)),this.needPax=fr(e,A+157,100,this.linkpath)||this.needPax,e.write("ustar\x0000",A+257,8),this.needPax=fr(e,A+265,32,this.uname)||this.needPax,this.needPax=fr(e,A+297,32,this.gname)||this.needPax,this.needPax=Ng(e,A+329,8,this.devmaj)||this.needPax,this.needPax=Ng(e,A+337,8,this.devmin)||this.needPax,this.needPax=fr(e,A+345,t,r)||this.needPax,e[A+475]!==0?this.needPax=fr(e,A+345,155,r)||this.needPax:(this.needPax=fr(e,A+345,130,r)||this.needPax,this.needPax=Dh(e,A+476,12,this.atime)||this.needPax,this.needPax=Dh(e,A+488,12,this.ctime)||this.needPax);let n=256;for(let s=A;s<A+148;s++)n+=e[s];for(let s=A+156;s<A+512;s++)n+=e[s];return this.cksum=n,Ng(e,A+148,8,this.cksum),this.cksumValid=true,this.needPax}get type(){return this.#A==="Unsupported"?this.#A:jQ.get(this.#A)}get typeKey(){return this.#A}set type(e){let A=String(gD.get(e));if(UQ(A)||A==="Unsupported")this.#A=A;else if(UQ(e))this.#A=e;else throw new TypeError("invalid entry type: "+e)}},XO=(e,A)=>{let t=e,i="",g,r=ue.posix.parse(e).root||".";if(Buffer.byteLength(t)<100)g=[t,i,false];else {i=ue.posix.dirname(t),t=ue.posix.basename(t);do Buffer.byteLength(t)<=100&&Buffer.byteLength(i)<=A?g=[t,i,false]:Buffer.byteLength(t)>100&&Buffer.byteLength(i)<=A?g=[t.slice(0,99),i,true]:(t=ue.posix.join(ue.posix.basename(i),t),i=ue.posix.dirname(i));while(i!==r&&g===void 0);g||(g=[e.slice(0,99),"",true]);}return g},Dr=(e,A,t)=>e.subarray(A,A+t).toString("utf8").replace(/\0.*/,""),hh=(e,A,t)=>zO(Mg(e,A,t)),zO=e=>e===void 0?void 0:new Date(e*1e3),Mg=(e,A,t)=>Number(e[A])&128?_O(e.subarray(A,A+t)):A_(e,A,t),$O=e=>isNaN(e)?void 0:e,A_=(e,A,t)=>$O(parseInt(e.subarray(A,A+t).toString("utf8").replace(/\0.*$/,"").trim(),8)),e_={12:8589934591,8:2097151},Ng=(e,A,t,i)=>i===void 0?false:i>e_[t]||i<0?(TO(i,e.subarray(A,A+t)),true):(t_(e,A,t,i),false),t_=(e,A,t,i)=>e.write(i_(i,t),A,t,"ascii"),i_=(e,A)=>g_(Math.floor(e).toString(8),A),g_=(e,A)=>(e.length===A-1?e:new Array(A-e.length-1).join("0")+e+" ")+"\0",Dh=(e,A,t,i)=>i===void 0?false:Ng(e,A,t,i.getTime()/1e3),r_=new Array(156).join("\0"),fr=(e,A,t,i)=>i===void 0?false:(e.write(i+r_,A,t,"utf8"),i.length!==Buffer.byteLength(i)||i.length>t),TQ=class rG{atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor(A,t=false){this.atime=A.atime,this.charset=A.charset,this.comment=A.comment,this.ctime=A.ctime,this.dev=A.dev,this.gid=A.gid,this.global=t,this.gname=A.gname,this.ino=A.ino,this.linkpath=A.linkpath,this.mtime=A.mtime,this.nlink=A.nlink,this.path=A.path,this.size=A.size,this.uid=A.uid,this.uname=A.uname;}encode(){let A=this.encodeBody();if(A==="")return Buffer.allocUnsafe(0);let t=Buffer.byteLength(A),i=512*Math.ceil(1+t/512),g=Buffer.allocUnsafe(i);for(let r=0;r<512;r++)g[r]=0;new Rr({path:("PaxHeader/"+ue.basename(this.path??"")).slice(0,99),mode:this.mode||420,uid:this.uid,gid:this.gid,size:t,mtime:this.mtime,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime,ctime:this.ctime}).encode(g),g.write(A,512,t,"utf8");for(let r=t+512;r<g.length;r++)g[r]=0;return g}encodeBody(){return this.encodeField("path")+this.encodeField("ctime")+this.encodeField("atime")+this.encodeField("dev")+this.encodeField("ino")+this.encodeField("nlink")+this.encodeField("charset")+this.encodeField("comment")+this.encodeField("gid")+this.encodeField("gname")+this.encodeField("linkpath")+this.encodeField("mtime")+this.encodeField("size")+this.encodeField("uid")+this.encodeField("uname")}encodeField(A){if(this[A]===void 0)return "";let t=this[A],i=t instanceof Date?t.getTime()/1e3:t,g=" "+(A==="dev"||A==="ino"||A==="nlink"?"SCHILY.":"")+A+"="+i+`
208
208
  `,r=Buffer.byteLength(g),n=Math.floor(Math.log(r)/Math.log(10))+1;return r+n>=Math.pow(10,n)&&(n+=1),n+r+g}static parse(A,t,i=false){return new rG(I_(s_(A),t),i)}},I_=(e,A)=>A?Object.assign({},A,e):e,s_=e=>e.replace(/\n$/,"").split(`
209
- `).reduce(C_,Object.create(null)),C_=(e,A)=>{let t=parseInt(A,10);if(t!==Buffer.byteLength(A)+1)return e;A=A.slice((t+" ").length);let i=A.split("="),g=i.shift();if(!g)return e;let r=g.replace(/^SCHILY\.(dev|ino|nlink)/,"$1"),n=i.join("=").replace(/\0.*/,"");switch(r){case "path":case "linkpath":case "type":case "charset":case "comment":case "gname":case "uname":e[r]=n;break;case "ctime":case "atime":case "mtime":e[r]=new Date(Number(n)*1e3);break;case "size":let s=+n;s>=0&&(e[r]=s);break;case "gid":case "uid":case "dev":case "ino":case "nlink":case "mode":e[r]=+n;break}return e},o_=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,hA=o_!=="win32"?e=>String(e):e=>String(e).replaceAll(/\\/g,"/"),B_=class extends kr{extended;globalExtended;header;startBlockSize;blockRemain;remain;type;meta=false;ignore=false;path;mode;uid;gid;uname;gname;size=0;mtime;atime;ctime;linkpath;dev;ino;nlink;invalid=false;absolute;unsupported=false;constructor(e,A,t){switch(super({}),this.pause(),this.extended=A,this.globalExtended=t,this.header=e,this.remain=e.size??0,this.startBlockSize=512*Math.ceil(this.remain/512),this.blockRemain=this.startBlockSize,this.type=e.type,this.type){case "File":case "OldFile":case "Link":case "SymbolicLink":case "CharacterDevice":case "BlockDevice":case "Directory":case "FIFO":case "ContiguousFile":case "GNUDumpDir":break;case "NextFileHasLongLinkpath":case "NextFileHasLongPath":case "OldGnuLongPath":case "GlobalExtendedHeader":case "ExtendedHeader":case "OldExtendedHeader":this.meta=true;break;default:this.ignore=true;}if(!e.path)throw new Error("no path provided for tar.ReadEntry");this.path=hA(e.path),this.mode=e.mode,this.mode&&(this.mode=this.mode&4095),this.uid=e.uid,this.gid=e.gid,this.uname=e.uname,this.gname=e.gname,this.size=this.remain,this.mtime=e.mtime,this.atime=e.atime,this.ctime=e.ctime,this.linkpath=e.linkpath?hA(e.linkpath):void 0,this.uname=e.uname,this.gname=e.gname,A&&this.#A(A),t&&this.#A(t,true);}write(e){let A=e.length;if(A>this.blockRemain)throw new Error("writing more to entry than is appropriate");let t=this.remain,i=this.blockRemain;return this.remain=Math.max(0,t-A),this.blockRemain=Math.max(0,i-A),this.ignore?true:t>=A?super.write(e):super.write(e.subarray(0,t))}#A(e,A=false){e.path&&(e.path=hA(e.path)),e.linkpath&&(e.linkpath=hA(e.linkpath)),Object.assign(this,Object.fromEntries(Object.entries(e).filter(([t,i])=>!(i==null||t==="path"&&A))));}},VQ=(e,A,t,i={})=>{e.file&&(i.file=e.file),e.cwd&&(i.cwd=e.cwd),i.code=t instanceof Error&&t.code||A,i.tarCode=A,!e.strict&&i.recoverable!==false?(t instanceof Error&&(i=Object.assign(t,i),t=t.message),e.emit("warn",A,t,i)):t instanceof Error?e.emit("error",Object.assign(t,i)):e.emit("error",Object.assign(new Error(`${A}: ${t}`),i));},Q_=1024*1024,xh=Buffer.from([31,139]),vh=Buffer.from([40,181,47,253]),E_=Math.max(xh.length,vh.length),Kt=Symbol("state"),dr=Symbol("writeEntry"),Vi=Symbol("readEntry"),fh=Symbol("nextEntry"),fN=Symbol("processEntry"),mi=Symbol("extendedHeader"),Hs=Symbol("globalExtendedHeader"),mg=Symbol("meta"),dN=Symbol("emitMeta"),OA=Symbol("buffer"),Zi=Symbol("queue"),Sg=Symbol("ended"),dh=Symbol("emittedEnd"),pr=Symbol("emit"),Ae=Symbol("unzip"),wQ=Symbol("consumeChunk"),yQ=Symbol("consumeChunkSub"),ph=Symbol("consumeBody"),pN=Symbol("consumeMeta"),wN=Symbol("consumeHeader"),Ys=Symbol("consuming"),wh=Symbol("bufferConcat"),FQ=Symbol("maybeEnd"),CI=Symbol("writing"),Si=Symbol("aborted"),mQ=Symbol("onDone"),wr=Symbol("sawValidEntry"),SQ=Symbol("sawNullBlock"),RQ=Symbol("sawEOF"),yN=Symbol("closeStream"),a_=1e3,Ts=Symbol("compressedBytesRead"),yh=Symbol("decompressedBytesRead"),FN=Symbol("checkDecompressionRatio"),u_=()=>true,gC=class extends sO.EventEmitter{file;strict;maxMetaEntrySize;filter;brotli;zstd;maxDecompressionRatio;writable=true;readable=false;[Zi]=[];[OA];[Vi];[dr];[Kt]="begin";[mg]="";[mi];[Hs];[Sg]=false;[Ae];[Si]=false;[wr];[SQ]=false;[RQ]=false;[CI]=false;[Ys]=false;[dh]=false;[Ts]=0;[yh]=0;constructor(e={}){super(),this.file=e.file||"",this.on(mQ,()=>{(this[Kt]==="begin"||this[wr]===false)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format");}),e.ondone?this.on(mQ,e.ondone):this.on(mQ,()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end");}),this.strict=!!e.strict,this.maxDecompressionRatio=typeof e.maxDecompressionRatio=="number"?e.maxDecompressionRatio:a_,this.maxMetaEntrySize=e.maxMetaEntrySize||Q_,this.filter=typeof e.filter=="function"?e.filter:u_;let A=e.file&&(e.file.endsWith(".tar.br")||e.file.endsWith(".tbr"));this.brotli=!(e.gzip||e.zstd)&&e.brotli!==void 0?e.brotli:A?void 0:false;let t=e.file&&(e.file.endsWith(".tar.zst")||e.file.endsWith(".tzst"));this.zstd=!(e.gzip||e.brotli)&&e.zstd!==void 0?e.zstd:t?true:void 0,this.on("end",()=>this[yN]()),typeof e.onwarn=="function"&&this.on("warn",e.onwarn),typeof e.onReadEntry=="function"&&this.on("entry",e.onReadEntry);}warn(e,A,t={}){VQ(this,e,A,t);}[wN](e,A){this[wr]===void 0&&(this[wr]=false);let t;try{t=new Rr(e,A,this[mi],this[Hs]);}catch(i){return this.warn("TAR_ENTRY_INVALID",i)}if(t.nullBlock)this[SQ]?(this[RQ]=true,this[Kt]==="begin"&&(this[Kt]="header"),this[pr]("eof")):(this[SQ]=true,this[pr]("nullBlock"));else if(this[SQ]=false,!t.cksumValid)this.warn("TAR_ENTRY_INVALID","checksum failure",{header:t});else if(!t.path)this.warn("TAR_ENTRY_INVALID","path is required",{header:t});else {let i=t.type;if(/^(Symbolic)?Link$/.test(i)&&!t.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:t});else if(!/^(Symbolic)?Link$/.test(i)&&!/^(Global)?ExtendedHeader$/.test(i)&&t.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:t});else {let g=this[dr]=new B_(t,this[mi],this[Hs]);if(!this[wr])if(g.remain){let r=()=>{g.invalid||(this[wr]=true);};g.on("end",r);}else this[wr]=true;g.meta?g.size>this.maxMetaEntrySize?(g.ignore=true,this[pr]("ignoredEntry",g),this[Kt]="ignore",g.resume()):g.size>0&&(this[mg]="",g.on("data",r=>this[mg]+=r),this[Kt]="meta"):(this[mi]=void 0,g.ignore=g.ignore||!this.filter(g.path,g),g.ignore?(this[pr]("ignoredEntry",g),this[Kt]=g.remain?"ignore":"header",g.resume()):(g.remain?this[Kt]="body":(this[Kt]="header",g.end()),this[Vi]?this[Zi].push(g):(this[Zi].push(g),this[fh]())));}}}[yN](){queueMicrotask(()=>this.emit("close"));}[fN](e){let A=true;if(!e)this[Vi]=void 0,A=false;else if(Array.isArray(e)){let[t,...i]=e;this.emit(t,...i);}else this[Vi]=e,this.emit("entry",e),e.emittedEnd||(e.on("end",()=>this[fh]()),A=false);return A}[fh](){do;while(this[fN](this[Zi].shift()));if(this[Zi].length===0){let e=this[Vi];!e||e.flowing||e.size===e.remain?this[CI]||this.emit("drain"):e.once("drain",()=>this.emit("drain"));}}[ph](e,A){let t=this[dr];if(!t)throw new Error("attempt to consume body without entry??");let i=t.blockRemain??0,g=i>=e.length&&A===0?e:e.subarray(A,A+i);return t.write(g),t.blockRemain||(this[Kt]="header",this[dr]=void 0,t.end()),g.length}[pN](e,A){let t=this[dr],i=this[ph](e,A);return !this[dr]&&t&&this[dN](t),i}[pr](e,A,t){this[Zi].length===0&&!this[Vi]?this.emit(e,A,t):this[Zi].push([e,A,t]);}[dN](e){switch(this[pr]("meta",this[mg]),e.type){case "ExtendedHeader":case "OldExtendedHeader":this[mi]=TQ.parse(this[mg],this[mi],false);break;case "GlobalExtendedHeader":this[Hs]=TQ.parse(this[mg],this[Hs],true);break;case "NextFileHasLongPath":case "OldGnuLongPath":{let A=this[mi]??Object.create(null);this[mi]=A,A.path=this[mg].replace(/\0.*/,"");break}case "NextFileHasLongLinkpath":{let A=this[mi]||Object.create(null);this[mi]=A,A.linkpath=this[mg].replace(/\0.*/,"");break}default:throw new Error("unknown meta: "+e.type)}}abort(e){if(!this[Si]){if(this[Ae]){let A=this[Ae];A.write=()=>true,A.end=()=>A,A.emit=()=>false,A.destroy?.();}this[Si]=true,this.emit("abort",e),this.warn("TAR_ABORT",e,{recoverable:false});}}[FN](e){this[yh]+=e.length;let A=this[yh]/this[Ts];return A>this.maxDecompressionRatio?(this.abort(new Error(`max decompression ratio exceeded: ${A.toFixed(2)} > ${this.maxDecompressionRatio}`)),false):true}write(e,A,t){if(typeof A=="function"&&(t=A,A=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof A=="string"?A:"utf8")),this[Si])return t?.(),false;if((this[Ae]===void 0||this.brotli===void 0&&this[Ae]===false)&&e){if(this[OA]&&(e=Buffer.concat([this[OA],e]),this[OA]=void 0),e.length<E_)return this[OA]=e,t?.(),true;for(let n=0;this[Ae]===void 0&&n<xh.length;n++)e[n]!==xh[n]&&(this[Ae]=false);let g=false;if(this[Ae]===false&&this.zstd!==false){g=true;for(let n=0;n<vh.length;n++)if(e[n]!==vh[n]){g=false;break}}let r=this.brotli===void 0&&!g;if(this[Ae]===false&&r)if(e.length<512)if(this[Sg])this.brotli=true;else return this[OA]=e,t?.(),true;else try{new Rr(e.subarray(0,512)),this.brotli=!1;}catch{this.brotli=true;}if(this[Ae]===void 0||this[Ae]===false&&(this.brotli||g)){let n=this[Sg];this[Sg]=false,this[Ae]=this[Ae]===void 0?new vO({}):g?new YO({}):new KO({}),this[Ae].on("data",o=>{this[FN](o)&&this[wQ](o);}),this[Ae].on("error",o=>{this[Si]||this.abort(o);}),this[Ae].on("end",()=>{this[Sg]=true,this[wQ]();}),this[CI]=true,this[Ts]+=e.length;let s=!!this[Ae][n?"end":"write"](e);return this[CI]=false,t?.(),s}}this[CI]=true,this[Ae]?(this[Ts]+=e.length,this[Ae].write(e)):this[wQ](e),this[CI]=false;let i=this[Zi].length>0?false:this[Vi]?this[Vi].flowing:true;return !i&&this[Zi].length===0&&this[Vi]?.once("drain",()=>this.emit("drain")),t?.(),i}[wh](e){e&&!this[Si]&&(this[OA]=this[OA]?Buffer.concat([this[OA],e]):e);}[FQ](){if(this[Sg]&&!this[dh]&&!this[Si]&&!this[Ys]){this[dh]=true;let e=this[dr];if(e?.blockRemain){let A=this[OA]?this[OA].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${e.blockRemain} more bytes, only ${A} available)`,{entry:e}),this[OA]&&e.write(this[OA]),e.end();}this[pr](mQ);}}[wQ](e){if(this[Ys]&&e)this[wh](e);else if(!e&&!this[OA])this[FQ]();else if(e){if(this[Ys]=true,this[OA]){this[wh](e);let A=this[OA];this[OA]=void 0,this[yQ](A);}else this[yQ](e);for(;this[OA]&&this[OA]?.length>=512&&!this[Si]&&!this[RQ];){let A=this[OA];this[OA]=void 0,this[yQ](A);}this[Ys]=false;}(!this[OA]||this[Sg])&&this[FQ]();}[yQ](e){let A=0,t=e.length;for(;A+512<=t&&!this[Si]&&!this[RQ];)switch(this[Kt]){case "begin":case "header":this[wN](e,A),A+=512;break;case "ignore":case "body":A+=this[ph](e,A);break;case "meta":A+=this[pN](e,A);break;default:throw new Error("invalid state: "+this[Kt])}A<t&&(this[OA]=this[OA]?Buffer.concat([e.subarray(A),this[OA]]):e.subarray(A));}end(e,A,t){return typeof e=="function"&&(t=e,A=void 0,e=void 0),typeof A=="function"&&(t=A,A=void 0),typeof e=="string"&&(e=Buffer.from(e,A)),t&&this.once("finish",t),this[Si]||(this[Ae]?(e&&(this[Ts]+=e.length,this[Ae].write(e)),this[Ae].end()):(this[Sg]=true,(this.brotli===void 0||this.zstd===void 0)&&(e=e||Buffer.alloc(0)),e&&this.write(e),this[FQ]())),this}},Xs=e=>{let A=e.length-1,t=-1;for(;A>-1&&e.charAt(A)==="/";)t=A,A--;return t===-1?e:e.slice(0,t)},c_=e=>{let A=e.onReadEntry;e.onReadEntry=A?t=>{A(t),t.resume();}:t=>t.resume();},nG=(e,A)=>{let t=new Map(A.map(r=>[Xs(r),true])),i=e.filter,g=(r,n="")=>{let s=n||ue.parse(r).root||".",o;if(r===s)o=false;else {let a=t.get(r);o=a!==void 0?a:g(ue.dirname(r),s);}return t.set(r,o),o};e.filter=i?(r,n)=>i(r,n)&&g(Xs(r)):r=>g(Xs(r));},l_=e=>{let A=new gC(e),t=e.file,i;try{i=RA__default.default.openSync(t,"r");let g=RA__default.default.fstatSync(i),r=e.maxReadSize||16*1024*1024;if(g.size<r){let n=Buffer.allocUnsafe(g.size),s=RA__default.default.readSync(i,n,0,g.size,0);A.end(s===n.byteLength?n:n.subarray(0,s));}else {let n=0,s=Buffer.allocUnsafe(r);for(;n<g.size;){let o=RA__default.default.readSync(i,s,0,r,n);if(o===0)break;n+=o,A.write(s.subarray(0,o));}A.end();}}finally{if(typeof i=="number")try{RA__default.default.closeSync(i);}catch{}}},h_=(e,A)=>{let t=new gC(e),i=e.maxReadSize||16*1024*1024,g=e.file;return new Promise((r,n)=>{t.on("error",n),t.on("end",r),RA__default.default.stat(g,(s,o)=>{if(s)n(s);else {let a=new eD(g,{readSize:i,size:o.size});a.on("error",n),a.pipe(t);}});})},ZQ=rC(l_,h_,e=>new gC(e),e=>new gC(e),(e,A)=>{A?.length&&nG(e,A),e.noResume||c_(e);}),IG=(e,A,t)=>(e&=4095,t&&(e=(e|384)&-19),A&&(e&256&&(e|=64),e&32&&(e|=8),e&4&&(e|=1)),e),{isAbsolute:f_,parse:SN}=ue.win32,rD=e=>{let A="",t=SN(e);for(;f_(e)||t.root;){let i=e.charAt(0)==="/"&&e.slice(0,4)!=="//?/"?"/":t.root;e=e.slice(i.length),A+=i,t=SN(e);}return [A,e]},XQ=["|","<",">","?",":"],nD=XQ.map(e=>String.fromCodePoint(61440+Number(e.codePointAt(0)))),d_=new Map(XQ.map((e,A)=>[e,nD[A]])),p_=new Map(nD.map((e,A)=>[e,XQ[A]])),RN=e=>XQ.reduce((A,t)=>A.split(t).join(d_.get(t)),e),w_=e=>nD.reduce((A,t)=>A.split(t).join(p_.get(t)),e),sG=(e,A)=>A?(e=hA(e).replace(/^\.(\/|$)/,""),Xs(A)+"/"+e):hA(e),y_=16*1024*1024,kN=Symbol("process"),MN=Symbol("file"),NN=Symbol("directory"),Jh=Symbol("symlink"),GN=Symbol("hardlink"),Ps=Symbol("header"),bQ=Symbol("read"),Kh=Symbol("lstat"),LQ=Symbol("onlstat"),Hh=Symbol("onread"),Yh=Symbol("onreadlink"),Th=Symbol("openfile"),Ph=Symbol("onopenfile"),Gg=Symbol("close"),OQ=Symbol("mode"),Oh=Symbol("awaitDrain"),Fh=Symbol("ondrain"),ki=Symbol("prefix"),CG=class extends kr{path;portable;myuid=process.getuid&&process.getuid()||0;myuser=process.env.USER||"";maxReadSize;linkCache;statCache;preservePaths;cwd;strict;mtime;noPax;noMtime;prefix;fd;blockLen=0;blockRemain=0;buf;pos=0;remain=0;length=0;offset=0;win32;absolute;header;type;linkpath;stat;onWriteEntry;#A=false;constructor(e,A={}){let t=tD(A);super(),this.path=hA(e),this.portable=!!t.portable,this.maxReadSize=t.maxReadSize||y_,this.linkCache=t.linkCache||new Map,this.statCache=t.statCache||new Map,this.preservePaths=!!t.preservePaths,this.cwd=hA(t.cwd||process.cwd()),this.strict=!!t.strict,this.noPax=!!t.noPax,this.noMtime=!!t.noMtime,this.mtime=t.mtime,this.prefix=t.prefix?hA(t.prefix):void 0,this.onWriteEntry=t.onWriteEntry,typeof t.onwarn=="function"&&this.on("warn",t.onwarn);let i=false;if(!this.preservePaths){let[r,n]=rD(this.path);r&&typeof n=="string"&&(this.path=n,i=r);}this.win32=!!t.win32||process.platform==="win32",this.win32&&(this.path=w_(this.path.replaceAll(/\\/g,"/")),e=e.replaceAll(/\\/g,"/")),this.absolute=hA(t.absolute||ue__default.default.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});let g=this.statCache.get(this.absolute);g?this[LQ](g):this[Kh]();}warn(e,A,t={}){return VQ(this,e,A,t)}emit(e,...A){return e==="error"&&(this.#A=true),super.emit(e,...A)}[Kh](){RA__default.default.lstat(this.absolute,(e,A)=>{if(e)return this.emit("error",e);this[LQ](A);});}[LQ](e){this.statCache.set(this.absolute,e),this.stat=e,e.isFile()||(e.size=0),this.type=S_(e),this.emit("stat",e),this[kN]();}[kN](){switch(this.type){case "File":return this[MN]();case "Directory":return this[NN]();case "SymbolicLink":return this[Jh]();default:return this.end()}}[OQ](e){return IG(e,this.type==="Directory",this.portable)}[ki](e){return sG(e,this.prefix)}[Ps](){if(!this.stat)throw new Error("cannot write header before stat");this.type==="Directory"&&this.portable&&(this.noMtime=true),this.onWriteEntry?.(this),this.header=new Rr({path:this[ki](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[ki](this.linkpath):this.linkpath,mode:this[OQ](this.stat.mode),uid:this.portable?void 0:this.stat.uid,gid:this.portable?void 0:this.stat.gid,size:this.stat.size,mtime:this.noMtime?void 0:this.mtime||this.stat.mtime,type:this.type==="Unsupported"?void 0:this.type,uname:this.portable?void 0:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?void 0:this.stat.atime,ctime:this.portable?void 0:this.stat.ctime}),this.header.encode()&&!this.noPax&&super.write(new TQ({atime:this.portable?void 0:this.header.atime,ctime:this.portable?void 0:this.header.ctime,gid:this.portable?void 0:this.header.gid,mtime:this.noMtime?void 0:this.mtime||this.header.mtime,path:this[ki](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[ki](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?void 0:this.header.uid,uname:this.portable?void 0:this.header.uname,dev:this.portable?void 0:this.stat.dev,ino:this.portable?void 0:this.stat.ino,nlink:this.portable?void 0:this.stat.nlink}).encode());let e=this.header?.block;if(!e)throw new Error("failed to encode header");super.write(e);}[NN](){if(!this.stat)throw new Error("cannot create directory entry without stat");this.path.slice(-1)!=="/"&&(this.path+="/"),this.stat.size=0,this[Ps](),this.end();}[Jh](){RA__default.default.readlink(this.absolute,(e,A)=>{if(e)return this.emit("error",e);this[Yh](A);});}[Yh](e){this.linkpath=hA(e),this[Ps](),this.end();}[GN](e){if(!this.stat)throw new Error("cannot create link entry without stat");this.type="Link",this.linkpath=hA(ue__default.default.relative(this.cwd,e)),this.stat.size=0,this[Ps](),this.end();}[MN](){if(!this.stat)throw new Error("cannot create file entry without stat");if(this.stat.nlink>1){let e=`${this.stat.dev}:${this.stat.ino}`,A=this.linkCache.get(e);if(A?.indexOf(this.cwd)===0)return this[GN](A);this.linkCache.set(e,this.absolute);}if(this[Ps](),this.stat.size===0)return this.end();this[Th]();}[Th](){RA__default.default.open(this.absolute,"r",(e,A)=>{if(e)return this.emit("error",e);this[Ph](A);});}[Ph](e){if(this.fd=e,this.#A)return this[Gg]();if(!this.stat)throw new Error("should stat before calling onopenfile");this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;let A=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(A),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[bQ]();}[bQ](){let{fd:e,buf:A,offset:t,length:i,pos:g}=this;if(e===void 0||A===void 0)throw new Error("cannot read file without first opening");RA__default.default.read(e,A,t,i,g,(r,n)=>{if(r)return this[Gg](()=>this.emit("error",r));this[Hh](n);});}[Gg](e=()=>{}){this.fd!==void 0&&RA__default.default.close(this.fd,e);}[Hh](e){if(e<=0&&this.remain>0){let t=Object.assign(new Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[Gg](()=>this.emit("error",t))}if(e>this.remain){let t=Object.assign(new Error("did not encounter expected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[Gg](()=>this.emit("error",t))}if(!this.buf)throw new Error("should have created buffer prior to reading");if(e===this.remain)for(let t=e;t<this.length&&e<this.blockRemain;t++)this.buf[t+this.offset]=0,e++,this.remain++;let A=this.offset===0&&e===this.buf.length?this.buf:this.buf.subarray(this.offset,this.offset+e);this.write(A)?this[Fh]():this[Oh](()=>this[Fh]());}[Oh](e){this.once("drain",e);}write(e,A,t){if(typeof A=="function"&&(t=A,A=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof A=="string"?A:"utf8")),this.blockRemain<e.length){let i=Object.assign(new Error("writing more data than expected"),{path:this.absolute});return this.emit("error",i)}return this.remain-=e.length,this.blockRemain-=e.length,this.pos+=e.length,this.offset+=e.length,super.write(e,null,t)}[Fh](){if(!this.remain)return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),this[Gg](e=>e?this.emit("error",e):this.end());if(!this.buf)throw new Error("buffer lost somehow in ONDRAIN");this.offset>=this.length&&(this.buf=Buffer.allocUnsafe(Math.min(this.blockRemain,this.buf.length)),this.offset=0),this.length=this.buf.length-this.offset,this[bQ]();}},F_=class extends CG{sync=true;[Kh](){this[LQ](RA__default.default.lstatSync(this.absolute));}[Jh](){this[Yh](RA__default.default.readlinkSync(this.absolute));}[Th](){this[Ph](RA__default.default.openSync(this.absolute,"r"));}[bQ](){let e=true;try{let{fd:A,buf:t,offset:i,length:g,pos:r}=this;if(A===void 0||t===void 0)throw new Error("fd and buf must be set in READ method");let n=RA__default.default.readSync(A,t,i,g,r);this[Hh](n),e=!1;}finally{if(e)try{this[Gg](()=>{});}catch{}}}[Oh](e){e();}[Gg](e=()=>{}){this.fd!==void 0&&RA__default.default.closeSync(this.fd),e();}},m_=class extends kr{blockLen=0;blockRemain=0;buf=0;pos=0;remain=0;length=0;preservePaths;portable;strict;noPax;noMtime;readEntry;type;prefix;path;mode;uid;gid;uname;gname;header;mtime;atime;ctime;linkpath;size;onWriteEntry;warn(e,A,t={}){return VQ(this,e,A,t)}constructor(e,A={}){let t=tD(A);super(),this.preservePaths=!!t.preservePaths,this.portable=!!t.portable,this.strict=!!t.strict,this.noPax=!!t.noPax,this.noMtime=!!t.noMtime,this.onWriteEntry=t.onWriteEntry,this.readEntry=e;let{type:i}=e;if(i==="Unsupported")throw new Error("writing entry that should be ignored");this.type=i,this.type==="Directory"&&this.portable&&(this.noMtime=true),this.prefix=t.prefix,this.path=hA(e.path),this.mode=e.mode!==void 0?this[OQ](e.mode):void 0,this.uid=this.portable?void 0:e.uid,this.gid=this.portable?void 0:e.gid,this.uname=this.portable?void 0:e.uname,this.gname=this.portable?void 0:e.gname,this.size=e.size,this.mtime=this.noMtime?void 0:t.mtime||e.mtime,this.atime=this.portable?void 0:e.atime,this.ctime=this.portable?void 0:e.ctime,this.linkpath=e.linkpath!==void 0?hA(e.linkpath):void 0,typeof t.onwarn=="function"&&this.on("warn",t.onwarn);let g=false;if(!this.preservePaths){let[n,s]=rD(this.path);n&&typeof s=="string"&&(this.path=s,g=n);}this.remain=e.size,this.blockRemain=e.startBlockSize,this.onWriteEntry?.(this),this.header=new Rr({path:this[ki](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[ki](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?void 0:this.uid,gid:this.portable?void 0:this.gid,size:this.size,mtime:this.noMtime?void 0:this.mtime,type:this.type,uname:this.portable?void 0:this.uname,atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime}),g&&this.warn("TAR_ENTRY_INFO",`stripping ${g} from absolute path`,{entry:this,path:g+this.path}),this.header.encode()&&!this.noPax&&super.write(new TQ({atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime,gid:this.portable?void 0:this.gid,mtime:this.noMtime?void 0:this.mtime,path:this[ki](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[ki](this.linkpath):this.linkpath,size:this.size,uid:this.portable?void 0:this.uid,uname:this.portable?void 0:this.uname,dev:this.portable?void 0:this.readEntry.dev,ino:this.portable?void 0:this.readEntry.ino,nlink:this.portable?void 0:this.readEntry.nlink}).encode());let r=this.header?.block;if(!r)throw new Error("failed to encode header");super.write(r),e.pipe(this);}[ki](e){return sG(e,this.prefix)}[OQ](e){return IG(e,this.type==="Directory",this.portable)}write(e,A,t){typeof A=="function"&&(t=A,A=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof A=="string"?A:"utf8"));let i=e.length;if(i>this.blockRemain)throw new Error("writing more to entry than is appropriate");return this.blockRemain-=i,super.write(e,t)}end(e,A,t){return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),typeof e=="function"&&(t=e,A=void 0,e=void 0),typeof A=="function"&&(t=A,A=void 0),typeof e=="string"&&(e=Buffer.from(e,A??"utf8")),t&&this.once("finish",t),e?super.end(e,t):super.end(t),this}},S_=e=>e.isFile()?"File":e.isDirectory()?"Directory":e.isSymbolicLink()?"SymbolicLink":"Unsupported",R_=class cI{tail;head;length=0;static create(A=[]){return new cI(A)}constructor(A=[]){for(let t of A)this.push(t);}*[Symbol.iterator](){for(let A=this.head;A;A=A.next)yield A.value;}removeNode(A){if(A.list!==this)throw new Error("removing node which does not belong to this list");let t=A.next,i=A.prev;return t&&(t.prev=i),i&&(i.next=t),A===this.head&&(this.head=t),A===this.tail&&(this.tail=i),this.length--,A.next=void 0,A.prev=void 0,A.list=void 0,t}unshiftNode(A){if(A===this.head)return;A.list&&A.list.removeNode(A);let t=this.head;A.list=this,A.next=t,t&&(t.prev=A),this.head=A,this.tail||(this.tail=A),this.length++;}pushNode(A){if(A===this.tail)return;A.list&&A.list.removeNode(A);let t=this.tail;A.list=this,A.prev=t,t&&(t.next=A),this.tail=A,this.head||(this.head=A),this.length++;}push(...A){for(let t=0,i=A.length;t<i;t++)M_(this,A[t]);return this.length}unshift(...A){for(var t=0,i=A.length;t<i;t++)N_(this,A[t]);return this.length}pop(){if(!this.tail)return;let A=this.tail.value,t=this.tail;return this.tail=this.tail.prev,this.tail?this.tail.next=void 0:this.head=void 0,t.list=void 0,this.length--,A}shift(){if(!this.head)return;let A=this.head.value,t=this.head;return this.head=this.head.next,this.head?this.head.prev=void 0:this.tail=void 0,t.list=void 0,this.length--,A}forEach(A,t){t=t||this;for(let i=this.head,g=0;i;g++)A.call(t,i.value,g,this),i=i.next;}forEachReverse(A,t){t=t||this;for(let i=this.tail,g=this.length-1;i;g--)A.call(t,i.value,g,this),i=i.prev;}get(A){let t=0,i=this.head;for(;i&&t<A;t++)i=i.next;if(t===A&&i)return i.value}getReverse(A){let t=0,i=this.tail;for(;i&&t<A;t++)i=i.prev;if(t===A&&i)return i.value}map(A,t){t=t||this;let i=new cI;for(let g=this.head;g;)i.push(A.call(t,g.value,this)),g=g.next;return i}mapReverse(A,t){t=t||this;var i=new cI;for(let g=this.tail;g;)i.push(A.call(t,g.value,this)),g=g.prev;return i}reduce(A,t){let i,g=this.head;if(arguments.length>1)i=t;else if(this.head)g=this.head.next,i=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var r=0;g;r++)i=A(i,g.value,r),g=g.next;return i}reduceReverse(A,t){let i,g=this.tail;if(arguments.length>1)i=t;else if(this.tail)g=this.tail.prev,i=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(let r=this.length-1;g;r--)i=A(i,g.value,r),g=g.prev;return i}toArray(){let A=new Array(this.length);for(let t=0,i=this.head;i;t++)A[t]=i.value,i=i.next;return A}toArrayReverse(){let A=new Array(this.length);for(let t=0,i=this.tail;i;t++)A[t]=i.value,i=i.prev;return A}slice(A=0,t=this.length){t<0&&(t+=this.length),A<0&&(A+=this.length);let i=new cI;if(t<A||t<0)return i;A<0&&(A=0),t>this.length&&(t=this.length);let g=this.head,r=0;for(r=0;g&&r<A;r++)g=g.next;for(;g&&r<t;r++,g=g.next)i.push(g.value);return i}sliceReverse(A=0,t=this.length){t<0&&(t+=this.length),A<0&&(A+=this.length);let i=new cI;if(t<A||t<0)return i;A<0&&(A=0),t>this.length&&(t=this.length);let g=this.length,r=this.tail;for(;r&&g>t;g--)r=r.prev;for(;r&&g>A;g--,r=r.prev)i.push(r.value);return i}splice(A,t=0,...i){A>this.length&&(A=this.length-1),A<0&&(A=this.length+A);let g=this.head;for(let n=0;g&&n<A;n++)g=g.next;let r=[];for(let n=0;g&&n<t;n++)r.push(g.value),g=this.removeNode(g);g?g!==this.tail&&(g=g.prev):g=this.tail;for(let n of i)g=k_(this,g,n);return r}reverse(){let A=this.head,t=this.tail;for(let i=A;i;i=i.prev){let g=i.prev;i.prev=i.next,i.next=g;}return this.head=t,this.tail=A,this}};function k_(e,A,t){let i=A,g=A?A.next:e.head,r=new ID(t,i,g,e);return r.next===void 0&&(e.tail=r),r.prev===void 0&&(e.head=r),e.length++,r}function M_(e,A){e.tail=new ID(A,e.tail,void 0,e),e.head||(e.head=e.tail),e.length++;}function N_(e,A){e.head=new ID(A,void 0,e.head,e),e.tail||(e.tail=e.head),e.length++;}var ID=class{list;next;prev;value;constructor(e,A,t,i){this.list=i,this.value=e,A?(A.next=this,this.prev=A):this.prev=void 0,t?(t.prev=this,this.next=t):this.next=void 0;}},bN=class{path;absolute;entry;stat;readdir;pending=false;pendingLink=false;ignore=false;piped=false;constructor(e,A){this.path=e||"./",this.absolute=A;}},LN=Buffer.alloc(1024),xQ=Symbol("onStat"),Os=Symbol("ended"),Ai=Symbol("queue"),_s=Symbol("pendingLinks"),Rg=Symbol("current"),yr=Symbol("process"),qs=Symbol("processing"),kQ=Symbol("processJob"),ei=Symbol("jobs"),mh=Symbol("jobDone"),vQ=Symbol("addFSEntry"),xN=Symbol("addTarEntry"),_h=Symbol("stat"),qh=Symbol("readdir"),JQ=Symbol("onreaddir"),KQ=Symbol("pipe"),vN=Symbol("entry"),Sh=Symbol("entryOpt"),HQ=Symbol("writeEntryClass"),oG=Symbol("write"),Rh=Symbol("ondrain"),zQ=class extends kr{sync=false;opt;cwd;maxReadSize;preservePaths;strict;noPax;prefix;linkCache;statCache;file;portable;zip;readdirCache;noDirRecurse;follow;noMtime;mtime;filter;jobs;[HQ];onWriteEntry;[Ai];[_s]=new Map;[ei]=0;[qs]=false;[Os]=false;constructor(e={}){if(super(),this.opt=e,this.file=e.file||"",this.cwd=e.cwd||process.cwd(),this.maxReadSize=e.maxReadSize,this.preservePaths=!!e.preservePaths,this.strict=!!e.strict,this.noPax=!!e.noPax,this.prefix=hA(e.prefix||""),this.linkCache=e.linkCache||new Map,this.statCache=e.statCache||new Map,this.readdirCache=e.readdirCache||new Map,this.onWriteEntry=e.onWriteEntry,this[HQ]=CG,typeof e.onwarn=="function"&&this.on("warn",e.onwarn),this.portable=!!e.portable,e.gzip||e.brotli||e.zstd){if((e.gzip?1:0)+(e.brotli?1:0)+(e.zstd?1:0)>1)throw new TypeError("gzip, brotli, zstd are mutually exclusive");if(e.gzip&&(typeof e.gzip!="object"&&(e.gzip={}),this.portable&&(e.gzip.portable=true),this.zip=new xO(e.gzip)),e.brotli&&(typeof e.brotli!="object"&&(e.brotli={}),this.zip=new JO(e.brotli)),e.zstd&&(typeof e.zstd!="object"&&(e.zstd={}),this.zip=new HO(e.zstd)),!this.zip)throw new Error("impossible");let A=this.zip;A.on("data",t=>super.write(t)),A.on("end",()=>super.end()),A.on("drain",()=>this[Rh]()),this.on("resume",()=>A.resume());}else this.on("drain",this[Rh]);this.noDirRecurse=!!e.noDirRecurse,this.follow=!!e.follow,this.noMtime=!!e.noMtime,e.mtime&&(this.mtime=e.mtime),this.filter=typeof e.filter=="function"?e.filter:()=>true,this[Ai]=new R_,this[ei]=0,this.jobs=Number(e.jobs)||4,this[qs]=false,this[Os]=false;}[oG](e){return super.write(e)}add(e){return this.write(e),this}end(e,A,t){return typeof e=="function"&&(t=e,e=void 0),typeof A=="function"&&(t=A,A=void 0),e&&this.add(e),this[Os]=true,this[yr](),t&&t(),this}write(e){if(this[Os])throw new Error("write after end");return typeof e=="string"?this[vQ](e):this[xN](e),this.flowing}[xN](e){let A=hA(ue__default.default.resolve(this.cwd,e.path));if(!this.filter(e.path,e))e.resume();else {let t=new bN(e.path,A);t.entry=new m_(e,this[Sh](t)),t.entry.on("end",()=>this[mh](t)),this[ei]+=1,this[Ai].push(t);}this[yr]();}[vQ](e){let A=hA(ue__default.default.resolve(this.cwd,e));this[Ai].push(new bN(e,A)),this[yr]();}[_h](e){e.pending=true,this[ei]+=1;let A=this.follow?"stat":"lstat";RA__default.default[A](e.absolute,(t,i)=>{e.pending=false,this[ei]-=1,t?this.emit("error",t):this[xQ](e,i);});}[xQ](e,A){if(this.statCache.set(e.absolute,A),e.stat=A,!this.filter(e.path,A))e.ignore=true;else if(A.isFile()&&A.nlink>1&&!this.linkCache.get(`${A.dev}:${A.ino}`)&&!this.sync)if(e===this[Rg])this[kQ](e);else {let t=`${A.dev}:${A.ino}`,i=this[_s].get(t);i?i.push(e):this[_s].set(t,[e]),e.pendingLink=true,e.pending=true;}this[yr]();}[qh](e){e.pending=true,this[ei]+=1,RA__default.default.readdir(e.absolute,(A,t)=>{if(e.pending=false,this[ei]-=1,A)return this.emit("error",A);this[JQ](e,t);});}[JQ](e,A){this.readdirCache.set(e.absolute,A),e.readdir=A,this[yr]();}[yr](){if(!this[qs]){this[qs]=true;for(let e=this[Ai].head;e&&this[ei]<this.jobs;e=e.next)if(this[kQ](e.value),e.value.ignore){let A=e.next;this[Ai].removeNode(e),e.next=A;}this[qs]=false,this[Os]&&this[Ai].length===0&&this[ei]===0&&(this.zip?this.zip.end(LN):(super.write(LN),super.end()));}}get[Rg](){return this[Ai]&&this[Ai].head&&this[Ai].head.value}[mh](e){this[Ai].shift(),this[ei]-=1;let{stat:A}=e;if(A&&A.isFile()&&A.nlink>1){let t=`${A.dev}:${A.ino}`,i=this[_s].get(t);if(i){this[_s].delete(t);for(let g of i)g.pending=false,this[kQ](g);}}this[yr]();}[kQ](e){if(e.pending&&e.pendingLink&&e===this[Rg]&&(e.pending=false,e.pendingLink=false),!e.pending){if(e.entry){e===this[Rg]&&!e.piped&&this[KQ](e);return}if(!e.stat){let A=this.statCache.get(e.absolute);A?this[xQ](e,A):this[_h](e);}if(e.stat&&!e.ignore){if(!this.noDirRecurse&&e.stat.isDirectory()&&!e.readdir){let A=this.readdirCache.get(e.absolute);if(A?this[JQ](e,A):this[qh](e),!e.readdir)return}if(e.entry=this[vN](e),!e.entry){e.ignore=true;return}e===this[Rg]&&!e.piped&&this[KQ](e);}}}[Sh](e){return {onwarn:(A,t,i)=>this.warn(A,t,i),noPax:this.noPax,cwd:this.cwd,absolute:e.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime,prefix:this.prefix,onWriteEntry:this.onWriteEntry}}[vN](e){this[ei]+=1;try{return new this[HQ](e.path,this[Sh](e)).on("end",()=>this[mh](e)).on("error",A=>this.emit("error",A))}catch(A){this.emit("error",A);}}[Rh](){this[Rg]&&this[Rg].entry&&this[Rg].entry.resume();}[KQ](e){e.piped=true,e.readdir&&e.readdir.forEach(i=>{let g=e.path,r=g==="./"?"":g.replace(/\/*$/,"/");this[vQ](r+i);});let A=e.entry,t=this.zip;if(!A)throw new Error("cannot pipe without source");t?A.on("data",i=>{t.write(i)||A.pause();}):A.on("data",i=>{super.write(i)||A.pause();});}pause(){return this.zip&&this.zip.pause(),super.pause()}warn(e,A,t={}){VQ(this,e,A,t);}},sD=class extends zQ{sync=true;constructor(e){super(e),this[HQ]=F_;}pause(){}resume(){}[_h](e){let A=this.follow?"statSync":"lstatSync";this[xQ](e,RA__default.default[A](e.absolute));}[qh](e){this[JQ](e,RA__default.default.readdirSync(e.absolute));}[KQ](e){let A=e.entry,t=this.zip;if(e.readdir&&e.readdir.forEach(i=>{let g=e.path,r=g==="./"?"":g.replace(/\/*$/,"/");this[vQ](r+i);}),!A)throw new Error("Cannot pipe without source");t?A.on("data",i=>{t.write(i);}):A.on("data",i=>{super[oG](i);});}},G_=(e,A)=>{let t=new sD(e),i=new XN(e.file,{mode:e.mode||438});t.pipe(i),BG(t,A);},U_=(e,A)=>{let t=new zQ(e),i=new WQ(e.file,{mode:e.mode||438});t.pipe(i);let g=new Promise((r,n)=>{i.on("error",n),i.on("close",r),t.on("error",n);});return QG(t,A).catch(r=>t.emit("error",r)),g},BG=(e,A)=>{A.forEach(t=>{t.charAt(0)==="@"?ZQ({file:ue__default.default.resolve(e.cwd,t.slice(1)),sync:true,noResume:true,onReadEntry:i=>e.add(i)}):e.add(t);}),e.end();},QG=async(e,A)=>{for(let t of A)t.charAt(0)==="@"?await ZQ({file:ue__default.default.resolve(String(e.cwd),t.slice(1)),noResume:true,onReadEntry:i=>{e.add(i);}}):e.add(t);e.end();},b_=(e,A)=>{let t=new sD(e);return BG(t,A),t},L_=(e,A)=>{let t=new zQ(e);return QG(t,A).catch(i=>t.emit("error",i)),t},$Q=rC(G_,U_,b_,L_,(e,A)=>{if(!A?.length)throw new TypeError("no paths specified to add to archive")}),v_=process.env.__FAKE_PLATFORM__||process.platform,cG=v_==="win32",{O_CREAT:lG,O_NOFOLLOW:JN,O_TRUNC:hG,O_WRONLY:DG}=RA__default.default.constants,fG=Number(process.env.__FAKE_FS_O_FILENAME__)||RA__default.default.constants.UV_FS_O_FILEMAP||0,J_=cG&&!!fG,K_=512*1024,H_=fG|hG|lG|DG,KN=!cG&&typeof JN=="number"?JN|hG|lG|DG:null,dG=KN!==null?()=>KN:J_?e=>e<K_?H_:"w":()=>"w",Wh=(e,A,t)=>{try{return RA__default.default.lchownSync(e,A,t)}catch(i){if(i?.code!=="ENOENT")throw i}},_Q=(e,A,t,i)=>{RA__default.default.lchown(e,A,t,g=>{i(g&&g?.code!=="ENOENT"?g:null);});},Y_=(e,A,t,i,g)=>{if(A.isDirectory())pG(ue__default.default.resolve(e,A.name),t,i,r=>{if(r)return g(r);let n=ue__default.default.resolve(e,A.name);_Q(n,t,i,g);});else {let r=ue__default.default.resolve(e,A.name);_Q(r,t,i,g);}},pG=(e,A,t,i)=>{RA__default.default.readdir(e,{withFileTypes:true},(g,r)=>{if(g){if(g.code==="ENOENT")return i();if(g.code!=="ENOTDIR"&&g.code!=="ENOTSUP")return i(g)}if(g||!r.length)return _Q(e,A,t,i);let n=r.length,s=null,o=a=>{if(!s){if(a)return i(s=a);if(--n===0)return _Q(e,A,t,i)}};for(let a of r)Y_(e,a,A,t,o);});},T_=(e,A,t,i)=>{A.isDirectory()&&wG(ue__default.default.resolve(e,A.name),t,i),Wh(ue__default.default.resolve(e,A.name),t,i);},wG=(e,A,t)=>{let i;try{i=RA__default.default.readdirSync(e,{withFileTypes:!0});}catch(g){let r=g;if(r?.code==="ENOENT")return;if(r?.code==="ENOTDIR"||r?.code==="ENOTSUP")return Wh(e,A,t);throw r}for(let g of i)T_(e,g,A,t);return Wh(e,A,t)},yG=class extends Error{path;code;syscall="chdir";constructor(e,A){super(`${A}: Cannot cd into '${e}'`),this.path=e,this.code=A;}get name(){return "CwdError"}},eE=class extends Error{path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor(e,A){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link"),this.symlink=e,this.path=A;}get name(){return "SymlinkError"}},O_=(e,A)=>{RA__default.default.stat(e,(t,i)=>{(t||!i.isDirectory())&&(t=new yG(e,t?.code||"ENOTDIR")),A(t);});},__=(e,A,t)=>{e=hA(e);let i=A.umask??18,g=A.mode|448,r=(g&i)!==0,n=A.uid,s=A.gid,o=typeof n=="number"&&typeof s=="number"&&(n!==A.processUid||s!==A.processGid),a=A.preserve,B=A.unlink,u=hA(A.cwd),Q=(C,E)=>{C?t(C):E&&o?pG(E,n,s,c=>Q(c)):r?RA__default.default.chmod(e,g,t):t();};if(e===u)return O_(e,Q);if(a)return P___default.default.mkdir(e,{mode:g,recursive:true}).then(C=>Q(null,C??void 0),Q);let I=hA(ue__default.default.relative(u,e)).split("/");jh(u,I,g,B,u,void 0,Q);},jh=(e,A,t,i,g,r,n)=>{if(A.length===0)return n(null,r);let s=A.shift(),o=hA(ue__default.default.resolve(e+"/"+s));RA__default.default.mkdir(o,t,FG(o,A,t,i,g,r,n));},FG=(e,A,t,i,g,r,n)=>s=>{s?RA__default.default.lstat(e,(o,a)=>{if(o)o.path=o.path&&hA(o.path),n(o);else if(a.isDirectory())jh(e,A,t,i,g,r,n);else if(i)RA__default.default.unlink(e,B=>{if(B)return n(B);RA__default.default.mkdir(e,t,FG(e,A,t,i,g,r,n));});else {if(a.isSymbolicLink())return n(new eE(e,e+"/"+A.join("/")));n(s);}}):(r=r||e,jh(e,A,t,i,g,r,n));},q_=e=>{let A=false,t;try{A=RA__default.default.statSync(e).isDirectory();}catch(i){t=i?.code;}finally{if(!A)throw new yG(e,t??"ENOTDIR")}},W_=(e,A)=>{e=hA(e);let t=A.umask??18,i=A.mode|448,g=(i&t)!==0,r=A.uid,n=A.gid,s=typeof r=="number"&&typeof n=="number"&&(r!==A.processUid||n!==A.processGid),o=A.preserve,a=A.unlink,B=hA(A.cwd),u=C=>{C&&s&&wG(C,r,n),g&&RA__default.default.chmodSync(e,i);};if(e===B)return q_(B),u();if(o)return u(RA__default.default.mkdirSync(e,{mode:i,recursive:true})??void 0);let Q=hA(ue__default.default.relative(B,e)).split("/"),I;for(let C=Q.shift(),E=B;C&&(E+="/"+C);C=Q.shift()){E=hA(ue__default.default.resolve(E));try{RA__default.default.mkdirSync(E,i),I=I||E;}catch{let c=RA__default.default.lstatSync(E);if(c.isDirectory())continue;if(a){RA__default.default.unlinkSync(E),RA__default.default.mkdirSync(E,i),I=I||E;continue}else if(c.isSymbolicLink())return new eE(E,E+"/"+Q.join("/"))}}return u(I)},kh=Object.create(null),HN=1e4,oI=new Set,j_=e=>{oI.has(e)?oI.delete(e):kh[e]=e.normalize("NFD").toLocaleLowerCase("en").toLocaleUpperCase("en"),oI.add(e);let A=kh[e],t=oI.size-HN;if(t>HN/10){for(let i of oI)if(oI.delete(i),delete kh[i],--t<=0)break}return A},V_=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,Z_=V_==="win32",X_=e=>e.split("/").slice(0,-1).reduce((A,t)=>{let i=A.at(-1);return i!==void 0&&(t=ue.join(i,t)),A.push(t||"/"),A},[]),z_=class{#A=new Map;#t=new Map;#e=new Set;reserve(e,A){e=Z_?["win32 parallelization disabled"]:e.map(i=>Xs(ue.join(j_(i))));let t=new Set(e.map(i=>X_(i)).reduce((i,g)=>i.concat(g)));this.#t.set(A,{dirs:t,paths:e});for(let i of e){let g=this.#A.get(i);g?g.push(A):this.#A.set(i,[A]);}for(let i of t){let g=this.#A.get(i);if(!g)this.#A.set(i,[new Set([A])]);else {let r=g.at(-1);r instanceof Set?r.add(A):g.push(new Set([A]));}}return this.#r(A)}#n(e){let A=this.#t.get(e);if(!A)throw new Error("function does not have any path reservations");return {paths:A.paths.map(t=>this.#A.get(t)),dirs:[...A.dirs].map(t=>this.#A.get(t))}}check(e){let{paths:A,dirs:t}=this.#n(e);return A.every(i=>i&&i[0]===e)&&t.every(i=>i&&i[0]instanceof Set&&i[0].has(e))}#r(e){return this.#e.has(e)||!this.check(e)?false:(this.#e.add(e),e(()=>this.#i(e)),true)}#i(e){if(!this.#e.has(e))return false;let A=this.#t.get(e);if(!A)throw new Error("invalid reservation");let{paths:t,dirs:i}=A,g=new Set;for(let r of t){let n=this.#A.get(r);if(!n||n?.[0]!==e)continue;let s=n[1];if(!s){this.#A.delete(r);continue}if(n.shift(),typeof s=="function")g.add(s);else for(let o of s)g.add(o);}for(let r of i){let n=this.#A.get(r),s=n?.[0];if(!(!n||!(s instanceof Set)))if(s.size===1&&n.length===1){this.#A.delete(r);continue}else if(s.size===1){n.shift();let o=n[0];typeof o=="function"&&g.add(o);}else s.delete(e);}return this.#e.delete(e),g.forEach(r=>this.#r(r)),true}},$_=()=>process.umask(),YN=Symbol("onEntry"),Vh=Symbol("checkFs"),TN=Symbol("checkFs2"),Zh=Symbol("isReusable"),Ht=Symbol("makeFs"),Xh=Symbol("file"),zh=Symbol("directory"),YQ=Symbol("link"),PN=Symbol("symlink"),ON=Symbol("hardlink"),Vs=Symbol("ensureNoSymlink"),_N=Symbol("unsupported"),qN=Symbol("checkPath"),Mh=Symbol("stripAbsolutePath"),Ug=Symbol("mkdir"),me=Symbol("onError"),MQ=Symbol("pending"),WN=Symbol("pend"),BI=Symbol("unpend"),Nh=Symbol("ended"),Gh=Symbol("maybeClose"),$h=Symbol("skip"),$s=Symbol("doChown"),AC=Symbol("uid"),eC=Symbol("gid"),tC=Symbol("checkedCwd"),Aq=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,iC=Aq==="win32",eq=1024,tq=(e,A)=>{if(!iC)return RA__default.default.unlink(e,A);let t=e+".DELETE."+crypto.randomBytes(16).toString("hex");RA__default.default.rename(e,t,i=>{if(i)return A(i);RA__default.default.unlink(t,A);});},iq=e=>{if(!iC)return RA__default.default.unlinkSync(e);let A=e+".DELETE."+crypto.randomBytes(16).toString("hex");RA__default.default.renameSync(e,A),RA__default.default.unlinkSync(A);},jN=(e,A,t)=>e!==void 0&&e===e>>>0?e:A!==void 0&&A===A>>>0?A:t,CD=class extends gC{[Nh]=false;[tC]=false;[MQ]=0;reservations=new z_;transform;writable=true;readable=false;uid;gid;setOwner;preserveOwner;processGid;processUid;maxDepth;forceChown;win32;newer;keep;noMtime;preservePaths;unlink;cwd;strip;processUmask;umask;dmode;fmode;chmod;constructor(e={}){if(e.ondone=()=>{this[Nh]=true,this[Gh]();},super(e),this.transform=e.transform,this.chmod=!!e.chmod,typeof e.uid=="number"||typeof e.gid=="number"){if(typeof e.uid!="number"||typeof e.gid!="number")throw new TypeError("cannot set owner without number uid and gid");if(e.preserveOwner)throw new TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=e.uid,this.gid=e.gid,this.setOwner=true;}else this.uid=void 0,this.gid=void 0,this.setOwner=false;this.preserveOwner=e.preserveOwner===void 0&&typeof e.uid!="number"?process.getuid?.()===0:!!e.preserveOwner,this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():void 0,this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():void 0,this.maxDepth=typeof e.maxDepth=="number"?e.maxDepth:eq,this.forceChown=e.forceChown===true,this.win32=!!e.win32||iC,this.newer=!!e.newer,this.keep=!!e.keep,this.noMtime=!!e.noMtime,this.preservePaths=!!e.preservePaths,this.unlink=!!e.unlink,this.cwd=hA(ue__default.default.resolve(e.cwd||process.cwd())),this.strip=Number(e.strip)||0,this.processUmask=this.chmod?typeof e.processUmask=="number"?e.processUmask:$_():0,this.umask=typeof e.umask=="number"?e.umask:this.processUmask,this.dmode=e.dmode||511&~this.umask,this.fmode=e.fmode||438&~this.umask,this.on("entry",A=>this[YN](A));}warn(e,A,t={}){return (e==="TAR_BAD_ARCHIVE"||e==="TAR_ABORT")&&(t.recoverable=false),super.warn(e,A,t)}[Gh](){this[Nh]&&this[MQ]===0&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"));}[Mh](e,A){let t=e[A],{type:i}=e;if(!t||this.preservePaths)return true;let[g,r]=rD(t),n=r.replaceAll(/\\/g,"/").split("/");if(n.includes("..")||iC&&/^[a-z]:\.\.$/i.test(n[0]??"")){if(A==="path"||i==="Link")return this.warn("TAR_ENTRY_ERROR",`${A} contains '..'`,{entry:e,[A]:t}),false;let s=ue__default.default.posix.dirname(e.path),o=ue__default.default.posix.normalize(ue__default.default.posix.join(s,n.join("/")));if(o.startsWith("../")||o==="..")return this.warn("TAR_ENTRY_ERROR",`${A} escapes extraction directory`,{entry:e,[A]:t}),false}return g&&(e[A]=String(r),this.warn("TAR_ENTRY_INFO",`stripping ${g} from absolute ${A}`,{entry:e,[A]:t})),true}[qN](e){let A=hA(e.path),t=A.split("/");if(this.strip){if(t.length<this.strip)return false;if(e.type==="Link"){let i=hA(String(e.linkpath)).split("/");if(i.length>=this.strip)e.linkpath=i.slice(this.strip).join("/");else return false}t.splice(0,this.strip),e.path=t.join("/");}if(isFinite(this.maxDepth)&&t.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:e,path:A,depth:t.length,maxDepth:this.maxDepth}),false;if(!this[Mh](e,"path")||!this[Mh](e,"linkpath"))return false;if(e.absolute=ue__default.default.isAbsolute(e.path)?hA(ue__default.default.resolve(e.path)):hA(ue__default.default.resolve(this.cwd,e.path)),!this.preservePaths&&typeof e.absolute=="string"&&e.absolute.indexOf(this.cwd+"/")!==0&&e.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:e,path:hA(e.path),resolvedPath:e.absolute,cwd:this.cwd}),false;if(e.absolute===this.cwd&&e.type!=="Directory"&&e.type!=="GNUDumpDir")return false;if(this.win32){let{root:i}=ue__default.default.win32.parse(String(e.absolute));e.absolute=i+RN(String(e.absolute).slice(i.length));let{root:g}=ue__default.default.win32.parse(e.path);e.path=g+RN(e.path.slice(g.length));}return true}[YN](e){if(!this[qN](e))return e.resume();switch(Lh__default.default.equal(typeof e.absolute,"string"),e.type){case "Directory":case "GNUDumpDir":e.mode&&(e.mode=e.mode|448);case "File":case "OldFile":case "ContiguousFile":case "Link":case "SymbolicLink":return this[Vh](e);default:return this[_N](e)}}[me](e,A){e.name==="CwdError"?this.emit("error",e):(this.warn("TAR_ENTRY_ERROR",e,{entry:A}),this[BI](),A.resume());}[Ug](e,A,t){__(hA(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:A},t);}[$s](e){return this.forceChown||this.preserveOwner&&(typeof e.uid=="number"&&e.uid!==this.processUid||typeof e.gid=="number"&&e.gid!==this.processGid)||typeof this.uid=="number"&&this.uid!==this.processUid||typeof this.gid=="number"&&this.gid!==this.processGid}[AC](e){return jN(this.uid,e.uid,this.processUid)}[eC](e){return jN(this.gid,e.gid,this.processGid)}[Xh](e,A){let t=typeof e.mode=="number"?e.mode&4095:this.fmode,i=new WQ(String(e.absolute),{flags:dG(e.size),mode:t,autoClose:false});i.on("error",s=>{i.fd&&RA__default.default.close(i.fd,()=>{}),i.write=()=>true,this[me](s,e),A();});let g=1,r=s=>{if(s){i.fd&&RA__default.default.close(i.fd,()=>{}),this[me](s,e),A();return}--g===0&&i.fd!==void 0&&RA__default.default.close(i.fd,o=>{o?this[me](o,e):this[BI](),A();});};i.on("finish",()=>{let s=String(e.absolute),o=i.fd;if(typeof o=="number"&&e.mtime&&!this.noMtime){g++;let a=e.atime||new Date,B=e.mtime;RA__default.default.futimes(o,a,B,u=>u?RA__default.default.utimes(s,a,B,Q=>r(Q&&u)):r());}if(typeof o=="number"&&this[$s](e)){g++;let a=this[AC](e),B=this[eC](e);typeof a=="number"&&typeof B=="number"&&RA__default.default.fchown(o,a,B,u=>u?RA__default.default.chown(s,a,B,Q=>r(Q&&u)):r());}r();});let n=this.transform&&this.transform(e)||e;n!==e&&(n.on("error",s=>{this[me](s,e),A();}),e.pipe(n)),n.pipe(i);}[zh](e,A){let t=typeof e.mode=="number"?e.mode&4095:this.dmode;this[Ug](String(e.absolute),t,i=>{if(i){this[me](i,e),A();return}let g=1,r=()=>{--g===0&&(A(),this[BI](),e.resume());};e.mtime&&!this.noMtime&&(g++,RA__default.default.utimes(String(e.absolute),e.atime||new Date,e.mtime,r)),this[$s](e)&&(g++,RA__default.default.chown(String(e.absolute),Number(this[AC](e)),Number(this[eC](e)),r)),r();});}[_N](e){e.unsupported=true,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${e.type}`,{entry:e}),e.resume();}[PN](e,A){let t=hA(ue__default.default.relative(this.cwd,ue__default.default.resolve(ue__default.default.dirname(String(e.absolute)),String(e.linkpath)))).split("/");this[Vs](e,this.cwd,t,()=>this[YQ](e,String(e.linkpath),"symlink",A),i=>{this[me](i,e),A();});}[ON](e,A){let t=hA(ue__default.default.resolve(this.cwd,String(e.linkpath))),i=hA(String(e.linkpath)).split("/");this[Vs](e,this.cwd,i,()=>this[YQ](e,t,"link",A),g=>{this[me](g,e),A();});}[Vs](e,A,t,i,g){let r=t.shift();if(this.preservePaths||r===void 0)return i();let n=ue__default.default.resolve(A,r);RA__default.default.lstat(n,(s,o)=>{if(s)return i();if(o?.isSymbolicLink())return g(new eE(n,ue__default.default.resolve(n,t.join("/"))));this[Vs](e,n,t,i,g);});}[WN](){this[MQ]++;}[BI](){this[MQ]--,this[Gh]();}[$h](e){this[BI](),e.resume();}[Zh](e,A){return e.type==="File"&&!this.unlink&&A.isFile()&&A.nlink<=1&&!iC}[Vh](e){this[WN]();let A=[e.path];e.linkpath&&A.push(e.linkpath),this.reservations.reserve(A,t=>this[TN](e,t));}[TN](e,A){let t=n=>{A(n);},i=()=>{this[Ug](this.cwd,this.dmode,n=>{if(n){this[me](n,e),t();return}this[tC]=true,g();});},g=()=>{if(e.absolute!==this.cwd){let n=hA(ue__default.default.dirname(String(e.absolute)));if(n!==this.cwd)return this[Ug](n,this.dmode,s=>{if(s){this[me](s,e),t();return}r();})}r();},r=()=>{RA__default.default.lstat(String(e.absolute),(n,s)=>{if(s&&(this.keep||this.newer&&s.mtime>(e.mtime??s.mtime))){this[$h](e),t();return}if(n||this[Zh](e,s))return this[Ht](null,e,t);if(s.isDirectory()){if(e.type==="Directory"){let o=this.chmod&&e.mode&&(s.mode&4095)!==e.mode,a=B=>this[Ht](B??null,e,t);return o?RA__default.default.chmod(String(e.absolute),Number(e.mode),a):a()}if(e.absolute!==this.cwd)return RA__default.default.rmdir(String(e.absolute),o=>this[Ht](o??null,e,t))}if(e.absolute===this.cwd)return this[Ht](null,e,t);tq(String(e.absolute),o=>this[Ht](o??null,e,t));});};this[tC]?g():i();}[Ht](e,A,t){if(e){this[me](e,A),t();return}switch(A.type){case "File":case "OldFile":case "ContiguousFile":return this[Xh](A,t);case "Link":return this[ON](A,t);case "SymbolicLink":return this[PN](A,t);case "Directory":case "GNUDumpDir":return this[zh](A,t)}}[YQ](e,A,t,i){RA__default.default[t](A,String(e.absolute),g=>{g?this[me](g,e):(this[BI](),e.resume()),i();});}},Ws=e=>{try{return [null,e()]}catch(A){return [A,null]}},SG=class extends CD{sync=true;[Ht](e,A){return super[Ht](e,A,()=>{})}[Vh](e){if(!this[tC]){let g=this[Ug](this.cwd,this.dmode);if(g)return this[me](g,e);this[tC]=true;}if(e.absolute!==this.cwd){let g=hA(ue__default.default.dirname(String(e.absolute)));if(g!==this.cwd){let r=this[Ug](g,this.dmode);if(r)return this[me](r,e)}}let[A,t]=Ws(()=>RA__default.default.lstatSync(String(e.absolute)));if(t&&(this.keep||this.newer&&t.mtime>(e.mtime??t.mtime)))return this[$h](e);if(A||this[Zh](e,t))return this[Ht](null,e);if(t.isDirectory()){if(e.type==="Directory"){let r=this.chmod&&e.mode&&(t.mode&4095)!==e.mode,[n]=r?Ws(()=>{RA__default.default.chmodSync(String(e.absolute),Number(e.mode));}):[];return this[Ht](n,e)}let[g]=Ws(()=>RA__default.default.rmdirSync(String(e.absolute)));this[Ht](g,e);}let[i]=e.absolute===this.cwd?[]:Ws(()=>iq(String(e.absolute)));this[Ht](i,e);}[Xh](e,A){let t=typeof e.mode=="number"?e.mode&4095:this.fmode,i=n=>{let s;try{RA__default.default.closeSync(g);}catch(o){s=o;}(n||s)&&this[me](n||s,e),A();},g;try{g=RA__default.default.openSync(String(e.absolute),dG(e.size),t);}catch(n){return i(n)}let r=this.transform&&this.transform(e)||e;r!==e&&(r.on("error",n=>this[me](n,e)),e.pipe(r)),r.on("data",n=>{try{RA__default.default.writeSync(g,n,0,n.length);}catch(s){i(s);}}),r.on("end",()=>{let n=null;if(e.mtime&&!this.noMtime){let s=e.atime||new Date,o=e.mtime;try{RA__default.default.futimesSync(g,s,o);}catch(a){try{RA__default.default.utimesSync(String(e.absolute),s,o);}catch{n=a;}}}if(this[$s](e)){let s=this[AC](e),o=this[eC](e);try{RA__default.default.fchownSync(g,Number(s),Number(o));}catch(a){try{RA__default.default.chownSync(String(e.absolute),Number(s),Number(o));}catch{n=n||a;}}}i(n);});}[zh](e,A){let t=typeof e.mode=="number"?e.mode&4095:this.dmode,i=this[Ug](String(e.absolute),t);if(i){this[me](i,e),A();return}if(e.mtime&&!this.noMtime)try{RA__default.default.utimesSync(String(e.absolute),e.atime||new Date,e.mtime);}catch{}if(this[$s](e))try{RA__default.default.chownSync(String(e.absolute),Number(this[AC](e)),Number(this[eC](e)));}catch{}A(),e.resume();}[Ug](e,A){try{return W_(hA(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:A})}catch(t){return t}}[Vs](e,A,t,i,g){if(this.preservePaths||t.length===0)return i();let r=A;for(let n of t){r=ue__default.default.resolve(r,n);let[s,o]=Ws(()=>RA__default.default.lstatSync(r));if(s)return i();if(o.isSymbolicLink())return g(new eE(r,ue__default.default.resolve(A,t.join("/"))))}i();}[YQ](e,A,t,i){let g=`${t}Sync`;try{RA__default.default[g](A,String(e.absolute)),i(),e.resume();}catch(r){return this[me](r,e)}}},gq=e=>{let A=new SG(e),t=e.file,i=RA__default.default.statSync(t),g=e.maxReadSize||16*1024*1024;new dO(t,{readSize:g,size:i.size}).pipe(A);},rq=(e,A)=>{let t=new CD(e),i=e.maxReadSize||16*1024*1024,g=e.file;return new Promise((r,n)=>{t.on("error",n),t.on("close",r),RA__default.default.stat(g,(s,o)=>{if(s)n(s);else {let a=new eD(g,{readSize:i,size:o.size});a.on("error",n),a.pipe(t);}});})},RG=rC(gq,rq,e=>new SG(e),e=>new CD(e),(e,A)=>{A?.length&&nG(e,A);}),nq=(e,A)=>{let t=new sD(e),i=true,g,r;try{try{g=RA__default.default.openSync(e.file,"r+");}catch(o){if(o?.code==="ENOENT")g=RA__default.default.openSync(e.file,"w+");else throw o}let n=RA__default.default.fstatSync(g),s=Buffer.alloc(512);A:for(r=0;r<n.size;r+=512){for(let B=0,u=0;B<512;B+=u){if(u=RA__default.default.readSync(g,s,B,s.length-B,r+B),r===0&&s[0]===31&&s[1]===139)throw new Error("cannot append to compressed archives");if(!u)break A}let o=new Rr(s);if(!o.cksumValid)break;let a=512*Math.ceil((o.size||0)/512);if(r+a+512>n.size)break;r+=a,e.mtimeCache&&o.mtime&&e.mtimeCache.set(String(o.path),o.mtime);}i=!1,Iq(e,t,r,g,A);}finally{if(i)try{RA__default.default.closeSync(g);}catch{}}},Iq=(e,A,t,i,g)=>{let r=new XN(e.file,{fd:i,start:t});A.pipe(r),Cq(A,g);},sq=(e,A)=>{A=Array.from(A);let t=new zQ(e),i=(g,r,n)=>{let s=(Q,I)=>{Q?RA__default.default.close(g,C=>n(Q)):n(null,I);},o=0;if(r===0)return s(null,0);let a=0,B=Buffer.alloc(512),u=(Q,I)=>{if(Q||I===void 0)return s(Q);if(a+=I,a<512&&I)return RA__default.default.read(g,B,a,B.length-a,o+a,u);if(o===0&&B[0]===31&&B[1]===139)return s(new Error("cannot append to compressed archives"));if(a<512)return s(null,o);let C=new Rr(B);if(!C.cksumValid)return s(null,o);let E=512*Math.ceil((C.size??0)/512);if(o+E+512>r||(o+=E+512,o>=r))return s(null,o);e.mtimeCache&&C.mtime&&e.mtimeCache.set(String(C.path),C.mtime),a=0,RA__default.default.read(g,B,0,512,o,u);};RA__default.default.read(g,B,0,512,o,u);};return new Promise((g,r)=>{t.on("error",r);let n="r+",s=(o,a)=>{if(o&&o.code==="ENOENT"&&n==="r+")return n="w+",RA__default.default.open(e.file,n,s);if(o||!a)return r(o);RA__default.default.fstat(a,(B,u)=>{if(B)return RA__default.default.close(a,()=>r(B));i(a,u.size,(Q,I)=>{if(Q)return r(Q);let C=new WQ(e.file,{fd:a,start:I});t.pipe(C),C.on("error",r),C.on("close",g),oq(t,A);});});};RA__default.default.open(e.file,n,s);})},Cq=(e,A)=>{A.forEach(t=>{t.charAt(0)==="@"?ZQ({file:ue__default.default.resolve(e.cwd,t.slice(1)),sync:true,noResume:true,onReadEntry:i=>e.add(i)}):e.add(t);}),e.end();},oq=async(e,A)=>{for(let t of A)t.charAt(0)==="@"?await ZQ({file:ue__default.default.resolve(String(e.cwd),t.slice(1)),noResume:true,onReadEntry:i=>e.add(i)}):e.add(t);e.end();},js=rC(nq,sq,()=>{throw new TypeError("file is required")},()=>{throw new TypeError("file is required")},(e,A)=>{if(!kO(e))throw new TypeError("file is required");if(e.gzip||e.brotli||e.zstd||e.file.endsWith(".br")||e.file.endsWith(".tbr"))throw new TypeError("cannot append to compressed archives");if(!A?.length)throw new TypeError("no paths specified to add/replace")});rC(js.syncFile,js.asyncFile,js.syncNoFile,js.asyncNoFile,(e,A=[])=>{js.validate?.(e,A),Bq(e);});var Bq=e=>{let A=e.filter;e.mtimeCache||(e.mtimeCache=new Map),e.filter=A?(t,i)=>A(t,i)&&!((e.mtimeCache?.get(t)??i.mtime??0)>(i.mtime??0)):(t,i)=>!((e.mtimeCache?.get(t)??i.mtime??0)>(i.mtime??0));};var MG=100;function Eq(e){return `${e.authUrl}/images/`}async function BD(e,A,t){let i=[],g=t?{tags:{some:{name:{eq:t}}}}:{},r=0;for(;;){let n=await Et(e,A,`query ExportAssets($where: _assetWhere, $limit: Int, $offset: Int, $sort: [_assetSort!]) {
209
+ `).reduce(C_,Object.create(null)),C_=(e,A)=>{let t=parseInt(A,10);if(t!==Buffer.byteLength(A)+1)return e;A=A.slice((t+" ").length);let i=A.split("="),g=i.shift();if(!g)return e;let r=g.replace(/^SCHILY\.(dev|ino|nlink)/,"$1"),n=i.join("=").replace(/\0.*/,"");switch(r){case "path":case "linkpath":case "type":case "charset":case "comment":case "gname":case "uname":e[r]=n;break;case "ctime":case "atime":case "mtime":e[r]=new Date(Number(n)*1e3);break;case "size":let s=+n;s>=0&&(e[r]=s);break;case "gid":case "uid":case "dev":case "ino":case "nlink":case "mode":e[r]=+n;break}return e},o_=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,hA=o_!=="win32"?e=>String(e):e=>String(e).replaceAll(/\\/g,"/"),B_=class extends kr{extended;globalExtended;header;startBlockSize;blockRemain;remain;type;meta=false;ignore=false;path;mode;uid;gid;uname;gname;size=0;mtime;atime;ctime;linkpath;dev;ino;nlink;invalid=false;absolute;unsupported=false;constructor(e,A,t){switch(super({}),this.pause(),this.extended=A,this.globalExtended=t,this.header=e,this.remain=e.size??0,this.startBlockSize=512*Math.ceil(this.remain/512),this.blockRemain=this.startBlockSize,this.type=e.type,this.type){case "File":case "OldFile":case "Link":case "SymbolicLink":case "CharacterDevice":case "BlockDevice":case "Directory":case "FIFO":case "ContiguousFile":case "GNUDumpDir":break;case "NextFileHasLongLinkpath":case "NextFileHasLongPath":case "OldGnuLongPath":case "GlobalExtendedHeader":case "ExtendedHeader":case "OldExtendedHeader":this.meta=true;break;default:this.ignore=true;}if(!e.path)throw new Error("no path provided for tar.ReadEntry");this.path=hA(e.path),this.mode=e.mode,this.mode&&(this.mode=this.mode&4095),this.uid=e.uid,this.gid=e.gid,this.uname=e.uname,this.gname=e.gname,this.size=this.remain,this.mtime=e.mtime,this.atime=e.atime,this.ctime=e.ctime,this.linkpath=e.linkpath?hA(e.linkpath):void 0,this.uname=e.uname,this.gname=e.gname,A&&this.#A(A),t&&this.#A(t,true);}write(e){let A=e.length;if(A>this.blockRemain)throw new Error("writing more to entry than is appropriate");let t=this.remain,i=this.blockRemain;return this.remain=Math.max(0,t-A),this.blockRemain=Math.max(0,i-A),this.ignore?true:t>=A?super.write(e):super.write(e.subarray(0,t))}#A(e,A=false){e.path&&(e.path=hA(e.path)),e.linkpath&&(e.linkpath=hA(e.linkpath)),Object.assign(this,Object.fromEntries(Object.entries(e).filter(([t,i])=>!(i==null||t==="path"&&A))));}},VQ=(e,A,t,i={})=>{e.file&&(i.file=e.file),e.cwd&&(i.cwd=e.cwd),i.code=t instanceof Error&&t.code||A,i.tarCode=A,!e.strict&&i.recoverable!==false?(t instanceof Error&&(i=Object.assign(t,i),t=t.message),e.emit("warn",A,t,i)):t instanceof Error?e.emit("error",Object.assign(t,i)):e.emit("error",Object.assign(new Error(`${A}: ${t}`),i));},Q_=1024*1024,xh=Buffer.from([31,139]),vh=Buffer.from([40,181,47,253]),E_=Math.max(xh.length,vh.length),Kt=Symbol("state"),dr=Symbol("writeEntry"),Vi=Symbol("readEntry"),fh=Symbol("nextEntry"),fN=Symbol("processEntry"),mi=Symbol("extendedHeader"),Hs=Symbol("globalExtendedHeader"),mg=Symbol("meta"),dN=Symbol("emitMeta"),OA=Symbol("buffer"),Zi=Symbol("queue"),Sg=Symbol("ended"),dh=Symbol("emittedEnd"),pr=Symbol("emit"),Ae=Symbol("unzip"),wQ=Symbol("consumeChunk"),yQ=Symbol("consumeChunkSub"),ph=Symbol("consumeBody"),pN=Symbol("consumeMeta"),wN=Symbol("consumeHeader"),Ys=Symbol("consuming"),wh=Symbol("bufferConcat"),FQ=Symbol("maybeEnd"),CI=Symbol("writing"),Si=Symbol("aborted"),mQ=Symbol("onDone"),wr=Symbol("sawValidEntry"),SQ=Symbol("sawNullBlock"),RQ=Symbol("sawEOF"),yN=Symbol("closeStream"),a_=1e3,Ts=Symbol("compressedBytesRead"),yh=Symbol("decompressedBytesRead"),FN=Symbol("checkDecompressionRatio"),u_=()=>true,gC=class extends sO.EventEmitter{file;strict;maxMetaEntrySize;filter;brotli;zstd;maxDecompressionRatio;writable=true;readable=false;[Zi]=[];[OA];[Vi];[dr];[Kt]="begin";[mg]="";[mi];[Hs];[Sg]=false;[Ae];[Si]=false;[wr];[SQ]=false;[RQ]=false;[CI]=false;[Ys]=false;[dh]=false;[Ts]=0;[yh]=0;constructor(e={}){super(),this.file=e.file||"",this.on(mQ,()=>{(this[Kt]==="begin"||this[wr]===false)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format");}),e.ondone?this.on(mQ,e.ondone):this.on(mQ,()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end");}),this.strict=!!e.strict,this.maxDecompressionRatio=typeof e.maxDecompressionRatio=="number"?e.maxDecompressionRatio:a_,this.maxMetaEntrySize=e.maxMetaEntrySize||Q_,this.filter=typeof e.filter=="function"?e.filter:u_;let A=e.file&&(e.file.endsWith(".tar.br")||e.file.endsWith(".tbr"));this.brotli=!(e.gzip||e.zstd)&&e.brotli!==void 0?e.brotli:A?void 0:false;let t=e.file&&(e.file.endsWith(".tar.zst")||e.file.endsWith(".tzst"));this.zstd=!(e.gzip||e.brotli)&&e.zstd!==void 0?e.zstd:t?true:void 0,this.on("end",()=>this[yN]()),typeof e.onwarn=="function"&&this.on("warn",e.onwarn),typeof e.onReadEntry=="function"&&this.on("entry",e.onReadEntry);}warn(e,A,t={}){VQ(this,e,A,t);}[wN](e,A){this[wr]===void 0&&(this[wr]=false);let t;try{t=new Rr(e,A,this[mi],this[Hs]);}catch(i){return this.warn("TAR_ENTRY_INVALID",i)}if(t.nullBlock)this[SQ]?(this[RQ]=true,this[Kt]==="begin"&&(this[Kt]="header"),this[pr]("eof")):(this[SQ]=true,this[pr]("nullBlock"));else if(this[SQ]=false,!t.cksumValid)this.warn("TAR_ENTRY_INVALID","checksum failure",{header:t});else if(!t.path)this.warn("TAR_ENTRY_INVALID","path is required",{header:t});else {let i=t.type;if(/^(Symbolic)?Link$/.test(i)&&!t.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:t});else if(!/^(Symbolic)?Link$/.test(i)&&!/^(Global)?ExtendedHeader$/.test(i)&&t.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:t});else {let g=this[dr]=new B_(t,this[mi],this[Hs]);if(!this[wr])if(g.remain){let r=()=>{g.invalid||(this[wr]=true);};g.on("end",r);}else this[wr]=true;g.meta?g.size>this.maxMetaEntrySize?(g.ignore=true,this[pr]("ignoredEntry",g),this[Kt]="ignore",g.resume()):g.size>0&&(this[mg]="",g.on("data",r=>this[mg]+=r),this[Kt]="meta"):(this[mi]=void 0,g.ignore=g.ignore||!this.filter(g.path,g),g.ignore?(this[pr]("ignoredEntry",g),this[Kt]=g.remain?"ignore":"header",g.resume()):(g.remain?this[Kt]="body":(this[Kt]="header",g.end()),this[Vi]?this[Zi].push(g):(this[Zi].push(g),this[fh]())));}}}[yN](){queueMicrotask(()=>this.emit("close"));}[fN](e){let A=true;if(!e)this[Vi]=void 0,A=false;else if(Array.isArray(e)){let[t,...i]=e;this.emit(t,...i);}else this[Vi]=e,this.emit("entry",e),e.emittedEnd||(e.on("end",()=>this[fh]()),A=false);return A}[fh](){do;while(this[fN](this[Zi].shift()));if(this[Zi].length===0){let e=this[Vi];!e||e.flowing||e.size===e.remain?this[CI]||this.emit("drain"):e.once("drain",()=>this.emit("drain"));}}[ph](e,A){let t=this[dr];if(!t)throw new Error("attempt to consume body without entry??");let i=t.blockRemain??0,g=i>=e.length&&A===0?e:e.subarray(A,A+i);return t.write(g),t.blockRemain||(this[Kt]="header",this[dr]=void 0,t.end()),g.length}[pN](e,A){let t=this[dr],i=this[ph](e,A);return !this[dr]&&t&&this[dN](t),i}[pr](e,A,t){this[Zi].length===0&&!this[Vi]?this.emit(e,A,t):this[Zi].push([e,A,t]);}[dN](e){switch(this[pr]("meta",this[mg]),e.type){case "ExtendedHeader":case "OldExtendedHeader":this[mi]=TQ.parse(this[mg],this[mi],false);break;case "GlobalExtendedHeader":this[Hs]=TQ.parse(this[mg],this[Hs],true);break;case "NextFileHasLongPath":case "OldGnuLongPath":{let A=this[mi]??Object.create(null);this[mi]=A,A.path=this[mg].replace(/\0.*/,"");break}case "NextFileHasLongLinkpath":{let A=this[mi]||Object.create(null);this[mi]=A,A.linkpath=this[mg].replace(/\0.*/,"");break}default:throw new Error("unknown meta: "+e.type)}}abort(e){if(!this[Si]){if(this[Ae]){let A=this[Ae];A.write=()=>true,A.end=()=>A,A.emit=()=>false,A.destroy?.();}this[Si]=true,this.emit("abort",e),this.warn("TAR_ABORT",e,{recoverable:false});}}[FN](e){this[yh]+=e.length;let A=this[yh]/this[Ts];return A>this.maxDecompressionRatio?(this.abort(new Error(`max decompression ratio exceeded: ${A.toFixed(2)} > ${this.maxDecompressionRatio}`)),false):true}write(e,A,t){if(typeof A=="function"&&(t=A,A=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof A=="string"?A:"utf8")),this[Si])return t?.(),false;if((this[Ae]===void 0||this.brotli===void 0&&this[Ae]===false)&&e){if(this[OA]&&(e=Buffer.concat([this[OA],e]),this[OA]=void 0),e.length<E_)return this[OA]=e,t?.(),true;for(let n=0;this[Ae]===void 0&&n<xh.length;n++)e[n]!==xh[n]&&(this[Ae]=false);let g=false;if(this[Ae]===false&&this.zstd!==false){g=true;for(let n=0;n<vh.length;n++)if(e[n]!==vh[n]){g=false;break}}let r=this.brotli===void 0&&!g;if(this[Ae]===false&&r)if(e.length<512)if(this[Sg])this.brotli=true;else return this[OA]=e,t?.(),true;else try{new Rr(e.subarray(0,512)),this.brotli=!1;}catch{this.brotli=true;}if(this[Ae]===void 0||this[Ae]===false&&(this.brotli||g)){let n=this[Sg];this[Sg]=false,this[Ae]=this[Ae]===void 0?new vO({}):g?new YO({}):new KO({}),this[Ae].on("data",o=>{this[FN](o)&&this[wQ](o);}),this[Ae].on("error",o=>{this[Si]||this.abort(o);}),this[Ae].on("end",()=>{this[Sg]=true,this[wQ]();}),this[CI]=true,this[Ts]+=e.length;let s=!!this[Ae][n?"end":"write"](e);return this[CI]=false,t?.(),s}}this[CI]=true,this[Ae]?(this[Ts]+=e.length,this[Ae].write(e)):this[wQ](e),this[CI]=false;let i=this[Zi].length>0?false:this[Vi]?this[Vi].flowing:true;return !i&&this[Zi].length===0&&this[Vi]?.once("drain",()=>this.emit("drain")),t?.(),i}[wh](e){e&&!this[Si]&&(this[OA]=this[OA]?Buffer.concat([this[OA],e]):e);}[FQ](){if(this[Sg]&&!this[dh]&&!this[Si]&&!this[Ys]){this[dh]=true;let e=this[dr];if(e?.blockRemain){let A=this[OA]?this[OA].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${e.blockRemain} more bytes, only ${A} available)`,{entry:e}),this[OA]&&e.write(this[OA]),e.end();}this[pr](mQ);}}[wQ](e){if(this[Ys]&&e)this[wh](e);else if(!e&&!this[OA])this[FQ]();else if(e){if(this[Ys]=true,this[OA]){this[wh](e);let A=this[OA];this[OA]=void 0,this[yQ](A);}else this[yQ](e);for(;this[OA]&&this[OA]?.length>=512&&!this[Si]&&!this[RQ];){let A=this[OA];this[OA]=void 0,this[yQ](A);}this[Ys]=false;}(!this[OA]||this[Sg])&&this[FQ]();}[yQ](e){let A=0,t=e.length;for(;A+512<=t&&!this[Si]&&!this[RQ];)switch(this[Kt]){case "begin":case "header":this[wN](e,A),A+=512;break;case "ignore":case "body":A+=this[ph](e,A);break;case "meta":A+=this[pN](e,A);break;default:throw new Error("invalid state: "+this[Kt])}A<t&&(this[OA]=this[OA]?Buffer.concat([e.subarray(A),this[OA]]):e.subarray(A));}end(e,A,t){return typeof e=="function"&&(t=e,A=void 0,e=void 0),typeof A=="function"&&(t=A,A=void 0),typeof e=="string"&&(e=Buffer.from(e,A)),t&&this.once("finish",t),this[Si]||(this[Ae]?(e&&(this[Ts]+=e.length,this[Ae].write(e)),this[Ae].end()):(this[Sg]=true,(this.brotli===void 0||this.zstd===void 0)&&(e=e||Buffer.alloc(0)),e&&this.write(e),this[FQ]())),this}},Xs=e=>{let A=e.length-1,t=-1;for(;A>-1&&e.charAt(A)==="/";)t=A,A--;return t===-1?e:e.slice(0,t)},c_=e=>{let A=e.onReadEntry;e.onReadEntry=A?t=>{A(t),t.resume();}:t=>t.resume();},nG=(e,A)=>{let t=new Map(A.map(n=>[Xs(n),true])),i=e.filter,g=100,r=(n,s="",o=0)=>{if(o>=g)return t.set(n,false),false;let a=s||ue.parse(n).root||".",B;if(n===a)B=false;else {let u=t.get(n);B=u!==void 0?u:r(ue.dirname(n),a,o+1);}return t.set(n,B),B};e.filter=i?(n,s)=>i(n,s)&&r(Xs(n)):n=>r(Xs(n));},l_=e=>{let A=new gC(e),t=e.file,i;try{i=RA__default.default.openSync(t,"r");let g=RA__default.default.fstatSync(i),r=e.maxReadSize||16*1024*1024;if(g.size<r){let n=Buffer.allocUnsafe(g.size),s=RA__default.default.readSync(i,n,0,g.size,0);A.end(s===n.byteLength?n:n.subarray(0,s));}else {let n=0,s=Buffer.allocUnsafe(r);for(;n<g.size;){let o=RA__default.default.readSync(i,s,0,r,n);if(o===0)break;n+=o,A.write(s.subarray(0,o));}A.end();}}finally{if(typeof i=="number")try{RA__default.default.closeSync(i);}catch{}}},h_=(e,A)=>{let t=new gC(e),i=e.maxReadSize||16*1024*1024,g=e.file;return new Promise((r,n)=>{t.on("error",n),t.on("end",r),RA__default.default.stat(g,(s,o)=>{if(s)n(s);else {let a=new eD(g,{readSize:i,size:o.size});a.on("error",n),a.pipe(t);}});})},ZQ=rC(l_,h_,e=>new gC(e),e=>new gC(e),(e,A)=>{A?.length&&nG(e,A),e.noResume||c_(e);}),IG=(e,A,t)=>(e&=4095,t&&(e=(e|384)&-19),A&&(e&256&&(e|=64),e&32&&(e|=8),e&4&&(e|=1)),e),{isAbsolute:f_,parse:SN}=ue.win32,rD=e=>{let A="",t=SN(e);for(;f_(e)||t.root;){let i=e.charAt(0)==="/"&&e.slice(0,4)!=="//?/"?"/":t.root;e=e.slice(i.length),A+=i,t=SN(e);}return [A,e]},XQ=["|","<",">","?",":"],nD=XQ.map(e=>String.fromCodePoint(61440+Number(e.codePointAt(0)))),d_=new Map(XQ.map((e,A)=>[e,nD[A]])),p_=new Map(nD.map((e,A)=>[e,XQ[A]])),RN=e=>XQ.reduce((A,t)=>A.split(t).join(d_.get(t)),e),w_=e=>nD.reduce((A,t)=>A.split(t).join(p_.get(t)),e),sG=(e,A)=>A?(e=hA(e).replace(/^\.(\/|$)/,""),Xs(A)+"/"+e):hA(e),y_=16*1024*1024,kN=Symbol("process"),MN=Symbol("file"),NN=Symbol("directory"),Jh=Symbol("symlink"),GN=Symbol("hardlink"),Ps=Symbol("header"),bQ=Symbol("read"),Kh=Symbol("lstat"),LQ=Symbol("onlstat"),Hh=Symbol("onread"),Yh=Symbol("onreadlink"),Th=Symbol("openfile"),Ph=Symbol("onopenfile"),Gg=Symbol("close"),OQ=Symbol("mode"),Oh=Symbol("awaitDrain"),Fh=Symbol("ondrain"),ki=Symbol("prefix"),CG=class extends kr{path;portable;myuid=process.getuid&&process.getuid()||0;myuser=process.env.USER||"";maxReadSize;linkCache;statCache;preservePaths;cwd;strict;mtime;noPax;noMtime;prefix;fd;blockLen=0;blockRemain=0;buf;pos=0;remain=0;length=0;offset=0;win32;absolute;header;type;linkpath;stat;onWriteEntry;#A=false;constructor(e,A={}){let t=tD(A);super(),this.path=hA(e),this.portable=!!t.portable,this.maxReadSize=t.maxReadSize||y_,this.linkCache=t.linkCache||new Map,this.statCache=t.statCache||new Map,this.preservePaths=!!t.preservePaths,this.cwd=hA(t.cwd||process.cwd()),this.strict=!!t.strict,this.noPax=!!t.noPax,this.noMtime=!!t.noMtime,this.mtime=t.mtime,this.prefix=t.prefix?hA(t.prefix):void 0,this.onWriteEntry=t.onWriteEntry,typeof t.onwarn=="function"&&this.on("warn",t.onwarn);let i=false;if(!this.preservePaths){let[r,n]=rD(this.path);r&&typeof n=="string"&&(this.path=n,i=r);}this.win32=!!t.win32||process.platform==="win32",this.win32&&(this.path=w_(this.path.replaceAll(/\\/g,"/")),e=e.replaceAll(/\\/g,"/")),this.absolute=hA(t.absolute||ue__default.default.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});let g=this.statCache.get(this.absolute);g?this[LQ](g):this[Kh]();}warn(e,A,t={}){return VQ(this,e,A,t)}emit(e,...A){return e==="error"&&(this.#A=true),super.emit(e,...A)}[Kh](){RA__default.default.lstat(this.absolute,(e,A)=>{if(e)return this.emit("error",e);this[LQ](A);});}[LQ](e){this.statCache.set(this.absolute,e),this.stat=e,e.isFile()||(e.size=0),this.type=S_(e),this.emit("stat",e),this[kN]();}[kN](){switch(this.type){case "File":return this[MN]();case "Directory":return this[NN]();case "SymbolicLink":return this[Jh]();default:return this.end()}}[OQ](e){return IG(e,this.type==="Directory",this.portable)}[ki](e){return sG(e,this.prefix)}[Ps](){if(!this.stat)throw new Error("cannot write header before stat");this.type==="Directory"&&this.portable&&(this.noMtime=true),this.onWriteEntry?.(this),this.header=new Rr({path:this[ki](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[ki](this.linkpath):this.linkpath,mode:this[OQ](this.stat.mode),uid:this.portable?void 0:this.stat.uid,gid:this.portable?void 0:this.stat.gid,size:this.stat.size,mtime:this.noMtime?void 0:this.mtime||this.stat.mtime,type:this.type==="Unsupported"?void 0:this.type,uname:this.portable?void 0:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?void 0:this.stat.atime,ctime:this.portable?void 0:this.stat.ctime}),this.header.encode()&&!this.noPax&&super.write(new TQ({atime:this.portable?void 0:this.header.atime,ctime:this.portable?void 0:this.header.ctime,gid:this.portable?void 0:this.header.gid,mtime:this.noMtime?void 0:this.mtime||this.header.mtime,path:this[ki](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[ki](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?void 0:this.header.uid,uname:this.portable?void 0:this.header.uname,dev:this.portable?void 0:this.stat.dev,ino:this.portable?void 0:this.stat.ino,nlink:this.portable?void 0:this.stat.nlink}).encode());let e=this.header?.block;if(!e)throw new Error("failed to encode header");super.write(e);}[NN](){if(!this.stat)throw new Error("cannot create directory entry without stat");this.path.slice(-1)!=="/"&&(this.path+="/"),this.stat.size=0,this[Ps](),this.end();}[Jh](){RA__default.default.readlink(this.absolute,(e,A)=>{if(e)return this.emit("error",e);this[Yh](A);});}[Yh](e){this.linkpath=hA(e),this[Ps](),this.end();}[GN](e){if(!this.stat)throw new Error("cannot create link entry without stat");this.type="Link",this.linkpath=hA(ue__default.default.relative(this.cwd,e)),this.stat.size=0,this[Ps](),this.end();}[MN](){if(!this.stat)throw new Error("cannot create file entry without stat");if(this.stat.nlink>1){let e=`${this.stat.dev}:${this.stat.ino}`,A=this.linkCache.get(e);if(A?.indexOf(this.cwd)===0)return this[GN](A);this.linkCache.set(e,this.absolute);}if(this[Ps](),this.stat.size===0)return this.end();this[Th]();}[Th](){RA__default.default.open(this.absolute,"r",(e,A)=>{if(e)return this.emit("error",e);this[Ph](A);});}[Ph](e){if(this.fd=e,this.#A)return this[Gg]();if(!this.stat)throw new Error("should stat before calling onopenfile");this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;let A=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(A),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[bQ]();}[bQ](){let{fd:e,buf:A,offset:t,length:i,pos:g}=this;if(e===void 0||A===void 0)throw new Error("cannot read file without first opening");RA__default.default.read(e,A,t,i,g,(r,n)=>{if(r)return this[Gg](()=>this.emit("error",r));this[Hh](n);});}[Gg](e=()=>{}){this.fd!==void 0&&RA__default.default.close(this.fd,e);}[Hh](e){if(e<=0&&this.remain>0){let t=Object.assign(new Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[Gg](()=>this.emit("error",t))}if(e>this.remain){let t=Object.assign(new Error("did not encounter expected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[Gg](()=>this.emit("error",t))}if(!this.buf)throw new Error("should have created buffer prior to reading");if(e===this.remain)for(let t=e;t<this.length&&e<this.blockRemain;t++)this.buf[t+this.offset]=0,e++,this.remain++;let A=this.offset===0&&e===this.buf.length?this.buf:this.buf.subarray(this.offset,this.offset+e);this.write(A)?this[Fh]():this[Oh](()=>this[Fh]());}[Oh](e){this.once("drain",e);}write(e,A,t){if(typeof A=="function"&&(t=A,A=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof A=="string"?A:"utf8")),this.blockRemain<e.length){let i=Object.assign(new Error("writing more data than expected"),{path:this.absolute});return this.emit("error",i)}return this.remain-=e.length,this.blockRemain-=e.length,this.pos+=e.length,this.offset+=e.length,super.write(e,null,t)}[Fh](){if(!this.remain)return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),this[Gg](e=>e?this.emit("error",e):this.end());if(!this.buf)throw new Error("buffer lost somehow in ONDRAIN");this.offset>=this.length&&(this.buf=Buffer.allocUnsafe(Math.min(this.blockRemain,this.buf.length)),this.offset=0),this.length=this.buf.length-this.offset,this[bQ]();}},F_=class extends CG{sync=true;[Kh](){this[LQ](RA__default.default.lstatSync(this.absolute));}[Jh](){this[Yh](RA__default.default.readlinkSync(this.absolute));}[Th](){this[Ph](RA__default.default.openSync(this.absolute,"r"));}[bQ](){let e=true;try{let{fd:A,buf:t,offset:i,length:g,pos:r}=this;if(A===void 0||t===void 0)throw new Error("fd and buf must be set in READ method");let n=RA__default.default.readSync(A,t,i,g,r);this[Hh](n),e=!1;}finally{if(e)try{this[Gg](()=>{});}catch{}}}[Oh](e){e();}[Gg](e=()=>{}){this.fd!==void 0&&RA__default.default.closeSync(this.fd),e();}},m_=class extends kr{blockLen=0;blockRemain=0;buf=0;pos=0;remain=0;length=0;preservePaths;portable;strict;noPax;noMtime;readEntry;type;prefix;path;mode;uid;gid;uname;gname;header;mtime;atime;ctime;linkpath;size;onWriteEntry;warn(e,A,t={}){return VQ(this,e,A,t)}constructor(e,A={}){let t=tD(A);super(),this.preservePaths=!!t.preservePaths,this.portable=!!t.portable,this.strict=!!t.strict,this.noPax=!!t.noPax,this.noMtime=!!t.noMtime,this.onWriteEntry=t.onWriteEntry,this.readEntry=e;let{type:i}=e;if(i==="Unsupported")throw new Error("writing entry that should be ignored");this.type=i,this.type==="Directory"&&this.portable&&(this.noMtime=true),this.prefix=t.prefix,this.path=hA(e.path),this.mode=e.mode!==void 0?this[OQ](e.mode):void 0,this.uid=this.portable?void 0:e.uid,this.gid=this.portable?void 0:e.gid,this.uname=this.portable?void 0:e.uname,this.gname=this.portable?void 0:e.gname,this.size=e.size,this.mtime=this.noMtime?void 0:t.mtime||e.mtime,this.atime=this.portable?void 0:e.atime,this.ctime=this.portable?void 0:e.ctime,this.linkpath=e.linkpath!==void 0?hA(e.linkpath):void 0,typeof t.onwarn=="function"&&this.on("warn",t.onwarn);let g=false;if(!this.preservePaths){let[n,s]=rD(this.path);n&&typeof s=="string"&&(this.path=s,g=n);}this.remain=e.size,this.blockRemain=e.startBlockSize,this.onWriteEntry?.(this),this.header=new Rr({path:this[ki](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[ki](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?void 0:this.uid,gid:this.portable?void 0:this.gid,size:this.size,mtime:this.noMtime?void 0:this.mtime,type:this.type,uname:this.portable?void 0:this.uname,atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime}),g&&this.warn("TAR_ENTRY_INFO",`stripping ${g} from absolute path`,{entry:this,path:g+this.path}),this.header.encode()&&!this.noPax&&super.write(new TQ({atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime,gid:this.portable?void 0:this.gid,mtime:this.noMtime?void 0:this.mtime,path:this[ki](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[ki](this.linkpath):this.linkpath,size:this.size,uid:this.portable?void 0:this.uid,uname:this.portable?void 0:this.uname,dev:this.portable?void 0:this.readEntry.dev,ino:this.portable?void 0:this.readEntry.ino,nlink:this.portable?void 0:this.readEntry.nlink}).encode());let r=this.header?.block;if(!r)throw new Error("failed to encode header");super.write(r),e.pipe(this);}[ki](e){return sG(e,this.prefix)}[OQ](e){return IG(e,this.type==="Directory",this.portable)}write(e,A,t){typeof A=="function"&&(t=A,A=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof A=="string"?A:"utf8"));let i=e.length;if(i>this.blockRemain)throw new Error("writing more to entry than is appropriate");return this.blockRemain-=i,super.write(e,t)}end(e,A,t){return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),typeof e=="function"&&(t=e,A=void 0,e=void 0),typeof A=="function"&&(t=A,A=void 0),typeof e=="string"&&(e=Buffer.from(e,A??"utf8")),t&&this.once("finish",t),e?super.end(e,t):super.end(t),this}},S_=e=>e.isFile()?"File":e.isDirectory()?"Directory":e.isSymbolicLink()?"SymbolicLink":"Unsupported",R_=class cI{tail;head;length=0;static create(A=[]){return new cI(A)}constructor(A=[]){for(let t of A)this.push(t);}*[Symbol.iterator](){for(let A=this.head;A;A=A.next)yield A.value;}removeNode(A){if(A.list!==this)throw new Error("removing node which does not belong to this list");let t=A.next,i=A.prev;return t&&(t.prev=i),i&&(i.next=t),A===this.head&&(this.head=t),A===this.tail&&(this.tail=i),this.length--,A.next=void 0,A.prev=void 0,A.list=void 0,t}unshiftNode(A){if(A===this.head)return;A.list&&A.list.removeNode(A);let t=this.head;A.list=this,A.next=t,t&&(t.prev=A),this.head=A,this.tail||(this.tail=A),this.length++;}pushNode(A){if(A===this.tail)return;A.list&&A.list.removeNode(A);let t=this.tail;A.list=this,A.prev=t,t&&(t.next=A),this.tail=A,this.head||(this.head=A),this.length++;}push(...A){for(let t=0,i=A.length;t<i;t++)M_(this,A[t]);return this.length}unshift(...A){for(var t=0,i=A.length;t<i;t++)N_(this,A[t]);return this.length}pop(){if(!this.tail)return;let A=this.tail.value,t=this.tail;return this.tail=this.tail.prev,this.tail?this.tail.next=void 0:this.head=void 0,t.list=void 0,this.length--,A}shift(){if(!this.head)return;let A=this.head.value,t=this.head;return this.head=this.head.next,this.head?this.head.prev=void 0:this.tail=void 0,t.list=void 0,this.length--,A}forEach(A,t){t=t||this;for(let i=this.head,g=0;i;g++)A.call(t,i.value,g,this),i=i.next;}forEachReverse(A,t){t=t||this;for(let i=this.tail,g=this.length-1;i;g--)A.call(t,i.value,g,this),i=i.prev;}get(A){let t=0,i=this.head;for(;i&&t<A;t++)i=i.next;if(t===A&&i)return i.value}getReverse(A){let t=0,i=this.tail;for(;i&&t<A;t++)i=i.prev;if(t===A&&i)return i.value}map(A,t){t=t||this;let i=new cI;for(let g=this.head;g;)i.push(A.call(t,g.value,this)),g=g.next;return i}mapReverse(A,t){t=t||this;var i=new cI;for(let g=this.tail;g;)i.push(A.call(t,g.value,this)),g=g.prev;return i}reduce(A,t){let i,g=this.head;if(arguments.length>1)i=t;else if(this.head)g=this.head.next,i=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var r=0;g;r++)i=A(i,g.value,r),g=g.next;return i}reduceReverse(A,t){let i,g=this.tail;if(arguments.length>1)i=t;else if(this.tail)g=this.tail.prev,i=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(let r=this.length-1;g;r--)i=A(i,g.value,r),g=g.prev;return i}toArray(){let A=new Array(this.length);for(let t=0,i=this.head;i;t++)A[t]=i.value,i=i.next;return A}toArrayReverse(){let A=new Array(this.length);for(let t=0,i=this.tail;i;t++)A[t]=i.value,i=i.prev;return A}slice(A=0,t=this.length){t<0&&(t+=this.length),A<0&&(A+=this.length);let i=new cI;if(t<A||t<0)return i;A<0&&(A=0),t>this.length&&(t=this.length);let g=this.head,r=0;for(r=0;g&&r<A;r++)g=g.next;for(;g&&r<t;r++,g=g.next)i.push(g.value);return i}sliceReverse(A=0,t=this.length){t<0&&(t+=this.length),A<0&&(A+=this.length);let i=new cI;if(t<A||t<0)return i;A<0&&(A=0),t>this.length&&(t=this.length);let g=this.length,r=this.tail;for(;r&&g>t;g--)r=r.prev;for(;r&&g>A;g--,r=r.prev)i.push(r.value);return i}splice(A,t=0,...i){A>this.length&&(A=this.length-1),A<0&&(A=this.length+A);let g=this.head;for(let n=0;g&&n<A;n++)g=g.next;let r=[];for(let n=0;g&&n<t;n++)r.push(g.value),g=this.removeNode(g);g?g!==this.tail&&(g=g.prev):g=this.tail;for(let n of i)g=k_(this,g,n);return r}reverse(){let A=this.head,t=this.tail;for(let i=A;i;i=i.prev){let g=i.prev;i.prev=i.next,i.next=g;}return this.head=t,this.tail=A,this}};function k_(e,A,t){let i=A,g=A?A.next:e.head,r=new ID(t,i,g,e);return r.next===void 0&&(e.tail=r),r.prev===void 0&&(e.head=r),e.length++,r}function M_(e,A){e.tail=new ID(A,e.tail,void 0,e),e.head||(e.head=e.tail),e.length++;}function N_(e,A){e.head=new ID(A,void 0,e.head,e),e.tail||(e.tail=e.head),e.length++;}var ID=class{list;next;prev;value;constructor(e,A,t,i){this.list=i,this.value=e,A?(A.next=this,this.prev=A):this.prev=void 0,t?(t.prev=this,this.next=t):this.next=void 0;}},bN=class{path;absolute;entry;stat;readdir;pending=false;pendingLink=false;ignore=false;piped=false;constructor(e,A){this.path=e||"./",this.absolute=A;}},LN=Buffer.alloc(1024),xQ=Symbol("onStat"),Os=Symbol("ended"),Ai=Symbol("queue"),_s=Symbol("pendingLinks"),Rg=Symbol("current"),yr=Symbol("process"),qs=Symbol("processing"),kQ=Symbol("processJob"),ei=Symbol("jobs"),mh=Symbol("jobDone"),vQ=Symbol("addFSEntry"),xN=Symbol("addTarEntry"),_h=Symbol("stat"),qh=Symbol("readdir"),JQ=Symbol("onreaddir"),KQ=Symbol("pipe"),vN=Symbol("entry"),Sh=Symbol("entryOpt"),HQ=Symbol("writeEntryClass"),oG=Symbol("write"),Rh=Symbol("ondrain"),zQ=class extends kr{sync=false;opt;cwd;maxReadSize;preservePaths;strict;noPax;prefix;linkCache;statCache;file;portable;zip;readdirCache;noDirRecurse;follow;noMtime;mtime;filter;jobs;[HQ];onWriteEntry;[Ai];[_s]=new Map;[ei]=0;[qs]=false;[Os]=false;constructor(e={}){if(super(),this.opt=e,this.file=e.file||"",this.cwd=e.cwd||process.cwd(),this.maxReadSize=e.maxReadSize,this.preservePaths=!!e.preservePaths,this.strict=!!e.strict,this.noPax=!!e.noPax,this.prefix=hA(e.prefix||""),this.linkCache=e.linkCache||new Map,this.statCache=e.statCache||new Map,this.readdirCache=e.readdirCache||new Map,this.onWriteEntry=e.onWriteEntry,this[HQ]=CG,typeof e.onwarn=="function"&&this.on("warn",e.onwarn),this.portable=!!e.portable,e.gzip||e.brotli||e.zstd){if((e.gzip?1:0)+(e.brotli?1:0)+(e.zstd?1:0)>1)throw new TypeError("gzip, brotli, zstd are mutually exclusive");if(e.gzip&&(typeof e.gzip!="object"&&(e.gzip={}),this.portable&&(e.gzip.portable=true),this.zip=new xO(e.gzip)),e.brotli&&(typeof e.brotli!="object"&&(e.brotli={}),this.zip=new JO(e.brotli)),e.zstd&&(typeof e.zstd!="object"&&(e.zstd={}),this.zip=new HO(e.zstd)),!this.zip)throw new Error("impossible");let A=this.zip;A.on("data",t=>super.write(t)),A.on("end",()=>super.end()),A.on("drain",()=>this[Rh]()),this.on("resume",()=>A.resume());}else this.on("drain",this[Rh]);this.noDirRecurse=!!e.noDirRecurse,this.follow=!!e.follow,this.noMtime=!!e.noMtime,e.mtime&&(this.mtime=e.mtime),this.filter=typeof e.filter=="function"?e.filter:()=>true,this[Ai]=new R_,this[ei]=0,this.jobs=Number(e.jobs)||4,this[qs]=false,this[Os]=false;}[oG](e){return super.write(e)}add(e){return this.write(e),this}end(e,A,t){return typeof e=="function"&&(t=e,e=void 0),typeof A=="function"&&(t=A,A=void 0),e&&this.add(e),this[Os]=true,this[yr](),t&&t(),this}write(e){if(this[Os])throw new Error("write after end");return typeof e=="string"?this[vQ](e):this[xN](e),this.flowing}[xN](e){let A=hA(ue__default.default.resolve(this.cwd,e.path));if(!this.filter(e.path,e))e.resume();else {let t=new bN(e.path,A);t.entry=new m_(e,this[Sh](t)),t.entry.on("end",()=>this[mh](t)),this[ei]+=1,this[Ai].push(t);}this[yr]();}[vQ](e){let A=hA(ue__default.default.resolve(this.cwd,e));this[Ai].push(new bN(e,A)),this[yr]();}[_h](e){e.pending=true,this[ei]+=1;let A=this.follow?"stat":"lstat";RA__default.default[A](e.absolute,(t,i)=>{e.pending=false,this[ei]-=1,t?this.emit("error",t):this[xQ](e,i);});}[xQ](e,A){if(this.statCache.set(e.absolute,A),e.stat=A,!this.filter(e.path,A))e.ignore=true;else if(A.isFile()&&A.nlink>1&&!this.linkCache.get(`${A.dev}:${A.ino}`)&&!this.sync)if(e===this[Rg])this[kQ](e);else {let t=`${A.dev}:${A.ino}`,i=this[_s].get(t);i?i.push(e):this[_s].set(t,[e]),e.pendingLink=true,e.pending=true;}this[yr]();}[qh](e){e.pending=true,this[ei]+=1,RA__default.default.readdir(e.absolute,(A,t)=>{if(e.pending=false,this[ei]-=1,A)return this.emit("error",A);this[JQ](e,t);});}[JQ](e,A){this.readdirCache.set(e.absolute,A),e.readdir=A,this[yr]();}[yr](){if(!this[qs]){this[qs]=true;for(let e=this[Ai].head;e&&this[ei]<this.jobs;e=e.next)if(this[kQ](e.value),e.value.ignore){let A=e.next;this[Ai].removeNode(e),e.next=A;}this[qs]=false,this[Os]&&this[Ai].length===0&&this[ei]===0&&(this.zip?this.zip.end(LN):(super.write(LN),super.end()));}}get[Rg](){return this[Ai]&&this[Ai].head&&this[Ai].head.value}[mh](e){this[Ai].shift(),this[ei]-=1;let{stat:A}=e;if(A&&A.isFile()&&A.nlink>1){let t=`${A.dev}:${A.ino}`,i=this[_s].get(t);if(i){this[_s].delete(t);for(let g of i)g.pending=false,this[kQ](g);}}this[yr]();}[kQ](e){if(e.pending&&e.pendingLink&&e===this[Rg]&&(e.pending=false,e.pendingLink=false),!e.pending){if(e.entry){e===this[Rg]&&!e.piped&&this[KQ](e);return}if(!e.stat){let A=this.statCache.get(e.absolute);A?this[xQ](e,A):this[_h](e);}if(e.stat&&!e.ignore){if(!this.noDirRecurse&&e.stat.isDirectory()&&!e.readdir){let A=this.readdirCache.get(e.absolute);if(A?this[JQ](e,A):this[qh](e),!e.readdir)return}if(e.entry=this[vN](e),!e.entry){e.ignore=true;return}e===this[Rg]&&!e.piped&&this[KQ](e);}}}[Sh](e){return {onwarn:(A,t,i)=>this.warn(A,t,i),noPax:this.noPax,cwd:this.cwd,absolute:e.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime,prefix:this.prefix,onWriteEntry:this.onWriteEntry}}[vN](e){this[ei]+=1;try{return new this[HQ](e.path,this[Sh](e)).on("end",()=>this[mh](e)).on("error",A=>this.emit("error",A))}catch(A){this.emit("error",A);}}[Rh](){this[Rg]&&this[Rg].entry&&this[Rg].entry.resume();}[KQ](e){e.piped=true,e.readdir&&e.readdir.forEach(i=>{let g=e.path,r=g==="./"?"":g.replace(/\/*$/,"/");this[vQ](r+i);});let A=e.entry,t=this.zip;if(!A)throw new Error("cannot pipe without source");t?A.on("data",i=>{t.write(i)||A.pause();}):A.on("data",i=>{super.write(i)||A.pause();});}pause(){return this.zip&&this.zip.pause(),super.pause()}warn(e,A,t={}){VQ(this,e,A,t);}},sD=class extends zQ{sync=true;constructor(e){super(e),this[HQ]=F_;}pause(){}resume(){}[_h](e){let A=this.follow?"statSync":"lstatSync";this[xQ](e,RA__default.default[A](e.absolute));}[qh](e){this[JQ](e,RA__default.default.readdirSync(e.absolute));}[KQ](e){let A=e.entry,t=this.zip;if(e.readdir&&e.readdir.forEach(i=>{let g=e.path,r=g==="./"?"":g.replace(/\/*$/,"/");this[vQ](r+i);}),!A)throw new Error("Cannot pipe without source");t?A.on("data",i=>{t.write(i);}):A.on("data",i=>{super[oG](i);});}},G_=(e,A)=>{let t=new sD(e),i=new XN(e.file,{mode:e.mode||438});t.pipe(i),BG(t,A);},U_=(e,A)=>{let t=new zQ(e),i=new WQ(e.file,{mode:e.mode||438});t.pipe(i);let g=new Promise((r,n)=>{i.on("error",n),i.on("close",r),t.on("error",n);});return QG(t,A).catch(r=>t.emit("error",r)),g},BG=(e,A)=>{A.forEach(t=>{t.charAt(0)==="@"?ZQ({file:ue__default.default.resolve(e.cwd,t.slice(1)),sync:true,noResume:true,onReadEntry:i=>e.add(i)}):e.add(t);}),e.end();},QG=async(e,A)=>{for(let t of A)t.charAt(0)==="@"?await ZQ({file:ue__default.default.resolve(String(e.cwd),t.slice(1)),noResume:true,onReadEntry:i=>{e.add(i);}}):e.add(t);e.end();},b_=(e,A)=>{let t=new sD(e);return BG(t,A),t},L_=(e,A)=>{let t=new zQ(e);return QG(t,A).catch(i=>t.emit("error",i)),t},$Q=rC(G_,U_,b_,L_,(e,A)=>{if(!A?.length)throw new TypeError("no paths specified to add to archive")}),v_=process.env.__FAKE_PLATFORM__||process.platform,cG=v_==="win32",{O_CREAT:lG,O_NOFOLLOW:JN,O_TRUNC:hG,O_WRONLY:DG}=RA__default.default.constants,fG=Number(process.env.__FAKE_FS_O_FILENAME__)||RA__default.default.constants.UV_FS_O_FILEMAP||0,J_=cG&&!!fG,K_=512*1024,H_=fG|hG|lG|DG,KN=!cG&&typeof JN=="number"?JN|hG|lG|DG:null,dG=KN!==null?()=>KN:J_?e=>e<K_?H_:"w":()=>"w",Wh=(e,A,t)=>{try{return RA__default.default.lchownSync(e,A,t)}catch(i){if(i?.code!=="ENOENT")throw i}},_Q=(e,A,t,i)=>{RA__default.default.lchown(e,A,t,g=>{i(g&&g?.code!=="ENOENT"?g:null);});},Y_=(e,A,t,i,g)=>{if(A.isDirectory())pG(ue__default.default.resolve(e,A.name),t,i,r=>{if(r)return g(r);let n=ue__default.default.resolve(e,A.name);_Q(n,t,i,g);});else {let r=ue__default.default.resolve(e,A.name);_Q(r,t,i,g);}},pG=(e,A,t,i)=>{RA__default.default.readdir(e,{withFileTypes:true},(g,r)=>{if(g){if(g.code==="ENOENT")return i();if(g.code!=="ENOTDIR"&&g.code!=="ENOTSUP")return i(g)}if(g||!r.length)return _Q(e,A,t,i);let n=r.length,s=null,o=a=>{if(!s){if(a)return i(s=a);if(--n===0)return _Q(e,A,t,i)}};for(let a of r)Y_(e,a,A,t,o);});},T_=(e,A,t,i)=>{A.isDirectory()&&wG(ue__default.default.resolve(e,A.name),t,i),Wh(ue__default.default.resolve(e,A.name),t,i);},wG=(e,A,t)=>{let i;try{i=RA__default.default.readdirSync(e,{withFileTypes:!0});}catch(g){let r=g;if(r?.code==="ENOENT")return;if(r?.code==="ENOTDIR"||r?.code==="ENOTSUP")return Wh(e,A,t);throw r}for(let g of i)T_(e,g,A,t);return Wh(e,A,t)},yG=class extends Error{path;code;syscall="chdir";constructor(e,A){super(`${A}: Cannot cd into '${e}'`),this.path=e,this.code=A;}get name(){return "CwdError"}},eE=class extends Error{path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor(e,A){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link"),this.symlink=e,this.path=A;}get name(){return "SymlinkError"}},O_=(e,A)=>{RA__default.default.stat(e,(t,i)=>{(t||!i.isDirectory())&&(t=new yG(e,t?.code||"ENOTDIR")),A(t);});},__=(e,A,t)=>{e=hA(e);let i=A.umask??18,g=A.mode|448,r=(g&i)!==0,n=A.uid,s=A.gid,o=typeof n=="number"&&typeof s=="number"&&(n!==A.processUid||s!==A.processGid),a=A.preserve,B=A.unlink,u=hA(A.cwd),Q=(C,E)=>{C?t(C):E&&o?pG(E,n,s,c=>Q(c)):r?RA__default.default.chmod(e,g,t):t();};if(e===u)return O_(e,Q);if(a)return P___default.default.mkdir(e,{mode:g,recursive:true}).then(C=>Q(null,C??void 0),Q);let I=hA(ue__default.default.relative(u,e)).split("/");jh(u,I,g,B,u,void 0,Q);},jh=(e,A,t,i,g,r,n)=>{if(A.length===0)return n(null,r);let s=A.shift(),o=hA(ue__default.default.resolve(e+"/"+s));RA__default.default.mkdir(o,t,FG(o,A,t,i,g,r,n));},FG=(e,A,t,i,g,r,n)=>s=>{s?RA__default.default.lstat(e,(o,a)=>{if(o)o.path=o.path&&hA(o.path),n(o);else if(a.isDirectory())jh(e,A,t,i,g,r,n);else if(i)RA__default.default.unlink(e,B=>{if(B)return n(B);RA__default.default.mkdir(e,t,FG(e,A,t,i,g,r,n));});else {if(a.isSymbolicLink())return n(new eE(e,e+"/"+A.join("/")));n(s);}}):(r=r||e,jh(e,A,t,i,g,r,n));},q_=e=>{let A=false,t;try{A=RA__default.default.statSync(e).isDirectory();}catch(i){t=i?.code;}finally{if(!A)throw new yG(e,t??"ENOTDIR")}},W_=(e,A)=>{e=hA(e);let t=A.umask??18,i=A.mode|448,g=(i&t)!==0,r=A.uid,n=A.gid,s=typeof r=="number"&&typeof n=="number"&&(r!==A.processUid||n!==A.processGid),o=A.preserve,a=A.unlink,B=hA(A.cwd),u=C=>{C&&s&&wG(C,r,n),g&&RA__default.default.chmodSync(e,i);};if(e===B)return q_(B),u();if(o)return u(RA__default.default.mkdirSync(e,{mode:i,recursive:true})??void 0);let Q=hA(ue__default.default.relative(B,e)).split("/"),I;for(let C=Q.shift(),E=B;C&&(E+="/"+C);C=Q.shift()){E=hA(ue__default.default.resolve(E));try{RA__default.default.mkdirSync(E,i),I=I||E;}catch{let c=RA__default.default.lstatSync(E);if(c.isDirectory())continue;if(a){RA__default.default.unlinkSync(E),RA__default.default.mkdirSync(E,i),I=I||E;continue}else if(c.isSymbolicLink())return new eE(E,E+"/"+Q.join("/"))}}return u(I)},kh=Object.create(null),HN=1e4,oI=new Set,j_=e=>{oI.has(e)?oI.delete(e):kh[e]=e.normalize("NFD").toLocaleLowerCase("en").toLocaleUpperCase("en"),oI.add(e);let A=kh[e],t=oI.size-HN;if(t>HN/10){for(let i of oI)if(oI.delete(i),delete kh[i],--t<=0)break}return A},V_=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,Z_=V_==="win32",X_=e=>e.split("/").slice(0,-1).reduce((A,t)=>{let i=A.at(-1);return i!==void 0&&(t=ue.join(i,t)),A.push(t||"/"),A},[]),z_=class{#A=new Map;#t=new Map;#e=new Set;reserve(e,A){e=Z_?["win32 parallelization disabled"]:e.map(i=>Xs(ue.join(j_(i))));let t=new Set(e.map(i=>X_(i)).reduce((i,g)=>i.concat(g)));this.#t.set(A,{dirs:t,paths:e});for(let i of e){let g=this.#A.get(i);g?g.push(A):this.#A.set(i,[A]);}for(let i of t){let g=this.#A.get(i);if(!g)this.#A.set(i,[new Set([A])]);else {let r=g.at(-1);r instanceof Set?r.add(A):g.push(new Set([A]));}}return this.#r(A)}#n(e){let A=this.#t.get(e);if(!A)throw new Error("function does not have any path reservations");return {paths:A.paths.map(t=>this.#A.get(t)),dirs:[...A.dirs].map(t=>this.#A.get(t))}}check(e){let{paths:A,dirs:t}=this.#n(e);return A.every(i=>i&&i[0]===e)&&t.every(i=>i&&i[0]instanceof Set&&i[0].has(e))}#r(e){return this.#e.has(e)||!this.check(e)?false:(this.#e.add(e),e(()=>this.#i(e)),true)}#i(e){if(!this.#e.has(e))return false;let A=this.#t.get(e);if(!A)throw new Error("invalid reservation");let{paths:t,dirs:i}=A,g=new Set;for(let r of t){let n=this.#A.get(r);if(!n||n?.[0]!==e)continue;let s=n[1];if(!s){this.#A.delete(r);continue}if(n.shift(),typeof s=="function")g.add(s);else for(let o of s)g.add(o);}for(let r of i){let n=this.#A.get(r),s=n?.[0];if(!(!n||!(s instanceof Set)))if(s.size===1&&n.length===1){this.#A.delete(r);continue}else if(s.size===1){n.shift();let o=n[0];typeof o=="function"&&g.add(o);}else s.delete(e);}return this.#e.delete(e),g.forEach(r=>this.#r(r)),true}},$_=()=>process.umask(),YN=Symbol("onEntry"),Vh=Symbol("checkFs"),TN=Symbol("checkFs2"),Zh=Symbol("isReusable"),Ht=Symbol("makeFs"),Xh=Symbol("file"),zh=Symbol("directory"),YQ=Symbol("link"),PN=Symbol("symlink"),ON=Symbol("hardlink"),Vs=Symbol("ensureNoSymlink"),_N=Symbol("unsupported"),qN=Symbol("checkPath"),Mh=Symbol("stripAbsolutePath"),Ug=Symbol("mkdir"),me=Symbol("onError"),MQ=Symbol("pending"),WN=Symbol("pend"),BI=Symbol("unpend"),Nh=Symbol("ended"),Gh=Symbol("maybeClose"),$h=Symbol("skip"),$s=Symbol("doChown"),AC=Symbol("uid"),eC=Symbol("gid"),tC=Symbol("checkedCwd"),Aq=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,iC=Aq==="win32",eq=1024,tq=(e,A)=>{if(!iC)return RA__default.default.unlink(e,A);let t=e+".DELETE."+crypto.randomBytes(16).toString("hex");RA__default.default.rename(e,t,i=>{if(i)return A(i);RA__default.default.unlink(t,A);});},iq=e=>{if(!iC)return RA__default.default.unlinkSync(e);let A=e+".DELETE."+crypto.randomBytes(16).toString("hex");RA__default.default.renameSync(e,A),RA__default.default.unlinkSync(A);},jN=(e,A,t)=>e!==void 0&&e===e>>>0?e:A!==void 0&&A===A>>>0?A:t,CD=class extends gC{[Nh]=false;[tC]=false;[MQ]=0;reservations=new z_;transform;writable=true;readable=false;uid;gid;setOwner;preserveOwner;processGid;processUid;maxDepth;forceChown;win32;newer;keep;noMtime;preservePaths;unlink;cwd;strip;processUmask;umask;dmode;fmode;chmod;constructor(e={}){if(e.ondone=()=>{this[Nh]=true,this[Gh]();},super(e),this.transform=e.transform,this.chmod=!!e.chmod,typeof e.uid=="number"||typeof e.gid=="number"){if(typeof e.uid!="number"||typeof e.gid!="number")throw new TypeError("cannot set owner without number uid and gid");if(e.preserveOwner)throw new TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=e.uid,this.gid=e.gid,this.setOwner=true;}else this.uid=void 0,this.gid=void 0,this.setOwner=false;this.preserveOwner=e.preserveOwner===void 0&&typeof e.uid!="number"?process.getuid?.()===0:!!e.preserveOwner,this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():void 0,this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():void 0,this.maxDepth=typeof e.maxDepth=="number"?e.maxDepth:eq,this.forceChown=e.forceChown===true,this.win32=!!e.win32||iC,this.newer=!!e.newer,this.keep=!!e.keep,this.noMtime=!!e.noMtime,this.preservePaths=!!e.preservePaths,this.unlink=!!e.unlink,this.cwd=hA(ue__default.default.resolve(e.cwd||process.cwd())),this.strip=Number(e.strip)||0,this.processUmask=this.chmod?typeof e.processUmask=="number"?e.processUmask:$_():0,this.umask=typeof e.umask=="number"?e.umask:this.processUmask,this.dmode=e.dmode||511&~this.umask,this.fmode=e.fmode||438&~this.umask,this.on("entry",A=>this[YN](A));}warn(e,A,t={}){return (e==="TAR_BAD_ARCHIVE"||e==="TAR_ABORT")&&(t.recoverable=false),super.warn(e,A,t)}[Gh](){this[Nh]&&this[MQ]===0&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"));}[Mh](e,A){let t=e[A],{type:i}=e;if(!t||this.preservePaths)return true;let[g,r]=rD(t),n=r.replaceAll(/\\/g,"/").split("/");if(n.includes("..")||iC&&/^[a-z]:\.\.$/i.test(n[0]??"")){if(A==="path"||i==="Link")return this.warn("TAR_ENTRY_ERROR",`${A} contains '..'`,{entry:e,[A]:t}),false;let s=ue__default.default.posix.dirname(e.path),o=ue__default.default.posix.normalize(ue__default.default.posix.join(s,n.join("/")));if(o.startsWith("../")||o==="..")return this.warn("TAR_ENTRY_ERROR",`${A} escapes extraction directory`,{entry:e,[A]:t}),false}return g&&(e[A]=String(r),this.warn("TAR_ENTRY_INFO",`stripping ${g} from absolute ${A}`,{entry:e,[A]:t})),true}[qN](e){let A=hA(e.path),t=A.split("/");if(this.strip){if(t.length<this.strip)return false;if(e.type==="Link"){let i=hA(String(e.linkpath)).split("/");if(i.length>=this.strip)e.linkpath=i.slice(this.strip).join("/");else return false}t.splice(0,this.strip),e.path=t.join("/");}if(isFinite(this.maxDepth)&&t.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:e,path:A,depth:t.length,maxDepth:this.maxDepth}),false;if(!this[Mh](e,"path")||!this[Mh](e,"linkpath"))return false;if(e.absolute=ue__default.default.isAbsolute(e.path)?hA(ue__default.default.resolve(e.path)):hA(ue__default.default.resolve(this.cwd,e.path)),!this.preservePaths&&typeof e.absolute=="string"&&e.absolute.indexOf(this.cwd+"/")!==0&&e.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:e,path:hA(e.path),resolvedPath:e.absolute,cwd:this.cwd}),false;if(e.absolute===this.cwd&&e.type!=="Directory"&&e.type!=="GNUDumpDir")return false;if(this.win32){let{root:i}=ue__default.default.win32.parse(String(e.absolute));e.absolute=i+RN(String(e.absolute).slice(i.length));let{root:g}=ue__default.default.win32.parse(e.path);e.path=g+RN(e.path.slice(g.length));}return true}[YN](e){if(!this[qN](e))return e.resume();switch(Lh__default.default.equal(typeof e.absolute,"string"),e.type){case "Directory":case "GNUDumpDir":e.mode&&(e.mode=e.mode|448);case "File":case "OldFile":case "ContiguousFile":case "Link":case "SymbolicLink":return this[Vh](e);default:return this[_N](e)}}[me](e,A){e.name==="CwdError"?this.emit("error",e):(this.warn("TAR_ENTRY_ERROR",e,{entry:A}),this[BI](),A.resume());}[Ug](e,A,t){__(hA(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:A},t);}[$s](e){return this.forceChown||this.preserveOwner&&(typeof e.uid=="number"&&e.uid!==this.processUid||typeof e.gid=="number"&&e.gid!==this.processGid)||typeof this.uid=="number"&&this.uid!==this.processUid||typeof this.gid=="number"&&this.gid!==this.processGid}[AC](e){return jN(this.uid,e.uid,this.processUid)}[eC](e){return jN(this.gid,e.gid,this.processGid)}[Xh](e,A){let t=typeof e.mode=="number"?e.mode&4095:this.fmode,i=new WQ(String(e.absolute),{flags:dG(e.size),mode:t,autoClose:false});i.on("error",s=>{i.fd&&RA__default.default.close(i.fd,()=>{}),i.write=()=>true,this[me](s,e),A();});let g=1,r=s=>{if(s){i.fd&&RA__default.default.close(i.fd,()=>{}),this[me](s,e),A();return}--g===0&&i.fd!==void 0&&RA__default.default.close(i.fd,o=>{o?this[me](o,e):this[BI](),A();});};i.on("finish",()=>{let s=String(e.absolute),o=i.fd;if(typeof o=="number"&&e.mtime&&!this.noMtime){g++;let a=e.atime||new Date,B=e.mtime;RA__default.default.futimes(o,a,B,u=>u?RA__default.default.utimes(s,a,B,Q=>r(Q&&u)):r());}if(typeof o=="number"&&this[$s](e)){g++;let a=this[AC](e),B=this[eC](e);typeof a=="number"&&typeof B=="number"&&RA__default.default.fchown(o,a,B,u=>u?RA__default.default.chown(s,a,B,Q=>r(Q&&u)):r());}r();});let n=this.transform&&this.transform(e)||e;n!==e&&(n.on("error",s=>{this[me](s,e),A();}),e.pipe(n)),n.pipe(i);}[zh](e,A){let t=typeof e.mode=="number"?e.mode&4095:this.dmode;this[Ug](String(e.absolute),t,i=>{if(i){this[me](i,e),A();return}let g=1,r=()=>{--g===0&&(A(),this[BI](),e.resume());};e.mtime&&!this.noMtime&&(g++,RA__default.default.utimes(String(e.absolute),e.atime||new Date,e.mtime,r)),this[$s](e)&&(g++,RA__default.default.chown(String(e.absolute),Number(this[AC](e)),Number(this[eC](e)),r)),r();});}[_N](e){e.unsupported=true,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${e.type}`,{entry:e}),e.resume();}[PN](e,A){let t=hA(ue__default.default.relative(this.cwd,ue__default.default.resolve(ue__default.default.dirname(String(e.absolute)),String(e.linkpath)))).split("/");this[Vs](e,this.cwd,t,()=>this[YQ](e,String(e.linkpath),"symlink",A),i=>{this[me](i,e),A();});}[ON](e,A){let t=hA(ue__default.default.resolve(this.cwd,String(e.linkpath))),i=hA(String(e.linkpath)).split("/");this[Vs](e,this.cwd,i,()=>this[YQ](e,t,"link",A),g=>{this[me](g,e),A();});}[Vs](e,A,t,i,g){let r=t.shift();if(this.preservePaths||r===void 0)return i();let n=ue__default.default.resolve(A,r);RA__default.default.lstat(n,(s,o)=>{if(s)return i();if(o?.isSymbolicLink())return g(new eE(n,ue__default.default.resolve(n,t.join("/"))));this[Vs](e,n,t,i,g);});}[WN](){this[MQ]++;}[BI](){this[MQ]--,this[Gh]();}[$h](e){this[BI](),e.resume();}[Zh](e,A){return e.type==="File"&&!this.unlink&&A.isFile()&&A.nlink<=1&&!iC}[Vh](e){this[WN]();let A=[e.path];e.linkpath&&A.push(e.linkpath),this.reservations.reserve(A,t=>this[TN](e,t));}[TN](e,A){let t=n=>{A(n);},i=()=>{this[Ug](this.cwd,this.dmode,n=>{if(n){this[me](n,e),t();return}this[tC]=true,g();});},g=()=>{if(e.absolute!==this.cwd){let n=hA(ue__default.default.dirname(String(e.absolute)));if(n!==this.cwd)return this[Ug](n,this.dmode,s=>{if(s){this[me](s,e),t();return}r();})}r();},r=()=>{RA__default.default.lstat(String(e.absolute),(n,s)=>{if(s&&(this.keep||this.newer&&s.mtime>(e.mtime??s.mtime))){this[$h](e),t();return}if(n||this[Zh](e,s))return this[Ht](null,e,t);if(s.isDirectory()){if(e.type==="Directory"){let o=this.chmod&&e.mode&&(s.mode&4095)!==e.mode,a=B=>this[Ht](B??null,e,t);return o?RA__default.default.chmod(String(e.absolute),Number(e.mode),a):a()}if(e.absolute!==this.cwd)return RA__default.default.rmdir(String(e.absolute),o=>this[Ht](o??null,e,t))}if(e.absolute===this.cwd)return this[Ht](null,e,t);tq(String(e.absolute),o=>this[Ht](o??null,e,t));});};this[tC]?g():i();}[Ht](e,A,t){if(e){this[me](e,A),t();return}switch(A.type){case "File":case "OldFile":case "ContiguousFile":return this[Xh](A,t);case "Link":return this[ON](A,t);case "SymbolicLink":return this[PN](A,t);case "Directory":case "GNUDumpDir":return this[zh](A,t)}}[YQ](e,A,t,i){RA__default.default[t](A,String(e.absolute),g=>{g?this[me](g,e):(this[BI](),e.resume()),i();});}},Ws=e=>{try{return [null,e()]}catch(A){return [A,null]}},SG=class extends CD{sync=true;[Ht](e,A){return super[Ht](e,A,()=>{})}[Vh](e){if(!this[tC]){let g=this[Ug](this.cwd,this.dmode);if(g)return this[me](g,e);this[tC]=true;}if(e.absolute!==this.cwd){let g=hA(ue__default.default.dirname(String(e.absolute)));if(g!==this.cwd){let r=this[Ug](g,this.dmode);if(r)return this[me](r,e)}}let[A,t]=Ws(()=>RA__default.default.lstatSync(String(e.absolute)));if(t&&(this.keep||this.newer&&t.mtime>(e.mtime??t.mtime)))return this[$h](e);if(A||this[Zh](e,t))return this[Ht](null,e);if(t.isDirectory()){if(e.type==="Directory"){let r=this.chmod&&e.mode&&(t.mode&4095)!==e.mode,[n]=r?Ws(()=>{RA__default.default.chmodSync(String(e.absolute),Number(e.mode));}):[];return this[Ht](n,e)}let[g]=Ws(()=>RA__default.default.rmdirSync(String(e.absolute)));this[Ht](g,e);}let[i]=e.absolute===this.cwd?[]:Ws(()=>iq(String(e.absolute)));this[Ht](i,e);}[Xh](e,A){let t=typeof e.mode=="number"?e.mode&4095:this.fmode,i=n=>{let s;try{RA__default.default.closeSync(g);}catch(o){s=o;}(n||s)&&this[me](n||s,e),A();},g;try{g=RA__default.default.openSync(String(e.absolute),dG(e.size),t);}catch(n){return i(n)}let r=this.transform&&this.transform(e)||e;r!==e&&(r.on("error",n=>this[me](n,e)),e.pipe(r)),r.on("data",n=>{try{RA__default.default.writeSync(g,n,0,n.length);}catch(s){i(s);}}),r.on("end",()=>{let n=null;if(e.mtime&&!this.noMtime){let s=e.atime||new Date,o=e.mtime;try{RA__default.default.futimesSync(g,s,o);}catch(a){try{RA__default.default.utimesSync(String(e.absolute),s,o);}catch{n=a;}}}if(this[$s](e)){let s=this[AC](e),o=this[eC](e);try{RA__default.default.fchownSync(g,Number(s),Number(o));}catch(a){try{RA__default.default.chownSync(String(e.absolute),Number(s),Number(o));}catch{n=n||a;}}}i(n);});}[zh](e,A){let t=typeof e.mode=="number"?e.mode&4095:this.dmode,i=this[Ug](String(e.absolute),t);if(i){this[me](i,e),A();return}if(e.mtime&&!this.noMtime)try{RA__default.default.utimesSync(String(e.absolute),e.atime||new Date,e.mtime);}catch{}if(this[$s](e))try{RA__default.default.chownSync(String(e.absolute),Number(this[AC](e)),Number(this[eC](e)));}catch{}A(),e.resume();}[Ug](e,A){try{return W_(hA(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:A})}catch(t){return t}}[Vs](e,A,t,i,g){if(this.preservePaths||t.length===0)return i();let r=A;for(let n of t){r=ue__default.default.resolve(r,n);let[s,o]=Ws(()=>RA__default.default.lstatSync(r));if(s)return i();if(o.isSymbolicLink())return g(new eE(r,ue__default.default.resolve(A,t.join("/"))))}i();}[YQ](e,A,t,i){let g=`${t}Sync`;try{RA__default.default[g](A,String(e.absolute)),i(),e.resume();}catch(r){return this[me](r,e)}}},gq=e=>{let A=new SG(e),t=e.file,i=RA__default.default.statSync(t),g=e.maxReadSize||16*1024*1024;new dO(t,{readSize:g,size:i.size}).pipe(A);},rq=(e,A)=>{let t=new CD(e),i=e.maxReadSize||16*1024*1024,g=e.file;return new Promise((r,n)=>{t.on("error",n),t.on("close",r),RA__default.default.stat(g,(s,o)=>{if(s)n(s);else {let a=new eD(g,{readSize:i,size:o.size});a.on("error",n),a.pipe(t);}});})},RG=rC(gq,rq,e=>new SG(e),e=>new CD(e),(e,A)=>{A?.length&&nG(e,A);}),nq=(e,A)=>{let t=new sD(e),i=true,g,r;try{try{g=RA__default.default.openSync(e.file,"r+");}catch(o){if(o?.code==="ENOENT")g=RA__default.default.openSync(e.file,"w+");else throw o}let n=RA__default.default.fstatSync(g),s=Buffer.alloc(512);A:for(r=0;r<n.size;r+=512){for(let B=0,u=0;B<512;B+=u){if(u=RA__default.default.readSync(g,s,B,s.length-B,r+B),r===0&&s[0]===31&&s[1]===139)throw new Error("cannot append to compressed archives");if(!u)break A}let o=new Rr(s);if(!o.cksumValid)break;let a=512*Math.ceil((o.size||0)/512);if(r+a+512>n.size)break;r+=a,e.mtimeCache&&o.mtime&&e.mtimeCache.set(String(o.path),o.mtime);}i=!1,Iq(e,t,r,g,A);}finally{if(i)try{RA__default.default.closeSync(g);}catch{}}},Iq=(e,A,t,i,g)=>{let r=new XN(e.file,{fd:i,start:t});A.pipe(r),Cq(A,g);},sq=(e,A)=>{A=Array.from(A);let t=new zQ(e),i=(g,r,n)=>{let s=(Q,I)=>{Q?RA__default.default.close(g,C=>n(Q)):n(null,I);},o=0;if(r===0)return s(null,0);let a=0,B=Buffer.alloc(512),u=(Q,I)=>{if(Q||I===void 0)return s(Q);if(a+=I,a<512&&I)return RA__default.default.read(g,B,a,B.length-a,o+a,u);if(o===0&&B[0]===31&&B[1]===139)return s(new Error("cannot append to compressed archives"));if(a<512)return s(null,o);let C=new Rr(B);if(!C.cksumValid)return s(null,o);let E=512*Math.ceil((C.size??0)/512);if(o+E+512>r||(o+=E+512,o>=r))return s(null,o);e.mtimeCache&&C.mtime&&e.mtimeCache.set(String(C.path),C.mtime),a=0,RA__default.default.read(g,B,0,512,o,u);};RA__default.default.read(g,B,0,512,o,u);};return new Promise((g,r)=>{t.on("error",r);let n="r+",s=(o,a)=>{if(o&&o.code==="ENOENT"&&n==="r+")return n="w+",RA__default.default.open(e.file,n,s);if(o||!a)return r(o);RA__default.default.fstat(a,(B,u)=>{if(B)return RA__default.default.close(a,()=>r(B));i(a,u.size,(Q,I)=>{if(Q)return r(Q);let C=new WQ(e.file,{fd:a,start:I});t.pipe(C),C.on("error",r),C.on("close",g),oq(t,A);});});};RA__default.default.open(e.file,n,s);})},Cq=(e,A)=>{A.forEach(t=>{t.charAt(0)==="@"?ZQ({file:ue__default.default.resolve(e.cwd,t.slice(1)),sync:true,noResume:true,onReadEntry:i=>e.add(i)}):e.add(t);}),e.end();},oq=async(e,A)=>{for(let t of A)t.charAt(0)==="@"?await ZQ({file:ue__default.default.resolve(String(e.cwd),t.slice(1)),noResume:true,onReadEntry:i=>e.add(i)}):e.add(t);e.end();},js=rC(nq,sq,()=>{throw new TypeError("file is required")},()=>{throw new TypeError("file is required")},(e,A)=>{if(!kO(e))throw new TypeError("file is required");if(e.gzip||e.brotli||e.zstd||e.file.endsWith(".br")||e.file.endsWith(".tbr"))throw new TypeError("cannot append to compressed archives");if(!A?.length)throw new TypeError("no paths specified to add/replace")});rC(js.syncFile,js.asyncFile,js.syncNoFile,js.asyncNoFile,(e,A=[])=>{js.validate?.(e,A),Bq(e);});var Bq=e=>{let A=e.filter;e.mtimeCache||(e.mtimeCache=new Map),e.filter=A?(t,i)=>A(t,i)&&!((e.mtimeCache?.get(t)??i.mtime??0)>(i.mtime??0)):(t,i)=>!((e.mtimeCache?.get(t)??i.mtime??0)>(i.mtime??0));};var MG=100;function Eq(e){return `${e.authUrl}/images/`}async function BD(e,A,t){let i=[],g=t?{tags:{some:{name:{eq:t}}}}:{},r=0;for(;;){let n=await Et(e,A,`query ExportAssets($where: _assetWhere, $limit: Int, $offset: Int, $sort: [_assetSort!]) {
210
210
  _assets(where: $where, limit: $limit, offset: $offset, sort: $sort) {
211
211
  _id
212
212
  extension