@buiducnhat/agent-skills 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1832 -967
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
|
-
import fs, { existsSync, mkdtempSync } from "node:fs";
|
|
4
|
-
import path from "node:path";
|
|
3
|
+
import fs, { existsSync, lstatSync, mkdtempSync, readdirSync } from "node:fs";
|
|
4
|
+
import path, { dirname, join } from "node:path";
|
|
5
|
+
import N, { stdin, stdout } from "node:process";
|
|
6
|
+
import * as k from "node:readline";
|
|
7
|
+
import ot from "node:readline";
|
|
8
|
+
import { ReadStream } from "node:tty";
|
|
5
9
|
import { stripVTControlCharacters } from "node:util";
|
|
6
|
-
import y, { stdin, stdout } from "node:process";
|
|
7
|
-
import * as g from "node:readline";
|
|
8
|
-
import O from "node:readline";
|
|
9
|
-
import { Writable } from "node:stream";
|
|
10
10
|
import { execSync, spawn } from "node:child_process";
|
|
11
11
|
import { tmpdir } from "node:os";
|
|
12
12
|
|
|
@@ -37,63 +37,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
37
37
|
enumerable: true
|
|
38
38
|
}) : target, mod));
|
|
39
39
|
|
|
40
|
-
//#endregion
|
|
41
|
-
//#region node_modules/sisteransi/src/index.js
|
|
42
|
-
var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
43
|
-
const ESC = "\x1B";
|
|
44
|
-
const CSI = `${ESC}[`;
|
|
45
|
-
const beep = "\x07";
|
|
46
|
-
const cursor = {
|
|
47
|
-
to(x, y) {
|
|
48
|
-
if (!y) return `${CSI}${x + 1}G`;
|
|
49
|
-
return `${CSI}${y + 1};${x + 1}H`;
|
|
50
|
-
},
|
|
51
|
-
move(x, y) {
|
|
52
|
-
let ret = "";
|
|
53
|
-
if (x < 0) ret += `${CSI}${-x}D`;
|
|
54
|
-
else if (x > 0) ret += `${CSI}${x}C`;
|
|
55
|
-
if (y < 0) ret += `${CSI}${-y}A`;
|
|
56
|
-
else if (y > 0) ret += `${CSI}${y}B`;
|
|
57
|
-
return ret;
|
|
58
|
-
},
|
|
59
|
-
up: (count = 1) => `${CSI}${count}A`,
|
|
60
|
-
down: (count = 1) => `${CSI}${count}B`,
|
|
61
|
-
forward: (count = 1) => `${CSI}${count}C`,
|
|
62
|
-
backward: (count = 1) => `${CSI}${count}D`,
|
|
63
|
-
nextLine: (count = 1) => `${CSI}E`.repeat(count),
|
|
64
|
-
prevLine: (count = 1) => `${CSI}F`.repeat(count),
|
|
65
|
-
left: `${CSI}G`,
|
|
66
|
-
hide: `${CSI}?25l`,
|
|
67
|
-
show: `${CSI}?25h`,
|
|
68
|
-
save: `${ESC}7`,
|
|
69
|
-
restore: `${ESC}8`
|
|
70
|
-
};
|
|
71
|
-
const scroll = {
|
|
72
|
-
up: (count = 1) => `${CSI}S`.repeat(count),
|
|
73
|
-
down: (count = 1) => `${CSI}T`.repeat(count)
|
|
74
|
-
};
|
|
75
|
-
const erase = {
|
|
76
|
-
screen: `${CSI}2J`,
|
|
77
|
-
up: (count = 1) => `${CSI}1J`.repeat(count),
|
|
78
|
-
down: (count = 1) => `${CSI}J`.repeat(count),
|
|
79
|
-
line: `${CSI}2K`,
|
|
80
|
-
lineEnd: `${CSI}K`,
|
|
81
|
-
lineStart: `${CSI}1K`,
|
|
82
|
-
lines(count) {
|
|
83
|
-
let clear = "";
|
|
84
|
-
for (let i = 0; i < count; i++) clear += this.line + (i < count - 1 ? cursor.up() : "");
|
|
85
|
-
if (count) clear += cursor.left;
|
|
86
|
-
return clear;
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
module.exports = {
|
|
90
|
-
cursor,
|
|
91
|
-
scroll,
|
|
92
|
-
erase,
|
|
93
|
-
beep
|
|
94
|
-
};
|
|
95
|
-
}));
|
|
96
|
-
|
|
97
40
|
//#endregion
|
|
98
41
|
//#region node_modules/picocolors/picocolors.js
|
|
99
42
|
var require_picocolors = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -163,274 +106,223 @@ var require_picocolors = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
163
106
|
module.exports.createColors = createColors;
|
|
164
107
|
}));
|
|
165
108
|
|
|
109
|
+
//#endregion
|
|
110
|
+
//#region node_modules/sisteransi/src/index.js
|
|
111
|
+
var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
112
|
+
const ESC = "\x1B";
|
|
113
|
+
const CSI = `${ESC}[`;
|
|
114
|
+
const beep = "\x07";
|
|
115
|
+
const cursor = {
|
|
116
|
+
to(x, y) {
|
|
117
|
+
if (!y) return `${CSI}${x + 1}G`;
|
|
118
|
+
return `${CSI}${y + 1};${x + 1}H`;
|
|
119
|
+
},
|
|
120
|
+
move(x, y) {
|
|
121
|
+
let ret = "";
|
|
122
|
+
if (x < 0) ret += `${CSI}${-x}D`;
|
|
123
|
+
else if (x > 0) ret += `${CSI}${x}C`;
|
|
124
|
+
if (y < 0) ret += `${CSI}${-y}A`;
|
|
125
|
+
else if (y > 0) ret += `${CSI}${y}B`;
|
|
126
|
+
return ret;
|
|
127
|
+
},
|
|
128
|
+
up: (count = 1) => `${CSI}${count}A`,
|
|
129
|
+
down: (count = 1) => `${CSI}${count}B`,
|
|
130
|
+
forward: (count = 1) => `${CSI}${count}C`,
|
|
131
|
+
backward: (count = 1) => `${CSI}${count}D`,
|
|
132
|
+
nextLine: (count = 1) => `${CSI}E`.repeat(count),
|
|
133
|
+
prevLine: (count = 1) => `${CSI}F`.repeat(count),
|
|
134
|
+
left: `${CSI}G`,
|
|
135
|
+
hide: `${CSI}?25l`,
|
|
136
|
+
show: `${CSI}?25h`,
|
|
137
|
+
save: `${ESC}7`,
|
|
138
|
+
restore: `${ESC}8`
|
|
139
|
+
};
|
|
140
|
+
const scroll = {
|
|
141
|
+
up: (count = 1) => `${CSI}S`.repeat(count),
|
|
142
|
+
down: (count = 1) => `${CSI}T`.repeat(count)
|
|
143
|
+
};
|
|
144
|
+
const erase = {
|
|
145
|
+
screen: `${CSI}2J`,
|
|
146
|
+
up: (count = 1) => `${CSI}1J`.repeat(count),
|
|
147
|
+
down: (count = 1) => `${CSI}J`.repeat(count),
|
|
148
|
+
line: `${CSI}2K`,
|
|
149
|
+
lineEnd: `${CSI}K`,
|
|
150
|
+
lineStart: `${CSI}1K`,
|
|
151
|
+
lines(count) {
|
|
152
|
+
let clear = "";
|
|
153
|
+
for (let i = 0; i < count; i++) clear += this.line + (i < count - 1 ? cursor.up() : "");
|
|
154
|
+
if (count) clear += cursor.left;
|
|
155
|
+
return clear;
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
module.exports = {
|
|
159
|
+
cursor,
|
|
160
|
+
scroll,
|
|
161
|
+
erase,
|
|
162
|
+
beep
|
|
163
|
+
};
|
|
164
|
+
}));
|
|
165
|
+
|
|
166
166
|
//#endregion
|
|
167
167
|
//#region node_modules/@clack/core/dist/index.mjs
|
|
168
|
-
var import_src = require_src();
|
|
169
168
|
var import_picocolors = /* @__PURE__ */ __toESM(require_picocolors(), 1);
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
function P$1(e) {
|
|
176
|
-
if (typeof e != "string") throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);
|
|
177
|
-
return e.replace(uD, "");
|
|
178
|
-
}
|
|
179
|
-
function L$1(e) {
|
|
180
|
-
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
169
|
+
var import_src = require_src();
|
|
170
|
+
function B(t, e, s) {
|
|
171
|
+
if (!s.some((u) => !u.disabled)) return t;
|
|
172
|
+
const i = t + e, r = Math.max(s.length - 1, 0), n = i < 0 ? r : i > r ? 0 : i;
|
|
173
|
+
return s[n].disabled ? B(n, e < 0 ? -1 : 1, s) : n;
|
|
181
174
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
var a = n[E], o = u.length(a);
|
|
202
|
-
if (r >= s - (o == 2 ? 1 : 0)) if (r + o <= i) D += a;
|
|
203
|
-
else break;
|
|
204
|
-
r += o;
|
|
175
|
+
const at$1 = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 170 || t === 173 || t === 174 || t >= 176 && t <= 180 || t >= 182 && t <= 186 || t >= 188 && t <= 191 || t === 198 || t === 208 || t === 215 || t === 216 || t >= 222 && t <= 225 || t === 230 || t >= 232 && t <= 234 || t === 236 || t === 237 || t === 240 || t === 242 || t === 243 || t >= 247 && t <= 250 || t === 252 || t === 254 || t === 257 || t === 273 || t === 275 || t === 283 || t === 294 || t === 295 || t === 299 || t >= 305 && t <= 307 || t === 312 || t >= 319 && t <= 322 || t === 324 || t >= 328 && t <= 331 || t === 333 || t === 338 || t === 339 || t === 358 || t === 359 || t === 363 || t === 462 || t === 464 || t === 466 || t === 468 || t === 470 || t === 472 || t === 474 || t === 476 || t === 593 || t === 609 || t === 708 || t === 711 || t >= 713 && t <= 715 || t === 717 || t === 720 || t >= 728 && t <= 731 || t === 733 || t === 735 || t >= 768 && t <= 879 || t >= 913 && t <= 929 || t >= 931 && t <= 937 || t >= 945 && t <= 961 || t >= 963 && t <= 969 || t === 1025 || t >= 1040 && t <= 1103 || t === 1105 || t === 8208 || t >= 8211 && t <= 8214 || t === 8216 || t === 8217 || t === 8220 || t === 8221 || t >= 8224 && t <= 8226 || t >= 8228 && t <= 8231 || t === 8240 || t === 8242 || t === 8243 || t === 8245 || t === 8251 || t === 8254 || t === 8308 || t === 8319 || t >= 8321 && t <= 8324 || t === 8364 || t === 8451 || t === 8453 || t === 8457 || t === 8467 || t === 8470 || t === 8481 || t === 8482 || t === 8486 || t === 8491 || t === 8531 || t === 8532 || t >= 8539 && t <= 8542 || t >= 8544 && t <= 8555 || t >= 8560 && t <= 8569 || t === 8585 || t >= 8592 && t <= 8601 || t === 8632 || t === 8633 || t === 8658 || t === 8660 || t === 8679 || t === 8704 || t === 8706 || t === 8707 || t === 8711 || t === 8712 || t === 8715 || t === 8719 || t === 8721 || t === 8725 || t === 8730 || t >= 8733 && t <= 8736 || t === 8739 || t === 8741 || t >= 8743 && t <= 8748 || t === 8750 || t >= 8756 && t <= 8759 || t === 8764 || t === 8765 || t === 8776 || t === 8780 || t === 8786 || t === 8800 || t === 8801 || t >= 8804 && t <= 8807 || t === 8810 || t === 8811 || t === 8814 || t === 8815 || t === 8834 || t === 8835 || t === 8838 || t === 8839 || t === 8853 || t === 8857 || t === 8869 || t === 8895 || t === 8978 || t >= 9312 && t <= 9449 || t >= 9451 && t <= 9547 || t >= 9552 && t <= 9587 || t >= 9600 && t <= 9615 || t >= 9618 && t <= 9621 || t === 9632 || t === 9633 || t >= 9635 && t <= 9641 || t === 9650 || t === 9651 || t === 9654 || t === 9655 || t === 9660 || t === 9661 || t === 9664 || t === 9665 || t >= 9670 && t <= 9672 || t === 9675 || t >= 9678 && t <= 9681 || t >= 9698 && t <= 9701 || t === 9711 || t === 9733 || t === 9734 || t === 9737 || t === 9742 || t === 9743 || t === 9756 || t === 9758 || t === 9792 || t === 9794 || t === 9824 || t === 9825 || t >= 9827 && t <= 9829 || t >= 9831 && t <= 9834 || t === 9836 || t === 9837 || t === 9839 || t === 9886 || t === 9887 || t === 9919 || t >= 9926 && t <= 9933 || t >= 9935 && t <= 9939 || t >= 9941 && t <= 9953 || t === 9955 || t === 9960 || t === 9961 || t >= 9963 && t <= 9969 || t === 9972 || t >= 9974 && t <= 9977 || t === 9979 || t === 9980 || t === 9982 || t === 9983 || t === 10045 || t >= 10102 && t <= 10111 || t >= 11094 && t <= 11097 || t >= 12872 && t <= 12879 || t >= 57344 && t <= 63743 || t >= 65024 && t <= 65039 || t === 65533 || t >= 127232 && t <= 127242 || t >= 127248 && t <= 127277 || t >= 127280 && t <= 127337 || t >= 127344 && t <= 127373 || t === 127375 || t === 127376 || t >= 127387 && t <= 127404 || t >= 917760 && t <= 917999 || t >= 983040 && t <= 1048573 || t >= 1048576 && t <= 1114109, lt$1 = (t) => t === 12288 || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510, ht$1 = (t) => t >= 4352 && t <= 4447 || t === 8986 || t === 8987 || t === 9001 || t === 9002 || t >= 9193 && t <= 9196 || t === 9200 || t === 9203 || t === 9725 || t === 9726 || t === 9748 || t === 9749 || t >= 9800 && t <= 9811 || t === 9855 || t === 9875 || t === 9889 || t === 9898 || t === 9899 || t === 9917 || t === 9918 || t === 9924 || t === 9925 || t === 9934 || t === 9940 || t === 9962 || t === 9970 || t === 9971 || t === 9973 || t === 9978 || t === 9981 || t === 9989 || t === 9994 || t === 9995 || t === 10024 || t === 10060 || t === 10062 || t >= 10067 && t <= 10069 || t === 10071 || t >= 10133 && t <= 10135 || t === 10160 || t === 10175 || t === 11035 || t === 11036 || t === 11088 || t === 11093 || t >= 11904 && t <= 11929 || t >= 11931 && t <= 12019 || t >= 12032 && t <= 12245 || t >= 12272 && t <= 12287 || t >= 12289 && t <= 12350 || t >= 12353 && t <= 12438 || t >= 12441 && t <= 12543 || t >= 12549 && t <= 12591 || t >= 12593 && t <= 12686 || t >= 12688 && t <= 12771 || t >= 12783 && t <= 12830 || t >= 12832 && t <= 12871 || t >= 12880 && t <= 19903 || t >= 19968 && t <= 42124 || t >= 42128 && t <= 42182 || t >= 43360 && t <= 43388 || t >= 44032 && t <= 55203 || t >= 63744 && t <= 64255 || t >= 65040 && t <= 65049 || t >= 65072 && t <= 65106 || t >= 65108 && t <= 65126 || t >= 65128 && t <= 65131 || t >= 94176 && t <= 94180 || t === 94192 || t === 94193 || t >= 94208 && t <= 100343 || t >= 100352 && t <= 101589 || t >= 101632 && t <= 101640 || t >= 110576 && t <= 110579 || t >= 110581 && t <= 110587 || t === 110589 || t === 110590 || t >= 110592 && t <= 110882 || t === 110898 || t >= 110928 && t <= 110930 || t === 110933 || t >= 110948 && t <= 110951 || t >= 110960 && t <= 111355 || t === 126980 || t === 127183 || t === 127374 || t >= 127377 && t <= 127386 || t >= 127488 && t <= 127490 || t >= 127504 && t <= 127547 || t >= 127552 && t <= 127560 || t === 127568 || t === 127569 || t >= 127584 && t <= 127589 || t >= 127744 && t <= 127776 || t >= 127789 && t <= 127797 || t >= 127799 && t <= 127868 || t >= 127870 && t <= 127891 || t >= 127904 && t <= 127946 || t >= 127951 && t <= 127955 || t >= 127968 && t <= 127984 || t === 127988 || t >= 127992 && t <= 128062 || t === 128064 || t >= 128066 && t <= 128252 || t >= 128255 && t <= 128317 || t >= 128331 && t <= 128334 || t >= 128336 && t <= 128359 || t === 128378 || t === 128405 || t === 128406 || t === 128420 || t >= 128507 && t <= 128591 || t >= 128640 && t <= 128709 || t === 128716 || t >= 128720 && t <= 128722 || t >= 128725 && t <= 128727 || t >= 128732 && t <= 128735 || t === 128747 || t === 128748 || t >= 128756 && t <= 128764 || t >= 128992 && t <= 129003 || t === 129008 || t >= 129292 && t <= 129338 || t >= 129340 && t <= 129349 || t >= 129351 && t <= 129535 || t >= 129648 && t <= 129660 || t >= 129664 && t <= 129672 || t >= 129680 && t <= 129725 || t >= 129727 && t <= 129733 || t >= 129742 && t <= 129755 || t >= 129760 && t <= 129768 || t >= 129776 && t <= 129784 || t >= 131072 && t <= 196605 || t >= 196608 && t <= 262141, O = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y, y = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y, L = /\t{1,1000}/y, P = /[\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?))*/uy, M$1 = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y, ct$1 = /\p{M}+/gu, ft$1 = {
|
|
176
|
+
limit: Infinity,
|
|
177
|
+
ellipsis: ""
|
|
178
|
+
}, X$1 = (t, e = {}, s = {}) => {
|
|
179
|
+
const i = e.limit ?? Infinity, r = e.ellipsis ?? "", n = e?.ellipsisWidth ?? (r ? X$1(r, ft$1, s).width : 0), u = s.ansiWidth ?? 0, a = s.controlWidth ?? 0, l = s.tabWidth ?? 8, E = s.ambiguousWidth ?? 1, g = s.emojiWidth ?? 2, m = s.fullWidthWidth ?? 2, A = s.regularWidth ?? 1, V = s.wideWidth ?? 2;
|
|
180
|
+
let h = 0, o = 0, p = t.length, v = 0, F = !1, d = p, b = Math.max(0, i - n), C = 0, w = 0, c = 0, f = 0;
|
|
181
|
+
t: for (;;) {
|
|
182
|
+
if (w > C || o >= p && o > h) {
|
|
183
|
+
const ut = t.slice(C, w) || t.slice(h, o);
|
|
184
|
+
v = 0;
|
|
185
|
+
for (const Y of ut.replaceAll(ct$1, "")) {
|
|
186
|
+
const $ = Y.codePointAt(0) || 0;
|
|
187
|
+
if (lt$1($) ? f = m : ht$1($) ? f = V : E !== A && at$1($) ? f = E : f = A, c + f > b && (d = Math.min(d, Math.max(C, h) + v)), c + f > i) {
|
|
188
|
+
F = !0;
|
|
189
|
+
break t;
|
|
190
|
+
}
|
|
191
|
+
v += Y.length, c += f;
|
|
192
|
+
}
|
|
193
|
+
C = w = 0;
|
|
205
194
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
const eD = L$1(tD);
|
|
211
|
-
var FD = function() {
|
|
212
|
-
return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
|
|
213
|
-
};
|
|
214
|
-
const sD = L$1(FD);
|
|
215
|
-
function p(e, u = {}) {
|
|
216
|
-
if (typeof e != "string" || e.length === 0 || (u = {
|
|
217
|
-
ambiguousIsNarrow: !0,
|
|
218
|
-
...u
|
|
219
|
-
}, e = P$1(e), e.length === 0)) return 0;
|
|
220
|
-
e = e.replace(sD(), " ");
|
|
221
|
-
const t = u.ambiguousIsNarrow ? 1 : 2;
|
|
222
|
-
let F = 0;
|
|
223
|
-
for (const s of e) {
|
|
224
|
-
const i = s.codePointAt(0);
|
|
225
|
-
if (i <= 31 || i >= 127 && i <= 159 || i >= 768 && i <= 879) continue;
|
|
226
|
-
switch (eD.eastAsianWidth(s)) {
|
|
227
|
-
case "F":
|
|
228
|
-
case "W":
|
|
229
|
-
F += 2;
|
|
195
|
+
if (o >= p) break;
|
|
196
|
+
if (M$1.lastIndex = o, M$1.test(t)) {
|
|
197
|
+
if (v = M$1.lastIndex - o, f = v * A, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / A))), c + f > i) {
|
|
198
|
+
F = !0;
|
|
230
199
|
break;
|
|
231
|
-
|
|
232
|
-
|
|
200
|
+
}
|
|
201
|
+
c += f, C = h, w = o, o = h = M$1.lastIndex;
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
if (O.lastIndex = o, O.test(t)) {
|
|
205
|
+
if (c + u > b && (d = Math.min(d, o)), c + u > i) {
|
|
206
|
+
F = !0;
|
|
233
207
|
break;
|
|
234
|
-
|
|
208
|
+
}
|
|
209
|
+
c += u, C = h, w = o, o = h = O.lastIndex;
|
|
210
|
+
continue;
|
|
235
211
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
dim: [2, 22],
|
|
244
|
-
italic: [3, 23],
|
|
245
|
-
underline: [4, 24],
|
|
246
|
-
overline: [53, 55],
|
|
247
|
-
inverse: [7, 27],
|
|
248
|
-
hidden: [8, 28],
|
|
249
|
-
strikethrough: [9, 29]
|
|
250
|
-
},
|
|
251
|
-
color: {
|
|
252
|
-
black: [30, 39],
|
|
253
|
-
red: [31, 39],
|
|
254
|
-
green: [32, 39],
|
|
255
|
-
yellow: [33, 39],
|
|
256
|
-
blue: [34, 39],
|
|
257
|
-
magenta: [35, 39],
|
|
258
|
-
cyan: [36, 39],
|
|
259
|
-
white: [37, 39],
|
|
260
|
-
blackBright: [90, 39],
|
|
261
|
-
gray: [90, 39],
|
|
262
|
-
grey: [90, 39],
|
|
263
|
-
redBright: [91, 39],
|
|
264
|
-
greenBright: [92, 39],
|
|
265
|
-
yellowBright: [93, 39],
|
|
266
|
-
blueBright: [94, 39],
|
|
267
|
-
magentaBright: [95, 39],
|
|
268
|
-
cyanBright: [96, 39],
|
|
269
|
-
whiteBright: [97, 39]
|
|
270
|
-
},
|
|
271
|
-
bgColor: {
|
|
272
|
-
bgBlack: [40, 49],
|
|
273
|
-
bgRed: [41, 49],
|
|
274
|
-
bgGreen: [42, 49],
|
|
275
|
-
bgYellow: [43, 49],
|
|
276
|
-
bgBlue: [44, 49],
|
|
277
|
-
bgMagenta: [45, 49],
|
|
278
|
-
bgCyan: [46, 49],
|
|
279
|
-
bgWhite: [47, 49],
|
|
280
|
-
bgBlackBright: [100, 49],
|
|
281
|
-
bgGray: [100, 49],
|
|
282
|
-
bgGrey: [100, 49],
|
|
283
|
-
bgRedBright: [101, 49],
|
|
284
|
-
bgGreenBright: [102, 49],
|
|
285
|
-
bgYellowBright: [103, 49],
|
|
286
|
-
bgBlueBright: [104, 49],
|
|
287
|
-
bgMagentaBright: [105, 49],
|
|
288
|
-
bgCyanBright: [106, 49],
|
|
289
|
-
bgWhiteBright: [107, 49]
|
|
290
|
-
}
|
|
291
|
-
};
|
|
292
|
-
Object.keys(C$1.modifier);
|
|
293
|
-
const iD = Object.keys(C$1.color), rD = Object.keys(C$1.bgColor);
|
|
294
|
-
[...iD, ...rD];
|
|
295
|
-
function CD() {
|
|
296
|
-
const e = /* @__PURE__ */ new Map();
|
|
297
|
-
for (const [u, t] of Object.entries(C$1)) {
|
|
298
|
-
for (const [F, s] of Object.entries(t)) C$1[F] = {
|
|
299
|
-
open: `\x1B[${s[0]}m`,
|
|
300
|
-
close: `\x1B[${s[1]}m`
|
|
301
|
-
}, t[F] = C$1[F], e.set(s[0], s[1]);
|
|
302
|
-
Object.defineProperty(C$1, u, {
|
|
303
|
-
value: t,
|
|
304
|
-
enumerable: !1
|
|
305
|
-
});
|
|
306
|
-
}
|
|
307
|
-
return Object.defineProperty(C$1, "codes", {
|
|
308
|
-
value: e,
|
|
309
|
-
enumerable: !1
|
|
310
|
-
}), C$1.color.close = "\x1B[39m", C$1.bgColor.close = "\x1B[49m", C$1.color.ansi = N(), C$1.color.ansi256 = I(), C$1.color.ansi16m = R(), C$1.bgColor.ansi = N(w), C$1.bgColor.ansi256 = I(w), C$1.bgColor.ansi16m = R(w), Object.defineProperties(C$1, {
|
|
311
|
-
rgbToAnsi256: {
|
|
312
|
-
value: (u, t, F) => u === t && t === F ? u < 8 ? 16 : u > 248 ? 231 : Math.round((u - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(u / 255 * 5) + 6 * Math.round(t / 255 * 5) + Math.round(F / 255 * 5),
|
|
313
|
-
enumerable: !1
|
|
314
|
-
},
|
|
315
|
-
hexToRgb: {
|
|
316
|
-
value: (u) => {
|
|
317
|
-
const t = /[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));
|
|
318
|
-
if (!t) return [
|
|
319
|
-
0,
|
|
320
|
-
0,
|
|
321
|
-
0
|
|
322
|
-
];
|
|
323
|
-
let [F] = t;
|
|
324
|
-
F.length === 3 && (F = [...F].map((i) => i + i).join(""));
|
|
325
|
-
const s = Number.parseInt(F, 16);
|
|
326
|
-
return [
|
|
327
|
-
s >> 16 & 255,
|
|
328
|
-
s >> 8 & 255,
|
|
329
|
-
s & 255
|
|
330
|
-
];
|
|
331
|
-
},
|
|
332
|
-
enumerable: !1
|
|
333
|
-
},
|
|
334
|
-
hexToAnsi256: {
|
|
335
|
-
value: (u) => C$1.rgbToAnsi256(...C$1.hexToRgb(u)),
|
|
336
|
-
enumerable: !1
|
|
337
|
-
},
|
|
338
|
-
ansi256ToAnsi: {
|
|
339
|
-
value: (u) => {
|
|
340
|
-
if (u < 8) return 30 + u;
|
|
341
|
-
if (u < 16) return 90 + (u - 8);
|
|
342
|
-
let t, F, s;
|
|
343
|
-
if (u >= 232) t = ((u - 232) * 10 + 8) / 255, F = t, s = t;
|
|
344
|
-
else {
|
|
345
|
-
u -= 16;
|
|
346
|
-
const r = u % 36;
|
|
347
|
-
t = Math.floor(u / 36) / 5, F = Math.floor(r / 6) / 5, s = r % 6 / 5;
|
|
348
|
-
}
|
|
349
|
-
const i = Math.max(t, F, s) * 2;
|
|
350
|
-
if (i === 0) return 30;
|
|
351
|
-
let D = 30 + (Math.round(s) << 2 | Math.round(F) << 1 | Math.round(t));
|
|
352
|
-
return i === 2 && (D += 60), D;
|
|
353
|
-
},
|
|
354
|
-
enumerable: !1
|
|
355
|
-
},
|
|
356
|
-
rgbToAnsi: {
|
|
357
|
-
value: (u, t, F) => C$1.ansi256ToAnsi(C$1.rgbToAnsi256(u, t, F)),
|
|
358
|
-
enumerable: !1
|
|
359
|
-
},
|
|
360
|
-
hexToAnsi: {
|
|
361
|
-
value: (u) => C$1.ansi256ToAnsi(C$1.hexToAnsi256(u)),
|
|
362
|
-
enumerable: !1
|
|
212
|
+
if (y.lastIndex = o, y.test(t)) {
|
|
213
|
+
if (v = y.lastIndex - o, f = v * a, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / a))), c + f > i) {
|
|
214
|
+
F = !0;
|
|
215
|
+
break;
|
|
216
|
+
}
|
|
217
|
+
c += f, C = h, w = o, o = h = y.lastIndex;
|
|
218
|
+
continue;
|
|
363
219
|
}
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
const E = p(n);
|
|
371
|
-
if (D + E <= t ? e[e.length - 1] += n : (e.push(n), D = 0), d$1.has(n) && (s = !0, i = F.slice(r + 1).join("").startsWith(_$1)), s) {
|
|
372
|
-
i ? n === y$1 && (s = !1, i = !1) : n === G$1 && (s = !1);
|
|
220
|
+
if (L.lastIndex = o, L.test(t)) {
|
|
221
|
+
if (v = L.lastIndex - o, f = v * l, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / l))), c + f > i) {
|
|
222
|
+
F = !0;
|
|
223
|
+
break;
|
|
224
|
+
}
|
|
225
|
+
c += f, C = h, w = o, o = h = L.lastIndex;
|
|
373
226
|
continue;
|
|
374
227
|
}
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
for (; t > 0 && !(p(u[t - 1]) > 0);) t--;
|
|
382
|
-
return t === u.length ? e : u.slice(0, t).join(" ") + u.slice(t).join("");
|
|
383
|
-
}, lD = (e, u, t = {}) => {
|
|
384
|
-
if (t.trim !== !1 && e.trim() === "") return "";
|
|
385
|
-
let F = "", s, i;
|
|
386
|
-
const D = aD(e);
|
|
387
|
-
let r = [""];
|
|
388
|
-
for (const [E, a] of e.split(" ").entries()) {
|
|
389
|
-
t.trim !== !1 && (r[r.length - 1] = r[r.length - 1].trimStart());
|
|
390
|
-
let o = p(r[r.length - 1]);
|
|
391
|
-
if (E !== 0 && (o >= u && (t.wordWrap === !1 || t.trim === !1) && (r.push(""), o = 0), (o > 0 || t.trim === !1) && (r[r.length - 1] += " ", o++)), t.hard && D[E] > u) {
|
|
392
|
-
const c = u - o, f = 1 + Math.floor((D[E] - c - 1) / u);
|
|
393
|
-
Math.floor((D[E] - 1) / u) < f && r.push(""), k$1(r, a, u);
|
|
228
|
+
if (P.lastIndex = o, P.test(t)) {
|
|
229
|
+
if (c + g > b && (d = Math.min(d, o)), c + g > i) {
|
|
230
|
+
F = !0;
|
|
231
|
+
break;
|
|
232
|
+
}
|
|
233
|
+
c += g, C = h, w = o, o = h = P.lastIndex;
|
|
394
234
|
continue;
|
|
395
235
|
}
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
236
|
+
o += 1;
|
|
237
|
+
}
|
|
238
|
+
return {
|
|
239
|
+
width: F ? b : c,
|
|
240
|
+
index: F ? d : p,
|
|
241
|
+
truncated: F,
|
|
242
|
+
ellipsed: F && i >= n
|
|
243
|
+
};
|
|
244
|
+
}, pt$1 = {
|
|
245
|
+
limit: Infinity,
|
|
246
|
+
ellipsis: "",
|
|
247
|
+
ellipsisWidth: 0
|
|
248
|
+
}, S = (t, e = {}) => X$1(t, pt$1, e).width, W$1 = "\x1B", Z$1 = "", Ft$1 = 39, j = "\x07", Q$1 = "[", dt$1 = "]", tt = "m", U$1 = `${dt$1}8;;`, et$1 = new RegExp(`(?:\\${Q$1}(?<code>\\d+)m|\\${U$1}(?<uri>.*)${j})`, "y"), mt$1 = (t) => {
|
|
249
|
+
if (t >= 30 && t <= 37 || t >= 90 && t <= 97) return 39;
|
|
250
|
+
if (t >= 40 && t <= 47 || t >= 100 && t <= 107) return 49;
|
|
251
|
+
if (t === 1 || t === 2) return 22;
|
|
252
|
+
if (t === 3) return 23;
|
|
253
|
+
if (t === 4) return 24;
|
|
254
|
+
if (t === 7) return 27;
|
|
255
|
+
if (t === 8) return 28;
|
|
256
|
+
if (t === 9) return 29;
|
|
257
|
+
if (t === 0) return 0;
|
|
258
|
+
}, st$1 = (t) => `${W$1}${Q$1}${t}${tt}`, it$1 = (t) => `${W$1}${U$1}${t}${j}`, gt$1 = (t) => t.map((e) => S(e)), G = (t, e, s) => {
|
|
259
|
+
const i = e[Symbol.iterator]();
|
|
260
|
+
let r = !1, n = !1, u = t.at(-1), a = u === void 0 ? 0 : S(u), l = i.next(), E = i.next(), g = 0;
|
|
261
|
+
for (; !l.done;) {
|
|
262
|
+
const m = l.value, A = S(m);
|
|
263
|
+
a + A <= s ? t[t.length - 1] += m : (t.push(m), a = 0), (m === W$1 || m === Z$1) && (r = !0, n = e.startsWith(U$1, g + 1)), r ? n ? m === j && (r = !1, n = !1) : m === tt && (r = !1) : (a += A, a === s && !E.done && (t.push(""), a = 0)), l = E, E = i.next(), g += m.length;
|
|
264
|
+
}
|
|
265
|
+
u = t.at(-1), !a && u !== void 0 && u.length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
|
|
266
|
+
}, vt$1 = (t) => {
|
|
267
|
+
const e = t.split(" ");
|
|
268
|
+
let s = e.length;
|
|
269
|
+
for (; s > 0 && !(S(e[s - 1]) > 0);) s--;
|
|
270
|
+
return s === e.length ? t : e.slice(0, s).join(" ") + e.slice(s).join("");
|
|
271
|
+
}, Et$1 = (t, e, s = {}) => {
|
|
272
|
+
if (s.trim !== !1 && t.trim() === "") return "";
|
|
273
|
+
let i = "", r, n;
|
|
274
|
+
const u = t.split(" "), a = gt$1(u);
|
|
275
|
+
let l = [""];
|
|
276
|
+
for (const [h, o] of u.entries()) {
|
|
277
|
+
s.trim !== !1 && (l[l.length - 1] = (l.at(-1) ?? "").trimStart());
|
|
278
|
+
let p = S(l.at(-1) ?? "");
|
|
279
|
+
if (h !== 0 && (p >= e && (s.wordWrap === !1 || s.trim === !1) && (l.push(""), p = 0), (p > 0 || s.trim === !1) && (l[l.length - 1] += " ", p++)), s.hard && a[h] > e) {
|
|
280
|
+
const v = e - p, F = 1 + Math.floor((a[h] - v - 1) / e);
|
|
281
|
+
Math.floor((a[h] - 1) / e) < F && l.push(""), G(l, o, e);
|
|
282
|
+
continue;
|
|
283
|
+
}
|
|
284
|
+
if (p + a[h] > e && p > 0 && a[h] > 0) {
|
|
285
|
+
if (s.wordWrap === !1 && p < e) {
|
|
286
|
+
G(l, o, e);
|
|
399
287
|
continue;
|
|
400
288
|
}
|
|
401
|
-
|
|
289
|
+
l.push("");
|
|
402
290
|
}
|
|
403
|
-
if (
|
|
404
|
-
|
|
291
|
+
if (p + a[h] > e && s.wordWrap === !1) {
|
|
292
|
+
G(l, o, e);
|
|
405
293
|
continue;
|
|
406
294
|
}
|
|
407
|
-
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
const
|
|
411
|
-
`)];
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
295
|
+
l[l.length - 1] += o;
|
|
296
|
+
}
|
|
297
|
+
s.trim !== !1 && (l = l.map((h) => vt$1(h)));
|
|
298
|
+
const E = l.join(`
|
|
299
|
+
`), g = E[Symbol.iterator]();
|
|
300
|
+
let m = g.next(), A = g.next(), V = 0;
|
|
301
|
+
for (; !m.done;) {
|
|
302
|
+
const h = m.value, o = A.value;
|
|
303
|
+
if (i += h, h === W$1 || h === Z$1) {
|
|
304
|
+
et$1.lastIndex = V + 1;
|
|
305
|
+
const F = et$1.exec(E)?.groups;
|
|
306
|
+
if (F?.code !== void 0) {
|
|
307
|
+
const d = Number.parseFloat(F.code);
|
|
308
|
+
r = d === Ft$1 ? void 0 : d;
|
|
309
|
+
} else F?.uri !== void 0 && (n = F.uri.length === 0 ? void 0 : F.uri);
|
|
419
310
|
}
|
|
420
|
-
const
|
|
421
|
-
|
|
422
|
-
` ? (
|
|
423
|
-
` && (
|
|
311
|
+
const p = r ? mt$1(r) : void 0;
|
|
312
|
+
o === `
|
|
313
|
+
` ? (n && (i += it$1("")), r && p && (i += st$1(p))) : h === `
|
|
314
|
+
` && (r && p && (i += st$1(r)), n && (i += it$1(n))), V += h.length, m = A, A = g.next();
|
|
424
315
|
}
|
|
425
|
-
return
|
|
316
|
+
return i;
|
|
426
317
|
};
|
|
427
|
-
function
|
|
428
|
-
return String(
|
|
318
|
+
function K$1(t, e, s) {
|
|
319
|
+
return String(t).normalize().replaceAll(`\r
|
|
320
|
+
`, `
|
|
429
321
|
`).split(`
|
|
430
|
-
`).map((
|
|
322
|
+
`).map((i) => Et$1(i, e, s)).join(`
|
|
431
323
|
`);
|
|
432
324
|
}
|
|
433
|
-
const
|
|
325
|
+
const _ = {
|
|
434
326
|
actions: new Set([
|
|
435
327
|
"up",
|
|
436
328
|
"down",
|
|
@@ -447,221 +339,351 @@ const B = {
|
|
|
447
339
|
["l", "right"],
|
|
448
340
|
["", "cancel"],
|
|
449
341
|
["escape", "cancel"]
|
|
450
|
-
])
|
|
342
|
+
]),
|
|
343
|
+
messages: {
|
|
344
|
+
cancel: "Canceled",
|
|
345
|
+
error: "Something went wrong"
|
|
346
|
+
},
|
|
347
|
+
withGuide: !0
|
|
451
348
|
};
|
|
452
|
-
function $(
|
|
453
|
-
if (typeof
|
|
454
|
-
for (const
|
|
349
|
+
function H$1(t, e) {
|
|
350
|
+
if (typeof t == "string") return _.aliases.get(t) === e;
|
|
351
|
+
for (const s of t) if (s !== void 0 && H$1(s, e)) return !0;
|
|
455
352
|
return !1;
|
|
456
353
|
}
|
|
457
|
-
function
|
|
458
|
-
if (
|
|
459
|
-
const
|
|
460
|
-
`),
|
|
461
|
-
`), s = [];
|
|
462
|
-
for (let
|
|
463
|
-
return
|
|
354
|
+
function _t(t, e) {
|
|
355
|
+
if (t === e) return;
|
|
356
|
+
const s = t.split(`
|
|
357
|
+
`), i = e.split(`
|
|
358
|
+
`), r = Math.max(s.length, i.length), n = [];
|
|
359
|
+
for (let u = 0; u < r; u++) s[u] !== i[u] && n.push(u);
|
|
360
|
+
return {
|
|
361
|
+
lines: n,
|
|
362
|
+
numLinesBefore: s.length,
|
|
363
|
+
numLinesAfter: i.length,
|
|
364
|
+
numLines: r
|
|
365
|
+
};
|
|
464
366
|
}
|
|
465
|
-
const
|
|
466
|
-
function
|
|
467
|
-
return
|
|
367
|
+
const bt$1 = globalThis.process.platform.startsWith("win"), z = Symbol("clack:cancel");
|
|
368
|
+
function Ct$1(t) {
|
|
369
|
+
return t === z;
|
|
468
370
|
}
|
|
469
|
-
function
|
|
470
|
-
const
|
|
471
|
-
|
|
371
|
+
function T(t, e) {
|
|
372
|
+
const s = t;
|
|
373
|
+
s.isTTY && s.setRawMode(e);
|
|
472
374
|
}
|
|
473
|
-
function
|
|
474
|
-
const
|
|
475
|
-
input:
|
|
476
|
-
output:
|
|
375
|
+
function Bt({ input: t = stdin, output: e = stdout, overwrite: s = !0, hideCursor: i = !0 } = {}) {
|
|
376
|
+
const r = k.createInterface({
|
|
377
|
+
input: t,
|
|
378
|
+
output: e,
|
|
477
379
|
prompt: "",
|
|
478
380
|
tabSize: 1
|
|
479
381
|
});
|
|
480
|
-
|
|
481
|
-
const
|
|
482
|
-
if ($([
|
|
483
|
-
String(
|
|
484
|
-
|
|
485
|
-
|
|
382
|
+
k.emitKeypressEvents(t, r), t instanceof ReadStream && t.isTTY && t.setRawMode(!0);
|
|
383
|
+
const n = (u, { name: a, sequence: l }) => {
|
|
384
|
+
if (H$1([
|
|
385
|
+
String(u),
|
|
386
|
+
a,
|
|
387
|
+
l
|
|
486
388
|
], "cancel")) {
|
|
487
|
-
|
|
389
|
+
i && e.write(import_src.cursor.show), process.exit(0);
|
|
488
390
|
return;
|
|
489
391
|
}
|
|
490
|
-
if (!
|
|
491
|
-
const
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
392
|
+
if (!s) return;
|
|
393
|
+
const g = a === "return" ? 0 : -1, m = a === "return" ? -1 : 0;
|
|
394
|
+
k.moveCursor(e, g, m, () => {
|
|
395
|
+
k.clearLine(e, 1, () => {
|
|
396
|
+
t.once("keypress", n);
|
|
495
397
|
});
|
|
496
398
|
});
|
|
497
399
|
};
|
|
498
|
-
return
|
|
499
|
-
|
|
400
|
+
return i && e.write(import_src.cursor.hide), t.once("keypress", n), () => {
|
|
401
|
+
t.off("keypress", n), i && e.write(import_src.cursor.show), t instanceof ReadStream && t.isTTY && !bt$1 && t.setRawMode(!1), r.terminal = !1, r.close();
|
|
500
402
|
};
|
|
501
403
|
}
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
})
|
|
404
|
+
const rt$1 = (t) => "columns" in t && typeof t.columns == "number" ? t.columns : 80, nt$1 = (t) => "rows" in t && typeof t.rows == "number" ? t.rows : 20;
|
|
405
|
+
function xt(t, e, s, i = s) {
|
|
406
|
+
return K$1(e, rt$1(t ?? stdout) - s.length, {
|
|
407
|
+
hard: !0,
|
|
408
|
+
trim: !1
|
|
409
|
+
}).split(`
|
|
410
|
+
`).map((n, u) => `${u === 0 ? i : s}${n}`).join(`
|
|
411
|
+
`);
|
|
412
|
+
}
|
|
508
413
|
var x$1 = class {
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
414
|
+
input;
|
|
415
|
+
output;
|
|
416
|
+
_abortSignal;
|
|
417
|
+
rl;
|
|
418
|
+
opts;
|
|
419
|
+
_render;
|
|
420
|
+
_track = !1;
|
|
421
|
+
_prevFrame = "";
|
|
422
|
+
_subscribers = /* @__PURE__ */ new Map();
|
|
423
|
+
_cursor = 0;
|
|
424
|
+
state = "initial";
|
|
425
|
+
error = "";
|
|
426
|
+
value;
|
|
427
|
+
userInput = "";
|
|
428
|
+
constructor(e, s = !0) {
|
|
429
|
+
const { input: i = stdin, output: r = stdout, render: n, signal: u, ...a } = e;
|
|
430
|
+
this.opts = a, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = n.bind(this), this._track = s, this._abortSignal = u, this.input = i, this.output = r;
|
|
513
431
|
}
|
|
514
432
|
unsubscribe() {
|
|
515
433
|
this._subscribers.clear();
|
|
516
434
|
}
|
|
517
|
-
setSubscriber(
|
|
518
|
-
const
|
|
519
|
-
|
|
435
|
+
setSubscriber(e, s) {
|
|
436
|
+
const i = this._subscribers.get(e) ?? [];
|
|
437
|
+
i.push(s), this._subscribers.set(e, i);
|
|
520
438
|
}
|
|
521
|
-
on(
|
|
522
|
-
this.setSubscriber(
|
|
439
|
+
on(e, s) {
|
|
440
|
+
this.setSubscriber(e, { cb: s });
|
|
523
441
|
}
|
|
524
|
-
once(
|
|
525
|
-
this.setSubscriber(
|
|
526
|
-
cb:
|
|
442
|
+
once(e, s) {
|
|
443
|
+
this.setSubscriber(e, {
|
|
444
|
+
cb: s,
|
|
527
445
|
once: !0
|
|
528
446
|
});
|
|
529
447
|
}
|
|
530
|
-
emit(
|
|
531
|
-
const
|
|
532
|
-
for (const
|
|
533
|
-
for (const
|
|
448
|
+
emit(e, ...s) {
|
|
449
|
+
const i = this._subscribers.get(e) ?? [], r = [];
|
|
450
|
+
for (const n of i) n.cb(...s), n.once && r.push(() => i.splice(i.indexOf(n), 1));
|
|
451
|
+
for (const n of r) n();
|
|
534
452
|
}
|
|
535
453
|
prompt() {
|
|
536
|
-
return new Promise((
|
|
454
|
+
return new Promise((e) => {
|
|
537
455
|
if (this._abortSignal) {
|
|
538
|
-
if (this._abortSignal.aborted) return this.state = "cancel", this.close(),
|
|
456
|
+
if (this._abortSignal.aborted) return this.state = "cancel", this.close(), e(z);
|
|
539
457
|
this._abortSignal.addEventListener("abort", () => {
|
|
540
458
|
this.state = "cancel", this.close();
|
|
541
459
|
}, { once: !0 });
|
|
542
460
|
}
|
|
543
|
-
|
|
544
|
-
F._write = (s, i, D) => {
|
|
545
|
-
this._track && (this.value = this.rl?.line.replace(/\t/g, ""), this._cursor = this.rl?.cursor ?? 0, this.emit("value", this.value)), D();
|
|
546
|
-
}, this.input.pipe(F), this.rl = O.createInterface({
|
|
461
|
+
this.rl = ot.createInterface({
|
|
547
462
|
input: this.input,
|
|
548
|
-
output: F,
|
|
549
463
|
tabSize: 2,
|
|
550
464
|
prompt: "",
|
|
551
465
|
escapeCodeTimeout: 50,
|
|
552
466
|
terminal: !0
|
|
553
|
-
}),
|
|
554
|
-
this.output.write(import_src.cursor.show), this.output.off("resize", this.render),
|
|
467
|
+
}), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, !0), this.input.on("keypress", this.onKeypress), T(this.input, !0), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
468
|
+
this.output.write(import_src.cursor.show), this.output.off("resize", this.render), T(this.input, !1), e(this.value);
|
|
555
469
|
}), this.once("cancel", () => {
|
|
556
|
-
this.output.write(import_src.cursor.show), this.output.off("resize", this.render),
|
|
470
|
+
this.output.write(import_src.cursor.show), this.output.off("resize", this.render), T(this.input, !1), e(z);
|
|
557
471
|
});
|
|
558
472
|
});
|
|
559
473
|
}
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
474
|
+
_isActionKey(e, s) {
|
|
475
|
+
return e === " ";
|
|
476
|
+
}
|
|
477
|
+
_setValue(e) {
|
|
478
|
+
this.value = e, this.emit("value", this.value);
|
|
479
|
+
}
|
|
480
|
+
_setUserInput(e, s) {
|
|
481
|
+
this.userInput = e ?? "", this.emit("userInput", this.userInput), s && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
|
|
482
|
+
}
|
|
483
|
+
_clearUserInput() {
|
|
484
|
+
this.rl?.write(null, {
|
|
485
|
+
ctrl: !0,
|
|
486
|
+
name: "u"
|
|
487
|
+
}), this._setUserInput("");
|
|
488
|
+
}
|
|
489
|
+
onKeypress(e, s) {
|
|
490
|
+
if (this._track && s.name !== "return" && (s.name && this._isActionKey(e, s) && this.rl?.write(null, {
|
|
491
|
+
ctrl: !0,
|
|
492
|
+
name: "h"
|
|
493
|
+
}), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), s?.name && (!this._track && _.aliases.has(s.name) && this.emit("cursor", _.aliases.get(s.name)), _.actions.has(s.name) && this.emit("cursor", s.name)), e && (e.toLowerCase() === "y" || e.toLowerCase() === "n") && this.emit("confirm", e.toLowerCase() === "y"), this.emit("key", e?.toLowerCase(), s), s?.name === "return") {
|
|
494
|
+
if (this.opts.validate) {
|
|
495
|
+
const i = this.opts.validate(this.value);
|
|
496
|
+
i && (this.error = i instanceof Error ? i.message : i, this.state = "error", this.rl?.write(this.userInput));
|
|
565
497
|
}
|
|
566
498
|
this.state !== "error" && (this.state = "submit");
|
|
567
499
|
}
|
|
568
|
-
$([
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
500
|
+
H$1([
|
|
501
|
+
e,
|
|
502
|
+
s?.name,
|
|
503
|
+
s?.sequence
|
|
572
504
|
], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
573
505
|
}
|
|
574
506
|
close() {
|
|
575
507
|
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
576
|
-
`),
|
|
508
|
+
`), T(this.input, !1), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
577
509
|
}
|
|
578
510
|
restoreCursor() {
|
|
579
|
-
const
|
|
511
|
+
const e = K$1(this._prevFrame, process.stdout.columns, {
|
|
512
|
+
hard: !0,
|
|
513
|
+
trim: !1
|
|
514
|
+
}).split(`
|
|
580
515
|
`).length - 1;
|
|
581
|
-
this.output.write(import_src.cursor.move(-999,
|
|
516
|
+
this.output.write(import_src.cursor.move(-999, e * -1));
|
|
582
517
|
}
|
|
583
518
|
render() {
|
|
584
|
-
const
|
|
585
|
-
|
|
519
|
+
const e = K$1(this._render(this) ?? "", process.stdout.columns, {
|
|
520
|
+
hard: !0,
|
|
521
|
+
trim: !1
|
|
522
|
+
});
|
|
523
|
+
if (e !== this._prevFrame) {
|
|
586
524
|
if (this.state === "initial") this.output.write(import_src.cursor.hide);
|
|
587
525
|
else {
|
|
588
|
-
const
|
|
589
|
-
if (this.restoreCursor(),
|
|
590
|
-
const
|
|
591
|
-
|
|
592
|
-
|
|
526
|
+
const s = _t(this._prevFrame, e), i = nt$1(this.output);
|
|
527
|
+
if (this.restoreCursor(), s) {
|
|
528
|
+
const r = Math.max(0, s.numLinesAfter - i), n = Math.max(0, s.numLinesBefore - i);
|
|
529
|
+
let u = s.lines.find((a) => a >= r);
|
|
530
|
+
if (u === void 0) {
|
|
531
|
+
this._prevFrame = e;
|
|
532
|
+
return;
|
|
533
|
+
}
|
|
534
|
+
if (s.lines.length === 1) {
|
|
535
|
+
this.output.write(import_src.cursor.move(0, u - n)), this.output.write(import_src.erase.lines(1));
|
|
536
|
+
const a = e.split(`
|
|
593
537
|
`);
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
538
|
+
this.output.write(a[u]), this._prevFrame = e, this.output.write(import_src.cursor.move(0, a.length - u - 1));
|
|
539
|
+
return;
|
|
540
|
+
} else if (s.lines.length > 1) {
|
|
541
|
+
if (r < n) u = r;
|
|
542
|
+
else {
|
|
543
|
+
const l = u - n;
|
|
544
|
+
l > 0 && this.output.write(import_src.cursor.move(0, l));
|
|
545
|
+
}
|
|
546
|
+
this.output.write(import_src.erase.down());
|
|
547
|
+
const a = e.split(`
|
|
548
|
+
`).slice(u);
|
|
549
|
+
this.output.write(a.join(`
|
|
550
|
+
`)), this._prevFrame = e;
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
605
553
|
}
|
|
606
554
|
this.output.write(import_src.erase.down());
|
|
607
555
|
}
|
|
608
|
-
this.output.write(
|
|
556
|
+
this.output.write(e), this.state === "initial" && (this.state = "active"), this._prevFrame = e;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
};
|
|
560
|
+
function wt$1(t, e) {
|
|
561
|
+
if (t === void 0 || e.length === 0) return 0;
|
|
562
|
+
const s = e.findIndex((i) => i.value === t);
|
|
563
|
+
return s !== -1 ? s : 0;
|
|
564
|
+
}
|
|
565
|
+
function Dt$1(t, e) {
|
|
566
|
+
return (e.label ?? String(e.value)).toLowerCase().includes(t.toLowerCase());
|
|
567
|
+
}
|
|
568
|
+
function St$1(t, e) {
|
|
569
|
+
if (e) return t ? e : e[0];
|
|
570
|
+
}
|
|
571
|
+
var Vt$1 = class extends x$1 {
|
|
572
|
+
filteredOptions;
|
|
573
|
+
multiple;
|
|
574
|
+
isNavigating = !1;
|
|
575
|
+
selectedValues = [];
|
|
576
|
+
focusedValue;
|
|
577
|
+
#t = 0;
|
|
578
|
+
#s = "";
|
|
579
|
+
#i;
|
|
580
|
+
#e;
|
|
581
|
+
get cursor() {
|
|
582
|
+
return this.#t;
|
|
583
|
+
}
|
|
584
|
+
get userInputWithCursor() {
|
|
585
|
+
if (!this.userInput) return import_picocolors.default.inverse(import_picocolors.default.hidden("_"));
|
|
586
|
+
if (this._cursor >= this.userInput.length) return `${this.userInput}\u2588`;
|
|
587
|
+
const e = this.userInput.slice(0, this._cursor), [s, ...i] = this.userInput.slice(this._cursor);
|
|
588
|
+
return `${e}${import_picocolors.default.inverse(s)}${i.join("")}`;
|
|
589
|
+
}
|
|
590
|
+
get options() {
|
|
591
|
+
return typeof this.#e == "function" ? this.#e() : this.#e;
|
|
592
|
+
}
|
|
593
|
+
constructor(e) {
|
|
594
|
+
super(e), this.#e = e.options;
|
|
595
|
+
const s = this.options;
|
|
596
|
+
this.filteredOptions = [...s], this.multiple = e.multiple === !0, this.#i = e.filter ?? Dt$1;
|
|
597
|
+
let i;
|
|
598
|
+
if (e.initialValue && Array.isArray(e.initialValue) ? this.multiple ? i = e.initialValue : i = e.initialValue.slice(0, 1) : !this.multiple && this.options.length > 0 && (i = [this.options[0].value]), i) for (const r of i) {
|
|
599
|
+
const n = s.findIndex((u) => u.value === r);
|
|
600
|
+
n !== -1 && (this.toggleSelected(r), this.#t = n);
|
|
601
|
+
}
|
|
602
|
+
this.focusedValue = this.options[this.#t]?.value, this.on("key", (r, n) => this.#r(r, n)), this.on("userInput", (r) => this.#n(r));
|
|
603
|
+
}
|
|
604
|
+
_isActionKey(e, s) {
|
|
605
|
+
return e === " " || this.multiple && this.isNavigating && s.name === "space" && e !== void 0 && e !== "";
|
|
606
|
+
}
|
|
607
|
+
#r(e, s) {
|
|
608
|
+
const i = s.name === "up", r = s.name === "down", n = s.name === "return";
|
|
609
|
+
i || r ? (this.#t = B(this.#t, i ? -1 : 1, this.filteredOptions), this.focusedValue = this.filteredOptions[this.#t]?.value, this.multiple || (this.selectedValues = [this.focusedValue]), this.isNavigating = !0) : n ? this.value = St$1(this.multiple, this.selectedValues) : this.multiple ? this.focusedValue !== void 0 && (s.name === "tab" || this.isNavigating && s.name === "space") ? this.toggleSelected(this.focusedValue) : this.isNavigating = !1 : (this.focusedValue && (this.selectedValues = [this.focusedValue]), this.isNavigating = !1);
|
|
610
|
+
}
|
|
611
|
+
deselectAll() {
|
|
612
|
+
this.selectedValues = [];
|
|
613
|
+
}
|
|
614
|
+
toggleSelected(e) {
|
|
615
|
+
this.filteredOptions.length !== 0 && (this.multiple ? this.selectedValues.includes(e) ? this.selectedValues = this.selectedValues.filter((s) => s !== e) : this.selectedValues = [...this.selectedValues, e] : this.selectedValues = [e]);
|
|
616
|
+
}
|
|
617
|
+
#n(e) {
|
|
618
|
+
if (e !== this.#s) {
|
|
619
|
+
this.#s = e;
|
|
620
|
+
const s = this.options;
|
|
621
|
+
e ? this.filteredOptions = s.filter((n) => this.#i(e, n)) : this.filteredOptions = [...s];
|
|
622
|
+
this.#t = B(wt$1(this.focusedValue, this.filteredOptions), 0, this.filteredOptions);
|
|
623
|
+
const r = this.filteredOptions[this.#t];
|
|
624
|
+
r && !r.disabled ? this.focusedValue = r.value : this.focusedValue = void 0, this.multiple || (this.focusedValue !== void 0 ? this.toggleSelected(this.focusedValue) : this.deselectAll());
|
|
609
625
|
}
|
|
610
626
|
}
|
|
611
627
|
};
|
|
612
|
-
var
|
|
628
|
+
var kt$1 = class extends x$1 {
|
|
613
629
|
get cursor() {
|
|
614
630
|
return this.value ? 0 : 1;
|
|
615
631
|
}
|
|
616
632
|
get _value() {
|
|
617
633
|
return this.cursor === 0;
|
|
618
634
|
}
|
|
619
|
-
constructor(
|
|
620
|
-
super(
|
|
635
|
+
constructor(e) {
|
|
636
|
+
super(e, !1), this.value = !!e.initialValue, this.on("userInput", () => {
|
|
621
637
|
this.value = this._value;
|
|
622
|
-
}), this.on("confirm", (
|
|
623
|
-
this.output.write(import_src.cursor.move(0, -1)), this.value =
|
|
638
|
+
}), this.on("confirm", (s) => {
|
|
639
|
+
this.output.write(import_src.cursor.move(0, -1)), this.value = s, this.state = "submit", this.close();
|
|
624
640
|
}), this.on("cursor", () => {
|
|
625
641
|
this.value = !this.value;
|
|
626
642
|
});
|
|
627
643
|
}
|
|
628
644
|
};
|
|
629
|
-
var
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
645
|
+
var yt$1 = class extends x$1 {
|
|
646
|
+
options;
|
|
647
|
+
cursor = 0;
|
|
648
|
+
#t;
|
|
649
|
+
getGroupItems(e) {
|
|
650
|
+
return this.options.filter((s) => s.group === e);
|
|
651
|
+
}
|
|
652
|
+
isGroupSelected(e) {
|
|
653
|
+
const s = this.getGroupItems(e), i = this.value;
|
|
654
|
+
return i === void 0 ? !1 : s.every((r) => i.includes(r.value));
|
|
655
|
+
}
|
|
656
|
+
toggleValue() {
|
|
657
|
+
const e = this.options[this.cursor];
|
|
658
|
+
if (this.value === void 0 && (this.value = []), e.group === !0) {
|
|
659
|
+
const s = e.value, i = this.getGroupItems(s);
|
|
660
|
+
this.isGroupSelected(s) ? this.value = this.value.filter((r) => i.findIndex((n) => n.value === r) === -1) : this.value = [...this.value, ...i.map((r) => r.value)], this.value = Array.from(new Set(this.value));
|
|
661
|
+
} else this.value = this.value.includes(e.value) ? this.value.filter((i) => i !== e.value) : [...this.value, e.value];
|
|
662
|
+
}
|
|
663
|
+
constructor(e) {
|
|
664
|
+
super(e, !1);
|
|
665
|
+
const { options: s } = e;
|
|
666
|
+
this.#t = e.selectableGroups !== !1, this.options = Object.entries(s).flatMap(([i, r]) => [{
|
|
667
|
+
value: i,
|
|
646
668
|
group: !0,
|
|
647
|
-
label:
|
|
648
|
-
}, ...
|
|
649
|
-
...
|
|
650
|
-
group:
|
|
651
|
-
}))]), this.value = [...
|
|
652
|
-
switch (
|
|
669
|
+
label: i
|
|
670
|
+
}, ...r.map((n) => ({
|
|
671
|
+
...n,
|
|
672
|
+
group: i
|
|
673
|
+
}))]), this.value = [...e.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: i }) => i === e.cursorAt), this.#t ? 0 : 1), this.on("cursor", (i) => {
|
|
674
|
+
switch (i) {
|
|
653
675
|
case "left":
|
|
654
676
|
case "up": {
|
|
655
677
|
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
656
|
-
const
|
|
657
|
-
!
|
|
678
|
+
const r = this.options[this.cursor]?.group === !0;
|
|
679
|
+
!this.#t && r && (this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1);
|
|
658
680
|
break;
|
|
659
681
|
}
|
|
660
682
|
case "down":
|
|
661
683
|
case "right": {
|
|
662
684
|
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
663
|
-
const
|
|
664
|
-
!
|
|
685
|
+
const r = this.options[this.cursor]?.group === !0;
|
|
686
|
+
!this.#t && r && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
|
|
665
687
|
break;
|
|
666
688
|
}
|
|
667
689
|
case "space":
|
|
@@ -670,40 +692,43 @@ let _D = class extends x$1 {
|
|
|
670
692
|
}
|
|
671
693
|
});
|
|
672
694
|
}
|
|
673
|
-
|
|
674
|
-
|
|
695
|
+
};
|
|
696
|
+
var Lt$1 = class extends x$1 {
|
|
697
|
+
options;
|
|
698
|
+
cursor = 0;
|
|
699
|
+
get _value() {
|
|
700
|
+
return this.options[this.cursor].value;
|
|
701
|
+
}
|
|
702
|
+
get _enabledOptions() {
|
|
703
|
+
return this.options.filter((e) => e.disabled !== !0);
|
|
704
|
+
}
|
|
705
|
+
toggleAll() {
|
|
706
|
+
const e = this._enabledOptions;
|
|
707
|
+
this.value = this.value !== void 0 && this.value.length === e.length ? [] : e.map((i) => i.value);
|
|
675
708
|
}
|
|
676
|
-
|
|
677
|
-
|
|
709
|
+
toggleInvert() {
|
|
710
|
+
const e = this.value;
|
|
711
|
+
if (!e) return;
|
|
712
|
+
this.value = this._enabledOptions.filter((i) => !e.includes(i.value)).map((i) => i.value);
|
|
678
713
|
}
|
|
679
714
|
toggleValue() {
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
const t = u.value, F = this.getGroupItems(t);
|
|
683
|
-
this.isGroupSelected(t) ? this.value = this.value.filter((s) => F.findIndex((i) => i.value === s) === -1) : this.value = [...this.value, ...F.map((s) => s.value)], this.value = Array.from(new Set(this.value));
|
|
684
|
-
} else this.value = this.value.includes(u.value) ? this.value.filter((F) => F !== u.value) : [...this.value, u.value];
|
|
715
|
+
this.value === void 0 && (this.value = []);
|
|
716
|
+
this.value = this.value.includes(this._value) ? this.value.filter((s) => s !== this._value) : [...this.value, this._value];
|
|
685
717
|
}
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
}) : e[u] = t, H = (e, u, t) => ($D(e, typeof u != "symbol" ? u + "" : u, t), t);
|
|
694
|
-
let SD = class extends x$1 {
|
|
695
|
-
constructor(u) {
|
|
696
|
-
super(u, !1), H(this, "options"), H(this, "cursor", 0), this.options = u.options, this.value = [...u.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: t }) => t === u.cursorAt), 0), this.on("key", (t) => {
|
|
697
|
-
t === "a" && this.toggleAll();
|
|
698
|
-
}), this.on("cursor", (t) => {
|
|
699
|
-
switch (t) {
|
|
718
|
+
constructor(e) {
|
|
719
|
+
super(e, !1), this.options = e.options, this.value = [...e.initialValues ?? []];
|
|
720
|
+
const s = Math.max(this.options.findIndex(({ value: i }) => i === e.cursorAt), 0);
|
|
721
|
+
this.cursor = this.options[s].disabled ? B(s, 1, this.options) : s, this.on("key", (i) => {
|
|
722
|
+
i === "a" && this.toggleAll(), i === "i" && this.toggleInvert();
|
|
723
|
+
}), this.on("cursor", (i) => {
|
|
724
|
+
switch (i) {
|
|
700
725
|
case "left":
|
|
701
726
|
case "up":
|
|
702
|
-
this.cursor = this.cursor
|
|
727
|
+
this.cursor = B(this.cursor, -1, this.options);
|
|
703
728
|
break;
|
|
704
729
|
case "down":
|
|
705
730
|
case "right":
|
|
706
|
-
this.cursor = this.cursor
|
|
731
|
+
this.cursor = B(this.cursor, 1, this.options);
|
|
707
732
|
break;
|
|
708
733
|
case "space":
|
|
709
734
|
this.toggleValue();
|
|
@@ -711,566 +736,1409 @@ let SD = class extends x$1 {
|
|
|
711
736
|
}
|
|
712
737
|
});
|
|
713
738
|
}
|
|
714
|
-
get _value() {
|
|
715
|
-
return this.options[this.cursor].value;
|
|
716
|
-
}
|
|
717
|
-
toggleAll() {
|
|
718
|
-
this.value = this.value.length === this.options.length ? [] : this.options.map((t) => t.value);
|
|
719
|
-
}
|
|
720
|
-
toggleValue() {
|
|
721
|
-
this.value = this.value.includes(this._value) ? this.value.filter((t) => t !== this._value) : [...this.value, this._value];
|
|
722
|
-
}
|
|
723
739
|
};
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
configurable: !0,
|
|
727
|
-
writable: !0,
|
|
728
|
-
value: t
|
|
729
|
-
}) : e[u] = t, U$1 = (e, u, t) => (jD(e, typeof u != "symbol" ? u + "" : u, t), t);
|
|
730
|
-
var MD = class extends x$1 {
|
|
731
|
-
constructor({ mask: u, ...t }) {
|
|
732
|
-
super(t), U$1(this, "valueWithCursor", ""), U$1(this, "_mask", "•"), this._mask = u ?? "•", this.on("finalize", () => {
|
|
733
|
-
this.valueWithCursor = this.masked;
|
|
734
|
-
}), this.on("value", () => {
|
|
735
|
-
if (this.cursor >= this.value.length) this.valueWithCursor = `${this.masked}${import_picocolors.default.inverse(import_picocolors.default.hidden("_"))}`;
|
|
736
|
-
else {
|
|
737
|
-
const F = this.masked.slice(0, this.cursor), s = this.masked.slice(this.cursor);
|
|
738
|
-
this.valueWithCursor = `${F}${import_picocolors.default.inverse(s[0])}${s.slice(1)}`;
|
|
739
|
-
}
|
|
740
|
-
});
|
|
741
|
-
}
|
|
740
|
+
let Mt$1 = class extends x$1 {
|
|
741
|
+
_mask = "•";
|
|
742
742
|
get cursor() {
|
|
743
743
|
return this._cursor;
|
|
744
744
|
}
|
|
745
745
|
get masked() {
|
|
746
|
-
return this.
|
|
746
|
+
return this.userInput.replaceAll(/./g, this._mask);
|
|
747
|
+
}
|
|
748
|
+
get userInputWithCursor() {
|
|
749
|
+
if (this.state === "submit" || this.state === "cancel") return this.masked;
|
|
750
|
+
const e = this.userInput;
|
|
751
|
+
if (this.cursor >= e.length) return `${this.masked}${import_picocolors.default.inverse(import_picocolors.default.hidden("_"))}`;
|
|
752
|
+
const s = this.masked, i = s.slice(0, this.cursor), r = s.slice(this.cursor);
|
|
753
|
+
return `${i}${import_picocolors.default.inverse(r[0])}${r.slice(1)}`;
|
|
754
|
+
}
|
|
755
|
+
clear() {
|
|
756
|
+
this._clearUserInput();
|
|
757
|
+
}
|
|
758
|
+
constructor({ mask: e, ...s }) {
|
|
759
|
+
super(s), this._mask = e ?? "•", this.on("userInput", (i) => {
|
|
760
|
+
this._setValue(i);
|
|
761
|
+
});
|
|
747
762
|
}
|
|
748
763
|
};
|
|
749
|
-
var
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
}
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
764
|
+
var Wt$1 = class extends x$1 {
|
|
765
|
+
options;
|
|
766
|
+
cursor = 0;
|
|
767
|
+
get _selectedValue() {
|
|
768
|
+
return this.options[this.cursor];
|
|
769
|
+
}
|
|
770
|
+
changeValue() {
|
|
771
|
+
this.value = this._selectedValue.value;
|
|
772
|
+
}
|
|
773
|
+
constructor(e) {
|
|
774
|
+
super(e, !1), this.options = e.options;
|
|
775
|
+
const s = this.options.findIndex(({ value: r }) => r === e.initialValue), i = s === -1 ? 0 : s;
|
|
776
|
+
this.cursor = this.options[i].disabled ? B(i, 1, this.options) : i, this.changeValue(), this.on("cursor", (r) => {
|
|
777
|
+
switch (r) {
|
|
759
778
|
case "left":
|
|
760
779
|
case "up":
|
|
761
|
-
this.cursor = this.cursor
|
|
780
|
+
this.cursor = B(this.cursor, -1, this.options);
|
|
762
781
|
break;
|
|
763
782
|
case "down":
|
|
764
783
|
case "right":
|
|
765
|
-
this.cursor = this.cursor
|
|
784
|
+
this.cursor = B(this.cursor, 1, this.options);
|
|
766
785
|
break;
|
|
767
786
|
}
|
|
768
787
|
this.changeValue();
|
|
769
788
|
});
|
|
770
789
|
}
|
|
771
|
-
get _value() {
|
|
772
|
-
return this.options[this.cursor];
|
|
773
|
-
}
|
|
774
|
-
changeValue() {
|
|
775
|
-
this.value = this._value.value;
|
|
776
|
-
}
|
|
777
790
|
};
|
|
778
|
-
var
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
const s = this.options.find(({ value: [i] }) => i?.toLowerCase() === F);
|
|
791
|
-
s && (this.value = s.value, this.state = "submit", this.emit("submit"));
|
|
791
|
+
var Tt$1 = class extends x$1 {
|
|
792
|
+
options;
|
|
793
|
+
cursor = 0;
|
|
794
|
+
constructor(e) {
|
|
795
|
+
super(e, !1), this.options = e.options;
|
|
796
|
+
const s = e.caseSensitive === !0, i = this.options.map(({ value: [r] }) => s ? r : r?.toLowerCase());
|
|
797
|
+
this.cursor = Math.max(i.indexOf(e.initialValue), 0), this.on("key", (r, n) => {
|
|
798
|
+
if (!r) return;
|
|
799
|
+
const u = s && n.shift ? r.toUpperCase() : r;
|
|
800
|
+
if (!i.includes(u)) return;
|
|
801
|
+
const a = this.options.find(({ value: [l] }) => s ? l === u : l?.toLowerCase() === r);
|
|
802
|
+
a && (this.value = a.value, this.state = "submit", this.emit("submit"));
|
|
792
803
|
});
|
|
793
804
|
}
|
|
794
805
|
};
|
|
795
|
-
var
|
|
796
|
-
get
|
|
797
|
-
if (this.state === "submit") return this.
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
806
|
+
var $t$1 = class extends x$1 {
|
|
807
|
+
get userInputWithCursor() {
|
|
808
|
+
if (this.state === "submit") return this.userInput;
|
|
809
|
+
const e = this.userInput;
|
|
810
|
+
if (this.cursor >= e.length) return `${this.userInput}\u2588`;
|
|
811
|
+
const s = e.slice(0, this.cursor), [i, ...r] = e.slice(this.cursor);
|
|
812
|
+
return `${s}${import_picocolors.default.inverse(i)}${r.join("")}`;
|
|
801
813
|
}
|
|
802
814
|
get cursor() {
|
|
803
815
|
return this._cursor;
|
|
804
816
|
}
|
|
805
|
-
constructor(
|
|
806
|
-
super(
|
|
807
|
-
|
|
817
|
+
constructor(e) {
|
|
818
|
+
super({
|
|
819
|
+
...e,
|
|
820
|
+
initialUserInput: e.initialUserInput ?? e.initialValue
|
|
821
|
+
}), this.on("userInput", (s) => {
|
|
822
|
+
this._setValue(s);
|
|
823
|
+
}), this.on("finalize", () => {
|
|
824
|
+
this.value || (this.value = e.defaultValue), this.value === void 0 && (this.value = "");
|
|
808
825
|
});
|
|
809
826
|
}
|
|
810
827
|
};
|
|
811
828
|
|
|
812
829
|
//#endregion
|
|
813
830
|
//#region node_modules/@clack/prompts/dist/index.mjs
|
|
814
|
-
function
|
|
815
|
-
return
|
|
831
|
+
function me() {
|
|
832
|
+
return N.platform !== "win32" ? N.env.TERM !== "linux" : !!N.env.CI || !!N.env.WT_SESSION || !!N.env.TERMINUS_SUBLIME || N.env.ConEmuTask === "{cmd::Cmder}" || N.env.TERM_PROGRAM === "Terminus-Sublime" || N.env.TERM_PROGRAM === "vscode" || N.env.TERM === "xterm-256color" || N.env.TERM === "alacritty" || N.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
816
833
|
}
|
|
817
|
-
const
|
|
834
|
+
const et = me(), ct = () => process.env.CI === "true", Mt = (t) => t.isTTY === !0, C = (t, r) => et ? t : r, Rt = C("◆", "*"), dt = C("■", "x"), $t = C("▲", "x"), V = C("◇", "o"), ht = C("┌", "T"), d = C("│", "|"), x = C("└", "—"), Ot = C("┐", "T"), Pt = C("┘", "—"), Q = C("●", ">"), H = C("○", " "), st = C("◻", "[•]"), U = C("◼", "[+]"), q = C("◻", "[ ]"), Nt = C("▪", "•"), rt = C("─", "-"), mt = C("╮", "+"), Wt = C("├", "+"), pt = C("╯", "+"), gt = C("╰", "+"), Lt = C("╭", "+"), ft = C("●", "•"), Ft = C("◆", "*"), yt = C("▲", "!"), Et = C("■", "x"), W = (t) => {
|
|
818
835
|
switch (t) {
|
|
819
836
|
case "initial":
|
|
820
|
-
case "active": return import_picocolors.default.cyan(
|
|
821
|
-
case "cancel": return import_picocolors.default.red(
|
|
822
|
-
case "error": return import_picocolors.default.yellow(
|
|
823
|
-
case "submit": return import_picocolors.default.green(
|
|
824
|
-
}
|
|
825
|
-
},
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
837
|
+
case "active": return import_picocolors.default.cyan(Rt);
|
|
838
|
+
case "cancel": return import_picocolors.default.red(dt);
|
|
839
|
+
case "error": return import_picocolors.default.yellow($t);
|
|
840
|
+
case "submit": return import_picocolors.default.green(V);
|
|
841
|
+
}
|
|
842
|
+
}, vt = (t) => {
|
|
843
|
+
switch (t) {
|
|
844
|
+
case "initial":
|
|
845
|
+
case "active": return import_picocolors.default.cyan(d);
|
|
846
|
+
case "cancel": return import_picocolors.default.red(d);
|
|
847
|
+
case "error": return import_picocolors.default.yellow(d);
|
|
848
|
+
case "submit": return import_picocolors.default.green(d);
|
|
849
|
+
}
|
|
850
|
+
}, pe = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 170 || t === 173 || t === 174 || t >= 176 && t <= 180 || t >= 182 && t <= 186 || t >= 188 && t <= 191 || t === 198 || t === 208 || t === 215 || t === 216 || t >= 222 && t <= 225 || t === 230 || t >= 232 && t <= 234 || t === 236 || t === 237 || t === 240 || t === 242 || t === 243 || t >= 247 && t <= 250 || t === 252 || t === 254 || t === 257 || t === 273 || t === 275 || t === 283 || t === 294 || t === 295 || t === 299 || t >= 305 && t <= 307 || t === 312 || t >= 319 && t <= 322 || t === 324 || t >= 328 && t <= 331 || t === 333 || t === 338 || t === 339 || t === 358 || t === 359 || t === 363 || t === 462 || t === 464 || t === 466 || t === 468 || t === 470 || t === 472 || t === 474 || t === 476 || t === 593 || t === 609 || t === 708 || t === 711 || t >= 713 && t <= 715 || t === 717 || t === 720 || t >= 728 && t <= 731 || t === 733 || t === 735 || t >= 768 && t <= 879 || t >= 913 && t <= 929 || t >= 931 && t <= 937 || t >= 945 && t <= 961 || t >= 963 && t <= 969 || t === 1025 || t >= 1040 && t <= 1103 || t === 1105 || t === 8208 || t >= 8211 && t <= 8214 || t === 8216 || t === 8217 || t === 8220 || t === 8221 || t >= 8224 && t <= 8226 || t >= 8228 && t <= 8231 || t === 8240 || t === 8242 || t === 8243 || t === 8245 || t === 8251 || t === 8254 || t === 8308 || t === 8319 || t >= 8321 && t <= 8324 || t === 8364 || t === 8451 || t === 8453 || t === 8457 || t === 8467 || t === 8470 || t === 8481 || t === 8482 || t === 8486 || t === 8491 || t === 8531 || t === 8532 || t >= 8539 && t <= 8542 || t >= 8544 && t <= 8555 || t >= 8560 && t <= 8569 || t === 8585 || t >= 8592 && t <= 8601 || t === 8632 || t === 8633 || t === 8658 || t === 8660 || t === 8679 || t === 8704 || t === 8706 || t === 8707 || t === 8711 || t === 8712 || t === 8715 || t === 8719 || t === 8721 || t === 8725 || t === 8730 || t >= 8733 && t <= 8736 || t === 8739 || t === 8741 || t >= 8743 && t <= 8748 || t === 8750 || t >= 8756 && t <= 8759 || t === 8764 || t === 8765 || t === 8776 || t === 8780 || t === 8786 || t === 8800 || t === 8801 || t >= 8804 && t <= 8807 || t === 8810 || t === 8811 || t === 8814 || t === 8815 || t === 8834 || t === 8835 || t === 8838 || t === 8839 || t === 8853 || t === 8857 || t === 8869 || t === 8895 || t === 8978 || t >= 9312 && t <= 9449 || t >= 9451 && t <= 9547 || t >= 9552 && t <= 9587 || t >= 9600 && t <= 9615 || t >= 9618 && t <= 9621 || t === 9632 || t === 9633 || t >= 9635 && t <= 9641 || t === 9650 || t === 9651 || t === 9654 || t === 9655 || t === 9660 || t === 9661 || t === 9664 || t === 9665 || t >= 9670 && t <= 9672 || t === 9675 || t >= 9678 && t <= 9681 || t >= 9698 && t <= 9701 || t === 9711 || t === 9733 || t === 9734 || t === 9737 || t === 9742 || t === 9743 || t === 9756 || t === 9758 || t === 9792 || t === 9794 || t === 9824 || t === 9825 || t >= 9827 && t <= 9829 || t >= 9831 && t <= 9834 || t === 9836 || t === 9837 || t === 9839 || t === 9886 || t === 9887 || t === 9919 || t >= 9926 && t <= 9933 || t >= 9935 && t <= 9939 || t >= 9941 && t <= 9953 || t === 9955 || t === 9960 || t === 9961 || t >= 9963 && t <= 9969 || t === 9972 || t >= 9974 && t <= 9977 || t === 9979 || t === 9980 || t === 9982 || t === 9983 || t === 10045 || t >= 10102 && t <= 10111 || t >= 11094 && t <= 11097 || t >= 12872 && t <= 12879 || t >= 57344 && t <= 63743 || t >= 65024 && t <= 65039 || t === 65533 || t >= 127232 && t <= 127242 || t >= 127248 && t <= 127277 || t >= 127280 && t <= 127337 || t >= 127344 && t <= 127373 || t === 127375 || t === 127376 || t >= 127387 && t <= 127404 || t >= 917760 && t <= 917999 || t >= 983040 && t <= 1048573 || t >= 1048576 && t <= 1114109, ge = (t) => t === 12288 || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510, fe = (t) => t >= 4352 && t <= 4447 || t === 8986 || t === 8987 || t === 9001 || t === 9002 || t >= 9193 && t <= 9196 || t === 9200 || t === 9203 || t === 9725 || t === 9726 || t === 9748 || t === 9749 || t >= 9800 && t <= 9811 || t === 9855 || t === 9875 || t === 9889 || t === 9898 || t === 9899 || t === 9917 || t === 9918 || t === 9924 || t === 9925 || t === 9934 || t === 9940 || t === 9962 || t === 9970 || t === 9971 || t === 9973 || t === 9978 || t === 9981 || t === 9989 || t === 9994 || t === 9995 || t === 10024 || t === 10060 || t === 10062 || t >= 10067 && t <= 10069 || t === 10071 || t >= 10133 && t <= 10135 || t === 10160 || t === 10175 || t === 11035 || t === 11036 || t === 11088 || t === 11093 || t >= 11904 && t <= 11929 || t >= 11931 && t <= 12019 || t >= 12032 && t <= 12245 || t >= 12272 && t <= 12287 || t >= 12289 && t <= 12350 || t >= 12353 && t <= 12438 || t >= 12441 && t <= 12543 || t >= 12549 && t <= 12591 || t >= 12593 && t <= 12686 || t >= 12688 && t <= 12771 || t >= 12783 && t <= 12830 || t >= 12832 && t <= 12871 || t >= 12880 && t <= 19903 || t >= 19968 && t <= 42124 || t >= 42128 && t <= 42182 || t >= 43360 && t <= 43388 || t >= 44032 && t <= 55203 || t >= 63744 && t <= 64255 || t >= 65040 && t <= 65049 || t >= 65072 && t <= 65106 || t >= 65108 && t <= 65126 || t >= 65128 && t <= 65131 || t >= 94176 && t <= 94180 || t === 94192 || t === 94193 || t >= 94208 && t <= 100343 || t >= 100352 && t <= 101589 || t >= 101632 && t <= 101640 || t >= 110576 && t <= 110579 || t >= 110581 && t <= 110587 || t === 110589 || t === 110590 || t >= 110592 && t <= 110882 || t === 110898 || t >= 110928 && t <= 110930 || t === 110933 || t >= 110948 && t <= 110951 || t >= 110960 && t <= 111355 || t === 126980 || t === 127183 || t === 127374 || t >= 127377 && t <= 127386 || t >= 127488 && t <= 127490 || t >= 127504 && t <= 127547 || t >= 127552 && t <= 127560 || t === 127568 || t === 127569 || t >= 127584 && t <= 127589 || t >= 127744 && t <= 127776 || t >= 127789 && t <= 127797 || t >= 127799 && t <= 127868 || t >= 127870 && t <= 127891 || t >= 127904 && t <= 127946 || t >= 127951 && t <= 127955 || t >= 127968 && t <= 127984 || t === 127988 || t >= 127992 && t <= 128062 || t === 128064 || t >= 128066 && t <= 128252 || t >= 128255 && t <= 128317 || t >= 128331 && t <= 128334 || t >= 128336 && t <= 128359 || t === 128378 || t === 128405 || t === 128406 || t === 128420 || t >= 128507 && t <= 128591 || t >= 128640 && t <= 128709 || t === 128716 || t >= 128720 && t <= 128722 || t >= 128725 && t <= 128727 || t >= 128732 && t <= 128735 || t === 128747 || t === 128748 || t >= 128756 && t <= 128764 || t >= 128992 && t <= 129003 || t === 129008 || t >= 129292 && t <= 129338 || t >= 129340 && t <= 129349 || t >= 129351 && t <= 129535 || t >= 129648 && t <= 129660 || t >= 129664 && t <= 129672 || t >= 129680 && t <= 129725 || t >= 129727 && t <= 129733 || t >= 129742 && t <= 129755 || t >= 129760 && t <= 129768 || t >= 129776 && t <= 129784 || t >= 131072 && t <= 196605 || t >= 196608 && t <= 262141, At = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y, it = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y, nt = /\t{1,1000}/y, wt = /[\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?))*/uy, at = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y, Fe = /\p{M}+/gu, ye = {
|
|
851
|
+
limit: Infinity,
|
|
852
|
+
ellipsis: ""
|
|
853
|
+
}, jt = (t, r = {}, s = {}) => {
|
|
854
|
+
const i = r.limit ?? Infinity, a = r.ellipsis ?? "", o = r?.ellipsisWidth ?? (a ? jt(a, ye, s).width : 0), u = s.ansiWidth ?? 0, l = s.controlWidth ?? 0, n = s.tabWidth ?? 8, c = s.ambiguousWidth ?? 1, g = s.emojiWidth ?? 2, F = s.fullWidthWidth ?? 2, p = s.regularWidth ?? 1, E = s.wideWidth ?? 2;
|
|
855
|
+
let $ = 0, m = 0, h = t.length, y = 0, f = !1, v = h, S = Math.max(0, i - o), I = 0, B = 0, A = 0, w = 0;
|
|
856
|
+
t: for (;;) {
|
|
857
|
+
if (B > I || m >= h && m > $) {
|
|
858
|
+
const _ = t.slice(I, B) || t.slice($, m);
|
|
859
|
+
y = 0;
|
|
860
|
+
for (const D of _.replaceAll(Fe, "")) {
|
|
861
|
+
const T = D.codePointAt(0) || 0;
|
|
862
|
+
if (ge(T) ? w = F : fe(T) ? w = E : c !== p && pe(T) ? w = c : w = p, A + w > S && (v = Math.min(v, Math.max(I, $) + y)), A + w > i) {
|
|
863
|
+
f = !0;
|
|
864
|
+
break t;
|
|
865
|
+
}
|
|
866
|
+
y += D.length, A += w;
|
|
867
|
+
}
|
|
868
|
+
I = B = 0;
|
|
869
|
+
}
|
|
870
|
+
if (m >= h) break;
|
|
871
|
+
if (at.lastIndex = m, at.test(t)) {
|
|
872
|
+
if (y = at.lastIndex - m, w = y * p, A + w > S && (v = Math.min(v, m + Math.floor((S - A) / p))), A + w > i) {
|
|
873
|
+
f = !0;
|
|
874
|
+
break;
|
|
875
|
+
}
|
|
876
|
+
A += w, I = $, B = m, m = $ = at.lastIndex;
|
|
877
|
+
continue;
|
|
878
|
+
}
|
|
879
|
+
if (At.lastIndex = m, At.test(t)) {
|
|
880
|
+
if (A + u > S && (v = Math.min(v, m)), A + u > i) {
|
|
881
|
+
f = !0;
|
|
882
|
+
break;
|
|
883
|
+
}
|
|
884
|
+
A += u, I = $, B = m, m = $ = At.lastIndex;
|
|
885
|
+
continue;
|
|
886
|
+
}
|
|
887
|
+
if (it.lastIndex = m, it.test(t)) {
|
|
888
|
+
if (y = it.lastIndex - m, w = y * l, A + w > S && (v = Math.min(v, m + Math.floor((S - A) / l))), A + w > i) {
|
|
889
|
+
f = !0;
|
|
890
|
+
break;
|
|
891
|
+
}
|
|
892
|
+
A += w, I = $, B = m, m = $ = it.lastIndex;
|
|
893
|
+
continue;
|
|
894
|
+
}
|
|
895
|
+
if (nt.lastIndex = m, nt.test(t)) {
|
|
896
|
+
if (y = nt.lastIndex - m, w = y * n, A + w > S && (v = Math.min(v, m + Math.floor((S - A) / n))), A + w > i) {
|
|
897
|
+
f = !0;
|
|
898
|
+
break;
|
|
899
|
+
}
|
|
900
|
+
A += w, I = $, B = m, m = $ = nt.lastIndex;
|
|
901
|
+
continue;
|
|
902
|
+
}
|
|
903
|
+
if (wt.lastIndex = m, wt.test(t)) {
|
|
904
|
+
if (A + g > S && (v = Math.min(v, m)), A + g > i) {
|
|
905
|
+
f = !0;
|
|
906
|
+
break;
|
|
907
|
+
}
|
|
908
|
+
A += g, I = $, B = m, m = $ = wt.lastIndex;
|
|
909
|
+
continue;
|
|
910
|
+
}
|
|
911
|
+
m += 1;
|
|
912
|
+
}
|
|
913
|
+
return {
|
|
914
|
+
width: f ? S : A,
|
|
915
|
+
index: f ? v : h,
|
|
916
|
+
truncated: f,
|
|
917
|
+
ellipsed: f && i >= o
|
|
918
|
+
};
|
|
919
|
+
}, Ee = {
|
|
920
|
+
limit: Infinity,
|
|
921
|
+
ellipsis: "",
|
|
922
|
+
ellipsisWidth: 0
|
|
923
|
+
}, M = (t, r = {}) => jt(t, Ee, r).width, ot$1 = "\x1B", Gt = "", ve = 39, Ct = "\x07", kt = "[", Ae = "]", Vt = "m", St = `${Ae}8;;`, Ht = new RegExp(`(?:\\${kt}(?<code>\\d+)m|\\${St}(?<uri>.*)${Ct})`, "y"), we = (t) => {
|
|
924
|
+
if (t >= 30 && t <= 37 || t >= 90 && t <= 97) return 39;
|
|
925
|
+
if (t >= 40 && t <= 47 || t >= 100 && t <= 107) return 49;
|
|
926
|
+
if (t === 1 || t === 2) return 22;
|
|
927
|
+
if (t === 3) return 23;
|
|
928
|
+
if (t === 4) return 24;
|
|
929
|
+
if (t === 7) return 27;
|
|
930
|
+
if (t === 8) return 28;
|
|
931
|
+
if (t === 9) return 29;
|
|
932
|
+
if (t === 0) return 0;
|
|
933
|
+
}, Ut = (t) => `${ot$1}${kt}${t}${Vt}`, Kt = (t) => `${ot$1}${St}${t}${Ct}`, Ce = (t) => t.map((r) => M(r)), It = (t, r, s) => {
|
|
934
|
+
const i = r[Symbol.iterator]();
|
|
935
|
+
let a = !1, o = !1, u = t.at(-1), l = u === void 0 ? 0 : M(u), n = i.next(), c = i.next(), g = 0;
|
|
936
|
+
for (; !n.done;) {
|
|
937
|
+
const F = n.value, p = M(F);
|
|
938
|
+
l + p <= s ? t[t.length - 1] += F : (t.push(F), l = 0), (F === ot$1 || F === Gt) && (a = !0, o = r.startsWith(St, g + 1)), a ? o ? F === Ct && (a = !1, o = !1) : F === Vt && (a = !1) : (l += p, l === s && !c.done && (t.push(""), l = 0)), n = c, c = i.next(), g += F.length;
|
|
939
|
+
}
|
|
940
|
+
u = t.at(-1), !l && u !== void 0 && u.length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
|
|
941
|
+
}, Se = (t) => {
|
|
942
|
+
const r = t.split(" ");
|
|
943
|
+
let s = r.length;
|
|
944
|
+
for (; s > 0 && !(M(r[s - 1]) > 0);) s--;
|
|
945
|
+
return s === r.length ? t : r.slice(0, s).join(" ") + r.slice(s).join("");
|
|
946
|
+
}, Ie = (t, r, s = {}) => {
|
|
947
|
+
if (s.trim !== !1 && t.trim() === "") return "";
|
|
948
|
+
let i = "", a, o;
|
|
949
|
+
const u = t.split(" "), l = Ce(u);
|
|
950
|
+
let n = [""];
|
|
951
|
+
for (const [$, m] of u.entries()) {
|
|
952
|
+
s.trim !== !1 && (n[n.length - 1] = (n.at(-1) ?? "").trimStart());
|
|
953
|
+
let h = M(n.at(-1) ?? "");
|
|
954
|
+
if ($ !== 0 && (h >= r && (s.wordWrap === !1 || s.trim === !1) && (n.push(""), h = 0), (h > 0 || s.trim === !1) && (n[n.length - 1] += " ", h++)), s.hard && l[$] > r) {
|
|
955
|
+
const y = r - h, f = 1 + Math.floor((l[$] - y - 1) / r);
|
|
956
|
+
Math.floor((l[$] - 1) / r) < f && n.push(""), It(n, m, r);
|
|
957
|
+
continue;
|
|
958
|
+
}
|
|
959
|
+
if (h + l[$] > r && h > 0 && l[$] > 0) {
|
|
960
|
+
if (s.wordWrap === !1 && h < r) {
|
|
961
|
+
It(n, m, r);
|
|
962
|
+
continue;
|
|
963
|
+
}
|
|
964
|
+
n.push("");
|
|
965
|
+
}
|
|
966
|
+
if (h + l[$] > r && s.wordWrap === !1) {
|
|
967
|
+
It(n, m, r);
|
|
968
|
+
continue;
|
|
969
|
+
}
|
|
970
|
+
n[n.length - 1] += m;
|
|
971
|
+
}
|
|
972
|
+
s.trim !== !1 && (n = n.map(($) => Se($)));
|
|
973
|
+
const c = n.join(`
|
|
974
|
+
`), g = c[Symbol.iterator]();
|
|
975
|
+
let F = g.next(), p = g.next(), E = 0;
|
|
976
|
+
for (; !F.done;) {
|
|
977
|
+
const $ = F.value, m = p.value;
|
|
978
|
+
if (i += $, $ === ot$1 || $ === Gt) {
|
|
979
|
+
Ht.lastIndex = E + 1;
|
|
980
|
+
const f = Ht.exec(c)?.groups;
|
|
981
|
+
if (f?.code !== void 0) {
|
|
982
|
+
const v = Number.parseFloat(f.code);
|
|
983
|
+
a = v === ve ? void 0 : v;
|
|
984
|
+
} else f?.uri !== void 0 && (o = f.uri.length === 0 ? void 0 : f.uri);
|
|
854
985
|
}
|
|
986
|
+
const h = a ? we(a) : void 0;
|
|
987
|
+
m === `
|
|
988
|
+
` ? (o && (i += Kt("")), a && h && (i += Ut(h))) : $ === `
|
|
989
|
+
` && (a && h && (i += Ut(a)), o && (i += Kt(o))), E += $.length, F = p, p = g.next();
|
|
990
|
+
}
|
|
991
|
+
return i;
|
|
992
|
+
};
|
|
993
|
+
function J(t, r, s) {
|
|
994
|
+
return String(t).normalize().replaceAll(`\r
|
|
995
|
+
`, `
|
|
996
|
+
`).split(`
|
|
997
|
+
`).map((i) => Ie(i, r, s)).join(`
|
|
998
|
+
`);
|
|
999
|
+
}
|
|
1000
|
+
const be = (t, r, s, i, a) => {
|
|
1001
|
+
let o = r, u = 0;
|
|
1002
|
+
for (let l = s; l < i; l++) {
|
|
1003
|
+
const n = t[l];
|
|
1004
|
+
if (o = o - n.length, u++, o <= a) break;
|
|
855
1005
|
}
|
|
856
|
-
|
|
1006
|
+
return {
|
|
1007
|
+
lineCount: o,
|
|
1008
|
+
removals: u
|
|
1009
|
+
};
|
|
1010
|
+
}, X = (t) => {
|
|
1011
|
+
const { cursor: r, options: s, style: i } = t, a = t.output ?? process.stdout, o = rt$1(a), u = t.columnPadding ?? 0, l = t.rowPadding ?? 4, n = o - u, c = nt$1(a), g = import_picocolors.default.dim("..."), F = t.maxItems ?? Number.POSITIVE_INFINITY, p = Math.max(c - l, 0), E = Math.max(Math.min(F, p), 5);
|
|
1012
|
+
let $ = 0;
|
|
1013
|
+
r >= E - 3 && ($ = Math.max(Math.min(r - E + 3, s.length - E), 0));
|
|
1014
|
+
let m = E < s.length && $ > 0, h = E < s.length && $ + E < s.length;
|
|
1015
|
+
const y = Math.min($ + E, s.length), f = [];
|
|
1016
|
+
let v = 0;
|
|
1017
|
+
m && v++, h && v++;
|
|
1018
|
+
const S = $ + (m ? 1 : 0), I = y - (h ? 1 : 0);
|
|
1019
|
+
for (let A = S; A < I; A++) {
|
|
1020
|
+
const w = J(i(s[A], A === r), n, {
|
|
1021
|
+
hard: !0,
|
|
1022
|
+
trim: !1
|
|
1023
|
+
}).split(`
|
|
1024
|
+
`);
|
|
1025
|
+
f.push(w), v += w.length;
|
|
1026
|
+
}
|
|
1027
|
+
if (v > p) {
|
|
1028
|
+
let A = 0, w = 0, _ = v;
|
|
1029
|
+
const D = r - S, T = (Y, L) => be(f, _, Y, L, p);
|
|
1030
|
+
m ? ({lineCount: _, removals: A} = T(0, D), _ > p && ({lineCount: _, removals: w} = T(D + 1, f.length))) : ({lineCount: _, removals: w} = T(D + 1, f.length), _ > p && ({lineCount: _, removals: A} = T(0, D))), A > 0 && (m = !0, f.splice(0, A)), w > 0 && (h = !0, f.splice(f.length - w, w));
|
|
1031
|
+
}
|
|
1032
|
+
const B = [];
|
|
1033
|
+
m && B.push(g);
|
|
1034
|
+
for (const A of f) for (const w of A) B.push(w);
|
|
1035
|
+
return h && B.push(g), B;
|
|
1036
|
+
};
|
|
1037
|
+
function qt(t) {
|
|
1038
|
+
return t.label ?? String(t.value ?? "");
|
|
1039
|
+
}
|
|
1040
|
+
function Jt(t, r) {
|
|
1041
|
+
if (!t) return !0;
|
|
1042
|
+
const s = (r.label ?? String(r.value ?? "")).toLowerCase(), i = (r.hint ?? "").toLowerCase(), a = String(r.value).toLowerCase(), o = t.toLowerCase();
|
|
1043
|
+
return s.includes(o) || i.includes(o) || a.includes(o);
|
|
1044
|
+
}
|
|
1045
|
+
function Be(t, r) {
|
|
1046
|
+
const s = [];
|
|
1047
|
+
for (const i of r) t.includes(i.value) && s.push(i);
|
|
1048
|
+
return s;
|
|
1049
|
+
}
|
|
1050
|
+
const Xt = (t) => new Vt$1({
|
|
1051
|
+
options: t.options,
|
|
1052
|
+
initialValue: t.initialValue ? [t.initialValue] : void 0,
|
|
1053
|
+
initialUserInput: t.initialUserInput,
|
|
1054
|
+
filter: t.filter ?? ((r, s) => Jt(r, s)),
|
|
1055
|
+
signal: t.signal,
|
|
1056
|
+
input: t.input,
|
|
1057
|
+
output: t.output,
|
|
857
1058
|
validate: t.validate,
|
|
858
|
-
mask: t.mask ?? $e,
|
|
859
1059
|
render() {
|
|
860
|
-
const
|
|
861
|
-
|
|
862
|
-
|
|
1060
|
+
const r = t.withGuide ?? _.withGuide, s = r ? [`${import_picocolors.default.gray(d)}`, `${W(this.state)} ${t.message}`] : [`${W(this.state)} ${t.message}`], i = this.userInput, a = this.options, o = t.placeholder, u = i === "" && o !== void 0, l = (n, c) => {
|
|
1061
|
+
const g = qt(n), F = n.hint && n.value === this.focusedValue ? import_picocolors.default.dim(` (${n.hint})`) : "";
|
|
1062
|
+
switch (c) {
|
|
1063
|
+
case "active": return `${import_picocolors.default.green(Q)} ${g}${F}`;
|
|
1064
|
+
case "inactive": return `${import_picocolors.default.dim(H)} ${import_picocolors.default.dim(g)}`;
|
|
1065
|
+
case "disabled": return `${import_picocolors.default.gray(H)} ${import_picocolors.default.strikethrough(import_picocolors.default.gray(g))}`;
|
|
1066
|
+
}
|
|
1067
|
+
};
|
|
863
1068
|
switch (this.state) {
|
|
864
|
-
case "
|
|
865
|
-
${import_picocolors.default.
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
1069
|
+
case "submit": {
|
|
1070
|
+
const n = Be(this.selectedValues, a), c = n.length > 0 ? ` ${import_picocolors.default.dim(n.map(qt).join(", "))}` : "", g = r ? import_picocolors.default.gray(d) : "";
|
|
1071
|
+
return `${s.join(`
|
|
1072
|
+
`)}
|
|
1073
|
+
${g}${c}`;
|
|
1074
|
+
}
|
|
1075
|
+
case "cancel": {
|
|
1076
|
+
const n = i ? ` ${import_picocolors.default.strikethrough(import_picocolors.default.dim(i))}` : "", c = r ? import_picocolors.default.gray(d) : "";
|
|
1077
|
+
return `${s.join(`
|
|
1078
|
+
`)}
|
|
1079
|
+
${c}${n}`;
|
|
1080
|
+
}
|
|
1081
|
+
default: {
|
|
1082
|
+
const n = this.state === "error" ? import_picocolors.default.yellow : import_picocolors.default.cyan, c = r ? `${n(d)} ` : "", g = r ? n(x) : "";
|
|
1083
|
+
let F = "";
|
|
1084
|
+
if (this.isNavigating || u) {
|
|
1085
|
+
const f = u ? o : i;
|
|
1086
|
+
F = f !== "" ? ` ${import_picocolors.default.dim(f)}` : "";
|
|
1087
|
+
} else F = ` ${this.userInputWithCursor}`;
|
|
1088
|
+
const p = this.filteredOptions.length !== a.length ? import_picocolors.default.dim(` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? "" : "es"})`) : "", E = this.filteredOptions.length === 0 && i ? [`${c}${import_picocolors.default.yellow("No matches found")}`] : [], $ = this.state === "error" ? [`${c}${import_picocolors.default.yellow(this.error)}`] : [];
|
|
1089
|
+
r && s.push(`${c.trimEnd()}`), s.push(`${c}${import_picocolors.default.dim("Search:")}${F}${p}`, ...E, ...$);
|
|
1090
|
+
const h = [`${c}${[
|
|
1091
|
+
`${import_picocolors.default.dim("↑/↓")} to select`,
|
|
1092
|
+
`${import_picocolors.default.dim("Enter:")} confirm`,
|
|
1093
|
+
`${import_picocolors.default.dim("Type:")} to search`
|
|
1094
|
+
].join(" • ")}`, g], y = this.filteredOptions.length === 0 ? [] : X({
|
|
1095
|
+
cursor: this.cursor,
|
|
1096
|
+
options: this.filteredOptions,
|
|
1097
|
+
columnPadding: r ? 3 : 0,
|
|
1098
|
+
rowPadding: s.length + h.length,
|
|
1099
|
+
style: (f, v) => l(f, f.disabled ? "disabled" : v ? "active" : "inactive"),
|
|
1100
|
+
maxItems: t.maxItems,
|
|
1101
|
+
output: t.output
|
|
1102
|
+
});
|
|
1103
|
+
return [
|
|
1104
|
+
...s,
|
|
1105
|
+
...y.map((f) => `${c}${f}`),
|
|
1106
|
+
...h
|
|
1107
|
+
].join(`
|
|
1108
|
+
`);
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
}
|
|
1112
|
+
}).prompt(), xe = (t) => {
|
|
1113
|
+
const r = (i, a, o, u) => {
|
|
1114
|
+
const l = o.includes(i.value), n = i.label ?? String(i.value ?? ""), c = i.hint && u !== void 0 && i.value === u ? import_picocolors.default.dim(` (${i.hint})`) : "", g = l ? import_picocolors.default.green(U) : import_picocolors.default.dim(q);
|
|
1115
|
+
return i.disabled ? `${import_picocolors.default.gray(q)} ${import_picocolors.default.strikethrough(import_picocolors.default.gray(n))}` : a ? `${g} ${n}${c}` : `${g} ${import_picocolors.default.dim(n)}`;
|
|
1116
|
+
}, s = new Vt$1({
|
|
1117
|
+
options: t.options,
|
|
1118
|
+
multiple: !0,
|
|
1119
|
+
filter: t.filter ?? ((i, a) => Jt(i, a)),
|
|
1120
|
+
validate: () => {
|
|
1121
|
+
if (t.required && s.selectedValues.length === 0) return "Please select at least one item";
|
|
1122
|
+
},
|
|
1123
|
+
initialValue: t.initialValues,
|
|
1124
|
+
signal: t.signal,
|
|
1125
|
+
input: t.input,
|
|
1126
|
+
output: t.output,
|
|
1127
|
+
render() {
|
|
1128
|
+
const i = `${import_picocolors.default.gray(d)}
|
|
1129
|
+
${W(this.state)} ${t.message}
|
|
1130
|
+
`, a = this.userInput, o = t.placeholder, u = a === "" && o !== void 0, l = this.isNavigating || u ? import_picocolors.default.dim(u ? o : a) : this.userInputWithCursor, n = this.options, c = this.filteredOptions.length !== n.length ? import_picocolors.default.dim(` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? "" : "es"})`) : "";
|
|
1131
|
+
switch (this.state) {
|
|
1132
|
+
case "submit": return `${i}${import_picocolors.default.gray(d)} ${import_picocolors.default.dim(`${this.selectedValues.length} items selected`)}`;
|
|
1133
|
+
case "cancel": return `${i}${import_picocolors.default.gray(d)} ${import_picocolors.default.strikethrough(import_picocolors.default.dim(a))}`;
|
|
1134
|
+
default: {
|
|
1135
|
+
const g = this.state === "error" ? import_picocolors.default.yellow : import_picocolors.default.cyan, F = [
|
|
1136
|
+
`${import_picocolors.default.dim("↑/↓")} to navigate`,
|
|
1137
|
+
`${import_picocolors.default.dim(this.isNavigating ? "Space/Tab:" : "Tab:")} select`,
|
|
1138
|
+
`${import_picocolors.default.dim("Enter:")} confirm`,
|
|
1139
|
+
`${import_picocolors.default.dim("Type:")} to search`
|
|
1140
|
+
], p = this.filteredOptions.length === 0 && a ? [`${g(d)} ${import_picocolors.default.yellow("No matches found")}`] : [], E = this.state === "error" ? [`${g(d)} ${import_picocolors.default.yellow(this.error)}`] : [], $ = [
|
|
1141
|
+
...`${i}${g(d)}`.split(`
|
|
1142
|
+
`),
|
|
1143
|
+
`${g(d)} ${import_picocolors.default.dim("Search:")} ${l}${c}`,
|
|
1144
|
+
...p,
|
|
1145
|
+
...E
|
|
1146
|
+
], m = [`${g(d)} ${F.join(" • ")}`, `${g(x)}`], h = X({
|
|
1147
|
+
cursor: this.cursor,
|
|
1148
|
+
options: this.filteredOptions,
|
|
1149
|
+
style: (y, f) => r(y, f, this.selectedValues, this.focusedValue),
|
|
1150
|
+
maxItems: t.maxItems,
|
|
1151
|
+
output: t.output,
|
|
1152
|
+
rowPadding: $.length + m.length
|
|
1153
|
+
});
|
|
1154
|
+
return [
|
|
1155
|
+
...$,
|
|
1156
|
+
...h.map((y) => `${g(d)} ${y}`),
|
|
1157
|
+
...m
|
|
1158
|
+
].join(`
|
|
1159
|
+
`);
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
});
|
|
1164
|
+
return s.prompt();
|
|
1165
|
+
}, _e = [
|
|
1166
|
+
Lt,
|
|
1167
|
+
mt,
|
|
1168
|
+
gt,
|
|
1169
|
+
pt
|
|
1170
|
+
], De = [
|
|
1171
|
+
ht,
|
|
1172
|
+
Ot,
|
|
1173
|
+
x,
|
|
1174
|
+
Pt
|
|
1175
|
+
];
|
|
1176
|
+
function Yt(t, r, s, i) {
|
|
1177
|
+
let a = s, o = s;
|
|
1178
|
+
return i === "center" ? a = Math.floor((r - t) / 2) : i === "right" && (a = r - t - s), o = r - a - t, [a, o];
|
|
1179
|
+
}
|
|
1180
|
+
const Te = (t) => t, Me = (t = "", r = "", s) => {
|
|
1181
|
+
const i = s?.output ?? process.stdout, a = rt$1(i), o = 2, u = s?.titlePadding ?? 1, l = s?.contentPadding ?? 2, n = s?.width === void 0 || s.width === "auto" ? 1 : Math.min(1, s.width), c = s?.withGuide ?? _.withGuide ? `${d} ` : "", g = s?.formatBorder ?? Te, F = (s?.rounded ? _e : De).map(g), p = g(rt), E = g(d), $ = M(c), m = M(r), h = a - $;
|
|
1182
|
+
let y = Math.floor(a * n) - $;
|
|
1183
|
+
if (s?.width === "auto") {
|
|
1184
|
+
const _ = t.split(`
|
|
1185
|
+
`);
|
|
1186
|
+
let D = m + u * 2;
|
|
1187
|
+
for (const Y of _) {
|
|
1188
|
+
const L = M(Y) + l * 2;
|
|
1189
|
+
L > D && (D = L);
|
|
874
1190
|
}
|
|
1191
|
+
const T = D + o;
|
|
1192
|
+
T < y && (y = T);
|
|
875
1193
|
}
|
|
876
|
-
|
|
877
|
-
const
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
1194
|
+
y % 2 !== 0 && (y < h ? y++ : y--);
|
|
1195
|
+
const f = y - o, v = f - u * 2, S = m > v ? `${r.slice(0, v - 3)}...` : r, [I, B] = Yt(M(S), f, u, s?.titleAlign), A = J(t, f - l * 2, {
|
|
1196
|
+
hard: !0,
|
|
1197
|
+
trim: !1
|
|
1198
|
+
});
|
|
1199
|
+
i.write(`${c}${F[0]}${p.repeat(I)}${S}${p.repeat(B)}${F[1]}
|
|
1200
|
+
`);
|
|
1201
|
+
const w = A.split(`
|
|
1202
|
+
`);
|
|
1203
|
+
for (const _ of w) {
|
|
1204
|
+
const [D, T] = Yt(M(_), f, l, s?.contentAlign);
|
|
1205
|
+
i.write(`${c}${E}${" ".repeat(D)}${_}${" ".repeat(T)}${E}
|
|
1206
|
+
`);
|
|
1207
|
+
}
|
|
1208
|
+
i.write(`${c}${F[2]}${p.repeat(f)}${F[3]}
|
|
1209
|
+
`);
|
|
1210
|
+
}, Re = (t) => {
|
|
1211
|
+
const r = t.active ?? "Yes", s = t.inactive ?? "No";
|
|
1212
|
+
return new kt$1({
|
|
1213
|
+
active: r,
|
|
1214
|
+
inactive: s,
|
|
1215
|
+
signal: t.signal,
|
|
1216
|
+
input: t.input,
|
|
1217
|
+
output: t.output,
|
|
881
1218
|
initialValue: t.initialValue ?? !0,
|
|
882
1219
|
render() {
|
|
883
|
-
const i = `${import_picocolors.default.gray(
|
|
884
|
-
${
|
|
885
|
-
`,
|
|
1220
|
+
const i = t.withGuide ?? _.withGuide, a = `${i ? `${import_picocolors.default.gray(d)}
|
|
1221
|
+
` : ""}${W(this.state)} ${t.message}
|
|
1222
|
+
`, o = this.value ? r : s;
|
|
886
1223
|
switch (this.state) {
|
|
887
|
-
case "submit": return `${
|
|
888
|
-
case "cancel": return `${
|
|
889
|
-
${import_picocolors.default.gray(
|
|
890
|
-
default:
|
|
891
|
-
|
|
1224
|
+
case "submit": return `${a}${i ? `${import_picocolors.default.gray(d)} ` : ""}${import_picocolors.default.dim(o)}`;
|
|
1225
|
+
case "cancel": return `${a}${i ? `${import_picocolors.default.gray(d)} ` : ""}${import_picocolors.default.strikethrough(import_picocolors.default.dim(o))}${i ? `
|
|
1226
|
+
${import_picocolors.default.gray(d)}` : ""}`;
|
|
1227
|
+
default: {
|
|
1228
|
+
const u = i ? `${import_picocolors.default.cyan(d)} ` : "", l = i ? import_picocolors.default.cyan(x) : "";
|
|
1229
|
+
return `${a}${u}${this.value ? `${import_picocolors.default.green(Q)} ${r}` : `${import_picocolors.default.dim(H)} ${import_picocolors.default.dim(r)}`}${t.vertical ? i ? `
|
|
1230
|
+
${import_picocolors.default.cyan(d)} ` : `
|
|
1231
|
+
` : ` ${import_picocolors.default.dim("/")} `}${this.value ? `${import_picocolors.default.dim(H)} ${import_picocolors.default.dim(s)}` : `${import_picocolors.default.green(Q)} ${s}`}
|
|
1232
|
+
${l}
|
|
892
1233
|
`;
|
|
1234
|
+
}
|
|
893
1235
|
}
|
|
894
1236
|
}
|
|
895
1237
|
}).prompt();
|
|
896
|
-
},
|
|
897
|
-
const
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
1238
|
+
}, Oe = async (t, r) => {
|
|
1239
|
+
const s = {}, i = Object.keys(t);
|
|
1240
|
+
for (const a of i) {
|
|
1241
|
+
const o = t[a], u = await o({ results: s })?.catch((l) => {
|
|
1242
|
+
throw l;
|
|
1243
|
+
});
|
|
1244
|
+
if (typeof r?.onCancel == "function" && Ct$1(u)) {
|
|
1245
|
+
s[a] = "canceled", r.onCancel({ results: s });
|
|
1246
|
+
continue;
|
|
904
1247
|
}
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
${import_picocolors.default.gray(o)}`;
|
|
917
|
-
default: return `${r}${import_picocolors.default.cyan(o)} ${G({
|
|
918
|
-
cursor: this.cursor,
|
|
919
|
-
options: this.options,
|
|
920
|
-
maxItems: t.maxItems,
|
|
921
|
-
style: (i, s) => n(i, s ? "active" : "inactive")
|
|
922
|
-
}).join(`
|
|
923
|
-
${import_picocolors.default.cyan(o)} `)}
|
|
924
|
-
${import_picocolors.default.cyan(d)}
|
|
925
|
-
`;
|
|
926
|
-
}
|
|
1248
|
+
s[a] = u;
|
|
1249
|
+
}
|
|
1250
|
+
return s;
|
|
1251
|
+
}, Pe = (t) => {
|
|
1252
|
+
const { selectableGroups: r = !0, groupSpacing: s = 0 } = t, i = (o, u, l = []) => {
|
|
1253
|
+
const n = o.label ?? String(o.value), c = typeof o.group == "string", g = c && (l[l.indexOf(o) + 1] ?? { group: !0 }), F = c && g && g.group === !0, p = c ? r ? `${F ? x : d} ` : " " : "";
|
|
1254
|
+
let E = "";
|
|
1255
|
+
if (s > 0 && !c) {
|
|
1256
|
+
const m = `
|
|
1257
|
+
${import_picocolors.default.cyan(d)}`;
|
|
1258
|
+
E = `${m.repeat(s - 1)}${m} `;
|
|
927
1259
|
}
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
return new ID({
|
|
935
|
-
options: t.options,
|
|
936
|
-
initialValue: t.initialValue,
|
|
937
|
-
render() {
|
|
938
|
-
const r = `${import_picocolors.default.gray(o)}
|
|
939
|
-
${b(this.state)} ${t.message}
|
|
940
|
-
`;
|
|
941
|
-
switch (this.state) {
|
|
942
|
-
case "submit": return `${r}${import_picocolors.default.gray(o)} ${n(this.options.find((i) => i.value === this.value) ?? t.options[0], "selected")}`;
|
|
943
|
-
case "cancel": return `${r}${import_picocolors.default.gray(o)} ${n(this.options[0], "cancelled")}
|
|
944
|
-
${import_picocolors.default.gray(o)}`;
|
|
945
|
-
default: return `${r}${import_picocolors.default.cyan(o)} ${this.options.map((i, s) => n(i, s === this.cursor ? "active" : "inactive")).join(`
|
|
946
|
-
${import_picocolors.default.cyan(o)} `)}
|
|
947
|
-
${import_picocolors.default.cyan(d)}
|
|
948
|
-
`;
|
|
949
|
-
}
|
|
1260
|
+
if (u === "active") return `${E}${import_picocolors.default.dim(p)}${import_picocolors.default.cyan(st)} ${n}${o.hint ? ` ${import_picocolors.default.dim(`(${o.hint})`)}` : ""}`;
|
|
1261
|
+
if (u === "group-active") return `${E}${p}${import_picocolors.default.cyan(st)} ${import_picocolors.default.dim(n)}`;
|
|
1262
|
+
if (u === "group-active-selected") return `${E}${p}${import_picocolors.default.green(U)} ${import_picocolors.default.dim(n)}`;
|
|
1263
|
+
if (u === "selected") {
|
|
1264
|
+
const m = c || r ? import_picocolors.default.green(U) : "";
|
|
1265
|
+
return `${E}${import_picocolors.default.dim(p)}${m} ${import_picocolors.default.dim(n)}${o.hint ? ` ${import_picocolors.default.dim(`(${o.hint})`)}` : ""}`;
|
|
950
1266
|
}
|
|
951
|
-
|
|
952
|
-
}
|
|
953
|
-
|
|
954
|
-
const
|
|
955
|
-
return
|
|
956
|
-
};
|
|
957
|
-
return new
|
|
1267
|
+
if (u === "cancelled") return `${import_picocolors.default.strikethrough(import_picocolors.default.dim(n))}`;
|
|
1268
|
+
if (u === "active-selected") return `${E}${import_picocolors.default.dim(p)}${import_picocolors.default.green(U)} ${n}${o.hint ? ` ${import_picocolors.default.dim(`(${o.hint})`)}` : ""}`;
|
|
1269
|
+
if (u === "submitted") return `${import_picocolors.default.dim(n)}`;
|
|
1270
|
+
const $ = c || r ? import_picocolors.default.dim(q) : "";
|
|
1271
|
+
return `${E}${import_picocolors.default.dim(p)}${$} ${import_picocolors.default.dim(n)}`;
|
|
1272
|
+
}, a = t.required ?? !0;
|
|
1273
|
+
return new yt$1({
|
|
958
1274
|
options: t.options,
|
|
1275
|
+
signal: t.signal,
|
|
1276
|
+
input: t.input,
|
|
1277
|
+
output: t.output,
|
|
959
1278
|
initialValues: t.initialValues,
|
|
960
|
-
required:
|
|
1279
|
+
required: a,
|
|
961
1280
|
cursorAt: t.cursorAt,
|
|
962
|
-
|
|
963
|
-
|
|
1281
|
+
selectableGroups: r,
|
|
1282
|
+
validate(o) {
|
|
1283
|
+
if (a && (o === void 0 || o.length === 0)) return `Please select at least one option.
|
|
964
1284
|
${import_picocolors.default.reset(import_picocolors.default.dim(`Press ${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(" space ")))} to select, ${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(" enter ")))} to submit`))}`;
|
|
965
1285
|
},
|
|
966
1286
|
render() {
|
|
967
|
-
const
|
|
968
|
-
${
|
|
969
|
-
`,
|
|
970
|
-
const a = this.value.includes(s.value);
|
|
971
|
-
return c && a ? n(s, "active-selected") : a ? n(s, "selected") : n(s, c ? "active" : "inactive");
|
|
972
|
-
};
|
|
1287
|
+
const o = `${import_picocolors.default.gray(d)}
|
|
1288
|
+
${W(this.state)} ${t.message}
|
|
1289
|
+
`, u = this.value ?? [];
|
|
973
1290
|
switch (this.state) {
|
|
974
|
-
case "submit":
|
|
1291
|
+
case "submit": {
|
|
1292
|
+
const l = this.options.filter(({ value: c }) => u.includes(c)).map((c) => i(c, "submitted")), n = l.length === 0 ? "" : ` ${l.join(import_picocolors.default.dim(", "))}`;
|
|
1293
|
+
return `${o}${import_picocolors.default.gray(d)}${n}`;
|
|
1294
|
+
}
|
|
975
1295
|
case "cancel": {
|
|
976
|
-
const
|
|
977
|
-
return `${
|
|
978
|
-
${import_picocolors.default.gray(
|
|
1296
|
+
const l = this.options.filter(({ value: n }) => u.includes(n)).map((n) => i(n, "cancelled")).join(import_picocolors.default.dim(", "));
|
|
1297
|
+
return `${o}${import_picocolors.default.gray(d)} ${l.trim() ? `${l}
|
|
1298
|
+
${import_picocolors.default.gray(d)}` : ""}`;
|
|
979
1299
|
}
|
|
980
1300
|
case "error": {
|
|
981
|
-
const
|
|
982
|
-
`).map((
|
|
1301
|
+
const l = this.error.split(`
|
|
1302
|
+
`).map((n, c) => c === 0 ? `${import_picocolors.default.yellow(x)} ${import_picocolors.default.yellow(n)}` : ` ${n}`).join(`
|
|
983
1303
|
`);
|
|
984
|
-
return `${
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
maxItems: t.maxItems,
|
|
988
|
-
style: i
|
|
1304
|
+
return `${o}${import_picocolors.default.yellow(d)} ${this.options.map((n, c, g) => {
|
|
1305
|
+
const F = u.includes(n.value) || n.group === !0 && this.isGroupSelected(`${n.value}`), p = c === this.cursor;
|
|
1306
|
+
return !p && typeof n.group == "string" && this.options[this.cursor].value === n.group ? i(n, F ? "group-active-selected" : "group-active", g) : p && F ? i(n, "active-selected", g) : F ? i(n, "selected", g) : i(n, p ? "active" : "inactive", g);
|
|
989
1307
|
}).join(`
|
|
990
|
-
${import_picocolors.default.yellow(
|
|
991
|
-
${
|
|
1308
|
+
${import_picocolors.default.yellow(d)} `)}
|
|
1309
|
+
${l}
|
|
992
1310
|
`;
|
|
993
1311
|
}
|
|
994
|
-
default:
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
${import_picocolors.default.cyan(d)}
|
|
1312
|
+
default: {
|
|
1313
|
+
const l = this.options.map((c, g, F) => {
|
|
1314
|
+
const p = u.includes(c.value) || c.group === !0 && this.isGroupSelected(`${c.value}`), E = g === this.cursor, $ = !E && typeof c.group == "string" && this.options[this.cursor].value === c.group;
|
|
1315
|
+
let m = "";
|
|
1316
|
+
return $ ? m = i(c, p ? "group-active-selected" : "group-active", F) : E && p ? m = i(c, "active-selected", F) : p ? m = i(c, "selected", F) : m = i(c, E ? "active" : "inactive", F), `${g !== 0 && !m.startsWith(`
|
|
1317
|
+
`) ? " " : ""}${m}`;
|
|
1318
|
+
}).join(`
|
|
1319
|
+
${import_picocolors.default.cyan(d)}`), n = l.startsWith(`
|
|
1320
|
+
`) ? "" : " ";
|
|
1321
|
+
return `${o}${import_picocolors.default.cyan(d)}${n}${l}
|
|
1322
|
+
${import_picocolors.default.cyan(x)}
|
|
1002
1323
|
`;
|
|
1324
|
+
}
|
|
1003
1325
|
}
|
|
1004
1326
|
}
|
|
1005
1327
|
}).prompt();
|
|
1006
|
-
},
|
|
1007
|
-
|
|
1008
|
-
const
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
if (
|
|
1013
|
-
const
|
|
1014
|
-
|
|
1328
|
+
}, R = {
|
|
1329
|
+
message: (t = [], { symbol: r = import_picocolors.default.gray(d), secondarySymbol: s = import_picocolors.default.gray(d), output: i = process.stdout, spacing: a = 1, withGuide: o } = {}) => {
|
|
1330
|
+
const u = [], l = o ?? _.withGuide, n = l ? s : "", c = l ? `${r} ` : "", g = l ? `${s} ` : "";
|
|
1331
|
+
for (let p = 0; p < a; p++) u.push(n);
|
|
1332
|
+
const F = Array.isArray(t) ? t : t.split(`
|
|
1333
|
+
`);
|
|
1334
|
+
if (F.length > 0) {
|
|
1335
|
+
const [p, ...E] = F;
|
|
1336
|
+
p.length > 0 ? u.push(`${c}${p}`) : u.push(l ? r : "");
|
|
1337
|
+
for (const $ of E) $.length > 0 ? u.push(`${g}${$}`) : u.push(l ? s : "");
|
|
1015
1338
|
}
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1339
|
+
i.write(`${u.join(`
|
|
1340
|
+
`)}
|
|
1341
|
+
`);
|
|
1342
|
+
},
|
|
1343
|
+
info: (t, r) => {
|
|
1344
|
+
R.message(t, {
|
|
1345
|
+
...r,
|
|
1346
|
+
symbol: import_picocolors.default.blue(ft)
|
|
1347
|
+
});
|
|
1348
|
+
},
|
|
1349
|
+
success: (t, r) => {
|
|
1350
|
+
R.message(t, {
|
|
1351
|
+
...r,
|
|
1352
|
+
symbol: import_picocolors.default.green(Ft)
|
|
1353
|
+
});
|
|
1354
|
+
},
|
|
1355
|
+
step: (t, r) => {
|
|
1356
|
+
R.message(t, {
|
|
1357
|
+
...r,
|
|
1358
|
+
symbol: import_picocolors.default.green(V)
|
|
1359
|
+
});
|
|
1360
|
+
},
|
|
1361
|
+
warn: (t, r) => {
|
|
1362
|
+
R.message(t, {
|
|
1363
|
+
...r,
|
|
1364
|
+
symbol: import_picocolors.default.yellow(yt)
|
|
1365
|
+
});
|
|
1366
|
+
},
|
|
1367
|
+
warning: (t, r) => {
|
|
1368
|
+
R.warn(t, r);
|
|
1369
|
+
},
|
|
1370
|
+
error: (t, r) => {
|
|
1371
|
+
R.message(t, {
|
|
1372
|
+
...r,
|
|
1373
|
+
symbol: import_picocolors.default.red(Et)
|
|
1374
|
+
});
|
|
1375
|
+
}
|
|
1376
|
+
}, Ne = (t = "", r) => {
|
|
1377
|
+
(r?.output ?? process.stdout).write(`${import_picocolors.default.gray(x)} ${import_picocolors.default.red(t)}
|
|
1378
|
+
|
|
1379
|
+
`);
|
|
1380
|
+
}, We = (t = "", r) => {
|
|
1381
|
+
(r?.output ?? process.stdout).write(`${import_picocolors.default.gray(ht)} ${t}
|
|
1382
|
+
`);
|
|
1383
|
+
}, Le = (t = "", r) => {
|
|
1384
|
+
(r?.output ?? process.stdout).write(`${import_picocolors.default.gray(d)}
|
|
1385
|
+
${import_picocolors.default.gray(x)} ${t}
|
|
1386
|
+
|
|
1387
|
+
`);
|
|
1388
|
+
}, Z = (t, r) => t.split(`
|
|
1389
|
+
`).map((s) => r(s)).join(`
|
|
1390
|
+
`), je = (t) => {
|
|
1391
|
+
const r = (i, a) => {
|
|
1392
|
+
const o = i.label ?? String(i.value);
|
|
1393
|
+
return a === "disabled" ? `${import_picocolors.default.gray(q)} ${Z(o, (u) => import_picocolors.default.strikethrough(import_picocolors.default.gray(u)))}${i.hint ? ` ${import_picocolors.default.dim(`(${i.hint ?? "disabled"})`)}` : ""}` : a === "active" ? `${import_picocolors.default.cyan(st)} ${o}${i.hint ? ` ${import_picocolors.default.dim(`(${i.hint})`)}` : ""}` : a === "selected" ? `${import_picocolors.default.green(U)} ${Z(o, import_picocolors.default.dim)}${i.hint ? ` ${import_picocolors.default.dim(`(${i.hint})`)}` : ""}` : a === "cancelled" ? `${Z(o, (u) => import_picocolors.default.strikethrough(import_picocolors.default.dim(u)))}` : a === "active-selected" ? `${import_picocolors.default.green(U)} ${o}${i.hint ? ` ${import_picocolors.default.dim(`(${i.hint})`)}` : ""}` : a === "submitted" ? `${Z(o, import_picocolors.default.dim)}` : `${import_picocolors.default.dim(q)} ${Z(o, import_picocolors.default.dim)}`;
|
|
1394
|
+
}, s = t.required ?? !0;
|
|
1395
|
+
return new Lt$1({
|
|
1023
1396
|
options: t.options,
|
|
1397
|
+
signal: t.signal,
|
|
1398
|
+
input: t.input,
|
|
1399
|
+
output: t.output,
|
|
1024
1400
|
initialValues: t.initialValues,
|
|
1025
|
-
required:
|
|
1401
|
+
required: s,
|
|
1026
1402
|
cursorAt: t.cursorAt,
|
|
1027
|
-
selectableGroups: n,
|
|
1028
1403
|
validate(i) {
|
|
1029
|
-
if (
|
|
1404
|
+
if (s && (i === void 0 || i.length === 0)) return `Please select at least one option.
|
|
1030
1405
|
${import_picocolors.default.reset(import_picocolors.default.dim(`Press ${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(" space ")))} to select, ${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(" enter ")))} to submit`))}`;
|
|
1031
1406
|
},
|
|
1032
1407
|
render() {
|
|
1033
|
-
const i = `${import_picocolors.default.gray(
|
|
1034
|
-
${
|
|
1035
|
-
|
|
1408
|
+
const i = xt(t.output, t.message, `${vt(this.state)} `, `${W(this.state)} `), a = `${import_picocolors.default.gray(d)}
|
|
1409
|
+
${i}
|
|
1410
|
+
`, o = this.value ?? [], u = (l, n) => {
|
|
1411
|
+
if (l.disabled) return r(l, "disabled");
|
|
1412
|
+
const c = o.includes(l.value);
|
|
1413
|
+
return n && c ? r(l, "active-selected") : c ? r(l, "selected") : r(l, n ? "active" : "inactive");
|
|
1414
|
+
};
|
|
1036
1415
|
switch (this.state) {
|
|
1037
|
-
case "submit":
|
|
1416
|
+
case "submit": {
|
|
1417
|
+
const l = this.options.filter(({ value: c }) => o.includes(c)).map((c) => r(c, "submitted")).join(import_picocolors.default.dim(", ")) || import_picocolors.default.dim("none");
|
|
1418
|
+
return `${a}${xt(t.output, l, `${import_picocolors.default.gray(d)} `)}`;
|
|
1419
|
+
}
|
|
1038
1420
|
case "cancel": {
|
|
1039
|
-
const
|
|
1040
|
-
return `${
|
|
1041
|
-
${import_picocolors.default.gray(
|
|
1421
|
+
const l = this.options.filter(({ value: c }) => o.includes(c)).map((c) => r(c, "cancelled")).join(import_picocolors.default.dim(", "));
|
|
1422
|
+
if (l.trim() === "") return `${a}${import_picocolors.default.gray(d)}`;
|
|
1423
|
+
return `${a}${xt(t.output, l, `${import_picocolors.default.gray(d)} `)}
|
|
1424
|
+
${import_picocolors.default.gray(d)}`;
|
|
1042
1425
|
}
|
|
1043
1426
|
case "error": {
|
|
1044
|
-
const
|
|
1045
|
-
`).map((
|
|
1046
|
-
`)
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1427
|
+
const l = `${import_picocolors.default.yellow(d)} `, n = this.error.split(`
|
|
1428
|
+
`).map((F, p) => p === 0 ? `${import_picocolors.default.yellow(x)} ${import_picocolors.default.yellow(F)}` : ` ${F}`).join(`
|
|
1429
|
+
`), c = a.split(`
|
|
1430
|
+
`).length, g = n.split(`
|
|
1431
|
+
`).length + 1;
|
|
1432
|
+
return `${a}${l}${X({
|
|
1433
|
+
output: t.output,
|
|
1434
|
+
options: this.options,
|
|
1435
|
+
cursor: this.cursor,
|
|
1436
|
+
maxItems: t.maxItems,
|
|
1437
|
+
columnPadding: l.length,
|
|
1438
|
+
rowPadding: c + g,
|
|
1439
|
+
style: u
|
|
1050
1440
|
}).join(`
|
|
1051
|
-
${
|
|
1052
|
-
${
|
|
1441
|
+
${l}`)}
|
|
1442
|
+
${n}
|
|
1053
1443
|
`;
|
|
1054
1444
|
}
|
|
1055
|
-
default:
|
|
1056
|
-
const l =
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1445
|
+
default: {
|
|
1446
|
+
const l = `${import_picocolors.default.cyan(d)} `, n = a.split(`
|
|
1447
|
+
`).length;
|
|
1448
|
+
return `${a}${l}${X({
|
|
1449
|
+
output: t.output,
|
|
1450
|
+
options: this.options,
|
|
1451
|
+
cursor: this.cursor,
|
|
1452
|
+
maxItems: t.maxItems,
|
|
1453
|
+
columnPadding: l.length,
|
|
1454
|
+
rowPadding: n + 2,
|
|
1455
|
+
style: u
|
|
1456
|
+
}).join(`
|
|
1457
|
+
${l}`)}
|
|
1458
|
+
${import_picocolors.default.cyan(x)}
|
|
1061
1459
|
`;
|
|
1460
|
+
}
|
|
1062
1461
|
}
|
|
1063
1462
|
}
|
|
1064
1463
|
}).prompt();
|
|
1065
|
-
},
|
|
1066
|
-
const
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1464
|
+
}, Ge = (t) => import_picocolors.default.dim(t), ke = (t, r, s) => {
|
|
1465
|
+
const i = {
|
|
1466
|
+
hard: !0,
|
|
1467
|
+
trim: !1
|
|
1468
|
+
}, a = J(t, r, i).split(`
|
|
1469
|
+
`), o = a.reduce((n, c) => Math.max(M(c), n), 0);
|
|
1470
|
+
return J(t, r - (a.map(s).reduce((n, c) => Math.max(M(c), n), 0) - o), i);
|
|
1471
|
+
}, Ve = (t = "", r = "", s) => {
|
|
1472
|
+
const i = s?.output ?? N.stdout, a = s?.withGuide ?? _.withGuide, o = s?.format ?? Ge, u = [
|
|
1473
|
+
"",
|
|
1474
|
+
...ke(t, rt$1(i) - 6, o).split(`
|
|
1475
|
+
`).map(o),
|
|
1476
|
+
""
|
|
1477
|
+
], l = M(r), n = Math.max(u.reduce((p, E) => {
|
|
1478
|
+
const $ = M(E);
|
|
1479
|
+
return $ > p ? $ : p;
|
|
1480
|
+
}, 0), l) + 2, c = u.map((p) => `${import_picocolors.default.gray(d)} ${p}${" ".repeat(n - M(p))}${import_picocolors.default.gray(d)}`).join(`
|
|
1481
|
+
`), g = a ? `${import_picocolors.default.gray(d)}
|
|
1482
|
+
` : "", F = a ? Wt : gt;
|
|
1483
|
+
i.write(`${g}${import_picocolors.default.green(V)} ${import_picocolors.default.reset(r)} ${import_picocolors.default.gray(rt.repeat(Math.max(n - l - 1, 1)) + mt)}
|
|
1076
1484
|
${c}
|
|
1077
|
-
${import_picocolors.default.gray(
|
|
1078
|
-
`);
|
|
1079
|
-
}, xe = (t = "") => {
|
|
1080
|
-
process.stdout.write(`${import_picocolors.default.gray(d)} ${import_picocolors.default.red(t)}
|
|
1081
|
-
|
|
1485
|
+
${import_picocolors.default.gray(F + rt.repeat(n + 2) + pt)}
|
|
1082
1486
|
`);
|
|
1083
|
-
},
|
|
1084
|
-
|
|
1487
|
+
}, He = (t) => new Mt$1({
|
|
1488
|
+
validate: t.validate,
|
|
1489
|
+
mask: t.mask ?? Nt,
|
|
1490
|
+
signal: t.signal,
|
|
1491
|
+
input: t.input,
|
|
1492
|
+
output: t.output,
|
|
1493
|
+
render() {
|
|
1494
|
+
const r = t.withGuide ?? _.withGuide, s = `${r ? `${import_picocolors.default.gray(d)}
|
|
1495
|
+
` : ""}${W(this.state)} ${t.message}
|
|
1496
|
+
`, i = this.userInputWithCursor, a = this.masked;
|
|
1497
|
+
switch (this.state) {
|
|
1498
|
+
case "error": {
|
|
1499
|
+
const o = r ? `${import_picocolors.default.yellow(d)} ` : "", u = r ? `${import_picocolors.default.yellow(x)} ` : "", l = a ?? "";
|
|
1500
|
+
return t.clearOnError && this.clear(), `${s.trim()}
|
|
1501
|
+
${o}${l}
|
|
1502
|
+
${u}${import_picocolors.default.yellow(this.error)}
|
|
1503
|
+
`;
|
|
1504
|
+
}
|
|
1505
|
+
case "submit": return `${s}${r ? `${import_picocolors.default.gray(d)} ` : ""}${a ? import_picocolors.default.dim(a) : ""}`;
|
|
1506
|
+
case "cancel": return `${s}${r ? `${import_picocolors.default.gray(d)} ` : ""}${a ? import_picocolors.default.strikethrough(import_picocolors.default.dim(a)) : ""}${a && r ? `
|
|
1507
|
+
${import_picocolors.default.gray(d)}` : ""}`;
|
|
1508
|
+
default: return `${s}${r ? `${import_picocolors.default.cyan(d)} ` : ""}${i}
|
|
1509
|
+
${r ? import_picocolors.default.cyan(x) : ""}
|
|
1510
|
+
`;
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
}).prompt(), Ue = (t) => {
|
|
1514
|
+
const r = t.validate;
|
|
1515
|
+
return Xt({
|
|
1516
|
+
...t,
|
|
1517
|
+
initialUserInput: t.initialValue ?? t.root ?? process.cwd(),
|
|
1518
|
+
maxItems: 5,
|
|
1519
|
+
validate(s) {
|
|
1520
|
+
if (!Array.isArray(s)) {
|
|
1521
|
+
if (!s) return "Please select a path";
|
|
1522
|
+
if (r) return r(s);
|
|
1523
|
+
}
|
|
1524
|
+
},
|
|
1525
|
+
options() {
|
|
1526
|
+
const s = this.userInput;
|
|
1527
|
+
if (s === "") return [];
|
|
1528
|
+
try {
|
|
1529
|
+
let i;
|
|
1530
|
+
return existsSync(s) ? lstatSync(s).isDirectory() ? i = s : i = dirname(s) : i = dirname(s), readdirSync(i).map((a) => {
|
|
1531
|
+
const o = join(i, a);
|
|
1532
|
+
return {
|
|
1533
|
+
name: a,
|
|
1534
|
+
path: o,
|
|
1535
|
+
isDirectory: lstatSync(o).isDirectory()
|
|
1536
|
+
};
|
|
1537
|
+
}).filter(({ path: a, isDirectory: o }) => a.startsWith(s) && (t.directory || !o)).map((a) => ({ value: a.path }));
|
|
1538
|
+
} catch {
|
|
1539
|
+
return [];
|
|
1540
|
+
}
|
|
1541
|
+
}
|
|
1542
|
+
});
|
|
1543
|
+
}, Ke = import_picocolors.default.magenta, bt = ({ indicator: t = "dots", onCancel: r, output: s = process.stdout, cancelMessage: i, errorMessage: a, frames: o = et ? [
|
|
1544
|
+
"◒",
|
|
1545
|
+
"◐",
|
|
1546
|
+
"◓",
|
|
1547
|
+
"◑"
|
|
1548
|
+
] : [
|
|
1549
|
+
"•",
|
|
1550
|
+
"o",
|
|
1551
|
+
"O",
|
|
1552
|
+
"0"
|
|
1553
|
+
], delay: u = et ? 80 : 120, signal: l, ...n } = {}) => {
|
|
1554
|
+
const c = ct();
|
|
1555
|
+
let g, F, p = !1, E = !1, $ = "", m, h = performance.now();
|
|
1556
|
+
const y = rt$1(s), f = n?.styleFrame ?? Ke, v = (b) => {
|
|
1557
|
+
const O = b > 1 ? a ?? _.messages.error : i ?? _.messages.cancel;
|
|
1558
|
+
E = b === 1, p && (L(O, b), E && typeof r == "function" && r());
|
|
1559
|
+
}, S = () => v(2), I = () => v(1), B = () => {
|
|
1560
|
+
process.on("uncaughtExceptionMonitor", S), process.on("unhandledRejection", S), process.on("SIGINT", I), process.on("SIGTERM", I), process.on("exit", v), l && l.addEventListener("abort", I);
|
|
1561
|
+
}, A = () => {
|
|
1562
|
+
process.removeListener("uncaughtExceptionMonitor", S), process.removeListener("unhandledRejection", S), process.removeListener("SIGINT", I), process.removeListener("SIGTERM", I), process.removeListener("exit", v), l && l.removeEventListener("abort", I);
|
|
1563
|
+
}, w = () => {
|
|
1564
|
+
if (m === void 0) return;
|
|
1565
|
+
c && s.write(`
|
|
1085
1566
|
`);
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1567
|
+
const b = J(m, y, {
|
|
1568
|
+
hard: !0,
|
|
1569
|
+
trim: !1
|
|
1570
|
+
}).split(`
|
|
1090
1571
|
`);
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
const
|
|
1094
|
-
|
|
1095
|
-
|
|
1572
|
+
b.length > 1 && s.write(import_src.cursor.up(b.length - 1)), s.write(import_src.cursor.to(0)), s.write(import_src.erase.down());
|
|
1573
|
+
}, _$1 = (b) => b.replace(/\.+$/, ""), D = (b) => {
|
|
1574
|
+
const O = (performance.now() - b) / 1e3, j = Math.floor(O / 60), G = Math.floor(O % 60);
|
|
1575
|
+
return j > 0 ? `[${j}m ${G}s]` : `[${G}s]`;
|
|
1576
|
+
}, T = n.withGuide ?? _.withGuide, Y = (b = "") => {
|
|
1577
|
+
p = !0, g = Bt({ output: s }), $ = _$1(b), h = performance.now(), T && s.write(`${import_picocolors.default.gray(d)}
|
|
1096
1578
|
`);
|
|
1097
|
-
|
|
1579
|
+
let O = 0, j = 0;
|
|
1580
|
+
B(), F = setInterval(() => {
|
|
1581
|
+
if (c && $ === m) return;
|
|
1582
|
+
w(), m = $;
|
|
1583
|
+
const G = f(o[O]);
|
|
1584
|
+
let tt;
|
|
1585
|
+
if (c) tt = `${G} ${$}...`;
|
|
1586
|
+
else if (t === "timer") tt = `${G} ${$} ${D(h)}`;
|
|
1587
|
+
else {
|
|
1588
|
+
const te = ".".repeat(Math.floor(j)).slice(0, 3);
|
|
1589
|
+
tt = `${G} ${$}${te}`;
|
|
1590
|
+
}
|
|
1591
|
+
const Zt = J(tt, y, {
|
|
1592
|
+
hard: !0,
|
|
1593
|
+
trim: !1
|
|
1594
|
+
});
|
|
1595
|
+
s.write(Zt), O = O + 1 < o.length ? O + 1 : 0, j = j < 4 ? j + .125 : 0;
|
|
1596
|
+
}, u);
|
|
1597
|
+
}, L = (b = "", O = 0, j = !1) => {
|
|
1598
|
+
if (!p) return;
|
|
1599
|
+
p = !1, clearInterval(F), w();
|
|
1600
|
+
const G = O === 0 ? import_picocolors.default.green(V) : O === 1 ? import_picocolors.default.red(dt) : import_picocolors.default.red($t);
|
|
1601
|
+
$ = b ?? $, j || (t === "timer" ? s.write(`${G} ${$} ${D(h)}
|
|
1602
|
+
`) : s.write(`${G} ${$}
|
|
1603
|
+
`)), A(), g();
|
|
1604
|
+
};
|
|
1605
|
+
return {
|
|
1606
|
+
start: Y,
|
|
1607
|
+
stop: (b = "") => L(b, 0),
|
|
1608
|
+
message: (b = "") => {
|
|
1609
|
+
$ = _$1(b ?? $);
|
|
1610
|
+
},
|
|
1611
|
+
cancel: (b = "") => L(b, 1),
|
|
1612
|
+
error: (b = "") => L(b, 2),
|
|
1613
|
+
clear: () => L("", 0, !0),
|
|
1614
|
+
get isCancelled() {
|
|
1615
|
+
return E;
|
|
1616
|
+
}
|
|
1617
|
+
};
|
|
1618
|
+
}, zt = {
|
|
1619
|
+
light: C("─", "-"),
|
|
1620
|
+
heavy: C("━", "="),
|
|
1621
|
+
block: C("█", "#")
|
|
1622
|
+
};
|
|
1623
|
+
const lt = (t, r) => t.includes(`
|
|
1624
|
+
`) ? t.split(`
|
|
1625
|
+
`).map((s) => r(s)).join(`
|
|
1626
|
+
`) : r(t), Je = (t) => {
|
|
1627
|
+
const r = (s, i) => {
|
|
1628
|
+
const a = s.label ?? String(s.value);
|
|
1629
|
+
switch (i) {
|
|
1630
|
+
case "disabled": return `${import_picocolors.default.gray(H)} ${lt(a, import_picocolors.default.gray)}${s.hint ? ` ${import_picocolors.default.dim(`(${s.hint ?? "disabled"})`)}` : ""}`;
|
|
1631
|
+
case "selected": return `${lt(a, import_picocolors.default.dim)}`;
|
|
1632
|
+
case "active": return `${import_picocolors.default.green(Q)} ${a}${s.hint ? ` ${import_picocolors.default.dim(`(${s.hint})`)}` : ""}`;
|
|
1633
|
+
case "cancelled": return `${lt(a, (o) => import_picocolors.default.strikethrough(import_picocolors.default.dim(o)))}`;
|
|
1634
|
+
default: return `${import_picocolors.default.dim(H)} ${lt(a, import_picocolors.default.dim)}`;
|
|
1635
|
+
}
|
|
1636
|
+
};
|
|
1637
|
+
return new Wt$1({
|
|
1638
|
+
options: t.options,
|
|
1639
|
+
signal: t.signal,
|
|
1640
|
+
input: t.input,
|
|
1641
|
+
output: t.output,
|
|
1642
|
+
initialValue: t.initialValue,
|
|
1643
|
+
render() {
|
|
1644
|
+
const s = t.withGuide ?? _.withGuide, i = `${W(this.state)} `, a = `${vt(this.state)} `, o = xt(t.output, t.message, a, i), u = `${s ? `${import_picocolors.default.gray(d)}
|
|
1645
|
+
` : ""}${o}
|
|
1646
|
+
`;
|
|
1647
|
+
switch (this.state) {
|
|
1648
|
+
case "submit": {
|
|
1649
|
+
const l = s ? `${import_picocolors.default.gray(d)} ` : "";
|
|
1650
|
+
return `${u}${xt(t.output, r(this.options[this.cursor], "selected"), l)}`;
|
|
1651
|
+
}
|
|
1652
|
+
case "cancel": {
|
|
1653
|
+
const l = s ? `${import_picocolors.default.gray(d)} ` : "";
|
|
1654
|
+
return `${u}${xt(t.output, r(this.options[this.cursor], "cancelled"), l)}${s ? `
|
|
1655
|
+
${import_picocolors.default.gray(d)}` : ""}`;
|
|
1656
|
+
}
|
|
1657
|
+
default: {
|
|
1658
|
+
const l = s ? `${import_picocolors.default.cyan(d)} ` : "", n = s ? import_picocolors.default.cyan(x) : "", c = u.split(`
|
|
1659
|
+
`).length, g = s ? 2 : 1;
|
|
1660
|
+
return `${u}${l}${X({
|
|
1661
|
+
output: t.output,
|
|
1662
|
+
cursor: this.cursor,
|
|
1663
|
+
options: this.options,
|
|
1664
|
+
maxItems: t.maxItems,
|
|
1665
|
+
columnPadding: l.length,
|
|
1666
|
+
rowPadding: c + g,
|
|
1667
|
+
style: (F, p) => r(F, F.disabled ? "disabled" : p ? "active" : "inactive")
|
|
1668
|
+
}).join(`
|
|
1669
|
+
${l}`)}
|
|
1670
|
+
${n}
|
|
1671
|
+
`;
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1098
1674
|
}
|
|
1099
|
-
|
|
1675
|
+
}).prompt();
|
|
1676
|
+
}, Xe = (t) => {
|
|
1677
|
+
const r = (s, i = "inactive") => {
|
|
1678
|
+
const a = s.label ?? String(s.value);
|
|
1679
|
+
return i === "selected" ? `${import_picocolors.default.dim(a)}` : i === "cancelled" ? `${import_picocolors.default.strikethrough(import_picocolors.default.dim(a))}` : i === "active" ? `${import_picocolors.default.bgCyan(import_picocolors.default.gray(` ${s.value} `))} ${a}${s.hint ? ` ${import_picocolors.default.dim(`(${s.hint})`)}` : ""}` : `${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(` ${s.value} `)))} ${a}${s.hint ? ` ${import_picocolors.default.dim(`(${s.hint})`)}` : ""}`;
|
|
1680
|
+
};
|
|
1681
|
+
return new Tt$1({
|
|
1682
|
+
options: t.options,
|
|
1683
|
+
signal: t.signal,
|
|
1684
|
+
input: t.input,
|
|
1685
|
+
output: t.output,
|
|
1686
|
+
initialValue: t.initialValue,
|
|
1687
|
+
caseSensitive: t.caseSensitive,
|
|
1688
|
+
render() {
|
|
1689
|
+
const s = t.withGuide ?? _.withGuide, i = `${s ? `${import_picocolors.default.gray(d)}
|
|
1690
|
+
` : ""}${W(this.state)} ${t.message}
|
|
1691
|
+
`;
|
|
1692
|
+
switch (this.state) {
|
|
1693
|
+
case "submit": {
|
|
1694
|
+
const a = s ? `${import_picocolors.default.gray(d)} ` : "", o = this.options.find((l) => l.value === this.value) ?? t.options[0];
|
|
1695
|
+
return `${i}${xt(t.output, r(o, "selected"), a)}`;
|
|
1696
|
+
}
|
|
1697
|
+
case "cancel": {
|
|
1698
|
+
const a = s ? `${import_picocolors.default.gray(d)} ` : "";
|
|
1699
|
+
return `${i}${xt(t.output, r(this.options[0], "cancelled"), a)}${s ? `
|
|
1700
|
+
${import_picocolors.default.gray(d)}` : ""}`;
|
|
1701
|
+
}
|
|
1702
|
+
default: {
|
|
1703
|
+
const a = s ? `${import_picocolors.default.cyan(d)} ` : "", o = s ? import_picocolors.default.cyan(x) : "";
|
|
1704
|
+
return `${i}${this.options.map((l, n) => xt(t.output, r(l, n === this.cursor ? "active" : "inactive"), a)).join(`
|
|
1100
1705
|
`)}
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
}
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
warn: (t) => {
|
|
1113
|
-
M.message(t, { symbol: import_picocolors.default.yellow(U) });
|
|
1114
|
-
},
|
|
1115
|
-
warning: (t) => {
|
|
1116
|
-
M.warn(t);
|
|
1117
|
-
},
|
|
1118
|
-
error: (t) => {
|
|
1119
|
-
M.message(t, { symbol: import_picocolors.default.red(K) });
|
|
1120
|
-
}
|
|
1121
|
-
}, J = `${import_picocolors.default.gray(o)} `, x = {
|
|
1122
|
-
message: async (t, { symbol: n = import_picocolors.default.gray(o) } = {}) => {
|
|
1123
|
-
process.stdout.write(`${import_picocolors.default.gray(o)}
|
|
1124
|
-
${n} `);
|
|
1125
|
-
let r = 3;
|
|
1706
|
+
${o}
|
|
1707
|
+
`;
|
|
1708
|
+
}
|
|
1709
|
+
}
|
|
1710
|
+
}
|
|
1711
|
+
}).prompt();
|
|
1712
|
+
}, Qt = `${import_picocolors.default.gray(d)} `, K = {
|
|
1713
|
+
message: async (t, { symbol: r = import_picocolors.default.gray(d) } = {}) => {
|
|
1714
|
+
process.stdout.write(`${import_picocolors.default.gray(d)}
|
|
1715
|
+
${r} `);
|
|
1716
|
+
let s = 3;
|
|
1126
1717
|
for await (let i of t) {
|
|
1127
1718
|
i = i.replace(/\n/g, `
|
|
1128
|
-
${
|
|
1129
|
-
`) && (
|
|
1719
|
+
${Qt}`), i.includes(`
|
|
1720
|
+
`) && (s = 3 + stripVTControlCharacters(i.slice(i.lastIndexOf(`
|
|
1130
1721
|
`))).length);
|
|
1131
|
-
const
|
|
1132
|
-
|
|
1133
|
-
${
|
|
1722
|
+
const a = stripVTControlCharacters(i).length;
|
|
1723
|
+
s + a < process.stdout.columns ? (s += a, process.stdout.write(i)) : (process.stdout.write(`
|
|
1724
|
+
${Qt}${i.trimStart()}`), s = 3 + stripVTControlCharacters(i.trimStart()).length);
|
|
1134
1725
|
}
|
|
1135
1726
|
process.stdout.write(`
|
|
1136
1727
|
`);
|
|
1137
1728
|
},
|
|
1138
|
-
info: (t) =>
|
|
1139
|
-
success: (t) =>
|
|
1140
|
-
step: (t) =>
|
|
1141
|
-
warn: (t) =>
|
|
1142
|
-
warning: (t) =>
|
|
1143
|
-
error: (t) =>
|
|
1144
|
-
},
|
|
1145
|
-
const
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
let s, c, a = !1, l = "", $, g = performance.now();
|
|
1157
|
-
const p = (m) => {
|
|
1158
|
-
a && N(m > 1 ? "Something went wrong" : "Canceled", m);
|
|
1159
|
-
}, v = () => p(2), f = () => p(1), j = () => {
|
|
1160
|
-
process.on("uncaughtExceptionMonitor", v), process.on("unhandledRejection", v), process.on("SIGINT", f), process.on("SIGTERM", f), process.on("exit", p);
|
|
1161
|
-
}, E = () => {
|
|
1162
|
-
process.removeListener("uncaughtExceptionMonitor", v), process.removeListener("unhandledRejection", v), process.removeListener("SIGINT", f), process.removeListener("SIGTERM", f), process.removeListener("exit", p);
|
|
1163
|
-
}, B = () => {
|
|
1164
|
-
if ($ === void 0) return;
|
|
1165
|
-
i && process.stdout.write(`
|
|
1166
|
-
`);
|
|
1167
|
-
const m = $.split(`
|
|
1729
|
+
info: (t) => K.message(t, { symbol: import_picocolors.default.blue(ft) }),
|
|
1730
|
+
success: (t) => K.message(t, { symbol: import_picocolors.default.green(Ft) }),
|
|
1731
|
+
step: (t) => K.message(t, { symbol: import_picocolors.default.green(V) }),
|
|
1732
|
+
warn: (t) => K.message(t, { symbol: import_picocolors.default.yellow(yt) }),
|
|
1733
|
+
warning: (t) => K.warn(t),
|
|
1734
|
+
error: (t) => K.message(t, { symbol: import_picocolors.default.red(Et) })
|
|
1735
|
+
}, Ye = async (t, r) => {
|
|
1736
|
+
for (const s of t) {
|
|
1737
|
+
if (s.enabled === !1) continue;
|
|
1738
|
+
const i = bt(r);
|
|
1739
|
+
i.start(s.title);
|
|
1740
|
+
const a = await s.task(i.message);
|
|
1741
|
+
i.stop(a || s.title);
|
|
1742
|
+
}
|
|
1743
|
+
}, ze = (t) => t.replace(/\x1b\[(?:\d+;)*\d*[ABCDEFGHfJKSTsu]|\x1b\[(s|u)/g, ""), Qe = (t) => {
|
|
1744
|
+
const r = t.output ?? process.stdout, s = rt$1(r), i = import_picocolors.default.gray(d), a = t.spacing ?? 1, o = 3, u = t.retainLog === !0, l = !ct() && Mt(r);
|
|
1745
|
+
r.write(`${i}
|
|
1746
|
+
`), r.write(`${import_picocolors.default.green(V)} ${t.title}
|
|
1168
1747
|
`);
|
|
1169
|
-
|
|
1170
|
-
}, R = (m) => m.replace(/\.+$/, ""), O = (m) => {
|
|
1171
|
-
const h = (performance.now() - m) / 1e3, w = Math.floor(h / 60), I = Math.floor(h % 60);
|
|
1172
|
-
return w > 0 ? `[${w}m ${I}s]` : `[${I}s]`;
|
|
1173
|
-
}, H = (m = "") => {
|
|
1174
|
-
a = !0, s = fD(), l = R(m), g = performance.now(), process.stdout.write(`${import_picocolors.default.gray(o)}
|
|
1748
|
+
for (let h = 0; h < a; h++) r.write(`${i}
|
|
1175
1749
|
`);
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1750
|
+
const n = [{
|
|
1751
|
+
value: "",
|
|
1752
|
+
full: ""
|
|
1753
|
+
}];
|
|
1754
|
+
let c = !1;
|
|
1755
|
+
const g = (h) => {
|
|
1756
|
+
if (n.length === 0) return;
|
|
1757
|
+
let y = 0;
|
|
1758
|
+
h && (y += a + 2);
|
|
1759
|
+
for (const f of n) {
|
|
1760
|
+
const { value: v, result: S } = f;
|
|
1761
|
+
let I = S?.message ?? v;
|
|
1762
|
+
if (I.length === 0) continue;
|
|
1763
|
+
S === void 0 && f.header !== void 0 && f.header !== "" && (I += `
|
|
1764
|
+
${f.header}`);
|
|
1765
|
+
const B = I.split(`
|
|
1766
|
+
`).reduce((A, w) => w === "" ? A + 1 : A + Math.ceil((w.length + o) / s), 0);
|
|
1767
|
+
y += B;
|
|
1768
|
+
}
|
|
1769
|
+
y > 0 && (y += 1, r.write(import_src.erase.lines(y)));
|
|
1770
|
+
}, F = (h, y, f) => {
|
|
1771
|
+
const v = f ? `${h.full}
|
|
1772
|
+
${h.value}` : h.value;
|
|
1773
|
+
h.header !== void 0 && h.header !== "" && R.message(h.header.split(`
|
|
1774
|
+
`).map(import_picocolors.default.bold), {
|
|
1775
|
+
output: r,
|
|
1776
|
+
secondarySymbol: i,
|
|
1777
|
+
symbol: i,
|
|
1778
|
+
spacing: 0
|
|
1779
|
+
}), R.message(v.split(`
|
|
1780
|
+
`).map(import_picocolors.default.dim), {
|
|
1781
|
+
output: r,
|
|
1782
|
+
secondarySymbol: i,
|
|
1783
|
+
symbol: i,
|
|
1784
|
+
spacing: y ?? a
|
|
1785
|
+
});
|
|
1786
|
+
}, p = () => {
|
|
1787
|
+
for (const h of n) {
|
|
1788
|
+
const { header: y, value: f, full: v } = h;
|
|
1789
|
+
(y === void 0 || y.length === 0) && f.length === 0 || F(h, void 0, u === !0 && v.length > 0);
|
|
1790
|
+
}
|
|
1791
|
+
}, E = (h, y, f) => {
|
|
1792
|
+
if (g(!1), (f?.raw !== !0 || !c) && h.value !== "" && (h.value += `
|
|
1793
|
+
`), h.value += ze(y), c = f?.raw === !0, t.limit !== void 0) {
|
|
1794
|
+
const v = h.value.split(`
|
|
1795
|
+
`), S = v.length - t.limit;
|
|
1796
|
+
if (S > 0) {
|
|
1797
|
+
const I = v.splice(0, S);
|
|
1798
|
+
u && (h.full += (h.full === "" ? "" : `
|
|
1799
|
+
`) + I.join(`
|
|
1800
|
+
`));
|
|
1186
1801
|
}
|
|
1187
|
-
h
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1802
|
+
h.value = v.join(`
|
|
1803
|
+
`);
|
|
1804
|
+
}
|
|
1805
|
+
l && $();
|
|
1806
|
+
}, $ = () => {
|
|
1807
|
+
for (const h of n) h.result ? h.result.status === "error" ? R.error(h.result.message, {
|
|
1808
|
+
output: r,
|
|
1809
|
+
secondarySymbol: i,
|
|
1810
|
+
spacing: 0
|
|
1811
|
+
}) : R.success(h.result.message, {
|
|
1812
|
+
output: r,
|
|
1813
|
+
secondarySymbol: i,
|
|
1814
|
+
spacing: 0
|
|
1815
|
+
}) : h.value !== "" && F(h, 0);
|
|
1816
|
+
}, m = (h, y) => {
|
|
1817
|
+
g(!1), h.result = y, l && $();
|
|
1195
1818
|
};
|
|
1196
1819
|
return {
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1820
|
+
message(h, y) {
|
|
1821
|
+
E(n[0], h, y);
|
|
1822
|
+
},
|
|
1823
|
+
group(h) {
|
|
1824
|
+
const y = {
|
|
1825
|
+
header: h,
|
|
1826
|
+
value: "",
|
|
1827
|
+
full: ""
|
|
1828
|
+
};
|
|
1829
|
+
return n.push(y), {
|
|
1830
|
+
message(f, v) {
|
|
1831
|
+
E(y, f, v);
|
|
1832
|
+
},
|
|
1833
|
+
error(f) {
|
|
1834
|
+
m(y, {
|
|
1835
|
+
status: "error",
|
|
1836
|
+
message: f
|
|
1837
|
+
});
|
|
1838
|
+
},
|
|
1839
|
+
success(f) {
|
|
1840
|
+
m(y, {
|
|
1841
|
+
status: "success",
|
|
1842
|
+
message: f
|
|
1843
|
+
});
|
|
1844
|
+
}
|
|
1845
|
+
};
|
|
1846
|
+
},
|
|
1847
|
+
error(h, y) {
|
|
1848
|
+
g(!0), R.error(h, {
|
|
1849
|
+
output: r,
|
|
1850
|
+
secondarySymbol: i,
|
|
1851
|
+
spacing: 1
|
|
1852
|
+
}), y?.showLog !== !1 && p(), n.splice(1, n.length - 1), n[0].value = "", n[0].full = "";
|
|
1853
|
+
},
|
|
1854
|
+
success(h, y) {
|
|
1855
|
+
g(!0), R.success(h, {
|
|
1856
|
+
output: r,
|
|
1857
|
+
secondarySymbol: i,
|
|
1858
|
+
spacing: 1
|
|
1859
|
+
}), y?.showLog === !0 && p(), n.splice(1, n.length - 1), n[0].value = "", n[0].full = "";
|
|
1201
1860
|
}
|
|
1202
1861
|
};
|
|
1203
|
-
},
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1862
|
+
}, Ze = (t) => new $t$1({
|
|
1863
|
+
validate: t.validate,
|
|
1864
|
+
placeholder: t.placeholder,
|
|
1865
|
+
defaultValue: t.defaultValue,
|
|
1866
|
+
initialValue: t.initialValue,
|
|
1867
|
+
output: t.output,
|
|
1868
|
+
signal: t.signal,
|
|
1869
|
+
input: t.input,
|
|
1870
|
+
render() {
|
|
1871
|
+
const r = t?.withGuide ?? _.withGuide, s = `${`${r ? `${import_picocolors.default.gray(d)}
|
|
1872
|
+
` : ""}${W(this.state)} `}${t.message}
|
|
1873
|
+
`, i = t.placeholder ? import_picocolors.default.inverse(t.placeholder[0]) + import_picocolors.default.dim(t.placeholder.slice(1)) : import_picocolors.default.inverse(import_picocolors.default.hidden("_")), a = this.userInput ? this.userInputWithCursor : i, o = this.value ?? "";
|
|
1874
|
+
switch (this.state) {
|
|
1875
|
+
case "error": {
|
|
1876
|
+
const u = this.error ? ` ${import_picocolors.default.yellow(this.error)}` : "", l = r ? `${import_picocolors.default.yellow(d)} ` : "", n = r ? import_picocolors.default.yellow(x) : "";
|
|
1877
|
+
return `${s.trim()}
|
|
1878
|
+
${l}${a}
|
|
1879
|
+
${n}${u}
|
|
1880
|
+
`;
|
|
1881
|
+
}
|
|
1882
|
+
case "submit": {
|
|
1883
|
+
const u = o ? ` ${import_picocolors.default.dim(o)}` : "";
|
|
1884
|
+
return `${s}${r ? import_picocolors.default.gray(d) : ""}${u}`;
|
|
1885
|
+
}
|
|
1886
|
+
case "cancel": {
|
|
1887
|
+
const u = o ? ` ${import_picocolors.default.strikethrough(import_picocolors.default.dim(o))}` : "", l = r ? import_picocolors.default.gray(d) : "";
|
|
1888
|
+
return `${s}${l}${u}${o.trim() ? `
|
|
1889
|
+
${l}` : ""}`;
|
|
1890
|
+
}
|
|
1891
|
+
default: return `${s}${r ? `${import_picocolors.default.cyan(d)} ` : ""}${a}
|
|
1892
|
+
${r ? import_picocolors.default.cyan(x) : ""}
|
|
1893
|
+
`;
|
|
1212
1894
|
}
|
|
1213
|
-
r[s] = a;
|
|
1214
|
-
}
|
|
1215
|
-
return r;
|
|
1216
|
-
}, Te = async (t) => {
|
|
1217
|
-
for (const n of t) {
|
|
1218
|
-
if (n.enabled === !1) continue;
|
|
1219
|
-
const r = Y();
|
|
1220
|
-
r.start(n.title);
|
|
1221
|
-
const i = await n.task(r.message);
|
|
1222
|
-
r.stop(i || n.title);
|
|
1223
1895
|
}
|
|
1224
|
-
};
|
|
1896
|
+
}).prompt();
|
|
1225
1897
|
|
|
1226
1898
|
//#endregion
|
|
1227
1899
|
//#region src/constants.ts
|
|
1228
1900
|
const REPO_URL = "https://github.com/buiducnhat/agent-skills.git";
|
|
1229
1901
|
const REPO_BRANCH = "main";
|
|
1902
|
+
const SUPPORTED_AGENTS = [
|
|
1903
|
+
{
|
|
1904
|
+
id: "adal",
|
|
1905
|
+
name: "AdaL"
|
|
1906
|
+
},
|
|
1907
|
+
{
|
|
1908
|
+
id: "amp",
|
|
1909
|
+
name: "Amp"
|
|
1910
|
+
},
|
|
1911
|
+
{
|
|
1912
|
+
id: "antigravity",
|
|
1913
|
+
name: "Antigravity"
|
|
1914
|
+
},
|
|
1915
|
+
{
|
|
1916
|
+
id: "augment",
|
|
1917
|
+
name: "Augment"
|
|
1918
|
+
},
|
|
1919
|
+
{
|
|
1920
|
+
id: "claude-code",
|
|
1921
|
+
name: "Claude Code"
|
|
1922
|
+
},
|
|
1923
|
+
{
|
|
1924
|
+
id: "cline",
|
|
1925
|
+
name: "Cline"
|
|
1926
|
+
},
|
|
1927
|
+
{
|
|
1928
|
+
id: "codebuddy",
|
|
1929
|
+
name: "CodeBuddy"
|
|
1930
|
+
},
|
|
1931
|
+
{
|
|
1932
|
+
id: "codex",
|
|
1933
|
+
name: "Codex"
|
|
1934
|
+
},
|
|
1935
|
+
{
|
|
1936
|
+
id: "command-code",
|
|
1937
|
+
name: "Command Code"
|
|
1938
|
+
},
|
|
1939
|
+
{
|
|
1940
|
+
id: "continue",
|
|
1941
|
+
name: "Continue"
|
|
1942
|
+
},
|
|
1943
|
+
{
|
|
1944
|
+
id: "cortex",
|
|
1945
|
+
name: "Cortex Code"
|
|
1946
|
+
},
|
|
1947
|
+
{
|
|
1948
|
+
id: "crush",
|
|
1949
|
+
name: "Crush"
|
|
1950
|
+
},
|
|
1951
|
+
{
|
|
1952
|
+
id: "cursor",
|
|
1953
|
+
name: "Cursor"
|
|
1954
|
+
},
|
|
1955
|
+
{
|
|
1956
|
+
id: "droid",
|
|
1957
|
+
name: "Droid"
|
|
1958
|
+
},
|
|
1959
|
+
{
|
|
1960
|
+
id: "gemini-cli",
|
|
1961
|
+
name: "Gemini CLI"
|
|
1962
|
+
},
|
|
1963
|
+
{
|
|
1964
|
+
id: "github-copilot",
|
|
1965
|
+
name: "GitHub Copilot"
|
|
1966
|
+
},
|
|
1967
|
+
{
|
|
1968
|
+
id: "goose",
|
|
1969
|
+
name: "Goose"
|
|
1970
|
+
},
|
|
1971
|
+
{
|
|
1972
|
+
id: "iflow-cli",
|
|
1973
|
+
name: "iFlow CLI"
|
|
1974
|
+
},
|
|
1975
|
+
{
|
|
1976
|
+
id: "junie",
|
|
1977
|
+
name: "Junie"
|
|
1978
|
+
},
|
|
1979
|
+
{
|
|
1980
|
+
id: "kilo",
|
|
1981
|
+
name: "Kilo Code"
|
|
1982
|
+
},
|
|
1983
|
+
{
|
|
1984
|
+
id: "kimi-cli",
|
|
1985
|
+
name: "Kimi Code CLI"
|
|
1986
|
+
},
|
|
1987
|
+
{
|
|
1988
|
+
id: "kiro-cli",
|
|
1989
|
+
name: "Kiro CLI"
|
|
1990
|
+
},
|
|
1991
|
+
{
|
|
1992
|
+
id: "kode",
|
|
1993
|
+
name: "Kode"
|
|
1994
|
+
},
|
|
1995
|
+
{
|
|
1996
|
+
id: "mcpjam",
|
|
1997
|
+
name: "MCPJam"
|
|
1998
|
+
},
|
|
1999
|
+
{
|
|
2000
|
+
id: "mistral-vibe",
|
|
2001
|
+
name: "Mistral Vibe"
|
|
2002
|
+
},
|
|
2003
|
+
{
|
|
2004
|
+
id: "mux",
|
|
2005
|
+
name: "Mux"
|
|
2006
|
+
},
|
|
2007
|
+
{
|
|
2008
|
+
id: "neovate",
|
|
2009
|
+
name: "Neovate"
|
|
2010
|
+
},
|
|
2011
|
+
{
|
|
2012
|
+
id: "openclaw",
|
|
2013
|
+
name: "OpenClaw"
|
|
2014
|
+
},
|
|
2015
|
+
{
|
|
2016
|
+
id: "opencode",
|
|
2017
|
+
name: "OpenCode"
|
|
2018
|
+
},
|
|
2019
|
+
{
|
|
2020
|
+
id: "openhands",
|
|
2021
|
+
name: "OpenHands"
|
|
2022
|
+
},
|
|
2023
|
+
{
|
|
2024
|
+
id: "pi",
|
|
2025
|
+
name: "Pi"
|
|
2026
|
+
},
|
|
2027
|
+
{
|
|
2028
|
+
id: "pochi",
|
|
2029
|
+
name: "Pochi"
|
|
2030
|
+
},
|
|
2031
|
+
{
|
|
2032
|
+
id: "qoder",
|
|
2033
|
+
name: "Qoder"
|
|
2034
|
+
},
|
|
2035
|
+
{
|
|
2036
|
+
id: "qwen-code",
|
|
2037
|
+
name: "Qwen Code"
|
|
2038
|
+
},
|
|
2039
|
+
{
|
|
2040
|
+
id: "replit",
|
|
2041
|
+
name: "Replit"
|
|
2042
|
+
},
|
|
2043
|
+
{
|
|
2044
|
+
id: "roo",
|
|
2045
|
+
name: "Roo Code"
|
|
2046
|
+
},
|
|
2047
|
+
{
|
|
2048
|
+
id: "trae",
|
|
2049
|
+
name: "Trae"
|
|
2050
|
+
},
|
|
2051
|
+
{
|
|
2052
|
+
id: "trae-cn",
|
|
2053
|
+
name: "Trae CN"
|
|
2054
|
+
},
|
|
2055
|
+
{
|
|
2056
|
+
id: "windsurf",
|
|
2057
|
+
name: "Windsurf"
|
|
2058
|
+
},
|
|
2059
|
+
{
|
|
2060
|
+
id: "zencoder",
|
|
2061
|
+
name: "Zencoder"
|
|
2062
|
+
}
|
|
2063
|
+
];
|
|
1230
2064
|
const AGENT_SKILLS_DIRS = {
|
|
2065
|
+
".adal": "adal",
|
|
2066
|
+
".agent": "antigravity",
|
|
2067
|
+
".agents": "amp",
|
|
2068
|
+
".augment": "augment",
|
|
1231
2069
|
".claude": "claude-code",
|
|
2070
|
+
".codebuddy": "codebuddy",
|
|
2071
|
+
".commandcode": "command-code",
|
|
2072
|
+
".continue": "continue",
|
|
2073
|
+
".cortex": "cortex",
|
|
2074
|
+
".crush": "crush",
|
|
1232
2075
|
".cursor": "cursor",
|
|
1233
|
-
".
|
|
1234
|
-
".pi": "pi",
|
|
2076
|
+
".factory": "droid",
|
|
1235
2077
|
".gemini": "gemini-cli",
|
|
1236
|
-
".
|
|
1237
|
-
".
|
|
1238
|
-
".
|
|
1239
|
-
".
|
|
1240
|
-
".
|
|
2078
|
+
".goose": "goose",
|
|
2079
|
+
".iflow": "iflow-cli",
|
|
2080
|
+
".junie": "junie",
|
|
2081
|
+
".kilocode": "kilo",
|
|
2082
|
+
".kiro": "kiro-cli",
|
|
2083
|
+
".kode": "kode",
|
|
2084
|
+
".mcpjam": "mcpjam",
|
|
2085
|
+
".mux": "mux",
|
|
2086
|
+
".neovate": "neovate",
|
|
2087
|
+
".openhands": "openhands",
|
|
2088
|
+
".pi": "pi",
|
|
2089
|
+
".pochi": "pochi",
|
|
2090
|
+
".qoder": "qoder",
|
|
2091
|
+
".qwen": "qwen-code",
|
|
2092
|
+
".roo": "roo",
|
|
2093
|
+
".trae": "trae",
|
|
1241
2094
|
".vibe": "mistral-vibe",
|
|
1242
|
-
".
|
|
1243
|
-
".
|
|
2095
|
+
".windsurf": "windsurf",
|
|
2096
|
+
".zencoder": "zencoder",
|
|
2097
|
+
skills: "openclaw"
|
|
1244
2098
|
};
|
|
1245
2099
|
const AGENT_RULES_MAP = {
|
|
1246
2100
|
"github-copilot": "AGENTS.md",
|
|
1247
2101
|
codex: "AGENTS.md",
|
|
1248
2102
|
pi: "AGENTS.md",
|
|
1249
|
-
jules: "AGENTS.md",
|
|
1250
2103
|
cursor: "AGENTS.md",
|
|
1251
2104
|
amp: "AGENTS.md",
|
|
1252
2105
|
"gemini-cli": "AGENTS.md",
|
|
1253
|
-
|
|
2106
|
+
kilo: "AGENTS.md",
|
|
1254
2107
|
opencode: "AGENTS.md",
|
|
1255
2108
|
"qwen-code": "AGENTS.md",
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
"factory-droid": "AGENTS.md",
|
|
2109
|
+
roo: "AGENTS.md",
|
|
2110
|
+
droid: "AGENTS.md",
|
|
1259
2111
|
"mistral-vibe": "AGENTS.md",
|
|
1260
2112
|
aider: "AGENTS.md",
|
|
1261
2113
|
windsurf: "AGENTS.md",
|
|
2114
|
+
replit: "AGENTS.md",
|
|
2115
|
+
adal: "AGENTS.md",
|
|
2116
|
+
codebuddy: "AGENTS.md",
|
|
2117
|
+
"command-code": "AGENTS.md",
|
|
2118
|
+
continue: "AGENTS.md",
|
|
2119
|
+
cortex: "AGENTS.md",
|
|
2120
|
+
"iflow-cli": "AGENTS.md",
|
|
2121
|
+
"kimi-cli": "AGENTS.md",
|
|
2122
|
+
kode: "AGENTS.md",
|
|
2123
|
+
mcpjam: "AGENTS.md",
|
|
2124
|
+
mux: "AGENTS.md",
|
|
2125
|
+
neovate: "AGENTS.md",
|
|
2126
|
+
openclaw: "AGENTS.md",
|
|
2127
|
+
pochi: "AGENTS.md",
|
|
2128
|
+
qoder: "AGENTS.md",
|
|
2129
|
+
"trae-cn": "AGENTS.md",
|
|
2130
|
+
zencoder: "AGENTS.md",
|
|
1262
2131
|
"claude-code": "CLAUDE.md",
|
|
1263
2132
|
cline: ".clinerules",
|
|
1264
2133
|
crush: "CRUSH.md",
|
|
1265
|
-
warp: "WARP.md",
|
|
1266
2134
|
antigravity: ".agent/rules/ruler.md",
|
|
1267
2135
|
"amazon-q": ".amazonq/rules/ruler_q_rules.md",
|
|
1268
2136
|
"firebase-studio": ".idx/airules.md",
|
|
1269
|
-
|
|
2137
|
+
openhands: ".openhands/microagents/repo.md",
|
|
1270
2138
|
junie: ".junie/guidelines.md",
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
kiro: ".kiro/steering/ruler_kiro_instructions.md",
|
|
2139
|
+
augment: ".augment/rules/ruler_augment_instructions.md",
|
|
2140
|
+
trae: ".trae/rules/project_rules.md",
|
|
2141
|
+
"kiro-cli": ".kiro/steering/ruler_kiro_instructions.md",
|
|
1274
2142
|
"jetbrains-ai": ".aiassistant/rules/AGENTS.md",
|
|
1275
2143
|
goose: ".goosehints"
|
|
1276
2144
|
};
|
|
@@ -1280,7 +2148,7 @@ const RULES_MARKER_END = "<!-- END agent-skills rules -->";
|
|
|
1280
2148
|
//#endregion
|
|
1281
2149
|
//#region src/fetch.ts
|
|
1282
2150
|
async function fetchTemplates() {
|
|
1283
|
-
const s =
|
|
2151
|
+
const s = bt();
|
|
1284
2152
|
s.start("Downloading agent skills from GitHub...");
|
|
1285
2153
|
const tempDir = mkdtempSync(path.join(tmpdir(), "agent-skills-"));
|
|
1286
2154
|
try {
|
|
@@ -1349,8 +2217,8 @@ function injectRules(projectDir, agents, agentsContent) {
|
|
|
1349
2217
|
|
|
1350
2218
|
//#endregion
|
|
1351
2219
|
//#region src/skills.ts
|
|
1352
|
-
async function runSkillsAdd(projectDir,
|
|
1353
|
-
const args =
|
|
2220
|
+
async function runSkillsAdd(projectDir, agents) {
|
|
2221
|
+
const args = agents.length === 0 ? [
|
|
1354
2222
|
"skills",
|
|
1355
2223
|
"add",
|
|
1356
2224
|
"buiducnhat/agent-skills",
|
|
@@ -1363,65 +2231,23 @@ async function runSkillsAdd(projectDir, nonInteractive) {
|
|
|
1363
2231
|
"add",
|
|
1364
2232
|
"buiducnhat/agent-skills",
|
|
1365
2233
|
"--skill",
|
|
1366
|
-
"*"
|
|
2234
|
+
"*",
|
|
2235
|
+
...agents.flatMap((a) => ["-a", a]),
|
|
2236
|
+
"-y"
|
|
1367
2237
|
];
|
|
1368
2238
|
return new Promise((resolve) => {
|
|
1369
|
-
const chunks = [];
|
|
1370
2239
|
const child = spawn("npx", args, {
|
|
1371
2240
|
cwd: projectDir,
|
|
1372
|
-
stdio:
|
|
1373
|
-
"inherit",
|
|
1374
|
-
"pipe",
|
|
1375
|
-
"inherit"
|
|
1376
|
-
]
|
|
1377
|
-
});
|
|
1378
|
-
child.stdout.on("data", (chunk) => {
|
|
1379
|
-
process.stdout.write(chunk);
|
|
1380
|
-
chunks.push(chunk);
|
|
2241
|
+
stdio: "inherit"
|
|
1381
2242
|
});
|
|
1382
2243
|
child.on("close", (code) => {
|
|
1383
|
-
|
|
1384
|
-
const success = code === 0;
|
|
1385
|
-
resolve({
|
|
1386
|
-
success,
|
|
1387
|
-
detectedAgents: success ? detectAgentsFromOutput(rawOutput) : [],
|
|
1388
|
-
rawOutput
|
|
1389
|
-
});
|
|
2244
|
+
resolve({ success: code === 0 });
|
|
1390
2245
|
});
|
|
1391
|
-
child.on("error", (
|
|
1392
|
-
resolve({
|
|
1393
|
-
success: false,
|
|
1394
|
-
detectedAgents: [],
|
|
1395
|
-
rawOutput: err.message
|
|
1396
|
-
});
|
|
2246
|
+
child.on("error", () => {
|
|
2247
|
+
resolve({ success: false });
|
|
1397
2248
|
});
|
|
1398
2249
|
});
|
|
1399
2250
|
}
|
|
1400
|
-
function detectAgentsFromOutput(output) {
|
|
1401
|
-
const detected = /* @__PURE__ */ new Set();
|
|
1402
|
-
for (const [dirPrefix, agentId] of Object.entries(AGENT_SKILLS_DIRS)) {
|
|
1403
|
-
const dirName = dirPrefix.slice(1);
|
|
1404
|
-
const patterns = [
|
|
1405
|
-
new RegExp(`\\.${dirName}/skills/`, "i"),
|
|
1406
|
-
new RegExp(`Installing.*\\.${dirName}`, "i"),
|
|
1407
|
-
new RegExp(`Added.*\\.${dirName}`, "i"),
|
|
1408
|
-
new RegExp(`\\b${dirName}\\b`, "i")
|
|
1409
|
-
];
|
|
1410
|
-
for (const pattern of patterns) if (pattern.test(output)) {
|
|
1411
|
-
detected.add(agentId);
|
|
1412
|
-
break;
|
|
1413
|
-
}
|
|
1414
|
-
}
|
|
1415
|
-
return Array.from(detected);
|
|
1416
|
-
}
|
|
1417
|
-
function detectAgentsFromFilesystem(projectDir) {
|
|
1418
|
-
const detected = [];
|
|
1419
|
-
for (const [dirPrefix, agentId] of Object.entries(AGENT_SKILLS_DIRS)) {
|
|
1420
|
-
const skillsDir = path.join(projectDir, dirPrefix, "skills");
|
|
1421
|
-
if (fs.existsSync(skillsDir)) detected.push(agentId);
|
|
1422
|
-
}
|
|
1423
|
-
return detected;
|
|
1424
|
-
}
|
|
1425
2251
|
|
|
1426
2252
|
//#endregion
|
|
1427
2253
|
//#region src/utils.ts
|
|
@@ -1446,6 +2272,14 @@ function parseArgs(argv) {
|
|
|
1446
2272
|
}
|
|
1447
2273
|
return args;
|
|
1448
2274
|
}
|
|
2275
|
+
function detectAgentsFromFilesystem(projectDir) {
|
|
2276
|
+
const detected = [];
|
|
2277
|
+
for (const [dirPrefix, agentId] of Object.entries(AGENT_SKILLS_DIRS)) {
|
|
2278
|
+
const skillsDir = path.join(projectDir, dirPrefix, "skills");
|
|
2279
|
+
if (fs.existsSync(skillsDir)) detected.push(agentId);
|
|
2280
|
+
}
|
|
2281
|
+
return detected;
|
|
2282
|
+
}
|
|
1449
2283
|
function copyDirectory(src, dest) {
|
|
1450
2284
|
fs.mkdirSync(dest, { recursive: true });
|
|
1451
2285
|
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
@@ -1459,7 +2293,15 @@ function copyDirectory(src, dest) {
|
|
|
1459
2293
|
function copyClaudeTemplate(tempDir, projectDir) {
|
|
1460
2294
|
const srcClaude = path.join(tempDir, "templates", ".claude");
|
|
1461
2295
|
const destClaude = path.join(projectDir, ".claude");
|
|
1462
|
-
if (fs.existsSync(srcClaude))
|
|
2296
|
+
if (!fs.existsSync(srcClaude)) return;
|
|
2297
|
+
fs.mkdirSync(destClaude, { recursive: true });
|
|
2298
|
+
for (const entry of fs.readdirSync(srcClaude, { withFileTypes: true })) {
|
|
2299
|
+
if (entry.name === "skills") continue;
|
|
2300
|
+
const src = path.join(srcClaude, entry.name);
|
|
2301
|
+
const dest = path.join(destClaude, entry.name);
|
|
2302
|
+
if (entry.isDirectory()) copyDirectory(src, dest);
|
|
2303
|
+
else fs.copyFileSync(src, dest);
|
|
2304
|
+
}
|
|
1463
2305
|
}
|
|
1464
2306
|
function printHelp() {
|
|
1465
2307
|
console.log(`
|
|
@@ -1478,18 +2320,18 @@ function printHelp() {
|
|
|
1478
2320
|
`);
|
|
1479
2321
|
}
|
|
1480
2322
|
function printSummary(agents, results) {
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
for (const result of results) if (result.action !== "skipped")
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
for (const agent of agents)
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
2323
|
+
R.success("Installation complete!");
|
|
2324
|
+
R.message("");
|
|
2325
|
+
R.message("What was set up:");
|
|
2326
|
+
R.message(" .claude/ - Claude Code settings");
|
|
2327
|
+
for (const result of results) if (result.action !== "skipped") R.message(` ${result.rulesFile} - ${result.action}`);
|
|
2328
|
+
R.message("");
|
|
2329
|
+
R.message("Agent configurations updated for:");
|
|
2330
|
+
for (const agent of agents) R.message(` - ${agent}`);
|
|
2331
|
+
R.message("");
|
|
2332
|
+
R.message("Next steps:");
|
|
2333
|
+
R.message(" 1. Review the updated agent rules files");
|
|
2334
|
+
R.message(" 2. Commit the generated files to your repository");
|
|
1493
2335
|
}
|
|
1494
2336
|
|
|
1495
2337
|
//#endregion
|
|
@@ -1512,36 +2354,59 @@ async function main() {
|
|
|
1512
2354
|
console.log(getCliVersion());
|
|
1513
2355
|
process.exit(0);
|
|
1514
2356
|
}
|
|
1515
|
-
|
|
2357
|
+
We(import_picocolors.default.bold(import_picocolors.default.cyan(" Agent Skills Installer ")));
|
|
1516
2358
|
const cwd = process.cwd();
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
2359
|
+
let selectedAgents;
|
|
2360
|
+
if (args.nonInteractive) {
|
|
2361
|
+
R.step("Installing skills to all agents (non-interactive)...");
|
|
2362
|
+
if (!(await runSkillsAdd(cwd, [])).success) {
|
|
2363
|
+
Ne(import_picocolors.default.red("Skills CLI failed. See errors above.\nYou can try running manually: npx skills add buiducnhat/agent-skills --skill '*' --all -y"));
|
|
2364
|
+
process.exit(1);
|
|
2365
|
+
}
|
|
2366
|
+
selectedAgents = detectAgentsFromFilesystem(cwd);
|
|
2367
|
+
if (selectedAgents.length === 0) {
|
|
2368
|
+
R.warn("No agents detected from filesystem. Skills may have been installed but rules injection was skipped.");
|
|
2369
|
+
Le(import_picocolors.default.yellow("Done. No agent rules files were updated."));
|
|
2370
|
+
process.exit(0);
|
|
2371
|
+
}
|
|
2372
|
+
} else {
|
|
2373
|
+
const preSelected = detectAgentsFromFilesystem(cwd);
|
|
2374
|
+
const selection = await je({
|
|
2375
|
+
message: "Select agents to install skills for:",
|
|
2376
|
+
options: SUPPORTED_AGENTS.map((a) => ({
|
|
2377
|
+
value: a.id,
|
|
2378
|
+
label: a.name
|
|
2379
|
+
})),
|
|
2380
|
+
initialValues: preSelected,
|
|
2381
|
+
required: false
|
|
2382
|
+
});
|
|
2383
|
+
if (Ct$1(selection)) {
|
|
2384
|
+
Ne("Installation cancelled.");
|
|
2385
|
+
process.exit(0);
|
|
2386
|
+
}
|
|
2387
|
+
selectedAgents = selection;
|
|
2388
|
+
if (selectedAgents.length === 0) {
|
|
2389
|
+
Le(import_picocolors.default.yellow("No agents selected. Nothing to install."));
|
|
2390
|
+
process.exit(0);
|
|
2391
|
+
}
|
|
2392
|
+
R.step("Installing skills via skills CLI...");
|
|
2393
|
+
if (!(await runSkillsAdd(cwd, selectedAgents)).success) {
|
|
2394
|
+
Ne(import_picocolors.default.red("Skills CLI failed. See errors above.\nYou can try running manually: npx skills add buiducnhat/agent-skills --skill '*' -a <agent> -y"));
|
|
2395
|
+
process.exit(1);
|
|
2396
|
+
}
|
|
1532
2397
|
}
|
|
1533
|
-
|
|
2398
|
+
R.info(`Configuring agents: ${selectedAgents.join(", ")}`);
|
|
1534
2399
|
let tempDir;
|
|
1535
2400
|
try {
|
|
1536
2401
|
tempDir = await fetchTemplates();
|
|
1537
2402
|
const agentsContent = fs.readFileSync(path.join(tempDir, "templates", "AGENTS.md"), "utf-8");
|
|
1538
|
-
const results = injectRules(cwd,
|
|
2403
|
+
const results = injectRules(cwd, selectedAgents, agentsContent);
|
|
1539
2404
|
copyClaudeTemplate(tempDir, cwd);
|
|
1540
|
-
printSummary(
|
|
1541
|
-
|
|
2405
|
+
printSummary(selectedAgents, results);
|
|
2406
|
+
Le(import_picocolors.default.green("Done! Your AI agent skills are ready."));
|
|
1542
2407
|
} catch (err) {
|
|
1543
2408
|
const message = err instanceof Error ? err.message : String(err);
|
|
1544
|
-
|
|
2409
|
+
Ne(import_picocolors.default.red(`Error: ${message}`));
|
|
1545
2410
|
process.exit(1);
|
|
1546
2411
|
} finally {
|
|
1547
2412
|
if (tempDir) cleanupTemp(tempDir);
|