dlw-machine-setup 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +112 -0
  2. package/bin/installer.js +4208 -0
  3. package/package.json +24 -0
@@ -0,0 +1,4208 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __commonJS = (cb, mod) => function __require() {
10
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+
29
+ // node_modules/yoctocolors-cjs/index.js
30
+ var require_yoctocolors_cjs = __commonJS({
31
+ "node_modules/yoctocolors-cjs/index.js"(exports2, module2) {
32
+ var tty = require("node:tty");
33
+ var hasColors = tty?.WriteStream?.prototype?.hasColors?.() ?? false;
34
+ var format = (open, close) => {
35
+ if (!hasColors) {
36
+ return (input) => input;
37
+ }
38
+ const openCode = `\x1B[${open}m`;
39
+ const closeCode = `\x1B[${close}m`;
40
+ return (input) => {
41
+ const string = input + "";
42
+ let index = string.indexOf(closeCode);
43
+ if (index === -1) {
44
+ return openCode + string + closeCode;
45
+ }
46
+ let result = openCode;
47
+ let lastIndex = 0;
48
+ const reopenOnNestedClose = close === 22;
49
+ const replaceCode = (reopenOnNestedClose ? closeCode : "") + openCode;
50
+ while (index !== -1) {
51
+ result += string.slice(lastIndex, index) + replaceCode;
52
+ lastIndex = index + closeCode.length;
53
+ index = string.indexOf(closeCode, lastIndex);
54
+ }
55
+ result += string.slice(lastIndex) + closeCode;
56
+ return result;
57
+ };
58
+ };
59
+ var colors5 = {};
60
+ colors5.reset = format(0, 0);
61
+ colors5.bold = format(1, 22);
62
+ colors5.dim = format(2, 22);
63
+ colors5.italic = format(3, 23);
64
+ colors5.underline = format(4, 24);
65
+ colors5.overline = format(53, 55);
66
+ colors5.inverse = format(7, 27);
67
+ colors5.hidden = format(8, 28);
68
+ colors5.strikethrough = format(9, 29);
69
+ colors5.black = format(30, 39);
70
+ colors5.red = format(31, 39);
71
+ colors5.green = format(32, 39);
72
+ colors5.yellow = format(33, 39);
73
+ colors5.blue = format(34, 39);
74
+ colors5.magenta = format(35, 39);
75
+ colors5.cyan = format(36, 39);
76
+ colors5.white = format(37, 39);
77
+ colors5.gray = format(90, 39);
78
+ colors5.bgBlack = format(40, 49);
79
+ colors5.bgRed = format(41, 49);
80
+ colors5.bgGreen = format(42, 49);
81
+ colors5.bgYellow = format(43, 49);
82
+ colors5.bgBlue = format(44, 49);
83
+ colors5.bgMagenta = format(45, 49);
84
+ colors5.bgCyan = format(46, 49);
85
+ colors5.bgWhite = format(47, 49);
86
+ colors5.bgGray = format(100, 49);
87
+ colors5.redBright = format(91, 39);
88
+ colors5.greenBright = format(92, 39);
89
+ colors5.yellowBright = format(93, 39);
90
+ colors5.blueBright = format(94, 39);
91
+ colors5.magentaBright = format(95, 39);
92
+ colors5.cyanBright = format(96, 39);
93
+ colors5.whiteBright = format(97, 39);
94
+ colors5.bgRedBright = format(101, 49);
95
+ colors5.bgGreenBright = format(102, 49);
96
+ colors5.bgYellowBright = format(103, 49);
97
+ colors5.bgBlueBright = format(104, 49);
98
+ colors5.bgMagentaBright = format(105, 49);
99
+ colors5.bgCyanBright = format(106, 49);
100
+ colors5.bgWhiteBright = format(107, 49);
101
+ module2.exports = colors5;
102
+ }
103
+ });
104
+
105
+ // node_modules/cli-width/index.js
106
+ var require_cli_width = __commonJS({
107
+ "node_modules/cli-width/index.js"(exports2, module2) {
108
+ "use strict";
109
+ module2.exports = cliWidth2;
110
+ function normalizeOpts(options) {
111
+ const defaultOpts = {
112
+ defaultWidth: 0,
113
+ output: process.stdout,
114
+ tty: require("tty")
115
+ };
116
+ if (!options) {
117
+ return defaultOpts;
118
+ }
119
+ Object.keys(defaultOpts).forEach(function(key) {
120
+ if (!options[key]) {
121
+ options[key] = defaultOpts[key];
122
+ }
123
+ });
124
+ return options;
125
+ }
126
+ function cliWidth2(options) {
127
+ const opts = normalizeOpts(options);
128
+ if (opts.output.getWindowSize) {
129
+ return opts.output.getWindowSize()[0] || opts.defaultWidth;
130
+ }
131
+ if (opts.tty.getWindowSize) {
132
+ return opts.tty.getWindowSize()[1] || opts.defaultWidth;
133
+ }
134
+ if (opts.output.columns) {
135
+ return opts.output.columns;
136
+ }
137
+ if (process.env.CLI_WIDTH) {
138
+ const width = parseInt(process.env.CLI_WIDTH, 10);
139
+ if (!isNaN(width) && width !== 0) {
140
+ return width;
141
+ }
142
+ }
143
+ return opts.defaultWidth;
144
+ }
145
+ }
146
+ });
147
+
148
+ // node_modules/ansi-regex/index.js
149
+ var require_ansi_regex = __commonJS({
150
+ "node_modules/ansi-regex/index.js"(exports2, module2) {
151
+ "use strict";
152
+ module2.exports = ({ onlyFirst = false } = {}) => {
153
+ const pattern = [
154
+ "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
155
+ "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"
156
+ ].join("|");
157
+ return new RegExp(pattern, onlyFirst ? void 0 : "g");
158
+ };
159
+ }
160
+ });
161
+
162
+ // node_modules/strip-ansi/index.js
163
+ var require_strip_ansi = __commonJS({
164
+ "node_modules/strip-ansi/index.js"(exports2, module2) {
165
+ "use strict";
166
+ var ansiRegex = require_ansi_regex();
167
+ module2.exports = (string) => typeof string === "string" ? string.replace(ansiRegex(), "") : string;
168
+ }
169
+ });
170
+
171
+ // node_modules/is-fullwidth-code-point/index.js
172
+ var require_is_fullwidth_code_point = __commonJS({
173
+ "node_modules/is-fullwidth-code-point/index.js"(exports2, module2) {
174
+ "use strict";
175
+ var isFullwidthCodePoint = (codePoint) => {
176
+ if (Number.isNaN(codePoint)) {
177
+ return false;
178
+ }
179
+ if (codePoint >= 4352 && (codePoint <= 4447 || // Hangul Jamo
180
+ codePoint === 9001 || // LEFT-POINTING ANGLE BRACKET
181
+ codePoint === 9002 || // RIGHT-POINTING ANGLE BRACKET
182
+ // CJK Radicals Supplement .. Enclosed CJK Letters and Months
183
+ 11904 <= codePoint && codePoint <= 12871 && codePoint !== 12351 || // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
184
+ 12880 <= codePoint && codePoint <= 19903 || // CJK Unified Ideographs .. Yi Radicals
185
+ 19968 <= codePoint && codePoint <= 42182 || // Hangul Jamo Extended-A
186
+ 43360 <= codePoint && codePoint <= 43388 || // Hangul Syllables
187
+ 44032 <= codePoint && codePoint <= 55203 || // CJK Compatibility Ideographs
188
+ 63744 <= codePoint && codePoint <= 64255 || // Vertical Forms
189
+ 65040 <= codePoint && codePoint <= 65049 || // CJK Compatibility Forms .. Small Form Variants
190
+ 65072 <= codePoint && codePoint <= 65131 || // Halfwidth and Fullwidth Forms
191
+ 65281 <= codePoint && codePoint <= 65376 || 65504 <= codePoint && codePoint <= 65510 || // Kana Supplement
192
+ 110592 <= codePoint && codePoint <= 110593 || // Enclosed Ideographic Supplement
193
+ 127488 <= codePoint && codePoint <= 127569 || // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
194
+ 131072 <= codePoint && codePoint <= 262141)) {
195
+ return true;
196
+ }
197
+ return false;
198
+ };
199
+ module2.exports = isFullwidthCodePoint;
200
+ module2.exports.default = isFullwidthCodePoint;
201
+ }
202
+ });
203
+
204
+ // node_modules/emoji-regex/index.js
205
+ var require_emoji_regex = __commonJS({
206
+ "node_modules/emoji-regex/index.js"(exports2, module2) {
207
+ "use strict";
208
+ module2.exports = function() {
209
+ return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\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\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])|\uD83C[\uDF3E\uDF73\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])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\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])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\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\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\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\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\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\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*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\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\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\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[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
210
+ };
211
+ }
212
+ });
213
+
214
+ // node_modules/string-width/index.js
215
+ var require_string_width = __commonJS({
216
+ "node_modules/string-width/index.js"(exports2, module2) {
217
+ "use strict";
218
+ var stripAnsi2 = require_strip_ansi();
219
+ var isFullwidthCodePoint = require_is_fullwidth_code_point();
220
+ var emojiRegex = require_emoji_regex();
221
+ var stringWidth = (string) => {
222
+ if (typeof string !== "string" || string.length === 0) {
223
+ return 0;
224
+ }
225
+ string = stripAnsi2(string);
226
+ if (string.length === 0) {
227
+ return 0;
228
+ }
229
+ string = string.replace(emojiRegex(), " ");
230
+ let width = 0;
231
+ for (let i = 0; i < string.length; i++) {
232
+ const code = string.codePointAt(i);
233
+ if (code <= 31 || code >= 127 && code <= 159) {
234
+ continue;
235
+ }
236
+ if (code >= 768 && code <= 879) {
237
+ continue;
238
+ }
239
+ if (code > 65535) {
240
+ i++;
241
+ }
242
+ width += isFullwidthCodePoint(code) ? 2 : 1;
243
+ }
244
+ return width;
245
+ };
246
+ module2.exports = stringWidth;
247
+ module2.exports.default = stringWidth;
248
+ }
249
+ });
250
+
251
+ // node_modules/color-name/index.js
252
+ var require_color_name = __commonJS({
253
+ "node_modules/color-name/index.js"(exports2, module2) {
254
+ "use strict";
255
+ module2.exports = {
256
+ "aliceblue": [240, 248, 255],
257
+ "antiquewhite": [250, 235, 215],
258
+ "aqua": [0, 255, 255],
259
+ "aquamarine": [127, 255, 212],
260
+ "azure": [240, 255, 255],
261
+ "beige": [245, 245, 220],
262
+ "bisque": [255, 228, 196],
263
+ "black": [0, 0, 0],
264
+ "blanchedalmond": [255, 235, 205],
265
+ "blue": [0, 0, 255],
266
+ "blueviolet": [138, 43, 226],
267
+ "brown": [165, 42, 42],
268
+ "burlywood": [222, 184, 135],
269
+ "cadetblue": [95, 158, 160],
270
+ "chartreuse": [127, 255, 0],
271
+ "chocolate": [210, 105, 30],
272
+ "coral": [255, 127, 80],
273
+ "cornflowerblue": [100, 149, 237],
274
+ "cornsilk": [255, 248, 220],
275
+ "crimson": [220, 20, 60],
276
+ "cyan": [0, 255, 255],
277
+ "darkblue": [0, 0, 139],
278
+ "darkcyan": [0, 139, 139],
279
+ "darkgoldenrod": [184, 134, 11],
280
+ "darkgray": [169, 169, 169],
281
+ "darkgreen": [0, 100, 0],
282
+ "darkgrey": [169, 169, 169],
283
+ "darkkhaki": [189, 183, 107],
284
+ "darkmagenta": [139, 0, 139],
285
+ "darkolivegreen": [85, 107, 47],
286
+ "darkorange": [255, 140, 0],
287
+ "darkorchid": [153, 50, 204],
288
+ "darkred": [139, 0, 0],
289
+ "darksalmon": [233, 150, 122],
290
+ "darkseagreen": [143, 188, 143],
291
+ "darkslateblue": [72, 61, 139],
292
+ "darkslategray": [47, 79, 79],
293
+ "darkslategrey": [47, 79, 79],
294
+ "darkturquoise": [0, 206, 209],
295
+ "darkviolet": [148, 0, 211],
296
+ "deeppink": [255, 20, 147],
297
+ "deepskyblue": [0, 191, 255],
298
+ "dimgray": [105, 105, 105],
299
+ "dimgrey": [105, 105, 105],
300
+ "dodgerblue": [30, 144, 255],
301
+ "firebrick": [178, 34, 34],
302
+ "floralwhite": [255, 250, 240],
303
+ "forestgreen": [34, 139, 34],
304
+ "fuchsia": [255, 0, 255],
305
+ "gainsboro": [220, 220, 220],
306
+ "ghostwhite": [248, 248, 255],
307
+ "gold": [255, 215, 0],
308
+ "goldenrod": [218, 165, 32],
309
+ "gray": [128, 128, 128],
310
+ "green": [0, 128, 0],
311
+ "greenyellow": [173, 255, 47],
312
+ "grey": [128, 128, 128],
313
+ "honeydew": [240, 255, 240],
314
+ "hotpink": [255, 105, 180],
315
+ "indianred": [205, 92, 92],
316
+ "indigo": [75, 0, 130],
317
+ "ivory": [255, 255, 240],
318
+ "khaki": [240, 230, 140],
319
+ "lavender": [230, 230, 250],
320
+ "lavenderblush": [255, 240, 245],
321
+ "lawngreen": [124, 252, 0],
322
+ "lemonchiffon": [255, 250, 205],
323
+ "lightblue": [173, 216, 230],
324
+ "lightcoral": [240, 128, 128],
325
+ "lightcyan": [224, 255, 255],
326
+ "lightgoldenrodyellow": [250, 250, 210],
327
+ "lightgray": [211, 211, 211],
328
+ "lightgreen": [144, 238, 144],
329
+ "lightgrey": [211, 211, 211],
330
+ "lightpink": [255, 182, 193],
331
+ "lightsalmon": [255, 160, 122],
332
+ "lightseagreen": [32, 178, 170],
333
+ "lightskyblue": [135, 206, 250],
334
+ "lightslategray": [119, 136, 153],
335
+ "lightslategrey": [119, 136, 153],
336
+ "lightsteelblue": [176, 196, 222],
337
+ "lightyellow": [255, 255, 224],
338
+ "lime": [0, 255, 0],
339
+ "limegreen": [50, 205, 50],
340
+ "linen": [250, 240, 230],
341
+ "magenta": [255, 0, 255],
342
+ "maroon": [128, 0, 0],
343
+ "mediumaquamarine": [102, 205, 170],
344
+ "mediumblue": [0, 0, 205],
345
+ "mediumorchid": [186, 85, 211],
346
+ "mediumpurple": [147, 112, 219],
347
+ "mediumseagreen": [60, 179, 113],
348
+ "mediumslateblue": [123, 104, 238],
349
+ "mediumspringgreen": [0, 250, 154],
350
+ "mediumturquoise": [72, 209, 204],
351
+ "mediumvioletred": [199, 21, 133],
352
+ "midnightblue": [25, 25, 112],
353
+ "mintcream": [245, 255, 250],
354
+ "mistyrose": [255, 228, 225],
355
+ "moccasin": [255, 228, 181],
356
+ "navajowhite": [255, 222, 173],
357
+ "navy": [0, 0, 128],
358
+ "oldlace": [253, 245, 230],
359
+ "olive": [128, 128, 0],
360
+ "olivedrab": [107, 142, 35],
361
+ "orange": [255, 165, 0],
362
+ "orangered": [255, 69, 0],
363
+ "orchid": [218, 112, 214],
364
+ "palegoldenrod": [238, 232, 170],
365
+ "palegreen": [152, 251, 152],
366
+ "paleturquoise": [175, 238, 238],
367
+ "palevioletred": [219, 112, 147],
368
+ "papayawhip": [255, 239, 213],
369
+ "peachpuff": [255, 218, 185],
370
+ "peru": [205, 133, 63],
371
+ "pink": [255, 192, 203],
372
+ "plum": [221, 160, 221],
373
+ "powderblue": [176, 224, 230],
374
+ "purple": [128, 0, 128],
375
+ "rebeccapurple": [102, 51, 153],
376
+ "red": [255, 0, 0],
377
+ "rosybrown": [188, 143, 143],
378
+ "royalblue": [65, 105, 225],
379
+ "saddlebrown": [139, 69, 19],
380
+ "salmon": [250, 128, 114],
381
+ "sandybrown": [244, 164, 96],
382
+ "seagreen": [46, 139, 87],
383
+ "seashell": [255, 245, 238],
384
+ "sienna": [160, 82, 45],
385
+ "silver": [192, 192, 192],
386
+ "skyblue": [135, 206, 235],
387
+ "slateblue": [106, 90, 205],
388
+ "slategray": [112, 128, 144],
389
+ "slategrey": [112, 128, 144],
390
+ "snow": [255, 250, 250],
391
+ "springgreen": [0, 255, 127],
392
+ "steelblue": [70, 130, 180],
393
+ "tan": [210, 180, 140],
394
+ "teal": [0, 128, 128],
395
+ "thistle": [216, 191, 216],
396
+ "tomato": [255, 99, 71],
397
+ "turquoise": [64, 224, 208],
398
+ "violet": [238, 130, 238],
399
+ "wheat": [245, 222, 179],
400
+ "white": [255, 255, 255],
401
+ "whitesmoke": [245, 245, 245],
402
+ "yellow": [255, 255, 0],
403
+ "yellowgreen": [154, 205, 50]
404
+ };
405
+ }
406
+ });
407
+
408
+ // node_modules/color-convert/conversions.js
409
+ var require_conversions = __commonJS({
410
+ "node_modules/color-convert/conversions.js"(exports2, module2) {
411
+ var cssKeywords = require_color_name();
412
+ var reverseKeywords = {};
413
+ for (const key of Object.keys(cssKeywords)) {
414
+ reverseKeywords[cssKeywords[key]] = key;
415
+ }
416
+ var convert = {
417
+ rgb: { channels: 3, labels: "rgb" },
418
+ hsl: { channels: 3, labels: "hsl" },
419
+ hsv: { channels: 3, labels: "hsv" },
420
+ hwb: { channels: 3, labels: "hwb" },
421
+ cmyk: { channels: 4, labels: "cmyk" },
422
+ xyz: { channels: 3, labels: "xyz" },
423
+ lab: { channels: 3, labels: "lab" },
424
+ lch: { channels: 3, labels: "lch" },
425
+ hex: { channels: 1, labels: ["hex"] },
426
+ keyword: { channels: 1, labels: ["keyword"] },
427
+ ansi16: { channels: 1, labels: ["ansi16"] },
428
+ ansi256: { channels: 1, labels: ["ansi256"] },
429
+ hcg: { channels: 3, labels: ["h", "c", "g"] },
430
+ apple: { channels: 3, labels: ["r16", "g16", "b16"] },
431
+ gray: { channels: 1, labels: ["gray"] }
432
+ };
433
+ module2.exports = convert;
434
+ for (const model of Object.keys(convert)) {
435
+ if (!("channels" in convert[model])) {
436
+ throw new Error("missing channels property: " + model);
437
+ }
438
+ if (!("labels" in convert[model])) {
439
+ throw new Error("missing channel labels property: " + model);
440
+ }
441
+ if (convert[model].labels.length !== convert[model].channels) {
442
+ throw new Error("channel and label counts mismatch: " + model);
443
+ }
444
+ const { channels, labels } = convert[model];
445
+ delete convert[model].channels;
446
+ delete convert[model].labels;
447
+ Object.defineProperty(convert[model], "channels", { value: channels });
448
+ Object.defineProperty(convert[model], "labels", { value: labels });
449
+ }
450
+ convert.rgb.hsl = function(rgb) {
451
+ const r = rgb[0] / 255;
452
+ const g = rgb[1] / 255;
453
+ const b = rgb[2] / 255;
454
+ const min = Math.min(r, g, b);
455
+ const max = Math.max(r, g, b);
456
+ const delta = max - min;
457
+ let h;
458
+ let s;
459
+ if (max === min) {
460
+ h = 0;
461
+ } else if (r === max) {
462
+ h = (g - b) / delta;
463
+ } else if (g === max) {
464
+ h = 2 + (b - r) / delta;
465
+ } else if (b === max) {
466
+ h = 4 + (r - g) / delta;
467
+ }
468
+ h = Math.min(h * 60, 360);
469
+ if (h < 0) {
470
+ h += 360;
471
+ }
472
+ const l = (min + max) / 2;
473
+ if (max === min) {
474
+ s = 0;
475
+ } else if (l <= 0.5) {
476
+ s = delta / (max + min);
477
+ } else {
478
+ s = delta / (2 - max - min);
479
+ }
480
+ return [h, s * 100, l * 100];
481
+ };
482
+ convert.rgb.hsv = function(rgb) {
483
+ let rdif;
484
+ let gdif;
485
+ let bdif;
486
+ let h;
487
+ let s;
488
+ const r = rgb[0] / 255;
489
+ const g = rgb[1] / 255;
490
+ const b = rgb[2] / 255;
491
+ const v = Math.max(r, g, b);
492
+ const diff = v - Math.min(r, g, b);
493
+ const diffc = function(c) {
494
+ return (v - c) / 6 / diff + 1 / 2;
495
+ };
496
+ if (diff === 0) {
497
+ h = 0;
498
+ s = 0;
499
+ } else {
500
+ s = diff / v;
501
+ rdif = diffc(r);
502
+ gdif = diffc(g);
503
+ bdif = diffc(b);
504
+ if (r === v) {
505
+ h = bdif - gdif;
506
+ } else if (g === v) {
507
+ h = 1 / 3 + rdif - bdif;
508
+ } else if (b === v) {
509
+ h = 2 / 3 + gdif - rdif;
510
+ }
511
+ if (h < 0) {
512
+ h += 1;
513
+ } else if (h > 1) {
514
+ h -= 1;
515
+ }
516
+ }
517
+ return [
518
+ h * 360,
519
+ s * 100,
520
+ v * 100
521
+ ];
522
+ };
523
+ convert.rgb.hwb = function(rgb) {
524
+ const r = rgb[0];
525
+ const g = rgb[1];
526
+ let b = rgb[2];
527
+ const h = convert.rgb.hsl(rgb)[0];
528
+ const w = 1 / 255 * Math.min(r, Math.min(g, b));
529
+ b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
530
+ return [h, w * 100, b * 100];
531
+ };
532
+ convert.rgb.cmyk = function(rgb) {
533
+ const r = rgb[0] / 255;
534
+ const g = rgb[1] / 255;
535
+ const b = rgb[2] / 255;
536
+ const k = Math.min(1 - r, 1 - g, 1 - b);
537
+ const c = (1 - r - k) / (1 - k) || 0;
538
+ const m = (1 - g - k) / (1 - k) || 0;
539
+ const y = (1 - b - k) / (1 - k) || 0;
540
+ return [c * 100, m * 100, y * 100, k * 100];
541
+ };
542
+ function comparativeDistance(x, y) {
543
+ return (x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2 + (x[2] - y[2]) ** 2;
544
+ }
545
+ convert.rgb.keyword = function(rgb) {
546
+ const reversed = reverseKeywords[rgb];
547
+ if (reversed) {
548
+ return reversed;
549
+ }
550
+ let currentClosestDistance = Infinity;
551
+ let currentClosestKeyword;
552
+ for (const keyword of Object.keys(cssKeywords)) {
553
+ const value = cssKeywords[keyword];
554
+ const distance = comparativeDistance(rgb, value);
555
+ if (distance < currentClosestDistance) {
556
+ currentClosestDistance = distance;
557
+ currentClosestKeyword = keyword;
558
+ }
559
+ }
560
+ return currentClosestKeyword;
561
+ };
562
+ convert.keyword.rgb = function(keyword) {
563
+ return cssKeywords[keyword];
564
+ };
565
+ convert.rgb.xyz = function(rgb) {
566
+ let r = rgb[0] / 255;
567
+ let g = rgb[1] / 255;
568
+ let b = rgb[2] / 255;
569
+ r = r > 0.04045 ? ((r + 0.055) / 1.055) ** 2.4 : r / 12.92;
570
+ g = g > 0.04045 ? ((g + 0.055) / 1.055) ** 2.4 : g / 12.92;
571
+ b = b > 0.04045 ? ((b + 0.055) / 1.055) ** 2.4 : b / 12.92;
572
+ const x = r * 0.4124 + g * 0.3576 + b * 0.1805;
573
+ const y = r * 0.2126 + g * 0.7152 + b * 0.0722;
574
+ const z = r * 0.0193 + g * 0.1192 + b * 0.9505;
575
+ return [x * 100, y * 100, z * 100];
576
+ };
577
+ convert.rgb.lab = function(rgb) {
578
+ const xyz = convert.rgb.xyz(rgb);
579
+ let x = xyz[0];
580
+ let y = xyz[1];
581
+ let z = xyz[2];
582
+ x /= 95.047;
583
+ y /= 100;
584
+ z /= 108.883;
585
+ x = x > 8856e-6 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
586
+ y = y > 8856e-6 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
587
+ z = z > 8856e-6 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
588
+ const l = 116 * y - 16;
589
+ const a = 500 * (x - y);
590
+ const b = 200 * (y - z);
591
+ return [l, a, b];
592
+ };
593
+ convert.hsl.rgb = function(hsl) {
594
+ const h = hsl[0] / 360;
595
+ const s = hsl[1] / 100;
596
+ const l = hsl[2] / 100;
597
+ let t2;
598
+ let t3;
599
+ let val;
600
+ if (s === 0) {
601
+ val = l * 255;
602
+ return [val, val, val];
603
+ }
604
+ if (l < 0.5) {
605
+ t2 = l * (1 + s);
606
+ } else {
607
+ t2 = l + s - l * s;
608
+ }
609
+ const t1 = 2 * l - t2;
610
+ const rgb = [0, 0, 0];
611
+ for (let i = 0; i < 3; i++) {
612
+ t3 = h + 1 / 3 * -(i - 1);
613
+ if (t3 < 0) {
614
+ t3++;
615
+ }
616
+ if (t3 > 1) {
617
+ t3--;
618
+ }
619
+ if (6 * t3 < 1) {
620
+ val = t1 + (t2 - t1) * 6 * t3;
621
+ } else if (2 * t3 < 1) {
622
+ val = t2;
623
+ } else if (3 * t3 < 2) {
624
+ val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
625
+ } else {
626
+ val = t1;
627
+ }
628
+ rgb[i] = val * 255;
629
+ }
630
+ return rgb;
631
+ };
632
+ convert.hsl.hsv = function(hsl) {
633
+ const h = hsl[0];
634
+ let s = hsl[1] / 100;
635
+ let l = hsl[2] / 100;
636
+ let smin = s;
637
+ const lmin = Math.max(l, 0.01);
638
+ l *= 2;
639
+ s *= l <= 1 ? l : 2 - l;
640
+ smin *= lmin <= 1 ? lmin : 2 - lmin;
641
+ const v = (l + s) / 2;
642
+ const sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
643
+ return [h, sv * 100, v * 100];
644
+ };
645
+ convert.hsv.rgb = function(hsv) {
646
+ const h = hsv[0] / 60;
647
+ const s = hsv[1] / 100;
648
+ let v = hsv[2] / 100;
649
+ const hi = Math.floor(h) % 6;
650
+ const f = h - Math.floor(h);
651
+ const p = 255 * v * (1 - s);
652
+ const q = 255 * v * (1 - s * f);
653
+ const t = 255 * v * (1 - s * (1 - f));
654
+ v *= 255;
655
+ switch (hi) {
656
+ case 0:
657
+ return [v, t, p];
658
+ case 1:
659
+ return [q, v, p];
660
+ case 2:
661
+ return [p, v, t];
662
+ case 3:
663
+ return [p, q, v];
664
+ case 4:
665
+ return [t, p, v];
666
+ case 5:
667
+ return [v, p, q];
668
+ }
669
+ };
670
+ convert.hsv.hsl = function(hsv) {
671
+ const h = hsv[0];
672
+ const s = hsv[1] / 100;
673
+ const v = hsv[2] / 100;
674
+ const vmin = Math.max(v, 0.01);
675
+ let sl;
676
+ let l;
677
+ l = (2 - s) * v;
678
+ const lmin = (2 - s) * vmin;
679
+ sl = s * vmin;
680
+ sl /= lmin <= 1 ? lmin : 2 - lmin;
681
+ sl = sl || 0;
682
+ l /= 2;
683
+ return [h, sl * 100, l * 100];
684
+ };
685
+ convert.hwb.rgb = function(hwb) {
686
+ const h = hwb[0] / 360;
687
+ let wh = hwb[1] / 100;
688
+ let bl = hwb[2] / 100;
689
+ const ratio = wh + bl;
690
+ let f;
691
+ if (ratio > 1) {
692
+ wh /= ratio;
693
+ bl /= ratio;
694
+ }
695
+ const i = Math.floor(6 * h);
696
+ const v = 1 - bl;
697
+ f = 6 * h - i;
698
+ if ((i & 1) !== 0) {
699
+ f = 1 - f;
700
+ }
701
+ const n = wh + f * (v - wh);
702
+ let r;
703
+ let g;
704
+ let b;
705
+ switch (i) {
706
+ default:
707
+ case 6:
708
+ case 0:
709
+ r = v;
710
+ g = n;
711
+ b = wh;
712
+ break;
713
+ case 1:
714
+ r = n;
715
+ g = v;
716
+ b = wh;
717
+ break;
718
+ case 2:
719
+ r = wh;
720
+ g = v;
721
+ b = n;
722
+ break;
723
+ case 3:
724
+ r = wh;
725
+ g = n;
726
+ b = v;
727
+ break;
728
+ case 4:
729
+ r = n;
730
+ g = wh;
731
+ b = v;
732
+ break;
733
+ case 5:
734
+ r = v;
735
+ g = wh;
736
+ b = n;
737
+ break;
738
+ }
739
+ return [r * 255, g * 255, b * 255];
740
+ };
741
+ convert.cmyk.rgb = function(cmyk) {
742
+ const c = cmyk[0] / 100;
743
+ const m = cmyk[1] / 100;
744
+ const y = cmyk[2] / 100;
745
+ const k = cmyk[3] / 100;
746
+ const r = 1 - Math.min(1, c * (1 - k) + k);
747
+ const g = 1 - Math.min(1, m * (1 - k) + k);
748
+ const b = 1 - Math.min(1, y * (1 - k) + k);
749
+ return [r * 255, g * 255, b * 255];
750
+ };
751
+ convert.xyz.rgb = function(xyz) {
752
+ const x = xyz[0] / 100;
753
+ const y = xyz[1] / 100;
754
+ const z = xyz[2] / 100;
755
+ let r;
756
+ let g;
757
+ let b;
758
+ r = x * 3.2406 + y * -1.5372 + z * -0.4986;
759
+ g = x * -0.9689 + y * 1.8758 + z * 0.0415;
760
+ b = x * 0.0557 + y * -0.204 + z * 1.057;
761
+ r = r > 31308e-7 ? 1.055 * r ** (1 / 2.4) - 0.055 : r * 12.92;
762
+ g = g > 31308e-7 ? 1.055 * g ** (1 / 2.4) - 0.055 : g * 12.92;
763
+ b = b > 31308e-7 ? 1.055 * b ** (1 / 2.4) - 0.055 : b * 12.92;
764
+ r = Math.min(Math.max(0, r), 1);
765
+ g = Math.min(Math.max(0, g), 1);
766
+ b = Math.min(Math.max(0, b), 1);
767
+ return [r * 255, g * 255, b * 255];
768
+ };
769
+ convert.xyz.lab = function(xyz) {
770
+ let x = xyz[0];
771
+ let y = xyz[1];
772
+ let z = xyz[2];
773
+ x /= 95.047;
774
+ y /= 100;
775
+ z /= 108.883;
776
+ x = x > 8856e-6 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
777
+ y = y > 8856e-6 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
778
+ z = z > 8856e-6 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
779
+ const l = 116 * y - 16;
780
+ const a = 500 * (x - y);
781
+ const b = 200 * (y - z);
782
+ return [l, a, b];
783
+ };
784
+ convert.lab.xyz = function(lab) {
785
+ const l = lab[0];
786
+ const a = lab[1];
787
+ const b = lab[2];
788
+ let x;
789
+ let y;
790
+ let z;
791
+ y = (l + 16) / 116;
792
+ x = a / 500 + y;
793
+ z = y - b / 200;
794
+ const y2 = y ** 3;
795
+ const x2 = x ** 3;
796
+ const z2 = z ** 3;
797
+ y = y2 > 8856e-6 ? y2 : (y - 16 / 116) / 7.787;
798
+ x = x2 > 8856e-6 ? x2 : (x - 16 / 116) / 7.787;
799
+ z = z2 > 8856e-6 ? z2 : (z - 16 / 116) / 7.787;
800
+ x *= 95.047;
801
+ y *= 100;
802
+ z *= 108.883;
803
+ return [x, y, z];
804
+ };
805
+ convert.lab.lch = function(lab) {
806
+ const l = lab[0];
807
+ const a = lab[1];
808
+ const b = lab[2];
809
+ let h;
810
+ const hr = Math.atan2(b, a);
811
+ h = hr * 360 / 2 / Math.PI;
812
+ if (h < 0) {
813
+ h += 360;
814
+ }
815
+ const c = Math.sqrt(a * a + b * b);
816
+ return [l, c, h];
817
+ };
818
+ convert.lch.lab = function(lch) {
819
+ const l = lch[0];
820
+ const c = lch[1];
821
+ const h = lch[2];
822
+ const hr = h / 360 * 2 * Math.PI;
823
+ const a = c * Math.cos(hr);
824
+ const b = c * Math.sin(hr);
825
+ return [l, a, b];
826
+ };
827
+ convert.rgb.ansi16 = function(args, saturation = null) {
828
+ const [r, g, b] = args;
829
+ let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation;
830
+ value = Math.round(value / 50);
831
+ if (value === 0) {
832
+ return 30;
833
+ }
834
+ let ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
835
+ if (value === 2) {
836
+ ansi += 60;
837
+ }
838
+ return ansi;
839
+ };
840
+ convert.hsv.ansi16 = function(args) {
841
+ return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
842
+ };
843
+ convert.rgb.ansi256 = function(args) {
844
+ const r = args[0];
845
+ const g = args[1];
846
+ const b = args[2];
847
+ if (r === g && g === b) {
848
+ if (r < 8) {
849
+ return 16;
850
+ }
851
+ if (r > 248) {
852
+ return 231;
853
+ }
854
+ return Math.round((r - 8) / 247 * 24) + 232;
855
+ }
856
+ const ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
857
+ return ansi;
858
+ };
859
+ convert.ansi16.rgb = function(args) {
860
+ let color = args % 10;
861
+ if (color === 0 || color === 7) {
862
+ if (args > 50) {
863
+ color += 3.5;
864
+ }
865
+ color = color / 10.5 * 255;
866
+ return [color, color, color];
867
+ }
868
+ const mult = (~~(args > 50) + 1) * 0.5;
869
+ const r = (color & 1) * mult * 255;
870
+ const g = (color >> 1 & 1) * mult * 255;
871
+ const b = (color >> 2 & 1) * mult * 255;
872
+ return [r, g, b];
873
+ };
874
+ convert.ansi256.rgb = function(args) {
875
+ if (args >= 232) {
876
+ const c = (args - 232) * 10 + 8;
877
+ return [c, c, c];
878
+ }
879
+ args -= 16;
880
+ let rem;
881
+ const r = Math.floor(args / 36) / 5 * 255;
882
+ const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
883
+ const b = rem % 6 / 5 * 255;
884
+ return [r, g, b];
885
+ };
886
+ convert.rgb.hex = function(args) {
887
+ const integer = ((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255);
888
+ const string = integer.toString(16).toUpperCase();
889
+ return "000000".substring(string.length) + string;
890
+ };
891
+ convert.hex.rgb = function(args) {
892
+ const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
893
+ if (!match) {
894
+ return [0, 0, 0];
895
+ }
896
+ let colorString = match[0];
897
+ if (match[0].length === 3) {
898
+ colorString = colorString.split("").map((char) => {
899
+ return char + char;
900
+ }).join("");
901
+ }
902
+ const integer = parseInt(colorString, 16);
903
+ const r = integer >> 16 & 255;
904
+ const g = integer >> 8 & 255;
905
+ const b = integer & 255;
906
+ return [r, g, b];
907
+ };
908
+ convert.rgb.hcg = function(rgb) {
909
+ const r = rgb[0] / 255;
910
+ const g = rgb[1] / 255;
911
+ const b = rgb[2] / 255;
912
+ const max = Math.max(Math.max(r, g), b);
913
+ const min = Math.min(Math.min(r, g), b);
914
+ const chroma = max - min;
915
+ let grayscale;
916
+ let hue;
917
+ if (chroma < 1) {
918
+ grayscale = min / (1 - chroma);
919
+ } else {
920
+ grayscale = 0;
921
+ }
922
+ if (chroma <= 0) {
923
+ hue = 0;
924
+ } else if (max === r) {
925
+ hue = (g - b) / chroma % 6;
926
+ } else if (max === g) {
927
+ hue = 2 + (b - r) / chroma;
928
+ } else {
929
+ hue = 4 + (r - g) / chroma;
930
+ }
931
+ hue /= 6;
932
+ hue %= 1;
933
+ return [hue * 360, chroma * 100, grayscale * 100];
934
+ };
935
+ convert.hsl.hcg = function(hsl) {
936
+ const s = hsl[1] / 100;
937
+ const l = hsl[2] / 100;
938
+ const c = l < 0.5 ? 2 * s * l : 2 * s * (1 - l);
939
+ let f = 0;
940
+ if (c < 1) {
941
+ f = (l - 0.5 * c) / (1 - c);
942
+ }
943
+ return [hsl[0], c * 100, f * 100];
944
+ };
945
+ convert.hsv.hcg = function(hsv) {
946
+ const s = hsv[1] / 100;
947
+ const v = hsv[2] / 100;
948
+ const c = s * v;
949
+ let f = 0;
950
+ if (c < 1) {
951
+ f = (v - c) / (1 - c);
952
+ }
953
+ return [hsv[0], c * 100, f * 100];
954
+ };
955
+ convert.hcg.rgb = function(hcg) {
956
+ const h = hcg[0] / 360;
957
+ const c = hcg[1] / 100;
958
+ const g = hcg[2] / 100;
959
+ if (c === 0) {
960
+ return [g * 255, g * 255, g * 255];
961
+ }
962
+ const pure = [0, 0, 0];
963
+ const hi = h % 1 * 6;
964
+ const v = hi % 1;
965
+ const w = 1 - v;
966
+ let mg = 0;
967
+ switch (Math.floor(hi)) {
968
+ case 0:
969
+ pure[0] = 1;
970
+ pure[1] = v;
971
+ pure[2] = 0;
972
+ break;
973
+ case 1:
974
+ pure[0] = w;
975
+ pure[1] = 1;
976
+ pure[2] = 0;
977
+ break;
978
+ case 2:
979
+ pure[0] = 0;
980
+ pure[1] = 1;
981
+ pure[2] = v;
982
+ break;
983
+ case 3:
984
+ pure[0] = 0;
985
+ pure[1] = w;
986
+ pure[2] = 1;
987
+ break;
988
+ case 4:
989
+ pure[0] = v;
990
+ pure[1] = 0;
991
+ pure[2] = 1;
992
+ break;
993
+ default:
994
+ pure[0] = 1;
995
+ pure[1] = 0;
996
+ pure[2] = w;
997
+ }
998
+ mg = (1 - c) * g;
999
+ return [
1000
+ (c * pure[0] + mg) * 255,
1001
+ (c * pure[1] + mg) * 255,
1002
+ (c * pure[2] + mg) * 255
1003
+ ];
1004
+ };
1005
+ convert.hcg.hsv = function(hcg) {
1006
+ const c = hcg[1] / 100;
1007
+ const g = hcg[2] / 100;
1008
+ const v = c + g * (1 - c);
1009
+ let f = 0;
1010
+ if (v > 0) {
1011
+ f = c / v;
1012
+ }
1013
+ return [hcg[0], f * 100, v * 100];
1014
+ };
1015
+ convert.hcg.hsl = function(hcg) {
1016
+ const c = hcg[1] / 100;
1017
+ const g = hcg[2] / 100;
1018
+ const l = g * (1 - c) + 0.5 * c;
1019
+ let s = 0;
1020
+ if (l > 0 && l < 0.5) {
1021
+ s = c / (2 * l);
1022
+ } else if (l >= 0.5 && l < 1) {
1023
+ s = c / (2 * (1 - l));
1024
+ }
1025
+ return [hcg[0], s * 100, l * 100];
1026
+ };
1027
+ convert.hcg.hwb = function(hcg) {
1028
+ const c = hcg[1] / 100;
1029
+ const g = hcg[2] / 100;
1030
+ const v = c + g * (1 - c);
1031
+ return [hcg[0], (v - c) * 100, (1 - v) * 100];
1032
+ };
1033
+ convert.hwb.hcg = function(hwb) {
1034
+ const w = hwb[1] / 100;
1035
+ const b = hwb[2] / 100;
1036
+ const v = 1 - b;
1037
+ const c = v - w;
1038
+ let g = 0;
1039
+ if (c < 1) {
1040
+ g = (v - c) / (1 - c);
1041
+ }
1042
+ return [hwb[0], c * 100, g * 100];
1043
+ };
1044
+ convert.apple.rgb = function(apple) {
1045
+ return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
1046
+ };
1047
+ convert.rgb.apple = function(rgb) {
1048
+ return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
1049
+ };
1050
+ convert.gray.rgb = function(args) {
1051
+ return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
1052
+ };
1053
+ convert.gray.hsl = function(args) {
1054
+ return [0, 0, args[0]];
1055
+ };
1056
+ convert.gray.hsv = convert.gray.hsl;
1057
+ convert.gray.hwb = function(gray) {
1058
+ return [0, 100, gray[0]];
1059
+ };
1060
+ convert.gray.cmyk = function(gray) {
1061
+ return [0, 0, 0, gray[0]];
1062
+ };
1063
+ convert.gray.lab = function(gray) {
1064
+ return [gray[0], 0, 0];
1065
+ };
1066
+ convert.gray.hex = function(gray) {
1067
+ const val = Math.round(gray[0] / 100 * 255) & 255;
1068
+ const integer = (val << 16) + (val << 8) + val;
1069
+ const string = integer.toString(16).toUpperCase();
1070
+ return "000000".substring(string.length) + string;
1071
+ };
1072
+ convert.rgb.gray = function(rgb) {
1073
+ const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
1074
+ return [val / 255 * 100];
1075
+ };
1076
+ }
1077
+ });
1078
+
1079
+ // node_modules/color-convert/route.js
1080
+ var require_route = __commonJS({
1081
+ "node_modules/color-convert/route.js"(exports2, module2) {
1082
+ var conversions = require_conversions();
1083
+ function buildGraph() {
1084
+ const graph = {};
1085
+ const models = Object.keys(conversions);
1086
+ for (let len = models.length, i = 0; i < len; i++) {
1087
+ graph[models[i]] = {
1088
+ // http://jsperf.com/1-vs-infinity
1089
+ // micro-opt, but this is simple.
1090
+ distance: -1,
1091
+ parent: null
1092
+ };
1093
+ }
1094
+ return graph;
1095
+ }
1096
+ function deriveBFS(fromModel) {
1097
+ const graph = buildGraph();
1098
+ const queue = [fromModel];
1099
+ graph[fromModel].distance = 0;
1100
+ while (queue.length) {
1101
+ const current = queue.pop();
1102
+ const adjacents = Object.keys(conversions[current]);
1103
+ for (let len = adjacents.length, i = 0; i < len; i++) {
1104
+ const adjacent = adjacents[i];
1105
+ const node = graph[adjacent];
1106
+ if (node.distance === -1) {
1107
+ node.distance = graph[current].distance + 1;
1108
+ node.parent = current;
1109
+ queue.unshift(adjacent);
1110
+ }
1111
+ }
1112
+ }
1113
+ return graph;
1114
+ }
1115
+ function link(from, to) {
1116
+ return function(args) {
1117
+ return to(from(args));
1118
+ };
1119
+ }
1120
+ function wrapConversion(toModel, graph) {
1121
+ const path = [graph[toModel].parent, toModel];
1122
+ let fn = conversions[graph[toModel].parent][toModel];
1123
+ let cur = graph[toModel].parent;
1124
+ while (graph[cur].parent) {
1125
+ path.unshift(graph[cur].parent);
1126
+ fn = link(conversions[graph[cur].parent][cur], fn);
1127
+ cur = graph[cur].parent;
1128
+ }
1129
+ fn.conversion = path;
1130
+ return fn;
1131
+ }
1132
+ module2.exports = function(fromModel) {
1133
+ const graph = deriveBFS(fromModel);
1134
+ const conversion = {};
1135
+ const models = Object.keys(graph);
1136
+ for (let len = models.length, i = 0; i < len; i++) {
1137
+ const toModel = models[i];
1138
+ const node = graph[toModel];
1139
+ if (node.parent === null) {
1140
+ continue;
1141
+ }
1142
+ conversion[toModel] = wrapConversion(toModel, graph);
1143
+ }
1144
+ return conversion;
1145
+ };
1146
+ }
1147
+ });
1148
+
1149
+ // node_modules/color-convert/index.js
1150
+ var require_color_convert = __commonJS({
1151
+ "node_modules/color-convert/index.js"(exports2, module2) {
1152
+ var conversions = require_conversions();
1153
+ var route = require_route();
1154
+ var convert = {};
1155
+ var models = Object.keys(conversions);
1156
+ function wrapRaw(fn) {
1157
+ const wrappedFn = function(...args) {
1158
+ const arg0 = args[0];
1159
+ if (arg0 === void 0 || arg0 === null) {
1160
+ return arg0;
1161
+ }
1162
+ if (arg0.length > 1) {
1163
+ args = arg0;
1164
+ }
1165
+ return fn(args);
1166
+ };
1167
+ if ("conversion" in fn) {
1168
+ wrappedFn.conversion = fn.conversion;
1169
+ }
1170
+ return wrappedFn;
1171
+ }
1172
+ function wrapRounded(fn) {
1173
+ const wrappedFn = function(...args) {
1174
+ const arg0 = args[0];
1175
+ if (arg0 === void 0 || arg0 === null) {
1176
+ return arg0;
1177
+ }
1178
+ if (arg0.length > 1) {
1179
+ args = arg0;
1180
+ }
1181
+ const result = fn(args);
1182
+ if (typeof result === "object") {
1183
+ for (let len = result.length, i = 0; i < len; i++) {
1184
+ result[i] = Math.round(result[i]);
1185
+ }
1186
+ }
1187
+ return result;
1188
+ };
1189
+ if ("conversion" in fn) {
1190
+ wrappedFn.conversion = fn.conversion;
1191
+ }
1192
+ return wrappedFn;
1193
+ }
1194
+ models.forEach((fromModel) => {
1195
+ convert[fromModel] = {};
1196
+ Object.defineProperty(convert[fromModel], "channels", { value: conversions[fromModel].channels });
1197
+ Object.defineProperty(convert[fromModel], "labels", { value: conversions[fromModel].labels });
1198
+ const routes = route(fromModel);
1199
+ const routeModels = Object.keys(routes);
1200
+ routeModels.forEach((toModel) => {
1201
+ const fn = routes[toModel];
1202
+ convert[fromModel][toModel] = wrapRounded(fn);
1203
+ convert[fromModel][toModel].raw = wrapRaw(fn);
1204
+ });
1205
+ });
1206
+ module2.exports = convert;
1207
+ }
1208
+ });
1209
+
1210
+ // node_modules/ansi-styles/index.js
1211
+ var require_ansi_styles = __commonJS({
1212
+ "node_modules/ansi-styles/index.js"(exports2, module2) {
1213
+ "use strict";
1214
+ var wrapAnsi16 = (fn, offset) => (...args) => {
1215
+ const code = fn(...args);
1216
+ return `\x1B[${code + offset}m`;
1217
+ };
1218
+ var wrapAnsi256 = (fn, offset) => (...args) => {
1219
+ const code = fn(...args);
1220
+ return `\x1B[${38 + offset};5;${code}m`;
1221
+ };
1222
+ var wrapAnsi16m = (fn, offset) => (...args) => {
1223
+ const rgb = fn(...args);
1224
+ return `\x1B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
1225
+ };
1226
+ var ansi2ansi = (n) => n;
1227
+ var rgb2rgb = (r, g, b) => [r, g, b];
1228
+ var setLazyProperty = (object, property, get) => {
1229
+ Object.defineProperty(object, property, {
1230
+ get: () => {
1231
+ const value = get();
1232
+ Object.defineProperty(object, property, {
1233
+ value,
1234
+ enumerable: true,
1235
+ configurable: true
1236
+ });
1237
+ return value;
1238
+ },
1239
+ enumerable: true,
1240
+ configurable: true
1241
+ });
1242
+ };
1243
+ var colorConvert;
1244
+ var makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
1245
+ if (colorConvert === void 0) {
1246
+ colorConvert = require_color_convert();
1247
+ }
1248
+ const offset = isBackground ? 10 : 0;
1249
+ const styles = {};
1250
+ for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
1251
+ const name = sourceSpace === "ansi16" ? "ansi" : sourceSpace;
1252
+ if (sourceSpace === targetSpace) {
1253
+ styles[name] = wrap(identity, offset);
1254
+ } else if (typeof suite === "object") {
1255
+ styles[name] = wrap(suite[targetSpace], offset);
1256
+ }
1257
+ }
1258
+ return styles;
1259
+ };
1260
+ function assembleStyles() {
1261
+ const codes = /* @__PURE__ */ new Map();
1262
+ const styles = {
1263
+ modifier: {
1264
+ reset: [0, 0],
1265
+ // 21 isn't widely supported and 22 does the same thing
1266
+ bold: [1, 22],
1267
+ dim: [2, 22],
1268
+ italic: [3, 23],
1269
+ underline: [4, 24],
1270
+ inverse: [7, 27],
1271
+ hidden: [8, 28],
1272
+ strikethrough: [9, 29]
1273
+ },
1274
+ color: {
1275
+ black: [30, 39],
1276
+ red: [31, 39],
1277
+ green: [32, 39],
1278
+ yellow: [33, 39],
1279
+ blue: [34, 39],
1280
+ magenta: [35, 39],
1281
+ cyan: [36, 39],
1282
+ white: [37, 39],
1283
+ // Bright color
1284
+ blackBright: [90, 39],
1285
+ redBright: [91, 39],
1286
+ greenBright: [92, 39],
1287
+ yellowBright: [93, 39],
1288
+ blueBright: [94, 39],
1289
+ magentaBright: [95, 39],
1290
+ cyanBright: [96, 39],
1291
+ whiteBright: [97, 39]
1292
+ },
1293
+ bgColor: {
1294
+ bgBlack: [40, 49],
1295
+ bgRed: [41, 49],
1296
+ bgGreen: [42, 49],
1297
+ bgYellow: [43, 49],
1298
+ bgBlue: [44, 49],
1299
+ bgMagenta: [45, 49],
1300
+ bgCyan: [46, 49],
1301
+ bgWhite: [47, 49],
1302
+ // Bright color
1303
+ bgBlackBright: [100, 49],
1304
+ bgRedBright: [101, 49],
1305
+ bgGreenBright: [102, 49],
1306
+ bgYellowBright: [103, 49],
1307
+ bgBlueBright: [104, 49],
1308
+ bgMagentaBright: [105, 49],
1309
+ bgCyanBright: [106, 49],
1310
+ bgWhiteBright: [107, 49]
1311
+ }
1312
+ };
1313
+ styles.color.gray = styles.color.blackBright;
1314
+ styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
1315
+ styles.color.grey = styles.color.blackBright;
1316
+ styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
1317
+ for (const [groupName, group] of Object.entries(styles)) {
1318
+ for (const [styleName, style] of Object.entries(group)) {
1319
+ styles[styleName] = {
1320
+ open: `\x1B[${style[0]}m`,
1321
+ close: `\x1B[${style[1]}m`
1322
+ };
1323
+ group[styleName] = styles[styleName];
1324
+ codes.set(style[0], style[1]);
1325
+ }
1326
+ Object.defineProperty(styles, groupName, {
1327
+ value: group,
1328
+ enumerable: false
1329
+ });
1330
+ }
1331
+ Object.defineProperty(styles, "codes", {
1332
+ value: codes,
1333
+ enumerable: false
1334
+ });
1335
+ styles.color.close = "\x1B[39m";
1336
+ styles.bgColor.close = "\x1B[49m";
1337
+ setLazyProperty(styles.color, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, false));
1338
+ setLazyProperty(styles.color, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, false));
1339
+ setLazyProperty(styles.color, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, false));
1340
+ setLazyProperty(styles.bgColor, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, true));
1341
+ setLazyProperty(styles.bgColor, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, true));
1342
+ setLazyProperty(styles.bgColor, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, true));
1343
+ return styles;
1344
+ }
1345
+ Object.defineProperty(module2, "exports", {
1346
+ enumerable: true,
1347
+ get: assembleStyles
1348
+ });
1349
+ }
1350
+ });
1351
+
1352
+ // node_modules/wrap-ansi/index.js
1353
+ var require_wrap_ansi = __commonJS({
1354
+ "node_modules/wrap-ansi/index.js"(exports2, module2) {
1355
+ "use strict";
1356
+ var stringWidth = require_string_width();
1357
+ var stripAnsi2 = require_strip_ansi();
1358
+ var ansiStyles = require_ansi_styles();
1359
+ var ESCAPES = /* @__PURE__ */ new Set([
1360
+ "\x1B",
1361
+ "\x9B"
1362
+ ]);
1363
+ var END_CODE = 39;
1364
+ var wrapAnsi2 = (code) => `${ESCAPES.values().next().value}[${code}m`;
1365
+ var wordLengths = (string) => string.split(" ").map((character) => stringWidth(character));
1366
+ var wrapWord = (rows, word, columns) => {
1367
+ const characters = [...word];
1368
+ let isInsideEscape = false;
1369
+ let visible = stringWidth(stripAnsi2(rows[rows.length - 1]));
1370
+ for (const [index, character] of characters.entries()) {
1371
+ const characterLength = stringWidth(character);
1372
+ if (visible + characterLength <= columns) {
1373
+ rows[rows.length - 1] += character;
1374
+ } else {
1375
+ rows.push(character);
1376
+ visible = 0;
1377
+ }
1378
+ if (ESCAPES.has(character)) {
1379
+ isInsideEscape = true;
1380
+ } else if (isInsideEscape && character === "m") {
1381
+ isInsideEscape = false;
1382
+ continue;
1383
+ }
1384
+ if (isInsideEscape) {
1385
+ continue;
1386
+ }
1387
+ visible += characterLength;
1388
+ if (visible === columns && index < characters.length - 1) {
1389
+ rows.push("");
1390
+ visible = 0;
1391
+ }
1392
+ }
1393
+ if (!visible && rows[rows.length - 1].length > 0 && rows.length > 1) {
1394
+ rows[rows.length - 2] += rows.pop();
1395
+ }
1396
+ };
1397
+ var stringVisibleTrimSpacesRight = (str) => {
1398
+ const words = str.split(" ");
1399
+ let last = words.length;
1400
+ while (last > 0) {
1401
+ if (stringWidth(words[last - 1]) > 0) {
1402
+ break;
1403
+ }
1404
+ last--;
1405
+ }
1406
+ if (last === words.length) {
1407
+ return str;
1408
+ }
1409
+ return words.slice(0, last).join(" ") + words.slice(last).join("");
1410
+ };
1411
+ var exec = (string, columns, options = {}) => {
1412
+ if (options.trim !== false && string.trim() === "") {
1413
+ return "";
1414
+ }
1415
+ let pre = "";
1416
+ let ret = "";
1417
+ let escapeCode;
1418
+ const lengths = wordLengths(string);
1419
+ let rows = [""];
1420
+ for (const [index, word] of string.split(" ").entries()) {
1421
+ if (options.trim !== false) {
1422
+ rows[rows.length - 1] = rows[rows.length - 1].trimLeft();
1423
+ }
1424
+ let rowLength = stringWidth(rows[rows.length - 1]);
1425
+ if (index !== 0) {
1426
+ if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
1427
+ rows.push("");
1428
+ rowLength = 0;
1429
+ }
1430
+ if (rowLength > 0 || options.trim === false) {
1431
+ rows[rows.length - 1] += " ";
1432
+ rowLength++;
1433
+ }
1434
+ }
1435
+ if (options.hard && lengths[index] > columns) {
1436
+ const remainingColumns = columns - rowLength;
1437
+ const breaksStartingThisLine = 1 + Math.floor((lengths[index] - remainingColumns - 1) / columns);
1438
+ const breaksStartingNextLine = Math.floor((lengths[index] - 1) / columns);
1439
+ if (breaksStartingNextLine < breaksStartingThisLine) {
1440
+ rows.push("");
1441
+ }
1442
+ wrapWord(rows, word, columns);
1443
+ continue;
1444
+ }
1445
+ if (rowLength + lengths[index] > columns && rowLength > 0 && lengths[index] > 0) {
1446
+ if (options.wordWrap === false && rowLength < columns) {
1447
+ wrapWord(rows, word, columns);
1448
+ continue;
1449
+ }
1450
+ rows.push("");
1451
+ }
1452
+ if (rowLength + lengths[index] > columns && options.wordWrap === false) {
1453
+ wrapWord(rows, word, columns);
1454
+ continue;
1455
+ }
1456
+ rows[rows.length - 1] += word;
1457
+ }
1458
+ if (options.trim !== false) {
1459
+ rows = rows.map(stringVisibleTrimSpacesRight);
1460
+ }
1461
+ pre = rows.join("\n");
1462
+ for (const [index, character] of [...pre].entries()) {
1463
+ ret += character;
1464
+ if (ESCAPES.has(character)) {
1465
+ const code2 = parseFloat(/\d[^m]*/.exec(pre.slice(index, index + 4)));
1466
+ escapeCode = code2 === END_CODE ? null : code2;
1467
+ }
1468
+ const code = ansiStyles.codes.get(Number(escapeCode));
1469
+ if (escapeCode && code) {
1470
+ if (pre[index + 1] === "\n") {
1471
+ ret += wrapAnsi2(code);
1472
+ } else if (character === "\n") {
1473
+ ret += wrapAnsi2(escapeCode);
1474
+ }
1475
+ }
1476
+ }
1477
+ return ret;
1478
+ };
1479
+ module2.exports = (string, columns, options) => {
1480
+ return String(string).normalize().replace(/\r\n/g, "\n").split("\n").map((line) => exec(line, columns, options)).join("\n");
1481
+ };
1482
+ }
1483
+ });
1484
+
1485
+ // node_modules/mute-stream/lib/index.js
1486
+ var require_lib = __commonJS({
1487
+ "node_modules/mute-stream/lib/index.js"(exports2, module2) {
1488
+ var Stream = require("stream");
1489
+ var MuteStream2 = class extends Stream {
1490
+ #isTTY = null;
1491
+ constructor(opts = {}) {
1492
+ super(opts);
1493
+ this.writable = this.readable = true;
1494
+ this.muted = false;
1495
+ this.on("pipe", this._onpipe);
1496
+ this.replace = opts.replace;
1497
+ this._prompt = opts.prompt || null;
1498
+ this._hadControl = false;
1499
+ }
1500
+ #destSrc(key, def) {
1501
+ if (this._dest) {
1502
+ return this._dest[key];
1503
+ }
1504
+ if (this._src) {
1505
+ return this._src[key];
1506
+ }
1507
+ return def;
1508
+ }
1509
+ #proxy(method, ...args) {
1510
+ if (typeof this._dest?.[method] === "function") {
1511
+ this._dest[method](...args);
1512
+ }
1513
+ if (typeof this._src?.[method] === "function") {
1514
+ this._src[method](...args);
1515
+ }
1516
+ }
1517
+ get isTTY() {
1518
+ if (this.#isTTY !== null) {
1519
+ return this.#isTTY;
1520
+ }
1521
+ return this.#destSrc("isTTY", false);
1522
+ }
1523
+ // basically just get replace the getter/setter with a regular value
1524
+ set isTTY(val) {
1525
+ this.#isTTY = val;
1526
+ }
1527
+ get rows() {
1528
+ return this.#destSrc("rows");
1529
+ }
1530
+ get columns() {
1531
+ return this.#destSrc("columns");
1532
+ }
1533
+ mute() {
1534
+ this.muted = true;
1535
+ }
1536
+ unmute() {
1537
+ this.muted = false;
1538
+ }
1539
+ _onpipe(src) {
1540
+ this._src = src;
1541
+ }
1542
+ pipe(dest, options) {
1543
+ this._dest = dest;
1544
+ return super.pipe(dest, options);
1545
+ }
1546
+ pause() {
1547
+ if (this._src) {
1548
+ return this._src.pause();
1549
+ }
1550
+ }
1551
+ resume() {
1552
+ if (this._src) {
1553
+ return this._src.resume();
1554
+ }
1555
+ }
1556
+ write(c) {
1557
+ if (this.muted) {
1558
+ if (!this.replace) {
1559
+ return true;
1560
+ }
1561
+ if (c.match(/^\u001b/)) {
1562
+ if (c.indexOf(this._prompt) === 0) {
1563
+ c = c.slice(this._prompt.length);
1564
+ c = c.replace(/./g, this.replace);
1565
+ c = this._prompt + c;
1566
+ }
1567
+ this._hadControl = true;
1568
+ return this.emit("data", c);
1569
+ } else {
1570
+ if (this._prompt && this._hadControl && c.indexOf(this._prompt) === 0) {
1571
+ this._hadControl = false;
1572
+ this.emit("data", this._prompt);
1573
+ c = c.slice(this._prompt.length);
1574
+ }
1575
+ c = c.toString().replace(/./g, this.replace);
1576
+ }
1577
+ }
1578
+ this.emit("data", c);
1579
+ }
1580
+ end(c) {
1581
+ if (this.muted) {
1582
+ if (c && this.replace) {
1583
+ c = c.toString().replace(/./g, this.replace);
1584
+ } else {
1585
+ c = null;
1586
+ }
1587
+ }
1588
+ if (c) {
1589
+ this.emit("data", c);
1590
+ }
1591
+ this.emit("end");
1592
+ }
1593
+ destroy(...args) {
1594
+ return this.#proxy("destroy", ...args);
1595
+ }
1596
+ destroySoon(...args) {
1597
+ return this.#proxy("destroySoon", ...args);
1598
+ }
1599
+ close(...args) {
1600
+ return this.#proxy("close", ...args);
1601
+ }
1602
+ };
1603
+ module2.exports = MuteStream2;
1604
+ }
1605
+ });
1606
+
1607
+ // node_modules/ansi-escapes/index.js
1608
+ var require_ansi_escapes = __commonJS({
1609
+ "node_modules/ansi-escapes/index.js"(exports2, module2) {
1610
+ "use strict";
1611
+ var ansiEscapes4 = module2.exports;
1612
+ module2.exports.default = ansiEscapes4;
1613
+ var ESC = "\x1B[";
1614
+ var OSC = "\x1B]";
1615
+ var BEL = "\x07";
1616
+ var SEP = ";";
1617
+ var isTerminalApp = process.env.TERM_PROGRAM === "Apple_Terminal";
1618
+ ansiEscapes4.cursorTo = (x, y) => {
1619
+ if (typeof x !== "number") {
1620
+ throw new TypeError("The `x` argument is required");
1621
+ }
1622
+ if (typeof y !== "number") {
1623
+ return ESC + (x + 1) + "G";
1624
+ }
1625
+ return ESC + (y + 1) + ";" + (x + 1) + "H";
1626
+ };
1627
+ ansiEscapes4.cursorMove = (x, y) => {
1628
+ if (typeof x !== "number") {
1629
+ throw new TypeError("The `x` argument is required");
1630
+ }
1631
+ let ret = "";
1632
+ if (x < 0) {
1633
+ ret += ESC + -x + "D";
1634
+ } else if (x > 0) {
1635
+ ret += ESC + x + "C";
1636
+ }
1637
+ if (y < 0) {
1638
+ ret += ESC + -y + "A";
1639
+ } else if (y > 0) {
1640
+ ret += ESC + y + "B";
1641
+ }
1642
+ return ret;
1643
+ };
1644
+ ansiEscapes4.cursorUp = (count = 1) => ESC + count + "A";
1645
+ ansiEscapes4.cursorDown = (count = 1) => ESC + count + "B";
1646
+ ansiEscapes4.cursorForward = (count = 1) => ESC + count + "C";
1647
+ ansiEscapes4.cursorBackward = (count = 1) => ESC + count + "D";
1648
+ ansiEscapes4.cursorLeft = ESC + "G";
1649
+ ansiEscapes4.cursorSavePosition = isTerminalApp ? "\x1B7" : ESC + "s";
1650
+ ansiEscapes4.cursorRestorePosition = isTerminalApp ? "\x1B8" : ESC + "u";
1651
+ ansiEscapes4.cursorGetPosition = ESC + "6n";
1652
+ ansiEscapes4.cursorNextLine = ESC + "E";
1653
+ ansiEscapes4.cursorPrevLine = ESC + "F";
1654
+ ansiEscapes4.cursorHide = ESC + "?25l";
1655
+ ansiEscapes4.cursorShow = ESC + "?25h";
1656
+ ansiEscapes4.eraseLines = (count) => {
1657
+ let clear = "";
1658
+ for (let i = 0; i < count; i++) {
1659
+ clear += ansiEscapes4.eraseLine + (i < count - 1 ? ansiEscapes4.cursorUp() : "");
1660
+ }
1661
+ if (count) {
1662
+ clear += ansiEscapes4.cursorLeft;
1663
+ }
1664
+ return clear;
1665
+ };
1666
+ ansiEscapes4.eraseEndLine = ESC + "K";
1667
+ ansiEscapes4.eraseStartLine = ESC + "1K";
1668
+ ansiEscapes4.eraseLine = ESC + "2K";
1669
+ ansiEscapes4.eraseDown = ESC + "J";
1670
+ ansiEscapes4.eraseUp = ESC + "1J";
1671
+ ansiEscapes4.eraseScreen = ESC + "2J";
1672
+ ansiEscapes4.scrollUp = ESC + "S";
1673
+ ansiEscapes4.scrollDown = ESC + "T";
1674
+ ansiEscapes4.clearScreen = "\x1Bc";
1675
+ ansiEscapes4.clearTerminal = process.platform === "win32" ? `${ansiEscapes4.eraseScreen}${ESC}0f` : (
1676
+ // 1. Erases the screen (Only done in case `2` is not supported)
1677
+ // 2. Erases the whole screen including scrollback buffer
1678
+ // 3. Moves cursor to the top-left position
1679
+ // More info: https://www.real-world-systems.com/docs/ANSIcode.html
1680
+ `${ansiEscapes4.eraseScreen}${ESC}3J${ESC}H`
1681
+ );
1682
+ ansiEscapes4.beep = BEL;
1683
+ ansiEscapes4.link = (text, url) => {
1684
+ return [
1685
+ OSC,
1686
+ "8",
1687
+ SEP,
1688
+ SEP,
1689
+ url,
1690
+ BEL,
1691
+ text,
1692
+ OSC,
1693
+ "8",
1694
+ SEP,
1695
+ SEP,
1696
+ BEL
1697
+ ].join("");
1698
+ };
1699
+ ansiEscapes4.image = (buffer, options = {}) => {
1700
+ let ret = `${OSC}1337;File=inline=1`;
1701
+ if (options.width) {
1702
+ ret += `;width=${options.width}`;
1703
+ }
1704
+ if (options.height) {
1705
+ ret += `;height=${options.height}`;
1706
+ }
1707
+ if (options.preserveAspectRatio === false) {
1708
+ ret += ";preserveAspectRatio=0";
1709
+ }
1710
+ return ret + ":" + buffer.toString("base64") + BEL;
1711
+ };
1712
+ ansiEscapes4.iTerm = {
1713
+ setCwd: (cwd = process.cwd()) => `${OSC}50;CurrentDir=${cwd}${BEL}`,
1714
+ annotation: (message, options = {}) => {
1715
+ let ret = `${OSC}1337;`;
1716
+ const hasX = typeof options.x !== "undefined";
1717
+ const hasY = typeof options.y !== "undefined";
1718
+ if ((hasX || hasY) && !(hasX && hasY && typeof options.length !== "undefined")) {
1719
+ throw new Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");
1720
+ }
1721
+ message = message.replace(/\|/g, "");
1722
+ ret += options.isHidden ? "AddHiddenAnnotation=" : "AddAnnotation=";
1723
+ if (options.length > 0) {
1724
+ ret += (hasX ? [message, options.length, options.x, options.y] : [options.length, message]).join("|");
1725
+ } else {
1726
+ ret += message;
1727
+ }
1728
+ return ret + BEL;
1729
+ }
1730
+ };
1731
+ }
1732
+ });
1733
+
1734
+ // node_modules/@inquirer/core/dist/esm/lib/key.mjs
1735
+ var isUpKey = (key) => (
1736
+ // The up key
1737
+ key.name === "up" || // Vim keybinding
1738
+ key.name === "k" || // Emacs keybinding
1739
+ key.ctrl && key.name === "p"
1740
+ );
1741
+ var isDownKey = (key) => (
1742
+ // The down key
1743
+ key.name === "down" || // Vim keybinding
1744
+ key.name === "j" || // Emacs keybinding
1745
+ key.ctrl && key.name === "n"
1746
+ );
1747
+ var isSpaceKey = (key) => key.name === "space";
1748
+ var isBackspaceKey = (key) => key.name === "backspace";
1749
+ var isNumberKey = (key) => "123456789".includes(key.name);
1750
+ var isEnterKey = (key) => key.name === "enter" || key.name === "return";
1751
+
1752
+ // node_modules/@inquirer/core/dist/esm/lib/errors.mjs
1753
+ var AbortPromptError = class extends Error {
1754
+ name = "AbortPromptError";
1755
+ message = "Prompt was aborted";
1756
+ constructor(options) {
1757
+ super();
1758
+ this.cause = options?.cause;
1759
+ }
1760
+ };
1761
+ var CancelPromptError = class extends Error {
1762
+ name = "CancelPromptError";
1763
+ message = "Prompt was canceled";
1764
+ };
1765
+ var ExitPromptError = class extends Error {
1766
+ name = "ExitPromptError";
1767
+ };
1768
+ var HookError = class extends Error {
1769
+ name = "HookError";
1770
+ };
1771
+ var ValidationError = class extends Error {
1772
+ name = "ValidationError";
1773
+ };
1774
+
1775
+ // node_modules/@inquirer/core/dist/esm/lib/use-prefix.mjs
1776
+ var import_node_async_hooks2 = require("node:async_hooks");
1777
+
1778
+ // node_modules/@inquirer/core/dist/esm/lib/hook-engine.mjs
1779
+ var import_node_async_hooks = require("node:async_hooks");
1780
+ var hookStorage = new import_node_async_hooks.AsyncLocalStorage();
1781
+ function createStore(rl) {
1782
+ const store = {
1783
+ rl,
1784
+ hooks: [],
1785
+ hooksCleanup: [],
1786
+ hooksEffect: [],
1787
+ index: 0,
1788
+ handleChange() {
1789
+ }
1790
+ };
1791
+ return store;
1792
+ }
1793
+ function withHooks(rl, cb) {
1794
+ const store = createStore(rl);
1795
+ return hookStorage.run(store, () => {
1796
+ function cycle(render) {
1797
+ store.handleChange = () => {
1798
+ store.index = 0;
1799
+ render();
1800
+ };
1801
+ store.handleChange();
1802
+ }
1803
+ return cb(cycle);
1804
+ });
1805
+ }
1806
+ function getStore() {
1807
+ const store = hookStorage.getStore();
1808
+ if (!store) {
1809
+ throw new HookError("[Inquirer] Hook functions can only be called from within a prompt");
1810
+ }
1811
+ return store;
1812
+ }
1813
+ function readline() {
1814
+ return getStore().rl;
1815
+ }
1816
+ function withUpdates(fn) {
1817
+ const wrapped = (...args) => {
1818
+ const store = getStore();
1819
+ let shouldUpdate = false;
1820
+ const oldHandleChange = store.handleChange;
1821
+ store.handleChange = () => {
1822
+ shouldUpdate = true;
1823
+ };
1824
+ const returnValue = fn(...args);
1825
+ if (shouldUpdate) {
1826
+ oldHandleChange();
1827
+ }
1828
+ store.handleChange = oldHandleChange;
1829
+ return returnValue;
1830
+ };
1831
+ return import_node_async_hooks.AsyncResource.bind(wrapped);
1832
+ }
1833
+ function withPointer(cb) {
1834
+ const store = getStore();
1835
+ const { index } = store;
1836
+ const pointer = {
1837
+ get() {
1838
+ return store.hooks[index];
1839
+ },
1840
+ set(value) {
1841
+ store.hooks[index] = value;
1842
+ },
1843
+ initialized: index in store.hooks
1844
+ };
1845
+ const returnValue = cb(pointer);
1846
+ store.index++;
1847
+ return returnValue;
1848
+ }
1849
+ function handleChange() {
1850
+ getStore().handleChange();
1851
+ }
1852
+ var effectScheduler = {
1853
+ queue(cb) {
1854
+ const store = getStore();
1855
+ const { index } = store;
1856
+ store.hooksEffect.push(() => {
1857
+ store.hooksCleanup[index]?.();
1858
+ const cleanFn = cb(readline());
1859
+ if (cleanFn != null && typeof cleanFn !== "function") {
1860
+ throw new ValidationError("useEffect return value must be a cleanup function or nothing.");
1861
+ }
1862
+ store.hooksCleanup[index] = cleanFn;
1863
+ });
1864
+ },
1865
+ run() {
1866
+ const store = getStore();
1867
+ withUpdates(() => {
1868
+ store.hooksEffect.forEach((effect) => {
1869
+ effect();
1870
+ });
1871
+ store.hooksEffect.length = 0;
1872
+ })();
1873
+ },
1874
+ clearAll() {
1875
+ const store = getStore();
1876
+ store.hooksCleanup.forEach((cleanFn) => {
1877
+ cleanFn?.();
1878
+ });
1879
+ store.hooksEffect.length = 0;
1880
+ store.hooksCleanup.length = 0;
1881
+ }
1882
+ };
1883
+
1884
+ // node_modules/@inquirer/core/dist/esm/lib/use-state.mjs
1885
+ function useState(defaultValue) {
1886
+ return withPointer((pointer) => {
1887
+ const setFn = (newValue) => {
1888
+ if (pointer.get() !== newValue) {
1889
+ pointer.set(newValue);
1890
+ handleChange();
1891
+ }
1892
+ };
1893
+ if (pointer.initialized) {
1894
+ return [pointer.get(), setFn];
1895
+ }
1896
+ const value = typeof defaultValue === "function" ? defaultValue() : defaultValue;
1897
+ pointer.set(value);
1898
+ return [value, setFn];
1899
+ });
1900
+ }
1901
+
1902
+ // node_modules/@inquirer/core/dist/esm/lib/use-effect.mjs
1903
+ function useEffect(cb, depArray) {
1904
+ withPointer((pointer) => {
1905
+ const oldDeps = pointer.get();
1906
+ const hasChanged = !Array.isArray(oldDeps) || depArray.some((dep, i) => !Object.is(dep, oldDeps[i]));
1907
+ if (hasChanged) {
1908
+ effectScheduler.queue(cb);
1909
+ }
1910
+ pointer.set(depArray);
1911
+ });
1912
+ }
1913
+
1914
+ // node_modules/@inquirer/core/dist/esm/lib/theme.mjs
1915
+ var import_yoctocolors_cjs = __toESM(require_yoctocolors_cjs(), 1);
1916
+
1917
+ // node_modules/@inquirer/figures/dist/esm/index.js
1918
+ var import_node_process = __toESM(require("node:process"), 1);
1919
+ function isUnicodeSupported() {
1920
+ if (import_node_process.default.platform !== "win32") {
1921
+ return import_node_process.default.env["TERM"] !== "linux";
1922
+ }
1923
+ return Boolean(import_node_process.default.env["WT_SESSION"]) || // Windows Terminal
1924
+ Boolean(import_node_process.default.env["TERMINUS_SUBLIME"]) || // Terminus (<0.2.27)
1925
+ import_node_process.default.env["ConEmuTask"] === "{cmd::Cmder}" || // ConEmu and cmder
1926
+ import_node_process.default.env["TERM_PROGRAM"] === "Terminus-Sublime" || import_node_process.default.env["TERM_PROGRAM"] === "vscode" || import_node_process.default.env["TERM"] === "xterm-256color" || import_node_process.default.env["TERM"] === "alacritty" || import_node_process.default.env["TERMINAL_EMULATOR"] === "JetBrains-JediTerm";
1927
+ }
1928
+ var common = {
1929
+ circleQuestionMark: "(?)",
1930
+ questionMarkPrefix: "(?)",
1931
+ square: "\u2588",
1932
+ squareDarkShade: "\u2593",
1933
+ squareMediumShade: "\u2592",
1934
+ squareLightShade: "\u2591",
1935
+ squareTop: "\u2580",
1936
+ squareBottom: "\u2584",
1937
+ squareLeft: "\u258C",
1938
+ squareRight: "\u2590",
1939
+ squareCenter: "\u25A0",
1940
+ bullet: "\u25CF",
1941
+ dot: "\u2024",
1942
+ ellipsis: "\u2026",
1943
+ pointerSmall: "\u203A",
1944
+ triangleUp: "\u25B2",
1945
+ triangleUpSmall: "\u25B4",
1946
+ triangleDown: "\u25BC",
1947
+ triangleDownSmall: "\u25BE",
1948
+ triangleLeftSmall: "\u25C2",
1949
+ triangleRightSmall: "\u25B8",
1950
+ home: "\u2302",
1951
+ heart: "\u2665",
1952
+ musicNote: "\u266A",
1953
+ musicNoteBeamed: "\u266B",
1954
+ arrowUp: "\u2191",
1955
+ arrowDown: "\u2193",
1956
+ arrowLeft: "\u2190",
1957
+ arrowRight: "\u2192",
1958
+ arrowLeftRight: "\u2194",
1959
+ arrowUpDown: "\u2195",
1960
+ almostEqual: "\u2248",
1961
+ notEqual: "\u2260",
1962
+ lessOrEqual: "\u2264",
1963
+ greaterOrEqual: "\u2265",
1964
+ identical: "\u2261",
1965
+ infinity: "\u221E",
1966
+ subscriptZero: "\u2080",
1967
+ subscriptOne: "\u2081",
1968
+ subscriptTwo: "\u2082",
1969
+ subscriptThree: "\u2083",
1970
+ subscriptFour: "\u2084",
1971
+ subscriptFive: "\u2085",
1972
+ subscriptSix: "\u2086",
1973
+ subscriptSeven: "\u2087",
1974
+ subscriptEight: "\u2088",
1975
+ subscriptNine: "\u2089",
1976
+ oneHalf: "\xBD",
1977
+ oneThird: "\u2153",
1978
+ oneQuarter: "\xBC",
1979
+ oneFifth: "\u2155",
1980
+ oneSixth: "\u2159",
1981
+ oneEighth: "\u215B",
1982
+ twoThirds: "\u2154",
1983
+ twoFifths: "\u2156",
1984
+ threeQuarters: "\xBE",
1985
+ threeFifths: "\u2157",
1986
+ threeEighths: "\u215C",
1987
+ fourFifths: "\u2158",
1988
+ fiveSixths: "\u215A",
1989
+ fiveEighths: "\u215D",
1990
+ sevenEighths: "\u215E",
1991
+ line: "\u2500",
1992
+ lineBold: "\u2501",
1993
+ lineDouble: "\u2550",
1994
+ lineDashed0: "\u2504",
1995
+ lineDashed1: "\u2505",
1996
+ lineDashed2: "\u2508",
1997
+ lineDashed3: "\u2509",
1998
+ lineDashed4: "\u254C",
1999
+ lineDashed5: "\u254D",
2000
+ lineDashed6: "\u2574",
2001
+ lineDashed7: "\u2576",
2002
+ lineDashed8: "\u2578",
2003
+ lineDashed9: "\u257A",
2004
+ lineDashed10: "\u257C",
2005
+ lineDashed11: "\u257E",
2006
+ lineDashed12: "\u2212",
2007
+ lineDashed13: "\u2013",
2008
+ lineDashed14: "\u2010",
2009
+ lineDashed15: "\u2043",
2010
+ lineVertical: "\u2502",
2011
+ lineVerticalBold: "\u2503",
2012
+ lineVerticalDouble: "\u2551",
2013
+ lineVerticalDashed0: "\u2506",
2014
+ lineVerticalDashed1: "\u2507",
2015
+ lineVerticalDashed2: "\u250A",
2016
+ lineVerticalDashed3: "\u250B",
2017
+ lineVerticalDashed4: "\u254E",
2018
+ lineVerticalDashed5: "\u254F",
2019
+ lineVerticalDashed6: "\u2575",
2020
+ lineVerticalDashed7: "\u2577",
2021
+ lineVerticalDashed8: "\u2579",
2022
+ lineVerticalDashed9: "\u257B",
2023
+ lineVerticalDashed10: "\u257D",
2024
+ lineVerticalDashed11: "\u257F",
2025
+ lineDownLeft: "\u2510",
2026
+ lineDownLeftArc: "\u256E",
2027
+ lineDownBoldLeftBold: "\u2513",
2028
+ lineDownBoldLeft: "\u2512",
2029
+ lineDownLeftBold: "\u2511",
2030
+ lineDownDoubleLeftDouble: "\u2557",
2031
+ lineDownDoubleLeft: "\u2556",
2032
+ lineDownLeftDouble: "\u2555",
2033
+ lineDownRight: "\u250C",
2034
+ lineDownRightArc: "\u256D",
2035
+ lineDownBoldRightBold: "\u250F",
2036
+ lineDownBoldRight: "\u250E",
2037
+ lineDownRightBold: "\u250D",
2038
+ lineDownDoubleRightDouble: "\u2554",
2039
+ lineDownDoubleRight: "\u2553",
2040
+ lineDownRightDouble: "\u2552",
2041
+ lineUpLeft: "\u2518",
2042
+ lineUpLeftArc: "\u256F",
2043
+ lineUpBoldLeftBold: "\u251B",
2044
+ lineUpBoldLeft: "\u251A",
2045
+ lineUpLeftBold: "\u2519",
2046
+ lineUpDoubleLeftDouble: "\u255D",
2047
+ lineUpDoubleLeft: "\u255C",
2048
+ lineUpLeftDouble: "\u255B",
2049
+ lineUpRight: "\u2514",
2050
+ lineUpRightArc: "\u2570",
2051
+ lineUpBoldRightBold: "\u2517",
2052
+ lineUpBoldRight: "\u2516",
2053
+ lineUpRightBold: "\u2515",
2054
+ lineUpDoubleRightDouble: "\u255A",
2055
+ lineUpDoubleRight: "\u2559",
2056
+ lineUpRightDouble: "\u2558",
2057
+ lineUpDownLeft: "\u2524",
2058
+ lineUpBoldDownBoldLeftBold: "\u252B",
2059
+ lineUpBoldDownBoldLeft: "\u2528",
2060
+ lineUpDownLeftBold: "\u2525",
2061
+ lineUpBoldDownLeftBold: "\u2529",
2062
+ lineUpDownBoldLeftBold: "\u252A",
2063
+ lineUpDownBoldLeft: "\u2527",
2064
+ lineUpBoldDownLeft: "\u2526",
2065
+ lineUpDoubleDownDoubleLeftDouble: "\u2563",
2066
+ lineUpDoubleDownDoubleLeft: "\u2562",
2067
+ lineUpDownLeftDouble: "\u2561",
2068
+ lineUpDownRight: "\u251C",
2069
+ lineUpBoldDownBoldRightBold: "\u2523",
2070
+ lineUpBoldDownBoldRight: "\u2520",
2071
+ lineUpDownRightBold: "\u251D",
2072
+ lineUpBoldDownRightBold: "\u2521",
2073
+ lineUpDownBoldRightBold: "\u2522",
2074
+ lineUpDownBoldRight: "\u251F",
2075
+ lineUpBoldDownRight: "\u251E",
2076
+ lineUpDoubleDownDoubleRightDouble: "\u2560",
2077
+ lineUpDoubleDownDoubleRight: "\u255F",
2078
+ lineUpDownRightDouble: "\u255E",
2079
+ lineDownLeftRight: "\u252C",
2080
+ lineDownBoldLeftBoldRightBold: "\u2533",
2081
+ lineDownLeftBoldRightBold: "\u252F",
2082
+ lineDownBoldLeftRight: "\u2530",
2083
+ lineDownBoldLeftBoldRight: "\u2531",
2084
+ lineDownBoldLeftRightBold: "\u2532",
2085
+ lineDownLeftRightBold: "\u252E",
2086
+ lineDownLeftBoldRight: "\u252D",
2087
+ lineDownDoubleLeftDoubleRightDouble: "\u2566",
2088
+ lineDownDoubleLeftRight: "\u2565",
2089
+ lineDownLeftDoubleRightDouble: "\u2564",
2090
+ lineUpLeftRight: "\u2534",
2091
+ lineUpBoldLeftBoldRightBold: "\u253B",
2092
+ lineUpLeftBoldRightBold: "\u2537",
2093
+ lineUpBoldLeftRight: "\u2538",
2094
+ lineUpBoldLeftBoldRight: "\u2539",
2095
+ lineUpBoldLeftRightBold: "\u253A",
2096
+ lineUpLeftRightBold: "\u2536",
2097
+ lineUpLeftBoldRight: "\u2535",
2098
+ lineUpDoubleLeftDoubleRightDouble: "\u2569",
2099
+ lineUpDoubleLeftRight: "\u2568",
2100
+ lineUpLeftDoubleRightDouble: "\u2567",
2101
+ lineUpDownLeftRight: "\u253C",
2102
+ lineUpBoldDownBoldLeftBoldRightBold: "\u254B",
2103
+ lineUpDownBoldLeftBoldRightBold: "\u2548",
2104
+ lineUpBoldDownLeftBoldRightBold: "\u2547",
2105
+ lineUpBoldDownBoldLeftRightBold: "\u254A",
2106
+ lineUpBoldDownBoldLeftBoldRight: "\u2549",
2107
+ lineUpBoldDownLeftRight: "\u2540",
2108
+ lineUpDownBoldLeftRight: "\u2541",
2109
+ lineUpDownLeftBoldRight: "\u253D",
2110
+ lineUpDownLeftRightBold: "\u253E",
2111
+ lineUpBoldDownBoldLeftRight: "\u2542",
2112
+ lineUpDownLeftBoldRightBold: "\u253F",
2113
+ lineUpBoldDownLeftBoldRight: "\u2543",
2114
+ lineUpBoldDownLeftRightBold: "\u2544",
2115
+ lineUpDownBoldLeftBoldRight: "\u2545",
2116
+ lineUpDownBoldLeftRightBold: "\u2546",
2117
+ lineUpDoubleDownDoubleLeftDoubleRightDouble: "\u256C",
2118
+ lineUpDoubleDownDoubleLeftRight: "\u256B",
2119
+ lineUpDownLeftDoubleRightDouble: "\u256A",
2120
+ lineCross: "\u2573",
2121
+ lineBackslash: "\u2572",
2122
+ lineSlash: "\u2571"
2123
+ };
2124
+ var specialMainSymbols = {
2125
+ tick: "\u2714",
2126
+ info: "\u2139",
2127
+ warning: "\u26A0",
2128
+ cross: "\u2718",
2129
+ squareSmall: "\u25FB",
2130
+ squareSmallFilled: "\u25FC",
2131
+ circle: "\u25EF",
2132
+ circleFilled: "\u25C9",
2133
+ circleDotted: "\u25CC",
2134
+ circleDouble: "\u25CE",
2135
+ circleCircle: "\u24DE",
2136
+ circleCross: "\u24E7",
2137
+ circlePipe: "\u24BE",
2138
+ radioOn: "\u25C9",
2139
+ radioOff: "\u25EF",
2140
+ checkboxOn: "\u2612",
2141
+ checkboxOff: "\u2610",
2142
+ checkboxCircleOn: "\u24E7",
2143
+ checkboxCircleOff: "\u24BE",
2144
+ pointer: "\u276F",
2145
+ triangleUpOutline: "\u25B3",
2146
+ triangleLeft: "\u25C0",
2147
+ triangleRight: "\u25B6",
2148
+ lozenge: "\u25C6",
2149
+ lozengeOutline: "\u25C7",
2150
+ hamburger: "\u2630",
2151
+ smiley: "\u32E1",
2152
+ mustache: "\u0DF4",
2153
+ star: "\u2605",
2154
+ play: "\u25B6",
2155
+ nodejs: "\u2B22",
2156
+ oneSeventh: "\u2150",
2157
+ oneNinth: "\u2151",
2158
+ oneTenth: "\u2152"
2159
+ };
2160
+ var specialFallbackSymbols = {
2161
+ tick: "\u221A",
2162
+ info: "i",
2163
+ warning: "\u203C",
2164
+ cross: "\xD7",
2165
+ squareSmall: "\u25A1",
2166
+ squareSmallFilled: "\u25A0",
2167
+ circle: "( )",
2168
+ circleFilled: "(*)",
2169
+ circleDotted: "( )",
2170
+ circleDouble: "( )",
2171
+ circleCircle: "(\u25CB)",
2172
+ circleCross: "(\xD7)",
2173
+ circlePipe: "(\u2502)",
2174
+ radioOn: "(*)",
2175
+ radioOff: "( )",
2176
+ checkboxOn: "[\xD7]",
2177
+ checkboxOff: "[ ]",
2178
+ checkboxCircleOn: "(\xD7)",
2179
+ checkboxCircleOff: "( )",
2180
+ pointer: ">",
2181
+ triangleUpOutline: "\u2206",
2182
+ triangleLeft: "\u25C4",
2183
+ triangleRight: "\u25BA",
2184
+ lozenge: "\u2666",
2185
+ lozengeOutline: "\u25CA",
2186
+ hamburger: "\u2261",
2187
+ smiley: "\u263A",
2188
+ mustache: "\u250C\u2500\u2510",
2189
+ star: "\u2736",
2190
+ play: "\u25BA",
2191
+ nodejs: "\u2666",
2192
+ oneSeventh: "1/7",
2193
+ oneNinth: "1/9",
2194
+ oneTenth: "1/10"
2195
+ };
2196
+ var mainSymbols = {
2197
+ ...common,
2198
+ ...specialMainSymbols
2199
+ };
2200
+ var fallbackSymbols = {
2201
+ ...common,
2202
+ ...specialFallbackSymbols
2203
+ };
2204
+ var shouldUseMain = isUnicodeSupported();
2205
+ var figures = shouldUseMain ? mainSymbols : fallbackSymbols;
2206
+ var esm_default = figures;
2207
+ var replacements = Object.entries(specialMainSymbols);
2208
+
2209
+ // node_modules/@inquirer/core/dist/esm/lib/theme.mjs
2210
+ var defaultTheme = {
2211
+ prefix: {
2212
+ idle: import_yoctocolors_cjs.default.blue("?"),
2213
+ // TODO: use figure
2214
+ done: import_yoctocolors_cjs.default.green(esm_default.tick)
2215
+ },
2216
+ spinner: {
2217
+ interval: 80,
2218
+ frames: ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"].map((frame) => import_yoctocolors_cjs.default.yellow(frame))
2219
+ },
2220
+ style: {
2221
+ answer: import_yoctocolors_cjs.default.cyan,
2222
+ message: import_yoctocolors_cjs.default.bold,
2223
+ error: (text) => import_yoctocolors_cjs.default.red(`> ${text}`),
2224
+ defaultAnswer: (text) => import_yoctocolors_cjs.default.dim(`(${text})`),
2225
+ help: import_yoctocolors_cjs.default.dim,
2226
+ highlight: import_yoctocolors_cjs.default.cyan,
2227
+ key: (text) => import_yoctocolors_cjs.default.cyan(import_yoctocolors_cjs.default.bold(`<${text}>`))
2228
+ }
2229
+ };
2230
+
2231
+ // node_modules/@inquirer/core/dist/esm/lib/make-theme.mjs
2232
+ function isPlainObject(value) {
2233
+ if (typeof value !== "object" || value === null)
2234
+ return false;
2235
+ let proto = value;
2236
+ while (Object.getPrototypeOf(proto) !== null) {
2237
+ proto = Object.getPrototypeOf(proto);
2238
+ }
2239
+ return Object.getPrototypeOf(value) === proto;
2240
+ }
2241
+ function deepMerge(...objects) {
2242
+ const output = {};
2243
+ for (const obj of objects) {
2244
+ for (const [key, value] of Object.entries(obj)) {
2245
+ const prevValue = output[key];
2246
+ output[key] = isPlainObject(prevValue) && isPlainObject(value) ? deepMerge(prevValue, value) : value;
2247
+ }
2248
+ }
2249
+ return output;
2250
+ }
2251
+ function makeTheme(...themes) {
2252
+ const themesToMerge = [
2253
+ defaultTheme,
2254
+ ...themes.filter((theme) => theme != null)
2255
+ ];
2256
+ return deepMerge(...themesToMerge);
2257
+ }
2258
+
2259
+ // node_modules/@inquirer/core/dist/esm/lib/use-prefix.mjs
2260
+ function usePrefix({ status = "idle", theme }) {
2261
+ const [showLoader, setShowLoader] = useState(false);
2262
+ const [tick, setTick] = useState(0);
2263
+ const { prefix, spinner } = makeTheme(theme);
2264
+ useEffect(() => {
2265
+ if (status === "loading") {
2266
+ let tickInterval;
2267
+ let inc = -1;
2268
+ const delayTimeout = setTimeout(import_node_async_hooks2.AsyncResource.bind(() => {
2269
+ setShowLoader(true);
2270
+ tickInterval = setInterval(import_node_async_hooks2.AsyncResource.bind(() => {
2271
+ inc = inc + 1;
2272
+ setTick(inc % spinner.frames.length);
2273
+ }), spinner.interval);
2274
+ }), 300);
2275
+ return () => {
2276
+ clearTimeout(delayTimeout);
2277
+ clearInterval(tickInterval);
2278
+ };
2279
+ } else {
2280
+ setShowLoader(false);
2281
+ }
2282
+ }, [status]);
2283
+ if (showLoader) {
2284
+ return spinner.frames[tick];
2285
+ }
2286
+ const iconName = status === "loading" ? "idle" : status;
2287
+ return typeof prefix === "string" ? prefix : prefix[iconName];
2288
+ }
2289
+
2290
+ // node_modules/@inquirer/core/dist/esm/lib/use-memo.mjs
2291
+ function useMemo(fn, dependencies) {
2292
+ return withPointer((pointer) => {
2293
+ const prev = pointer.get();
2294
+ if (!prev || prev.dependencies.length !== dependencies.length || prev.dependencies.some((dep, i) => dep !== dependencies[i])) {
2295
+ const value = fn();
2296
+ pointer.set({ value, dependencies });
2297
+ return value;
2298
+ }
2299
+ return prev.value;
2300
+ });
2301
+ }
2302
+
2303
+ // node_modules/@inquirer/core/dist/esm/lib/use-ref.mjs
2304
+ function useRef(val) {
2305
+ return useState({ current: val })[0];
2306
+ }
2307
+
2308
+ // node_modules/@inquirer/core/dist/esm/lib/use-keypress.mjs
2309
+ function useKeypress(userHandler) {
2310
+ const signal = useRef(userHandler);
2311
+ signal.current = userHandler;
2312
+ useEffect((rl) => {
2313
+ let ignore = false;
2314
+ const handler = withUpdates((_input, event) => {
2315
+ if (ignore)
2316
+ return;
2317
+ void signal.current(event, rl);
2318
+ });
2319
+ rl.input.on("keypress", handler);
2320
+ return () => {
2321
+ ignore = true;
2322
+ rl.input.removeListener("keypress", handler);
2323
+ };
2324
+ }, []);
2325
+ }
2326
+
2327
+ // node_modules/@inquirer/core/dist/esm/lib/utils.mjs
2328
+ var import_cli_width = __toESM(require_cli_width(), 1);
2329
+ var import_wrap_ansi = __toESM(require_wrap_ansi(), 1);
2330
+ function breakLines(content, width) {
2331
+ return content.split("\n").flatMap((line) => (0, import_wrap_ansi.default)(line, width, { trim: false, hard: true }).split("\n").map((str) => str.trimEnd())).join("\n");
2332
+ }
2333
+ function readlineWidth() {
2334
+ return (0, import_cli_width.default)({ defaultWidth: 80, output: readline().output });
2335
+ }
2336
+
2337
+ // node_modules/@inquirer/core/dist/esm/lib/pagination/lines.mjs
2338
+ function split(content, width) {
2339
+ return breakLines(content, width).split("\n");
2340
+ }
2341
+ function rotate(count, items) {
2342
+ const max = items.length;
2343
+ const offset = (count % max + max) % max;
2344
+ return [...items.slice(offset), ...items.slice(0, offset)];
2345
+ }
2346
+ function lines({ items, width, renderItem, active, position: requested, pageSize }) {
2347
+ const layouts = items.map((item, index) => ({
2348
+ item,
2349
+ index,
2350
+ isActive: index === active
2351
+ }));
2352
+ const layoutsInPage = rotate(active - requested, layouts).slice(0, pageSize);
2353
+ const renderItemAt = (index) => layoutsInPage[index] == null ? [] : split(renderItem(layoutsInPage[index]), width);
2354
+ const pageBuffer = Array.from({ length: pageSize });
2355
+ const activeItem = renderItemAt(requested).slice(0, pageSize);
2356
+ const position = requested + activeItem.length <= pageSize ? requested : pageSize - activeItem.length;
2357
+ pageBuffer.splice(position, activeItem.length, ...activeItem);
2358
+ let bufferPointer = position + activeItem.length;
2359
+ let layoutPointer = requested + 1;
2360
+ while (bufferPointer < pageSize && layoutPointer < layoutsInPage.length) {
2361
+ for (const line of renderItemAt(layoutPointer)) {
2362
+ pageBuffer[bufferPointer++] = line;
2363
+ if (bufferPointer >= pageSize)
2364
+ break;
2365
+ }
2366
+ layoutPointer++;
2367
+ }
2368
+ bufferPointer = position - 1;
2369
+ layoutPointer = requested - 1;
2370
+ while (bufferPointer >= 0 && layoutPointer >= 0) {
2371
+ for (const line of renderItemAt(layoutPointer).reverse()) {
2372
+ pageBuffer[bufferPointer--] = line;
2373
+ if (bufferPointer < 0)
2374
+ break;
2375
+ }
2376
+ layoutPointer--;
2377
+ }
2378
+ return pageBuffer.filter((line) => typeof line === "string");
2379
+ }
2380
+
2381
+ // node_modules/@inquirer/core/dist/esm/lib/pagination/position.mjs
2382
+ function finite({ active, pageSize, total }) {
2383
+ const middle = Math.floor(pageSize / 2);
2384
+ if (total <= pageSize || active < middle)
2385
+ return active;
2386
+ if (active >= total - middle)
2387
+ return active + pageSize - total;
2388
+ return middle;
2389
+ }
2390
+ function infinite({ active, lastActive, total, pageSize, pointer }) {
2391
+ if (total <= pageSize)
2392
+ return active;
2393
+ if (lastActive < active && active - lastActive < pageSize) {
2394
+ return Math.min(Math.floor(pageSize / 2), pointer + active - lastActive);
2395
+ }
2396
+ return pointer;
2397
+ }
2398
+
2399
+ // node_modules/@inquirer/core/dist/esm/lib/pagination/use-pagination.mjs
2400
+ function usePagination({ items, active, renderItem, pageSize, loop = true }) {
2401
+ const state = useRef({ position: 0, lastActive: 0 });
2402
+ const position = loop ? infinite({
2403
+ active,
2404
+ lastActive: state.current.lastActive,
2405
+ total: items.length,
2406
+ pageSize,
2407
+ pointer: state.current.position
2408
+ }) : finite({
2409
+ active,
2410
+ total: items.length,
2411
+ pageSize
2412
+ });
2413
+ state.current.position = position;
2414
+ state.current.lastActive = active;
2415
+ return lines({
2416
+ items,
2417
+ width: readlineWidth(),
2418
+ renderItem,
2419
+ active,
2420
+ position,
2421
+ pageSize
2422
+ }).join("\n");
2423
+ }
2424
+
2425
+ // node_modules/@inquirer/core/dist/esm/lib/create-prompt.mjs
2426
+ var readline2 = __toESM(require("node:readline"), 1);
2427
+ var import_node_async_hooks3 = require("node:async_hooks");
2428
+ var import_mute_stream = __toESM(require_lib(), 1);
2429
+
2430
+ // node_modules/signal-exit/dist/mjs/signals.js
2431
+ var signals = [];
2432
+ signals.push("SIGHUP", "SIGINT", "SIGTERM");
2433
+ if (process.platform !== "win32") {
2434
+ signals.push(
2435
+ "SIGALRM",
2436
+ "SIGABRT",
2437
+ "SIGVTALRM",
2438
+ "SIGXCPU",
2439
+ "SIGXFSZ",
2440
+ "SIGUSR2",
2441
+ "SIGTRAP",
2442
+ "SIGSYS",
2443
+ "SIGQUIT",
2444
+ "SIGIOT"
2445
+ // should detect profiler and enable/disable accordingly.
2446
+ // see #21
2447
+ // 'SIGPROF'
2448
+ );
2449
+ }
2450
+ if (process.platform === "linux") {
2451
+ signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
2452
+ }
2453
+
2454
+ // node_modules/signal-exit/dist/mjs/index.js
2455
+ var processOk = (process4) => !!process4 && typeof process4 === "object" && typeof process4.removeListener === "function" && typeof process4.emit === "function" && typeof process4.reallyExit === "function" && typeof process4.listeners === "function" && typeof process4.kill === "function" && typeof process4.pid === "number" && typeof process4.on === "function";
2456
+ var kExitEmitter = /* @__PURE__ */ Symbol.for("signal-exit emitter");
2457
+ var global = globalThis;
2458
+ var ObjectDefineProperty = Object.defineProperty.bind(Object);
2459
+ var Emitter = class {
2460
+ emitted = {
2461
+ afterExit: false,
2462
+ exit: false
2463
+ };
2464
+ listeners = {
2465
+ afterExit: [],
2466
+ exit: []
2467
+ };
2468
+ count = 0;
2469
+ id = Math.random();
2470
+ constructor() {
2471
+ if (global[kExitEmitter]) {
2472
+ return global[kExitEmitter];
2473
+ }
2474
+ ObjectDefineProperty(global, kExitEmitter, {
2475
+ value: this,
2476
+ writable: false,
2477
+ enumerable: false,
2478
+ configurable: false
2479
+ });
2480
+ }
2481
+ on(ev, fn) {
2482
+ this.listeners[ev].push(fn);
2483
+ }
2484
+ removeListener(ev, fn) {
2485
+ const list = this.listeners[ev];
2486
+ const i = list.indexOf(fn);
2487
+ if (i === -1) {
2488
+ return;
2489
+ }
2490
+ if (i === 0 && list.length === 1) {
2491
+ list.length = 0;
2492
+ } else {
2493
+ list.splice(i, 1);
2494
+ }
2495
+ }
2496
+ emit(ev, code, signal) {
2497
+ if (this.emitted[ev]) {
2498
+ return false;
2499
+ }
2500
+ this.emitted[ev] = true;
2501
+ let ret = false;
2502
+ for (const fn of this.listeners[ev]) {
2503
+ ret = fn(code, signal) === true || ret;
2504
+ }
2505
+ if (ev === "exit") {
2506
+ ret = this.emit("afterExit", code, signal) || ret;
2507
+ }
2508
+ return ret;
2509
+ }
2510
+ };
2511
+ var SignalExitBase = class {
2512
+ };
2513
+ var signalExitWrap = (handler) => {
2514
+ return {
2515
+ onExit(cb, opts) {
2516
+ return handler.onExit(cb, opts);
2517
+ },
2518
+ load() {
2519
+ return handler.load();
2520
+ },
2521
+ unload() {
2522
+ return handler.unload();
2523
+ }
2524
+ };
2525
+ };
2526
+ var SignalExitFallback = class extends SignalExitBase {
2527
+ onExit() {
2528
+ return () => {
2529
+ };
2530
+ }
2531
+ load() {
2532
+ }
2533
+ unload() {
2534
+ }
2535
+ };
2536
+ var SignalExit = class extends SignalExitBase {
2537
+ // "SIGHUP" throws an `ENOSYS` error on Windows,
2538
+ // so use a supported signal instead
2539
+ /* c8 ignore start */
2540
+ #hupSig = process3.platform === "win32" ? "SIGINT" : "SIGHUP";
2541
+ /* c8 ignore stop */
2542
+ #emitter = new Emitter();
2543
+ #process;
2544
+ #originalProcessEmit;
2545
+ #originalProcessReallyExit;
2546
+ #sigListeners = {};
2547
+ #loaded = false;
2548
+ constructor(process4) {
2549
+ super();
2550
+ this.#process = process4;
2551
+ this.#sigListeners = {};
2552
+ for (const sig of signals) {
2553
+ this.#sigListeners[sig] = () => {
2554
+ const listeners = this.#process.listeners(sig);
2555
+ let { count } = this.#emitter;
2556
+ const p = process4;
2557
+ if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
2558
+ count += p.__signal_exit_emitter__.count;
2559
+ }
2560
+ if (listeners.length === count) {
2561
+ this.unload();
2562
+ const ret = this.#emitter.emit("exit", null, sig);
2563
+ const s = sig === "SIGHUP" ? this.#hupSig : sig;
2564
+ if (!ret)
2565
+ process4.kill(process4.pid, s);
2566
+ }
2567
+ };
2568
+ }
2569
+ this.#originalProcessReallyExit = process4.reallyExit;
2570
+ this.#originalProcessEmit = process4.emit;
2571
+ }
2572
+ onExit(cb, opts) {
2573
+ if (!processOk(this.#process)) {
2574
+ return () => {
2575
+ };
2576
+ }
2577
+ if (this.#loaded === false) {
2578
+ this.load();
2579
+ }
2580
+ const ev = opts?.alwaysLast ? "afterExit" : "exit";
2581
+ this.#emitter.on(ev, cb);
2582
+ return () => {
2583
+ this.#emitter.removeListener(ev, cb);
2584
+ if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) {
2585
+ this.unload();
2586
+ }
2587
+ };
2588
+ }
2589
+ load() {
2590
+ if (this.#loaded) {
2591
+ return;
2592
+ }
2593
+ this.#loaded = true;
2594
+ this.#emitter.count += 1;
2595
+ for (const sig of signals) {
2596
+ try {
2597
+ const fn = this.#sigListeners[sig];
2598
+ if (fn)
2599
+ this.#process.on(sig, fn);
2600
+ } catch (_) {
2601
+ }
2602
+ }
2603
+ this.#process.emit = (ev, ...a) => {
2604
+ return this.#processEmit(ev, ...a);
2605
+ };
2606
+ this.#process.reallyExit = (code) => {
2607
+ return this.#processReallyExit(code);
2608
+ };
2609
+ }
2610
+ unload() {
2611
+ if (!this.#loaded) {
2612
+ return;
2613
+ }
2614
+ this.#loaded = false;
2615
+ signals.forEach((sig) => {
2616
+ const listener = this.#sigListeners[sig];
2617
+ if (!listener) {
2618
+ throw new Error("Listener not defined for signal: " + sig);
2619
+ }
2620
+ try {
2621
+ this.#process.removeListener(sig, listener);
2622
+ } catch (_) {
2623
+ }
2624
+ });
2625
+ this.#process.emit = this.#originalProcessEmit;
2626
+ this.#process.reallyExit = this.#originalProcessReallyExit;
2627
+ this.#emitter.count -= 1;
2628
+ }
2629
+ #processReallyExit(code) {
2630
+ if (!processOk(this.#process)) {
2631
+ return 0;
2632
+ }
2633
+ this.#process.exitCode = code || 0;
2634
+ this.#emitter.emit("exit", this.#process.exitCode, null);
2635
+ return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
2636
+ }
2637
+ #processEmit(ev, ...args) {
2638
+ const og = this.#originalProcessEmit;
2639
+ if (ev === "exit" && processOk(this.#process)) {
2640
+ if (typeof args[0] === "number") {
2641
+ this.#process.exitCode = args[0];
2642
+ }
2643
+ const ret = og.call(this.#process, ev, ...args);
2644
+ this.#emitter.emit("exit", this.#process.exitCode, null);
2645
+ return ret;
2646
+ } else {
2647
+ return og.call(this.#process, ev, ...args);
2648
+ }
2649
+ }
2650
+ };
2651
+ var process3 = globalThis.process;
2652
+ var {
2653
+ /**
2654
+ * Called when the process is exiting, whether via signal, explicit
2655
+ * exit, or running out of stuff to do.
2656
+ *
2657
+ * If the global process object is not suitable for instrumentation,
2658
+ * then this will be a no-op.
2659
+ *
2660
+ * Returns a function that may be used to unload signal-exit.
2661
+ */
2662
+ onExit,
2663
+ /**
2664
+ * Load the listeners. Likely you never need to call this, unless
2665
+ * doing a rather deep integration with signal-exit functionality.
2666
+ * Mostly exposed for the benefit of testing.
2667
+ *
2668
+ * @internal
2669
+ */
2670
+ load,
2671
+ /**
2672
+ * Unload the listeners. Likely you never need to call this, unless
2673
+ * doing a rather deep integration with signal-exit functionality.
2674
+ * Mostly exposed for the benefit of testing.
2675
+ *
2676
+ * @internal
2677
+ */
2678
+ unload
2679
+ } = signalExitWrap(processOk(process3) ? new SignalExit(process3) : new SignalExitFallback());
2680
+
2681
+ // node_modules/@inquirer/core/dist/esm/lib/screen-manager.mjs
2682
+ var import_strip_ansi = __toESM(require_strip_ansi(), 1);
2683
+ var import_ansi_escapes = __toESM(require_ansi_escapes(), 1);
2684
+ var height = (content) => content.split("\n").length;
2685
+ var lastLine = (content) => content.split("\n").pop() ?? "";
2686
+ function cursorDown(n) {
2687
+ return n > 0 ? import_ansi_escapes.default.cursorDown(n) : "";
2688
+ }
2689
+ var ScreenManager = class {
2690
+ rl;
2691
+ // These variables are keeping information to allow correct prompt re-rendering
2692
+ height = 0;
2693
+ extraLinesUnderPrompt = 0;
2694
+ cursorPos;
2695
+ constructor(rl) {
2696
+ this.rl = rl;
2697
+ this.rl = rl;
2698
+ this.cursorPos = rl.getCursorPos();
2699
+ }
2700
+ write(content) {
2701
+ this.rl.output.unmute();
2702
+ this.rl.output.write(content);
2703
+ this.rl.output.mute();
2704
+ }
2705
+ render(content, bottomContent = "") {
2706
+ const promptLine = lastLine(content);
2707
+ const rawPromptLine = (0, import_strip_ansi.default)(promptLine);
2708
+ let prompt = rawPromptLine;
2709
+ if (this.rl.line.length > 0) {
2710
+ prompt = prompt.slice(0, -this.rl.line.length);
2711
+ }
2712
+ this.rl.setPrompt(prompt);
2713
+ this.cursorPos = this.rl.getCursorPos();
2714
+ const width = readlineWidth();
2715
+ content = breakLines(content, width);
2716
+ bottomContent = breakLines(bottomContent, width);
2717
+ if (rawPromptLine.length % width === 0) {
2718
+ content += "\n";
2719
+ }
2720
+ let output = content + (bottomContent ? "\n" + bottomContent : "");
2721
+ const promptLineUpDiff = Math.floor(rawPromptLine.length / width) - this.cursorPos.rows;
2722
+ const bottomContentHeight = promptLineUpDiff + (bottomContent ? height(bottomContent) : 0);
2723
+ if (bottomContentHeight > 0)
2724
+ output += import_ansi_escapes.default.cursorUp(bottomContentHeight);
2725
+ output += import_ansi_escapes.default.cursorTo(this.cursorPos.cols);
2726
+ this.write(cursorDown(this.extraLinesUnderPrompt) + import_ansi_escapes.default.eraseLines(this.height) + output);
2727
+ this.extraLinesUnderPrompt = bottomContentHeight;
2728
+ this.height = height(output);
2729
+ }
2730
+ checkCursorPos() {
2731
+ const cursorPos = this.rl.getCursorPos();
2732
+ if (cursorPos.cols !== this.cursorPos.cols) {
2733
+ this.write(import_ansi_escapes.default.cursorTo(cursorPos.cols));
2734
+ this.cursorPos = cursorPos;
2735
+ }
2736
+ }
2737
+ done({ clearContent }) {
2738
+ this.rl.setPrompt("");
2739
+ let output = cursorDown(this.extraLinesUnderPrompt);
2740
+ output += clearContent ? import_ansi_escapes.default.eraseLines(this.height) : "\n";
2741
+ output += import_ansi_escapes.default.cursorShow;
2742
+ this.write(output);
2743
+ this.rl.close();
2744
+ }
2745
+ };
2746
+
2747
+ // node_modules/@inquirer/core/dist/esm/lib/promise-polyfill.mjs
2748
+ var PromisePolyfill = class extends Promise {
2749
+ // Available starting from Node 22
2750
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers
2751
+ static withResolver() {
2752
+ let resolve3;
2753
+ let reject;
2754
+ const promise = new Promise((res, rej) => {
2755
+ resolve3 = res;
2756
+ reject = rej;
2757
+ });
2758
+ return { promise, resolve: resolve3, reject };
2759
+ }
2760
+ };
2761
+
2762
+ // node_modules/@inquirer/core/dist/esm/lib/create-prompt.mjs
2763
+ function createPrompt(view) {
2764
+ const prompt = (config, context = {}) => {
2765
+ const { input = process.stdin, signal } = context;
2766
+ const cleanups = /* @__PURE__ */ new Set();
2767
+ const output = new import_mute_stream.default();
2768
+ output.pipe(context.output ?? process.stdout);
2769
+ const rl = readline2.createInterface({
2770
+ terminal: true,
2771
+ input,
2772
+ output
2773
+ });
2774
+ const screen = new ScreenManager(rl);
2775
+ const { promise, resolve: resolve3, reject } = PromisePolyfill.withResolver();
2776
+ const cancel = () => reject(new CancelPromptError());
2777
+ if (signal) {
2778
+ const abort = () => reject(new AbortPromptError({ cause: signal.reason }));
2779
+ if (signal.aborted) {
2780
+ abort();
2781
+ return Object.assign(promise, { cancel });
2782
+ }
2783
+ signal.addEventListener("abort", abort);
2784
+ cleanups.add(() => signal.removeEventListener("abort", abort));
2785
+ }
2786
+ cleanups.add(onExit((code, signal2) => {
2787
+ reject(new ExitPromptError(`User force closed the prompt with ${code} ${signal2}`));
2788
+ }));
2789
+ const checkCursorPos = () => screen.checkCursorPos();
2790
+ rl.input.on("keypress", checkCursorPos);
2791
+ cleanups.add(() => rl.input.removeListener("keypress", checkCursorPos));
2792
+ return withHooks(rl, (cycle) => {
2793
+ const hooksCleanup = import_node_async_hooks3.AsyncResource.bind(() => effectScheduler.clearAll());
2794
+ rl.on("close", hooksCleanup);
2795
+ cleanups.add(() => rl.removeListener("close", hooksCleanup));
2796
+ cycle(() => {
2797
+ try {
2798
+ const nextView = view(config, (value) => {
2799
+ setImmediate(() => resolve3(value));
2800
+ });
2801
+ const [content, bottomContent] = typeof nextView === "string" ? [nextView] : nextView;
2802
+ screen.render(content, bottomContent);
2803
+ effectScheduler.run();
2804
+ } catch (error) {
2805
+ reject(error);
2806
+ }
2807
+ });
2808
+ return Object.assign(promise.then((answer) => {
2809
+ effectScheduler.clearAll();
2810
+ return answer;
2811
+ }, (error) => {
2812
+ effectScheduler.clearAll();
2813
+ throw error;
2814
+ }).finally(() => {
2815
+ cleanups.forEach((cleanup) => cleanup());
2816
+ screen.done({ clearContent: Boolean(context?.clearPromptOnDone) });
2817
+ output.end();
2818
+ }).then(() => promise), { cancel });
2819
+ });
2820
+ };
2821
+ return prompt;
2822
+ }
2823
+
2824
+ // node_modules/@inquirer/core/dist/esm/lib/Separator.mjs
2825
+ var import_yoctocolors_cjs2 = __toESM(require_yoctocolors_cjs(), 1);
2826
+ var Separator = class {
2827
+ separator = import_yoctocolors_cjs2.default.dim(Array.from({ length: 15 }).join(esm_default.line));
2828
+ type = "separator";
2829
+ constructor(separator) {
2830
+ if (separator) {
2831
+ this.separator = separator;
2832
+ }
2833
+ }
2834
+ static isSeparator(choice) {
2835
+ return Boolean(choice && typeof choice === "object" && "type" in choice && choice.type === "separator");
2836
+ }
2837
+ };
2838
+
2839
+ // node_modules/@inquirer/checkbox/dist/esm/index.mjs
2840
+ var import_yoctocolors_cjs3 = __toESM(require_yoctocolors_cjs(), 1);
2841
+ var import_ansi_escapes2 = __toESM(require_ansi_escapes(), 1);
2842
+ var checkboxTheme = {
2843
+ icon: {
2844
+ checked: import_yoctocolors_cjs3.default.green(esm_default.circleFilled),
2845
+ unchecked: esm_default.circle,
2846
+ cursor: esm_default.pointer
2847
+ },
2848
+ style: {
2849
+ disabledChoice: (text) => import_yoctocolors_cjs3.default.dim(`- ${text}`),
2850
+ renderSelectedChoices: (selectedChoices) => selectedChoices.map((choice) => choice.short).join(", "),
2851
+ description: (text) => import_yoctocolors_cjs3.default.cyan(text)
2852
+ },
2853
+ helpMode: "auto"
2854
+ };
2855
+ function isSelectable(item) {
2856
+ return !Separator.isSeparator(item) && !item.disabled;
2857
+ }
2858
+ function isChecked(item) {
2859
+ return isSelectable(item) && Boolean(item.checked);
2860
+ }
2861
+ function toggle(item) {
2862
+ return isSelectable(item) ? { ...item, checked: !item.checked } : item;
2863
+ }
2864
+ function check(checked) {
2865
+ return function(item) {
2866
+ return isSelectable(item) ? { ...item, checked } : item;
2867
+ };
2868
+ }
2869
+ function normalizeChoices(choices) {
2870
+ return choices.map((choice) => {
2871
+ if (Separator.isSeparator(choice))
2872
+ return choice;
2873
+ if (typeof choice === "string") {
2874
+ return {
2875
+ value: choice,
2876
+ name: choice,
2877
+ short: choice,
2878
+ disabled: false,
2879
+ checked: false
2880
+ };
2881
+ }
2882
+ const name = choice.name ?? String(choice.value);
2883
+ return {
2884
+ value: choice.value,
2885
+ name,
2886
+ short: choice.short ?? name,
2887
+ description: choice.description,
2888
+ disabled: choice.disabled ?? false,
2889
+ checked: choice.checked ?? false
2890
+ };
2891
+ });
2892
+ }
2893
+ var esm_default2 = createPrompt((config, done) => {
2894
+ const { instructions, pageSize = 7, loop = true, required, validate = () => true } = config;
2895
+ const theme = makeTheme(checkboxTheme, config.theme);
2896
+ const prefix = usePrefix({ theme });
2897
+ const firstRender = useRef(true);
2898
+ const [status, setStatus] = useState("pending");
2899
+ const [items, setItems] = useState(normalizeChoices(config.choices));
2900
+ const bounds = useMemo(() => {
2901
+ const first = items.findIndex(isSelectable);
2902
+ const last = items.findLastIndex(isSelectable);
2903
+ if (first < 0) {
2904
+ throw new ValidationError("[checkbox prompt] No selectable choices. All choices are disabled.");
2905
+ }
2906
+ return { first, last };
2907
+ }, [items]);
2908
+ const [active, setActive] = useState(bounds.first);
2909
+ const [showHelpTip, setShowHelpTip] = useState(true);
2910
+ const [errorMsg, setError] = useState();
2911
+ useKeypress(async (key) => {
2912
+ if (isEnterKey(key)) {
2913
+ const selection = items.filter(isChecked);
2914
+ const isValid = await validate([...selection]);
2915
+ if (required && !items.some(isChecked)) {
2916
+ setError("At least one choice must be selected");
2917
+ } else if (isValid === true) {
2918
+ setStatus("done");
2919
+ done(selection.map((choice) => choice.value));
2920
+ } else {
2921
+ setError(isValid || "You must select a valid value");
2922
+ }
2923
+ } else if (isUpKey(key) || isDownKey(key)) {
2924
+ if (loop || isUpKey(key) && active !== bounds.first || isDownKey(key) && active !== bounds.last) {
2925
+ const offset = isUpKey(key) ? -1 : 1;
2926
+ let next = active;
2927
+ do {
2928
+ next = (next + offset + items.length) % items.length;
2929
+ } while (!isSelectable(items[next]));
2930
+ setActive(next);
2931
+ }
2932
+ } else if (isSpaceKey(key)) {
2933
+ setError(void 0);
2934
+ setShowHelpTip(false);
2935
+ setItems(items.map((choice, i) => i === active ? toggle(choice) : choice));
2936
+ } else if (key.name === "a") {
2937
+ const selectAll = items.some((choice) => isSelectable(choice) && !choice.checked);
2938
+ setItems(items.map(check(selectAll)));
2939
+ } else if (key.name === "i") {
2940
+ setItems(items.map(toggle));
2941
+ } else if (isNumberKey(key)) {
2942
+ const position = Number(key.name) - 1;
2943
+ const item = items[position];
2944
+ if (item != null && isSelectable(item)) {
2945
+ setActive(position);
2946
+ setItems(items.map((choice, i) => i === position ? toggle(choice) : choice));
2947
+ }
2948
+ }
2949
+ });
2950
+ const message = theme.style.message(config.message);
2951
+ let description;
2952
+ const page = usePagination({
2953
+ items,
2954
+ active,
2955
+ renderItem({ item, isActive }) {
2956
+ if (Separator.isSeparator(item)) {
2957
+ return ` ${item.separator}`;
2958
+ }
2959
+ if (item.disabled) {
2960
+ const disabledLabel = typeof item.disabled === "string" ? item.disabled : "(disabled)";
2961
+ return theme.style.disabledChoice(`${item.name} ${disabledLabel}`);
2962
+ }
2963
+ if (isActive) {
2964
+ description = item.description;
2965
+ }
2966
+ const checkbox = item.checked ? theme.icon.checked : theme.icon.unchecked;
2967
+ const color = isActive ? theme.style.highlight : (x) => x;
2968
+ const cursor = isActive ? theme.icon.cursor : " ";
2969
+ return color(`${cursor}${checkbox} ${item.name}`);
2970
+ },
2971
+ pageSize,
2972
+ loop
2973
+ });
2974
+ if (status === "done") {
2975
+ const selection = items.filter(isChecked);
2976
+ const answer = theme.style.answer(theme.style.renderSelectedChoices(selection, items));
2977
+ return `${prefix} ${message} ${answer}`;
2978
+ }
2979
+ let helpTipTop = "";
2980
+ let helpTipBottom = "";
2981
+ if (theme.helpMode === "always" || theme.helpMode === "auto" && showHelpTip && (instructions === void 0 || instructions)) {
2982
+ if (typeof instructions === "string") {
2983
+ helpTipTop = instructions;
2984
+ } else {
2985
+ const keys = [
2986
+ `${theme.style.key("space")} to select`,
2987
+ `${theme.style.key("a")} to toggle all`,
2988
+ `${theme.style.key("i")} to invert selection`,
2989
+ `and ${theme.style.key("enter")} to proceed`
2990
+ ];
2991
+ helpTipTop = ` (Press ${keys.join(", ")})`;
2992
+ }
2993
+ if (items.length > pageSize && (theme.helpMode === "always" || theme.helpMode === "auto" && firstRender.current)) {
2994
+ helpTipBottom = `
2995
+ ${theme.style.help("(Use arrow keys to reveal more choices)")}`;
2996
+ firstRender.current = false;
2997
+ }
2998
+ }
2999
+ const choiceDescription = description ? `
3000
+ ${theme.style.description(description)}` : ``;
3001
+ let error = "";
3002
+ if (errorMsg) {
3003
+ error = `
3004
+ ${theme.style.error(errorMsg)}`;
3005
+ }
3006
+ return `${prefix} ${message}${helpTipTop}
3007
+ ${page}${helpTipBottom}${choiceDescription}${error}${import_ansi_escapes2.default.cursorHide}`;
3008
+ });
3009
+
3010
+ // node_modules/@inquirer/confirm/dist/esm/index.mjs
3011
+ var esm_default3 = createPrompt((config, done) => {
3012
+ const { transformer = (answer) => answer ? "yes" : "no" } = config;
3013
+ const [status, setStatus] = useState("pending");
3014
+ const [value, setValue] = useState("");
3015
+ const theme = makeTheme(config.theme);
3016
+ const prefix = usePrefix({ theme });
3017
+ useKeypress((key, rl) => {
3018
+ if (isEnterKey(key)) {
3019
+ let answer = config.default !== false;
3020
+ if (/^(y|yes)/i.test(value))
3021
+ answer = true;
3022
+ else if (/^(n|no)/i.test(value))
3023
+ answer = false;
3024
+ setValue(transformer(answer));
3025
+ setStatus("done");
3026
+ done(answer);
3027
+ } else {
3028
+ setValue(rl.line);
3029
+ }
3030
+ });
3031
+ let formattedValue = value;
3032
+ let defaultValue = "";
3033
+ if (status === "done") {
3034
+ formattedValue = theme.style.answer(value);
3035
+ } else {
3036
+ defaultValue = ` ${theme.style.defaultAnswer(config.default === false ? "y/N" : "Y/n")}`;
3037
+ }
3038
+ const message = theme.style.message(config.message);
3039
+ return `${prefix} ${message}${defaultValue} ${formattedValue}`;
3040
+ });
3041
+
3042
+ // node_modules/@inquirer/input/dist/esm/index.mjs
3043
+ var esm_default4 = createPrompt((config, done) => {
3044
+ const { required, validate = () => true } = config;
3045
+ const theme = makeTheme(config.theme);
3046
+ const [status, setStatus] = useState("pending");
3047
+ const [defaultValue = "", setDefaultValue] = useState(config.default);
3048
+ const [errorMsg, setError] = useState();
3049
+ const [value, setValue] = useState("");
3050
+ const isLoading = status === "loading";
3051
+ const prefix = usePrefix({ isLoading, theme });
3052
+ useKeypress(async (key, rl) => {
3053
+ if (status !== "pending") {
3054
+ return;
3055
+ }
3056
+ if (isEnterKey(key)) {
3057
+ const answer = value || defaultValue;
3058
+ setStatus("loading");
3059
+ const isValid = required && !answer ? "You must provide a value" : await validate(answer);
3060
+ if (isValid === true) {
3061
+ setValue(answer);
3062
+ setStatus("done");
3063
+ done(answer);
3064
+ } else {
3065
+ rl.write(value);
3066
+ setError(isValid || "You must provide a valid value");
3067
+ setStatus("pending");
3068
+ }
3069
+ } else if (isBackspaceKey(key) && !value) {
3070
+ setDefaultValue(void 0);
3071
+ } else if (key.name === "tab" && !value) {
3072
+ setDefaultValue(void 0);
3073
+ rl.clearLine(0);
3074
+ rl.write(defaultValue);
3075
+ setValue(defaultValue);
3076
+ } else {
3077
+ setValue(rl.line);
3078
+ setError(void 0);
3079
+ }
3080
+ });
3081
+ const message = theme.style.message(config.message);
3082
+ let formattedValue = value;
3083
+ if (typeof config.transformer === "function") {
3084
+ formattedValue = config.transformer(value, { isFinal: status === "done" });
3085
+ } else if (status === "done") {
3086
+ formattedValue = theme.style.answer(value);
3087
+ }
3088
+ let defaultStr;
3089
+ if (defaultValue && status !== "done" && !value) {
3090
+ defaultStr = theme.style.defaultAnswer(defaultValue);
3091
+ }
3092
+ let error = "";
3093
+ if (errorMsg) {
3094
+ error = theme.style.error(errorMsg);
3095
+ }
3096
+ return [
3097
+ [prefix, message, defaultStr, formattedValue].filter((v) => v !== void 0).join(" "),
3098
+ error
3099
+ ];
3100
+ });
3101
+
3102
+ // node_modules/@inquirer/select/dist/esm/index.mjs
3103
+ var import_yoctocolors_cjs4 = __toESM(require_yoctocolors_cjs(), 1);
3104
+ var import_ansi_escapes3 = __toESM(require_ansi_escapes(), 1);
3105
+ var selectTheme = {
3106
+ icon: { cursor: esm_default.pointer },
3107
+ style: {
3108
+ disabled: (text) => import_yoctocolors_cjs4.default.dim(`- ${text}`),
3109
+ description: (text) => import_yoctocolors_cjs4.default.cyan(text)
3110
+ },
3111
+ helpMode: "auto"
3112
+ };
3113
+ function isSelectable2(item) {
3114
+ return !Separator.isSeparator(item) && !item.disabled;
3115
+ }
3116
+ function normalizeChoices2(choices) {
3117
+ return choices.map((choice) => {
3118
+ if (Separator.isSeparator(choice))
3119
+ return choice;
3120
+ if (typeof choice === "string") {
3121
+ return {
3122
+ value: choice,
3123
+ name: choice,
3124
+ short: choice,
3125
+ disabled: false
3126
+ };
3127
+ }
3128
+ const name = choice.name ?? String(choice.value);
3129
+ return {
3130
+ value: choice.value,
3131
+ name,
3132
+ description: choice.description,
3133
+ short: choice.short ?? name,
3134
+ disabled: choice.disabled ?? false
3135
+ };
3136
+ });
3137
+ }
3138
+ var esm_default5 = createPrompt((config, done) => {
3139
+ const { loop = true, pageSize = 7 } = config;
3140
+ const firstRender = useRef(true);
3141
+ const theme = makeTheme(selectTheme, config.theme);
3142
+ const prefix = usePrefix({ theme });
3143
+ const [status, setStatus] = useState("pending");
3144
+ const searchTimeoutRef = useRef();
3145
+ const items = useMemo(() => normalizeChoices2(config.choices), [config.choices]);
3146
+ const bounds = useMemo(() => {
3147
+ const first = items.findIndex(isSelectable2);
3148
+ const last = items.findLastIndex(isSelectable2);
3149
+ if (first < 0) {
3150
+ throw new ValidationError("[select prompt] No selectable choices. All choices are disabled.");
3151
+ }
3152
+ return { first, last };
3153
+ }, [items]);
3154
+ const defaultItemIndex = useMemo(() => {
3155
+ if (!("default" in config))
3156
+ return -1;
3157
+ return items.findIndex((item) => isSelectable2(item) && item.value === config.default);
3158
+ }, [config.default, items]);
3159
+ const [active, setActive] = useState(defaultItemIndex === -1 ? bounds.first : defaultItemIndex);
3160
+ const selectedChoice = items[active];
3161
+ useKeypress((key, rl) => {
3162
+ clearTimeout(searchTimeoutRef.current);
3163
+ if (isEnterKey(key)) {
3164
+ setStatus("done");
3165
+ done(selectedChoice.value);
3166
+ } else if (isUpKey(key) || isDownKey(key)) {
3167
+ rl.clearLine(0);
3168
+ if (loop || isUpKey(key) && active !== bounds.first || isDownKey(key) && active !== bounds.last) {
3169
+ const offset = isUpKey(key) ? -1 : 1;
3170
+ let next = active;
3171
+ do {
3172
+ next = (next + offset + items.length) % items.length;
3173
+ } while (!isSelectable2(items[next]));
3174
+ setActive(next);
3175
+ }
3176
+ } else if (isNumberKey(key)) {
3177
+ rl.clearLine(0);
3178
+ const position = Number(key.name) - 1;
3179
+ const item = items[position];
3180
+ if (item != null && isSelectable2(item)) {
3181
+ setActive(position);
3182
+ }
3183
+ } else if (isBackspaceKey(key)) {
3184
+ rl.clearLine(0);
3185
+ } else {
3186
+ const searchTerm = rl.line.toLowerCase();
3187
+ const matchIndex = items.findIndex((item) => {
3188
+ if (Separator.isSeparator(item) || !isSelectable2(item))
3189
+ return false;
3190
+ return item.name.toLowerCase().startsWith(searchTerm);
3191
+ });
3192
+ if (matchIndex >= 0) {
3193
+ setActive(matchIndex);
3194
+ }
3195
+ searchTimeoutRef.current = setTimeout(() => {
3196
+ rl.clearLine(0);
3197
+ }, 700);
3198
+ }
3199
+ });
3200
+ useEffect(() => () => {
3201
+ clearTimeout(searchTimeoutRef.current);
3202
+ }, []);
3203
+ const message = theme.style.message(config.message);
3204
+ let helpTipTop = "";
3205
+ let helpTipBottom = "";
3206
+ if (theme.helpMode === "always" || theme.helpMode === "auto" && firstRender.current) {
3207
+ firstRender.current = false;
3208
+ if (items.length > pageSize) {
3209
+ helpTipBottom = `
3210
+ ${theme.style.help("(Use arrow keys to reveal more choices)")}`;
3211
+ } else {
3212
+ helpTipTop = theme.style.help("(Use arrow keys)");
3213
+ }
3214
+ }
3215
+ const page = usePagination({
3216
+ items,
3217
+ active,
3218
+ renderItem({ item, isActive }) {
3219
+ if (Separator.isSeparator(item)) {
3220
+ return ` ${item.separator}`;
3221
+ }
3222
+ if (item.disabled) {
3223
+ const disabledLabel = typeof item.disabled === "string" ? item.disabled : "(disabled)";
3224
+ return theme.style.disabled(`${item.name} ${disabledLabel}`);
3225
+ }
3226
+ const color = isActive ? theme.style.highlight : (x) => x;
3227
+ const cursor = isActive ? theme.icon.cursor : ` `;
3228
+ return color(`${cursor} ${item.name}`);
3229
+ },
3230
+ pageSize,
3231
+ loop
3232
+ });
3233
+ if (status === "done") {
3234
+ return `${prefix} ${message} ${theme.style.answer(selectedChoice.short)}`;
3235
+ }
3236
+ const choiceDescription = selectedChoice.description ? `
3237
+ ${theme.style.description(selectedChoice.description)}` : ``;
3238
+ return `${[prefix, message, helpTipTop].filter(Boolean).join(" ")}
3239
+ ${page}${helpTipBottom}${choiceDescription}${import_ansi_escapes3.default.cursorHide}`;
3240
+ });
3241
+
3242
+ // src/index.ts
3243
+ var import_fs5 = require("fs");
3244
+ var import_readline = require("readline");
3245
+ var import_path5 = require("path");
3246
+
3247
+ // data/wizard-options/agents.json
3248
+ var agents_default = {
3249
+ agents: [
3250
+ { name: "Claude Code", value: "claude-code" },
3251
+ { name: "GitHub Copilot", value: "github-copilot" },
3252
+ { name: "Cursor", value: "cursor" }
3253
+ ]
3254
+ };
3255
+
3256
+ // data/wizard-options/personas.json
3257
+ var personas_default = {
3258
+ baseMcpServers: ["azure-devops", "context7"],
3259
+ personas: [
3260
+ {
3261
+ id: "sapui5-developer",
3262
+ name: "SAPUI5 Developer",
3263
+ description: "Frontend development with SAP UI5 and Fiori",
3264
+ domains: ["SAPUI5", "GENERAL"],
3265
+ mcpServers: ["azure-devops", "context7", "playwright", "@ui5/mcp-server"]
3266
+ },
3267
+ {
3268
+ id: "cap-developer",
3269
+ name: "CAP Developer",
3270
+ description: "Backend development with SAP Cloud Application Programming model",
3271
+ domains: ["CAP", "GENERAL"],
3272
+ mcpServers: ["azure-devops", "context7", "cds-mcp"]
3273
+ },
3274
+ {
3275
+ id: "abap-developer",
3276
+ name: "ABAP Developer",
3277
+ description: "ABAP and SAP backend development",
3278
+ domains: ["ABAP", "GENERAL"],
3279
+ mcpServers: ["azure-devops", "context7", "abap", "sap-researcher"]
3280
+ },
3281
+ {
3282
+ id: "btp-developer",
3283
+ name: "BTP Developer",
3284
+ description: "SAP Business Technology Platform development",
3285
+ domains: ["BTP", "GENERAL"],
3286
+ mcpServers: ["azure-devops", "context7"]
3287
+ },
3288
+ {
3289
+ id: "sap-dm-developer",
3290
+ name: "SAP Digital Manufacturing Developer",
3291
+ description: "SAP Digital Manufacturing development",
3292
+ domains: ["SAP_DM", "GENERAL"],
3293
+ mcpServers: ["azure-devops", "context7"]
3294
+ },
3295
+ {
3296
+ id: "forms-developer",
3297
+ name: "Forms Developer",
3298
+ description: "SAP Forms development",
3299
+ domains: ["FORMS", "GENERAL"],
3300
+ mcpServers: ["azure-devops", "context7"]
3301
+ }
3302
+ ]
3303
+ };
3304
+
3305
+ // src/utils/data/fetch-contexts.ts
3306
+ var import_fs2 = require("fs");
3307
+ var import_path2 = require("path");
3308
+ var import_child_process = require("child_process");
3309
+
3310
+ // src/utils/auth/github-auth.ts
3311
+ var import_fs = require("fs");
3312
+ var import_path = require("path");
3313
+ var import_os = require("os");
3314
+ var GITHUB_CLIENT_ID = "Ov23liwpMumAhwVufZ7N";
3315
+ var GITHUB_DEVICE_CODE_URL = "https://github.com/login/device/code";
3316
+ var GITHUB_TOKEN_URL = "https://github.com/login/oauth/access_token";
3317
+ function getTokenCachePath() {
3318
+ const configDir = (0, import_path.join)((0, import_os.homedir)(), ".one-shot-installer");
3319
+ if (!(0, import_fs.existsSync)(configDir)) {
3320
+ (0, import_fs.mkdirSync)(configDir, { recursive: true });
3321
+ }
3322
+ return (0, import_path.join)(configDir, "github-token.json");
3323
+ }
3324
+ function loadCachedToken() {
3325
+ const cachePath = getTokenCachePath();
3326
+ if (!(0, import_fs.existsSync)(cachePath)) {
3327
+ return null;
3328
+ }
3329
+ try {
3330
+ const data = (0, import_fs.readFileSync)(cachePath, "utf-8");
3331
+ const cached = JSON.parse(data);
3332
+ return cached.access_token;
3333
+ } catch (error) {
3334
+ return null;
3335
+ }
3336
+ }
3337
+ function saveTokenToCache(token) {
3338
+ const cachePath = getTokenCachePath();
3339
+ const cached = {
3340
+ access_token: token,
3341
+ created_at: Date.now()
3342
+ };
3343
+ (0, import_fs.writeFileSync)(cachePath, JSON.stringify(cached, null, 2), { encoding: "utf-8", mode: 384 });
3344
+ }
3345
+ function clearTokenCache() {
3346
+ const cachePath = getTokenCachePath();
3347
+ if ((0, import_fs.existsSync)(cachePath)) {
3348
+ try {
3349
+ (0, import_fs.unlinkSync)(cachePath);
3350
+ } catch (error) {
3351
+ }
3352
+ }
3353
+ }
3354
+ async function requestDeviceCode() {
3355
+ const response = await fetch(GITHUB_DEVICE_CODE_URL, {
3356
+ method: "POST",
3357
+ headers: {
3358
+ "Accept": "application/json",
3359
+ "Content-Type": "application/json"
3360
+ },
3361
+ body: JSON.stringify({
3362
+ client_id: GITHUB_CLIENT_ID,
3363
+ scope: "repo"
3364
+ // Read access to private repositories
3365
+ })
3366
+ });
3367
+ if (!response.ok) {
3368
+ throw new Error(`GitHub device code request failed: ${response.status}`);
3369
+ }
3370
+ return await response.json();
3371
+ }
3372
+ async function pollForToken(deviceCode, interval) {
3373
+ const maxAttempts = 60;
3374
+ let attempts = 0;
3375
+ while (attempts < maxAttempts) {
3376
+ await new Promise((resolve3) => setTimeout(resolve3, interval * 1e3));
3377
+ const response = await fetch(GITHUB_TOKEN_URL, {
3378
+ method: "POST",
3379
+ headers: {
3380
+ "Accept": "application/json",
3381
+ "Content-Type": "application/json"
3382
+ },
3383
+ body: JSON.stringify({
3384
+ client_id: GITHUB_CLIENT_ID,
3385
+ device_code: deviceCode,
3386
+ grant_type: "urn:ietf:params:oauth:grant-type:device_code"
3387
+ })
3388
+ });
3389
+ if (!response.ok) {
3390
+ throw new Error(`GitHub token request failed: ${response.status}`);
3391
+ }
3392
+ const data = await response.json();
3393
+ if (data.access_token) {
3394
+ return data.access_token;
3395
+ }
3396
+ if (data.error === "authorization_pending") {
3397
+ attempts++;
3398
+ continue;
3399
+ }
3400
+ if (data.error === "slow_down") {
3401
+ interval += 5;
3402
+ attempts++;
3403
+ continue;
3404
+ }
3405
+ if (data.error === "expired_token") {
3406
+ throw new Error("Device code expired. Please try again.");
3407
+ }
3408
+ if (data.error === "access_denied") {
3409
+ throw new Error("Access denied. User cancelled authorization.");
3410
+ }
3411
+ throw new Error(`Unexpected error: ${data.error} - ${data.error_description}`);
3412
+ }
3413
+ throw new Error("Authentication timeout. Please try again.");
3414
+ }
3415
+ async function authenticateWithGitHub() {
3416
+ const envToken = process.env.GITHUB_TOKEN;
3417
+ if (envToken) {
3418
+ return envToken;
3419
+ }
3420
+ const cachedToken = loadCachedToken();
3421
+ if (cachedToken) {
3422
+ const isValid = await verifyToken(cachedToken);
3423
+ if (isValid) {
3424
+ return cachedToken;
3425
+ }
3426
+ clearTokenCache();
3427
+ }
3428
+ console.log("\nGitHub Authentication Required\n");
3429
+ console.log("This installer needs access to private GitHub repositories.");
3430
+ console.log("You'll authenticate once, and the token will be cached for future use.\n");
3431
+ console.log("Requesting authorization code...");
3432
+ const deviceCodeData = await requestDeviceCode();
3433
+ console.log("\n\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557");
3434
+ console.log("\u2551 GitHub Authentication \u2551");
3435
+ console.log("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D\n");
3436
+ console.log(`1. Visit: ${deviceCodeData.verification_uri}`);
3437
+ console.log(`2. Enter code: ${deviceCodeData.user_code}`);
3438
+ console.log("\nWaiting for authentication...");
3439
+ console.log("(This window will continue automatically once you approve)\n");
3440
+ const accessToken = await pollForToken(
3441
+ deviceCodeData.device_code,
3442
+ deviceCodeData.interval || 5
3443
+ );
3444
+ saveTokenToCache(accessToken);
3445
+ console.log("\u2705 Authentication successful!\n");
3446
+ return accessToken;
3447
+ }
3448
+ async function verifyToken(token) {
3449
+ try {
3450
+ const response = await fetch("https://api.github.com/user", {
3451
+ headers: {
3452
+ "Authorization": `Bearer ${token}`,
3453
+ "Accept": "application/vnd.github+json"
3454
+ }
3455
+ });
3456
+ return response.ok;
3457
+ } catch (error) {
3458
+ return false;
3459
+ }
3460
+ }
3461
+ async function getGitHubToken() {
3462
+ return await authenticateWithGitHub();
3463
+ }
3464
+
3465
+ // src/utils/data/fetch-contexts.ts
3466
+ var GITHUB_REPO = "DLW-INT-SAP-DEV/DBE_DLWR_AI_WORKSPACE_SETUP_client";
3467
+ var MAX_RETRIES = 3;
3468
+ var RETRY_DELAY_MS = 2e3;
3469
+ var MIN_FILE_SIZE = 1024;
3470
+ async function fetchContexts(options = {}) {
3471
+ const { domains = [], targetDir = process.cwd(), force = false } = options;
3472
+ const result = {
3473
+ successful: [],
3474
+ failed: [],
3475
+ skipped: [],
3476
+ failureReasons: {}
3477
+ };
3478
+ if (domains.length === 0) {
3479
+ return result;
3480
+ }
3481
+ await checkPrerequisites();
3482
+ const githubToken = await getGitHubToken();
3483
+ try {
3484
+ const releaseUrl = `https://api.github.com/repos/${GITHUB_REPO}/releases/latest`;
3485
+ const headers = {
3486
+ "Accept": "application/vnd.github+json",
3487
+ "Authorization": `Bearer ${githubToken}`
3488
+ };
3489
+ const releaseResponse = await fetchWithRetry(releaseUrl, { headers }, MAX_RETRIES);
3490
+ if (!releaseResponse.ok) {
3491
+ throw new Error(
3492
+ `GitHub API error (${releaseResponse.status}): ${getReadableError(releaseResponse.status)}`
3493
+ );
3494
+ }
3495
+ const releaseData = await releaseResponse.json();
3496
+ const contextsDir = (0, import_path2.join)(targetDir, "contexts");
3497
+ const tempDir = (0, import_path2.join)(targetDir, ".temp-download");
3498
+ try {
3499
+ if (!(0, import_fs2.existsSync)(contextsDir)) {
3500
+ (0, import_fs2.mkdirSync)(contextsDir, { recursive: true });
3501
+ }
3502
+ if ((0, import_fs2.existsSync)(tempDir)) {
3503
+ (0, import_fs2.rmSync)(tempDir, { recursive: true, force: true });
3504
+ }
3505
+ (0, import_fs2.mkdirSync)(tempDir, { recursive: true });
3506
+ } catch (error) {
3507
+ throw new Error(`Failed to create directories: ${error instanceof Error ? error.message : "Unknown error"}`);
3508
+ }
3509
+ for (const domain of domains) {
3510
+ try {
3511
+ const domainPath = (0, import_path2.join)(contextsDir, domain);
3512
+ if ((0, import_fs2.existsSync)(domainPath) && force) {
3513
+ (0, import_fs2.rmSync)(domainPath, { recursive: true, force: true });
3514
+ }
3515
+ const archiveName = `${domain.toLowerCase()}.tar.gz`;
3516
+ const asset = releaseData.assets?.find((a) => a.name === archiveName);
3517
+ if (!asset) {
3518
+ result.failed.push(domain);
3519
+ result.failureReasons[domain] = "Not found in release";
3520
+ continue;
3521
+ }
3522
+ const downloadHeaders = {
3523
+ "Accept": "application/octet-stream",
3524
+ "Authorization": `Bearer ${githubToken}`
3525
+ };
3526
+ const downloadUrl = asset.url;
3527
+ const response = await fetchWithRetry(downloadUrl, { headers: downloadHeaders }, MAX_RETRIES);
3528
+ if (!response.ok) {
3529
+ throw new Error(`Download failed: ${getReadableError(response.status)}`);
3530
+ }
3531
+ const archivePath = (0, import_path2.join)(tempDir, archiveName);
3532
+ const arrayBuffer = await response.arrayBuffer();
3533
+ (0, import_fs2.writeFileSync)(archivePath, Buffer.from(arrayBuffer));
3534
+ const stats = (0, import_fs2.statSync)(archivePath);
3535
+ if (stats.size < MIN_FILE_SIZE) {
3536
+ throw new Error("File corrupted");
3537
+ }
3538
+ const listResult = (0, import_child_process.spawnSync)("tar", ["-tzf", archivePath], { encoding: "utf8" });
3539
+ if (listResult.status !== 0) {
3540
+ throw new Error("Failed to read archive contents");
3541
+ }
3542
+ const resolvedTempDir = (0, import_path2.resolve)(tempDir);
3543
+ for (const entry of listResult.stdout.split("\n").filter(Boolean)) {
3544
+ const entryPath = (0, import_path2.resolve)((0, import_path2.join)(tempDir, entry.replace(/\/$/, "")));
3545
+ if (!entryPath.startsWith(resolvedTempDir + import_path2.sep)) {
3546
+ throw new Error(`Archive contains unsafe path: ${entry}`);
3547
+ }
3548
+ }
3549
+ (0, import_child_process.spawnSync)("tar", ["-xzf", archivePath, "-C", tempDir], { stdio: "ignore" });
3550
+ const extractedEntries = (0, import_fs2.readdirSync)(tempDir);
3551
+ const extractedFolder = extractedEntries.find((e) => e.toLowerCase() === domain.toLowerCase());
3552
+ if (!extractedFolder) {
3553
+ throw new Error("Extraction failed");
3554
+ }
3555
+ const extractedPath = (0, import_path2.join)(tempDir, extractedFolder);
3556
+ mergeDirectories(extractedPath, domainPath);
3557
+ result.successful.push(domain);
3558
+ } catch (error) {
3559
+ const reason = error instanceof Error ? error.message : "Unknown error";
3560
+ result.failed.push(domain);
3561
+ result.failureReasons[domain] = reason;
3562
+ }
3563
+ }
3564
+ try {
3565
+ if ((0, import_fs2.existsSync)(tempDir)) {
3566
+ (0, import_fs2.rmSync)(tempDir, { recursive: true, force: true });
3567
+ }
3568
+ } catch (error) {
3569
+ }
3570
+ } catch (error) {
3571
+ const tempDir = (0, import_path2.join)(targetDir, ".temp-download");
3572
+ if ((0, import_fs2.existsSync)(tempDir)) {
3573
+ try {
3574
+ (0, import_fs2.rmSync)(tempDir, { recursive: true, force: true });
3575
+ } catch {
3576
+ }
3577
+ }
3578
+ throw error;
3579
+ }
3580
+ return result;
3581
+ }
3582
+ async function checkPrerequisites() {
3583
+ const check2 = (0, import_child_process.spawnSync)("tar", ["--version"], { stdio: "ignore" });
3584
+ if (check2.status !== 0) {
3585
+ throw new Error(
3586
+ "tar command not found. Please ensure tar is installed and available in your PATH."
3587
+ );
3588
+ }
3589
+ }
3590
+ async function fetchWithRetry(url, options, maxRetries) {
3591
+ let lastError = null;
3592
+ for (let attempt = 1; attempt <= maxRetries; attempt++) {
3593
+ try {
3594
+ const response = await fetch(url, options);
3595
+ if (!response.ok && response.status >= 400 && response.status < 500 && response.status !== 429) {
3596
+ return response;
3597
+ }
3598
+ if (response.ok) {
3599
+ return response;
3600
+ }
3601
+ lastError = new Error(`HTTP ${response.status}: ${response.statusText}`);
3602
+ } catch (error) {
3603
+ lastError = error instanceof Error ? error : new Error(String(error));
3604
+ }
3605
+ if (attempt < maxRetries) {
3606
+ const delay = RETRY_DELAY_MS * Math.pow(2, attempt - 1);
3607
+ await new Promise((resolve3) => setTimeout(resolve3, delay));
3608
+ }
3609
+ }
3610
+ throw lastError || new Error("Failed after maximum retries");
3611
+ }
3612
+ function getReadableError(status) {
3613
+ switch (status) {
3614
+ case 401:
3615
+ return "Authentication failed. Check your GitHub token.";
3616
+ case 403:
3617
+ return "Access denied. Verify token permissions and rate limits.";
3618
+ case 404:
3619
+ return "Resource not found. Verify the repository and release exist.";
3620
+ case 429:
3621
+ return "Rate limit exceeded. Please wait and try again.";
3622
+ case 500:
3623
+ case 502:
3624
+ case 503:
3625
+ return "GitHub server error. Please try again later.";
3626
+ default:
3627
+ return `Unexpected error (${status})`;
3628
+ }
3629
+ }
3630
+ function mergeDirectories(source, target) {
3631
+ let added = 0;
3632
+ let skipped = 0;
3633
+ if (!(0, import_fs2.existsSync)(target)) {
3634
+ (0, import_fs2.mkdirSync)(target, { recursive: true });
3635
+ }
3636
+ const entries = (0, import_fs2.readdirSync)(source, { withFileTypes: true });
3637
+ for (const entry of entries) {
3638
+ const sourcePath = (0, import_path2.join)(source, entry.name);
3639
+ const targetPath = (0, import_path2.join)(target, entry.name);
3640
+ if (entry.isDirectory()) {
3641
+ const result = mergeDirectories(sourcePath, targetPath);
3642
+ added += result.added;
3643
+ skipped += result.skipped;
3644
+ } else {
3645
+ if ((0, import_fs2.existsSync)(targetPath)) {
3646
+ skipped++;
3647
+ } else {
3648
+ (0, import_fs2.copyFileSync)(sourcePath, targetPath);
3649
+ added++;
3650
+ }
3651
+ }
3652
+ }
3653
+ return { added, skipped };
3654
+ }
3655
+
3656
+ // src/utils/setup/setup-mcp.ts
3657
+ var import_fs3 = require("fs");
3658
+ var import_path3 = require("path");
3659
+
3660
+ // data/wizard-options/mcp-servers.json
3661
+ var mcp_servers_default = {
3662
+ "azure-devops": {
3663
+ command: "npx",
3664
+ args: ["-y", "@azure-devops/mcp", "__AZURE_ORG__"],
3665
+ description: "Access Azure DevOps work items, boards, pipelines and repositories",
3666
+ useWhen: "User asks about work items, sprints, pipelines, pull requests or Azure DevOps tasks"
3667
+ },
3668
+ context7: {
3669
+ type: "stdio",
3670
+ command: "npx",
3671
+ args: ["-y", "@upstash/context7-mcp"],
3672
+ description: "Fetch up-to-date library and framework documentation",
3673
+ useWhen: "User asks how something works in a specific library or framework (e.g. 'how does X work in SAPUI5?')"
3674
+ },
3675
+ "@ui5/mcp-server": {
3676
+ type: "stdio",
3677
+ command: "npx",
3678
+ args: ["@ui5/mcp-server"],
3679
+ description: "SAPUI5-specific tooling for views, controllers, manifest and OData",
3680
+ useWhen: "User asks to create or modify SAPUI5 views, controllers, fragments or manifest.json"
3681
+ },
3682
+ playwright: {
3683
+ command: "npx",
3684
+ args: ["@playwright/mcp@latest"],
3685
+ description: "Browser automation and end-to-end testing",
3686
+ useWhen: "User asks to write or run browser tests, or automate browser interactions"
3687
+ },
3688
+ "cds-mcp": {
3689
+ command: "npx",
3690
+ args: ["-y", "@cap-js/mcp-server"],
3691
+ description: "SAP CAP/CDS tooling for service definitions, handlers and CQL",
3692
+ useWhen: "User asks about CAP services, CDS models, handlers or CQL queries"
3693
+ },
3694
+ abap: {
3695
+ type: "http",
3696
+ url: "http://localhost:5001/mcp",
3697
+ description: "ABAP development assistant for SAP backend development",
3698
+ useWhen: "User asks about ABAP code, RAP objects, CDS views or SAP backend logic"
3699
+ },
3700
+ "sap-researcher": {
3701
+ command: "npx",
3702
+ args: ["mcp-remote", "http://gsi-em-az1-0057/successormcp/mcp", "--allow-http"],
3703
+ description: "Internal SAP knowledge base and documentation search",
3704
+ useWhen: "User asks about SAP-specific topics, best practices or internal documentation"
3705
+ }
3706
+ };
3707
+
3708
+ // src/utils/setup/setup-mcp.ts
3709
+ function getAgentMCPTarget(agent) {
3710
+ switch (agent) {
3711
+ case "claude-code":
3712
+ return { filePath: "mcp.json", rootKey: "mcpServers", dir: null };
3713
+ case "cursor":
3714
+ return { filePath: ".cursor/mcp.json", rootKey: "mcpServers", dir: ".cursor" };
3715
+ case "github-copilot":
3716
+ default:
3717
+ return { filePath: ".vscode/mcp.json", rootKey: "servers", dir: ".vscode" };
3718
+ }
3719
+ }
3720
+ var ALL_MCP_SERVERS = mcp_servers_default;
3721
+ async function setupMCPConfiguration(projectPath, mcpConfig, agent) {
3722
+ const target = getAgentMCPTarget(agent);
3723
+ const mcpJsonPath = (0, import_path3.join)(projectPath, target.filePath);
3724
+ if (target.dir) {
3725
+ const dir = (0, import_path3.join)(projectPath, target.dir);
3726
+ if (!(0, import_fs3.existsSync)(dir)) {
3727
+ (0, import_fs3.mkdirSync)(dir, { recursive: true });
3728
+ }
3729
+ }
3730
+ let existingFile = {};
3731
+ if ((0, import_fs3.existsSync)(mcpJsonPath)) {
3732
+ try {
3733
+ const content = (0, import_fs3.readFileSync)(mcpJsonPath, "utf-8");
3734
+ existingFile = JSON.parse(content);
3735
+ } catch {
3736
+ }
3737
+ }
3738
+ const existing = existingFile[target.rootKey] ?? {};
3739
+ const addedServers = [];
3740
+ const skippedServers = [];
3741
+ const mergedServers = { ...existing };
3742
+ for (const [serverName, serverConfig] of Object.entries(mcpConfig)) {
3743
+ if (mergedServers[serverName]) {
3744
+ skippedServers.push(serverName);
3745
+ } else {
3746
+ const { description, useWhen, ...mcpFields } = serverConfig;
3747
+ mergedServers[serverName] = mcpFields;
3748
+ addedServers.push(serverName);
3749
+ }
3750
+ }
3751
+ const outputFile = { ...existingFile, [target.rootKey]: mergedServers };
3752
+ (0, import_fs3.writeFileSync)(mcpJsonPath, JSON.stringify(outputFile, null, 2), "utf-8");
3753
+ return { addedServers, skippedServers };
3754
+ }
3755
+ function buildMCPConfiguration(selectedItems, baseMcpServers2) {
3756
+ const config = {};
3757
+ for (const serverName of baseMcpServers2) {
3758
+ if (ALL_MCP_SERVERS[serverName]) {
3759
+ config[serverName] = ALL_MCP_SERVERS[serverName];
3760
+ }
3761
+ }
3762
+ for (const item of selectedItems) {
3763
+ for (const serverName of item.mcpServers) {
3764
+ if (ALL_MCP_SERVERS[serverName] && !config[serverName]) {
3765
+ config[serverName] = ALL_MCP_SERVERS[serverName];
3766
+ }
3767
+ }
3768
+ }
3769
+ return config;
3770
+ }
3771
+
3772
+ // src/utils/setup/setup-instructions.ts
3773
+ var import_fs4 = require("fs");
3774
+ var import_path4 = require("path");
3775
+ var CONTEXTS_DIR = (0, import_path4.join)(process.cwd(), "contexts");
3776
+ function stripFrontmatter(content) {
3777
+ const match = content.match(/^---\r?\n[\s\S]*?\r?\n---\r?\n*/);
3778
+ return match ? content.slice(match[0].length) : content;
3779
+ }
3780
+ function collectMarkdownFilesRecursive(dir, basePath, result) {
3781
+ const entries = (0, import_fs4.readdirSync)(dir, { withFileTypes: true });
3782
+ for (const entry of entries) {
3783
+ const fullPath = (0, import_path4.join)(dir, entry.name);
3784
+ const relPath = (0, import_path4.join)(basePath, entry.name);
3785
+ if (entry.isDirectory()) {
3786
+ collectMarkdownFilesRecursive(fullPath, relPath, result);
3787
+ } else if (entry.isFile() && entry.name.endsWith(".md")) {
3788
+ result.push({
3789
+ relativePath: relPath,
3790
+ content: stripFrontmatter((0, import_fs4.readFileSync)(fullPath, "utf-8")),
3791
+ priority: 1
3792
+ });
3793
+ }
3794
+ }
3795
+ }
3796
+ function collectInstructionFiles(domains) {
3797
+ const result = /* @__PURE__ */ new Map();
3798
+ for (const domain of domains) {
3799
+ const domainPath = (0, import_path4.join)(CONTEXTS_DIR, domain.toUpperCase());
3800
+ if (!(0, import_fs4.existsSync)(domainPath)) continue;
3801
+ const files = [];
3802
+ const instructionsMd = (0, import_path4.join)(domainPath, "core", "instructions.md");
3803
+ if ((0, import_fs4.existsSync)(instructionsMd)) {
3804
+ files.push({
3805
+ relativePath: "core/instructions.md",
3806
+ content: stripFrontmatter((0, import_fs4.readFileSync)(instructionsMd, "utf-8")),
3807
+ priority: 0
3808
+ });
3809
+ }
3810
+ const instructionsDir = (0, import_path4.join)(domainPath, "core", "instructions");
3811
+ if ((0, import_fs4.existsSync)(instructionsDir)) {
3812
+ collectMarkdownFilesRecursive(instructionsDir, "core/instructions", files);
3813
+ }
3814
+ files.sort((a, b) => a.priority - b.priority || a.relativePath.localeCompare(b.relativePath));
3815
+ if (files.length > 0) {
3816
+ result.set(domain, files);
3817
+ }
3818
+ }
3819
+ return result;
3820
+ }
3821
+ function buildMCPSection(mcpConfig) {
3822
+ const entries = Object.entries(mcpConfig);
3823
+ if (entries.length === 0) return "";
3824
+ const lines2 = [
3825
+ `## MCP Servers`,
3826
+ ``,
3827
+ `The following MCP servers are available. Use them proactively when relevant:`,
3828
+ ``
3829
+ ];
3830
+ for (const [name, config] of entries) {
3831
+ const description = config.description;
3832
+ const useWhen = config.useWhen;
3833
+ if (!description) continue;
3834
+ lines2.push(`### ${name}`);
3835
+ lines2.push(description);
3836
+ if (useWhen) {
3837
+ lines2.push(`**Use when**: ${useWhen}`);
3838
+ }
3839
+ lines2.push(``);
3840
+ }
3841
+ return lines2.join("\n");
3842
+ }
3843
+ function buildContextRefsSection(domains) {
3844
+ const lines2 = [
3845
+ `## Context References`,
3846
+ ``,
3847
+ `Domain-specific guidelines and reference material are available in the \`contexts/\` folder:`,
3848
+ ``
3849
+ ];
3850
+ for (const domain of domains) {
3851
+ const domainUpper = domain.toUpperCase();
3852
+ const domainPath = (0, import_path4.join)(CONTEXTS_DIR, domainUpper);
3853
+ if (!(0, import_fs4.existsSync)(domainPath)) continue;
3854
+ lines2.push(`### ${domainUpper}`);
3855
+ const instructionsMd = (0, import_path4.join)(domainPath, "core", "instructions.md");
3856
+ if ((0, import_fs4.existsSync)(instructionsMd)) {
3857
+ lines2.push(`- \`contexts/${domainUpper}/core/instructions.md\` \u2014 core development guidelines`);
3858
+ }
3859
+ const instructionsDir = (0, import_path4.join)(domainPath, "core", "instructions");
3860
+ if ((0, import_fs4.existsSync)(instructionsDir)) {
3861
+ lines2.push(`- \`contexts/${domainUpper}/core/instructions/\` \u2014 detailed topic-specific guidelines`);
3862
+ }
3863
+ const refDir = (0, import_path4.join)(domainPath, "reference");
3864
+ if ((0, import_fs4.existsSync)(refDir)) {
3865
+ lines2.push(`- \`contexts/${domainUpper}/reference/\` \u2014 cheat sheets and reference material`);
3866
+ }
3867
+ lines2.push(``);
3868
+ }
3869
+ lines2.push(`**ALWAYS** consult these files before implementing features or making architectural decisions.`);
3870
+ lines2.push(``);
3871
+ return lines2.join("\n");
3872
+ }
3873
+ function buildCombinedInstructions(domains, instructionFiles, mcpConfig) {
3874
+ const lines2 = [
3875
+ `# AI Development Instructions`,
3876
+ ``,
3877
+ `> Generated by One-Shot Installer`,
3878
+ ``
3879
+ ];
3880
+ lines2.push(buildContextRefsSection(domains));
3881
+ if (mcpConfig && Object.keys(mcpConfig).length > 0) {
3882
+ lines2.push(buildMCPSection(mcpConfig));
3883
+ }
3884
+ for (const domain of domains) {
3885
+ const files = instructionFiles.get(domain);
3886
+ if (!files || files.length === 0) continue;
3887
+ lines2.push(`## ${domain.toUpperCase()}`);
3888
+ lines2.push(``);
3889
+ for (const file of files) {
3890
+ lines2.push(file.content.trim());
3891
+ lines2.push(``);
3892
+ }
3893
+ }
3894
+ return lines2.join("\n");
3895
+ }
3896
+ async function setupInstructions(config) {
3897
+ const { domains, agent, mcpConfig } = config;
3898
+ const instructionFiles = collectInstructionFiles(domains);
3899
+ switch (agent) {
3900
+ case "claude-code": {
3901
+ const combinedContent = buildCombinedInstructions(domains, instructionFiles, mcpConfig);
3902
+ const claudeMdPath = (0, import_path4.join)(process.cwd(), "CLAUDE.md");
3903
+ (0, import_fs4.writeFileSync)(claudeMdPath, combinedContent, "utf-8");
3904
+ break;
3905
+ }
3906
+ case "github-copilot": {
3907
+ const instructionsDir = (0, import_path4.join)(process.cwd(), ".github", "instructions");
3908
+ if (!(0, import_fs4.existsSync)(instructionsDir)) (0, import_fs4.mkdirSync)(instructionsDir, { recursive: true });
3909
+ const combinedBody = buildCombinedInstructions(domains, instructionFiles, mcpConfig);
3910
+ const withFrontmatter = `---
3911
+ applyTo: "**"
3912
+ ---
3913
+
3914
+ ${combinedBody}`;
3915
+ const filePath = (0, import_path4.join)(instructionsDir, `instructions.instructions.md`);
3916
+ (0, import_fs4.writeFileSync)(filePath, withFrontmatter, "utf-8");
3917
+ break;
3918
+ }
3919
+ case "cursor": {
3920
+ const cursorDir = (0, import_path4.join)(process.cwd(), ".cursor", "rules");
3921
+ if (!(0, import_fs4.existsSync)(cursorDir)) (0, import_fs4.mkdirSync)(cursorDir, { recursive: true });
3922
+ const combinedBody = buildCombinedInstructions(domains, instructionFiles, mcpConfig);
3923
+ const rulesPath = (0, import_path4.join)(cursorDir, `instructions.mdc`);
3924
+ (0, import_fs4.writeFileSync)(rulesPath, combinedBody, "utf-8");
3925
+ break;
3926
+ }
3927
+ default:
3928
+ break;
3929
+ }
3930
+ }
3931
+
3932
+ // src/utils/mod.ts
3933
+ var personas = personas_default.personas;
3934
+ var baseMcpServers = personas_default.baseMcpServers;
3935
+ var agents = agents_default.agents;
3936
+
3937
+ // src/index.ts
3938
+ function getInstructionFilePath(agent) {
3939
+ switch (agent) {
3940
+ case "claude-code":
3941
+ return "CLAUDE.md";
3942
+ case "github-copilot":
3943
+ return ".github/instructions/instructions.instructions.md";
3944
+ case "cursor":
3945
+ return ".cursor/rules/instructions.mdc";
3946
+ default:
3947
+ return "CLAUDE.md";
3948
+ }
3949
+ }
3950
+ function getMCPConfigPath(agent) {
3951
+ switch (agent) {
3952
+ case "claude-code":
3953
+ return "mcp.json";
3954
+ case "cursor":
3955
+ return ".cursor/mcp.json";
3956
+ case "github-copilot":
3957
+ default:
3958
+ return ".vscode/mcp.json";
3959
+ }
3960
+ }
3961
+ function formatMCPCommand(server) {
3962
+ if (server.url) return server.url;
3963
+ if (server.command) return `${server.command} ${(server.args ?? []).join(" ")}`.trimEnd();
3964
+ return "";
3965
+ }
3966
+ function waitForEnter() {
3967
+ const rl = (0, import_readline.createInterface)({ input: process.stdin, output: process.stdout });
3968
+ return new Promise((resolve3) => {
3969
+ rl.question(" Press Enter to close...", () => {
3970
+ rl.close();
3971
+ resolve3();
3972
+ });
3973
+ });
3974
+ }
3975
+ async function main() {
3976
+ console.clear();
3977
+ console.log("One-Shot Setup Installer\n");
3978
+ try {
3979
+ const config = await collectInputs();
3980
+ if (!config) {
3981
+ await waitForEnter();
3982
+ return;
3983
+ }
3984
+ const proceed = await previewAndConfirm(config);
3985
+ if (!proceed) {
3986
+ console.log("\nNo changes made.");
3987
+ await waitForEnter();
3988
+ return;
3989
+ }
3990
+ const result = await execute(config);
3991
+ printSummary(result);
3992
+ } catch (error) {
3993
+ console.error("\n[ERROR]", error instanceof Error ? error.message : String(error));
3994
+ }
3995
+ await waitForEnter();
3996
+ }
3997
+ async function collectInputs() {
3998
+ const selectedIds = await esm_default2({
3999
+ message: "Personas:",
4000
+ choices: personas.map((p) => ({
4001
+ name: p.name.replace(/ Developer$/, ""),
4002
+ value: p.id
4003
+ })),
4004
+ required: false
4005
+ });
4006
+ if (selectedIds.length === 0) {
4007
+ console.log("\nNo personas selected. Exiting.");
4008
+ return null;
4009
+ }
4010
+ const selectedPersonas = personas.filter((p) => selectedIds.includes(p.id));
4011
+ const agent = await esm_default5({
4012
+ message: "AI coding tool:",
4013
+ choices: agents
4014
+ });
4015
+ const mcpConfig = buildMCPConfiguration(selectedPersonas, baseMcpServers);
4016
+ let azureDevOpsOrg = "";
4017
+ if (mcpConfig["azure-devops"]) {
4018
+ const org = await esm_default4({
4019
+ message: "Azure DevOps org (leave empty to skip):"
4020
+ });
4021
+ azureDevOpsOrg = org.trim();
4022
+ if (azureDevOpsOrg === "") {
4023
+ delete mcpConfig["azure-devops"];
4024
+ } else {
4025
+ mcpConfig["azure-devops"].args = mcpConfig["azure-devops"].args?.map(
4026
+ (arg) => arg === "__AZURE_ORG__" ? azureDevOpsOrg : arg
4027
+ );
4028
+ }
4029
+ }
4030
+ const projectInput = await esm_default4({
4031
+ message: "Project directory:",
4032
+ default: (0, import_path5.resolve)(process.cwd())
4033
+ });
4034
+ return {
4035
+ personas: selectedPersonas,
4036
+ agent,
4037
+ azureDevOpsOrg,
4038
+ projectPath: (0, import_path5.resolve)(projectInput),
4039
+ mcpConfig
4040
+ };
4041
+ }
4042
+ async function previewAndConfirm(config) {
4043
+ const personaNames = config.personas.map((p) => p.name.replace(/ Developer$/, "")).join(", ");
4044
+ const agentDisplay = agents.find((a) => a.value === config.agent)?.name ?? config.agent;
4045
+ const instructionFile = getInstructionFilePath(config.agent);
4046
+ const mcpConfigFile = getMCPConfigPath(config.agent);
4047
+ const serverEntries = Object.entries(config.mcpConfig);
4048
+ console.log("\n" + "\u2500".repeat(48));
4049
+ console.log(" Ready to install");
4050
+ console.log("\u2500".repeat(48) + "\n");
4051
+ console.log(` Personas ${personaNames}`);
4052
+ console.log(` Tool ${agentDisplay}`);
4053
+ console.log(` Directory ${config.projectPath}`);
4054
+ console.log("");
4055
+ console.log(` Instruction file`);
4056
+ console.log(` ${instructionFile}`);
4057
+ console.log("");
4058
+ console.log(` MCP config`);
4059
+ console.log(` ${mcpConfigFile}`);
4060
+ if (serverEntries.length > 0) {
4061
+ console.log("");
4062
+ console.log(" MCP servers");
4063
+ const maxLen = Math.max(...serverEntries.map(([name]) => name.length));
4064
+ for (const [name, server] of serverEntries) {
4065
+ const cmd = formatMCPCommand(server);
4066
+ console.log(` ${name.padEnd(maxLen + 2)}${cmd}`);
4067
+ }
4068
+ }
4069
+ console.log("\n" + "\u2500".repeat(48));
4070
+ return esm_default3({ message: "Proceed?", default: true });
4071
+ }
4072
+ async function execute(config) {
4073
+ const instructionFilePath = getInstructionFilePath(config.agent);
4074
+ const mcpConfigPath = getMCPConfigPath(config.agent);
4075
+ const result = {
4076
+ success: false,
4077
+ domainsInstalled: [],
4078
+ domainsFailed: [],
4079
+ failureReasons: {},
4080
+ instructionsCreated: false,
4081
+ instructionFilePath,
4082
+ mcpConfigured: false,
4083
+ mcpConfigPath,
4084
+ mcpServersAdded: []
4085
+ };
4086
+ console.log("");
4087
+ const uniqueDomains = [...new Set(config.personas.flatMap((p) => p.domains))];
4088
+ const domainValues = uniqueDomains.map((d) => d.toLowerCase());
4089
+ console.log(` Downloading contexts...`);
4090
+ try {
4091
+ const downloadResult = await fetchContexts({ domains: domainValues });
4092
+ result.domainsInstalled = downloadResult.successful;
4093
+ result.domainsFailed = downloadResult.failed;
4094
+ result.failureReasons = downloadResult.failureReasons;
4095
+ } catch (error) {
4096
+ result.domainsFailed = domainValues;
4097
+ const reason = error instanceof Error ? error.message : String(error);
4098
+ for (const d of domainValues) result.failureReasons[d] = reason;
4099
+ }
4100
+ const domainColWidth = Math.max(...domainValues.map((d) => d.length), 8) + 2;
4101
+ for (const domain of domainValues) {
4102
+ const ok = result.domainsInstalled.includes(domain);
4103
+ const reason = result.failureReasons[domain];
4104
+ const status = ok ? "\u2713" : `\u2717 ${reason ?? "Unknown error"}`;
4105
+ console.log(` ${domain.padEnd(domainColWidth)}${status}`);
4106
+ }
4107
+ console.log("");
4108
+ if (result.domainsInstalled.length === 0) {
4109
+ result.success = false;
4110
+ return result;
4111
+ }
4112
+ process.stdout.write(` Writing ${instructionFilePath}... `);
4113
+ try {
4114
+ await setupInstructions({
4115
+ domains: result.domainsInstalled,
4116
+ agent: config.agent,
4117
+ mcpConfig: config.mcpConfig
4118
+ });
4119
+ result.instructionsCreated = true;
4120
+ console.log("\u2713");
4121
+ } catch (error) {
4122
+ console.log("\u2717");
4123
+ console.log(` Error: ${error instanceof Error ? error.message : String(error)}`);
4124
+ console.log(` Path: ${instructionFilePath}`);
4125
+ }
4126
+ process.stdout.write(` Writing ${mcpConfigPath}... `);
4127
+ try {
4128
+ const mcpResult = await setupMCPConfiguration(
4129
+ config.projectPath,
4130
+ config.mcpConfig,
4131
+ config.agent
4132
+ );
4133
+ result.mcpConfigured = true;
4134
+ result.mcpServersAdded = mcpResult.addedServers;
4135
+ console.log("\u2713");
4136
+ } catch (error) {
4137
+ console.log("\u2717");
4138
+ console.log(` Error: ${error instanceof Error ? error.message : String(error)}`);
4139
+ console.log(` Path: ${mcpConfigPath}`);
4140
+ }
4141
+ result.success = result.domainsFailed.length === 0 && result.instructionsCreated && result.mcpConfigured;
4142
+ const state = {
4143
+ installedAt: (/* @__PURE__ */ new Date()).toISOString(),
4144
+ agent: config.agent,
4145
+ personas: config.personas.map((p) => p.id),
4146
+ domains: result.domainsInstalled,
4147
+ mcpServers: Object.keys(config.mcpConfig),
4148
+ files: {
4149
+ instructions: instructionFilePath,
4150
+ mcpConfig: mcpConfigPath,
4151
+ contexts: "contexts/"
4152
+ }
4153
+ };
4154
+ try {
4155
+ (0, import_fs5.writeFileSync)((0, import_path5.join)(config.projectPath, ".one-shot-state.json"), JSON.stringify(state, null, 2), "utf-8");
4156
+ } catch {
4157
+ }
4158
+ return result;
4159
+ }
4160
+ function printSummary(result) {
4161
+ const hasErrors = !result.success;
4162
+ console.log("\u2500".repeat(48));
4163
+ console.log(hasErrors ? " Done (with errors).\n" : " Done.\n");
4164
+ if (result.domainsInstalled.length > 0) {
4165
+ console.log(` contexts/ ${result.domainsInstalled.join(", ")}`);
4166
+ }
4167
+ if (result.instructionsCreated) {
4168
+ console.log(` ${result.instructionFilePath} written`);
4169
+ }
4170
+ if (result.mcpConfigured) {
4171
+ const serverList = result.mcpServersAdded.length > 0 ? ` (${result.mcpServersAdded.join(", ")})` : "";
4172
+ console.log(` ${result.mcpConfigPath} written${serverList}`);
4173
+ }
4174
+ if (hasErrors) {
4175
+ console.log("\n What went wrong:");
4176
+ if (result.domainsFailed.length > 0) {
4177
+ console.log("");
4178
+ console.log(" Context downloads failed:");
4179
+ for (const domain of result.domainsFailed) {
4180
+ const reason = result.failureReasons[domain];
4181
+ console.log(` ${domain} \u2014 ${reason ?? "Unknown error"}`);
4182
+ }
4183
+ }
4184
+ if (!result.instructionsCreated) {
4185
+ console.log("");
4186
+ console.log(` Instruction file not written: ${result.instructionFilePath}`);
4187
+ }
4188
+ if (!result.mcpConfigured) {
4189
+ console.log("");
4190
+ console.log(` MCP config not written: ${result.mcpConfigPath}`);
4191
+ }
4192
+ console.log("\n Troubleshooting:");
4193
+ if (result.domainsFailed.length > 0) {
4194
+ console.log(" - Re-authenticate: delete ~/.one-shot-installer/github-token.json");
4195
+ console.log(" - Check network connectivity");
4196
+ console.log(" - Confirm your GitHub account has access to the repository");
4197
+ }
4198
+ if (!result.instructionsCreated || !result.mcpConfigured) {
4199
+ console.log(" - Check write permissions for the project directory");
4200
+ console.log(` - Project directory: ${result.instructionFilePath.includes("/") ? "check parent folders exist" : "current directory"}`);
4201
+ }
4202
+ }
4203
+ console.log("\n" + "\u2500".repeat(48) + "\n");
4204
+ }
4205
+ main().catch((error) => {
4206
+ console.error("\n[ERROR]", error instanceof Error ? error.message : String(error));
4207
+ process.exit(1);
4208
+ });