functiongetProxyUrl(e){lett,r,i="https:"===e.protocol;returncheckBypass(e)||(r=i?process.env.https_proxy||process.env.HTTPS_PROXY:process.env.http_proxy||process.env.HTTP_PROXY,r&&(t=newURL(r))),t}functioncheckBypass(e){if(!e.hostname)return!1;lett,r=process.env.no_proxy||process.env.NO_PROXY||"";if(!r)return!1;e.port?t=+e.port:"http:"===e.protocol?t=80:"https:"===e.protocol&&(t=443);leti=[e.hostname.toUpperCase()];"number"==typeoft&&i.push(`${i[0]}:${t}`);for(letsofr.split(",").map((e=>e.trim().toUpperCase())).filter((e=>e)))if(i.some((e=>e===s)))return!0;return!1}functiondownloadTool(e,t,r,i){return__awaiter(this,void0,void0,(function*(){t=t||path.join(_getTempDirectory(),v4_1.default()),yieldio.mkdirP(path.dirname(t)),core.debug("Downloading "+e),core.debug("Destination "+t);consts=_getGlobal("TEST_DOWNLOAD_TOOL_RETRY_MIN_SECONDS",10),n=_getGlobal("TEST_DOWNLOAD_TOOL_RETRY_MAX_SECONDS",20),o=newretry_helper_1.RetryHelper(3,s,n);returnyieldo.execute((()=>__awaiter(this,void0,void0,(function*(){returnyielddownloadToolAttempt(e,t||"",r,i)}))),(e=>!(einstanceofHTTPError&&e.httpStatusCode&&500>e.httpStatusCode&&408!==e.httpStatusCode&&429!==e.httpStatusCode)))}))}functiondownloadToolAttempt(e,t,r,i){return__awaiter(this,void0,void0,(function*(){if(fs.existsSync(t))throwError(`Destination file path ${t} already exists`);consts=newhttpm.HttpClient(userAgent,[],{allowRetries:!1});r&&(core.debug("set auth"),void0===i&&(i={}),i.authorization=r);constn=yields.get(e,i);if(200!==n.message.statusCode){constt=newHTTPError(n.message.statusCode);throwcore.debug(`Failed to download from "${e}". Code(${n.message.statusCode}) Message(${n.message.statusMessage})`),t}consto=util.promisify(stream$1.pipeline),a=_getGlobal("TEST_DOWNLOAD_TOOL_RESPONSE_MESSAGE_FACTORY",(()=>n.message))();leth=!1;try{returnyieldo(a,fs.createWriteStream(t)),core.debug("download complete"),h=!0,t}finally{if(!h){core.debug("download failed");try{yieldio.rmRF(t)}catch(c){core.debug(`Failed to delete '${t}'. ${c.message}`)}}}}))}functionextract7z(e,t,r){return__awaiter(this,void0,void0,(function*(){assert_1.ok(IS_WINDOWS$1,"extract7z() not supported on current OS"),assert_1.ok(e,'parameter "file" is required'),t=yield_createExtractFolder(t);consti=process.cwd();if(process.chdir(t),r)try{constt=["x",core.isDebug()?"-bb1":"-bb0","-bd","-sccUTF-8",e],i={silent:!0};yieldexec_1.exec(`"${r}"`,t,i)}finally{process.chdir(i)}else{constr=["-NoLogo","-Sta","-NoProfile","-NonInteractive","-ExecutionPolicy","Unrestricted","-Command",`& '${path.join(__dirname,"..","scripts","Invoke-7zdec.ps1").replace(/'/g,"''").replace(/"|\n|\r/g,"")}' -Source '${e.replace(/'/g,"''").replace(/"|\n|\r/g,"")}' -Target '${t.replace(/'/g,"''").replace(/"|\n|\r/g,"")}'`],s={silent:!0};try{conste=yieldio.which("powershell",!0);yieldexec_1.exec(`"${e}"`,r,s)}finally{process.chdir(i)}}returnt}))}functionextractTar(e,t,r="xz"){return__awaiter(this,void0,void0,(function*(){if(!e)throwError("parameter 'file' is required");t=yield_createExtractFolder(t),core.debug("Checking tar --version");leti="";yieldexec_1.exec("tar --version",[],{ignoreReturnCode:!0,silent:!0,listeners:{stdout:e=>i+=""+e,stderr:e=>i+=""+e}}),core.debug(i.trim());consts=i.toUpperCase().includes("GNU TAR");letn;n=rinstanceofArray?r:[r],core.isDebug()&&!r.includes("v")&&n.push("-v");leto=t,a=e;returnIS_WINDOWS$1&&s&&(n.push("--force-local"),o=t.replace(/\\/g,"/"),a=e.replace(/\\/g,"/")),s&&(n.push("--warning=no-unknown-keyword"),n.push("--overwrite")),n.push("-C",o,"-f",a),yieldexec_1.exec("tar",n),t}))}functionextractXar(e,t,r=[]){return__awaiter(this,void0,void0,(function*(){leti;assert_1.ok(IS_MAC$1,"extractXar() not supported on current OS"),assert_1.ok(e,'parameter "file" is required'),t=yield_createExtractFolder(t),i=rinstanceofArray?r:[r],i.push("-x","-C",t,"-f",e),core.isDebug()&&i.push("-v");consts=yieldio.which("xar",!0);returnyieldexec_1.exec(`"${s}"`,_unique(i)),t}))}functionextractZip(e,t){return__awaiter(this,void0,void0,(function*(){if(!