tenjin-cli 0.1.0-alpha.3 → 0.1.0-alpha.30

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.
Files changed (246) hide show
  1. package/NOTICE.md +54 -7
  2. package/README.md +149 -264
  3. package/dist/{_esm-FEASBWRP.js → _esm-CE7KNONL.js} +9 -10
  4. package/dist/alive-3J3CHOQP.js +21 -0
  5. package/dist/{ccip-NQXCEK2U.js → ccip-7RMRLAGV.js} +4 -4
  6. package/dist/{ccip-XR5NE5QK.js → ccip-NLCSCHKI.js} +5 -5
  7. package/dist/chunk-2SNUOHAT.js +75 -0
  8. package/dist/chunk-2SNUOHAT.js.map +1 -0
  9. package/dist/chunk-3O2BQIF6.js +2227 -0
  10. package/dist/chunk-3O2BQIF6.js.map +1 -0
  11. package/dist/{chunk-ZMHYXMO6.js → chunk-5IEP5EGE.js} +3 -3
  12. package/dist/chunk-5LJCEMFD.js +12700 -0
  13. package/dist/chunk-5LJCEMFD.js.map +1 -0
  14. package/dist/chunk-6W5GYG3W.js +128 -0
  15. package/dist/chunk-6W5GYG3W.js.map +1 -0
  16. package/dist/chunk-7EKYXMUO.js +7536 -0
  17. package/dist/chunk-7EKYXMUO.js.map +1 -0
  18. package/dist/chunk-7QKHZQKW.js +1680 -0
  19. package/dist/chunk-7QKHZQKW.js.map +1 -0
  20. package/dist/chunk-A36LQPHV.js +29 -0
  21. package/dist/chunk-A36LQPHV.js.map +1 -0
  22. package/dist/chunk-AEG2PXBP.js +192 -0
  23. package/dist/chunk-AEG2PXBP.js.map +1 -0
  24. package/dist/chunk-AKWGE6JQ.js +49 -0
  25. package/dist/chunk-AKWGE6JQ.js.map +1 -0
  26. package/dist/chunk-AWFUPKTM.js +238 -0
  27. package/dist/chunk-AWFUPKTM.js.map +1 -0
  28. package/dist/{chunk-UGX7YPX2.js → chunk-AWQPGIR6.js} +7 -9
  29. package/dist/{chunk-UGX7YPX2.js.map → chunk-AWQPGIR6.js.map} +1 -1
  30. package/dist/{chunk-5CLSD5YN.js → chunk-BPMWXTFX.js} +2 -2
  31. package/dist/chunk-EBVIKMCH.js +108 -0
  32. package/dist/chunk-EBVIKMCH.js.map +1 -0
  33. package/dist/{chunk-YALGASEU.js → chunk-EGELTSPU.js} +2 -2
  34. package/dist/{chunk-S3IGX57D.js → chunk-EL56RW2J.js} +166 -7237
  35. package/dist/chunk-EL56RW2J.js.map +1 -0
  36. package/dist/chunk-HE2MS4QO.js +256 -0
  37. package/dist/chunk-HE2MS4QO.js.map +1 -0
  38. package/dist/{chunk-CYOF7ROH.js → chunk-HPWO4O6S.js} +3 -3
  39. package/dist/chunk-IOODYAXL.js +324 -0
  40. package/dist/chunk-IOODYAXL.js.map +1 -0
  41. package/dist/chunk-JMM6YE7J.js +2174 -0
  42. package/dist/chunk-JMM6YE7J.js.map +1 -0
  43. package/dist/{chunk-QVX5MWJZ.js → chunk-JRGFKVAZ.js} +2 -2
  44. package/dist/{chunk-HIVZG55D.js → chunk-KG3D7FIF.js} +2 -2
  45. package/dist/chunk-KHE6L6TD.js +416 -0
  46. package/dist/chunk-KHE6L6TD.js.map +1 -0
  47. package/dist/chunk-KOGZDMHO.js +21 -0
  48. package/dist/chunk-KOGZDMHO.js.map +1 -0
  49. package/dist/chunk-KYFZTGMC.js +237 -0
  50. package/dist/chunk-KYFZTGMC.js.map +1 -0
  51. package/dist/chunk-LFZJM56J.js +159 -0
  52. package/dist/chunk-LFZJM56J.js.map +1 -0
  53. package/dist/chunk-LHHMV4GU.js +27 -0
  54. package/dist/chunk-LHHMV4GU.js.map +1 -0
  55. package/dist/{chunk-YBMMV4Y4.js → chunk-MEFB5KHA.js} +13 -5
  56. package/dist/chunk-MEFB5KHA.js.map +1 -0
  57. package/dist/{chunk-NCE5NSN6.js → chunk-N35E6CM2.js} +140 -10
  58. package/dist/chunk-N35E6CM2.js.map +1 -0
  59. package/dist/chunk-NZIP4PA2.js +114 -0
  60. package/dist/chunk-NZIP4PA2.js.map +1 -0
  61. package/dist/chunk-O2FRQ2L2.js +168 -0
  62. package/dist/chunk-O2FRQ2L2.js.map +1 -0
  63. package/dist/chunk-OK2TDZQU.js +404 -0
  64. package/dist/chunk-OK2TDZQU.js.map +1 -0
  65. package/dist/chunk-ORWL5BSN.js +269 -0
  66. package/dist/chunk-ORWL5BSN.js.map +1 -0
  67. package/dist/{chunk-Z6MFJV5Z.js → chunk-OSYTBCUC.js} +850 -499
  68. package/dist/chunk-OSYTBCUC.js.map +1 -0
  69. package/dist/chunk-P7LABKCW.js +90 -0
  70. package/dist/chunk-P7LABKCW.js.map +1 -0
  71. package/dist/chunk-PAYV4XUA.js +151 -0
  72. package/dist/chunk-PAYV4XUA.js.map +1 -0
  73. package/dist/{chunk-ZABPQJ3M.js → chunk-POUWHWID.js} +2 -2
  74. package/dist/chunk-QUVVWYJW.js +112 -0
  75. package/dist/chunk-QUVVWYJW.js.map +1 -0
  76. package/dist/chunk-RAULEAZ6.js +228 -0
  77. package/dist/chunk-RAULEAZ6.js.map +1 -0
  78. package/dist/chunk-S4SAZ7OD.js +30 -0
  79. package/dist/chunk-S4SAZ7OD.js.map +1 -0
  80. package/dist/chunk-SJLTEINJ.js +117 -0
  81. package/dist/chunk-SJLTEINJ.js.map +1 -0
  82. package/dist/chunk-SPAVAYSW.js +125 -0
  83. package/dist/chunk-SPAVAYSW.js.map +1 -0
  84. package/dist/chunk-TTBKWWTV.js +1605 -0
  85. package/dist/chunk-TTBKWWTV.js.map +1 -0
  86. package/dist/{chunk-RRN3YTK7.js → chunk-TTNESUPQ.js} +3 -3
  87. package/dist/chunk-U6YQ6FRI.js +378 -0
  88. package/dist/chunk-U6YQ6FRI.js.map +1 -0
  89. package/dist/chunk-VFMQTSXG.js +29 -0
  90. package/dist/chunk-VFMQTSXG.js.map +1 -0
  91. package/dist/chunk-VUFAK2LW.js +115 -0
  92. package/dist/chunk-VUFAK2LW.js.map +1 -0
  93. package/dist/chunk-VZGAONSJ.js +194 -0
  94. package/dist/chunk-VZGAONSJ.js.map +1 -0
  95. package/dist/{chunk-OYMYCW7J.js → chunk-WO5BJNIB.js} +682 -53
  96. package/dist/chunk-WO5BJNIB.js.map +1 -0
  97. package/dist/chunk-WVUSXNIE.js +39 -0
  98. package/dist/chunk-WVUSXNIE.js.map +1 -0
  99. package/dist/chunk-XKESD27X.js +10 -0
  100. package/dist/chunk-XKESD27X.js.map +1 -0
  101. package/dist/{chunk-HSDCI7OV.js → chunk-XZKD7DIF.js} +3 -3
  102. package/dist/{chunk-XJIW7USF.js → chunk-YFQOA5AU.js} +118 -9
  103. package/dist/chunk-YFQOA5AU.js.map +1 -0
  104. package/dist/chunk-YHKXNYTB.js +105 -0
  105. package/dist/chunk-YHKXNYTB.js.map +1 -0
  106. package/dist/{cli-SBXI5AMS.js → cli-O5SN7ZJ4.js} +382 -214
  107. package/dist/cli-O5SN7ZJ4.js.map +1 -0
  108. package/dist/config-OJQI27LT.js +45 -0
  109. package/dist/dist-3LOO6M4U.js +2842 -0
  110. package/dist/dist-3LOO6M4U.js.map +1 -0
  111. package/dist/doctor-IQQJHGGM.js +590 -0
  112. package/dist/doctor-IQQJHGGM.js.map +1 -0
  113. package/dist/env-proxy-XL4P73MZ.js +15 -0
  114. package/dist/{ethersCompat-Df4a6QIZ-3YZIAXDK.js → ethersCompat-Df4a6QIZ-THAVUGIJ.js} +5 -5
  115. package/dist/fund-WEV6DMTD.js +365 -0
  116. package/dist/fund-WEV6DMTD.js.map +1 -0
  117. package/dist/hook-command-D2P3ILRV.js +32 -0
  118. package/dist/hosts/claude/.claude-plugin/marketplace.json +19 -0
  119. package/dist/hosts/claude/tenjin/.claude-plugin/plugin.json +14 -0
  120. package/dist/hosts/claude/tenjin/.mcp.json +12 -0
  121. package/dist/hosts/claude/tenjin/hooks/hooks.json +221 -0
  122. package/dist/index.js +21 -2
  123. package/dist/index.js.map +1 -1
  124. package/dist/install-TUCRF32I.js +60 -0
  125. package/dist/install-identity-WHPNMNMQ.js +26 -0
  126. package/dist/install-wallet-MA27FTQ5.js +113 -0
  127. package/dist/install-wallet-MA27FTQ5.js.map +1 -0
  128. package/dist/mcp-QML7ZMPH.js +13427 -0
  129. package/dist/mcp-QML7ZMPH.js.map +1 -0
  130. package/dist/package-LGKYOEPV.js +37 -0
  131. package/dist/package-LGKYOEPV.js.map +1 -0
  132. package/dist/paths-POPTXJO6.js +61 -0
  133. package/dist/paths-POPTXJO6.js.map +1 -0
  134. package/dist/pay-2C2UBBXJ.js +51 -0
  135. package/dist/pay-2C2UBBXJ.js.map +1 -0
  136. package/dist/payments-C44QUFXU.js +106 -0
  137. package/dist/payments-C44QUFXU.js.map +1 -0
  138. package/dist/redact-6W23GGJC.js +15 -0
  139. package/dist/redact-6W23GGJC.js.map +1 -0
  140. package/dist/{secp256k1-N3ZHU7LB.js → secp256k1-ZZZT2CAX.js} +3 -3
  141. package/dist/secp256k1-ZZZT2CAX.js.map +1 -0
  142. package/dist/send-KVJX4XIR.js +222 -0
  143. package/dist/send-KVJX4XIR.js.map +1 -0
  144. package/dist/status-S7C3WMSH.js +115 -0
  145. package/dist/status-S7C3WMSH.js.map +1 -0
  146. package/dist/status-line-YR2T5HC4.js +86 -0
  147. package/dist/status-line-YR2T5HC4.js.map +1 -0
  148. package/dist/uninstall-HY6LKIIT.js +149 -0
  149. package/dist/uninstall-HY6LKIIT.js.map +1 -0
  150. package/dist/update-OJV22LR3.js +36 -0
  151. package/dist/update-OJV22LR3.js.map +1 -0
  152. package/dist/usdc-JK4RRFFQ.js +39 -0
  153. package/dist/usdc-JK4RRFFQ.js.map +1 -0
  154. package/dist/{viemAdapter-By13KInL-ZZE6UV4Y.js → viemAdapter-By13KInL-X2VY6CY3.js} +5 -5
  155. package/dist/viemAdapter-By13KInL-X2VY6CY3.js.map +1 -0
  156. package/dist/wallet-PD2IMZDU.js +39 -0
  157. package/dist/wallet-PD2IMZDU.js.map +1 -0
  158. package/dist/wallet-kdf-worker.mjs +980 -0
  159. package/docs/agent-permissions.md +180 -0
  160. package/docs/safety-model.md +59 -0
  161. package/docs/troubleshooting.md +13 -0
  162. package/package.json +28 -19
  163. package/LICENSE +0 -21
  164. package/dist/buy-EE6SEXP6.js +0 -1598
  165. package/dist/buy-EE6SEXP6.js.map +0 -1
  166. package/dist/candidate-ERMSYYQZ.js +0 -127
  167. package/dist/candidate-ERMSYYQZ.js.map +0 -1
  168. package/dist/chunk-3OV7E5G5.js +0 -18
  169. package/dist/chunk-3OV7E5G5.js.map +0 -1
  170. package/dist/chunk-4ONXEEQL.js +0 -152
  171. package/dist/chunk-4ONXEEQL.js.map +0 -1
  172. package/dist/chunk-662MSGZB.js +0 -286
  173. package/dist/chunk-662MSGZB.js.map +0 -1
  174. package/dist/chunk-7KUW4MJD.js +0 -59
  175. package/dist/chunk-7KUW4MJD.js.map +0 -1
  176. package/dist/chunk-AWPAWHNX.js +0 -333
  177. package/dist/chunk-AWPAWHNX.js.map +0 -1
  178. package/dist/chunk-DXTQ3CSI.js +0 -171
  179. package/dist/chunk-DXTQ3CSI.js.map +0 -1
  180. package/dist/chunk-ESPNTPQ2.js +0 -207
  181. package/dist/chunk-ESPNTPQ2.js.map +0 -1
  182. package/dist/chunk-FJPLRISB.js +0 -79
  183. package/dist/chunk-FJPLRISB.js.map +0 -1
  184. package/dist/chunk-GO75V3NZ.js +0 -160
  185. package/dist/chunk-GO75V3NZ.js.map +0 -1
  186. package/dist/chunk-JPHG2JW3.js +0 -96
  187. package/dist/chunk-JPHG2JW3.js.map +0 -1
  188. package/dist/chunk-MUBUQVC3.js +0 -67
  189. package/dist/chunk-MUBUQVC3.js.map +0 -1
  190. package/dist/chunk-NCE5NSN6.js.map +0 -1
  191. package/dist/chunk-OYMYCW7J.js.map +0 -1
  192. package/dist/chunk-RY4XKNV3.js +0 -140
  193. package/dist/chunk-RY4XKNV3.js.map +0 -1
  194. package/dist/chunk-S3IGX57D.js.map +0 -1
  195. package/dist/chunk-TLCMMYLY.js +0 -126
  196. package/dist/chunk-TLCMMYLY.js.map +0 -1
  197. package/dist/chunk-UO22YNY4.js +0 -69
  198. package/dist/chunk-UO22YNY4.js.map +0 -1
  199. package/dist/chunk-XHC6FCGZ.js +0 -261
  200. package/dist/chunk-XHC6FCGZ.js.map +0 -1
  201. package/dist/chunk-XJIW7USF.js.map +0 -1
  202. package/dist/chunk-YBMMV4Y4.js.map +0 -1
  203. package/dist/chunk-YN5SHIXQ.js +0 -126
  204. package/dist/chunk-YN5SHIXQ.js.map +0 -1
  205. package/dist/chunk-Z52RA3NC.js +0 -137
  206. package/dist/chunk-Z52RA3NC.js.map +0 -1
  207. package/dist/chunk-Z6MFJV5Z.js.map +0 -1
  208. package/dist/cli-SBXI5AMS.js.map +0 -1
  209. package/dist/config-VELDKLHY.js +0 -21
  210. package/dist/doctor-T3KWNNP2.js +0 -20
  211. package/dist/inspect-LMKOXE4Y.js +0 -96
  212. package/dist/inspect-LMKOXE4Y.js.map +0 -1
  213. package/dist/install-LEX3ENQ6.js +0 -387
  214. package/dist/install-LEX3ENQ6.js.map +0 -1
  215. package/dist/lookup-ZPN2Q67N.js +0 -129
  216. package/dist/lookup-ZPN2Q67N.js.map +0 -1
  217. package/dist/outcome-N7TAK6WR.js +0 -66
  218. package/dist/outcome-N7TAK6WR.js.map +0 -1
  219. package/dist/publish-BKBQQAW4.js +0 -1478
  220. package/dist/publish-BKBQQAW4.js.map +0 -1
  221. package/dist/usdc-JIAJW4SV.js +0 -22
  222. package/dist/wallet-CWEMYVIH.js +0 -179
  223. package/dist/wallet-CWEMYVIH.js.map +0 -1
  224. package/dist/wallet-PA54CRBL.js +0 -30
  225. package/skills/tenjin/SKILL.md +0 -199
  226. package/skills/tenjin-publish/SKILL.md +0 -111
  227. package/skills/tenjin-search/SKILL.md +0 -133
  228. /package/dist/{_esm-FEASBWRP.js.map → _esm-CE7KNONL.js.map} +0 -0
  229. /package/dist/{ccip-NQXCEK2U.js.map → alive-3J3CHOQP.js.map} +0 -0
  230. /package/dist/{ccip-XR5NE5QK.js.map → ccip-7RMRLAGV.js.map} +0 -0
  231. /package/dist/{config-VELDKLHY.js.map → ccip-NLCSCHKI.js.map} +0 -0
  232. /package/dist/{chunk-ZMHYXMO6.js.map → chunk-5IEP5EGE.js.map} +0 -0
  233. /package/dist/{chunk-5CLSD5YN.js.map → chunk-BPMWXTFX.js.map} +0 -0
  234. /package/dist/{chunk-YALGASEU.js.map → chunk-EGELTSPU.js.map} +0 -0
  235. /package/dist/{chunk-CYOF7ROH.js.map → chunk-HPWO4O6S.js.map} +0 -0
  236. /package/dist/{chunk-QVX5MWJZ.js.map → chunk-JRGFKVAZ.js.map} +0 -0
  237. /package/dist/{chunk-HIVZG55D.js.map → chunk-KG3D7FIF.js.map} +0 -0
  238. /package/dist/{chunk-ZABPQJ3M.js.map → chunk-POUWHWID.js.map} +0 -0
  239. /package/dist/{chunk-RRN3YTK7.js.map → chunk-TTNESUPQ.js.map} +0 -0
  240. /package/dist/{chunk-HSDCI7OV.js.map → chunk-XZKD7DIF.js.map} +0 -0
  241. /package/dist/{doctor-T3KWNNP2.js.map → config-OJQI27LT.js.map} +0 -0
  242. /package/dist/{ethersCompat-Df4a6QIZ-3YZIAXDK.js.map → env-proxy-XL4P73MZ.js.map} +0 -0
  243. /package/dist/{secp256k1-N3ZHU7LB.js.map → ethersCompat-Df4a6QIZ-THAVUGIJ.js.map} +0 -0
  244. /package/dist/{usdc-JIAJW4SV.js.map → hook-command-D2P3ILRV.js.map} +0 -0
  245. /package/dist/{viemAdapter-By13KInL-ZZE6UV4Y.js.map → install-TUCRF32I.js.map} +0 -0
  246. /package/dist/{wallet-PA54CRBL.js.map → install-identity-WHPNMNMQ.js.map} +0 -0
