@usecontextlayer/ctxb 0.5.27 → 0.5.29

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.
@@ -1,8 +1,8 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="348dd40c-5dd4-5636-97be-d4f14b1f8aa4")}catch(e){}}();
3
- import g$1, { stdin, stdout } from "node:process";
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="9e9df825-86bd-510d-bd9a-34d2071402b1")}catch(e){}}();
3
+ import process$1, { stdin, stdout } from "node:process";
4
4
  import { WriteStream } from "node:tty";
5
- import f from "node:readline";
5
+ import l__default from "node:readline";
6
6
 
7
7
  //#region ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/chunks/prompt.mjs
8
8
  function getDefaultExportFromCjs(x) {
@@ -207,7 +207,11 @@ function A$1(t, u = {}) {
207
207
  }
208
208
  return e;
209
209
  }
210
- const m = 10, L$1 = (t = 0) => (u) => `\x1B[${u + t}m`, N = (t = 0) => (u) => `\x1B[${38 + t};5;${u}m`, I = (t = 0) => (u, F, e) => `\x1B[${38 + t};2;${u};${F};${e}m`, r = {
210
+ const m = 10;
211
+ const L$1 = (t = 0) => (u) => `\x1B[${u + t}m`;
212
+ const N = (t = 0) => (u) => `\x1B[${38 + t};5;${u}m`;
213
+ const I = (t = 0) => (u, F, e) => `\x1B[${38 + t};2;${u};${F};${e}m`;
214
+ const r = {
211
215
  modifier: {
212
216
  reset: [0, 0],
213
217
  bold: [1, 22],
@@ -261,7 +265,8 @@ const m = 10, L$1 = (t = 0) => (u) => `\x1B[${u + t}m`, N = (t = 0) => (u) => `\
261
265
  }
262
266
  };
263
267
  Object.keys(r.modifier);
264
- const tD = Object.keys(r.color), eD = Object.keys(r.bgColor);
268
+ const tD = Object.keys(r.color);
269
+ const eD = Object.keys(r.bgColor);
265
270
  [...tD, ...eD];
266
271
  function sD() {
267
272
  const t = /* @__PURE__ */ new Map();
@@ -334,7 +339,18 @@ function sD() {
334
339
  }
335
340
  }), r;
336
341
  }
337
- const iD = sD(), v = new Set(["\x1B", "›"]), CD = 39, w$1 = "\x07", W$1 = "[", rD = "]", R = "m", y = `${rD}8;;`, V$1 = (t) => `${v.values().next().value}${W$1}${t}${R}`, z = (t) => `${v.values().next().value}${y}${t}${w$1}`, ED = (t) => t.split(" ").map((u) => A$1(u)), _ = (t, u, F) => {
342
+ const iD = sD();
343
+ const v = /* @__PURE__ */ new Set(["\x1B", "›"]);
344
+ const CD = 39;
345
+ const w$1 = "\x07";
346
+ const W$1 = "[";
347
+ const rD = "]";
348
+ const R = "m";
349
+ const y = `${rD}8;;`;
350
+ const V$1 = (t) => `${v.values().next().value}${W$1}${t}${R}`;
351
+ const z = (t) => `${v.values().next().value}${y}${t}${w$1}`;
352
+ const ED = (t) => t.split(" ").map((u) => A$1(u));
353
+ const _ = (t, u, F) => {
338
354
  const e = [...u];
339
355
  let s = false, i = false, D = A$1(T$1(t[t.length - 1]));
340
356
  for (const [C, o] of e.entries()) {
@@ -346,12 +362,14 @@ const iD = sD(), v = new Set(["\x1B", "›"]), CD = 39, w$1 = "\x07", W$1 = "[",
346
362
  D += E, D === F && C < e.length - 1 && (t.push(""), D = 0);
347
363
  }
348
364
  !D && t[t.length - 1].length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
349
- }, nD = (t) => {
365
+ };
366
+ const nD = (t) => {
350
367
  const u = t.split(" ");
351
368
  let F = u.length;
352
369
  for (; F > 0 && !(A$1(u[F - 1]) > 0);) F--;
353
370
  return F === u.length ? t : u.slice(0, F).join(" ") + u.slice(F).join("");
354
- }, oD = (t, u, F = {}) => {
371
+ };
372
+ const oD = (t, u, F = {}) => {
355
373
  if (F.trim !== false && t.trim() === "") return "";
356
374
  let e = "", s, i;
357
375
  const D = ED(t);
@@ -402,7 +420,7 @@ function G(t, u, F) {
402
420
  `);
403
421
  }
404
422
  const c = {
405
- actions: new Set([
423
+ actions: /* @__PURE__ */ new Set([
406
424
  "up",
407
425
  "down",
408
426
  "left",
@@ -411,7 +429,7 @@ const c = {
411
429
  "enter",
412
430
  "cancel"
413
431
  ]),
414
- aliases: new Map([
432
+ aliases: /* @__PURE__ */ new Map([
415
433
  ["k", "up"],
416
434
  ["j", "down"],
417
435
  ["h", "left"],
@@ -439,12 +457,14 @@ function d$1(t, u) {
439
457
  const F = t;
440
458
  F.isTTY && F.setRawMode(u);
441
459
  }
442
- var AD = Object.defineProperty, pD = (t, u, F) => u in t ? AD(t, u, {
460
+ var AD = Object.defineProperty;
461
+ var pD = (t, u, F) => u in t ? AD(t, u, {
443
462
  enumerable: true,
444
463
  configurable: true,
445
464
  writable: true,
446
465
  value: F
447
- }) : t[u] = F, h = (t, u, F) => (pD(t, typeof u != "symbol" ? u + "" : u, F), F);
466
+ }) : t[u] = F;
467
+ var h = (t, u, F) => (pD(t, typeof u != "symbol" ? u + "" : u, F), F);
448
468
  var x = class {
449
469
  constructor(u, F = true) {
450
470
  h(this, "input"), h(this, "output"), h(this, "_abortSignal"), h(this, "rl"), h(this, "opts"), h(this, "_render"), h(this, "_track", false), h(this, "_prevFrame", ""), h(this, "_subscribers", /* @__PURE__ */ new Map()), h(this, "_cursor", 0), h(this, "state", "initial"), h(this, "error", ""), h(this, "value");
@@ -483,13 +503,13 @@ var x = class {
483
503
  const e = new WriteStream(0);
484
504
  e._write = (s, i, D) => {
485
505
  this._track && (this.value = this.rl?.line.replace(/\t/g, ""), this._cursor = this.rl?.cursor ?? 0, this.emit("value", this.value)), D();
486
- }, this.input.pipe(e), this.rl = f.createInterface({
506
+ }, this.input.pipe(e), this.rl = l__default.createInterface({
487
507
  input: this.input,
488
508
  output: e,
489
509
  tabSize: 2,
490
510
  prompt: "",
491
511
  escapeCodeTimeout: 50
492
- }), f.emitKeypressEvents(this.input, this.rl), this.rl.prompt(), this.opts.initialValue !== void 0 && this._track && this.rl.write(this.opts.initialValue), this.input.on("keypress", this.onKeypress), d$1(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
512
+ }), l__default.emitKeypressEvents(this.input, this.rl), this.rl.prompt(), this.opts.initialValue !== void 0 && this._track && this.rl.write(this.opts.initialValue), this.input.on("keypress", this.onKeypress), d$1(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
493
513
  this.output.write(srcExports.cursor.show), this.output.off("resize", this.render), d$1(this.input, false), u(this.value);
494
514
  }), this.once("cancel", () => {
495
515
  this.output.write(srcExports.cursor.show), this.output.off("resize", this.render), d$1(this.input, false), u(S);
@@ -565,12 +585,14 @@ var fD = class extends x {
565
585
  });
566
586
  }
567
587
  };
568
- var bD = Object.defineProperty, mD = (t, u, F) => u in t ? bD(t, u, {
588
+ var bD = Object.defineProperty;
589
+ var mD = (t, u, F) => u in t ? bD(t, u, {
569
590
  enumerable: true,
570
591
  configurable: true,
571
592
  writable: true,
572
593
  value: F
573
- }) : t[u] = F, Y = (t, u, F) => (mD(t, typeof u != "symbol" ? u + "" : u, F), F);
594
+ }) : t[u] = F;
595
+ var Y = (t, u, F) => (mD(t, typeof u != "symbol" ? u + "" : u, F), F);
574
596
  let wD = class extends x {
575
597
  constructor(u) {
576
598
  super(u, false), Y(this, "options"), Y(this, "cursor", 0), this.options = u.options, this.value = [...u.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: F }) => F === u.cursorAt), 0), this.on("key", (F) => {
@@ -585,9 +607,7 @@ let wD = class extends x {
585
607
  case "right":
586
608
  this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
587
609
  break;
588
- case "space":
589
- this.toggleValue();
590
- break;
610
+ case "space": this.toggleValue();
591
611
  }
592
612
  });
593
613
  }
@@ -603,12 +623,14 @@ let wD = class extends x {
603
623
  this.value = u ? this.value.filter((F) => F !== this._value) : [...this.value, this._value];
604
624
  }
605
625
  };
606
- var SD = Object.defineProperty, $D = (t, u, F) => u in t ? SD(t, u, {
626
+ var SD = Object.defineProperty;
627
+ var $D = (t, u, F) => u in t ? SD(t, u, {
607
628
  enumerable: true,
608
629
  configurable: true,
609
630
  writable: true,
610
631
  value: F
611
- }) : t[u] = F, q = (t, u, F) => ($D(t, typeof u != "symbol" ? u + "" : u, F), F);
632
+ }) : t[u] = F;
633
+ var q = (t, u, F) => ($D(t, typeof u != "symbol" ? u + "" : u, F), F);
612
634
  var jD = class extends x {
613
635
  constructor(u) {
614
636
  super(u, false), q(this, "options"), q(this, "cursor", 0), this.options = u.options, this.cursor = this.options.findIndex(({ value: F }) => F === u.initialValue), this.cursor === -1 && (this.cursor = 0), this.changeValue(), this.on("cursor", (F) => {
@@ -618,9 +640,7 @@ var jD = class extends x {
618
640
  this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
619
641
  break;
620
642
  case "down":
621
- case "right":
622
- this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
623
- break;
643
+ case "right": this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
624
644
  }
625
645
  this.changeValue();
626
646
  });
@@ -649,9 +669,22 @@ var PD = class extends x {
649
669
  }
650
670
  };
651
671
  function ce() {
652
- return g$1.platform !== "win32" ? g$1.env.TERM !== "linux" : !!g$1.env.CI || !!g$1.env.WT_SESSION || !!g$1.env.TERMINUS_SUBLIME || g$1.env.ConEmuTask === "{cmd::Cmder}" || g$1.env.TERM_PROGRAM === "Terminus-Sublime" || g$1.env.TERM_PROGRAM === "vscode" || g$1.env.TERM === "xterm-256color" || g$1.env.TERM === "alacritty" || g$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
672
+ return process$1.platform !== "win32" ? process$1.env.TERM !== "linux" : !!process$1.env.CI || !!process$1.env.WT_SESSION || !!process$1.env.TERMINUS_SUBLIME || process$1.env.ConEmuTask === "{cmd::Cmder}" || process$1.env.TERM_PROGRAM === "Terminus-Sublime" || process$1.env.TERM_PROGRAM === "vscode" || process$1.env.TERM === "xterm-256color" || process$1.env.TERM === "alacritty" || process$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
653
673
  }
654
- const V = ce(), u = (t, n) => V ? t : n, le = u("❯", ">"), L = u("■", "x"), W = u("▲", "x"), C = u("✔", "√"), o = u(""), d = u(""), k = u("●", ">"), P = u("○", " "), A = u("◻", "[•]"), T = u("◼", "[+]"), F = u("◻", "[ ]"), w = (t) => {
674
+ const V = ce();
675
+ const u = (t, n) => V ? t : n;
676
+ const le = u("❯", ">");
677
+ const L = u("■", "x");
678
+ const W = u("▲", "x");
679
+ const C = u("✔", "√");
680
+ const o = u("");
681
+ const d = u("");
682
+ const k = u("●", ">");
683
+ const P = u("○", " ");
684
+ const A = u("◻", "[•]");
685
+ const T = u("◼", "[+]");
686
+ const F = u("◻", "[ ]");
687
+ const w = (t) => {
655
688
  switch (t) {
656
689
  case "initial":
657
690
  case "active": return e.cyan(le);
@@ -659,7 +692,8 @@ const V = ce(), u = (t, n) => V ? t : n, le = u("❯", ">"), L = u("■", "x"),
659
692
  case "error": return e.yellow(W);
660
693
  case "submit": return e.green(C);
661
694
  }
662
- }, B = (t) => {
695
+ };
696
+ const B = (t) => {
663
697
  const { cursor: n, options: s, style: r } = t, i = t.maxItems ?? Number.POSITIVE_INFINITY, a = Math.max(process.stdout.rows - 4, 0), c = Math.min(a, Math.max(i, 5));
664
698
  let l = 0;
665
699
  n >= l + c - 3 ? l = Math.max(Math.min(n - c + 3, s.length - c), 0) : n < l + 2 && (l = Math.max(n - 2, 0));
@@ -668,7 +702,8 @@ const V = ce(), u = (t, n) => V ? t : n, le = u("❯", ">"), L = u("■", "x"),
668
702
  const j = v === 0 && $, E = v === x.length - 1 && p;
669
703
  return j || E ? e.dim("...") : r(M, v + l === n);
670
704
  });
671
- }, he = (t) => new PD({
705
+ };
706
+ const he = (t) => new PD({
672
707
  validate: t.validate,
673
708
  placeholder: t.placeholder,
674
709
  defaultValue: t.defaultValue,
@@ -690,7 +725,8 @@ ${e.cyan(d)}
690
725
  `;
691
726
  }
692
727
  }
693
- }).prompt(), ye = (t) => {
728
+ }).prompt();
729
+ const ye = (t) => {
694
730
  const n = t.active ?? "Yes", s = t.inactive ?? "No";
695
731
  return new fD({
696
732
  active: n,
@@ -710,7 +746,8 @@ ${e.cyan(d)}
710
746
  }
711
747
  }
712
748
  }).prompt();
713
- }, ve = (t) => {
749
+ };
750
+ const ve = (t) => {
714
751
  const n = (s, r) => {
715
752
  const i = s.label ?? String(s.value);
716
753
  switch (r) {
@@ -743,7 +780,8 @@ ${e.cyan(d)}
743
780
  }
744
781
  }
745
782
  }).prompt();
746
- }, fe = (t) => {
783
+ };
784
+ const fe = (t) => {
747
785
  const n = (s, r) => {
748
786
  const i = s.label ?? String(s.value);
749
787
  return r === "active" ? `${e.cyan(A)} ${i} ${s.hint ? e.dim(`(${s.hint})`) : ""}` : r === "selected" ? `${e.green(T)} ${e.dim(i)}` : r === "cancelled" ? `${e.strikethrough(e.dim(i))}` : r === "active-selected" ? `${e.green(T)} ${i} ${s.hint ? e.dim(`(${s.hint})`) : ""}` : r === "submitted" ? `${e.dim(i)}` : `${e.dim(F)} ${e.dim(i)}`;
@@ -849,5 +887,5 @@ async function prompt(message, opts = {}) {
849
887
 
850
888
  //#endregion
851
889
  export { prompt };
852
- //# sourceMappingURL=prompt-CHIvwqcZ.mjs.map
853
- //# debugId=348dd40c-5dd4-5636-97be-d4f14b1f8aa4
890
+ //# sourceMappingURL=prompt-BWUCluoW.mjs.map
891
+ //# debugId=9e9df825-86bd-510d-bd9a-34d2071402b1