mmx-cli 1.0.18 → 1.0.19
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 +12 -0
- package/dist/index.d.ts +73 -10
- package/dist/mmx.mjs +262 -261
- package/dist/sdk.mjs +252 -12
- package/package.json +1 -1
package/dist/mmx.mjs
CHANGED
|
@@ -1,113 +1,113 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{createRequire as
|
|
3
|
-
`)}if(typeof t==="object")return
|
|
4
|
-
`)}function
|
|
5
|
-
`)}function
|
|
6
|
-
`);return{}}}async function
|
|
7
|
-
`,{mode:384}),
|
|
2
|
+
import{createRequire as Wo}from"node:module";var To=Object.create;var{getPrototypeOf:Jo,defineProperty:Je,getOwnPropertyNames:Xo}=Object;var Yo=Object.prototype.hasOwnProperty;function Qo(t){return this[t]}var zo,Zo,Ft=(t,e,i)=>{var r=t!=null&&typeof t==="object";if(r){var o=e?zo??=new WeakMap:Zo??=new WeakMap,m=o.get(t);if(m)return m}i=t!=null?To(Jo(t)):{};let n=e||!t||!t.__esModule?Je(i,"default",{value:t,enumerable:!0}):i;for(let p of Xo(t))if(!Yo.call(n,p))Je(n,p,{get:Qo.bind(t,p),enumerable:!0});if(r)o.set(t,n);return n};var an=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var No=(t)=>t;function Oo(t,e){this[t]=No.bind(null,e)}var Ct=(t,e)=>{for(var i in e)Je(t,i,{get:e[i],enumerable:!0,configurable:!0,set:Oo.bind(e,i)})};var h=(t,e)=>()=>(t&&(e=t(t=0)),e);var dt=Wo(import.meta.url);var s;var d=h(()=>{s={SUCCESS:0,GENERAL:1,USAGE:2,AUTH:3,QUOTA:4,TIMEOUT:5,NETWORK:6,CONTENT_FILTER:10}});var c;var k=h(()=>{d();c=class c extends Error{exitCode;hint;constructor(t,e=s.GENERAL,i){super(t);this.name="CLIError",this.exitCode=e,this.hint=i}toJSON(){return{error:{code:this.exitCode,message:this.message,...this.hint?{hint:this.hint}:{}}}}}});function Io(t){if(!t||typeof t!=="object"||Array.isArray(t))return;let e=t;if(typeof e.access_token!=="string"||!e.access_token)return;if(typeof e.refresh_token!=="string")return;if(typeof e.expires_at!=="string")return;let i={access_token:e.access_token,refresh_token:e.refresh_token,expires_at:e.expires_at};if(typeof e.region==="string"&&Xn.has(e.region))i.region=e.region;if(typeof e.resource_url==="string"&&e.resource_url.startsWith("http"))i.resource_url=e.resource_url;if(typeof e.account==="string"&&e.account.length>0)i.account=e.account;return i}function Yn(t){if(!t||typeof t!=="object"||Array.isArray(t))return{};let e=t,i={};if(typeof e.api_key==="string")i.api_key=e.api_key;if(typeof e.region==="string"&&Xn.has(e.region))i.region=e.region;if(typeof e.base_url==="string"&&e.base_url.startsWith("http"))i.base_url=e.base_url;if(typeof e.output==="string"&&Po.has(e.output))i.output=e.output;if(typeof e.timeout==="number"&&e.timeout>0)i.timeout=e.timeout;if(typeof e.proxy==="string"&&e.proxy.startsWith("http"))i.proxy=e.proxy;let r=Io(e.oauth);if(r)i.oauth=r;if(typeof e.default_text_model==="string"&&e.default_text_model.length>0)i.default_text_model=e.default_text_model;if(typeof e.default_speech_model==="string"&&e.default_speech_model.length>0)i.default_speech_model=e.default_speech_model;if(typeof e.default_video_model==="string"&&e.default_video_model.length>0)i.default_video_model=e.default_video_model;if(typeof e.default_music_model==="string"&&e.default_music_model.length>0)i.default_music_model=e.default_music_model;return i}var Z,Ot,gt,Xn,Po;var nt=h(()=>{Z={global:"https://api.minimax.io",cn:"https://api.minimaxi.com"},Ot={global:"https://platform.minimax.io",cn:"https://platform.minimaxi.com"},gt={global:"https://account.minimax.io",cn:"https://account.minimaxi.com"},Xn=new Set(["global","cn"]),Po=new Set(["text","json"])});function A(t){return{name:t.name,description:t.description,usage:t.usage,options:t.options,examples:t.examples,apiDocs:t.apiDocs,execute:t.run}}var Dt;var J=h(()=>{Dt=[{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{homedir as Eo}from"os";import{join as Qn}from"path";function te(){if(process.env.MMX_CONFIG_DIR)return process.env.MMX_CONFIG_DIR;return Qn(Eo(),Lo)}function it(){return Qn(te(),"config.json")}async function zn(){let t=te();await(await import("fs/promises")).mkdir(t,{recursive:!0,mode:448})}var Lo=".mmx";var kt=()=>{};var Nn={};Ct(Nn,{formatText:()=>Qe,formatTable:()=>Zn,formatKeyValue:()=>ee});function Qe(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 Zn(t);return t.map(String).join(`
|
|
3
|
+
`)}if(typeof t==="object")return ee(t);return String(t)}function ee(t,e=0){let i=" ".repeat(e),r=[];for(let[o,m]of Object.entries(t)){if(m===null||m===void 0)continue;if(Array.isArray(m)){r.push(`${i}${o}:`);for(let n of m)if(typeof n==="object"&&n!==null)r.push(`${i} - ${ee(n,e+4).trimStart()}`);else r.push(`${i} - ${String(n)}`)}else if(typeof m==="object")r.push(`${i}${o}:`),r.push(ee(m,e+2));else r.push(`${i}${o}: ${String(m)}`)}return r.join(`
|
|
4
|
+
`)}function Zn(t){if(t.length===0)return"(empty)";let e=Object.keys(t[0]),i=e.map((n)=>Math.max(n.length,...t.map((p)=>String(p[n]??"").length))),r=e.map((n,p)=>n.toUpperCase().padEnd(i[p])).join(" "),o=i.map((n)=>"-".repeat(n)).join(" "),m=t.map((n)=>e.map((p,u)=>String(n[p]??"").padEnd(i[u])).join(" "));return[r,o,...m].join(`
|
|
5
|
+
`)}function On(t){return JSON.stringify(t,null,2)}function V(t){if(t==="json"||t==="text")return t;if(!process.stdout.isTTY)return"json";return"text"}function S(t,e){switch(e){case"json":return On(t);case"text":return Qe(t)}}function rt(t,e){if(!t.dryRun)return!1;return console.log(S({request:e},V(t.output))),!0}var Y=()=>{};import{copyFileSync as Fo,existsSync as Co,readFileSync as go,renameSync as Do,unlinkSync as tm,writeFileSync as em}from"fs";function nm(t){return t instanceof Error&&"code"in t&&t.code==="EXDEV"}function im(t,e,i={rename:Do,copy:Fo,unlink:tm}){try{i.rename(t,e)}catch(r){if(!nm(r))throw r;i.copy(t,e),i.unlink(t)}}function Q(){let t=it();if(!Co(t))return{};try{return Yn(JSON.parse(go(t,"utf-8")))}catch(e){let i=e;if(i instanceof SyntaxError||i.message.includes("JSON"))process.stderr.write(`Warning: config file is corrupted. Run 'mmx config set' to reset.
|
|
6
|
+
`);return{}}}async function f(t,e){await zn();let i=it(),r=i+".tmp";em(r,JSON.stringify(t,null,2)+`
|
|
7
|
+
`,{mode:384}),im(r,i,e)}function ze(t){let e=Q(),i=t.apiKey||void 0,r=e.api_key,o=t.region||process.env.MINIMAX_REGION||void 0;if(o&&!(o in Z))throw new c(`Invalid region "${o}". Valid values: ${Object.keys(Z).join(", ")}`,s.USAGE);let m=e.region,n=o||m||"global",p=i||r,u=!o&&(!m||p!==void 0&&p!==e.api_key),x=t.baseUrl||process.env.MINIMAX_BASE_URL||e.base_url||e.oauth?.resource_url||Z[n]||Z.global,y=V(t.output||process.env.MINIMAX_OUTPUT||e.output),w=process.env.MINIMAX_TIMEOUT?Number(process.env.MINIMAX_TIMEOUT):void 0,_=w!==void 0&&Number.isFinite(w)&&w>0?w:void 0,M=t.timeout??_??e.timeout??300;return{apiKey:i,fileApiKey:r,fileRegion:e.region,configPath:it(),region:n,baseUrl:x,output:y,timeout:M,defaultTextModel:e.default_text_model,defaultSpeechModel:e.default_speech_model,defaultVideoModel:e.default_video_model,defaultMusicModel:e.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}}var mt=h(()=>{nt();kt();Y();k();d()});function N(t){if(t?.nonInteractive===!0)return!1;if(process.env.CI)return!1;return process.stdout.isTTY===!0&&process.stdin.isTTY===!0}var Ne=an((bu,Wn)=>{var Ze={to(t,e){if(!e)return`\x1B[${t+1}G`;return`\x1B[${e+1};${t+1}H`},move(t,e){let i="";if(t<0)i+=`\x1B[${-t}D`;else if(t>0)i+=`\x1B[${t}C`;if(e<0)i+=`\x1B[${-e}A`;else if(e>0)i+=`\x1B[${e}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"},rm={up:(t=1)=>"\x1B[S".repeat(t),down:(t=1)=>"\x1B[T".repeat(t)},om={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 e="";for(let i=0;i<t;i++)e+=this.line+(i<t-1?Ze.up():"");if(t)e+=Ze.left;return e}};Wn.exports={cursor:Ze,scroll:rm,erase:om,beep:"\x07"}});var We=an((Su,Oe)=>{var ie=process||{},Hn=ie.argv||[],ne=ie.env||{},mm=!(!!ne.NO_COLOR||Hn.includes("--no-color"))&&(!!ne.FORCE_COLOR||Hn.includes("--color")||ie.platform==="win32"||(ie.stdout||{}).isTTY&&ne.TERM!=="dumb"||!!ne.CI),pm=(t,e,i=t)=>(r)=>{let o=""+r,m=o.indexOf(e,t.length);return~m?t+$m(o,e,i,m)+e:t+o+e},$m=(t,e,i,r)=>{let o="",m=0;do o+=t.substring(m,r)+i,m=r+e.length,r=t.indexOf(e,m);while(~r);return o+t.substring(m)},Kn=(t=mm)=>{let e=t?pm:()=>String;return{isColorSupported:t,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};Oe.exports=Kn();Oe.exports.createColors=Kn});import{stdin as ii,stdout as ri}from"node:process";import*as $t from"node:readline";import ln from"node:readline";import{WriteStream as um}from"node:tty";function sm({onlyFirst:t=!1}={}){let e=["[\\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(e,t?void 0:"g")}function oi(t){if(typeof t!="string")throw TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(cm,"")}function mi(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Wt(t,e={}){if(typeof t!="string"||t.length===0||(e={ambiguousIsNarrow:!0,...e},t=oi(t),t.length===0))return 0;t=t.replace(wm()," ");let i=e.ambiguousIsNarrow?1:2,r=0;for(let o of t){let m=o.codePointAt(0);if(m<=31||m>=127&&m<=159||m>=768&&m<=879)continue;switch(_m.eastAsianWidth(o)){case"F":case"W":r+=2;break;case"A":r+=i;break;default:r+=1}}return r}function hm(){let t=new Map;for(let[e,i]of Object.entries(X)){for(let[r,o]of Object.entries(i))X[r]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},i[r]=X[r],t.set(o[0],o[1]);Object.defineProperty(X,e,{value:i,enumerable:!1})}return Object.defineProperty(X,"codes",{value:t,enumerable:!1}),X.color.close="\x1B[39m",X.bgColor.close="\x1B[49m",X.color.ansi=fn(),X.color.ansi256=Pn(),X.color.ansi16m=In(),X.bgColor.ansi=fn(He),X.bgColor.ansi256=Pn(He),X.bgColor.ansi16m=In(He),Object.defineProperties(X,{rgbToAnsi256:{value:(e,i,r)=>e===i&&i===r?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(i/255*5)+Math.round(r/255*5),enumerable:!1},hexToRgb:{value:(e)=>{let i=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!i)return[0,0,0];let[r]=i;r.length===3&&(r=[...r].map((m)=>m+m).join(""));let o=Number.parseInt(r,16);return[o>>16&255,o>>8&255,o&255]},enumerable:!1},hexToAnsi256:{value:(e)=>X.rgbToAnsi256(...X.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value:(e)=>{if(e<8)return 30+e;if(e<16)return 90+(e-8);let i,r,o;if(e>=232)i=((e-232)*10+8)/255,r=i,o=i;else{e-=16;let p=e%36;i=Math.floor(e/36)/5,r=Math.floor(p/6)/5,o=p%6/5}let m=Math.max(i,r,o)*2;if(m===0)return 30;let n=30+(Math.round(o)<<2|Math.round(r)<<1|Math.round(i));return m===2&&(n+=60),n},enumerable:!1},rgbToAnsi:{value:(e,i,r)=>X.ansi256ToAnsi(X.rgbToAnsi256(e,i,r)),enumerable:!1},hexToAnsi:{value:(e)=>X.ansi256ToAnsi(X.hexToAnsi256(e)),enumerable:!1}}),X}function Fn(t,e,i){return String(t).normalize().replace(/\r\n/g,`
|
|
8
8
|
`).split(`
|
|
9
|
-
`).map((r)=>
|
|
10
|
-
`)}function
|
|
11
|
-
`),r=
|
|
12
|
-
`)
|
|
13
|
-
`),
|
|
14
|
-
`).length-1;this.output.write(
|
|
15
|
-
`);this.output.write(r[i]),this._prevFrame=t,this.output.write(
|
|
9
|
+
`).map((r)=>Bm(r,e,i)).join(`
|
|
10
|
+
`)}function jm(t,e){if(t===e)return;let i=t.split(`
|
|
11
|
+
`),r=e.split(`
|
|
12
|
+
`),o=[];for(let m=0;m<Math.max(i.length,r.length);m++)i[m]!==r[m]&&o.push(m);return o}function me(t){return t===si}function re(t,e){t.isTTY&&t.setRawMode(e)}class ut{constructor({render:t,input:e=ii,output:i=ri,...r},o=!0){F(this,"input"),F(this,"output"),F(this,"rl"),F(this,"opts"),F(this,"_track",!1),F(this,"_render"),F(this,"_cursor",0),F(this,"state","initial"),F(this,"value"),F(this,"error",""),F(this,"subscribers",new Map),F(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=e,this.output=i}prompt(){let t=new um(0);return t._write=(e,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=ln.createInterface({input:this.input,output:t,tabSize:2,prompt:"",escapeCodeTimeout:50}),ln.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),re(this.input,!0),this.output.on("resize",this.render),this.render(),new Promise((e,i)=>{this.once("submit",()=>{this.output.write(l.cursor.show),this.output.off("resize",this.render),re(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(l.cursor.show),this.output.off("resize",this.render),re(this.input,!1),e(si)})})}on(t,e){let i=this.subscribers.get(t)??[];i.push({cb:e}),this.subscribers.set(t,i)}once(t,e){let i=this.subscribers.get(t)??[];i.push({cb:e,once:!0}),this.subscribers.set(t,i)}emit(t,...e){let i=this.subscribers.get(t)??[],r=[];for(let o of i)o.cb(...e),o.once&&r.push(()=>i.splice(i.indexOf(o),1));for(let o of r)o()}unsubscribe(){this.subscribers.clear()}onKeypress(t,e){if(this.state==="error"&&(this.state="active"),e?.name&&!this._track&&Cn.has(e.name)&&this.emit("cursor",Cn.get(e.name)),e?.name&&dm.has(e.name)&&this.emit("cursor",e.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()),e?.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(`
|
|
13
|
+
`),re(this.input,!1),this.rl.close(),this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let t=Fn(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
|
|
14
|
+
`).length-1;this.output.write(l.cursor.move(-999,t*-1))}render(){let t=Fn(this._render(this)??"",process.stdout.columns,{hard:!0});if(t!==this._prevFrame){if(this.state==="initial")this.output.write(l.cursor.hide);else{let e=jm(this._prevFrame,t);if(this.restoreCursor(),e&&e?.length===1){let i=e[0];this.output.write(l.cursor.move(0,i)),this.output.write(l.erase.lines(1));let r=t.split(`
|
|
15
|
+
`);this.output.write(r[i]),this._prevFrame=t,this.output.write(l.cursor.move(0,r.length-i-1));return}else if(e&&e?.length>1){let i=e[0];this.output.write(l.cursor.move(0,i)),this.output.write(l.erase.down());let r=t.split(`
|
|
16
16
|
`).slice(i);this.output.write(r.join(`
|
|
17
|
-
`)),this._prevFrame=t;return}this.output.write(I.erase.down())}this.output.write(t),this.state==="initial"&&(this.state="active"),this._prevFrame=t}}}function ge({input:t=Ie,output:n=Pe,overwrite:i=!0,hideCursor:r=!0}={}){let $=$t.createInterface({input:t,output:n,prompt:"",tabSize:1});$t.emitKeypressEvents(t,$),t.isTTY&&t.setRawMode(!0);let p=(e,{name:m})=>{if(String(e)==="\x03"){r&&n.write(I.cursor.show),process.exit(0);return}if(!i)return;$t.moveCursor(n,m==="return"?0:-1,m==="return"?-1:0,()=>{$t.clearLine(n,1,()=>{t.once("keypress",p)})})};return r&&n.write(I.cursor.hide),t.once("keypress",p),()=>{t.off("keypress",p),r&&n.write(I.cursor.show),t.isTTY&&!Ap&&t.setRawMode(!1),$.terminal=!1,$.close()}}var I,yt,l$,Ee,E$,L$,C$=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},a$,Un=10,Xe=(t=0)=>(n)=>`\x1B[${n+t}m`,Ue=(t=0)=>(n)=>`\x1B[${38+t};5;${n}m`,Qe=(t=0)=>(n,i,r)=>`\x1B[${38+t};2;${n};${i};${r}m`,T,F$,f$,D$,Et,tp=39,Zn="\x07",Le="[",np="]",Ce="m",Tn,Ze=(t)=>`${Et.values().next().value}${Le}${t}${Ce}`,Te=(t)=>`${Et.values().next().value}${Tn}${t}${Zn}`,ep=(t)=>t.split(" ").map((n)=>Qt(n)),Qn=(t,n,i)=>{let r=[...n],$=!1,p=!1,e=Qt(de(t[t.length-1]));for(let[m,u]of r.entries()){let c=Qt(u);if(e+c<=i?t[t.length-1]+=u:(t.push(u),e=0),Et.has(u)&&($=!0,p=r.slice(m+1).join("").startsWith(Tn)),$){p?u===Zn&&($=!1,p=!1):u===Ce&&($=!1);continue}e+=c,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())},ip=(t)=>{let n=t.split(" "),i=n.length;for(;i>0&&!(Qt(n[i-1])>0);)i--;return i===n.length?t:n.slice(0,i).join(" ")+n.slice(i).join("")},rp=(t,n,i={})=>{if(i.trim!==!1&&t.trim()==="")return"";let r="",$,p,e=ep(t),m=[""];for(let[c,_]of t.split(" ").entries()){i.trim!==!1&&(m[m.length-1]=m[m.length-1].trimStart());let w=Qt(m[m.length-1]);if(c!==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[c]>n){let v=n-w,M=1+Math.floor((e[c]-v-1)/n);Math.floor((e[c]-1)/n)<M&&m.push(""),Qn(m,_,n);continue}if(w+e[c]>n&&w>0&&e[c]>0){if(i.wordWrap===!1&&w<n){Qn(m,_,n);continue}m.push("")}if(w+e[c]>n&&i.wordWrap===!1){Qn(m,_,n);continue}m[m.length-1]+=_}i.trim!==!1&&(m=m.map((c)=>ip(c)));let u=[...m.join(`
|
|
18
|
-
`)];for(let[
|
|
19
|
-
`?(
|
|
20
|
-
`&&($&&w&&(r+=Ze($)),p&&(r+=Te(p)))}return r},$p,pp=(t,n,i)=>(n in t)?$p(t,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[n]=i,C=(t,n,i)=>(pp(t,typeof n!="symbol"?n+"":n,i),i),ae,ze,op,Yn,up,xp=(t,n,i)=>(n in t)?up(t,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[n]=i,Ne=(t,n,i)=>(xp(t,typeof n!="symbol"?n+"":n,i),i),zn,yp,cp=(t,n,i)=>(n in t)?yp(t,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[n]=i,Oe=(t,n,i)=>(cp(t,typeof n!="symbol"?n+"":n,i),i),Fe,_p,wp=(t,n,i)=>(n in t)?_p(t,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[n]=i,We=(t,n,i)=>(wp(t,typeof n!="symbol"?n+"":n,i),i),Nn,vp,Mp=(t,n,i)=>(n in t)?vp(t,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[n]=i,He=(t,n,i)=>(Mp(t,typeof n!="symbol"?n+"":n,i),i),fe,bp,sp=(t,n,i)=>(n in t)?bp(t,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[n]=i,Ke=(t,n,i)=>(sp(t,typeof n!="symbol"?n+"":n,i),i),On,Rp,Gp=(t,n,i)=>(n in t)?Rp(t,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[n]=i,Sp=(t,n,i)=>(Gp(t,typeof n!="symbol"?n+"":n,i),i),Wn,Ap;var Hn=s(()=>{I=Nt(Jn(),1),yt=Nt(Xn(),1);l$=d$();Ee={exports:{}};(function(t){var n={};t.exports=n,n.eastAsianWidth=function(r){var $=r.charCodeAt(0),p=r.length==2?r.charCodeAt(1):0,e=$;return 55296<=$&&$<=56319&&56320<=p&&p<=57343&&($&=1023,p&=1023,e=$<<10|p,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 $=this.eastAsianWidth(r);return $=="F"||$=="W"||$=="A"?2:1};function i(r){return r.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}n.length=function(r){for(var $=i(r),p=0,e=0;e<$.length;e++)p=p+this.characterLength($[e]);return p},n.slice=function(r,$,p){textLen=n.length(r),$=$||0,p=p||1,$<0&&($=textLen+$),p<0&&(p=textLen+p);for(var e="",m=0,u=i(r),c=0;c<u.length;c++){var _=u[c],w=n.length(_);if(m>=$-(w==2?1:0))if(m+w<=p)e+=_;else break;m+=w}return e}})(Ee);E$=Ee.exports,L$=le(E$),a$=le(C$);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);F$=Object.keys(T.color),f$=Object.keys(T.bgColor);[...F$,...f$];D$=g$(),Et=new Set(["\x1B",""]),Tn=`${np}8;;`;$p=Object.defineProperty;ae=Symbol("clack:cancel");ze=new Map([["k","up"],["j","down"],["h","left"],["l","right"]]),op=new Set(["up","down","left","right","space","enter"]);Yn=class Yn extends pt{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(I.cursor.move(0,-1)),this.value=n,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};up=Object.defineProperty;zn=class zn extends pt{constructor(t){super(t,!1),Ne(this,"options"),Ne(this,"cursor",0);let{options:n}=t;this.options=Object.entries(n).flatMap(([i,r])=>[{value:i,group:!0,label:i},...r.map(($)=>({...$,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(($)=>$.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]}}};yp=Object.defineProperty,Fe=class extends pt{constructor(t){super(t,!1),Oe(this,"options"),Oe(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]}},_p=Object.defineProperty;Nn=class Nn extends pt{constructor({mask:t,...n}){super(n),We(this,"valueWithCursor",""),We(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}${yt.default.inverse(yt.default.hidden("_"))}`;else{let i=this.masked.slice(0,this.cursor),r=this.masked.slice(this.cursor);this.valueWithCursor=`${i}${yt.default.inverse(r[0])}${r.slice(1)}`}})}get cursor(){return this._cursor}get masked(){return this.value.replaceAll(/./g,this._mask)}};vp=Object.defineProperty,fe=class extends pt{constructor(t){super(t,!1),He(this,"options"),He(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}},bp=Object.defineProperty;On=class On extends pt{constructor(t){super(t,!1),Ke(this,"options"),Ke(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:[$]})=>$?.toLowerCase()===i);r&&(this.value=r.value,this.state="submit",this.emit("submit"))})}};Rp=Object.defineProperty;Wn=class Wn extends pt{constructor(t){super(t),Sp(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}${yt.default.inverse(yt.default.hidden("_"))}`;else{let n=this.value.slice(0,this.cursor),i=this.value.slice(this.cursor);this.valueWithCursor=`${n}${yt.default.inverse(i[0])}${i.slice(1)}`}})}get cursor(){return this._cursor}};Ap=globalThis.process.platform.startsWith("win")});var wt={};Ot(wt,{text:()=>Tp,spinner:()=>lp,selectKey:()=>Op,select:()=>Np,password:()=>Yp,outro:()=>dp,note:()=>Kp,multiselect:()=>Wp,log:()=>ct,isCancel:()=>Lt,intro:()=>Pp,groupMultiselect:()=>Hp,group:()=>Lp,confirm:()=>zp,cancel:()=>Ip});import f from"node:process";function hp(){return f.platform!=="win32"?f.env.TERM!=="linux":Boolean(f.env.CI)||Boolean(f.env.WT_SESSION)||Boolean(f.env.TERMINUS_SUBLIME)||f.env.ConEmuTask==="{cmd::Cmder}"||f.env.TERM_PROGRAM==="Terminus-Sublime"||f.env.TERM_PROGRAM==="vscode"||f.env.TERM==="xterm-256color"||f.env.TERM==="alacritty"||f.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}function Ep(){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 o,ht,In,O=(t,n)=>In?t:n,qp,ti,ni,Ct,jp,R,d,Pn,dn,ln,Zt,ei,Bp,De,kp,Jp,Vp,Xp,Up,Qp,Zp,_t=(t)=>{switch(t){case"initial":case"active":return o.default.cyan(qp);case"cancel":return o.default.red(ti);case"error":return o.default.yellow(ni);case"submit":return o.default.green(Ct)}},Tp=(t)=>new Wn({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,render(){let n=`${o.default.gray(R)}
|
|
21
|
-
${
|
|
22
|
-
`,i=t.placeholder
|
|
23
|
-
${
|
|
24
|
-
${
|
|
25
|
-
`;case"submit":return`${
|
|
26
|
-
|
|
27
|
-
${
|
|
28
|
-
`}}}).prompt(),
|
|
29
|
-
${
|
|
30
|
-
`,i=this.valueWithCursor,r=this.masked;switch(this.state){case"error":return`${
|
|
31
|
-
${
|
|
32
|
-
${
|
|
33
|
-
`;case"submit":return`${
|
|
34
|
-
|
|
35
|
-
${
|
|
36
|
-
`}}}).prompt(),
|
|
37
|
-
${
|
|
38
|
-
|
|
39
|
-
${
|
|
40
|
-
${
|
|
41
|
-
`}}}).prompt()},
|
|
42
|
-
${
|
|
43
|
-
`;switch(this.state){case"submit":return`${r}${
|
|
44
|
-
${
|
|
45
|
-
${
|
|
46
|
-
${
|
|
47
|
-
`}}}}).prompt()},
|
|
48
|
-
${
|
|
49
|
-
`;switch(this.state){case"submit":return`${i}${
|
|
50
|
-
${
|
|
51
|
-
${
|
|
52
|
-
${
|
|
53
|
-
`}}}).prompt()},
|
|
54
|
-
${
|
|
55
|
-
${
|
|
56
|
-
`;switch(this.state){case"submit":return`${i}${
|
|
57
|
-
${
|
|
58
|
-
`).map((
|
|
59
|
-
`);return i
|
|
60
|
-
${
|
|
17
|
+
`)),this._prevFrame=t;return}this.output.write(l.erase.down())}this.output.write(t),this.state==="initial"&&(this.state="active"),this._prevFrame=t}}}function _i({input:t=ii,output:e=ri,overwrite:i=!0,hideCursor:r=!0}={}){let o=$t.createInterface({input:t,output:e,prompt:"",tabSize:1});$t.emitKeypressEvents(t,o),t.isTTY&&t.setRawMode(!0);let m=(n,{name:p})=>{if(String(n)==="\x03"){r&&e.write(l.cursor.show),process.exit(0);return}if(!i)return;$t.moveCursor(e,p==="return"?0:-1,p==="return"?-1:0,()=>{$t.clearLine(e,1,()=>{t.once("keypress",m)})})};return r&&e.write(l.cursor.hide),t.once("keypress",m),()=>{t.off("keypress",m),r&&e.write(l.cursor.show),t.isTTY&&!Hm&&t.setRawMode(!1),o.terminal=!1,o.close()}}var l,yt,cm,pi,xm,_m,ym=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},wm,He=10,fn=(t=0)=>(e)=>`\x1B[${e+t}m`,Pn=(t=0)=>(e)=>`\x1B[${38+t};5;${e}m`,In=(t=0)=>(e,i,r)=>`\x1B[${38+t};2;${e};${i};${r}m`,X,Mm,vm,Rm,oe,bm=39,le="\x07",$i="[",Sm="]",ui="m",fe,En=(t)=>`${oe.values().next().value}${$i}${t}${ui}`,Ln=(t)=>`${oe.values().next().value}${fe}${t}${le}`,Gm=(t)=>t.split(" ").map((e)=>Wt(e)),Ke=(t,e,i)=>{let r=[...e],o=!1,m=!1,n=Wt(oi(t[t.length-1]));for(let[p,u]of r.entries()){let x=Wt(u);if(n+x<=i?t[t.length-1]+=u:(t.push(u),n=0),oe.has(u)&&(o=!0,m=r.slice(p+1).join("").startsWith(fe)),o){m?u===le&&(o=!1,m=!1):u===ui&&(o=!1);continue}n+=x,n===i&&p<r.length-1&&(t.push(""),n=0)}!n&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())},Am=(t)=>{let e=t.split(" "),i=e.length;for(;i>0&&!(Wt(e[i-1])>0);)i--;return i===e.length?t:e.slice(0,i).join(" ")+e.slice(i).join("")},Bm=(t,e,i={})=>{if(i.trim!==!1&&t.trim()==="")return"";let r="",o,m,n=Gm(t),p=[""];for(let[x,y]of t.split(" ").entries()){i.trim!==!1&&(p[p.length-1]=p[p.length-1].trimStart());let w=Wt(p[p.length-1]);if(x!==0&&(w>=e&&(i.wordWrap===!1||i.trim===!1)&&(p.push(""),w=0),(w>0||i.trim===!1)&&(p[p.length-1]+=" ",w++)),i.hard&&n[x]>e){let _=e-w,M=1+Math.floor((n[x]-_-1)/e);Math.floor((n[x]-1)/e)<M&&p.push(""),Ke(p,y,e);continue}if(w+n[x]>e&&w>0&&n[x]>0){if(i.wordWrap===!1&&w<e){Ke(p,y,e);continue}p.push("")}if(w+n[x]>e&&i.wordWrap===!1){Ke(p,y,e);continue}p[p.length-1]+=y}i.trim!==!1&&(p=p.map((x)=>Am(x)));let u=[...p.join(`
|
|
18
|
+
`)];for(let[x,y]of u.entries()){if(r+=y,oe.has(y)){let{groups:_}=new RegExp(`(?:\\${$i}(?<code>\\d+)m|\\${fe}(?<uri>.*)${le})`).exec(u.slice(x).join(""))||{groups:{}};if(_.code!==void 0){let M=Number.parseFloat(_.code);o=M===bm?void 0:M}else _.uri!==void 0&&(m=_.uri.length===0?void 0:_.uri)}let w=Rm.codes.get(Number(o));u[x+1]===`
|
|
19
|
+
`?(m&&(r+=Ln("")),o&&w&&(r+=En(w))):y===`
|
|
20
|
+
`&&(o&&w&&(r+=En(o)),m&&(r+=Ln(m)))}return r},Vm,qm=(t,e,i)=>(e in t)?Vm(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,F=(t,e,i)=>(qm(t,typeof e!="symbol"?e+"":e,i),i),si,Cn,dm,Pe,km,Um=(t,e,i)=>(e in t)?km(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,gn=(t,e,i)=>(Um(t,typeof e!="symbol"?e+"":e,i),i),Ie,am,Tm=(t,e,i)=>(e in t)?am(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Dn=(t,e,i)=>(Tm(t,typeof e!="symbol"?e+"":e,i),i),ci,Jm,Xm=(t,e,i)=>(e in t)?Jm(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,ti=(t,e,i)=>(Xm(t,typeof e!="symbol"?e+"":e,i),i),Ee,Ym,Qm=(t,e,i)=>(e in t)?Ym(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,ei=(t,e,i)=>(Qm(t,typeof e!="symbol"?e+"":e,i),i),xi,zm,Zm=(t,e,i)=>(e in t)?zm(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,ni=(t,e,i)=>(Zm(t,typeof e!="symbol"?e+"":e,i),i),Le,Nm,Om=(t,e,i)=>(e in t)?Nm(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Wm=(t,e,i)=>(Om(t,typeof e!="symbol"?e+"":e,i),i),Fe,Hm;var Ce=h(()=>{l=Ft(Ne(),1),yt=Ft(We(),1);cm=sm();pi={exports:{}};(function(t){var e={};t.exports=e,e.eastAsianWidth=function(r){var o=r.charCodeAt(0),m=r.length==2?r.charCodeAt(1):0,n=o;return 55296<=o&&o<=56319&&56320<=m&&m<=57343&&(o&=1023,m&=1023,n=o<<10|m,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),m=0,n=0;n<o.length;n++)m=m+this.characterLength(o[n]);return m},e.slice=function(r,o,m){textLen=e.length(r),o=o||0,m=m||1,o<0&&(o=textLen+o),m<0&&(m=textLen+m);for(var n="",p=0,u=i(r),x=0;x<u.length;x++){var y=u[x],w=e.length(y);if(p>=o-(w==2?1:0))if(p+w<=m)n+=y;else break;p+=w}return n}})(pi);xm=pi.exports,_m=mi(xm),wm=mi(ym);X={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(X.modifier);Mm=Object.keys(X.color),vm=Object.keys(X.bgColor);[...Mm,...vm];Rm=hm(),oe=new Set(["\x1B",""]),fe=`${Sm}8;;`;Vm=Object.defineProperty;si=Symbol("clack:cancel");Cn=new Map([["k","up"],["j","down"],["h","left"],["l","right"]]),dm=new Set(["up","down","left","right","space","enter"]);Pe=class Pe extends ut{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(l.cursor.move(0,-1)),this.value=e,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};km=Object.defineProperty;Ie=class Ie extends ut{constructor(t){super(t,!1),gn(this,"options"),gn(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]}}};am=Object.defineProperty,ci=class extends ut{constructor(t){super(t,!1),Dn(this,"options"),Dn(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]}},Jm=Object.defineProperty;Ee=class Ee extends ut{constructor({mask:t,...e}){super(e),ti(this,"valueWithCursor",""),ti(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}${yt.default.inverse(yt.default.hidden("_"))}`;else{let i=this.masked.slice(0,this.cursor),r=this.masked.slice(this.cursor);this.valueWithCursor=`${i}${yt.default.inverse(r[0])}${r.slice(1)}`}})}get cursor(){return this._cursor}get masked(){return this.value.replaceAll(/./g,this._mask)}};Ym=Object.defineProperty,xi=class extends ut{constructor(t){super(t,!1),ei(this,"options"),ei(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}},zm=Object.defineProperty;Le=class Le extends ut{constructor(t){super(t,!1),ni(this,"options"),ni(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"))})}};Nm=Object.defineProperty;Fe=class Fe extends ut{constructor(t){super(t),Wm(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}${yt.default.inverse(yt.default.hidden("_"))}`;else{let e=this.value.slice(0,this.cursor),i=this.value.slice(this.cursor);this.valueWithCursor=`${e}${yt.default.inverse(i[0])}${i.slice(1)}`}})}get cursor(){return this._cursor}};Hm=globalThis.process.platform.startsWith("win")});var vt={};Ct(vt,{text:()=>tp,spinner:()=>cp,selectKey:()=>rp,select:()=>ip,password:()=>ep,outro:()=>sp,note:()=>pp,multiselect:()=>op,log:()=>wt,isCancel:()=>me,intro:()=>up,groupMultiselect:()=>mp,group:()=>_p,confirm:()=>np,cancel:()=>$p});import D from"node:process";function Km(){return D.platform!=="win32"?D.env.TERM!=="linux":Boolean(D.env.CI)||Boolean(D.env.WT_SESSION)||Boolean(D.env.TERMINUS_SUBLIME)||D.env.ConEmuTask==="{cmd::Cmder}"||D.env.TERM_PROGRAM==="Terminus-Sublime"||D.env.TERM_PROGRAM==="vscode"||D.env.TERM==="xterm-256color"||D.env.TERM==="alacritty"||D.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}function xp(){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 $,Ut,De,z=(t,e)=>De?t:e,lm,wi,Mi,pe,fm,R,P,tn,en,nn,Ht,vi,Pm,yi,Im,Em,Lm,Fm,Cm,gm,Dm,Mt=(t)=>{switch(t){case"initial":case"active":return $.default.cyan(lm);case"cancel":return $.default.red(wi);case"error":return $.default.yellow(Mi);case"submit":return $.default.green(pe)}},tp=(t)=>new Fe({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,render(){let e=`${$.default.gray(R)}
|
|
21
|
+
${Mt(this.state)} ${t.message}
|
|
22
|
+
`,i=t.placeholder?$.default.inverse(t.placeholder[0])+$.default.dim(t.placeholder.slice(1)):$.default.inverse($.default.hidden("_")),r=this.value?this.valueWithCursor:i;switch(this.state){case"error":return`${e.trim()}
|
|
23
|
+
${$.default.yellow(R)} ${r}
|
|
24
|
+
${$.default.yellow(P)} ${$.default.yellow(this.error)}
|
|
25
|
+
`;case"submit":return`${e}${$.default.gray(R)} ${$.default.dim(this.value||t.placeholder)}`;case"cancel":return`${e}${$.default.gray(R)} ${$.default.strikethrough($.default.dim(this.value??""))}${this.value?.trim()?`
|
|
26
|
+
`+$.default.gray(R):""}`;default:return`${e}${$.default.cyan(R)} ${r}
|
|
27
|
+
${$.default.cyan(P)}
|
|
28
|
+
`}}}).prompt(),ep=(t)=>new Ee({validate:t.validate,mask:t.mask??Pm,render(){let e=`${$.default.gray(R)}
|
|
29
|
+
${Mt(this.state)} ${t.message}
|
|
30
|
+
`,i=this.valueWithCursor,r=this.masked;switch(this.state){case"error":return`${e.trim()}
|
|
31
|
+
${$.default.yellow(R)} ${r}
|
|
32
|
+
${$.default.yellow(P)} ${$.default.yellow(this.error)}
|
|
33
|
+
`;case"submit":return`${e}${$.default.gray(R)} ${$.default.dim(r)}`;case"cancel":return`${e}${$.default.gray(R)} ${$.default.strikethrough($.default.dim(r??""))}${r?`
|
|
34
|
+
`+$.default.gray(R):""}`;default:return`${e}${$.default.cyan(R)} ${i}
|
|
35
|
+
${$.default.cyan(P)}
|
|
36
|
+
`}}}).prompt(),np=(t)=>{let e=t.active??"Yes",i=t.inactive??"No";return new Pe({active:e,inactive:i,initialValue:t.initialValue??!0,render(){let r=`${$.default.gray(R)}
|
|
37
|
+
${Mt(this.state)} ${t.message}
|
|
38
|
+
`,o=this.value?e:i;switch(this.state){case"submit":return`${r}${$.default.gray(R)} ${$.default.dim(o)}`;case"cancel":return`${r}${$.default.gray(R)} ${$.default.strikethrough($.default.dim(o))}
|
|
39
|
+
${$.default.gray(R)}`;default:return`${r}${$.default.cyan(R)} ${this.value?`${$.default.green(tn)} ${e}`:`${$.default.dim(en)} ${$.default.dim(e)}`} ${$.default.dim("/")} ${this.value?`${$.default.dim(en)} ${$.default.dim(i)}`:`${$.default.green(tn)} ${i}`}
|
|
40
|
+
${$.default.cyan(P)}
|
|
41
|
+
`}}}).prompt()},ip=(t)=>{let e=(r,o)=>{let m=r.label??String(r.value);return o==="active"?`${$.default.green(tn)} ${m} ${r.hint?$.default.dim(`(${r.hint})`):""}`:o==="selected"?`${$.default.dim(m)}`:o==="cancelled"?`${$.default.strikethrough($.default.dim(m))}`:`${$.default.dim(en)} ${$.default.dim(m)}`},i=0;return new xi({options:t.options,initialValue:t.initialValue,render(){let r=`${$.default.gray(R)}
|
|
42
|
+
${Mt(this.state)} ${t.message}
|
|
43
|
+
`;switch(this.state){case"submit":return`${r}${$.default.gray(R)} ${e(this.options[this.cursor],"selected")}`;case"cancel":return`${r}${$.default.gray(R)} ${e(this.options[this.cursor],"cancelled")}
|
|
44
|
+
${$.default.gray(R)}`;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 m=o<this.options.length&&i>0,n=o<this.options.length&&i+o<this.options.length;return`${r}${$.default.cyan(R)} ${this.options.slice(i,i+o).map((p,u,x)=>u===0&&m?$.default.dim("..."):u===x.length-1&&n?$.default.dim("..."):e(p,u+i===this.cursor?"active":"inactive")).join(`
|
|
45
|
+
${$.default.cyan(R)} `)}
|
|
46
|
+
${$.default.cyan(P)}
|
|
47
|
+
`}}}}).prompt()},rp=(t)=>{let e=(i,r="inactive")=>{let o=i.label??String(i.value);return r==="selected"?`${$.default.dim(o)}`:r==="cancelled"?`${$.default.strikethrough($.default.dim(o))}`:r==="active"?`${$.default.bgCyan($.default.gray(` ${i.value} `))} ${o} ${i.hint?$.default.dim(`(${i.hint})`):""}`:`${$.default.gray($.default.bgWhite($.default.inverse(` ${i.value} `)))} ${o} ${i.hint?$.default.dim(`(${i.hint})`):""}`};return new Le({options:t.options,initialValue:t.initialValue,render(){let i=`${$.default.gray(R)}
|
|
48
|
+
${Mt(this.state)} ${t.message}
|
|
49
|
+
`;switch(this.state){case"submit":return`${i}${$.default.gray(R)} ${e(this.options.find((r)=>r.value===this.value),"selected")}`;case"cancel":return`${i}${$.default.gray(R)} ${e(this.options[0],"cancelled")}
|
|
50
|
+
${$.default.gray(R)}`;default:return`${i}${$.default.cyan(R)} ${this.options.map((r,o)=>e(r,o===this.cursor?"active":"inactive")).join(`
|
|
51
|
+
${$.default.cyan(R)} `)}
|
|
52
|
+
${$.default.cyan(P)}
|
|
53
|
+
`}}}).prompt()},op=(t)=>{let e=(i,r)=>{let o=i.label??String(i.value);return r==="active"?`${$.default.cyan(nn)} ${o} ${i.hint?$.default.dim(`(${i.hint})`):""}`:r==="selected"?`${$.default.green(Ht)} ${$.default.dim(o)}`:r==="cancelled"?`${$.default.strikethrough($.default.dim(o))}`:r==="active-selected"?`${$.default.green(Ht)} ${o} ${i.hint?$.default.dim(`(${i.hint})`):""}`:r==="submitted"?`${$.default.dim(o)}`:`${$.default.dim(vi)} ${$.default.dim(o)}`};return new ci({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.
|
|
54
|
+
${$.default.reset($.default.dim(`Press ${$.default.gray($.default.bgWhite($.default.inverse(" space ")))} to select, ${$.default.gray($.default.bgWhite($.default.inverse(" enter ")))} to submit`))}`},render(){let i=`${$.default.gray(R)}
|
|
55
|
+
${Mt(this.state)} ${t.message}
|
|
56
|
+
`;switch(this.state){case"submit":return`${i}${$.default.gray(R)} ${this.options.filter(({value:r})=>this.value.includes(r)).map((r)=>e(r,"submitted")).join($.default.dim(", "))||$.default.dim("none")}`;case"cancel":{let r=this.options.filter(({value:o})=>this.value.includes(o)).map((o)=>e(o,"cancelled")).join($.default.dim(", "));return`${i}${$.default.gray(R)} ${r.trim()?`${r}
|
|
57
|
+
${$.default.gray(R)}`:""}`}case"error":{let r=this.error.split(`
|
|
58
|
+
`).map((o,m)=>m===0?`${$.default.yellow(P)} ${$.default.yellow(o)}`:` ${o}`).join(`
|
|
59
|
+
`);return i+$.default.yellow(R)+" "+this.options.map((o,m)=>{let n=this.value.includes(o.value),p=m===this.cursor;return p&&n?e(o,"active-selected"):n?e(o,"selected"):e(o,p?"active":"inactive")}).join(`
|
|
60
|
+
${$.default.yellow(R)} `)+`
|
|
61
61
|
`+r+`
|
|
62
|
-
`}default:return`${i}${
|
|
63
|
-
${
|
|
64
|
-
${
|
|
65
|
-
`}}}).prompt()},
|
|
66
|
-
${
|
|
67
|
-
${
|
|
68
|
-
`;switch(this.state){case"submit":return`${i}${
|
|
69
|
-
${
|
|
70
|
-
`).map((
|
|
71
|
-
`);return`${i}${
|
|
72
|
-
${
|
|
62
|
+
`}default:return`${i}${$.default.cyan(R)} ${this.options.map((r,o)=>{let m=this.value.includes(r.value),n=o===this.cursor;return n&&m?e(r,"active-selected"):m?e(r,"selected"):e(r,n?"active":"inactive")}).join(`
|
|
63
|
+
${$.default.cyan(R)} `)}
|
|
64
|
+
${$.default.cyan(P)}
|
|
65
|
+
`}}}).prompt()},mp=(t)=>{let e=(i,r,o=[])=>{let m=i.label??String(i.value),n=typeof i.group=="string",p=n&&(o[o.indexOf(i)+1]??{group:!0}),u=n&&p.group===!0,x=n?`${u?P:R} `:"";return r==="active"?`${$.default.dim(x)}${$.default.cyan(nn)} ${m} ${i.hint?$.default.dim(`(${i.hint})`):""}`:r==="group-active"?`${x}${$.default.cyan(nn)} ${$.default.dim(m)}`:r==="group-active-selected"?`${x}${$.default.green(Ht)} ${$.default.dim(m)}`:r==="selected"?`${$.default.dim(x)}${$.default.green(Ht)} ${$.default.dim(m)}`:r==="cancelled"?`${$.default.strikethrough($.default.dim(m))}`:r==="active-selected"?`${$.default.dim(x)}${$.default.green(Ht)} ${m} ${i.hint?$.default.dim(`(${i.hint})`):""}`:r==="submitted"?`${$.default.dim(m)}`:`${$.default.dim(x)}${$.default.dim(vi)} ${$.default.dim(m)}`};return new Ie({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.
|
|
66
|
+
${$.default.reset($.default.dim(`Press ${$.default.gray($.default.bgWhite($.default.inverse(" space ")))} to select, ${$.default.gray($.default.bgWhite($.default.inverse(" enter ")))} to submit`))}`},render(){let i=`${$.default.gray(R)}
|
|
67
|
+
${Mt(this.state)} ${t.message}
|
|
68
|
+
`;switch(this.state){case"submit":return`${i}${$.default.gray(R)} ${this.options.filter(({value:r})=>this.value.includes(r)).map((r)=>e(r,"submitted")).join($.default.dim(", "))}`;case"cancel":{let r=this.options.filter(({value:o})=>this.value.includes(o)).map((o)=>e(o,"cancelled")).join($.default.dim(", "));return`${i}${$.default.gray(R)} ${r.trim()?`${r}
|
|
69
|
+
${$.default.gray(R)}`:""}`}case"error":{let r=this.error.split(`
|
|
70
|
+
`).map((o,m)=>m===0?`${$.default.yellow(P)} ${$.default.yellow(o)}`:` ${o}`).join(`
|
|
71
|
+
`);return`${i}${$.default.yellow(R)} ${this.options.map((o,m,n)=>{let p=this.value.includes(o.value)||o.group===!0&&this.isGroupSelected(`${o.value}`),u=m===this.cursor;return!u&&typeof o.group=="string"&&this.options[this.cursor].value===o.group?e(o,p?"group-active-selected":"group-active",n):u&&p?e(o,"active-selected",n):p?e(o,"selected",n):e(o,u?"active":"inactive",n)}).join(`
|
|
72
|
+
${$.default.yellow(R)} `)}
|
|
73
73
|
${r}
|
|
74
|
-
`}default:return`${i}${
|
|
75
|
-
${
|
|
76
|
-
${
|
|
77
|
-
`}}}).prompt()},
|
|
74
|
+
`}default:return`${i}${$.default.cyan(R)} ${this.options.map((r,o,m)=>{let n=this.value.includes(r.value)||r.group===!0&&this.isGroupSelected(`${r.value}`),p=o===this.cursor;return!p&&typeof r.group=="string"&&this.options[this.cursor].value===r.group?e(r,n?"group-active-selected":"group-active",m):p&&n?e(r,"active-selected",m):n?e(r,"selected",m):e(r,p?"active":"inactive",m)}).join(`
|
|
75
|
+
${$.default.cyan(R)} `)}
|
|
76
|
+
${$.default.cyan(P)}
|
|
77
|
+
`}}}).prompt()},ge=(t)=>t.replace(xp(),""),pp=(t="",e="")=>{let i=`
|
|
78
78
|
${t}
|
|
79
79
|
`.split(`
|
|
80
|
-
`),r=
|
|
81
|
-
`);process.stdout.write(`${
|
|
82
|
-
${
|
|
83
|
-
${
|
|
84
|
-
${
|
|
85
|
-
`)}
|
|
80
|
+
`),r=ge(e).length,o=Math.max(i.reduce((n,p)=>(p=ge(p),p.length>n?p.length:n),0),r)+2,m=i.map((n)=>`${$.default.gray(R)} ${$.default.dim(n)}${" ".repeat(o-ge(n).length)}${$.default.gray(R)}`).join(`
|
|
81
|
+
`);process.stdout.write(`${$.default.gray(R)}
|
|
82
|
+
${$.default.green(pe)} ${$.default.reset(e)} ${$.default.gray(yi.repeat(Math.max(o-r-1,1))+Im)}
|
|
83
|
+
${m}
|
|
84
|
+
${$.default.gray(Em+yi.repeat(o+2)+Lm)}
|
|
85
|
+
`)},$p=(t="")=>{process.stdout.write(`${$.default.gray(P)} ${$.default.red(t)}
|
|
86
86
|
|
|
87
|
-
`)},
|
|
88
|
-
`)},
|
|
89
|
-
${
|
|
87
|
+
`)},up=(t="")=>{process.stdout.write(`${$.default.gray(fm)} ${t}
|
|
88
|
+
`)},sp=(t="")=>{process.stdout.write(`${$.default.gray(R)}
|
|
89
|
+
${$.default.gray(P)} ${t}
|
|
90
90
|
|
|
91
|
-
`)},
|
|
92
|
-
`);let w=0,
|
|
93
|
-
`),i()},u=(
|
|
94
|
-
`);i.push(`${
|
|
91
|
+
`)},wt,cp=()=>{let t=De?["◒","◐","◓","◑"]:["•","o","O","0"],e=De?80:120,i,r,o=!1,m="",n=(y="")=>{o=!0,i=_i(),m=y.replace(/\.+$/,""),process.stdout.write(`${$.default.gray(R)}
|
|
92
|
+
`);let w=0,_=0;r=setInterval(()=>{let M=$.default.magenta(t[w]),G=".".repeat(Math.floor(_)).slice(0,3);process.stdout.write(Ut.cursor.move(-999,0)),process.stdout.write(Ut.erase.down(1)),process.stdout.write(`${M} ${m}${G}`),w=w+1<t.length?w+1:0,_=_<t.length?_+0.125:0},e)},p=(y="",w=0)=>{m=y??m,o=!1,clearInterval(r);let _=w===0?$.default.green(pe):w===1?$.default.red(wi):$.default.red(Mi);process.stdout.write(Ut.cursor.move(-999,0)),process.stdout.write(Ut.erase.down(1)),process.stdout.write(`${_} ${m}
|
|
93
|
+
`),i()},u=(y="")=>{m=y??m},x=(y)=>{let w=y>1?"Something went wrong":"Canceled";o&&p(w,y)};return process.on("uncaughtExceptionMonitor",()=>x(2)),process.on("unhandledRejection",()=>x(2)),process.on("SIGINT",()=>x(1)),process.on("SIGTERM",()=>x(1)),process.on("exit",x),{start:n,stop:p,message:u}},_p=async(t,e)=>{let i={},r=Object.keys(t);for(let o of r){let m=t[o],n=await m({results:i})?.catch((p)=>{throw p});if(typeof e?.onCancel=="function"&&me(n)){i[o]="canceled",e.onCancel({results:i});continue}i[o]=n}return i};var ht=h(()=>{Ce();Ce();$=Ft(We(),1),Ut=Ft(Ne(),1);De=Km(),lm=z("◆","*"),wi=z("■","x"),Mi=z("▲","x"),pe=z("◇","o"),fm=z("┌","T"),R=z("│","|"),P=z("└","—"),tn=z("●",">"),en=z("○"," "),nn=z("◻","[•]"),Ht=z("◼","[+]"),vi=z("◻","[ ]"),Pm=z("▪","•"),yi=z("─","-"),Im=z("╮","+"),Em=z("├","+"),Lm=z("╯","+"),Fm=z("●","•"),Cm=z("◆","*"),gm=z("▲","!"),Dm=z("■","x"),wt={message:(t="",{symbol:e=$.default.gray(R)}={})=>{let i=[`${$.default.gray(R)}`];if(t){let[r,...o]=t.split(`
|
|
94
|
+
`);i.push(`${e} ${r}`,...o.map((m)=>`${$.default.gray(R)} ${m}`))}process.stdout.write(`${i.join(`
|
|
95
95
|
`)}
|
|
96
|
-
`)},info:(t)=>{
|
|
96
|
+
`)},info:(t)=>{wt.message(t,{symbol:$.default.blue(Fm)})},success:(t)=>{wt.message(t,{symbol:$.default.green(Cm)})},step:(t)=>{wt.message(t,{symbol:$.default.green(pe)})},warn:(t)=>{wt.message(t,{symbol:$.default.yellow(gm)})},warning:(t)=>{wt.warn(t)},error:(t)=>{wt.message(t,{symbol:$.default.red(Dm)})}}});async function tt(t){if(!N())return;let{defaultValue:e,message:i}=t,o=await(await Promise.resolve().then(() => (ht(),vt))).text({message:i,default:e,placeholder:e});if(typeof o==="symbol")return;return o}async function hi(t){if(!N())return;let{message:e}=t,r=await(await Promise.resolve().then(() => (ht(),vt))).confirm({message:e});if(typeof r==="symbol")return;return r}function Rt(t,e){throw new c(`Missing required argument: --${t}
|
|
97
97
|
Hint: In non-interactive (CI / agent) environments all required flags must be provided.
|
|
98
|
-
In an interactive terminal, run without --${t} and the CLI will prompt for it.`,
|
|
99
|
-
`),process.exit(1);return
|
|
98
|
+
In an interactive terminal, run without --${t} and the CLI will prompt for it.`,s.USAGE,e)}async function $e(t){if(t.value)return t.value;if(N({nonInteractive:t.nonInteractive})){let e=await tt({message:t.message});if(!e)process.stderr.write(t.cancelMessage+`
|
|
99
|
+
`),process.exit(1);return e}Rt(t.flagName,t.usageHint)}var st=h(()=>{k();d()});function E(t){return t.length>8?`${t.slice(0,4)}...${t.slice(-4)}`:"***"}async function bi(t){let e=gt[t],{randomBytes:i,createHash:r}=await import("crypto"),o=i(32).toString("base64url"),m=r("sha256").update(o).digest("base64url"),n=i(16).toString("base64url"),p=await fetch(`${e}/oauth2/device/code`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:Ri,scope:wp.join(" "),code_challenge:m,code_challenge_method:"S256",state:n})});if(!p.ok){let w=await p.text().catch(()=>"");throw new c(`Failed to start device-code flow (HTTP ${p.status}).`,s.AUTH,w||`URL: ${e}/oauth2/device/code`)}let u=await p.json();if(u.state!==n)throw new c("OAuth state mismatch.",s.AUTH);vp(u.verification_uri),process.stderr.write(`
|
|
100
100
|
Opened: ${u.verification_uri}
|
|
101
101
|
`),process.stderr.write(`Code: ${u.user_code}
|
|
102
|
-
`),process.stderr.write(`Client: ${
|
|
102
|
+
`),process.stderr.write(`Client: ${yp}
|
|
103
103
|
`),process.stderr.write(`Waiting for authorization...
|
|
104
|
-
`);let
|
|
105
|
-
${
|
|
106
|
-
`)});function
|
|
104
|
+
`);let x=u.expired_in,y=u.interval||3000;while(Date.now()<x){await Mp(y);let w=await fetch(`${e}/oauth2/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"urn:ietf:params:oauth:grant-type:device_code",client_id:Ri,user_code:u.user_code,code_verifier:o})});if(!w.ok)throw new c(`Device-code authorization failed (HTTP ${w.status}).`,s.AUTH);let _=await w.json();if(_.status==="pending")continue;if(_.status==="success"&&_.access_token)return{access_token:_.access_token,refresh_token:_.refresh_token??"",expires_at:new Date(_.expired_in??Date.now()).toISOString(),region:t,resource_url:_.resource_url};throw new c(`Device-code authorization failed: ${_.status}`,s.AUTH)}throw new c("Device-code authorization timed out.",s.TIMEOUT)}function Mp(t){return new Promise((e)=>setTimeout(e,t))}function vp(t){let{execFile:e,spawn:i}=dt("child_process");if(process.platform==="darwin")e("open",[t]);else if(process.platform==="win32")i("cmd.exe",["/c","start","",t],{shell:!1,detached:!0});else e("xdg-open",[t])}var Ri="659cf4c1-615c-45f6-a5f6-4bf15eb476e5",yp="MiniMax CLI",wp;var Si=h(()=>{nt();k();d();wp=["openid","profile","coding_plan"]});async function L(){return Q().oauth??null}async function ue(t){let e=Q();e.oauth=t,await f(e)}async function Gi(){let t=Q();if(!("oauth"in t))return;delete t.oauth,await f(t)}var ct=h(()=>{mt()});function se(t){return`Looked for credentials in: ${t??it()}
|
|
105
|
+
${hp}`}var hp;var rn=h(()=>{kt();hp=["Log in: mmx auth login","Pass per-call: --api-key sk-xxxxx","Or set env var: MMX_CONFIG_DIR=/path/to/.mmx"].join(`
|
|
106
|
+
`)});function at(t){return t.replace(/^https?:\/\//,"")}async function Bi(t){if(t.apiKey||t.fileApiKey)return;if(await L())return;let e=process.env.MINIMAX_API_KEY;if(e){if(!N({nonInteractive:t.nonInteractive}))return;if(await hi({message:`Found MINIMAX_API_KEY in environment (${E(e)}). Save to config file?`}))await Ai(t,e);return}if(!N({nonInteractive:t.nonInteractive}))throw new c("No credentials found.",s.AUTH,se(t.configPath));let i=await on();if(i==="api-key"){let r=await tt({message:"Enter your MiniMax API key:"});if(!r)throw new c("API key is required.",s.AUTH);await Ai(t,r);return}await mn(i==="oauth-cn"?"cn":"global")}async function on(){let{select:t,isCancel:e}=await Promise.resolve().then(() => (ht(),vt)),i=await t({message:"How would you like to authenticate?",options:Rp.map((r)=>({value:r.value,label:r.label}))});if(e(i))throw new c("Authentication cancelled.",s.AUTH);return i}async function Vi(){let{select:t,isCancel:e}=await Promise.resolve().then(() => (ht(),vt)),i=await t({message:"Select an OAuth region:",options:[{value:"global",label:`Global → ${at(Z.global)}`},{value:"cn",label:`China → ${at(Z.cn)}`}]});if(e(i))throw new c("Authentication cancelled.",s.AUTH);return i}async function mn(t){let e=await bi(t),i=Q();delete i.api_key,i.oauth=e,i.region=t,await f(i),process.stderr.write(`Logged in successfully.
|
|
107
107
|
`),process.stderr.write(`Credentials saved to ~/.mmx/config.json
|
|
108
|
-
`)}async function
|
|
109
|
-
`)}var
|
|
110
|
-
Re-authenticate: mmx auth login`)}async function
|
|
108
|
+
`)}async function Ai(t,e){let i={...Q(),api_key:e};await f(i),t.fileApiKey=e,process.stderr.write(`API key saved to ${t.configPath??"~/.mmx/config.json"}
|
|
109
|
+
`)}var Rp;var pn=h(()=>{nt();mt();st();k();d();Si();ct();rn();Rp=[{value:"oauth-global",label:`MiniMax (OAuth login → ${at(Z.global)})`},{value:"oauth-cn",label:`MiniMax (OAuth login → ${at(Z.cn)})`},{value:"api-key",label:`API key (${at(Z.global)} or ${at(Z.cn)})`}]});async function $n(t,e="global"){let i=`${gt[e]}/oauth2/token`,r=null;for(let o=0;o<=qi;o++){if(o>0)await new Promise((p)=>setTimeout(p,Sp*o));let m;try{m=await fetch(i,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:t,client_id:bp}),signal:AbortSignal.timeout(Gp)})}catch(p){let u=p instanceof Error&&(p.name==="AbortError"||p.name==="TimeoutError"||p.message.includes("timed out"));r=Error(u?"Token refresh timed out — auth server did not respond within 10 s.":`Token refresh failed: ${p instanceof Error?p.message:String(p)}`);continue}if(!m.ok){if(m.status>=400&&m.status<500)throw new c("OAuth session expired and could not be refreshed.",s.AUTH,"Re-authenticate: mmx auth login");r=Error(`Token refresh failed: HTTP ${m.status}`);continue}let n=await m.json();if(n.status!=="success"||!n.access_token)throw new c(`OAuth refresh failed: ${n.status}.`,s.AUTH,"Re-authenticate: mmx auth login");return{access_token:n.access_token,refresh_token:n.refresh_token??t,expires_at:new Date(n.expired_in??Date.now()).toISOString(),resource_url:n.resource_url}}throw new c(`Token refresh failed after ${qi+1} attempts: ${r?.message}`,s.AUTH,`Check your network connection.
|
|
110
|
+
Re-authenticate: mmx auth login`)}async function ji(t){let e=new Date(t.expires_at).getTime();if(Date.now()<e-Ap)return t.access_token;let i=await $n(t.refresh_token,t.region??"global"),r={access_token:i.access_token,refresh_token:i.refresh_token,expires_at:i.expires_at,region:t.region,resource_url:i.resource_url??t.resource_url,account:t.account};return await ue(r),r.access_token}var bp="659cf4c1-615c-45f6-a5f6-4bf15eb476e5",qi=2,Sp=500,Gp=1e4,Ap=300000;var un=h(()=>{nt();ct();k();d()});async function ce(t){if(t.apiKey)return{token:t.apiKey,method:"api-key",source:"flag"};let e=await L();if(e)return{token:await ji(e),method:"oauth",source:"config.json"};if(t.fileApiKey)return{token:t.fileApiKey,method:"api-key",source:"config.json"};throw new c("No credentials found.",s.AUTH,se(t.configPath))}var sn=h(()=>{ct();un();k();d();rn()});function di(t){if(!t)return"";if(t.includes("/t2a"))return`
|
|
111
111
|
|
|
112
112
|
Speech models require the Plus plan or above.`;if(t.includes("/image_generation"))return`
|
|
113
113
|
|
|
@@ -115,199 +115,200 @@ image-01 requires the Plus plan or above.`;if(t.includes("/video_generation")||t
|
|
|
115
115
|
|
|
116
116
|
Video models (Hailuo-2.3 / 2.3-Fast) require the Max plan or above.`;if(t.includes("/music_generation"))return`
|
|
117
117
|
|
|
118
|
-
Music-2.6 requires the Max plan or above.`;return""}function
|
|
119
|
-
Re-authenticate: mmx auth login`);if(t===429)return new
|
|
120
|
-
Upgrade plan: ${
|
|
121
|
-
Upgrade plan: ${
|
|
122
|
-
`)}var
|
|
123
|
-
`),process.stderr.write(`> Auth: ${
|
|
124
|
-
`);let
|
|
125
|
-
`);if(!
|
|
118
|
+
Music-2.6 requires the Max plan or above.`;return""}function ki(t){return`${t?.includes("minimaxi.com")?"https://platform.minimaxi.com":"https://platform.minimax.io"}/subscribe/token-plan`}function Kt(t,e,i){let r=e.base_resp?.status_msg||e.error?.message||`HTTP ${t}`,o=e.base_resp?.status_code||e.error?.code;if(t===401||t===403)return new c(`API key rejected (HTTP ${t}).`,s.AUTH,`Check status: mmx auth status
|
|
119
|
+
Re-authenticate: mmx auth login`);if(t===429)return new c(`Rate limit or quota exceeded. ${r}`,s.QUOTA,"Check usage: mmx quota show");if(t===408||t===504)return new c(`Request timed out (HTTP ${t}).`,s.TIMEOUT,"Try increasing --timeout or retry later.");if(o===1002||o===1039){let m=e.base_resp?.status_msg||"content sensitivity";return new c(`Input content flagged by sensitivity filter (${m}).`,s.CONTENT_FILTER)}if(o===1028||o===1030){let m=di(i);return new c(`Quota exhausted. ${r}`,s.QUOTA,`Check usage: mmx quota show${m}
|
|
120
|
+
Upgrade plan: ${ki(i)}`)}if(o===2061){let m=di(i);return new c(`This model is not available on your current Token Plan. ${r}`,s.QUOTA,`Check usage: mmx quota show${m}
|
|
121
|
+
Upgrade plan: ${ki(i)}`)}return new c(`API error: ${r} (HTTP ${t})`,s.GENERAL)}var cn=h(()=>{k();d()});import{homedir as Ui}from"os";function kp(t){return t.startsWith(Ui())?t.replace(Ui(),"~"):t}function Up(t){return t.replace(/^https?:\/\//,"")}function Ti(t,e,i){if(t.quiet||ai||!process.stderr.isTTY)return;ai=!0;let r=t.configPath?kp(t.configPath):"~/.mmx/config.json",o=Up(t.baseUrl),m=t.apiKey?"(flag)":"(file)",n=E(e),p=i?` ${xt}|${C} ${xt}Model:${C} ${qp}${i}${C}`:"";process.stderr.write(`${Bp}${Vp}MINIMAX${C} ${xt}${r}${C} ${xt}|${C} ${xt}URL:${C} ${jp}${o}${C} ${xt}|${C} ${xt}Key:${C} ${dp}${n}${C} ${xt}${m}${C}${p}
|
|
122
|
+
`)}var ai=!1,C="\x1B[0m",xt="\x1B[2m",Bp="\x1B[1m",Vp="\x1B[38;2;43;82;255m",qp="\x1B[38;2;147;51;234m",jp="\x1B[38;2;6;184;212m",dp="\x1B[38;2;236;72;153m";var Ji=()=>{};var Xi=()=>{};var bt="1.0.19";var xe=h(()=>{Xi()});async function et(t,e){let i=typeof FormData<"u"&&e.body instanceof FormData,r={"User-Agent":`mmx-cli/${bt}`,...e.headers};if(!i&&!r["Content-Type"])r["Content-Type"]="application/json";if(!e.noAuth){let n=await ce(t);if(e.authStyle==="x-api-key")r["x-api-key"]=n.token;else r.Authorization=`Bearer ${n.token}`;if(t.verbose)process.stderr.write(`> ${e.method??"GET"} ${e.url}
|
|
123
|
+
`),process.stderr.write(`> Auth: ${n.token.slice(0,8)}...
|
|
124
|
+
`);let p=e.body&&typeof e.body==="object"&&"model"in e.body?String(e.body.model):void 0;Ti(t,n.token,p)}let o=(e.timeout??t.timeout)*1000,m=await fetch(e.url,{method:e.method??"GET",headers:r,body:e.body?i?e.body:JSON.stringify(e.body):void 0,signal:e.stream?void 0:AbortSignal.timeout(o)});if(t.verbose)process.stderr.write(`< ${m.status} ${m.statusText}
|
|
125
|
+
`);if(!m.ok){let n={};try{n=await m.json()}catch{}throw Kt(m.status,n,e.url)}return m}async function q(t,e){let i=await et(t,e),r;try{r=await i.json()}catch{let o=i.headers.get("content-type")||"";throw new c(`API returned non-JSON response (${o||"unknown type"}). Server may be experiencing issues.`,s.GENERAL)}if(r.base_resp?.status_code&&r.base_resp.status_code!==0)throw Kt(200,{base_resp:r.base_resp},e.url);return r}var O=h(()=>{k();d();sn();cn();Ji();xe()});function _e(t){return`${t}/anthropic/v1/messages`}function Yi(t){return`${t}/v1/t2a_v2`}function Qi(t){return`${t}/v1/get_voice`}function zi(t){return`${t}/v1/image_generation`}function Zi(t){return`${t}/v1/video_generation`}function Ni(t){return`${t}/v2/video_generation`}function ye(t,e){return`${t}/v1/query/video_generation?task_id=${e}`}function we(t,e){return`${t}/v2/query/video_generation/${e}`}function Me(t,e){return`${t}/v1/files/retrieve?file_id=${e}`}function ve(t){return`${t}/v1/music_generation`}function Oi(t){return`${t}/v1/music_cover_preprocess`}function Wi(t){return`${t}/v1/coding_plan/search`}function Hi(t){return`${t}/v1/coding_plan/vlm`}function St(t){return`${t}/v1/token_plan/remains`}function Ki(t){return`${t}/v1/files/upload`}function li(t){return`${t}/v1/files/list`}function fi(t){return`${t}/v1/files/delete`}function Fi(t){if(t>=50)return["\x1B[38;2;74;222;128m","\x1B[48;2;22;163;74m"];if(t>=20)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"]}function Xp(t,e){if(e!=="cn")return t;return Jp[t]??t}function Yp(t,e){if(t<=0)return e;let i=Math.floor(t/3600000),r=Math.floor(t%3600000/60000);return i>0?`${i}h ${r}m`:`${r}m`}function Pi(t){return new Date(t).toISOString().slice(0,10)}function Qp(t){return t>=11904&&t<=40959||t>=63744&&t<=64255||t>=65072&&t<=65103||t>=65281&&t<=65376||t>=131072&&t<=195103}function g(t){let e=t.replace(/\x1b\[[0-9;]*m/g,""),i=0;for(let r of e)i+=Qp(r.codePointAt(0))?2:1;return i}function Np(t){return t===3}function Op(t){return t.current_interval_total_count===0&&t.current_weekly_total_count===0&&t.current_interval_status===3&&t.current_weekly_status===3}function xn(t){return Math.max(0,Math.min(Zp,Math.round(t)))}function Wp(t){if(t===void 0||t===null)return 1;return Math.max(0,t)/1000}function Hp(t,e,i,r){let o=Wp(r);if(t!==void 0&&t!==null)return xn(t*o);return i>0?xn(e/i*100*o):0}function Kp(t,e,i=zp,r=!0){let o=xn(t),m=Math.min(1,o/100),n=Math.round(i*m),p=i-n,u=`${o}%`.padStart(4);if(!e){let _=`[${"█".repeat(n)}${".".repeat(p)}]`;return r?`${_} ${u}`:_}let[x,y]=Fi(o),w=`${y}${" ".repeat(n)}\x1B[0m\x1B[48;2;55;65;81m${" ".repeat(p)}\x1B[0m`;return r?`${w} ${x}\x1B[1m${u}\x1B[0m`:w}function Ii(t,e,i,r,o,m,n,p){if(n){let w=(p??lp).padStart(4);if(o){let M=`\x1B[48;2;22;163;74m${" ".repeat(lt)}\x1B[0m`;return`\x1B[2m${t}\x1B[0m ${M} \x1B[38;2;74;222;128m\x1B[1m${w}\x1B[0m`}let _=`[${"█".repeat(lt)}]`;return`${t} ${_} ${w}`}let u=Hp(r,e,i,m),x=Kp(u,o,lt,i<=0);if(i>0){let y=`${e.toLocaleString()} / ${i.toLocaleString()}`;return o?`\x1B[2m${t}\x1B[0m ${x} ${Fi(u)[0]}${y}\x1B[0m`:`${t} ${x} ${y}`}return`${t} ${x}`}function Ei(t,e,i){if(i){let r=`\x1B[48;2;55;65;81m${" ".repeat(lt)}\x1B[0m`;return`\x1B[2m${t}\x1B[0m ${r} \x1B[38;2;248;113;113m\x1B[1m${e}\x1B[0m`}return`${t} [${".".repeat(lt)}] ${e}`}function he(t,e,i,r,o){return o?`\x1B[2m${e}${i.repeat(t)}${r}\x1B[0m`:`+${"-".repeat(t)}+`}function Li(t,e,i,r){let o=Math.max(0,e-2-i);return r?`${"\x1B[2m"}│${"\x1B[0m"} ${t}${" ".repeat(o)} ${"\x1B[2m"}│${"\x1B[0m"}`:`| ${t}${" ".repeat(o)} |`}function Tt(t,e){let i=!e.noColor&&process.stdout.isTTY===!0,r=e.region==="cn"?Tp:ap,o=t.map((v)=>{let B=Xp(v.model_name,e.region),j=Op(v),U=j?Ei(r.current,r.notInPlan,i):Ii(r.current,v.current_interval_usage_count,v.current_interval_total_count,v.current_interval_remaining_percent,i),T=j?Ei(r.weekly,r.notInPlan,i):Ii(r.weekly,v.current_weekly_usage_count,v.current_weekly_total_count,v.current_weekly_remaining_percent,i,v.weekly_boost_permille,Np(v.current_weekly_status),e.region==="cn"?fp:Pp),K=j?`${r.resetsIn} —`:`${r.resetsIn} ${Yp(v.remains_time,r.now)}`;return{displayName:B,current:U,weekly:T,reset:K}}),m=Math.max(6,...o.map((v)=>g(v.displayName))),n=Math.max(...o.map((v)=>g(v.current)),18),p=Math.max(...o.map((v)=>g(v.weekly)),18),u=Math.max(...o.map((v)=>g(v.reset)),10),x=Math.max(72,m+2+n+2+p+2+u+4),y=t.length>0?`${Pi(t[0].weekly_start_time)} — ${Pi(t[0].weekly_end_time)}`:"",w=`MINIMAX ${r.dashboard}`,_=`${r.week}: ${y}`,M=Math.max(2,x-2-g(w)-g(_)),G=i?`\x1B[1m\x1B[38;2;43;82;255mMINIMAX\x1B[0m \x1B[2m${r.dashboard}\x1B[0m${" ".repeat(M)}\x1B[2m${r.week}:\x1B[0m \x1B[38;2;6;184;212m${y}\x1B[0m`:`${w}${" ".repeat(M)}${_}`,b=g(w)+M+g(_);if(console.log(""),console.log(he(x,"╭","─","╮",i)),console.log(Li(G,x,b,i)),t.length===0){console.log(he(x,"╰","─","╯",i)),console.log(`
|
|
126
126
|
${r.noData}
|
|
127
|
-
`);return}for(let
|
|
128
|
-
`),i.every((
|
|
129
|
-
`)
|
|
127
|
+
`);return}for(let v of o){console.log(he(x,"├","─","┤",i));let j=`${i?`\x1B[1m${v.displayName}\x1B[0m`:v.displayName}${" ".repeat(Math.max(1,m-g(v.displayName)+2))}${v.current}${" ".repeat(Math.max(1,n-g(v.current)+2))}${v.weekly}${" ".repeat(Math.max(1,p-g(v.weekly)+2))}`+v.reset;console.log(Li(j,x,g(j),i))}console.log(he(x,"╰","─","╯",i)),console.log("")}var ap,Tp,Jp,zp=16,lt=10,Zp=200,lp="∞",fp="无限",Pp="unlimited";var Re=h(()=>{ap={dashboard:"TokenPlan Quota",week:"Week",current:"Left",weekly:"Wk left",resetsIn:"Reset",noData:"No quota data available.",now:"now",notInPlan:"not in plan"},Tp={dashboard:"TokenPlan 配额面板",week:"周期",current:"剩余",weekly:"周剩余",resetsIn:"重置",noData:"暂无配额数据",now:"即将",notInPlan:"不在当前套餐中"},Jp={general:"通用",video:"视频"}});function Ep(t){return Z[t]+Ip}async function Lp(t,e,i){let r=[{Authorization:`Bearer ${e}`},{"x-api-key":e}],o=!1,m=!1;for(let n of r){let p;try{p=await fetch(Ep(t),{headers:{...n,"Content-Type":"application/json"},signal:AbortSignal.timeout(i)})}catch{o=!0;continue}if(p.status===401||p.status===403)continue;if(!p.ok){m=!0;continue}try{if((await p.json()).base_resp?.status_code===0)return"authorized";m=!0}catch{m=!0}}if(m)return"inconclusive";if(o)return"unreachable";return"unauthorized"}async function be(t){process.stderr.write("Detecting region...");let e=Object.keys(Z),i=await Promise.all(e.map(async(m)=>({region:m,result:await Lp(m,t,5000)}))),r=i.find((m)=>m.result==="authorized");if(!r){if(process.stderr.write(` failed
|
|
128
|
+
`),i.every((m)=>m.result==="unauthorized"))throw new c("API key was rejected by all regions.",s.AUTH,"No credentials were changed. Check that the key is valid and belongs to a Token Plan.");if(i.some((m)=>m.result==="unreachable"))throw new c("Could not reach the regional API endpoints.",s.NETWORK,"No region was changed. Check the network or proxy, then retry or pass --region global|cn explicitly.");throw new c("Could not determine the API key region.",s.GENERAL,"No region was changed because the API returned an inconclusive response. Retry later or pass --region global|cn explicitly.")}let o=r.region;return process.stderr.write(` ${o}
|
|
129
|
+
`),o}async function Ci(t){let e=Q();e.region=t,await f(e)}var Ip="/v1/token_plan/remains";var _n=h(()=>{nt();mt();k();d()});function Fp(t){if(t instanceof c)return t.exitCode===s.NETWORK||t.exitCode===s.TIMEOUT;if(!(t instanceof Error))return!1;if(t.name==="AbortError"||t.name==="TimeoutError")return!0;let e=t.message.toLowerCase(),i="code"in t?String(t.code).toLowerCase():"";return t instanceof TypeError&&e==="fetch failed"||e.includes("failed to fetch")||e.includes("unable to connect")||e.includes("connection refused")||e.includes("econnrefused")||e.includes("connection reset")||e.includes("econnreset")||e.includes("network error")||e.includes("enotfound")||e.includes("getaddrinfo")||e.includes("proxy")||e.includes("socket")||e.includes("etimedout")||i==="connectionrefused"||i==="econnrefused"||i==="econnreset"||i==="enotfound"||i==="etimedout"}async function Cp(t){try{let e=St(t.baseUrl),i=await q(t,{url:e});Tt(i.model_remains||[],t)}catch{}}async function tr(t){let{registry:e}=await Promise.resolve().then(() => (Se(),ir));e.printHelp([],process.stderr,t.region),await Cp(t)}async function gi(t,e){await mn(e);let i=Q(),r={...t,region:e,baseUrl:i.oauth?.resource_url||Z[e]};await tr(r)}async function Di(t,e,i){if(t.dryRun){console.log("Would validate and save API key.");return}let r=i??await be(e),o={...t,region:r,baseUrl:Z[r],apiKey:e};try{await q(o,{url:St(o.baseUrl)})}catch(n){if(n instanceof c&&n.exitCode===s.AUTH)throw new c("API key validation failed.",s.AUTH,"Check that your key is valid and belongs to a Token Plan.");if(!i)throw n;let p=Fp(n)?`the ${r} API endpoint is unreachable`:`the ${r} API endpoint returned an inconclusive response`;process.stderr.write(`Warning: Could not validate the API key because ${p}.
|
|
130
130
|
Saving the explicitly selected region "${r}". Requests may fail until validation succeeds.
|
|
131
|
-
`)}let
|
|
132
|
-
`),await
|
|
131
|
+
`)}let m=Q();delete m.oauth,m.api_key=e,m.region=r,await f(m),process.stderr.write(`API key saved to ${it()}
|
|
132
|
+
`),await tr(o)}var er;var nr=h(()=>{J();k();d();pn();O();Re();_n();kt();mt();nt();er=A({name:"auth login",description:"Authenticate via OAuth or API key",usage:"mmx auth login [--api-key <key>] [--recommend] [--region=global|cn]",options:[{flag:"--api-key <key>",description:"Skip the menu and save this API key directly"},{flag:"--recommend",description:"Skip the menu, go straight to OAuth (combine with --region= to skip the region picker)"}],examples:["mmx auth login","mmx auth login --api-key sk-cp-xxxxx","mmx auth login --recommend","mmx auth login --recommend --region=global","mmx auth login --recommend --region=cn"],async run(t,e){let i=process.env.MINIMAX_API_KEY;if(i&&!e.apiKey){let m=E(i);if(N({nonInteractive:t.nonInteractive})){let{confirm:n,isCancel:p}=await Promise.resolve().then(() => (ht(),vt)),u=await n({message:`MINIMAX_API_KEY is set (${m}). Configure persistent credentials anyway?`,initialValue:!1});if(p(u)||!u)process.stdout.write(`Login skipped. Using environment variable.
|
|
133
133
|
`),process.exit(0)}else process.stderr.write(`Warning: MINIMAX_API_KEY is already set in environment.
|
|
134
|
-
`)}if(
|
|
135
|
-
`);try{let
|
|
136
|
-
Or set $MINIMAX_API_KEY`},i))}}})});var
|
|
137
|
-
`);return}if(i)await
|
|
138
|
-
`);if(
|
|
139
|
-
`)}}})});async function*
|
|
140
|
-
${
|
|
141
|
-
`);r=u.pop()||"";for(let
|
|
142
|
-
`),process.exit(1)
|
|
134
|
+
`)}if(e.apiKey){await Di(t,e.apiKey,e.region);return}if(t.dryRun){console.log("Would prompt for auth method (oauth-global, oauth-cn, api-key).");return}if(!N({nonInteractive:t.nonInteractive}))throw new c("--api-key is required in non-interactive mode.",s.USAGE,"mmx auth login --api-key sk-xxxxx");if(e.recommend){let m=e.region||await Vi();await gi(t,m);return}let r=await on();if(r==="api-key"){let{text:m,isCancel:n}=await Promise.resolve().then(() => (ht(),vt)),p=await m({message:"Paste your MiniMax API key:",validate:(u)=>u&&u.length>0?void 0:"API key cannot be empty."});if(n(p))throw new c("Authentication cancelled.",s.AUTH);await Di(t,p,e.region);return}let o=e.region||(r==="oauth-cn"?"cn":"global");await gi(t,o)}})});var rr;var or=h(()=>{J();sn();ct();Y();O();Re();rr=A({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,e){try{let i=await ce(t),r=V(t.output);if(r!=="text"){let m={method:i.method,source:i.source};if(i.method==="oauth"){let n=await L();if(n){if(m.token_expires=n.expires_at,n.account)m.account=n.account}}else m.key=E(i.token);console.log(S(m,r));return}console.log("Authentication Status:"),console.log(` Method: ${i.method}`),console.log(` Source: ${i.source}`);let o=i.token;if(console.log(` Key: ${E(o)}`),i.method==="oauth"){let m=await L();if(m){if(m.account)console.log(` Account: ${m.account}`);let n=new Date(m.expires_at),p=Math.round((n.getTime()-Date.now())/60000);console.log(` Expires in: ${p} minutes`)}}process.stderr.write(`Fetching quota snapshot...
|
|
135
|
+
`);try{let m=St(t.baseUrl),n=await q(t,{url:m,method:"GET"});Tt(n.model_remains||[],t)}catch(m){console.log(` Quota fetch failed: ${m.message}`)}}catch{let i=V(t.output);console.log(S({authenticated:!1,message:"Not authenticated.",hint:`Run: mmx auth login
|
|
136
|
+
Or set $MINIMAX_API_KEY`},i))}}})});var mr;var pr=h(()=>{J();k();d();ct();un();Y();mr=A({name:"auth refresh",description:"Manually refresh OAuth token",usage:"mmx auth refresh",examples:["mmx auth refresh"],async run(t,e){let i=await L();if(!i)throw new c("Not applicable: not authenticated via OAuth.",s.USAGE,"Run mmx auth login first.");if(t.dryRun){console.log("Would refresh OAuth token.");return}let r=await $n(i.refresh_token,i.region??"global"),o={access_token:r.access_token,refresh_token:r.refresh_token,expires_at:r.expires_at,region:i.region,resource_url:r.resource_url??i.resource_url,account:i.account};await ue(o);let m=V(t.output);if(t.quiet){console.log(o.expires_at);return}console.log(S({status:"Token refreshed",expires:o.expires_at},m))}})});var $r;var ur=h(()=>{J();ct();mt();$r=A({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,e){let i=await L(),o=!!Q().api_key;if(t.dryRun){if(i)console.log("Would clear oauth from ~/.mmx/config.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&&!o){process.stderr.write(`No credentials to clear.
|
|
137
|
+
`);return}if(i)await Gi(),process.stderr.write(`Cleared oauth from ~/.mmx/config.json
|
|
138
|
+
`);if(o){let m=Q();delete m.api_key,await f(m),process.stderr.write(`Cleared api_key from ~/.mmx/config.json
|
|
139
|
+
`)}}})});async function*Jt(t){let e=t.body?.getReader();if(!e)return;let i=new TextDecoder,r="",o={},m=(n)=>{let p=n.endsWith("\r")?n.slice(0,-1):n;if(p===""){let w=o.data!==void 0?{data:o.data,event:o.event,id:o.id}:void 0;return o={},w}if(p.startsWith(":"))return;let u=p.indexOf(":");if(u===-1)return;let x=p.slice(0,u),y=p.slice(u+1).trimStart();switch(x){case"data":o.data=o.data!==void 0?`${o.data}
|
|
140
|
+
${y}`:y;break;case"event":o.event=y;break;case"id":o.id=y;break}return};try{while(!0){let{done:n,value:p}=await e.read();if(n)break;r+=i.decode(p,{stream:!0});let u=r.split(`
|
|
141
|
+
`);r=u.pop()||"";for(let x of u){let y=m(x);if(y)yield y}}if(r+=i.decode(),r.length>0){let n=m(r);if(n)yield n}if(o.data!==void 0)yield{data:o.data,event:o.event,id:o.id}}finally{e.releaseLock()}}import{readFileSync as yn}from"fs";function cr(t,e,i){let r=(1-Math.abs(2*i-1))*e,o=r*(1-Math.abs(t/60%2-1)),m=i-r/2,n=0,p=0,u=0;if(t<60)n=r,p=o;else if(t<120)n=o,p=r;else if(t<180)p=r,u=o;else if(t<240)p=o,u=r;else if(t<300)n=o,u=r;else n=r,u=o;return[Math.round((n+m)*255),Math.round((p+m)*255),Math.round((u+m)*255)]}class xr{frame=0;startTime=0;timer=null;out;noColor;constructor(t,e){this.out=t,this.noColor=e}start(){this.frame=0,this.startTime=Date.now(),this.tick(),this.timer=setInterval(()=>this.tick(),80)}stop(){if(this.timer)clearInterval(this.timer),this.timer=null;this.out.write("\r\x1B[0K")}tick(){let t=sr[this.frame%sr.length],e=Math.floor((Date.now()-this.startTime)/1000),i=e>=60?`Thinking (${Math.floor(e/60)}m ${e%60}s)`:`Thinking (${e}s)`;if(this.frame++,this.noColor)this.out.write(`\r${t} ${i}\x1B[0K`);else{let[r,o,m]=cr(this.frame*17%360,0.85,0.55),[n,p,u]=cr((this.frame*17+40)%360,0.85,0.55);this.out.write(`\r\x1B[38;2;${r};${o};${m}m${t}\x1B[0m \x1B[38;2;${n};${p};${u}m${i}\x1B[0m\x1B[0K`)}}}function gp(t){let e=[],i;if(t.system)i=t.system;if(t.messagesFile){let r=t.messagesFile,o=r==="-"?yn("/dev/stdin","utf-8"):yn(r,"utf-8"),m=JSON.parse(o);for(let n of m)if(n.role==="system")i=typeof n.content==="string"?n.content:"";else e.push(n)}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 m of o){let n=m.indexOf(":"),p=n!==-1?m.slice(0,n):"";if(r.has(p)){let u=m.slice(n+1);if(p==="system")i=u;else e.push({role:p,content:u})}else e.push({role:"user",content:m})}}return{system:i,messages:e}}function Dp(t){return t.filter((e)=>e.type==="text").map((e)=>e.text).join("")}var sr,_r;var yr=h(()=>{J();O();Y();k();d();st();sr=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];_r=A({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-M3)"},{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-M3 --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,e){let{system:i,messages:r}=gp(e),o=r;if(o.length===0)if(N({nonInteractive:t.nonInteractive})){let y=await tt({message:"Enter your message:"});if(!y)process.stderr.write(`Chat cancelled.
|
|
142
|
+
`),process.exit(1);o=[{role:"user",content:y}]}else Rt("message","mmx text chat --message <text>");let m=e.model||t.defaultTextModel||"MiniMax-M3",n=V(t.output),p=e.stream===!0||e.stream===void 0&&n!=="json"&&process.stdout.isTTY,u={model:m,messages:o,max_tokens:e.maxTokens??4096,stream:p};if(i)u.system=i;if(e.temperature!==void 0)u.temperature=e.temperature;if(e.topP!==void 0)u.top_p=e.topP;if(e.tool){let y=e.tool.map((w)=>{try{return JSON.parse(w)}catch{try{let _=yn(w,"utf-8");return JSON.parse(_)}catch{throw new c(`Invalid tool definition: "${w}" is neither valid JSON nor a readable file.`,s.USAGE)}}});u.tools=y}if(t.dryRun){console.log(S({request:u},n));return}let x=_e(t.baseUrl);if(p){let y=await et(t,{url:x,method:"POST",body:u,stream:!0,authStyle:"x-api-key"}),w=y.headers.get("content-type")||"";if(!w.includes("text/event-stream")&&!w.includes("stream"))throw new c(`Expected SSE stream but got content-type "${w}". Server may be experiencing issues.`,s.GENERAL);let _="",M=!1,G=t.noColor?"":"\x1B[2m",b=t.noColor?"":"\x1B[0m",v=n==="json",j=process.stdout.isTTY&&!v?process.stderr:process.stderr,U=v?void 0:process.stdout,T=new xr(j,t.noColor);for await(let K of Jt(y)){if(K.data==="[DONE]")break;try{let a=JSON.parse(K.data);if(a.type==="content_block_start"){if(a.content_block.type==="thinking")M=!0,T.start();else if(a.content_block.type==="text"&&M)T.stop(),M=!1,j.write(`${b}
|
|
143
143
|
Response:
|
|
144
|
-
`)}else if(
|
|
145
|
-
${G}[warning] Failed to parse stream chunk: ${
|
|
146
|
-
`)}}if(M)
|
|
147
|
-
`)}else{let
|
|
144
|
+
`)}else if(a.type==="content_block_delta"){if(a.delta.type==="text_delta")_+=a.delta.text,U?.write(a.delta.text)}}catch(a){process.stderr.write(`
|
|
145
|
+
${G}[warning] Failed to parse stream chunk: ${a instanceof Error?a.message:String(a)}${b}
|
|
146
|
+
`)}}if(M)T.stop();if(n==="json")console.log(S({content:_},n));else U?.write(`
|
|
147
|
+
`)}else{let y=await q(t,{url:x,method:"POST",body:u,authStyle:"x-api-key"}),w=Dp(y.content);if(t.quiet||n==="text")console.log(w);else console.log(S(y,n))}}})});import{writeFileSync as t$}from"node:fs";function wr(t){return`\x1B[${t}A`}function e$(t){return`\x1B[${t}B`}function wn(t){return`\x1B[${t}G`}function Ge(){return"\x1B[2K"}function n$(){return"\x1B[0J"}function o$(){process.stdout.write(`
|
|
148
148
|
Available commands:
|
|
149
|
-
`);for(let[t,
|
|
149
|
+
`);for(let[t,e]of Object.entries(vn))process.stdout.write(` ${t.padEnd(Mr+2)} ${e}
|
|
150
150
|
`);process.stdout.write(`
|
|
151
|
-
`)}class
|
|
152
|
-
`){let
|
|
153
|
-
`),this.lastTotal=0;let
|
|
154
|
-
`,
|
|
155
|
-
`,
|
|
156
|
-
`,i)for(let
|
|
157
|
-
`;if(
|
|
158
|
-
${
|
|
159
|
-
`),process.stdout.write(`${i}Model: ${
|
|
160
|
-
`)
|
|
151
|
+
`)}class vr{buffer="";cursor=0;history=[];historyIdx=-1;out;promptLen;dim;reset;width;lastTotal=0;resolve=null;constructor(t,e,i,r){this.out=t,this.promptLen=e.length,this.dim=i,this.reset=r,this.width=t.columns||80}readLine(){return new Promise((t)=>{this.buffer="",this.cursor=0,this.lastTotal=0,this.resolve=t,this.render()})}feed(t){let e=t.toString(),i=0;while(i<e.length){let r=e[i];if(r==="\x1B"&&i+1<e.length&&e[i+1]==="["){let o=e.slice(i,i+3);if(o==="\x1B[A"){this.historyUp(),i+=3;continue}if(o==="\x1B[B"){this.historyDown(),i+=3;continue}if(o==="\x1B[C"){if(this.cursor<this.buffer.length)this.cursor++;this.render(),i+=3;continue}if(o==="\x1B[D"){if(this.cursor>0)this.cursor--;this.render(),i+=3;continue}if(o==="\x1B[H"){this.cursor=0,this.render(),i+=3;continue}if(o==="\x1B[F"){this.cursor=this.buffer.length,this.render(),i+=3;continue}if(i+3<e.length&&e.slice(i,i+4)==="\x1B[3~"){if(this.cursor<this.buffer.length)this.buffer=this.buffer.slice(0,this.cursor)+this.buffer.slice(this.cursor+1);this.render(),i+=4;continue}i+=1;continue}if(r==="\r"||r===`
|
|
152
|
+
`){let o=this.buffer;if(o.trim())this.history.push(o),this.historyIdx=-1;let m=this.lastTotal>0?this.lastTotal-1:0;this.out.write(e$(m)+`
|
|
153
|
+
`),this.lastTotal=0;let n=this.resolve;if(this.resolve=null,n)n(o);i++;continue}if(r===""||r==="\b"){if(this.cursor>0)this.buffer=this.buffer.slice(0,this.cursor-1)+this.buffer.slice(this.cursor),this.cursor--;this.render(),i++;continue}if(r==="\x01"){this.cursor=0,this.render(),i++;continue}if(r==="\x05"){this.cursor=this.buffer.length,this.render(),i++;continue}if(r==="\x15"){this.buffer="",this.cursor=0,this.render(),i++;continue}if(r==="\x17"){let o=this.buffer.slice(0,this.cursor),m=this.buffer.slice(this.cursor),n=o.replace(/\S+\s*$/,"");this.cursor=n.length,this.buffer=n+m,this.render(),i++;continue}if(r==="\t"){if(this.buffer.startsWith("/")){let o=Mn.filter((m)=>m.startsWith(this.buffer));if(o.length===1)this.buffer=o[0],this.cursor=this.buffer.length,this.render()}i++;continue}if(r.charCodeAt(0)>=32){this.buffer=this.buffer.slice(0,this.cursor)+r+this.buffer.slice(this.cursor),this.cursor++,this.render(),i++;continue}i++}}historyUp(){if(this.history.length===0)return;if(this.historyIdx===-1)this.historyIdx=this.history.length-1;else if(this.historyIdx>0)this.historyIdx--;this.buffer=this.history[this.historyIdx],this.cursor=this.buffer.length,this.render()}historyDown(){if(this.historyIdx===-1)return;if(this.historyIdx<this.history.length-1)this.historyIdx++,this.buffer=this.history[this.historyIdx];else this.historyIdx=-1,this.buffer="";this.cursor=this.buffer.length,this.render()}border(){return this.dim+"─".repeat(this.width)+this.reset}render(){let t=this.buffer.startsWith("/")?Mn.filter((n)=>n.startsWith(this.buffer)):[],e=t.length===1&&t[0]===this.buffer,i=t.length>0&&!e,r=i?t.length:0,o=3+r,m="";if(this.lastTotal>0)m+=wr(1);if(m+=wn(1)+Ge()+this.border()+`
|
|
154
|
+
`,m+=Ge()+"> "+this.buffer+`
|
|
155
|
+
`,m+=wn(1)+Ge()+this.border()+`
|
|
156
|
+
`,i)for(let n of t)m+=Ge()+` ${this.dim}${n.padEnd(Mr+2)} ${vn[n]}${this.reset}
|
|
157
|
+
`;if(o<this.lastTotal)m+=n$();m+=wr(r+2),m+=wn(this.promptLen+this.cursor+1),this.out.write(m),this.lastTotal=o}}var i$="\x1B[?25l",r$="\x1B[?25h",vn,Mn,Mr,hr;var Rr=h(()=>{J();O();k();d();vn={"/exit":"Exit the conversation","/clear":"Clear conversation history (keeps system prompt)","/system":"Show or set the system prompt. Usage: /system [new prompt]","/model":"Show or set the model. Usage: /model [model-id]","/save":"Save conversation to a JSON file. Usage: /save <path>","/help":"Show available slash commands","/history":"Show conversation messages with content preview"},Mn=Object.keys(vn),Mr=Math.max(...Mn.map((t)=>t.length));hr=A({name:"text repl",description:"Start an interactive multi-turn chat session",usage:"mmx text repl [flags]",options:[{flag:"--model <model>",description:"Model ID (default: MiniMax-M3)"},{flag:"--system <text>",description:"System prompt"},{flag:"--max-tokens <n>",description:"Maximum tokens per response (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"}],examples:["mmx text repl",'mmx text repl --model MiniMax-M3 --system "You are a coding assistant."',"mmx text repl --temperature 0.7 --max-tokens 8192"],async run(t,e){if(!N({nonInteractive:t.nonInteractive}))throw new c("The repl command requires an interactive terminal.",s.USAGE,"mmx text repl");if(!process.stdin.isTTY)throw new c("The repl command requires a TTY.",s.USAGE);let i=t.noColor?"":"\x1B[2m",r=t.noColor?"":"\x1B[0m",o={messages:[],system:e.system,model:e.model||t.defaultTextModel||"MiniMax-M3",maxTokens:e.maxTokens??4096,temperature:e.temperature!==void 0?e.temperature:void 0,topP:e.topP!==void 0?e.topP:void 0},m=t.noColor?"":"\x1B[1m";if(process.stdout.write(`
|
|
158
|
+
${m}MiniMax Chat REPL${r}
|
|
159
|
+
`),process.stdout.write(`${i}Model: ${o.model}${r}
|
|
160
|
+
`),o.system)process.stdout.write(`${i}System: ${o.system.slice(0,80)}${o.system.length>80?"...":""}${r}
|
|
161
161
|
`);process.stdout.write(`${i}Type / to see commands, /exit to quit.${r}
|
|
162
|
-
`);let{stdin:
|
|
163
|
-
`);return}let
|
|
164
|
-
`);else if(
|
|
162
|
+
`);let{stdin:n,stdout:p}=process;if(typeof n.setRawMode==="function")n.setRawMode(!0);n.resume(),n.setEncoding("utf8");let u=!1,x=0;async function y(){if(o.messages.length===0){p.write(`${i}No messages to send. Type something first.${r}
|
|
163
|
+
`);return}let b={model:o.model,messages:o.messages,max_tokens:o.maxTokens,stream:!0};if(o.system)b.system=o.system;if(o.temperature!==void 0)b.temperature=o.temperature;if(o.topP!==void 0)b.top_p=o.topP;u=!0;let v=_e(t.baseUrl);try{let B=await et(t,{url:v,method:"POST",body:b,stream:!0,authStyle:"x-api-key"}),j=B.headers.get("content-type")||"";if(!j.includes("text/event-stream")&&!j.includes("stream"))throw new c(`Expected SSE stream but got content-type "${j}".`,s.GENERAL);let U="",T=!1;for await(let K of Jt(B)){if(K.data==="[DONE]")break;try{let a=JSON.parse(K.data);if(a.type==="content_block_start"){if(a.content_block.type==="thinking")T=!0,p.write(`${i}Thinking:
|
|
164
|
+
`);else if(a.content_block.type==="text"&&T)p.write(`${r}
|
|
165
165
|
Response:
|
|
166
|
-
`),
|
|
167
|
-
`);else
|
|
168
|
-
`)}catch(
|
|
169
|
-
`)}finally{u=!1,
|
|
170
|
-
`),"exit";case"/help":return
|
|
171
|
-
`),"ok";case"/system":{if(
|
|
172
|
-
`);else if(
|
|
173
|
-
${
|
|
174
|
-
`);else
|
|
175
|
-
`);return"ok"}case"/model":{if(
|
|
176
|
-
`);else
|
|
177
|
-
`);return"ok"}case"/save":{if(!
|
|
178
|
-
`),"ok";try{let
|
|
179
|
-
`)}catch(
|
|
180
|
-
`)}return"ok"}case"/history":{if(
|
|
181
|
-
`),"ok";if(
|
|
182
|
-
`);let
|
|
183
|
-
`),
|
|
184
|
-
`),"ok"}default:if(
|
|
185
|
-
`),"ok";return"ok"}}let
|
|
166
|
+
`),T=!1}else if(a.type==="content_block_delta"){if(a.delta.type==="text_delta")U+=a.delta.text,p.write(a.delta.text);else if(a.delta.type==="thinking_delta")p.write(a.delta.thinking)}}catch{}}if(T)p.write(r);if(U)o.messages.push({role:"assistant",content:U}),p.write(`
|
|
167
|
+
`);else p.write(`${i}[empty response]${r}
|
|
168
|
+
`)}catch(B){p.write(`${i}[error] ${B instanceof Error?B.message:String(B)}${r}
|
|
169
|
+
`)}finally{u=!1,x=0}}function w(b){let v=b.trim().split(/\s+/),B=v[0],j=v.slice(1).join(" ");switch(B){case"/exit":return p.write(`${i}Goodbye!${r}
|
|
170
|
+
`),"exit";case"/help":return o$(),"ok";case"/clear":return o.messages=[],p.write(`${i}Conversation cleared.${r}
|
|
171
|
+
`),"ok";case"/system":{if(j)o.system=j,p.write(`${i}System prompt set.${r}
|
|
172
|
+
`);else if(o.system)p.write(`${i}System prompt:${r}
|
|
173
|
+
${o.system}
|
|
174
|
+
`);else p.write(`${i}No system prompt set.${r}
|
|
175
|
+
`);return"ok"}case"/model":{if(j)o.model=j,p.write(`${i}Model set to: ${o.model}${r}
|
|
176
|
+
`);else p.write(`${i}Current model: ${o.model}${r}
|
|
177
|
+
`);return"ok"}case"/save":{if(!j)return p.write(`${i}Usage: /save <file-path>${r}
|
|
178
|
+
`),"ok";try{let U=[];if(o.system)U.push({role:"system",content:o.system});for(let T of o.messages)U.push({role:T.role,content:typeof T.content==="string"?T.content:JSON.stringify(T.content)});t$(j,JSON.stringify(U,null,2),"utf-8"),p.write(`${i}Conversation saved to ${j} (${U.length} messages)${r}
|
|
179
|
+
`)}catch(U){p.write(`${i}[error] Failed to save: ${U instanceof Error?U.message:String(U)}${r}
|
|
180
|
+
`)}return"ok"}case"/history":{if(o.messages.length===0)return p.write(`${i}No messages in conversation.${r}
|
|
181
|
+
`),"ok";if(o.system)p.write(`${i}[system] ${o.system.slice(0,100)}${o.system.length>100?"...":""}${r}
|
|
182
|
+
`);let U=1;for(let T of o.messages){let K=T.role==="user"?"user":"assistant",a=typeof T.content==="string"?T.content:"[structured content]",Zt=(a.length>120?a.slice(0,120)+"...":a).replace(/\n/g,"↵"),Lt=` ${String(U).padStart(2)} ${K.padEnd(11)}`;p.write(`${i}${Lt}${r}${Zt}
|
|
183
|
+
`),U++}return p.write(`${i}── ${U-1} messages ──${r}
|
|
184
|
+
`),"ok"}default:if(B.startsWith("/"))return p.write(`${i}Unknown command: ${B}. Type /help for available commands.${r}
|
|
185
|
+
`),"ok";return"ok"}}let _=()=>{if(u){p.write(`
|
|
186
186
|
${i}[interrupted]${r}
|
|
187
|
-
`),
|
|
187
|
+
`),x=0,u=!1;return}if(x++,x>=2){if(p.write(`
|
|
188
188
|
${i}Goodbye!${r}
|
|
189
|
-
`),G=!1,typeof
|
|
189
|
+
`),G=!1,typeof n.setRawMode==="function")n.setRawMode(!1);n.pause(),process.removeListener("SIGINT",_),process.exit(0)}else p.write(`
|
|
190
190
|
${i}Press Ctrl+C again or type /exit to quit.${r}
|
|
191
|
-
`)};process.on("SIGINT",
|
|
192
|
-
`)}}})});import{writeFileSync as
|
|
193
|
-
`);if(
|
|
194
|
-
${
|
|
195
|
-
${
|
|
191
|
+
`)};process.on("SIGINT",_);let M=new vr(p,"> ",i,r),G=!0;n.on("data",(b)=>{M.feed(b)}),p.write(i$);try{while(G){let b=await M.readLine();if(!G)break;let v=b.trim();if(!v)continue;if(v.startsWith("/")){if(w(v)==="exit"){G=!1;break}continue}o.messages.push({role:"user",content:v}),await y()}}finally{if(p.write(r$),typeof n.setRawMode==="function")n.setRawMode(!1);n.pause(),process.removeListener("SIGINT",_),n.removeAllListeners("data"),p.write(`
|
|
192
|
+
`)}}})});import{writeFileSync as m$}from"fs";function Xt(t,e,i,r){if(e){let o=t.data.audio;if(!o)throw new c("API response missing audio data (audio field is empty).",s.GENERAL);if(!/^[0-9a-fA-F]*$/.test(o))throw new c("API returned invalid audio data (not valid hex).",s.GENERAL);if(o.length%2!==0)throw new c("API returned truncated audio data (odd-length hex string).",s.GENERAL);try{m$(e,Buffer.from(o,"hex"))}catch(m){if(m.code==="ENOSPC")throw new c("Disk full — cannot write audio file.",s.GENERAL,"Free up disk space and try again.");throw m}if(r)console.log(e);else console.log(S({saved:e,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(S({url:o,duration_ms:t.extra_info?.audio_length,size_bytes:t.extra_info?.audio_size},i))}}var Ae=h(()=>{Y();k();d()});var br={};Ct(br,{readTextFromPathOrStdin:()=>ft});import{readFileSync as p$}from"fs";function ft(t){return p$(t==="-"?"/dev/stdin":t,"utf-8")}var Be=()=>{};function Gt(t){return t.join(", ")}function Qt(t,e){if(!e.includes(t))throw new c(`Invalid audio format "${t}". Supported: ${Gt(e)}`,s.USAGE)}function Sr(t,e){return $$[t]??e}function Gr(t,e){if(e&&t==="wav")throw new c("wav format is not supported in streaming mode.",s.USAGE,"Use mp3, pcm, flac, pcmu_raw, pcmu_wav, or opus for streaming.")}var hn,Yt,$$;var Ve=h(()=>{k();d();hn=["mp3","pcm","flac","wav","pcmu_raw","pcmu_wav","opus"],Yt=["mp3","wav","pcm"];$$={opus:24000,pcmu_raw:8000,pcmu_wav:8000}});function Ar(t){if(!/^[0-9a-fA-F]+$/.test(t))throw new c("API returned invalid audio data (not valid hex).",s.GENERAL);if(t.length%2!==0)throw new c("API returned truncated audio data (odd-length hex string).",s.GENERAL);return Uint8Array.from(Buffer.from(t,"hex"))}function Br(t,e){let i=e.base_resp?.status_code;if(i!==void 0&&i!==0||e.error)throw Kt(t.status,e,t.url||void 0)}function Vr(){return new c("API stream ended without audio data.",s.GENERAL)}async function*u$(t){let e=t.headers.get("content-type")||"";if(!e.toLowerCase().includes("text/event-stream")){let r;try{r=await t.json()}catch{throw new c(`Expected SSE audio stream but got content-type "${e||"unknown"}".`,s.GENERAL)}Br(t,r);let o=r.data?.audio;if(!o)throw Vr();yield Ar(o);return}let i=!1;for await(let r of Jt(t)){if(!r.data||r.data==="[DONE]")break;let o;try{o=JSON.parse(r.data)}catch(n){throw new c(`Failed to parse audio stream chunk: ${n instanceof Error?n.message:String(n)}`,s.GENERAL)}Br(t,o);let m=o.data?.audio;if(m)i=!0,yield Ar(m);if(o.data?.status===2)break}if(!i)throw Vr()}async function zt(t){process.stdout.on("error",(e)=>{if(e.code==="EPIPE")process.exit(0);throw e});for await(let e of u$(t))if(!process.stdout.write(e))await new Promise((i)=>process.stdout.once("drain",i))}var qe=h(()=>{cn();k();d()});import{writeFileSync as s$}from"fs";var Rn;var qr=h(()=>{J();k();d();O();Y();Ae();Be();Ve();qe();Rn=A({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: ${Gt(hn)} (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,e){let i=e.text??e._positional?.[0];if(e.textFile)i=ft(e.textFile);if(!i)throw new c("--text or --text-file is required.",s.USAGE,'mmx speech synthesize --text "Hello" --out hello.mp3');let r=e.model||t.defaultSpeechModel||"speech-2.8-hd",o=e.voice||"English_expressive_narrator",m=new Date().toISOString().slice(0,19).replace(/[T:]/g,"-"),n=e.format||"mp3";Qt(n,hn),Gr(n,e.stream===!0);let p=e.out??`speech_${m}.${n}`,u="hex",x={model:r,text:i,voice_setting:{voice_id:o,speed:e.speed??void 0,vol:e.volume??void 0,pitch:e.pitch??void 0},audio_setting:{format:e.format||"mp3",sample_rate:e.sampleRate??Sr(n,32000),bitrate:e.bitrate??128000,channel:e.channels??1},output_format:u,stream:e.stream===!0};if(e.language)x.language_boost=e.language;if(e.subtitles)x.subtitle_enable=!0;if(e.pronunciation)x.pronunciation_dict={tone:e.pronunciation};if(rt(t,x))return;let y=V(t.output),w=Yi(t.baseUrl);if(e.stream){let M=await et(t,{url:w,method:"POST",body:x,stream:!0});await zt(M);return}let _=await q(t,{url:w,method:"POST",body:x});if(!t.quiet)process.stderr.write(`[Model: ${r}]
|
|
193
|
+
`);if(Xt(_,p,y,t.quiet),e.subtitles&&_.data.subtitle_file)try{let M=await fetch(_.data.subtitle_file);if(!M.ok)throw new c(`Failed to download subtitle file: ${M.status}`,s.GENERAL);let G=await M.json();if(G?.length){let b=p.replace(/\.[^.]+$/,"")+".srt",v=G.map((B,j)=>{let U=(T)=>{let K=String(Math.floor(T/3600000)).padStart(2,"0"),a=String(Math.floor(T%3600000/60000)).padStart(2,"0"),Et=String(Math.floor(T%60000/1000)).padStart(2,"0"),Zt=String(Math.round(T%1000)).padStart(3,"0");return`${K}:${a}:${Et},${Zt}`};return`${j+1}
|
|
194
|
+
${U(B.time_begin)} --> ${U(B.time_end)}
|
|
195
|
+
${B.text}`}).join(`
|
|
196
196
|
|
|
197
|
-
`);if(
|
|
198
|
-
`)}else if(
|
|
199
|
-
`)}}})});function
|
|
200
|
-
`)}}}}function
|
|
201
|
-
`)}}}var
|
|
202
|
-
Retry ${
|
|
203
|
-
`);await new Promise((
|
|
204
|
-
Download attempt ${
|
|
205
|
-
`)}throw new
|
|
206
|
-
`);let w=[];if(
|
|
207
|
-
`);if(
|
|
208
|
-
`);
|
|
209
|
-
`);await
|
|
210
|
-
`));else console.log(
|
|
197
|
+
`);if(s$(b,v,"utf-8"),!t.quiet)console.log(S({subtitles:b},y));else console.log(b)}}catch(M){if(!t.quiet)process.stderr.write(`Warning: failed to download subtitles: ${M.message}
|
|
198
|
+
`)}else if(e.subtitles&&!_.data.subtitle_file){if(!t.quiet)process.stderr.write(`Warning: subtitles requested but not returned by API
|
|
199
|
+
`)}}})});function c$(t){let e=t.match(/^(.+?)_[A-Z]/);return e?e[1]:t}function x$(t,e){let i=e.toLowerCase();return t.filter((r)=>{let o=c$(r.voice_id).toLowerCase();return o===i||o.startsWith(i+"_")||o.startsWith(i+" (")})}var jr;var dr=h(()=>{J();O();Y();jr=A({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,e){let i=V(t.output);if(t.dryRun){console.log(S({request:{voice_type:"system"}},i));return}let o=(await q(t,{url:Qi(t.baseUrl),method:"POST",body:{voice_type:"system"}})).system_voice??[],m=e.language;if(m){let n=x$(o,m);if(i!=="text"){console.log(S(n,i));return}for(let p of n){let u=p.description?.join("; ")||"",x=p.voice_name?` (${p.voice_name})`:"";if(console.log(` ${p.voice_id}${x}`),u)console.log(` ${u}`)}}else{if(i!=="text"){console.log(S(o.map((n)=>n.voice_id),i));return}for(let n of o)console.log(n.voice_id)}}})});function Ur(t){let e=process.stderr.isTTY,i=0,r=null,o=t;return{start(){if(!e)return;r=setInterval(()=>{process.stderr.write(`\r${kr[i%kr.length]} ${o}`),i++},80)},update(m){o=m},stop(m){if(r)clearInterval(r),r=null;if(e){if(process.stderr.write("\r\x1B[K"),m)process.stderr.write(`${m}
|
|
200
|
+
`)}}}}function ar(t,e=""){let i=process.stderr.isTTY,r=30;return{update(o){if(!i)return;let m=Math.min(1,o/t),n=Math.round(30*m),p=30-n,u="█".repeat(n)+"░".repeat(p),x=`${Math.round(m*100)}%`;process.stderr.write(`\r${e} ${u} ${x}`)},finish(){if(i)process.stderr.write(`
|
|
201
|
+
`)}}}var kr;var bn=h(()=>{kr=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"]});import{createWriteStream as _$,renameSync as y$,unlinkSync as w$}from"fs";async function _t(t,e,i){let r=t.startsWith("http://")?t.replace("http://","https://"):t,o=i?.retries??3,m=i?.retryDelayMs??1000,n;for(let p=0;p<=o;p++)try{if(p>0){let B=m*Math.pow(2,p-1);if(!i?.quiet)process.stderr.write(`
|
|
202
|
+
Retry ${p}/${o} in ${B}ms...
|
|
203
|
+
`);await new Promise((j)=>setTimeout(j,B))}let u=await fetch(r);if(!u.ok)throw new c(`Download failed: HTTP ${u.status}`,s.GENERAL);let x=u.headers.get("content-encoding")?0:Number(u.headers.get("content-length")||0),y=u.body?.getReader();if(!y)throw new c("No response body",s.GENERAL);let w=`${e}.tmp-${process.pid}-${Date.now()}-${p}-${Math.random().toString(36).slice(2)}`,_=_$(w),M=x>0&&!i?.quiet?ar(x,"Downloading"):null,G=0,b=!1,v=!1;try{let B=new Promise((j,U)=>{_.on("error",U)});while(!0){let{done:j,value:U}=await Promise.race([y.read(),B]);if(j)break;if(!_.write(U))await new Promise((K)=>_.once("drain",K));G+=U.byteLength,M?.update(G)}if(x>0&&G!==x)throw new c(`Download truncated: expected ${x} bytes, received ${G}.`,s.NETWORK);b=!0}finally{y.releaseLock(),M?.finish();try{if(!_.destroyed)await new Promise((B,j)=>{_.on("finish",B),_.on("error",j),_.end()}),v=b}finally{if(!v)try{w$(w)}catch{}}}return y$(w,e),{size:G}}catch(u){if(n=u instanceof Error?u:Error(String(u)),!i?.quiet)process.stderr.write(`
|
|
204
|
+
Download attempt ${p+1} failed: ${n.message}
|
|
205
|
+
`)}throw new c(`Download failed after ${o+1} attempts: ${n?.message}`,s.NETWORK,"Check your network connection and proxy settings.")}function je(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`}var de=h(()=>{bn();k();d()});import{readFileSync as M$,existsSync as v$,statSync as h$}from"fs";import{extname as Tr}from"path";function ke(t,e){if(e!==void 0){let m=h$(t).size;if(m>e)throw new c(`Image file is ${(m/1024/1024).toFixed(1)} MB; MiniMax-H3 allows at most ${e/1024/1024} MB.`,s.USAGE,"Use a public URL or mm_file:// file ID for large images.")}let i=Tr(t).toLowerCase(),r=Jr[i]||"image/jpeg",o=M$(t);return`data:${r};base64,${o.toString("base64")}`}function At(t,e){return t.startsWith("http")||t.startsWith("data:")||t.startsWith("mm_file://")?t:ke(t,e)}async function Xr(t){if(t.startsWith("data:"))return t;if(t.startsWith("http://")||t.startsWith("https://")){let i=await fetch(t);if(!i.ok)throw new c(`Failed to download image: HTTP ${i.status}`,s.GENERAL);let o=(i.headers.get("content-type")||"image/jpeg").split(";")[0].trim(),m=await i.arrayBuffer();if(m.byteLength>R$)throw new c(`Image too large (${(m.byteLength/1024/1024).toFixed(1)} MB). Maximum is 50 MB.`,s.USAGE);return`data:${o};base64,${Buffer.from(m).toString("base64")}`}if(!v$(t))throw new c(`File not found: ${t}`,s.USAGE);let e=Tr(t).toLowerCase();if(!Jr[e])throw new c(`Unsupported image format "${e}". Supported: jpg, jpeg, png, webp`,s.USAGE);return ke(t)}var Jr,R$=52428800;var Ue=h(()=>{k();d();Jr={".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png",".webp":"image/webp",".heic":"image/heic",".heif":"image/heif"}});import{mkdirSync as Yr,existsSync as Pt,writeFileSync as Qr}from"fs";import{dirname as b$,join as zr,resolve as Sn}from"path";var Zr;var Nr=h(()=>{J();k();d();O();de();Y();Ue();st();Zr=A({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,e){let i=e.prompt??e._positional?.[0];i=await $e({value:i,message:"Enter your image prompt:",cancelMessage:"Image generation cancelled.",flagName:"prompt",usageHint:"mmx image generate --prompt <text>",nonInteractive:t.nonInteractive});let{width:r,height:o}=e;if(r!==void 0&&o===void 0)throw new c("--width requires --height. Both must be specified together.",s.USAGE);if(o!==void 0&&r===void 0)throw new c("--height requires --width. Both must be specified together.",s.USAGE);if(r!==void 0&&o!==void 0){let _=(M,G)=>{if(G<512||G>2048)throw new c(`--${M} must be between 512 and 2048, got ${G}.`,s.USAGE);if(G%8!==0)throw new c(`--${M} must be a multiple of 8, got ${G}.`,s.USAGE)};_("width",r),_("height",o)}let m=e.out;if(m&&e.n>1)throw new c("--out cannot be used with --n > 1. Use --out-dir instead.",s.USAGE);let n=e.responseFormat||"url",p={model:"image-01",prompt:i,aspect_ratio:r!==void 0&&o!==void 0?void 0:e.aspectRatio||void 0,n:e.n??1,seed:e.seed,width:r,height:o,prompt_optimizer:e.promptOptimizer===!0||void 0,aigc_watermark:e.aigcWatermark===!0||void 0,response_format:n};if(e.subjectRef){let _=e.subjectRef,M=Object.fromEntries(_.split(",").map((b)=>{let v=b.indexOf("=");if(v===-1)return[b,""];return[b.slice(0,v),b.slice(v+1)]})),G={type:M.type||"character"};if(M.image)if(M.image.startsWith("http"))G.image_url=M.image;else G.image_file=ke(Sn(M.image));p.subject_reference=[G]}if(rt(t,p))return;let u=V(t.output),x=zi(t.baseUrl),y=await q(t,{url:x,method:"POST",body:p});if(!t.quiet)process.stderr.write(`[Model: image-01]
|
|
206
|
+
`);let w=[];if(m){let _=b$(Sn(m));if(!Pt(_))Yr(_,{recursive:!0});let M=Sn(m);if(Pt(M))process.stderr.write(`Warning: overwriting existing file: ${M}
|
|
207
|
+
`);if(n==="base64"){let G=(y.data.image_base64||[])[0];if(G)Qr(M,G,"base64")}else{let G=(y.data.image_urls||[])[0];if(G)await _t(G,M,{quiet:t.quiet})}w.push(M)}else{let _=e.outDir??".";if(!Pt(_))Yr(_,{recursive:!0});let M=e.outPrefix||"image";if(n==="base64"){let G=y.data.image_base64||[];for(let b=0;b<G.length;b++){let v=`${M}_${String(b+1).padStart(3,"0")}.jpg`,B=zr(_,v);if(Pt(B))process.stderr.write(`Warning: overwriting existing file: ${B}
|
|
208
|
+
`);Qr(B,G[b],"base64"),w.push(B)}}else{let G=y.data.image_urls||[];for(let b=0;b<G.length;b++){let v=`${M}_${String(b+1).padStart(3,"0")}.jpg`,B=zr(_,v);if(Pt(B))process.stderr.write(`Warning: overwriting existing file: ${B}
|
|
209
|
+
`);await _t(G[b],B,{quiet:t.quiet}),w.push(B)}}}if(u==="json")console.log(S({id:y.data.task_id,saved:w,success_count:y.data.success_count,failed_count:y.data.failed_count},u));else if(t.quiet)console.log(w.join(`
|
|
210
|
+
`));else console.log(S({id:y.data.task_id,saved:w,success_count:y.data.success_count,failed_count:y.data.failed_count},u))}})});async function Gn(t,e){let i=Date.now()+e.timeoutSec*1000,r=Ur("Polling...");if(!t.quiet)r.start();try{while(Date.now()<i){let o=await q(t,{url:e.url});if(e.getStatus&&!t.quiet)r.update(`Status: ${e.getStatus(o)}`);if(e.isComplete(o))return r.stop("Done."),o;if(e.isFailed(o)){r.stop("Failed.");let m=e.getStatus?e.getStatus(o):"failed",n=o?.base_resp?` (${o.base_resp.status_msg})`:"";throw new c(`Task ${m}.${n}`,s.GENERAL,"Check the MiniMax dashboard or --verbose output for details.")}await new Promise((m)=>setTimeout(m,e.intervalSec*1000))}}finally{r.stop()}throw new c("Polling timed out.",s.TIMEOUT,"Try increasing --timeout or check task status manually.")}var Or=h(()=>{O();k();d();bn()});import{existsSync as S$,readFileSync as G$,statSync as A$}from"fs";import{extname as B$}from"path";function Hr(t){let e=/^data:[^;,]+;base64,([\s\S]*)$/.exec(t);if(!e)return;let i=e[1].replace(/\s/g,""),r=i.endsWith("==")?2:i.endsWith("=")?1:0;return Math.max(0,Math.floor(i.length*3/4)-r)}function An(t,e){if(t.startsWith("http://")||t.startsWith("https://")||t.startsWith("mm_file://"))return t;if(t.startsWith("data:"))return e==="audio"?t.replace(/^data:audio\/mpeg;base64,/,"data:audio/mp3;base64,"):t;if(!S$(t))throw new c(`File not found: ${t}`,s.USAGE);let i=B$(t).toLowerCase(),r=V$[e],o=r[i];if(!o){let u=Object.keys(r).map((x)=>x.slice(1)).join(", ");throw new c(`Unsupported ${e} format "${i}". Supported local files: ${u}`,s.USAGE)}let m=Bt[e],n=A$(t).size;if(n>m)throw new c(`${e[0].toUpperCase()}${e.slice(1)} file is ${(n/1024/1024).toFixed(1)} MB; MiniMax-H3 allows at most ${m/1024/1024} MB.`,s.USAGE,"Use a public URL or mm_file:// file ID for large media.");let p=G$(t);return`data:${o};base64,${p.toString("base64")}`}var V$,Bt,Wr=67108864;var Bn=h(()=>{k();d();V$={video:{".mp4":"video/mp4"},audio:{".mp3":"audio/mp3",".wav":"audio/wav"}},Bt={image:31457280,video:52428800,audio:15728640}});function Vt(t){return t===It}function Kr(t){return Vt(t.model)}function lr(t){let e=t.images??[];if(e.length>1&&e.some((n)=>!n.role))throw new W("Each image must specify a role when multiple images are provided.");let i=[{type:"text",text:t.prompt},...e.map((n)=>({type:"image_url",image_url:{url:n.url},role:n.role??"first_frame"})),...(t.referenceVideos??[]).map((n)=>({type:"video_url",video_url:{url:n},role:"reference_video"})),...(t.referenceAudios??[]).map((n)=>({type:"audio_url",audio_url:{url:n},role:"reference_audio"}))],r=i.some((n)=>n.type==="image_url"&&(n.role==="first_frame"||n.role==="last_frame")),o=i.some((n)=>n.type!=="text"&&n.role?.startsWith("reference_")),m={model:It,content:i,resolution:t.resolution??"2K",duration:t.duration??5,ratio:r?"adaptive":t.ratio??(o?"adaptive":"16:9")};if(t.callbackUrl)m.callback_url=t.callbackUrl;return d$(m),m}function d$(t){if(!Vt(t.model))throw new W(`Video Generation V2 only supports ${It}.`);let e=t.content.filter((_)=>_.type==="text");if(!e.some((_)=>_.text.trim().length>0))throw new W("MiniMax-H3 requires a non-empty text content item.");if(e.some((_)=>_.text.length>7000))throw new W("MiniMax-H3 text content must not exceed 7000 characters.");if(t.resolution!=="2K")throw new W("MiniMax-H3 currently only supports 2K resolution.");if(!Number.isInteger(t.duration)||t.duration<4||t.duration>15)throw new W("MiniMax-H3 duration must be an integer from 4 to 15 seconds.");if(t.ratio&&!q$.has(t.ratio))throw new W("MiniMax-H3 ratio must be one of: adaptive, 21:9, 16:9, 4:3, 1:1, 3:4, 9:16.");let i=t.content.filter((_)=>_.type==="image_url"),r=t.content.filter((_)=>_.type==="video_url"),o=t.content.filter((_)=>_.type==="audio_url");if(i.some((_)=>_.role&&!j$.has(_.role)))throw new W("MiniMax-H3 image role must be one of: first_frame, last_frame, reference_image.");if(r.some((_)=>_.role!=="reference_video"))throw new W("MiniMax-H3 video role must be reference_video.");if(o.some((_)=>_.role!=="reference_audio"))throw new W("MiniMax-H3 audio role must be reference_audio.");for(let _ of i)Vn(_.image_url.url,"image");for(let _ of r)Vn(_.video_url.url,"video");for(let _ of o)Vn(_.audio_url.url,"audio");let m=Buffer.byteLength(JSON.stringify(t));if(m>Wr)throw new W(`MiniMax-H3 request body is ${(m/1024/1024).toFixed(1)} MB; the maximum is 64 MB. Use public URLs or mm_file:// file IDs instead of Base64.`);let n=i.filter((_)=>!_.role||_.role==="first_frame"),p=i.filter((_)=>_.role==="last_frame"),u=i.filter((_)=>_.role==="reference_image"),x=n.length>0||p.length>0,y=u.length>0||r.length>0||o.length>0;if(n.length>1||p.length>1)throw new W("MiniMax-H3 accepts at most one first frame and one last frame.");if(u.length>9||r.length>3||o.length>3)throw new W("MiniMax-H3 accepts up to 9 reference images, 3 reference videos, and 3 reference audios.");if(x&&y)throw new W("MiniMax-H3 frame inputs and reference inputs cannot be used together.");if(o.length>0&&u.length===0&&r.length===0)throw new W("MiniMax-H3 reference audio requires at least one reference image or reference video.");if(t.content.every((_)=>_.type==="text")&&(!t.ratio||t.ratio==="adaptive"))throw new W("MiniMax-H3 text-to-video requires a concrete ratio; adaptive is not supported.")}function Vn(t,e){let i=Hr(t),r=Bt[e];if(i!==void 0&&i>r)throw new W(`MiniMax-H3 ${e} input is ${(i/1024/1024).toFixed(1)} MB; the maximum is ${r/1024/1024} MB.`)}var It="MiniMax-H3",q$,j$,W;var qn=h(()=>{Bn();q$=new Set(["adaptive","21:9","16:9","4:3","1:1","3:4","9:16"]),j$=new Set(["first_frame","last_frame","reference_image"]);W=class W extends Error{constructor(t){super(t);this.name="VideoV2InputError"}}});var fr;var Pr=h(()=>{J();k();d();O();Or();de();Y();Ue();Bn();st();qn();fr=A({name:"video generate",description:`Generate a video
|
|
211
|
+
V2: MiniMax-H3 (text/image/video/audio content, 2K)
|
|
211
212
|
T2V: Hailuo-2.3
|
|
212
|
-
I2V: Hailuo-2.3 (default) / Hailuo-2.3-Fast (fast mode, requires --
|
|
213
|
-
SEF: Hailuo-02 (requires --
|
|
214
|
-
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.
|
|
215
|
-
`);if(
|
|
216
|
-
`);return}let
|
|
217
|
-
`)}})});var
|
|
218
|
-
`);if(w==="url"){if(
|
|
219
|
-
`);
|
|
220
|
-
`),process.exit(1);if(!
|
|
213
|
+
I2V: Hailuo-2.3 (default) / Hailuo-2.3-Fast (fast mode, requires --image)
|
|
214
|
+
SEF: Hailuo-02 (requires --image and --last-frame)
|
|
215
|
+
S2V: S2V-01 (requires --subject-image)`,apiDocs:"/docs/api-reference/video-generation-v2-create",usage:"mmx video generate --prompt <text> [flags]",options:[{flag:"--model <model>",description:"Model ID. V2: MiniMax-H3. Legacy: MiniMax-Hailuo-2.3 or MiniMax-Hailuo-2.3-Fast. Auto-switched to Hailuo-02 with --last-frame, or S2V-01 with --subject-image."},{flag:"--prompt <text>",description:"Video description",required:!0},{flag:"--image <path-or-url>",description:"Input image for image-to-video (local path or URL)."},{flag:"--first-frame <path-or-url>",description:"Backward-compatible alias for --image.",hidden:!0},{flag:"--last-frame <path-or-url>",description:"Optional ending image. Legacy SEF also requires --image; MiniMax-H3 supports a last frame alone."},{flag:"--subject-image <path-or-url>",description:"Subject reference image for character consistency (local path or URL). Switches to S2V-01 model."},{flag:"--reference-image <path-or-url>",description:"H3 reference image (repeatable).",type:"array"},{flag:"--reference-video <path-or-url>",description:"H3 reference video (repeatable; local MP4, URL, data URI, or mm_file:// ID).",type:"array"},{flag:"--reference-audio <path-or-url>",description:"H3 reference audio (repeatable; requires a reference image or video).",type:"array"},{flag:"--duration <seconds>",description:"Output duration. H3 supports integer values from 4 to 15 (default: 5).",type:"number"},{flag:"--ratio <ratio>",description:"H3 aspect ratio: adaptive, 21:9, 16:9, 4:3, 1:1, 3:4, or 9:16."},{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',"# H3 text-to-video (Video Generation V2)",'mmx video generate --model MiniMax-H3 --prompt "Ocean waves at sunset"',"# H3 image-to-video",'mmx video generate --model MiniMax-H3 --prompt "The subject walks forward" --image start.jpg',"# H3 reference-to-video",'mmx video generate --model MiniMax-H3 --prompt "Keep the same character" --reference-image character.png --reference-video motion.mp4',"# SEF: first + last frame interpolation (uses Hailuo-02 model)",'mmx video generate --prompt "Walk forward" --image 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,e){let i=e.prompt;i=await $e({value:i,message:"Enter your video prompt:",cancelMessage:"Video generation cancelled.",flagName:"prompt",usageHint:"mmx video generate --prompt <text>",nonInteractive:t.nonInteractive});let r=e.model,o=t.defaultVideoModel||"MiniMax-Hailuo-2.3",m=e.image,n=e.firstFrame;if(m&&n)throw new c("--image and --first-frame are aliases; provide only one.",s.USAGE);let p=m??n,u=Boolean(e.referenceImage||e.referenceVideo||e.referenceAudio||e.duration!==void 0||e.ratio),x;if(r)x=r;else if(Vt(o))x=It;else if(e.lastFrame)x="MiniMax-Hailuo-02";else if(e.subjectImage)x="S2V-01";else x=o;if(e.lastFrame&&e.subjectImage)throw new c("--last-frame and --subject-image cannot be used together (SEF and S2V are different modes).",s.USAGE,"mmx video generate --prompt <text> --image <path> --last-frame <path>");if(r==="MiniMax-Hailuo-2.3-Fast"&&!p)throw new c("MiniMax-Hailuo-2.3-Fast only supports I2V (image-to-video). Use --image to provide an input image.",s.USAGE,"mmx video generate --prompt <text> --model MiniMax-Hailuo-2.3-Fast --image <path>");let y;if(Vt(x)){if(e.subjectImage)throw new c("--subject-image is only supported by the legacy S2V-01 model. Use --reference-image for MiniMax-H3.",s.USAGE,"mmx video generate --model MiniMax-H3 --prompt <text> --reference-image <path>");let ot=[...p?[{url:At(p,Bt.image),role:"first_frame"}]:[],...e.lastFrame?[{url:At(e.lastFrame,Bt.image),role:"last_frame"}]:[],...(e.referenceImage??[]).map((H)=>({url:At(H,Bt.image),role:"reference_image"}))];try{y=lr({prompt:i,images:ot,referenceVideos:(e.referenceVideo??[]).map((H)=>An(H,"video")),referenceAudios:(e.referenceAudio??[]).map((H)=>An(H,"audio")),duration:e.duration,ratio:e.ratio,callbackUrl:e.callbackUrl})}catch(H){if(H instanceof W)throw new c(H.message,s.USAGE,"mmx video generate --model MiniMax-H3 --prompt <text>");throw H}}else{if(u)throw new c("--reference-image, --reference-video, --reference-audio, --duration, and --ratio require --model MiniMax-H3.",s.USAGE);if(y={model:x,prompt:i},p)y.first_frame_image=At(p);if(e.lastFrame){if(!p)throw new c("--last-frame requires --image (SEF mode).",s.USAGE,"mmx video generate --prompt <text> --image <path> --last-frame <path>");y.last_frame_image=At(e.lastFrame)}if(e.subjectImage)y.subject_reference=[{type:"character",image:[At(e.subjectImage)]}];if(e.callbackUrl)y.callback_url=e.callbackUrl}if(rt(t,y))return;let w=V(t.output),_=Kr(y),M=_?Ni(t.baseUrl):Zi(t.baseUrl),b=(await q(t,{url:M,method:"POST",body:y})).task_id;if(!t.quiet)process.stderr.write(`[Model: ${x}]
|
|
216
|
+
`);if(e.noWait||t.async){process.stdout.write(JSON.stringify({taskId:b})),process.stdout.write(`
|
|
217
|
+
`);return}let v=e.pollInterval??5,B,j,U;if(_){let ot=we(t.baseUrl,b),H=await Gn(t,{url:ot,intervalSec:v,timeoutSec:t.timeout,isComplete:(jt)=>jt.task.status==="succeeded",isFailed:(jt)=>["failed","cancelled","expired"].includes(jt.task.status),getStatus:(jt)=>jt.task.status});U=H.task.status,B=H.task.content?.url}else{let ot=ye(t.baseUrl,b),H=await Gn(t,{url:ot,intervalSec:v,timeoutSec:t.timeout,isComplete:(Nt)=>Nt.status==="Success",isFailed:(Nt)=>Nt.status==="Failed",getStatus:(Nt)=>Nt.status});if(U=H.status,j=H.file_id,!j)throw new c("Task completed but no file_id returned.",s.GENERAL);B=(await q(t,{url:Me(t.baseUrl,j)})).file?.download_url}if(!B)throw new c("No download URL available for this file.",s.GENERAL);if(e.download){let ot=e.download,{size:H}=await _t(B,ot,{quiet:t.quiet});if(t.quiet)console.log(ot);else console.log(S({task_id:b,status:U,file_id:j,saved:ot,size:je(H)},w));return}let T=await import("os"),{join:K}=await import("path"),a=K(T.tmpdir(),"mmx-video"),{existsSync:Et,mkdirSync:Zt}=await import("fs");if(!Et(a))Zt(a,{recursive:!0});let Lt=K(a,`${b}.mp4`);await _t(B,Lt,{quiet:t.quiet}),process.stdout.write(Lt),process.stdout.write(`
|
|
218
|
+
`)}})});var Ir;var Er=h(()=>{J();k();d();O();Y();qn();Ir=A({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"},{flag:"--model <model>",description:"Use MiniMax-H3 for Video Generation V2 tasks; defaults to the legacy V1 query."}],examples:["mmx video task get --task-id 106916112212032","mmx video task get --task-id 106916112212032 --output json","mmx video task get --task-id 424010985738629 --model MiniMax-H3 --output json"],async run(t,e){let i=e.taskId;if(!i)throw new c("--task-id is required.",s.USAGE,"mmx video task get --task-id <id>");if(t.dryRun){console.log(`Would query task: ${i}`);return}let r=V(t.output),o=e.model;if(Vt(o)){let p=we(t.baseUrl,i),x=(await q(t,{url:p})).task;if(t.quiet){console.log(x.status);return}console.log(S({task_id:x.id,model:x.model,status:x.status,url:x.content?.url,resolution:x.resolution,duration:x.duration,ratio:x.ratio,error:x.error},r));return}let m=ye(t.baseUrl,i),n=await q(t,{url:m});if(t.quiet){console.log(n.status);return}console.log(S({task_id:n.task_id,status:n.status,file_id:n.file_id,video_width:n.video_width,video_height:n.video_height},r))}})});var Lr;var Fr=h(()=>{J();k();d();O();de();Y();Lr=A({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,e){let i=e.fileId;if(!i)throw new c("--file-id is required.",s.USAGE,"mmx video download --file-id <id> --out <path>");let r=e.out;if(!r)throw new c("--out is required.",s.USAGE,"mmx video download --file-id <id> --out video.mp4");if(t.dryRun){console.log(`Would download file ${i} to ${r}`);return}let o=Me(t.baseUrl,i),n=(await q(t,{url:o})).file?.download_url;if(!n)throw new c("No download URL available for this file.",s.GENERAL,"The file may still be processing. Check task status first.");let{size:p}=await _t(n,r,{quiet:t.quiet}),u=V(t.output);if(t.quiet){console.log(r);return}console.log(S({saved:r,size:je(p)},u))}})});function Cr(t,e){return t.includes(e)}function gr(t){if(t.defaultMusicModel&&Cr(ae,t.defaultMusicModel))return t.defaultMusicModel;return"music-3.0"}function Dr(t){if(t.defaultMusicModel&&Cr(Te,t.defaultMusicModel))return t.defaultMusicModel;return"music-cover"}var ae,Te;var jn=h(()=>{ae=["music-3.0","music-2.6","music-2.6-free","music-2.5+","music-2.5"],Te=["music-cover","music-cover-free"]});var to;var eo=h(()=>{J();k();d();O();Y();Ae();Be();Ve();qe();jn();to=A({name:"music generate",description:"Generate a song (music-3.0)",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-3.0 (default), music-2.6, music-2.6-free, 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: ${Gt(Yt)} (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-3.0:",'mmx music generate --prompt "Cinematic orchestral" --model "music-3.0" --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,e){let{prompt:i,lyrics:r}=e,o=e.instrumental===!0,m=e.lyricsOptimizer===!0;if(e.lyricsFile)r=ft(e.lyricsFile);if(o&&(r||e.lyricsFile))throw new c("Cannot use --instrumental with --lyrics or --lyrics-file.",s.USAGE,"mmx music generate --prompt <style> --instrumental");if(m&&(r||o))throw new c("Cannot use --lyrics-optimizer with --lyrics, --lyrics-file, or --instrumental.",s.USAGE,"mmx music generate --prompt <text> --lyrics-optimizer");if(!i&&!r&&!o&&!m)throw new c("At least one of --prompt or --lyrics is required.",s.USAGE,"mmx music generate --prompt <text> --lyrics <text>");if((o||m)&&!i?.trim())throw new c("--prompt is required with --instrumental or --lyrics-optimizer.",s.USAGE,"mmx music generate --prompt <text> --instrumental");if(!o&&!m&&!r?.trim())throw new c("Lyrics are required. Add --lyrics or --lyrics-file, or use --instrumental for pure music, or --lyrics-optimizer to auto-generate.",s.USAGE,"mmx music generate --prompt <text> --lyrics <text>");let n=[];if(e.vocals)n.push(`Vocals: ${e.vocals}`);if(e.genre)n.push(`Genre: ${e.genre}`);if(e.mood)n.push(`Mood: ${e.mood}`);if(e.instruments)n.push(`Instruments: ${e.instruments}`);if(e.tempo)n.push(`Tempo: ${e.tempo}`);if(e.bpm)n.push(`BPM: ${e.bpm}`);if(e.key)n.push(`Key: ${e.key}`);if(e.avoid)n.push(`Avoid: ${e.avoid}`);if(e.useCase)n.push(`Use case: ${e.useCase}`);if(e.structure)n.push(`Structure: ${e.structure}`);if(e.references)n.push(`References: ${e.references}`);if(e.extra)n.push(`Extra: ${e.extra}`);if(n.length>0){let v=n.join(". ");i=i?`${i}. ${v}`:v}let p=new Date().toISOString().slice(0,19).replace(/[T:]/g,"-"),u=e.format||"mp3";Qt(u,Yt);let x=e.out??`music_${p}.${u}`,y=e.model||gr(t);if(e.model&&!ae.includes(y))throw new c(`Invalid model "${y}". Valid models: ${ae.join(", ")}`,s.USAGE,"mmx music generate --model music-3.0");let w=e.outputFormat||"hex";if(w!=="hex"&&w!=="url")throw new c('--output-format must be "hex" or "url".',s.USAGE,"mmx music generate --output-format url");if(e.stream&&w==="url")throw new c("--stream and --output-format url cannot be used together. Streaming requires hex format.",s.USAGE,"mmx music generate --output-format url");let _={model:y,prompt:i,lyrics:r,is_instrumental:o||void 0,lyrics_optimizer:m||void 0,audio_setting:{format:e.format||"mp3",sample_rate:e.sampleRate??44100,bitrate:e.bitrate??256000},output_format:e.stream===!0?"hex":w,stream:e.stream===!0};if(e.aigcWatermark)_.aigc_watermark=!0;if(rt(t,_))return;let M=V(t.output),G=ve(t.baseUrl);if(e.stream){let v=await et(t,{url:G,method:"POST",body:_,stream:!0});await zt(v);return}let b=await q(t,{url:G,method:"POST",body:_});if(!t.quiet)process.stderr.write(`[Model: ${y}]
|
|
219
|
+
`);if(w==="url"){if(b.data?.audio_url)console.log(b.data.audio_url);else throw new c("Requested URL output but API did not return audio_url.",s.GENERAL);return}Xt(b,x,M,t.quiet)}})});import{readFileSync as k$}from"fs";var no;var io=h(()=>{J();k();d();O();Y();Ae();Ve();qe();jn();no=A({name:"music cover",description:"Generate a cover version of a song based on reference audio",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 (default) or music-cover-free."},{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 provided, CLI auto-runs cover preprocess first. If omitted, lyrics are extracted from reference audio via ASR."},{flag:"--lyrics-file <path>",description:"Read lyrics from file (use - for stdin). Triggers cover preprocess automatically."},{flag:"--seed <number>",description:"Random seed 0–1000000 for reproducible results",type:"number"},{flag:"--format <fmt>",description:`Audio format: ${Gt(Yt)} (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','mmx music cover --model music-cover-free --prompt "Jazz, piano, slow" --audio https://example.com/ref.mp3 --out free_cover.mp3'],async run(t,e){let{prompt:i,audio:r,audioFile:o}=e;if(!i)throw new c("--prompt is required.",s.USAGE,"mmx music cover --prompt <text> --audio <url>");if(!r&&!o)throw new c("One of --audio <url> or --audio-file <path> is required.",s.USAGE,"mmx music cover --prompt <text> --audio <url>");if(r&&o)throw new c("Use either --audio or --audio-file, not both.",s.USAGE);let m=e.lyrics;if(e.lyricsFile){let{readTextFromPathOrStdin:B}=await Promise.resolve().then(() => (Be(),br));m=B(e.lyricsFile)}let n=new Date().toISOString().slice(0,19).replace(/[T:]/g,"-"),p=e.format||"mp3";Qt(p,Yt);let u=e.out??`cover_${n}.${p}`,x=V(t.output),y=e.model||Dr(t);if(e.model&&!Te.includes(y))throw new c(`Invalid model "${y}". Valid models: ${Te.join(", ")}`,s.USAGE,"mmx music cover --model music-cover");let w=r?{audio_url:r}:{audio_base64:k$(o).toString("base64")},_={model:y,prompt:i,lyrics:m,seed:e.seed,audio_setting:{format:p,sample_rate:e.sampleRate??44100,bitrate:e.bitrate??256000,channel:e.channel??void 0},output_format:"hex",stream:e.stream===!0,...w},M=Boolean(m?.trim()),G=M?{model:"music-cover",...w}:void 0;if(M)delete _.audio_url,delete _.audio_base64,_.cover_feature_id="__cover_feature_id_from_preprocess__";if(t.dryRun){console.log(S(M?{preprocess_request:G,request:_}:{request:_},x));return}let b=ve(t.baseUrl);if(M){let B=Oi(t.baseUrl),j=await q(t,{url:B,method:"POST",body:G});_.cover_feature_id=j.cover_feature_id}if(e.stream){let B=await et(t,{url:b,method:"POST",body:_,stream:!0});await zt(B);return}let v=await q(t,{url:b,method:"POST",body:_});if(!t.quiet)process.stderr.write(`[Model: ${y}]
|
|
220
|
+
`);Xt(v,u,x,t.quiet)}})});var dn;var ro=h(()=>{J();O();Y();k();d();dn=A({name:"search query",description:"Search the web via MiniMax. Note: the underlying /v1/coding_plan/search API returns at most 10 results per call and does not currently support pagination, so refining your --q is the only way to see different results.",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,e){let i=e.q??e.query??e._positional?.[0];if(!i)throw new c("--q is required.",s.USAGE,'mmx search query --q "your search query"');let r=V(t.output);if(t.dryRun){console.log(S({request:{q:i}},r));return}let o=Wi(t.baseUrl),m=await q(t,{url:o,method:"POST",body:{q:i}}),n=m.organic||[];if(r!=="text"){console.log(S(m,r));return}if(t.quiet){for(let p of n)console.log(`${p.title} ${p.link}`);return}if(n.length===0){console.log("No results found.");return}for(let p of n){if(console.log(`${p.title}`),console.log(` ${p.link}`),p.snippet)console.log(` ${p.snippet}`);if(p.date)console.log(` ${p.date}`);console.log("")}}})});var oo;var mo=h(()=>{J();O();Y();k();d();st();Ue();oo=A({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,e){let i=e.image??e.file??e.path??e._positional?.[0],r=e.fileId,o=e.prompt||"Describe the image.";if(!i&&!r)if(N({nonInteractive:t.nonInteractive})){let x=await tt({message:"Enter image path, URL, or File ID:"});if(!x)process.stderr.write(`Vision describe cancelled.
|
|
221
|
+
`),process.exit(1);if(!x.includes(".")&&!x.startsWith("http"))r=x;else i=x}else throw new c("Missing required argument. Must provide either --image or --file-id.",s.USAGE,"mmx vision describe --image <path> OR --file-id <id>");else if(i&&r)throw new c("Conflicting arguments: cannot provide both --image and --file-id.",s.USAGE);if(rt(t,{prompt:o,image:i,fileId:r}))return;let m=V(t.output),n=Hi(t.baseUrl),p={prompt:o};if(r)p.file_id=r;else if(i){let x=await Xr(i);p.image_url=x}let u=await q(t,{url:n,method:"POST",body:p});if(m!=="text"){process.stdout.write(S(u,m)+`
|
|
221
222
|
`);return}process.stdout.write(u.content+`
|
|
222
|
-
`)}})});var
|
|
223
|
-
`)}catch{throw new
|
|
224
|
-
`)}})});import{existsSync as
|
|
225
|
-
`),process.exit(1)}else
|
|
226
|
-
`);return}let
|
|
227
|
-
`);return}process.stdout.write(
|
|
228
|
-
`)}})});var
|
|
229
|
-
`);return}let r=
|
|
230
|
-
`);return}if(
|
|
231
|
-
`);return}let
|
|
232
|
-
`)}})});var
|
|
233
|
-
`),process.exit(1)}else
|
|
234
|
-
`);return}let
|
|
235
|
-
`);return}process.stdout.write(
|
|
236
|
-
`)}})});var
|
|
223
|
+
`)}})});var po;var $o=h(()=>{J();O();Y();Re();po=A({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,e){if(t.dryRun){console.log("Would fetch quota information.");return}let i=St(t.baseUrl),r=await q(t,{url:i}),o=r.model_remains||[],m=V(e.output);if(m!=="text"){console.log(S(r,m));return}if(t.quiet){for(let n of o){let p=n.current_interval_total_count-n.current_interval_usage_count;console.log(`${n.model_name} ${n.current_interval_usage_count} ${n.current_interval_total_count} ${p}`)}return}Tt(o,t)}})});var uo;var so=h(()=>{J();mt();kt();Y();uo=A({name:"config show",description:"Display current configuration",usage:"mmx config show",examples:["mmx config show","mmx config show --output json"],async run(t,e){let i=Q(),r=V(t.output),o={region:t.region,base_url:t.baseUrl,output:t.output,timeout:t.timeout,config_file:it()};if(i.api_key)o.api_key=E(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;if(i.proxy)o.proxy=i.proxy;console.log(S(o,r))}})});function xo(t,e){return t==="api_key"?E(String(e)):e}var co,U$,_o;var yo=h(()=>{J();k();d();Y();mt();co=["region","base_url","output","timeout","api_key","proxy","default_text_model","default_speech_model","default_video_model","default_music_model"],U$={"default-text-model":"default_text_model","default-speech-model":"default_speech_model","default-video-model":"default_video_model","default-music-model":"default_music_model"};_o=A({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, proxy, 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 proxy --value http://127.0.0.1:7890","mmx config set --key base_url --value https://api-uw.minimax.io"],async run(t,e){let i=e._positional,r=e.key??i?.[0],o=e.value??i?.[1];if(!r||o===void 0)throw new c("--key and --value are required.",s.USAGE,"mmx config set --key <key> --value <value>");let m=U$[r]||r;if(!co.includes(m))throw new c(`Invalid config key "${r}". Valid keys: ${co.join(", ")}`,s.USAGE);let n=m==="api_key"?o.trim():o;if(m==="api_key"&&n.length===0)throw new c("Invalid api_key. The value must not be empty.",s.USAGE);if(m==="region"&&!["global","cn"].includes(o))throw new c(`Invalid region "${o}". Valid values: global, cn`,s.USAGE);if(m==="output"&&!["text","json"].includes(o))throw new c(`Invalid output format "${o}". Valid values: text, json`,s.USAGE);if(m==="base_url"&&!o.startsWith("http"))throw new c(`Invalid base_url "${o}". Must start with http.`,s.USAGE);if(m==="proxy"&&!o.startsWith("http"))throw new c(`Invalid proxy "${o}". Must be a URL starting with http (e.g. http://127.0.0.1:7890).`,s.USAGE);if(m==="timeout"){let x=Number(o);if(isNaN(x)||x<=0)throw new c(`Invalid timeout "${o}". Must be a positive number.`,s.USAGE)}let p=V(t.output);if(t.dryRun){console.log(S({would_set:{[m]:xo(m,n)}},p));return}let u=Q();if(u[m]=m==="timeout"?Number(n):n,m==="api_key")delete u.oauth,delete u.region;if(await f(u),!t.quiet)console.log(S({[m]:xo(m,u[m])},p))}})});function a$(t){let e=t.match(/^--([a-zA-Z0-9-]+)/),i=e?e[1]:"",r=i.replace(/-([a-zA-Z0-9])/g,(n,p)=>p.toUpperCase()),o="string",m=!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"))m=!0;return{name:r,kebabName:i,inferredType:o,isArray:m}}function kn(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){if(r.hidden)continue;let{name:o,inferredType:m,isArray:n}=a$(r.flag);if(!o)continue;let p=r.type,u=n?"array":p??m,x={description:r.description};if(u==="array")x.type="array",x.items={type:"string"};else x.type=u;let y=i.input_schema;if(y.properties[o]=x,r.required)y.required.push(o)}return i}var T$,wo;var Mo=h(()=>{J();Se();k();d();T$=["auth ","config ","update"],wo=A({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,e){let i=e.command;if(i){try{let{command:m}=pt.resolve(i.split(" ")),n=kn(m);process.stdout.write(JSON.stringify(n,null,2)+`
|
|
224
|
+
`)}catch{throw new c(`Command "${i}" not found.`,s.USAGE)}return}let o=pt.getAllCommands().filter((m)=>!T$.some((n)=>m.name.startsWith(n))).map((m)=>kn(m));process.stdout.write(JSON.stringify(o,null,2)+`
|
|
225
|
+
`)}})});import{existsSync as J$}from"fs";import{readFile as X$}from"fs/promises";import{resolve as Y$,basename as Q$}from"path";var vo;var ho=h(()=>{J();k();d();O();Y();st();vo=A({name:"file upload",description:"Upload a file to MiniMax storage",usage:"mmx file upload --file <path> [--purpose <purpose>]",options:[{flag:"--file <path>",description:"Local path to the file",required:!0},{flag:"--purpose <string>",description:"File purpose (default: retrieval)"}],examples:["mmx file upload --file doc.pdf","mmx file upload --file image.png --purpose vision"],async run(t,e){let i=e.file;if(!i)if(N({nonInteractive:t.nonInteractive})){if(i=await tt({message:"Enter file path:"}),!i)process.stderr.write(`Upload cancelled.
|
|
226
|
+
`),process.exit(1)}else Rt("file","mmx file upload --file <path>");let r=Y$(i);if(!J$(r))throw new c(`File not found: ${r}`,s.USAGE);let o=e.purpose||"retrieval",m=V(t.output);if(t.dryRun){process.stdout.write(S({request:{file:r,purpose:o}},m)+`
|
|
227
|
+
`);return}let n=new FormData,p=await X$(r),u=Q$(r),x=new Blob([p]);n.append("file",x,u),n.append("purpose",o);let y=Ki(t.baseUrl),w=await q(t,{url:y,method:"POST",body:n});if(t.quiet){process.stdout.write(w.file.file_id+`
|
|
228
|
+
`);return}process.stdout.write(S(w.file,m)+`
|
|
229
|
+
`)}})});var Ro;var bo=h(()=>{J();O();Y();Ro=A({name:"file list",description:"List uploaded files in MiniMax storage",usage:"mmx file list",examples:["mmx file list","mmx file list --output json"],async run(t,e){let i=V(t.output);if(t.dryRun){process.stdout.write(`Would list uploaded files.
|
|
230
|
+
`);return}let r=li(t.baseUrl),o=await q(t,{url:r,method:"GET"});if(i!=="text"){process.stdout.write(S(o,i)+`
|
|
231
|
+
`);return}if(!o.files||o.files.length===0){process.stdout.write(`No files found.
|
|
232
|
+
`);return}let m=o.files.map((p)=>({ID:p.file_id,FILENAME:p.filename,PURPOSE:p.purpose,SIZE_KB:(p.bytes/1024).toFixed(1),CREATED:new Date(p.created_at*1000).toISOString().slice(0,16).replace("T"," ")})),{formatTable:n}=await Promise.resolve().then(() => Nn);process.stdout.write(n(m)+`
|
|
233
|
+
`)}})});var So;var Go=h(()=>{J();O();Y();st();So=A({name:"file delete",description:"Delete an uploaded file from MiniMax storage",usage:"mmx file delete --file-id <id>",options:[{flag:"--file-id <id>",description:"ID of the file to delete",required:!0}],examples:["mmx file delete --file-id 123456789"],async run(t,e){let i=e.fileId;if(!i)if(N({nonInteractive:t.nonInteractive})){if(i=await tt({message:"Enter file ID to delete:"}),!i)process.stderr.write(`Delete cancelled.
|
|
234
|
+
`),process.exit(1)}else Rt("file-id","mmx file delete --file-id <id>");let r=V(t.output);if(t.dryRun){process.stdout.write(S({request:{delete_file:i}},r)+`
|
|
235
|
+
`);return}let o=fi(t.baseUrl),m=await q(t,{url:o,method:"POST",body:{file_id:Number(i)}});if(t.quiet){process.stdout.write(`deleted
|
|
236
|
+
`);return}process.stdout.write(S({file_id:m.file_id,deleted:!0},r)+`
|
|
237
|
+
`)}})});var Ao;var Bo=h(()=>{J();xe();Ao=A({name:"update",description:"Update mmx to the latest version",usage:"mmx update",examples:["mmx update"],async run(){process.stderr.write(`Current version: ${bt}
|
|
237
238
|
|
|
238
239
|
`),process.stderr.write(`Run:
|
|
239
240
|
`),process.stderr.write(` npm update -g mmx-cli
|
|
240
241
|
|
|
241
|
-
`)}})});var
|
|
242
|
+
`)}})});var z$,Vo;var qo=h(()=>{J();nt();z$=[{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"}],Vo=A({name:"help",description:"Show MiniMax API documentation links",usage:"mmx help",async run(t,e){let i=Ot[t.region]||Ot.global;process.stdout.write(`
|
|
242
243
|
MiniMax API Documentation Links
|
|
243
244
|
|
|
244
245
|
Official docs: ${i}/docs/api-reference
|
|
245
246
|
|
|
246
|
-
`);for(let r of
|
|
247
|
+
`);for(let r of z$)process.stdout.write(` ${r.command.padEnd(30)} ${r.title}
|
|
247
248
|
`),process.stdout.write(` ${" ".repeat(30)} ${i}${r.path}
|
|
248
249
|
|
|
249
|
-
`)}})});var
|
|
250
|
-
`);throw new
|
|
250
|
+
`)}})});var ir={};Ct(ir,{registry:()=>pt});class jo{root={children:new Map};constructor(t){for(let[e,i]of Object.entries(t))this.register(e,i)}register(t,e){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=e}getAllCommands(){let t=[],e=(i)=>{if(i.command)t.push(i.command);for(let r of i.children.values())e(r)};return e(this.root),t}resolve(t){let e=this.root,i=[];for(let r of t){let o=e.children.get(r);if(!o)break;e=o,i.push(r)}if(e.command)return{command:e.command,extra:t.slice(i.length)};if(i.length>0&&e.children.size===1){let[,r]=e.children.entries().next().value;if(r.command)return{command:r.command,extra:t.slice(i.length)}}if(i.length>0&&e.children.size>1){let o=Array.from(e.children.values()).map((n)=>n.command),m=o[0];if(m&&o.every((n)=>n===m))return{command:m,extra:t.slice(i.length)}}if(i.length>0&&e.children.size>0){let r=Array.from(e.children.entries()).map(([o,m])=>{if(m.command)return` ${i.join(" ")} ${o} ${m.command.description}`;let n=Array.from(m.children.keys()).join(", ");return` ${i.join(" ")} ${o} [${n}]`}).join(`
|
|
251
|
+
`);throw new c(`Unknown command: mmx ${t.join(" ")}
|
|
251
252
|
|
|
252
253
|
Available commands:
|
|
253
|
-
${r}`,
|
|
254
|
-
${this.bold("Usage:",
|
|
254
|
+
${r}`,s.USAGE,`mmx ${i.join(" ")} --help`)}throw new c(`Unknown command: mmx ${t.join(" ")}`,s.USAGE,"mmx --help")}bold=(t,e)=>e.isTTY?`\x1B[1m${t}\x1B[0m`:t;accent=(t,e)=>e.isTTY?`\x1B[38;2;248;103;58m${t}\x1B[0m`:t;dim=(t,e)=>e.isTTY?`\x1B[2m${t}\x1B[0m`:t;printHelp(t,e=process.stdout,i="global"){if(t.length===0){this.printRootHelp(e);return}let r=this.root;for(let m of t){let n=r.children.get(m);if(!n){this.printRootHelp(e);return}r=n}if(r.command){this.printCommandHelp(r.command,e,i);return}let o=t.join(" ");e.write(`
|
|
255
|
+
${this.bold("Usage:",e)} mmx ${o} <command> [flags]
|
|
255
256
|
|
|
256
|
-
`),
|
|
257
|
-
`),this.printChildren(r
|
|
258
|
-
`)}printRootHelp(t){let
|
|
259
|
-
`);for(let
|
|
260
|
-
`)}else t.write(n
|
|
261
|
-
`);let r=(
|
|
257
|
+
`),e.write(`${this.bold("Commands:",e)}
|
|
258
|
+
`),this.printChildren(r,o,e),e.write(`
|
|
259
|
+
`)}printRootHelp(t){let e=["███╗ ███╗███╗ ███╗██╗ ██╗","████╗ ████║████╗ ████║╚██╗██╔╝","██╔████╔██║██╔████╔██║ ╚███╔╝ ","██║╚██╔╝██║██║╚██╔╝██║ ██╔██╗ ","██║ ╚═╝ ██║██║ ╚═╝ ██║██╔╝ ██╗","╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝"],i=[[240,23,122],[242,43,106],[244,63,90],[246,83,74],[248,103,58],[250,123,42]];t.write(`
|
|
260
|
+
`);for(let n=0;n<e.length;n++)if(t.isTTY){let[p,u,x]=i[n];t.write(`\x1B[1;38;2;${p};${u};${x}m${e[n]}\x1B[0m
|
|
261
|
+
`)}else t.write(e[n]+`
|
|
262
|
+
`);let r=(n)=>this.bold(n,t),o=(n)=>this.accent(n,t),m=(n)=>this.dim(n,t);t.write(`
|
|
262
263
|
${r("Usage:")} mmx <resource> <command> [flags]
|
|
263
264
|
|
|
264
265
|
${r("Resources:")}
|
|
265
|
-
${
|
|
266
|
-
${
|
|
267
|
-
${
|
|
268
|
-
${
|
|
269
|
-
${
|
|
270
|
-
${
|
|
271
|
-
${
|
|
272
|
-
${
|
|
273
|
-
${
|
|
274
|
-
${
|
|
275
|
-
${
|
|
276
|
-
${
|
|
266
|
+
${o("auth")} ${m("Authentication (login, status, refresh, logout)")}
|
|
267
|
+
${o("text")} ${m("Text generation (chat)")}
|
|
268
|
+
${o("speech")} ${m("Speech synthesis (synthesize, voices)")}
|
|
269
|
+
${o("image")} ${m("Image generation (generate)")}
|
|
270
|
+
${o("video")} ${m("Video generation (generate, task get, download)")}
|
|
271
|
+
${o("music")} ${m("Music generation (generate, cover)")}
|
|
272
|
+
${o("search")} ${m("Web search (query)")}
|
|
273
|
+
${o("vision")} ${m("Image understanding (describe)")}
|
|
274
|
+
${o("quota")} ${m("Usage quotas (show)")}
|
|
275
|
+
${o("config")} ${m("CLI configuration (show, set, export-schema)")}
|
|
276
|
+
${o("file")} ${m("File storage (upload, list, delete)")}
|
|
277
|
+
${o("update")} ${m("Update mmx to a newer version")}
|
|
277
278
|
|
|
278
279
|
${r("Global Flags:")}
|
|
279
|
-
${
|
|
280
|
-
${
|
|
281
|
-
${
|
|
282
|
-
${
|
|
283
|
-
${
|
|
284
|
-
${
|
|
285
|
-
${
|
|
286
|
-
${
|
|
287
|
-
${
|
|
288
|
-
${
|
|
289
|
-
${
|
|
290
|
-
${
|
|
280
|
+
${o("--api-key <key>")} ${m("API key (overrides all other auth)")}
|
|
281
|
+
${o("--region <region>")} ${m("API region: global (default), cn")}
|
|
282
|
+
${o("--base-url <url>")} ${m("API base URL (overrides region)")}
|
|
283
|
+
${o("--output <format>")} ${m("Output format: text, json")}
|
|
284
|
+
${o("--quiet")} ${m("Suppress non-essential output")}
|
|
285
|
+
${o("--verbose")} ${m("Print HTTP request/response details")}
|
|
286
|
+
${o("--timeout <seconds>")} ${m("Request timeout (default: 300)")}
|
|
287
|
+
${o("--no-color")} ${m("Disable ANSI colors and spinners")}
|
|
288
|
+
${o("--dry-run")} ${m("Show what would happen without executing")}
|
|
289
|
+
${o("--non-interactive")} ${m("Disable interactive prompts (CI/agent mode)")}
|
|
290
|
+
${o("--version")} ${m("Print version and exit")}
|
|
291
|
+
${o("--help")} ${m("Show help")}
|
|
291
292
|
|
|
292
293
|
${r("Getting Help:")}
|
|
293
|
-
${
|
|
294
|
-
${
|
|
295
|
-
`)}printCommandHelp(t,
|
|
294
|
+
${m("Add --help after any command to see its full list of options, defaults,")}
|
|
295
|
+
${m("and usage examples. For example:")} mmx text chat --help
|
|
296
|
+
`)}printCommandHelp(t,e,i="global"){let r=(p)=>this.bold(p,e),o=(p)=>this.accent(p,e),m=(p)=>this.dim(p,e);if(e.write(`
|
|
296
297
|
${t.description}
|
|
297
|
-
`),t.usage)
|
|
298
|
-
`);
|
|
298
|
+
`),t.usage)e.write(`${r("Usage:")} ${t.usage}
|
|
299
|
+
`);let n=t.options?.filter((p)=>!p.hidden)??[];if(n.length>0){let p=Math.max(...n.map((u)=>u.flag.length));e.write(`
|
|
299
300
|
${r("Options:")}
|
|
300
|
-
`);for(let
|
|
301
|
-
`)}if(t.examples&&t.examples.length>0){
|
|
301
|
+
`);for(let u of n)e.write(` ${o(u.flag.padEnd(p+2))} ${m(u.description)}
|
|
302
|
+
`)}if(t.examples&&t.examples.length>0){e.write(`
|
|
302
303
|
${r("Examples:")}
|
|
303
|
-
`);for(let
|
|
304
|
-
`)}if(t.apiDocs)
|
|
305
|
-
${r("API Reference:")} ${
|
|
306
|
-
`);
|
|
307
|
-
${
|
|
308
|
-
`),
|
|
309
|
-
`)}printChildren(t,
|
|
310
|
-
`)}}var
|
|
304
|
+
`);for(let p of t.examples)e.write(` ${m(p)}
|
|
305
|
+
`)}if(t.apiDocs)e.write(`
|
|
306
|
+
${r("API Reference:")} ${m(Ot[i]+t.apiDocs)}
|
|
307
|
+
`);e.write(`
|
|
308
|
+
${m("Global flags (--api-key, --output, --quiet, etc.) are always available.")}
|
|
309
|
+
`),e.write(`${m("Run")} mmx --help ${m("for the full list.")}
|
|
310
|
+
`)}printChildren(t,e,i){let r=[],o=(n,p)=>{for(let[u,x]of n.children){if(x.command)r.push({fullName:`${p} ${u}`,description:x.command.description});if(x.children.size>0)o(x,`${p} ${u}`)}};o(t,e);let m=Math.max(...r.map((n)=>n.fullName.length));for(let{fullName:n,description:p}of r)i.write(` ${this.accent(n.padEnd(m),i)} ${this.dim(p,i)}
|
|
311
|
+
`)}}var pt;var Se=h(()=>{k();d();nt();nr();or();pr();ur();yr();Rr();qr();dr();Nr();Pr();Er();Fr();eo();io();ro();mo();$o();so();yo();Mo();ho();bo();Go();Bo();qo();pt=new jo({"auth login":er,"auth status":rr,"auth refresh":mr,"auth logout":$r,"text chat":_r,"text repl":hr,"speech synthesize":Rn,"speech generate":Rn,"speech voices":jr,"image generate":Zr,"video generate":fr,"video task get":Ir,"video download":Lr,"music generate":to,"music cover":no,"search query":dn,"search web":dn,"vision describe":oo,"quota show":po,"config show":uo,"config set":_o,"config export-schema":wo,"file upload":vo,"file list":Ro,"file delete":So,update:Ao,help:Vo})});var Ho=new Set(["true","1","yes","on"]),Ko=new Set(["false","0","no","off"]);function Xe(t){return t.replace(/-([a-z])/g,(e,i)=>i.toUpperCase())}function lo(t){let e=t.flag.match(/^--([a-z][a-z0-9-]*)/i);return e?Xe(e[1]):null}function fo(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 Tn(t){let e=new Set,i=new Set,r=new Set;for(let o of t){let m=lo(o);if(!m)continue;if(fo(o))e.add(m);else if(o.type==="number")i.add(m);else if(o.type==="array")r.add(m)}return{booleans:e,numbers:i,arrays:r}}function Jn(t,e=[]){let i=Tn(e),r=[],o=0;while(o<t.length){let m=t[o];if(m==="--")break;if(m.startsWith("--")){let n=m.indexOf("="),p=n!==-1?m.slice(2,n):m.slice(2),u=Xe(p);if(!i.booleans.has(u)&&n===-1)o+=2;else o+=1;continue}if(m.startsWith("-")){o++;continue}r.push(m),o++}return r}function Ye(t,e){let i=Tn(e),r={quiet:!1,verbose:!1,noColor:!1,yes:!1,dryRun:!1,help:!1,nonInteractive:!1,async:!1},o=0;while(o<t.length){let m=t[o];if(m==="--help"||m==="-h"){r.help=!0,o++;continue}if(m==="--")break;if(m.startsWith("--")){let n=m.indexOf("="),p,u;if(n!==-1)p=m.slice(2,n),u=m.slice(n+1);else p=m.slice(2);let x=Xe(p);if(i.booleans.has(x)){if(u===void 0)r[x]=!0;else{let y=u.trim().toLowerCase();if(Ho.has(y))r[x]=!0;else if(Ko.has(y))r[x]=!1;else throw Error(`Flag --${p} requires a boolean value (e.g. true/false), got "${u}".`)}o++;continue}if(u===void 0)o++,u=t[o];if(u===void 0)throw Error(`Flag --${p} requires a value.`);if(i.arrays.has(x)){let y=r[x];if(y)y.push(u);else r[x]=[u]}else if(i.numbers.has(x)){let y=Number(u);if(u.trim()===""||!Number.isFinite(y))throw Error(`Flag --${p} requires a numeric value, got "${u}".`);r[x]=y}else r[x]=u}o++}return r}Se();J();k();d();Y();function qt(t){if(t instanceof c){if(V(process.env.MINIMAX_OUTPUT)==="json")process.stderr.write(JSON.stringify(t.toJSON(),null,2)+`
|
|
311
312
|
`);else{if(process.stderr.write(`
|
|
312
313
|
Error: ${t.message}
|
|
313
314
|
`),t.hint)process.stderr.write(`
|
|
@@ -315,25 +316,25 @@ Error: ${t.message}
|
|
|
315
316
|
`).join(`
|
|
316
317
|
`)}
|
|
317
318
|
`);process.stderr.write(` (exit code ${t.exitCode})
|
|
318
|
-
`)}process.exit(t.exitCode)}if(t instanceof Error){if(t.name==="AbortError"||t.name==="TimeoutError"||t.message.includes("timed out")){let
|
|
319
|
+
`)}process.exit(t.exitCode)}if(t instanceof Error){if(t.name==="AbortError"||t.name==="TimeoutError"||t.message.includes("timed out")){let o=new c("Request timed out.",s.TIMEOUT,`Try increasing --timeout (e.g. --timeout 60).
|
|
319
320
|
If this happens on every request with a valid API key, you may be hitting the wrong region.
|
|
320
321
|
`+`Run: mmx auth status — to check your credentials and region.
|
|
321
|
-
`+"Run: mmx config set region global (or cn) — to override the region.");return
|
|
322
|
-
To use a proxy: set HTTPS_PROXY env var, or run: mmx config set --key proxy --value http://HOST:PORT`);return
|
|
323
|
-
To use a proxy: set HTTPS_PROXY env var, or run: mmx config set --key proxy --value http://HOST:PORT`;if(
|
|
324
|
-
`+"Check: HTTPS_PROXY / HTTP_PROXY env vars, or mmx config show for configured proxy.";let
|
|
322
|
+
`+"Run: mmx config set region global (or cn) — to override the region.");return qt(o)}if(t instanceof TypeError&&t.message==="fetch failed"){let o=new c("Network request failed.",s.NETWORK,`Check your network connection.
|
|
323
|
+
To use a proxy: set HTTPS_PROXY env var, or run: mmx config set --key proxy --value http://HOST:PORT`);return qt(o)}let e=t.message.toLowerCase();if(e.includes("failed to fetch")||e.includes("connection refused")||e.includes("econnrefused")||e.includes("connection reset")||e.includes("econnreset")||e.includes("network error")||e.includes("enotfound")||e.includes("getaddrinfo")||e.includes("proxy")||e.includes("socket")||e.includes("etimedout")||e.includes("timeout")||e.includes("eai_AGAIN")){let o=`Check your network connection.
|
|
324
|
+
To use a proxy: set HTTPS_PROXY env var, or run: mmx config set --key proxy --value http://HOST:PORT`;if(e.includes("proxy"))o=`Proxy connection failed — verify your proxy URL and authentication.
|
|
325
|
+
`+"Check: HTTPS_PROXY / HTTP_PROXY env vars, or mmx config show for configured proxy.";let m=new c("Network request failed.",s.NETWORK,o);return qt(m)}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 m=new c(`File system error: ${t.message}`,s.GENERAL,o);return qt(m)}else if(typeof r==="string"&&r.startsWith("E")){let o=new c(`File system error: ${t.message}`,s.GENERAL,"Check the file path and permissions.");return qt(o)}if(process.stderr.write(`
|
|
325
326
|
Error: ${t.message}
|
|
326
327
|
`),process.env.MINIMAX_VERBOSE==="1")process.stderr.write(`${t.stack}
|
|
327
328
|
`)}else process.stderr.write(`
|
|
328
329
|
Error: ${String(t)}
|
|
329
|
-
`);process.exit(
|
|
330
|
+
`);process.exit(s.GENERAL)}mt();_n();nt();kt();import{join as Z$}from"path";import{readFileSync as N$,writeFileSync as O$}from"fs";var ko=()=>Z$(te(),"update-state.json"),W$=86400000,H$=3000,K$="MiniMax-AI-Dev/minimax-cli";function l$(){try{let t=N$(ko(),"utf-8");return JSON.parse(t)}catch{return null}}function f$(t){try{O$(ko(),JSON.stringify(t))}catch{}}async function P$(){try{let t=await fetch(`https://api.github.com/repos/${K$}/releases/latest`,{headers:{Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28"},signal:AbortSignal.timeout(H$)});if(!t.ok)return null;return(await t.json()).tag_name??null}catch{return null}}var Un=null;function Uo(){return Un}async function ao(t){if(process.env.CI||!process.stderr.isTTY)return;let e=l$(),i=Date.now();if(e&&i-e.lastChecked<W$){if(e.latestVersion&&e.latestVersion!==`v${t}`)Un=e.latestVersion;return}let r=await P$();if(!r)return;if(f$({lastChecked:i,latestVersion:r}),r!==`v${t}`)Un=r}ct();pn();xe();import{ProxyAgent as I$,setGlobalDispatcher as E$}from"undici";process.on("SIGINT",()=>{process.stderr.write(`
|
|
330
331
|
Interrupted. Exiting.
|
|
331
|
-
`),process.exit(130)});process.stdout.on("error",(t)=>{if(t.code==="EPIPE")process.exit(0);else throw t});var
|
|
332
|
+
`),process.exit(130)});process.stdout.on("error",(t)=>{if(t.code==="EPIPE")process.exit(0);else throw t});var L$=[["auth","login"],["auth","logout"],["config","show"],["config","set"],["config","export-schema"],["update"]];async function F$(){let t=process.argv.slice(2);if(t.includes("--version")||t.includes("-v"))console.log(`mmx ${bt}`),process.exit(0);let e=Jn(t,Dt),i=Q(),r=process.env.HTTPS_PROXY||process.env.https_proxy||process.env.HTTP_PROXY||process.env.http_proxy||process.env.ALL_PROXY||process.env.all_proxy||i.proxy;if(r)E$(new I$(r));if(t.includes("--help")||t.includes("-h")){let w=t.indexOf("--region"),_=w>=0&&t[w+1]||process.env.MINIMAX_REGION||i.region||"global";pt.printHelp(e,process.stderr,_),process.exit(0)}if(e.length===0){pt.printHelp([],process.stderr);let{command:w}=pt.resolve(["quota","show"]),_=Ye(t,[...Dt,...w.options??[]]),M=ze(_),G=!!(M.apiKey||M.fileApiKey),b=!!await L();if(G||b)await w.execute(M,_);else process.stderr.write(` Not logged in.
|
|
332
333
|
`),process.stderr.write(` mmx auth login Choose MiniMax OAuth (Global/China) or paste an API key
|
|
333
334
|
`),process.stderr.write(` mmx auth login --api-key Save an API key directly
|
|
334
335
|
|
|
335
|
-
`);process.exit(0)}let{command
|
|
336
|
-
Update available: ${
|
|
336
|
+
`);process.exit(0)}let{command:o,extra:m}=pt.resolve(e),n=Ye(t,[...Dt,...o.options??[]]);if(m.length>0)n._positional=m;let p=ze(n);if(!L$.some((w)=>w.every((_,M)=>e[M]===_)))await Bi(p);if(p.needsRegionDetection){let w=p.apiKey||p.fileApiKey;if(w){let _=await be(w);p.region=_,p.baseUrl=Z[_],p.needsRegionDetection=!1,await Ci(_)}}let x=ao(bt).catch(()=>{});await o.execute(p,n),await x;let y=Uo();if(y&&!p.quiet)process.stderr.write(`
|
|
337
|
+
Update available: ${y}
|
|
337
338
|
`),process.stderr.write(` npm update -g mmx-cli
|
|
338
339
|
|
|
339
|
-
`)}
|
|
340
|
+
`)}F$().catch(qt);
|