create-unibest 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -70
- package/outfile.cjs +35 -35
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,27 +1,23 @@
|
|
|
1
1
|
|
|
2
|
-
<h1 align="center"
|
|
2
|
+
<h1 align="center">✨create unibest✨</h1>
|
|
3
3
|
|
|
4
4
|
<p align="center">
|
|
5
|
-
<a href="https://
|
|
6
|
-
<a href="https://www.npmjs.com/package/create-
|
|
7
|
-
<a href="https://www.npmjs.com/package/create-uni"><img src="https://img.shields.io/npm/v/create-uni?colorA=363a4f&colorB=a6da95&style=for-the-badge"></a>
|
|
5
|
+
<a href="https://www.npmjs.com/package/create-unibest"><img src="https://img.shields.io/npm/dm/create-unibest?colorA=363a4f&colorB=f5a97f&style=for-the-badge"></a>
|
|
6
|
+
<a href="https://www.npmjs.com/package/create-unibest"><img src="https://img.shields.io/npm/v/create-unibest?colorA=363a4f&colorB=a6da95&style=for-the-badge"></a>
|
|
8
7
|
</p>
|
|
9
8
|
|
|
10
9
|
<h2 align="center">
|
|
11
|
-
<sub>>_ Easy to use create
|
|
10
|
+
<sub>>_ Easy to use create unibest▌</sub>
|
|
12
11
|
</h2>
|
|
13
12
|
|
|
14
13
|
# 📦 使用
|
|
15
14
|
|
|
16
15
|
```shell
|
|
17
|
-
# npm
|
|
18
|
-
npm create uni@latest
|
|
19
|
-
|
|
20
|
-
# yarn
|
|
21
|
-
yarn create uni
|
|
22
|
-
|
|
23
16
|
# pnpm
|
|
24
|
-
pnpm create
|
|
17
|
+
pnpm create unibest
|
|
18
|
+
|
|
19
|
+
# npm
|
|
20
|
+
npm create unibest@latest
|
|
25
21
|
```
|
|
26
22
|
|
|
27
23
|
> [!TIP]
|
|
@@ -29,68 +25,16 @@
|
|
|
29
25
|
|
|
30
26
|
## 📖 介绍
|
|
31
27
|
|
|
32
|
-
`create-
|
|
33
|
-
|
|
34
|
-
<p align="center"><img src=".github/image/demo.png"></p>
|
|
28
|
+
`create-unibest` 是一个用于快速创建 `uni-app` 项目的轻量脚手架工具,它可以帮助你快速创建一个基于 `vite` 和 `vue3` 的 `uni-app` 项目,同时提供了一些模板供你选择。
|
|
35
29
|
|
|
36
30
|
## 🚤 快速使用
|
|
37
31
|
|
|
38
32
|
```shell
|
|
39
|
-
|
|
33
|
+
pnpm create uni <项目名称> -t <模板>
|
|
40
34
|
```
|
|
41
35
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
| 配置项 | 参数 | 别名 | 可选值 |
|
|
45
|
-
| :---: | :---: | :---: | :---: |
|
|
46
|
-
| Template | —— | t | vitesse |
|
|
47
|
-
| TypeScript | ts | —— | —— |
|
|
48
|
-
| Plugin | pluginList | p | 见[插件列表](#插件列表) |
|
|
49
|
-
| Module | moduleList | m | 见[模块列表](#模块列表) |
|
|
50
|
-
| UI | ui | u | uni/ano |
|
|
51
|
-
| Eslint | eslint | -e | —— |
|
|
52
|
-
|
|
53
|
-
#### 📦插件列表
|
|
54
|
-
|
|
55
|
-
| 插件名 | 描述 | 参数名 |
|
|
56
|
-
| :---: | :---: | :---: |
|
|
57
|
-
| [vite-plugin-uni-components](https://github.com/uni-helper/vite-plugin-uni-components) | 按需自动引入组件 | import |
|
|
58
|
-
| [vite-plugin-uni-pages](https://github.com/uni-helper/vite-plugin-uni-pages) | 提供基于文件系统的路由 | pages |
|
|
59
|
-
| [vite-plugin-uni-layouts](https://github.com/uni-helper/vite-plugin-uni-layouts) | 提供类 nuxt 的 layouts 系统 | layouts |
|
|
60
|
-
| [vite-plugin-uni-manifest](https://github.com/uni-helper/vite-plugin-uni-manifest) | 自动生成 manifest.json 文件 | manifest |
|
|
61
|
-
| [vite-plugin-uni-platform](https://github.com/uni-helper/vite-plugin-uni-platform) | 基于文件名 (*.<h5\|mp-weixin\|app>.*) 的按平台编译插件 | filePlatform |
|
|
62
|
-
| [vite-plugin-uni-platform-modifier](https://github.com/uni-helper/vite-plugin-uni-platform-modifier) | 为属性、指令提供平台修饰符并按需编译 | platformModifier |
|
|
63
|
-
| [vite-plugin-uni-middleware](https://github.com/uni-helper/vite-plugin-uni-middleware) | 使用路由中间件 | middleware |
|
|
64
|
-
|
|
65
|
-
#### 📦模块列表
|
|
66
|
-
|
|
67
|
-
| 模块名 | 描述 | 参数名 |
|
|
68
|
-
| :---: | :---: | :---: |
|
|
69
|
-
| [pinia](https://github.com/vuejs/pinia) | 符合直觉的 Vue.js 状态管理库 | pinia |
|
|
70
|
-
| [unocss](https://github.com/antfu/unocss) | 即时按需的原子级 CSS 引擎 | unocss |
|
|
71
|
-
| [uni-network](https://github.com/uni-helper/uni-network) | 为 uni-app 打造的基于 Promise 的网络请求库 | uniNetwork |
|
|
72
|
-
| [uni-use](https://github.com/uni-helper/uni-use) | uni-app 组合式工具集 | uniUse |
|
|
73
|
-
| [uni-promises](https://github.com/uni-helper/uni-promises) | 为 uni-app 提供的 Promise 包装器 | uniPromises |
|
|
74
|
-
|
|
75
|
-
## 🤝 参与贡献
|
|
76
|
-
|
|
77
|
-
- 提交新功能
|
|
78
|
-
- 解决[`issues`](https://github.com/uni-helper/create-uni/issues)
|
|
79
|
-
- 提交新[`模板`](./src/question/template/)/[`Plugin`](./src/question/plugin/choices.ts)/[`module`](./src/question/module/choices.ts)/[`UI`](./src/question/UI/)
|
|
80
|
-
|
|
81
|
-
## 🌸 感谢
|
|
82
|
-
|
|
83
|
-
项目灵感及部分代码来自 [create-vue](https://github.com/vuejs/create-vue)
|
|
84
|
-
|
|
85
|
-
## 📄 License
|
|
86
|
-
|
|
87
|
-
[MIT LICENSE](./LICENSE)
|
|
88
|
-
|
|
89
|
-
## [Sponsors](https://github.com/FliPPeDround/sponsors)
|
|
90
|
-
|
|
91
|
-
<p align="center">
|
|
92
|
-
<a href="https://cdn.jsdelivr.net/gh/FliPPeDround/sponsors/sponsorkit/sponsors.svg">
|
|
93
|
-
<img alt="sponsors" src="https://cdn.jsdelivr.net/gh/FliPPeDround/sponsors/sponsorkit/sponsors.svg"/>
|
|
94
|
-
</a>
|
|
95
|
-
</p>
|
|
36
|
+
目前支持 `base`、`demo`、`i18n` 三种模板。
|
|
96
37
|
|
|
38
|
+
- 如果想学习所有的 `demo`,可以通过 `pnpm create unibest my-unibest -t demo` 生成。(包含了所有的 `demo` 和 `i18n` 代码)
|
|
39
|
+
- 如果是新开发一个项目,建议使用 `base` 模板,可以通过 `pnpm create unibest my-unibest -t base` 生成。(不含 `demo` 代码)
|
|
40
|
+
- 如果项目有多语言需求,建议使用 `i18n` 模板,可以通过 `pnpm create unibest my-unibest -t i18n` 生成。(不含 `demo` 代码)
|
package/outfile.cjs
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var yo=Object.create;var
|
|
3
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,n=!1,h;return{s:function(){e=e.call(i)},n:function(){var u=e.next();return o=u.done,u},e:function(u){n=!0,h=u},f:function(){try{!o&&e.return!=null&&e.return()}finally{if(n)throw h}}}}function jo(i,t){if(i){if(typeof i=="string")return
|
|
2
|
+
"use strict";var yo=Object.create;var bi=Object.defineProperty;var xo=Object.getOwnPropertyDescriptor;var So=Object.getOwnPropertyNames;var Oo=Object.getPrototypeOf,$o=Object.prototype.hasOwnProperty;var a=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports);var qo=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of So(t))!$o.call(i,s)&&s!==e&&bi(i,s,{get:()=>t[s],enumerable:!(r=xo(t,s))||r.enumerable});return i};var I=(i,t,e)=>(e=i!=null?yo(Oo(i)):{},qo(t||!i||!i.__esModule?bi(e,"default",{value:i,enumerable:!0}):e,i));var Oi=a((xa,Si)=>{"use strict";function To(i,t){var e=i;t.slice(0,-1).forEach(function(s){e=e[s]||{}});var r=t[t.length-1];return r in e}function yi(i){return typeof i=="number"||/^0x[0-9a-f]+$/i.test(i)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(i)}function xi(i,t){return t==="constructor"&&typeof i[t]=="function"||t==="__proto__"}Si.exports=function(i,t){t||(t={});var e={bools:{},strings:{},unknownFn:null};typeof t.unknown=="function"&&(e.unknownFn=t.unknown),typeof t.boolean=="boolean"&&t.boolean?e.allBools=!0:[].concat(t.boolean).filter(Boolean).forEach(function(f){e.bools[f]=!0});var r={};function s(f){return r[f].some(function($){return e.bools[$]})}Object.keys(t.alias||{}).forEach(function(f){r[f]=[].concat(t.alias[f]),r[f].forEach(function($){r[$]=[f].concat(r[f].filter(function(U){return $!==U}))})}),[].concat(t.string).filter(Boolean).forEach(function(f){e.strings[f]=!0,r[f]&&[].concat(r[f]).forEach(function($){e.strings[$]=!0})});var o=t.default||{},n={_:[]};function h(f,$){return e.allBools&&/^--[^=]+$/.test($)||e.strings[f]||e.bools[f]||r[f]}function l(f,$,U){for(var b=f,pt=0;pt<$.length-1;pt++){var j=$[pt];if(xi(b,j))return;b[j]===void 0&&(b[j]={}),(b[j]===Object.prototype||b[j]===Number.prototype||b[j]===String.prototype)&&(b[j]={}),b[j]===Array.prototype&&(b[j]=[]),b=b[j]}var G=$[$.length-1];xi(b,G)||((b===Object.prototype||b===Number.prototype||b===String.prototype)&&(b={}),b===Array.prototype&&(b=[]),b[G]===void 0||e.bools[G]||typeof b[G]=="boolean"?b[G]=U:Array.isArray(b[G])?b[G].push(U):b[G]=[b[G],U])}function u(f,$,U){if(!(U&&e.unknownFn&&!h(f,U)&&e.unknownFn(U)===!1)){var b=!e.strings[f]&&yi($)?Number($):$;l(n,f.split("."),b),(r[f]||[]).forEach(function(pt){l(n,pt.split("."),b)})}}Object.keys(e.bools).forEach(function(f){u(f,o[f]===void 0?!1:o[f])});var S=[];i.indexOf("--")!==-1&&(S=i.slice(i.indexOf("--")+1),i=i.slice(0,i.indexOf("--")));for(var m=0;m<i.length;m++){var c=i[m],p,q;if(/^--.+=/.test(c)){var ft=c.match(/^--([^=]+)=([\s\S]*)$/);p=ft[1];var D=ft[2];e.bools[p]&&(D=D!=="false"),u(p,D,c)}else if(/^--no-.+/.test(c))p=c.match(/^--no-(.+)/)[1],u(p,!1,c);else if(/^--.+/.test(c))p=c.match(/^--(.+)/)[1],q=i[m+1],q!==void 0&&!/^(-|--)[^-]/.test(q)&&!e.bools[p]&&!e.allBools&&(!r[p]||!s(p))?(u(p,q,c),m+=1):/^(true|false)$/.test(q)?(u(p,q==="true",c),m+=1):u(p,e.strings[p]?"":!0,c);else if(/^-[^-]+/.test(c)){for(var O=c.slice(1,-1).split(""),k=!1,T=0;T<O.length;T++){if(q=c.slice(T+2),q==="-"){u(O[T],q,c);continue}if(/[A-Za-z]/.test(O[T])&&q[0]==="="){u(O[T],q.slice(1),c),k=!0;break}if(/[A-Za-z]/.test(O[T])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(q)){u(O[T],q,c),k=!0;break}if(O[T+1]&&O[T+1].match(/\W/)){u(O[T],c.slice(T+2),c),k=!0;break}else u(O[T],e.strings[O[T]]?"":!0,c)}p=c.slice(-1)[0],!k&&p!=="-"&&(i[m+1]&&!/^(-|--)[^-]/.test(i[m+1])&&!e.bools[p]&&(!r[p]||!s(p))?(u(p,i[m+1],c),m+=1):i[m+1]&&/^(true|false)$/.test(i[m+1])?(u(p,i[m+1]==="true",c),m+=1):u(p,e.strings[p]?"":!0,c))}else if((!e.unknownFn||e.unknownFn(c)!==!1)&&n._.push(e.strings._||!yi(c)?c:Number(c)),t.stopEarly){n._.push.apply(n._,i.slice(m+1));break}}return Object.keys(o).forEach(function(f){To(n,f.split("."))||(l(n,f.split("."),o[f]),(r[f]||[]).forEach(function($){l(n,$.split("."),o[f])}))}),t["--"]?n["--"]=S.slice():S.forEach(function(f){n._.push(f)}),n}});var w=a((Sa,qi)=>{"use strict";var{FORCE_COLOR:Mo,NODE_DISABLE_COLORS:Po,TERM:_o}=process.env,g={enabled:!Po&&_o!=="dumb"&&Mo!=="0",reset:v(0,0),bold:v(1,22),dim:v(2,22),italic:v(3,23),underline:v(4,24),inverse:v(7,27),hidden:v(8,28),strikethrough:v(9,29),black:v(30,39),red:v(31,39),green:v(32,39),yellow:v(33,39),blue:v(34,39),magenta:v(35,39),cyan:v(36,39),white:v(37,39),gray:v(90,39),grey:v(90,39),bgBlack:v(40,49),bgRed:v(41,49),bgGreen:v(42,49),bgYellow:v(43,49),bgBlue:v(44,49),bgMagenta:v(45,49),bgCyan:v(46,49),bgWhite:v(47,49)};function $i(i,t){let e=0,r,s="",o="";for(;e<i.length;e++)r=i[e],s+=r.open,o+=r.close,t.includes(r.close)&&(t=t.replace(r.rgx,r.close+r.open));return s+t+o}function Co(i,t){let e={has:i,keys:t};return e.reset=g.reset.bind(e),e.bold=g.bold.bind(e),e.dim=g.dim.bind(e),e.italic=g.italic.bind(e),e.underline=g.underline.bind(e),e.inverse=g.inverse.bind(e),e.hidden=g.hidden.bind(e),e.strikethrough=g.strikethrough.bind(e),e.black=g.black.bind(e),e.red=g.red.bind(e),e.green=g.green.bind(e),e.yellow=g.yellow.bind(e),e.blue=g.blue.bind(e),e.magenta=g.magenta.bind(e),e.cyan=g.cyan.bind(e),e.white=g.white.bind(e),e.gray=g.gray.bind(e),e.grey=g.grey.bind(e),e.bgBlack=g.bgBlack.bind(e),e.bgRed=g.bgRed.bind(e),e.bgGreen=g.bgGreen.bind(e),e.bgYellow=g.bgYellow.bind(e),e.bgBlue=g.bgBlue.bind(e),e.bgMagenta=g.bgMagenta.bind(e),e.bgCyan=g.bgCyan.bind(e),e.bgWhite=g.bgWhite.bind(e),e}function v(i,t){let e={open:`\x1B[${i}m`,close:`\x1B[${t}m`,rgx:new RegExp(`\\x1b\\[${t}m`,"g")};return function(r){return this!==void 0&&this.has!==void 0?(this.has.includes(i)||(this.has.push(i),this.keys.push(e)),r===void 0?this:g.enabled?$i(this.keys,r+""):r+""):r===void 0?Co([i],[e]):g.enabled?$i([e],r+""):r+""}}qi.exports=g});var Mi=a((Oa,Ti)=>{"use strict";Ti.exports=(i,t)=>{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(t){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 Ct=a(($a,Pi)=>{"use strict";Pi.exports=i=>{let t=["[\\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("|"),e=new RegExp(t,"g");return typeof i=="string"?i.replace(e,""):i}});var x=a((qa,_i)=>{"use strict";var Qt="\x1B",y=`${Qt}[`,Io="\x07",te={to(i,t){return t?`${y}${t+1};${i+1}H`:`${y}${i+1}G`},move(i,t){let e="";return i<0?e+=`${y}${-i}D`:i>0&&(e+=`${y}${i}C`),t<0?e+=`${y}${-t}A`:t>0&&(e+=`${y}${t}B`),e},up:(i=1)=>`${y}${i}A`,down:(i=1)=>`${y}${i}B`,forward:(i=1)=>`${y}${i}C`,backward:(i=1)=>`${y}${i}D`,nextLine:(i=1)=>`${y}E`.repeat(i),prevLine:(i=1)=>`${y}F`.repeat(i),left:`${y}G`,hide:`${y}?25l`,show:`${y}?25h`,save:`${Qt}7`,restore:`${Qt}8`},Do={up:(i=1)=>`${y}S`.repeat(i),down:(i=1)=>`${y}T`.repeat(i)},Eo={screen:`${y}2J`,up:(i=1)=>`${y}1J`.repeat(i),down:(i=1)=>`${y}J`.repeat(i),line:`${y}2K`,lineEnd:`${y}K`,lineStart:`${y}1K`,lines(i){let t="";for(let e=0;e<i;e++)t+=this.line+(e<i-1?te.up():"");return i&&(t+=te.left),t}};_i.exports={cursor:te,scroll:Do,erase:Eo,beep:Io}});var Ai=a((Ta,Ei)=>{"use strict";function Ao(i,t){var e=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!e){if(Array.isArray(i)||(e=jo(i))||t&&i&&typeof i.length=="number"){e&&(i=e);var r=0,s=function(){};return{s,n:function(){return r>=i.length?{done:!0}:{done:!1,value:i[r++]}},e:function(u){throw u},f:s}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
3
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,n=!1,h;return{s:function(){e=e.call(i)},n:function(){var u=e.next();return o=u.done,u},e:function(u){n=!0,h=u},f:function(){try{!o&&e.return!=null&&e.return()}finally{if(n)throw h}}}}function jo(i,t){if(i){if(typeof i=="string")return Ci(i,t);var e=Object.prototype.toString.call(i).slice(8,-1);if(e==="Object"&&i.constructor&&(e=i.constructor.name),e==="Map"||e==="Set")return Array.from(i);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return Ci(i,t)}}function Ci(i,t){(t==null||t>i.length)&&(t=i.length);for(var e=0,r=new Array(t);e<t;e++)r[e]=i[e];return r}var Ro=Ct(),Di=x(),Ii=Di.erase,Fo=Di.cursor,Lo=i=>[...Ro(i)].length;Ei.exports=function(i,t){if(!t)return Ii.line+Fo.to(0);let e=0,r=i.split(/\r?\n/);var s=Ao(r),o;try{for(s.s();!(o=s.n()).done;){let n=o.value;e+=1+Math.floor(Math.max(Lo(n)-1,0)/t)}}catch(n){s.e(n)}finally{s.f()}return Ii.lines(e)}});var ee=a((Ma,ji)=>{"use strict";var gt={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},Bo={arrowUp:gt.arrowUp,arrowDown:gt.arrowDown,arrowLeft:gt.arrowLeft,arrowRight:gt.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},Yo=process.platform==="win32"?Bo:gt;ji.exports=Yo});var Fi=a((Pa,Ri)=>{"use strict";var ut=w(),nt=ee(),ie=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}`}}),Ho=i=>ie[i]||ie.default,bt=Object.freeze({aborted:ut.red(nt.cross),done:ut.green(nt.tick),exited:ut.yellow(nt.cross),default:ut.cyan("?")}),No=(i,t,e)=>t?bt.aborted:e?bt.exited:i?bt.done:bt.default,Vo=i=>ut.gray(i?nt.ellipsis:nt.pointerSmall),ko=(i,t)=>ut.gray(i?t?nt.pointerSmall:"+":nt.line);Ri.exports={styles:ie,render:Ho,symbols:bt,symbol:No,delimiter:Vo,item:ko}});var Bi=a((_a,Li)=>{"use strict";var Uo=Ct();Li.exports=function(i,t){let e=String(Uo(i)||"").split(/\r?\n/);return t?e.map(r=>Math.ceil(r.length/t)).reduce((r,s)=>r+s):e.length}});var Hi=a((Ca,Yi)=>{"use strict";Yi.exports=(i,t={})=>{let e=Number.isSafeInteger(parseInt(t.margin))?new Array(parseInt(t.margin)).fill(" ").join(""):t.margin||"",r=t.width;return(i||"").split(/\r?\n/g).map(s=>s.split(/\s+/g).reduce((o,n)=>(n.length+e.length>=r||o[o.length-1].length+n.length+1<r?o[o.length-1]+=` ${n}`:o.push(`${e}${n}`),o),[e]).join(`
|
|
4
4
|
`)).join(`
|
|
5
|
-
`)}});var
|
|
6
|
-
`),this.close()}validate(){var t=this;return
|
|
5
|
+
`)}});var Vi=a((Ia,Ni)=>{"use strict";Ni.exports=(i,t,e)=>{e=e||t;let r=Math.min(t-e,i-Math.floor(e/2));r<0&&(r=0);let s=Math.min(r+e,t);return{startIndex:r,endIndex:s}}});var E=a((Da,ki)=>{"use strict";ki.exports={action:Mi(),clear:Ai(),style:Fi(),strip:Ct(),figures:ee(),lines:Bi(),wrap:Hi(),entriesToDisplay:Vi()}});var J=a((Ea,Ji)=>{"use strict";var Ui=require("readline"),Go=E(),Jo=Go.action,zo=require("events"),Gi=x(),Wo=Gi.beep,Ko=Gi.cursor,Zo=w(),re=class extends zo{constructor(t={}){super(),this.firstRender=!0,this.in=t.stdin||process.stdin,this.out=t.stdout||process.stdout,this.onRender=(t.onRender||(()=>{})).bind(this);let e=Ui.createInterface({input:this.in,escapeCodeTimeout:50});Ui.emitKeypressEvents(this.in,e),this.in.isTTY&&this.in.setRawMode(!0);let r=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,s=(o,n)=>{let h=Jo(n,r);h===!1?this._&&this._(o,n):typeof this[h]=="function"?this[h](n):this.bell()};this.close=()=>{this.out.write(Ko.show),this.in.removeListener("keypress",s),this.in.isTTY&&this.in.setRawMode(!1),e.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",s)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(Wo)}render(){this.onRender(Zo),this.firstRender&&(this.firstRender=!1)}};Ji.exports=re});var Xi=a((Aa,Zi)=>{"use strict";function zi(i,t,e,r,s,o,n){try{var h=i[o](n),l=h.value}catch(u){e(u);return}h.done?t(l):Promise.resolve(l).then(r,s)}function Wi(i){return function(){var t=this,e=arguments;return new Promise(function(r,s){var o=i.apply(t,e);function n(l){zi(o,r,s,n,h,"next",l)}function h(l){zi(o,r,s,n,h,"throw",l)}n(void 0)})}}var It=w(),Xo=J(),Ki=x(),Qo=Ki.erase,vt=Ki.cursor,Dt=E(),se=Dt.style,ne=Dt.clear,th=Dt.lines,eh=Dt.figures,oe=class extends Xo{constructor(t={}){super(t),this.transform=se.render(t.style),this.scale=this.transform.scale,this.msg=t.message,this.initial=t.initial||"",this.validator=t.validate||(()=>!0),this.value="",this.errorMsg=t.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=ne("",this.out.columns),this.render()}set value(t){!t&&this.initial?(this.placeholder=!0,this.rendered=It.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(t)),this._value=t,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(`
|
|
6
|
+
`),this.close()}validate(){var t=this;return Wi(function*(){let e=yield t.validator(t.value);typeof e=="string"&&(t.errorMsg=e,e=!1),t.error=!e})()}submit(){var t=this;return Wi(function*(){if(t.value=t.value||t.initial,t.cursorOffset=0,t.cursor=t.rendered.length,yield t.validate(),t.error){t.red=!0,t.fire(),t.render();return}t.done=!0,t.aborted=!1,t.fire(),t.render(),t.out.write(`
|
|
7
7
|
`),t.close()})()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(t){this.placeholder||(this.cursor=this.cursor+t,this.cursorOffset+=t)}_(t,e){let r=this.value.slice(0,this.cursor),s=this.value.slice(this.cursor);this.value=`${r}${t}${s}`,this.red=!1,this.cursor=this.placeholder?0:r.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let t=this.value.slice(0,this.cursor-1),e=this.value.slice(this.cursor);this.value=`${t}${e}`,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 t=this.value.slice(0,this.cursor),e=this.value.slice(this.cursor+1);this.value=`${t}${e}`,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(vt.down(th(this.outputError,this.out.columns)-1)+ne(this.outputError,this.out.columns)),this.out.write(ne(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[se.symbol(this.done,this.aborted),It.bold(this.msg),se.delimiter(this.done),this.red?It.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
8
8
|
`).reduce((t,e,r)=>t+`
|
|
9
|
-
${r?" ":eh.pointerSmall} ${It.red().italic(e)}`,"")),this.out.write(Qo.line+vt.to(0)+this.outputText+vt.save+this.outputError+vt.restore+vt.move(this.cursorOffset,0)))}};
|
|
9
|
+
${r?" ":eh.pointerSmall} ${It.red().italic(e)}`,"")),this.out.write(Qo.line+vt.to(0)+this.outputText+vt.save+this.outputError+vt.restore+vt.move(this.cursorOffset,0)))}};Zi.exports=oe});var ir=a((ja,er)=>{"use strict";var z=w(),ih=J(),wt=E(),Qi=wt.style,tr=wt.clear,Et=wt.figures,rh=wt.wrap,sh=wt.entriesToDisplay,nh=x(),oh=nh.cursor,he=class extends ih{constructor(t={}){super(t),this.msg=t.message,this.hint=t.hint||"- Use arrow-keys. Return to submit.",this.warn=t.warn||"- This option is disabled",this.cursor=t.initial||0,this.choices=t.choices.map((e,r)=>(typeof e=="string"&&(e={title:e,value:r}),{title:e&&(e.title||e.value||e),value:e&&(e.value===void 0?r:e.value),description:e&&e.description,selected:e&&e.selected,disabled:e&&e.disabled})),this.optionsPerPage=t.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=tr("",this.out.columns),this.render()}moveCursor(t){this.cursor=t,this.value=this.choices[t].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(`
|
|
10
10
|
`),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
11
|
-
`),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()}_(t,e){if(t===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(oh.hide):this.out.write(
|
|
11
|
+
`),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()}_(t,e){if(t===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(oh.hide):this.out.write(tr(this.outputText,this.out.columns)),super.render();let t=sh(this.cursor,this.choices.length,this.optionsPerPage),e=t.startIndex,r=t.endIndex;if(this.outputText=[Qi.symbol(this.done,this.aborted),z.bold(this.msg),Qi.delimiter(!1),this.done?this.selection.title:this.selection.disabled?z.yellow(this.warn):z.gray(this.hint)].join(" "),!this.done){this.outputText+=`
|
|
12
12
|
`;for(let s=e;s<r;s++){let o,n,h="",l=this.choices[s];s===e&&e>0?n=Et.arrowUp:s===r-1&&r<this.choices.length?n=Et.arrowDown:n=" ",l.disabled?(o=this.cursor===s?z.gray().underline(l.title):z.strikethrough().gray(l.title),n=(this.cursor===s?z.bold().gray(Et.pointer)+" ":" ")+n):(o=this.cursor===s?z.cyan().underline(l.title):l.title,n=(this.cursor===s?z.cyan(Et.pointer)+" ":" ")+n,l.description&&this.cursor===s&&(h=` - ${l.description}`,(n.length+o.length+h.length>=this.out.columns||l.description.split(/\r?\n/).length>1)&&(h=`
|
|
13
13
|
`+rh(l.description,{margin:3,width:this.out.columns})))),this.outputText+=`${n} ${o}${z.gray(h)}
|
|
14
|
-
`}}this.out.write(this.outputText)}};
|
|
14
|
+
`}}this.out.write(this.outputText)}};er.exports=he});var lr=a((Ra,hr)=>{"use strict";var At=w(),hh=J(),nr=E(),rr=nr.style,lh=nr.clear,or=x(),sr=or.cursor,uh=or.erase,le=class extends hh{constructor(t={}){super(t),this.msg=t.message,this.value=!!t.initial,this.active=t.active||"on",this.inactive=t.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(`
|
|
15
15
|
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
16
|
-
`),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()}_(t,e){if(t===" ")this.value=!this.value;else if(t==="1")this.value=!0;else if(t==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(
|
|
17
|
-
`),this.close()}validate(){var t=this;return
|
|
18
|
-
`),t.close()})()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let t=this.parts[this.cursor].prev();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}right(){let t=this.parts[this.cursor].next();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}next(){let t=this.parts[this.cursor].next();this.moveCursor(t?this.parts.indexOf(t):this.parts.findIndex(e=>e instanceof
|
|
16
|
+
`),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()}_(t,e){if(t===" ")this.value=!this.value;else if(t==="1")this.value=!0;else if(t==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(sr.hide):this.out.write(lh(this.outputText,this.out.columns)),super.render(),this.outputText=[rr.symbol(this.done,this.aborted),At.bold(this.msg),rr.delimiter(this.done),this.value?this.inactive:At.cyan().underline(this.inactive),At.gray("/"),this.value?At.cyan().underline(this.active):this.active].join(" "),this.out.write(uh.line+sr.to(0)+this.outputText))}};hr.exports=le});var F=a((Fa,ur)=>{"use strict";var ue=class i{constructor({token:t,date:e,parts:r,locales:s}){this.token=t,this.date=e||new Date,this.parts=r||[this],this.locales=s||{}}up(){}down(){}next(){let t=this.parts.indexOf(this);return this.parts.find((e,r)=>r>t&&e instanceof i)}setTo(t){}prev(){let t=[].concat(this.parts).reverse(),e=t.indexOf(this);return t.find((r,s)=>s>e&&r instanceof i)}toString(){return String(this.date)}};ur.exports=ue});var cr=a((La,ar)=>{"use strict";var ah=F(),ae=class extends ah{constructor(t={}){super(t)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let t=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?t.toUpperCase():t}};ar.exports=ae});var fr=a((Ba,dr)=>{"use strict";var ch=F(),dh=i=>(i=i%10,i===1?"st":i===2?"nd":i===3?"rd":"th"),ce=class extends ch{constructor(t={}){super(t)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(t){this.date.setDate(parseInt(t.substr(-2)))}toString(){let t=this.date.getDate(),e=this.date.getDay();return this.token==="DD"?String(t).padStart(2,"0"):this.token==="Do"?t+dh(t):this.token==="d"?e+1:this.token==="ddd"?this.locales.weekdaysShort[e]:this.token==="dddd"?this.locales.weekdays[e]:t}};dr.exports=ce});var mr=a((Ya,pr)=>{"use strict";var fh=F(),de=class extends fh{constructor(t={}){super(t)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(t){this.date.setHours(parseInt(t.substr(-2)))}toString(){let t=this.date.getHours();return/h/.test(this.token)&&(t=t%12||12),this.token.length>1?String(t).padStart(2,"0"):t}};pr.exports=de});var br=a((Ha,gr)=>{"use strict";var ph=F(),fe=class extends ph{constructor(t={}){super(t)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(t){this.date.setMilliseconds(parseInt(t.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};gr.exports=fe});var wr=a((Na,vr)=>{"use strict";var mh=F(),pe=class extends mh{constructor(t={}){super(t)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(t){this.date.setMinutes(parseInt(t.substr(-2)))}toString(){let t=this.date.getMinutes();return this.token.length>1?String(t).padStart(2,"0"):t}};vr.exports=pe});var xr=a((Va,yr)=>{"use strict";var gh=F(),me=class extends gh{constructor(t={}){super(t)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(t){t=parseInt(t.substr(-2))-1,this.date.setMonth(t<0?0:t)}toString(){let t=this.date.getMonth(),e=this.token.length;return e===2?String(t+1).padStart(2,"0"):e===3?this.locales.monthsShort[t]:e===4?this.locales.months[t]:String(t+1)}};yr.exports=me});var Or=a((ka,Sr)=>{"use strict";var bh=F(),ge=class extends bh{constructor(t={}){super(t)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(t){this.date.setSeconds(parseInt(t.substr(-2)))}toString(){let t=this.date.getSeconds();return this.token.length>1?String(t).padStart(2,"0"):t}};Sr.exports=ge});var qr=a((Ua,$r)=>{"use strict";var vh=F(),be=class extends vh{constructor(t={}){super(t)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(t){this.date.setFullYear(t.substr(-4))}toString(){let t=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?t.substr(-2):t}};$r.exports=be});var Mr=a((Ga,Tr)=>{"use strict";Tr.exports={DatePart:F(),Meridiem:cr(),Day:fr(),Hours:mr(),Milliseconds:br(),Minutes:wr(),Month:xr(),Seconds:Or(),Year:qr()}});var Fr=a((Ja,Rr)=>{"use strict";function Pr(i,t,e,r,s,o,n){try{var h=i[o](n),l=h.value}catch(u){e(u);return}h.done?t(l):Promise.resolve(l).then(r,s)}function _r(i){return function(){var t=this,e=arguments;return new Promise(function(r,s){var o=i.apply(t,e);function n(l){Pr(o,r,s,n,h,"next",l)}function h(l){Pr(o,r,s,n,h,"throw",l)}n(void 0)})}}var ve=w(),wh=J(),ye=E(),Cr=ye.style,Ir=ye.clear,yh=ye.figures,jr=x(),xh=jr.erase,Dr=jr.cursor,W=Mr(),Er=W.DatePart,Sh=W.Meridiem,Oh=W.Day,$h=W.Hours,qh=W.Milliseconds,Th=W.Minutes,Mh=W.Month,Ph=W.Seconds,_h=W.Year,Ch=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,Ar={1:({token:i})=>i.replace(/\\(.)/g,"$1"),2:i=>new Oh(i),3:i=>new Mh(i),4:i=>new _h(i),5:i=>new Sh(i),6:i=>new $h(i),7:i=>new Th(i),8:i=>new Ph(i),9:i=>new qh(i)},Ih={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(",")},we=class extends wh{constructor(t={}){super(t),this.msg=t.message,this.cursor=0,this.typed="",this.locales=Object.assign(Ih,t.locales),this._date=t.initial||new Date,this.errorMsg=t.error||"Please Enter A Valid Value",this.validator=t.validate||(()=>!0),this.mask=t.mask||"YYYY-MM-DD HH:mm:ss",this.clear=Ir("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(t){t&&this._date.setTime(t.getTime())}set mask(t){let e;for(this.parts=[];e=Ch.exec(t);){let s=e.shift(),o=e.findIndex(n=>n!=null);this.parts.push(o in Ar?Ar[o]({token:e[o]||s,date:this.date,parts:this.parts,locales:this.locales}):e[o]||s)}let r=this.parts.reduce((s,o)=>(typeof o=="string"&&typeof s[s.length-1]=="string"?s[s.length-1]+=o:s.push(o),s),[]);this.parts.splice(0),this.parts.push(...r),this.reset()}moveCursor(t){this.typed="",this.cursor=t,this.fire()}reset(){this.moveCursor(this.parts.findIndex(t=>t instanceof Er)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
17
|
+
`),this.close()}validate(){var t=this;return _r(function*(){let e=yield t.validator(t.value);typeof e=="string"&&(t.errorMsg=e,e=!1),t.error=!e})()}submit(){var t=this;return _r(function*(){if(yield t.validate(),t.error){t.color="red",t.fire(),t.render();return}t.done=!0,t.aborted=!1,t.fire(),t.render(),t.out.write(`
|
|
18
|
+
`),t.close()})()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let t=this.parts[this.cursor].prev();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}right(){let t=this.parts[this.cursor].next();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}next(){let t=this.parts[this.cursor].next();this.moveCursor(t?this.parts.indexOf(t):this.parts.findIndex(e=>e instanceof Er)),this.render()}_(t){/\d/.test(t)&&(this.typed+=t,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(Dr.hide):this.out.write(Ir(this.outputText,this.out.columns)),super.render(),this.outputText=[Cr.symbol(this.done,this.aborted),ve.bold(this.msg),Cr.delimiter(!1),this.parts.reduce((t,e,r)=>t.concat(r===this.cursor&&!this.done?ve.cyan().underline(e.toString()):e),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
|
|
19
19
|
`).reduce((t,e,r)=>t+`
|
|
20
|
-
${r?" ":yh.pointerSmall} ${ve.red().italic(e)}`,"")),this.out.write(xh.line+
|
|
21
|
-
`),this.close()}validate(){var t=this;return
|
|
22
|
-
`),t.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 t=this.value.toString();if(t.length===0)return this.bell();this.value=this.parse(t=t.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()}_(t,e){if(!this.valid(t))return this.bell();let r=Date.now();if(r-this.lastHit>1e3&&(this.typed=""),this.typed+=t,this.lastHit=r,this.color="cyan",t===".")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(Rt.down(jh(this.outputError,this.out.columns)-1)+
|
|
20
|
+
${r?" ":yh.pointerSmall} ${ve.red().italic(e)}`,"")),this.out.write(xh.line+Dr.to(0)+this.outputText))}};Rr.exports=we});var kr=a((za,Vr)=>{"use strict";function Lr(i,t,e,r,s,o,n){try{var h=i[o](n),l=h.value}catch(u){e(u);return}h.done?t(l):Promise.resolve(l).then(r,s)}function Br(i){return function(){var t=this,e=arguments;return new Promise(function(r,s){var o=i.apply(t,e);function n(l){Lr(o,r,s,n,h,"next",l)}function h(l){Lr(o,r,s,n,h,"throw",l)}n(void 0)})}}var jt=w(),Dh=J(),Nr=x(),Rt=Nr.cursor,Eh=Nr.erase,Ft=E(),xe=Ft.style,Ah=Ft.figures,Yr=Ft.clear,jh=Ft.lines,Rh=/[0-9]/,Se=i=>i!==void 0,Hr=(i,t)=>{let e=Math.pow(10,t);return Math.round(i*e)/e},Oe=class extends Dh{constructor(t={}){super(t),this.transform=xe.render(t.style),this.msg=t.message,this.initial=Se(t.initial)?t.initial:"",this.float=!!t.float,this.round=t.round||2,this.inc=t.increment||1,this.min=Se(t.min)?t.min:-1/0,this.max=Se(t.max)?t.max:1/0,this.errorMsg=t.error||"Please Enter A Valid Value",this.validator=t.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(t){!t&&t!==0?(this.placeholder=!0,this.rendered=jt.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${Hr(t,this.round)}`),this._value=Hr(t,this.round)),this.fire()}get value(){return this._value}parse(t){return this.float?parseFloat(t):parseInt(t)}valid(t){return t==="-"||t==="."&&this.float||Rh.test(t)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let t=this.value;this.value=t!==""?t:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
21
|
+
`),this.close()}validate(){var t=this;return Br(function*(){let e=yield t.validator(t.value);typeof e=="string"&&(t.errorMsg=e,e=!1),t.error=!e})()}submit(){var t=this;return Br(function*(){if(yield t.validate(),t.error){t.color="red",t.fire(),t.render();return}let e=t.value;t.value=e!==""?e:t.initial,t.done=!0,t.aborted=!1,t.error=!1,t.fire(),t.render(),t.out.write(`
|
|
22
|
+
`),t.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 t=this.value.toString();if(t.length===0)return this.bell();this.value=this.parse(t=t.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()}_(t,e){if(!this.valid(t))return this.bell();let r=Date.now();if(r-this.lastHit>1e3&&(this.typed=""),this.typed+=t,this.lastHit=r,this.color="cyan",t===".")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(Rt.down(jh(this.outputError,this.out.columns)-1)+Yr(this.outputError,this.out.columns)),this.out.write(Yr(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[xe.symbol(this.done,this.aborted),jt.bold(this.msg),xe.delimiter(this.done),!this.done||!this.done&&!this.placeholder?jt[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
23
23
|
`).reduce((t,e,r)=>t+`
|
|
24
|
-
${r?" ":Ah.pointerSmall} ${jt.red().italic(e)}`,"")),this.out.write(Eh.line+Rt.to(0)+this.outputText+Rt.save+this.outputError+Rt.restore))}};
|
|
24
|
+
${r?" ":Ah.pointerSmall} ${jt.red().italic(e)}`,"")),this.out.write(Eh.line+Rt.to(0)+this.outputText+Rt.save+this.outputError+Rt.restore))}};Vr.exports=Oe});var qe=a((Wa,Jr)=>{"use strict";var L=w(),Fh=x(),Lh=Fh.cursor,Bh=J(),yt=E(),Ur=yt.clear,tt=yt.figures,Gr=yt.style,Yh=yt.wrap,Hh=yt.entriesToDisplay,$e=class extends Bh{constructor(t={}){super(t),this.msg=t.message,this.cursor=t.cursor||0,this.scrollIndex=t.cursor||0,this.hint=t.hint||"",this.warn=t.warn||"- This option is disabled -",this.minSelected=t.min,this.showMinError=!1,this.maxChoices=t.max,this.instructions=t.instructions,this.optionsPerPage=t.optionsPerPage||10,this.value=t.choices.map((e,r)=>(typeof e=="string"&&(e={title:e,value:r}),{title:e&&(e.title||e.value||e),description:e&&e.description,value:e&&(e.value===void 0?r:e.value),selected:e&&e.selected,disabled:e&&e.disabled})),this.clear=Ur("",this.out.columns),t.overrideRender||this.render()}reset(){this.value.map(t=>!t.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(t=>t.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
25
25
|
`),this.close()}submit(){let t=this.value.filter(e=>e.selected);this.minSelected&&t.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
26
26
|
`),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(t=>t.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){let t=this.value[this.cursor];if(t.selected)t.selected=!1,this.render();else{if(t.disabled||this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();t.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let t=!this.value[this.cursor].selected;this.value.filter(e=>!e.disabled).forEach(e=>e.selected=t),this.render()}_(t,e){if(t===" ")this.handleSpaceToggle();else if(t==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
27
27
|
Instructions:
|
|
@@ -31,13 +31,13 @@ Instructions:
|
|
|
31
31
|
`:"")+" enter/return: Complete answer":""}renderOption(t,e,r,s){let o=(e.selected?L.green(tt.radioOn):tt.radioOff)+" "+s+" ",n,h;return e.disabled?n=t===r?L.gray().underline(e.title):L.strikethrough().gray(e.title):(n=t===r?L.cyan().underline(e.title):e.title,t===r&&e.description&&(h=` - ${e.description}`,(o.length+n.length+h.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(h=`
|
|
32
32
|
`+Yh(e.description,{margin:o.length,width:this.out.columns})))),o+n+L.gray(h||"")}paginateOptions(t){if(t.length===0)return L.red("No matches for this query.");let e=Hh(this.cursor,t.length,this.optionsPerPage),r=e.startIndex,s=e.endIndex,o,n=[];for(let h=r;h<s;h++)h===r&&r>0?o=tt.arrowUp:h===s-1&&s<t.length?o=tt.arrowDown:o=" ",n.push(this.renderOption(this.cursor,t[h],h,o));return`
|
|
33
33
|
`+n.join(`
|
|
34
|
-
`)}renderOptions(t){return this.done?"":this.paginateOptions(t)}renderDoneOrInstructions(){if(this.done)return this.value.filter(e=>e.selected).map(e=>e.title).join(", ");let t=[L.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&t.push(L.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Lh.hide),super.render();let t=[
|
|
34
|
+
`)}renderOptions(t){return this.done?"":this.paginateOptions(t)}renderDoneOrInstructions(){if(this.done)return this.value.filter(e=>e.selected).map(e=>e.title).join(", ");let t=[L.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&t.push(L.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Lh.hide),super.render();let t=[Gr.symbol(this.done,this.aborted),L.bold(this.msg),Gr.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=L.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),t+=this.renderOptions(this.value),this.out.write(this.clear+t),this.clear=Ur(t,this.out.columns)}};Jr.exports=$e});var ts=a((Ka,Qr)=>{"use strict";function zr(i,t,e,r,s,o,n){try{var h=i[o](n),l=h.value}catch(u){e(u);return}h.done?t(l):Promise.resolve(l).then(r,s)}function Nh(i){return function(){var t=this,e=arguments;return new Promise(function(r,s){var o=i.apply(t,e);function n(l){zr(o,r,s,n,h,"next",l)}function h(l){zr(o,r,s,n,h,"throw",l)}n(void 0)})}}var xt=w(),Vh=J(),Xr=x(),kh=Xr.erase,Wr=Xr.cursor,St=E(),Te=St.style,Kr=St.clear,Me=St.figures,Uh=St.wrap,Gh=St.entriesToDisplay,Zr=(i,t)=>i[t]&&(i[t].value||i[t].title||i[t]),Jh=(i,t)=>i[t]&&(i[t].title||i[t].value||i[t]),zh=(i,t)=>{let e=i.findIndex(r=>r.value===t||r.title===t);return e>-1?e:void 0},Pe=class extends Vh{constructor(t={}){super(t),this.msg=t.message,this.suggest=t.suggest,this.choices=t.choices,this.initial=typeof t.initial=="number"?t.initial:zh(t.choices,t.initial),this.select=this.initial||t.cursor||0,this.i18n={noMatches:t.noMatches||"no matches found"},this.fallback=t.fallback||this.initial,this.clearFirst=t.clearFirst||!1,this.suggestions=[],this.input="",this.limit=t.limit||10,this.cursor=0,this.transform=Te.render(t.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=Kr("",this.out.columns),this.complete(this.render),this.render()}set fallback(t){this._fb=Number.isSafeInteger(parseInt(t))?parseInt(t):t}get fallback(){let t;return typeof this._fb=="number"?t=this.choices[this._fb]:typeof this._fb=="string"&&(t={title:this._fb}),t||this._fb||{title:this.i18n.noMatches}}moveSelect(t){this.select=t,this.suggestions.length>0?this.value=Zr(this.suggestions,t):this.value=this.fallback.value,this.fire()}complete(t){var e=this;return Nh(function*(){let r=e.completing=e.suggest(e.input,e.choices),s=yield r;if(e.completing!==r)return;e.suggestions=s.map((n,h,l)=>({title:Jh(l,h),value:Zr(l,h),description:n.description})),e.completing=!1;let o=Math.max(s.length-1,0);e.moveSelect(Math.min(o,e.select)),t&&t()})()}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(`
|
|
35
35
|
`),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
36
36
|
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
37
37
|
`),this.close()}_(t,e){let r=this.input.slice(0,this.cursor),s=this.input.slice(this.cursor);this.input=`${r}${t}${s}`,this.cursor=r.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let t=this.input.slice(0,this.cursor-1),e=this.input.slice(this.cursor);this.input=`${t}${e}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let t=this.input.slice(0,this.cursor),e=this.input.slice(this.cursor+1);this.input=`${t}${e}`,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(t,e,r,s){let o,n=r?Me.arrowUp:s?Me.arrowDown:" ",h=e?xt.cyan().underline(t.title):t.title;return n=(e?xt.cyan(Me.pointer)+" ":" ")+n,t.description&&(o=` - ${t.description}`,(n.length+h.length+o.length>=this.out.columns||t.description.split(/\r?\n/).length>1)&&(o=`
|
|
38
|
-
`+Uh(t.description,{margin:3,width:this.out.columns}))),n+" "+h+xt.gray(o||"")}render(){if(this.closed)return;this.firstRender?this.out.write(
|
|
38
|
+
`+Uh(t.description,{margin:3,width:this.out.columns}))),n+" "+h+xt.gray(o||"")}render(){if(this.closed)return;this.firstRender?this.out.write(Wr.hide):this.out.write(Kr(this.outputText,this.out.columns)),super.render();let t=Gh(this.select,this.choices.length,this.limit),e=t.startIndex,r=t.endIndex;if(this.outputText=[Te.symbol(this.done,this.aborted,this.exited),xt.bold(this.msg),Te.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,r).map((o,n)=>this.renderOption(o,this.select===n+e,n===0&&e>0,n+e===r-1&&r<this.choices.length)).join(`
|
|
39
39
|
`);this.outputText+=`
|
|
40
|
-
`+(s||xt.gray(this.fallback.title))}this.out.write(kh.line+
|
|
40
|
+
`+(s||xt.gray(this.fallback.title))}this.out.write(kh.line+Wr.to(0)+this.outputText)}};Qr.exports=Pe});var ss=a((Za,rs)=>{"use strict";var K=w(),Wh=x(),Kh=Wh.cursor,Zh=qe(),Ce=E(),es=Ce.clear,is=Ce.style,at=Ce.figures,_e=class extends Zh{constructor(t={}){t.overrideRender=!0,super(t),this.inputValue="",this.clear=es("",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(t=>t.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 t=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(r=>this.inputValue?!!(typeof r.title=="string"&&r.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof r.value=="string"&&r.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);let e=this.filteredOptions.findIndex(r=>r===t);this.cursor=e<0?0:e,this.render()}handleSpaceToggle(){let t=this.filteredOptions[this.cursor];if(t.selected)t.selected=!1,this.render();else{if(t.disabled||this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();t.selected=!0,this.render()}}handleInputChange(t){this.inputValue=this.inputValue+t,this.updateFilteredOptions()}_(t,e){t===" "?this.handleSpaceToggle():this.handleInputChange(t)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
41
41
|
Instructions:
|
|
42
42
|
${at.arrowUp}/${at.arrowDown}: Highlight option
|
|
43
43
|
${at.arrowLeft}/${at.arrowRight}/[space]: Toggle selection
|
|
@@ -45,31 +45,31 @@ Instructions:
|
|
|
45
45
|
enter/return: Complete answer
|
|
46
46
|
`:""}renderCurrentInput(){return`
|
|
47
47
|
Filtered results for: ${this.inputValue?this.inputValue:K.gray("Enter something to filter")}
|
|
48
|
-
`}renderOption(t,e,r){let s;return e.disabled?s=t===r?K.gray().underline(e.title):K.strikethrough().gray(e.title):s=t===r?K.cyan().underline(e.title):e.title,(e.selected?K.green(at.radioOn):at.radioOff)+" "+s}renderDoneOrInstructions(){if(this.done)return this.value.filter(e=>e.selected).map(e=>e.title).join(", ");let t=[K.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&t.push(K.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Kh.hide),super.render();let t=[
|
|
48
|
+
`}renderOption(t,e,r){let s;return e.disabled?s=t===r?K.gray().underline(e.title):K.strikethrough().gray(e.title):s=t===r?K.cyan().underline(e.title):e.title,(e.selected?K.green(at.radioOn):at.radioOff)+" "+s}renderDoneOrInstructions(){if(this.done)return this.value.filter(e=>e.selected).map(e=>e.title).join(", ");let t=[K.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&t.push(K.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Kh.hide),super.render();let t=[is.symbol(this.done,this.aborted),K.bold(this.msg),is.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=K.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),t+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+t),this.clear=es(t,this.out.columns)}};rs.exports=_e});var cs=a((Xa,as)=>{"use strict";var ns=w(),Xh=J(),ls=E(),os=ls.style,Qh=ls.clear,us=x(),tl=us.erase,hs=us.cursor,Ie=class extends Xh{constructor(t={}){super(t),this.msg=t.message,this.value=t.initial,this.initialValue=!!t.initial,this.yesMsg=t.yes||"yes",this.yesOption=t.yesOption||"(Y/n)",this.noMsg=t.no||"no",this.noOption=t.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(`
|
|
49
49
|
`),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
50
|
-
`),this.close()}_(t,e){return t.toLowerCase()==="y"?(this.value=!0,this.submit()):t.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(
|
|
51
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,n=!1,h;return{s:function(){e=e.call(i)},n:function(){var u=e.next();return o=u.done,u},e:function(u){n=!0,h=u},f:function(){try{!o&&e.return!=null&&e.return()}finally{if(n)throw h}}}}function nl(i,t){if(i){if(typeof i=="string")return
|
|
50
|
+
`),this.close()}_(t,e){return t.toLowerCase()==="y"?(this.value=!0,this.submit()):t.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(hs.hide):this.out.write(Qh(this.outputText,this.out.columns)),super.render(),this.outputText=[os.symbol(this.done,this.aborted),ns.bold(this.msg),os.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:ns.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(tl.line+hs.to(0)+this.outputText))}};as.exports=Ie});var fs=a((Qa,ds)=>{"use strict";ds.exports={TextPrompt:Xi(),SelectPrompt:ir(),TogglePrompt:lr(),DatePrompt:Fr(),NumberPrompt:kr(),MultiselectPrompt:qe(),AutocompletePrompt:ts(),AutocompleteMultiselectPrompt:ss(),ConfirmPrompt:cs()}});var ms=a(ps=>{"use strict";var _=ps,el=fs(),Lt=i=>i;function B(i,t,e={}){return new Promise((r,s)=>{let o=new el[i](t),n=e.onAbort||Lt,h=e.onSubmit||Lt,l=e.onExit||Lt;o.on("state",t.onState||Lt),o.on("submit",u=>r(h(u))),o.on("exit",u=>r(l(u))),o.on("abort",u=>s(n(u)))})}_.text=i=>B("TextPrompt",i);_.password=i=>(i.style="password",_.text(i));_.invisible=i=>(i.style="invisible",_.text(i));_.number=i=>B("NumberPrompt",i);_.date=i=>B("DatePrompt",i);_.confirm=i=>B("ConfirmPrompt",i);_.list=i=>{let t=i.separator||",";return B("TextPrompt",i,{onSubmit:e=>e.split(t).map(r=>r.trim())})};_.toggle=i=>B("TogglePrompt",i);_.select=i=>B("SelectPrompt",i);_.multiselect=i=>{i.choices=[].concat(i.choices||[]);let t=e=>e.filter(r=>r.selected).map(r=>r.value);return B("MultiselectPrompt",i,{onAbort:t,onSubmit:t})};_.autocompleteMultiselect=i=>{i.choices=[].concat(i.choices||[]);let t=e=>e.filter(r=>r.selected).map(r=>r.value);return B("AutocompleteMultiselectPrompt",i,{onAbort:t,onSubmit:t})};var il=(i,t)=>Promise.resolve(t.filter(e=>e.title.slice(0,i.length).toLowerCase()===i.toLowerCase()));_.autocomplete=i=>(i.suggest=i.suggest||il,i.choices=[].concat(i.choices||[]),B("AutocompletePrompt",i))});var Os=a((ec,Ss)=>{"use strict";function gs(i,t){var e=Object.keys(i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(i);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(i,s).enumerable})),e.push.apply(e,r)}return e}function bs(i){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?gs(Object(e),!0).forEach(function(r){rl(i,r,e[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(e)):gs(Object(e)).forEach(function(r){Object.defineProperty(i,r,Object.getOwnPropertyDescriptor(e,r))})}return i}function rl(i,t,e){return t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function sl(i,t){var e=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!e){if(Array.isArray(i)||(e=nl(i))||t&&i&&typeof i.length=="number"){e&&(i=e);var r=0,s=function(){};return{s,n:function(){return r>=i.length?{done:!0}:{done:!1,value:i[r++]}},e:function(u){throw u},f:s}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
51
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,n=!1,h;return{s:function(){e=e.call(i)},n:function(){var u=e.next();return o=u.done,u},e:function(u){n=!0,h=u},f:function(){try{!o&&e.return!=null&&e.return()}finally{if(n)throw h}}}}function nl(i,t){if(i){if(typeof i=="string")return vs(i,t);var e=Object.prototype.toString.call(i).slice(8,-1);if(e==="Object"&&i.constructor&&(e=i.constructor.name),e==="Map"||e==="Set")return Array.from(i);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return vs(i,t)}}function vs(i,t){(t==null||t>i.length)&&(t=i.length);for(var e=0,r=new Array(t);e<t;e++)r[e]=i[e];return r}function ws(i,t,e,r,s,o,n){try{var h=i[o](n),l=h.value}catch(u){e(u);return}h.done?t(l):Promise.resolve(l).then(r,s)}function ys(i){return function(){var t=this,e=arguments;return new Promise(function(r,s){var o=i.apply(t,e);function n(l){ws(o,r,s,n,h,"next",l)}function h(l){ws(o,r,s,n,h,"throw",l)}n(void 0)})}}var De=ms(),ol=["suggest","format","onState","validate","onRender","type"],xs=()=>{};function et(){return Ee.apply(this,arguments)}function Ee(){return Ee=ys(function*(i=[],{onSubmit:t=xs,onCancel:e=xs}={}){let r={},s=et._override||{};i=[].concat(i);let o,n,h,l,u,S,m=function(){var D=ys(function*(O,k,T=!1){if(!(!T&&O.validate&&O.validate(k)!==!0))return O.format?yield O.format(k,r):k});return function(k,T){return D.apply(this,arguments)}}();var c=sl(i),p;try{for(c.s();!(p=c.n()).done;){n=p.value;var q=n;if(l=q.name,u=q.type,typeof u=="function"&&(u=yield u(o,bs({},r),n),n.type=u),!!u){for(let D in n){if(ol.includes(D))continue;let O=n[D];n[D]=typeof O=="function"?yield O(o,bs({},r),S):O}if(S=n,typeof n.message!="string")throw new Error("prompt message is required");var ft=n;if(l=ft.name,u=ft.type,De[u]===void 0)throw new Error(`prompt type (${u}) is not defined`);if(s[n.name]!==void 0&&(o=yield m(n,s[n.name]),o!==void 0)){r[l]=o;continue}try{o=et._injected?hl(et._injected,n.initial):yield De[u](n),r[l]=o=yield m(n,o,!0),h=yield t(n,o,r)}catch{h=!(yield e(n,r))}if(h)return r}}}catch(D){c.e(D)}finally{c.f()}return r}),Ee.apply(this,arguments)}function hl(i,t){let e=i.shift();if(e instanceof Error)throw e;return e===void 0?t:e}function ll(i){et._injected=(et._injected||[]).concat(i)}function ul(i){et._override=Object.assign({},i)}Ss.exports=Object.assign(et,{prompt:et,prompts:De,inject:ll,override:ul})});var qs=a((ic,$s)=>{"use strict";$s.exports=(i,t)=>{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(t){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 Bt=a((rc,Ts)=>{"use strict";Ts.exports=i=>{let t=["[\\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("|"),e=new RegExp(t,"g");return typeof i=="string"?i.replace(e,""):i}});var _s=a((sc,Ps)=>{"use strict";var al=Bt(),{erase:Ms,cursor:cl}=x(),dl=i=>[...al(i)].length;Ps.exports=function(i,t){if(!t)return Ms.line+cl.to(0);let e=0,r=i.split(/\r?\n/);for(let s of r)e+=1+Math.floor(Math.max(dl(s)-1,0)/t);return Ms.lines(e)}});var ot=a((nc,Cs)=>{"use strict";var Ot={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},fl={arrowUp:Ot.arrowUp,arrowDown:Ot.arrowDown,arrowLeft:Ot.arrowLeft,arrowRight:Ot.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},pl=process.platform==="win32"?fl:Ot;Cs.exports=pl});var Ds=a((oc,Is)=>{"use strict";var ct=w(),ht=ot(),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}`}}),ml=i=>Ae[i]||Ae.default,$t=Object.freeze({aborted:ct.red(ht.cross),done:ct.green(ht.tick),exited:ct.yellow(ht.cross),default:ct.cyan("?")}),gl=(i,t,e)=>t?$t.aborted:e?$t.exited:i?$t.done:$t.default,bl=i=>ct.gray(i?ht.ellipsis:ht.pointerSmall),vl=(i,t)=>ct.gray(i?t?ht.pointerSmall:"+":ht.line);Is.exports={styles:Ae,render:ml,symbols:$t,symbol:gl,delimiter:bl,item:vl}});var As=a((hc,Es)=>{"use strict";var wl=Bt();Es.exports=function(i,t){let e=String(wl(i)||"").split(/\r?\n/);return t?e.map(r=>Math.ceil(r.length/t)).reduce((r,s)=>r+s):e.length}});var Rs=a((lc,js)=>{"use strict";js.exports=(i,t={})=>{let e=Number.isSafeInteger(parseInt(t.margin))?new Array(parseInt(t.margin)).fill(" ").join(""):t.margin||"",r=t.width;return(i||"").split(/\r?\n/g).map(s=>s.split(/\s+/g).reduce((o,n)=>(n.length+e.length>=r||o[o.length-1].length+n.length+1<r?o[o.length-1]+=` ${n}`:o.push(`${e}${n}`),o),[e]).join(`
|
|
52
52
|
`)).join(`
|
|
53
|
-
`)}});var
|
|
53
|
+
`)}});var Ls=a((uc,Fs)=>{"use strict";Fs.exports=(i,t,e)=>{e=e||t;let r=Math.min(t-e,i-Math.floor(e/2));r<0&&(r=0);let s=Math.min(r+e,t);return{startIndex:r,endIndex:s}}});var A=a((ac,Bs)=>{"use strict";Bs.exports={action:qs(),clear:_s(),style:Ds(),strip:Bt(),figures:ot(),lines:As(),wrap:Rs(),entriesToDisplay:Ls()}});var Z=a((cc,Hs)=>{"use strict";var Ys=require("readline"),{action:yl}=A(),xl=require("events"),{beep:Sl,cursor:Ol}=x(),$l=w(),je=class extends xl{constructor(t={}){super(),this.firstRender=!0,this.in=t.stdin||process.stdin,this.out=t.stdout||process.stdout,this.onRender=(t.onRender||(()=>{})).bind(this);let e=Ys.createInterface({input:this.in,escapeCodeTimeout:50});Ys.emitKeypressEvents(this.in,e),this.in.isTTY&&this.in.setRawMode(!0);let r=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,s=(o,n)=>{let h=yl(n,r);h===!1?this._&&this._(o,n):typeof this[h]=="function"?this[h](n):this.bell()};this.close=()=>{this.out.write(Ol.show),this.in.removeListener("keypress",s),this.in.isTTY&&this.in.setRawMode(!1),e.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",s)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(Sl)}render(){this.onRender($l),this.firstRender&&(this.firstRender=!1)}};Hs.exports=je});var Vs=a((dc,Ns)=>{var Yt=w(),ql=Z(),{erase:Tl,cursor:qt}=x(),{style:Re,clear:Fe,lines:Ml,figures:Pl}=A(),Le=class extends ql{constructor(t={}){super(t),this.transform=Re.render(t.style),this.scale=this.transform.scale,this.msg=t.message,this.initial=t.initial||"",this.validator=t.validate||(()=>!0),this.value="",this.errorMsg=t.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=Fe("",this.out.columns),this.render()}set value(t){!t&&this.initial?(this.placeholder=!0,this.rendered=Yt.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(t)),this._value=t,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(`
|
|
54
54
|
`),this.close()}async validate(){let t=await this.validator(this.value);typeof t=="string"&&(this.errorMsg=t,t=!1),this.error=!t}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(`
|
|
55
55
|
`),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(t){this.placeholder||(this.cursor=this.cursor+t,this.cursorOffset+=t)}_(t,e){let r=this.value.slice(0,this.cursor),s=this.value.slice(this.cursor);this.value=`${r}${t}${s}`,this.red=!1,this.cursor=this.placeholder?0:r.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let t=this.value.slice(0,this.cursor-1),e=this.value.slice(this.cursor);this.value=`${t}${e}`,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 t=this.value.slice(0,this.cursor),e=this.value.slice(this.cursor+1);this.value=`${t}${e}`,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(qt.down(Ml(this.outputError,this.out.columns)-1)+Fe(this.outputError,this.out.columns)),this.out.write(Fe(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[Re.symbol(this.done,this.aborted),Yt.bold(this.msg),Re.delimiter(this.done),this.red?Yt.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
56
56
|
`).reduce((t,e,r)=>t+`
|
|
57
|
-
${r?" ":Pl.pointerSmall} ${Yt.red().italic(e)}`,"")),this.out.write(Tl.line+qt.to(0)+this.outputText+qt.save+this.outputError+qt.restore+qt.move(this.cursorOffset,0)))}};
|
|
57
|
+
${r?" ":Pl.pointerSmall} ${Yt.red().italic(e)}`,"")),this.out.write(Tl.line+qt.to(0)+this.outputText+qt.save+this.outputError+qt.restore+qt.move(this.cursorOffset,0)))}};Ns.exports=Le});var Js=a((fc,Gs)=>{"use strict";var X=w(),_l=Z(),{style:ks,clear:Us,figures:Ht,wrap:Cl,entriesToDisplay:Il}=A(),{cursor:Dl}=x(),Be=class extends _l{constructor(t={}){super(t),this.msg=t.message,this.hint=t.hint||"- Use arrow-keys. Return to submit.",this.warn=t.warn||"- This option is disabled",this.cursor=t.initial||0,this.choices=t.choices.map((e,r)=>(typeof e=="string"&&(e={title:e,value:r}),{title:e&&(e.title||e.value||e),value:e&&(e.value===void 0?r:e.value),description:e&&e.description,selected:e&&e.selected,disabled:e&&e.disabled})),this.optionsPerPage=t.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=Us("",this.out.columns),this.render()}moveCursor(t){this.cursor=t,this.value=this.choices[t].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(`
|
|
58
58
|
`),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
59
|
-
`),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()}_(t,e){if(t===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(Dl.hide):this.out.write(
|
|
59
|
+
`),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()}_(t,e){if(t===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(Dl.hide):this.out.write(Us(this.outputText,this.out.columns)),super.render();let{startIndex:t,endIndex:e}=Il(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[ks.symbol(this.done,this.aborted),X.bold(this.msg),ks.delimiter(!1),this.done?this.selection.title:this.selection.disabled?X.yellow(this.warn):X.gray(this.hint)].join(" "),!this.done){this.outputText+=`
|
|
60
60
|
`;for(let r=t;r<e;r++){let s,o,n="",h=this.choices[r];r===t&&t>0?o=Ht.arrowUp:r===e-1&&e<this.choices.length?o=Ht.arrowDown:o=" ",h.disabled?(s=this.cursor===r?X.gray().underline(h.title):X.strikethrough().gray(h.title),o=(this.cursor===r?X.bold().gray(Ht.pointer)+" ":" ")+o):(s=this.cursor===r?X.cyan().underline(h.title):h.title,o=(this.cursor===r?X.cyan(Ht.pointer)+" ":" ")+o,h.description&&this.cursor===r&&(n=` - ${h.description}`,(o.length+s.length+n.length>=this.out.columns||h.description.split(/\r?\n/).length>1)&&(n=`
|
|
61
61
|
`+Cl(h.description,{margin:3,width:this.out.columns})))),this.outputText+=`${o} ${s}${X.gray(n)}
|
|
62
|
-
`}}this.out.write(this.outputText)}};
|
|
62
|
+
`}}this.out.write(this.outputText)}};Gs.exports=Be});var Zs=a((pc,Ks)=>{var Nt=w(),El=Z(),{style:zs,clear:Al}=A(),{cursor:Ws,erase:jl}=x(),Ye=class extends El{constructor(t={}){super(t),this.msg=t.message,this.value=!!t.initial,this.active=t.active||"on",this.inactive=t.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(`
|
|
63
63
|
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
64
|
-
`),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()}_(t,e){if(t===" ")this.value=!this.value;else if(t==="1")this.value=!0;else if(t==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(
|
|
64
|
+
`),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()}_(t,e){if(t===" ")this.value=!this.value;else if(t==="1")this.value=!0;else if(t==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(Ws.hide):this.out.write(Al(this.outputText,this.out.columns)),super.render(),this.outputText=[zs.symbol(this.done,this.aborted),Nt.bold(this.msg),zs.delimiter(this.done),this.value?this.inactive:Nt.cyan().underline(this.inactive),Nt.gray("/"),this.value?Nt.cyan().underline(this.active):this.active].join(" "),this.out.write(jl.line+Ws.to(0)+this.outputText))}};Ks.exports=Ye});var Y=a((mc,Xs)=>{"use strict";var He=class i{constructor({token:t,date:e,parts:r,locales:s}){this.token=t,this.date=e||new Date,this.parts=r||[this],this.locales=s||{}}up(){}down(){}next(){let t=this.parts.indexOf(this);return this.parts.find((e,r)=>r>t&&e instanceof i)}setTo(t){}prev(){let t=[].concat(this.parts).reverse(),e=t.indexOf(this);return t.find((r,s)=>s>e&&r instanceof i)}toString(){return String(this.date)}};Xs.exports=He});var tn=a((gc,Qs)=>{"use strict";var Rl=Y(),Ne=class extends Rl{constructor(t={}){super(t)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let t=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?t.toUpperCase():t}};Qs.exports=Ne});var rn=a((bc,en)=>{"use strict";var Fl=Y(),Ll=i=>(i=i%10,i===1?"st":i===2?"nd":i===3?"rd":"th"),Ve=class extends Fl{constructor(t={}){super(t)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(t){this.date.setDate(parseInt(t.substr(-2)))}toString(){let t=this.date.getDate(),e=this.date.getDay();return this.token==="DD"?String(t).padStart(2,"0"):this.token==="Do"?t+Ll(t):this.token==="d"?e+1:this.token==="ddd"?this.locales.weekdaysShort[e]:this.token==="dddd"?this.locales.weekdays[e]:t}};en.exports=Ve});var nn=a((vc,sn)=>{"use strict";var Bl=Y(),ke=class extends Bl{constructor(t={}){super(t)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(t){this.date.setHours(parseInt(t.substr(-2)))}toString(){let t=this.date.getHours();return/h/.test(this.token)&&(t=t%12||12),this.token.length>1?String(t).padStart(2,"0"):t}};sn.exports=ke});var hn=a((wc,on)=>{"use strict";var Yl=Y(),Ue=class extends Yl{constructor(t={}){super(t)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(t){this.date.setMilliseconds(parseInt(t.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};on.exports=Ue});var un=a((yc,ln)=>{"use strict";var Hl=Y(),Ge=class extends Hl{constructor(t={}){super(t)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(t){this.date.setMinutes(parseInt(t.substr(-2)))}toString(){let t=this.date.getMinutes();return this.token.length>1?String(t).padStart(2,"0"):t}};ln.exports=Ge});var cn=a((xc,an)=>{"use strict";var Nl=Y(),Je=class extends Nl{constructor(t={}){super(t)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(t){t=parseInt(t.substr(-2))-1,this.date.setMonth(t<0?0:t)}toString(){let t=this.date.getMonth(),e=this.token.length;return e===2?String(t+1).padStart(2,"0"):e===3?this.locales.monthsShort[t]:e===4?this.locales.months[t]:String(t+1)}};an.exports=Je});var fn=a((Sc,dn)=>{"use strict";var Vl=Y(),ze=class extends Vl{constructor(t={}){super(t)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(t){this.date.setSeconds(parseInt(t.substr(-2)))}toString(){let t=this.date.getSeconds();return this.token.length>1?String(t).padStart(2,"0"):t}};dn.exports=ze});var mn=a((Oc,pn)=>{"use strict";var kl=Y(),We=class extends kl{constructor(t={}){super(t)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(t){this.date.setFullYear(t.substr(-4))}toString(){let t=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?t.substr(-2):t}};pn.exports=We});var bn=a(($c,gn)=>{"use strict";gn.exports={DatePart:Y(),Meridiem:tn(),Day:rn(),Hours:nn(),Milliseconds:hn(),Minutes:un(),Month:cn(),Seconds:fn(),Year:mn()}});var $n=a((qc,On)=>{"use strict";var Ke=w(),Ul=Z(),{style:vn,clear:wn,figures:Gl}=A(),{erase:Jl,cursor:yn}=x(),{DatePart:xn,Meridiem:zl,Day:Wl,Hours:Kl,Milliseconds:Zl,Minutes:Xl,Month:Ql,Seconds:tu,Year:eu}=bn(),iu=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,Sn={1:({token:i})=>i.replace(/\\(.)/g,"$1"),2:i=>new Wl(i),3:i=>new Ql(i),4:i=>new eu(i),5:i=>new zl(i),6:i=>new Kl(i),7:i=>new Xl(i),8:i=>new tu(i),9:i=>new Zl(i)},ru={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(",")},Ze=class extends Ul{constructor(t={}){super(t),this.msg=t.message,this.cursor=0,this.typed="",this.locales=Object.assign(ru,t.locales),this._date=t.initial||new Date,this.errorMsg=t.error||"Please Enter A Valid Value",this.validator=t.validate||(()=>!0),this.mask=t.mask||"YYYY-MM-DD HH:mm:ss",this.clear=wn("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(t){t&&this._date.setTime(t.getTime())}set mask(t){let e;for(this.parts=[];e=iu.exec(t);){let s=e.shift(),o=e.findIndex(n=>n!=null);this.parts.push(o in Sn?Sn[o]({token:e[o]||s,date:this.date,parts:this.parts,locales:this.locales}):e[o]||s)}let r=this.parts.reduce((s,o)=>(typeof o=="string"&&typeof s[s.length-1]=="string"?s[s.length-1]+=o:s.push(o),s),[]);this.parts.splice(0),this.parts.push(...r),this.reset()}moveCursor(t){this.typed="",this.cursor=t,this.fire()}reset(){this.moveCursor(this.parts.findIndex(t=>t instanceof xn)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
65
65
|
`),this.close()}async validate(){let t=await this.validator(this.value);typeof t=="string"&&(this.errorMsg=t,t=!1),this.error=!t}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(`
|
|
66
|
-
`),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let t=this.parts[this.cursor].prev();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}right(){let t=this.parts[this.cursor].next();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}next(){let t=this.parts[this.cursor].next();this.moveCursor(t?this.parts.indexOf(t):this.parts.findIndex(e=>e instanceof
|
|
66
|
+
`),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let t=this.parts[this.cursor].prev();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}right(){let t=this.parts[this.cursor].next();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}next(){let t=this.parts[this.cursor].next();this.moveCursor(t?this.parts.indexOf(t):this.parts.findIndex(e=>e instanceof xn)),this.render()}_(t){/\d/.test(t)&&(this.typed+=t,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(yn.hide):this.out.write(wn(this.outputText,this.out.columns)),super.render(),this.outputText=[vn.symbol(this.done,this.aborted),Ke.bold(this.msg),vn.delimiter(!1),this.parts.reduce((t,e,r)=>t.concat(r===this.cursor&&!this.done?Ke.cyan().underline(e.toString()):e),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
|
|
67
67
|
`).reduce((t,e,r)=>t+`
|
|
68
|
-
${r?" ":Gl.pointerSmall} ${Ke.red().italic(e)}`,"")),this.out.write(Jl.line+
|
|
68
|
+
${r?" ":Gl.pointerSmall} ${Ke.red().italic(e)}`,"")),this.out.write(Jl.line+yn.to(0)+this.outputText))}};On.exports=Ze});var Pn=a((Tc,Mn)=>{var Vt=w(),su=Z(),{cursor:kt,erase:nu}=x(),{style:Xe,figures:ou,clear:qn,lines:hu}=A(),lu=/[0-9]/,Qe=i=>i!==void 0,Tn=(i,t)=>{let e=Math.pow(10,t);return Math.round(i*e)/e},ti=class extends su{constructor(t={}){super(t),this.transform=Xe.render(t.style),this.msg=t.message,this.initial=Qe(t.initial)?t.initial:"",this.float=!!t.float,this.round=t.round||2,this.inc=t.increment||1,this.min=Qe(t.min)?t.min:-1/0,this.max=Qe(t.max)?t.max:1/0,this.errorMsg=t.error||"Please Enter A Valid Value",this.validator=t.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(t){!t&&t!==0?(this.placeholder=!0,this.rendered=Vt.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${Tn(t,this.round)}`),this._value=Tn(t,this.round)),this.fire()}get value(){return this._value}parse(t){return this.float?parseFloat(t):parseInt(t)}valid(t){return t==="-"||t==="."&&this.float||lu.test(t)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let t=this.value;this.value=t!==""?t:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
69
69
|
`),this.close()}async validate(){let t=await this.validator(this.value);typeof t=="string"&&(this.errorMsg=t,t=!1),this.error=!t}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}let t=this.value;this.value=t!==""?t:this.initial,this.done=!0,this.aborted=!1,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
70
|
-
`),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 t=this.value.toString();if(t.length===0)return this.bell();this.value=this.parse(t=t.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()}_(t,e){if(!this.valid(t))return this.bell();let r=Date.now();if(r-this.lastHit>1e3&&(this.typed=""),this.typed+=t,this.lastHit=r,this.color="cyan",t===".")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(kt.down(hu(this.outputError,this.out.columns)-1)
|
|
70
|
+
`),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 t=this.value.toString();if(t.length===0)return this.bell();this.value=this.parse(t=t.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()}_(t,e){if(!this.valid(t))return this.bell();let r=Date.now();if(r-this.lastHit>1e3&&(this.typed=""),this.typed+=t,this.lastHit=r,this.color="cyan",t===".")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(kt.down(hu(this.outputError,this.out.columns)-1)+qn(this.outputError,this.out.columns)),this.out.write(qn(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[Xe.symbol(this.done,this.aborted),Vt.bold(this.msg),Xe.delimiter(this.done),!this.done||!this.done&&!this.placeholder?Vt[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
71
71
|
`).reduce((t,e,r)=>t+`
|
|
72
|
-
${r?" ":ou.pointerSmall} ${Vt.red().italic(e)}`,"")),this.out.write(nu.line+kt.to(0)+this.outputText+kt.save+this.outputError+kt.restore))}};
|
|
72
|
+
${r?" ":ou.pointerSmall} ${Vt.red().italic(e)}`,"")),this.out.write(nu.line+kt.to(0)+this.outputText+kt.save+this.outputError+kt.restore))}};Mn.exports=ti});var ii=a((Mc,In)=>{"use strict";var H=w(),{cursor:uu}=x(),au=Z(),{clear:_n,figures:it,style:Cn,wrap:cu,entriesToDisplay:du}=A(),ei=class extends au{constructor(t={}){super(t),this.msg=t.message,this.cursor=t.cursor||0,this.scrollIndex=t.cursor||0,this.hint=t.hint||"",this.warn=t.warn||"- This option is disabled -",this.minSelected=t.min,this.showMinError=!1,this.maxChoices=t.max,this.instructions=t.instructions,this.optionsPerPage=t.optionsPerPage||10,this.value=t.choices.map((e,r)=>(typeof e=="string"&&(e={title:e,value:r}),{title:e&&(e.title||e.value||e),description:e&&e.description,value:e&&(e.value===void 0?r:e.value),selected:e&&e.selected,disabled:e&&e.disabled})),this.clear=_n("",this.out.columns),t.overrideRender||this.render()}reset(){this.value.map(t=>!t.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(t=>t.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
73
73
|
`),this.close()}submit(){let t=this.value.filter(e=>e.selected);this.minSelected&&t.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
74
74
|
`),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(t=>t.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){let t=this.value[this.cursor];if(t.selected)t.selected=!1,this.render();else{if(t.disabled||this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();t.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let t=!this.value[this.cursor].selected;this.value.filter(e=>!e.disabled).forEach(e=>e.selected=t),this.render()}_(t,e){if(t===" ")this.handleSpaceToggle();else if(t==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
75
75
|
Instructions:
|
|
@@ -79,13 +79,13 @@ Instructions:
|
|
|
79
79
|
`:"")+" enter/return: Complete answer":""}renderOption(t,e,r,s){let o=(e.selected?H.green(it.radioOn):it.radioOff)+" "+s+" ",n,h;return e.disabled?n=t===r?H.gray().underline(e.title):H.strikethrough().gray(e.title):(n=t===r?H.cyan().underline(e.title):e.title,t===r&&e.description&&(h=` - ${e.description}`,(o.length+n.length+h.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(h=`
|
|
80
80
|
`+cu(e.description,{margin:o.length,width:this.out.columns})))),o+n+H.gray(h||"")}paginateOptions(t){if(t.length===0)return H.red("No matches for this query.");let{startIndex:e,endIndex:r}=du(this.cursor,t.length,this.optionsPerPage),s,o=[];for(let n=e;n<r;n++)n===e&&e>0?s=it.arrowUp:n===r-1&&r<t.length?s=it.arrowDown:s=" ",o.push(this.renderOption(this.cursor,t[n],n,s));return`
|
|
81
81
|
`+o.join(`
|
|
82
|
-
`)}renderOptions(t){return this.done?"":this.paginateOptions(t)}renderDoneOrInstructions(){if(this.done)return this.value.filter(e=>e.selected).map(e=>e.title).join(", ");let t=[H.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&t.push(H.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(uu.hide),super.render();let t=[
|
|
82
|
+
`)}renderOptions(t){return this.done?"":this.paginateOptions(t)}renderDoneOrInstructions(){if(this.done)return this.value.filter(e=>e.selected).map(e=>e.title).join(", ");let t=[H.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&t.push(H.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(uu.hide),super.render();let t=[Cn.symbol(this.done,this.aborted),H.bold(this.msg),Cn.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=H.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),t+=this.renderOptions(this.value),this.out.write(this.clear+t),this.clear=_n(t,this.out.columns)}};In.exports=ei});var Rn=a((Pc,jn)=>{"use strict";var Tt=w(),fu=Z(),{erase:pu,cursor:Dn}=x(),{style:ri,clear:En,figures:si,wrap:mu,entriesToDisplay:gu}=A(),An=(i,t)=>i[t]&&(i[t].value||i[t].title||i[t]),bu=(i,t)=>i[t]&&(i[t].title||i[t].value||i[t]),vu=(i,t)=>{let e=i.findIndex(r=>r.value===t||r.title===t);return e>-1?e:void 0},ni=class extends fu{constructor(t={}){super(t),this.msg=t.message,this.suggest=t.suggest,this.choices=t.choices,this.initial=typeof t.initial=="number"?t.initial:vu(t.choices,t.initial),this.select=this.initial||t.cursor||0,this.i18n={noMatches:t.noMatches||"no matches found"},this.fallback=t.fallback||this.initial,this.clearFirst=t.clearFirst||!1,this.suggestions=[],this.input="",this.limit=t.limit||10,this.cursor=0,this.transform=ri.render(t.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=En("",this.out.columns),this.complete(this.render),this.render()}set fallback(t){this._fb=Number.isSafeInteger(parseInt(t))?parseInt(t):t}get fallback(){let t;return typeof this._fb=="number"?t=this.choices[this._fb]:typeof this._fb=="string"&&(t={title:this._fb}),t||this._fb||{title:this.i18n.noMatches}}moveSelect(t){this.select=t,this.suggestions.length>0?this.value=An(this.suggestions,t):this.value=this.fallback.value,this.fire()}async complete(t){let e=this.completing=this.suggest(this.input,this.choices),r=await e;if(this.completing!==e)return;this.suggestions=r.map((o,n,h)=>({title:bu(h,n),value:An(h,n),description:o.description})),this.completing=!1;let s=Math.max(r.length-1,0);this.moveSelect(Math.min(s,this.select)),t&&t()}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(`
|
|
83
83
|
`),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
84
84
|
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
85
85
|
`),this.close()}_(t,e){let r=this.input.slice(0,this.cursor),s=this.input.slice(this.cursor);this.input=`${r}${t}${s}`,this.cursor=r.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let t=this.input.slice(0,this.cursor-1),e=this.input.slice(this.cursor);this.input=`${t}${e}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let t=this.input.slice(0,this.cursor),e=this.input.slice(this.cursor+1);this.input=`${t}${e}`,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(t,e,r,s){let o,n=r?si.arrowUp:s?si.arrowDown:" ",h=e?Tt.cyan().underline(t.title):t.title;return n=(e?Tt.cyan(si.pointer)+" ":" ")+n,t.description&&(o=` - ${t.description}`,(n.length+h.length+o.length>=this.out.columns||t.description.split(/\r?\n/).length>1)&&(o=`
|
|
86
|
-
`+mu(t.description,{margin:3,width:this.out.columns}))),n+" "+h+Tt.gray(o||"")}render(){if(this.closed)return;this.firstRender?this.out.write(
|
|
86
|
+
`+mu(t.description,{margin:3,width:this.out.columns}))),n+" "+h+Tt.gray(o||"")}render(){if(this.closed)return;this.firstRender?this.out.write(Dn.hide):this.out.write(En(this.outputText,this.out.columns)),super.render();let{startIndex:t,endIndex:e}=gu(this.select,this.choices.length,this.limit);if(this.outputText=[ri.symbol(this.done,this.aborted,this.exited),Tt.bold(this.msg),ri.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,e).map((s,o)=>this.renderOption(s,this.select===o+t,o===0&&t>0,o+t===e-1&&e<this.choices.length)).join(`
|
|
87
87
|
`);this.outputText+=`
|
|
88
|
-
`+(r||Tt.gray(this.fallback.title))}this.out.write(pu.line+
|
|
88
|
+
`+(r||Tt.gray(this.fallback.title))}this.out.write(pu.line+Dn.to(0)+this.outputText)}};jn.exports=ni});var Yn=a((_c,Bn)=>{"use strict";var Q=w(),{cursor:wu}=x(),yu=ii(),{clear:Fn,style:Ln,figures:dt}=A(),oi=class extends yu{constructor(t={}){t.overrideRender=!0,super(t),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(t=>t.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 t=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(r=>this.inputValue?!!(typeof r.title=="string"&&r.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof r.value=="string"&&r.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);let e=this.filteredOptions.findIndex(r=>r===t);this.cursor=e<0?0:e,this.render()}handleSpaceToggle(){let t=this.filteredOptions[this.cursor];if(t.selected)t.selected=!1,this.render();else{if(t.disabled||this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();t.selected=!0,this.render()}}handleInputChange(t){this.inputValue=this.inputValue+t,this.updateFilteredOptions()}_(t,e){t===" "?this.handleSpaceToggle():this.handleInputChange(t)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
89
89
|
Instructions:
|
|
90
90
|
${dt.arrowUp}/${dt.arrowDown}: Highlight option
|
|
91
91
|
${dt.arrowLeft}/${dt.arrowRight}/[space]: Toggle selection
|
|
@@ -93,8 +93,8 @@ Instructions:
|
|
|
93
93
|
enter/return: Complete answer
|
|
94
94
|
`:""}renderCurrentInput(){return`
|
|
95
95
|
Filtered results for: ${this.inputValue?this.inputValue:Q.gray("Enter something to filter")}
|
|
96
|
-
`}renderOption(t,e,r){let s;return e.disabled?s=t===r?Q.gray().underline(e.title):Q.strikethrough().gray(e.title):s=t===r?Q.cyan().underline(e.title):e.title,(e.selected?Q.green(dt.radioOn):dt.radioOff)+" "+s}renderDoneOrInstructions(){if(this.done)return this.value.filter(e=>e.selected).map(e=>e.title).join(", ");let t=[Q.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&t.push(Q.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(wu.hide),super.render();let t=[
|
|
96
|
+
`}renderOption(t,e,r){let s;return e.disabled?s=t===r?Q.gray().underline(e.title):Q.strikethrough().gray(e.title):s=t===r?Q.cyan().underline(e.title):e.title,(e.selected?Q.green(dt.radioOn):dt.radioOff)+" "+s}renderDoneOrInstructions(){if(this.done)return this.value.filter(e=>e.selected).map(e=>e.title).join(", ");let t=[Q.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&t.push(Q.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(wu.hide),super.render();let t=[Ln.symbol(this.done,this.aborted),Q.bold(this.msg),Ln.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=Q.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),t+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+t),this.clear=Fn(t,this.out.columns)}};Bn.exports=oi});var Un=a((Cc,kn)=>{var Hn=w(),xu=Z(),{style:Nn,clear:Su}=A(),{erase:Ou,cursor:Vn}=x(),hi=class extends xu{constructor(t={}){super(t),this.msg=t.message,this.value=t.initial,this.initialValue=!!t.initial,this.yesMsg=t.yes||"yes",this.yesOption=t.yesOption||"(Y/n)",this.noMsg=t.no||"no",this.noOption=t.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(`
|
|
97
97
|
`),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
98
|
-
`),this.close()}_(t,e){return t.toLowerCase()==="y"?(this.value=!0,this.submit()):t.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(
|
|
98
|
+
`),this.close()}_(t,e){return t.toLowerCase()==="y"?(this.value=!0,this.submit()):t.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(Vn.hide):this.out.write(Su(this.outputText,this.out.columns)),super.render(),this.outputText=[Nn.symbol(this.done,this.aborted),Hn.bold(this.msg),Nn.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:Hn.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(Ou.line+Vn.to(0)+this.outputText))}};kn.exports=hi});var Jn=a((Ic,Gn)=>{"use strict";Gn.exports={TextPrompt:Vs(),SelectPrompt:Js(),TogglePrompt:Zs(),DatePrompt:$n(),NumberPrompt:Pn(),MultiselectPrompt:ii(),AutocompletePrompt:Rn(),AutocompleteMultiselectPrompt:Yn(),ConfirmPrompt:Un()}});var Wn=a(zn=>{"use strict";var C=zn,$u=Jn(),Ut=i=>i;function N(i,t,e={}){return new Promise((r,s)=>{let o=new $u[i](t),n=e.onAbort||Ut,h=e.onSubmit||Ut,l=e.onExit||Ut;o.on("state",t.onState||Ut),o.on("submit",u=>r(h(u))),o.on("exit",u=>r(l(u))),o.on("abort",u=>s(n(u)))})}C.text=i=>N("TextPrompt",i);C.password=i=>(i.style="password",C.text(i));C.invisible=i=>(i.style="invisible",C.text(i));C.number=i=>N("NumberPrompt",i);C.date=i=>N("DatePrompt",i);C.confirm=i=>N("ConfirmPrompt",i);C.list=i=>{let t=i.separator||",";return N("TextPrompt",i,{onSubmit:e=>e.split(t).map(r=>r.trim())})};C.toggle=i=>N("TogglePrompt",i);C.select=i=>N("SelectPrompt",i);C.multiselect=i=>{i.choices=[].concat(i.choices||[]);let t=e=>e.filter(r=>r.selected).map(r=>r.value);return N("MultiselectPrompt",i,{onAbort:t,onSubmit:t})};C.autocompleteMultiselect=i=>{i.choices=[].concat(i.choices||[]);let t=e=>e.filter(r=>r.selected).map(r=>r.value);return N("AutocompleteMultiselectPrompt",i,{onAbort:t,onSubmit:t})};var qu=(i,t)=>Promise.resolve(t.filter(e=>e.title.slice(0,i.length).toLowerCase()===i.toLowerCase()));C.autocomplete=i=>(i.suggest=i.suggest||qu,i.choices=[].concat(i.choices||[]),N("AutocompletePrompt",i))});var Xn=a((Ec,Zn)=>{"use strict";var li=Wn(),Tu=["suggest","format","onState","validate","onRender","type"],Kn=()=>{};async function rt(i=[],{onSubmit:t=Kn,onCancel:e=Kn}={}){let r={},s=rt._override||{};i=[].concat(i);let o,n,h,l,u,S,m=async(c,p,q=!1)=>{if(!(!q&&c.validate&&c.validate(p)!==!0))return c.format?await c.format(p,r):p};for(n of i)if({name:l,type:u}=n,typeof u=="function"&&(u=await u(o,{...r},n),n.type=u),!!u){for(let c in n){if(Tu.includes(c))continue;let p=n[c];n[c]=typeof p=="function"?await p(o,{...r},S):p}if(S=n,typeof n.message!="string")throw new Error("prompt message is required");if({name:l,type:u}=n,li[u]===void 0)throw new Error(`prompt type (${u}) is not defined`);if(s[n.name]!==void 0&&(o=await m(n,s[n.name]),o!==void 0)){r[l]=o;continue}try{o=rt._injected?Mu(rt._injected,n.initial):await li[u](n),r[l]=o=await m(n,o,!0),h=await t(n,o,r)}catch{h=!await e(n,r)}if(h)return r}return r}function Mu(i,t){let e=i.shift();if(e instanceof Error)throw e;return e===void 0?t:e}function Pu(i){rt._injected=(rt._injected||[]).concat(i)}function _u(i){rt._override=Object.assign({},i)}Zn.exports=Object.assign(rt,{prompt:rt,prompts:li,inject:Pu,override:_u})});var ui=a((Ac,Qn)=>{function Cu(i){i=(Array.isArray(i)?i:i.split(".")).map(Number);let t=0,e=process.versions.node.split(".").map(Number);for(;t<i.length;t++){if(e[t]>i[t])return!1;if(i[t]>e[t])return!0}return!1}Qn.exports=Cu("8.6.0")?Os():Xn()});var V=require("fs"),bo=require("path"),Pt=I(require("process"),1);var st=!0,lt=typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{},mt=0;if(lt.process&<.process.env&<.process.stdout){let{FORCE_COLOR:i,NODE_DISABLE_COLORS:t,NO_COLOR:e,TERM:r,COLORTERM:s}=lt.process.env;t||e||i==="0"?st=!1:i==="1"||i==="2"||i==="3"?st=!0:r==="dumb"?st=!1:"CI"in lt.process.env&&["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(o=>o in lt.process.env)?st=!0:st=process.stdout.isTTY,st&&(process.platform==="win32"||s&&(s==="truecolor"||s==="24bit")?mt=3:r&&(r.endsWith("-256color")||r.endsWith("256"))?mt=2:mt=1)}var vi={enabled:st,supportLevel:mt};function d(i,t,e=1){let r=`\x1B[${i}m`,s=`\x1B[${t}m`,o=new RegExp(`\\x1b\\[${t}m`,"g");return n=>vi.enabled&&vi.supportLevel>=e?r+(""+n).replace(o,r)+s:""+n}var Lu=d(0,0),M=d(1,22),Bu=d(2,22),Yu=d(3,23),Hu=d(4,24),Nu=d(7,27),Vu=d(8,28),ku=d(9,29),Uu=d(30,39),P=d(31,39),R=d(32,39),Gu=d(33,39),Ju=d(34,39),zu=d(35,39),Wu=d(36,39),Ku=d(97,39),Zu=d(90,39),Xu=d(37,39),Qu=d(91,39),ta=d(92,39),ea=d(93,39),ia=d(94,39),ra=d(95,39),wi=d(96,39),sa=d(40,49),na=d(41,49),oa=d(42,49),ha=d(43,49),la=d(44,49),ua=d(45,49),aa=d(46,49),ca=d(107,49),da=d(100,49),fa=d(101,49),pa=d(102,49),ma=d(103,49),ga=d(104,49),ba=d(105,49),va=d(106,49),wa=d(47,49);var vo=I(Oi(),1),wo=I(ui(),1),gi=I(ot(),1);var po=I(ui(),1);var mo=I(ot(),1);var ao=I(ot(),1);var Gt=require("fs");function Jt(i){if(!(0,Gt.existsSync)(i))return!0;let t=(0,Gt.readdirSync)(i);return t.length===0||t.length===1&&t[0]===".git"}var eo=require("child_process"),io=require("fs"),ro=require("path"),so=I(require("process"),1);var zt=require("fs"),to=require("path");function Iu(i,t){let e=JSON.parse((0,zt.readFileSync)(i,"utf8"));e.name=t,(0,zt.writeFileSync)(i,JSON.stringify(e,null,2))}function Wt(i,t){let e=t.toLocaleLowerCase().replace(/\s/g,"-"),r=(0,to.join)(i,"package.json");Iu(r,e)}async function Du(i){let t=(0,ro.join)(i,".git");await io.promises.rm(t,{recursive:!0,force:!0})}async function Eu(i,t,e){let r=null;for(let s of i)try{await new Promise((o,n)=>{let h=`git clone -b ${t} ${s} ${e}`;(0,eo.exec)(h,async l=>{if(l){console.error(`${P("exec error:")} ${l}`),n(l);return}try{await Du(e),o()}catch(u){n(u)}})});return}catch(o){console.error(`${P("cloneRepo error:")} ${o}`),r=o}if(r)throw new Error("All URLs failed")}function Au(i){let{github:t,gitee:e}=i;return[e,t].filter(Boolean)}async function no(i,t,e,r){var o;let s=Au(i.url);try{await Eu(s,i.branch||"main",e)}catch{r.fail(`${M("\u6A21\u677F\u521B\u5EFA\u5931\u8D25\uFF01")}`),so.default.exit(1)}Wt(e,t),(o=i.callBack)==null||o.call(i,e)}var ai=I(require("process"),1);function oo(){let i="Unibest-creator - \u5FEB\u901F\u521B\u5EFA unibest(uni-app) \u9879\u76EE",t="",e={r:59,g:209,b:145},r={r:43,g:76,b:238};for(let o=0;o<i.length;o++){let n=o/(i.length-1),h=Math.round(e.r+(r.r-e.r)*n),l=Math.round(e.g+(r.g-e.g)*n),u=Math.round(e.b+(r.b-e.b)*n);t+=`\x1B[38;2;${h};${l};${u}m${i[o]}\x1B[0m`}let s=ai.default.stdout.isTTY&&ai.default.stdout.getColorDepth()>8?t:wi(i);console.log(),console.log(s),console.log()}var Kt=I(require("process"),1);var ci=I(ot(),1),ju=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],di=class{constructor(t){this.message=t,this.interval=null}setFinishMessage(t){return t+" ".repeat(this.message.length-t.length)}start(){let t=0;return this.interval=setInterval(()=>{Kt.default.stdout.write(`\r${ju[t%9]} ${this.message}`),t++},100),this}fail(t){this.interval&&(clearInterval(this.interval),Kt.default.stdout.write(`\r${P(ci.default.cross)} ${this.setFinishMessage(t)}
|
|
99
99
|
`))}succeed(t){this.interval&&(clearInterval(this.interval),Kt.default.stdout.write(`\r${R(ci.default.tick)} ${this.setFinishMessage(t)}
|
|
100
|
-
`))}};function
|
|
100
|
+
`))}};function ho(i){return new di(i)}var Mt=I(require("fs"),1),lo=I(require("path"),1);var fi=(i,t,e)=>{for(let r of Mt.readdirSync(i)){if(r===".git")continue;let s=lo.resolve(i,r);if(Mt.lstatSync(s).isDirectory()){fi(s,t,e),t(s);continue}e(s)}};var uo=require("path");function pi(i,t,e){return t==="install"?i==="yarn"?"yarn":`${i} install`:e?i==="npm"?`npm run ${t} -- ${e}`:`${i} ${t} ${e}`:i==="npm"?`npm run ${t}`:`${i} ${t}`}function mi(i,t,e,r){if(r.succeed(`${M("\u6A21\u677F\u521B\u5EFA\u5B8C\u6210\uFF01")}`),console.log(),i!==t){let s=(0,uo.relative)(t,i);console.log(` ${M(R(`cd ${s.includes(" ")?`"${s}"`:s}`))}`)}console.log(` ${M(R(pi(e,"i")))}`),console.log(` ${M(R(pi(e,"dev")))}`),console.log()}var Zt=i=>[{name:"shouldOverwrite",type:t=>Jt(i??t)?null:"toggle",message:t=>{let e=i??t;return`${e==="."?"\u5F53\u524D\u6587\u4EF6":`\u76EE\u6807\u6587\u4EF6"${e}"`}\u975E\u7A7A\uFF0C\u662F\u5426\u8986\u76D6\uFF1F`},initial:!1,active:"\u662F",inactive:"\u5426"},{name:"overwriteChecker",type:t=>{if(t===!1)throw new Error(`${P(ao.default.cross)} ${M("\u64CD\u4F5C\u5DF2\u53D6\u6D88")}`);return null}}];var co=()=>[{name:"projectName",type:"text",message:"\u8BF7\u8F93\u5165\u9879\u76EE\u540D\u79F0:",initial:"unibest"},...Zt()];var Xt=[{title:`base${R("(\u63A8\u8350)")}`,description:`${P("(\u591ATAB base\u9879\u76EE)")}`,value:{type:"base",branch:"base",url:{gitee:"https://gitee.com/codercup/unibest.git",github:"https://github.com/codercup/unibest.git"}}},{title:`demo${R("(\u6F14\u793A\u9879\u76EE)")}`,description:`${P("(\u591ATAB\u6F14\u793A\u9879\u76EE)")}`,value:{type:"demo",branch:"demo",url:{gitee:"https://gitee.com/codercup/unibest.git",github:"https://github.com/codercup/unibest.git"}}},{title:`i18n${R("(\u591A\u8BED\u8A00)")}`,description:`${P("(\u591ATAB\u591A\u8BED\u8A00\u9879\u76EE)")}`,value:{type:"i18n",branch:"i18n",url:{gitee:"https://gitee.com/codercup/unibest.git",github:"https://github.com/codercup/unibest.git"}}}];var fo=()=>({name:"templateType",type:"select",message:"\u8BF7\u9009\u62E9 uni-app \u6A21\u677F\uFF1F",hint:"\u4F7F\u7528\u65B9\u5411\u952E\u9009\u62E9\uFF0C\u56DE\u8F66\u786E\u8BA4",choices:[...Xt],initial:0});async function go(){let i=[...co(),fo()];return await(0,po.default)(i,{onCancel:()=>{throw new Error(`${P(mo.default.cross)} ${M("\u64CD\u4F5C\u5DF2\u53D6\u6D88")}`)}})}var _t;async function Ru(){var u;oo();let i=(0,vo.default)(Pt.default.argv.slice(2),{alias:{templateType:["t"]},string:["_"]}),t=i._[0],e={};if(t){let S=(u=Xt.find(c=>c.value.type===(i==null?void 0:i.t)))==null?void 0:u.value;!S&&(i!=null&&i.templateType)&&(console.log(`${P(gi.default.cross)} ${M(`\u672A\u83B7\u53D6\u5230${i==null?void 0:i.templateType}\u6A21\u677F`)}`),Pt.default.exit(1));let m=()=>{throw new Error(`${P(gi.default.cross)} ${M("\u64CD\u4F5C\u5DF2\u53D6\u6D88")}`)};e={projectName:t,shouldOverwrite:Jt(t)?!0:(await(0,wo.default)(Zt(t),{onCancel:m})).shouldOverwrite,templateType:S||{type:"base",branch:"base",url:{gitee:"https://gitee.com/codercup/unibest.git",github:"https://github.com/codercup/unibest.git"}}}}else try{e=await go()}catch(S){console.log(S.message),Pt.default.exit(1)}_t=ho(`${M("\u6B63\u5728\u521B\u5EFA\u6A21\u677F...")}`).start();let r=Pt.default.cwd(),s=(0,bo.join)(r,e.projectName),o="pnpm";function n(S){(0,V.existsSync)(S)&&fi(S,m=>(0,V.rmdirSync)(m),m=>(0,V.unlinkSync)(m))}if((0,V.existsSync)(s)&&e.shouldOverwrite?n(s):(0,V.existsSync)(s)||(0,V.mkdirSync)(s),e.templateType.type!=="custom"){let{templateType:S,projectName:m}=e;await no(S,m,s,_t),mi(s,r,o,_t);return}let h=[],l={};for(let S of h)await S(l);Wt(s,e.projectName),mi(s,r,o,_t)}Ru().catch(i=>{_t.fail(`${M("\u6A21\u677F\u521B\u5EFA\u5931\u8D25\uFF01")}`),console.error(i)});
|