create-enchilada 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +92 -68
- package/package.json +4 -4
- package/templates/node-express/package.json +2 -2
- package/templates/react-dev/package.json +3 -3
- package/templates/react-dev-typescript/package.json +6 -6
- package/templates/react-dev-webpack/package.json +4 -4
- package/templates/react-typescript/package.json +3 -3
- package/templates/react-webpack/.babelrc +1 -0
- package/templates/react-webpack/package.json +2 -1
- package/templates/react-experimental/_gitignore +0 -89
- package/templates/react-experimental/farm.config.ts +0 -5
- package/templates/react-experimental/index.html +0 -12
- package/templates/react-experimental/oxlintrc.json +0 -12
- package/templates/react-experimental/package.json +0 -28
- package/templates/react-experimental/src/App.css +0 -3
- package/templates/react-experimental/src/App.jsx +0 -20
- package/templates/react-experimental/src/index.css +0 -57
- package/templates/react-experimental/src/main.jsx +0 -10
- package/templates/react-experimental/tsconfig.json +0 -25
- package/templates/react-experimental/tsconfig.node.json +0 -11
package/dist/index.js
CHANGED
|
@@ -1,104 +1,104 @@
|
|
|
1
|
-
import Pt from"readline";import Ct from"events";import{fileURLToPath as
|
|
2
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var
|
|
1
|
+
import Pt from"readline";import Ct from"events";import{fileURLToPath as ui}from"node:url";import X from"node:path";import oe,{argv as ci}from"node:process";import di from"node:os";import Et from"node:tty";import{readFileSync as fi,writeFileSync as pi,existsSync as Dt,mkdirSync as mi}from"fs";import{readdirSync as gi,lstatSync as vi,mkdirSync as bi,copyFileSync as yi}from"node:fs";function _t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var le={},he,qt;function q(){if(qt)return he;qt=1;const{FORCE_COLOR:e,NODE_DISABLE_COLORS:r,TERM:n}=process.env,t={enabled:!r&&n!=="dumb"&&e!=="0",reset:i(0,0),bold:i(1,22),dim:i(2,22),italic:i(3,23),underline:i(4,24),inverse:i(7,27),hidden:i(8,28),strikethrough:i(9,29),black:i(30,39),red:i(31,39),green:i(32,39),yellow:i(33,39),blue:i(34,39),magenta:i(35,39),cyan:i(36,39),white:i(37,39),gray:i(90,39),grey:i(90,39),bgBlack:i(40,49),bgRed:i(41,49),bgGreen:i(42,49),bgYellow:i(43,49),bgBlue:i(44,49),bgMagenta:i(45,49),bgCyan:i(46,49),bgWhite:i(47,49)};function s(v,h){let u=0,o,m="",d="";for(;u<v.length;u++)o=v[u],m+=o.open,d+=o.close,h.includes(o.close)&&(h=h.replace(o.rgx,o.close+o.open));return m+h+d}function f(v,h){let u={has:v,keys:h};return u.reset=t.reset.bind(u),u.bold=t.bold.bind(u),u.dim=t.dim.bind(u),u.italic=t.italic.bind(u),u.underline=t.underline.bind(u),u.inverse=t.inverse.bind(u),u.hidden=t.hidden.bind(u),u.strikethrough=t.strikethrough.bind(u),u.black=t.black.bind(u),u.red=t.red.bind(u),u.green=t.green.bind(u),u.yellow=t.yellow.bind(u),u.blue=t.blue.bind(u),u.magenta=t.magenta.bind(u),u.cyan=t.cyan.bind(u),u.white=t.white.bind(u),u.gray=t.gray.bind(u),u.grey=t.grey.bind(u),u.bgBlack=t.bgBlack.bind(u),u.bgRed=t.bgRed.bind(u),u.bgGreen=t.bgGreen.bind(u),u.bgYellow=t.bgYellow.bind(u),u.bgBlue=t.bgBlue.bind(u),u.bgMagenta=t.bgMagenta.bind(u),u.bgCyan=t.bgCyan.bind(u),u.bgWhite=t.bgWhite.bind(u),u}function i(v,h){let u={open:`\x1B[${v}m`,close:`\x1B[${h}m`,rgx:new RegExp(`\\x1b\\[${h}m`,"g")};return function(o){return this!==void 0&&this.has!==void 0?(this.has.includes(v)||(this.has.push(v),this.keys.push(u)),o===void 0?this:t.enabled?s(this.keys,o+""):o+""):o===void 0?f([v],[u]):t.enabled?s([u],o+""):o+""}}return he=t,he}var ae,At;function wi(){return At||(At=1,ae=(e,r)=>{if(!(e.meta&&e.name!=="escape")){if(e.ctrl){if(e.name==="a")return"first";if(e.name==="c"||e.name==="d")return"abort";if(e.name==="e")return"last";if(e.name==="g")return"reset"}if(r){if(e.name==="j")return"down";if(e.name==="k")return"up"}return e.name==="return"||e.name==="enter"?"submit":e.name==="backspace"?"delete":e.name==="delete"?"deleteForward":e.name==="abort"?"abort":e.name==="escape"?"exit":e.name==="tab"?"next":e.name==="pagedown"?"nextPage":e.name==="pageup"?"prevPage":e.name==="home"?"home":e.name==="end"?"end":e.name==="up"?"up":e.name==="down"?"down":e.name==="right"?"right":e.name==="left"?"left":!1}}),ae}var ue,It;function ce(){return It||(It=1,ue=e=>{const r=["[\\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("|"),n=new RegExp(r,"g");return typeof e=="string"?e.replace(n,""):e}),ue}var de,Ft;function A(){if(Ft)return de;Ft=1;const e="\x1B",r=`${e}[`,n="\x07",t={to(i,v){return v?`${r}${v+1};${i+1}H`:`${r}${i+1}G`},move(i,v){let h="";return i<0?h+=`${r}${-i}D`:i>0&&(h+=`${r}${i}C`),v<0?h+=`${r}${-v}A`:v>0&&(h+=`${r}${v}B`),h},up:(i=1)=>`${r}${i}A`,down:(i=1)=>`${r}${i}B`,forward:(i=1)=>`${r}${i}C`,backward:(i=1)=>`${r}${i}D`,nextLine:(i=1)=>`${r}E`.repeat(i),prevLine:(i=1)=>`${r}F`.repeat(i),left:`${r}G`,hide:`${r}?25l`,show:`${r}?25h`,save:`${e}7`,restore:`${e}8`},s={up:(i=1)=>`${r}S`.repeat(i),down:(i=1)=>`${r}T`.repeat(i)},f={screen:`${r}2J`,up:(i=1)=>`${r}1J`.repeat(i),down:(i=1)=>`${r}J`.repeat(i),line:`${r}2K`,lineEnd:`${r}K`,lineStart:`${r}1K`,lines(i){let v="";for(let h=0;h<i;h++)v+=this.line+(h<i-1?t.up():"");return i&&(v+=t.left),v}};return de={cursor:t,scroll:s,erase:f,beep:n},de}var fe,jt;function xi(){if(jt)return fe;jt=1;function e(h,u){var o=typeof Symbol<"u"&&h[Symbol.iterator]||h["@@iterator"];if(!o){if(Array.isArray(h)||(o=r(h))||u){o&&(h=o);var m=0,d=function(){};return{s:d,n:function(){return m>=h.length?{done:!0}:{done:!1,value:h[m++]}},e:function(c){throw c},f:d}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var l=!0,a=!1,b;return{s:function(){o=o.call(h)},n:function(){var c=o.next();return l=c.done,c},e:function(c){a=!0,b=c},f:function(){try{!l&&o.return!=null&&o.return()}finally{if(a)throw b}}}}function r(h,u){if(h){if(typeof h=="string")return n(h,u);var o=Object.prototype.toString.call(h).slice(8,-1);if(o==="Object"&&h.constructor&&(o=h.constructor.name),o==="Map"||o==="Set")return Array.from(h);if(o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return n(h,u)}}function n(h,u){(u==null||u>h.length)&&(u=h.length);for(var o=0,m=new Array(u);o<u;o++)m[o]=h[o];return m}const t=ce(),s=A(),f=s.erase,i=s.cursor,v=h=>[...t(h)].length;return fe=function(h,u){if(!u)return f.line+i.to(0);let o=0;const m=h.split(/\r?\n/);var d=e(m),l;try{for(d.s();!(l=d.n()).done;){let a=l.value;o+=1+Math.floor(Math.max(v(a)-1,0)/u)}}catch(a){d.e(a)}finally{d.f()}return f.lines(o)},fe}var pe,kt;function Nt(){if(kt)return pe;kt=1;const e={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},r={arrowUp:e.arrowUp,arrowDown:e.arrowDown,arrowLeft:e.arrowLeft,arrowRight:e.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"};return pe=process.platform==="win32"?r:e,pe}var me,Lt;function Si(){if(Lt)return me;Lt=1;const e=q(),r=Nt(),n=Object.freeze({password:{scale:1,render:h=>"*".repeat(h.length)},emoji:{scale:2,render:h=>"\u{1F603}".repeat(h.length)},invisible:{scale:0,render:h=>""},default:{scale:1,render:h=>`${h}`}}),t=h=>n[h]||n.default,s=Object.freeze({aborted:e.red(r.cross),done:e.green(r.tick),exited:e.yellow(r.cross),default:e.cyan("?")});return me={styles:n,render:t,symbols:s,symbol:(h,u,o)=>u?s.aborted:o?s.exited:h?s.done:s.default,delimiter:h=>e.gray(h?r.ellipsis:r.pointerSmall),item:(h,u)=>e.gray(h?u?r.pointerSmall:"+":r.line)},me}var ge,Vt;function $i(){if(Vt)return ge;Vt=1;const e=ce();return ge=function(r,n){let t=String(e(r)||"").split(/\r?\n/);return n?t.map(s=>Math.ceil(s.length/n)).reduce((s,f)=>s+f):t.length},ge}var ve,Yt;function Ti(){return Yt||(Yt=1,ve=(e,r={})=>{const n=Number.isSafeInteger(parseInt(r.margin))?new Array(parseInt(r.margin)).fill(" ").join(""):r.margin||"",t=r.width;return(e||"").split(/\r?\n/g).map(s=>s.split(/\s+/g).reduce((f,i)=>(i.length+n.length>=t||f[f.length-1].length+i.length+1<t?f[f.length-1]+=` ${i}`:f.push(`${n}${i}`),f),[n]).join(`
|
|
3
3
|
`)).join(`
|
|
4
|
-
`)}),ve}var be,
|
|
5
|
-
`),this.close()}validate(){var
|
|
6
|
-
`),
|
|
7
|
-
`).reduce((
|
|
8
|
-
${g?" ":m.pointerSmall} ${
|
|
4
|
+
`)}),ve}var be,Bt;function Mi(){return Bt||(Bt=1,be=(e,r,n)=>{n=n||r;let t=Math.min(r-n,e-Math.floor(n/2));t<0&&(t=0);let s=Math.min(t+n,r);return{startIndex:t,endIndex:s}}),be}var ye,Ht;function Y(){return Ht||(Ht=1,ye={action:wi(),clear:xi(),style:Si(),strip:ce(),figures:Nt(),lines:$i(),wrap:Ti(),entriesToDisplay:Mi()}),ye}var we,Jt;function z(){if(Jt)return we;Jt=1;const e=Pt,r=Y(),n=r.action,t=Ct,s=A(),f=s.beep,i=s.cursor,v=q();class h extends t{constructor(o={}){super(),this.firstRender=!0,this.in=o.stdin||process.stdin,this.out=o.stdout||process.stdout,this.onRender=(o.onRender||(()=>{})).bind(this);const m=e.createInterface({input:this.in,escapeCodeTimeout:50});e.emitKeypressEvents(this.in,m),this.in.isTTY&&this.in.setRawMode(!0);const d=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,l=(a,b)=>{let g=n(b,d);g===!1?this._&&this._(a,b):typeof this[g]=="function"?this[g](b):this.bell()};this.close=()=>{this.out.write(i.show),this.in.removeListener("keypress",l),this.in.isTTY&&this.in.setRawMode(!1),m.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",l)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(f)}render(){this.onRender(v),this.firstRender&&(this.firstRender=!1)}}return we=h,we}var xe,Ut;function Oi(){if(Ut)return xe;Ut=1;function e(l,a,b,g,c,p,y){try{var w=l[p](y),x=w.value}catch($){b($);return}w.done?a(x):Promise.resolve(x).then(g,c)}function r(l){return function(){var a=this,b=arguments;return new Promise(function(g,c){var p=l.apply(a,b);function y(x){e(p,g,c,y,w,"next",x)}function w(x){e(p,g,c,y,w,"throw",x)}y(void 0)})}}const n=q(),t=z(),s=A(),f=s.erase,i=s.cursor,v=Y(),h=v.style,u=v.clear,o=v.lines,m=v.figures;class d extends t{constructor(a={}){super(a),this.transform=h.render(a.style),this.scale=this.transform.scale,this.msg=a.message,this.initial=a.initial||"",this.validator=a.validate||(()=>!0),this.value="",this.errorMsg=a.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=u("",this.out.columns),this.render()}set value(a){!a&&this.initial?(this.placeholder=!0,this.rendered=n.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(a)),this._value=a,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=+!!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(`
|
|
5
|
+
`),this.close()}validate(){var a=this;return r(function*(){let b=yield a.validator(a.value);typeof b=="string"&&(a.errorMsg=b,b=!1),a.error=!b})()}submit(){var a=this;return r(function*(){if(a.value=a.value||a.initial,a.cursorOffset=0,a.cursor=a.rendered.length,yield a.validate(),a.error){a.red=!0,a.fire(),a.render();return}a.done=!0,a.aborted=!1,a.fire(),a.render(),a.out.write(`
|
|
6
|
+
`),a.close()})()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(a){this.placeholder||(this.cursor=this.cursor+a,this.cursorOffset+=a)}_(a,b){let g=this.value.slice(0,this.cursor),c=this.value.slice(this.cursor);this.value=`${g}${a}${c}`,this.red=!1,this.cursor=this.placeholder?0:g.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let a=this.value.slice(0,this.cursor-1),b=this.value.slice(this.cursor);this.value=`${a}${b}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let a=this.value.slice(0,this.cursor),b=this.value.slice(this.cursor+1);this.value=`${a}${b}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0: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(){this.closed||(this.firstRender||(this.outputError&&this.out.write(i.down(o(this.outputError,this.out.columns)-1)+u(this.outputError,this.out.columns)),this.out.write(u(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[h.symbol(this.done,this.aborted),n.bold(this.msg),h.delimiter(this.done),this.red?n.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
7
|
+
`).reduce((a,b,g)=>a+`
|
|
8
|
+
${g?" ":m.pointerSmall} ${n.red().italic(b)}`,"")),this.out.write(f.line+i.to(0)+this.outputText+i.save+this.outputError+i.restore+i.move(this.cursorOffset,0)))}}return xe=d,xe}var Se,Gt;function Ri(){if(Gt)return Se;Gt=1;const e=q(),r=z(),n=Y(),t=n.style,s=n.clear,f=n.figures,i=n.wrap,v=n.entriesToDisplay,h=A(),u=h.cursor;class o extends r{constructor(d={}){super(d),this.msg=d.message,this.hint=d.hint||"- Use arrow-keys. Return to submit.",this.warn=d.warn||"- This option is disabled",this.cursor=d.initial||0,this.choices=d.choices.map((l,a)=>(typeof l=="string"&&(l={title:l,value:a}),{title:l&&(l.title||l.value||l),value:l&&(l.value===void 0?a:l.value),description:l&&l.description,selected:l&&l.selected,disabled:l&&l.disabled})),this.optionsPerPage=d.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=s("",this.out.columns),this.render()}moveCursor(d){this.cursor=d,this.value=this.choices[d].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(`
|
|
9
9
|
`),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
10
|
-
`),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(
|
|
11
|
-
`;for(let
|
|
12
|
-
`+i(y.description,{margin:3,width:this.out.columns})))),this.outputText+=`${
|
|
13
|
-
`}}this.out.write(this.outputText)}}return
|
|
10
|
+
`),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(d,l){if(d===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(u.hide):this.out.write(s(this.outputText,this.out.columns)),super.render();let d=v(this.cursor,this.choices.length,this.optionsPerPage),l=d.startIndex,a=d.endIndex;if(this.outputText=[t.symbol(this.done,this.aborted),e.bold(this.msg),t.delimiter(!1),this.done?this.selection.title:this.selection.disabled?e.yellow(this.warn):e.gray(this.hint)].join(" "),!this.done){this.outputText+=`
|
|
11
|
+
`;for(let b=l;b<a;b++){let g,c,p="",y=this.choices[b];b===l&&l>0?c=f.arrowUp:b===a-1&&a<this.choices.length?c=f.arrowDown:c=" ",y.disabled?(g=this.cursor===b?e.gray().underline(y.title):e.strikethrough().gray(y.title),c=(this.cursor===b?e.bold().gray(f.pointer)+" ":" ")+c):(g=this.cursor===b?e.cyan().underline(y.title):y.title,c=(this.cursor===b?e.cyan(f.pointer)+" ":" ")+c,y.description&&this.cursor===b&&(p=` - ${y.description}`,(c.length+g.length+p.length>=this.out.columns||y.description.split(/\r?\n/).length>1)&&(p=`
|
|
12
|
+
`+i(y.description,{margin:3,width:this.out.columns})))),this.outputText+=`${c} ${g}${e.gray(p)}
|
|
13
|
+
`}}this.out.write(this.outputText)}}return Se=o,Se}var $e,Wt;function Pi(){if(Wt)return $e;Wt=1;const e=q(),r=z(),n=Y(),t=n.style,s=n.clear,f=A(),i=f.cursor,v=f.erase;class h extends r{constructor(o={}){super(o),this.msg=o.message,this.value=!!o.initial,this.active=o.active||"on",this.inactive=o.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(`
|
|
14
14
|
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
15
|
-
`),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()}_(
|
|
16
|
-
`),this.close()}validate(){var
|
|
17
|
-
`)
|
|
18
|
-
`).reduce((
|
|
19
|
-
${
|
|
20
|
-
`),this.close()}validate(){var
|
|
21
|
-
`),
|
|
22
|
-
`).reduce((
|
|
23
|
-
${y?" ":
|
|
24
|
-
`),this.close()}submit(){const
|
|
25
|
-
`),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(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render()}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(
|
|
15
|
+
`),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()}_(o,m){if(o===" ")this.value=!this.value;else if(o==="1")this.value=!0;else if(o==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(i.hide):this.out.write(s(this.outputText,this.out.columns)),super.render(),this.outputText=[t.symbol(this.done,this.aborted),e.bold(this.msg),t.delimiter(this.done),this.value?this.inactive:e.cyan().underline(this.inactive),e.gray("/"),this.value?e.cyan().underline(this.active):this.active].join(" "),this.out.write(v.line+i.to(0)+this.outputText))}}return $e=h,$e}var Te,zt;function J(){if(zt)return Te;zt=1;class e{constructor({token:n,date:t,parts:s,locales:f}){this.token=n,this.date=t||new Date,this.parts=s||[this],this.locales=f||{}}up(){}down(){}next(){const n=this.parts.indexOf(this);return this.parts.find((t,s)=>s>n&&t instanceof e)}setTo(n){}prev(){let n=[].concat(this.parts).reverse();const t=n.indexOf(this);return n.find((s,f)=>f>t&&s instanceof e)}toString(){return String(this.date)}}return Te=e,Te}var Me,Kt;function Ci(){if(Kt)return Me;Kt=1;const e=J();class r extends e{constructor(t={}){super(t)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let t=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?t.toUpperCase():t}}return Me=r,Me}var Oe,Zt;function Ei(){if(Zt)return Oe;Zt=1;const e=J(),r=t=>(t=t%10,t===1?"st":t===2?"nd":t===3?"rd":"th");class n extends e{constructor(s={}){super(s)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(s){this.date.setDate(parseInt(s.substr(-2)))}toString(){let s=this.date.getDate(),f=this.date.getDay();return this.token==="DD"?String(s).padStart(2,"0"):this.token==="Do"?s+r(s):this.token==="d"?f+1:this.token==="ddd"?this.locales.weekdaysShort[f]:this.token==="dddd"?this.locales.weekdays[f]:s}}return Oe=n,Oe}var Re,Xt;function Di(){if(Xt)return Re;Xt=1;const e=J();class r extends e{constructor(t={}){super(t)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(t){this.date.setHours(parseInt(t.substr(-2)))}toString(){let t=this.date.getHours();return/h/.test(this.token)&&(t=t%12||12),this.token.length>1?String(t).padStart(2,"0"):t}}return Re=r,Re}var Pe,Qt;function _i(){if(Qt)return Pe;Qt=1;const e=J();class r extends e{constructor(t={}){super(t)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(t){this.date.setMilliseconds(parseInt(t.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}}return Pe=r,Pe}var Ce,er;function qi(){if(er)return Ce;er=1;const e=J();class r extends e{constructor(t={}){super(t)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(t){this.date.setMinutes(parseInt(t.substr(-2)))}toString(){let t=this.date.getMinutes();return this.token.length>1?String(t).padStart(2,"0"):t}}return Ce=r,Ce}var Ee,tr;function Ai(){if(tr)return Ee;tr=1;const e=J();class r extends e{constructor(t={}){super(t)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(t){t=parseInt(t.substr(-2))-1,this.date.setMonth(t<0?0:t)}toString(){let t=this.date.getMonth(),s=this.token.length;return s===2?String(t+1).padStart(2,"0"):s===3?this.locales.monthsShort[t]:s===4?this.locales.months[t]:String(t+1)}}return Ee=r,Ee}var De,rr;function Ii(){if(rr)return De;rr=1;const e=J();class r extends e{constructor(t={}){super(t)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(t){this.date.setSeconds(parseInt(t.substr(-2)))}toString(){let t=this.date.getSeconds();return this.token.length>1?String(t).padStart(2,"0"):t}}return De=r,De}var _e,ir;function Fi(){if(ir)return _e;ir=1;const e=J();class r extends e{constructor(t={}){super(t)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(t){this.date.setFullYear(t.substr(-4))}toString(){let t=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?t.substr(-2):t}}return _e=r,_e}var qe,sr;function ji(){return sr||(sr=1,qe={DatePart:J(),Meridiem:Ci(),Day:Ei(),Hours:Di(),Milliseconds:_i(),Minutes:qi(),Month:Ai(),Seconds:Ii(),Year:Fi()}),qe}var Ae,nr;function ki(){if(nr)return Ae;nr=1;function e(M,S,R,E,C,F,V){try{var k=M[F](V),j=k.value}catch(Z){R(Z);return}k.done?S(j):Promise.resolve(j).then(E,C)}function r(M){return function(){var S=this,R=arguments;return new Promise(function(E,C){var F=M.apply(S,R);function V(j){e(F,E,C,V,k,"next",j)}function k(j){e(F,E,C,V,k,"throw",j)}V(void 0)})}}const n=q(),t=z(),s=Y(),f=s.style,i=s.clear,v=s.figures,h=A(),u=h.erase,o=h.cursor,m=ji(),d=m.DatePart,l=m.Meridiem,a=m.Day,b=m.Hours,g=m.Milliseconds,c=m.Minutes,p=m.Month,y=m.Seconds,w=m.Year,x=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,$={1:({token:M})=>M.replace(/\\(.)/g,"$1"),2:M=>new a(M),3:M=>new p(M),4:M=>new w(M),5:M=>new l(M),6:M=>new b(M),7:M=>new c(M),8:M=>new y(M),9:M=>new g(M)},T={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 O extends t{constructor(S={}){super(S),this.msg=S.message,this.cursor=0,this.typed="",this.locales=Object.assign(T,S.locales),this._date=S.initial||new Date,this.errorMsg=S.error||"Please Enter A Valid Value",this.validator=S.validate||(()=>!0),this.mask=S.mask||"YYYY-MM-DD HH:mm:ss",this.clear=i("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(S){S&&this._date.setTime(S.getTime())}set mask(S){let R;for(this.parts=[];R=x.exec(S);){let C=R.shift(),F=R.findIndex(V=>V!=null);this.parts.push(F in $?$[F]({token:R[F]||C,date:this.date,parts:this.parts,locales:this.locales}):R[F]||C)}let E=this.parts.reduce((C,F)=>(typeof F=="string"&&typeof C[C.length-1]=="string"?C[C.length-1]+=F:C.push(F),C),[]);this.parts.splice(0),this.parts.push(...E),this.reset()}moveCursor(S){this.typed="",this.cursor=S,this.fire()}reset(){this.moveCursor(this.parts.findIndex(S=>S instanceof d)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
16
|
+
`),this.close()}validate(){var S=this;return r(function*(){let R=yield S.validator(S.value);typeof R=="string"&&(S.errorMsg=R,R=!1),S.error=!R})()}submit(){var S=this;return r(function*(){if(yield S.validate(),S.error){S.color="red",S.fire(),S.render();return}S.done=!0,S.aborted=!1,S.fire(),S.render(),S.out.write(`
|
|
17
|
+
`),S.close()})()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let S=this.parts[this.cursor].prev();if(S==null)return this.bell();this.moveCursor(this.parts.indexOf(S)),this.render()}right(){let S=this.parts[this.cursor].next();if(S==null)return this.bell();this.moveCursor(this.parts.indexOf(S)),this.render()}next(){let S=this.parts[this.cursor].next();this.moveCursor(S?this.parts.indexOf(S):this.parts.findIndex(R=>R instanceof d)),this.render()}_(S){/\d/.test(S)&&(this.typed+=S,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(o.hide):this.out.write(i(this.outputText,this.out.columns)),super.render(),this.outputText=[f.symbol(this.done,this.aborted),n.bold(this.msg),f.delimiter(!1),this.parts.reduce((S,R,E)=>S.concat(E===this.cursor&&!this.done?n.cyan().underline(R.toString()):R),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
|
|
18
|
+
`).reduce((S,R,E)=>S+`
|
|
19
|
+
${E?" ":v.pointerSmall} ${n.red().italic(R)}`,"")),this.out.write(u.line+o.to(0)+this.outputText))}}return Ae=O,Ae}var Ie,or;function Ni(){if(or)return Ie;or=1;function e(g,c,p,y,w,x,$){try{var T=g[x]($),O=T.value}catch(M){p(M);return}T.done?c(O):Promise.resolve(O).then(y,w)}function r(g){return function(){var c=this,p=arguments;return new Promise(function(y,w){var x=g.apply(c,p);function $(O){e(x,y,w,$,T,"next",O)}function T(O){e(x,y,w,$,T,"throw",O)}$(void 0)})}}const n=q(),t=z(),s=A(),f=s.cursor,i=s.erase,v=Y(),h=v.style,u=v.figures,o=v.clear,m=v.lines,d=/[0-9]/,l=g=>g!==void 0,a=(g,c)=>{let p=Math.pow(10,c);return Math.round(g*p)/p};class b extends t{constructor(c={}){super(c),this.transform=h.render(c.style),this.msg=c.message,this.initial=l(c.initial)?c.initial:"",this.float=!!c.float,this.round=c.round||2,this.inc=c.increment||1,this.min=l(c.min)?c.min:-1/0,this.max=l(c.max)?c.max:1/0,this.errorMsg=c.error||"Please Enter A Valid Value",this.validator=c.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(c){!c&&c!==0?(this.placeholder=!0,this.rendered=n.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${a(c,this.round)}`),this._value=a(c,this.round)),this.fire()}get value(){return this._value}parse(c){return this.float?parseFloat(c):parseInt(c)}valid(c){return c==="-"||c==="."&&this.float||d.test(c)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let c=this.value;this.value=c!==""?c:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
20
|
+
`),this.close()}validate(){var c=this;return r(function*(){let p=yield c.validator(c.value);typeof p=="string"&&(c.errorMsg=p,p=!1),c.error=!p})()}submit(){var c=this;return r(function*(){if(yield c.validate(),c.error){c.color="red",c.fire(),c.render();return}let p=c.value;c.value=p!==""?p:c.initial,c.done=!0,c.aborted=!1,c.error=!1,c.fire(),c.render(),c.out.write(`
|
|
21
|
+
`),c.close()})()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),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),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let c=this.value.toString();if(c.length===0)return this.bell();this.value=this.parse(c=c.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()}_(c,p){if(!this.valid(c))return this.bell();const y=Date.now();if(y-this.lastHit>1e3&&(this.typed=""),this.typed+=c,this.lastHit=y,this.color="cyan",c===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(f.down(m(this.outputError,this.out.columns)-1)+o(this.outputError,this.out.columns)),this.out.write(o(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[h.symbol(this.done,this.aborted),n.bold(this.msg),h.delimiter(this.done),!this.done||!this.done&&!this.placeholder?n[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
22
|
+
`).reduce((c,p,y)=>c+`
|
|
23
|
+
${y?" ":u.pointerSmall} ${n.red().italic(p)}`,"")),this.out.write(i.line+f.to(0)+this.outputText+f.save+this.outputError+f.restore))}}return Ie=b,Ie}var Fe,lr;function hr(){if(lr)return Fe;lr=1;const e=q(),r=A(),n=r.cursor,t=z(),s=Y(),f=s.clear,i=s.figures,v=s.style,h=s.wrap,u=s.entriesToDisplay;class o extends t{constructor(d={}){super(d),this.msg=d.message,this.cursor=d.cursor||0,this.scrollIndex=d.cursor||0,this.hint=d.hint||"",this.warn=d.warn||"- This option is disabled -",this.minSelected=d.min,this.showMinError=!1,this.maxChoices=d.max,this.instructions=d.instructions,this.optionsPerPage=d.optionsPerPage||10,this.value=d.choices.map((l,a)=>(typeof l=="string"&&(l={title:l,value:a}),{title:l&&(l.title||l.value||l),description:l&&l.description,value:l&&(l.value===void 0?a:l.value),selected:l&&l.selected,disabled:l&&l.disabled})),this.clear=f("",this.out.columns),d.overrideRender||this.render()}reset(){this.value.map(d=>!d.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(d=>d.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
24
|
+
`),this.close()}submit(){const d=this.value.filter(l=>l.selected);this.minSelected&&d.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
25
|
+
`),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(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render()}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(d=>d.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){const d=this.value[this.cursor];if(d.selected)d.selected=!1,this.render();else{if(d.disabled||this.value.filter(l=>l.selected).length>=this.maxChoices)return this.bell();d.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();const d=!this.value[this.cursor].selected;this.value.filter(l=>!l.disabled).forEach(l=>l.selected=d),this.render()}_(d,l){if(d===" ")this.handleSpaceToggle();else if(d==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
26
26
|
Instructions:
|
|
27
27
|
${i.arrowUp}/${i.arrowDown}: Highlight option
|
|
28
28
|
${i.arrowLeft}/${i.arrowRight}/[space]: Toggle selection
|
|
29
29
|
`+(this.maxChoices===void 0?` a: Toggle all
|
|
30
|
-
`:"")+" enter/return: Complete answer":""}renderOption(
|
|
31
|
-
`+l
|
|
32
|
-
`+
|
|
33
|
-
`)}renderOptions(
|
|
30
|
+
`:"")+" enter/return: Complete answer":""}renderOption(d,l,a,b){const g=(l.selected?e.green(i.radioOn):i.radioOff)+" "+b+" ";let c,p;return l.disabled?c=d===a?e.gray().underline(l.title):e.strikethrough().gray(l.title):(c=d===a?e.cyan().underline(l.title):l.title,d===a&&l.description&&(p=` - ${l.description}`,(g.length+c.length+p.length>=this.out.columns||l.description.split(/\r?\n/).length>1)&&(p=`
|
|
31
|
+
`+h(l.description,{margin:g.length,width:this.out.columns})))),g+c+e.gray(p||"")}paginateOptions(d){if(d.length===0)return e.red("No matches for this query.");let l=u(this.cursor,d.length,this.optionsPerPage),a=l.startIndex,b=l.endIndex,g,c=[];for(let p=a;p<b;p++)p===a&&a>0?g=i.arrowUp:p===b-1&&b<d.length?g=i.arrowDown:g=" ",c.push(this.renderOption(this.cursor,d[p],p,g));return`
|
|
32
|
+
`+c.join(`
|
|
33
|
+
`)}renderOptions(d){return this.done?"":this.paginateOptions(d)}renderDoneOrInstructions(){if(this.done)return this.value.filter(l=>l.selected).map(l=>l.title).join(", ");const d=[e.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&d.push(e.yellow(this.warn)),d.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(n.hide),super.render();let d=[v.symbol(this.done,this.aborted),e.bold(this.msg),v.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(d+=e.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),d+=this.renderOptions(this.value),this.out.write(this.clear+d),this.clear=f(d,this.out.columns)}}return Fe=o,Fe}var je,ar;function Li(){if(ar)return je;ar=1;function e(c,p,y,w,x,$,T){try{var O=c[$](T),M=O.value}catch(S){y(S);return}O.done?p(M):Promise.resolve(M).then(w,x)}function r(c){return function(){var p=this,y=arguments;return new Promise(function(w,x){var $=c.apply(p,y);function T(M){e($,w,x,T,O,"next",M)}function O(M){e($,w,x,T,O,"throw",M)}T(void 0)})}}const n=q(),t=z(),s=A(),f=s.erase,i=s.cursor,v=Y(),h=v.style,u=v.clear,o=v.figures,m=v.wrap,d=v.entriesToDisplay,l=(c,p)=>c[p]&&(c[p].value||c[p].title||c[p]),a=(c,p)=>c[p]&&(c[p].title||c[p].value||c[p]),b=(c,p)=>{const y=c.findIndex(w=>w.value===p||w.title===p);return y>-1?y:void 0};class g extends t{constructor(p={}){super(p),this.msg=p.message,this.suggest=p.suggest,this.choices=p.choices,this.initial=typeof p.initial=="number"?p.initial:b(p.choices,p.initial),this.select=this.initial||p.cursor||0,this.i18n={noMatches:p.noMatches||"no matches found"},this.fallback=p.fallback||this.initial,this.clearFirst=p.clearFirst||!1,this.suggestions=[],this.input="",this.limit=p.limit||10,this.cursor=0,this.transform=h.render(p.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=u("",this.out.columns),this.complete(this.render),this.render()}set fallback(p){this._fb=Number.isSafeInteger(parseInt(p))?parseInt(p):p}get fallback(){let p;return typeof this._fb=="number"?p=this.choices[this._fb]:typeof this._fb=="string"&&(p={title:this._fb}),p||this._fb||{title:this.i18n.noMatches}}moveSelect(p){this.select=p,this.suggestions.length>0?this.value=l(this.suggestions,p):this.value=this.fallback.value,this.fire()}complete(p){var y=this;return r(function*(){const w=y.completing=y.suggest(y.input,y.choices),x=yield w;if(y.completing!==w)return;y.suggestions=x.map((T,O,M)=>({title:a(M,O),value:l(M,O),description:T.description})),y.completing=!1;const $=Math.max(x.length-1,0);y.moveSelect(Math.min($,y.select)),p&&p()})()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
34
34
|
`),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
35
35
|
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
36
|
-
`),this.close()}_(p,y){let w=this.input.slice(0,this.cursor),x=this.input.slice(this.cursor);this.input=`${w}${p}${x}`,this.cursor=w.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let p=this.input.slice(0,this.cursor-1),y=this.input.slice(this.cursor);this.input=`${p}${y}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let p=this.input.slice(0,this.cursor),y=this.input.slice(this.cursor+1);this.input=`${p}${y}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):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(p,y,w,x){let
|
|
37
|
-
`+m(p.description,{margin:3,width:this.out.columns}))),T+" "+O+
|
|
36
|
+
`),this.close()}_(p,y){let w=this.input.slice(0,this.cursor),x=this.input.slice(this.cursor);this.input=`${w}${p}${x}`,this.cursor=w.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let p=this.input.slice(0,this.cursor-1),y=this.input.slice(this.cursor);this.input=`${p}${y}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let p=this.input.slice(0,this.cursor),y=this.input.slice(this.cursor+1);this.input=`${p}${y}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):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(p,y,w,x){let $,T=w?o.arrowUp:x?o.arrowDown:" ",O=y?n.cyan().underline(p.title):p.title;return T=(y?n.cyan(o.pointer)+" ":" ")+T,p.description&&($=` - ${p.description}`,(T.length+O.length+$.length>=this.out.columns||p.description.split(/\r?\n/).length>1)&&($=`
|
|
37
|
+
`+m(p.description,{margin:3,width:this.out.columns}))),T+" "+O+n.gray($||"")}render(){if(this.closed)return;this.firstRender?this.out.write(i.hide):this.out.write(u(this.outputText,this.out.columns)),super.render();let p=d(this.select,this.choices.length,this.limit),y=p.startIndex,w=p.endIndex;if(this.outputText=[h.symbol(this.done,this.aborted,this.exited),n.bold(this.msg),h.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 x=this.suggestions.slice(y,w).map(($,T)=>this.renderOption($,this.select===T+y,T===0&&y>0,T+y===w-1&&w<this.choices.length)).join(`
|
|
38
38
|
`);this.outputText+=`
|
|
39
|
-
`+(x||
|
|
39
|
+
`+(x||n.gray(this.fallback.title))}this.out.write(f.line+i.to(0)+this.outputText)}}return je=g,je}var ke,ur;function Vi(){if(ur)return ke;ur=1;const e=q(),r=A(),n=r.cursor,t=hr(),s=Y(),f=s.clear,i=s.style,v=s.figures;class h extends t{constructor(o={}){o.overrideRender=!0,super(o),this.inputValue="",this.clear=f("",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(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(o=>o.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){const o=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(d=>this.inputValue?!!(typeof d.title=="string"&&d.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof d.value=="string"&&d.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);const m=this.filteredOptions.findIndex(d=>d===o);this.cursor=m<0?0:m,this.render()}handleSpaceToggle(){const o=this.filteredOptions[this.cursor];if(o.selected)o.selected=!1,this.render();else{if(o.disabled||this.value.filter(m=>m.selected).length>=this.maxChoices)return this.bell();o.selected=!0,this.render()}}handleInputChange(o){this.inputValue=this.inputValue+o,this.updateFilteredOptions()}_(o,m){o===" "?this.handleSpaceToggle():this.handleInputChange(o)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
40
40
|
Instructions:
|
|
41
|
-
${
|
|
42
|
-
${
|
|
41
|
+
${v.arrowUp}/${v.arrowDown}: Highlight option
|
|
42
|
+
${v.arrowLeft}/${v.arrowRight}/[space]: Toggle selection
|
|
43
43
|
[a,b,c]/delete: Filter choices
|
|
44
44
|
enter/return: Complete answer
|
|
45
45
|
`:""}renderCurrentInput(){return`
|
|
46
46
|
Filtered results for: ${this.inputValue?this.inputValue:e.gray("Enter something to filter")}
|
|
47
|
-
`}renderOption(
|
|
47
|
+
`}renderOption(o,m,d){let l;return m.disabled?l=o===d?e.gray().underline(m.title):e.strikethrough().gray(m.title):l=o===d?e.cyan().underline(m.title):m.title,(m.selected?e.green(v.radioOn):v.radioOff)+" "+l}renderDoneOrInstructions(){if(this.done)return this.value.filter(m=>m.selected).map(m=>m.title).join(", ");const o=[e.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&o.push(e.yellow(this.warn)),o.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(n.hide),super.render();let o=[i.symbol(this.done,this.aborted),e.bold(this.msg),i.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(o+=e.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),o+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+o),this.clear=f(o,this.out.columns)}}return ke=h,ke}var Ne,cr;function Yi(){if(cr)return Ne;cr=1;const e=q(),r=z(),n=Y(),t=n.style,s=n.clear,f=A(),i=f.erase,v=f.cursor;class h extends r{constructor(o={}){super(o),this.msg=o.message,this.value=o.initial,this.initialValue=!!o.initial,this.yesMsg=o.yes||"yes",this.yesOption=o.yesOption||"(Y/n)",this.noMsg=o.no||"no",this.noOption=o.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(`
|
|
48
48
|
`),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
49
|
-
`),this.close()}_(
|
|
50
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var x=!0
|
|
49
|
+
`),this.close()}_(o,m){return o.toLowerCase()==="y"?(this.value=!0,this.submit()):o.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(v.hide):this.out.write(s(this.outputText,this.out.columns)),super.render(),this.outputText=[t.symbol(this.done,this.aborted),e.bold(this.msg),t.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:e.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(i.line+v.to(0)+this.outputText))}}return Ne=h,Ne}var Le,dr;function Bi(){return dr||(dr=1,Le={TextPrompt:Oi(),SelectPrompt:Ri(),TogglePrompt:Pi(),DatePrompt:ki(),NumberPrompt:Ni(),MultiselectPrompt:hr(),AutocompletePrompt:Li(),AutocompleteMultiselectPrompt:Vi(),ConfirmPrompt:Yi()}),Le}var fr;function Hi(){return fr||(fr=1,function(e){const r=e,n=Bi(),t=i=>i;function s(i,v,h={}){return new Promise((u,o)=>{const m=new n[i](v),d=h.onAbort||t,l=h.onSubmit||t,a=h.onExit||t;m.on("state",v.onState||t),m.on("submit",b=>u(l(b))),m.on("exit",b=>u(a(b))),m.on("abort",b=>o(d(b)))})}r.text=i=>s("TextPrompt",i),r.password=i=>(i.style="password",r.text(i)),r.invisible=i=>(i.style="invisible",r.text(i)),r.number=i=>s("NumberPrompt",i),r.date=i=>s("DatePrompt",i),r.confirm=i=>s("ConfirmPrompt",i),r.list=i=>{const v=i.separator||",";return s("TextPrompt",i,{onSubmit:h=>h.split(v).map(u=>u.trim())})},r.toggle=i=>s("TogglePrompt",i),r.select=i=>s("SelectPrompt",i),r.multiselect=i=>{i.choices=[].concat(i.choices||[]);const v=h=>h.filter(u=>u.selected).map(u=>u.value);return s("MultiselectPrompt",i,{onAbort:v,onSubmit:v})},r.autocompleteMultiselect=i=>{i.choices=[].concat(i.choices||[]);const v=h=>h.filter(u=>u.selected).map(u=>u.value);return s("AutocompleteMultiselectPrompt",i,{onAbort:v,onSubmit:v})};const f=(i,v)=>Promise.resolve(v.filter(h=>h.title.slice(0,i.length).toLowerCase()===i.toLowerCase()));r.autocomplete=i=>(i.suggest=i.suggest||f,i.choices=[].concat(i.choices||[]),s("AutocompletePrompt",i))}(le)),le}var Ve,pr;function Ji(){if(pr)return Ve;pr=1;function e(g,c){var p=Object.keys(g);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(g);c&&(y=y.filter(function(w){return Object.getOwnPropertyDescriptor(g,w).enumerable})),p.push.apply(p,y)}return p}function r(g){for(var c=1;c<arguments.length;c++){var p=arguments[c]!=null?arguments[c]:{};c%2?e(Object(p),!0).forEach(function(y){n(g,y,p[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(g,Object.getOwnPropertyDescriptors(p)):e(Object(p)).forEach(function(y){Object.defineProperty(g,y,Object.getOwnPropertyDescriptor(p,y))})}return g}function n(g,c,p){return c in g?Object.defineProperty(g,c,{value:p,enumerable:!0,configurable:!0,writable:!0}):g[c]=p,g}function t(g,c){var p=typeof Symbol<"u"&&g[Symbol.iterator]||g["@@iterator"];if(!p){if(Array.isArray(g)||(p=s(g))||c){p&&(g=p);var y=0,w=function(){};return{s:w,n:function(){return y>=g.length?{done:!0}:{done:!1,value:g[y++]}},e:function(M){throw M},f:w}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
50
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var x=!0,$=!1,T;return{s:function(){p=p.call(g)},n:function(){var M=p.next();return x=M.done,M},e:function(M){$=!0,T=M},f:function(){try{!x&&p.return!=null&&p.return()}finally{if($)throw T}}}}function s(g,c){if(g){if(typeof g=="string")return f(g,c);var p=Object.prototype.toString.call(g).slice(8,-1);if(p==="Object"&&g.constructor&&(p=g.constructor.name),p==="Map"||p==="Set")return Array.from(g);if(p==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(p))return f(g,c)}}function f(g,c){(c==null||c>g.length)&&(c=g.length);for(var p=0,y=new Array(c);p<c;p++)y[p]=g[p];return y}function i(g,c,p,y,w,x,$){try{var T=g[x]($),O=T.value}catch(M){p(M);return}T.done?c(O):Promise.resolve(O).then(y,w)}function v(g){return function(){var c=this,p=arguments;return new Promise(function(y,w){var x=g.apply(c,p);function $(O){i(x,y,w,$,T,"next",O)}function T(O){i(x,y,w,$,T,"throw",O)}$(void 0)})}}const h=Hi(),u=["suggest","format","onState","validate","onRender","type"],o=()=>{};function m(){return d.apply(this,arguments)}function d(){return d=v(function*(g=[],{onSubmit:c=o,onCancel:p=o}={}){const y={},w=m._override||{};g=[].concat(g);let x,$,T,O,M,S;const R=function(){var k=v(function*(j,Z,Rt=!1){if(!(!Rt&&j.validate&&j.validate(Z)!==!0))return j.format?yield j.format(Z,y):Z});return function(Z,Rt){return k.apply(this,arguments)}}();var E=t(g),C;try{for(E.s();!(C=E.n()).done;){$=C.value;var F=$;if(O=F.name,M=F.type,typeof M=="function"&&(M=yield M(x,r({},y),$),$.type=M),!!M){for(let k in $){if(u.includes(k))continue;let j=$[k];$[k]=typeof j=="function"?yield j(x,r({},y),S):j}if(S=$,typeof $.message!="string")throw new Error("prompt message is required");var V=$;if(O=V.name,M=V.type,h[M]===void 0)throw new Error(`prompt type (${M}) is not defined`);if(w[$.name]!==void 0&&(x=yield R($,w[$.name]),x!==void 0)){y[O]=x;continue}try{x=m._injected?l(m._injected,$.initial):yield h[M]($),y[O]=x=yield R($,x,!0),T=yield c($,x,y)}catch{T=!(yield p($,y))}if(T)return y}}}catch(k){E.e(k)}finally{E.f()}return y}),d.apply(this,arguments)}function l(g,c){const p=g.shift();if(p instanceof Error)throw p;return p===void 0?c:p}function a(g){m._injected=(m._injected||[]).concat(g)}function b(g){m._override=Object.assign({},g)}return Ve=Object.assign(m,{prompt:m,prompts:h,inject:a,override:b}),Ve}var Ye={},Be,mr;function Ui(){return mr||(mr=1,Be=(e,r)=>{if(!(e.meta&&e.name!=="escape")){if(e.ctrl){if(e.name==="a")return"first";if(e.name==="c"||e.name==="d")return"abort";if(e.name==="e")return"last";if(e.name==="g")return"reset"}if(r){if(e.name==="j")return"down";if(e.name==="k")return"up"}return e.name==="return"||e.name==="enter"?"submit":e.name==="backspace"?"delete":e.name==="delete"?"deleteForward":e.name==="abort"?"abort":e.name==="escape"?"exit":e.name==="tab"?"next":e.name==="pagedown"?"nextPage":e.name==="pageup"?"prevPage":e.name==="home"?"home":e.name==="end"?"end":e.name==="up"?"up":e.name==="down"?"down":e.name==="right"?"right":e.name==="left"?"left":!1}}),Be}var He,gr;function Je(){return gr||(gr=1,He=e=>{const r=["[\\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("|"),n=new RegExp(r,"g");return typeof e=="string"?e.replace(n,""):e}),He}var Ue,vr;function Gi(){if(vr)return Ue;vr=1;const e=Je(),{erase:r,cursor:n}=A(),t=s=>[...e(s)].length;return Ue=function(s,f){if(!f)return r.line+n.to(0);let i=0;const v=s.split(/\r?\n/);for(let h of v)i+=1+Math.floor(Math.max(t(h)-1,0)/f);return r.lines(i)},Ue}var Ge,br;function yr(){if(br)return Ge;br=1;const e={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},r={arrowUp:e.arrowUp,arrowDown:e.arrowDown,arrowLeft:e.arrowLeft,arrowRight:e.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"};return Ge=process.platform==="win32"?r:e,Ge}var We,wr;function Wi(){if(wr)return We;wr=1;const e=q(),r=yr(),n=Object.freeze({password:{scale:1,render:h=>"*".repeat(h.length)},emoji:{scale:2,render:h=>"\u{1F603}".repeat(h.length)},invisible:{scale:0,render:h=>""},default:{scale:1,render:h=>`${h}`}}),t=h=>n[h]||n.default,s=Object.freeze({aborted:e.red(r.cross),done:e.green(r.tick),exited:e.yellow(r.cross),default:e.cyan("?")});return We={styles:n,render:t,symbols:s,symbol:(h,u,o)=>u?s.aborted:o?s.exited:h?s.done:s.default,delimiter:h=>e.gray(h?r.ellipsis:r.pointerSmall),item:(h,u)=>e.gray(h?u?r.pointerSmall:"+":r.line)},We}var ze,xr;function zi(){if(xr)return ze;xr=1;const e=Je();return ze=function(r,n){let t=String(e(r)||"").split(/\r?\n/);return n?t.map(s=>Math.ceil(s.length/n)).reduce((s,f)=>s+f):t.length},ze}var Ke,Sr;function Ki(){return Sr||(Sr=1,Ke=(e,r={})=>{const n=Number.isSafeInteger(parseInt(r.margin))?new Array(parseInt(r.margin)).fill(" ").join(""):r.margin||"",t=r.width;return(e||"").split(/\r?\n/g).map(s=>s.split(/\s+/g).reduce((f,i)=>(i.length+n.length>=t||f[f.length-1].length+i.length+1<t?f[f.length-1]+=` ${i}`:f.push(`${n}${i}`),f),[n]).join(`
|
|
51
51
|
`)).join(`
|
|
52
|
-
`)}),Ke}var Ze
|
|
53
|
-
`),this.close()}async validate(){let
|
|
54
|
-
`),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(
|
|
55
|
-
`).reduce((
|
|
56
|
-
${
|
|
52
|
+
`)}),Ke}var Ze,$r;function Zi(){return $r||($r=1,Ze=(e,r,n)=>{n=n||r;let t=Math.min(r-n,e-Math.floor(n/2));t<0&&(t=0);let s=Math.min(t+n,r);return{startIndex:t,endIndex:s}}),Ze}var Xe,Tr;function B(){return Tr||(Tr=1,Xe={action:Ui(),clear:Gi(),style:Wi(),strip:Je(),figures:yr(),lines:zi(),wrap:Ki(),entriesToDisplay:Zi()}),Xe}var Qe,Mr;function K(){if(Mr)return Qe;Mr=1;const e=Pt,{action:r}=B(),n=Ct,{beep:t,cursor:s}=A(),f=q();class i extends n{constructor(h={}){super(),this.firstRender=!0,this.in=h.stdin||process.stdin,this.out=h.stdout||process.stdout,this.onRender=(h.onRender||(()=>{})).bind(this);const u=e.createInterface({input:this.in,escapeCodeTimeout:50});e.emitKeypressEvents(this.in,u),this.in.isTTY&&this.in.setRawMode(!0);const o=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,m=(d,l)=>{let a=r(l,o);a===!1?this._&&this._(d,l):typeof this[a]=="function"?this[a](l):this.bell()};this.close=()=>{this.out.write(s.show),this.in.removeListener("keypress",m),this.in.isTTY&&this.in.setRawMode(!1),u.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",m)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(t)}render(){this.onRender(f),this.firstRender&&(this.firstRender=!1)}}return Qe=i,Qe}var et,Or;function Xi(){if(Or)return et;Or=1;const e=q(),r=K(),{erase:n,cursor:t}=A(),{style:s,clear:f,lines:i,figures:v}=B();class h extends r{constructor(o={}){super(o),this.transform=s.render(o.style),this.scale=this.transform.scale,this.msg=o.message,this.initial=o.initial||"",this.validator=o.validate||(()=>!0),this.value="",this.errorMsg=o.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=f("",this.out.columns),this.render()}set value(o){!o&&this.initial?(this.placeholder=!0,this.rendered=e.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(o)),this._value=o,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=+!!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(`
|
|
53
|
+
`),this.close()}async validate(){let o=await this.validator(this.value);typeof o=="string"&&(this.errorMsg=o,o=!1),this.error=!o}async submit(){if(this.value=this.value||this.initial,this.cursorOffset=0,this.cursor=this.rendered.length,await this.validate(),this.error){this.red=!0,this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
54
|
+
`),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(o){this.placeholder||(this.cursor=this.cursor+o,this.cursorOffset+=o)}_(o,m){let d=this.value.slice(0,this.cursor),l=this.value.slice(this.cursor);this.value=`${d}${o}${l}`,this.red=!1,this.cursor=this.placeholder?0:d.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let o=this.value.slice(0,this.cursor-1),m=this.value.slice(this.cursor);this.value=`${o}${m}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let o=this.value.slice(0,this.cursor),m=this.value.slice(this.cursor+1);this.value=`${o}${m}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0: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(){this.closed||(this.firstRender||(this.outputError&&this.out.write(t.down(i(this.outputError,this.out.columns)-1)+f(this.outputError,this.out.columns)),this.out.write(f(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[s.symbol(this.done,this.aborted),e.bold(this.msg),s.delimiter(this.done),this.red?e.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
55
|
+
`).reduce((o,m,d)=>o+`
|
|
56
|
+
${d?" ":v.pointerSmall} ${e.red().italic(m)}`,"")),this.out.write(n.line+t.to(0)+this.outputText+t.save+this.outputError+t.restore+t.move(this.cursorOffset,0)))}}return et=h,et}var tt,Rr;function Qi(){if(Rr)return tt;Rr=1;const e=q(),r=K(),{style:n,clear:t,figures:s,wrap:f,entriesToDisplay:i}=B(),{cursor:v}=A();class h extends r{constructor(o={}){super(o),this.msg=o.message,this.hint=o.hint||"- Use arrow-keys. Return to submit.",this.warn=o.warn||"- This option is disabled",this.cursor=o.initial||0,this.choices=o.choices.map((m,d)=>(typeof m=="string"&&(m={title:m,value:d}),{title:m&&(m.title||m.value||m),value:m&&(m.value===void 0?d:m.value),description:m&&m.description,selected:m&&m.selected,disabled:m&&m.disabled})),this.optionsPerPage=o.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=t("",this.out.columns),this.render()}moveCursor(o){this.cursor=o,this.value=this.choices[o].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(`
|
|
57
57
|
`),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
58
|
-
`),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(
|
|
59
|
-
`;for(let
|
|
60
|
-
`+
|
|
61
|
-
`}}this.out.write(this.outputText)}}return tt=
|
|
58
|
+
`),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(o,m){if(o===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(v.hide):this.out.write(t(this.outputText,this.out.columns)),super.render();let{startIndex:o,endIndex:m}=i(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[n.symbol(this.done,this.aborted),e.bold(this.msg),n.delimiter(!1),this.done?this.selection.title:this.selection.disabled?e.yellow(this.warn):e.gray(this.hint)].join(" "),!this.done){this.outputText+=`
|
|
59
|
+
`;for(let d=o;d<m;d++){let l,a,b="",g=this.choices[d];d===o&&o>0?a=s.arrowUp:d===m-1&&m<this.choices.length?a=s.arrowDown:a=" ",g.disabled?(l=this.cursor===d?e.gray().underline(g.title):e.strikethrough().gray(g.title),a=(this.cursor===d?e.bold().gray(s.pointer)+" ":" ")+a):(l=this.cursor===d?e.cyan().underline(g.title):g.title,a=(this.cursor===d?e.cyan(s.pointer)+" ":" ")+a,g.description&&this.cursor===d&&(b=` - ${g.description}`,(a.length+l.length+b.length>=this.out.columns||g.description.split(/\r?\n/).length>1)&&(b=`
|
|
60
|
+
`+f(g.description,{margin:3,width:this.out.columns})))),this.outputText+=`${a} ${l}${e.gray(b)}
|
|
61
|
+
`}}this.out.write(this.outputText)}}return tt=h,tt}var rt,Pr;function es(){if(Pr)return rt;Pr=1;const e=q(),r=K(),{style:n,clear:t}=B(),{cursor:s,erase:f}=A();class i extends r{constructor(h={}){super(h),this.msg=h.message,this.value=!!h.initial,this.active=h.active||"on",this.inactive=h.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(`
|
|
62
62
|
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
63
|
-
`),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()}_(
|
|
63
|
+
`),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()}_(h,u){if(h===" ")this.value=!this.value;else if(h==="1")this.value=!0;else if(h==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(s.hide):this.out.write(t(this.outputText,this.out.columns)),super.render(),this.outputText=[n.symbol(this.done,this.aborted),e.bold(this.msg),n.delimiter(this.done),this.value?this.inactive:e.cyan().underline(this.inactive),e.gray("/"),this.value?e.cyan().underline(this.active):this.active].join(" "),this.out.write(f.line+s.to(0)+this.outputText))}}return rt=i,rt}var it,Cr;function U(){if(Cr)return it;Cr=1;class e{constructor({token:n,date:t,parts:s,locales:f}){this.token=n,this.date=t||new Date,this.parts=s||[this],this.locales=f||{}}up(){}down(){}next(){const n=this.parts.indexOf(this);return this.parts.find((t,s)=>s>n&&t instanceof e)}setTo(n){}prev(){let n=[].concat(this.parts).reverse();const t=n.indexOf(this);return n.find((s,f)=>f>t&&s instanceof e)}toString(){return String(this.date)}}return it=e,it}var st,Er;function ts(){if(Er)return st;Er=1;const e=U();class r extends e{constructor(t={}){super(t)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let t=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?t.toUpperCase():t}}return st=r,st}var nt,Dr;function rs(){if(Dr)return nt;Dr=1;const e=U(),r=t=>(t=t%10,t===1?"st":t===2?"nd":t===3?"rd":"th");class n extends e{constructor(s={}){super(s)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(s){this.date.setDate(parseInt(s.substr(-2)))}toString(){let s=this.date.getDate(),f=this.date.getDay();return this.token==="DD"?String(s).padStart(2,"0"):this.token==="Do"?s+r(s):this.token==="d"?f+1:this.token==="ddd"?this.locales.weekdaysShort[f]:this.token==="dddd"?this.locales.weekdays[f]:s}}return nt=n,nt}var ot,_r;function is(){if(_r)return ot;_r=1;const e=U();class r extends e{constructor(t={}){super(t)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(t){this.date.setHours(parseInt(t.substr(-2)))}toString(){let t=this.date.getHours();return/h/.test(this.token)&&(t=t%12||12),this.token.length>1?String(t).padStart(2,"0"):t}}return ot=r,ot}var lt,qr;function ss(){if(qr)return lt;qr=1;const e=U();class r extends e{constructor(t={}){super(t)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(t){this.date.setMilliseconds(parseInt(t.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}}return lt=r,lt}var ht,Ar;function ns(){if(Ar)return ht;Ar=1;const e=U();class r extends e{constructor(t={}){super(t)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(t){this.date.setMinutes(parseInt(t.substr(-2)))}toString(){let t=this.date.getMinutes();return this.token.length>1?String(t).padStart(2,"0"):t}}return ht=r,ht}var at,Ir;function os(){if(Ir)return at;Ir=1;const e=U();class r extends e{constructor(t={}){super(t)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(t){t=parseInt(t.substr(-2))-1,this.date.setMonth(t<0?0:t)}toString(){let t=this.date.getMonth(),s=this.token.length;return s===2?String(t+1).padStart(2,"0"):s===3?this.locales.monthsShort[t]:s===4?this.locales.months[t]:String(t+1)}}return at=r,at}var ut,Fr;function ls(){if(Fr)return ut;Fr=1;const e=U();class r extends e{constructor(t={}){super(t)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(t){this.date.setSeconds(parseInt(t.substr(-2)))}toString(){let t=this.date.getSeconds();return this.token.length>1?String(t).padStart(2,"0"):t}}return ut=r,ut}var ct,jr;function hs(){if(jr)return ct;jr=1;const e=U();class r extends e{constructor(t={}){super(t)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(t){this.date.setFullYear(t.substr(-4))}toString(){let t=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?t.substr(-2):t}}return ct=r,ct}var dt,kr;function as(){return kr||(kr=1,dt={DatePart:U(),Meridiem:ts(),Day:rs(),Hours:is(),Milliseconds:ss(),Minutes:ns(),Month:os(),Seconds:ls(),Year:hs()}),dt}var ft,Nr;function us(){if(Nr)return ft;Nr=1;const e=q(),r=K(),{style:n,clear:t,figures:s}=B(),{erase:f,cursor:i}=A(),{DatePart:v,Meridiem:h,Day:u,Hours:o,Milliseconds:m,Minutes:d,Month:l,Seconds:a,Year:b}=as(),g=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,c={1:({token:w})=>w.replace(/\\(.)/g,"$1"),2:w=>new u(w),3:w=>new l(w),4:w=>new b(w),5:w=>new h(w),6:w=>new o(w),7:w=>new d(w),8:w=>new a(w),9:w=>new m(w)},p={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 y extends r{constructor(x={}){super(x),this.msg=x.message,this.cursor=0,this.typed="",this.locales=Object.assign(p,x.locales),this._date=x.initial||new Date,this.errorMsg=x.error||"Please Enter A Valid Value",this.validator=x.validate||(()=>!0),this.mask=x.mask||"YYYY-MM-DD HH:mm:ss",this.clear=t("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(x){x&&this._date.setTime(x.getTime())}set mask(x){let $;for(this.parts=[];$=g.exec(x);){let O=$.shift(),M=$.findIndex(S=>S!=null);this.parts.push(M in c?c[M]({token:$[M]||O,date:this.date,parts:this.parts,locales:this.locales}):$[M]||O)}let T=this.parts.reduce((O,M)=>(typeof M=="string"&&typeof O[O.length-1]=="string"?O[O.length-1]+=M:O.push(M),O),[]);this.parts.splice(0),this.parts.push(...T),this.reset()}moveCursor(x){this.typed="",this.cursor=x,this.fire()}reset(){this.moveCursor(this.parts.findIndex(x=>x instanceof v)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
64
64
|
`),this.close()}async validate(){let x=await this.validator(this.value);typeof x=="string"&&(this.errorMsg=x,x=!1),this.error=!x}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
65
|
-
`),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let x=this.parts[this.cursor].prev();if(x==null)return this.bell();this.moveCursor(this.parts.indexOf(x)),this.render()}right(){let x=this.parts[this.cursor].next();if(x==null)return this.bell();this.moveCursor(this.parts.indexOf(x)),this.render()}next(){let x=this.parts[this.cursor].next();this.moveCursor(x?this.parts.indexOf(x):this.parts.findIndex(
|
|
66
|
-
`).reduce((x
|
|
67
|
-
${T?" ":s.pointerSmall} ${e.red().italic(
|
|
68
|
-
`),this.close()}async validate(){let
|
|
69
|
-
`),this.close()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),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),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let
|
|
70
|
-
`).reduce((
|
|
71
|
-
${
|
|
72
|
-
`),this.close()}submit(){const
|
|
73
|
-
`),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(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render()}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(
|
|
65
|
+
`),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let x=this.parts[this.cursor].prev();if(x==null)return this.bell();this.moveCursor(this.parts.indexOf(x)),this.render()}right(){let x=this.parts[this.cursor].next();if(x==null)return this.bell();this.moveCursor(this.parts.indexOf(x)),this.render()}next(){let x=this.parts[this.cursor].next();this.moveCursor(x?this.parts.indexOf(x):this.parts.findIndex($=>$ instanceof v)),this.render()}_(x){/\d/.test(x)&&(this.typed+=x,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(i.hide):this.out.write(t(this.outputText,this.out.columns)),super.render(),this.outputText=[n.symbol(this.done,this.aborted),e.bold(this.msg),n.delimiter(!1),this.parts.reduce((x,$,T)=>x.concat(T===this.cursor&&!this.done?e.cyan().underline($.toString()):$),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
|
|
66
|
+
`).reduce((x,$,T)=>x+`
|
|
67
|
+
${T?" ":s.pointerSmall} ${e.red().italic($)}`,"")),this.out.write(f.line+i.to(0)+this.outputText))}}return ft=y,ft}var pt,Lr;function cs(){if(Lr)return pt;Lr=1;const e=q(),r=K(),{cursor:n,erase:t}=A(),{style:s,figures:f,clear:i,lines:v}=B(),h=/[0-9]/,u=d=>d!==void 0,o=(d,l)=>{let a=Math.pow(10,l);return Math.round(d*a)/a};class m extends r{constructor(l={}){super(l),this.transform=s.render(l.style),this.msg=l.message,this.initial=u(l.initial)?l.initial:"",this.float=!!l.float,this.round=l.round||2,this.inc=l.increment||1,this.min=u(l.min)?l.min:-1/0,this.max=u(l.max)?l.max:1/0,this.errorMsg=l.error||"Please Enter A Valid Value",this.validator=l.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(l){!l&&l!==0?(this.placeholder=!0,this.rendered=e.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${o(l,this.round)}`),this._value=o(l,this.round)),this.fire()}get value(){return this._value}parse(l){return this.float?parseFloat(l):parseInt(l)}valid(l){return l==="-"||l==="."&&this.float||h.test(l)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let l=this.value;this.value=l!==""?l:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
68
|
+
`),this.close()}async validate(){let l=await this.validator(this.value);typeof l=="string"&&(this.errorMsg=l,l=!1),this.error=!l}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}let l=this.value;this.value=l!==""?l:this.initial,this.done=!0,this.aborted=!1,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
69
|
+
`),this.close()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),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),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let l=this.value.toString();if(l.length===0)return this.bell();this.value=this.parse(l=l.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()}_(l,a){if(!this.valid(l))return this.bell();const b=Date.now();if(b-this.lastHit>1e3&&(this.typed=""),this.typed+=l,this.lastHit=b,this.color="cyan",l===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(n.down(v(this.outputError,this.out.columns)-1)+i(this.outputError,this.out.columns)),this.out.write(i(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[s.symbol(this.done,this.aborted),e.bold(this.msg),s.delimiter(this.done),!this.done||!this.done&&!this.placeholder?e[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
70
|
+
`).reduce((l,a,b)=>l+`
|
|
71
|
+
${b?" ":f.pointerSmall} ${e.red().italic(a)}`,"")),this.out.write(t.line+n.to(0)+this.outputText+n.save+this.outputError+n.restore))}}return pt=m,pt}var mt,Vr;function Yr(){if(Vr)return mt;Vr=1;const e=q(),{cursor:r}=A(),n=K(),{clear:t,figures:s,style:f,wrap:i,entriesToDisplay:v}=B();class h extends n{constructor(o={}){super(o),this.msg=o.message,this.cursor=o.cursor||0,this.scrollIndex=o.cursor||0,this.hint=o.hint||"",this.warn=o.warn||"- This option is disabled -",this.minSelected=o.min,this.showMinError=!1,this.maxChoices=o.max,this.instructions=o.instructions,this.optionsPerPage=o.optionsPerPage||10,this.value=o.choices.map((m,d)=>(typeof m=="string"&&(m={title:m,value:d}),{title:m&&(m.title||m.value||m),description:m&&m.description,value:m&&(m.value===void 0?d:m.value),selected:m&&m.selected,disabled:m&&m.disabled})),this.clear=t("",this.out.columns),o.overrideRender||this.render()}reset(){this.value.map(o=>!o.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(o=>o.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
72
|
+
`),this.close()}submit(){const o=this.value.filter(m=>m.selected);this.minSelected&&o.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
73
|
+
`),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(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render()}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(o=>o.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){const o=this.value[this.cursor];if(o.selected)o.selected=!1,this.render();else{if(o.disabled||this.value.filter(m=>m.selected).length>=this.maxChoices)return this.bell();o.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();const o=!this.value[this.cursor].selected;this.value.filter(m=>!m.disabled).forEach(m=>m.selected=o),this.render()}_(o,m){if(o===" ")this.handleSpaceToggle();else if(o==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
74
74
|
Instructions:
|
|
75
75
|
${s.arrowUp}/${s.arrowDown}: Highlight option
|
|
76
76
|
${s.arrowLeft}/${s.arrowRight}/[space]: Toggle selection
|
|
77
77
|
`+(this.maxChoices===void 0?` a: Toggle all
|
|
78
|
-
`:"")+" enter/return: Complete answer":""}renderOption(
|
|
79
|
-
`+i(m.description,{margin:
|
|
80
|
-
`+
|
|
81
|
-
`)}renderOptions(
|
|
78
|
+
`:"")+" enter/return: Complete answer":""}renderOption(o,m,d,l){const a=(m.selected?e.green(s.radioOn):s.radioOff)+" "+l+" ";let b,g;return m.disabled?b=o===d?e.gray().underline(m.title):e.strikethrough().gray(m.title):(b=o===d?e.cyan().underline(m.title):m.title,o===d&&m.description&&(g=` - ${m.description}`,(a.length+b.length+g.length>=this.out.columns||m.description.split(/\r?\n/).length>1)&&(g=`
|
|
79
|
+
`+i(m.description,{margin:a.length,width:this.out.columns})))),a+b+e.gray(g||"")}paginateOptions(o){if(o.length===0)return e.red("No matches for this query.");let{startIndex:m,endIndex:d}=v(this.cursor,o.length,this.optionsPerPage),l,a=[];for(let b=m;b<d;b++)b===m&&m>0?l=s.arrowUp:b===d-1&&d<o.length?l=s.arrowDown:l=" ",a.push(this.renderOption(this.cursor,o[b],b,l));return`
|
|
80
|
+
`+a.join(`
|
|
81
|
+
`)}renderOptions(o){return this.done?"":this.paginateOptions(o)}renderDoneOrInstructions(){if(this.done)return this.value.filter(m=>m.selected).map(m=>m.title).join(", ");const o=[e.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&o.push(e.yellow(this.warn)),o.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(r.hide),super.render();let o=[f.symbol(this.done,this.aborted),e.bold(this.msg),f.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(o+=e.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),o+=this.renderOptions(this.value),this.out.write(this.clear+o),this.clear=t(o,this.out.columns)}}return mt=h,mt}var gt,Br;function ds(){if(Br)return gt;Br=1;const e=q(),r=K(),{erase:n,cursor:t}=A(),{style:s,clear:f,figures:i,wrap:v,entriesToDisplay:h}=B(),u=(l,a)=>l[a]&&(l[a].value||l[a].title||l[a]),o=(l,a)=>l[a]&&(l[a].title||l[a].value||l[a]),m=(l,a)=>{const b=l.findIndex(g=>g.value===a||g.title===a);return b>-1?b:void 0};class d extends r{constructor(a={}){super(a),this.msg=a.message,this.suggest=a.suggest,this.choices=a.choices,this.initial=typeof a.initial=="number"?a.initial:m(a.choices,a.initial),this.select=this.initial||a.cursor||0,this.i18n={noMatches:a.noMatches||"no matches found"},this.fallback=a.fallback||this.initial,this.clearFirst=a.clearFirst||!1,this.suggestions=[],this.input="",this.limit=a.limit||10,this.cursor=0,this.transform=s.render(a.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=f("",this.out.columns),this.complete(this.render),this.render()}set fallback(a){this._fb=Number.isSafeInteger(parseInt(a))?parseInt(a):a}get fallback(){let a;return typeof this._fb=="number"?a=this.choices[this._fb]:typeof this._fb=="string"&&(a={title:this._fb}),a||this._fb||{title:this.i18n.noMatches}}moveSelect(a){this.select=a,this.suggestions.length>0?this.value=u(this.suggestions,a):this.value=this.fallback.value,this.fire()}async complete(a){const b=this.completing=this.suggest(this.input,this.choices),g=await b;if(this.completing!==b)return;this.suggestions=g.map((p,y,w)=>({title:o(w,y),value:u(w,y),description:p.description})),this.completing=!1;const c=Math.max(g.length-1,0);this.moveSelect(Math.min(c,this.select)),a&&a()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
82
82
|
`),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
83
83
|
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
84
|
-
`),this.close()}_(
|
|
85
|
-
`+
|
|
84
|
+
`),this.close()}_(a,b){let g=this.input.slice(0,this.cursor),c=this.input.slice(this.cursor);this.input=`${g}${a}${c}`,this.cursor=g.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let a=this.input.slice(0,this.cursor-1),b=this.input.slice(this.cursor);this.input=`${a}${b}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let a=this.input.slice(0,this.cursor),b=this.input.slice(this.cursor+1);this.input=`${a}${b}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):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(a,b,g,c){let p,y=g?i.arrowUp:c?i.arrowDown:" ",w=b?e.cyan().underline(a.title):a.title;return y=(b?e.cyan(i.pointer)+" ":" ")+y,a.description&&(p=` - ${a.description}`,(y.length+w.length+p.length>=this.out.columns||a.description.split(/\r?\n/).length>1)&&(p=`
|
|
85
|
+
`+v(a.description,{margin:3,width:this.out.columns}))),y+" "+w+e.gray(p||"")}render(){if(this.closed)return;this.firstRender?this.out.write(t.hide):this.out.write(f(this.outputText,this.out.columns)),super.render();let{startIndex:a,endIndex:b}=h(this.select,this.choices.length,this.limit);if(this.outputText=[s.symbol(this.done,this.aborted,this.exited),e.bold(this.msg),s.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 g=this.suggestions.slice(a,b).map((c,p)=>this.renderOption(c,this.select===p+a,p===0&&a>0,p+a===b-1&&b<this.choices.length)).join(`
|
|
86
86
|
`);this.outputText+=`
|
|
87
|
-
`+(g||e.gray(this.fallback.title))}this.out.write(
|
|
87
|
+
`+(g||e.gray(this.fallback.title))}this.out.write(n.line+t.to(0)+this.outputText)}}return gt=d,gt}var vt,Hr;function fs(){if(Hr)return vt;Hr=1;const e=q(),{cursor:r}=A(),n=Yr(),{clear:t,style:s,figures:f}=B();class i extends n{constructor(h={}){h.overrideRender=!0,super(h),this.inputValue="",this.clear=t("",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(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(h=>h.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){const h=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(o=>this.inputValue?!!(typeof o.title=="string"&&o.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof o.value=="string"&&o.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);const u=this.filteredOptions.findIndex(o=>o===h);this.cursor=u<0?0:u,this.render()}handleSpaceToggle(){const h=this.filteredOptions[this.cursor];if(h.selected)h.selected=!1,this.render();else{if(h.disabled||this.value.filter(u=>u.selected).length>=this.maxChoices)return this.bell();h.selected=!0,this.render()}}handleInputChange(h){this.inputValue=this.inputValue+h,this.updateFilteredOptions()}_(h,u){h===" "?this.handleSpaceToggle():this.handleInputChange(h)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
88
88
|
Instructions:
|
|
89
|
-
${
|
|
90
|
-
${
|
|
89
|
+
${f.arrowUp}/${f.arrowDown}: Highlight option
|
|
90
|
+
${f.arrowLeft}/${f.arrowRight}/[space]: Toggle selection
|
|
91
91
|
[a,b,c]/delete: Filter choices
|
|
92
92
|
enter/return: Complete answer
|
|
93
93
|
`:""}renderCurrentInput(){return`
|
|
94
94
|
Filtered results for: ${this.inputValue?this.inputValue:e.gray("Enter something to filter")}
|
|
95
|
-
`}renderOption(
|
|
95
|
+
`}renderOption(h,u,o){let m;return u.disabled?m=h===o?e.gray().underline(u.title):e.strikethrough().gray(u.title):m=h===o?e.cyan().underline(u.title):u.title,(u.selected?e.green(f.radioOn):f.radioOff)+" "+m}renderDoneOrInstructions(){if(this.done)return this.value.filter(u=>u.selected).map(u=>u.title).join(", ");const h=[e.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&h.push(e.yellow(this.warn)),h.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(r.hide),super.render();let h=[s.symbol(this.done,this.aborted),e.bold(this.msg),s.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(h+=e.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),h+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+h),this.clear=t(h,this.out.columns)}}return vt=i,vt}var bt,Jr;function ps(){if(Jr)return bt;Jr=1;const e=q(),r=K(),{style:n,clear:t}=B(),{erase:s,cursor:f}=A();class i extends r{constructor(h={}){super(h),this.msg=h.message,this.value=h.initial,this.initialValue=!!h.initial,this.yesMsg=h.yes||"yes",this.yesOption=h.yesOption||"(Y/n)",this.noMsg=h.no||"no",this.noOption=h.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(`
|
|
96
96
|
`),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
97
|
-
`),this.close()}_(l,a){return l.toLowerCase()==="y"?(this.value=!0,this.submit()):l.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(c.hide):this.out.write(t(this.outputText,this.out.columns)),super.render(),this.outputText=[o.symbol(this.done,this.aborted),e.bold(this.msg),o.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:e.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(s.line+c.to(0)+this.outputText))}}return bt=i,bt}var yt,Jr;function ps(){return Jr||(Jr=1,yt={TextPrompt:Zi(),SelectPrompt:Xi(),TogglePrompt:Qi(),DatePrompt:us(),NumberPrompt:as(),MultiselectPrompt:Vr(),AutocompletePrompt:cs(),AutocompleteMultiselectPrompt:ds(),ConfirmPrompt:fs()}),yt}var Wr;function ms(){return Wr||(Wr=1,function(e){const r=e,o=ps(),t=i=>i;function s(i,b,l={}){return new Promise((a,n)=>{const m=new o[i](b),f=l.onAbort||t,h=l.onSubmit||t,u=l.onExit||t;m.on("state",b.onState||t),m.on("submit",v=>a(h(v))),m.on("exit",v=>a(u(v))),m.on("abort",v=>n(f(v)))})}r.text=i=>s("TextPrompt",i),r.password=i=>(i.style="password",r.text(i)),r.invisible=i=>(i.style="invisible",r.text(i)),r.number=i=>s("NumberPrompt",i),r.date=i=>s("DatePrompt",i),r.confirm=i=>s("ConfirmPrompt",i),r.list=i=>{const b=i.separator||",";return s("TextPrompt",i,{onSubmit:l=>l.split(b).map(a=>a.trim())})},r.toggle=i=>s("TogglePrompt",i),r.select=i=>s("SelectPrompt",i),r.multiselect=i=>{i.choices=[].concat(i.choices||[]);const b=l=>l.filter(a=>a.selected).map(a=>a.value);return s("MultiselectPrompt",i,{onAbort:b,onSubmit:b})},r.autocompleteMultiselect=i=>{i.choices=[].concat(i.choices||[]);const b=l=>l.filter(a=>a.selected).map(a=>a.value);return s("AutocompleteMultiselectPrompt",i,{onAbort:b,onSubmit:b})};const c=(i,b)=>Promise.resolve(b.filter(l=>l.title.slice(0,i.length).toLowerCase()===i.toLowerCase()));r.autocomplete=i=>(i.suggest=i.suggest||c,i.choices=[].concat(i.choices||[]),s("AutocompletePrompt",i))}(Be)),Be}var wt,zr;function gs(){if(zr)return wt;zr=1;const e=ms(),r=["suggest","format","onState","validate","onRender","type"],o=()=>{};async function t(b=[],{onSubmit:l=o,onCancel:a=o}={}){const n={},m=t._override||{};b=[].concat(b);let f,h,u,v,g,d;const p=async(y,w,x=!1)=>{if(!(!x&&y.validate&&y.validate(w)!==!0))return y.format?await y.format(w,n):w};for(h of b)if({name:v,type:g}=h,typeof g=="function"&&(g=await g(f,{...n},h),h.type=g),!!g){for(let y in h){if(r.includes(y))continue;let w=h[y];h[y]=typeof w=="function"?await w(f,{...n},d):w}if(d=h,typeof h.message!="string")throw new Error("prompt message is required");if({name:v,type:g}=h,e[g]===void 0)throw new Error(`prompt type (${g}) is not defined`);if(m[h.name]!==void 0&&(f=await p(h,m[h.name]),f!==void 0)){n[v]=f;continue}try{f=t._injected?s(t._injected,h.initial):await e[g](h),n[v]=f=await p(h,f,!0),u=await l(h,f,n)}catch{u=!await a(h,n)}if(u)return n}return n}function s(b,l){const a=b.shift();if(a instanceof Error)throw a;return a===void 0?l:a}function c(b){t._injected=(t._injected||[]).concat(b)}function i(b){t._override=Object.assign({},b)}return wt=Object.assign(t,{prompt:t,prompts:e,inject:c,override:i}),wt}var xt,Kr;function vs(){if(Kr)return xt;Kr=1;function e(r){r=(Array.isArray(r)?r:r.split(".")).map(Number);let o=0,t=process.versions.node.split(".").map(Number);for(;o<r.length;o++){if(t[o]>r[o])return!1;if(r[o]>t[o])return!0}return!1}return xt=e("8.6.0")?Hi():gs(),xt}var bs=vs(),ie=qt(bs),$t,Zr;function ys(){if(Zr)return $t;Zr=1;function e(t,s){var c=t;s.slice(0,-1).forEach(function(b){c=c[b]||{}});var i=s[s.length-1];return i in c}function r(t){return typeof t=="number"||/^0x[0-9a-f]+$/i.test(t)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(t)}function o(t,s){return s==="constructor"&&typeof t[s]=="function"||s==="__proto__"}return $t=function(t,s){s||(s={});var c={bools:{},strings:{},unknownFn:null};typeof s.unknown=="function"&&(c.unknownFn=s.unknown),typeof s.boolean=="boolean"&&s.boolean?c.allBools=!0:[].concat(s.boolean).filter(Boolean).forEach(function(T){c.bools[T]=!0});var i={};function b(T){return i[T].some(function(O){return c.bools[O]})}Object.keys(s.alias||{}).forEach(function(T){i[T]=[].concat(s.alias[T]),i[T].forEach(function(O){i[O]=[T].concat(i[T].filter(function(M){return O!==M}))})}),[].concat(s.string).filter(Boolean).forEach(function(T){c.strings[T]=!0,i[T]&&[].concat(i[T]).forEach(function(O){c.strings[O]=!0})});var l=s.default||{},a={_:[]};function n(T,O){return c.allBools&&/^--[^=]+$/.test(O)||c.strings[T]||c.bools[T]||i[T]}function m(T,O,M){for(var $=T,R=0;R<O.length-1;R++){var D=O[R];if(o($,D))return;$[D]===void 0&&($[D]={}),($[D]===Object.prototype||$[D]===Number.prototype||$[D]===String.prototype)&&($[D]={}),$[D]===Array.prototype&&($[D]=[]),$=$[D]}var C=O[O.length-1];o($,C)||(($===Object.prototype||$===Number.prototype||$===String.prototype)&&($={}),$===Array.prototype&&($=[]),$[C]===void 0||c.bools[C]||typeof $[C]=="boolean"?$[C]=M:Array.isArray($[C])?$[C].push(M):$[C]=[$[C],M])}function f(T,O,M){if(!(M&&c.unknownFn&&!n(T,M)&&c.unknownFn(M)===!1)){var $=!c.strings[T]&&r(O)?Number(O):O;m(a,T.split("."),$),(i[T]||[]).forEach(function(R){m(a,R.split("."),$)})}}Object.keys(c.bools).forEach(function(T){f(T,l[T]===void 0?!1:l[T])});var h=[];t.indexOf("--")!==-1&&(h=t.slice(t.indexOf("--")+1),t=t.slice(0,t.indexOf("--")));for(var u=0;u<t.length;u++){var v=t[u],g,d;if(/^--.+=/.test(v)){var p=v.match(/^--([^=]+)=([\s\S]*)$/);g=p[1];var y=p[2];c.bools[g]&&(y=y!=="false"),f(g,y,v)}else if(/^--no-.+/.test(v))g=v.match(/^--no-(.+)/)[1],f(g,!1,v);else if(/^--.+/.test(v))g=v.match(/^--(.+)/)[1],d=t[u+1],d!==void 0&&!/^(-|--)[^-]/.test(d)&&!c.bools[g]&&!c.allBools&&(!i[g]||!b(g))?(f(g,d,v),u+=1):/^(true|false)$/.test(d)?(f(g,d==="true",v),u+=1):f(g,c.strings[g]?"":!0,v);else if(/^-[^-]+/.test(v)){for(var w=v.slice(1,-1).split(""),x=!1,S=0;S<w.length;S++){if(d=v.slice(S+2),d==="-"){f(w[S],d,v);continue}if(/[A-Za-z]/.test(w[S])&&d[0]==="="){f(w[S],d.slice(1),v),x=!0;break}if(/[A-Za-z]/.test(w[S])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(d)){f(w[S],d,v),x=!0;break}if(w[S+1]&&w[S+1].match(/\W/)){f(w[S],v.slice(S+2),v),x=!0;break}else f(w[S],c.strings[w[S]]?"":!0,v)}g=v.slice(-1)[0],!x&&g!=="-"&&(t[u+1]&&!/^(-|--)[^-]/.test(t[u+1])&&!c.bools[g]&&(!i[g]||!b(g))?(f(g,t[u+1],v),u+=1):t[u+1]&&/^(true|false)$/.test(t[u+1])?(f(g,t[u+1]==="true",v),u+=1):f(g,c.strings[g]?"":!0,v))}else if((!c.unknownFn||c.unknownFn(v)!==!1)&&a._.push(c.strings._||!r(v)?v:Number(v)),s.stopEarly){a._.push.apply(a._,t.slice(u+1));break}}return Object.keys(l).forEach(function(T){e(a,T.split("."))||(m(a,T.split("."),l[T]),(i[T]||[]).forEach(function(O){m(a,O.split("."),l[T])}))}),s["--"]?a["--"]=h.slice():h.forEach(function(T){a._.push(T)}),a},$t}var ws=ys(),xs=qt(ws);const St=10,Xr=(e=0)=>r=>`\x1B[${r+e}m`,Qr=(e=0)=>r=>`\x1B[${38+e};5;${r}m`,ei=(e=0)=>(r,o,t)=>`\x1B[${38+e};2;${r};${o};${t}m`,E={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(E.modifier);const $s=Object.keys(E.color),Ss=Object.keys(E.bgColor);[...$s,...Ss];function Ts(){const e=new Map;for(const[r,o]of Object.entries(E)){for(const[t,s]of Object.entries(o))E[t]={open:`\x1B[${s[0]}m`,close:`\x1B[${s[1]}m`},o[t]=E[t],e.set(s[0],s[1]);Object.defineProperty(E,r,{value:o,enumerable:!1})}return Object.defineProperty(E,"codes",{value:e,enumerable:!1}),E.color.close="\x1B[39m",E.bgColor.close="\x1B[49m",E.color.ansi=Xr(),E.color.ansi256=Qr(),E.color.ansi16m=ei(),E.bgColor.ansi=Xr(St),E.bgColor.ansi256=Qr(St),E.bgColor.ansi16m=ei(St),Object.defineProperties(E,{rgbToAnsi256:{value(r,o,t){return r===o&&o===t?r<8?16:r>248?231:Math.round((r-8)/247*24)+232:16+36*Math.round(r/255*5)+6*Math.round(o/255*5)+Math.round(t/255*5)},enumerable:!1},hexToRgb:{value(r){const o=/[a-f\d]{6}|[a-f\d]{3}/i.exec(r.toString(16));if(!o)return[0,0,0];let[t]=o;t.length===3&&(t=[...t].map(c=>c+c).join(""));const s=Number.parseInt(t,16);return[s>>16&255,s>>8&255,s&255]},enumerable:!1},hexToAnsi256:{value:r=>E.rgbToAnsi256(...E.hexToRgb(r)),enumerable:!1},ansi256ToAnsi:{value(r){if(r<8)return 30+r;if(r<16)return 90+(r-8);let o,t,s;if(r>=232)o=((r-232)*10+8)/255,t=o,s=o;else{r-=16;const b=r%36;o=Math.floor(r/36)/5,t=Math.floor(b/6)/5,s=b%6/5}const c=Math.max(o,t,s)*2;if(c===0)return 30;let i=30+(Math.round(s)<<2|Math.round(t)<<1|Math.round(o));return c===2&&(i+=60),i},enumerable:!1},rgbToAnsi:{value:(r,o,t)=>E.ansi256ToAnsi(E.rgbToAnsi256(r,o,t)),enumerable:!1},hexToAnsi:{value:r=>E.ansi256ToAnsi(E.hexToAnsi256(r)),enumerable:!1}}),E}const H=Ts();function k(e,r=globalThis.Deno?globalThis.Deno.args:oe.argv){const o=e.startsWith("-")?"":e.length===1?"-":"--",t=r.indexOf(o+e),s=r.indexOf("--");return t!==-1&&(s===-1||t<s)}const{env:_}=oe;let se;k("no-color")||k("no-colors")||k("color=false")||k("color=never")?se=0:(k("color")||k("colors")||k("color=true")||k("color=always"))&&(se=1);function Ms(){if("FORCE_COLOR"in _)return _.FORCE_COLOR==="true"?1:_.FORCE_COLOR==="false"?0:_.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(_.FORCE_COLOR,10),3)}function Os(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function Rs(e,{streamIsTTY:r,sniffFlags:o=!0}={}){const t=Ms();t!==void 0&&(se=t);const s=o?se:t;if(s===0)return 0;if(o){if(k("color=16m")||k("color=full")||k("color=truecolor"))return 3;if(k("color=256"))return 2}if("TF_BUILD"in _&&"AGENT_NAME"in _)return 1;if(e&&!r&&s===void 0)return 0;const c=s||0;if(_.TERM==="dumb")return c;if(oe.platform==="win32"){const i=ci.release().split(".");return Number(i[0])>=10&&Number(i[2])>=10586?Number(i[2])>=14931?3:2:1}if("CI"in _)return"GITHUB_ACTIONS"in _||"GITEA_ACTIONS"in _?3:["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(i=>i in _)||_.CI_NAME==="codeship"?1:c;if("TEAMCITY_VERSION"in _)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(_.TEAMCITY_VERSION)?1:0;if(_.COLORTERM==="truecolor"||_.TERM==="xterm-kitty")return 3;if("TERM_PROGRAM"in _){const i=Number.parseInt((_.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(_.TERM_PROGRAM){case"iTerm.app":return i>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(_.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(_.TERM)||"COLORTERM"in _?1:c}function ti(e,r={}){const o=Rs(e,{streamIsTTY:e&&e.isTTY,...r});return Os(o)}const Ps={stdout:ti({isTTY:Et.isatty(1)}),stderr:ti({isTTY:Et.isatty(2)})};function Cs(e,r,o){let t=e.indexOf(r);if(t===-1)return e;const s=r.length;let c=0,i="";do i+=e.slice(c,t)+r+o,c=t+s,t=e.indexOf(r,c);while(t!==-1);return i+=e.slice(c),i}function Ds(e,r,o,t){let s=0,c="";do{const i=e[t-1]==="\r";c+=e.slice(s,i?t-1:t)+r+(i?`\r
|
|
97
|
+
`),this.close()}_(h,u){return h.toLowerCase()==="y"?(this.value=!0,this.submit()):h.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(f.hide):this.out.write(t(this.outputText,this.out.columns)),super.render(),this.outputText=[n.symbol(this.done,this.aborted),e.bold(this.msg),n.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:e.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(s.line+f.to(0)+this.outputText))}}return bt=i,bt}var yt,Ur;function ms(){return Ur||(Ur=1,yt={TextPrompt:Xi(),SelectPrompt:Qi(),TogglePrompt:es(),DatePrompt:us(),NumberPrompt:cs(),MultiselectPrompt:Yr(),AutocompletePrompt:ds(),AutocompleteMultiselectPrompt:fs(),ConfirmPrompt:ps()}),yt}var Gr;function gs(){return Gr||(Gr=1,function(e){const r=e,n=ms(),t=i=>i;function s(i,v,h={}){return new Promise((u,o)=>{const m=new n[i](v),d=h.onAbort||t,l=h.onSubmit||t,a=h.onExit||t;m.on("state",v.onState||t),m.on("submit",b=>u(l(b))),m.on("exit",b=>u(a(b))),m.on("abort",b=>o(d(b)))})}r.text=i=>s("TextPrompt",i),r.password=i=>(i.style="password",r.text(i)),r.invisible=i=>(i.style="invisible",r.text(i)),r.number=i=>s("NumberPrompt",i),r.date=i=>s("DatePrompt",i),r.confirm=i=>s("ConfirmPrompt",i),r.list=i=>{const v=i.separator||",";return s("TextPrompt",i,{onSubmit:h=>h.split(v).map(u=>u.trim())})},r.toggle=i=>s("TogglePrompt",i),r.select=i=>s("SelectPrompt",i),r.multiselect=i=>{i.choices=[].concat(i.choices||[]);const v=h=>h.filter(u=>u.selected).map(u=>u.value);return s("MultiselectPrompt",i,{onAbort:v,onSubmit:v})},r.autocompleteMultiselect=i=>{i.choices=[].concat(i.choices||[]);const v=h=>h.filter(u=>u.selected).map(u=>u.value);return s("AutocompleteMultiselectPrompt",i,{onAbort:v,onSubmit:v})};const f=(i,v)=>Promise.resolve(v.filter(h=>h.title.slice(0,i.length).toLowerCase()===i.toLowerCase()));r.autocomplete=i=>(i.suggest=i.suggest||f,i.choices=[].concat(i.choices||[]),s("AutocompletePrompt",i))}(Ye)),Ye}var wt,Wr;function vs(){if(Wr)return wt;Wr=1;const e=gs(),r=["suggest","format","onState","validate","onRender","type"],n=()=>{};async function t(v=[],{onSubmit:h=n,onCancel:u=n}={}){const o={},m=t._override||{};v=[].concat(v);let d,l,a,b,g,c;const p=async(y,w,x=!1)=>{if(!(!x&&y.validate&&y.validate(w)!==!0))return y.format?await y.format(w,o):w};for(l of v)if({name:b,type:g}=l,typeof g=="function"&&(g=await g(d,{...o},l),l.type=g),!!g){for(let y in l){if(r.includes(y))continue;let w=l[y];l[y]=typeof w=="function"?await w(d,{...o},c):w}if(c=l,typeof l.message!="string")throw new Error("prompt message is required");if({name:b,type:g}=l,e[g]===void 0)throw new Error(`prompt type (${g}) is not defined`);if(m[l.name]!==void 0&&(d=await p(l,m[l.name]),d!==void 0)){o[b]=d;continue}try{d=t._injected?s(t._injected,l.initial):await e[g](l),o[b]=d=await p(l,d,!0),a=await h(l,d,o)}catch{a=!await u(l,o)}if(a)return o}return o}function s(v,h){const u=v.shift();if(u instanceof Error)throw u;return u===void 0?h:u}function f(v){t._injected=(t._injected||[]).concat(v)}function i(v){t._override=Object.assign({},v)}return wt=Object.assign(t,{prompt:t,prompts:e,inject:f,override:i}),wt}var xt,zr;function bs(){if(zr)return xt;zr=1;function e(r){r=(Array.isArray(r)?r:r.split(".")).map(Number);let n=0,t=process.versions.node.split(".").map(Number);for(;n<r.length;n++){if(t[n]>r[n])return!1;if(r[n]>t[n])return!0}return!1}return xt=e("8.6.0")?Ji():vs(),xt}var ys=bs(),ie=_t(ys),St,Kr;function ws(){if(Kr)return St;Kr=1;function e(t,s){var f=t;s.slice(0,-1).forEach(function(v){f=f[v]||{}});var i=s[s.length-1];return i in f}function r(t){return typeof t=="number"||/^0x[0-9a-f]+$/i.test(t)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(t)}function n(t,s){return s==="constructor"&&typeof t[s]=="function"||s==="__proto__"}return St=function(t,s){s||(s={});var f={bools:{},strings:{},unknownFn:null};typeof s.unknown=="function"&&(f.unknownFn=s.unknown),typeof s.boolean=="boolean"&&s.boolean?f.allBools=!0:[].concat(s.boolean).filter(Boolean).forEach(function(T){f.bools[T]=!0});var i={};function v(T){return i[T].some(function(O){return f.bools[O]})}Object.keys(s.alias||{}).forEach(function(T){i[T]=[].concat(s.alias[T]),i[T].forEach(function(O){i[O]=[T].concat(i[T].filter(function(M){return O!==M}))})}),[].concat(s.string).filter(Boolean).forEach(function(T){f.strings[T]=!0,i[T]&&[].concat(i[T]).forEach(function(O){f.strings[O]=!0})});var h=s.default||{},u={_:[]};function o(T,O){return f.allBools&&/^--[^=]+$/.test(O)||f.strings[T]||f.bools[T]||i[T]}function m(T,O,M){for(var S=T,R=0;R<O.length-1;R++){var E=O[R];if(n(S,E))return;S[E]===void 0&&(S[E]={}),(S[E]===Object.prototype||S[E]===Number.prototype||S[E]===String.prototype)&&(S[E]={}),S[E]===Array.prototype&&(S[E]=[]),S=S[E]}var C=O[O.length-1];n(S,C)||((S===Object.prototype||S===Number.prototype||S===String.prototype)&&(S={}),S===Array.prototype&&(S=[]),S[C]===void 0||f.bools[C]||typeof S[C]=="boolean"?S[C]=M:Array.isArray(S[C])?S[C].push(M):S[C]=[S[C],M])}function d(T,O,M){if(!(M&&f.unknownFn&&!o(T,M)&&f.unknownFn(M)===!1)){var S=!f.strings[T]&&r(O)?Number(O):O;m(u,T.split("."),S),(i[T]||[]).forEach(function(R){m(u,R.split("."),S)})}}Object.keys(f.bools).forEach(function(T){d(T,h[T]===void 0?!1:h[T])});var l=[];t.indexOf("--")!==-1&&(l=t.slice(t.indexOf("--")+1),t=t.slice(0,t.indexOf("--")));for(var a=0;a<t.length;a++){var b=t[a],g,c;if(/^--.+=/.test(b)){var p=b.match(/^--([^=]+)=([\s\S]*)$/);g=p[1];var y=p[2];f.bools[g]&&(y=y!=="false"),d(g,y,b)}else if(/^--no-.+/.test(b))g=b.match(/^--no-(.+)/)[1],d(g,!1,b);else if(/^--.+/.test(b))g=b.match(/^--(.+)/)[1],c=t[a+1],c!==void 0&&!/^(-|--)[^-]/.test(c)&&!f.bools[g]&&!f.allBools&&(!i[g]||!v(g))?(d(g,c,b),a+=1):/^(true|false)$/.test(c)?(d(g,c==="true",b),a+=1):d(g,f.strings[g]?"":!0,b);else if(/^-[^-]+/.test(b)){for(var w=b.slice(1,-1).split(""),x=!1,$=0;$<w.length;$++){if(c=b.slice($+2),c==="-"){d(w[$],c,b);continue}if(/[A-Za-z]/.test(w[$])&&c[0]==="="){d(w[$],c.slice(1),b),x=!0;break}if(/[A-Za-z]/.test(w[$])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(c)){d(w[$],c,b),x=!0;break}if(w[$+1]&&w[$+1].match(/\W/)){d(w[$],b.slice($+2),b),x=!0;break}else d(w[$],f.strings[w[$]]?"":!0,b)}g=b.slice(-1)[0],!x&&g!=="-"&&(t[a+1]&&!/^(-|--)[^-]/.test(t[a+1])&&!f.bools[g]&&(!i[g]||!v(g))?(d(g,t[a+1],b),a+=1):t[a+1]&&/^(true|false)$/.test(t[a+1])?(d(g,t[a+1]==="true",b),a+=1):d(g,f.strings[g]?"":!0,b))}else if((!f.unknownFn||f.unknownFn(b)!==!1)&&u._.push(f.strings._||!r(b)?b:Number(b)),s.stopEarly){u._.push.apply(u._,t.slice(a+1));break}}return Object.keys(h).forEach(function(T){e(u,T.split("."))||(m(u,T.split("."),h[T]),(i[T]||[]).forEach(function(O){m(u,O.split("."),h[T])}))}),s["--"]?u["--"]=l.slice():l.forEach(function(T){u._.push(T)}),u},St}var xs=ws(),Ss=_t(xs);const $t=10,Zr=(e=0)=>r=>`\x1B[${r+e}m`,Xr=(e=0)=>r=>`\x1B[${38+e};5;${r}m`,Qr=(e=0)=>(r,n,t)=>`\x1B[${38+e};2;${r};${n};${t}m`,D={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(D.modifier);const $s=Object.keys(D.color),Ts=Object.keys(D.bgColor);[...$s,...Ts];function Ms(){const e=new Map;for(const[r,n]of Object.entries(D)){for(const[t,s]of Object.entries(n))D[t]={open:`\x1B[${s[0]}m`,close:`\x1B[${s[1]}m`},n[t]=D[t],e.set(s[0],s[1]);Object.defineProperty(D,r,{value:n,enumerable:!1})}return Object.defineProperty(D,"codes",{value:e,enumerable:!1}),D.color.close="\x1B[39m",D.bgColor.close="\x1B[49m",D.color.ansi=Zr(),D.color.ansi256=Xr(),D.color.ansi16m=Qr(),D.bgColor.ansi=Zr($t),D.bgColor.ansi256=Xr($t),D.bgColor.ansi16m=Qr($t),Object.defineProperties(D,{rgbToAnsi256:{value(r,n,t){return r===n&&n===t?r<8?16:r>248?231:Math.round((r-8)/247*24)+232:16+36*Math.round(r/255*5)+6*Math.round(n/255*5)+Math.round(t/255*5)},enumerable:!1},hexToRgb:{value(r){const n=/[a-f\d]{6}|[a-f\d]{3}/i.exec(r.toString(16));if(!n)return[0,0,0];let[t]=n;t.length===3&&(t=[...t].map(f=>f+f).join(""));const s=Number.parseInt(t,16);return[s>>16&255,s>>8&255,s&255]},enumerable:!1},hexToAnsi256:{value:r=>D.rgbToAnsi256(...D.hexToRgb(r)),enumerable:!1},ansi256ToAnsi:{value(r){if(r<8)return 30+r;if(r<16)return 90+(r-8);let n,t,s;if(r>=232)n=((r-232)*10+8)/255,t=n,s=n;else{r-=16;const v=r%36;n=Math.floor(r/36)/5,t=Math.floor(v/6)/5,s=v%6/5}const f=Math.max(n,t,s)*2;if(f===0)return 30;let i=30+(Math.round(s)<<2|Math.round(t)<<1|Math.round(n));return f===2&&(i+=60),i},enumerable:!1},rgbToAnsi:{value:(r,n,t)=>D.ansi256ToAnsi(D.rgbToAnsi256(r,n,t)),enumerable:!1},hexToAnsi:{value:r=>D.ansi256ToAnsi(D.hexToAnsi256(r)),enumerable:!1}}),D}const H=Ms();function N(e,r=globalThis.Deno?globalThis.Deno.args:oe.argv){const n=e.startsWith("-")?"":e.length===1?"-":"--",t=r.indexOf(n+e),s=r.indexOf("--");return t!==-1&&(s===-1||t<s)}const{env:_}=oe;let se;N("no-color")||N("no-colors")||N("color=false")||N("color=never")?se=0:(N("color")||N("colors")||N("color=true")||N("color=always"))&&(se=1);function Os(){if("FORCE_COLOR"in _)return _.FORCE_COLOR==="true"?1:_.FORCE_COLOR==="false"?0:_.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(_.FORCE_COLOR,10),3)}function Rs(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function Ps(e,{streamIsTTY:r,sniffFlags:n=!0}={}){const t=Os();t!==void 0&&(se=t);const s=n?se:t;if(s===0)return 0;if(n){if(N("color=16m")||N("color=full")||N("color=truecolor"))return 3;if(N("color=256"))return 2}if("TF_BUILD"in _&&"AGENT_NAME"in _)return 1;if(e&&!r&&s===void 0)return 0;const f=s||0;if(_.TERM==="dumb")return f;if(oe.platform==="win32"){const i=di.release().split(".");return Number(i[0])>=10&&Number(i[2])>=10586?Number(i[2])>=14931?3:2:1}if("CI"in _)return"GITHUB_ACTIONS"in _||"GITEA_ACTIONS"in _?3:["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(i=>i in _)||_.CI_NAME==="codeship"?1:f;if("TEAMCITY_VERSION"in _)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(_.TEAMCITY_VERSION)?1:0;if(_.COLORTERM==="truecolor"||_.TERM==="xterm-kitty")return 3;if("TERM_PROGRAM"in _){const i=Number.parseInt((_.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(_.TERM_PROGRAM){case"iTerm.app":return i>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(_.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(_.TERM)||"COLORTERM"in _?1:f}function ei(e,r={}){const n=Ps(e,{streamIsTTY:e&&e.isTTY,...r});return Rs(n)}const Cs={stdout:ei({isTTY:Et.isatty(1)}),stderr:ei({isTTY:Et.isatty(2)})};function Es(e,r,n){let t=e.indexOf(r);if(t===-1)return e;const s=r.length;let f=0,i="";do i+=e.slice(f,t)+r+n,f=t+s,t=e.indexOf(r,f);while(t!==-1);return i+=e.slice(f),i}function Ds(e,r,n,t){let s=0,f="";do{const i=e[t-1]==="\r";f+=e.slice(s,i?t-1:t)+r+(i?`\r
|
|
98
98
|
`:`
|
|
99
|
-
`)+
|
|
100
|
-
`,s)}while(t!==-1);return
|
|
101
|
-
`);return
|
|
99
|
+
`)+n,s=t+1,t=e.indexOf(`
|
|
100
|
+
`,s)}while(t!==-1);return f+=e.slice(s),f}const{stdout:ti,stderr:ri}=Cs,Tt=Symbol("GENERATOR"),Q=Symbol("STYLER"),te=Symbol("IS_EMPTY"),ii=["ansi","ansi","ansi256","ansi16m"],ee=Object.create(null),_s=(e,r={})=>{if(r.level&&!(Number.isInteger(r.level)&&r.level>=0&&r.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");const n=ti?ti.level:0;e.level=r.level===void 0?n:r.level},qs=e=>{const r=(...n)=>n.join(" ");return _s(r,e),Object.setPrototypeOf(r,re.prototype),r};function re(e){return qs(e)}Object.setPrototypeOf(re.prototype,Function.prototype);for(const[e,r]of Object.entries(H))ee[e]={get(){const n=ne(this,Ot(r.open,r.close,this[Q]),this[te]);return Object.defineProperty(this,e,{value:n}),n}};ee.visible={get(){const e=ne(this,this[Q],!0);return Object.defineProperty(this,"visible",{value:e}),e}};const Mt=(e,r,n,...t)=>e==="rgb"?r==="ansi16m"?H[n].ansi16m(...t):r==="ansi256"?H[n].ansi256(H.rgbToAnsi256(...t)):H[n].ansi(H.rgbToAnsi(...t)):e==="hex"?Mt("rgb",r,n,...H.hexToRgb(...t)):H[n][e](...t),As=["rgb","hex","ansi256"];for(const e of As){ee[e]={get(){const{level:n}=this;return function(...t){const s=Ot(Mt(e,ii[n],"color",...t),H.color.close,this[Q]);return ne(this,s,this[te])}}};const r="bg"+e[0].toUpperCase()+e.slice(1);ee[r]={get(){const{level:n}=this;return function(...t){const s=Ot(Mt(e,ii[n],"bgColor",...t),H.bgColor.close,this[Q]);return ne(this,s,this[te])}}}}const Is=Object.defineProperties(()=>{},{...ee,level:{enumerable:!0,get(){return this[Tt].level},set(e){this[Tt].level=e}}}),Ot=(e,r,n)=>{let t,s;return n===void 0?(t=e,s=r):(t=n.openAll+e,s=r+n.closeAll),{open:e,close:r,openAll:t,closeAll:s,parent:n}},ne=(e,r,n)=>{const t=(...s)=>Fs(t,s.length===1?""+s[0]:s.join(" "));return Object.setPrototypeOf(t,Is),t[Tt]=e,t[Q]=r,t[te]=n,t},Fs=(e,r)=>{if(e.level<=0||!r)return e[te]?"":r;let n=e[Q];if(n===void 0)return r;const{openAll:t,closeAll:s}=n;if(r.includes("\x1B"))for(;n!==void 0;)r=Es(r,n.close,n.open),n=n.parent;const f=r.indexOf(`
|
|
101
|
+
`);return f!==-1&&(r=Ds(r,s,t,f)),t+r+s};Object.defineProperties(re.prototype,ee);const I=re();re({level:ri?ri.level:0});const P={backend:I.hex("#3677FF"),frontend:I.hex("#6DC6FE"),vanilla:I.hex("#EEC900"),react:I.hex("#3B89E0"),typescript:I.hex("#30B3ED"),ok:I.hex("#30ED86"),error:I.hex("#ED3066"),info:I.hex("#42ECDE"),gray:I.hex("#686868"),vue:I.hex("#54E6A5"),warn:I.hex("#EC9942"),webpack:I.hex("#75AFCC"),node:I.hex("#417E38"),rust:I.hex("#D34516"),experimental:I.hex("#FA2200")};function G(e){const r=22-e.length;return I.reset(P.gray(`${" ".repeat(r)}|${" ".repeat(2)}`))}function L(e){const r=e.split(" ");return e==="Frontend"?P.frontend(e):e==="Backend"?P.backend(e):e==="VanillaJS"?P.vanilla(e):e==="NodeJS"||r.includes("Node")?P.node(e):r.includes("JavaScript")?P.react(e):r.includes("Rspack")||r.includes("Rust")?P.rust(e):r.includes("TypeScript")?P.typescript(e):r.includes("React")?P.react(e):e}function W(e){return I.reset(e)}const si={Frontend:{VanillaJS:[{value:"vanilla-js",title:`${L("VanillaJS")}${G("VanillaJS")}${W(P.error("Vanilla JS + Vite."))}`}],"React JavaScript":[{value:"react",title:`${L("React")}${G("React")}${W(P.error("React + Vite."))}`},{value:"react-dev",title:`${L("React Dev")}${G("React Dev")}${W(P.error("Tailwind + Linter + Tests"))}`},{value:"react-webpack",title:`${L("React Webpack")}${G("React Webpack")}${W(P.error("React + Webpack."))}`},{value:"react-dev-webpack",title:`${L("React Dev Webpack")}${G("React Dev Webpack")}${W(P.error("Tailwind + Linter + Tests"))}`}],"React TypeScript":[{value:"react-typescript",title:`${L("React TypeScript")}${G("React TypeScript")}${W(P.error("React + Vite + TypeScript"))}`},{value:"react-dev-typescript",title:`${L("React Dev TypeScript")}${G("React Dev TypeScript")}${W(P.error("Tailwind + Linter + Tests"))}`}],"React Rust":[{value:"react-rspack",title:`${L("React Rspack")}${G("React Rspack")}${W(P.error("React + Rspack"))}`}]},Backend:{NodeJS:[{value:"node-express",title:`${L("Node Express")}${G("Node Express")}${W(P.error("Express + Sequelize + Linter + Tests"))}`}]}},ni=(e,r)=>{gi(e).forEach(n=>{const t=X.join(e,n);let s=X.join(r,n);n==="_gitignore"&&(s=X.join(r,".gitignore"));try{vi(t).isDirectory()?(bi(s,{recursive:!0}),ni(t,s)):yi(t,s)}catch(f){throw new Error(`Failed to copy ${t} to ${s}`,{cause:f})}})},js=(e,r)=>{const n=X.join(e,"package.json");try{const t=fi(n,"utf8"),s=JSON.parse(t);s.name=r,pi(n,JSON.stringify(s,null,2),"utf8")}catch(t){console.log(t.message)}};async function ks(e,r,n){const t=Dt(e),s=Dt(r);if(!t){console.log(P.error("Invalid Template"));return}if(s){console.log(P.error("Target directory already exist!"));return}console.info(`\u{1F4C2} ${P.ok("Target directory doesn't exist")}`),console.info(`\u{1F6A7} ${P.ok("Creating directory")}`),mi(r,{recursive:!0}),console.info(`\u{1F4C1} ${P.ok("Finished creating directory")}`),ni(e,r),js(r,n),console.info(`\u{1F680} ${P.ok(`Finished generating your app ${P.error(n)}`)}`),console.info(`\u{1F3E0} ${P.info(`cd ${n}`)}`),console.info(`\u{1F9EA} ${P.info("npm install")}`)}const Ns=e=>e.toLowerCase().split(/[\s|_]/).join("-"),Ls=e=>e.match(/[^a-zA-Z0-9-\s]/g)?"App name should not contain special characters except hyphen (-)":!0,oi=`
|
|
102
102
|
Usage: create-enchilada [OPTION]... [DIRECTORY]
|
|
103
103
|
|
|
104
104
|
Create a new app. With no arguments,
|
|
@@ -109,6 +109,7 @@ Options:
|
|
|
109
109
|
e.g., my-app, would be like ./my-app/
|
|
110
110
|
the directory should not exist.
|
|
111
111
|
-t, --template NAME Use a specific template.
|
|
112
|
+
-l, --list List all available templates with full stack details, and exit.
|
|
112
113
|
-h, --help Display a help message, and exit.
|
|
113
114
|
|
|
114
115
|
Available templates:
|
|
@@ -121,4 +122,27 @@ Available templates:
|
|
|
121
122
|
react-dev-typescript Tailwind + Linter + Tests
|
|
122
123
|
react-rspack React + Rspack
|
|
123
124
|
node-express Express + Sequelize + Linter + Tests
|
|
124
|
-
`,
|
|
125
|
+
`,li=`
|
|
126
|
+
Available templates:
|
|
127
|
+
|
|
128
|
+
Frontend
|
|
129
|
+
VanillaJS
|
|
130
|
+
vanilla-js Vanilla JS + Vite
|
|
131
|
+
|
|
132
|
+
React JavaScript
|
|
133
|
+
react React 19 + Vite
|
|
134
|
+
react-dev React 19 + Vite + Tailwind + ESLint + Jest + RTL
|
|
135
|
+
react-webpack React + Webpack
|
|
136
|
+
react-dev-webpack React + Webpack + Tailwind + ESLint + Jest + RTL
|
|
137
|
+
|
|
138
|
+
React TypeScript
|
|
139
|
+
react-typescript React 19 + Vite + TypeScript
|
|
140
|
+
react-dev-typescript React 19 + Vite + TypeScript + Tailwind + ESLint + Jest + RTL
|
|
141
|
+
|
|
142
|
+
React Rust
|
|
143
|
+
react-rspack React + Rspack
|
|
144
|
+
|
|
145
|
+
Backend
|
|
146
|
+
NodeJS
|
|
147
|
+
node-express Express + Sequelize + PostgreSQL + JWT + Passport + ESLint + Jest
|
|
148
|
+
`,Vs=Ss(ci.slice(2)),hi=(e,r)=>{const n=X.join(process.cwd(),r),t=X.resolve(ui(import.meta.url),"../../templates",`${e}`);ks(t,n,r)},ai=async e=>{const r=e.template||e.t,n=e._[0],{help:t,h:s,list:f,l:i}=e;if(t||s)return console.info(oi),oi;if(f||i)return console.info(li),li;if(!r||!n)try{const v=await ie([{type:"select",name:"category",message:"Select the type of project:",choices:Object.keys(si).map(l=>({title:L(l),value:l}))}]);v.category||process.exit(0);const h=si[v.category],u=await ie({type:"select",name:"subcategory",message:`Select the technology for ${v.category}:`,choices:Object.keys(h).map(l=>({title:L(l),value:l}))});u.subcategory||process.exit(0);const o=h[u.subcategory],m=await ie({type:"select",name:"template",message:`Select the template for ${u.subcategory}:`,choices:o});m.template||process.exit(0);const d=await ie({type:"text",name:"appName",message:P.typescript("Enter your app name"),initial:"my-app",format:l=>Ns(l),validate:l=>Ls(l)});d.appName||process.exit(0),hi(m.template,d.appName)}catch(v){console.error(P.error(v.message))}else try{hi(r,n)}catch(v){console.error(P.error(v.message))}return 0};ai(Vs);export{ai as default};
|