setup-cpp/dist/legacy/setup-cpp.js

82 lines
322 KiB
JavaScript
Raw Normal View History

#!/usr/bin/env node
2025-07-10 22:11:16 +08:00
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const at=require("process"),le=require("os"),T=require("path"),ae=require("fs"),Rn=require("https"),Om=require("perf_hooks"),ba=require("http");require("net");const $m=require("tls"),On=require("events"),pr=require("util"),Im=require("string_decoder"),Nt=require("child_process"),kr=require("assert"),Pm=require("timers"),ap=require("buffer"),lt=require("url"),qr=require("stream"),Tm=require("constants"),pn=require("console");var ge=typeof document<"u"?document.currentScript:null;function Ra(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const Ar=Ra(ae),sc=Ra(Rn),Mn=Ra(ba),cp=Object.freeze(Object.defineProperty({__proto__:null,get default(){return cp},get randomUUID(){return oy}},Symbol.toStringTag,{value:"Module"}));function Gn(e){return e==null?[]:Array.isArray(e)?e:[e]}function xm(e,t,r,n){var o,s=e[t],i=~n.string.indexOf(t)?r==null||r===!0?"":String(r):typeof r=="boolean"?r:~n.boolean.indexOf(t)?r==="false"?!1:r==="true"||(e._.push((o=+r,o*0===0?o:r)),!!r):(o=+r,o*0===0?o:r);e[t]=s==null?i:Array.isArray(s)?s.concat(i):[s,i]}function Cm(e,t){e=e||[],t=t||{};var r,n,o,s,i,l={_:[]},u=0,a=0,c=0,m=e.length;const p=t.alias!==void 0,v=t.unknown!==void 0,E=t.default!==void 0;if(t.alias=t.alias||{},t.string=Gn(t.string),t.boolean=Gn(t.boolean),p)for(r in t.alias)for(n=t.alias[r]=Gn(t.alias[r]),u=0;u<n.length;u++)(t.alias[n[u]]=n.concat(r)).splice(u,1);for(u=t.boolean.length;u-- >0;)for(n=t.alias[t.boolean[u]]||[],a=n.length;a-- >0;)t.boolean.push(n[a]);for(u=t.string.length;u-- >0;)for(n=t.alias[t.string[u]]||[],a=n.length;a-- >0;)t.string.push(n[a]);if(E){for(r in t.default)if(s=typeof t.default[r],n=t.alias[r]=t.alias[r]||[],t[s]!==void 0)for(t[s].push(r),u=0;u<n.length;u++)t[s].push(n[u])}const d=v?Object.keys(t.alias):[];for(u=0;u<m;u++){if(o=e[u],o==="--"){l._=l._.concat(e.slice(++u));break}for(a=0;a<o.length&&o.charCodeAt(a)===45;a++);if(a===0)l._.push(o);else if(o.substring(a,a+3)==="no-"){if(s=o.substring(a+3),v&&!~d.indexOf(s))return t.unknown(o);l[s]=!1}else{for(c=a+1;c<o.length&&o.charCodeAt(c)!==61;c++);for(s=o.substring(a,c),i=o.substring(++c)||u+1===m||(""+e[u+1]).charCodeAt(0)===45||e[++u],n=a===2?[s]:s,c=0;c<n.length;c++){if(s=n[c],v&&!~d.indexOf(s))return t.unknown("-".repeat(a)+s);xm(l,s,c+1<n.length||i,t)}}}if(E)for(r in t.default)l[r]===void 0&&(l[r]=t.default[r]);if(p)for(r in l)for(n=t.alias[r]||[];n.length>0;)l[n.shift()]=l[r];return l}var et=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Oe(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function $n(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var r=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}),r}var Vr={exports:{}},Vn,ac;function In(){if(ac)return Vn;ac=1;const e="2.0.0",t=256,r=Number.MAX_SAFE_INTEGER||9007199254740991,n=16,o=t-6;return Vn={MAX_LENGTH:t,MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:o,MAX_SAFE_INTEGER:r,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:e,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},Vn}var Bn,cc;function Pn(){return cc||(cc=1,Bn=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{}),Bn}var uc;function Fr(){return uc||(uc=1,function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:o}=
`),G=Math.max.apply(Math,C.map(function(F){return F.length})),Y=["┌".concat("─".repeat(G+2),"┐")],Q=0,A=C;Q<A.length;Q++){var x=A[Q];Y.push("│ ".concat(x.padEnd(G)," │"))}return Y.push("└".concat("─".repeat(G+2),"┘")),Y.join(`
`)},O=function($){return i(void 0,void 0,void 0,function(){var C,G;return l(this,function(Y){switch(Y.label){case 0:if(!$.alwaysRun&&(!process.stdout.isTTY||E&&!$.shouldNotifyInNpmScript))return $.debug&&console.error("Opting out of running simpleUpdateNotifier()"),[2];Y.label=1;case 1:return Y.trys.push([1,3,,4]),[4,b($)];case 2:return C=Y.sent(),C&&console.error(g("New version of ".concat($.pkg.name,` available!
Current Version: `).concat($.pkg.version,`
2025-11-10 16:13:02 +08:00
Latest Version: `).concat(C))),[3,4];case 3:return G=Y.sent(),$.debug&&G instanceof Error&&console.error("Unexpected error in simpleUpdateNotifier():",G),[3,4];case 4:return[2]}})})};return Ni=O,Ni}var ey=Zm();const ty=Oe(ey),ry="setup-cpp",ny="1.7.2",xa={name:ry,version:ny};var dt={},Ye={},Mt={},Zc;function Ca(){if(Zc)return Mt;Zc=1,Object.defineProperty(Mt,"__esModule",{value:!0}),Mt.toCommandProperties=Mt.toCommandValue=void 0;function e(r){return r==null?"":typeof r=="string"||r instanceof String?r:JSON.stringify(r)}Mt.toCommandValue=e;function t(r){return Object.keys(r).length?{title:r.title,file:r.file,line:r.startLine,endLine:r.endLine,col:r.startColumn,endColumn:r.endColumn}:{}}return Mt.toCommandProperties=t,Mt}var eu;function iy(){if(eu)return Ye;eu=1;var e=Ye&&Ye.__createBinding||(Object.create?function(m,p,v,E){E===void 0&&(E=v);var d=Object.getOwnPropertyDescriptor(p,v);(!d||("get"in d?!p.__esModule:d.writable||d.configurable))&&(d={enumerable:!0,get:function(){return p[v]}}),Object.defineProperty(m,E,d)}:function(m,p,v,E){E===void 0&&(E=v),m[E]=p[v]}),t=Ye&&Ye.__setModuleDefault||(Object.create?function(m,p){Object.defineProperty(m,"default",{enumerable:!0,value:p})}:function(m,p){m.default=p}),r=Ye&&Ye.__importStar||function(m){if(m&&m.__esModule)return m;var p={};if(m!=null)for(var v in m)v!=="default"&&Object.prototype.hasOwnProperty.call(m,v)&&e(p,m,v);return t(p,m),p};Object.defineProperty(Ye,"__esModule",{value:!0}),Ye.issue=Ye.issueCommand=void 0;const n=r(le),o=Ca();function s(m,p,v){const E=new u(m,p,v);process.stdout.write(E.toString()+n.EOL)}Ye.issueCommand=s;function i(m,p=""){s(m,{},p)}Ye.issue=i;const l="::";class u{constructor(p,v,E){p||(p="missing.command"),this.command=p,this.properties=v,this.message=E}toString(){let p=l+this.command;if(this.properties&&Object.keys(this.properties).length>0){p+=" ";let v=!0;for(const E in this.properties)if(this.properties.hasOwnProperty(E)){const d=this.properties[E];d&&(v?v=!1:p+=",",p+=`${E}=${c(d)}`)}}return p+=`${l}${a(this.message)}`,p}}function a(m){return(0,o.toCommandValue)(m).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A")}function c(m){return(0,o.toCommandValue)(m).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/:/g,"%3A").replace(/,/g,"%2C")}return Ye}var Je={},sp;(sp=global.crypto)!=null&&sp.randomUUID||(global.crypto||(global.crypto={}),global.crypto.randomUUID=()=>{let e=new Date().getTime(),t=Om.performance.now()*1e3;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{let n=Math.random()*16;return e>0?(n=(e+n)%16|0,e=Math.floor(e/16)):(n=(t+n)%16|0,t=Math.floor(t/16)),(r==="x"?n:n&3|8).toString(16)})});const oy=global.crypto.randomUUID.bind(global.crypto),Aa=$n(cp);var tu;function sy(){if(tu)return Je;tu=1;var e=Je&&Je.__createBinding||(Object.create?function(a,c,m,p){p===void 0&&(p=m);var v=Object.getOwnPropertyDescriptor(c,m);(!v||("get"in v?!c.__esModule:v.writable||v.configurable))&&(v={enumerable:!0,get:function(){return c[m]}}),Object.defineProperty(a,p,v)}:function(a,c,m,p){p===void 0&&(p=m),a[p]=c[m]}),t=Je&&Je.__setModuleDefault||(Object.create?function(a,c){Object.defineProperty(a,"default",{enumerable:!0,value:c})}:function(a,c){a.default=c}),r=Je&&Je.__importStar||function(a){if(a&&a.__esModule)return a;var c={};if(a!=null)for(var m in a)m!=="default"&&Object.prototype.hasOwnProperty.call(a,m)&&e(c,a,m);return t(c,a),c};Object.defineProperty(Je,"__esModule",{value:!0}),Je.prepareKeyValueMessage=Je.issueFileCommand=void 0;const n=r(Aa),o=r(ae),s=r(le),i=Ca();function l(a,c){const m=process.env[`GITHUB_${a}`];if(!m)throw new Error(`Unable to find environment variable for file command ${a}`);if(!o.existsSync(m))throw new Error(`Missing file at path: ${m}`);o.appendFileSync(m,`${(0,i.toCommandValue)(c)}${s.EOL}`,{encoding:"utf8"})}Je.issueFileCommand=l;function u(a,c){const m=`ghadelimiter_${n.randomUUID()}`,p=(0,i.toCommandValue)(c);if(a.includes(m))throw new Error(`Unexpected input: name should not contain the delimiter "${m}"`);if(p.includes(m))throw new Error(`Unexpected input:
2025-07-10 22:11:16 +08:00
`,$.message,$.stack);var C=new Error("tunneling socket could not be established, cause="+$.message);C.code="ECONNRESET",d.request.emit("error",C),h.removeSocket(y)}},a.prototype.removeSocket=function(d){var f=this.sockets.indexOf(d);if(f!==-1){this.sockets.splice(f,1);var h=this.requests.shift();h&&this.createSocket(h,function(y){h.request.onSocket(y)})}};function c(E,d){var f=this;a.prototype.createSocket.call(f,E,function(h){var y=E.request.getHeader("host"),w=p({},f.options,{socket:h,servername:y?y.replace(/:.*$/,""):E.host}),S=e.connect(0,w);f.sockets[f.sockets.indexOf(h)]=S,d(S)})}function m(E,d,f){return typeof E=="string"?{host:E,port:d,localAddress:f}:E}function p(E){for(var d=1,f=arguments.length;d<f;++d){var h=arguments[d];if(typeof h=="object")for(var y=Object.keys(h),w=0,S=y.length;w<S;++w){var _=y[w];h[_]!==void 0&&(E[_]=h[_])}}return E}var v;return process.env.NODE_DEBUG&&/\btunnel\b/.test(process.env.NODE_DEBUG)?v=function(){var E=Array.prototype.slice.call(arguments);typeof E[0]=="string"?E[0]="TUNNEL: "+E[0]:E.unshift("TUNNEL:"),console.error.apply(console,E)}:v=function(){},Vt.debug=v,Vt}var Li,iu;function ly(){return iu||(iu=1,Li=uy()),Li}var Br=ly(),tt;(function(e){e[e.OK=200]="OK",e[e.MultipleChoices=300]="MultipleChoices",e[e.MovedPermanently=301]="MovedPermanently",e[e.ResourceMoved=302]="ResourceMoved",e[e.SeeOther=303]="SeeOther",e[e.NotModified=304]="NotModified",e[e.UseProxy=305]="UseProxy",e[e.SwitchProxy=306]="SwitchProxy",e[e.TemporaryRedirect=307]="TemporaryRedirect",e[e.PermanentRedirect=308]="PermanentRedirect",e[e.BadRequest=400]="BadRequest",e[e.Unauthorized=401]="Unauthorized",e[e.PaymentRequired=402]="PaymentRequired",e[e.Forbidden=403]="Forbidden",e[e.NotFound=404]="NotFound",e[e.MethodNotAllowed=405]="MethodNotAllowed",e[e.NotAcceptable=406]="NotAcceptable",e[e.ProxyAuthenticationRequired=407]="ProxyAuthenticationRequired",e[e.RequestTimeout=408]="RequestTimeout",e[e.Conflict=409]="Conflict",e[e.Gone=410]="Gone",e[e.TooManyRequests=429]="TooManyRequests",e[e.InternalServerError=500]="InternalServerError",e[e.NotImplemented=501]="NotImplemented",e[e.BadGateway=502]="BadGateway",e[e.ServiceUnavailable=503]="ServiceUnavailable",e[e.GatewayTimeout=504]="GatewayTimeout"})(tt||(tt={}));var je;(function(e){e.Accept="accept",e.ContentType="content-type"})(je||(je={}));var It;(function(e){e.ApplicationJson="application/json"})(It||(It={}));function fy(e){const t=wa(new URL(e));return t?t.href:""}const dy=[tt.MovedPermanently,tt.ResourceMoved,tt.SeeOther,tt.TemporaryRedirect,tt.PermanentRedirect],py=[tt.BadGateway,tt.ServiceUnavailable,tt.GatewayTimeout],hy=["OPTIONS","GET","DELETE","HEAD"],my=10,yy=5;class An extends Error{constructor(t,r){super(t),this.name="HttpClientError",this.statusCode=r,Object.setPrototypeOf(this,An.prototype)}statusCode;result}class wp{constructor(t){this.message=t}message;async readBody(){return new Promise(async t=>{let r=Buffer.alloc(0);this.message.on("data",n=>{r=Buffer.concat([r,n])}),this.message.on("end",()=>{t(r.toString())})})}async readBodyBuffer(){return new Promise(async t=>{const r=[];this.message.on("data",n=>{r.push(n)}),this.message.on("end",()=>{t(Buffer.concat(r))})})}}function wy(e){return new URL(e).protocol==="https:"}class vp{userAgent;handlers;requestOptions;_ignoreSslError=!1;_socketTimeout;_allowRedirects=!0;_allowRedirectDowngrade=!1;_maxRedirects=50;_allowRetries=!1;_maxRetries=1;_agent;_proxyAgent;_proxyAgentDispatcher;_keepAlive=!1;_disposed=!1;constructor(t,r,n){this.userAgent=t,this.handlers=r||[],this.requestOptions=n,n&&(n.ignoreSslError!=null&&(this._ignoreSslError=n.ignoreSslError),this._socketTimeout=n.socketTimeout,n.allowRedirects!=null&&(this._allowRedirects=n.allowRedirects),n.allowRedirectDowngrade!=null&&(this._allowRedirectDowngrade=n.allowRedirectDowngrade),n.maxRedirects!=null&&(this._maxRedirects=Math.max(n.maxRedirects,0)),n.keepAlive!=null&&(this._keepAlive=n.keepAlive),n.allowRetries!=null&&(this._allowRetries=n.allowRetries),n.maxRetries!=null&&(this._maxRetries=n.maxRetries))}async options(t,r){return this.request(
Error Code : ${m.statusCode}
2025-07-10 22:11:16 +08:00
Error Message: ${m.message}`)})).result)===null||l===void 0?void 0:l.value;if(!c)throw new Error("Response json body do not have ID Token field");return c})}static getIDToken(i){return e(this,void 0,void 0,function*(){try{let l=o.getIDTokenUrl();if(i){const a=encodeURIComponent(i);l=`${l}&audience=${a}`}(0,n.debug)(`ID token url is ${l}`);const u=yield o.getCall(l);return(0,n.setSecret)(u),u}catch(l){throw new Error(`Error message: ${l.message}`)}})}}return Gt.OidcClient=o,Gt}var Rr={},au;function cu(){return au||(au=1,function(e){var t=Rr&&Rr.__awaiter||function(a,c,m,p){function v(E){return E instanceof m?E:new m(function(d){d(E)})}return new(m||(m=Promise))(function(E,d){function f(w){try{y(p.next(w))}catch(S){d(S)}}function h(w){try{y(p.throw(w))}catch(S){d(S)}}function y(w){w.done?E(w.value):v(w.value).then(f,h)}y((p=p.apply(a,c||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.summary=e.markdownSummary=e.SUMMARY_DOCS_URL=e.SUMMARY_ENV_VAR=void 0;const r=le,n=ae,{access:o,appendFile:s,writeFile:i}=n.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 l{constructor(){this._buffer=""}filePath(){return t(this,void 0,void 0,function*(){if(this._filePath)return this._filePath;const c=process.env[e.SUMMARY_ENV_VAR];if(!c)throw new Error(`Unable to find environment variable for $${e.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`);try{yield o(c,n.constants.R_OK|n.constants.W_OK)}catch{throw new Error(`Unable to access summary file: '${c}'. Check if the file has correct read/write permissions.`)}return this._filePath=c,this._filePath})}wrap(c,m,p={}){const v=Object.entries(p).map(([E,d])=>` ${E}="${d}"`).join("");return m?`<${c}${v}>${m}</${c}>`:`<${c}${v}>`}write(c){return t(this,void 0,void 0,function*(){const m=!!(c!=null&&c.overwrite),p=yield this.filePath();return yield(m?i:s)(p,this._buffer,{encoding:"utf8"}),this.emptyBuffer()})}clear(){return t(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(c,m=!1){return this._buffer+=c,m?this.addEOL():this}addEOL(){return this.addRaw(r.EOL)}addCodeBlock(c,m){const p=Object.assign({},m&&{lang:m}),v=this.wrap("pre",this.wrap("code",c),p);return this.addRaw(v).addEOL()}addList(c,m=!1){const p=m?"ol":"ul",v=c.map(d=>this.wrap("li",d)).join(""),E=this.wrap(p,v);return this.addRaw(E).addEOL()}addTable(c){const m=c.map(v=>{const E=v.map(d=>{if(typeof d=="string")return this.wrap("td",d);const{header:f,data:h,colspan:y,rowspan:w}=d,S=f?"th":"td",_=Object.assign(Object.assign({},y&&{colspan:y}),w&&{rowspan:w});return this.wrap(S,h,_)}).join("");return this.wrap("tr",E)}).join(""),p=this.wrap("table",m);return this.addRaw(p).addEOL()}addDetails(c,m){const p=this.wrap("details",this.wrap("summary",c)+m);return this.addRaw(p).addEOL()}addImage(c,m,p){const{width:v,height:E}=p||{},d=Object.assign(Object.assign({},v&&{width:v}),E&&{height:E}),f=this.wrap("img",null,Object.assign({src:c,alt:m},d));return this.addRaw(f).addEOL()}addHeading(c,m){const p=`h${m}`,v=["h1","h2","h3","h4","h5","h6"].includes(p)?p:"h1",E=this.wrap(v,c);return this.addRaw(E).addEOL()}addSeparator(){const c=this.wrap("hr",null);return this.addRaw(c).addEOL()}addBreak(){const c=this.wrap("br",null);return this.addRaw(c).addEOL()}addQuote(c,m){const p=Object.assign({},m&&{cite:m}),v=this.wrap("blockquote",c,p);return this.addRaw(v).addEOL()}addLink(c,m){const p=this.wrap("a",c,{href:m});return this.addRaw(p).addEOL()}}const u=new l;e.markdownSummary=u,e.summary=u}(Rr)),Rr}var Ge={},uu;function Ey(){if(uu)return Ge;uu=1;var e=Ge&&Ge.__createBinding||(Object.create?function(l,u,a,c){c===void 0&&(c=a);var m=Object.getOwnPropertyDescriptor(u,a);(!m||("get"in m?!u.__esModule:m.writable||m.configurable))&&(m={enumerable:!0,get:function(){return u[a]}}),Object.defineProperty(l,c,m)}:functi
`);return{name:v,version:E}});e.platform=i.default.platform(),e.arch=i.default.arch(),e.isWindows=e.platform==="win32",e.isMacOS=e.platform==="darwin",e.isLinux=e.platform==="linux";function m(){return o(this,void 0,void 0,function*(){return Object.assign(Object.assign({},yield e.isWindows?u():e.isMacOS?a():c()),{platform:e.platform,arch:e.arch,isWindows:e.isWindows,isMacOS:e.isMacOS,isLinux:e.isLinux})})}e.getDetails=m}(Qe)),Qe}var mu;function mr(){return mu||(mu=1,function(e){var t=dt&&dt.__createBinding||(Object.create?function(N,H,X,re){re===void 0&&(re=X);var ue=Object.getOwnPropertyDescriptor(H,X);(!ue||("get"in ue?!H.__esModule:ue.writable||ue.configurable))&&(ue={enumerable:!0,get:function(){return H[X]}}),Object.defineProperty(N,re,ue)}:function(N,H,X,re){re===void 0&&(re=X),N[re]=H[X]}),r=dt&&dt.__setModuleDefault||(Object.create?function(N,H){Object.defineProperty(N,"default",{enumerable:!0,value:H})}:function(N,H){N.default=H}),n=dt&&dt.__importStar||function(N){if(N&&N.__esModule)return N;var H={};if(N!=null)for(var X in N)X!=="default"&&Object.prototype.hasOwnProperty.call(N,X)&&t(H,N,X);return r(H,N),H},o=dt&&dt.__awaiter||function(N,H,X,re){function ue(K){return K instanceof X?K:new X(function(ie){ie(K)})}return new(X||(X=Promise))(function(K,ie){function oe(D){try{k(re.next(D))}catch(L){ie(L)}}function _e(D){try{k(re.throw(D))}catch(L){ie(L)}}function k(D){D.done?K(D.value):ue(D.value).then(oe,_e)}k((re=re.apply(N,H||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.platform=e.toPlatformPath=e.toWin32Path=e.toPosixPath=e.markdownSummary=e.summary=e.getIDToken=e.getState=e.saveState=e.group=e.endGroup=e.startGroup=e.info=e.notice=e.warning=e.error=e.debug=e.isDebug=e.setFailed=e.setCommandEcho=e.setOutput=e.getBooleanInput=e.getMultilineInput=e.getInput=e.addPath=e.setSecret=e.exportVariable=e.ExitCode=void 0;const s=iy(),i=sy(),l=Ca(),u=n(le),a=n(T),c=_y();var m;(function(N){N[N.Success=0]="Success",N[N.Failure=1]="Failure"})(m||(e.ExitCode=m={}));function p(N,H){const X=(0,l.toCommandValue)(H);if(process.env[N]=X,process.env.GITHUB_ENV||"")return(0,i.issueFileCommand)("ENV",(0,i.prepareKeyValueMessage)(N,H));(0,s.issueCommand)("set-env",{name:N},X)}e.exportVariable=p;function v(N){(0,s.issueCommand)("add-mask",{},N)}e.setSecret=v;function E(N){process.env.GITHUB_PATH||""?(0,i.issueFileCommand)("PATH",N):(0,s.issueCommand)("add-path",{},N),process.env.PATH=`${N}${a.delimiter}${process.env.PATH}`}e.addPath=E;function d(N,H){const X=process.env[`INPUT_${N.replace(/ /g,"_").toUpperCase()}`]||"";if(H&&H.required&&!X)throw new Error(`Input required and not supplied: ${N}`);return H&&H.trimWhitespace===!1?X:X.trim()}e.getInput=d;function f(N,H){const X=d(N,H).split(`
`).filter(re=>re!=="");return H&&H.trimWhitespace===!1?X:X.map(re=>re.trim())}e.getMultilineInput=f;function h(N,H){const X=["true","True","TRUE"],re=["false","False","FALSE"],ue=d(N,H);if(X.includes(ue))return!0;if(re.includes(ue))return!1;throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${N}
Support boolean input list: \`true | True | TRUE | false | False | FALSE\``)}e.getBooleanInput=h;function y(N,H){if(process.env.GITHUB_OUTPUT||"")return(0,i.issueFileCommand)("OUTPUT",(0,i.prepareKeyValueMessage)(N,H));process.stdout.write(u.EOL),(0,s.issueCommand)("set-output",{name:N},(0,l.toCommandValue)(H))}e.setOutput=y;function w(N){(0,s.issue)("echo",N?"on":"off")}e.setCommandEcho=w;function S(N){process.exitCode=m.Failure,g(N)}e.setFailed=S;function _(){return process.env.RUNNER_DEBUG==="1"}e.isDebug=_;function b(N){(0,s.issueCommand)("debug",{},N)}e.debug=b;function g(N,H={}){(0,s.issueCommand)("error",(0,l.toCommandProperties)(H),N instanceof Error?N.toString():N)}e.error=g;function O(N,H={}){(0,s.issueCommand)("warning",(0,l.toCommandProperties)(H),N instanceof Error?N.toString():N)}e.warning=O;function $(N,H={}){(0,s.issueCommand)("notice",(0,l.toCommandProperties)(H),N instanceof Error?N.toString():N)}e.notice=$;function C(N){process.stdout.write(N+u.EOL)}e.info=C;function G(N){(0,s.issue)("group",N)}e.startGroup=G;function Y(){(0,s.issue)("endgroup")}e.endGroup=Y;function Q(N,H){return o(this,void 0,void 0,function*(){G(N);let X;try{X=yield H()}finally{Y()}return X})}e.group=Q;function A(N,H){if(process.env.GITHUB_STATE||"")return(0,i.issueFileCommand)("STATE",(0,i.prepareKeyValueMessage)(N,H));(0,s.issueCommand)("save-state",{name:N},(0,l.toCommandValue)(H))}e.saveState=A;function x(N){return process.env[`STATE_${N}`]||""}e.getState=x;function F(N){return o(this,void 0,void 0,function*(){return yield c.OidcClient.getIDToken(N)})}e.getIDToken=F;var U=cu();Object.defineProperty(e,"summary",{enumerable:!0,get:function(){return U.summary}});var q=cu();Object.defineProperty(e,"markdownSummary",{enumerable:!0,get:function(){return q.markdownSummary}});var V=Ey();Object.defineProperty(e,"toPosixPath",{enumerable:!0,get:function(){return V.toPosixPath}}),Object.defineProperty(e,"toWin32Path",{enumerable:!0,get:function(){return V.toWin32Path}}),Object.defineProperty(e,"toPlatformPath",{enumerable:!0,get:function(){return V.toPlatformPath}}),e.platform=n(by())}(dt)),dt}var Se=mr();function Sp(e){const t=Se.getInput(e.toLowerCase());if(t!=="false"&&t!=="")return t}var Di={};const Ry=[{name:"Agola CI",constant:"AGOLA",env:"AGOLA_GIT_REF",pr:"AGOLA_PULL_REQUEST_ID"},{name:"Appcircle",constant:"APPCIRCLE",env:"AC_APPCIRCLE",pr:{env:"AC_GIT_PR",ne:"false"}},{name:"AppVeyor",constant:"APPVEYOR",env:"APPVEYOR",pr:"APPVEYOR_PULL_REQUEST_NUMBER"},{name:"AWS CodeBuild",constant:"CODEBUILD",env:"CODEBUILD_BUILD_ARN",pr:{env:"CODEBUILD_WEBHOOK_EVENT",any:["PULL_REQUEST_CREATED","PULL_REQUEST_UPDATED","PULL_REQUEST_REOPENED"]}},{name:"Azure Pipelines",constant:"AZURE_PIPELINES",env:"TF_BUILD",pr:{BUILD_REASON:"PullRequest"}},{name:"Bamboo",constant:"BAMBOO",env:"bamboo_planKey"},{name:"Bitbucket Pipelines",constant:"BITBUCKET",env:"BITBUCKET_COMMIT",pr:"BITBUCKET_PR_ID"},{name:"Bitrise",constant:"BITRISE",env:"BITRISE_IO",pr:"BITRISE_PULL_REQUEST"},{name:"Buddy",constant:"BUDDY",env:"BUDDY_WORKSPACE_ID",pr:"BUDDY_EXECUTION_PULL_REQUEST_ID"},{name:"Buildkite",constant:"BUILDKITE",env:"BUILDKITE",pr:{env:"BUILDKITE_PULL_REQUEST",ne:"false"}},{name:"CircleCI",constant:"CIRCLE",env:"CIRCLECI",pr:"CIRCLE_PULL_REQUEST"},{name:"Cirrus CI",constant:"CIRRUS",env:"CIRRUS_CI",pr:"CIRRUS_PR"},{name:"Cloudflare Pages",constant:"CLOUDFLARE_PAGES",env:"CF_PAGES"},{name:"Cloudflare Workers",constant:"CLOUDFLARE_WORKERS",env:"WORKERS_CI"},{name:"Codefresh",constant:"CODEFRESH",env:"CF_BUILD_ID",pr:{any:["CF_PULL_REQUEST_NUMBER","CF_PULL_REQUEST_ID"]}},{name:"Codemagic",constant:"CODEMAGIC",env:"CM_BUILD_ID",pr:"CM_PULL_REQUEST"},{name:"Codeship",constant:"CODESHIP",env:{CI_NAME:"codeship"}},{name:"Drone",constant:"DRONE",env:"DRONE",pr:{DRONE_BUILD_EVENT:"pull_request"}},{name:"dsari",constant:"DSARI",env:"DSARI"},{name:"Earthly",constant:"EARTHLY",env:"EARTHLY_CI"},{name:"Expo Application Services",constant:"EAS",env:"EAS_BUILD"},{name:"Gerrit",constant:"GERRIT",env:"GERRIT_PROJECT"},{name:"Gitea Actions",constant:"GITEA_ACTIONS",env:"GITEA_A
`:10,r=typeof e=="string"?"\r":13;return e[e.length-1]===t&&(e=e.slice(0,-1)),e[e.length-1]===r&&(e=e.slice(0,-1)),e}function bp(e={}){const{env:t=process.env,platform:r=process.platform}=e;return r!=="win32"?"PATH":Object.keys(t).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"}const Vy=({cwd:e=at.cwd(),path:t=at.env[bp()],preferLocal:r=!0,execPath:n=at.execPath,addExecPath:o=!0}={})=>{const s=e instanceof URL?lt.fileURLToPath(e):e,i=T.resolve(s),l=[];return r&&By(l,i),o&&zy(l,n,i),[...l,t].join(T.delimiter)},By=(e,t)=>{let r;for(;r!==t;)e.push(T.join(t,"node_modules/.bin")),r=t,t=T.resolve(t,"..")},zy=(e,t,r)=>{const n=t instanceof URL?lt.fileURLToPath(t):t;e.push(T.resolve(r,n,".."))},Hy=({env:e=at.env,...t}={})=>{e={...e};const r=bp({env:e});return t.path=e[r],e[r]=Vy(t),e},Wy=(e,t,r,n)=>{if(r==="length"||r==="prototype"||r==="arguments"||r==="caller")return;const o=Object.getOwnPropertyDescriptor(e,r),s=Object.getOwnPropertyDescriptor(t,r);!Xy(o,s)&&n||Object.defineProperty(e,r,s)},Xy=function(e,t){return e===void 0||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},Ky=(e,t)=>{const r=Object.getPrototypeOf(t);r!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,r)},Yy=(e,t)=>`/* Wrapped ${e}*/
${t}`,Jy=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Qy=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Zy=(e,t,r)=>{const n=r===""?"":`with ${r.trim()}() `,o=Yy.bind(null,n,t.toString());Object.defineProperty(o,"name",Qy),Object.defineProperty(e,"toString",{...Jy,value:o})};function ew(e,t,{ignoreNonConfigurable:r=!1}={}){const{name:n}=e;for(const o of Reflect.ownKeys(t))Wy(e,t,o,r);return Ky(e,t),Zy(e,t,n),e}const mn=new WeakMap,Rp=(e,t={})=>{if(typeof e!="function")throw new TypeError("Expected a function");let r,n=0;const o=e.displayName||e.name||"<anonymous>",s=function(...i){if(mn.set(s,++n),n===1)r=e.apply(this,i),e=null;else if(t.throw===!0)throw new Error(`Function \`${o}\` can only be called once`);return r};return ew(s,e),mn.set(s,n),s};Rp.callCount=e=>{if(!mn.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return mn.get(e)};const tw=()=>{const e=$p-Op+1;return Array.from({length:e},rw)},rw=(e,t)=>({name:`SIGRT${t+1}`,number:Op+t,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),Op=34,$p=64,nw=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standar
${n.message}`:f,w=[y,t,e].filter(Boolean).join(`
2025-07-10 22:11:16 +08:00
`);return h?(n.originalMessage=n.message,n.message=w):n=new Error(w),n.shortMessage=y,n.command=i,n.escapedCommand=l,n.exitCode=s,n.signal=o,n.signalDescription=v,n.stdout=e,n.stderr=t,n.cwd=p,r!==void 0&&(n.all=r),"bufferedData"in n&&delete n.bufferedData,n.failed=!0,n.timedOut=!!u,n.isCanceled=a,n.killed=c&&!u,n},nn=["stdin","stdout","stderr"],dw=e=>nn.some(t=>e[t]!==void 0),pw=e=>{if(!e)return;const{stdio:t}=e;if(t===void 0)return nn.map(n=>e[n]);if(dw(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${nn.map(n=>`\`${n}\``).join(", ")}`);if(typeof t=="string")return t;if(!Array.isArray(t))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);const r=Math.max(t.length,nn.length);return Array.from({length:r},(n,o)=>t[o])};var zt={exports:{}},Hi={exports:{}},xu;function hw(){return xu||(xu=1,function(e){e.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"],process.platform!=="win32"&&e.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT"),process.platform==="linux"&&e.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")}(Hi)),Hi.exports}var Cu;function mw(){if(Cu)return zt.exports;Cu=1;var e=et.process;const t=function(f){return f&&typeof f=="object"&&typeof f.removeListener=="function"&&typeof f.emit=="function"&&typeof f.reallyExit=="function"&&typeof f.listeners=="function"&&typeof f.kill=="function"&&typeof f.pid=="number"&&typeof f.on=="function"};if(!t(e))zt.exports=function(){return function(){}};else{var r=kr,n=hw(),o=/^win/i.test(e.platform),s=On;typeof s!="function"&&(s=s.EventEmitter);var i;e.__signal_exit_emitter__?i=e.__signal_exit_emitter__:(i=e.__signal_exit_emitter__=new s,i.count=0,i.emitted={}),i.infinite||(i.setMaxListeners(1/0),i.infinite=!0),zt.exports=function(f,h){if(!t(et.process))return function(){};r.equal(typeof f,"function","a callback must be provided for exit handler"),c===!1&&m();var y="exit";h&&h.alwaysLast&&(y="afterexit");var w=function(){i.removeListener(y,f),i.listeners("exit").length===0&&i.listeners("afterexit").length===0&&l()};return i.on(y,f),w};var l=function(){!c||!t(et.process)||(c=!1,n.forEach(function(h){try{e.removeListener(h,a[h])}catch{}}),e.emit=E,e.reallyExit=p,i.count-=1)};zt.exports.unload=l;var u=function(h,y,w){i.emitted[h]||(i.emitted[h]=!0,i.emit(h,y,w))},a={};n.forEach(function(f){a[f]=function(){if(t(et.process)){var y=e.listeners(f);y.length===i.count&&(l(),u("exit",null,f),u("afterexit",null,f),o&&f==="SIGHUP"&&(f="SIGINT"),e.kill(e.pid,f))}}}),zt.exports.signals=function(){return n};var c=!1,m=function(){c||!t(et.process)||(c=!0,i.count+=1,n=n.filter(function(h){try{return e.on(h,a[h]),!0}catch{return!1}}),e.emit=d,e.reallyExit=v)};zt.exports.load=m;var p=e.reallyExit,v=function(h){t(et.process)&&(e.exitCode=h||0,u("exit",e.exitCode,null),u("afterexit",e.exitCode,null),p.call(e,e.exitCode))},E=e.emit,d=function(h,y){if(h==="exit"&&t(et.process)){y!==void 0&&(e.exitCode=y);var w=E.apply(this,arguments);return u("exit",e.exitCode,null),u("afterexit",e.exitCode,null),w}else return E.apply(this,arguments)}}return zt.exports}var yw=mw();const ww=Oe(yw),vw=1e3*5,gw=(e,t="SIGTERM",r={})=>{const n=e(t);return _w(e,t,r,n),n},_w=(e,t,r,n)=>{if(!Ew(t,r,n))return;const o=bw(r),s=setTimeout(()=>{e("SIGKILL")},o);s.unref&&s.unref()},Ew=(e,{forceKillAfterTimeout:t},r)=>Sw(e)&&t!==!1&&r,Sw=e=>e===le.constants.signals.SIGTERM||typeof e=="string"&&e.toUpperCase()==="SIGTERM",bw=({forceKillAfterTimeout:e=!0})=>{if(e===!0)return vw;if(!Number.isFinite(e)||e<0)throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e},Rw=(e,t)=>{e.kill()&&(t.isCanceled=!0)},Ow=(e,t,r)=>{e.kill(t),r(Object.assign(new Error("Timed out"),{timedOut:!0,signal:t}))},$w=(e,{timeout:t,killSignal:r="SIGTERM"},n)=>{if(t===0||t===void 0)return n;let o;const s=new Promise((l,u)=>{o=setTimeout(()=>{Ow(e,r,u)},t)}),i=n.finally(()=>{clearTimeout(o)});return Promise.race([s,i])},Iw=({timeout:e})=>
`)},Qw=1e3*1e3*100,Zw=({env:e,extendEnv:t,preferLocal:r,localDir:n,execPath:o})=>{const s=t?{...at.env,...e}:e;return r?Hy({env:s,cwd:n,execPath:o}):s},Lp=(e,t,r={})=>{const n=My._parse(e,t,r);return e=n.command,t=n.args,r=n.options,r={maxBuffer:Qw,buffer:!0,stripFinalNewline:!0,extendEnv:!0,preferLocal:!1,localDir:r.cwd||at.cwd(),execPath:at.execPath,encoding:"utf8",reject:!0,cleanup:!0,all:!1,windowsHide:!0,verbose:Yw,...r},r.env=Zw(r),r.stdio=pw(r),at.platform==="win32"&&T.basename(e,".exe")==="cmd"&&t.unshift("/q"),{file:e,args:t,options:r,parsed:n}},Nr=(e,t,r)=>typeof t!="string"&&!ap.Buffer.isBuffer(t)?r===void 0?void 0:"":e.stripFinalNewline?Gy(t):t;function fe(e,t,r){const n=Lp(e,t,r),o=xp(e,t),s=Cp(e,t);Np(s,n.options),Iw(n.options);let i;try{i=Nt.spawn(n.file,n.args,n.options)}catch(v){const E=new Nt.ChildProcess,d=Promise.reject(yn({error:v,stdout:"",stderr:"",all:"",command:o,escapedCommand:s,parsed:n,timedOut:!1,isCanceled:!1,killed:!1}));return qu(E,d),E}const l=zw(i),u=$w(i,n.options,l),a=Pw(i,n.options,u),c={isCanceled:!1};i.kill=gw.bind(null,i.kill.bind(i)),i.cancel=Rw.bind(null,i,c);const p=Rp(async()=>{const[{error:v,exitCode:E,signal:d,timedOut:f},h,y,w]=await Gw(i,n.options,a),S=Nr(n.options,h),_=Nr(n.options,y),b=Nr(n.options,w);if(v||E!==0||d!==null){const g=yn({error:v,exitCode:E,signal:d,stdout:S,stderr:_,all:b,command:o,escapedCommand:s,parsed:n,timedOut:f,isCanceled:c.isCanceled||(n.options.signal?n.options.signal.aborted:!1),killed:i.killed});if(!n.options.reject)return g;throw g}return{command:o,escapedCommand:s,exitCode:0,stdout:S,stderr:_,all:b,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}});return Uw(i,n.options),i.all=Mw(i,n.options),xw(i),qu(i,p),i}function ze(e,t,r){const n=Lp(e,t,r),o=xp(e,t),s=Cp(e,t);Np(s,n.options);const i=Fw(n.options);let l;try{l=Nt.spawnSync(n.file,n.args,{...n.options,input:i})}catch(c){throw yn({error:c,stdout:"",stderr:"",all:"",command:o,escapedCommand:s,parsed:n,timedOut:!1,isCanceled:!1,killed:!1})}const u=Nr(n.options,l.stdout,l.error),a=Nr(n.options,l.stderr,l.error);if(l.error||l.status!==0||l.signal!==null){const c=yn({stdout:u,stderr:a,error:l.error,signal:l.signal,exitCode:l.status,command:o,escapedCommand:s,parsed:n,timedOut:l.error&&l.error.code==="ETIMEDOUT",isCanceled:!1,killed:l.signal!==null});if(!n.options.reject)return c;throw c}return{command:o,escapedCommand:s,exitCode:0,stdout:u,stderr:a,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}}function ev(e,t){const[r,...n]=Ap(e);return fe(r,n,t)}function tv(e,t){const[r,...n]=Ap(e);return ze(r,n,t)}var mt={},Ht={};const rv=Ar.promises,{access:nv,appendFile:Dp,chmod:Da,chown:iv,copyFile:ov,lchmod:sv,lchown:av,link:cv,lstat:uv,mkdir:lv,mkdtemp:fv,open:dv,readdir:ka,readFile:Qt,readlink:pv,realpath:hv,rename:mv,rmdir:yv,stat:wv,symlink:vv,truncate:gv,unlink:_v,utimes:Ev,writeFile:Lr}=Ar.promises,Sv="rm"in Ar.promises?Ar.promises.rm:pr.promisify(Ar.unlink),bv=Object.freeze(Object.defineProperty({__proto__:null,access:nv,appendFile:Dp,chmod:Da,chown:iv,copyFile:ov,default:rv,lchmod:sv,lchown:av,link:cv,lstat:uv,mkdir:lv,mkdtemp:fv,open:dv,readFile:Qt,readdir:ka,readlink:pv,realpath:hv,rename:mv,rm:Sv,rmdir:yv,stat:wv,symlink:vv,truncate:gv,unlink:_v,utimes:Ev,writeFile:Lr},Symbol.toStringTag,{value:"Module"})),kp=$n(bv);var Fu;function Rv(){if(Fu)return Ht;Fu=1,Object.defineProperty(Ht,"__esModule",{value:!0}),Ht.sync=Ht.isexe=void 0;const e=ae,t=kp,r=async(i,l={})=>{const{ignoreErrors:u=!1}=l;try{return o(await(0,t.stat)(i),l)}catch(a){const c=a;if(u||c.code==="EACCES")return!1;throw c}};Ht.isexe=r;const n=(i,l={})=>{const{ignoreErrors:u=!1}=l;try{return o((0,e.statSync)(i),l)}catch(a){const c=a;if(u||c.code==="EACCES")return!1;throw c}};Ht.sync=n;const o=(i,l)=>i.isFile()&&s(i,l),s=(i,l)=>{var w,S,_,b,g,O,$,C;const u=(S=l.uid)!=null?S:(w=process.getuid)==null?void 0:w.call(process),a=(g=(b=l.groups)!=null?b:(_=process.getgroups)==null?void 0:_.call(process))!=null?g:[],c=(C=($=l.gid)!=null?$:(O=process.getgid)==null?void 0:O.call(process))!=null?C:a[0];if(u===void 0||c===void 0)throw new Error("canno
Consider to rely on 'then' or 'done' mode instead.`);b&&(delete c[v],m[v]=_,a.emit("setasync",v,b))},y=function(){f=!0,c[v]&&(delete c[v],delete p[v],a.delete(v))},w=u;if(w||(w="then"),w==="then"){var S=function(){s(y)};d=d.then(function(_){s(h.bind(this,_))},S),typeof d.finally=="function"&&d.finally(S)}else if(w==="done"){if(typeof d.done!="function")throw new Error("Memoizee error: Retrieved promise does not implement 'done' in 'done' mode");d.done(h,y)}else if(w==="done:finally"){if(typeof d.done!="function")throw new Error("Memoizee error: Retrieved promise does not implement 'done' in 'done:finally' mode");if(typeof d.finally!="function")throw new Error("Memoizee error: Retrieved promise does not implement 'finally' in 'done:finally' mode");d.done(h),d.finally(y)}}),a.on("get",function(v,E,d){var f;if(c[v]){++c[v];return}f=p[v];var h=function(){a.emit("getasync",v,E,d)};o(f)?typeof f.done=="function"?f.done(h):f.then(function(){s(h)}):h()}),a.on("delete",function(v){if(delete p[v],c[v]){delete c[v];return}if(hasOwnProperty.call(m,v)){var E=m[v];delete m[v],a.emit("deleteasync",v,[E])}}),a.on("clear",function(){var v=m;m=i(null),c=i(null),p=i(null),a.emit("clearasync",e(v,function(E){return[E]}))})},sf}var mf={},yf;function qg(){if(yf)return mf;yf=1;var e=jt(),t=Ln(),r=rr(),n=Function.prototype.apply;return r.dispose=function(o,s,i){var l;if(e(o),i.async&&r.async||i.promise&&r.promise){s.on("deleteasync",l=function(u,a){n.call(o,null,a)}),s.on("clearasync",function(u){t(u,function(a,c){l(c,a)})});return}s.on("delete",l=function(u,a){o(a)}),s.on("clear",function(u){t(u,function(a,c){l(c,a)})})},mf}var wf={},vs,vf;function Fg(){return vf||(vf=1,vs=2147483647),vs}var gs,gf;function jg(){if(gf)return gs;gf=1;var e=tr(),t=Fg();return gs=function(r){if(r=e(r),r>t)throw new TypeError(r+" exceeds maximum possible timeout");return r},gs}var _f;function Ug(){if(_f)return wf;_f=1;var e=Fa(),t=Ln(),r=Ua(),n=Yp(),o=jg(),s=rr(),i=Function.prototype,l=Math.max,u=Math.min,a=Object.create;return s.maxAge=function(c,m,p){var v,E,d,f;c=o(c),c&&(v=a(null),E=p.async&&s.async||p.promise&&s.promise?"async":"",m.on("set"+E,function(h){v[h]=setTimeout(function(){m.delete(h)},c),typeof v[h].unref=="function"&&v[h].unref(),f&&(f[h]&&f[h]!=="nextTick"&&clearTimeout(f[h]),f[h]=setTimeout(function(){delete f[h]},d),typeof f[h].unref=="function"&&f[h].unref())}),m.on("delete"+E,function(h){clearTimeout(v[h]),delete v[h],f&&(f[h]!=="nextTick"&&clearTimeout(f[h]),delete f[h])}),p.preFetch&&(p.preFetch===!0||isNaN(p.preFetch)?d=.333:d=l(u(Number(p.preFetch),1),0),d&&(f={},d=(1-d)*c,m.on("get"+E,function(h,y,w){f[h]||(f[h]="nextTick",r(function(){var S;f[h]==="nextTick"&&(delete f[h],m.delete(h),p.async&&(y=e(y),y.push(i)),S=m.memoized.apply(w,y),p.promise&&n(S)&&(typeof S.done=="function"?S.done(i,i):S.then(i,i)))}))}))),m.on("clear"+E,function(){t(v,function(h){clearTimeout(h)}),v={},f&&(t(f,function(h){h!=="nextTick"&&clearTimeout(h)}),f={})}))},wf}var Ef={},_s,Sf;function Mg(){if(Sf)return _s;Sf=1;var e=tr(),t=Object.create,r=Object.prototype.hasOwnProperty;return _s=function(n){var o=0,s=1,i=t(null),l=t(null),u=0,a;return n=e(n),{hit:function(c){var m=l[c],p=++u;if(i[p]=c,l[c]=p,!m)return++o,o<=n?void 0:(c=i[s],a(c),c);if(delete i[m],s===m)for(;!r.call(i,++s););},delete:a=function(c){var m=l[c];if(m&&(delete i[m],delete l[c],--o,s===m)){if(!o){u=0,s=1;return}for(;!r.call(i,++s););}},clear:function(){o=0,s=1,i=t(null),l=t(null),u=0}}},_s}var bf;function Gg(){if(bf)return Ef;bf=1;var e=tr(),t=Mg(),r=rr();return r.max=function(n,o,s){var i,l,u;n=e(n),n&&(l=t(n),i=s.async&&r.async||s.promise&&r.promise?"async":"",o.on("set"+i,u=function(a){a=l.hit(a),a!==void 0&&o.delete(a)}),o.on("get"+i,u),o.on("delete"+i,l.delete),o.on("clear"+i,l.clear))},Ef}var Rf={},Of;function Vg(){if(Of)return Rf;Of=1;var e=nr(),t=rr(),r=Object.create,n=Object.defineProperties;return t.refCounter=function(o,s,i){var l,u;l=r(null),u=i.async&&t.async||i.promise&&t.promise?"async":"",s.on("set"+u,function(a,c){l[a]=c||1}),s.on("get"+u,function(a){++l[a]}),s.on("delete"+u,funct
# ${o}
if [[ "$SOURCE_${o.toUpperCase()}RC" != 0 && -f "${n}" ]]; then source "${n}"; fi
`;try{await Promise.all([Qg(e),If(s,t),If(s,r)])}catch(l){ve(`Failed to add ${s} to .profile or .bashrc. You should add it manually: ${l}`)}}const Ga=Fe(Jg,{promise:!0});async function Qg(e){const t=e.guard===void 0?`
# Automatically Generated by envosman
`:`
# Automatically Generated by envosman ${e.guard}
export SOURCE_${e.guard.toUpperCase()}RC=0
2025-07-10 22:11:16 +08:00
`;await we(e.rcPath)&&((await Ma(e.rcPath,"utf8")).includes(t)||(await Jp(e.rcPath,`
${t}
2025-07-10 22:11:16 +08:00
`),W(`Added ${t} to ${e.rcPath}`)))}async function If(e,t){await we(t)&&((await Ma(t,"utf-8")).includes(e)||(await Jp(t,e),W(`${e} was added to ${t}`)))}async function Zg(e){if(await we(e.rcPath)){const t=(await Ma(e.rcPath,"utf-8")).split(`
`),r=[...new Set(t.reverse())].reverse();await Kg(e.rcPath,r.join(`
`)),await vr(e.rcPath)}}var Ss,Pf;function e_(){if(Pf)return Ss;Pf=1;const e=le,t=e.platform()!=="win32",r=e.release(),n=/(\d+\.\d+)\.(\d+)/,o=(s="",i="")=>/1\d+\.\d+/.test(s)&&Number(i)>=17134.1184;return Ss=function(s){return t?s.replace(/(\s+)/g,"\\$1"):o(...n.exec(r).splice(1))?s:s.replace(/(\s+)/g,"%20")},Ss}var t_=e_();const r_=Oe(t_);var on={exports:{}},bs,Tf;function n_(){if(Tf)return bs;Tf=1;var e=/[|\\{}()[\]^$+*?.]/g;return bs=function(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(e,"\\$&")},bs}var i_=on.exports,xf;function o_(){return xf||(xf=1,function(){var e,t;e=n_(),t=function(r){return r.split("").reverse().join("")},on.exports=function(r,n,o){var s;return n==null&&(n="'"),o==null&&(o="\\"),typeof r!="string"?r:(s=new RegExp("(["+e(n)+"])(?!"+e(o)+")","g"),t(t(r).replace(s,"$1"+o)))}}.call(i_)),on.exports}var s_=o_();const a_=Oe(s_);function c_(e,t=!1){const r=t?r_(e):e;return a_(r,'"',"\\")}const{GITHUB_ACTIONS:u_}=Et,{appendFile:Cf}=ae.promises;async function Pe(e,t,r={}){const n={escapeSpace:!1,overwrite:!0,rcPath:Qp,...r},o=c_(t!=null?t:"",n.escapeSpace);try{if(u_)try{if(!n.overwrite&&process.env[e]!==void 0){W(`Environment variable ${e} is already defined. Skipping.`);return}Se.exportVariable(e,o)}catch(s){Ae(s),await Af(e,o,n)}else await Af(e,o,n)}catch(s){Ae(`${s}
Failed to export environment variable ${e}=${o}. You should add it manually.`)}}async function Af(e,t,r){const n=t!=null?t:"";switch(process.platform){case"win32":{if(!r.overwrite&&process.env[e]!==void 0){W(`Environment variable ${e} is already defined. Skipping.`);return}await qp(`[Environment]::SetEnvironmentVariable('${e}', '${n}', "User")`),W(`${e}='${n}' was set in the environment.`);return}case"linux":case"darwin":{await Ga(r),r.overwrite?(await Cf(r.rcPath,`
export ${e}="${n}"
2025-07-10 22:11:16 +08:00
`),W(`${e}="${n}" was added to "${r.rcPath}`)):(await Cf(r.rcPath,`
if [ -z "\${${e}}" ]; then export ${e}="${n}"; fi
2025-07-10 22:11:16 +08:00
`),W(`if not defined ${e} then ${e}="${n}" was added to "${r.rcPath}`)),process.env[e]=n;return}}process.env[e]=n}const{GITHUB_ACTIONS:l_}=Et,{appendFile:f_}=ae.promises;async function $e(e,t={}){const r={rcPath:Qp,...t};if(!p_(e)){process.env.PATH=`${e}${T.delimiter}${process.env.PATH}`;try{if(l_)try{Se.addPath(e)}catch(n){Ae(n),await Nf(e,r)}else await Nf(e,r)}catch(n){Ae(`${n}
Failed to add ${e} to the percistent PATH. You should add it manually.`)}}}async function Nf(e,t){switch(process.platform){case"win32":{await qp(`$USER_PATH=([Environment]::GetEnvironmentVariable("PATH", "User")); [Environment]::SetEnvironmentVariable("PATH", "${e};$USER_PATH", "User")`),W(`"${e}" was added to the PATH.`);return}case"linux":case"darwin":{await Ga(t),await f_(t.rcPath,`
export PATH="${e}:$PATH"
2025-07-10 22:11:16 +08:00
`),W(`"${e}" was added to "${t.rcPath}"`);return}default:return}}const d_=[/\/usr\/bin\/?/,/\/usr\/local\/bin\/?/];function p_(e){var t,r;return d_.some(n=>n.test(e))?((r=(t=process.env.PATH)==null?void 0:t.split(T.delimiter))!=null?r:[]).includes(e):!1}function Va(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var sn={exports:{}},h_=sn.exports,Lf;function Zp(){return Lf||(Lf=1,function(e){(function(){var t={},r={create:n,addLocale:o,pluralize:s};e.exports=r;function n(a){return l(a),{pluralize:function(c,m){return s(a,c,m)}}}function o(a,c){t[a]=c}function s(a,c,m){if(l(a),typeof m!="object")throw new Error("List of variants should be specified as an object");var p=t[a](c);return typeof m[p]<"u"?m[p]:null}function i(a){return typeof t[a]<"u"}function l(a){i(a)||u(a)}function u(a){try{Va(__dirname+"/../locales/"+a+".js")}catch{throw Error("Failed to load the following locale: "+a)}}}).call(h_)}(sn)),sn.exports}var Rs,Df;function eh(){return Df||(Df=1,Rs=Zp()),Rs}var m_=eh();const y_=Oe(m_);var Os={},kf;function w_(){return kf||(kf=1,function(){var e=this,t;typeof Va=="function"?t=Zp():t=e.numerous,t.addLocale("en",function(n){var o=Math.floor(Math.abs(n)),s=n.toString().replace(/^[^.]*\.?/,"").length;return typeof n=="string"&&(n=parseInt(n,10)),o===1&&s===0?"one":"other"})}.call(Os)),Os}var v_=w_();const g_=Oe(v_);var $s={exports:{}},qf;function __(){return qf||(qf=1,function(e,t){e.exports=!!(typeof process<"u"&&process.versions&&process.versions.node)}($s)),$s.exports}var Is,Ff;function E_(){if(Ff)return Is;Ff=1;const e=eh(),t=__(),r=[["years",12*4*7*24*60*60*1e3],["months",4*7*24*60*60*1e3],["weeks",7*24*60*60*1e3],["days",24*60*60*1e3],["hours",60*60*1e3],["minutes",60*1e3],["seconds",1e3]],n={locale:"en",span:2,delimiter:", ",unitType:"long",unitTypeLookupOrder:["long","short","narrow"],autoloadLocales:!0},o={};Is={create:i,addLocale:s,defaultConfig:n};function s(d){Array.isArray(d)||(d=[d]);for(const f of d){const{id:h,data:y}=f;o[h]=y}}function i(d){return d=Object.assign({},n,d||{}),{format:function(f,h,y){return y=Object.assign({},d,y||{}),l(f,h,y)}}}function l(d,f,h){if(u(h.locale,{autoload:h.autoloadLocales}),!d)throw new Error("Missing first date argument");if(!f)throw new Error("Missing second date argument");const y=m(d,f),w=[];for(const S of y){const[_,b]=S;if(b>0&&w.push(p(_,b,h)),w.length>=h.span)break}return w.join(h.delimiter)}function u(d,f){const{autoload:h}=f;if(!a(d))if(t&&h)c(d);else throw new Error(`Missing locale: ${d}, you must load it manually before using it`)}function a(d){return!!o[d]}function c(d){try{s(Va(`../locales/${d}.js`))}catch(f){throw Error(`Failed to load locale: ${d} from ../locales/${d}.js. If using a bundled time-delta, set 'autoloadLocales: false' in the config: ${f}`)}}function m(d,f){let h=f-d;const y=[];return r.some(function(w){const S=w[0],_=w[1],b=Math.floor(h/_);if(h-=b*_,y.push([S,b]),h<=0)return!0}),y}function p(d,f,h){const y=v(h);return e.pluralize(h.locale,f,y[d]).replace("{0}",f)}function v(d){const f=o[d.locale];let h=d.unitTypeLookupOrder.slice();h.unshift(d.unitType),h=E(h);let y=null;if(h.some(function(w){if(typeof f[w]<"u")return y=f[w],!0}),y===null)throw new Error("Can not find any unit type data for locale: "+d.locale);return y}function E(d){return Array.from(new Set(d))}return Is}var Ps,jf;function S_(){return jf||(jf=1,Ps=E_()),Ps}var b_=S_();const Uf=Oe(b_);var Ts,Mf;function R_(){return Mf||(Mf=1,Ts={id:"en",data:{long:{years:{one:"{0} year",other:"{0} years"},months:{one:"{0} month",other:"{0} months"},weeks:{one:"{0} week",other:"{0} weeks"},days:{one:"{0} day",other:"{0} days"},hours:{one:"{0} hour",other:"{0} hours"},minutes:{one:"{0} minute",other:"{0} minutes"},seconds:{one:"{0} second",other:"{0} seconds"}},narrow:{years:{one:"{0}y",other:"{0}y"},months:{one:"{0}m",other:"{0}m"},weeks:{one:"{0}w",other:"{0}w"},days:{one:"{0}d",other:"{0}d"},hours:{one:"{0}h",other:"{0}h"},minutes:
`),await vn.clear(),await vn(),W(`Successfully added repository: ${e}`),!0}catch(t){throw new Error(`Failed to add repository ${e}: ${t}`)}}async function ph(){const e=(await G_()).split(".").slice(0,2).join(".");return M_(`https://dl-cdn.alpinelinux.org/alpine/v${e}/community/`)}async function G_(){const e="/etc/alpine-release";if(!await we(e))throw new Error(`Alpine release file not found at ${e}`);return Qt(e,"utf8")}async function V_(e){try{const{exitCode:t}=await vt("apk",["info","-e",e.name],{reject:!1,stdio:["ignore","pipe","ignore"]});if(t!==0)return!1;if(e.version===void 0||e.version==="")return!0;const{stdout:r}=await vt("apk",["info","-v",e.name],{stdio:["ignore","pipe","ignore"]});return r.trim().split("-").slice(-1)[0]===e.version}catch{return!1}}async function hh(e){return(await Promise.all(e.map(async r=>await V_(r)?void 0:r))).filter(r=>r!==void 0).map(mh)}function mh(e){return e.version!==void 0&&e.version!==""?`${e.name}=${e.version}`:e.name}async function B_(){const e=await hh([{name:"bash"}]);e.length!==0&&me("apk",["add",...e],{...it})}const z_=Fe(B_,{promise:!0});async function ke(e,t=!1){if(!await Ie())throw new Error("apk is not available on this system");try{await z_(),t&&await vn.clear(),await vn();const r=await hh(e);return r.length===0?(W("All packages are already installed"),{binDir:"/usr/bin"}):(W(`Installing ${r.join(" ")}`),await vt("apk",["add",...r]),W(`Successfully installed ${r.join(" ")}`),{binDir:"/usr/bin"})}catch(r){throw ve(`Failed to install ${e.map(n=>mh(n)).join(" ")}: ${r}`),r}}const{GITHUB_ACTIONS:H_}=Et,{appendFile:W_}=ae.promises;async function X_(e,t,r=40){await vt("update-alternatives",["--install",`/usr/bin/${e}`,e,t,r.toString()])}async function wt(e,t,r,n=40){H_?await X_(e,t,n):(await Ga(r),await W_(r.rcPath,`
if [ $UID -eq 0 ]; then update-alternatives --install /usr/bin/${e} ${e} ${t} ${n}; fi
2025-07-10 22:11:16 +08:00
`))}var Cs={},Bf;function K_(){return Bf||(Bf=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DownloaderHelper=e.DH_STATES=void 0;var t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(y){return typeof y}:function(y){return y&&typeof Symbol=="function"&&y.constructor===Symbol&&y!==Symbol.prototype?"symbol":typeof y},r=function(){function y(w,S){for(var _,b=0;b<S.length;b++)_=S[b],_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(w,_.key,_)}return function(w,S,_){return S&&y(w.prototype,S),_&&y(w,_),w}}(),n=ae,o=v(n),s=lt,i=T,l=v(i),u=ba,a=v(u),c=Rn,m=v(c),p=On;function v(y){if(y&&y.__esModule)return y;var w={};if(y!=null)for(var S in y)Object.prototype.hasOwnProperty.call(y,S)&&(w[S]=y[S]);return w.default=y,w}function E(y,w){if(!(y instanceof w))throw new TypeError("Cannot call a class as a function")}function d(y,w){if(!y)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return w&&(typeof w=="object"||typeof w=="function")?w:y}function f(y,w){if(typeof w!="function"&&w!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof w);y.prototype=Object.create(w&&w.prototype,{constructor:{value:y,enumerable:!1,writable:!0,configurable:!0}}),w&&(Object.setPrototypeOf?Object.setPrototypeOf(y,w):y.__proto__=w)}var h=e.DH_STATES={IDLE:"IDLE",SKIPPED:"SKIPPED",STARTED:"STARTED",DOWNLOADING:"DOWNLOADING",RETRY:"RETRY",PAUSED:"PAUSED",RESUMED:"RESUMED",STOPPED:"STOPPED",FINISHED:"FINISHED",FAILED:"FAILED"};e.DownloaderHelper=function(y){function w(S,_){var b=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{};E(this,w);var g=d(this,(w.__proto__||Object.getPrototypeOf(w)).call(this,{captureRejections:!0}));return g.__validate(S,_)?(g.url=g.requestURL=S.trim(),g.state=h.IDLE,g.__defaultOpts={body:null,retry:!1,method:"GET",headers:{},fileName:"",timeout:-1,metadata:null,override:!1,forceResume:!1,removeOnStop:!0,removeOnFail:!0,progressThrottle:1e3,httpRequestOptions:{},httpsRequestOptions:{},resumeOnIncomplete:!0,resumeIfFileExists:!1,resumeOnIncompleteMaxRetry:5},g.__opts=Object.assign({},g.__defaultOpts),g.__pipes=[],g.__total=0,g.__downloaded=0,g.__progress=0,g.__retryCount=0,g.__retryTimeout=null,g.__resumeRetryCount=0,g.__states=h,g.__promise=null,g.__request=null,g.__response=null,g.__isAborted=!1,g.__isResumed=!1,g.__isResumable=!1,g.__isRedirected=!1,g.__destFolder=_,g.__statsEstimate={time:0,bytes:0,prevBytes:0,throttleTime:0},g.__fileName="",g.__filePath="",g.updateOptions(b),g):d(g)}return f(w,y),r(w,[{key:"start",value:function(){var _=this,b=function(){return new Promise(function(g,O){_.__promise={resolve:g,reject:O},_.__start()})};return this.__opts.resumeIfFileExists&&this.state!==this.__states.RESUMED?this.getTotalSize().then(function(g){var O=g.name,$=g.total,C=_.__opts.override;if(_.__opts.override=!0,_.__filePath=_.__getFilePath(O),_.__opts.override=C,_.__filePath&&o.existsSync(_.__filePath)){var G=_.__getFilesizeInBytes(_.__filePath);return G===$?b():_.resumeFromFile(_.__filePath,{total:$,fileName:O})}return b()}):b()}},{key:"pause",value:function(){var _=this;return this.state===this.__states.STOPPED?Promise.resolve(!0):(this.__response&&(this.__response.unpipe(),this.__pipes.forEach(function(b){return b.stream.unpipe()})),this.__fileStream&&this.__fileStream.removeAllListeners(),this.__requestAbort(),this.__closeFileStream().then(function(){return _.__setState(_.__states.PAUSED),_.emit("pause"),!0}))}},{key:"resume",value:function(){return this.__promise?this.state===this.__states.STOPPED?Promise.resolve(!1):(this.__setState(this.__states.RESUMED),this.__isResumable&&(this.__isResumed=!0,this.__reqOptions.headers.range="bytes="+this.__downloaded+"-"),this.emit("resume",this.__isResumed),this.__start()):this.start()}},{key:"stop",value:function(){var _=this;if(this.state===this.__states.STOPPED)return Promise.resolve(!0);var b=function(){return new Promise(function(g,O){o.access(_.__filePath,function($){return $?(_.__emitStop(),g(!0)):void o.unlink(_.
`).some(n=>n.startsWith("Status: install ok installed"))}catch{return!1}}async function eE(e){try{const{stdout:t}=await fe("dpkg",["-l",e],{env:ut("apt-get"),stdio:"pipe"});return typeof t!="string"?!1:t.split(`
`).some(n=>n.startsWith("ii"))}catch{return!1}}let _h=!1;function tE(e=Ur()){me(e,["update","-o",Er],{...it,env:ut(e)}),_h=!0}const lr=Fe(tE);var Pt;(function(e){e[e.NameDashVersion=0]="NameDashVersion",e[e.NameEqualsVersion=1]="NameEqualsVersion",e[e.Name=2]="Name",e[e.None=3]="None"})(Pt||(Pt={}));async function Eh(e,t=Ur()){return(await Promise.all(e.map(r=>ga(r,t)))).filter(r=>r!==void 0)}async function ga(e,t=Ur()){const r=await nE(t,e);return await Ba(r)?void 0:r}async function Sh(e,t,r,n){const o=r!==void 0&&r!=="",s=!o||n;if(o){if(await rE(e,t,r))return Pt.NameDashVersion;if(await Hf(e,`${t}=${r}`))return Pt.NameEqualsVersion}const i=()=>{o&&n&&W(`Could not find package ${t} ${r}. Falling back to latest version.`)};return s&&await Hf(e,t)?(i(),Pt.Name):_h?s?(i(),Pt.Name):Pt.None:(lr(e),Sh(e,t,r,n))}async function rE(e,t,r){try{const{stdout:n}=await fe("apt-cache",["search","--names-only",`^${wn(t)}-${wn(r)}$`],{env:ut(e),stdio:"pipe"});if(n.trim()!=="")return!0}catch{}return!1}async function Hf(e,t){try{const{stdout:r}=await fe("apt-cache",["show",t],{env:ut(e),stdio:"pipe",verbose:!0});if(r.trim()!=="")return!0}catch{}return!1}async function nE(e,t){const{name:r,version:n,fallBackToLatest:o=!1}=t;switch(await Sh(e,r,n,o)){case Pt.NameDashVersion:return`${r}-${n}`;case Pt.NameEqualsVersion:return`${r}=${n}`;case Pt.Name:return r;default:throw new Error(`Could not find package '${r}' ${n!=null?n:"with unspecified version"}`)}}async function iE(e){lr(e);const t=await Eh([{name:"ca-certificates"},{name:"gnupg"},{name:"apt-utils"}],e);t.length!==0&&me(e,["install","-y","--fix-broken","-o",Er,...t],{...it,env:ut(e)})}const bh=Fe(iE,{promise:!0});function oE(e="apt-get"){try{const{stdout:t}=me("add-apt-repository",["--help"],{...it,env:ut(e),stdio:"pipe"});return t.includes("--no-update")}catch{return!1}}const Rh=Fe(oE);async function sE(e,t=Ur()){await bh(t),await Oh();try{me("add-apt-repository",["-y",Rh(t)?"--no-update":void 0,e].filter(r=>r!==void 0),{...it,env:ut(t)})}catch{me("add-apt-repository",["-y",e],{...it,env:ut(t)})}lr.clear(),lr(t)}async function Oh(){if(await Ba("software-properties-common"))return;const e="apt-get";me(e,["install","-y","--fix-broken","-o",Er,"software-properties-common"],{...it,env:ut(e)})}const aE=["E: Could not get lock","dpkg: error processing archive","dpkg: error: dpkg status database is locked by another process"];async function pe(e,t=!1){try{const r=Ur();for(const{name:o,version:s}of e)W(`Installing ${o} ${s!=null?s:""} via ${r}`);t&&lr.clear(),lr(r),await cE(r,e);const n=await Eh(e,r);if(n.length===0)return W("All packages are already installed"),{binDir:"/usr/bin/"};await bh(r);try{await uE(e),me(r,["install","--fix-broken","-y",...n],{...it,env:ut(r)})}catch(o){if(lE(o))aE.some(s=>typeof o.stderr=="string"&&o.stderr.includes(s))&&(ve(`Failed to install packages ${n}. Retrying...`),me(r,["install","--fix-broken","-y","-o",Er,...n],{...it,env:ut(r)}));else throw o}return{binDir:"/usr/bin/"}}catch(r){const n=r instanceof Error?`${r.message}
${r.stack}`:String(r);throw new Error(`Failed to install apt packages: ${n}`)}}async function cE(e,t){const r=[...new Set(t.flatMap(n=>{var o;return(o=n.repository)!=null?o:[]}))];await Promise.all(r.map(n=>sE(n,e)))}async function uE(e){await Promise.all(e.map(async t=>{t.key!==void 0&&await J_(t.key)}))}function lE(e){return typeof e.stderr=="string"}let ar;async function Wf(){if(!ye())return;if(typeof ar=="string")return{binDir:ar};const e=de.sync("apt-fast",{nothrow:!0});return e!==null?(ar=T.dirname(e),{binDir:ar}):(ar="/usr/bin",await fE(),{binDir:ar})}async function fE(){const e=pe([{name:"bash"},{name:"wget"}]),t=new _r.DownloaderHelper("https://raw.githubusercontent.com/ilikenwf/apt-fast/c2cd0a0420d3f2d647dc82cf749bfd58c4697dac/quick-install.sh",le.tmpdir(),{fileName:"install-apt-fast.sh"});t.on("error",u=>{throw new Error(`Failed to download install-apt-fast.sh: ${u}`)}),await t.start();const r=T.join(le.tmpdir(),"install-apt-fast.sh");let n=await Qt(r,"utf8");n=n.replace(/sudo/g,"").replace("https://raw.githubusercontent.com/ilikenwf/apt-fast/master","https://raw.githubusercontent.com/Rongronggg9/apt-fast/ac82051792f764220e5e303d4560de0f1952826b"),await Lr(r,n),await e;try{me("bash",[r])}catch(u){Ae(`Failed to install apt-fast via installer: ${u}`)}const o="/etc/apt-fast.conf";let s=await Qt(o,"utf8");const i=["_APTMGR","DOWNLOADBEFORE"];for(const u of i)s=s.replace(new RegExp(`^#\\s*${u}`,"m"),u);const l=T.join(le.tmpdir(),"apt-fast.conf");await Lr(l,s),me("mv",[l,o])}let Dt;async function dE({version:e}={}){if(!ye())return;if(typeof Dt=="string")return{binDir:Dt};const t=de.sync("nala",{nothrow:!0});if(t!==null)return Dt=T.dirname(t),{binDir:Dt};await pe([{name:"python3-apt"}]),Dt="/usr/bin";try{const r=await ga({name:"nala",version:e});if(r!==void 0)return await pe([{name:r}]),{binDir:Dt}}catch(r){W(`Failed to install nala: ${r}`)}try{const r=await ga({name:"nala-legacy"});if(r!==void 0)return await pe([{name:r}],!0),{binDir:Dt}}catch(r){W(`Failed to install nala-legacy: ${r}`)}return await pE(),{binDir:Dt}}async function pE(){const e=new _r.DownloaderHelper("https://gitlab.com/volian/volian-archive/-/raw/1939afc3f80638dca2bbedde74bbd86731703cc8/install-nala.sh",le.tmpdir(),{fileName:"install-nala.sh"});e.on("error",n=>{throw new Error(`Failed to download install-nala.sh: ${n}`)}),await e.start();const t=T.join(le.tmpdir(),"install-nala.sh"),r=await Qt(t,"utf8");await Lr(t,r.replace(/sudo/g,"")),await pe([{name:"wget"}]);try{me("bash",[t])}catch(n){Ae(`Failed to install nala via installer: ${n}`),me("apt",["install","-y","-t","nala","nala"])}}let Kt;async function za(e={}){if(!["darwin","linux"].includes(process.platform)||process.platform==="linux"&&process.arch!=="x64"){ve(`Brew is not supported on ${process.platform} ${process.arch}`);return}if(typeof Kt=="string")return{binDir:Kt};const t=await de("brew",{nothrow:!0});if(t!==null)return Kt=T.dirname(t),{binDir:Kt};await pe([{name:"ca-certificates"}]);const r=new _r.DownloaderHelper("https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh",le.tmpdir(),{fileName:"install-brew.sh"});return r.on("error",n=>{throw new Error(`Failed to download the brew installer script: ${n}`)}),await r.start(),ze("/bin/bash",[r.getDownloadPath()],{stdio:"inherit",env:{NONINTERACTIVE:"1"}}),Kt=Ha(),await $e(Kt,e.rcOptions),{binDir:Kt}}function Ha(){return T.join(Wa(),"bin")}function $h(){return T.join(Ha(),"brew")}function Wa(){if(process.platform==="darwin")return process.arch==="arm64"?"/opt/homebrew":"/usr/local";if(process.platform==="linux")return"/home/linuxbrew/.linuxbrew";throw new Error("Unsupported platform for brew")}function Ih(e,t){return t!==void 0&&t!==""?`${e}@${t}`:e}async function hE(e,t){const r=Ih(e,t),n=await Xf(r);if(n!==void 0)return n;const o=await Xf(e);return o!==void 0?o:mE(e,r)}async function Xf(e){try{const t=$h();return(await fe(t,["--prefix",e],{stdio:"pipe"})).stdout}catch{return}}function mE(e,t){const r=Wa(),n=T.join(r,"opt",t);if(ae.existsSync(n))return n;const o=T.join(r,"opt",e);if(ae.existsSync(o))return o;const s=T.join(r,"C
GFS4: `),console.error(f)}),!e[s]){var c=et[s]||[];u(e,c),e.close=function(f){function h(y,w){return f.call(e,y,function(S){S||E(),typeof w=="function"&&w.apply(this,arguments)})}return Object.defineProperty(h,i,{value:f}),h}(e.close),e.closeSync=function(f){function h(y){f.apply(e,arguments),E()}return Object.defineProperty(h,i,{value:f}),h}(e.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){a(e[s]),kr.equal(e[s].length,0)})}et[s]||u(et,e[s]),Zr=m(n(e)),process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!e.__patched&&(Zr=m(e),e.__patched=!0);function m(f){t(f),f.gracefulify=m,f.createReadStream=H,f.createWriteStream=X;var h=f.readFile;f.readFile=y;function y(K,ie,oe){return typeof ie=="function"&&(oe=ie,ie=null),_e(K,ie,oe);function _e(k,D,L,M){return h(k,D,function(z){z&&(z.code==="EMFILE"||z.code==="ENFILE")?p([_e,[k,D,L],z,M||Date.now(),Date.now()]):typeof L=="function"&&L.apply(this,arguments)})}}var w=f.writeFile;f.writeFile=S;function S(K,ie,oe,_e){return typeof oe=="function"&&(_e=oe,oe=null),k(K,ie,oe,_e);function k(D,L,M,z,ee){return w(D,L,M,function(J){J&&(J.code==="EMFILE"||J.code==="ENFILE")?p([k,[D,L,M,z],J,ee||Date.now(),Date.now()]):typeof z=="function"&&z.apply(this,arguments)})}}var _=f.appendFile;_&&(f.appendFile=b);function b(K,ie,oe,_e){return typeof oe=="function"&&(_e=oe,oe=null),k(K,ie,oe,_e);function k(D,L,M,z,ee){return _(D,L,M,function(J){J&&(J.code==="EMFILE"||J.code==="ENFILE")?p([k,[D,L,M,z],J,ee||Date.now(),Date.now()]):typeof z=="function"&&z.apply(this,arguments)})}}var g=f.copyFile;g&&(f.copyFile=O);function O(K,ie,oe,_e){return typeof oe=="function"&&(_e=oe,oe=0),k(K,ie,oe,_e);function k(D,L,M,z,ee){return g(D,L,M,function(J){J&&(J.code==="EMFILE"||J.code==="ENFILE")?p([k,[D,L,M,z],J,ee||Date.now(),Date.now()]):typeof z=="function"&&z.apply(this,arguments)})}}var $=f.readdir;f.readdir=G;var C=/^v[0-5]\./;function G(K,ie,oe){typeof ie=="function"&&(oe=ie,ie=null);var _e=C.test(process.version)?function(L,M,z,ee){return $(L,k(L,M,z,ee))}:function(L,M,z,ee){return $(L,M,k(L,M,z,ee))};return _e(K,ie,oe);function k(D,L,M,z){return function(ee,J){ee&&(ee.code==="EMFILE"||ee.code==="ENFILE")?p([_e,[D,L,M],ee,z||Date.now(),Date.now()]):(J&&J.sort&&J.sort(),typeof M=="function"&&M.call(this,ee,J))}}}if(process.version.substr(0,4)==="v0.8"){var Y=r(f);U=Y.ReadStream,V=Y.WriteStream}var Q=f.ReadStream;Q&&(U.prototype=Object.create(Q.prototype),U.prototype.open=q);var A=f.WriteStream;A&&(V.prototype=Object.create(A.prototype),V.prototype.open=N),Object.defineProperty(f,"ReadStream",{get:function(){return U},set:function(K){U=K},enumerable:!0,configurable:!0}),Object.defineProperty(f,"WriteStream",{get:function(){return V},set:function(K){V=K},enumerable:!0,configurable:!0});var x=U;Object.defineProperty(f,"FileReadStream",{get:function(){return x},set:function(K){x=K},enumerable:!0,configurable:!0});var F=V;Object.defineProperty(f,"FileWriteStream",{get:function(){return F},set:function(K){F=K},enumerable:!0,configurable:!0});function U(K,ie){return this instanceof U?(Q.apply(this,arguments),this):U.apply(Object.create(U.prototype),arguments)}function q(){var K=this;ue(K.path,K.flags,K.mode,function(ie,oe){ie?(K.autoClose&&K.destroy(),K.emit("error",ie)):(K.fd=oe,K.emit("open",oe),K.read())})}function V(K,ie){return this instanceof V?(A.apply(this,arguments),this):V.apply(Object.create(V.prototype),arguments)}function N(){var K=this;ue(K.path,K.flags,K.mode,function(ie,oe){ie?(K.destroy(),K.emit("error",ie)):(K.fd=oe,K.emit("open",oe))})}function H(K,ie){return new f.ReadStream(K,ie)}function X(K,ie){return new f.WriteStream(K,ie)}var re=f.open;f.open=ue;function ue(K,ie,oe,_e){return typeof oe=="function"&&(_e=oe,oe=null),k(K,ie,oe,_e);function k(D,L,M,z,ee){return re(D,L,M,function(J,qe){J&&(J.code==="EMFILE"||J.code==="ENFILE")?p([k,[D,L,M,z],J,ee||Date.now(),Date.now()]):typeof z=="function"&&z.apply(this,arguments)})}}return f}function p(f){a("ENQUEUE",f[0].name,f[1]),e[s].push(f),d()}var v;function E(){for(var f=Date.now(),h=0;h<e[s].length;++h)e[s][h].length>2&&
2025-07-10 22:11:16 +08:00
see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0001");const{srcStat:y,destStat:w}=await s.checkPaths(d,f,"copy",h);if(await s.checkParentPaths(d,y,f,"copy"),!await l(d,f,h))return;const _=t.dirname(f);await n(_)||await r(_),await u(w,d,f,h)}async function l(d,f,h){return h.filter?h.filter(d,f):!0}async function u(d,f,h,y){const S=await(y.dereference?e.stat:e.lstat)(f);if(S.isDirectory())return v(S,d,f,h,y);if(S.isFile()||S.isCharacterDevice()||S.isBlockDevice())return a(S,d,f,h,y);if(S.isSymbolicLink())return E(d,f,h,y);throw S.isSocket()?new Error(`Cannot copy a socket file: ${f}`):S.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${f}`):new Error(`Unknown file: ${f}`)}async function a(d,f,h,y,w){if(!f)return c(d,h,y,w);if(w.overwrite)return await e.unlink(y),c(d,h,y,w);if(w.errorOnExist)throw new Error(`'${y}' already exists`)}async function c(d,f,h,y){if(await e.copyFile(f,h),y.preserveTimestamps){m(d.mode)&&await p(h,d.mode);const w=await e.stat(f);await o(h,w.atime,w.mtime)}return e.chmod(h,d.mode)}function m(d){return(d&128)===0}function p(d,f){return e.chmod(d,f|128)}async function v(d,f,h,y,w){f||await e.mkdir(y);const S=[];for await(const _ of await e.opendir(h)){const b=t.join(h,_.name),g=t.join(y,_.name);S.push(l(b,g,w).then(O=>{if(O)return s.checkPaths(b,g,"copy",w).then(({destStat:$})=>u($,b,g,w))}))}await Promise.all(S),f||await e.chmod(y,d.mode)}async function E(d,f,h,y){let w=await e.readlink(f);if(y.dereference&&(w=t.resolve(process.cwd(),w)),!d)return e.symlink(w,h);let S=null;try{S=await e.readlink(h)}catch(_){if(_.code==="EINVAL"||_.code==="UNKNOWN")return e.symlink(w,h);throw _}if(y.dereference&&(S=t.resolve(process.cwd(),S)),s.isSrcSubdir(w,S))throw new Error(`Cannot copy '${w}' to a subdirectory of itself, '${S}'.`);if(s.isSrcSubdir(S,w))throw new Error(`Cannot overwrite '${S}' with '${w}'.`);return await e.unlink(h),e.symlink(w,h)}return Vs=i,Vs}var Bs,fd;function DE(){if(fd)return Bs;fd=1;const e=Mr(),t=T,r=Ct().mkdirsSync,n=Nh().utimesMillisSync,o=Sr();function s(_,b,g){typeof g=="function"&&(g={filter:g}),g=g||{},g.clobber="clobber"in g?!!g.clobber:!0,g.overwrite="overwrite"in g?!!g.overwrite:g.clobber,g.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
2025-07-10 22:11:16 +08:00
see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0002");const{srcStat:O,destStat:$}=o.checkPathsSync(_,b,"copy",g);if(o.checkParentPathsSync(_,O,b,"copy"),g.filter&&!g.filter(_,b))return;const C=t.dirname(b);return e.existsSync(C)||r(C),i($,_,b,g)}function i(_,b,g,O){const C=(O.dereference?e.statSync:e.lstatSync)(b);if(C.isDirectory())return d(C,_,b,g,O);if(C.isFile()||C.isCharacterDevice()||C.isBlockDevice())return l(C,_,b,g,O);if(C.isSymbolicLink())return w(_,b,g,O);throw C.isSocket()?new Error(`Cannot copy a socket file: ${b}`):C.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${b}`):new Error(`Unknown file: ${b}`)}function l(_,b,g,O,$){return b?u(_,g,O,$):a(_,g,O,$)}function u(_,b,g,O){if(O.overwrite)return e.unlinkSync(g),a(_,b,g,O);if(O.errorOnExist)throw new Error(`'${g}' already exists`)}function a(_,b,g,O){return e.copyFileSync(b,g),O.preserveTimestamps&&c(_.mode,b,g),v(g,_.mode)}function c(_,b,g){return m(_)&&p(g,_),E(b,g)}function m(_){return(_&128)===0}function p(_,b){return v(_,b|128)}function v(_,b){return e.chmodSync(_,b)}function E(_,b){const g=e.statSync(_);return n(b,g.atime,g.mtime)}function d(_,b,g,O,$){return b?h(g,O,$):f(_.mode,g,O,$)}function f(_,b,g,O){return e.mkdirSync(g),h(b,g,O),v(g,_)}function h(_,b,g){const O=e.opendirSync(_);try{let $;for(;($=O.readSync())!==null;)y($.name,_,b,g)}finally{O.closeSync()}}function y(_,b,g,O){const $=t.join(b,_),C=t.join(g,_);if(O.filter&&!O.filter($,C))return;const{destStat:G}=o.checkPathsSync($,C,"copy",O);return i(G,$,C,O)}function w(_,b,g,O){let $=e.readlinkSync(b);if(O.dereference&&($=t.resolve(process.cwd(),$)),_){let C;try{C=e.readlinkSync(g)}catch(G){if(G.code==="EINVAL"||G.code==="UNKNOWN")return e.symlinkSync($,g);throw G}if(O.dereference&&(C=t.resolve(process.cwd(),C)),o.isSrcSubdir($,C))throw new Error(`Cannot copy '${$}' to a subdirectory of itself, '${C}'.`);if(o.isSrcSubdir(C,$))throw new Error(`Cannot overwrite '${C}' with '${$}'.`);return S($,g)}else return e.symlinkSync($,g)}function S(_,b){return e.unlinkSync(b),e.symlinkSync(_,b)}return Bs=s,Bs}var zs,dd;function Ya(){if(dd)return zs;dd=1;const e=Ue().fromPromise;return zs={copy:e(LE()),copySync:DE()},zs}var Hs,pd;function Fn(){if(pd)return Hs;pd=1;const e=Mr(),t=Ue().fromCallback;function r(o,s){e.rm(o,{recursive:!0,force:!0},s)}function n(o){e.rmSync(o,{recursive:!0,force:!0})}return Hs={remove:t(r),removeSync:n},Hs}var Ws,hd;function kE(){if(hd)return Ws;hd=1;const e=Ue().fromPromise,t=We(),r=T,n=Ct(),o=Fn(),s=e(async function(u){let a;try{a=await t.readdir(u)}catch{return n.mkdirs(u)}return Promise.all(a.map(c=>o.remove(r.join(u,c))))});function i(l){let u;try{u=t.readdirSync(l)}catch{return n.mkdirsSync(l)}u.forEach(a=>{a=r.join(l,a),o.removeSync(a)})}return Ws={emptyDirSync:i,emptydirSync:i,emptyDir:s,emptydir:s},Ws}var Xs,md;function qE(){if(md)return Xs;md=1;const e=Ue().fromPromise,t=T,r=We(),n=Ct();async function o(i){let l;try{l=await r.stat(i)}catch{}if(l&&l.isFile())return;const u=t.dirname(i);let a=null;try{a=await r.stat(u)}catch(c){if(c.code==="ENOENT"){await n.mkdirs(u),await r.writeFile(i,"");return}else throw c}a.isDirectory()?await r.writeFile(i,""):await r.readdir(u)}function s(i){let l;try{l=r.statSync(i)}catch{}if(l&&l.isFile())return;const u=t.dirname(i);try{r.statSync(u).isDirectory()||r.readdirSync(u)}catch(a){if(a&&a.code==="ENOENT")n.mkdirsSync(u);else throw a}r.writeFileSync(i,"")}return Xs={createFile:e(o),createFileSync:s},Xs}var Ks,yd;function FE(){if(yd)return Ks;yd=1;const e=Ue().fromPromise,t=T,r=We(),n=Ct(),{pathExists:o}=ir(),{areIdentical:s}=Sr();async function i(u,a){let c;try{c=await r.lstat(a)}catch{}let m;try{m=await r.lstat(u)}catch(E){throw E.message=E.message.replace("lstat","ensureLink"),E}if(c&&s(m,c))return;const p=t.dirname(a);await o(p)||await n.mkdirs(p),await r.link(u,a)}function l(u,a){let c;try{c=r.lstatSync(a)}catch{}try{const v=r.lstatSync(u);if(c&&s(v,c))return}catch(v){throw v.message=v.message.replace("lstat","ensureLink"),v}const m=t.dirname(a);return r.existsSync(m)||n.mkdirsSync(m),r.linkSync(u,
`,finalEOL:o=!0,replacer:s=null,spaces:i}={}){const l=o?n:"";return JSON.stringify(r,s,i).replace(/\n/g,n)+l}function t(r){return Buffer.isBuffer(r)&&(r=r.toString("utf8")),r.replace(/^\uFEFF/,"")}return ea={stringify:e,stripBom:t},ea}var ta,Sd;function VE(){if(Sd)return ta;Sd=1;let e;try{e=Mr()}catch{e=ae}const t=Ue(),{stringify:r,stripBom:n}=Ja();async function o(m,p={}){typeof p=="string"&&(p={encoding:p});const v=p.fs||e,E="throws"in p?p.throws:!0;let d=await t.fromCallback(v.readFile)(m,p);d=n(d);let f;try{f=JSON.parse(d,p?p.reviver:null)}catch(h){if(E)throw h.message=`${m}: ${h.message}`,h;return null}return f}const s=t.fromPromise(o);function i(m,p={}){typeof p=="string"&&(p={encoding:p});const v=p.fs||e,E="throws"in p?p.throws:!0;try{let d=v.readFileSync(m,p);return d=n(d),JSON.parse(d,p.reviver)}catch(d){if(E)throw d.message=`${m}: ${d.message}`,d;return null}}async function l(m,p,v={}){const E=v.fs||e,d=r(p,v);await t.fromCallback(E.writeFile)(m,d,v)}const u=t.fromPromise(l);function a(m,p,v={}){const E=v.fs||e,d=r(p,v);return E.writeFileSync(m,d,v)}return ta={readFile:s,readFileSync:i,writeFile:u,writeFileSync:a},ta}var ra,bd;function BE(){if(bd)return ra;bd=1;const e=VE();return ra={readJson:e.readFile,readJsonSync:e.readFileSync,writeJson:e.writeFile,writeJsonSync:e.writeFileSync},ra}var na,Rd;function Qa(){if(Rd)return na;Rd=1;const e=Ue().fromPromise,t=We(),r=T,n=Ct(),o=ir().pathExists;async function s(l,u,a="utf-8"){const c=r.dirname(l);return await o(c)||await n.mkdirs(c),t.writeFile(l,u,a)}function i(l,...u){const a=r.dirname(l);t.existsSync(a)||n.mkdirsSync(a),t.writeFileSync(l,...u)}return na={outputFile:e(s),outputFileSync:i},na}var ia,Od;function zE(){if(Od)return ia;Od=1;const{stringify:e}=Ja(),{outputFile:t}=Qa();async function r(n,o,s={}){const i=e(o,s);await t(n,i,s)}return ia=r,ia}var oa,$d;function HE(){if($d)return oa;$d=1;const{stringify:e}=Ja(),{outputFileSync:t}=Qa();function r(n,o,s){const i=e(o,s);t(n,i,s)}return oa=r,oa}var sa,Id;function WE(){if(Id)return sa;Id=1;const e=Ue().fromPromise,t=BE();return t.outputJson=e(zE()),t.outputJsonSync=HE(),t.outputJSON=t.outputJson,t.outputJSONSync=t.outputJsonSync,t.writeJSON=t.writeJson,t.writeJSONSync=t.writeJsonSync,t.readJSON=t.readJson,t.readJSONSync=t.readJsonSync,sa=t,sa}var aa,Pd;function XE(){if(Pd)return aa;Pd=1;const e=We(),t=T,{copy:r}=Ya(),{remove:n}=Fn(),{mkdirp:o}=Ct(),{pathExists:s}=ir(),i=Sr();async function l(c,m,p={}){const v=p.overwrite||p.clobber||!1,{srcStat:E,isChangingCase:d=!1}=await i.checkPaths(c,m,"move",p);await i.checkParentPaths(c,E,m,"move");const f=t.dirname(m);return t.parse(f).root!==f&&await o(f),u(c,m,v,d)}async function u(c,m,p,v){if(!v){if(p)await n(m);else if(await s(m))throw new Error("dest already exists.")}try{await e.rename(c,m)}catch(E){if(E.code!=="EXDEV")throw E;await a(c,m,p)}}async function a(c,m,p){return await r(c,m,{overwrite:p,errorOnExist:!0,preserveTimestamps:!0}),n(c)}return aa=l,aa}var ca,Td;function KE(){if(Td)return ca;Td=1;const e=Mr(),t=T,r=Ya().copySync,n=Fn().removeSync,o=Ct().mkdirpSync,s=Sr();function i(m,p,v){v=v||{};const E=v.overwrite||v.clobber||!1,{srcStat:d,isChangingCase:f=!1}=s.checkPathsSync(m,p,"move",v);return s.checkParentPathsSync(m,d,p,"move"),l(p)||o(t.dirname(p)),u(m,p,E,f)}function l(m){const p=t.dirname(m);return t.parse(p).root===p}function u(m,p,v,E){if(E)return a(m,p,v);if(v)return n(p),a(m,p,v);if(e.existsSync(p))throw new Error("dest already exists.");return a(m,p,v)}function a(m,p,v){try{e.renameSync(m,p)}catch(E){if(E.code!=="EXDEV")throw E;return c(m,p,v)}}function c(m,p,v){return r(m,p,{overwrite:v,errorOnExist:!0,preserveTimestamps:!0}),n(m)}return ca=i,ca}var ua,xd;function YE(){if(xd)return ua;xd=1;const e=Ue().fromPromise;return ua={move:e(XE()),moveSync:KE()},ua}var la,Cd;function JE(){return Cd||(Cd=1,la={...We(),...Ya(),...kE(),...GE(),...WE(),...Ct(),...YE(),...Qa(),...ir(),...Fn()}),la}var Tt=JE();let kt;async function Lh(e){var i;if(process.platform!=="win32")return;if(typeof kt=="string")return{binDir:kt};const t=de.sync("choco",{nothrow:!0});if
`);for(const y of h){const w=y.split("=");if(w.length===2&&(w[0].trim()==="VERSION_ID"||w[0].trim()==="DISTRIB_RELEASE")){d=w[1].trim().replace(/^"/,"").replace(/"$/,"");break}}}}return d}t._getOsVersion=p;function v(){const E="/etc/lsb-release",d="/etc/os-release";let f="";return c.existsSync(E)?f=c.readFileSync(E).toString():c.existsSync(d)&&(f=c.readFileSync(d).toString()),f}t._readLinuxVersionFile=v}(Pr,Pr.exports)),Pr.exports}var Ze={},Dd;function ZE(){if(Dd)return Ze;Dd=1;var e=Ze&&Ze.__createBinding||(Object.create?function(i,l,u,a){a===void 0&&(a=u);var c=Object.getOwnPropertyDescriptor(l,u);(!c||("get"in c?!l.__esModule:c.writable||c.configurable))&&(c={enumerable:!0,get:function(){return l[u]}}),Object.defineProperty(i,a,c)}:function(i,l,u,a){a===void 0&&(a=u),i[a]=l[u]}),t=Ze&&Ze.__setModuleDefault||(Object.create?function(i,l){Object.defineProperty(i,"default",{enumerable:!0,value:l})}:function(i,l){i.default=l}),r=Ze&&Ze.__importStar||function(i){if(i&&i.__esModule)return i;var l={};if(i!=null)for(var u in i)u!=="default"&&Object.prototype.hasOwnProperty.call(i,u)&&e(l,i,u);return t(l,i),l},n=Ze&&Ze.__awaiter||function(i,l,u,a){function c(m){return m instanceof u?m:new u(function(p){p(m)})}return new(u||(u=Promise))(function(m,p){function v(f){try{d(a.next(f))}catch(h){p(h)}}function E(f){try{d(a.throw(f))}catch(h){p(h)}}function d(f){f.done?m(f.value):c(f.value).then(v,E)}d((a=a.apply(i,l||[])).next())})};Object.defineProperty(Ze,"__esModule",{value:!0}),Ze.RetryHelper=void 0;const o=r(mr());class s{constructor(l,u,a){if(l<1)throw new Error("max attempts should be greater than or equal to 1");if(this.maxAttempts=l,this.minSeconds=Math.floor(u),this.maxSeconds=Math.floor(a),this.minSeconds>this.maxSeconds)throw new Error("min seconds should be less than or equal to max seconds")}execute(l,u){return n(this,void 0,void 0,function*(){let a=1;for(;a<this.maxAttempts;){try{return yield l()}catch(m){if(u&&!u(m))throw m;o.info(m.message)}const c=this.getSleepAmount();o.info(`Waiting ${c} seconds before trying again`),yield this.sleep(c),a++}return yield l()})}getSleepAmount(){return Math.floor(Math.random()*(this.maxSeconds-this.minSeconds+1))+this.minSeconds}sleep(l){return n(this,void 0,void 0,function*(){return new Promise(u=>setTimeout(u,l*1e3))})}}return Ze.RetryHelper=s,Ze}var kd;function eS(){if(kd)return ce;kd=1;var e=ce&&ce.__createBinding||(Object.create?function(k,D,L,M){M===void 0&&(M=L);var z=Object.getOwnPropertyDescriptor(D,L);(!z||("get"in z?!D.__esModule:z.writable||z.configurable))&&(z={enumerable:!0,get:function(){return D[L]}}),Object.defineProperty(k,M,z)}:function(k,D,L,M){M===void 0&&(M=L),k[M]=D[L]}),t=ce&&ce.__setModuleDefault||(Object.create?function(k,D){Object.defineProperty(k,"default",{enumerable:!0,value:D})}:function(k,D){k.default=D}),r=ce&&ce.__importStar||function(k){if(k&&k.__esModule)return k;var D={};if(k!=null)for(var L in k)L!=="default"&&Object.prototype.hasOwnProperty.call(k,L)&&e(D,k,L);return t(D,k),D},n=ce&&ce.__awaiter||function(k,D,L,M){function z(ee){return ee instanceof L?ee:new L(function(J){J(ee)})}return new(L||(L=Promise))(function(ee,J){function qe(Ce){try{Xe(M.next(Ce))}catch(At){J(At)}}function xe(Ce){try{Xe(M.throw(Ce))}catch(At){J(At)}}function Xe(Ce){Ce.done?ee(Ce.value):z(Ce.value).then(qe,xe)}Xe((M=M.apply(k,D||[])).next())})};Object.defineProperty(ce,"__esModule",{value:!0}),ce.evaluateVersions=ce.isExplicitVersion=ce.findFromManifest=ce.getManifestFromRepo=ce.findAllVersions=ce.find=ce.cacheFile=ce.cacheDir=ce.extractZip=ce.extractXar=ce.extractTar=ce.extract7z=ce.downloadTool=ce.HTTPError=void 0;const o=r(mr()),s=r(Ep()),i=r(Aa),l=r(ae),u=r(QE()),a=r(le),c=r(T),m=r(gp),p=r(Dh()),v=r(qr),E=r(pr),d=kr,f=Na(),h=ZE();class y extends Error{constructor(D){super(`Unexpected HTTP response: ${D}`),this.httpStatusCode=D,Object.setPrototypeOf(this,new.target.prototype)}}ce.HTTPError=y;const w=process.platform==="win32",S=process.platform==="darwin",_="actions/tool-cache";function b(k,D,L,M){return n(this,void 0,void 0,function*(){D=D||c.join(ie(),i.randomUUID())
`)){const p=m.match(s);if(p!==null){if(p[1]!=="Ubuntu")return[];c=!0}const v=m.match(i);v&&(u=v);const E=m.match(l);if(E&&(a=E),c&&u&&a)break}if(!c)return[];for(const m of[u,a])if(m){const p=[m[1],m[2]];return m[3]&&p.push(m[3]),p.map(v=>parseInt(v,10))}return[]}return $r.getUbuntuVersion=n,$r}var Wh=FS();async function jS(){try{if(ye()){try{de.sync("lsb_release",{nothrow:!0})===null&&await pe([{name:"lsb-release"}])}catch{return Hd()}const e=await Wh.getUbuntuVersion();return e.length===0?Hd():e}else return null}catch(e){return ve(e.toString()),null}}const Ft=Fe(jS,{promise:!0});function Hd(){if(!("version"in le&&typeof le.version=="function"))return null;const t=le.version().match(/(\d+)\.(\d+)\.(\d+)/);if(t===null)return null;const r=Number.parseInt(t[1],10),n=Number.parseInt(t[2],10),o=Number.parseInt(t[3],10);return[r,n,o]}function US(e){return[...new Set(e)]}function Wd(e,t='"'){return e.includes(" ")?`${t}${e}${t}`:e}async function or(e,t,r={}){return bn(await zS(r.pythonVersion),e,t,r)}async function bn(e,t,r,n={}){const{usePipx:o=!0,user:s=!0,upgrade:i=!1,isLibrary:l=!1}=n,u=o&&!l&&await ln(e),a=!u&&await Yh(e),c=u?"pipx":"pip",m=HS(t);if(!i&&(u?await XS(e,m):await WS(e,m)))return{binDir:u?await Xd():await Kd(e,m)};if(!a&&await KS(e,m))try{Se.info(`Installing ${t} ${r!=null?r:""} via ${c}`);const v=r!==void 0&&r!==""?`${t}==${r}`:t,E=i?u?["upgrade"]:["install","--upgrade"]:["install"],d=!u&&s?["--user"]:[],f=process.env;u&&s&&(f.PIPX_HOME=await VS(),f.PIPX_BIN_DIR=await Xh()),ze(e,["-m",c,...E,...d,v],{stdio:"inherit",env:f})}catch(v){const E=v instanceof Error?`${v.message}
${v.stack}`:String(v);if(Se.info(`Failed to install ${t} via ${c}: ${E}`),await Dr(t)===null)throw new Error(`Failed to install ${t} via ${c}: ${v}.`)}else if(await Dr(t)===null)throw new Error(`Failed to install ${t} as it was not found via ${c} or the system package manager`);return{binDir:u?await Xd():await Kd(e,m)}}function Xd(){return Xh()}async function Kd(e,t){const r=await QS(e),n=await YS(r,t);return await $e(n,ne),n}async function MS(){return await de("pipx",{nothrow:!0})!==null}async function ln(e){return(await fe(e,["-m","pipx","--help"],{stdio:"ignore",reject:!1})).exitCode===0}async function GS(){let e=process.env.PIPX_HOME;if(e!==void 0)return e;const t=rt("~/.local/pipx");if(await we(t))return t;switch(process.platform){case"win32":{e=rt("~/AppData/Local/pipx");break}case"darwin":{e=rt("~/Library/Application Support/pipx");break}default:{e=rt("~/.local/share/pipx");break}}return await Tr(e),await Tr(T.join(e,"trash")),await Tr(T.join(e,"shared")),await Tr(T.join(e,"venv")),e}const VS=Fe(GS,{promise:!0});async function BS(){if(process.env.PIPX_BIN_DIR!==void 0)return process.env.PIPX_BIN_DIR;const e=rt("~/.local/bin");return await $e(e,ne),await Tr(e),e}const Xh=Fe(BS,{promise:!0});let rn;async function zS(e){if(rn!==void 0)return rn;const t=e!=null?e:nt("python",void 0,await Ft());return rn=(await Hh({version:t,setupDir:"",arch:process.arch})).bin,rn}function HS(e){return e.replace(/\[.*]/g,"").trim()}async function WS(e,t){try{return(await fe(e,["-m","pip","-qq","show",t],{stdio:"ignore",reject:!1})).exitCode===0}catch{return!1}}async function XS(e,t){try{const r=await fe(e,["-m","pipx","list","--json"],{stdio:"ignore",reject:!1});if(r.exitCode!==0||typeof r.stdout!="string")return!1;const n=JSON.parse(r.stdout);if(t in n.venvs)return!0;for(const o of Object.values(n.venvs))if(o.metadata.main_package.package_or_url===t||o.metadata.main_package.package===t)return!0}catch{}return!1}async function KS(e,t){return(await fe(e,["-m","pip","-qq","index","versions",t],{stdio:"ignore",reject:!1})).exitCode===0}async function YS(e,t){const n=(await Promise.all(e.map(s=>we(T.join(s,Ee(t)))))).findIndex(s=>s);if(n!==-1)return e[n];const o=de.sync(Ee(t),{nothrow:!0});return o!==null?T.dirname(o):e[e.length-1]}async function Dr(e,t){if(process.platform==="linux"){Se.info(`Installing ${e} via the system package manager`);const r=e==="pipx"?Te():!0;if(Te())return be(r?`python-${e}`:e);if(Le())return Ne([{name:r?`python3-${e}`:e}]);if(ye())return pe([{name:r?`python3-${e}`:e}]);if(await Ie())return ke([{name:r?`py3-${e}`:e}])}else if(process.platform==="darwin")return["venv"].includes(e)?null:Me(e);return null}async function JS(e){const t=[];process.platform==="linux"?t.push("/home/runner/.local/bin/"):process.platform==="darwin"&&t.push("/usr/local/bin/");const r=await Kh(e);return t.push(T.join(r,"Scripts"),T.join(r,"Scripts","bin"),T.join(r,"bin")),US(t)}const QS=Fe(JS,{promise:!0});async function ZS(e){return(await qn.getExecOutput(`${e} -c "import sys;print(sys.base_exec_prefix);"`)).stdout.trim()}const Kh=Fe(ZS,{promise:!0});async function eb(e){try{const t=await Kh(e),r=await Ch(e);if(r===void 0)return ve(`Failed to get the version of ${e}`),!1;const n=T.join(t,"lib",`python${r.major}.${r.minor}`,"EXTERNALLY-MANAGED");return we(n)}catch(t){return ve(`Failed to check if ${e} is externally managed: ${t}`),!1}}const Yh=Fe(eb,{promise:!0});function tb({version:e}={}){return ye()&&(e===void 0||e==="")?pe([{name:"gcovr",version:e}]):or("gcovr",e)}function rb(){return Pe("GCOV","llvm-cov gcov",ne)}function Yd(e){const t=kn(e),r=t!==null?fh(t):e,n=r!==""?`gcov-${r}`:"gcov";return Pe("GCOV",n,ne)}const st=["x64","amd64","x86_64","win64","64","amd64_x86","amd64_arm64"],ur=["x86","i386","ia32","win32","32","x32"],ct=["aarch64","arm64","woa64","arm"],nb=["armv7","armv7a"],ib=["powerpc64le","ppc64le"],ob=["sparc64"],sb=["sparcv9"];function Jh(e){return ct.includes(e)?"arm64":st.includes(e)?"amd64":e}async function ab({version:e}={}){switch(process.platform){case"win32":return De("bazelisk",e);case"darwin":return Me("bazelisk",
apt-get update -o ${Er}`)}async function Kb(e){let t=e.replace(/apt-get install -y/g,`apt-get install -o Dpkg::Options::="--force-overwrite" -o ${Er} -y --fix-broken`);const r=["libc++-$LLVM_VERSION-dev","libc++abi-$LLVM_VERSION-dev","libunwind-$LLVM_VERSION-dev"];return await Promise.all(r.map(async n=>{const o=n.replace("$LLVM_VERSION","*");await eE(o)&&(pn.info(`Removing conflicting package ${o}`),t=t.replace(n,""))})),t}function Yb(e){return yh()?e.replace(/apt-get/g,"nala"):e}function Jb(e,t,r){return e===1?t.replace(/ -y \$PKG/g,` -y clang-format-${r}`):t}const Jd=typeof __dirname=="string"?__dirname:T.dirname(lt.fileURLToPath(typeof document>"u"?require("url").pathToFileURL(__filename).href:ge&&ge.tagName.toUpperCase()==="SCRIPT"&&ge.src||new URL("setup-cpp.js",document.baseURI).href));async function Qb(e,t,r){const n=await Zb(t,r,e);W(`Downloading LLVM from ${n}`);const o=jh(n);return{url:n,extractedFolderName:"",binRelativeDir:"bin",binFileName:Ee("clang"),extractFunction:o===cn.Tar||o===cn.TarGz||o===cn.TarXz?(s,i)=>process.platform==="win32"?dr(s,i,!0):Za(s,i,1):Uh(o)}}async function Zb(e,t,r){const{keywords:n,optionalKeywords:o}=await eR(e,t),s=await gn(T.join(Jd,"github_llvm_llvm-project.json")),i=_n(s,{version:r,keywords:n,optionalKeywords:o,filterMapTag(a){return a.replace(/^llvmorg-/,"")}});if(i!==void 0)return`https://github.com/llvm/llvm-project/releases/download/${i.tag}/${i.name}`;const l=await gn(T.join(Jd,"llvm_org_releases.json")),u=_n(l,{version:r,keywords:n,optionalKeywords:o});if(u!==void 0)return`https://releases.llvm.org/${u.tag}/${u.name}`;throw new Error(`No asset found for version ${r} matching ${n} and ${o}`)}async function eR(e,t){const r=[],n=[];switch(e){case"win32":{n.push(".tar.xz",".tar.xz");const o=[];st.includes(t)?(o.push("win64"),n.push(["x86_64","X64"])):ur.includes(t)?o.push("win32"):ct.includes(t)?o.push("woa64"):(W(`Using arch ${t} for LLVM`),o.push(t)),o.push("windows","Windows"),r.push(o);break}case"linux":{const o=["linux","Linux"];if(ye()){n.push("ubuntu");const s=await Ft();if(s!==null){n.push(`${s[0]}`);const i=s[1]<10?`0${s[1]}`:`${s[1]}`;n.push(`${s[0]}.${i}`),n.push(`${s[0]}.${i}.${s[2]}`)}}else Le()&&n.push("rhel");st.includes(t)?r.push(["x86_64","X64"]):ur.includes(t)?r.push("x86"):ct.includes(t)?r.push("aarch64"):nb.includes(t)?r.push("armv7a"):ib.includes(t)?r.push("powerpc64le"):ob.includes(t)?r.push("sparc64"):(W(`Using arch ${t} for LLVM`),r.push(t)),r.push(o);break}case"darwin":{r.push(["apple","macos","macOS"]),st.includes(t)?n.push(["x86_64","X64"]):ct.includes(t)?n.push(["arm64","ARM64"]):(W(`Using arch ${t} for LLVM`),r.push(t));break}case"freebsd":{r.push("freebsd"),st.includes(t)?r.push("amd64"):ur.includes(t)?r.push("i386"):(W(`Using arch ${t} for LLVM`),r.push(t));break}case"solaris":{r.push("solaris"),st.includes(t)?r.push("amd64"):sb.includes(t)?r.push("sparcv9"):(W(`Using arch ${t} for LLVM`),r.push(t));break}default:W(`Using ${e} ${t} for LLVM`),r.push(e,t);break}return{keywords:r,optionalKeywords:n}}async function tR({version:e,setupDir:t,arch:r}){const n=await gt("llvm",e,Qb,t,r);return await nR(br(e),r),n}async function rR(e,t){if(ye())for(const r of["libtinfo5","libtinfo6"])try{await pe([{name:r}])}catch{try{if(r==="libtinfo5"){W(`Failed to install ${r}
Manually installing the package`);const o=`libtinfo5_6.3-2ubuntu0.1_${Jh(t)}.deb`,s=`https://launchpad.net/ubuntu/+archive/primary/+files/${o}`,i=new _r.DownloaderHelper(s,le.tmpdir(),{fileName:o});i.on("error",async l=>{W(`Failed to download ${s}: ${l}`),await i.stop()}),await i.start(),me("dpkg",["-i",T.join(le.tmpdir(),o)])}}catch{W(`Failed to install ${r}. Ignoring`)}}else Te()?await be("ncurses5-compat-libs",void 0,"yay"):Le()&&await Ne([{name:"ncurses-compat-libs"}])}const nR=Fe(rR,{promise:!0});async function iR({version:e}){if(process.platform!=="darwin")return Promise.resolve(void 0);try{return await oR({version:e})}catch(t){W(`Failed to install llvm via brew: ${t}`);return}}async function oR({version:e}){const t=br(e),r=await Me("llvm",`${t}`,{"force-bottle":!0});return await $e(r.binDir,ne),r}const{GITHUB_ACTIONS:sR}=Et,aR=typeof __dirname=="string"?__dirname:T.dirname(lt.fileURLToPath(typeof document>"u"?require("url").pathToFileURL(__filename).href:ge&&ge.tagName.toUpperCase()==="SCRIPT"&&ge.src||new URL("setup-cpp.js",document.baseURI).href));async function dn({version:e,setupDir:t,arch:r}){const n=await ic(e,t,r);return await uR(r),await fR(),n.installDir!==void 0&&await lR(n.installDir,e),n}async function ic(e,t,r,n=nc.All){const o=await Bb(e,n);if(o!==void 0)return o;const s=await Mb(e);if(s!==void 0)return s;const i=await iR({version:e});return i!==void 0?i:tR({version:e,setupDir:t,arch:r})}async function cR(e){process.platform==="linux"&&await En({version:nt("gcc",void 0,await Ft()),setupDir:"",arch:e,priority:40})}const uR=Fe(cR,{promise:!0});async function lR(e,t){var i,l;const r=(i=process.env.LD_LIBRARY_PATH)!=null?i:"",n=(l=process.env.DYLD_LIBRARY_PATH)!=null?l:"",o=br(t),s=[Pe("CC",Ee(`${e}/bin/clang`),ne),Pe("CXX",Ee(`${e}/bin/clang++`),ne),Pe("LLVM_PATH",e,ne),Pe("LLVM_LD_LIBRARY_PATH",`${r}${T.delimiter}${e}/lib`,ne),Pe("LLVM_DYLD_LIBRARY_PATH",`${n}${T.delimiter}${e}/lib`,ne),Pe("LLVM_LDFLAGS",`-L${Wd(`${e}/lib`)}`,ne),Pe("LLVM_CPPFLAGS",`-I${Wd(`${e}/include`)}`,ne),await we(`${e}/lib/clang/${t}/include`)?Pe("LLVM_CPATH",`${e}/lib/clang/${t}/include`,ne):await we(`${e}/lib/clang/${o}/include`)?Pe("LLVM_CPATH",`${e}/lib/clang/${o}/include`,ne):Promise.resolve(),Pe("LLVM_LIBRARY_PATH",`${e}/lib`,ne),Ph()];ye()&&s.push(wt("cc",`${e}/bin/clang`,ne,60),wt("cxx",`${e}/bin/clang++`,ne,60),wt("clang",`${e}/bin/clang`,ne),wt("clang++",`${e}/bin/clang++`,ne),wt("lld",`${e}/bin/lld`,ne),wt("ld.lld",`${e}/bin/ld.lld`,ne),wt("llvm-ar",`${e}/bin/llvm-ar`,ne)),await Promise.all(s)}async function fR(){if(!sR)return;const e=T.join(aR,"llvm_matcher.json");if(!await we(e))return ve("the llvm_matcher.json file does not exist in the same folder as setup-cpp.js");W(`::add-matcher::${e}`)}function Qd({version:e,setupDir:t,arch:r}){return ic(e,t,r,nc.ClangFormat)}function Zd({version:e,setupDir:t,arch:r}){return ic(e,t,r)}async function dR({version:e}={}){switch(process.platform){case"win32":return De("make",e);case"darwin":{await Me("make",e);const t=T.join(Wa(),"opt/make/libexec/gnubin");return await $e(t,ne),{binDir:t}}case"linux":{if(Te())return be("make",e);if(Le())return Ne([{name:"make",version:e}]);if(ye())return pe([{name:"make",version:e}]);if(await Ie())return ke([{name:"make",version:e}]);throw new Error("Unsupported linux distribution")}default:throw new Error("Unsupported platform")}}function pR({version:e}={}){return or("meson",e)}var Yt={},ep;function hR(){if(ep)return Yt;ep=1;const e=mr(),t=Nt,r=ae,n=T,o=at,s=o.env["ProgramFiles(x86)"],i=[o.env["ProgramFiles(x86)"],o.env.ProgramFiles],l=["Enterprise","Professional","Community","BuildTools"],u=["2022","2019","2017"],a={2022:"17.0",2019:"16.0",2017:"15.0",2015:"14.0",2013:"12.0"};function c(y){return Object.values(a).includes(y)?y:y in a?a[y]:y}Yt.vsversion_to_versionnumber=c;function m(y){if(Object.keys(a).includes(y))return y;for(const[w,S]of Object.entries(a))if(S===y)return w;return y}Yt.vsversion_to_year=m;const p=`${s}\\Microsoft Visual Studio\\Installer`;function v(y,w){try{return t.execSync(`vswhere -products * ${w} -prerelease -property in
`),A=Y[1].split(`\r
`),x=Y[2].split(`\r
`),F=A.filter(q=>!!(q.match(/^\[ERROR.*\]/)&&!q.match(/Error in script usage. The correct usage is:$/)));if(F.length>0)throw new Error(`invalid parameters\r
`+F.join(`\r
2025-07-10 22:11:16 +08:00
`));let U={};for(let q of Q){const[V,N]=q.split("=");U[V]=N}e.startGroup("Environment variables");for(let q of x){if(!q.includes("="))continue;let[V,N]=q.split("="),H=U[V];N!==H&&(e.info(`Setting ${V}`),d(V)&&(N=f(N)),e.exportVariable(V,N))}e.endGroup(),e.info("Configured Developer Command Prompt")}return Yt.setupMSVCDevCmd=h,Yt}var Sa=hR();function mR(e){switch(e){case"x32":case"32":case"ia32":return"x86";case"64":return"x64";default:return e}}async function oc({vsversion:e,VCTargetsPath:t,arch:r,toolset:n,sdk:o,uwp:s,spectre:i}){t!==void 0&&await we(t)&&(W(`Adding ${t} to PATH`),await Pe("VCTargetsPath",t,ne)),await Sa.setupMSVCDevCmd(mR(r),o,n,s,i,e)}const{GITHUB_ACTIONS:yR}=Et,wR=typeof __dirname=="string"?__dirname:T.dirname(lt.fileURLToPath(typeof document>"u"?require("url").pathToFileURL(__filename).href:ge&&ge.tagName.toUpperCase()==="SCRIPT"&&ge.src||new URL("setup-cpp.js",document.baseURI).href));async function Cr({version:e,setupDir:t,arch:r,sdk:n,uwp:o,spectre:s}){if(process.platform!=="win32")return;const i=Sa.vsversion_to_versionnumber(e);W(`Checking if MSVC ${i} is already installed`);let l=!1;try{const c=Sa.findVcvarsall(i);l=!0,W(`Found the pre-installed version of MSVC at ${c}`)}catch{}let u,a;if(!l)try{i==="14.0"?(u="14.0",await De("visualcpp-build-tools","14.0.25420.1",["--ignore-dependencies"]),a="C:/Program Files (x86)/MSBuild/Microsoft.Cpp/v4.0/v140"):i==="15.0"?(u="14.16",await De("visualstudio2017buildtools","15.9.41.0",[]),a="C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.16"):i==="16.0"?(u="14.29",await De("visualstudio2019buildtools","16.11.7.0",[]),a="C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133"):i==="17.0"?(u=void 0,await De("visualstudio2022buildtools","117.0.5.0",[]),a=void 0):Ae(`The given MSVC versions ${e} is not supported yet.`)}catch(c){Ae(c)}await oc({VCTargetsPath:a,arch:r,toolset:u,sdk:n,uwp:o,spectre:s}),yR&&await vR()}async function vR(){const e=T.join(wR,"msvc_matcher.json");if(!await we(e))return ve("the msvc_matcher.json file does not exist in the same folder as setup-cpp.js");W(`::add-matcher::${e}`)}async function tp({version:e}={}){return process.platform!=="win32"?void 0:(await De("opencppcoverage",e),{binDir:await gR()})}async function gR(){const e="C:/Program Files/OpenCppCoverage";return await $e(e,ne),e}function _R(e,t,r){return{url:ER(t,r,e),binRelativeDir:"",binFileName:Ee("pwsh"),extractedFolderName:""}}function ER(e,t,r){var n;switch(e){case"win32":{const o=["ia32","x86","i386","x32"].includes(t)?"win-x86":"win-x64";return`https://github.com/PowerShell/PowerShell/releases/download/v${r}/PowerShell-${r}-${o}.zip`}case"darwin":{const o=["arm","arm64"].includes(t)?"osx-arm64":"osx-x64";return`https://github.com/PowerShell/PowerShell/releases/download/v${r}/powershell-${r}-${o}.tar.gz`}case"linux":{const s=(n={arm64:"linux-arm64",arm:"linux-arm64",arm32:"linux-arm32",aarch64:"linux-arm64",x64:"linux-x64"}[t])!=null?n:"linux-x64";return`https://github.com/PowerShell/PowerShell/releases/download/v${r}/powershell-${r}-${s}.tar.gz`}default:throw new Error(`Unsupported platform '${e}'`)}}async function rp({version:e,setupDir:t,arch:r}){try{return await Ie()?np({version:e}):await gt("pwsh",e,_R,t,r)}catch(n){return Ae(`Failed to setup pwsh via download: ${n}. Trying package managers...`),np({version:e})}}async function np({version:e}={}){switch(process.platform){case"win32":{await De("powershell-core",e);const t="C:/Program Files/PowerShell/7";return await $e(t,ne),{binDir:t}}case"darwin":return Me("powershell",e,{cask:!0,overwrite:!1});case"linux":{if(Te())return be("powershell-bin",e,"yay");if(Le())return await Ne([{name:"curl"}]),me("/bin/bash",["-c","curl https://packages.microsoft.com/config/rhel/8/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo"]),Ne([{name:"powershell",version:e}]);if(ye()){await pe([{name:"curl"}]);const t=await Ft(),r=`${t[0]}.0${t[1]}`;return me("curl",["-LJO",`https://packages.microsoft.com/config/ubuntu/${r}/packages-microsoft-prod.deb`]),me("dpkg",["-i","packages
- The installation directory is ${t.installDir}`),t.binDir!==""&&(r+=`
2025-07-10 22:11:16 +08:00
- The binary directory is ${t.binDir}`)),r}const CR=/[.-]((?:\d{4}|\d+(?:\.\d+)*(?:-[\w.-]+)?(?:\+[\w.-]+)?)$)/;function AR(e){try{const t=e.match(CR);if(t===null)return{compiler:e,version:void 0};const r=t[1],n=e.slice(0,t.index).replace(/[.-]$/,"");return!r.match(/^\d{4}$/)&&kn(r)===null&&W(`Non-semver version format: ${r}`),{compiler:n,version:r}}catch(t){return Ae(`Failed to parse the compiler info ${e}: ${t}`),{compiler:e,version:void 0}}}async function NR(e,t,r,n,o,s,i){var u;let l;try{if(Se.startGroup(`Installing ${e} ${t!=null?t:""}`),e in tm)l=await dn({version:nt("llvm",t,r),setupDir:T.join(n,"llvm"),arch:o}),await rb();else if(e in rm){const a=nt("gcc",t,r);l=await En({version:a,setupDir:T.join(n,"gcc"),arch:o}),await Yd(a)}else if(e in nm){const a=nt("mingw",t,r);l=await ec({version:a,setupDir:T.join(n,"gcc"),arch:o}),await Yd(a)}else e in im?l=await Cr({version:nt("msvc",t,r),setupDir:T.join(n,"msvc"),arch:o}):e in om?await xr():(l=null,i.push(`Unsupported compiler ${e}`))}catch(a){Ae(a),a instanceof Error&&Ae((u=a.stack)!=null?u:""),i.push(`Failed to install the ${e} compiler ${t}`)}l!==null&&s.push(lm(e,l)),Se.endGroup()}async function LR(e,t="npm"){try{return await de("setup-cpp",{nothrow:!0})!==null?`setup-cpp@${e} already installed`:(W(`Installing setup-cpp@${e} via ${t}...`),await fe(t,["install","-g",`setup-cpp@${e}`],{stdio:"inherit",timeout:1e3*60*1}),`setup-cpp@${e} installed successfully`)}catch(r){return new Error(`Failed to install the setup-cpp@${e} CLI: ${r}. Ignoring...`)}}async function DR(e={}){var E,d;const t=(E=e.architecture)!=null?E:process.arch,r=(d=process.env.SETUP_CPP_DIR)!=null?d:rt("~"),n=[],o=[],s=Uf.create({autoloadLocales:!0});Uf.addLocale($_),y_.addLocale(g_);let i,l;const u=await Ft(),a=e.compiler!==void 0?AR(e.compiler):void 0;if(!$S(e,[...sm,"compiler"],a))return{successMessages:[],errorMessages:["The same version must be used for llvm, clang-format and clang-tidy"]};Te()&&typeof e.cppcheck=="string"&&typeof e.gcovr=="string"&&(W("installing python-pygments to avoid conflicts with cppcheck and gcovr on Arch linux"),await be("python-pygments"));const c=cm.filter(f=>{const h=e[f];return h!==void 0&&h!=="false"}),m=e["setup-cpp"]===void 0||e["setup-cpp"]?LR(xa.version,e["node-package-manager"]):Promise.resolve(void 0);let p=!1;for(const f of c){const h=e[f],y=e.timeout!==void 0?Number.parseFloat(e.timeout)*60*1e3:void 0;if(i=Date.now(),await TR(f,h,u,t,r,n,o,y),l=Date.now(),W(`took ${s.format(i,l)||"0 seconds"}`),o.length!==0&&hn.isCI){p=!0;break}}if(!p&&a!==void 0){const f=Date.now();await NR(a.compiler,a.version,u,r,t,n,o);const h=Date.now();W(`took ${s.format(f,h)||"0 seconds"}`)}const v=await m;return typeof v=="string"&&n.push(v),await Zg(ne),{successMessages:n,errorMessages:o}}async function kR(e){const t=hn.GITHUB_ACTIONS?Promise.resolve():qR(),r=fm(e);if(r.help)return FR(),0;if(r.version)return W(`${xa.version}`),0;const{successMessages:n,errorMessages:o}=await DR(r);for(const s of n)$y(s);for(const s of o)Ae(s);if((n.length!==0||o.length!==0)&&(W("setup-cpp finished"),!hn.GITHUB_ACTIONS))switch(process.platform){case"win32":{ve("Run `RefreshEnv.cmd` or restart your shell to update the environment.");break}case"linux":case"darwin":{ve("Run `source ~/.cpprc` or restart your shell to update the environment.");break}}return await t,o.length===0?0:1}async function qR(){try{await ty({pkg:xa})}catch(e){ve(`Failed to check for updates: ${e instanceof Error?e.message+e.stack:e}`)}}function fm(e){const t=Object.fromEntries(op.map(r=>[r,Sp(r)]));return Cm(e,{string:[...op,"timeout","node-package-manager"],default:t,alias:{h:"help",v:"version"},boolean:["help","version","setup-cpp"]})}function FR(){W(`
setup-cpp [options]
setup-cpp --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
Install all the tools required for building and testing C++/C projects.
--architecture the cpu architecture to install the tools for. By default it uses the current CPU architecture.
--timeout the timeout for the installation of each tool in minutes. By default it is 10 minutes.
--compiler the <compiler> to install.
You can specify the version instead of specifying just the name e.g: --compiler 'llvm-13.0.0'
--tool_name pass "true" or pass the <version> you would like to install for this tool. e.g. --conan true or --conan "1.42.1"
--nodePackageManager the node package manager to use (npm/yarn/pnpm) when installing setup-cpp globally
--help show this help message
--version show the version of setup-cpp
All the available tools:
2025-07-10 22:11:16 +08:00
`),console.table({"compiler and analyzer":{tools:"--llvm, --gcc, --msvc, --apple-clang, --vcvarsall"},"build system":{tools:"--cmake, --ninja, --meson, --make, --task, --bazel"},"package manager":{tools:"--vcpkg, --conan, --choco, --brew, --apt-fast, --nala, --git, --setup-cpp"},"analyzer/linter":{tools:"--clang-tidy, --clang-format, --cppcheck, --cpplint, --flawfinder, --lizard, --infer, , --cmakelang, --cmake-lint, --cmake-format"},cache:{tools:"--ccache, --sccache"},documentation:{tools:"--doxygen, --graphviz"},coverage:{tools:"--gcovr, --opencppcoverage, --kcov"},other:{tools:"--python, --powershell, --sevenzip, --tar"}},["tools"])}process.env.SETUP_CPP_SKIP_MAIN!=="true"&&kR(process.argv).then(e=>{process.exitCode=e}).catch(e=>{Ae("main() panicked!"),Ae(e),process.exitCode=1});exports.HttpClient=vp;exports.ciInfo=Et;exports.commonjsGlobal=et;exports.coreExports=Se;exports.execExports=qn;exports.getAugmentedNamespace=$n;exports.getDefaultExportFromCjs=Oe;exports.info=W;exports.parseArgs=fm;exports.pathExists=we;exports.require$$13=Aa;exports.requireSemver=yp;exports.toolCacheExports=jn;exports.warning=ve;
2025-04-07 21:21:56 +08:00
//# sourceMappingURL=setup-cpp.js.map