@meistrari/tela-cli 1.9.1 → 1.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -34,19 +34,1646 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
34
34
  ));
35
35
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
36
36
 
37
+ // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js
38
+ var require_polyfills = __commonJS({
39
+ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js"(exports2, module2) {
40
+ var constants = require("constants");
41
+ var origCwd = process.cwd;
42
+ var cwd = null;
43
+ var platform2 = process.env.GRACEFUL_FS_PLATFORM || process.platform;
44
+ process.cwd = function() {
45
+ if (!cwd)
46
+ cwd = origCwd.call(process);
47
+ return cwd;
48
+ };
49
+ try {
50
+ process.cwd();
51
+ } catch (er) {
52
+ }
53
+ if (typeof process.chdir === "function") {
54
+ chdir = process.chdir;
55
+ process.chdir = function(d) {
56
+ cwd = null;
57
+ chdir.call(process, d);
58
+ };
59
+ if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir);
60
+ }
61
+ var chdir;
62
+ module2.exports = patch;
63
+ function patch(fs) {
64
+ if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
65
+ patchLchmod(fs);
66
+ }
67
+ if (!fs.lutimes) {
68
+ patchLutimes(fs);
69
+ }
70
+ fs.chown = chownFix(fs.chown);
71
+ fs.fchown = chownFix(fs.fchown);
72
+ fs.lchown = chownFix(fs.lchown);
73
+ fs.chmod = chmodFix(fs.chmod);
74
+ fs.fchmod = chmodFix(fs.fchmod);
75
+ fs.lchmod = chmodFix(fs.lchmod);
76
+ fs.chownSync = chownFixSync(fs.chownSync);
77
+ fs.fchownSync = chownFixSync(fs.fchownSync);
78
+ fs.lchownSync = chownFixSync(fs.lchownSync);
79
+ fs.chmodSync = chmodFixSync(fs.chmodSync);
80
+ fs.fchmodSync = chmodFixSync(fs.fchmodSync);
81
+ fs.lchmodSync = chmodFixSync(fs.lchmodSync);
82
+ fs.stat = statFix(fs.stat);
83
+ fs.fstat = statFix(fs.fstat);
84
+ fs.lstat = statFix(fs.lstat);
85
+ fs.statSync = statFixSync(fs.statSync);
86
+ fs.fstatSync = statFixSync(fs.fstatSync);
87
+ fs.lstatSync = statFixSync(fs.lstatSync);
88
+ if (fs.chmod && !fs.lchmod) {
89
+ fs.lchmod = function(path2, mode, cb) {
90
+ if (cb) process.nextTick(cb);
91
+ };
92
+ fs.lchmodSync = function() {
93
+ };
94
+ }
95
+ if (fs.chown && !fs.lchown) {
96
+ fs.lchown = function(path2, uid, gid, cb) {
97
+ if (cb) process.nextTick(cb);
98
+ };
99
+ fs.lchownSync = function() {
100
+ };
101
+ }
102
+ if (platform2 === "win32") {
103
+ fs.rename = typeof fs.rename !== "function" ? fs.rename : (function(fs$rename) {
104
+ function rename(from, to, cb) {
105
+ var start = Date.now();
106
+ var backoff = 0;
107
+ fs$rename(from, to, function CB(er) {
108
+ if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
109
+ setTimeout(function() {
110
+ fs.stat(to, function(stater, st) {
111
+ if (stater && stater.code === "ENOENT")
112
+ fs$rename(from, to, CB);
113
+ else
114
+ cb(er);
115
+ });
116
+ }, backoff);
117
+ if (backoff < 100)
118
+ backoff += 10;
119
+ return;
120
+ }
121
+ if (cb) cb(er);
122
+ });
123
+ }
124
+ if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename);
125
+ return rename;
126
+ })(fs.rename);
127
+ }
128
+ fs.read = typeof fs.read !== "function" ? fs.read : (function(fs$read) {
129
+ function read(fd, buffer, offset, length, position, callback_) {
130
+ var callback;
131
+ if (callback_ && typeof callback_ === "function") {
132
+ var eagCounter = 0;
133
+ callback = function(er, _2, __) {
134
+ if (er && er.code === "EAGAIN" && eagCounter < 10) {
135
+ eagCounter++;
136
+ return fs$read.call(fs, fd, buffer, offset, length, position, callback);
137
+ }
138
+ callback_.apply(this, arguments);
139
+ };
140
+ }
141
+ return fs$read.call(fs, fd, buffer, offset, length, position, callback);
142
+ }
143
+ if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
144
+ return read;
145
+ })(fs.read);
146
+ fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ (function(fs$readSync) {
147
+ return function(fd, buffer, offset, length, position) {
148
+ var eagCounter = 0;
149
+ while (true) {
150
+ try {
151
+ return fs$readSync.call(fs, fd, buffer, offset, length, position);
152
+ } catch (er) {
153
+ if (er.code === "EAGAIN" && eagCounter < 10) {
154
+ eagCounter++;
155
+ continue;
156
+ }
157
+ throw er;
158
+ }
159
+ }
160
+ };
161
+ })(fs.readSync);
162
+ function patchLchmod(fs2) {
163
+ fs2.lchmod = function(path2, mode, callback) {
164
+ fs2.open(
165
+ path2,
166
+ constants.O_WRONLY | constants.O_SYMLINK,
167
+ mode,
168
+ function(err, fd) {
169
+ if (err) {
170
+ if (callback) callback(err);
171
+ return;
172
+ }
173
+ fs2.fchmod(fd, mode, function(err2) {
174
+ fs2.close(fd, function(err22) {
175
+ if (callback) callback(err2 || err22);
176
+ });
177
+ });
178
+ }
179
+ );
180
+ };
181
+ fs2.lchmodSync = function(path2, mode) {
182
+ var fd = fs2.openSync(path2, constants.O_WRONLY | constants.O_SYMLINK, mode);
183
+ var threw = true;
184
+ var ret;
185
+ try {
186
+ ret = fs2.fchmodSync(fd, mode);
187
+ threw = false;
188
+ } finally {
189
+ if (threw) {
190
+ try {
191
+ fs2.closeSync(fd);
192
+ } catch (er) {
193
+ }
194
+ } else {
195
+ fs2.closeSync(fd);
196
+ }
197
+ }
198
+ return ret;
199
+ };
200
+ }
201
+ function patchLutimes(fs2) {
202
+ if (constants.hasOwnProperty("O_SYMLINK") && fs2.futimes) {
203
+ fs2.lutimes = function(path2, at, mt, cb) {
204
+ fs2.open(path2, constants.O_SYMLINK, function(er, fd) {
205
+ if (er) {
206
+ if (cb) cb(er);
207
+ return;
208
+ }
209
+ fs2.futimes(fd, at, mt, function(er2) {
210
+ fs2.close(fd, function(er22) {
211
+ if (cb) cb(er2 || er22);
212
+ });
213
+ });
214
+ });
215
+ };
216
+ fs2.lutimesSync = function(path2, at, mt) {
217
+ var fd = fs2.openSync(path2, constants.O_SYMLINK);
218
+ var ret;
219
+ var threw = true;
220
+ try {
221
+ ret = fs2.futimesSync(fd, at, mt);
222
+ threw = false;
223
+ } finally {
224
+ if (threw) {
225
+ try {
226
+ fs2.closeSync(fd);
227
+ } catch (er) {
228
+ }
229
+ } else {
230
+ fs2.closeSync(fd);
231
+ }
232
+ }
233
+ return ret;
234
+ };
235
+ } else if (fs2.futimes) {
236
+ fs2.lutimes = function(_a2, _b, _c, cb) {
237
+ if (cb) process.nextTick(cb);
238
+ };
239
+ fs2.lutimesSync = function() {
240
+ };
241
+ }
242
+ }
243
+ function chmodFix(orig) {
244
+ if (!orig) return orig;
245
+ return function(target, mode, cb) {
246
+ return orig.call(fs, target, mode, function(er) {
247
+ if (chownErOk(er)) er = null;
248
+ if (cb) cb.apply(this, arguments);
249
+ });
250
+ };
251
+ }
252
+ function chmodFixSync(orig) {
253
+ if (!orig) return orig;
254
+ return function(target, mode) {
255
+ try {
256
+ return orig.call(fs, target, mode);
257
+ } catch (er) {
258
+ if (!chownErOk(er)) throw er;
259
+ }
260
+ };
261
+ }
262
+ function chownFix(orig) {
263
+ if (!orig) return orig;
264
+ return function(target, uid, gid, cb) {
265
+ return orig.call(fs, target, uid, gid, function(er) {
266
+ if (chownErOk(er)) er = null;
267
+ if (cb) cb.apply(this, arguments);
268
+ });
269
+ };
270
+ }
271
+ function chownFixSync(orig) {
272
+ if (!orig) return orig;
273
+ return function(target, uid, gid) {
274
+ try {
275
+ return orig.call(fs, target, uid, gid);
276
+ } catch (er) {
277
+ if (!chownErOk(er)) throw er;
278
+ }
279
+ };
280
+ }
281
+ function statFix(orig) {
282
+ if (!orig) return orig;
283
+ return function(target, options2, cb) {
284
+ if (typeof options2 === "function") {
285
+ cb = options2;
286
+ options2 = null;
287
+ }
288
+ function callback(er, stats) {
289
+ if (stats) {
290
+ if (stats.uid < 0) stats.uid += 4294967296;
291
+ if (stats.gid < 0) stats.gid += 4294967296;
292
+ }
293
+ if (cb) cb.apply(this, arguments);
294
+ }
295
+ return options2 ? orig.call(fs, target, options2, callback) : orig.call(fs, target, callback);
296
+ };
297
+ }
298
+ function statFixSync(orig) {
299
+ if (!orig) return orig;
300
+ return function(target, options2) {
301
+ var stats = options2 ? orig.call(fs, target, options2) : orig.call(fs, target);
302
+ if (stats) {
303
+ if (stats.uid < 0) stats.uid += 4294967296;
304
+ if (stats.gid < 0) stats.gid += 4294967296;
305
+ }
306
+ return stats;
307
+ };
308
+ }
309
+ function chownErOk(er) {
310
+ if (!er)
311
+ return true;
312
+ if (er.code === "ENOSYS")
313
+ return true;
314
+ var nonroot = !process.getuid || process.getuid() !== 0;
315
+ if (nonroot) {
316
+ if (er.code === "EINVAL" || er.code === "EPERM")
317
+ return true;
318
+ }
319
+ return false;
320
+ }
321
+ }
322
+ }
323
+ });
324
+
325
+ // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js
326
+ var require_legacy_streams = __commonJS({
327
+ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js"(exports2, module2) {
328
+ var Stream = require("stream").Stream;
329
+ module2.exports = legacy;
330
+ function legacy(fs) {
331
+ return {
332
+ ReadStream: ReadStream2,
333
+ WriteStream
334
+ };
335
+ function ReadStream2(path2, options2) {
336
+ if (!(this instanceof ReadStream2)) return new ReadStream2(path2, options2);
337
+ Stream.call(this);
338
+ var self2 = this;
339
+ this.path = path2;
340
+ this.fd = null;
341
+ this.readable = true;
342
+ this.paused = false;
343
+ this.flags = "r";
344
+ this.mode = 438;
345
+ this.bufferSize = 64 * 1024;
346
+ options2 = options2 || {};
347
+ var keys = Object.keys(options2);
348
+ for (var index = 0, length = keys.length; index < length; index++) {
349
+ var key = keys[index];
350
+ this[key] = options2[key];
351
+ }
352
+ if (this.encoding) this.setEncoding(this.encoding);
353
+ if (this.start !== void 0) {
354
+ if ("number" !== typeof this.start) {
355
+ throw TypeError("start must be a Number");
356
+ }
357
+ if (this.end === void 0) {
358
+ this.end = Infinity;
359
+ } else if ("number" !== typeof this.end) {
360
+ throw TypeError("end must be a Number");
361
+ }
362
+ if (this.start > this.end) {
363
+ throw new Error("start must be <= end");
364
+ }
365
+ this.pos = this.start;
366
+ }
367
+ if (this.fd !== null) {
368
+ process.nextTick(function() {
369
+ self2._read();
370
+ });
371
+ return;
372
+ }
373
+ fs.open(this.path, this.flags, this.mode, function(err, fd) {
374
+ if (err) {
375
+ self2.emit("error", err);
376
+ self2.readable = false;
377
+ return;
378
+ }
379
+ self2.fd = fd;
380
+ self2.emit("open", fd);
381
+ self2._read();
382
+ });
383
+ }
384
+ function WriteStream(path2, options2) {
385
+ if (!(this instanceof WriteStream)) return new WriteStream(path2, options2);
386
+ Stream.call(this);
387
+ this.path = path2;
388
+ this.fd = null;
389
+ this.writable = true;
390
+ this.flags = "w";
391
+ this.encoding = "binary";
392
+ this.mode = 438;
393
+ this.bytesWritten = 0;
394
+ options2 = options2 || {};
395
+ var keys = Object.keys(options2);
396
+ for (var index = 0, length = keys.length; index < length; index++) {
397
+ var key = keys[index];
398
+ this[key] = options2[key];
399
+ }
400
+ if (this.start !== void 0) {
401
+ if ("number" !== typeof this.start) {
402
+ throw TypeError("start must be a Number");
403
+ }
404
+ if (this.start < 0) {
405
+ throw new Error("start must be >= zero");
406
+ }
407
+ this.pos = this.start;
408
+ }
409
+ this.busy = false;
410
+ this._queue = [];
411
+ if (this.fd === null) {
412
+ this._open = fs.open;
413
+ this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
414
+ this.flush();
415
+ }
416
+ }
417
+ }
418
+ }
419
+ });
420
+
421
+ // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js
422
+ var require_clone = __commonJS({
423
+ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js"(exports2, module2) {
424
+ "use strict";
425
+ module2.exports = clone2;
426
+ var getPrototypeOf2 = Object.getPrototypeOf || function(obj) {
427
+ return obj.__proto__;
428
+ };
429
+ function clone2(obj) {
430
+ if (obj === null || typeof obj !== "object")
431
+ return obj;
432
+ if (obj instanceof Object)
433
+ var copy = { __proto__: getPrototypeOf2(obj) };
434
+ else
435
+ var copy = /* @__PURE__ */ Object.create(null);
436
+ Object.getOwnPropertyNames(obj).forEach(function(key) {
437
+ Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key));
438
+ });
439
+ return copy;
440
+ }
441
+ }
442
+ });
443
+
444
+ // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js
445
+ var require_graceful_fs = __commonJS({
446
+ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js"(exports2, module2) {
447
+ var fs = require("fs");
448
+ var polyfills = require_polyfills();
449
+ var legacy = require_legacy_streams();
450
+ var clone2 = require_clone();
451
+ var util4 = require("util");
452
+ var gracefulQueue;
453
+ var previousSymbol;
454
+ if (typeof Symbol === "function" && typeof Symbol.for === "function") {
455
+ gracefulQueue = /* @__PURE__ */ Symbol.for("graceful-fs.queue");
456
+ previousSymbol = /* @__PURE__ */ Symbol.for("graceful-fs.previous");
457
+ } else {
458
+ gracefulQueue = "___graceful-fs.queue";
459
+ previousSymbol = "___graceful-fs.previous";
460
+ }
461
+ function noop2() {
462
+ }
463
+ function publishQueue(context, queue2) {
464
+ Object.defineProperty(context, gracefulQueue, {
465
+ get: function() {
466
+ return queue2;
467
+ }
468
+ });
469
+ }
470
+ var debug = noop2;
471
+ if (util4.debuglog)
472
+ debug = util4.debuglog("gfs4");
473
+ else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ""))
474
+ debug = function() {
475
+ var m3 = util4.format.apply(util4, arguments);
476
+ m3 = "GFS4: " + m3.split(/\n/).join("\nGFS4: ");
477
+ console.error(m3);
478
+ };
479
+ if (!fs[gracefulQueue]) {
480
+ queue = global[gracefulQueue] || [];
481
+ publishQueue(fs, queue);
482
+ fs.close = (function(fs$close) {
483
+ function close(fd, cb) {
484
+ return fs$close.call(fs, fd, function(err) {
485
+ if (!err) {
486
+ resetQueue();
487
+ }
488
+ if (typeof cb === "function")
489
+ cb.apply(this, arguments);
490
+ });
491
+ }
492
+ Object.defineProperty(close, previousSymbol, {
493
+ value: fs$close
494
+ });
495
+ return close;
496
+ })(fs.close);
497
+ fs.closeSync = (function(fs$closeSync) {
498
+ function closeSync(fd) {
499
+ fs$closeSync.apply(fs, arguments);
500
+ resetQueue();
501
+ }
502
+ Object.defineProperty(closeSync, previousSymbol, {
503
+ value: fs$closeSync
504
+ });
505
+ return closeSync;
506
+ })(fs.closeSync);
507
+ if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
508
+ process.on("exit", function() {
509
+ debug(fs[gracefulQueue]);
510
+ require("assert").equal(fs[gracefulQueue].length, 0);
511
+ });
512
+ }
513
+ }
514
+ var queue;
515
+ if (!global[gracefulQueue]) {
516
+ publishQueue(global, fs[gracefulQueue]);
517
+ }
518
+ module2.exports = patch(clone2(fs));
519
+ if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) {
520
+ module2.exports = patch(fs);
521
+ fs.__patched = true;
522
+ }
523
+ function patch(fs2) {
524
+ polyfills(fs2);
525
+ fs2.gracefulify = patch;
526
+ fs2.createReadStream = createReadStream;
527
+ fs2.createWriteStream = createWriteStream;
528
+ var fs$readFile = fs2.readFile;
529
+ fs2.readFile = readFile2;
530
+ function readFile2(path2, options2, cb) {
531
+ if (typeof options2 === "function")
532
+ cb = options2, options2 = null;
533
+ return go$readFile(path2, options2, cb);
534
+ function go$readFile(path3, options3, cb2, startTime) {
535
+ return fs$readFile(path3, options3, function(err) {
536
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
537
+ enqueue([go$readFile, [path3, options3, cb2], err, startTime || Date.now(), Date.now()]);
538
+ else {
539
+ if (typeof cb2 === "function")
540
+ cb2.apply(this, arguments);
541
+ }
542
+ });
543
+ }
544
+ }
545
+ var fs$writeFile = fs2.writeFile;
546
+ fs2.writeFile = writeFile2;
547
+ function writeFile2(path2, data, options2, cb) {
548
+ if (typeof options2 === "function")
549
+ cb = options2, options2 = null;
550
+ return go$writeFile(path2, data, options2, cb);
551
+ function go$writeFile(path3, data2, options3, cb2, startTime) {
552
+ return fs$writeFile(path3, data2, options3, function(err) {
553
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
554
+ enqueue([go$writeFile, [path3, data2, options3, cb2], err, startTime || Date.now(), Date.now()]);
555
+ else {
556
+ if (typeof cb2 === "function")
557
+ cb2.apply(this, arguments);
558
+ }
559
+ });
560
+ }
561
+ }
562
+ var fs$appendFile = fs2.appendFile;
563
+ if (fs$appendFile)
564
+ fs2.appendFile = appendFile;
565
+ function appendFile(path2, data, options2, cb) {
566
+ if (typeof options2 === "function")
567
+ cb = options2, options2 = null;
568
+ return go$appendFile(path2, data, options2, cb);
569
+ function go$appendFile(path3, data2, options3, cb2, startTime) {
570
+ return fs$appendFile(path3, data2, options3, function(err) {
571
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
572
+ enqueue([go$appendFile, [path3, data2, options3, cb2], err, startTime || Date.now(), Date.now()]);
573
+ else {
574
+ if (typeof cb2 === "function")
575
+ cb2.apply(this, arguments);
576
+ }
577
+ });
578
+ }
579
+ }
580
+ var fs$copyFile = fs2.copyFile;
581
+ if (fs$copyFile)
582
+ fs2.copyFile = copyFile;
583
+ function copyFile(src, dest, flags, cb) {
584
+ if (typeof flags === "function") {
585
+ cb = flags;
586
+ flags = 0;
587
+ }
588
+ return go$copyFile(src, dest, flags, cb);
589
+ function go$copyFile(src2, dest2, flags2, cb2, startTime) {
590
+ return fs$copyFile(src2, dest2, flags2, function(err) {
591
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
592
+ enqueue([go$copyFile, [src2, dest2, flags2, cb2], err, startTime || Date.now(), Date.now()]);
593
+ else {
594
+ if (typeof cb2 === "function")
595
+ cb2.apply(this, arguments);
596
+ }
597
+ });
598
+ }
599
+ }
600
+ var fs$readdir = fs2.readdir;
601
+ fs2.readdir = readdir2;
602
+ var noReaddirOptionVersions = /^v[0-5]\./;
603
+ function readdir2(path2, options2, cb) {
604
+ if (typeof options2 === "function")
605
+ cb = options2, options2 = null;
606
+ var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path3, options3, cb2, startTime) {
607
+ return fs$readdir(path3, fs$readdirCallback(
608
+ path3,
609
+ options3,
610
+ cb2,
611
+ startTime
612
+ ));
613
+ } : function go$readdir2(path3, options3, cb2, startTime) {
614
+ return fs$readdir(path3, options3, fs$readdirCallback(
615
+ path3,
616
+ options3,
617
+ cb2,
618
+ startTime
619
+ ));
620
+ };
621
+ return go$readdir(path2, options2, cb);
622
+ function fs$readdirCallback(path3, options3, cb2, startTime) {
623
+ return function(err, files) {
624
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
625
+ enqueue([
626
+ go$readdir,
627
+ [path3, options3, cb2],
628
+ err,
629
+ startTime || Date.now(),
630
+ Date.now()
631
+ ]);
632
+ else {
633
+ if (files && files.sort)
634
+ files.sort();
635
+ if (typeof cb2 === "function")
636
+ cb2.call(this, err, files);
637
+ }
638
+ };
639
+ }
640
+ }
641
+ if (process.version.substr(0, 4) === "v0.8") {
642
+ var legStreams = legacy(fs2);
643
+ ReadStream2 = legStreams.ReadStream;
644
+ WriteStream = legStreams.WriteStream;
645
+ }
646
+ var fs$ReadStream = fs2.ReadStream;
647
+ if (fs$ReadStream) {
648
+ ReadStream2.prototype = Object.create(fs$ReadStream.prototype);
649
+ ReadStream2.prototype.open = ReadStream$open;
650
+ }
651
+ var fs$WriteStream = fs2.WriteStream;
652
+ if (fs$WriteStream) {
653
+ WriteStream.prototype = Object.create(fs$WriteStream.prototype);
654
+ WriteStream.prototype.open = WriteStream$open;
655
+ }
656
+ Object.defineProperty(fs2, "ReadStream", {
657
+ get: function() {
658
+ return ReadStream2;
659
+ },
660
+ set: function(val) {
661
+ ReadStream2 = val;
662
+ },
663
+ enumerable: true,
664
+ configurable: true
665
+ });
666
+ Object.defineProperty(fs2, "WriteStream", {
667
+ get: function() {
668
+ return WriteStream;
669
+ },
670
+ set: function(val) {
671
+ WriteStream = val;
672
+ },
673
+ enumerable: true,
674
+ configurable: true
675
+ });
676
+ var FileReadStream = ReadStream2;
677
+ Object.defineProperty(fs2, "FileReadStream", {
678
+ get: function() {
679
+ return FileReadStream;
680
+ },
681
+ set: function(val) {
682
+ FileReadStream = val;
683
+ },
684
+ enumerable: true,
685
+ configurable: true
686
+ });
687
+ var FileWriteStream = WriteStream;
688
+ Object.defineProperty(fs2, "FileWriteStream", {
689
+ get: function() {
690
+ return FileWriteStream;
691
+ },
692
+ set: function(val) {
693
+ FileWriteStream = val;
694
+ },
695
+ enumerable: true,
696
+ configurable: true
697
+ });
698
+ function ReadStream2(path2, options2) {
699
+ if (this instanceof ReadStream2)
700
+ return fs$ReadStream.apply(this, arguments), this;
701
+ else
702
+ return ReadStream2.apply(Object.create(ReadStream2.prototype), arguments);
703
+ }
704
+ function ReadStream$open() {
705
+ var that = this;
706
+ open(that.path, that.flags, that.mode, function(err, fd) {
707
+ if (err) {
708
+ if (that.autoClose)
709
+ that.destroy();
710
+ that.emit("error", err);
711
+ } else {
712
+ that.fd = fd;
713
+ that.emit("open", fd);
714
+ that.read();
715
+ }
716
+ });
717
+ }
718
+ function WriteStream(path2, options2) {
719
+ if (this instanceof WriteStream)
720
+ return fs$WriteStream.apply(this, arguments), this;
721
+ else
722
+ return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
723
+ }
724
+ function WriteStream$open() {
725
+ var that = this;
726
+ open(that.path, that.flags, that.mode, function(err, fd) {
727
+ if (err) {
728
+ that.destroy();
729
+ that.emit("error", err);
730
+ } else {
731
+ that.fd = fd;
732
+ that.emit("open", fd);
733
+ }
734
+ });
735
+ }
736
+ function createReadStream(path2, options2) {
737
+ return new fs2.ReadStream(path2, options2);
738
+ }
739
+ function createWriteStream(path2, options2) {
740
+ return new fs2.WriteStream(path2, options2);
741
+ }
742
+ var fs$open = fs2.open;
743
+ fs2.open = open;
744
+ function open(path2, flags, mode, cb) {
745
+ if (typeof mode === "function")
746
+ cb = mode, mode = null;
747
+ return go$open(path2, flags, mode, cb);
748
+ function go$open(path3, flags2, mode2, cb2, startTime) {
749
+ return fs$open(path3, flags2, mode2, function(err, fd) {
750
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
751
+ enqueue([go$open, [path3, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
752
+ else {
753
+ if (typeof cb2 === "function")
754
+ cb2.apply(this, arguments);
755
+ }
756
+ });
757
+ }
758
+ }
759
+ return fs2;
760
+ }
761
+ function enqueue(elem) {
762
+ debug("ENQUEUE", elem[0].name, elem[1]);
763
+ fs[gracefulQueue].push(elem);
764
+ retry();
765
+ }
766
+ var retryTimer;
767
+ function resetQueue() {
768
+ var now3 = Date.now();
769
+ for (var i2 = 0; i2 < fs[gracefulQueue].length; ++i2) {
770
+ if (fs[gracefulQueue][i2].length > 2) {
771
+ fs[gracefulQueue][i2][3] = now3;
772
+ fs[gracefulQueue][i2][4] = now3;
773
+ }
774
+ }
775
+ retry();
776
+ }
777
+ function retry() {
778
+ clearTimeout(retryTimer);
779
+ retryTimer = void 0;
780
+ if (fs[gracefulQueue].length === 0)
781
+ return;
782
+ var elem = fs[gracefulQueue].shift();
783
+ var fn = elem[0];
784
+ var args = elem[1];
785
+ var err = elem[2];
786
+ var startTime = elem[3];
787
+ var lastTime = elem[4];
788
+ if (startTime === void 0) {
789
+ debug("RETRY", fn.name, args);
790
+ fn.apply(null, args);
791
+ } else if (Date.now() - startTime >= 6e4) {
792
+ debug("TIMEOUT", fn.name, args);
793
+ var cb = args.pop();
794
+ if (typeof cb === "function")
795
+ cb.call(null, err);
796
+ } else {
797
+ var sinceAttempt = Date.now() - lastTime;
798
+ var sinceStart = Math.max(lastTime - startTime, 1);
799
+ var desiredDelay = Math.min(sinceStart * 1.2, 100);
800
+ if (sinceAttempt >= desiredDelay) {
801
+ debug("RETRY", fn.name, args);
802
+ fn.apply(null, args.concat([startTime]));
803
+ } else {
804
+ fs[gracefulQueue].push(elem);
805
+ }
806
+ }
807
+ if (retryTimer === void 0) {
808
+ retryTimer = setTimeout(retry, 0);
809
+ }
810
+ }
811
+ }
812
+ });
813
+
814
+ // ../../node_modules/.pnpm/retry@0.12.0/node_modules/retry/lib/retry_operation.js
815
+ var require_retry_operation = __commonJS({
816
+ "../../node_modules/.pnpm/retry@0.12.0/node_modules/retry/lib/retry_operation.js"(exports2, module2) {
817
+ function RetryOperation(timeouts, options2) {
818
+ if (typeof options2 === "boolean") {
819
+ options2 = { forever: options2 };
820
+ }
821
+ this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
822
+ this._timeouts = timeouts;
823
+ this._options = options2 || {};
824
+ this._maxRetryTime = options2 && options2.maxRetryTime || Infinity;
825
+ this._fn = null;
826
+ this._errors = [];
827
+ this._attempts = 1;
828
+ this._operationTimeout = null;
829
+ this._operationTimeoutCb = null;
830
+ this._timeout = null;
831
+ this._operationStart = null;
832
+ if (this._options.forever) {
833
+ this._cachedTimeouts = this._timeouts.slice(0);
834
+ }
835
+ }
836
+ module2.exports = RetryOperation;
837
+ RetryOperation.prototype.reset = function() {
838
+ this._attempts = 1;
839
+ this._timeouts = this._originalTimeouts;
840
+ };
841
+ RetryOperation.prototype.stop = function() {
842
+ if (this._timeout) {
843
+ clearTimeout(this._timeout);
844
+ }
845
+ this._timeouts = [];
846
+ this._cachedTimeouts = null;
847
+ };
848
+ RetryOperation.prototype.retry = function(err) {
849
+ if (this._timeout) {
850
+ clearTimeout(this._timeout);
851
+ }
852
+ if (!err) {
853
+ return false;
854
+ }
855
+ var currentTime = (/* @__PURE__ */ new Date()).getTime();
856
+ if (err && currentTime - this._operationStart >= this._maxRetryTime) {
857
+ this._errors.unshift(new Error("RetryOperation timeout occurred"));
858
+ return false;
859
+ }
860
+ this._errors.push(err);
861
+ var timeout = this._timeouts.shift();
862
+ if (timeout === void 0) {
863
+ if (this._cachedTimeouts) {
864
+ this._errors.splice(this._errors.length - 1, this._errors.length);
865
+ this._timeouts = this._cachedTimeouts.slice(0);
866
+ timeout = this._timeouts.shift();
867
+ } else {
868
+ return false;
869
+ }
870
+ }
871
+ var self2 = this;
872
+ var timer = setTimeout(function() {
873
+ self2._attempts++;
874
+ if (self2._operationTimeoutCb) {
875
+ self2._timeout = setTimeout(function() {
876
+ self2._operationTimeoutCb(self2._attempts);
877
+ }, self2._operationTimeout);
878
+ if (self2._options.unref) {
879
+ self2._timeout.unref();
880
+ }
881
+ }
882
+ self2._fn(self2._attempts);
883
+ }, timeout);
884
+ if (this._options.unref) {
885
+ timer.unref();
886
+ }
887
+ return true;
888
+ };
889
+ RetryOperation.prototype.attempt = function(fn, timeoutOps) {
890
+ this._fn = fn;
891
+ if (timeoutOps) {
892
+ if (timeoutOps.timeout) {
893
+ this._operationTimeout = timeoutOps.timeout;
894
+ }
895
+ if (timeoutOps.cb) {
896
+ this._operationTimeoutCb = timeoutOps.cb;
897
+ }
898
+ }
899
+ var self2 = this;
900
+ if (this._operationTimeoutCb) {
901
+ this._timeout = setTimeout(function() {
902
+ self2._operationTimeoutCb();
903
+ }, self2._operationTimeout);
904
+ }
905
+ this._operationStart = (/* @__PURE__ */ new Date()).getTime();
906
+ this._fn(this._attempts);
907
+ };
908
+ RetryOperation.prototype.try = function(fn) {
909
+ console.log("Using RetryOperation.try() is deprecated");
910
+ this.attempt(fn);
911
+ };
912
+ RetryOperation.prototype.start = function(fn) {
913
+ console.log("Using RetryOperation.start() is deprecated");
914
+ this.attempt(fn);
915
+ };
916
+ RetryOperation.prototype.start = RetryOperation.prototype.try;
917
+ RetryOperation.prototype.errors = function() {
918
+ return this._errors;
919
+ };
920
+ RetryOperation.prototype.attempts = function() {
921
+ return this._attempts;
922
+ };
923
+ RetryOperation.prototype.mainError = function() {
924
+ if (this._errors.length === 0) {
925
+ return null;
926
+ }
927
+ var counts = {};
928
+ var mainError = null;
929
+ var mainErrorCount = 0;
930
+ for (var i2 = 0; i2 < this._errors.length; i2++) {
931
+ var error48 = this._errors[i2];
932
+ var message = error48.message;
933
+ var count = (counts[message] || 0) + 1;
934
+ counts[message] = count;
935
+ if (count >= mainErrorCount) {
936
+ mainError = error48;
937
+ mainErrorCount = count;
938
+ }
939
+ }
940
+ return mainError;
941
+ };
942
+ }
943
+ });
944
+
945
+ // ../../node_modules/.pnpm/retry@0.12.0/node_modules/retry/lib/retry.js
946
+ var require_retry = __commonJS({
947
+ "../../node_modules/.pnpm/retry@0.12.0/node_modules/retry/lib/retry.js"(exports2) {
948
+ var RetryOperation = require_retry_operation();
949
+ exports2.operation = function(options2) {
950
+ var timeouts = exports2.timeouts(options2);
951
+ return new RetryOperation(timeouts, {
952
+ forever: options2 && options2.forever,
953
+ unref: options2 && options2.unref,
954
+ maxRetryTime: options2 && options2.maxRetryTime
955
+ });
956
+ };
957
+ exports2.timeouts = function(options2) {
958
+ if (options2 instanceof Array) {
959
+ return [].concat(options2);
960
+ }
961
+ var opts = {
962
+ retries: 10,
963
+ factor: 2,
964
+ minTimeout: 1 * 1e3,
965
+ maxTimeout: Infinity,
966
+ randomize: false
967
+ };
968
+ for (var key in options2) {
969
+ opts[key] = options2[key];
970
+ }
971
+ if (opts.minTimeout > opts.maxTimeout) {
972
+ throw new Error("minTimeout is greater than maxTimeout");
973
+ }
974
+ var timeouts = [];
975
+ for (var i2 = 0; i2 < opts.retries; i2++) {
976
+ timeouts.push(this.createTimeout(i2, opts));
977
+ }
978
+ if (options2 && options2.forever && !timeouts.length) {
979
+ timeouts.push(this.createTimeout(i2, opts));
980
+ }
981
+ timeouts.sort(function(a2, b3) {
982
+ return a2 - b3;
983
+ });
984
+ return timeouts;
985
+ };
986
+ exports2.createTimeout = function(attempt, opts) {
987
+ var random = opts.randomize ? Math.random() + 1 : 1;
988
+ var timeout = Math.round(random * opts.minTimeout * Math.pow(opts.factor, attempt));
989
+ timeout = Math.min(timeout, opts.maxTimeout);
990
+ return timeout;
991
+ };
992
+ exports2.wrap = function(obj, options2, methods2) {
993
+ if (options2 instanceof Array) {
994
+ methods2 = options2;
995
+ options2 = null;
996
+ }
997
+ if (!methods2) {
998
+ methods2 = [];
999
+ for (var key in obj) {
1000
+ if (typeof obj[key] === "function") {
1001
+ methods2.push(key);
1002
+ }
1003
+ }
1004
+ }
1005
+ for (var i2 = 0; i2 < methods2.length; i2++) {
1006
+ var method = methods2[i2];
1007
+ var original = obj[method];
1008
+ obj[method] = function retryWrapper(original2) {
1009
+ var op = exports2.operation(options2);
1010
+ var args = Array.prototype.slice.call(arguments, 1);
1011
+ var callback = args.pop();
1012
+ args.push(function(err) {
1013
+ if (op.retry(err)) {
1014
+ return;
1015
+ }
1016
+ if (err) {
1017
+ arguments[0] = op.mainError();
1018
+ }
1019
+ callback.apply(this, arguments);
1020
+ });
1021
+ op.attempt(function() {
1022
+ original2.apply(obj, args);
1023
+ });
1024
+ }.bind(obj, original);
1025
+ obj[method].options = options2;
1026
+ }
1027
+ };
1028
+ }
1029
+ });
1030
+
1031
+ // ../../node_modules/.pnpm/retry@0.12.0/node_modules/retry/index.js
1032
+ var require_retry2 = __commonJS({
1033
+ "../../node_modules/.pnpm/retry@0.12.0/node_modules/retry/index.js"(exports2, module2) {
1034
+ module2.exports = require_retry();
1035
+ }
1036
+ });
1037
+
1038
+ // ../../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/signals.js
1039
+ var require_signals = __commonJS({
1040
+ "../../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/signals.js"(exports2, module2) {
1041
+ module2.exports = [
1042
+ "SIGABRT",
1043
+ "SIGALRM",
1044
+ "SIGHUP",
1045
+ "SIGINT",
1046
+ "SIGTERM"
1047
+ ];
1048
+ if (process.platform !== "win32") {
1049
+ module2.exports.push(
1050
+ "SIGVTALRM",
1051
+ "SIGXCPU",
1052
+ "SIGXFSZ",
1053
+ "SIGUSR2",
1054
+ "SIGTRAP",
1055
+ "SIGSYS",
1056
+ "SIGQUIT",
1057
+ "SIGIOT"
1058
+ // should detect profiler and enable/disable accordingly.
1059
+ // see #21
1060
+ // 'SIGPROF'
1061
+ );
1062
+ }
1063
+ if (process.platform === "linux") {
1064
+ module2.exports.push(
1065
+ "SIGIO",
1066
+ "SIGPOLL",
1067
+ "SIGPWR",
1068
+ "SIGSTKFLT",
1069
+ "SIGUNUSED"
1070
+ );
1071
+ }
1072
+ }
1073
+ });
1074
+
1075
+ // ../../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js
1076
+ var require_signal_exit = __commonJS({
1077
+ "../../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js"(exports2, module2) {
1078
+ var process7 = global.process;
1079
+ var processOk = function(process8) {
1080
+ return process8 && typeof process8 === "object" && typeof process8.removeListener === "function" && typeof process8.emit === "function" && typeof process8.reallyExit === "function" && typeof process8.listeners === "function" && typeof process8.kill === "function" && typeof process8.pid === "number" && typeof process8.on === "function";
1081
+ };
1082
+ if (!processOk(process7)) {
1083
+ module2.exports = function() {
1084
+ return function() {
1085
+ };
1086
+ };
1087
+ } else {
1088
+ assert2 = require("assert");
1089
+ signals = require_signals();
1090
+ isWin = /^win/i.test(process7.platform);
1091
+ EE = require("events");
1092
+ if (typeof EE !== "function") {
1093
+ EE = EE.EventEmitter;
1094
+ }
1095
+ if (process7.__signal_exit_emitter__) {
1096
+ emitter = process7.__signal_exit_emitter__;
1097
+ } else {
1098
+ emitter = process7.__signal_exit_emitter__ = new EE();
1099
+ emitter.count = 0;
1100
+ emitter.emitted = {};
1101
+ }
1102
+ if (!emitter.infinite) {
1103
+ emitter.setMaxListeners(Infinity);
1104
+ emitter.infinite = true;
1105
+ }
1106
+ module2.exports = function(cb, opts) {
1107
+ if (!processOk(global.process)) {
1108
+ return function() {
1109
+ };
1110
+ }
1111
+ assert2.equal(typeof cb, "function", "a callback must be provided for exit handler");
1112
+ if (loaded === false) {
1113
+ load();
1114
+ }
1115
+ var ev = "exit";
1116
+ if (opts && opts.alwaysLast) {
1117
+ ev = "afterexit";
1118
+ }
1119
+ var remove = function() {
1120
+ emitter.removeListener(ev, cb);
1121
+ if (emitter.listeners("exit").length === 0 && emitter.listeners("afterexit").length === 0) {
1122
+ unload();
1123
+ }
1124
+ };
1125
+ emitter.on(ev, cb);
1126
+ return remove;
1127
+ };
1128
+ unload = function unload2() {
1129
+ if (!loaded || !processOk(global.process)) {
1130
+ return;
1131
+ }
1132
+ loaded = false;
1133
+ signals.forEach(function(sig) {
1134
+ try {
1135
+ process7.removeListener(sig, sigListeners[sig]);
1136
+ } catch (er) {
1137
+ }
1138
+ });
1139
+ process7.emit = originalProcessEmit;
1140
+ process7.reallyExit = originalProcessReallyExit;
1141
+ emitter.count -= 1;
1142
+ };
1143
+ module2.exports.unload = unload;
1144
+ emit = function emit2(event, code, signal) {
1145
+ if (emitter.emitted[event]) {
1146
+ return;
1147
+ }
1148
+ emitter.emitted[event] = true;
1149
+ emitter.emit(event, code, signal);
1150
+ };
1151
+ sigListeners = {};
1152
+ signals.forEach(function(sig) {
1153
+ sigListeners[sig] = function listener() {
1154
+ if (!processOk(global.process)) {
1155
+ return;
1156
+ }
1157
+ var listeners = process7.listeners(sig);
1158
+ if (listeners.length === emitter.count) {
1159
+ unload();
1160
+ emit("exit", null, sig);
1161
+ emit("afterexit", null, sig);
1162
+ if (isWin && sig === "SIGHUP") {
1163
+ sig = "SIGINT";
1164
+ }
1165
+ process7.kill(process7.pid, sig);
1166
+ }
1167
+ };
1168
+ });
1169
+ module2.exports.signals = function() {
1170
+ return signals;
1171
+ };
1172
+ loaded = false;
1173
+ load = function load2() {
1174
+ if (loaded || !processOk(global.process)) {
1175
+ return;
1176
+ }
1177
+ loaded = true;
1178
+ emitter.count += 1;
1179
+ signals = signals.filter(function(sig) {
1180
+ try {
1181
+ process7.on(sig, sigListeners[sig]);
1182
+ return true;
1183
+ } catch (er) {
1184
+ return false;
1185
+ }
1186
+ });
1187
+ process7.emit = processEmit;
1188
+ process7.reallyExit = processReallyExit;
1189
+ };
1190
+ module2.exports.load = load;
1191
+ originalProcessReallyExit = process7.reallyExit;
1192
+ processReallyExit = function processReallyExit2(code) {
1193
+ if (!processOk(global.process)) {
1194
+ return;
1195
+ }
1196
+ process7.exitCode = code || /* istanbul ignore next */
1197
+ 0;
1198
+ emit("exit", process7.exitCode, null);
1199
+ emit("afterexit", process7.exitCode, null);
1200
+ originalProcessReallyExit.call(process7, process7.exitCode);
1201
+ };
1202
+ originalProcessEmit = process7.emit;
1203
+ processEmit = function processEmit2(ev, arg) {
1204
+ if (ev === "exit" && processOk(global.process)) {
1205
+ if (arg !== void 0) {
1206
+ process7.exitCode = arg;
1207
+ }
1208
+ var ret = originalProcessEmit.apply(this, arguments);
1209
+ emit("exit", process7.exitCode, null);
1210
+ emit("afterexit", process7.exitCode, null);
1211
+ return ret;
1212
+ } else {
1213
+ return originalProcessEmit.apply(this, arguments);
1214
+ }
1215
+ };
1216
+ }
1217
+ var assert2;
1218
+ var signals;
1219
+ var isWin;
1220
+ var EE;
1221
+ var emitter;
1222
+ var unload;
1223
+ var emit;
1224
+ var sigListeners;
1225
+ var loaded;
1226
+ var load;
1227
+ var originalProcessReallyExit;
1228
+ var processReallyExit;
1229
+ var originalProcessEmit;
1230
+ var processEmit;
1231
+ }
1232
+ });
1233
+
1234
+ // ../../node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/mtime-precision.js
1235
+ var require_mtime_precision = __commonJS({
1236
+ "../../node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/mtime-precision.js"(exports2, module2) {
1237
+ "use strict";
1238
+ var cacheSymbol = /* @__PURE__ */ Symbol();
1239
+ function probe(file2, fs, callback) {
1240
+ const cachedPrecision = fs[cacheSymbol];
1241
+ if (cachedPrecision) {
1242
+ return fs.stat(file2, (err, stat) => {
1243
+ if (err) {
1244
+ return callback(err);
1245
+ }
1246
+ callback(null, stat.mtime, cachedPrecision);
1247
+ });
1248
+ }
1249
+ const mtime = new Date(Math.ceil(Date.now() / 1e3) * 1e3 + 5);
1250
+ fs.utimes(file2, mtime, mtime, (err) => {
1251
+ if (err) {
1252
+ return callback(err);
1253
+ }
1254
+ fs.stat(file2, (err2, stat) => {
1255
+ if (err2) {
1256
+ return callback(err2);
1257
+ }
1258
+ const precision = stat.mtime.getTime() % 1e3 === 0 ? "s" : "ms";
1259
+ Object.defineProperty(fs, cacheSymbol, { value: precision });
1260
+ callback(null, stat.mtime, precision);
1261
+ });
1262
+ });
1263
+ }
1264
+ function getMtime(precision) {
1265
+ let now3 = Date.now();
1266
+ if (precision === "s") {
1267
+ now3 = Math.ceil(now3 / 1e3) * 1e3;
1268
+ }
1269
+ return new Date(now3);
1270
+ }
1271
+ module2.exports.probe = probe;
1272
+ module2.exports.getMtime = getMtime;
1273
+ }
1274
+ });
1275
+
1276
+ // ../../node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/lockfile.js
1277
+ var require_lockfile = __commonJS({
1278
+ "../../node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/lockfile.js"(exports2, module2) {
1279
+ "use strict";
1280
+ var path2 = require("path");
1281
+ var fs = require_graceful_fs();
1282
+ var retry = require_retry2();
1283
+ var onExit = require_signal_exit();
1284
+ var mtimePrecision = require_mtime_precision();
1285
+ var locks = {};
1286
+ function getLockFile(file2, options2) {
1287
+ return options2.lockfilePath || `${file2}.lock`;
1288
+ }
1289
+ function resolveCanonicalPath(file2, options2, callback) {
1290
+ if (!options2.realpath) {
1291
+ return callback(null, path2.resolve(file2));
1292
+ }
1293
+ options2.fs.realpath(file2, callback);
1294
+ }
1295
+ function acquireLock(file2, options2, callback) {
1296
+ const lockfilePath = getLockFile(file2, options2);
1297
+ options2.fs.mkdir(lockfilePath, (err) => {
1298
+ if (!err) {
1299
+ return mtimePrecision.probe(lockfilePath, options2.fs, (err2, mtime, mtimePrecision2) => {
1300
+ if (err2) {
1301
+ options2.fs.rmdir(lockfilePath, () => {
1302
+ });
1303
+ return callback(err2);
1304
+ }
1305
+ callback(null, mtime, mtimePrecision2);
1306
+ });
1307
+ }
1308
+ if (err.code !== "EEXIST") {
1309
+ return callback(err);
1310
+ }
1311
+ if (options2.stale <= 0) {
1312
+ return callback(Object.assign(new Error("Lock file is already being held"), { code: "ELOCKED", file: file2 }));
1313
+ }
1314
+ options2.fs.stat(lockfilePath, (err2, stat) => {
1315
+ if (err2) {
1316
+ if (err2.code === "ENOENT") {
1317
+ return acquireLock(file2, { ...options2, stale: 0 }, callback);
1318
+ }
1319
+ return callback(err2);
1320
+ }
1321
+ if (!isLockStale(stat, options2)) {
1322
+ return callback(Object.assign(new Error("Lock file is already being held"), { code: "ELOCKED", file: file2 }));
1323
+ }
1324
+ removeLock(file2, options2, (err3) => {
1325
+ if (err3) {
1326
+ return callback(err3);
1327
+ }
1328
+ acquireLock(file2, { ...options2, stale: 0 }, callback);
1329
+ });
1330
+ });
1331
+ });
1332
+ }
1333
+ function isLockStale(stat, options2) {
1334
+ return stat.mtime.getTime() < Date.now() - options2.stale;
1335
+ }
1336
+ function removeLock(file2, options2, callback) {
1337
+ options2.fs.rmdir(getLockFile(file2, options2), (err) => {
1338
+ if (err && err.code !== "ENOENT") {
1339
+ return callback(err);
1340
+ }
1341
+ callback();
1342
+ });
1343
+ }
1344
+ function updateLock(file2, options2) {
1345
+ const lock2 = locks[file2];
1346
+ if (lock2.updateTimeout) {
1347
+ return;
1348
+ }
1349
+ lock2.updateDelay = lock2.updateDelay || options2.update;
1350
+ lock2.updateTimeout = setTimeout(() => {
1351
+ lock2.updateTimeout = null;
1352
+ options2.fs.stat(lock2.lockfilePath, (err, stat) => {
1353
+ const isOverThreshold = lock2.lastUpdate + options2.stale < Date.now();
1354
+ if (err) {
1355
+ if (err.code === "ENOENT" || isOverThreshold) {
1356
+ return setLockAsCompromised(file2, lock2, Object.assign(err, { code: "ECOMPROMISED" }));
1357
+ }
1358
+ lock2.updateDelay = 1e3;
1359
+ return updateLock(file2, options2);
1360
+ }
1361
+ const isMtimeOurs = lock2.mtime.getTime() === stat.mtime.getTime();
1362
+ if (!isMtimeOurs) {
1363
+ return setLockAsCompromised(
1364
+ file2,
1365
+ lock2,
1366
+ Object.assign(
1367
+ new Error("Unable to update lock within the stale threshold"),
1368
+ { code: "ECOMPROMISED" }
1369
+ )
1370
+ );
1371
+ }
1372
+ const mtime = mtimePrecision.getMtime(lock2.mtimePrecision);
1373
+ options2.fs.utimes(lock2.lockfilePath, mtime, mtime, (err2) => {
1374
+ const isOverThreshold2 = lock2.lastUpdate + options2.stale < Date.now();
1375
+ if (lock2.released) {
1376
+ return;
1377
+ }
1378
+ if (err2) {
1379
+ if (err2.code === "ENOENT" || isOverThreshold2) {
1380
+ return setLockAsCompromised(file2, lock2, Object.assign(err2, { code: "ECOMPROMISED" }));
1381
+ }
1382
+ lock2.updateDelay = 1e3;
1383
+ return updateLock(file2, options2);
1384
+ }
1385
+ lock2.mtime = mtime;
1386
+ lock2.lastUpdate = Date.now();
1387
+ lock2.updateDelay = null;
1388
+ updateLock(file2, options2);
1389
+ });
1390
+ });
1391
+ }, lock2.updateDelay);
1392
+ if (lock2.updateTimeout.unref) {
1393
+ lock2.updateTimeout.unref();
1394
+ }
1395
+ }
1396
+ function setLockAsCompromised(file2, lock2, err) {
1397
+ lock2.released = true;
1398
+ if (lock2.updateTimeout) {
1399
+ clearTimeout(lock2.updateTimeout);
1400
+ }
1401
+ if (locks[file2] === lock2) {
1402
+ delete locks[file2];
1403
+ }
1404
+ lock2.options.onCompromised(err);
1405
+ }
1406
+ function lock(file2, options2, callback) {
1407
+ options2 = {
1408
+ stale: 1e4,
1409
+ update: null,
1410
+ realpath: true,
1411
+ retries: 0,
1412
+ fs,
1413
+ onCompromised: (err) => {
1414
+ throw err;
1415
+ },
1416
+ ...options2
1417
+ };
1418
+ options2.retries = options2.retries || 0;
1419
+ options2.retries = typeof options2.retries === "number" ? { retries: options2.retries } : options2.retries;
1420
+ options2.stale = Math.max(options2.stale || 0, 2e3);
1421
+ options2.update = options2.update == null ? options2.stale / 2 : options2.update || 0;
1422
+ options2.update = Math.max(Math.min(options2.update, options2.stale / 2), 1e3);
1423
+ resolveCanonicalPath(file2, options2, (err, file3) => {
1424
+ if (err) {
1425
+ return callback(err);
1426
+ }
1427
+ const operation = retry.operation(options2.retries);
1428
+ operation.attempt(() => {
1429
+ acquireLock(file3, options2, (err2, mtime, mtimePrecision2) => {
1430
+ if (operation.retry(err2)) {
1431
+ return;
1432
+ }
1433
+ if (err2) {
1434
+ return callback(operation.mainError());
1435
+ }
1436
+ const lock2 = locks[file3] = {
1437
+ lockfilePath: getLockFile(file3, options2),
1438
+ mtime,
1439
+ mtimePrecision: mtimePrecision2,
1440
+ options: options2,
1441
+ lastUpdate: Date.now()
1442
+ };
1443
+ updateLock(file3, options2);
1444
+ callback(null, (releasedCallback) => {
1445
+ if (lock2.released) {
1446
+ return releasedCallback && releasedCallback(Object.assign(new Error("Lock is already released"), { code: "ERELEASED" }));
1447
+ }
1448
+ unlock(file3, { ...options2, realpath: false }, releasedCallback);
1449
+ });
1450
+ });
1451
+ });
1452
+ });
1453
+ }
1454
+ function unlock(file2, options2, callback) {
1455
+ options2 = {
1456
+ fs,
1457
+ realpath: true,
1458
+ ...options2
1459
+ };
1460
+ resolveCanonicalPath(file2, options2, (err, file3) => {
1461
+ if (err) {
1462
+ return callback(err);
1463
+ }
1464
+ const lock2 = locks[file3];
1465
+ if (!lock2) {
1466
+ return callback(Object.assign(new Error("Lock is not acquired/owned by you"), { code: "ENOTACQUIRED" }));
1467
+ }
1468
+ lock2.updateTimeout && clearTimeout(lock2.updateTimeout);
1469
+ lock2.released = true;
1470
+ delete locks[file3];
1471
+ removeLock(file3, options2, callback);
1472
+ });
1473
+ }
1474
+ function check2(file2, options2, callback) {
1475
+ options2 = {
1476
+ stale: 1e4,
1477
+ realpath: true,
1478
+ fs,
1479
+ ...options2
1480
+ };
1481
+ options2.stale = Math.max(options2.stale || 0, 2e3);
1482
+ resolveCanonicalPath(file2, options2, (err, file3) => {
1483
+ if (err) {
1484
+ return callback(err);
1485
+ }
1486
+ options2.fs.stat(getLockFile(file3, options2), (err2, stat) => {
1487
+ if (err2) {
1488
+ return err2.code === "ENOENT" ? callback(null, false) : callback(err2);
1489
+ }
1490
+ return callback(null, !isLockStale(stat, options2));
1491
+ });
1492
+ });
1493
+ }
1494
+ function getLocks() {
1495
+ return locks;
1496
+ }
1497
+ onExit(() => {
1498
+ for (const file2 in locks) {
1499
+ const options2 = locks[file2].options;
1500
+ try {
1501
+ options2.fs.rmdirSync(getLockFile(file2, options2));
1502
+ } catch (e) {
1503
+ }
1504
+ }
1505
+ });
1506
+ module2.exports.lock = lock;
1507
+ module2.exports.unlock = unlock;
1508
+ module2.exports.check = check2;
1509
+ module2.exports.getLocks = getLocks;
1510
+ }
1511
+ });
1512
+
1513
+ // ../../node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/adapter.js
1514
+ var require_adapter = __commonJS({
1515
+ "../../node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/adapter.js"(exports2, module2) {
1516
+ "use strict";
1517
+ var fs = require_graceful_fs();
1518
+ function createSyncFs(fs2) {
1519
+ const methods2 = ["mkdir", "realpath", "stat", "rmdir", "utimes"];
1520
+ const newFs = { ...fs2 };
1521
+ methods2.forEach((method) => {
1522
+ newFs[method] = (...args) => {
1523
+ const callback = args.pop();
1524
+ let ret;
1525
+ try {
1526
+ ret = fs2[`${method}Sync`](...args);
1527
+ } catch (err) {
1528
+ return callback(err);
1529
+ }
1530
+ callback(null, ret);
1531
+ };
1532
+ });
1533
+ return newFs;
1534
+ }
1535
+ function toPromise(method) {
1536
+ return (...args) => new Promise((resolve, reject) => {
1537
+ args.push((err, result) => {
1538
+ if (err) {
1539
+ reject(err);
1540
+ } else {
1541
+ resolve(result);
1542
+ }
1543
+ });
1544
+ method(...args);
1545
+ });
1546
+ }
1547
+ function toSync(method) {
1548
+ return (...args) => {
1549
+ let err;
1550
+ let result;
1551
+ args.push((_err, _result) => {
1552
+ err = _err;
1553
+ result = _result;
1554
+ });
1555
+ method(...args);
1556
+ if (err) {
1557
+ throw err;
1558
+ }
1559
+ return result;
1560
+ };
1561
+ }
1562
+ function toSyncOptions(options2) {
1563
+ options2 = { ...options2 };
1564
+ options2.fs = createSyncFs(options2.fs || fs);
1565
+ if (typeof options2.retries === "number" && options2.retries > 0 || options2.retries && typeof options2.retries.retries === "number" && options2.retries.retries > 0) {
1566
+ throw Object.assign(new Error("Cannot use retries with the sync api"), { code: "ESYNC" });
1567
+ }
1568
+ return options2;
1569
+ }
1570
+ module2.exports = {
1571
+ toPromise,
1572
+ toSync,
1573
+ toSyncOptions
1574
+ };
1575
+ }
1576
+ });
1577
+
1578
+ // ../../node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/index.js
1579
+ var require_proper_lockfile = __commonJS({
1580
+ "../../node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/index.js"(exports2, module2) {
1581
+ "use strict";
1582
+ var lockfile = require_lockfile();
1583
+ var { toPromise, toSync, toSyncOptions } = require_adapter();
1584
+ async function lock(file2, options2) {
1585
+ const release = await toPromise(lockfile.lock)(file2, options2);
1586
+ return toPromise(release);
1587
+ }
1588
+ function lockSync(file2, options2) {
1589
+ const release = toSync(lockfile.lock)(file2, toSyncOptions(options2));
1590
+ return toSync(release);
1591
+ }
1592
+ function unlock(file2, options2) {
1593
+ return toPromise(lockfile.unlock)(file2, options2);
1594
+ }
1595
+ function unlockSync(file2, options2) {
1596
+ return toSync(lockfile.unlock)(file2, toSyncOptions(options2));
1597
+ }
1598
+ function check2(file2, options2) {
1599
+ return toPromise(lockfile.check)(file2, options2);
1600
+ }
1601
+ function checkSync(file2, options2) {
1602
+ return toSync(lockfile.check)(file2, toSyncOptions(options2));
1603
+ }
1604
+ module2.exports = lock;
1605
+ module2.exports.lock = lock;
1606
+ module2.exports.unlock = unlock;
1607
+ module2.exports.lockSync = lockSync;
1608
+ module2.exports.unlockSync = unlockSync;
1609
+ module2.exports.check = check2;
1610
+ module2.exports.checkSync = checkSync;
1611
+ }
1612
+ });
1613
+
1614
+ // ../../packages/local-config/dist/credential-mutations.js
1615
+ var require_credential_mutations = __commonJS({
1616
+ "../../packages/local-config/dist/credential-mutations.js"(exports2) {
1617
+ "use strict";
1618
+ Object.defineProperty(exports2, "__esModule", { value: true });
1619
+ exports2.withCredentialMutation = withCredentialMutation;
1620
+ exports2.coordinateCredentialMutations = coordinateCredentialMutations;
1621
+ var node_async_hooks_1 = require("node:async_hooks");
1622
+ var node_crypto_1 = require("node:crypto");
1623
+ var promises_1 = require("node:fs/promises");
1624
+ var node_os_1 = require("node:os");
1625
+ var node_path_1 = require("node:path");
1626
+ var proper_lockfile_1 = require_proper_lockfile();
1627
+ var held = new node_async_hooks_1.AsyncLocalStorage();
1628
+ async function withCredentialMutation(ref, operation) {
1629
+ if (ref.provider !== "keychain")
1630
+ return await operation();
1631
+ const key = (0, node_crypto_1.createHash)("sha256").update(JSON.stringify([ref.provider, ref.service, ref.account])).digest("hex");
1632
+ const inherited = held.getStore();
1633
+ if (inherited?.get(key)?.active)
1634
+ return await operation();
1635
+ const directory = (0, node_path_1.join)((0, node_os_1.homedir)(), ".tela", "credential-locks");
1636
+ await (0, promises_1.mkdir)(directory, { recursive: true, mode: 448 });
1637
+ const info = await (0, promises_1.lstat)(directory);
1638
+ if (!info.isDirectory() || info.uid !== process.getuid?.() || (info.mode & 63) !== 0)
1639
+ throw new Error("Unsafe credential lock directory");
1640
+ const release = await (0, proper_lockfile_1.lock)((0, node_path_1.join)(directory, key), {
1641
+ realpath: false,
1642
+ stale: 6e4,
1643
+ update: 5e3,
1644
+ retries: { retries: 40, factor: 1, minTimeout: 250, maxTimeout: 250 }
1645
+ });
1646
+ const owner = { active: true };
1647
+ try {
1648
+ return await held.run(new Map([...inherited ?? [], [key, owner]]), operation);
1649
+ } finally {
1650
+ owner.active = false;
1651
+ await release();
1652
+ }
1653
+ }
1654
+ function coordinateCredentialMutations(adapter2) {
1655
+ return {
1656
+ ...adapter2,
1657
+ set: async (ref, credential) => await withCredentialMutation(ref, async () => await adapter2.set(ref, credential)),
1658
+ delete: async (ref) => await withCredentialMutation(ref, async () => await adapter2.delete(ref))
1659
+ };
1660
+ }
1661
+ }
1662
+ });
1663
+
37
1664
  // ../../packages/local-config/dist/credentials.js
