tako-cli 0.1.19 → 0.1.20
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.js +31 -29
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
// @bun
|
|
3
|
+
var wr=Object.create;var{getPrototypeOf:pr,defineProperty:w$,getOwnPropertyNames:nr}=Object;var Sr=Object.prototype.hasOwnProperty;var q=(r,m,a)=>{a=r!=null?wr(pr(r)):{};let s=m||!r||!r.__esModule?w$(a,"default",{value:r,enumerable:!0}):a;for(let h of nr(r))if(!Sr.call(s,h))w$(s,h,{get:()=>r[h],enumerable:!0});return s};var p$=(r,m)=>()=>(m||r((m={exports:{}}).exports,m),m.exports);var I=import.meta.require;var m$=p$((e1,Q$)=>{var r$={to(r,m){if(!m)return`\x1B[${r+1}G`;return`\x1B[${m+1};${r+1}H`},move(r,m){let a="";if(r<0)a+=`\x1B[${-r}D`;else if(r>0)a+=`\x1B[${r}C`;if(m<0)a+=`\x1B[${-m}A`;else if(m>0)a+=`\x1B[${m}B`;return a},up:(r=1)=>`\x1B[${r}A`,down:(r=1)=>`\x1B[${r}B`,forward:(r=1)=>`\x1B[${r}C`,backward:(r=1)=>`\x1B[${r}D`,nextLine:(r=1)=>"\x1B[E".repeat(r),prevLine:(r=1)=>"\x1B[F".repeat(r),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},Yr={up:(r=1)=>"\x1B[S".repeat(r),down:(r=1)=>"\x1B[T".repeat(r)},Hr={screen:"\x1B[2J",up:(r=1)=>"\x1B[1J".repeat(r),down:(r=1)=>"\x1B[J".repeat(r),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(r){let m="";for(let a=0;a<r;a++)m+=this.line+(a<r-1?r$.up():"");if(r)m+=r$.left;return m}};Q$.exports={cursor:r$,scroll:Yr,erase:Hr,beep:"\x07"}});var s$=p$((o1,a$)=>{var O=process||{},j$=O.argv||[],K=O.env||{},Lr=!(!!K.NO_COLOR||j$.includes("--no-color"))&&(!!K.FORCE_COLOR||j$.includes("--color")||O.platform==="win32"||(O.stdout||{}).isTTY&&K.TERM!=="dumb"||!!K.CI),Vr=(r,m,a=r)=>(s)=>{let h=""+s,b=h.indexOf(m,r.length);return~b?r+Xr(h,m,a,b)+m:r+h+m},Xr=(r,m,a,s)=>{let h="",b=0;do h+=r.substring(b,s)+a,b=s+m.length,s=r.indexOf(m,b);while(~s);return h+r.substring(b)},Y$=(r=Lr)=>{let m=r?Vr:()=>String;return{isColorSupported:r,reset:m("\x1B[0m","\x1B[0m"),bold:m("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:m("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:m("\x1B[3m","\x1B[23m"),underline:m("\x1B[4m","\x1B[24m"),inverse:m("\x1B[7m","\x1B[27m"),hidden:m("\x1B[8m","\x1B[28m"),strikethrough:m("\x1B[9m","\x1B[29m"),black:m("\x1B[30m","\x1B[39m"),red:m("\x1B[31m","\x1B[39m"),green:m("\x1B[32m","\x1B[39m"),yellow:m("\x1B[33m","\x1B[39m"),blue:m("\x1B[34m","\x1B[39m"),magenta:m("\x1B[35m","\x1B[39m"),cyan:m("\x1B[36m","\x1B[39m"),white:m("\x1B[37m","\x1B[39m"),gray:m("\x1B[90m","\x1B[39m"),bgBlack:m("\x1B[40m","\x1B[49m"),bgRed:m("\x1B[41m","\x1B[49m"),bgGreen:m("\x1B[42m","\x1B[49m"),bgYellow:m("\x1B[43m","\x1B[49m"),bgBlue:m("\x1B[44m","\x1B[49m"),bgMagenta:m("\x1B[45m","\x1B[49m"),bgCyan:m("\x1B[46m","\x1B[49m"),bgWhite:m("\x1B[47m","\x1B[49m"),blackBright:m("\x1B[90m","\x1B[39m"),redBright:m("\x1B[91m","\x1B[39m"),greenBright:m("\x1B[92m","\x1B[39m"),yellowBright:m("\x1B[93m","\x1B[39m"),blueBright:m("\x1B[94m","\x1B[39m"),magentaBright:m("\x1B[95m","\x1B[39m"),cyanBright:m("\x1B[96m","\x1B[39m"),whiteBright:m("\x1B[97m","\x1B[39m"),bgBlackBright:m("\x1B[100m","\x1B[49m"),bgRedBright:m("\x1B[101m","\x1B[49m"),bgGreenBright:m("\x1B[102m","\x1B[49m"),bgYellowBright:m("\x1B[103m","\x1B[49m"),bgBlueBright:m("\x1B[104m","\x1B[49m"),bgMagentaBright:m("\x1B[105m","\x1B[49m"),bgCyanBright:m("\x1B[106m","\x1B[49m"),bgWhiteBright:m("\x1B[107m","\x1B[49m")}};a$.exports=Y$();a$.exports.createColors=Y$});import{join as F}from"path";import{homedir as Mr}from"os";import{join as V}from"path";var Q=V(Mr(),".tako"),S$=V(Q,"config.json"),u=V(Q,"tools"),Z=V(Q,"bun"),n=V(Z,"bin",process.platform==="win32"?"bun.exe":"bun");var M="https://claude-proxy.shiroha.tech",n$={apiKey:"",apiId:"",installedClients:{}};async function M$(){let r=await import("fs/promises");try{await r.mkdir(Q,{recursive:!0}),await r.mkdir(u,{recursive:!0})}catch{}}async function z(){await M$();try{let r=Bun.file(S$);if(await r.exists()){let m=await r.json();return{...n$,...m}}}catch{}return{...n$}}async function qr(r){await M$(),await Bun.write(S$,JSON.stringify(r,null,2))}async function P(r){let a={...await z(),...r};return await qr(a),a}async function q$(){return!!(await z()).apiKey}async function W$(){return(await z()).apiKey}async function f$(){return(await z()).apiId}function G$(r,m){if(!r.startsWith(Q))throw Error(`\u5B89\u5168\u68C0\u67E5\u5931\u8D25: ${m} \u8DEF\u5F84 "${r}" \u4E0D\u5728 Tako \u76EE\u5F55\u4E0B`)}function j(r){let m=F(u,r);return G$(m,"\u5BA2\u6237\u7AEF\u5B89\u88C5\u76EE\u5F55"),m}function Z$(r){let m=j(r.id),a;if(process.platform==="win32")a=F(m,"node_modules",".bin",`${r.command}.cmd`);else a=F(m,"node_modules",".bin",r.command);return G$(a,"\u5BA2\u6237\u7AEF\u53EF\u6267\u884C\u6587\u4EF6"),a}var z$=new Map;function U(r){z$.set(r.id,r)}function J$(){return Array.from(z$.values())}var Wr={id:"claude-code",name:"Claude Code",package:"@anthropic-ai/claude-code",command:"claude",runtime:"bun",getEnvVars(r){return{ANTHROPIC_BASE_URL:`${M}/api`,ANTHROPIC_AUTH_TOKEN:r}}};U(Wr);import{homedir as fr}from"os";import{join as D}from"path";var $$=D(fr(),".codex"),Gr=D($$,"config.toml"),Zr=D($$,"auth.json"),zr=`model_provider = "crs"
|
|
2
4
|
model = "gpt-5-codex"
|
|
3
5
|
model_reasoning_effort = "high"
|
|
4
6
|
disable_response_storage = true
|
|
@@ -13,41 +15,41 @@ env_key = "CRS_OAI_KEY"
|
|
|
13
15
|
`,Jr=`{
|
|
14
16
|
"OPENAI_API_KEY": null
|
|
15
17
|
}
|
|
16
|
-
`;async function Qr(r){let m=await import("fs/promises");try{await m.mkdir($$,{recursive:!0})}catch{}await Bun.write(Gr,zr),await Bun.write(Zr,Jr)}var jr={id:"codex",name:"Codex",package:"@openai/codex",command:"codex",runtime:"bun",entryPoint:"dist/index.js",getEnvVars(r){return{CRS_OAI_KEY:r}},setupConfigFiles:Qr};K(jr);var w=q(m$(),1),R=q(s$(),1);import{stdin as P$,stdout as U$}from"process";import*as f from"readline";import H$ from"readline";import{WriteStream as kr}from"tty";function Br({onlyFirst:r=!1}={}){let m=["[\\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(m,r?void 0:"g")}var Tr=Br();function K$(r){if(typeof r!="string")throw TypeError(`Expected a \`string\`, got \`${typeof r}\``);return r.replace(Tr,"")}function O$(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var A$={exports:{}};(function(r){var m={};r.exports=m,m.eastAsianWidth=function(s){var e=s.charCodeAt(0),h=s.length==2?s.charCodeAt(1):0,$=e;return 55296<=e&&e<=56319&&56320<=h&&h<=57343&&(e&=1023,h&=1023,$=e<<10|h,$+=65536),$==12288||65281<=$&&$<=65376||65504<=$&&$<=65510?"F":$==8361||65377<=$&&$<=65470||65474<=$&&$<=65479||65482<=$&&$<=65487||65490<=$&&$<=65495||65498<=$&&$<=65500||65512<=$&&$<=65518?"H":4352<=$&&$<=4447||4515<=$&&$<=4519||4602<=$&&$<=4607||9001<=$&&$<=9002||11904<=$&&$<=11929||11931<=$&&$<=12019||12032<=$&&$<=12245||12272<=$&&$<=12283||12289<=$&&$<=12350||12353<=$&&$<=12438||12441<=$&&$<=12543||12549<=$&&$<=12589||12593<=$&&$<=12686||12688<=$&&$<=12730||12736<=$&&$<=12771||12784<=$&&$<=12830||12832<=$&&$<=12871||12880<=$&&$<=13054||13056<=$&&$<=19903||19968<=$&&$<=42124||42128<=$&&$<=42182||43360<=$&&$<=43388||44032<=$&&$<=55203||55216<=$&&$<=55238||55243<=$&&$<=55291||63744<=$&&$<=64255||65040<=$&&$<=65049||65072<=$&&$<=65106||65108<=$&&$<=65126||65128<=$&&$<=65131||110592<=$&&$<=110593||127488<=$&&$<=127490||127504<=$&&$<=127546||127552<=$&&$<=127560||127568<=$&&$<=127569||131072<=$&&$<=194367||177984<=$&&$<=196605||196608<=$&&$<=262141?"W":32<=$&&$<=126||162<=$&&$<=163||165<=$&&$<=166||$==172||$==175||10214<=$&&$<=10221||10629<=$&&$<=10630?"Na":$==161||$==164||167<=$&&$<=168||$==170||173<=$&&$<=174||176<=$&&$<=180||182<=$&&$<=186||188<=$&&$<=191||$==198||$==208||215<=$&&$<=216||222<=$&&$<=225||$==230||232<=$&&$<=234||236<=$&&$<=237||$==240||242<=$&&$<=243||247<=$&&$<=250||$==252||$==254||$==257||$==273||$==275||$==283||294<=$&&$<=295||$==299||305<=$&&$<=307||$==312||319<=$&&$<=322||$==324||328<=$&&$<=331||$==333||338<=$&&$<=339||358<=$&&$<=359||$==363||$==462||$==464||$==466||$==468||$==470||$==472||$==474||$==476||$==593||$==609||$==708||$==711||713<=$&&$<=715||$==717||$==720||728<=$&&$<=731||$==733||$==735||768<=$&&$<=879||913<=$&&$<=929||931<=$&&$<=937||945<=$&&$<=961||963<=$&&$<=969||$==1025||1040<=$&&$<=1103||$==1105||$==8208||8211<=$&&$<=8214||8216<=$&&$<=8217||8220<=$&&$<=8221||8224<=$&&$<=8226||8228<=$&&$<=8231||$==8240||8242<=$&&$<=8243||$==8245||$==8251||$==8254||$==8308||$==8319||8321<=$&&$<=8324||$==8364||$==8451||$==8453||$==8457||$==8467||$==8470||8481<=$&&$<=8482||$==8486||$==8491||8531<=$&&$<=8532||8539<=$&&$<=8542||8544<=$&&$<=8555||8560<=$&&$<=8569||$==8585||8592<=$&&$<=8601||8632<=$&&$<=8633||$==8658||$==8660||$==8679||$==8704||8706<=$&&$<=8707||8711<=$&&$<=8712||$==8715||$==8719||$==8721||$==8725||$==8730||8733<=$&&$<=8736||$==8739||$==8741||8743<=$&&$<=8748||$==8750||8756<=$&&$<=8759||8764<=$&&$<=8765||$==8776||$==8780||$==8786||8800<=$&&$<=8801||8804<=$&&$<=8807||8810<=$&&$<=8811||8814<=$&&$<=8815||8834<=$&&$<=8835||8838<=$&&$<=8839||$==8853||$==8857||$==8869||$==8895||$==8978||9312<=$&&$<=9449||9451<=$&&$<=9547||9552<=$&&$<=9587||9600<=$&&$<=9615||9618<=$&&$<=9621||9632<=$&&$<=9633||9635<=$&&$<=9641||9650<=$&&$<=9651||9654<=$&&$<=9655||9660<=$&&$<=9661||9664<=$&&$<=9665||9670<=$&&$<=9672||$==9675||9678<=$&&$<=9681||9698<=$&&$<=9701||$==9711||9733<=$&&$<=9734||$==9737||9742<=$&&$<=9743||9748<=$&&$<=9749||$==9756||$==9758||$==9792||$==9794||9824<=$&&$<=9825||9827<=$&&$<=9829||9831<=$&&$<=9834||9836<=$&&$<=9837||$==9839||9886<=$&&$<=9887||9918<=$&&$<=9919||9924<=$&&$<=9933||9935<=$&&$<=9953||$==9955||9960<=$&&$<=9983||$==10045||$==10071||10102<=$&&$<=10111||11093<=$&&$<=11097||12872<=$&&$<=12879||57344<=$&&$<=63743||65024<=$&&$<=65039||$==65533||127232<=$&&$<=127242||127248<=$&&$<=127277||127280<=$&&$<=127337||127344<=$&&$<=127386||917760<=$&&$<=917999||983040<=$&&$<=1048573||1048576<=$&&$<=1114109?"A":"N"},m.characterLength=function(s){var e=this.eastAsianWidth(s);return e=="F"||e=="W"||e=="A"?2:1};function a(s){return s.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}m.length=function(s){for(var e=a(s),h=0,$=0;$<e.length;$++)h=h+this.characterLength(e[$]);return h},m.slice=function(s,e,h){textLen=m.length(s),e=e||0,h=h||1,e<0&&(e=textLen+e),h<0&&(h=textLen+h);for(var $="",o=0,i=a(s),t=0;t<i.length;t++){var v=i[t],c=m.length(v);if(o>=e-(c==2?1:0))if(o+c<=h)$+=v;else break;o+=c}return $}})(A$);var Er=A$.exports,Ir=O$(Er),Pr=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},Ur=O$(Pr);function V(r,m={}){if(typeof r!="string"||r.length===0||(m={ambiguousIsNarrow:!0,...m},r=K$(r),r.length===0))return 0;r=r.replace(Ur()," ");let a=m.ambiguousIsNarrow?1:2,s=0;for(let e of r){let h=e.codePointAt(0);if(h<=31||h>=127&&h<=159||h>=768&&h<=879)continue;switch(Ir.eastAsianWidth(e)){case"F":case"W":s+=2;break;case"A":s+=a;break;default:s+=1}}return s}var e$=10,L$=(r=0)=>(m)=>`\x1B[${m+r}m`,V$=(r=0)=>(m)=>`\x1B[${38+r};5;${m}m`,X$=(r=0)=>(m,a,s)=>`\x1B[${38+r};2;${m};${a};${s}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 Kr=Object.keys(x.color),Or=Object.keys(x.bgColor);[...Kr,...Or];function Ar(){let r=new Map;for(let[m,a]of Object.entries(x)){for(let[s,e]of Object.entries(a))x[s]={open:`\x1B[${e[0]}m`,close:`\x1B[${e[1]}m`},a[s]=x[s],r.set(e[0],e[1]);Object.defineProperty(x,m,{value:a,enumerable:!1})}return Object.defineProperty(x,"codes",{value:r,enumerable:!1}),x.color.close="\x1B[39m",x.bgColor.close="\x1B[49m",x.color.ansi=L$(),x.color.ansi256=V$(),x.color.ansi16m=X$(),x.bgColor.ansi=L$(e$),x.bgColor.ansi256=V$(e$),x.bgColor.ansi16m=X$(e$),Object.defineProperties(x,{rgbToAnsi256:{value:(m,a,s)=>m===a&&a===s?m<8?16:m>248?231:Math.round((m-8)/247*24)+232:16+36*Math.round(m/255*5)+6*Math.round(a/255*5)+Math.round(s/255*5),enumerable:!1},hexToRgb:{value:(m)=>{let a=/[a-f\d]{6}|[a-f\d]{3}/i.exec(m.toString(16));if(!a)return[0,0,0];let[s]=a;s.length===3&&(s=[...s].map((h)=>h+h).join(""));let e=Number.parseInt(s,16);return[e>>16&255,e>>8&255,e&255]},enumerable:!1},hexToAnsi256:{value:(m)=>x.rgbToAnsi256(...x.hexToRgb(m)),enumerable:!1},ansi256ToAnsi:{value:(m)=>{if(m<8)return 30+m;if(m<16)return 90+(m-8);let a,s,e;if(m>=232)a=((m-232)*10+8)/255,s=a,e=a;else{m-=16;let o=m%36;a=Math.floor(m/36)/5,s=Math.floor(o/6)/5,e=o%6/5}let h=Math.max(a,s,e)*2;if(h===0)return 30;let $=30+(Math.round(e)<<2|Math.round(s)<<1|Math.round(a));return h===2&&($+=60),$},enumerable:!1},rgbToAnsi:{value:(m,a,s)=>x.ansi256ToAnsi(x.rgbToAnsi256(m,a,s)),enumerable:!1},hexToAnsi:{value:(m)=>x.ansi256ToAnsi(x.hexToAnsi256(m)),enumerable:!1}}),x}var Nr=Ar(),C=new Set(["\x1B","\x9B"]),Rr=39,b$="\x07",N$="[",Cr="]",R$="m",o$=`${Cr}8;;`,k$=(r)=>`${C.values().next().value}${N$}${r}${R$}`,B$=(r)=>`${C.values().next().value}${o$}${r}${b$}`,_r=(r)=>r.split(" ").map((m)=>V(m)),h$=(r,m,a)=>{let s=[...m],e=!1,h=!1,$=V(K$(r[r.length-1]));for(let[o,i]of s.entries()){let t=V(i);if($+t<=a?r[r.length-1]+=i:(r.push(i),$=0),C.has(i)&&(e=!0,h=s.slice(o+1).join("").startsWith(o$)),e){h?i===b$&&(e=!1,h=!1):i===R$&&(e=!1);continue}$+=t,$===a&&o<s.length-1&&(r.push(""),$=0)}!$&&r[r.length-1].length>0&&r.length>1&&(r[r.length-2]+=r.pop())},ur=(r)=>{let m=r.split(" "),a=m.length;for(;a>0&&!(V(m[a-1])>0);)a--;return a===m.length?r:m.slice(0,a).join(" ")+m.slice(a).join("")},Fr=(r,m,a={})=>{if(a.trim!==!1&&r.trim()==="")return"";let s="",e,h,$=_r(r),o=[""];for(let[t,v]of r.split(" ").entries()){a.trim!==!1&&(o[o.length-1]=o[o.length-1].trimStart());let c=V(o[o.length-1]);if(t!==0&&(c>=m&&(a.wordWrap===!1||a.trim===!1)&&(o.push(""),c=0),(c>0||a.trim===!1)&&(o[o.length-1]+=" ",c++)),a.hard&&$[t]>m){let d=m-c,G=1+Math.floor(($[t]-d-1)/m);Math.floor(($[t]-1)/m)<G&&o.push(""),h$(o,v,m);continue}if(c+$[t]>m&&c>0&&$[t]>0){if(a.wordWrap===!1&&c<m){h$(o,v,m);continue}o.push("")}if(c+$[t]>m&&a.wordWrap===!1){h$(o,v,m);continue}o[o.length-1]+=v}a.trim!==!1&&(o=o.map((t)=>ur(t)));let i=[...o.join(`
|
|
17
|
-
`)];for(let[t,v]of
|
|
18
|
-
`?(
|
|
19
|
-
`&&(
|
|
18
|
+
`;async function Qr(r){let m=await import("fs/promises");try{await m.mkdir($$,{recursive:!0})}catch{}await Bun.write(Gr,zr),await Bun.write(Zr,Jr)}var jr={id:"codex",name:"Codex",package:"@openai/codex",command:"codex",runtime:"bun",getEnvVars(r){return{CRS_OAI_KEY:r}},setupConfigFiles:Qr};U(jr);var w=q(m$(),1),N=q(s$(),1);import{stdin as P$,stdout as U$}from"process";import*as W from"readline";import H$ from"readline";import{WriteStream as kr}from"tty";function Br({onlyFirst:r=!1}={}){let m=["[\\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(m,r?void 0:"g")}var Er=Br();function K$(r){if(typeof r!="string")throw TypeError(`Expected a \`string\`, got \`${typeof r}\``);return r.replace(Er,"")}function O$(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var A$={exports:{}};(function(r){var m={};r.exports=m,m.eastAsianWidth=function(s){var h=s.charCodeAt(0),b=s.length==2?s.charCodeAt(1):0,$=h;return 55296<=h&&h<=56319&&56320<=b&&b<=57343&&(h&=1023,b&=1023,$=h<<10|b,$+=65536),$==12288||65281<=$&&$<=65376||65504<=$&&$<=65510?"F":$==8361||65377<=$&&$<=65470||65474<=$&&$<=65479||65482<=$&&$<=65487||65490<=$&&$<=65495||65498<=$&&$<=65500||65512<=$&&$<=65518?"H":4352<=$&&$<=4447||4515<=$&&$<=4519||4602<=$&&$<=4607||9001<=$&&$<=9002||11904<=$&&$<=11929||11931<=$&&$<=12019||12032<=$&&$<=12245||12272<=$&&$<=12283||12289<=$&&$<=12350||12353<=$&&$<=12438||12441<=$&&$<=12543||12549<=$&&$<=12589||12593<=$&&$<=12686||12688<=$&&$<=12730||12736<=$&&$<=12771||12784<=$&&$<=12830||12832<=$&&$<=12871||12880<=$&&$<=13054||13056<=$&&$<=19903||19968<=$&&$<=42124||42128<=$&&$<=42182||43360<=$&&$<=43388||44032<=$&&$<=55203||55216<=$&&$<=55238||55243<=$&&$<=55291||63744<=$&&$<=64255||65040<=$&&$<=65049||65072<=$&&$<=65106||65108<=$&&$<=65126||65128<=$&&$<=65131||110592<=$&&$<=110593||127488<=$&&$<=127490||127504<=$&&$<=127546||127552<=$&&$<=127560||127568<=$&&$<=127569||131072<=$&&$<=194367||177984<=$&&$<=196605||196608<=$&&$<=262141?"W":32<=$&&$<=126||162<=$&&$<=163||165<=$&&$<=166||$==172||$==175||10214<=$&&$<=10221||10629<=$&&$<=10630?"Na":$==161||$==164||167<=$&&$<=168||$==170||173<=$&&$<=174||176<=$&&$<=180||182<=$&&$<=186||188<=$&&$<=191||$==198||$==208||215<=$&&$<=216||222<=$&&$<=225||$==230||232<=$&&$<=234||236<=$&&$<=237||$==240||242<=$&&$<=243||247<=$&&$<=250||$==252||$==254||$==257||$==273||$==275||$==283||294<=$&&$<=295||$==299||305<=$&&$<=307||$==312||319<=$&&$<=322||$==324||328<=$&&$<=331||$==333||338<=$&&$<=339||358<=$&&$<=359||$==363||$==462||$==464||$==466||$==468||$==470||$==472||$==474||$==476||$==593||$==609||$==708||$==711||713<=$&&$<=715||$==717||$==720||728<=$&&$<=731||$==733||$==735||768<=$&&$<=879||913<=$&&$<=929||931<=$&&$<=937||945<=$&&$<=961||963<=$&&$<=969||$==1025||1040<=$&&$<=1103||$==1105||$==8208||8211<=$&&$<=8214||8216<=$&&$<=8217||8220<=$&&$<=8221||8224<=$&&$<=8226||8228<=$&&$<=8231||$==8240||8242<=$&&$<=8243||$==8245||$==8251||$==8254||$==8308||$==8319||8321<=$&&$<=8324||$==8364||$==8451||$==8453||$==8457||$==8467||$==8470||8481<=$&&$<=8482||$==8486||$==8491||8531<=$&&$<=8532||8539<=$&&$<=8542||8544<=$&&$<=8555||8560<=$&&$<=8569||$==8585||8592<=$&&$<=8601||8632<=$&&$<=8633||$==8658||$==8660||$==8679||$==8704||8706<=$&&$<=8707||8711<=$&&$<=8712||$==8715||$==8719||$==8721||$==8725||$==8730||8733<=$&&$<=8736||$==8739||$==8741||8743<=$&&$<=8748||$==8750||8756<=$&&$<=8759||8764<=$&&$<=8765||$==8776||$==8780||$==8786||8800<=$&&$<=8801||8804<=$&&$<=8807||8810<=$&&$<=8811||8814<=$&&$<=8815||8834<=$&&$<=8835||8838<=$&&$<=8839||$==8853||$==8857||$==8869||$==8895||$==8978||9312<=$&&$<=9449||9451<=$&&$<=9547||9552<=$&&$<=9587||9600<=$&&$<=9615||9618<=$&&$<=9621||9632<=$&&$<=9633||9635<=$&&$<=9641||9650<=$&&$<=9651||9654<=$&&$<=9655||9660<=$&&$<=9661||9664<=$&&$<=9665||9670<=$&&$<=9672||$==9675||9678<=$&&$<=9681||9698<=$&&$<=9701||$==9711||9733<=$&&$<=9734||$==9737||9742<=$&&$<=9743||9748<=$&&$<=9749||$==9756||$==9758||$==9792||$==9794||9824<=$&&$<=9825||9827<=$&&$<=9829||9831<=$&&$<=9834||9836<=$&&$<=9837||$==9839||9886<=$&&$<=9887||9918<=$&&$<=9919||9924<=$&&$<=9933||9935<=$&&$<=9953||$==9955||9960<=$&&$<=9983||$==10045||$==10071||10102<=$&&$<=10111||11093<=$&&$<=11097||12872<=$&&$<=12879||57344<=$&&$<=63743||65024<=$&&$<=65039||$==65533||127232<=$&&$<=127242||127248<=$&&$<=127277||127280<=$&&$<=127337||127344<=$&&$<=127386||917760<=$&&$<=917999||983040<=$&&$<=1048573||1048576<=$&&$<=1114109?"A":"N"},m.characterLength=function(s){var h=this.eastAsianWidth(s);return h=="F"||h=="W"||h=="A"?2:1};function a(s){return s.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}m.length=function(s){for(var h=a(s),b=0,$=0;$<h.length;$++)b=b+this.characterLength(h[$]);return b},m.slice=function(s,h,b){textLen=m.length(s),h=h||0,b=b||1,h<0&&(h=textLen+h),b<0&&(b=textLen+b);for(var $="",o=0,c=a(s),t=0;t<c.length;t++){var v=c[t],i=m.length(v);if(o>=h-(i==2?1:0))if(o+i<=b)$+=v;else break;o+=i}return $}})(A$);var Tr=A$.exports,Ir=O$(Tr),Pr=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},Ur=O$(Pr);function X(r,m={}){if(typeof r!="string"||r.length===0||(m={ambiguousIsNarrow:!0,...m},r=K$(r),r.length===0))return 0;r=r.replace(Ur()," ");let a=m.ambiguousIsNarrow?1:2,s=0;for(let h of r){let b=h.codePointAt(0);if(b<=31||b>=127&&b<=159||b>=768&&b<=879)continue;switch(Ir.eastAsianWidth(h)){case"F":case"W":s+=2;break;case"A":s+=a;break;default:s+=1}}return s}var h$=10,L$=(r=0)=>(m)=>`\x1B[${m+r}m`,V$=(r=0)=>(m)=>`\x1B[${38+r};5;${m}m`,X$=(r=0)=>(m,a,s)=>`\x1B[${38+r};2;${m};${a};${s}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 Kr=Object.keys(x.color),Or=Object.keys(x.bgColor);[...Kr,...Or];function Ar(){let r=new Map;for(let[m,a]of Object.entries(x)){for(let[s,h]of Object.entries(a))x[s]={open:`\x1B[${h[0]}m`,close:`\x1B[${h[1]}m`},a[s]=x[s],r.set(h[0],h[1]);Object.defineProperty(x,m,{value:a,enumerable:!1})}return Object.defineProperty(x,"codes",{value:r,enumerable:!1}),x.color.close="\x1B[39m",x.bgColor.close="\x1B[49m",x.color.ansi=L$(),x.color.ansi256=V$(),x.color.ansi16m=X$(),x.bgColor.ansi=L$(h$),x.bgColor.ansi256=V$(h$),x.bgColor.ansi16m=X$(h$),Object.defineProperties(x,{rgbToAnsi256:{value:(m,a,s)=>m===a&&a===s?m<8?16:m>248?231:Math.round((m-8)/247*24)+232:16+36*Math.round(m/255*5)+6*Math.round(a/255*5)+Math.round(s/255*5),enumerable:!1},hexToRgb:{value:(m)=>{let a=/[a-f\d]{6}|[a-f\d]{3}/i.exec(m.toString(16));if(!a)return[0,0,0];let[s]=a;s.length===3&&(s=[...s].map((b)=>b+b).join(""));let h=Number.parseInt(s,16);return[h>>16&255,h>>8&255,h&255]},enumerable:!1},hexToAnsi256:{value:(m)=>x.rgbToAnsi256(...x.hexToRgb(m)),enumerable:!1},ansi256ToAnsi:{value:(m)=>{if(m<8)return 30+m;if(m<16)return 90+(m-8);let a,s,h;if(m>=232)a=((m-232)*10+8)/255,s=a,h=a;else{m-=16;let o=m%36;a=Math.floor(m/36)/5,s=Math.floor(o/6)/5,h=o%6/5}let b=Math.max(a,s,h)*2;if(b===0)return 30;let $=30+(Math.round(h)<<2|Math.round(s)<<1|Math.round(a));return b===2&&($+=60),$},enumerable:!1},rgbToAnsi:{value:(m,a,s)=>x.ansi256ToAnsi(x.rgbToAnsi256(m,a,s)),enumerable:!1},hexToAnsi:{value:(m)=>x.ansi256ToAnsi(x.hexToAnsi256(m)),enumerable:!1}}),x}var Nr=Ar(),R=new Set(["\x1B","\x9B"]),Rr=39,e$="\x07",N$="[",Cr="]",R$="m",o$=`${Cr}8;;`,k$=(r)=>`${R.values().next().value}${N$}${r}${R$}`,B$=(r)=>`${R.values().next().value}${o$}${r}${e$}`,_r=(r)=>r.split(" ").map((m)=>X(m)),b$=(r,m,a)=>{let s=[...m],h=!1,b=!1,$=X(K$(r[r.length-1]));for(let[o,c]of s.entries()){let t=X(c);if($+t<=a?r[r.length-1]+=c:(r.push(c),$=0),R.has(c)&&(h=!0,b=s.slice(o+1).join("").startsWith(o$)),h){b?c===e$&&(h=!1,b=!1):c===R$&&(h=!1);continue}$+=t,$===a&&o<s.length-1&&(r.push(""),$=0)}!$&&r[r.length-1].length>0&&r.length>1&&(r[r.length-2]+=r.pop())},ur=(r)=>{let m=r.split(" "),a=m.length;for(;a>0&&!(X(m[a-1])>0);)a--;return a===m.length?r:m.slice(0,a).join(" ")+m.slice(a).join("")},Fr=(r,m,a={})=>{if(a.trim!==!1&&r.trim()==="")return"";let s="",h,b,$=_r(r),o=[""];for(let[t,v]of r.split(" ").entries()){a.trim!==!1&&(o[o.length-1]=o[o.length-1].trimStart());let i=X(o[o.length-1]);if(t!==0&&(i>=m&&(a.wordWrap===!1||a.trim===!1)&&(o.push(""),i=0),(i>0||a.trim===!1)&&(o[o.length-1]+=" ",i++)),a.hard&&$[t]>m){let d=m-i,G=1+Math.floor(($[t]-d-1)/m);Math.floor(($[t]-1)/m)<G&&o.push(""),b$(o,v,m);continue}if(i+$[t]>m&&i>0&&$[t]>0){if(a.wordWrap===!1&&i<m){b$(o,v,m);continue}o.push("")}if(i+$[t]>m&&a.wordWrap===!1){b$(o,v,m);continue}o[o.length-1]+=v}a.trim!==!1&&(o=o.map((t)=>ur(t)));let c=[...o.join(`
|
|
19
|
+
`)];for(let[t,v]of c.entries()){if(s+=v,R.has(v)){let{groups:d}=new RegExp(`(?:\\${N$}(?<code>\\d+)m|\\${o$}(?<uri>.*)${e$})`).exec(c.slice(t).join(""))||{groups:{}};if(d.code!==void 0){let G=Number.parseFloat(d.code);h=G===Rr?void 0:G}else d.uri!==void 0&&(b=d.uri.length===0?void 0:d.uri)}let i=Nr.codes.get(Number(h));c[t+1]===`
|
|
20
|
+
`?(b&&(s+=B$("")),h&&i&&(s+=k$(i))):v===`
|
|
21
|
+
`&&(h&&i&&(s+=k$(h)),b&&(s+=B$(b)))}return s};function E$(r,m,a){return String(r).normalize().replace(/\r\n/g,`
|
|
20
22
|
`).split(`
|
|
21
23
|
`).map((s)=>Fr(s,m,a)).join(`
|
|
22
24
|
`)}var Dr=Object.defineProperty,$m=(r,m,a)=>(m in r)?Dr(r,m,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[m]=a,p=(r,m,a)=>($m(r,typeof m!="symbol"?m+"":m,a),a);function rm(r,m){if(r===m)return;let a=r.split(`
|
|
23
25
|
`),s=m.split(`
|
|
24
|
-
`),
|
|
25
|
-
`),
|
|
26
|
-
`).length-1;this.output.write(w.cursor.move(-999,r*-1))}render(){let r=
|
|
26
|
+
`),h=[];for(let b=0;b<Math.max(a.length,s.length);b++)a[b]!==s[b]&&h.push(b);return h}var C$=Symbol("clack:cancel");function k(r){return r===C$}function A(r,m){r.isTTY&&r.setRawMode(m)}var T$=new Map([["k","up"],["j","down"],["h","left"],["l","right"]]),mm=new Set(["up","down","left","right","space","enter"]);class t${constructor({render:r,input:m=P$,output:a=U$,...s},h=!0){p(this,"input"),p(this,"output"),p(this,"rl"),p(this,"opts"),p(this,"_track",!1),p(this,"_render"),p(this,"_cursor",0),p(this,"state","initial"),p(this,"value"),p(this,"error",""),p(this,"subscribers",new Map),p(this,"_prevFrame",""),this.opts=s,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=r.bind(this),this._track=h,this.input=m,this.output=a}prompt(){let r=new kr(0);return r._write=(m,a,s)=>{this._track&&(this.value=this.rl.line.replace(/\t/g,""),this._cursor=this.rl.cursor,this.emit("value",this.value)),s()},this.input.pipe(r),this.rl=H$.createInterface({input:this.input,output:r,tabSize:2,prompt:"",escapeCodeTimeout:50}),H$.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),A(this.input,!0),this.output.on("resize",this.render),this.render(),new Promise((m,a)=>{this.once("submit",()=>{this.output.write(w.cursor.show),this.output.off("resize",this.render),A(this.input,!1),m(this.value)}),this.once("cancel",()=>{this.output.write(w.cursor.show),this.output.off("resize",this.render),A(this.input,!1),m(C$)})})}on(r,m){let a=this.subscribers.get(r)??[];a.push({cb:m}),this.subscribers.set(r,a)}once(r,m){let a=this.subscribers.get(r)??[];a.push({cb:m,once:!0}),this.subscribers.set(r,a)}emit(r,...m){let a=this.subscribers.get(r)??[],s=[];for(let h of a)h.cb(...m),h.once&&s.push(()=>a.splice(a.indexOf(h),1));for(let h of s)h()}unsubscribe(){this.subscribers.clear()}onKeypress(r,m){if(this.state==="error"&&(this.state="active"),m?.name&&!this._track&&T$.has(m.name)&&this.emit("cursor",T$.get(m.name)),m?.name&&mm.has(m.name)&&this.emit("cursor",m.name),r&&(r.toLowerCase()==="y"||r.toLowerCase()==="n")&&this.emit("confirm",r.toLowerCase()==="y"),r==="\t"&&this.opts.placeholder&&(this.value||(this.rl.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),r&&this.emit("key",r.toLowerCase()),m?.name==="return"){if(this.opts.validate){let a=this.opts.validate(this.value);a&&(this.error=a,this.state="error",this.rl.write(this.value))}this.state!=="error"&&(this.state="submit")}r==="\x03"&&(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(`
|
|
27
|
+
`),A(this.input,!1),this.rl.close(),this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let r=E$(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
|
|
28
|
+
`).length-1;this.output.write(w.cursor.move(-999,r*-1))}render(){let r=E$(this._render(this)??"",process.stdout.columns,{hard:!0});if(r!==this._prevFrame){if(this.state==="initial")this.output.write(w.cursor.hide);else{let m=rm(this._prevFrame,r);if(this.restoreCursor(),m&&m?.length===1){let a=m[0];this.output.write(w.cursor.move(0,a)),this.output.write(w.erase.lines(1));let s=r.split(`
|
|
27
29
|
`);this.output.write(s[a]),this._prevFrame=r,this.output.write(w.cursor.move(0,s.length-a-1));return}else if(m&&m?.length>1){let a=m[0];this.output.write(w.cursor.move(0,a)),this.output.write(w.erase.down());let s=r.split(`
|
|
28
30
|
`).slice(a);this.output.write(s.join(`
|
|
29
|
-
`)),this._prevFrame=r;return}this.output.write(w.erase.down())}this.output.write(r),this.state==="initial"&&(this.state="active"),this._prevFrame=r}}}var am=Object.defineProperty,sm=(r,m,a)=>(m in r)?am(r,m,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[m]=a,I$=(r,m,a)=>(sm(r,typeof m!="symbol"?m+"":m,a),a),_$=class extends t${constructor(r){super(r,!1),I$(this,"options"),I$(this,"cursor",0),this.options=r.options,this.cursor=this.options.findIndex(({value:m})=>m===r.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",(m)=>{switch(m){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}};var
|
|
31
|
+
`)),this._prevFrame=r;return}this.output.write(w.erase.down())}this.output.write(r),this.state==="initial"&&(this.state="active"),this._prevFrame=r}}}var am=Object.defineProperty,sm=(r,m,a)=>(m in r)?am(r,m,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[m]=a,I$=(r,m,a)=>(sm(r,typeof m!="symbol"?m+"":m,a),a),_$=class extends t${constructor(r){super(r,!1),I$(this,"options"),I$(this,"cursor",0),this.options=r.options,this.cursor=this.options.findIndex(({value:m})=>m===r.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",(m)=>{switch(m){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}};var hm=Object.defineProperty,bm=(r,m,a)=>(m in r)?hm(r,m,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[m]=a,em=(r,m,a)=>(bm(r,typeof m!="symbol"?m+"":m,a),a);class c$ extends t${constructor(r){super(r),em(this,"valueWithCursor",""),this.on("finalize",()=>{this.value||(this.value=r.defaultValue),this.valueWithCursor=this.value}),this.on("value",()=>{if(this.cursor>=this.value.length)this.valueWithCursor=`${this.value}${N.default.inverse(N.default.hidden("_"))}`;else{let m=this.value.slice(0,this.cursor),a=this.value.slice(this.cursor);this.valueWithCursor=`${m}${N.default.inverse(a[0])}${a.slice(1)}`}})}get cursor(){return this._cursor}}var om=globalThis.process.platform.startsWith("win");function u$({input:r=P$,output:m=U$,overwrite:a=!0,hideCursor:s=!0}={}){let h=W.createInterface({input:r,output:m,prompt:"",tabSize:1});W.emitKeypressEvents(r,h),r.isTTY&&r.setRawMode(!0);let b=($,{name:o})=>{if(String($)==="\x03"){s&&m.write(w.cursor.show),process.exit(0);return}if(!a)return;W.moveCursor(m,o==="return"?0:-1,o==="return"?-1:0,()=>{W.clearLine(m,1,()=>{r.once("keypress",b)})})};return s&&m.write(w.cursor.hide),r.once("keypress",b),()=>{r.off("keypress",b),s&&m.write(w.cursor.show),r.isTTY&&!om&&r.setRawMode(!1),h.terminal=!1,h.close()}}var e=q(s$(),1),Y=q(m$(),1);import S from"process";function tm(){return S.platform!=="win32"?S.env.TERM!=="linux":Boolean(S.env.CI)||Boolean(S.env.WT_SESSION)||Boolean(S.env.TERMINUS_SUBLIME)||S.env.ConEmuTask==="{cmd::Cmder}"||S.env.TERM_PROGRAM==="Terminus-Sublime"||S.env.TERM_PROGRAM==="vscode"||S.env.TERM==="xterm-256color"||S.env.TERM==="alacritty"||S.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var i$=tm(),l=(r,m)=>i$?r:m,cm=l("\u25C6","*"),F$=l("\u25A0","x"),D$=l("\u25B2","x"),v$=l("\u25C7","o"),S1=l("\u250C","T"),y=l("\u2502","|"),C=l("\u2514","\u2014"),im=l("\u25CF",">"),vm=l("\u25CB"," "),M1=l("\u25FB","[\u2022]"),q1=l("\u25FC","[+]"),W1=l("\u25FB","[ ]"),f1=l("\u25AA","\u2022"),G1=l("\u2500","-"),Z1=l("\u256E","+"),z1=l("\u251C","+"),J1=l("\u256F","+"),xm=l("\u25CF","\u2022"),gm=l("\u25C6","*"),lm=l("\u25B2","!"),dm=l("\u25A0","x"),$r=(r)=>{switch(r){case"initial":case"active":return e.default.cyan(cm);case"cancel":return e.default.red(F$);case"error":return e.default.yellow(D$);case"submit":return e.default.green(v$)}},rr=(r)=>new c$({validate:r.validate,placeholder:r.placeholder,defaultValue:r.defaultValue,initialValue:r.initialValue,render(){let m=`${e.default.gray(y)}
|
|
30
32
|
${$r(this.state)} ${r.message}
|
|
31
|
-
`,a=r.placeholder?
|
|
32
|
-
${
|
|
33
|
-
${
|
|
34
|
-
`;case"submit":return`${m}${
|
|
35
|
-
`+
|
|
36
|
-
${
|
|
37
|
-
`}}}).prompt();var mr=(r)=>{let m=(s,
|
|
33
|
+
`,a=r.placeholder?e.default.inverse(r.placeholder[0])+e.default.dim(r.placeholder.slice(1)):e.default.inverse(e.default.hidden("_")),s=this.value?this.valueWithCursor:a;switch(this.state){case"error":return`${m.trim()}
|
|
34
|
+
${e.default.yellow(y)} ${s}
|
|
35
|
+
${e.default.yellow(C)} ${e.default.yellow(this.error)}
|
|
36
|
+
`;case"submit":return`${m}${e.default.gray(y)} ${e.default.dim(this.value||r.placeholder)}`;case"cancel":return`${m}${e.default.gray(y)} ${e.default.strikethrough(e.default.dim(this.value??""))}${this.value?.trim()?`
|
|
37
|
+
`+e.default.gray(y):""}`;default:return`${m}${e.default.cyan(y)} ${s}
|
|
38
|
+
${e.default.cyan(C)}
|
|
39
|
+
`}}}).prompt();var mr=(r)=>{let m=(s,h)=>{let b=s.label??String(s.value);return h==="active"?`${e.default.green(im)} ${b} ${s.hint?e.default.dim(`(${s.hint})`):""}`:h==="selected"?`${e.default.dim(b)}`:h==="cancelled"?`${e.default.strikethrough(e.default.dim(b))}`:`${e.default.dim(vm)} ${e.default.dim(b)}`},a=0;return new _$({options:r.options,initialValue:r.initialValue,render(){let s=`${e.default.gray(y)}
|
|
38
40
|
${$r(this.state)} ${r.message}
|
|
39
|
-
`;switch(this.state){case"submit":return`${s}${
|
|
40
|
-
${
|
|
41
|
-
${
|
|
42
|
-
${
|
|
43
|
-
`}}}}).prompt()};var x$=(r="")=>{process.stdout.write(`${
|
|
44
|
-
${
|
|
41
|
+
`;switch(this.state){case"submit":return`${s}${e.default.gray(y)} ${m(this.options[this.cursor],"selected")}`;case"cancel":return`${s}${e.default.gray(y)} ${m(this.options[this.cursor],"cancelled")}
|
|
42
|
+
${e.default.gray(y)}`;default:{let h=r.maxItems===void 0?1/0:Math.max(r.maxItems,5);this.cursor>=a+h-3?a=Math.max(Math.min(this.cursor-h+3,this.options.length-h),0):this.cursor<a+2&&(a=Math.max(this.cursor-2,0));let b=h<this.options.length&&a>0,$=h<this.options.length&&a+h<this.options.length;return`${s}${e.default.cyan(y)} ${this.options.slice(a,a+h).map((o,c,t)=>c===0&&b?e.default.dim("..."):c===t.length-1&&$?e.default.dim("..."):m(o,c+a===this.cursor?"active":"inactive")).join(`
|
|
43
|
+
${e.default.cyan(y)} `)}
|
|
44
|
+
${e.default.cyan(C)}
|
|
45
|
+
`}}}}).prompt()};var x$=(r="")=>{process.stdout.write(`${e.default.gray(y)}
|
|
46
|
+
${e.default.gray(C)} ${r}
|
|
45
47
|
|
|
46
|
-
`)},g={message:(r="",{symbol:m=
|
|
47
|
-
`);a.push(`${m} ${s}`,...
|
|
48
|
+
`)},g={message:(r="",{symbol:m=e.default.gray(y)}={})=>{let a=[`${e.default.gray(y)}`];if(r){let[s,...h]=r.split(`
|
|
49
|
+
`);a.push(`${m} ${s}`,...h.map((b)=>`${e.default.gray(y)} ${b}`))}process.stdout.write(`${a.join(`
|
|
48
50
|
`)}
|
|
49
|
-
`)},info:(r)=>{g.message(r,{symbol:
|
|
50
|
-
`);let
|
|
51
|
-
`),a()},i=(v="")=>{h=v??h},t=(v)=>{let c=v>1?"Something went wrong":"Canceled";e&&o(c,v)};return process.on("uncaughtExceptionMonitor",()=>t(2)),process.on("unhandledRejection",()=>t(2)),process.on("SIGINT",()=>t(1)),process.on("SIGTERM",()=>t(1)),process.on("exit",t),{start:$,stop:o,message:i}};function wm(r){return r.startsWith("cr_")&&r.length>10}async function pm(r){try{let a=await(await fetch(`${M}/apiStats/api/get-key-id`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:r})})).json();if(a.success&&a.data?.id)return{valid:!0,apiId:a.data.id};return{valid:!1,error:a.error||"Key \u9A8C\u8BC1\u5931\u8D25"}}catch(m){return{valid:!1,error:m instanceof Error?m.message:"\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25"}}}async function ar(r){if(!wm(r))return{success:!1,error:"Key \u683C\u5F0F\u4E0D\u6B63\u786E\uFF0C\u5FC5\u987B\u4EE5 cr_ \u5F00\u5934"};let m=await pm(r);if(!m.valid)return{success:!1,error:m.error};return await I({apiKey:r,apiId:m.apiId}),{success:!0}}import{join as br}from"path";var u=null,g$={cn:{npm:"https://registry.npmmirror.com",bun:"https://bun.sh/install",bunMirror:"https://registry.npmmirror.com/-/binary/bun"},global:{npm:"https://registry.npmjs.org",bun:"https://bun.sh/install",bunMirror:null}};async function k(){if(u)return u;let r=[nm,Sm,Mm];for(let m of r)try{let a=await Promise.race([m(),new Promise((s,e)=>setTimeout(()=>e(Error("timeout")),3000))]);if(a)return u=a,a}catch{}return u="cn","cn"}async function nm(){try{let r=await fetch("http://ip-api.com/json/?fields=countryCode",{signal:AbortSignal.timeout(2000)});if(!r.ok)return null;return(await r.json()).countryCode==="CN"?"cn":"global"}catch{return null}}async function Sm(){try{let r=await fetch("https://ipinfo.io/json",{signal:AbortSignal.timeout(2000)});if(!r.ok)return null;return(await r.json()).country==="CN"?"cn":"global"}catch{return null}}async function Mm(){try{let r=await fetch("https://api.ip.sb/geoip",{signal:AbortSignal.timeout(2000)});if(!r.ok)return null;return(await r.json()).country_code==="CN"?"cn":"global"}catch{return null}}async function qm(){let r=await k();return g$[r]}async function Y(){return(await qm()).npm}async function sr(){if(await k()==="cn")return`curl -fsSL https://bun.sh/install | BUN_INSTALL_MIRROR="${g$.cn.bunMirror}" bash`;return"curl -fsSL https://bun.sh/install | bash"}async function er(){let r=await k(),m=g$[r];if(r==="cn")g.info("\u68C0\u6D4B\u5230\u4E2D\u56FD\u5927\u9646\u7F51\u7EDC\uFF0C\u4F7F\u7528\u56FD\u5185\u955C\u50CF\u6E90"),g.message(` npm: ${m.npm}`);else g.info("\u4F7F\u7528\u56FD\u9645\u6E90")}var J=null;function fm(r){return r.startsWith(Z)}async function or(){try{if(!await Bun.file(n).exists())return!1;let m=Bun.spawn([n,"--version"],{stdout:"pipe",stderr:"pipe"});return await m.exited,m.exitCode===0}catch{return!1}}async function Wm(){if(process.platform==="win32")return!0;try{let m=Bun.spawn(["which","unzip"],{stdout:"pipe",stderr:"pipe"});if(await m.exited,m.exitCode===0)return!0}catch{}g.warn("\u6B63\u5728\u5B89\u88C5\u7CFB\u7EDF\u4F9D\u8D56 (unzip)...");let r=["apt-get update -qq && apt-get install -y -qq unzip","yum install -y -q unzip","dnf install -y -q unzip","pacman -S --noconfirm unzip","apk add --quiet unzip"];for(let m of r)try{let a=Bun.spawn(["bash","-c",`sudo ${m} 2>/dev/null || ${m}`],{stdout:"pipe",stderr:"pipe"});if(await a.exited,a.exitCode===0)return!0}catch{}return!1}async function Gm(){let r=W();if(!await Wm())return g.error("\u8BF7\u5148\u624B\u52A8\u5B89\u88C5 unzip: apt install unzip / yum install unzip"),!1;await er(),r.start("\u6B63\u5728\u5B89\u88C5 Tako \u4E13\u5C5E Bun \u8FD0\u884C\u65F6...");try{await(await import("fs/promises")).mkdir(Z,{recursive:!0});let a;if(process.platform==="win32"){let e=await k()==="cn"?'$env:BUN_INSTALL_MIRROR="https://registry.npmmirror.com/-/binary/bun"; ':"",h=`$env:BUN_INSTALL="${Z}"; ${e}irm bun.sh/install.ps1 | iex`;a=await Bun.spawn(["powershell","-Command",h],{stdout:"inherit",stderr:"inherit"}).exited}else{let s=await sr(),e=`BUN_INSTALL="${Z}" ${s}`;a=await Bun.spawn(["bash","-c",e],{stdout:"inherit",stderr:"inherit"}).exited}if(a!==0)return r.stop("Bun \u5B89\u88C5\u5931\u8D25"),!1;return J=n,r.stop("Tako \u4E13\u5C5E Bun \u5B89\u88C5\u5B8C\u6210"),g.info(`\u5B89\u88C5\u4F4D\u7F6E: ${Z}`),!0}catch(m){return r.stop("Bun \u5B89\u88C5\u5931\u8D25"),!1}}async function Zm(){if(await or())return J=n,!0;return g.warn("\u672A\u68C0\u6D4B\u5230 Tako \u4E13\u5C5E Bun\uFF0C\u6B63\u5728\u81EA\u52A8\u5B89\u88C5..."),g.info("\uFF08\u4E0D\u4F1A\u5F71\u54CD\u60A8\u7CFB\u7EDF\u4E2D\u5DF2\u5B89\u88C5\u7684 Node.js \u6216 Bun\uFF09"),await Gm()}async function l$(){if(J){if(!fm(J))J=n;return J}if(await or())return J=n,n;return n}async function tr(r){try{let m=await Y(),a=await fetch(`${m}/${r}/latest`);if(!a.ok)return null;return(await a.json()).version}catch{return null}}async function zm(r){return(await z()).installedClients[r.id]?.version||null}async function cr(r){let m=U(r.id),a=br(m,"package.json");try{return await Bun.file(a).exists()}catch{return!1}}async function ir(r){let m=await zm(r);if(!m)return!0;let a=await tr(r.package);if(!a)return!1;return m!==a}async function hr(r,m=!1){let a=W(),s=U(r.id);try{if(!await Zm())return{success:!1,error:"Tako \u4E13\u5C5E Bun \u5B89\u88C5\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u6216\u624B\u52A8\u5220\u9664 ~/.tako/bun \u76EE\u5F55\u540E\u91CD\u8BD5"};let e=await cr(r),h=m||await ir(r);if(e&&!h)return{success:!0};let $=e?"\u66F4\u65B0":"\u5B89\u88C5";a.start(`\u6B63\u5728${$} ${r.name}...`),await(await import("fs/promises")).mkdir(s,{recursive:!0});let i=br(s,"package.json");if(!await Bun.file(i).exists())await Bun.write(i,JSON.stringify({name:`tako-${r.id}`,private:!0,dependencies:{}},null,2));let v=await l$(),c=await Y(),d=Bun.spawn([v,"add",r.package,"--registry",c],{cwd:s,stdout:"pipe",stderr:"pipe"});if(await d.exited!==0){let T=await new Response(d.stderr).text();return a.stop(`${$} ${r.name} \u5931\u8D25`),{success:!1,error:T}}let B=await tr(r.package);if(B){let T=await z();T.installedClients[r.id]={version:B,installedAt:new Date().toISOString()},await I(T)}return a.stop(`${r.name} ${$}\u5B8C\u6210`),{success:!0}}catch(e){return a.stop("\u64CD\u4F5C\u5931\u8D25"),{success:!1,error:e instanceof Error?e.message:"\u672A\u77E5\u9519\u8BEF"}}}async function vr(r){if(!await cr(r))return await hr(r);if(await ir(r))return await hr(r,!0);return{success:!0}}async function xr(r){try{let m=await vr(r);if(!m.success)return m;let a=await f$();if(!a)return{success:!1,error:"\u672A\u914D\u7F6E API Key"};if(r.setupConfigFiles)await r.setupConfigFiles(a);let s=Z$(r);if(!await Bun.file(s).exists())return{success:!1,error:`\u627E\u4E0D\u5230\u53EF\u6267\u884C\u6587\u4EF6: ${s}`};let h=r.getEnvVars(a),$={...process.env,...h};g.info(`\u542F\u52A8 ${r.name}...`);let o;if(r.runtime==="native")o=[s];else o=[await l$(),s];return await Bun.spawn(o,{env:$,stdio:["inherit","inherit","inherit"],cwd:process.cwd()}).exited,{success:!0}}catch(m){return{success:!1,error:m instanceof Error?m.message:"\u542F\u52A8\u5931\u8D25"}}}async function d$(){try{let r=await W$();if(!r)return{success:!1,error:"\u672A\u627E\u5230 API ID\uFF0C\u8BF7\u91CD\u65B0\u914D\u7F6E Key"};let a=await(await fetch(`${M}/apiStats/api/user-stats`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiId:r})})).json(),e=await(await fetch(`${M}/apiStats/api/user-model-stats`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiId:r,period:"daily"})})).json();if(!a.success)return{success:!1,error:a.error||a.message||"\u83B7\u53D6\u7EDF\u8BA1\u5931\u8D25"};let h=(e.data||[]).map(($)=>({model:$.model,requests:$.requests,cost:$.formatted?.total||"$0.00"}));return{success:!0,data:{totalRequests:a.data?.usage?.total?.requests||0,totalCost:a.data?.usage?.total?.formattedCost||"$0.00",todayCost:`$${(a.data?.limits?.currentDailyCost||0).toFixed(2)}`,modelStats:h}}}catch(r){return{success:!1,error:r instanceof Error?r.message:"\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25"}}}function y$(r){return r.toLocaleString("en-US")}var gr="tako-cli",H="0.1.19";function Jm(r,m){let a=r.split(".").map(Number),s=m.split(".").map(Number);for(let e=0;e<3;e++){let h=a[e]||0,$=s[e]||0;if(h>$)return 1;if(h<$)return-1}return 0}async function Qm(){try{let r=await Y(),m=await fetch(`${r}/${gr}/latest`,{signal:AbortSignal.timeout(5000)});if(!m.ok)return null;return(await m.json()).version||null}catch{return null}}async function jm(){let r=await Qm();if(!r)return{hasUpdate:!1,currentVersion:H};return{hasUpdate:Jm(r,H)>0,latestVersion:r,currentVersion:H}}async function Ym(r){let m=W();m.start(`\u6B63\u5728\u66F4\u65B0\u5230 v${r}...`);try{let a=await Y(),s=Bun.spawn([n,"add","-g",`${gr}@latest`,"--registry",a],{stdout:"pipe",stderr:"pipe"});if(await s.exited,s.exitCode===0)return m.stop(`\u66F4\u65B0\u6210\u529F\uFF01\u5DF2\u66F4\u65B0\u5230 v${r}`),!0;else{let e=await new Response(s.stderr).text();return m.stop(`\u66F4\u65B0\u5931\u8D25: ${e||"\u672A\u77E5\u9519\u8BEF"}`),!1}}catch(a){return m.stop(`\u66F4\u65B0\u5931\u8D25: ${a instanceof Error?a.message:"\u672A\u77E5\u9519\u8BEF"}`),!1}}async function lr(){try{let r=await jm();if(r.hasUpdate&&r.latestVersion){if(g.warn(`\u53D1\u73B0\u65B0\u7248\u672C v${r.latestVersion}\uFF08\u5F53\u524D v${H}\uFF09`),await Ym(r.latestVersion))g.info("\u8BF7\u91CD\u65B0\u542F\u52A8 Tako CLI \u4EE5\u4F7F\u7528\u65B0\u7248\u672C"),process.exit(0)}}catch{}}function Hm(){console.log(),console.log(` \uD83D\uDC19 Tako CLI v${H}`),console.log(" \x1B[90m\u6B22\u8FCE\u4F7F\u7528\uFF01\x1B[0m"),console.log()}async function dr(r=!1){if(!r)g.warn("\u672A\u68C0\u6D4B\u5230 API Key"),console.log();let m=await rr({message:r?"\u8BF7\u8F93\u5165\u65B0\u7684 API Key (cr_xxx):":"\u8BF7\u8F93\u5165\u4F60\u7684 API Key (cr_xxx):",placeholder:"cr_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",validate(e){if(!e)return"\u8BF7\u8F93\u5165 API Key";if(!e.startsWith("cr_"))return"Key \u5FC5\u987B\u4EE5 cr_ \u5F00\u5934";if(e.length<10)return"Key \u683C\u5F0F\u4E0D\u6B63\u786E"}});if(X(m))return!1;let a=W();a.start("\u9A8C\u8BC1 Key \u4E2D...");let s=await ar(m);if(s.success)return a.stop("Key \u9A8C\u8BC1\u6210\u529F\uFF01\u5DF2\u4FDD\u5B58\u5230\u914D\u7F6E\u6587\u4EF6"),!0;else return a.stop(`\u9A8C\u8BC1\u5931\u8D25: ${s.error}`),!1}function Lm(r,m){let a=[];if(a.push(""),a.push(" \uD83D\uDCCA \u7528\u91CF\u7EDF\u8BA1"),a.push(""),a.push(` \u603B\u8C03\u7528\u6B21\u6570: ${y$(r.totalRequests)} \u6B21`),a.push(` \u603B\u6D88\u8D39: ${r.totalCost}`),a.push(` \u4ECA\u65E5\u6D88\u8D39: ${r.todayCost}`),r.modelStats.length>0)a.push(""),a.push(" \u6A21\u578B\u4F7F\u7528\u5206\u5E03 (\u4ECA\u65E5):"),r.modelStats.forEach((s,e)=>{let h=e===r.modelStats.length-1?"\u2514\u2500":"\u251C\u2500",$=s.model.length>25?s.model.slice(0,22)+"...":s.model;a.push(` ${h} ${$.padEnd(25)} ${y$(s.requests).padStart(6)} \u6B21 ${s.cost.padStart(8)}`)});return a.push(""),a.push(` \x1B[90m${m}s \u540E\u5237\u65B0 | \u6309\u4EFB\u610F\u952E\u8FD4\u56DE\x1B[0m`),a.join(`
|
|
52
|
-
`)}async function Vm(){let m=
|
|
53
|
-
`).length;process.stdout.write(`\x1B[${o}A\x1B[0J`)}
|
|
51
|
+
`)},info:(r)=>{g.message(r,{symbol:e.default.blue(xm)})},success:(r)=>{g.message(r,{symbol:e.default.green(gm)})},step:(r)=>{g.message(r,{symbol:e.default.green(v$)})},warn:(r)=>{g.message(r,{symbol:e.default.yellow(lm)})},warning:(r)=>{g.warn(r)},error:(r)=>{g.message(r,{symbol:e.default.red(dm)})}},f=()=>{let r=i$?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],m=i$?80:120,a,s,h=!1,b="",$=(v="")=>{h=!0,a=u$(),b=v.replace(/\.+$/,""),process.stdout.write(`${e.default.gray(y)}
|
|
52
|
+
`);let i=0,d=0;s=setInterval(()=>{let G=e.default.magenta(r[i]),E=".".repeat(Math.floor(d)).slice(0,3);process.stdout.write(Y.cursor.move(-999,0)),process.stdout.write(Y.erase.down(1)),process.stdout.write(`${G} ${b}${E}`),i=i+1<r.length?i+1:0,d=d<r.length?d+0.125:0},m)},o=(v="",i=0)=>{b=v??b,h=!1,clearInterval(s);let d=i===0?e.default.green(v$):i===1?e.default.red(F$):e.default.red(D$);process.stdout.write(Y.cursor.move(-999,0)),process.stdout.write(Y.erase.down(1)),process.stdout.write(`${d} ${b}
|
|
53
|
+
`),a()},c=(v="")=>{b=v??b},t=(v)=>{let i=v>1?"Something went wrong":"Canceled";h&&o(i,v)};return process.on("uncaughtExceptionMonitor",()=>t(2)),process.on("unhandledRejection",()=>t(2)),process.on("SIGINT",()=>t(1)),process.on("SIGTERM",()=>t(1)),process.on("exit",t),{start:$,stop:o,message:c}};function wm(r){return r.startsWith("cr_")&&r.length>10}async function pm(r){try{let a=await(await fetch(`${M}/apiStats/api/get-key-id`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:r})})).json();if(a.success&&a.data?.id)return{valid:!0,apiId:a.data.id};return{valid:!1,error:a.error||"Key \u9A8C\u8BC1\u5931\u8D25"}}catch(m){return{valid:!1,error:m instanceof Error?m.message:"\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25"}}}async function ar(r){if(!wm(r))return{success:!1,error:"Key \u683C\u5F0F\u4E0D\u6B63\u786E\uFF0C\u5FC5\u987B\u4EE5 cr_ \u5F00\u5934"};let m=await pm(r);if(!m.valid)return{success:!1,error:m.error};return await P({apiKey:r,apiId:m.apiId}),{success:!0}}import{join as er}from"path";var _=null,g$={cn:{npm:"https://registry.npmmirror.com",bun:"https://bun.sh/install",bunMirror:"https://registry.npmmirror.com/-/binary/bun"},global:{npm:"https://registry.npmjs.org",bun:"https://bun.sh/install",bunMirror:null}};async function B(){if(_)return _;let r=[nm,Sm,Mm];for(let m of r)try{let a=await Promise.race([m(),new Promise((s,h)=>setTimeout(()=>h(Error("timeout")),3000))]);if(a)return _=a,a}catch{}return _="cn","cn"}async function nm(){try{let r=await fetch("http://ip-api.com/json/?fields=countryCode",{signal:AbortSignal.timeout(2000)});if(!r.ok)return null;return(await r.json()).countryCode==="CN"?"cn":"global"}catch{return null}}async function Sm(){try{let r=await fetch("https://ipinfo.io/json",{signal:AbortSignal.timeout(2000)});if(!r.ok)return null;return(await r.json()).country==="CN"?"cn":"global"}catch{return null}}async function Mm(){try{let r=await fetch("https://api.ip.sb/geoip",{signal:AbortSignal.timeout(2000)});if(!r.ok)return null;return(await r.json()).country_code==="CN"?"cn":"global"}catch{return null}}async function qm(){let r=await B();return g$[r]}async function H(){return(await qm()).npm}async function sr(){if(await B()==="cn")return`curl -fsSL https://bun.sh/install | BUN_INSTALL_MIRROR="${g$.cn.bunMirror}" bash`;return"curl -fsSL https://bun.sh/install | bash"}async function hr(){let r=await B(),m=g$[r];if(r==="cn")g.info("\u68C0\u6D4B\u5230\u4E2D\u56FD\u5927\u9646\u7F51\u7EDC\uFF0C\u4F7F\u7528\u56FD\u5185\u955C\u50CF\u6E90"),g.message(` npm: ${m.npm}`);else g.info("\u4F7F\u7528\u56FD\u9645\u6E90")}var J=null;function Wm(r){return r.startsWith(Z)}async function or(){try{if(!await Bun.file(n).exists())return!1;let m=Bun.spawn([n,"--version"],{stdout:"pipe",stderr:"pipe"});return await m.exited,m.exitCode===0}catch{return!1}}async function fm(){if(process.platform==="win32")return!0;try{let m=Bun.spawn(["which","unzip"],{stdout:"pipe",stderr:"pipe"});if(await m.exited,m.exitCode===0)return!0}catch{}g.warn("\u6B63\u5728\u5B89\u88C5\u7CFB\u7EDF\u4F9D\u8D56 (unzip)...");let r=["apt-get update -qq && apt-get install -y -qq unzip","yum install -y -q unzip","dnf install -y -q unzip","pacman -S --noconfirm unzip","apk add --quiet unzip"];for(let m of r)try{let a=Bun.spawn(["bash","-c",`sudo ${m} 2>/dev/null || ${m}`],{stdout:"pipe",stderr:"pipe"});if(await a.exited,a.exitCode===0)return!0}catch{}return!1}async function Gm(){let r=f();if(!await fm())return g.error("\u8BF7\u5148\u624B\u52A8\u5B89\u88C5 unzip: apt install unzip / yum install unzip"),!1;await hr(),r.start("\u6B63\u5728\u5B89\u88C5 Tako \u4E13\u5C5E Bun \u8FD0\u884C\u65F6...");try{await(await import("fs/promises")).mkdir(Z,{recursive:!0});let a;if(process.platform==="win32"){let h=await B()==="cn"?'$env:BUN_INSTALL_MIRROR="https://registry.npmmirror.com/-/binary/bun"; ':"",b=`$env:BUN_INSTALL="${Z}"; ${h}irm bun.sh/install.ps1 | iex`;a=await Bun.spawn(["powershell","-Command",b],{stdout:"inherit",stderr:"inherit"}).exited}else{let s=await sr(),h=`BUN_INSTALL="${Z}" ${s}`;a=await Bun.spawn(["bash","-c",h],{stdout:"inherit",stderr:"inherit"}).exited}if(a!==0)return r.stop("Bun \u5B89\u88C5\u5931\u8D25"),!1;return J=n,r.stop("Tako \u4E13\u5C5E Bun \u5B89\u88C5\u5B8C\u6210"),g.info(`\u5B89\u88C5\u4F4D\u7F6E: ${Z}`),!0}catch(m){return r.stop("Bun \u5B89\u88C5\u5931\u8D25"),!1}}async function Zm(){if(await or())return J=n,!0;return g.warn("\u672A\u68C0\u6D4B\u5230 Tako \u4E13\u5C5E Bun\uFF0C\u6B63\u5728\u81EA\u52A8\u5B89\u88C5..."),g.info("\uFF08\u4E0D\u4F1A\u5F71\u54CD\u60A8\u7CFB\u7EDF\u4E2D\u5DF2\u5B89\u88C5\u7684 Node.js \u6216 Bun\uFF09"),await Gm()}async function l$(){if(J){if(!Wm(J))J=n;return J}if(await or())return J=n,n;return n}async function tr(r){try{let m=await H(),a=await fetch(`${m}/${r}/latest`);if(!a.ok)return null;return(await a.json()).version}catch{return null}}async function zm(r){return(await z()).installedClients[r.id]?.version||null}async function cr(r){let m=j(r.id),a=er(m,"package.json");try{return await Bun.file(a).exists()}catch{return!1}}async function ir(r){let m=await zm(r);if(!m)return!0;let a=await tr(r.package);if(!a)return!1;return m!==a}async function br(r,m=!1){let a=f(),s=j(r.id);try{if(!await Zm())return{success:!1,error:"Tako \u4E13\u5C5E Bun \u5B89\u88C5\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u6216\u624B\u52A8\u5220\u9664 ~/.tako/bun \u76EE\u5F55\u540E\u91CD\u8BD5"};let h=await cr(r),b=m||await ir(r);if(h&&!b)return{success:!0};let $=h?"\u66F4\u65B0":"\u5B89\u88C5";a.start(`\u6B63\u5728${$} ${r.name}...`),await(await import("fs/promises")).mkdir(s,{recursive:!0});let c=er(s,"package.json");if(!await Bun.file(c).exists())await Bun.write(c,JSON.stringify({name:`tako-${r.id}`,private:!0,dependencies:{}},null,2));let v=await l$(),i=await H(),d=Bun.spawn([v,"add",r.package,"--registry",i],{cwd:s,stdout:"pipe",stderr:"pipe"});if(await d.exited!==0){let T=await new Response(d.stderr).text();return a.stop(`${$} ${r.name} \u5931\u8D25`),{success:!1,error:T}}let E=await tr(r.package);if(E){let T=await z();T.installedClients[r.id]={version:E,installedAt:new Date().toISOString()},await P(T)}return a.stop(`${r.name} ${$}\u5B8C\u6210`),{success:!0}}catch(h){return a.stop("\u64CD\u4F5C\u5931\u8D25"),{success:!1,error:h instanceof Error?h.message:"\u672A\u77E5\u9519\u8BEF"}}}async function vr(r){if(!await cr(r))return await br(r);if(await ir(r))return await br(r,!0);return{success:!0}}async function xr(r){try{let m=await vr(r);if(!m.success)return m;let a=await W$();if(!a)return{success:!1,error:"\u672A\u914D\u7F6E API Key"};if(r.setupConfigFiles)await r.setupConfigFiles(a);let s=r.getEnvVars(a),h={...process.env,...s};g.info(`\u542F\u52A8 ${r.name}...`);let b,$;if(r.runtime==="native"){let c=Z$(r);if(!await Bun.file(c).exists())return{success:!1,error:`\u627E\u4E0D\u5230\u53EF\u6267\u884C\u6587\u4EF6: ${c}`};b=[c],$=process.cwd()}else{let c=await l$(),t=j(r.id);b=[c,"--bun","run",r.command],$=t}return await Bun.spawn(b,{env:h,stdio:["inherit","inherit","inherit"],cwd:$}).exited,{success:!0}}catch(m){return{success:!1,error:m instanceof Error?m.message:"\u542F\u52A8\u5931\u8D25"}}}async function d$(){try{let r=await f$();if(!r)return{success:!1,error:"\u672A\u627E\u5230 API ID\uFF0C\u8BF7\u91CD\u65B0\u914D\u7F6E Key"};let a=await(await fetch(`${M}/apiStats/api/user-stats`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiId:r})})).json(),h=await(await fetch(`${M}/apiStats/api/user-model-stats`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiId:r,period:"daily"})})).json();if(!a.success)return{success:!1,error:a.error||a.message||"\u83B7\u53D6\u7EDF\u8BA1\u5931\u8D25"};let b=(h.data||[]).map(($)=>({model:$.model,requests:$.requests,cost:$.formatted?.total||"$0.00"}));return{success:!0,data:{totalRequests:a.data?.usage?.total?.requests||0,totalCost:a.data?.usage?.total?.formattedCost||"$0.00",todayCost:`$${(a.data?.limits?.currentDailyCost||0).toFixed(2)}`,modelStats:b}}}catch(r){return{success:!1,error:r instanceof Error?r.message:"\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25"}}}function y$(r){return r.toLocaleString("en-US")}var gr="tako-cli",L="0.1.20";function Jm(r,m){let a=r.split(".").map(Number),s=m.split(".").map(Number);for(let h=0;h<3;h++){let b=a[h]||0,$=s[h]||0;if(b>$)return 1;if(b<$)return-1}return 0}async function Qm(){try{let r=await H(),m=await fetch(`${r}/${gr}/latest`,{signal:AbortSignal.timeout(5000)});if(!m.ok)return null;return(await m.json()).version||null}catch{return null}}async function jm(){let r=await Qm();if(!r)return{hasUpdate:!1,currentVersion:L};return{hasUpdate:Jm(r,L)>0,latestVersion:r,currentVersion:L}}async function Ym(r){let m=f();m.start(`\u6B63\u5728\u66F4\u65B0\u5230 v${r}...`);try{let a=await H(),s=Bun.spawn([n,"add","-g",`${gr}@latest`,"--registry",a],{stdout:"pipe",stderr:"pipe"});if(await s.exited,s.exitCode===0)return m.stop(`\u66F4\u65B0\u6210\u529F\uFF01\u5DF2\u66F4\u65B0\u5230 v${r}`),!0;else{let h=await new Response(s.stderr).text();return m.stop(`\u66F4\u65B0\u5931\u8D25: ${h||"\u672A\u77E5\u9519\u8BEF"}`),!1}}catch(a){return m.stop(`\u66F4\u65B0\u5931\u8D25: ${a instanceof Error?a.message:"\u672A\u77E5\u9519\u8BEF"}`),!1}}async function lr(){try{let r=await jm();if(r.hasUpdate&&r.latestVersion){if(g.warn(`\u53D1\u73B0\u65B0\u7248\u672C v${r.latestVersion}\uFF08\u5F53\u524D v${L}\uFF09`),await Ym(r.latestVersion))g.info("\u8BF7\u91CD\u65B0\u542F\u52A8 Tako CLI \u4EE5\u4F7F\u7528\u65B0\u7248\u672C"),process.exit(0)}}catch{}}function Hm(){console.log(),console.log(` \uD83D\uDC19 Tako CLI v${L}`),console.log(" \x1B[90m\u6B22\u8FCE\u4F7F\u7528\uFF01\x1B[0m"),console.log()}async function dr(r=!1){if(!r)g.warn("\u672A\u68C0\u6D4B\u5230 API Key"),console.log();let m=await rr({message:r?"\u8BF7\u8F93\u5165\u65B0\u7684 API Key (cr_xxx):":"\u8BF7\u8F93\u5165\u4F60\u7684 API Key (cr_xxx):",placeholder:"cr_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",validate(h){if(!h)return"\u8BF7\u8F93\u5165 API Key";if(!h.startsWith("cr_"))return"Key \u5FC5\u987B\u4EE5 cr_ \u5F00\u5934";if(h.length<10)return"Key \u683C\u5F0F\u4E0D\u6B63\u786E"}});if(k(m))return!1;let a=f();a.start("\u9A8C\u8BC1 Key \u4E2D...");let s=await ar(m);if(s.success)return a.stop("Key \u9A8C\u8BC1\u6210\u529F\uFF01\u5DF2\u4FDD\u5B58\u5230\u914D\u7F6E\u6587\u4EF6"),!0;else return a.stop(`\u9A8C\u8BC1\u5931\u8D25: ${s.error}`),!1}function Lm(r,m){let a=[];if(a.push(""),a.push(" \uD83D\uDCCA \u7528\u91CF\u7EDF\u8BA1"),a.push(""),a.push(` \u603B\u8C03\u7528\u6B21\u6570: ${y$(r.totalRequests)} \u6B21`),a.push(` \u603B\u6D88\u8D39: ${r.totalCost}`),a.push(` \u4ECA\u65E5\u6D88\u8D39: ${r.todayCost}`),r.modelStats.length>0)a.push(""),a.push(" \u6A21\u578B\u4F7F\u7528\u5206\u5E03 (\u4ECA\u65E5):"),r.modelStats.forEach((s,h)=>{let b=h===r.modelStats.length-1?"\u2514\u2500":"\u251C\u2500",$=s.model.length>25?s.model.slice(0,22)+"...":s.model;a.push(` ${b} ${$.padEnd(25)} ${y$(s.requests).padStart(6)} \u6B21 ${s.cost.padStart(8)}`)});return a.push(""),a.push(` \x1B[90m${m}s \u540E\u5237\u65B0 | \u6309\u4EFB\u610F\u952E\u8FD4\u56DE\x1B[0m`),a.join(`
|
|
54
|
+
`)}async function Vm(){let m=f();m.start("\u83B7\u53D6\u7528\u91CF\u7EDF\u8BA1...");let a=await d$();if(!a.success){m.stop(`\u83B7\u53D6\u5931\u8D25: ${a.error}`);return}m.stop("");let s=10,h="",b=()=>{if(h){let o=h.split(`
|
|
55
|
+
`).length;process.stdout.write(`\x1B[${o}A\x1B[0J`)}h=Lm(a.data,s),console.log(h)};b();let $=process.stdin.isRaw;if(process.stdin.isTTY)process.stdin.setRawMode(!0);return process.stdin.resume(),new Promise((o)=>{let c=!0,t=()=>{if(!c)return;c=!1,i(),o()},v=setInterval(async()=>{if(!c)return;if(s--,s<=0){s=10;let d=await d$();if(d.success)a=d}b()},1000),i=()=>{if(clearInterval(v),process.stdin.removeListener("data",t),process.stdin.isTTY)process.stdin.setRawMode($??!1);process.stdin.pause()};process.stdin.on("data",t)})}async function Xm(){let m=[...J$().map((s)=>({value:{type:"launch",client:s},label:`\u542F\u52A8 ${s.name}`,hint:s.package})),{value:{type:"stats"},label:"\u67E5\u770B\u7528\u91CF\u7EDF\u8BA1"},{value:{type:"config"},label:"\u914D\u7F6E API Key"},{value:{type:"exit"},label:"\u9000\u51FA"}],a=await mr({message:"\u8BF7\u9009\u62E9\u64CD\u4F5C:",options:m});if(k(a))return null;return a}async function km(r){switch(r.type){case"launch":let m=await xr(r.client);if(!m.success)g.error(m.error||"\u542F\u52A8\u5931\u8D25");return!0;case"stats":return await Vm(),!0;case"config":return await dr(!0),!0;case"exit":return!1}}async function yr(){if(Hm(),!await q$()){if(!await dr()){x$("\u518D\u89C1\uFF01");return}}while(!0){let m=await Xm();if(m===null)break;if(!await km(m))break}x$("\u518D\u89C1\uFF01")}async function Bm(){await lr(),await yr()}Bm().catch((r)=>{console.error("Tako CLI \u53D1\u751F\u9519\u8BEF:",r),process.exit(1)});
|