mmx-cli 1.0.11 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/mmx.mjs +172 -162
- package/package.json +1 -1
package/dist/mmx.mjs
CHANGED
|
@@ -1,104 +1,104 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{createRequire as
|
|
2
|
+
import{createRequire as Ji}from"node:module";var Si=Object.create;var{getPrototypeOf:Ai,defineProperty:Ut,getOwnPropertyNames:ji}=Object;var Gi=Object.prototype.hasOwnProperty;function qi(t){return this[t]}var Ti,Bi,kt=(t,n,i)=>{var r=t!=null&&typeof t==="object";if(r){var o=n?Ti??=new WeakMap:Bi??=new WeakMap,$=o.get(t);if($)return $}i=t!=null?Si(Ai(t)):{};let e=n||!t||!t.__esModule?Ut(i,"default",{value:t,enumerable:!0}):i;for(let m of ji(t))if(!Gi.call(e,m))Ut(e,m,{get:qi.bind(t,m),enumerable:!0});if(r)o.set(t,e);return e};var Tn=(t,n)=>()=>(n||t((n={exports:{}}).exports,n),n.exports);var Ni=(t)=>t;function li(t,n){this[t]=Ni.bind(null,n)}var Bn=(t,n)=>{for(var i in n)Ut(t,i,{get:n[i],enumerable:!0,configurable:!0,set:li.bind(n,i)})};var It=(t,n)=>()=>(t&&(n=t(t=0)),n);var $t=Ji(import.meta.url);var Dt=Tn((im,ee)=>{var gt={to(t,n){if(!n)return`\x1B[${t+1}G`;return`\x1B[${n+1};${t+1}H`},move(t,n){let i="";if(t<0)i+=`\x1B[${-t}D`;else if(t>0)i+=`\x1B[${t}C`;if(n<0)i+=`\x1B[${-n}A`;else if(n>0)i+=`\x1B[${n}B`;return i},up:(t=1)=>`\x1B[${t}A`,down:(t=1)=>`\x1B[${t}B`,forward:(t=1)=>`\x1B[${t}C`,backward:(t=1)=>`\x1B[${t}D`,nextLine:(t=1)=>"\x1B[E".repeat(t),prevLine:(t=1)=>"\x1B[F".repeat(t),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},pr={up:(t=1)=>"\x1B[S".repeat(t),down:(t=1)=>"\x1B[T".repeat(t)},ur={screen:"\x1B[2J",up:(t=1)=>"\x1B[1J".repeat(t),down:(t=1)=>"\x1B[J".repeat(t),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(t){let n="";for(let i=0;i<t;i++)n+=this.line+(i<t-1?gt.up():"");if(t)n+=gt.left;return n}};ee.exports={cursor:gt,scroll:pr,erase:ur,beep:"\x07"}});var nn=Tn((rm,tn)=>{var Jt=process||{},ie=Jt.argv||[],lt=Jt.env||{},yr=!(!!lt.NO_COLOR||ie.includes("--no-color"))&&(!!lt.FORCE_COLOR||ie.includes("--color")||Jt.platform==="win32"||(Jt.stdout||{}).isTTY&<.TERM!=="dumb"||!!lt.CI),cr=(t,n,i=t)=>(r)=>{let o=""+r,$=o.indexOf(n,t.length);return~$?t+_r(o,n,i,$)+n:t+o+n},_r=(t,n,i,r)=>{let o="",$=0;do o+=t.substring($,r)+i,$=r+n.length,r=t.indexOf(n,$);while(~r);return o+t.substring($)},re=(t=yr)=>{let n=t?cr:()=>String;return{isColorSupported:t,reset:n("\x1B[0m","\x1B[0m"),bold:n("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:n("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:n("\x1B[3m","\x1B[23m"),underline:n("\x1B[4m","\x1B[24m"),inverse:n("\x1B[7m","\x1B[27m"),hidden:n("\x1B[8m","\x1B[28m"),strikethrough:n("\x1B[9m","\x1B[29m"),black:n("\x1B[30m","\x1B[39m"),red:n("\x1B[31m","\x1B[39m"),green:n("\x1B[32m","\x1B[39m"),yellow:n("\x1B[33m","\x1B[39m"),blue:n("\x1B[34m","\x1B[39m"),magenta:n("\x1B[35m","\x1B[39m"),cyan:n("\x1B[36m","\x1B[39m"),white:n("\x1B[37m","\x1B[39m"),gray:n("\x1B[90m","\x1B[39m"),bgBlack:n("\x1B[40m","\x1B[49m"),bgRed:n("\x1B[41m","\x1B[49m"),bgGreen:n("\x1B[42m","\x1B[49m"),bgYellow:n("\x1B[43m","\x1B[49m"),bgBlue:n("\x1B[44m","\x1B[49m"),bgMagenta:n("\x1B[45m","\x1B[49m"),bgCyan:n("\x1B[46m","\x1B[49m"),bgWhite:n("\x1B[47m","\x1B[49m"),blackBright:n("\x1B[90m","\x1B[39m"),redBright:n("\x1B[91m","\x1B[39m"),greenBright:n("\x1B[92m","\x1B[39m"),yellowBright:n("\x1B[93m","\x1B[39m"),blueBright:n("\x1B[94m","\x1B[39m"),magentaBright:n("\x1B[95m","\x1B[39m"),cyanBright:n("\x1B[96m","\x1B[39m"),whiteBright:n("\x1B[97m","\x1B[39m"),bgBlackBright:n("\x1B[100m","\x1B[49m"),bgRedBright:n("\x1B[101m","\x1B[49m"),bgGreenBright:n("\x1B[102m","\x1B[49m"),bgYellowBright:n("\x1B[103m","\x1B[49m"),bgBlueBright:n("\x1B[104m","\x1B[49m"),bgMagentaBright:n("\x1B[105m","\x1B[49m"),bgCyanBright:n("\x1B[106m","\x1B[49m"),bgWhiteBright:n("\x1B[107m","\x1B[49m")}};tn.exports=re();tn.exports.createColors=re});import{stdin as ve,stdout as Re}from"node:process";import*as f from"node:readline";import oe from"node:readline";import{WriteStream as xr}from"node:tty";function wr({onlyFirst:t=!1}={}){let n=["[\\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(n,t?void 0:"g")}function ke(t){if(typeof t!="string")throw TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(hr,"")}function Me(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function ht(t,n={}){if(typeof t!="string"||t.length===0||(n={ambiguousIsNarrow:!0,...n},t=ke(t),t.length===0))return 0;t=t.replace(Rr()," ");let i=n.ambiguousIsNarrow?1:2,r=0;for(let o of t){let $=o.codePointAt(0);if($<=31||$>=127&&$<=159||$>=768&&$<=879)continue;switch(sr.eastAsianWidth(o)){case"F":case"W":r+=2;break;case"A":r+=i;break;default:r+=1}}return r}function Sr(){let t=new Map;for(let[n,i]of Object.entries(B)){for(let[r,o]of Object.entries(i))B[r]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},i[r]=B[r],t.set(o[0],o[1]);Object.defineProperty(B,n,{value:i,enumerable:!1})}return Object.defineProperty(B,"codes",{value:t,enumerable:!1}),B.color.close="\x1B[39m",B.bgColor.close="\x1B[49m",B.color.ansi=$e(),B.color.ansi256=me(),B.color.ansi16m=pe(),B.bgColor.ansi=$e(en),B.bgColor.ansi256=me(en),B.bgColor.ansi16m=pe(en),Object.defineProperties(B,{rgbToAnsi256:{value:(n,i,r)=>n===i&&i===r?n<8?16:n>248?231:Math.round((n-8)/247*24)+232:16+36*Math.round(n/255*5)+6*Math.round(i/255*5)+Math.round(r/255*5),enumerable:!1},hexToRgb:{value:(n)=>{let i=/[a-f\d]{6}|[a-f\d]{3}/i.exec(n.toString(16));if(!i)return[0,0,0];let[r]=i;r.length===3&&(r=[...r].map(($)=>$+$).join(""));let o=Number.parseInt(r,16);return[o>>16&255,o>>8&255,o&255]},enumerable:!1},hexToAnsi256:{value:(n)=>B.rgbToAnsi256(...B.hexToRgb(n)),enumerable:!1},ansi256ToAnsi:{value:(n)=>{if(n<8)return 30+n;if(n<16)return 90+(n-8);let i,r,o;if(n>=232)i=((n-232)*10+8)/255,r=i,o=i;else{n-=16;let m=n%36;i=Math.floor(n/36)/5,r=Math.floor(m/6)/5,o=m%6/5}let $=Math.max(i,r,o)*2;if($===0)return 30;let e=30+(Math.round(o)<<2|Math.round(r)<<1|Math.round(i));return $===2&&(e+=60),e},enumerable:!1},rgbToAnsi:{value:(n,i,r)=>B.ansi256ToAnsi(B.rgbToAnsi256(n,i,r)),enumerable:!1},hexToAnsi:{value:(n)=>B.ansi256ToAnsi(B.hexToAnsi256(n)),enumerable:!1}}),B}function ce(t,n,i){return String(t).normalize().replace(/\r\n/g,`
|
|
3
3
|
`).split(`
|
|
4
|
-
`).map((r)=>
|
|
5
|
-
`)}function
|
|
6
|
-
`),r=
|
|
7
|
-
`),o=[];for(let $=0;$<Math.max(i.length,r.length);$++)i[$]!==r[$]&&o.push($);return o}function
|
|
8
|
-
`),
|
|
9
|
-
`).length-1;this.output.write(X.cursor.move(-999,t*-1))}render(){let t=
|
|
10
|
-
`);this.output.write(r[i]),this._prevFrame=t,this.output.write(X.cursor.move(0,r.length-i-1));return}else if(
|
|
4
|
+
`).map((r)=>Br(r,n,i)).join(`
|
|
5
|
+
`)}function Jr(t,n){if(t===n)return;let i=t.split(`
|
|
6
|
+
`),r=n.split(`
|
|
7
|
+
`),o=[];for(let $=0;$<Math.max(i.length,r.length);$++)i[$]!==r[$]&&o.push($);return o}function Ot(t){return t===Ge}function Xt(t,n){t.isTTY&&t.setRawMode(n)}class g{constructor({render:t,input:n=ve,output:i=Re,...r},o=!0){z(this,"input"),z(this,"output"),z(this,"rl"),z(this,"opts"),z(this,"_track",!1),z(this,"_render"),z(this,"_cursor",0),z(this,"state","initial"),z(this,"value"),z(this,"error",""),z(this,"subscribers",new Map),z(this,"_prevFrame",""),this.opts=r,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=t.bind(this),this._track=o,this.input=n,this.output=i}prompt(){let t=new xr(0);return t._write=(n,i,r)=>{this._track&&(this.value=this.rl.line.replace(/\t/g,""),this._cursor=this.rl.cursor,this.emit("value",this.value)),r()},this.input.pipe(t),this.rl=oe.createInterface({input:this.input,output:t,tabSize:2,prompt:"",escapeCodeTimeout:50}),oe.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),Xt(this.input,!0),this.output.on("resize",this.render),this.render(),new Promise((n,i)=>{this.once("submit",()=>{this.output.write(X.cursor.show),this.output.off("resize",this.render),Xt(this.input,!1),n(this.value)}),this.once("cancel",()=>{this.output.write(X.cursor.show),this.output.off("resize",this.render),Xt(this.input,!1),n(Ge)})})}on(t,n){let i=this.subscribers.get(t)??[];i.push({cb:n}),this.subscribers.set(t,i)}once(t,n){let i=this.subscribers.get(t)??[];i.push({cb:n,once:!0}),this.subscribers.set(t,i)}emit(t,...n){let i=this.subscribers.get(t)??[],r=[];for(let o of i)o.cb(...n),o.once&&r.push(()=>i.splice(i.indexOf(o),1));for(let o of r)o()}unsubscribe(){this.subscribers.clear()}onKeypress(t,n){if(this.state==="error"&&(this.state="active"),n?.name&&!this._track&&_e.has(n.name)&&this.emit("cursor",_e.get(n.name)),n?.name&&Xr.has(n.name)&&this.emit("cursor",n.name),t&&(t.toLowerCase()==="y"||t.toLowerCase()==="n")&&this.emit("confirm",t.toLowerCase()==="y"),t==="\t"&&this.opts.placeholder&&(this.value||(this.rl.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),t&&this.emit("key",t.toLowerCase()),n?.name==="return"){if(this.opts.validate){let i=this.opts.validate(this.value);i&&(this.error=i,this.state="error",this.rl.write(this.value))}this.state!=="error"&&(this.state="submit")}t==="\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(`
|
|
8
|
+
`),Xt(this.input,!1),this.rl.close(),this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let t=ce(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
|
|
9
|
+
`).length-1;this.output.write(X.cursor.move(-999,t*-1))}render(){let t=ce(this._render(this)??"",process.stdout.columns,{hard:!0});if(t!==this._prevFrame){if(this.state==="initial")this.output.write(X.cursor.hide);else{let n=Jr(this._prevFrame,t);if(this.restoreCursor(),n&&n?.length===1){let i=n[0];this.output.write(X.cursor.move(0,i)),this.output.write(X.erase.lines(1));let r=t.split(`
|
|
10
|
+
`);this.output.write(r[i]),this._prevFrame=t,this.output.write(X.cursor.move(0,r.length-i-1));return}else if(n&&n?.length>1){let i=n[0];this.output.write(X.cursor.move(0,i)),this.output.write(X.erase.down());let r=t.split(`
|
|
11
11
|
`).slice(i);this.output.write(r.join(`
|
|
12
|
-
`)),this._prevFrame=t;return}this.output.write(X.erase.down())}this.output.write(t),this.state==="initial"&&(this.state="active"),this._prevFrame=t}}}function Gn({input:t=hn,output:e=bn,overwrite:i=!0,hideCursor:r=!0}={}){let o=F.createInterface({input:t,output:e,prompt:"",tabSize:1});F.emitKeypressEvents(t,o),t.isTTY&&t.setRawMode(!0);let $=(n,{name:m})=>{if(String(n)==="\x03"){r&&e.write(X.cursor.show),process.exit(0);return}if(!i)return;F.moveCursor(e,m==="return"?0:-1,m==="return"?-1:0,()=>{F.clearLine(e,1,()=>{t.once("keypress",$)})})};return r&&e.write(X.cursor.hide),t.once("keypress",$),()=>{t.off("keypress",$),r&&e.write(X.cursor.show),t.isTTY&&!Hr&&t.setRawMode(!1),o.terminal=!1,o.close()}}var X,et,ur,Rn,yr,xr,wr=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},_r,ee=10,rn=(t=0)=>(e)=>`\x1B[${e+t}m`,on=(t=0)=>(e)=>`\x1B[${38+t};5;${e}m`,$n=(t=0)=>(e,i,r)=>`\x1B[${38+t};2;${e};${i};${r}m`,T,hr,br,lr,Xt,Rr=39,ie="\x07",kn="[",kr="]",Sn="m",re,mn=(t)=>`${Xt.values().next().value}${kn}${t}${Sn}`,pn=(t)=>`${Xt.values().next().value}${re}${t}${ie}`,Sr=(t)=>t.split(" ").map((e)=>_t(e)),ne=(t,e,i)=>{let r=[...e],o=!1,$=!1,n=_t(vn(t[t.length-1]));for(let[m,s]of r.entries()){let c=_t(s);if(n+c<=i?t[t.length-1]+=s:(t.push(s),n=0),Xt.has(s)&&(o=!0,$=r.slice(m+1).join("").startsWith(re)),o){$?s===ie&&(o=!1,$=!1):s===Sn&&(o=!1);continue}n+=c,n===i&&m<r.length-1&&(t.push(""),n=0)}!n&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())},Mr=(t)=>{let e=t.split(" "),i=e.length;for(;i>0&&!(_t(e[i-1])>0);)i--;return i===e.length?t:e.slice(0,i).join(" ")+e.slice(i).join("")},Ar=(t,e,i={})=>{if(i.trim!==!1&&t.trim()==="")return"";let r="",o,$,n=Sr(t),m=[""];for(let[c,x]of t.split(" ").entries()){i.trim!==!1&&(m[m.length-1]=m[m.length-1].trimStart());let w=_t(m[m.length-1]);if(c!==0&&(w>=e&&(i.wordWrap===!1||i.trim===!1)&&(m.push(""),w=0),(w>0||i.trim===!1)&&(m[m.length-1]+=" ",w++)),i.hard&&n[c]>e){let h=e-w,_=1+Math.floor((n[c]-h-1)/e);Math.floor((n[c]-1)/e)<_&&m.push(""),ne(m,x,e);continue}if(w+n[c]>e&&w>0&&n[c]>0){if(i.wordWrap===!1&&w<e){ne(m,x,e);continue}m.push("")}if(w+n[c]>e&&i.wordWrap===!1){ne(m,x,e);continue}m[m.length-1]+=x}i.trim!==!1&&(m=m.map((c)=>Mr(c)));let s=[...m.join(`
|
|
13
|
-
`)];for(let[
|
|
14
|
-
`?($&&(r+=
|
|
15
|
-
`&&(o&&w&&(r+=mn(o)),$&&(r+=pn($)))}return r},jr,Gr=(t,e,i)=>(e in t)?jr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,z=(t,e,i)=>(Gr(t,typeof e!="symbol"?e+"":e,i),i),Mn,cn,Tr,oe,qr,Nr=(t,e,i)=>(e in t)?qr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,un=(t,e,i)=>(Nr(t,typeof e!="symbol"?e+"":e,i),i),$e,Jr,Xr=(t,e,i)=>(e in t)?Jr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,yn=(t,e,i)=>(Xr(t,typeof e!="symbol"?e+"":e,i),i),An,Qr,Or=(t,e,i)=>(e in t)?Qr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,xn=(t,e,i)=>(Or(t,typeof e!="symbol"?e+"":e,i),i),me,Yr,Vr=(t,e,i)=>(e in t)?Yr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,wn=(t,e,i)=>(Vr(t,typeof e!="symbol"?e+"":e,i),i),jn,Zr,zr=(t,e,i)=>(e in t)?Zr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,_n=(t,e,i)=>(zr(t,typeof e!="symbol"?e+"":e,i),i),pe,dr,Wr=(t,e,i)=>(e in t)?dr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Kr=(t,e,i)=>(Wr(t,typeof e!="symbol"?e+"":e,i),i),se,Hr;var ce=Ht(()=>{X=lt(gt(),1),et=lt(te(),1);ur=cr();Rn={exports:{}};(function(t){var e={};t.exports=e,e.eastAsianWidth=function(r){var o=r.charCodeAt(0),$=r.length==2?r.charCodeAt(1):0,n=o;return 55296<=o&&o<=56319&&56320<=$&&$<=57343&&(o&=1023,$&=1023,n=o<<10|$,n+=65536),n==12288||65281<=n&&n<=65376||65504<=n&&n<=65510?"F":n==8361||65377<=n&&n<=65470||65474<=n&&n<=65479||65482<=n&&n<=65487||65490<=n&&n<=65495||65498<=n&&n<=65500||65512<=n&&n<=65518?"H":4352<=n&&n<=4447||4515<=n&&n<=4519||4602<=n&&n<=4607||9001<=n&&n<=9002||11904<=n&&n<=11929||11931<=n&&n<=12019||12032<=n&&n<=12245||12272<=n&&n<=12283||12289<=n&&n<=12350||12353<=n&&n<=12438||12441<=n&&n<=12543||12549<=n&&n<=12589||12593<=n&&n<=12686||12688<=n&&n<=12730||12736<=n&&n<=12771||12784<=n&&n<=12830||12832<=n&&n<=12871||12880<=n&&n<=13054||13056<=n&&n<=19903||19968<=n&&n<=42124||42128<=n&&n<=42182||43360<=n&&n<=43388||44032<=n&&n<=55203||55216<=n&&n<=55238||55243<=n&&n<=55291||63744<=n&&n<=64255||65040<=n&&n<=65049||65072<=n&&n<=65106||65108<=n&&n<=65126||65128<=n&&n<=65131||110592<=n&&n<=110593||127488<=n&&n<=127490||127504<=n&&n<=127546||127552<=n&&n<=127560||127568<=n&&n<=127569||131072<=n&&n<=194367||177984<=n&&n<=196605||196608<=n&&n<=262141?"W":32<=n&&n<=126||162<=n&&n<=163||165<=n&&n<=166||n==172||n==175||10214<=n&&n<=10221||10629<=n&&n<=10630?"Na":n==161||n==164||167<=n&&n<=168||n==170||173<=n&&n<=174||176<=n&&n<=180||182<=n&&n<=186||188<=n&&n<=191||n==198||n==208||215<=n&&n<=216||222<=n&&n<=225||n==230||232<=n&&n<=234||236<=n&&n<=237||n==240||242<=n&&n<=243||247<=n&&n<=250||n==252||n==254||n==257||n==273||n==275||n==283||294<=n&&n<=295||n==299||305<=n&&n<=307||n==312||319<=n&&n<=322||n==324||328<=n&&n<=331||n==333||338<=n&&n<=339||358<=n&&n<=359||n==363||n==462||n==464||n==466||n==468||n==470||n==472||n==474||n==476||n==593||n==609||n==708||n==711||713<=n&&n<=715||n==717||n==720||728<=n&&n<=731||n==733||n==735||768<=n&&n<=879||913<=n&&n<=929||931<=n&&n<=937||945<=n&&n<=961||963<=n&&n<=969||n==1025||1040<=n&&n<=1103||n==1105||n==8208||8211<=n&&n<=8214||8216<=n&&n<=8217||8220<=n&&n<=8221||8224<=n&&n<=8226||8228<=n&&n<=8231||n==8240||8242<=n&&n<=8243||n==8245||n==8251||n==8254||n==8308||n==8319||8321<=n&&n<=8324||n==8364||n==8451||n==8453||n==8457||n==8467||n==8470||8481<=n&&n<=8482||n==8486||n==8491||8531<=n&&n<=8532||8539<=n&&n<=8542||8544<=n&&n<=8555||8560<=n&&n<=8569||n==8585||8592<=n&&n<=8601||8632<=n&&n<=8633||n==8658||n==8660||n==8679||n==8704||8706<=n&&n<=8707||8711<=n&&n<=8712||n==8715||n==8719||n==8721||n==8725||n==8730||8733<=n&&n<=8736||n==8739||n==8741||8743<=n&&n<=8748||n==8750||8756<=n&&n<=8759||8764<=n&&n<=8765||n==8776||n==8780||n==8786||8800<=n&&n<=8801||8804<=n&&n<=8807||8810<=n&&n<=8811||8814<=n&&n<=8815||8834<=n&&n<=8835||8838<=n&&n<=8839||n==8853||n==8857||n==8869||n==8895||n==8978||9312<=n&&n<=9449||9451<=n&&n<=9547||9552<=n&&n<=9587||9600<=n&&n<=9615||9618<=n&&n<=9621||9632<=n&&n<=9633||9635<=n&&n<=9641||9650<=n&&n<=9651||9654<=n&&n<=9655||9660<=n&&n<=9661||9664<=n&&n<=9665||9670<=n&&n<=9672||n==9675||9678<=n&&n<=9681||9698<=n&&n<=9701||n==9711||9733<=n&&n<=9734||n==9737||9742<=n&&n<=9743||9748<=n&&n<=9749||n==9756||n==9758||n==9792||n==9794||9824<=n&&n<=9825||9827<=n&&n<=9829||9831<=n&&n<=9834||9836<=n&&n<=9837||n==9839||9886<=n&&n<=9887||9918<=n&&n<=9919||9924<=n&&n<=9933||9935<=n&&n<=9953||n==9955||9960<=n&&n<=9983||n==10045||n==10071||10102<=n&&n<=10111||11093<=n&&n<=11097||12872<=n&&n<=12879||57344<=n&&n<=63743||65024<=n&&n<=65039||n==65533||127232<=n&&n<=127242||127248<=n&&n<=127277||127280<=n&&n<=127337||127344<=n&&n<=127386||917760<=n&&n<=917999||983040<=n&&n<=1048573||1048576<=n&&n<=1114109?"A":"N"},e.characterLength=function(r){var o=this.eastAsianWidth(r);return o=="F"||o=="W"||o=="A"?2:1};function i(r){return r.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}e.length=function(r){for(var o=i(r),$=0,n=0;n<o.length;n++)$=$+this.characterLength(o[n]);return $},e.slice=function(r,o,$){textLen=e.length(r),o=o||0,$=$||1,o<0&&(o=textLen+o),$<0&&($=textLen+$);for(var n="",m=0,s=i(r),c=0;c<s.length;c++){var x=s[c],w=e.length(x);if(m>=o-(w==2?1:0))if(m+w<=$)n+=x;else break;m+=w}return n}})(Rn);yr=Rn.exports,xr=ln(yr),_r=ln(wr);T={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(T.modifier);hr=Object.keys(T.color),br=Object.keys(T.bgColor);[...hr,...br];lr=vr(),Xt=new Set(["\x1B",""]),re=`${kr}8;;`;jr=Object.defineProperty;Mn=Symbol("clack:cancel");cn=new Map([["k","up"],["j","down"],["h","left"],["l","right"]]),Tr=new Set(["up","down","left","right","space","enter"]);oe=class oe extends g{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(t){super(t,!1),this.value=!!t.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",(e)=>{this.output.write(X.cursor.move(0,-1)),this.value=e,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};qr=Object.defineProperty;$e=class $e extends g{constructor(t){super(t,!1),un(this,"options"),un(this,"cursor",0);let{options:e}=t;this.options=Object.entries(e).flatMap(([i,r])=>[{value:i,group:!0,label:i},...r.map((o)=>({...o,group:i}))]),this.value=[...t.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:i})=>i===t.cursorAt),0),this.on("cursor",(i)=>{switch(i){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break;case"space":this.toggleValue();break}})}getGroupItems(t){return this.options.filter((e)=>e.group===t)}isGroupSelected(t){return this.getGroupItems(t).every((e)=>this.value.includes(e.value))}toggleValue(){let t=this.options[this.cursor];if(t.group===!0){let e=t.value,i=this.getGroupItems(e);this.isGroupSelected(e)?this.value=this.value.filter((r)=>i.findIndex((o)=>o.value===r)===-1):this.value=[...this.value,...i.map((r)=>r.value)],this.value=Array.from(new Set(this.value))}else{let e=this.value.includes(t.value);this.value=e?this.value.filter((i)=>i!==t.value):[...this.value,t.value]}}};Jr=Object.defineProperty,An=class extends g{constructor(t){super(t,!1),yn(this,"options"),yn(this,"cursor",0),this.options=t.options,this.value=[...t.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:e})=>e===t.cursorAt),0),this.on("key",(e)=>{e==="a"&&this.toggleAll()}),this.on("cursor",(e)=>{switch(e){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break;case"space":this.toggleValue();break}})}get _value(){return this.options[this.cursor].value}toggleAll(){let t=this.value.length===this.options.length;this.value=t?[]:this.options.map((e)=>e.value)}toggleValue(){let t=this.value.includes(this._value);this.value=t?this.value.filter((e)=>e!==this._value):[...this.value,this._value]}},Qr=Object.defineProperty;me=class me extends g{constructor({mask:t,...e}){super(e),xn(this,"valueWithCursor",""),xn(this,"_mask","•"),this._mask=t??"•",this.on("finalize",()=>{this.valueWithCursor=this.masked}),this.on("value",()=>{if(this.cursor>=this.value.length)this.valueWithCursor=`${this.masked}${et.default.inverse(et.default.hidden("_"))}`;else{let i=this.masked.slice(0,this.cursor),r=this.masked.slice(this.cursor);this.valueWithCursor=`${i}${et.default.inverse(r[0])}${r.slice(1)}`}})}get cursor(){return this._cursor}get masked(){return this.value.replaceAll(/./g,this._mask)}};Yr=Object.defineProperty,jn=class extends g{constructor(t){super(t,!1),wn(this,"options"),wn(this,"cursor",0),this.options=t.options,this.cursor=this.options.findIndex(({value:e})=>e===t.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",(e)=>{switch(e){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}},Zr=Object.defineProperty;pe=class pe extends g{constructor(t){super(t,!1),_n(this,"options"),_n(this,"cursor",0),this.options=t.options;let e=this.options.map(({value:[i]})=>i?.toLowerCase());this.cursor=Math.max(e.indexOf(t.initialValue),0),this.on("key",(i)=>{if(!e.includes(i))return;let r=this.options.find(({value:[o]})=>o?.toLowerCase()===i);r&&(this.value=r.value,this.state="submit",this.emit("submit"))})}};dr=Object.defineProperty;se=class se extends g{constructor(t){super(t),Kr(this,"valueWithCursor",""),this.on("finalize",()=>{this.value||(this.value=t.defaultValue),this.valueWithCursor=this.value}),this.on("value",()=>{if(this.cursor>=this.value.length)this.valueWithCursor=`${this.value}${et.default.inverse(et.default.hidden("_"))}`;else{let e=this.value.slice(0,this.cursor),i=this.value.slice(this.cursor);this.valueWithCursor=`${e}${et.default.inverse(i[0])}${i.slice(1)}`}})}get cursor(){return this._cursor}};Hr=globalThis.process.platform.startsWith("win")});var Yt={};je(Yt,{text:()=>to,spinner:()=>uo,selectKey:()=>ro,select:()=>io,password:()=>eo,outro:()=>co,note:()=>mo,multiselect:()=>oo,log:()=>nt,isCancel:()=>Qt,intro:()=>so,groupMultiselect:()=>$o,group:()=>xo,confirm:()=>no,cancel:()=>po});import K from"node:process";function Ur(){return K.platform!=="win32"?K.env.TERM!=="linux":Boolean(K.env.CI)||Boolean(K.env.WT_SESSION)||Boolean(K.env.TERMINUS_SUBLIME)||K.env.ConEmuTask==="{cmd::Cmder}"||K.env.TERM_PROGRAM==="Terminus-Sublime"||K.env.TERM_PROGRAM==="vscode"||K.env.TERM==="xterm-256color"||K.env.TERM==="alacritty"||K.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}function yo(){let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(t,"g")}var p,st,ye,q=(t,e)=>ye?t:e,ar,Tn,qn,Ot,Ir,b,O,xe,we,_e,ht,Nn,Pr,Bn,Cr,Lr,Er,fr,Fr,gr,Dr,it=(t)=>{switch(t){case"initial":case"active":return p.default.cyan(ar);case"cancel":return p.default.red(Tn);case"error":return p.default.yellow(qn);case"submit":return p.default.green(Ot)}},to=(t)=>new se({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,render(){let e=`${p.default.gray(b)}
|
|
16
|
-
${
|
|
17
|
-
`,i=t.placeholder?p.default.inverse(t.placeholder[0])+p.default.dim(t.placeholder.slice(1)):p.default.inverse(p.default.hidden("_")),r=this.value?this.valueWithCursor:i;switch(this.state){case"error":return`${
|
|
18
|
-
${p.default.yellow(
|
|
12
|
+
`)),this._prevFrame=t;return}this.output.write(X.erase.down())}this.output.write(t),this.state==="initial"&&(this.state="active"),this._prevFrame=t}}}function Be({input:t=ve,output:n=Re,overwrite:i=!0,hideCursor:r=!0}={}){let o=f.createInterface({input:t,output:n,prompt:"",tabSize:1});f.emitKeypressEvents(t,o),t.isTTY&&t.setRawMode(!0);let $=(e,{name:m})=>{if(String(e)==="\x03"){r&&n.write(X.cursor.show),process.exit(0);return}if(!i)return;f.moveCursor(n,m==="return"?0:-1,m==="return"?-1:0,()=>{f.clearLine(n,1,()=>{t.once("keypress",$)})})};return r&&n.write(X.cursor.hide),t.once("keypress",$),()=>{t.off("keypress",$),r&&n.write(X.cursor.show),t.isTTY&&!Cr&&t.setRawMode(!1),o.terminal=!1,o.close()}}var X,et,hr,Se,br,sr,vr=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},Rr,en=10,$e=(t=0)=>(n)=>`\x1B[${n+t}m`,me=(t=0)=>(n)=>`\x1B[${38+t};5;${n}m`,pe=(t=0)=>(n,i,r)=>`\x1B[${38+t};2;${n};${i};${r}m`,B,kr,Mr,Ar,Qt,jr=39,on="\x07",Ae="[",Gr="]",je="m",$n,ue=(t)=>`${Qt.values().next().value}${Ae}${t}${je}`,ye=(t)=>`${Qt.values().next().value}${$n}${t}${on}`,qr=(t)=>t.split(" ").map((n)=>ht(n)),rn=(t,n,i)=>{let r=[...n],o=!1,$=!1,e=ht(ke(t[t.length-1]));for(let[m,u]of r.entries()){let y=ht(u);if(e+y<=i?t[t.length-1]+=u:(t.push(u),e=0),Qt.has(u)&&(o=!0,$=r.slice(m+1).join("").startsWith($n)),o){$?u===on&&(o=!1,$=!1):u===je&&(o=!1);continue}e+=y,e===i&&m<r.length-1&&(t.push(""),e=0)}!e&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())},Tr=(t)=>{let n=t.split(" "),i=n.length;for(;i>0&&!(ht(n[i-1])>0);)i--;return i===n.length?t:n.slice(0,i).join(" ")+n.slice(i).join("")},Br=(t,n,i={})=>{if(i.trim!==!1&&t.trim()==="")return"";let r="",o,$,e=qr(t),m=[""];for(let[y,x]of t.split(" ").entries()){i.trim!==!1&&(m[m.length-1]=m[m.length-1].trimStart());let w=ht(m[m.length-1]);if(y!==0&&(w>=n&&(i.wordWrap===!1||i.trim===!1)&&(m.push(""),w=0),(w>0||i.trim===!1)&&(m[m.length-1]+=" ",w++)),i.hard&&e[y]>n){let b=n-w,h=1+Math.floor((e[y]-b-1)/n);Math.floor((e[y]-1)/n)<h&&m.push(""),rn(m,x,n);continue}if(w+e[y]>n&&w>0&&e[y]>0){if(i.wordWrap===!1&&w<n){rn(m,x,n);continue}m.push("")}if(w+e[y]>n&&i.wordWrap===!1){rn(m,x,n);continue}m[m.length-1]+=x}i.trim!==!1&&(m=m.map((y)=>Tr(y)));let u=[...m.join(`
|
|
13
|
+
`)];for(let[y,x]of u.entries()){if(r+=x,Qt.has(x)){let{groups:b}=new RegExp(`(?:\\${Ae}(?<code>\\d+)m|\\${$n}(?<uri>.*)${on})`).exec(u.slice(y).join(""))||{groups:{}};if(b.code!==void 0){let h=Number.parseFloat(b.code);o=h===jr?void 0:h}else b.uri!==void 0&&($=b.uri.length===0?void 0:b.uri)}let w=Ar.codes.get(Number(o));u[y+1]===`
|
|
14
|
+
`?($&&(r+=ye("")),o&&w&&(r+=ue(w))):x===`
|
|
15
|
+
`&&(o&&w&&(r+=ue(o)),$&&(r+=ye($)))}return r},Nr,lr=(t,n,i)=>(n in t)?Nr(t,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[n]=i,z=(t,n,i)=>(lr(t,typeof n!="symbol"?n+"":n,i),i),Ge,_e,Xr,mn,Qr,Or=(t,n,i)=>(n in t)?Qr(t,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[n]=i,xe=(t,n,i)=>(Or(t,typeof n!="symbol"?n+"":n,i),i),pn,Yr,Vr=(t,n,i)=>(n in t)?Yr(t,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[n]=i,we=(t,n,i)=>(Vr(t,typeof n!="symbol"?n+"":n,i),i),qe,Zr,zr=(t,n,i)=>(n in t)?Zr(t,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[n]=i,he=(t,n,i)=>(zr(t,typeof n!="symbol"?n+"":n,i),i),un,Wr,Kr=(t,n,i)=>(n in t)?Wr(t,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[n]=i,be=(t,n,i)=>(Kr(t,typeof n!="symbol"?n+"":n,i),i),Te,Hr,Ur=(t,n,i)=>(n in t)?Hr(t,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[n]=i,se=(t,n,i)=>(Ur(t,typeof n!="symbol"?n+"":n,i),i),yn,Ir,dr=(t,n,i)=>(n in t)?Ir(t,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[n]=i,Pr=(t,n,i)=>(dr(t,typeof n!="symbol"?n+"":n,i),i),cn,Cr;var _n=It(()=>{X=kt(Dt(),1),et=kt(nn(),1);hr=wr();Se={exports:{}};(function(t){var n={};t.exports=n,n.eastAsianWidth=function(r){var o=r.charCodeAt(0),$=r.length==2?r.charCodeAt(1):0,e=o;return 55296<=o&&o<=56319&&56320<=$&&$<=57343&&(o&=1023,$&=1023,e=o<<10|$,e+=65536),e==12288||65281<=e&&e<=65376||65504<=e&&e<=65510?"F":e==8361||65377<=e&&e<=65470||65474<=e&&e<=65479||65482<=e&&e<=65487||65490<=e&&e<=65495||65498<=e&&e<=65500||65512<=e&&e<=65518?"H":4352<=e&&e<=4447||4515<=e&&e<=4519||4602<=e&&e<=4607||9001<=e&&e<=9002||11904<=e&&e<=11929||11931<=e&&e<=12019||12032<=e&&e<=12245||12272<=e&&e<=12283||12289<=e&&e<=12350||12353<=e&&e<=12438||12441<=e&&e<=12543||12549<=e&&e<=12589||12593<=e&&e<=12686||12688<=e&&e<=12730||12736<=e&&e<=12771||12784<=e&&e<=12830||12832<=e&&e<=12871||12880<=e&&e<=13054||13056<=e&&e<=19903||19968<=e&&e<=42124||42128<=e&&e<=42182||43360<=e&&e<=43388||44032<=e&&e<=55203||55216<=e&&e<=55238||55243<=e&&e<=55291||63744<=e&&e<=64255||65040<=e&&e<=65049||65072<=e&&e<=65106||65108<=e&&e<=65126||65128<=e&&e<=65131||110592<=e&&e<=110593||127488<=e&&e<=127490||127504<=e&&e<=127546||127552<=e&&e<=127560||127568<=e&&e<=127569||131072<=e&&e<=194367||177984<=e&&e<=196605||196608<=e&&e<=262141?"W":32<=e&&e<=126||162<=e&&e<=163||165<=e&&e<=166||e==172||e==175||10214<=e&&e<=10221||10629<=e&&e<=10630?"Na":e==161||e==164||167<=e&&e<=168||e==170||173<=e&&e<=174||176<=e&&e<=180||182<=e&&e<=186||188<=e&&e<=191||e==198||e==208||215<=e&&e<=216||222<=e&&e<=225||e==230||232<=e&&e<=234||236<=e&&e<=237||e==240||242<=e&&e<=243||247<=e&&e<=250||e==252||e==254||e==257||e==273||e==275||e==283||294<=e&&e<=295||e==299||305<=e&&e<=307||e==312||319<=e&&e<=322||e==324||328<=e&&e<=331||e==333||338<=e&&e<=339||358<=e&&e<=359||e==363||e==462||e==464||e==466||e==468||e==470||e==472||e==474||e==476||e==593||e==609||e==708||e==711||713<=e&&e<=715||e==717||e==720||728<=e&&e<=731||e==733||e==735||768<=e&&e<=879||913<=e&&e<=929||931<=e&&e<=937||945<=e&&e<=961||963<=e&&e<=969||e==1025||1040<=e&&e<=1103||e==1105||e==8208||8211<=e&&e<=8214||8216<=e&&e<=8217||8220<=e&&e<=8221||8224<=e&&e<=8226||8228<=e&&e<=8231||e==8240||8242<=e&&e<=8243||e==8245||e==8251||e==8254||e==8308||e==8319||8321<=e&&e<=8324||e==8364||e==8451||e==8453||e==8457||e==8467||e==8470||8481<=e&&e<=8482||e==8486||e==8491||8531<=e&&e<=8532||8539<=e&&e<=8542||8544<=e&&e<=8555||8560<=e&&e<=8569||e==8585||8592<=e&&e<=8601||8632<=e&&e<=8633||e==8658||e==8660||e==8679||e==8704||8706<=e&&e<=8707||8711<=e&&e<=8712||e==8715||e==8719||e==8721||e==8725||e==8730||8733<=e&&e<=8736||e==8739||e==8741||8743<=e&&e<=8748||e==8750||8756<=e&&e<=8759||8764<=e&&e<=8765||e==8776||e==8780||e==8786||8800<=e&&e<=8801||8804<=e&&e<=8807||8810<=e&&e<=8811||8814<=e&&e<=8815||8834<=e&&e<=8835||8838<=e&&e<=8839||e==8853||e==8857||e==8869||e==8895||e==8978||9312<=e&&e<=9449||9451<=e&&e<=9547||9552<=e&&e<=9587||9600<=e&&e<=9615||9618<=e&&e<=9621||9632<=e&&e<=9633||9635<=e&&e<=9641||9650<=e&&e<=9651||9654<=e&&e<=9655||9660<=e&&e<=9661||9664<=e&&e<=9665||9670<=e&&e<=9672||e==9675||9678<=e&&e<=9681||9698<=e&&e<=9701||e==9711||9733<=e&&e<=9734||e==9737||9742<=e&&e<=9743||9748<=e&&e<=9749||e==9756||e==9758||e==9792||e==9794||9824<=e&&e<=9825||9827<=e&&e<=9829||9831<=e&&e<=9834||9836<=e&&e<=9837||e==9839||9886<=e&&e<=9887||9918<=e&&e<=9919||9924<=e&&e<=9933||9935<=e&&e<=9953||e==9955||9960<=e&&e<=9983||e==10045||e==10071||10102<=e&&e<=10111||11093<=e&&e<=11097||12872<=e&&e<=12879||57344<=e&&e<=63743||65024<=e&&e<=65039||e==65533||127232<=e&&e<=127242||127248<=e&&e<=127277||127280<=e&&e<=127337||127344<=e&&e<=127386||917760<=e&&e<=917999||983040<=e&&e<=1048573||1048576<=e&&e<=1114109?"A":"N"},n.characterLength=function(r){var o=this.eastAsianWidth(r);return o=="F"||o=="W"||o=="A"?2:1};function i(r){return r.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}n.length=function(r){for(var o=i(r),$=0,e=0;e<o.length;e++)$=$+this.characterLength(o[e]);return $},n.slice=function(r,o,$){textLen=n.length(r),o=o||0,$=$||1,o<0&&(o=textLen+o),$<0&&($=textLen+$);for(var e="",m=0,u=i(r),y=0;y<u.length;y++){var x=u[y],w=n.length(x);if(m>=o-(w==2?1:0))if(m+w<=$)e+=x;else break;m+=w}return e}})(Se);br=Se.exports,sr=Me(br),Rr=Me(vr);B={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(B.modifier);kr=Object.keys(B.color),Mr=Object.keys(B.bgColor);[...kr,...Mr];Ar=Sr(),Qt=new Set(["\x1B",""]),$n=`${Gr}8;;`;Nr=Object.defineProperty;Ge=Symbol("clack:cancel");_e=new Map([["k","up"],["j","down"],["h","left"],["l","right"]]),Xr=new Set(["up","down","left","right","space","enter"]);mn=class mn extends g{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(t){super(t,!1),this.value=!!t.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",(n)=>{this.output.write(X.cursor.move(0,-1)),this.value=n,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};Qr=Object.defineProperty;pn=class pn extends g{constructor(t){super(t,!1),xe(this,"options"),xe(this,"cursor",0);let{options:n}=t;this.options=Object.entries(n).flatMap(([i,r])=>[{value:i,group:!0,label:i},...r.map((o)=>({...o,group:i}))]),this.value=[...t.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:i})=>i===t.cursorAt),0),this.on("cursor",(i)=>{switch(i){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break;case"space":this.toggleValue();break}})}getGroupItems(t){return this.options.filter((n)=>n.group===t)}isGroupSelected(t){return this.getGroupItems(t).every((n)=>this.value.includes(n.value))}toggleValue(){let t=this.options[this.cursor];if(t.group===!0){let n=t.value,i=this.getGroupItems(n);this.isGroupSelected(n)?this.value=this.value.filter((r)=>i.findIndex((o)=>o.value===r)===-1):this.value=[...this.value,...i.map((r)=>r.value)],this.value=Array.from(new Set(this.value))}else{let n=this.value.includes(t.value);this.value=n?this.value.filter((i)=>i!==t.value):[...this.value,t.value]}}};Yr=Object.defineProperty,qe=class extends g{constructor(t){super(t,!1),we(this,"options"),we(this,"cursor",0),this.options=t.options,this.value=[...t.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:n})=>n===t.cursorAt),0),this.on("key",(n)=>{n==="a"&&this.toggleAll()}),this.on("cursor",(n)=>{switch(n){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break;case"space":this.toggleValue();break}})}get _value(){return this.options[this.cursor].value}toggleAll(){let t=this.value.length===this.options.length;this.value=t?[]:this.options.map((n)=>n.value)}toggleValue(){let t=this.value.includes(this._value);this.value=t?this.value.filter((n)=>n!==this._value):[...this.value,this._value]}},Zr=Object.defineProperty;un=class un extends g{constructor({mask:t,...n}){super(n),he(this,"valueWithCursor",""),he(this,"_mask","•"),this._mask=t??"•",this.on("finalize",()=>{this.valueWithCursor=this.masked}),this.on("value",()=>{if(this.cursor>=this.value.length)this.valueWithCursor=`${this.masked}${et.default.inverse(et.default.hidden("_"))}`;else{let i=this.masked.slice(0,this.cursor),r=this.masked.slice(this.cursor);this.valueWithCursor=`${i}${et.default.inverse(r[0])}${r.slice(1)}`}})}get cursor(){return this._cursor}get masked(){return this.value.replaceAll(/./g,this._mask)}};Wr=Object.defineProperty,Te=class extends g{constructor(t){super(t,!1),be(this,"options"),be(this,"cursor",0),this.options=t.options,this.cursor=this.options.findIndex(({value:n})=>n===t.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",(n)=>{switch(n){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}},Hr=Object.defineProperty;yn=class yn extends g{constructor(t){super(t,!1),se(this,"options"),se(this,"cursor",0),this.options=t.options;let n=this.options.map(({value:[i]})=>i?.toLowerCase());this.cursor=Math.max(n.indexOf(t.initialValue),0),this.on("key",(i)=>{if(!n.includes(i))return;let r=this.options.find(({value:[o]})=>o?.toLowerCase()===i);r&&(this.value=r.value,this.state="submit",this.emit("submit"))})}};Ir=Object.defineProperty;cn=class cn extends g{constructor(t){super(t),Pr(this,"valueWithCursor",""),this.on("finalize",()=>{this.value||(this.value=t.defaultValue),this.valueWithCursor=this.value}),this.on("value",()=>{if(this.cursor>=this.value.length)this.valueWithCursor=`${this.value}${et.default.inverse(et.default.hidden("_"))}`;else{let n=this.value.slice(0,this.cursor),i=this.value.slice(this.cursor);this.valueWithCursor=`${n}${et.default.inverse(i[0])}${i.slice(1)}`}})}get cursor(){return this._cursor}};Cr=globalThis.process.platform.startsWith("win")});var Vt={};Bn(Vt,{text:()=>ro,spinner:()=>ho,selectKey:()=>po,select:()=>mo,password:()=>oo,outro:()=>wo,note:()=>co,multiselect:()=>uo,log:()=>it,isCancel:()=>Ot,intro:()=>xo,groupMultiselect:()=>yo,group:()=>so,confirm:()=>$o,cancel:()=>_o});import H from"node:process";function Lr(){return H.platform!=="win32"?H.env.TERM!=="linux":Boolean(H.env.CI)||Boolean(H.env.WT_SESSION)||Boolean(H.env.TERMINUS_SUBLIME)||H.env.ConEmuTask==="{cmd::Cmder}"||H.env.TERM_PROGRAM==="Terminus-Sublime"||H.env.TERM_PROGRAM==="vscode"||H.env.TERM==="xterm-256color"||H.env.TERM==="alacritty"||H.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}function bo(){let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(t,"g")}var p,ut,wn,N=(t,n)=>wn?t:n,ar,le,Je,Yt,Er,s,O,hn,bn,sn,bt,Xe,Fr,Ne,fr,gr,Dr,to,no,eo,io,rt=(t)=>{switch(t){case"initial":case"active":return p.default.cyan(ar);case"cancel":return p.default.red(le);case"error":return p.default.yellow(Je);case"submit":return p.default.green(Yt)}},ro=(t)=>new cn({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,render(){let n=`${p.default.gray(s)}
|
|
16
|
+
${rt(this.state)} ${t.message}
|
|
17
|
+
`,i=t.placeholder?p.default.inverse(t.placeholder[0])+p.default.dim(t.placeholder.slice(1)):p.default.inverse(p.default.hidden("_")),r=this.value?this.valueWithCursor:i;switch(this.state){case"error":return`${n.trim()}
|
|
18
|
+
${p.default.yellow(s)} ${r}
|
|
19
19
|
${p.default.yellow(O)} ${p.default.yellow(this.error)}
|
|
20
|
-
`;case"submit":return`${
|
|
21
|
-
`+p.default.gray(
|
|
20
|
+
`;case"submit":return`${n}${p.default.gray(s)} ${p.default.dim(this.value||t.placeholder)}`;case"cancel":return`${n}${p.default.gray(s)} ${p.default.strikethrough(p.default.dim(this.value??""))}${this.value?.trim()?`
|
|
21
|
+
`+p.default.gray(s):""}`;default:return`${n}${p.default.cyan(s)} ${r}
|
|
22
22
|
${p.default.cyan(O)}
|
|
23
|
-
`}}}).prompt(),
|
|
24
|
-
${
|
|
25
|
-
`,i=this.valueWithCursor,r=this.masked;switch(this.state){case"error":return`${
|
|
26
|
-
${p.default.yellow(
|
|
23
|
+
`}}}).prompt(),oo=(t)=>new un({validate:t.validate,mask:t.mask??Fr,render(){let n=`${p.default.gray(s)}
|
|
24
|
+
${rt(this.state)} ${t.message}
|
|
25
|
+
`,i=this.valueWithCursor,r=this.masked;switch(this.state){case"error":return`${n.trim()}
|
|
26
|
+
${p.default.yellow(s)} ${r}
|
|
27
27
|
${p.default.yellow(O)} ${p.default.yellow(this.error)}
|
|
28
|
-
`;case"submit":return`${
|
|
29
|
-
`+p.default.gray(
|
|
28
|
+
`;case"submit":return`${n}${p.default.gray(s)} ${p.default.dim(r)}`;case"cancel":return`${n}${p.default.gray(s)} ${p.default.strikethrough(p.default.dim(r??""))}${r?`
|
|
29
|
+
`+p.default.gray(s):""}`;default:return`${n}${p.default.cyan(s)} ${i}
|
|
30
30
|
${p.default.cyan(O)}
|
|
31
|
-
`}}}).prompt()
|
|
32
|
-
${
|
|
33
|
-
`,o=this.value?
|
|
34
|
-
${p.default.gray(
|
|
31
|
+
`}}}).prompt(),$o=(t)=>{let n=t.active??"Yes",i=t.inactive??"No";return new mn({active:n,inactive:i,initialValue:t.initialValue??!0,render(){let r=`${p.default.gray(s)}
|
|
32
|
+
${rt(this.state)} ${t.message}
|
|
33
|
+
`,o=this.value?n:i;switch(this.state){case"submit":return`${r}${p.default.gray(s)} ${p.default.dim(o)}`;case"cancel":return`${r}${p.default.gray(s)} ${p.default.strikethrough(p.default.dim(o))}
|
|
34
|
+
${p.default.gray(s)}`;default:return`${r}${p.default.cyan(s)} ${this.value?`${p.default.green(hn)} ${n}`:`${p.default.dim(bn)} ${p.default.dim(n)}`} ${p.default.dim("/")} ${this.value?`${p.default.dim(bn)} ${p.default.dim(i)}`:`${p.default.green(hn)} ${i}`}
|
|
35
35
|
${p.default.cyan(O)}
|
|
36
|
-
`}}}).prompt()},
|
|
37
|
-
${
|
|
38
|
-
`;switch(this.state){case"submit":return`${r}${p.default.gray(
|
|
39
|
-
${p.default.gray(
|
|
40
|
-
${p.default.cyan(
|
|
36
|
+
`}}}).prompt()},mo=(t)=>{let n=(r,o)=>{let $=r.label??String(r.value);return o==="active"?`${p.default.green(hn)} ${$} ${r.hint?p.default.dim(`(${r.hint})`):""}`:o==="selected"?`${p.default.dim($)}`:o==="cancelled"?`${p.default.strikethrough(p.default.dim($))}`:`${p.default.dim(bn)} ${p.default.dim($)}`},i=0;return new Te({options:t.options,initialValue:t.initialValue,render(){let r=`${p.default.gray(s)}
|
|
37
|
+
${rt(this.state)} ${t.message}
|
|
38
|
+
`;switch(this.state){case"submit":return`${r}${p.default.gray(s)} ${n(this.options[this.cursor],"selected")}`;case"cancel":return`${r}${p.default.gray(s)} ${n(this.options[this.cursor],"cancelled")}
|
|
39
|
+
${p.default.gray(s)}`;default:{let o=t.maxItems===void 0?1/0:Math.max(t.maxItems,5);this.cursor>=i+o-3?i=Math.max(Math.min(this.cursor-o+3,this.options.length-o),0):this.cursor<i+2&&(i=Math.max(this.cursor-2,0));let $=o<this.options.length&&i>0,e=o<this.options.length&&i+o<this.options.length;return`${r}${p.default.cyan(s)} ${this.options.slice(i,i+o).map((m,u,y)=>u===0&&$?p.default.dim("..."):u===y.length-1&&e?p.default.dim("..."):n(m,u+i===this.cursor?"active":"inactive")).join(`
|
|
40
|
+
${p.default.cyan(s)} `)}
|
|
41
41
|
${p.default.cyan(O)}
|
|
42
|
-
`}}}}).prompt()},
|
|
43
|
-
${
|
|
44
|
-
`;switch(this.state){case"submit":return`${i}${p.default.gray(
|
|
45
|
-
${p.default.gray(
|
|
46
|
-
${p.default.cyan(
|
|
42
|
+
`}}}}).prompt()},po=(t)=>{let n=(i,r="inactive")=>{let o=i.label??String(i.value);return r==="selected"?`${p.default.dim(o)}`:r==="cancelled"?`${p.default.strikethrough(p.default.dim(o))}`:r==="active"?`${p.default.bgCyan(p.default.gray(` ${i.value} `))} ${o} ${i.hint?p.default.dim(`(${i.hint})`):""}`:`${p.default.gray(p.default.bgWhite(p.default.inverse(` ${i.value} `)))} ${o} ${i.hint?p.default.dim(`(${i.hint})`):""}`};return new yn({options:t.options,initialValue:t.initialValue,render(){let i=`${p.default.gray(s)}
|
|
43
|
+
${rt(this.state)} ${t.message}
|
|
44
|
+
`;switch(this.state){case"submit":return`${i}${p.default.gray(s)} ${n(this.options.find((r)=>r.value===this.value),"selected")}`;case"cancel":return`${i}${p.default.gray(s)} ${n(this.options[0],"cancelled")}
|
|
45
|
+
${p.default.gray(s)}`;default:return`${i}${p.default.cyan(s)} ${this.options.map((r,o)=>n(r,o===this.cursor?"active":"inactive")).join(`
|
|
46
|
+
${p.default.cyan(s)} `)}
|
|
47
47
|
${p.default.cyan(O)}
|
|
48
|
-
`}}}).prompt()},
|
|
49
|
-
${p.default.reset(p.default.dim(`Press ${p.default.gray(p.default.bgWhite(p.default.inverse(" space ")))} to select, ${p.default.gray(p.default.bgWhite(p.default.inverse(" enter ")))} to submit`))}`},render(){let i=`${p.default.gray(
|
|
50
|
-
${
|
|
51
|
-
`;switch(this.state){case"submit":return`${i}${p.default.gray(
|
|
52
|
-
${p.default.gray(
|
|
48
|
+
`}}}).prompt()},uo=(t)=>{let n=(i,r)=>{let o=i.label??String(i.value);return r==="active"?`${p.default.cyan(sn)} ${o} ${i.hint?p.default.dim(`(${i.hint})`):""}`:r==="selected"?`${p.default.green(bt)} ${p.default.dim(o)}`:r==="cancelled"?`${p.default.strikethrough(p.default.dim(o))}`:r==="active-selected"?`${p.default.green(bt)} ${o} ${i.hint?p.default.dim(`(${i.hint})`):""}`:r==="submitted"?`${p.default.dim(o)}`:`${p.default.dim(Xe)} ${p.default.dim(o)}`};return new qe({options:t.options,initialValues:t.initialValues,required:t.required??!0,cursorAt:t.cursorAt,validate(i){if(this.required&&i.length===0)return`Please select at least one option.
|
|
49
|
+
${p.default.reset(p.default.dim(`Press ${p.default.gray(p.default.bgWhite(p.default.inverse(" space ")))} to select, ${p.default.gray(p.default.bgWhite(p.default.inverse(" enter ")))} to submit`))}`},render(){let i=`${p.default.gray(s)}
|
|
50
|
+
${rt(this.state)} ${t.message}
|
|
51
|
+
`;switch(this.state){case"submit":return`${i}${p.default.gray(s)} ${this.options.filter(({value:r})=>this.value.includes(r)).map((r)=>n(r,"submitted")).join(p.default.dim(", "))||p.default.dim("none")}`;case"cancel":{let r=this.options.filter(({value:o})=>this.value.includes(o)).map((o)=>n(o,"cancelled")).join(p.default.dim(", "));return`${i}${p.default.gray(s)} ${r.trim()?`${r}
|
|
52
|
+
${p.default.gray(s)}`:""}`}case"error":{let r=this.error.split(`
|
|
53
53
|
`).map((o,$)=>$===0?`${p.default.yellow(O)} ${p.default.yellow(o)}`:` ${o}`).join(`
|
|
54
|
-
`);return i+p.default.yellow(
|
|
55
|
-
${p.default.yellow(
|
|
54
|
+
`);return i+p.default.yellow(s)+" "+this.options.map((o,$)=>{let e=this.value.includes(o.value),m=$===this.cursor;return m&&e?n(o,"active-selected"):e?n(o,"selected"):n(o,m?"active":"inactive")}).join(`
|
|
55
|
+
${p.default.yellow(s)} `)+`
|
|
56
56
|
`+r+`
|
|
57
|
-
`}default:return`${i}${p.default.cyan(
|
|
58
|
-
${p.default.cyan(
|
|
57
|
+
`}default:return`${i}${p.default.cyan(s)} ${this.options.map((r,o)=>{let $=this.value.includes(r.value),e=o===this.cursor;return e&&$?n(r,"active-selected"):$?n(r,"selected"):n(r,e?"active":"inactive")}).join(`
|
|
58
|
+
${p.default.cyan(s)} `)}
|
|
59
59
|
${p.default.cyan(O)}
|
|
60
|
-
`}}}).prompt()}
|
|
61
|
-
${p.default.reset(p.default.dim(`Press ${p.default.gray(p.default.bgWhite(p.default.inverse(" space ")))} to select, ${p.default.gray(p.default.bgWhite(p.default.inverse(" enter ")))} to submit`))}`},render(){let i=`${p.default.gray(
|
|
62
|
-
${
|
|
63
|
-
`;switch(this.state){case"submit":return`${i}${p.default.gray(
|
|
64
|
-
${p.default.gray(
|
|
60
|
+
`}}}).prompt()},yo=(t)=>{let n=(i,r,o=[])=>{let $=i.label??String(i.value),e=typeof i.group=="string",m=e&&(o[o.indexOf(i)+1]??{group:!0}),u=e&&m.group===!0,y=e?`${u?O:s} `:"";return r==="active"?`${p.default.dim(y)}${p.default.cyan(sn)} ${$} ${i.hint?p.default.dim(`(${i.hint})`):""}`:r==="group-active"?`${y}${p.default.cyan(sn)} ${p.default.dim($)}`:r==="group-active-selected"?`${y}${p.default.green(bt)} ${p.default.dim($)}`:r==="selected"?`${p.default.dim(y)}${p.default.green(bt)} ${p.default.dim($)}`:r==="cancelled"?`${p.default.strikethrough(p.default.dim($))}`:r==="active-selected"?`${p.default.dim(y)}${p.default.green(bt)} ${$} ${i.hint?p.default.dim(`(${i.hint})`):""}`:r==="submitted"?`${p.default.dim($)}`:`${p.default.dim(y)}${p.default.dim(Xe)} ${p.default.dim($)}`};return new pn({options:t.options,initialValues:t.initialValues,required:t.required??!0,cursorAt:t.cursorAt,validate(i){if(this.required&&i.length===0)return`Please select at least one option.
|
|
61
|
+
${p.default.reset(p.default.dim(`Press ${p.default.gray(p.default.bgWhite(p.default.inverse(" space ")))} to select, ${p.default.gray(p.default.bgWhite(p.default.inverse(" enter ")))} to submit`))}`},render(){let i=`${p.default.gray(s)}
|
|
62
|
+
${rt(this.state)} ${t.message}
|
|
63
|
+
`;switch(this.state){case"submit":return`${i}${p.default.gray(s)} ${this.options.filter(({value:r})=>this.value.includes(r)).map((r)=>n(r,"submitted")).join(p.default.dim(", "))}`;case"cancel":{let r=this.options.filter(({value:o})=>this.value.includes(o)).map((o)=>n(o,"cancelled")).join(p.default.dim(", "));return`${i}${p.default.gray(s)} ${r.trim()?`${r}
|
|
64
|
+
${p.default.gray(s)}`:""}`}case"error":{let r=this.error.split(`
|
|
65
65
|
`).map((o,$)=>$===0?`${p.default.yellow(O)} ${p.default.yellow(o)}`:` ${o}`).join(`
|
|
66
|
-
`);return`${i}${p.default.yellow(
|
|
67
|
-
${p.default.yellow(
|
|
66
|
+
`);return`${i}${p.default.yellow(s)} ${this.options.map((o,$,e)=>{let m=this.value.includes(o.value)||o.group===!0&&this.isGroupSelected(`${o.value}`),u=$===this.cursor;return!u&&typeof o.group=="string"&&this.options[this.cursor].value===o.group?n(o,m?"group-active-selected":"group-active",e):u&&m?n(o,"active-selected",e):m?n(o,"selected",e):n(o,u?"active":"inactive",e)}).join(`
|
|
67
|
+
${p.default.yellow(s)} `)}
|
|
68
68
|
${r}
|
|
69
|
-
`}default:return`${i}${p.default.cyan(
|
|
70
|
-
${p.default.cyan(
|
|
69
|
+
`}default:return`${i}${p.default.cyan(s)} ${this.options.map((r,o,$)=>{let e=this.value.includes(r.value)||r.group===!0&&this.isGroupSelected(`${r.value}`),m=o===this.cursor;return!m&&typeof r.group=="string"&&this.options[this.cursor].value===r.group?n(r,e?"group-active-selected":"group-active",$):m&&e?n(r,"active-selected",$):e?n(r,"selected",$):n(r,m?"active":"inactive",$)}).join(`
|
|
70
|
+
${p.default.cyan(s)} `)}
|
|
71
71
|
${p.default.cyan(O)}
|
|
72
|
-
`}}}).prompt()},
|
|
72
|
+
`}}}).prompt()},xn=(t)=>t.replace(bo(),""),co=(t="",n="")=>{let i=`
|
|
73
73
|
${t}
|
|
74
74
|
`.split(`
|
|
75
|
-
`),r=
|
|
76
|
-
`);process.stdout.write(`${p.default.gray(
|
|
77
|
-
${p.default.green(
|
|
75
|
+
`),r=xn(n).length,o=Math.max(i.reduce((e,m)=>(m=xn(m),m.length>e?m.length:e),0),r)+2,$=i.map((e)=>`${p.default.gray(s)} ${p.default.dim(e)}${" ".repeat(o-xn(e).length)}${p.default.gray(s)}`).join(`
|
|
76
|
+
`);process.stdout.write(`${p.default.gray(s)}
|
|
77
|
+
${p.default.green(Yt)} ${p.default.reset(n)} ${p.default.gray(Ne.repeat(Math.max(o-r-1,1))+fr)}
|
|
78
78
|
${$}
|
|
79
|
-
${p.default.gray(
|
|
80
|
-
`)},
|
|
79
|
+
${p.default.gray(gr+Ne.repeat(o+2)+Dr)}
|
|
80
|
+
`)},_o=(t="")=>{process.stdout.write(`${p.default.gray(O)} ${p.default.red(t)}
|
|
81
81
|
|
|
82
|
-
`)},
|
|
83
|
-
`)},
|
|
82
|
+
`)},xo=(t="")=>{process.stdout.write(`${p.default.gray(Er)} ${t}
|
|
83
|
+
`)},wo=(t="")=>{process.stdout.write(`${p.default.gray(s)}
|
|
84
84
|
${p.default.gray(O)} ${t}
|
|
85
85
|
|
|
86
|
-
`)},
|
|
87
|
-
`);let w=0,
|
|
88
|
-
`),i()},
|
|
89
|
-
`);i.push(`${
|
|
86
|
+
`)},it,ho=()=>{let t=wn?["◒","◐","◓","◑"]:["•","o","O","0"],n=wn?80:120,i,r,o=!1,$="",e=(x="")=>{o=!0,i=Be(),$=x.replace(/\.+$/,""),process.stdout.write(`${p.default.gray(s)}
|
|
87
|
+
`);let w=0,b=0;r=setInterval(()=>{let h=p.default.magenta(t[w]),v=".".repeat(Math.floor(b)).slice(0,3);process.stdout.write(ut.cursor.move(-999,0)),process.stdout.write(ut.erase.down(1)),process.stdout.write(`${h} ${$}${v}`),w=w+1<t.length?w+1:0,b=b<t.length?b+0.125:0},n)},m=(x="",w=0)=>{$=x??$,o=!1,clearInterval(r);let b=w===0?p.default.green(Yt):w===1?p.default.red(le):p.default.red(Je);process.stdout.write(ut.cursor.move(-999,0)),process.stdout.write(ut.erase.down(1)),process.stdout.write(`${b} ${$}
|
|
88
|
+
`),i()},u=(x="")=>{$=x??$},y=(x)=>{let w=x>1?"Something went wrong":"Canceled";o&&m(w,x)};return process.on("uncaughtExceptionMonitor",()=>y(2)),process.on("unhandledRejection",()=>y(2)),process.on("SIGINT",()=>y(1)),process.on("SIGTERM",()=>y(1)),process.on("exit",y),{start:e,stop:m,message:u}},so=async(t,n)=>{let i={},r=Object.keys(t);for(let o of r){let $=t[o],e=await $({results:i})?.catch((m)=>{throw m});if(typeof n?.onCancel=="function"&&Ot(e)){i[o]="canceled",n.onCancel({results:i});continue}i[o]=e}return i};var Zt=It(()=>{_n();_n();p=kt(nn(),1),ut=kt(Dt(),1);wn=Lr(),ar=N("◆","*"),le=N("■","x"),Je=N("▲","x"),Yt=N("◇","o"),Er=N("┌","T"),s=N("│","|"),O=N("└","—"),hn=N("●",">"),bn=N("○"," "),sn=N("◻","[•]"),bt=N("◼","[+]"),Xe=N("◻","[ ]"),Fr=N("▪","•"),Ne=N("─","-"),fr=N("╮","+"),gr=N("├","+"),Dr=N("╯","+"),to=N("●","•"),no=N("◆","*"),eo=N("▲","!"),io=N("■","x"),it={message:(t="",{symbol:n=p.default.gray(s)}={})=>{let i=[`${p.default.gray(s)}`];if(t){let[r,...o]=t.split(`
|
|
89
|
+
`);i.push(`${n} ${r}`,...o.map(($)=>`${p.default.gray(s)} ${$}`))}process.stdout.write(`${i.join(`
|
|
90
90
|
`)}
|
|
91
|
-
`)},info:(t)=>{
|
|
92
|
-
`);return null}}async function mt(t){await
|
|
93
|
-
`,{mode:384}),
|
|
94
|
-
`)}catch{}}var
|
|
95
|
-
`);let w=await
|
|
91
|
+
`)},info:(t)=>{it.message(t,{symbol:p.default.blue(to)})},success:(t)=>{it.message(t,{symbol:p.default.green(no)})},step:(t)=>{it.message(t,{symbol:p.default.green(Yt)})},warn:(t)=>{it.message(t,{symbol:p.default.yellow(eo)})},warning:(t)=>{it.warn(t)},error:(t)=>{it.message(t,{symbol:p.default.red(io)})}}});var Ke={};Bn(Ke,{readTextFromPathOrStdin:()=>st});import{readFileSync as Mo}from"fs";function st(t){return Mo(t==="-"?"/dev/stdin":t,"utf-8")}var Wt=()=>{};function dt(t){return t.replace(/-([a-z])/g,(n,i)=>i.toUpperCase())}function Xi(t){let n=t.flag.match(/^--([a-z][a-z0-9-]*)/i);return n?dt(n[1]):null}function Qi(t){if(t.type==="boolean")return!0;if(t.type==="string"||t.type==="number"||t.type==="array")return!1;return!t.flag.includes("<")&&!t.flag.includes("[")}function Nn(t){let n=new Set,i=new Set,r=new Set;for(let o of t){let $=Xi(o);if(!$)continue;if(Qi(o))n.add($);else if(o.type==="number")i.add($);else if(o.type==="array")r.add($)}return{booleans:n,numbers:i,arrays:r}}function ln(t,n=[]){let i=Nn(n),r=[],o=0;while(o<t.length){let $=t[o];if($==="--")break;if($.startsWith("--")){let e=$.indexOf("="),m=e!==-1?$.slice(2,e):$.slice(2),u=dt(m);if(!i.booleans.has(u)&&e===-1)o+=2;else o+=1;continue}if($.startsWith("-")){o++;continue}r.push($),o++}return r}function Pt(t,n){let i=Nn(n),r={quiet:!1,verbose:!1,noColor:!1,yes:!1,dryRun:!1,help:!1,nonInteractive:!1,async:!1},o=0;while(o<t.length){let $=t[o];if($==="--help"||$==="-h"){r.help=!0,o++;continue}if($==="--")break;if($.startsWith("--")){let e=$.indexOf("="),m,u;if(e!==-1)m=$.slice(2,e),u=$.slice(e+1);else m=$.slice(2);let y=dt(m);if(i.booleans.has(y)){r[y]=!0,o++;continue}if(u===void 0)o++,u=t[o];if(u===void 0)throw Error(`Flag --${m} requires a value.`);if(i.arrays.has(y)){let x=r[y];if(x)x.push(u);else r[y]=[u]}else if(i.numbers.has(y))r[y]=Number(u);else r[y]=u}o++}return r}var c={SUCCESS:0,GENERAL:1,USAGE:2,AUTH:3,QUOTA:4,TIMEOUT:5,NETWORK:6,CONTENT_FILTER:10};class _ extends Error{exitCode;hint;constructor(t,n=c.GENERAL,i){super(t);this.name="CLIError",this.exitCode=n,this.hint=i}toJSON(){return{error:{code:this.exitCode,message:this.message,...this.hint?{hint:this.hint}:{}}}}}var L={global:"https://api.minimax.io",cn:"https://api.minimaxi.com"},xt={global:"https://platform.minimax.io",cn:"https://platform.minimaxi.com"},Oi=new Set(["global","cn"]),Yi=new Set(["text","json"]);function Jn(t){if(!t||typeof t!=="object"||Array.isArray(t))return{};let n=t,i={};if(typeof n.api_key==="string")i.api_key=n.api_key;if(typeof n.region==="string"&&Oi.has(n.region))i.region=n.region;if(typeof n.base_url==="string"&&n.base_url.startsWith("http"))i.base_url=n.base_url;if(typeof n.output==="string"&&Yi.has(n.output))i.output=n.output;if(typeof n.timeout==="number"&&n.timeout>0)i.timeout=n.timeout;if(typeof n.default_text_model==="string"&&n.default_text_model.length>0)i.default_text_model=n.default_text_model;if(typeof n.default_speech_model==="string"&&n.default_speech_model.length>0)i.default_speech_model=n.default_speech_model;if(typeof n.default_video_model==="string"&&n.default_video_model.length>0)i.default_video_model=n.default_video_model;if(typeof n.default_music_model==="string"&&n.default_music_model.length>0)i.default_music_model=n.default_music_model;return i}function M(t){return{name:t.name,description:t.description,usage:t.usage,options:t.options,examples:t.examples,apiDocs:t.apiDocs,execute:t.run}}var Mt=[{flag:"--api-key <key>",description:"API key"},{flag:"--region <region>",description:"API region: global, cn"},{flag:"--base-url <url>",description:"API base URL"},{flag:"--output <format>",description:"Output format: text, json"},{flag:"--timeout <seconds>",description:"Request timeout",type:"number"},{flag:"--quiet",description:"Suppress non-essential output"},{flag:"--verbose",description:"Print HTTP request/response details"},{flag:"--no-color",description:"Disable ANSI colors"},{flag:"--dry-run",description:"Dry run mode"},{flag:"--non-interactive",description:"Disable interactive prompts"},{flag:"--help",description:"Show help"},{flag:"--version",description:"Print version"}];import{readFileSync as zi,writeFileSync as Wi,renameSync as Ki,unlinkSync as Hi,existsSync as Xn,statSync as Ui}from"fs";import{homedir as Vi}from"os";import{join as Ct}from"path";var Zi=".mmx";function wt(){return Ct(Vi(),Zi)}function a(){return Ct(wt(),"config.json")}function St(){return Ct(wt(),"credentials.json")}async function At(){let t=wt();await(await import("fs/promises")).mkdir(t,{recursive:!0,mode:448})}async function W(){let t=St();if(!Xn(t))return null;try{Ii(t);let n=zi(t,"utf-8"),i=JSON.parse(n);if(!i.access_token||!i.refresh_token)return null;return i}catch(n){let i=n;if(i instanceof SyntaxError||i.message.includes("JSON"))process.stderr.write(`Warning: credentials file is corrupted. Run 'mmx auth logout' to reset.
|
|
92
|
+
`);return null}}async function mt(t){await At();let n=St(),i=n+".tmp";Wi(i,JSON.stringify(t,null,2)+`
|
|
93
|
+
`,{mode:384}),Ki(i,n)}async function Qn(){let t=St();if(Xn(t))Hi(t)}function Ii(t){try{let i=Ui(t).mode&511;if(i!==384)process.stderr.write(`Warning: ${t} has permissions ${i.toString(8)}, expected 600.
|
|
94
|
+
`)}catch{}}var On={clientId:"mmx-cli",authorizationUrl:"https://platform.minimax.io/oauth/authorize",tokenUrl:"https://api.minimax.io/v1/oauth/token",deviceCodeUrl:"https://api.minimax.io/v1/oauth/device/code",scopes:["api"],callbackPort:18991};async function Yn(t=On){let{randomBytes:n,createHash:i}=await import("crypto"),r=n(32).toString("base64url"),o=i("sha256").update(r).digest("base64url"),$=n(16).toString("hex"),e=new URLSearchParams({client_id:t.clientId,response_type:"code",redirect_uri:`http://localhost:${t.callbackPort}/callback`,scope:t.scopes.join(" "),state:$,code_challenge:o,code_challenge_method:"S256"}),m=`${t.authorizationUrl}?${e}`,{execFile:u,spawn:y}=await import("child_process"),x=process.platform;if(x==="darwin")u("open",[m]);else if(x==="win32")y("cmd.exe",["/c","start","",m],{shell:!1,detached:!0});else u("xdg-open",[m]);process.stderr.write(`Opening browser to authenticate with MiniMax...
|
|
95
|
+
`);let w=await di(t.callbackPort,$),b=await fetch(t.tokenUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"authorization_code",code:w,client_id:t.clientId,redirect_uri:`http://localhost:${t.callbackPort}/callback`,code_verifier:r})});if(!b.ok){let h=await b.text();throw new _(`OAuth token exchange failed: ${h}`,c.AUTH)}return await b.json()}async function di(t,n){return new Promise((i,r)=>{let o=setTimeout(()=>{$.stop(),r(new _("OAuth callback timed out.",c.TIMEOUT))},120000),$=Bun.serve({port:t,fetch(e){let m=new URL(e.url);if(m.pathname!=="/callback")return new Response("Not found",{status:404});let u=m.searchParams.get("code"),y=m.searchParams.get("state"),x=m.searchParams.get("error");if(x)return clearTimeout(o),$.stop(),r(new _(`OAuth error: ${x}`,c.AUTH)),new Response("<html><body><h1>Authentication Failed</h1><p>You can close this tab.</p></body></html>",{headers:{"Content-Type":"text/html"}});if(!u||y!==n)return clearTimeout(o),$.stop(),r(new _("Invalid OAuth callback.",c.AUTH)),new Response("Invalid callback",{status:400});return clearTimeout(o),$.stop(),i(u),new Response("<html><body><h1>Authentication Successful</h1><p>You can close this tab.</p></body></html>",{headers:{"Content-Type":"text/html"}})}})})}async function Vn(t=On){let n=await fetch(t.deviceCodeUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:t.clientId,scope:t.scopes.join(" ")})});if(!n.ok)throw new _("Failed to start device code flow.",c.AUTH);let{device_code:i,user_code:r,verification_uri:o,interval:$,expires_in:e}=await n.json();process.stderr.write(`
|
|
96
96
|
Visit: ${o}
|
|
97
97
|
`),process.stderr.write(`Enter code: ${r}
|
|
98
98
|
`),process.stderr.write(`Waiting for authorization...
|
|
99
|
-
`);let m=Date.now()+
|
|
100
|
-
Re-authenticate: mmx auth login`)}async function
|
|
101
|
-
Pass directly: --api-key sk-xxxxx`)}function
|
|
99
|
+
`);let m=Date.now()+e*1000,u=($||5)*1000;while(Date.now()<m){await new Promise((w)=>setTimeout(w,u));let y=await fetch(t.tokenUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"urn:ietf:params:oauth:grant-type:device_code",device_code:i,client_id:t.clientId})});if(y.ok)return await y.json();let x=await y.json();if(x.error==="authorization_pending")continue;if(x.error==="slow_down"){await new Promise((w)=>setTimeout(w,5000));continue}throw new _(`Device code authorization failed: ${x.error}`,c.AUTH)}throw new _("Device code authorization timed out.",c.TIMEOUT)}var Pi="https://api.minimax.io/v1/oauth/token",Zn=2,Ci=500;async function Lt(t){let n=null;for(let i=0;i<=Zn;i++){if(i>0)await new Promise(($)=>setTimeout($,Ci*i));let r;try{r=await fetch(Pi,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:t}),signal:AbortSignal.timeout(1e4)})}catch($){let e=$ instanceof Error&&($.name==="AbortError"||$.name==="TimeoutError"||$.message.includes("timed out"));n=Error(e?"Token refresh timed out — auth server did not respond within 10 s.":`Token refresh failed: ${$ instanceof Error?$.message:String($)}`);continue}if(!r.ok){if(r.status>=400&&r.status<500)throw new _("OAuth session expired and could not be refreshed.",c.AUTH,"Re-authenticate: mmx auth login");n=Error(`Token refresh failed: HTTP ${r.status}`);continue}return await r.json()}throw new _(`Token refresh failed after ${Zn+1} attempts: ${n?.message}`,c.AUTH,`Check your network connection.
|
|
100
|
+
Re-authenticate: mmx auth login`)}async function zn(t){let n=new Date(t.expires_at).getTime(),i=300000;if(Date.now()<n-300000)return t.access_token;let r=await Lt(t.refresh_token),o={access_token:r.access_token,refresh_token:r.refresh_token,expires_at:new Date(Date.now()+r.expires_in*1000).toISOString(),token_type:"Bearer",account:t.account};return await mt(o),o.access_token}async function jt(t){if(t.apiKey)return{token:t.apiKey,method:"api-key",source:"flag"};let n=await W();if(n)return{token:await zn(n),method:"oauth",source:"credentials.json"};if(t.fileApiKey)return{token:t.fileApiKey,method:"api-key",source:"config.json"};throw new _("No credentials found.",c.AUTH,`Log in: mmx auth login
|
|
101
|
+
Pass directly: --api-key sk-xxxxx`)}function Wn(t){if(!t)return"";if(t.includes("/t2a"))return`
|
|
102
102
|
|
|
103
103
|
Speech models require the Plus plan or above.`;if(t.includes("/image_generation"))return`
|
|
104
104
|
|
|
@@ -106,96 +106,106 @@ image-01 requires the Plus plan or above.`;if(t.includes("/video_generation")||t
|
|
|
106
106
|
|
|
107
107
|
Video models (Hailuo-2.3 / 2.3-Fast) require the Max plan or above.`;if(t.includes("/music_generation"))return`
|
|
108
108
|
|
|
109
|
-
Music-2.6 requires the Max plan or above.`;return""}function
|
|
110
|
-
Re-authenticate: mmx auth login`);if(t===429)return new
|
|
111
|
-
Upgrade plan: ${
|
|
112
|
-
Upgrade plan: ${
|
|
113
|
-
`)}async function
|
|
109
|
+
Music-2.6 requires the Max plan or above.`;return""}function Kn(t){return`${t?.includes("minimaxi.com")?"https://platform.minimaxi.com":"https://platform.minimax.io"}/subscribe/token-plan`}function at(t,n,i){let r=n.base_resp?.status_msg||n.error?.message||`HTTP ${t}`,o=n.base_resp?.status_code||n.error?.code;if(t===401||t===403)return new _(`API key rejected (HTTP ${t}).`,c.AUTH,`Check status: mmx auth status
|
|
110
|
+
Re-authenticate: mmx auth login`);if(t===429)return new _(`Rate limit or quota exceeded. ${r}`,c.QUOTA,"Check usage: mmx quota show");if(t===408||t===504)return new _(`Request timed out (HTTP ${t}).`,c.TIMEOUT,"Try increasing --timeout or retry later.");if(o===1002||o===1039){let $=n.base_resp?.status_msg||"content sensitivity";return new _(`Input content flagged by sensitivity filter (${$}).`,c.CONTENT_FILTER)}if(o===1028||o===1030){let $=Wn(i);return new _(`Quota exhausted. ${r}`,c.QUOTA,`Check usage: mmx quota show${$}
|
|
111
|
+
Upgrade plan: ${Kn(i)}`)}if(o===2061){let $=Wn(i);return new _(`This model is not available on your current Token Plan. ${r}`,c.QUOTA,`Check usage: mmx quota show${$}
|
|
112
|
+
Upgrade plan: ${Kn(i)}`)}return new _(`API error: ${r} (HTTP ${t})`,c.GENERAL)}import{homedir as Hn}from"os";function K(t){return t.length>8?`${t.slice(0,4)}...${t.slice(-4)}`:"***"}var Un=!1;var Z="\x1B[0m",E="\x1B[2m",Li="\x1B[1m",ai="\x1B[38;2;43;82;255m",Ei="\x1B[38;2;147;51;234m",Fi="\x1B[38;2;6;184;212m",fi="\x1B[38;2;236;72;153m";function gi(t){return t.startsWith(Hn())?t.replace(Hn(),"~"):t}function In(t,n,i){if(t.quiet||Un||!process.stderr.isTTY)return;Un=!0;let r=t.configPath?gi(t.configPath):"~/.mmx/config.json",o=t.fileRegion?`${t.fileRegion} (file)`:"global (default)",$=t.apiKey?"(flag)":"(file)",e=K(n),m=i?` ${E}|${Z} ${E}Model:${Z} ${Ei}${i}${Z}`:"";process.stderr.write(`${Li}${ai}MINIMAX${Z} ${E}${r}${Z} ${E}|${Z} ${E}Region:${Z} ${Fi}${o}${Z} ${E}|${Z} ${E}Key:${Z} ${fi}${e}${Z} ${E}${$}${Z}${m}
|
|
113
|
+
`)}async function C(t,n){let i=typeof FormData<"u"&&n.body instanceof FormData,r="1.0.12",o={"User-Agent":"mmx-cli/1.0.12",...n.headers};if(!i&&!o["Content-Type"])o["Content-Type"]="application/json";if(!n.noAuth){let m=await jt(t);if(n.authStyle==="x-api-key")o["x-api-key"]=m.token;else o.Authorization=`Bearer ${m.token}`;if(t.verbose)process.stderr.write(`> ${n.method??"GET"} ${n.url}
|
|
114
114
|
`),process.stderr.write(`> Auth: ${m.token.slice(0,8)}...
|
|
115
|
-
`);let
|
|
116
|
-
`);if(!
|
|
115
|
+
`);let u=n.body&&typeof n.body==="object"&&"model"in n.body?String(n.body.model):void 0;In(t,m.token,u)}let $=(n.timeout??t.timeout)*1000,e=await fetch(n.url,{method:n.method??"GET",headers:o,body:n.body?i?n.body:JSON.stringify(n.body):void 0,signal:AbortSignal.timeout($)});if(t.verbose)process.stderr.write(`< ${e.status} ${e.statusText}
|
|
116
|
+
`);if(!e.ok){let m={};try{m=await e.json()}catch{}throw at(e.status,m,n.url)}return e}async function q(t,n){let i=await C(t,n),r;try{r=await i.json()}catch{let o=i.headers.get("content-type")||"";throw new _(`API returned non-JSON response (${o||"unknown type"}). Server may be experiencing issues.`,c.GENERAL)}if(r.base_resp?.status_code&&r.base_resp.status_code!==0)throw at(200,{base_resp:r.base_resp},n.url);return r}function dn(t){return`${t}/anthropic/v1/messages`}function Pn(t){return`${t}/v1/t2a_v2`}function Cn(t){return`${t}/v1/get_voice`}function Ln(t){return`${t}/v1/image_generation`}function an(t){return`${t}/v1/video_generation`}function Gt(t,n){return`${t}/v1/query/video_generation?task_id=${n}`}function qt(t,n){return`${t}/v1/files/retrieve?file_id=${n}`}function Tt(t){return`${t}/v1/music_generation`}function En(t){return`${t}/v1/coding_plan/search`}function Fn(t){return`${t}/v1/coding_plan/vlm`}function nt(t){return`${t.includes("minimaxi.com")?"https://api.minimaxi.com":"https://api.minimax.io"}/v1/token_plan/remains`}function Dn(t){if(t<50)return["\x1B[38;2;74;222;128m","\x1B[48;2;22;163;74m"];if(t<=80)return["\x1B[38;2;250;204;21m","\x1B[48;2;202;138;4m"];return["\x1B[38;2;248;113;113m","\x1B[48;2;220;38;38m"]}var Di={dashboard:"TokenPlan Quota",week:"Week",weekly:"Weekly",resetsIn:"Resets in",noData:"No quota data available.",now:"now"},tr={dashboard:"TokenPlan 配额面板",week:"周期",weekly:"每周",resetsIn:"重置于",noData:"暂无配额数据",now:"即将"};function nr(t,n){if(t<=0)return n;let i=Math.floor(t/3600000),r=Math.floor(t%3600000/60000);return i>0?`${i}h ${r}m`:`${r}m`}function fn(t){return new Date(t).toISOString().slice(0,10)}function er(t){return t>=11904&&t<=40959||t>=63744&&t<=64255||t>=65072&&t<=65103||t>=65281&&t<=65376||t>=131072&&t<=195103}function F(t){let n=t.replace(/\x1b\[[0-9;]*m/g,""),i=0;for(let r of n)i+=er(r.codePointAt(0))?2:1;return i}var Nt=16;function gn(t,n){let i=Math.max(0,Math.min(100,t))/100,r=Math.round(Nt*i),o=Nt-r,$=`${t}%`.padStart(4);if(!n)return`[${"█".repeat(r)}${".".repeat(o)}] ${$}`;let[e,m]=Dn(t);return`${m}${" ".repeat(r)}\x1B[0m\x1B[48;2;55;65;81m${" ".repeat(o)}\x1B[0m ${e}\x1B[1m${$}\x1B[0m`}function Bt(t,n,i,r,o){return o?`\x1B[2m${n}${i.repeat(t)}${r}\x1B[0m`:`+${"-".repeat(t)}+`}function Et(t,n,i,r){let o=Math.max(0,n-2-i);return r?`${"\x1B[2m"}│${"\x1B[0m"} ${t}${" ".repeat(o)} ${"\x1B[2m"}│${"\x1B[0m"}`:`| ${t}${" ".repeat(o)} |`}function pt(t,n){let i=!n.noColor&&process.stdout.isTTY===!0,r=n.region==="cn"?tr:Di,o=t.length>0?Math.max(...t.map((h)=>h.model_name.length)):16,$=i?Nt+5:Nt+7,e=Math.max(68,o+2+15+2+$+2),m=t.length>0?`${fn(t[0].weekly_start_time)} — ${fn(t[0].weekly_end_time)}`:"",u=`MINIMAX ${r.dashboard}`,y=`${r.week}: ${m}`,x=Math.max(2,e-2-F(u)-F(y)),w=i?`\x1B[1m\x1B[38;2;43;82;255mMINIMAX\x1B[0m \x1B[2m${r.dashboard}\x1B[0m${" ".repeat(x)}\x1B[2m${r.week}:\x1B[0m \x1B[38;2;6;184;212m${m}\x1B[0m`:`${u}${" ".repeat(x)}${y}`,b=F(u)+x+F(y);if(console.log(""),console.log(Bt(e,"╭","─","╮",i)),console.log(Et(w,e,b,i)),t.length===0){console.log(Bt(e,"╰","─","╯",i)),console.log(`
|
|
117
117
|
${r.noData}
|
|
118
|
-
`);return}for(let
|
|
119
|
-
`)}if(typeof t==="object")return
|
|
120
|
-
`)}function
|
|
121
|
-
`)}function
|
|
122
|
-
`);return{}}}async function
|
|
123
|
-
`,{mode:384})
|
|
118
|
+
`);return}for(let h of t){console.log(Bt(e,"├","─","┤",i));let{current_interval_usage_count:v,current_interval_total_count:R}=h,S=R>0?Math.round(v/R*100):0,A=h.current_weekly_usage_count,l=h.current_weekly_total_count,Y=nr(h.remains_time,r.now),T=h.model_name.padEnd(o),G=`${v.toLocaleString()} / ${R.toLocaleString()}`,V=gn(S,i),d=o+2+15+2+$,P=i?`\x1B[1m${T}\x1B[0m ${Dn(S)[0]}${G.padStart(15)}\x1B[0m ${V}`:`${T} ${G.padStart(15)} ${gn(S,!1)}`;console.log(Et(P,e,d,i));let _t=`└ ${r.weekly} ${A.toLocaleString()} / ${l.toLocaleString()}`,Rt=`${r.resetsIn} ${Y}`,Ht=Math.max(2,e-2-2-F(_t)-F(Rt)),ki=2+F(_t)+Ht+F(Rt),Mi=i?` \x1B[2m${_t}${" ".repeat(Ht)}${Rt}\x1B[0m`:` ${_t}${" ".repeat(Ht)}${Rt}`;console.log(Et(Mi,e,ki,i))}console.log(Bt(e,"╰","─","╯",i)),console.log("")}import{readFileSync as rr,writeFileSync as or,renameSync as $r,existsSync as mr}from"fs";function te(t){if(t===null||t===void 0)return"";if(typeof t==="string")return t;if(typeof t==="number"||typeof t==="boolean")return String(t);if(Array.isArray(t)){if(t.length===0)return"(empty)";if(typeof t[0]==="object"&&t[0]!==null)return ir(t);return t.map(String).join(`
|
|
119
|
+
`)}if(typeof t==="object")return Ft(t);return String(t)}function Ft(t,n=0){let i=" ".repeat(n),r=[];for(let[o,$]of Object.entries(t)){if($===null||$===void 0)continue;if(Array.isArray($)){r.push(`${i}${o}:`);for(let e of $)if(typeof e==="object"&&e!==null)r.push(`${i} - ${Ft(e,n+4).trimStart()}`);else r.push(`${i} - ${String(e)}`)}else if(typeof $==="object")r.push(`${i}${o}:`),r.push(Ft($,n+2));else r.push(`${i}${o}: ${String($)}`)}return r.join(`
|
|
120
|
+
`)}function ir(t){if(t.length===0)return"(empty)";let n=Object.keys(t[0]),i=n.map((e)=>Math.max(e.length,...t.map((m)=>String(m[e]??"").length))),r=n.map((e,m)=>e.toUpperCase().padEnd(i[m])).join(" "),o=i.map((e)=>"-".repeat(e)).join(" "),$=t.map((e)=>n.map((m,u)=>String(e[m]??"").padEnd(i[u])).join(" "));return[r,o,...$].join(`
|
|
121
|
+
`)}function ne(t){return JSON.stringify(t,null,2)}function j(t){if(t==="json"||t==="text")return t;if(!process.stdout.isTTY)return"json";return"text"}function k(t,n){switch(n){case"json":return ne(t);case"text":return te(t)}}function Q(){let t=a();if(!mr(t))return{};try{return Jn(JSON.parse(rr(t,"utf-8")))}catch(n){let i=n;if(i instanceof SyntaxError||i.message.includes("JSON"))process.stderr.write(`Warning: config file is corrupted. Run 'mmx config set' to reset.
|
|
122
|
+
`);return{}}}async function U(t){await At();let n=a(),i=n+".tmp";or(i,JSON.stringify(t,null,2)+`
|
|
123
|
+
`,{mode:384}),$r(i,n)}function ft(t){let n=Q(),i=t.apiKey||void 0,r=n.api_key,o=t.region||process.env.MINIMAX_REGION||void 0,$=n.region,e=o||$||"global",m=i||r,u=!o&&(!$||m!==void 0&&m!==n.api_key),y=t.baseUrl||process.env.MINIMAX_BASE_URL||n.base_url||L[e]||L.global,x=j(t.output||process.env.MINIMAX_OUTPUT||n.output),w=process.env.MINIMAX_TIMEOUT?Number(process.env.MINIMAX_TIMEOUT):void 0,b=w!==void 0&&Number.isFinite(w)&&w>0?w:void 0,h=t.timeout??b??n.timeout??300;return{apiKey:i,fileApiKey:r,fileRegion:n.region,configPath:a(),region:e,baseUrl:y,output:x,timeout:h,defaultTextModel:n.default_text_model,defaultSpeechModel:n.default_speech_model,defaultVideoModel:n.default_video_model,defaultMusicModel:n.default_music_model,verbose:t.verbose||process.env.MINIMAX_VERBOSE==="1",quiet:t.quiet||!1,noColor:t.noColor||process.env.NO_COLOR!==void 0||!process.stdout.isTTY,yes:t.yes||!1,dryRun:t.dryRun||!1,nonInteractive:t.nonInteractive||!1,async:t.async||!1,needsRegionDetection:u}}function J(t){if(t?.nonInteractive===!0)return!1;if(process.env.CI)return!1;return process.stdout.isTTY===!0&&process.stdin.isTTY===!0}async function Qe(t){try{let n=nt(t.baseUrl),i=await q(t,{url:n});pt(i.model_remains||[],t)}catch{}}var Oe=M({name:"auth login",description:"Authenticate via OAuth or API key",usage:"mmx auth login [--method oauth|api-key] [--api-key <key>] [--no-browser]",options:[{flag:"--method <method>",description:"Auth method: oauth (default), api-key"},{flag:"--api-key <key>",description:"API key to store"},{flag:"--no-browser",description:"Use device-code flow instead of browser"}],examples:["mmx auth login","mmx auth login --no-browser","mmx auth login --api-key sk-xxxxx","mmx auth login --method api-key --api-key sk-xxxxx"],async run(t,n){let i=process.env.MINIMAX_API_KEY;if(i&&!n.apiKey){let e=K(i);if(J({nonInteractive:t.nonInteractive})){let{confirm:m}=await Promise.resolve().then(() => (Zt(),Vt));if(!await m({message:`Detected MINIMAX_API_KEY in environment (${e}).
|
|
124
124
|
You are already authenticated via env.
|
|
125
125
|
Do you still want to configure local persistent credentials?`,initialValue:!1}))process.stdout.write(`Login skipped. Using environment variables.
|
|
126
126
|
`),process.exit(0)}else process.stderr.write(`Warning: MINIMAX_API_KEY is already set in environment.
|
|
127
|
-
`)}if((
|
|
128
|
-
`)}catch{throw new
|
|
129
|
-
`),await
|
|
127
|
+
`)}if((n.apiKey?"api-key":n.method||"oauth")==="api-key"){let e=n.apiKey||t.apiKey;if(!e)throw new _("--api-key is required when using --method api-key.",c.USAGE,"mmx auth login --api-key sk-xxxxx");if(!t.dryRun){process.stderr.write("Testing key... ");try{let u={...t,apiKey:e};await q(u,{url:nt(u.baseUrl)}),process.stderr.write(`Valid
|
|
128
|
+
`)}catch{throw new _("API key validation failed.",c.AUTH,"Check that your key is valid and belongs to a Token Plan.")}let m=Q();m.api_key=e,await U(m),process.stderr.write(`API key saved to ${a()}
|
|
129
|
+
`),await Qe({...t,apiKey:e})}else console.log("Would validate and save API key.");return}if(t.dryRun){console.log("Would start OAuth login flow.");return}let o;if(n.noBrowser)o=await Vn();else o=await Yn();let $={access_token:o.access_token,refresh_token:o.refresh_token,expires_at:new Date(Date.now()+o.expires_in*1000).toISOString(),token_type:"Bearer"};await mt($),process.stderr.write(`Logged in successfully.
|
|
130
130
|
`),process.stderr.write(`Credentials saved to ~/.mmx/credentials.json
|
|
131
|
-
`),await
|
|
132
|
-
`);try{let $=
|
|
133
|
-
Or set $MINIMAX_API_KEY`},i))}}});var
|
|
134
|
-
`);if(o)try{let $=r;delete $.api_key,await
|
|
131
|
+
`),await Qe({...t,apiKey:$.access_token})}});var Ye=M({name:"auth status",description:"Show current authentication state and quota snapshot",usage:"mmx auth status",examples:["mmx auth status","mmx auth status --output json"],async run(t,n){try{let i=await jt(t),r=j(t.output);if(r!=="text"){let $={method:i.method,source:i.source};if(i.method==="oauth"){let e=await W();if(e){if($.token_expires=e.expires_at,e.account)$.account=e.account}}else $.key=K(i.token);console.log(k($,r));return}console.log("Authentication Status:"),console.log(` Method: ${i.method}`),console.log(` Source: ${i.source}`);let o=i.token;if(console.log(` Key: ${K(o)}`),i.method==="oauth"){let $=await W();if($){if($.account)console.log(` Account: ${$.account}`);let e=new Date($.expires_at),m=Math.round((e.getTime()-Date.now())/60000);console.log(` Expires in: ${m} minutes`)}}process.stderr.write(`Fetching quota snapshot...
|
|
132
|
+
`);try{let $=nt(t.baseUrl),e=await q(t,{url:$,method:"GET"});pt(e.model_remains||[],t)}catch($){console.log(` Quota fetch failed: ${$.message}`)}}catch{let i=j(t.output);console.log(k({authenticated:!1,message:"Not authenticated.",hint:`Run: mmx auth login
|
|
133
|
+
Or set $MINIMAX_API_KEY`},i))}}});var Ve=M({name:"auth refresh",description:"Manually refresh OAuth token",usage:"mmx auth refresh",examples:["mmx auth refresh"],async run(t,n){let i=await W();if(!i)throw new _("Not applicable: not authenticated via OAuth.",c.USAGE,"Run mmx auth login first.");if(t.dryRun){console.log("Would refresh OAuth token.");return}let r=await Lt(i.refresh_token),o={access_token:r.access_token,refresh_token:r.refresh_token,expires_at:new Date(Date.now()+r.expires_in*1000).toISOString(),token_type:"Bearer",account:i.account};await mt(o);let $=j(t.output);if(t.quiet){console.log(o.expires_at);return}console.log(k({status:"Token refreshed",expires:o.expires_at},$))}});var Ze=M({name:"auth logout",description:"Revoke tokens and clear stored credentials",usage:"mmx auth logout [--yes] [--dry-run]",options:[{flag:"--yes",description:"Skip confirmation prompt"}],examples:["mmx auth logout","mmx auth logout --dry-run","mmx auth logout --yes"],async run(t,n){let i=await W(),r=Q(),o=!!r.api_key;if(t.dryRun){if(i)console.log("Would remove ~/.mmx/credentials.json");if(o)console.log("Would clear api_key from ~/.mmx/config.json");if(!i&&!o)console.log("No credentials to clear.");console.log("No changes made.");return}if(i)await Qn(),process.stderr.write(`Removed ~/.mmx/credentials.json
|
|
134
|
+
`);if(o)try{let $=r;delete $.api_key,await U($),process.stderr.write(`Cleared api_key from ~/.mmx/config.json
|
|
135
135
|
`)}catch{}if(!i&&!o)process.stderr.write(`No credentials to clear.
|
|
136
|
-
`)}});async function*
|
|
137
|
-
`);r=
|
|
138
|
-
${w}`:w;break;case"event":m.event=w;break;case"id":m.id=w;break}}}if(r.trim()&&r.includes("data:")){let o=r.indexOf(":");if(o!==-1)yield{data:r.slice(o+1).trimStart()}}}finally{
|
|
136
|
+
`)}});async function*zt(t){let n=t.body?.getReader();if(!n)return;let i=new TextDecoder,r="";try{while(!0){let{done:o,value:$}=await n.read();if(o)break;r+=i.decode($,{stream:!0});let e=r.split(`
|
|
137
|
+
`);r=e.pop()||"";let m={};for(let u of e){if(u===""){if(m.data!==void 0)yield{data:m.data,event:m.event,id:m.id};m={};continue}if(u.startsWith(":"))continue;let y=u.indexOf(":");if(y===-1)continue;let x=u.slice(0,y),w=u.slice(y+1).trimStart();switch(x){case"data":m.data=m.data!==void 0?`${m.data}
|
|
138
|
+
${w}`:w;break;case"event":m.event=w;break;case"id":m.id=w;break}}}if(r.trim()&&r.includes("data:")){let o=r.indexOf(":");if(o!==-1)yield{data:r.slice(o+1).trimStart()}}}finally{n.releaseLock()}}import{readFileSync as vn}from"fs";async function I(t){if(!J())return;let{defaultValue:n,message:i}=t,o=await(await Promise.resolve().then(() => (Zt(),Vt))).text({message:i,default:n,placeholder:n});if(typeof o==="symbol")return;return o}async function ze(t){if(!J())return;let{message:n}=t,r=await(await Promise.resolve().then(() => (Zt(),Vt))).confirm({message:n});if(typeof r==="symbol")return;return r}function yt(t,n){throw new _(`Missing required argument: --${t}
|
|
139
139
|
Hint: In non-interactive (CI / agent) environments all required flags must be provided.
|
|
140
|
-
In an interactive terminal, run without --${t} and the CLI will prompt for it.`,
|
|
141
|
-
`),process.exit(1);o=[{role:"user",content:x}]}else
|
|
142
|
-
`);else if(
|
|
140
|
+
In an interactive terminal, run without --${t} and the CLI will prompt for it.`,c.USAGE,n)}function vo(t){let n=[],i;if(t.system)i=t.system;if(t.messagesFile){let r=t.messagesFile,o=r==="-"?vn("/dev/stdin","utf-8"):vn(r,"utf-8"),$=JSON.parse(o);for(let e of $)if(e.role==="system")i=typeof e.content==="string"?e.content:"";else n.push(e)}if(!t.message&&t.prompt)t.message=Array.isArray(t.prompt)?t.prompt:[t.prompt];if(t.message){let r=new Set(["system","user","assistant"]),o=t.message;for(let $ of o){let e=$.indexOf(":"),m=e!==-1?$.slice(0,e):"";if(r.has(m)){let u=$.slice(e+1);if(m==="system")i=u;else n.push({role:m,content:u})}else n.push({role:"user",content:$})}}return{system:i,messages:n}}function Ro(t){return t.filter((n)=>n.type==="text").map((n)=>n.text).join("")}var We=M({name:"text chat",description:"Send a chat completion (MiniMax Messages API)",apiDocs:"/docs/api-reference/text-post",usage:"mmx text chat --message <text> [flags]",options:[{flag:"--model <model>",description:"Model ID (default: MiniMax-M2.7)"},{flag:"--message <text>",description:"Message text (repeatable, prefix role: to set role)",required:!0,type:"array"},{flag:"--messages-file <path>",description:"JSON file with messages array (use - for stdin)"},{flag:"--system <text>",description:"System prompt"},{flag:"--max-tokens <n>",description:"Maximum tokens to generate (default: 4096)",type:"number"},{flag:"--temperature <n>",description:"Sampling temperature (0.0, 1.0]",type:"number"},{flag:"--top-p <n>",description:"Nucleus sampling threshold",type:"number"},{flag:"--stream",description:"Stream response tokens (default: on in TTY)"},{flag:"--tool <json-or-path>",description:"Tool definition as JSON or file path (repeatable)",type:"array"}],examples:['mmx text chat --message "What is MiniMax?"','mmx text chat --model MiniMax-M2.7-highspeed --system "You are a coding assistant." --message "Write fizzbuzz in Python"','mmx text chat --message "Hello" --message "assistant:Hi!" --message "How are you?"',"cat conversation.json | mmx text chat --messages-file - --stream",'mmx text chat --message "Hello" --output json'],async run(t,n){let{system:i,messages:r}=vo(n),o=r;if(o.length===0)if(J({nonInteractive:t.nonInteractive})){let x=await I({message:"Enter your message:"});if(!x)process.stderr.write(`Chat cancelled.
|
|
141
|
+
`),process.exit(1);o=[{role:"user",content:x}]}else yt("message","mmx text chat --message <text>");let $=n.model||t.defaultTextModel||"MiniMax-M2.7",e=n.stream===!0||n.stream===void 0&&process.stdout.isTTY,m=j(t.output),u={model:$,messages:o,max_tokens:n.maxTokens??4096,stream:e};if(i)u.system=i;if(n.temperature!==void 0)u.temperature=n.temperature;if(n.topP!==void 0)u.top_p=n.topP;if(n.tool){let x=n.tool.map((w)=>{try{return JSON.parse(w)}catch{try{let b=vn(w,"utf-8");return JSON.parse(b)}catch{throw new _(`Invalid tool definition: "${w}" is neither valid JSON nor a readable file.`,c.USAGE)}}});u.tools=x}if(t.dryRun){console.log(k({request:u},m));return}let y=dn(t.baseUrl);if(e){let x=await C(t,{url:y,method:"POST",body:u,stream:!0,authStyle:"x-api-key"}),w=x.headers.get("content-type")||"";if(!w.includes("text/event-stream")&&!w.includes("stream"))throw new _(`Expected SSE stream but got content-type "${w}". Server may be experiencing issues.`,c.GENERAL);let b="",h=!1,v=t.noColor?"":"\x1B[2m",R=t.noColor?"":"\x1B[0m",A=process.stdout.isTTY?process.stdout:process.stderr,l=process.stdout;for await(let Y of zt(x)){if(Y.data==="[DONE]")break;try{let T=JSON.parse(Y.data);if(T.type==="content_block_start"){if(T.content_block.type==="thinking")h=!0,A.write(`${v}Thinking:
|
|
142
|
+
`);else if(T.content_block.type==="text"&&h)A.write(`${R}
|
|
143
143
|
|
|
144
144
|
Response:
|
|
145
|
-
`),
|
|
146
|
-
${
|
|
147
|
-
`)}}if(
|
|
148
|
-
`),m==="json")console.log(
|
|
149
|
-
`);if(
|
|
150
|
-
${Y(
|
|
151
|
-
${
|
|
145
|
+
`),h=!1}else if(T.type==="content_block_delta"){if(T.delta.type==="text_delta")b+=T.delta.text,l.write(T.delta.text);else if(T.delta.type==="thinking_delta")A.write(T.delta.thinking)}}catch(T){process.stderr.write(`
|
|
146
|
+
${v}[warning] Failed to parse stream chunk: ${T instanceof Error?T.message:String(T)}${R}
|
|
147
|
+
`)}}if(h)A.write(R);if(l.write(`
|
|
148
|
+
`),m==="json")console.log(k({content:b},m))}else{let x=await q(t,{url:y,method:"POST",body:u,authStyle:"x-api-key"}),w=Ro(x.content);if(t.quiet||m==="text")console.log(w);else console.log(k(x,m))}}});import{writeFileSync as ko}from"fs";function ct(t,n,i,r){if(n){let o=t.data.audio;if(!o)throw new _("API response missing audio data (audio field is empty).",c.GENERAL);if(!/^[0-9a-fA-F]*$/.test(o))throw new _("API returned invalid audio data (not valid hex).",c.GENERAL);if(o.length%2!==0)throw new _("API returned truncated audio data (odd-length hex string).",c.GENERAL);try{ko(n,Buffer.from(o,"hex"))}catch($){if($.code==="ENOSPC")throw new _("Disk full — cannot write audio file.",c.GENERAL,"Free up disk space and try again.");throw $}if(r)console.log(n);else console.log(k({saved:n,duration_ms:t.extra_info?.audio_length,size_bytes:t.extra_info?.audio_size,sample_rate:t.extra_info?.audio_sample_rate},i))}else{let o=t.data.audio_url??t.data.audio;if(r)console.log(o);else console.log(k({url:o,duration_ms:t.extra_info?.audio_length,size_bytes:t.extra_info?.audio_size},i))}}Wt();import{writeFileSync as So}from"fs";var Rn=M({name:"speech synthesize",description:"Synchronous TTS, up to 10k chars (speech-2.8-hd / 2.6 / 02)",apiDocs:"/docs/api-reference/speech-t2a-http",usage:"mmx speech synthesize --text <text> [--out <path>] [flags]",options:[{flag:"--model <model>",description:"Model ID (default: speech-2.8-hd)"},{flag:"--text <text>",description:"Text to synthesize"},{flag:"--text-file <path>",description:"Read text from file (use - for stdin)"},{flag:"--voice <id>",description:"Voice ID (default: English_expressive_narrator)"},{flag:"--speed <n>",description:"Speech speed multiplier",type:"number"},{flag:"--volume <n>",description:"Volume level",type:"number"},{flag:"--pitch <n>",description:"Pitch adjustment",type:"number"},{flag:"--format <fmt>",description:"Audio format (default: mp3)"},{flag:"--sample-rate <hz>",description:"Sample rate (default: 32000)",type:"number"},{flag:"--bitrate <bps>",description:"Bitrate (default: 128000)",type:"number"},{flag:"--channels <n>",description:"Audio channels (default: 1)",type:"number"},{flag:"--language <code>",description:"Language boost"},{flag:"--subtitles",description:"Include subtitle timing data"},{flag:"--pronunciation <from/to>",description:"Custom pronunciation (repeatable)",type:"array"},{flag:"--out <path>",description:"Save audio to file (uses hex decoding)"},{flag:"--stream",description:"Stream raw audio to stdout"}],examples:['mmx speech synthesize --text "Hello, world!"','mmx speech synthesize --text "Hello, world!" --out hello.mp3','mmx speech synthesize --text "Hello" --subtitles --out hello.mp3','echo "Breaking news." | mmx speech synthesize --text-file - --out news.mp3','mmx speech synthesize --text "Stream" --stream | mpv --no-terminal -'],async run(t,n){let i=n.text??n._positional?.[0];if(n.textFile)i=st(n.textFile);if(!i)throw new _("--text or --text-file is required.",c.USAGE,'mmx speech synthesize --text "Hello" --out hello.mp3');let r=n.model||t.defaultSpeechModel||"speech-2.8-hd",o=n.voice||"English_expressive_narrator",$=new Date().toISOString().slice(0,19).replace(/[T:]/g,"-"),e=n.format||"mp3",m=n.out??`speech_${$}.${e}`,u="hex",y=j(t.output),x={model:r,text:i,voice_setting:{voice_id:o,speed:n.speed??void 0,vol:n.volume??void 0,pitch:n.pitch??void 0},audio_setting:{format:n.format||"mp3",sample_rate:n.sampleRate??32000,bitrate:n.bitrate??128000,channel:n.channels??1},output_format:u,stream:n.stream===!0};if(n.language)x.language_boost=n.language;if(n.subtitles)x.subtitle_enable=!0;if(n.pronunciation)x.pronunciation_dict=n.pronunciation.map((h)=>{let[v,R]=h.split("/");return{tone:R||v,text:v}});if(t.dryRun){console.log(k({request:x},y));return}let w=Pn(t.baseUrl);if(n.stream){let h=await C(t,{url:w,method:"POST",body:x,stream:!0});for await(let v of zt(h)){if(!v.data||v.data==="[DONE]")break;let S=JSON.parse(v.data)?.data?.audio;if(S)process.stdout.write(Buffer.from(S,"hex"))}return}let b=await q(t,{url:w,method:"POST",body:x});if(!t.quiet)process.stderr.write(`[Model: ${r}]
|
|
149
|
+
`);if(ct(b,m,y,t.quiet),n.subtitles&&b.data.subtitle_file)try{let h=await fetch(b.data.subtitle_file);if(!h.ok)throw new _(`Failed to download subtitle file: ${h.status}`,c.GENERAL);let v=await h.json();if(v?.length){let R=m.replace(/\.[^.]+$/,"")+".srt",S=v.map((A,l)=>{let Y=(T)=>{let G=String(Math.floor(T/3600000)).padStart(2,"0"),V=String(Math.floor(T%3600000/60000)).padStart(2,"0"),d=String(Math.floor(T%60000/1000)).padStart(2,"0"),P=String(Math.round(T%1000)).padStart(3,"0");return`${G}:${V}:${d},${P}`};return`${l+1}
|
|
150
|
+
${Y(A.time_begin)} --> ${Y(A.time_end)}
|
|
151
|
+
${A.text}`}).join(`
|
|
152
152
|
|
|
153
|
-
`);if(
|
|
154
|
-
`)}else if(
|
|
155
|
-
`)}}});function
|
|
156
|
-
`)}}}}function
|
|
157
|
-
`)}}}async function
|
|
158
|
-
|
|
159
|
-
`);let
|
|
160
|
-
|
|
161
|
-
`)
|
|
162
|
-
`),process.exit(1);i=
|
|
163
|
-
`);if(
|
|
164
|
-
`);
|
|
165
|
-
`)
|
|
166
|
-
`);
|
|
167
|
-
`)
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
`)}
|
|
173
|
-
`)
|
|
153
|
+
`);if(So(R,S,"utf-8"),!t.quiet)console.log(k({subtitles:R},y));else console.log(R)}}catch(h){if(!t.quiet)process.stderr.write(`Warning: failed to download subtitles: ${h.message}
|
|
154
|
+
`)}else if(n.subtitles&&!b.data.subtitle_file){if(!t.quiet)process.stderr.write(`Warning: subtitles requested but not returned by API
|
|
155
|
+
`)}}});function Ao(t){let n=t.match(/^(.+?)_[A-Z]/);return n?n[1]:t}function jo(t,n){let i=n.toLowerCase();return t.filter((r)=>{let o=Ao(r.voice_id).toLowerCase();return o===i||o.startsWith(i+"_")||o.startsWith(i+" (")})}var He=M({name:"speech voices",description:"List available system voices",usage:"mmx speech voices [--language <lang>]",options:[{flag:"--language <lang>",description:"Filter voices by language (e.g. english, korean, japanese)"}],examples:["mmx speech voices","mmx speech voices --language english","mmx speech voices --language korean","mmx speech voices --output json"],async run(t,n){let i=j(t.output);if(t.dryRun){console.log(k({request:{voice_type:"system"}},i));return}let o=(await q(t,{url:Cn(t.baseUrl),method:"POST",body:{voice_type:"system"}})).system_voice??[],$=n.language;if($){let e=jo(o,$);if(i!=="text"){console.log(k(e,i));return}for(let m of e){let u=m.description?.join("; ")||"",y=m.voice_name?` (${m.voice_name})`:"";if(console.log(` ${m.voice_id}${y}`),u)console.log(` ${u}`)}}else{if(i!=="text"){console.log(k(o.map((e)=>e.voice_id),i));return}for(let e of o)console.log(e.voice_id)}}});import{createWriteStream as Go,unlinkSync as qo}from"fs";var Ue=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];function Ie(t){let n=process.stderr.isTTY,i=0,r=null,o=t;return{start(){if(!n)return;r=setInterval(()=>{process.stderr.write(`\r${Ue[i%Ue.length]} ${o}`),i++},80)},update($){o=$},stop($){if(r)clearInterval(r),r=null;if(n){if(process.stderr.write("\r\x1B[K"),$)process.stderr.write(`${$}
|
|
156
|
+
`)}}}}function de(t,n=""){let i=process.stderr.isTTY,r=30;return{update(o){if(!i)return;let $=Math.min(1,o/t),e=Math.round(30*$),m=30-e,u="█".repeat(e)+"░".repeat(m),y=`${Math.round($*100)}%`;process.stderr.write(`\r${n} ${u} ${y}`)},finish(){if(i)process.stderr.write(`
|
|
157
|
+
`)}}}async function D(t,n,i){let r=t.startsWith("http://")?t.replace("http://","https://"):t,o=i?.retries??3,$=i?.retryDelayMs??1000,e;for(let m=0;m<=o;m++)try{if(m>0){let R=$*Math.pow(2,m-1);if(!i?.quiet)process.stderr.write(`
|
|
158
|
+
Retry ${m}/${o} in ${R}ms...
|
|
159
|
+
`);await new Promise((S)=>setTimeout(S,R))}let u=await fetch(r);if(!u.ok)throw new _(`Download failed: HTTP ${u.status}`,c.GENERAL);let y=Number(u.headers.get("content-length")||0),x=u.body?.getReader();if(!x)throw new _("No response body",c.GENERAL);let w=Go(n),b=y>0&&!i?.quiet?de(y,"Downloading"):null,h=0,v=!1;try{let R=new Promise((S,A)=>{w.on("error",A)});while(!0){let{done:S,value:A}=await Promise.race([x.read(),R]);if(S)break;if(!w.write(A))await new Promise((Y)=>w.once("drain",Y));h+=A.byteLength,b?.update(h)}v=!0}finally{if(x.releaseLock(),b?.finish(),await new Promise((R,S)=>{w.on("finish",R),w.on("error",S),w.end()}),!v)try{qo(n)}catch{}}return{size:h}}catch(u){if(e=u instanceof Error?u:Error(String(u)),!i?.quiet)process.stderr.write(`
|
|
160
|
+
Download attempt ${m+1} failed: ${e.message}
|
|
161
|
+
`)}throw new _(`Download failed after ${o+1} attempts: ${e?.message}`,c.NETWORK,"Check your network connection and proxy settings.")}function Kt(t){if(t<1024)return`${t} B`;if(t<1048576)return`${(t/1024).toFixed(1)} KB`;if(t<1073741824)return`${(t/1048576).toFixed(1)} MB`;return`${(t/1073741824).toFixed(1)} GB`}import{mkdirSync as Pe,existsSync as vt,readFileSync as To,writeFileSync as Ce}from"fs";import{dirname as Bo,join as Le,resolve as kn,extname as No}from"path";var lo={".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png",".webp":"image/webp"},ae=M({name:"image generate",description:"Generate images (image-01 / image-01-live)",apiDocs:"/docs/api-reference/image-generation-t2i",usage:"mmx image generate --prompt <text> [flags]",options:[{flag:"--prompt <text>",description:"Image description",required:!0},{flag:"--aspect-ratio <ratio>",description:"Aspect ratio (e.g. 16:9, 1:1). Ignored if --width and --height are both specified."},{flag:"--n <count>",description:"Number of images to generate (default: 1)",type:"number"},{flag:"--seed <n>",description:"Random seed for reproducible generation (same seed + prompt = identical output)",type:"number"},{flag:"--width <px>",description:"Custom width in pixels. Range [512, 2048], must be multiple of 8. Only effective for image-01 model. Overrides --aspect-ratio if set.",type:"number"},{flag:"--height <px>",description:"Custom height in pixels. Range [512, 2048], must be multiple of 8. Only effective for image-01 model. Overrides --aspect-ratio if set.",type:"number"},{flag:"--prompt-optimizer",description:"Automatically optimize the prompt before generation for better results."},{flag:"--aigc-watermark",description:"Embed AI-generated content watermark in the output image."},{flag:"--subject-ref <params>",description:"Subject reference for character consistency. Format: type=character,image=path-or-url"},{flag:"--out <path>",description:"Save image to exact file path (single image only)"},{flag:"--response-format <format>",description:"Response format: url (download), base64 (embed). Default: url"},{flag:"--out-dir <dir>",description:"Download images to directory"},{flag:"--out-prefix <prefix>",description:"Filename prefix (default: image)"}],examples:['mmx image generate --prompt "A cat in a spacesuit on Mars" --aspect-ratio 16:9','mmx image generate --prompt "Logo design" --n 3 --out-dir ./generated/','mmx image generate --prompt "Mountain landscape" --quiet',"# Reproducible output with seed",'mmx image generate --prompt "A castle" --seed 42',"# Custom dimensions (must be 512–2048, multiple of 8)",'mmx image generate --prompt "Wide landscape" --width 1920 --height 1080',"# Optimized prompt with watermark",'mmx image generate --prompt "sunset" --prompt-optimizer --aigc-watermark',"# Save to exact path",'mmx image generate --prompt "A cat" --out /tmp/cat.jpg',"# Base64 response (bypasses CDN, useful when image URLs are unreachable)",'mmx image generate --prompt "A cat" --response-format base64'],async run(t,n){let i=n.prompt??n._positional?.[0];if(!i)if(J({nonInteractive:t.nonInteractive})){let b=await I({message:"Enter your image prompt:"});if(!b)process.stderr.write(`Image generation cancelled.
|
|
162
|
+
`),process.exit(1);i=b}else yt("prompt","mmx image generate --prompt <text>");let{width:r,height:o}=n;if(r!==void 0&&o===void 0)throw new _("--width requires --height. Both must be specified together.",c.USAGE);if(o!==void 0&&r===void 0)throw new _("--height requires --width. Both must be specified together.",c.USAGE);if(r!==void 0&&o!==void 0){let b=(h,v)=>{if(v<512||v>2048)throw new _(`--${h} must be between 512 and 2048, got ${v}.`,c.USAGE);if(v%8!==0)throw new _(`--${h} must be a multiple of 8, got ${v}.`,c.USAGE)};b("width",r),b("height",o)}let $=n.out;if($&&n.n>1)throw new _("--out cannot be used with --n > 1. Use --out-dir instead.",c.USAGE);let e=n.responseFormat||"url",m={model:"image-01",prompt:i,aspect_ratio:r!==void 0&&o!==void 0?void 0:n.aspectRatio||void 0,n:n.n??1,seed:n.seed,width:r,height:o,prompt_optimizer:n.promptOptimizer===!0||void 0,aigc_watermark:n.aigcWatermark===!0||void 0,response_format:e};if(n.subjectRef){let b=n.subjectRef,h=Object.fromEntries(b.split(",").map((R)=>{let S=R.indexOf("=");if(S===-1)return[R,""];return[R.slice(0,S),R.slice(S+1)]})),v={type:h.type||"character"};if(h.image)if(h.image.startsWith("http"))v.image_url=h.image;else{let R=kn(h.image),S=To(R),A=No(R).toLowerCase(),l=lo[A]||"image/jpeg";v.image_file=`data:${l};base64,${S.toString("base64")}`}m.subject_reference=[v]}let u=j(t.output);if(t.dryRun){console.log(k({request:m},u));return}let y=Ln(t.baseUrl),x=await q(t,{url:y,method:"POST",body:m});if(!t.quiet)process.stderr.write(`[Model: image-01]
|
|
163
|
+
`);let w=[];if($){let b=Bo(kn($));if(!vt(b))Pe(b,{recursive:!0});let h=kn($);if(vt(h))process.stderr.write(`Warning: overwriting existing file: ${h}
|
|
164
|
+
`);if(e==="base64"){let v=(x.data.image_base64||[])[0];if(v)Ce(h,v,"base64")}else{let v=(x.data.image_urls||[])[0];if(v)await D(v,h,{quiet:t.quiet})}w.push(h)}else{let b=n.outDir??".";if(!vt(b))Pe(b,{recursive:!0});let h=n.outPrefix||"image";if(e==="base64"){let v=x.data.image_base64||[];for(let R=0;R<v.length;R++){let S=`${h}_${String(R+1).padStart(3,"0")}.jpg`,A=Le(b,S);if(vt(A))process.stderr.write(`Warning: overwriting existing file: ${A}
|
|
165
|
+
`);Ce(A,v[R],"base64"),w.push(A)}}else{let v=x.data.image_urls||[];for(let R=0;R<v.length;R++){let S=`${h}_${String(R+1).padStart(3,"0")}.jpg`,A=Le(b,S);if(vt(A))process.stderr.write(`Warning: overwriting existing file: ${A}
|
|
166
|
+
`);await D(v[R],A,{quiet:t.quiet}),w.push(A)}}}if(u==="json")console.log(k({id:x.data.task_id,saved:w,success_count:x.data.success_count,failed_count:x.data.failed_count},u));else if(t.quiet)console.log(w.join(`
|
|
167
|
+
`));else console.log(k({id:x.data.task_id,saved:w,success_count:x.data.success_count,failed_count:x.data.failed_count},u))}});async function Ee(t,n){let i=Date.now()+n.timeoutSec*1000,r=Ie("Polling...");if(!t.quiet)r.start();try{while(Date.now()<i){let o=await q(t,{url:n.url});if(n.getStatus&&!t.quiet)r.update(`Status: ${n.getStatus(o)}`);if(n.isComplete(o))return r.stop("Done."),o;if(n.isFailed(o)){r.stop("Failed.");let $=n.getStatus?n.getStatus(o):"failed",e=o?.base_resp?` (${o.base_resp.status_msg})`:"";throw new _(`Task ${$}.${e}`,c.GENERAL,"Check the MiniMax dashboard or --verbose output for details.")}await new Promise(($)=>setTimeout($,n.intervalSec*1000))}}finally{r.stop()}throw new _("Polling timed out.",c.TIMEOUT,"Try increasing --timeout or check task status manually.")}import{readFileSync as Mn}from"fs";import{extname as Sn}from"path";var An={".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png",".webp":"image/webp"},Fe=M({name:"video generate",description:`Generate a video
|
|
168
|
+
T2V: Hailuo-2.3
|
|
169
|
+
I2V: Hailuo-2.3 (default) / Hailuo-2.3-Fast (fast mode, requires --first-frame)
|
|
170
|
+
SEF: Hailuo-02 (requires --first-frame and --last-frame)
|
|
171
|
+
S2V: S2V-01 (requires --subject-image)`,apiDocs:"/docs/api-reference/video-generation",usage:"mmx video generate --prompt <text> [flags]",options:[{flag:"--model <model>",description:"Model ID. T2V: MiniMax-Hailuo-2.3; I2V: MiniMax-Hailuo-2.3 (default) or MiniMax-Hailuo-2.3-Fast (fast, requires --first-frame). Auto-switched to Hailuo-02 with --last-frame, or S2V-01 with --subject-image."},{flag:"--prompt <text>",description:"Video description",required:!0},{flag:"--first-frame <path-or-url>",description:"First frame image (local path or URL). Auto base64-encoded for local files."},{flag:"--last-frame <path-or-url>",description:"Last frame image (local path or URL). Enables SEF (start-end frame) interpolation mode with Hailuo-02 model. Requires --first-frame."},{flag:"--subject-image <path-or-url>",description:"Subject reference image for character consistency (local path or URL). Switches to S2V-01 model."},{flag:"--callback-url <url>",description:"Webhook URL for completion notification"},{flag:"--download <path>",description:"Save video to file on completion"},{flag:"--no-wait",description:"Return task ID immediately without waiting"},{flag:"--async",description:"Return task ID immediately (agent/CI mode, same as --no-wait but explicit)"},{flag:"--poll-interval <seconds>",description:"Polling interval when waiting (default: 5)",type:"number"}],examples:['mmx video generate --prompt "A man reads a book. Static shot."','mmx video generate --prompt "Ocean waves at sunset." --download sunset.mp4','mmx video generate --prompt "A robot painting." --async --quiet','mmx video generate --prompt "A robot painting." --no-wait --quiet',"# SEF: first + last frame interpolation (uses Hailuo-02 model)",'mmx video generate --prompt "Walk forward" --first-frame start.jpg --last-frame end.jpg',"# Subject reference: character consistency (uses S2V-01 model)",'mmx video generate --prompt "A detective walking" --subject-image character.jpg'],async run(t,n){let i=n.prompt;if(!i)if(J({nonInteractive:t.nonInteractive})){let G=await I({message:"Enter your video prompt:"});if(!G)process.stderr.write(`Video generation cancelled.
|
|
172
|
+
`),process.exit(1);i=G}else yt("prompt","mmx video generate --prompt <text>");if(n.lastFrame&&n.subjectImage)throw new _("--last-frame and --subject-image cannot be used together (SEF and S2V are different modes).",c.USAGE,"mmx video generate --prompt <text> --first-frame <path> --last-frame <path>");let r=n.model;if(r==="MiniMax-Hailuo-2.3-Fast"&&!n.firstFrame)throw new _("MiniMax-Hailuo-2.3-Fast only supports I2V (image-to-video). Use --first-frame to provide an input image.",c.USAGE,"mmx video generate --prompt <text> --model MiniMax-Hailuo-2.3-Fast --first-frame <image>");let o;if(r)o=r;else if(n.lastFrame)o="MiniMax-Hailuo-02";else if(n.subjectImage)o="S2V-01";else o=t.defaultVideoModel||"MiniMax-Hailuo-2.3";let $=j(t.output),e={model:o,prompt:i};if(n.firstFrame){let G=n.firstFrame;if(G.startsWith("http"))e.first_frame_image=G;else{let V=Mn(G),d=Sn(G).toLowerCase(),P=An[d]||"image/jpeg";e.first_frame_image=`data:${P};base64,${V.toString("base64")}`}}if(n.lastFrame){if(!n.firstFrame)throw new _("--last-frame requires --first-frame (SEF mode).",c.USAGE,"mmx video generate --prompt <text> --first-frame <path> --last-frame <path>");let G=n.lastFrame;if(G.startsWith("http"))e.last_frame_image=G;else{let V=Mn(G),d=Sn(G).toLowerCase(),P=An[d]||"image/jpeg";e.last_frame_image=`data:${P};base64,${V.toString("base64")}`}}if(n.subjectImage){let G=n.subjectImage,V;if(G.startsWith("http"))V=G;else{let d=Mn(G),P=Sn(G).toLowerCase();V=`data:${An[P]||"image/jpeg"};base64,${d.toString("base64")}`}e.subject_reference=[{type:"character",image:[V]}]}if(n.callbackUrl)e.callback_url=n.callbackUrl;if(t.dryRun){console.log(k({request:e},$));return}let m=an(t.baseUrl),y=(await q(t,{url:m,method:"POST",body:e})).task_id;if(!t.quiet)process.stderr.write(`[Model: ${o}]
|
|
173
|
+
`);if(n.noWait||t.async){process.stdout.write(JSON.stringify({taskId:y})),process.stdout.write(`
|
|
174
|
+
`);return}let x=n.pollInterval??5,w=Gt(t.baseUrl,y),b=await Ee(t,{url:w,intervalSec:x,timeoutSec:t.timeout,isComplete:(G)=>G.status==="Success",isFailed:(G)=>G.status==="Failed",getStatus:(G)=>G.status});if(!b.file_id)throw new _("Task completed but no file_id returned.",c.GENERAL);let v=(await q(t,{url:qt(t.baseUrl,b.file_id)})).file?.download_url;if(!v)throw new _("No download URL available for this file.",c.GENERAL);if(n.download){let G=n.download,{size:V}=await D(v,G,{quiet:t.quiet});if(t.quiet)console.log(G);else console.log(k({task_id:y,status:"Success",file_id:b.file_id,saved:G,size:Kt(V)},$));return}let R=await import("os"),{join:S}=await import("path"),A=S(R.tmpdir(),"mmx-video"),{existsSync:l,mkdirSync:Y}=await import("fs");if(!l(A))Y(A,{recursive:!0});let T=S(A,`${y}.mp4`);await D(v,T,{quiet:t.quiet}),process.stdout.write(T),process.stdout.write(`
|
|
175
|
+
`)}});var fe=M({name:"video task get",description:"Query video task status",usage:"mmx video task get --task-id <id>",options:[{flag:"--task-id <id>",description:"Video generation task ID"}],examples:["mmx video task get --task-id 106916112212032","mmx video task get --task-id 106916112212032 --output json"],async run(t,n){let i=n.taskId;if(!i)throw new _("--task-id is required.",c.USAGE,"mmx video task get --task-id <id>");if(t.dryRun){console.log(`Would query task: ${i}`);return}let r=Gt(t.baseUrl,i),o=await q(t,{url:r}),$=j(t.output);if(t.quiet){console.log(o.status);return}console.log(k({task_id:o.task_id,status:o.status,file_id:o.file_id,video_width:o.video_width,video_height:o.video_height},$))}});var ge=M({name:"video download",description:"Download a completed video by file ID",usage:"mmx video download --file-id <id> --out <path>",options:[{flag:"--file-id <id>",description:"File ID to download"},{flag:"--out <path>",description:"Output file path"}],examples:["mmx video download --file-id 176844028768320 --out video.mp4","mmx video download --file-id 176844028768320 --out video.mp4 --quiet"],async run(t,n){let i=n.fileId;if(!i)throw new _("--file-id is required.",c.USAGE,"mmx video download --file-id <id> --out <path>");let r=n.out;if(!r)throw new _("--out is required.",c.USAGE,"mmx video download --file-id <id> --out video.mp4");if(t.dryRun){console.log(`Would download file ${i} to ${r}`);return}let o=qt(t.baseUrl,i),e=(await q(t,{url:o})).file?.download_url;if(!e)throw new _("No download URL available for this file.",c.GENERAL,"The file may still be processing. Check task status first.");let{size:m}=await D(e,r,{quiet:t.quiet}),u=j(t.output);if(t.quiet){console.log(r);return}console.log(k({saved:r,size:Kt(m)},u))}});Wt();function De(t){return(t.apiKey??t.fileApiKey??"").startsWith("sk-cp-")}function ti(t){if(t.defaultMusicModel)return t.defaultMusicModel;return De(t)?"music-2.6":"music-2.6-free"}var Jo=new Set(["music-cover","music-cover-free"]);function ni(t){if(t.defaultMusicModel&&Jo.has(t.defaultMusicModel))return t.defaultMusicModel;return De(t)?"music-cover":"music-cover-free"}var ei=M({name:"music generate",description:"Generate a song (music-2.6 / music-2.6-free / music-2.5+ / music-2.5)",apiDocs:"/docs/api-reference/music-generation",usage:"mmx music generate --prompt <text> (--lyrics <text> | --instrumental | --lyrics-optimizer) [--out <path>] [flags]",options:[{flag:"--prompt <text>",description:'Music style description (e.g. "cinematic orchestral, building tension"). Max 2000 chars when combined with structured flags.'},{flag:"--lyrics <text>",description:"Song lyrics with structure tags (newline separated). Supported: [Intro], [Verse], [Pre Chorus], [Chorus], [Interlude], [Bridge], [Outro], [Post Chorus], [Transition], [Break], [Hook], [Build Up], [Inst], [Solo]. Tags must be clean — no descriptions inside brackets (they will be sung). Max 3500 chars."},{flag:"--lyrics-file <path>",description:"Read lyrics from file (use - for stdin). Same tag rules as --lyrics."},{flag:"--lyrics-optimizer",description:"Auto-generate lyrics from prompt (cannot be used with --lyrics or --instrumental)"},{flag:"--instrumental",description:"Generate instrumental music (no vocals). music-2.6/music-2.5+: native is_instrumental flag; music-2.5: lyrics workaround. Cannot be used with --lyrics."},{flag:"--vocals <text>",description:'Vocal style, e.g. "warm male baritone", "bright female soprano", "duet with harmonies"'},{flag:"--genre <text>",description:"Music genre, e.g. folk, pop, jazz, electronic"},{flag:"--mood <text>",description:"Mood or emotion, e.g. warm, melancholic, uplifting"},{flag:"--instruments <text>",description:'Instruments to feature, e.g. "acoustic guitar, piano, strings"'},{flag:"--tempo <text>",description:"Tempo description, e.g. fast, slow, moderate"},{flag:"--bpm <number>",description:"Exact tempo in beats per minute",type:"number"},{flag:"--key <text>",description:"Musical key, e.g. C major, A minor, G sharp"},{flag:"--avoid <text>",description:"Elements to avoid in the generated music"},{flag:"--use-case <text>",description:'Use case context, e.g. "background music for video", "theme song"'},{flag:"--structure <text>",description:'Song structure, e.g. "verse-chorus-verse-bridge-chorus"'},{flag:"--references <text>",description:'Reference tracks or artists, e.g. "similar to Ed Sheeran"'},{flag:"--extra <text>",description:"Additional fine-grained requirements not covered above"},{flag:"--model <model>",description:"Model: music-2.6 (recommended), music-2.6-free (default, unlimited), music-2.5+, or music-2.5."},{flag:"--output-format <fmt>",description:"Return format: hex (default, saved to file) or url (24h expiry, download promptly). When --stream, only hex."},{flag:"--aigc-watermark",description:"Embed AI-generated content watermark in audio for content provenance"},{flag:"--format <fmt>",description:"Audio format (default: mp3)"},{flag:"--sample-rate <hz>",description:"Sample rate (default: 44100)",type:"number"},{flag:"--bitrate <bps>",description:"Bitrate (default: 256000)",type:"number"},{flag:"--stream",description:"Stream raw audio to stdout"},{flag:"--out <path>",description:"Save audio to file (uses hex decoding)"}],examples:['mmx music generate --prompt "Upbeat pop" --lyrics "La la la..." --out summer.mp3','mmx music generate --prompt "Indie folk, melancholic" --lyrics-file song.txt --out my_song.mp3',"# Auto-generate lyrics from prompt:",'mmx music generate --prompt "Upbeat pop about summer" --lyrics-optimizer --out summer.mp3',"# Instrumental:",'mmx music generate --prompt "Cinematic orchestral, building tension" --instrumental --out bgm.mp3',"# URL output (24h expiry — download promptly):",'mmx music generate --prompt "Upbeat pop" --lyrics "La la la..." --output-format url',"# Instrumental with music-2.5+:",'mmx music generate --prompt "Cinematic orchestral" --model "music-2.5+" --instrumental --out bgm.mp3',"# Detailed prompt with vocal characteristics:",'mmx music generate --prompt "Warm morning folk" --vocals "male and female duet, harmonies in chorus" --instruments "acoustic guitar, piano" --bpm 95 --lyrics-file song.txt --out duet.mp3'],async run(t,n){let{prompt:i,lyrics:r}=n,o=n.instrumental===!0,$=n.lyricsOptimizer===!0;if(n.lyricsFile)r=st(n.lyricsFile);if(o&&(r||n.lyricsFile))throw new _("Cannot use --instrumental with --lyrics or --lyrics-file.",c.USAGE,"mmx music generate --prompt <style> --instrumental");if($&&(r||o))throw new _("Cannot use --lyrics-optimizer with --lyrics, --lyrics-file, or --instrumental.",c.USAGE,"mmx music generate --prompt <text> --lyrics-optimizer");if(!i&&!r&&!o&&!$)throw new _("At least one of --prompt or --lyrics is required.",c.USAGE,"mmx music generate --prompt <text> --lyrics <text>");if(!o&&!$&&!r?.trim())throw new _("Lyrics are required. Add --lyrics or --lyrics-file, or use --instrumental for pure music, or --lyrics-optimizer to auto-generate.",c.USAGE,"mmx music generate --prompt <text> --lyrics <text>");let e=[];if(n.vocals)e.push(`Vocals: ${n.vocals}`);if(n.genre)e.push(`Genre: ${n.genre}`);if(n.mood)e.push(`Mood: ${n.mood}`);if(n.instruments)e.push(`Instruments: ${n.instruments}`);if(n.tempo)e.push(`Tempo: ${n.tempo}`);if(n.bpm)e.push(`BPM: ${n.bpm}`);if(n.key)e.push(`Key: ${n.key}`);if(n.avoid)e.push(`Avoid: ${n.avoid}`);if(n.useCase)e.push(`Use case: ${n.useCase}`);if(n.structure)e.push(`Structure: ${n.structure}`);if(n.references)e.push(`References: ${n.references}`);if(n.extra)e.push(`Extra: ${n.extra}`);if(e.length>0){let A=e.join(". ");i=i?`${i}. ${A}`:A}let m=new Date().toISOString().slice(0,19).replace(/[T:]/g,"-"),u=n.format||"mp3",y=n.out??`music_${m}.${u}`,x=j(t.output),w=n.model||ti(t),b=["music-2.6","music-2.6-free","music-2.5+","music-2.5"];if(n.model&&!b.includes(w))throw new _(`Invalid model "${w}". Valid models: ${b.join(", ")}`,c.USAGE,"mmx music generate --model music-2.6");let h=n.outputFormat||"hex";if(h!=="hex"&&h!=="url")throw new _('--output-format must be "hex" or "url".',c.USAGE,"mmx music generate --output-format url");if(n.stream&&h==="url")throw new _("--stream and --output-format url cannot be used together. Streaming requires hex format.",c.USAGE,"mmx music generate --output-format url");let v={model:w,prompt:i,lyrics:r,is_instrumental:o||void 0,lyrics_optimizer:$||void 0,audio_setting:{format:n.format||"mp3",sample_rate:n.sampleRate??44100,bitrate:n.bitrate??256000},output_format:n.stream===!0?"hex":h,stream:n.stream===!0};if(n.aigcWatermark)v.aigc_watermark=!0;if(t.dryRun){console.log(k({request:v},x));return}let R=Tt(t.baseUrl);if(n.stream){let l=(await C(t,{url:R,method:"POST",body:v,stream:!0})).body?.getReader();if(!l)throw new _("No response body",c.GENERAL);while(!0){let{done:Y,value:T}=await l.read();if(Y)break;process.stdout.write(T)}l.releaseLock();return}let S=await q(t,{url:R,method:"POST",body:v});if(!t.quiet)process.stderr.write(`[Model: ${w}]
|
|
176
|
+
`);if(h==="url"){if(S.data?.audio_url)console.log(S.data.audio_url);else throw new _("Requested URL output but API did not return audio_url.",c.GENERAL);return}ct(S,y,x,t.quiet)}});import{readFileSync as Xo}from"fs";var ii=M({name:"music cover",description:"Generate a cover version of a song based on reference audio (music-cover / music-cover-free)",apiDocs:"/docs/api-reference/music-generation",usage:"mmx music cover --prompt <text> (--audio <url> | --audio-file <path>) [--lyrics <text>] [--out <path>] [flags]",options:[{flag:"--model <model>",description:"Model: music-cover (Token Plan), music-cover-free (Pay-as-you-go, default). Override only if needed."},{flag:"--prompt <text>",description:'Target cover style, e.g. "Indie folk, acoustic guitar, warm male vocal"'},{flag:"--audio <url>",description:"URL of the reference audio (mp3, wav, flac, etc. — 6s to 6min, max 50MB)"},{flag:"--audio-file <path>",description:"Local reference audio file (auto base64-encoded)"},{flag:"--lyrics <text>",description:"Cover lyrics. If omitted, extracted from reference audio via ASR."},{flag:"--lyrics-file <path>",description:"Read lyrics from file (use - for stdin)"},{flag:"--seed <number>",description:"Random seed 0–1000000 for reproducible results",type:"number"},{flag:"--format <fmt>",description:"Audio format: mp3, wav, pcm (default: mp3)"},{flag:"--sample-rate <hz>",description:"Sample rate: 16000, 24000, 32000, 44100 (default: 44100)",type:"number"},{flag:"--bitrate <bps>",description:"Bitrate: 32000, 64000, 128000, 256000 (default: 256000)",type:"number"},{flag:"--channel <n>",description:"Channels: 1 (mono) or 2 (stereo, default)",type:"number"},{flag:"--stream",description:"Stream raw audio to stdout"},{flag:"--out <path>",description:"Save audio to file"}],examples:['mmx music cover --prompt "Indie folk, acoustic guitar, warm male vocal" --audio https://example.com/song.mp3 --out cover.mp3','mmx music cover --prompt "Jazz, piano, slow" --audio-file original.mp3 --lyrics-file lyrics.txt --out jazz_cover.mp3','mmx music cover --prompt "Pop, upbeat" --audio https://example.com/ref.mp3 --seed 42 --out reproducible.mp3'],async run(t,n){let{prompt:i,audio:r,audioFile:o}=n;if(!i)throw new _("--prompt is required.",c.USAGE,"mmx music cover --prompt <text> --audio <url>");if(!r&&!o)throw new _("One of --audio <url> or --audio-file <path> is required.",c.USAGE,"mmx music cover --prompt <text> --audio <url>");if(r&&o)throw new _("Use either --audio or --audio-file, not both.",c.USAGE);let $=n.lyrics;if(n.lyricsFile){let{readTextFromPathOrStdin:R}=await Promise.resolve().then(() => (Wt(),Ke));$=R(n.lyricsFile)}let e=new Date().toISOString().slice(0,19).replace(/[T:]/g,"-"),m=n.format||"mp3",u=n.out??`cover_${e}.${m}`,y=j(t.output),x=n.model||ni(t),w=["music-cover","music-cover-free"];if(n.model&&!w.includes(x))throw new _(`Invalid model "${x}". Valid models: ${w.join(", ")}`,c.USAGE,"mmx music cover --model music-cover");let b={model:x,prompt:i,lyrics:$,seed:n.seed,audio_setting:{format:m,sample_rate:n.sampleRate??44100,bitrate:n.bitrate??256000,channel:n.channel??void 0},output_format:"hex",stream:n.stream===!0};if(r)b.audio_url=r;else b.audio_base64=Xo(o).toString("base64");if(t.dryRun){console.log(k({request:b},y));return}let h=Tt(t.baseUrl);if(n.stream){let S=(await C(t,{url:h,method:"POST",body:b,stream:!0})).body?.getReader();if(!S)throw new _("No response body",c.GENERAL);while(!0){let{done:A,value:l}=await S.read();if(A)break;process.stdout.write(l)}S.releaseLock();return}let v=await q(t,{url:h,method:"POST",body:b});if(!t.quiet)process.stderr.write(`[Model: ${x}]
|
|
177
|
+
`);ct(v,u,y,t.quiet)}});var jn=M({name:"search query",description:"Search the web via MiniMax",usage:"mmx search query --q <query>",options:[{flag:"--q <query>",description:"Search query string"}],examples:['mmx search query --q "MiniMax AI"','mmx search query --q "latest news" --output json'],async run(t,n){let i=n.q??n.query??n._positional?.[0];if(!i)throw new _("--q is required.",c.USAGE,'mmx search query --q "your search query"');let r=j(t.output);if(t.dryRun){console.log(k({request:{q:i}},r));return}let o=En(t.baseUrl),$=await q(t,{url:o,method:"POST",body:{q:i}}),e=$.organic||[];if(r!=="text"){console.log(k($,r));return}if(t.quiet){for(let m of e)console.log(`${m.title} ${m.link}`);return}if(e.length===0){console.log("No results found.");return}for(let m of e){if(console.log(`${m.title}`),console.log(` ${m.link}`),m.snippet)console.log(` ${m.snippet}`);if(m.date)console.log(` ${m.date}`);console.log("")}}});import{readFileSync as Qo,existsSync as Oo}from"fs";import{extname as Yo}from"path";var Vo={".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png",".webp":"image/webp"},Zo=52428800;async function zo(t){if(t.startsWith("data:"))return t;if(t.startsWith("http://")||t.startsWith("https://")){let o=await fetch(t);if(!o.ok)throw new _(`Failed to download image: HTTP ${o.status}`,c.GENERAL);let e=(o.headers.get("content-type")||"image/jpeg").split(";")[0].trim(),m=await o.arrayBuffer();if(m.byteLength>Zo)throw new _(`Image too large (${(m.byteLength/1024/1024).toFixed(1)} MB). Maximum is 50 MB.`,c.USAGE);let u=Buffer.from(m).toString("base64");return`data:${e};base64,${u}`}if(!Oo(t))throw new _(`File not found: ${t}`,c.USAGE);let n=Yo(t).toLowerCase(),i=Vo[n];if(!i)throw new _(`Unsupported image format "${n}". Supported: jpg, jpeg, png, webp`,c.USAGE);let r=Qo(t);return`data:${i};base64,${r.toString("base64")}`}var ri=M({name:"vision describe",description:"Describe an image using MiniMax VLM",usage:"mmx vision describe (--image <path-or-url> | --file-id <id>) [--prompt <text>]",options:[{flag:"--image <path-or-url>",description:"Local image path or URL (base64 encoded automatically)"},{flag:"--file-id <id>",description:"Pre-uploaded file ID (skips base64 conversion)"},{flag:"--prompt <text>",description:'Question about the image (default: "Describe the image.")'}],examples:["mmx vision describe --image photo.jpg",'mmx vision describe --image https://example.com/photo.jpg --prompt "What breed is this dog?"','mmx vision describe --file-id file-123456789 --prompt "Extract the text"'],async run(t,n){let i=n.image??n.file??n.path??n._positional?.[0],r=n.fileId,o=n.prompt||"Describe the image.";if(!i&&!r)if(J({nonInteractive:t.nonInteractive})){let y=await I({message:"Enter image path, URL, or File ID:"});if(!y)process.stderr.write(`Vision describe cancelled.
|
|
178
|
+
`),process.exit(1);if(!y.includes(".")&&!y.startsWith("http"))r=y;else i=y}else throw new _("Missing required argument. Must provide either --image or --file-id.",c.USAGE,"mmx vision describe --image <path> OR --file-id <id>");else if(i&&r)throw new _("Conflicting arguments: cannot provide both --image and --file-id.",c.USAGE);let $=j(t.output);if(t.dryRun){process.stdout.write(k({request:{prompt:o,image:i,fileId:r}},$)+`
|
|
179
|
+
`);return}let e=Fn(t.baseUrl),m={prompt:o};if(r)m.file_id=r;else if(i){let y=await zo(i);m.image_url=y}let u=await q(t,{url:e,method:"POST",body:m});if($!=="text"){process.stdout.write(k(u,$)+`
|
|
180
|
+
`);return}process.stdout.write(u.content+`
|
|
181
|
+
`)}});var oi=M({name:"quota show",description:"Display Token Plan usage and remaining quotas",usage:"mmx quota show",examples:["mmx quota show","mmx quota show --output json"],async run(t,n){if(t.dryRun){console.log("Would fetch quota information.");return}let i=nt(t.baseUrl),r=await q(t,{url:i}),o=r.model_remains||[],$=j(n.output);if($!=="text"){console.log(k(r,$));return}if(t.quiet){for(let e of o){let m=e.current_interval_total_count-e.current_interval_usage_count;console.log(`${e.model_name} ${e.current_interval_usage_count} ${e.current_interval_total_count} ${m}`)}return}pt(o,t)}});var $i=M({name:"config show",description:"Display current configuration",usage:"mmx config show",examples:["mmx config show","mmx config show --output json"],async run(t,n){let i=Q(),r=j(t.output),o={region:t.region,base_url:t.baseUrl,output:t.output,timeout:t.timeout,config_file:a()};if(i.api_key)o.api_key=K(i.api_key);if(i.default_text_model)o.default_text_model=i.default_text_model;if(i.default_speech_model)o.default_speech_model=i.default_speech_model;if(i.default_video_model)o.default_video_model=i.default_video_model;if(i.default_music_model)o.default_music_model=i.default_music_model;console.log(k(o,r))}});var mi=["region","base_url","output","timeout","api_key","default_text_model","default_speech_model","default_video_model","default_music_model"],Wo={"default-text-model":"default_text_model","default-speech-model":"default_speech_model","default-video-model":"default_video_model","default-music-model":"default_music_model"},pi=M({name:"config set",description:"Set a config value",usage:"mmx config set --key <key> --value <value>",options:[{flag:"--key <key>",description:"Config key (region, base_url, output, timeout, api_key, default_text_model, default_speech_model, default_video_model, default_music_model)"},{flag:"--value <value>",description:"Value to set"}],examples:["mmx config set --key output --value json","mmx config set --key timeout --value 600","mmx config set --key base_url --value https://api-uw.minimax.io"],async run(t,n){let i=n._positional,r=n.key??i?.[0],o=n.value??i?.[1];if(!r||o===void 0)throw new _("--key and --value are required.",c.USAGE,"mmx config set --key <key> --value <value>");let $=Wo[r]||r;if(!mi.includes($))throw new _(`Invalid config key "${r}". Valid keys: ${mi.join(", ")}`,c.USAGE);if($==="region"&&!["global","cn"].includes(o))throw new _(`Invalid region "${o}". Valid values: global, cn`,c.USAGE);if($==="output"&&!["text","json"].includes(o))throw new _(`Invalid output format "${o}". Valid values: text, json`,c.USAGE);if($==="timeout"){let u=Number(o);if(isNaN(u)||u<=0)throw new _(`Invalid timeout "${o}". Must be a positive number.`,c.USAGE)}let e=j(t.output);if(t.dryRun){console.log(k({would_set:{[$]:o}},e));return}let m=Q();if(m[$]=$==="timeout"?Number(o):o,$==="api_key")delete m.region;if(await U(m),!t.quiet)console.log(k({[$]:m[$]},e))}});function Ko(t){let n=t.match(/^--([a-zA-Z0-9-]+)/),i=n?n[1]:"",r=i.replace(/-([a-zA-Z0-9])/g,(e,m)=>m.toUpperCase()),o="string",$=!1;if(!t.includes("<")&&!t.includes("["))o="boolean";else if(t.includes("<n>")||t.includes("<hz>")||t.includes("<bps>")||t.includes("<count>"))o="number";if(t.toLowerCase().includes("repeatable"))$=!0;return{name:r,kebabName:i,inferredType:o,isArray:$}}function Gn(t){let i={name:`mmx_${t.name.replace(/ /g,"_")}`,description:t.description,input_schema:{type:"object",properties:{},required:[]}};if(t.options)for(let r of t.options){let{name:o,inferredType:$,isArray:e}=Ko(r.flag);if(!o)continue;let m=r.type,u=e?"array":m??$,y={description:r.description};if(u==="array")y.type="array",y.items={type:"string"};else y.type=u;let x=i.input_schema;if(x.properties[o]=y,r.required)x.required.push(o)}return i}var Ho=["auth ","config ","update"],ui=M({name:"config export-schema",description:"Export all (or one) CLI command(s) as Anthropic/OpenAI-compatible JSON tool schemas",usage:'mmx config export-schema [--command "<name>"]',options:[{flag:"--command <name>",description:'Export schema for a specific command only (e.g. "image generate")'}],examples:["mmx config export-schema",'mmx config export-schema --command "video generate"'],async run(t,n){let i=n.command;if(i){try{let{command:$}=tt.resolve(i.split(" ")),e=Gn($);process.stdout.write(JSON.stringify(e,null,2)+`
|
|
182
|
+
`)}catch{throw new _(`Command "${i}" not found.`,c.USAGE)}return}let o=tt.getAllCommands().filter(($)=>!Ho.some((e)=>$.name.startsWith(e))).map(($)=>Gn($));process.stdout.write(JSON.stringify(o,null,2)+`
|
|
183
|
+
`)}});var Uo="1.0.12",yi=M({name:"update",description:"Update mmx to the latest version",usage:"mmx update",examples:["mmx update"],async run(){process.stderr.write(`Current version: ${Uo}
|
|
174
184
|
|
|
175
185
|
`),process.stderr.write(`Run:
|
|
176
186
|
`),process.stderr.write(` npm update -g mmx-cli
|
|
177
187
|
|
|
178
|
-
`)}});var
|
|
188
|
+
`)}});var Io=[{command:"mmx text chat",title:"Text Generation (Chat Completion)",path:"/docs/api-reference/text-post"},{command:"mmx speech synthesize",title:"Speech T2A (Text-to-Audio)",path:"/docs/api-reference/speech-t2a-http"},{command:"mmx image generate",title:"Image Generation (T2I / I2I)",path:"/docs/api-reference/image-generation-t2i"},{command:"mmx video generate",title:"Video Generation (T2V / I2V / S2V)",path:"/docs/api-reference/video-generation"},{command:"mmx music generate",title:"Music Generation",path:"/docs/api-reference/music-generation"},{command:"mmx music cover",title:"Music Cover (via Music Generation)",path:"/docs/api-reference/music-generation"},{command:"mmx search query",title:"Web Search",path:"/docs/api-reference/web-search"},{command:"mmx vision describe",title:"Vision (Image Understanding)",path:"/docs/api-reference/vision"}],ci=M({name:"help",description:"Show MiniMax API documentation links",usage:"mmx help",async run(t,n){let i=xt[t.region]||xt.global;process.stdout.write(`
|
|
179
189
|
MiniMax API Documentation Links
|
|
180
190
|
|
|
181
191
|
Official docs: ${i}/docs/api-reference
|
|
182
192
|
|
|
183
|
-
`);for(let r of
|
|
193
|
+
`);for(let r of Io)process.stdout.write(` ${r.command.padEnd(30)} ${r.title}
|
|
184
194
|
`),process.stdout.write(` ${" ".repeat(30)} ${i}${r.path}
|
|
185
195
|
|
|
186
|
-
`)}});class
|
|
187
|
-
`);throw new
|
|
196
|
+
`)}});class _i{root={children:new Map};constructor(t){for(let[n,i]of Object.entries(t))this.register(n,i)}register(t,n){let i=t.split(" "),r=this.root;for(let o of i){if(!r.children.has(o))r.children.set(o,{children:new Map});r=r.children.get(o)}r.command=n}getAllCommands(){let t=[],n=(i)=>{if(i.command)t.push(i.command);for(let r of i.children.values())n(r)};return n(this.root),t}resolve(t){let n=this.root,i=[];for(let r of t){let o=n.children.get(r);if(!o)break;n=o,i.push(r)}if(n.command)return{command:n.command,extra:t.slice(i.length)};if(i.length>0&&n.children.size===1){let[,r]=n.children.entries().next().value;if(r.command)return{command:r.command,extra:t.slice(i.length)}}if(i.length>0&&n.children.size>0){let r=Array.from(n.children.entries()).map(([o,$])=>{if($.command)return` ${i.join(" ")} ${o} ${$.command.description}`;let e=Array.from($.children.keys()).join(", ");return` ${i.join(" ")} ${o} [${e}]`}).join(`
|
|
197
|
+
`);throw new _(`Unknown command: mmx ${t.join(" ")}
|
|
188
198
|
|
|
189
199
|
Available commands:
|
|
190
|
-
${r}`,
|
|
191
|
-
${this.bold("Usage:",
|
|
200
|
+
${r}`,c.USAGE,`mmx ${i.join(" ")} --help`)}throw new _(`Unknown command: mmx ${t.join(" ")}`,c.USAGE,"mmx --help")}bold=(t,n)=>n.isTTY?`\x1B[1m${t}\x1B[0m`:t;accent=(t,n)=>n.isTTY?`\x1B[38;2;248;103;58m${t}\x1B[0m`:t;dim=(t,n)=>n.isTTY?`\x1B[2m${t}\x1B[0m`:t;printHelp(t,n=process.stdout,i="global"){if(t.length===0){this.printRootHelp(n);return}let r=this.root;for(let $ of t){let e=r.children.get($);if(!e){this.printRootHelp(n);return}r=e}if(r.command){this.printCommandHelp(r.command,n,i);return}let o=t.join(" ");n.write(`
|
|
201
|
+
${this.bold("Usage:",n)} mmx ${o} <command> [flags]
|
|
192
202
|
|
|
193
|
-
`),
|
|
194
|
-
`),this.printChildren(r,o,
|
|
195
|
-
`)}printRootHelp(t){let
|
|
196
|
-
`);for(let
|
|
197
|
-
`)}else t.write(e
|
|
198
|
-
`);let r=(
|
|
203
|
+
`),n.write(`${this.bold("Commands:",n)}
|
|
204
|
+
`),this.printChildren(r,o,n),n.write(`
|
|
205
|
+
`)}printRootHelp(t){let n=["███╗ ███╗███╗ ███╗██╗ ██╗","████╗ ████║████╗ ████║╚██╗██╔╝","██╔████╔██║██╔████╔██║ ╚███╔╝ ","██║╚██╔╝██║██║╚██╔╝██║ ██╔██╗ ","██║ ╚═╝ ██║██║ ╚═╝ ██║██╔╝ ██╗","╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝"],i=[[240,23,122],[242,43,106],[244,63,90],[246,83,74],[248,103,58],[250,123,42]];t.write(`
|
|
206
|
+
`);for(let e=0;e<n.length;e++)if(t.isTTY){let[m,u,y]=i[e];t.write(`\x1B[1;38;2;${m};${u};${y}m${n[e]}\x1B[0m
|
|
207
|
+
`)}else t.write(n[e]+`
|
|
208
|
+
`);let r=(e)=>this.bold(e,t),o=(e)=>this.accent(e,t),$=(e)=>this.dim(e,t);t.write(`
|
|
199
209
|
${r("Usage:")} mmx <resource> <command> [flags]
|
|
200
210
|
|
|
201
211
|
${r("Resources:")}
|
|
@@ -228,22 +238,22 @@ ${r("Global Flags:")}
|
|
|
228
238
|
${r("Getting Help:")}
|
|
229
239
|
${$("Add --help after any command to see its full list of options, defaults,")}
|
|
230
240
|
${$("and usage examples. For example:")} mmx text chat --help
|
|
231
|
-
`)}printCommandHelp(t,
|
|
241
|
+
`)}printCommandHelp(t,n,i="global"){let r=(e)=>this.bold(e,n),o=(e)=>this.accent(e,n),$=(e)=>this.dim(e,n);if(n.write(`
|
|
232
242
|
${t.description}
|
|
233
|
-
`),t.usage)
|
|
234
|
-
`);if(t.options&&t.options.length>0){let
|
|
243
|
+
`),t.usage)n.write(`${r("Usage:")} ${t.usage}
|
|
244
|
+
`);if(t.options&&t.options.length>0){let e=Math.max(...t.options.map((m)=>m.flag.length));n.write(`
|
|
235
245
|
${r("Options:")}
|
|
236
|
-
`);for(let m of t.options)
|
|
237
|
-
`)}if(t.examples&&t.examples.length>0){
|
|
246
|
+
`);for(let m of t.options)n.write(` ${o(m.flag.padEnd(e+2))} ${$(m.description)}
|
|
247
|
+
`)}if(t.examples&&t.examples.length>0){n.write(`
|
|
238
248
|
${r("Examples:")}
|
|
239
|
-
`);for(let
|
|
240
|
-
`)}if(t.apiDocs)
|
|
249
|
+
`);for(let e of t.examples)n.write(` ${$(e)}
|
|
250
|
+
`)}if(t.apiDocs)n.write(`
|
|
241
251
|
${r("API Reference:")} ${$(xt[i]+t.apiDocs)}
|
|
242
|
-
`);
|
|
252
|
+
`);n.write(`
|
|
243
253
|
${$("Global flags (--api-key, --output, --quiet, etc.) are always available.")}
|
|
244
|
-
`),
|
|
245
|
-
`)}printChildren(t,
|
|
246
|
-
`)}}var
|
|
254
|
+
`),n.write(`${$("Run")} mmx --help ${$("for the full list.")}
|
|
255
|
+
`)}printChildren(t,n,i){let r=[],o=(e,m)=>{for(let[u,y]of e.children){if(y.command)r.push({fullName:`${m} ${u}`,description:y.command.description});if(y.children.size>0)o(y,`${m} ${u}`)}};o(t,n);let $=Math.max(...r.map((e)=>e.fullName.length));for(let{fullName:e,description:m}of r)i.write(` ${this.accent(e.padEnd($),i)} ${this.dim(m,i)}
|
|
256
|
+
`)}}var tt=new _i({"auth login":Oe,"auth status":Ye,"auth refresh":Ve,"auth logout":Ze,"text chat":We,"speech synthesize":Rn,"speech generate":Rn,"speech voices":He,"image generate":ae,"video generate":Fe,"video task get":fe,"video download":ge,"music generate":ei,"music cover":ii,"search query":jn,"search web":jn,"vision describe":ri,"quota show":oi,"config show":$i,"config set":pi,"config export-schema":ui,update:yi,help:ci});function ot(t){if(t instanceof _){if(j(process.env.MINIMAX_OUTPUT)==="json")process.stderr.write(JSON.stringify(t.toJSON(),null,2)+`
|
|
247
257
|
`);else{if(process.stderr.write(`
|
|
248
258
|
Error: ${t.message}
|
|
249
259
|
`),t.hint)process.stderr.write(`
|
|
@@ -251,29 +261,29 @@ Error: ${t.message}
|
|
|
251
261
|
`).join(`
|
|
252
262
|
`)}
|
|
253
263
|
`);process.stderr.write(` (exit code ${t.exitCode})
|
|
254
|
-
`)}process.exit(t.exitCode)}if(t instanceof Error){if(t.name==="AbortError"||t.name==="TimeoutError"||t.message.includes("timed out")){let o=new
|
|
264
|
+
`)}process.exit(t.exitCode)}if(t instanceof Error){if(t.name==="AbortError"||t.name==="TimeoutError"||t.message.includes("timed out")){let o=new _("Request timed out.",c.TIMEOUT,`Try increasing --timeout (e.g. --timeout 60).
|
|
255
265
|
If this happens on every request with a valid API key, you may be hitting the wrong region.
|
|
256
266
|
`+`Run: mmx auth status — to check your credentials and region.
|
|
257
|
-
`+"Run: mmx config set region global (or cn) — to override the region.");return ot(o)}if(t instanceof TypeError&&t.message==="fetch failed"){let o=new
|
|
267
|
+
`+"Run: mmx config set region global (or cn) — to override the region.");return ot(o)}if(t instanceof TypeError&&t.message==="fetch failed"){let o=new _("Network request failed.",c.NETWORK,"Check your network connection and proxy settings. Also verify MINIMAX_BASE_URL is a valid URL.");return ot(o)}let n=t.message.toLowerCase();if(n.includes("failed to fetch")||n.includes("connection refused")||n.includes("econnrefused")||n.includes("connection reset")||n.includes("econnreset")||n.includes("network error")||n.includes("enotfound")||n.includes("getaddrinfo")||n.includes("proxy")||n.includes("socket")||n.includes("etimedout")||n.includes("timeout")||n.includes("eai_AGAIN")){let o="Check your network connection and proxy settings.";if(n.includes("proxy"))o="Proxy error — check HTTP_PROXY / HTTPS_PROXY environment variables and proxy authentication.";let $=new _("Network request failed.",c.NETWORK,o);return ot($)}let r=t.code;if(r==="ENOENT"||r==="EACCES"||r==="ENOSPC"||r==="ENOTDIR"||r==="EISDIR"||r==="EPERM"||r==="EBUSY"){let o="Check the file path and permissions.";if(r==="ENOENT")o="File or directory not found.";if(r==="EACCES"||r==="EPERM")o="Permission denied — check file or directory permissions.";if(r==="ENOSPC")o="Disk full — free up space and try again.";let $=new _(`File system error: ${t.message}`,c.GENERAL,o);return ot($)}else if(typeof r==="string"&&r.startsWith("E")){let o=new _(`File system error: ${t.message}`,c.GENERAL,"Check the file path and permissions.");return ot(o)}if(process.stderr.write(`
|
|
258
268
|
Error: ${t.message}
|
|
259
269
|
`),process.env.MINIMAX_VERBOSE==="1")process.stderr.write(`${t.stack}
|
|
260
270
|
`)}else process.stderr.write(`
|
|
261
271
|
Error: ${String(t)}
|
|
262
|
-
`);process.exit(
|
|
272
|
+
`);process.exit(c.GENERAL)}var Po="/v1/token_plan/remains";function Co(t){return L[t]+Po}async function Lo(t,n,i){let r=[{Authorization:`Bearer ${n}`},{"x-api-key":n}];for(let o of r)try{let $=await fetch(Co(t),{headers:{...o,"Content-Type":"application/json"},signal:AbortSignal.timeout(i)});if(!$.ok)continue;if((await $.json()).base_resp?.status_code===0)return!0}catch{}return!1}async function xi(t){process.stderr.write("Detecting region...");let n=Object.keys(L),r=(await Promise.all(n.map(async($)=>({region:$,ok:await Lo($,t,5000)})))).find(($)=>$.ok);if(!r)return process.stderr.write(` failed
|
|
263
273
|
`),process.stderr.write(`Warning: API key failed validation against all regions (global, cn).
|
|
264
274
|
This usually means the API key is invalid or the network is blocking requests.
|
|
265
275
|
Falling back to 'global'. Subsequent requests may fail.
|
|
266
276
|
Run 'mmx auth status' to verify your credentials.
|
|
267
277
|
`),"global";let o=r.region;return process.stderr.write(` ${o}
|
|
268
|
-
`),o}async function
|
|
269
|
-
Pass directly: --api-key sk-xxxxx`);let $=await
|
|
270
|
-
`)}var
|
|
278
|
+
`),o}async function wi(t){let n=Q();n.region=t,await U(n)}import{join as ao}from"path";import{readFileSync as Eo,writeFileSync as Fo}from"fs";var hi=()=>ao(wt(),"update-state.json"),fo=86400000,go=3000,Do="MiniMax-AI-Dev/minimax-cli";function t$(){try{let t=Eo(hi(),"utf-8");return JSON.parse(t)}catch{return null}}function n$(t){try{Fo(hi(),JSON.stringify(t))}catch{}}async function e$(){try{let t=await fetch(`https://api.github.com/repos/${Do}/releases/latest`,{headers:{Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28"},signal:AbortSignal.timeout(go)});if(!t.ok)return null;return(await t.json()).tag_name??null}catch{return null}}var qn=null;function bi(){return qn}async function si(t){if(process.env.CI||!process.stderr.isTTY)return;let n=t$(),i=Date.now();if(n&&i-n.lastChecked<fo){if(n.latestVersion&&n.latestVersion!==`v${t}`)qn=n.latestVersion;return}let r=await e$();if(!r)return;if(n$({lastChecked:i,latestVersion:r}),r!==`v${t}`)qn=r}async function vi(t){if(t.apiKey||t.fileApiKey)return;let n=process.env.MINIMAX_API_KEY,i;if(n){if(!J({nonInteractive:t.nonInteractive}))i=n;else if(await ze({message:`Found MINIMAX_API_KEY in environment (${K(n)}). Save it to config file?`}))i=n}if(!i){if(!J({nonInteractive:t.nonInteractive}))throw new _("No API key found.",c.AUTH,`Set env var: export MINIMAX_API_KEY=sk-xxxxx
|
|
279
|
+
Pass directly: --api-key sk-xxxxx`);let $=await I({message:"Enter your MiniMax API key:"});if(!$)throw new _("API key is required.",c.AUTH);i=$}let r={...Q(),api_key:i};await U(r),t.fileApiKey=i;let o=t.configPath??"~/.mmx/config.json";process.stderr.write(`API key saved to ${o}
|
|
280
|
+
`)}var Ri="1.0.12";process.on("SIGINT",()=>{process.stderr.write(`
|
|
271
281
|
Interrupted. Exiting.
|
|
272
|
-
`),process.exit(130)});process.stdout.on("error",(t)=>{if(t.code==="EPIPE")process.exit(0);else throw t});var
|
|
282
|
+
`),process.exit(130)});process.stdout.on("error",(t)=>{if(t.code==="EPIPE")process.exit(0);else throw t});var i$=[["auth","login"],["auth","logout"],["config","show"],["config","set"],["config","export-schema"],["update"]];async function r$(){let t=process.argv.slice(2);if(t.includes("--version")||t.includes("-v"))console.log(`mmx ${Ri}`),process.exit(0);let n=ln(t,Mt);if(t.includes("--help")||t.includes("-h")){let y=t.indexOf("--region"),x=y>=0&&t[y+1]||process.env.MINIMAX_REGION||Q().region||"global";tt.printHelp(n,process.stderr,x),process.exit(0)}if(n.length===0){tt.printHelp([],process.stderr);let{command:y}=tt.resolve(["quota","show"]),x=Pt(t,[...Mt,...y.options??[]]),w=ft(x),b=!!(w.apiKey||w.fileApiKey),h=!!await W();if(b||h)await y.execute(w,x);else process.stderr.write(` Not logged in.
|
|
273
283
|
`),process.stderr.write(` mmx auth login --api-key sk-xxxxx
|
|
274
284
|
|
|
275
|
-
`);process.exit(0)}let{command:i,extra:r}=
|
|
276
|
-
Update available: ${
|
|
285
|
+
`);process.exit(0)}let{command:i,extra:r}=tt.resolve(n),o=Pt(t,[...Mt,...i.options??[]]);if(r.length>0)o._positional=r;let $=ft(o);if(!i$.some((y)=>y.every((x,w)=>n[w]===x)))await vi($);if($.needsRegionDetection){let y=$.apiKey||$.fileApiKey;if(y){let x=await xi(y);$.region=x,$.baseUrl=L[x],$.needsRegionDetection=!1,await wi(x)}}let m=si(Ri).catch(()=>{});await i.execute($,o),await m;let u=bi();if(u&&!$.quiet)process.stderr.write(`
|
|
286
|
+
Update available: ${u}
|
|
277
287
|
`),process.stderr.write(` npm update -g mmx-cli
|
|
278
288
|
|
|
279
|
-
`)}
|
|
289
|
+
`)}r$().catch(ot);
|