agentica 0.14.0 → 0.14.2
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/dist/index.mjs +93 -0
- package/package.json +2 -1
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import w,{stdin as ke,stdout as Pe}from"node:process";import{promisify as Ct}from"node:util";import*as K from"node:readline";import Te from"node:readline";import{WriteStream as ft}from"node:tty";import gt from"events";import Et from"child_process";import bt from"path";import At from"fs";import _t from"process";import{existsSync as De}from"node:fs";import{rm as Bt,appendFile as vt,readFile as oe,writeFile as ae}from"node:fs/promises";import{join as N}from"node:path";import{exec as $t}from"node:child_process";import{downloadTemplate as yt}from"giget";function Ve(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}function wt(i){if(Object.prototype.hasOwnProperty.call(i,"__esModule"))return i;var t=i.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(i).forEach(function(r){var s=Object.getOwnPropertyDescriptor(i,r);Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:function(){return i[r]}})}),n}var le,Ie;function xt(){if(Ie)return le;Ie=1;const i="\x1B",t=`${i}[`,n="\x07",r={to(e,a){return a?`${t}${a+1};${e+1}H`:`${t}${e+1}G`},move(e,a){let h="";return e<0?h+=`${t}${-e}D`:e>0&&(h+=`${t}${e}C`),a<0?h+=`${t}${-a}A`:a>0&&(h+=`${t}${a}B`),h},up:(e=1)=>`${t}${e}A`,down:(e=1)=>`${t}${e}B`,forward:(e=1)=>`${t}${e}C`,backward:(e=1)=>`${t}${e}D`,nextLine:(e=1)=>`${t}E`.repeat(e),prevLine:(e=1)=>`${t}F`.repeat(e),left:`${t}G`,hide:`${t}?25l`,show:`${t}?25h`,save:`${i}7`,restore:`${i}8`},s={up:(e=1)=>`${t}S`.repeat(e),down:(e=1)=>`${t}T`.repeat(e)},D={screen:`${t}2J`,up:(e=1)=>`${t}1J`.repeat(e),down:(e=1)=>`${t}J`.repeat(e),line:`${t}2K`,lineEnd:`${t}K`,lineStart:`${t}1K`,lines(e){let a="";for(let h=0;h<e;h++)a+=this.line+(h<e-1?r.up():"");return e&&(a+=r.left),a}};return le={cursor:r,scroll:s,erase:D,beep:n},le}var j=xt(),U={exports:{}},Me;function Ot(){if(Me)return U.exports;Me=1;let i=process||{},t=i.argv||[],n=i.env||{},r=!(n.NO_COLOR||t.includes("--no-color"))&&(!!n.FORCE_COLOR||t.includes("--color")||i.platform==="win32"||(i.stdout||{}).isTTY&&n.TERM!=="dumb"||!!n.CI),s=(a,h,d=a)=>g=>{let f=""+g,_=f.indexOf(h,a.length);return~_?a+D(f,h,d,_)+h:a+f+h},D=(a,h,d,g)=>{let f="",_=0;do f+=a.substring(_,g)+d,_=g+h.length,g=a.indexOf(h,_);while(~g);return f+a.substring(_)},e=(a=r)=>{let h=a?s:()=>String;return{isColorSupported:a,reset:h("\x1B[0m","\x1B[0m"),bold:h("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:h("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:h("\x1B[3m","\x1B[23m"),underline:h("\x1B[4m","\x1B[24m"),inverse:h("\x1B[7m","\x1B[27m"),hidden:h("\x1B[8m","\x1B[28m"),strikethrough:h("\x1B[9m","\x1B[29m"),black:h("\x1B[30m","\x1B[39m"),red:h("\x1B[31m","\x1B[39m"),green:h("\x1B[32m","\x1B[39m"),yellow:h("\x1B[33m","\x1B[39m"),blue:h("\x1B[34m","\x1B[39m"),magenta:h("\x1B[35m","\x1B[39m"),cyan:h("\x1B[36m","\x1B[39m"),white:h("\x1B[37m","\x1B[39m"),gray:h("\x1B[90m","\x1B[39m"),bgBlack:h("\x1B[40m","\x1B[49m"),bgRed:h("\x1B[41m","\x1B[49m"),bgGreen:h("\x1B[42m","\x1B[49m"),bgYellow:h("\x1B[43m","\x1B[49m"),bgBlue:h("\x1B[44m","\x1B[49m"),bgMagenta:h("\x1B[45m","\x1B[49m"),bgCyan:h("\x1B[46m","\x1B[49m"),bgWhite:h("\x1B[47m","\x1B[49m"),blackBright:h("\x1B[90m","\x1B[39m"),redBright:h("\x1B[91m","\x1B[39m"),greenBright:h("\x1B[92m","\x1B[39m"),yellowBright:h("\x1B[93m","\x1B[39m"),blueBright:h("\x1B[94m","\x1B[39m"),magentaBright:h("\x1B[95m","\x1B[39m"),cyanBright:h("\x1B[96m","\x1B[39m"),whiteBright:h("\x1B[97m","\x1B[39m"),bgBlackBright:h("\x1B[100m","\x1B[49m"),bgRedBright:h("\x1B[101m","\x1B[49m"),bgGreenBright:h("\x1B[102m","\x1B[49m"),bgYellowBright:h("\x1B[103m","\x1B[49m"),bgBlueBright:h("\x1B[104m","\x1B[49m"),bgMagentaBright:h("\x1B[105m","\x1B[49m"),bgCyanBright:h("\x1B[106m","\x1B[49m"),bgWhiteBright:h("\x1B[107m","\x1B[49m")}};return U.exports=e(),U.exports.createColors=e,U.exports}var T=Ot();const m=Ve(T);function St({onlyFirst:i=!1}={}){const t=["[\\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(t,i?void 0:"g")}const jt=St();function Ne(i){if(typeof i!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof i}\``);return i.replace(jt,"")}function He(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Re={exports:{}};(function(i){var t={};i.exports=t,t.eastAsianWidth=function(r){var s=r.charCodeAt(0),D=r.length==2?r.charCodeAt(1):0,e=s;return 55296<=s&&s<=56319&&56320<=D&&D<=57343&&(s&=1023,D&=1023,e=s<<10|D,e+=65536),e==12288||65281<=e&&e<=65376||65504<=e&&e<=65510?"F":e==8361||65377<=e&&e<=65470||65474<=e&&e<=65479||65482<=e&&e<=65487||65490<=e&&e<=65495||65498<=e&&e<=65500||65512<=e&&e<=65518?"H":4352<=e&&e<=4447||4515<=e&&e<=4519||4602<=e&&e<=4607||9001<=e&&e<=9002||11904<=e&&e<=11929||11931<=e&&e<=12019||12032<=e&&e<=12245||12272<=e&&e<=12283||12289<=e&&e<=12350||12353<=e&&e<=12438||12441<=e&&e<=12543||12549<=e&&e<=12589||12593<=e&&e<=12686||12688<=e&&e<=12730||12736<=e&&e<=12771||12784<=e&&e<=12830||12832<=e&&e<=12871||12880<=e&&e<=13054||13056<=e&&e<=19903||19968<=e&&e<=42124||42128<=e&&e<=42182||43360<=e&&e<=43388||44032<=e&&e<=55203||55216<=e&&e<=55238||55243<=e&&e<=55291||63744<=e&&e<=64255||65040<=e&&e<=65049||65072<=e&&e<=65106||65108<=e&&e<=65126||65128<=e&&e<=65131||110592<=e&&e<=110593||127488<=e&&e<=127490||127504<=e&&e<=127546||127552<=e&&e<=127560||127568<=e&&e<=127569||131072<=e&&e<=194367||177984<=e&&e<=196605||196608<=e&&e<=262141?"W":32<=e&&e<=126||162<=e&&e<=163||165<=e&&e<=166||e==172||e==175||10214<=e&&e<=10221||10629<=e&&e<=10630?"Na":e==161||e==164||167<=e&&e<=168||e==170||173<=e&&e<=174||176<=e&&e<=180||182<=e&&e<=186||188<=e&&e<=191||e==198||e==208||215<=e&&e<=216||222<=e&&e<=225||e==230||232<=e&&e<=234||236<=e&&e<=237||e==240||242<=e&&e<=243||247<=e&&e<=250||e==252||e==254||e==257||e==273||e==275||e==283||294<=e&&e<=295||e==299||305<=e&&e<=307||e==312||319<=e&&e<=322||e==324||328<=e&&e<=331||e==333||338<=e&&e<=339||358<=e&&e<=359||e==363||e==462||e==464||e==466||e==468||e==470||e==472||e==474||e==476||e==593||e==609||e==708||e==711||713<=e&&e<=715||e==717||e==720||728<=e&&e<=731||e==733||e==735||768<=e&&e<=879||913<=e&&e<=929||931<=e&&e<=937||945<=e&&e<=961||963<=e&&e<=969||e==1025||1040<=e&&e<=1103||e==1105||e==8208||8211<=e&&e<=8214||8216<=e&&e<=8217||8220<=e&&e<=8221||8224<=e&&e<=8226||8228<=e&&e<=8231||e==8240||8242<=e&&e<=8243||e==8245||e==8251||e==8254||e==8308||e==8319||8321<=e&&e<=8324||e==8364||e==8451||e==8453||e==8457||e==8467||e==8470||8481<=e&&e<=8482||e==8486||e==8491||8531<=e&&e<=8532||8539<=e&&e<=8542||8544<=e&&e<=8555||8560<=e&&e<=8569||e==8585||8592<=e&&e<=8601||8632<=e&&e<=8633||e==8658||e==8660||e==8679||e==8704||8706<=e&&e<=8707||8711<=e&&e<=8712||e==8715||e==8719||e==8721||e==8725||e==8730||8733<=e&&e<=8736||e==8739||e==8741||8743<=e&&e<=8748||e==8750||8756<=e&&e<=8759||8764<=e&&e<=8765||e==8776||e==8780||e==8786||8800<=e&&e<=8801||8804<=e&&e<=8807||8810<=e&&e<=8811||8814<=e&&e<=8815||8834<=e&&e<=8835||8838<=e&&e<=8839||e==8853||e==8857||e==8869||e==8895||e==8978||9312<=e&&e<=9449||9451<=e&&e<=9547||9552<=e&&e<=9587||9600<=e&&e<=9615||9618<=e&&e<=9621||9632<=e&&e<=9633||9635<=e&&e<=9641||9650<=e&&e<=9651||9654<=e&&e<=9655||9660<=e&&e<=9661||9664<=e&&e<=9665||9670<=e&&e<=9672||e==9675||9678<=e&&e<=9681||9698<=e&&e<=9701||e==9711||9733<=e&&e<=9734||e==9737||9742<=e&&e<=9743||9748<=e&&e<=9749||e==9756||e==9758||e==9792||e==9794||9824<=e&&e<=9825||9827<=e&&e<=9829||9831<=e&&e<=9834||9836<=e&&e<=9837||e==9839||9886<=e&&e<=9887||9918<=e&&e<=9919||9924<=e&&e<=9933||9935<=e&&e<=9953||e==9955||9960<=e&&e<=9983||e==10045||e==10071||10102<=e&&e<=10111||11093<=e&&e<=11097||12872<=e&&e<=12879||57344<=e&&e<=63743||65024<=e&&e<=65039||e==65533||127232<=e&&e<=127242||127248<=e&&e<=127277||127280<=e&&e<=127337||127344<=e&&e<=127386||917760<=e&&e<=917999||983040<=e&&e<=1048573||1048576<=e&&e<=1114109?"A":"N"},t.characterLength=function(r){var s=this.eastAsianWidth(r);return s=="F"||s=="W"||s=="A"?2:1};function n(r){return r.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}t.length=function(r){for(var s=n(r),D=0,e=0;e<s.length;e++)D=D+this.characterLength(s[e]);return D},t.slice=function(r,s,D){textLen=t.length(r),s=s||0,D=D||1,s<0&&(s=textLen+s),D<0&&(D=textLen+D);for(var e="",a=0,h=n(r),d=0;d<h.length;d++){var g=h[d],f=t.length(g);if(a>=s-(f==2?1:0))if(a+f<=D)e+=g;else break;a+=f}return e}})(Re);var kt=Re.exports;const Pt=He(kt);var Tt=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\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\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\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\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])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\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};const Vt=He(Tt);function W(i,t={}){if(typeof i!="string"||i.length===0||(t={ambiguousIsNarrow:!0,...t},i=Ne(i),i.length===0))return 0;i=i.replace(Vt()," ");const n=t.ambiguousIsNarrow?1:2;let r=0;for(const s of i){const D=s.codePointAt(0);if(!(D<=31||D>=127&&D<=159||D>=768&&D<=879))switch(Pt.eastAsianWidth(s)){case"F":case"W":r+=2;break;case"A":r+=n;break;default:r+=1}}return r}const ce=10,Ge=(i=0)=>t=>`\x1B[${t+i}m`,We=(i=0)=>t=>`\x1B[${38+i};5;${t}m`,Le=(i=0)=>(t,n,r)=>`\x1B[${38+i};2;${t};${n};${r}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);const It=Object.keys($.color),Mt=Object.keys($.bgColor);[...It,...Mt];function Nt(){const i=new Map;for(const[t,n]of Object.entries($)){for(const[r,s]of Object.entries(n))$[r]={open:`\x1B[${s[0]}m`,close:`\x1B[${s[1]}m`},n[r]=$[r],i.set(s[0],s[1]);Object.defineProperty($,t,{value:n,enumerable:!1})}return Object.defineProperty($,"codes",{value:i,enumerable:!1}),$.color.close="\x1B[39m",$.bgColor.close="\x1B[49m",$.color.ansi=Ge(),$.color.ansi256=We(),$.color.ansi16m=Le(),$.bgColor.ansi=Ge(ce),$.bgColor.ansi256=We(ce),$.bgColor.ansi16m=Le(ce),Object.defineProperties($,{rgbToAnsi256:{value:(t,n,r)=>t===n&&n===r?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(r/255*5),enumerable:!1},hexToRgb:{value:t=>{const n=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!n)return[0,0,0];let[r]=n;r.length===3&&(r=[...r].map(D=>D+D).join(""));const s=Number.parseInt(r,16);return[s>>16&255,s>>8&255,s&255]},enumerable:!1},hexToAnsi256:{value:t=>$.rgbToAnsi256(...$.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value:t=>{if(t<8)return 30+t;if(t<16)return 90+(t-8);let n,r,s;if(t>=232)n=((t-232)*10+8)/255,r=n,s=n;else{t-=16;const a=t%36;n=Math.floor(t/36)/5,r=Math.floor(a/6)/5,s=a%6/5}const D=Math.max(n,r,s)*2;if(D===0)return 30;let e=30+(Math.round(s)<<2|Math.round(r)<<1|Math.round(n));return D===2&&(e+=60),e},enumerable:!1},rgbToAnsi:{value:(t,n,r)=>$.ansi256ToAnsi($.rgbToAnsi256(t,n,r)),enumerable:!1},hexToAnsi:{value:t=>$.ansi256ToAnsi($.hexToAnsi256(t)),enumerable:!1}}),$}const Ht=Nt(),z=new Set(["\x1B","\x9B"]),Rt=39,he="\x07",qe="[",Gt="]",Ke="m",pe=`${Gt}8;;`,Ue=i=>`${z.values().next().value}${qe}${i}${Ke}`,ze=i=>`${z.values().next().value}${pe}${i}${he}`,Wt=i=>i.split(" ").map(t=>W(t)),me=(i,t,n)=>{const r=[...t];let s=!1,D=!1,e=W(Ne(i[i.length-1]));for(const[a,h]of r.entries()){const d=W(h);if(e+d<=n?i[i.length-1]+=h:(i.push(h),e=0),z.has(h)&&(s=!0,D=r.slice(a+1).join("").startsWith(pe)),s){D?h===he&&(s=!1,D=!1):h===Ke&&(s=!1);continue}e+=d,e===n&&a<r.length-1&&(i.push(""),e=0)}!e&&i[i.length-1].length>0&&i.length>1&&(i[i.length-2]+=i.pop())},Lt=i=>{const t=i.split(" ");let n=t.length;for(;n>0&&!(W(t[n-1])>0);)n--;return n===t.length?i:t.slice(0,n).join(" ")+t.slice(n).join("")},qt=(i,t,n={})=>{if(n.trim!==!1&&i.trim()==="")return"";let r="",s,D;const e=Wt(i);let a=[""];for(const[d,g]of i.split(" ").entries()){n.trim!==!1&&(a[a.length-1]=a[a.length-1].trimStart());let f=W(a[a.length-1]);if(d!==0&&(f>=t&&(n.wordWrap===!1||n.trim===!1)&&(a.push(""),f=0),(f>0||n.trim===!1)&&(a[a.length-1]+=" ",f++)),n.hard&&e[d]>t){const _=t-f,S=1+Math.floor((e[d]-_-1)/t);Math.floor((e[d]-1)/t)<S&&a.push(""),me(a,g,t);continue}if(f+e[d]>t&&f>0&&e[d]>0){if(n.wordWrap===!1&&f<t){me(a,g,t);continue}a.push("")}if(f+e[d]>t&&n.wordWrap===!1){me(a,g,t);continue}a[a.length-1]+=g}n.trim!==!1&&(a=a.map(d=>Lt(d)));const h=[...a.join(`
|
|
2
|
+
`)];for(const[d,g]of h.entries()){if(r+=g,z.has(g)){const{groups:_}=new RegExp(`(?:\\${qe}(?<code>\\d+)m|\\${pe}(?<uri>.*)${he})`).exec(h.slice(d).join(""))||{groups:{}};if(_.code!==void 0){const S=Number.parseFloat(_.code);s=S===Rt?void 0:S}else _.uri!==void 0&&(D=_.uri.length===0?void 0:_.uri)}const f=Ht.codes.get(Number(s));h[d+1]===`
|
|
3
|
+
`?(D&&(r+=ze("")),s&&f&&(r+=Ue(f))):g===`
|
|
4
|
+
`&&(s&&f&&(r+=Ue(s)),D&&(r+=ze(D)))}return r};function Ye(i,t,n){return String(i).normalize().replace(/\r\n/g,`
|
|
5
|
+
`).split(`
|
|
6
|
+
`).map(r=>qt(r,t,n)).join(`
|
|
7
|
+
`)}const Kt=["up","down","left","right","space","enter","cancel"],Y={actions:new Set(Kt),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]])};function de(i,t){if(typeof i=="string")return Y.aliases.get(i)===t;for(const n of i)if(n!==void 0&&de(n,t))return!0;return!1}function Ut(i,t){if(i===t)return;const n=i.split(`
|
|
8
|
+
`),r=t.split(`
|
|
9
|
+
`),s=[];for(let D=0;D<Math.max(n.length,r.length);D++)n[D]!==r[D]&&s.push(D);return s}const zt=globalThis.process.platform.startsWith("win"),Fe=Symbol("clack:cancel");function H(i){return i===Fe}function J(i,t){const n=i;n.isTTY&&n.setRawMode(t)}function Yt({input:i=ke,output:t=Pe,overwrite:n=!0,hideCursor:r=!0}={}){const s=K.createInterface({input:i,output:t,prompt:"",tabSize:1});K.emitKeypressEvents(i,s),i.isTTY&&i.setRawMode(!0);const D=(e,{name:a,sequence:h})=>{const d=String(e);if(de([d,a,h],"cancel")){r&&t.write(j.cursor.show),process.exit(0);return}if(!n)return;const g=a==="return"?0:-1,f=a==="return"?-1:0;K.moveCursor(t,g,f,()=>{K.clearLine(t,1,()=>{i.once("keypress",D)})})};return r&&t.write(j.cursor.hide),i.once("keypress",D),()=>{i.off("keypress",D),r&&t.write(j.cursor.show),i.isTTY&&!zt&&i.setRawMode(!1),s.terminal=!1,s.close()}}var Jt=Object.defineProperty,Zt=(i,t,n)=>t in i?Jt(i,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[t]=n,I=(i,t,n)=>(Zt(i,typeof t!="symbol"?t+"":t,n),n);class Z{constructor(t,n=!0){I(this,"input"),I(this,"output"),I(this,"_abortSignal"),I(this,"rl"),I(this,"opts"),I(this,"_render"),I(this,"_track",!1),I(this,"_prevFrame",""),I(this,"_subscribers",new Map),I(this,"_cursor",0),I(this,"state","initial"),I(this,"error",""),I(this,"value");const{input:r=ke,output:s=Pe,render:D,signal:e,...a}=t;this.opts=a,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=D.bind(this),this._track=n,this._abortSignal=e,this.input=r,this.output=s}unsubscribe(){this._subscribers.clear()}setSubscriber(t,n){const r=this._subscribers.get(t)??[];r.push(n),this._subscribers.set(t,r)}on(t,n){this.setSubscriber(t,{cb:n})}once(t,n){this.setSubscriber(t,{cb:n,once:!0})}emit(t,...n){const r=this._subscribers.get(t)??[],s=[];for(const D of r)D.cb(...n),D.once&&s.push(()=>r.splice(r.indexOf(D),1));for(const D of s)D()}prompt(){return new Promise((t,n)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),t(Fe);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}const r=new ft(0);r._write=(s,D,e)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,""),this._cursor=this.rl?.cursor??0,this.emit("value",this.value)),e()},this.input.pipe(r),this.rl=Te.createInterface({input:this.input,output:r,tabSize:2,prompt:"",escapeCodeTimeout:50}),Te.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),J(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(j.cursor.show),this.output.off("resize",this.render),J(this.input,!1),t(this.value)}),this.once("cancel",()=>{this.output.write(j.cursor.show),this.output.off("resize",this.render),J(this.input,!1),t(Fe)})})}onKeypress(t,n){if(this.state==="error"&&(this.state="active"),n?.name&&(!this._track&&Y.aliases.has(n.name)&&this.emit("cursor",Y.aliases.get(n.name)),Y.actions.has(n.name)&&this.emit("cursor",n.name)),t&&(t.toLowerCase()==="y"||t.toLowerCase()==="n")&&this.emit("confirm",t.toLowerCase()==="y"),t===" "&&this.opts.placeholder&&(this.value||(this.rl?.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),t&&this.emit("key",t.toLowerCase()),n?.name==="return"){if(this.opts.validate){const r=this.opts.validate(this.value);r&&(this.error=r instanceof Error?r.message:r,this.state="error",this.rl?.write(this.value))}this.state!=="error"&&(this.state="submit")}de([t,n?.name,n?.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(`
|
|
10
|
+
`),J(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){const t=Ye(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
|
|
11
|
+
`).length-1;this.output.write(j.cursor.move(-999,t*-1))}render(){const t=Ye(this._render(this)??"",process.stdout.columns,{hard:!0});if(t!==this._prevFrame){if(this.state==="initial")this.output.write(j.cursor.hide);else{const n=Ut(this._prevFrame,t);if(this.restoreCursor(),n&&n?.length===1){const r=n[0];this.output.write(j.cursor.move(0,r)),this.output.write(j.erase.lines(1));const s=t.split(`
|
|
12
|
+
`);this.output.write(s[r]),this._prevFrame=t,this.output.write(j.cursor.move(0,s.length-r-1));return}if(n&&n?.length>1){const r=n[0];this.output.write(j.cursor.move(0,r)),this.output.write(j.erase.down());const s=t.split(`
|
|
13
|
+
`).slice(r);this.output.write(s.join(`
|
|
14
|
+
`)),this._prevFrame=t;return}this.output.write(j.erase.down())}this.output.write(t),this.state==="initial"&&(this.state="active"),this._prevFrame=t}}}class Qt extends Z{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",n=>{this.output.write(j.cursor.move(0,-1)),this.value=n,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}var Xt=Object.defineProperty,eu=(i,t,n)=>t in i?Xt(i,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[t]=n,Je=(i,t,n)=>(eu(i,typeof t!="symbol"?t+"":t,n),n);let tu=class extends Z{constructor(i){super(i,!1),Je(this,"options"),Je(this,"cursor",0),this.options=i.options,this.value=[...i.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:t})=>t===i.cursorAt),0),this.on("key",t=>{t==="a"&&this.toggleAll()}),this.on("cursor",t=>{switch(t){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break;case"space":this.toggleValue();break}})}get _value(){return this.options[this.cursor].value}toggleAll(){const i=this.value.length===this.options.length;this.value=i?[]:this.options.map(t=>t.value)}toggleValue(){const i=this.value.includes(this._value);this.value=i?this.value.filter(t=>t!==this._value):[...this.value,this._value]}};var uu=Object.defineProperty,ru=(i,t,n)=>t in i?uu(i,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[t]=n,Ze=(i,t,n)=>(ru(i,typeof t!="symbol"?t+"":t,n),n);class su extends Z{constructor(t){super(t,!1),Ze(this,"options"),Ze(this,"cursor",0),this.options=t.options,this.cursor=this.options.findIndex(({value:n})=>n===t.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",n=>{switch(n){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}}class iu extends Z{get valueWithCursor(){if(this.state==="submit")return this.value;if(this.cursor>=this.value.length)return`${this.value}\u2588`;const t=this.value.slice(0,this.cursor),[n,...r]=this.value.slice(this.cursor);return`${t}${m.inverse(n)}${r.join("")}`}get cursor(){return this._cursor}constructor(t){super(t),this.on("finalize",()=>{this.value||(this.value=t.defaultValue)})}}function nu(){return w.platform!=="win32"?w.env.TERM!=="linux":!!w.env.CI||!!w.env.WT_SESSION||!!w.env.TERMINUS_SUBLIME||w.env.ConEmuTask==="{cmd::Cmder}"||w.env.TERM_PROGRAM==="Terminus-Sublime"||w.env.TERM_PROGRAM==="vscode"||w.env.TERM==="xterm-256color"||w.env.TERM==="alacritty"||w.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}const Ce=nu(),k=(i,t)=>Ce?i:t,Du=k("\u25C6","*"),Qe=k("\u25A0","x"),Xe=k("\u25B2","x"),fe=k("\u25C7","o"),ou=k("\u250C","T"),B=k("\u2502","|"),R=k("\u2514","\u2014"),ge=k("\u25CF",">"),Ee=k("\u25CB"," "),au=k("\u25FB","[\u2022]"),et=k("\u25FC","[+]"),lu=k("\u25FB","[ ]"),cu=k("\u25CF","\u2022"),hu=k("\u25C6","*"),pu=k("\u25B2","!"),mu=k("\u25A0","x"),Q=i=>{switch(i){case"initial":case"active":return m.cyan(Du);case"cancel":return m.red(Qe);case"error":return m.yellow(Xe);case"submit":return m.green(fe)}},be=i=>{const{cursor:t,options:n,style:r}=i,s=i.maxItems??Number.POSITIVE_INFINITY,D=Math.max(process.stdout.rows-4,0),e=Math.min(D,Math.max(s,5));let a=0;t>=a+e-3?a=Math.max(Math.min(t-e+3,n.length-e),0):t<a+2&&(a=Math.max(t-2,0));const h=e<n.length&&a>0,d=e<n.length&&a+e<n.length;return n.slice(a,a+e).map((g,f,_)=>{const S=f===0&&h,V=f===_.length-1&&d;return S||V?m.dim("..."):r(g,f+a===t)})},Ae=i=>new iu({validate:i.validate,placeholder:i.placeholder,defaultValue:i.defaultValue,initialValue:i.initialValue,render(){const t=`${m.gray(B)}
|
|
15
|
+
${Q(this.state)} ${i.message}
|
|
16
|
+
`,n=i.placeholder?m.inverse(i.placeholder[0])+m.dim(i.placeholder.slice(1)):m.inverse(m.hidden("_")),r=this.value?this.valueWithCursor:n;switch(this.state){case"error":return`${t.trim()}
|
|
17
|
+
${m.yellow(B)} ${r}
|
|
18
|
+
${m.yellow(R)} ${m.yellow(this.error)}
|
|
19
|
+
`;case"submit":return`${t}${m.gray(B)} ${m.dim(this.value||i.placeholder)}`;case"cancel":return`${t}${m.gray(B)} ${m.strikethrough(m.dim(this.value??""))}${this.value?.trim()?`
|
|
20
|
+
${m.gray(B)}`:""}`;default:return`${t}${m.cyan(B)} ${r}
|
|
21
|
+
${m.cyan(R)}
|
|
22
|
+
`}}}).prompt(),du=i=>{const t=i.active??"Yes",n=i.inactive??"No";return new Qt({active:t,inactive:n,initialValue:i.initialValue??!0,render(){const r=`${m.gray(B)}
|
|
23
|
+
${Q(this.state)} ${i.message}
|
|
24
|
+
`,s=this.value?t:n;switch(this.state){case"submit":return`${r}${m.gray(B)} ${m.dim(s)}`;case"cancel":return`${r}${m.gray(B)} ${m.strikethrough(m.dim(s))}
|
|
25
|
+
${m.gray(B)}`;default:return`${r}${m.cyan(B)} ${this.value?`${m.green(ge)} ${t}`:`${m.dim(Ee)} ${m.dim(t)}`} ${m.dim("/")} ${this.value?`${m.dim(Ee)} ${m.dim(n)}`:`${m.green(ge)} ${n}`}
|
|
26
|
+
${m.cyan(R)}
|
|
27
|
+
`}}}).prompt()},tt=i=>{const t=(n,r)=>{const s=n.label??String(n.value);switch(r){case"selected":return`${m.dim(s)}`;case"active":return`${m.green(ge)} ${s} ${n.hint?m.dim(`(${n.hint})`):""}`;case"cancelled":return`${m.strikethrough(m.dim(s))}`;default:return`${m.dim(Ee)} ${m.dim(s)}`}};return new su({options:i.options,initialValue:i.initialValue,render(){const n=`${m.gray(B)}
|
|
28
|
+
${Q(this.state)} ${i.message}
|
|
29
|
+
`;switch(this.state){case"submit":return`${n}${m.gray(B)} ${t(this.options[this.cursor],"selected")}`;case"cancel":return`${n}${m.gray(B)} ${t(this.options[this.cursor],"cancelled")}
|
|
30
|
+
${m.gray(B)}`;default:return`${n}${m.cyan(B)} ${be({cursor:this.cursor,options:this.options,maxItems:i.maxItems,style:(r,s)=>t(r,s?"active":"inactive")}).join(`
|
|
31
|
+
${m.cyan(B)} `)}
|
|
32
|
+
${m.cyan(R)}
|
|
33
|
+
`}}}).prompt()},Fu=i=>{const t=(n,r)=>{const s=n.label??String(n.value);return r==="active"?`${m.cyan(au)} ${s} ${n.hint?m.dim(`(${n.hint})`):""}`:r==="selected"?`${m.green(et)} ${m.dim(s)}`:r==="cancelled"?`${m.strikethrough(m.dim(s))}`:r==="active-selected"?`${m.green(et)} ${s} ${n.hint?m.dim(`(${n.hint})`):""}`:r==="submitted"?`${m.dim(s)}`:`${m.dim(lu)} ${m.dim(s)}`};return new tu({options:i.options,initialValues:i.initialValues,required:i.required??!0,cursorAt:i.cursorAt,validate(n){if(this.required&&n.length===0)return`Please select at least one option.
|
|
34
|
+
${m.reset(m.dim(`Press ${m.gray(m.bgWhite(m.inverse(" space ")))} to select, ${m.gray(m.bgWhite(m.inverse(" enter ")))} to submit`))}`},render(){const n=`${m.gray(B)}
|
|
35
|
+
${Q(this.state)} ${i.message}
|
|
36
|
+
`,r=(s,D)=>{const e=this.value.includes(s.value);return D&&e?t(s,"active-selected"):e?t(s,"selected"):t(s,D?"active":"inactive")};switch(this.state){case"submit":return`${n}${m.gray(B)} ${this.options.filter(({value:s})=>this.value.includes(s)).map(s=>t(s,"submitted")).join(m.dim(", "))||m.dim("none")}`;case"cancel":{const s=this.options.filter(({value:D})=>this.value.includes(D)).map(D=>t(D,"cancelled")).join(m.dim(", "));return`${n}${m.gray(B)} ${s.trim()?`${s}
|
|
37
|
+
${m.gray(B)}`:""}`}case"error":{const s=this.error.split(`
|
|
38
|
+
`).map((D,e)=>e===0?`${m.yellow(R)} ${m.yellow(D)}`:` ${D}`).join(`
|
|
39
|
+
`);return`${n+m.yellow(B)} ${be({options:this.options,cursor:this.cursor,maxItems:i.maxItems,style:r}).join(`
|
|
40
|
+
${m.yellow(B)} `)}
|
|
41
|
+
${s}
|
|
42
|
+
`}default:return`${n}${m.cyan(B)} ${be({options:this.options,cursor:this.cursor,maxItems:i.maxItems,style:r}).join(`
|
|
43
|
+
${m.cyan(B)} `)}
|
|
44
|
+
${m.cyan(R)}
|
|
45
|
+
`}}}).prompt()},ut=(i="")=>{process.stdout.write(`${m.gray(ou)} ${i}
|
|
46
|
+
`)},Cu=(i="")=>{process.stdout.write(`${m.gray(B)}
|
|
47
|
+
${m.gray(R)} ${i}
|
|
48
|
+
|
|
49
|
+
`)},O={message:(i="",{symbol:t=m.gray(B)}={})=>{const n=[`${m.gray(B)}`];if(i){const[r,...s]=i.split(`
|
|
50
|
+
`);n.push(`${t} ${r}`,...s.map(D=>`${m.gray(B)} ${D}`))}process.stdout.write(`${n.join(`
|
|
51
|
+
`)}
|
|
52
|
+
`)},info:i=>{O.message(i,{symbol:m.blue(cu)})},success:i=>{O.message(i,{symbol:m.green(hu)})},step:i=>{O.message(i,{symbol:m.green(fe)})},warn:i=>{O.message(i,{symbol:m.yellow(pu)})},warning:i=>{O.warn(i)},error:i=>{O.message(i,{symbol:m.red(mu)})}};`${m.gray(B)}`;const fu=({indicator:i="dots"}={})=>{const t=Ce?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],n=Ce?80:120,r=process.env.CI==="true";let s,D,e=!1,a="",h,d=performance.now();const g=l=>{const p=l>1?"Something went wrong":"Canceled";e&&o(p,l)},f=()=>g(2),_=()=>g(1),S=()=>{process.on("uncaughtExceptionMonitor",f),process.on("unhandledRejection",f),process.on("SIGINT",_),process.on("SIGTERM",_),process.on("exit",g)},V=()=>{process.removeListener("uncaughtExceptionMonitor",f),process.removeListener("unhandledRejection",f),process.removeListener("SIGINT",_),process.removeListener("SIGTERM",_),process.removeListener("exit",g)},M=()=>{if(h===void 0)return;r&&process.stdout.write(`
|
|
53
|
+
`);const l=h.split(`
|
|
54
|
+
`);process.stdout.write(j.cursor.move(-999,l.length-1)),process.stdout.write(j.erase.down(l.length))},v=l=>l.replace(/\.+$/,""),y=l=>{const p=(performance.now()-l)/1e3,c=Math.floor(p/60),F=Math.floor(p%60);return c>0?`[${c}m ${F}s]`:`[${F}s]`},u=(l="")=>{e=!0,s=Yt(),a=v(l),d=performance.now(),process.stdout.write(`${m.gray(B)}
|
|
55
|
+
`);let p=0,c=0;S(),D=setInterval(()=>{if(r&&a===h)return;M(),h=a;const F=m.magenta(t[p]);if(r)process.stdout.write(`${F} ${a}...`);else if(i==="timer")process.stdout.write(`${F} ${a} ${y(d)}`);else{const E=".".repeat(Math.floor(c)).slice(0,3);process.stdout.write(`${F} ${a}${E}`)}p=p+1<t.length?p+1:0,c=c<t.length?c+.125:0},n)},o=(l="",p=0)=>{e=!1,clearInterval(D),M();const c=p===0?m.green(fe):p===1?m.red(Qe):m.red(Xe);a=v(l??a),i==="timer"?process.stdout.write(`${c} ${a} ${y(d)}
|
|
56
|
+
`):process.stdout.write(`${c} ${a}
|
|
57
|
+
`),V(),s()};return{start:u,stop:o,message:(l="")=>{a=v(l??a)}}};var X={exports:{}},ee={},te={},rt;function ue(){if(rt)return te;rt=1;class i extends Error{constructor(r,s,D){super(D),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=s,this.exitCode=r,this.nestedError=void 0}}class t extends i{constructor(r){super(1,"commander.invalidArgument",r),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}return te.CommanderError=i,te.InvalidArgumentError=t,te}var st;function _e(){if(st)return ee;st=1;const{InvalidArgumentError:i}=ue();class t{constructor(s,D){switch(this.description=D||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,s[0]){case"<":this.required=!0,this._name=s.slice(1,-1);break;case"[":this.required=!1,this._name=s.slice(1,-1);break;default:this.required=!0,this._name=s;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(s,D){return D===this.defaultValue||!Array.isArray(D)?[s]:D.concat(s)}default(s,D){return this.defaultValue=s,this.defaultValueDescription=D,this}argParser(s){return this.parseArg=s,this}choices(s){return this.argChoices=s.slice(),this.parseArg=(D,e)=>{if(!this.argChoices.includes(D))throw new i(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(D,e):D},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function n(r){const s=r.name()+(r.variadic===!0?"...":"");return r.required?"<"+s+">":"["+s+"]"}return ee.Argument=t,ee.humanReadableArgName=n,ee}var Be={},ve={},it;function nt(){if(it)return ve;it=1;const{humanReadableArgName:i}=_e();class t{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(r){const s=r.commands.filter(D=>!D._hidden);if(r._hasImplicitHelpCommand()){const[,D,e]=r._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/),a=r.createCommand(D).helpOption(!1);a.description(r._helpCommandDescription),e&&a.arguments(e),s.push(a)}return this.sortSubcommands&&s.sort((D,e)=>D.name().localeCompare(e.name())),s}compareOptions(r,s){const D=e=>e.short?e.short.replace(/^-/,""):e.long.replace(/^--/,"");return D(r).localeCompare(D(s))}visibleOptions(r){const s=r.options.filter(a=>!a.hidden),D=r._hasHelpOption&&r._helpShortFlag&&!r._findOption(r._helpShortFlag),e=r._hasHelpOption&&!r._findOption(r._helpLongFlag);if(D||e){let a;D?e?a=r.createOption(r._helpFlags,r._helpDescription):a=r.createOption(r._helpShortFlag,r._helpDescription):a=r.createOption(r._helpLongFlag,r._helpDescription),s.push(a)}return this.sortOptions&&s.sort(this.compareOptions),s}visibleGlobalOptions(r){if(!this.showGlobalOptions)return[];const s=[];for(let D=r.parent;D;D=D.parent){const e=D.options.filter(a=>!a.hidden);s.push(...e)}return this.sortOptions&&s.sort(this.compareOptions),s}visibleArguments(r){return r._argsDescription&&r._args.forEach(s=>{s.description=s.description||r._argsDescription[s.name()]||""}),r._args.find(s=>s.description)?r._args:[]}subcommandTerm(r){const s=r._args.map(D=>i(D)).join(" ");return r._name+(r._aliases[0]?"|"+r._aliases[0]:"")+(r.options.length?" [options]":"")+(s?" "+s:"")}optionTerm(r){return r.flags}argumentTerm(r){return r.name()}longestSubcommandTermLength(r,s){return s.visibleCommands(r).reduce((D,e)=>Math.max(D,s.subcommandTerm(e).length),0)}longestOptionTermLength(r,s){return s.visibleOptions(r).reduce((D,e)=>Math.max(D,s.optionTerm(e).length),0)}longestGlobalOptionTermLength(r,s){return s.visibleGlobalOptions(r).reduce((D,e)=>Math.max(D,s.optionTerm(e).length),0)}longestArgumentTermLength(r,s){return s.visibleArguments(r).reduce((D,e)=>Math.max(D,s.argumentTerm(e).length),0)}commandUsage(r){let s=r._name;r._aliases[0]&&(s=s+"|"+r._aliases[0]);let D="";for(let e=r.parent;e;e=e.parent)D=e.name()+" "+D;return D+s+" "+r.usage()}commandDescription(r){return r.description()}subcommandDescription(r){return r.summary()||r.description()}optionDescription(r){const s=[];return r.argChoices&&s.push(`choices: ${r.argChoices.map(D=>JSON.stringify(D)).join(", ")}`),r.defaultValue!==void 0&&(r.required||r.optional||r.isBoolean()&&typeof r.defaultValue=="boolean")&&s.push(`default: ${r.defaultValueDescription||JSON.stringify(r.defaultValue)}`),r.presetArg!==void 0&&r.optional&&s.push(`preset: ${JSON.stringify(r.presetArg)}`),r.envVar!==void 0&&s.push(`env: ${r.envVar}`),s.length>0?`${r.description} (${s.join(", ")})`:r.description}argumentDescription(r){const s=[];if(r.argChoices&&s.push(`choices: ${r.argChoices.map(D=>JSON.stringify(D)).join(", ")}`),r.defaultValue!==void 0&&s.push(`default: ${r.defaultValueDescription||JSON.stringify(r.defaultValue)}`),s.length>0){const D=`(${s.join(", ")})`;return r.description?`${r.description} ${D}`:D}return r.description}formatHelp(r,s){const D=s.padWidth(r,s),e=s.helpWidth||80,a=2,h=2;function d(v,y){if(y){const u=`${v.padEnd(D+h)}${y}`;return s.wrap(u,e-a,D+h)}return v}function g(v){return v.join(`
|
|
58
|
+
`).replace(/^/gm," ".repeat(a))}let f=[`Usage: ${s.commandUsage(r)}`,""];const _=s.commandDescription(r);_.length>0&&(f=f.concat([s.wrap(_,e,0),""]));const S=s.visibleArguments(r).map(v=>d(s.argumentTerm(v),s.argumentDescription(v)));S.length>0&&(f=f.concat(["Arguments:",g(S),""]));const V=s.visibleOptions(r).map(v=>d(s.optionTerm(v),s.optionDescription(v)));if(V.length>0&&(f=f.concat(["Options:",g(V),""])),this.showGlobalOptions){const v=s.visibleGlobalOptions(r).map(y=>d(s.optionTerm(y),s.optionDescription(y)));v.length>0&&(f=f.concat(["Global Options:",g(v),""]))}const M=s.visibleCommands(r).map(v=>d(s.subcommandTerm(v),s.subcommandDescription(v)));return M.length>0&&(f=f.concat(["Commands:",g(M),""])),f.join(`
|
|
59
|
+
`)}padWidth(r,s){return Math.max(s.longestOptionTermLength(r,s),s.longestGlobalOptionTermLength(r,s),s.longestSubcommandTermLength(r,s),s.longestArgumentTermLength(r,s))}wrap(r,s,D,e=40){const a=" \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF",h=new RegExp(`[\\n][${a}]+`);if(r.match(h))return r;const d=s-D;if(d<e)return r;const g=r.slice(0,D),f=r.slice(D).replace(`\r
|
|
60
|
+
`,`
|
|
61
|
+
`),_=" ".repeat(D),V="\\s\u200B",M=new RegExp(`
|
|
62
|
+
|.{1,${d-1}}([${V}]|$)|[^${V}]+?([${V}]|$)`,"g"),v=f.match(M)||[];return g+v.map((y,u)=>y===`
|
|
63
|
+
`?"":(u>0?_:"")+y.trimEnd()).join(`
|
|
64
|
+
`)}}return ve.Help=t,ve}var L={},Dt;function ot(){if(Dt)return L;Dt=1;const{InvalidArgumentError:i}=ue();class t{constructor(e,a){this.flags=e,this.description=a||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;const h=s(e);this.short=h.shortFlag,this.long=h.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(e,a){return this.defaultValue=e,this.defaultValueDescription=a,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let a=e;return typeof e=="string"&&(a={[e]:!0}),this.implied=Object.assign(this.implied||{},a),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_concatValue(e,a){return a===this.defaultValue||!Array.isArray(a)?[e]:a.concat(e)}choices(e){return this.argChoices=e.slice(),this.parseArg=(a,h)=>{if(!this.argChoices.includes(a))throw new i(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(a,h):a},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return r(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class n{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(a=>{a.negate?this.negativeOptions.set(a.attributeName(),a):this.positiveOptions.set(a.attributeName(),a)}),this.negativeOptions.forEach((a,h)=>{this.positiveOptions.has(h)&&this.dualOptions.add(h)})}valueFromOption(e,a){const h=a.attributeName();if(!this.dualOptions.has(h))return!0;const d=this.negativeOptions.get(h).presetArg,g=d!==void 0?d:!1;return a.negate===(g===e)}}function r(D){return D.split("-").reduce((e,a)=>e+a[0].toUpperCase()+a.slice(1))}function s(D){let e,a;const h=D.split(/[ |,]+/);return h.length>1&&!/^[[<]/.test(h[1])&&(e=h.shift()),a=h.shift(),!e&&/^-[^-]$/.test(a)&&(e=a,a=void 0),{shortFlag:e,longFlag:a}}return L.Option=t,L.splitOptionFlags=s,L.DualOptions=n,L}var $e={},at;function gu(){if(at)return $e;at=1;const i=3;function t(r,s){if(Math.abs(r.length-s.length)>i)return Math.max(r.length,s.length);const D=[];for(let e=0;e<=r.length;e++)D[e]=[e];for(let e=0;e<=s.length;e++)D[0][e]=e;for(let e=1;e<=s.length;e++)for(let a=1;a<=r.length;a++){let h=1;r[a-1]===s[e-1]?h=0:h=1,D[a][e]=Math.min(D[a-1][e]+1,D[a][e-1]+1,D[a-1][e-1]+h),a>1&&e>1&&r[a-1]===s[e-2]&&r[a-2]===s[e-1]&&(D[a][e]=Math.min(D[a][e],D[a-2][e-2]+1))}return D[r.length][s.length]}function n(r,s){if(!s||s.length===0)return"";s=Array.from(new Set(s));const D=r.startsWith("--");D&&(r=r.slice(2),s=s.map(d=>d.slice(2)));let e=[],a=i;const h=.4;return s.forEach(d=>{if(d.length<=1)return;const g=t(r,d),f=Math.max(r.length,d.length);(f-g)/f>h&&(g<a?(a=g,e=[d]):g===a&&e.push(d))}),e.sort((d,g)=>d.localeCompare(g)),D&&(e=e.map(d=>`--${d}`)),e.length>1?`
|
|
65
|
+
(Did you mean one of ${e.join(", ")}?)`:e.length===1?`
|
|
66
|
+
(Did you mean ${e[0]}?)`:""}return $e.suggestSimilar=n,$e}var lt;function Eu(){if(lt)return Be;lt=1;const i=gt.EventEmitter,t=Et,n=bt,r=At,s=_t,{Argument:D,humanReadableArgName:e}=_e(),{CommanderError:a}=ue(),{Help:h}=nt(),{Option:d,splitOptionFlags:g,DualOptions:f}=ot(),{suggestSimilar:_}=gu();class S extends i{constructor(u){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this._args=[],this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=u||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:o=>s.stdout.write(o),writeErr:o=>s.stderr.write(o),getOutHelpWidth:()=>s.stdout.isTTY?s.stdout.columns:void 0,getErrHelpWidth:()=>s.stderr.isTTY?s.stderr.columns:void 0,outputError:(o,l)=>l(o)},this._hidden=!1,this._hasHelpOption=!0,this._helpFlags="-h, --help",this._helpDescription="display help for command",this._helpShortFlag="-h",this._helpLongFlag="--help",this._addImplicitHelpCommand=void 0,this._helpCommandName="help",this._helpCommandnameAndArgs="help [command]",this._helpCommandDescription="display help for command",this._helpConfiguration={}}copyInheritedSettings(u){return this._outputConfiguration=u._outputConfiguration,this._hasHelpOption=u._hasHelpOption,this._helpFlags=u._helpFlags,this._helpDescription=u._helpDescription,this._helpShortFlag=u._helpShortFlag,this._helpLongFlag=u._helpLongFlag,this._helpCommandName=u._helpCommandName,this._helpCommandnameAndArgs=u._helpCommandnameAndArgs,this._helpCommandDescription=u._helpCommandDescription,this._helpConfiguration=u._helpConfiguration,this._exitCallback=u._exitCallback,this._storeOptionsAsProperties=u._storeOptionsAsProperties,this._combineFlagAndOptionalValue=u._combineFlagAndOptionalValue,this._allowExcessArguments=u._allowExcessArguments,this._enablePositionalOptions=u._enablePositionalOptions,this._showHelpAfterError=u._showHelpAfterError,this._showSuggestionAfterError=u._showSuggestionAfterError,this}command(u,o,l){let p=o,c=l;typeof p=="object"&&p!==null&&(c=p,p=null),c=c||{};const[,F,E]=u.match(/([^ ]+) *(.*)/),C=this.createCommand(F);return p&&(C.description(p),C._executableHandler=!0),c.isDefault&&(this._defaultCommandName=C._name),C._hidden=!!(c.noHelp||c.hidden),C._executableFile=c.executableFile||null,E&&C.arguments(E),this.commands.push(C),C.parent=this,C.copyInheritedSettings(this),p?this:C}createCommand(u){return new S(u)}createHelp(){return Object.assign(new h,this.configureHelp())}configureHelp(u){return u===void 0?this._helpConfiguration:(this._helpConfiguration=u,this)}configureOutput(u){return u===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,u),this)}showHelpAfterError(u=!0){return typeof u!="string"&&(u=!!u),this._showHelpAfterError=u,this}showSuggestionAfterError(u=!0){return this._showSuggestionAfterError=!!u,this}addCommand(u,o){if(!u._name)throw new Error(`Command passed to .addCommand() must have a name
|
|
67
|
+
- specify the name in Command constructor or using .name()`);return o=o||{},o.isDefault&&(this._defaultCommandName=u._name),(o.noHelp||o.hidden)&&(u._hidden=!0),this.commands.push(u),u.parent=this,this}createArgument(u,o){return new D(u,o)}argument(u,o,l,p){const c=this.createArgument(u,o);return typeof l=="function"?c.default(p).argParser(l):c.default(l),this.addArgument(c),this}arguments(u){return u.split(/ +/).forEach(o=>{this.argument(o)}),this}addArgument(u){const o=this._args.slice(-1)[0];if(o&&o.variadic)throw new Error(`only the last argument can be variadic '${o.name()}'`);if(u.required&&u.defaultValue!==void 0&&u.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${u.name()}'`);return this._args.push(u),this}addHelpCommand(u,o){return u===!1?this._addImplicitHelpCommand=!1:(this._addImplicitHelpCommand=!0,typeof u=="string"&&(this._helpCommandName=u.split(" ")[0],this._helpCommandnameAndArgs=u),this._helpCommandDescription=o||this._helpCommandDescription),this}_hasImplicitHelpCommand(){return this._addImplicitHelpCommand===void 0?this.commands.length&&!this._actionHandler&&!this._findCommand("help"):this._addImplicitHelpCommand}hook(u,o){const l=["preSubcommand","preAction","postAction"];if(!l.includes(u))throw new Error(`Unexpected value for event passed to hook : '${u}'.
|
|
68
|
+
Expecting one of '${l.join("', '")}'`);return this._lifeCycleHooks[u]?this._lifeCycleHooks[u].push(o):this._lifeCycleHooks[u]=[o],this}exitOverride(u){return u?this._exitCallback=u:this._exitCallback=o=>{if(o.code!=="commander.executeSubCommandAsync")throw o},this}_exit(u,o,l){this._exitCallback&&this._exitCallback(new a(u,o,l)),s.exit(u)}action(u){const o=l=>{const p=this._args.length,c=l.slice(0,p);return this._storeOptionsAsProperties?c[p]=this:c[p]=this.opts(),c.push(this),u.apply(this,c)};return this._actionHandler=o,this}createOption(u,o){return new d(u,o)}addOption(u){const o=u.name(),l=u.attributeName();if(u.negate){const c=u.long.replace(/^--no-/,"--");this._findOption(c)||this.setOptionValueWithSource(l,u.defaultValue===void 0?!0:u.defaultValue,"default")}else u.defaultValue!==void 0&&this.setOptionValueWithSource(l,u.defaultValue,"default");this.options.push(u);const p=(c,F,E)=>{c==null&&u.presetArg!==void 0&&(c=u.presetArg);const C=this.getOptionValue(l);if(c!==null&&u.parseArg)try{c=u.parseArg(c,C)}catch(b){if(b.code==="commander.invalidArgument"){const A=`${F} ${b.message}`;this.error(A,{exitCode:b.exitCode,code:b.code})}throw b}else c!==null&&u.variadic&&(c=u._concatValue(c,C));c==null&&(u.negate?c=!1:u.isBoolean()||u.optional?c=!0:c=""),this.setOptionValueWithSource(l,c,E)};return this.on("option:"+o,c=>{const F=`error: option '${u.flags}' argument '${c}' is invalid.`;p(c,F,"cli")}),u.envVar&&this.on("optionEnv:"+o,c=>{const F=`error: option '${u.flags}' value '${c}' from env '${u.envVar}' is invalid.`;p(c,F,"env")}),this}_optionEx(u,o,l,p,c){if(typeof o=="object"&&o instanceof d)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");const F=this.createOption(o,l);if(F.makeOptionMandatory(!!u.mandatory),typeof p=="function")F.default(c).argParser(p);else if(p instanceof RegExp){const E=p;p=(C,b)=>{const A=E.exec(C);return A?A[0]:b},F.default(c).argParser(p)}else F.default(p);return this.addOption(F)}option(u,o,l,p){return this._optionEx({},u,o,l,p)}requiredOption(u,o,l,p){return this._optionEx({mandatory:!0},u,o,l,p)}combineFlagAndOptionalValue(u=!0){return this._combineFlagAndOptionalValue=!!u,this}allowUnknownOption(u=!0){return this._allowUnknownOption=!!u,this}allowExcessArguments(u=!0){return this._allowExcessArguments=!!u,this}enablePositionalOptions(u=!0){return this._enablePositionalOptions=!!u,this}passThroughOptions(u=!0){if(this._passThroughOptions=!!u,this.parent&&u&&!this.parent._enablePositionalOptions)throw new Error("passThroughOptions can not be used without turning on enablePositionalOptions for parent command(s)");return this}storeOptionsAsProperties(u=!0){if(this._storeOptionsAsProperties=!!u,this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");return this}getOptionValue(u){return this._storeOptionsAsProperties?this[u]:this._optionValues[u]}setOptionValue(u,o){return this.setOptionValueWithSource(u,o,void 0)}setOptionValueWithSource(u,o,l){return this._storeOptionsAsProperties?this[u]=o:this._optionValues[u]=o,this._optionValueSources[u]=l,this}getOptionValueSource(u){return this._optionValueSources[u]}getOptionValueSourceWithGlobals(u){let o;return v(this).forEach(l=>{l.getOptionValueSource(u)!==void 0&&(o=l.getOptionValueSource(u))}),o}_prepareUserArgs(u,o){if(u!==void 0&&!Array.isArray(u))throw new Error("first parameter to parse must be array or undefined");o=o||{},u===void 0&&(u=s.argv,s.versions&&s.versions.electron&&(o.from="electron")),this.rawArgs=u.slice();let l;switch(o.from){case void 0:case"node":this._scriptPath=u[1],l=u.slice(2);break;case"electron":s.defaultApp?(this._scriptPath=u[1],l=u.slice(2)):l=u.slice(1);break;case"user":l=u.slice(0);break;default:throw new Error(`unexpected parse option { from: '${o.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",l}parse(u,o){const l=this._prepareUserArgs(u,o);return this._parseCommand([],l),this}async parseAsync(u,o){const l=this._prepareUserArgs(u,o);return await this._parseCommand([],l),this}_executeSubCommand(u,o){o=o.slice();let l=!1;const p=[".js",".ts",".tsx",".mjs",".cjs"];function c(A,x){const G=n.resolve(A,x);if(r.existsSync(G))return G;if(p.includes(n.extname(x)))return;const je=p.find(Ft=>r.existsSync(`${G}${Ft}`));if(je)return`${G}${je}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let F=u._executableFile||`${this._name}-${u._name}`,E=this._executableDir||"";if(this._scriptPath){let A;try{A=r.realpathSync(this._scriptPath)}catch{A=this._scriptPath}E=n.resolve(n.dirname(A),E)}if(E){let A=c(E,F);if(!A&&!u._executableFile&&this._scriptPath){const x=n.basename(this._scriptPath,n.extname(this._scriptPath));x!==this._name&&(A=c(E,`${x}-${u._name}`))}F=A||F}l=p.includes(n.extname(F));let C;s.platform!=="win32"?l?(o.unshift(F),o=M(s.execArgv).concat(o),C=t.spawn(s.argv[0],o,{stdio:"inherit"})):C=t.spawn(F,o,{stdio:"inherit"}):(o.unshift(F),o=M(s.execArgv).concat(o),C=t.spawn(s.execPath,o,{stdio:"inherit"})),C.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(x=>{s.on(x,()=>{C.killed===!1&&C.exitCode===null&&C.kill(x)})});const b=this._exitCallback;b?C.on("close",()=>{b(new a(s.exitCode||0,"commander.executeSubCommandAsync","(close)"))}):C.on("close",s.exit.bind(s)),C.on("error",A=>{if(A.code==="ENOENT"){const x=E?`searched for local subcommand relative to directory '${E}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",G=`'${F}' does not exist
|
|
69
|
+
- if '${u._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
70
|
+
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
71
|
+
- ${x}`;throw new Error(G)}else if(A.code==="EACCES")throw new Error(`'${F}' not executable`);if(!b)s.exit(1);else{const x=new a(1,"commander.executeSubCommandAsync","(error)");x.nestedError=A,b(x)}}),this.runningCommand=C}_dispatchSubcommand(u,o,l){const p=this._findCommand(u);p||this.help({error:!0});let c;return c=this._chainOrCallSubCommandHook(c,p,"preSubcommand"),c=this._chainOrCall(c,()=>{if(p._executableHandler)this._executeSubCommand(p,o.concat(l));else return p._parseCommand(o,l)}),c}_checkNumberOfArguments(){this._args.forEach((u,o)=>{u.required&&this.args[o]==null&&this.missingArgument(u.name())}),!(this._args.length>0&&this._args[this._args.length-1].variadic)&&this.args.length>this._args.length&&this._excessArguments(this.args)}_processArguments(){const u=(l,p,c)=>{let F=p;if(p!==null&&l.parseArg)try{F=l.parseArg(p,c)}catch(E){if(E.code==="commander.invalidArgument"){const C=`error: command-argument value '${p}' is invalid for argument '${l.name()}'. ${E.message}`;this.error(C,{exitCode:E.exitCode,code:E.code})}throw E}return F};this._checkNumberOfArguments();const o=[];this._args.forEach((l,p)=>{let c=l.defaultValue;l.variadic?p<this.args.length?(c=this.args.slice(p),l.parseArg&&(c=c.reduce((F,E)=>u(l,E,F),l.defaultValue))):c===void 0&&(c=[]):p<this.args.length&&(c=this.args[p],l.parseArg&&(c=u(l,c,l.defaultValue))),o[p]=c}),this.processedArgs=o}_chainOrCall(u,o){return u&&u.then&&typeof u.then=="function"?u.then(()=>o()):o()}_chainOrCallHooks(u,o){let l=u;const p=[];return v(this).reverse().filter(c=>c._lifeCycleHooks[o]!==void 0).forEach(c=>{c._lifeCycleHooks[o].forEach(F=>{p.push({hookedCommand:c,callback:F})})}),o==="postAction"&&p.reverse(),p.forEach(c=>{l=this._chainOrCall(l,()=>c.callback(c.hookedCommand,this))}),l}_chainOrCallSubCommandHook(u,o,l){let p=u;return this._lifeCycleHooks[l]!==void 0&&this._lifeCycleHooks[l].forEach(c=>{p=this._chainOrCall(p,()=>c(this,o))}),p}_parseCommand(u,o){const l=this.parseOptions(o);if(this._parseOptionsEnv(),this._parseOptionsImplied(),u=u.concat(l.operands),o=l.unknown,this.args=u.concat(o),u&&this._findCommand(u[0]))return this._dispatchSubcommand(u[0],u.slice(1),o);if(this._hasImplicitHelpCommand()&&u[0]===this._helpCommandName)return u.length===1&&this.help(),this._dispatchSubcommand(u[1],[],[this._helpLongFlag]);if(this._defaultCommandName)return V(this,o),this._dispatchSubcommand(this._defaultCommandName,u,o);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),V(this,l.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();const p=()=>{l.unknown.length>0&&this.unknownOption(l.unknown[0])},c=`command:${this.name()}`;if(this._actionHandler){p(),this._processArguments();let F;return F=this._chainOrCallHooks(F,"preAction"),F=this._chainOrCall(F,()=>this._actionHandler(this.processedArgs)),this.parent&&(F=this._chainOrCall(F,()=>{this.parent.emit(c,u,o)})),F=this._chainOrCallHooks(F,"postAction"),F}if(this.parent&&this.parent.listenerCount(c))p(),this._processArguments(),this.parent.emit(c,u,o);else if(u.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",u,o);this.listenerCount("command:*")?this.emit("command:*",u,o):this.commands.length?this.unknownCommand():(p(),this._processArguments())}else this.commands.length?(p(),this.help({error:!0})):(p(),this._processArguments())}_findCommand(u){if(u)return this.commands.find(o=>o._name===u||o._aliases.includes(u))}_findOption(u){return this.options.find(o=>o.is(u))}_checkForMissingMandatoryOptions(){for(let u=this;u;u=u.parent)u.options.forEach(o=>{o.mandatory&&u.getOptionValue(o.attributeName())===void 0&&u.missingMandatoryOptionValue(o)})}_checkForConflictingLocalOptions(){const u=this.options.filter(l=>{const p=l.attributeName();return this.getOptionValue(p)===void 0?!1:this.getOptionValueSource(p)!=="default"});u.filter(l=>l.conflictsWith.length>0).forEach(l=>{const p=u.find(c=>l.conflictsWith.includes(c.attributeName()));p&&this._conflictingOption(l,p)})}_checkForConflictingOptions(){for(let u=this;u;u=u.parent)u._checkForConflictingLocalOptions()}parseOptions(u){const o=[],l=[];let p=o;const c=u.slice();function F(C){return C.length>1&&C[0]==="-"}let E=null;for(;c.length;){const C=c.shift();if(C==="--"){p===l&&p.push(C),p.push(...c);break}if(E&&!F(C)){this.emit(`option:${E.name()}`,C);continue}if(E=null,F(C)){const b=this._findOption(C);if(b){if(b.required){const A=c.shift();A===void 0&&this.optionMissingArgument(b),this.emit(`option:${b.name()}`,A)}else if(b.optional){let A=null;c.length>0&&!F(c[0])&&(A=c.shift()),this.emit(`option:${b.name()}`,A)}else this.emit(`option:${b.name()}`);E=b.variadic?b:null;continue}}if(C.length>2&&C[0]==="-"&&C[1]!=="-"){const b=this._findOption(`-${C[1]}`);if(b){b.required||b.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${b.name()}`,C.slice(2)):(this.emit(`option:${b.name()}`),c.unshift(`-${C.slice(2)}`));continue}}if(/^--[^=]+=/.test(C)){const b=C.indexOf("="),A=this._findOption(C.slice(0,b));if(A&&(A.required||A.optional)){this.emit(`option:${A.name()}`,C.slice(b+1));continue}}if(F(C)&&(p=l),(this._enablePositionalOptions||this._passThroughOptions)&&o.length===0&&l.length===0){if(this._findCommand(C)){o.push(C),c.length>0&&l.push(...c);break}else if(C===this._helpCommandName&&this._hasImplicitHelpCommand()){o.push(C),c.length>0&&o.push(...c);break}else if(this._defaultCommandName){l.push(C),c.length>0&&l.push(...c);break}}if(this._passThroughOptions){p.push(C),c.length>0&&p.push(...c);break}p.push(C)}return{operands:o,unknown:l}}opts(){if(this._storeOptionsAsProperties){const u={},o=this.options.length;for(let l=0;l<o;l++){const p=this.options[l].attributeName();u[p]=p===this._versionOptionName?this._version:this[p]}return u}return this._optionValues}optsWithGlobals(){return v(this).reduce((u,o)=>Object.assign(u,o.opts()),{})}error(u,o){this._outputConfiguration.outputError(`${u}
|
|
72
|
+
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
73
|
+
`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
|
|
74
|
+
`),this.outputHelp({error:!0}));const l=o||{},p=l.exitCode||1,c=l.code||"commander.error";this._exit(p,c,u)}_parseOptionsEnv(){this.options.forEach(u=>{if(u.envVar&&u.envVar in s.env){const o=u.attributeName();(this.getOptionValue(o)===void 0||["default","config","env"].includes(this.getOptionValueSource(o)))&&(u.required||u.optional?this.emit(`optionEnv:${u.name()}`,s.env[u.envVar]):this.emit(`optionEnv:${u.name()}`))}})}_parseOptionsImplied(){const u=new f(this.options),o=l=>this.getOptionValue(l)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(l));this.options.filter(l=>l.implied!==void 0&&o(l.attributeName())&&u.valueFromOption(this.getOptionValue(l.attributeName()),l)).forEach(l=>{Object.keys(l.implied).filter(p=>!o(p)).forEach(p=>{this.setOptionValueWithSource(p,l.implied[p],"implied")})})}missingArgument(u){const o=`error: missing required argument '${u}'`;this.error(o,{code:"commander.missingArgument"})}optionMissingArgument(u){const o=`error: option '${u.flags}' argument missing`;this.error(o,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(u){const o=`error: required option '${u.flags}' not specified`;this.error(o,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(u,o){const l=F=>{const E=F.attributeName(),C=this.getOptionValue(E),b=this.options.find(x=>x.negate&&E===x.attributeName()),A=this.options.find(x=>!x.negate&&E===x.attributeName());return b&&(b.presetArg===void 0&&C===!1||b.presetArg!==void 0&&C===b.presetArg)?b:A||F},p=F=>{const E=l(F),C=E.attributeName();return this.getOptionValueSource(C)==="env"?`environment variable '${E.envVar}'`:`option '${E.flags}'`},c=`error: ${p(u)} cannot be used with ${p(o)}`;this.error(c,{code:"commander.conflictingOption"})}unknownOption(u){if(this._allowUnknownOption)return;let o="";if(u.startsWith("--")&&this._showSuggestionAfterError){let p=[],c=this;do{const F=c.createHelp().visibleOptions(c).filter(E=>E.long).map(E=>E.long);p=p.concat(F),c=c.parent}while(c&&!c._enablePositionalOptions);o=_(u,p)}const l=`error: unknown option '${u}'${o}`;this.error(l,{code:"commander.unknownOption"})}_excessArguments(u){if(this._allowExcessArguments)return;const o=this._args.length,l=o===1?"":"s",c=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${o} argument${l} but got ${u.length}.`;this.error(c,{code:"commander.excessArguments"})}unknownCommand(){const u=this.args[0];let o="";if(this._showSuggestionAfterError){const p=[];this.createHelp().visibleCommands(this).forEach(c=>{p.push(c.name()),c.alias()&&p.push(c.alias())}),o=_(u,p)}const l=`error: unknown command '${u}'${o}`;this.error(l,{code:"commander.unknownCommand"})}version(u,o,l){if(u===void 0)return this._version;this._version=u,o=o||"-V, --version",l=l||"output the version number";const p=this.createOption(o,l);return this._versionOptionName=p.attributeName(),this.options.push(p),this.on("option:"+p.name(),()=>{this._outputConfiguration.writeOut(`${u}
|
|
75
|
+
`),this._exit(0,"commander.version",u)}),this}description(u,o){return u===void 0&&o===void 0?this._description:(this._description=u,o&&(this._argsDescription=o),this)}summary(u){return u===void 0?this._summary:(this._summary=u,this)}alias(u){if(u===void 0)return this._aliases[0];let o=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(o=this.commands[this.commands.length-1]),u===o._name)throw new Error("Command alias can't be the same as its name");return o._aliases.push(u),this}aliases(u){return u===void 0?this._aliases:(u.forEach(o=>this.alias(o)),this)}usage(u){if(u===void 0){if(this._usage)return this._usage;const o=this._args.map(l=>e(l));return[].concat(this.options.length||this._hasHelpOption?"[options]":[],this.commands.length?"[command]":[],this._args.length?o:[]).join(" ")}return this._usage=u,this}name(u){return u===void 0?this._name:(this._name=u,this)}nameFromFilename(u){return this._name=n.basename(u,n.extname(u)),this}executableDir(u){return u===void 0?this._executableDir:(this._executableDir=u,this)}helpInformation(u){const o=this.createHelp();return o.helpWidth===void 0&&(o.helpWidth=u&&u.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),o.formatHelp(this,o)}_getHelpContext(u){u=u||{};const o={error:!!u.error};let l;return o.error?l=p=>this._outputConfiguration.writeErr(p):l=p=>this._outputConfiguration.writeOut(p),o.write=u.write||l,o.command=this,o}outputHelp(u){let o;typeof u=="function"&&(o=u,u=void 0);const l=this._getHelpContext(u);v(this).reverse().forEach(c=>c.emit("beforeAllHelp",l)),this.emit("beforeHelp",l);let p=this.helpInformation(l);if(o&&(p=o(p),typeof p!="string"&&!Buffer.isBuffer(p)))throw new Error("outputHelp callback must return a string or a Buffer");l.write(p),this.emit(this._helpLongFlag),this.emit("afterHelp",l),v(this).forEach(c=>c.emit("afterAllHelp",l))}helpOption(u,o){if(typeof u=="boolean")return this._hasHelpOption=u,this;this._helpFlags=u||this._helpFlags,this._helpDescription=o||this._helpDescription;const l=g(this._helpFlags);return this._helpShortFlag=l.shortFlag,this._helpLongFlag=l.longFlag,this}help(u){this.outputHelp(u);let o=s.exitCode||0;o===0&&u&&typeof u!="function"&&u.error&&(o=1),this._exit(o,"commander.help","(outputHelp)")}addHelpText(u,o){const l=["beforeAll","before","after","afterAll"];if(!l.includes(u))throw new Error(`Unexpected value for position to addHelpText.
|
|
76
|
+
Expecting one of '${l.join("', '")}'`);const p=`${u}Help`;return this.on(p,c=>{let F;typeof o=="function"?F=o({error:c.error,command:c.command}):F=o,F&&c.write(`${F}
|
|
77
|
+
`)}),this}}function V(y,u){y._hasHelpOption&&u.find(l=>l===y._helpLongFlag||l===y._helpShortFlag)&&(y.outputHelp(),y._exit(0,"commander.helpDisplayed","(outputHelp)"))}function M(y){return y.map(u=>{if(!u.startsWith("--inspect"))return u;let o,l="127.0.0.1",p="9229",c;return(c=u.match(/^(--inspect(-brk)?)$/))!==null?o=c[1]:(c=u.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(o=c[1],/^\d+$/.test(c[3])?p=c[3]:l=c[3]):(c=u.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(o=c[1],l=c[3],p=c[4]),o&&p!=="0"?`${o}=${l}:${parseInt(p)+1}`:u})}function v(y){const u=[];for(let o=y;o;o=o.parent)u.push(o);return u}return Be.Command=S,Be}var ct;function bu(){return ct||(ct=1,function(i,t){const{Argument:n}=_e(),{Command:r}=Eu(),{CommanderError:s,InvalidArgumentError:D}=ue(),{Help:e}=nt(),{Option:a}=ot();t=i.exports=new r,t.program=t,t.Argument=n,t.Command=r,t.CommanderError=s,t.Help=e,t.InvalidArgumentError=D,t.InvalidOptionArgumentError=D,t.Option=a}(X,X.exports)),X.exports}var Au=bu();const _u=Ve(Au),{program:rr,createCommand:sr,createArgument:ir,createOption:nr,CommanderError:Dr,InvalidArgumentError:or,InvalidOptionArgumentError:ar,Command:Bu,Argument:lr,Option:cr,Help:hr}=_u;var q={};class vu extends Error{method;path;expected;value;fake_expected_typed_value_;constructor(t){super(t.message||`Error on ${t.method}(): invalid type${t.path?` on ${t.path}`:""}, expect to be ${t.expected}`);const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.method=t.method,this.path=t.path,this.expected=t.expected,this.value=t.value}}const $u={__proto__:null,TypeGuardError:vu},yu=wt($u);var ht;function wu(){if(ht)return q;ht=1,Object.defineProperty(q,"__esModule",{value:!0}),q._assertGuard=void 0;const i=yu,t=(n,r,s)=>{if(n===!0)throw s?s(r):new i.TypeGuardError(r);return!1};return q._assertGuard=t,q}var P=wu();function pt(i){return i.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join("")}async function ye(i){try{return await(await import("prettier")).format(i,{parser:"typescript"})}catch{return i}}const xu=Ct($t),Ou="https://raw.githubusercontent.com/wrtnlabs/connectors/refs/heads/main/connectors-list.json",we="@wrtnlabs/connector-";function Su(i){return`${we}${i}`}function ju(i){return i.replace(we,"")}async function ku(){const i=await(await fetch(Ou)).json();return(()=>{const t=D=>Array.isArray(D.connectors)&&D.connectors.every(e=>typeof e=="string"&&RegExp(/^@wrtnlabs\/connector\x2d(.*)/).test(e))&&typeof D.version=="string",n=(D,e,a=!0)=>((Array.isArray(D.connectors)||P._assertGuard(a,{method:"typia.assert",path:e+".connectors",expected:"Array<`@wrtnlabs/connector-${string}`>",value:D.connectors},s))&&D.connectors.every((h,d)=>typeof h=="string"&&RegExp(/^@wrtnlabs\/connector\x2d(.*)/).test(h)||P._assertGuard(a,{method:"typia.assert",path:e+".connectors["+d+"]",expected:"`@wrtnlabs/connector-${string}`",value:h},s))||P._assertGuard(a,{method:"typia.assert",path:e+".connectors",expected:"Array<`@wrtnlabs/connector-${string}`>",value:D.connectors},s))&&(typeof D.version=="string"||P._assertGuard(a,{method:"typia.assert",path:e+".version",expected:"string",value:D.version},s)),r=D=>typeof D=="object"&&D!==null&&t(D);let s;return(D,e)=>(r(D)===!1&&(s=e,((a,h,d=!0)=>(typeof a=="object"&&a!==null||P._assertGuard(!0,{method:"typia.assert",path:h+"",expected:"UnwrapTaggedConnectors",value:a},s))&&n(a,h+"",!0)||P._assertGuard(!0,{method:"typia.assert",path:h+"",expected:"UnwrapTaggedConnectors",value:a},s))(D,"$input",!0)),D)})()(i)}async function Pu(){return(await ku()).connectors.map(i=>{const t=ju(i),n=t.replace("-"," ").toUpperCase();return{packageName:i,serviceName:t,displayName:n}})}function xe(i){return i.map(t=>{const n=pt(t);return`{
|
|
78
|
+
name: "${n} Connector",
|
|
79
|
+
protocol: "class",
|
|
80
|
+
application: typia.llm.application<${n}Service, "chatgpt">(),
|
|
81
|
+
execute: new ${n}Service(),
|
|
82
|
+
}`}).join(`,
|
|
83
|
+
`)}function Oe(i){return i.map(t=>`import { ${pt(t)}Service } from "${we}${t}";`).join(`
|
|
84
|
+
`)}function Se({content:i,importCode:t,connectorCode:n}){return i.replace("/// INSERT IMPORT HERE",t).replace("/// INSERT CONTROLLER HERE",n)}async function re({template:i,project:t}){await yt(`github:wrtnlabs/agentica.template.${i}`,{dir:t}),await Bt(N(t,".github/dependabot.yml"),{force:!0})}async function se({projectPath:i,dotEnvfileName:t,apiKeys:n}){if(!De(i))throw new Error(`${i} directory does not exist.`);const r=N(i,t??".env"),s=(De(r)?`
|
|
85
|
+
`:"")+n.map(({key:D,value:e})=>`${D}=${e}`).join(`
|
|
86
|
+
`);await vt(r,s)}function Tu({packageManager:i,pkg:t}){switch(i){case"npm":return`npm install ${t}`;case"yarn":return`yarn add ${t}`;case"pnpm":return`pnpm add ${t}`;case"bun":return`bun add ${t}`;default:throw new Error(`Unsupported package manager: ${i}`)}}function Vu(){const i=w.env.npm_config_user_agent;switch(!0){case i?.startsWith("npm"):return"npm";case i?.startsWith("yarn"):return"yarn";case i?.startsWith("pnpm"):return"pnpm";case i?.startsWith("bun"):return"bun";default:return"npm"}}async function ie({packageManager:i,projectAbsolutePath:t,services:n}){const r=[...n.map(e=>Su(e)),"typescript"].join(" "),s=Tu({packageManager:i,pkg:r}),D=fu();D.start("\u{1F4E6} Package installation in progress..."),await xu(s,{cwd:t}),D.stop("\u2705 Package installation completed")}async function Iu({template:i}){const t={template:i};{const n=await Ae({message:"Enter the project directory path:",placeholder:"./my-agentica-project",validate(s){if(s==="")return"Please enter a directory path";if(s[0]!==".")return"Please enter a relative path.";if(De(s))return"Directory already exists"}});H(n)&&w.exit(0);const r=N(w.cwd(),n);t.projectAbsolutePath=r}{const n=await tt({message:"Which package manager do you want to use?",initialValue:Vu(),options:[{value:"npm",label:"npm"},{value:"pnpm",label:"pnpm"},{value:"yarn",label:`yarn (${T.blueBright("berry is not supported")})`},{value:"bun",label:"bun"}]});H(n)&&w.exit(0),O.info(`\u{1F4E6} Using ${n} as package manager`),t.packageManager=n}if(t.template==null){const n=await tt({message:"Which project type do you want to start?",options:[{value:"standalone",label:`Standalone ${T.blueBright("Agent Server")}`},{value:"nodejs",label:`NodeJS ${T.blueBright("Agent Server")}`},{value:"nestjs",label:`NestJS ${T.blueBright("Agent Server")}`},{value:"react",label:`React ${T.blueBright("Application")}`},{value:"nestjs+react",label:`NestJS + React ${T.blueBright("Agent Server + Client Application")}`}]});H(n)&&w.exit(0),t.template=n}if(t.template!=="standalone"){const n=await Ae({message:"Server Port(if project is client app, this port mean ws server port):",initialValue:"3000",validate(r){if(Number.isNaN(Number.parseInt(r)))return"Port must be an integer"}});H(n)&&w.exit(0),t.port=Number(n)}if(t.template!=="react"){const n=(await Pu()).sort((s,D)=>s.displayName.localeCompare(D.displayName)).map(({displayName:s,serviceName:D})=>({label:s,value:D})),r=await Fu({message:`Which connectors do you want to include? (Press ${T.cyan("<space>")} to select, ${T.cyan("<a>")} to select all, ${T.cyan("<enter>")} to proceed)`,options:n,required:!1});H(r)&&w.exit(0),t.services=r}{const n=await du({message:"Enter your OpenAI API key?",initialValue:!1});if(H(n)&&w.exit(0),n){const r=await Ae({message:"Please enter your OPENAI API key:"});H(r)&&w.exit(0),t.openAIKey=r}else t.openAIKey=null}try{(()=>{const n=e=>(e.packageManager==="npm"||e.packageManager==="yarn"||e.packageManager==="pnpm"||e.packageManager==="bun")&&typeof e.projectAbsolutePath=="string"&&(e.template==="nodejs"||e.template==="nestjs"||e.template==="react"||e.template==="standalone"||e.template==="nestjs+react")&&(e.openAIKey===null||typeof e.openAIKey=="string")&&(e.port===void 0||typeof e.port=="number")&&Array.isArray(e.services)&&e.services.every(a=>typeof a=="string"),r=(e,a,h=!0)=>(e.packageManager==="npm"||e.packageManager==="yarn"||e.packageManager==="pnpm"||e.packageManager==="bun"||P._assertGuard(h,{method:"typia.assertGuard",path:a+".packageManager",expected:'("bun" | "npm" | "pnpm" | "yarn")',value:e.packageManager},D))&&(typeof e.projectAbsolutePath=="string"||P._assertGuard(h,{method:"typia.assertGuard",path:a+".projectAbsolutePath",expected:"string",value:e.projectAbsolutePath},D))&&(e.template==="nodejs"||e.template==="nestjs"||e.template==="react"||e.template==="standalone"||e.template==="nestjs+react"||P._assertGuard(h,{method:"typia.assertGuard",path:a+".template",expected:'("nestjs" | "nestjs+react" | "nodejs" | "react" | "standalone")',value:e.template},D))&&(e.openAIKey===null||typeof e.openAIKey=="string"||P._assertGuard(h,{method:"typia.assertGuard",path:a+".openAIKey",expected:"(null | string)",value:e.openAIKey},D))&&(e.port===void 0||typeof e.port=="number"||P._assertGuard(h,{method:"typia.assertGuard",path:a+".port",expected:"(number | undefined)",value:e.port},D))&&((Array.isArray(e.services)||P._assertGuard(h,{method:"typia.assertGuard",path:a+".services",expected:"Array<string>",value:e.services},D))&&e.services.every((d,g)=>typeof d=="string"||P._assertGuard(h,{method:"typia.assertGuard",path:a+".services["+g+"]",expected:"string",value:d},D))||P._assertGuard(h,{method:"typia.assertGuard",path:a+".services",expected:"Array<string>",value:e.services},D)),s=e=>typeof e=="object"&&e!==null&&n(e);let D;return(e,a)=>{s(e)===!1&&(D=a,((h,d,g=!0)=>(typeof h=="object"&&h!==null||P._assertGuard(!0,{method:"typia.assertGuard",path:d+"",expected:"__type",value:h},D))&&r(h,d+"",!0)||P._assertGuard(!0,{method:"typia.assertGuard",path:d+"",expected:"__type",value:h},D))(e,"$input",!0))}})()(t)}catch(n){throw new Error(`\u274C ${n.toString()}`)}return t}async function Mu({projectAbsolutePath:i,context:t}){await re({template:"standalone",project:i}),O.success("\u2705 Template downloaded");const n=Oe(t.services),r=xe(t.services),s=N(i,"src/index.ts"),D=await oe(s,"utf-8"),e=Se({content:D,importCode:n,connectorCode:r}),a=await ye(e);await ae(s,a),await se({projectPath:i,apiKeys:[{key:"OPENAI_API_KEY",value:t.openAIKey??""}]}),O.success("\u2705 .env created"),await ie({packageManager:t.packageManager,projectAbsolutePath:i,services:t.services})}async function Nu({projectAbsolutePath:i,context:t}){await re({template:"nodejs",project:i}),O.success("\u2705 Template downloaded");const n=Oe(t.services),r=xe(t.services),s=N(i,"src/index.ts"),D=await oe(s,"utf-8").then(h=>t.services.length===0?h:h.replace(/import \{ BbsArticleService \}.*;\n/g,"").replace(/controllers:\s*\[[\s\S]*?\],\n/,`controllers: [/// INSERT CONTROLLER HERE],
|
|
87
|
+
`)),e=Se({content:D,importCode:n,connectorCode:r}),a=await ye(e);await ae(s,a),await se({projectPath:i,apiKeys:[{key:"OPENAI_API_KEY",value:t.openAIKey??""},{key:"PORT",value:t.port?.toString()??"3000"}]}),O.success("\u2705 .env created"),await ie({packageManager:t.packageManager,projectAbsolutePath:i,services:t.services})}async function mt({projectAbsolutePath:i,context:t}){await re({template:"nestjs",project:i}),O.success("\u2705 Template downloaded");const n=Oe(t.services),r=xe(t.services),s=N(i,"src/controllers/chat/ChatController.ts"),D=await oe(s,"utf-8").then(h=>t.services.length===0?h:h.replace(/import \{ BbsArticleService \}.*;\n/g,"").replace(/controllers:\s*\[[\s\S]*?\],\n/,`controllers: [/// INSERT CONTROLLER HERE],
|
|
88
|
+
`)),e=Se({content:D,importCode:n,connectorCode:r}),a=await ye(e);await ae(s,a),await se({projectPath:i,apiKeys:[{key:"OPENAI_API_KEY",value:t.openAIKey??""},{key:"API_PORT",value:t.port?.toString()??"3000"}]}),O.success("\u2705 .env created"),await ie({packageManager:t.packageManager,projectAbsolutePath:i,services:t.services})}async function dt({projectAbsolutePath:i,context:t}){await re({template:"react",project:i}),O.success("\u2705 Template downloaded"),await se({projectPath:i,apiKeys:[{key:"OPENAI_API_KEY",value:t.openAIKey??""},{key:"VITE_AGENTICA_WS_URL",value:`ws://localhost:${t.port}/chat`}]}),O.success("\u2705 .env created"),await ie({packageManager:t.packageManager,projectAbsolutePath:i,services:t.services})}async function Hu({template:i}){ut("Agentica Start Wizard");const t=await Iu({template:i}),{projectAbsolutePath:n}=t;switch(t.template){case"standalone":await Mu({projectAbsolutePath:n,context:t});break;case"nodejs":await Nu({projectAbsolutePath:n,context:t});break;case"nestjs":await mt({projectAbsolutePath:n,context:t});break;case"react":await dt({projectAbsolutePath:n,context:t});break;case"nestjs+react":await mt({projectAbsolutePath:N(n,"server"),context:t}),await dt({projectAbsolutePath:N(n,"client"),context:t});break;default:throw t.template,new Error(`\u274C Template ${t.template} not supported`)}Cu(`
|
|
89
|
+
\u{1F389} Project ${n} created
|
|
90
|
+
\u26A0\uFE0F ${T.yellow("Note:")} Please implement constructor values for each controller generated in agent.ts or index.ts
|
|
91
|
+
`)}const Ru="0.14.2",ne=new Bu;ne.version(Ru),ne.command("start").description("Start a new project").option("-p, --project [nodejs|nestjs|react|nestjs+react|standalone]","The project type").action(async i=>{if(i.project===!0){O.error(`
|
|
92
|
+
\u274C The value of ${T.redBright("--project")} is required`);return}if(!(t=>t===void 0||t==="nodejs"||t==="nestjs"||t==="react"||t==="standalone"||t==="nestjs+react")(i.project)){O.error(`
|
|
93
|
+
\u274C The value of ${T.redBright("--project")} is invalid`);return}ut(`\u{1F680} ${T.blueBright("Agentica")} Setup Wizard`),await Hu({template:i.project})});function Gu(){ne.parse(w.argv)}export{ne as program,Gu as run};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentica",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.14.
|
|
4
|
+
"version": "0.14.2",
|
|
5
5
|
"description": "Agentic AI Library specialized in LLM Function Calling",
|
|
6
6
|
"author": "Wrtn Technologies",
|
|
7
7
|
"license": "MIT",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"LICENSE",
|
|
34
34
|
"README.md",
|
|
35
35
|
"bin",
|
|
36
|
+
"dist",
|
|
36
37
|
"package.json"
|
|
37
38
|
],
|
|
38
39
|
"engines": {
|