oauth-init 0.17.0 → 1.0.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 (2) hide show
  1. package/dist/index.js +2175 -1579
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -31,6 +31,20 @@ var __toESM = (mod, isNodeMode, target) => {
31
31
  return to;
32
32
  };
33
33
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
34
+ var __returnValue = (v) => v;
35
+ function __exportSetter(name, newValue) {
36
+ this[name] = __returnValue.bind(null, newValue);
37
+ }
38
+ var __export = (target, all) => {
39
+ for (var name in all)
40
+ __defProp(target, name, {
41
+ get: all[name],
42
+ enumerable: true,
43
+ configurable: true,
44
+ set: __exportSetter.bind(all, name)
45
+ });
46
+ };
47
+ var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
34
48
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
35
49
 
36
50
  // node_modules/picocolors/picocolors.js
@@ -161,1693 +175,2109 @@ var require_src = __commonJS((exports, module) => {
161
175
  module.exports = { cursor, scroll, erase, beep };
162
176
  });
163
177
 
164
- // node_modules/isexe/windows.js
165
- var require_windows = __commonJS((exports, module) => {
166
- module.exports = isexe;
167
- isexe.sync = sync;
168
- var fs = __require("fs");
169
- function checkPathExt(path, options) {
170
- var pathext = options.pathExt !== undefined ? options.pathExt : process.env.PATHEXT;
171
- if (!pathext) {
172
- return true;
173
- }
174
- pathext = pathext.split(";");
175
- if (pathext.indexOf("") !== -1) {
176
- return true;
177
- }
178
- for (var i = 0;i < pathext.length; i++) {
179
- var p = pathext[i].toLowerCase();
180
- if (p && path.substr(-p.length).toLowerCase() === p) {
181
- return true;
182
- }
178
+ // node_modules/@clack/core/dist/index.mjs
179
+ import { stdout as R, stdin as q } from "node:process";
180
+ import * as k from "node:readline";
181
+ import ot from "node:readline";
182
+ import { ReadStream as J } from "node:tty";
183
+ function B(t, e, s) {
184
+ if (!s.some((u) => !u.disabled))
185
+ return t;
186
+ const i = t + e, r = Math.max(s.length - 1, 0), n = i < 0 ? r : i > r ? 0 : i;
187
+ return s[n].disabled ? B(n, e < 0 ? -1 : 1, s) : n;
188
+ }
189
+ function K(t, e, s) {
190
+ return String(t).normalize().replaceAll(`\r
191
+ `, `
192
+ `).split(`
193
+ `).map((i) => Et(i, e, s)).join(`
194
+ `);
195
+ }
196
+ function It(t) {
197
+ if (t.aliases !== undefined) {
198
+ const e = t.aliases;
199
+ for (const s in e) {
200
+ if (!Object.hasOwn(e, s))
201
+ continue;
202
+ const i = e[s];
203
+ _.actions.has(i) && (_.aliases.has(s) || _.aliases.set(s, i));
183
204
  }
184
- return false;
185
205
  }
186
- function checkStat(stat, path, options) {
187
- if (!stat.isSymbolicLink() && !stat.isFile()) {
188
- return false;
189
- }
190
- return checkPathExt(path, options);
206
+ if (t.messages !== undefined) {
207
+ const e = t.messages;
208
+ e.cancel !== undefined && (_.messages.cancel = e.cancel), e.error !== undefined && (_.messages.error = e.error);
191
209
  }
192
- function isexe(path, options, cb) {
193
- fs.stat(path, function(er, stat) {
194
- cb(er, er ? false : checkStat(stat, path, options));
210
+ t.withGuide !== undefined && (_.withGuide = t.withGuide !== false);
211
+ }
212
+ function H(t, e) {
213
+ if (typeof t == "string")
214
+ return _.aliases.get(t) === e;
215
+ for (const s of t)
216
+ if (s !== undefined && H(s, e))
217
+ return true;
218
+ return false;
219
+ }
220
+ function _t(t, e) {
221
+ if (t === e)
222
+ return;
223
+ const s = t.split(`
224
+ `), i = e.split(`
225
+ `), r = Math.max(s.length, i.length), n = [];
226
+ for (let u = 0;u < r; u++)
227
+ s[u] !== i[u] && n.push(u);
228
+ return { lines: n, numLinesBefore: s.length, numLinesAfter: i.length, numLines: r };
229
+ }
230
+ function Ct(t) {
231
+ return t === z;
232
+ }
233
+ function T(t, e) {
234
+ const s = t;
235
+ s.isTTY && s.setRawMode(e);
236
+ }
237
+ function Bt({ input: t = q, output: e = R, overwrite: s = true, hideCursor: i = true } = {}) {
238
+ const r = k.createInterface({ input: t, output: e, prompt: "", tabSize: 1 });
239
+ k.emitKeypressEvents(t, r), t instanceof J && t.isTTY && t.setRawMode(true);
240
+ const n = (u, { name: a, sequence: l }) => {
241
+ const E = String(u);
242
+ if (H([E, a, l], "cancel")) {
243
+ i && e.write(import_sisteransi.cursor.show), process.exit(0);
244
+ return;
245
+ }
246
+ if (!s)
247
+ return;
248
+ const g = a === "return" ? 0 : -1, m = a === "return" ? -1 : 0;
249
+ k.moveCursor(e, g, m, () => {
250
+ k.clearLine(e, 1, () => {
251
+ t.once("keypress", n);
252
+ });
195
253
  });
196
- }
197
- function sync(path, options) {
198
- return checkStat(fs.statSync(path), path, options);
199
- }
200
- });
254
+ };
255
+ return i && e.write(import_sisteransi.cursor.hide), t.once("keypress", n), () => {
256
+ t.off("keypress", n), i && e.write(import_sisteransi.cursor.show), t instanceof J && t.isTTY && !bt && t.setRawMode(false), r.terminal = false, r.close();
257
+ };
258
+ }
259
+ function xt(t, e, s, i = s) {
260
+ const r = rt(t ?? R);
261
+ return K(e, r - s.length, { hard: true, trim: false }).split(`
262
+ `).map((n, u) => `${u === 0 ? i : s}${n}`).join(`
263
+ `);
264
+ }
201
265
 
202
- // node_modules/isexe/mode.js
203
- var require_mode = __commonJS((exports, module) => {
204
- module.exports = isexe;
205
- isexe.sync = sync;
206
- var fs = __require("fs");
207
- function isexe(path, options, cb) {
208
- fs.stat(path, function(er, stat) {
209
- cb(er, er ? false : checkStat(stat, options));
210
- });
266
+ class x {
267
+ input;
268
+ output;
269
+ _abortSignal;
270
+ rl;
271
+ opts;
272
+ _render;
273
+ _track = false;
274
+ _prevFrame = "";
275
+ _subscribers = new Map;
276
+ _cursor = 0;
277
+ state = "initial";
278
+ error = "";
279
+ value;
280
+ userInput = "";
281
+ constructor(e, s = true) {
282
+ const { input: i = q, output: r = R, render: n, signal: u, ...a } = e;
283
+ this.opts = a, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = n.bind(this), this._track = s, this._abortSignal = u, this.input = i, this.output = r;
211
284
  }
212
- function sync(path, options) {
213
- return checkStat(fs.statSync(path), options);
285
+ unsubscribe() {
286
+ this._subscribers.clear();
214
287
  }
215
- function checkStat(stat, options) {
216
- return stat.isFile() && checkMode(stat, options);
288
+ setSubscriber(e, s) {
289
+ const i = this._subscribers.get(e) ?? [];
290
+ i.push(s), this._subscribers.set(e, i);
217
291
  }
218
- function checkMode(stat, options) {
219
- var mod = stat.mode;
220
- var uid = stat.uid;
221
- var gid = stat.gid;
222
- var myUid = options.uid !== undefined ? options.uid : process.getuid && process.getuid();
223
- var myGid = options.gid !== undefined ? options.gid : process.getgid && process.getgid();
224
- var u = parseInt("100", 8);
225
- var g = parseInt("010", 8);
226
- var o = parseInt("001", 8);
227
- var ug = u | g;
228
- var ret = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
229
- return ret;
292
+ on(e, s) {
293
+ this.setSubscriber(e, { cb: s });
230
294
  }
231
- });
232
-
233
- // node_modules/isexe/index.js
234
- var require_isexe = __commonJS((exports, module) => {
235
- var fs = __require("fs");
236
- var core;
237
- if (process.platform === "win32" || global.TESTING_WINDOWS) {
238
- core = require_windows();
239
- } else {
240
- core = require_mode();
295
+ once(e, s) {
296
+ this.setSubscriber(e, { cb: s, once: true });
241
297
  }
242
- module.exports = isexe;
243
- isexe.sync = sync;
244
- function isexe(path, options, cb) {
245
- if (typeof options === "function") {
246
- cb = options;
247
- options = {};
248
- }
249
- if (!cb) {
250
- if (typeof Promise !== "function") {
251
- throw new TypeError("callback not provided");
298
+ emit(e, ...s) {
299
+ const i = this._subscribers.get(e) ?? [], r = [];
300
+ for (const n of i)
301
+ n.cb(...s), n.once && r.push(() => i.splice(i.indexOf(n), 1));
302
+ for (const n of r)
303
+ n();
304
+ }
305
+ prompt() {
306
+ return new Promise((e) => {
307
+ if (this._abortSignal) {
308
+ if (this._abortSignal.aborted)
309
+ return this.state = "cancel", this.close(), e(z);
310
+ this._abortSignal.addEventListener("abort", () => {
311
+ this.state = "cancel", this.close();
312
+ }, { once: true });
252
313
  }
253
- return new Promise(function(resolve, reject) {
254
- isexe(path, options || {}, function(er, is) {
255
- if (er) {
256
- reject(er);
257
- } else {
258
- resolve(is);
259
- }
260
- });
314
+ this.rl = ot.createInterface({ input: this.input, tabSize: 2, prompt: "", escapeCodeTimeout: 50, terminal: true }), this.rl.prompt(), this.opts.initialUserInput !== undefined && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), T(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
315
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), T(this.input, false), e(this.value);
316
+ }), this.once("cancel", () => {
317
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), T(this.input, false), e(z);
261
318
  });
262
- }
263
- core(path, options || {}, function(er, is) {
264
- if (er) {
265
- if (er.code === "EACCES" || options && options.ignoreErrors) {
266
- er = null;
267
- is = false;
268
- }
269
- }
270
- cb(er, is);
271
319
  });
272
320
  }
273
- function sync(path, options) {
274
- try {
275
- return core.sync(path, options || {});
276
- } catch (er) {
277
- if (options && options.ignoreErrors || er.code === "EACCES") {
278
- return false;
279
- } else {
280
- throw er;
321
+ _isActionKey(e, s) {
322
+ return e === "\t";
323
+ }
324
+ _setValue(e) {
325
+ this.value = e, this.emit("value", this.value);
326
+ }
327
+ _setUserInput(e, s) {
328
+ this.userInput = e ?? "", this.emit("userInput", this.userInput), s && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
329
+ }
330
+ _clearUserInput() {
331
+ this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
332
+ }
333
+ onKeypress(e, s) {
334
+ if (this._track && s.name !== "return" && (s.name && this._isActionKey(e, s) && this.rl?.write(null, { ctrl: true, name: "h" }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), s?.name && (!this._track && _.aliases.has(s.name) && this.emit("cursor", _.aliases.get(s.name)), _.actions.has(s.name) && this.emit("cursor", s.name)), e && (e.toLowerCase() === "y" || e.toLowerCase() === "n") && this.emit("confirm", e.toLowerCase() === "y"), this.emit("key", e?.toLowerCase(), s), s?.name === "return") {
335
+ if (this.opts.validate) {
336
+ const i = this.opts.validate(this.value);
337
+ i && (this.error = i instanceof Error ? i.message : i, this.state = "error", this.rl?.write(this.userInput));
281
338
  }
339
+ this.state !== "error" && (this.state = "submit");
282
340
  }
341
+ H([e, s?.name, s?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
283
342
  }
284
- });
285
-
286
- // node_modules/which/which.js
287
- var require_which = __commonJS((exports, module) => {
288
- var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
289
- var path = __require("path");
290
- var COLON = isWindows ? ";" : ":";
291
- var isexe = require_isexe();
292
- var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
293
- var getPathInfo = (cmd, opt) => {
294
- const colon = opt.colon || COLON;
295
- const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [
296
- ...isWindows ? [process.cwd()] : [],
297
- ...(opt.path || process.env.PATH || "").split(colon)
298
- ];
299
- const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
300
- const pathExt = isWindows ? pathExtExe.split(colon) : [""];
301
- if (isWindows) {
302
- if (cmd.indexOf(".") !== -1 && pathExt[0] !== "")
303
- pathExt.unshift("");
304
- }
305
- return {
306
- pathEnv,
307
- pathExt,
308
- pathExtExe
309
- };
310
- };
311
- var which = (cmd, opt, cb) => {
312
- if (typeof opt === "function") {
313
- cb = opt;
314
- opt = {};
315
- }
316
- if (!opt)
317
- opt = {};
318
- const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
319
- const found = [];
320
- const step = (i) => new Promise((resolve, reject) => {
321
- if (i === pathEnv.length)
322
- return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
323
- const ppRaw = pathEnv[i];
324
- const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
325
- const pCmd = path.join(pathPart, cmd);
326
- const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
327
- resolve(subStep(p, i, 0));
328
- });
329
- const subStep = (p, i, ii) => new Promise((resolve, reject) => {
330
- if (ii === pathExt.length)
331
- return resolve(step(i + 1));
332
- const ext = pathExt[ii];
333
- isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
334
- if (!er && is) {
335
- if (opt.all)
336
- found.push(p + ext);
337
- else
338
- return resolve(p + ext);
343
+ close() {
344
+ this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
345
+ `), T(this.input, false), this.rl?.close(), this.rl = undefined, this.emit(`${this.state}`, this.value), this.unsubscribe();
346
+ }
347
+ restoreCursor() {
348
+ const e = K(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
349
+ `).length - 1;
350
+ this.output.write(import_sisteransi.cursor.move(-999, e * -1));
351
+ }
352
+ render() {
353
+ const e = K(this._render(this) ?? "", process.stdout.columns, { hard: true, trim: false });
354
+ if (e !== this._prevFrame) {
355
+ if (this.state === "initial")
356
+ this.output.write(import_sisteransi.cursor.hide);
357
+ else {
358
+ const s = _t(this._prevFrame, e), i = nt(this.output);
359
+ if (this.restoreCursor(), s) {
360
+ const r = Math.max(0, s.numLinesAfter - i), n = Math.max(0, s.numLinesBefore - i);
361
+ let u = s.lines.find((a) => a >= r);
362
+ if (u === undefined) {
363
+ this._prevFrame = e;
364
+ return;
365
+ }
366
+ if (s.lines.length === 1) {
367
+ this.output.write(import_sisteransi.cursor.move(0, u - n)), this.output.write(import_sisteransi.erase.lines(1));
368
+ const a = e.split(`
369
+ `);
370
+ this.output.write(a[u]), this._prevFrame = e, this.output.write(import_sisteransi.cursor.move(0, a.length - u - 1));
371
+ return;
372
+ } else if (s.lines.length > 1) {
373
+ if (r < n)
374
+ u = r;
375
+ else {
376
+ const l = u - n;
377
+ l > 0 && this.output.write(import_sisteransi.cursor.move(0, l));
378
+ }
379
+ this.output.write(import_sisteransi.erase.down());
380
+ const a = e.split(`
381
+ `).slice(u);
382
+ this.output.write(a.join(`
383
+ `)), this._prevFrame = e;
384
+ return;
385
+ }
339
386
  }
340
- return resolve(subStep(p, i, ii + 1));
341
- });
342
- });
343
- return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
344
- };
345
- var whichSync = (cmd, opt) => {
346
- opt = opt || {};
347
- const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
348
- const found = [];
349
- for (let i = 0;i < pathEnv.length; i++) {
350
- const ppRaw = pathEnv[i];
351
- const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
352
- const pCmd = path.join(pathPart, cmd);
353
- const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
354
- for (let j2 = 0;j2 < pathExt.length; j2++) {
355
- const cur = p + pathExt[j2];
356
- try {
357
- const is = isexe.sync(cur, { pathExt: pathExtExe });
358
- if (is) {
359
- if (opt.all)
360
- found.push(cur);
361
- else
362
- return cur;
387
+ this.output.write(import_sisteransi.erase.down());
388
+ }
389
+ this.output.write(e), this.state === "initial" && (this.state = "active"), this._prevFrame = e;
390
+ }
391
+ }
392
+ }
393
+ function wt(t, e) {
394
+ if (t === undefined || e.length === 0)
395
+ return 0;
396
+ const s = e.findIndex((i) => i.value === t);
397
+ return s !== -1 ? s : 0;
398
+ }
399
+ function Dt(t, e) {
400
+ return (e.label ?? String(e.value)).toLowerCase().includes(t.toLowerCase());
401
+ }
402
+ function St(t, e) {
403
+ if (e)
404
+ return t ? e : e[0];
405
+ }
406
+ var import_picocolors, import_sisteransi, at = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 170 || t === 173 || t === 174 || t >= 176 && t <= 180 || t >= 182 && t <= 186 || t >= 188 && t <= 191 || t === 198 || t === 208 || t === 215 || t === 216 || t >= 222 && t <= 225 || t === 230 || t >= 232 && t <= 234 || t === 236 || t === 237 || t === 240 || t === 242 || t === 243 || t >= 247 && t <= 250 || t === 252 || t === 254 || t === 257 || t === 273 || t === 275 || t === 283 || t === 294 || t === 295 || t === 299 || t >= 305 && t <= 307 || t === 312 || t >= 319 && t <= 322 || t === 324 || t >= 328 && t <= 331 || t === 333 || t === 338 || t === 339 || t === 358 || t === 359 || t === 363 || t === 462 || t === 464 || t === 466 || t === 468 || t === 470 || t === 472 || t === 474 || t === 476 || t === 593 || t === 609 || t === 708 || t === 711 || t >= 713 && t <= 715 || t === 717 || t === 720 || t >= 728 && t <= 731 || t === 733 || t === 735 || t >= 768 && t <= 879 || t >= 913 && t <= 929 || t >= 931 && t <= 937 || t >= 945 && t <= 961 || t >= 963 && t <= 969 || t === 1025 || t >= 1040 && t <= 1103 || t === 1105 || t === 8208 || t >= 8211 && t <= 8214 || t === 8216 || t === 8217 || t === 8220 || t === 8221 || t >= 8224 && t <= 8226 || t >= 8228 && t <= 8231 || t === 8240 || t === 8242 || t === 8243 || t === 8245 || t === 8251 || t === 8254 || t === 8308 || t === 8319 || t >= 8321 && t <= 8324 || t === 8364 || t === 8451 || t === 8453 || t === 8457 || t === 8467 || t === 8470 || t === 8481 || t === 8482 || t === 8486 || t === 8491 || t === 8531 || t === 8532 || t >= 8539 && t <= 8542 || t >= 8544 && t <= 8555 || t >= 8560 && t <= 8569 || t === 8585 || t >= 8592 && t <= 8601 || t === 8632 || t === 8633 || t === 8658 || t === 8660 || t === 8679 || t === 8704 || t === 8706 || t === 8707 || t === 8711 || t === 8712 || t === 8715 || t === 8719 || t === 8721 || t === 8725 || t === 8730 || t >= 8733 && t <= 8736 || t === 8739 || t === 8741 || t >= 8743 && t <= 8748 || t === 8750 || t >= 8756 && t <= 8759 || t === 8764 || t === 8765 || t === 8776 || t === 8780 || t === 8786 || t === 8800 || t === 8801 || t >= 8804 && t <= 8807 || t === 8810 || t === 8811 || t === 8814 || t === 8815 || t === 8834 || t === 8835 || t === 8838 || t === 8839 || t === 8853 || t === 8857 || t === 8869 || t === 8895 || t === 8978 || t >= 9312 && t <= 9449 || t >= 9451 && t <= 9547 || t >= 9552 && t <= 9587 || t >= 9600 && t <= 9615 || t >= 9618 && t <= 9621 || t === 9632 || t === 9633 || t >= 9635 && t <= 9641 || t === 9650 || t === 9651 || t === 9654 || t === 9655 || t === 9660 || t === 9661 || t === 9664 || t === 9665 || t >= 9670 && t <= 9672 || t === 9675 || t >= 9678 && t <= 9681 || t >= 9698 && t <= 9701 || t === 9711 || t === 9733 || t === 9734 || t === 9737 || t === 9742 || t === 9743 || t === 9756 || t === 9758 || t === 9792 || t === 9794 || t === 9824 || t === 9825 || t >= 9827 && t <= 9829 || t >= 9831 && t <= 9834 || t === 9836 || t === 9837 || t === 9839 || t === 9886 || t === 9887 || t === 9919 || t >= 9926 && t <= 9933 || t >= 9935 && t <= 9939 || t >= 9941 && t <= 9953 || t === 9955 || t === 9960 || t === 9961 || t >= 9963 && t <= 9969 || t === 9972 || t >= 9974 && t <= 9977 || t === 9979 || t === 9980 || t === 9982 || t === 9983 || t === 10045 || t >= 10102 && t <= 10111 || t >= 11094 && t <= 11097 || t >= 12872 && t <= 12879 || t >= 57344 && t <= 63743 || t >= 65024 && t <= 65039 || t === 65533 || t >= 127232 && t <= 127242 || t >= 127248 && t <= 127277 || t >= 127280 && t <= 127337 || t >= 127344 && t <= 127373 || t === 127375 || t === 127376 || t >= 127387 && t <= 127404 || t >= 917760 && t <= 917999 || t >= 983040 && t <= 1048573 || t >= 1048576 && t <= 1114109, lt = (t) => t === 12288 || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510, ht = (t) => t >= 4352 && t <= 4447 || t === 8986 || t === 8987 || t === 9001 || t === 9002 || t >= 9193 && t <= 9196 || t === 9200 || t === 9203 || t === 9725 || t === 9726 || t === 9748 || t === 9749 || t >= 9800 && t <= 9811 || t === 9855 || t === 9875 || t === 9889 || t === 9898 || t === 9899 || t === 9917 || t === 9918 || t === 9924 || t === 9925 || t === 9934 || t === 9940 || t === 9962 || t === 9970 || t === 9971 || t === 9973 || t === 9978 || t === 9981 || t === 9989 || t === 9994 || t === 9995 || t === 10024 || t === 10060 || t === 10062 || t >= 10067 && t <= 10069 || t === 10071 || t >= 10133 && t <= 10135 || t === 10160 || t === 10175 || t === 11035 || t === 11036 || t === 11088 || t === 11093 || t >= 11904 && t <= 11929 || t >= 11931 && t <= 12019 || t >= 12032 && t <= 12245 || t >= 12272 && t <= 12287 || t >= 12289 && t <= 12350 || t >= 12353 && t <= 12438 || t >= 12441 && t <= 12543 || t >= 12549 && t <= 12591 || t >= 12593 && t <= 12686 || t >= 12688 && t <= 12771 || t >= 12783 && t <= 12830 || t >= 12832 && t <= 12871 || t >= 12880 && t <= 19903 || t >= 19968 && t <= 42124 || t >= 42128 && t <= 42182 || t >= 43360 && t <= 43388 || t >= 44032 && t <= 55203 || t >= 63744 && t <= 64255 || t >= 65040 && t <= 65049 || t >= 65072 && t <= 65106 || t >= 65108 && t <= 65126 || t >= 65128 && t <= 65131 || t >= 94176 && t <= 94180 || t === 94192 || t === 94193 || t >= 94208 && t <= 100343 || t >= 100352 && t <= 101589 || t >= 101632 && t <= 101640 || t >= 110576 && t <= 110579 || t >= 110581 && t <= 110587 || t === 110589 || t === 110590 || t >= 110592 && t <= 110882 || t === 110898 || t >= 110928 && t <= 110930 || t === 110933 || t >= 110948 && t <= 110951 || t >= 110960 && t <= 111355 || t === 126980 || t === 127183 || t === 127374 || t >= 127377 && t <= 127386 || t >= 127488 && t <= 127490 || t >= 127504 && t <= 127547 || t >= 127552 && t <= 127560 || t === 127568 || t === 127569 || t >= 127584 && t <= 127589 || t >= 127744 && t <= 127776 || t >= 127789 && t <= 127797 || t >= 127799 && t <= 127868 || t >= 127870 && t <= 127891 || t >= 127904 && t <= 127946 || t >= 127951 && t <= 127955 || t >= 127968 && t <= 127984 || t === 127988 || t >= 127992 && t <= 128062 || t === 128064 || t >= 128066 && t <= 128252 || t >= 128255 && t <= 128317 || t >= 128331 && t <= 128334 || t >= 128336 && t <= 128359 || t === 128378 || t === 128405 || t === 128406 || t === 128420 || t >= 128507 && t <= 128591 || t >= 128640 && t <= 128709 || t === 128716 || t >= 128720 && t <= 128722 || t >= 128725 && t <= 128727 || t >= 128732 && t <= 128735 || t === 128747 || t === 128748 || t >= 128756 && t <= 128764 || t >= 128992 && t <= 129003 || t === 129008 || t >= 129292 && t <= 129338 || t >= 129340 && t <= 129349 || t >= 129351 && t <= 129535 || t >= 129648 && t <= 129660 || t >= 129664 && t <= 129672 || t >= 129680 && t <= 129725 || t >= 129727 && t <= 129733 || t >= 129742 && t <= 129755 || t >= 129760 && t <= 129768 || t >= 129776 && t <= 129784 || t >= 131072 && t <= 196605 || t >= 196608 && t <= 262141, O, y, L, P, M, ct, ft, X = (t, e = {}, s = {}) => {
407
+ const i = e.limit ?? 1 / 0, r = e.ellipsis ?? "", n = e?.ellipsisWidth ?? (r ? X(r, ft, s).width : 0), u = s.ansiWidth ?? 0, a = s.controlWidth ?? 0, l = s.tabWidth ?? 8, E = s.ambiguousWidth ?? 1, g = s.emojiWidth ?? 2, m = s.fullWidthWidth ?? 2, A = s.regularWidth ?? 1, V = s.wideWidth ?? 2;
408
+ let h = 0, o = 0, p = t.length, v = 0, F = false, d = p, b = Math.max(0, i - n), C = 0, w = 0, c = 0, f = 0;
409
+ t:
410
+ for (;; ) {
411
+ if (w > C || o >= p && o > h) {
412
+ const ut = t.slice(C, w) || t.slice(h, o);
413
+ v = 0;
414
+ for (const Y of ut.replaceAll(ct, "")) {
415
+ const $ = Y.codePointAt(0) || 0;
416
+ if (lt($) ? f = m : ht($) ? f = V : E !== A && at($) ? f = E : f = A, c + f > b && (d = Math.min(d, Math.max(C, h) + v)), c + f > i) {
417
+ F = true;
418
+ break t;
363
419
  }
364
- } catch (ex) {}
420
+ v += Y.length, c += f;
421
+ }
422
+ C = w = 0;
423
+ }
424
+ if (o >= p)
425
+ break;
426
+ if (M.lastIndex = o, M.test(t)) {
427
+ if (v = M.lastIndex - o, f = v * A, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / A))), c + f > i) {
428
+ F = true;
429
+ break;
430
+ }
431
+ c += f, C = h, w = o, o = h = M.lastIndex;
432
+ continue;
433
+ }
434
+ if (O.lastIndex = o, O.test(t)) {
435
+ if (c + u > b && (d = Math.min(d, o)), c + u > i) {
436
+ F = true;
437
+ break;
438
+ }
439
+ c += u, C = h, w = o, o = h = O.lastIndex;
440
+ continue;
441
+ }
442
+ if (y.lastIndex = o, y.test(t)) {
443
+ if (v = y.lastIndex - o, f = v * a, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / a))), c + f > i) {
444
+ F = true;
445
+ break;
446
+ }
447
+ c += f, C = h, w = o, o = h = y.lastIndex;
448
+ continue;
365
449
  }
450
+ if (L.lastIndex = o, L.test(t)) {
451
+ if (v = L.lastIndex - o, f = v * l, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / l))), c + f > i) {
452
+ F = true;
453
+ break;
454
+ }
455
+ c += f, C = h, w = o, o = h = L.lastIndex;
456
+ continue;
457
+ }
458
+ if (P.lastIndex = o, P.test(t)) {
459
+ if (c + g > b && (d = Math.min(d, o)), c + g > i) {
460
+ F = true;
461
+ break;
462
+ }
463
+ c += g, C = h, w = o, o = h = P.lastIndex;
464
+ continue;
465
+ }
466
+ o += 1;
366
467
  }
367
- if (opt.all && found.length)
368
- return found;
369
- if (opt.nothrow)
370
- return null;
371
- throw getNotFoundError(cmd);
372
- };
373
- module.exports = which;
374
- which.sync = whichSync;
375
- });
376
-
377
- // node_modules/path-key/index.js
378
- var require_path_key = __commonJS((exports, module) => {
379
- var pathKey = (options = {}) => {
380
- const environment = options.env || process.env;
381
- const platform2 = options.platform || process.platform;
382
- if (platform2 !== "win32") {
383
- return "PATH";
468
+ return { width: F ? b : c, index: F ? d : p, truncated: F, ellipsed: F && i >= n };
469
+ }, pt, S = (t, e = {}) => X(t, pt, e).width, W = "\x1B", Z = "›", Ft = 39, j = "\x07", Q = "[", dt = "]", tt = "m", U, et, mt = (t) => {
470
+ if (t >= 30 && t <= 37 || t >= 90 && t <= 97)
471
+ return 39;
472
+ if (t >= 40 && t <= 47 || t >= 100 && t <= 107)
473
+ return 49;
474
+ if (t === 1 || t === 2)
475
+ return 22;
476
+ if (t === 3)
477
+ return 23;
478
+ if (t === 4)
479
+ return 24;
480
+ if (t === 7)
481
+ return 27;
482
+ if (t === 8)
483
+ return 28;
484
+ if (t === 9)
485
+ return 29;
486
+ if (t === 0)
487
+ return 0;
488
+ }, st = (t) => `${W}${Q}${t}${tt}`, it = (t) => `${W}${U}${t}${j}`, gt = (t) => t.map((e) => S(e)), G = (t, e, s) => {
489
+ const i = e[Symbol.iterator]();
490
+ let r = false, n = false, u = t.at(-1), a = u === undefined ? 0 : S(u), l = i.next(), E = i.next(), g = 0;
491
+ for (;!l.done; ) {
492
+ const m = l.value, A = S(m);
493
+ a + A <= s ? t[t.length - 1] += m : (t.push(m), a = 0), (m === W || m === Z) && (r = true, n = e.startsWith(U, g + 1)), r ? n ? m === j && (r = false, n = false) : m === tt && (r = false) : (a += A, a === s && !E.done && (t.push(""), a = 0)), l = E, E = i.next(), g += m.length;
494
+ }
495
+ u = t.at(-1), !a && u !== undefined && u.length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
496
+ }, vt = (t) => {
497
+ const e = t.split(" ");
498
+ let s = e.length;
499
+ for (;s > 0 && !(S(e[s - 1]) > 0); )
500
+ s--;
501
+ return s === e.length ? t : e.slice(0, s).join(" ") + e.slice(s).join("");
502
+ }, Et = (t, e, s = {}) => {
503
+ if (s.trim !== false && t.trim() === "")
504
+ return "";
505
+ let i = "", r, n;
506
+ const u = t.split(" "), a = gt(u);
507
+ let l = [""];
508
+ for (const [h, o] of u.entries()) {
509
+ s.trim !== false && (l[l.length - 1] = (l.at(-1) ?? "").trimStart());
510
+ let p = S(l.at(-1) ?? "");
511
+ if (h !== 0 && (p >= e && (s.wordWrap === false || s.trim === false) && (l.push(""), p = 0), (p > 0 || s.trim === false) && (l[l.length - 1] += " ", p++)), s.hard && a[h] > e) {
512
+ const v = e - p, F = 1 + Math.floor((a[h] - v - 1) / e);
513
+ Math.floor((a[h] - 1) / e) < F && l.push(""), G(l, o, e);
514
+ continue;
384
515
  }
385
- return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
386
- };
387
- module.exports = pathKey;
388
- module.exports.default = pathKey;
389
- });
390
-
391
- // node_modules/cross-spawn/lib/util/resolveCommand.js
392
- var require_resolveCommand = __commonJS((exports, module) => {
393
- var path = __require("path");
394
- var which = require_which();
395
- var getPathKey = require_path_key();
396
- function resolveCommandAttempt(parsed, withoutPathExt) {
397
- const env = parsed.options.env || process.env;
398
- const cwd = process.cwd();
399
- const hasCustomCwd = parsed.options.cwd != null;
400
- const shouldSwitchCwd = hasCustomCwd && process.chdir !== undefined && !process.chdir.disabled;
401
- if (shouldSwitchCwd) {
402
- try {
403
- process.chdir(parsed.options.cwd);
404
- } catch (err) {}
516
+ if (p + a[h] > e && p > 0 && a[h] > 0) {
517
+ if (s.wordWrap === false && p < e) {
518
+ G(l, o, e);
519
+ continue;
520
+ }
521
+ l.push("");
522
+ }
523
+ if (p + a[h] > e && s.wordWrap === false) {
524
+ G(l, o, e);
525
+ continue;
526
+ }
527
+ l[l.length - 1] += o;
528
+ }
529
+ s.trim !== false && (l = l.map((h) => vt(h)));
530
+ const E = l.join(`
531
+ `), g = E[Symbol.iterator]();
532
+ let m = g.next(), A = g.next(), V = 0;
533
+ for (;!m.done; ) {
534
+ const h = m.value, o = A.value;
535
+ if (i += h, h === W || h === Z) {
536
+ et.lastIndex = V + 1;
537
+ const F = et.exec(E)?.groups;
538
+ if (F?.code !== undefined) {
539
+ const d = Number.parseFloat(F.code);
540
+ r = d === Ft ? undefined : d;
541
+ } else
542
+ F?.uri !== undefined && (n = F.uri.length === 0 ? undefined : F.uri);
543
+ }
544
+ const p = r ? mt(r) : undefined;
545
+ o === `
546
+ ` ? (n && (i += it("")), r && p && (i += st(p))) : h === `
547
+ ` && (r && p && (i += st(r)), n && (i += it(n))), V += h.length, m = A, A = g.next();
548
+ }
549
+ return i;
550
+ }, At, _, bt, z, rt = (t) => ("columns" in t) && typeof t.columns == "number" ? t.columns : 80, nt = (t) => ("rows" in t) && typeof t.rows == "number" ? t.rows : 20, Vt, kt, yt, Lt, Mt, Wt, Tt, $t;
551
+ var init_dist = __esm(() => {
552
+ import_picocolors = __toESM(require_picocolors(), 1);
553
+ import_sisteransi = __toESM(require_src(), 1);
554
+ O = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
555
+ y = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
556
+ L = /\t{1,1000}/y;
557
+ P = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu;
558
+ M = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
559
+ ct = /\p{M}+/gu;
560
+ ft = { limit: 1 / 0, ellipsis: "" };
561
+ pt = { limit: 1 / 0, ellipsis: "", ellipsisWidth: 0 };
562
+ U = `${dt}8;;`;
563
+ et = new RegExp(`(?:\\${Q}(?<code>\\d+)m|\\${U}(?<uri>.*)${j})`, "y");
564
+ At = ["up", "down", "left", "right", "space", "enter", "cancel"];
565
+ _ = { actions: new Set(At), aliases: new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["\x03", "cancel"], ["escape", "cancel"]]), messages: { cancel: "Canceled", error: "Something went wrong" }, withGuide: true };
566
+ bt = globalThis.process.platform.startsWith("win");
567
+ z = Symbol("clack:cancel");
568
+ Vt = class Vt extends x {
569
+ filteredOptions;
570
+ multiple;
571
+ isNavigating = false;
572
+ selectedValues = [];
573
+ focusedValue;
574
+ #t = 0;
575
+ #s = "";
576
+ #i;
577
+ #e;
578
+ get cursor() {
579
+ return this.#t;
580
+ }
581
+ get userInputWithCursor() {
582
+ if (!this.userInput)
583
+ return import_picocolors.default.inverse(import_picocolors.default.hidden("_"));
584
+ if (this._cursor >= this.userInput.length)
585
+ return `${this.userInput}█`;
586
+ const e = this.userInput.slice(0, this._cursor), [s, ...i] = this.userInput.slice(this._cursor);
587
+ return `${e}${import_picocolors.default.inverse(s)}${i.join("")}`;
588
+ }
589
+ get options() {
590
+ return typeof this.#e == "function" ? this.#e() : this.#e;
591
+ }
592
+ constructor(e) {
593
+ super(e), this.#e = e.options;
594
+ const s = this.options;
595
+ this.filteredOptions = [...s], this.multiple = e.multiple === true, this.#i = e.filter ?? Dt;
596
+ let i;
597
+ if (e.initialValue && Array.isArray(e.initialValue) ? this.multiple ? i = e.initialValue : i = e.initialValue.slice(0, 1) : !this.multiple && this.options.length > 0 && (i = [this.options[0].value]), i)
598
+ for (const r of i) {
599
+ const n = s.findIndex((u) => u.value === r);
600
+ n !== -1 && (this.toggleSelected(r), this.#t = n);
601
+ }
602
+ this.focusedValue = this.options[this.#t]?.value, this.on("key", (r, n) => this.#r(r, n)), this.on("userInput", (r) => this.#n(r));
603
+ }
604
+ _isActionKey(e, s) {
605
+ return e === "\t" || this.multiple && this.isNavigating && s.name === "space" && e !== undefined && e !== "";
606
+ }
607
+ #r(e, s) {
608
+ const i = s.name === "up", r = s.name === "down", n = s.name === "return";
609
+ i || r ? (this.#t = B(this.#t, i ? -1 : 1, this.filteredOptions), this.focusedValue = this.filteredOptions[this.#t]?.value, this.multiple || (this.selectedValues = [this.focusedValue]), this.isNavigating = true) : n ? this.value = St(this.multiple, this.selectedValues) : this.multiple ? this.focusedValue !== undefined && (s.name === "tab" || this.isNavigating && s.name === "space") ? this.toggleSelected(this.focusedValue) : this.isNavigating = false : (this.focusedValue && (this.selectedValues = [this.focusedValue]), this.isNavigating = false);
610
+ }
611
+ deselectAll() {
612
+ this.selectedValues = [];
613
+ }
614
+ toggleSelected(e) {
615
+ this.filteredOptions.length !== 0 && (this.multiple ? this.selectedValues.includes(e) ? this.selectedValues = this.selectedValues.filter((s) => s !== e) : this.selectedValues = [...this.selectedValues, e] : this.selectedValues = [e]);
616
+ }
617
+ #n(e) {
618
+ if (e !== this.#s) {
619
+ this.#s = e;
620
+ const s = this.options;
621
+ e ? this.filteredOptions = s.filter((n) => this.#i(e, n)) : this.filteredOptions = [...s];
622
+ const i = wt(this.focusedValue, this.filteredOptions);
623
+ this.#t = B(i, 0, this.filteredOptions);
624
+ const r = this.filteredOptions[this.#t];
625
+ r && !r.disabled ? this.focusedValue = r.value : this.focusedValue = undefined, this.multiple || (this.focusedValue !== undefined ? this.toggleSelected(this.focusedValue) : this.deselectAll());
626
+ }
405
627
  }
406
- let resolved;
407
- try {
408
- resolved = which.sync(parsed.command, {
409
- path: env[getPathKey({ env })],
410
- pathExt: withoutPathExt ? path.delimiter : undefined
628
+ };
629
+ kt = class kt extends x {
630
+ get cursor() {
631
+ return this.value ? 0 : 1;
632
+ }
633
+ get _value() {
634
+ return this.cursor === 0;
635
+ }
636
+ constructor(e) {
637
+ super(e, false), this.value = !!e.initialValue, this.on("userInput", () => {
638
+ this.value = this._value;
639
+ }), this.on("confirm", (s) => {
640
+ this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = s, this.state = "submit", this.close();
641
+ }), this.on("cursor", () => {
642
+ this.value = !this.value;
411
643
  });
412
- } catch (e2) {} finally {
413
- if (shouldSwitchCwd) {
414
- process.chdir(cwd);
644
+ }
645
+ };
646
+ yt = class yt extends x {
647
+ options;
648
+ cursor = 0;
649
+ #t;
650
+ getGroupItems(e) {
651
+ return this.options.filter((s) => s.group === e);
652
+ }
653
+ isGroupSelected(e) {
654
+ const s = this.getGroupItems(e), i = this.value;
655
+ return i === undefined ? false : s.every((r) => i.includes(r.value));
656
+ }
657
+ toggleValue() {
658
+ const e = this.options[this.cursor];
659
+ if (this.value === undefined && (this.value = []), e.group === true) {
660
+ const s = e.value, i = this.getGroupItems(s);
661
+ this.isGroupSelected(s) ? this.value = this.value.filter((r) => i.findIndex((n) => n.value === r) === -1) : this.value = [...this.value, ...i.map((r) => r.value)], this.value = Array.from(new Set(this.value));
662
+ } else {
663
+ const s = this.value.includes(e.value);
664
+ this.value = s ? this.value.filter((i) => i !== e.value) : [...this.value, e.value];
415
665
  }
416
666
  }
417
- if (resolved) {
418
- resolved = path.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
667
+ constructor(e) {
668
+ super(e, false);
669
+ const { options: s } = e;
670
+ this.#t = e.selectableGroups !== false, this.options = Object.entries(s).flatMap(([i, r]) => [{ value: i, group: true, label: i }, ...r.map((n) => ({ ...n, group: i }))]), this.value = [...e.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: i }) => i === e.cursorAt), this.#t ? 0 : 1), this.on("cursor", (i) => {
671
+ switch (i) {
672
+ case "left":
673
+ case "up": {
674
+ this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
675
+ const r = this.options[this.cursor]?.group === true;
676
+ !this.#t && r && (this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1);
677
+ break;
678
+ }
679
+ case "down":
680
+ case "right": {
681
+ this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
682
+ const r = this.options[this.cursor]?.group === true;
683
+ !this.#t && r && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
684
+ break;
685
+ }
686
+ case "space":
687
+ this.toggleValue();
688
+ break;
689
+ }
690
+ });
419
691
  }
420
- return resolved;
421
- }
422
- function resolveCommand(parsed) {
423
- return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
424
- }
425
- module.exports = resolveCommand;
426
- });
427
-
428
- // node_modules/cross-spawn/lib/util/escape.js
429
- var require_escape = __commonJS((exports, module) => {
430
- var metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
431
- function escapeCommand(arg) {
432
- arg = arg.replace(metaCharsRegExp, "^$1");
433
- return arg;
434
- }
435
- function escapeArgument(arg, doubleEscapeMetaChars) {
436
- arg = `${arg}`;
437
- arg = arg.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"");
438
- arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
439
- arg = `"${arg}"`;
440
- arg = arg.replace(metaCharsRegExp, "^$1");
441
- if (doubleEscapeMetaChars) {
442
- arg = arg.replace(metaCharsRegExp, "^$1");
692
+ };
693
+ Lt = class Lt extends x {
694
+ options;
695
+ cursor = 0;
696
+ get _value() {
697
+ return this.options[this.cursor].value;
698
+ }
699
+ get _enabledOptions() {
700
+ return this.options.filter((e) => e.disabled !== true);
701
+ }
702
+ toggleAll() {
703
+ const e = this._enabledOptions, s = this.value !== undefined && this.value.length === e.length;
704
+ this.value = s ? [] : e.map((i) => i.value);
705
+ }
706
+ toggleInvert() {
707
+ const e = this.value;
708
+ if (!e)
709
+ return;
710
+ const s = this._enabledOptions.filter((i) => !e.includes(i.value));
711
+ this.value = s.map((i) => i.value);
712
+ }
713
+ toggleValue() {
714
+ this.value === undefined && (this.value = []);
715
+ const e = this.value.includes(this._value);
716
+ this.value = e ? this.value.filter((s) => s !== this._value) : [...this.value, this._value];
717
+ }
718
+ constructor(e) {
719
+ super(e, false), this.options = e.options, this.value = [...e.initialValues ?? []];
720
+ const s = Math.max(this.options.findIndex(({ value: i }) => i === e.cursorAt), 0);
721
+ this.cursor = this.options[s].disabled ? B(s, 1, this.options) : s, this.on("key", (i) => {
722
+ i === "a" && this.toggleAll(), i === "i" && this.toggleInvert();
723
+ }), this.on("cursor", (i) => {
724
+ switch (i) {
725
+ case "left":
726
+ case "up":
727
+ this.cursor = B(this.cursor, -1, this.options);
728
+ break;
729
+ case "down":
730
+ case "right":
731
+ this.cursor = B(this.cursor, 1, this.options);
732
+ break;
733
+ case "space":
734
+ this.toggleValue();
735
+ break;
736
+ }
737
+ });
443
738
  }
444
- return arg;
445
- }
446
- exports.command = escapeCommand;
447
- exports.argument = escapeArgument;
448
- });
449
-
450
- // node_modules/shebang-regex/index.js
451
- var require_shebang_regex = __commonJS((exports, module) => {
452
- module.exports = /^#!(.*)/;
453
- });
454
-
455
- // node_modules/shebang-command/index.js
456
- var require_shebang_command = __commonJS((exports, module) => {
457
- var shebangRegex = require_shebang_regex();
458
- module.exports = (string = "") => {
459
- const match = string.match(shebangRegex);
460
- if (!match) {
461
- return null;
739
+ };
740
+ Mt = class extends x {
741
+ _mask = "•";
742
+ get cursor() {
743
+ return this._cursor;
744
+ }
745
+ get masked() {
746
+ return this.userInput.replaceAll(/./g, this._mask);
747
+ }
748
+ get userInputWithCursor() {
749
+ if (this.state === "submit" || this.state === "cancel")
750
+ return this.masked;
751
+ const e = this.userInput;
752
+ if (this.cursor >= e.length)
753
+ return `${this.masked}${import_picocolors.default.inverse(import_picocolors.default.hidden("_"))}`;
754
+ const s = this.masked, i = s.slice(0, this.cursor), r = s.slice(this.cursor);
755
+ return `${i}${import_picocolors.default.inverse(r[0])}${r.slice(1)}`;
756
+ }
757
+ clear() {
758
+ this._clearUserInput();
759
+ }
760
+ constructor({ mask: e, ...s }) {
761
+ super(s), this._mask = e ?? "•", this.on("userInput", (i) => {
762
+ this._setValue(i);
763
+ });
462
764
  }
463
- const [path, argument] = match[0].replace(/#! ?/, "").split(" ");
464
- const binary = path.split("/").pop();
465
- if (binary === "env") {
466
- return argument;
765
+ };
766
+ Wt = class Wt extends x {
767
+ options;
768
+ cursor = 0;
769
+ get _selectedValue() {
770
+ return this.options[this.cursor];
771
+ }
772
+ changeValue() {
773
+ this.value = this._selectedValue.value;
774
+ }
775
+ constructor(e) {
776
+ super(e, false), this.options = e.options;
777
+ const s = this.options.findIndex(({ value: r }) => r === e.initialValue), i = s === -1 ? 0 : s;
778
+ this.cursor = this.options[i].disabled ? B(i, 1, this.options) : i, this.changeValue(), this.on("cursor", (r) => {
779
+ switch (r) {
780
+ case "left":
781
+ case "up":
782
+ this.cursor = B(this.cursor, -1, this.options);
783
+ break;
784
+ case "down":
785
+ case "right":
786
+ this.cursor = B(this.cursor, 1, this.options);
787
+ break;
788
+ }
789
+ this.changeValue();
790
+ });
791
+ }
792
+ };
793
+ Tt = class Tt extends x {
794
+ options;
795
+ cursor = 0;
796
+ constructor(e) {
797
+ super(e, false), this.options = e.options;
798
+ const s = e.caseSensitive === true, i = this.options.map(({ value: [r] }) => s ? r : r?.toLowerCase());
799
+ this.cursor = Math.max(i.indexOf(e.initialValue), 0), this.on("key", (r, n) => {
800
+ if (!r)
801
+ return;
802
+ const u = s && n.shift ? r.toUpperCase() : r;
803
+ if (!i.includes(u))
804
+ return;
805
+ const a = this.options.find(({ value: [l] }) => s ? l === u : l?.toLowerCase() === r);
806
+ a && (this.value = a.value, this.state = "submit", this.emit("submit"));
807
+ });
808
+ }
809
+ };
810
+ $t = class $t extends x {
811
+ get userInputWithCursor() {
812
+ if (this.state === "submit")
813
+ return this.userInput;
814
+ const e = this.userInput;
815
+ if (this.cursor >= e.length)
816
+ return `${this.userInput}█`;
817
+ const s = e.slice(0, this.cursor), [i, ...r] = e.slice(this.cursor);
818
+ return `${s}${import_picocolors.default.inverse(i)}${r.join("")}`;
819
+ }
820
+ get cursor() {
821
+ return this._cursor;
822
+ }
823
+ constructor(e) {
824
+ super({ ...e, initialUserInput: e.initialUserInput ?? e.initialValue }), this.on("userInput", (s) => {
825
+ this._setValue(s);
826
+ }), this.on("finalize", () => {
827
+ this.value || (this.value = e.defaultValue), this.value === undefined && (this.value = "");
828
+ });
467
829
  }
468
- return argument ? `${binary} ${argument}` : binary;
469
830
  };
470
831
  });
471
832
 
472
- // node_modules/cross-spawn/lib/util/readShebang.js
473
- var require_readShebang = __commonJS((exports, module) => {
474
- var fs = __require("fs");
475
- var shebangCommand = require_shebang_command();
476
- function readShebang(command) {
477
- const size = 150;
478
- const buffer = Buffer.alloc(size);
479
- let fd;
480
- try {
481
- fd = fs.openSync(command, "r");
482
- fs.readSync(fd, buffer, 0, size, 0);
483
- fs.closeSync(fd);
484
- } catch (e2) {}
485
- return shebangCommand(buffer.toString());
486
- }
487
- module.exports = readShebang;
833
+ // node_modules/@clack/prompts/dist/index.mjs
834
+ var exports_dist = {};
835
+ __export(exports_dist, {
836
+ updateSettings: () => It,
837
+ unicodeOr: () => C,
838
+ unicode: () => et2,
839
+ text: () => Ze,
840
+ tasks: () => Ye,
841
+ taskLog: () => Qe,
842
+ symbolBar: () => vt2,
843
+ symbol: () => W2,
844
+ stream: () => K2,
845
+ spinner: () => bt2,
846
+ settings: () => _,
847
+ selectKey: () => Xe,
848
+ select: () => Je,
849
+ progress: () => qe,
850
+ path: () => Ue,
851
+ password: () => He,
852
+ outro: () => Le,
853
+ note: () => Ve,
854
+ multiselect: () => je,
855
+ log: () => R2,
856
+ limitOptions: () => X2,
857
+ isTTY: () => Mt2,
858
+ isCancel: () => Ct,
859
+ isCI: () => ct2,
860
+ intro: () => We,
861
+ groupMultiselect: () => Pe,
862
+ group: () => Oe,
863
+ confirm: () => Re,
864
+ cancel: () => Ne,
865
+ box: () => Me,
866
+ autocompleteMultiselect: () => xe,
867
+ autocomplete: () => Xt,
868
+ S_WARN: () => yt2,
869
+ S_SUCCESS: () => Ft2,
870
+ S_STEP_SUBMIT: () => V,
871
+ S_STEP_ERROR: () => $t2,
872
+ S_STEP_CANCEL: () => dt2,
873
+ S_STEP_ACTIVE: () => Rt,
874
+ S_RADIO_INACTIVE: () => H2,
875
+ S_RADIO_ACTIVE: () => Q2,
876
+ S_PASSWORD_MASK: () => Nt,
877
+ S_INFO: () => ft2,
878
+ S_ERROR: () => Et2,
879
+ S_CORNER_TOP_RIGHT: () => mt2,
880
+ S_CORNER_TOP_LEFT: () => Lt2,
881
+ S_CORNER_BOTTOM_RIGHT: () => pt2,
882
+ S_CORNER_BOTTOM_LEFT: () => gt2,
883
+ S_CONNECT_LEFT: () => Wt2,
884
+ S_CHECKBOX_SELECTED: () => U2,
885
+ S_CHECKBOX_INACTIVE: () => q2,
886
+ S_CHECKBOX_ACTIVE: () => st2,
887
+ S_BAR_START_RIGHT: () => Ot,
888
+ S_BAR_START: () => ht2,
889
+ S_BAR_H: () => rt2,
890
+ S_BAR_END_RIGHT: () => Pt,
891
+ S_BAR_END: () => x2,
892
+ S_BAR: () => d
488
893
  });
489
-
490
- // node_modules/cross-spawn/lib/parse.js
491
- var require_parse = __commonJS((exports, module) => {
492
- var path = __require("path");
493
- var resolveCommand = require_resolveCommand();
494
- var escape = require_escape();
495
- var readShebang = require_readShebang();
496
- var isWin = process.platform === "win32";
497
- var isExecutableRegExp = /\.(?:com|exe)$/i;
498
- var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
499
- function detectShebang(parsed) {
500
- parsed.file = resolveCommand(parsed);
501
- const shebang = parsed.file && readShebang(parsed.file);
502
- if (shebang) {
503
- parsed.args.unshift(parsed.file);
504
- parsed.command = shebang;
505
- return resolveCommand(parsed);
894
+ import N2 from "node:process";
895
+ import { readdirSync as de, existsSync as $e, lstatSync as xt2 } from "node:fs";
896
+ import { dirname as _t2, join as he } from "node:path";
897
+ import { stripVTControlCharacters as ut } from "node:util";
898
+ function me() {
899
+ return N2.platform !== "win32" ? N2.env.TERM !== "linux" : !!N2.env.CI || !!N2.env.WT_SESSION || !!N2.env.TERMINUS_SUBLIME || N2.env.ConEmuTask === "{cmd::Cmder}" || N2.env.TERM_PROGRAM === "Terminus-Sublime" || N2.env.TERM_PROGRAM === "vscode" || N2.env.TERM === "xterm-256color" || N2.env.TERM === "alacritty" || N2.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
900
+ }
901
+ function J2(t, r, s) {
902
+ return String(t).normalize().replaceAll(`\r
903
+ `, `
904
+ `).split(`
905
+ `).map((i) => Ie(i, r, s)).join(`
906
+ `);
907
+ }
908
+ function qt(t) {
909
+ return t.label ?? String(t.value ?? "");
910
+ }
911
+ function Jt(t, r) {
912
+ if (!t)
913
+ return true;
914
+ const s = (r.label ?? String(r.value ?? "")).toLowerCase(), i = (r.hint ?? "").toLowerCase(), a = String(r.value).toLowerCase(), o = t.toLowerCase();
915
+ return s.includes(o) || i.includes(o) || a.includes(o);
916
+ }
917
+ function Be(t, r) {
918
+ const s = [];
919
+ for (const i of r)
920
+ t.includes(i.value) && s.push(i);
921
+ return s;
922
+ }
923
+ function Yt(t, r, s, i) {
924
+ let a = s, o = s;
925
+ return i === "center" ? a = Math.floor((r - t) / 2) : i === "right" && (a = r - t - s), o = r - a - t, [a, o];
926
+ }
927
+ function qe({ style: t = "heavy", max: r = 100, size: s = 40, ...i } = {}) {
928
+ const a = bt2(i);
929
+ let o = 0, u = "";
930
+ const l = Math.max(1, r), n = Math.max(1, s), c = (E) => {
931
+ switch (E) {
932
+ case "initial":
933
+ case "active":
934
+ return import_picocolors2.default.magenta;
935
+ case "error":
936
+ case "cancel":
937
+ return import_picocolors2.default.red;
938
+ case "submit":
939
+ return import_picocolors2.default.green;
940
+ default:
941
+ return import_picocolors2.default.magenta;
942
+ }
943
+ }, g = (E, $) => {
944
+ const m = Math.floor(o / l * n);
945
+ return `${c(E)(zt[t].repeat(m))}${import_picocolors2.default.dim(zt[t].repeat(n - m))} ${$}`;
946
+ }, F = (E = "") => {
947
+ u = E, a.start(g("initial", E));
948
+ }, p = (E = 1, $) => {
949
+ o = Math.min(l, E + o), a.message(g("active", $ ?? u)), u = $ ?? u;
950
+ };
951
+ return { start: F, stop: a.stop, cancel: a.cancel, error: a.error, clear: a.clear, advance: p, isCancelled: a.isCancelled, message: (E) => p(0, E) };
952
+ }
953
+ var import_picocolors2, import_sisteransi2, et2, ct2 = () => process.env.CI === "true", Mt2 = (t) => t.isTTY === true, C = (t, r) => et2 ? t : r, Rt, dt2, $t2, V, ht2, d, x2, Ot, Pt, Q2, H2, st2, U2, q2, Nt, rt2, mt2, Wt2, pt2, gt2, Lt2, ft2, Ft2, yt2, Et2, W2 = (t) => {
954
+ switch (t) {
955
+ case "initial":
956
+ case "active":
957
+ return import_picocolors2.default.cyan(Rt);
958
+ case "cancel":
959
+ return import_picocolors2.default.red(dt2);
960
+ case "error":
961
+ return import_picocolors2.default.yellow($t2);
962
+ case "submit":
963
+ return import_picocolors2.default.green(V);
964
+ }
965
+ }, vt2 = (t) => {
966
+ switch (t) {
967
+ case "initial":
968
+ case "active":
969
+ return import_picocolors2.default.cyan(d);
970
+ case "cancel":
971
+ return import_picocolors2.default.red(d);
972
+ case "error":
973
+ return import_picocolors2.default.yellow(d);
974
+ case "submit":
975
+ return import_picocolors2.default.green(d);
976
+ }
977
+ }, pe = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 170 || t === 173 || t === 174 || t >= 176 && t <= 180 || t >= 182 && t <= 186 || t >= 188 && t <= 191 || t === 198 || t === 208 || t === 215 || t === 216 || t >= 222 && t <= 225 || t === 230 || t >= 232 && t <= 234 || t === 236 || t === 237 || t === 240 || t === 242 || t === 243 || t >= 247 && t <= 250 || t === 252 || t === 254 || t === 257 || t === 273 || t === 275 || t === 283 || t === 294 || t === 295 || t === 299 || t >= 305 && t <= 307 || t === 312 || t >= 319 && t <= 322 || t === 324 || t >= 328 && t <= 331 || t === 333 || t === 338 || t === 339 || t === 358 || t === 359 || t === 363 || t === 462 || t === 464 || t === 466 || t === 468 || t === 470 || t === 472 || t === 474 || t === 476 || t === 593 || t === 609 || t === 708 || t === 711 || t >= 713 && t <= 715 || t === 717 || t === 720 || t >= 728 && t <= 731 || t === 733 || t === 735 || t >= 768 && t <= 879 || t >= 913 && t <= 929 || t >= 931 && t <= 937 || t >= 945 && t <= 961 || t >= 963 && t <= 969 || t === 1025 || t >= 1040 && t <= 1103 || t === 1105 || t === 8208 || t >= 8211 && t <= 8214 || t === 8216 || t === 8217 || t === 8220 || t === 8221 || t >= 8224 && t <= 8226 || t >= 8228 && t <= 8231 || t === 8240 || t === 8242 || t === 8243 || t === 8245 || t === 8251 || t === 8254 || t === 8308 || t === 8319 || t >= 8321 && t <= 8324 || t === 8364 || t === 8451 || t === 8453 || t === 8457 || t === 8467 || t === 8470 || t === 8481 || t === 8482 || t === 8486 || t === 8491 || t === 8531 || t === 8532 || t >= 8539 && t <= 8542 || t >= 8544 && t <= 8555 || t >= 8560 && t <= 8569 || t === 8585 || t >= 8592 && t <= 8601 || t === 8632 || t === 8633 || t === 8658 || t === 8660 || t === 8679 || t === 8704 || t === 8706 || t === 8707 || t === 8711 || t === 8712 || t === 8715 || t === 8719 || t === 8721 || t === 8725 || t === 8730 || t >= 8733 && t <= 8736 || t === 8739 || t === 8741 || t >= 8743 && t <= 8748 || t === 8750 || t >= 8756 && t <= 8759 || t === 8764 || t === 8765 || t === 8776 || t === 8780 || t === 8786 || t === 8800 || t === 8801 || t >= 8804 && t <= 8807 || t === 8810 || t === 8811 || t === 8814 || t === 8815 || t === 8834 || t === 8835 || t === 8838 || t === 8839 || t === 8853 || t === 8857 || t === 8869 || t === 8895 || t === 8978 || t >= 9312 && t <= 9449 || t >= 9451 && t <= 9547 || t >= 9552 && t <= 9587 || t >= 9600 && t <= 9615 || t >= 9618 && t <= 9621 || t === 9632 || t === 9633 || t >= 9635 && t <= 9641 || t === 9650 || t === 9651 || t === 9654 || t === 9655 || t === 9660 || t === 9661 || t === 9664 || t === 9665 || t >= 9670 && t <= 9672 || t === 9675 || t >= 9678 && t <= 9681 || t >= 9698 && t <= 9701 || t === 9711 || t === 9733 || t === 9734 || t === 9737 || t === 9742 || t === 9743 || t === 9756 || t === 9758 || t === 9792 || t === 9794 || t === 9824 || t === 9825 || t >= 9827 && t <= 9829 || t >= 9831 && t <= 9834 || t === 9836 || t === 9837 || t === 9839 || t === 9886 || t === 9887 || t === 9919 || t >= 9926 && t <= 9933 || t >= 9935 && t <= 9939 || t >= 9941 && t <= 9953 || t === 9955 || t === 9960 || t === 9961 || t >= 9963 && t <= 9969 || t === 9972 || t >= 9974 && t <= 9977 || t === 9979 || t === 9980 || t === 9982 || t === 9983 || t === 10045 || t >= 10102 && t <= 10111 || t >= 11094 && t <= 11097 || t >= 12872 && t <= 12879 || t >= 57344 && t <= 63743 || t >= 65024 && t <= 65039 || t === 65533 || t >= 127232 && t <= 127242 || t >= 127248 && t <= 127277 || t >= 127280 && t <= 127337 || t >= 127344 && t <= 127373 || t === 127375 || t === 127376 || t >= 127387 && t <= 127404 || t >= 917760 && t <= 917999 || t >= 983040 && t <= 1048573 || t >= 1048576 && t <= 1114109, ge = (t) => t === 12288 || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510, fe = (t) => t >= 4352 && t <= 4447 || t === 8986 || t === 8987 || t === 9001 || t === 9002 || t >= 9193 && t <= 9196 || t === 9200 || t === 9203 || t === 9725 || t === 9726 || t === 9748 || t === 9749 || t >= 9800 && t <= 9811 || t === 9855 || t === 9875 || t === 9889 || t === 9898 || t === 9899 || t === 9917 || t === 9918 || t === 9924 || t === 9925 || t === 9934 || t === 9940 || t === 9962 || t === 9970 || t === 9971 || t === 9973 || t === 9978 || t === 9981 || t === 9989 || t === 9994 || t === 9995 || t === 10024 || t === 10060 || t === 10062 || t >= 10067 && t <= 10069 || t === 10071 || t >= 10133 && t <= 10135 || t === 10160 || t === 10175 || t === 11035 || t === 11036 || t === 11088 || t === 11093 || t >= 11904 && t <= 11929 || t >= 11931 && t <= 12019 || t >= 12032 && t <= 12245 || t >= 12272 && t <= 12287 || t >= 12289 && t <= 12350 || t >= 12353 && t <= 12438 || t >= 12441 && t <= 12543 || t >= 12549 && t <= 12591 || t >= 12593 && t <= 12686 || t >= 12688 && t <= 12771 || t >= 12783 && t <= 12830 || t >= 12832 && t <= 12871 || t >= 12880 && t <= 19903 || t >= 19968 && t <= 42124 || t >= 42128 && t <= 42182 || t >= 43360 && t <= 43388 || t >= 44032 && t <= 55203 || t >= 63744 && t <= 64255 || t >= 65040 && t <= 65049 || t >= 65072 && t <= 65106 || t >= 65108 && t <= 65126 || t >= 65128 && t <= 65131 || t >= 94176 && t <= 94180 || t === 94192 || t === 94193 || t >= 94208 && t <= 100343 || t >= 100352 && t <= 101589 || t >= 101632 && t <= 101640 || t >= 110576 && t <= 110579 || t >= 110581 && t <= 110587 || t === 110589 || t === 110590 || t >= 110592 && t <= 110882 || t === 110898 || t >= 110928 && t <= 110930 || t === 110933 || t >= 110948 && t <= 110951 || t >= 110960 && t <= 111355 || t === 126980 || t === 127183 || t === 127374 || t >= 127377 && t <= 127386 || t >= 127488 && t <= 127490 || t >= 127504 && t <= 127547 || t >= 127552 && t <= 127560 || t === 127568 || t === 127569 || t >= 127584 && t <= 127589 || t >= 127744 && t <= 127776 || t >= 127789 && t <= 127797 || t >= 127799 && t <= 127868 || t >= 127870 && t <= 127891 || t >= 127904 && t <= 127946 || t >= 127951 && t <= 127955 || t >= 127968 && t <= 127984 || t === 127988 || t >= 127992 && t <= 128062 || t === 128064 || t >= 128066 && t <= 128252 || t >= 128255 && t <= 128317 || t >= 128331 && t <= 128334 || t >= 128336 && t <= 128359 || t === 128378 || t === 128405 || t === 128406 || t === 128420 || t >= 128507 && t <= 128591 || t >= 128640 && t <= 128709 || t === 128716 || t >= 128720 && t <= 128722 || t >= 128725 && t <= 128727 || t >= 128732 && t <= 128735 || t === 128747 || t === 128748 || t >= 128756 && t <= 128764 || t >= 128992 && t <= 129003 || t === 129008 || t >= 129292 && t <= 129338 || t >= 129340 && t <= 129349 || t >= 129351 && t <= 129535 || t >= 129648 && t <= 129660 || t >= 129664 && t <= 129672 || t >= 129680 && t <= 129725 || t >= 129727 && t <= 129733 || t >= 129742 && t <= 129755 || t >= 129760 && t <= 129768 || t >= 129776 && t <= 129784 || t >= 131072 && t <= 196605 || t >= 196608 && t <= 262141, At2, it2, nt2, wt2, at2, Fe, ye, jt = (t, r = {}, s = {}) => {
978
+ const i = r.limit ?? 1 / 0, a = r.ellipsis ?? "", o = r?.ellipsisWidth ?? (a ? jt(a, ye, s).width : 0), u = s.ansiWidth ?? 0, l = s.controlWidth ?? 0, n = s.tabWidth ?? 8, c = s.ambiguousWidth ?? 1, g = s.emojiWidth ?? 2, F = s.fullWidthWidth ?? 2, p = s.regularWidth ?? 1, E = s.wideWidth ?? 2;
979
+ let $ = 0, m = 0, h = t.length, y2 = 0, f = false, v = h, S2 = Math.max(0, i - o), I2 = 0, B2 = 0, A = 0, w = 0;
980
+ t:
981
+ for (;; ) {
982
+ if (B2 > I2 || m >= h && m > $) {
983
+ const _2 = t.slice(I2, B2) || t.slice($, m);
984
+ y2 = 0;
985
+ for (const D2 of _2.replaceAll(Fe, "")) {
986
+ const T2 = D2.codePointAt(0) || 0;
987
+ if (ge(T2) ? w = F : fe(T2) ? w = E : c !== p && pe(T2) ? w = c : w = p, A + w > S2 && (v = Math.min(v, Math.max(I2, $) + y2)), A + w > i) {
988
+ f = true;
989
+ break t;
990
+ }
991
+ y2 += D2.length, A += w;
992
+ }
993
+ I2 = B2 = 0;
994
+ }
995
+ if (m >= h)
996
+ break;
997
+ if (at2.lastIndex = m, at2.test(t)) {
998
+ if (y2 = at2.lastIndex - m, w = y2 * p, A + w > S2 && (v = Math.min(v, m + Math.floor((S2 - A) / p))), A + w > i) {
999
+ f = true;
1000
+ break;
1001
+ }
1002
+ A += w, I2 = $, B2 = m, m = $ = at2.lastIndex;
1003
+ continue;
1004
+ }
1005
+ if (At2.lastIndex = m, At2.test(t)) {
1006
+ if (A + u > S2 && (v = Math.min(v, m)), A + u > i) {
1007
+ f = true;
1008
+ break;
1009
+ }
1010
+ A += u, I2 = $, B2 = m, m = $ = At2.lastIndex;
1011
+ continue;
1012
+ }
1013
+ if (it2.lastIndex = m, it2.test(t)) {
1014
+ if (y2 = it2.lastIndex - m, w = y2 * l, A + w > S2 && (v = Math.min(v, m + Math.floor((S2 - A) / l))), A + w > i) {
1015
+ f = true;
1016
+ break;
1017
+ }
1018
+ A += w, I2 = $, B2 = m, m = $ = it2.lastIndex;
1019
+ continue;
1020
+ }
1021
+ if (nt2.lastIndex = m, nt2.test(t)) {
1022
+ if (y2 = nt2.lastIndex - m, w = y2 * n, A + w > S2 && (v = Math.min(v, m + Math.floor((S2 - A) / n))), A + w > i) {
1023
+ f = true;
1024
+ break;
1025
+ }
1026
+ A += w, I2 = $, B2 = m, m = $ = nt2.lastIndex;
1027
+ continue;
1028
+ }
1029
+ if (wt2.lastIndex = m, wt2.test(t)) {
1030
+ if (A + g > S2 && (v = Math.min(v, m)), A + g > i) {
1031
+ f = true;
1032
+ break;
1033
+ }
1034
+ A += g, I2 = $, B2 = m, m = $ = wt2.lastIndex;
1035
+ continue;
1036
+ }
1037
+ m += 1;
1038
+ }
1039
+ return { width: f ? S2 : A, index: f ? v : h, truncated: f, ellipsed: f && i >= o };
1040
+ }, Ee, M2 = (t, r = {}) => jt(t, Ee, r).width, ot2 = "\x1B", Gt = "›", ve = 39, Ct2 = "\x07", kt2 = "[", Ae = "]", Vt2 = "m", St2, Ht, we = (t) => {
1041
+ if (t >= 30 && t <= 37 || t >= 90 && t <= 97)
1042
+ return 39;
1043
+ if (t >= 40 && t <= 47 || t >= 100 && t <= 107)
1044
+ return 49;
1045
+ if (t === 1 || t === 2)
1046
+ return 22;
1047
+ if (t === 3)
1048
+ return 23;
1049
+ if (t === 4)
1050
+ return 24;
1051
+ if (t === 7)
1052
+ return 27;
1053
+ if (t === 8)
1054
+ return 28;
1055
+ if (t === 9)
1056
+ return 29;
1057
+ if (t === 0)
1058
+ return 0;
1059
+ }, Ut = (t) => `${ot2}${kt2}${t}${Vt2}`, Kt = (t) => `${ot2}${St2}${t}${Ct2}`, Ce = (t) => t.map((r) => M2(r)), It2 = (t, r, s) => {
1060
+ const i = r[Symbol.iterator]();
1061
+ let a = false, o = false, u = t.at(-1), l = u === undefined ? 0 : M2(u), n = i.next(), c = i.next(), g = 0;
1062
+ for (;!n.done; ) {
1063
+ const F = n.value, p = M2(F);
1064
+ l + p <= s ? t[t.length - 1] += F : (t.push(F), l = 0), (F === ot2 || F === Gt) && (a = true, o = r.startsWith(St2, g + 1)), a ? o ? F === Ct2 && (a = false, o = false) : F === Vt2 && (a = false) : (l += p, l === s && !c.done && (t.push(""), l = 0)), n = c, c = i.next(), g += F.length;
1065
+ }
1066
+ u = t.at(-1), !l && u !== undefined && u.length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
1067
+ }, Se = (t) => {
1068
+ const r = t.split(" ");
1069
+ let s = r.length;
1070
+ for (;s > 0 && !(M2(r[s - 1]) > 0); )
1071
+ s--;
1072
+ return s === r.length ? t : r.slice(0, s).join(" ") + r.slice(s).join("");
1073
+ }, Ie = (t, r, s = {}) => {
1074
+ if (s.trim !== false && t.trim() === "")
1075
+ return "";
1076
+ let i = "", a, o;
1077
+ const u = t.split(" "), l = Ce(u);
1078
+ let n = [""];
1079
+ for (const [$, m] of u.entries()) {
1080
+ s.trim !== false && (n[n.length - 1] = (n.at(-1) ?? "").trimStart());
1081
+ let h = M2(n.at(-1) ?? "");
1082
+ if ($ !== 0 && (h >= r && (s.wordWrap === false || s.trim === false) && (n.push(""), h = 0), (h > 0 || s.trim === false) && (n[n.length - 1] += " ", h++)), s.hard && l[$] > r) {
1083
+ const y2 = r - h, f = 1 + Math.floor((l[$] - y2 - 1) / r);
1084
+ Math.floor((l[$] - 1) / r) < f && n.push(""), It2(n, m, r);
1085
+ continue;
506
1086
  }
507
- return parsed.file;
508
- }
509
- function parseNonShell(parsed) {
510
- if (!isWin) {
511
- return parsed;
1087
+ if (h + l[$] > r && h > 0 && l[$] > 0) {
1088
+ if (s.wordWrap === false && h < r) {
1089
+ It2(n, m, r);
1090
+ continue;
1091
+ }
1092
+ n.push("");
512
1093
  }
513
- const commandFile = detectShebang(parsed);
514
- const needsShell = !isExecutableRegExp.test(commandFile);
515
- if (parsed.options.forceShell || needsShell) {
516
- const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
517
- parsed.command = path.normalize(parsed.command);
518
- parsed.command = escape.command(parsed.command);
519
- parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
520
- const shellCommand = [parsed.command].concat(parsed.args).join(" ");
521
- parsed.args = ["/d", "/s", "/c", `"${shellCommand}"`];
522
- parsed.command = process.env.comspec || "cmd.exe";
523
- parsed.options.windowsVerbatimArguments = true;
1094
+ if (h + l[$] > r && s.wordWrap === false) {
1095
+ It2(n, m, r);
1096
+ continue;
524
1097
  }
525
- return parsed;
1098
+ n[n.length - 1] += m;
526
1099
  }
527
- function parse(command, args, options) {
528
- if (args && !Array.isArray(args)) {
529
- options = args;
530
- args = null;
1100
+ s.trim !== false && (n = n.map(($) => Se($)));
1101
+ const c = n.join(`
1102
+ `), g = c[Symbol.iterator]();
1103
+ let F = g.next(), p = g.next(), E = 0;
1104
+ for (;!F.done; ) {
1105
+ const $ = F.value, m = p.value;
1106
+ if (i += $, $ === ot2 || $ === Gt) {
1107
+ Ht.lastIndex = E + 1;
1108
+ const f = Ht.exec(c)?.groups;
1109
+ if (f?.code !== undefined) {
1110
+ const v = Number.parseFloat(f.code);
1111
+ a = v === ve ? undefined : v;
1112
+ } else
1113
+ f?.uri !== undefined && (o = f.uri.length === 0 ? undefined : f.uri);
531
1114
  }
532
- args = args ? args.slice(0) : [];
533
- options = Object.assign({}, options);
534
- const parsed = {
535
- command,
536
- args,
537
- options,
538
- file: undefined,
539
- original: {
540
- command,
541
- args
542
- }
543
- };
544
- return options.shell ? parsed : parseNonShell(parsed);
1115
+ const h = a ? we(a) : undefined;
1116
+ m === `
1117
+ ` ? (o && (i += Kt("")), a && h && (i += Ut(h))) : $ === `
1118
+ ` && (a && h && (i += Ut(a)), o && (i += Kt(o))), E += $.length, F = p, p = g.next();
545
1119
  }
546
- module.exports = parse;
547
- });
548
-
549
- // node_modules/cross-spawn/lib/enoent.js
550
- var require_enoent = __commonJS((exports, module) => {
551
- var isWin = process.platform === "win32";
552
- function notFoundError(original, syscall) {
553
- return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
554
- code: "ENOENT",
555
- errno: "ENOENT",
556
- syscall: `${syscall} ${original.command}`,
557
- path: original.command,
558
- spawnargs: original.args
559
- });
1120
+ return i;
1121
+ }, be = (t, r, s, i, a) => {
1122
+ let o = r, u = 0;
1123
+ for (let l = s;l < i; l++) {
1124
+ const n = t[l];
1125
+ if (o = o - n.length, u++, o <= a)
1126
+ break;
560
1127
  }
561
- function hookChildProcess(cp, parsed) {
562
- if (!isWin) {
563
- return;
564
- }
565
- const originalEmit = cp.emit;
566
- cp.emit = function(name, arg1) {
567
- if (name === "exit") {
568
- const err = verifyENOENT(arg1, parsed);
569
- if (err) {
570
- return originalEmit.call(cp, "error", err);
571
- }
572
- }
573
- return originalEmit.apply(cp, arguments);
574
- };
1128
+ return { lineCount: o, removals: u };
1129
+ }, X2 = (t) => {
1130
+ const { cursor: r, options: s, style: i } = t, a = t.output ?? process.stdout, o = rt(a), u = t.columnPadding ?? 0, l = t.rowPadding ?? 4, n = o - u, c = nt(a), g = import_picocolors2.default.dim("..."), F = t.maxItems ?? Number.POSITIVE_INFINITY, p = Math.max(c - l, 0), E = Math.max(Math.min(F, p), 5);
1131
+ let $ = 0;
1132
+ r >= E - 3 && ($ = Math.max(Math.min(r - E + 3, s.length - E), 0));
1133
+ let m = E < s.length && $ > 0, h = E < s.length && $ + E < s.length;
1134
+ const y2 = Math.min($ + E, s.length), f = [];
1135
+ let v = 0;
1136
+ m && v++, h && v++;
1137
+ const S2 = $ + (m ? 1 : 0), I2 = y2 - (h ? 1 : 0);
1138
+ for (let A = S2;A < I2; A++) {
1139
+ const w = J2(i(s[A], A === r), n, { hard: true, trim: false }).split(`
1140
+ `);
1141
+ f.push(w), v += w.length;
575
1142
  }
576
- function verifyENOENT(status, parsed) {
577
- if (isWin && status === 1 && !parsed.file) {
578
- return notFoundError(parsed.original, "spawn");
579
- }
580
- return null;
1143
+ if (v > p) {
1144
+ let A = 0, w = 0, _2 = v;
1145
+ const D2 = r - S2, T2 = (Y, L2) => be(f, _2, Y, L2, p);
1146
+ m ? ({ lineCount: _2, removals: A } = T2(0, D2), _2 > p && ({ lineCount: _2, removals: w } = T2(D2 + 1, f.length))) : ({ lineCount: _2, removals: w } = T2(D2 + 1, f.length), _2 > p && ({ lineCount: _2, removals: A } = T2(0, D2))), A > 0 && (m = true, f.splice(0, A)), w > 0 && (h = true, f.splice(f.length - w, w));
581
1147
  }
582
- function verifyENOENTSync(status, parsed) {
583
- if (isWin && status === 1 && !parsed.file) {
584
- return notFoundError(parsed.original, "spawnSync");
1148
+ const B2 = [];
1149
+ m && B2.push(g);
1150
+ for (const A of f)
1151
+ for (const w of A)
1152
+ B2.push(w);
1153
+ return h && B2.push(g), B2;
1154
+ }, Xt = (t) => new Vt({ options: t.options, initialValue: t.initialValue ? [t.initialValue] : undefined, initialUserInput: t.initialUserInput, filter: t.filter ?? ((r, s) => Jt(r, s)), signal: t.signal, input: t.input, output: t.output, validate: t.validate, render() {
1155
+ const r = t.withGuide ?? _.withGuide, s = r ? [`${import_picocolors2.default.gray(d)}`, `${W2(this.state)} ${t.message}`] : [`${W2(this.state)} ${t.message}`], i = this.userInput, a = this.options, o = t.placeholder, u = i === "" && o !== undefined, l = (n, c) => {
1156
+ const g = qt(n), F = n.hint && n.value === this.focusedValue ? import_picocolors2.default.dim(` (${n.hint})`) : "";
1157
+ switch (c) {
1158
+ case "active":
1159
+ return `${import_picocolors2.default.green(Q2)} ${g}${F}`;
1160
+ case "inactive":
1161
+ return `${import_picocolors2.default.dim(H2)} ${import_picocolors2.default.dim(g)}`;
1162
+ case "disabled":
1163
+ return `${import_picocolors2.default.gray(H2)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.gray(g))}`;
585
1164
  }
586
- return null;
587
- }
588
- module.exports = {
589
- hookChildProcess,
590
- verifyENOENT,
591
- verifyENOENTSync,
592
- notFoundError
593
1165
  };
594
- });
595
-
596
- // node_modules/cross-spawn/index.js
597
- var require_cross_spawn = __commonJS((exports, module) => {
598
- var cp = __require("child_process");
599
- var parse = require_parse();
600
- var enoent = require_enoent();
601
- function spawn(command, args, options) {
602
- const parsed = parse(command, args, options);
603
- const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
604
- enoent.hookChildProcess(spawned, parsed);
605
- return spawned;
1166
+ switch (this.state) {
1167
+ case "submit": {
1168
+ const n = Be(this.selectedValues, a), c = n.length > 0 ? ` ${import_picocolors2.default.dim(n.map(qt).join(", "))}` : "", g = r ? import_picocolors2.default.gray(d) : "";
1169
+ return `${s.join(`
1170
+ `)}
1171
+ ${g}${c}`;
1172
+ }
1173
+ case "cancel": {
1174
+ const n = i ? ` ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(i))}` : "", c = r ? import_picocolors2.default.gray(d) : "";
1175
+ return `${s.join(`
1176
+ `)}
1177
+ ${c}${n}`;
1178
+ }
1179
+ default: {
1180
+ const n = this.state === "error" ? import_picocolors2.default.yellow : import_picocolors2.default.cyan, c = r ? `${n(d)} ` : "", g = r ? n(x2) : "";
1181
+ let F = "";
1182
+ if (this.isNavigating || u) {
1183
+ const f = u ? o : i;
1184
+ F = f !== "" ? ` ${import_picocolors2.default.dim(f)}` : "";
1185
+ } else
1186
+ F = ` ${this.userInputWithCursor}`;
1187
+ const p = this.filteredOptions.length !== a.length ? import_picocolors2.default.dim(` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? "" : "es"})`) : "", E = this.filteredOptions.length === 0 && i ? [`${c}${import_picocolors2.default.yellow("No matches found")}`] : [], $ = this.state === "error" ? [`${c}${import_picocolors2.default.yellow(this.error)}`] : [];
1188
+ r && s.push(`${c.trimEnd()}`), s.push(`${c}${import_picocolors2.default.dim("Search:")}${F}${p}`, ...E, ...$);
1189
+ const m = [`${import_picocolors2.default.dim("↑/↓")} to select`, `${import_picocolors2.default.dim("Enter:")} confirm`, `${import_picocolors2.default.dim("Type:")} to search`], h = [`${c}${m.join(" • ")}`, g], y2 = this.filteredOptions.length === 0 ? [] : X2({ cursor: this.cursor, options: this.filteredOptions, columnPadding: r ? 3 : 0, rowPadding: s.length + h.length, style: (f, v) => l(f, f.disabled ? "disabled" : v ? "active" : "inactive"), maxItems: t.maxItems, output: t.output });
1190
+ return [...s, ...y2.map((f) => `${c}${f}`), ...h].join(`
1191
+ `);
1192
+ }
606
1193
  }
607
- function spawnSync(command, args, options) {
608
- const parsed = parse(command, args, options);
609
- const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
610
- result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
611
- return result;
1194
+ } }).prompt(), xe = (t) => {
1195
+ const r = (i, a, o, u) => {
1196
+ const l = o.includes(i.value), n = i.label ?? String(i.value ?? ""), c = i.hint && u !== undefined && i.value === u ? import_picocolors2.default.dim(` (${i.hint})`) : "", g = l ? import_picocolors2.default.green(U2) : import_picocolors2.default.dim(q2);
1197
+ return i.disabled ? `${import_picocolors2.default.gray(q2)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.gray(n))}` : a ? `${g} ${n}${c}` : `${g} ${import_picocolors2.default.dim(n)}`;
1198
+ }, s = new Vt({ options: t.options, multiple: true, filter: t.filter ?? ((i, a) => Jt(i, a)), validate: () => {
1199
+ if (t.required && s.selectedValues.length === 0)
1200
+ return "Please select at least one item";
1201
+ }, initialValue: t.initialValues, signal: t.signal, input: t.input, output: t.output, render() {
1202
+ const i = `${import_picocolors2.default.gray(d)}
1203
+ ${W2(this.state)} ${t.message}
1204
+ `, a = this.userInput, o = t.placeholder, u = a === "" && o !== undefined, l = this.isNavigating || u ? import_picocolors2.default.dim(u ? o : a) : this.userInputWithCursor, n = this.options, c = this.filteredOptions.length !== n.length ? import_picocolors2.default.dim(` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? "" : "es"})`) : "";
1205
+ switch (this.state) {
1206
+ case "submit":
1207
+ return `${i}${import_picocolors2.default.gray(d)} ${import_picocolors2.default.dim(`${this.selectedValues.length} items selected`)}`;
1208
+ case "cancel":
1209
+ return `${i}${import_picocolors2.default.gray(d)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(a))}`;
1210
+ default: {
1211
+ const g = this.state === "error" ? import_picocolors2.default.yellow : import_picocolors2.default.cyan, F = [`${import_picocolors2.default.dim("↑/↓")} to navigate`, `${import_picocolors2.default.dim(this.isNavigating ? "Space/Tab:" : "Tab:")} select`, `${import_picocolors2.default.dim("Enter:")} confirm`, `${import_picocolors2.default.dim("Type:")} to search`], p = this.filteredOptions.length === 0 && a ? [`${g(d)} ${import_picocolors2.default.yellow("No matches found")}`] : [], E = this.state === "error" ? [`${g(d)} ${import_picocolors2.default.yellow(this.error)}`] : [], $ = [...`${i}${g(d)}`.split(`
1212
+ `), `${g(d)} ${import_picocolors2.default.dim("Search:")} ${l}${c}`, ...p, ...E], m = [`${g(d)} ${F.join(" • ")}`, `${g(x2)}`], h = X2({ cursor: this.cursor, options: this.filteredOptions, style: (y2, f) => r(y2, f, this.selectedValues, this.focusedValue), maxItems: t.maxItems, output: t.output, rowPadding: $.length + m.length });
1213
+ return [...$, ...h.map((y2) => `${g(d)} ${y2}`), ...m].join(`
1214
+ `);
1215
+ }
1216
+ }
1217
+ } });
1218
+ return s.prompt();
1219
+ }, _e, De, Te = (t) => t, Me = (t = "", r = "", s) => {
1220
+ const i = s?.output ?? process.stdout, a = rt(i), o = 2, u = s?.titlePadding ?? 1, l = s?.contentPadding ?? 2, n = s?.width === undefined || s.width === "auto" ? 1 : Math.min(1, s.width), c = s?.withGuide ?? _.withGuide ? `${d} ` : "", g = s?.formatBorder ?? Te, F = ((s?.rounded) ? _e : De).map(g), p = g(rt2), E = g(d), $ = M2(c), m = M2(r), h = a - $;
1221
+ let y2 = Math.floor(a * n) - $;
1222
+ if (s?.width === "auto") {
1223
+ const _2 = t.split(`
1224
+ `);
1225
+ let D2 = m + u * 2;
1226
+ for (const Y of _2) {
1227
+ const L2 = M2(Y) + l * 2;
1228
+ L2 > D2 && (D2 = L2);
1229
+ }
1230
+ const T2 = D2 + o;
1231
+ T2 < y2 && (y2 = T2);
612
1232
  }
613
- module.exports = spawn;
614
- module.exports.spawn = spawn;
615
- module.exports.sync = spawnSync;
616
- module.exports._parse = parse;
617
- module.exports._enoent = enoent;
618
- });
619
-
620
- // node_modules/@clack/core/dist/index.mjs
621
- var import_picocolors = __toESM(require_picocolors(), 1);
622
- var import_sisteransi = __toESM(require_src(), 1);
623
- import { stdout as R, stdin as q } from "node:process";
624
- import * as k from "node:readline";
625
- import ot from "node:readline";
626
- import { ReadStream as J } from "node:tty";
627
- function B(t, e, s) {
628
- if (!s.some((u) => !u.disabled))
629
- return t;
630
- const i = t + e, r = Math.max(s.length - 1, 0), n = i < 0 ? r : i > r ? 0 : i;
631
- return s[n].disabled ? B(n, e < 0 ? -1 : 1, s) : n;
632
- }
633
- var at = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 170 || t === 173 || t === 174 || t >= 176 && t <= 180 || t >= 182 && t <= 186 || t >= 188 && t <= 191 || t === 198 || t === 208 || t === 215 || t === 216 || t >= 222 && t <= 225 || t === 230 || t >= 232 && t <= 234 || t === 236 || t === 237 || t === 240 || t === 242 || t === 243 || t >= 247 && t <= 250 || t === 252 || t === 254 || t === 257 || t === 273 || t === 275 || t === 283 || t === 294 || t === 295 || t === 299 || t >= 305 && t <= 307 || t === 312 || t >= 319 && t <= 322 || t === 324 || t >= 328 && t <= 331 || t === 333 || t === 338 || t === 339 || t === 358 || t === 359 || t === 363 || t === 462 || t === 464 || t === 466 || t === 468 || t === 470 || t === 472 || t === 474 || t === 476 || t === 593 || t === 609 || t === 708 || t === 711 || t >= 713 && t <= 715 || t === 717 || t === 720 || t >= 728 && t <= 731 || t === 733 || t === 735 || t >= 768 && t <= 879 || t >= 913 && t <= 929 || t >= 931 && t <= 937 || t >= 945 && t <= 961 || t >= 963 && t <= 969 || t === 1025 || t >= 1040 && t <= 1103 || t === 1105 || t === 8208 || t >= 8211 && t <= 8214 || t === 8216 || t === 8217 || t === 8220 || t === 8221 || t >= 8224 && t <= 8226 || t >= 8228 && t <= 8231 || t === 8240 || t === 8242 || t === 8243 || t === 8245 || t === 8251 || t === 8254 || t === 8308 || t === 8319 || t >= 8321 && t <= 8324 || t === 8364 || t === 8451 || t === 8453 || t === 8457 || t === 8467 || t === 8470 || t === 8481 || t === 8482 || t === 8486 || t === 8491 || t === 8531 || t === 8532 || t >= 8539 && t <= 8542 || t >= 8544 && t <= 8555 || t >= 8560 && t <= 8569 || t === 8585 || t >= 8592 && t <= 8601 || t === 8632 || t === 8633 || t === 8658 || t === 8660 || t === 8679 || t === 8704 || t === 8706 || t === 8707 || t === 8711 || t === 8712 || t === 8715 || t === 8719 || t === 8721 || t === 8725 || t === 8730 || t >= 8733 && t <= 8736 || t === 8739 || t === 8741 || t >= 8743 && t <= 8748 || t === 8750 || t >= 8756 && t <= 8759 || t === 8764 || t === 8765 || t === 8776 || t === 8780 || t === 8786 || t === 8800 || t === 8801 || t >= 8804 && t <= 8807 || t === 8810 || t === 8811 || t === 8814 || t === 8815 || t === 8834 || t === 8835 || t === 8838 || t === 8839 || t === 8853 || t === 8857 || t === 8869 || t === 8895 || t === 8978 || t >= 9312 && t <= 9449 || t >= 9451 && t <= 9547 || t >= 9552 && t <= 9587 || t >= 9600 && t <= 9615 || t >= 9618 && t <= 9621 || t === 9632 || t === 9633 || t >= 9635 && t <= 9641 || t === 9650 || t === 9651 || t === 9654 || t === 9655 || t === 9660 || t === 9661 || t === 9664 || t === 9665 || t >= 9670 && t <= 9672 || t === 9675 || t >= 9678 && t <= 9681 || t >= 9698 && t <= 9701 || t === 9711 || t === 9733 || t === 9734 || t === 9737 || t === 9742 || t === 9743 || t === 9756 || t === 9758 || t === 9792 || t === 9794 || t === 9824 || t === 9825 || t >= 9827 && t <= 9829 || t >= 9831 && t <= 9834 || t === 9836 || t === 9837 || t === 9839 || t === 9886 || t === 9887 || t === 9919 || t >= 9926 && t <= 9933 || t >= 9935 && t <= 9939 || t >= 9941 && t <= 9953 || t === 9955 || t === 9960 || t === 9961 || t >= 9963 && t <= 9969 || t === 9972 || t >= 9974 && t <= 9977 || t === 9979 || t === 9980 || t === 9982 || t === 9983 || t === 10045 || t >= 10102 && t <= 10111 || t >= 11094 && t <= 11097 || t >= 12872 && t <= 12879 || t >= 57344 && t <= 63743 || t >= 65024 && t <= 65039 || t === 65533 || t >= 127232 && t <= 127242 || t >= 127248 && t <= 127277 || t >= 127280 && t <= 127337 || t >= 127344 && t <= 127373 || t === 127375 || t === 127376 || t >= 127387 && t <= 127404 || t >= 917760 && t <= 917999 || t >= 983040 && t <= 1048573 || t >= 1048576 && t <= 1114109;
634
- var lt = (t) => t === 12288 || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510;
635
- var ht = (t) => t >= 4352 && t <= 4447 || t === 8986 || t === 8987 || t === 9001 || t === 9002 || t >= 9193 && t <= 9196 || t === 9200 || t === 9203 || t === 9725 || t === 9726 || t === 9748 || t === 9749 || t >= 9800 && t <= 9811 || t === 9855 || t === 9875 || t === 9889 || t === 9898 || t === 9899 || t === 9917 || t === 9918 || t === 9924 || t === 9925 || t === 9934 || t === 9940 || t === 9962 || t === 9970 || t === 9971 || t === 9973 || t === 9978 || t === 9981 || t === 9989 || t === 9994 || t === 9995 || t === 10024 || t === 10060 || t === 10062 || t >= 10067 && t <= 10069 || t === 10071 || t >= 10133 && t <= 10135 || t === 10160 || t === 10175 || t === 11035 || t === 11036 || t === 11088 || t === 11093 || t >= 11904 && t <= 11929 || t >= 11931 && t <= 12019 || t >= 12032 && t <= 12245 || t >= 12272 && t <= 12287 || t >= 12289 && t <= 12350 || t >= 12353 && t <= 12438 || t >= 12441 && t <= 12543 || t >= 12549 && t <= 12591 || t >= 12593 && t <= 12686 || t >= 12688 && t <= 12771 || t >= 12783 && t <= 12830 || t >= 12832 && t <= 12871 || t >= 12880 && t <= 19903 || t >= 19968 && t <= 42124 || t >= 42128 && t <= 42182 || t >= 43360 && t <= 43388 || t >= 44032 && t <= 55203 || t >= 63744 && t <= 64255 || t >= 65040 && t <= 65049 || t >= 65072 && t <= 65106 || t >= 65108 && t <= 65126 || t >= 65128 && t <= 65131 || t >= 94176 && t <= 94180 || t === 94192 || t === 94193 || t >= 94208 && t <= 100343 || t >= 100352 && t <= 101589 || t >= 101632 && t <= 101640 || t >= 110576 && t <= 110579 || t >= 110581 && t <= 110587 || t === 110589 || t === 110590 || t >= 110592 && t <= 110882 || t === 110898 || t >= 110928 && t <= 110930 || t === 110933 || t >= 110948 && t <= 110951 || t >= 110960 && t <= 111355 || t === 126980 || t === 127183 || t === 127374 || t >= 127377 && t <= 127386 || t >= 127488 && t <= 127490 || t >= 127504 && t <= 127547 || t >= 127552 && t <= 127560 || t === 127568 || t === 127569 || t >= 127584 && t <= 127589 || t >= 127744 && t <= 127776 || t >= 127789 && t <= 127797 || t >= 127799 && t <= 127868 || t >= 127870 && t <= 127891 || t >= 127904 && t <= 127946 || t >= 127951 && t <= 127955 || t >= 127968 && t <= 127984 || t === 127988 || t >= 127992 && t <= 128062 || t === 128064 || t >= 128066 && t <= 128252 || t >= 128255 && t <= 128317 || t >= 128331 && t <= 128334 || t >= 128336 && t <= 128359 || t === 128378 || t === 128405 || t === 128406 || t === 128420 || t >= 128507 && t <= 128591 || t >= 128640 && t <= 128709 || t === 128716 || t >= 128720 && t <= 128722 || t >= 128725 && t <= 128727 || t >= 128732 && t <= 128735 || t === 128747 || t === 128748 || t >= 128756 && t <= 128764 || t >= 128992 && t <= 129003 || t === 129008 || t >= 129292 && t <= 129338 || t >= 129340 && t <= 129349 || t >= 129351 && t <= 129535 || t >= 129648 && t <= 129660 || t >= 129664 && t <= 129672 || t >= 129680 && t <= 129725 || t >= 129727 && t <= 129733 || t >= 129742 && t <= 129755 || t >= 129760 && t <= 129768 || t >= 129776 && t <= 129784 || t >= 131072 && t <= 196605 || t >= 196608 && t <= 262141;
636
- var O = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
637
- var y = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
638
- var L = /\t{1,1000}/y;
639
- var P = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu;
640
- var M = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
641
- var ct = /\p{M}+/gu;
642
- var ft = { limit: 1 / 0, ellipsis: "" };
643
- var X = (t, e = {}, s = {}) => {
644
- const i = e.limit ?? 1 / 0, r = e.ellipsis ?? "", n = e?.ellipsisWidth ?? (r ? X(r, ft, s).width : 0), u = s.ansiWidth ?? 0, a = s.controlWidth ?? 0, l = s.tabWidth ?? 8, E = s.ambiguousWidth ?? 1, g = s.emojiWidth ?? 2, m = s.fullWidthWidth ?? 2, A = s.regularWidth ?? 1, V = s.wideWidth ?? 2;
645
- let h = 0, o = 0, p = t.length, v = 0, F = false, d = p, b = Math.max(0, i - n), C = 0, w = 0, c = 0, f = 0;
646
- t:
647
- for (;; ) {
648
- if (w > C || o >= p && o > h) {
649
- const ut = t.slice(C, w) || t.slice(h, o);
650
- v = 0;
651
- for (const Y of ut.replaceAll(ct, "")) {
652
- const $ = Y.codePointAt(0) || 0;
653
- if (lt($) ? f = m : ht($) ? f = V : E !== A && at($) ? f = E : f = A, c + f > b && (d = Math.min(d, Math.max(C, h) + v)), c + f > i) {
654
- F = true;
655
- break t;
656
- }
657
- v += Y.length, c += f;
658
- }
659
- C = w = 0;
1233
+ y2 % 2 !== 0 && (y2 < h ? y2++ : y2--);
1234
+ const f = y2 - o, v = f - u * 2, S2 = m > v ? `${r.slice(0, v - 3)}...` : r, [I2, B2] = Yt(M2(S2), f, u, s?.titleAlign), A = J2(t, f - l * 2, { hard: true, trim: false });
1235
+ i.write(`${c}${F[0]}${p.repeat(I2)}${S2}${p.repeat(B2)}${F[1]}
1236
+ `);
1237
+ const w = A.split(`
1238
+ `);
1239
+ for (const _2 of w) {
1240
+ const [D2, T2] = Yt(M2(_2), f, l, s?.contentAlign);
1241
+ i.write(`${c}${E}${" ".repeat(D2)}${_2}${" ".repeat(T2)}${E}
1242
+ `);
1243
+ }
1244
+ i.write(`${c}${F[2]}${p.repeat(f)}${F[3]}
1245
+ `);
1246
+ }, Re = (t) => {
1247
+ const r = t.active ?? "Yes", s = t.inactive ?? "No";
1248
+ return new kt({ active: r, inactive: s, signal: t.signal, input: t.input, output: t.output, initialValue: t.initialValue ?? true, render() {
1249
+ const i = t.withGuide ?? _.withGuide, a = `${i ? `${import_picocolors2.default.gray(d)}
1250
+ ` : ""}${W2(this.state)} ${t.message}
1251
+ `, o = this.value ? r : s;
1252
+ switch (this.state) {
1253
+ case "submit": {
1254
+ const u = i ? `${import_picocolors2.default.gray(d)} ` : "";
1255
+ return `${a}${u}${import_picocolors2.default.dim(o)}`;
1256
+ }
1257
+ case "cancel": {
1258
+ const u = i ? `${import_picocolors2.default.gray(d)} ` : "";
1259
+ return `${a}${u}${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(o))}${i ? `
1260
+ ${import_picocolors2.default.gray(d)}` : ""}`;
1261
+ }
1262
+ default: {
1263
+ const u = i ? `${import_picocolors2.default.cyan(d)} ` : "", l = i ? import_picocolors2.default.cyan(x2) : "";
1264
+ return `${a}${u}${this.value ? `${import_picocolors2.default.green(Q2)} ${r}` : `${import_picocolors2.default.dim(H2)} ${import_picocolors2.default.dim(r)}`}${t.vertical ? i ? `
1265
+ ${import_picocolors2.default.cyan(d)} ` : `
1266
+ ` : ` ${import_picocolors2.default.dim("/")} `}${this.value ? `${import_picocolors2.default.dim(H2)} ${import_picocolors2.default.dim(s)}` : `${import_picocolors2.default.green(Q2)} ${s}`}
1267
+ ${l}
1268
+ `;
1269
+ }
1270
+ }
1271
+ } }).prompt();
1272
+ }, Oe = async (t, r) => {
1273
+ const s = {}, i = Object.keys(t);
1274
+ for (const a of i) {
1275
+ const o = t[a], u = await o({ results: s })?.catch((l) => {
1276
+ throw l;
1277
+ });
1278
+ if (typeof r?.onCancel == "function" && Ct(u)) {
1279
+ s[a] = "canceled", r.onCancel({ results: s });
1280
+ continue;
1281
+ }
1282
+ s[a] = u;
1283
+ }
1284
+ return s;
1285
+ }, Pe = (t) => {
1286
+ const { selectableGroups: r = true, groupSpacing: s = 0 } = t, i = (o, u, l = []) => {
1287
+ const n = o.label ?? String(o.value), c = typeof o.group == "string", g = c && (l[l.indexOf(o) + 1] ?? { group: true }), F = c && g && g.group === true, p = c ? r ? `${F ? x2 : d} ` : " " : "";
1288
+ let E = "";
1289
+ if (s > 0 && !c) {
1290
+ const m = `
1291
+ ${import_picocolors2.default.cyan(d)}`;
1292
+ E = `${m.repeat(s - 1)}${m} `;
1293
+ }
1294
+ if (u === "active")
1295
+ return `${E}${import_picocolors2.default.dim(p)}${import_picocolors2.default.cyan(st2)} ${n}${o.hint ? ` ${import_picocolors2.default.dim(`(${o.hint})`)}` : ""}`;
1296
+ if (u === "group-active")
1297
+ return `${E}${p}${import_picocolors2.default.cyan(st2)} ${import_picocolors2.default.dim(n)}`;
1298
+ if (u === "group-active-selected")
1299
+ return `${E}${p}${import_picocolors2.default.green(U2)} ${import_picocolors2.default.dim(n)}`;
1300
+ if (u === "selected") {
1301
+ const m = c || r ? import_picocolors2.default.green(U2) : "";
1302
+ return `${E}${import_picocolors2.default.dim(p)}${m} ${import_picocolors2.default.dim(n)}${o.hint ? ` ${import_picocolors2.default.dim(`(${o.hint})`)}` : ""}`;
1303
+ }
1304
+ if (u === "cancelled")
1305
+ return `${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(n))}`;
1306
+ if (u === "active-selected")
1307
+ return `${E}${import_picocolors2.default.dim(p)}${import_picocolors2.default.green(U2)} ${n}${o.hint ? ` ${import_picocolors2.default.dim(`(${o.hint})`)}` : ""}`;
1308
+ if (u === "submitted")
1309
+ return `${import_picocolors2.default.dim(n)}`;
1310
+ const $ = c || r ? import_picocolors2.default.dim(q2) : "";
1311
+ return `${E}${import_picocolors2.default.dim(p)}${$} ${import_picocolors2.default.dim(n)}`;
1312
+ }, a = t.required ?? true;
1313
+ return new yt({ options: t.options, signal: t.signal, input: t.input, output: t.output, initialValues: t.initialValues, required: a, cursorAt: t.cursorAt, selectableGroups: r, validate(o) {
1314
+ if (a && (o === undefined || o.length === 0))
1315
+ return `Please select at least one option.
1316
+ ${import_picocolors2.default.reset(import_picocolors2.default.dim(`Press ${import_picocolors2.default.gray(import_picocolors2.default.bgWhite(import_picocolors2.default.inverse(" space ")))} to select, ${import_picocolors2.default.gray(import_picocolors2.default.bgWhite(import_picocolors2.default.inverse(" enter ")))} to submit`))}`;
1317
+ }, render() {
1318
+ const o = `${import_picocolors2.default.gray(d)}
1319
+ ${W2(this.state)} ${t.message}
1320
+ `, u = this.value ?? [];
1321
+ switch (this.state) {
1322
+ case "submit": {
1323
+ const l = this.options.filter(({ value: c }) => u.includes(c)).map((c) => i(c, "submitted")), n = l.length === 0 ? "" : ` ${l.join(import_picocolors2.default.dim(", "))}`;
1324
+ return `${o}${import_picocolors2.default.gray(d)}${n}`;
1325
+ }
1326
+ case "cancel": {
1327
+ const l = this.options.filter(({ value: n }) => u.includes(n)).map((n) => i(n, "cancelled")).join(import_picocolors2.default.dim(", "));
1328
+ return `${o}${import_picocolors2.default.gray(d)} ${l.trim() ? `${l}
1329
+ ${import_picocolors2.default.gray(d)}` : ""}`;
1330
+ }
1331
+ case "error": {
1332
+ const l = this.error.split(`
1333
+ `).map((n, c) => c === 0 ? `${import_picocolors2.default.yellow(x2)} ${import_picocolors2.default.yellow(n)}` : ` ${n}`).join(`
1334
+ `);
1335
+ return `${o}${import_picocolors2.default.yellow(d)} ${this.options.map((n, c, g) => {
1336
+ const F = u.includes(n.value) || n.group === true && this.isGroupSelected(`${n.value}`), p = c === this.cursor;
1337
+ return !p && typeof n.group == "string" && this.options[this.cursor].value === n.group ? i(n, F ? "group-active-selected" : "group-active", g) : p && F ? i(n, "active-selected", g) : F ? i(n, "selected", g) : i(n, p ? "active" : "inactive", g);
1338
+ }).join(`
1339
+ ${import_picocolors2.default.yellow(d)} `)}
1340
+ ${l}
1341
+ `;
660
1342
  }
661
- if (o >= p)
662
- break;
663
- if (M.lastIndex = o, M.test(t)) {
664
- if (v = M.lastIndex - o, f = v * A, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / A))), c + f > i) {
665
- F = true;
666
- break;
667
- }
668
- c += f, C = h, w = o, o = h = M.lastIndex;
669
- continue;
1343
+ default: {
1344
+ const l = this.options.map((c, g, F) => {
1345
+ const p = u.includes(c.value) || c.group === true && this.isGroupSelected(`${c.value}`), E = g === this.cursor, $ = !E && typeof c.group == "string" && this.options[this.cursor].value === c.group;
1346
+ let m = "";
1347
+ return $ ? m = i(c, p ? "group-active-selected" : "group-active", F) : E && p ? m = i(c, "active-selected", F) : p ? m = i(c, "selected", F) : m = i(c, E ? "active" : "inactive", F), `${g !== 0 && !m.startsWith(`
1348
+ `) ? " " : ""}${m}`;
1349
+ }).join(`
1350
+ ${import_picocolors2.default.cyan(d)}`), n = l.startsWith(`
1351
+ `) ? "" : " ";
1352
+ return `${o}${import_picocolors2.default.cyan(d)}${n}${l}
1353
+ ${import_picocolors2.default.cyan(x2)}
1354
+ `;
670
1355
  }
671
- if (O.lastIndex = o, O.test(t)) {
672
- if (c + u > b && (d = Math.min(d, o)), c + u > i) {
673
- F = true;
674
- break;
675
- }
676
- c += u, C = h, w = o, o = h = O.lastIndex;
677
- continue;
1356
+ }
1357
+ } }).prompt();
1358
+ }, R2, Ne = (t = "", r) => {
1359
+ (r?.output ?? process.stdout).write(`${import_picocolors2.default.gray(x2)} ${import_picocolors2.default.red(t)}
1360
+
1361
+ `);
1362
+ }, We = (t = "", r) => {
1363
+ (r?.output ?? process.stdout).write(`${import_picocolors2.default.gray(ht2)} ${t}
1364
+ `);
1365
+ }, Le = (t = "", r) => {
1366
+ (r?.output ?? process.stdout).write(`${import_picocolors2.default.gray(d)}
1367
+ ${import_picocolors2.default.gray(x2)} ${t}
1368
+
1369
+ `);
1370
+ }, Z2 = (t, r) => t.split(`
1371
+ `).map((s) => r(s)).join(`
1372
+ `), je = (t) => {
1373
+ const r = (i, a) => {
1374
+ const o = i.label ?? String(i.value);
1375
+ return a === "disabled" ? `${import_picocolors2.default.gray(q2)} ${Z2(o, (u) => import_picocolors2.default.strikethrough(import_picocolors2.default.gray(u)))}${i.hint ? ` ${import_picocolors2.default.dim(`(${i.hint ?? "disabled"})`)}` : ""}` : a === "active" ? `${import_picocolors2.default.cyan(st2)} ${o}${i.hint ? ` ${import_picocolors2.default.dim(`(${i.hint})`)}` : ""}` : a === "selected" ? `${import_picocolors2.default.green(U2)} ${Z2(o, import_picocolors2.default.dim)}${i.hint ? ` ${import_picocolors2.default.dim(`(${i.hint})`)}` : ""}` : a === "cancelled" ? `${Z2(o, (u) => import_picocolors2.default.strikethrough(import_picocolors2.default.dim(u)))}` : a === "active-selected" ? `${import_picocolors2.default.green(U2)} ${o}${i.hint ? ` ${import_picocolors2.default.dim(`(${i.hint})`)}` : ""}` : a === "submitted" ? `${Z2(o, import_picocolors2.default.dim)}` : `${import_picocolors2.default.dim(q2)} ${Z2(o, import_picocolors2.default.dim)}`;
1376
+ }, s = t.required ?? true;
1377
+ return new Lt({ options: t.options, signal: t.signal, input: t.input, output: t.output, initialValues: t.initialValues, required: s, cursorAt: t.cursorAt, validate(i) {
1378
+ if (s && (i === undefined || i.length === 0))
1379
+ return `Please select at least one option.
1380
+ ${import_picocolors2.default.reset(import_picocolors2.default.dim(`Press ${import_picocolors2.default.gray(import_picocolors2.default.bgWhite(import_picocolors2.default.inverse(" space ")))} to select, ${import_picocolors2.default.gray(import_picocolors2.default.bgWhite(import_picocolors2.default.inverse(" enter ")))} to submit`))}`;
1381
+ }, render() {
1382
+ const i = xt(t.output, t.message, `${vt2(this.state)} `, `${W2(this.state)} `), a = `${import_picocolors2.default.gray(d)}
1383
+ ${i}
1384
+ `, o = this.value ?? [], u = (l, n) => {
1385
+ if (l.disabled)
1386
+ return r(l, "disabled");
1387
+ const c = o.includes(l.value);
1388
+ return n && c ? r(l, "active-selected") : c ? r(l, "selected") : r(l, n ? "active" : "inactive");
1389
+ };
1390
+ switch (this.state) {
1391
+ case "submit": {
1392
+ const l = this.options.filter(({ value: c }) => o.includes(c)).map((c) => r(c, "submitted")).join(import_picocolors2.default.dim(", ")) || import_picocolors2.default.dim("none"), n = xt(t.output, l, `${import_picocolors2.default.gray(d)} `);
1393
+ return `${a}${n}`;
678
1394
  }
679
- if (y.lastIndex = o, y.test(t)) {
680
- if (v = y.lastIndex - o, f = v * a, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / a))), c + f > i) {
681
- F = true;
682
- break;
683
- }
684
- c += f, C = h, w = o, o = h = y.lastIndex;
685
- continue;
1395
+ case "cancel": {
1396
+ const l = this.options.filter(({ value: c }) => o.includes(c)).map((c) => r(c, "cancelled")).join(import_picocolors2.default.dim(", "));
1397
+ if (l.trim() === "")
1398
+ return `${a}${import_picocolors2.default.gray(d)}`;
1399
+ const n = xt(t.output, l, `${import_picocolors2.default.gray(d)} `);
1400
+ return `${a}${n}
1401
+ ${import_picocolors2.default.gray(d)}`;
686
1402
  }
687
- if (L.lastIndex = o, L.test(t)) {
688
- if (v = L.lastIndex - o, f = v * l, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / l))), c + f > i) {
689
- F = true;
690
- break;
691
- }
692
- c += f, C = h, w = o, o = h = L.lastIndex;
693
- continue;
1403
+ case "error": {
1404
+ const l = `${import_picocolors2.default.yellow(d)} `, n = this.error.split(`
1405
+ `).map((F, p) => p === 0 ? `${import_picocolors2.default.yellow(x2)} ${import_picocolors2.default.yellow(F)}` : ` ${F}`).join(`
1406
+ `), c = a.split(`
1407
+ `).length, g = n.split(`
1408
+ `).length + 1;
1409
+ return `${a}${l}${X2({ output: t.output, options: this.options, cursor: this.cursor, maxItems: t.maxItems, columnPadding: l.length, rowPadding: c + g, style: u }).join(`
1410
+ ${l}`)}
1411
+ ${n}
1412
+ `;
694
1413
  }
695
- if (P.lastIndex = o, P.test(t)) {
696
- if (c + g > b && (d = Math.min(d, o)), c + g > i) {
697
- F = true;
698
- break;
699
- }
700
- c += g, C = h, w = o, o = h = P.lastIndex;
701
- continue;
1414
+ default: {
1415
+ const l = `${import_picocolors2.default.cyan(d)} `, n = a.split(`
1416
+ `).length;
1417
+ return `${a}${l}${X2({ output: t.output, options: this.options, cursor: this.cursor, maxItems: t.maxItems, columnPadding: l.length, rowPadding: n + 2, style: u }).join(`
1418
+ ${l}`)}
1419
+ ${import_picocolors2.default.cyan(x2)}
1420
+ `;
702
1421
  }
703
- o += 1;
704
- }
705
- return { width: F ? b : c, index: F ? d : p, truncated: F, ellipsed: F && i >= n };
706
- };
707
- var pt = { limit: 1 / 0, ellipsis: "", ellipsisWidth: 0 };
708
- var S = (t, e = {}) => X(t, pt, e).width;
709
- var W = "\x1B";
710
- var Z = "›";
711
- var Ft = 39;
712
- var j = "\x07";
713
- var Q = "[";
714
- var dt = "]";
715
- var tt = "m";
716
- var U = `${dt}8;;`;
717
- var et = new RegExp(`(?:\\${Q}(?<code>\\d+)m|\\${U}(?<uri>.*)${j})`, "y");
718
- var mt = (t) => {
719
- if (t >= 30 && t <= 37 || t >= 90 && t <= 97)
720
- return 39;
721
- if (t >= 40 && t <= 47 || t >= 100 && t <= 107)
722
- return 49;
723
- if (t === 1 || t === 2)
724
- return 22;
725
- if (t === 3)
726
- return 23;
727
- if (t === 4)
728
- return 24;
729
- if (t === 7)
730
- return 27;
731
- if (t === 8)
732
- return 28;
733
- if (t === 9)
734
- return 29;
735
- if (t === 0)
736
- return 0;
737
- };
738
- var st = (t) => `${W}${Q}${t}${tt}`;
739
- var it = (t) => `${W}${U}${t}${j}`;
740
- var gt = (t) => t.map((e) => S(e));
741
- var G = (t, e, s) => {
742
- const i = e[Symbol.iterator]();
743
- let r = false, n = false, u = t.at(-1), a = u === undefined ? 0 : S(u), l = i.next(), E = i.next(), g = 0;
744
- for (;!l.done; ) {
745
- const m = l.value, A = S(m);
746
- a + A <= s ? t[t.length - 1] += m : (t.push(m), a = 0), (m === W || m === Z) && (r = true, n = e.startsWith(U, g + 1)), r ? n ? m === j && (r = false, n = false) : m === tt && (r = false) : (a += A, a === s && !E.done && (t.push(""), a = 0)), l = E, E = i.next(), g += m.length;
747
- }
748
- u = t.at(-1), !a && u !== undefined && u.length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
749
- };
750
- var vt = (t) => {
751
- const e = t.split(" ");
752
- let s = e.length;
753
- for (;s > 0 && !(S(e[s - 1]) > 0); )
754
- s--;
755
- return s === e.length ? t : e.slice(0, s).join(" ") + e.slice(s).join("");
756
- };
757
- var Et = (t, e, s = {}) => {
758
- if (s.trim !== false && t.trim() === "")
759
- return "";
760
- let i = "", r, n;
761
- const u = t.split(" "), a = gt(u);
762
- let l = [""];
763
- for (const [h, o] of u.entries()) {
764
- s.trim !== false && (l[l.length - 1] = (l.at(-1) ?? "").trimStart());
765
- let p = S(l.at(-1) ?? "");
766
- if (h !== 0 && (p >= e && (s.wordWrap === false || s.trim === false) && (l.push(""), p = 0), (p > 0 || s.trim === false) && (l[l.length - 1] += " ", p++)), s.hard && a[h] > e) {
767
- const v = e - p, F = 1 + Math.floor((a[h] - v - 1) / e);
768
- Math.floor((a[h] - 1) / e) < F && l.push(""), G(l, o, e);
769
- continue;
770
1422
  }
771
- if (p + a[h] > e && p > 0 && a[h] > 0) {
772
- if (s.wordWrap === false && p < e) {
773
- G(l, o, e);
774
- continue;
775
- }
776
- l.push("");
1423
+ } }).prompt();
1424
+ }, Ge = (t) => import_picocolors2.default.dim(t), ke = (t, r, s) => {
1425
+ const i = { hard: true, trim: false }, a = J2(t, r, i).split(`
1426
+ `), o = a.reduce((n, c) => Math.max(M2(c), n), 0), u = a.map(s).reduce((n, c) => Math.max(M2(c), n), 0), l = r - (u - o);
1427
+ return J2(t, l, i);
1428
+ }, Ve = (t = "", r = "", s) => {
1429
+ const i = s?.output ?? N2.stdout, a = s?.withGuide ?? _.withGuide, o = s?.format ?? Ge, u = ["", ...ke(t, rt(i) - 6, o).split(`
1430
+ `).map(o), ""], l = M2(r), n = Math.max(u.reduce((p, E) => {
1431
+ const $ = M2(E);
1432
+ return $ > p ? $ : p;
1433
+ }, 0), l) + 2, c = u.map((p) => `${import_picocolors2.default.gray(d)} ${p}${" ".repeat(n - M2(p))}${import_picocolors2.default.gray(d)}`).join(`
1434
+ `), g = a ? `${import_picocolors2.default.gray(d)}
1435
+ ` : "", F = a ? Wt2 : gt2;
1436
+ i.write(`${g}${import_picocolors2.default.green(V)} ${import_picocolors2.default.reset(r)} ${import_picocolors2.default.gray(rt2.repeat(Math.max(n - l - 1, 1)) + mt2)}
1437
+ ${c}
1438
+ ${import_picocolors2.default.gray(F + rt2.repeat(n + 2) + pt2)}
1439
+ `);
1440
+ }, He = (t) => new Mt({ validate: t.validate, mask: t.mask ?? Nt, signal: t.signal, input: t.input, output: t.output, render() {
1441
+ const r = t.withGuide ?? _.withGuide, s = `${r ? `${import_picocolors2.default.gray(d)}
1442
+ ` : ""}${W2(this.state)} ${t.message}
1443
+ `, i = this.userInputWithCursor, a = this.masked;
1444
+ switch (this.state) {
1445
+ case "error": {
1446
+ const o = r ? `${import_picocolors2.default.yellow(d)} ` : "", u = r ? `${import_picocolors2.default.yellow(x2)} ` : "", l = a ?? "";
1447
+ return t.clearOnError && this.clear(), `${s.trim()}
1448
+ ${o}${l}
1449
+ ${u}${import_picocolors2.default.yellow(this.error)}
1450
+ `;
777
1451
  }
778
- if (p + a[h] > e && s.wordWrap === false) {
779
- G(l, o, e);
780
- continue;
1452
+ case "submit": {
1453
+ const o = r ? `${import_picocolors2.default.gray(d)} ` : "", u = a ? import_picocolors2.default.dim(a) : "";
1454
+ return `${s}${o}${u}`;
781
1455
  }
782
- l[l.length - 1] += o;
783
- }
784
- s.trim !== false && (l = l.map((h) => vt(h)));
785
- const E = l.join(`
786
- `), g = E[Symbol.iterator]();
787
- let m = g.next(), A = g.next(), V = 0;
788
- for (;!m.done; ) {
789
- const h = m.value, o = A.value;
790
- if (i += h, h === W || h === Z) {
791
- et.lastIndex = V + 1;
792
- const F = et.exec(E)?.groups;
793
- if (F?.code !== undefined) {
794
- const d = Number.parseFloat(F.code);
795
- r = d === Ft ? undefined : d;
796
- } else
797
- F?.uri !== undefined && (n = F.uri.length === 0 ? undefined : F.uri);
1456
+ case "cancel": {
1457
+ const o = r ? `${import_picocolors2.default.gray(d)} ` : "", u = a ? import_picocolors2.default.strikethrough(import_picocolors2.default.dim(a)) : "";
1458
+ return `${s}${o}${u}${a && r ? `
1459
+ ${import_picocolors2.default.gray(d)}` : ""}`;
798
1460
  }
799
- const p = r ? mt(r) : undefined;
800
- o === `
801
- ` ? (n && (i += it("")), r && p && (i += st(p))) : h === `
802
- ` && (r && p && (i += st(r)), n && (i += it(n))), V += h.length, m = A, A = g.next();
803
- }
804
- return i;
805
- };
806
- function K(t, e, s) {
807
- return String(t).normalize().replaceAll(`\r
808
- `, `
809
- `).split(`
810
- `).map((i) => Et(i, e, s)).join(`
811
- `);
812
- }
813
- var At = ["up", "down", "left", "right", "space", "enter", "cancel"];
814
- var _ = { actions: new Set(At), aliases: new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["\x03", "cancel"], ["escape", "cancel"]]), messages: { cancel: "Canceled", error: "Something went wrong" }, withGuide: true };
815
- function H(t, e) {
816
- if (typeof t == "string")
817
- return _.aliases.get(t) === e;
818
- for (const s of t)
819
- if (s !== undefined && H(s, e))
820
- return true;
821
- return false;
822
- }
823
- function _t(t, e) {
824
- if (t === e)
825
- return;
826
- const s = t.split(`
827
- `), i = e.split(`
828
- `), r = Math.max(s.length, i.length), n = [];
829
- for (let u = 0;u < r; u++)
830
- s[u] !== i[u] && n.push(u);
831
- return { lines: n, numLinesBefore: s.length, numLinesAfter: i.length, numLines: r };
832
- }
833
- var bt = globalThis.process.platform.startsWith("win");
834
- var z = Symbol("clack:cancel");
835
- function Ct(t) {
836
- return t === z;
837
- }
838
- function T(t, e) {
839
- const s = t;
840
- s.isTTY && s.setRawMode(e);
841
- }
842
- function Bt({ input: t = q, output: e = R, overwrite: s = true, hideCursor: i = true } = {}) {
843
- const r = k.createInterface({ input: t, output: e, prompt: "", tabSize: 1 });
844
- k.emitKeypressEvents(t, r), t instanceof J && t.isTTY && t.setRawMode(true);
845
- const n = (u, { name: a, sequence: l }) => {
846
- const E = String(u);
847
- if (H([E, a, l], "cancel")) {
848
- i && e.write(import_sisteransi.cursor.show), process.exit(0);
849
- return;
1461
+ default: {
1462
+ const o = r ? `${import_picocolors2.default.cyan(d)} ` : "", u = r ? import_picocolors2.default.cyan(x2) : "";
1463
+ return `${s}${o}${i}
1464
+ ${u}
1465
+ `;
850
1466
  }
851
- if (!s)
1467
+ }
1468
+ } }).prompt(), Ue = (t) => {
1469
+ const r = t.validate;
1470
+ return Xt({ ...t, initialUserInput: t.initialValue ?? t.root ?? process.cwd(), maxItems: 5, validate(s) {
1471
+ if (!Array.isArray(s)) {
1472
+ if (!s)
1473
+ return "Please select a path";
1474
+ if (r)
1475
+ return r(s);
1476
+ }
1477
+ }, options() {
1478
+ const s = this.userInput;
1479
+ if (s === "")
1480
+ return [];
1481
+ try {
1482
+ let i;
1483
+ return $e(s) ? xt2(s).isDirectory() ? i = s : i = _t2(s) : i = _t2(s), de(i).map((a) => {
1484
+ const o = he(i, a), u = xt2(o);
1485
+ return { name: a, path: o, isDirectory: u.isDirectory() };
1486
+ }).filter(({ path: a, isDirectory: o }) => a.startsWith(s) && (t.directory || !o)).map((a) => ({ value: a.path }));
1487
+ } catch {
1488
+ return [];
1489
+ }
1490
+ } });
1491
+ }, Ke, bt2 = ({ indicator: t = "dots", onCancel: r, output: s = process.stdout, cancelMessage: i, errorMessage: a, frames: o = et2 ? ["◒", "◐", "◓", "◑"] : ["•", "o", "O", "0"], delay: u = et2 ? 80 : 120, signal: l, ...n } = {}) => {
1492
+ const c = ct2();
1493
+ let g, F, p = false, E = false, $ = "", m, h = performance.now();
1494
+ const y2 = rt(s), f = n?.styleFrame ?? Ke, v = (b) => {
1495
+ const O2 = b > 1 ? a ?? _.messages.error : i ?? _.messages.cancel;
1496
+ E = b === 1, p && (L2(O2, b), E && typeof r == "function" && r());
1497
+ }, S2 = () => v(2), I2 = () => v(1), B2 = () => {
1498
+ process.on("uncaughtExceptionMonitor", S2), process.on("unhandledRejection", S2), process.on("SIGINT", I2), process.on("SIGTERM", I2), process.on("exit", v), l && l.addEventListener("abort", I2);
1499
+ }, A = () => {
1500
+ process.removeListener("uncaughtExceptionMonitor", S2), process.removeListener("unhandledRejection", S2), process.removeListener("SIGINT", I2), process.removeListener("SIGTERM", I2), process.removeListener("exit", v), l && l.removeEventListener("abort", I2);
1501
+ }, w = () => {
1502
+ if (m === undefined)
852
1503
  return;
853
- const g = a === "return" ? 0 : -1, m = a === "return" ? -1 : 0;
854
- k.moveCursor(e, g, m, () => {
855
- k.clearLine(e, 1, () => {
856
- t.once("keypress", n);
857
- });
858
- });
1504
+ c && s.write(`
1505
+ `);
1506
+ const b = J2(m, y2, { hard: true, trim: false }).split(`
1507
+ `);
1508
+ b.length > 1 && s.write(import_sisteransi2.cursor.up(b.length - 1)), s.write(import_sisteransi2.cursor.to(0)), s.write(import_sisteransi2.erase.down());
1509
+ }, _2 = (b) => b.replace(/\.+$/, ""), D2 = (b) => {
1510
+ const O2 = (performance.now() - b) / 1000, j2 = Math.floor(O2 / 60), G2 = Math.floor(O2 % 60);
1511
+ return j2 > 0 ? `[${j2}m ${G2}s]` : `[${G2}s]`;
1512
+ }, T2 = n.withGuide ?? _.withGuide, Y = (b = "") => {
1513
+ p = true, g = Bt({ output: s }), $ = _2(b), h = performance.now(), T2 && s.write(`${import_picocolors2.default.gray(d)}
1514
+ `);
1515
+ let O2 = 0, j2 = 0;
1516
+ B2(), F = setInterval(() => {
1517
+ if (c && $ === m)
1518
+ return;
1519
+ w(), m = $;
1520
+ const G2 = f(o[O2]);
1521
+ let tt2;
1522
+ if (c)
1523
+ tt2 = `${G2} ${$}...`;
1524
+ else if (t === "timer")
1525
+ tt2 = `${G2} ${$} ${D2(h)}`;
1526
+ else {
1527
+ const te = ".".repeat(Math.floor(j2)).slice(0, 3);
1528
+ tt2 = `${G2} ${$}${te}`;
1529
+ }
1530
+ const Zt = J2(tt2, y2, { hard: true, trim: false });
1531
+ s.write(Zt), O2 = O2 + 1 < o.length ? O2 + 1 : 0, j2 = j2 < 4 ? j2 + 0.125 : 0;
1532
+ }, u);
1533
+ }, L2 = (b = "", O2 = 0, j2 = false) => {
1534
+ if (!p)
1535
+ return;
1536
+ p = false, clearInterval(F), w();
1537
+ const G2 = O2 === 0 ? import_picocolors2.default.green(V) : O2 === 1 ? import_picocolors2.default.red(dt2) : import_picocolors2.default.red($t2);
1538
+ $ = b ?? $, j2 || (t === "timer" ? s.write(`${G2} ${$} ${D2(h)}
1539
+ `) : s.write(`${G2} ${$}
1540
+ `)), A(), g();
859
1541
  };
860
- return i && e.write(import_sisteransi.cursor.hide), t.once("keypress", n), () => {
861
- t.off("keypress", n), i && e.write(import_sisteransi.cursor.show), t instanceof J && t.isTTY && !bt && t.setRawMode(false), r.terminal = false, r.close();
1542
+ return { start: Y, stop: (b = "") => L2(b, 0), message: (b = "") => {
1543
+ $ = _2(b ?? $);
1544
+ }, cancel: (b = "") => L2(b, 1), error: (b = "") => L2(b, 2), clear: () => L2("", 0, true), get isCancelled() {
1545
+ return E;
1546
+ } };
1547
+ }, zt, lt2 = (t, r) => t.includes(`
1548
+ `) ? t.split(`
1549
+ `).map((s) => r(s)).join(`
1550
+ `) : r(t), Je = (t) => {
1551
+ const r = (s, i) => {
1552
+ const a = s.label ?? String(s.value);
1553
+ switch (i) {
1554
+ case "disabled":
1555
+ return `${import_picocolors2.default.gray(H2)} ${lt2(a, import_picocolors2.default.gray)}${s.hint ? ` ${import_picocolors2.default.dim(`(${s.hint ?? "disabled"})`)}` : ""}`;
1556
+ case "selected":
1557
+ return `${lt2(a, import_picocolors2.default.dim)}`;
1558
+ case "active":
1559
+ return `${import_picocolors2.default.green(Q2)} ${a}${s.hint ? ` ${import_picocolors2.default.dim(`(${s.hint})`)}` : ""}`;
1560
+ case "cancelled":
1561
+ return `${lt2(a, (o) => import_picocolors2.default.strikethrough(import_picocolors2.default.dim(o)))}`;
1562
+ default:
1563
+ return `${import_picocolors2.default.dim(H2)} ${lt2(a, import_picocolors2.default.dim)}`;
1564
+ }
862
1565
  };
863
- }
864
- var rt = (t) => ("columns" in t) && typeof t.columns == "number" ? t.columns : 80;
865
- var nt = (t) => ("rows" in t) && typeof t.rows == "number" ? t.rows : 20;
866
- function xt(t, e, s, i = s) {
867
- const r = rt(t ?? R);
868
- return K(e, r - s.length, { hard: true, trim: false }).split(`
869
- `).map((n, u) => `${u === 0 ? i : s}${n}`).join(`
870
- `);
871
- }
872
-
873
- class x {
874
- input;
875
- output;
876
- _abortSignal;
877
- rl;
878
- opts;
879
- _render;
880
- _track = false;
881
- _prevFrame = "";
882
- _subscribers = new Map;
883
- _cursor = 0;
884
- state = "initial";
885
- error = "";
886
- value;
887
- userInput = "";
888
- constructor(e, s = true) {
889
- const { input: i = q, output: r = R, render: n, signal: u, ...a } = e;
890
- this.opts = a, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = n.bind(this), this._track = s, this._abortSignal = u, this.input = i, this.output = r;
891
- }
892
- unsubscribe() {
893
- this._subscribers.clear();
894
- }
895
- setSubscriber(e, s) {
896
- const i = this._subscribers.get(e) ?? [];
897
- i.push(s), this._subscribers.set(e, i);
898
- }
899
- on(e, s) {
900
- this.setSubscriber(e, { cb: s });
901
- }
902
- once(e, s) {
903
- this.setSubscriber(e, { cb: s, once: true });
904
- }
905
- emit(e, ...s) {
906
- const i = this._subscribers.get(e) ?? [], r = [];
907
- for (const n of i)
908
- n.cb(...s), n.once && r.push(() => i.splice(i.indexOf(n), 1));
909
- for (const n of r)
910
- n();
911
- }
912
- prompt() {
913
- return new Promise((e) => {
914
- if (this._abortSignal) {
915
- if (this._abortSignal.aborted)
916
- return this.state = "cancel", this.close(), e(z);
917
- this._abortSignal.addEventListener("abort", () => {
918
- this.state = "cancel", this.close();
919
- }, { once: true });
1566
+ return new Wt({ options: t.options, signal: t.signal, input: t.input, output: t.output, initialValue: t.initialValue, render() {
1567
+ const s = t.withGuide ?? _.withGuide, i = `${W2(this.state)} `, a = `${vt2(this.state)} `, o = xt(t.output, t.message, a, i), u = `${s ? `${import_picocolors2.default.gray(d)}
1568
+ ` : ""}${o}
1569
+ `;
1570
+ switch (this.state) {
1571
+ case "submit": {
1572
+ const l = s ? `${import_picocolors2.default.gray(d)} ` : "", n = xt(t.output, r(this.options[this.cursor], "selected"), l);
1573
+ return `${u}${n}`;
920
1574
  }
921
- this.rl = ot.createInterface({ input: this.input, tabSize: 2, prompt: "", escapeCodeTimeout: 50, terminal: true }), this.rl.prompt(), this.opts.initialUserInput !== undefined && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), T(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
922
- this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), T(this.input, false), e(this.value);
923
- }), this.once("cancel", () => {
924
- this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), T(this.input, false), e(z);
925
- });
926
- });
927
- }
928
- _isActionKey(e, s) {
929
- return e === "\t";
930
- }
931
- _setValue(e) {
932
- this.value = e, this.emit("value", this.value);
933
- }
934
- _setUserInput(e, s) {
935
- this.userInput = e ?? "", this.emit("userInput", this.userInput), s && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
936
- }
937
- _clearUserInput() {
938
- this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
939
- }
940
- onKeypress(e, s) {
941
- if (this._track && s.name !== "return" && (s.name && this._isActionKey(e, s) && this.rl?.write(null, { ctrl: true, name: "h" }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), s?.name && (!this._track && _.aliases.has(s.name) && this.emit("cursor", _.aliases.get(s.name)), _.actions.has(s.name) && this.emit("cursor", s.name)), e && (e.toLowerCase() === "y" || e.toLowerCase() === "n") && this.emit("confirm", e.toLowerCase() === "y"), this.emit("key", e?.toLowerCase(), s), s?.name === "return") {
942
- if (this.opts.validate) {
943
- const i = this.opts.validate(this.value);
944
- i && (this.error = i instanceof Error ? i.message : i, this.state = "error", this.rl?.write(this.userInput));
1575
+ case "cancel": {
1576
+ const l = s ? `${import_picocolors2.default.gray(d)} ` : "", n = xt(t.output, r(this.options[this.cursor], "cancelled"), l);
1577
+ return `${u}${n}${s ? `
1578
+ ${import_picocolors2.default.gray(d)}` : ""}`;
1579
+ }
1580
+ default: {
1581
+ const l = s ? `${import_picocolors2.default.cyan(d)} ` : "", n = s ? import_picocolors2.default.cyan(x2) : "", c = u.split(`
1582
+ `).length, g = s ? 2 : 1;
1583
+ return `${u}${l}${X2({ output: t.output, cursor: this.cursor, options: this.options, maxItems: t.maxItems, columnPadding: l.length, rowPadding: c + g, style: (F, p) => r(F, F.disabled ? "disabled" : p ? "active" : "inactive") }).join(`
1584
+ ${l}`)}
1585
+ ${n}
1586
+ `;
945
1587
  }
946
- this.state !== "error" && (this.state = "submit");
947
1588
  }
948
- H([e, s?.name, s?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
949
- }
950
- close() {
951
- this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
952
- `), T(this.input, false), this.rl?.close(), this.rl = undefined, this.emit(`${this.state}`, this.value), this.unsubscribe();
953
- }
954
- restoreCursor() {
955
- const e = K(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
956
- `).length - 1;
957
- this.output.write(import_sisteransi.cursor.move(-999, e * -1));
958
- }
959
- render() {
960
- const e = K(this._render(this) ?? "", process.stdout.columns, { hard: true, trim: false });
961
- if (e !== this._prevFrame) {
962
- if (this.state === "initial")
963
- this.output.write(import_sisteransi.cursor.hide);
964
- else {
965
- const s = _t(this._prevFrame, e), i = nt(this.output);
966
- if (this.restoreCursor(), s) {
967
- const r = Math.max(0, s.numLinesAfter - i), n = Math.max(0, s.numLinesBefore - i);
968
- let u = s.lines.find((a) => a >= r);
969
- if (u === undefined) {
970
- this._prevFrame = e;
971
- return;
972
- }
973
- if (s.lines.length === 1) {
974
- this.output.write(import_sisteransi.cursor.move(0, u - n)), this.output.write(import_sisteransi.erase.lines(1));
975
- const a = e.split(`
1589
+ } }).prompt();
1590
+ }, Xe = (t) => {
1591
+ const r = (s, i = "inactive") => {
1592
+ const a = s.label ?? String(s.value);
1593
+ return i === "selected" ? `${import_picocolors2.default.dim(a)}` : i === "cancelled" ? `${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(a))}` : i === "active" ? `${import_picocolors2.default.bgCyan(import_picocolors2.default.gray(` ${s.value} `))} ${a}${s.hint ? ` ${import_picocolors2.default.dim(`(${s.hint})`)}` : ""}` : `${import_picocolors2.default.gray(import_picocolors2.default.bgWhite(import_picocolors2.default.inverse(` ${s.value} `)))} ${a}${s.hint ? ` ${import_picocolors2.default.dim(`(${s.hint})`)}` : ""}`;
1594
+ };
1595
+ return new Tt({ options: t.options, signal: t.signal, input: t.input, output: t.output, initialValue: t.initialValue, caseSensitive: t.caseSensitive, render() {
1596
+ const s = t.withGuide ?? _.withGuide, i = `${s ? `${import_picocolors2.default.gray(d)}
1597
+ ` : ""}${W2(this.state)} ${t.message}
1598
+ `;
1599
+ switch (this.state) {
1600
+ case "submit": {
1601
+ const a = s ? `${import_picocolors2.default.gray(d)} ` : "", o = this.options.find((l) => l.value === this.value) ?? t.options[0], u = xt(t.output, r(o, "selected"), a);
1602
+ return `${i}${u}`;
1603
+ }
1604
+ case "cancel": {
1605
+ const a = s ? `${import_picocolors2.default.gray(d)} ` : "", o = xt(t.output, r(this.options[0], "cancelled"), a);
1606
+ return `${i}${o}${s ? `
1607
+ ${import_picocolors2.default.gray(d)}` : ""}`;
1608
+ }
1609
+ default: {
1610
+ const a = s ? `${import_picocolors2.default.cyan(d)} ` : "", o = s ? import_picocolors2.default.cyan(x2) : "", u = this.options.map((l, n) => xt(t.output, r(l, n === this.cursor ? "active" : "inactive"), a)).join(`
976
1611
  `);
977
- this.output.write(a[u]), this._prevFrame = e, this.output.write(import_sisteransi.cursor.move(0, a.length - u - 1));
978
- return;
979
- } else if (s.lines.length > 1) {
980
- if (r < n)
981
- u = r;
982
- else {
983
- const l = u - n;
984
- l > 0 && this.output.write(import_sisteransi.cursor.move(0, l));
985
- }
986
- this.output.write(import_sisteransi.erase.down());
987
- const a = e.split(`
988
- `).slice(u);
989
- this.output.write(a.join(`
990
- `)), this._prevFrame = e;
991
- return;
992
- }
993
- }
994
- this.output.write(import_sisteransi.erase.down());
1612
+ return `${i}${u}
1613
+ ${o}
1614
+ `;
995
1615
  }
996
- this.output.write(e), this.state === "initial" && (this.state = "active"), this._prevFrame = e;
1616
+ }
1617
+ } }).prompt();
1618
+ }, Qt, K2, Ye = async (t, r) => {
1619
+ for (const s of t) {
1620
+ if (s.enabled === false)
1621
+ continue;
1622
+ const i = bt2(r);
1623
+ i.start(s.title);
1624
+ const a = await s.task(i.message);
1625
+ i.stop(a || s.title);
1626
+ }
1627
+ }, ze = (t) => t.replace(/\x1b\[(?:\d+;)*\d*[ABCDEFGHfJKSTsu]|\x1b\[(s|u)/g, ""), Qe = (t) => {
1628
+ const r = t.output ?? process.stdout, s = rt(r), i = import_picocolors2.default.gray(d), a = t.spacing ?? 1, o = 3, u = t.retainLog === true, l = !ct2() && Mt2(r);
1629
+ r.write(`${i}
1630
+ `), r.write(`${import_picocolors2.default.green(V)} ${t.title}
1631
+ `);
1632
+ for (let h = 0;h < a; h++)
1633
+ r.write(`${i}
1634
+ `);
1635
+ const n = [{ value: "", full: "" }];
1636
+ let c = false;
1637
+ const g = (h) => {
1638
+ if (n.length === 0)
1639
+ return;
1640
+ let y2 = 0;
1641
+ h && (y2 += a + 2);
1642
+ for (const f of n) {
1643
+ const { value: v, result: S2 } = f;
1644
+ let I2 = S2?.message ?? v;
1645
+ if (I2.length === 0)
1646
+ continue;
1647
+ S2 === undefined && f.header !== undefined && f.header !== "" && (I2 += `
1648
+ ${f.header}`);
1649
+ const B2 = I2.split(`
1650
+ `).reduce((A, w) => w === "" ? A + 1 : A + Math.ceil((w.length + o) / s), 0);
1651
+ y2 += B2;
1652
+ }
1653
+ y2 > 0 && (y2 += 1, r.write(import_sisteransi2.erase.lines(y2)));
1654
+ }, F = (h, y2, f) => {
1655
+ const v = f ? `${h.full}
1656
+ ${h.value}` : h.value;
1657
+ h.header !== undefined && h.header !== "" && R2.message(h.header.split(`
1658
+ `).map(import_picocolors2.default.bold), { output: r, secondarySymbol: i, symbol: i, spacing: 0 }), R2.message(v.split(`
1659
+ `).map(import_picocolors2.default.dim), { output: r, secondarySymbol: i, symbol: i, spacing: y2 ?? a });
1660
+ }, p = () => {
1661
+ for (const h of n) {
1662
+ const { header: y2, value: f, full: v } = h;
1663
+ (y2 === undefined || y2.length === 0) && f.length === 0 || F(h, undefined, u === true && v.length > 0);
1664
+ }
1665
+ }, E = (h, y2, f) => {
1666
+ if (g(false), (f?.raw !== true || !c) && h.value !== "" && (h.value += `
1667
+ `), h.value += ze(y2), c = f?.raw === true, t.limit !== undefined) {
1668
+ const v = h.value.split(`
1669
+ `), S2 = v.length - t.limit;
1670
+ if (S2 > 0) {
1671
+ const I2 = v.splice(0, S2);
1672
+ u && (h.full += (h.full === "" ? "" : `
1673
+ `) + I2.join(`
1674
+ `));
1675
+ }
1676
+ h.value = v.join(`
1677
+ `);
1678
+ }
1679
+ l && $();
1680
+ }, $ = () => {
1681
+ for (const h of n)
1682
+ h.result ? h.result.status === "error" ? R2.error(h.result.message, { output: r, secondarySymbol: i, spacing: 0 }) : R2.success(h.result.message, { output: r, secondarySymbol: i, spacing: 0 }) : h.value !== "" && F(h, 0);
1683
+ }, m = (h, y2) => {
1684
+ g(false), h.result = y2, l && $();
1685
+ };
1686
+ return { message(h, y2) {
1687
+ E(n[0], h, y2);
1688
+ }, group(h) {
1689
+ const y2 = { header: h, value: "", full: "" };
1690
+ return n.push(y2), { message(f, v) {
1691
+ E(y2, f, v);
1692
+ }, error(f) {
1693
+ m(y2, { status: "error", message: f });
1694
+ }, success(f) {
1695
+ m(y2, { status: "success", message: f });
1696
+ } };
1697
+ }, error(h, y2) {
1698
+ g(true), R2.error(h, { output: r, secondarySymbol: i, spacing: 1 }), y2?.showLog !== false && p(), n.splice(1, n.length - 1), n[0].value = "", n[0].full = "";
1699
+ }, success(h, y2) {
1700
+ g(true), R2.success(h, { output: r, secondarySymbol: i, spacing: 1 }), y2?.showLog === true && p(), n.splice(1, n.length - 1), n[0].value = "", n[0].full = "";
1701
+ } };
1702
+ }, Ze = (t) => new $t({ validate: t.validate, placeholder: t.placeholder, defaultValue: t.defaultValue, initialValue: t.initialValue, output: t.output, signal: t.signal, input: t.input, render() {
1703
+ const r = t?.withGuide ?? _.withGuide, s = `${`${r ? `${import_picocolors2.default.gray(d)}
1704
+ ` : ""}${W2(this.state)} `}${t.message}
1705
+ `, i = t.placeholder ? import_picocolors2.default.inverse(t.placeholder[0]) + import_picocolors2.default.dim(t.placeholder.slice(1)) : import_picocolors2.default.inverse(import_picocolors2.default.hidden("_")), a = this.userInput ? this.userInputWithCursor : i, o = this.value ?? "";
1706
+ switch (this.state) {
1707
+ case "error": {
1708
+ const u = this.error ? ` ${import_picocolors2.default.yellow(this.error)}` : "", l = r ? `${import_picocolors2.default.yellow(d)} ` : "", n = r ? import_picocolors2.default.yellow(x2) : "";
1709
+ return `${s.trim()}
1710
+ ${l}${a}
1711
+ ${n}${u}
1712
+ `;
1713
+ }
1714
+ case "submit": {
1715
+ const u = o ? ` ${import_picocolors2.default.dim(o)}` : "", l = r ? import_picocolors2.default.gray(d) : "";
1716
+ return `${s}${l}${u}`;
1717
+ }
1718
+ case "cancel": {
1719
+ const u = o ? ` ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(o))}` : "", l = r ? import_picocolors2.default.gray(d) : "";
1720
+ return `${s}${l}${u}${o.trim() ? `
1721
+ ${l}` : ""}`;
1722
+ }
1723
+ default: {
1724
+ const u = r ? `${import_picocolors2.default.cyan(d)} ` : "", l = r ? import_picocolors2.default.cyan(x2) : "";
1725
+ return `${s}${u}${a}
1726
+ ${l}
1727
+ `;
997
1728
  }
998
1729
  }
999
- }
1000
- function wt(t, e) {
1001
- if (t === undefined || e.length === 0)
1002
- return 0;
1003
- const s = e.findIndex((i) => i.value === t);
1004
- return s !== -1 ? s : 0;
1005
- }
1006
- function Dt(t, e) {
1007
- return (e.label ?? String(e.value)).toLowerCase().includes(t.toLowerCase());
1008
- }
1009
- function St(t, e) {
1010
- if (e)
1011
- return t ? e : e[0];
1012
- }
1730
+ } }).prompt();
1731
+ var init_dist2 = __esm(() => {
1732
+ init_dist();
1733
+ init_dist();
1734
+ import_picocolors2 = __toESM(require_picocolors(), 1);
1735
+ import_sisteransi2 = __toESM(require_src(), 1);
1736
+ et2 = me();
1737
+ Rt = C("◆", "*");
1738
+ dt2 = C("■", "x");
1739
+ $t2 = C("▲", "x");
1740
+ V = C("◇", "o");
1741
+ ht2 = C("┌", "T");
1742
+ d = C("│", "|");
1743
+ x2 = C("└", "—");
1744
+ Ot = C("┐", "T");
1745
+ Pt = C("┘", "—");
1746
+ Q2 = C("●", ">");
1747
+ H2 = C("○", " ");
1748
+ st2 = C("◻", "[•]");
1749
+ U2 = C("◼", "[+]");
1750
+ q2 = C("◻", "[ ]");
1751
+ Nt = C("▪", "•");
1752
+ rt2 = C("─", "-");
1753
+ mt2 = C("╮", "+");
1754
+ Wt2 = C("├", "+");
1755
+ pt2 = C("╯", "+");
1756
+ gt2 = C("╰", "+");
1757
+ Lt2 = C("╭", "+");
1758
+ ft2 = C("●", "•");
1759
+ Ft2 = C("◆", "*");
1760
+ yt2 = C("▲", "!");
1761
+ Et2 = C("■", "x");
1762
+ At2 = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
1763
+ it2 = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
1764
+ nt2 = /\t{1,1000}/y;
1765
+ wt2 = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu;
1766
+ at2 = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
1767
+ Fe = /\p{M}+/gu;
1768
+ ye = { limit: 1 / 0, ellipsis: "" };
1769
+ Ee = { limit: 1 / 0, ellipsis: "", ellipsisWidth: 0 };
1770
+ St2 = `${Ae}8;;`;
1771
+ Ht = new RegExp(`(?:\\${kt2}(?<code>\\d+)m|\\${St2}(?<uri>.*)${Ct2})`, "y");
1772
+ _e = [Lt2, mt2, gt2, pt2];
1773
+ De = [ht2, Ot, x2, Pt];
1774
+ R2 = { message: (t = [], { symbol: r = import_picocolors2.default.gray(d), secondarySymbol: s = import_picocolors2.default.gray(d), output: i = process.stdout, spacing: a = 1, withGuide: o } = {}) => {
1775
+ const u = [], l = o ?? _.withGuide, n = l ? s : "", c = l ? `${r} ` : "", g = l ? `${s} ` : "";
1776
+ for (let p = 0;p < a; p++)
1777
+ u.push(n);
1778
+ const F = Array.isArray(t) ? t : t.split(`
1779
+ `);
1780
+ if (F.length > 0) {
1781
+ const [p, ...E] = F;
1782
+ p.length > 0 ? u.push(`${c}${p}`) : u.push(l ? r : "");
1783
+ for (const $ of E)
1784
+ $.length > 0 ? u.push(`${g}${$}`) : u.push(l ? s : "");
1785
+ }
1786
+ i.write(`${u.join(`
1787
+ `)}
1788
+ `);
1789
+ }, info: (t, r) => {
1790
+ R2.message(t, { ...r, symbol: import_picocolors2.default.blue(ft2) });
1791
+ }, success: (t, r) => {
1792
+ R2.message(t, { ...r, symbol: import_picocolors2.default.green(Ft2) });
1793
+ }, step: (t, r) => {
1794
+ R2.message(t, { ...r, symbol: import_picocolors2.default.green(V) });
1795
+ }, warn: (t, r) => {
1796
+ R2.message(t, { ...r, symbol: import_picocolors2.default.yellow(yt2) });
1797
+ }, warning: (t, r) => {
1798
+ R2.warn(t, r);
1799
+ }, error: (t, r) => {
1800
+ R2.message(t, { ...r, symbol: import_picocolors2.default.red(Et2) });
1801
+ } };
1802
+ Ke = import_picocolors2.default.magenta;
1803
+ zt = { light: C("─", "-"), heavy: C("━", "="), block: C("█", "#") };
1804
+ Qt = `${import_picocolors2.default.gray(d)} `;
1805
+ K2 = { message: async (t, { symbol: r = import_picocolors2.default.gray(d) } = {}) => {
1806
+ process.stdout.write(`${import_picocolors2.default.gray(d)}
1807
+ ${r} `);
1808
+ let s = 3;
1809
+ for await (let i of t) {
1810
+ i = i.replace(/\n/g, `
1811
+ ${Qt}`), i.includes(`
1812
+ `) && (s = 3 + ut(i.slice(i.lastIndexOf(`
1813
+ `))).length);
1814
+ const a = ut(i).length;
1815
+ s + a < process.stdout.columns ? (s += a, process.stdout.write(i)) : (process.stdout.write(`
1816
+ ${Qt}${i.trimStart()}`), s = 3 + ut(i.trimStart()).length);
1817
+ }
1818
+ process.stdout.write(`
1819
+ `);
1820
+ }, info: (t) => K2.message(t, { symbol: import_picocolors2.default.blue(ft2) }), success: (t) => K2.message(t, { symbol: import_picocolors2.default.green(Ft2) }), step: (t) => K2.message(t, { symbol: import_picocolors2.default.green(V) }), warn: (t) => K2.message(t, { symbol: import_picocolors2.default.yellow(yt2) }), warning: (t) => K2.warn(t), error: (t) => K2.message(t, { symbol: import_picocolors2.default.red(Et2) }) };
1821
+ });
1013
1822
 
1014
- class Vt extends x {
1015
- filteredOptions;
1016
- multiple;
1017
- isNavigating = false;
1018
- selectedValues = [];
1019
- focusedValue;
1020
- #t = 0;
1021
- #s = "";
1022
- #i;
1023
- #e;
1024
- get cursor() {
1025
- return this.#t;
1026
- }
1027
- get userInputWithCursor() {
1028
- if (!this.userInput)
1029
- return import_picocolors.default.inverse(import_picocolors.default.hidden("_"));
1030
- if (this._cursor >= this.userInput.length)
1031
- return `${this.userInput}█`;
1032
- const e = this.userInput.slice(0, this._cursor), [s, ...i] = this.userInput.slice(this._cursor);
1033
- return `${e}${import_picocolors.default.inverse(s)}${i.join("")}`;
1034
- }
1035
- get options() {
1036
- return typeof this.#e == "function" ? this.#e() : this.#e;
1037
- }
1038
- constructor(e) {
1039
- super(e), this.#e = e.options;
1040
- const s = this.options;
1041
- this.filteredOptions = [...s], this.multiple = e.multiple === true, this.#i = e.filter ?? Dt;
1042
- let i;
1043
- if (e.initialValue && Array.isArray(e.initialValue) ? this.multiple ? i = e.initialValue : i = e.initialValue.slice(0, 1) : !this.multiple && this.options.length > 0 && (i = [this.options[0].value]), i)
1044
- for (const r of i) {
1045
- const n = s.findIndex((u) => u.value === r);
1046
- n !== -1 && (this.toggleSelected(r), this.#t = n);
1823
+ // node_modules/isexe/windows.js
1824
+ var require_windows = __commonJS((exports, module) => {
1825
+ module.exports = isexe;
1826
+ isexe.sync = sync;
1827
+ var fs = __require("fs");
1828
+ function checkPathExt(path, options) {
1829
+ var pathext = options.pathExt !== undefined ? options.pathExt : process.env.PATHEXT;
1830
+ if (!pathext) {
1831
+ return true;
1832
+ }
1833
+ pathext = pathext.split(";");
1834
+ if (pathext.indexOf("") !== -1) {
1835
+ return true;
1836
+ }
1837
+ for (var i = 0;i < pathext.length; i++) {
1838
+ var p = pathext[i].toLowerCase();
1839
+ if (p && path.substr(-p.length).toLowerCase() === p) {
1840
+ return true;
1047
1841
  }
1048
- this.focusedValue = this.options[this.#t]?.value, this.on("key", (r, n) => this.#r(r, n)), this.on("userInput", (r) => this.#n(r));
1049
- }
1050
- _isActionKey(e, s) {
1051
- return e === "\t" || this.multiple && this.isNavigating && s.name === "space" && e !== undefined && e !== "";
1052
- }
1053
- #r(e, s) {
1054
- const i = s.name === "up", r = s.name === "down", n = s.name === "return";
1055
- i || r ? (this.#t = B(this.#t, i ? -1 : 1, this.filteredOptions), this.focusedValue = this.filteredOptions[this.#t]?.value, this.multiple || (this.selectedValues = [this.focusedValue]), this.isNavigating = true) : n ? this.value = St(this.multiple, this.selectedValues) : this.multiple ? this.focusedValue !== undefined && (s.name === "tab" || this.isNavigating && s.name === "space") ? this.toggleSelected(this.focusedValue) : this.isNavigating = false : (this.focusedValue && (this.selectedValues = [this.focusedValue]), this.isNavigating = false);
1056
- }
1057
- deselectAll() {
1058
- this.selectedValues = [];
1059
- }
1060
- toggleSelected(e) {
1061
- this.filteredOptions.length !== 0 && (this.multiple ? this.selectedValues.includes(e) ? this.selectedValues = this.selectedValues.filter((s) => s !== e) : this.selectedValues = [...this.selectedValues, e] : this.selectedValues = [e]);
1062
- }
1063
- #n(e) {
1064
- if (e !== this.#s) {
1065
- this.#s = e;
1066
- const s = this.options;
1067
- e ? this.filteredOptions = s.filter((n) => this.#i(e, n)) : this.filteredOptions = [...s];
1068
- const i = wt(this.focusedValue, this.filteredOptions);
1069
- this.#t = B(i, 0, this.filteredOptions);
1070
- const r = this.filteredOptions[this.#t];
1071
- r && !r.disabled ? this.focusedValue = r.value : this.focusedValue = undefined, this.multiple || (this.focusedValue !== undefined ? this.toggleSelected(this.focusedValue) : this.deselectAll());
1072
1842
  }
1843
+ return false;
1073
1844
  }
1074
- }
1075
-
1076
- class kt extends x {
1077
- get cursor() {
1078
- return this.value ? 0 : 1;
1079
- }
1080
- get _value() {
1081
- return this.cursor === 0;
1845
+ function checkStat(stat, path, options) {
1846
+ if (!stat.isSymbolicLink() && !stat.isFile()) {
1847
+ return false;
1848
+ }
1849
+ return checkPathExt(path, options);
1082
1850
  }
1083
- constructor(e) {
1084
- super(e, false), this.value = !!e.initialValue, this.on("userInput", () => {
1085
- this.value = this._value;
1086
- }), this.on("confirm", (s) => {
1087
- this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = s, this.state = "submit", this.close();
1088
- }), this.on("cursor", () => {
1089
- this.value = !this.value;
1851
+ function isexe(path, options, cb) {
1852
+ fs.stat(path, function(er, stat) {
1853
+ cb(er, er ? false : checkStat(stat, path, options));
1090
1854
  });
1091
1855
  }
1092
- }
1093
-
1094
- class yt extends x {
1095
- options;
1096
- cursor = 0;
1097
- #t;
1098
- getGroupItems(e) {
1099
- return this.options.filter((s) => s.group === e);
1100
- }
1101
- isGroupSelected(e) {
1102
- const s = this.getGroupItems(e), i = this.value;
1103
- return i === undefined ? false : s.every((r) => i.includes(r.value));
1104
- }
1105
- toggleValue() {
1106
- const e = this.options[this.cursor];
1107
- if (this.value === undefined && (this.value = []), e.group === true) {
1108
- const s = e.value, i = this.getGroupItems(s);
1109
- this.isGroupSelected(s) ? this.value = this.value.filter((r) => i.findIndex((n) => n.value === r) === -1) : this.value = [...this.value, ...i.map((r) => r.value)], this.value = Array.from(new Set(this.value));
1110
- } else {
1111
- const s = this.value.includes(e.value);
1112
- this.value = s ? this.value.filter((i) => i !== e.value) : [...this.value, e.value];
1113
- }
1114
- }
1115
- constructor(e) {
1116
- super(e, false);
1117
- const { options: s } = e;
1118
- this.#t = e.selectableGroups !== false, this.options = Object.entries(s).flatMap(([i, r]) => [{ value: i, group: true, label: i }, ...r.map((n) => ({ ...n, group: i }))]), this.value = [...e.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: i }) => i === e.cursorAt), this.#t ? 0 : 1), this.on("cursor", (i) => {
1119
- switch (i) {
1120
- case "left":
1121
- case "up": {
1122
- this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
1123
- const r = this.options[this.cursor]?.group === true;
1124
- !this.#t && r && (this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1);
1125
- break;
1126
- }
1127
- case "down":
1128
- case "right": {
1129
- this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
1130
- const r = this.options[this.cursor]?.group === true;
1131
- !this.#t && r && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
1132
- break;
1133
- }
1134
- case "space":
1135
- this.toggleValue();
1136
- break;
1137
- }
1138
- });
1856
+ function sync(path, options) {
1857
+ return checkStat(fs.statSync(path), path, options);
1139
1858
  }
1140
- }
1859
+ });
1141
1860
 
1142
- class Lt extends x {
1143
- options;
1144
- cursor = 0;
1145
- get _value() {
1146
- return this.options[this.cursor].value;
1147
- }
1148
- get _enabledOptions() {
1149
- return this.options.filter((e) => e.disabled !== true);
1150
- }
1151
- toggleAll() {
1152
- const e = this._enabledOptions, s = this.value !== undefined && this.value.length === e.length;
1153
- this.value = s ? [] : e.map((i) => i.value);
1154
- }
1155
- toggleInvert() {
1156
- const e = this.value;
1157
- if (!e)
1158
- return;
1159
- const s = this._enabledOptions.filter((i) => !e.includes(i.value));
1160
- this.value = s.map((i) => i.value);
1161
- }
1162
- toggleValue() {
1163
- this.value === undefined && (this.value = []);
1164
- const e = this.value.includes(this._value);
1165
- this.value = e ? this.value.filter((s) => s !== this._value) : [...this.value, this._value];
1166
- }
1167
- constructor(e) {
1168
- super(e, false), this.options = e.options, this.value = [...e.initialValues ?? []];
1169
- const s = Math.max(this.options.findIndex(({ value: i }) => i === e.cursorAt), 0);
1170
- this.cursor = this.options[s].disabled ? B(s, 1, this.options) : s, this.on("key", (i) => {
1171
- i === "a" && this.toggleAll(), i === "i" && this.toggleInvert();
1172
- }), this.on("cursor", (i) => {
1173
- switch (i) {
1174
- case "left":
1175
- case "up":
1176
- this.cursor = B(this.cursor, -1, this.options);
1177
- break;
1178
- case "down":
1179
- case "right":
1180
- this.cursor = B(this.cursor, 1, this.options);
1181
- break;
1182
- case "space":
1183
- this.toggleValue();
1184
- break;
1185
- }
1186
- });
1187
- }
1188
- }
1189
- var Mt = class extends x {
1190
- _mask = "•";
1191
- get cursor() {
1192
- return this._cursor;
1193
- }
1194
- get masked() {
1195
- return this.userInput.replaceAll(/./g, this._mask);
1196
- }
1197
- get userInputWithCursor() {
1198
- if (this.state === "submit" || this.state === "cancel")
1199
- return this.masked;
1200
- const e = this.userInput;
1201
- if (this.cursor >= e.length)
1202
- return `${this.masked}${import_picocolors.default.inverse(import_picocolors.default.hidden("_"))}`;
1203
- const s = this.masked, i = s.slice(0, this.cursor), r = s.slice(this.cursor);
1204
- return `${i}${import_picocolors.default.inverse(r[0])}${r.slice(1)}`;
1205
- }
1206
- clear() {
1207
- this._clearUserInput();
1208
- }
1209
- constructor({ mask: e, ...s }) {
1210
- super(s), this._mask = e ?? "•", this.on("userInput", (i) => {
1211
- this._setValue(i);
1861
+ // node_modules/isexe/mode.js
1862
+ var require_mode = __commonJS((exports, module) => {
1863
+ module.exports = isexe;
1864
+ isexe.sync = sync;
1865
+ var fs = __require("fs");
1866
+ function isexe(path, options, cb) {
1867
+ fs.stat(path, function(er, stat) {
1868
+ cb(er, er ? false : checkStat(stat, options));
1212
1869
  });
1213
1870
  }
1214
- };
1215
-
1216
- class Wt extends x {
1217
- options;
1218
- cursor = 0;
1219
- get _selectedValue() {
1220
- return this.options[this.cursor];
1221
- }
1222
- changeValue() {
1223
- this.value = this._selectedValue.value;
1871
+ function sync(path, options) {
1872
+ return checkStat(fs.statSync(path), options);
1224
1873
  }
1225
- constructor(e) {
1226
- super(e, false), this.options = e.options;
1227
- const s = this.options.findIndex(({ value: r }) => r === e.initialValue), i = s === -1 ? 0 : s;
1228
- this.cursor = this.options[i].disabled ? B(i, 1, this.options) : i, this.changeValue(), this.on("cursor", (r) => {
1229
- switch (r) {
1230
- case "left":
1231
- case "up":
1232
- this.cursor = B(this.cursor, -1, this.options);
1233
- break;
1234
- case "down":
1235
- case "right":
1236
- this.cursor = B(this.cursor, 1, this.options);
1237
- break;
1238
- }
1239
- this.changeValue();
1240
- });
1874
+ function checkStat(stat, options) {
1875
+ return stat.isFile() && checkMode(stat, options);
1241
1876
  }
1242
- }
1243
- class $t extends x {
1244
- get userInputWithCursor() {
1245
- if (this.state === "submit")
1246
- return this.userInput;
1247
- const e = this.userInput;
1248
- if (this.cursor >= e.length)
1249
- return `${this.userInput}█`;
1250
- const s = e.slice(0, this.cursor), [i, ...r] = e.slice(this.cursor);
1251
- return `${s}${import_picocolors.default.inverse(i)}${r.join("")}`;
1252
- }
1253
- get cursor() {
1254
- return this._cursor;
1255
- }
1256
- constructor(e) {
1257
- super({ ...e, initialUserInput: e.initialUserInput ?? e.initialValue }), this.on("userInput", (s) => {
1258
- this._setValue(s);
1259
- }), this.on("finalize", () => {
1260
- this.value || (this.value = e.defaultValue), this.value === undefined && (this.value = "");
1261
- });
1877
+ function checkMode(stat, options) {
1878
+ var mod = stat.mode;
1879
+ var uid = stat.uid;
1880
+ var gid = stat.gid;
1881
+ var myUid = options.uid !== undefined ? options.uid : process.getuid && process.getuid();
1882
+ var myGid = options.gid !== undefined ? options.gid : process.getgid && process.getgid();
1883
+ var u = parseInt("100", 8);
1884
+ var g = parseInt("010", 8);
1885
+ var o = parseInt("001", 8);
1886
+ var ug = u | g;
1887
+ var ret = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
1888
+ return ret;
1262
1889
  }
1263
- }
1890
+ });
1264
1891
 
1265
- // node_modules/@clack/prompts/dist/index.mjs
1266
- var import_picocolors2 = __toESM(require_picocolors(), 1);
1267
- import N2 from "node:process";
1268
- var import_sisteransi2 = __toESM(require_src(), 1);
1269
- function me() {
1270
- return N2.platform !== "win32" ? N2.env.TERM !== "linux" : !!N2.env.CI || !!N2.env.WT_SESSION || !!N2.env.TERMINUS_SUBLIME || N2.env.ConEmuTask === "{cmd::Cmder}" || N2.env.TERM_PROGRAM === "Terminus-Sublime" || N2.env.TERM_PROGRAM === "vscode" || N2.env.TERM === "xterm-256color" || N2.env.TERM === "alacritty" || N2.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
1271
- }
1272
- var et2 = me();
1273
- var ct2 = () => process.env.CI === "true";
1274
- var C = (t, r) => et2 ? t : r;
1275
- var Rt = C("◆", "*");
1276
- var dt2 = C("■", "x");
1277
- var $t2 = C("▲", "x");
1278
- var V = C("◇", "o");
1279
- var ht2 = C("┌", "T");
1280
- var d = C("│", "|");
1281
- var x2 = C("└", "—");
1282
- var Ot = C("┐", "T");
1283
- var Pt = C("┘", "—");
1284
- var Q2 = C("●", ">");
1285
- var H2 = C("○", " ");
1286
- var st2 = C("◻", "[•]");
1287
- var U2 = C("◼", "[+]");
1288
- var q2 = C("◻", "[ ]");
1289
- var Nt = C("▪", "•");
1290
- var rt2 = C("─", "-");
1291
- var mt2 = C("╮", "+");
1292
- var Wt2 = C("├", "+");
1293
- var pt2 = C("╯", "+");
1294
- var gt2 = C("╰", "+");
1295
- var Lt2 = C("╭", "+");
1296
- var ft2 = C("●", "•");
1297
- var Ft2 = C("◆", "*");
1298
- var yt2 = C("▲", "!");
1299
- var Et2 = C("■", "x");
1300
- var W2 = (t) => {
1301
- switch (t) {
1302
- case "initial":
1303
- case "active":
1304
- return import_picocolors2.default.cyan(Rt);
1305
- case "cancel":
1306
- return import_picocolors2.default.red(dt2);
1307
- case "error":
1308
- return import_picocolors2.default.yellow($t2);
1309
- case "submit":
1310
- return import_picocolors2.default.green(V);
1311
- }
1312
- };
1313
- var vt2 = (t) => {
1314
- switch (t) {
1315
- case "initial":
1316
- case "active":
1317
- return import_picocolors2.default.cyan(d);
1318
- case "cancel":
1319
- return import_picocolors2.default.red(d);
1320
- case "error":
1321
- return import_picocolors2.default.yellow(d);
1322
- case "submit":
1323
- return import_picocolors2.default.green(d);
1892
+ // node_modules/isexe/index.js
1893
+ var require_isexe = __commonJS((exports, module) => {
1894
+ var fs = __require("fs");
1895
+ var core;
1896
+ if (process.platform === "win32" || global.TESTING_WINDOWS) {
1897
+ core = require_windows();
1898
+ } else {
1899
+ core = require_mode();
1324
1900
  }
1325
- };
1326
- var pe = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 170 || t === 173 || t === 174 || t >= 176 && t <= 180 || t >= 182 && t <= 186 || t >= 188 && t <= 191 || t === 198 || t === 208 || t === 215 || t === 216 || t >= 222 && t <= 225 || t === 230 || t >= 232 && t <= 234 || t === 236 || t === 237 || t === 240 || t === 242 || t === 243 || t >= 247 && t <= 250 || t === 252 || t === 254 || t === 257 || t === 273 || t === 275 || t === 283 || t === 294 || t === 295 || t === 299 || t >= 305 && t <= 307 || t === 312 || t >= 319 && t <= 322 || t === 324 || t >= 328 && t <= 331 || t === 333 || t === 338 || t === 339 || t === 358 || t === 359 || t === 363 || t === 462 || t === 464 || t === 466 || t === 468 || t === 470 || t === 472 || t === 474 || t === 476 || t === 593 || t === 609 || t === 708 || t === 711 || t >= 713 && t <= 715 || t === 717 || t === 720 || t >= 728 && t <= 731 || t === 733 || t === 735 || t >= 768 && t <= 879 || t >= 913 && t <= 929 || t >= 931 && t <= 937 || t >= 945 && t <= 961 || t >= 963 && t <= 969 || t === 1025 || t >= 1040 && t <= 1103 || t === 1105 || t === 8208 || t >= 8211 && t <= 8214 || t === 8216 || t === 8217 || t === 8220 || t === 8221 || t >= 8224 && t <= 8226 || t >= 8228 && t <= 8231 || t === 8240 || t === 8242 || t === 8243 || t === 8245 || t === 8251 || t === 8254 || t === 8308 || t === 8319 || t >= 8321 && t <= 8324 || t === 8364 || t === 8451 || t === 8453 || t === 8457 || t === 8467 || t === 8470 || t === 8481 || t === 8482 || t === 8486 || t === 8491 || t === 8531 || t === 8532 || t >= 8539 && t <= 8542 || t >= 8544 && t <= 8555 || t >= 8560 && t <= 8569 || t === 8585 || t >= 8592 && t <= 8601 || t === 8632 || t === 8633 || t === 8658 || t === 8660 || t === 8679 || t === 8704 || t === 8706 || t === 8707 || t === 8711 || t === 8712 || t === 8715 || t === 8719 || t === 8721 || t === 8725 || t === 8730 || t >= 8733 && t <= 8736 || t === 8739 || t === 8741 || t >= 8743 && t <= 8748 || t === 8750 || t >= 8756 && t <= 8759 || t === 8764 || t === 8765 || t === 8776 || t === 8780 || t === 8786 || t === 8800 || t === 8801 || t >= 8804 && t <= 8807 || t === 8810 || t === 8811 || t === 8814 || t === 8815 || t === 8834 || t === 8835 || t === 8838 || t === 8839 || t === 8853 || t === 8857 || t === 8869 || t === 8895 || t === 8978 || t >= 9312 && t <= 9449 || t >= 9451 && t <= 9547 || t >= 9552 && t <= 9587 || t >= 9600 && t <= 9615 || t >= 9618 && t <= 9621 || t === 9632 || t === 9633 || t >= 9635 && t <= 9641 || t === 9650 || t === 9651 || t === 9654 || t === 9655 || t === 9660 || t === 9661 || t === 9664 || t === 9665 || t >= 9670 && t <= 9672 || t === 9675 || t >= 9678 && t <= 9681 || t >= 9698 && t <= 9701 || t === 9711 || t === 9733 || t === 9734 || t === 9737 || t === 9742 || t === 9743 || t === 9756 || t === 9758 || t === 9792 || t === 9794 || t === 9824 || t === 9825 || t >= 9827 && t <= 9829 || t >= 9831 && t <= 9834 || t === 9836 || t === 9837 || t === 9839 || t === 9886 || t === 9887 || t === 9919 || t >= 9926 && t <= 9933 || t >= 9935 && t <= 9939 || t >= 9941 && t <= 9953 || t === 9955 || t === 9960 || t === 9961 || t >= 9963 && t <= 9969 || t === 9972 || t >= 9974 && t <= 9977 || t === 9979 || t === 9980 || t === 9982 || t === 9983 || t === 10045 || t >= 10102 && t <= 10111 || t >= 11094 && t <= 11097 || t >= 12872 && t <= 12879 || t >= 57344 && t <= 63743 || t >= 65024 && t <= 65039 || t === 65533 || t >= 127232 && t <= 127242 || t >= 127248 && t <= 127277 || t >= 127280 && t <= 127337 || t >= 127344 && t <= 127373 || t === 127375 || t === 127376 || t >= 127387 && t <= 127404 || t >= 917760 && t <= 917999 || t >= 983040 && t <= 1048573 || t >= 1048576 && t <= 1114109;
1327
- var ge = (t) => t === 12288 || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510;
1328
- var fe = (t) => t >= 4352 && t <= 4447 || t === 8986 || t === 8987 || t === 9001 || t === 9002 || t >= 9193 && t <= 9196 || t === 9200 || t === 9203 || t === 9725 || t === 9726 || t === 9748 || t === 9749 || t >= 9800 && t <= 9811 || t === 9855 || t === 9875 || t === 9889 || t === 9898 || t === 9899 || t === 9917 || t === 9918 || t === 9924 || t === 9925 || t === 9934 || t === 9940 || t === 9962 || t === 9970 || t === 9971 || t === 9973 || t === 9978 || t === 9981 || t === 9989 || t === 9994 || t === 9995 || t === 10024 || t === 10060 || t === 10062 || t >= 10067 && t <= 10069 || t === 10071 || t >= 10133 && t <= 10135 || t === 10160 || t === 10175 || t === 11035 || t === 11036 || t === 11088 || t === 11093 || t >= 11904 && t <= 11929 || t >= 11931 && t <= 12019 || t >= 12032 && t <= 12245 || t >= 12272 && t <= 12287 || t >= 12289 && t <= 12350 || t >= 12353 && t <= 12438 || t >= 12441 && t <= 12543 || t >= 12549 && t <= 12591 || t >= 12593 && t <= 12686 || t >= 12688 && t <= 12771 || t >= 12783 && t <= 12830 || t >= 12832 && t <= 12871 || t >= 12880 && t <= 19903 || t >= 19968 && t <= 42124 || t >= 42128 && t <= 42182 || t >= 43360 && t <= 43388 || t >= 44032 && t <= 55203 || t >= 63744 && t <= 64255 || t >= 65040 && t <= 65049 || t >= 65072 && t <= 65106 || t >= 65108 && t <= 65126 || t >= 65128 && t <= 65131 || t >= 94176 && t <= 94180 || t === 94192 || t === 94193 || t >= 94208 && t <= 100343 || t >= 100352 && t <= 101589 || t >= 101632 && t <= 101640 || t >= 110576 && t <= 110579 || t >= 110581 && t <= 110587 || t === 110589 || t === 110590 || t >= 110592 && t <= 110882 || t === 110898 || t >= 110928 && t <= 110930 || t === 110933 || t >= 110948 && t <= 110951 || t >= 110960 && t <= 111355 || t === 126980 || t === 127183 || t === 127374 || t >= 127377 && t <= 127386 || t >= 127488 && t <= 127490 || t >= 127504 && t <= 127547 || t >= 127552 && t <= 127560 || t === 127568 || t === 127569 || t >= 127584 && t <= 127589 || t >= 127744 && t <= 127776 || t >= 127789 && t <= 127797 || t >= 127799 && t <= 127868 || t >= 127870 && t <= 127891 || t >= 127904 && t <= 127946 || t >= 127951 && t <= 127955 || t >= 127968 && t <= 127984 || t === 127988 || t >= 127992 && t <= 128062 || t === 128064 || t >= 128066 && t <= 128252 || t >= 128255 && t <= 128317 || t >= 128331 && t <= 128334 || t >= 128336 && t <= 128359 || t === 128378 || t === 128405 || t === 128406 || t === 128420 || t >= 128507 && t <= 128591 || t >= 128640 && t <= 128709 || t === 128716 || t >= 128720 && t <= 128722 || t >= 128725 && t <= 128727 || t >= 128732 && t <= 128735 || t === 128747 || t === 128748 || t >= 128756 && t <= 128764 || t >= 128992 && t <= 129003 || t === 129008 || t >= 129292 && t <= 129338 || t >= 129340 && t <= 129349 || t >= 129351 && t <= 129535 || t >= 129648 && t <= 129660 || t >= 129664 && t <= 129672 || t >= 129680 && t <= 129725 || t >= 129727 && t <= 129733 || t >= 129742 && t <= 129755 || t >= 129760 && t <= 129768 || t >= 129776 && t <= 129784 || t >= 131072 && t <= 196605 || t >= 196608 && t <= 262141;
1329
- var At2 = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
1330
- var it2 = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
1331
- var nt2 = /\t{1,1000}/y;
1332
- var wt2 = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu;
1333
- var at2 = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
1334
- var Fe = /\p{M}+/gu;
1335
- var ye = { limit: 1 / 0, ellipsis: "" };
1336
- var jt = (t, r = {}, s = {}) => {
1337
- const i = r.limit ?? 1 / 0, a = r.ellipsis ?? "", o = r?.ellipsisWidth ?? (a ? jt(a, ye, s).width : 0), u = s.ansiWidth ?? 0, l = s.controlWidth ?? 0, n = s.tabWidth ?? 8, c = s.ambiguousWidth ?? 1, g = s.emojiWidth ?? 2, F = s.fullWidthWidth ?? 2, p = s.regularWidth ?? 1, E = s.wideWidth ?? 2;
1338
- let $ = 0, m = 0, h = t.length, y2 = 0, f = false, v = h, S2 = Math.max(0, i - o), I2 = 0, B2 = 0, A = 0, w = 0;
1339
- t:
1340
- for (;; ) {
1341
- if (B2 > I2 || m >= h && m > $) {
1342
- const _2 = t.slice(I2, B2) || t.slice($, m);
1343
- y2 = 0;
1344
- for (const D2 of _2.replaceAll(Fe, "")) {
1345
- const T2 = D2.codePointAt(0) || 0;
1346
- if (ge(T2) ? w = F : fe(T2) ? w = E : c !== p && pe(T2) ? w = c : w = p, A + w > S2 && (v = Math.min(v, Math.max(I2, $) + y2)), A + w > i) {
1347
- f = true;
1348
- break t;
1349
- }
1350
- y2 += D2.length, A += w;
1351
- }
1352
- I2 = B2 = 0;
1353
- }
1354
- if (m >= h)
1355
- break;
1356
- if (at2.lastIndex = m, at2.test(t)) {
1357
- if (y2 = at2.lastIndex - m, w = y2 * p, A + w > S2 && (v = Math.min(v, m + Math.floor((S2 - A) / p))), A + w > i) {
1358
- f = true;
1359
- break;
1360
- }
1361
- A += w, I2 = $, B2 = m, m = $ = at2.lastIndex;
1362
- continue;
1363
- }
1364
- if (At2.lastIndex = m, At2.test(t)) {
1365
- if (A + u > S2 && (v = Math.min(v, m)), A + u > i) {
1366
- f = true;
1367
- break;
1368
- }
1369
- A += u, I2 = $, B2 = m, m = $ = At2.lastIndex;
1370
- continue;
1371
- }
1372
- if (it2.lastIndex = m, it2.test(t)) {
1373
- if (y2 = it2.lastIndex - m, w = y2 * l, A + w > S2 && (v = Math.min(v, m + Math.floor((S2 - A) / l))), A + w > i) {
1374
- f = true;
1375
- break;
1376
- }
1377
- A += w, I2 = $, B2 = m, m = $ = it2.lastIndex;
1378
- continue;
1379
- }
1380
- if (nt2.lastIndex = m, nt2.test(t)) {
1381
- if (y2 = nt2.lastIndex - m, w = y2 * n, A + w > S2 && (v = Math.min(v, m + Math.floor((S2 - A) / n))), A + w > i) {
1382
- f = true;
1383
- break;
1384
- }
1385
- A += w, I2 = $, B2 = m, m = $ = nt2.lastIndex;
1386
- continue;
1901
+ module.exports = isexe;
1902
+ isexe.sync = sync;
1903
+ function isexe(path, options, cb) {
1904
+ if (typeof options === "function") {
1905
+ cb = options;
1906
+ options = {};
1907
+ }
1908
+ if (!cb) {
1909
+ if (typeof Promise !== "function") {
1910
+ throw new TypeError("callback not provided");
1387
1911
  }
1388
- if (wt2.lastIndex = m, wt2.test(t)) {
1389
- if (A + g > S2 && (v = Math.min(v, m)), A + g > i) {
1390
- f = true;
1391
- break;
1912
+ return new Promise(function(resolve, reject) {
1913
+ isexe(path, options || {}, function(er, is) {
1914
+ if (er) {
1915
+ reject(er);
1916
+ } else {
1917
+ resolve(is);
1918
+ }
1919
+ });
1920
+ });
1921
+ }
1922
+ core(path, options || {}, function(er, is) {
1923
+ if (er) {
1924
+ if (er.code === "EACCES" || options && options.ignoreErrors) {
1925
+ er = null;
1926
+ is = false;
1392
1927
  }
1393
- A += g, I2 = $, B2 = m, m = $ = wt2.lastIndex;
1394
- continue;
1395
1928
  }
1396
- m += 1;
1929
+ cb(er, is);
1930
+ });
1931
+ }
1932
+ function sync(path, options) {
1933
+ try {
1934
+ return core.sync(path, options || {});
1935
+ } catch (er) {
1936
+ if (options && options.ignoreErrors || er.code === "EACCES") {
1937
+ return false;
1938
+ } else {
1939
+ throw er;
1940
+ }
1397
1941
  }
1398
- return { width: f ? S2 : A, index: f ? v : h, truncated: f, ellipsed: f && i >= o };
1399
- };
1400
- var Ee = { limit: 1 / 0, ellipsis: "", ellipsisWidth: 0 };
1401
- var M2 = (t, r = {}) => jt(t, Ee, r).width;
1402
- var ot2 = "\x1B";
1403
- var Gt = "›";
1404
- var ve = 39;
1405
- var Ct2 = "\x07";
1406
- var kt2 = "[";
1407
- var Ae = "]";
1408
- var Vt2 = "m";
1409
- var St2 = `${Ae}8;;`;
1410
- var Ht = new RegExp(`(?:\\${kt2}(?<code>\\d+)m|\\${St2}(?<uri>.*)${Ct2})`, "y");
1411
- var we = (t) => {
1412
- if (t >= 30 && t <= 37 || t >= 90 && t <= 97)
1413
- return 39;
1414
- if (t >= 40 && t <= 47 || t >= 100 && t <= 107)
1415
- return 49;
1416
- if (t === 1 || t === 2)
1417
- return 22;
1418
- if (t === 3)
1419
- return 23;
1420
- if (t === 4)
1421
- return 24;
1422
- if (t === 7)
1423
- return 27;
1424
- if (t === 8)
1425
- return 28;
1426
- if (t === 9)
1427
- return 29;
1428
- if (t === 0)
1429
- return 0;
1430
- };
1431
- var Ut = (t) => `${ot2}${kt2}${t}${Vt2}`;
1432
- var Kt = (t) => `${ot2}${St2}${t}${Ct2}`;
1433
- var Ce = (t) => t.map((r) => M2(r));
1434
- var It2 = (t, r, s) => {
1435
- const i = r[Symbol.iterator]();
1436
- let a = false, o = false, u = t.at(-1), l = u === undefined ? 0 : M2(u), n = i.next(), c = i.next(), g = 0;
1437
- for (;!n.done; ) {
1438
- const F = n.value, p = M2(F);
1439
- l + p <= s ? t[t.length - 1] += F : (t.push(F), l = 0), (F === ot2 || F === Gt) && (a = true, o = r.startsWith(St2, g + 1)), a ? o ? F === Ct2 && (a = false, o = false) : F === Vt2 && (a = false) : (l += p, l === s && !c.done && (t.push(""), l = 0)), n = c, c = i.next(), g += F.length;
1440
1942
  }
1441
- u = t.at(-1), !l && u !== undefined && u.length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
1442
- };
1443
- var Se = (t) => {
1444
- const r = t.split(" ");
1445
- let s = r.length;
1446
- for (;s > 0 && !(M2(r[s - 1]) > 0); )
1447
- s--;
1448
- return s === r.length ? t : r.slice(0, s).join(" ") + r.slice(s).join("");
1449
- };
1450
- var Ie = (t, r, s = {}) => {
1451
- if (s.trim !== false && t.trim() === "")
1452
- return "";
1453
- let i = "", a, o;
1454
- const u = t.split(" "), l = Ce(u);
1455
- let n = [""];
1456
- for (const [$, m] of u.entries()) {
1457
- s.trim !== false && (n[n.length - 1] = (n.at(-1) ?? "").trimStart());
1458
- let h = M2(n.at(-1) ?? "");
1459
- if ($ !== 0 && (h >= r && (s.wordWrap === false || s.trim === false) && (n.push(""), h = 0), (h > 0 || s.trim === false) && (n[n.length - 1] += " ", h++)), s.hard && l[$] > r) {
1460
- const y2 = r - h, f = 1 + Math.floor((l[$] - y2 - 1) / r);
1461
- Math.floor((l[$] - 1) / r) < f && n.push(""), It2(n, m, r);
1462
- continue;
1943
+ });
1944
+
1945
+ // node_modules/which/which.js
1946
+ var require_which = __commonJS((exports, module) => {
1947
+ var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
1948
+ var path = __require("path");
1949
+ var COLON = isWindows ? ";" : ":";
1950
+ var isexe = require_isexe();
1951
+ var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
1952
+ var getPathInfo = (cmd, opt) => {
1953
+ const colon = opt.colon || COLON;
1954
+ const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [
1955
+ ...isWindows ? [process.cwd()] : [],
1956
+ ...(opt.path || process.env.PATH || "").split(colon)
1957
+ ];
1958
+ const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
1959
+ const pathExt = isWindows ? pathExtExe.split(colon) : [""];
1960
+ if (isWindows) {
1961
+ if (cmd.indexOf(".") !== -1 && pathExt[0] !== "")
1962
+ pathExt.unshift("");
1463
1963
  }
1464
- if (h + l[$] > r && h > 0 && l[$] > 0) {
1465
- if (s.wordWrap === false && h < r) {
1466
- It2(n, m, r);
1467
- continue;
1964
+ return {
1965
+ pathEnv,
1966
+ pathExt,
1967
+ pathExtExe
1968
+ };
1969
+ };
1970
+ var which = (cmd, opt, cb) => {
1971
+ if (typeof opt === "function") {
1972
+ cb = opt;
1973
+ opt = {};
1974
+ }
1975
+ if (!opt)
1976
+ opt = {};
1977
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
1978
+ const found = [];
1979
+ const step = (i) => new Promise((resolve, reject) => {
1980
+ if (i === pathEnv.length)
1981
+ return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
1982
+ const ppRaw = pathEnv[i];
1983
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
1984
+ const pCmd = path.join(pathPart, cmd);
1985
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
1986
+ resolve(subStep(p, i, 0));
1987
+ });
1988
+ const subStep = (p, i, ii) => new Promise((resolve, reject) => {
1989
+ if (ii === pathExt.length)
1990
+ return resolve(step(i + 1));
1991
+ const ext = pathExt[ii];
1992
+ isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
1993
+ if (!er && is) {
1994
+ if (opt.all)
1995
+ found.push(p + ext);
1996
+ else
1997
+ return resolve(p + ext);
1998
+ }
1999
+ return resolve(subStep(p, i, ii + 1));
2000
+ });
2001
+ });
2002
+ return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
2003
+ };
2004
+ var whichSync = (cmd, opt) => {
2005
+ opt = opt || {};
2006
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
2007
+ const found = [];
2008
+ for (let i = 0;i < pathEnv.length; i++) {
2009
+ const ppRaw = pathEnv[i];
2010
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
2011
+ const pCmd = path.join(pathPart, cmd);
2012
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
2013
+ for (let j2 = 0;j2 < pathExt.length; j2++) {
2014
+ const cur = p + pathExt[j2];
2015
+ try {
2016
+ const is = isexe.sync(cur, { pathExt: pathExtExe });
2017
+ if (is) {
2018
+ if (opt.all)
2019
+ found.push(cur);
2020
+ else
2021
+ return cur;
2022
+ }
2023
+ } catch (ex) {}
1468
2024
  }
1469
- n.push("");
1470
2025
  }
1471
- if (h + l[$] > r && s.wordWrap === false) {
1472
- It2(n, m, r);
1473
- continue;
2026
+ if (opt.all && found.length)
2027
+ return found;
2028
+ if (opt.nothrow)
2029
+ return null;
2030
+ throw getNotFoundError(cmd);
2031
+ };
2032
+ module.exports = which;
2033
+ which.sync = whichSync;
2034
+ });
2035
+
2036
+ // node_modules/path-key/index.js
2037
+ var require_path_key = __commonJS((exports, module) => {
2038
+ var pathKey = (options = {}) => {
2039
+ const environment = options.env || process.env;
2040
+ const platform2 = options.platform || process.platform;
2041
+ if (platform2 !== "win32") {
2042
+ return "PATH";
1474
2043
  }
1475
- n[n.length - 1] += m;
1476
- }
1477
- s.trim !== false && (n = n.map(($) => Se($)));
1478
- const c = n.join(`
1479
- `), g = c[Symbol.iterator]();
1480
- let F = g.next(), p = g.next(), E = 0;
1481
- for (;!F.done; ) {
1482
- const $ = F.value, m = p.value;
1483
- if (i += $, $ === ot2 || $ === Gt) {
1484
- Ht.lastIndex = E + 1;
1485
- const f = Ht.exec(c)?.groups;
1486
- if (f?.code !== undefined) {
1487
- const v = Number.parseFloat(f.code);
1488
- a = v === ve ? undefined : v;
1489
- } else
1490
- f?.uri !== undefined && (o = f.uri.length === 0 ? undefined : f.uri);
2044
+ return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
2045
+ };
2046
+ module.exports = pathKey;
2047
+ module.exports.default = pathKey;
2048
+ });
2049
+
2050
+ // node_modules/cross-spawn/lib/util/resolveCommand.js
2051
+ var require_resolveCommand = __commonJS((exports, module) => {
2052
+ var path = __require("path");
2053
+ var which = require_which();
2054
+ var getPathKey = require_path_key();
2055
+ function resolveCommandAttempt(parsed, withoutPathExt) {
2056
+ const env = parsed.options.env || process.env;
2057
+ const cwd = process.cwd();
2058
+ const hasCustomCwd = parsed.options.cwd != null;
2059
+ const shouldSwitchCwd = hasCustomCwd && process.chdir !== undefined && !process.chdir.disabled;
2060
+ if (shouldSwitchCwd) {
2061
+ try {
2062
+ process.chdir(parsed.options.cwd);
2063
+ } catch (err) {}
1491
2064
  }
1492
- const h = a ? we(a) : undefined;
1493
- m === `
1494
- ` ? (o && (i += Kt("")), a && h && (i += Ut(h))) : $ === `
1495
- ` && (a && h && (i += Ut(a)), o && (i += Kt(o))), E += $.length, F = p, p = g.next();
1496
- }
1497
- return i;
1498
- };
1499
- function J2(t, r, s) {
1500
- return String(t).normalize().replaceAll(`\r
1501
- `, `
1502
- `).split(`
1503
- `).map((i) => Ie(i, r, s)).join(`
1504
- `);
1505
- }
1506
- var be = (t, r, s, i, a) => {
1507
- let o = r, u = 0;
1508
- for (let l = s;l < i; l++) {
1509
- const n = t[l];
1510
- if (o = o - n.length, u++, o <= a)
1511
- break;
1512
- }
1513
- return { lineCount: o, removals: u };
1514
- };
1515
- var X2 = (t) => {
1516
- const { cursor: r, options: s, style: i } = t, a = t.output ?? process.stdout, o = rt(a), u = t.columnPadding ?? 0, l = t.rowPadding ?? 4, n = o - u, c = nt(a), g = import_picocolors2.default.dim("..."), F = t.maxItems ?? Number.POSITIVE_INFINITY, p = Math.max(c - l, 0), E = Math.max(Math.min(F, p), 5);
1517
- let $ = 0;
1518
- r >= E - 3 && ($ = Math.max(Math.min(r - E + 3, s.length - E), 0));
1519
- let m = E < s.length && $ > 0, h = E < s.length && $ + E < s.length;
1520
- const y2 = Math.min($ + E, s.length), f = [];
1521
- let v = 0;
1522
- m && v++, h && v++;
1523
- const S2 = $ + (m ? 1 : 0), I2 = y2 - (h ? 1 : 0);
1524
- for (let A = S2;A < I2; A++) {
1525
- const w = J2(i(s[A], A === r), n, { hard: true, trim: false }).split(`
1526
- `);
1527
- f.push(w), v += w.length;
2065
+ let resolved;
2066
+ try {
2067
+ resolved = which.sync(parsed.command, {
2068
+ path: env[getPathKey({ env })],
2069
+ pathExt: withoutPathExt ? path.delimiter : undefined
2070
+ });
2071
+ } catch (e2) {} finally {
2072
+ if (shouldSwitchCwd) {
2073
+ process.chdir(cwd);
2074
+ }
2075
+ }
2076
+ if (resolved) {
2077
+ resolved = path.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
2078
+ }
2079
+ return resolved;
1528
2080
  }
1529
- if (v > p) {
1530
- let A = 0, w = 0, _2 = v;
1531
- const D2 = r - S2, T2 = (Y, L2) => be(f, _2, Y, L2, p);
1532
- m ? ({ lineCount: _2, removals: A } = T2(0, D2), _2 > p && ({ lineCount: _2, removals: w } = T2(D2 + 1, f.length))) : ({ lineCount: _2, removals: w } = T2(D2 + 1, f.length), _2 > p && ({ lineCount: _2, removals: A } = T2(0, D2))), A > 0 && (m = true, f.splice(0, A)), w > 0 && (h = true, f.splice(f.length - w, w));
2081
+ function resolveCommand(parsed) {
2082
+ return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
1533
2083
  }
1534
- const B2 = [];
1535
- m && B2.push(g);
1536
- for (const A of f)
1537
- for (const w of A)
1538
- B2.push(w);
1539
- return h && B2.push(g), B2;
1540
- };
1541
- var Re = (t) => {
1542
- const r = t.active ?? "Yes", s = t.inactive ?? "No";
1543
- return new kt({ active: r, inactive: s, signal: t.signal, input: t.input, output: t.output, initialValue: t.initialValue ?? true, render() {
1544
- const i = t.withGuide ?? _.withGuide, a = `${i ? `${import_picocolors2.default.gray(d)}
1545
- ` : ""}${W2(this.state)} ${t.message}
1546
- `, o = this.value ? r : s;
1547
- switch (this.state) {
1548
- case "submit": {
1549
- const u = i ? `${import_picocolors2.default.gray(d)} ` : "";
1550
- return `${a}${u}${import_picocolors2.default.dim(o)}`;
1551
- }
1552
- case "cancel": {
1553
- const u = i ? `${import_picocolors2.default.gray(d)} ` : "";
1554
- return `${a}${u}${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(o))}${i ? `
1555
- ${import_picocolors2.default.gray(d)}` : ""}`;
1556
- }
1557
- default: {
1558
- const u = i ? `${import_picocolors2.default.cyan(d)} ` : "", l = i ? import_picocolors2.default.cyan(x2) : "";
1559
- return `${a}${u}${this.value ? `${import_picocolors2.default.green(Q2)} ${r}` : `${import_picocolors2.default.dim(H2)} ${import_picocolors2.default.dim(r)}`}${t.vertical ? i ? `
1560
- ${import_picocolors2.default.cyan(d)} ` : `
1561
- ` : ` ${import_picocolors2.default.dim("/")} `}${this.value ? `${import_picocolors2.default.dim(H2)} ${import_picocolors2.default.dim(s)}` : `${import_picocolors2.default.green(Q2)} ${s}`}
1562
- ${l}
1563
- `;
1564
- }
2084
+ module.exports = resolveCommand;
2085
+ });
2086
+
2087
+ // node_modules/cross-spawn/lib/util/escape.js
2088
+ var require_escape = __commonJS((exports, module) => {
2089
+ var metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
2090
+ function escapeCommand(arg) {
2091
+ arg = arg.replace(metaCharsRegExp, "^$1");
2092
+ return arg;
2093
+ }
2094
+ function escapeArgument(arg, doubleEscapeMetaChars) {
2095
+ arg = `${arg}`;
2096
+ arg = arg.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"");
2097
+ arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
2098
+ arg = `"${arg}"`;
2099
+ arg = arg.replace(metaCharsRegExp, "^$1");
2100
+ if (doubleEscapeMetaChars) {
2101
+ arg = arg.replace(metaCharsRegExp, "^$1");
1565
2102
  }
1566
- } }).prompt();
1567
- };
1568
- var R2 = { message: (t = [], { symbol: r = import_picocolors2.default.gray(d), secondarySymbol: s = import_picocolors2.default.gray(d), output: i = process.stdout, spacing: a = 1, withGuide: o } = {}) => {
1569
- const u = [], l = o ?? _.withGuide, n = l ? s : "", c = l ? `${r} ` : "", g = l ? `${s} ` : "";
1570
- for (let p = 0;p < a; p++)
1571
- u.push(n);
1572
- const F = Array.isArray(t) ? t : t.split(`
1573
- `);
1574
- if (F.length > 0) {
1575
- const [p, ...E] = F;
1576
- p.length > 0 ? u.push(`${c}${p}`) : u.push(l ? r : "");
1577
- for (const $ of E)
1578
- $.length > 0 ? u.push(`${g}${$}`) : u.push(l ? s : "");
2103
+ return arg;
1579
2104
  }
1580
- i.write(`${u.join(`
1581
- `)}
1582
- `);
1583
- }, info: (t, r) => {
1584
- R2.message(t, { ...r, symbol: import_picocolors2.default.blue(ft2) });
1585
- }, success: (t, r) => {
1586
- R2.message(t, { ...r, symbol: import_picocolors2.default.green(Ft2) });
1587
- }, step: (t, r) => {
1588
- R2.message(t, { ...r, symbol: import_picocolors2.default.green(V) });
1589
- }, warn: (t, r) => {
1590
- R2.message(t, { ...r, symbol: import_picocolors2.default.yellow(yt2) });
1591
- }, warning: (t, r) => {
1592
- R2.warn(t, r);
1593
- }, error: (t, r) => {
1594
- R2.message(t, { ...r, symbol: import_picocolors2.default.red(Et2) });
1595
- } };
1596
- var Ne = (t = "", r) => {
1597
- (r?.output ?? process.stdout).write(`${import_picocolors2.default.gray(x2)} ${import_picocolors2.default.red(t)}
2105
+ exports.command = escapeCommand;
2106
+ exports.argument = escapeArgument;
2107
+ });
1598
2108
 
1599
- `);
1600
- };
1601
- var We = (t = "", r) => {
1602
- (r?.output ?? process.stdout).write(`${import_picocolors2.default.gray(ht2)} ${t}
1603
- `);
1604
- };
1605
- var Le = (t = "", r) => {
1606
- (r?.output ?? process.stdout).write(`${import_picocolors2.default.gray(d)}
1607
- ${import_picocolors2.default.gray(x2)} ${t}
2109
+ // node_modules/shebang-regex/index.js
2110
+ var require_shebang_regex = __commonJS((exports, module) => {
2111
+ module.exports = /^#!(.*)/;
2112
+ });
1608
2113
 
1609
- `);
1610
- };
1611
- var Z2 = (t, r) => t.split(`
1612
- `).map((s) => r(s)).join(`
1613
- `);
1614
- var je = (t) => {
1615
- const r = (i, a) => {
1616
- const o = i.label ?? String(i.value);
1617
- return a === "disabled" ? `${import_picocolors2.default.gray(q2)} ${Z2(o, (u) => import_picocolors2.default.strikethrough(import_picocolors2.default.gray(u)))}${i.hint ? ` ${import_picocolors2.default.dim(`(${i.hint ?? "disabled"})`)}` : ""}` : a === "active" ? `${import_picocolors2.default.cyan(st2)} ${o}${i.hint ? ` ${import_picocolors2.default.dim(`(${i.hint})`)}` : ""}` : a === "selected" ? `${import_picocolors2.default.green(U2)} ${Z2(o, import_picocolors2.default.dim)}${i.hint ? ` ${import_picocolors2.default.dim(`(${i.hint})`)}` : ""}` : a === "cancelled" ? `${Z2(o, (u) => import_picocolors2.default.strikethrough(import_picocolors2.default.dim(u)))}` : a === "active-selected" ? `${import_picocolors2.default.green(U2)} ${o}${i.hint ? ` ${import_picocolors2.default.dim(`(${i.hint})`)}` : ""}` : a === "submitted" ? `${Z2(o, import_picocolors2.default.dim)}` : `${import_picocolors2.default.dim(q2)} ${Z2(o, import_picocolors2.default.dim)}`;
1618
- }, s = t.required ?? true;
1619
- return new Lt({ options: t.options, signal: t.signal, input: t.input, output: t.output, initialValues: t.initialValues, required: s, cursorAt: t.cursorAt, validate(i) {
1620
- if (s && (i === undefined || i.length === 0))
1621
- return `Please select at least one option.
1622
- ${import_picocolors2.default.reset(import_picocolors2.default.dim(`Press ${import_picocolors2.default.gray(import_picocolors2.default.bgWhite(import_picocolors2.default.inverse(" space ")))} to select, ${import_picocolors2.default.gray(import_picocolors2.default.bgWhite(import_picocolors2.default.inverse(" enter ")))} to submit`))}`;
1623
- }, render() {
1624
- const i = xt(t.output, t.message, `${vt2(this.state)} `, `${W2(this.state)} `), a = `${import_picocolors2.default.gray(d)}
1625
- ${i}
1626
- `, o = this.value ?? [], u = (l, n) => {
1627
- if (l.disabled)
1628
- return r(l, "disabled");
1629
- const c = o.includes(l.value);
1630
- return n && c ? r(l, "active-selected") : c ? r(l, "selected") : r(l, n ? "active" : "inactive");
1631
- };
1632
- switch (this.state) {
1633
- case "submit": {
1634
- const l = this.options.filter(({ value: c }) => o.includes(c)).map((c) => r(c, "submitted")).join(import_picocolors2.default.dim(", ")) || import_picocolors2.default.dim("none"), n = xt(t.output, l, `${import_picocolors2.default.gray(d)} `);
1635
- return `${a}${n}`;
1636
- }
1637
- case "cancel": {
1638
- const l = this.options.filter(({ value: c }) => o.includes(c)).map((c) => r(c, "cancelled")).join(import_picocolors2.default.dim(", "));
1639
- if (l.trim() === "")
1640
- return `${a}${import_picocolors2.default.gray(d)}`;
1641
- const n = xt(t.output, l, `${import_picocolors2.default.gray(d)} `);
1642
- return `${a}${n}
1643
- ${import_picocolors2.default.gray(d)}`;
1644
- }
1645
- case "error": {
1646
- const l = `${import_picocolors2.default.yellow(d)} `, n = this.error.split(`
1647
- `).map((F, p) => p === 0 ? `${import_picocolors2.default.yellow(x2)} ${import_picocolors2.default.yellow(F)}` : ` ${F}`).join(`
1648
- `), c = a.split(`
1649
- `).length, g = n.split(`
1650
- `).length + 1;
1651
- return `${a}${l}${X2({ output: t.output, options: this.options, cursor: this.cursor, maxItems: t.maxItems, columnPadding: l.length, rowPadding: c + g, style: u }).join(`
1652
- ${l}`)}
1653
- ${n}
1654
- `;
1655
- }
1656
- default: {
1657
- const l = `${import_picocolors2.default.cyan(d)} `, n = a.split(`
1658
- `).length;
1659
- return `${a}${l}${X2({ output: t.output, options: this.options, cursor: this.cursor, maxItems: t.maxItems, columnPadding: l.length, rowPadding: n + 2, style: u }).join(`
1660
- ${l}`)}
1661
- ${import_picocolors2.default.cyan(x2)}
1662
- `;
1663
- }
1664
- }
1665
- } }).prompt();
1666
- };
1667
- var Ge = (t) => import_picocolors2.default.dim(t);
1668
- var ke = (t, r, s) => {
1669
- const i = { hard: true, trim: false }, a = J2(t, r, i).split(`
1670
- `), o = a.reduce((n, c) => Math.max(M2(c), n), 0), u = a.map(s).reduce((n, c) => Math.max(M2(c), n), 0), l = r - (u - o);
1671
- return J2(t, l, i);
1672
- };
1673
- var Ve = (t = "", r = "", s) => {
1674
- const i = s?.output ?? N2.stdout, a = s?.withGuide ?? _.withGuide, o = s?.format ?? Ge, u = ["", ...ke(t, rt(i) - 6, o).split(`
1675
- `).map(o), ""], l = M2(r), n = Math.max(u.reduce((p, E) => {
1676
- const $ = M2(E);
1677
- return $ > p ? $ : p;
1678
- }, 0), l) + 2, c = u.map((p) => `${import_picocolors2.default.gray(d)} ${p}${" ".repeat(n - M2(p))}${import_picocolors2.default.gray(d)}`).join(`
1679
- `), g = a ? `${import_picocolors2.default.gray(d)}
1680
- ` : "", F = a ? Wt2 : gt2;
1681
- i.write(`${g}${import_picocolors2.default.green(V)} ${import_picocolors2.default.reset(r)} ${import_picocolors2.default.gray(rt2.repeat(Math.max(n - l - 1, 1)) + mt2)}
1682
- ${c}
1683
- ${import_picocolors2.default.gray(F + rt2.repeat(n + 2) + pt2)}
1684
- `);
1685
- };
1686
- var He = (t) => new Mt({ validate: t.validate, mask: t.mask ?? Nt, signal: t.signal, input: t.input, output: t.output, render() {
1687
- const r = t.withGuide ?? _.withGuide, s = `${r ? `${import_picocolors2.default.gray(d)}
1688
- ` : ""}${W2(this.state)} ${t.message}
1689
- `, i = this.userInputWithCursor, a = this.masked;
1690
- switch (this.state) {
1691
- case "error": {
1692
- const o = r ? `${import_picocolors2.default.yellow(d)} ` : "", u = r ? `${import_picocolors2.default.yellow(x2)} ` : "", l = a ?? "";
1693
- return t.clearOnError && this.clear(), `${s.trim()}
1694
- ${o}${l}
1695
- ${u}${import_picocolors2.default.yellow(this.error)}
1696
- `;
1697
- }
1698
- case "submit": {
1699
- const o = r ? `${import_picocolors2.default.gray(d)} ` : "", u = a ? import_picocolors2.default.dim(a) : "";
1700
- return `${s}${o}${u}`;
1701
- }
1702
- case "cancel": {
1703
- const o = r ? `${import_picocolors2.default.gray(d)} ` : "", u = a ? import_picocolors2.default.strikethrough(import_picocolors2.default.dim(a)) : "";
1704
- return `${s}${o}${u}${a && r ? `
1705
- ${import_picocolors2.default.gray(d)}` : ""}`;
2114
+ // node_modules/shebang-command/index.js
2115
+ var require_shebang_command = __commonJS((exports, module) => {
2116
+ var shebangRegex = require_shebang_regex();
2117
+ module.exports = (string = "") => {
2118
+ const match = string.match(shebangRegex);
2119
+ if (!match) {
2120
+ return null;
1706
2121
  }
1707
- default: {
1708
- const o = r ? `${import_picocolors2.default.cyan(d)} ` : "", u = r ? import_picocolors2.default.cyan(x2) : "";
1709
- return `${s}${o}${i}
1710
- ${u}
1711
- `;
2122
+ const [path, argument] = match[0].replace(/#! ?/, "").split(" ");
2123
+ const binary = path.split("/").pop();
2124
+ if (binary === "env") {
2125
+ return argument;
1712
2126
  }
1713
- }
1714
- } }).prompt();
1715
- var Ke = import_picocolors2.default.magenta;
1716
- var bt2 = ({ indicator: t = "dots", onCancel: r, output: s = process.stdout, cancelMessage: i, errorMessage: a, frames: o = et2 ? ["◒", "◐", "◓", "◑"] : ["•", "o", "O", "0"], delay: u = et2 ? 80 : 120, signal: l, ...n } = {}) => {
1717
- const c = ct2();
1718
- let g, F, p = false, E = false, $ = "", m, h = performance.now();
1719
- const y2 = rt(s), f = n?.styleFrame ?? Ke, v = (b) => {
1720
- const O2 = b > 1 ? a ?? _.messages.error : i ?? _.messages.cancel;
1721
- E = b === 1, p && (L2(O2, b), E && typeof r == "function" && r());
1722
- }, S2 = () => v(2), I2 = () => v(1), B2 = () => {
1723
- process.on("uncaughtExceptionMonitor", S2), process.on("unhandledRejection", S2), process.on("SIGINT", I2), process.on("SIGTERM", I2), process.on("exit", v), l && l.addEventListener("abort", I2);
1724
- }, A = () => {
1725
- process.removeListener("uncaughtExceptionMonitor", S2), process.removeListener("unhandledRejection", S2), process.removeListener("SIGINT", I2), process.removeListener("SIGTERM", I2), process.removeListener("exit", v), l && l.removeEventListener("abort", I2);
1726
- }, w = () => {
1727
- if (m === undefined)
1728
- return;
1729
- c && s.write(`
1730
- `);
1731
- const b = J2(m, y2, { hard: true, trim: false }).split(`
1732
- `);
1733
- b.length > 1 && s.write(import_sisteransi2.cursor.up(b.length - 1)), s.write(import_sisteransi2.cursor.to(0)), s.write(import_sisteransi2.erase.down());
1734
- }, _2 = (b) => b.replace(/\.+$/, ""), D2 = (b) => {
1735
- const O2 = (performance.now() - b) / 1000, j2 = Math.floor(O2 / 60), G2 = Math.floor(O2 % 60);
1736
- return j2 > 0 ? `[${j2}m ${G2}s]` : `[${G2}s]`;
1737
- }, T2 = n.withGuide ?? _.withGuide, Y = (b = "") => {
1738
- p = true, g = Bt({ output: s }), $ = _2(b), h = performance.now(), T2 && s.write(`${import_picocolors2.default.gray(d)}
1739
- `);
1740
- let O2 = 0, j2 = 0;
1741
- B2(), F = setInterval(() => {
1742
- if (c && $ === m)
1743
- return;
1744
- w(), m = $;
1745
- const G2 = f(o[O2]);
1746
- let tt2;
1747
- if (c)
1748
- tt2 = `${G2} ${$}...`;
1749
- else if (t === "timer")
1750
- tt2 = `${G2} ${$} ${D2(h)}`;
1751
- else {
1752
- const te = ".".repeat(Math.floor(j2)).slice(0, 3);
1753
- tt2 = `${G2} ${$}${te}`;
1754
- }
1755
- const Zt = J2(tt2, y2, { hard: true, trim: false });
1756
- s.write(Zt), O2 = O2 + 1 < o.length ? O2 + 1 : 0, j2 = j2 < 4 ? j2 + 0.125 : 0;
1757
- }, u);
1758
- }, L2 = (b = "", O2 = 0, j2 = false) => {
1759
- if (!p)
1760
- return;
1761
- p = false, clearInterval(F), w();
1762
- const G2 = O2 === 0 ? import_picocolors2.default.green(V) : O2 === 1 ? import_picocolors2.default.red(dt2) : import_picocolors2.default.red($t2);
1763
- $ = b ?? $, j2 || (t === "timer" ? s.write(`${G2} ${$} ${D2(h)}
1764
- `) : s.write(`${G2} ${$}
1765
- `)), A(), g();
2127
+ return argument ? `${binary} ${argument}` : binary;
1766
2128
  };
1767
- return { start: Y, stop: (b = "") => L2(b, 0), message: (b = "") => {
1768
- $ = _2(b ?? $);
1769
- }, cancel: (b = "") => L2(b, 1), error: (b = "") => L2(b, 2), clear: () => L2("", 0, true), get isCancelled() {
1770
- return E;
1771
- } };
1772
- };
1773
- var zt = { light: C("─", "-"), heavy: C("━", "="), block: C("█", "#") };
1774
- var lt2 = (t, r) => t.includes(`
1775
- `) ? t.split(`
1776
- `).map((s) => r(s)).join(`
1777
- `) : r(t);
1778
- var Je = (t) => {
1779
- const r = (s, i) => {
1780
- const a = s.label ?? String(s.value);
1781
- switch (i) {
1782
- case "disabled":
1783
- return `${import_picocolors2.default.gray(H2)} ${lt2(a, import_picocolors2.default.gray)}${s.hint ? ` ${import_picocolors2.default.dim(`(${s.hint ?? "disabled"})`)}` : ""}`;
1784
- case "selected":
1785
- return `${lt2(a, import_picocolors2.default.dim)}`;
1786
- case "active":
1787
- return `${import_picocolors2.default.green(Q2)} ${a}${s.hint ? ` ${import_picocolors2.default.dim(`(${s.hint})`)}` : ""}`;
1788
- case "cancelled":
1789
- return `${lt2(a, (o) => import_picocolors2.default.strikethrough(import_picocolors2.default.dim(o)))}`;
1790
- default:
1791
- return `${import_picocolors2.default.dim(H2)} ${lt2(a, import_picocolors2.default.dim)}`;
2129
+ });
2130
+
2131
+ // node_modules/cross-spawn/lib/util/readShebang.js
2132
+ var require_readShebang = __commonJS((exports, module) => {
2133
+ var fs = __require("fs");
2134
+ var shebangCommand = require_shebang_command();
2135
+ function readShebang(command) {
2136
+ const size = 150;
2137
+ const buffer = Buffer.alloc(size);
2138
+ let fd;
2139
+ try {
2140
+ fd = fs.openSync(command, "r");
2141
+ fs.readSync(fd, buffer, 0, size, 0);
2142
+ fs.closeSync(fd);
2143
+ } catch (e2) {}
2144
+ return shebangCommand(buffer.toString());
2145
+ }
2146
+ module.exports = readShebang;
2147
+ });
2148
+
2149
+ // node_modules/cross-spawn/lib/parse.js
2150
+ var require_parse = __commonJS((exports, module) => {
2151
+ var path = __require("path");
2152
+ var resolveCommand = require_resolveCommand();
2153
+ var escape = require_escape();
2154
+ var readShebang = require_readShebang();
2155
+ var isWin = process.platform === "win32";
2156
+ var isExecutableRegExp = /\.(?:com|exe)$/i;
2157
+ var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
2158
+ function detectShebang(parsed) {
2159
+ parsed.file = resolveCommand(parsed);
2160
+ const shebang = parsed.file && readShebang(parsed.file);
2161
+ if (shebang) {
2162
+ parsed.args.unshift(parsed.file);
2163
+ parsed.command = shebang;
2164
+ return resolveCommand(parsed);
1792
2165
  }
1793
- };
1794
- return new Wt({ options: t.options, signal: t.signal, input: t.input, output: t.output, initialValue: t.initialValue, render() {
1795
- const s = t.withGuide ?? _.withGuide, i = `${W2(this.state)} `, a = `${vt2(this.state)} `, o = xt(t.output, t.message, a, i), u = `${s ? `${import_picocolors2.default.gray(d)}
1796
- ` : ""}${o}
1797
- `;
1798
- switch (this.state) {
1799
- case "submit": {
1800
- const l = s ? `${import_picocolors2.default.gray(d)} ` : "", n = xt(t.output, r(this.options[this.cursor], "selected"), l);
1801
- return `${u}${n}`;
1802
- }
1803
- case "cancel": {
1804
- const l = s ? `${import_picocolors2.default.gray(d)} ` : "", n = xt(t.output, r(this.options[this.cursor], "cancelled"), l);
1805
- return `${u}${n}${s ? `
1806
- ${import_picocolors2.default.gray(d)}` : ""}`;
1807
- }
1808
- default: {
1809
- const l = s ? `${import_picocolors2.default.cyan(d)} ` : "", n = s ? import_picocolors2.default.cyan(x2) : "", c = u.split(`
1810
- `).length, g = s ? 2 : 1;
1811
- return `${u}${l}${X2({ output: t.output, cursor: this.cursor, options: this.options, maxItems: t.maxItems, columnPadding: l.length, rowPadding: c + g, style: (F, p) => r(F, F.disabled ? "disabled" : p ? "active" : "inactive") }).join(`
1812
- ${l}`)}
1813
- ${n}
1814
- `;
1815
- }
2166
+ return parsed.file;
2167
+ }
2168
+ function parseNonShell(parsed) {
2169
+ if (!isWin) {
2170
+ return parsed;
1816
2171
  }
1817
- } }).prompt();
1818
- };
1819
- var Qt = `${import_picocolors2.default.gray(d)} `;
1820
- var Ze = (t) => new $t({ validate: t.validate, placeholder: t.placeholder, defaultValue: t.defaultValue, initialValue: t.initialValue, output: t.output, signal: t.signal, input: t.input, render() {
1821
- const r = t?.withGuide ?? _.withGuide, s = `${`${r ? `${import_picocolors2.default.gray(d)}
1822
- ` : ""}${W2(this.state)} `}${t.message}
1823
- `, i = t.placeholder ? import_picocolors2.default.inverse(t.placeholder[0]) + import_picocolors2.default.dim(t.placeholder.slice(1)) : import_picocolors2.default.inverse(import_picocolors2.default.hidden("_")), a = this.userInput ? this.userInputWithCursor : i, o = this.value ?? "";
1824
- switch (this.state) {
1825
- case "error": {
1826
- const u = this.error ? ` ${import_picocolors2.default.yellow(this.error)}` : "", l = r ? `${import_picocolors2.default.yellow(d)} ` : "", n = r ? import_picocolors2.default.yellow(x2) : "";
1827
- return `${s.trim()}
1828
- ${l}${a}
1829
- ${n}${u}
1830
- `;
2172
+ const commandFile = detectShebang(parsed);
2173
+ const needsShell = !isExecutableRegExp.test(commandFile);
2174
+ if (parsed.options.forceShell || needsShell) {
2175
+ const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
2176
+ parsed.command = path.normalize(parsed.command);
2177
+ parsed.command = escape.command(parsed.command);
2178
+ parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
2179
+ const shellCommand = [parsed.command].concat(parsed.args).join(" ");
2180
+ parsed.args = ["/d", "/s", "/c", `"${shellCommand}"`];
2181
+ parsed.command = process.env.comspec || "cmd.exe";
2182
+ parsed.options.windowsVerbatimArguments = true;
1831
2183
  }
1832
- case "submit": {
1833
- const u = o ? ` ${import_picocolors2.default.dim(o)}` : "", l = r ? import_picocolors2.default.gray(d) : "";
1834
- return `${s}${l}${u}`;
2184
+ return parsed;
2185
+ }
2186
+ function parse(command, args, options) {
2187
+ if (args && !Array.isArray(args)) {
2188
+ options = args;
2189
+ args = null;
1835
2190
  }
1836
- case "cancel": {
1837
- const u = o ? ` ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(o))}` : "", l = r ? import_picocolors2.default.gray(d) : "";
1838
- return `${s}${l}${u}${o.trim() ? `
1839
- ${l}` : ""}`;
2191
+ args = args ? args.slice(0) : [];
2192
+ options = Object.assign({}, options);
2193
+ const parsed = {
2194
+ command,
2195
+ args,
2196
+ options,
2197
+ file: undefined,
2198
+ original: {
2199
+ command,
2200
+ args
2201
+ }
2202
+ };
2203
+ return options.shell ? parsed : parseNonShell(parsed);
2204
+ }
2205
+ module.exports = parse;
2206
+ });
2207
+
2208
+ // node_modules/cross-spawn/lib/enoent.js
2209
+ var require_enoent = __commonJS((exports, module) => {
2210
+ var isWin = process.platform === "win32";
2211
+ function notFoundError(original, syscall) {
2212
+ return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
2213
+ code: "ENOENT",
2214
+ errno: "ENOENT",
2215
+ syscall: `${syscall} ${original.command}`,
2216
+ path: original.command,
2217
+ spawnargs: original.args
2218
+ });
2219
+ }
2220
+ function hookChildProcess(cp, parsed) {
2221
+ if (!isWin) {
2222
+ return;
1840
2223
  }
1841
- default: {
1842
- const u = r ? `${import_picocolors2.default.cyan(d)} ` : "", l = r ? import_picocolors2.default.cyan(x2) : "";
1843
- return `${s}${u}${a}
1844
- ${l}
1845
- `;
2224
+ const originalEmit = cp.emit;
2225
+ cp.emit = function(name, arg1) {
2226
+ if (name === "exit") {
2227
+ const err = verifyENOENT(arg1, parsed);
2228
+ if (err) {
2229
+ return originalEmit.call(cp, "error", err);
2230
+ }
2231
+ }
2232
+ return originalEmit.apply(cp, arguments);
2233
+ };
2234
+ }
2235
+ function verifyENOENT(status, parsed) {
2236
+ if (isWin && status === 1 && !parsed.file) {
2237
+ return notFoundError(parsed.original, "spawn");
1846
2238
  }
2239
+ return null;
1847
2240
  }
1848
- } }).prompt();
2241
+ function verifyENOENTSync(status, parsed) {
2242
+ if (isWin && status === 1 && !parsed.file) {
2243
+ return notFoundError(parsed.original, "spawnSync");
2244
+ }
2245
+ return null;
2246
+ }
2247
+ module.exports = {
2248
+ hookChildProcess,
2249
+ verifyENOENT,
2250
+ verifyENOENTSync,
2251
+ notFoundError
2252
+ };
2253
+ });
2254
+
2255
+ // node_modules/cross-spawn/index.js
2256
+ var require_cross_spawn = __commonJS((exports, module) => {
2257
+ var cp = __require("child_process");
2258
+ var parse = require_parse();
2259
+ var enoent = require_enoent();
2260
+ function spawn(command, args, options) {
2261
+ const parsed = parse(command, args, options);
2262
+ const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
2263
+ enoent.hookChildProcess(spawned, parsed);
2264
+ return spawned;
2265
+ }
2266
+ function spawnSync(command, args, options) {
2267
+ const parsed = parse(command, args, options);
2268
+ const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
2269
+ result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
2270
+ return result;
2271
+ }
2272
+ module.exports = spawn;
2273
+ module.exports.spawn = spawn;
2274
+ module.exports.sync = spawnSync;
2275
+ module.exports._parse = parse;
2276
+ module.exports._enoent = enoent;
2277
+ });
1849
2278
 
1850
2279
  // src/index.ts
2280
+ init_dist2();
1851
2281
  import path7 from "path";
1852
2282
  import fs6 from "fs";
1853
2283
 
@@ -8564,6 +8994,9 @@ var {
8564
8994
  getCancelSignal: getCancelSignal2
8565
8995
  } = getIpcExport();
8566
8996
 
8997
+ // src/lib/providers/google.ts
8998
+ init_dist2();
8999
+
8567
9000
  // node_modules/open/index.js
8568
9001
  import process16 from "node:process";
8569
9002
  import path6 from "node:path";
@@ -9175,6 +9608,7 @@ defineLazyProperty(apps, "safari", () => detectPlatformBinary({
9175
9608
  var open_default = open;
9176
9609
 
9177
9610
  // src/lib/save-credentials.ts
9611
+ init_dist2();
9178
9612
  import { writeFile, readFile, access } from "fs/promises";
9179
9613
 
9180
9614
  // src/lib/config.ts
@@ -9247,6 +9681,7 @@ ${envKeySecret}=${clientSecret}`;
9247
9681
  }
9248
9682
 
9249
9683
  // src/lib/ask-save-option.ts
9684
+ init_dist2();
9250
9685
  async function askSaveOption() {
9251
9686
  if (globalConfig.skipPrompts) {
9252
9687
  return "dot-env";
@@ -9429,6 +9864,7 @@ ${_appName}`, "Save this URL");
9429
9864
  }
9430
9865
 
9431
9866
  // src/lib/providers/github.ts
9867
+ init_dist2();
9432
9868
  import http from "http";
9433
9869
  function logStep2(message) {
9434
9870
  if (!globalConfig.quiet)
@@ -9582,6 +10018,7 @@ ${callbackUrl}`, "Save this URL");
9582
10018
  }
9583
10019
 
9584
10020
  // src/lib/providers/discord.ts
10021
+ init_dist2();
9585
10022
  function logStep3(message) {
9586
10023
  if (!globalConfig.quiet)
9587
10024
  R2.step(message);
@@ -9645,6 +10082,145 @@ ${callbackUrl}`, "Save this URL");
9645
10082
  }
9646
10083
  }
9647
10084
 
10085
+ // src/lib/providers/gitlab.ts
10086
+ init_dist2();
10087
+ function logStep4(message) {
10088
+ if (!globalConfig.quiet)
10089
+ R2.step(message);
10090
+ }
10091
+ function logMessage4(message) {
10092
+ if (!globalConfig.quiet)
10093
+ R2.message(message);
10094
+ }
10095
+
10096
+ class GitLabAuthProvider {
10097
+ async run(callbackUrl) {
10098
+ try {
10099
+ logStep4("Step 1: Create GitLab Application");
10100
+ const appType = await this.selectAppType();
10101
+ if (Ct(appType))
10102
+ return Ne("Setup aborted.");
10103
+ const portalUrl = this.getPortalUrl(appType);
10104
+ logMessage4(`Opening GitLab: ${portalUrl}`);
10105
+ Ve(`Required Redirect URI:
10106
+ ${callbackUrl}`, "Save this URL");
10107
+ if (!globalConfig.noOpen) {
10108
+ const shouldOpen = globalConfig.skipPrompts ? true : await Re({
10109
+ message: "Open GitLab Applications page?",
10110
+ initialValue: true
10111
+ });
10112
+ if (Ct(shouldOpen))
10113
+ return Ne("Setup aborted.");
10114
+ if (shouldOpen)
10115
+ await open_default(portalUrl);
10116
+ }
10117
+ if (!globalConfig.skipPrompts) {
10118
+ const instructions = this.getInstructions(appType);
10119
+ Ve(instructions, "Action Required");
10120
+ }
10121
+ logStep4("Step 2: Collect Credentials");
10122
+ const clientId = await this.promptClientId();
10123
+ if (Ct(clientId))
10124
+ return Ne("Setup aborted.");
10125
+ const clientSecret = await this.promptClientSecret();
10126
+ if (Ct(clientSecret))
10127
+ return Ne("Setup aborted.");
10128
+ logStep4("Step 3: Save credentials");
10129
+ const saveOption = await askSaveOption();
10130
+ if (Ct(saveOption))
10131
+ return Ne("Setup aborted.");
10132
+ await saveCredentials(clientId, clientSecret, "gitlab", saveOption);
10133
+ } catch (err) {
10134
+ R2.error(`Setup Failed: ${err.message}`);
10135
+ process.exit(1);
10136
+ }
10137
+ }
10138
+ async selectAppType() {
10139
+ if (globalConfig.skipPrompts) {
10140
+ return "user";
10141
+ }
10142
+ const { log, select, isCancel: isCancel2, cancel: cancel2 } = await Promise.resolve().then(() => (init_dist2(), exports_dist));
10143
+ return select({
10144
+ message: "What type of GitLab application?",
10145
+ options: [
10146
+ {
10147
+ value: "user",
10148
+ label: "User-owned Application",
10149
+ hint: "For GitLab.com personal apps"
10150
+ },
10151
+ {
10152
+ value: "group",
10153
+ label: "Group-owned Application",
10154
+ hint: "For GitLab.com group apps"
10155
+ },
10156
+ {
10157
+ value: "instance",
10158
+ label: "Instance-wide Application",
10159
+ hint: "For GitLab Self-Managed (admin only)"
10160
+ }
10161
+ ]
10162
+ });
10163
+ }
10164
+ getPortalUrl(appType) {
10165
+ switch (appType) {
10166
+ case "user":
10167
+ return "https://gitlab.com/-/user_settings/applications";
10168
+ case "group":
10169
+ return "https://gitlab.com/groups/-/settings/applications";
10170
+ case "instance":
10171
+ return "https://gitlab.com/admin/applications";
10172
+ default:
10173
+ return "https://gitlab.com/-/user_settings/applications";
10174
+ }
10175
+ }
10176
+ getInstructions(appType) {
10177
+ switch (appType) {
10178
+ case "user":
10179
+ return `1. Click 'Add new application'
10180
+ 2. Enter name and Redirect URI
10181
+ 3. Select scopes (openid, profile, email recommended)
10182
+ 4. Click 'Save application'
10183
+ 5. Copy Application ID and Secret`;
10184
+ case "group":
10185
+ return `1. Go to Group → Settings → Applications
10186
+ ` + `2. Click 'Add new application'
10187
+ 3. Enter name and Redirect URI
10188
+ 4. Select scopes (openid, profile, email recommended)
10189
+ 5. Click 'Save application'
10190
+ 6. Copy Application ID and Secret`;
10191
+ case "instance":
10192
+ return `1. Click 'New application'
10193
+ 2. Enter name and Redirect URI
10194
+ 3. Select scopes (openid, profile, email recommended)
10195
+ 4. Mark as 'Trusted' to skip user authorization
10196
+ 5. Click 'Save application'
10197
+ 6. Copy Application ID and Secret`;
10198
+ default:
10199
+ return "Follow the on-screen instructions to create the application";
10200
+ }
10201
+ }
10202
+ async promptClientId() {
10203
+ if (globalConfig.skipPrompts) {
10204
+ R2.error("Client ID required in non-interactive mode. Run without --skip-prompts");
10205
+ process.exit(1);
10206
+ }
10207
+ return Ze({
10208
+ message: "Paste your Application ID (Client ID):",
10209
+ placeholder: "abc123..."
10210
+ });
10211
+ }
10212
+ async promptClientSecret() {
10213
+ if (globalConfig.skipPrompts) {
10214
+ R2.error("Client Secret required in non-interactive mode. Run without --skip-prompts");
10215
+ process.exit(1);
10216
+ }
10217
+ return He({
10218
+ message: "Paste your Client Secret:",
10219
+ validate: (value) => !value || value.length < 10 ? "Secret too short" : undefined
10220
+ });
10221
+ }
10222
+ }
10223
+
9648
10224
  // src/index.ts
9649
10225
  var AUTH_LIBRARIES = [
9650
10226
  { name: "next-auth", callbackPattern: "/api/auth/callback/[provider]" },
@@ -9698,7 +10274,13 @@ GitHub OAuth Setup:
9698
10274
  Discord OAuth Setup:
9699
10275
  1. Requires Discord Developer Portal setup
9700
10276
  2. Redirect URI: http://localhost:3000/api/auth/callback/discord
9701
- 3. Need: Client ID and Client Secret from Discord Developer Portal`
10277
+ 3. Need: Client ID and Client Secret from Discord Developer Portal`,
10278
+ gitlab: `
10279
+ GitLab OAuth Setup:
10280
+ 1. Requires GitLab.com or GitLab Self-Managed
10281
+ 2. Redirect URI: http://localhost:3000/api/auth/callback/gitlab
10282
+ 3. Need: Application ID and Client Secret from GitLab Applications
10283
+ 4. Supports user-owned, group-owned, or instance-wide apps`
9702
10284
  };
9703
10285
  function showProviderHelp(provider) {
9704
10286
  const help = PROVIDER_HELP[provider.toLowerCase()];
@@ -9761,6 +10343,19 @@ async function setupOAuthServices(oauthServices, customCallbackUrl) {
9761
10343
  }
9762
10344
  const discordProvider = new DiscordAuthProvider;
9763
10345
  await discordProvider.run(discordOauthCallback);
10346
+ } else if (service === "gitlab") {
10347
+ R2.step("GitLab OAuth Setup");
10348
+ const gitlabOauthCallback = globalConfig.skipPrompts ? defaultCallback : await Ze({
10349
+ message: "Enter the GitLab OAuth callback URL:",
10350
+ placeholder: defaultCallback,
10351
+ defaultValue: defaultCallback
10352
+ });
10353
+ if (Ct(gitlabOauthCallback)) {
10354
+ Ne("Setup aborted.");
10355
+ return;
10356
+ }
10357
+ const gitlabProvider = new GitLabAuthProvider;
10358
+ await gitlabProvider.run(gitlabOauthCallback);
9764
10359
  }
9765
10360
  }
9766
10361
  Le("OAuth setup completed! Thank you for using oauth-init!");
@@ -9776,7 +10371,7 @@ async function main() {
9776
10371
  callbackUrl: args.find((arg) => arg.startsWith("--callback-url="))?.split("=")[1] || args.find((arg) => arg.startsWith("-c="))?.split("=")[1]
9777
10372
  };
9778
10373
  const providerArg = args.find((arg) => !arg.startsWith("-"));
9779
- if (providerArg && (providerArg === "google" || providerArg === "github" || providerArg === "discord")) {
10374
+ if (providerArg && (providerArg === "google" || providerArg === "github" || providerArg === "discord" || providerArg === "gitlab")) {
9780
10375
  showProviderHelp(providerArg);
9781
10376
  }
9782
10377
  if (flags.help) {
@@ -9803,7 +10398,7 @@ Examples:
9803
10398
  process.exit(0);
9804
10399
  }
9805
10400
  if (flags.provider) {
9806
- const validProviders = ["google", "github", "discord"];
10401
+ const validProviders = ["google", "github", "discord", "gitlab"];
9807
10402
  const providers = flags.provider.split(",").map((p) => p.trim().toLowerCase());
9808
10403
  const invalid = providers.filter((p) => !validProviders.includes(p));
9809
10404
  if (invalid.length > 0) {
@@ -9845,7 +10440,8 @@ Examples:
9845
10440
  options: [
9846
10441
  { value: "google", label: "Google" },
9847
10442
  { value: "github", label: "Github" },
9848
- { value: "discord", label: "Discord" }
10443
+ { value: "discord", label: "Discord" },
10444
+ { value: "gitlab", label: "GitLab" }
9849
10445
  ]
9850
10446
  });
9851
10447
  if (Ct(oauthToSetup)) {