create-qwik 0.0.3 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -3,19 +3,19 @@
|
|
|
3
3
|
## Interactive mode
|
|
4
4
|
|
|
5
5
|
```
|
|
6
|
-
npm init qwik
|
|
6
|
+
npm init qwik@latest
|
|
7
7
|
```
|
|
8
8
|
|
|
9
9
|
## Command mode
|
|
10
10
|
|
|
11
11
|
```
|
|
12
|
-
npm init qwik <starter> <projectName>
|
|
12
|
+
npm init qwik@latest <starter> <projectName>
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
#### Example:
|
|
16
16
|
|
|
17
17
|
```
|
|
18
|
-
npm init qwik
|
|
18
|
+
npm init qwik@latest todo my-app
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
## Community
|
package/index.js
CHANGED
|
@@ -5,45 +5,45 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://github.com/BuilderIO/qwik/blob/main/LICENSE
|
|
7
7
|
*/
|
|
8
|
-
var
|
|
9
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var n=!0,o=!1,h;return{s:function(){t=t.call(i)},n:function(){var a=t.next();return n=a.done,a},e:function(a){o=!0,h=a},f:function(){try{!n&&t.return!=null&&t.return()}finally{if(o)throw h}}}}function
|
|
8
|
+
var eo=Object.create;var ve=Object.defineProperty;var to=Object.getOwnPropertyDescriptor;var io=Object.getOwnPropertyNames,wt=Object.getOwnPropertySymbols,so=Object.getPrototypeOf,xt=Object.prototype.hasOwnProperty,ro=Object.prototype.propertyIsEnumerable;var St=(i,e,t)=>e in i?ve(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,Ne=(i,e)=>{for(var t in e||(e={}))xt.call(e,t)&&St(i,t,e[t]);if(wt)for(var t of wt(e))ro.call(e,t)&&St(i,t,e[t]);return i};var no=i=>ve(i,"__esModule",{value:!0});var u=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var oo=(i,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of io(e))!xt.call(i,s)&&s!=="default"&&ve(i,s,{get:()=>e[s],enumerable:!(t=to(e,s))||t.enumerable});return i},N=i=>oo(no(ve(i!=null?eo(so(i)):{},"default",i&&i.__esModule&&"default"in i?{get:()=>i.default,enumerable:!0}:{value:i,enumerable:!0})),i);var m=u((Su,Et)=>{"use strict";var{FORCE_COLOR:ao,NODE_DISABLE_COLORS:co,TERM:fo}=process.env,d={enabled:!co&&fo!=="dumb"&&ao!=="0",reset:p(0,0),bold:p(1,22),dim:p(2,22),italic:p(3,23),underline:p(4,24),inverse:p(7,27),hidden:p(8,28),strikethrough:p(9,29),black:p(30,39),red:p(31,39),green:p(32,39),yellow:p(33,39),blue:p(34,39),magenta:p(35,39),cyan:p(36,39),white:p(37,39),gray:p(90,39),grey:p(90,39),bgBlack:p(40,49),bgRed:p(41,49),bgGreen:p(42,49),bgYellow:p(43,49),bgBlue:p(44,49),bgMagenta:p(45,49),bgCyan:p(46,49),bgWhite:p(47,49)};function jt(i,e){let t=0,s,r="",n="";for(;t<i.length;t++)s=i[t],r+=s.open,n+=s.close,e.includes(s.close)&&(e=e.replace(s.rgx,s.close+s.open));return r+e+n}function po(i,e){let t={has:i,keys:e};return t.reset=d.reset.bind(t),t.bold=d.bold.bind(t),t.dim=d.dim.bind(t),t.italic=d.italic.bind(t),t.underline=d.underline.bind(t),t.inverse=d.inverse.bind(t),t.hidden=d.hidden.bind(t),t.strikethrough=d.strikethrough.bind(t),t.black=d.black.bind(t),t.red=d.red.bind(t),t.green=d.green.bind(t),t.yellow=d.yellow.bind(t),t.blue=d.blue.bind(t),t.magenta=d.magenta.bind(t),t.cyan=d.cyan.bind(t),t.white=d.white.bind(t),t.gray=d.gray.bind(t),t.grey=d.grey.bind(t),t.bgBlack=d.bgBlack.bind(t),t.bgRed=d.bgRed.bind(t),t.bgGreen=d.bgGreen.bind(t),t.bgYellow=d.bgYellow.bind(t),t.bgBlue=d.bgBlue.bind(t),t.bgMagenta=d.bgMagenta.bind(t),t.bgCyan=d.bgCyan.bind(t),t.bgWhite=d.bgWhite.bind(t),t}function p(i,e){let t={open:`[${i}m`,close:`[${e}m`,rgx:new RegExp(`\\x1b\\[${e}m`,"g")};return function(s){return this!==void 0&&this.has!==void 0?(this.has.includes(i)||(this.has.push(i),this.keys.push(t)),s===void 0?this:d.enabled?jt(this.keys,s+""):s+""):s===void 0?po([i],[t]):d.enabled?jt([t],s+""):s+""}}Et.exports=d});var Rt=u((Ou,At)=>{"use strict";At.exports=(i,e)=>{if(!(i.meta&&i.name!=="escape")){if(i.ctrl){if(i.name==="a")return"first";if(i.name==="c"||i.name==="d")return"abort";if(i.name==="e")return"last";if(i.name==="g")return"reset"}if(e){if(i.name==="j")return"down";if(i.name==="k")return"up"}return i.name==="return"||i.name==="enter"?"submit":i.name==="backspace"?"delete":i.name==="delete"?"deleteForward":i.name==="abort"?"abort":i.name==="escape"?"exit":i.name==="tab"?"next":i.name==="pagedown"?"nextPage":i.name==="pageup"?"prevPage":i.name==="home"?"home":i.name==="end"?"end":i.name==="up"?"up":i.name==="down"?"down":i.name==="right"?"right":i.name==="left"?"left":!1}}});var Me=u((qu,Ft)=>{"use strict";Ft.exports=i=>{let e=["[\\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("|"),t=new RegExp(e,"g");return typeof i=="string"?i.replace(t,""):i}});var b=u((Mu,Yt)=>{"use strict";var Ve="",g=`${Ve}[`,mo="\x07",Je={to(i,e){return e?`${g}${e+1};${i+1}H`:`${g}${i+1}G`},move(i,e){let t="";return i<0?t+=`${g}${-i}D`:i>0&&(t+=`${g}${i}C`),e<0?t+=`${g}${-e}A`:e>0&&(t+=`${g}${e}B`),t},up:(i=1)=>`${g}${i}A`,down:(i=1)=>`${g}${i}B`,forward:(i=1)=>`${g}${i}C`,backward:(i=1)=>`${g}${i}D`,nextLine:(i=1)=>`${g}E`.repeat(i),prevLine:(i=1)=>`${g}F`.repeat(i),left:`${g}G`,hide:`${g}?25l`,show:`${g}?25h`,save:`${Ve}7`,restore:`${Ve}8`},go={up:(i=1)=>`${g}S`.repeat(i),down:(i=1)=>`${g}T`.repeat(i)},bo={screen:`${g}2J`,up:(i=1)=>`${g}1J`.repeat(i),down:(i=1)=>`${g}J`.repeat(i),line:`${g}2K`,lineEnd:`${g}K`,lineStart:`${g}1K`,lines(i){let e="";for(let t=0;t<i;t++)e+=this.line+(t<i-1?Je.up():"");return i&&(e+=Je.left),e}};Yt.exports={cursor:Je,scroll:go,erase:bo,beep:mo}});var Jt=u((Pu,Vt)=>{"use strict";function vo(i,e){var t=typeof Symbol!="undefined"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=yo(i))||e&&i&&typeof i.length=="number"){t&&(i=t);var s=0,r=function(){};return{s:r,n:function(){return s>=i.length?{done:!0}:{done:!1,value:i[s++]}},e:function(a){throw a},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
9
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var n=!0,o=!1,h;return{s:function(){t=t.call(i)},n:function(){var a=t.next();return n=a.done,a},e:function(a){o=!0,h=a},f:function(){try{!n&&t.return!=null&&t.return()}finally{if(o)throw h}}}}function yo(i,e){if(!!i){if(typeof i=="string")return Ht(i,e);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return Array.from(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Ht(i,e)}}function Ht(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,s=new Array(e);t<e;t++)s[t]=i[t];return s}var wo=Me(),Nt=b(),Lt=Nt.erase,xo=Nt.cursor,So=i=>[...wo(i)].length;Vt.exports=function(i,e){if(!e)return Lt.line+xo.to(0);let t=0,s=i.split(/\r?\n/);var r=vo(s),n;try{for(r.s();!(n=r.n()).done;){let o=n.value;t+=1+Math.floor(Math.max(So(o)-1,0)/e)}}catch(o){r.e(o)}finally{r.f()}return Lt.lines(t)}});var Ge=u((Tu,Gt)=>{"use strict";var se={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},Oo={arrowUp:se.arrowUp,arrowDown:se.arrowDown,arrowLeft:se.arrowLeft,arrowRight:se.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},qo=process.platform==="win32"?Oo:se;Gt.exports=qo});var Bt=u(($u,Ut)=>{"use strict";var W=m(),B=Ge(),Ue=Object.freeze({password:{scale:1,render:i=>"*".repeat(i.length)},emoji:{scale:2,render:i=>"\u{1F603}".repeat(i.length)},invisible:{scale:0,render:i=>""},default:{scale:1,render:i=>`${i}`}}),Mo=i=>Ue[i]||Ue.default,re=Object.freeze({aborted:W.red(B.cross),done:W.green(B.tick),exited:W.yellow(B.cross),default:W.cyan("?")}),Po=(i,e,t)=>e?re.aborted:t?re.exited:i?re.done:re.default,To=i=>W.gray(i?B.ellipsis:B.pointerSmall),$o=(i,e)=>W.gray(i?e?B.pointerSmall:"+":B.line);Ut.exports={styles:Ue,render:Mo,symbols:re,symbol:Po,delimiter:To,item:$o}});var Wt=u((Cu,zt)=>{"use strict";var Co=Me();zt.exports=function(i,e){let t=String(Co(i)||"").split(/\r?\n/);return e?t.map(s=>Math.ceil(s.length/e)).reduce((s,r)=>s+r):t.length}});var Kt=u((Du,Zt)=>{"use strict";Zt.exports=(i,e={})=>{let t=Number.isSafeInteger(parseInt(e.margin))?new Array(parseInt(e.margin)).fill(" ").join(""):e.margin||"",s=e.width;return(i||"").split(/\r?\n/g).map(r=>r.split(/\s+/g).reduce((n,o)=>(o.length+t.length>=s||n[n.length-1].length+o.length+1<s?n[n.length-1]+=` ${o}`:n.push(`${t}${o}`),n),[t]).join(`
|
|
10
10
|
`)).join(`
|
|
11
|
-
`)}});var
|
|
12
|
-
`),this.close()}validate(){var e=this;return
|
|
13
|
-
`),e.close()})()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(e){this.placeholder||(this.cursor=this.cursor+e,this.cursorOffset+=e)}_(e,t){let s=this.value.slice(0,this.cursor),r=this.value.slice(this.cursor);this.value=`${s}${e}${r}`,this.red=!1,this.cursor=this.placeholder?0:s.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let e=this.value.slice(0,this.cursor-1),t=this.value.slice(this.cursor);this.value=`${e}${t}`,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 e=this.value.slice(0,this.cursor),t=this.value.slice(this.cursor+1);this.value=`${e}${t}`,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(ne.down(
|
|
11
|
+
`)}});var Qt=u((Iu,Xt)=>{"use strict";Xt.exports=(i,e,t)=>{t=t||e;let s=Math.min(e-t,i-Math.floor(t/2));s<0&&(s=0);let r=Math.min(s+t,e);return{startIndex:s,endIndex:r}}});var S=u((_u,ei)=>{"use strict";ei.exports={action:Rt(),clear:Jt(),style:Bt(),strip:Me(),figures:Ge(),lines:Wt(),wrap:Kt(),entriesToDisplay:Qt()}});var k=u((ku,ri)=>{"use strict";var ti=require("readline"),Do=S(),Io=Do.action,_o=require("events"),ii=b(),ko=ii.beep,jo=ii.cursor,Eo=m(),si=class extends _o{constructor(e={}){super();this.firstRender=!0,this.in=e.stdin||process.stdin,this.out=e.stdout||process.stdout,this.onRender=(e.onRender||(()=>{})).bind(this);let t=ti.createInterface({input:this.in,escapeCodeTimeout:50});ti.emitKeypressEvents(this.in,t),this.in.isTTY&&this.in.setRawMode(!0);let s=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,r=(n,o)=>{let h=Io(o,s);h===!1?this._&&this._(n,o):typeof this[h]=="function"?this[h](o):this.bell()};this.close=()=>{this.out.write(jo.show),this.in.removeListener("keypress",r),this.in.isTTY&&this.in.setRawMode(!1),t.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",r)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(ko)}render(){this.onRender(Eo),this.firstRender&&(this.firstRender=!1)}};ri.exports=si});var ai=u((ju,ui)=>{"use strict";function ni(i,e,t,s,r,n,o){try{var h=i[n](o),l=h.value}catch(a){t(a);return}h.done?e(l):Promise.resolve(l).then(s,r)}function oi(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var n=i.apply(e,t);function o(l){ni(n,s,r,o,h,"next",l)}function h(l){ni(n,s,r,o,h,"throw",l)}o(void 0)})}}var Pe=m(),Ao=k(),hi=b(),Ro=hi.erase,ne=hi.cursor,Te=S(),Be=Te.style,ze=Te.clear,Fo=Te.lines,Yo=Te.figures,li=class extends Ao{constructor(e={}){super(e);this.transform=Be.render(e.style),this.scale=this.transform.scale,this.msg=e.message,this.initial=e.initial||"",this.validator=e.validate||(()=>!0),this.value="",this.errorMsg=e.error||"Please Enter A Valid Value",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.clear=ze("",this.out.columns),this.render()}set value(e){!e&&this.initial?(this.placeholder=!0,this.rendered=Pe.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(e)),this._value=e,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
|
|
12
|
+
`),this.close()}validate(){var e=this;return oi(function*(){let t=yield e.validator(e.value);typeof t=="string"&&(e.errorMsg=t,t=!1),e.error=!t})()}submit(){var e=this;return oi(function*(){if(e.value=e.value||e.initial,e.cursorOffset=0,e.cursor=e.rendered.length,yield e.validate(),e.error){e.red=!0,e.fire(),e.render();return}e.done=!0,e.aborted=!1,e.fire(),e.render(),e.out.write(`
|
|
13
|
+
`),e.close()})()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(e){this.placeholder||(this.cursor=this.cursor+e,this.cursorOffset+=e)}_(e,t){let s=this.value.slice(0,this.cursor),r=this.value.slice(this.cursor);this.value=`${s}${e}${r}`,this.red=!1,this.cursor=this.placeholder?0:s.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let e=this.value.slice(0,this.cursor-1),t=this.value.slice(this.cursor);this.value=`${e}${t}`,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 e=this.value.slice(0,this.cursor),t=this.value.slice(this.cursor+1);this.value=`${e}${t}`,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(ne.down(Fo(this.outputError,this.out.columns)-1)+ze(this.outputError,this.out.columns)),this.out.write(ze(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[Be.symbol(this.done,this.aborted),Pe.bold(this.msg),Be.delimiter(this.done),this.red?Pe.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
14
14
|
`).reduce((e,t,s)=>e+`
|
|
15
|
-
${s?" ":
|
|
15
|
+
${s?" ":Yo.pointerSmall} ${Pe.red().italic(t)}`,"")),this.out.write(Ro.line+ne.to(0)+this.outputText+ne.save+this.outputError+ne.restore+ne.move(this.cursorOffset,0)))}};ui.exports=li});var mi=u((Eu,pi)=>{"use strict";var j=m(),Ho=k(),oe=S(),ci=oe.style,di=oe.clear,$e=oe.figures,No=oe.wrap,Lo=oe.entriesToDisplay,Vo=b(),Jo=Vo.cursor,fi=class extends Ho{constructor(e={}){super(e);this.msg=e.message,this.hint=e.hint||"- Use arrow-keys. Return to submit.",this.warn=e.warn||"- This option is disabled",this.cursor=e.initial||0,this.choices=e.choices.map((t,s)=>(typeof t=="string"&&(t={title:t,value:s}),{title:t&&(t.title||t.value||t),value:t&&(t.value===void 0?s:t.value),description:t&&t.description,selected:t&&t.selected,disabled:t&&t.disabled})),this.optionsPerPage=e.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=di("",this.out.columns),this.render()}moveCursor(e){this.cursor=e,this.value=this.choices[e].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(`
|
|
16
16
|
`),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
17
|
-
`),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()}_(e,t){if(e===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(
|
|
17
|
+
`),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()}_(e,t){if(e===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(Jo.hide):this.out.write(di(this.outputText,this.out.columns)),super.render();let e=Lo(this.cursor,this.choices.length,this.optionsPerPage),t=e.startIndex,s=e.endIndex;if(this.outputText=[ci.symbol(this.done,this.aborted),j.bold(this.msg),ci.delimiter(!1),this.done?this.selection.title:this.selection.disabled?j.yellow(this.warn):j.gray(this.hint)].join(" "),!this.done){this.outputText+=`
|
|
18
18
|
`;for(let r=t;r<s;r++){let n,o,h="",l=this.choices[r];r===t&&t>0?o=$e.arrowUp:r===s-1&&s<this.choices.length?o=$e.arrowDown:o=" ",l.disabled?(n=this.cursor===r?j.gray().underline(l.title):j.strikethrough().gray(l.title),o=(this.cursor===r?j.bold().gray($e.pointer)+" ":" ")+o):(n=this.cursor===r?j.cyan().underline(l.title):l.title,o=(this.cursor===r?j.cyan($e.pointer)+" ":" ")+o,l.description&&this.cursor===r&&(h=` - ${l.description}`,(o.length+n.length+h.length>=this.out.columns||l.description.split(/\r?\n/).length>1)&&(h=`
|
|
19
|
-
`+
|
|
20
|
-
`}}this.out.write(this.outputText)}};
|
|
19
|
+
`+No(l.description,{margin:3,width:this.out.columns})))),this.outputText+=`${o} ${n}${j.gray(h)}
|
|
20
|
+
`}}this.out.write(this.outputText)}};pi.exports=fi});var Si=u((Au,xi)=>{"use strict";var Ce=m(),Go=k(),gi=S(),bi=gi.style,Uo=gi.clear,vi=b(),yi=vi.cursor,Bo=vi.erase,wi=class extends Go{constructor(e={}){super(e);this.msg=e.message,this.value=!!e.initial,this.active=e.active||"on",this.inactive=e.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(`
|
|
21
21
|
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
22
|
-
`),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()}_(e,t){if(e===" ")this.value=!this.value;else if(e==="1")this.value=!0;else if(e==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(
|
|
23
|
-
`),this.close()}validate(){var e=this;return
|
|
24
|
-
`),e.close()})()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let e=this.parts[this.cursor].prev();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}right(){let e=this.parts[this.cursor].next();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}next(){let e=this.parts[this.cursor].next();this.moveCursor(e?this.parts.indexOf(e):this.parts.findIndex(t=>t instanceof
|
|
22
|
+
`),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()}_(e,t){if(e===" ")this.value=!this.value;else if(e==="1")this.value=!0;else if(e==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(yi.hide):this.out.write(Uo(this.outputText,this.out.columns)),super.render(),this.outputText=[bi.symbol(this.done,this.aborted),Ce.bold(this.msg),bi.delimiter(this.done),this.value?this.inactive:Ce.cyan().underline(this.inactive),Ce.gray("/"),this.value?Ce.cyan().underline(this.active):this.active].join(" "),this.out.write(Bo.line+yi.to(0)+this.outputText))}};xi.exports=wi});var P=u((Ru,Oi)=>{"use strict";var he=class{constructor({token:e,date:t,parts:s,locales:r}){this.token=e,this.date=t||new Date,this.parts=s||[this],this.locales=r||{}}up(){}down(){}next(){let e=this.parts.indexOf(this);return this.parts.find((t,s)=>s>e&&t instanceof he)}setTo(e){}prev(){let e=[].concat(this.parts).reverse(),t=e.indexOf(this);return e.find((s,r)=>r>t&&s instanceof he)}toString(){return String(this.date)}};Oi.exports=he});var Pi=u((Fu,Mi)=>{"use strict";var zo=P(),qi=class extends zo{constructor(e={}){super(e)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let e=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?e.toUpperCase():e}};Mi.exports=qi});var Ci=u((Yu,$i)=>{"use strict";var Wo=P(),Zo=i=>(i=i%10,i===1?"st":i===2?"nd":i===3?"rd":"th"),Ti=class extends Wo{constructor(e={}){super(e)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(e){this.date.setDate(parseInt(e.substr(-2)))}toString(){let e=this.date.getDate(),t=this.date.getDay();return this.token==="DD"?String(e).padStart(2,"0"):this.token==="Do"?e+Zo(e):this.token==="d"?t+1:this.token==="ddd"?this.locales.weekdaysShort[t]:this.token==="dddd"?this.locales.weekdays[t]:e}};$i.exports=Ti});var _i=u((Hu,Ii)=>{"use strict";var Ko=P(),Di=class extends Ko{constructor(e={}){super(e)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(e){this.date.setHours(parseInt(e.substr(-2)))}toString(){let e=this.date.getHours();return/h/.test(this.token)&&(e=e%12||12),this.token.length>1?String(e).padStart(2,"0"):e}};Ii.exports=Di});var Ei=u((Nu,ji)=>{"use strict";var Xo=P(),ki=class extends Xo{constructor(e={}){super(e)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(e){this.date.setMilliseconds(parseInt(e.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};ji.exports=ki});var Fi=u((Lu,Ri)=>{"use strict";var Qo=P(),Ai=class extends Qo{constructor(e={}){super(e)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(e){this.date.setMinutes(parseInt(e.substr(-2)))}toString(){let e=this.date.getMinutes();return this.token.length>1?String(e).padStart(2,"0"):e}};Ri.exports=Ai});var Ni=u((Vu,Hi)=>{"use strict";var eh=P(),Yi=class extends eh{constructor(e={}){super(e)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(e){e=parseInt(e.substr(-2))-1,this.date.setMonth(e<0?0:e)}toString(){let e=this.date.getMonth(),t=this.token.length;return t===2?String(e+1).padStart(2,"0"):t===3?this.locales.monthsShort[e]:t===4?this.locales.months[e]:String(e+1)}};Hi.exports=Yi});var Ji=u((Ju,Vi)=>{"use strict";var th=P(),Li=class extends th{constructor(e={}){super(e)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(e){this.date.setSeconds(parseInt(e.substr(-2)))}toString(){let e=this.date.getSeconds();return this.token.length>1?String(e).padStart(2,"0"):e}};Vi.exports=Li});var Bi=u((Gu,Ui)=>{"use strict";var ih=P(),Gi=class extends ih{constructor(e={}){super(e)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(e){this.date.setFullYear(e.substr(-4))}toString(){let e=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?e.substr(-2):e}};Ui.exports=Gi});var Wi=u((Uu,zi)=>{"use strict";zi.exports={DatePart:P(),Meridiem:Pi(),Day:Ci(),Hours:_i(),Milliseconds:Ei(),Minutes:Fi(),Month:Ni(),Seconds:Ji(),Year:Bi()}});var os=u((Bu,ns)=>{"use strict";function Zi(i,e,t,s,r,n,o){try{var h=i[n](o),l=h.value}catch(a){t(a);return}h.done?e(l):Promise.resolve(l).then(s,r)}function Ki(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var n=i.apply(e,t);function o(l){Zi(n,s,r,o,h,"next",l)}function h(l){Zi(n,s,r,o,h,"throw",l)}o(void 0)})}}var We=m(),sh=k(),Ze=S(),Xi=Ze.style,Qi=Ze.clear,rh=Ze.figures,es=b(),nh=es.erase,ts=es.cursor,E=Wi(),is=E.DatePart,oh=E.Meridiem,hh=E.Day,lh=E.Hours,uh=E.Milliseconds,ah=E.Minutes,ch=E.Month,dh=E.Seconds,fh=E.Year,ph=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,ss={1:({token:i})=>i.replace(/\\(.)/g,"$1"),2:i=>new hh(i),3:i=>new ch(i),4:i=>new fh(i),5:i=>new oh(i),6:i=>new lh(i),7:i=>new ah(i),8:i=>new dh(i),9:i=>new uh(i)},mh={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(",")},rs=class extends sh{constructor(e={}){super(e);this.msg=e.message,this.cursor=0,this.typed="",this.locales=Object.assign(mh,e.locales),this._date=e.initial||new Date,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.mask=e.mask||"YYYY-MM-DD HH:mm:ss",this.clear=Qi("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(e){e&&this._date.setTime(e.getTime())}set mask(e){let t;for(this.parts=[];t=ph.exec(e);){let r=t.shift(),n=t.findIndex(o=>o!=null);this.parts.push(n in ss?ss[n]({token:t[n]||r,date:this.date,parts:this.parts,locales:this.locales}):t[n]||r)}let s=this.parts.reduce((r,n)=>(typeof n=="string"&&typeof r[r.length-1]=="string"?r[r.length-1]+=n:r.push(n),r),[]);this.parts.splice(0),this.parts.push(...s),this.reset()}moveCursor(e){this.typed="",this.cursor=e,this.fire()}reset(){this.moveCursor(this.parts.findIndex(e=>e instanceof is)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
23
|
+
`),this.close()}validate(){var e=this;return Ki(function*(){let t=yield e.validator(e.value);typeof t=="string"&&(e.errorMsg=t,t=!1),e.error=!t})()}submit(){var e=this;return Ki(function*(){if(yield e.validate(),e.error){e.color="red",e.fire(),e.render();return}e.done=!0,e.aborted=!1,e.fire(),e.render(),e.out.write(`
|
|
24
|
+
`),e.close()})()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let e=this.parts[this.cursor].prev();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}right(){let e=this.parts[this.cursor].next();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}next(){let e=this.parts[this.cursor].next();this.moveCursor(e?this.parts.indexOf(e):this.parts.findIndex(t=>t instanceof is)),this.render()}_(e){/\d/.test(e)&&(this.typed+=e,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(ts.hide):this.out.write(Qi(this.outputText,this.out.columns)),super.render(),this.outputText=[Xi.symbol(this.done,this.aborted),We.bold(this.msg),Xi.delimiter(!1),this.parts.reduce((e,t,s)=>e.concat(s===this.cursor&&!this.done?We.cyan().underline(t.toString()):t),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
|
|
25
25
|
`).reduce((e,t,s)=>e+`
|
|
26
|
-
${s?" ":
|
|
27
|
-
`),this.close()}validate(){var e=this;return
|
|
28
|
-
`),e.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 e=this.value.toString();if(e.length===0)return this.bell();this.value=this.parse(e=e.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()}_(e,t){if(!this.valid(e))return this.bell();let s=Date.now();if(s-this.lastHit>1e3&&(this.typed=""),this.typed+=e,this.lastHit=s,this.color="cyan",e===".")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(Ie.down(
|
|
26
|
+
${s?" ":rh.pointerSmall} ${We.red().italic(t)}`,"")),this.out.write(nh.line+ts.to(0)+this.outputText))}};ns.exports=rs});var ps=u((zu,fs)=>{"use strict";function hs(i,e,t,s,r,n,o){try{var h=i[n](o),l=h.value}catch(a){t(a);return}h.done?e(l):Promise.resolve(l).then(s,r)}function ls(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var n=i.apply(e,t);function o(l){hs(n,s,r,o,h,"next",l)}function h(l){hs(n,s,r,o,h,"throw",l)}o(void 0)})}}var De=m(),gh=k(),us=b(),Ie=us.cursor,bh=us.erase,_e=S(),Ke=_e.style,vh=_e.figures,as=_e.clear,yh=_e.lines,wh=/[0-9]/,Xe=i=>i!==void 0,cs=(i,e)=>{let t=Math.pow(10,e);return Math.round(i*t)/t},ds=class extends gh{constructor(e={}){super(e);this.transform=Ke.render(e.style),this.msg=e.message,this.initial=Xe(e.initial)?e.initial:"",this.float=!!e.float,this.round=e.round||2,this.inc=e.increment||1,this.min=Xe(e.min)?e.min:-1/0,this.max=Xe(e.max)?e.max:1/0,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(e){!e&&e!==0?(this.placeholder=!0,this.rendered=De.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${cs(e,this.round)}`),this._value=cs(e,this.round)),this.fire()}get value(){return this._value}parse(e){return this.float?parseFloat(e):parseInt(e)}valid(e){return e==="-"||e==="."&&this.float||wh.test(e)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let e=this.value;this.value=e!==""?e:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
27
|
+
`),this.close()}validate(){var e=this;return ls(function*(){let t=yield e.validator(e.value);typeof t=="string"&&(e.errorMsg=t,t=!1),e.error=!t})()}submit(){var e=this;return ls(function*(){if(yield e.validate(),e.error){e.color="red",e.fire(),e.render();return}let t=e.value;e.value=t!==""?t:e.initial,e.done=!0,e.aborted=!1,e.error=!1,e.fire(),e.render(),e.out.write(`
|
|
28
|
+
`),e.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 e=this.value.toString();if(e.length===0)return this.bell();this.value=this.parse(e=e.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()}_(e,t){if(!this.valid(e))return this.bell();let s=Date.now();if(s-this.lastHit>1e3&&(this.typed=""),this.typed+=e,this.lastHit=s,this.color="cyan",e===".")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(Ie.down(yh(this.outputError,this.out.columns)-1)+as(this.outputError,this.out.columns)),this.out.write(as(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[Ke.symbol(this.done,this.aborted),De.bold(this.msg),Ke.delimiter(this.done),!this.done||!this.done&&!this.placeholder?De[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
29
29
|
`).reduce((e,t,s)=>e+`
|
|
30
|
-
${s?" ":
|
|
30
|
+
${s?" ":vh.pointerSmall} ${De.red().italic(t)}`,"")),this.out.write(bh.line+Ie.to(0)+this.outputText+Ie.save+this.outputError+Ie.restore))}};fs.exports=ds});var Qe=u((Wu,vs)=>{"use strict";var T=m(),xh=b(),Sh=xh.cursor,Oh=k(),le=S(),ms=le.clear,L=le.figures,gs=le.style,qh=le.wrap,Mh=le.entriesToDisplay,bs=class extends Oh{constructor(e={}){super(e);this.msg=e.message,this.cursor=e.cursor||0,this.scrollIndex=e.cursor||0,this.hint=e.hint||"",this.warn=e.warn||"- This option is disabled -",this.minSelected=e.min,this.showMinError=!1,this.maxChoices=e.max,this.instructions=e.instructions,this.optionsPerPage=e.optionsPerPage||10,this.value=e.choices.map((t,s)=>(typeof t=="string"&&(t={title:t,value:s}),{title:t&&(t.title||t.value||t),description:t&&t.description,value:t&&(t.value===void 0?s:t.value),selected:t&&t.selected,disabled:t&&t.disabled})),this.clear=ms("",this.out.columns),e.overrideRender||this.render()}reset(){this.value.map(e=>!e.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(e=>e.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
31
31
|
`),this.close()}submit(){let e=this.value.filter(t=>t.selected);this.minSelected&&e.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
32
32
|
`),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(e=>e.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){let e=this.value[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let e=!this.value[this.cursor].selected;this.value.filter(t=>!t.disabled).forEach(t=>t.selected=e),this.render()}_(e,t){if(e===" ")this.handleSpaceToggle();else if(e==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
33
33
|
Instructions:
|
|
34
34
|
${L.arrowUp}/${L.arrowDown}: Highlight option
|
|
35
35
|
${L.arrowLeft}/${L.arrowRight}/[space]: Toggle selection
|
|
36
36
|
`+(this.maxChoices===void 0?` a: Toggle all
|
|
37
|
-
`:"")+" enter/return: Complete answer":""}renderOption(e,t,s,r){let n=(t.selected?
|
|
38
|
-
`+
|
|
37
|
+
`:"")+" enter/return: Complete answer":""}renderOption(e,t,s,r){let n=(t.selected?T.green(L.radioOn):L.radioOff)+" "+r+" ",o,h;return t.disabled?o=e===s?T.gray().underline(t.title):T.strikethrough().gray(t.title):(o=e===s?T.cyan().underline(t.title):t.title,e===s&&t.description&&(h=` - ${t.description}`,(n.length+o.length+h.length>=this.out.columns||t.description.split(/\r?\n/).length>1)&&(h=`
|
|
38
|
+
`+qh(t.description,{margin:n.length,width:this.out.columns})))),n+o+T.gray(h||"")}paginateOptions(e){if(e.length===0)return T.red("No matches for this query.");let t=Mh(this.cursor,e.length,this.optionsPerPage),s=t.startIndex,r=t.endIndex,n,o=[];for(let h=s;h<r;h++)h===s&&s>0?n=L.arrowUp:h===r-1&&r<e.length?n=L.arrowDown:n=" ",o.push(this.renderOption(this.cursor,e[h],h,n));return`
|
|
39
39
|
`+o.join(`
|
|
40
|
-
`)}renderOptions(e){return this.done?"":this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[
|
|
40
|
+
`)}renderOptions(e){return this.done?"":this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[T.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&e.push(T.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Sh.hide),super.render();let e=[gs.symbol(this.done,this.aborted),T.bold(this.msg),gs.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=T.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.value),this.out.write(this.clear+e),this.clear=ms(e,this.out.columns)}};vs.exports=bs});var Ps=u((Zu,Ms)=>{"use strict";function ys(i,e,t,s,r,n,o){try{var h=i[n](o),l=h.value}catch(a){t(a);return}h.done?e(l):Promise.resolve(l).then(s,r)}function Ph(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var n=i.apply(e,t);function o(l){ys(n,s,r,o,h,"next",l)}function h(l){ys(n,s,r,o,h,"throw",l)}o(void 0)})}}var ue=m(),Th=k(),ws=b(),$h=ws.erase,xs=ws.cursor,ae=S(),et=ae.style,Ss=ae.clear,tt=ae.figures,Ch=ae.wrap,Dh=ae.entriesToDisplay,Os=(i,e)=>i[e]&&(i[e].value||i[e].title||i[e]),Ih=(i,e)=>i[e]&&(i[e].title||i[e].value||i[e]),_h=(i,e)=>{let t=i.findIndex(s=>s.value===e||s.title===e);return t>-1?t:void 0},qs=class extends Th{constructor(e={}){super(e);this.msg=e.message,this.suggest=e.suggest,this.choices=e.choices,this.initial=typeof e.initial=="number"?e.initial:_h(e.choices,e.initial),this.select=this.initial||e.cursor||0,this.i18n={noMatches:e.noMatches||"no matches found"},this.fallback=e.fallback||this.initial,this.clearFirst=e.clearFirst||!1,this.suggestions=[],this.input="",this.limit=e.limit||10,this.cursor=0,this.transform=et.render(e.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=Ss("",this.out.columns),this.complete(this.render),this.render()}set fallback(e){this._fb=Number.isSafeInteger(parseInt(e))?parseInt(e):e}get fallback(){let e;return typeof this._fb=="number"?e=this.choices[this._fb]:typeof this._fb=="string"&&(e={title:this._fb}),e||this._fb||{title:this.i18n.noMatches}}moveSelect(e){this.select=e,this.suggestions.length>0?this.value=Os(this.suggestions,e):this.value=this.fallback.value,this.fire()}complete(e){var t=this;return Ph(function*(){let s=t.completing=t.suggest(t.input,t.choices),r=yield s;if(t.completing!==s)return;t.suggestions=r.map((o,h,l)=>({title:Ih(l,h),value:Os(l,h),description:o.description})),t.completing=!1;let n=Math.max(r.length-1,0);t.moveSelect(Math.min(n,t.select)),e&&e()})()}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(`
|
|
41
41
|
`),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
42
42
|
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
43
43
|
`),this.close()}_(e,t){let s=this.input.slice(0,this.cursor),r=this.input.slice(this.cursor);this.input=`${s}${e}${r}`,this.cursor=s.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let e=this.input.slice(0,this.cursor-1),t=this.input.slice(this.cursor);this.input=`${e}${t}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let e=this.input.slice(0,this.cursor),t=this.input.slice(this.cursor+1);this.input=`${e}${t}`,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(e,t,s,r){let n,o=s?tt.arrowUp:r?tt.arrowDown:" ",h=t?ue.cyan().underline(e.title):e.title;return o=(t?ue.cyan(tt.pointer)+" ":" ")+o,e.description&&(n=` - ${e.description}`,(o.length+h.length+n.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(n=`
|
|
44
|
-
`+
|
|
44
|
+
`+Ch(e.description,{margin:3,width:this.out.columns}))),o+" "+h+ue.gray(n||"")}render(){if(this.closed)return;this.firstRender?this.out.write(xs.hide):this.out.write(Ss(this.outputText,this.out.columns)),super.render();let e=Dh(this.select,this.choices.length,this.limit),t=e.startIndex,s=e.endIndex;if(this.outputText=[et.symbol(this.done,this.aborted,this.exited),ue.bold(this.msg),et.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){let r=this.suggestions.slice(t,s).map((n,o)=>this.renderOption(n,this.select===o+t,o===0&&t>0,o+t===s-1&&s<this.choices.length)).join(`
|
|
45
45
|
`);this.outputText+=`
|
|
46
|
-
`+(r||ue.gray(this.fallback.title))}this.out.write(
|
|
46
|
+
`+(r||ue.gray(this.fallback.title))}this.out.write($h.line+xs.to(0)+this.outputText)}};Ms.exports=qs});var Is=u((Ku,Ds)=>{"use strict";var A=m(),kh=b(),jh=kh.cursor,Eh=Qe(),it=S(),Ts=it.clear,$s=it.style,Z=it.figures,Cs=class extends Eh{constructor(e={}){e.overrideRender=!0,super(e),this.inputValue="",this.clear=Ts("",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(e=>e.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(){let e=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(s=>this.inputValue?!!(typeof s.title=="string"&&s.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof s.value=="string"&&s.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);let t=this.filteredOptions.findIndex(s=>s===e);this.cursor=t<0?0:t,this.render()}handleSpaceToggle(){let e=this.filteredOptions[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}handleInputChange(e){this.inputValue=this.inputValue+e,this.updateFilteredOptions()}_(e,t){e===" "?this.handleSpaceToggle():this.handleInputChange(e)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
47
47
|
Instructions:
|
|
48
48
|
${Z.arrowUp}/${Z.arrowDown}: Highlight option
|
|
49
49
|
${Z.arrowLeft}/${Z.arrowRight}/[space]: Toggle selection
|
|
@@ -51,47 +51,47 @@ Instructions:
|
|
|
51
51
|
enter/return: Complete answer
|
|
52
52
|
`:""}renderCurrentInput(){return`
|
|
53
53
|
Filtered results for: ${this.inputValue?this.inputValue:A.gray("Enter something to filter")}
|
|
54
|
-
`}renderOption(e,t,s){let r;return t.disabled?r=e===s?A.gray().underline(t.title):A.strikethrough().gray(t.title):r=e===s?A.cyan().underline(t.title):t.title,(t.selected?A.green(Z.radioOn):Z.radioOff)+" "+r}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[A.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&e.push(A.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(
|
|
54
|
+
`}renderOption(e,t,s){let r;return t.disabled?r=e===s?A.gray().underline(t.title):A.strikethrough().gray(t.title):r=e===s?A.cyan().underline(t.title):t.title,(t.selected?A.green(Z.radioOn):Z.radioOff)+" "+r}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[A.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&e.push(A.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(jh.hide),super.render();let e=[$s.symbol(this.done,this.aborted),A.bold(this.msg),$s.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=A.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+e),this.clear=Ts(e,this.out.columns)}};Ds.exports=Cs});var Ys=u((Xu,Fs)=>{"use strict";var _s=m(),Ah=k(),ks=S(),js=ks.style,Rh=ks.clear,Es=b(),Fh=Es.erase,As=Es.cursor,Rs=class extends Ah{constructor(e={}){super(e);this.msg=e.message,this.value=e.initial,this.initialValue=!!e.initial,this.yesMsg=e.yes||"yes",this.yesOption=e.yesOption||"(Y/n)",this.noMsg=e.no||"no",this.noOption=e.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(`
|
|
55
55
|
`),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
56
|
-
`),this.close()}_(e,t){return e.toLowerCase()==="y"?(this.value=!0,this.submit()):e.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(
|
|
57
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var n=!0,o=!1,h;return{s:function(){t=t.call(i)},n:function(){var a=t.next();return n=a.done,a},e:function(a){o=!0,h=a},f:function(){try{!n&&t.return!=null&&t.return()}finally{if(o)throw h}}}}function
|
|
56
|
+
`),this.close()}_(e,t){return e.toLowerCase()==="y"?(this.value=!0,this.submit()):e.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(As.hide):this.out.write(Rh(this.outputText,this.out.columns)),super.render(),this.outputText=[js.symbol(this.done,this.aborted),_s.bold(this.msg),js.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:_s.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(Fh.line+As.to(0)+this.outputText))}};Fs.exports=Rs});var Ns=u((Qu,Hs)=>{"use strict";Hs.exports={TextPrompt:ai(),SelectPrompt:mi(),TogglePrompt:Si(),DatePrompt:os(),NumberPrompt:ps(),MultiselectPrompt:Qe(),AutocompletePrompt:Ps(),AutocompleteMultiselectPrompt:Is(),ConfirmPrompt:Ys()}});var Vs=u(Ls=>{"use strict";var w=Ls,Yh=Ns(),ke=i=>i;function $(i,e,t={}){return new Promise((s,r)=>{let n=new Yh[i](e),o=t.onAbort||ke,h=t.onSubmit||ke,l=t.onExit||ke;n.on("state",e.onState||ke),n.on("submit",a=>s(h(a))),n.on("exit",a=>s(l(a))),n.on("abort",a=>r(o(a)))})}w.text=i=>$("TextPrompt",i);w.password=i=>(i.style="password",w.text(i));w.invisible=i=>(i.style="invisible",w.text(i));w.number=i=>$("NumberPrompt",i);w.date=i=>$("DatePrompt",i);w.confirm=i=>$("ConfirmPrompt",i);w.list=i=>{let e=i.separator||",";return $("TextPrompt",i,{onSubmit:t=>t.split(e).map(s=>s.trim())})};w.toggle=i=>$("TogglePrompt",i);w.select=i=>$("SelectPrompt",i);w.multiselect=i=>{i.choices=[].concat(i.choices||[]);let e=t=>t.filter(s=>s.selected).map(s=>s.value);return $("MultiselectPrompt",i,{onAbort:e,onSubmit:e})};w.autocompleteMultiselect=i=>{i.choices=[].concat(i.choices||[]);let e=t=>t.filter(s=>s.selected).map(s=>s.value);return $("AutocompleteMultiselectPrompt",i,{onAbort:e,onSubmit:e})};var Hh=(i,e)=>Promise.resolve(e.filter(t=>t.title.slice(0,i.length).toLowerCase()===i.toLowerCase()));w.autocomplete=i=>(i.suggest=i.suggest||Hh,i.choices=[].concat(i.choices||[]),$("AutocompletePrompt",i))});var Ks=u((ta,Zs)=>{"use strict";function Js(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);e&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,s)}return t}function Gs(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Js(Object(t),!0).forEach(function(s){Nh(i,s,t[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Js(Object(t)).forEach(function(s){Object.defineProperty(i,s,Object.getOwnPropertyDescriptor(t,s))})}return i}function Nh(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Lh(i,e){var t=typeof Symbol!="undefined"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=Vh(i))||e&&i&&typeof i.length=="number"){t&&(i=t);var s=0,r=function(){};return{s:r,n:function(){return s>=i.length?{done:!0}:{done:!1,value:i[s++]}},e:function(a){throw a},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
57
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var n=!0,o=!1,h;return{s:function(){t=t.call(i)},n:function(){var a=t.next();return n=a.done,a},e:function(a){o=!0,h=a},f:function(){try{!n&&t.return!=null&&t.return()}finally{if(o)throw h}}}}function Vh(i,e){if(!!i){if(typeof i=="string")return Us(i,e);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return Array.from(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Us(i,e)}}function Us(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,s=new Array(e);t<e;t++)s[t]=i[t];return s}function Bs(i,e,t,s,r,n,o){try{var h=i[n](o),l=h.value}catch(a){t(a);return}h.done?e(l):Promise.resolve(l).then(s,r)}function zs(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var n=i.apply(e,t);function o(l){Bs(n,s,r,o,h,"next",l)}function h(l){Bs(n,s,r,o,h,"throw",l)}o(void 0)})}}var st=Vs(),Jh=["suggest","format","onState","validate","onRender","type"],Ws=()=>{};function V(){return rt.apply(this,arguments)}function rt(){return rt=zs(function*(i=[],{onSubmit:e=Ws,onCancel:t=Ws}={}){let s={},r=V._override||{};i=[].concat(i);let n,o,h,l,a,Q,ee=function(){var H=zs(function*(_,be,yt=!1){if(!(!yt&&_.validate&&_.validate(be)!==!0))return _.format?yield _.format(be,s):be});return function(be,yt){return H.apply(this,arguments)}}();var v=Lh(i),q;try{for(v.s();!(q=v.n()).done;){o=q.value;var ge=o;if(l=ge.name,a=ge.type,typeof a=="function"&&(a=yield a(n,Gs({},s),o),o.type=a),!!a){for(let H in o){if(Jh.includes(H))continue;let _=o[H];o[H]=typeof _=="function"?yield _(n,Gs({},s),Q):_}if(Q=o,typeof o.message!="string")throw new Error("prompt message is required");var vt=o;if(l=vt.name,a=vt.type,st[a]===void 0)throw new Error(`prompt type (${a}) is not defined`);if(r[o.name]!==void 0&&(n=yield ee(o,r[o.name]),n!==void 0)){s[l]=n;continue}try{n=V._injected?Gh(V._injected,o.initial):yield st[a](o),s[l]=n=yield ee(o,n,!0),h=yield e(o,n,s)}catch(H){h=!(yield t(o,s))}if(h)return s}}}catch(H){v.e(H)}finally{v.f()}return s}),rt.apply(this,arguments)}function Gh(i,e){let t=i.shift();if(t instanceof Error)throw t;return t===void 0?e:t}function Uh(i){V._injected=(V._injected||[]).concat(i)}function Bh(i){V._override=Object.assign({},i)}Zs.exports=Object.assign(V,{prompt:V,prompts:st,inject:Uh,override:Bh})});var Qs=u((ia,Xs)=>{"use strict";Xs.exports=(i,e)=>{if(!(i.meta&&i.name!=="escape")){if(i.ctrl){if(i.name==="a")return"first";if(i.name==="c"||i.name==="d")return"abort";if(i.name==="e")return"last";if(i.name==="g")return"reset"}if(e){if(i.name==="j")return"down";if(i.name==="k")return"up"}return i.name==="return"||i.name==="enter"?"submit":i.name==="backspace"?"delete":i.name==="delete"?"deleteForward":i.name==="abort"?"abort":i.name==="escape"?"exit":i.name==="tab"?"next":i.name==="pagedown"?"nextPage":i.name==="pageup"?"prevPage":i.name==="home"?"home":i.name==="end"?"end":i.name==="up"?"up":i.name==="down"?"down":i.name==="right"?"right":i.name==="left"?"left":!1}}});var je=u((sa,er)=>{"use strict";er.exports=i=>{let e=["[\\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("|"),t=new RegExp(e,"g");return typeof i=="string"?i.replace(t,""):i}});var sr=u((ra,ir)=>{"use strict";var zh=je(),{erase:tr,cursor:Wh}=b(),Zh=i=>[...zh(i)].length;ir.exports=function(i,e){if(!e)return tr.line+Wh.to(0);let t=0,s=i.split(/\r?\n/);for(let r of s)t+=1+Math.floor(Math.max(Zh(r)-1,0)/e);return tr.lines(t)}});var nt=u((na,rr)=>{"use strict";var ce={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},Kh={arrowUp:ce.arrowUp,arrowDown:ce.arrowDown,arrowLeft:ce.arrowLeft,arrowRight:ce.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},Xh=process.platform==="win32"?Kh:ce;rr.exports=Xh});var or=u((oa,nr)=>{"use strict";var K=m(),z=nt(),ot=Object.freeze({password:{scale:1,render:i=>"*".repeat(i.length)},emoji:{scale:2,render:i=>"\u{1F603}".repeat(i.length)},invisible:{scale:0,render:i=>""},default:{scale:1,render:i=>`${i}`}}),Qh=i=>ot[i]||ot.default,de=Object.freeze({aborted:K.red(z.cross),done:K.green(z.tick),exited:K.yellow(z.cross),default:K.cyan("?")}),el=(i,e,t)=>e?de.aborted:t?de.exited:i?de.done:de.default,tl=i=>K.gray(i?z.ellipsis:z.pointerSmall),il=(i,e)=>K.gray(i?e?z.pointerSmall:"+":z.line);nr.exports={styles:ot,render:Qh,symbols:de,symbol:el,delimiter:tl,item:il}});var lr=u((ha,hr)=>{"use strict";var sl=je();hr.exports=function(i,e){let t=String(sl(i)||"").split(/\r?\n/);return e?t.map(s=>Math.ceil(s.length/e)).reduce((s,r)=>s+r):t.length}});var ar=u((la,ur)=>{"use strict";ur.exports=(i,e={})=>{let t=Number.isSafeInteger(parseInt(e.margin))?new Array(parseInt(e.margin)).fill(" ").join(""):e.margin||"",s=e.width;return(i||"").split(/\r?\n/g).map(r=>r.split(/\s+/g).reduce((n,o)=>(o.length+t.length>=s||n[n.length-1].length+o.length+1<s?n[n.length-1]+=` ${o}`:n.push(`${t}${o}`),n),[t]).join(`
|
|
58
58
|
`)).join(`
|
|
59
|
-
`)}});var
|
|
59
|
+
`)}});var dr=u((ua,cr)=>{"use strict";cr.exports=(i,e,t)=>{t=t||e;let s=Math.min(e-t,i-Math.floor(t/2));s<0&&(s=0);let r=Math.min(s+t,e);return{startIndex:s,endIndex:r}}});var O=u((aa,fr)=>{"use strict";fr.exports={action:Qs(),clear:sr(),style:or(),strip:je(),figures:nt(),lines:lr(),wrap:ar(),entriesToDisplay:dr()}});var R=u((ca,gr)=>{"use strict";var pr=require("readline"),{action:rl}=O(),nl=require("events"),{beep:ol,cursor:hl}=b(),ll=m(),mr=class extends nl{constructor(e={}){super();this.firstRender=!0,this.in=e.stdin||process.stdin,this.out=e.stdout||process.stdout,this.onRender=(e.onRender||(()=>{})).bind(this);let t=pr.createInterface({input:this.in,escapeCodeTimeout:50});pr.emitKeypressEvents(this.in,t),this.in.isTTY&&this.in.setRawMode(!0);let s=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,r=(n,o)=>{let h=rl(o,s);h===!1?this._&&this._(n,o):typeof this[h]=="function"?this[h](o):this.bell()};this.close=()=>{this.out.write(hl.show),this.in.removeListener("keypress",r),this.in.isTTY&&this.in.setRawMode(!1),t.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",r)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(ol)}render(){this.onRender(ll),this.firstRender&&(this.firstRender=!1)}};gr.exports=mr});var yr=u((da,vr)=>{var Ee=m(),ul=R(),{erase:al,cursor:fe}=b(),{style:ht,clear:lt,lines:cl,figures:dl}=O(),br=class extends ul{constructor(e={}){super(e);this.transform=ht.render(e.style),this.scale=this.transform.scale,this.msg=e.message,this.initial=e.initial||"",this.validator=e.validate||(()=>!0),this.value="",this.errorMsg=e.error||"Please Enter A Valid Value",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.clear=lt("",this.out.columns),this.render()}set value(e){!e&&this.initial?(this.placeholder=!0,this.rendered=Ee.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(e)),this._value=e,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
|
|
60
60
|
`),this.close()}async validate(){let e=await this.validator(this.value);typeof e=="string"&&(this.errorMsg=e,e=!1),this.error=!e}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(`
|
|
61
|
-
`),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(e){this.placeholder||(this.cursor=this.cursor+e,this.cursorOffset+=e)}_(e,t){let s=this.value.slice(0,this.cursor),r=this.value.slice(this.cursor);this.value=`${s}${e}${r}`,this.red=!1,this.cursor=this.placeholder?0:s.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let e=this.value.slice(0,this.cursor-1),t=this.value.slice(this.cursor);this.value=`${e}${t}`,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 e=this.value.slice(0,this.cursor),t=this.value.slice(this.cursor+1);this.value=`${e}${t}`,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(fe.down(
|
|
61
|
+
`),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(e){this.placeholder||(this.cursor=this.cursor+e,this.cursorOffset+=e)}_(e,t){let s=this.value.slice(0,this.cursor),r=this.value.slice(this.cursor);this.value=`${s}${e}${r}`,this.red=!1,this.cursor=this.placeholder?0:s.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let e=this.value.slice(0,this.cursor-1),t=this.value.slice(this.cursor);this.value=`${e}${t}`,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 e=this.value.slice(0,this.cursor),t=this.value.slice(this.cursor+1);this.value=`${e}${t}`,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(fe.down(cl(this.outputError,this.out.columns)-1)+lt(this.outputError,this.out.columns)),this.out.write(lt(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[ht.symbol(this.done,this.aborted),Ee.bold(this.msg),ht.delimiter(this.done),this.red?Ee.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
62
62
|
`).reduce((e,t,s)=>e+`
|
|
63
|
-
${s?" ":
|
|
63
|
+
${s?" ":dl.pointerSmall} ${Ee.red().italic(t)}`,"")),this.out.write(al.line+fe.to(0)+this.outputText+fe.save+this.outputError+fe.restore+fe.move(this.cursorOffset,0)))}};vr.exports=br});var qr=u((fa,Or)=>{"use strict";var F=m(),fl=R(),{style:wr,clear:xr,figures:Ae,wrap:pl,entriesToDisplay:ml}=O(),{cursor:gl}=b(),Sr=class extends fl{constructor(e={}){super(e);this.msg=e.message,this.hint=e.hint||"- Use arrow-keys. Return to submit.",this.warn=e.warn||"- This option is disabled",this.cursor=e.initial||0,this.choices=e.choices.map((t,s)=>(typeof t=="string"&&(t={title:t,value:s}),{title:t&&(t.title||t.value||t),value:t&&(t.value===void 0?s:t.value),description:t&&t.description,selected:t&&t.selected,disabled:t&&t.disabled})),this.optionsPerPage=e.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=xr("",this.out.columns),this.render()}moveCursor(e){this.cursor=e,this.value=this.choices[e].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(`
|
|
64
64
|
`),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
65
|
-
`),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()}_(e,t){if(e===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(
|
|
65
|
+
`),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()}_(e,t){if(e===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(gl.hide):this.out.write(xr(this.outputText,this.out.columns)),super.render();let{startIndex:e,endIndex:t}=ml(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[wr.symbol(this.done,this.aborted),F.bold(this.msg),wr.delimiter(!1),this.done?this.selection.title:this.selection.disabled?F.yellow(this.warn):F.gray(this.hint)].join(" "),!this.done){this.outputText+=`
|
|
66
66
|
`;for(let s=e;s<t;s++){let r,n,o="",h=this.choices[s];s===e&&e>0?n=Ae.arrowUp:s===t-1&&t<this.choices.length?n=Ae.arrowDown:n=" ",h.disabled?(r=this.cursor===s?F.gray().underline(h.title):F.strikethrough().gray(h.title),n=(this.cursor===s?F.bold().gray(Ae.pointer)+" ":" ")+n):(r=this.cursor===s?F.cyan().underline(h.title):h.title,n=(this.cursor===s?F.cyan(Ae.pointer)+" ":" ")+n,h.description&&this.cursor===s&&(o=` - ${h.description}`,(n.length+r.length+o.length>=this.out.columns||h.description.split(/\r?\n/).length>1)&&(o=`
|
|
67
|
-
`+
|
|
68
|
-
`}}this.out.write(this.outputText)}};
|
|
67
|
+
`+pl(h.description,{margin:3,width:this.out.columns})))),this.outputText+=`${n} ${r}${F.gray(o)}
|
|
68
|
+
`}}this.out.write(this.outputText)}};Or.exports=Sr});var Cr=u((pa,$r)=>{var Re=m(),bl=R(),{style:Mr,clear:vl}=O(),{cursor:Pr,erase:yl}=b(),Tr=class extends bl{constructor(e={}){super(e);this.msg=e.message,this.value=!!e.initial,this.active=e.active||"on",this.inactive=e.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(`
|
|
69
69
|
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
70
|
-
`),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()}_(e,t){if(e===" ")this.value=!this.value;else if(e==="1")this.value=!0;else if(e==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(
|
|
70
|
+
`),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()}_(e,t){if(e===" ")this.value=!this.value;else if(e==="1")this.value=!0;else if(e==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(Pr.hide):this.out.write(vl(this.outputText,this.out.columns)),super.render(),this.outputText=[Mr.symbol(this.done,this.aborted),Re.bold(this.msg),Mr.delimiter(this.done),this.value?this.inactive:Re.cyan().underline(this.inactive),Re.gray("/"),this.value?Re.cyan().underline(this.active):this.active].join(" "),this.out.write(yl.line+Pr.to(0)+this.outputText))}};$r.exports=Tr});var C=u((ma,Dr)=>{"use strict";var pe=class{constructor({token:e,date:t,parts:s,locales:r}){this.token=e,this.date=t||new Date,this.parts=s||[this],this.locales=r||{}}up(){}down(){}next(){let e=this.parts.indexOf(this);return this.parts.find((t,s)=>s>e&&t instanceof pe)}setTo(e){}prev(){let e=[].concat(this.parts).reverse(),t=e.indexOf(this);return e.find((s,r)=>r>t&&s instanceof pe)}toString(){return String(this.date)}};Dr.exports=pe});var kr=u((ga,_r)=>{"use strict";var wl=C(),Ir=class extends wl{constructor(e={}){super(e)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let e=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?e.toUpperCase():e}};_r.exports=Ir});var Ar=u((ba,Er)=>{"use strict";var xl=C(),Sl=i=>(i=i%10,i===1?"st":i===2?"nd":i===3?"rd":"th"),jr=class extends xl{constructor(e={}){super(e)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(e){this.date.setDate(parseInt(e.substr(-2)))}toString(){let e=this.date.getDate(),t=this.date.getDay();return this.token==="DD"?String(e).padStart(2,"0"):this.token==="Do"?e+Sl(e):this.token==="d"?t+1:this.token==="ddd"?this.locales.weekdaysShort[t]:this.token==="dddd"?this.locales.weekdays[t]:e}};Er.exports=jr});var Yr=u((va,Fr)=>{"use strict";var Ol=C(),Rr=class extends Ol{constructor(e={}){super(e)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(e){this.date.setHours(parseInt(e.substr(-2)))}toString(){let e=this.date.getHours();return/h/.test(this.token)&&(e=e%12||12),this.token.length>1?String(e).padStart(2,"0"):e}};Fr.exports=Rr});var Lr=u((ya,Nr)=>{"use strict";var ql=C(),Hr=class extends ql{constructor(e={}){super(e)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(e){this.date.setMilliseconds(parseInt(e.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};Nr.exports=Hr});var Gr=u((wa,Jr)=>{"use strict";var Ml=C(),Vr=class extends Ml{constructor(e={}){super(e)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(e){this.date.setMinutes(parseInt(e.substr(-2)))}toString(){let e=this.date.getMinutes();return this.token.length>1?String(e).padStart(2,"0"):e}};Jr.exports=Vr});var zr=u((xa,Br)=>{"use strict";var Pl=C(),Ur=class extends Pl{constructor(e={}){super(e)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(e){e=parseInt(e.substr(-2))-1,this.date.setMonth(e<0?0:e)}toString(){let e=this.date.getMonth(),t=this.token.length;return t===2?String(e+1).padStart(2,"0"):t===3?this.locales.monthsShort[e]:t===4?this.locales.months[e]:String(e+1)}};Br.exports=Ur});var Kr=u((Sa,Zr)=>{"use strict";var Tl=C(),Wr=class extends Tl{constructor(e={}){super(e)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(e){this.date.setSeconds(parseInt(e.substr(-2)))}toString(){let e=this.date.getSeconds();return this.token.length>1?String(e).padStart(2,"0"):e}};Zr.exports=Wr});var en=u((Oa,Qr)=>{"use strict";var $l=C(),Xr=class extends $l{constructor(e={}){super(e)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(e){this.date.setFullYear(e.substr(-4))}toString(){let e=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?e.substr(-2):e}};Qr.exports=Xr});var sn=u((qa,tn)=>{"use strict";tn.exports={DatePart:C(),Meridiem:kr(),Day:Ar(),Hours:Yr(),Milliseconds:Lr(),Minutes:Gr(),Month:zr(),Seconds:Kr(),Year:en()}});var cn=u((Ma,an)=>{"use strict";var ut=m(),Cl=R(),{style:rn,clear:nn,figures:Dl}=O(),{erase:Il,cursor:on}=b(),{DatePart:hn,Meridiem:_l,Day:kl,Hours:jl,Milliseconds:El,Minutes:Al,Month:Rl,Seconds:Fl,Year:Yl}=sn(),Hl=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,ln={1:({token:i})=>i.replace(/\\(.)/g,"$1"),2:i=>new kl(i),3:i=>new Rl(i),4:i=>new Yl(i),5:i=>new _l(i),6:i=>new jl(i),7:i=>new Al(i),8:i=>new Fl(i),9:i=>new El(i)},Nl={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(",")},un=class extends Cl{constructor(e={}){super(e);this.msg=e.message,this.cursor=0,this.typed="",this.locales=Object.assign(Nl,e.locales),this._date=e.initial||new Date,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.mask=e.mask||"YYYY-MM-DD HH:mm:ss",this.clear=nn("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(e){e&&this._date.setTime(e.getTime())}set mask(e){let t;for(this.parts=[];t=Hl.exec(e);){let r=t.shift(),n=t.findIndex(o=>o!=null);this.parts.push(n in ln?ln[n]({token:t[n]||r,date:this.date,parts:this.parts,locales:this.locales}):t[n]||r)}let s=this.parts.reduce((r,n)=>(typeof n=="string"&&typeof r[r.length-1]=="string"?r[r.length-1]+=n:r.push(n),r),[]);this.parts.splice(0),this.parts.push(...s),this.reset()}moveCursor(e){this.typed="",this.cursor=e,this.fire()}reset(){this.moveCursor(this.parts.findIndex(e=>e instanceof hn)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
71
71
|
`),this.close()}async validate(){let e=await this.validator(this.value);typeof e=="string"&&(this.errorMsg=e,e=!1),this.error=!e}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(`
|
|
72
|
-
`),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let e=this.parts[this.cursor].prev();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}right(){let e=this.parts[this.cursor].next();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}next(){let e=this.parts[this.cursor].next();this.moveCursor(e?this.parts.indexOf(e):this.parts.findIndex(t=>t instanceof
|
|
72
|
+
`),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let e=this.parts[this.cursor].prev();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}right(){let e=this.parts[this.cursor].next();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}next(){let e=this.parts[this.cursor].next();this.moveCursor(e?this.parts.indexOf(e):this.parts.findIndex(t=>t instanceof hn)),this.render()}_(e){/\d/.test(e)&&(this.typed+=e,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(on.hide):this.out.write(nn(this.outputText,this.out.columns)),super.render(),this.outputText=[rn.symbol(this.done,this.aborted),ut.bold(this.msg),rn.delimiter(!1),this.parts.reduce((e,t,s)=>e.concat(s===this.cursor&&!this.done?ut.cyan().underline(t.toString()):t),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
|
|
73
73
|
`).reduce((e,t,s)=>e+`
|
|
74
|
-
${s?" "
|
|
74
|
+
${s?" ":Dl.pointerSmall} ${ut.red().italic(t)}`,"")),this.out.write(Il.line+on.to(0)+this.outputText))}};an.exports=un});var gn=u((Pa,mn)=>{var Fe=m(),Ll=R(),{cursor:Ye,erase:Vl}=b(),{style:at,figures:Jl,clear:dn,lines:Gl}=O(),Ul=/[0-9]/,ct=i=>i!==void 0,fn=(i,e)=>{let t=Math.pow(10,e);return Math.round(i*t)/t},pn=class extends Ll{constructor(e={}){super(e);this.transform=at.render(e.style),this.msg=e.message,this.initial=ct(e.initial)?e.initial:"",this.float=!!e.float,this.round=e.round||2,this.inc=e.increment||1,this.min=ct(e.min)?e.min:-1/0,this.max=ct(e.max)?e.max:1/0,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(e){!e&&e!==0?(this.placeholder=!0,this.rendered=Fe.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${fn(e,this.round)}`),this._value=fn(e,this.round)),this.fire()}get value(){return this._value}parse(e){return this.float?parseFloat(e):parseInt(e)}valid(e){return e==="-"||e==="."&&this.float||Ul.test(e)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let e=this.value;this.value=e!==""?e:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
75
75
|
`),this.close()}async validate(){let e=await this.validator(this.value);typeof e=="string"&&(this.errorMsg=e,e=!1),this.error=!e}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}let e=this.value;this.value=e!==""?e:this.initial,this.done=!0,this.aborted=!1,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
76
|
-
`),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 e=this.value.toString();if(e.length===0)return this.bell();this.value=this.parse(e=e.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()}_(e,t){if(!this.valid(e))return this.bell();let s=Date.now();if(s-this.lastHit>1e3&&(this.typed=""),this.typed+=e,this.lastHit=s,this.color="cyan",e===".")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(Ye.down(
|
|
76
|
+
`),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 e=this.value.toString();if(e.length===0)return this.bell();this.value=this.parse(e=e.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()}_(e,t){if(!this.valid(e))return this.bell();let s=Date.now();if(s-this.lastHit>1e3&&(this.typed=""),this.typed+=e,this.lastHit=s,this.color="cyan",e===".")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(Ye.down(Gl(this.outputError,this.out.columns)-1)+dn(this.outputError,this.out.columns)),this.out.write(dn(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[at.symbol(this.done,this.aborted),Fe.bold(this.msg),at.delimiter(this.done),!this.done||!this.done&&!this.placeholder?Fe[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
77
77
|
`).reduce((e,t,s)=>e+`
|
|
78
|
-
${s?" ":
|
|
78
|
+
${s?" ":Jl.pointerSmall} ${Fe.red().italic(t)}`,"")),this.out.write(Vl.line+Ye.to(0)+this.outputText+Ye.save+this.outputError+Ye.restore))}};mn.exports=pn});var dt=u((Ta,wn)=>{"use strict";var D=m(),{cursor:Bl}=b(),zl=R(),{clear:bn,figures:J,style:vn,wrap:Wl,entriesToDisplay:Zl}=O(),yn=class extends zl{constructor(e={}){super(e);this.msg=e.message,this.cursor=e.cursor||0,this.scrollIndex=e.cursor||0,this.hint=e.hint||"",this.warn=e.warn||"- This option is disabled -",this.minSelected=e.min,this.showMinError=!1,this.maxChoices=e.max,this.instructions=e.instructions,this.optionsPerPage=e.optionsPerPage||10,this.value=e.choices.map((t,s)=>(typeof t=="string"&&(t={title:t,value:s}),{title:t&&(t.title||t.value||t),description:t&&t.description,value:t&&(t.value===void 0?s:t.value),selected:t&&t.selected,disabled:t&&t.disabled})),this.clear=bn("",this.out.columns),e.overrideRender||this.render()}reset(){this.value.map(e=>!e.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(e=>e.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
79
79
|
`),this.close()}submit(){let e=this.value.filter(t=>t.selected);this.minSelected&&e.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
80
80
|
`),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(e=>e.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){let e=this.value[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let e=!this.value[this.cursor].selected;this.value.filter(t=>!t.disabled).forEach(t=>t.selected=e),this.render()}_(e,t){if(e===" ")this.handleSpaceToggle();else if(e==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
81
81
|
Instructions:
|
|
82
82
|
${J.arrowUp}/${J.arrowDown}: Highlight option
|
|
83
83
|
${J.arrowLeft}/${J.arrowRight}/[space]: Toggle selection
|
|
84
84
|
`+(this.maxChoices===void 0?` a: Toggle all
|
|
85
|
-
`:"")+" enter/return: Complete answer":""}renderOption(e,t,s,r){let n=(t.selected?
|
|
86
|
-
`+
|
|
85
|
+
`:"")+" enter/return: Complete answer":""}renderOption(e,t,s,r){let n=(t.selected?D.green(J.radioOn):J.radioOff)+" "+r+" ",o,h;return t.disabled?o=e===s?D.gray().underline(t.title):D.strikethrough().gray(t.title):(o=e===s?D.cyan().underline(t.title):t.title,e===s&&t.description&&(h=` - ${t.description}`,(n.length+o.length+h.length>=this.out.columns||t.description.split(/\r?\n/).length>1)&&(h=`
|
|
86
|
+
`+Wl(t.description,{margin:n.length,width:this.out.columns})))),n+o+D.gray(h||"")}paginateOptions(e){if(e.length===0)return D.red("No matches for this query.");let{startIndex:t,endIndex:s}=Zl(this.cursor,e.length,this.optionsPerPage),r,n=[];for(let o=t;o<s;o++)o===t&&t>0?r=J.arrowUp:o===s-1&&s<e.length?r=J.arrowDown:r=" ",n.push(this.renderOption(this.cursor,e[o],o,r));return`
|
|
87
87
|
`+n.join(`
|
|
88
|
-
`)}renderOptions(e){return this.done?"":this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[
|
|
88
|
+
`)}renderOptions(e){return this.done?"":this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[D.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&e.push(D.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Bl.hide),super.render();let e=[vn.symbol(this.done,this.aborted),D.bold(this.msg),vn.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=D.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.value),this.out.write(this.clear+e),this.clear=bn(e,this.out.columns)}};wn.exports=yn});var Pn=u(($a,Mn)=>{"use strict";var me=m(),Kl=R(),{erase:Xl,cursor:xn}=b(),{style:ft,clear:Sn,figures:pt,wrap:Ql,entriesToDisplay:eu}=O(),On=(i,e)=>i[e]&&(i[e].value||i[e].title||i[e]),tu=(i,e)=>i[e]&&(i[e].title||i[e].value||i[e]),iu=(i,e)=>{let t=i.findIndex(s=>s.value===e||s.title===e);return t>-1?t:void 0},qn=class extends Kl{constructor(e={}){super(e);this.msg=e.message,this.suggest=e.suggest,this.choices=e.choices,this.initial=typeof e.initial=="number"?e.initial:iu(e.choices,e.initial),this.select=this.initial||e.cursor||0,this.i18n={noMatches:e.noMatches||"no matches found"},this.fallback=e.fallback||this.initial,this.clearFirst=e.clearFirst||!1,this.suggestions=[],this.input="",this.limit=e.limit||10,this.cursor=0,this.transform=ft.render(e.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=Sn("",this.out.columns),this.complete(this.render),this.render()}set fallback(e){this._fb=Number.isSafeInteger(parseInt(e))?parseInt(e):e}get fallback(){let e;return typeof this._fb=="number"?e=this.choices[this._fb]:typeof this._fb=="string"&&(e={title:this._fb}),e||this._fb||{title:this.i18n.noMatches}}moveSelect(e){this.select=e,this.suggestions.length>0?this.value=On(this.suggestions,e):this.value=this.fallback.value,this.fire()}async complete(e){let t=this.completing=this.suggest(this.input,this.choices),s=await t;if(this.completing!==t)return;this.suggestions=s.map((n,o,h)=>({title:tu(h,o),value:On(h,o),description:n.description})),this.completing=!1;let r=Math.max(s.length-1,0);this.moveSelect(Math.min(r,this.select)),e&&e()}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(`
|
|
89
89
|
`),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
90
90
|
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
91
91
|
`),this.close()}_(e,t){let s=this.input.slice(0,this.cursor),r=this.input.slice(this.cursor);this.input=`${s}${e}${r}`,this.cursor=s.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let e=this.input.slice(0,this.cursor-1),t=this.input.slice(this.cursor);this.input=`${e}${t}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let e=this.input.slice(0,this.cursor),t=this.input.slice(this.cursor+1);this.input=`${e}${t}`,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(e,t,s,r){let n,o=s?pt.arrowUp:r?pt.arrowDown:" ",h=t?me.cyan().underline(e.title):e.title;return o=(t?me.cyan(pt.pointer)+" ":" ")+o,e.description&&(n=` - ${e.description}`,(o.length+h.length+n.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(n=`
|
|
92
|
-
`+
|
|
92
|
+
`+Ql(e.description,{margin:3,width:this.out.columns}))),o+" "+h+me.gray(n||"")}render(){if(this.closed)return;this.firstRender?this.out.write(xn.hide):this.out.write(Sn(this.outputText,this.out.columns)),super.render();let{startIndex:e,endIndex:t}=eu(this.select,this.choices.length,this.limit);if(this.outputText=[ft.symbol(this.done,this.aborted,this.exited),me.bold(this.msg),ft.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){let s=this.suggestions.slice(e,t).map((r,n)=>this.renderOption(r,this.select===n+e,n===0&&e>0,n+e===t-1&&t<this.choices.length)).join(`
|
|
93
93
|
`);this.outputText+=`
|
|
94
|
-
`+(s||me.gray(this.fallback.title))}this.out.write(
|
|
94
|
+
`+(s||me.gray(this.fallback.title))}this.out.write(Xl.line+xn.to(0)+this.outputText)}};Mn.exports=qn});var In=u((Ca,Dn)=>{"use strict";var Y=m(),{cursor:su}=b(),ru=dt(),{clear:Tn,style:$n,figures:X}=O(),Cn=class extends ru{constructor(e={}){e.overrideRender=!0,super(e),this.inputValue="",this.clear=Tn("",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(e=>e.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(){let e=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(s=>this.inputValue?!!(typeof s.title=="string"&&s.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof s.value=="string"&&s.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);let t=this.filteredOptions.findIndex(s=>s===e);this.cursor=t<0?0:t,this.render()}handleSpaceToggle(){let e=this.filteredOptions[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}handleInputChange(e){this.inputValue=this.inputValue+e,this.updateFilteredOptions()}_(e,t){e===" "?this.handleSpaceToggle():this.handleInputChange(e)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
95
95
|
Instructions:
|
|
96
96
|
${X.arrowUp}/${X.arrowDown}: Highlight option
|
|
97
97
|
${X.arrowLeft}/${X.arrowRight}/[space]: Toggle selection
|
|
@@ -99,9 +99,9 @@ Instructions:
|
|
|
99
99
|
enter/return: Complete answer
|
|
100
100
|
`:""}renderCurrentInput(){return`
|
|
101
101
|
Filtered results for: ${this.inputValue?this.inputValue:Y.gray("Enter something to filter")}
|
|
102
|
-
`}renderOption(e,t,s){let r;return t.disabled?r=e===s?Y.gray().underline(t.title):Y.strikethrough().gray(t.title):r=e===s?Y.cyan().underline(t.title):t.title,(t.selected?Y.green(X.radioOn):X.radioOff)+" "+r}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[Y.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&e.push(Y.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(
|
|
102
|
+
`}renderOption(e,t,s){let r;return t.disabled?r=e===s?Y.gray().underline(t.title):Y.strikethrough().gray(t.title):r=e===s?Y.cyan().underline(t.title):t.title,(t.selected?Y.green(X.radioOn):X.radioOff)+" "+r}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[Y.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&e.push(Y.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(su.hide),super.render();let e=[$n.symbol(this.done,this.aborted),Y.bold(this.msg),$n.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=Y.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+e),this.clear=Tn(e,this.out.columns)}};Dn.exports=Cn});var Rn=u((Da,An)=>{var _n=m(),nu=R(),{style:kn,clear:ou}=O(),{erase:hu,cursor:jn}=b(),En=class extends nu{constructor(e={}){super(e);this.msg=e.message,this.value=e.initial,this.initialValue=!!e.initial,this.yesMsg=e.yes||"yes",this.yesOption=e.yesOption||"(Y/n)",this.noMsg=e.no||"no",this.noOption=e.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(`
|
|
103
103
|
`),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
104
|
-
`),this.close()}_(e,t){return e.toLowerCase()==="y"?(this.value=!0,this.submit()):e.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(
|
|
105
|
-
\u274C ${
|
|
104
|
+
`),this.close()}_(e,t){return e.toLowerCase()==="y"?(this.value=!0,this.submit()):e.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(jn.hide):this.out.write(ou(this.outputText,this.out.columns)),super.render(),this.outputText=[kn.symbol(this.done,this.aborted),_n.bold(this.msg),kn.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:_n.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(hu.line+jn.to(0)+this.outputText))}};An.exports=En});var Yn=u((Ia,Fn)=>{"use strict";Fn.exports={TextPrompt:yr(),SelectPrompt:qr(),TogglePrompt:Cr(),DatePrompt:cn(),NumberPrompt:gn(),MultiselectPrompt:dt(),AutocompletePrompt:Pn(),AutocompleteMultiselectPrompt:In(),ConfirmPrompt:Rn()}});var Nn=u(Hn=>{"use strict";var x=Hn,lu=Yn(),He=i=>i;function I(i,e,t={}){return new Promise((s,r)=>{let n=new lu[i](e),o=t.onAbort||He,h=t.onSubmit||He,l=t.onExit||He;n.on("state",e.onState||He),n.on("submit",a=>s(h(a))),n.on("exit",a=>s(l(a))),n.on("abort",a=>r(o(a)))})}x.text=i=>I("TextPrompt",i);x.password=i=>(i.style="password",x.text(i));x.invisible=i=>(i.style="invisible",x.text(i));x.number=i=>I("NumberPrompt",i);x.date=i=>I("DatePrompt",i);x.confirm=i=>I("ConfirmPrompt",i);x.list=i=>{let e=i.separator||",";return I("TextPrompt",i,{onSubmit:t=>t.split(e).map(s=>s.trim())})};x.toggle=i=>I("TogglePrompt",i);x.select=i=>I("SelectPrompt",i);x.multiselect=i=>{i.choices=[].concat(i.choices||[]);let e=t=>t.filter(s=>s.selected).map(s=>s.value);return I("MultiselectPrompt",i,{onAbort:e,onSubmit:e})};x.autocompleteMultiselect=i=>{i.choices=[].concat(i.choices||[]);let e=t=>t.filter(s=>s.selected).map(s=>s.value);return I("AutocompleteMultiselectPrompt",i,{onAbort:e,onSubmit:e})};var uu=(i,e)=>Promise.resolve(e.filter(t=>t.title.slice(0,i.length).toLowerCase()===i.toLowerCase()));x.autocomplete=i=>(i.suggest=i.suggest||uu,i.choices=[].concat(i.choices||[]),I("AutocompletePrompt",i))});var Jn=u((ka,Vn)=>{"use strict";var mt=Nn(),au=["suggest","format","onState","validate","onRender","type"],Ln=()=>{};async function G(i=[],{onSubmit:e=Ln,onCancel:t=Ln}={}){let s={},r=G._override||{};i=[].concat(i);let n,o,h,l,a,Q,ee=async(v,q,ge=!1)=>{if(!(!ge&&v.validate&&v.validate(q)!==!0))return v.format?await v.format(q,s):q};for(o of i)if({name:l,type:a}=o,typeof a=="function"&&(a=await a(n,Ne({},s),o),o.type=a),!!a){for(let v in o){if(au.includes(v))continue;let q=o[v];o[v]=typeof q=="function"?await q(n,Ne({},s),Q):q}if(Q=o,typeof o.message!="string")throw new Error("prompt message is required");if({name:l,type:a}=o,mt[a]===void 0)throw new Error(`prompt type (${a}) is not defined`);if(r[o.name]!==void 0&&(n=await ee(o,r[o.name]),n!==void 0)){s[l]=n;continue}try{n=G._injected?cu(G._injected,o.initial):await mt[a](o),s[l]=n=await ee(o,n,!0),h=await e(o,n,s)}catch(v){h=!await t(o,s)}if(h)return s}return s}function cu(i,e){let t=i.shift();if(t instanceof Error)throw t;return t===void 0?e:t}function du(i){G._injected=(G._injected||[]).concat(i)}function fu(i){G._override=Object.assign({},i)}Vn.exports=Object.assign(G,{prompt:G,prompts:mt,inject:du,override:fu})});var Un=u((ja,Gn)=>{function pu(i){i=(Array.isArray(i)?i:i.split(".")).map(Number);let e=0,t=process.versions.node.split(".").map(Number);for(;e<i.length;e++){if(t[e]>i[e])return!1;if(i[e]>t[e])return!0}return!1}Gn.exports=pu("8.6.0")?Ks():Jn()});var Xn=N(require("path"));var It=N(require("fs"));"use strict";var Le,Ot,qt,Mt,Pt=!0;typeof process!="undefined"&&({FORCE_COLOR:Le,NODE_DISABLE_COLORS:Ot,NO_COLOR:qt,TERM:Mt}=process.env,Pt=process.stdout&&process.stdout.isTTY);var c={enabled:!Ot&&qt==null&&Mt!=="dumb"&&(Le!=null&&Le!=="0"||Pt),reset:f(0,0),bold:f(1,22),dim:f(2,22),italic:f(3,23),underline:f(4,24),inverse:f(7,27),hidden:f(8,28),strikethrough:f(9,29),black:f(30,39),red:f(31,39),green:f(32,39),yellow:f(33,39),blue:f(34,39),magenta:f(35,39),cyan:f(36,39),white:f(37,39),gray:f(90,39),grey:f(90,39),bgBlack:f(40,49),bgRed:f(41,49),bgGreen:f(42,49),bgYellow:f(43,49),bgBlue:f(44,49),bgMagenta:f(45,49),bgCyan:f(46,49),bgWhite:f(47,49)};function Tt(i,e){let t=0,s,r="",n="";for(;t<i.length;t++)s=i[t],r+=s.open,n+=s.close,~e.indexOf(s.close)&&(e=e.replace(s.rgx,s.close+s.open));return r+e+n}function ho(i,e){let t={has:i,keys:e};return t.reset=c.reset.bind(t),t.bold=c.bold.bind(t),t.dim=c.dim.bind(t),t.italic=c.italic.bind(t),t.underline=c.underline.bind(t),t.inverse=c.inverse.bind(t),t.hidden=c.hidden.bind(t),t.strikethrough=c.strikethrough.bind(t),t.black=c.black.bind(t),t.red=c.red.bind(t),t.green=c.green.bind(t),t.yellow=c.yellow.bind(t),t.blue=c.blue.bind(t),t.magenta=c.magenta.bind(t),t.cyan=c.cyan.bind(t),t.white=c.white.bind(t),t.gray=c.gray.bind(t),t.grey=c.grey.bind(t),t.bgBlack=c.bgBlack.bind(t),t.bgRed=c.bgRed.bind(t),t.bgGreen=c.bgGreen.bind(t),t.bgYellow=c.bgYellow.bind(t),t.bgBlue=c.bgBlue.bind(t),t.bgMagenta=c.bgMagenta.bind(t),t.bgCyan=c.bgCyan.bind(t),t.bgWhite=c.bgWhite.bind(t),t}function f(i,e){let t={open:`[${i}m`,close:`[${e}m`,rgx:new RegExp(`\\x1b\\[${e}m`,"g")};return function(s){return this!==void 0&&this.has!==void 0?(!!~this.has.indexOf(i)||(this.has.push(i),this.keys.push(t)),s===void 0?this:c.enabled?Tt(this.keys,s+""):s+""):s===void 0?ho([i],[t]):c.enabled?Tt([t],s+""):s+""}}var M=c;var _t=N(require("path"));var y=N(require("fs"));var U=N(require("path"));function te(i){console.error(`
|
|
105
|
+
\u274C ${M.red(i)}
|
|
106
106
|
`),process.exit(1)}function ye(i){(0,y.existsSync)(i)&&te(`Directory "${i}" already exists. Please either remove this directory, or choose another location.`)}function we(i){return i.toLocaleLowerCase().replace(/ /g,"-")}function xe(i){return(0,U.resolve)(process.cwd(),i)}function Se(i,e){let t=(0,y.readdirSync)(i);for(let s of t){let r=(0,U.join)(i,s),n=(0,U.join)(e,s),o=(0,y.statSync)(r);o.isDirectory()?((0,y.mkdirSync)(n),Se(r,n)):o.isFile()&&(0,y.copyFileSync)(r,n)}}function ie(i){let e=(0,U.join)(i,"package.json");return JSON.parse((0,y.readFileSync)(e,"utf-8"))}function $t(i,e){let t=(0,U.join)(i,"package.json");(0,y.writeFileSync)(t,JSON.stringify(e,null,2)+`
|
|
107
|
-
`)}function Ct(i){return i.toLocaleLowerCase().split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function Oe(i,e,t){if(e[t]){i[t]?Object.assign(i[t],e[t]):i[t]=e[t];let s={},r=Object.keys(i[t]).sort();for(let n of r)s[n]=i[t][n];i[t]=s}}function qe(i,e){
|
|
107
|
+
`)}function Ct(i){return i.toLocaleLowerCase().split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function Oe(i,e,t){if(e[t]){i[t]?Object.assign(i[t],e[t]):i[t]=e[t];let s={},r=Object.keys(i[t]).sort();for(let n of r)s[n]=i[t][n];i[t]=s}}function Dt(){return lo()}function lo(){try{return process.cwd().startsWith("/home/projects/")}catch(i){}return!1}function qe(i,e){kt(e.projectName)||te("Missing project name"),kt(e.appId)||te("Missing starter id");let t=we(e.projectName),s;Dt()?s=process.cwd():(s=xe(t),ye(s),(0,It.mkdirSync)(s,{recursive:!0}));let r=i.apps.find(o=>o.id===e.appId),n=i.servers.find(o=>o.id===e.serverId);r?uo(s,r,n):te(`Invalid starter id "${e.appId}".`)}function uo(i,e,t){Se(e.dir,i);let s=ie(e.dir);if(t){s.name+="-"+t.id,Se(t.dir,i);let o=ie(t.dir);Oe(s,o,"scripts"),Oe(s,o,"dependencies"),Oe(s,o,"devDependencies")}$t(i,s);let r=process.cwd()===i,n=(0,_t.relative)(process.cwd(),i);console.log(""),console.log(r?`\u2B50\uFE0F ${M.green("Success!")}`:`\u2B50\uFE0F ${M.green("Success! Project saved in")} ${M.yellow(n)} ${M.green("directory")}`),console.log(""),console.log(`\u{1F4DF} ${M.cyan("Next steps:")}`),r||console.log(` cd ${n}`),console.log(" npm install"),console.log(" npm start"),console.log("")}function kt(i){return typeof i=="string"&&i.trim().length>0}var Bn=N(Un());async function zn(i){console.clear(),console.log(`\u{1F4AB} ${M.cyan("Let's create a Qwik project")} \u{1F4AB}`),console.log("");let e=await(0,Bn.default)([{type:"text",name:"projectName",message:"Project name",initial:"qwik-app",validate:s=>{let r=we(s),n=xe(r);return ye(n),!0}},{type:"select",name:"appId",message:"Select a starter",choices:i.apps.map(s=>({title:s.name,value:s.id,description:s.description}))},{type:"select",name:"serverId",message:"Select a server",choices:[...i.servers.map(s=>({title:s.name,value:s.id,description:s.description})),{title:"Setup later",value:"no-hosting",description:"I'll setup my own hosting"}]}]),t={projectName:e.projectName,appId:e.appId,serverId:e.serverId};qe(i,t)}var Wn=N(require("fs")),gt=N(require("path"));function Zn(i){return{apps:Kn(i,"apps"),servers:Kn(i,"servers")}}function Kn(i,e){let t=(0,gt.join)(i,e);return(0,Wn.readdirSync)(t).map(r=>{let n=(0,gt.join)(t,r),o=ie(n);return{id:r,name:Ct(r),description:o.description,dir:n}}).sort((r,n)=>r.name<n.name?-1:r.name>n.name?1:0)}var bt=process.argv.slice(2),Qn=Zn((0,Xn.join)(__dirname,"starters"));if(bt.length>=2){let i={appId:bt[0],projectName:bt[1],serverId:"express"};qe(Qn,i)}else zn(Qn);
|
package/package.json
CHANGED
|
@@ -5,16 +5,18 @@
|
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "npm run clean && rollup -c",
|
|
7
7
|
"clean": "rimraf */build/",
|
|
8
|
-
"start": "npm run clean && concurrently -c blue,green \"rollup -c --configDev --watch\" \"wait-on public/build && npm run serve\""
|
|
8
|
+
"start": "npm run clean && concurrently -c blue,green \"rollup -c --configDev --watch\" \"wait-on public/build && npm run serve\"",
|
|
9
|
+
"serve": "echo \"server not setup\""
|
|
9
10
|
},
|
|
10
11
|
"devDependencies": {
|
|
11
|
-
"@builder.io/qwik": "~0.0.
|
|
12
|
+
"@builder.io/qwik": "~0.0.15",
|
|
12
13
|
"@rollup/plugin-node-resolve": "^13.0.6",
|
|
13
14
|
"@rollup/plugin-typescript": "^8.3.0",
|
|
14
15
|
"concurrently": "^6.4.0",
|
|
15
16
|
"rimraf": "^3.0.2",
|
|
16
17
|
"rollup": "^2.59.0",
|
|
17
|
-
"typescript": "^4.5.2"
|
|
18
|
+
"typescript": "^4.5.2",
|
|
19
|
+
"wait-on": "^6.0.0"
|
|
18
20
|
},
|
|
19
21
|
"author": "Builder.io Team",
|
|
20
22
|
"license": "MIT",
|
|
@@ -5,16 +5,18 @@
|
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "npm run clean && rollup -c",
|
|
7
7
|
"clean": "rimraf */build/",
|
|
8
|
-
"start": "npm run clean && concurrently -c blue,green \"rollup -c --configDev --watch\" \"wait-on public/build && npm run serve\""
|
|
8
|
+
"start": "npm run clean && concurrently -c blue,green \"rollup -c --configDev --watch\" \"wait-on public/build && npm run serve\"",
|
|
9
|
+
"serve": "echo \"server not setup\""
|
|
9
10
|
},
|
|
10
11
|
"devDependencies": {
|
|
11
|
-
"@builder.io/qwik": "~0.0.
|
|
12
|
+
"@builder.io/qwik": "~0.0.15",
|
|
12
13
|
"@rollup/plugin-node-resolve": "^13.0.6",
|
|
13
14
|
"@rollup/plugin-typescript": "^8.3.0",
|
|
14
15
|
"concurrently": "^6.4.0",
|
|
15
16
|
"rimraf": "^3.0.2",
|
|
16
17
|
"rollup": "^2.59.0",
|
|
17
|
-
"typescript": "^4.5.2"
|
|
18
|
+
"typescript": "^4.5.2",
|
|
19
|
+
"wait-on": "^6.0.0"
|
|
18
20
|
},
|
|
19
21
|
"author": "Builder.io Team",
|
|
20
22
|
"license": "MIT",
|
|
@@ -5,16 +5,18 @@
|
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "npm run clean && rollup -c",
|
|
7
7
|
"clean": "rimraf */build/",
|
|
8
|
-
"start": "npm run clean && concurrently -c blue,green \"rollup -c --configDev --watch\" \"wait-on public/build && npm run serve\""
|
|
8
|
+
"start": "npm run clean && concurrently -c blue,green \"rollup -c --configDev --watch\" \"wait-on public/build && npm run serve\"",
|
|
9
|
+
"serve": "echo \"server not setup\""
|
|
9
10
|
},
|
|
10
11
|
"devDependencies": {
|
|
11
|
-
"@builder.io/qwik": "~0.0.
|
|
12
|
+
"@builder.io/qwik": "~0.0.15",
|
|
12
13
|
"@rollup/plugin-node-resolve": "^13.0.6",
|
|
13
14
|
"@rollup/plugin-typescript": "^8.3.0",
|
|
14
15
|
"concurrently": "^6.4.0",
|
|
15
16
|
"rimraf": "^3.0.2",
|
|
16
17
|
"rollup": "^2.59.0",
|
|
17
|
-
"typescript": "^4.5.2"
|
|
18
|
+
"typescript": "^4.5.2",
|
|
19
|
+
"wait-on": "^6.0.0"
|
|
18
20
|
},
|
|
19
21
|
"author": "Builder.io Team",
|
|
20
22
|
"license": "MIT",
|
|
@@ -5,16 +5,18 @@
|
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "npm run clean && rollup -c",
|
|
7
7
|
"clean": "rimraf */build/",
|
|
8
|
-
"start": "npm run clean && concurrently -c blue,green \"rollup -c --configDev --watch\" \"wait-on public/build && npm run serve\""
|
|
8
|
+
"start": "npm run clean && concurrently -c blue,green \"rollup -c --configDev --watch\" \"wait-on public/build && npm run serve\"",
|
|
9
|
+
"serve": "echo \"server not setup\""
|
|
9
10
|
},
|
|
10
11
|
"devDependencies": {
|
|
11
|
-
"@builder.io/qwik": "~0.0.
|
|
12
|
+
"@builder.io/qwik": "~0.0.15",
|
|
12
13
|
"@rollup/plugin-node-resolve": "^13.0.6",
|
|
13
14
|
"@rollup/plugin-typescript": "^8.3.0",
|
|
14
15
|
"concurrently": "^6.4.0",
|
|
15
16
|
"rimraf": "^3.0.2",
|
|
16
17
|
"rollup": "^2.59.0",
|
|
17
|
-
"typescript": "^4.5.2"
|
|
18
|
+
"typescript": "^4.5.2",
|
|
19
|
+
"wait-on": "^6.0.0"
|
|
18
20
|
},
|
|
19
21
|
"author": "Builder.io Team",
|
|
20
22
|
"license": "MIT",
|