@@ -0,0 +1,2842 @@
1
+ import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
+ import {
3
+ __commonJS,
4
+ __toESM
5
+ } from "./chunk-ZXTAQYNA.js";
6
+
7
+ // node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
8
+ var require_src = __commonJS({
9
+ "node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js"(exports, module) {
10
+ "use strict";
11
+ var ESC2 = "\x1B";
12
+ var CSI2 = `${ESC2}[`;
13
+ var beep = "\x07";
14
+ var cursor3 = {
15
+ to(x2, y) {
16
+ if (!y) return `${CSI2}${x2 + 1}G`;
17
+ return `${CSI2}${y + 1};${x2 + 1}H`;
18
+ },
19
+ move(x2, y) {
20
+ let ret = "";
21
+ if (x2 < 0) ret += `${CSI2}${-x2}D`;
22
+ else if (x2 > 0) ret += `${CSI2}${x2}C`;
23
+ if (y < 0) ret += `${CSI2}${-y}A`;
24
+ else if (y > 0) ret += `${CSI2}${y}B`;
25
+ return ret;
26
+ },
27
+ up: (count = 1) => `${CSI2}${count}A`,
28
+ down: (count = 1) => `${CSI2}${count}B`,
29
+ forward: (count = 1) => `${CSI2}${count}C`,
30
+ backward: (count = 1) => `${CSI2}${count}D`,
31
+ nextLine: (count = 1) => `${CSI2}E`.repeat(count),
32
+ prevLine: (count = 1) => `${CSI2}F`.repeat(count),
33
+ left: `${CSI2}G`,
34
+ hide: `${CSI2}?25l`,
35
+ show: `${CSI2}?25h`,
36
+ save: `${ESC2}7`,
37
+ restore: `${ESC2}8`
38
+ };
39
+ var scroll = {
40
+ up: (count = 1) => `${CSI2}S`.repeat(count),
41
+ down: (count = 1) => `${CSI2}T`.repeat(count)
42
+ };
43
+ var erase3 = {
44
+ screen: `${CSI2}2J`,
45
+ up: (count = 1) => `${CSI2}1J`.repeat(count),
46
+ down: (count = 1) => `${CSI2}J`.repeat(count),
47
+ line: `${CSI2}2K`,
48
+ lineEnd: `${CSI2}K`,
49
+ lineStart: `${CSI2}1K`,
50
+ lines(count) {
51
+ let clear = "";
52
+ for (let i2 = 0; i2 < count; i2++)
53
+ clear += this.line + (i2 < count - 1 ? cursor3.up() : "");
54
+ if (count)
55
+ clear += cursor3.left;
56
+ return clear;
57
+ }
58
+ };
59
+ module.exports = { cursor: cursor3, scroll, erase: erase3, beep };
60
+ }
61
+ });
62
+
63
+ // node_modules/.pnpm/@clack+core@1.4.3/node_modules/@clack/core/dist/index.mjs
64
+ import { styleText } from "node:util";
65
+ import { stdout, stdin } from "node:process";
66
+ import * as l from "node:readline";
67
+ import l__default from "node:readline";
68
+
69
+ // node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
70
+ var getCodePointsLength = /* @__PURE__ */ (() => {
71
+ const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
72
+ return (input) => {
73
+ let surrogatePairsNr = 0;
74
+ SURROGATE_PAIR_RE.lastIndex = 0;
75
+ while (SURROGATE_PAIR_RE.test(input)) {
76
+ surrogatePairsNr += 1;
77
+ }
78
+ return input.length - surrogatePairsNr;
79
+ };
80
+ })();
81
+ var isFullWidth = (x2) => {
82
+ return x2 === 12288 || x2 >= 65281 && x2 <= 65376 || x2 >= 65504 && x2 <= 65510;
83
+ };
84
+ var isWideNotCJKTNotEmoji = (x2) => {
85
+ return x2 === 8987 || x2 === 9001 || x2 >= 12272 && x2 <= 12287 || x2 >= 12289 && x2 <= 12350 || x2 >= 12441 && x2 <= 12543 || x2 >= 12549 && x2 <= 12591 || x2 >= 12593 && x2 <= 12686 || x2 >= 12688 && x2 <= 12771 || x2 >= 12783 && x2 <= 12830 || x2 >= 12832 && x2 <= 12871 || x2 >= 12880 && x2 <= 19903 || x2 >= 65040 && x2 <= 65049 || x2 >= 65072 && x2 <= 65106 || x2 >= 65108 && x2 <= 65126 || x2 >= 65128 && x2 <= 65131 || x2 >= 127488 && x2 <= 127490 || x2 >= 127504 && x2 <= 127547 || x2 >= 127552 && x2 <= 127560 || x2 >= 131072 && x2 <= 196605 || x2 >= 196608 && x2 <= 262141;
86
+ };
87
+
88
+ // node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js
89
+ var ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
90
+ var CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
91
+ var CJKT_WIDE_RE = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu;
92
+ var TAB_RE = /\t{1,1000}/y;
93
+ var EMOJI_RE = new RegExp("[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*", "yu");
94
+ var LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
95
+ var MODIFIER_RE = new RegExp("\\p{M}+", "gu");
96
+ var NO_TRUNCATION = { limit: Infinity, ellipsis: "" };
97
+ var getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
98
+ const LIMIT = truncationOptions.limit ?? Infinity;
99
+ const ELLIPSIS = truncationOptions.ellipsis ?? "";
100
+ const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);
101
+ const ANSI_WIDTH = 0;
102
+ const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
103
+ const TAB_WIDTH = widthOptions.tabWidth ?? 8;
104
+ const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
105
+ const FULL_WIDTH_WIDTH = 2;
106
+ const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
107
+ const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
108
+ const PARSE_BLOCKS = [
109
+ [LATIN_RE, REGULAR_WIDTH],
110
+ [ANSI_RE, ANSI_WIDTH],
111
+ [CONTROL_RE, CONTROL_WIDTH],
112
+ [TAB_RE, TAB_WIDTH],
113
+ [EMOJI_RE, EMOJI_WIDTH],
114
+ [CJKT_WIDE_RE, WIDE_WIDTH]
115
+ ];
116
+ let indexPrev = 0;
117
+ let index = 0;
118
+ let length = input.length;
119
+ let lengthExtra = 0;
120
+ let truncationEnabled = false;
121
+ let truncationIndex = length;
122
+ let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
123
+ let unmatchedStart = 0;
124
+ let unmatchedEnd = 0;
125
+ let width = 0;
126
+ let widthExtra = 0;
127
+ outer: while (true) {
128
+ if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
129
+ const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
130
+ lengthExtra = 0;
131
+ for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
132
+ const codePoint = char.codePointAt(0) || 0;
133
+ if (isFullWidth(codePoint)) {
134
+ widthExtra = FULL_WIDTH_WIDTH;
135
+ } else if (isWideNotCJKTNotEmoji(codePoint)) {
136
+ widthExtra = WIDE_WIDTH;
137
+ } else {
138
+ widthExtra = REGULAR_WIDTH;
139
+ }
140
+ if (width + widthExtra > truncationLimit) {
141
+ truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
142
+ }
143
+ if (width + widthExtra > LIMIT) {
144
+ truncationEnabled = true;
145
+ break outer;
146
+ }
147
+ lengthExtra += char.length;
148
+ width += widthExtra;
149
+ }
150
+ unmatchedStart = unmatchedEnd = 0;
151
+ }
152
+ if (index >= length) {
153
+ break outer;
154
+ }
155
+ for (let i2 = 0, l2 = PARSE_BLOCKS.length; i2 < l2; i2++) {
156
+ const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i2];
157
+ BLOCK_RE.lastIndex = index;
158
+ if (BLOCK_RE.test(input)) {
159
+ lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
160
+ widthExtra = lengthExtra * BLOCK_WIDTH;
161
+ if (width + widthExtra > truncationLimit) {
162
+ truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
163
+ }
164
+ if (width + widthExtra > LIMIT) {
165
+ truncationEnabled = true;
166
+ break outer;
167
+ }
168
+ width += widthExtra;
169
+ unmatchedStart = indexPrev;
170
+ unmatchedEnd = index;
171
+ index = indexPrev = BLOCK_RE.lastIndex;
172
+ continue outer;
173
+ }
174
+ }
175
+ index += 1;
176
+ }
177
+ return {
178
+ width: truncationEnabled ? truncationLimit : width,
179
+ index: truncationEnabled ? truncationIndex : length,
180
+ truncated: truncationEnabled,
181
+ ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
182
+ };
183
+ };
184
+ var dist_default = getStringTruncatedWidth;
185
+
186
+ // node_modules/.pnpm/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js
187
+ var NO_TRUNCATION2 = {
188
+ limit: Infinity,
189
+ ellipsis: "",
190
+ ellipsisWidth: 0
191
+ };
192
+ var fastStringWidth = (input, options = {}) => {
193
+ return dist_default(input, NO_TRUNCATION2, options).width;
194
+ };
195
+ var dist_default2 = fastStringWidth;
196
+
197
+ // node_modules/.pnpm/fast-wrap-ansi@0.2.2/node_modules/fast-wrap-ansi/lib/main.js
198
+ var ESC = "\x1B";
199
+ var CSI = "\x9B";
200
+ var END_CODE = 39;
201
+ var ANSI_ESCAPE_BELL = "\x07";
202
+ var ANSI_CSI = "[";
203
+ var ANSI_OSC = "]";
204
+ var ANSI_SGR_TERMINATOR = "m";
205
+ var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
206
+ var GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
207
+ var getClosingCode = (openingCode) => {
208
+ if (openingCode >= 30 && openingCode <= 37)
209
+ return 39;
210
+ if (openingCode >= 90 && openingCode <= 97)
211
+ return 39;
212
+ if (openingCode >= 40 && openingCode <= 47)
213
+ return 49;
214
+ if (openingCode >= 100 && openingCode <= 107)
215
+ return 49;
216
+ if (openingCode === 1 || openingCode === 2)
217
+ return 22;
218
+ if (openingCode === 3)
219
+ return 23;
220
+ if (openingCode === 4)
221
+ return 24;
222
+ if (openingCode === 7)
223
+ return 27;
224
+ if (openingCode === 8)
225
+ return 28;
226
+ if (openingCode === 9)
227
+ return 29;
228
+ if (openingCode === 0)
229
+ return 0;
230
+ return void 0;
231
+ };
232
+ var wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
233
+ var wrapAnsiHyperlink = (url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
234
+ var wrapWord = (rows, word, columns) => {
235
+ const characters = word[Symbol.iterator]();
236
+ let isInsideEscape = false;
237
+ let isInsideLinkEscape = false;
238
+ let lastRow = rows.at(-1);
239
+ let visible = lastRow === void 0 ? 0 : dist_default2(lastRow);
240
+ let currentCharacter = characters.next();
241
+ let nextCharacter = characters.next();
242
+ let rawCharacterIndex = 0;
243
+ while (!currentCharacter.done) {
244
+ const character = currentCharacter.value;
245
+ const characterLength = dist_default2(character);
246
+ if (visible + characterLength <= columns) {
247
+ rows[rows.length - 1] += character;
248
+ } else {
249
+ rows.push(character);
250
+ visible = 0;
251
+ }
252
+ if (character === ESC || character === CSI) {
253
+ isInsideEscape = true;
254
+ isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
255
+ }
256
+ if (isInsideEscape) {
257
+ if (isInsideLinkEscape) {
258
+ if (character === ANSI_ESCAPE_BELL) {
259
+ isInsideEscape = false;
260
+ isInsideLinkEscape = false;
261
+ }
262
+ } else if (character === ANSI_SGR_TERMINATOR) {
263
+ isInsideEscape = false;
264
+ }
265
+ } else {
266
+ visible += characterLength;
267
+ if (visible === columns && !nextCharacter.done) {
268
+ rows.push("");
269
+ visible = 0;
270
+ }
271
+ }
272
+ currentCharacter = nextCharacter;
273
+ nextCharacter = characters.next();
274
+ rawCharacterIndex += character.length;
275
+ }
276
+ lastRow = rows.at(-1);
277
+ if (!visible && lastRow !== void 0 && lastRow.length && rows.length > 1) {
278
+ rows[rows.length - 2] += rows.pop();
279
+ }
280
+ };
281
+ var stringVisibleTrimSpacesRight = (string) => {
282
+ const words = string.split(" ");
283
+ let last = words.length;
284
+ while (last) {
285
+ if (dist_default2(words[last - 1])) {
286
+ break;
287
+ }
288
+ last--;
289
+ }
290
+ if (last === words.length) {
291
+ return string;
292
+ }
293
+ return words.slice(0, last).join(" ") + words.slice(last).join("");
294
+ };
295
+ var exec = (string, columns, options = {}) => {
296
+ if (options.trim !== false && string.trim() === "") {
297
+ return "";
298
+ }
299
+ let returnValue = "";
300
+ let escapeCode;
301
+ let escapeUrl;
302
+ const words = string.split(" ");
303
+ let rows = [""];
304
+ let rowLength = 0;
305
+ for (let index = 0; index < words.length; index++) {
306
+ const word = words[index];
307
+ if (options.trim !== false) {
308
+ const row = rows.at(-1) ?? "";
309
+ const trimmed = row.trimStart();
310
+ if (row.length !== trimmed.length) {
311
+ rows[rows.length - 1] = trimmed;
312
+ rowLength = dist_default2(trimmed);
313
+ }
314
+ }
315
+ if (index !== 0) {
316
+ if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
317
+ rows.push("");
318
+ rowLength = 0;
319
+ }
320
+ if (rowLength || options.trim === false) {
321
+ rows[rows.length - 1] += " ";
322
+ rowLength++;
323
+ }
324
+ }
325
+ const wordLength = dist_default2(word);
326
+ if (options.hard && wordLength > columns) {
327
+ const remainingColumns = columns - rowLength;
328
+ const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
329
+ const breaksStartingNextLine = Math.floor((wordLength - 1) / columns);
330
+ if (breaksStartingNextLine < breaksStartingThisLine) {
331
+ rows.push("");
332
+ }
333
+ wrapWord(rows, word, columns);
334
+ rowLength = dist_default2(rows.at(-1) ?? "");
335
+ continue;
336
+ }
337
+ if (rowLength + wordLength > columns && rowLength && wordLength) {
338
+ if (options.wordWrap === false && rowLength < columns) {
339
+ wrapWord(rows, word, columns);
340
+ rowLength = dist_default2(rows.at(-1) ?? "");
341
+ continue;
342
+ }
343
+ rows.push("");
344
+ rowLength = 0;
345
+ }
346
+ if (rowLength + wordLength > columns && options.wordWrap === false) {
347
+ wrapWord(rows, word, columns);
348
+ rowLength = dist_default2(rows.at(-1) ?? "");
349
+ continue;
350
+ }
351
+ rows[rows.length - 1] += word;
352
+ rowLength += wordLength;
353
+ }
354
+ if (options.trim !== false) {
355
+ rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
356
+ }
357
+ const preString = rows.join("\n");
358
+ let inSurrogate = false;
359
+ for (let i2 = 0; i2 < preString.length; i2++) {
360
+ const character = preString[i2];
361
+ returnValue += character;
362
+ if (!inSurrogate) {
363
+ inSurrogate = character >= "\uD800" && character <= "\uDBFF";
364
+ if (inSurrogate) {
365
+ continue;
366
+ }
367
+ } else {
368
+ inSurrogate = false;
369
+ }
370
+ if (character === ESC || character === CSI) {
371
+ GROUP_REGEX.lastIndex = i2 + 1;
372
+ const groupsResult = GROUP_REGEX.exec(preString);
373
+ const groups = groupsResult?.groups;
374
+ if (groups?.code !== void 0) {
375
+ const code = Number.parseFloat(groups.code);
376
+ escapeCode = code === END_CODE ? void 0 : code;
377
+ } else if (groups?.uri !== void 0) {
378
+ escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
379
+ }
380
+ }
381
+ if (preString[i2 + 1] === "\n") {
382
+ if (escapeUrl) {
383
+ returnValue += wrapAnsiHyperlink("");
384
+ }
385
+ const closingCode = escapeCode ? getClosingCode(escapeCode) : void 0;
386
+ if (escapeCode && closingCode) {
387
+ returnValue += wrapAnsiCode(closingCode);
388
+ }
389
+ } else if (character === "\n") {
390
+ if (escapeCode && getClosingCode(escapeCode)) {
391
+ returnValue += wrapAnsiCode(escapeCode);
392
+ }
393
+ if (escapeUrl) {
394
+ returnValue += wrapAnsiHyperlink(escapeUrl);
395
+ }
396
+ }
397
+ }
398
+ return returnValue;
399
+ };
400
+ var CRLF_OR_LF = /\r?\n/;
401
+ function wrapAnsi(string, columns, options) {
402
+ return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
403
+ }
404
+
405
+ // node_modules/.pnpm/@clack+core@1.4.3/node_modules/@clack/core/dist/index.mjs
406
+ var import_sisteransi = __toESM(require_src(), 1);
407
+ import { ReadStream } from "node:tty";
408
+ function findCursor(s, o2, l2) {
409
+ if (!l2.some((r2) => !r2.disabled))
410
+ return s;
411
+ const t2 = s + o2, n3 = Math.max(l2.length - 1, 0), e = t2 < 0 ? n3 : t2 > n3 ? 0 : t2;
412
+ return l2[e]?.disabled ? findCursor(e, o2 < 0 ? -1 : 1, l2) : e;
413
+ }
414
+ function findTextCursor(s, o2, l2, i2) {
415
+ const t2 = i2.split(`
416
+ `);
417
+ let n3 = 0, e = s;
418
+ for (const r2 of t2) {
419
+ if (e <= r2.length)
420
+ break;
421
+ e -= r2.length + 1, n3++;
422
+ }
423
+ for (n3 = Math.max(0, Math.min(t2.length - 1, n3 + l2)), e = Math.min(e, t2[n3].length) + o2; e < 0 && n3 > 0; )
424
+ n3--, e += t2[n3].length + 1;
425
+ for (; e > t2[n3].length && n3 < t2.length - 1; )
426
+ e -= t2[n3].length + 1, n3++;
427
+ e = Math.max(0, Math.min(t2[n3].length, e));
428
+ let h2 = 0;
429
+ for (let r2 = 0; r2 < n3; r2++)
430
+ h2 += t2[r2].length + 1;
431
+ return h2 + e;
432
+ }
433
+ var a$1 = ["up", "down", "left", "right", "space", "enter", "cancel"];
434
+ var t = [
435
+ "January",
436
+ "February",
437
+ "March",
438
+ "April",
439
+ "May",
440
+ "June",
441
+ "July",
442
+ "August",
443
+ "September",
444
+ "October",
445
+ "November",
446
+ "December"
447
+ ];
448
+ var settings = {
449
+ actions: new Set(a$1),
450
+ aliases: /* @__PURE__ */ new Map([
451
+ // vim support
452
+ ["k", "up"],
453
+ ["j", "down"],
454
+ ["h", "left"],
455
+ ["l", "right"],
456
+ ["", "cancel"],
457
+ // opinionated defaults!
458
+ ["escape", "cancel"]
459
+ ]),
460
+ messages: {
461
+ cancel: "Canceled",
462
+ error: "Something went wrong"
463
+ },
464
+ withGuide: true,
465
+ date: {
466
+ monthNames: [...t],
467
+ messages: {
468
+ required: "Please enter a valid date",
469
+ invalidMonth: "There are only 12 months in a year",
470
+ invalidDay: (n3, e) => `There are only ${n3} days in ${e}`,
471
+ afterMin: (n3) => `Date must be on or after ${n3.toISOString().slice(0, 10)}`,
472
+ beforeMax: (n3) => `Date must be on or before ${n3.toISOString().slice(0, 10)}`
473
+ }
474
+ }
475
+ };
476
+ function updateSettings(n3) {
477
+ if (n3.aliases !== void 0) {
478
+ const e = n3.aliases;
479
+ for (const s in e) {
480
+ if (!Object.hasOwn(e, s)) continue;
481
+ const i2 = e[s];
482
+ i2 === void 0 || !settings.actions.has(i2) || settings.aliases.has(s) || settings.aliases.set(s, i2);
483
+ }
484
+ }
485
+ if (n3.messages !== void 0) {
486
+ const e = n3.messages;
487
+ e.cancel !== void 0 && (settings.messages.cancel = e.cancel), e.error !== void 0 && (settings.messages.error = e.error);
488
+ }
489
+ if (n3.withGuide !== void 0 && (settings.withGuide = n3.withGuide !== false), n3.date !== void 0) {
490
+ const e = n3.date;
491
+ e.monthNames !== void 0 && (settings.date.monthNames = [...e.monthNames]), e.messages !== void 0 && (e.messages.required !== void 0 && (settings.date.messages.required = e.messages.required), e.messages.invalidMonth !== void 0 && (settings.date.messages.invalidMonth = e.messages.invalidMonth), e.messages.invalidDay !== void 0 && (settings.date.messages.invalidDay = e.messages.invalidDay), e.messages.afterMin !== void 0 && (settings.date.messages.afterMin = e.messages.afterMin), e.messages.beforeMax !== void 0 && (settings.date.messages.beforeMax = e.messages.beforeMax));
492
+ }
493
+ }
494
+ function isActionKey(n3, e) {
495
+ if (typeof n3 == "string")
496
+ return settings.aliases.get(n3) === e;
497
+ for (const s of n3)
498
+ if (s !== void 0 && isActionKey(s, e))
499
+ return true;
500
+ return false;
501
+ }
502
+ function diffLines(i2, s) {
503
+ if (i2 === s) return;
504
+ const e = i2.split(`
505
+ `), t2 = s.split(`
506
+ `), r2 = Math.max(e.length, t2.length), f2 = [];
507
+ for (let n3 = 0; n3 < r2; n3++)
508
+ e[n3] !== t2[n3] && f2.push(n3);
509
+ return {
510
+ lines: f2,
511
+ numLinesBefore: e.length,
512
+ numLinesAfter: t2.length,
513
+ numLines: r2
514
+ };
515
+ }
516
+ var R = globalThis.process.platform.startsWith("win");
517
+ var CANCEL_SYMBOL = /* @__PURE__ */ Symbol("clack:cancel");
518
+ function isCancel(e) {
519
+ return e === CANCEL_SYMBOL;
520
+ }
521
+ function setRawMode(e, r2) {
522
+ const o2 = e;
523
+ o2.isTTY && o2.setRawMode(r2);
524
+ }
525
+ function block({
526
+ input: e = stdin,
527
+ output: r2 = stdout,
528
+ overwrite: o2 = true,
529
+ hideCursor: t2 = true
530
+ } = {}) {
531
+ const s = l.createInterface({
532
+ input: e,
533
+ output: r2,
534
+ prompt: "",
535
+ tabSize: 1
536
+ });
537
+ l.emitKeypressEvents(e, s), e instanceof ReadStream && e.isTTY && e.setRawMode(true);
538
+ const n3 = (f2, { name: a2, sequence: p3 }) => {
539
+ const c3 = String(f2);
540
+ if (isActionKey([c3, a2, p3], "cancel")) {
541
+ t2 && r2.write(import_sisteransi.cursor.show), process.exit(0);
542
+ return;
543
+ }
544
+ if (!o2) return;
545
+ const i2 = a2 === "return" ? 0 : -1, m3 = a2 === "return" ? -1 : 0;
546
+ l.moveCursor(r2, i2, m3, () => {
547
+ l.clearLine(r2, 1, () => {
548
+ e.once("keypress", n3);
549
+ });
550
+ });
551
+ };
552
+ return t2 && r2.write(import_sisteransi.cursor.hide), e.once("keypress", n3), () => {
553
+ e.off("keypress", n3), t2 && r2.write(import_sisteransi.cursor.show), e instanceof ReadStream && e.isTTY && !R && e.setRawMode(false), s.terminal = false, s.close();
554
+ };
555
+ }
556
+ var getColumns = (e) => "columns" in e && typeof e.columns == "number" ? e.columns : 80;
557
+ var getRows = (e) => "rows" in e && typeof e.rows == "number" ? e.rows : 20;
558
+ function wrapTextWithPrefix(e, r2, o2, t2 = o2, s = o2, n3) {
559
+ const f2 = getColumns(e ?? stdout);
560
+ return wrapAnsi(r2, f2 - o2.length, {
561
+ hard: true,
562
+ trim: false
563
+ }).split(`
564
+ `).map((c3, i2, m3) => {
565
+ const d = n3 ? n3(c3, i2) : c3;
566
+ return i2 === 0 ? `${t2}${d}` : i2 === m3.length - 1 ? `${s}${d}` : `${o2}${d}`;
567
+ }).join(`
568
+ `);
569
+ }
570
+ function runValidation(e, n3) {
571
+ if ("~standard" in e) {
572
+ const a2 = e["~standard"].validate(n3);
573
+ if (a2 instanceof Promise)
574
+ throw new TypeError(
575
+ "Schema validation must be synchronous. Update `validate()` and remove any asynchronous logic."
576
+ );
577
+ return a2.issues?.at(0)?.message;
578
+ }
579
+ return e(n3);
580
+ }
581
+ var V = class {
582
+ input;
583
+ output;
584
+ _abortSignal;
585
+ rl;
586
+ opts;
587
+ _render;
588
+ _track = false;
589
+ _prevFrame = "";
590
+ _subscribers = /* @__PURE__ */ new Map();
591
+ _cursor = 0;
592
+ state = "initial";
593
+ error = "";
594
+ value;
595
+ userInput = "";
596
+ constructor(t2, e = true) {
597
+ const { input: i2 = stdin, output: n3 = stdout, render: s, signal: r2, ...o2 } = t2;
598
+ this.opts = o2, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = s.bind(this), this._track = e, this._abortSignal = r2, this.input = i2, this.output = n3;
599
+ }
600
+ /**
601
+ * Unsubscribe all listeners
602
+ */
603
+ unsubscribe() {
604
+ this._subscribers.clear();
605
+ }
606
+ /**
607
+ * Set a subscriber with opts
608
+ * @param event - The event name
609
+ */
610
+ setSubscriber(t2, e) {
611
+ const i2 = this._subscribers.get(t2) ?? [];
612
+ i2.push(e), this._subscribers.set(t2, i2);
613
+ }
614
+ /**
615
+ * Subscribe to an event
616
+ * @param event - The event name
617
+ * @param cb - The callback
618
+ */
619
+ on(t2, e) {
620
+ this.setSubscriber(t2, { cb: e });
621
+ }
622
+ /**
623
+ * Subscribe to an event once
624
+ * @param event - The event name
625
+ * @param cb - The callback
626
+ */
627
+ once(t2, e) {
628
+ this.setSubscriber(t2, { cb: e, once: true });
629
+ }
630
+ /**
631
+ * Emit an event with data
632
+ * @param event - The event name
633
+ * @param data - The data to pass to the callback
634
+ */
635
+ emit(t2, ...e) {
636
+ const i2 = this._subscribers.get(t2) ?? [], n3 = [];
637
+ for (const s of i2)
638
+ s.cb(...e), s.once && n3.push(() => i2.splice(i2.indexOf(s), 1));
639
+ for (const s of n3)
640
+ s();
641
+ }
642
+ prompt() {
643
+ return new Promise((t2) => {
644
+ if (this._abortSignal) {
645
+ if (this._abortSignal.aborted)
646
+ return this.state = "cancel", this.close(), t2(CANCEL_SYMBOL);
647
+ this._abortSignal.addEventListener(
648
+ "abort",
649
+ () => {
650
+ this.state = "cancel", this.close();
651
+ },
652
+ { once: true }
653
+ );
654
+ }
655
+ this.rl = l__default.createInterface({
656
+ input: this.input,
657
+ tabSize: 2,
658
+ prompt: "",
659
+ escapeCodeTimeout: 50,
660
+ terminal: true
661
+ }), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), setRawMode(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
662
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(this.value);
663
+ }), this.once("cancel", () => {
664
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(CANCEL_SYMBOL);
665
+ });
666
+ });
667
+ }
668
+ _isActionKey(t2, e) {
669
+ return t2 === " ";
670
+ }
671
+ _shouldSubmit(t2, e) {
672
+ return true;
673
+ }
674
+ _setValue(t2) {
675
+ this.value = t2, this.emit("value", this.value);
676
+ }
677
+ _setUserInput(t2, e) {
678
+ this.userInput = t2 ?? "", this.emit("userInput", this.userInput), e && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
679
+ }
680
+ _clearUserInput() {
681
+ this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
682
+ }
683
+ onKeypress(t2, e) {
684
+ if (this._track && e.name !== "return" && (e.name && this._isActionKey(t2, e) && this.rl?.write(null, { ctrl: true, name: "h" }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), e?.name && (!this._track && settings.aliases.has(e.name) && this.emit("cursor", settings.aliases.get(e.name)), settings.actions.has(e.name) && this.emit("cursor", e.name)), t2 && (t2.toLowerCase() === "y" || t2.toLowerCase() === "n") && this.emit("confirm", t2.toLowerCase() === "y"), this.emit("key", t2, e), e?.name === "return" && this._shouldSubmit(t2, e)) {
685
+ if (this.opts.validate) {
686
+ const i2 = runValidation(this.opts.validate, this.value);
687
+ i2 && (this.error = i2 instanceof Error ? i2.message : i2, this.state = "error", this.rl?.write(this.userInput));
688
+ }
689
+ this.state !== "error" && (this.state = "submit");
690
+ }
691
+ isActionKey([t2, e?.name, e?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
692
+ }
693
+ close() {
694
+ this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
695
+ `), setRawMode(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
696
+ }
697
+ restoreCursor() {
698
+ const t2 = wrapAnsi(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
699
+ `).length - 1;
700
+ this.output.write(import_sisteransi.cursor.move(-999, t2 * -1));
701
+ }
702
+ render() {
703
+ const t2 = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
704
+ hard: true,
705
+ trim: false
706
+ });
707
+ if (t2 !== this._prevFrame) {
708
+ if (this.state === "initial")
709
+ this.output.write(import_sisteransi.cursor.hide);
710
+ else {
711
+ const e = diffLines(this._prevFrame, t2), i2 = getRows(this.output);
712
+ if (this.restoreCursor(), e) {
713
+ const n3 = Math.max(0, e.numLinesAfter - i2), s = Math.max(0, e.numLinesBefore - i2);
714
+ let r2 = e.lines.find((o2) => o2 >= n3);
715
+ if (r2 === void 0) {
716
+ this._prevFrame = t2;
717
+ return;
718
+ }
719
+ if (e.lines.length === 1) {
720
+ this.output.write(import_sisteransi.cursor.move(0, r2 - s)), this.output.write(import_sisteransi.erase.lines(1));
721
+ const o2 = t2.split(`
722
+ `);
723
+ this.output.write(o2[r2]), this._prevFrame = t2, this.output.write(import_sisteransi.cursor.move(0, o2.length - r2 - 1));
724
+ return;
725
+ } else if (e.lines.length > 1) {
726
+ if (n3 < s)
727
+ r2 = n3;
728
+ else {
729
+ const h2 = r2 - s;
730
+ h2 > 0 && this.output.write(import_sisteransi.cursor.move(0, h2));
731
+ }
732
+ this.output.write(import_sisteransi.erase.down());
733
+ const f2 = t2.split(`
734
+ `).slice(r2);
735
+ this.output.write(f2.join(`
736
+ `)), this._prevFrame = t2;
737
+ return;
738
+ }
739
+ }
740
+ this.output.write(import_sisteransi.erase.down());
741
+ }
742
+ this.output.write(t2), this.state === "initial" && (this.state = "active"), this._prevFrame = t2;
743
+ }
744
+ }
745
+ };
746
+ function p$1(l2, e) {
747
+ if (l2 === void 0 || e.length === 0)
748
+ return 0;
749
+ const i2 = e.findIndex((s) => s.value === l2);
750
+ return i2 !== -1 ? i2 : 0;
751
+ }
752
+ function g(l2, e) {
753
+ return (e.label ?? String(e.value)).toLowerCase().includes(l2.toLowerCase());
754
+ }
755
+ function m(l2, e) {
756
+ if (e)
757
+ return l2 ? e : e[0];
758
+ }
759
+ var T$1 = class T extends V {
760
+ filteredOptions;
761
+ multiple;
762
+ isNavigating = false;
763
+ selectedValues = [];
764
+ focusedValue;
765
+ #e = 0;
766
+ #s = "";
767
+ #t;
768
+ #i;
769
+ #n;
770
+ get cursor() {
771
+ return this.#e;
772
+ }
773
+ get userInputWithCursor() {
774
+ if (!this.userInput)
775
+ return styleText(["inverse", "hidden"], "_");
776
+ if (this._cursor >= this.userInput.length)
777
+ return `${this.userInput}\u2588`;
778
+ const e = this.userInput.slice(0, this.cursor), t2 = this.userInput.slice(this.cursor, this.cursor + 1), i2 = this.userInput.slice(this.cursor + 1);
779
+ return `${e}${styleText("inverse", t2)}${i2}`;
780
+ }
781
+ get options() {
782
+ return typeof this.#i == "function" ? this.#i() : this.#i;
783
+ }
784
+ constructor(e) {
785
+ super(e), this.#i = e.options, this.#n = e.placeholder;
786
+ const t2 = this.options;
787
+ this.filteredOptions = [...t2], this.multiple = e.multiple === true, this.#t = typeof e.options == "function" ? e.filter : e.filter ?? g;
788
+ let i2;
789
+ if (e.initialValue && Array.isArray(e.initialValue) ? this.multiple ? i2 = e.initialValue : i2 = e.initialValue.slice(0, 1) : !this.multiple && this.options.length > 0 && (i2 = [this.options[0]?.value]), i2)
790
+ for (const s of i2) {
791
+ const n3 = t2.findIndex((o2) => o2.value === s);
792
+ n3 !== -1 && (this.toggleSelected(s), this.#e = n3);
793
+ }
794
+ this.focusedValue = this.options[this.#e]?.value, this.on("key", (s, n3) => this.#l(s, n3)), this.on("userInput", (s) => this.#u(s));
795
+ }
796
+ _isActionKey(e, t2) {
797
+ return e === " " || this.multiple && this.isNavigating && t2.name === "space" && e !== void 0 && e !== "";
798
+ }
799
+ #l(e, t2) {
800
+ const i2 = t2.name === "up", s = t2.name === "down", n3 = t2.name === "return", o2 = this.userInput === "" || this.userInput === " ", u5 = this.#n, a2 = this.options, f2 = u5 !== void 0 && u5 !== "" && a2.some(
801
+ (r2) => !r2.disabled && (this.#t ? this.#t(u5, r2) : true)
802
+ );
803
+ if (t2.name === "tab" && o2 && f2) {
804
+ this.userInput === " " && this._clearUserInput(), this._setUserInput(u5, true), this.isNavigating = false;
805
+ return;
806
+ }
807
+ i2 || s ? (this.#e = findCursor(this.#e, i2 ? -1 : 1, this.filteredOptions), this.focusedValue = this.filteredOptions[this.#e]?.value, this.multiple || (this.selectedValues = [this.focusedValue]), this.isNavigating = true) : n3 ? this.value = m(this.multiple, this.selectedValues) : this.multiple ? this.focusedValue !== void 0 && (t2.name === "tab" || this.isNavigating && t2.name === "space") ? this.toggleSelected(this.focusedValue) : this.isNavigating = false : (this.focusedValue && (this.selectedValues = [this.focusedValue]), this.isNavigating = false);
808
+ }
809
+ deselectAll() {
810
+ this.selectedValues = [];
811
+ }
812
+ toggleSelected(e) {
813
+ this.filteredOptions.length !== 0 && (this.multiple ? this.selectedValues.includes(e) ? this.selectedValues = this.selectedValues.filter((t2) => t2 !== e) : this.selectedValues = [...this.selectedValues, e] : this.selectedValues = [e]);
814
+ }
815
+ #u(e) {
816
+ if (e !== this.#s) {
817
+ this.#s = e;
818
+ const t2 = this.options;
819
+ e && this.#t ? this.filteredOptions = t2.filter((n3) => this.#t?.(e, n3)) : this.filteredOptions = [...t2];
820
+ const i2 = p$1(this.focusedValue, this.filteredOptions);
821
+ this.#e = findCursor(i2, 0, this.filteredOptions);
822
+ const s = this.filteredOptions[this.#e];
823
+ s && !s.disabled ? this.focusedValue = s.value : this.focusedValue = void 0, this.multiple || (this.focusedValue !== void 0 ? this.toggleSelected(this.focusedValue) : this.deselectAll());
824
+ }
825
+ }
826
+ };
827
+ var r = class extends V {
828
+ get cursor() {
829
+ return this.value ? 0 : 1;
830
+ }
831
+ get _value() {
832
+ return this.cursor === 0;
833
+ }
834
+ constructor(t2) {
835
+ super(t2, false), this.value = !!t2.initialValue, this.on("userInput", () => {
836
+ this.value = this._value;
837
+ }), this.on("confirm", (i2) => {
838
+ this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = i2, this.state = "submit", this.close();
839
+ }), this.on("cursor", () => {
840
+ this.value = !this.value;
841
+ });
842
+ }
843
+ };
844
+ var _ = {
845
+ Y: { type: "year", len: 4 },
846
+ M: { type: "month", len: 2 },
847
+ D: { type: "day", len: 2 }
848
+ };
849
+ function M(r2) {
850
+ return [...r2].map((t2) => _[t2]);
851
+ }
852
+ function P(r2) {
853
+ const i2 = new Intl.DateTimeFormat(r2, {
854
+ year: "numeric",
855
+ month: "2-digit",
856
+ day: "2-digit"
857
+ }).formatToParts(new Date(2e3, 0, 15)), s = [];
858
+ let n3 = "/";
859
+ for (const e of i2)
860
+ e.type === "literal" ? n3 = e.value.trim() || e.value : (e.type === "year" || e.type === "month" || e.type === "day") && s.push({ type: e.type, len: e.type === "year" ? 4 : 2 });
861
+ return { segments: s, separator: n3 };
862
+ }
863
+ function p(r2) {
864
+ return Number.parseInt((r2 || "0").replace(/_/g, "0"), 10) || 0;
865
+ }
866
+ function f(r2) {
867
+ return {
868
+ year: p(r2.year),
869
+ month: p(r2.month),
870
+ day: p(r2.day)
871
+ };
872
+ }
873
+ function c(r2, t2) {
874
+ return new Date(r2 || 2001, t2 || 1, 0).getDate();
875
+ }
876
+ function b(r2) {
877
+ const { year: t2, month: i2, day: s } = f(r2);
878
+ if (!t2 || t2 < 0 || t2 > 9999 || !i2 || i2 < 1 || i2 > 12 || !s || s < 1) return;
879
+ const n3 = new Date(Date.UTC(t2, i2 - 1, s));
880
+ if (!(n3.getUTCFullYear() !== t2 || n3.getUTCMonth() !== i2 - 1 || n3.getUTCDate() !== s))
881
+ return { year: t2, month: i2, day: s };
882
+ }
883
+ function C(r2) {
884
+ const t2 = b(r2);
885
+ return t2 ? new Date(Date.UTC(t2.year, t2.month - 1, t2.day)) : void 0;
886
+ }
887
+ function T2(r2, t2, i2, s) {
888
+ const n3 = i2 ? {
889
+ year: i2.getUTCFullYear(),
890
+ month: i2.getUTCMonth() + 1,
891
+ day: i2.getUTCDate()
892
+ } : null, e = s ? {
893
+ year: s.getUTCFullYear(),
894
+ month: s.getUTCMonth() + 1,
895
+ day: s.getUTCDate()
896
+ } : null;
897
+ return r2 === "year" ? { min: n3?.year ?? 1, max: e?.year ?? 9999 } : r2 === "month" ? {
898
+ min: n3 && t2.year === n3.year ? n3.month : 1,
899
+ max: e && t2.year === e.year ? e.month : 12
900
+ } : {
901
+ min: n3 && t2.year === n3.year && t2.month === n3.month ? n3.day : 1,
902
+ max: e && t2.year === e.year && t2.month === e.month ? e.day : c(t2.year, t2.month)
903
+ };
904
+ }
905
+ var U = class extends V {
906
+ #i;
907
+ #o;
908
+ #t;
909
+ #h;
910
+ #u;
911
+ #e = { segmentIndex: 0, positionInSegment: 0 };
912
+ #n = true;
913
+ #s = null;
914
+ inlineError = "";
915
+ get segmentCursor() {
916
+ return { ...this.#e };
917
+ }
918
+ get segmentValues() {
919
+ return { ...this.#t };
920
+ }
921
+ get segments() {
922
+ return this.#i;
923
+ }
924
+ get separator() {
925
+ return this.#o;
926
+ }
927
+ get formattedValue() {
928
+ return this.#l(this.#t);
929
+ }
930
+ #l(t2) {
931
+ return this.#i.map((i2) => t2[i2.type]).join(this.#o);
932
+ }
933
+ #r() {
934
+ this._setUserInput(this.#l(this.#t)), this._setValue(C(this.#t) ?? void 0);
935
+ }
936
+ constructor(t2) {
937
+ const i2 = t2.format ? { segments: M(t2.format), separator: t2.separator ?? "/" } : P(t2.locale), s = t2.separator ?? i2.separator, n3 = t2.format ? M(t2.format) : i2.segments, e = t2.initialValue ?? t2.defaultValue, m3 = e ? {
938
+ year: String(e.getUTCFullYear()).padStart(4, "0"),
939
+ month: String(e.getUTCMonth() + 1).padStart(2, "0"),
940
+ day: String(e.getUTCDate()).padStart(2, "0")
941
+ } : { year: "____", month: "__", day: "__" }, o2 = n3.map((a2) => m3[a2.type]).join(s);
942
+ super({ ...t2, initialUserInput: o2 }, false), this.#i = n3, this.#o = s, this.#t = m3, this.#h = t2.minDate, this.#u = t2.maxDate, this.#r(), this.on("cursor", (a2) => this.#f(a2)), this.on("key", (a2, u5) => this.#y(a2, u5)), this.on("finalize", () => this.#p(t2));
943
+ }
944
+ #a() {
945
+ const t2 = Math.max(0, Math.min(this.#e.segmentIndex, this.#i.length - 1)), i2 = this.#i[t2];
946
+ if (i2)
947
+ return this.#e.positionInSegment = Math.max(
948
+ 0,
949
+ Math.min(this.#e.positionInSegment, i2.len - 1)
950
+ ), { segment: i2, index: t2 };
951
+ }
952
+ #m(t2) {
953
+ this.inlineError = "", this.#s = null;
954
+ const i2 = this.#a();
955
+ i2 && (this.#e.segmentIndex = Math.max(
956
+ 0,
957
+ Math.min(this.#i.length - 1, i2.index + t2)
958
+ ), this.#e.positionInSegment = 0, this.#n = true);
959
+ }
960
+ #d(t2) {
961
+ const i2 = this.#a();
962
+ if (!i2) return;
963
+ const { segment: s } = i2, n3 = this.#t[s.type], e = !n3 || n3.replace(/_/g, "") === "", m3 = Number.parseInt((n3 || "0").replace(/_/g, "0"), 10) || 0, o2 = T2(
964
+ s.type,
965
+ f(this.#t),
966
+ this.#h,
967
+ this.#u
968
+ );
969
+ let a2;
970
+ e ? a2 = t2 === 1 ? o2.min : o2.max : a2 = Math.max(Math.min(o2.max, m3 + t2), o2.min), this.#t = {
971
+ ...this.#t,
972
+ [s.type]: a2.toString().padStart(s.len, "0")
973
+ }, this.#n = true, this.#s = null, this.#r();
974
+ }
975
+ #f(t2) {
976
+ if (t2)
977
+ switch (t2) {
978
+ case "right":
979
+ return this.#m(1);
980
+ case "left":
981
+ return this.#m(-1);
982
+ case "up":
983
+ return this.#d(1);
984
+ case "down":
985
+ return this.#d(-1);
986
+ }
987
+ }
988
+ #y(t2, i2) {
989
+ if (i2?.name === "backspace" || i2?.sequence === "\x7F" || i2?.sequence === "\b" || t2 === "\x7F" || t2 === "\b") {
990
+ this.inlineError = "";
991
+ const n3 = this.#a();
992
+ if (!n3) return;
993
+ if (!this.#t[n3.segment.type].replace(/_/g, "")) {
994
+ this.#m(-1);
995
+ return;
996
+ }
997
+ this.#t[n3.segment.type] = "_".repeat(n3.segment.len), this.#n = true, this.#e.positionInSegment = 0, this.#r();
998
+ return;
999
+ }
1000
+ if (i2?.name === "tab") {
1001
+ this.inlineError = "";
1002
+ const n3 = this.#a();
1003
+ if (!n3) return;
1004
+ const e = i2.shift ? -1 : 1, m3 = n3.index + e;
1005
+ m3 >= 0 && m3 < this.#i.length && (this.#e.segmentIndex = m3, this.#e.positionInSegment = 0, this.#n = true);
1006
+ return;
1007
+ }
1008
+ if (t2 && /^[0-9]$/.test(t2)) {
1009
+ const n3 = this.#a();
1010
+ if (!n3) return;
1011
+ const { segment: e } = n3, m3 = !this.#t[e.type].replace(/_/g, "");
1012
+ if (this.#n && this.#s !== null && !m3) {
1013
+ const h2 = this.#s + t2, d = { ...this.#t, [e.type]: h2 }, g2 = this.#g(d, e);
1014
+ if (g2) {
1015
+ this.inlineError = g2, this.#s = null, this.#n = false;
1016
+ return;
1017
+ }
1018
+ this.inlineError = "", this.#t[e.type] = h2, this.#s = null, this.#n = false, this.#r(), n3.index < this.#i.length - 1 && (this.#e.segmentIndex = n3.index + 1, this.#e.positionInSegment = 0, this.#n = true);
1019
+ return;
1020
+ }
1021
+ this.#n && !m3 && (this.#t[e.type] = "_".repeat(e.len), this.#e.positionInSegment = 0), this.#n = false, this.#s = null;
1022
+ const o2 = this.#t[e.type], a2 = o2.indexOf("_"), u5 = a2 >= 0 ? a2 : Math.min(this.#e.positionInSegment, e.len - 1);
1023
+ if (u5 < 0 || u5 >= e.len) return;
1024
+ let l2 = o2.slice(0, u5) + t2 + o2.slice(u5 + 1), D = false;
1025
+ if (u5 === 0 && o2 === "__" && (e.type === "month" || e.type === "day")) {
1026
+ const h2 = Number.parseInt(t2, 10);
1027
+ l2 = `0${t2}`, D = h2 <= (e.type === "month" ? 1 : 2);
1028
+ }
1029
+ if (e.type === "year" && (l2 = (o2.replace(/_/g, "") + t2).padStart(e.len, "_")), !l2.includes("_")) {
1030
+ const h2 = { ...this.#t, [e.type]: l2 }, d = this.#g(h2, e);
1031
+ if (d) {
1032
+ this.inlineError = d;
1033
+ return;
1034
+ }
1035
+ }
1036
+ this.inlineError = "", this.#t[e.type] = l2;
1037
+ const y = l2.includes("_") ? void 0 : b(this.#t);
1038
+ if (y) {
1039
+ const { year: h2, month: d } = y, g2 = c(h2, d);
1040
+ this.#t = {
1041
+ year: String(Math.max(0, Math.min(9999, h2))).padStart(4, "0"),
1042
+ month: String(Math.max(1, Math.min(12, d))).padStart(2, "0"),
1043
+ day: String(Math.max(1, Math.min(g2, y.day))).padStart(2, "0")
1044
+ };
1045
+ }
1046
+ this.#r();
1047
+ const S = l2.indexOf("_");
1048
+ D ? (this.#n = true, this.#s = t2) : S >= 0 ? this.#e.positionInSegment = S : a2 >= 0 && n3.index < this.#i.length - 1 ? (this.#e.segmentIndex = n3.index + 1, this.#e.positionInSegment = 0, this.#n = true) : this.#e.positionInSegment = Math.min(u5 + 1, e.len - 1);
1049
+ }
1050
+ }
1051
+ #g(t2, i2) {
1052
+ const { month: s, day: n3 } = f(t2);
1053
+ if (i2.type === "month" && (s < 0 || s > 12))
1054
+ return settings.date.messages.invalidMonth;
1055
+ if (i2.type === "day" && (n3 < 0 || n3 > 31))
1056
+ return settings.date.messages.invalidDay(31, "any month");
1057
+ }
1058
+ #p(t2) {
1059
+ const { year: i2, month: s, day: n3 } = f(this.#t);
1060
+ if (i2 && s && n3) {
1061
+ const e = c(i2, s);
1062
+ this.#t = {
1063
+ ...this.#t,
1064
+ day: String(Math.min(n3, e)).padStart(2, "0")
1065
+ };
1066
+ }
1067
+ this.value = C(this.#t) ?? t2.defaultValue ?? void 0;
1068
+ }
1069
+ };
1070
+ var u$2 = class u extends V {
1071
+ options;
1072
+ cursor = 0;
1073
+ #t;
1074
+ getGroupItems(t2) {
1075
+ return this.options.filter((r2) => r2.group === t2);
1076
+ }
1077
+ isGroupSelected(t2) {
1078
+ const r2 = this.getGroupItems(t2), e = this.value;
1079
+ return e === void 0 ? false : r2.every((s) => e.includes(s.value));
1080
+ }
1081
+ toggleValue() {
1082
+ const t2 = this.options[this.cursor];
1083
+ if (t2 !== void 0)
1084
+ if (this.value === void 0 && (this.value = []), t2.group === true) {
1085
+ const r2 = t2.value, e = this.getGroupItems(r2);
1086
+ this.isGroupSelected(r2) ? this.value = this.value.filter(
1087
+ (s) => e.findIndex((i2) => i2.value === s) === -1
1088
+ ) : this.value = [...this.value, ...e.map((s) => s.value)], this.value = Array.from(new Set(this.value));
1089
+ } else {
1090
+ const r2 = this.value.includes(t2.value);
1091
+ this.value = r2 ? this.value.filter((e) => e !== t2.value) : [...this.value, t2.value];
1092
+ }
1093
+ }
1094
+ constructor(t2) {
1095
+ super(t2, false);
1096
+ const { options: r2 } = t2;
1097
+ this.#t = t2.selectableGroups !== false, this.options = Object.entries(r2).flatMap(([e, s]) => [
1098
+ { value: e, group: true, label: e },
1099
+ ...s.map((i2) => ({ ...i2, group: e }))
1100
+ ]), this.value = [...t2.initialValues ?? []], this.cursor = Math.max(
1101
+ this.options.findIndex(({ value: e }) => e === t2.cursorAt),
1102
+ this.#t ? 0 : 1
1103
+ ), this.on("cursor", (e) => {
1104
+ switch (e) {
1105
+ case "left":
1106
+ case "up": {
1107
+ this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
1108
+ const s = this.options[this.cursor]?.group === true;
1109
+ !this.#t && s && (this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1);
1110
+ break;
1111
+ }
1112
+ case "down":
1113
+ case "right": {
1114
+ this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
1115
+ const s = this.options[this.cursor]?.group === true;
1116
+ !this.#t && s && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
1117
+ break;
1118
+ }
1119
+ case "space":
1120
+ this.toggleValue();
1121
+ break;
1122
+ }
1123
+ });
1124
+ }
1125
+ };
1126
+ var o = /* @__PURE__ */ new Set(["up", "down", "left", "right"]);
1127
+ var h = class extends V {
1128
+ #t = false;
1129
+ #s;
1130
+ focused = "editor";
1131
+ get userInputWithCursor() {
1132
+ if (this.state === "submit")
1133
+ return this.userInput;
1134
+ const t2 = this.userInput;
1135
+ if (this.cursor >= t2.length)
1136
+ return `${t2}\u2588`;
1137
+ const s = t2.slice(0, this.cursor), r2 = t2.slice(this.cursor, this.cursor + 1), i2 = t2.slice(this.cursor + 1);
1138
+ return r2 === `
1139
+ ` ? `${s}\u2588
1140
+ ${i2}` : `${s}${styleText("inverse", r2)}${i2}`;
1141
+ }
1142
+ get cursor() {
1143
+ return this._cursor;
1144
+ }
1145
+ #r(t2) {
1146
+ if (this.userInput.length === 0) {
1147
+ this._setUserInput(t2);
1148
+ return;
1149
+ }
1150
+ this._setUserInput(
1151
+ this.userInput.slice(0, this.cursor) + t2 + this.userInput.slice(this.cursor)
1152
+ );
1153
+ }
1154
+ #i(t2) {
1155
+ const s = this.value ?? "";
1156
+ switch (t2) {
1157
+ case "up":
1158
+ this._cursor = findTextCursor(this._cursor, 0, -1, s);
1159
+ return;
1160
+ case "down":
1161
+ this._cursor = findTextCursor(this._cursor, 0, 1, s);
1162
+ return;
1163
+ case "left":
1164
+ this._cursor = findTextCursor(this._cursor, -1, 0, s);
1165
+ return;
1166
+ case "right":
1167
+ this._cursor = findTextCursor(this._cursor, 1, 0, s);
1168
+ return;
1169
+ }
1170
+ }
1171
+ _shouldSubmit(t2, s) {
1172
+ if (this.#s)
1173
+ return this.focused === "submit" ? true : (this.#r(`
1174
+ `), this._cursor++, false);
1175
+ const r2 = this.#t;
1176
+ return this.#t = true, r2 && this.cursor === this.userInput.length ? (this.userInput[this.cursor - 1] === `
1177
+ ` && (this._setUserInput(
1178
+ this.userInput.slice(0, this.cursor - 1) + this.userInput.slice(this.cursor)
1179
+ ), this._cursor--), true) : (this.#r(`
1180
+ `), this._cursor++, false);
1181
+ }
1182
+ constructor(t2) {
1183
+ const s = t2.initialUserInput ?? t2.initialValue;
1184
+ super(
1185
+ {
1186
+ ...t2,
1187
+ initialUserInput: s
1188
+ },
1189
+ false
1190
+ ), s !== void 0 && (this._cursor = s.length), this.#s = t2.showSubmit ?? false, this.on("key", (r2, i2) => {
1191
+ if (i2?.name && o.has(i2.name)) {
1192
+ this.#t = false, this.#i(i2.name);
1193
+ return;
1194
+ }
1195
+ if (r2 === " " && this.#s) {
1196
+ this.focused = this.focused === "editor" ? "submit" : "editor";
1197
+ return;
1198
+ }
1199
+ if (i2?.name !== "return") {
1200
+ if (this.#t = false, i2?.name === "backspace" && this.cursor > 0) {
1201
+ this._setUserInput(
1202
+ this.userInput.slice(0, this.cursor - 1) + this.userInput.slice(this.cursor)
1203
+ ), this._cursor--;
1204
+ return;
1205
+ }
1206
+ if (i2?.name === "delete" && this.cursor < this.userInput.length) {
1207
+ this._setUserInput(
1208
+ this.userInput.slice(0, this.cursor) + this.userInput.slice(this.cursor + 1)
1209
+ );
1210
+ return;
1211
+ }
1212
+ r2 && (this.#s && this.focused === "submit" && (this.focused = "editor"), this.#r(r2 ?? ""), this._cursor++);
1213
+ }
1214
+ }), this.on("userInput", (r2) => {
1215
+ this._setValue(r2);
1216
+ }), this.on("finalize", () => {
1217
+ this.value || (this.value = t2.defaultValue), this.value === void 0 && (this.value = "");
1218
+ });
1219
+ }
1220
+ };
1221
+ var a = class extends V {
1222
+ options;
1223
+ cursor = 0;
1224
+ get _value() {
1225
+ return this.options[this.cursor]?.value;
1226
+ }
1227
+ get _enabledOptions() {
1228
+ return this.options.filter((e) => e.disabled !== true);
1229
+ }
1230
+ toggleAll() {
1231
+ const e = this._enabledOptions, i2 = this.value !== void 0 && this.value.length === e.length;
1232
+ this.value = i2 ? [] : e.map((t2) => t2.value);
1233
+ }
1234
+ toggleInvert() {
1235
+ const e = this.value;
1236
+ if (!e)
1237
+ return;
1238
+ const i2 = this._enabledOptions.filter((t2) => !e.includes(t2.value));
1239
+ this.value = i2.map((t2) => t2.value);
1240
+ }
1241
+ toggleValue() {
1242
+ this.value === void 0 && (this.value = []);
1243
+ const e = this.value.includes(this._value);
1244
+ this.value = e ? this.value.filter((i2) => i2 !== this._value) : [...this.value, this._value];
1245
+ }
1246
+ constructor(e) {
1247
+ super(e, false), this.options = e.options, this.value = [...e.initialValues ?? []];
1248
+ const i2 = Math.max(
1249
+ this.options.findIndex(({ value: t2 }) => t2 === e.cursorAt),
1250
+ 0
1251
+ );
1252
+ this.cursor = this.options[i2]?.disabled ? findCursor(i2, 1, this.options) : i2, this.on("key", (t2, l2) => {
1253
+ l2.name === "a" && this.toggleAll(), l2.name === "i" && this.toggleInvert();
1254
+ }), this.on("cursor", (t2) => {
1255
+ switch (t2) {
1256
+ case "left":
1257
+ case "up":
1258
+ this.cursor = findCursor(this.cursor, -1, this.options);
1259
+ break;
1260
+ case "down":
1261
+ case "right":
1262
+ this.cursor = findCursor(this.cursor, 1, this.options);
1263
+ break;
1264
+ case "space":
1265
+ this.toggleValue();
1266
+ break;
1267
+ }
1268
+ });
1269
+ }
1270
+ };
1271
+ var u$1 = class u2 extends V {
1272
+ _mask = "\u2022";
1273
+ get cursor() {
1274
+ return this._cursor;
1275
+ }
1276
+ get masked() {
1277
+ return this.userInput.replaceAll(/./g, this._mask);
1278
+ }
1279
+ get userInputWithCursor() {
1280
+ if (this.state === "submit" || this.state === "cancel")
1281
+ return this.masked;
1282
+ const t2 = this.userInput;
1283
+ if (this.cursor >= t2.length)
1284
+ return `${this.masked}${styleText(["inverse", "hidden"], "_")}`;
1285
+ const s = this.masked, r2 = s.slice(0, this.cursor), i2 = s.slice(this.cursor, this.cursor + 1), o2 = s.slice(this.cursor + 1);
1286
+ return `${r2}${styleText("inverse", i2)}${o2}`;
1287
+ }
1288
+ clear() {
1289
+ this._clearUserInput();
1290
+ }
1291
+ constructor({ mask: t2, ...s }) {
1292
+ super(s), this._mask = t2 ?? "\u2022", this.on("userInput", (r2) => {
1293
+ this._setValue(r2);
1294
+ }), this.on("finalize", () => {
1295
+ this.value === void 0 && (this.value = "");
1296
+ });
1297
+ }
1298
+ };
1299
+ var n$1 = class n extends V {
1300
+ options;
1301
+ cursor = 0;
1302
+ get _selectedValue() {
1303
+ return this.options[this.cursor];
1304
+ }
1305
+ changeValue() {
1306
+ const e = this._selectedValue;
1307
+ this.value = e === void 0 ? void 0 : e.value;
1308
+ }
1309
+ constructor(e) {
1310
+ super(e, false), this.options = e.options;
1311
+ const o2 = this.options.findIndex(({ value: s }) => s === e.initialValue), t2 = o2 === -1 ? 0 : o2;
1312
+ this.cursor = this.options[t2]?.disabled ? findCursor(t2, 1, this.options) : t2, this.changeValue(), this.on("cursor", (s) => {
1313
+ switch (s) {
1314
+ case "left":
1315
+ case "up":
1316
+ this.cursor = findCursor(this.cursor, -1, this.options);
1317
+ break;
1318
+ case "down":
1319
+ case "right":
1320
+ this.cursor = findCursor(this.cursor, 1, this.options);
1321
+ break;
1322
+ }
1323
+ this.changeValue();
1324
+ });
1325
+ }
1326
+ };
1327
+ var u3 = class extends V {
1328
+ options;
1329
+ cursor = 0;
1330
+ constructor(t2) {
1331
+ super(t2, false), this.options = t2.options;
1332
+ const s = t2.caseSensitive === true, i2 = this.options.map(({ value: [e] }) => s ? e : e?.toLowerCase());
1333
+ this.cursor = Math.max(i2.indexOf(t2.initialValue), 0), this.on("key", (e) => {
1334
+ if (!e)
1335
+ return;
1336
+ const o2 = s ? e : e.toLowerCase();
1337
+ if (!i2.includes(o2))
1338
+ return;
1339
+ const n3 = this.options.find(({ value: [r2] }) => s ? r2 === o2 : r2?.toLowerCase() === o2);
1340
+ n3 && (this.value = n3.value, this.state = "submit", this.emit("submit"));
1341
+ });
1342
+ }
1343
+ };
1344
+ var n2 = class extends V {
1345
+ get userInputWithCursor() {
1346
+ if (this.state === "submit")
1347
+ return this.userInput;
1348
+ const t2 = this.userInput;
1349
+ if (this.cursor >= t2.length)
1350
+ return `${this.userInput}\u2588`;
1351
+ const r2 = t2.slice(0, this.cursor), s = t2.slice(this.cursor, this.cursor + 1), e = t2.slice(this.cursor + 1);
1352
+ return `${r2}${styleText("inverse", s)}${e}`;
1353
+ }
1354
+ get cursor() {
1355
+ return this._cursor;
1356
+ }
1357
+ constructor(t2) {
1358
+ super({
1359
+ ...t2,
1360
+ initialUserInput: t2.initialUserInput ?? t2.initialValue
1361
+ }), this.on("userInput", (r2) => {
1362
+ this._setValue(r2);
1363
+ }), this.on("finalize", () => {
1364
+ this.value || (this.value = t2.defaultValue), this.value === void 0 && (this.value = "");
1365
+ });
1366
+ }
1367
+ };
1368
+
1369
+ // node_modules/.pnpm/@clack+prompts@1.7.0/node_modules/@clack/prompts/dist/index.mjs
1370
+ import { styleText as styleText2, stripVTControlCharacters } from "node:util";
1371
+ import process$1 from "node:process";
1372
+ var import_sisteransi2 = __toESM(require_src(), 1);
1373
+ import { existsSync, lstatSync, readdirSync } from "node:fs";
1374
+ import { dirname, join } from "node:path";
1375
+ function isUnicodeSupported() {
1376
+ if (process$1.platform !== "win32") {
1377
+ return process$1.env.TERM !== "linux";
1378
+ }
1379
+ return Boolean(process$1.env.CI) || Boolean(process$1.env.WT_SESSION) || Boolean(process$1.env.TERMINUS_SUBLIME) || process$1.env.ConEmuTask === "{cmd::Cmder}" || process$1.env.TERM_PROGRAM === "Terminus-Sublime" || process$1.env.TERM_PROGRAM === "vscode" || process$1.env.TERM === "xterm-256color" || process$1.env.TERM === "alacritty" || process$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
1380
+ }
1381
+ var unicode = isUnicodeSupported();
1382
+ var isCI = () => process.env.CI === "true";
1383
+ var isTTY = (o2) => o2.isTTY === true;
1384
+ var unicodeOr = (o2, e) => unicode ? o2 : e;
1385
+ var S_STEP_ACTIVE = unicodeOr("\u25C6", "*");
1386
+ var S_STEP_CANCEL = unicodeOr("\u25A0", "x");
1387
+ var S_STEP_ERROR = unicodeOr("\u25B2", "x");
1388
+ var S_STEP_SUBMIT = unicodeOr("\u25C7", "o");
1389
+ var S_BAR_START = unicodeOr("\u250C", "T");
1390
+ var S_BAR = unicodeOr("\u2502", "|");
1391
+ var S_BAR_END = unicodeOr("\u2514", "\u2014");
1392
+ var S_BAR_START_RIGHT = unicodeOr("\u2510", "T");
1393
+ var S_BAR_END_RIGHT = unicodeOr("\u2518", "\u2014");
1394
+ var S_RADIO_ACTIVE = unicodeOr("\u25CF", ">");
1395
+ var S_RADIO_INACTIVE = unicodeOr("\u25CB", " ");
1396
+ var S_CHECKBOX_ACTIVE = unicodeOr("\u25FB", "[\u2022]");
1397
+ var S_CHECKBOX_SELECTED = unicodeOr("\u25FC", "[+]");
1398
+ var S_CHECKBOX_INACTIVE = unicodeOr("\u25FB", "[ ]");
1399
+ var S_PASSWORD_MASK = unicodeOr("\u25AA", "\u2022");
1400
+ var S_BAR_H = unicodeOr("\u2500", "-");
1401
+ var S_CORNER_TOP_RIGHT = unicodeOr("\u256E", "+");
1402
+ var S_CONNECT_LEFT = unicodeOr("\u251C", "+");
1403
+ var S_CORNER_BOTTOM_RIGHT = unicodeOr("\u256F", "+");
1404
+ var S_CORNER_BOTTOM_LEFT = unicodeOr("\u2570", "+");
1405
+ var S_CORNER_TOP_LEFT = unicodeOr("\u256D", "+");
1406
+ var S_INFO = unicodeOr("\u25CF", "\u2022");
1407
+ var S_SUCCESS = unicodeOr("\u25C6", "*");
1408
+ var S_WARN = unicodeOr("\u25B2", "!");
1409
+ var S_ERROR = unicodeOr("\u25A0", "x");
1410
+ var symbol = (o2) => {
1411
+ switch (o2) {
1412
+ case "initial":
1413
+ case "active":
1414
+ return styleText2("cyan", S_STEP_ACTIVE);
1415
+ case "cancel":
1416
+ return styleText2("red", S_STEP_CANCEL);
1417
+ case "error":
1418
+ return styleText2("yellow", S_STEP_ERROR);
1419
+ case "submit":
1420
+ return styleText2("green", S_STEP_SUBMIT);
1421
+ }
1422
+ };
1423
+ var symbolBar = (o2) => {
1424
+ switch (o2) {
1425
+ case "initial":
1426
+ case "active":
1427
+ return styleText2("cyan", S_BAR);
1428
+ case "cancel":
1429
+ return styleText2("red", S_BAR);
1430
+ case "error":
1431
+ return styleText2("yellow", S_BAR);
1432
+ case "submit":
1433
+ return styleText2("green", S_BAR);
1434
+ }
1435
+ };
1436
+ function formatInstructionFooter(o2, e) {
1437
+ const r2 = [`${e ? `${styleText2("cyan", S_BAR)} ` : ""}${o2.join(" \u2022 ")}`];
1438
+ return e && r2.push(styleText2("cyan", S_BAR_END)), r2;
1439
+ }
1440
+ var I = (l2, e, w, p3, b3, C3 = false) => {
1441
+ let r2 = e, O = 0;
1442
+ if (C3)
1443
+ for (let i2 = p3 - 1; i2 >= w; i2--) {
1444
+ const m3 = l2[i2];
1445
+ if (m3 && (r2 -= m3.length), O++, r2 <= b3) break;
1446
+ }
1447
+ else
1448
+ for (let i2 = w; i2 < p3; i2++) {
1449
+ const m3 = l2[i2];
1450
+ if (m3 && (r2 -= m3.length), O++, r2 <= b3) break;
1451
+ }
1452
+ return { lineCount: r2, removals: O };
1453
+ };
1454
+ var limitOptions = ({
1455
+ cursor: l2,
1456
+ options: e,
1457
+ style: w,
1458
+ output: p3 = process.stdout,
1459
+ maxItems: b3 = Number.POSITIVE_INFINITY,
1460
+ columnPadding: C3 = 0,
1461
+ rowPadding: r2 = 4
1462
+ }) => {
1463
+ const i2 = getColumns(p3) - C3, m3 = getRows(p3), M2 = styleText2("dim", "..."), v = Math.max(m3 - r2, 0), a2 = Math.max(Math.min(b3, v), 5);
1464
+ let f2 = 0;
1465
+ l2 >= a2 - 3 && (f2 = Math.max(
1466
+ Math.min(l2 - a2 + 3, e.length - a2),
1467
+ 0
1468
+ ));
1469
+ let d = a2 < e.length && f2 > 0, c3 = a2 < e.length && f2 + a2 < e.length;
1470
+ const W2 = Math.min(
1471
+ f2 + a2,
1472
+ e.length
1473
+ ), s = [];
1474
+ let g2 = 0;
1475
+ d && g2++, c3 && g2++;
1476
+ const T3 = f2 + (d ? 1 : 0), y = W2 - (c3 ? 1 : 0);
1477
+ for (let t2 = T3; t2 < y; t2++) {
1478
+ const n3 = e[t2], o2 = n3 ? w(n3, t2 === l2) : "", h2 = wrapAnsi(o2, i2, {
1479
+ hard: true,
1480
+ trim: false
1481
+ }).split(`
1482
+ `);
1483
+ s.push(h2), g2 += h2.length;
1484
+ }
1485
+ if (g2 > v) {
1486
+ let t2 = 0, n3 = 0, o2 = g2;
1487
+ const h2 = l2 - T3;
1488
+ let u5 = v;
1489
+ const L = () => I(s, o2, 0, h2, u5), E2 = () => I(
1490
+ s,
1491
+ o2,
1492
+ h2 + 1,
1493
+ s.length,
1494
+ u5,
1495
+ true
1496
+ );
1497
+ d ? ({ lineCount: o2, removals: t2 } = L(), o2 > u5 && (c3 || (u5 -= 1), { lineCount: o2, removals: n3 } = E2())) : (c3 || (u5 -= 1), { lineCount: o2, removals: n3 } = E2(), o2 > u5 && (u5 -= 1, { lineCount: o2, removals: t2 } = L())), t2 > 0 && (d = true, s.splice(0, t2)), n3 > 0 && (c3 = true, s.splice(s.length - n3, n3));
1498
+ }
1499
+ const x2 = [];
1500
+ d && x2.push(M2);
1501
+ for (const t2 of s)
1502
+ for (const n3 of t2)
1503
+ x2.push(n3);
1504
+ return c3 && x2.push(M2), x2;
1505
+ };
1506
+ function P2(t2) {
1507
+ return t2.label ?? String(t2.value ?? "");
1508
+ }
1509
+ function E(t2, c3) {
1510
+ if (!t2)
1511
+ return true;
1512
+ const n3 = (c3.label ?? String(c3.value ?? "")).toLowerCase(), i2 = (c3.hint ?? "").toLowerCase(), l2 = String(c3.value).toLowerCase(), o2 = t2.toLowerCase();
1513
+ return n3.includes(o2) || i2.includes(o2) || l2.includes(o2);
1514
+ }
1515
+ function N(t2, c3) {
1516
+ const n3 = [];
1517
+ for (const i2 of c3)
1518
+ t2.includes(i2.value) && n3.push(i2);
1519
+ return n3;
1520
+ }
1521
+ var autocomplete = (t2) => new T$1({
1522
+ options: t2.options,
1523
+ initialValue: t2.initialValue ? [t2.initialValue] : void 0,
1524
+ initialUserInput: t2.initialUserInput,
1525
+ placeholder: t2.placeholder,
1526
+ filter: t2.filter ?? ((n3, i2) => E(n3, i2)),
1527
+ signal: t2.signal,
1528
+ input: t2.input,
1529
+ output: t2.output,
1530
+ validate: t2.validate,
1531
+ render() {
1532
+ const n3 = t2.withGuide ?? settings.withGuide, i2 = n3 ? [`${styleText2("gray", S_BAR)}`, `${symbol(this.state)} ${t2.message}`] : [`${symbol(this.state)} ${t2.message}`], l2 = this.userInput, o2 = this.options, m3 = t2.placeholder, p3 = l2 === "" && m3 !== void 0, $ = (r2, s) => {
1533
+ const a2 = P2(r2), u5 = r2.hint && r2.value === this.focusedValue ? styleText2("dim", ` (${r2.hint})`) : "";
1534
+ switch (s) {
1535
+ case "active":
1536
+ return `${styleText2("green", S_RADIO_ACTIVE)} ${a2}${u5}`;
1537
+ case "inactive":
1538
+ return `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", a2)}`;
1539
+ case "disabled":
1540
+ return `${styleText2("gray", S_RADIO_INACTIVE)} ${styleText2(["strikethrough", "gray"], a2)}`;
1541
+ }
1542
+ };
1543
+ switch (this.state) {
1544
+ case "submit": {
1545
+ const r2 = N(this.selectedValues, o2), s = r2.length > 0 ? ` ${styleText2("dim", r2.map(P2).join(", "))}` : "", a2 = n3 ? styleText2("gray", S_BAR) : "";
1546
+ return `${i2.join(`
1547
+ `)}
1548
+ ${a2}${s}`;
1549
+ }
1550
+ case "cancel": {
1551
+ const r2 = l2 ? ` ${styleText2(["strikethrough", "dim"], l2)}` : "", s = n3 ? styleText2("gray", S_BAR) : "";
1552
+ return `${i2.join(`
1553
+ `)}
1554
+ ${s}${r2}`;
1555
+ }
1556
+ default: {
1557
+ const r2 = this.state === "error" ? "yellow" : "cyan", s = n3 ? `${styleText2(r2, S_BAR)} ` : "", a2 = n3 ? styleText2(r2, S_BAR_END) : "";
1558
+ let u5 = "";
1559
+ if (this.isNavigating || p3) {
1560
+ const d = p3 ? m3 : l2;
1561
+ u5 = d !== "" ? ` ${styleText2("dim", d)}` : "";
1562
+ } else
1563
+ u5 = ` ${this.userInputWithCursor}`;
1564
+ const V2 = this.filteredOptions.length !== o2.length ? styleText2(
1565
+ "dim",
1566
+ ` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? "" : "es"})`
1567
+ ) : "", y = this.filteredOptions.length === 0 && l2 ? [`${s}${styleText2("yellow", "No matches found")}`] : [], b3 = this.state === "error" ? [`${s}${styleText2("yellow", this.error)}`] : [];
1568
+ n3 && i2.push(`${s.trimEnd()}`), i2.push(
1569
+ `${s}${styleText2("dim", "Search:")}${u5}${V2}`,
1570
+ ...y,
1571
+ ...b3
1572
+ );
1573
+ const v = [
1574
+ `${styleText2("dim", "\u2191/\u2193")} to select`,
1575
+ `${styleText2("dim", "Enter:")} confirm`,
1576
+ `${styleText2("dim", "Type:")} to search`
1577
+ ], g2 = [`${s}${v.join(" \u2022 ")}`, a2], O = this.filteredOptions.length === 0 ? [] : limitOptions({
1578
+ cursor: this.cursor,
1579
+ options: this.filteredOptions,
1580
+ columnPadding: n3 ? 3 : 0,
1581
+ // for `| ` when guide is shown
1582
+ rowPadding: i2.length + g2.length,
1583
+ style: (d, f2) => $(
1584
+ d,
1585
+ d.disabled ? "disabled" : f2 ? "active" : "inactive"
1586
+ ),
1587
+ maxItems: t2.maxItems,
1588
+ output: t2.output
1589
+ });
1590
+ return [
1591
+ ...i2,
1592
+ ...O.map((d) => `${s}${d}`),
1593
+ ...g2
1594
+ ].join(`
1595
+ `);
1596
+ }
1597
+ }
1598
+ }
1599
+ }).prompt();
1600
+ var autocompleteMultiselect = (t2) => {
1601
+ const c3 = (i2, l2, o2, m3) => {
1602
+ const p3 = o2.includes(i2.value), $ = i2.label ?? String(i2.value ?? ""), r2 = i2.hint && m3 !== void 0 && i2.value === m3 ? styleText2("dim", ` (${i2.hint})`) : "", s = p3 ? styleText2("green", S_CHECKBOX_SELECTED) : styleText2("dim", S_CHECKBOX_INACTIVE);
1603
+ return i2.disabled ? `${styleText2("gray", S_CHECKBOX_INACTIVE)} ${styleText2(["strikethrough", "gray"], $)}` : l2 ? `${s} ${$}${r2}` : `${s} ${styleText2("dim", $)}`;
1604
+ }, n3 = new T$1({
1605
+ options: t2.options,
1606
+ multiple: true,
1607
+ placeholder: t2.placeholder,
1608
+ filter: t2.filter ?? ((i2, l2) => E(i2, l2)),
1609
+ validate: () => {
1610
+ if (t2.required && n3.selectedValues.length === 0)
1611
+ return "Please select at least one item";
1612
+ },
1613
+ initialValue: t2.initialValues,
1614
+ signal: t2.signal,
1615
+ input: t2.input,
1616
+ output: t2.output,
1617
+ render() {
1618
+ const i2 = t2.withGuide ?? settings.withGuide, l2 = `${i2 ? `${styleText2("gray", S_BAR)}
1619
+ ` : ""}${symbol(this.state)} ${t2.message}
1620
+ `, o2 = this.userInput, m3 = t2.placeholder, p3 = o2 === "" && m3 !== void 0, $ = this.isNavigating || p3 ? styleText2("dim", p3 ? m3 : o2) : this.userInputWithCursor, r2 = this.options, s = this.filteredOptions.length !== r2.length ? styleText2(
1621
+ "dim",
1622
+ ` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? "" : "es"})`
1623
+ ) : "";
1624
+ switch (this.state) {
1625
+ case "submit":
1626
+ return `${l2}${i2 ? `${styleText2("gray", S_BAR)} ` : ""}${styleText2(
1627
+ "dim",
1628
+ `${this.selectedValues.length} items selected`
1629
+ )}`;
1630
+ case "cancel":
1631
+ return `${l2}${i2 ? `${styleText2("gray", S_BAR)} ` : ""}${styleText2(
1632
+ ["strikethrough", "dim"],
1633
+ o2
1634
+ )}`;
1635
+ default: {
1636
+ const a2 = this.state === "error" ? "yellow" : "cyan", u5 = i2 ? `${styleText2(a2, S_BAR)} ` : "", V2 = i2 ? styleText2(a2, S_BAR_END) : "", y = [
1637
+ `${styleText2("dim", "\u2191/\u2193")} to navigate`,
1638
+ `${styleText2("dim", this.isNavigating ? "Space/Tab:" : "Tab:")} select`,
1639
+ `${styleText2("dim", "Enter:")} confirm`,
1640
+ `${styleText2("dim", "Type:")} to search`
1641
+ ], b3 = this.filteredOptions.length === 0 && o2 ? [`${u5}${styleText2("yellow", "No matches found")}`] : [], v = this.state === "error" ? [`${u5}${styleText2("yellow", this.error)}`] : [], g2 = [
1642
+ ...`${l2}${i2 ? styleText2(a2, S_BAR) : ""}`.split(`
1643
+ `),
1644
+ `${u5}${styleText2("dim", "Search:")} ${$}${s}`,
1645
+ ...b3,
1646
+ ...v
1647
+ ], O = [`${u5}${y.join(" \u2022 ")}`, V2], d = limitOptions({
1648
+ cursor: this.cursor,
1649
+ options: this.filteredOptions,
1650
+ style: (f2, _2) => c3(f2, _2, this.selectedValues, this.focusedValue),
1651
+ maxItems: t2.maxItems,
1652
+ output: t2.output,
1653
+ rowPadding: g2.length + O.length
1654
+ });
1655
+ return [
1656
+ ...g2,
1657
+ ...d.map((f2) => `${u5}${f2}`),
1658
+ ...O
1659
+ ].join(`
1660
+ `);
1661
+ }
1662
+ }
1663
+ }
1664
+ });
1665
+ return n3.prompt();
1666
+ };
1667
+ var J = [
1668
+ S_CORNER_TOP_LEFT,
1669
+ S_CORNER_TOP_RIGHT,
1670
+ S_CORNER_BOTTOM_LEFT,
1671
+ S_CORNER_BOTTOM_RIGHT
1672
+ ];
1673
+ var K = [S_BAR_START, S_BAR_START_RIGHT, S_BAR_END, S_BAR_END_RIGHT];
1674
+ function A$1(n3, e, t2, o2) {
1675
+ let i2 = t2, f2 = t2;
1676
+ return o2 === "center" ? i2 = Math.floor((e - n3) / 2) : o2 === "right" && (i2 = e - n3 - t2), f2 = e - i2 - n3, [i2, f2];
1677
+ }
1678
+ var Q = (n3) => n3;
1679
+ var box = (n3 = "", e = "", t2) => {
1680
+ const o2 = t2?.output ?? process.stdout, i2 = getColumns(o2), R2 = 1 * 2, u5 = t2?.titlePadding ?? 1, h2 = t2?.contentPadding ?? 2, w = t2?.width === void 0 || t2.width === "auto" ? 1 : Math.min(1, t2.width), m3 = t2?.withGuide ?? settings.withGuide ? `${S_BAR} ` : "", b3 = t2?.formatBorder ?? Q, a2 = (t2?.rounded ? J : K).map(b3), _2 = b3(S_BAR_H), B = b3(S_BAR), p3 = dist_default2(m3), x2 = dist_default2(e), O = i2 - p3;
1681
+ let r2 = Math.floor(i2 * w) - p3;
1682
+ if (t2?.width === "auto") {
1683
+ const c3 = n3.split(`
1684
+ `);
1685
+ let s = x2 + u5 * 2;
1686
+ for (const G of c3) {
1687
+ const P3 = dist_default2(G) + h2 * 2;
1688
+ P3 > s && (s = P3);
1689
+ }
1690
+ const g2 = s + R2;
1691
+ g2 < r2 && (r2 = g2);
1692
+ }
1693
+ r2 % 2 !== 0 && (r2 < O ? r2++ : r2--);
1694
+ const d = r2 - R2, S = d - u5 * 2, T3 = x2 > S ? `${e.slice(0, S - 3)}...` : e, [y, W2] = A$1(
1695
+ dist_default2(T3),
1696
+ d,
1697
+ u5,
1698
+ t2?.titleAlign
1699
+ ), L = wrapAnsi(n3, d - h2 * 2, {
1700
+ hard: true,
1701
+ trim: false
1702
+ });
1703
+ o2.write(
1704
+ `${m3}${a2[0]}${_2.repeat(y)}${T3}${_2.repeat(W2)}${a2[1]}
1705
+ `
1706
+ );
1707
+ const E2 = L.split(`
1708
+ `);
1709
+ for (const c3 of E2) {
1710
+ const [s, g2] = A$1(
1711
+ dist_default2(c3),
1712
+ d,
1713
+ h2,
1714
+ t2?.contentAlign
1715
+ );
1716
+ o2.write(
1717
+ `${m3}${B}${" ".repeat(s)}${c3}${" ".repeat(g2)}${B}
1718
+ `
1719
+ );
1720
+ }
1721
+ o2.write(`${m3}${a2[2]}${_2.repeat(d)}${a2[3]}
1722
+ `);
1723
+ };
1724
+ var confirm = (i2) => {
1725
+ const a2 = i2.active ?? "Yes", s = i2.inactive ?? "No";
1726
+ return new r({
1727
+ active: a2,
1728
+ inactive: s,
1729
+ signal: i2.signal,
1730
+ input: i2.input,
1731
+ output: i2.output,
1732
+ initialValue: i2.initialValue ?? true,
1733
+ render() {
1734
+ const e = i2.withGuide ?? settings.withGuide, u5 = `${symbol(this.state)} `, l2 = e ? `${styleText2("gray", S_BAR)} ` : "", f2 = wrapTextWithPrefix(
1735
+ i2.output,
1736
+ i2.message,
1737
+ l2,
1738
+ u5
1739
+ ), o2 = `${e ? `${styleText2("gray", S_BAR)}
1740
+ ` : ""}${f2}
1741
+ `, c3 = this.value ? a2 : s;
1742
+ switch (this.state) {
1743
+ case "submit": {
1744
+ const r2 = e ? `${styleText2("gray", S_BAR)} ` : "";
1745
+ return `${o2}${r2}${styleText2("dim", c3)}`;
1746
+ }
1747
+ case "cancel": {
1748
+ const r2 = e ? `${styleText2("gray", S_BAR)} ` : "";
1749
+ return `${o2}${r2}${styleText2(["strikethrough", "dim"], c3)}${e ? `
1750
+ ${styleText2("gray", S_BAR)}` : ""}`;
1751
+ }
1752
+ default: {
1753
+ const r2 = e ? `${styleText2("cyan", S_BAR)} ` : "", g2 = e ? styleText2("cyan", S_BAR_END) : "";
1754
+ return `${o2}${r2}${this.value ? `${styleText2("green", S_RADIO_ACTIVE)} ${a2}` : `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", a2)}`}${i2.vertical ? e ? `
1755
+ ${styleText2("cyan", S_BAR)} ` : `
1756
+ ` : ` ${styleText2("dim", "/")} `}${this.value ? `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", s)}` : `${styleText2("green", S_RADIO_ACTIVE)} ${s}`}
1757
+ ${g2}
1758
+ `;
1759
+ }
1760
+ }
1761
+ }
1762
+ }).prompt();
1763
+ };
1764
+ var date = (e) => {
1765
+ const r2 = e.validate;
1766
+ return new U({
1767
+ ...e,
1768
+ validate(t2) {
1769
+ if (t2 === void 0)
1770
+ return e.defaultValue !== void 0 ? void 0 : r2 ? runValidation(r2, t2) : settings.date.messages.required;
1771
+ const o2 = (i2) => i2.toISOString().slice(0, 10);
1772
+ if (e.minDate && o2(t2) < o2(e.minDate))
1773
+ return settings.date.messages.afterMin(e.minDate);
1774
+ if (e.maxDate && o2(t2) > o2(e.maxDate))
1775
+ return settings.date.messages.beforeMax(e.maxDate);
1776
+ if (r2) return runValidation(r2, t2);
1777
+ },
1778
+ render() {
1779
+ const t2 = (e?.withGuide ?? settings.withGuide) !== false, i2 = `${`${t2 ? `${styleText2("gray", S_BAR)}
1780
+ ` : ""}${symbol(this.state)} `}${e.message}
1781
+ `, l2 = this.state !== "initial" ? this.state : "active", d = b2(this, l2), c3 = this.value instanceof Date ? this.formattedValue : "";
1782
+ switch (this.state) {
1783
+ case "error": {
1784
+ const a2 = this.error ? ` ${styleText2("yellow", this.error)}` : "", s = t2 ? `${styleText2("yellow", S_BAR)} ` : "", f2 = t2 ? styleText2("yellow", S_BAR_END) : "";
1785
+ return `${i2.trim()}
1786
+ ${s}${d}
1787
+ ${f2}${a2}
1788
+ `;
1789
+ }
1790
+ case "submit": {
1791
+ const a2 = c3 ? ` ${styleText2("dim", c3)}` : "", s = t2 ? styleText2("gray", S_BAR) : "";
1792
+ return `${i2}${s}${a2}`;
1793
+ }
1794
+ case "cancel": {
1795
+ const a2 = c3 ? ` ${styleText2(["strikethrough", "dim"], c3)}` : "", s = t2 ? styleText2("gray", S_BAR) : "";
1796
+ return `${i2}${s}${a2}${c3.trim() ? `
1797
+ ${s}` : ""}`;
1798
+ }
1799
+ default: {
1800
+ const a2 = t2 ? `${styleText2("cyan", S_BAR)} ` : "", s = t2 ? styleText2("cyan", S_BAR_END) : "", f2 = t2 ? `${styleText2("cyan", S_BAR)} ` : "", g2 = this.inlineError ? `
1801
+ ${f2}${styleText2("yellow", this.inlineError)}` : "";
1802
+ return `${i2}${a2}${d}${g2}
1803
+ ${s}
1804
+ `;
1805
+ }
1806
+ }
1807
+ }
1808
+ }).prompt();
1809
+ };
1810
+ function b2(e, r2) {
1811
+ const t2 = e.segmentValues, o2 = e.segmentCursor;
1812
+ if (r2 === "submit" || r2 === "cancel")
1813
+ return e.formattedValue;
1814
+ const i2 = styleText2("gray", e.separator);
1815
+ return e.segments.map((l2, d) => {
1816
+ const c3 = d === o2.segmentIndex && !["submit", "cancel"].includes(r2), a2 = p2[l2.type];
1817
+ return x(t2[l2.type], { isActive: c3, label: a2 });
1818
+ }).join(i2);
1819
+ }
1820
+ function x(e, r2) {
1821
+ const t2 = !e || e.replace(/_/g, "") === "";
1822
+ return r2.isActive ? styleText2("inverse", t2 ? r2.label : e.replace(/_/g, " ")) : t2 ? styleText2("dim", r2.label) : e.replace(/_/g, styleText2("dim", " "));
1823
+ }
1824
+ var p2 = {
1825
+ year: "yyyy",
1826
+ month: "mm",
1827
+ day: "dd"
1828
+ };
1829
+ var group = async (o2, r2) => {
1830
+ const t2 = {}, p3 = Object.keys(o2);
1831
+ for (const e of p3) {
1832
+ const i2 = o2[e], n3 = await i2({ results: t2 })?.catch((a2) => {
1833
+ throw a2;
1834
+ });
1835
+ if (typeof r2?.onCancel == "function" && isCancel(n3)) {
1836
+ t2[e] = "canceled", r2.onCancel({ results: t2 });
1837
+ continue;
1838
+ }
1839
+ t2[e] = n3;
1840
+ }
1841
+ return t2;
1842
+ };
1843
+ var MULTISELECT_INSTRUCTIONS = [
1844
+ `${styleText2("dim", "\u2191/\u2193")} to navigate`,
1845
+ `${styleText2("dim", "Space:")} select`,
1846
+ `${styleText2("dim", "Enter:")} confirm`
1847
+ ];
1848
+ var m2 = (i2, u5) => i2.split(`
1849
+ `).map((d) => u5(d)).join(`
1850
+ `);
1851
+ var multiselect = (i2) => {
1852
+ const u5 = (t2, a2) => {
1853
+ const r2 = t2.label ?? String(t2.value);
1854
+ return a2 === "disabled" ? `${styleText2("gray", S_CHECKBOX_INACTIVE)} ${m2(r2, (o2) => styleText2(["strikethrough", "gray"], o2))}${t2.hint ? ` ${styleText2("dim", `(${t2.hint ?? "disabled"})`)}` : ""}` : a2 === "active" ? `${styleText2("cyan", S_CHECKBOX_ACTIVE)} ${r2}${t2.hint ? ` ${styleText2("dim", `(${t2.hint})`)}` : ""}` : a2 === "selected" ? `${styleText2("green", S_CHECKBOX_SELECTED)} ${m2(r2, (o2) => styleText2("dim", o2))}${t2.hint ? ` ${styleText2("dim", `(${t2.hint})`)}` : ""}` : a2 === "cancelled" ? `${m2(r2, (o2) => styleText2(["strikethrough", "dim"], o2))}` : a2 === "active-selected" ? `${styleText2("green", S_CHECKBOX_SELECTED)} ${r2}${t2.hint ? ` ${styleText2("dim", `(${t2.hint})`)}` : ""}` : a2 === "submitted" ? `${m2(r2, (o2) => styleText2("dim", o2))}` : `${styleText2("dim", S_CHECKBOX_INACTIVE)} ${m2(r2, (o2) => styleText2("dim", o2))}`;
1855
+ }, d = i2.required ?? true, v = i2.showInstructions ?? true;
1856
+ return new a({
1857
+ options: i2.options,
1858
+ signal: i2.signal,
1859
+ input: i2.input,
1860
+ output: i2.output,
1861
+ initialValues: i2.initialValues,
1862
+ required: d,
1863
+ cursorAt: i2.cursorAt,
1864
+ validate(t2) {
1865
+ if (d && (t2 === void 0 || t2.length === 0))
1866
+ return `Please select at least one option.
1867
+ ${styleText2(
1868
+ "reset",
1869
+ styleText2(
1870
+ "dim",
1871
+ `Press ${styleText2(["gray", "bgWhite", "inverse"], " space ")} to select, ${styleText2(
1872
+ "gray",
1873
+ styleText2("bgWhite", styleText2("inverse", " enter "))
1874
+ )} to submit`
1875
+ )
1876
+ )}`;
1877
+ },
1878
+ render() {
1879
+ const t2 = i2.withGuide ?? settings.withGuide, a2 = wrapTextWithPrefix(
1880
+ i2.output,
1881
+ i2.message,
1882
+ t2 ? `${symbolBar(this.state)} ` : "",
1883
+ `${symbol(this.state)} `
1884
+ ), r2 = `${t2 ? `${styleText2("gray", S_BAR)}
1885
+ ` : ""}${a2}
1886
+ `, o2 = this.value ?? [], p3 = (n3, l2) => {
1887
+ if (n3.disabled)
1888
+ return u5(n3, "disabled");
1889
+ const s = o2.includes(n3.value);
1890
+ return l2 && s ? u5(n3, "active-selected") : s ? u5(n3, "selected") : u5(n3, l2 ? "active" : "inactive");
1891
+ };
1892
+ switch (this.state) {
1893
+ case "submit": {
1894
+ const n3 = this.options.filter(({ value: s }) => o2.includes(s)).map((s) => u5(s, "submitted")).join(styleText2("dim", ", ")) || styleText2("dim", "none"), l2 = wrapTextWithPrefix(
1895
+ i2.output,
1896
+ n3,
1897
+ t2 ? `${styleText2("gray", S_BAR)} ` : ""
1898
+ );
1899
+ return `${r2}${l2}`;
1900
+ }
1901
+ case "cancel": {
1902
+ const n3 = this.options.filter(({ value: s }) => o2.includes(s)).map((s) => u5(s, "cancelled")).join(styleText2("dim", ", "));
1903
+ if (n3.trim() === "")
1904
+ return `${r2}${styleText2("gray", S_BAR)}`;
1905
+ const l2 = wrapTextWithPrefix(
1906
+ i2.output,
1907
+ n3,
1908
+ t2 ? `${styleText2("gray", S_BAR)} ` : ""
1909
+ );
1910
+ return `${r2}${l2}${t2 ? `
1911
+ ${styleText2("gray", S_BAR)}` : ""}`;
1912
+ }
1913
+ case "error": {
1914
+ const n3 = t2 ? `${styleText2("yellow", S_BAR)} ` : "", l2 = this.error.split(`
1915
+ `).map(
1916
+ ($, C3) => C3 === 0 ? `${t2 ? `${styleText2("yellow", S_BAR_END)} ` : ""}${styleText2("yellow", $)}` : ` ${$}`
1917
+ ).join(`
1918
+ `), s = r2.split(`
1919
+ `).length, h2 = l2.split(`
1920
+ `).length + 1;
1921
+ return `${r2}${n3}${limitOptions({
1922
+ output: i2.output,
1923
+ options: this.options,
1924
+ cursor: this.cursor,
1925
+ maxItems: i2.maxItems,
1926
+ columnPadding: n3.length,
1927
+ rowPadding: s + h2,
1928
+ style: p3
1929
+ }).join(`
1930
+ ${n3}`)}
1931
+ ${l2}
1932
+ `;
1933
+ }
1934
+ default: {
1935
+ const n3 = t2 ? `${styleText2("cyan", S_BAR)} ` : "", l2 = r2.split(`
1936
+ `).length, s = v ? formatInstructionFooter(MULTISELECT_INSTRUCTIONS, t2) : t2 ? [styleText2("cyan", S_BAR_END)] : [], h2 = s.join(`
1937
+ `), $ = s.length + 1;
1938
+ return `${r2}${n3}${limitOptions({
1939
+ output: i2.output,
1940
+ options: this.options,
1941
+ cursor: this.cursor,
1942
+ maxItems: i2.maxItems,
1943
+ columnPadding: n3.length,
1944
+ rowPadding: l2 + $,
1945
+ style: p3
1946
+ }).join(`
1947
+ ${n3}`)}
1948
+ ${h2}
1949
+ `;
1950
+ }
1951
+ }
1952
+ }
1953
+ }).prompt();
1954
+ };
1955
+ var groupMultiselect = (o2) => {
1956
+ const { selectableGroups: h2 = true, groupSpacing: x2 = 0 } = o2, m3 = (n3, l2, g2 = []) => {
1957
+ const a2 = n3.label ?? String(n3.value), t2 = typeof n3.group == "string", s = t2 && (g2[g2.indexOf(n3) + 1] ?? { group: true }), u5 = t2 && s && s.group === true;
1958
+ let r2 = "", c3 = "";
1959
+ t2 && (h2 ? (r2 = u5 ? `${S_BAR_END} ` : `${S_BAR} `, c3 = u5 ? " " : `${S_BAR} `) : r2 = " ");
1960
+ let i2 = "";
1961
+ if (x2 > 0 && !t2 && (i2 = `
1962
+ `.repeat(x2)), l2 === "active")
1963
+ return wrapTextWithPrefix(
1964
+ o2.output,
1965
+ `${a2}${n3.hint ? ` ${styleText2("dim", `(${n3.hint})`)}` : ""}`,
1966
+ `${i2}${styleText2("dim", r2)} `,
1967
+ `${i2}${styleText2("dim", r2)}${styleText2("cyan", S_CHECKBOX_ACTIVE)} `,
1968
+ `${i2}${styleText2("dim", c3)} `
1969
+ );
1970
+ if (l2 === "group-active")
1971
+ return wrapTextWithPrefix(
1972
+ o2.output,
1973
+ a2,
1974
+ `${i2}${r2} `,
1975
+ `${i2}${r2}${styleText2("cyan", S_CHECKBOX_ACTIVE)} `,
1976
+ `${i2}${c3} `,
1977
+ (d) => styleText2("dim", d)
1978
+ );
1979
+ if (l2 === "group-active-selected")
1980
+ return wrapTextWithPrefix(
1981
+ o2.output,
1982
+ a2,
1983
+ `${i2}${r2} `,
1984
+ `${i2}${r2}${styleText2("green", S_CHECKBOX_SELECTED)} `,
1985
+ `${i2}${c3} `,
1986
+ (d) => styleText2("dim", d)
1987
+ );
1988
+ if (l2 === "selected") {
1989
+ const d = t2 || h2 ? styleText2("green", S_CHECKBOX_SELECTED) : "";
1990
+ return wrapTextWithPrefix(
1991
+ o2.output,
1992
+ `${a2}${n3.hint ? ` (${n3.hint})` : ""}`,
1993
+ `${i2}${styleText2("dim", r2)} `,
1994
+ `${i2}${styleText2("dim", r2)}${d} `,
1995
+ `${i2}${styleText2("dim", c3)} `,
1996
+ (S) => styleText2("dim", S)
1997
+ );
1998
+ }
1999
+ if (l2 === "cancelled")
2000
+ return `${styleText2(["strikethrough", "dim"], a2)}`;
2001
+ if (l2 === "active-selected")
2002
+ return wrapTextWithPrefix(
2003
+ o2.output,
2004
+ `${a2}${n3.hint ? ` ${styleText2("dim", `(${n3.hint})`)}` : ""}`,
2005
+ `${i2}${styleText2("dim", r2)} `,
2006
+ `${i2}${styleText2("dim", r2)}${styleText2("green", S_CHECKBOX_SELECTED)} `,
2007
+ `${i2}${styleText2("dim", c3)} `
2008
+ );
2009
+ if (l2 === "submitted")
2010
+ return `${styleText2("dim", a2)}`;
2011
+ const f2 = t2 || h2 ? styleText2("dim", S_CHECKBOX_INACTIVE) : "";
2012
+ return wrapTextWithPrefix(
2013
+ o2.output,
2014
+ a2,
2015
+ `${i2}${styleText2("dim", r2)} `,
2016
+ `${i2}${styleText2("dim", r2)}${f2} `,
2017
+ `${i2}${styleText2("dim", c3)} `,
2018
+ (d) => styleText2("dim", d)
2019
+ );
2020
+ }, y = o2.required ?? true, I2 = o2.showInstructions ?? true;
2021
+ return new u$2({
2022
+ options: o2.options,
2023
+ signal: o2.signal,
2024
+ input: o2.input,
2025
+ output: o2.output,
2026
+ initialValues: o2.initialValues,
2027
+ required: y,
2028
+ cursorAt: o2.cursorAt,
2029
+ selectableGroups: h2,
2030
+ validate(n3) {
2031
+ if (y && (n3 === void 0 || n3.length === 0))
2032
+ return `Please select at least one option.
2033
+ ${styleText2(
2034
+ "reset",
2035
+ styleText2(
2036
+ "dim",
2037
+ `Press ${styleText2(["gray", "bgWhite", "inverse"], " space ")} to select, ${styleText2(
2038
+ "gray",
2039
+ styleText2(["bgWhite", "inverse"], " enter ")
2040
+ )} to submit`
2041
+ )
2042
+ )}`;
2043
+ },
2044
+ render() {
2045
+ const n3 = o2.withGuide ?? settings.withGuide, l2 = `${n3 ? `${styleText2("gray", S_BAR)}
2046
+ ` : ""}${symbol(this.state)} ${o2.message}
2047
+ `, g2 = this.value ?? [], a2 = (t2, s) => {
2048
+ const u5 = this.options, r2 = g2.includes(t2.value) || t2.group === true && this.isGroupSelected(`${t2.value}`);
2049
+ return !s && typeof t2.group == "string" && this.options[this.cursor]?.value === t2.group ? m3(t2, r2 ? "group-active-selected" : "group-active", u5) : s && r2 ? m3(t2, "active-selected", u5) : r2 ? m3(t2, "selected", u5) : m3(t2, s ? "active" : "inactive", u5);
2050
+ };
2051
+ switch (this.state) {
2052
+ case "submit": {
2053
+ const t2 = this.options.filter(({ value: u5 }) => g2.includes(u5)).map((u5) => m3(u5, "submitted")), s = t2.length === 0 ? "" : ` ${t2.join(styleText2("dim", ", "))}`;
2054
+ return `${l2}${n3 ? styleText2("gray", S_BAR) : ""}${s}`;
2055
+ }
2056
+ case "cancel": {
2057
+ const t2 = this.options.filter(({ value: s }) => g2.includes(s)).map((s) => m3(s, "cancelled")).join(styleText2("dim", ", "));
2058
+ return `${l2}${n3 ? `${styleText2("gray", S_BAR)} ` : ""}${t2.trim() ? `${t2}${n3 ? `
2059
+ ${styleText2("gray", S_BAR)}` : ""}` : ""}`;
2060
+ }
2061
+ case "error": {
2062
+ const t2 = n3 ? `${styleText2("yellow", S_BAR)} ` : "", s = this.error.split(`
2063
+ `).map(
2064
+ (i2, f2) => f2 === 0 ? `${n3 ? `${styleText2("yellow", S_BAR_END)} ` : ""}${styleText2("yellow", i2)}` : ` ${i2}`
2065
+ ).join(`
2066
+ `), u5 = l2.split(`
2067
+ `).length, r2 = s.split(`
2068
+ `).length + 1, c3 = limitOptions({
2069
+ output: o2.output,
2070
+ options: this.options,
2071
+ cursor: this.cursor,
2072
+ maxItems: o2.maxItems,
2073
+ columnPadding: t2.length,
2074
+ rowPadding: u5 + r2,
2075
+ style: a2
2076
+ }).join(`
2077
+ ${t2}`);
2078
+ return `${l2}${t2}${c3}
2079
+ ${s}
2080
+ `;
2081
+ }
2082
+ default: {
2083
+ const t2 = n3 ? `${styleText2("cyan", S_BAR)} ` : "", s = l2.split(`
2084
+ `).length, u5 = I2 ? formatInstructionFooter(MULTISELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], r2 = u5.join(`
2085
+ `), c3 = u5.length + 1, i2 = limitOptions({
2086
+ output: o2.output,
2087
+ options: this.options,
2088
+ cursor: this.cursor,
2089
+ maxItems: o2.maxItems,
2090
+ columnPadding: t2.length,
2091
+ rowPadding: s + c3,
2092
+ style: a2
2093
+ }).join(`
2094
+ ${t2}`);
2095
+ return `${l2}${t2}${i2}
2096
+ ${r2}
2097
+ `;
2098
+ }
2099
+ }
2100
+ }
2101
+ }).prompt();
2102
+ };
2103
+ var log = {
2104
+ message: (s = [], {
2105
+ symbol: e = styleText2("gray", S_BAR),
2106
+ secondarySymbol: r2 = styleText2("gray", S_BAR),
2107
+ output: m3 = process.stdout,
2108
+ spacing: l2 = 1,
2109
+ withGuide: c3
2110
+ } = {}) => {
2111
+ const t2 = [], o2 = c3 ?? settings.withGuide, f2 = o2 ? r2 : "", O = o2 ? `${e} ` : "", u5 = o2 ? `${r2} ` : "";
2112
+ for (let i2 = 0; i2 < l2; i2++)
2113
+ t2.push(f2);
2114
+ const g2 = Array.isArray(s) ? s : s.split(`
2115
+ `);
2116
+ if (g2.length > 0) {
2117
+ const [i2, ...y] = g2;
2118
+ i2.length > 0 ? t2.push(`${O}${i2}`) : t2.push(o2 ? e : "");
2119
+ for (const p3 of y)
2120
+ p3.length > 0 ? t2.push(`${u5}${p3}`) : t2.push(o2 ? r2 : "");
2121
+ }
2122
+ m3.write(`${t2.join(`
2123
+ `)}
2124
+ `);
2125
+ },
2126
+ info: (s, e) => {
2127
+ log.message(s, { ...e, symbol: styleText2("blue", S_INFO) });
2128
+ },
2129
+ success: (s, e) => {
2130
+ log.message(s, { ...e, symbol: styleText2("green", S_SUCCESS) });
2131
+ },
2132
+ step: (s, e) => {
2133
+ log.message(s, { ...e, symbol: styleText2("green", S_STEP_SUBMIT) });
2134
+ },
2135
+ warn: (s, e) => {
2136
+ log.message(s, { ...e, symbol: styleText2("yellow", S_WARN) });
2137
+ },
2138
+ /** alias for `log.warn()`. */
2139
+ warning: (s, e) => {
2140
+ log.warn(s, e);
2141
+ },
2142
+ error: (s, e) => {
2143
+ log.message(s, { ...e, symbol: styleText2("red", S_ERROR) });
2144
+ }
2145
+ };
2146
+ var cancel = (o2 = "", t2) => {
2147
+ const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_END)} ` : "";
2148
+ i2.write(`${e}${styleText2("red", o2)}
2149
+
2150
+ `);
2151
+ };
2152
+ var intro = (o2 = "", t2) => {
2153
+ const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_START)} ` : "";
2154
+ i2.write(`${e}${o2}
2155
+ `);
2156
+ };
2157
+ var outro = (o2 = "", t2) => {
2158
+ const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR)}
2159
+ ${styleText2("gray", S_BAR_END)} ` : "";
2160
+ i2.write(`${e}${o2}
2161
+
2162
+ `);
2163
+ };
2164
+ var multiline = (e) => new h({
2165
+ validate: e.validate,
2166
+ placeholder: e.placeholder,
2167
+ defaultValue: e.defaultValue,
2168
+ initialValue: e.initialValue,
2169
+ showSubmit: e.showSubmit,
2170
+ output: e.output,
2171
+ signal: e.signal,
2172
+ input: e.input,
2173
+ render() {
2174
+ const i2 = e?.withGuide ?? settings.withGuide, o2 = `${`${i2 ? `${styleText2("gray", S_BAR)}
2175
+ ` : ""}${symbol(this.state)} `}${e.message}
2176
+ `, m3 = e.placeholder && e.placeholder.length > 0 ? (
2177
+ // biome-ignore lint/style/noNonNullAssertion: guarded by placeholder.length > 0
2178
+ styleText2("inverse", e.placeholder[0]) + styleText2("dim", e.placeholder.slice(1))
2179
+ ) : styleText2(["inverse", "hidden"], "_"), a2 = this.userInput ? this.userInputWithCursor : m3, l2 = this.value ?? "", c3 = e.showSubmit ? `
2180
+ ${styleText2(this.focused === "submit" ? "cyan" : "dim", "[ submit ]")}` : "";
2181
+ switch (this.state) {
2182
+ case "error": {
2183
+ const n3 = `${styleText2("yellow", S_BAR)} `, r2 = i2 ? wrapTextWithPrefix(e.output, a2, n3, void 0) : a2, u5 = styleText2("yellow", S_BAR_END);
2184
+ return `${o2}${r2}
2185
+ ${u5} ${styleText2("yellow", this.error)}${c3}
2186
+ `;
2187
+ }
2188
+ case "submit": {
2189
+ const n3 = `${styleText2("gray", S_BAR)} `, r2 = i2 ? wrapTextWithPrefix(
2190
+ e.output,
2191
+ l2,
2192
+ n3,
2193
+ void 0,
2194
+ void 0,
2195
+ (u5) => styleText2("dim", u5)
2196
+ ) : l2 ? styleText2("dim", l2) : "";
2197
+ return `${o2}${r2}`;
2198
+ }
2199
+ case "cancel": {
2200
+ const n3 = `${styleText2("gray", S_BAR)} `, r2 = i2 ? wrapTextWithPrefix(
2201
+ e.output,
2202
+ l2,
2203
+ n3,
2204
+ void 0,
2205
+ void 0,
2206
+ (u5) => styleText2(["strikethrough", "dim"], u5)
2207
+ ) : l2 ? styleText2(["strikethrough", "dim"], l2) : "";
2208
+ return `${o2}${r2}`;
2209
+ }
2210
+ default: {
2211
+ const n3 = i2 ? `${styleText2("cyan", S_BAR)} ` : "", r2 = i2 ? styleText2("cyan", S_BAR_END) : "", u5 = i2 ? wrapTextWithPrefix(e.output, a2, n3) : a2;
2212
+ return `${o2}${u5}
2213
+ ${r2}${c3}
2214
+ `;
2215
+ }
2216
+ }
2217
+ }
2218
+ }).prompt();
2219
+ var W$1 = (o2) => o2;
2220
+ var C2 = (o2, e, s) => {
2221
+ const a2 = {
2222
+ hard: true,
2223
+ trim: false
2224
+ }, i2 = wrapAnsi(o2, e, a2).split(`
2225
+ `), c3 = i2.reduce((n3, t2) => Math.max(dist_default2(t2), n3), 0), u5 = i2.map(s).reduce((n3, t2) => Math.max(dist_default2(t2), n3), 0), g2 = e - (u5 - c3);
2226
+ return wrapAnsi(o2, g2, a2);
2227
+ };
2228
+ var note = (o2 = "", e = "", s) => {
2229
+ const a2 = s?.output ?? process$1.stdout, i2 = s?.withGuide ?? settings.withGuide, c3 = s?.format ?? W$1, g2 = ["", ...C2(o2, getColumns(a2) - 6, c3).split(`
2230
+ `).map(c3), ""], n3 = dist_default2(e), t2 = Math.max(
2231
+ g2.reduce((m3, F) => {
2232
+ const O = dist_default2(F);
2233
+ return O > m3 ? O : m3;
2234
+ }, 0),
2235
+ n3
2236
+ ) + 2, h2 = g2.map(
2237
+ (m3) => `${styleText2("gray", S_BAR)} ${m3}${" ".repeat(t2 - dist_default2(m3))}${styleText2("gray", S_BAR)}`
2238
+ ).join(`
2239
+ `), T3 = i2 ? `${styleText2("gray", S_BAR)}
2240
+ ` : "", l$1 = i2 ? S_CONNECT_LEFT : S_CORNER_BOTTOM_LEFT;
2241
+ a2.write(
2242
+ `${T3}${styleText2("green", S_STEP_SUBMIT)} ${styleText2("reset", e)} ${styleText2(
2243
+ "gray",
2244
+ S_BAR_H.repeat(Math.max(t2 - n3 - 1, 1)) + S_CORNER_TOP_RIGHT
2245
+ )}
2246
+ ${h2}
2247
+ ${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
2248
+ `
2249
+ );
2250
+ };
2251
+ var password = (r2) => new u$1({
2252
+ validate: r2.validate,
2253
+ mask: r2.mask ?? S_PASSWORD_MASK,
2254
+ signal: r2.signal,
2255
+ input: r2.input,
2256
+ output: r2.output,
2257
+ render() {
2258
+ const e = r2.withGuide ?? settings.withGuide, o2 = `${e ? `${styleText2("gray", S_BAR)}
2259
+ ` : ""}${symbol(this.state)} ${r2.message}
2260
+ `, c3 = this.userInputWithCursor, i2 = this.masked;
2261
+ switch (this.state) {
2262
+ case "error": {
2263
+ const s = e ? `${styleText2("yellow", S_BAR)} ` : "", n3 = e ? `${styleText2("yellow", S_BAR_END)} ` : "", l2 = i2 ?? "";
2264
+ return r2.clearOnError && this.clear(), `${o2.trim()}
2265
+ ${s}${l2}
2266
+ ${n3}${styleText2("yellow", this.error)}
2267
+ `;
2268
+ }
2269
+ case "submit": {
2270
+ const s = e ? `${styleText2("gray", S_BAR)} ` : "", n3 = i2 ? styleText2("dim", i2) : "";
2271
+ return `${o2}${s}${n3}`;
2272
+ }
2273
+ case "cancel": {
2274
+ const s = e ? `${styleText2("gray", S_BAR)} ` : "", n3 = i2 ? styleText2(["strikethrough", "dim"], i2) : "";
2275
+ return `${o2}${s}${n3}${i2 && e ? `
2276
+ ${styleText2("gray", S_BAR)}` : ""}`;
2277
+ }
2278
+ default: {
2279
+ const s = e ? `${styleText2("cyan", S_BAR)} ` : "", n3 = e ? styleText2("cyan", S_BAR_END) : "";
2280
+ return `${o2}${s}${c3}
2281
+ ${n3}
2282
+ `;
2283
+ }
2284
+ }
2285
+ }
2286
+ }).prompt();
2287
+ var path = (e) => {
2288
+ const a2 = e.validate;
2289
+ return autocomplete({
2290
+ ...e,
2291
+ initialUserInput: e.initialValue ?? e.root ?? process.cwd(),
2292
+ maxItems: 5,
2293
+ validate(t2) {
2294
+ if (!Array.isArray(t2)) {
2295
+ if (!t2)
2296
+ return "Please select a path";
2297
+ if (a2)
2298
+ return runValidation(a2, t2);
2299
+ }
2300
+ },
2301
+ options() {
2302
+ const t2 = this.userInput;
2303
+ if (t2 === "")
2304
+ return [];
2305
+ try {
2306
+ let i2;
2307
+ existsSync(t2) ? lstatSync(t2).isDirectory() && (!e.directory || t2.endsWith("/")) ? i2 = t2 : i2 = dirname(t2) : i2 = dirname(t2);
2308
+ const c3 = t2.length > 1 && t2.endsWith("/") ? t2.slice(0, -1) : t2;
2309
+ return readdirSync(i2).map((r2) => {
2310
+ const n3 = join(i2, r2), m3 = lstatSync(n3);
2311
+ return {
2312
+ name: r2,
2313
+ path: n3,
2314
+ isDirectory: m3.isDirectory()
2315
+ };
2316
+ }).filter(
2317
+ ({ path: r2, isDirectory: n3 }) => r2.startsWith(c3) && (n3 || !e.directory)
2318
+ ).map((r2) => ({
2319
+ value: r2.path
2320
+ }));
2321
+ } catch {
2322
+ return [];
2323
+ }
2324
+ }
2325
+ });
2326
+ };
2327
+ var W = (l2) => styleText2("magenta", l2);
2328
+ var spinner = ({
2329
+ indicator: l2 = "dots",
2330
+ onCancel: h2,
2331
+ output: n3 = process.stdout,
2332
+ cancelMessage: G,
2333
+ errorMessage: O,
2334
+ frames: E2 = unicode ? ["\u25D2", "\u25D0", "\u25D3", "\u25D1"] : ["\u2022", "o", "O", "0"],
2335
+ delay: F = unicode ? 80 : 120,
2336
+ signal: m3,
2337
+ ...I2
2338
+ } = {}) => {
2339
+ const u5 = isCI();
2340
+ let M2, T3, d = false, S = false, s = "", p3, w = performance.now();
2341
+ const x2 = getColumns(n3), k = I2?.styleFrame ?? W, g2 = (e) => {
2342
+ const r2 = e > 1 ? O ?? settings.messages.error : G ?? settings.messages.cancel;
2343
+ S = e === 1, d && (a2(r2, e), S && typeof h2 == "function" && h2());
2344
+ }, f2 = () => g2(2), i2 = () => g2(1), A2 = () => {
2345
+ process.on("uncaughtExceptionMonitor", f2), process.on("unhandledRejection", f2), process.on("SIGINT", i2), process.on("SIGTERM", i2), process.on("exit", g2), m3 && m3.addEventListener("abort", i2);
2346
+ }, H = () => {
2347
+ process.removeListener("uncaughtExceptionMonitor", f2), process.removeListener("unhandledRejection", f2), process.removeListener("SIGINT", i2), process.removeListener("SIGTERM", i2), process.removeListener("exit", g2), m3 && m3.removeEventListener("abort", i2);
2348
+ }, y = () => {
2349
+ if (p3 === void 0) return;
2350
+ u5 && n3.write(`
2351
+ `);
2352
+ const r2 = wrapAnsi(p3, x2, {
2353
+ hard: true,
2354
+ trim: false
2355
+ }).split(`
2356
+ `);
2357
+ r2.length > 1 && n3.write(import_sisteransi2.cursor.up(r2.length - 1)), n3.write(import_sisteransi2.cursor.to(0)), n3.write(import_sisteransi2.erase.down());
2358
+ }, C3 = (e) => e.replace(/\.+$/, ""), _2 = (e) => {
2359
+ const r2 = (performance.now() - e) / 1e3, t2 = Math.floor(r2 / 60), o2 = Math.floor(r2 % 60);
2360
+ return t2 > 0 ? `[${t2}m ${o2}s]` : `[${o2}s]`;
2361
+ }, N2 = I2.withGuide ?? settings.withGuide, P3 = (e = "") => {
2362
+ d = true, M2 = block({ output: n3 }), s = C3(e), w = performance.now(), N2 && n3.write(`${styleText2("gray", S_BAR)}
2363
+ `);
2364
+ let r2 = 0, t2 = 0;
2365
+ A2(), T3 = setInterval(() => {
2366
+ if (u5 && s === p3)
2367
+ return;
2368
+ y(), p3 = s;
2369
+ const o2 = k(E2[r2]);
2370
+ let v;
2371
+ if (u5)
2372
+ v = `${o2} ${s}...`;
2373
+ else if (l2 === "timer")
2374
+ v = `${o2} ${s} ${_2(w)}`;
2375
+ else {
2376
+ const B = ".".repeat(Math.floor(t2)).slice(0, 3);
2377
+ v = `${o2} ${s}${B}`;
2378
+ }
2379
+ const j = wrapAnsi(v, x2, {
2380
+ hard: true,
2381
+ trim: false
2382
+ });
2383
+ n3.write(j), r2 = r2 + 1 < E2.length ? r2 + 1 : 0, t2 = t2 < 4 ? t2 + 0.125 : 0;
2384
+ }, F);
2385
+ }, a2 = (e = "", r2 = 0, t2 = false) => {
2386
+ if (!d) return;
2387
+ d = false, clearInterval(T3), y();
2388
+ const o2 = r2 === 0 ? styleText2("green", S_STEP_SUBMIT) : r2 === 1 ? styleText2("red", S_STEP_CANCEL) : styleText2("red", S_STEP_ERROR);
2389
+ s = e ?? s, t2 || (l2 === "timer" ? n3.write(`${o2} ${s} ${_2(w)}
2390
+ `) : n3.write(`${o2} ${s}
2391
+ `)), H(), M2();
2392
+ };
2393
+ return {
2394
+ start: P3,
2395
+ stop: (e = "") => a2(e, 0),
2396
+ message: (e = "") => {
2397
+ s = C3(e ?? s);
2398
+ },
2399
+ cancel: (e = "") => a2(e, 1),
2400
+ error: (e = "") => a2(e, 2),
2401
+ clear: () => a2("", 0, true),
2402
+ get isCancelled() {
2403
+ return S;
2404
+ }
2405
+ };
2406
+ };
2407
+ var u4 = {
2408
+ light: unicodeOr("\u2500", "-"),
2409
+ heavy: unicodeOr("\u2501", "="),
2410
+ block: unicodeOr("\u2588", "#")
2411
+ };
2412
+ function progress({
2413
+ style: o2 = "heavy",
2414
+ max: d = 100,
2415
+ size: v = 40,
2416
+ ...x2
2417
+ } = {}) {
2418
+ const r2 = spinner(x2);
2419
+ let a2 = 0, n3 = "";
2420
+ const c3 = Math.max(1, d), l2 = Math.max(1, v), S = (t2) => {
2421
+ switch (t2) {
2422
+ case "initial":
2423
+ case "active":
2424
+ return (e) => styleText2("magenta", e);
2425
+ case "error":
2426
+ case "cancel":
2427
+ return (e) => styleText2("red", e);
2428
+ case "submit":
2429
+ return (e) => styleText2("green", e);
2430
+ default:
2431
+ return (e) => styleText2("magenta", e);
2432
+ }
2433
+ }, p3 = (t2, e) => {
2434
+ const m3 = Math.floor(a2 / c3 * l2);
2435
+ return `${S(t2)(u4[o2].repeat(m3))}${styleText2("dim", u4[o2].repeat(l2 - m3))} ${e}`;
2436
+ }, h2 = (t2 = "") => {
2437
+ n3 = t2, r2.start(p3("initial", t2));
2438
+ }, g2 = (t2 = 1, e) => {
2439
+ a2 = Math.min(c3, t2 + a2), r2.message(p3("active", e ?? n3)), n3 = e ?? n3;
2440
+ };
2441
+ return {
2442
+ start: h2,
2443
+ stop: r2.stop,
2444
+ cancel: r2.cancel,
2445
+ error: r2.error,
2446
+ clear: r2.clear,
2447
+ advance: g2,
2448
+ isCancelled: r2.isCancelled,
2449
+ message: (t2) => g2(0, t2)
2450
+ };
2451
+ }
2452
+ var SELECT_INSTRUCTIONS = [
2453
+ `${styleText2("dim", "\u2191/\u2193")} to navigate`,
2454
+ `${styleText2("dim", "Enter:")} confirm`
2455
+ ];
2456
+ var c2 = (t2, o2) => t2.includes(`
2457
+ `) ? t2.split(`
2458
+ `).map((d) => o2(d)).join(`
2459
+ `) : o2(t2);
2460
+ var select = (t2) => {
2461
+ const o2 = (n3, m3) => {
2462
+ if (n3 === void 0)
2463
+ return "";
2464
+ const s = n3.label ?? String(n3.value);
2465
+ switch (m3) {
2466
+ case "disabled":
2467
+ return `${styleText2("gray", S_RADIO_INACTIVE)} ${c2(s, (i2) => styleText2("gray", i2))}${n3.hint ? ` ${styleText2("dim", `(${n3.hint ?? "disabled"})`)}` : ""}`;
2468
+ case "selected":
2469
+ return `${c2(s, (i2) => styleText2("dim", i2))}`;
2470
+ case "active":
2471
+ return `${styleText2("green", S_RADIO_ACTIVE)} ${s}${n3.hint ? ` ${styleText2("dim", `(${n3.hint})`)}` : ""}`;
2472
+ case "cancelled":
2473
+ return `${c2(s, (i2) => styleText2(["strikethrough", "dim"], i2))}`;
2474
+ default:
2475
+ return `${styleText2("dim", S_RADIO_INACTIVE)} ${c2(s, (i2) => styleText2("dim", i2))}`;
2476
+ }
2477
+ }, d = t2.showInstructions ?? true;
2478
+ return new n$1({
2479
+ options: t2.options,
2480
+ signal: t2.signal,
2481
+ input: t2.input,
2482
+ output: t2.output,
2483
+ initialValue: t2.initialValue,
2484
+ render() {
2485
+ const n3 = t2.withGuide ?? settings.withGuide, m3 = `${symbol(this.state)} `, s = `${symbolBar(this.state)} `, i2 = wrapTextWithPrefix(
2486
+ t2.output,
2487
+ t2.message,
2488
+ s,
2489
+ m3
2490
+ ), u5 = `${n3 ? `${styleText2("gray", S_BAR)}
2491
+ ` : ""}${i2}
2492
+ `;
2493
+ switch (this.state) {
2494
+ case "submit": {
2495
+ const r2 = n3 ? `${styleText2("gray", S_BAR)} ` : "", a2 = wrapTextWithPrefix(
2496
+ t2.output,
2497
+ o2(this.options[this.cursor], "selected"),
2498
+ r2
2499
+ );
2500
+ return `${u5}${a2}`;
2501
+ }
2502
+ case "cancel": {
2503
+ const r2 = n3 ? `${styleText2("gray", S_BAR)} ` : "", a2 = wrapTextWithPrefix(
2504
+ t2.output,
2505
+ o2(this.options[this.cursor], "cancelled"),
2506
+ r2
2507
+ );
2508
+ return `${u5}${a2}${n3 ? `
2509
+ ${styleText2("gray", S_BAR)}` : ""}`;
2510
+ }
2511
+ default: {
2512
+ const r2 = n3 ? `${styleText2("cyan", S_BAR)} ` : "", a2 = u5.split(`
2513
+ `).length, p3 = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], b3 = p3.join(`
2514
+ `), f2 = p3.length + 1;
2515
+ return `${u5}${r2}${limitOptions({
2516
+ output: t2.output,
2517
+ cursor: this.cursor,
2518
+ options: this.options,
2519
+ maxItems: t2.maxItems,
2520
+ columnPadding: r2.length,
2521
+ rowPadding: a2 + f2,
2522
+ style: (g2, x2) => o2(g2, g2.disabled ? "disabled" : x2 ? "active" : "inactive")
2523
+ }).join(`
2524
+ ${r2}`)}
2525
+ ${b3}
2526
+ `;
2527
+ }
2528
+ }
2529
+ }
2530
+ }).prompt();
2531
+ };
2532
+ var selectKey = (t2) => {
2533
+ const l2 = (e, a2 = "inactive") => {
2534
+ if (e === void 0)
2535
+ return "";
2536
+ const n3 = e.label ?? String(e.value);
2537
+ return a2 === "selected" ? `${styleText2("dim", n3)}` : a2 === "cancelled" ? `${styleText2(["strikethrough", "dim"], n3)}` : a2 === "active" ? `${styleText2(["bgCyan", "gray"], ` ${e.value} `)} ${n3}${e.hint ? ` ${styleText2("dim", `(${e.hint})`)}` : ""}` : `${styleText2(["gray", "bgWhite", "inverse"], ` ${e.value} `)} ${n3}${e.hint ? ` ${styleText2("dim", `(${e.hint})`)}` : ""}`;
2538
+ };
2539
+ return new u3({
2540
+ options: t2.options,
2541
+ signal: t2.signal,
2542
+ input: t2.input,
2543
+ output: t2.output,
2544
+ initialValue: t2.initialValue,
2545
+ caseSensitive: t2.caseSensitive,
2546
+ render() {
2547
+ const e = t2.withGuide ?? settings.withGuide, a2 = `${e ? `${styleText2("gray", S_BAR)}
2548
+ ` : ""}${symbol(this.state)} ${t2.message}
2549
+ `;
2550
+ switch (this.state) {
2551
+ case "submit": {
2552
+ const n3 = e ? `${styleText2("gray", S_BAR)} ` : "", s = this.options.find((u5) => u5.value === this.value) ?? t2.options[0], c3 = wrapTextWithPrefix(
2553
+ t2.output,
2554
+ l2(s, "selected"),
2555
+ n3
2556
+ );
2557
+ return `${a2}${c3}`;
2558
+ }
2559
+ case "cancel": {
2560
+ const n3 = e ? `${styleText2("gray", S_BAR)} ` : "", s = wrapTextWithPrefix(
2561
+ t2.output,
2562
+ l2(this.options[0], "cancelled"),
2563
+ n3
2564
+ );
2565
+ return `${a2}${s}${e ? `
2566
+ ${styleText2("gray", S_BAR)}` : ""}`;
2567
+ }
2568
+ default: {
2569
+ const n3 = e ? `${styleText2("cyan", S_BAR)} ` : "", s = e ? styleText2("cyan", S_BAR_END) : "", c3 = this.options.map(
2570
+ (u5, d) => wrapTextWithPrefix(
2571
+ t2.output,
2572
+ l2(u5, d === this.cursor ? "active" : "inactive"),
2573
+ n3
2574
+ )
2575
+ ).join(`
2576
+ `);
2577
+ return `${a2}${c3}
2578
+ ${s}
2579
+ `;
2580
+ }
2581
+ }
2582
+ }
2583
+ }).prompt();
2584
+ };
2585
+ var i = `${styleText2("gray", S_BAR)} `;
2586
+ var stream = {
2587
+ message: async (e, { symbol: l2 = styleText2("gray", S_BAR) } = {}) => {
2588
+ process.stdout.write(`${styleText2("gray", S_BAR)}
2589
+ ${l2} `);
2590
+ let s = 3;
2591
+ for await (let r2 of e) {
2592
+ r2 = r2.replace(/\n/g, `
2593
+ ${i}`), r2.includes(`
2594
+ `) && (s = 3 + stripVTControlCharacters(r2.slice(r2.lastIndexOf(`
2595
+ `))).length);
2596
+ const o2 = stripVTControlCharacters(r2).length;
2597
+ s + o2 < process.stdout.columns ? (s += o2, process.stdout.write(r2)) : (process.stdout.write(`
2598
+ ${i}${r2.trimStart()}`), s = 3 + stripVTControlCharacters(r2.trimStart()).length);
2599
+ }
2600
+ process.stdout.write(`
2601
+ `);
2602
+ },
2603
+ info: (e) => stream.message(e, { symbol: styleText2("blue", S_INFO) }),
2604
+ success: (e) => stream.message(e, { symbol: styleText2("green", S_SUCCESS) }),
2605
+ step: (e) => stream.message(e, { symbol: styleText2("green", S_STEP_SUBMIT) }),
2606
+ warn: (e) => stream.message(e, { symbol: styleText2("yellow", S_WARN) }),
2607
+ /** alias for `log.warn()`. */
2608
+ warning: (e) => stream.warn(e),
2609
+ error: (e) => stream.message(e, { symbol: styleText2("red", S_ERROR) })
2610
+ };
2611
+ var tasks = async (o2, e) => {
2612
+ for (const t2 of o2) {
2613
+ if (t2.enabled === false) continue;
2614
+ const s = spinner(e);
2615
+ s.start(t2.title);
2616
+ const n3 = await t2.task(s.message);
2617
+ s.stop(n3 || t2.title);
2618
+ }
2619
+ };
2620
+ var A = (l2) => l2.replace(/\x1b\[(?:\d+;)*\d*[ABCDEFGHfJKSTsu]|\x1b\[(s|u)/g, "");
2621
+ var taskLog = (l2) => {
2622
+ const r2 = l2.output ?? process.stdout, O = getColumns(r2), i2 = styleText2("gray", S_BAR), p3 = l2.spacing ?? 1, k = 3, m3 = l2.retainLog === true, d = !isCI() && isTTY(r2);
2623
+ r2.write(`${i2}
2624
+ `), r2.write(`${styleText2("green", S_STEP_SUBMIT)} ${l2.title}
2625
+ `);
2626
+ for (let e = 0; e < p3; e++)
2627
+ r2.write(`${i2}
2628
+ `);
2629
+ const n3 = [
2630
+ {
2631
+ value: "",
2632
+ full: ""
2633
+ }
2634
+ ];
2635
+ let v = false;
2636
+ const f2 = (e) => {
2637
+ if (n3.length === 0)
2638
+ return;
2639
+ let s = 0;
2640
+ e && (s += p3 + 2);
2641
+ for (const t2 of n3) {
2642
+ const { value: o2, result: a2 } = t2;
2643
+ let g2 = a2?.message ?? o2;
2644
+ if (g2.length === 0)
2645
+ continue;
2646
+ a2 === void 0 && t2.header !== void 0 && t2.header !== "" && (g2 += `
2647
+ ${t2.header}`);
2648
+ const E2 = g2.split(`
2649
+ `).reduce((b3, w) => w === "" ? b3 + 1 : b3 + Math.ceil((w.length + k) / O), 0);
2650
+ s += E2;
2651
+ }
2652
+ s > 0 && (s += 1, r2.write(import_sisteransi2.erase.lines(s)));
2653
+ }, h2 = (e, s, t2) => {
2654
+ const o2 = t2 ? `${e.full}
2655
+ ${e.value}` : e.value;
2656
+ e.header !== void 0 && e.header !== "" && log.message(
2657
+ e.header.split(`
2658
+ `).map((a2) => styleText2("bold", a2)),
2659
+ {
2660
+ output: r2,
2661
+ secondarySymbol: i2,
2662
+ symbol: i2,
2663
+ spacing: 0
2664
+ }
2665
+ ), log.message(
2666
+ o2.split(`
2667
+ `).map((a2) => styleText2("dim", a2)),
2668
+ {
2669
+ output: r2,
2670
+ secondarySymbol: i2,
2671
+ symbol: i2,
2672
+ spacing: s ?? p3
2673
+ }
2674
+ );
2675
+ }, T3 = () => {
2676
+ for (const e of n3) {
2677
+ const { header: s, value: t2, full: o2 } = e;
2678
+ (s === void 0 || s.length === 0) && t2.length === 0 || h2(e, void 0, m3 === true && o2.length > 0);
2679
+ }
2680
+ }, L = (e, s, t2) => {
2681
+ if (f2(false), (t2?.raw !== true || !v) && e.value !== "" && (e.value += `
2682
+ `), e.value += A(s), v = t2?.raw === true, l2.limit !== void 0) {
2683
+ const o2 = e.value.split(`
2684
+ `), a2 = o2.length - l2.limit;
2685
+ if (a2 > 0) {
2686
+ const g2 = o2.splice(0, a2);
2687
+ m3 && (e.full += (e.full === "" ? "" : `
2688
+ `) + g2.join(`
2689
+ `));
2690
+ }
2691
+ e.value = o2.join(`
2692
+ `);
2693
+ }
2694
+ d && y();
2695
+ }, y = () => {
2696
+ for (const e of n3)
2697
+ e.result ? e.result.status === "error" ? log.error(e.result.message, { output: r2, secondarySymbol: i2, spacing: 0 }) : log.success(e.result.message, { output: r2, secondarySymbol: i2, spacing: 0 }) : e.value !== "" && h2(e, 0);
2698
+ }, B = (e, s) => {
2699
+ f2(false), e.result = s, d && y();
2700
+ };
2701
+ return {
2702
+ message(e, s) {
2703
+ L(n3[0], e, s);
2704
+ },
2705
+ group(e) {
2706
+ const s = {
2707
+ header: e,
2708
+ value: "",
2709
+ full: ""
2710
+ };
2711
+ return n3.push(s), {
2712
+ message(t2, o2) {
2713
+ L(s, t2, o2);
2714
+ },
2715
+ error(t2) {
2716
+ B(s, {
2717
+ status: "error",
2718
+ message: t2
2719
+ });
2720
+ },
2721
+ success(t2) {
2722
+ B(s, {
2723
+ status: "success",
2724
+ message: t2
2725
+ });
2726
+ }
2727
+ };
2728
+ },
2729
+ error(e, s) {
2730
+ f2(true), log.error(e, { output: r2, secondarySymbol: i2, spacing: 1 }), s?.showLog !== false && T3(), n3.splice(1, n3.length - 1), n3[0].value = "", n3[0].full = "";
2731
+ },
2732
+ success(e, s) {
2733
+ f2(true), log.success(e, { output: r2, secondarySymbol: i2, spacing: 1 }), s?.showLog === true && T3(), n3.splice(1, n3.length - 1), n3[0].value = "", n3[0].full = "";
2734
+ }
2735
+ };
2736
+ };
2737
+ var text = (e) => new n2({
2738
+ validate: e.validate,
2739
+ placeholder: e.placeholder,
2740
+ defaultValue: e.defaultValue,
2741
+ initialValue: e.initialValue,
2742
+ output: e.output,
2743
+ signal: e.signal,
2744
+ input: e.input,
2745
+ render() {
2746
+ const i2 = e?.withGuide ?? settings.withGuide, s = `${`${i2 ? `${styleText2("gray", S_BAR)}
2747
+ ` : ""}${symbol(this.state)} `}${e.message}
2748
+ `, c3 = e.placeholder && e.placeholder.length > 0 ? (
2749
+ // biome-ignore lint/style/noNonNullAssertion: guarded by placeholder.length > 0
2750
+ styleText2("inverse", e.placeholder[0]) + styleText2("dim", e.placeholder.slice(1))
2751
+ ) : styleText2(["inverse", "hidden"], "_"), o2 = this.userInput ? this.userInputWithCursor : c3, l2 = this.value ?? "";
2752
+ switch (this.state) {
2753
+ case "error": {
2754
+ const n3 = this.error ? ` ${styleText2("yellow", this.error)}` : "", r2 = i2 ? `${styleText2("yellow", S_BAR)} ` : "", d = i2 ? styleText2("yellow", S_BAR_END) : "";
2755
+ return `${s.trim()}
2756
+ ${r2}${o2}
2757
+ ${d}${n3}
2758
+ `;
2759
+ }
2760
+ case "submit": {
2761
+ const n3 = l2 ? ` ${styleText2("dim", l2)}` : "", r2 = i2 ? styleText2("gray", S_BAR) : "";
2762
+ return `${s}${r2}${n3}`;
2763
+ }
2764
+ case "cancel": {
2765
+ const n3 = l2 ? ` ${styleText2(["strikethrough", "dim"], l2)}` : "", r2 = i2 ? styleText2("gray", S_BAR) : "";
2766
+ return `${s}${r2}${n3}${l2.trim() ? `
2767
+ ${r2}` : ""}`;
2768
+ }
2769
+ default: {
2770
+ const n3 = i2 ? `${styleText2("cyan", S_BAR)} ` : "", r2 = i2 ? styleText2("cyan", S_BAR_END) : "";
2771
+ return `${s}${n3}${o2}
2772
+ ${r2}
2773
+ `;
2774
+ }
2775
+ }
2776
+ }
2777
+ }).prompt();
2778
+ export {
2779
+ MULTISELECT_INSTRUCTIONS,
2780
+ SELECT_INSTRUCTIONS,
2781
+ S_BAR,
2782
+ S_BAR_END,
2783
+ S_BAR_END_RIGHT,
2784
+ S_BAR_H,
2785
+ S_BAR_START,
2786
+ S_BAR_START_RIGHT,
2787
+ S_CHECKBOX_ACTIVE,
2788
+ S_CHECKBOX_INACTIVE,
2789
+ S_CHECKBOX_SELECTED,
2790
+ S_CONNECT_LEFT,
2791
+ S_CORNER_BOTTOM_LEFT,
2792
+ S_CORNER_BOTTOM_RIGHT,
2793
+ S_CORNER_TOP_LEFT,
2794
+ S_CORNER_TOP_RIGHT,
2795
+ S_ERROR,
2796
+ S_INFO,
2797
+ S_PASSWORD_MASK,
2798
+ S_RADIO_ACTIVE,
2799
+ S_RADIO_INACTIVE,
2800
+ S_STEP_ACTIVE,
2801
+ S_STEP_CANCEL,
2802
+ S_STEP_ERROR,
2803
+ S_STEP_SUBMIT,
2804
+ S_SUCCESS,
2805
+ S_WARN,
2806
+ autocomplete,
2807
+ autocompleteMultiselect,
2808
+ box,
2809
+ cancel,
2810
+ confirm,
2811
+ date,
2812
+ formatInstructionFooter,
2813
+ group,
2814
+ groupMultiselect,
2815
+ intro,
2816
+ isCI,
2817
+ isCancel,
2818
+ isTTY,
2819
+ limitOptions,
2820
+ log,
2821
+ multiline,
2822
+ multiselect,
2823
+ note,
2824
+ outro,
2825
+ password,
2826
+ path,
2827
+ progress,
2828
+ select,
2829
+ selectKey,
2830
+ settings,
2831
+ spinner,
2832
+ stream,
2833
+ symbol,
2834
+ symbolBar,
2835
+ taskLog,
2836
+ tasks,
2837
+ text,
2838
+ unicode,
2839
+ unicodeOr,
2840
+ updateSettings
2841
+ };
2842
+ //# sourceMappingURL=dist-3LOO6M4U.js.map