38
1665
  var require_credentials = __commonJS({
39
1666
  "../../packages/local-config/dist/credentials.js"(exports2) {
40
1667
  "use strict";
41
1668
  Object.defineProperty(exports2, "__esModule", { value: true });
42
- exports2.isExpired = isExpired;
1669
+ exports2.isExpired = isExpired2;
43
1670
  exports2.diagnoseStoredCredential = diagnoseStoredCredential;
44
1671
  exports2.createEnvCredentialAdapter = createEnvCredentialAdapter;
45
1672
  exports2.createMemoryCredentialAdapter = createMemoryCredentialAdapter;
46
1673
  exports2.refKey = refKey;
47
1674
  exports2.projectCredentialUser = projectCredentialUser;
48
1675
  exports2.projectCredentialOrganization = projectCredentialOrganization;
49
- function isExpired(credential, now3 = /* @__PURE__ */ new Date()) {
1676
+ function isExpired2(credential, now3 = /* @__PURE__ */ new Date()) {
50
1677
  if (!credential.expiresAt)
51
1678
  return false;
52
1679
  return new Date(credential.expiresAt).getTime() <= now3.getTime();
@@ -63,7 +1690,7 @@ var require_credentials = __commonJS({
63
1690
  };
64
1691
  }
65
1692
  const refreshable = credential.kind === "user-session" && Boolean(credential.refreshToken);
66
- const expired = isExpired(credential, now3);
1693
+ const expired = isExpired2(credential, now3);
67
1694
  return {
68
1695
  ok: !expired || refreshable,
69
1696
  provider: ref.provider,
@@ -159,26 +1786,64 @@ var require_auth = __commonJS({
159
1786
  "../../packages/local-config/dist/auth.js"(exports2) {
160
1787
  "use strict";
161
1788
  Object.defineProperty(exports2, "__esModule", { value: true });
162
- exports2.shouldRefreshUserSession = shouldRefreshUserSession;
163
- exports2.refreshUserSessionCredential = refreshUserSessionCredential3;
1789
+ exports2.shouldRefreshUserSession = shouldRefreshUserSession2;
1790
+ exports2.refreshUserSessionCredential = refreshUserSessionCredential2;
164
1791
  exports2.createStoredUserSession = createStoredUserSession;
165
1792
  exports2.getJwtExpiresAt = getJwtExpiresAt;
166
1793
  var node_buffer_1 = require("node:buffer");
1794
+ var credential_mutations_1 = require_credential_mutations();
167
1795
  var credentials_1 = require_credentials();
168
- function shouldRefreshUserSession(credential, now3 = refreshSkewDate()) {
1796
+ function shouldRefreshUserSession2(credential, now3 = refreshSkewDate()) {
169
1797
  return credential.kind === "user-session" && Boolean(credential.refreshToken) && (0, credentials_1.isExpired)(credential, now3);
170
1798
  }
171
- async function refreshUserSessionCredential3(environment, credentialRef, credential, credentials, options2 = {}) {
172
- if (!shouldRefreshUserSession(credential, options2.now ?? refreshSkewDate())) {
173
- return credential;
174
- }
175
- if (!credential.refreshToken) {
1799
+ var refreshQueues = /* @__PURE__ */ new Map();
1800
+ var pendingWrites = /* @__PURE__ */ new Map();
1801
+ async function refreshUserSessionCredential2(environment, credentialRef, credential, credentials, options2 = {}) {
1802
+ if (!shouldRefreshUserSession2(credential, options2.now ?? refreshSkewDate()))
176
1803
  return credential;
1804
+ const key = JSON.stringify([credentialRef.provider, credentialRef.service, credentialRef.account, credentialRef.kind]);
1805
+ const previous = refreshQueues.get(key) ?? Promise.resolve();
1806
+ const operation = previous.catch(() => void 0).then(async () => {
1807
+ let current = await credentials.get(credentialRef);
1808
+ if (!current) {
1809
+ pendingWrites.delete(key);
1810
+ throw new Error("Session was removed. Sign in again.");
1811
+ }
1812
+ const pending = pendingWrites.get(key);
1813
+ if (pending && pending.previousToken === current.refreshToken) {
1814
+ current = await persist(current.refreshToken, pending.credential);
1815
+ }
1816
+ pendingWrites.delete(key);
1817
+ if (!shouldRefreshUserSession2(current, options2.now ?? refreshSkewDate()) || !current.refreshToken)
1818
+ return current;
1819
+ const tokens = await refreshApplicationToken(environment.authApiUrl, current.refreshToken);
1820
+ const refreshed = createStoredUserSession(tokens, current);
1821
+ pendingWrites.set(key, { previousToken: current.refreshToken, credential: refreshed });
1822
+ return await persist(current.refreshToken, refreshed);
1823
+ async function persist(expectedToken, candidate) {
1824
+ return await (0, credential_mutations_1.withCredentialMutation)(credentialRef, async () => {
1825
+ const latest = await credentials.get(credentialRef);
1826
+ if (!latest) {
1827
+ pendingWrites.delete(key);
1828
+ throw new Error("Session was removed. Sign in again.");
1829
+ }
1830
+ if (latest.refreshToken !== expectedToken) {
1831
+ pendingWrites.delete(key);
1832
+ return latest;
1833
+ }
1834
+ await credentials.set(credentialRef, candidate);
1835
+ pendingWrites.delete(key);
1836
+ return candidate;
1837
+ });
1838
+ }
1839
+ });
1840
+ refreshQueues.set(key, operation);
1841
+ try {
1842
+ return await operation;
1843
+ } finally {
1844
+ if (refreshQueues.get(key) === operation)
1845
+ refreshQueues.delete(key);
177
1846
  }
178
- const tokens = await refreshApplicationToken(environment.authApiUrl, credential.refreshToken);
179
- const refreshed = createStoredUserSession(tokens, credential);
180
- await credentials.set(credentialRef, refreshed);
181
- return refreshed;
182
1847
  }
183
1848
  function createStoredUserSession(tokens, previousCredential = {}) {
184
1849
  const previousRaw = sanitizeCredentialRaw(previousCredential.raw);
@@ -222,6 +1887,7 @@ var require_auth = __commonJS({
222
1887
  async function authApiRequest(authApiUrl, routePath, { method = "GET", body, headers = {} } = {}) {
223
1888
  const response = await fetch(`${authApiUrl.replace(/\/+$/, "")}${authApiRoute(routePath)}`, {
224
1889
  method,
1890
+ signal: AbortSignal.timeout(2e4),
225
1891
  headers: {
226
1892
  accept: "application/json",
227
1893
  ...body === void 0 ? {} : { "content-type": "application/json" },
@@ -16914,6 +18580,7 @@ var require_keychain = __commonJS({
16914
18580
  exports2.createLinuxKeychainAdapter = createLinuxKeychainAdapter;
16915
18581
  exports2.runSecretToolProcess = runSecretToolProcess;
16916
18582
  exports2.createKeychainAdapter = createKeychainAdapter;
18583
+ var credential_mutations_1 = require_credential_mutations();
16917
18584
  var node_buffer_1 = require("node:buffer");
16918
18585
  var node_child_process_1 = require("node:child_process");
16919
18586
  var node_util_1 = require("node:util");
@@ -16937,7 +18604,7 @@ var require_keychain = __commonJS({
16937
18604
  throw error48;
16938
18605
  }
16939
18606
  }
16940
- return {
18607
+ return (0, credential_mutations_1.coordinateCredentialMutations)({
16941
18608
  get: get2,
16942
18609
  async set(ref, credential) {
16943
18610
  await run("security", [
@@ -16976,7 +18643,7 @@ var require_keychain = __commonJS({
16976
18643
  return diagnostic(ref, "unreadable");
16977
18644
  }
16978
18645
  }
16979
- };
18646
+ });
16980
18647
  }
16981
18648
  async function runCommand(command, args) {
16982
18649
  return await execFileAsync(command, args, { encoding: "utf8" });
@@ -17059,7 +18726,7 @@ var require_keychain = __commonJS({
17059
18726
  return null;
17060
18727
  return parseStoredCredential(raw, ref);
17061
18728
  }
17062
- return {
18729
+ return (0, credential_mutations_1.coordinateCredentialMutations)({
17063
18730
  get: get2,
17064
18731
  async set(ref, credential) {
17065
18732
  const payload = JSON.stringify(credential);
@@ -17089,7 +18756,7 @@ var require_keychain = __commonJS({
17089
18756
  return diagnostic(ref, "unreadable");
17090
18757
  }
17091
18758
  }
17092
- };
18759
+ });
17093
18760
  }
17094
18761
  async function runSecretTool(args, input) {
17095
18762
  return await runSecretToolProcess("secret-tool", args, input);
@@ -17665,6 +19332,102 @@ var require_public = __commonJS({
17665
19332
  }
17666
19333
  });
17667
19334
 
19335
+ // ../../packages/local-config/dist/session-broker.js
19336
+ var require_session_broker = __commonJS({
19337
+ "../../packages/local-config/dist/session-broker.js"(exports2) {
19338
+ "use strict";
19339
+ Object.defineProperty(exports2, "__esModule", { value: true });
19340
+ exports2.SessionBrokerUnavailableError = exports2.SESSION_BROKER_MAX_BYTES = exports2.SESSION_BROKER_ROUTE = exports2.sessionBrokerRequestSchema = exports2.sessionBrokerDescriptorSchema = void 0;
19341
+ exports2.sessionBrokerPaths = sessionBrokerPaths;
19342
+ exports2.requestDockSessionRefresh = requestDockSessionRefresh2;
19343
+ exports2.isDockSessionBrokerAvailable = isDockSessionBrokerAvailable2;
19344
+ var node_buffer_1 = require("node:buffer");
19345
+ var node_fs_1 = require("node:fs");
19346
+ var promises_1 = require("node:fs/promises");
19347
+ var node_http_1 = require("node:http");
19348
+ var node_path_1 = require("node:path");
19349
+ var zod_1 = require_zod();
19350
+ var paths_1 = require_paths();
19351
+ exports2.sessionBrokerDescriptorSchema = zod_1.z.object({
19352
+ version: zod_1.z.literal(1),
19353
+ port: zod_1.z.number().int().min(1).max(65535),
19354
+ secret: zod_1.z.string().regex(/^[a-f0-9]{64}$/)
19355
+ }).strict();
19356
+ exports2.sessionBrokerRequestSchema = zod_1.z.object({
19357
+ contextId: zod_1.z.string().min(1).max(256)
19358
+ }).strict();
19359
+ exports2.SESSION_BROKER_ROUTE = "/v1/session/refresh";
19360
+ exports2.SESSION_BROKER_MAX_BYTES = 4096;
19361
+ function sessionBrokerPaths(rootDir = (0, paths_1.getTelaLocalPaths)().rootDir) {
19362
+ const directory = (0, node_path_1.join)(rootDir, "session-broker");
19363
+ return { directory, descriptor: (0, node_path_1.join)(directory, "endpoint.json") };
19364
+ }
19365
+ var SessionBrokerUnavailableError2 = class extends Error {
19366
+ constructor() {
19367
+ super("Tela Dock session renewal is unavailable. Open or update Tela Dock, then retry. No local refresh was attempted.");
19368
+ this.name = "SessionBrokerUnavailableError";
19369
+ }
19370
+ };
19371
+ exports2.SessionBrokerUnavailableError = SessionBrokerUnavailableError2;
19372
+ async function requestDockSessionRefresh2(contextId, rootDir) {
19373
+ await callBroker(JSON.stringify(exports2.sessionBrokerRequestSchema.parse({ contextId })), rootDir);
19374
+ }
19375
+ async function isDockSessionBrokerAvailable2(rootDir) {
19376
+ try {
19377
+ await callBroker(void 0, rootDir);
19378
+ return true;
19379
+ } catch {
19380
+ return false;
19381
+ }
19382
+ }
19383
+ async function callBroker(body, rootDir) {
19384
+ const paths = sessionBrokerPaths(rootDir);
19385
+ let endpoint;
19386
+ try {
19387
+ const directory = await (0, promises_1.lstat)(paths.directory);
19388
+ if (!directory.isDirectory() || directory.uid !== process.getuid?.() || (directory.mode & 63) !== 0)
19389
+ throw new Error("Unsafe broker directory");
19390
+ const file2 = await (0, promises_1.open)(paths.descriptor, node_fs_1.constants.O_RDONLY | node_fs_1.constants.O_NOFOLLOW);
19391
+ try {
19392
+ const stat = await file2.stat();
19393
+ if (!stat.isFile() || stat.uid !== process.getuid?.() || (stat.mode & 63) !== 0 || stat.size > exports2.SESSION_BROKER_MAX_BYTES)
19394
+ throw new Error("Unsafe broker descriptor");
19395
+ endpoint = exports2.sessionBrokerDescriptorSchema.parse(JSON.parse(await file2.readFile("utf8")));
19396
+ } finally {
19397
+ await file2.close();
19398
+ }
19399
+ } catch {
19400
+ throw new SessionBrokerUnavailableError2();
19401
+ }
19402
+ await new Promise((resolve, reject) => {
19403
+ const req = (0, node_http_1.request)({
19404
+ hostname: "127.0.0.1",
19405
+ port: endpoint.port,
19406
+ method: body ? "POST" : "GET",
19407
+ path: body ? exports2.SESSION_BROKER_ROUTE : "/v1/health",
19408
+ agent: false,
19409
+ headers: {
19410
+ "authorization": `Bearer ${endpoint.secret}`,
19411
+ "content-type": "application/json",
19412
+ "content-length": node_buffer_1.Buffer.byteLength(body ?? "")
19413
+ }
19414
+ }, (res) => {
19415
+ res.resume();
19416
+ if (res.statusCode === 204)
19417
+ resolve();
19418
+ else if (res.statusCode === 401 || res.statusCode === 404)
19419
+ reject(new SessionBrokerUnavailableError2());
19420
+ else
19421
+ reject(new Error("Tela Dock could not renew and save this session. Check the selected context in Dock and sign in again if needed."));
19422
+ });
19423
+ req.on("error", () => reject(new SessionBrokerUnavailableError2()));
19424
+ req.setTimeout(body ? 3e4 : 1e3, () => req.destroy(new Error("Session renewal timed out")));
19425
+ req.end(body);
19426
+ });
19427
+ }
19428
+ }
19429
+ });
19430
+
17668
19431
  // ../../packages/local-config/dist/types.js
17669
19432
  var require_types = __commonJS({
17670
19433
  "../../packages/local-config/dist/types.js"(exports2) {
@@ -17707,6 +19470,7 @@ var require_dist = __commonJS({
17707
19470
  __exportStar(require_paths(), exports2);
17708
19471
  __exportStar(require_public(), exports2);
17709
19472
  __exportStar(require_schema(), exports2);
19473
+ __exportStar(require_session_broker(), exports2);
17710
19474
  __exportStar(require_types(), exports2);
17711
19475
  }
17712
19476
  });
@@ -19590,11 +21354,11 @@ var init_dist = __esm({
19590
21354
  return Promise.resolve(attempt < this.options.attempts);
19591
21355
  }
19592
21356
  getDelay(attempt) {
19593
- const delay = Math.min(
21357
+ const delay2 = Math.min(
19594
21358
  this.options.maxDelay,
19595
21359
  this.options.baseDelay * 2 ** attempt
19596
21360
  );
19597
- return delay;
21361
+ return delay2;
19598
21362
  }
19599
21363
  };
19600
21364
  getAuthHeader = async (options2) => {
@@ -19872,8 +21636,8 @@ var init_dist = __esm({
19872
21636
  await onRetry(responseContext);
19873
21637
  }
19874
21638
  }
19875
- const delay = retryStrategy.getDelay(_retryAttempt);
19876
- await new Promise((resolve) => setTimeout(resolve, delay));
21639
+ const delay2 = retryStrategy.getDelay(_retryAttempt);
21640
+ await new Promise((resolve) => setTimeout(resolve, delay2));
19877
21641
  return await betterFetch(url3, __spreadProps(__spreadValues({}, options2), {
19878
21642
  retryAttempt: _retryAttempt + 1
19879
21643
  }));
@@ -38129,14 +39893,14 @@ __export(dist_exports, {
38129
39893
  function isNotFound(err) {
38130
39894
  return typeof err === "object" && err !== null && "code" in err && err.code === "ENOENT";
38131
39895
  }
38132
- var import_promises, import_promises2, import_node_path, DeviceFlowAbortedError, DEFAULT_POLL_INTERVAL, DeviceFlow, JsonFileStorage;
39896
+ var import_promises2, import_promises3, import_node_path, DeviceFlowAbortedError, DEFAULT_POLL_INTERVAL, DeviceFlow, JsonFileStorage;
38133
39897
  var init_dist3 = __esm({
38134
39898
  "../../node_modules/.pnpm/@meistrari+auth-cli@1.6.0_@better-auth+core@1.6.26_@better-auth+utils@0.4.2_@better-fet_0bf65f4b8ffb95a65428638518b6161c/node_modules/@meistrari/auth-cli/dist/index.mjs"() {
38135
- import_promises = require("node:timers/promises");
39899
+ import_promises2 = require("node:timers/promises");
38136
39900
  init_dist2();
38137
39901
  init_dist2();
38138
39902
  init_emittery();
38139
- import_promises2 = require("node:fs/promises");
39903
+ import_promises3 = require("node:fs/promises");
38140
39904
  import_node_path = require("node:path");
38141
39905
  DeviceFlowAbortedError = class extends Error {
38142
39906
  /**
@@ -38446,7 +40210,7 @@ var init_dist3 = __esm({
38446
40210
  */
38447
40211
  async #sleep(ms) {
38448
40212
  try {
38449
- await (0, import_promises.setTimeout)(ms, void 0, { signal: this.#signal });
40213
+ await (0, import_promises2.setTimeout)(ms, void 0, { signal: this.#signal });
38450
40214
  } catch (err) {
38451
40215
  if (this.#signal?.aborted) {
38452
40216
  await this.#emitAbortedOnce();
@@ -38477,7 +40241,7 @@ var init_dist3 = __esm({
38477
40241
  */
38478
40242
  async load() {
38479
40243
  try {
38480
- const content = await (0, import_promises2.readFile)(this.path, "utf-8");
40244
+ const content = await (0, import_promises3.readFile)(this.path, "utf-8");
38481
40245
  return JSON.parse(content);
38482
40246
  } catch (err) {
38483
40247
  if (isNotFound(err))
@@ -38490,8 +40254,8 @@ var init_dist3 = __esm({
38490
40254
  * directories as needed and applying the configured file mode.
38491
40255
  */
38492
40256
  async save(tokens) {
38493
- await (0, import_promises2.mkdir)((0, import_node_path.dirname)(this.path), { recursive: true });
38494
- await (0, import_promises2.writeFile)(this.path, JSON.stringify(tokens, null, this.#indent), {
40257
+ await (0, import_promises3.mkdir)((0, import_node_path.dirname)(this.path), { recursive: true });
40258
+ await (0, import_promises3.writeFile)(this.path, JSON.stringify(tokens, null, this.#indent), {
38495
40259
  mode: this.#mode
38496
40260
  });
38497
40261
  }
@@ -38501,7 +40265,7 @@ var init_dist3 = __esm({
38501
40265
  */
38502
40266
  async clear() {
38503
40267
  try {
38504
- await (0, import_promises2.unlink)(this.path);
40268
+ await (0, import_promises3.unlink)(this.path);
38505
40269
  } catch (err) {
38506
40270
  if (isNotFound(err))
38507
40271
  return;
@@ -137307,10 +139071,10 @@ function T3(r2, t2, i2, s) {
137307
139071
  max: e && t2.year === e.year && t2.month === e.month ? e.day : c(t2.year, t2.month)
137308
139072
  };
137309
139073
  }
137310
- var import_node_util, import_node_process5, l2, import_node_readline, import_sisteransi, import_node_tty2, a$1, t, settings, R2, CANCEL_SYMBOL, getColumns, getRows, V, T$1, r, _, U, u$2, o, h, a, u$1, n$1, u4, n2;
139074
+ var import_node_util2, import_node_process5, l2, import_node_readline, import_sisteransi, import_node_tty2, a$1, t, settings, R2, CANCEL_SYMBOL, getColumns, getRows, V, T$1, r, _, U, u$2, o, h, a, u$1, n$1, u4, n2;
137311
139075
  var init_dist7 = __esm({
137312
139076
  "../../node_modules/.pnpm/@clack+core@1.4.3/node_modules/@clack/core/dist/index.mjs"() {
137313
- import_node_util = require("node:util");
139077
+ import_node_util2 = require("node:util");
137314
139078
  import_node_process5 = require("node:process");
137315
139079
  l2 = __toESM(require("node:readline"), 1);
137316
139080
  import_node_readline = __toESM(require("node:readline"), 1);
@@ -137545,11 +139309,11 @@ var init_dist7 = __esm({
137545
139309
  }
137546
139310
  get userInputWithCursor() {
137547
139311
  if (!this.userInput)
137548
- return (0, import_node_util.styleText)(["inverse", "hidden"], "_");
139312
+ return (0, import_node_util2.styleText)(["inverse", "hidden"], "_");
137549
139313
  if (this._cursor >= this.userInput.length)
137550
139314
  return `${this.userInput}\u2588`;
137551
139315
  const e = this.userInput.slice(0, this.cursor), t2 = this.userInput.slice(this.cursor, this.cursor + 1), i2 = this.userInput.slice(this.cursor + 1);
137552
- return `${e}${(0, import_node_util.styleText)("inverse", t2)}${i2}`;
139316
+ return `${e}${(0, import_node_util2.styleText)("inverse", t2)}${i2}`;
137553
139317
  }
137554
139318
  get options() {
137555
139319
  return typeof this.#i == "function" ? this.#i() : this.#i;
@@ -137854,7 +139618,7 @@ var init_dist7 = __esm({
137854
139618
  const s = t2.slice(0, this.cursor), r2 = t2.slice(this.cursor, this.cursor + 1), i2 = t2.slice(this.cursor + 1);
137855
139619
  return r2 === `
137856
139620
  ` ? `${s}\u2588
137857
- ${i2}` : `${s}${(0, import_node_util.styleText)("inverse", r2)}${i2}`;
139621
+ ${i2}` : `${s}${(0, import_node_util2.styleText)("inverse", r2)}${i2}`;
137858
139622
  }
137859
139623
  get cursor() {
137860
139624
  return this._cursor;
@@ -137998,9 +139762,9 @@ ${i2}` : `${s}${(0, import_node_util.styleText)("inverse", r2)}${i2}`;
137998
139762
  return this.masked;
137999
139763
  const t2 = this.userInput;
138000
139764
  if (this.cursor >= t2.length)
138001
- return `${this.masked}${(0, import_node_util.styleText)(["inverse", "hidden"], "_")}`;
139765
+ return `${this.masked}${(0, import_node_util2.styleText)(["inverse", "hidden"], "_")}`;
138002
139766
  const s = this.masked, r2 = s.slice(0, this.cursor), i2 = s.slice(this.cursor, this.cursor + 1), o2 = s.slice(this.cursor + 1);
138003
- return `${r2}${(0, import_node_util.styleText)("inverse", i2)}${o2}`;
139767
+ return `${r2}${(0, import_node_util2.styleText)("inverse", i2)}${o2}`;
138004
139768
  }
138005
139769
  clear() {
138006
139770
  this._clearUserInput();
@@ -138066,7 +139830,7 @@ ${i2}` : `${s}${(0, import_node_util.styleText)("inverse", r2)}${i2}`;
138066
139830
  if (this.cursor >= t2.length)
138067
139831
  return `${this.userInput}\u2588`;
138068
139832
  const r2 = t2.slice(0, this.cursor), s = t2.slice(this.cursor, this.cursor + 1), e = t2.slice(this.cursor + 1);
138069
- return `${r2}${(0, import_node_util.styleText)("inverse", s)}${e}`;
139833
+ return `${r2}${(0, import_node_util2.styleText)("inverse", s)}${e}`;
138070
139834
  }
138071
139835
  get cursor() {
138072
139836
  return this._cursor;
@@ -138158,8 +139922,8 @@ function isUnicodeSupported() {
138158
139922
  return Boolean(import_node_process6.default.env.CI) || Boolean(import_node_process6.default.env.WT_SESSION) || Boolean(import_node_process6.default.env.TERMINUS_SUBLIME) || import_node_process6.default.env.ConEmuTask === "{cmd::Cmder}" || import_node_process6.default.env.TERM_PROGRAM === "Terminus-Sublime" || import_node_process6.default.env.TERM_PROGRAM === "vscode" || import_node_process6.default.env.TERM === "xterm-256color" || import_node_process6.default.env.TERM === "alacritty" || import_node_process6.default.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
138159
139923
  }
138160
139924
  function formatInstructionFooter(o2, e) {
138161
- const r2 = [`${e ? `${(0, import_node_util2.styleText)("cyan", S_BAR)} ` : ""}${o2.join(" \u2022 ")}`];
138162
- return e && r2.push((0, import_node_util2.styleText)("cyan", S_BAR_END)), r2;
139925
+ const r2 = [`${e ? `${(0, import_node_util3.styleText)("cyan", S_BAR)} ` : ""}${o2.join(" \u2022 ")}`];
139926
+ return e && r2.push((0, import_node_util3.styleText)("cyan", S_BAR_END)), r2;
138163
139927
  }
138164
139928
  function P3(t2) {
138165
139929
  return t2.label ?? String(t2.value ?? "");
@@ -138184,7 +139948,7 @@ function b2(e, r2) {
138184
139948
  const t2 = e.segmentValues, o2 = e.segmentCursor;
138185
139949
  if (r2 === "submit" || r2 === "cancel")
138186
139950
  return e.formattedValue;
138187
- const i2 = (0, import_node_util2.styleText)("gray", e.separator);
139951
+ const i2 = (0, import_node_util3.styleText)("gray", e.separator);
138188
139952
  return e.segments.map((l3, d) => {
138189
139953
  const c3 = d === o2.segmentIndex && !["submit", "cancel"].includes(r2), a2 = p2[l3.type];
138190
139954
  return x(t2[l3.type], { isActive: c3, label: a2 });
@@ -138192,7 +139956,7 @@ function b2(e, r2) {
138192
139956
  }
138193
139957
  function x(e, r2) {
138194
139958
  const t2 = !e || e.replace(/_/g, "") === "";
138195
- return r2.isActive ? (0, import_node_util2.styleText)("inverse", t2 ? r2.label : e.replace(/_/g, " ")) : t2 ? (0, import_node_util2.styleText)("dim", r2.label) : e.replace(/_/g, (0, import_node_util2.styleText)("dim", " "));
139959
+ return r2.isActive ? (0, import_node_util3.styleText)("inverse", t2 ? r2.label : e.replace(/_/g, " ")) : t2 ? (0, import_node_util3.styleText)("dim", r2.label) : e.replace(/_/g, (0, import_node_util3.styleText)("dim", " "));
138196
139960
  }
138197
139961
  function progress({
138198
139962
  style: o2 = "heavy",
@@ -138206,18 +139970,18 @@ function progress({
138206
139970
  switch (t2) {
138207
139971
  case "initial":
138208
139972
  case "active":
138209
- return (e) => (0, import_node_util2.styleText)("magenta", e);
139973
+ return (e) => (0, import_node_util3.styleText)("magenta", e);
138210
139974
  case "error":
138211
139975
  case "cancel":
138212
- return (e) => (0, import_node_util2.styleText)("red", e);
139976
+ return (e) => (0, import_node_util3.styleText)("red", e);
138213
139977
  case "submit":
138214
- return (e) => (0, import_node_util2.styleText)("green", e);
139978
+ return (e) => (0, import_node_util3.styleText)("green", e);
138215
139979
  default:
138216
- return (e) => (0, import_node_util2.styleText)("magenta", e);
139980
+ return (e) => (0, import_node_util3.styleText)("magenta", e);
138217
139981
  }
138218
139982
  }, p3 = (t2, e) => {
138219
139983
  const m3 = Math.floor(a2 / c3 * l3);
138220
- return `${S2(t2)(u5[o2].repeat(m3))}${(0, import_node_util2.styleText)("dim", u5[o2].repeat(l3 - m3))} ${e}`;
139984
+ return `${S2(t2)(u5[o2].repeat(m3))}${(0, import_node_util3.styleText)("dim", u5[o2].repeat(l3 - m3))} ${e}`;
138221
139985
  }, h2 = (t2 = "") => {
138222
139986
  n3 = t2, r2.start(p3("initial", t2));
138223
139987
  }, g2 = (t2 = 1, e) => {
@@ -138234,12 +139998,12 @@ function progress({
138234
139998
  message: (t2) => g2(0, t2)
138235
139999
  };
138236
140000
  }
138237
- var import_node_util2, import_node_process6, import_node_fs, import_node_path3, import_sisteransi2, unicode, isCI, isTTY, unicodeOr, S_STEP_ACTIVE, S_STEP_CANCEL, S_STEP_ERROR, S_STEP_SUBMIT, S_BAR_START, S_BAR, S_BAR_END, S_BAR_START_RIGHT, S_BAR_END_RIGHT, S_RADIO_ACTIVE, S_RADIO_INACTIVE, S_CHECKBOX_ACTIVE, S_CHECKBOX_SELECTED, S_CHECKBOX_INACTIVE, S_PASSWORD_MASK, S_BAR_H, S_CORNER_TOP_RIGHT, S_CONNECT_LEFT, S_CORNER_BOTTOM_RIGHT, S_CORNER_BOTTOM_LEFT, S_CORNER_TOP_LEFT, S_INFO, S_SUCCESS, S_WARN, S_ERROR, symbol2, symbolBar, I2, limitOptions, autocomplete, autocompleteMultiselect, J, K, Q, box, confirm, date5, p2, group, MULTISELECT_INSTRUCTIONS, m2, multiselect, groupMultiselect, log, cancel, intro, outro, multiline, W$1, C3, note, password, path, W, spinner, u5, SELECT_INSTRUCTIONS, c2, select, selectKey, i, stream4, tasks, A, taskLog, text;
140001
+ var import_node_util3, import_node_process6, import_node_fs, import_node_path3, import_sisteransi2, unicode, isCI, isTTY, unicodeOr, S_STEP_ACTIVE, S_STEP_CANCEL, S_STEP_ERROR, S_STEP_SUBMIT, S_BAR_START, S_BAR, S_BAR_END, S_BAR_START_RIGHT, S_BAR_END_RIGHT, S_RADIO_ACTIVE, S_RADIO_INACTIVE, S_CHECKBOX_ACTIVE, S_CHECKBOX_SELECTED, S_CHECKBOX_INACTIVE, S_PASSWORD_MASK, S_BAR_H, S_CORNER_TOP_RIGHT, S_CONNECT_LEFT, S_CORNER_BOTTOM_RIGHT, S_CORNER_BOTTOM_LEFT, S_CORNER_TOP_LEFT, S_INFO, S_SUCCESS, S_WARN, S_ERROR, symbol2, symbolBar, I2, limitOptions, autocomplete, autocompleteMultiselect, J, K, Q, box, confirm, date5, p2, group, MULTISELECT_INSTRUCTIONS, m2, multiselect, groupMultiselect, log, cancel, intro, outro, multiline, W$1, C3, note, password, path, W, spinner, u5, SELECT_INSTRUCTIONS, c2, select, selectKey, i, stream4, tasks, A, taskLog, text;
138238
140002
  var init_dist8 = __esm({
138239
140003
  "../../node_modules/.pnpm/@clack+prompts@1.7.0/node_modules/@clack/prompts/dist/index.mjs"() {
138240
140004
  init_dist7();
138241
140005
  init_dist7();
138242
- import_node_util2 = require("node:util");
140006
+ import_node_util3 = require("node:util");
138243
140007
  import_node_process6 = __toESM(require("node:process"), 1);
138244
140008
  init_main();
138245
140009
  init_dist6();
@@ -138279,26 +140043,26 @@ var init_dist8 = __esm({
138279
140043
  switch (o2) {
138280
140044
  case "initial":
138281
140045
  case "active":
138282
- return (0, import_node_util2.styleText)("cyan", S_STEP_ACTIVE);
140046
+ return (0, import_node_util3.styleText)("cyan", S_STEP_ACTIVE);
138283
140047
  case "cancel":
138284
- return (0, import_node_util2.styleText)("red", S_STEP_CANCEL);
140048
+ return (0, import_node_util3.styleText)("red", S_STEP_CANCEL);
138285
140049
  case "error":
138286
- return (0, import_node_util2.styleText)("yellow", S_STEP_ERROR);
140050
+ return (0, import_node_util3.styleText)("yellow", S_STEP_ERROR);
138287
140051
  case "submit":
138288
- return (0, import_node_util2.styleText)("green", S_STEP_SUBMIT);
140052
+ return (0, import_node_util3.styleText)("green", S_STEP_SUBMIT);
138289
140053
  }
138290
140054
  };
138291
140055
  symbolBar = (o2) => {
138292
140056
  switch (o2) {
138293
140057
  case "initial":
138294
140058
  case "active":
138295
- return (0, import_node_util2.styleText)("cyan", S_BAR);
140059
+ return (0, import_node_util3.styleText)("cyan", S_BAR);
138296
140060
  case "cancel":
138297
- return (0, import_node_util2.styleText)("red", S_BAR);
140061
+ return (0, import_node_util3.styleText)("red", S_BAR);
138298
140062
  case "error":
138299
- return (0, import_node_util2.styleText)("yellow", S_BAR);
140063
+ return (0, import_node_util3.styleText)("yellow", S_BAR);
138300
140064
  case "submit":
138301
- return (0, import_node_util2.styleText)("green", S_BAR);
140065
+ return (0, import_node_util3.styleText)("green", S_BAR);
138302
140066
  }
138303
140067
  };
138304
140068
  I2 = (l3, e, w2, p3, b3, C4 = false) => {
@@ -138324,7 +140088,7 @@ var init_dist8 = __esm({
138324
140088
  columnPadding: C4 = 0,
138325
140089
  rowPadding: r2 = 4
138326
140090
  }) => {
138327
- const i2 = getColumns(p3) - C4, m3 = getRows(p3), M3 = (0, import_node_util2.styleText)("dim", "..."), v = Math.max(m3 - r2, 0), a2 = Math.max(Math.min(b3, v), 5);
140091
+ const i2 = getColumns(p3) - C4, m3 = getRows(p3), M3 = (0, import_node_util3.styleText)("dim", "..."), v = Math.max(m3 - r2, 0), a2 = Math.max(Math.min(b3, v), 5);
138328
140092
  let f2 = 0;
138329
140093
  l3 >= a2 - 3 && (f2 = Math.max(
138330
140094
  Math.min(l3 - a2 + 3, e.length - a2),
@@ -138378,51 +140142,51 @@ var init_dist8 = __esm({
138378
140142
  output: t2.output,
138379
140143
  validate: t2.validate,
138380
140144
  render() {
138381
- const n3 = t2.withGuide ?? settings.withGuide, i2 = n3 ? [`${(0, import_node_util2.styleText)("gray", S_BAR)}`, `${symbol2(this.state)} ${t2.message}`] : [`${symbol2(this.state)} ${t2.message}`], l3 = this.userInput, o2 = this.options, m3 = t2.placeholder, p3 = l3 === "" && m3 !== void 0, $2 = (r2, s) => {
138382
- const a2 = P3(r2), u6 = r2.hint && r2.value === this.focusedValue ? (0, import_node_util2.styleText)("dim", ` (${r2.hint})`) : "";
140145
+ const n3 = t2.withGuide ?? settings.withGuide, i2 = n3 ? [`${(0, import_node_util3.styleText)("gray", S_BAR)}`, `${symbol2(this.state)} ${t2.message}`] : [`${symbol2(this.state)} ${t2.message}`], l3 = this.userInput, o2 = this.options, m3 = t2.placeholder, p3 = l3 === "" && m3 !== void 0, $2 = (r2, s) => {
140146
+ const a2 = P3(r2), u6 = r2.hint && r2.value === this.focusedValue ? (0, import_node_util3.styleText)("dim", ` (${r2.hint})`) : "";
138383
140147
  switch (s) {
138384
140148
  case "active":
138385
- return `${(0, import_node_util2.styleText)("green", S_RADIO_ACTIVE)} ${a2}${u6}`;
140149
+ return `${(0, import_node_util3.styleText)("green", S_RADIO_ACTIVE)} ${a2}${u6}`;
138386
140150
  case "inactive":
138387
- return `${(0, import_node_util2.styleText)("dim", S_RADIO_INACTIVE)} ${(0, import_node_util2.styleText)("dim", a2)}`;
140151
+ return `${(0, import_node_util3.styleText)("dim", S_RADIO_INACTIVE)} ${(0, import_node_util3.styleText)("dim", a2)}`;
138388
140152
  case "disabled":
138389
- return `${(0, import_node_util2.styleText)("gray", S_RADIO_INACTIVE)} ${(0, import_node_util2.styleText)(["strikethrough", "gray"], a2)}`;
140153
+ return `${(0, import_node_util3.styleText)("gray", S_RADIO_INACTIVE)} ${(0, import_node_util3.styleText)(["strikethrough", "gray"], a2)}`;
138390
140154
  }
138391
140155
  };
138392
140156
  switch (this.state) {
138393
140157
  case "submit": {
138394
- const r2 = N(this.selectedValues, o2), s = r2.length > 0 ? ` ${(0, import_node_util2.styleText)("dim", r2.map(P3).join(", "))}` : "", a2 = n3 ? (0, import_node_util2.styleText)("gray", S_BAR) : "";
140158
+ const r2 = N(this.selectedValues, o2), s = r2.length > 0 ? ` ${(0, import_node_util3.styleText)("dim", r2.map(P3).join(", "))}` : "", a2 = n3 ? (0, import_node_util3.styleText)("gray", S_BAR) : "";
138395
140159
  return `${i2.join(`
138396
140160
  `)}
138397
140161
  ${a2}${s}`;
138398
140162
  }
138399
140163
  case "cancel": {
138400
- const r2 = l3 ? ` ${(0, import_node_util2.styleText)(["strikethrough", "dim"], l3)}` : "", s = n3 ? (0, import_node_util2.styleText)("gray", S_BAR) : "";
140164
+ const r2 = l3 ? ` ${(0, import_node_util3.styleText)(["strikethrough", "dim"], l3)}` : "", s = n3 ? (0, import_node_util3.styleText)("gray", S_BAR) : "";
138401
140165
  return `${i2.join(`
138402
140166
  `)}
138403
140167
  ${s}${r2}`;
138404
140168
  }
138405
140169
  default: {
138406
- const r2 = this.state === "error" ? "yellow" : "cyan", s = n3 ? `${(0, import_node_util2.styleText)(r2, S_BAR)} ` : "", a2 = n3 ? (0, import_node_util2.styleText)(r2, S_BAR_END) : "";
140170
+ const r2 = this.state === "error" ? "yellow" : "cyan", s = n3 ? `${(0, import_node_util3.styleText)(r2, S_BAR)} ` : "", a2 = n3 ? (0, import_node_util3.styleText)(r2, S_BAR_END) : "";
138407
140171
  let u6 = "";
138408
140172
  if (this.isNavigating || p3) {
138409
140173
  const d = p3 ? m3 : l3;
138410
- u6 = d !== "" ? ` ${(0, import_node_util2.styleText)("dim", d)}` : "";
140174
+ u6 = d !== "" ? ` ${(0, import_node_util3.styleText)("dim", d)}` : "";
138411
140175
  } else
138412
140176
  u6 = ` ${this.userInputWithCursor}`;
138413
- const V2 = this.filteredOptions.length !== o2.length ? (0, import_node_util2.styleText)(
140177
+ const V2 = this.filteredOptions.length !== o2.length ? (0, import_node_util3.styleText)(
138414
140178
  "dim",
138415
140179
  ` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? "" : "es"})`
138416
- ) : "", y2 = this.filteredOptions.length === 0 && l3 ? [`${s}${(0, import_node_util2.styleText)("yellow", "No matches found")}`] : [], b3 = this.state === "error" ? [`${s}${(0, import_node_util2.styleText)("yellow", this.error)}`] : [];
140180
+ ) : "", y2 = this.filteredOptions.length === 0 && l3 ? [`${s}${(0, import_node_util3.styleText)("yellow", "No matches found")}`] : [], b3 = this.state === "error" ? [`${s}${(0, import_node_util3.styleText)("yellow", this.error)}`] : [];
138417
140181
  n3 && i2.push(`${s.trimEnd()}`), i2.push(
138418
- `${s}${(0, import_node_util2.styleText)("dim", "Search:")}${u6}${V2}`,
140182
+ `${s}${(0, import_node_util3.styleText)("dim", "Search:")}${u6}${V2}`,
138419
140183
  ...y2,
138420
140184
  ...b3
138421
140185
  );
138422
140186
  const v = [
138423
- `${(0, import_node_util2.styleText)("dim", "\u2191/\u2193")} to select`,
138424
- `${(0, import_node_util2.styleText)("dim", "Enter:")} confirm`,
138425
- `${(0, import_node_util2.styleText)("dim", "Type:")} to search`
140187
+ `${(0, import_node_util3.styleText)("dim", "\u2191/\u2193")} to select`,
140188
+ `${(0, import_node_util3.styleText)("dim", "Enter:")} confirm`,
140189
+ `${(0, import_node_util3.styleText)("dim", "Type:")} to search`
138426
140190
  ], g2 = [`${s}${v.join(" \u2022 ")}`, a2], O = this.filteredOptions.length === 0 ? [] : limitOptions({
138427
140191
  cursor: this.cursor,
138428
140192
  options: this.filteredOptions,
@@ -138448,8 +140212,8 @@ ${s}${r2}`;
138448
140212
  }).prompt();
138449
140213
  autocompleteMultiselect = (t2) => {
138450
140214
  const c3 = (i2, l3, o2, m3) => {
138451
- const p3 = o2.includes(i2.value), $2 = i2.label ?? String(i2.value ?? ""), r2 = i2.hint && m3 !== void 0 && i2.value === m3 ? (0, import_node_util2.styleText)("dim", ` (${i2.hint})`) : "", s = p3 ? (0, import_node_util2.styleText)("green", S_CHECKBOX_SELECTED) : (0, import_node_util2.styleText)("dim", S_CHECKBOX_INACTIVE);
138452
- return i2.disabled ? `${(0, import_node_util2.styleText)("gray", S_CHECKBOX_INACTIVE)} ${(0, import_node_util2.styleText)(["strikethrough", "gray"], $2)}` : l3 ? `${s} ${$2}${r2}` : `${s} ${(0, import_node_util2.styleText)("dim", $2)}`;
140215
+ const p3 = o2.includes(i2.value), $2 = i2.label ?? String(i2.value ?? ""), r2 = i2.hint && m3 !== void 0 && i2.value === m3 ? (0, import_node_util3.styleText)("dim", ` (${i2.hint})`) : "", s = p3 ? (0, import_node_util3.styleText)("green", S_CHECKBOX_SELECTED) : (0, import_node_util3.styleText)("dim", S_CHECKBOX_INACTIVE);
140216
+ return i2.disabled ? `${(0, import_node_util3.styleText)("gray", S_CHECKBOX_INACTIVE)} ${(0, import_node_util3.styleText)(["strikethrough", "gray"], $2)}` : l3 ? `${s} ${$2}${r2}` : `${s} ${(0, import_node_util3.styleText)("dim", $2)}`;
138453
140217
  }, n3 = new T$1({
138454
140218
  options: t2.options,
138455
140219
  multiple: true,
@@ -138464,33 +140228,33 @@ ${s}${r2}`;
138464
140228
  input: t2.input,
138465
140229
  output: t2.output,
138466
140230
  render() {
138467
- const i2 = t2.withGuide ?? settings.withGuide, l3 = `${i2 ? `${(0, import_node_util2.styleText)("gray", S_BAR)}
140231
+ const i2 = t2.withGuide ?? settings.withGuide, l3 = `${i2 ? `${(0, import_node_util3.styleText)("gray", S_BAR)}
138468
140232
  ` : ""}${symbol2(this.state)} ${t2.message}
138469
- `, o2 = this.userInput, m3 = t2.placeholder, p3 = o2 === "" && m3 !== void 0, $2 = this.isNavigating || p3 ? (0, import_node_util2.styleText)("dim", p3 ? m3 : o2) : this.userInputWithCursor, r2 = this.options, s = this.filteredOptions.length !== r2.length ? (0, import_node_util2.styleText)(
140233
+ `, o2 = this.userInput, m3 = t2.placeholder, p3 = o2 === "" && m3 !== void 0, $2 = this.isNavigating || p3 ? (0, import_node_util3.styleText)("dim", p3 ? m3 : o2) : this.userInputWithCursor, r2 = this.options, s = this.filteredOptions.length !== r2.length ? (0, import_node_util3.styleText)(
138470
140234
  "dim",
138471
140235
  ` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? "" : "es"})`
138472
140236
  ) : "";
138473
140237
  switch (this.state) {
138474
140238
  case "submit":
138475
- return `${l3}${i2 ? `${(0, import_node_util2.styleText)("gray", S_BAR)} ` : ""}${(0, import_node_util2.styleText)(
140239
+ return `${l3}${i2 ? `${(0, import_node_util3.styleText)("gray", S_BAR)} ` : ""}${(0, import_node_util3.styleText)(
138476
140240
  "dim",
138477
140241
  `${this.selectedValues.length} items selected`
138478
140242
  )}`;
138479
140243
  case "cancel":
138480
- return `${l3}${i2 ? `${(0, import_node_util2.styleText)("gray", S_BAR)} ` : ""}${(0, import_node_util2.styleText)(
140244
+ return `${l3}${i2 ? `${(0, import_node_util3.styleText)("gray", S_BAR)} ` : ""}${(0, import_node_util3.styleText)(
138481
140245
  ["strikethrough", "dim"],
138482
140246
  o2
138483
140247
  )}`;
138484
140248
  default: {
138485
- const a2 = this.state === "error" ? "yellow" : "cyan", u6 = i2 ? `${(0, import_node_util2.styleText)(a2, S_BAR)} ` : "", V2 = i2 ? (0, import_node_util2.styleText)(a2, S_BAR_END) : "", y2 = [
138486
- `${(0, import_node_util2.styleText)("dim", "\u2191/\u2193")} to navigate`,
138487
- `${(0, import_node_util2.styleText)("dim", this.isNavigating ? "Space/Tab:" : "Tab:")} select`,
138488
- `${(0, import_node_util2.styleText)("dim", "Enter:")} confirm`,
138489
- `${(0, import_node_util2.styleText)("dim", "Type:")} to search`
138490
- ], b3 = this.filteredOptions.length === 0 && o2 ? [`${u6}${(0, import_node_util2.styleText)("yellow", "No matches found")}`] : [], v = this.state === "error" ? [`${u6}${(0, import_node_util2.styleText)("yellow", this.error)}`] : [], g2 = [
138491
- ...`${l3}${i2 ? (0, import_node_util2.styleText)(a2, S_BAR) : ""}`.split(`
140249
+ const a2 = this.state === "error" ? "yellow" : "cyan", u6 = i2 ? `${(0, import_node_util3.styleText)(a2, S_BAR)} ` : "", V2 = i2 ? (0, import_node_util3.styleText)(a2, S_BAR_END) : "", y2 = [
140250
+ `${(0, import_node_util3.styleText)("dim", "\u2191/\u2193")} to navigate`,
140251
+ `${(0, import_node_util3.styleText)("dim", this.isNavigating ? "Space/Tab:" : "Tab:")} select`,
140252
+ `${(0, import_node_util3.styleText)("dim", "Enter:")} confirm`,
140253
+ `${(0, import_node_util3.styleText)("dim", "Type:")} to search`
140254
+ ], b3 = this.filteredOptions.length === 0 && o2 ? [`${u6}${(0, import_node_util3.styleText)("yellow", "No matches found")}`] : [], v = this.state === "error" ? [`${u6}${(0, import_node_util3.styleText)("yellow", this.error)}`] : [], g2 = [
140255
+ ...`${l3}${i2 ? (0, import_node_util3.styleText)(a2, S_BAR) : ""}`.split(`
138492
140256
  `),
138493
- `${u6}${(0, import_node_util2.styleText)("dim", "Search:")} ${$2}${s}`,
140257
+ `${u6}${(0, import_node_util3.styleText)("dim", "Search:")} ${$2}${s}`,
138494
140258
  ...b3,
138495
140259
  ...v
138496
140260
  ], O = [`${u6}${y2.join(" \u2022 ")}`, V2], d = limitOptions({
@@ -138576,29 +140340,29 @@ ${s}${r2}`;
138576
140340
  output: i2.output,
138577
140341
  initialValue: i2.initialValue ?? true,
138578
140342
  render() {
138579
- const e = i2.withGuide ?? settings.withGuide, u6 = `${symbol2(this.state)} `, l3 = e ? `${(0, import_node_util2.styleText)("gray", S_BAR)} ` : "", f2 = wrapTextWithPrefix(
140343
+ const e = i2.withGuide ?? settings.withGuide, u6 = `${symbol2(this.state)} `, l3 = e ? `${(0, import_node_util3.styleText)("gray", S_BAR)} ` : "", f2 = wrapTextWithPrefix(
138580
140344
  i2.output,
138581
140345
  i2.message,
138582
140346
  l3,
138583
140347
  u6
138584
- ), o2 = `${e ? `${(0, import_node_util2.styleText)("gray", S_BAR)}
140348
+ ), o2 = `${e ? `${(0, import_node_util3.styleText)("gray", S_BAR)}
138585
140349
  ` : ""}${f2}
138586
140350
  `, c3 = this.value ? a2 : s;
138587
140351
  switch (this.state) {
138588
140352
  case "submit": {
138589
- const r2 = e ? `${(0, import_node_util2.styleText)("gray", S_BAR)} ` : "";
138590
- return `${o2}${r2}${(0, import_node_util2.styleText)("dim", c3)}`;
140353
+ const r2 = e ? `${(0, import_node_util3.styleText)("gray", S_BAR)} ` : "";
140354
+ return `${o2}${r2}${(0, import_node_util3.styleText)("dim", c3)}`;
138591
140355
  }
138592
140356
  case "cancel": {
138593
- const r2 = e ? `${(0, import_node_util2.styleText)("gray", S_BAR)} ` : "";
138594
- return `${o2}${r2}${(0, import_node_util2.styleText)(["strikethrough", "dim"], c3)}${e ? `
138595
- ${(0, import_node_util2.styleText)("gray", S_BAR)}` : ""}`;
140357
+ const r2 = e ? `${(0, import_node_util3.styleText)("gray", S_BAR)} ` : "";
140358
+ return `${o2}${r2}${(0, import_node_util3.styleText)(["strikethrough", "dim"], c3)}${e ? `
140359
+ ${(0, import_node_util3.styleText)("gray", S_BAR)}` : ""}`;
138596
140360
  }
138597
140361
  default: {
138598
- const r2 = e ? `${(0, import_node_util2.styleText)("cyan", S_BAR)} ` : "", g2 = e ? (0, import_node_util2.styleText)("cyan", S_BAR_END) : "";
138599
- return `${o2}${r2}${this.value ? `${(0, import_node_util2.styleText)("green", S_RADIO_ACTIVE)} ${a2}` : `${(0, import_node_util2.styleText)("dim", S_RADIO_INACTIVE)} ${(0, import_node_util2.styleText)("dim", a2)}`}${i2.vertical ? e ? `
138600
- ${(0, import_node_util2.styleText)("cyan", S_BAR)} ` : `
138601
- ` : ` ${(0, import_node_util2.styleText)("dim", "/")} `}${this.value ? `${(0, import_node_util2.styleText)("dim", S_RADIO_INACTIVE)} ${(0, import_node_util2.styleText)("dim", s)}` : `${(0, import_node_util2.styleText)("green", S_RADIO_ACTIVE)} ${s}`}
140362
+ const r2 = e ? `${(0, import_node_util3.styleText)("cyan", S_BAR)} ` : "", g2 = e ? (0, import_node_util3.styleText)("cyan", S_BAR_END) : "";
140363
+ return `${o2}${r2}${this.value ? `${(0, import_node_util3.styleText)("green", S_RADIO_ACTIVE)} ${a2}` : `${(0, import_node_util3.styleText)("dim", S_RADIO_INACTIVE)} ${(0, import_node_util3.styleText)("dim", a2)}`}${i2.vertical ? e ? `
140364
+ ${(0, import_node_util3.styleText)("cyan", S_BAR)} ` : `
140365
+ ` : ` ${(0, import_node_util3.styleText)("dim", "/")} `}${this.value ? `${(0, import_node_util3.styleText)("dim", S_RADIO_INACTIVE)} ${(0, import_node_util3.styleText)("dim", s)}` : `${(0, import_node_util3.styleText)("green", S_RADIO_ACTIVE)} ${s}`}
138602
140366
  ${g2}
138603
140367
  `;
138604
140368
  }
@@ -138621,29 +140385,29 @@ ${g2}
138621
140385
  if (r2) return runValidation(r2, t2);
138622
140386
  },
138623
140387
  render() {
138624
- const t2 = (e?.withGuide ?? settings.withGuide) !== false, i2 = `${`${t2 ? `${(0, import_node_util2.styleText)("gray", S_BAR)}
140388
+ const t2 = (e?.withGuide ?? settings.withGuide) !== false, i2 = `${`${t2 ? `${(0, import_node_util3.styleText)("gray", S_BAR)}
138625
140389
  ` : ""}${symbol2(this.state)} `}${e.message}
138626
140390
  `, l3 = this.state !== "initial" ? this.state : "active", d = b2(this, l3), c3 = this.value instanceof Date ? this.formattedValue : "";
138627
140391
  switch (this.state) {
138628
140392
  case "error": {
138629
- const a2 = this.error ? ` ${(0, import_node_util2.styleText)("yellow", this.error)}` : "", s = t2 ? `${(0, import_node_util2.styleText)("yellow", S_BAR)} ` : "", f2 = t2 ? (0, import_node_util2.styleText)("yellow", S_BAR_END) : "";
140393
+ const a2 = this.error ? ` ${(0, import_node_util3.styleText)("yellow", this.error)}` : "", s = t2 ? `${(0, import_node_util3.styleText)("yellow", S_BAR)} ` : "", f2 = t2 ? (0, import_node_util3.styleText)("yellow", S_BAR_END) : "";
138630
140394
  return `${i2.trim()}
138631
140395
  ${s}${d}
138632
140396
  ${f2}${a2}
138633
140397
  `;
138634
140398
  }
138635
140399
  case "submit": {
138636
- const a2 = c3 ? ` ${(0, import_node_util2.styleText)("dim", c3)}` : "", s = t2 ? (0, import_node_util2.styleText)("gray", S_BAR) : "";
140400
+ const a2 = c3 ? ` ${(0, import_node_util3.styleText)("dim", c3)}` : "", s = t2 ? (0, import_node_util3.styleText)("gray", S_BAR) : "";
138637
140401
  return `${i2}${s}${a2}`;
138638
140402
  }
138639
140403
  case "cancel": {
138640
- const a2 = c3 ? ` ${(0, import_node_util2.styleText)(["strikethrough", "dim"], c3)}` : "", s = t2 ? (0, import_node_util2.styleText)("gray", S_BAR) : "";
140404
+ const a2 = c3 ? ` ${(0, import_node_util3.styleText)(["strikethrough", "dim"], c3)}` : "", s = t2 ? (0, import_node_util3.styleText)("gray", S_BAR) : "";
138641
140405
  return `${i2}${s}${a2}${c3.trim() ? `
138642
140406
  ${s}` : ""}`;
138643
140407
  }
138644
140408
  default: {
138645
- const a2 = t2 ? `${(0, import_node_util2.styleText)("cyan", S_BAR)} ` : "", s = t2 ? (0, import_node_util2.styleText)("cyan", S_BAR_END) : "", f2 = t2 ? `${(0, import_node_util2.styleText)("cyan", S_BAR)} ` : "", g2 = this.inlineError ? `
138646
- ${f2}${(0, import_node_util2.styleText)("yellow", this.inlineError)}` : "";
140409
+ const a2 = t2 ? `${(0, import_node_util3.styleText)("cyan", S_BAR)} ` : "", s = t2 ? (0, import_node_util3.styleText)("cyan", S_BAR_END) : "", f2 = t2 ? `${(0, import_node_util3.styleText)("cyan", S_BAR)} ` : "", g2 = this.inlineError ? `
140410
+ ${f2}${(0, import_node_util3.styleText)("yellow", this.inlineError)}` : "";
138647
140411
  return `${i2}${a2}${d}${g2}
138648
140412
  ${s}
138649
140413
  `;
@@ -138672,9 +140436,9 @@ ${s}
138672
140436
  return t2;
138673
140437
  };
138674
140438
  MULTISELECT_INSTRUCTIONS = [
138675
- `${(0, import_node_util2.styleText)("dim", "\u2191/\u2193")} to navigate`,
138676
- `${(0, import_node_util2.styleText)("dim", "Space:")} select`,
138677
- `${(0, import_node_util2.styleText)("dim", "Enter:")} confirm`
140439
+ `${(0, import_node_util3.styleText)("dim", "\u2191/\u2193")} to navigate`,
140440
+ `${(0, import_node_util3.styleText)("dim", "Space:")} select`,
140441
+ `${(0, import_node_util3.styleText)("dim", "Enter:")} confirm`
138678
140442
  ];
138679
140443
  m2 = (i2, u6) => i2.split(`
138680
140444
  `).map((d) => u6(d)).join(`
@@ -138682,7 +140446,7 @@ ${s}
138682
140446
  multiselect = (i2) => {
138683
140447
  const u6 = (t2, a2) => {
138684
140448
  const r2 = t2.label ?? String(t2.value);
138685
- return a2 === "disabled" ? `${(0, import_node_util2.styleText)("gray", S_CHECKBOX_INACTIVE)} ${m2(r2, (o2) => (0, import_node_util2.styleText)(["strikethrough", "gray"], o2))}${t2.hint ? ` ${(0, import_node_util2.styleText)("dim", `(${t2.hint ?? "disabled"})`)}` : ""}` : a2 === "active" ? `${(0, import_node_util2.styleText)("cyan", S_CHECKBOX_ACTIVE)} ${r2}${t2.hint ? ` ${(0, import_node_util2.styleText)("dim", `(${t2.hint})`)}` : ""}` : a2 === "selected" ? `${(0, import_node_util2.styleText)("green", S_CHECKBOX_SELECTED)} ${m2(r2, (o2) => (0, import_node_util2.styleText)("dim", o2))}${t2.hint ? ` ${(0, import_node_util2.styleText)("dim", `(${t2.hint})`)}` : ""}` : a2 === "cancelled" ? `${m2(r2, (o2) => (0, import_node_util2.styleText)(["strikethrough", "dim"], o2))}` : a2 === "active-selected" ? `${(0, import_node_util2.styleText)("green", S_CHECKBOX_SELECTED)} ${r2}${t2.hint ? ` ${(0, import_node_util2.styleText)("dim", `(${t2.hint})`)}` : ""}` : a2 === "submitted" ? `${m2(r2, (o2) => (0, import_node_util2.styleText)("dim", o2))}` : `${(0, import_node_util2.styleText)("dim", S_CHECKBOX_INACTIVE)} ${m2(r2, (o2) => (0, import_node_util2.styleText)("dim", o2))}`;
140449
+ return a2 === "disabled" ? `${(0, import_node_util3.styleText)("gray", S_CHECKBOX_INACTIVE)} ${m2(r2, (o2) => (0, import_node_util3.styleText)(["strikethrough", "gray"], o2))}${t2.hint ? ` ${(0, import_node_util3.styleText)("dim", `(${t2.hint ?? "disabled"})`)}` : ""}` : a2 === "active" ? `${(0, import_node_util3.styleText)("cyan", S_CHECKBOX_ACTIVE)} ${r2}${t2.hint ? ` ${(0, import_node_util3.styleText)("dim", `(${t2.hint})`)}` : ""}` : a2 === "selected" ? `${(0, import_node_util3.styleText)("green", S_CHECKBOX_SELECTED)} ${m2(r2, (o2) => (0, import_node_util3.styleText)("dim", o2))}${t2.hint ? ` ${(0, import_node_util3.styleText)("dim", `(${t2.hint})`)}` : ""}` : a2 === "cancelled" ? `${m2(r2, (o2) => (0, import_node_util3.styleText)(["strikethrough", "dim"], o2))}` : a2 === "active-selected" ? `${(0, import_node_util3.styleText)("green", S_CHECKBOX_SELECTED)} ${r2}${t2.hint ? ` ${(0, import_node_util3.styleText)("dim", `(${t2.hint})`)}` : ""}` : a2 === "submitted" ? `${m2(r2, (o2) => (0, import_node_util3.styleText)("dim", o2))}` : `${(0, import_node_util3.styleText)("dim", S_CHECKBOX_INACTIVE)} ${m2(r2, (o2) => (0, import_node_util3.styleText)("dim", o2))}`;
138686
140450
  }, d = i2.required ?? true, v = i2.showInstructions ?? true;
138687
140451
  return new a({
138688
140452
  options: i2.options,
@@ -138695,13 +140459,13 @@ ${s}
138695
140459
  validate(t2) {
138696
140460
  if (d && (t2 === void 0 || t2.length === 0))
138697
140461
  return `Please select at least one option.
138698
- ${(0, import_node_util2.styleText)(
140462
+ ${(0, import_node_util3.styleText)(
138699
140463
  "reset",
138700
- (0, import_node_util2.styleText)(
140464
+ (0, import_node_util3.styleText)(
138701
140465
  "dim",
138702
- `Press ${(0, import_node_util2.styleText)(["gray", "bgWhite", "inverse"], " space ")} to select, ${(0, import_node_util2.styleText)(
140466
+ `Press ${(0, import_node_util3.styleText)(["gray", "bgWhite", "inverse"], " space ")} to select, ${(0, import_node_util3.styleText)(
138703
140467
  "gray",
138704
- (0, import_node_util2.styleText)("bgWhite", (0, import_node_util2.styleText)("inverse", " enter "))
140468
+ (0, import_node_util3.styleText)("bgWhite", (0, import_node_util3.styleText)("inverse", " enter "))
138705
140469
  )} to submit`
138706
140470
  )
138707
140471
  )}`;
@@ -138712,7 +140476,7 @@ ${(0, import_node_util2.styleText)(
138712
140476
  i2.message,
138713
140477
  t2 ? `${symbolBar(this.state)} ` : "",
138714
140478
  `${symbol2(this.state)} `
138715
- ), r2 = `${t2 ? `${(0, import_node_util2.styleText)("gray", S_BAR)}
140479
+ ), r2 = `${t2 ? `${(0, import_node_util3.styleText)("gray", S_BAR)}
138716
140480
  ` : ""}${a2}
138717
140481
  `, o2 = this.value ?? [], p3 = (n3, l3) => {
138718
140482
  if (n3.disabled)
@@ -138722,29 +140486,29 @@ ${(0, import_node_util2.styleText)(
138722
140486
  };
138723
140487
  switch (this.state) {
138724
140488
  case "submit": {
138725
- const n3 = this.options.filter(({ value: s }) => o2.includes(s)).map((s) => u6(s, "submitted")).join((0, import_node_util2.styleText)("dim", ", ")) || (0, import_node_util2.styleText)("dim", "none"), l3 = wrapTextWithPrefix(
140489
+ const n3 = this.options.filter(({ value: s }) => o2.includes(s)).map((s) => u6(s, "submitted")).join((0, import_node_util3.styleText)("dim", ", ")) || (0, import_node_util3.styleText)("dim", "none"), l3 = wrapTextWithPrefix(
138726
140490
  i2.output,
138727
140491
  n3,
138728
- t2 ? `${(0, import_node_util2.styleText)("gray", S_BAR)} ` : ""
140492
+ t2 ? `${(0, import_node_util3.styleText)("gray", S_BAR)} ` : ""
138729
140493
  );
138730
140494
  return `${r2}${l3}`;
138731
140495
  }
138732
140496
  case "cancel": {
138733
- const n3 = this.options.filter(({ value: s }) => o2.includes(s)).map((s) => u6(s, "cancelled")).join((0, import_node_util2.styleText)("dim", ", "));
140497
+ const n3 = this.options.filter(({ value: s }) => o2.includes(s)).map((s) => u6(s, "cancelled")).join((0, import_node_util3.styleText)("dim", ", "));
138734
140498
  if (n3.trim() === "")
138735
- return `${r2}${(0, import_node_util2.styleText)("gray", S_BAR)}`;
140499
+ return `${r2}${(0, import_node_util3.styleText)("gray", S_BAR)}`;
138736
140500
  const l3 = wrapTextWithPrefix(
138737
140501
  i2.output,
138738
140502
  n3,
138739
- t2 ? `${(0, import_node_util2.styleText)("gray", S_BAR)} ` : ""
140503
+ t2 ? `${(0, import_node_util3.styleText)("gray", S_BAR)} ` : ""
138740
140504
  );
138741
140505
  return `${r2}${l3}${t2 ? `
138742
- ${(0, import_node_util2.styleText)("gray", S_BAR)}` : ""}`;
140506
+ ${(0, import_node_util3.styleText)("gray", S_BAR)}` : ""}`;
138743
140507
  }
138744
140508
  case "error": {
138745
- const n3 = t2 ? `${(0, import_node_util2.styleText)("yellow", S_BAR)} ` : "", l3 = this.error.split(`
140509
+ const n3 = t2 ? `${(0, import_node_util3.styleText)("yellow", S_BAR)} ` : "", l3 = this.error.split(`
138746
140510
  `).map(
138747
- ($2, C4) => C4 === 0 ? `${t2 ? `${(0, import_node_util2.styleText)("yellow", S_BAR_END)} ` : ""}${(0, import_node_util2.styleText)("yellow", $2)}` : ` ${$2}`
140511
+ ($2, C4) => C4 === 0 ? `${t2 ? `${(0, import_node_util3.styleText)("yellow", S_BAR_END)} ` : ""}${(0, import_node_util3.styleText)("yellow", $2)}` : ` ${$2}`
138748
140512
  ).join(`
138749
140513
  `), s = r2.split(`
138750
140514
  `).length, h2 = l3.split(`
@@ -138763,8 +140527,8 @@ ${l3}
138763
140527
  `;
138764
140528
  }
138765
140529
  default: {
138766
- const n3 = t2 ? `${(0, import_node_util2.styleText)("cyan", S_BAR)} ` : "", l3 = r2.split(`
138767
- `).length, s = v ? formatInstructionFooter(MULTISELECT_INSTRUCTIONS, t2) : t2 ? [(0, import_node_util2.styleText)("cyan", S_BAR_END)] : [], h2 = s.join(`
140530
+ const n3 = t2 ? `${(0, import_node_util3.styleText)("cyan", S_BAR)} ` : "", l3 = r2.split(`
140531
+ `).length, s = v ? formatInstructionFooter(MULTISELECT_INSTRUCTIONS, t2) : t2 ? [(0, import_node_util3.styleText)("cyan", S_BAR_END)] : [], h2 = s.join(`
138768
140532
  `), $2 = s.length + 1;
138769
140533
  return `${r2}${n3}${limitOptions({
138770
140534
  output: i2.output,
@@ -138793,60 +140557,60 @@ ${h2}
138793
140557
  `.repeat(x2)), l3 === "active")
138794
140558
  return wrapTextWithPrefix(
138795
140559
  o2.output,
138796
- `${a2}${n3.hint ? ` ${(0, import_node_util2.styleText)("dim", `(${n3.hint})`)}` : ""}`,
138797
- `${i2}${(0, import_node_util2.styleText)("dim", r2)} `,
138798
- `${i2}${(0, import_node_util2.styleText)("dim", r2)}${(0, import_node_util2.styleText)("cyan", S_CHECKBOX_ACTIVE)} `,
138799
- `${i2}${(0, import_node_util2.styleText)("dim", c3)} `
140560
+ `${a2}${n3.hint ? ` ${(0, import_node_util3.styleText)("dim", `(${n3.hint})`)}` : ""}`,
140561
+ `${i2}${(0, import_node_util3.styleText)("dim", r2)} `,
140562
+ `${i2}${(0, import_node_util3.styleText)("dim", r2)}${(0, import_node_util3.styleText)("cyan", S_CHECKBOX_ACTIVE)} `,
140563
+ `${i2}${(0, import_node_util3.styleText)("dim", c3)} `
138800
140564
  );
138801
140565
  if (l3 === "group-active")
138802
140566
  return wrapTextWithPrefix(
138803
140567
  o2.output,
138804
140568
  a2,
138805
140569
  `${i2}${r2} `,
138806
- `${i2}${r2}${(0, import_node_util2.styleText)("cyan", S_CHECKBOX_ACTIVE)} `,
140570
+ `${i2}${r2}${(0, import_node_util3.styleText)("cyan", S_CHECKBOX_ACTIVE)} `,
138807
140571
  `${i2}${c3} `,
138808
- (d) => (0, import_node_util2.styleText)("dim", d)
140572
+ (d) => (0, import_node_util3.styleText)("dim", d)
138809
140573
  );
138810
140574
  if (l3 === "group-active-selected")
138811
140575
  return wrapTextWithPrefix(
138812
140576
  o2.output,
138813
140577
  a2,
138814
140578
  `${i2}${r2} `,
138815
- `${i2}${r2}${(0, import_node_util2.styleText)("green", S_CHECKBOX_SELECTED)} `,
140579
+ `${i2}${r2}${(0, import_node_util3.styleText)("green", S_CHECKBOX_SELECTED)} `,
138816
140580
  `${i2}${c3} `,
138817
- (d) => (0, import_node_util2.styleText)("dim", d)
140581
+ (d) => (0, import_node_util3.styleText)("dim", d)
138818
140582
  );
138819
140583
  if (l3 === "selected") {
138820
- const d = t2 || h2 ? (0, import_node_util2.styleText)("green", S_CHECKBOX_SELECTED) : "";
140584
+ const d = t2 || h2 ? (0, import_node_util3.styleText)("green", S_CHECKBOX_SELECTED) : "";
138821
140585
  return wrapTextWithPrefix(
138822
140586
  o2.output,
138823
140587
  `${a2}${n3.hint ? ` (${n3.hint})` : ""}`,
138824
- `${i2}${(0, import_node_util2.styleText)("dim", r2)} `,
138825
- `${i2}${(0, import_node_util2.styleText)("dim", r2)}${d} `,
138826
- `${i2}${(0, import_node_util2.styleText)("dim", c3)} `,
138827
- (S2) => (0, import_node_util2.styleText)("dim", S2)
140588
+ `${i2}${(0, import_node_util3.styleText)("dim", r2)} `,
140589
+ `${i2}${(0, import_node_util3.styleText)("dim", r2)}${d} `,
140590
+ `${i2}${(0, import_node_util3.styleText)("dim", c3)} `,
140591
+ (S2) => (0, import_node_util3.styleText)("dim", S2)
138828
140592
  );
138829
140593
  }
138830
140594
  if (l3 === "cancelled")
138831
- return `${(0, import_node_util2.styleText)(["strikethrough", "dim"], a2)}`;
140595
+ return `${(0, import_node_util3.styleText)(["strikethrough", "dim"], a2)}`;
138832
140596
  if (l3 === "active-selected")
138833
140597
  return wrapTextWithPrefix(
138834
140598
  o2.output,
138835
- `${a2}${n3.hint ? ` ${(0, import_node_util2.styleText)("dim", `(${n3.hint})`)}` : ""}`,
138836
- `${i2}${(0, import_node_util2.styleText)("dim", r2)} `,
138837
- `${i2}${(0, import_node_util2.styleText)("dim", r2)}${(0, import_node_util2.styleText)("green", S_CHECKBOX_SELECTED)} `,
138838
- `${i2}${(0, import_node_util2.styleText)("dim", c3)} `
140599
+ `${a2}${n3.hint ? ` ${(0, import_node_util3.styleText)("dim", `(${n3.hint})`)}` : ""}`,
140600
+ `${i2}${(0, import_node_util3.styleText)("dim", r2)} `,
140601
+ `${i2}${(0, import_node_util3.styleText)("dim", r2)}${(0, import_node_util3.styleText)("green", S_CHECKBOX_SELECTED)} `,
140602
+ `${i2}${(0, import_node_util3.styleText)("dim", c3)} `
138839
140603
  );
138840
140604
  if (l3 === "submitted")
138841
- return `${(0, import_node_util2.styleText)("dim", a2)}`;
138842
- const f2 = t2 || h2 ? (0, import_node_util2.styleText)("dim", S_CHECKBOX_INACTIVE) : "";
140605
+ return `${(0, import_node_util3.styleText)("dim", a2)}`;
140606
+ const f2 = t2 || h2 ? (0, import_node_util3.styleText)("dim", S_CHECKBOX_INACTIVE) : "";
138843
140607
  return wrapTextWithPrefix(
138844
140608
  o2.output,
138845
140609
  a2,
138846
- `${i2}${(0, import_node_util2.styleText)("dim", r2)} `,
138847
- `${i2}${(0, import_node_util2.styleText)("dim", r2)}${f2} `,
138848
- `${i2}${(0, import_node_util2.styleText)("dim", c3)} `,
138849
- (d) => (0, import_node_util2.styleText)("dim", d)
140610
+ `${i2}${(0, import_node_util3.styleText)("dim", r2)} `,
140611
+ `${i2}${(0, import_node_util3.styleText)("dim", r2)}${f2} `,
140612
+ `${i2}${(0, import_node_util3.styleText)("dim", c3)} `,
140613
+ (d) => (0, import_node_util3.styleText)("dim", d)
138850
140614
  );
138851
140615
  }, y2 = o2.required ?? true, I3 = o2.showInstructions ?? true;
138852
140616
  return new u$2({
@@ -138861,19 +140625,19 @@ ${h2}
138861
140625
  validate(n3) {
138862
140626
  if (y2 && (n3 === void 0 || n3.length === 0))
138863
140627
  return `Please select at least one option.
138864
- ${(0, import_node_util2.styleText)(
140628
+ ${(0, import_node_util3.styleText)(
138865
140629
  "reset",
138866
- (0, import_node_util2.styleText)(
140630
+ (0, import_node_util3.styleText)(
138867
140631
  "dim",
138868
- `Press ${(0, import_node_util2.styleText)(["gray", "bgWhite", "inverse"], " space ")} to select, ${(0, import_node_util2.styleText)(
140632
+ `Press ${(0, import_node_util3.styleText)(["gray", "bgWhite", "inverse"], " space ")} to select, ${(0, import_node_util3.styleText)(
138869
140633
  "gray",
138870
- (0, import_node_util2.styleText)(["bgWhite", "inverse"], " enter ")
140634
+ (0, import_node_util3.styleText)(["bgWhite", "inverse"], " enter ")
138871
140635
  )} to submit`
138872
140636
  )
138873
140637
  )}`;
138874
140638
  },
138875
140639
  render() {
138876
- const n3 = o2.withGuide ?? settings.withGuide, l3 = `${n3 ? `${(0, import_node_util2.styleText)("gray", S_BAR)}
140640
+ const n3 = o2.withGuide ?? settings.withGuide, l3 = `${n3 ? `${(0, import_node_util3.styleText)("gray", S_BAR)}
138877
140641
  ` : ""}${symbol2(this.state)} ${o2.message}
138878
140642
  `, g2 = this.value ?? [], a2 = (t2, s) => {
138879
140643
  const u6 = this.options, r2 = g2.includes(t2.value) || t2.group === true && this.isGroupSelected(`${t2.value}`);
@@ -138881,18 +140645,18 @@ ${(0, import_node_util2.styleText)(
138881
140645
  };
138882
140646
  switch (this.state) {
138883
140647
  case "submit": {
138884
- const t2 = this.options.filter(({ value: u6 }) => g2.includes(u6)).map((u6) => m3(u6, "submitted")), s = t2.length === 0 ? "" : ` ${t2.join((0, import_node_util2.styleText)("dim", ", "))}`;
138885
- return `${l3}${n3 ? (0, import_node_util2.styleText)("gray", S_BAR) : ""}${s}`;
140648
+ const t2 = this.options.filter(({ value: u6 }) => g2.includes(u6)).map((u6) => m3(u6, "submitted")), s = t2.length === 0 ? "" : ` ${t2.join((0, import_node_util3.styleText)("dim", ", "))}`;
140649
+ return `${l3}${n3 ? (0, import_node_util3.styleText)("gray", S_BAR) : ""}${s}`;
138886
140650
  }
138887
140651
  case "cancel": {
138888
- const t2 = this.options.filter(({ value: s }) => g2.includes(s)).map((s) => m3(s, "cancelled")).join((0, import_node_util2.styleText)("dim", ", "));
138889
- return `${l3}${n3 ? `${(0, import_node_util2.styleText)("gray", S_BAR)} ` : ""}${t2.trim() ? `${t2}${n3 ? `
138890
- ${(0, import_node_util2.styleText)("gray", S_BAR)}` : ""}` : ""}`;
140652
+ const t2 = this.options.filter(({ value: s }) => g2.includes(s)).map((s) => m3(s, "cancelled")).join((0, import_node_util3.styleText)("dim", ", "));
140653
+ return `${l3}${n3 ? `${(0, import_node_util3.styleText)("gray", S_BAR)} ` : ""}${t2.trim() ? `${t2}${n3 ? `
140654
+ ${(0, import_node_util3.styleText)("gray", S_BAR)}` : ""}` : ""}`;
138891
140655
  }
138892
140656
  case "error": {
138893
- const t2 = n3 ? `${(0, import_node_util2.styleText)("yellow", S_BAR)} ` : "", s = this.error.split(`
140657
+ const t2 = n3 ? `${(0, import_node_util3.styleText)("yellow", S_BAR)} ` : "", s = this.error.split(`
138894
140658
  `).map(
138895
- (i2, f2) => f2 === 0 ? `${n3 ? `${(0, import_node_util2.styleText)("yellow", S_BAR_END)} ` : ""}${(0, import_node_util2.styleText)("yellow", i2)}` : ` ${i2}`
140659
+ (i2, f2) => f2 === 0 ? `${n3 ? `${(0, import_node_util3.styleText)("yellow", S_BAR_END)} ` : ""}${(0, import_node_util3.styleText)("yellow", i2)}` : ` ${i2}`
138896
140660
  ).join(`
138897
140661
  `), u6 = l3.split(`
138898
140662
  `).length, r2 = s.split(`
@@ -138911,8 +140675,8 @@ ${s}
138911
140675
  `;
138912
140676
  }
138913
140677
  default: {
138914
- const t2 = n3 ? `${(0, import_node_util2.styleText)("cyan", S_BAR)} ` : "", s = l3.split(`
138915
- `).length, u6 = I3 ? formatInstructionFooter(MULTISELECT_INSTRUCTIONS, n3) : n3 ? [(0, import_node_util2.styleText)("cyan", S_BAR_END)] : [], r2 = u6.join(`
140678
+ const t2 = n3 ? `${(0, import_node_util3.styleText)("cyan", S_BAR)} ` : "", s = l3.split(`
140679
+ `).length, u6 = I3 ? formatInstructionFooter(MULTISELECT_INSTRUCTIONS, n3) : n3 ? [(0, import_node_util3.styleText)("cyan", S_BAR_END)] : [], r2 = u6.join(`
138916
140680
  `), c3 = u6.length + 1, i2 = limitOptions({
138917
140681
  output: o2.output,
138918
140682
  options: this.options,
@@ -138933,8 +140697,8 @@ ${r2}
138933
140697
  };
138934
140698
  log = {
138935
140699
  message: (s = [], {
138936
- symbol: e = (0, import_node_util2.styleText)("gray", S_BAR),
138937
- secondarySymbol: r2 = (0, import_node_util2.styleText)("gray", S_BAR),
140700
+ symbol: e = (0, import_node_util3.styleText)("gray", S_BAR),
140701
+ secondarySymbol: r2 = (0, import_node_util3.styleText)("gray", S_BAR),
138938
140702
  output: m3 = process.stdout,
138939
140703
  spacing: l3 = 1,
138940
140704
  withGuide: c3
@@ -138955,39 +140719,39 @@ ${r2}
138955
140719
  `);
138956
140720
  },
138957
140721
  info: (s, e) => {
138958
- log.message(s, { ...e, symbol: (0, import_node_util2.styleText)("blue", S_INFO) });
140722
+ log.message(s, { ...e, symbol: (0, import_node_util3.styleText)("blue", S_INFO) });
138959
140723
  },
138960
140724
  success: (s, e) => {
138961
- log.message(s, { ...e, symbol: (0, import_node_util2.styleText)("green", S_SUCCESS) });
140725
+ log.message(s, { ...e, symbol: (0, import_node_util3.styleText)("green", S_SUCCESS) });
138962
140726
  },
138963
140727
  step: (s, e) => {
138964
- log.message(s, { ...e, symbol: (0, import_node_util2.styleText)("green", S_STEP_SUBMIT) });
140728
+ log.message(s, { ...e, symbol: (0, import_node_util3.styleText)("green", S_STEP_SUBMIT) });
138965
140729
  },
138966
140730
  warn: (s, e) => {
138967
- log.message(s, { ...e, symbol: (0, import_node_util2.styleText)("yellow", S_WARN) });
140731
+ log.message(s, { ...e, symbol: (0, import_node_util3.styleText)("yellow", S_WARN) });
138968
140732
  },
138969
140733
  /** alias for `log.warn()`. */
138970
140734
  warning: (s, e) => {
138971
140735
  log.warn(s, e);
138972
140736
  },
138973
140737
  error: (s, e) => {
138974
- log.message(s, { ...e, symbol: (0, import_node_util2.styleText)("red", S_ERROR) });
140738
+ log.message(s, { ...e, symbol: (0, import_node_util3.styleText)("red", S_ERROR) });
138975
140739
  }
138976
140740
  };
138977
140741
  cancel = (o2 = "", t2) => {
138978
- const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${(0, import_node_util2.styleText)("gray", S_BAR_END)} ` : "";
138979
- i2.write(`${e}${(0, import_node_util2.styleText)("red", o2)}
140742
+ const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${(0, import_node_util3.styleText)("gray", S_BAR_END)} ` : "";
140743
+ i2.write(`${e}${(0, import_node_util3.styleText)("red", o2)}
138980
140744
 
138981
140745
  `);
138982
140746
  };
138983
140747
  intro = (o2 = "", t2) => {
138984
- const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${(0, import_node_util2.styleText)("gray", S_BAR_START)} ` : "";
140748
+ const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${(0, import_node_util3.styleText)("gray", S_BAR_START)} ` : "";
138985
140749
  i2.write(`${e}${o2}
138986
140750
  `);
138987
140751
  };
138988
140752
  outro = (o2 = "", t2) => {
138989
- const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${(0, import_node_util2.styleText)("gray", S_BAR)}
138990
- ${(0, import_node_util2.styleText)("gray", S_BAR_END)} ` : "";
140753
+ const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${(0, import_node_util3.styleText)("gray", S_BAR)}
140754
+ ${(0, import_node_util3.styleText)("gray", S_BAR_END)} ` : "";
138991
140755
  i2.write(`${e}${o2}
138992
140756
 
138993
140757
  `);
@@ -139002,44 +140766,44 @@ ${(0, import_node_util2.styleText)("gray", S_BAR_END)} ` : "";
139002
140766
  signal: e.signal,
139003
140767
  input: e.input,
139004
140768
  render() {
139005
- const i2 = e?.withGuide ?? settings.withGuide, o2 = `${`${i2 ? `${(0, import_node_util2.styleText)("gray", S_BAR)}
140769
+ const i2 = e?.withGuide ?? settings.withGuide, o2 = `${`${i2 ? `${(0, import_node_util3.styleText)("gray", S_BAR)}
139006
140770
  ` : ""}${symbol2(this.state)} `}${e.message}
139007
140771
  `, m3 = e.placeholder && e.placeholder.length > 0 ? (
139008
140772
  // biome-ignore lint/style/noNonNullAssertion: guarded by placeholder.length > 0
139009
- (0, import_node_util2.styleText)("inverse", e.placeholder[0]) + (0, import_node_util2.styleText)("dim", e.placeholder.slice(1))
139010
- ) : (0, import_node_util2.styleText)(["inverse", "hidden"], "_"), a2 = this.userInput ? this.userInputWithCursor : m3, l3 = this.value ?? "", c3 = e.showSubmit ? `
139011
- ${(0, import_node_util2.styleText)(this.focused === "submit" ? "cyan" : "dim", "[ submit ]")}` : "";
140773
+ (0, import_node_util3.styleText)("inverse", e.placeholder[0]) + (0, import_node_util3.styleText)("dim", e.placeholder.slice(1))
140774
+ ) : (0, import_node_util3.styleText)(["inverse", "hidden"], "_"), a2 = this.userInput ? this.userInputWithCursor : m3, l3 = this.value ?? "", c3 = e.showSubmit ? `
140775
+ ${(0, import_node_util3.styleText)(this.focused === "submit" ? "cyan" : "dim", "[ submit ]")}` : "";
139012
140776
  switch (this.state) {
139013
140777
  case "error": {
139014
- const n3 = `${(0, import_node_util2.styleText)("yellow", S_BAR)} `, r2 = i2 ? wrapTextWithPrefix(e.output, a2, n3, void 0) : a2, u6 = (0, import_node_util2.styleText)("yellow", S_BAR_END);
140778
+ const n3 = `${(0, import_node_util3.styleText)("yellow", S_BAR)} `, r2 = i2 ? wrapTextWithPrefix(e.output, a2, n3, void 0) : a2, u6 = (0, import_node_util3.styleText)("yellow", S_BAR_END);
139015
140779
  return `${o2}${r2}
139016
- ${u6} ${(0, import_node_util2.styleText)("yellow", this.error)}${c3}
140780
+ ${u6} ${(0, import_node_util3.styleText)("yellow", this.error)}${c3}
139017
140781
  `;
139018
140782
  }
139019
140783
  case "submit": {
139020
- const n3 = `${(0, import_node_util2.styleText)("gray", S_BAR)} `, r2 = i2 ? wrapTextWithPrefix(
140784
+ const n3 = `${(0, import_node_util3.styleText)("gray", S_BAR)} `, r2 = i2 ? wrapTextWithPrefix(
139021
140785
  e.output,
139022
140786
  l3,
139023
140787
  n3,
139024
140788
  void 0,
139025
140789
  void 0,
139026
- (u6) => (0, import_node_util2.styleText)("dim", u6)
139027
- ) : l3 ? (0, import_node_util2.styleText)("dim", l3) : "";
140790
+ (u6) => (0, import_node_util3.styleText)("dim", u6)
140791
+ ) : l3 ? (0, import_node_util3.styleText)("dim", l3) : "";
139028
140792
  return `${o2}${r2}`;
139029
140793
  }
139030
140794
  case "cancel": {
139031
- const n3 = `${(0, import_node_util2.styleText)("gray", S_BAR)} `, r2 = i2 ? wrapTextWithPrefix(
140795
+ const n3 = `${(0, import_node_util3.styleText)("gray", S_BAR)} `, r2 = i2 ? wrapTextWithPrefix(
139032
140796
  e.output,
139033
140797
  l3,
139034
140798
  n3,
139035
140799
  void 0,
139036
140800
  void 0,
139037
- (u6) => (0, import_node_util2.styleText)(["strikethrough", "dim"], u6)
139038
- ) : l3 ? (0, import_node_util2.styleText)(["strikethrough", "dim"], l3) : "";
140801
+ (u6) => (0, import_node_util3.styleText)(["strikethrough", "dim"], u6)
140802
+ ) : l3 ? (0, import_node_util3.styleText)(["strikethrough", "dim"], l3) : "";
139039
140803
  return `${o2}${r2}`;
139040
140804
  }
139041
140805
  default: {
139042
- const n3 = i2 ? `${(0, import_node_util2.styleText)("cyan", S_BAR)} ` : "", r2 = i2 ? (0, import_node_util2.styleText)("cyan", S_BAR_END) : "", u6 = i2 ? wrapTextWithPrefix(e.output, a2, n3) : a2;
140806
+ const n3 = i2 ? `${(0, import_node_util3.styleText)("cyan", S_BAR)} ` : "", r2 = i2 ? (0, import_node_util3.styleText)("cyan", S_BAR_END) : "", u6 = i2 ? wrapTextWithPrefix(e.output, a2, n3) : a2;
139043
140807
  return `${o2}${u6}
139044
140808
  ${r2}${c3}
139045
140809
  `;
@@ -139065,17 +140829,17 @@ ${r2}${c3}
139065
140829
  }, 0),
139066
140830
  n3
139067
140831
  ) + 2, h2 = g2.map(
139068
- (m3) => `${(0, import_node_util2.styleText)("gray", S_BAR)} ${m3}${" ".repeat(t2 - dist_default2(m3))}${(0, import_node_util2.styleText)("gray", S_BAR)}`
140832
+ (m3) => `${(0, import_node_util3.styleText)("gray", S_BAR)} ${m3}${" ".repeat(t2 - dist_default2(m3))}${(0, import_node_util3.styleText)("gray", S_BAR)}`
139069
140833
  ).join(`
139070
- `), T4 = i2 ? `${(0, import_node_util2.styleText)("gray", S_BAR)}
140834
+ `), T4 = i2 ? `${(0, import_node_util3.styleText)("gray", S_BAR)}
139071
140835
  ` : "", l$1 = i2 ? S_CONNECT_LEFT : S_CORNER_BOTTOM_LEFT;
139072
140836
  a2.write(
139073
- `${T4}${(0, import_node_util2.styleText)("green", S_STEP_SUBMIT)} ${(0, import_node_util2.styleText)("reset", e)} ${(0, import_node_util2.styleText)(
140837
+ `${T4}${(0, import_node_util3.styleText)("green", S_STEP_SUBMIT)} ${(0, import_node_util3.styleText)("reset", e)} ${(0, import_node_util3.styleText)(
139074
140838
  "gray",
139075
140839
  S_BAR_H.repeat(Math.max(t2 - n3 - 1, 1)) + S_CORNER_TOP_RIGHT
139076
140840
  )}
139077
140841
  ${h2}
139078
- ${(0, import_node_util2.styleText)("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
140842
+ ${(0, import_node_util3.styleText)("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
139079
140843
  `
139080
140844
  );
139081
140845
  };
@@ -139086,28 +140850,28 @@ ${(0, import_node_util2.styleText)("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORN
139086
140850
  input: r2.input,
139087
140851
  output: r2.output,
139088
140852
  render() {
139089
- const e = r2.withGuide ?? settings.withGuide, o2 = `${e ? `${(0, import_node_util2.styleText)("gray", S_BAR)}
140853
+ const e = r2.withGuide ?? settings.withGuide, o2 = `${e ? `${(0, import_node_util3.styleText)("gray", S_BAR)}
139090
140854
  ` : ""}${symbol2(this.state)} ${r2.message}
139091
140855
  `, c3 = this.userInputWithCursor, i2 = this.masked;
139092
140856
  switch (this.state) {
139093
140857
  case "error": {
139094
- const s = e ? `${(0, import_node_util2.styleText)("yellow", S_BAR)} ` : "", n3 = e ? `${(0, import_node_util2.styleText)("yellow", S_BAR_END)} ` : "", l3 = i2 ?? "";
140858
+ const s = e ? `${(0, import_node_util3.styleText)("yellow", S_BAR)} ` : "", n3 = e ? `${(0, import_node_util3.styleText)("yellow", S_BAR_END)} ` : "", l3 = i2 ?? "";
139095
140859
  return r2.clearOnError && this.clear(), `${o2.trim()}
139096
140860
  ${s}${l3}
139097
- ${n3}${(0, import_node_util2.styleText)("yellow", this.error)}
140861
+ ${n3}${(0, import_node_util3.styleText)("yellow", this.error)}
139098
140862
  `;
139099
140863
  }
139100
140864
  case "submit": {
139101
- const s = e ? `${(0, import_node_util2.styleText)("gray", S_BAR)} ` : "", n3 = i2 ? (0, import_node_util2.styleText)("dim", i2) : "";
140865
+ const s = e ? `${(0, import_node_util3.styleText)("gray", S_BAR)} ` : "", n3 = i2 ? (0, import_node_util3.styleText)("dim", i2) : "";
139102
140866
  return `${o2}${s}${n3}`;
139103
140867
  }
139104
140868
  case "cancel": {
139105
- const s = e ? `${(0, import_node_util2.styleText)("gray", S_BAR)} ` : "", n3 = i2 ? (0, import_node_util2.styleText)(["strikethrough", "dim"], i2) : "";
140869
+ const s = e ? `${(0, import_node_util3.styleText)("gray", S_BAR)} ` : "", n3 = i2 ? (0, import_node_util3.styleText)(["strikethrough", "dim"], i2) : "";
139106
140870
  return `${o2}${s}${n3}${i2 && e ? `
139107
- ${(0, import_node_util2.styleText)("gray", S_BAR)}` : ""}`;
140871
+ ${(0, import_node_util3.styleText)("gray", S_BAR)}` : ""}`;
139108
140872
  }
139109
140873
  default: {
139110
- const s = e ? `${(0, import_node_util2.styleText)("cyan", S_BAR)} ` : "", n3 = e ? (0, import_node_util2.styleText)("cyan", S_BAR_END) : "";
140874
+ const s = e ? `${(0, import_node_util3.styleText)("cyan", S_BAR)} ` : "", n3 = e ? (0, import_node_util3.styleText)("cyan", S_BAR_END) : "";
139111
140875
  return `${o2}${s}${c3}
139112
140876
  ${n3}
139113
140877
  `;
@@ -139155,7 +140919,7 @@ ${n3}
139155
140919
  }
139156
140920
  });
139157
140921
  };
139158
- W = (l3) => (0, import_node_util2.styleText)("magenta", l3);
140922
+ W = (l3) => (0, import_node_util3.styleText)("magenta", l3);
139159
140923
  spinner = ({
139160
140924
  indicator: l3 = "dots",
139161
140925
  onCancel: h2,
@@ -139190,7 +140954,7 @@ ${n3}
139190
140954
  const r2 = (performance.now() - e) / 1e3, t2 = Math.floor(r2 / 60), o2 = Math.floor(r2 % 60);
139191
140955
  return t2 > 0 ? `[${t2}m ${o2}s]` : `[${o2}s]`;
139192
140956
  }, N2 = I3.withGuide ?? settings.withGuide, P4 = (e = "") => {
139193
- d = true, M3 = block2({ output: n3 }), s = C4(e), w2 = performance.now(), N2 && n3.write(`${(0, import_node_util2.styleText)("gray", S_BAR)}
140957
+ d = true, M3 = block2({ output: n3 }), s = C4(e), w2 = performance.now(), N2 && n3.write(`${(0, import_node_util3.styleText)("gray", S_BAR)}
139194
140958
  `);
139195
140959
  let r2 = 0, t2 = 0;
139196
140960
  A2(), T4 = setInterval(() => {
@@ -139216,7 +140980,7 @@ ${n3}
139216
140980
  }, a2 = (e = "", r2 = 0, t2 = false) => {
139217
140981
  if (!d) return;
139218
140982
  d = false, clearInterval(T4), y2();
139219
- const o2 = r2 === 0 ? (0, import_node_util2.styleText)("green", S_STEP_SUBMIT) : r2 === 1 ? (0, import_node_util2.styleText)("red", S_STEP_CANCEL) : (0, import_node_util2.styleText)("red", S_STEP_ERROR);
140983
+ const o2 = r2 === 0 ? (0, import_node_util3.styleText)("green", S_STEP_SUBMIT) : r2 === 1 ? (0, import_node_util3.styleText)("red", S_STEP_CANCEL) : (0, import_node_util3.styleText)("red", S_STEP_ERROR);
139220
140984
  s = e ?? s, t2 || (l3 === "timer" ? n3.write(`${o2} ${s} ${_2(w2)}
139221
140985
  `) : n3.write(`${o2} ${s}
139222
140986
  `)), H2(), M3();
@@ -139241,8 +141005,8 @@ ${n3}
139241
141005
  block: unicodeOr("\u2588", "#")
139242
141006
  };
139243
141007
  SELECT_INSTRUCTIONS = [
139244
- `${(0, import_node_util2.styleText)("dim", "\u2191/\u2193")} to navigate`,
139245
- `${(0, import_node_util2.styleText)("dim", "Enter:")} confirm`
141008
+ `${(0, import_node_util3.styleText)("dim", "\u2191/\u2193")} to navigate`,
141009
+ `${(0, import_node_util3.styleText)("dim", "Enter:")} confirm`
139246
141010
  ];
139247
141011
  c2 = (t2, o2) => t2.includes(`
139248
141012
  `) ? t2.split(`
@@ -139255,15 +141019,15 @@ ${n3}
139255
141019
  const s = n3.label ?? String(n3.value);
139256
141020
  switch (m3) {
139257
141021
  case "disabled":
139258
- return `${(0, import_node_util2.styleText)("gray", S_RADIO_INACTIVE)} ${c2(s, (i2) => (0, import_node_util2.styleText)("gray", i2))}${n3.hint ? ` ${(0, import_node_util2.styleText)("dim", `(${n3.hint ?? "disabled"})`)}` : ""}`;
141022
+ return `${(0, import_node_util3.styleText)("gray", S_RADIO_INACTIVE)} ${c2(s, (i2) => (0, import_node_util3.styleText)("gray", i2))}${n3.hint ? ` ${(0, import_node_util3.styleText)("dim", `(${n3.hint ?? "disabled"})`)}` : ""}`;
139259
141023
  case "selected":
139260
- return `${c2(s, (i2) => (0, import_node_util2.styleText)("dim", i2))}`;
141024
+ return `${c2(s, (i2) => (0, import_node_util3.styleText)("dim", i2))}`;
139261
141025
  case "active":
139262
- return `${(0, import_node_util2.styleText)("green", S_RADIO_ACTIVE)} ${s}${n3.hint ? ` ${(0, import_node_util2.styleText)("dim", `(${n3.hint})`)}` : ""}`;
141026
+ return `${(0, import_node_util3.styleText)("green", S_RADIO_ACTIVE)} ${s}${n3.hint ? ` ${(0, import_node_util3.styleText)("dim", `(${n3.hint})`)}` : ""}`;
139263
141027
  case "cancelled":
139264
- return `${c2(s, (i2) => (0, import_node_util2.styleText)(["strikethrough", "dim"], i2))}`;
141028
+ return `${c2(s, (i2) => (0, import_node_util3.styleText)(["strikethrough", "dim"], i2))}`;
139265
141029
  default:
139266
- return `${(0, import_node_util2.styleText)("dim", S_RADIO_INACTIVE)} ${c2(s, (i2) => (0, import_node_util2.styleText)("dim", i2))}`;
141030
+ return `${(0, import_node_util3.styleText)("dim", S_RADIO_INACTIVE)} ${c2(s, (i2) => (0, import_node_util3.styleText)("dim", i2))}`;
139267
141031
  }
139268
141032
  }, d = t2.showInstructions ?? true;
139269
141033
  return new n$1({
@@ -139278,12 +141042,12 @@ ${n3}
139278
141042
  t2.message,
139279
141043
  s,
139280
141044
  m3
139281
- ), u6 = `${n3 ? `${(0, import_node_util2.styleText)("gray", S_BAR)}
141045
+ ), u6 = `${n3 ? `${(0, import_node_util3.styleText)("gray", S_BAR)}
139282
141046
  ` : ""}${i2}
139283
141047
  `;
139284
141048
  switch (this.state) {
139285
141049
  case "submit": {
139286
- const r2 = n3 ? `${(0, import_node_util2.styleText)("gray", S_BAR)} ` : "", a2 = wrapTextWithPrefix(
141050
+ const r2 = n3 ? `${(0, import_node_util3.styleText)("gray", S_BAR)} ` : "", a2 = wrapTextWithPrefix(
139287
141051
  t2.output,
139288
141052
  o2(this.options[this.cursor], "selected"),
139289
141053
  r2
@@ -139291,17 +141055,17 @@ ${n3}
139291
141055
  return `${u6}${a2}`;
139292
141056
  }
139293
141057
  case "cancel": {
139294
- const r2 = n3 ? `${(0, import_node_util2.styleText)("gray", S_BAR)} ` : "", a2 = wrapTextWithPrefix(
141058
+ const r2 = n3 ? `${(0, import_node_util3.styleText)("gray", S_BAR)} ` : "", a2 = wrapTextWithPrefix(
139295
141059
  t2.output,
139296
141060
  o2(this.options[this.cursor], "cancelled"),
139297
141061
  r2
139298
141062
  );
139299
141063
  return `${u6}${a2}${n3 ? `
139300
- ${(0, import_node_util2.styleText)("gray", S_BAR)}` : ""}`;
141064
+ ${(0, import_node_util3.styleText)("gray", S_BAR)}` : ""}`;
139301
141065
  }
139302
141066
  default: {
139303
- const r2 = n3 ? `${(0, import_node_util2.styleText)("cyan", S_BAR)} ` : "", a2 = u6.split(`
139304
- `).length, p3 = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n3) : n3 ? [(0, import_node_util2.styleText)("cyan", S_BAR_END)] : [], b3 = p3.join(`
141067
+ const r2 = n3 ? `${(0, import_node_util3.styleText)("cyan", S_BAR)} ` : "", a2 = u6.split(`
141068
+ `).length, p3 = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n3) : n3 ? [(0, import_node_util3.styleText)("cyan", S_BAR_END)] : [], b3 = p3.join(`
139305
141069
  `), f2 = p3.length + 1;
139306
141070
  return `${u6}${r2}${limitOptions({
139307
141071
  output: t2.output,
@@ -139325,7 +141089,7 @@ ${b3}
139325
141089
  if (e === void 0)
139326
141090
  return "";
139327
141091
  const n3 = e.label ?? String(e.value);
139328
- return a2 === "selected" ? `${(0, import_node_util2.styleText)("dim", n3)}` : a2 === "cancelled" ? `${(0, import_node_util2.styleText)(["strikethrough", "dim"], n3)}` : a2 === "active" ? `${(0, import_node_util2.styleText)(["bgCyan", "gray"], ` ${e.value} `)} ${n3}${e.hint ? ` ${(0, import_node_util2.styleText)("dim", `(${e.hint})`)}` : ""}` : `${(0, import_node_util2.styleText)(["gray", "bgWhite", "inverse"], ` ${e.value} `)} ${n3}${e.hint ? ` ${(0, import_node_util2.styleText)("dim", `(${e.hint})`)}` : ""}`;
141092
+ return a2 === "selected" ? `${(0, import_node_util3.styleText)("dim", n3)}` : a2 === "cancelled" ? `${(0, import_node_util3.styleText)(["strikethrough", "dim"], n3)}` : a2 === "active" ? `${(0, import_node_util3.styleText)(["bgCyan", "gray"], ` ${e.value} `)} ${n3}${e.hint ? ` ${(0, import_node_util3.styleText)("dim", `(${e.hint})`)}` : ""}` : `${(0, import_node_util3.styleText)(["gray", "bgWhite", "inverse"], ` ${e.value} `)} ${n3}${e.hint ? ` ${(0, import_node_util3.styleText)("dim", `(${e.hint})`)}` : ""}`;
139329
141093
  };
139330
141094
  return new u4({
139331
141095
  options: t2.options,
@@ -139335,12 +141099,12 @@ ${b3}
139335
141099
  initialValue: t2.initialValue,
139336
141100
  caseSensitive: t2.caseSensitive,
139337
141101
  render() {
139338
- const e = t2.withGuide ?? settings.withGuide, a2 = `${e ? `${(0, import_node_util2.styleText)("gray", S_BAR)}
141102
+ const e = t2.withGuide ?? settings.withGuide, a2 = `${e ? `${(0, import_node_util3.styleText)("gray", S_BAR)}
139339
141103
  ` : ""}${symbol2(this.state)} ${t2.message}
139340
141104
  `;
139341
141105
  switch (this.state) {
139342
141106
  case "submit": {
139343
- const n3 = e ? `${(0, import_node_util2.styleText)("gray", S_BAR)} ` : "", s = this.options.find((u6) => u6.value === this.value) ?? t2.options[0], c3 = wrapTextWithPrefix(
141107
+ const n3 = e ? `${(0, import_node_util3.styleText)("gray", S_BAR)} ` : "", s = this.options.find((u6) => u6.value === this.value) ?? t2.options[0], c3 = wrapTextWithPrefix(
139344
141108
  t2.output,
139345
141109
  l3(s, "selected"),
139346
141110
  n3
@@ -139348,16 +141112,16 @@ ${b3}
139348
141112
  return `${a2}${c3}`;
139349
141113
  }
139350
141114
  case "cancel": {
139351
- const n3 = e ? `${(0, import_node_util2.styleText)("gray", S_BAR)} ` : "", s = wrapTextWithPrefix(
141115
+ const n3 = e ? `${(0, import_node_util3.styleText)("gray", S_BAR)} ` : "", s = wrapTextWithPrefix(
139352
141116
  t2.output,
139353
141117
  l3(this.options[0], "cancelled"),
139354
141118
  n3
139355
141119
  );
139356
141120
  return `${a2}${s}${e ? `
139357
- ${(0, import_node_util2.styleText)("gray", S_BAR)}` : ""}`;
141121
+ ${(0, import_node_util3.styleText)("gray", S_BAR)}` : ""}`;
139358
141122
  }
139359
141123
  default: {
139360
- const n3 = e ? `${(0, import_node_util2.styleText)("cyan", S_BAR)} ` : "", s = e ? (0, import_node_util2.styleText)("cyan", S_BAR_END) : "", c3 = this.options.map(
141124
+ const n3 = e ? `${(0, import_node_util3.styleText)("cyan", S_BAR)} ` : "", s = e ? (0, import_node_util3.styleText)("cyan", S_BAR_END) : "", c3 = this.options.map(
139361
141125
  (u6, d) => wrapTextWithPrefix(
139362
141126
  t2.output,
139363
141127
  l3(u6, d === this.cursor ? "active" : "inactive"),
@@ -139373,31 +141137,31 @@ ${s}
139373
141137
  }
139374
141138
  }).prompt();
139375
141139
  };
139376
- i = `${(0, import_node_util2.styleText)("gray", S_BAR)} `;
141140
+ i = `${(0, import_node_util3.styleText)("gray", S_BAR)} `;
139377
141141
  stream4 = {
139378
- message: async (e, { symbol: l3 = (0, import_node_util2.styleText)("gray", S_BAR) } = {}) => {
139379
- process.stdout.write(`${(0, import_node_util2.styleText)("gray", S_BAR)}
141142
+ message: async (e, { symbol: l3 = (0, import_node_util3.styleText)("gray", S_BAR) } = {}) => {
141143
+ process.stdout.write(`${(0, import_node_util3.styleText)("gray", S_BAR)}
139380
141144
  ${l3} `);
139381
141145
  let s = 3;
139382
141146
  for await (let r2 of e) {
139383
141147
  r2 = r2.replace(/\n/g, `
139384
141148
  ${i}`), r2.includes(`
139385
- `) && (s = 3 + (0, import_node_util2.stripVTControlCharacters)(r2.slice(r2.lastIndexOf(`
141149
+ `) && (s = 3 + (0, import_node_util3.stripVTControlCharacters)(r2.slice(r2.lastIndexOf(`
139386
141150
  `))).length);
139387
- const o2 = (0, import_node_util2.stripVTControlCharacters)(r2).length;
141151
+ const o2 = (0, import_node_util3.stripVTControlCharacters)(r2).length;
139388
141152
  s + o2 < process.stdout.columns ? (s += o2, process.stdout.write(r2)) : (process.stdout.write(`
139389
- ${i}${r2.trimStart()}`), s = 3 + (0, import_node_util2.stripVTControlCharacters)(r2.trimStart()).length);
141153
+ ${i}${r2.trimStart()}`), s = 3 + (0, import_node_util3.stripVTControlCharacters)(r2.trimStart()).length);
139390
141154
  }
139391
141155
  process.stdout.write(`
139392
141156
  `);
139393
141157
  },
139394
- info: (e) => stream4.message(e, { symbol: (0, import_node_util2.styleText)("blue", S_INFO) }),
139395
- success: (e) => stream4.message(e, { symbol: (0, import_node_util2.styleText)("green", S_SUCCESS) }),
139396
- step: (e) => stream4.message(e, { symbol: (0, import_node_util2.styleText)("green", S_STEP_SUBMIT) }),
139397
- warn: (e) => stream4.message(e, { symbol: (0, import_node_util2.styleText)("yellow", S_WARN) }),
141158
+ info: (e) => stream4.message(e, { symbol: (0, import_node_util3.styleText)("blue", S_INFO) }),
141159
+ success: (e) => stream4.message(e, { symbol: (0, import_node_util3.styleText)("green", S_SUCCESS) }),
141160
+ step: (e) => stream4.message(e, { symbol: (0, import_node_util3.styleText)("green", S_STEP_SUBMIT) }),
141161
+ warn: (e) => stream4.message(e, { symbol: (0, import_node_util3.styleText)("yellow", S_WARN) }),
139398
141162
  /** alias for `log.warn()`. */
139399
141163
  warning: (e) => stream4.warn(e),
139400
- error: (e) => stream4.message(e, { symbol: (0, import_node_util2.styleText)("red", S_ERROR) })
141164
+ error: (e) => stream4.message(e, { symbol: (0, import_node_util3.styleText)("red", S_ERROR) })
139401
141165
  };
139402
141166
  tasks = async (o2, e) => {
139403
141167
  for (const t2 of o2) {
@@ -139410,9 +141174,9 @@ ${i}${r2.trimStart()}`), s = 3 + (0, import_node_util2.stripVTControlCharacters)
139410
141174
  };
139411
141175
  A = (l3) => l3.replace(/\x1b\[(?:\d+;)*\d*[ABCDEFGHfJKSTsu]|\x1b\[(s|u)/g, "");
139412
141176
  taskLog = (l3) => {
139413
- const r2 = l3.output ?? process.stdout, O = getColumns(r2), i2 = (0, import_node_util2.styleText)("gray", S_BAR), p3 = l3.spacing ?? 1, k = 3, m3 = l3.retainLog === true, d = !isCI() && isTTY(r2);
141177
+ const r2 = l3.output ?? process.stdout, O = getColumns(r2), i2 = (0, import_node_util3.styleText)("gray", S_BAR), p3 = l3.spacing ?? 1, k = 3, m3 = l3.retainLog === true, d = !isCI() && isTTY(r2);
139414
141178
  r2.write(`${i2}
139415
- `), r2.write(`${(0, import_node_util2.styleText)("green", S_STEP_SUBMIT)} ${l3.title}
141179
+ `), r2.write(`${(0, import_node_util3.styleText)("green", S_STEP_SUBMIT)} ${l3.title}
139416
141180
  `);
139417
141181
  for (let e = 0; e < p3; e++)
139418
141182
  r2.write(`${i2}
@@ -139446,7 +141210,7 @@ ${t2.header}`);
139446
141210
  ${e.value}` : e.value;
139447
141211
  e.header !== void 0 && e.header !== "" && log.message(
139448
141212
  e.header.split(`
139449
- `).map((a2) => (0, import_node_util2.styleText)("bold", a2)),
141213
+ `).map((a2) => (0, import_node_util3.styleText)("bold", a2)),
139450
141214
  {
139451
141215
  output: r2,
139452
141216
  secondarySymbol: i2,
@@ -139455,7 +141219,7 @@ ${e.value}` : e.value;
139455
141219
  }
139456
141220
  ), log.message(
139457
141221
  o2.split(`
139458
- `).map((a2) => (0, import_node_util2.styleText)("dim", a2)),
141222
+ `).map((a2) => (0, import_node_util3.styleText)("dim", a2)),
139459
141223
  {
139460
141224
  output: r2,
139461
141225
  secondarySymbol: i2,
@@ -139534,31 +141298,31 @@ ${e.value}` : e.value;
139534
141298
  signal: e.signal,
139535
141299
  input: e.input,
139536
141300
  render() {
139537
- const i2 = e?.withGuide ?? settings.withGuide, s = `${`${i2 ? `${(0, import_node_util2.styleText)("gray", S_BAR)}
141301
+ const i2 = e?.withGuide ?? settings.withGuide, s = `${`${i2 ? `${(0, import_node_util3.styleText)("gray", S_BAR)}
139538
141302
  ` : ""}${symbol2(this.state)} `}${e.message}
139539
141303
  `, c3 = e.placeholder && e.placeholder.length > 0 ? (
139540
141304
  // biome-ignore lint/style/noNonNullAssertion: guarded by placeholder.length > 0
139541
- (0, import_node_util2.styleText)("inverse", e.placeholder[0]) + (0, import_node_util2.styleText)("dim", e.placeholder.slice(1))
139542
- ) : (0, import_node_util2.styleText)(["inverse", "hidden"], "_"), o2 = this.userInput ? this.userInputWithCursor : c3, l3 = this.value ?? "";
141305
+ (0, import_node_util3.styleText)("inverse", e.placeholder[0]) + (0, import_node_util3.styleText)("dim", e.placeholder.slice(1))
141306
+ ) : (0, import_node_util3.styleText)(["inverse", "hidden"], "_"), o2 = this.userInput ? this.userInputWithCursor : c3, l3 = this.value ?? "";
139543
141307
  switch (this.state) {
139544
141308
  case "error": {
139545
- const n3 = this.error ? ` ${(0, import_node_util2.styleText)("yellow", this.error)}` : "", r2 = i2 ? `${(0, import_node_util2.styleText)("yellow", S_BAR)} ` : "", d = i2 ? (0, import_node_util2.styleText)("yellow", S_BAR_END) : "";
141309
+ const n3 = this.error ? ` ${(0, import_node_util3.styleText)("yellow", this.error)}` : "", r2 = i2 ? `${(0, import_node_util3.styleText)("yellow", S_BAR)} ` : "", d = i2 ? (0, import_node_util3.styleText)("yellow", S_BAR_END) : "";
139546
141310
  return `${s.trim()}
139547
141311
  ${r2}${o2}
139548
141312
  ${d}${n3}
139549
141313
  `;
139550
141314
  }
139551
141315
  case "submit": {
139552
- const n3 = l3 ? ` ${(0, import_node_util2.styleText)("dim", l3)}` : "", r2 = i2 ? (0, import_node_util2.styleText)("gray", S_BAR) : "";
141316
+ const n3 = l3 ? ` ${(0, import_node_util3.styleText)("dim", l3)}` : "", r2 = i2 ? (0, import_node_util3.styleText)("gray", S_BAR) : "";
139553
141317
  return `${s}${r2}${n3}`;
139554
141318
  }
139555
141319
  case "cancel": {
139556
- const n3 = l3 ? ` ${(0, import_node_util2.styleText)(["strikethrough", "dim"], l3)}` : "", r2 = i2 ? (0, import_node_util2.styleText)("gray", S_BAR) : "";
141320
+ const n3 = l3 ? ` ${(0, import_node_util3.styleText)(["strikethrough", "dim"], l3)}` : "", r2 = i2 ? (0, import_node_util3.styleText)("gray", S_BAR) : "";
139557
141321
  return `${s}${r2}${n3}${l3.trim() ? `
139558
141322
  ${r2}` : ""}`;
139559
141323
  }
139560
141324
  default: {
139561
- const n3 = i2 ? `${(0, import_node_util2.styleText)("cyan", S_BAR)} ` : "", r2 = i2 ? (0, import_node_util2.styleText)("cyan", S_BAR_END) : "";
141325
+ const n3 = i2 ? `${(0, import_node_util3.styleText)("cyan", S_BAR)} ` : "", r2 = i2 ? (0, import_node_util3.styleText)("cyan", S_BAR_END) : "";
139562
141326
  return `${s}${n3}${o2}
139563
141327
  ${r2}
139564
141328
  `;
@@ -141482,7 +143246,7 @@ var require_type2 = __commonJS({
141482
143246
  });
141483
143247
 
141484
143248
  // ../../node_modules/.pnpm/@sinclair+typebox@0.34.28/node_modules/@sinclair/typebox/build/cjs/type/clone/index.js
141485
- var require_clone = __commonJS({
143249
+ var require_clone2 = __commonJS({
141486
143250
  "../../node_modules/.pnpm/@sinclair+typebox@0.34.28/node_modules/@sinclair/typebox/build/cjs/type/clone/index.js"(exports2) {
141487
143251
  "use strict";
141488
143252
  var __createBinding = exports2 && exports2.__createBinding || (Object.create ? (function(o2, m3, k, k2) {
@@ -146694,7 +148458,7 @@ var require_compute = __commonJS({
146694
148458
  exports2.ComputeType = ComputeType;
146695
148459
  exports2.ComputeModuleProperties = ComputeModuleProperties;
146696
148460
  var index_1 = require_create();
146697
- var index_2 = require_clone();
148461
+ var index_2 = require_clone2();
146698
148462
  var index_3 = require_discard2();
146699
148463
  var index_4 = require_array2();
146700
148464
  var index_5 = require_awaited2();
@@ -147977,7 +149741,7 @@ var require_cjs = __commonJS({
147977
149741
  for (var p3 in m3) if (p3 !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p3)) __createBinding(exports3, m3, p3);
147978
149742
  };
147979
149743
  Object.defineProperty(exports2, "__esModule", { value: true });
147980
- __exportStar(require_clone(), exports2);
149744
+ __exportStar(require_clone2(), exports2);
147981
149745
  __exportStar(require_create(), exports2);
147982
149746
  __exportStar(require_error2(), exports2);
147983
149747
  __exportStar(require_guard3(), exports2);
@@ -350435,12 +352199,12 @@ ${options2.prefix}` : "\n" : options2.prefix
350435
352199
  * of the new one. (Note that the amount of time the canceled operation had been
350436
352200
  * waiting does not affect the amount of time that the new operation waits.)
350437
352201
  */
350438
- schedule(operationId, delay, cb) {
352202
+ schedule(operationId, delay2, cb) {
350439
352203
  const pendingTimeout = this.pendingTimeouts.get(operationId);
350440
352204
  if (pendingTimeout) {
350441
352205
  this.host.clearTimeout(pendingTimeout);
350442
352206
  }
350443
- this.pendingTimeouts.set(operationId, this.host.setTimeout(_ThrottledOperations.run, delay, operationId, this, cb));
352207
+ this.pendingTimeouts.set(operationId, this.host.setTimeout(_ThrottledOperations.run, delay2, operationId, this, cb));
350444
352208
  if (this.logger) {
350445
352209
  this.logger.info(`Scheduled: ${operationId}${pendingTimeout ? ", Cancelled earlier one" : ""}`);
350446
352210
  }
@@ -350460,9 +352224,9 @@ ${options2.prefix}` : "\n" : options2.prefix
350460
352224
  }
350461
352225
  };
350462
352226
  var GcTimer = class _GcTimer {
350463
- constructor(host, delay, logger) {
352227
+ constructor(host, delay2, logger) {
350464
352228
  this.host = host;
350465
- this.delay = delay;
352229
+ this.delay = delay2;
350466
352230
  this.logger = logger;
350467
352231
  }
350468
352232
  scheduleCollect() {
@@ -360811,12 +362575,12 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
360811
362575
  const project = this.projectService.tryGetDefaultProjectForFile(fileName);
360812
362576
  return project && { fileName, project };
360813
362577
  }
360814
- getDiagnostics(next, delay, fileArgs) {
362578
+ getDiagnostics(next, delay2, fileArgs) {
360815
362579
  if (this.suppressDiagnosticEvents) {
360816
362580
  return;
360817
362581
  }
360818
362582
  if (fileArgs.length > 0) {
360819
- this.updateErrorCheck(next, fileArgs, delay);
362583
+ this.updateErrorCheck(next, fileArgs, delay2);
360820
362584
  }
360821
362585
  }
360822
362586
  change(args) {
@@ -361216,7 +362980,7 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range
361216
362980
  const spans = languageService.getBraceMatchingAtPosition(file2, position);
361217
362981
  return !spans ? void 0 : simplifiedResult ? spans.map((span) => toProtocolTextSpan(span, scriptInfo)) : spans;
361218
362982
  }
361219
- getDiagnosticsForProject(next, delay, fileName) {
362983
+ getDiagnosticsForProject(next, delay2, fileName) {
361220
362984
  if (this.suppressDiagnosticEvents) {
361221
362985
  return;
361222
362986
  }
@@ -361261,7 +363025,7 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range
361261
363025
  this.updateErrorCheck(
361262
363026
  next,
361263
363027
  checkList,
361264
- delay,
363028
+ delay2,
361265
363029
  /*requireOpen*/
361266
363030
  false
361267
363031
  );
@@ -370418,7 +372182,7 @@ var require_load_source = __commonJS({
370418
372182
  });
370419
372183
 
370420
372184
  // ../../packages/workflow-code/dist/cli/state/lockfile.js
370421
- var require_lockfile = __commonJS({
372185
+ var require_lockfile2 = __commonJS({
370422
372186
  "../../packages/workflow-code/dist/cli/state/lockfile.js"(exports2) {
370423
372187
  "use strict";
370424
372188
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -370821,7 +372585,7 @@ var require_planning = __commonJS({
370821
372585
  exports2.planRemoteSnapshotWrite = planRemoteSnapshotWrite;
370822
372586
  exports2.planSyncResultWrite = planSyncResultWrite;
370823
372587
  var diagnostics_1 = require_diagnostics();
370824
- var lockfile_1 = require_lockfile();
372588
+ var lockfile_1 = require_lockfile2();
370825
372589
  function validateLockfileIdentity(lockfile, facts, path2 = "<lockfile>") {
370826
372590
  const mismatches = [];
370827
372591
  pushMismatch(mismatches, "targetName", lockfile.targetName, facts.targetName);
@@ -371149,7 +372913,7 @@ var require_state2 = __commonJS({
371149
372913
  for (var p3 in m3) if (p3 !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p3)) __createBinding(exports3, m3, p3);
371150
372914
  };
371151
372915
  Object.defineProperty(exports2, "__esModule", { value: true });
371152
- __exportStar(require_lockfile(), exports2);
372916
+ __exportStar(require_lockfile2(), exports2);
371153
372917
  __exportStar(require_planning(), exports2);
371154
372918
  __exportStar(require_types3(), exports2);
371155
372919
  __exportStar(require_write(), exports2);
@@ -380750,6 +382514,8 @@ var require_commit_message = __commonJS({
380750
382514
  "../../packages/agent/dist/commit-message.js"(exports2) {
380751
382515
  "use strict";
380752
382516
  Object.defineProperty(exports2, "__esModule", { value: true });
382517
+ exports2.normalizeClaudeCommitFallbackReason = normalizeClaudeCommitFallbackReason;
382518
+ exports2.getClaudeCommitFallbackReason = getClaudeCommitFallbackReason;
380753
382519
  exports2.isConventionalCommitMessage = isConventionalCommitMessage;
380754
382520
  exports2.normalizeConventionalCommitMessage = normalizeConventionalCommitMessage;
380755
382521
  exports2.generateCommitMessageWithClaude = generateCommitMessageWithClaude;
@@ -380757,6 +382523,40 @@ var require_commit_message = __commonJS({
380757
382523
  var node_path_1 = require("node:path");
380758
382524
  var process_1 = require_process();
380759
382525
  var conventionalCommitPattern = /^(?:build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(?:\([^)]+\))?!?:\s+\S/;
382526
+ var claudeCommitFallbackReasons = {
382527
+ unavailable: "Claude Code is not available. Set it up or review the fallback commit message.",
382528
+ empty: "Claude returned an empty commit message. Review the fallback message or retry.",
382529
+ unsupported: "Claude Code does not support the selected model. Update Claude Code, then retry.",
382530
+ authentication: "Claude authentication failed. Sign in to Claude Code, then retry.",
382531
+ limit: "Claude usage limit reached. Review the fallback message or retry after the limit resets.",
382532
+ timeout: "Claude took too long to generate a commit message. Review the fallback message or retry.",
382533
+ failed: "Claude could not generate the commit message. Review the fallback message or retry."
382534
+ };
382535
+ function normalizeClaudeCommitFallbackReason(reason) {
382536
+ if (Object.values(claudeCommitFallbackReasons).includes(reason))
382537
+ return reason;
382538
+ if (["Claude CLI is not available", "Claude unavailable"].includes(reason))
382539
+ return claudeCommitFallbackReasons.unavailable;
382540
+ if (/^Claude returned an empty commit message\.?$/.test(reason))
382541
+ return claudeCommitFallbackReasons.empty;
382542
+ return claudeCommitFallbackReasons.failed;
382543
+ }
382544
+ function getClaudeCommitFallbackReason(error48) {
382545
+ if (error48 instanceof process_1.CommandError) {
382546
+ const output = `${error48.result.stderr}
382547
+ ${error48.result.stdout}`;
382548
+ if (/does not support this model|unsupported model/i.test(output))
382549
+ return claudeCommitFallbackReasons.unsupported;
382550
+ if (/not logged in|authentication failed|invalid api key|login required/i.test(output))
382551
+ return claudeCommitFallbackReasons.authentication;
382552
+ if (/rate limit|usage limit|limit reached/i.test(output))
382553
+ return claudeCommitFallbackReasons.limit;
382554
+ if (/timed out/i.test(output))
382555
+ return claudeCommitFallbackReasons.timeout;
382556
+ return claudeCommitFallbackReasons.failed;
382557
+ }
382558
+ return normalizeClaudeCommitFallbackReason(error48 instanceof Error ? error48.message : "");
382559
+ }
380760
382560
  function firstNonEmptyLine(input) {
380761
382561
  return input.split(/\r?\n/).map((line) => line.trim()).find(Boolean) ?? "";
380762
382562
  }
@@ -380896,13 +382696,13 @@ var require_push = __commonJS({
380896
382696
  return {
380897
382697
  message: fallbackMessage,
380898
382698
  source: "fallback",
380899
- fallbackReason: error48 instanceof Error ? error48.message : String(error48)
382699
+ fallbackReason: (0, commit_message_1.getClaudeCommitFallbackReason)(error48)
380900
382700
  };
380901
382701
  }
380902
382702
  return {
380903
382703
  message: (0, commit_message_1.fallbackCommitMessageFromFiles)(files) || (0, git_1.buildFallbackCommitMessage)(files),
380904
382704
  source: "fallback",
380905
- fallbackReason: "Claude returned an empty commit message."
382705
+ fallbackReason: (0, commit_message_1.normalizeClaudeCommitFallbackReason)("Claude returned an empty commit message.")
380906
382706
  };
380907
382707
  }
380908
382708
  function isDetachedHeadError(error48) {
@@ -385527,18 +387327,60 @@ function writeError(io, message) {
385527
387327
  `);
385528
387328
  }
385529
387329
 
385530
- // src/commands/auth.ts
387330
+ // src/refresh-session.ts
385531
387331
  var import_node_child_process = require("node:child_process");
385532
- var import_promises3 = require("node:fs/promises");
387332
+ var import_promises = require("node:timers/promises");
387333
+ var import_node_util = require("node:util");
387334
+ var import_tela_local_config = __toESM(require_dist());
387335
+ async function refreshCliSession(resolved, original, credentials, options2 = {}) {
387336
+ if (!(0, import_tela_local_config.shouldRefreshUserSession)(original))
387337
+ return original;
387338
+ const ref = resolved.context.credentialRef;
387339
+ if ((options2.platform ?? process.platform) !== "darwin" || ref.provider !== "keychain")
387340
+ return await (0, import_tela_local_config.refreshUserSessionCredential)(resolved.environment, ref, original, credentials);
387341
+ await (options2.requestRefresh ?? renewThroughDock)(resolved.id);
387342
+ const credential = await credentials.get(ref);
387343
+ if (!credential || credential.kind !== "user-session" || !credential.accessToken || (0, import_tela_local_config.isExpired)(credential))
387344
+ throw new Error("Tela Dock did not save a valid session. Check the context in Dock and sign in again.");
387345
+ return credential;
387346
+ }
387347
+ async function renewThroughDock(contextId, dependencies = {}) {
387348
+ const available = dependencies.available ?? import_tela_local_config.isDockSessionBrokerAvailable;
387349
+ if (!await available()) {
387350
+ try {
387351
+ await (dependencies.launch ?? launchDock)();
387352
+ } catch {
387353
+ throw new import_tela_local_config.SessionBrokerUnavailableError();
387354
+ }
387355
+ let ready = false;
387356
+ for (let attempt = 0; attempt < 20; attempt++) {
387357
+ if (await available()) {
387358
+ ready = true;
387359
+ break;
387360
+ }
387361
+ await (dependencies.wait ?? (async () => await (0, import_promises.setTimeout)(250)))();
387362
+ }
387363
+ if (!ready)
387364
+ throw new import_tela_local_config.SessionBrokerUnavailableError();
387365
+ }
387366
+ await (dependencies.refresh ?? import_tela_local_config.requestDockSessionRefresh)(contextId);
387367
+ }
387368
+ async function launchDock() {
387369
+ await (0, import_node_util.promisify)(import_node_child_process.execFile)("/usr/bin/open", ["-g", "-b", "com.tela.dock"], { timeout: 5e3 });
387370
+ }
387371
+
387372
+ // src/commands/auth.ts
387373
+ var import_node_child_process2 = require("node:child_process");
387374
+ var import_promises4 = require("node:fs/promises");
385533
387375
  var import_node_os = require("node:os");
385534
387376
  var import_node_path2 = require("node:path");
385535
387377
  var import_node_process = __toESM(require("node:process"));
385536
- var import_tela_local_config2 = __toESM(require_dist());
387378
+ var import_tela_local_config3 = __toESM(require_dist());
385537
387379
 
385538
387380
  // src/credentials.ts
385539
- var import_tela_local_config = __toESM(require_dist());
387381
+ var import_tela_local_config2 = __toESM(require_dist());
385540
387382
  function createCliCredentialAdapter(env3 = process.env) {
385541
- return (0, import_tela_local_config.createLocalCredentialAdapter)(env3);
387383
+ return (0, import_tela_local_config2.createLocalCredentialAdapter)(env3);
385542
387384
  }
385543
387385
 
385544
387386
  // src/commands/auth.ts
@@ -385570,8 +387412,8 @@ async function authLogin(args, options2, io) {
385570
387412
  return 1;
385571
387413
  }
385572
387414
  try {
385573
- const config2 = await (0, import_tela_local_config2.loadConfig)();
385574
- const context = parsed.contextId ? (0, import_tela_local_config2.resolveContext)(config2, { contextId: parsed.contextId }) : null;
387415
+ const config2 = await (0, import_tela_local_config3.loadConfig)();
387416
+ const context = parsed.contextId ? (0, import_tela_local_config3.resolveContext)(config2, { contextId: parsed.contextId }) : null;
385575
387417
  const environmentId = context?.context.environmentId ?? parsed.environmentId ?? "production";
385576
387418
  const environment = config2.environments[environmentId];
385577
387419
  if (!environment)
@@ -385584,7 +387426,7 @@ async function authLogin(args, options2, io) {
385584
387426
  );
385585
387427
  }
385586
387428
  const { DeviceFlow: DeviceFlow2 } = await Promise.resolve().then(() => (init_dist3(), dist_exports));
385587
- const storage = (0, import_tela_local_config2.createTelaTokenStorage)();
387429
+ const storage = (0, import_tela_local_config3.createTelaTokenStorage)();
385588
387430
  const flowOptions = {
385589
387431
  apiUrl: parsed.authUrl ?? environment.authApiUrl,
385590
387432
  requesterApplicationId,
@@ -385669,8 +387511,8 @@ async function authLogout(args, options2, io) {
385669
387511
  return 1;
385670
387512
  }
385671
387513
  try {
385672
- const config2 = await (0, import_tela_local_config2.loadConfig)();
385673
- const targets = all3 ? Object.entries(config2.contexts) : [[(0, import_tela_local_config2.resolveContext)(config2, { contextId }).id, (0, import_tela_local_config2.resolveContext)(config2, { contextId }).context]];
387514
+ const config2 = await (0, import_tela_local_config3.loadConfig)();
387515
+ const targets = all3 ? Object.entries(config2.contexts) : [[(0, import_tela_local_config3.resolveContext)(config2, { contextId }).id, (0, import_tela_local_config3.resolveContext)(config2, { contextId }).context]];
385674
387516
  const credentials = createCliCredentialAdapter();
385675
387517
  for (const [, context] of targets)
385676
387518
  await credentials.delete(context.credentialRef);
@@ -385690,8 +387532,8 @@ async function authWhoami(args, options2, io) {
385690
387532
  return 1;
385691
387533
  }
385692
387534
  try {
385693
- const config2 = await (0, import_tela_local_config2.loadConfig)();
385694
- const resolved = (0, import_tela_local_config2.resolveContext)(config2, selector);
387535
+ const config2 = await (0, import_tela_local_config3.loadConfig)();
387536
+ const resolved = (0, import_tela_local_config3.resolveContext)(config2, selector);
385695
387537
  const credential = await createCliCredentialAdapter().get(resolved.context.credentialRef);
385696
387538
  if (!credential)
385697
387539
  throw new Error(`Missing credential for Tela context ${resolved.id}`);
@@ -385718,8 +387560,8 @@ async function authWhoami(args, options2, io) {
385718
387560
  }
385719
387561
  }
385720
387562
  async function authTokenList(options2, io) {
385721
- const config2 = await (0, import_tela_local_config2.loadConfig)();
385722
- const publicConfig = await (0, import_tela_local_config2.toPublicConfig)(config2, createCliCredentialAdapter());
387563
+ const config2 = await (0, import_tela_local_config3.loadConfig)();
387564
+ const publicConfig = await (0, import_tela_local_config3.toPublicConfig)(config2, createCliCredentialAdapter());
385723
387565
  const tokens = Object.values(publicConfig.contexts).map((context) => ({
385724
387566
  contextId: context.id,
385725
387567
  environmentId: context.environmentId,
@@ -385742,7 +387584,7 @@ async function authTokenList(options2, io) {
385742
387584
  async function discoverLegacyTelactlCredentials() {
385743
387585
  const root = (0, import_node_path2.join)((0, import_node_os.homedir)(), ".telactl");
385744
387586
  try {
385745
- const names = await (0, import_promises3.readdir)(root);
387587
+ const names = await (0, import_promises4.readdir)(root);
385746
387588
  return names.filter((name) => name.startsWith("credentials.") && name.endsWith(".json")).map((name) => ({
385747
387589
  environmentId: name.slice("credentials.".length, -".json".length),
385748
387590
  path: (0, import_node_path2.join)(root, name)
@@ -385796,8 +387638,8 @@ async function authToken(args, options2, io) {
385796
387638
  }
385797
387639
  }
385798
387640
  async function resolveToken(options2) {
385799
- const config2 = await (0, import_tela_local_config2.loadConfig)();
385800
- const resolved = (0, import_tela_local_config2.resolveContext)(config2, {
387641
+ const config2 = await (0, import_tela_local_config3.loadConfig)();
387642
+ const resolved = (0, import_tela_local_config3.resolveContext)(config2, {
385801
387643
  contextId: options2.contextId,
385802
387644
  environmentId: options2.environmentId
385803
387645
  });
@@ -385807,7 +387649,7 @@ async function resolveToken(options2) {
385807
387649
  if (!originalCredential) {
385808
387650
  throw new Error(`Missing credential for Tela context ${resolved.id}`);
385809
387651
  }
385810
- const credential = originalCredential.kind === "user-session" ? await (0, import_tela_local_config2.refreshUserSessionCredential)(resolved.environment, credentialRef, originalCredential, credentials) : originalCredential;
387652
+ const credential = originalCredential.kind === "user-session" ? await refreshCliSession(resolved, originalCredential, credentials) : originalCredential;
385811
387653
  const refreshed = credential !== originalCredential;
385812
387654
  if (options2.kind === "access-token") {
385813
387655
  if (credential.kind !== "user-session" || !credential.accessToken) {
@@ -385953,7 +387795,7 @@ function formatDeviceFlowInstructions(input) {
385953
387795
  function openExternal(url3) {
385954
387796
  const command = import_node_process.default.platform === "darwin" ? "open" : import_node_process.default.platform === "win32" ? "rundll32" : "xdg-open";
385955
387797
  const args = import_node_process.default.platform === "win32" ? ["url.dll,FileProtocolHandler", url3] : [url3];
385956
- const child = (0, import_node_child_process.spawn)(command, args, { detached: true, stdio: "ignore" });
387798
+ const child = (0, import_node_child_process2.spawn)(command, args, { detached: true, stdio: "ignore" });
385957
387799
  child.unref();
385958
387800
  }
385959
387801
  function resolveSafeVerificationUrl(rawUrl, { allowLoopbackHttp = false } = {}) {
@@ -385996,7 +387838,7 @@ function writeAuthHelp(io) {
385996
387838
  }
385997
387839
 
385998
387840
  // src/commands/context.ts
385999
- var import_tela_local_config3 = __toESM(require_dist());
387841
+ var import_tela_local_config4 = __toESM(require_dist());
386000
387842
  async function runContextCommand(args, options2, io) {
386001
387843
  const [action, ...rest] = args;
386002
387844
  if (!action || action === "help" || action === "--help" || action === "-h") {
@@ -386015,7 +387857,7 @@ async function runContextCommand(args, options2, io) {
386015
387857
  return 1;
386016
387858
  }
386017
387859
  async function currentContext(options2, io) {
386018
- const config2 = await (0, import_tela_local_config3.loadConfig)();
387860
+ const config2 = await (0, import_tela_local_config4.loadConfig)();
386019
387861
  const credentials = createCliCredentialAdapter();
386020
387862
  const activeContextId = config2.activeContextId;
386021
387863
  const activeContext = activeContextId ? config2.contexts[activeContextId] : void 0;
@@ -386025,7 +387867,7 @@ async function currentContext(options2, io) {
386025
387867
  else writeLine(io, "No active Tela context.");
386026
387868
  return 0;
386027
387869
  }
386028
- const summary = await (0, import_tela_local_config3.toContextSummary)(activeContextId, activeContext, config2, credentials);
387870
+ const summary = await (0, import_tela_local_config4.toContextSummary)(activeContextId, activeContext, config2, credentials);
386029
387871
  if (options2.json) {
386030
387872
  writeJson(io, { activeContext: summary });
386031
387873
  return 0;
@@ -386034,9 +387876,9 @@ async function currentContext(options2, io) {
386034
387876
  return 0;
386035
387877
  }
386036
387878
  async function listContexts(options2, io) {
386037
- const config2 = await (0, import_tela_local_config3.loadConfig)();
387879
+ const config2 = await (0, import_tela_local_config4.loadConfig)();
386038
387880
  const credentials = createCliCredentialAdapter();
386039
- const publicConfig = await (0, import_tela_local_config3.toPublicConfig)(config2, credentials);
387881
+ const publicConfig = await (0, import_tela_local_config4.toPublicConfig)(config2, credentials);
386040
387882
  const contexts = Object.values(publicConfig.contexts);
386041
387883
  if (options2.json) {
386042
387884
  writeJson(io, { contexts });
@@ -386059,13 +387901,13 @@ async function showContext(contextId, options2, io) {
386059
387901
  writeError(io, "Usage: tela context show <context-id>");
386060
387902
  return 1;
386061
387903
  }
386062
- const config2 = await (0, import_tela_local_config3.loadConfig)();
387904
+ const config2 = await (0, import_tela_local_config4.loadConfig)();
386063
387905
  const context = config2.contexts[contextId];
386064
387906
  if (!context) {
386065
387907
  writeError(io, `Unknown Tela context: ${contextId}`);
386066
387908
  return 1;
386067
387909
  }
386068
- const summary = await (0, import_tela_local_config3.toContextSummary)(contextId, context, config2, createCliCredentialAdapter());
387910
+ const summary = await (0, import_tela_local_config4.toContextSummary)(contextId, context, config2, createCliCredentialAdapter());
386069
387911
  if (options2.json) {
386070
387912
  writeJson(io, { context: summary });
386071
387913
  return 0;
@@ -386078,11 +387920,11 @@ async function useContext(contextId, options2, io) {
386078
387920
  writeError(io, "Usage: tela context use <context-id>");
386079
387921
  return 1;
386080
387922
  }
386081
- const config2 = await (0, import_tela_local_config3.updateConfig)((current) => (0, import_tela_local_config3.setActiveContext)(current, contextId));
387923
+ const config2 = await (0, import_tela_local_config4.updateConfig)((current) => (0, import_tela_local_config4.setActiveContext)(current, contextId));
386082
387924
  const context = config2.contexts[contextId];
386083
387925
  if (!context)
386084
387926
  throw new Error(`Unknown context: ${contextId}`);
386085
- const summary = await (0, import_tela_local_config3.toContextSummary)(contextId, context, config2, createCliCredentialAdapter());
387927
+ const summary = await (0, import_tela_local_config4.toContextSummary)(contextId, context, config2, createCliCredentialAdapter());
386086
387928
  if (options2.json) {
386087
387929
  writeJson(io, { activeContext: summary });
386088
387930
  return 0;
@@ -386110,7 +387952,7 @@ function writeContextHelp(io) {
386110
387952
  }
386111
387953
 
386112
387954
  // src/commands/doctor-auth.ts
386113
- var import_tela_local_config4 = __toESM(require_dist());
387955
+ var import_tela_local_config5 = __toESM(require_dist());
386114
387956
  async function runDoctorCommand(args, options2, io) {
386115
387957
  const [action] = args;
386116
387958
  if (!action || action === "help" || action === "--help" || action === "-h") {
@@ -386123,8 +387965,8 @@ async function runDoctorCommand(args, options2, io) {
386123
387965
  return 1;
386124
387966
  }
386125
387967
  async function doctorAuth(options2, io) {
386126
- const config2 = await (0, import_tela_local_config4.loadConfig)();
386127
- const publicConfig = await (0, import_tela_local_config4.toPublicConfig)(config2, createCliCredentialAdapter());
387968
+ const config2 = await (0, import_tela_local_config5.loadConfig)();
387969
+ const publicConfig = await (0, import_tela_local_config5.toPublicConfig)(config2, createCliCredentialAdapter());
386128
387970
  const contexts = Object.values(publicConfig.contexts);
386129
387971
  const ok = contexts.every((context) => context.credential.ok);
386130
387972
  if (options2.json) {
@@ -386146,11 +387988,11 @@ function writeDoctorHelp(io) {
386146
387988
  }
386147
387989
 
386148
387990
  // src/commands/env.ts
386149
- var import_tela_local_config7 = __toESM(require_dist());
387991
+ var import_tela_local_config8 = __toESM(require_dist());
386150
387992
 
386151
387993
  // src/commands/ingredients.ts
386152
387994
  var import_node_buffer = require("node:buffer");
386153
- var import_tela_local_config6 = __toESM(require_dist());
387995
+ var import_tela_local_config7 = __toESM(require_dist());
386154
387996
  var import_tela_pantry2 = __toESM(require_dist2());
386155
387997
 
386156
387998
  // src/markdown.ts
@@ -386219,7 +388061,7 @@ function terminalWidth(target) {
386219
388061
  }
386220
388062
 
386221
388063
  // src/session.ts
386222
- var import_tela_local_config5 = __toESM(require_dist());
388064
+ var import_tela_local_config6 = __toESM(require_dist());
386223
388065
  var import_tela_pantry = __toESM(require_dist2());
386224
388066
  var ENV_ACCESS_TOKEN_REF = {
386225
388067
  provider: "env",
@@ -386228,15 +388070,15 @@ var ENV_ACCESS_TOKEN_REF = {
386228
388070
  kind: "user-session"
386229
388071
  };
386230
388072
  async function loadPantry(flags) {
386231
- const config2 = await (0, import_tela_local_config5.loadConfig)();
386232
- const resolved = (0, import_tela_local_config5.resolveContext)(config2, {
388073
+ const config2 = await (0, import_tela_local_config6.loadConfig)();
388074
+ const resolved = (0, import_tela_local_config6.resolveContext)(config2, {
386233
388075
  contextId: flags.contextId,
386234
388076
  environmentId: flags.environmentId
386235
388077
  });
386236
388078
  return await loadPantryForContext(resolved, config2);
386237
388079
  }
386238
388080
  async function loadPantryForContext(resolved, config2) {
386239
- const loadedConfig = config2 ?? await (0, import_tela_local_config5.loadConfig)();
388081
+ const loadedConfig = config2 ?? await (0, import_tela_local_config6.loadConfig)();
386240
388082
  const baseUrl = resolvePantryBaseUrl(resolved);
386241
388083
  const credential = await loadPantryCredential(loadedConfig, resolved);
386242
388084
  return { client: (0, import_tela_pantry.createPantryClient)(baseUrl, credential), baseUrl };
@@ -386248,7 +388090,8 @@ async function loadPantryCredential(config2, selected) {
386248
388090
  const originalCredential = await credentials.get(candidate.credentialRef);
386249
388091
  if (!originalCredential)
386250
388092
  continue;
386251
- const credential = originalCredential.kind === "user-session" ? await (0, import_tela_local_config5.refreshUserSessionCredential)(candidate.resolved.environment, candidate.credentialRef, originalCredential, credentials) : originalCredential;
388093
+ const sessionContext = { ...candidate.resolved, context: { ...candidate.resolved.context, credentialRef: candidate.credentialRef } };
388094
+ const credential = originalCredential.kind === "user-session" ? await refreshCliSession(sessionContext, originalCredential, credentials) : originalCredential;
386252
388095
  if (credential.accessToken)
386253
388096
  return credential;
386254
388097
  }
@@ -386289,14 +388132,14 @@ function pantryCredentialCandidates(config2, selected) {
386289
388132
  return candidates;
386290
388133
  }
386291
388134
  async function loadSession(contextId, environmentId) {
386292
- const config2 = await (0, import_tela_local_config5.loadConfig)();
386293
- const resolved = (0, import_tela_local_config5.resolveContext)(config2, { contextId, environmentId });
388135
+ const config2 = await (0, import_tela_local_config6.loadConfig)();
388136
+ const resolved = (0, import_tela_local_config6.resolveContext)(config2, { contextId, environmentId });
386294
388137
  const credentials = createCliCredentialAdapter();
386295
388138
  const credentialRef = resolved.context.credentialRef;
386296
388139
  const originalCredential = await credentials.get(credentialRef);
386297
388140
  if (!originalCredential)
386298
388141
  throw new Error(`Missing credential for Tela context ${resolved.id}`);
386299
- const credential = originalCredential.kind === "user-session" ? await (0, import_tela_local_config5.refreshUserSessionCredential)(resolved.environment, credentialRef, originalCredential, credentials) : originalCredential;
388142
+ const credential = originalCredential.kind === "user-session" ? await refreshCliSession(resolved, originalCredential, credentials) : originalCredential;
386300
388143
  return {
386301
388144
  resolved,
386302
388145
  credentialRef,
@@ -386428,7 +388271,7 @@ async function callIngredientApi(args, _options, io) {
386428
388271
  const targetSession = await loadSession(flags.contextId, flags.environmentId);
386429
388272
  const { client, baseUrl } = await loadPantryForContext(targetSession.resolved);
386430
388273
  const ingredient = (0, import_tela_pantry2.assertIngredientType)(await (0, import_tela_pantry2.fetchServiceIngredient)(client, slug, baseUrl), "api");
386431
- const { inventory } = await (0, import_tela_local_config6.loadInventory)((0, import_tela_local_config6.getTelaLocalPaths)().inventoryFile);
388274
+ const { inventory } = await (0, import_tela_local_config7.loadInventory)((0, import_tela_local_config7.getTelaLocalPaths)().inventoryFile);
386432
388275
  const environment = (0, import_tela_pantry2.resolveServiceEnvironment)(
386433
388276
  ingredient,
386434
388277
  inventory.services.environmentDefaults,
@@ -386609,7 +388452,7 @@ async function setServiceEnvironment(args, io) {
386609
388452
  const available = ingredient.environments.map((candidate) => candidate.slug).join(", ") || "(none)";
386610
388453
  return usageError(`Environment '${environment}' not found for '${slug}'. Available: ${available}`, io);
386611
388454
  }
386612
- await (0, import_tela_local_config6.updateInventory)((inventory) => {
388455
+ await (0, import_tela_local_config7.updateInventory)((inventory) => {
386613
388456
  inventory.services.environmentDefaults[slug] = environment;
386614
388457
  });
386615
388458
  writeLine(io, `Set default environment for '${slug}' to '${environment}'`);
@@ -386786,8 +388629,8 @@ async function runEnvCommand(args, options2, io) {
386786
388629
  return 1;
386787
388630
  }
386788
388631
  async function listEnvironments(options2, io) {
386789
- const config2 = await (0, import_tela_local_config7.loadConfig)();
386790
- const publicConfig = await (0, import_tela_local_config7.toPublicConfig)(config2, createCliCredentialAdapter());
388632
+ const config2 = await (0, import_tela_local_config8.loadConfig)();
388633
+ const publicConfig = await (0, import_tela_local_config8.toPublicConfig)(config2, createCliCredentialAdapter());
386791
388634
  const environments = Object.values(publicConfig.environments);
386792
388635
  if (options2.json) {
386793
388636
  writeJson(io, { environments });
@@ -386807,7 +388650,7 @@ function writeEnvHelp(io) {
386807
388650
 
386808
388651
  // src/commands/skills.ts
386809
388652
  var import_tela_pantry3 = __toESM(require_dist2());
386810
- var import_tela_local_config8 = __toESM(require_dist());
388653
+ var import_tela_local_config9 = __toESM(require_dist());
386811
388654
  async function runSkillsCommand(args, options2, io) {
386812
388655
  const [command, ...rest] = args;
386813
388656
  if (!command || command === "help" || command === "--help" || command === "-h") {
@@ -386858,7 +388701,7 @@ async function writeCatalog(flags, options2, io, filters) {
386858
388701
  const { client } = await loadPantry(flags);
386859
388702
  const [skills, installed] = await Promise.all([
386860
388703
  (0, import_tela_pantry3.fetchSkillCatalog)(client, filters),
386861
- (0, import_tela_local_config8.listInstalledSkills)()
388704
+ (0, import_tela_local_config9.listInstalledSkills)()
386862
388705
  ]);
386863
388706
  const entries = annotateInstalled(skills, installed);
386864
388707
  if (options2.json) {