create-ts-vite-project 0.4.0 → 0.5.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/.gitignore +0 -3
- package/README.md +51 -74
- package/dist/index.min.js +51 -51
- package/package.json +1 -1
- package/template/capacitor/capacitor.config.ts +30 -3
- package/template/common/eslint.config.js +2 -3
- package/template/common/public/icon-only.png +0 -0
- package/template/common/public/splash.png +0 -0
- package/template/common/tsconfig.json +0 -2
- package/template/electron-builder/electron-builder.config.js +17 -12
- package/template/electron-forge/forge.config.js +11 -5
- package/template/electron/electron/background.png +0 -0
- /package/template/{electron/electron → common/public}/app.ico +0 -0
- /package/template/{electron/electron → common/public}/app.svg +0 -0
- /package/template/{electron/electron/app.png → common/public/icon-foreground.png} +0 -0
package/.gitignore
CHANGED
|
@@ -17,12 +17,10 @@ node_modules/
|
|
|
17
17
|
!.yarn/versions
|
|
18
18
|
|
|
19
19
|
# Build outputs
|
|
20
|
-
android/
|
|
21
20
|
build/
|
|
22
21
|
coverage/
|
|
23
22
|
dist/
|
|
24
23
|
dist-ssr/
|
|
25
|
-
out/
|
|
26
24
|
platforms/
|
|
27
25
|
src-tauri/
|
|
28
26
|
*.tsbuildinfo
|
|
@@ -49,7 +47,6 @@ Thumbs.db
|
|
|
49
47
|
# Temporary folders
|
|
50
48
|
tmp/
|
|
51
49
|
temp/
|
|
52
|
-
.out/
|
|
53
50
|
|
|
54
51
|
# Jest
|
|
55
52
|
jest-cache/
|
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
- модули ECMAScript (вместо CommonJS),
|
|
11
11
|
- стандарт ES2022.
|
|
12
12
|
|
|
13
|
-
#
|
|
13
|
+
# Быстрый запуск
|
|
14
14
|
|
|
15
15
|
Выполняем
|
|
16
16
|
|
|
@@ -19,13 +19,9 @@ yarn create ts-vite-project
|
|
|
19
19
|
# npm create ts-vite-project
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
> Первым аргументом можно указать название проекта. Тогда будет выполнена автоматическая ускоренная установка без дополнительных вопросов. Также автоматически будут установлены базовые зависимости.
|
|
25
|
-
|
|
26
|
-
# Быстрый запуск
|
|
22
|
+
И следуем указаниям в консоли.
|
|
27
23
|
|
|
28
|
-
|
|
24
|
+
Запуск в режиме разработки:
|
|
29
25
|
|
|
30
26
|
```
|
|
31
27
|
yarn dev
|
|
@@ -55,7 +51,7 @@ yarn preview
|
|
|
55
51
|
# npm run preview
|
|
56
52
|
```
|
|
57
53
|
|
|
58
|
-
# Запуск под
|
|
54
|
+
# Запуск под десктопные устройства
|
|
59
55
|
|
|
60
56
|
В режиме разработки
|
|
61
57
|
|
|
@@ -96,7 +92,7 @@ yarn electron:build
|
|
|
96
92
|
Готовое приложение будет лежать в каталоге
|
|
97
93
|
|
|
98
94
|
```
|
|
99
|
-
|
|
95
|
+
build/electron-builder
|
|
100
96
|
```
|
|
101
97
|
|
|
102
98
|
## Electron Forge
|
|
@@ -131,34 +127,31 @@ yarn electron:make
|
|
|
131
127
|
Готовое приложение будет лежать в каталоге
|
|
132
128
|
|
|
133
129
|
```
|
|
134
|
-
|
|
130
|
+
build/electron-forge
|
|
135
131
|
```
|
|
136
132
|
|
|
137
|
-
## Билд
|
|
133
|
+
## Билд для MacOS
|
|
134
|
+
|
|
135
|
+
Сборка производится только на устройствах Mac с установленной средой разработки XCode.
|
|
138
136
|
|
|
139
|
-
|
|
137
|
+
> следующая информация не проверена
|
|
140
138
|
|
|
141
|
-
Добавить в **forge.config.js**:
|
|
139
|
+
Добавить в **forge.config.js**, в секцию **packagerConfig**:
|
|
142
140
|
|
|
143
141
|
```
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
tool: 'notarytool',
|
|
158
|
-
appleId: process.env.APPLE_ID,
|
|
159
|
-
appleIdPassword: process.env.APPLE_PASSWORD,
|
|
160
|
-
teamId: process.env.APPLE_TEAM_ID
|
|
161
|
-
}
|
|
142
|
+
appCategoryType: 'public.app-category.productivity',
|
|
143
|
+
osxSign: {
|
|
144
|
+
identity: 'Developer ID Application: Your Name (TEAM_ID)',
|
|
145
|
+
'hardened-runtime': true,
|
|
146
|
+
entitlements: 'entitlements.plist',
|
|
147
|
+
'entitlements-inherit': 'entitlements.plist',
|
|
148
|
+
'signature-flags': 'library',
|
|
149
|
+
},
|
|
150
|
+
osxNotarize: {
|
|
151
|
+
tool: 'notarytool',
|
|
152
|
+
appleId: process.env.APPLE_ID,
|
|
153
|
+
appleIdPassword: process.env.APPLE_PASSWORD,
|
|
154
|
+
teamId: process.env.APPLE_TEAM_ID,
|
|
162
155
|
},
|
|
163
156
|
```
|
|
164
157
|
|
|
@@ -166,11 +159,10 @@ out/make/squirrel.windows
|
|
|
166
159
|
|
|
167
160
|
```
|
|
168
161
|
packagerConfig: {
|
|
169
|
-
name: 'YourApp',
|
|
170
162
|
osxSign: {},
|
|
171
163
|
osxNotarize: {
|
|
172
164
|
tool: 'notarytool',
|
|
173
|
-
}
|
|
165
|
+
},
|
|
174
166
|
},
|
|
175
167
|
```
|
|
176
168
|
|
|
@@ -217,9 +209,9 @@ npm run make -- --platform darwin --arch universal
|
|
|
217
209
|
npm run build --electron-mac-sign --product-id="your-product-id" --app-id="your-app-id" --name="Your-app-name" --version="version-number" --keystore-path=path/to/keystore-file.p12 --store-password=password
|
|
218
210
|
```
|
|
219
211
|
|
|
220
|
-
## Подготовка к сборке
|
|
212
|
+
## Подготовка к сборке для Android
|
|
221
213
|
|
|
222
|
-
Сборку делаем через
|
|
214
|
+
Сборку делаем через **Capacitor**.
|
|
223
215
|
|
|
224
216
|
Для настройки отредактируйте файл
|
|
225
217
|
|
|
@@ -227,85 +219,66 @@ npm run build --electron-mac-sign --product-id="your-product-id" --app-id="your-
|
|
|
227
219
|
capacitor.config.ts
|
|
228
220
|
```
|
|
229
221
|
|
|
230
|
-
Добавляем мобильное
|
|
222
|
+
Добавляем мобильное устройство
|
|
231
223
|
|
|
232
224
|
```
|
|
233
|
-
yarn
|
|
225
|
+
yarn capacitor:android
|
|
226
|
+
yarn capacitor:ios
|
|
234
227
|
```
|
|
235
228
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
Мы создали другой каталог app, где вы можете хранить все настройки и ресурсы для сборки.
|
|
239
|
-
|
|
240
|
-
Перед сборкой вам просто нужно скопировать его содержимое
|
|
229
|
+
Приложение создается в каталоге
|
|
241
230
|
|
|
242
231
|
```
|
|
243
|
-
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
или
|
|
247
|
-
|
|
248
|
-
```
|
|
249
|
-
xcopy app\android\* android\app\src\main /E /H /C /I /Y
|
|
232
|
+
build/capacitor/android
|
|
250
233
|
```
|
|
251
234
|
|
|
252
235
|
Выполняем предварительную сборку
|
|
253
236
|
|
|
254
237
|
```
|
|
255
|
-
yarn
|
|
238
|
+
yarn capacitor:make
|
|
256
239
|
```
|
|
257
240
|
|
|
258
|
-
|
|
241
|
+
## Сборка для Android
|
|
259
242
|
|
|
260
|
-
|
|
261
|
-
yarn cap copy
|
|
262
|
-
```
|
|
243
|
+
Для дальнейшей сборки под Android лучше всего работать в контейнере nodejs из проекта https://github.com/isengine/server.git
|
|
263
244
|
|
|
264
|
-
|
|
245
|
+
Иначе Вам придется установить JDK, Android SDK и другие библиотеки, которые уже включены в контейнер выше.
|
|
265
246
|
|
|
266
|
-
|
|
247
|
+
Мы рекомендуем воспользоваться актуальной документацией:
|
|
267
248
|
|
|
268
|
-
|
|
249
|
+
https://www.oracle.com/java/technologies/downloads/
|
|
250
|
+
https://developer.android.com/tools/releases/platform-tools?hl=ru
|
|
269
251
|
|
|
270
|
-
|
|
271
|
-
cd android
|
|
272
|
-
```
|
|
252
|
+
Остальные действия те же, что и в предыдущем пункте.
|
|
273
253
|
|
|
274
254
|
Билд в режиме дебаг:
|
|
275
255
|
|
|
276
256
|
```
|
|
277
|
-
|
|
257
|
+
yarn capacitor:dev
|
|
278
258
|
```
|
|
279
259
|
|
|
280
260
|
Готовое приложение будет лежать в каталоге
|
|
281
261
|
|
|
282
262
|
```
|
|
283
|
-
android/app/build/outputs/apk/debug/app-debug.apk
|
|
263
|
+
build/capacitor/android/app/build/outputs/apk/debug/app-debug.apk
|
|
284
264
|
```
|
|
285
265
|
|
|
286
266
|
Билд в продакшн:
|
|
287
267
|
|
|
288
268
|
```
|
|
289
|
-
|
|
269
|
+
yarn capacitor:build
|
|
290
270
|
```
|
|
291
271
|
|
|
292
272
|
Готовое приложение теперь будет лежать в каталоге
|
|
293
273
|
|
|
294
274
|
```
|
|
295
|
-
android/app/build/outputs/apk/release/app-release-unsigned.apk
|
|
296
|
-
```
|
|
297
|
-
|
|
298
|
-
Дальнейшие действия лучше выполнять из корневого каталога проекта
|
|
299
|
-
|
|
300
|
-
```
|
|
301
|
-
cd ..
|
|
275
|
+
build/capacitor/android/app/build/outputs/apk/release/app-release-unsigned.apk
|
|
302
276
|
```
|
|
303
277
|
|
|
304
278
|
Создаем ключ для подписи
|
|
305
279
|
|
|
306
280
|
```
|
|
307
281
|
keytool -genkey -v -keystore MY_RELEASE_KEY.jks -keyalg RSA -keysize 2048 -validity 10000 -alias MY_KEY_ALIAS
|
|
308
|
-
|
|
309
282
|
```
|
|
310
283
|
|
|
311
284
|
Запишите созданные пароли и alias, так как они понадобятся вам в дальнейшем.
|
|
@@ -313,23 +286,27 @@ keytool -genkey -v -keystore MY_RELEASE_KEY.jks -keyalg RSA -keysize 2048 -valid
|
|
|
313
286
|
Создаем копию приложения
|
|
314
287
|
|
|
315
288
|
```
|
|
316
|
-
cp android/app/build/outputs/apk/release/app-release-unsigned.apk android/app/build/outputs/apk/release/app-release.apk
|
|
289
|
+
cp build/capacitor/android/app/build/outputs/apk/release/app-release-unsigned.apk build/capacitor/android/app/build/outputs/apk/release/app-release.apk
|
|
317
290
|
```
|
|
318
291
|
|
|
319
292
|
Подписываем приложение
|
|
320
293
|
|
|
321
294
|
```
|
|
322
|
-
apksigner sign --ks MY_RELEASE_KEY.jks --ks-key-alias MY_KEY_ALIAS --ks-pass pass:YOUR_KEYSTORE_PASSWORD --key-pass pass:YOUR_KEY_PASSWORD android/app/build/outputs/apk/release/app-release.apk
|
|
295
|
+
apksigner sign --ks MY_RELEASE_KEY.jks --ks-key-alias MY_KEY_ALIAS --ks-pass pass:YOUR_KEYSTORE_PASSWORD --key-pass pass:YOUR_KEY_PASSWORD build/capacitor/android/app/build/outputs/apk/release/app-release.apk
|
|
323
296
|
```
|
|
324
297
|
|
|
325
298
|
Можно проверить подпись
|
|
326
299
|
|
|
327
300
|
```
|
|
328
|
-
apksigner verify android/app/build/outputs/apk/release/app-release.apk
|
|
301
|
+
apksigner verify build/capacitor/android/app/build/outputs/apk/release/app-release.apk
|
|
329
302
|
```
|
|
330
303
|
|
|
331
304
|
Если APK подписан правильно, вы не увидите никаких ошибок.
|
|
332
305
|
|
|
306
|
+
## Сборка для IOS
|
|
307
|
+
|
|
308
|
+
Сборка производится только на устройствах Mac с установленной средой разработки XCode.
|
|
309
|
+
|
|
333
310
|
# Tauri
|
|
334
311
|
|
|
335
312
|
Настроить **Tauri** сложнее, чем **Electron**.
|
package/dist/index.min.js
CHANGED
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
"use strict";var Wn=Object.create;var Xt=Object.defineProperty;var Kn=Object.getOwnPropertyDescriptor;var Xn=Object.getOwnPropertyNames;var Qn=Object.getPrototypeOf,eo=Object.prototype.hasOwnProperty;var u=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var to=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Xn(e))!eo.call(i,s)&&s!==t&&Xt(i,s,{get:()=>e[s],enumerable:!(r=Kn(e,s))||r.enumerable});return i};var q=(i,e,t)=>(t=i!=null?Wn(Qn(i)):{},to(e||!i||!i.__esModule?Xt(t,"default",{value:i,enumerable:!0}):t,i));var f=u((
|
|
2
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var n=!0,o=!1,h;return{s:function(){t=t.call(i)},n:function(){var a=t.next();return n=a.done,a},e:function(a){o=!0,h=a},f:function(){try{!n&&t.return!=null&&t.return()}finally{if(o)throw h}}}}function uo(i,e){if(i){if(typeof i=="string")return
|
|
1
|
+
"use strict";var Wn=Object.create;var Xt=Object.defineProperty;var Kn=Object.getOwnPropertyDescriptor;var Xn=Object.getOwnPropertyNames;var Qn=Object.getPrototypeOf,eo=Object.prototype.hasOwnProperty;var u=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var to=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Xn(e))!eo.call(i,s)&&s!==t&&Xt(i,s,{get:()=>e[s],enumerable:!(r=Kn(e,s))||r.enumerable});return i};var q=(i,e,t)=>(t=i!=null?Wn(Qn(i)):{},to(e||!i||!i.__esModule?Xt(t,"default",{value:i,enumerable:!0}):t,i));var f=u((gu,si)=>{"use strict";var{FORCE_COLOR:io,NODE_DISABLE_COLORS:ro,TERM:so}=process.env,c={enabled:!ro&&so!=="dumb"&&io!=="0",reset:d(0,0),bold:d(1,22),dim:d(2,22),italic:d(3,23),underline:d(4,24),inverse:d(7,27),hidden:d(8,28),strikethrough:d(9,29),black:d(30,39),red:d(31,39),green:d(32,39),yellow:d(33,39),blue:d(34,39),magenta:d(35,39),cyan:d(36,39),white:d(37,39),gray:d(90,39),grey:d(90,39),bgBlack:d(40,49),bgRed:d(41,49),bgGreen:d(42,49),bgYellow:d(43,49),bgBlue:d(44,49),bgMagenta:d(45,49),bgCyan:d(46,49),bgWhite:d(47,49)};function ri(i,e){let t=0,r,s="",n="";for(;t<i.length;t++)r=i[t],s+=r.open,n+=r.close,e.includes(r.close)&&(e=e.replace(r.rgx,r.close+r.open));return s+e+n}function no(i,e){let t={has:i,keys:e};return t.reset=c.reset.bind(t),t.bold=c.bold.bind(t),t.dim=c.dim.bind(t),t.italic=c.italic.bind(t),t.underline=c.underline.bind(t),t.inverse=c.inverse.bind(t),t.hidden=c.hidden.bind(t),t.strikethrough=c.strikethrough.bind(t),t.black=c.black.bind(t),t.red=c.red.bind(t),t.green=c.green.bind(t),t.yellow=c.yellow.bind(t),t.blue=c.blue.bind(t),t.magenta=c.magenta.bind(t),t.cyan=c.cyan.bind(t),t.white=c.white.bind(t),t.gray=c.gray.bind(t),t.grey=c.grey.bind(t),t.bgBlack=c.bgBlack.bind(t),t.bgRed=c.bgRed.bind(t),t.bgGreen=c.bgGreen.bind(t),t.bgYellow=c.bgYellow.bind(t),t.bgBlue=c.bgBlue.bind(t),t.bgMagenta=c.bgMagenta.bind(t),t.bgCyan=c.bgCyan.bind(t),t.bgWhite=c.bgWhite.bind(t),t}function d(i,e){let t={open:`\x1B[${i}m`,close:`\x1B[${e}m`,rgx:new RegExp(`\\x1b\\[${e}m`,"g")};return function(r){return this!==void 0&&this.has!==void 0?(this.has.includes(i)||(this.has.push(i),this.keys.push(t)),r===void 0?this:c.enabled?ri(this.keys,r+""):r+""):r===void 0?no([i],[t]):c.enabled?ri([t],r+""):r+""}}si.exports=c});var oi=u((bu,ni)=>{"use strict";ni.exports=(i,e)=>{if(!(i.meta&&i.name!=="escape")){if(i.ctrl){if(i.name==="a")return"first";if(i.name==="c"||i.name==="d")return"abort";if(i.name==="e")return"last";if(i.name==="g")return"reset"}if(e){if(i.name==="j")return"down";if(i.name==="k")return"up"}return i.name==="return"||i.name==="enter"?"submit":i.name==="backspace"?"delete":i.name==="delete"?"deleteForward":i.name==="abort"?"abort":i.name==="escape"?"exit":i.name==="tab"?"next":i.name==="pagedown"?"nextPage":i.name==="pageup"?"prevPage":i.name==="home"?"home":i.name==="end"?"end":i.name==="up"?"up":i.name==="down"?"down":i.name==="right"?"right":i.name==="left"?"left":!1}}});var ye=u((vu,hi)=>{"use strict";hi.exports=i=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),t=new RegExp(e,"g");return typeof i=="string"?i.replace(t,""):i}});var p=u((yu,li)=>{"use strict";var Ve={to(i,e){return e?`\x1B[${e+1};${i+1}H`:`\x1B[${i+1}G`},move(i,e){let t="";return i<0?t+=`\x1B[${-i}D`:i>0&&(t+=`\x1B[${i}C`),e<0?t+=`\x1B[${-e}A`:e>0&&(t+=`\x1B[${e}B`),t},up:(i=1)=>`\x1B[${i}A`,down:(i=1)=>`\x1B[${i}B`,forward:(i=1)=>`\x1B[${i}C`,backward:(i=1)=>`\x1B[${i}D`,nextLine:(i=1)=>"\x1B[E".repeat(i),prevLine:(i=1)=>"\x1B[F".repeat(i),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},oo={up:(i=1)=>"\x1B[S".repeat(i),down:(i=1)=>"\x1B[T".repeat(i)},ho={screen:"\x1B[2J",up:(i=1)=>"\x1B[1J".repeat(i),down:(i=1)=>"\x1B[J".repeat(i),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(i){let e="";for(let t=0;t<i;t++)e+=this.line+(t<i-1?Ve.up():"");return i&&(e+=Ve.left),e}};li.exports={cursor:Ve,scroll:oo,erase:ho,beep:"\x07"}});var fi=u((wu,di)=>{"use strict";function lo(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=uo(i))||e&&i&&typeof i.length=="number"){t&&(i=t);var r=0,s=function(){};return{s,n:function(){return r>=i.length?{done:!0}:{done:!1,value:i[r++]}},e:function(a){throw a},f:s}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var n=!0,o=!1,h;return{s:function(){t=t.call(i)},n:function(){var a=t.next();return n=a.done,a},e:function(a){o=!0,h=a},f:function(){try{!n&&t.return!=null&&t.return()}finally{if(o)throw h}}}}function uo(i,e){if(i){if(typeof i=="string")return ui(i,e);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return Array.from(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return ui(i,e)}}function ui(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=i[t];return r}var ao=ye(),ci=p(),ai=ci.erase,co=ci.cursor,fo=i=>[...ao(i)].length;di.exports=function(i,e){if(!e)return ai.line+co.to(0);let t=0,r=i.split(/\r?\n/);var s=lo(r),n;try{for(s.s();!(n=s.n()).done;){let o=n.value;t+=1+Math.floor(Math.max(fo(o)-1,0)/e)}}catch(o){s.e(o)}finally{s.f()}return ai.lines(t)}});var He=u((xu,pi)=>{"use strict";var ne={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},po={arrowUp:ne.arrowUp,arrowDown:ne.arrowDown,arrowLeft:ne.arrowLeft,arrowRight:ne.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},mo=process.platform==="win32"?po:ne;pi.exports=mo});var gi=u((Su,mi)=>{"use strict";var X=f(),B=He(),Le=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}`}}),go=i=>Le[i]||Le.default,oe=Object.freeze({aborted:X.red(B.cross),done:X.green(B.tick),exited:X.yellow(B.cross),default:X.cyan("?")}),bo=(i,e,t)=>e?oe.aborted:t?oe.exited:i?oe.done:oe.default,vo=i=>X.gray(i?B.ellipsis:B.pointerSmall),yo=(i,e)=>X.gray(i?e?B.pointerSmall:"+":B.line);mi.exports={styles:Le,render:go,symbols:oe,symbol:bo,delimiter:vo,item:yo}});var vi=u((qu,bi)=>{"use strict";var wo=ye();bi.exports=function(i,e){let t=String(wo(i)||"").split(/\r?\n/);return e?t.map(r=>Math.ceil(r.length/e)).reduce((r,s)=>r+s):t.length}});var wi=u((Ou,yi)=>{"use strict";yi.exports=(i,e={})=>{let t=Number.isSafeInteger(parseInt(e.margin))?new Array(parseInt(e.margin)).fill(" ").join(""):e.margin||"",r=e.width;return(i||"").split(/\r?\n/g).map(s=>s.split(/\s+/g).reduce((n,o)=>(o.length+t.length>=r||n[n.length-1].length+o.length+1<r?n[n.length-1]+=` ${o}`:n.push(`${t}${o}`),n),[t]).join(`
|
|
3
3
|
`)).join(`
|
|
4
|
-
`)}});var
|
|
5
|
-
`),this.close()}validate(){var e=this;return
|
|
6
|
-
`),e.close()})()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(e){this.placeholder||(this.cursor=this.cursor+e,this.cursorOffset+=e)}_(e,t){let r=this.value.slice(0,this.cursor),s=this.value.slice(this.cursor);this.value=`${r}${e}${s}`,this.red=!1,this.cursor=this.placeholder?0:r.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let e=this.value.slice(0,this.cursor-1),t=this.value.slice(this.cursor);this.value=`${e}${t}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let e=this.value.slice(0,this.cursor),t=this.value.slice(this.cursor+1);this.value=`${e}${t}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(
|
|
4
|
+
`)}});var Si=u((Pu,xi)=>{"use strict";xi.exports=(i,e,t)=>{t=t||e;let r=Math.min(e-t,i-Math.floor(t/2));r<0&&(r=0);let s=Math.min(r+t,e);return{startIndex:r,endIndex:s}}});var y=u((Mu,qi)=>{"use strict";qi.exports={action:oi(),clear:fi(),style:gi(),strip:ye(),figures:He(),lines:vi(),wrap:wi(),entriesToDisplay:Si()}});var D=u((Iu,Mi)=>{"use strict";var Oi=require("readline"),xo=y(),So=xo.action,qo=require("events"),Pi=p(),Oo=Pi.beep,Po=Pi.cursor,Mo=f(),Ye=class extends qo{constructor(e={}){super(),this.firstRender=!0,this.in=e.stdin||process.stdin,this.out=e.stdout||process.stdout,this.onRender=(e.onRender||(()=>{})).bind(this);let t=Oi.createInterface({input:this.in,escapeCodeTimeout:50});Oi.emitKeypressEvents(this.in,t),this.in.isTTY&&this.in.setRawMode(!0);let r=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,s=(n,o)=>{let h=So(o,r);h===!1?this._&&this._(n,o):typeof this[h]=="function"?this[h](o):this.bell()};this.close=()=>{this.out.write(Po.show),this.in.removeListener("keypress",s),this.in.isTTY&&this.in.setRawMode(!1),t.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",s)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(Oo)}render(){this.onRender(Mo),this.firstRender&&(this.firstRender=!1)}};Mi.exports=Ye});var _i=u((Tu,Ci)=>{"use strict";function Ii(i,e,t,r,s,n,o){try{var h=i[n](o),l=h.value}catch(a){t(a);return}h.done?e(l):Promise.resolve(l).then(r,s)}function Ti(i){return function(){var e=this,t=arguments;return new Promise(function(r,s){var n=i.apply(e,t);function o(l){Ii(n,r,s,o,h,"next",l)}function h(l){Ii(n,r,s,o,h,"throw",l)}o(void 0)})}}var we=f(),Io=D(),$i=p(),To=$i.erase,he=$i.cursor,xe=y(),Ne=xe.style,Ue=xe.clear,$o=xe.lines,Co=xe.figures,Ge=class extends Io{constructor(e={}){super(e),this.transform=Ne.render(e.style),this.scale=this.transform.scale,this.msg=e.message,this.initial=e.initial||"",this.validator=e.validate||(()=>!0),this.value="",this.errorMsg=e.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=Ue("",this.out.columns),this.render()}set value(e){!e&&this.initial?(this.placeholder=!0,this.rendered=we.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(e)),this._value=e,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=+!!this.initial,this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
|
|
5
|
+
`),this.close()}validate(){var e=this;return Ti(function*(){let t=yield e.validator(e.value);typeof t=="string"&&(e.errorMsg=t,t=!1),e.error=!t})()}submit(){var e=this;return Ti(function*(){if(e.value=e.value||e.initial,e.cursorOffset=0,e.cursor=e.rendered.length,yield e.validate(),e.error){e.red=!0,e.fire(),e.render();return}e.done=!0,e.aborted=!1,e.fire(),e.render(),e.out.write(`
|
|
6
|
+
`),e.close()})()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(e){this.placeholder||(this.cursor=this.cursor+e,this.cursorOffset+=e)}_(e,t){let r=this.value.slice(0,this.cursor),s=this.value.slice(this.cursor);this.value=`${r}${e}${s}`,this.red=!1,this.cursor=this.placeholder?0:r.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let e=this.value.slice(0,this.cursor-1),t=this.value.slice(this.cursor);this.value=`${e}${t}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let e=this.value.slice(0,this.cursor),t=this.value.slice(this.cursor+1);this.value=`${e}${t}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(he.down($o(this.outputError,this.out.columns)-1)+Ue(this.outputError,this.out.columns)),this.out.write(Ue(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[Ne.symbol(this.done,this.aborted),we.bold(this.msg),Ne.delimiter(this.done),this.red?we.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
7
7
|
`).reduce((e,t,r)=>e+`
|
|
8
|
-
${r?" ":Co.pointerSmall} ${
|
|
8
|
+
${r?" ":Co.pointerSmall} ${we.red().italic(t)}`,"")),this.out.write(To.line+he.to(0)+this.outputText+he.save+this.outputError+he.restore+he.move(this.cursorOffset,0)))}};Ci.exports=Ge});var Ei=u(($u,ji)=>{"use strict";var k=f(),_o=D(),le=y(),Di=le.style,ki=le.clear,Se=le.figures,Do=le.wrap,ko=le.entriesToDisplay,jo=p(),Eo=jo.cursor,Je=class extends _o{constructor(e={}){super(e),this.msg=e.message,this.hint=e.hint||"- Use arrow-keys. Return to submit.",this.warn=e.warn||"- This option is disabled",this.cursor=e.initial||0,this.choices=e.choices.map((t,r)=>(typeof t=="string"&&(t={title:t,value:r}),{title:t&&(t.title||t.value||t),value:t&&(t.value===void 0?r:t.value),description:t&&t.description,selected:t&&t.selected,disabled:t&&t.disabled})),this.optionsPerPage=e.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=ki("",this.out.columns),this.render()}moveCursor(e){this.cursor=e,this.value=this.choices[e].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
9
9
|
`),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
10
|
-
`),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(e,t){if(e===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(Eo.hide):this.out.write(
|
|
11
|
-
`;for(let s=t;s<r;s++){let n,o,h="",l=this.choices[s];s===t&&t>0?o=
|
|
10
|
+
`),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(e,t){if(e===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(Eo.hide):this.out.write(ki(this.outputText,this.out.columns)),super.render();let e=ko(this.cursor,this.choices.length,this.optionsPerPage),t=e.startIndex,r=e.endIndex;if(this.outputText=[Di.symbol(this.done,this.aborted),k.bold(this.msg),Di.delimiter(!1),this.done?this.selection.title:this.selection.disabled?k.yellow(this.warn):k.gray(this.hint)].join(" "),!this.done){this.outputText+=`
|
|
11
|
+
`;for(let s=t;s<r;s++){let n,o,h="",l=this.choices[s];s===t&&t>0?o=Se.arrowUp:s===r-1&&r<this.choices.length?o=Se.arrowDown:o=" ",l.disabled?(n=this.cursor===s?k.gray().underline(l.title):k.strikethrough().gray(l.title),o=(this.cursor===s?k.bold().gray(Se.pointer)+" ":" ")+o):(n=this.cursor===s?k.cyan().underline(l.title):l.title,o=(this.cursor===s?k.cyan(Se.pointer)+" ":" ")+o,l.description&&this.cursor===s&&(h=` - ${l.description}`,(o.length+n.length+h.length>=this.out.columns||l.description.split(/\r?\n/).length>1)&&(h=`
|
|
12
12
|
`+Do(l.description,{margin:3,width:this.out.columns})))),this.outputText+=`${o} ${n}${k.gray(h)}
|
|
13
|
-
`}}this.out.write(this.outputText)}};
|
|
13
|
+
`}}this.out.write(this.outputText)}};ji.exports=Je});var Li=u((Cu,Hi)=>{"use strict";var qe=f(),Ao=D(),Fi=y(),Ai=Fi.style,Ro=Fi.clear,Vi=p(),Ri=Vi.cursor,Fo=Vi.erase,Be=class extends Ao{constructor(e={}){super(e),this.msg=e.message,this.value=!!e.initial,this.active=e.active||"on",this.inactive=e.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
14
14
|
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
15
|
-
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(e,t){if(e===" ")this.value=!this.value;else if(e==="1")this.value=!0;else if(e==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(
|
|
16
|
-
`),this.close()}validate(){var e=this;return
|
|
17
|
-
`),e.close()})()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let e=this.parts[this.cursor].prev();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}right(){let e=this.parts[this.cursor].next();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}next(){let e=this.parts[this.cursor].next();this.moveCursor(e?this.parts.indexOf(e):this.parts.findIndex(t=>t instanceof
|
|
15
|
+
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(e,t){if(e===" ")this.value=!this.value;else if(e==="1")this.value=!0;else if(e==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(Ri.hide):this.out.write(Ro(this.outputText,this.out.columns)),super.render(),this.outputText=[Ai.symbol(this.done,this.aborted),qe.bold(this.msg),Ai.delimiter(this.done),this.value?this.inactive:qe.cyan().underline(this.inactive),qe.gray("/"),this.value?qe.cyan().underline(this.active):this.active].join(" "),this.out.write(Fo.line+Ri.to(0)+this.outputText))}};Hi.exports=Be});var O=u((_u,Yi)=>{"use strict";var ze=class i{constructor({token:e,date:t,parts:r,locales:s}){this.token=e,this.date=t||new Date,this.parts=r||[this],this.locales=s||{}}up(){}down(){}next(){let e=this.parts.indexOf(this);return this.parts.find((t,r)=>r>e&&t instanceof i)}setTo(e){}prev(){let e=[].concat(this.parts).reverse(),t=e.indexOf(this);return e.find((r,s)=>s>t&&r instanceof i)}toString(){return String(this.date)}};Yi.exports=ze});var Ui=u((Du,Ni)=>{"use strict";var Vo=O(),Ze=class extends Vo{constructor(e={}){super(e)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let e=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?e.toUpperCase():e}};Ni.exports=Ze});var Ji=u((ku,Gi)=>{"use strict";var Ho=O(),Lo=i=>(i=i%10,i===1?"st":i===2?"nd":i===3?"rd":"th"),We=class extends Ho{constructor(e={}){super(e)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(e){this.date.setDate(parseInt(e.substr(-2)))}toString(){let e=this.date.getDate(),t=this.date.getDay();return this.token==="DD"?String(e).padStart(2,"0"):this.token==="Do"?e+Lo(e):this.token==="d"?t+1:this.token==="ddd"?this.locales.weekdaysShort[t]:this.token==="dddd"?this.locales.weekdays[t]:e}};Gi.exports=We});var zi=u((ju,Bi)=>{"use strict";var Yo=O(),Ke=class extends Yo{constructor(e={}){super(e)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(e){this.date.setHours(parseInt(e.substr(-2)))}toString(){let e=this.date.getHours();return/h/.test(this.token)&&(e=e%12||12),this.token.length>1?String(e).padStart(2,"0"):e}};Bi.exports=Ke});var Wi=u((Eu,Zi)=>{"use strict";var No=O(),Xe=class extends No{constructor(e={}){super(e)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(e){this.date.setMilliseconds(parseInt(e.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};Zi.exports=Xe});var Xi=u((Au,Ki)=>{"use strict";var Uo=O(),Qe=class extends Uo{constructor(e={}){super(e)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(e){this.date.setMinutes(parseInt(e.substr(-2)))}toString(){let e=this.date.getMinutes();return this.token.length>1?String(e).padStart(2,"0"):e}};Ki.exports=Qe});var er=u((Ru,Qi)=>{"use strict";var Go=O(),et=class extends Go{constructor(e={}){super(e)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(e){e=parseInt(e.substr(-2))-1,this.date.setMonth(e<0?0:e)}toString(){let e=this.date.getMonth(),t=this.token.length;return t===2?String(e+1).padStart(2,"0"):t===3?this.locales.monthsShort[e]:t===4?this.locales.months[e]:String(e+1)}};Qi.exports=et});var ir=u((Fu,tr)=>{"use strict";var Jo=O(),tt=class extends Jo{constructor(e={}){super(e)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(e){this.date.setSeconds(parseInt(e.substr(-2)))}toString(){let e=this.date.getSeconds();return this.token.length>1?String(e).padStart(2,"0"):e}};tr.exports=tt});var sr=u((Vu,rr)=>{"use strict";var Bo=O(),it=class extends Bo{constructor(e={}){super(e)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(e){this.date.setFullYear(e.substr(-4))}toString(){let e=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?e.substr(-2):e}};rr.exports=it});var or=u((Hu,nr)=>{"use strict";nr.exports={DatePart:O(),Meridiem:Ui(),Day:Ji(),Hours:zi(),Milliseconds:Wi(),Minutes:Xi(),Month:er(),Seconds:ir(),Year:sr()}});var gr=u((Lu,mr)=>{"use strict";function hr(i,e,t,r,s,n,o){try{var h=i[n](o),l=h.value}catch(a){t(a);return}h.done?e(l):Promise.resolve(l).then(r,s)}function lr(i){return function(){var e=this,t=arguments;return new Promise(function(r,s){var n=i.apply(e,t);function o(l){hr(n,r,s,o,h,"next",l)}function h(l){hr(n,r,s,o,h,"throw",l)}o(void 0)})}}var rt=f(),zo=D(),nt=y(),ur=nt.style,ar=nt.clear,Zo=nt.figures,pr=p(),Wo=pr.erase,cr=pr.cursor,j=or(),dr=j.DatePart,Ko=j.Meridiem,Xo=j.Day,Qo=j.Hours,eh=j.Milliseconds,th=j.Minutes,ih=j.Month,rh=j.Seconds,sh=j.Year,nh=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,fr={1:({token:i})=>i.replace(/\\(.)/g,"$1"),2:i=>new Xo(i),3:i=>new ih(i),4:i=>new sh(i),5:i=>new Ko(i),6:i=>new Qo(i),7:i=>new th(i),8:i=>new rh(i),9:i=>new eh(i)},oh={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(",")},st=class extends zo{constructor(e={}){super(e),this.msg=e.message,this.cursor=0,this.typed="",this.locales=Object.assign(oh,e.locales),this._date=e.initial||new Date,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.mask=e.mask||"YYYY-MM-DD HH:mm:ss",this.clear=ar("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(e){e&&this._date.setTime(e.getTime())}set mask(e){let t;for(this.parts=[];t=nh.exec(e);){let s=t.shift(),n=t.findIndex(o=>o!=null);this.parts.push(n in fr?fr[n]({token:t[n]||s,date:this.date,parts:this.parts,locales:this.locales}):t[n]||s)}let r=this.parts.reduce((s,n)=>(typeof n=="string"&&typeof s[s.length-1]=="string"?s[s.length-1]+=n:s.push(n),s),[]);this.parts.splice(0),this.parts.push(...r),this.reset()}moveCursor(e){this.typed="",this.cursor=e,this.fire()}reset(){this.moveCursor(this.parts.findIndex(e=>e instanceof dr)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
16
|
+
`),this.close()}validate(){var e=this;return lr(function*(){let t=yield e.validator(e.value);typeof t=="string"&&(e.errorMsg=t,t=!1),e.error=!t})()}submit(){var e=this;return lr(function*(){if(yield e.validate(),e.error){e.color="red",e.fire(),e.render();return}e.done=!0,e.aborted=!1,e.fire(),e.render(),e.out.write(`
|
|
17
|
+
`),e.close()})()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let e=this.parts[this.cursor].prev();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}right(){let e=this.parts[this.cursor].next();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}next(){let e=this.parts[this.cursor].next();this.moveCursor(e?this.parts.indexOf(e):this.parts.findIndex(t=>t instanceof dr)),this.render()}_(e){/\d/.test(e)&&(this.typed+=e,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(cr.hide):this.out.write(ar(this.outputText,this.out.columns)),super.render(),this.outputText=[ur.symbol(this.done,this.aborted),rt.bold(this.msg),ur.delimiter(!1),this.parts.reduce((e,t,r)=>e.concat(r===this.cursor&&!this.done?rt.cyan().underline(t.toString()):t),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
|
|
18
18
|
`).reduce((e,t,r)=>e+`
|
|
19
|
-
${r?" ":Zo.pointerSmall} ${rt.red().italic(t)}`,"")),this.out.write(Wo.line+
|
|
20
|
-
`),this.close()}validate(){var e=this;return
|
|
21
|
-
`),e.close()})()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let e=this.value.toString();if(e.length===0)return this.bell();this.value=this.parse(e=e.slice(0,-1))||"",this.value!==""&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(e,t){if(!this.valid(e))return this.bell();let r=Date.now();if(r-this.lastHit>1e3&&(this.typed=""),this.typed+=e,this.lastHit=r,this.color="cyan",e===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(
|
|
19
|
+
${r?" ":Zo.pointerSmall} ${rt.red().italic(t)}`,"")),this.out.write(Wo.line+cr.to(0)+this.outputText))}};mr.exports=st});var qr=u((Yu,Sr)=>{"use strict";function br(i,e,t,r,s,n,o){try{var h=i[n](o),l=h.value}catch(a){t(a);return}h.done?e(l):Promise.resolve(l).then(r,s)}function vr(i){return function(){var e=this,t=arguments;return new Promise(function(r,s){var n=i.apply(e,t);function o(l){br(n,r,s,o,h,"next",l)}function h(l){br(n,r,s,o,h,"throw",l)}o(void 0)})}}var Oe=f(),hh=D(),xr=p(),Pe=xr.cursor,lh=xr.erase,Me=y(),ot=Me.style,uh=Me.figures,yr=Me.clear,ah=Me.lines,ch=/[0-9]/,ht=i=>i!==void 0,wr=(i,e)=>{let t=Math.pow(10,e);return Math.round(i*t)/t},lt=class extends hh{constructor(e={}){super(e),this.transform=ot.render(e.style),this.msg=e.message,this.initial=ht(e.initial)?e.initial:"",this.float=!!e.float,this.round=e.round||2,this.inc=e.increment||1,this.min=ht(e.min)?e.min:-1/0,this.max=ht(e.max)?e.max:1/0,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(e){!e&&e!==0?(this.placeholder=!0,this.rendered=Oe.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${wr(e,this.round)}`),this._value=wr(e,this.round)),this.fire()}get value(){return this._value}parse(e){return this.float?parseFloat(e):parseInt(e)}valid(e){return e==="-"||e==="."&&this.float||ch.test(e)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let e=this.value;this.value=e!==""?e:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
20
|
+
`),this.close()}validate(){var e=this;return vr(function*(){let t=yield e.validator(e.value);typeof t=="string"&&(e.errorMsg=t,t=!1),e.error=!t})()}submit(){var e=this;return vr(function*(){if(yield e.validate(),e.error){e.color="red",e.fire(),e.render();return}let t=e.value;e.value=t!==""?t:e.initial,e.done=!0,e.aborted=!1,e.error=!1,e.fire(),e.render(),e.out.write(`
|
|
21
|
+
`),e.close()})()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let e=this.value.toString();if(e.length===0)return this.bell();this.value=this.parse(e=e.slice(0,-1))||"",this.value!==""&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(e,t){if(!this.valid(e))return this.bell();let r=Date.now();if(r-this.lastHit>1e3&&(this.typed=""),this.typed+=e,this.lastHit=r,this.color="cyan",e===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(Pe.down(ah(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=[ot.symbol(this.done,this.aborted),Oe.bold(this.msg),ot.delimiter(this.done),!this.done||!this.done&&!this.placeholder?Oe[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
22
22
|
`).reduce((e,t,r)=>e+`
|
|
23
|
-
${r?" ":uh.pointerSmall} ${
|
|
23
|
+
${r?" ":uh.pointerSmall} ${Oe.red().italic(t)}`,"")),this.out.write(lh.line+Pe.to(0)+this.outputText+Pe.save+this.outputError+Pe.restore))}};Sr.exports=lt});var at=u((Nu,Mr)=>{"use strict";var P=f(),dh=p(),fh=dh.cursor,ph=D(),ue=y(),Or=ue.clear,L=ue.figures,Pr=ue.style,mh=ue.wrap,gh=ue.entriesToDisplay,ut=class extends ph{constructor(e={}){super(e),this.msg=e.message,this.cursor=e.cursor||0,this.scrollIndex=e.cursor||0,this.hint=e.hint||"",this.warn=e.warn||"- This option is disabled -",this.minSelected=e.min,this.showMinError=!1,this.maxChoices=e.max,this.instructions=e.instructions,this.optionsPerPage=e.optionsPerPage||10,this.value=e.choices.map((t,r)=>(typeof t=="string"&&(t={title:t,value:r}),{title:t&&(t.title||t.value||t),description:t&&t.description,value:t&&(t.value===void 0?r:t.value),selected:t&&t.selected,disabled:t&&t.disabled})),this.clear=Or("",this.out.columns),e.overrideRender||this.render()}reset(){this.value.map(e=>!e.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(e=>e.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
24
24
|
`),this.close()}submit(){let e=this.value.filter(t=>t.selected);this.minSelected&&e.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
25
25
|
`),this.close())}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render()}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){let e=this.value[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let e=!this.value[this.cursor].selected;this.value.filter(t=>!t.disabled).forEach(t=>t.selected=e),this.render()}_(e,t){if(e===" ")this.handleSpaceToggle();else if(e==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
26
26
|
Instructions:
|
|
27
|
-
${
|
|
28
|
-
${
|
|
27
|
+
${L.arrowUp}/${L.arrowDown}: Highlight option
|
|
28
|
+
${L.arrowLeft}/${L.arrowRight}/[space]: Toggle selection
|
|
29
29
|
`+(this.maxChoices===void 0?` a: Toggle all
|
|
30
|
-
`:"")+" enter/return: Complete answer":""}renderOption(e,t,r,s){let n=(t.selected?P.green(
|
|
31
|
-
`+mh(t.description,{margin:n.length,width:this.out.columns})))),n+o+P.gray(h||"")}paginateOptions(e){if(e.length===0)return P.red("No matches for this query.");let t=gh(this.cursor,e.length,this.optionsPerPage),r=t.startIndex,s=t.endIndex,n,o=[];for(let h=r;h<s;h++)h===r&&r>0?n=
|
|
30
|
+
`:"")+" enter/return: Complete answer":""}renderOption(e,t,r,s){let n=(t.selected?P.green(L.radioOn):L.radioOff)+" "+s+" ",o,h;return t.disabled?o=e===r?P.gray().underline(t.title):P.strikethrough().gray(t.title):(o=e===r?P.cyan().underline(t.title):t.title,e===r&&t.description&&(h=` - ${t.description}`,(n.length+o.length+h.length>=this.out.columns||t.description.split(/\r?\n/).length>1)&&(h=`
|
|
31
|
+
`+mh(t.description,{margin:n.length,width:this.out.columns})))),n+o+P.gray(h||"")}paginateOptions(e){if(e.length===0)return P.red("No matches for this query.");let t=gh(this.cursor,e.length,this.optionsPerPage),r=t.startIndex,s=t.endIndex,n,o=[];for(let h=r;h<s;h++)h===r&&r>0?n=L.arrowUp:h===s-1&&s<e.length?n=L.arrowDown:n=" ",o.push(this.renderOption(this.cursor,e[h],h,n));return`
|
|
32
32
|
`+o.join(`
|
|
33
|
-
`)}renderOptions(e){return this.done?"":this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[P.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&e.push(P.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(fh.hide),super.render();let e=[
|
|
33
|
+
`)}renderOptions(e){return this.done?"":this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[P.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&e.push(P.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(fh.hide),super.render();let e=[Pr.symbol(this.done,this.aborted),P.bold(this.msg),Pr.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=P.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.value),this.out.write(this.clear+e),this.clear=Or(e,this.out.columns)}};Mr.exports=ut});var kr=u((Uu,Dr)=>{"use strict";function Ir(i,e,t,r,s,n,o){try{var h=i[n](o),l=h.value}catch(a){t(a);return}h.done?e(l):Promise.resolve(l).then(r,s)}function bh(i){return function(){var e=this,t=arguments;return new Promise(function(r,s){var n=i.apply(e,t);function o(l){Ir(n,r,s,o,h,"next",l)}function h(l){Ir(n,r,s,o,h,"throw",l)}o(void 0)})}}var ae=f(),vh=D(),_r=p(),yh=_r.erase,Tr=_r.cursor,ce=y(),ct=ce.style,$r=ce.clear,dt=ce.figures,wh=ce.wrap,xh=ce.entriesToDisplay,Cr=(i,e)=>i[e]&&(i[e].value||i[e].title||i[e]),Sh=(i,e)=>i[e]&&(i[e].title||i[e].value||i[e]),qh=(i,e)=>{let t=i.findIndex(r=>r.value===e||r.title===e);return t>-1?t:void 0},ft=class extends vh{constructor(e={}){super(e),this.msg=e.message,this.suggest=e.suggest,this.choices=e.choices,this.initial=typeof e.initial=="number"?e.initial:qh(e.choices,e.initial),this.select=this.initial||e.cursor||0,this.i18n={noMatches:e.noMatches||"no matches found"},this.fallback=e.fallback||this.initial,this.clearFirst=e.clearFirst||!1,this.suggestions=[],this.input="",this.limit=e.limit||10,this.cursor=0,this.transform=ct.render(e.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=$r("",this.out.columns),this.complete(this.render),this.render()}set fallback(e){this._fb=Number.isSafeInteger(parseInt(e))?parseInt(e):e}get fallback(){let e;return typeof this._fb=="number"?e=this.choices[this._fb]:typeof this._fb=="string"&&(e={title:this._fb}),e||this._fb||{title:this.i18n.noMatches}}moveSelect(e){this.select=e,this.suggestions.length>0?this.value=Cr(this.suggestions,e):this.value=this.fallback.value,this.fire()}complete(e){var t=this;return bh(function*(){let r=t.completing=t.suggest(t.input,t.choices),s=yield r;if(t.completing!==r)return;t.suggestions=s.map((o,h,l)=>({title:Sh(l,h),value:Cr(l,h),description:o.description})),t.completing=!1;let n=Math.max(s.length-1,0);t.moveSelect(Math.min(n,t.select)),e&&e()})()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
34
34
|
`),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
35
35
|
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
36
|
-
`),this.close()}_(e,t){let r=this.input.slice(0,this.cursor),s=this.input.slice(this.cursor);this.input=`${r}${e}${s}`,this.cursor=r.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let e=this.input.slice(0,this.cursor-1),t=this.input.slice(this.cursor);this.input=`${e}${t}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let e=this.input.slice(0,this.cursor),t=this.input.slice(this.cursor+1);this.input=`${e}${t}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(e,t,r,s){let n,o=r?dt.arrowUp:s?dt.arrowDown:" ",h=t?
|
|
37
|
-
`+wh(e.description,{margin:3,width:this.out.columns}))),o+" "+h+
|
|
36
|
+
`),this.close()}_(e,t){let r=this.input.slice(0,this.cursor),s=this.input.slice(this.cursor);this.input=`${r}${e}${s}`,this.cursor=r.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let e=this.input.slice(0,this.cursor-1),t=this.input.slice(this.cursor);this.input=`${e}${t}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let e=this.input.slice(0,this.cursor),t=this.input.slice(this.cursor+1);this.input=`${e}${t}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(e,t,r,s){let n,o=r?dt.arrowUp:s?dt.arrowDown:" ",h=t?ae.cyan().underline(e.title):e.title;return o=(t?ae.cyan(dt.pointer)+" ":" ")+o,e.description&&(n=` - ${e.description}`,(o.length+h.length+n.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(n=`
|
|
37
|
+
`+wh(e.description,{margin:3,width:this.out.columns}))),o+" "+h+ae.gray(n||"")}render(){if(this.closed)return;this.firstRender?this.out.write(Tr.hide):this.out.write($r(this.outputText,this.out.columns)),super.render();let e=xh(this.select,this.choices.length,this.limit),t=e.startIndex,r=e.endIndex;if(this.outputText=[ct.symbol(this.done,this.aborted,this.exited),ae.bold(this.msg),ct.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(t,r).map((n,o)=>this.renderOption(n,this.select===o+t,o===0&&t>0,o+t===r-1&&r<this.choices.length)).join(`
|
|
38
38
|
`);this.outputText+=`
|
|
39
|
-
`+(s||
|
|
39
|
+
`+(s||ae.gray(this.fallback.title))}this.out.write(yh.line+Tr.to(0)+this.outputText)}};Dr.exports=ft});var Rr=u((Gu,Ar)=>{"use strict";var E=f(),Oh=p(),Ph=Oh.cursor,Mh=at(),mt=y(),jr=mt.clear,Er=mt.style,Q=mt.figures,pt=class extends Mh{constructor(e={}){e.overrideRender=!0,super(e),this.inputValue="",this.clear=jr("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){let e=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(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 t=this.filteredOptions.findIndex(r=>r===e);this.cursor=t<0?0:t,this.render()}handleSpaceToggle(){let e=this.filteredOptions[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}handleInputChange(e){this.inputValue=this.inputValue+e,this.updateFilteredOptions()}_(e,t){e===" "?this.handleSpaceToggle():this.handleInputChange(e)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
40
40
|
Instructions:
|
|
41
|
-
${
|
|
42
|
-
${
|
|
41
|
+
${Q.arrowUp}/${Q.arrowDown}: Highlight option
|
|
42
|
+
${Q.arrowLeft}/${Q.arrowRight}/[space]: Toggle selection
|
|
43
43
|
[a,b,c]/delete: Filter choices
|
|
44
44
|
enter/return: Complete answer
|
|
45
45
|
`:""}renderCurrentInput(){return`
|
|
46
46
|
Filtered results for: ${this.inputValue?this.inputValue:E.gray("Enter something to filter")}
|
|
47
|
-
`}renderOption(e,t,r){let s;return t.disabled?s=e===r?E.gray().underline(t.title):E.strikethrough().gray(t.title):s=e===r?E.cyan().underline(t.title):t.title,(t.selected?E.green(
|
|
47
|
+
`}renderOption(e,t,r){let s;return t.disabled?s=e===r?E.gray().underline(t.title):E.strikethrough().gray(t.title):s=e===r?E.cyan().underline(t.title):t.title,(t.selected?E.green(Q.radioOn):Q.radioOff)+" "+s}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[E.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&e.push(E.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Ph.hide),super.render();let e=[Er.symbol(this.done,this.aborted),E.bold(this.msg),Er.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=E.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+e),this.clear=jr(e,this.out.columns)}};Ar.exports=pt});var Ur=u((Ju,Nr)=>{"use strict";var Fr=f(),Ih=D(),Lr=y(),Vr=Lr.style,Th=Lr.clear,Yr=p(),$h=Yr.erase,Hr=Yr.cursor,gt=class extends Ih{constructor(e={}){super(e),this.msg=e.message,this.value=e.initial,this.initialValue=!!e.initial,this.yesMsg=e.yes||"yes",this.yesOption=e.yesOption||"(Y/n)",this.noMsg=e.no||"no",this.noOption=e.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
48
48
|
`),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
49
|
-
`),this.close()}_(e,t){return e.toLowerCase()==="y"?(this.value=!0,this.submit()):e.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(
|
|
50
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var n=!0,o=!1,h;return{s:function(){t=t.call(i)},n:function(){var a=t.next();return n=a.done,a},e:function(a){o=!0,h=a},f:function(){try{!n&&t.return!=null&&t.return()}finally{if(o)throw h}}}}function jh(i,e){if(i){if(typeof i=="string")return
|
|
49
|
+
`),this.close()}_(e,t){return e.toLowerCase()==="y"?(this.value=!0,this.submit()):e.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(Hr.hide):this.out.write(Th(this.outputText,this.out.columns)),super.render(),this.outputText=[Vr.symbol(this.done,this.aborted),Fr.bold(this.msg),Vr.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:Fr.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write($h.line+Hr.to(0)+this.outputText))}};Nr.exports=gt});var Jr=u((Bu,Gr)=>{"use strict";Gr.exports={TextPrompt:_i(),SelectPrompt:Ei(),TogglePrompt:Li(),DatePrompt:gr(),NumberPrompt:qr(),MultiselectPrompt:at(),AutocompletePrompt:kr(),AutocompleteMultiselectPrompt:Rr(),ConfirmPrompt:Ur()}});var zr=u(Br=>{"use strict";var b=Br,Ch=Jr(),Ie=i=>i;function M(i,e,t={}){return new Promise((r,s)=>{let n=new Ch[i](e),o=t.onAbort||Ie,h=t.onSubmit||Ie,l=t.onExit||Ie;n.on("state",e.onState||Ie),n.on("submit",a=>r(h(a))),n.on("exit",a=>r(l(a))),n.on("abort",a=>s(o(a)))})}b.text=i=>M("TextPrompt",i);b.password=i=>(i.style="password",b.text(i));b.invisible=i=>(i.style="invisible",b.text(i));b.number=i=>M("NumberPrompt",i);b.date=i=>M("DatePrompt",i);b.confirm=i=>M("ConfirmPrompt",i);b.list=i=>{let e=i.separator||",";return M("TextPrompt",i,{onSubmit:t=>t.split(e).map(r=>r.trim())})};b.toggle=i=>M("TogglePrompt",i);b.select=i=>M("SelectPrompt",i);b.multiselect=i=>{i.choices=[].concat(i.choices||[]);let e=t=>t.filter(r=>r.selected).map(r=>r.value);return M("MultiselectPrompt",i,{onAbort:e,onSubmit:e})};b.autocompleteMultiselect=i=>{i.choices=[].concat(i.choices||[]);let e=t=>t.filter(r=>r.selected).map(r=>r.value);return M("AutocompleteMultiselectPrompt",i,{onAbort:e,onSubmit:e})};var _h=(i,e)=>Promise.resolve(e.filter(t=>t.title.slice(0,i.length).toLowerCase()===i.toLowerCase()));b.autocomplete=i=>(i.suggest=i.suggest||_h,i.choices=[].concat(i.choices||[]),M("AutocompletePrompt",i))});var is=u((Zu,ts)=>{"use strict";function Zr(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(i);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(i,s).enumerable})),t.push.apply(t,r)}return t}function Wr(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Zr(Object(t),!0).forEach(function(r){Dh(i,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Zr(Object(t)).forEach(function(r){Object.defineProperty(i,r,Object.getOwnPropertyDescriptor(t,r))})}return i}function Dh(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function kh(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=jh(i))||e&&i&&typeof i.length=="number"){t&&(i=t);var r=0,s=function(){};return{s,n:function(){return r>=i.length?{done:!0}:{done:!1,value:i[r++]}},e:function(a){throw a},f:s}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
50
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var n=!0,o=!1,h;return{s:function(){t=t.call(i)},n:function(){var a=t.next();return n=a.done,a},e:function(a){o=!0,h=a},f:function(){try{!n&&t.return!=null&&t.return()}finally{if(o)throw h}}}}function jh(i,e){if(i){if(typeof i=="string")return Kr(i,e);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return Array.from(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Kr(i,e)}}function Kr(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=i[t];return r}function Xr(i,e,t,r,s,n,o){try{var h=i[n](o),l=h.value}catch(a){t(a);return}h.done?e(l):Promise.resolve(l).then(r,s)}function Qr(i){return function(){var e=this,t=arguments;return new Promise(function(r,s){var n=i.apply(e,t);function o(l){Xr(n,r,s,o,h,"next",l)}function h(l){Xr(n,r,s,o,h,"throw",l)}o(void 0)})}}var bt=zr(),Eh=["suggest","format","onState","validate","onRender","type"],es=()=>{};function Y(){return vt.apply(this,arguments)}function vt(){return vt=Qr(function*(i=[],{onSubmit:e=es,onCancel:t=es}={}){let r={},s=Y._override||{};i=[].concat(i);let n,o,h,l,a,x,W=(function(){var V=Qr(function*(_,be,Kt=!1){if(!(!Kt&&_.validate&&_.validate(be)!==!0))return _.format?yield _.format(be,r):be});return function(be,Kt){return V.apply(this,arguments)}})();var m=kh(i),S;try{for(m.s();!(S=m.n()).done;){o=S.value;var ge=o;if(l=ge.name,a=ge.type,typeof a=="function"&&(a=yield a(n,Wr({},r),o),o.type=a),!!a){for(let V in o){if(Eh.includes(V))continue;let _=o[V];o[V]=typeof _=="function"?yield _(n,Wr({},r),x):_}if(x=o,typeof o.message!="string")throw new Error("prompt message is required");var Wt=o;if(l=Wt.name,a=Wt.type,bt[a]===void 0)throw new Error(`prompt type (${a}) is not defined`);if(s[o.name]!==void 0&&(n=yield W(o,s[o.name]),n!==void 0)){r[l]=n;continue}try{n=Y._injected?Ah(Y._injected,o.initial):yield bt[a](o),r[l]=n=yield W(o,n,!0),h=yield e(o,n,r)}catch{h=!(yield t(o,r))}if(h)return r}}}catch(V){m.e(V)}finally{m.f()}return r}),vt.apply(this,arguments)}function Ah(i,e){let t=i.shift();if(t instanceof Error)throw t;return t===void 0?e:t}function Rh(i){Y._injected=(Y._injected||[]).concat(i)}function Fh(i){Y._override=Object.assign({},i)}ts.exports=Object.assign(Y,{prompt:Y,prompts:bt,inject:Rh,override:Fh})});var ss=u((Wu,rs)=>{"use strict";rs.exports=(i,e)=>{if(!(i.meta&&i.name!=="escape")){if(i.ctrl){if(i.name==="a")return"first";if(i.name==="c"||i.name==="d")return"abort";if(i.name==="e")return"last";if(i.name==="g")return"reset"}if(e){if(i.name==="j")return"down";if(i.name==="k")return"up"}return i.name==="return"||i.name==="enter"?"submit":i.name==="backspace"?"delete":i.name==="delete"?"deleteForward":i.name==="abort"?"abort":i.name==="escape"?"exit":i.name==="tab"?"next":i.name==="pagedown"?"nextPage":i.name==="pageup"?"prevPage":i.name==="home"?"home":i.name==="end"?"end":i.name==="up"?"up":i.name==="down"?"down":i.name==="right"?"right":i.name==="left"?"left":!1}}});var Te=u((Ku,ns)=>{"use strict";ns.exports=i=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),t=new RegExp(e,"g");return typeof i=="string"?i.replace(t,""):i}});var ls=u((Xu,hs)=>{"use strict";var Vh=Te(),{erase:os,cursor:Hh}=p(),Lh=i=>[...Vh(i)].length;hs.exports=function(i,e){if(!e)return os.line+Hh.to(0);let t=0,r=i.split(/\r?\n/);for(let s of r)t+=1+Math.floor(Math.max(Lh(s)-1,0)/e);return os.lines(t)}});var yt=u((Qu,us)=>{"use strict";var de={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},Yh={arrowUp:de.arrowUp,arrowDown:de.arrowDown,arrowLeft:de.arrowLeft,arrowRight:de.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},Nh=process.platform==="win32"?Yh:de;us.exports=Nh});var cs=u((ea,as)=>{"use strict";var ee=f(),z=yt(),wt=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}`}}),Uh=i=>wt[i]||wt.default,fe=Object.freeze({aborted:ee.red(z.cross),done:ee.green(z.tick),exited:ee.yellow(z.cross),default:ee.cyan("?")}),Gh=(i,e,t)=>e?fe.aborted:t?fe.exited:i?fe.done:fe.default,Jh=i=>ee.gray(i?z.ellipsis:z.pointerSmall),Bh=(i,e)=>ee.gray(i?e?z.pointerSmall:"+":z.line);as.exports={styles:wt,render:Uh,symbols:fe,symbol:Gh,delimiter:Jh,item:Bh}});var fs=u((ta,ds)=>{"use strict";var zh=Te();ds.exports=function(i,e){let t=String(zh(i)||"").split(/\r?\n/);return e?t.map(r=>Math.ceil(r.length/e)).reduce((r,s)=>r+s):t.length}});var ms=u((ia,ps)=>{"use strict";ps.exports=(i,e={})=>{let t=Number.isSafeInteger(parseInt(e.margin))?new Array(parseInt(e.margin)).fill(" ").join(""):e.margin||"",r=e.width;return(i||"").split(/\r?\n/g).map(s=>s.split(/\s+/g).reduce((n,o)=>(o.length+t.length>=r||n[n.length-1].length+o.length+1<r?n[n.length-1]+=` ${o}`:n.push(`${t}${o}`),n),[t]).join(`
|
|
51
51
|
`)).join(`
|
|
52
|
-
`)}});var
|
|
52
|
+
`)}});var bs=u((ra,gs)=>{"use strict";gs.exports=(i,e,t)=>{t=t||e;let r=Math.min(e-t,i-Math.floor(t/2));r<0&&(r=0);let s=Math.min(r+t,e);return{startIndex:r,endIndex:s}}});var w=u((sa,vs)=>{"use strict";vs.exports={action:ss(),clear:ls(),style:cs(),strip:Te(),figures:yt(),lines:fs(),wrap:ms(),entriesToDisplay:bs()}});var A=u((na,ws)=>{"use strict";var ys=require("readline"),{action:Zh}=w(),Wh=require("events"),{beep:Kh,cursor:Xh}=p(),Qh=f(),xt=class extends Wh{constructor(e={}){super(),this.firstRender=!0,this.in=e.stdin||process.stdin,this.out=e.stdout||process.stdout,this.onRender=(e.onRender||(()=>{})).bind(this);let t=ys.createInterface({input:this.in,escapeCodeTimeout:50});ys.emitKeypressEvents(this.in,t),this.in.isTTY&&this.in.setRawMode(!0);let r=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,s=(n,o)=>{let h=Zh(o,r);h===!1?this._&&this._(n,o):typeof this[h]=="function"?this[h](o):this.bell()};this.close=()=>{this.out.write(Xh.show),this.in.removeListener("keypress",s),this.in.isTTY&&this.in.setRawMode(!1),t.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",s)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(Kh)}render(){this.onRender(Qh),this.firstRender&&(this.firstRender=!1)}};ws.exports=xt});var Ss=u((oa,xs)=>{var $e=f(),el=A(),{erase:tl,cursor:pe}=p(),{style:St,clear:qt,lines:il,figures:rl}=w(),Ot=class extends el{constructor(e={}){super(e),this.transform=St.render(e.style),this.scale=this.transform.scale,this.msg=e.message,this.initial=e.initial||"",this.validator=e.validate||(()=>!0),this.value="",this.errorMsg=e.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=qt("",this.out.columns),this.render()}set value(e){!e&&this.initial?(this.placeholder=!0,this.rendered=$e.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(e)),this._value=e,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=+!!this.initial,this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
|
|
53
53
|
`),this.close()}async validate(){let e=await this.validator(this.value);typeof e=="string"&&(this.errorMsg=e,e=!1),this.error=!e}async submit(){if(this.value=this.value||this.initial,this.cursorOffset=0,this.cursor=this.rendered.length,await this.validate(),this.error){this.red=!0,this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
54
|
-
`),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(e){this.placeholder||(this.cursor=this.cursor+e,this.cursorOffset+=e)}_(e,t){let r=this.value.slice(0,this.cursor),s=this.value.slice(this.cursor);this.value=`${r}${e}${s}`,this.red=!1,this.cursor=this.placeholder?0:r.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let e=this.value.slice(0,this.cursor-1),t=this.value.slice(this.cursor);this.value=`${e}${t}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let e=this.value.slice(0,this.cursor),t=this.value.slice(this.cursor+1);this.value=`${e}${t}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(
|
|
54
|
+
`),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(e){this.placeholder||(this.cursor=this.cursor+e,this.cursorOffset+=e)}_(e,t){let r=this.value.slice(0,this.cursor),s=this.value.slice(this.cursor);this.value=`${r}${e}${s}`,this.red=!1,this.cursor=this.placeholder?0:r.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let e=this.value.slice(0,this.cursor-1),t=this.value.slice(this.cursor);this.value=`${e}${t}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let e=this.value.slice(0,this.cursor),t=this.value.slice(this.cursor+1);this.value=`${e}${t}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(pe.down(il(this.outputError,this.out.columns)-1)+qt(this.outputError,this.out.columns)),this.out.write(qt(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[St.symbol(this.done,this.aborted),$e.bold(this.msg),St.delimiter(this.done),this.red?$e.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
55
55
|
`).reduce((e,t,r)=>e+`
|
|
56
|
-
${r?" ":rl.pointerSmall} ${
|
|
56
|
+
${r?" ":rl.pointerSmall} ${$e.red().italic(t)}`,"")),this.out.write(tl.line+pe.to(0)+this.outputText+pe.save+this.outputError+pe.restore+pe.move(this.cursorOffset,0)))}};xs.exports=Ot});var Ms=u((ha,Ps)=>{"use strict";var R=f(),sl=A(),{style:qs,clear:Os,figures:Ce,wrap:nl,entriesToDisplay:ol}=w(),{cursor:hl}=p(),Pt=class extends sl{constructor(e={}){super(e),this.msg=e.message,this.hint=e.hint||"- Use arrow-keys. Return to submit.",this.warn=e.warn||"- This option is disabled",this.cursor=e.initial||0,this.choices=e.choices.map((t,r)=>(typeof t=="string"&&(t={title:t,value:r}),{title:t&&(t.title||t.value||t),value:t&&(t.value===void 0?r:t.value),description:t&&t.description,selected:t&&t.selected,disabled:t&&t.disabled})),this.optionsPerPage=e.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=Os("",this.out.columns),this.render()}moveCursor(e){this.cursor=e,this.value=this.choices[e].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
57
57
|
`),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
58
|
-
`),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(e,t){if(e===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(hl.hide):this.out.write(
|
|
59
|
-
`;for(let r=e;r<t;r++){let s,n,o="",h=this.choices[r];r===e&&e>0?n=
|
|
58
|
+
`),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(e,t){if(e===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(hl.hide):this.out.write(Os(this.outputText,this.out.columns)),super.render();let{startIndex:e,endIndex:t}=ol(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[qs.symbol(this.done,this.aborted),R.bold(this.msg),qs.delimiter(!1),this.done?this.selection.title:this.selection.disabled?R.yellow(this.warn):R.gray(this.hint)].join(" "),!this.done){this.outputText+=`
|
|
59
|
+
`;for(let r=e;r<t;r++){let s,n,o="",h=this.choices[r];r===e&&e>0?n=Ce.arrowUp:r===t-1&&t<this.choices.length?n=Ce.arrowDown:n=" ",h.disabled?(s=this.cursor===r?R.gray().underline(h.title):R.strikethrough().gray(h.title),n=(this.cursor===r?R.bold().gray(Ce.pointer)+" ":" ")+n):(s=this.cursor===r?R.cyan().underline(h.title):h.title,n=(this.cursor===r?R.cyan(Ce.pointer)+" ":" ")+n,h.description&&this.cursor===r&&(o=` - ${h.description}`,(n.length+s.length+o.length>=this.out.columns||h.description.split(/\r?\n/).length>1)&&(o=`
|
|
60
60
|
`+nl(h.description,{margin:3,width:this.out.columns})))),this.outputText+=`${n} ${s}${R.gray(o)}
|
|
61
|
-
`}}this.out.write(this.outputText)}};
|
|
61
|
+
`}}this.out.write(this.outputText)}};Ps.exports=Pt});var Cs=u((la,$s)=>{var _e=f(),ll=A(),{style:Is,clear:ul}=w(),{cursor:Ts,erase:al}=p(),Mt=class extends ll{constructor(e={}){super(e),this.msg=e.message,this.value=!!e.initial,this.active=e.active||"on",this.inactive=e.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
62
62
|
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
63
|
-
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(e,t){if(e===" ")this.value=!this.value;else if(e==="1")this.value=!0;else if(e==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(
|
|
63
|
+
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(e,t){if(e===" ")this.value=!this.value;else if(e==="1")this.value=!0;else if(e==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(Ts.hide):this.out.write(ul(this.outputText,this.out.columns)),super.render(),this.outputText=[Is.symbol(this.done,this.aborted),_e.bold(this.msg),Is.delimiter(this.done),this.value?this.inactive:_e.cyan().underline(this.inactive),_e.gray("/"),this.value?_e.cyan().underline(this.active):this.active].join(" "),this.out.write(al.line+Ts.to(0)+this.outputText))}};$s.exports=Mt});var I=u((ua,_s)=>{"use strict";var It=class i{constructor({token:e,date:t,parts:r,locales:s}){this.token=e,this.date=t||new Date,this.parts=r||[this],this.locales=s||{}}up(){}down(){}next(){let e=this.parts.indexOf(this);return this.parts.find((t,r)=>r>e&&t instanceof i)}setTo(e){}prev(){let e=[].concat(this.parts).reverse(),t=e.indexOf(this);return e.find((r,s)=>s>t&&r instanceof i)}toString(){return String(this.date)}};_s.exports=It});var ks=u((aa,Ds)=>{"use strict";var cl=I(),Tt=class extends cl{constructor(e={}){super(e)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let e=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?e.toUpperCase():e}};Ds.exports=Tt});var Es=u((ca,js)=>{"use strict";var dl=I(),fl=i=>(i=i%10,i===1?"st":i===2?"nd":i===3?"rd":"th"),$t=class extends dl{constructor(e={}){super(e)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(e){this.date.setDate(parseInt(e.substr(-2)))}toString(){let e=this.date.getDate(),t=this.date.getDay();return this.token==="DD"?String(e).padStart(2,"0"):this.token==="Do"?e+fl(e):this.token==="d"?t+1:this.token==="ddd"?this.locales.weekdaysShort[t]:this.token==="dddd"?this.locales.weekdays[t]:e}};js.exports=$t});var Rs=u((da,As)=>{"use strict";var pl=I(),Ct=class extends pl{constructor(e={}){super(e)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(e){this.date.setHours(parseInt(e.substr(-2)))}toString(){let e=this.date.getHours();return/h/.test(this.token)&&(e=e%12||12),this.token.length>1?String(e).padStart(2,"0"):e}};As.exports=Ct});var Vs=u((fa,Fs)=>{"use strict";var ml=I(),_t=class extends ml{constructor(e={}){super(e)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(e){this.date.setMilliseconds(parseInt(e.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};Fs.exports=_t});var Ls=u((pa,Hs)=>{"use strict";var gl=I(),Dt=class extends gl{constructor(e={}){super(e)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(e){this.date.setMinutes(parseInt(e.substr(-2)))}toString(){let e=this.date.getMinutes();return this.token.length>1?String(e).padStart(2,"0"):e}};Hs.exports=Dt});var Ns=u((ma,Ys)=>{"use strict";var bl=I(),kt=class extends bl{constructor(e={}){super(e)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(e){e=parseInt(e.substr(-2))-1,this.date.setMonth(e<0?0:e)}toString(){let e=this.date.getMonth(),t=this.token.length;return t===2?String(e+1).padStart(2,"0"):t===3?this.locales.monthsShort[e]:t===4?this.locales.months[e]:String(e+1)}};Ys.exports=kt});var Gs=u((ga,Us)=>{"use strict";var vl=I(),jt=class extends vl{constructor(e={}){super(e)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(e){this.date.setSeconds(parseInt(e.substr(-2)))}toString(){let e=this.date.getSeconds();return this.token.length>1?String(e).padStart(2,"0"):e}};Us.exports=jt});var Bs=u((ba,Js)=>{"use strict";var yl=I(),Et=class extends yl{constructor(e={}){super(e)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(e){this.date.setFullYear(e.substr(-4))}toString(){let e=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?e.substr(-2):e}};Js.exports=Et});var Zs=u((va,zs)=>{"use strict";zs.exports={DatePart:I(),Meridiem:ks(),Day:Es(),Hours:Rs(),Milliseconds:Vs(),Minutes:Ls(),Month:Ns(),Seconds:Gs(),Year:Bs()}});var rn=u((ya,tn)=>{"use strict";var At=f(),wl=A(),{style:Ws,clear:Ks,figures:xl}=w(),{erase:Sl,cursor:Xs}=p(),{DatePart:Qs,Meridiem:ql,Day:Ol,Hours:Pl,Milliseconds:Ml,Minutes:Il,Month:Tl,Seconds:$l,Year:Cl}=Zs(),_l=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,en={1:({token:i})=>i.replace(/\\(.)/g,"$1"),2:i=>new Ol(i),3:i=>new Tl(i),4:i=>new Cl(i),5:i=>new ql(i),6:i=>new Pl(i),7:i=>new Il(i),8:i=>new $l(i),9:i=>new Ml(i)},Dl={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(",")},Rt=class extends wl{constructor(e={}){super(e),this.msg=e.message,this.cursor=0,this.typed="",this.locales=Object.assign(Dl,e.locales),this._date=e.initial||new Date,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.mask=e.mask||"YYYY-MM-DD HH:mm:ss",this.clear=Ks("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(e){e&&this._date.setTime(e.getTime())}set mask(e){let t;for(this.parts=[];t=_l.exec(e);){let s=t.shift(),n=t.findIndex(o=>o!=null);this.parts.push(n in en?en[n]({token:t[n]||s,date:this.date,parts:this.parts,locales:this.locales}):t[n]||s)}let r=this.parts.reduce((s,n)=>(typeof n=="string"&&typeof s[s.length-1]=="string"?s[s.length-1]+=n:s.push(n),s),[]);this.parts.splice(0),this.parts.push(...r),this.reset()}moveCursor(e){this.typed="",this.cursor=e,this.fire()}reset(){this.moveCursor(this.parts.findIndex(e=>e instanceof Qs)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
64
64
|
`),this.close()}async validate(){let e=await this.validator(this.value);typeof e=="string"&&(this.errorMsg=e,e=!1),this.error=!e}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
65
|
-
`),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let e=this.parts[this.cursor].prev();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}right(){let e=this.parts[this.cursor].next();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}next(){let e=this.parts[this.cursor].next();this.moveCursor(e?this.parts.indexOf(e):this.parts.findIndex(t=>t instanceof
|
|
65
|
+
`),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let e=this.parts[this.cursor].prev();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}right(){let e=this.parts[this.cursor].next();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}next(){let e=this.parts[this.cursor].next();this.moveCursor(e?this.parts.indexOf(e):this.parts.findIndex(t=>t instanceof Qs)),this.render()}_(e){/\d/.test(e)&&(this.typed+=e,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(Xs.hide):this.out.write(Ks(this.outputText,this.out.columns)),super.render(),this.outputText=[Ws.symbol(this.done,this.aborted),At.bold(this.msg),Ws.delimiter(!1),this.parts.reduce((e,t,r)=>e.concat(r===this.cursor&&!this.done?At.cyan().underline(t.toString()):t),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
|
|
66
66
|
`).reduce((e,t,r)=>e+`
|
|
67
|
-
${r?" ":xl.pointerSmall} ${At.red().italic(t)}`,"")),this.out.write(Sl.line+
|
|
67
|
+
${r?" ":xl.pointerSmall} ${At.red().italic(t)}`,"")),this.out.write(Sl.line+Xs.to(0)+this.outputText))}};tn.exports=Rt});var hn=u((wa,on)=>{var De=f(),kl=A(),{cursor:ke,erase:jl}=p(),{style:Ft,figures:El,clear:sn,lines:Al}=w(),Rl=/[0-9]/,Vt=i=>i!==void 0,nn=(i,e)=>{let t=Math.pow(10,e);return Math.round(i*t)/t},Ht=class extends kl{constructor(e={}){super(e),this.transform=Ft.render(e.style),this.msg=e.message,this.initial=Vt(e.initial)?e.initial:"",this.float=!!e.float,this.round=e.round||2,this.inc=e.increment||1,this.min=Vt(e.min)?e.min:-1/0,this.max=Vt(e.max)?e.max:1/0,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(e){!e&&e!==0?(this.placeholder=!0,this.rendered=De.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${nn(e,this.round)}`),this._value=nn(e,this.round)),this.fire()}get value(){return this._value}parse(e){return this.float?parseFloat(e):parseInt(e)}valid(e){return e==="-"||e==="."&&this.float||Rl.test(e)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let e=this.value;this.value=e!==""?e:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
68
68
|
`),this.close()}async validate(){let e=await this.validator(this.value);typeof e=="string"&&(this.errorMsg=e,e=!1),this.error=!e}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}let e=this.value;this.value=e!==""?e:this.initial,this.done=!0,this.aborted=!1,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
69
|
-
`),this.close()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let e=this.value.toString();if(e.length===0)return this.bell();this.value=this.parse(e=e.slice(0,-1))||"",this.value!==""&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(e,t){if(!this.valid(e))return this.bell();let r=Date.now();if(r-this.lastHit>1e3&&(this.typed=""),this.typed+=e,this.lastHit=r,this.color="cyan",e===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(
|
|
69
|
+
`),this.close()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let e=this.value.toString();if(e.length===0)return this.bell();this.value=this.parse(e=e.slice(0,-1))||"",this.value!==""&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(e,t){if(!this.valid(e))return this.bell();let r=Date.now();if(r-this.lastHit>1e3&&(this.typed=""),this.typed+=e,this.lastHit=r,this.color="cyan",e===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(ke.down(Al(this.outputError,this.out.columns)-1)+sn(this.outputError,this.out.columns)),this.out.write(sn(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[Ft.symbol(this.done,this.aborted),De.bold(this.msg),Ft.delimiter(this.done),!this.done||!this.done&&!this.placeholder?De[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
70
70
|
`).reduce((e,t,r)=>e+`
|
|
71
|
-
${r?" ":El.pointerSmall} ${
|
|
71
|
+
${r?" ":El.pointerSmall} ${De.red().italic(t)}`,"")),this.out.write(jl.line+ke.to(0)+this.outputText+ke.save+this.outputError+ke.restore))}};on.exports=Ht});var Yt=u((xa,an)=>{"use strict";var T=f(),{cursor:Fl}=p(),Vl=A(),{clear:ln,figures:N,style:un,wrap:Hl,entriesToDisplay:Ll}=w(),Lt=class extends Vl{constructor(e={}){super(e),this.msg=e.message,this.cursor=e.cursor||0,this.scrollIndex=e.cursor||0,this.hint=e.hint||"",this.warn=e.warn||"- This option is disabled -",this.minSelected=e.min,this.showMinError=!1,this.maxChoices=e.max,this.instructions=e.instructions,this.optionsPerPage=e.optionsPerPage||10,this.value=e.choices.map((t,r)=>(typeof t=="string"&&(t={title:t,value:r}),{title:t&&(t.title||t.value||t),description:t&&t.description,value:t&&(t.value===void 0?r:t.value),selected:t&&t.selected,disabled:t&&t.disabled})),this.clear=ln("",this.out.columns),e.overrideRender||this.render()}reset(){this.value.map(e=>!e.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(e=>e.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
72
72
|
`),this.close()}submit(){let e=this.value.filter(t=>t.selected);this.minSelected&&e.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
73
73
|
`),this.close())}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render()}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){let e=this.value[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let e=!this.value[this.cursor].selected;this.value.filter(t=>!t.disabled).forEach(t=>t.selected=e),this.render()}_(e,t){if(e===" ")this.handleSpaceToggle();else if(e==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
74
74
|
Instructions:
|
|
@@ -76,23 +76,23 @@ Instructions:
|
|
|
76
76
|
${N.arrowLeft}/${N.arrowRight}/[space]: Toggle selection
|
|
77
77
|
`+(this.maxChoices===void 0?` a: Toggle all
|
|
78
78
|
`:"")+" enter/return: Complete answer":""}renderOption(e,t,r,s){let n=(t.selected?T.green(N.radioOn):N.radioOff)+" "+s+" ",o,h;return t.disabled?o=e===r?T.gray().underline(t.title):T.strikethrough().gray(t.title):(o=e===r?T.cyan().underline(t.title):t.title,e===r&&t.description&&(h=` - ${t.description}`,(n.length+o.length+h.length>=this.out.columns||t.description.split(/\r?\n/).length>1)&&(h=`
|
|
79
|
-
`+
|
|
79
|
+
`+Hl(t.description,{margin:n.length,width:this.out.columns})))),n+o+T.gray(h||"")}paginateOptions(e){if(e.length===0)return T.red("No matches for this query.");let{startIndex:t,endIndex:r}=Ll(this.cursor,e.length,this.optionsPerPage),s,n=[];for(let o=t;o<r;o++)o===t&&t>0?s=N.arrowUp:o===r-1&&r<e.length?s=N.arrowDown:s=" ",n.push(this.renderOption(this.cursor,e[o],o,s));return`
|
|
80
80
|
`+n.join(`
|
|
81
|
-
`)}renderOptions(e){return this.done?"":this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[T.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&e.push(T.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(
|
|
81
|
+
`)}renderOptions(e){return this.done?"":this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[T.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&e.push(T.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Fl.hide),super.render();let e=[un.symbol(this.done,this.aborted),T.bold(this.msg),un.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=T.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.value),this.out.write(this.clear+e),this.clear=ln(e,this.out.columns)}};an.exports=Lt});var mn=u((Sa,pn)=>{"use strict";var me=f(),Yl=A(),{erase:Nl,cursor:cn}=p(),{style:Nt,clear:dn,figures:Ut,wrap:Ul,entriesToDisplay:Gl}=w(),fn=(i,e)=>i[e]&&(i[e].value||i[e].title||i[e]),Jl=(i,e)=>i[e]&&(i[e].title||i[e].value||i[e]),Bl=(i,e)=>{let t=i.findIndex(r=>r.value===e||r.title===e);return t>-1?t:void 0},Gt=class extends Yl{constructor(e={}){super(e),this.msg=e.message,this.suggest=e.suggest,this.choices=e.choices,this.initial=typeof e.initial=="number"?e.initial:Bl(e.choices,e.initial),this.select=this.initial||e.cursor||0,this.i18n={noMatches:e.noMatches||"no matches found"},this.fallback=e.fallback||this.initial,this.clearFirst=e.clearFirst||!1,this.suggestions=[],this.input="",this.limit=e.limit||10,this.cursor=0,this.transform=Nt.render(e.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=dn("",this.out.columns),this.complete(this.render),this.render()}set fallback(e){this._fb=Number.isSafeInteger(parseInt(e))?parseInt(e):e}get fallback(){let e;return typeof this._fb=="number"?e=this.choices[this._fb]:typeof this._fb=="string"&&(e={title:this._fb}),e||this._fb||{title:this.i18n.noMatches}}moveSelect(e){this.select=e,this.suggestions.length>0?this.value=fn(this.suggestions,e):this.value=this.fallback.value,this.fire()}async complete(e){let t=this.completing=this.suggest(this.input,this.choices),r=await t;if(this.completing!==t)return;this.suggestions=r.map((n,o,h)=>({title:Jl(h,o),value:fn(h,o),description:n.description})),this.completing=!1;let s=Math.max(r.length-1,0);this.moveSelect(Math.min(s,this.select)),e&&e()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
82
82
|
`),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
83
83
|
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
84
|
-
`),this.close()}_(e,t){let r=this.input.slice(0,this.cursor),s=this.input.slice(this.cursor);this.input=`${r}${e}${s}`,this.cursor=r.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let e=this.input.slice(0,this.cursor-1),t=this.input.slice(this.cursor);this.input=`${e}${t}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let e=this.input.slice(0,this.cursor),t=this.input.slice(this.cursor+1);this.input=`${e}${t}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(e,t,r,s){let n,o=r?Ut.arrowUp:s?Ut.arrowDown:" ",h=t?
|
|
85
|
-
`+Ul(e.description,{margin:3,width:this.out.columns}))),o+" "+h+
|
|
84
|
+
`),this.close()}_(e,t){let r=this.input.slice(0,this.cursor),s=this.input.slice(this.cursor);this.input=`${r}${e}${s}`,this.cursor=r.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let e=this.input.slice(0,this.cursor-1),t=this.input.slice(this.cursor);this.input=`${e}${t}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let e=this.input.slice(0,this.cursor),t=this.input.slice(this.cursor+1);this.input=`${e}${t}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(e,t,r,s){let n,o=r?Ut.arrowUp:s?Ut.arrowDown:" ",h=t?me.cyan().underline(e.title):e.title;return o=(t?me.cyan(Ut.pointer)+" ":" ")+o,e.description&&(n=` - ${e.description}`,(o.length+h.length+n.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(n=`
|
|
85
|
+
`+Ul(e.description,{margin:3,width:this.out.columns}))),o+" "+h+me.gray(n||"")}render(){if(this.closed)return;this.firstRender?this.out.write(cn.hide):this.out.write(dn(this.outputText,this.out.columns)),super.render();let{startIndex:e,endIndex:t}=Gl(this.select,this.choices.length,this.limit);if(this.outputText=[Nt.symbol(this.done,this.aborted,this.exited),me.bold(this.msg),Nt.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(e,t).map((s,n)=>this.renderOption(s,this.select===n+e,n===0&&e>0,n+e===t-1&&t<this.choices.length)).join(`
|
|
86
86
|
`);this.outputText+=`
|
|
87
|
-
`+(r||
|
|
87
|
+
`+(r||me.gray(this.fallback.title))}this.out.write(Nl.line+cn.to(0)+this.outputText)}};pn.exports=Gt});var yn=u((qa,vn)=>{"use strict";var F=f(),{cursor:zl}=p(),Zl=Yt(),{clear:gn,style:bn,figures:te}=w(),Jt=class extends Zl{constructor(e={}){e.overrideRender=!0,super(e),this.inputValue="",this.clear=gn("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){let e=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(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 t=this.filteredOptions.findIndex(r=>r===e);this.cursor=t<0?0:t,this.render()}handleSpaceToggle(){let e=this.filteredOptions[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}handleInputChange(e){this.inputValue=this.inputValue+e,this.updateFilteredOptions()}_(e,t){e===" "?this.handleSpaceToggle():this.handleInputChange(e)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
88
88
|
Instructions:
|
|
89
|
-
${
|
|
90
|
-
${
|
|
89
|
+
${te.arrowUp}/${te.arrowDown}: Highlight option
|
|
90
|
+
${te.arrowLeft}/${te.arrowRight}/[space]: Toggle selection
|
|
91
91
|
[a,b,c]/delete: Filter choices
|
|
92
92
|
enter/return: Complete answer
|
|
93
93
|
`:""}renderCurrentInput(){return`
|
|
94
|
-
Filtered results for: ${this.inputValue?this.inputValue:
|
|
95
|
-
`}renderOption(e,t,r){let s;return t.disabled?s=e===r?
|
|
94
|
+
Filtered results for: ${this.inputValue?this.inputValue:F.gray("Enter something to filter")}
|
|
95
|
+
`}renderOption(e,t,r){let s;return t.disabled?s=e===r?F.gray().underline(t.title):F.strikethrough().gray(t.title):s=e===r?F.cyan().underline(t.title):t.title,(t.selected?F.green(te.radioOn):te.radioOff)+" "+s}renderDoneOrInstructions(){if(this.done)return this.value.filter(t=>t.selected).map(t=>t.title).join(", ");let e=[F.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&e.push(F.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(zl.hide),super.render();let e=[bn.symbol(this.done,this.aborted),F.bold(this.msg),bn.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=F.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+e),this.clear=gn(e,this.out.columns)}};vn.exports=Jt});var On=u((Oa,qn)=>{var wn=f(),Wl=A(),{style:xn,clear:Kl}=w(),{erase:Xl,cursor:Sn}=p(),Bt=class extends Wl{constructor(e={}){super(e),this.msg=e.message,this.value=e.initial,this.initialValue=!!e.initial,this.yesMsg=e.yes||"yes",this.yesOption=e.yesOption||"(Y/n)",this.noMsg=e.no||"no",this.noOption=e.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
96
96
|
`),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
97
|
-
`),this.close()}_(e,t){return e.toLowerCase()==="y"?(this.value=!0,this.submit()):e.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(
|
|
98
|
-
\u274C ${i}`),e&&console.error(e),process.exit()}
|
|
97
|
+
`),this.close()}_(e,t){return e.toLowerCase()==="y"?(this.value=!0,this.submit()):e.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(Sn.hide):this.out.write(Kl(this.outputText,this.out.columns)),super.render(),this.outputText=[xn.symbol(this.done,this.aborted),wn.bold(this.msg),xn.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:wn.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(Xl.line+Sn.to(0)+this.outputText))}};qn.exports=Bt});var Mn=u((Pa,Pn)=>{"use strict";Pn.exports={TextPrompt:Ss(),SelectPrompt:Ms(),TogglePrompt:Cs(),DatePrompt:rn(),NumberPrompt:hn(),MultiselectPrompt:Yt(),AutocompletePrompt:mn(),AutocompleteMultiselectPrompt:yn(),ConfirmPrompt:On()}});var Tn=u(In=>{"use strict";var v=In,Ql=Mn(),je=i=>i;function $(i,e,t={}){return new Promise((r,s)=>{let n=new Ql[i](e),o=t.onAbort||je,h=t.onSubmit||je,l=t.onExit||je;n.on("state",e.onState||je),n.on("submit",a=>r(h(a))),n.on("exit",a=>r(l(a))),n.on("abort",a=>s(o(a)))})}v.text=i=>$("TextPrompt",i);v.password=i=>(i.style="password",v.text(i));v.invisible=i=>(i.style="invisible",v.text(i));v.number=i=>$("NumberPrompt",i);v.date=i=>$("DatePrompt",i);v.confirm=i=>$("ConfirmPrompt",i);v.list=i=>{let e=i.separator||",";return $("TextPrompt",i,{onSubmit:t=>t.split(e).map(r=>r.trim())})};v.toggle=i=>$("TogglePrompt",i);v.select=i=>$("SelectPrompt",i);v.multiselect=i=>{i.choices=[].concat(i.choices||[]);let e=t=>t.filter(r=>r.selected).map(r=>r.value);return $("MultiselectPrompt",i,{onAbort:e,onSubmit:e})};v.autocompleteMultiselect=i=>{i.choices=[].concat(i.choices||[]);let e=t=>t.filter(r=>r.selected).map(r=>r.value);return $("AutocompleteMultiselectPrompt",i,{onAbort:e,onSubmit:e})};var eu=(i,e)=>Promise.resolve(e.filter(t=>t.title.slice(0,i.length).toLowerCase()===i.toLowerCase()));v.autocomplete=i=>(i.suggest=i.suggest||eu,i.choices=[].concat(i.choices||[]),$("AutocompletePrompt",i))});var _n=u((Ia,Cn)=>{"use strict";var zt=Tn(),tu=["suggest","format","onState","validate","onRender","type"],$n=()=>{};async function U(i=[],{onSubmit:e=$n,onCancel:t=$n}={}){let r={},s=U._override||{};i=[].concat(i);let n,o,h,l,a,x,W=async(m,S,ge=!1)=>{if(!(!ge&&m.validate&&m.validate(S)!==!0))return m.format?await m.format(S,r):S};for(o of i)if({name:l,type:a}=o,typeof a=="function"&&(a=await a(n,{...r},o),o.type=a),!!a){for(let m in o){if(tu.includes(m))continue;let S=o[m];o[m]=typeof S=="function"?await S(n,{...r},x):S}if(x=o,typeof o.message!="string")throw new Error("prompt message is required");if({name:l,type:a}=o,zt[a]===void 0)throw new Error(`prompt type (${a}) is not defined`);if(s[o.name]!==void 0&&(n=await W(o,s[o.name]),n!==void 0)){r[l]=n;continue}try{n=U._injected?iu(U._injected,o.initial):await zt[a](o),r[l]=n=await W(o,n,!0),h=await e(o,n,r)}catch{h=!await t(o,r)}if(h)return r}return r}function iu(i,e){let t=i.shift();if(t instanceof Error)throw t;return t===void 0?e:t}function ru(i){U._injected=(U._injected||[]).concat(i)}function su(i){U._override=Object.assign({},i)}Cn.exports=Object.assign(U,{prompt:U,prompts:zt,inject:ru,override:su})});var ie=u((Ta,Dn)=>{function nu(i){i=(Array.isArray(i)?i:i.split(".")).map(Number);let e=0,t=process.versions.node.split(".").map(Number);for(;e<i.length;e++){if(t[e]>i[e])return!1;if(i[e]>t[e])return!0}return!1}Dn.exports=nu("8.6.0")?is():_n()});var Zt=q(require("path"));var K=q(require("path"));var Qt=require("fs"),Re=q(require("path"));function ve(i,e,t){(0,Qt.copyFileSync)(Re.default.join(e,i),Re.default.join(t,i))}var H=require("fs"),Fe=q(require("path"));function G(i,e){let t=(0,H.readdirSync)(i);for(let r of t){let s=Fe.default.join(i,r),n=Fe.default.join(e,r);(0,H.statSync)(s).isDirectory()?((0,H.mkdirSync)(n,{recursive:!0}),G(s,n)):(0,H.copyFileSync)(s,n)}}async function ei(i,e,t){G(K.default.join(i,"template","common"),e),t.includes("capacitor")&&G(K.default.join(i,"template","capacitor"),e),t.includes("electron")&&(G(K.default.join(i,"template","electron"),e),t.includes("builder")&&G(K.default.join(i,"template","electron-builder"),e),t.includes("forge")&&G(K.default.join(i,"template","electron-forge"),e)),ve(".gitignore",i,e),ve("LICENSE",i,e),ve("README.md",i,e)}function g(i,e){console.error(`
|
|
98
|
+
\u274C ${i}`),e&&console.error(e),process.exit()}var An=require("child_process");var ti=require("child_process");function ii(){let i=["npm"];try{(0,ti.execSync)("yarn --version",{stdio:"ignore"}),i.unshift("yarn")}catch{}return i}function J(i){console.log("");for(let e of i)console.log(e);console.log("")}var kn=q(ie());function C(i){i.aborted&&g("Operation cancelled",null)}async function Ee(i,e){return(await(0,kn.default)({type:"toggle",name:"value",message:i,initial:e,active:"yes",inactive:"no",onState:C})).value}var jn=q(ie());async function En(i,e){let t=e.map(s=>({title:s,value:s.trim().toLowerCase()}));return(await(0,jn.default)({type:"select",name:"value",message:i,choices:t,initial:0,onState:C})).value}async function Rn(i){if(await Ee("Install dependencies?",!0))try{process.chdir(i);let t=ii(),r=t[0];t.length>1&&(r=await En("Package manager",t)),J([`\u{1F4E6} Using package manager: ${r}`,"\u{1F4E6} Installing dependencies..."]),(0,An.execSync)(`${r} install`,{stdio:"inherit"}),J(["\u2705 Dependencies installed"])}catch(t){g("Error executing next steps",t)}}var Ae=require("fs");var re=require("fs");function Fn(i){try{return(0,re.existsSync)(i)?(0,re.statSync)(i).isDirectory()?(0,re.readdirSync)(i).length===0:(g(`Path is not a directory: ${i}`,null),!1):!0}catch(e){return g("Error checking directory",e),!1}}async function Vn(i){Fn(i)||(await Ee(`Directory "${i}" already exists. Overwrite?`,!1)||g("Operation cancelled",null),(0,Ae.rmSync)(i,{recursive:!0,force:!0}));try{(0,Ae.mkdirSync)(i,{recursive:!0})}catch(e){g("Error executing next steps",e)}}var Hn=q(ie());async function Ln(i,e,t=!1){let r=e.map(n=>({title:n,value:n.trim().toLowerCase(),selected:t}));return(await(0,Hn.default)({type:"multiselect",name:"value",message:i,choices:r,instructions:!1,onState:C})).value}async function Yn(){let e=await Ln("Select extended project libraries",["electron"," builder"," forge","capacitor","tauri"],!0),t={},r={},s={},n="";return e.includes("capacitor")&&(s["capacitor:android"]="cap add android",s["capacitor:ios"]="cap add ios",s["capacitor:assets"]="capacitor-assets generate --android --ios --assetPath public --androidProject build/capacitor/android --iosProject build/capacitor/ios/App",s["capacitor:make"]="npm run build && cap copy && npm run capacitor:assets",s["capacitor:dev"]="cd build/capacitor/android && gradlew assembleDebug",s["capacitor:build"]="cd build/capacitor/android && gradlew assembleRelease",t["@capacitor/android"]="^7.4.4",t["@capacitor/assets"]="^3.0.5",t["@capacitor/cli"]="^7.4.4",t["@capacitor/core"]="^7.4.4",t["@capacitor/ios"]="^7.4.4"),e.includes("electron")&&(n="electron/main.ts",s["electron:dev"]="electron .",t["@electron-forge/cli"]="^7.10.2",t["@electron/fuses"]="^1.8.0",t["@types/electron-squirrel-startup"]="^1.0.2",t.electron="^39.2.2",r["electron-squirrel-startup"]="^1.0.1",e.includes("builder")&&(s["electron:build"]="electron-builder --config electron-builder.config.js",t["electron-builder"]="^26.0.12",t["electron-builder-squirrel-windows"]="^26.0.12"),e.includes("forge")&&(s["electron:make"]="electron-forge make",s["electron:start"]="electron-forge start",s["electron:package"]="electron-forge package",t["@electron-forge/cli"]="^7.10.2",t["@electron-forge/maker-deb"]="^7.10.2",t["@electron-forge/maker-dmg"]="^7.10.2",t["@electron-forge/maker-rpm"]="^7.10.2",t["@electron-forge/maker-squirrel"]="^7.10.2",t["@electron-forge/maker-zip"]="^7.10.2",t["@electron-forge/plugin-auto-unpack-natives"]="^7.10.2",t["@electron-forge/plugin-fuses"]="^7.10.2")),e.includes("tauri")&&(s["tauri:init"]="tauri init --force",s["tauri:dev"]="tauri dev",s["tauri:build"]="tauri build",t["@tauri-apps/cli"]="^2.9.5"),{devDependencies:t,dependencies:r,scripts:s,main:n,libraries:e}}var se=require("fs"),Nn=q(require("path"));function Un(i,e,t){let r=Nn.default.join(i,"package.json");(0,se.existsSync)(r)||g(`File not found: ${r}`,null);let s=JSON.parse((0,se.readFileSync)(r,"utf8"));s.name=e.name,e.version&&(s.version=e.version),e.productName&&(s.productName=e.productName),e.description&&(s.description=e.description),e.repository&&(s.repository=e.repository),e.author&&(s.author=e.author),t.main&&(s.main=t.main),t.scripts&&(s.scripts={...s.scripts,...t.scripts}),t.devDependencies&&(s.devDependencies={...s.devDependencies,...t.devDependencies}),t.dependencies&&(s.dependencies={...s.dependencies,...t.dependencies});try{(0,se.writeFileSync)(r,JSON.stringify(s,null,2))}catch(n){g("Error write package.json",n)}}var Gn={name:"ts-vite-project",productName:"TS Vite Project",description:"TypeScript Vite Application",version:"0.1.0",author:"",repository:"",homepage:""};var Jn=q(ie());async function Bn(i,e=""){return(await(0,Jn.default)({type:"list",name:"value",message:i,initial:e,separator:".",onState:C})).value||""}var zn=q(ie());async function Z(i,e="",t=!1){return(await(0,zn.default)({type:"text",name:"value",message:i,initial:e,validate:n=>!!(!t||t&&n.trim()),onState:C})).value||""}async function Zn(){let{name:i,productName:e,description:t,version:r,author:s,repository:n,bugs:o,homepage:h}=Gn;e=(await Z("Product name (required)",e,!0)).trim(),i=e.split(" ").map(m=>m.toLowerCase()).join("-"),i=(await Z("Project (required)",i,!0)).trim(),t=(await Z("Description (required)",t,!0)).trim();let l=await Bn("Version",r);for(let m=l.length;m<3;m++)l.push("0");r=l.join("."),s={},s.name=(await Z("Author (required)","",!0)).trim(),s.email=(await Z("Email (required)","",!0)).trim(),n={};let a=`https://github.com/${s.name}/${i}.git`,x=(await Z("Repository url",a)).trim();return x&&(n.type="git",n.url=`git+${x}`,o={},s.email&&(o.email=s.email),o.url=`${x}/issues`,h=`${x}#readme`),{name:i,productName:e,description:t,version:r,author:s,repository:n,bugs:o,homepage:h}}async function ou(){J(["\u{1F680} Creating TypeScript + Vite Project","(will be installed in project name folder)","","\u26A0\uFE0F keys:","arrows - select","[enter] - confirm","[esc] - abort and exit","[space] - switch or clear","[tab] - edit default value"]);try{let i=await Zn(),e=await Yn(),t=Zt.default.resolve(i.name),r=Zt.default.resolve(__dirname,"..");await Vn(t),await ei(r,t,e.libraries),Un(t,i,e),J(["\u2705 Project created successfully!"]),await Rn(t),J(["Next steps:",`\u{1F4C1} cd ${i.name}`,"\u{1F4E6} npm install","\u2B50 npm run dev","","Happy coding! \u{1F44B}"])}catch(i){g("Error creating project",i)}}ou().catch(console.error);
|
package/package.json
CHANGED
|
@@ -1,9 +1,36 @@
|
|
|
1
1
|
import type { CapacitorConfig } from '@capacitor/cli';
|
|
2
|
+
import packageJson from './package.json' with { type: 'json' };
|
|
3
|
+
|
|
4
|
+
const author = packageJson.author?.name || packageJson.author;
|
|
5
|
+
const name = packageJson.name.replaceAll('-', '_');
|
|
6
|
+
const productName = packageJson.productName;
|
|
7
|
+
const version = packageJson.version;
|
|
2
8
|
|
|
3
9
|
const config: CapacitorConfig = {
|
|
4
|
-
appId:
|
|
5
|
-
appName:
|
|
6
|
-
webDir: 'dist'
|
|
10
|
+
appId: `com.${author}.${name}`,
|
|
11
|
+
appName: `${productName}`,
|
|
12
|
+
webDir: 'dist',
|
|
13
|
+
android: {
|
|
14
|
+
path: `build/capacitor/android/${version}`,
|
|
15
|
+
},
|
|
16
|
+
ios: {
|
|
17
|
+
path: `build/capacitor/ios/${version}`,
|
|
18
|
+
},
|
|
19
|
+
plugins: {
|
|
20
|
+
SplashScreen: {
|
|
21
|
+
launchShowDuration: 3000,
|
|
22
|
+
launchAutoHide: true,
|
|
23
|
+
backgroundColor: "#ffffffff",
|
|
24
|
+
androidSplashResourceName: "splash",
|
|
25
|
+
androidScaleType: "CENTER_CROP",
|
|
26
|
+
showSpinner: false,
|
|
27
|
+
androidSpinnerStyle: "large",
|
|
28
|
+
iosSpinnerStyle: "small",
|
|
29
|
+
spinnerColor: "#999999",
|
|
30
|
+
splashFullScreen: true,
|
|
31
|
+
splashImmersive: true,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
7
34
|
};
|
|
8
35
|
|
|
9
36
|
export default config;
|
|
Binary file
|
|
Binary file
|
|
@@ -1,23 +1,28 @@
|
|
|
1
|
+
import packageJson from './package.json' with { type: 'json' };
|
|
2
|
+
|
|
3
|
+
const author = packageJson.author?.name || packageJson.author;
|
|
4
|
+
const name = packageJson.name.replaceAll('-', '_');
|
|
5
|
+
|
|
1
6
|
export default {
|
|
2
|
-
appId:
|
|
3
|
-
|
|
7
|
+
appId: `com.${author}.${name}`,
|
|
8
|
+
artifactName: '${productName}-v${version}.${ext}',
|
|
9
|
+
icon: 'public/app.ico',
|
|
4
10
|
asar: true,
|
|
5
11
|
asarUnpack: [
|
|
6
12
|
'resources/**',
|
|
7
13
|
],
|
|
8
14
|
files: [
|
|
9
15
|
'dist/**/*',
|
|
10
|
-
'electron/**/*',
|
|
11
|
-
],
|
|
12
|
-
extraResources: [
|
|
13
|
-
{
|
|
14
|
-
from: 'electron/app.ico',
|
|
15
|
-
to: 'app.ico',
|
|
16
|
-
},
|
|
17
16
|
],
|
|
17
|
+
// extraResources: [
|
|
18
|
+
// {
|
|
19
|
+
// from: 'public/app.ico',
|
|
20
|
+
// to: 'app.ico',
|
|
21
|
+
// },
|
|
22
|
+
// ],
|
|
18
23
|
directories: {
|
|
19
24
|
// buildResources: "build/resources",
|
|
20
|
-
output: '
|
|
25
|
+
output: 'build/electron-builder/${version}',
|
|
21
26
|
},
|
|
22
27
|
// mac: {
|
|
23
28
|
// category: 'your.app.category.type',
|
|
@@ -31,8 +36,8 @@ export default {
|
|
|
31
36
|
// target: 'AppImage',
|
|
32
37
|
// },
|
|
33
38
|
nsis: {
|
|
34
|
-
installerIcon: '
|
|
35
|
-
uninstallerIcon: '
|
|
39
|
+
installerIcon: 'public/app.ico',
|
|
40
|
+
uninstallerIcon: 'public/app.ico',
|
|
36
41
|
license: 'LICENSE',
|
|
37
42
|
oneClick: false,
|
|
38
43
|
allowToChangeInstallationDirectory: true,
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import { FusesPlugin } from '@electron-forge/plugin-fuses';
|
|
2
2
|
import { FuseV1Options, FuseVersion } from '@electron/fuses';
|
|
3
|
+
import packageJson from './package.json' with { type: 'json' };
|
|
4
|
+
|
|
5
|
+
const author = packageJson.author?.name || packageJson.author;
|
|
6
|
+
const name = packageJson.name.replaceAll('-', '_');
|
|
3
7
|
|
|
4
8
|
export default {
|
|
9
|
+
outDir: 'build/electron-forge/${version}',
|
|
5
10
|
packagerConfig: {
|
|
6
|
-
|
|
11
|
+
appBundleId: `com.${author}.${name}`,
|
|
12
|
+
icon: 'public/app.ico',
|
|
7
13
|
asar: true,
|
|
8
14
|
asarUnpack: [
|
|
9
15
|
'resources/**',
|
|
10
16
|
],
|
|
11
17
|
extraResource: [
|
|
12
|
-
'
|
|
18
|
+
'public/app.ico',
|
|
13
19
|
],
|
|
14
20
|
},
|
|
15
21
|
rebuildConfig: {},
|
|
@@ -19,8 +25,8 @@ export default {
|
|
|
19
25
|
config: {
|
|
20
26
|
// frameworkVersion: 'net461',
|
|
21
27
|
iconUrl: 'file:///',
|
|
22
|
-
setupIcon: '
|
|
23
|
-
loadingGif: '
|
|
28
|
+
setupIcon: 'public/app.ico',
|
|
29
|
+
loadingGif: 'public/splash.png',
|
|
24
30
|
createDesktopShortcut: true,
|
|
25
31
|
createStartMenuShortcut: true,
|
|
26
32
|
|
|
@@ -34,7 +40,7 @@ export default {
|
|
|
34
40
|
{
|
|
35
41
|
name: '@electron-forge/maker-dmg',
|
|
36
42
|
config: {
|
|
37
|
-
background: '
|
|
43
|
+
background: 'public/splash.png',
|
|
38
44
|
format: 'ULFO',
|
|
39
45
|
}
|
|
40
46
|
},
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|