From 356a7cbf2a9b721c71a667f0fd37d8de2fca78a7 Mon Sep 17 00:00:00 2001 From: ChecksumDev Date: Wed, 17 Jul 2024 21:56:12 -0500 Subject: [PATCH] chore(main): release 1.6.1 (#33) * chore(main): release 1.6.1 * chore: bundle update --------- Co-authored-by: BeatForge CI --- CHANGELOG.md | 7 +++++++ dist/index.js | 4 ++-- package.json | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e565483..5616be4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.6.1](https://github.com/beat-forge/init-beatsaber/compare/v1.6.0...v1.6.1) (2024-07-18) + + +### Bug Fixes + +* remove BOM from `manifest.json` if present ([51e47f0](https://github.com/beat-forge/init-beatsaber/commit/51e47f0312b8c8abd407bb3904d894aaf64031ef)) + ## [1.6.0](https://github.com/beat-forge/init-beatsaber/compare/v1.5.2...v1.6.0) (2024-07-18) diff --git a/dist/index.js b/dist/index.js index dcd77bb..01c3d30 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,3 +1,3 @@ -import{createRequire as D4} from"node:module";var O4=Object.create;var{defineProperty:R8,getPrototypeOf:U4,getOwnPropertyNames:T4}=Object;var C4=Object.prototype.hasOwnProperty;var j4=($,Q,V)=>{V=$!=null?O4(U4($)):{};const X=Q||!$||!$.__esModule?R8(V,"default",{value:$,enumerable:!0}):V;for(let J of T4($))if(!C4.call(X,J))R8(X,J,{get:()=>$[J],enumerable:!0});return X};var F=($,Q)=>()=>(Q||$((Q={exports:{}}).exports,Q),Q.exports);var U=D4(import.meta.url);var o$=F((g8)=>{var N4=function($){if($===null||$===void 0)return"";else if(typeof $==="string"||$ instanceof String)return $;return JSON.stringify($)},S4=function($){if(!Object.keys($).length)return{};return{title:$.title,file:$.file,line:$.startLine,endLine:$.endLine,col:$.startColumn,endColumn:$.endColumn}};Object.defineProperty(g8,"__esModule",{value:!0});g8.toCommandProperties=g8.toCommandValue=void 0;g8.toCommandValue=N4;g8.toCommandProperties=S4});var h8=F((d)=>{var b8=function($,Q,V){const X=new E8($,Q,V);process.stdout.write(X.toString()+y4.EOL)},m4=function($,Q=""){b8($,{},Q)},b4=function($){return m8.toCommandValue($).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A")},E4=function($){return m8.toCommandValue($).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/:/g,"%3A").replace(/,/g,"%2C")},R4=d&&d.__createBinding||(Object.create?function($,Q,V,X){if(X===void 0)X=V;Object.defineProperty($,X,{enumerable:!0,get:function(){return Q[V]}})}:function($,Q,V,X){if(X===void 0)X=V;$[X]=Q[V]}),g4=d&&d.__setModuleDefault||(Object.create?function($,Q){Object.defineProperty($,"default",{enumerable:!0,value:Q})}:function($,Q){$.default=Q}),k4=d&&d.__importStar||function($){if($&&$.__esModule)return $;var Q={};if($!=null){for(var V in $)if(V!=="default"&&Object.hasOwnProperty.call($,V))R4(Q,$,V)}return g4(Q,$),Q};Object.defineProperty(d,"__esModule",{value:!0});d.issue=d.issueCommand=void 0;var y4=k4(U("os")),m8=o$();d.issueCommand=b8;d.issue=m4;var y8="::";class E8{constructor($,Q,V){if(!$)$="missing.command";this.command=$,this.properties=Q,this.message=V}toString(){let $=y8+this.command;if(this.properties&&Object.keys(this.properties).length>0){$+=" ";let Q=!0;for(let V in this.properties)if(this.properties.hasOwnProperty(V)){const X=this.properties[V];if(X){if(Q)Q=!1;else $+=",";$+=`${V}=${E4(X)}`}}}return $+=`${y8}${b4(this.message)}`,$}}});var r5=F((u8)=>{var u4=function($){return $&&$.__esModule?$:{default:$}},f4=function(){if(t$>e$.length-16)h4.default.randomFillSync(e$),t$=0;return e$.slice(t$,t$+=16)};Object.defineProperty(u8,"__esModule",{value:!0});u8.default=f4;var h4=u4(U("crypto")),e$=new Uint8Array(256),t$=e$.length});var l8=F((f8)=>{Object.defineProperty(f8,"__esModule",{value:!0});f8.default=void 0;var l4=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;f8.default=l4});var x$=F((d8)=>{var i4=function($){return $&&$.__esModule?$:{default:$}},p4=function($){return typeof $==="string"&&d4.default.test($)};Object.defineProperty(d8,"__esModule",{value:!0});d8.default=void 0;var d4=i4(l8()),a4=p4;d8.default=a4});var O$=F((p8)=>{var s4=function($){return $&&$.__esModule?$:{default:$}},r4=function($,Q=0){const V=(R[$[Q+0]]+R[$[Q+1]]+R[$[Q+2]]+R[$[Q+3]]+"-"+R[$[Q+4]]+R[$[Q+5]]+"-"+R[$[Q+6]]+R[$[Q+7]]+"-"+R[$[Q+8]]+R[$[Q+9]]+"-"+R[$[Q+10]]+R[$[Q+11]]+R[$[Q+12]]+R[$[Q+13]]+R[$[Q+14]]+R[$[Q+15]]).toLowerCase();if(!n4.default(V))throw TypeError("Stringified UUID is invalid");return V};Object.defineProperty(p8,"__esModule",{value:!0});p8.default=void 0;var n4=s4(x$()),R=[];for(let $=0;$<256;++$)R.push(($+256).toString(16).substr(1));var o4=r4;p8.default=o4});var t8=F((r8)=>{var s8=function($){return $&&$.__esModule?$:{default:$}},$6=function($,Q,V){let X=Q&&V||0;const J=Q||new Array(16);$=$||{};let Z=$.node||n8,K=$.clockseq!==void 0?$.clockseq:o5;if(Z==null||K==null){const L=$.random||($.rng||t4.default)();if(Z==null)Z=n8=[L[0]|1,L[1],L[2],L[3],L[4],L[5]];if(K==null)K=o5=(L[6]<<8|L[7])&16383}let G=$.msecs!==void 0?$.msecs:Date.now(),Y=$.nsecs!==void 0?$.nsecs:e5+1;const W=G-t5+(Y-e5)/1e4;if(W<0&&$.clockseq===void 0)K=K+1&16383;if((W<0||G>t5)&&$.nsecs===void 0)Y=0;if(Y>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");t5=G,e5=Y,o5=K,G+=12219292800000;const z=((G&268435455)*1e4+Y)%4294967296;J[X++]=z>>>24&255,J[X++]=z>>>16&255,J[X++]=z>>>8&255,J[X++]=z&255;const q=G/4294967296*1e4&268435455;J[X++]=q>>>8&255,J[X++]=q&255,J[X++]=q>>>24&15|16,J[X++]=q>>>16&255,J[X++]=K>>>8|128,J[X++]=K&255;for(let L=0;L<6;++L)J[X+L]=Z[L];return Q||e4.default(J)};Object.defineProperty(r8,"__esModule",{value:!0});r8.default=void 0;var t4=s8(r5()),e4=s8(O$()),n8,o5,t5=0,e5=0,Q6=$6;r8.default=Q6});var $1=F((e8)=>{var X6=function($){return $&&$.__esModule?$:{default:$}},J6=function($){if(!V6.default($))throw TypeError("Invalid UUID");let Q;const V=new Uint8Array(16);return V[0]=(Q=parseInt($.slice(0,8),16))>>>24,V[1]=Q>>>16&255,V[2]=Q>>>8&255,V[3]=Q&255,V[4]=(Q=parseInt($.slice(9,13),16))>>>8,V[5]=Q&255,V[6]=(Q=parseInt($.slice(14,18),16))>>>8,V[7]=Q&255,V[8]=(Q=parseInt($.slice(19,23),16))>>>8,V[9]=Q&255,V[10]=(Q=parseInt($.slice(24,36),16))/1099511627776&255,V[11]=Q/4294967296&255,V[12]=Q>>>24&255,V[13]=Q>>>16&255,V[14]=Q>>>8&255,V[15]=Q&255,V};Object.defineProperty(e8,"__esModule",{value:!0});e8.default=void 0;var V6=X6(x$()),Z6=J6;e8.default=Z6});var Q1=F((J9)=>{var Q9=function($){return $&&$.__esModule?$:{default:$}},Y6=function($){$=unescape(encodeURIComponent($));const Q=[];for(let V=0;V<$.length;++V)Q.push($.charCodeAt(V));return Q},z6=function($,Q,V){function X(J,Z,K,G){if(typeof J==="string")J=Y6(J);if(typeof Z==="string")Z=G6.default(Z);if(Z.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let Y=new Uint8Array(16+J.length);if(Y.set(Z),Y.set(J,Z.length),Y=V(Y),Y[6]=Y[6]&15|Q,Y[8]=Y[8]&63|128,K){G=G||0;for(let W=0;W<16;++W)K[G+W]=Y[W];return K}return K6.default(Y)}try{X.name=$}catch(J){}return X.DNS=V9,X.URL=X9,X};Object.defineProperty(J9,"__esModule",{value:!0});J9.default=z6;J9.URL=J9.DNS=void 0;var K6=Q9(O$()),G6=Q9($1()),V9="6ba7b810-9dad-11d1-80b4-00c04fd430c8";J9.DNS=V9;var X9="6ba7b811-9dad-11d1-80b4-00c04fd430c8";J9.URL=X9});var Y9=F((K9)=>{var L6=function($){return $&&$.__esModule?$:{default:$}},M6=function($){if(Array.isArray($))$=Buffer.from($);else if(typeof $==="string")$=Buffer.from($,"utf8");return B6.default.createHash("md5").update($).digest()};Object.defineProperty(K9,"__esModule",{value:!0});K9.default=void 0;var B6=L6(U("crypto")),w6=M6;K9.default=w6});var B9=F((W9)=>{var z9=function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(W9,"__esModule",{value:!0});W9.default=void 0;var A6=z9(Q1()),I6=z9(Y9()),P6=A6.default("v3",48,I6.default),F6=P6;W9.default=F6});var A9=F((M9)=>{var L9=function($){return $&&$.__esModule?$:{default:$}},x6=function($,Q,V){$=$||{};const X=$.random||($.rng||v6.default)();if(X[6]=X[6]&15|64,X[8]=X[8]&63|128,Q){V=V||0;for(let J=0;J<16;++J)Q[V+J]=X[J];return Q}return H6.default(X)};Object.defineProperty(M9,"__esModule",{value:!0});M9.default=void 0;var v6=L9(r5()),H6=L9(O$()),O6=x6;M9.default=O6});var F9=F((I9)=>{var T6=function($){return $&&$.__esModule?$:{default:$}},C6=function($){if(Array.isArray($))$=Buffer.from($);else if(typeof $==="string")$=Buffer.from($,"utf8");return U6.default.createHash("sha1").update($).digest()};Object.defineProperty(I9,"__esModule",{value:!0});I9.default=void 0;var U6=T6(U("crypto")),j6=C6;I9.default=j6});var O9=F((H9)=>{var v9=function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(H9,"__esModule",{value:!0});H9.default=void 0;var D6=v9(Q1()),N6=v9(F9()),S6=D6.default("v5",80,N6.default),_6=S6;H9.default=_6});var C9=F((U9)=>{Object.defineProperty(U9,"__esModule",{value:!0});U9.default=void 0;var R6="00000000-0000-0000-0000-000000000000";U9.default=R6});var N9=F((j9)=>{var k6=function($){return $&&$.__esModule?$:{default:$}},y6=function($){if(!g6.default($))throw TypeError("Invalid UUID");return parseInt($.substr(14,1),16)};Object.defineProperty(j9,"__esModule",{value:!0});j9.default=void 0;var g6=k6(x$()),m6=y6;j9.default=m6});var S9=F((t)=>{var w0=function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(t,"__esModule",{value:!0});Object.defineProperty(t,"v1",{enumerable:!0,get:function(){return b6.default}});Object.defineProperty(t,"v3",{enumerable:!0,get:function(){return E6.default}});Object.defineProperty(t,"v4",{enumerable:!0,get:function(){return h6.default}});Object.defineProperty(t,"v5",{enumerable:!0,get:function(){return u6.default}});Object.defineProperty(t,"NIL",{enumerable:!0,get:function(){return f6.default}});Object.defineProperty(t,"version",{enumerable:!0,get:function(){return c6.default}});Object.defineProperty(t,"validate",{enumerable:!0,get:function(){return l6.default}});Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return d6.default}});Object.defineProperty(t,"parse",{enumerable:!0,get:function(){return i6.default}});var b6=w0(t8()),E6=w0(B9()),h6=w0(A9()),u6=w0(O9()),f6=w0(C9()),c6=w0(N9()),l6=w0(x$()),d6=w0(O$()),i6=w0($1())});var k9=F((i)=>{var s6=function($,Q){const V=process.env[`GITHUB_${$}`];if(!V)throw new Error(`Unable to find environment variable for file command ${$}`);if(!_9.existsSync(V))throw new Error(`Missing file at path: ${V}`);_9.appendFileSync(V,`${g9.toCommandValue(Q)}${V1.EOL}`,{encoding:"utf8"})},r6=function($,Q){const V=`ghadelimiter_${n6.v4()}`,X=g9.toCommandValue(Q);if($.includes(V))throw new Error(`Unexpected input: name should not contain the delimiter "${V}"`);if(X.includes(V))throw new Error(`Unexpected input: value should not contain the delimiter "${V}"`);return`${$}<<${V}${V1.EOL}${X}${V1.EOL}${V}`},p6=i&&i.__createBinding||(Object.create?function($,Q,V,X){if(X===void 0)X=V;Object.defineProperty($,X,{enumerable:!0,get:function(){return Q[V]}})}:function($,Q,V,X){if(X===void 0)X=V;$[X]=Q[V]}),a6=i&&i.__setModuleDefault||(Object.create?function($,Q){Object.defineProperty($,"default",{enumerable:!0,value:Q})}:function($,Q){$.default=Q}),R9=i&&i.__importStar||function($){if($&&$.__esModule)return $;var Q={};if($!=null){for(var V in $)if(V!=="default"&&Object.hasOwnProperty.call($,V))p6(Q,$,V)}return a6(Q,$),Q};Object.defineProperty(i,"__esModule",{value:!0});i.prepareKeyValueMessage=i.issueFileCommand=void 0;var _9=R9(U("fs")),V1=R9(U("os")),n6=S9(),g9=o$();i.issueFileCommand=s6;i.prepareKeyValueMessage=r6});var E9=F((m9)=>{var o6=function($){const Q=$.protocol==="https:";if(y9($))return;const V=(()=>{if(Q)return process.env.https_proxy||process.env.HTTPS_PROXY;else return process.env.http_proxy||process.env.HTTP_PROXY})();if(V)try{return new URL(V)}catch(X){if(!V.startsWith("http://")&&!V.startsWith("https://"))return new URL(`http://${V}`)}else return},y9=function($){if(!$.hostname)return!1;const Q=$.hostname;if(t6(Q))return!0;const V=process.env.no_proxy||process.env.NO_PROXY||"";if(!V)return!1;let X;if($.port)X=Number($.port);else if($.protocol==="http:")X=80;else if($.protocol==="https:")X=443;const J=[$.hostname.toUpperCase()];if(typeof X==="number")J.push(`${J[0]}:${X}`);for(let Z of V.split(",").map((K)=>K.trim().toUpperCase()).filter((K)=>K))if(Z==="*"||J.some((K)=>K===Z||K.endsWith(`.${Z}`)||Z.startsWith(".")&&K.endsWith(`${Z}`)))return!0;return!1},t6=function($){const Q=$.toLowerCase();return Q==="localhost"||Q.startsWith("127.")||Q.startsWith("[::1]")||Q.startsWith("[0:0:0:0:0:0:0:1]")};Object.defineProperty(m9,"__esModule",{value:!0});m9.checkBypass=m9.getProxyUrl=void 0;m9.getProxyUrl=o6;m9.checkBypass=y9});var c9=F((GQ)=>{var XQ=function($){var Q=new A0($);return Q.request=X1.request,Q},JQ=function($){var Q=new A0($);return Q.request=X1.request,Q.createSocket=u9,Q.defaultPort=443,Q},ZQ=function($){var Q=new A0($);return Q.request=h9.request,Q},KQ=function($){var Q=new A0($);return Q.request=h9.request,Q.createSocket=u9,Q.defaultPort=443,Q},A0=function($){var Q=this;Q.options=$||{},Q.proxyOptions=Q.options.proxy||{},Q.maxSockets=Q.options.maxSockets||X1.Agent.defaultMaxSockets,Q.requests=[],Q.sockets=[],Q.on("free",function V(X,J,Z,K){var G=f9(J,Z,K);for(var Y=0,W=Q.requests.length;Y=this.maxSockets){Z.requests.push(K);return}Z.createSocket(K,function(G){G.on("free",Y),G.on("close",W),G.on("agentRemove",W),Q.onSocket(G);function Y(){Z.emit("free",G,K)}function W(z){Z.removeSocket(G),G.removeListener("free",Y),G.removeListener("close",W),G.removeListener("agentRemove",W)}})};A0.prototype.createSocket=function $(Q,V){var X=this,J={};X.sockets.push(J);var Z=J1({},X.proxyOptions,{method:"CONNECT",path:Q.host+":"+Q.port,agent:!1,headers:{host:Q.host+":"+Q.port}});if(Q.localAddress)Z.localAddress=Q.localAddress;if(Z.proxyAuth)Z.headers=Z.headers||{},Z.headers["Proxy-Authorization"]="Basic "+new Buffer(Z.proxyAuth).toString("base64");C0("making CONNECT request");var K=X.request(Z);K.useChunkedEncodingByDefault=!1,K.once("response",G),K.once("upgrade",Y),K.once("connect",W),K.once("error",z),K.end();function G(q){q.upgrade=!0}function Y(q,L,H){process.nextTick(function(){W(q,L,H)})}function W(q,L,H){if(K.removeAllListeners(),L.removeAllListeners(),q.statusCode!==200){C0("tunneling socket could not be established, statusCode=%d",q.statusCode),L.destroy();var T=new Error("tunneling socket could not be established, statusCode="+q.statusCode);T.code="ECONNRESET",Q.request.emit("error",T),X.removeSocket(J);return}if(H.length>0){C0("got illegal response body from proxy"),L.destroy();var T=new Error("got illegal response body from proxy");T.code="ECONNRESET",Q.request.emit("error",T),X.removeSocket(J);return}return C0("tunneling connection has established"),X.sockets[X.sockets.indexOf(J)]=L,V(L)}function z(q){K.removeAllListeners(),C0("tunneling socket could not be established, cause=%s\n",q.message,q.stack);var L=new Error("tunneling socket could not be established, cause="+q.message);L.code="ECONNRESET",Q.request.emit("error",L),X.removeSocket(J)}};A0.prototype.removeSocket=function $(Q){var V=this.sockets.indexOf(Q);if(V===-1)return;this.sockets.splice(V,1);var X=this.requests.shift();if(X)this.createSocket(X,function(J){X.request.onSocket(J)})};var C0;if(process.env.NODE_DEBUG&&/\btunnel\b/.test(process.env.NODE_DEBUG))C0=function(){var $=Array.prototype.slice.call(arguments);if(typeof $[0]==="string")$[0]="TUNNEL: "+$[0];else $.unshift("TUNNEL:");console.error.apply(console,$)};else C0=function(){};GQ.debug=C0});var i9=F((P)=>{var wQ=function($){const Q=l9.getProxyUrl(new URL($));return Q?Q.href:""},HQ=function($){return new URL($).protocol==="https:"},LQ=P&&P.__createBinding||(Object.create?function($,Q,V,X){if(X===void 0)X=V;Object.defineProperty($,X,{enumerable:!0,get:function(){return Q[V]}})}:function($,Q,V,X){if(X===void 0)X=V;$[X]=Q[V]}),MQ=P&&P.__setModuleDefault||(Object.create?function($,Q){Object.defineProperty($,"default",{enumerable:!0,value:Q})}:function($,Q){$.default=Q}),X5=P&&P.__importStar||function($){if($&&$.__esModule)return $;var Q={};if($!=null){for(var V in $)if(V!=="default"&&Object.hasOwnProperty.call($,V))LQ(Q,$,V)}return MQ(Q,$),Q},x=P&&P.__awaiter||function($,Q,V,X){function J(Z){return Z instanceof V?Z:new V(function(K){K(Z)})}return new(V||(V=Promise))(function(Z,K){function G(z){try{W(X.next(z))}catch(q){K(q)}}function Y(z){try{W(X.throw(z))}catch(q){K(q)}}function W(z){z.done?Z(z.value):J(z.value).then(G,Y)}W((X=X.apply($,Q||[])).next())})};Object.defineProperty(P,"__esModule",{value:!0});P.HttpClient=P.isHttps=P.HttpClientResponse=P.HttpClientError=P.getProxyUrl=P.MediaTypes=P.Headers=P.HttpCodes=void 0;var $5=X5(U("http")),Z1=X5(U("https")),l9=X5(E9()),Q5=X5(c9()),e;(function($){$[$.OK=200]="OK",$[$.MultipleChoices=300]="MultipleChoices",$[$.MovedPermanently=301]="MovedPermanently",$[$.ResourceMoved=302]="ResourceMoved",$[$.SeeOther=303]="SeeOther",$[$.NotModified=304]="NotModified",$[$.UseProxy=305]="UseProxy",$[$.SwitchProxy=306]="SwitchProxy",$[$.TemporaryRedirect=307]="TemporaryRedirect",$[$.PermanentRedirect=308]="PermanentRedirect",$[$.BadRequest=400]="BadRequest",$[$.Unauthorized=401]="Unauthorized",$[$.PaymentRequired=402]="PaymentRequired",$[$.Forbidden=403]="Forbidden",$[$.NotFound=404]="NotFound",$[$.MethodNotAllowed=405]="MethodNotAllowed",$[$.NotAcceptable=406]="NotAcceptable",$[$.ProxyAuthenticationRequired=407]="ProxyAuthenticationRequired",$[$.RequestTimeout=408]="RequestTimeout",$[$.Conflict=409]="Conflict",$[$.Gone=410]="Gone",$[$.TooManyRequests=429]="TooManyRequests",$[$.InternalServerError=500]="InternalServerError",$[$.NotImplemented=501]="NotImplemented",$[$.BadGateway=502]="BadGateway",$[$.ServiceUnavailable=503]="ServiceUnavailable",$[$.GatewayTimeout=504]="GatewayTimeout"})(e=P.HttpCodes||(P.HttpCodes={}));var y;(function($){$.Accept="accept",$.ContentType="content-type"})(y=P.Headers||(P.Headers={}));var j0;(function($){$.ApplicationJson="application/json"})(j0=P.MediaTypes||(P.MediaTypes={}));P.getProxyUrl=wQ;var AQ=[e.MovedPermanently,e.ResourceMoved,e.SeeOther,e.TemporaryRedirect,e.PermanentRedirect],IQ=[e.BadGateway,e.ServiceUnavailable,e.GatewayTimeout],PQ=["OPTIONS","GET","DELETE","HEAD"],FQ=10,vQ=5;class J5 extends Error{constructor($,Q){super($);this.name="HttpClientError",this.statusCode=Q,Object.setPrototypeOf(this,J5.prototype)}}P.HttpClientError=J5;class K1{constructor($){this.message=$}readBody(){return x(this,void 0,void 0,function*(){return new Promise(($)=>x(this,void 0,void 0,function*(){let Q=Buffer.alloc(0);this.message.on("data",(V)=>{Q=Buffer.concat([Q,V])}),this.message.on("end",()=>{$(Q.toString())})}))})}readBodyBuffer(){return x(this,void 0,void 0,function*(){return new Promise(($)=>x(this,void 0,void 0,function*(){const Q=[];this.message.on("data",(V)=>{Q.push(V)}),this.message.on("end",()=>{$(Buffer.concat(Q))})}))})}}P.HttpClientResponse=K1;P.isHttps=HQ;class d9{constructor($,Q,V){if(this._ignoreSslError=!1,this._allowRedirects=!0,this._allowRedirectDowngrade=!1,this._maxRedirects=50,this._allowRetries=!1,this._maxRetries=1,this._keepAlive=!1,this._disposed=!1,this.userAgent=$,this.handlers=Q||[],this.requestOptions=V,V){if(V.ignoreSslError!=null)this._ignoreSslError=V.ignoreSslError;if(this._socketTimeout=V.socketTimeout,V.allowRedirects!=null)this._allowRedirects=V.allowRedirects;if(V.allowRedirectDowngrade!=null)this._allowRedirectDowngrade=V.allowRedirectDowngrade;if(V.maxRedirects!=null)this._maxRedirects=Math.max(V.maxRedirects,0);if(V.keepAlive!=null)this._keepAlive=V.keepAlive;if(V.allowRetries!=null)this._allowRetries=V.allowRetries;if(V.maxRetries!=null)this._maxRetries=V.maxRetries}}options($,Q){return x(this,void 0,void 0,function*(){return this.request("OPTIONS",$,null,Q||{})})}get($,Q){return x(this,void 0,void 0,function*(){return this.request("GET",$,null,Q||{})})}del($,Q){return x(this,void 0,void 0,function*(){return this.request("DELETE",$,null,Q||{})})}post($,Q,V){return x(this,void 0,void 0,function*(){return this.request("POST",$,Q,V||{})})}patch($,Q,V){return x(this,void 0,void 0,function*(){return this.request("PATCH",$,Q,V||{})})}put($,Q,V){return x(this,void 0,void 0,function*(){return this.request("PUT",$,Q,V||{})})}head($,Q){return x(this,void 0,void 0,function*(){return this.request("HEAD",$,null,Q||{})})}sendStream($,Q,V,X){return x(this,void 0,void 0,function*(){return this.request($,Q,V,X)})}getJson($,Q={}){return x(this,void 0,void 0,function*(){Q[y.Accept]=this._getExistingOrDefaultHeader(Q,y.Accept,j0.ApplicationJson);const V=yield this.get($,Q);return this._processResponse(V,this.requestOptions)})}postJson($,Q,V={}){return x(this,void 0,void 0,function*(){const X=JSON.stringify(Q,null,2);V[y.Accept]=this._getExistingOrDefaultHeader(V,y.Accept,j0.ApplicationJson),V[y.ContentType]=this._getExistingOrDefaultHeader(V,y.ContentType,j0.ApplicationJson);const J=yield this.post($,X,V);return this._processResponse(J,this.requestOptions)})}putJson($,Q,V={}){return x(this,void 0,void 0,function*(){const X=JSON.stringify(Q,null,2);V[y.Accept]=this._getExistingOrDefaultHeader(V,y.Accept,j0.ApplicationJson),V[y.ContentType]=this._getExistingOrDefaultHeader(V,y.ContentType,j0.ApplicationJson);const J=yield this.put($,X,V);return this._processResponse(J,this.requestOptions)})}patchJson($,Q,V={}){return x(this,void 0,void 0,function*(){const X=JSON.stringify(Q,null,2);V[y.Accept]=this._getExistingOrDefaultHeader(V,y.Accept,j0.ApplicationJson),V[y.ContentType]=this._getExistingOrDefaultHeader(V,y.ContentType,j0.ApplicationJson);const J=yield this.patch($,X,V);return this._processResponse(J,this.requestOptions)})}request($,Q,V,X){return x(this,void 0,void 0,function*(){if(this._disposed)throw new Error("Client has already been disposed.");const J=new URL(Q);let Z=this._prepareRequest($,J,X);const K=this._allowRetries&&PQ.includes($)?this._maxRetries+1:1;let G=0,Y;do{if(Y=yield this.requestRaw(Z,V),Y&&Y.message&&Y.message.statusCode===e.Unauthorized){let z;for(let q of this.handlers)if(q.canHandleAuthentication(Y)){z=q;break}if(z)return z.handleAuthentication(this,Z,V);else return Y}let W=this._maxRedirects;while(Y.message.statusCode&&AQ.includes(Y.message.statusCode)&&this._allowRedirects&&W>0){const z=Y.message.headers.location;if(!z)break;const q=new URL(z);if(J.protocol==="https:"&&J.protocol!==q.protocol&&!this._allowRedirectDowngrade)throw new Error("Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.");if(yield Y.readBody(),q.hostname!==J.hostname){for(let L in X)if(L.toLowerCase()==="authorization")delete X[L]}Z=this._prepareRequest($,q,X),Y=yield this.requestRaw(Z,V),W--}if(!Y.message.statusCode||!IQ.includes(Y.message.statusCode))return Y;if(G+=1,G{function J(Z,K){if(Z)X(Z);else if(!K)X(new Error("Unknown error"));else V(K)}this.requestRawWithCallback($,Q,J)})})}requestRawWithCallback($,Q,V){if(typeof Q==="string"){if(!$.options.headers)$.options.headers={};$.options.headers["Content-Length"]=Buffer.byteLength(Q,"utf8")}let X=!1;function J(G,Y){if(!X)X=!0,V(G,Y)}const Z=$.httpModule.request($.options,(G)=>{const Y=new K1(G);J(void 0,Y)});let K;if(Z.on("socket",(G)=>{K=G}),Z.setTimeout(this._socketTimeout||180000,()=>{if(K)K.end();J(new Error(`Request timeout: ${$.options.path}`))}),Z.on("error",function(G){J(G)}),Q&&typeof Q==="string")Z.write(Q,"utf8");if(Q&&typeof Q!=="string")Q.on("close",function(){Z.end()}),Q.pipe(Z);else Z.end()}getAgent($){const Q=new URL($);return this._getAgent(Q)}_prepareRequest($,Q,V){const X={};X.parsedUrl=Q;const J=X.parsedUrl.protocol==="https:";X.httpModule=J?Z1:$5;const Z=J?443:80;if(X.options={},X.options.host=X.parsedUrl.hostname,X.options.port=X.parsedUrl.port?parseInt(X.parsedUrl.port):Z,X.options.path=(X.parsedUrl.pathname||"")+(X.parsedUrl.search||""),X.options.method=$,X.options.headers=this._mergeHeaders(V),this.userAgent!=null)X.options.headers["user-agent"]=this.userAgent;if(X.options.agent=this._getAgent(X.parsedUrl),this.handlers)for(let K of this.handlers)K.prepareRequest(X.options);return X}_mergeHeaders($){if(this.requestOptions&&this.requestOptions.headers)return Object.assign({},V5(this.requestOptions.headers),V5($||{}));return V5($||{})}_getExistingOrDefaultHeader($,Q,V){let X;if(this.requestOptions&&this.requestOptions.headers)X=V5(this.requestOptions.headers)[Q];return $[Q]||X||V}_getAgent($){let Q;const V=l9.getProxyUrl($),X=V&&V.hostname;if(this._keepAlive&&X)Q=this._proxyAgent;if(this._keepAlive&&!X)Q=this._agent;if(Q)return Q;const J=$.protocol==="https:";let Z=100;if(this.requestOptions)Z=this.requestOptions.maxSockets||$5.globalAgent.maxSockets;if(V&&V.hostname){const K={maxSockets:Z,keepAlive:this._keepAlive,proxy:Object.assign(Object.assign({},(V.username||V.password)&&{proxyAuth:`${V.username}:${V.password}`}),{host:V.hostname,port:V.port})};let G;const Y=V.protocol==="https:";if(J)G=Y?Q5.httpsOverHttps:Q5.httpsOverHttp;else G=Y?Q5.httpOverHttps:Q5.httpOverHttp;Q=G(K),this._proxyAgent=Q}if(this._keepAlive&&!Q){const K={keepAlive:this._keepAlive,maxSockets:Z};Q=J?new Z1.Agent(K):new $5.Agent(K),this._agent=Q}if(!Q)Q=J?Z1.globalAgent:$5.globalAgent;if(J&&this._ignoreSslError)Q.options=Object.assign(Q.options||{},{rejectUnauthorized:!1});return Q}_performExponentialBackoff($){return x(this,void 0,void 0,function*(){$=Math.min(FQ,$);const Q=vQ*Math.pow(2,$);return new Promise((V)=>setTimeout(()=>V(),Q))})}_processResponse($,Q){return x(this,void 0,void 0,function*(){return new Promise((V,X)=>x(this,void 0,void 0,function*(){const J=$.message.statusCode||0,Z={statusCode:J,result:null,headers:{}};if(J===e.NotFound)V(Z);function K(W,z){if(typeof z==="string"){const q=new Date(z);if(!isNaN(q.valueOf()))return q}return z}let G,Y;try{if(Y=yield $.readBody(),Y&&Y.length>0){if(Q&&Q.deserializeDates)G=JSON.parse(Y,K);else G=JSON.parse(Y);Z.result=G}Z.headers=$.message.headers}catch(W){}if(J>299){let W;if(G&&G.message)W=G.message;else if(Y&&Y.length>0)W=Y;else W=`Failed request: (${J})`;const z=new J5(W,J);z.result=Z.result,X(z)}else V(Z)}))})}}P.HttpClient=d9;var V5=($)=>Object.keys($).reduce((Q,V)=>(Q[V.toLowerCase()]=$[V],Q),{})});var s9=F((Z0)=>{var G1=Z0&&Z0.__awaiter||function($,Q,V,X){function J(Z){return Z instanceof V?Z:new V(function(K){K(Z)})}return new(V||(V=Promise))(function(Z,K){function G(z){try{W(X.next(z))}catch(q){K(q)}}function Y(z){try{W(X.throw(z))}catch(q){K(q)}}function W(z){z.done?Z(z.value):J(z.value).then(G,Y)}W((X=X.apply($,Q||[])).next())})};Object.defineProperty(Z0,"__esModule",{value:!0});Z0.PersonalAccessTokenCredentialHandler=Z0.BearerCredentialHandler=Z0.BasicCredentialHandler=void 0;class p9{constructor($,Q){this.username=$,this.password=Q}prepareRequest($){if(!$.headers)throw Error("The request has no headers");$.headers.Authorization=`Basic ${Buffer.from(`${this.username}:${this.password}`).toString("base64")}`}canHandleAuthentication(){return!1}handleAuthentication(){return G1(this,void 0,void 0,function*(){throw new Error("not implemented")})}}Z0.BasicCredentialHandler=p9;class a9{constructor($){this.token=$}prepareRequest($){if(!$.headers)throw Error("The request has no headers");$.headers.Authorization=`Bearer ${this.token}`}canHandleAuthentication(){return!1}handleAuthentication(){return G1(this,void 0,void 0,function*(){throw new Error("not implemented")})}}Z0.BearerCredentialHandler=a9;class n9{constructor($){this.token=$}prepareRequest($){if(!$.headers)throw Error("The request has no headers");$.headers.Authorization=`Basic ${Buffer.from(`PAT:${this.token}`).toString("base64")}`}canHandleAuthentication(){return!1}handleAuthentication(){return G1(this,void 0,void 0,function*(){throw new Error("not implemented")})}}Z0.PersonalAccessTokenCredentialHandler=n9});var t9=F((K$)=>{var r9=K$&&K$.__awaiter||function($,Q,V,X){function J(Z){return Z instanceof V?Z:new V(function(K){K(Z)})}return new(V||(V=Promise))(function(Z,K){function G(z){try{W(X.next(z))}catch(q){K(q)}}function Y(z){try{W(X.throw(z))}catch(q){K(q)}}function W(z){z.done?Z(z.value):J(z.value).then(G,Y)}W((X=X.apply($,Q||[])).next())})};Object.defineProperty(K$,"__esModule",{value:!0});K$.OidcClient=void 0;var xQ=i9(),OQ=s9(),o9=Y1();class Z${static createHttpClient($=!0,Q=10){const V={allowRetries:$,maxRetries:Q};return new xQ.HttpClient("actions/oidc-client",[new OQ.BearerCredentialHandler(Z$.getRequestToken())],V)}static getRequestToken(){const $=process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN;if(!$)throw new Error("Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable");return $}static getIDTokenUrl(){const $=process.env.ACTIONS_ID_TOKEN_REQUEST_URL;if(!$)throw new Error("Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable");return $}static getCall($){var Q;return r9(this,void 0,void 0,function*(){const J=(Q=(yield Z$.createHttpClient().getJson($).catch((Z)=>{throw new Error(`Failed to get ID Token. \n +import{createRequire as D4} from"node:module";var O4=Object.create;var{defineProperty:R8,getPrototypeOf:U4,getOwnPropertyNames:T4}=Object;var C4=Object.prototype.hasOwnProperty;var j4=($,Q,V)=>{V=$!=null?O4(U4($)):{};const X=Q||!$||!$.__esModule?R8(V,"default",{value:$,enumerable:!0}):V;for(let J of T4($))if(!C4.call(X,J))R8(X,J,{get:()=>$[J],enumerable:!0});return X};var F=($,Q)=>()=>(Q||$((Q={exports:{}}).exports,Q),Q.exports);var T=D4(import.meta.url);var o$=F((g8)=>{var N4=function($){if($===null||$===void 0)return"";else if(typeof $==="string"||$ instanceof String)return $;return JSON.stringify($)},S4=function($){if(!Object.keys($).length)return{};return{title:$.title,file:$.file,line:$.startLine,endLine:$.endLine,col:$.startColumn,endColumn:$.endColumn}};Object.defineProperty(g8,"__esModule",{value:!0});g8.toCommandProperties=g8.toCommandValue=void 0;g8.toCommandValue=N4;g8.toCommandProperties=S4});var h8=F((d)=>{var b8=function($,Q,V){const X=new E8($,Q,V);process.stdout.write(X.toString()+y4.EOL)},m4=function($,Q=""){b8($,{},Q)},b4=function($){return m8.toCommandValue($).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A")},E4=function($){return m8.toCommandValue($).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/:/g,"%3A").replace(/,/g,"%2C")},R4=d&&d.__createBinding||(Object.create?function($,Q,V,X){if(X===void 0)X=V;Object.defineProperty($,X,{enumerable:!0,get:function(){return Q[V]}})}:function($,Q,V,X){if(X===void 0)X=V;$[X]=Q[V]}),g4=d&&d.__setModuleDefault||(Object.create?function($,Q){Object.defineProperty($,"default",{enumerable:!0,value:Q})}:function($,Q){$.default=Q}),k4=d&&d.__importStar||function($){if($&&$.__esModule)return $;var Q={};if($!=null){for(var V in $)if(V!=="default"&&Object.hasOwnProperty.call($,V))R4(Q,$,V)}return g4(Q,$),Q};Object.defineProperty(d,"__esModule",{value:!0});d.issue=d.issueCommand=void 0;var y4=k4(T("os")),m8=o$();d.issueCommand=b8;d.issue=m4;var y8="::";class E8{constructor($,Q,V){if(!$)$="missing.command";this.command=$,this.properties=Q,this.message=V}toString(){let $=y8+this.command;if(this.properties&&Object.keys(this.properties).length>0){$+=" ";let Q=!0;for(let V in this.properties)if(this.properties.hasOwnProperty(V)){const X=this.properties[V];if(X){if(Q)Q=!1;else $+=",";$+=`${V}=${E4(X)}`}}}return $+=`${y8}${b4(this.message)}`,$}}});var r5=F((u8)=>{var u4=function($){return $&&$.__esModule?$:{default:$}},f4=function(){if(t$>e$.length-16)h4.default.randomFillSync(e$),t$=0;return e$.slice(t$,t$+=16)};Object.defineProperty(u8,"__esModule",{value:!0});u8.default=f4;var h4=u4(T("crypto")),e$=new Uint8Array(256),t$=e$.length});var l8=F((f8)=>{Object.defineProperty(f8,"__esModule",{value:!0});f8.default=void 0;var l4=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;f8.default=l4});var x$=F((d8)=>{var i4=function($){return $&&$.__esModule?$:{default:$}},p4=function($){return typeof $==="string"&&d4.default.test($)};Object.defineProperty(d8,"__esModule",{value:!0});d8.default=void 0;var d4=i4(l8()),a4=p4;d8.default=a4});var O$=F((p8)=>{var s4=function($){return $&&$.__esModule?$:{default:$}},r4=function($,Q=0){const V=(R[$[Q+0]]+R[$[Q+1]]+R[$[Q+2]]+R[$[Q+3]]+"-"+R[$[Q+4]]+R[$[Q+5]]+"-"+R[$[Q+6]]+R[$[Q+7]]+"-"+R[$[Q+8]]+R[$[Q+9]]+"-"+R[$[Q+10]]+R[$[Q+11]]+R[$[Q+12]]+R[$[Q+13]]+R[$[Q+14]]+R[$[Q+15]]).toLowerCase();if(!n4.default(V))throw TypeError("Stringified UUID is invalid");return V};Object.defineProperty(p8,"__esModule",{value:!0});p8.default=void 0;var n4=s4(x$()),R=[];for(let $=0;$<256;++$)R.push(($+256).toString(16).substr(1));var o4=r4;p8.default=o4});var t8=F((r8)=>{var s8=function($){return $&&$.__esModule?$:{default:$}},$6=function($,Q,V){let X=Q&&V||0;const J=Q||new Array(16);$=$||{};let Z=$.node||n8,K=$.clockseq!==void 0?$.clockseq:o5;if(Z==null||K==null){const L=$.random||($.rng||t4.default)();if(Z==null)Z=n8=[L[0]|1,L[1],L[2],L[3],L[4],L[5]];if(K==null)K=o5=(L[6]<<8|L[7])&16383}let G=$.msecs!==void 0?$.msecs:Date.now(),Y=$.nsecs!==void 0?$.nsecs:e5+1;const W=G-t5+(Y-e5)/1e4;if(W<0&&$.clockseq===void 0)K=K+1&16383;if((W<0||G>t5)&&$.nsecs===void 0)Y=0;if(Y>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");t5=G,e5=Y,o5=K,G+=12219292800000;const z=((G&268435455)*1e4+Y)%4294967296;J[X++]=z>>>24&255,J[X++]=z>>>16&255,J[X++]=z>>>8&255,J[X++]=z&255;const q=G/4294967296*1e4&268435455;J[X++]=q>>>8&255,J[X++]=q&255,J[X++]=q>>>24&15|16,J[X++]=q>>>16&255,J[X++]=K>>>8|128,J[X++]=K&255;for(let L=0;L<6;++L)J[X+L]=Z[L];return Q||e4.default(J)};Object.defineProperty(r8,"__esModule",{value:!0});r8.default=void 0;var t4=s8(r5()),e4=s8(O$()),n8,o5,t5=0,e5=0,Q6=$6;r8.default=Q6});var $1=F((e8)=>{var X6=function($){return $&&$.__esModule?$:{default:$}},J6=function($){if(!V6.default($))throw TypeError("Invalid UUID");let Q;const V=new Uint8Array(16);return V[0]=(Q=parseInt($.slice(0,8),16))>>>24,V[1]=Q>>>16&255,V[2]=Q>>>8&255,V[3]=Q&255,V[4]=(Q=parseInt($.slice(9,13),16))>>>8,V[5]=Q&255,V[6]=(Q=parseInt($.slice(14,18),16))>>>8,V[7]=Q&255,V[8]=(Q=parseInt($.slice(19,23),16))>>>8,V[9]=Q&255,V[10]=(Q=parseInt($.slice(24,36),16))/1099511627776&255,V[11]=Q/4294967296&255,V[12]=Q>>>24&255,V[13]=Q>>>16&255,V[14]=Q>>>8&255,V[15]=Q&255,V};Object.defineProperty(e8,"__esModule",{value:!0});e8.default=void 0;var V6=X6(x$()),Z6=J6;e8.default=Z6});var Q1=F((J9)=>{var Q9=function($){return $&&$.__esModule?$:{default:$}},Y6=function($){$=unescape(encodeURIComponent($));const Q=[];for(let V=0;V<$.length;++V)Q.push($.charCodeAt(V));return Q},z6=function($,Q,V){function X(J,Z,K,G){if(typeof J==="string")J=Y6(J);if(typeof Z==="string")Z=G6.default(Z);if(Z.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let Y=new Uint8Array(16+J.length);if(Y.set(Z),Y.set(J,Z.length),Y=V(Y),Y[6]=Y[6]&15|Q,Y[8]=Y[8]&63|128,K){G=G||0;for(let W=0;W<16;++W)K[G+W]=Y[W];return K}return K6.default(Y)}try{X.name=$}catch(J){}return X.DNS=V9,X.URL=X9,X};Object.defineProperty(J9,"__esModule",{value:!0});J9.default=z6;J9.URL=J9.DNS=void 0;var K6=Q9(O$()),G6=Q9($1()),V9="6ba7b810-9dad-11d1-80b4-00c04fd430c8";J9.DNS=V9;var X9="6ba7b811-9dad-11d1-80b4-00c04fd430c8";J9.URL=X9});var Y9=F((K9)=>{var L6=function($){return $&&$.__esModule?$:{default:$}},M6=function($){if(Array.isArray($))$=Buffer.from($);else if(typeof $==="string")$=Buffer.from($,"utf8");return B6.default.createHash("md5").update($).digest()};Object.defineProperty(K9,"__esModule",{value:!0});K9.default=void 0;var B6=L6(T("crypto")),w6=M6;K9.default=w6});var B9=F((W9)=>{var z9=function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(W9,"__esModule",{value:!0});W9.default=void 0;var A6=z9(Q1()),I6=z9(Y9()),P6=A6.default("v3",48,I6.default),F6=P6;W9.default=F6});var A9=F((M9)=>{var L9=function($){return $&&$.__esModule?$:{default:$}},x6=function($,Q,V){$=$||{};const X=$.random||($.rng||v6.default)();if(X[6]=X[6]&15|64,X[8]=X[8]&63|128,Q){V=V||0;for(let J=0;J<16;++J)Q[V+J]=X[J];return Q}return H6.default(X)};Object.defineProperty(M9,"__esModule",{value:!0});M9.default=void 0;var v6=L9(r5()),H6=L9(O$()),O6=x6;M9.default=O6});var F9=F((I9)=>{var T6=function($){return $&&$.__esModule?$:{default:$}},C6=function($){if(Array.isArray($))$=Buffer.from($);else if(typeof $==="string")$=Buffer.from($,"utf8");return U6.default.createHash("sha1").update($).digest()};Object.defineProperty(I9,"__esModule",{value:!0});I9.default=void 0;var U6=T6(T("crypto")),j6=C6;I9.default=j6});var O9=F((H9)=>{var v9=function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(H9,"__esModule",{value:!0});H9.default=void 0;var D6=v9(Q1()),N6=v9(F9()),S6=D6.default("v5",80,N6.default),_6=S6;H9.default=_6});var C9=F((U9)=>{Object.defineProperty(U9,"__esModule",{value:!0});U9.default=void 0;var R6="00000000-0000-0000-0000-000000000000";U9.default=R6});var N9=F((j9)=>{var k6=function($){return $&&$.__esModule?$:{default:$}},y6=function($){if(!g6.default($))throw TypeError("Invalid UUID");return parseInt($.substr(14,1),16)};Object.defineProperty(j9,"__esModule",{value:!0});j9.default=void 0;var g6=k6(x$()),m6=y6;j9.default=m6});var S9=F((t)=>{var w0=function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(t,"__esModule",{value:!0});Object.defineProperty(t,"v1",{enumerable:!0,get:function(){return b6.default}});Object.defineProperty(t,"v3",{enumerable:!0,get:function(){return E6.default}});Object.defineProperty(t,"v4",{enumerable:!0,get:function(){return h6.default}});Object.defineProperty(t,"v5",{enumerable:!0,get:function(){return u6.default}});Object.defineProperty(t,"NIL",{enumerable:!0,get:function(){return f6.default}});Object.defineProperty(t,"version",{enumerable:!0,get:function(){return c6.default}});Object.defineProperty(t,"validate",{enumerable:!0,get:function(){return l6.default}});Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return d6.default}});Object.defineProperty(t,"parse",{enumerable:!0,get:function(){return i6.default}});var b6=w0(t8()),E6=w0(B9()),h6=w0(A9()),u6=w0(O9()),f6=w0(C9()),c6=w0(N9()),l6=w0(x$()),d6=w0(O$()),i6=w0($1())});var k9=F((i)=>{var s6=function($,Q){const V=process.env[`GITHUB_${$}`];if(!V)throw new Error(`Unable to find environment variable for file command ${$}`);if(!_9.existsSync(V))throw new Error(`Missing file at path: ${V}`);_9.appendFileSync(V,`${g9.toCommandValue(Q)}${V1.EOL}`,{encoding:"utf8"})},r6=function($,Q){const V=`ghadelimiter_${n6.v4()}`,X=g9.toCommandValue(Q);if($.includes(V))throw new Error(`Unexpected input: name should not contain the delimiter "${V}"`);if(X.includes(V))throw new Error(`Unexpected input: value should not contain the delimiter "${V}"`);return`${$}<<${V}${V1.EOL}${X}${V1.EOL}${V}`},p6=i&&i.__createBinding||(Object.create?function($,Q,V,X){if(X===void 0)X=V;Object.defineProperty($,X,{enumerable:!0,get:function(){return Q[V]}})}:function($,Q,V,X){if(X===void 0)X=V;$[X]=Q[V]}),a6=i&&i.__setModuleDefault||(Object.create?function($,Q){Object.defineProperty($,"default",{enumerable:!0,value:Q})}:function($,Q){$.default=Q}),R9=i&&i.__importStar||function($){if($&&$.__esModule)return $;var Q={};if($!=null){for(var V in $)if(V!=="default"&&Object.hasOwnProperty.call($,V))p6(Q,$,V)}return a6(Q,$),Q};Object.defineProperty(i,"__esModule",{value:!0});i.prepareKeyValueMessage=i.issueFileCommand=void 0;var _9=R9(T("fs")),V1=R9(T("os")),n6=S9(),g9=o$();i.issueFileCommand=s6;i.prepareKeyValueMessage=r6});var E9=F((m9)=>{var o6=function($){const Q=$.protocol==="https:";if(y9($))return;const V=(()=>{if(Q)return process.env.https_proxy||process.env.HTTPS_PROXY;else return process.env.http_proxy||process.env.HTTP_PROXY})();if(V)try{return new URL(V)}catch(X){if(!V.startsWith("http://")&&!V.startsWith("https://"))return new URL(`http://${V}`)}else return},y9=function($){if(!$.hostname)return!1;const Q=$.hostname;if(t6(Q))return!0;const V=process.env.no_proxy||process.env.NO_PROXY||"";if(!V)return!1;let X;if($.port)X=Number($.port);else if($.protocol==="http:")X=80;else if($.protocol==="https:")X=443;const J=[$.hostname.toUpperCase()];if(typeof X==="number")J.push(`${J[0]}:${X}`);for(let Z of V.split(",").map((K)=>K.trim().toUpperCase()).filter((K)=>K))if(Z==="*"||J.some((K)=>K===Z||K.endsWith(`.${Z}`)||Z.startsWith(".")&&K.endsWith(`${Z}`)))return!0;return!1},t6=function($){const Q=$.toLowerCase();return Q==="localhost"||Q.startsWith("127.")||Q.startsWith("[::1]")||Q.startsWith("[0:0:0:0:0:0:0:1]")};Object.defineProperty(m9,"__esModule",{value:!0});m9.checkBypass=m9.getProxyUrl=void 0;m9.getProxyUrl=o6;m9.checkBypass=y9});var c9=F((GQ)=>{var XQ=function($){var Q=new A0($);return Q.request=X1.request,Q},JQ=function($){var Q=new A0($);return Q.request=X1.request,Q.createSocket=u9,Q.defaultPort=443,Q},ZQ=function($){var Q=new A0($);return Q.request=h9.request,Q},KQ=function($){var Q=new A0($);return Q.request=h9.request,Q.createSocket=u9,Q.defaultPort=443,Q},A0=function($){var Q=this;Q.options=$||{},Q.proxyOptions=Q.options.proxy||{},Q.maxSockets=Q.options.maxSockets||X1.Agent.defaultMaxSockets,Q.requests=[],Q.sockets=[],Q.on("free",function V(X,J,Z,K){var G=f9(J,Z,K);for(var Y=0,W=Q.requests.length;Y=this.maxSockets){Z.requests.push(K);return}Z.createSocket(K,function(G){G.on("free",Y),G.on("close",W),G.on("agentRemove",W),Q.onSocket(G);function Y(){Z.emit("free",G,K)}function W(z){Z.removeSocket(G),G.removeListener("free",Y),G.removeListener("close",W),G.removeListener("agentRemove",W)}})};A0.prototype.createSocket=function $(Q,V){var X=this,J={};X.sockets.push(J);var Z=J1({},X.proxyOptions,{method:"CONNECT",path:Q.host+":"+Q.port,agent:!1,headers:{host:Q.host+":"+Q.port}});if(Q.localAddress)Z.localAddress=Q.localAddress;if(Z.proxyAuth)Z.headers=Z.headers||{},Z.headers["Proxy-Authorization"]="Basic "+new Buffer(Z.proxyAuth).toString("base64");C0("making CONNECT request");var K=X.request(Z);K.useChunkedEncodingByDefault=!1,K.once("response",G),K.once("upgrade",Y),K.once("connect",W),K.once("error",z),K.end();function G(q){q.upgrade=!0}function Y(q,L,H){process.nextTick(function(){W(q,L,H)})}function W(q,L,H){if(K.removeAllListeners(),L.removeAllListeners(),q.statusCode!==200){C0("tunneling socket could not be established, statusCode=%d",q.statusCode),L.destroy();var x=new Error("tunneling socket could not be established, statusCode="+q.statusCode);x.code="ECONNRESET",Q.request.emit("error",x),X.removeSocket(J);return}if(H.length>0){C0("got illegal response body from proxy"),L.destroy();var x=new Error("got illegal response body from proxy");x.code="ECONNRESET",Q.request.emit("error",x),X.removeSocket(J);return}return C0("tunneling connection has established"),X.sockets[X.sockets.indexOf(J)]=L,V(L)}function z(q){K.removeAllListeners(),C0("tunneling socket could not be established, cause=%s\n",q.message,q.stack);var L=new Error("tunneling socket could not be established, cause="+q.message);L.code="ECONNRESET",Q.request.emit("error",L),X.removeSocket(J)}};A0.prototype.removeSocket=function $(Q){var V=this.sockets.indexOf(Q);if(V===-1)return;this.sockets.splice(V,1);var X=this.requests.shift();if(X)this.createSocket(X,function(J){X.request.onSocket(J)})};var C0;if(process.env.NODE_DEBUG&&/\btunnel\b/.test(process.env.NODE_DEBUG))C0=function(){var $=Array.prototype.slice.call(arguments);if(typeof $[0]==="string")$[0]="TUNNEL: "+$[0];else $.unshift("TUNNEL:");console.error.apply(console,$)};else C0=function(){};GQ.debug=C0});var i9=F((P)=>{var wQ=function($){const Q=l9.getProxyUrl(new URL($));return Q?Q.href:""},HQ=function($){return new URL($).protocol==="https:"},LQ=P&&P.__createBinding||(Object.create?function($,Q,V,X){if(X===void 0)X=V;Object.defineProperty($,X,{enumerable:!0,get:function(){return Q[V]}})}:function($,Q,V,X){if(X===void 0)X=V;$[X]=Q[V]}),MQ=P&&P.__setModuleDefault||(Object.create?function($,Q){Object.defineProperty($,"default",{enumerable:!0,value:Q})}:function($,Q){$.default=Q}),X5=P&&P.__importStar||function($){if($&&$.__esModule)return $;var Q={};if($!=null){for(var V in $)if(V!=="default"&&Object.hasOwnProperty.call($,V))LQ(Q,$,V)}return MQ(Q,$),Q},O=P&&P.__awaiter||function($,Q,V,X){function J(Z){return Z instanceof V?Z:new V(function(K){K(Z)})}return new(V||(V=Promise))(function(Z,K){function G(z){try{W(X.next(z))}catch(q){K(q)}}function Y(z){try{W(X.throw(z))}catch(q){K(q)}}function W(z){z.done?Z(z.value):J(z.value).then(G,Y)}W((X=X.apply($,Q||[])).next())})};Object.defineProperty(P,"__esModule",{value:!0});P.HttpClient=P.isHttps=P.HttpClientResponse=P.HttpClientError=P.getProxyUrl=P.MediaTypes=P.Headers=P.HttpCodes=void 0;var $5=X5(T("http")),Z1=X5(T("https")),l9=X5(E9()),Q5=X5(c9()),e;(function($){$[$.OK=200]="OK",$[$.MultipleChoices=300]="MultipleChoices",$[$.MovedPermanently=301]="MovedPermanently",$[$.ResourceMoved=302]="ResourceMoved",$[$.SeeOther=303]="SeeOther",$[$.NotModified=304]="NotModified",$[$.UseProxy=305]="UseProxy",$[$.SwitchProxy=306]="SwitchProxy",$[$.TemporaryRedirect=307]="TemporaryRedirect",$[$.PermanentRedirect=308]="PermanentRedirect",$[$.BadRequest=400]="BadRequest",$[$.Unauthorized=401]="Unauthorized",$[$.PaymentRequired=402]="PaymentRequired",$[$.Forbidden=403]="Forbidden",$[$.NotFound=404]="NotFound",$[$.MethodNotAllowed=405]="MethodNotAllowed",$[$.NotAcceptable=406]="NotAcceptable",$[$.ProxyAuthenticationRequired=407]="ProxyAuthenticationRequired",$[$.RequestTimeout=408]="RequestTimeout",$[$.Conflict=409]="Conflict",$[$.Gone=410]="Gone",$[$.TooManyRequests=429]="TooManyRequests",$[$.InternalServerError=500]="InternalServerError",$[$.NotImplemented=501]="NotImplemented",$[$.BadGateway=502]="BadGateway",$[$.ServiceUnavailable=503]="ServiceUnavailable",$[$.GatewayTimeout=504]="GatewayTimeout"})(e=P.HttpCodes||(P.HttpCodes={}));var y;(function($){$.Accept="accept",$.ContentType="content-type"})(y=P.Headers||(P.Headers={}));var j0;(function($){$.ApplicationJson="application/json"})(j0=P.MediaTypes||(P.MediaTypes={}));P.getProxyUrl=wQ;var AQ=[e.MovedPermanently,e.ResourceMoved,e.SeeOther,e.TemporaryRedirect,e.PermanentRedirect],IQ=[e.BadGateway,e.ServiceUnavailable,e.GatewayTimeout],PQ=["OPTIONS","GET","DELETE","HEAD"],FQ=10,vQ=5;class J5 extends Error{constructor($,Q){super($);this.name="HttpClientError",this.statusCode=Q,Object.setPrototypeOf(this,J5.prototype)}}P.HttpClientError=J5;class K1{constructor($){this.message=$}readBody(){return O(this,void 0,void 0,function*(){return new Promise(($)=>O(this,void 0,void 0,function*(){let Q=Buffer.alloc(0);this.message.on("data",(V)=>{Q=Buffer.concat([Q,V])}),this.message.on("end",()=>{$(Q.toString())})}))})}readBodyBuffer(){return O(this,void 0,void 0,function*(){return new Promise(($)=>O(this,void 0,void 0,function*(){const Q=[];this.message.on("data",(V)=>{Q.push(V)}),this.message.on("end",()=>{$(Buffer.concat(Q))})}))})}}P.HttpClientResponse=K1;P.isHttps=HQ;class d9{constructor($,Q,V){if(this._ignoreSslError=!1,this._allowRedirects=!0,this._allowRedirectDowngrade=!1,this._maxRedirects=50,this._allowRetries=!1,this._maxRetries=1,this._keepAlive=!1,this._disposed=!1,this.userAgent=$,this.handlers=Q||[],this.requestOptions=V,V){if(V.ignoreSslError!=null)this._ignoreSslError=V.ignoreSslError;if(this._socketTimeout=V.socketTimeout,V.allowRedirects!=null)this._allowRedirects=V.allowRedirects;if(V.allowRedirectDowngrade!=null)this._allowRedirectDowngrade=V.allowRedirectDowngrade;if(V.maxRedirects!=null)this._maxRedirects=Math.max(V.maxRedirects,0);if(V.keepAlive!=null)this._keepAlive=V.keepAlive;if(V.allowRetries!=null)this._allowRetries=V.allowRetries;if(V.maxRetries!=null)this._maxRetries=V.maxRetries}}options($,Q){return O(this,void 0,void 0,function*(){return this.request("OPTIONS",$,null,Q||{})})}get($,Q){return O(this,void 0,void 0,function*(){return this.request("GET",$,null,Q||{})})}del($,Q){return O(this,void 0,void 0,function*(){return this.request("DELETE",$,null,Q||{})})}post($,Q,V){return O(this,void 0,void 0,function*(){return this.request("POST",$,Q,V||{})})}patch($,Q,V){return O(this,void 0,void 0,function*(){return this.request("PATCH",$,Q,V||{})})}put($,Q,V){return O(this,void 0,void 0,function*(){return this.request("PUT",$,Q,V||{})})}head($,Q){return O(this,void 0,void 0,function*(){return this.request("HEAD",$,null,Q||{})})}sendStream($,Q,V,X){return O(this,void 0,void 0,function*(){return this.request($,Q,V,X)})}getJson($,Q={}){return O(this,void 0,void 0,function*(){Q[y.Accept]=this._getExistingOrDefaultHeader(Q,y.Accept,j0.ApplicationJson);const V=yield this.get($,Q);return this._processResponse(V,this.requestOptions)})}postJson($,Q,V={}){return O(this,void 0,void 0,function*(){const X=JSON.stringify(Q,null,2);V[y.Accept]=this._getExistingOrDefaultHeader(V,y.Accept,j0.ApplicationJson),V[y.ContentType]=this._getExistingOrDefaultHeader(V,y.ContentType,j0.ApplicationJson);const J=yield this.post($,X,V);return this._processResponse(J,this.requestOptions)})}putJson($,Q,V={}){return O(this,void 0,void 0,function*(){const X=JSON.stringify(Q,null,2);V[y.Accept]=this._getExistingOrDefaultHeader(V,y.Accept,j0.ApplicationJson),V[y.ContentType]=this._getExistingOrDefaultHeader(V,y.ContentType,j0.ApplicationJson);const J=yield this.put($,X,V);return this._processResponse(J,this.requestOptions)})}patchJson($,Q,V={}){return O(this,void 0,void 0,function*(){const X=JSON.stringify(Q,null,2);V[y.Accept]=this._getExistingOrDefaultHeader(V,y.Accept,j0.ApplicationJson),V[y.ContentType]=this._getExistingOrDefaultHeader(V,y.ContentType,j0.ApplicationJson);const J=yield this.patch($,X,V);return this._processResponse(J,this.requestOptions)})}request($,Q,V,X){return O(this,void 0,void 0,function*(){if(this._disposed)throw new Error("Client has already been disposed.");const J=new URL(Q);let Z=this._prepareRequest($,J,X);const K=this._allowRetries&&PQ.includes($)?this._maxRetries+1:1;let G=0,Y;do{if(Y=yield this.requestRaw(Z,V),Y&&Y.message&&Y.message.statusCode===e.Unauthorized){let z;for(let q of this.handlers)if(q.canHandleAuthentication(Y)){z=q;break}if(z)return z.handleAuthentication(this,Z,V);else return Y}let W=this._maxRedirects;while(Y.message.statusCode&&AQ.includes(Y.message.statusCode)&&this._allowRedirects&&W>0){const z=Y.message.headers.location;if(!z)break;const q=new URL(z);if(J.protocol==="https:"&&J.protocol!==q.protocol&&!this._allowRedirectDowngrade)throw new Error("Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.");if(yield Y.readBody(),q.hostname!==J.hostname){for(let L in X)if(L.toLowerCase()==="authorization")delete X[L]}Z=this._prepareRequest($,q,X),Y=yield this.requestRaw(Z,V),W--}if(!Y.message.statusCode||!IQ.includes(Y.message.statusCode))return Y;if(G+=1,G{function J(Z,K){if(Z)X(Z);else if(!K)X(new Error("Unknown error"));else V(K)}this.requestRawWithCallback($,Q,J)})})}requestRawWithCallback($,Q,V){if(typeof Q==="string"){if(!$.options.headers)$.options.headers={};$.options.headers["Content-Length"]=Buffer.byteLength(Q,"utf8")}let X=!1;function J(G,Y){if(!X)X=!0,V(G,Y)}const Z=$.httpModule.request($.options,(G)=>{const Y=new K1(G);J(void 0,Y)});let K;if(Z.on("socket",(G)=>{K=G}),Z.setTimeout(this._socketTimeout||180000,()=>{if(K)K.end();J(new Error(`Request timeout: ${$.options.path}`))}),Z.on("error",function(G){J(G)}),Q&&typeof Q==="string")Z.write(Q,"utf8");if(Q&&typeof Q!=="string")Q.on("close",function(){Z.end()}),Q.pipe(Z);else Z.end()}getAgent($){const Q=new URL($);return this._getAgent(Q)}_prepareRequest($,Q,V){const X={};X.parsedUrl=Q;const J=X.parsedUrl.protocol==="https:";X.httpModule=J?Z1:$5;const Z=J?443:80;if(X.options={},X.options.host=X.parsedUrl.hostname,X.options.port=X.parsedUrl.port?parseInt(X.parsedUrl.port):Z,X.options.path=(X.parsedUrl.pathname||"")+(X.parsedUrl.search||""),X.options.method=$,X.options.headers=this._mergeHeaders(V),this.userAgent!=null)X.options.headers["user-agent"]=this.userAgent;if(X.options.agent=this._getAgent(X.parsedUrl),this.handlers)for(let K of this.handlers)K.prepareRequest(X.options);return X}_mergeHeaders($){if(this.requestOptions&&this.requestOptions.headers)return Object.assign({},V5(this.requestOptions.headers),V5($||{}));return V5($||{})}_getExistingOrDefaultHeader($,Q,V){let X;if(this.requestOptions&&this.requestOptions.headers)X=V5(this.requestOptions.headers)[Q];return $[Q]||X||V}_getAgent($){let Q;const V=l9.getProxyUrl($),X=V&&V.hostname;if(this._keepAlive&&X)Q=this._proxyAgent;if(this._keepAlive&&!X)Q=this._agent;if(Q)return Q;const J=$.protocol==="https:";let Z=100;if(this.requestOptions)Z=this.requestOptions.maxSockets||$5.globalAgent.maxSockets;if(V&&V.hostname){const K={maxSockets:Z,keepAlive:this._keepAlive,proxy:Object.assign(Object.assign({},(V.username||V.password)&&{proxyAuth:`${V.username}:${V.password}`}),{host:V.hostname,port:V.port})};let G;const Y=V.protocol==="https:";if(J)G=Y?Q5.httpsOverHttps:Q5.httpsOverHttp;else G=Y?Q5.httpOverHttps:Q5.httpOverHttp;Q=G(K),this._proxyAgent=Q}if(this._keepAlive&&!Q){const K={keepAlive:this._keepAlive,maxSockets:Z};Q=J?new Z1.Agent(K):new $5.Agent(K),this._agent=Q}if(!Q)Q=J?Z1.globalAgent:$5.globalAgent;if(J&&this._ignoreSslError)Q.options=Object.assign(Q.options||{},{rejectUnauthorized:!1});return Q}_performExponentialBackoff($){return O(this,void 0,void 0,function*(){$=Math.min(FQ,$);const Q=vQ*Math.pow(2,$);return new Promise((V)=>setTimeout(()=>V(),Q))})}_processResponse($,Q){return O(this,void 0,void 0,function*(){return new Promise((V,X)=>O(this,void 0,void 0,function*(){const J=$.message.statusCode||0,Z={statusCode:J,result:null,headers:{}};if(J===e.NotFound)V(Z);function K(W,z){if(typeof z==="string"){const q=new Date(z);if(!isNaN(q.valueOf()))return q}return z}let G,Y;try{if(Y=yield $.readBody(),Y&&Y.length>0){if(Q&&Q.deserializeDates)G=JSON.parse(Y,K);else G=JSON.parse(Y);Z.result=G}Z.headers=$.message.headers}catch(W){}if(J>299){let W;if(G&&G.message)W=G.message;else if(Y&&Y.length>0)W=Y;else W=`Failed request: (${J})`;const z=new J5(W,J);z.result=Z.result,X(z)}else V(Z)}))})}}P.HttpClient=d9;var V5=($)=>Object.keys($).reduce((Q,V)=>(Q[V.toLowerCase()]=$[V],Q),{})});var s9=F((Z0)=>{var G1=Z0&&Z0.__awaiter||function($,Q,V,X){function J(Z){return Z instanceof V?Z:new V(function(K){K(Z)})}return new(V||(V=Promise))(function(Z,K){function G(z){try{W(X.next(z))}catch(q){K(q)}}function Y(z){try{W(X.throw(z))}catch(q){K(q)}}function W(z){z.done?Z(z.value):J(z.value).then(G,Y)}W((X=X.apply($,Q||[])).next())})};Object.defineProperty(Z0,"__esModule",{value:!0});Z0.PersonalAccessTokenCredentialHandler=Z0.BearerCredentialHandler=Z0.BasicCredentialHandler=void 0;class p9{constructor($,Q){this.username=$,this.password=Q}prepareRequest($){if(!$.headers)throw Error("The request has no headers");$.headers.Authorization=`Basic ${Buffer.from(`${this.username}:${this.password}`).toString("base64")}`}canHandleAuthentication(){return!1}handleAuthentication(){return G1(this,void 0,void 0,function*(){throw new Error("not implemented")})}}Z0.BasicCredentialHandler=p9;class a9{constructor($){this.token=$}prepareRequest($){if(!$.headers)throw Error("The request has no headers");$.headers.Authorization=`Bearer ${this.token}`}canHandleAuthentication(){return!1}handleAuthentication(){return G1(this,void 0,void 0,function*(){throw new Error("not implemented")})}}Z0.BearerCredentialHandler=a9;class n9{constructor($){this.token=$}prepareRequest($){if(!$.headers)throw Error("The request has no headers");$.headers.Authorization=`Basic ${Buffer.from(`PAT:${this.token}`).toString("base64")}`}canHandleAuthentication(){return!1}handleAuthentication(){return G1(this,void 0,void 0,function*(){throw new Error("not implemented")})}}Z0.PersonalAccessTokenCredentialHandler=n9});var t9=F((K$)=>{var r9=K$&&K$.__awaiter||function($,Q,V,X){function J(Z){return Z instanceof V?Z:new V(function(K){K(Z)})}return new(V||(V=Promise))(function(Z,K){function G(z){try{W(X.next(z))}catch(q){K(q)}}function Y(z){try{W(X.throw(z))}catch(q){K(q)}}function W(z){z.done?Z(z.value):J(z.value).then(G,Y)}W((X=X.apply($,Q||[])).next())})};Object.defineProperty(K$,"__esModule",{value:!0});K$.OidcClient=void 0;var xQ=i9(),OQ=s9(),o9=Y1();class Z${static createHttpClient($=!0,Q=10){const V={allowRetries:$,maxRetries:Q};return new xQ.HttpClient("actions/oidc-client",[new OQ.BearerCredentialHandler(Z$.getRequestToken())],V)}static getRequestToken(){const $=process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN;if(!$)throw new Error("Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable");return $}static getIDTokenUrl(){const $=process.env.ACTIONS_ID_TOKEN_REQUEST_URL;if(!$)throw new Error("Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable");return $}static getCall($){var Q;return r9(this,void 0,void 0,function*(){const J=(Q=(yield Z$.createHttpClient().getJson($).catch((Z)=>{throw new Error(`Failed to get ID Token. \n Error Code : ${Z.statusCode}\n - Error Message: ${Z.message}`)})).result)===null||Q===void 0?void 0:Q.value;if(!J)throw new Error("Response json body do not have ID Token field");return J})}static getIDToken($){return r9(this,void 0,void 0,function*(){try{let Q=Z$.getIDTokenUrl();if($){const X=encodeURIComponent($);Q=`${Q}&audience=${X}`}o9.debug(`ID token url is ${Q}`);const V=yield Z$.getCall(Q);return o9.setSecret(V),V}catch(Q){throw new Error(`Error message: ${Q.message}`)}})}}K$.OidcClient=Z$});var q1=F((E)=>{var z1=E&&E.__awaiter||function($,Q,V,X){function J(Z){return Z instanceof V?Z:new V(function(K){K(Z)})}return new(V||(V=Promise))(function(Z,K){function G(z){try{W(X.next(z))}catch(q){K(q)}}function Y(z){try{W(X.throw(z))}catch(q){K(q)}}function W(z){z.done?Z(z.value):J(z.value).then(G,Y)}W((X=X.apply($,Q||[])).next())})};Object.defineProperty(E,"__esModule",{value:!0});E.summary=E.markdownSummary=E.SUMMARY_DOCS_URL=E.SUMMARY_ENV_VAR=void 0;var UQ=U("os"),W1=U("fs"),{access:TQ,appendFile:CQ,writeFile:jQ}=W1.promises;E.SUMMARY_ENV_VAR="GITHUB_STEP_SUMMARY";E.SUMMARY_DOCS_URL="https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary";class e9{constructor(){this._buffer=""}filePath(){return z1(this,void 0,void 0,function*(){if(this._filePath)return this._filePath;const $=process.env[E.SUMMARY_ENV_VAR];if(!$)throw new Error(`Unable to find environment variable for \$${E.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`);try{yield TQ($,W1.constants.R_OK|W1.constants.W_OK)}catch(Q){throw new Error(`Unable to access summary file: '${$}'. Check if the file has correct read/write permissions.`)}return this._filePath=$,this._filePath})}wrap($,Q,V={}){const X=Object.entries(V).map(([J,Z])=>` ${J}="${Z}"`).join("");if(!Q)return`<${$}${X}>`;return`<${$}${X}>${Q}`}write($){return z1(this,void 0,void 0,function*(){const Q=!!($===null||$===void 0?void 0:$.overwrite),V=yield this.filePath();return yield(Q?jQ:CQ)(V,this._buffer,{encoding:"utf8"}),this.emptyBuffer()})}clear(){return z1(this,void 0,void 0,function*(){return this.emptyBuffer().write({overwrite:!0})})}stringify(){return this._buffer}isEmptyBuffer(){return this._buffer.length===0}emptyBuffer(){return this._buffer="",this}addRaw($,Q=!1){return this._buffer+=$,Q?this.addEOL():this}addEOL(){return this.addRaw(UQ.EOL)}addCodeBlock($,Q){const V=Object.assign({},Q&&{lang:Q}),X=this.wrap("pre",this.wrap("code",$),V);return this.addRaw(X).addEOL()}addList($,Q=!1){const V=Q?"ol":"ul",X=$.map((Z)=>this.wrap("li",Z)).join(""),J=this.wrap(V,X);return this.addRaw(J).addEOL()}addTable($){const Q=$.map((X)=>{const J=X.map((Z)=>{if(typeof Z==="string")return this.wrap("td",Z);const{header:K,data:G,colspan:Y,rowspan:W}=Z,z=K?"th":"td",q=Object.assign(Object.assign({},Y&&{colspan:Y}),W&&{rowspan:W});return this.wrap(z,G,q)}).join("");return this.wrap("tr",J)}).join(""),V=this.wrap("table",Q);return this.addRaw(V).addEOL()}addDetails($,Q){const V=this.wrap("details",this.wrap("summary",$)+Q);return this.addRaw(V).addEOL()}addImage($,Q,V){const{width:X,height:J}=V||{},Z=Object.assign(Object.assign({},X&&{width:X}),J&&{height:J}),K=this.wrap("img",null,Object.assign({src:$,alt:Q},Z));return this.addRaw(K).addEOL()}addHeading($,Q){const V=`h${Q}`,X=["h1","h2","h3","h4","h5","h6"].includes(V)?V:"h1",J=this.wrap(X,$);return this.addRaw(J).addEOL()}addSeparator(){const $=this.wrap("hr",null);return this.addRaw($).addEOL()}addBreak(){const $=this.wrap("br",null);return this.addRaw($).addEOL()}addQuote($,Q){const V=Object.assign({},Q&&{cite:Q}),X=this.wrap("blockquote",$,V);return this.addRaw(X).addEOL()}addLink($,Q){const V=this.wrap("a",$,{href:Q});return this.addRaw(V).addEOL()}}var $7=new e9;E.markdownSummary=$7;E.summary=$7});var Q7=F((h)=>{var RQ=function($){return $.replace(/[\\]/g,"/")},gQ=function($){return $.replace(/[/]/g,"\\")},kQ=function($){return $.replace(/[/\\]/g,_Q.sep)},DQ=h&&h.__createBinding||(Object.create?function($,Q,V,X){if(X===void 0)X=V;Object.defineProperty($,X,{enumerable:!0,get:function(){return Q[V]}})}:function($,Q,V,X){if(X===void 0)X=V;$[X]=Q[V]}),NQ=h&&h.__setModuleDefault||(Object.create?function($,Q){Object.defineProperty($,"default",{enumerable:!0,value:Q})}:function($,Q){$.default=Q}),SQ=h&&h.__importStar||function($){if($&&$.__esModule)return $;var Q={};if($!=null){for(var V in $)if(V!=="default"&&Object.hasOwnProperty.call($,V))DQ(Q,$,V)}return NQ(Q,$),Q};Object.defineProperty(h,"__esModule",{value:!0});h.toPlatformPath=h.toWin32Path=h.toPosixPath=void 0;var _Q=SQ(U("path"));h.toPosixPath=RQ;h.toWin32Path=gQ;h.toPlatformPath=kQ});var Y1=F((B)=>{var hQ=function($,Q){const V=G$.toCommandValue(Q);if(process.env[$]=V,process.env.GITHUB_ENV||"")return l0.issueFileCommand("ENV",l0.prepareKeyValueMessage($,Q));p.issueCommand("set-env",{name:$},V)},uQ=function($){p.issueCommand("add-mask",{},$)},fQ=function($){if(process.env.GITHUB_PATH||"")l0.issueFileCommand("PATH",$);else p.issueCommand("add-path",{},$);process.env.PATH=`${$}${bQ.delimiter}${process.env.PATH}`},B1=function($,Q){const V=process.env[`INPUT_${$.replace(/ /g,"_").toUpperCase()}`]||"";if(Q&&Q.required&&!V)throw new Error(`Input required and not supplied: ${$}`);if(Q&&Q.trimWhitespace===!1)return V;return V.trim()},cQ=function($,Q){const V=B1($,Q).split("\n").filter((X)=>X!=="");if(Q&&Q.trimWhitespace===!1)return V;return V.map((X)=>X.trim())},lQ=function($,Q){const V=["true","True","TRUE"],X=["false","False","FALSE"],J=B1($,Q);if(V.includes(J))return!0;if(X.includes(J))return!1;throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${$}\nSupport boolean input list: \`true | True | TRUE | false | False | FALSE\``)},dQ=function($,Q){if(process.env.GITHUB_OUTPUT||"")return l0.issueFileCommand("OUTPUT",l0.prepareKeyValueMessage($,Q));process.stdout.write(J7.EOL),p.issueCommand("set-output",{name:$},G$.toCommandValue(Q))},iQ=function($){p.issue("echo",$?"on":"off")},pQ=function($){process.exitCode=Z7.Failure,K7($)},aQ=function(){return process.env.RUNNER_DEBUG==="1"},nQ=function($){p.issueCommand("debug",{},$)},K7=function($,Q={}){p.issueCommand("error",G$.toCommandProperties(Q),$ instanceof Error?$.toString():$)},sQ=function($,Q={}){p.issueCommand("warning",G$.toCommandProperties(Q),$ instanceof Error?$.toString():$)},rQ=function($,Q={}){p.issueCommand("notice",G$.toCommandProperties(Q),$ instanceof Error?$.toString():$)},oQ=function($){process.stdout.write($+J7.EOL)},G7=function($){p.issue("group",$)},Y7=function(){p.issue("endgroup")},tQ=function($,Q){return X7(this,void 0,void 0,function*(){G7($);let V;try{V=yield Q()}finally{Y7()}return V})},eQ=function($,Q){if(process.env.GITHUB_STATE||"")return l0.issueFileCommand("STATE",l0.prepareKeyValueMessage($,Q));p.issueCommand("save-state",{name:$},G$.toCommandValue(Q))},$V=function($){return process.env[`STATE_${$}`]||""},QV=function($){return X7(this,void 0,void 0,function*(){return yield EQ.OidcClient.getIDToken($)})},yQ=B&&B.__createBinding||(Object.create?function($,Q,V,X){if(X===void 0)X=V;Object.defineProperty($,X,{enumerable:!0,get:function(){return Q[V]}})}:function($,Q,V,X){if(X===void 0)X=V;$[X]=Q[V]}),mQ=B&&B.__setModuleDefault||(Object.create?function($,Q){Object.defineProperty($,"default",{enumerable:!0,value:Q})}:function($,Q){$.default=Q}),V7=B&&B.__importStar||function($){if($&&$.__esModule)return $;var Q={};if($!=null){for(var V in $)if(V!=="default"&&Object.hasOwnProperty.call($,V))yQ(Q,$,V)}return mQ(Q,$),Q},X7=B&&B.__awaiter||function($,Q,V,X){function J(Z){return Z instanceof V?Z:new V(function(K){K(Z)})}return new(V||(V=Promise))(function(Z,K){function G(z){try{W(X.next(z))}catch(q){K(q)}}function Y(z){try{W(X.throw(z))}catch(q){K(q)}}function W(z){z.done?Z(z.value):J(z.value).then(G,Y)}W((X=X.apply($,Q||[])).next())})};Object.defineProperty(B,"__esModule",{value:!0});B.getIDToken=B.getState=B.saveState=B.group=B.endGroup=B.startGroup=B.info=B.notice=B.warning=B.error=B.debug=B.isDebug=B.setFailed=B.setCommandEcho=B.setOutput=B.getBooleanInput=B.getMultilineInput=B.getInput=B.addPath=B.setSecret=B.exportVariable=B.ExitCode=void 0;var p=h8(),l0=k9(),G$=o$(),J7=V7(U("os")),bQ=V7(U("path")),EQ=t9(),Z7;(function($){$[$.Success=0]="Success",$[$.Failure=1]="Failure"})(Z7=B.ExitCode||(B.ExitCode={}));B.exportVariable=hQ;B.setSecret=uQ;B.addPath=fQ;B.getInput=B1;B.getMultilineInput=cQ;B.getBooleanInput=lQ;B.setOutput=dQ;B.setCommandEcho=iQ;B.setFailed=pQ;B.isDebug=aQ;B.debug=nQ;B.error=K7;B.warning=sQ;B.notice=rQ;B.info=oQ;B.startGroup=G7;B.endGroup=Y7;B.group=tQ;B.saveState=eQ;B.getState=$V;B.getIDToken=QV;var VV=q1();Object.defineProperty(B,"summary",{enumerable:!0,get:function(){return VV.summary}});var XV=q1();Object.defineProperty(B,"markdownSummary",{enumerable:!0,get:function(){return XV.markdownSummary}});var L1=Q7();Object.defineProperty(B,"toPosixPath",{enumerable:!0,get:function(){return L1.toPosixPath}});Object.defineProperty(B,"toWin32Path",{enumerable:!0,get:function(){return L1.toWin32Path}});Object.defineProperty(B,"toPlatformPath",{enumerable:!0,get:function(){return L1.toPlatformPath}})});var F4=F((E3,tX)=>{tX.exports={name:"init-beatsaber",description:"A GitHub Action to initialize a Beat Saber modding environment",version:"1.6.0",author:"BeatForge",private:!0,type:"module",homepage:"https://github.com/beat-forge/init-beatsaber",repository:{type:"git",url:"git+https://github.com/beat-forge/init-beatsaber.git"},bugs:{url:"https://github.com/beat-forge/init-beatsaber/issues"},main:"dist/index.js",engines:{node:">=20"},scripts:{all:"bun run format:write && bun run package","package:node":"bun build --target=node ./src/index.ts --outfile=dist/index.js --minify","package:bun":"bun build --target=bun ./src/index.ts --outfile=dist/index.js --minify","format:write":"prettier --write \"**/*.{ts,tsx}\"",bundle:"bun run format:write && bun run package:node"},license:"AGPL-3.0",dependencies:{"@actions/core":"^1.10.1","@actions/github":"^5.1.1",tar:"^7.4.0"},devDependencies:{"@types/node":"^20.14.10","bun-types":"^1.1.20",prettier:"^3.3.3",typescript:"^5.5.3"}}});var w=j4(Y1(),1);import{promises as J$,createWriteStream as eX} from"fs";import{dirname as v4,join as s5,resolve as n5} from"path";import MV from"events";import u from"fs";import{EventEmitter as F1} from"node:events";import L7 from"node:stream";import{StringDecoder as JV} from"node:string_decoder";var z7=typeof process==="object"&&process?process:{stdout:null,stderr:null},ZV=($)=>!!$&&typeof $==="object"&&($ instanceof c||$ instanceof L7||KV($)||GV($)),KV=($)=>!!$&&typeof $==="object"&&$ instanceof F1&&typeof $.pipe==="function"&&$.pipe!==L7.Writable.prototype.pipe,GV=($)=>!!$&&typeof $==="object"&&$ instanceof F1&&typeof $.write==="function"&&typeof $.end==="function",I0=Symbol("EOF"),P0=Symbol("maybeEmitEnd"),D0=Symbol("emittedEnd"),Z5=Symbol("emittingEnd"),U$=Symbol("emittedError"),K5=Symbol("closed"),W7=Symbol("read"),G5=Symbol("flush"),q7=Symbol("flushChunk"),$0=Symbol("encoding"),Y$=Symbol("decoder"),N=Symbol("flowing"),T$=Symbol("paused"),z$=Symbol("resume"),S=Symbol("buffer"),m=Symbol("pipes"),_=Symbol("bufferLength"),M1=Symbol("bufferPush"),Y5=Symbol("bufferShift"),g=Symbol("objectMode"),O=Symbol("destroyed"),w1=Symbol("error"),A1=Symbol("emitData"),B7=Symbol("emitEnd"),I1=Symbol("emitEnd2"),K0=Symbol("async"),P1=Symbol("abort"),z5=Symbol("aborted"),C$=Symbol("signal"),d0=Symbol("dataListeners"),f=Symbol("discarded"),j$=($)=>Promise.resolve().then($),YV=($)=>$(),zV=($)=>$==="end"||$==="finish"||$==="prefinish",WV=($)=>$ instanceof ArrayBuffer||!!$&&typeof $==="object"&&$.constructor&&$.constructor.name==="ArrayBuffer"&&$.byteLength>=0,qV=($)=>!Buffer.isBuffer($)&&ArrayBuffer.isView($);class v1{src;dest;opts;ondrain;constructor($,Q,V){this.src=$,this.dest=Q,this.opts=V,this.ondrain=()=>$[z$](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors($){}end(){if(this.unpipe(),this.opts.end)this.dest.end()}}class M7 extends v1{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor($,Q,V){super($,Q,V);this.proxyErrors=(X)=>Q.emit("error",X),$.on("error",this.proxyErrors)}}var BV=($)=>!!$.objectMode,LV=($)=>!$.objectMode&&!!$.encoding&&$.encoding!=="buffer";class c extends F1{[N]=!1;[T$]=!1;[m]=[];[S]=[];[g];[$0];[K0];[Y$];[I0]=!1;[D0]=!1;[Z5]=!1;[K5]=!1;[U$]=null;[_]=0;[O]=!1;[C$];[z5]=!1;[d0]=0;[f]=!1;writable=!0;readable=!0;constructor(...$){const Q=$[0]||{};super();if(Q.objectMode&&typeof Q.encoding==="string")throw new TypeError("Encoding and objectMode may not be used together");if(BV(Q))this[g]=!0,this[$0]=null;else if(LV(Q))this[$0]=Q.encoding,this[g]=!1;else this[g]=!1,this[$0]=null;if(this[K0]=!!Q.async,this[Y$]=this[$0]?new JV(this[$0]):null,Q&&Q.debugExposeBuffer===!0)Object.defineProperty(this,"buffer",{get:()=>this[S]});if(Q&&Q.debugExposePipes===!0)Object.defineProperty(this,"pipes",{get:()=>this[m]});const{signal:V}=Q;if(V)if(this[C$]=V,V.aborted)this[P1]();else V.addEventListener("abort",()=>this[P1]())}get bufferLength(){return this[_]}get encoding(){return this[$0]}set encoding($){throw new Error("Encoding must be set at instantiation time")}setEncoding($){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[g]}set objectMode($){throw new Error("objectMode must be set at instantiation time")}get["async"](){return this[K0]}set["async"]($){this[K0]=this[K0]||!!$}[P1](){this[z5]=!0,this.emit("abort",this[C$]?.reason),this.destroy(this[C$]?.reason)}get aborted(){return this[z5]}set aborted($){}write($,Q,V){if(this[z5])return!1;if(this[I0])throw new Error("write after end");if(this[O])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;if(typeof Q==="function")V=Q,Q="utf8";if(!Q)Q="utf8";const X=this[K0]?j$:YV;if(!this[g]&&!Buffer.isBuffer($)){if(qV($))$=Buffer.from($.buffer,$.byteOffset,$.byteLength);else if(WV($))$=Buffer.from($);else if(typeof $!=="string")throw new Error("Non-contiguous data written to non-objectMode stream")}if(this[g]){if(this[N]&&this[_]!==0)this[G5](!0);if(this[N])this.emit("data",$);else this[M1]($);if(this[_]!==0)this.emit("readable");if(V)X(V);return this[N]}if(!$.length){if(this[_]!==0)this.emit("readable");if(V)X(V);return this[N]}if(typeof $==="string"&&!(Q===this[$0]&&!this[Y$]?.lastNeed))$=Buffer.from($,Q);if(Buffer.isBuffer($)&&this[$0])$=this[Y$].write($);if(this[N]&&this[_]!==0)this[G5](!0);if(this[N])this.emit("data",$);else this[M1]($);if(this[_]!==0)this.emit("readable");if(V)X(V);return this[N]}read($){if(this[O])return null;if(this[f]=!1,this[_]===0||$===0||$&&$>this[_])return this[P0](),null;if(this[g])$=null;if(this[S].length>1&&!this[g])this[S]=[this[$0]?this[S].join(""):Buffer.concat(this[S],this[_])];const Q=this[W7]($||null,this[S][0]);return this[P0](),Q}[W7]($,Q){if(this[g])this[Y5]();else{const V=Q;if($===V.length||$===null)this[Y5]();else if(typeof V==="string")this[S][0]=V.slice($),Q=V.slice(0,$),this[_]-=$;else this[S][0]=V.subarray($),Q=V.subarray(0,$),this[_]-=$}if(this.emit("data",Q),!this[S].length&&!this[I0])this.emit("drain");return Q}end($,Q,V){if(typeof $==="function")V=$,$=void 0;if(typeof Q==="function")V=Q,Q="utf8";if($!==void 0)this.write($,Q);if(V)this.once("end",V);if(this[I0]=!0,this.writable=!1,this[N]||!this[T$])this[P0]();return this}[z$](){if(this[O])return;if(!this[d0]&&!this[m].length)this[f]=!0;if(this[T$]=!1,this[N]=!0,this.emit("resume"),this[S].length)this[G5]();else if(this[I0])this[P0]();else this.emit("drain")}resume(){return this[z$]()}pause(){this[N]=!1,this[T$]=!0,this[f]=!1}get destroyed(){return this[O]}get flowing(){return this[N]}get paused(){return this[T$]}[M1]($){if(this[g])this[_]+=1;else this[_]+=$.length;this[S].push($)}[Y5](){if(this[g])this[_]-=1;else this[_]-=this[S][0].length;return this[S].shift()}[G5]($=!1){do;while(this[q7](this[Y5]())&&this[S].length);if(!$&&!this[S].length&&!this[I0])this.emit("drain")}[q7]($){return this.emit("data",$),this[N]}pipe($,Q){if(this[O])return $;this[f]=!1;const V=this[D0];if(Q=Q||{},$===z7.stdout||$===z7.stderr)Q.end=!1;else Q.end=Q.end!==!1;if(Q.proxyErrors=!!Q.proxyErrors,V){if(Q.end)$.end()}else if(this[m].push(!Q.proxyErrors?new v1(this,$,Q):new M7(this,$,Q)),this[K0])j$(()=>this[z$]());else this[z$]();return $}unpipe($){const Q=this[m].find((V)=>V.dest===$);if(Q){if(this[m].length===1){if(this[N]&&this[d0]===0)this[N]=!1;this[m]=[]}else this[m].splice(this[m].indexOf(Q),1);Q.unpipe()}}addListener($,Q){return this.on($,Q)}on($,Q){const V=super.on($,Q);if($==="data"){if(this[f]=!1,this[d0]++,!this[m].length&&!this[N])this[z$]()}else if($==="readable"&&this[_]!==0)super.emit("readable");else if(zV($)&&this[D0])super.emit($),this.removeAllListeners($);else if($==="error"&&this[U$]){const X=Q;if(this[K0])j$(()=>X.call(this,this[U$]));else X.call(this,this[U$])}return V}removeListener($,Q){return this.off($,Q)}off($,Q){const V=super.off($,Q);if($==="data"){if(this[d0]=this.listeners("data").length,this[d0]===0&&!this[f]&&!this[m].length)this[N]=!1}return V}removeAllListeners($){const Q=super.removeAllListeners($);if($==="data"||$===void 0){if(this[d0]=0,!this[f]&&!this[m].length)this[N]=!1}return Q}get emittedEnd(){return this[D0]}[P0](){if(!this[Z5]&&!this[D0]&&!this[O]&&this[S].length===0&&this[I0]){if(this[Z5]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[K5])this.emit("close");this[Z5]=!1}}emit($,...Q){const V=Q[0];if($!=="error"&&$!=="close"&&$!==O&&this[O])return!1;else if($==="data")return!this[g]&&!V?!1:this[K0]?(j$(()=>this[A1](V)),!0):this[A1](V);else if($==="end")return this[B7]();else if($==="close"){if(this[K5]=!0,!this[D0]&&!this[O])return!1;const J=super.emit("close");return this.removeAllListeners("close"),J}else if($==="error"){this[U$]=V,super.emit(w1,V);const J=!this[C$]||this.listeners("error").length?super.emit("error",V):!1;return this[P0](),J}else if($==="resume"){const J=super.emit("resume");return this[P0](),J}else if($==="finish"||$==="prefinish"){const J=super.emit($);return this.removeAllListeners($),J}const X=super.emit($,...Q);return this[P0](),X}[A1]($){for(let V of this[m])if(V.dest.write($)===!1)this.pause();const Q=this[f]?!1:super.emit("data",$);return this[P0](),Q}[B7](){if(this[D0])return!1;return this[D0]=!0,this.readable=!1,this[K0]?(j$(()=>this[I1]()),!0):this[I1]()}[I1](){if(this[Y$]){const Q=this[Y$].end();if(Q){for(let V of this[m])V.dest.write(Q);if(!this[f])super.emit("data",Q)}}for(let Q of this[m])Q.end();const $=super.emit("end");return this.removeAllListeners("end"),$}async collect(){const $=Object.assign([],{dataLength:0});if(!this[g])$.dataLength=0;const Q=this.promise();return this.on("data",(V)=>{if($.push(V),!this[g])$.dataLength+=V.length}),await Q,$}async concat(){if(this[g])throw new Error("cannot concat in objectMode");const $=await this.collect();return this[$0]?$.join(""):Buffer.concat($,$.dataLength)}async promise(){return new Promise(($,Q)=>{this.on(O,()=>Q(new Error("stream destroyed"))),this.on("error",(V)=>Q(V)),this.on("end",()=>$())})}[Symbol.asyncIterator](){this[f]=!1;let $=!1;const Q=async()=>{return this.pause(),$=!0,{value:void 0,done:!0}};return{next:()=>{if($)return Q();const X=this.read();if(X!==null)return Promise.resolve({done:!1,value:X});if(this[I0])return Q();let J,Z;const K=(z)=>{this.off("data",G),this.off("end",Y),this.off(O,W),Q(),Z(z)},G=(z)=>{this.off("error",K),this.off("end",Y),this.off(O,W),this.pause(),J({value:z,done:!!this[I0]})},Y=()=>{this.off("error",K),this.off("data",G),this.off(O,W),Q(),J({done:!0,value:void 0})},W=()=>K(new Error("stream destroyed"));return new Promise((z,q)=>{Z=q,J=z,this.once(O,W),this.once("error",K),this.once("end",Y),this.once("data",G)})},throw:Q,return:Q,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[f]=!1;let $=!1;const Q=()=>{return this.pause(),this.off(w1,Q),this.off(O,Q),this.off("end",Q),$=!0,{done:!0,value:void 0}},V=()=>{if($)return Q();const X=this.read();return X===null?Q():{done:!1,value:X}};return this.once("end",Q),this.once(w1,Q),this.once(O,Q),{next:V,throw:Q,return:Q,[Symbol.iterator](){return this}}}destroy($){if(this[O]){if($)this.emit("error",$);else this.emit(O);return this}this[O]=!0,this[f]=!0,this[S].length=0,this[_]=0;const Q=this;if(typeof Q.close==="function"&&!this[K5])Q.close();if($)this.emit("error",$);else this.emit(O);return this}static get isStream(){return ZV}}var wV=u.writev,S0=Symbol("_autoClose"),V0=Symbol("_close"),D$=Symbol("_ended"),I=Symbol("_fd"),H1=Symbol("_finished"),v0=Symbol("_flags"),x1=Symbol("_flush"),C1=Symbol("_handleChunk"),j1=Symbol("_makeBuf"),S$=Symbol("_mode"),W5=Symbol("_needDrain"),B$=Symbol("_onerror"),L$=Symbol("_onopen"),O1=Symbol("_onread"),W$=Symbol("_onwrite"),_0=Symbol("_open"),Q0=Symbol("_path"),N0=Symbol("_pos"),G0=Symbol("_queue"),q$=Symbol("_read"),U1=Symbol("_readSize"),F0=Symbol("_reading"),N$=Symbol("_remain"),T1=Symbol("_size"),q5=Symbol("_write"),i0=Symbol("_writing"),B5=Symbol("_defaultFlag"),p0=Symbol("_errored");class M$ extends c{[p0]=!1;[I];[Q0];[U1];[F0]=!1;[T1];[N$];[S0];constructor($,Q){Q=Q||{};super(Q);if(this.readable=!0,this.writable=!1,typeof $!=="string")throw new TypeError("path must be a string");if(this[p0]=!1,this[I]=typeof Q.fd==="number"?Q.fd:void 0,this[Q0]=$,this[U1]=Q.readSize||16777216,this[F0]=!1,this[T1]=typeof Q.size==="number"?Q.size:1/0,this[N$]=this[T1],this[S0]=typeof Q.autoClose==="boolean"?Q.autoClose:!0,typeof this[I]==="number")this[q$]();else this[_0]()}get fd(){return this[I]}get path(){return this[Q0]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[_0](){u.open(this[Q0],"r",($,Q)=>this[L$]($,Q))}[L$]($,Q){if($)this[B$]($);else this[I]=Q,this.emit("open",Q),this[q$]()}[j1](){return Buffer.allocUnsafe(Math.min(this[U1],this[N$]))}[q$](){if(!this[F0]){this[F0]=!0;const $=this[j1]();if($.length===0)return process.nextTick(()=>this[O1](null,0,$));u.read(this[I],$,0,$.length,null,(Q,V,X)=>this[O1](Q,V,X))}}[O1]($,Q,V){if(this[F0]=!1,$)this[B$]($);else if(this[C1](Q,V))this[q$]()}[V0](){if(this[S0]&&typeof this[I]==="number"){const $=this[I];this[I]=void 0,u.close($,(Q)=>Q?this.emit("error",Q):this.emit("close"))}}[B$]($){this[F0]=!0,this[V0](),this.emit("error",$)}[C1]($,Q){let V=!1;if(this[N$]-=$,$>0)V=super.write($this[L$]($,Q))}[L$]($,Q){if(this[B5]&&this[v0]==="r+"&&$&&$.code==="ENOENT")this[v0]="w",this[_0]();else if($)this[B$]($);else if(this[I]=Q,this.emit("open",Q),!this[i0])this[x1]()}end($,Q){if($)this.write($,Q);if(this[D$]=!0,!this[i0]&&!this[G0].length&&typeof this[I]==="number")this[W$](null,0);return this}write($,Q){if(typeof $==="string")$=Buffer.from($,Q);if(this[D$])return this.emit("error",new Error("write() after end()")),!1;if(this[I]===void 0||this[i0]||this[G0].length)return this[G0].push($),this[W5]=!0,!1;return this[i0]=!0,this[q5]($),!0}[q5]($){u.write(this[I],$,0,$.length,this[N0],(Q,V)=>this[W$](Q,V))}[W$]($,Q){if($)this[B$]($);else{if(this[N0]!==void 0&&typeof Q==="number")this[N0]+=Q;if(this[G0].length)this[x1]();else if(this[i0]=!1,this[D$]&&!this[H1])this[H1]=!0,this[V0](),this.emit("finish");else if(this[W5])this[W5]=!1,this.emit("drain")}}[x1](){if(this[G0].length===0){if(this[D$])this[W$](null,0)}else if(this[G0].length===1)this[q5](this[G0].pop());else{const $=this[G0];this[G0]=[],wV(this[I],$,this[N0],(Q,V)=>this[W$](Q,V))}}[V0](){if(this[S0]&&typeof this[I]==="number"){const $=this[I];this[I]=void 0,u.close($,(Q)=>Q?this.emit("error",Q):this.emit("close"))}}}class _$ extends R0{[_0](){let $;if(this[B5]&&this[v0]==="r+")try{$=u.openSync(this[Q0],this[v0],this[S$])}catch(Q){if(Q?.code==="ENOENT")return this[v0]="w",this[_0]();else throw Q}else $=u.openSync(this[Q0],this[v0],this[S$]);this[L$](null,$)}[V0](){if(this[S0]&&typeof this[I]==="number"){const $=this[I];this[I]=void 0,u.closeSync($),this.emit("close")}}[q5]($){let Q=!0;try{this[W$](null,u.writeSync(this[I],$,0,$.length,this[N0])),Q=!1}finally{if(Q)try{this[V0]()}catch{}}}}import a7 from"node:path";import I$ from"node:fs";import{dirname as aV,parse as nV} from"path";var AV=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"]]),w7=($)=>!!$.sync&&!!$.file,A7=($)=>!$.sync&&!!$.file,I7=($)=>!!$.sync&&!$.file,P7=($)=>!$.sync&&!$.file;var F7=($)=>!!$.file;var IV=($)=>{const Q=AV.get($);if(Q)return Q;return $},R$=($={})=>{if(!$)return{};const Q={};for(let[V,X]of Object.entries($)){const J=IV(V);Q[J]=X}if(Q.chmod===void 0&&Q.noChmod===!1)Q.chmod=!0;return delete Q.noChmod,Q};var Y0=($,Q,V,X,J)=>{return Object.assign((Z=[],K,G)=>{if(Array.isArray(Z))K=Z,Z={};if(typeof K==="function")G=K,K=void 0;if(!K)K=[];else K=Array.from(K);const Y=R$(Z);if(J?.(Y,K),w7(Y)){if(typeof G==="function")throw new TypeError("callback not supported for sync tar functions");return $(Y,K)}else if(A7(Y)){const W=Q(Y,K),z=G?G:void 0;return z?W.then(()=>z(),z):W}else if(I7(Y)){if(typeof G==="function")throw new TypeError("callback not supported for sync tar functions");return V(Y,K)}else if(P7(Y)){if(typeof G==="function")throw new TypeError("callback only supported with file option");return X(Y,K)}else throw new Error("impossible options??")},{syncFile:$,asyncFile:Q,syncNoFile:V,asyncNoFile:X,validate:J})};import{EventEmitter as dV} from"events";import _1 from"assert";import{Buffer as g0} from"buffer";import vV from"zlib";import PV from"zlib";var FV=PV.constants||{ZLIB_VERNUM:4736},H0=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},FV));var v7=g0.concat,a0=Symbol("_superWrite");class g$ extends Error{code;errno;constructor($){super("zlib: "+$.message);if(this.code=$.code,this.errno=$.errno,!this.code)this.code="ZLIB_ERROR";this.message="zlib: "+$.message,Error.captureStackTrace(this,this.constructor)}get name(){return"ZlibError"}}var S1=Symbol("flushFlag");class R1 extends c{#$=!1;#V=!1;#X;#Z;#J;#Q;#K;get sawError(){return this.#$}get handle(){return this.#Q}get flushFlag(){return this.#X}constructor($,Q){if(!$||typeof $!=="object")throw new TypeError("invalid options for ZlibBase constructor");super($);this.#X=$.flush??0,this.#Z=$.finishFlush??0,this.#J=$.fullFlushFlag??0;try{this.#Q=new vV[Q]($)}catch(V){throw new g$(V)}this.#K=(V)=>{if(this.#$)return;this.#$=!0,this.close(),this.emit("error",V)},this.#Q?.on("error",(V)=>this.#K(new g$(V))),this.once("end",()=>this.close)}close(){if(this.#Q)this.#Q.close(),this.#Q=void 0,this.emit("close")}reset(){if(!this.#$)return _1(this.#Q,"zlib binding closed"),this.#Q.reset?.()}flush($){if(this.ended)return;if(typeof $!=="number")$=this.#J;this.write(Object.assign(g0.alloc(0),{[S1]:$}))}end($,Q,V){if(typeof $==="function")V=$,Q=void 0,$=void 0;if(typeof Q==="function")V=Q,Q=void 0;if($)if(Q)this.write($,Q);else this.write($);return this.flush(this.#Z),this.#V=!0,super.end(V)}get ended(){return this.#V}[a0]($){return super.write($)}write($,Q,V){if(typeof Q==="function")V=Q,Q="utf8";if(typeof $==="string")$=g0.from($,Q);if(this.#$)return;_1(this.#Q,"zlib binding closed");const X=this.#Q._handle,J=X.close;X.close=()=>{};const Z=this.#Q.close;this.#Q.close=()=>{},g0.concat=(Y)=>Y;let K=void 0;try{const Y=typeof $[S1]==="number"?$[S1]:this.#X;K=this.#Q._processChunk($,Y),g0.concat=v7}catch(Y){g0.concat=v7,this.#K(new g$(Y))}finally{if(this.#Q)this.#Q._handle=X,X.close=J,this.#Q.close=Z,this.#Q.removeAllListeners("error")}if(this.#Q)this.#Q.on("error",(Y)=>this.#K(new g$(Y)));let G;if(K)if(Array.isArray(K)&&K.length>0){const Y=K[0];G=this[a0](g0.from(Y));for(let W=1;W{if(typeof X==="function")J=X,X=this.flushFlag;this.flush(X),J?.()};try{this.handle.params($,Q)}finally{this.handle.flush=V}if(this.handle)this.#$=$,this.#V=Q}}}class k1 extends g1{#$;constructor($){super($,"Gzip");this.#$=$&&!!$.portable}[a0]($){if(!this.#$)return super[a0]($);return this.#$=!1,$[9]=255,super[a0]($)}}class y1 extends g1{constructor($){super($,"Unzip")}}class m1 extends R1{constructor($,Q){$=$||{},$.flush=$.flush||H0.BROTLI_OPERATION_PROCESS,$.finishFlush=$.finishFlush||H0.BROTLI_OPERATION_FINISH,$.fullFlushFlag=H0.BROTLI_OPERATION_FLUSH;super($,Q)}}class b1 extends m1{constructor($){super($,"BrotliCompress")}}class E1 extends m1{constructor($){super($,"BrotliDecompress")}}var xV=function($,Q,V){const X=Q,J=Q?Q.next:$.head,Z=new L5(V,X,J,$);if(Z.next===void 0)$.tail=Z;if(Z.prev===void 0)$.head=Z;return $.length++,Z},OV=function($,Q){if($.tail=new L5(Q,$.tail,void 0,$),!$.head)$.head=$.tail;$.length++},UV=function($,Q){if($.head=new L5(Q,void 0,$.head,$),!$.tail)$.tail=$.head;$.length++};class z0{tail;head;length=0;static create($=[]){return new z0($)}constructor($=[]){for(let Q of $)this.push(Q)}*[Symbol.iterator](){for(let $=this.head;$;$=$.next)yield $.value}removeNode($){if($.list!==this)throw new Error("removing node which does not belong to this list");const{next:Q,prev:V}=$;if(Q)Q.prev=V;if(V)V.next=Q;if($===this.head)this.head=Q;if($===this.tail)this.tail=V;return this.length--,$.next=void 0,$.prev=void 0,$.list=void 0,Q}unshiftNode($){if($===this.head)return;if($.list)$.list.removeNode($);const Q=this.head;if($.list=this,$.next=Q,Q)Q.prev=$;if(this.head=$,!this.tail)this.tail=$;this.length++}pushNode($){if($===this.tail)return;if($.list)$.list.removeNode($);const Q=this.tail;if($.list=this,$.prev=Q,Q)Q.next=$;if(this.tail=$,!this.head)this.head=$;this.length++}push(...$){for(let Q=0,V=$.length;Q1)V=Q;else if(this.head)X=this.head.next,V=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var J=0;X;J++)V=$(V,X.value,J),X=X.next;return V}reduceReverse($,Q){let V,X=this.tail;if(arguments.length>1)V=Q;else if(this.tail)X=this.tail.prev,V=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(let J=this.length-1;X;J--)V=$(V,X.value,J),X=X.prev;return V}toArray(){const $=new Array(this.length);for(let Q=0,V=this.head;V;Q++)$[Q]=V.value,V=V.next;return $}toArrayReverse(){const $=new Array(this.length);for(let Q=0,V=this.tail;V;Q++)$[Q]=V.value,V=V.prev;return $}slice($=0,Q=this.length){if(Q<0)Q+=this.length;if($<0)$+=this.length;const V=new z0;if(Q<$||Q<0)return V;if($<0)$=0;if(Q>this.length)Q=this.length;let X=this.head,J=0;for(J=0;!!X&&J<$;J++)X=X.next;for(;!!X&&Jthis.length)Q=this.length;let X=this.length,J=this.tail;for(;!!J&&X>Q;X--)J=J.prev;for(;!!J&&X>$;X--,J=J.prev)V.push(J.value);return V}splice($,Q=0,...V){if($>this.length)$=this.length-1;if($<0)$=this.length+$;let X=this.head;for(let Z=0;!!X&&Z<$;Z++)X=X.next;const J=[];for(let Z=0;!!X&&Z{if(!Number.isSafeInteger($))throw Error("cannot encode number outside of javascript safe integer range");else if($<0)CV($,Q);else TV($,Q);return Q},TV=($,Q)=>{Q[0]=128;for(var V=Q.length;V>1;V--)Q[V-1]=$&255,$=Math.floor($/256)},CV=($,Q)=>{Q[0]=255;var V=!1;$=$*-1;for(var X=Q.length;X>1;X--){var J=$&255;if($=Math.floor($/256),V)Q[X-1]=O7(J);else if(J===0)Q[X-1]=0;else V=!0,Q[X-1]=U7(J)}},x7=($)=>{const Q=$[0],V=Q===128?DV($.subarray(1,$.length)):Q===255?jV($):null;if(V===null)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(V))throw Error("parsed number outside of javascript safe integer range");return V},jV=($)=>{var Q=$.length,V=0,X=!1;for(var J=Q-1;J>-1;J--){var Z=Number($[J]),K;if(X)K=O7(Z);else if(Z===0)K=Z;else X=!0,K=U7(Z);if(K!==0)V-=K*Math.pow(256,Q-J-1)}return V},DV=($)=>{var Q=$.length,V=0;for(var X=Q-1;X>-1;X--){var J=Number($[X]);if(J!==0)V+=J*Math.pow(256,Q-X-1)}return V},O7=($)=>(255^$)&255,U7=($)=>(255^$)+1&255;var M5=($)=>w5.has($);var w5=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"]]),T7=new Map(Array.from(w5).map(($)=>[$[1],$[0]]));class a{cksumValid=!1;needPax=!1;nullBlock=!1;block;path;mode;uid;gid;size;cksum;#$="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor($,Q=0,V,X){if(Buffer.isBuffer($))this.decode($,Q||0,V,X);else if($)this.#V($)}decode($,Q,V,X){if(!Q)Q=0;if(!$||!($.length>=Q+512))throw new Error("need 512 bytes for header");if(this.path=n0($,Q,100),this.mode=k0($,Q+100,8),this.uid=k0($,Q+108,8),this.gid=k0($,Q+116,8),this.size=k0($,Q+124,12),this.mtime=h1($,Q+136,12),this.cksum=k0($,Q+148,12),X)this.#V(X,!0);if(V)this.#V(V);const J=n0($,Q+156,1);if(M5(J))this.#$=J||"0";if(this.#$==="0"&&this.path.slice(-1)==="/")this.#$="5";if(this.#$==="5")this.size=0;if(this.linkpath=n0($,Q+157,100),$.subarray(Q+257,Q+265).toString()==="ustar\x0000")if(this.uname=n0($,Q+265,32),this.gname=n0($,Q+297,32),this.devmaj=k0($,Q+329,8)??0,this.devmin=k0($,Q+337,8)??0,$[Q+475]!==0){const K=n0($,Q+345,155);this.path=K+"/"+this.path}else{const K=n0($,Q+345,130);if(K)this.path=K+"/"+this.path;this.atime=h1($,Q+476,12),this.ctime=h1($,Q+488,12)}let Z=256;for(let K=Q;K{return!(X===null||X===void 0||V==="path"&&Q||V==="linkpath"&&Q||V==="global")})))}encode($,Q=0){if(!$)$=this.block=Buffer.alloc(512);if(this.#$==="Unsupported")this.#$="0";if(!($.length>=Q+512))throw new Error("need 512 bytes for header");const V=this.ctime||this.atime?130:155,X=SV(this.path||"",V),J=X[0],Z=X[1];if(this.needPax=!!X[2],this.needPax=s0($,Q,100,J)||this.needPax,this.needPax=y0($,Q+100,8,this.mode)||this.needPax,this.needPax=y0($,Q+108,8,this.uid)||this.needPax,this.needPax=y0($,Q+116,8,this.gid)||this.needPax,this.needPax=y0($,Q+124,12,this.size)||this.needPax,this.needPax=u1($,Q+136,12,this.mtime)||this.needPax,$[Q+156]=this.#$.charCodeAt(0),this.needPax=s0($,Q+157,100,this.linkpath)||this.needPax,$.write("ustar\x0000",Q+257,8),this.needPax=s0($,Q+265,32,this.uname)||this.needPax,this.needPax=s0($,Q+297,32,this.gname)||this.needPax,this.needPax=y0($,Q+329,8,this.devmaj)||this.needPax,this.needPax=y0($,Q+337,8,this.devmin)||this.needPax,this.needPax=s0($,Q+345,V,Z)||this.needPax,$[Q+475]!==0)this.needPax=s0($,Q+345,155,Z)||this.needPax;else this.needPax=s0($,Q+345,130,Z)||this.needPax,this.needPax=u1($,Q+476,12,this.atime)||this.needPax,this.needPax=u1($,Q+488,12,this.ctime)||this.needPax;let K=256;for(let G=Q;G{let X=$,J="",Z=void 0;const K=w$.parse($).root||".";if(Buffer.byteLength(X)<100)Z=[X,J,!1];else{J=w$.dirname(X),X=w$.basename(X);do if(Buffer.byteLength(X)<=100&&Buffer.byteLength(J)<=Q)Z=[X,J,!1];else if(Buffer.byteLength(X)>100&&Buffer.byteLength(J)<=Q)Z=[X.slice(0,99),J,!0];else X=w$.join(w$.basename(J),X),J=w$.dirname(J);while(J!==K&&Z===void 0);if(!Z)Z=[$.slice(0,99),"",!0]}return Z},n0=($,Q,V)=>$.subarray(Q,Q+V).toString("utf8").replace(/\0.*/,""),h1=($,Q,V)=>_V(k0($,Q,V)),_V=($)=>$===void 0?void 0:new Date($*1000),k0=($,Q,V)=>Number($[Q])&128?x7($.subarray(Q,Q+V)):gV($,Q,V),RV=($)=>isNaN($)?void 0:$,gV=($,Q,V)=>RV(parseInt($.subarray(Q,Q+V).toString("utf8").replace(/\0.*$/,"").trim(),8)),kV={12:8589934591,8:2097151},y0=($,Q,V,X)=>X===void 0?!1:X>kV[V]||X<0?(H7(X,$.subarray(Q,Q+V)),!0):(yV($,Q,V,X),!1),yV=($,Q,V,X)=>$.write(mV(X,V),Q,V,"ascii"),mV=($,Q)=>bV(Math.floor($).toString(8),Q),bV=($,Q)=>($.length===Q-1?$:new Array(Q-$.length-1).join("0")+$+" ")+"\0",u1=($,Q,V,X)=>X===void 0?!1:y0($,Q,V,X.getTime()/1000),EV=new Array(156).join("\0"),s0=($,Q,V,X)=>X===void 0?!1:($.write(X+EV,Q,V,"utf8"),X.length!==Buffer.byteLength(X)||X.length>V);import{basename as hV} from"node:path";class m0{atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor($,Q=!1){this.atime=$.atime,this.charset=$.charset,this.comment=$.comment,this.ctime=$.ctime,this.dev=$.dev,this.gid=$.gid,this.global=Q,this.gname=$.gname,this.ino=$.ino,this.linkpath=$.linkpath,this.mtime=$.mtime,this.nlink=$.nlink,this.path=$.path,this.size=$.size,this.uid=$.uid,this.uname=$.uname}encode(){const $=this.encodeBody();if($==="")return Buffer.allocUnsafe(0);const Q=Buffer.byteLength($),V=512*Math.ceil(1+Q/512),X=Buffer.allocUnsafe(V);for(let J=0;J<512;J++)X[J]=0;new a({path:("PaxHeader/"+hV(this.path??"")).slice(0,99),mode:this.mode||420,uid:this.uid,gid:this.gid,size:Q,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(X),X.write($,512,Q,"utf8");for(let J=Q+512;J=Math.pow(10,Z))Z+=1;return Z+J+X}static parse($,Q,V=!1){return new m0(uV(fV($),Q),V)}}var uV=($,Q)=>Q?Object.assign({},Q,$):$,fV=($)=>$.replace(/\n$/,"").split("\n").reduce(cV,Object.create(null)),cV=($,Q)=>{const V=parseInt(Q,10);if(V!==Buffer.byteLength(Q)+1)return $;Q=Q.slice((V+" ").length);const X=Q.split("="),J=X.shift();if(!J)return $;const Z=J.replace(/^SCHILY\.(dev|ino|nlink)/,"$1"),K=X.join("=");return $[Z]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(Z)?new Date(Number(K)*1000):/^[0-9]+$/.test(K)?+K:K,$};var lV=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,M=lV!=="win32"?($)=>$:($)=>$&&$.replace(/\\/g,"/");class k$ extends c{extended;globalExtended;header;startBlockSize;blockRemain;remain;type;meta=!1;ignore=!1;path;mode;uid;gid;uname;gname;size=0;mtime;atime;ctime;linkpath;dev;ino;nlink;invalid=!1;absolute;unsupported=!1;constructor($,Q,V){super({});switch(this.pause(),this.extended=Q,this.globalExtended=V,this.header=$,this.remain=$.size??0,this.startBlockSize=512*Math.ceil(this.remain/512),this.blockRemain=this.startBlockSize,this.type=$.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=!0;break;default:this.ignore=!0}if(!$.path)throw new Error("no path provided for tar.ReadEntry");if(this.path=M($.path),this.mode=$.mode,this.mode)this.mode=this.mode&4095;if(this.uid=$.uid,this.gid=$.gid,this.uname=$.uname,this.gname=$.gname,this.size=this.remain,this.mtime=$.mtime,this.atime=$.atime,this.ctime=$.ctime,this.linkpath=$.linkpath?M($.linkpath):void 0,this.uname=$.uname,this.gname=$.gname,Q)this.#$(Q);if(V)this.#$(V,!0)}write($){const Q=$.length;if(Q>this.blockRemain)throw new Error("writing more to entry than is appropriate");const V=this.remain,X=this.blockRemain;if(this.remain=Math.max(0,V-Q),this.blockRemain=Math.max(0,X-Q),this.ignore)return!0;if(V>=Q)return super.write($);return super.write($.subarray(0,V))}#$($,Q=!1){if($.path)$.path=M($.path);if($.linkpath)$.linkpath=M($.linkpath);Object.assign(this,Object.fromEntries(Object.entries($).filter(([V,X])=>{return!(X===null||X===void 0||V==="path"&&Q)})))}}var r0=($,Q,V,X={})=>{if($.file)X.file=$.file;if($.cwd)X.cwd=$.cwd;if(X.code=V instanceof Error&&V.code||Q,X.tarCode=Q,!$.strict&&X.recoverable!==!1){if(V instanceof Error)X=Object.assign(V,X),V=V.message;$.emit("warn",Q,V,X)}else if(V instanceof Error)$.emit("error",Object.assign(V,X));else $.emit("error",Object.assign(new Error(`${Q}: ${V}`),X))};var iV=1048576,f1=Buffer.from([31,139]),n=Symbol("state"),o0=Symbol("writeEntry"),x0=Symbol("readEntry"),c1=Symbol("nextEntry"),j7=Symbol("processEntry"),W0=Symbol("extendedHeader"),y$=Symbol("globalExtendedHeader"),b0=Symbol("meta"),D7=Symbol("emitMeta"),v=Symbol("buffer"),O0=Symbol("queue"),E0=Symbol("ended"),l1=Symbol("emittedEnd"),t0=Symbol("emit"),C=Symbol("unzip"),A5=Symbol("consumeChunk"),I5=Symbol("consumeChunkSub"),d1=Symbol("consumeBody"),N7=Symbol("consumeMeta"),S7=Symbol("consumeHeader"),m$=Symbol("consuming"),i1=Symbol("bufferConcat"),P5=Symbol("maybeEnd"),A$=Symbol("writing"),h0=Symbol("aborted"),F5=Symbol("onDone"),e0=Symbol("sawValidEntry"),v5=Symbol("sawNullBlock"),H5=Symbol("sawEOF"),_7=Symbol("closeStream"),pV=()=>!0;class u0 extends dV{file;strict;maxMetaEntrySize;filter;brotli;writable=!0;readable=!1;[O0]=new z0;[v];[x0];[o0];[n]="begin";[b0]="";[W0];[y$];[E0]=!1;[C];[h0]=!1;[e0];[v5]=!1;[H5]=!1;[A$]=!1;[m$]=!1;[l1]=!1;constructor($={}){super();if(this.file=$.file||"",this.on(F5,()=>{if(this[n]==="begin"||this[e0]===!1)this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),$.ondone)this.on(F5,$.ondone);else this.on(F5,()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")});this.strict=!!$.strict,this.maxMetaEntrySize=$.maxMetaEntrySize||iV,this.filter=typeof $.filter==="function"?$.filter:pV;const Q=$.file&&($.file.endsWith(".tar.br")||$.file.endsWith(".tbr"));if(this.brotli=!$.gzip&&$.brotli!==void 0?$.brotli:Q?void 0:!1,this.on("end",()=>this[_7]()),typeof $.onwarn==="function")this.on("warn",$.onwarn);if(typeof $.onReadEntry==="function")this.on("entry",$.onReadEntry)}warn($,Q,V={}){r0(this,$,Q,V)}[S7]($,Q){if(this[e0]===void 0)this[e0]=!1;let V;try{V=new a($,Q,this[W0],this[y$])}catch(X){return this.warn("TAR_ENTRY_INVALID",X)}if(V.nullBlock)if(this[v5]){if(this[H5]=!0,this[n]==="begin")this[n]="header";this[t0]("eof")}else this[v5]=!0,this[t0]("nullBlock");else if(this[v5]=!1,!V.cksumValid)this.warn("TAR_ENTRY_INVALID","checksum failure",{header:V});else if(!V.path)this.warn("TAR_ENTRY_INVALID","path is required",{header:V});else{const X=V.type;if(/^(Symbolic)?Link$/.test(X)&&!V.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:V});else if(!/^(Symbolic)?Link$/.test(X)&&!/^(Global)?ExtendedHeader$/.test(X)&&V.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:V});else{const J=this[o0]=new k$(V,this[W0],this[y$]);if(!this[e0])if(J.remain){const Z=()=>{if(!J.invalid)this[e0]=!0};J.on("end",Z)}else this[e0]=!0;if(J.meta){if(J.size>this.maxMetaEntrySize)J.ignore=!0,this[t0]("ignoredEntry",J),this[n]="ignore",J.resume();else if(J.size>0)this[b0]="",J.on("data",(Z)=>this[b0]+=Z),this[n]="meta"}else if(this[W0]=void 0,J.ignore=J.ignore||!this.filter(J.path,J),J.ignore)this[t0]("ignoredEntry",J),this[n]=J.remain?"ignore":"header",J.resume();else{if(J.remain)this[n]="body";else this[n]="header",J.end();if(!this[x0])this[O0].push(J),this[c1]();else this[O0].push(J)}}}}[_7](){queueMicrotask(()=>this.emit("close"))}[j7]($){let Q=!0;if(!$)this[x0]=void 0,Q=!1;else if(Array.isArray($)){const[V,...X]=$;this.emit(V,...X)}else if(this[x0]=$,this.emit("entry",$),!$.emittedEnd)$.on("end",()=>this[c1]()),Q=!1;return Q}[c1](){do;while(this[j7](this[O0].shift()));if(!this[O0].length){const $=this[x0];if(!$||$.flowing||$.size===$.remain){if(!this[A$])this.emit("drain")}else $.once("drain",()=>this.emit("drain"))}}[d1]($,Q){const V=this[o0];if(!V)throw new Error("attempt to consume body without entry??");const X=V.blockRemain??0,J=X>=$.length&&Q===0?$:$.subarray(Q,Q+X);if(V.write(J),!V.blockRemain)this[n]="header",this[o0]=void 0,V.end();return J.length}[N7]($,Q){const V=this[o0],X=this[d1]($,Q);if(!this[o0]&&V)this[D7](V);return X}[t0]($,Q,V){if(!this[O0].length&&!this[x0])this.emit($,Q,V);else this[O0].push([$,Q,V])}[D7]($){switch(this[t0]("meta",this[b0]),$.type){case"ExtendedHeader":case"OldExtendedHeader":this[W0]=m0.parse(this[b0],this[W0],!1);break;case"GlobalExtendedHeader":this[y$]=m0.parse(this[b0],this[y$],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":{const Q=this[W0]??Object.create(null);this[W0]=Q,Q.path=this[b0].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{const Q=this[W0]||Object.create(null);this[W0]=Q,Q.linkpath=this[b0].replace(/\0.*/,"");break}default:throw new Error("unknown meta: "+$.type)}}abort($){this[h0]=!0,this.emit("abort",$),this.warn("TAR_ABORT",$,{recoverable:!1})}write($,Q,V){if(typeof Q==="function")V=Q,Q=void 0;if(typeof $==="string")$=Buffer.from($,typeof Q==="string"?Q:"utf8");if(this[h0])return V?.(),!1;if((this[C]===void 0||this.brotli===void 0&&this[C]===!1)&&$){if(this[v])$=Buffer.concat([this[v],$]),this[v]=void 0;if($.lengththis[A5](Y)),this[C].on("error",(Y)=>this.abort(Y)),this[C].on("end",()=>{this[E0]=!0,this[A5]()}),this[A$]=!0;const G=!!this[C][K?"end":"write"]($);return this[A$]=!1,V?.(),G}}if(this[A$]=!0,this[C])this[C].write($);else this[A5]($);this[A$]=!1;const J=this[O0].length?!1:this[x0]?this[x0].flowing:!0;if(!J&&!this[O0].length)this[x0]?.once("drain",()=>this.emit("drain"));return V?.(),J}[i1]($){if($&&!this[h0])this[v]=this[v]?Buffer.concat([this[v],$]):$}[P5](){if(this[E0]&&!this[l1]&&!this[h0]&&!this[m$]){this[l1]=!0;const $=this[o0];if($&&$.blockRemain){const Q=this[v]?this[v].length:0;if(this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${$.blockRemain} more bytes, only ${Q} available)`,{entry:$}),this[v])$.write(this[v]);$.end()}this[t0](F5)}}[A5]($){if(this[m$]&&$)this[i1]($);else if(!$&&!this[v])this[P5]();else if($){if(this[m$]=!0,this[v]){this[i1]($);const Q=this[v];this[v]=void 0,this[I5](Q)}else this[I5]($);while(this[v]&&this[v]?.length>=512&&!this[h0]&&!this[H5]){const Q=this[v];this[v]=void 0,this[I5](Q)}this[m$]=!1}if(!this[v]||this[E0])this[P5]()}[I5]($){let Q=0;const V=$.length;while(Q+512<=V&&!this[h0]&&!this[H5])switch(this[n]){case"begin":case"header":this[S7]($,Q),Q+=512;break;case"ignore":case"body":Q+=this[d1]($,Q);break;case"meta":Q+=this[N7]($,Q);break;default:throw new Error("invalid state: "+this[n])}if(Q{let Q=$.length-1,V=-1;while(Q>-1&&$.charAt(Q)==="/")V=Q,Q--;return V===-1?$:$.slice(0,V)};var sV=($)=>{const Q=$.onReadEntry;$.onReadEntry=Q?(V)=>{Q(V),V.resume()}:(V)=>V.resume()},p1=($,Q)=>{const V=new Map(Q.map((Z)=>[q0(Z),!0])),X=$.filter,J=(Z,K="")=>{const G=K||nV(Z).root||".";let Y;if(Z===G)Y=!1;else{const W=V.get(Z);if(W!==void 0)Y=W;else Y=J(aV(Z),G)}return V.set(Z,Y),Y};$.filter=X?(Z,K)=>X(Z,K)&&J(q0(Z)):(Z)=>J(q0(Z))},rV=($)=>{const Q=new u0($),V=$.file;let X;try{const J=I$.statSync(V),Z=$.maxReadSize||16777216;if(J.size{const V=new u0($),X=$.maxReadSize||16777216,J=$.file;return new Promise((K,G)=>{V.on("error",G),V.on("end",K),I$.stat(J,(Y,W)=>{if(Y)G(Y);else{const z=new M$(J,{readSize:X,size:W.size});z.on("error",G),z.pipe(V)}})})},$$=Y0(rV,oV,($)=>new u0($),($)=>new u0($),($,Q)=>{if(Q?.length)p1($,Q);if(!$.noResume)sV($)});import R5 from"fs";import B0 from"fs";import y7 from"path";var a1=($,Q,V)=>{if($&=4095,V)$=($|384)&-19;if(Q){if($&256)$|=64;if($&32)$|=8;if($&4)$|=1}return $};import{win32 as tV} from"node:path";var{isAbsolute:eV,parse:R7}=tV,b$=($)=>{let Q="",V=R7($);while(eV($)||V.root){const X=$.charAt(0)==="/"&&$.slice(0,4)!=="//?/"?"/":V.root;$=$.slice(X.length),Q+=X,V=R7($)}return[Q,$]};var x5=["|","<",">","?",":"],n1=x5.map(($)=>String.fromCharCode(61440+$.charCodeAt(0))),$X=new Map(x5.map(($,Q)=>[$,n1[Q]])),QX=new Map(n1.map(($,Q)=>[$,x5[Q]])),s1=($)=>x5.reduce((Q,V)=>Q.split(V).join($X.get(V)),$),g7=($)=>n1.reduce((Q,V)=>Q.split(V).join(QX.get(V)),$);var u7=($,Q)=>{if(!Q)return M($);return $=M($).replace(/^\.(\/|$)/,""),q0(Q)+"/"+$},VX=16777216,m7=Symbol("process"),b7=Symbol("file"),E7=Symbol("directory"),o1=Symbol("symlink"),h7=Symbol("hardlink"),E$=Symbol("header"),O5=Symbol("read"),t1=Symbol("lstat"),U5=Symbol("onlstat"),e1=Symbol("onread"),$8=Symbol("onreadlink"),Q8=Symbol("openfile"),V8=Symbol("onopenfile"),f0=Symbol("close"),T5=Symbol("mode"),X8=Symbol("awaitDrain"),r1=Symbol("ondrain"),L0=Symbol("prefix");class C5 extends c{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;#$=!1;constructor($,Q={}){const V=R$(Q);super();if(this.path=M($),this.portable=!!V.portable,this.maxReadSize=V.maxReadSize||VX,this.linkCache=V.linkCache||new Map,this.statCache=V.statCache||new Map,this.preservePaths=!!V.preservePaths,this.cwd=M(V.cwd||process.cwd()),this.strict=!!V.strict,this.noPax=!!V.noPax,this.noMtime=!!V.noMtime,this.mtime=V.mtime,this.prefix=V.prefix?M(V.prefix):void 0,typeof V.onwarn==="function")this.on("warn",V.onwarn);let X=!1;if(!this.preservePaths){const[Z,K]=b$(this.path);if(Z&&typeof K==="string")this.path=K,X=Z}if(this.win32=!!V.win32||process.platform==="win32",this.win32)this.path=g7(this.path.replace(/\\/g,"/")),$=$.replace(/\\/g,"/");if(this.absolute=M(V.absolute||y7.resolve(this.cwd,$)),this.path==="")this.path="./";if(X)this.warn("TAR_ENTRY_INFO",`stripping ${X} from absolute path`,{entry:this,path:X+this.path});const J=this.statCache.get(this.absolute);if(J)this[U5](J);else this[t1]()}warn($,Q,V={}){return r0(this,$,Q,V)}emit($,...Q){if($==="error")this.#$=!0;return super.emit($,...Q)}[t1](){B0.lstat(this.absolute,($,Q)=>{if($)return this.emit("error",$);this[U5](Q)})}[U5]($){if(this.statCache.set(this.absolute,$),this.stat=$,!$.isFile())$.size=0;this.type=XX($),this.emit("stat",$),this[m7]()}[m7](){switch(this.type){case"File":return this[b7]();case"Directory":return this[E7]();case"SymbolicLink":return this[o1]();default:return this.end()}}[T5]($){return a1($,this.type==="Directory",this.portable)}[L0]($){return u7($,this.prefix)}[E$](){if(!this.stat)throw new Error("cannot write header before stat");if(this.type==="Directory"&&this.portable)this.noMtime=!0;if(this.header=new a({path:this[L0](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[L0](this.linkpath):this.linkpath,mode:this[T5](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 m0({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[L0](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[L0](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());const $=this.header?.block;if(!$)throw new Error("failed to encode header");super.write($)}[E7](){if(!this.stat)throw new Error("cannot create directory entry without stat");if(this.path.slice(-1)!=="/")this.path+="/";this.stat.size=0,this[E$](),this.end()}[o1](){B0.readlink(this.absolute,($,Q)=>{if($)return this.emit("error",$);this[$8](Q)})}[$8]($){this.linkpath=M($),this[E$](),this.end()}[h7]($){if(!this.stat)throw new Error("cannot create link entry without stat");this.type="Link",this.linkpath=M(y7.relative(this.cwd,$)),this.stat.size=0,this[E$](),this.end()}[b7](){if(!this.stat)throw new Error("cannot create file entry without stat");if(this.stat.nlink>1){const $=`${this.stat.dev}:${this.stat.ino}`,Q=this.linkCache.get($);if(Q?.indexOf(this.cwd)===0)return this[h7](Q);this.linkCache.set($,this.absolute)}if(this[E$](),this.stat.size===0)return this.end();this[Q8]()}[Q8](){B0.open(this.absolute,"r",($,Q)=>{if($)return this.emit("error",$);this[V8](Q)})}[V8]($){if(this.fd=$,this.#$)return this[f0]();if(!this.stat)throw new Error("should stat before calling onopenfile");this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;const Q=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(Q),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[O5]()}[O5](){const{fd:$,buf:Q,offset:V,length:X,pos:J}=this;if($===void 0||Q===void 0)throw new Error("cannot read file without first opening");B0.read($,Q,V,X,J,(Z,K)=>{if(Z)return this[f0](()=>this.emit("error",Z));this[e1](K)})}[f0]($=()=>{}){if(this.fd!==void 0)B0.close(this.fd,$)}[e1]($){if($<=0&&this.remain>0){const X=Object.assign(new Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[f0](()=>this.emit("error",X))}if($>this.remain){const X=Object.assign(new Error("did not encounter expected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[f0](()=>this.emit("error",X))}if(!this.buf)throw new Error("should have created buffer prior to reading");if($===this.remain)for(let X=$;Xthis[r1]());else this[r1]()}[X8]($){this.once("drain",$)}write($,Q,V){if(typeof Q==="function")V=Q,Q=void 0;if(typeof $==="string")$=Buffer.from($,typeof Q==="string"?Q:"utf8");if(this.blockRemain<$.length){const X=Object.assign(new Error("writing more data than expected"),{path:this.absolute});return this.emit("error",X)}return this.remain-=$.length,this.blockRemain-=$.length,this.pos+=$.length,this.offset+=$.length,super.write($,null,V)}[r1](){if(!this.remain){if(this.blockRemain)super.write(Buffer.alloc(this.blockRemain));return this[f0](($)=>$?this.emit("error",$):this.end())}if(!this.buf)throw new Error("buffer lost somehow in ONDRAIN");if(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[O5]()}}class J8 extends C5{sync=!0;[t1](){this[U5](B0.lstatSync(this.absolute))}[o1](){this[$8](B0.readlinkSync(this.absolute))}[Q8](){this[V8](B0.openSync(this.absolute,"r"))}[O5](){let $=!0;try{const{fd:Q,buf:V,offset:X,length:J,pos:Z}=this;if(Q===void 0||V===void 0)throw new Error("fd and buf must be set in READ method");const K=B0.readSync(Q,V,X,J,Z);this[e1](K),$=!1}finally{if($)try{this[f0](()=>{})}catch(Q){}}}[X8]($){$()}[f0]($=()=>{}){if(this.fd!==void 0)B0.closeSync(this.fd);$()}}class Z8 extends c{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;warn($,Q,V={}){return r0(this,$,Q,V)}constructor($,Q={}){const V=R$(Q);super();this.preservePaths=!!V.preservePaths,this.portable=!!V.portable,this.strict=!!V.strict,this.noPax=!!V.noPax,this.noMtime=!!V.noMtime,this.readEntry=$;const{type:X}=$;if(X==="Unsupported")throw new Error("writing entry that should be ignored");if(this.type=X,this.type==="Directory"&&this.portable)this.noMtime=!0;if(this.prefix=V.prefix,this.path=M($.path),this.mode=$.mode!==void 0?this[T5]($.mode):void 0,this.uid=this.portable?void 0:$.uid,this.gid=this.portable?void 0:$.gid,this.uname=this.portable?void 0:$.uname,this.gname=this.portable?void 0:$.gname,this.size=$.size,this.mtime=this.noMtime?void 0:V.mtime||$.mtime,this.atime=this.portable?void 0:$.atime,this.ctime=this.portable?void 0:$.ctime,this.linkpath=$.linkpath!==void 0?M($.linkpath):void 0,typeof V.onwarn==="function")this.on("warn",V.onwarn);let J=!1;if(!this.preservePaths){const[K,G]=b$(this.path);if(K&&typeof G==="string")this.path=G,J=K}if(this.remain=$.size,this.blockRemain=$.startBlockSize,this.header=new a({path:this[L0](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[L0](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}),J)this.warn("TAR_ENTRY_INFO",`stripping ${J} from absolute path`,{entry:this,path:J+this.path});if(this.header.encode()&&!this.noPax)super.write(new m0({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[L0](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[L0](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());const Z=this.header?.block;if(!Z)throw new Error("failed to encode header");super.write(Z),$.pipe(this)}[L0]($){return u7($,this.prefix)}[T5]($){return a1($,this.type==="Directory",this.portable)}write($,Q,V){if(typeof Q==="function")V=Q,Q=void 0;if(typeof $==="string")$=Buffer.from($,typeof Q==="string"?Q:"utf8");const X=$.length;if(X>this.blockRemain)throw new Error("writing more to entry than is appropriate");return this.blockRemain-=X,super.write($,V)}end($,Q,V){if(this.blockRemain)super.write(Buffer.alloc(this.blockRemain));if(typeof $==="function")V=$,Q=void 0,$=void 0;if(typeof Q==="function")V=Q,Q=void 0;if(typeof $==="string")$=Buffer.from($,Q??"utf8");if(V)this.once("finish",V);return $?super.end($,V):super.end(V),this}}var XX=($)=>$.isFile()?"File":$.isDirectory()?"Directory":$.isSymbolicLink()?"SymbolicLink":"Unsupported";import i7 from"path";class z8{path;absolute;entry;stat;readdir;pending=!1;ignore=!1;piped=!1;constructor($,Q){this.path=$||"./",this.absolute=Q}}var f7=Buffer.alloc(1024),j5=Symbol("onStat"),h$=Symbol("ended"),X0=Symbol("queue"),P$=Symbol("current"),Q$=Symbol("process"),u$=Symbol("processing"),c7=Symbol("processJob"),J0=Symbol("jobs"),K8=Symbol("jobDone"),D5=Symbol("addFSEntry"),l7=Symbol("addTarEntry"),W8=Symbol("stat"),q8=Symbol("readdir"),N5=Symbol("onreaddir"),S5=Symbol("pipe"),d7=Symbol("entry"),G8=Symbol("entryOpt"),_5=Symbol("writeEntryClass"),p7=Symbol("write"),Y8=Symbol("ondrain");class V$ extends c{opt;cwd;maxReadSize;preservePaths;strict;noPax;prefix;linkCache;statCache;file;portable;zip;readdirCache;noDirRecurse;follow;noMtime;mtime;filter;jobs;[_5];onWriteEntry;[X0];[J0]=0;[u$]=!1;[h$]=!1;constructor($={}){super();if(this.opt=$,this.file=$.file||"",this.cwd=$.cwd||process.cwd(),this.maxReadSize=$.maxReadSize,this.preservePaths=!!$.preservePaths,this.strict=!!$.strict,this.noPax=!!$.noPax,this.prefix=M($.prefix||""),this.linkCache=$.linkCache||new Map,this.statCache=$.statCache||new Map,this.readdirCache=$.readdirCache||new Map,this.onWriteEntry=$.onWriteEntry,this[_5]=C5,typeof $.onwarn==="function")this.on("warn",$.onwarn);if(this.portable=!!$.portable,$.gzip||$.brotli){if($.gzip&&$.brotli)throw new TypeError("gzip and brotli are mutually exclusive");if($.gzip){if(typeof $.gzip!=="object")$.gzip={};if(this.portable)$.gzip.portable=!0;this.zip=new k1($.gzip)}if($.brotli){if(typeof $.brotli!=="object")$.brotli={};this.zip=new b1($.brotli)}if(!this.zip)throw new Error("impossible");const Q=this.zip;Q.on("data",(V)=>super.write(V)),Q.on("end",()=>super.end()),Q.on("drain",()=>this[Y8]()),this.on("resume",()=>Q.resume())}else this.on("drain",this[Y8]);if(this.noDirRecurse=!!$.noDirRecurse,this.follow=!!$.follow,this.noMtime=!!$.noMtime,$.mtime)this.mtime=$.mtime;this.filter=typeof $.filter==="function"?$.filter:()=>!0,this[X0]=new z0,this[J0]=0,this.jobs=Number($.jobs)||4,this[u$]=!1,this[h$]=!1}[p7]($){return super.write($)}add($){return this.write($),this}end($){if($)this.add($);return this[h$]=!0,this[Q$](),this}write($){if(this[h$])throw new Error("write after end");if($ instanceof k$)this[l7]($);else this[D5]($);return this.flowing}[l7]($){const Q=M(i7.resolve(this.cwd,$.path));if(!this.filter($.path,$))$.resume();else{const V=new z8($.path,Q);V.entry=new Z8($,this[G8](V)),V.entry.on("end",()=>this[K8](V)),this[J0]+=1,this[X0].push(V)}this[Q$]()}[D5]($){const Q=M(i7.resolve(this.cwd,$));this[X0].push(new z8($,Q)),this[Q$]()}[W8]($){$.pending=!0,this[J0]+=1;const Q=this.follow?"stat":"lstat";R5[Q]($.absolute,(V,X)=>{if($.pending=!1,this[J0]-=1,V)this.emit("error",V);else this[j5]($,X)})}[j5]($,Q){if(this.statCache.set($.absolute,Q),$.stat=Q,!this.filter($.path,Q))$.ignore=!0;this[Q$]()}[q8]($){$.pending=!0,this[J0]+=1,R5.readdir($.absolute,(Q,V)=>{if($.pending=!1,this[J0]-=1,Q)return this.emit("error",Q);this[N5]($,V)})}[N5]($,Q){this.readdirCache.set($.absolute,Q),$.readdir=Q,this[Q$]()}[Q$](){if(this[u$])return;this[u$]=!0;for(let $=this[X0].head;!!$&&this[J0]this.warn(Q,V,X),noPax:this.noPax,cwd:this.cwd,absolute:$.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}}[d7]($){this[J0]+=1;try{const Q=new this[_5]($.path,this[G8]($));return this.onWriteEntry?.(Q),Q.on("end",()=>this[K8]($)).on("error",(V)=>this.emit("error",V))}catch(Q){this.emit("error",Q)}}[Y8](){if(this[P$]&&this[P$].entry)this[P$].entry.resume()}[S5]($){if($.piped=!0,$.readdir)$.readdir.forEach((X)=>{const J=$.path,Z=J==="./"?"":J.replace(/\/*$/,"/");this[D5](Z+X)});const Q=$.entry,V=this.zip;if(!Q)throw new Error("cannot pipe without source");if(V)Q.on("data",(X)=>{if(!V.write(X))Q.pause()});else Q.on("data",(X)=>{if(!super.write(X))Q.pause()})}pause(){if(this.zip)this.zip.pause();return super.pause()}warn($,Q,V={}){r0(this,$,Q,V)}}class F$ extends V${sync=!0;constructor($){super($);this[_5]=J8}pause(){}resume(){}[W8]($){const Q=this.follow?"statSync":"lstatSync";this[j5]($,R5[Q]($.absolute))}[q8]($){this[N5]($,R5.readdirSync($.absolute))}[S5]($){const Q=$.entry,V=this.zip;if($.readdir)$.readdir.forEach((X)=>{const J=$.path,Z=J==="./"?"":J.replace(/\/*$/,"/");this[D5](Z+X)});if(!Q)throw new Error("Cannot pipe without source");if(V)Q.on("data",(X)=>{V.write(X)});else Q.on("data",(X)=>{super[p7](X)})}}var JX=($,Q)=>{const V=new F$($),X=new _$($.file,{mode:$.mode||438});V.pipe(X),n7(V,Q)},ZX=($,Q)=>{const V=new V$($),X=new R0($.file,{mode:$.mode||438});V.pipe(X);const J=new Promise((Z,K)=>{X.on("error",K),X.on("close",Z),V.on("error",K)});return s7(V,Q),J},n7=($,Q)=>{Q.forEach((V)=>{if(V.charAt(0)==="@")$$({file:a7.resolve($.cwd,V.slice(1)),sync:!0,noResume:!0,onReadEntry:(X)=>$.add(X)});else $.add(V)}),$.end()},s7=async($,Q)=>{for(let V=0;V{$.add(J)}});else $.add(X)}$.end()},KX=($,Q)=>{const V=new F$($);return n7(V,Q),V},GX=($,Q)=>{const V=new V$($);return s7(V,Q),V},YX=Y0(JX,ZX,KX,GX,($,Q)=>{if(!Q?.length)throw new TypeError("no paths specified to add to archive")});import I4 from"node:fs";import yX from"node:assert";import{randomBytes as A4} from"node:crypto";import A from"node:fs";import T0 from"node:path";import r7 from"fs";var zX=process.env.__FAKE_PLATFORM__||process.platform,WX=zX==="win32",{O_CREAT:qX,O_TRUNC:BX,O_WRONLY:LX}=r7.constants,o7=Number(process.env.__FAKE_FS_O_FILENAME__)||r7.constants.UV_FS_O_FILEMAP||0,MX=WX&&!!o7,wX=524288,AX=o7|BX|qX|LX,B8=!MX?()=>"w":($)=>${try{return k5.lchownSync($,Q,V)}catch(X){if(X?.code!=="ENOENT")throw X}},g5=($,Q,V,X)=>{k5.lchown($,Q,V,(J)=>{X(J&&J?.code!=="ENOENT"?J:null)})},IX=($,Q,V,X,J)=>{if(Q.isDirectory())M8(f$.resolve($,Q.name),V,X,(Z)=>{if(Z)return J(Z);const K=f$.resolve($,Q.name);g5(K,V,X,J)});else{const Z=f$.resolve($,Q.name);g5(Z,V,X,J)}},M8=($,Q,V,X)=>{k5.readdir($,{withFileTypes:!0},(J,Z)=>{if(J){if(J.code==="ENOENT")return X();else if(J.code!=="ENOTDIR"&&J.code!=="ENOTSUP")return X(J)}if(J||!Z.length)return g5($,Q,V,X);let K=Z.length,G=null;const Y=(W)=>{if(G)return;if(W)return X(G=W);if(--K===0)return g5($,Q,V,X)};for(let W of Z)IX($,W,Q,V,Y)})},PX=($,Q,V,X)=>{if(Q.isDirectory())w8(f$.resolve($,Q.name),V,X);L8(f$.resolve($,Q.name),V,X)},w8=($,Q,V)=>{let X;try{X=k5.readdirSync($,{withFileTypes:!0})}catch(J){const Z=J;if(Z?.code==="ENOENT")return;else if(Z?.code==="ENOTDIR"||Z?.code==="ENOTSUP")return L8($,Q,V);else throw Z}for(let J of X)PX($,J,Q,V);return L8($,Q,V)};import r from"fs";import{dirname as t7} from"path";import{mkdir as FX,mkdirSync as vX,stat as HX,statSync as xX} from"fs";var s=($)=>{if(!$)$={mode:511};else if(typeof $==="object")$={mode:511,...$};else if(typeof $==="number")$={mode:$};else if(typeof $==="string")$={mode:parseInt($,8)};else throw new TypeError("invalid options argument");const Q=$,V=$.fs||{};return $.mkdir=$.mkdir||V.mkdir||FX,$.mkdirAsync=$.mkdirAsync?$.mkdirAsync:async(X,J)=>{return new Promise((Z,K)=>Q.mkdir(X,J,(G,Y)=>G?K(G):Z(Y)))},$.stat=$.stat||V.stat||HX,$.statAsync=$.statAsync?$.statAsync:async(X)=>new Promise((J,Z)=>Q.stat(X,(K,G)=>K?Z(K):J(G))),$.statSync=$.statSync||V.statSync||xX,$.mkdirSync=$.mkdirSync||V.mkdirSync||vX,Q};var M0=($,Q,V)=>{const X=t7($),J={...s(Q),recursive:!1};if(X===$)try{return J.mkdirSync($,J)}catch(Z){const K=Z;if(K&&K.code!=="EISDIR")throw Z;return}try{return J.mkdirSync($,J),V||$}catch(Z){const K=Z;if(K&&K.code==="ENOENT")return M0($,J,M0(X,J,V));if(K&&K.code!=="EEXIST"&&K&&K.code!=="EROFS")throw Z;try{if(!J.statSync($).isDirectory())throw Z}catch(G){throw Z}}},U0=Object.assign(async($,Q,V)=>{const X=s(Q);X.recursive=!1;const J=t7($);if(J===$)return X.mkdirAsync($,X).catch((Z)=>{const K=Z;if(K&&K.code!=="EISDIR")throw Z});return X.mkdirAsync($,X).then(()=>V||$,async(Z)=>{const K=Z;if(K&&K.code==="ENOENT")return U0(J,X).then((G)=>U0($,X,G));if(K&&K.code!=="EEXIST"&&K.code!=="EROFS")throw Z;return X.statAsync($).then((G)=>{if(G.isDirectory())return V;else throw Z},()=>{throw Z})})},{sync:M0});import{dirname as $4} from"path";import{dirname as e7} from"path";var A8=async($,Q,V)=>{if(V===Q)return;return $.statAsync(Q).then((X)=>X.isDirectory()?V:void 0,(X)=>{const J=X;return J&&J.code==="ENOENT"?A8($,e7(Q),Q):void 0})},I8=($,Q,V)=>{if(V===Q)return;try{return $.statSync(Q).isDirectory()?V:void 0}catch(X){const J=X;return J&&J.code==="ENOENT"?I8($,e7(Q),Q):void 0}};var v$=($,Q)=>{const V=s(Q);if(V.recursive=!0,$4($)===$)return V.mkdirSync($,V);const J=I8(V,$);try{return V.mkdirSync($,V),J}catch(Z){const K=Z;if(K&&K.code==="ENOENT")return M0($,V);else throw Z}},c$=Object.assign(async($,Q)=>{const V={...s(Q),recursive:!0};if($4($)===$)return await V.mkdirAsync($,V);return A8(V,$).then((J)=>V.mkdirAsync($,V).then((Z)=>J||Z).catch((Z)=>{const K=Z;if(K&&K.code==="ENOENT")return U0($,V);else throw Z}))},{sync:v$});import{parse as UX,resolve as TX} from"path";var OX=process.env.__TESTING_MKDIRP_PLATFORM__||process.platform,P8=($)=>{if(/\0/.test($))throw Object.assign(new TypeError("path must be a string without null bytes"),{path:$,code:"ERR_INVALID_ARG_VALUE"});if($=TX($),OX==="win32"){const Q=/[*|"<>?:]/,{root:V}=UX($);if(Q.test($.substring(V.length)))throw Object.assign(new Error("Illegal characters in path."),{path:$,code:"EINVAL"})}return $};import{mkdir as CX,mkdirSync as jX} from"fs";var DX=process.env.__TESTING_MKDIRP_NODE_VERSION__||process.version,F8=DX.replace(/^v/,"").split("."),Q4=+F8[0]>10||+F8[0]===10&&+F8[1]>=12,l$=!Q4?()=>!1:($)=>s($).mkdirSync===jX,y5=Object.assign(!Q4?()=>!1:($)=>s($).mkdir===CX,{sync:l$});var m5=($,Q)=>{$=P8($);const V=s(Q);return l$(V)?v$($,V):M0($,V)};var V4=Object.assign(async($,Q)=>{$=P8($);const V=s(Q);return y5(V)?c$($,V):U0($,V)},{mkdirpSync:m5,mkdirpNative:c$,mkdirpNativeSync:v$,mkdirpManual:U0,mkdirpManualSync:M0,sync:m5,native:c$,nativeSync:v$,manual:U0,manualSync:M0,useNative:y5,useNativeSync:l$});import h5 from"node:path";class b5 extends Error{path;code;syscall="chdir";constructor($,Q){super(`${Q}: Cannot cd into '${$}'`);this.path=$,this.code=Q}get name(){return"CwdError"}}class E5 extends Error{path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor($,Q){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link");this.symlink=$,this.path=Q}get name(){return"SymlinkError"}}var u5=($,Q)=>$.get(M(Q)),d$=($,Q,V)=>$.set(M(Q),V),NX=($,Q)=>{r.stat($,(V,X)=>{if(V||!X.isDirectory())V=new b5($,V?.code||"ENOTDIR");Q(V)})},X4=($,Q,V)=>{$=M($);const X=Q.umask??18,J=Q.mode|448,Z=(J&X)!==0,K=Q.uid,G=Q.gid,Y=typeof K==="number"&&typeof G==="number"&&(K!==Q.processUid||G!==Q.processGid),W=Q.preserve,z=Q.unlink,q=Q.cache,L=M(Q.cwd),H=(b,D)=>{if(b)V(b);else if(d$(q,$,!0),D&&Y)M8(D,K,G,(S8)=>H(S8));else if(Z)r.chmod($,J,V);else V()};if(q&&u5(q,$)===!0)return H();if($===L)return NX($,H);if(W)return V4($,{mode:J}).then((b)=>H(null,b??void 0),H);const j=M(h5.relative(L,$)).split("/");f5(L,j,J,q,z,L,void 0,H)},f5=($,Q,V,X,J,Z,K,G)=>{if(!Q.length)return G(null,K);const Y=Q.shift(),W=M(h5.resolve($+"/"+Y));if(u5(X,W))return f5(W,Q,V,X,J,Z,K,G);r.mkdir(W,V,J4(W,Q,V,X,J,Z,K,G))},J4=($,Q,V,X,J,Z,K,G)=>(Y)=>{if(Y)r.lstat($,(W,z)=>{if(W)W.path=W.path&&M(W.path),G(W);else if(z.isDirectory())f5($,Q,V,X,J,Z,K,G);else if(J)r.unlink($,(q)=>{if(q)return G(q);r.mkdir($,V,J4($,Q,V,X,J,Z,K,G))});else if(z.isSymbolicLink())return G(new E5($,$+"/"+Q.join("/")));else G(Y)});else K=K||$,f5($,Q,V,X,J,Z,K,G)},SX=($)=>{let Q=!1,V=void 0;try{Q=r.statSync($).isDirectory()}catch(X){V=X?.code}finally{if(!Q)throw new b5($,V??"ENOTDIR")}},Z4=($,Q)=>{$=M($);const V=Q.umask??18,X=Q.mode|448,J=(X&V)!==0,Z=Q.uid,K=Q.gid,G=typeof Z==="number"&&typeof K==="number"&&(Z!==Q.processUid||K!==Q.processGid),Y=Q.preserve,W=Q.unlink,z=Q.cache,q=M(Q.cwd),L=(b)=>{if(d$(z,$,!0),b&&G)w8(b,Z,K);if(J)r.chmodSync($,X)};if(z&&u5(z,$)===!0)return L();if($===q)return SX(q),L();if(Y)return L(m5($,X)??void 0);const T=M(h5.relative(q,$)).split("/");let j=void 0;for(let b=T.shift(),D=q;b&&(D+="/"+b);b=T.shift()){if(D=M(h5.resolve(D)),u5(z,D))continue;try{r.mkdirSync(D,X),j=j||D,d$(z,D,!0)}catch(S8){const _8=r.lstatSync(D);if(_8.isDirectory()){d$(z,D,!0);continue}else if(W){r.unlinkSync(D),r.mkdirSync(D,X),j=j||D,d$(z,D,!0);continue}else if(_8.isSymbolicLink())return new E5(D,D+"/"+T.join("/"))}}return L(j)};var v8=Object.create(null),{hasOwnProperty:_X}=Object.prototype,c5=($)=>{if(!_X.call(v8,$))v8[$]=$.normalize("NFD");return v8[$]};import{join as K4} from"node:path";var RX=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,gX=RX==="win32",kX=($)=>{return $.split("/").slice(0,-1).reduce((V,X)=>{const J=V[V.length-1];if(J!==void 0)X=K4(J,X);return V.push(X||"/"),V},[])};class H8{#$=new Map;#V=new Map;#X=new Set;reserve($,Q){$=gX?["win32 parallelization disabled"]:$.map((X)=>{return q0(K4(c5(X))).toLowerCase()});const V=new Set($.map((X)=>kX(X)).reduce((X,J)=>X.concat(J)));this.#V.set(Q,{dirs:V,paths:$});for(let X of $){const J=this.#$.get(X);if(!J)this.#$.set(X,[Q]);else J.push(Q)}for(let X of V){const J=this.#$.get(X);if(!J)this.#$.set(X,[new Set([Q])]);else{const Z=J[J.length-1];if(Z instanceof Set)Z.add(Q);else J.push(new Set([Q]))}}return this.#J(Q)}#Z($){const Q=this.#V.get($);if(!Q)throw new Error("function does not have any path reservations");return{paths:Q.paths.map((V)=>this.#$.get(V)),dirs:[...Q.dirs].map((V)=>this.#$.get(V))}}check($){const{paths:Q,dirs:V}=this.#Z($);return Q.every((X)=>X&&X[0]===$)&&V.every((X)=>X&&X[0]instanceof Set&&X[0].has($))}#J($){if(this.#X.has($)||!this.check($))return!1;return this.#X.add($),$(()=>this.#Q($)),!0}#Q($){if(!this.#X.has($))return!1;const Q=this.#V.get($);if(!Q)throw new Error("invalid reservation");const{paths:V,dirs:X}=Q,J=new Set;for(let Z of V){const K=this.#$.get(Z);if(!K||K?.[0]!==$)continue;const G=K[1];if(!G){this.#$.delete(Z);continue}if(K.shift(),typeof G==="function")J.add(G);else for(let Y of G)J.add(Y)}for(let Z of X){const K=this.#$.get(Z),G=K?.[0];if(!K||!(G instanceof Set))continue;if(G.size===1&&K.length===1){this.#$.delete(Z);continue}else if(G.size===1){K.shift();const Y=K[0];if(typeof Y==="function")J.add(Y)}else G.delete($)}return this.#X.delete($),J.forEach((Z)=>this.#J(Z)),!0}}var G4=Symbol("onEntry"),U8=Symbol("checkFs"),Y4=Symbol("checkFs2"),i5=Symbol("pruneCache"),T8=Symbol("isReusable"),o=Symbol("makeFs"),C8=Symbol("file"),j8=Symbol("directory"),p5=Symbol("link"),z4=Symbol("symlink"),W4=Symbol("hardlink"),q4=Symbol("unsupported"),B4=Symbol("checkPath"),c0=Symbol("mkdir"),k=Symbol("onError"),l5=Symbol("pending"),L4=Symbol("pend"),H$=Symbol("unpend"),x8=Symbol("ended"),O8=Symbol("maybeClose"),D8=Symbol("skip"),i$=Symbol("doChown"),p$=Symbol("uid"),a$=Symbol("gid"),n$=Symbol("checkedCwd"),mX=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,s$=mX==="win32",bX=1024,EX=($,Q)=>{if(!s$)return A.unlink($,Q);const V=$+".DELETE."+A4(16).toString("hex");A.rename($,V,(X)=>{if(X)return Q(X);A.unlink(V,Q)})},hX=($)=>{if(!s$)return A.unlinkSync($);const Q=$+".DELETE."+A4(16).toString("hex");A.renameSync($,Q),A.unlinkSync(Q)},M4=($,Q,V)=>$!==void 0&&$===$>>>0?$:Q!==void 0&&Q===Q>>>0?Q:V,w4=($)=>q0(M(c5($))).toLowerCase(),uX=($,Q)=>{Q=w4(Q);for(let V of $.keys()){const X=w4(V);if(X===Q||X.indexOf(Q+"/")===0)$.delete(V)}},fX=($)=>{for(let Q of $.keys())$.delete(Q)};class r$ extends u0{[x8]=!1;[n$]=!1;[l5]=0;reservations=new H8;transform;writable=!0;readable=!1;dirCache;uid;gid;setOwner;preserveOwner;processGid;processUid;maxDepth;forceChown;win32;newer;keep;noMtime;preservePaths;unlink;cwd;strip;processUmask;umask;dmode;fmode;chmod;constructor($={}){$.ondone=()=>{this[x8]=!0,this[O8]()};super($);if(this.transform=$.transform,this.dirCache=$.dirCache||new Map,this.chmod=!!$.chmod,typeof $.uid==="number"||typeof $.gid==="number"){if(typeof $.uid!=="number"||typeof $.gid!=="number")throw new TypeError("cannot set owner without number uid and gid");if($.preserveOwner)throw new TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=$.uid,this.gid=$.gid,this.setOwner=!0}else this.uid=void 0,this.gid=void 0,this.setOwner=!1;if($.preserveOwner===void 0&&typeof $.uid!=="number")this.preserveOwner=!!(process.getuid&&process.getuid()===0);else this.preserveOwner=!!$.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 $.maxDepth==="number"?$.maxDepth:bX,this.forceChown=$.forceChown===!0,this.win32=!!$.win32||s$,this.newer=!!$.newer,this.keep=!!$.keep,this.noMtime=!!$.noMtime,this.preservePaths=!!$.preservePaths,this.unlink=!!$.unlink,this.cwd=M(T0.resolve($.cwd||process.cwd())),this.strip=Number($.strip)||0,this.processUmask=!this.chmod?0:typeof $.processUmask==="number"?$.processUmask:process.umask(),this.umask=typeof $.umask==="number"?$.umask:this.processUmask,this.dmode=$.dmode||511&~this.umask,this.fmode=$.fmode||438&~this.umask,this.on("entry",(Q)=>this[G4](Q))}warn($,Q,V={}){if($==="TAR_BAD_ARCHIVE"||$==="TAR_ABORT")V.recoverable=!1;return super.warn($,Q,V)}[O8](){if(this[x8]&&this[l5]===0)this.emit("prefinish"),this.emit("finish"),this.emit("end")}[B4]($){const Q=M($.path),V=Q.split("/");if(this.strip){if(V.length=this.strip)$.linkpath=X.slice(this.strip).join("/");else return!1}V.splice(0,this.strip),$.path=V.join("/")}if(isFinite(this.maxDepth)&&V.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:$,path:Q,depth:V.length,maxDepth:this.maxDepth}),!1;if(!this.preservePaths){if(V.includes("..")||s$&&/^[a-z]:\.\.$/i.test(V[0]??""))return this.warn("TAR_ENTRY_ERROR","path contains '..'",{entry:$,path:Q}),!1;const[X,J]=b$(Q);if(X)$.path=String(J),this.warn("TAR_ENTRY_INFO",`stripping ${X} from absolute path`,{entry:$,path:Q})}if(T0.isAbsolute($.path))$.absolute=M(T0.resolve($.path));else $.absolute=M(T0.resolve(this.cwd,$.path));if(!this.preservePaths&&typeof $.absolute==="string"&&$.absolute.indexOf(this.cwd+"/")!==0&&$.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:$,path:M($.path),resolvedPath:$.absolute,cwd:this.cwd}),!1;if($.absolute===this.cwd&&$.type!=="Directory"&&$.type!=="GNUDumpDir")return!1;if(this.win32){const{root:X}=T0.win32.parse(String($.absolute));$.absolute=X+s1(String($.absolute).slice(X.length));const{root:J}=T0.win32.parse($.path);$.path=J+s1($.path.slice(J.length))}return!0}[G4]($){if(!this[B4]($))return $.resume();switch(yX.equal(typeof $.absolute,"string"),$.type){case"Directory":case"GNUDumpDir":if($.mode)$.mode=$.mode|448;case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[U8]($);case"CharacterDevice":case"BlockDevice":case"FIFO":default:return this[q4]($)}}[k]($,Q){if($.name==="CwdError")this.emit("error",$);else this.warn("TAR_ENTRY_ERROR",$,{entry:Q}),this[H$](),Q.resume()}[c0]($,Q,V){X4(M($),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:Q},V)}[i$]($){return this.forceChown||this.preserveOwner&&(typeof $.uid==="number"&&$.uid!==this.processUid||typeof $.gid==="number"&&$.gid!==this.processGid)||typeof this.uid==="number"&&this.uid!==this.processUid||typeof this.gid==="number"&&this.gid!==this.processGid}[p$]($){return M4(this.uid,$.uid,this.processUid)}[a$]($){return M4(this.gid,$.gid,this.processGid)}[C8]($,Q){const V=typeof $.mode==="number"?$.mode&4095:this.fmode,X=new R0(String($.absolute),{flags:B8($.size),mode:V,autoClose:!1});X.on("error",(G)=>{if(X.fd)A.close(X.fd,()=>{});X.write=()=>!0,this[k](G,$),Q()});let J=1;const Z=(G)=>{if(G){if(X.fd)A.close(X.fd,()=>{});this[k](G,$),Q();return}if(--J===0){if(X.fd!==void 0)A.close(X.fd,(Y)=>{if(Y)this[k](Y,$);else this[H$]();Q()})}};X.on("finish",()=>{const G=String($.absolute),Y=X.fd;if(typeof Y==="number"&&$.mtime&&!this.noMtime){J++;const W=$.atime||new Date,z=$.mtime;A.futimes(Y,W,z,(q)=>q?A.utimes(G,W,z,(L)=>Z(L&&q)):Z())}if(typeof Y==="number"&&this[i$]($)){J++;const W=this[p$]($),z=this[a$]($);if(typeof W==="number"&&typeof z==="number")A.fchown(Y,W,z,(q)=>q?A.chown(G,W,z,(L)=>Z(L&&q)):Z())}Z()});const K=this.transform?this.transform($)||$:$;if(K!==$)K.on("error",(G)=>{this[k](G,$),Q()}),$.pipe(K);K.pipe(X)}[j8]($,Q){const V=typeof $.mode==="number"?$.mode&4095:this.dmode;this[c0](String($.absolute),V,(X)=>{if(X){this[k](X,$),Q();return}let J=1;const Z=()=>{if(--J===0)Q(),this[H$](),$.resume()};if($.mtime&&!this.noMtime)J++,A.utimes(String($.absolute),$.atime||new Date,$.mtime,Z);if(this[i$]($))J++,A.chown(String($.absolute),Number(this[p$]($)),Number(this[a$]($)),Z);Z()})}[q4]($){$.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${$.type}`,{entry:$}),$.resume()}[z4]($,Q){this[p5]($,String($.linkpath),"symlink",Q)}[W4]($,Q){const V=M(T0.resolve(this.cwd,String($.linkpath)));this[p5]($,V,"link",Q)}[L4](){this[l5]++}[H$](){this[l5]--,this[O8]()}[D8]($){this[H$](),$.resume()}[T8]($,Q){return $.type==="File"&&!this.unlink&&Q.isFile()&&Q.nlink<=1&&!s$}[U8]($){this[L4]();const Q=[$.path];if($.linkpath)Q.push($.linkpath);this.reservations.reserve(Q,(V)=>this[Y4]($,V))}[i5]($){if($.type==="SymbolicLink")fX(this.dirCache);else if($.type!=="Directory")uX(this.dirCache,String($.absolute))}[Y4]($,Q){this[i5]($);const V=(K)=>{this[i5]($),Q(K)},X=()=>{this[c0](this.cwd,this.dmode,(K)=>{if(K){this[k](K,$),V();return}this[n$]=!0,J()})},J=()=>{if($.absolute!==this.cwd){const K=M(T0.dirname(String($.absolute)));if(K!==this.cwd)return this[c0](K,this.dmode,(G)=>{if(G){this[k](G,$),V();return}Z()})}Z()},Z=()=>{A.lstat(String($.absolute),(K,G)=>{if(G&&(this.keep||this.newer&&G.mtime>($.mtime??G.mtime))){this[D8]($),V();return}if(K||this[T8]($,G))return this[o](null,$,V);if(G.isDirectory()){if($.type==="Directory"){const Y=this.chmod&&$.mode&&(G.mode&4095)!==$.mode,W=(z)=>this[o](z??null,$,V);if(!Y)return W();return A.chmod(String($.absolute),Number($.mode),W)}if($.absolute!==this.cwd)return A.rmdir(String($.absolute),(Y)=>this[o](Y??null,$,V))}if($.absolute===this.cwd)return this[o](null,$,V);EX(String($.absolute),(Y)=>this[o](Y??null,$,V))})};if(this[n$])J();else X()}[o]($,Q,V){if($){this[k]($,Q),V();return}switch(Q.type){case"File":case"OldFile":case"ContiguousFile":return this[C8](Q,V);case"Link":return this[W4](Q,V);case"SymbolicLink":return this[z4](Q,V);case"Directory":case"GNUDumpDir":return this[j8](Q,V)}}[p5]($,Q,V,X){A[V](Q,String($.absolute),(J)=>{if(J)this[k](J,$);else this[H$](),$.resume();X()})}}var d5=($)=>{try{return[null,$()]}catch(Q){return[Q,null]}};class a5 extends r${sync=!0;[o]($,Q){return super[o]($,Q,()=>{})}[U8]($){if(this[i5]($),!this[n$]){const J=this[c0](this.cwd,this.dmode);if(J)return this[k](J,$);this[n$]=!0}if($.absolute!==this.cwd){const J=M(T0.dirname(String($.absolute)));if(J!==this.cwd){const Z=this[c0](J,this.dmode);if(Z)return this[k](Z,$)}}const[Q,V]=d5(()=>A.lstatSync(String($.absolute)));if(V&&(this.keep||this.newer&&V.mtime>($.mtime??V.mtime)))return this[D8]($);if(Q||this[T8]($,V))return this[o](null,$);if(V.isDirectory()){if($.type==="Directory"){const Z=this.chmod&&$.mode&&(V.mode&4095)!==$.mode,[K]=Z?d5(()=>{A.chmodSync(String($.absolute),Number($.mode))}):[];return this[o](K,$)}const[J]=d5(()=>A.rmdirSync(String($.absolute)));this[o](J,$)}const[X]=$.absolute===this.cwd?[]:d5(()=>hX(String($.absolute)));this[o](X,$)}[C8]($,Q){const V=typeof $.mode==="number"?$.mode&4095:this.fmode,X=(K)=>{let G;try{A.closeSync(J)}catch(Y){G=Y}if(K||G)this[k](K||G,$);Q()};let J;try{J=A.openSync(String($.absolute),B8($.size),V)}catch(K){return X(K)}const Z=this.transform?this.transform($)||$:$;if(Z!==$)Z.on("error",(K)=>this[k](K,$)),$.pipe(Z);Z.on("data",(K)=>{try{A.writeSync(J,K,0,K.length)}catch(G){X(G)}}),Z.on("end",()=>{let K=null;if($.mtime&&!this.noMtime){const G=$.atime||new Date,Y=$.mtime;try{A.futimesSync(J,G,Y)}catch(W){try{A.utimesSync(String($.absolute),G,Y)}catch(z){K=W}}}if(this[i$]($)){const G=this[p$]($),Y=this[a$]($);try{A.fchownSync(J,Number(G),Number(Y))}catch(W){try{A.chownSync(String($.absolute),Number(G),Number(Y))}catch(z){K=K||W}}}X(K)})}[j8]($,Q){const V=typeof $.mode==="number"?$.mode&4095:this.dmode,X=this[c0](String($.absolute),V);if(X){this[k](X,$),Q();return}if($.mtime&&!this.noMtime)try{A.utimesSync(String($.absolute),$.atime||new Date,$.mtime)}catch(J){}if(this[i$]($))try{A.chownSync(String($.absolute),Number(this[p$]($)),Number(this[a$]($)))}catch(J){}Q(),$.resume()}[c0]($,Q){try{return Z4(M($),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:Q})}catch(V){return V}}[p5]($,Q,V,X){const J=`${V}Sync`;try{A[J](Q,String($.absolute)),X(),$.resume()}catch(Z){return this[k](Z,$)}}}var cX=($)=>{const Q=new a5($),V=$.file,X=I4.statSync(V),J=$.maxReadSize||16777216;new D1(V,{readSize:J,size:X.size}).pipe(Q)},lX=($,Q)=>{const V=new r$($),X=$.maxReadSize||16777216,J=$.file;return new Promise((K,G)=>{V.on("error",G),V.on("close",K),I4.stat(J,(Y,W)=>{if(Y)G(Y);else{const z=new M$(J,{readSize:X,size:W.size});z.on("error",G),z.pipe(V)}})})},N8=Y0(cX,lX,($)=>new a5($),($)=>new r$($),($,Q)=>{if(Q?.length)p1($,Q)});import l from"node:fs";import P4 from"node:path";var dX=($,Q)=>{const V=new F$($);let X=!0,J,Z;try{try{J=l.openSync($.file,"r+")}catch(Y){if(Y?.code==="ENOENT")J=l.openSync($.file,"w+");else throw Y}const K=l.fstatSync(J),G=Buffer.alloc(512);$:for(Z=0;ZK.size)break;if(Z+=W,$.mtimeCache&&Y.mtime)$.mtimeCache.set(String(Y.path),Y.mtime)}X=!1,iX($,V,Z,J,Q)}finally{if(X)try{l.closeSync(J)}catch(K){}}},iX=($,Q,V,X,J)=>{const Z=new _$($.file,{fd:X,start:V});Q.pipe(Z),aX(Q,J)},pX=($,Q)=>{Q=Array.from(Q);const V=new V$($),X=(Z,K,G)=>{const Y=(H,T)=>{if(H)l.close(Z,(j)=>G(H));else G(null,T)};let W=0;if(K===0)return Y(null,0);let z=0;const q=Buffer.alloc(512),L=(H,T)=>{if(H||typeof T==="undefined")return Y(H);if(z+=T,z<512&&T)return l.read(Z,q,z,q.length-z,W+z,L);if(W===0&&q[0]===31&&q[1]===139)return Y(new Error("cannot append to compressed archives"));if(z<512)return Y(null,W);const j=new a(q);if(!j.cksumValid)return Y(null,W);const b=512*Math.ceil((j.size??0)/512);if(W+b+512>K)return Y(null,W);if(W+=b+512,W>=K)return Y(null,W);if($.mtimeCache&&j.mtime)$.mtimeCache.set(String(j.path),j.mtime);z=0,l.read(Z,q,0,512,W,L)};l.read(Z,q,0,512,W,L)};return new Promise((Z,K)=>{V.on("error",K);let G="r+";const Y=(W,z)=>{if(W&&W.code==="ENOENT"&&G==="r+")return G="w+",l.open($.file,G,Y);if(W||!z)return K(W);l.fstat(z,(q,L)=>{if(q)return l.close(z,()=>K(q));X(z,L.size,(H,T)=>{if(H)return K(H);const j=new R0($.file,{fd:z,start:T});V.pipe(j),j.on("error",K),j.on("close",Z),nX(V,Q)})})};l.open($.file,G,Y)})},aX=($,Q)=>{Q.forEach((V)=>{if(V.charAt(0)==="@")$$({file:P4.resolve($.cwd,V.slice(1)),sync:!0,noResume:!0,onReadEntry:(X)=>$.add(X)});else $.add(V)}),$.end()},nX=async($,Q)=>{for(let V=0;V$.add(J)});else $.add(X)}$.end()},X$=Y0(dX,pX,()=>{throw new TypeError("file is required")},()=>{throw new TypeError("file is required")},($,Q)=>{if(!F7($))throw new TypeError("file is required");if($.gzip||$.brotli||$.file.endsWith(".br")||$.file.endsWith(".tbr"))throw new TypeError("cannot append to compressed archives");if(!Q?.length)throw new TypeError("no paths specified to add/replace")});var sX=Y0(X$.syncFile,X$.asyncFile,X$.syncNoFile,X$.asyncNoFile,($,Q=[])=>{X$.validate?.($,Q),rX($)}),rX=($)=>{const Q=$.filter;if(!$.mtimeCache)$.mtimeCache=new Map;$.filter=Q?(V,X)=>Q(V,X)&&!(($.mtimeCache?.get(V)??X.mtime??0)>(X.mtime??0)):(V,X)=>!(($.mtimeCache?.get(V)??X.mtime??0)>(X.mtime??0))};async function $J($,Q,V){w.info(`Starting download from URL: ${$}`);const J=`beat-forge/init-beatsaber@${F4().version}`;w.info(`User-Agent: ${J}`);const Z=await fetch($,{headers:{"User-Agent":J,Authorization:`token ${V}`}});if(w.info(`Response status: ${Z.status}`),w.info(`Response headers: ${JSON.stringify([...Z.headers])}`),!Z.ok)throw w.error(`Failed to download file: ${Z.statusText}`),new Error(`Failed to download file: ${Z.statusText}`);await J$.mkdir(v4(Q),{recursive:!0}),w.info(`Directory created for output path: ${v4(Q)}`);const K=eX(Q),G=Z.body?.getReader();if(!G)throw w.error("Failed to get reader from response body"),new Error("Failed to get reader from response body");w.info("Starting to read and write file stream"),await(async()=>{while(!0){const{done:W,value:z}=await G.read();if(W)break;if(z)K.write(z)}K.close()})(),w.info("File downloaded and written successfully")}async function QJ($,Q){w.info(`Extracting tarball from ${$} to ${Q}`);try{await J$.mkdir(Q,{recursive:!0}),await N8({file:$,cwd:Q})}catch(V){throw w.error(`Failed to extract tarball from ${$} to ${Q}`),w.error(`Error details: ${V}`),V}w.info("Tarball extraction completed successfully")}async function H4($,Q){w.info(`Moving contents from ${$} to ${Q}`);try{await J$.mkdir(Q,{recursive:!0});const V=await J$.readdir($,{withFileTypes:!0});w.info(`Files to move: ${V.map((X)=>X.name).join(", ")}`);for(let X of V){const J=s5($,X.name),Z=s5(Q,X.name);if(X.isDirectory())await H4(J,Z);else await J$.rename(J,Z);w.info(`Moved ${J} to ${Z}`)}}catch(V){throw w.error(`Failed to move contents from ${$} to ${Q}`),w.error(`Error details: ${V}`),V}w.info("Content move completed successfully")}async function x4($){const Q=await J$.readdir($,{withFileTypes:!0});for(let V of Q){const X=s5($,V.name);if(V.isDirectory()){const J=await x4(X);if(J)return J}else if(V.name==="manifest.json")return X}return null}async function VJ(){try{w.info("Initializing Beat Saber references...");const $=w.getInput("token",{required:!0}),Q=w.getInput("manifest");let V=w.getInput("version");const X=w.getInput("path")||"./Refs",J=w.getInput("repo")||"beat-forge/beatsaber-stripped",Z=w.getInput("host")||"github.com";if(w.info(`Inputs: version=${V}, path=${X}, repo=${J}, host=${Z}, manifest=${Q}`),!V){w.info("No version specified. Attempting to infer version from manifest.json...");const H=Q?n5(Q):await x4(process.cwd());if(H)w.info(`Found manifest.json at ${H}`),V=JSON.parse(await J$.readFile(H,"utf8")).gameVersion,w.info(`Inferred version: ${V}`);else throw w.error("No manifest.json found and no version specified."),new Error("No manifest.json found and no version specified.")}const[K,G]=J.split("/");if(!K||!G)throw w.error("Repository input is invalid. Expected format {owner}/{repo}."),new Error("Repository input is invalid. Expected format {owner}/{repo}.");const Y=`version/${V}`,W=`https://${Z}/${K}/${G}/archive/refs/heads/${Y}.tar.gz`,z=n5("archive.tar.gz"),q=n5("extract"),L=n5(X);w.info(`Archive URL: ${W}`),w.info(`Tarball path: ${z}`),w.info(`Extract path: ${q}`),w.info(`References path: ${L}`),await $J(W,z,$),await QJ(z,q),await H4(s5(q,`beatsaber-stripped-version-${V}`,"data"),L),w.info("Beat Saber references initialized successfully")}catch($){w.setFailed(`Action failed with error: ${$}`)}}VJ(); + Error Message: ${Z.message}`)})).result)===null||Q===void 0?void 0:Q.value;if(!J)throw new Error("Response json body do not have ID Token field");return J})}static getIDToken($){return r9(this,void 0,void 0,function*(){try{let Q=Z$.getIDTokenUrl();if($){const X=encodeURIComponent($);Q=`${Q}&audience=${X}`}o9.debug(`ID token url is ${Q}`);const V=yield Z$.getCall(Q);return o9.setSecret(V),V}catch(Q){throw new Error(`Error message: ${Q.message}`)}})}}K$.OidcClient=Z$});var q1=F((E)=>{var z1=E&&E.__awaiter||function($,Q,V,X){function J(Z){return Z instanceof V?Z:new V(function(K){K(Z)})}return new(V||(V=Promise))(function(Z,K){function G(z){try{W(X.next(z))}catch(q){K(q)}}function Y(z){try{W(X.throw(z))}catch(q){K(q)}}function W(z){z.done?Z(z.value):J(z.value).then(G,Y)}W((X=X.apply($,Q||[])).next())})};Object.defineProperty(E,"__esModule",{value:!0});E.summary=E.markdownSummary=E.SUMMARY_DOCS_URL=E.SUMMARY_ENV_VAR=void 0;var UQ=T("os"),W1=T("fs"),{access:TQ,appendFile:CQ,writeFile:jQ}=W1.promises;E.SUMMARY_ENV_VAR="GITHUB_STEP_SUMMARY";E.SUMMARY_DOCS_URL="https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary";class e9{constructor(){this._buffer=""}filePath(){return z1(this,void 0,void 0,function*(){if(this._filePath)return this._filePath;const $=process.env[E.SUMMARY_ENV_VAR];if(!$)throw new Error(`Unable to find environment variable for \$${E.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`);try{yield TQ($,W1.constants.R_OK|W1.constants.W_OK)}catch(Q){throw new Error(`Unable to access summary file: '${$}'. Check if the file has correct read/write permissions.`)}return this._filePath=$,this._filePath})}wrap($,Q,V={}){const X=Object.entries(V).map(([J,Z])=>` ${J}="${Z}"`).join("");if(!Q)return`<${$}${X}>`;return`<${$}${X}>${Q}`}write($){return z1(this,void 0,void 0,function*(){const Q=!!($===null||$===void 0?void 0:$.overwrite),V=yield this.filePath();return yield(Q?jQ:CQ)(V,this._buffer,{encoding:"utf8"}),this.emptyBuffer()})}clear(){return z1(this,void 0,void 0,function*(){return this.emptyBuffer().write({overwrite:!0})})}stringify(){return this._buffer}isEmptyBuffer(){return this._buffer.length===0}emptyBuffer(){return this._buffer="",this}addRaw($,Q=!1){return this._buffer+=$,Q?this.addEOL():this}addEOL(){return this.addRaw(UQ.EOL)}addCodeBlock($,Q){const V=Object.assign({},Q&&{lang:Q}),X=this.wrap("pre",this.wrap("code",$),V);return this.addRaw(X).addEOL()}addList($,Q=!1){const V=Q?"ol":"ul",X=$.map((Z)=>this.wrap("li",Z)).join(""),J=this.wrap(V,X);return this.addRaw(J).addEOL()}addTable($){const Q=$.map((X)=>{const J=X.map((Z)=>{if(typeof Z==="string")return this.wrap("td",Z);const{header:K,data:G,colspan:Y,rowspan:W}=Z,z=K?"th":"td",q=Object.assign(Object.assign({},Y&&{colspan:Y}),W&&{rowspan:W});return this.wrap(z,G,q)}).join("");return this.wrap("tr",J)}).join(""),V=this.wrap("table",Q);return this.addRaw(V).addEOL()}addDetails($,Q){const V=this.wrap("details",this.wrap("summary",$)+Q);return this.addRaw(V).addEOL()}addImage($,Q,V){const{width:X,height:J}=V||{},Z=Object.assign(Object.assign({},X&&{width:X}),J&&{height:J}),K=this.wrap("img",null,Object.assign({src:$,alt:Q},Z));return this.addRaw(K).addEOL()}addHeading($,Q){const V=`h${Q}`,X=["h1","h2","h3","h4","h5","h6"].includes(V)?V:"h1",J=this.wrap(X,$);return this.addRaw(J).addEOL()}addSeparator(){const $=this.wrap("hr",null);return this.addRaw($).addEOL()}addBreak(){const $=this.wrap("br",null);return this.addRaw($).addEOL()}addQuote($,Q){const V=Object.assign({},Q&&{cite:Q}),X=this.wrap("blockquote",$,V);return this.addRaw(X).addEOL()}addLink($,Q){const V=this.wrap("a",$,{href:Q});return this.addRaw(V).addEOL()}}var $7=new e9;E.markdownSummary=$7;E.summary=$7});var Q7=F((h)=>{var RQ=function($){return $.replace(/[\\]/g,"/")},gQ=function($){return $.replace(/[/]/g,"\\")},kQ=function($){return $.replace(/[/\\]/g,_Q.sep)},DQ=h&&h.__createBinding||(Object.create?function($,Q,V,X){if(X===void 0)X=V;Object.defineProperty($,X,{enumerable:!0,get:function(){return Q[V]}})}:function($,Q,V,X){if(X===void 0)X=V;$[X]=Q[V]}),NQ=h&&h.__setModuleDefault||(Object.create?function($,Q){Object.defineProperty($,"default",{enumerable:!0,value:Q})}:function($,Q){$.default=Q}),SQ=h&&h.__importStar||function($){if($&&$.__esModule)return $;var Q={};if($!=null){for(var V in $)if(V!=="default"&&Object.hasOwnProperty.call($,V))DQ(Q,$,V)}return NQ(Q,$),Q};Object.defineProperty(h,"__esModule",{value:!0});h.toPlatformPath=h.toWin32Path=h.toPosixPath=void 0;var _Q=SQ(T("path"));h.toPosixPath=RQ;h.toWin32Path=gQ;h.toPlatformPath=kQ});var Y1=F((B)=>{var hQ=function($,Q){const V=G$.toCommandValue(Q);if(process.env[$]=V,process.env.GITHUB_ENV||"")return l0.issueFileCommand("ENV",l0.prepareKeyValueMessage($,Q));p.issueCommand("set-env",{name:$},V)},uQ=function($){p.issueCommand("add-mask",{},$)},fQ=function($){if(process.env.GITHUB_PATH||"")l0.issueFileCommand("PATH",$);else p.issueCommand("add-path",{},$);process.env.PATH=`${$}${bQ.delimiter}${process.env.PATH}`},B1=function($,Q){const V=process.env[`INPUT_${$.replace(/ /g,"_").toUpperCase()}`]||"";if(Q&&Q.required&&!V)throw new Error(`Input required and not supplied: ${$}`);if(Q&&Q.trimWhitespace===!1)return V;return V.trim()},cQ=function($,Q){const V=B1($,Q).split("\n").filter((X)=>X!=="");if(Q&&Q.trimWhitespace===!1)return V;return V.map((X)=>X.trim())},lQ=function($,Q){const V=["true","True","TRUE"],X=["false","False","FALSE"],J=B1($,Q);if(V.includes(J))return!0;if(X.includes(J))return!1;throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${$}\nSupport boolean input list: \`true | True | TRUE | false | False | FALSE\``)},dQ=function($,Q){if(process.env.GITHUB_OUTPUT||"")return l0.issueFileCommand("OUTPUT",l0.prepareKeyValueMessage($,Q));process.stdout.write(J7.EOL),p.issueCommand("set-output",{name:$},G$.toCommandValue(Q))},iQ=function($){p.issue("echo",$?"on":"off")},pQ=function($){process.exitCode=Z7.Failure,K7($)},aQ=function(){return process.env.RUNNER_DEBUG==="1"},nQ=function($){p.issueCommand("debug",{},$)},K7=function($,Q={}){p.issueCommand("error",G$.toCommandProperties(Q),$ instanceof Error?$.toString():$)},sQ=function($,Q={}){p.issueCommand("warning",G$.toCommandProperties(Q),$ instanceof Error?$.toString():$)},rQ=function($,Q={}){p.issueCommand("notice",G$.toCommandProperties(Q),$ instanceof Error?$.toString():$)},oQ=function($){process.stdout.write($+J7.EOL)},G7=function($){p.issue("group",$)},Y7=function(){p.issue("endgroup")},tQ=function($,Q){return X7(this,void 0,void 0,function*(){G7($);let V;try{V=yield Q()}finally{Y7()}return V})},eQ=function($,Q){if(process.env.GITHUB_STATE||"")return l0.issueFileCommand("STATE",l0.prepareKeyValueMessage($,Q));p.issueCommand("save-state",{name:$},G$.toCommandValue(Q))},$V=function($){return process.env[`STATE_${$}`]||""},QV=function($){return X7(this,void 0,void 0,function*(){return yield EQ.OidcClient.getIDToken($)})},yQ=B&&B.__createBinding||(Object.create?function($,Q,V,X){if(X===void 0)X=V;Object.defineProperty($,X,{enumerable:!0,get:function(){return Q[V]}})}:function($,Q,V,X){if(X===void 0)X=V;$[X]=Q[V]}),mQ=B&&B.__setModuleDefault||(Object.create?function($,Q){Object.defineProperty($,"default",{enumerable:!0,value:Q})}:function($,Q){$.default=Q}),V7=B&&B.__importStar||function($){if($&&$.__esModule)return $;var Q={};if($!=null){for(var V in $)if(V!=="default"&&Object.hasOwnProperty.call($,V))yQ(Q,$,V)}return mQ(Q,$),Q},X7=B&&B.__awaiter||function($,Q,V,X){function J(Z){return Z instanceof V?Z:new V(function(K){K(Z)})}return new(V||(V=Promise))(function(Z,K){function G(z){try{W(X.next(z))}catch(q){K(q)}}function Y(z){try{W(X.throw(z))}catch(q){K(q)}}function W(z){z.done?Z(z.value):J(z.value).then(G,Y)}W((X=X.apply($,Q||[])).next())})};Object.defineProperty(B,"__esModule",{value:!0});B.getIDToken=B.getState=B.saveState=B.group=B.endGroup=B.startGroup=B.info=B.notice=B.warning=B.error=B.debug=B.isDebug=B.setFailed=B.setCommandEcho=B.setOutput=B.getBooleanInput=B.getMultilineInput=B.getInput=B.addPath=B.setSecret=B.exportVariable=B.ExitCode=void 0;var p=h8(),l0=k9(),G$=o$(),J7=V7(T("os")),bQ=V7(T("path")),EQ=t9(),Z7;(function($){$[$.Success=0]="Success",$[$.Failure=1]="Failure"})(Z7=B.ExitCode||(B.ExitCode={}));B.exportVariable=hQ;B.setSecret=uQ;B.addPath=fQ;B.getInput=B1;B.getMultilineInput=cQ;B.getBooleanInput=lQ;B.setOutput=dQ;B.setCommandEcho=iQ;B.setFailed=pQ;B.isDebug=aQ;B.debug=nQ;B.error=K7;B.warning=sQ;B.notice=rQ;B.info=oQ;B.startGroup=G7;B.endGroup=Y7;B.group=tQ;B.saveState=eQ;B.getState=$V;B.getIDToken=QV;var VV=q1();Object.defineProperty(B,"summary",{enumerable:!0,get:function(){return VV.summary}});var XV=q1();Object.defineProperty(B,"markdownSummary",{enumerable:!0,get:function(){return XV.markdownSummary}});var L1=Q7();Object.defineProperty(B,"toPosixPath",{enumerable:!0,get:function(){return L1.toPosixPath}});Object.defineProperty(B,"toWin32Path",{enumerable:!0,get:function(){return L1.toWin32Path}});Object.defineProperty(B,"toPlatformPath",{enumerable:!0,get:function(){return L1.toPlatformPath}})});var F4=F((E3,tX)=>{tX.exports={name:"init-beatsaber",description:"A GitHub Action to initialize a Beat Saber modding environment",version:"1.6.1",author:"BeatForge",private:!0,type:"module",homepage:"https://github.com/beat-forge/init-beatsaber",repository:{type:"git",url:"git+https://github.com/beat-forge/init-beatsaber.git"},bugs:{url:"https://github.com/beat-forge/init-beatsaber/issues"},main:"dist/index.js",engines:{node:">=20"},scripts:{all:"bun run format:write && bun run package","package:node":"bun build --target=node ./src/index.ts --outfile=dist/index.js --minify","package:bun":"bun build --target=bun ./src/index.ts --outfile=dist/index.js --minify","format:write":"prettier --write \"**/*.{ts,tsx}\"",bundle:"bun run format:write && bun run package:node"},license:"AGPL-3.0",dependencies:{"@actions/core":"^1.10.1","@actions/github":"^5.1.1",tar:"^7.4.0"},devDependencies:{"@types/node":"^20.14.10","bun-types":"^1.1.20",prettier:"^3.3.3",typescript:"^5.5.3"}}});var w=j4(Y1(),1);import{promises as J$,createWriteStream as eX} from"fs";import{dirname as v4,join as s5,resolve as n5} from"path";import MV from"events";import u from"fs";import{EventEmitter as F1} from"node:events";import L7 from"node:stream";import{StringDecoder as JV} from"node:string_decoder";var z7=typeof process==="object"&&process?process:{stdout:null,stderr:null},ZV=($)=>!!$&&typeof $==="object"&&($ instanceof c||$ instanceof L7||KV($)||GV($)),KV=($)=>!!$&&typeof $==="object"&&$ instanceof F1&&typeof $.pipe==="function"&&$.pipe!==L7.Writable.prototype.pipe,GV=($)=>!!$&&typeof $==="object"&&$ instanceof F1&&typeof $.write==="function"&&typeof $.end==="function",I0=Symbol("EOF"),P0=Symbol("maybeEmitEnd"),D0=Symbol("emittedEnd"),Z5=Symbol("emittingEnd"),U$=Symbol("emittedError"),K5=Symbol("closed"),W7=Symbol("read"),G5=Symbol("flush"),q7=Symbol("flushChunk"),$0=Symbol("encoding"),Y$=Symbol("decoder"),N=Symbol("flowing"),T$=Symbol("paused"),z$=Symbol("resume"),S=Symbol("buffer"),m=Symbol("pipes"),_=Symbol("bufferLength"),M1=Symbol("bufferPush"),Y5=Symbol("bufferShift"),g=Symbol("objectMode"),U=Symbol("destroyed"),w1=Symbol("error"),A1=Symbol("emitData"),B7=Symbol("emitEnd"),I1=Symbol("emitEnd2"),K0=Symbol("async"),P1=Symbol("abort"),z5=Symbol("aborted"),C$=Symbol("signal"),d0=Symbol("dataListeners"),f=Symbol("discarded"),j$=($)=>Promise.resolve().then($),YV=($)=>$(),zV=($)=>$==="end"||$==="finish"||$==="prefinish",WV=($)=>$ instanceof ArrayBuffer||!!$&&typeof $==="object"&&$.constructor&&$.constructor.name==="ArrayBuffer"&&$.byteLength>=0,qV=($)=>!Buffer.isBuffer($)&&ArrayBuffer.isView($);class v1{src;dest;opts;ondrain;constructor($,Q,V){this.src=$,this.dest=Q,this.opts=V,this.ondrain=()=>$[z$](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors($){}end(){if(this.unpipe(),this.opts.end)this.dest.end()}}class M7 extends v1{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor($,Q,V){super($,Q,V);this.proxyErrors=(X)=>Q.emit("error",X),$.on("error",this.proxyErrors)}}var BV=($)=>!!$.objectMode,LV=($)=>!$.objectMode&&!!$.encoding&&$.encoding!=="buffer";class c extends F1{[N]=!1;[T$]=!1;[m]=[];[S]=[];[g];[$0];[K0];[Y$];[I0]=!1;[D0]=!1;[Z5]=!1;[K5]=!1;[U$]=null;[_]=0;[U]=!1;[C$];[z5]=!1;[d0]=0;[f]=!1;writable=!0;readable=!0;constructor(...$){const Q=$[0]||{};super();if(Q.objectMode&&typeof Q.encoding==="string")throw new TypeError("Encoding and objectMode may not be used together");if(BV(Q))this[g]=!0,this[$0]=null;else if(LV(Q))this[$0]=Q.encoding,this[g]=!1;else this[g]=!1,this[$0]=null;if(this[K0]=!!Q.async,this[Y$]=this[$0]?new JV(this[$0]):null,Q&&Q.debugExposeBuffer===!0)Object.defineProperty(this,"buffer",{get:()=>this[S]});if(Q&&Q.debugExposePipes===!0)Object.defineProperty(this,"pipes",{get:()=>this[m]});const{signal:V}=Q;if(V)if(this[C$]=V,V.aborted)this[P1]();else V.addEventListener("abort",()=>this[P1]())}get bufferLength(){return this[_]}get encoding(){return this[$0]}set encoding($){throw new Error("Encoding must be set at instantiation time")}setEncoding($){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[g]}set objectMode($){throw new Error("objectMode must be set at instantiation time")}get["async"](){return this[K0]}set["async"]($){this[K0]=this[K0]||!!$}[P1](){this[z5]=!0,this.emit("abort",this[C$]?.reason),this.destroy(this[C$]?.reason)}get aborted(){return this[z5]}set aborted($){}write($,Q,V){if(this[z5])return!1;if(this[I0])throw new Error("write after end");if(this[U])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;if(typeof Q==="function")V=Q,Q="utf8";if(!Q)Q="utf8";const X=this[K0]?j$:YV;if(!this[g]&&!Buffer.isBuffer($)){if(qV($))$=Buffer.from($.buffer,$.byteOffset,$.byteLength);else if(WV($))$=Buffer.from($);else if(typeof $!=="string")throw new Error("Non-contiguous data written to non-objectMode stream")}if(this[g]){if(this[N]&&this[_]!==0)this[G5](!0);if(this[N])this.emit("data",$);else this[M1]($);if(this[_]!==0)this.emit("readable");if(V)X(V);return this[N]}if(!$.length){if(this[_]!==0)this.emit("readable");if(V)X(V);return this[N]}if(typeof $==="string"&&!(Q===this[$0]&&!this[Y$]?.lastNeed))$=Buffer.from($,Q);if(Buffer.isBuffer($)&&this[$0])$=this[Y$].write($);if(this[N]&&this[_]!==0)this[G5](!0);if(this[N])this.emit("data",$);else this[M1]($);if(this[_]!==0)this.emit("readable");if(V)X(V);return this[N]}read($){if(this[U])return null;if(this[f]=!1,this[_]===0||$===0||$&&$>this[_])return this[P0](),null;if(this[g])$=null;if(this[S].length>1&&!this[g])this[S]=[this[$0]?this[S].join(""):Buffer.concat(this[S],this[_])];const Q=this[W7]($||null,this[S][0]);return this[P0](),Q}[W7]($,Q){if(this[g])this[Y5]();else{const V=Q;if($===V.length||$===null)this[Y5]();else if(typeof V==="string")this[S][0]=V.slice($),Q=V.slice(0,$),this[_]-=$;else this[S][0]=V.subarray($),Q=V.subarray(0,$),this[_]-=$}if(this.emit("data",Q),!this[S].length&&!this[I0])this.emit("drain");return Q}end($,Q,V){if(typeof $==="function")V=$,$=void 0;if(typeof Q==="function")V=Q,Q="utf8";if($!==void 0)this.write($,Q);if(V)this.once("end",V);if(this[I0]=!0,this.writable=!1,this[N]||!this[T$])this[P0]();return this}[z$](){if(this[U])return;if(!this[d0]&&!this[m].length)this[f]=!0;if(this[T$]=!1,this[N]=!0,this.emit("resume"),this[S].length)this[G5]();else if(this[I0])this[P0]();else this.emit("drain")}resume(){return this[z$]()}pause(){this[N]=!1,this[T$]=!0,this[f]=!1}get destroyed(){return this[U]}get flowing(){return this[N]}get paused(){return this[T$]}[M1]($){if(this[g])this[_]+=1;else this[_]+=$.length;this[S].push($)}[Y5](){if(this[g])this[_]-=1;else this[_]-=this[S][0].length;return this[S].shift()}[G5]($=!1){do;while(this[q7](this[Y5]())&&this[S].length);if(!$&&!this[S].length&&!this[I0])this.emit("drain")}[q7]($){return this.emit("data",$),this[N]}pipe($,Q){if(this[U])return $;this[f]=!1;const V=this[D0];if(Q=Q||{},$===z7.stdout||$===z7.stderr)Q.end=!1;else Q.end=Q.end!==!1;if(Q.proxyErrors=!!Q.proxyErrors,V){if(Q.end)$.end()}else if(this[m].push(!Q.proxyErrors?new v1(this,$,Q):new M7(this,$,Q)),this[K0])j$(()=>this[z$]());else this[z$]();return $}unpipe($){const Q=this[m].find((V)=>V.dest===$);if(Q){if(this[m].length===1){if(this[N]&&this[d0]===0)this[N]=!1;this[m]=[]}else this[m].splice(this[m].indexOf(Q),1);Q.unpipe()}}addListener($,Q){return this.on($,Q)}on($,Q){const V=super.on($,Q);if($==="data"){if(this[f]=!1,this[d0]++,!this[m].length&&!this[N])this[z$]()}else if($==="readable"&&this[_]!==0)super.emit("readable");else if(zV($)&&this[D0])super.emit($),this.removeAllListeners($);else if($==="error"&&this[U$]){const X=Q;if(this[K0])j$(()=>X.call(this,this[U$]));else X.call(this,this[U$])}return V}removeListener($,Q){return this.off($,Q)}off($,Q){const V=super.off($,Q);if($==="data"){if(this[d0]=this.listeners("data").length,this[d0]===0&&!this[f]&&!this[m].length)this[N]=!1}return V}removeAllListeners($){const Q=super.removeAllListeners($);if($==="data"||$===void 0){if(this[d0]=0,!this[f]&&!this[m].length)this[N]=!1}return Q}get emittedEnd(){return this[D0]}[P0](){if(!this[Z5]&&!this[D0]&&!this[U]&&this[S].length===0&&this[I0]){if(this[Z5]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[K5])this.emit("close");this[Z5]=!1}}emit($,...Q){const V=Q[0];if($!=="error"&&$!=="close"&&$!==U&&this[U])return!1;else if($==="data")return!this[g]&&!V?!1:this[K0]?(j$(()=>this[A1](V)),!0):this[A1](V);else if($==="end")return this[B7]();else if($==="close"){if(this[K5]=!0,!this[D0]&&!this[U])return!1;const J=super.emit("close");return this.removeAllListeners("close"),J}else if($==="error"){this[U$]=V,super.emit(w1,V);const J=!this[C$]||this.listeners("error").length?super.emit("error",V):!1;return this[P0](),J}else if($==="resume"){const J=super.emit("resume");return this[P0](),J}else if($==="finish"||$==="prefinish"){const J=super.emit($);return this.removeAllListeners($),J}const X=super.emit($,...Q);return this[P0](),X}[A1]($){for(let V of this[m])if(V.dest.write($)===!1)this.pause();const Q=this[f]?!1:super.emit("data",$);return this[P0](),Q}[B7](){if(this[D0])return!1;return this[D0]=!0,this.readable=!1,this[K0]?(j$(()=>this[I1]()),!0):this[I1]()}[I1](){if(this[Y$]){const Q=this[Y$].end();if(Q){for(let V of this[m])V.dest.write(Q);if(!this[f])super.emit("data",Q)}}for(let Q of this[m])Q.end();const $=super.emit("end");return this.removeAllListeners("end"),$}async collect(){const $=Object.assign([],{dataLength:0});if(!this[g])$.dataLength=0;const Q=this.promise();return this.on("data",(V)=>{if($.push(V),!this[g])$.dataLength+=V.length}),await Q,$}async concat(){if(this[g])throw new Error("cannot concat in objectMode");const $=await this.collect();return this[$0]?$.join(""):Buffer.concat($,$.dataLength)}async promise(){return new Promise(($,Q)=>{this.on(U,()=>Q(new Error("stream destroyed"))),this.on("error",(V)=>Q(V)),this.on("end",()=>$())})}[Symbol.asyncIterator](){this[f]=!1;let $=!1;const Q=async()=>{return this.pause(),$=!0,{value:void 0,done:!0}};return{next:()=>{if($)return Q();const X=this.read();if(X!==null)return Promise.resolve({done:!1,value:X});if(this[I0])return Q();let J,Z;const K=(z)=>{this.off("data",G),this.off("end",Y),this.off(U,W),Q(),Z(z)},G=(z)=>{this.off("error",K),this.off("end",Y),this.off(U,W),this.pause(),J({value:z,done:!!this[I0]})},Y=()=>{this.off("error",K),this.off("data",G),this.off(U,W),Q(),J({done:!0,value:void 0})},W=()=>K(new Error("stream destroyed"));return new Promise((z,q)=>{Z=q,J=z,this.once(U,W),this.once("error",K),this.once("end",Y),this.once("data",G)})},throw:Q,return:Q,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[f]=!1;let $=!1;const Q=()=>{return this.pause(),this.off(w1,Q),this.off(U,Q),this.off("end",Q),$=!0,{done:!0,value:void 0}},V=()=>{if($)return Q();const X=this.read();return X===null?Q():{done:!1,value:X}};return this.once("end",Q),this.once(w1,Q),this.once(U,Q),{next:V,throw:Q,return:Q,[Symbol.iterator](){return this}}}destroy($){if(this[U]){if($)this.emit("error",$);else this.emit(U);return this}this[U]=!0,this[f]=!0,this[S].length=0,this[_]=0;const Q=this;if(typeof Q.close==="function"&&!this[K5])Q.close();if($)this.emit("error",$);else this.emit(U);return this}static get isStream(){return ZV}}var wV=u.writev,S0=Symbol("_autoClose"),V0=Symbol("_close"),D$=Symbol("_ended"),I=Symbol("_fd"),H1=Symbol("_finished"),v0=Symbol("_flags"),x1=Symbol("_flush"),C1=Symbol("_handleChunk"),j1=Symbol("_makeBuf"),S$=Symbol("_mode"),W5=Symbol("_needDrain"),B$=Symbol("_onerror"),L$=Symbol("_onopen"),O1=Symbol("_onread"),W$=Symbol("_onwrite"),_0=Symbol("_open"),Q0=Symbol("_path"),N0=Symbol("_pos"),G0=Symbol("_queue"),q$=Symbol("_read"),U1=Symbol("_readSize"),F0=Symbol("_reading"),N$=Symbol("_remain"),T1=Symbol("_size"),q5=Symbol("_write"),i0=Symbol("_writing"),B5=Symbol("_defaultFlag"),p0=Symbol("_errored");class M$ extends c{[p0]=!1;[I];[Q0];[U1];[F0]=!1;[T1];[N$];[S0];constructor($,Q){Q=Q||{};super(Q);if(this.readable=!0,this.writable=!1,typeof $!=="string")throw new TypeError("path must be a string");if(this[p0]=!1,this[I]=typeof Q.fd==="number"?Q.fd:void 0,this[Q0]=$,this[U1]=Q.readSize||16777216,this[F0]=!1,this[T1]=typeof Q.size==="number"?Q.size:1/0,this[N$]=this[T1],this[S0]=typeof Q.autoClose==="boolean"?Q.autoClose:!0,typeof this[I]==="number")this[q$]();else this[_0]()}get fd(){return this[I]}get path(){return this[Q0]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[_0](){u.open(this[Q0],"r",($,Q)=>this[L$]($,Q))}[L$]($,Q){if($)this[B$]($);else this[I]=Q,this.emit("open",Q),this[q$]()}[j1](){return Buffer.allocUnsafe(Math.min(this[U1],this[N$]))}[q$](){if(!this[F0]){this[F0]=!0;const $=this[j1]();if($.length===0)return process.nextTick(()=>this[O1](null,0,$));u.read(this[I],$,0,$.length,null,(Q,V,X)=>this[O1](Q,V,X))}}[O1]($,Q,V){if(this[F0]=!1,$)this[B$]($);else if(this[C1](Q,V))this[q$]()}[V0](){if(this[S0]&&typeof this[I]==="number"){const $=this[I];this[I]=void 0,u.close($,(Q)=>Q?this.emit("error",Q):this.emit("close"))}}[B$]($){this[F0]=!0,this[V0](),this.emit("error",$)}[C1]($,Q){let V=!1;if(this[N$]-=$,$>0)V=super.write($this[L$]($,Q))}[L$]($,Q){if(this[B5]&&this[v0]==="r+"&&$&&$.code==="ENOENT")this[v0]="w",this[_0]();else if($)this[B$]($);else if(this[I]=Q,this.emit("open",Q),!this[i0])this[x1]()}end($,Q){if($)this.write($,Q);if(this[D$]=!0,!this[i0]&&!this[G0].length&&typeof this[I]==="number")this[W$](null,0);return this}write($,Q){if(typeof $==="string")$=Buffer.from($,Q);if(this[D$])return this.emit("error",new Error("write() after end()")),!1;if(this[I]===void 0||this[i0]||this[G0].length)return this[G0].push($),this[W5]=!0,!1;return this[i0]=!0,this[q5]($),!0}[q5]($){u.write(this[I],$,0,$.length,this[N0],(Q,V)=>this[W$](Q,V))}[W$]($,Q){if($)this[B$]($);else{if(this[N0]!==void 0&&typeof Q==="number")this[N0]+=Q;if(this[G0].length)this[x1]();else if(this[i0]=!1,this[D$]&&!this[H1])this[H1]=!0,this[V0](),this.emit("finish");else if(this[W5])this[W5]=!1,this.emit("drain")}}[x1](){if(this[G0].length===0){if(this[D$])this[W$](null,0)}else if(this[G0].length===1)this[q5](this[G0].pop());else{const $=this[G0];this[G0]=[],wV(this[I],$,this[N0],(Q,V)=>this[W$](Q,V))}}[V0](){if(this[S0]&&typeof this[I]==="number"){const $=this[I];this[I]=void 0,u.close($,(Q)=>Q?this.emit("error",Q):this.emit("close"))}}}class _$ extends R0{[_0](){let $;if(this[B5]&&this[v0]==="r+")try{$=u.openSync(this[Q0],this[v0],this[S$])}catch(Q){if(Q?.code==="ENOENT")return this[v0]="w",this[_0]();else throw Q}else $=u.openSync(this[Q0],this[v0],this[S$]);this[L$](null,$)}[V0](){if(this[S0]&&typeof this[I]==="number"){const $=this[I];this[I]=void 0,u.closeSync($),this.emit("close")}}[q5]($){let Q=!0;try{this[W$](null,u.writeSync(this[I],$,0,$.length,this[N0])),Q=!1}finally{if(Q)try{this[V0]()}catch{}}}}import a7 from"node:path";import I$ from"node:fs";import{dirname as aV,parse as nV} from"path";var AV=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"]]),w7=($)=>!!$.sync&&!!$.file,A7=($)=>!$.sync&&!!$.file,I7=($)=>!!$.sync&&!$.file,P7=($)=>!$.sync&&!$.file;var F7=($)=>!!$.file;var IV=($)=>{const Q=AV.get($);if(Q)return Q;return $},R$=($={})=>{if(!$)return{};const Q={};for(let[V,X]of Object.entries($)){const J=IV(V);Q[J]=X}if(Q.chmod===void 0&&Q.noChmod===!1)Q.chmod=!0;return delete Q.noChmod,Q};var Y0=($,Q,V,X,J)=>{return Object.assign((Z=[],K,G)=>{if(Array.isArray(Z))K=Z,Z={};if(typeof K==="function")G=K,K=void 0;if(!K)K=[];else K=Array.from(K);const Y=R$(Z);if(J?.(Y,K),w7(Y)){if(typeof G==="function")throw new TypeError("callback not supported for sync tar functions");return $(Y,K)}else if(A7(Y)){const W=Q(Y,K),z=G?G:void 0;return z?W.then(()=>z(),z):W}else if(I7(Y)){if(typeof G==="function")throw new TypeError("callback not supported for sync tar functions");return V(Y,K)}else if(P7(Y)){if(typeof G==="function")throw new TypeError("callback only supported with file option");return X(Y,K)}else throw new Error("impossible options??")},{syncFile:$,asyncFile:Q,syncNoFile:V,asyncNoFile:X,validate:J})};import{EventEmitter as dV} from"events";import _1 from"assert";import{Buffer as g0} from"buffer";import vV from"zlib";import PV from"zlib";var FV=PV.constants||{ZLIB_VERNUM:4736},H0=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},FV));var v7=g0.concat,a0=Symbol("_superWrite");class g$ extends Error{code;errno;constructor($){super("zlib: "+$.message);if(this.code=$.code,this.errno=$.errno,!this.code)this.code="ZLIB_ERROR";this.message="zlib: "+$.message,Error.captureStackTrace(this,this.constructor)}get name(){return"ZlibError"}}var S1=Symbol("flushFlag");class R1 extends c{#$=!1;#V=!1;#X;#Z;#J;#Q;#K;get sawError(){return this.#$}get handle(){return this.#Q}get flushFlag(){return this.#X}constructor($,Q){if(!$||typeof $!=="object")throw new TypeError("invalid options for ZlibBase constructor");super($);this.#X=$.flush??0,this.#Z=$.finishFlush??0,this.#J=$.fullFlushFlag??0;try{this.#Q=new vV[Q]($)}catch(V){throw new g$(V)}this.#K=(V)=>{if(this.#$)return;this.#$=!0,this.close(),this.emit("error",V)},this.#Q?.on("error",(V)=>this.#K(new g$(V))),this.once("end",()=>this.close)}close(){if(this.#Q)this.#Q.close(),this.#Q=void 0,this.emit("close")}reset(){if(!this.#$)return _1(this.#Q,"zlib binding closed"),this.#Q.reset?.()}flush($){if(this.ended)return;if(typeof $!=="number")$=this.#J;this.write(Object.assign(g0.alloc(0),{[S1]:$}))}end($,Q,V){if(typeof $==="function")V=$,Q=void 0,$=void 0;if(typeof Q==="function")V=Q,Q=void 0;if($)if(Q)this.write($,Q);else this.write($);return this.flush(this.#Z),this.#V=!0,super.end(V)}get ended(){return this.#V}[a0]($){return super.write($)}write($,Q,V){if(typeof Q==="function")V=Q,Q="utf8";if(typeof $==="string")$=g0.from($,Q);if(this.#$)return;_1(this.#Q,"zlib binding closed");const X=this.#Q._handle,J=X.close;X.close=()=>{};const Z=this.#Q.close;this.#Q.close=()=>{},g0.concat=(Y)=>Y;let K=void 0;try{const Y=typeof $[S1]==="number"?$[S1]:this.#X;K=this.#Q._processChunk($,Y),g0.concat=v7}catch(Y){g0.concat=v7,this.#K(new g$(Y))}finally{if(this.#Q)this.#Q._handle=X,X.close=J,this.#Q.close=Z,this.#Q.removeAllListeners("error")}if(this.#Q)this.#Q.on("error",(Y)=>this.#K(new g$(Y)));let G;if(K)if(Array.isArray(K)&&K.length>0){const Y=K[0];G=this[a0](g0.from(Y));for(let W=1;W{if(typeof X==="function")J=X,X=this.flushFlag;this.flush(X),J?.()};try{this.handle.params($,Q)}finally{this.handle.flush=V}if(this.handle)this.#$=$,this.#V=Q}}}class k1 extends g1{#$;constructor($){super($,"Gzip");this.#$=$&&!!$.portable}[a0]($){if(!this.#$)return super[a0]($);return this.#$=!1,$[9]=255,super[a0]($)}}class y1 extends g1{constructor($){super($,"Unzip")}}class m1 extends R1{constructor($,Q){$=$||{},$.flush=$.flush||H0.BROTLI_OPERATION_PROCESS,$.finishFlush=$.finishFlush||H0.BROTLI_OPERATION_FINISH,$.fullFlushFlag=H0.BROTLI_OPERATION_FLUSH;super($,Q)}}class b1 extends m1{constructor($){super($,"BrotliCompress")}}class E1 extends m1{constructor($){super($,"BrotliDecompress")}}var xV=function($,Q,V){const X=Q,J=Q?Q.next:$.head,Z=new L5(V,X,J,$);if(Z.next===void 0)$.tail=Z;if(Z.prev===void 0)$.head=Z;return $.length++,Z},OV=function($,Q){if($.tail=new L5(Q,$.tail,void 0,$),!$.head)$.head=$.tail;$.length++},UV=function($,Q){if($.head=new L5(Q,void 0,$.head,$),!$.tail)$.tail=$.head;$.length++};class z0{tail;head;length=0;static create($=[]){return new z0($)}constructor($=[]){for(let Q of $)this.push(Q)}*[Symbol.iterator](){for(let $=this.head;$;$=$.next)yield $.value}removeNode($){if($.list!==this)throw new Error("removing node which does not belong to this list");const{next:Q,prev:V}=$;if(Q)Q.prev=V;if(V)V.next=Q;if($===this.head)this.head=Q;if($===this.tail)this.tail=V;return this.length--,$.next=void 0,$.prev=void 0,$.list=void 0,Q}unshiftNode($){if($===this.head)return;if($.list)$.list.removeNode($);const Q=this.head;if($.list=this,$.next=Q,Q)Q.prev=$;if(this.head=$,!this.tail)this.tail=$;this.length++}pushNode($){if($===this.tail)return;if($.list)$.list.removeNode($);const Q=this.tail;if($.list=this,$.prev=Q,Q)Q.next=$;if(this.tail=$,!this.head)this.head=$;this.length++}push(...$){for(let Q=0,V=$.length;Q1)V=Q;else if(this.head)X=this.head.next,V=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var J=0;X;J++)V=$(V,X.value,J),X=X.next;return V}reduceReverse($,Q){let V,X=this.tail;if(arguments.length>1)V=Q;else if(this.tail)X=this.tail.prev,V=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(let J=this.length-1;X;J--)V=$(V,X.value,J),X=X.prev;return V}toArray(){const $=new Array(this.length);for(let Q=0,V=this.head;V;Q++)$[Q]=V.value,V=V.next;return $}toArrayReverse(){const $=new Array(this.length);for(let Q=0,V=this.tail;V;Q++)$[Q]=V.value,V=V.prev;return $}slice($=0,Q=this.length){if(Q<0)Q+=this.length;if($<0)$+=this.length;const V=new z0;if(Q<$||Q<0)return V;if($<0)$=0;if(Q>this.length)Q=this.length;let X=this.head,J=0;for(J=0;!!X&&J<$;J++)X=X.next;for(;!!X&&Jthis.length)Q=this.length;let X=this.length,J=this.tail;for(;!!J&&X>Q;X--)J=J.prev;for(;!!J&&X>$;X--,J=J.prev)V.push(J.value);return V}splice($,Q=0,...V){if($>this.length)$=this.length-1;if($<0)$=this.length+$;let X=this.head;for(let Z=0;!!X&&Z<$;Z++)X=X.next;const J=[];for(let Z=0;!!X&&Z{if(!Number.isSafeInteger($))throw Error("cannot encode number outside of javascript safe integer range");else if($<0)CV($,Q);else TV($,Q);return Q},TV=($,Q)=>{Q[0]=128;for(var V=Q.length;V>1;V--)Q[V-1]=$&255,$=Math.floor($/256)},CV=($,Q)=>{Q[0]=255;var V=!1;$=$*-1;for(var X=Q.length;X>1;X--){var J=$&255;if($=Math.floor($/256),V)Q[X-1]=O7(J);else if(J===0)Q[X-1]=0;else V=!0,Q[X-1]=U7(J)}},x7=($)=>{const Q=$[0],V=Q===128?DV($.subarray(1,$.length)):Q===255?jV($):null;if(V===null)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(V))throw Error("parsed number outside of javascript safe integer range");return V},jV=($)=>{var Q=$.length,V=0,X=!1;for(var J=Q-1;J>-1;J--){var Z=Number($[J]),K;if(X)K=O7(Z);else if(Z===0)K=Z;else X=!0,K=U7(Z);if(K!==0)V-=K*Math.pow(256,Q-J-1)}return V},DV=($)=>{var Q=$.length,V=0;for(var X=Q-1;X>-1;X--){var J=Number($[X]);if(J!==0)V+=J*Math.pow(256,Q-X-1)}return V},O7=($)=>(255^$)&255,U7=($)=>(255^$)+1&255;var M5=($)=>w5.has($);var w5=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"]]),T7=new Map(Array.from(w5).map(($)=>[$[1],$[0]]));class a{cksumValid=!1;needPax=!1;nullBlock=!1;block;path;mode;uid;gid;size;cksum;#$="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor($,Q=0,V,X){if(Buffer.isBuffer($))this.decode($,Q||0,V,X);else if($)this.#V($)}decode($,Q,V,X){if(!Q)Q=0;if(!$||!($.length>=Q+512))throw new Error("need 512 bytes for header");if(this.path=n0($,Q,100),this.mode=k0($,Q+100,8),this.uid=k0($,Q+108,8),this.gid=k0($,Q+116,8),this.size=k0($,Q+124,12),this.mtime=h1($,Q+136,12),this.cksum=k0($,Q+148,12),X)this.#V(X,!0);if(V)this.#V(V);const J=n0($,Q+156,1);if(M5(J))this.#$=J||"0";if(this.#$==="0"&&this.path.slice(-1)==="/")this.#$="5";if(this.#$==="5")this.size=0;if(this.linkpath=n0($,Q+157,100),$.subarray(Q+257,Q+265).toString()==="ustar\x0000")if(this.uname=n0($,Q+265,32),this.gname=n0($,Q+297,32),this.devmaj=k0($,Q+329,8)??0,this.devmin=k0($,Q+337,8)??0,$[Q+475]!==0){const K=n0($,Q+345,155);this.path=K+"/"+this.path}else{const K=n0($,Q+345,130);if(K)this.path=K+"/"+this.path;this.atime=h1($,Q+476,12),this.ctime=h1($,Q+488,12)}let Z=256;for(let K=Q;K{return!(X===null||X===void 0||V==="path"&&Q||V==="linkpath"&&Q||V==="global")})))}encode($,Q=0){if(!$)$=this.block=Buffer.alloc(512);if(this.#$==="Unsupported")this.#$="0";if(!($.length>=Q+512))throw new Error("need 512 bytes for header");const V=this.ctime||this.atime?130:155,X=SV(this.path||"",V),J=X[0],Z=X[1];if(this.needPax=!!X[2],this.needPax=s0($,Q,100,J)||this.needPax,this.needPax=y0($,Q+100,8,this.mode)||this.needPax,this.needPax=y0($,Q+108,8,this.uid)||this.needPax,this.needPax=y0($,Q+116,8,this.gid)||this.needPax,this.needPax=y0($,Q+124,12,this.size)||this.needPax,this.needPax=u1($,Q+136,12,this.mtime)||this.needPax,$[Q+156]=this.#$.charCodeAt(0),this.needPax=s0($,Q+157,100,this.linkpath)||this.needPax,$.write("ustar\x0000",Q+257,8),this.needPax=s0($,Q+265,32,this.uname)||this.needPax,this.needPax=s0($,Q+297,32,this.gname)||this.needPax,this.needPax=y0($,Q+329,8,this.devmaj)||this.needPax,this.needPax=y0($,Q+337,8,this.devmin)||this.needPax,this.needPax=s0($,Q+345,V,Z)||this.needPax,$[Q+475]!==0)this.needPax=s0($,Q+345,155,Z)||this.needPax;else this.needPax=s0($,Q+345,130,Z)||this.needPax,this.needPax=u1($,Q+476,12,this.atime)||this.needPax,this.needPax=u1($,Q+488,12,this.ctime)||this.needPax;let K=256;for(let G=Q;G{let X=$,J="",Z=void 0;const K=w$.parse($).root||".";if(Buffer.byteLength(X)<100)Z=[X,J,!1];else{J=w$.dirname(X),X=w$.basename(X);do if(Buffer.byteLength(X)<=100&&Buffer.byteLength(J)<=Q)Z=[X,J,!1];else if(Buffer.byteLength(X)>100&&Buffer.byteLength(J)<=Q)Z=[X.slice(0,99),J,!0];else X=w$.join(w$.basename(J),X),J=w$.dirname(J);while(J!==K&&Z===void 0);if(!Z)Z=[$.slice(0,99),"",!0]}return Z},n0=($,Q,V)=>$.subarray(Q,Q+V).toString("utf8").replace(/\0.*/,""),h1=($,Q,V)=>_V(k0($,Q,V)),_V=($)=>$===void 0?void 0:new Date($*1000),k0=($,Q,V)=>Number($[Q])&128?x7($.subarray(Q,Q+V)):gV($,Q,V),RV=($)=>isNaN($)?void 0:$,gV=($,Q,V)=>RV(parseInt($.subarray(Q,Q+V).toString("utf8").replace(/\0.*$/,"").trim(),8)),kV={12:8589934591,8:2097151},y0=($,Q,V,X)=>X===void 0?!1:X>kV[V]||X<0?(H7(X,$.subarray(Q,Q+V)),!0):(yV($,Q,V,X),!1),yV=($,Q,V,X)=>$.write(mV(X,V),Q,V,"ascii"),mV=($,Q)=>bV(Math.floor($).toString(8),Q),bV=($,Q)=>($.length===Q-1?$:new Array(Q-$.length-1).join("0")+$+" ")+"\0",u1=($,Q,V,X)=>X===void 0?!1:y0($,Q,V,X.getTime()/1000),EV=new Array(156).join("\0"),s0=($,Q,V,X)=>X===void 0?!1:($.write(X+EV,Q,V,"utf8"),X.length!==Buffer.byteLength(X)||X.length>V);import{basename as hV} from"node:path";class m0{atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor($,Q=!1){this.atime=$.atime,this.charset=$.charset,this.comment=$.comment,this.ctime=$.ctime,this.dev=$.dev,this.gid=$.gid,this.global=Q,this.gname=$.gname,this.ino=$.ino,this.linkpath=$.linkpath,this.mtime=$.mtime,this.nlink=$.nlink,this.path=$.path,this.size=$.size,this.uid=$.uid,this.uname=$.uname}encode(){const $=this.encodeBody();if($==="")return Buffer.allocUnsafe(0);const Q=Buffer.byteLength($),V=512*Math.ceil(1+Q/512),X=Buffer.allocUnsafe(V);for(let J=0;J<512;J++)X[J]=0;new a({path:("PaxHeader/"+hV(this.path??"")).slice(0,99),mode:this.mode||420,uid:this.uid,gid:this.gid,size:Q,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(X),X.write($,512,Q,"utf8");for(let J=Q+512;J=Math.pow(10,Z))Z+=1;return Z+J+X}static parse($,Q,V=!1){return new m0(uV(fV($),Q),V)}}var uV=($,Q)=>Q?Object.assign({},Q,$):$,fV=($)=>$.replace(/\n$/,"").split("\n").reduce(cV,Object.create(null)),cV=($,Q)=>{const V=parseInt(Q,10);if(V!==Buffer.byteLength(Q)+1)return $;Q=Q.slice((V+" ").length);const X=Q.split("="),J=X.shift();if(!J)return $;const Z=J.replace(/^SCHILY\.(dev|ino|nlink)/,"$1"),K=X.join("=");return $[Z]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(Z)?new Date(Number(K)*1000):/^[0-9]+$/.test(K)?+K:K,$};var lV=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,M=lV!=="win32"?($)=>$:($)=>$&&$.replace(/\\/g,"/");class k$ extends c{extended;globalExtended;header;startBlockSize;blockRemain;remain;type;meta=!1;ignore=!1;path;mode;uid;gid;uname;gname;size=0;mtime;atime;ctime;linkpath;dev;ino;nlink;invalid=!1;absolute;unsupported=!1;constructor($,Q,V){super({});switch(this.pause(),this.extended=Q,this.globalExtended=V,this.header=$,this.remain=$.size??0,this.startBlockSize=512*Math.ceil(this.remain/512),this.blockRemain=this.startBlockSize,this.type=$.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=!0;break;default:this.ignore=!0}if(!$.path)throw new Error("no path provided for tar.ReadEntry");if(this.path=M($.path),this.mode=$.mode,this.mode)this.mode=this.mode&4095;if(this.uid=$.uid,this.gid=$.gid,this.uname=$.uname,this.gname=$.gname,this.size=this.remain,this.mtime=$.mtime,this.atime=$.atime,this.ctime=$.ctime,this.linkpath=$.linkpath?M($.linkpath):void 0,this.uname=$.uname,this.gname=$.gname,Q)this.#$(Q);if(V)this.#$(V,!0)}write($){const Q=$.length;if(Q>this.blockRemain)throw new Error("writing more to entry than is appropriate");const V=this.remain,X=this.blockRemain;if(this.remain=Math.max(0,V-Q),this.blockRemain=Math.max(0,X-Q),this.ignore)return!0;if(V>=Q)return super.write($);return super.write($.subarray(0,V))}#$($,Q=!1){if($.path)$.path=M($.path);if($.linkpath)$.linkpath=M($.linkpath);Object.assign(this,Object.fromEntries(Object.entries($).filter(([V,X])=>{return!(X===null||X===void 0||V==="path"&&Q)})))}}var r0=($,Q,V,X={})=>{if($.file)X.file=$.file;if($.cwd)X.cwd=$.cwd;if(X.code=V instanceof Error&&V.code||Q,X.tarCode=Q,!$.strict&&X.recoverable!==!1){if(V instanceof Error)X=Object.assign(V,X),V=V.message;$.emit("warn",Q,V,X)}else if(V instanceof Error)$.emit("error",Object.assign(V,X));else $.emit("error",Object.assign(new Error(`${Q}: ${V}`),X))};var iV=1048576,f1=Buffer.from([31,139]),n=Symbol("state"),o0=Symbol("writeEntry"),x0=Symbol("readEntry"),c1=Symbol("nextEntry"),j7=Symbol("processEntry"),W0=Symbol("extendedHeader"),y$=Symbol("globalExtendedHeader"),b0=Symbol("meta"),D7=Symbol("emitMeta"),v=Symbol("buffer"),O0=Symbol("queue"),E0=Symbol("ended"),l1=Symbol("emittedEnd"),t0=Symbol("emit"),j=Symbol("unzip"),A5=Symbol("consumeChunk"),I5=Symbol("consumeChunkSub"),d1=Symbol("consumeBody"),N7=Symbol("consumeMeta"),S7=Symbol("consumeHeader"),m$=Symbol("consuming"),i1=Symbol("bufferConcat"),P5=Symbol("maybeEnd"),A$=Symbol("writing"),h0=Symbol("aborted"),F5=Symbol("onDone"),e0=Symbol("sawValidEntry"),v5=Symbol("sawNullBlock"),H5=Symbol("sawEOF"),_7=Symbol("closeStream"),pV=()=>!0;class u0 extends dV{file;strict;maxMetaEntrySize;filter;brotli;writable=!0;readable=!1;[O0]=new z0;[v];[x0];[o0];[n]="begin";[b0]="";[W0];[y$];[E0]=!1;[j];[h0]=!1;[e0];[v5]=!1;[H5]=!1;[A$]=!1;[m$]=!1;[l1]=!1;constructor($={}){super();if(this.file=$.file||"",this.on(F5,()=>{if(this[n]==="begin"||this[e0]===!1)this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),$.ondone)this.on(F5,$.ondone);else this.on(F5,()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")});this.strict=!!$.strict,this.maxMetaEntrySize=$.maxMetaEntrySize||iV,this.filter=typeof $.filter==="function"?$.filter:pV;const Q=$.file&&($.file.endsWith(".tar.br")||$.file.endsWith(".tbr"));if(this.brotli=!$.gzip&&$.brotli!==void 0?$.brotli:Q?void 0:!1,this.on("end",()=>this[_7]()),typeof $.onwarn==="function")this.on("warn",$.onwarn);if(typeof $.onReadEntry==="function")this.on("entry",$.onReadEntry)}warn($,Q,V={}){r0(this,$,Q,V)}[S7]($,Q){if(this[e0]===void 0)this[e0]=!1;let V;try{V=new a($,Q,this[W0],this[y$])}catch(X){return this.warn("TAR_ENTRY_INVALID",X)}if(V.nullBlock)if(this[v5]){if(this[H5]=!0,this[n]==="begin")this[n]="header";this[t0]("eof")}else this[v5]=!0,this[t0]("nullBlock");else if(this[v5]=!1,!V.cksumValid)this.warn("TAR_ENTRY_INVALID","checksum failure",{header:V});else if(!V.path)this.warn("TAR_ENTRY_INVALID","path is required",{header:V});else{const X=V.type;if(/^(Symbolic)?Link$/.test(X)&&!V.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:V});else if(!/^(Symbolic)?Link$/.test(X)&&!/^(Global)?ExtendedHeader$/.test(X)&&V.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:V});else{const J=this[o0]=new k$(V,this[W0],this[y$]);if(!this[e0])if(J.remain){const Z=()=>{if(!J.invalid)this[e0]=!0};J.on("end",Z)}else this[e0]=!0;if(J.meta){if(J.size>this.maxMetaEntrySize)J.ignore=!0,this[t0]("ignoredEntry",J),this[n]="ignore",J.resume();else if(J.size>0)this[b0]="",J.on("data",(Z)=>this[b0]+=Z),this[n]="meta"}else if(this[W0]=void 0,J.ignore=J.ignore||!this.filter(J.path,J),J.ignore)this[t0]("ignoredEntry",J),this[n]=J.remain?"ignore":"header",J.resume();else{if(J.remain)this[n]="body";else this[n]="header",J.end();if(!this[x0])this[O0].push(J),this[c1]();else this[O0].push(J)}}}}[_7](){queueMicrotask(()=>this.emit("close"))}[j7]($){let Q=!0;if(!$)this[x0]=void 0,Q=!1;else if(Array.isArray($)){const[V,...X]=$;this.emit(V,...X)}else if(this[x0]=$,this.emit("entry",$),!$.emittedEnd)$.on("end",()=>this[c1]()),Q=!1;return Q}[c1](){do;while(this[j7](this[O0].shift()));if(!this[O0].length){const $=this[x0];if(!$||$.flowing||$.size===$.remain){if(!this[A$])this.emit("drain")}else $.once("drain",()=>this.emit("drain"))}}[d1]($,Q){const V=this[o0];if(!V)throw new Error("attempt to consume body without entry??");const X=V.blockRemain??0,J=X>=$.length&&Q===0?$:$.subarray(Q,Q+X);if(V.write(J),!V.blockRemain)this[n]="header",this[o0]=void 0,V.end();return J.length}[N7]($,Q){const V=this[o0],X=this[d1]($,Q);if(!this[o0]&&V)this[D7](V);return X}[t0]($,Q,V){if(!this[O0].length&&!this[x0])this.emit($,Q,V);else this[O0].push([$,Q,V])}[D7]($){switch(this[t0]("meta",this[b0]),$.type){case"ExtendedHeader":case"OldExtendedHeader":this[W0]=m0.parse(this[b0],this[W0],!1);break;case"GlobalExtendedHeader":this[y$]=m0.parse(this[b0],this[y$],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":{const Q=this[W0]??Object.create(null);this[W0]=Q,Q.path=this[b0].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{const Q=this[W0]||Object.create(null);this[W0]=Q,Q.linkpath=this[b0].replace(/\0.*/,"");break}default:throw new Error("unknown meta: "+$.type)}}abort($){this[h0]=!0,this.emit("abort",$),this.warn("TAR_ABORT",$,{recoverable:!1})}write($,Q,V){if(typeof Q==="function")V=Q,Q=void 0;if(typeof $==="string")$=Buffer.from($,typeof Q==="string"?Q:"utf8");if(this[h0])return V?.(),!1;if((this[j]===void 0||this.brotli===void 0&&this[j]===!1)&&$){if(this[v])$=Buffer.concat([this[v],$]),this[v]=void 0;if($.lengththis[A5](Y)),this[j].on("error",(Y)=>this.abort(Y)),this[j].on("end",()=>{this[E0]=!0,this[A5]()}),this[A$]=!0;const G=!!this[j][K?"end":"write"]($);return this[A$]=!1,V?.(),G}}if(this[A$]=!0,this[j])this[j].write($);else this[A5]($);this[A$]=!1;const J=this[O0].length?!1:this[x0]?this[x0].flowing:!0;if(!J&&!this[O0].length)this[x0]?.once("drain",()=>this.emit("drain"));return V?.(),J}[i1]($){if($&&!this[h0])this[v]=this[v]?Buffer.concat([this[v],$]):$}[P5](){if(this[E0]&&!this[l1]&&!this[h0]&&!this[m$]){this[l1]=!0;const $=this[o0];if($&&$.blockRemain){const Q=this[v]?this[v].length:0;if(this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${$.blockRemain} more bytes, only ${Q} available)`,{entry:$}),this[v])$.write(this[v]);$.end()}this[t0](F5)}}[A5]($){if(this[m$]&&$)this[i1]($);else if(!$&&!this[v])this[P5]();else if($){if(this[m$]=!0,this[v]){this[i1]($);const Q=this[v];this[v]=void 0,this[I5](Q)}else this[I5]($);while(this[v]&&this[v]?.length>=512&&!this[h0]&&!this[H5]){const Q=this[v];this[v]=void 0,this[I5](Q)}this[m$]=!1}if(!this[v]||this[E0])this[P5]()}[I5]($){let Q=0;const V=$.length;while(Q+512<=V&&!this[h0]&&!this[H5])switch(this[n]){case"begin":case"header":this[S7]($,Q),Q+=512;break;case"ignore":case"body":Q+=this[d1]($,Q);break;case"meta":Q+=this[N7]($,Q);break;default:throw new Error("invalid state: "+this[n])}if(Q{let Q=$.length-1,V=-1;while(Q>-1&&$.charAt(Q)==="/")V=Q,Q--;return V===-1?$:$.slice(0,V)};var sV=($)=>{const Q=$.onReadEntry;$.onReadEntry=Q?(V)=>{Q(V),V.resume()}:(V)=>V.resume()},p1=($,Q)=>{const V=new Map(Q.map((Z)=>[q0(Z),!0])),X=$.filter,J=(Z,K="")=>{const G=K||nV(Z).root||".";let Y;if(Z===G)Y=!1;else{const W=V.get(Z);if(W!==void 0)Y=W;else Y=J(aV(Z),G)}return V.set(Z,Y),Y};$.filter=X?(Z,K)=>X(Z,K)&&J(q0(Z)):(Z)=>J(q0(Z))},rV=($)=>{const Q=new u0($),V=$.file;let X;try{const J=I$.statSync(V),Z=$.maxReadSize||16777216;if(J.size{const V=new u0($),X=$.maxReadSize||16777216,J=$.file;return new Promise((K,G)=>{V.on("error",G),V.on("end",K),I$.stat(J,(Y,W)=>{if(Y)G(Y);else{const z=new M$(J,{readSize:X,size:W.size});z.on("error",G),z.pipe(V)}})})},$$=Y0(rV,oV,($)=>new u0($),($)=>new u0($),($,Q)=>{if(Q?.length)p1($,Q);if(!$.noResume)sV($)});import R5 from"fs";import B0 from"fs";import y7 from"path";var a1=($,Q,V)=>{if($&=4095,V)$=($|384)&-19;if(Q){if($&256)$|=64;if($&32)$|=8;if($&4)$|=1}return $};import{win32 as tV} from"node:path";var{isAbsolute:eV,parse:R7}=tV,b$=($)=>{let Q="",V=R7($);while(eV($)||V.root){const X=$.charAt(0)==="/"&&$.slice(0,4)!=="//?/"?"/":V.root;$=$.slice(X.length),Q+=X,V=R7($)}return[Q,$]};var x5=["|","<",">","?",":"],n1=x5.map(($)=>String.fromCharCode(61440+$.charCodeAt(0))),$X=new Map(x5.map(($,Q)=>[$,n1[Q]])),QX=new Map(n1.map(($,Q)=>[$,x5[Q]])),s1=($)=>x5.reduce((Q,V)=>Q.split(V).join($X.get(V)),$),g7=($)=>n1.reduce((Q,V)=>Q.split(V).join(QX.get(V)),$);var u7=($,Q)=>{if(!Q)return M($);return $=M($).replace(/^\.(\/|$)/,""),q0(Q)+"/"+$},VX=16777216,m7=Symbol("process"),b7=Symbol("file"),E7=Symbol("directory"),o1=Symbol("symlink"),h7=Symbol("hardlink"),E$=Symbol("header"),O5=Symbol("read"),t1=Symbol("lstat"),U5=Symbol("onlstat"),e1=Symbol("onread"),$8=Symbol("onreadlink"),Q8=Symbol("openfile"),V8=Symbol("onopenfile"),f0=Symbol("close"),T5=Symbol("mode"),X8=Symbol("awaitDrain"),r1=Symbol("ondrain"),L0=Symbol("prefix");class C5 extends c{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;#$=!1;constructor($,Q={}){const V=R$(Q);super();if(this.path=M($),this.portable=!!V.portable,this.maxReadSize=V.maxReadSize||VX,this.linkCache=V.linkCache||new Map,this.statCache=V.statCache||new Map,this.preservePaths=!!V.preservePaths,this.cwd=M(V.cwd||process.cwd()),this.strict=!!V.strict,this.noPax=!!V.noPax,this.noMtime=!!V.noMtime,this.mtime=V.mtime,this.prefix=V.prefix?M(V.prefix):void 0,typeof V.onwarn==="function")this.on("warn",V.onwarn);let X=!1;if(!this.preservePaths){const[Z,K]=b$(this.path);if(Z&&typeof K==="string")this.path=K,X=Z}if(this.win32=!!V.win32||process.platform==="win32",this.win32)this.path=g7(this.path.replace(/\\/g,"/")),$=$.replace(/\\/g,"/");if(this.absolute=M(V.absolute||y7.resolve(this.cwd,$)),this.path==="")this.path="./";if(X)this.warn("TAR_ENTRY_INFO",`stripping ${X} from absolute path`,{entry:this,path:X+this.path});const J=this.statCache.get(this.absolute);if(J)this[U5](J);else this[t1]()}warn($,Q,V={}){return r0(this,$,Q,V)}emit($,...Q){if($==="error")this.#$=!0;return super.emit($,...Q)}[t1](){B0.lstat(this.absolute,($,Q)=>{if($)return this.emit("error",$);this[U5](Q)})}[U5]($){if(this.statCache.set(this.absolute,$),this.stat=$,!$.isFile())$.size=0;this.type=XX($),this.emit("stat",$),this[m7]()}[m7](){switch(this.type){case"File":return this[b7]();case"Directory":return this[E7]();case"SymbolicLink":return this[o1]();default:return this.end()}}[T5]($){return a1($,this.type==="Directory",this.portable)}[L0]($){return u7($,this.prefix)}[E$](){if(!this.stat)throw new Error("cannot write header before stat");if(this.type==="Directory"&&this.portable)this.noMtime=!0;if(this.header=new a({path:this[L0](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[L0](this.linkpath):this.linkpath,mode:this[T5](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 m0({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[L0](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[L0](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());const $=this.header?.block;if(!$)throw new Error("failed to encode header");super.write($)}[E7](){if(!this.stat)throw new Error("cannot create directory entry without stat");if(this.path.slice(-1)!=="/")this.path+="/";this.stat.size=0,this[E$](),this.end()}[o1](){B0.readlink(this.absolute,($,Q)=>{if($)return this.emit("error",$);this[$8](Q)})}[$8]($){this.linkpath=M($),this[E$](),this.end()}[h7]($){if(!this.stat)throw new Error("cannot create link entry without stat");this.type="Link",this.linkpath=M(y7.relative(this.cwd,$)),this.stat.size=0,this[E$](),this.end()}[b7](){if(!this.stat)throw new Error("cannot create file entry without stat");if(this.stat.nlink>1){const $=`${this.stat.dev}:${this.stat.ino}`,Q=this.linkCache.get($);if(Q?.indexOf(this.cwd)===0)return this[h7](Q);this.linkCache.set($,this.absolute)}if(this[E$](),this.stat.size===0)return this.end();this[Q8]()}[Q8](){B0.open(this.absolute,"r",($,Q)=>{if($)return this.emit("error",$);this[V8](Q)})}[V8]($){if(this.fd=$,this.#$)return this[f0]();if(!this.stat)throw new Error("should stat before calling onopenfile");this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;const Q=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(Q),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[O5]()}[O5](){const{fd:$,buf:Q,offset:V,length:X,pos:J}=this;if($===void 0||Q===void 0)throw new Error("cannot read file without first opening");B0.read($,Q,V,X,J,(Z,K)=>{if(Z)return this[f0](()=>this.emit("error",Z));this[e1](K)})}[f0]($=()=>{}){if(this.fd!==void 0)B0.close(this.fd,$)}[e1]($){if($<=0&&this.remain>0){const X=Object.assign(new Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[f0](()=>this.emit("error",X))}if($>this.remain){const X=Object.assign(new Error("did not encounter expected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[f0](()=>this.emit("error",X))}if(!this.buf)throw new Error("should have created buffer prior to reading");if($===this.remain)for(let X=$;Xthis[r1]());else this[r1]()}[X8]($){this.once("drain",$)}write($,Q,V){if(typeof Q==="function")V=Q,Q=void 0;if(typeof $==="string")$=Buffer.from($,typeof Q==="string"?Q:"utf8");if(this.blockRemain<$.length){const X=Object.assign(new Error("writing more data than expected"),{path:this.absolute});return this.emit("error",X)}return this.remain-=$.length,this.blockRemain-=$.length,this.pos+=$.length,this.offset+=$.length,super.write($,null,V)}[r1](){if(!this.remain){if(this.blockRemain)super.write(Buffer.alloc(this.blockRemain));return this[f0](($)=>$?this.emit("error",$):this.end())}if(!this.buf)throw new Error("buffer lost somehow in ONDRAIN");if(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[O5]()}}class J8 extends C5{sync=!0;[t1](){this[U5](B0.lstatSync(this.absolute))}[o1](){this[$8](B0.readlinkSync(this.absolute))}[Q8](){this[V8](B0.openSync(this.absolute,"r"))}[O5](){let $=!0;try{const{fd:Q,buf:V,offset:X,length:J,pos:Z}=this;if(Q===void 0||V===void 0)throw new Error("fd and buf must be set in READ method");const K=B0.readSync(Q,V,X,J,Z);this[e1](K),$=!1}finally{if($)try{this[f0](()=>{})}catch(Q){}}}[X8]($){$()}[f0]($=()=>{}){if(this.fd!==void 0)B0.closeSync(this.fd);$()}}class Z8 extends c{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;warn($,Q,V={}){return r0(this,$,Q,V)}constructor($,Q={}){const V=R$(Q);super();this.preservePaths=!!V.preservePaths,this.portable=!!V.portable,this.strict=!!V.strict,this.noPax=!!V.noPax,this.noMtime=!!V.noMtime,this.readEntry=$;const{type:X}=$;if(X==="Unsupported")throw new Error("writing entry that should be ignored");if(this.type=X,this.type==="Directory"&&this.portable)this.noMtime=!0;if(this.prefix=V.prefix,this.path=M($.path),this.mode=$.mode!==void 0?this[T5]($.mode):void 0,this.uid=this.portable?void 0:$.uid,this.gid=this.portable?void 0:$.gid,this.uname=this.portable?void 0:$.uname,this.gname=this.portable?void 0:$.gname,this.size=$.size,this.mtime=this.noMtime?void 0:V.mtime||$.mtime,this.atime=this.portable?void 0:$.atime,this.ctime=this.portable?void 0:$.ctime,this.linkpath=$.linkpath!==void 0?M($.linkpath):void 0,typeof V.onwarn==="function")this.on("warn",V.onwarn);let J=!1;if(!this.preservePaths){const[K,G]=b$(this.path);if(K&&typeof G==="string")this.path=G,J=K}if(this.remain=$.size,this.blockRemain=$.startBlockSize,this.header=new a({path:this[L0](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[L0](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}),J)this.warn("TAR_ENTRY_INFO",`stripping ${J} from absolute path`,{entry:this,path:J+this.path});if(this.header.encode()&&!this.noPax)super.write(new m0({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[L0](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[L0](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());const Z=this.header?.block;if(!Z)throw new Error("failed to encode header");super.write(Z),$.pipe(this)}[L0]($){return u7($,this.prefix)}[T5]($){return a1($,this.type==="Directory",this.portable)}write($,Q,V){if(typeof Q==="function")V=Q,Q=void 0;if(typeof $==="string")$=Buffer.from($,typeof Q==="string"?Q:"utf8");const X=$.length;if(X>this.blockRemain)throw new Error("writing more to entry than is appropriate");return this.blockRemain-=X,super.write($,V)}end($,Q,V){if(this.blockRemain)super.write(Buffer.alloc(this.blockRemain));if(typeof $==="function")V=$,Q=void 0,$=void 0;if(typeof Q==="function")V=Q,Q=void 0;if(typeof $==="string")$=Buffer.from($,Q??"utf8");if(V)this.once("finish",V);return $?super.end($,V):super.end(V),this}}var XX=($)=>$.isFile()?"File":$.isDirectory()?"Directory":$.isSymbolicLink()?"SymbolicLink":"Unsupported";import i7 from"path";class z8{path;absolute;entry;stat;readdir;pending=!1;ignore=!1;piped=!1;constructor($,Q){this.path=$||"./",this.absolute=Q}}var f7=Buffer.alloc(1024),j5=Symbol("onStat"),h$=Symbol("ended"),X0=Symbol("queue"),P$=Symbol("current"),Q$=Symbol("process"),u$=Symbol("processing"),c7=Symbol("processJob"),J0=Symbol("jobs"),K8=Symbol("jobDone"),D5=Symbol("addFSEntry"),l7=Symbol("addTarEntry"),W8=Symbol("stat"),q8=Symbol("readdir"),N5=Symbol("onreaddir"),S5=Symbol("pipe"),d7=Symbol("entry"),G8=Symbol("entryOpt"),_5=Symbol("writeEntryClass"),p7=Symbol("write"),Y8=Symbol("ondrain");class V$ extends c{opt;cwd;maxReadSize;preservePaths;strict;noPax;prefix;linkCache;statCache;file;portable;zip;readdirCache;noDirRecurse;follow;noMtime;mtime;filter;jobs;[_5];onWriteEntry;[X0];[J0]=0;[u$]=!1;[h$]=!1;constructor($={}){super();if(this.opt=$,this.file=$.file||"",this.cwd=$.cwd||process.cwd(),this.maxReadSize=$.maxReadSize,this.preservePaths=!!$.preservePaths,this.strict=!!$.strict,this.noPax=!!$.noPax,this.prefix=M($.prefix||""),this.linkCache=$.linkCache||new Map,this.statCache=$.statCache||new Map,this.readdirCache=$.readdirCache||new Map,this.onWriteEntry=$.onWriteEntry,this[_5]=C5,typeof $.onwarn==="function")this.on("warn",$.onwarn);if(this.portable=!!$.portable,$.gzip||$.brotli){if($.gzip&&$.brotli)throw new TypeError("gzip and brotli are mutually exclusive");if($.gzip){if(typeof $.gzip!=="object")$.gzip={};if(this.portable)$.gzip.portable=!0;this.zip=new k1($.gzip)}if($.brotli){if(typeof $.brotli!=="object")$.brotli={};this.zip=new b1($.brotli)}if(!this.zip)throw new Error("impossible");const Q=this.zip;Q.on("data",(V)=>super.write(V)),Q.on("end",()=>super.end()),Q.on("drain",()=>this[Y8]()),this.on("resume",()=>Q.resume())}else this.on("drain",this[Y8]);if(this.noDirRecurse=!!$.noDirRecurse,this.follow=!!$.follow,this.noMtime=!!$.noMtime,$.mtime)this.mtime=$.mtime;this.filter=typeof $.filter==="function"?$.filter:()=>!0,this[X0]=new z0,this[J0]=0,this.jobs=Number($.jobs)||4,this[u$]=!1,this[h$]=!1}[p7]($){return super.write($)}add($){return this.write($),this}end($){if($)this.add($);return this[h$]=!0,this[Q$](),this}write($){if(this[h$])throw new Error("write after end");if($ instanceof k$)this[l7]($);else this[D5]($);return this.flowing}[l7]($){const Q=M(i7.resolve(this.cwd,$.path));if(!this.filter($.path,$))$.resume();else{const V=new z8($.path,Q);V.entry=new Z8($,this[G8](V)),V.entry.on("end",()=>this[K8](V)),this[J0]+=1,this[X0].push(V)}this[Q$]()}[D5]($){const Q=M(i7.resolve(this.cwd,$));this[X0].push(new z8($,Q)),this[Q$]()}[W8]($){$.pending=!0,this[J0]+=1;const Q=this.follow?"stat":"lstat";R5[Q]($.absolute,(V,X)=>{if($.pending=!1,this[J0]-=1,V)this.emit("error",V);else this[j5]($,X)})}[j5]($,Q){if(this.statCache.set($.absolute,Q),$.stat=Q,!this.filter($.path,Q))$.ignore=!0;this[Q$]()}[q8]($){$.pending=!0,this[J0]+=1,R5.readdir($.absolute,(Q,V)=>{if($.pending=!1,this[J0]-=1,Q)return this.emit("error",Q);this[N5]($,V)})}[N5]($,Q){this.readdirCache.set($.absolute,Q),$.readdir=Q,this[Q$]()}[Q$](){if(this[u$])return;this[u$]=!0;for(let $=this[X0].head;!!$&&this[J0]this.warn(Q,V,X),noPax:this.noPax,cwd:this.cwd,absolute:$.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}}[d7]($){this[J0]+=1;try{const Q=new this[_5]($.path,this[G8]($));return this.onWriteEntry?.(Q),Q.on("end",()=>this[K8]($)).on("error",(V)=>this.emit("error",V))}catch(Q){this.emit("error",Q)}}[Y8](){if(this[P$]&&this[P$].entry)this[P$].entry.resume()}[S5]($){if($.piped=!0,$.readdir)$.readdir.forEach((X)=>{const J=$.path,Z=J==="./"?"":J.replace(/\/*$/,"/");this[D5](Z+X)});const Q=$.entry,V=this.zip;if(!Q)throw new Error("cannot pipe without source");if(V)Q.on("data",(X)=>{if(!V.write(X))Q.pause()});else Q.on("data",(X)=>{if(!super.write(X))Q.pause()})}pause(){if(this.zip)this.zip.pause();return super.pause()}warn($,Q,V={}){r0(this,$,Q,V)}}class F$ extends V${sync=!0;constructor($){super($);this[_5]=J8}pause(){}resume(){}[W8]($){const Q=this.follow?"statSync":"lstatSync";this[j5]($,R5[Q]($.absolute))}[q8]($){this[N5]($,R5.readdirSync($.absolute))}[S5]($){const Q=$.entry,V=this.zip;if($.readdir)$.readdir.forEach((X)=>{const J=$.path,Z=J==="./"?"":J.replace(/\/*$/,"/");this[D5](Z+X)});if(!Q)throw new Error("Cannot pipe without source");if(V)Q.on("data",(X)=>{V.write(X)});else Q.on("data",(X)=>{super[p7](X)})}}var JX=($,Q)=>{const V=new F$($),X=new _$($.file,{mode:$.mode||438});V.pipe(X),n7(V,Q)},ZX=($,Q)=>{const V=new V$($),X=new R0($.file,{mode:$.mode||438});V.pipe(X);const J=new Promise((Z,K)=>{X.on("error",K),X.on("close",Z),V.on("error",K)});return s7(V,Q),J},n7=($,Q)=>{Q.forEach((V)=>{if(V.charAt(0)==="@")$$({file:a7.resolve($.cwd,V.slice(1)),sync:!0,noResume:!0,onReadEntry:(X)=>$.add(X)});else $.add(V)}),$.end()},s7=async($,Q)=>{for(let V=0;V{$.add(J)}});else $.add(X)}$.end()},KX=($,Q)=>{const V=new F$($);return n7(V,Q),V},GX=($,Q)=>{const V=new V$($);return s7(V,Q),V},YX=Y0(JX,ZX,KX,GX,($,Q)=>{if(!Q?.length)throw new TypeError("no paths specified to add to archive")});import I4 from"node:fs";import yX from"node:assert";import{randomBytes as A4} from"node:crypto";import A from"node:fs";import T0 from"node:path";import r7 from"fs";var zX=process.env.__FAKE_PLATFORM__||process.platform,WX=zX==="win32",{O_CREAT:qX,O_TRUNC:BX,O_WRONLY:LX}=r7.constants,o7=Number(process.env.__FAKE_FS_O_FILENAME__)||r7.constants.UV_FS_O_FILEMAP||0,MX=WX&&!!o7,wX=524288,AX=o7|BX|qX|LX,B8=!MX?()=>"w":($)=>${try{return k5.lchownSync($,Q,V)}catch(X){if(X?.code!=="ENOENT")throw X}},g5=($,Q,V,X)=>{k5.lchown($,Q,V,(J)=>{X(J&&J?.code!=="ENOENT"?J:null)})},IX=($,Q,V,X,J)=>{if(Q.isDirectory())M8(f$.resolve($,Q.name),V,X,(Z)=>{if(Z)return J(Z);const K=f$.resolve($,Q.name);g5(K,V,X,J)});else{const Z=f$.resolve($,Q.name);g5(Z,V,X,J)}},M8=($,Q,V,X)=>{k5.readdir($,{withFileTypes:!0},(J,Z)=>{if(J){if(J.code==="ENOENT")return X();else if(J.code!=="ENOTDIR"&&J.code!=="ENOTSUP")return X(J)}if(J||!Z.length)return g5($,Q,V,X);let K=Z.length,G=null;const Y=(W)=>{if(G)return;if(W)return X(G=W);if(--K===0)return g5($,Q,V,X)};for(let W of Z)IX($,W,Q,V,Y)})},PX=($,Q,V,X)=>{if(Q.isDirectory())w8(f$.resolve($,Q.name),V,X);L8(f$.resolve($,Q.name),V,X)},w8=($,Q,V)=>{let X;try{X=k5.readdirSync($,{withFileTypes:!0})}catch(J){const Z=J;if(Z?.code==="ENOENT")return;else if(Z?.code==="ENOTDIR"||Z?.code==="ENOTSUP")return L8($,Q,V);else throw Z}for(let J of X)PX($,J,Q,V);return L8($,Q,V)};import r from"fs";import{dirname as t7} from"path";import{mkdir as FX,mkdirSync as vX,stat as HX,statSync as xX} from"fs";var s=($)=>{if(!$)$={mode:511};else if(typeof $==="object")$={mode:511,...$};else if(typeof $==="number")$={mode:$};else if(typeof $==="string")$={mode:parseInt($,8)};else throw new TypeError("invalid options argument");const Q=$,V=$.fs||{};return $.mkdir=$.mkdir||V.mkdir||FX,$.mkdirAsync=$.mkdirAsync?$.mkdirAsync:async(X,J)=>{return new Promise((Z,K)=>Q.mkdir(X,J,(G,Y)=>G?K(G):Z(Y)))},$.stat=$.stat||V.stat||HX,$.statAsync=$.statAsync?$.statAsync:async(X)=>new Promise((J,Z)=>Q.stat(X,(K,G)=>K?Z(K):J(G))),$.statSync=$.statSync||V.statSync||xX,$.mkdirSync=$.mkdirSync||V.mkdirSync||vX,Q};var M0=($,Q,V)=>{const X=t7($),J={...s(Q),recursive:!1};if(X===$)try{return J.mkdirSync($,J)}catch(Z){const K=Z;if(K&&K.code!=="EISDIR")throw Z;return}try{return J.mkdirSync($,J),V||$}catch(Z){const K=Z;if(K&&K.code==="ENOENT")return M0($,J,M0(X,J,V));if(K&&K.code!=="EEXIST"&&K&&K.code!=="EROFS")throw Z;try{if(!J.statSync($).isDirectory())throw Z}catch(G){throw Z}}},U0=Object.assign(async($,Q,V)=>{const X=s(Q);X.recursive=!1;const J=t7($);if(J===$)return X.mkdirAsync($,X).catch((Z)=>{const K=Z;if(K&&K.code!=="EISDIR")throw Z});return X.mkdirAsync($,X).then(()=>V||$,async(Z)=>{const K=Z;if(K&&K.code==="ENOENT")return U0(J,X).then((G)=>U0($,X,G));if(K&&K.code!=="EEXIST"&&K.code!=="EROFS")throw Z;return X.statAsync($).then((G)=>{if(G.isDirectory())return V;else throw Z},()=>{throw Z})})},{sync:M0});import{dirname as $4} from"path";import{dirname as e7} from"path";var A8=async($,Q,V)=>{if(V===Q)return;return $.statAsync(Q).then((X)=>X.isDirectory()?V:void 0,(X)=>{const J=X;return J&&J.code==="ENOENT"?A8($,e7(Q),Q):void 0})},I8=($,Q,V)=>{if(V===Q)return;try{return $.statSync(Q).isDirectory()?V:void 0}catch(X){const J=X;return J&&J.code==="ENOENT"?I8($,e7(Q),Q):void 0}};var v$=($,Q)=>{const V=s(Q);if(V.recursive=!0,$4($)===$)return V.mkdirSync($,V);const J=I8(V,$);try{return V.mkdirSync($,V),J}catch(Z){const K=Z;if(K&&K.code==="ENOENT")return M0($,V);else throw Z}},c$=Object.assign(async($,Q)=>{const V={...s(Q),recursive:!0};if($4($)===$)return await V.mkdirAsync($,V);return A8(V,$).then((J)=>V.mkdirAsync($,V).then((Z)=>J||Z).catch((Z)=>{const K=Z;if(K&&K.code==="ENOENT")return U0($,V);else throw Z}))},{sync:v$});import{parse as UX,resolve as TX} from"path";var OX=process.env.__TESTING_MKDIRP_PLATFORM__||process.platform,P8=($)=>{if(/\0/.test($))throw Object.assign(new TypeError("path must be a string without null bytes"),{path:$,code:"ERR_INVALID_ARG_VALUE"});if($=TX($),OX==="win32"){const Q=/[*|"<>?:]/,{root:V}=UX($);if(Q.test($.substring(V.length)))throw Object.assign(new Error("Illegal characters in path."),{path:$,code:"EINVAL"})}return $};import{mkdir as CX,mkdirSync as jX} from"fs";var DX=process.env.__TESTING_MKDIRP_NODE_VERSION__||process.version,F8=DX.replace(/^v/,"").split("."),Q4=+F8[0]>10||+F8[0]===10&&+F8[1]>=12,l$=!Q4?()=>!1:($)=>s($).mkdirSync===jX,y5=Object.assign(!Q4?()=>!1:($)=>s($).mkdir===CX,{sync:l$});var m5=($,Q)=>{$=P8($);const V=s(Q);return l$(V)?v$($,V):M0($,V)};var V4=Object.assign(async($,Q)=>{$=P8($);const V=s(Q);return y5(V)?c$($,V):U0($,V)},{mkdirpSync:m5,mkdirpNative:c$,mkdirpNativeSync:v$,mkdirpManual:U0,mkdirpManualSync:M0,sync:m5,native:c$,nativeSync:v$,manual:U0,manualSync:M0,useNative:y5,useNativeSync:l$});import h5 from"node:path";class b5 extends Error{path;code;syscall="chdir";constructor($,Q){super(`${Q}: Cannot cd into '${$}'`);this.path=$,this.code=Q}get name(){return"CwdError"}}class E5 extends Error{path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor($,Q){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link");this.symlink=$,this.path=Q}get name(){return"SymlinkError"}}var u5=($,Q)=>$.get(M(Q)),d$=($,Q,V)=>$.set(M(Q),V),NX=($,Q)=>{r.stat($,(V,X)=>{if(V||!X.isDirectory())V=new b5($,V?.code||"ENOTDIR");Q(V)})},X4=($,Q,V)=>{$=M($);const X=Q.umask??18,J=Q.mode|448,Z=(J&X)!==0,K=Q.uid,G=Q.gid,Y=typeof K==="number"&&typeof G==="number"&&(K!==Q.processUid||G!==Q.processGid),W=Q.preserve,z=Q.unlink,q=Q.cache,L=M(Q.cwd),H=(b,D)=>{if(b)V(b);else if(d$(q,$,!0),D&&Y)M8(D,K,G,(S8)=>H(S8));else if(Z)r.chmod($,J,V);else V()};if(q&&u5(q,$)===!0)return H();if($===L)return NX($,H);if(W)return V4($,{mode:J}).then((b)=>H(null,b??void 0),H);const C=M(h5.relative(L,$)).split("/");f5(L,C,J,q,z,L,void 0,H)},f5=($,Q,V,X,J,Z,K,G)=>{if(!Q.length)return G(null,K);const Y=Q.shift(),W=M(h5.resolve($+"/"+Y));if(u5(X,W))return f5(W,Q,V,X,J,Z,K,G);r.mkdir(W,V,J4(W,Q,V,X,J,Z,K,G))},J4=($,Q,V,X,J,Z,K,G)=>(Y)=>{if(Y)r.lstat($,(W,z)=>{if(W)W.path=W.path&&M(W.path),G(W);else if(z.isDirectory())f5($,Q,V,X,J,Z,K,G);else if(J)r.unlink($,(q)=>{if(q)return G(q);r.mkdir($,V,J4($,Q,V,X,J,Z,K,G))});else if(z.isSymbolicLink())return G(new E5($,$+"/"+Q.join("/")));else G(Y)});else K=K||$,f5($,Q,V,X,J,Z,K,G)},SX=($)=>{let Q=!1,V=void 0;try{Q=r.statSync($).isDirectory()}catch(X){V=X?.code}finally{if(!Q)throw new b5($,V??"ENOTDIR")}},Z4=($,Q)=>{$=M($);const V=Q.umask??18,X=Q.mode|448,J=(X&V)!==0,Z=Q.uid,K=Q.gid,G=typeof Z==="number"&&typeof K==="number"&&(Z!==Q.processUid||K!==Q.processGid),Y=Q.preserve,W=Q.unlink,z=Q.cache,q=M(Q.cwd),L=(b)=>{if(d$(z,$,!0),b&&G)w8(b,Z,K);if(J)r.chmodSync($,X)};if(z&&u5(z,$)===!0)return L();if($===q)return SX(q),L();if(Y)return L(m5($,X)??void 0);const x=M(h5.relative(q,$)).split("/");let C=void 0;for(let b=x.shift(),D=q;b&&(D+="/"+b);b=x.shift()){if(D=M(h5.resolve(D)),u5(z,D))continue;try{r.mkdirSync(D,X),C=C||D,d$(z,D,!0)}catch(S8){const _8=r.lstatSync(D);if(_8.isDirectory()){d$(z,D,!0);continue}else if(W){r.unlinkSync(D),r.mkdirSync(D,X),C=C||D,d$(z,D,!0);continue}else if(_8.isSymbolicLink())return new E5(D,D+"/"+x.join("/"))}}return L(C)};var v8=Object.create(null),{hasOwnProperty:_X}=Object.prototype,c5=($)=>{if(!_X.call(v8,$))v8[$]=$.normalize("NFD");return v8[$]};import{join as K4} from"node:path";var RX=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,gX=RX==="win32",kX=($)=>{return $.split("/").slice(0,-1).reduce((V,X)=>{const J=V[V.length-1];if(J!==void 0)X=K4(J,X);return V.push(X||"/"),V},[])};class H8{#$=new Map;#V=new Map;#X=new Set;reserve($,Q){$=gX?["win32 parallelization disabled"]:$.map((X)=>{return q0(K4(c5(X))).toLowerCase()});const V=new Set($.map((X)=>kX(X)).reduce((X,J)=>X.concat(J)));this.#V.set(Q,{dirs:V,paths:$});for(let X of $){const J=this.#$.get(X);if(!J)this.#$.set(X,[Q]);else J.push(Q)}for(let X of V){const J=this.#$.get(X);if(!J)this.#$.set(X,[new Set([Q])]);else{const Z=J[J.length-1];if(Z instanceof Set)Z.add(Q);else J.push(new Set([Q]))}}return this.#J(Q)}#Z($){const Q=this.#V.get($);if(!Q)throw new Error("function does not have any path reservations");return{paths:Q.paths.map((V)=>this.#$.get(V)),dirs:[...Q.dirs].map((V)=>this.#$.get(V))}}check($){const{paths:Q,dirs:V}=this.#Z($);return Q.every((X)=>X&&X[0]===$)&&V.every((X)=>X&&X[0]instanceof Set&&X[0].has($))}#J($){if(this.#X.has($)||!this.check($))return!1;return this.#X.add($),$(()=>this.#Q($)),!0}#Q($){if(!this.#X.has($))return!1;const Q=this.#V.get($);if(!Q)throw new Error("invalid reservation");const{paths:V,dirs:X}=Q,J=new Set;for(let Z of V){const K=this.#$.get(Z);if(!K||K?.[0]!==$)continue;const G=K[1];if(!G){this.#$.delete(Z);continue}if(K.shift(),typeof G==="function")J.add(G);else for(let Y of G)J.add(Y)}for(let Z of X){const K=this.#$.get(Z),G=K?.[0];if(!K||!(G instanceof Set))continue;if(G.size===1&&K.length===1){this.#$.delete(Z);continue}else if(G.size===1){K.shift();const Y=K[0];if(typeof Y==="function")J.add(Y)}else G.delete($)}return this.#X.delete($),J.forEach((Z)=>this.#J(Z)),!0}}var G4=Symbol("onEntry"),U8=Symbol("checkFs"),Y4=Symbol("checkFs2"),i5=Symbol("pruneCache"),T8=Symbol("isReusable"),o=Symbol("makeFs"),C8=Symbol("file"),j8=Symbol("directory"),p5=Symbol("link"),z4=Symbol("symlink"),W4=Symbol("hardlink"),q4=Symbol("unsupported"),B4=Symbol("checkPath"),c0=Symbol("mkdir"),k=Symbol("onError"),l5=Symbol("pending"),L4=Symbol("pend"),H$=Symbol("unpend"),x8=Symbol("ended"),O8=Symbol("maybeClose"),D8=Symbol("skip"),i$=Symbol("doChown"),p$=Symbol("uid"),a$=Symbol("gid"),n$=Symbol("checkedCwd"),mX=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,s$=mX==="win32",bX=1024,EX=($,Q)=>{if(!s$)return A.unlink($,Q);const V=$+".DELETE."+A4(16).toString("hex");A.rename($,V,(X)=>{if(X)return Q(X);A.unlink(V,Q)})},hX=($)=>{if(!s$)return A.unlinkSync($);const Q=$+".DELETE."+A4(16).toString("hex");A.renameSync($,Q),A.unlinkSync(Q)},M4=($,Q,V)=>$!==void 0&&$===$>>>0?$:Q!==void 0&&Q===Q>>>0?Q:V,w4=($)=>q0(M(c5($))).toLowerCase(),uX=($,Q)=>{Q=w4(Q);for(let V of $.keys()){const X=w4(V);if(X===Q||X.indexOf(Q+"/")===0)$.delete(V)}},fX=($)=>{for(let Q of $.keys())$.delete(Q)};class r$ extends u0{[x8]=!1;[n$]=!1;[l5]=0;reservations=new H8;transform;writable=!0;readable=!1;dirCache;uid;gid;setOwner;preserveOwner;processGid;processUid;maxDepth;forceChown;win32;newer;keep;noMtime;preservePaths;unlink;cwd;strip;processUmask;umask;dmode;fmode;chmod;constructor($={}){$.ondone=()=>{this[x8]=!0,this[O8]()};super($);if(this.transform=$.transform,this.dirCache=$.dirCache||new Map,this.chmod=!!$.chmod,typeof $.uid==="number"||typeof $.gid==="number"){if(typeof $.uid!=="number"||typeof $.gid!=="number")throw new TypeError("cannot set owner without number uid and gid");if($.preserveOwner)throw new TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=$.uid,this.gid=$.gid,this.setOwner=!0}else this.uid=void 0,this.gid=void 0,this.setOwner=!1;if($.preserveOwner===void 0&&typeof $.uid!=="number")this.preserveOwner=!!(process.getuid&&process.getuid()===0);else this.preserveOwner=!!$.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 $.maxDepth==="number"?$.maxDepth:bX,this.forceChown=$.forceChown===!0,this.win32=!!$.win32||s$,this.newer=!!$.newer,this.keep=!!$.keep,this.noMtime=!!$.noMtime,this.preservePaths=!!$.preservePaths,this.unlink=!!$.unlink,this.cwd=M(T0.resolve($.cwd||process.cwd())),this.strip=Number($.strip)||0,this.processUmask=!this.chmod?0:typeof $.processUmask==="number"?$.processUmask:process.umask(),this.umask=typeof $.umask==="number"?$.umask:this.processUmask,this.dmode=$.dmode||511&~this.umask,this.fmode=$.fmode||438&~this.umask,this.on("entry",(Q)=>this[G4](Q))}warn($,Q,V={}){if($==="TAR_BAD_ARCHIVE"||$==="TAR_ABORT")V.recoverable=!1;return super.warn($,Q,V)}[O8](){if(this[x8]&&this[l5]===0)this.emit("prefinish"),this.emit("finish"),this.emit("end")}[B4]($){const Q=M($.path),V=Q.split("/");if(this.strip){if(V.length=this.strip)$.linkpath=X.slice(this.strip).join("/");else return!1}V.splice(0,this.strip),$.path=V.join("/")}if(isFinite(this.maxDepth)&&V.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:$,path:Q,depth:V.length,maxDepth:this.maxDepth}),!1;if(!this.preservePaths){if(V.includes("..")||s$&&/^[a-z]:\.\.$/i.test(V[0]??""))return this.warn("TAR_ENTRY_ERROR","path contains '..'",{entry:$,path:Q}),!1;const[X,J]=b$(Q);if(X)$.path=String(J),this.warn("TAR_ENTRY_INFO",`stripping ${X} from absolute path`,{entry:$,path:Q})}if(T0.isAbsolute($.path))$.absolute=M(T0.resolve($.path));else $.absolute=M(T0.resolve(this.cwd,$.path));if(!this.preservePaths&&typeof $.absolute==="string"&&$.absolute.indexOf(this.cwd+"/")!==0&&$.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:$,path:M($.path),resolvedPath:$.absolute,cwd:this.cwd}),!1;if($.absolute===this.cwd&&$.type!=="Directory"&&$.type!=="GNUDumpDir")return!1;if(this.win32){const{root:X}=T0.win32.parse(String($.absolute));$.absolute=X+s1(String($.absolute).slice(X.length));const{root:J}=T0.win32.parse($.path);$.path=J+s1($.path.slice(J.length))}return!0}[G4]($){if(!this[B4]($))return $.resume();switch(yX.equal(typeof $.absolute,"string"),$.type){case"Directory":case"GNUDumpDir":if($.mode)$.mode=$.mode|448;case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[U8]($);case"CharacterDevice":case"BlockDevice":case"FIFO":default:return this[q4]($)}}[k]($,Q){if($.name==="CwdError")this.emit("error",$);else this.warn("TAR_ENTRY_ERROR",$,{entry:Q}),this[H$](),Q.resume()}[c0]($,Q,V){X4(M($),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:Q},V)}[i$]($){return this.forceChown||this.preserveOwner&&(typeof $.uid==="number"&&$.uid!==this.processUid||typeof $.gid==="number"&&$.gid!==this.processGid)||typeof this.uid==="number"&&this.uid!==this.processUid||typeof this.gid==="number"&&this.gid!==this.processGid}[p$]($){return M4(this.uid,$.uid,this.processUid)}[a$]($){return M4(this.gid,$.gid,this.processGid)}[C8]($,Q){const V=typeof $.mode==="number"?$.mode&4095:this.fmode,X=new R0(String($.absolute),{flags:B8($.size),mode:V,autoClose:!1});X.on("error",(G)=>{if(X.fd)A.close(X.fd,()=>{});X.write=()=>!0,this[k](G,$),Q()});let J=1;const Z=(G)=>{if(G){if(X.fd)A.close(X.fd,()=>{});this[k](G,$),Q();return}if(--J===0){if(X.fd!==void 0)A.close(X.fd,(Y)=>{if(Y)this[k](Y,$);else this[H$]();Q()})}};X.on("finish",()=>{const G=String($.absolute),Y=X.fd;if(typeof Y==="number"&&$.mtime&&!this.noMtime){J++;const W=$.atime||new Date,z=$.mtime;A.futimes(Y,W,z,(q)=>q?A.utimes(G,W,z,(L)=>Z(L&&q)):Z())}if(typeof Y==="number"&&this[i$]($)){J++;const W=this[p$]($),z=this[a$]($);if(typeof W==="number"&&typeof z==="number")A.fchown(Y,W,z,(q)=>q?A.chown(G,W,z,(L)=>Z(L&&q)):Z())}Z()});const K=this.transform?this.transform($)||$:$;if(K!==$)K.on("error",(G)=>{this[k](G,$),Q()}),$.pipe(K);K.pipe(X)}[j8]($,Q){const V=typeof $.mode==="number"?$.mode&4095:this.dmode;this[c0](String($.absolute),V,(X)=>{if(X){this[k](X,$),Q();return}let J=1;const Z=()=>{if(--J===0)Q(),this[H$](),$.resume()};if($.mtime&&!this.noMtime)J++,A.utimes(String($.absolute),$.atime||new Date,$.mtime,Z);if(this[i$]($))J++,A.chown(String($.absolute),Number(this[p$]($)),Number(this[a$]($)),Z);Z()})}[q4]($){$.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${$.type}`,{entry:$}),$.resume()}[z4]($,Q){this[p5]($,String($.linkpath),"symlink",Q)}[W4]($,Q){const V=M(T0.resolve(this.cwd,String($.linkpath)));this[p5]($,V,"link",Q)}[L4](){this[l5]++}[H$](){this[l5]--,this[O8]()}[D8]($){this[H$](),$.resume()}[T8]($,Q){return $.type==="File"&&!this.unlink&&Q.isFile()&&Q.nlink<=1&&!s$}[U8]($){this[L4]();const Q=[$.path];if($.linkpath)Q.push($.linkpath);this.reservations.reserve(Q,(V)=>this[Y4]($,V))}[i5]($){if($.type==="SymbolicLink")fX(this.dirCache);else if($.type!=="Directory")uX(this.dirCache,String($.absolute))}[Y4]($,Q){this[i5]($);const V=(K)=>{this[i5]($),Q(K)},X=()=>{this[c0](this.cwd,this.dmode,(K)=>{if(K){this[k](K,$),V();return}this[n$]=!0,J()})},J=()=>{if($.absolute!==this.cwd){const K=M(T0.dirname(String($.absolute)));if(K!==this.cwd)return this[c0](K,this.dmode,(G)=>{if(G){this[k](G,$),V();return}Z()})}Z()},Z=()=>{A.lstat(String($.absolute),(K,G)=>{if(G&&(this.keep||this.newer&&G.mtime>($.mtime??G.mtime))){this[D8]($),V();return}if(K||this[T8]($,G))return this[o](null,$,V);if(G.isDirectory()){if($.type==="Directory"){const Y=this.chmod&&$.mode&&(G.mode&4095)!==$.mode,W=(z)=>this[o](z??null,$,V);if(!Y)return W();return A.chmod(String($.absolute),Number($.mode),W)}if($.absolute!==this.cwd)return A.rmdir(String($.absolute),(Y)=>this[o](Y??null,$,V))}if($.absolute===this.cwd)return this[o](null,$,V);EX(String($.absolute),(Y)=>this[o](Y??null,$,V))})};if(this[n$])J();else X()}[o]($,Q,V){if($){this[k]($,Q),V();return}switch(Q.type){case"File":case"OldFile":case"ContiguousFile":return this[C8](Q,V);case"Link":return this[W4](Q,V);case"SymbolicLink":return this[z4](Q,V);case"Directory":case"GNUDumpDir":return this[j8](Q,V)}}[p5]($,Q,V,X){A[V](Q,String($.absolute),(J)=>{if(J)this[k](J,$);else this[H$](),$.resume();X()})}}var d5=($)=>{try{return[null,$()]}catch(Q){return[Q,null]}};class a5 extends r${sync=!0;[o]($,Q){return super[o]($,Q,()=>{})}[U8]($){if(this[i5]($),!this[n$]){const J=this[c0](this.cwd,this.dmode);if(J)return this[k](J,$);this[n$]=!0}if($.absolute!==this.cwd){const J=M(T0.dirname(String($.absolute)));if(J!==this.cwd){const Z=this[c0](J,this.dmode);if(Z)return this[k](Z,$)}}const[Q,V]=d5(()=>A.lstatSync(String($.absolute)));if(V&&(this.keep||this.newer&&V.mtime>($.mtime??V.mtime)))return this[D8]($);if(Q||this[T8]($,V))return this[o](null,$);if(V.isDirectory()){if($.type==="Directory"){const Z=this.chmod&&$.mode&&(V.mode&4095)!==$.mode,[K]=Z?d5(()=>{A.chmodSync(String($.absolute),Number($.mode))}):[];return this[o](K,$)}const[J]=d5(()=>A.rmdirSync(String($.absolute)));this[o](J,$)}const[X]=$.absolute===this.cwd?[]:d5(()=>hX(String($.absolute)));this[o](X,$)}[C8]($,Q){const V=typeof $.mode==="number"?$.mode&4095:this.fmode,X=(K)=>{let G;try{A.closeSync(J)}catch(Y){G=Y}if(K||G)this[k](K||G,$);Q()};let J;try{J=A.openSync(String($.absolute),B8($.size),V)}catch(K){return X(K)}const Z=this.transform?this.transform($)||$:$;if(Z!==$)Z.on("error",(K)=>this[k](K,$)),$.pipe(Z);Z.on("data",(K)=>{try{A.writeSync(J,K,0,K.length)}catch(G){X(G)}}),Z.on("end",()=>{let K=null;if($.mtime&&!this.noMtime){const G=$.atime||new Date,Y=$.mtime;try{A.futimesSync(J,G,Y)}catch(W){try{A.utimesSync(String($.absolute),G,Y)}catch(z){K=W}}}if(this[i$]($)){const G=this[p$]($),Y=this[a$]($);try{A.fchownSync(J,Number(G),Number(Y))}catch(W){try{A.chownSync(String($.absolute),Number(G),Number(Y))}catch(z){K=K||W}}}X(K)})}[j8]($,Q){const V=typeof $.mode==="number"?$.mode&4095:this.dmode,X=this[c0](String($.absolute),V);if(X){this[k](X,$),Q();return}if($.mtime&&!this.noMtime)try{A.utimesSync(String($.absolute),$.atime||new Date,$.mtime)}catch(J){}if(this[i$]($))try{A.chownSync(String($.absolute),Number(this[p$]($)),Number(this[a$]($)))}catch(J){}Q(),$.resume()}[c0]($,Q){try{return Z4(M($),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:Q})}catch(V){return V}}[p5]($,Q,V,X){const J=`${V}Sync`;try{A[J](Q,String($.absolute)),X(),$.resume()}catch(Z){return this[k](Z,$)}}}var cX=($)=>{const Q=new a5($),V=$.file,X=I4.statSync(V),J=$.maxReadSize||16777216;new D1(V,{readSize:J,size:X.size}).pipe(Q)},lX=($,Q)=>{const V=new r$($),X=$.maxReadSize||16777216,J=$.file;return new Promise((K,G)=>{V.on("error",G),V.on("close",K),I4.stat(J,(Y,W)=>{if(Y)G(Y);else{const z=new M$(J,{readSize:X,size:W.size});z.on("error",G),z.pipe(V)}})})},N8=Y0(cX,lX,($)=>new a5($),($)=>new r$($),($,Q)=>{if(Q?.length)p1($,Q)});import l from"node:fs";import P4 from"node:path";var dX=($,Q)=>{const V=new F$($);let X=!0,J,Z;try{try{J=l.openSync($.file,"r+")}catch(Y){if(Y?.code==="ENOENT")J=l.openSync($.file,"w+");else throw Y}const K=l.fstatSync(J),G=Buffer.alloc(512);$:for(Z=0;ZK.size)break;if(Z+=W,$.mtimeCache&&Y.mtime)$.mtimeCache.set(String(Y.path),Y.mtime)}X=!1,iX($,V,Z,J,Q)}finally{if(X)try{l.closeSync(J)}catch(K){}}},iX=($,Q,V,X,J)=>{const Z=new _$($.file,{fd:X,start:V});Q.pipe(Z),aX(Q,J)},pX=($,Q)=>{Q=Array.from(Q);const V=new V$($),X=(Z,K,G)=>{const Y=(H,x)=>{if(H)l.close(Z,(C)=>G(H));else G(null,x)};let W=0;if(K===0)return Y(null,0);let z=0;const q=Buffer.alloc(512),L=(H,x)=>{if(H||typeof x==="undefined")return Y(H);if(z+=x,z<512&&x)return l.read(Z,q,z,q.length-z,W+z,L);if(W===0&&q[0]===31&&q[1]===139)return Y(new Error("cannot append to compressed archives"));if(z<512)return Y(null,W);const C=new a(q);if(!C.cksumValid)return Y(null,W);const b=512*Math.ceil((C.size??0)/512);if(W+b+512>K)return Y(null,W);if(W+=b+512,W>=K)return Y(null,W);if($.mtimeCache&&C.mtime)$.mtimeCache.set(String(C.path),C.mtime);z=0,l.read(Z,q,0,512,W,L)};l.read(Z,q,0,512,W,L)};return new Promise((Z,K)=>{V.on("error",K);let G="r+";const Y=(W,z)=>{if(W&&W.code==="ENOENT"&&G==="r+")return G="w+",l.open($.file,G,Y);if(W||!z)return K(W);l.fstat(z,(q,L)=>{if(q)return l.close(z,()=>K(q));X(z,L.size,(H,x)=>{if(H)return K(H);const C=new R0($.file,{fd:z,start:x});V.pipe(C),C.on("error",K),C.on("close",Z),nX(V,Q)})})};l.open($.file,G,Y)})},aX=($,Q)=>{Q.forEach((V)=>{if(V.charAt(0)==="@")$$({file:P4.resolve($.cwd,V.slice(1)),sync:!0,noResume:!0,onReadEntry:(X)=>$.add(X)});else $.add(V)}),$.end()},nX=async($,Q)=>{for(let V=0;V$.add(J)});else $.add(X)}$.end()},X$=Y0(dX,pX,()=>{throw new TypeError("file is required")},()=>{throw new TypeError("file is required")},($,Q)=>{if(!F7($))throw new TypeError("file is required");if($.gzip||$.brotli||$.file.endsWith(".br")||$.file.endsWith(".tbr"))throw new TypeError("cannot append to compressed archives");if(!Q?.length)throw new TypeError("no paths specified to add/replace")});var sX=Y0(X$.syncFile,X$.asyncFile,X$.syncNoFile,X$.asyncNoFile,($,Q=[])=>{X$.validate?.($,Q),rX($)}),rX=($)=>{const Q=$.filter;if(!$.mtimeCache)$.mtimeCache=new Map;$.filter=Q?(V,X)=>Q(V,X)&&!(($.mtimeCache?.get(V)??X.mtime??0)>(X.mtime??0)):(V,X)=>!(($.mtimeCache?.get(V)??X.mtime??0)>(X.mtime??0))};async function $J($,Q,V){w.info(`Starting download from URL: ${$}`);const J=`beat-forge/init-beatsaber@${F4().version}`;w.info(`User-Agent: ${J}`);const Z=await fetch($,{headers:{"User-Agent":J,Authorization:`token ${V}`}});if(w.info(`Response status: ${Z.status}`),w.info(`Response headers: ${JSON.stringify([...Z.headers])}`),!Z.ok)throw w.error(`Failed to download file: ${Z.statusText}`),new Error(`Failed to download file: ${Z.statusText}`);await J$.mkdir(v4(Q),{recursive:!0}),w.info(`Directory created for output path: ${v4(Q)}`);const K=eX(Q),G=Z.body?.getReader();if(!G)throw w.error("Failed to get reader from response body"),new Error("Failed to get reader from response body");w.info("Starting to read and write file stream"),await(async()=>{while(!0){const{done:W,value:z}=await G.read();if(W)break;if(z)K.write(z)}K.close()})(),w.info("File downloaded and written successfully")}async function QJ($,Q){w.info(`Extracting tarball from ${$} to ${Q}`);try{await J$.mkdir(Q,{recursive:!0}),await N8({file:$,cwd:Q})}catch(V){throw w.error(`Failed to extract tarball from ${$} to ${Q}`),w.error(`Error details: ${V}`),V}w.info("Tarball extraction completed successfully")}async function H4($,Q){w.info(`Moving contents from ${$} to ${Q}`);try{await J$.mkdir(Q,{recursive:!0});const V=await J$.readdir($,{withFileTypes:!0});w.info(`Files to move: ${V.map((X)=>X.name).join(", ")}`);for(let X of V){const J=s5($,X.name),Z=s5(Q,X.name);if(X.isDirectory())await H4(J,Z);else await J$.rename(J,Z);w.info(`Moved ${J} to ${Z}`)}}catch(V){throw w.error(`Failed to move contents from ${$} to ${Q}`),w.error(`Error details: ${V}`),V}w.info("Content move completed successfully")}async function x4($){const Q=await J$.readdir($,{withFileTypes:!0});for(let V of Q){const X=s5($,V.name);if(V.isDirectory()){const J=await x4(X);if(J)return J}else if(V.name==="manifest.json")return X}return null}async function VJ(){try{w.info("Initializing Beat Saber references...");const $=w.getInput("token",{required:!0}),Q=w.getInput("manifest");let V=w.getInput("version");const X=w.getInput("path")||"./Refs",J=w.getInput("repo")||"beat-forge/beatsaber-stripped",Z=w.getInput("host")||"github.com";if(w.info(`Inputs: version=${V}, path=${X}, repo=${J}, host=${Z}, manifest=${Q}`),!V){w.info("No version specified. Attempting to infer version from manifest.json...");const H=Q?n5(Q):await x4(process.cwd());if(H){w.info(`Found manifest.json at ${H}`);let x=await J$.readFile(H,"utf-8");if(x.startsWith("\uFEFF"))w.info("Removing BOM from manifest.json"),x=x.substring(1);V=JSON.parse(x).gameVersion,w.info(`Inferred version: ${V}`)}else throw w.error("No manifest.json found and no version specified."),new Error("No manifest.json found and no version specified.")}const[K,G]=J.split("/");if(!K||!G)throw w.error("Repository input is invalid. Expected format {owner}/{repo}."),new Error("Repository input is invalid. Expected format {owner}/{repo}.");const Y=`version/${V}`,W=`https://${Z}/${K}/${G}/archive/refs/heads/${Y}.tar.gz`,z=n5("archive.tar.gz"),q=n5("extract"),L=n5(X);w.info(`Archive URL: ${W}`),w.info(`Tarball path: ${z}`),w.info(`Extract path: ${q}`),w.info(`References path: ${L}`),await $J(W,z,$),await QJ(z,q),await H4(s5(q,`beatsaber-stripped-version-${V}`,"data"),L),w.info("Beat Saber references initialized successfully")}catch($){w.setFailed(`Action failed with error: ${$}`)}}VJ(); diff --git a/package.json b/package.json index 43bca1a..987d447 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "init-beatsaber", "description": "A GitHub Action to initialize a Beat Saber modding environment", - "version": "1.6.0", + "version": "1.6.1", "author": "BeatForge", "private": true, "type": "module",