@r5n/hydra 0.3.6 → 0.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/cli.js +52 -52
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
<a href="https://github.com/r5n-labs">
|
|
3
|
-
<img src="https://avatars.githubusercontent.com/u/
|
|
3
|
+
<img src="https://avatars.githubusercontent.com/u/99986752?s=400&v=4" alt="R5N Labs" width="100" height="100">
|
|
4
4
|
</a>
|
|
5
5
|
|
|
6
6
|
<h1>Hydra</h1>
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
<a href="https://github.com/r5n-labs/clis/blob/main/packages/hydra/LICENSE">
|
|
14
14
|
<img src="https://img.shields.io/badge/license-Apache%202.0-blue.svg" alt="License">
|
|
15
15
|
</a>
|
|
16
|
-
<img src="https://img.shields.io/badge/bundle%20size-~
|
|
16
|
+
<img src="https://img.shields.io/badge/bundle%20size-~73KB-green.svg" alt="Bundle Size">
|
|
17
17
|
</p>
|
|
18
18
|
</div>
|
|
19
19
|
|
|
@@ -28,7 +28,7 @@ Hydra is a powerful CLI tool for managing multiple GitHub self-hosted runners lo
|
|
|
28
28
|
- 🚀 **Parallel Runner Management** - Create and manage multiple runners simultaneously using Web Workers
|
|
29
29
|
- 🔧 **Profile-Based Configuration** - Store and reuse configurations with JSON/TOML support
|
|
30
30
|
- 📊 **Real-Time Status Monitoring** - Check runner status with formatted or JSON output
|
|
31
|
-
- 🏃 **Zero Runtime Dependencies** - Fully bundled (~
|
|
31
|
+
- 🏃 **Zero Runtime Dependencies** - Fully bundled (~73KB) for optimal performance
|
|
32
32
|
- 🎯 **Cross-Platform Support** - Works on macOS, Linux, and Windows
|
|
33
33
|
|
|
34
34
|
## 📦 Installation
|
package/dist/cli.js
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
var Zt=Object.create;var{getPrototypeOf:Vt,defineProperty:Jn,getOwnPropertyNames:Ft}=Object;var Dt=Object.prototype.hasOwnProperty;var gn=(t,r,o)=>{o=t!=null?Zt(Vt(t)):{};let e=r||!t||!t.__esModule?Jn(o,"default",{value:t,enumerable:!0}):o;for(let i of Ft(t))if(!Dt.call(e,i))Jn(e,i,{get:()=>t[i],enumerable:!0});return e};var Yn=(t,r)=>()=>(r||t((r={exports:{}}).exports,r),r.exports);var kn=Yn((Mo,Qn)=>{var Tn={to(t,r){if(!r)return`\x1B[${t+1}G`;return`\x1B[${r+1};${t+1}H`},move(t,r){let o="";if(t<0)o+=`\x1B[${-t}D`;else if(t>0)o+=`\x1B[${t}C`;if(r<0)o+=`\x1B[${-r}A`;else if(r>0)o+=`\x1B[${r}B`;return o},up:(t=1)=>`\x1B[${t}A`,down:(t=1)=>`\x1B[${t}B`,forward:(t=1)=>`\x1B[${t}C`,backward:(t=1)=>`\x1B[${t}D`,nextLine:(t=1)=>"\x1B[E".repeat(t),prevLine:(t=1)=>"\x1B[F".repeat(t),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},nr={up:(t=1)=>"\x1B[S".repeat(t),down:(t=1)=>"\x1B[T".repeat(t)},tr={screen:"\x1B[2J",up:(t=1)=>"\x1B[1J".repeat(t),down:(t=1)=>"\x1B[J".repeat(t),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(t){let r="";for(let o=0;o<t;o++)r+=this.line+(o<t-1?Tn.up():"");if(t)r+=Tn.left;return r}};Qn.exports={cursor:Tn,scroll:nr,erase:tr,beep:"\x07"}});var vn=Yn((Xo,Nn)=>{var hn=process||{},Zn=hn.argv||[],un=hn.env||{},rr=!(!!un.NO_COLOR||Zn.includes("--no-color"))&&(!!un.FORCE_COLOR||Zn.includes("--color")||hn.platform==="win32"||(hn.stdout||{}).isTTY&&un.TERM!=="dumb"||!!un.CI),or=(t,r,o=t)=>(e)=>{let i=""+e,s=i.indexOf(r,t.length);return~s?t+er(i,r,o,s)+r:t+i+r},er=(t,r,o,e)=>{let i="",s=0;do i+=t.substring(s,e)+o,s=e+r.length,e=t.indexOf(r,s);while(~e);return i+t.substring(s)},Vn=(t=rr)=>{let r=t?or:()=>String;return{isColorSupported:t,reset:r("\x1B[0m","\x1B[0m"),bold:r("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:r("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:r("\x1B[3m","\x1B[23m"),underline:r("\x1B[4m","\x1B[24m"),inverse:r("\x1B[7m","\x1B[27m"),hidden:r("\x1B[8m","\x1B[28m"),strikethrough:r("\x1B[9m","\x1B[29m"),black:r("\x1B[30m","\x1B[39m"),red:r("\x1B[31m","\x1B[39m"),green:r("\x1B[32m","\x1B[39m"),yellow:r("\x1B[33m","\x1B[39m"),blue:r("\x1B[34m","\x1B[39m"),magenta:r("\x1B[35m","\x1B[39m"),cyan:r("\x1B[36m","\x1B[39m"),white:r("\x1B[37m","\x1B[39m"),gray:r("\x1B[90m","\x1B[39m"),bgBlack:r("\x1B[40m","\x1B[49m"),bgRed:r("\x1B[41m","\x1B[49m"),bgGreen:r("\x1B[42m","\x1B[49m"),bgYellow:r("\x1B[43m","\x1B[49m"),bgBlue:r("\x1B[44m","\x1B[49m"),bgMagenta:r("\x1B[45m","\x1B[49m"),bgCyan:r("\x1B[46m","\x1B[49m"),bgWhite:r("\x1B[47m","\x1B[49m"),blackBright:r("\x1B[90m","\x1B[39m"),redBright:r("\x1B[91m","\x1B[39m"),greenBright:r("\x1B[92m","\x1B[39m"),yellowBright:r("\x1B[93m","\x1B[39m"),blueBright:r("\x1B[94m","\x1B[39m"),magentaBright:r("\x1B[95m","\x1B[39m"),cyanBright:r("\x1B[96m","\x1B[39m"),whiteBright:r("\x1B[97m","\x1B[39m"),bgBlackBright:r("\x1B[100m","\x1B[49m"),bgRedBright:r("\x1B[101m","\x1B[49m"),bgGreenBright:r("\x1B[102m","\x1B[49m"),bgYellowBright:r("\x1B[103m","\x1B[49m"),bgBlueBright:r("\x1B[104m","\x1B[49m"),bgMagentaBright:r("\x1B[105m","\x1B[49m"),bgCyanBright:r("\x1B[106m","\x1B[49m"),bgWhiteBright:r("\x1B[107m","\x1B[49m")}};Nn.exports=Vn();Nn.exports.createColors=Vn});var S=gn(kn(),1),at=gn(vn(),1);import{stdin as it,stdout as st}from"process";import*as j from"readline";import Fn from"readline";import{Writable as ir}from"stream";function sr({onlyFirst:t=!1}={}){let r=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(r,t?void 0:"g")}var ar=sr();function ct(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(ar,"")}function ft(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var mt={exports:{}};(function(t){var r={};t.exports=r,r.eastAsianWidth=function(e){var i=e.charCodeAt(0),s=e.length==2?e.charCodeAt(1):0,n=i;return 55296<=i&&i<=56319&&56320<=s&&s<=57343&&(i&=1023,s&=1023,n=i<<10|s,n+=65536),n==12288||65281<=n&&n<=65376||65504<=n&&n<=65510?"F":n==8361||65377<=n&&n<=65470||65474<=n&&n<=65479||65482<=n&&n<=65487||65490<=n&&n<=65495||65498<=n&&n<=65500||65512<=n&&n<=65518?"H":4352<=n&&n<=4447||4515<=n&&n<=4519||4602<=n&&n<=4607||9001<=n&&n<=9002||11904<=n&&n<=11929||11931<=n&&n<=12019||12032<=n&&n<=12245||12272<=n&&n<=12283||12289<=n&&n<=12350||12353<=n&&n<=12438||12441<=n&&n<=12543||12549<=n&&n<=12589||12593<=n&&n<=12686||12688<=n&&n<=12730||12736<=n&&n<=12771||12784<=n&&n<=12830||12832<=n&&n<=12871||12880<=n&&n<=13054||13056<=n&&n<=19903||19968<=n&&n<=42124||42128<=n&&n<=42182||43360<=n&&n<=43388||44032<=n&&n<=55203||55216<=n&&n<=55238||55243<=n&&n<=55291||63744<=n&&n<=64255||65040<=n&&n<=65049||65072<=n&&n<=65106||65108<=n&&n<=65126||65128<=n&&n<=65131||110592<=n&&n<=110593||127488<=n&&n<=127490||127504<=n&&n<=127546||127552<=n&&n<=127560||127568<=n&&n<=127569||131072<=n&&n<=194367||177984<=n&&n<=196605||196608<=n&&n<=262141?"W":32<=n&&n<=126||162<=n&&n<=163||165<=n&&n<=166||n==172||n==175||10214<=n&&n<=10221||10629<=n&&n<=10630?"Na":n==161||n==164||167<=n&&n<=168||n==170||173<=n&&n<=174||176<=n&&n<=180||182<=n&&n<=186||188<=n&&n<=191||n==198||n==208||215<=n&&n<=216||222<=n&&n<=225||n==230||232<=n&&n<=234||236<=n&&n<=237||n==240||242<=n&&n<=243||247<=n&&n<=250||n==252||n==254||n==257||n==273||n==275||n==283||294<=n&&n<=295||n==299||305<=n&&n<=307||n==312||319<=n&&n<=322||n==324||328<=n&&n<=331||n==333||338<=n&&n<=339||358<=n&&n<=359||n==363||n==462||n==464||n==466||n==468||n==470||n==472||n==474||n==476||n==593||n==609||n==708||n==711||713<=n&&n<=715||n==717||n==720||728<=n&&n<=731||n==733||n==735||768<=n&&n<=879||913<=n&&n<=929||931<=n&&n<=937||945<=n&&n<=961||963<=n&&n<=969||n==1025||1040<=n&&n<=1103||n==1105||n==8208||8211<=n&&n<=8214||8216<=n&&n<=8217||8220<=n&&n<=8221||8224<=n&&n<=8226||8228<=n&&n<=8231||n==8240||8242<=n&&n<=8243||n==8245||n==8251||n==8254||n==8308||n==8319||8321<=n&&n<=8324||n==8364||n==8451||n==8453||n==8457||n==8467||n==8470||8481<=n&&n<=8482||n==8486||n==8491||8531<=n&&n<=8532||8539<=n&&n<=8542||8544<=n&&n<=8555||8560<=n&&n<=8569||n==8585||8592<=n&&n<=8601||8632<=n&&n<=8633||n==8658||n==8660||n==8679||n==8704||8706<=n&&n<=8707||8711<=n&&n<=8712||n==8715||n==8719||n==8721||n==8725||n==8730||8733<=n&&n<=8736||n==8739||n==8741||8743<=n&&n<=8748||n==8750||8756<=n&&n<=8759||8764<=n&&n<=8765||n==8776||n==8780||n==8786||8800<=n&&n<=8801||8804<=n&&n<=8807||8810<=n&&n<=8811||8814<=n&&n<=8815||8834<=n&&n<=8835||8838<=n&&n<=8839||n==8853||n==8857||n==8869||n==8895||n==8978||9312<=n&&n<=9449||9451<=n&&n<=9547||9552<=n&&n<=9587||9600<=n&&n<=9615||9618<=n&&n<=9621||9632<=n&&n<=9633||9635<=n&&n<=9641||9650<=n&&n<=9651||9654<=n&&n<=9655||9660<=n&&n<=9661||9664<=n&&n<=9665||9670<=n&&n<=9672||n==9675||9678<=n&&n<=9681||9698<=n&&n<=9701||n==9711||9733<=n&&n<=9734||n==9737||9742<=n&&n<=9743||9748<=n&&n<=9749||n==9756||n==9758||n==9792||n==9794||9824<=n&&n<=9825||9827<=n&&n<=9829||9831<=n&&n<=9834||9836<=n&&n<=9837||n==9839||9886<=n&&n<=9887||9918<=n&&n<=9919||9924<=n&&n<=9933||9935<=n&&n<=9953||n==9955||9960<=n&&n<=9983||n==10045||n==10071||10102<=n&&n<=10111||11093<=n&&n<=11097||12872<=n&&n<=12879||57344<=n&&n<=63743||65024<=n&&n<=65039||n==65533||127232<=n&&n<=127242||127248<=n&&n<=127277||127280<=n&&n<=127337||127344<=n&&n<=127386||917760<=n&&n<=917999||983040<=n&&n<=1048573||1048576<=n&&n<=1114109?"A":"N"},r.characterLength=function(e){var i=this.eastAsianWidth(e);return i=="F"||i=="W"||i=="A"?2:1};function o(e){return e.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}r.length=function(e){for(var i=o(e),s=0,n=0;n<i.length;n++)s=s+this.characterLength(i[n]);return s},r.slice=function(e,i,s){textLen=r.length(e),i=i||0,s=s||1,i<0&&(i=textLen+i),s<0&&(s=textLen+s);for(var n="",a=0,c=o(e),l=0;l<c.length;l++){var f=c[l],m=r.length(f);if(a>=i-(m==2?1:0))if(a+m<=s)n+=f;else break;a+=m}return n}})(mt);var cr=mt.exports,fr=ft(cr),mr=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\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80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A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\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},lr=ft(mr);function en(t,r={}){if(typeof t!="string"||t.length===0||(r={ambiguousIsNarrow:!0,...r},t=ct(t),t.length===0))return 0;t=t.replace(lr()," ");let o=r.ambiguousIsNarrow?1:2,e=0;for(let i of t){let s=i.codePointAt(0);if(s<=31||s>=127&&s<=159||s>=768&&s<=879)continue;switch(fr.eastAsianWidth(i)){case"F":case"W":e+=2;break;case"A":e+=o;break;default:e+=1}}return e}var Pn=10,Dn=(t=0)=>(r)=>`\x1B[${r+t}m`,nt=(t=0)=>(r)=>`\x1B[${38+t};5;${r}m`,tt=(t=0)=>(r,o,e)=>`\x1B[${38+t};2;${r};${o};${e}m`,x={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(x.modifier);var pr=Object.keys(x.color),gr=Object.keys(x.bgColor);[...pr];function ur(){let t=new Map;for(let[r,o]of Object.entries(x)){for(let[e,i]of Object.entries(o))x[e]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},o[e]=x[e],t.set(i[0],i[1]);Object.defineProperty(x,r,{value:o,enumerable:!1})}return Object.defineProperty(x,"codes",{value:t,enumerable:!1}),x.color.close="\x1B[39m",x.bgColor.close="\x1B[49m",x.color.ansi=Dn(),x.color.ansi256=nt(),x.color.ansi16m=tt(),x.bgColor.ansi=Dn(Pn),x.bgColor.ansi256=nt(Pn),x.bgColor.ansi16m=tt(Pn),Object.defineProperties(x,{rgbToAnsi256:{value:(r,o,e)=>r===o&&o===e?r<8?16:r>248?231:Math.round((r-8)/247*24)+232:16+36*Math.round(r/255*5)+6*Math.round(o/255*5)+Math.round(e/255*5),enumerable:!1},hexToRgb:{value:(r)=>{let o=/[a-f\d]{6}|[a-f\d]{3}/i.exec(r.toString(16));if(!o)return[0,0,0];let[e]=o;e.length===3&&(e=[...e].map((s)=>s+s).join(""));let i=Number.parseInt(e,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:(r)=>x.rgbToAnsi256(...x.hexToRgb(r)),enumerable:!1},ansi256ToAnsi:{value:(r)=>{if(r<8)return 30+r;if(r<16)return 90+(r-8);let o,e,i;if(r>=232)o=((r-232)*10+8)/255,e=o,i=o;else{r-=16;let a=r%36;o=Math.floor(r/36)/5,e=Math.floor(a/6)/5,i=a%6/5}let s=Math.max(o,e,i)*2;if(s===0)return 30;let n=30+(Math.round(i)<<2|Math.round(e)<<1|Math.round(o));return s===2&&(n+=60),n},enumerable:!1},rgbToAnsi:{value:(r,o,e)=>x.ansi256ToAnsi(x.rgbToAnsi256(r,o,e)),enumerable:!1},hexToAnsi:{value:(r)=>x.ansi256ToAnsi(x.hexToAnsi256(r)),enumerable:!1}}),x}var hr=ur(),yn=new Set(["\x1B","\x9B"]),dr=39,Xn="\x07",lt="[",br="]",pt="m",_n=`${br}8;;`,rt=(t)=>`${yn.values().next().value}${lt}${t}${pt}`,ot=(t)=>`${yn.values().next().value}${_n}${t}${Xn}`,yr=(t)=>t.split(" ").map((r)=>en(r)),Gn=(t,r,o)=>{let e=[...r],i=!1,s=!1,n=en(ct(t[t.length-1]));for(let[a,c]of e.entries()){let l=en(c);if(n+l<=o?t[t.length-1]+=c:(t.push(c),n=0),yn.has(c)&&(i=!0,s=e.slice(a+1).join("").startsWith(_n)),i){s?c===Xn&&(i=!1,s=!1):c===pt&&(i=!1);continue}n+=l,n===o&&a<e.length-1&&(t.push(""),n=0)}!n&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())},xr=(t)=>{let r=t.split(" "),o=r.length;for(;o>0&&!(en(r[o-1])>0);)o--;return o===r.length?t:r.slice(0,o).join(" ")+r.slice(o).join("")},$r=(t,r,o={})=>{if(o.trim!==!1&&t.trim()==="")return"";let e="",i,s,n=yr(t),a=[""];for(let[l,f]of t.split(" ").entries()){o.trim!==!1&&(a[a.length-1]=a[a.length-1].trimStart());let m=en(a[a.length-1]);if(l!==0&&(m>=r&&(o.wordWrap===!1||o.trim===!1)&&(a.push(""),m=0),(m>0||o.trim===!1)&&(a[a.length-1]+=" ",m++)),o.hard&&n[l]>r){let p=r-m,d=1+Math.floor((n[l]-p-1)/r);Math.floor((n[l]-1)/r)<d&&a.push(""),Gn(a,f,r);continue}if(m+n[l]>r&&m>0&&n[l]>0){if(o.wordWrap===!1&&m<r){Gn(a,f,r);continue}a.push("")}if(m+n[l]>r&&o.wordWrap===!1){Gn(a,f,r);continue}a[a.length-1]+=f}o.trim!==!1&&(a=a.map((l)=>xr(l)));let c=[...a.join(`
|
|
3
|
-
`)];for(let[l,f]of c.entries()){if(e+=f,
|
|
4
|
-
`?(s&&(e+=
|
|
5
|
-
`&&(i&&m&&(e+=
|
|
2
|
+
var Vt=Object.create;var{getPrototypeOf:Ft,defineProperty:Yn,getOwnPropertyNames:Dt}=Object;var nr=Object.prototype.hasOwnProperty;var un=(t,r,o)=>{o=t!=null?Vt(Ft(t)):{};let e=r||!t||!t.__esModule?Yn(o,"default",{value:t,enumerable:!0}):o;for(let i of Dt(t))if(!nr.call(e,i))Yn(e,i,{get:()=>t[i],enumerable:!0});return e};var Qn=(t,r)=>()=>(r||t((r={exports:{}}).exports,r),r.exports);var Nn=Qn((Xo,Zn)=>{var kn={to(t,r){if(!r)return`\x1B[${t+1}G`;return`\x1B[${r+1};${t+1}H`},move(t,r){let o="";if(t<0)o+=`\x1B[${-t}D`;else if(t>0)o+=`\x1B[${t}C`;if(r<0)o+=`\x1B[${-r}A`;else if(r>0)o+=`\x1B[${r}B`;return o},up:(t=1)=>`\x1B[${t}A`,down:(t=1)=>`\x1B[${t}B`,forward:(t=1)=>`\x1B[${t}C`,backward:(t=1)=>`\x1B[${t}D`,nextLine:(t=1)=>"\x1B[E".repeat(t),prevLine:(t=1)=>"\x1B[F".repeat(t),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},tr={up:(t=1)=>"\x1B[S".repeat(t),down:(t=1)=>"\x1B[T".repeat(t)},rr={screen:"\x1B[2J",up:(t=1)=>"\x1B[1J".repeat(t),down:(t=1)=>"\x1B[J".repeat(t),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(t){let r="";for(let o=0;o<t;o++)r+=this.line+(o<t-1?kn.up():"");if(t)r+=kn.left;return r}};Zn.exports={cursor:kn,scroll:tr,erase:rr,beep:"\x07"}});var Pn=Qn((_o,vn)=>{var hn=process||{},Vn=hn.argv||[],dn=hn.env||{},or=!(!!dn.NO_COLOR||Vn.includes("--no-color"))&&(!!dn.FORCE_COLOR||Vn.includes("--color")||hn.platform==="win32"||(hn.stdout||{}).isTTY&&dn.TERM!=="dumb"||!!dn.CI),er=(t,r,o=t)=>(e)=>{let i=""+e,s=i.indexOf(r,t.length);return~s?t+ir(i,r,o,s)+r:t+i+r},ir=(t,r,o,e)=>{let i="",s=0;do i+=t.substring(s,e)+o,s=e+r.length,e=t.indexOf(r,s);while(~e);return i+t.substring(s)},Fn=(t=or)=>{let r=t?er:()=>String;return{isColorSupported:t,reset:r("\x1B[0m","\x1B[0m"),bold:r("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:r("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:r("\x1B[3m","\x1B[23m"),underline:r("\x1B[4m","\x1B[24m"),inverse:r("\x1B[7m","\x1B[27m"),hidden:r("\x1B[8m","\x1B[28m"),strikethrough:r("\x1B[9m","\x1B[29m"),black:r("\x1B[30m","\x1B[39m"),red:r("\x1B[31m","\x1B[39m"),green:r("\x1B[32m","\x1B[39m"),yellow:r("\x1B[33m","\x1B[39m"),blue:r("\x1B[34m","\x1B[39m"),magenta:r("\x1B[35m","\x1B[39m"),cyan:r("\x1B[36m","\x1B[39m"),white:r("\x1B[37m","\x1B[39m"),gray:r("\x1B[90m","\x1B[39m"),bgBlack:r("\x1B[40m","\x1B[49m"),bgRed:r("\x1B[41m","\x1B[49m"),bgGreen:r("\x1B[42m","\x1B[49m"),bgYellow:r("\x1B[43m","\x1B[49m"),bgBlue:r("\x1B[44m","\x1B[49m"),bgMagenta:r("\x1B[45m","\x1B[49m"),bgCyan:r("\x1B[46m","\x1B[49m"),bgWhite:r("\x1B[47m","\x1B[49m"),blackBright:r("\x1B[90m","\x1B[39m"),redBright:r("\x1B[91m","\x1B[39m"),greenBright:r("\x1B[92m","\x1B[39m"),yellowBright:r("\x1B[93m","\x1B[39m"),blueBright:r("\x1B[94m","\x1B[39m"),magentaBright:r("\x1B[95m","\x1B[39m"),cyanBright:r("\x1B[96m","\x1B[39m"),whiteBright:r("\x1B[97m","\x1B[39m"),bgBlackBright:r("\x1B[100m","\x1B[49m"),bgRedBright:r("\x1B[101m","\x1B[49m"),bgGreenBright:r("\x1B[102m","\x1B[49m"),bgYellowBright:r("\x1B[103m","\x1B[49m"),bgBlueBright:r("\x1B[104m","\x1B[49m"),bgMagentaBright:r("\x1B[105m","\x1B[49m"),bgCyanBright:r("\x1B[106m","\x1B[49m"),bgWhiteBright:r("\x1B[107m","\x1B[49m")}};vn.exports=Fn();vn.exports.createColors=Fn});var C=un(Nn(),1),ct=un(Pn(),1);import{stdin as st,stdout as at}from"process";import*as W from"readline";import Dn from"readline";import{Writable as sr}from"stream";function ar({onlyFirst:t=!1}={}){let r=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(r,t?void 0:"g")}var cr=ar();function ft(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(cr,"")}function mt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var lt={exports:{}};(function(t){var r={};t.exports=r,r.eastAsianWidth=function(e){var i=e.charCodeAt(0),s=e.length==2?e.charCodeAt(1):0,n=i;return 55296<=i&&i<=56319&&56320<=s&&s<=57343&&(i&=1023,s&=1023,n=i<<10|s,n+=65536),n==12288||65281<=n&&n<=65376||65504<=n&&n<=65510?"F":n==8361||65377<=n&&n<=65470||65474<=n&&n<=65479||65482<=n&&n<=65487||65490<=n&&n<=65495||65498<=n&&n<=65500||65512<=n&&n<=65518?"H":4352<=n&&n<=4447||4515<=n&&n<=4519||4602<=n&&n<=4607||9001<=n&&n<=9002||11904<=n&&n<=11929||11931<=n&&n<=12019||12032<=n&&n<=12245||12272<=n&&n<=12283||12289<=n&&n<=12350||12353<=n&&n<=12438||12441<=n&&n<=12543||12549<=n&&n<=12589||12593<=n&&n<=12686||12688<=n&&n<=12730||12736<=n&&n<=12771||12784<=n&&n<=12830||12832<=n&&n<=12871||12880<=n&&n<=13054||13056<=n&&n<=19903||19968<=n&&n<=42124||42128<=n&&n<=42182||43360<=n&&n<=43388||44032<=n&&n<=55203||55216<=n&&n<=55238||55243<=n&&n<=55291||63744<=n&&n<=64255||65040<=n&&n<=65049||65072<=n&&n<=65106||65108<=n&&n<=65126||65128<=n&&n<=65131||110592<=n&&n<=110593||127488<=n&&n<=127490||127504<=n&&n<=127546||127552<=n&&n<=127560||127568<=n&&n<=127569||131072<=n&&n<=194367||177984<=n&&n<=196605||196608<=n&&n<=262141?"W":32<=n&&n<=126||162<=n&&n<=163||165<=n&&n<=166||n==172||n==175||10214<=n&&n<=10221||10629<=n&&n<=10630?"Na":n==161||n==164||167<=n&&n<=168||n==170||173<=n&&n<=174||176<=n&&n<=180||182<=n&&n<=186||188<=n&&n<=191||n==198||n==208||215<=n&&n<=216||222<=n&&n<=225||n==230||232<=n&&n<=234||236<=n&&n<=237||n==240||242<=n&&n<=243||247<=n&&n<=250||n==252||n==254||n==257||n==273||n==275||n==283||294<=n&&n<=295||n==299||305<=n&&n<=307||n==312||319<=n&&n<=322||n==324||328<=n&&n<=331||n==333||338<=n&&n<=339||358<=n&&n<=359||n==363||n==462||n==464||n==466||n==468||n==470||n==472||n==474||n==476||n==593||n==609||n==708||n==711||713<=n&&n<=715||n==717||n==720||728<=n&&n<=731||n==733||n==735||768<=n&&n<=879||913<=n&&n<=929||931<=n&&n<=937||945<=n&&n<=961||963<=n&&n<=969||n==1025||1040<=n&&n<=1103||n==1105||n==8208||8211<=n&&n<=8214||8216<=n&&n<=8217||8220<=n&&n<=8221||8224<=n&&n<=8226||8228<=n&&n<=8231||n==8240||8242<=n&&n<=8243||n==8245||n==8251||n==8254||n==8308||n==8319||8321<=n&&n<=8324||n==8364||n==8451||n==8453||n==8457||n==8467||n==8470||8481<=n&&n<=8482||n==8486||n==8491||8531<=n&&n<=8532||8539<=n&&n<=8542||8544<=n&&n<=8555||8560<=n&&n<=8569||n==8585||8592<=n&&n<=8601||8632<=n&&n<=8633||n==8658||n==8660||n==8679||n==8704||8706<=n&&n<=8707||8711<=n&&n<=8712||n==8715||n==8719||n==8721||n==8725||n==8730||8733<=n&&n<=8736||n==8739||n==8741||8743<=n&&n<=8748||n==8750||8756<=n&&n<=8759||8764<=n&&n<=8765||n==8776||n==8780||n==8786||8800<=n&&n<=8801||8804<=n&&n<=8807||8810<=n&&n<=8811||8814<=n&&n<=8815||8834<=n&&n<=8835||8838<=n&&n<=8839||n==8853||n==8857||n==8869||n==8895||n==8978||9312<=n&&n<=9449||9451<=n&&n<=9547||9552<=n&&n<=9587||9600<=n&&n<=9615||9618<=n&&n<=9621||9632<=n&&n<=9633||9635<=n&&n<=9641||9650<=n&&n<=9651||9654<=n&&n<=9655||9660<=n&&n<=9661||9664<=n&&n<=9665||9670<=n&&n<=9672||n==9675||9678<=n&&n<=9681||9698<=n&&n<=9701||n==9711||9733<=n&&n<=9734||n==9737||9742<=n&&n<=9743||9748<=n&&n<=9749||n==9756||n==9758||n==9792||n==9794||9824<=n&&n<=9825||9827<=n&&n<=9829||9831<=n&&n<=9834||9836<=n&&n<=9837||n==9839||9886<=n&&n<=9887||9918<=n&&n<=9919||9924<=n&&n<=9933||9935<=n&&n<=9953||n==9955||9960<=n&&n<=9983||n==10045||n==10071||10102<=n&&n<=10111||11093<=n&&n<=11097||12872<=n&&n<=12879||57344<=n&&n<=63743||65024<=n&&n<=65039||n==65533||127232<=n&&n<=127242||127248<=n&&n<=127277||127280<=n&&n<=127337||127344<=n&&n<=127386||917760<=n&&n<=917999||983040<=n&&n<=1048573||1048576<=n&&n<=1114109?"A":"N"},r.characterLength=function(e){var i=this.eastAsianWidth(e);return i=="F"||i=="W"||i=="A"?2:1};function o(e){return e.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}r.length=function(e){for(var i=o(e),s=0,n=0;n<i.length;n++)s=s+this.characterLength(i[n]);return s},r.slice=function(e,i,s){textLen=r.length(e),i=i||0,s=s||1,i<0&&(i=textLen+i),s<0&&(s=textLen+s);for(var n="",a=0,c=o(e),l=0;l<c.length;l++){var f=c[l],m=r.length(f);if(a>=i-(m==2?1:0))if(a+m<=s)n+=f;else break;a+=m}return n}})(lt);var fr=lt.exports,mr=mt(fr),lr=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDD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D2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1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uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},pr=mt(lr);function sn(t,r={}){if(typeof t!="string"||t.length===0||(r={ambiguousIsNarrow:!0,...r},t=ft(t),t.length===0))return 0;t=t.replace(pr()," ");let o=r.ambiguousIsNarrow?1:2,e=0;for(let i of t){let s=i.codePointAt(0);if(s<=31||s>=127&&s<=159||s>=768&&s<=879)continue;switch(mr.eastAsianWidth(i)){case"F":case"W":e+=2;break;case"A":e+=o;break;default:e+=1}}return e}var Gn=10,nt=(t=0)=>(r)=>`\x1B[${r+t}m`,tt=(t=0)=>(r)=>`\x1B[${38+t};5;${r}m`,rt=(t=0)=>(r,o,e)=>`\x1B[${38+t};2;${r};${o};${e}m`,$={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys($.modifier);var gr=Object.keys($.color),ur=Object.keys($.bgColor);[...gr];function dr(){let t=new Map;for(let[r,o]of Object.entries($)){for(let[e,i]of Object.entries(o))$[e]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},o[e]=$[e],t.set(i[0],i[1]);Object.defineProperty($,r,{value:o,enumerable:!1})}return Object.defineProperty($,"codes",{value:t,enumerable:!1}),$.color.close="\x1B[39m",$.bgColor.close="\x1B[49m",$.color.ansi=nt(),$.color.ansi256=tt(),$.color.ansi16m=rt(),$.bgColor.ansi=nt(Gn),$.bgColor.ansi256=tt(Gn),$.bgColor.ansi16m=rt(Gn),Object.defineProperties($,{rgbToAnsi256:{value:(r,o,e)=>r===o&&o===e?r<8?16:r>248?231:Math.round((r-8)/247*24)+232:16+36*Math.round(r/255*5)+6*Math.round(o/255*5)+Math.round(e/255*5),enumerable:!1},hexToRgb:{value:(r)=>{let o=/[a-f\d]{6}|[a-f\d]{3}/i.exec(r.toString(16));if(!o)return[0,0,0];let[e]=o;e.length===3&&(e=[...e].map((s)=>s+s).join(""));let i=Number.parseInt(e,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:(r)=>$.rgbToAnsi256(...$.hexToRgb(r)),enumerable:!1},ansi256ToAnsi:{value:(r)=>{if(r<8)return 30+r;if(r<16)return 90+(r-8);let o,e,i;if(r>=232)o=((r-232)*10+8)/255,e=o,i=o;else{r-=16;let a=r%36;o=Math.floor(r/36)/5,e=Math.floor(a/6)/5,i=a%6/5}let s=Math.max(o,e,i)*2;if(s===0)return 30;let n=30+(Math.round(i)<<2|Math.round(e)<<1|Math.round(o));return s===2&&(n+=60),n},enumerable:!1},rgbToAnsi:{value:(r,o,e)=>$.ansi256ToAnsi($.rgbToAnsi256(r,o,e)),enumerable:!1},hexToAnsi:{value:(r)=>$.ansi256ToAnsi($.hexToAnsi256(r)),enumerable:!1}}),$}var hr=dr(),xn=new Set(["\x1B","\x9B"]),br=39,_n="\x07",pt="[",yr="]",gt="m",An=`${yr}8;;`,ot=(t)=>`${xn.values().next().value}${pt}${t}${gt}`,et=(t)=>`${xn.values().next().value}${An}${t}${_n}`,xr=(t)=>t.split(" ").map((r)=>sn(r)),Mn=(t,r,o)=>{let e=[...r],i=!1,s=!1,n=sn(ft(t[t.length-1]));for(let[a,c]of e.entries()){let l=sn(c);if(n+l<=o?t[t.length-1]+=c:(t.push(c),n=0),xn.has(c)&&(i=!0,s=e.slice(a+1).join("").startsWith(An)),i){s?c===_n&&(i=!1,s=!1):c===gt&&(i=!1);continue}n+=l,n===o&&a<e.length-1&&(t.push(""),n=0)}!n&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())},$r=(t)=>{let r=t.split(" "),o=r.length;for(;o>0&&!(sn(r[o-1])>0);)o--;return o===r.length?t:r.slice(0,o).join(" ")+r.slice(o).join("")},wr=(t,r,o={})=>{if(o.trim!==!1&&t.trim()==="")return"";let e="",i,s,n=xr(t),a=[""];for(let[l,f]of t.split(" ").entries()){o.trim!==!1&&(a[a.length-1]=a[a.length-1].trimStart());let m=sn(a[a.length-1]);if(l!==0&&(m>=r&&(o.wordWrap===!1||o.trim===!1)&&(a.push(""),m=0),(m>0||o.trim===!1)&&(a[a.length-1]+=" ",m++)),o.hard&&n[l]>r){let p=r-m,d=1+Math.floor((n[l]-p-1)/r);Math.floor((n[l]-1)/r)<d&&a.push(""),Mn(a,f,r);continue}if(m+n[l]>r&&m>0&&n[l]>0){if(o.wordWrap===!1&&m<r){Mn(a,f,r);continue}a.push("")}if(m+n[l]>r&&o.wordWrap===!1){Mn(a,f,r);continue}a[a.length-1]+=f}o.trim!==!1&&(a=a.map((l)=>$r(l)));let c=[...a.join(`
|
|
3
|
+
`)];for(let[l,f]of c.entries()){if(e+=f,xn.has(f)){let{groups:p}=new RegExp(`(?:\\${pt}(?<code>\\d+)m|\\${An}(?<uri>.*)${_n})`).exec(c.slice(l).join(""))||{groups:{}};if(p.code!==void 0){let d=Number.parseFloat(p.code);i=d===br?void 0:d}else p.uri!==void 0&&(s=p.uri.length===0?void 0:p.uri)}let m=hr.codes.get(Number(i));c[l+1]===`
|
|
4
|
+
`?(s&&(e+=et("")),i&&m&&(e+=ot(m))):f===`
|
|
5
|
+
`&&(i&&m&&(e+=ot(i)),s&&(e+=et(s)))}return e};function it(t,r,o){return String(t).normalize().replace(/\r\n/g,`
|
|
6
6
|
`).split(`
|
|
7
|
-
`).map((e)
|
|
8
|
-
`)}var
|
|
7
|
+
`).map((e)=>wr(e,r,o)).join(`
|
|
8
|
+
`)}var Er=["up","down","left","right","space","enter","cancel"],yn={actions:new Set(Er),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]])};function Un(t,r){if(typeof t=="string")return yn.aliases.get(t)===r;for(let o of t)if(o!==void 0&&Un(o,r))return!0;return!1}function Rr(t,r){if(t===r)return;let o=t.split(`
|
|
9
9
|
`),e=r.split(`
|
|
10
|
-
`),i=[];for(let s=0;s<Math.max(o.length,e.length);s++)o[s]!==e[s]&&i.push(s);return i}var
|
|
11
|
-
`),
|
|
12
|
-
`).length-1;this.output.write(
|
|
13
|
-
`);this.output.write(e[o]),this._prevFrame=t,this.output.write(
|
|
10
|
+
`),i=[];for(let s=0;s<Math.max(o.length,e.length);s++)o[s]!==e[s]&&i.push(s);return i}var Or=globalThis.process.platform.startsWith("win"),Xn=Symbol("clack:cancel");function T(t){return t===Xn}function bn(t,r){let o=t;o.isTTY&&o.setRawMode(r)}function ut({input:t=st,output:r=at,overwrite:o=!0,hideCursor:e=!0}={}){let i=W.createInterface({input:t,output:r,prompt:"",tabSize:1});W.emitKeypressEvents(t,i),t.isTTY&&t.setRawMode(!0);let s=(n,{name:a,sequence:c})=>{let l=String(n);if(Un([l,a,c],"cancel")){e&&r.write(C.cursor.show),process.exit(0);return}if(!o)return;W.moveCursor(r,a==="return"?0:-1,a==="return"?-1:0,()=>{W.clearLine(r,1,()=>{t.once("keypress",s)})})};return e&&r.write(C.cursor.hide),t.once("keypress",s),()=>{t.off("keypress",s),e&&r.write(C.cursor.show),t.isTTY&&!Or&&t.setRawMode(!1),i.terminal=!1,i.close()}}var Sr=Object.defineProperty,Cr=(t,r,o)=>(r in t)?Sr(t,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[r]=o,v=(t,r,o)=>(Cr(t,typeof r!="symbol"?r+"":r,o),o);class qn{constructor(t,r=!0){v(this,"input"),v(this,"output"),v(this,"_abortSignal"),v(this,"rl"),v(this,"opts"),v(this,"_render"),v(this,"_track",!1),v(this,"_prevFrame",""),v(this,"_subscribers",new Map),v(this,"_cursor",0),v(this,"state","initial"),v(this,"error",""),v(this,"value");let{input:o=st,output:e=at,render:i,signal:s,...n}=t;this.opts=n,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=i.bind(this),this._track=r,this._abortSignal=s,this.input=o,this.output=e}unsubscribe(){this._subscribers.clear()}setSubscriber(t,r){let o=this._subscribers.get(t)??[];o.push(r),this._subscribers.set(t,o)}on(t,r){this.setSubscriber(t,{cb:r})}once(t,r){this.setSubscriber(t,{cb:r,once:!0})}emit(t,...r){let o=this._subscribers.get(t)??[],e=[];for(let i of o)i.cb(...r),i.once&&e.push(()=>o.splice(o.indexOf(i),1));for(let i of e)i()}prompt(){return new Promise((t,r)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),t(Xn);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let o=new sr;o._write=(e,i,s)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,""),this._cursor=this.rl?.cursor??0,this.emit("value",this.value)),s()},this.input.pipe(o),this.rl=Dn.createInterface({input:this.input,output:o,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),Dn.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),bn(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(C.cursor.show),this.output.off("resize",this.render),bn(this.input,!1),t(this.value)}),this.once("cancel",()=>{this.output.write(C.cursor.show),this.output.off("resize",this.render),bn(this.input,!1),t(Xn)})})}onKeypress(t,r){if(this.state==="error"&&(this.state="active"),r?.name&&(!this._track&&yn.aliases.has(r.name)&&this.emit("cursor",yn.aliases.get(r.name)),yn.actions.has(r.name)&&this.emit("cursor",r.name)),t&&(t.toLowerCase()==="y"||t.toLowerCase()==="n")&&this.emit("confirm",t.toLowerCase()==="y"),t==="\t"&&this.opts.placeholder&&(this.value||(this.rl?.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),t&&this.emit("key",t.toLowerCase()),r?.name==="return"){if(this.opts.validate){let o=this.opts.validate(this.value);o&&(this.error=o instanceof Error?o.message:o,this.state="error",this.rl?.write(this.value))}this.state!=="error"&&(this.state="submit")}Un([t,r?.name,r?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
|
|
11
|
+
`),bn(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let t=it(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
|
|
12
|
+
`).length-1;this.output.write(C.cursor.move(-999,t*-1))}render(){let t=it(this._render(this)??"",process.stdout.columns,{hard:!0});if(t!==this._prevFrame){if(this.state==="initial")this.output.write(C.cursor.hide);else{let r=Rr(this._prevFrame,t);if(this.restoreCursor(),r&&r?.length===1){let o=r[0];this.output.write(C.cursor.move(0,o)),this.output.write(C.erase.lines(1));let e=t.split(`
|
|
13
|
+
`);this.output.write(e[o]),this._prevFrame=t,this.output.write(C.cursor.move(0,e.length-o-1));return}if(r&&r?.length>1){let o=r[0];this.output.write(C.cursor.move(0,o)),this.output.write(C.erase.down());let e=t.split(`
|
|
14
14
|
`).slice(o);this.output.write(e.join(`
|
|
15
|
-
`)),this._prevFrame=t;return}this.output.write(
|
|
16
|
-
${
|
|
15
|
+
`)),this._prevFrame=t;return}this.output.write(C.erase.down())}this.output.write(t),this.state==="initial"&&(this.state="active"),this._prevFrame=t}}}class Hn extends qn{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(t){super(t,!1),this.value=!!t.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",(r)=>{this.output.write(C.cursor.move(0,-1)),this.value=r,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}var Tr;Tr=new WeakMap;class Ln extends qn{get valueWithCursor(){if(this.state==="submit")return this.value;if(this.cursor>=this.value.length)return`${this.value}\u2588`;let t=this.value.slice(0,this.cursor),[r,...o]=this.value.slice(this.cursor);return`${t}${ct.default.inverse(r)}${o.join("")}`}get cursor(){return this._cursor}constructor(t){super(t),this.on("finalize",()=>{this.value||(this.value=t.defaultValue)})}}var g=un(Pn(),1),$n=un(Nn(),1);import A from"process";function kr(){return A.platform!=="win32"?A.env.TERM!=="linux":!!A.env.CI||!!A.env.WT_SESSION||!!A.env.TERMINUS_SUBLIME||A.env.ConEmuTask==="{cmd::Cmder}"||A.env.TERM_PROGRAM==="Terminus-Sublime"||A.env.TERM_PROGRAM==="vscode"||A.env.TERM==="xterm-256color"||A.env.TERM==="alacritty"||A.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var Bn=kr(),R=(t,r)=>Bn?t:r,Nr=R("\u25C6","*"),bt=R("\u25A0","x"),yt=R("\u25B2","x"),In=R("\u25C7","o"),vr=R("\u250C","T"),S=R("\u2502","|"),an=R("\u2514","\u2014"),dt=R("\u25CF",">"),ht=R("\u25CB"," "),Yo=R("\u25FB","[\u2022]"),Qo=R("\u25FC","[+]"),Zo=R("\u25FB","[ ]"),Vo=R("\u25AA","\u2022"),Fo=R("\u2500","-"),Do=R("\u256E","+"),ne=R("\u251C","+"),te=R("\u256F","+"),Pr=R("\u25CF","\u2022"),Gr=R("\u25C6","*"),Mr=R("\u25B2","!"),Xr=R("\u25A0","x"),xt=(t)=>{switch(t){case"initial":case"active":return g.default.cyan(Nr);case"cancel":return g.default.red(bt);case"error":return g.default.yellow(yt);case"submit":return g.default.green(In)}};var P=(t)=>new Ln({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,render(){let r=`${g.default.gray(S)}
|
|
16
|
+
${xt(this.state)} ${t.message}
|
|
17
17
|
`,o=t.placeholder?g.default.inverse(t.placeholder[0])+g.default.dim(t.placeholder.slice(1)):g.default.inverse(g.default.hidden("_")),e=this.value?this.valueWithCursor:o;switch(this.state){case"error":return`${r.trim()}
|
|
18
|
-
${g.default.yellow(
|
|
19
|
-
${g.default.yellow(
|
|
20
|
-
`;case"submit":return`${r}${g.default.gray(
|
|
21
|
-
${g.default.gray(
|
|
22
|
-
${g.default.cyan(
|
|
23
|
-
`}}}).prompt();var
|
|
24
|
-
${
|
|
25
|
-
`,i=this.value?r:o;switch(this.state){case"submit":return`${e}${g.default.gray(
|
|
26
|
-
${g.default.gray(
|
|
27
|
-
${g.default.cyan(
|
|
28
|
-
`}}}).prompt()};var
|
|
29
|
-
|
|
30
|
-
`)}
|
|
31
|
-
`)}
|
|
32
|
-
${g.default.gray(
|
|
33
|
-
|
|
34
|
-
`)},
|
|
35
|
-
`);o.push(`${r} ${e}`,...i.map((s)=>`${g.default.gray(
|
|
18
|
+
${g.default.yellow(S)} ${e}
|
|
19
|
+
${g.default.yellow(an)} ${g.default.yellow(this.error)}
|
|
20
|
+
`;case"submit":return`${r}${g.default.gray(S)} ${g.default.dim(this.value||t.placeholder)}`;case"cancel":return`${r}${g.default.gray(S)} ${g.default.strikethrough(g.default.dim(this.value??""))}${this.value?.trim()?`
|
|
21
|
+
${g.default.gray(S)}`:""}`;default:return`${r}${g.default.cyan(S)} ${e}
|
|
22
|
+
${g.default.cyan(an)}
|
|
23
|
+
`}}}).prompt();var z=(t)=>{let r=t.active??"Yes",o=t.inactive??"No";return new Hn({active:r,inactive:o,initialValue:t.initialValue??!0,render(){let e=`${g.default.gray(S)}
|
|
24
|
+
${xt(this.state)} ${t.message}
|
|
25
|
+
`,i=this.value?r:o;switch(this.state){case"submit":return`${e}${g.default.gray(S)} ${g.default.dim(i)}`;case"cancel":return`${e}${g.default.gray(S)} ${g.default.strikethrough(g.default.dim(i))}
|
|
26
|
+
${g.default.gray(S)}`;default:return`${e}${g.default.cyan(S)} ${this.value?`${g.default.green(dt)} ${r}`:`${g.default.dim(ht)} ${g.default.dim(r)}`} ${g.default.dim("/")} ${this.value?`${g.default.dim(ht)} ${g.default.dim(o)}`:`${g.default.green(dt)} ${o}`}
|
|
27
|
+
${g.default.cyan(an)}
|
|
28
|
+
`}}}).prompt()};var jn=(t="")=>{process.stdout.write(`${g.default.gray(an)} ${g.default.red(t)}
|
|
29
|
+
|
|
30
|
+
`)},$t=(t="")=>{process.stdout.write(`${g.default.gray(vr)} ${t}
|
|
31
|
+
`)},wt=(t="")=>{process.stdout.write(`${g.default.gray(S)}
|
|
32
|
+
${g.default.gray(an)} ${t}
|
|
33
|
+
|
|
34
|
+
`)},U={message:(t="",{symbol:r=g.default.gray(S)}={})=>{let o=[`${g.default.gray(S)}`];if(t){let[e,...i]=t.split(`
|
|
35
|
+
`);o.push(`${r} ${e}`,...i.map((s)=>`${g.default.gray(S)} ${s}`))}process.stdout.write(`${o.join(`
|
|
36
36
|
`)}
|
|
37
|
-
`)},info:(t)=>{
|
|
38
|
-
`);let
|
|
39
|
-
`);process.stdout.write(
|
|
40
|
-
`);let
|
|
41
|
-
`):process.stdout.write(`${
|
|
42
|
-
`),u(),i()};return{start:
|
|
43
|
-
${d}`});if(
|
|
37
|
+
`)},info:(t)=>{U.message(t,{symbol:g.default.blue(Pr)})},success:(t)=>{U.message(t,{symbol:g.default.green(Gr)})},step:(t)=>{U.message(t,{symbol:g.default.green(In)})},warn:(t)=>{U.message(t,{symbol:g.default.yellow(Mr)})},warning:(t)=>{U.warn(t)},error:(t)=>{U.message(t,{symbol:g.default.red(Xr)})}},re=`${g.default.gray(S)} `;var Et=({indicator:t="dots"}={})=>{let r=Bn?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],o=Bn?80:120,e=process.env.CI==="true",i,s,n=!1,a="",c,l=performance.now(),f=(x)=>{let w=x>1?"Something went wrong":"Canceled";n&&B(w,x)},m=()=>f(2),p=()=>f(1),d=()=>{process.on("uncaughtExceptionMonitor",m),process.on("unhandledRejection",m),process.on("SIGINT",p),process.on("SIGTERM",p),process.on("exit",f)},u=()=>{process.removeListener("uncaughtExceptionMonitor",m),process.removeListener("unhandledRejection",m),process.removeListener("SIGINT",p),process.removeListener("SIGTERM",p),process.removeListener("exit",f)},E=()=>{if(c===void 0)return;e&&process.stdout.write(`
|
|
38
|
+
`);let x=c.split(`
|
|
39
|
+
`);process.stdout.write($n.cursor.move(-999,x.length-1)),process.stdout.write($n.erase.down(x.length))},k=(x)=>x.replace(/\.+$/,""),q=(x)=>{let w=(performance.now()-x)/1000,N=Math.floor(w/60),I=Math.floor(w%60);return N>0?`[${N}m ${I}s]`:`[${I}s]`},y=(x="")=>{n=!0,i=ut(),a=k(x),l=performance.now(),process.stdout.write(`${g.default.gray(S)}
|
|
40
|
+
`);let w=0,N=0;d(),s=setInterval(()=>{if(e&&a===c)return;E(),c=a;let I=g.default.magenta(r[w]);if(e)process.stdout.write(`${I} ${a}...`);else if(t==="timer")process.stdout.write(`${I} ${a} ${q(l)}`);else{let Y=".".repeat(Math.floor(N)).slice(0,3);process.stdout.write(`${I} ${a}${Y}`)}w=w+1<r.length?w+1:0,N=N<r.length?N+0.125:0},o)},B=(x="",w=0)=>{n=!1,clearInterval(s),E();let N=w===0?g.default.green(In):w===1?g.default.red(bt):g.default.red(yt);a=k(x??a),t==="timer"?process.stdout.write(`${N} ${a} ${q(l)}
|
|
41
|
+
`):process.stdout.write(`${N} ${a}
|
|
42
|
+
`),u(),i()};return{start:y,stop:B,message:(x="")=>{a=k(x??a)}}},Rt=async(t,r)=>{let o={},e=Object.keys(t);for(let i of e){let s=t[i],n=await s({results:o})?.catch((a)=>{throw a});if(typeof r?.onCancel=="function"&&T(n)){o[i]="canceled",r.onCancel({results:o});continue}o[i]=n}return o};var _r=!process.env.NO_COLOR&&(process.env.FORCE_COLOR||process.stdout.isTTY),Ar=["blue","cyan","gray","green","magenta","red","white","yellow"],Ur=["bold","dim","italic","underline","reset"],St={bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",reset:"\x1B[0m",underline:"\x1B[4m"},qr={"\x1B[30m":"\x1B[90m","\x1B[31m":"\x1B[91m","\x1B[32m":"\x1B[92m","\x1B[33m":"\x1B[93m","\x1B[34m":"\x1B[94m","\x1B[35m":"\x1B[95m","\x1B[36m":"\x1B[96m","\x1B[37m":"\x1B[97m"};function Wn(t){return(r)=>_r?`${t}${r}${St.reset}`:r}function Ot({bright:t=!1,color:r}){let o=Bun.color(r,"ansi");if(!o)return"";return t?qr[o]||o:o}var Hr=Ar.reduce((t,r)=>{return t[r]=Wn(Ot({color:r})),t[`${r}Bright`]=Wn(Ot({bright:!0,color:r})),t},{}),Lr=Ur.reduce((t,r)=>{return t[r]=Wn(St[r]),t},{}),b={...Hr,...Lr};var O=({prefix:t="",level:r=process.env.DEBUG?0:1}={})=>{function o(...a){if(r<=0){let c=a.join(" ");console.log(wn({level:b.dim("DEBUG"),message:c,prefix:t}))}}function e(...a){if(r<=1){let c=a.join(" ");console.info(wn({level:b.cyan("INFO "),message:c,prefix:t}))}}function i(...a){if(r<=2){let c=a.join(" ");console.warn(wn({level:b.yellow("WARN "),message:c,prefix:t}))}}function s(...a){if(r<=3){let c=a.join(" ");console.error(wn({level:b.red("ERROR"),message:c,prefix:t}))}}function n(a){return O({level:r,prefix:`${t}:${a}`})}return{child:n,debug:o,error:s,info:e,warn:i}},zn=O();function wn({prefix:t,level:r,message:o}){let e=new Date().toISOString().split("T")[1]?.split(".")[0]||"",i=t?`[${t}] `:"";return`${b.dim(e||"")} ${r} ${i}${o}`}var h={arrow:b.yellow,bold:b.bold,boolean:b.cyan,bullet:b.yellow,busy:b.yellow,command:b.green,dim:b.dim,error:b.red,flag:b.yellow,info:b.cyan,number:b.magenta,offline:b.red,online:b.green,separator:b.dim,string:b.green,success:b.green,value:b.cyan,warning:b.yellow};var xe=O({prefix:"cli-core"}).child("error");var j=new Uint32Array(65536),Br=(t,r)=>{let o=t.length,e=r.length,i=1<<o-1,s=-1,n=0,a=o,c=o;while(c--)j[t.charCodeAt(c)]|=1<<c;for(c=0;c<e;c++){let l=j[r.charCodeAt(c)],f=l|n;if(l|=(l&s)+s^s,n|=~(l|s),s&=l,n&i)a++;if(s&i)a--;n=n<<1|1,s=s<<1|~(f|n),n&=f}c=o;while(c--)j[t.charCodeAt(c)]=0;return a},Ir=(t,r)=>{let o=r.length,e=t.length,i=[],s=[],n=Math.ceil(o/32),a=Math.ceil(e/32);for(let u=0;u<n;u++)s[u]=-1,i[u]=0;let c=0;for(;c<a-1;c++){let u=0,E=-1,k=c*32,q=Math.min(32,e)+k;for(let y=k;y<q;y++)j[t.charCodeAt(y)]|=1<<y;for(let y=0;y<o;y++){let B=j[r.charCodeAt(y)],x=s[y/32|0]>>>y&1,w=i[y/32|0]>>>y&1,N=B|u,I=((B|w)&E)+E^E|B|w,Y=u|~(I|E),gn=E&I;if(Y>>>31^x)s[y/32|0]^=1<<y;if(gn>>>31^w)i[y/32|0]^=1<<y;Y=Y<<1|x,gn=gn<<1|w,E=gn|~(N|Y),u=Y&N}for(let y=k;y<q;y++)j[t.charCodeAt(y)]=0}let l=0,f=-1,m=c*32,p=Math.min(32,e-m)+m;for(let u=m;u<p;u++)j[t.charCodeAt(u)]|=1<<u;let d=e;for(let u=0;u<o;u++){let E=j[r.charCodeAt(u)],k=s[u/32|0]>>>u&1,q=i[u/32|0]>>>u&1,y=E|l,B=((E|q)&f)+f^f|E|q,x=l|~(B|f),w=f&B;if(d+=x>>>e-1&1,d-=w>>>e-1&1,x>>>31^k)s[u/32|0]^=1<<u;if(w>>>31^q)i[u/32|0]^=1<<u;x=x<<1|k,w=w<<1|q,f=w|~(y|x),l=x&y}for(let u=m;u<p;u++)j[t.charCodeAt(u)]=0;return d},Ct=(t,r)=>{if(t.length<r.length){let o=r;r=t,t=o}if(r.length===0)return t.length;if(t.length<=32)return Br(t,r);return Ir(t,r)};function Tt(t,r,o=3){return r.map((s)=>({distance:Ct(t.toLowerCase(),s.toLowerCase()),option:s})).filter(({distance:s})=>s<=Math.max(3,t.length/2)).sort((s,n)=>s.distance-n.distance).slice(0,o).map(({option:s})=>s)}function kt(t,r){return r[t.toLowerCase()]||null}var Nt=O({prefix:"cli-core"}).child("graceful");async function tn(t,r={}){let{fallback:o,logLevel:e="warn",message:i="Operation failed gracefully"}=r;try{return await t()}catch(s){let n=s instanceof Error?s.message:String(s);if(Nt[e](`${i}: ${n}`),o)try{await o()}catch(a){Nt.error(`Fallback also failed: ${a instanceof Error?a.message:String(a)}`)}return}}var jr={backoffMultiplier:2,initialDelay:1000,maxAttempts:3,maxDelay:30000,onRetry:(t,r)=>{zn.warn(`Retry attempt ${t}: ${r.message}`)},retryableErrors:["ECONNREFUSED","ECONNRESET","ETIMEDOUT","ENOTFOUND","rate limit","429","503","502","504","npm ERR!","EPUBLISHCONFLICT"]};async function cn(t,r={}){let o={...jr,...r},e=new Error("Operation failed");for(let i=1;i<=o.maxAttempts;i++)try{return await t()}catch(s){if(e=s instanceof Error?s:new Error(String(s)),!o.retryableErrors.some((c)=>e.message.toLowerCase().includes(c.toLowerCase()))||i===o.maxAttempts)throw e;o.onRetry(i,e);let a=Math.min(o.initialDelay*o.backoffMultiplier**(i-1),o.maxDelay);await new Promise((c)=>setTimeout(c,a))}throw e}var H=(t)=>{return t.map=(r)=>H((o)=>r(t(o))),t.or=(r)=>H((o)=>{try{return t(o)}catch(e){return r(o)}}),t},En=()=>"bad banditype"();var vt=(t)=>H((r)=>t.includes(r)?r:En()),Rn=(t)=>H((r)=>typeof r===typeof t?r:En()),fn=()=>Rn(""),Pt=()=>Rn(0),Gt=()=>Rn(!0);var Mt=()=>Rn();var Xt=(t)=>H((r)=>r instanceof t?r:En()),Kn=(t)=>Xt(Object).map((r)=>{let o={};for(let e in r){let i=t(r[e]);i!==void 0&&(o[e]=i)}return o}),rn=(t)=>Xt(Object).map((r)=>{let o={};for(let e in t){let i=t[e](r[e]);i!==void 0&&(o[e]=i)}return o});function Wr(t,r){return H((o)=>{try{return t(o)}catch{try{return r(o)}catch{throw new Error("No matching schema in union")}}})}function Q(t,r){return(o)=>{if(o===void 0)return r;return t(o)}}function _t(){return H((t)=>{let r=Pt()(t);if(!Number.isInteger(r)||r<=0)throw new Error("Must be a positive integer");return r})}function At(){return H((t)=>{let r=fn()(t);try{return new URL(r),r}catch{throw new Error("Must be a valid URL")}})}function Ut(t,r){return H((o)=>{let e=fn()(o);if(!t.test(e))throw new Error(r||`Must match pattern ${t}`);return e})}function mn(t){return{parse(r){try{return t(r)}catch(o){throw new Error(o instanceof Error?o.message:"Validation failed")}},safeParse(r){try{return{data:t(r),success:!0}}catch(o){return{error:o instanceof Error?o:new Error("Validation failed"),success:!1}}},validator:t}}function Z(){return Wr(Mt(),fn())}function V(t){return Q(fn(),t)}function on(t){return Q(Gt(),t)}function On(t,r){return Q(vt(t),r)}import{parseArgs as ro}from"util";var{$:X}=globalThis.Bun;import{join as Bt}from"path";var{$:Lt}=globalThis.Bun;import{tmpdir as zr}from"os";var qt={MACHINES_DIR:"machines",TEMP_DIR:zr()};var Kr=rn({directory:V("./gh-runners"),labels:Z(),name:V("runner"),numberOfMachines:Q(_t(),1),os:On(["osx","linux","windows"],"osx"),overwrite:on(!1),run:on(!1),runnerGroup:Z(),url:Z()}),Jr=mn(Kr),Ht=mn(rn({defaultProfile:Z(),profiles:Kn(Jr.validator)}));var Yr=["hydra.json",".hydra.json","hydra.toml",".hydra.toml"];async function Qr(t=process.cwd()){for(let r of Yr){let o=Bt(t,r);if(await Bun.file(o).exists())return o}return null}async function K(t){let r=t?.configPath||await Qr();if(!r)return null;let o=Bun.file(r);if(!await o.exists())return null;try{let e=await o.text(),i=r.endsWith(".toml")?await Zr(e):JSON.parse(e);return Ht.parse(i)}catch(e){if(e instanceof Error)throw new Error(`Invalid config file: ${e.message}`);throw e}}async function J(t,r){if(!t)return null;let o=r||t.defaultProfile;if(!o)return null;return t.profiles[o]||null}async function Zr(t){let r=Bt(qt.TEMP_DIR,`hydra-config-${Date.now()}.toml`);await Bun.write(r,t);try{let o=await import(r);return await Lt`rm -f ${r}`.quiet(),o.default}catch(o){throw await Lt`rm -f ${r}`.quiet(),new Error(`Failed to parse TOML configuration: ${o}`)}}function ln(){let t=import.meta.path,r=t.substring(0,t.lastIndexOf("/"));return r.substring(0,r.lastIndexOf("/"))}var Vr=rn({directory:V(`${process.cwd()}/gh-runners`),labels:Z(),name:V("runner"),numberOfMachines:Q(Ut(/^\d+$/,"Number of machines must be a positive integer"),"1"),os:On(["osx","linux","windows"],"osx"),overwrite:on(!1),run:on(!1),token:V(process.env.GITHUB_PERSONAL_ACCESS_TOKEN??""),url:At()}),ri=mn(Vr);var F=O({prefix:"WorkerManager"}),G=new Set,It=!1;function Fr(){if(It)return;It=!0;let t=()=>{if(G.size>0)F.info("Cleaning up workers...");jt()};process.on("exit",t),process.on("SIGINT",t),process.on("SIGTERM",t),process.on("uncaughtException",(r)=>{F.error("Uncaught exception:",r),t(),process.exit(1)})}function Dr(t){G.add(t),F.debug(`Worker added. Total workers: ${G.size}`),t.addEventListener("exit",()=>{G.delete(t),F.debug(`Worker exited. Remaining workers: ${G.size}`)})}function no(t){if(G.has(t))t.terminate(),G.delete(t),F.debug(`Worker removed. Remaining workers: ${G.size}`)}function jt(){if(G.size>0){F.info(`Terminating ${G.size} workers...`);for(let t of G)try{t.terminate()}catch(r){F.error("Failed to terminate worker:",r)}G.clear()}}function to(){return G.size}Fr();var Sn={add:Dr,remove:no,get size(){return to()},terminateAll:jt};var M=O({prefix:"createMachines"});async function Wt(){let t=await eo(),{overwrite:r,directory:o,numberOfMachines:e,os:i,run:s,name:n,labels:a,runnerGroup:c}=t,{token:l,url:f}=t;if(!f)throw new Error("URL (-u) parameter is required");if(!l){let d=oo(f),u=await z({message:`No token provided. Would you like to open GitHub to get a runner token?
|
|
43
|
+
${d}`});if(T(u)||!u)throw new Error("Token is required to create runners");M.info("Opening GitHub runner settings..."),await X`open ${d}`.quiet();let E=await P({message:"Enter the runner registration token:",placeholder:"AXXXXXXXXXXXXXXXXXXXXXXXXX",validate:(k)=>{if(!k||k.trim().length===0)return"Token is required";return}});if(T(E))throw new Error("Token is required to create runners");l=E.trim()}if(M.info(`Creating ${e} runners in ${o}`),M.debug(`OS: ${i}, Name: ${n}, Labels: ${a||"none"}`),await Bun.file(o).exists())if(r)M.warn(`Directory ${o} exists, removing...`),await X`rm -rf ${o}`;else throw new Error(`Directory ${o} already exists`);let p=await io({directory:o,os:i});if(await so({directory:o,numberOfMachines:e,overwrite:r,runnerBase:p}),!s){M.info("Runners created but not started");return}ao({directory:o,labels:a,name:n,numberOfMachines:e,runnerGroup:c,token:l,url:f})}function oo(t){try{let r=new URL(t),o=r.pathname.split("/").filter(Boolean);if(r.hostname==="github.com"||r.hostname==="www.github.com"){if(o[0]==="orgs"&&o[1])return`https://github.com/organizations/${o[1]}/settings/actions/runners/new`;else if(o.length>=2)return`https://github.com/${o[0]}/${o[1]}/settings/actions/runners/new`}else if(o[0]==="orgs"&&o[1])return`${r.origin}/organizations/${o[1]}/settings/actions/runners/new`;else if(o.length>=2)return`${r.origin}/${o[0]}/${o[1]}/settings/actions/runners/new`;return t}catch{return t}}async function eo(){let{values:t}=ro({allowPositionals:!0,args:Bun.argv,options:{config:{short:"c",type:"string"},directory:{default:`${process.cwd()}/gh-runners`,short:"d",type:"string"},labels:{short:"l",type:"string"},name:{default:"runner",short:"n",type:"string"},numberOfMachines:{default:"1",short:"m",type:"string"},os:{default:"osx",short:"s",type:"string"},overwrite:{default:!1,short:"f",type:"boolean"},profile:{short:"p",type:"string"},run:{default:!1,short:"r",type:"boolean"},runnerGroup:{short:"g",type:"string"},token:{short:"t",type:"string"},url:{short:"u",type:"string"}},strict:!0}),r=await K({configPath:t.config}),o=await J(r,t.profile),e={directory:t.directory,labels:t.labels,name:t.name,numberOfMachines:t.numberOfMachines,os:t.os,overwrite:t.overwrite,run:t.run,runnerGroup:t.runnerGroup,token:t.token,url:t.url};if(o)return{directory:e.directory??o.directory??`${process.cwd()}/gh-runners`,labels:e.labels??o.labels,name:e.name??o.name??"runner",numberOfMachines:e.numberOfMachines??String(o.numberOfMachines)??"1",os:e.os??o.os??"osx",overwrite:e.overwrite??o.overwrite??!1,run:e.run??o.run??!1,runnerGroup:e.runnerGroup??o.runnerGroup,token:e.token,url:e.url??o.url};return{directory:e.directory,labels:e.labels,name:e.name,numberOfMachines:e.numberOfMachines,os:e.os,overwrite:e.overwrite,run:e.run,runnerGroup:e.runnerGroup,token:e.token,url:e.url}}async function io({directory:t,os:r}){let o=M.child("download");o.info(`Fetching latest runner version for ${r}...`);let e=await cn(async()=>(await X`curl -Ls -o /dev/null -w "%{url_effective}" https://github.com/actions/runner/releases/latest`).text(),{onRetry:(l,f)=>{o.warn(`Retrying GitHub API call (attempt ${l}): ${f.message}`)}}),s=(await X`basename ${e}`).text().trim().replace("v",""),n=`actions-runner-${r}-x64-${s}.tar.gz`,a=`https://github.com/actions/runner/releases/download/v${s}/${n}`;if(o.debug(`Runner version: ${s}`),o.debug(`Download URL: ${a}`),await X`mkdir -p ${t}`,await X`mkdir -p ${t}/machines`,!await Bun.file(`${t}/${n}`).exists())o.info("Downloading runner image..."),await cn(async()=>await X`curl -o ${t}/${n} -L ${a}`,{maxAttempts:5,onRetry:(l,f)=>{o.warn(`Retrying runner download (attempt ${l}): ${f.message}`)}}),o.info("Download complete");else o.info("Runner image already exists, skipping download");return n}async function so({overwrite:t,numberOfMachines:r,directory:o,runnerBase:e}){let i=M.child("extract"),s=Number(r),n=(()=>{try{let f=Bun.spawnSync(["nproc"]);return Number.parseInt(f.stdout.toString().trim(),10)||4}catch{try{let f=Bun.spawnSync(["sysctl","-n","hw.ncpu"]);return Number.parseInt(f.stdout.toString().trim(),10)||4}catch{return 4}}})(),a=Math.min(Math.max(2,Math.floor(n/2)),s,8);i.info(`Extracting ${s} runners with concurrency of ${a}`);let c=Array.from({length:s},(f,m)=>m+1).map((f)=>({execute:async()=>{let m=`${o}/machines/${f}`;if(await Bun.file(m).exists())if(t)i.debug(`Machine ${f} already exists, removing...`),await X`rm -rf ${m}`;else{i.debug(`Machine ${f} already exists, skipping...`);return}await X`mkdir -p ${m}`,await X`tar xzf ${e} -C ${m.replace(`${o}/`,"")}`.cwd(o);let d=`${ln()}/src/runner`;await X`cp -R ${d}/hooks ${m}`,await X`cp -R ${d}/.runner-env ${m}/.runner-env`,i.debug(`Machine ${f} extracted successfully`)},runnerIndex:f})),l=[];for(let f=0;f<c.length;f+=a){let m=c.slice(f,f+a),p=await Promise.allSettled(m.map((d)=>d.execute()));for(let[d,u]of p.entries())if(u.status==="rejected")throw i.error(`Failed to extract runner ${m[d]?.runnerIndex}: ${u.reason}`),u.reason;l.push(...p)}i.info(`Successfully extracted ${s} runners`)}function ao({directory:t,numberOfMachines:r,token:o,url:e,name:i,labels:s,runnerGroup:n}){M.info(`Starting ${r} runners...`);for(let a=1;a<=Number(r);a++){let c=`${ln()}/src/runner-worker.ts`,l=`${i}-${a}`,f=new Worker(c,{name:l,ref:!0});f.addEventListener("open",()=>{M.info(`Worker ${l} started`),f.postMessage({index:a,labels:s,machineCwd:`${t}/machines/${a}`,name:i,runnerGroup:n,token:o,url:e})}),f.addEventListener("message",({data:m})=>{let p=m.type==="error"?"error":"info";M[p](`${l}: ${m.message}`)}),f.addEventListener("error",(m)=>{M.error(`Worker ${l} error:`,m)}),f.addEventListener("exit",(m)=>{M.info(`Worker ${l} exited with code ${m}`)}),Sn.add(f)}M.info("All workers started. Press Ctrl+C to stop all machines")}var zt="0.3.9";var Kt={create:`
|
|
44
44
|
hydra create - Create and register new GitHub runner machines
|
|
45
45
|
|
|
46
46
|
USAGE
|
|
@@ -151,24 +151,24 @@ EXAMPLES
|
|
|
151
151
|
|
|
152
152
|
# Status using profile
|
|
153
153
|
hydra status -p production
|
|
154
|
-
`};function
|
|
155
|
-
`).map((e)=>{if(e.startsWith("hydra"))return h.bold(e);if(e==="USAGE"||e==="OPTIONS"||e==="EXAMPLES")return h.bold(e);if(e.startsWith(" -")){let i=e.match(/^(\s+-\w,\s--\w+)\s+(.+)$/);if(i){let[,s="",n=""]=i,a=n.replace("(required)",h.
|
|
154
|
+
`};function pn(t){if(t&&Kt[t]){let o=Kt[t].split(`
|
|
155
|
+
`).map((e)=>{if(e.startsWith("hydra"))return h.bold(e);if(e==="USAGE"||e==="OPTIONS"||e==="EXAMPLES")return h.bold(e);if(e.startsWith(" -")){let i=e.match(/^(\s+-\w,\s--\w+)\s+(.+)$/);if(i){let[,s="",n=""]=i,a=n.replace("(required)",h.error("(required)")).replace(/\(default: ([^)]+)\)/g,(c,l)=>h.dim(`(default: ${l})`)).replace(/\[boolean\]/g,h.boolean("[boolean]")).replace(/\[string\]/g,h.string("[string]")).replace(/\[number\]/g,h.number("[number]"));return` ${h.flag(s.padEnd(26))} ${a}`}}if(e.startsWith(" # "))return h.dim(e);if(e.startsWith(" hydra"))return` ${h.value(e.trim())}`;return e}).join(`
|
|
156
156
|
`);console.info(o);return}console.info(`
|
|
157
|
-
${h.bold(`Hydra@${
|
|
157
|
+
${h.bold(`Hydra@${zt} - GitHub self-hosted runner manager`)}
|
|
158
158
|
|
|
159
159
|
${h.bold("USAGE")}
|
|
160
160
|
hydra <command> [options]
|
|
161
161
|
|
|
162
162
|
${h.bold("COMMANDS")}
|
|
163
|
-
${h.
|
|
164
|
-
${h.
|
|
165
|
-
${h.
|
|
166
|
-
${h.
|
|
167
|
-
${h.
|
|
168
|
-
${h.
|
|
169
|
-
|
|
170
|
-
Use ${h.
|
|
171
|
-
`)}import{resolve as
|
|
172
|
-
${c}`});if(
|
|
173
|
-
${l}`});if(
|
|
174
|
-
`).filter(Boolean)},{fallback:()=>{},logLevel:"debug",message:"No local runners found"})||[]}async function
|
|
163
|
+
${h.command("init")} Initialize a new Hydra configuration file
|
|
164
|
+
${h.command("create")} Create and register new GitHub runner machines
|
|
165
|
+
${h.command("run")} Start existing GitHub runner machines
|
|
166
|
+
${h.command("remove")} Remove GitHub runner machines
|
|
167
|
+
${h.command("status")} Check the status of GitHub runner machines
|
|
168
|
+
${h.command("help")} Show this help message
|
|
169
|
+
|
|
170
|
+
Use ${h.value("hydra <command> --help")} for more information about a command.
|
|
171
|
+
`)}import{resolve as fo}from"path";import{parseArgs as mo}from"util";var{$:Jn}=globalThis.Bun;var D=O({prefix:"hydra"}).child("init");async function Jt(){let{toml:t}=po(),r=t?"hydra.toml":"hydra.json",o=fo(process.cwd(),r);if(await Bun.file(o).exists()){let m=await z({initialValue:!1,message:`Configuration file ${r} already exists. Overwrite?`});if(T(m)||!m)jn("Configuration cancelled"),process.exit(0)}$t(b.cyan("\uD83D\uDE80 Hydra Configuration Setup")),D.info("This will create a configuration file with your runner settings."),D.info("You can always edit the file later or create additional profiles.");let i=await Rt({profileName:()=>P({message:"Profile name?",placeholder:"default"}),directory:()=>P({defaultValue:"./gh-runners",message:"Directory to store runners?",placeholder:"./gh-runners"}),name:()=>P({defaultValue:"runner",message:"Runner name prefix?",placeholder:"runner"}),labels:({results:m})=>{let p=m.name||"runner";return P({defaultValue:p,message:"Runner labels (comma-separated)?",placeholder:p})},numberOfMachines:()=>P({defaultValue:"1",message:"Number of runner machines?",placeholder:"1",validate:(m)=>{let p=Number.parseInt(m,10);if(Number.isNaN(p)||p<1)return"Please enter a valid number greater than 0";return}}),url:()=>P({message:"GitHub repository or organization URL? (optional)",placeholder:"https://github.com/org/repo"})},{onCancel:()=>{jn("Configuration cancelled"),process.exit(0)}}),{profileName:s,labels:n,numberOfMachines:a,...c}=i,l={defaultProfile:s,profiles:{[s]:{...c,labels:n,numberOfMachines:Number.parseInt(a,10),os:"osx",overwrite:!1,run:!1}}},f=JSON.stringify(l,null,2);if(await Bun.write(o,f),await tn(async()=>{await Jn`chmod 600 ${o}`.quiet()},{logLevel:"warn",message:"Could not set secure file permissions"}),wt(b.green(`\u2713 Configuration saved to ${r}`)),D.info("Example usage:"),D.info(` hydra create -p ${s} --token YOUR_TOKEN${i.url?"":" --url REPO_URL"}`),D.info("You can add more profiles by editing the configuration file."),i.url)await lo(i.url)}async function lo(t){let r=/github\.com[:/]([^/]+)(?:\/([^/.]+))?/,o=t.match(r);if(!o)return;let[,e,i]=o,n=`https://github.com/${i?`${e}/${i}`:`organizations/${e}`}/settings/actions/runners`;D.info(`Opening GitHub settings: ${n}`),await tn(async()=>{await Jn`open ${n}`.quiet()},{fallback:async()=>{await tn(async()=>{await Jn`xdg-open ${n}`.quiet()},{fallback:()=>{D.info("Please open the URL manually to add a new runner token.")},logLevel:"info",message:"Alternative browser open method also failed"})},logLevel:"info",message:"Could not open browser automatically"})}function po(){let{values:t}=mo({allowPositionals:!0,args:Bun.argv,options:{toml:{default:!1,short:"t",type:"boolean"}},strict:!0});return t}import{parseArgs as go}from"util";var{$:nn}=globalThis.Bun;var _=O({prefix:"hydra"}).child("remove");async function Yt(){let t=await uo(),{directory:r,numberOfMachines:o,force:e}=t,{token:i,url:s}=t,n=`${r}/machines`;if(!await Bun.file(n).exists())throw new Error(`Machines directory not found at ${n}. Nothing to remove.`);if(!i&&!e){if(!s)throw _.warn("No token or URL provided. Runners will not be unregistered from GitHub."),_.warn("Use --force to remove runners without unregistering them."),new Error("Token (-t) and URL (-u) parameters are required or use --force");let c=yo(s),l=await z({message:`No token provided. Would you like to open GitHub to get a runner token for unregistration?
|
|
172
|
+
${c}`});if(T(l)||!l)throw _.warn("Use --force to remove runners without unregistering them."),new Error("Token is required to unregister runners (or use --force)");_.info("Opening GitHub runner settings..."),await nn`open ${c}`.quiet();let f=await P({message:"Enter the runner removal token:",placeholder:"AXXXXXXXXXXXXXXXXXXXXXXXXX",validate:(m)=>{if(!m||m.trim().length===0)return"Token is required";return}});if(T(f))throw _.warn("Use --force to remove runners without unregistering them."),new Error("Token is required to unregister runners (or use --force)");i=f.trim()}if(i&&s)_.info("Unregistering runners from GitHub..."),await ho({directory:r,numberOfMachines:o,token:i});else if(!e)throw _.warn("No token or URL provided. Runners will not be unregistered from GitHub."),_.warn("Use --force to remove runners without unregistering them."),new Error("Token (-t) and URL (-u) parameters are required or use --force");await bo({directory:r,numberOfMachines:o}),_.info("Runners successfully removed")}async function uo(){let{values:t}=go({allowPositionals:!0,args:Bun.argv,options:{config:{short:"c",type:"string"},directory:{default:`${process.cwd()}/gh-runners`,short:"d",type:"string"},force:{default:!1,short:"f",type:"boolean"},numberOfMachines:{default:"1",short:"m",type:"string"},profile:{short:"p",type:"string"},token:{short:"t",type:"string"},url:{short:"u",type:"string"}},strict:!0}),r=await K({configPath:t.config}),o=await J(r,t.profile),e={directory:t.directory,force:t.force,numberOfMachines:t.numberOfMachines,token:t.token,url:t.url};if(o)return{directory:e.directory??o.directory??`${process.cwd()}/gh-runners`,force:e.force,numberOfMachines:e.numberOfMachines??String(o.numberOfMachines)??"1",token:e.token,url:e.url??o.url};return e}async function ho({directory:t,numberOfMachines:r,token:o}){let e=_.child("unregister"),i=Number(r),s=(()=>{try{let p=Bun.spawnSync(["nproc"]);return Number.parseInt(p.stdout.toString().trim(),10)||4}catch{try{let p=Bun.spawnSync(["sysctl","-n","hw.ncpu"]);return Number.parseInt(p.stdout.toString().trim(),10)||4}catch{return 4}}})(),n=Math.min(Math.max(2,Math.floor(s/2)),i,8);e.info(`Unregistering ${i} runners with concurrency of ${n}`);let a=Array.from({length:i},(p,d)=>d+1).map((p)=>({execute:async()=>{let d=`${t}/machines/${p}`;if(!await Bun.file(d).exists())return e.debug(`Machine ${p} doesn't exist, skipping...`),{runnerIndex:p,status:"skipped"};try{return e.debug(`Unregistering machine ${p}...`),await nn`${d}/config.sh remove --token ${o}`.quiet(),e.info(`Successfully unregistered machine ${p} from GitHub`),{runnerIndex:p,status:"success"}}catch(E){return e.warn(`Unable to unregister machine ${p}: ${E}`),{error:E,runnerIndex:p,status:"failed"}}},runnerIndex:p})),c=[];for(let p=0;p<a.length;p+=n){let d=a.slice(p,p+n),u=await Promise.allSettled(d.map((E)=>E.execute()));c.push(...u)}let l=c.filter((p)=>p.status==="fulfilled"&&p.value?.status==="success").length,f=c.filter((p)=>p.status==="fulfilled"&&p.value?.status==="failed").length,m=c.filter((p)=>p.status==="fulfilled"&&p.value?.status==="skipped").length;e.info(`Unregistration complete: ${l} successful, ${f} failed, ${m} skipped`)}async function bo({directory:t,numberOfMachines:r}){let o=_.child("removeDirectories"),e=Number(r),i=Array.from({length:e},(c,l)=>l+1).map((c)=>({execute:async()=>{let l=`${t}/machines/${c}`;if(!await Bun.file(l).exists())return{runnerIndex:c,status:"skipped"};try{return await nn`rm -rf ${l}`.quiet(),o.debug(`Removed machine ${c} directory`),{runnerIndex:c,status:"success"}}catch(m){return o.error(`Error removing machine ${c} directory: ${m}`),{error:m,runnerIndex:c,status:"failed"}}},runnerIndex:c})),s=await Promise.allSettled(i.map((c)=>c.execute())),n=s.filter((c)=>c.status==="fulfilled"&&c.value?.status==="success").length,a=s.filter((c)=>c.status==="fulfilled"&&c.value?.status==="failed").length;if(o.info(`Directory removal complete: ${n} removed, ${a} failed`),a>0)throw new Error(`Failed to remove ${a} runner directories`);try{let c=`${t}/machines`;if(!(await nn`ls -A ${c}`.text()).trim()){if(await nn`rm -rf ${c}`.quiet(),!(await nn`ls -A ${t}`.text()).trim())await nn`rm -rf ${t}`.quiet();_.info("Removed empty directories")}}catch(c){}}function yo(t){try{let r=new URL(t),o=r.pathname.split("/").filter(Boolean);if(r.hostname==="github.com"||r.hostname==="www.github.com"){if(o[0]==="orgs"&&o[1])return`https://github.com/organizations/${o[1]}/settings/actions/runners`;else if(o.length>=2)return`https://github.com/${o[0]}/${o[1]}/settings/actions/runners`}else if(o[0]==="orgs"&&o[1])return`${r.origin}/organizations/${o[1]}/settings/actions/runners`;else if(o.length>=2)return`${r.origin}/${o[0]}/${o[1]}/settings/actions/runners`;return t}catch{return t}}import{parseArgs as xo}from"util";var{$:$o}=globalThis.Bun;var L=O({prefix:"runMachines"});async function Qt(){let t=await wo(),{directory:r,numberOfMachines:o,name:e,labels:i,runnerGroup:s}=t,{token:n,url:a}=t;if(!a)throw new Error("URL (-u) parameter is required");if(!n){let l=Ro(a),f=await z({message:`No token provided. Would you like to open GitHub to get a runner token?
|
|
173
|
+
${l}`});if(T(f)||!f)throw new Error("Token is required to run machines");L.info("Opening GitHub runner settings..."),await $o`open ${l}`.quiet();let m=await P({message:"Enter the runner registration token:",placeholder:"AXXXXXXXXXXXXXXXXXXXXXXXXX",validate:(p)=>{if(!p||p.trim().length===0)return"Token is required";return}});if(T(m))throw new Error("Token is required to run machines");n=m.trim()}if(L.info(`Starting ${o} runners from ${r}`),L.debug(`Name: ${e}, Labels: ${i||"none"}`),!await Bun.file(`${r}/machines`).exists())throw new Error(`Machines directory not found at ${r}/machines. Run 'hydra create' first.`);await Eo({directory:r,labels:i,name:e,numberOfMachines:o,runnerGroup:s,token:n,url:a})}async function wo(){let{values:t}=xo({allowPositionals:!0,args:Bun.argv,options:{config:{short:"c",type:"string"},directory:{default:`${process.cwd()}/gh-runners`,short:"d",type:"string"},labels:{short:"l",type:"string"},name:{default:"runner",short:"n",type:"string"},numberOfMachines:{default:"1",short:"m",type:"string"},profile:{short:"p",type:"string"},runnerGroup:{short:"g",type:"string"},token:{short:"t",type:"string"},url:{short:"u",type:"string"}},strict:!0}),r=await K({configPath:t.config}),o=await J(r,t.profile),e={directory:t.directory,labels:t.labels,name:t.name,numberOfMachines:t.numberOfMachines,runnerGroup:t.runnerGroup,token:t.token,url:t.url};if(o)return{directory:e.directory??o.directory??`${process.cwd()}/gh-runners`,labels:e.labels??o.labels,name:e.name??o.name??"runner",numberOfMachines:e.numberOfMachines??String(o.numberOfMachines)??"1",runnerGroup:e.runnerGroup??o.runnerGroup,token:e.token,url:e.url??o.url};return e}async function Eo({directory:t,numberOfMachines:r,token:o,url:e,name:i,labels:s,runnerGroup:n}){L.info(`Starting ${r} workers...`);for(let a=1;a<=Number(r);a++){let c=`${t}/machines/${a}`;if(!await Bun.file(c).exists()){L.warn(`Machine ${a} doesn't exist, skipping...`);continue}let f=`${ln()}/src/runner-worker.ts`,m=`${i}-${a}`,p=new Worker(f,{name:m,ref:!0});p.addEventListener("message",({data:d})=>{let u=d.type==="error"?"error":"info";L[u](`${m}: ${d.message}`)}),p.addEventListener("error",(d)=>{L.error(`Worker ${m} error:`,d)}),p.addEventListener("exit",(d)=>{L.info(`Worker ${m} exited with code ${d}`)}),p.postMessage({index:a,labels:s,machineCwd:c,name:i,runnerGroup:n,token:o,url:e}),L.info(`Worker ${m} starting...`),Sn.add(p)}L.info("All workers started. Press Ctrl+C to stop all machines")}function Ro(t){try{let r=new URL(t),o=r.pathname.split("/").filter(Boolean);if(r.hostname==="github.com"||r.hostname==="www.github.com"){if(o[0]==="orgs"&&o[1])return`https://github.com/organizations/${o[1]}/settings/actions/runners/new`;else if(o.length>=2)return`https://github.com/${o[0]}/${o[1]}/settings/actions/runners/new`}else if(o[0]==="orgs"&&o[1])return`${r.origin}/organizations/${o[1]}/settings/actions/runners/new`;else if(o.length>=2)return`${r.origin}/${o[0]}/${o[1]}/settings/actions/runners/new`;return t}catch{return t}}import{parseArgs as Oo}from"util";var{$:So}=globalThis.Bun;var en=O({prefix:"hydra"}).child("status");async function Zt(){let t=await Co(),{directory:r,token:o,url:e,json:i}=t;if(!o||!e)throw new Error("Token (-t) and URL (-u) parameters are required");let s=Et();s.start("Fetching runner status...");try{let n=await To(r),a=await ko(e,o),c=No(n,a);if(s.stop("Runner status fetched"),i)en.info(JSON.stringify(c,null,2));else vo(c)}catch(n){throw s.stop("Failed to fetch runner status"),n}}async function Co(){let{values:t}=Oo({allowPositionals:!0,args:Bun.argv,options:{config:{short:"c",type:"string"},directory:{default:`${process.cwd()}/gh-runners`,short:"d",type:"string"},json:{default:!1,short:"j",type:"boolean"},profile:{short:"p",type:"string"},token:{short:"t",type:"string"},url:{short:"u",type:"string"}},strict:!0}),r=await K({configPath:t.config}),o=await J(r,t.profile);return{directory:t.directory||o?.directory||`${process.cwd()}/gh-runners`,json:t.json,token:t.token,url:t.url||o?.url}}async function To(t){let r=`${t}/machines`;return await tn(async()=>{return(await So`ls ${r} 2>/dev/null || true`.quiet()).stdout.toString().trim().split(`
|
|
174
|
+
`).filter(Boolean)},{fallback:()=>{},logLevel:"debug",message:"No local runners found"})||[]}async function ko(t,r){let o=t.match(/github\.com[:/]([^/]+)(?:\/([^/.]+))?/);if(!o)throw new Error("Invalid GitHub URL");let[,e,i]=o,s=i?`https://api.github.com/repos/${e}/${i}/actions/runners`:`https://api.github.com/orgs/${e}/actions/runners`;return cn(async()=>{let n={Accept:"application/vnd.github.v3+json",Authorization:`Bearer ${r}`},a=await fetch(s,{headers:n});if(!a.ok)throw new Error(`GitHub API error: ${a.status} ${a.statusText}`);return await a.json()},{onRetry:(n,a)=>{U.warn(`Retrying GitHub API call (attempt ${n}): ${a.message}`)}})}function No(t,r){let o=[],e=new Map(r.runners.map((i)=>[i.name,i]));for(let i of t){let s=`runner-${i}`,n=e.get(s);if(n)o.push({busy:n.busy,labels:n.labels.map((a)=>a.name),name:s,os:n.os,status:n.busy?"busy":n.status==="online"?"online":"offline"});else o.push({busy:!1,labels:[],name:s,os:"unknown",status:"offline"})}return o}function vo(t){if(t.length===0){U.info("No runners found");return}en.info("Runner Status:"),en.info("\u2500".repeat(80));let r={busy:h.busy,offline:h.offline,online:h.online};for(let e of t){let i=r[e.status],s=e.status.toUpperCase().padEnd(7);en.info(`${i("\u25CF")} ${i(s)} ${h.value(e.name.padEnd(20))} ${h.dim(`OS: ${e.os.padEnd(10)}`)} ${e.labels.length>0?h.dim(`Labels: ${e.labels.join(", ")}`):""}`)}en.info("\u2500".repeat(80));let o={busy:t.filter((e)=>e.status==="busy").length,offline:t.filter((e)=>e.status==="offline").length,online:t.filter((e)=>e.status==="online").length,total:t.length};en.info(`Summary: Total: ${o.total} | ${h.online(`Online: ${o.online}`)} | ${h.busy(`Busy: ${o.busy}`)} | ${h.offline(`Offline: ${o.offline}`)}`)}var Cn=["init","create","run","remove","status","help"],Tn=O({prefix:"hydra"}),Po={c:"create",ceate:"create",craete:"create",cretae:"create",del:"remove",delete:"remove",h:"help",i:"init",info:"status",initialise:"init",inti:"init",intialize:"init",list:"status",ls:"status",new:"create",r:"run",remvoe:"remove",rm:"remove",rmove:"remove",rnu:"run",runn:"run",s:"status",start:"run",stat:"status",stop:"remove",sttaus:"status",t:"troubleshoot"};async function Go(){try{let[,,t,...r]=process.argv;if(!t||t==="--help"||t==="-h")pn(),process.exit(0);let o=t;if(!Cn.includes(t)){let e=kt(t,Po);if(e&&Cn.includes(e))o=e,Tn.warn(`Assuming you meant '${e}'`)}if(!Cn.includes(o)){Tn.error(`Unknown command: ${t}`);let e=Tt(t,Cn);if(e.length>0){Tn.error("Did you mean one of these?");for(let i of e)Tn.error(` ${i}`)}pn(),process.exit(1)}if(r.includes("--help")||r.includes("-h"))pn(o),process.exit(0);switch(o){case"init":await Jt();break;case"create":await Wt();break;case"run":await Qt();break;case"remove":await Yt();break;case"status":await Zt();break;case"help":{let e=r[0];pn(e);break}default:throw new Error(`Unknown command: ${o}`)}process.exit(0)}catch(t){let r=t instanceof Error?t:new Error(String(t));U.error(r.message),process.exit(1)}}await Go();
|
package/package.json
CHANGED