UNPKG

tutorial

Version:

Open a tutorial for Expo, EAS, React, and React Native

9 lines 108 kB
#!/usr/bin/env node import{createRequire as aZ} from"node:module";var nZ=Object.create;var{defineProperty:i1,getPrototypeOf:lZ,getOwnPropertyNames:pZ}=Object;var iZ=Object.prototype.hasOwnProperty;var s0=(Q,J,Z)=>{Z=Q!=null?nZ(lZ(Q)):{};const K=J||!Q||!Q.__esModule?i1(Z,"default",{value:Q,enumerable:!0}):Z;for(let W of pZ(Q))if(!iZ.call(K,W))i1(K,W,{get:()=>Q[W],enumerable:!0});return K};var B=(Q,J)=>()=>(J||Q((J={exports:{}}).exports,J),J.exports);var Z0=aZ(import.meta.url);var o1=B((pW,a1)=>{var O0=function(Q,{argv:J=process.argv.slice(2),permissive:Z=!1,stopAtPositional:K=!1}={}){if(!Q)throw new q("argument specification object is required","ARG_CONFIG_NO_SPEC");const W={_:[]},U={},X={};for(let z of Object.keys(Q)){if(!z)throw new q("argument key cannot be an empty string","ARG_CONFIG_EMPTY_KEY");if(z[0]!=="-")throw new q(`argument key must start with '-' but found: '${z}'`,"ARG_CONFIG_NONOPT_KEY");if(z.length===1)throw new q(`argument key must have a name; singular '-' keys are not allowed: ${z}`,"ARG_CONFIG_NONAME_KEY");if(typeof Q[z]==="string"){U[z]=Q[z];continue}let H=Q[z],Y=!1;if(Array.isArray(H)&&H.length===1&&typeof H[0]==="function"){const[D]=H;H=(E,N,F=[])=>{return F.push(D(E,N,F[F.length-1])),F},Y=D===Boolean||D[t0]===!0}else if(typeof H==="function")Y=H===Boolean||H[t0]===!0;else throw new q(`type missing or not a function or valid array type: ${z}`,"ARG_CONFIG_VAD_TYPE");if(z[1]!=="-"&&z.length>2)throw new q(`short argument keys (with a single hyphen) must have only one character: ${z}`,"ARG_CONFIG_SHORTOPT_TOOLONG");X[z]=[H,Y]}for(let z=0,H=J.length;z<H;z++){const Y=J[z];if(K&&W._.length>0){W._=W._.concat(J.slice(z));break}if(Y==="--"){W._=W._.concat(J.slice(z+1));break}if(Y.length>1&&Y[0]==="-"){const D=Y[1]==="-"||Y.length===2?[Y]:Y.slice(1).split("").map((E)=>`-${E}`);for(let E=0;E<D.length;E++){const N=D[E],[F,s]=N[1]==="-"?N.split(/=(.*)/,2):[N,void 0];let T=F;while(T in U)T=U[T];if(!(T in X))if(Z){W._.push(N);continue}else throw new q(`unknown or unexpected option: ${F}`,"ARG_UNKNOWN_OPTION");const[j,I]=X[T];if(!I&&E+1<D.length)throw new q(`option requires argument (but was followed by another short argument): ${F}`,"ARG_MISSING_REQUIRED_SHORTARG");if(I)W[T]=j(!0,T,W[T]);else if(s===void 0){if(J.length<z+2||J[z+1].length>1&&J[z+1][0]==="-"&&!(J[z+1].match(/^-?\d*(\.(?=\d))?\d*$/)&&(j===Number||typeof BigInt!=="undefined"&&j===BigInt))){const J0=F===T?"":` (alias for ${T})`;throw new q(`option requires argument: ${F}${J0}`,"ARG_MISSING_REQUIRED_LONGARG")}W[T]=j(J[z+1],T,W[T]),++z}else W[T]=j(s,T,W[T])}}else W._.push(Y)}return W},t0=Symbol("arg flag");class q extends Error{constructor(Q,J){super(Q);this.name="ArgError",this.code=J,Object.setPrototypeOf(this,q.prototype)}}O0.flag=(Q)=>{return Q[t0]=!0,Q};O0.COUNT=O0.flag((Q,J,Z)=>(Z||0)+1);O0.ArgError=q;a1.exports=O0});var M=B((xU,z9)=>{var X9=function(Q,J){let Z=0,K,W="",U="";for(;Z<Q.length;Z++)if(K=Q[Z],W+=K.open,U+=K.close,J.includes(K.close))J=J.replace(K.rgx,K.close+K.open);return W+J+U},S8=function(Q,J){let Z={has:Q,keys:J};return Z.reset=R.reset.bind(Z),Z.bold=R.bold.bind(Z),Z.dim=R.dim.bind(Z),Z.italic=R.italic.bind(Z),Z.underline=R.underline.bind(Z),Z.inverse=R.inverse.bind(Z),Z.hidden=R.hidden.bind(Z),Z.strikethrough=R.strikethrough.bind(Z),Z.black=R.black.bind(Z),Z.red=R.red.bind(Z),Z.green=R.green.bind(Z),Z.yellow=R.yellow.bind(Z),Z.blue=R.blue.bind(Z),Z.magenta=R.magenta.bind(Z),Z.cyan=R.cyan.bind(Z),Z.white=R.white.bind(Z),Z.gray=R.gray.bind(Z),Z.grey=R.grey.bind(Z),Z.bgBlack=R.bgBlack.bind(Z),Z.bgRed=R.bgRed.bind(Z),Z.bgGreen=R.bgGreen.bind(Z),Z.bgYellow=R.bgYellow.bind(Z),Z.bgBlue=R.bgBlue.bind(Z),Z.bgMagenta=R.bgMagenta.bind(Z),Z.bgCyan=R.bgCyan.bind(Z),Z.bgWhite=R.bgWhite.bind(Z),Z},O=function(Q,J){let Z={open:`\x1B[${Q}m`,close:`\x1B[${J}m`,rgx:new RegExp(`\\x1b\\[${J}m`,"g")};return function(K){if(this!==void 0&&this.has!==void 0)return this.has.includes(Q)||(this.has.push(Q),this.keys.push(Z)),K===void 0?this:R.enabled?X9(this.keys,K+""):K+"";return K===void 0?S8([Q],[Z]):R.enabled?X9([Z],K+""):K+""}},{FORCE_COLOR:E8,NODE_DISABLE_COLORS:j8,TERM:C8}=process.env,R={enabled:!j8&&C8!=="dumb"&&E8!=="0",reset:O(0,0),bold:O(1,22),dim:O(2,22),italic:O(3,23),underline:O(4,24),inverse:O(7,27),hidden:O(8,28),strikethrough:O(9,29),black:O(30,39),red:O(31,39),green:O(32,39),yellow:O(33,39),blue:O(34,39),magenta:O(35,39),cyan:O(36,39),white:O(37,39),gray:O(90,39),grey:O(90,39),bgBlack:O(40,49),bgRed:O(41,49),bgGreen:O(42,49),bgYellow:O(43,49),bgBlue:O(44,49),bgMagenta:O(45,49),bgCyan:O(46,49),bgWhite:O(47,49)};z9.exports=R});var Y9=B((yU,H9)=>{H9.exports=(Q,J)=>{if(Q.meta&&Q.name!=="escape")return;if(Q.ctrl){if(Q.name==="a")return"first";if(Q.name==="c")return"abort";if(Q.name==="d")return"abort";if(Q.name==="e")return"last";if(Q.name==="g")return"reset"}if(J){if(Q.name==="j")return"down";if(Q.name==="k")return"up"}if(Q.name==="return")return"submit";if(Q.name==="enter")return"submit";if(Q.name==="backspace")return"delete";if(Q.name==="delete")return"deleteForward";if(Q.name==="abort")return"abort";if(Q.name==="escape")return"exit";if(Q.name==="tab")return"next";if(Q.name==="pagedown")return"nextPage";if(Q.name==="pageup")return"prevPage";if(Q.name==="home")return"home";if(Q.name==="end")return"end";if(Q.name==="up")return"up";if(Q.name==="down")return"down";if(Q.name==="right")return"right";if(Q.name==="left")return"left";return!1}});var w0=B((vU,B9)=>{B9.exports=(Q)=>{const J=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),Z=new RegExp(J,"g");return typeof Q==="string"?Q.replace(Z,""):Q}});var $=B((mU,R9)=>{var V=`${"\x1B"}[`,R1={to(Q,J){if(!J)return`${V}${Q+1}G`;return`${V}${J+1};${Q+1}H`},move(Q,J){let Z="";if(Q<0)Z+=`${V}${-Q}D`;else if(Q>0)Z+=`${V}${Q}C`;if(J<0)Z+=`${V}${-J}A`;else if(J>0)Z+=`${V}${J}B`;return Z},up:(Q=1)=>`${V}${Q}A`,down:(Q=1)=>`${V}${Q}B`,forward:(Q=1)=>`${V}${Q}C`,backward:(Q=1)=>`${V}${Q}D`,nextLine:(Q=1)=>`${V}E`.repeat(Q),prevLine:(Q=1)=>`${V}F`.repeat(Q),left:`${V}G`,hide:`${V}?25l`,show:`${V}?25h`,save:`${"\x1B"}7`,restore:`${"\x1B"}8`},I8={up:(Q=1)=>`${V}S`.repeat(Q),down:(Q=1)=>`${V}T`.repeat(Q)},q8={screen:`${V}2J`,up:(Q=1)=>`${V}1J`.repeat(Q),down:(Q=1)=>`${V}J`.repeat(Q),line:`${V}2K`,lineEnd:`${V}K`,lineStart:`${V}1K`,lines(Q){let J="";for(let Z=0;Z<Q;Z++)J+=this.line+(Z<Q-1?R1.up():"");if(Q)J+=R1.left;return J}};R9.exports={cursor:R1,scroll:I8,erase:q8,beep:"\x07"}});var $9=B((gU,V9)=>{var A8=function(Q,J){var Z=typeof Symbol!=="undefined"&&Q[Symbol.iterator]||Q["@@iterator"];if(!Z){if(Array.isArray(Q)||(Z=P8(Q))||J&&Q&&typeof Q.length==="number"){if(Z)Q=Z;var K=0,W=function H(){};return{s:W,n:function H(){if(K>=Q.length)return{done:!0};return{done:!1,value:Q[K++]}},e:function H(Y){throw Y},f:W}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var U=!0,X=!1,z;return{s:function H(){Z=Z.call(Q)},n:function H(){var Y=Z.next();return U=Y.done,Y},e:function H(Y){X=!0,z=Y},f:function H(){try{if(!U&&Z.return!=null)Z.return()}finally{if(X)throw z}}}},P8=function(Q,J){if(!Q)return;if(typeof Q==="string")return O9(Q,J);var Z=Object.prototype.toString.call(Q).slice(8,-1);if(Z==="Object"&&Q.constructor)Z=Q.constructor.name;if(Z==="Map"||Z==="Set")return Array.from(Q);if(Z==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Z))return O9(Q,J)},O9=function(Q,J){if(J==null||J>Q.length)J=Q.length;for(var Z=0,K=new Array(J);Z<J;Z++)K[Z]=Q[Z];return K},w8=w0(),M9=$(),G9=M9.erase,b8=M9.cursor,f8=(Q)=>[...w8(Q)].length;V9.exports=function(Q,J){if(!J)return G9.line+b8.to(0);let Z=0;const K=Q.split(/\r?\n/);var W=A8(K),U;try{for(W.s();!(U=W.n()).done;){let X=U.value;Z+=1+Math.floor(Math.max(f8(X)-1,0)/J)}}catch(X){W.e(X)}finally{W.f()}return G9.lines(Z)}});var O1=B((dU,L9)=>{var M0={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},k8={arrowUp:M0.arrowUp,arrowDown:M0.arrowDown,arrowLeft:M0.arrowLeft,arrowRight:M0.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},_8=process.platform==="win32"?k8:M0;L9.exports=_8});var F9=B((uU,N9)=>{var X0=M(),r=O1(),G1=Object.freeze({password:{scale:1,render:(Q)=>"*".repeat(Q.length)},emoji:{scale:2,render:(Q)=>"\uD83D\uDE03".repeat(Q.length)},invisible:{scale:0,render:(Q)=>""},default:{scale:1,render:(Q)=>`${Q}`}}),h8=(Q)=>G1[Q]||G1.default,V0=Object.freeze({aborted:X0.red(r.cross),done:X0.green(r.tick),exited:X0.yellow(r.cross),default:X0.cyan("?")}),x8=(Q,J,Z)=>J?V0.aborted:Z?V0.exited:Q?V0.done:V0.default,y8=(Q)=>X0.gray(Q?r.ellipsis:r.pointerSmall),v8=(Q,J)=>X0.gray(Q?J?r.pointerSmall:"+":r.line);N9.exports={styles:G1,render:h8,symbols:V0,symbol:x8,delimiter:y8,item:v8}});var D9=B((cU,T9)=>{var m8=w0();T9.exports=function(Q,J){let Z=String(m8(Q)||"").split(/\r?\n/);if(!J)return Z.length;return Z.map((K)=>Math.ceil(K.length/J)).reduce((K,W)=>K+W)}});var j9=B((nU,E9)=>{E9.exports=(Q,J={})=>{const Z=Number.isSafeInteger(parseInt(J.margin))?new Array(parseInt(J.margin)).fill(" ").join(""):J.margin||"",K=J.width;return(Q||"").split(/\r?\n/g).map((W)=>W.split(/\s+/g).reduce((U,X)=>{if(X.length+Z.length>=K||U[U.length-1].length+X.length+1<K)U[U.length-1]+=` ${X}`;else U.push(`${Z}${X}`);return U},[Z]).join("\n")).join("\n")}});var S9=B((lU,C9)=>{C9.exports=(Q,J,Z)=>{Z=Z||J;let K=Math.min(J-Z,Q-Math.floor(Z/2));if(K<0)K=0;let W=Math.min(K+Z,J);return{startIndex:K,endIndex:W}}});var w=B((pU,I9)=>{I9.exports={action:Y9(),clear:$9(),style:F9(),strip:w0(),figures:O1(),lines:D9(),wrap:j9(),entriesToDisplay:S9()}});var m=B((iU,w9)=>{var q9=Z0("readline"),g8=w(),d8=g8.action,u8=Z0("events"),A9=$(),c8=A9.beep,n8=A9.cursor,l8=M();class P9 extends u8{constructor(Q={}){super();this.firstRender=!0,this.in=Q.stdin||process.stdin,this.out=Q.stdout||process.stdout,this.onRender=(Q.onRender||(()=>{return})).bind(this);const J=q9.createInterface({input:this.in,escapeCodeTimeout:50});if(q9.emitKeypressEvents(this.in,J),this.in.isTTY)this.in.setRawMode(!0);const Z=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,K=(W,U)=>{let X=d8(U,Z);if(X===!1)this._&&this._(W,U);else if(typeof this[X]==="function")this[X](U);else this.bell()};this.close=()=>{if(this.out.write(n8.show),this.in.removeListener("keypress",K),this.in.isTTY)this.in.setRawMode(!1);J.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",K)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(c8)}render(){if(this.onRender(l8),this.firstRender)this.firstRender=!1}}w9.exports=P9});var x9=B((aU,h9)=>{var b9=function(Q,J,Z,K,W,U,X){try{var z=Q[U](X),H=z.value}catch(Y){Z(Y);return}if(z.done)J(H);else Promise.resolve(H).then(K,W)},f9=function(Q){return function(){var J=this,Z=arguments;return new Promise(function(K,W){var U=Q.apply(J,Z);function X(H){b9(U,K,W,X,z,"next",H)}function z(H){b9(U,K,W,X,z,"throw",H)}X(void 0)})}},b0=M(),p8=m(),k9=$(),i8=k9.erase,$0=k9.cursor,f0=w(),M1=f0.style,V1=f0.clear,a8=f0.lines,o8=f0.figures;class _9 extends p8{constructor(Q={}){super(Q);this.transform=M1.render(Q.style),this.scale=this.transform.scale,this.msg=Q.message,this.initial=Q.initial||"",this.validator=Q.validate||(()=>!0),this.value="",this.errorMsg=Q.error||"Please Enter A Valid Value",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.clear=V1("",this.out.columns),this.render()}set value(Q){if(!Q&&this.initial)this.placeholder=!0,this.rendered=b0.gray(this.transform.render(this.initial));else this.placeholder=!1,this.rendered=this.transform.render(Q);this._value=Q,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write("\n"),this.close()}validate(){var Q=this;return f9(function*(){let J=yield Q.validator(Q.value);if(typeof J==="string")Q.errorMsg=J,J=!1;Q.error=!J})()}submit(){var Q=this;return f9(function*(){if(Q.value=Q.value||Q.initial,Q.cursorOffset=0,Q.cursor=Q.rendered.length,yield Q.validate(),Q.error){Q.red=!0,Q.fire(),Q.render();return}Q.done=!0,Q.aborted=!1,Q.fire(),Q.render(),Q.out.write("\n"),Q.close()})()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(Q){if(this.placeholder)return;this.cursor=this.cursor+Q,this.cursorOffset+=Q}_(Q,J){let Z=this.value.slice(0,this.cursor),K=this.value.slice(this.cursor);this.value=`${Z}${Q}${K}`,this.red=!1,this.cursor=this.placeholder?0:Z.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let Q=this.value.slice(0,this.cursor-1),J=this.value.slice(this.cursor);if(this.value=`${Q}${J}`,this.red=!1,this.isCursorAtStart())this.cursorOffset=0;else this.cursorOffset++,this.moveCursor(-1);this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let Q=this.value.slice(0,this.cursor),J=this.value.slice(this.cursor+1);if(this.value=`${Q}${J}`,this.red=!1,this.isCursorAtEnd())this.cursorOffset=0;else this.cursorOffset++;this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){if(this.closed)return;if(!this.firstRender){if(this.outputError)this.out.write($0.down(a8(this.outputError,this.out.columns)-1)+V1(this.outputError,this.out.columns));this.out.write(V1(this.outputText,this.out.columns))}if(super.render(),this.outputError="",this.outputText=[M1.symbol(this.done,this.aborted),b0.bold(this.msg),M1.delimiter(this.done),this.red?b0.red(this.rendered):this.rendered].join(" "),this.error)this.outputError+=this.errorMsg.split("\n").reduce((Q,J,Z)=>Q+`\n${Z?" ":o8.pointerSmall} ${b0.red().italic(J)}`,"");this.out.write(i8.line+$0.to(0)+this.outputText+$0.save+this.outputError+$0.restore+$0.move(this.cursorOffset,0))}}h9.exports=_9});var d9=B((oU,g9)=>{var g=M(),s8=m(),L0=w(),y9=L0.style,v9=L0.clear,k0=L0.figures,t8=L0.wrap,r8=L0.entriesToDisplay,e8=$(),QK=e8.cursor;class m9 extends s8{constructor(Q={}){super(Q);this.msg=Q.message,this.hint=Q.hint||"- Use arrow-keys. Return to submit.",this.warn=Q.warn||"- This option is disabled",this.cursor=Q.initial||0,this.choices=Q.choices.map((J,Z)=>{if(typeof J==="string")J={title:J,value:Z};return{title:J&&(J.title||J.value||J),value:J&&(J.value===void 0?Z:J.value),description:J&&J.description,selected:J&&J.selected,disabled:J&&J.disabled}}),this.optionsPerPage=Q.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=v9("",this.out.columns),this.render()}moveCursor(Q){this.cursor=Q,this.value=this.choices[Q].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write("\n"),this.close()}submit(){if(!this.selection.disabled)this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write("\n"),this.close();else this.bell()}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){if(this.cursor===0)this.moveCursor(this.choices.length-1);else this.moveCursor(this.cursor-1);this.render()}down(){if(this.cursor===this.choices.length-1)this.moveCursor(0);else this.moveCursor(this.cursor+1);this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(Q,J){if(Q===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;if(this.firstRender)this.out.write(QK.hide);else this.out.write(v9(this.outputText,this.out.columns));super.render();let Q=r8(this.cursor,this.choices.length,this.optionsPerPage),J=Q.startIndex,Z=Q.endIndex;if(this.outputText=[y9.symbol(this.done,this.aborted),g.bold(this.msg),y9.delimiter(!1),this.done?this.selection.title:this.selection.disabled?g.yellow(this.warn):g.gray(this.hint)].join(" "),!this.done){this.outputText+="\n";for(let K=J;K<Z;K++){let W,U,X="",z=this.choices[K];if(K===J&&J>0)U=k0.arrowUp;else if(K===Z-1&&Z<this.choices.length)U=k0.arrowDown;else U=" ";if(z.disabled)W=this.cursor===K?g.gray().underline(z.title):g.strikethrough().gray(z.title),U=(this.cursor===K?g.bold().gray(k0.pointer)+" ":" ")+U;else if(W=this.cursor===K?g.cyan().underline(z.title):z.title,U=(this.cursor===K?g.cyan(k0.pointer)+" ":" ")+U,z.description&&this.cursor===K){if(X=` - ${z.description}`,U.length+W.length+X.length>=this.out.columns||z.description.split(/\r?\n/).length>1)X="\n"+t8(z.description,{margin:3,width:this.out.columns})}this.outputText+=`${U} ${W}${g.gray(X)}\n`}}this.out.write(this.outputText)}}g9.exports=m9});var a9=B((sU,i9)=>{var _0=M(),JK=m(),n9=w(),u9=n9.style,ZK=n9.clear,l9=$(),c9=l9.cursor,KK=l9.erase;class p9 extends JK{constructor(Q={}){super(Q);this.msg=Q.message,this.value=!!Q.initial,this.active=Q.active||"on",this.inactive=Q.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write("\n"),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write("\n"),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(Q,J){if(Q===" ")this.value=!this.value;else if(Q==="1")this.value=!0;else if(Q==="0")this.value=!1;else return this.bell();this.render()}render(){if(this.closed)return;if(this.firstRender)this.out.write(c9.hide);else this.out.write(ZK(this.outputText,this.out.columns));super.render(),this.outputText=[u9.symbol(this.done,this.aborted),_0.bold(this.msg),u9.delimiter(this.done),this.value?this.inactive:_0.cyan().underline(this.inactive),_0.gray("/"),this.value?_0.cyan().underline(this.active):this.active].join(" "),this.out.write(KK.line+c9.to(0)+this.outputText)}}i9.exports=p9});var k=B((tU,o9)=>{class h0{constructor({token:Q,date:J,parts:Z,locales:K}){this.token=Q,this.date=J||new Date,this.parts=Z||[this],this.locales=K||{}}up(){}down(){}next(){const Q=this.parts.indexOf(this);return this.parts.find((J,Z)=>Z>Q&&J instanceof h0)}setTo(Q){}prev(){let Q=[].concat(this.parts).reverse();const J=Q.indexOf(this);return Q.find((Z,K)=>K>J&&Z instanceof h0)}toString(){return String(this.date)}}o9.exports=h0});var r9=B((rU,t9)=>{var WK=k();class s9 extends WK{constructor(Q={}){super(Q)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let Q=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?Q.toUpperCase():Q}}t9.exports=s9});var JQ=B((eU,QQ)=>{var UK=k(),XK=(Q)=>{return Q=Q%10,Q===1?"st":Q===2?"nd":Q===3?"rd":"th"};class e9 extends UK{constructor(Q={}){super(Q)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(Q){this.date.setDate(parseInt(Q.substr(-2)))}toString(){let Q=this.date.getDate(),J=this.date.getDay();return this.token==="DD"?String(Q).padStart(2,"0"):this.token==="Do"?Q+XK(Q):this.token==="d"?J+1:this.token==="ddd"?this.locales.weekdaysShort[J]:this.token==="dddd"?this.locales.weekdays[J]:Q}}QQ.exports=e9});var WQ=B((QX,KQ)=>{var zK=k();class ZQ extends zK{constructor(Q={}){super(Q)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(Q){this.date.setHours(parseInt(Q.substr(-2)))}toString(){let Q=this.date.getHours();if(/h/.test(this.token))Q=Q%12||12;return this.token.length>1?String(Q).padStart(2,"0"):Q}}KQ.exports=ZQ});var zQ=B((JX,XQ)=>{var HK=k();class UQ extends HK{constructor(Q={}){super(Q)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(Q){this.date.setMilliseconds(parseInt(Q.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}}XQ.exports=UQ});var BQ=B((ZX,YQ)=>{var YK=k();class HQ extends YK{constructor(Q={}){super(Q)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(Q){this.date.setMinutes(parseInt(Q.substr(-2)))}toString(){let Q=this.date.getMinutes();return this.token.length>1?String(Q).padStart(2,"0"):Q}}YQ.exports=HQ});var GQ=B((KX,OQ)=>{var BK=k();class RQ extends BK{constructor(Q={}){super(Q)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(Q){Q=parseInt(Q.substr(-2))-1,this.date.setMonth(Q<0?0:Q)}toString(){let Q=this.date.getMonth(),J=this.token.length;return J===2?String(Q+1).padStart(2,"0"):J===3?this.locales.monthsShort[Q]:J===4?this.locales.months[Q]:String(Q+1)}}OQ.exports=RQ});var $Q=B((WX,VQ)=>{var RK=k();class MQ extends RK{constructor(Q={}){super(Q)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(Q){this.date.setSeconds(parseInt(Q.substr(-2)))}toString(){let Q=this.date.getSeconds();return this.token.length>1?String(Q).padStart(2,"0"):Q}}VQ.exports=MQ});var FQ=B((UX,NQ)=>{var OK=k();class LQ extends OK{constructor(Q={}){super(Q)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(Q){this.date.setFullYear(Q.substr(-4))}toString(){let Q=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?Q.substr(-2):Q}}NQ.exports=LQ});var DQ=B((XX,TQ)=>{TQ.exports={DatePart:k(),Meridiem:r9(),Day:JQ(),Hours:WQ(),Milliseconds:zQ(),Minutes:BQ(),Month:GQ(),Seconds:$Q(),Year:FQ()}});var fQ=B((zX,bQ)=>{var EQ=function(Q,J,Z,K,W,U,X){try{var z=Q[U](X),H=z.value}catch(Y){Z(Y);return}if(z.done)J(H);else Promise.resolve(H).then(K,W)},jQ=function(Q){return function(){var J=this,Z=arguments;return new Promise(function(K,W){var U=Q.apply(J,Z);function X(H){EQ(U,K,W,X,z,"next",H)}function z(H){EQ(U,K,W,X,z,"throw",H)}X(void 0)})}},$1=M(),GK=m(),L1=w(),CQ=L1.style,SQ=L1.clear,MK=L1.figures,PQ=$(),VK=PQ.erase,IQ=PQ.cursor,d=DQ(),qQ=d.DatePart,$K=d.Meridiem,LK=d.Day,NK=d.Hours,FK=d.Milliseconds,TK=d.Minutes,DK=d.Month,EK=d.Seconds,jK=d.Year,CK=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,AQ={1:({token:Q})=>Q.replace(/\\(.)/g,"$1"),2:(Q)=>new LK(Q),3:(Q)=>new DK(Q),4:(Q)=>new jK(Q),5:(Q)=>new $K(Q),6:(Q)=>new NK(Q),7:(Q)=>new TK(Q),8:(Q)=>new EK(Q),9:(Q)=>new FK(Q)},SK={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")};class wQ extends GK{constructor(Q={}){super(Q);this.msg=Q.message,this.cursor=0,this.typed="",this.locales=Object.assign(SK,Q.locales),this._date=Q.initial||new Date,this.errorMsg=Q.error||"Please Enter A Valid Value",this.validator=Q.validate||(()=>!0),this.mask=Q.mask||"YYYY-MM-DD HH:mm:ss",this.clear=SQ("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(Q){if(Q)this._date.setTime(Q.getTime())}set mask(Q){let J;this.parts=[];while(J=CK.exec(Q)){let K=J.shift(),W=J.findIndex((U)=>U!=null);this.parts.push(W in AQ?AQ[W]({token:J[W]||K,date:this.date,parts:this.parts,locales:this.locales}):J[W]||K)}let Z=this.parts.reduce((K,W)=>{if(typeof W==="string"&&typeof K[K.length-1]==="string")K[K.length-1]+=W;else K.push(W);return K},[]);this.parts.splice(0),this.parts.push(...Z),this.reset()}moveCursor(Q){this.typed="",this.cursor=Q,this.fire()}reset(){this.moveCursor(this.parts.findIndex((Q)=>Q instanceof qQ)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write("\n"),this.close()}validate(){var Q=this;return jQ(function*(){let J=yield Q.validator(Q.value);if(typeof J==="string")Q.errorMsg=J,J=!1;Q.error=!J})()}submit(){var Q=this;return jQ(function*(){if(yield Q.validate(),Q.error){Q.color="red",Q.fire(),Q.render();return}Q.done=!0,Q.aborted=!1,Q.fire(),Q.render(),Q.out.write("\n"),Q.close()})()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let Q=this.parts[this.cursor].prev();if(Q==null)return this.bell();this.moveCursor(this.parts.indexOf(Q)),this.render()}right(){let Q=this.parts[this.cursor].next();if(Q==null)return this.bell();this.moveCursor(this.parts.indexOf(Q)),this.render()}next(){let Q=this.parts[this.cursor].next();this.moveCursor(Q?this.parts.indexOf(Q):this.parts.findIndex((J)=>J instanceof qQ)),this.render()}_(Q){if(/\d/.test(Q))this.typed+=Q,this.parts[this.cursor].setTo(this.typed),this.render()}render(){if(this.closed)return;if(this.firstRender)this.out.write(IQ.hide);else this.out.write(SQ(this.outputText,this.out.columns));if(super.render(),this.outputText=[CQ.symbol(this.done,this.aborted),$1.bold(this.msg),CQ.delimiter(!1),this.parts.reduce((Q,J,Z)=>Q.concat(Z===this.cursor&&!this.done?$1.cyan().underline(J.toString()):J),[]).join("")].join(" "),this.error)this.outputText+=this.errorMsg.split("\n").reduce((Q,J,Z)=>Q+`\n${Z?" ":MK.pointerSmall} ${$1.red().italic(J)}`,"");this.out.write(VK.line+IQ.to(0)+this.outputText)}}bQ.exports=wQ});var gQ=B((HX,mQ)=>{var kQ=function(Q,J,Z,K,W,U,X){try{var z=Q[U](X),H=z.value}catch(Y){Z(Y);return}if(z.done)J(H);else Promise.resolve(H).then(K,W)},_Q=function(Q){return function(){var J=this,Z=arguments;return new Promise(function(K,W){var U=Q.apply(J,Z);function X(H){kQ(U,K,W,X,z,"next",H)}function z(H){kQ(U,K,W,X,z,"throw",H)}X(void 0)})}},x0=M(),IK=m(),yQ=$(),y0=yQ.cursor,qK=yQ.erase,v0=w(),N1=v0.style,AK=v0.figures,hQ=v0.clear,PK=v0.lines,wK=/[0-9]/,F1=(Q)=>Q!==void 0,xQ=(Q,J)=>{let Z=Math.pow(10,J);return Math.round(Q*Z)/Z};class vQ extends IK{constructor(Q={}){super(Q);this.transform=N1.render(Q.style),this.msg=Q.message,this.initial=F1(Q.initial)?Q.initial:"",this.float=!!Q.float,this.round=Q.round||2,this.inc=Q.increment||1,this.min=F1(Q.min)?Q.min:(-Infinity),this.max=F1(Q.max)?Q.max:Infinity,this.errorMsg=Q.error||"Please Enter A Valid Value",this.validator=Q.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(Q){if(!Q&&Q!==0)this.placeholder=!0,this.rendered=x0.gray(this.transform.render(`${this.initial}`)),this._value="";else this.placeholder=!1,this.rendered=this.transform.render(`${xQ(Q,this.round)}`),this._value=xQ(Q,this.round);this.fire()}get value(){return this._value}parse(Q){return this.float?parseFloat(Q):parseInt(Q)}valid(Q){return Q==="-"||Q==="."&&this.float||wK.test(Q)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let Q=this.value;this.value=Q!==""?Q:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write("\n"),this.close()}validate(){var Q=this;return _Q(function*(){let J=yield Q.validator(Q.value);if(typeof J==="string")Q.errorMsg=J,J=!1;Q.error=!J})()}submit(){var Q=this;return _Q(function*(){if(yield Q.validate(),Q.error){Q.color="red",Q.fire(),Q.render();return}let J=Q.value;Q.value=J!==""?J:Q.initial,Q.done=!0,Q.aborted=!1,Q.error=!1,Q.fire(),Q.render(),Q.out.write("\n"),Q.close()})()}up(){if(this.typed="",this.value==="")this.value=this.min-this.inc;if(this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value==="")this.value=this.min+this.inc;if(this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let Q=this.value.toString();if(Q.length===0)return this.bell();if(this.value=this.parse(Q=Q.slice(0,-1))||"",this.value!==""&&this.value<this.min)this.value=this.min;this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(Q,J){if(!this.valid(Q))return this.bell();const Z=Date.now();if(Z-this.lastHit>1000)this.typed="";if(this.typed+=Q,this.lastHit=Z,this.color="cyan",Q===".")return this.fire();if(this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max)this.value=this.max;if(this.value<this.min)this.value=this.min;this.fire(),this.render()}render(){if(this.closed)return;if(!this.firstRender){if(this.outputError)this.out.write(y0.down(PK(this.outputError,this.out.columns)-1)+hQ(this.outputError,this.out.columns));this.out.write(hQ(this.outputText,this.out.columns))}if(super.render(),this.outputError="",this.outputText=[N1.symbol(this.done,this.aborted),x0.bold(this.msg),N1.delimiter(this.done),!this.done||!this.done&&!this.placeholder?x0[this.color]().underline(this.rendered):this.rendered].join(" "),this.error)this.outputError+=this.errorMsg.split("\n").reduce((Q,J,Z)=>Q+`\n${Z?" ":AK.pointerSmall} ${x0.red().italic(J)}`,"");this.out.write(qK.line+y0.to(0)+this.outputText+y0.save+this.outputError+y0.restore)}}mQ.exports=vQ});var T1=B((YX,nQ)=>{var _=M(),bK=$(),fK=bK.cursor,kK=m(),N0=w(),dQ=N0.clear,p=N0.figures,uQ=N0.style,_K=N0.wrap,hK=N0.entriesToDisplay;class cQ extends kK{constructor(Q={}){super(Q);if(this.msg=Q.message,this.cursor=Q.cursor||0,this.scrollIndex=Q.cursor||0,this.hint=Q.hint||"",this.warn=Q.warn||"- This option is disabled -",this.minSelected=Q.min,this.showMinError=!1,this.maxChoices=Q.max,this.instructions=Q.instructions,this.optionsPerPage=Q.optionsPerPage||10,this.value=Q.choices.map((J,Z)=>{if(typeof J==="string")J={title:J,value:Z};return{title:J&&(J.title||J.value||J),description:J&&J.description,value:J&&(J.value===void 0?Z:J.value),selected:J&&J.selected,disabled:J&&J.disabled}}),this.clear=dQ("",this.out.columns),!Q.overrideRender)this.render()}reset(){this.value.map((Q)=>!Q.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter((Q)=>Q.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write("\n"),this.close()}submit(){const Q=this.value.filter((J)=>J.selected);if(this.minSelected&&Q.length<this.minSelected)this.showMinError=!0,this.render();else this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write("\n"),this.close()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){if(this.cursor===0)this.cursor=this.value.length-1;else this.cursor--;this.render()}down(){if(this.cursor===this.value.length-1)this.cursor=0;else this.cursor++;this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter((Q)=>Q.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){const Q=this.value[this.cursor];if(Q.selected)Q.selected=!1,this.render();else if(Q.disabled||this.value.filter((J)=>J.selected).length>=this.maxChoices)return this.bell();else Q.selected=!0,this.render()}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();const Q=!this.value[this.cursor].selected;this.value.filter((J)=>!J.disabled).forEach((J)=>J.selected=Q),this.render()}_(Q,J){if(Q===" ")this.handleSpaceToggle();else if(Q==="a")this.toggleAll();else return this.bell()}renderInstructions(){if(this.instructions===void 0||this.instructions){if(typeof this.instructions==="string")return this.instructions;return"\nInstructions:\n"+` ${p.arrowUp}/${p.arrowDown}: Highlight option\n`+` ${p.arrowLeft}/${p.arrowRight}/[space]: Toggle selection\n`+(this.maxChoices===void 0?" a: Toggle all\n":"")+" enter/return: Complete answer"}return""}renderOption(Q,J,Z,K){const W=(J.selected?_.green(p.radioOn):p.radioOff)+" "+K+" ";let U,X;if(J.disabled)U=Q===Z?_.gray().underline(J.title):_.strikethrough().gray(J.title);else if(U=Q===Z?_.cyan().underline(J.title):J.title,Q===Z&&J.description){if(X=` - ${J.description}`,W.length+U.length+X.length>=this.out.columns||J.description.split(/\r?\n/).length>1)X="\n"+_K(J.description,{margin:W.length,width:this.out.columns})}return W+U+_.gray(X||"")}paginateOptions(Q){if(Q.length===0)return _.red("No matches for this query.");let J=hK(this.cursor,Q.length,this.optionsPerPage),Z=J.startIndex,K=J.endIndex,W,U=[];for(let X=Z;X<K;X++){if(X===Z&&Z>0)W=p.arrowUp;else if(X===K-1&&K<Q.length)W=p.arrowDown;else W=" ";U.push(this.renderOption(this.cursor,Q[X],X,W))}return"\n"+U.join("\n")}renderOptions(Q){if(!this.done)return this.paginateOptions(Q);return""}renderDoneOrInstructions(){if(this.done)return this.value.filter((J)=>J.selected).map((J)=>J.title).join(", ");const Q=[_.gray(this.hint),this.renderInstructions()];if(this.value[this.cursor].disabled)Q.push(_.yellow(this.warn));return Q.join(" ")}render(){if(this.closed)return;if(this.firstRender)this.out.write(fK.hide);super.render();let Q=[uQ.symbol(this.done,this.aborted),_.bold(this.msg),uQ.delimiter(!1),this.renderDoneOrInstructions()].join(" ");if(this.showMinError)Q+=_.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1;Q+=this.renderOptions(this.value),this.out.write(this.clear+Q),this.clear=dQ(Q,this.out.columns)}}nQ.exports=cQ});var rQ=B((BX,tQ)=>{var lQ=function(Q,J,Z,K,W,U,X){try{var z=Q[U](X),H=z.value}catch(Y){Z(Y);return}if(z.done)J(H);else Promise.resolve(H).then(K,W)},xK=function(Q){return function(){var J=this,Z=arguments;return new Promise(function(K,W){var U=Q.apply(J,Z);function X(H){lQ(U,K,W,X,z,"next",H)}function z(H){lQ(U,K,W,X,z,"throw",H)}X(void 0)})}},F0=M(),yK=m(),oQ=$(),vK=oQ.erase,pQ=oQ.cursor,T0=w(),D1=T0.style,iQ=T0.clear,E1=T0.figures,mK=T0.wrap,gK=T0.entriesToDisplay,aQ=(Q,J)=>Q[J]&&(Q[J].value||Q[J].title||Q[J]),dK=(Q,J)=>Q[J]&&(Q[J].title||Q[J].value||Q[J]),uK=(Q,J)=>{const Z=Q.findIndex((K)=>K.value===J||K.title===J);return Z>-1?Z:void 0};class sQ extends yK{constructor(Q={}){super(Q);this.msg=Q.message,this.suggest=Q.suggest,this.choices=Q.choices,this.initial=typeof Q.initial==="number"?Q.initial:uK(Q.choices,Q.initial),this.select=this.initial||Q.cursor||0,this.i18n={noMatches:Q.noMatches||"no matches found"},this.fallback=Q.fallback||this.initial,this.clearFirst=Q.clearFirst||!1,this.suggestions=[],this.input="",this.limit=Q.limit||10,this.cursor=0,this.transform=D1.render(Q.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=iQ("",this.out.columns),this.complete(this.render),this.render()}set fallback(Q){this._fb=Number.isSafeInteger(parseInt(Q))?parseInt(Q):Q}get fallback(){let Q;if(typeof this._fb==="number")Q=this.choices[this._fb];else if(typeof this._fb==="string")Q={title:this._fb};return Q||this._fb||{title:this.i18n.noMatches}}moveSelect(Q){if(this.select=Q,this.suggestions.length>0)this.value=aQ(this.suggestions,Q);else this.value=this.fallback.value;this.fire()}complete(Q){var J=this;return xK(function*(){const Z=J.completing=J.suggest(J.input,J.choices),K=yield Z;if(J.completing!==Z)return;J.suggestions=K.map((U,X,z)=>({title:dK(z,X),value:aQ(z,X),description:U.description})),J.completing=!1;const W=Math.max(K.length-1,0);J.moveSelect(Math.min(W,J.select)),Q&&Q()})()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){if(this.clearFirst&&this.input.length>0)this.reset();else this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write("\n"),this.close()}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write("\n"),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write("\n"),this.close()}_(Q,J){let Z=this.input.slice(0,this.cursor),K=this.input.slice(this.cursor);this.input=`${Z}${Q}${K}`,this.cursor=Z.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let Q=this.input.slice(0,this.cursor-1),J=this.input.slice(this.cursor);this.input=`${Q}${J}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let Q=this.input.slice(0,this.cursor),J=this.input.slice(this.cursor+1);this.input=`${Q}${J}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){if(this.select===0)this.moveSelect(this.suggestions.length-1);else this.moveSelect(this.select-1);this.render()}down(){if(this.select===this.suggestions.length-1)this.moveSelect(0);else this.moveSelect(this.select+1);this.render()}next(){if(this.select===this.suggestions.length-1)this.moveSelect(0);else this.moveSelect(this.select+1);this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(Q,J,Z,K){let W,U=Z?E1.arrowUp:K?E1.arrowDown:" ",X=J?F0.cyan().underline(Q.title):Q.title;if(U=(J?F0.cyan(E1.pointer)+" ":" ")+U,Q.description){if(W=` - ${Q.description}`,U.length+X.length+W.length>=this.out.columns||Q.description.split(/\r?\n/).length>1)W="\n"+mK(Q.description,{margin:3,width:this.out.columns})}return U+" "+X+F0.gray(W||"")}render(){if(this.closed)return;if(this.firstRender)this.out.write(pQ.hide);else this.out.write(iQ(this.outputText,this.out.columns));super.render();let Q=gK(this.select,this.choices.length,this.limit),J=Q.startIndex,Z=Q.endIndex;if(this.outputText=[D1.symbol(this.done,this.aborted,this.exited),F0.bold(this.msg),D1.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){const K=this.suggestions.slice(J,Z).map((W,U)=>this.renderOption(W,this.select===U+J,U===0&&J>0,U+J===Z-1&&Z<this.choices.length)).join("\n");this.outputText+="\n"+(K||F0.gray(this.fallback.title))}this.out.write(vK.line+pQ.to(0)+this.outputText)}}tQ.exports=sQ});var K5=B((RX,Z5)=>{var u=M(),cK=$(),nK=cK.cursor,lK=T1(),j1=w(),eQ=j1.clear,Q5=j1.style,z0=j1.figures;class J5 extends lK{constructor(Q={}){Q.overrideRender=!0;super(Q);this.inputValue="",this.clear=eQ("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){if(this.cursor===0)this.cursor=this.filteredOptions.length-1;else this.cursor--;this.render()}down(){if(this.cursor===this.filteredOptions.length-1)this.cursor=0;else this.cursor++;this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter((Q)=>Q.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){if(this.inputValue.length)this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions()}updateFilteredOptions(){const Q=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter((Z)=>{if(this.inputValue){if(typeof Z.title==="string"){if(Z.title.toLowerCase().includes(this.inputValue.toLowerCase()))return!0}if(typeof Z.value==="string"){if(Z.value.toLowerCase().includes(this.inputValue.toLowerCase()))return!0}return!1}return!0});const J=this.filteredOptions.findIndex((Z)=>Z===Q);this.cursor=J<0?0:J,this.render()}handleSpaceToggle(){const Q=this.filteredOptions[this.cursor];if(Q.selected)Q.selected=!1,this.render();else if(Q.disabled||this.value.filter((J)=>J.selected).length>=this.maxChoices)return this.bell();else Q.selected=!0,this.render()}handleInputChange(Q){this.inputValue=this.inputValue+Q,this.updateFilteredOptions()}_(Q,J){if(Q===" ")this.handleSpaceToggle();else this.handleInputChange(Q)}renderInstructions(){if(this.instructions===void 0||this.instructions){if(typeof this.instructions==="string")return this.instructions;return` Instructions: ${z0.arrowUp}/${z0.arrowDown}: Highlight option ${z0.arrowLeft}/${z0.arrowRight}/[space]: Toggle selection [a,b,c]/delete: Filter choices enter/return: Complete answer `}return""}renderCurrentInput(){return` Filtered results for: ${this.inputValue?this.inputValue:u.gray("Enter something to filter")}\n`}renderOption(Q,J,Z){let K;if(J.disabled)K=Q===Z?u.gray().underline(J.title):u.strikethrough().gray(J.title);else K=Q===Z?u.cyan().underline(J.title):J.title;return(J.selected?u.green(z0.radioOn):z0.radioOff)+" "+K}renderDoneOrInstructions(){if(this.done)return this.value.filter((J)=>J.selected).map((J)=>J.title).join(", ");const Q=[u.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];if(this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled)Q.push(u.yellow(this.warn));return Q.join(" ")}render(){if(this.closed)return;if(this.firstRender)this.out.write(nK.hide);super.render();let Q=[Q5.symbol(this.done,this.aborted),u.bold(this.msg),Q5.delimiter(!1),this.renderDoneOrInstructions()].join(" ");if(this.showMinError)Q+=u.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1;Q+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+Q),this.clear=eQ(Q,this.out.columns)}}Z5.exports=J5});var R5=B((OX,B5)=>{var W5=M(),pK=m(),z5=w(),U5=z5.style,iK=z5.clear,H5=$(),aK=H5.erase,X5=H5.cursor;class Y5 extends pK{constructor(Q={}){super(Q);this.msg=Q.message,this.value=Q.initial,this.initialValue=!!Q.initial,this.yesMsg=Q.yes||"yes",this.yesOption=Q.yesOption||"(Y/n)",this.noMsg=Q.no||"no",this.noOption=Q.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write("\n"),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write("\n"),this.close()}_(Q,J){if(Q.toLowerCase()==="y")return this.value=!0,this.submit();if(Q.toLowerCase()==="n")return this.value=!1,this.submit();return this.bell()}render(){if(this.closed)return;if(this.firstRender)this.out.write(X5.hide);else this.out.write(iK(this.outputText,this.out.columns));super.render(),this.outputText=[U5.symbol(this.done,this.aborted),W5.bold(this.msg),U5.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:W5.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(aK.line+X5.to(0)+this.outputText)}}B5.exports=Y5});var G5=B((GX,O5)=>{O5.exports={TextPrompt:x9(),SelectPrompt:d9(),TogglePrompt:a9(),DatePrompt:fQ(),NumberPrompt:gQ(),MultiselectPrompt:T1(),AutocompletePrompt:rQ(),AutocompleteMultiselectPrompt:K5(),ConfirmPrompt:R5()}});var V5=B((M5)=>{var h=function(Q,J,Z={}){return new Promise((K,W)=>{const U=new oK[Q](J),X=Z.onAbort||m0,z=Z.onSubmit||m0,H=Z.onExit||m0;U.on("state",J.onState||m0),U.on("submit",(Y)=>K(z(Y))),U.on("exit",(Y)=>K(H(Y))),U.on("abort",(Y)=>W(X(Y)))})},C=M5,oK=G5(),m0=(Q)=>Q;C.text=(Q)=>h("TextPrompt",Q);C.password=(Q)=>{return Q.style="password",C.text(Q)};C.invisible=(Q)=>{return Q.style="invisible",C.text(Q)};C.number=(Q)=>h("NumberPrompt",Q);C.date=(Q)=>h("DatePrompt",Q);C.confirm=(Q)=>h("ConfirmPrompt",Q);C.list=(Q)=>{const J=Q.separator||",";return h("TextPrompt",Q,{onSubmit:(Z)=>Z.split(J).map((K)=>K.trim())})};C.toggle=(Q)=>h("TogglePrompt",Q);C.select=(Q)=>h("SelectPrompt",Q);C.multiselect=(Q)=>{Q.choices=[].concat(Q.choices||[]);const J=(Z)=>Z.filter((K)=>K.selected).map((K)=>K.value);return h("MultiselectPrompt",Q,{onAbort:J,onSubmit:J})};C.autocompleteMultiselect=(Q)=>{Q.choices=[].concat(Q.choices||[]);const J=(Z)=>Z.filter((K)=>K.selected).map((K)=>K.value);return h("AutocompleteMultiselectPrompt",Q,{onAbort:J,onSubmit:J})};var sK=(Q,J)=>Promise.resolve(J.filter((Z)=>Z.title.slice(0,Q.length).toLowerCase()===Q.toLowerCase()));C.autocomplete=(Q)=>{return Q.suggest=Q.suggest||sK,Q.choices=[].concat(Q.choices||[]),h("AutocompletePrompt",Q)}});var j5=B((VX,E5)=>{var $5=function(Q,J){var Z=Object.keys(Q);if(Object.getOwnPropertySymbols){var K=Object.getOwnPropertySymbols(Q);if(J)K=K.filter(function(W){return Object.getOwnPropertyDescriptor(Q,W).enumerable});Z.push.apply(Z,K)}return Z},L5=function(Q){for(var J=1;J<arguments.length;J++){var Z=arguments[J]!=null?arguments[J]:{};if(J%2)$5(Object(Z),!0).forEach(function(K){tK(Q,K,Z[K])});else if(Object.getOwnPropertyDescriptors)Object.defineProperties(Q,Object.getOwnPropertyDescriptors(Z));else $5(Object(Z)).forEach(function(K){Object.defineProperty(Q,K,Object.getOwnPropertyDescriptor(Z,K))})}return Q},tK=function(Q,J,Z){if(J in Q)Object.defineProperty(Q,J,{value:Z,enumerable:!0,configurable:!0,writable:!0});else Q[J]=Z;return Q},rK=function(Q,J){var Z=typeof Symbol!=="undefined"&&Q[Symbol.iterator]||Q["@@iterator"];if(!Z){if(Array.isArray(Q)||(Z=eK(Q))||J&&Q&&typeof Q.length==="number"){if(Z)Q=Z;var K=0,W=function H(){};return{s:W,n:function H(){if(K>=Q.length)return{done:!0};return{done:!1,value:Q[K++]}},e:function H(Y){throw Y},f:W}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var U=!0,X=!1,z;return{s:function H(){Z=Z.call(Q)},n:function H(){var Y=Z.next();return U=Y.done,Y},e:function H(Y){X=!0,z=Y},f:function H(){try{if(!U&&Z.return!=null)Z.return()}finally{if(X)throw z}}}},eK=function(Q,J){if(!Q)return;if(typeof Q==="string")return N5(Q,J);var Z=Object.prototype.toString.call(Q).slice(8,-1);if(Z==="Object"&&Q.constructor)Z=Q.constructor.name;if(Z==="Map"||Z==="Set")return Array.from(Q);if(Z==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Z))return N5(Q,J)},N5=function(Q,J){if(J==null||J>Q.length)J=Q.length;for(var Z=0,K=new Array(J);Z<J;Z++)K[Z]=Q[Z];return K},F5=function(Q,J,Z,K,W,U,X){try{var z=Q[U](X),H=z.value}catch(Y){Z(Y);return}if(z.done)J(H);else Promise.resolve(H).then(K,W)},T5=function(Q){return function(){var J=this,Z=arguments;return new Promise(function(K,W){var U=Q.apply(J,Z);function X(H){F5(U,K,W,X,z,"next",H)}function z(H){F5(U,K,W,X,z,"throw",H)}X(void 0)})}},i=function(){return S1.apply(this,arguments)},S1=function(){return S1=T5(function*(Q=[],{onSubmit:J=D5,onCancel:Z=D5}={}){const K={},W=i._override||{};Q=[].concat(Q);let U,X,z,H,Y,D;const E=function(){var j=T5(function*(I,J0,p1=!1){if(!p1&&I.validate&&I.validate(J0)!==!0)return;return I.format?yield I.format(J0,K):J0});return function I(J0,p1){return j.apply(this,arguments)}}();var N=rK(Q),F;try{for(N.s();!(F=N.n()).done;){X=F.value;var s=X;if(H=s.name,Y=s.type,typeof Y==="function")Y=yield Y(U,L5({},K),X),X.type=Y;if(!Y)continue;for(let j in X){if(Q6.includes(j))continue;let I=X[j];X[j]=typeof I==="function"?yield I(U,L5({},K),D):I}if(D=X,typeof X.message!=="string")throw new Error("prompt message is required");var T=X;if(H=T.name,Y=T.type,C1[Y]===void 0)throw new Error(`prompt type (${Y}) is not defined`);if(W[X.name]!==void 0){if(U=yield E(X,W[X.name]),U!==void 0){K[H]=U;continue}}try{U=i._injected?J6(i._injected,X.initial):yield C1[Y](X),K[H]=U=yield E(X,U,!0),z=yield J(X,U,K)}catch(j){z=!(yield Z(X,K))}if(z)return K}}catch(j){N.e(j)}finally{N.f()}return K}),S1.apply(this,arguments)},J6=function(Q,J){const Z=Q.shift();if(Z instanceof Error)throw Z;return Z===void 0?J:Z},Z6=function(Q){i._injected=(i._injected||[]).concat(Q)},K6=function(Q){i._override=Object.assign({},Q)},C1=V5(),Q6=["suggest","format","onState","validate","onRender","type"],D5=()=>{};E5.exports=Object.assign(i,{prompt:i,prompts:C1,inject:Z6,override:K6})});var S5=B(($X,C5)=>{C5.exports=(Q,J)=>{if(Q.meta&&Q.name!=="escape")return;if(Q.ctrl){if(Q.name==="a")return"first";if(Q.name==="c")return"abort";if(Q.name==="d")return"abort";if(Q.name==="e")return"last";if(Q.name==="g")return"reset"}if(J){if(Q.name==="j")return"down";if(Q.name==="k")return"up"}if(Q.name==="return")return"submit";if(Q.name==="enter")return"submit";if(Q.name==="backspace")return"delete";if(Q.name==="delete")return"deleteForward";if(Q.name==="abort")return"abort";if(Q.name==="escape")return"exit";if(Q.name==="tab")return"next";if(Q.name==="pagedown")return"nextPage";if(Q.name==="pageup")return"prevPage";if(Q.name==="home")return"home";if(Q.name==="end")return"end";if(Q.name==="up")return"up";if(Q.name==="down")return"down";if(Q.name==="right")return"right";if(Q.name==="left")return"left";return!1}});var g0=B((LX,I5)=>{I5.exports=(Q)=>{const J=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))