create-ts-vite-project 0.2.4 → 0.2.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/.gitignore +1 -0
- package/README.md +13 -0
- package/dist/index.min.js +97 -2
- package/package.json +3 -1
- package/template/package.json +1 -1
package/.gitignore
CHANGED
package/README.md
CHANGED
|
@@ -344,6 +344,17 @@ https://v2.tauri.app/start/prerequisites/
|
|
|
344
344
|
yarn tauri:init
|
|
345
345
|
```
|
|
346
346
|
|
|
347
|
+
По-умолчанию **Tauri** будет распакован в каталог **src-tauri**.
|
|
348
|
+
|
|
349
|
+
Секция **build** должна иметь такие параметры:
|
|
350
|
+
|
|
351
|
+
```
|
|
352
|
+
"frontendDist": "../dist",
|
|
353
|
+
"devUrl": "http://localhost:8080",
|
|
354
|
+
"beforeDevCommand": "yarn dev",
|
|
355
|
+
"beforeBuildCommand": "yarn build"
|
|
356
|
+
```
|
|
357
|
+
|
|
347
358
|
Запуск в режиме разработки:
|
|
348
359
|
|
|
349
360
|
```
|
|
@@ -356,6 +367,8 @@ yarn tauri:dev
|
|
|
356
367
|
yarn tauri:build
|
|
357
368
|
```
|
|
358
369
|
|
|
370
|
+
> Если после сборки у вас запускается приложение с пустым экраном, попробуйте обновить компонент **WebView** вашей ОС.
|
|
371
|
+
|
|
359
372
|
# Тестирование
|
|
360
373
|
|
|
361
374
|
Тестируем с помощью **Vitest**.
|
package/dist/index.min.js
CHANGED
|
@@ -1,2 +1,97 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
|
|
1
|
+
"use strict";var Jn=Object.create;var Zt=Object.defineProperty;var Gn=Object.getOwnPropertyDescriptor;var Bn=Object.getOwnPropertyNames;var zn=Object.getPrototypeOf,Zn=Object.prototype.hasOwnProperty;var u=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var Wn=(i,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Bn(e))!Zn.call(i,r)&&r!==t&&Zt(i,r,{get:()=>e[r],enumerable:!(s=Gn(e,r))||s.enumerable});return i};var $=(i,e,t)=>(t=i!=null?Jn(zn(i)):{},Wn(e||!i||!i.__esModule?Zt(t,"default",{value:i,enumerable:!0}):t,i));var f=u((ou,ti)=>{"use strict";var{FORCE_COLOR:Kn,NODE_DISABLE_COLORS:Xn,TERM:Qn}=process.env,c={enabled:!Xn&&Qn!=="dumb"&&Kn!=="0",reset:d(0,0),bold:d(1,22),dim:d(2,22),italic:d(3,23),underline:d(4,24),inverse:d(7,27),hidden:d(8,28),strikethrough:d(9,29),black:d(30,39),red:d(31,39),green:d(32,39),yellow:d(33,39),blue:d(34,39),magenta:d(35,39),cyan:d(36,39),white:d(37,39),gray:d(90,39),grey:d(90,39),bgBlack:d(40,49),bgRed:d(41,49),bgGreen:d(42,49),bgYellow:d(43,49),bgBlue:d(44,49),bgMagenta:d(45,49),bgCyan:d(46,49),bgWhite:d(47,49)};function ei(i,e){let t=0,s,r="",o="";for(;t<i.length;t++)s=i[t],r+=s.open,o+=s.close,e.includes(s.close)&&(e=e.replace(s.rgx,s.close+s.open));return r+e+o}function eo(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 d(i,e){let t={open:`\x1B[${i}m`,close:`\x1B[${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:c.enabled?ei(this.keys,s+""):s+""):s===void 0?eo([i],[t]):c.enabled?ei([t],s+""):s+""}}ti.exports=c});var si=u((hu,ii)=>{"use strict";ii.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((lu,ri)=>{"use strict";ri.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 p=u((uu,ni)=>{"use strict";var ke={to(i,e){return e?`\x1B[${e+1};${i+1}H`:`\x1B[${i+1}G`},move(i,e){let t="";return i<0?t+=`\x1B[${-i}D`:i>0&&(t+=`\x1B[${i}C`),e<0?t+=`\x1B[${-e}A`:e>0&&(t+=`\x1B[${e}B`),t},up:(i=1)=>`\x1B[${i}A`,down:(i=1)=>`\x1B[${i}B`,forward:(i=1)=>`\x1B[${i}C`,backward:(i=1)=>`\x1B[${i}D`,nextLine:(i=1)=>"\x1B[E".repeat(i),prevLine:(i=1)=>"\x1B[F".repeat(i),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},to={up:(i=1)=>"\x1B[S".repeat(i),down:(i=1)=>"\x1B[T".repeat(i)},io={screen:"\x1B[2J",up:(i=1)=>"\x1B[1J".repeat(i),down:(i=1)=>"\x1B[J".repeat(i),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(i){let e="";for(let t=0;t<i;t++)e+=this.line+(t<i-1?ke.up():"");return i&&(e+=ke.left),e}};ni.exports={cursor:ke,scroll:to,erase:io,beep:"\x07"}});var ai=u((au,ui)=>{"use strict";function so(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=ro(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.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,n=!1,h;return{s:function(){t=t.call(i)},n:function(){var a=t.next();return o=a.done,a},e:function(a){n=!0,h=a},f:function(){try{!o&&t.return!=null&&t.return()}finally{if(n)throw h}}}}function ro(i,e){if(i){if(typeof i=="string")return oi(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 oi(i,e)}}function oi(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 no=me(),li=p(),hi=li.erase,oo=li.cursor,ho=i=>[...no(i)].length;ui.exports=function(i,e){if(!e)return hi.line+oo.to(0);let t=0,s=i.split(/\r?\n/);var r=so(s),o;try{for(r.s();!(o=r.n()).done;){let n=o.value;t+=1+Math.floor(Math.max(ho(n)-1,0)/e)}}catch(n){r.e(n)}finally{r.f()}return hi.lines(t)}});var Ee=u((cu,ci)=>{"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"},lo={arrowUp:se.arrowUp,arrowDown:se.arrowDown,arrowLeft:se.arrowLeft,arrowRight:se.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},uo=process.platform==="win32"?lo:se;ci.exports=uo});var fi=u((du,di)=>{"use strict";var K=f(),G=Ee(),Ae=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}`}}),ao=i=>Ae[i]||Ae.default,re=Object.freeze({aborted:K.red(G.cross),done:K.green(G.tick),exited:K.yellow(G.cross),default:K.cyan("?")}),co=(i,e,t)=>e?re.aborted:t?re.exited:i?re.done:re.default,fo=i=>K.gray(i?G.ellipsis:G.pointerSmall),po=(i,e)=>K.gray(i?e?G.pointerSmall:"+":G.line);di.exports={styles:Ae,render:ao,symbols:re,symbol:co,delimiter:fo,item:po}});var mi=u((fu,pi)=>{"use strict";var mo=me();pi.exports=function(i,e){let t=String(mo(i)||"").split(/\r?\n/);return e?t.map(s=>Math.ceil(s.length/e)).reduce((s,r)=>s+r):t.length}});var vi=u((pu,gi)=>{"use strict";gi.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((o,n)=>(n.length+t.length>=s||o[o.length-1].length+n.length+1<s?o[o.length-1]+=` ${n}`:o.push(`${t}${n}`),o),[t]).join(`
|
|
3
|
+
`)).join(`
|
|
4
|
+
`)}});var yi=u((mu,bi)=>{"use strict";bi.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 w=u((gu,wi)=>{"use strict";wi.exports={action:si(),clear:ai(),style:fi(),strip:me(),figures:Ee(),lines:mi(),wrap:vi(),entriesToDisplay:yi()}});var C=u((vu,qi)=>{"use strict";var xi=require("readline"),go=w(),vo=go.action,bo=require("events"),Si=p(),yo=Si.beep,wo=Si.cursor,xo=f(),Re=class extends bo{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=xi.createInterface({input:this.in,escapeCodeTimeout:50});xi.emitKeypressEvents(this.in,t),this.in.isTTY&&this.in.setRawMode(!0);let s=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,r=(o,n)=>{let h=vo(n,s);h===!1?this._&&this._(o,n):typeof this[h]=="function"?this[h](n):this.bell()};this.close=()=>{this.out.write(wo.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(yo)}render(){this.onRender(xo),this.firstRender&&(this.firstRender=!1)}};qi.exports=Re});var Ti=u((bu,Ii)=>{"use strict";function Oi(i,e,t,s,r,o,n){try{var h=i[o](n),l=h.value}catch(a){t(a);return}h.done?e(l):Promise.resolve(l).then(s,r)}function Mi(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var o=i.apply(e,t);function n(l){Oi(o,s,r,n,h,"next",l)}function h(l){Oi(o,s,r,n,h,"throw",l)}n(void 0)})}}var ge=f(),So=C(),Pi=p(),qo=Pi.erase,ne=Pi.cursor,ve=w(),Fe=ve.style,Ve=ve.clear,Oo=ve.lines,Mo=ve.figures,He=class extends So{constructor(e={}){super(e),this.transform=Fe.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=+!!this.initial,this.cursorOffset=0,this.clear=Ve("",this.out.columns),this.render()}set value(e){!e&&this.initial?(this.placeholder=!0,this.rendered=ge.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=+!!this.initial,this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
|
|
5
|
+
`),this.close()}validate(){var e=this;return Mi(function*(){let t=yield e.validator(e.value);typeof t=="string"&&(e.errorMsg=t,t=!1),e.error=!t})()}submit(){var e=this;return Mi(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(`
|
|
6
|
+
`),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(Oo(this.outputError,this.out.columns)-1)+Ve(this.outputError,this.out.columns)),this.out.write(Ve(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[Fe.symbol(this.done,this.aborted),ge.bold(this.msg),Fe.delimiter(this.done),this.red?ge.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
7
|
+
`).reduce((e,t,s)=>e+`
|
|
8
|
+
${s?" ":Mo.pointerSmall} ${ge.red().italic(t)}`,"")),this.out.write(qo.line+ne.to(0)+this.outputText+ne.save+this.outputError+ne.restore+ne.move(this.cursorOffset,0)))}};Ii.exports=He});var Di=u((yu,_i)=>{"use strict";var _=f(),Po=C(),oe=w(),$i=oe.style,Ci=oe.clear,be=oe.figures,Io=oe.wrap,To=oe.entriesToDisplay,$o=p(),Co=$o.cursor,Ye=class extends Po{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=Ci("",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(`
|
|
9
|
+
`),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
10
|
+
`),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(e,t){if(e===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(Co.hide):this.out.write(Ci(this.outputText,this.out.columns)),super.render();let e=To(this.cursor,this.choices.length,this.optionsPerPage),t=e.startIndex,s=e.endIndex;if(this.outputText=[$i.symbol(this.done,this.aborted),_.bold(this.msg),$i.delimiter(!1),this.done?this.selection.title:this.selection.disabled?_.yellow(this.warn):_.gray(this.hint)].join(" "),!this.done){this.outputText+=`
|
|
11
|
+
`;for(let r=t;r<s;r++){let o,n,h="",l=this.choices[r];r===t&&t>0?n=be.arrowUp:r===s-1&&s<this.choices.length?n=be.arrowDown:n=" ",l.disabled?(o=this.cursor===r?_.gray().underline(l.title):_.strikethrough().gray(l.title),n=(this.cursor===r?_.bold().gray(be.pointer)+" ":" ")+n):(o=this.cursor===r?_.cyan().underline(l.title):l.title,n=(this.cursor===r?_.cyan(be.pointer)+" ":" ")+n,l.description&&this.cursor===r&&(h=` - ${l.description}`,(n.length+o.length+h.length>=this.out.columns||l.description.split(/\r?\n/).length>1)&&(h=`
|
|
12
|
+
`+Io(l.description,{margin:3,width:this.out.columns})))),this.outputText+=`${n} ${o}${_.gray(h)}
|
|
13
|
+
`}}this.out.write(this.outputText)}};_i.exports=Ye});var Fi=u((wu,Ri)=>{"use strict";var ye=f(),_o=C(),Ei=w(),ji=Ei.style,Do=Ei.clear,Ai=p(),ki=Ai.cursor,jo=Ai.erase,Le=class extends _o{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(`
|
|
14
|
+
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
15
|
+
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(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(ki.hide):this.out.write(Do(this.outputText,this.out.columns)),super.render(),this.outputText=[ji.symbol(this.done,this.aborted),ye.bold(this.msg),ji.delimiter(this.done),this.value?this.inactive:ye.cyan().underline(this.inactive),ye.gray("/"),this.value?ye.cyan().underline(this.active):this.active].join(" "),this.out.write(jo.line+ki.to(0)+this.outputText))}};Ri.exports=Le});var S=u((xu,Vi)=>{"use strict";var Ne=class i{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 i)}setTo(e){}prev(){let e=[].concat(this.parts).reverse(),t=e.indexOf(this);return e.find((s,r)=>r>t&&s instanceof i)}toString(){return String(this.date)}};Vi.exports=Ne});var Yi=u((Su,Hi)=>{"use strict";var ko=S(),Ue=class extends ko{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}};Hi.exports=Ue});var Ni=u((qu,Li)=>{"use strict";var Eo=S(),Ao=i=>(i=i%10,i===1?"st":i===2?"nd":i===3?"rd":"th"),Je=class extends Eo{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+Ao(e):this.token==="d"?t+1:this.token==="ddd"?this.locales.weekdaysShort[t]:this.token==="dddd"?this.locales.weekdays[t]:e}};Li.exports=Je});var Ji=u((Ou,Ui)=>{"use strict";var Ro=S(),Ge=class extends Ro{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}};Ui.exports=Ge});var Bi=u((Mu,Gi)=>{"use strict";var Fo=S(),Be=class extends Fo{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)}};Gi.exports=Be});var Zi=u((Pu,zi)=>{"use strict";var Vo=S(),ze=class extends Vo{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}};zi.exports=ze});var Ki=u((Iu,Wi)=>{"use strict";var Ho=S(),Ze=class extends Ho{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)}};Wi.exports=Ze});var Qi=u((Tu,Xi)=>{"use strict";var Yo=S(),We=class extends Yo{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}};Xi.exports=We});var ts=u(($u,es)=>{"use strict";var Lo=S(),Ke=class extends Lo{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}};es.exports=Ke});var ss=u((Cu,is)=>{"use strict";is.exports={DatePart:S(),Meridiem:Yi(),Day:Ni(),Hours:Ji(),Milliseconds:Bi(),Minutes:Zi(),Month:Ki(),Seconds:Qi(),Year:ts()}});var fs=u((_u,ds)=>{"use strict";function rs(i,e,t,s,r,o,n){try{var h=i[o](n),l=h.value}catch(a){t(a);return}h.done?e(l):Promise.resolve(l).then(s,r)}function ns(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var o=i.apply(e,t);function n(l){rs(o,s,r,n,h,"next",l)}function h(l){rs(o,s,r,n,h,"throw",l)}n(void 0)})}}var Xe=f(),No=C(),et=w(),os=et.style,hs=et.clear,Uo=et.figures,cs=p(),Jo=cs.erase,ls=cs.cursor,D=ss(),us=D.DatePart,Go=D.Meridiem,Bo=D.Day,zo=D.Hours,Zo=D.Milliseconds,Wo=D.Minutes,Ko=D.Month,Xo=D.Seconds,Qo=D.Year,eh=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,as={1:({token:i})=>i.replace(/\\(.)/g,"$1"),2:i=>new Bo(i),3:i=>new Ko(i),4:i=>new Qo(i),5:i=>new Go(i),6:i=>new zo(i),7:i=>new Wo(i),8:i=>new Xo(i),9:i=>new Zo(i)},th={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(",")},Qe=class extends No{constructor(e={}){super(e),this.msg=e.message,this.cursor=0,this.typed="",this.locales=Object.assign(th,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=hs("",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=eh.exec(e);){let r=t.shift(),o=t.findIndex(n=>n!=null);this.parts.push(o in as?as[o]({token:t[o]||r,date:this.date,parts:this.parts,locales:this.locales}):t[o]||r)}let s=this.parts.reduce((r,o)=>(typeof o=="string"&&typeof r[r.length-1]=="string"?r[r.length-1]+=o:r.push(o),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 us)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
16
|
+
`),this.close()}validate(){var e=this;return ns(function*(){let t=yield e.validator(e.value);typeof t=="string"&&(e.errorMsg=t,t=!1),e.error=!t})()}submit(){var e=this;return ns(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(`
|
|
17
|
+
`),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 us)),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(ls.hide):this.out.write(hs(this.outputText,this.out.columns)),super.render(),this.outputText=[os.symbol(this.done,this.aborted),Xe.bold(this.msg),os.delimiter(!1),this.parts.reduce((e,t,s)=>e.concat(s===this.cursor&&!this.done?Xe.cyan().underline(t.toString()):t),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
|
|
18
|
+
`).reduce((e,t,s)=>e+`
|
|
19
|
+
${s?" ":Uo.pointerSmall} ${Xe.red().italic(t)}`,"")),this.out.write(Jo.line+ls.to(0)+this.outputText))}};ds.exports=Qe});var ws=u((Du,ys)=>{"use strict";function ps(i,e,t,s,r,o,n){try{var h=i[o](n),l=h.value}catch(a){t(a);return}h.done?e(l):Promise.resolve(l).then(s,r)}function ms(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var o=i.apply(e,t);function n(l){ps(o,s,r,n,h,"next",l)}function h(l){ps(o,s,r,n,h,"throw",l)}n(void 0)})}}var we=f(),ih=C(),bs=p(),xe=bs.cursor,sh=bs.erase,Se=w(),tt=Se.style,rh=Se.figures,gs=Se.clear,nh=Se.lines,oh=/[0-9]/,it=i=>i!==void 0,vs=(i,e)=>{let t=Math.pow(10,e);return Math.round(i*t)/t},st=class extends ih{constructor(e={}){super(e),this.transform=tt.render(e.style),this.msg=e.message,this.initial=it(e.initial)?e.initial:"",this.float=!!e.float,this.round=e.round||2,this.inc=e.increment||1,this.min=it(e.min)?e.min:-1/0,this.max=it(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=we.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${vs(e,this.round)}`),this._value=vs(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||oh.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(`
|
|
20
|
+
`),this.close()}validate(){var e=this;return ms(function*(){let t=yield e.validator(e.value);typeof t=="string"&&(e.errorMsg=t,t=!1),e.error=!t})()}submit(){var e=this;return ms(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(`
|
|
21
|
+
`),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(xe.down(nh(this.outputError,this.out.columns)-1)+gs(this.outputError,this.out.columns)),this.out.write(gs(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[tt.symbol(this.done,this.aborted),we.bold(this.msg),tt.delimiter(this.done),!this.done||!this.done&&!this.placeholder?we[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
22
|
+
`).reduce((e,t,s)=>e+`
|
|
23
|
+
${s?" ":rh.pointerSmall} ${we.red().italic(t)}`,"")),this.out.write(sh.line+xe.to(0)+this.outputText+xe.save+this.outputError+xe.restore))}};ys.exports=st});var nt=u((ju,qs)=>{"use strict";var q=f(),hh=p(),lh=hh.cursor,uh=C(),he=w(),xs=he.clear,F=he.figures,Ss=he.style,ah=he.wrap,ch=he.entriesToDisplay,rt=class extends uh{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=xs("",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(`
|
|
24
|
+
`),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(`
|
|
25
|
+
`),this.close())}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render()}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(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:`
|
|
26
|
+
Instructions:
|
|
27
|
+
${F.arrowUp}/${F.arrowDown}: Highlight option
|
|
28
|
+
${F.arrowLeft}/${F.arrowRight}/[space]: Toggle selection
|
|
29
|
+
`+(this.maxChoices===void 0?` a: Toggle all
|
|
30
|
+
`:"")+" enter/return: Complete answer":""}renderOption(e,t,s,r){let o=(t.selected?q.green(F.radioOn):F.radioOff)+" "+r+" ",n,h;return t.disabled?n=e===s?q.gray().underline(t.title):q.strikethrough().gray(t.title):(n=e===s?q.cyan().underline(t.title):t.title,e===s&&t.description&&(h=` - ${t.description}`,(o.length+n.length+h.length>=this.out.columns||t.description.split(/\r?\n/).length>1)&&(h=`
|
|
31
|
+
`+ah(t.description,{margin:o.length,width:this.out.columns})))),o+n+q.gray(h||"")}paginateOptions(e){if(e.length===0)return q.red("No matches for this query.");let t=ch(this.cursor,e.length,this.optionsPerPage),s=t.startIndex,r=t.endIndex,o,n=[];for(let h=s;h<r;h++)h===s&&s>0?o=F.arrowUp:h===r-1&&r<e.length?o=F.arrowDown:o=" ",n.push(this.renderOption(this.cursor,e[h],h,o));return`
|
|
32
|
+
`+n.join(`
|
|
33
|
+
`)}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=[q.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&e.push(q.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(lh.hide),super.render();let e=[Ss.symbol(this.done,this.aborted),q.bold(this.msg),Ss.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=q.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=xs(e,this.out.columns)}};qs.exports=rt});var Cs=u((ku,$s)=>{"use strict";function Os(i,e,t,s,r,o,n){try{var h=i[o](n),l=h.value}catch(a){t(a);return}h.done?e(l):Promise.resolve(l).then(s,r)}function dh(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var o=i.apply(e,t);function n(l){Os(o,s,r,n,h,"next",l)}function h(l){Os(o,s,r,n,h,"throw",l)}n(void 0)})}}var le=f(),fh=C(),Ts=p(),ph=Ts.erase,Ms=Ts.cursor,ue=w(),ot=ue.style,Ps=ue.clear,ht=ue.figures,mh=ue.wrap,gh=ue.entriesToDisplay,Is=(i,e)=>i[e]&&(i[e].value||i[e].title||i[e]),vh=(i,e)=>i[e]&&(i[e].title||i[e].value||i[e]),bh=(i,e)=>{let t=i.findIndex(s=>s.value===e||s.title===e);return t>-1?t:void 0},lt=class extends fh{constructor(e={}){super(e),this.msg=e.message,this.suggest=e.suggest,this.choices=e.choices,this.initial=typeof e.initial=="number"?e.initial:bh(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=ot.render(e.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=Ps("",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=Is(this.suggestions,e):this.value=this.fallback.value,this.fire()}complete(e){var t=this;return dh(function*(){let s=t.completing=t.suggest(t.input,t.choices),r=yield s;if(t.completing!==s)return;t.suggestions=r.map((n,h,l)=>({title:vh(l,h),value:Is(l,h),description:n.description})),t.completing=!1;let o=Math.max(r.length-1,0);t.moveSelect(Math.min(o,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(`
|
|
34
|
+
`),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
35
|
+
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
36
|
+
`),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 o,n=s?ht.arrowUp:r?ht.arrowDown:" ",h=t?le.cyan().underline(e.title):e.title;return n=(t?le.cyan(ht.pointer)+" ":" ")+n,e.description&&(o=` - ${e.description}`,(n.length+h.length+o.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(o=`
|
|
37
|
+
`+mh(e.description,{margin:3,width:this.out.columns}))),n+" "+h+le.gray(o||"")}render(){if(this.closed)return;this.firstRender?this.out.write(Ms.hide):this.out.write(Ps(this.outputText,this.out.columns)),super.render();let e=gh(this.select,this.choices.length,this.limit),t=e.startIndex,s=e.endIndex;if(this.outputText=[ot.symbol(this.done,this.aborted,this.exited),le.bold(this.msg),ot.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((o,n)=>this.renderOption(o,this.select===n+t,n===0&&t>0,n+t===s-1&&s<this.choices.length)).join(`
|
|
38
|
+
`);this.outputText+=`
|
|
39
|
+
`+(r||le.gray(this.fallback.title))}this.out.write(ph.line+Ms.to(0)+this.outputText)}};$s.exports=lt});var ks=u((Eu,js)=>{"use strict";var j=f(),yh=p(),wh=yh.cursor,xh=nt(),at=w(),_s=at.clear,Ds=at.style,X=at.figures,ut=class extends xh{constructor(e={}){e.overrideRender=!0,super(e),this.inputValue="",this.clear=_s("",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:`
|
|
40
|
+
Instructions:
|
|
41
|
+
${X.arrowUp}/${X.arrowDown}: Highlight option
|
|
42
|
+
${X.arrowLeft}/${X.arrowRight}/[space]: Toggle selection
|
|
43
|
+
[a,b,c]/delete: Filter choices
|
|
44
|
+
enter/return: Complete answer
|
|
45
|
+
`:""}renderCurrentInput(){return`
|
|
46
|
+
Filtered results for: ${this.inputValue?this.inputValue:j.gray("Enter something to filter")}
|
|
47
|
+
`}renderOption(e,t,s){let r;return t.disabled?r=e===s?j.gray().underline(t.title):j.strikethrough().gray(t.title):r=e===s?j.cyan().underline(t.title):t.title,(t.selected?j.green(X.radioOn):X.radioOff)+" "+r}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[j.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&e.push(j.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(wh.hide),super.render();let e=[Ds.symbol(this.done,this.aborted),j.bold(this.msg),Ds.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=j.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=_s(e,this.out.columns)}};js.exports=ut});var Ys=u((Au,Hs)=>{"use strict";var Es=f(),Sh=C(),Fs=w(),As=Fs.style,qh=Fs.clear,Vs=p(),Oh=Vs.erase,Rs=Vs.cursor,ct=class extends Sh{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(`
|
|
48
|
+
`),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
49
|
+
`),this.close()}_(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(Rs.hide):this.out.write(qh(this.outputText,this.out.columns)),super.render(),this.outputText=[As.symbol(this.done,this.aborted),Es.bold(this.msg),As.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:Es.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(Oh.line+Rs.to(0)+this.outputText))}};Hs.exports=ct});var Ns=u((Ru,Ls)=>{"use strict";Ls.exports={TextPrompt:Ti(),SelectPrompt:Di(),TogglePrompt:Fi(),DatePrompt:fs(),NumberPrompt:ws(),MultiselectPrompt:nt(),AutocompletePrompt:Cs(),AutocompleteMultiselectPrompt:ks(),ConfirmPrompt:Ys()}});var Js=u(Us=>{"use strict";var v=Us,Mh=Ns(),qe=i=>i;function O(i,e,t={}){return new Promise((s,r)=>{let o=new Mh[i](e),n=t.onAbort||qe,h=t.onSubmit||qe,l=t.onExit||qe;o.on("state",e.onState||qe),o.on("submit",a=>s(h(a))),o.on("exit",a=>s(l(a))),o.on("abort",a=>r(n(a)))})}v.text=i=>O("TextPrompt",i);v.password=i=>(i.style="password",v.text(i));v.invisible=i=>(i.style="invisible",v.text(i));v.number=i=>O("NumberPrompt",i);v.date=i=>O("DatePrompt",i);v.confirm=i=>O("ConfirmPrompt",i);v.list=i=>{let e=i.separator||",";return O("TextPrompt",i,{onSubmit:t=>t.split(e).map(s=>s.trim())})};v.toggle=i=>O("TogglePrompt",i);v.select=i=>O("SelectPrompt",i);v.multiselect=i=>{i.choices=[].concat(i.choices||[]);let e=t=>t.filter(s=>s.selected).map(s=>s.value);return O("MultiselectPrompt",i,{onAbort:e,onSubmit:e})};v.autocompleteMultiselect=i=>{i.choices=[].concat(i.choices||[]);let e=t=>t.filter(s=>s.selected).map(s=>s.value);return O("AutocompleteMultiselectPrompt",i,{onAbort:e,onSubmit:e})};var Ph=(i,e)=>Promise.resolve(e.filter(t=>t.title.slice(0,i.length).toLowerCase()===i.toLowerCase()));v.autocomplete=i=>(i.suggest=i.suggest||Ph,i.choices=[].concat(i.choices||[]),O("AutocompletePrompt",i))});var Qs=u((Vu,Xs)=>{"use strict";function Gs(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 Bs(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Gs(Object(t),!0).forEach(function(s){Ih(i,s,t[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Gs(Object(t)).forEach(function(s){Object.defineProperty(i,s,Object.getOwnPropertyDescriptor(t,s))})}return i}function Ih(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Th(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=$h(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.
|
|
50
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,n=!1,h;return{s:function(){t=t.call(i)},n:function(){var a=t.next();return o=a.done,a},e:function(a){n=!0,h=a},f:function(){try{!o&&t.return!=null&&t.return()}finally{if(n)throw h}}}}function $h(i,e){if(i){if(typeof i=="string")return zs(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 zs(i,e)}}function zs(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 Zs(i,e,t,s,r,o,n){try{var h=i[o](n),l=h.value}catch(a){t(a);return}h.done?e(l):Promise.resolve(l).then(s,r)}function Ws(i){return function(){var e=this,t=arguments;return new Promise(function(s,r){var o=i.apply(e,t);function n(l){Zs(o,s,r,n,h,"next",l)}function h(l){Zs(o,s,r,n,h,"throw",l)}n(void 0)})}}var dt=Js(),Ch=["suggest","format","onState","validate","onRender","type"],Ks=()=>{};function V(){return ft.apply(this,arguments)}function ft(){return ft=Ws(function*(i=[],{onSubmit:e=Ks,onCancel:t=Ks}={}){let s={},r=V._override||{};i=[].concat(i);let o,n,h,l,a,z,Z=(function(){var y=Ws(function*(T,pe,zt=!1){if(!(!zt&&T.validate&&T.validate(pe)!==!0))return T.format?yield T.format(pe,s):pe});return function(pe,zt){return y.apply(this,arguments)}})();var m=Th(i),g;try{for(m.s();!(g=m.n()).done;){n=g.value;var N=n;if(l=N.name,a=N.type,typeof a=="function"&&(a=yield a(o,Bs({},s),n),n.type=a),!!a){for(let y in n){if(Ch.includes(y))continue;let T=n[y];n[y]=typeof T=="function"?yield T(o,Bs({},s),z):T}if(z=n,typeof n.message!="string")throw new Error("prompt message is required");var U=n;if(l=U.name,a=U.type,dt[a]===void 0)throw new Error(`prompt type (${a}) is not defined`);if(r[n.name]!==void 0&&(o=yield Z(n,r[n.name]),o!==void 0)){s[l]=o;continue}try{o=V._injected?_h(V._injected,n.initial):yield dt[a](n),s[l]=o=yield Z(n,o,!0),h=yield e(n,o,s)}catch{h=!(yield t(n,s))}if(h)return s}}}catch(y){m.e(y)}finally{m.f()}return s}),ft.apply(this,arguments)}function _h(i,e){let t=i.shift();if(t instanceof Error)throw t;return t===void 0?e:t}function Dh(i){V._injected=(V._injected||[]).concat(i)}function jh(i){V._override=Object.assign({},i)}Xs.exports=Object.assign(V,{prompt:V,prompts:dt,inject:Dh,override:jh})});var tr=u((Hu,er)=>{"use strict";er.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 Oe=u((Yu,ir)=>{"use strict";ir.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 nr=u((Lu,rr)=>{"use strict";var kh=Oe(),{erase:sr,cursor:Eh}=p(),Ah=i=>[...kh(i)].length;rr.exports=function(i,e){if(!e)return sr.line+Eh.to(0);let t=0,s=i.split(/\r?\n/);for(let r of s)t+=1+Math.floor(Math.max(Ah(r)-1,0)/e);return sr.lines(t)}});var pt=u((Nu,or)=>{"use strict";var ae={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},Rh={arrowUp:ae.arrowUp,arrowDown:ae.arrowDown,arrowLeft:ae.arrowLeft,arrowRight:ae.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},Fh=process.platform==="win32"?Rh:ae;or.exports=Fh});var lr=u((Uu,hr)=>{"use strict";var Q=f(),B=pt(),mt=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}`}}),Vh=i=>mt[i]||mt.default,ce=Object.freeze({aborted:Q.red(B.cross),done:Q.green(B.tick),exited:Q.yellow(B.cross),default:Q.cyan("?")}),Hh=(i,e,t)=>e?ce.aborted:t?ce.exited:i?ce.done:ce.default,Yh=i=>Q.gray(i?B.ellipsis:B.pointerSmall),Lh=(i,e)=>Q.gray(i?e?B.pointerSmall:"+":B.line);hr.exports={styles:mt,render:Vh,symbols:ce,symbol:Hh,delimiter:Yh,item:Lh}});var ar=u((Ju,ur)=>{"use strict";var Nh=Oe();ur.exports=function(i,e){let t=String(Nh(i)||"").split(/\r?\n/);return e?t.map(s=>Math.ceil(s.length/e)).reduce((s,r)=>s+r):t.length}});var dr=u((Gu,cr)=>{"use strict";cr.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((o,n)=>(n.length+t.length>=s||o[o.length-1].length+n.length+1<s?o[o.length-1]+=` ${n}`:o.push(`${t}${n}`),o),[t]).join(`
|
|
51
|
+
`)).join(`
|
|
52
|
+
`)}});var pr=u((Bu,fr)=>{"use strict";fr.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 x=u((zu,mr)=>{"use strict";mr.exports={action:tr(),clear:nr(),style:lr(),strip:Oe(),figures:pt(),lines:ar(),wrap:dr(),entriesToDisplay:pr()}});var k=u((Zu,vr)=>{"use strict";var gr=require("readline"),{action:Uh}=x(),Jh=require("events"),{beep:Gh,cursor:Bh}=p(),zh=f(),gt=class extends Jh{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=gr.createInterface({input:this.in,escapeCodeTimeout:50});gr.emitKeypressEvents(this.in,t),this.in.isTTY&&this.in.setRawMode(!0);let s=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,r=(o,n)=>{let h=Uh(n,s);h===!1?this._&&this._(o,n):typeof this[h]=="function"?this[h](n):this.bell()};this.close=()=>{this.out.write(Bh.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(Gh)}render(){this.onRender(zh),this.firstRender&&(this.firstRender=!1)}};vr.exports=gt});var yr=u((Wu,br)=>{var Me=f(),Zh=k(),{erase:Wh,cursor:de}=p(),{style:vt,clear:bt,lines:Kh,figures:Xh}=x(),yt=class extends Zh{constructor(e={}){super(e),this.transform=vt.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=+!!this.initial,this.cursorOffset=0,this.clear=bt("",this.out.columns),this.render()}set value(e){!e&&this.initial?(this.placeholder=!0,this.rendered=Me.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=+!!this.initial,this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
|
|
53
|
+
`),this.close()}async validate(){let 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(`
|
|
54
|
+
`),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(de.down(Kh(this.outputError,this.out.columns)-1)+bt(this.outputError,this.out.columns)),this.out.write(bt(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[vt.symbol(this.done,this.aborted),Me.bold(this.msg),vt.delimiter(this.done),this.red?Me.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
55
|
+
`).reduce((e,t,s)=>e+`
|
|
56
|
+
${s?" ":Xh.pointerSmall} ${Me.red().italic(t)}`,"")),this.out.write(Wh.line+de.to(0)+this.outputText+de.save+this.outputError+de.restore+de.move(this.cursorOffset,0)))}};br.exports=yt});var qr=u((Ku,Sr)=>{"use strict";var E=f(),Qh=k(),{style:wr,clear:xr,figures:Pe,wrap:el,entriesToDisplay:tl}=x(),{cursor:il}=p(),wt=class extends Qh{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(`
|
|
57
|
+
`),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
58
|
+
`),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(e,t){if(e===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(il.hide):this.out.write(xr(this.outputText,this.out.columns)),super.render();let{startIndex:e,endIndex:t}=tl(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[wr.symbol(this.done,this.aborted),E.bold(this.msg),wr.delimiter(!1),this.done?this.selection.title:this.selection.disabled?E.yellow(this.warn):E.gray(this.hint)].join(" "),!this.done){this.outputText+=`
|
|
59
|
+
`;for(let s=e;s<t;s++){let r,o,n="",h=this.choices[s];s===e&&e>0?o=Pe.arrowUp:s===t-1&&t<this.choices.length?o=Pe.arrowDown:o=" ",h.disabled?(r=this.cursor===s?E.gray().underline(h.title):E.strikethrough().gray(h.title),o=(this.cursor===s?E.bold().gray(Pe.pointer)+" ":" ")+o):(r=this.cursor===s?E.cyan().underline(h.title):h.title,o=(this.cursor===s?E.cyan(Pe.pointer)+" ":" ")+o,h.description&&this.cursor===s&&(n=` - ${h.description}`,(o.length+r.length+n.length>=this.out.columns||h.description.split(/\r?\n/).length>1)&&(n=`
|
|
60
|
+
`+el(h.description,{margin:3,width:this.out.columns})))),this.outputText+=`${o} ${r}${E.gray(n)}
|
|
61
|
+
`}}this.out.write(this.outputText)}};Sr.exports=wt});var Ir=u((Xu,Pr)=>{var Ie=f(),sl=k(),{style:Or,clear:rl}=x(),{cursor:Mr,erase:nl}=p(),xt=class extends sl{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(`
|
|
62
|
+
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
63
|
+
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(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(Mr.hide):this.out.write(rl(this.outputText,this.out.columns)),super.render(),this.outputText=[Or.symbol(this.done,this.aborted),Ie.bold(this.msg),Or.delimiter(this.done),this.value?this.inactive:Ie.cyan().underline(this.inactive),Ie.gray("/"),this.value?Ie.cyan().underline(this.active):this.active].join(" "),this.out.write(nl.line+Mr.to(0)+this.outputText))}};Pr.exports=xt});var M=u((Qu,Tr)=>{"use strict";var St=class i{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 i)}setTo(e){}prev(){let e=[].concat(this.parts).reverse(),t=e.indexOf(this);return e.find((s,r)=>r>t&&s instanceof i)}toString(){return String(this.date)}};Tr.exports=St});var Cr=u((ea,$r)=>{"use strict";var ol=M(),qt=class extends ol{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=qt});var Dr=u((ta,_r)=>{"use strict";var hl=M(),ll=i=>(i=i%10,i===1?"st":i===2?"nd":i===3?"rd":"th"),Ot=class extends hl{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+ll(e):this.token==="d"?t+1:this.token==="ddd"?this.locales.weekdaysShort[t]:this.token==="dddd"?this.locales.weekdays[t]:e}};_r.exports=Ot});var kr=u((ia,jr)=>{"use strict";var ul=M(),Mt=class extends ul{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}};jr.exports=Mt});var Ar=u((sa,Er)=>{"use strict";var al=M(),Pt=class extends al{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)}};Er.exports=Pt});var Fr=u((ra,Rr)=>{"use strict";var cl=M(),It=class extends cl{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}};Rr.exports=It});var Hr=u((na,Vr)=>{"use strict";var dl=M(),Tt=class extends dl{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)}};Vr.exports=Tt});var Lr=u((oa,Yr)=>{"use strict";var fl=M(),$t=class extends fl{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}};Yr.exports=$t});var Ur=u((ha,Nr)=>{"use strict";var pl=M(),Ct=class extends pl{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}};Nr.exports=Ct});var Gr=u((la,Jr)=>{"use strict";Jr.exports={DatePart:M(),Meridiem:Cr(),Day:Dr(),Hours:kr(),Milliseconds:Ar(),Minutes:Fr(),Month:Hr(),Seconds:Lr(),Year:Ur()}});var Qr=u((ua,Xr)=>{"use strict";var _t=f(),ml=k(),{style:Br,clear:zr,figures:gl}=x(),{erase:vl,cursor:Zr}=p(),{DatePart:Wr,Meridiem:bl,Day:yl,Hours:wl,Milliseconds:xl,Minutes:Sl,Month:ql,Seconds:Ol,Year:Ml}=Gr(),Pl=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,Kr={1:({token:i})=>i.replace(/\\(.)/g,"$1"),2:i=>new yl(i),3:i=>new ql(i),4:i=>new Ml(i),5:i=>new bl(i),6:i=>new wl(i),7:i=>new Sl(i),8:i=>new Ol(i),9:i=>new xl(i)},Il={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(",")},Dt=class extends ml{constructor(e={}){super(e),this.msg=e.message,this.cursor=0,this.typed="",this.locales=Object.assign(Il,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=zr("",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=Pl.exec(e);){let r=t.shift(),o=t.findIndex(n=>n!=null);this.parts.push(o in Kr?Kr[o]({token:t[o]||r,date:this.date,parts:this.parts,locales:this.locales}):t[o]||r)}let s=this.parts.reduce((r,o)=>(typeof o=="string"&&typeof r[r.length-1]=="string"?r[r.length-1]+=o:r.push(o),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 Wr)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
64
|
+
`),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(`
|
|
65
|
+
`),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let 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 Wr)),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(Zr.hide):this.out.write(zr(this.outputText,this.out.columns)),super.render(),this.outputText=[Br.symbol(this.done,this.aborted),_t.bold(this.msg),Br.delimiter(!1),this.parts.reduce((e,t,s)=>e.concat(s===this.cursor&&!this.done?_t.cyan().underline(t.toString()):t),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
|
|
66
|
+
`).reduce((e,t,s)=>e+`
|
|
67
|
+
${s?" ":gl.pointerSmall} ${_t.red().italic(t)}`,"")),this.out.write(vl.line+Zr.to(0)+this.outputText))}};Xr.exports=Dt});var rn=u((aa,sn)=>{var Te=f(),Tl=k(),{cursor:$e,erase:$l}=p(),{style:jt,figures:Cl,clear:en,lines:_l}=x(),Dl=/[0-9]/,kt=i=>i!==void 0,tn=(i,e)=>{let t=Math.pow(10,e);return Math.round(i*t)/t},Et=class extends Tl{constructor(e={}){super(e),this.transform=jt.render(e.style),this.msg=e.message,this.initial=kt(e.initial)?e.initial:"",this.float=!!e.float,this.round=e.round||2,this.inc=e.increment||1,this.min=kt(e.min)?e.min:-1/0,this.max=kt(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=Te.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${tn(e,this.round)}`),this._value=tn(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||Dl.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(`
|
|
68
|
+
`),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(`
|
|
69
|
+
`),this.close()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let 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($e.down(_l(this.outputError,this.out.columns)-1)+en(this.outputError,this.out.columns)),this.out.write(en(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[jt.symbol(this.done,this.aborted),Te.bold(this.msg),jt.delimiter(this.done),!this.done||!this.done&&!this.placeholder?Te[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
70
|
+
`).reduce((e,t,s)=>e+`
|
|
71
|
+
${s?" ":Cl.pointerSmall} ${Te.red().italic(t)}`,"")),this.out.write($l.line+$e.to(0)+this.outputText+$e.save+this.outputError+$e.restore))}};sn.exports=Et});var Rt=u((ca,hn)=>{"use strict";var P=f(),{cursor:jl}=p(),kl=k(),{clear:nn,figures:H,style:on,wrap:El,entriesToDisplay:Al}=x(),At=class extends kl{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=nn("",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(`
|
|
72
|
+
`),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(`
|
|
73
|
+
`),this.close())}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render()}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(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:`
|
|
74
|
+
Instructions:
|
|
75
|
+
${H.arrowUp}/${H.arrowDown}: Highlight option
|
|
76
|
+
${H.arrowLeft}/${H.arrowRight}/[space]: Toggle selection
|
|
77
|
+
`+(this.maxChoices===void 0?` a: Toggle all
|
|
78
|
+
`:"")+" enter/return: Complete answer":""}renderOption(e,t,s,r){let o=(t.selected?P.green(H.radioOn):H.radioOff)+" "+r+" ",n,h;return t.disabled?n=e===s?P.gray().underline(t.title):P.strikethrough().gray(t.title):(n=e===s?P.cyan().underline(t.title):t.title,e===s&&t.description&&(h=` - ${t.description}`,(o.length+n.length+h.length>=this.out.columns||t.description.split(/\r?\n/).length>1)&&(h=`
|
|
79
|
+
`+El(t.description,{margin:o.length,width:this.out.columns})))),o+n+P.gray(h||"")}paginateOptions(e){if(e.length===0)return P.red("No matches for this query.");let{startIndex:t,endIndex:s}=Al(this.cursor,e.length,this.optionsPerPage),r,o=[];for(let n=t;n<s;n++)n===t&&t>0?r=H.arrowUp:n===s-1&&s<e.length?r=H.arrowDown:r=" ",o.push(this.renderOption(this.cursor,e[n],n,r));return`
|
|
80
|
+
`+o.join(`
|
|
81
|
+
`)}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=[P.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&e.push(P.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(jl.hide),super.render();let e=[on.symbol(this.done,this.aborted),P.bold(this.msg),on.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=P.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=nn(e,this.out.columns)}};hn.exports=At});var dn=u((da,cn)=>{"use strict";var fe=f(),Rl=k(),{erase:Fl,cursor:ln}=p(),{style:Ft,clear:un,figures:Vt,wrap:Vl,entriesToDisplay:Hl}=x(),an=(i,e)=>i[e]&&(i[e].value||i[e].title||i[e]),Yl=(i,e)=>i[e]&&(i[e].title||i[e].value||i[e]),Ll=(i,e)=>{let t=i.findIndex(s=>s.value===e||s.title===e);return t>-1?t:void 0},Ht=class extends Rl{constructor(e={}){super(e),this.msg=e.message,this.suggest=e.suggest,this.choices=e.choices,this.initial=typeof e.initial=="number"?e.initial:Ll(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=un("",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=an(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((o,n,h)=>({title:Yl(h,n),value:an(h,n),description:o.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(`
|
|
82
|
+
`),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
83
|
+
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
84
|
+
`),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 o,n=s?Vt.arrowUp:r?Vt.arrowDown:" ",h=t?fe.cyan().underline(e.title):e.title;return n=(t?fe.cyan(Vt.pointer)+" ":" ")+n,e.description&&(o=` - ${e.description}`,(n.length+h.length+o.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(o=`
|
|
85
|
+
`+Vl(e.description,{margin:3,width:this.out.columns}))),n+" "+h+fe.gray(o||"")}render(){if(this.closed)return;this.firstRender?this.out.write(ln.hide):this.out.write(un(this.outputText,this.out.columns)),super.render();let{startIndex:e,endIndex:t}=Hl(this.select,this.choices.length,this.limit);if(this.outputText=[Ft.symbol(this.done,this.aborted,this.exited),fe.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,o)=>this.renderOption(r,this.select===o+e,o===0&&e>0,o+e===t-1&&t<this.choices.length)).join(`
|
|
86
|
+
`);this.outputText+=`
|
|
87
|
+
`+(s||fe.gray(this.fallback.title))}this.out.write(Fl.line+ln.to(0)+this.outputText)}};cn.exports=Ht});var gn=u((fa,mn)=>{"use strict";var A=f(),{cursor:Nl}=p(),Ul=Rt(),{clear:fn,style:pn,figures:ee}=x(),Yt=class extends Ul{constructor(e={}){e.overrideRender=!0,super(e),this.inputValue="",this.clear=fn("",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:`
|
|
88
|
+
Instructions:
|
|
89
|
+
${ee.arrowUp}/${ee.arrowDown}: Highlight option
|
|
90
|
+
${ee.arrowLeft}/${ee.arrowRight}/[space]: Toggle selection
|
|
91
|
+
[a,b,c]/delete: Filter choices
|
|
92
|
+
enter/return: Complete answer
|
|
93
|
+
`:""}renderCurrentInput(){return`
|
|
94
|
+
Filtered results for: ${this.inputValue?this.inputValue:A.gray("Enter something to filter")}
|
|
95
|
+
`}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(ee.radioOn):ee.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(Nl.hide),super.render();let e=[pn.symbol(this.done,this.aborted),A.bold(this.msg),pn.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=fn(e,this.out.columns)}};mn.exports=Yt});var xn=u((pa,wn)=>{var vn=f(),Jl=k(),{style:bn,clear:Gl}=x(),{erase:Bl,cursor:yn}=p(),Lt=class extends Jl{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(`
|
|
96
|
+
`),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
97
|
+
`),this.close()}_(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(yn.hide):this.out.write(Gl(this.outputText,this.out.columns)),super.render(),this.outputText=[bn.symbol(this.done,this.aborted),vn.bold(this.msg),bn.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:vn.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(Bl.line+yn.to(0)+this.outputText))}};wn.exports=Lt});var qn=u((ma,Sn)=>{"use strict";Sn.exports={TextPrompt:yr(),SelectPrompt:qr(),TogglePrompt:Ir(),DatePrompt:Qr(),NumberPrompt:rn(),MultiselectPrompt:Rt(),AutocompletePrompt:dn(),AutocompleteMultiselectPrompt:gn(),ConfirmPrompt:xn()}});var Mn=u(On=>{"use strict";var b=On,zl=qn(),Ce=i=>i;function I(i,e,t={}){return new Promise((s,r)=>{let o=new zl[i](e),n=t.onAbort||Ce,h=t.onSubmit||Ce,l=t.onExit||Ce;o.on("state",e.onState||Ce),o.on("submit",a=>s(h(a))),o.on("exit",a=>s(l(a))),o.on("abort",a=>r(n(a)))})}b.text=i=>I("TextPrompt",i);b.password=i=>(i.style="password",b.text(i));b.invisible=i=>(i.style="invisible",b.text(i));b.number=i=>I("NumberPrompt",i);b.date=i=>I("DatePrompt",i);b.confirm=i=>I("ConfirmPrompt",i);b.list=i=>{let e=i.separator||",";return I("TextPrompt",i,{onSubmit:t=>t.split(e).map(s=>s.trim())})};b.toggle=i=>I("TogglePrompt",i);b.select=i=>I("SelectPrompt",i);b.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})};b.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 Zl=(i,e)=>Promise.resolve(e.filter(t=>t.title.slice(0,i.length).toLowerCase()===i.toLowerCase()));b.autocomplete=i=>(i.suggest=i.suggest||Zl,i.choices=[].concat(i.choices||[]),I("AutocompletePrompt",i))});var Tn=u((va,In)=>{"use strict";var Nt=Mn(),Wl=["suggest","format","onState","validate","onRender","type"],Pn=()=>{};async function Y(i=[],{onSubmit:e=Pn,onCancel:t=Pn}={}){let s={},r=Y._override||{};i=[].concat(i);let o,n,h,l,a,z,Z=async(m,g,N=!1)=>{if(!(!N&&m.validate&&m.validate(g)!==!0))return m.format?await m.format(g,s):g};for(n of i)if({name:l,type:a}=n,typeof a=="function"&&(a=await a(o,{...s},n),n.type=a),!!a){for(let m in n){if(Wl.includes(m))continue;let g=n[m];n[m]=typeof g=="function"?await g(o,{...s},z):g}if(z=n,typeof n.message!="string")throw new Error("prompt message is required");if({name:l,type:a}=n,Nt[a]===void 0)throw new Error(`prompt type (${a}) is not defined`);if(r[n.name]!==void 0&&(o=await Z(n,r[n.name]),o!==void 0)){s[l]=o;continue}try{o=Y._injected?Kl(Y._injected,n.initial):await Nt[a](n),s[l]=o=await Z(n,o,!0),h=await e(n,o,s)}catch{h=!await t(n,s)}if(h)return s}return s}function Kl(i,e){let t=i.shift();if(t instanceof Error)throw t;return t===void 0?e:t}function Xl(i){Y._injected=(Y._injected||[]).concat(i)}function Ql(i){Y._override=Object.assign({},i)}In.exports=Object.assign(Y,{prompt:Y,prompts:Nt,inject:Xl,override:Ql})});var _e=u((ba,$n)=>{function eu(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}$n.exports=eu("8.6.0")?Qs():Tn()});var Bt=$(require("path"));var Wt=$(require("readline")),Kt=Wt.default.createInterface({input:process.stdin,output:process.stdout});function J(i){console.log("");for(let e of i)console.log(e);console.log("")}var W=require("fs"),Xt=$(require("path"));function Qt(i,e){let t=Xt.default.join(i,"package.json");if((0,W.existsSync)(t)){let s=JSON.parse((0,W.readFileSync)(t,"utf8"));s.name=e.name,e.version&&(s.version=e.version),e.productName&&(s.productName=e.productName),e.description&&(s.description=e.description),e.repository&&(s.repository=e.repository),e.author&&(s.author=e.author),(0,W.writeFileSync)(t,JSON.stringify(s,null,2))}}var Cn=$(_e());async function te(i,e=!1){return(await(0,Cn.default)({type:"toggle",name:"value",message:i,initial:e,active:"yes",inactive:"no"})).value}var Dn=$(require("path"));var _n=require("fs"),Ut=$(require("path"));function De(i,e,t){(0,_n.copyFileSync)(Ut.default.join(e,i),Ut.default.join(t,i))}var L=require("fs"),Jt=$(require("path"));function Gt(i,e){let t=(0,L.readdirSync)(i);for(let s of t){let r=Jt.default.join(i,s),o=Jt.default.join(e,s);(0,L.statSync)(r).isDirectory()?((0,L.mkdirSync)(o,{recursive:!0}),Gt(r,o)):(0,L.copyFileSync)(r,o)}}async function jn(i,e){Gt(Dn.default.join(i,"template"),e),De(".gitignore",i,e),De("LICENSE",i,e),De("README.md",i,e)}var Fn=require("child_process");var kn=require("child_process");function En(){let i=["npm"];try{(0,kn.execSync)("yarn --version",{stdio:"ignore"}),i.unshift("yarn")}catch(e){console.error("\u274C Detect package manager error",e)}return i}var An=$(_e());async function Rn(i,e){let t=e.map(r=>({title:r,value:r.toLowerCase()}));return(await(0,An.default)({type:"select",name:"value",message:i,choices:t,initial:0})).value}async function Vn(i){try{process.chdir(i);let e=En(),t=e[0];e.length>1&&(t=await Rn("Package manager",e)),J([`\u{1F4E6} Using package manager: ${t}`,"\u{1F4E6} Installing dependencies..."]),(0,Fn.execSync)(`${t} install`,{stdio:"inherit"}),J(["\u2705 Dependencies installed"])}catch(e){console.error("\u274C Error executing next steps",e)}}var je=require("fs");var ie=require("fs");function Hn(i){try{return(0,ie.existsSync)(i)?(0,ie.statSync)(i).isDirectory()?(0,ie.readdirSync)(i).length===0:(console.error(`\u274C Path is not a directory: ${i}`),!1):!0}catch(e){return console.error("\u274C Error checking directory",e),!1}}async function Yn(i){if(!Hn(i)){if(!await te(`Directory "${i}" already exists. Overwrite?`)){console.error("\u274C Operation cancelled");return}(0,je.rmSync)(i,{recursive:!0,force:!0})}try{(0,je.mkdirSync)(i,{recursive:!0})}catch(e){console.error("\u274C Error executing next steps",e);return}}var Ln={name:"ts-vite-project",version:"0.1.0",productName:"TS Vite Project",description:"TypeScript Vite application",license:"MIT",author:"",repository:"",homepage:""};var Nn=$(_e());async function R(i,e=""){return(await(0,Nn.default)({type:"text",name:"value",message:i,initial:e})).value||""}async function Un(i){let{name:e,version:t,productName:s,description:r,license:o,author:n,repository:h,bugs:l,homepage:a}=Ln;if(i.length?(s=i.map(m=>`${m.slice(0,1).toUpperCase()}${m.slice(1)}`).join(" "),e=i.map(m=>m.toLowerCase()).join("-")):(s=(await R("Product name",s)).trim(),e=s.split(" ").map(m=>m.toLowerCase()).join("-"),e=(await R("Project name",e)).trim()),await te("Config extended project params?")){let g=(await R("Version",t)).trim().split(".");for(let y=g.length;y<3;y++)g.push("0");t=g.join("."),r=(await R("Description",r)).trim()||r,o=(await R("License",o)).trim()||o,n={},n.name=(await R("Author")).trim(),n.email=(await R("Email")).trim(),h={};let N=`https://github.com/${n.name}/${e}.git`,U=(await R("Repository url",N)).trim()||N;U&&(h.url=`git+${U}`,l={},n.email&&(l.email=n.email),l.url=`${U}/issues`,a=`${U}#readme`)}return{name:e,version:t,productName:s,description:r,license:o,author:n,repository:h,bugs:l,homepage:a}}async function tu(){J(["\u{1F680} Creating TypeScript + Vite Project","(will be installed in project name folder)"]);let i=process.argv.slice(2),e=await Un(i),t=Bt.default.resolve(e.name),s=Bt.default.resolve(__dirname,"..");await Yn(t);try{await jn(s,t),Qt(t,e),J(["\u2705 Project created successfully!"]),await te("Install dependencies?")&&await Vn(t),J(["Next steps:",`\u{1F4C1} cd ${e.name}`,"\u{1F4E6} npm install","\u2B50 npm run dev","","Happy coding! \u{1F44B}"])}catch(r){console.error("\u274C Error creating project:",r)}finally{Kt.close()}}tu().catch(console.error);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-ts-vite-project",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"productName": "TS Vite Project Template Creator",
|
|
5
5
|
"description": "Template for projects based typescript, vite, vitest, eslint, prettier, electron, tauri",
|
|
6
6
|
"license": "MIT",
|
|
@@ -63,6 +63,7 @@
|
|
|
63
63
|
"@eslint/js": "^9.39.1",
|
|
64
64
|
"@types/jest": "^30.0.0",
|
|
65
65
|
"@types/node": "^24.10.1",
|
|
66
|
+
"@types/prompts": "^2.4.9",
|
|
66
67
|
"@typescript-eslint/eslint-plugin": "^8.47.0",
|
|
67
68
|
"@typescript-eslint/parser": "^8.47.0",
|
|
68
69
|
"esbuild": "^0.27.0",
|
|
@@ -74,6 +75,7 @@
|
|
|
74
75
|
"globals": "^16.5.0",
|
|
75
76
|
"jest": "^30.2.0",
|
|
76
77
|
"prettier": "^3.6.2",
|
|
78
|
+
"prompts": "^2.4.2",
|
|
77
79
|
"ts-jest": "^29.4.5",
|
|
78
80
|
"ts-node": "^10.9.2",
|
|
79
81
|
"typescript": "^5.9.3"
|
package/template/package.json
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"electron:build": "electron-builder --config electron-builder.config.js",
|
|
24
24
|
"tauri:build": "tauri build",
|
|
25
25
|
"tauri:dev": "tauri dev",
|
|
26
|
-
"tauri:init": "tauri init"
|
|
26
|
+
"tauri:init": "tauri init --force"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@capacitor/android": "^7.4.4",
|