@profullstack/threatcrush 0.13.14 → 0.13.16

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
@@ -5328,7 +5328,7 @@ var require_toml = __commonJS({
5328
5328
  }
5329
5329
  });
5330
5330
 
5331
- // ../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/color.js
5331
+ // ../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/color.js
5332
5332
  function rgb(r, g, b) {
5333
5333
  return RGB_FLAG | (r & 255) << 16 | (g & 255) << 8 | b & 255;
5334
5334
  }
@@ -5439,7 +5439,7 @@ function grayscale(c) {
5439
5439
  }
5440
5440
  var DEFAULT_COLOR, RGB_FLAG, IDX_FLAG, CUBE, BASE16;
5441
5441
  var init_color = __esm({
5442
- "../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/color.js"() {
5442
+ "../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/color.js"() {
5443
5443
  "use strict";
5444
5444
  DEFAULT_COLOR = 0;
5445
5445
  RGB_FLAG = 16777216;
@@ -5466,7 +5466,7 @@ var init_color = __esm({
5466
5466
  }
5467
5467
  });
5468
5468
 
5469
- // ../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/unicode.js
5469
+ // ../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/unicode.js
5470
5470
  function isLoneSurrogate(cp) {
5471
5471
  return cp >= 55296 && cp <= 57343;
5472
5472
  }
@@ -5491,6 +5491,8 @@ function internCluster(text) {
5491
5491
  return existing;
5492
5492
  if (clusters.length >= MAX_CLUSTERS) {
5493
5493
  const first = safe.codePointAt(0) ?? 32;
5494
+ if (clusterWidth(safe) === 2 && charWidth(first) !== 2)
5495
+ return 12288;
5494
5496
  return charWidth(first) > 0 ? first : 32;
5495
5497
  }
5496
5498
  const id = CLUSTER_BASE + clusters.length;
@@ -5536,14 +5538,26 @@ function charWidth(cp) {
5536
5538
  return 2;
5537
5539
  return 1;
5538
5540
  }
5541
+ function clusterWidth(text) {
5542
+ const first = text.codePointAt(0) ?? 32;
5543
+ const base = charWidth(first);
5544
+ if (base === 2)
5545
+ return 2;
5546
+ if (isRegional(first)) {
5547
+ const second = text.codePointAt(2);
5548
+ return second !== void 0 && isRegional(second) ? 2 : 1;
5549
+ }
5550
+ if (isKeycapBase(first) && text.includes("\u20E3"))
5551
+ return 2;
5552
+ if (inRanges(first, PICTOGRAPHIC) && (text.includes("\uFE0F") || /[\u{1f3fb}-\u{1f3ff}]/u.test(text)))
5553
+ return 2;
5554
+ return 1;
5555
+ }
5539
5556
  function cellWidth(value) {
5540
5557
  if (value === CONTINUATION)
5541
5558
  return 0;
5542
- if (value >= CLUSTER_BASE) {
5543
- const t = clusterText(value);
5544
- const first = t.codePointAt(0) ?? 32;
5545
- return charWidth(first) === 2 ? 2 : 1;
5546
- }
5559
+ if (value >= CLUSTER_BASE)
5560
+ return clusterWidth(clusterText(value));
5547
5561
  return charWidth(value);
5548
5562
  }
5549
5563
  function graphemes(text) {
@@ -5583,6 +5597,15 @@ function graphemes(text) {
5583
5597
  parts += 2;
5584
5598
  continue;
5585
5599
  }
5600
+ const pictographicBase = inRanges(cp, PICTOGRAPHIC);
5601
+ const joins = pictographicBase && (isToneModifier(next) || isTag(next)) || isRegional(cp) && isRegional(next) && size === 2 && !cluster;
5602
+ if (joins) {
5603
+ cluster = cluster || text.slice(i, i + size);
5604
+ cluster += text.slice(i + size, i + size + nsize);
5605
+ size += nsize;
5606
+ parts += 1;
5607
+ continue;
5608
+ }
5586
5609
  if (charWidth(next) !== 0)
5587
5610
  break;
5588
5611
  if (isUnsafeCodepoint(next))
@@ -5594,7 +5617,8 @@ function graphemes(text) {
5594
5617
  }
5595
5618
  if (width === 0) {
5596
5619
  } else if (cluster) {
5597
- out.push({ value: internCluster(cluster), width });
5620
+ const value = internCluster(cluster);
5621
+ out.push({ value, width: cellWidth(value) });
5598
5622
  } else {
5599
5623
  out.push({ value: cp, width });
5600
5624
  }
@@ -5691,9 +5715,9 @@ function wrap(text, width) {
5691
5715
  }
5692
5716
  return lines;
5693
5717
  }
5694
- var CLUSTER_BASE, CONTINUATION, clusters, clusterIds, REPLACEMENT, UNSAFE, MAX_CLUSTER_CODEPOINTS, MAX_CLUSTERS, ZERO_WIDTH, WIDE, PICTOGRAPHIC, ZWJ;
5718
+ var CLUSTER_BASE, CONTINUATION, clusters, clusterIds, REPLACEMENT, UNSAFE, MAX_CLUSTER_CODEPOINTS, MAX_CLUSTERS, ZERO_WIDTH, WIDE, PICTOGRAPHIC, isRegional, isToneModifier, isTag, isKeycapBase, ZWJ;
5695
5719
  var init_unicode = __esm({
5696
- "../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/unicode.js"() {
5720
+ "../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/unicode.js"() {
5697
5721
  "use strict";
5698
5722
  CLUSTER_BASE = 1114112;
5699
5723
  CONTINUATION = 4294967295;
@@ -5796,14 +5820,18 @@ var init_unicode = __esm({
5796
5820
  [126976, 129791],
5797
5821
  [130048, 131069]
5798
5822
  ];
5823
+ isRegional = (cp) => cp >= 127462 && cp <= 127487;
5824
+ isToneModifier = (cp) => cp >= 127995 && cp <= 127999;
5825
+ isTag = (cp) => cp >= 917536 && cp <= 917631;
5826
+ isKeycapBase = (cp) => cp >= 48 && cp <= 57 || cp === 35 || cp === 42;
5799
5827
  ZWJ = 8205;
5800
5828
  }
5801
5829
  });
5802
5830
 
5803
- // ../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/buffer.js
5831
+ // ../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/buffer.js
5804
5832
  var Attr, FrameBuffer;
5805
5833
  var init_buffer = __esm({
5806
- "../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/buffer.js"() {
5834
+ "../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/buffer.js"() {
5807
5835
  "use strict";
5808
5836
  init_color();
5809
5837
  init_unicode();
@@ -5992,7 +6020,7 @@ var init_buffer = __esm({
5992
6020
  }
5993
6021
  });
5994
6022
 
5995
- // ../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/ansi.js
6023
+ // ../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/ansi.js
5996
6024
  function moveTo(x, y) {
5997
6025
  return `${CSI}${y + 1};${x + 1}H`;
5998
6026
  }
@@ -6033,9 +6061,17 @@ function fg16(i) {
6033
6061
  function bg16(i) {
6034
6062
  return i < 8 ? `${CSI}${40 + i}m` : `${CSI}${100 + i - 8}m`;
6035
6063
  }
6036
- var ESC, CSI, ansi, fgDefault, bgDefault;
6064
+ function stripAnsi(text) {
6065
+ const stripped = text.replace(
6066
+ // eslint-disable-next-line no-control-regex
6067
+ /(?:\x1b\[|\x9b)[0-9;?<=>]*[ -/]*[@-~]|(?:\x1b\]|\x9d)[\s\S]*?(?:\x07|\x1b\\|\x9c|$)|(?:\x1bP|\x90)[\s\S]*?(?:\x1b\\|\x9c|$)|\x1b[@-Z\\-_]/g,
6068
+ ""
6069
+ );
6070
+ return stripped.replace(TEXT_UNSAFE, "");
6071
+ }
6072
+ var ESC, CSI, ansi, fgDefault, bgDefault, TEXT_UNSAFE;
6037
6073
  var init_ansi = __esm({
6038
- "../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/ansi.js"() {
6074
+ "../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/ansi.js"() {
6039
6075
  "use strict";
6040
6076
  init_unicode();
6041
6077
  ESC = "\x1B";
@@ -6067,10 +6103,11 @@ var init_ansi = __esm({
6067
6103
  };
6068
6104
  fgDefault = `${CSI}39m`;
6069
6105
  bgDefault = `${CSI}49m`;
6106
+ TEXT_UNSAFE = /[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f-\u009f\u202a-\u202e\u2066-\u2069]/gu;
6070
6107
  }
6071
6108
  });
6072
6109
 
6073
- // ../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/diff.js
6110
+ // ../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/diff.js
6074
6111
  function encodeRows(buffer, options = {}) {
6075
6112
  const encoder = new Encoder({ ...options, origin: { x: 0, y: 0 }, relative: false });
6076
6113
  const width = buffer.width;
@@ -6091,7 +6128,7 @@ function encodeRows(buffer, options = {}) {
6091
6128
  }
6092
6129
  var GAP_MERGE, Encoder;
6093
6130
  var init_diff = __esm({
6094
- "../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/diff.js"() {
6131
+ "../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/diff.js"() {
6095
6132
  "use strict";
6096
6133
  init_buffer();
6097
6134
  init_buffer();
@@ -6302,7 +6339,7 @@ var init_diff = __esm({
6302
6339
  }
6303
6340
  });
6304
6341
 
6305
- // ../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/capabilities.js
6342
+ // ../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/capabilities.js
6306
6343
  function detectProgram(env2) {
6307
6344
  if (env2.KITTY_WINDOW_ID || env2.TERM === "xterm-kitty")
6308
6345
  return "kitty";
@@ -6399,12 +6436,12 @@ function detectCapabilities(overrides = {}, env2 = process.env, stream = process
6399
6436
  };
6400
6437
  }
6401
6438
  var init_capabilities = __esm({
6402
- "../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/capabilities.js"() {
6439
+ "../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/capabilities.js"() {
6403
6440
  "use strict";
6404
6441
  }
6405
6442
  });
6406
6443
 
6407
- // ../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/input.js
6444
+ // ../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/input.js
6408
6445
  function decodeModifiers(param) {
6409
6446
  const bits = Math.max(0, param - 1);
6410
6447
  return { shift: (bits & 1) !== 0, alt: (bits & 2) !== 0, ctrl: (bits & 4) !== 0 };
@@ -6440,7 +6477,7 @@ function matchKey(event, binding) {
6440
6477
  }
6441
6478
  var SPECIAL, PASTE_END, InputParser, SPECIAL_KEYS_SORTED;
6442
6479
  var init_input = __esm({
6443
- "../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/input.js"() {
6480
+ "../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/input.js"() {
6444
6481
  "use strict";
6445
6482
  SPECIAL = {
6446
6483
  "[A": "up",
@@ -6683,7 +6720,7 @@ var init_input = __esm({
6683
6720
  }
6684
6721
  });
6685
6722
 
6686
- // ../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/terminal.js
6723
+ // ../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/terminal.js
6687
6724
  function anchor() {
6688
6725
  return ansi.reset + ansi.cursorSave;
6689
6726
  }
@@ -6692,7 +6729,7 @@ function toAnchor() {
6692
6729
  }
6693
6730
  var Terminal;
6694
6731
  var init_terminal = __esm({
6695
- "../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/terminal.js"() {
6732
+ "../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/terminal.js"() {
6696
6733
  "use strict";
6697
6734
  init_ansi();
6698
6735
  init_capabilities();
@@ -6978,7 +7015,7 @@ var init_terminal = __esm({
6978
7015
  }
6979
7016
  });
6980
7017
 
6981
- // ../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/theme.js
7018
+ // ../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/theme.js
6982
7019
  function variant(base, overrides) {
6983
7020
  return { ...base, ...overrides };
6984
7021
  }
@@ -7007,7 +7044,7 @@ function seriesColor(theme, index) {
7007
7044
  }
7008
7045
  var DARK, DRACULA, NORD, TOKYO_NIGHT, GRUVBOX, MATRIX, MONOCHROME, HIGH_CONTRAST, LIGHT, themes, themeList;
7009
7046
  var init_theme = __esm({
7010
- "../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/theme.js"() {
7047
+ "../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/theme.js"() {
7011
7048
  "use strict";
7012
7049
  init_color();
7013
7050
  DARK = {
@@ -7218,7 +7255,7 @@ var init_theme = __esm({
7218
7255
  }
7219
7256
  });
7220
7257
 
7221
- // ../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/layout.js
7258
+ // ../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/layout.js
7222
7259
  function parse(c, total) {
7223
7260
  const min = c.min ?? 0;
7224
7261
  const max = c.max ?? Infinity;
@@ -7392,12 +7429,12 @@ function isEmpty(rect) {
7392
7429
  return rect.width <= 0 || rect.height <= 0;
7393
7430
  }
7394
7431
  var init_layout = __esm({
7395
- "../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/layout.js"() {
7432
+ "../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/layout.js"() {
7396
7433
  "use strict";
7397
7434
  }
7398
7435
  });
7399
7436
 
7400
- // ../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/richtext.js
7437
+ // ../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/richtext.js
7401
7438
  function isRich(value) {
7402
7439
  return typeof value !== "string";
7403
7440
  }
@@ -7602,14 +7639,14 @@ function wrapRich(value, width) {
7602
7639
  return out;
7603
7640
  }
7604
7641
  var init_richtext = __esm({
7605
- "../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/richtext.js"() {
7642
+ "../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/richtext.js"() {
7606
7643
  "use strict";
7607
7644
  init_buffer();
7608
7645
  init_unicode();
7609
7646
  }
7610
7647
  });
7611
7648
 
7612
- // ../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/surface.js
7649
+ // ../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/surface.js
7613
7650
  function borderGlyph(style, bits) {
7614
7651
  const chars = BORDERS[style];
7615
7652
  for (const [part, value] of Object.entries(PART_BITS)) {
@@ -7648,7 +7685,7 @@ function createSurface(buffer, theme, rect) {
7648
7685
  }
7649
7686
  var BORDERS, EDGE_UP, EDGE_RIGHT, EDGE_DOWN, EDGE_LEFT, PART_BITS, BITS_BY_CODEPOINT, Surface;
7650
7687
  var init_surface = __esm({
7651
- "../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/surface.js"() {
7688
+ "../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/surface.js"() {
7652
7689
  "use strict";
7653
7690
  init_layout();
7654
7691
  init_unicode();
@@ -7913,17 +7950,18 @@ var init_surface = __esm({
7913
7950
  if (sides.right)
7914
7951
  putV(w - 1, 1, h - 2, b.v);
7915
7952
  }
7953
+ const headerWidth = Math.max(0, w - Math.max(0, options.titleRightPadding ?? 0));
7916
7954
  const subtitle = options.subtitle ? ` ${options.subtitle} ` : "";
7917
- const subtitleWidth = subtitle && stringWidth(subtitle) + 4 < w ? stringWidth(subtitle) : 0;
7955
+ const subtitleWidth = subtitle && stringWidth(subtitle) + 4 < headerWidth ? stringWidth(subtitle) : 0;
7918
7956
  if (options.title && sides.top) {
7919
7957
  const titleColor = options.titleColor ?? this.theme.title;
7920
7958
  const label = ` ${options.title} `;
7921
- const limit = subtitleWidth > 0 ? w - 1 - subtitleWidth : w - 2;
7959
+ const limit = subtitleWidth > 0 ? headerWidth - 1 - subtitleWidth : headerWidth - 2;
7922
7960
  const room = Math.max(0, limit - 2);
7923
7961
  const shown = truncate(label, room);
7924
7962
  const tw = stringWidth(shown);
7925
7963
  const align = options.titleAlign ?? "left";
7926
- const tx = align === "left" ? 2 : align === "right" ? Math.max(2, limit - tw) : Math.max(2, Math.min(limit - tw, Math.floor((w - tw) / 2)));
7964
+ const tx = align === "left" ? 2 : align === "right" ? Math.max(2, limit - tw) : Math.max(2, Math.min(limit - tw, Math.floor((headerWidth - tw) / 2)));
7927
7965
  this.text(tx, 0, shown, {
7928
7966
  fg: titleColor,
7929
7967
  bg,
@@ -7932,7 +7970,7 @@ var init_surface = __esm({
7932
7970
  });
7933
7971
  }
7934
7972
  if (subtitleWidth > 0 && sides.top) {
7935
- this.text(w - 2 - subtitleWidth, 0, subtitle, {
7973
+ this.text(headerWidth - 2 - subtitleWidth, 0, subtitle, {
7936
7974
  fg: options.subtitleColor ?? this.theme.muted,
7937
7975
  bg
7938
7976
  });
@@ -7958,13 +7996,13 @@ var init_surface = __esm({
7958
7996
  }
7959
7997
  });
7960
7998
 
7961
- // ../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/graphics/braille.js
7999
+ // ../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/graphics/braille.js
7962
8000
  function snap(v) {
7963
8001
  return Math.round(v + (v >= 0 ? 1e-9 : -1e-9));
7964
8002
  }
7965
8003
  var BRAILLE_BASE, DOT_BITS, BrailleCanvas;
7966
8004
  var init_braille = __esm({
7967
- "../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/graphics/braille.js"() {
8005
+ "../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/graphics/braille.js"() {
7968
8006
  "use strict";
7969
8007
  BRAILLE_BASE = 10240;
7970
8008
  DOT_BITS = [
@@ -8218,7 +8256,7 @@ var init_braille = __esm({
8218
8256
  }
8219
8257
  });
8220
8258
 
8221
- // ../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/graphics/blocks.js
8259
+ // ../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/graphics/blocks.js
8222
8260
  function verticalGlyph(ratio2, mode = "block") {
8223
8261
  const r = ratio2 <= 0 ? 0 : ratio2 >= 1 ? 1 : ratio2;
8224
8262
  if (mode === "ascii")
@@ -8237,14 +8275,14 @@ function horizontalGlyph(ratio2, mode = "block") {
8237
8275
  }
8238
8276
  var HORIZONTAL_EIGHTHS, VERTICAL_EIGHTHS;
8239
8277
  var init_blocks = __esm({
8240
- "../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/graphics/blocks.js"() {
8278
+ "../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/graphics/blocks.js"() {
8241
8279
  "use strict";
8242
8280
  HORIZONTAL_EIGHTHS = ["", "\u258F", "\u258E", "\u258D", "\u258C", "\u258B", "\u258A", "\u2589", "\u2588"];
8243
8281
  VERTICAL_EIGHTHS = ["", "\u2581", "\u2582", "\u2583", "\u2584", "\u2585", "\u2586", "\u2587", "\u2588"];
8244
8282
  }
8245
8283
  });
8246
8284
 
8247
- // ../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/graphics/plot.js
8285
+ // ../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/graphics/plot.js
8248
8286
  function bound(value) {
8249
8287
  return typeof value === "number" && Number.isFinite(value) ? value : void 0;
8250
8288
  }
@@ -8533,7 +8571,7 @@ function donut(surface, options) {
8533
8571
  blit(surface, canvas, (col, row) => colorFor.get(`${col},${row}`) ?? theme.muted, options.background);
8534
8572
  }
8535
8573
  var init_plot = __esm({
8536
- "../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/graphics/plot.js"() {
8574
+ "../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/graphics/plot.js"() {
8537
8575
  "use strict";
8538
8576
  init_color();
8539
8577
  init_braille();
@@ -8542,7 +8580,7 @@ var init_plot = __esm({
8542
8580
  }
8543
8581
  });
8544
8582
 
8545
- // ../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/graphics/canvas.js
8583
+ // ../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/graphics/canvas.js
8546
8584
  function span(bounds) {
8547
8585
  if (!bounds)
8548
8586
  return UNIT;
@@ -8638,7 +8676,7 @@ function drawCanvas(surface, options) {
8638
8676
  }
8639
8677
  var UNIT;
8640
8678
  var init_canvas = __esm({
8641
- "../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/graphics/canvas.js"() {
8679
+ "../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/graphics/canvas.js"() {
8642
8680
  "use strict";
8643
8681
  init_color();
8644
8682
  init_braille();
@@ -8647,7 +8685,7 @@ var init_canvas = __esm({
8647
8685
  }
8648
8686
  });
8649
8687
 
8650
- // ../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/widgets/text.js
8688
+ // ../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/widgets/text.js
8651
8689
  function attrsOf(o) {
8652
8690
  let a = o.attrs ?? 0;
8653
8691
  if (o.bold)
@@ -8776,7 +8814,7 @@ function drawStatusBar(surface, options) {
8776
8814
  return spans;
8777
8815
  }
8778
8816
  var init_text = __esm({
8779
- "../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/widgets/text.js"() {
8817
+ "../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/widgets/text.js"() {
8780
8818
  "use strict";
8781
8819
  init_buffer();
8782
8820
  init_color();
@@ -8786,7 +8824,7 @@ var init_text = __esm({
8786
8824
  }
8787
8825
  });
8788
8826
 
8789
- // ../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/widgets/calendar.js
8827
+ // ../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/widgets/calendar.js
8790
8828
  function daysInMonth(year, month) {
8791
8829
  if (month === 2)
8792
8830
  return isLeapYear(year) ? 29 : 28;
@@ -8866,7 +8904,7 @@ function calendarHeight(options) {
8866
8904
  }
8867
8905
  var MONTH_NAMES, WEEKDAY_NAMES, DAY_WIDTH, GRID_WIDTH;
8868
8906
  var init_calendar = __esm({
8869
- "../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/widgets/calendar.js"() {
8907
+ "../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/widgets/calendar.js"() {
8870
8908
  "use strict";
8871
8909
  init_buffer();
8872
8910
  init_unicode();
@@ -8890,7 +8928,7 @@ var init_calendar = __esm({
8890
8928
  }
8891
8929
  });
8892
8930
 
8893
- // ../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/graphics/chart.js
8931
+ // ../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/graphics/chart.js
8894
8932
  function bound2(value) {
8895
8933
  return typeof value === "number" && Number.isFinite(value) ? value : void 0;
8896
8934
  }
@@ -9090,7 +9128,7 @@ function plotCells(surface, series, o) {
9090
9128
  });
9091
9129
  }
9092
9130
  var init_chart = __esm({
9093
- "../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/graphics/chart.js"() {
9131
+ "../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/graphics/chart.js"() {
9094
9132
  "use strict";
9095
9133
  init_color();
9096
9134
  init_braille();
@@ -9100,7 +9138,7 @@ var init_chart = __esm({
9100
9138
  }
9101
9139
  });
9102
9140
 
9103
- // ../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/widgets/chart.js
9141
+ // ../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/widgets/chart.js
9104
9142
  function niceLabel(value) {
9105
9143
  if (!Number.isFinite(value))
9106
9144
  return "";
@@ -9162,7 +9200,7 @@ function drawChart(surface, options) {
9162
9200
  }
9163
9201
  }
9164
9202
  var init_chart2 = __esm({
9165
- "../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/widgets/chart.js"() {
9203
+ "../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/widgets/chart.js"() {
9166
9204
  "use strict";
9167
9205
  init_unicode();
9168
9206
  init_theme();
@@ -9170,14 +9208,14 @@ var init_chart2 = __esm({
9170
9208
  }
9171
9209
  });
9172
9210
 
9173
- // ../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/widgets/shadow.js
9211
+ // ../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/widgets/shadow.js
9174
9212
  var init_shadow = __esm({
9175
- "../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/widgets/shadow.js"() {
9213
+ "../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/widgets/shadow.js"() {
9176
9214
  "use strict";
9177
9215
  }
9178
9216
  });
9179
9217
 
9180
- // ../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/widgets/surface.js
9218
+ // ../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/widgets/surface.js
9181
9219
  function drawClear(surface, options = {}) {
9182
9220
  if (surface.empty)
9183
9221
  return;
@@ -9201,16 +9239,16 @@ function drawFill(surface, options = {}) {
9201
9239
  }
9202
9240
  }
9203
9241
  var init_surface2 = __esm({
9204
- "../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/widgets/surface.js"() {
9242
+ "../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/widgets/surface.js"() {
9205
9243
  "use strict";
9206
9244
  init_unicode();
9207
9245
  }
9208
9246
  });
9209
9247
 
9210
- // ../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/graphics/world-data.js
9248
+ // ../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/graphics/world-data.js
9211
9249
  var WORLD_COUNTRIES;
9212
9250
  var init_world_data = __esm({
9213
- "../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/graphics/world-data.js"() {
9251
+ "../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/graphics/world-data.js"() {
9214
9252
  "use strict";
9215
9253
  WORLD_COUNTRIES = [
9216
9254
  {
@@ -10501,7 +10539,7 @@ var init_world_data = __esm({
10501
10539
  }
10502
10540
  });
10503
10541
 
10504
- // ../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/graphics/world.js
10542
+ // ../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/graphics/world.js
10505
10543
  function matches(country, keys) {
10506
10544
  for (const key of keys) {
10507
10545
  if (key.length === 0)
@@ -10566,7 +10604,7 @@ function degreesAt(column, row, width, height, x = WORLD_X, y = WORLD_Y) {
10566
10604
  }
10567
10605
  var WORLD_X, WORLD_Y;
10568
10606
  var init_world = __esm({
10569
- "../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/graphics/world.js"() {
10607
+ "../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/graphics/world.js"() {
10570
10608
  "use strict";
10571
10609
  init_world_data();
10572
10610
  WORLD_X = { min: -180, max: 180 };
@@ -10574,7 +10612,7 @@ var init_world = __esm({
10574
10612
  }
10575
10613
  });
10576
10614
 
10577
- // ../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/widgets/world.js
10615
+ // ../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/widgets/world.js
10578
10616
  function drawWorldMap(surface, options = {}) {
10579
10617
  if (surface.empty)
10580
10618
  return;
@@ -10598,14 +10636,14 @@ function countryAtCell(column, row, width, height, options = {}) {
10598
10636
  return countryAt(at.lon, at.lat);
10599
10637
  }
10600
10638
  var init_world2 = __esm({
10601
- "../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/widgets/world.js"() {
10639
+ "../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/widgets/world.js"() {
10602
10640
  "use strict";
10603
10641
  init_canvas();
10604
10642
  init_world();
10605
10643
  }
10606
10644
  });
10607
10645
 
10608
- // ../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/widgets/scrollbar.js
10646
+ // ../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/widgets/scrollbar.js
10609
10647
  function isVertical(orientation) {
10610
10648
  return orientation === "right" || orientation === "left";
10611
10649
  }
@@ -10661,13 +10699,13 @@ function offsetForPosition(position, track, total, viewport) {
10661
10699
  return Math.round(at / usable2 * (total - visible));
10662
10700
  }
10663
10701
  var init_scrollbar = __esm({
10664
- "../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/widgets/scrollbar.js"() {
10702
+ "../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/widgets/scrollbar.js"() {
10665
10703
  "use strict";
10666
10704
  init_color();
10667
10705
  }
10668
10706
  });
10669
10707
 
10670
- // ../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/widgets/table.js
10708
+ // ../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/widgets/table.js
10671
10709
  function cellValue(row, column, index) {
10672
10710
  if (column.render)
10673
10711
  return column.render(row, index);
@@ -10726,7 +10764,8 @@ function drawTable(surface, options) {
10726
10764
  break;
10727
10765
  const y = i + headerRows;
10728
10766
  const selected = options.selected === rowIndex;
10729
- const rowBg = selected ? theme.selection : options.zebra && rowIndex % 2 === 1 ? zebraBg : options.background;
10767
+ const hovered = !selected && options.hovered === rowIndex;
10768
+ const rowBg = selected ? theme.selection : hovered ? hoverBg(theme) : options.zebra && rowIndex % 2 === 1 ? zebraBg : options.background;
10730
10769
  if (rowBg !== void 0)
10731
10770
  surface.fillRect(0, y, bodyWidth, 1, { bg: rowBg });
10732
10771
  let x = 0;
@@ -10757,6 +10796,9 @@ function drawTable(surface, options) {
10757
10796
  drawScrollbar(surface, surface.width - 1, headerRows, capacity, options.rows.length, offset);
10758
10797
  }
10759
10798
  }
10799
+ function hoverBg(theme) {
10800
+ return elevate(theme, 0.1);
10801
+ }
10760
10802
  function drawList(surface, options) {
10761
10803
  if (surface.empty)
10762
10804
  return;
@@ -10770,13 +10812,15 @@ function drawList(surface, options) {
10770
10812
  break;
10771
10813
  const item = typeof raw === "string" ? { label: raw } : raw;
10772
10814
  const selected = options.selected === index;
10815
+ const hovered = !selected && options.hovered === index;
10773
10816
  const bullet = options.bullet ? `${options.bullet} ` : "";
10774
10817
  const label = `${bullet}${item.label}`;
10775
- if (selected)
10776
- surface.fillRect(0, i, width, 1, { bg: theme.selection });
10818
+ const bg = selected ? theme.selection : hovered ? hoverBg(theme) : options.background;
10819
+ if (selected || hovered)
10820
+ surface.fillRect(0, i, width, 1, { bg });
10777
10821
  surface.text(0, i, fit(truncate(label, width), width), {
10778
10822
  fg: selected ? theme.selectionText : item.color ?? theme.foreground,
10779
- bg: selected ? theme.selection : options.background,
10823
+ bg,
10780
10824
  attrs: selected ? Attr.Bold : 0
10781
10825
  });
10782
10826
  }
@@ -10799,6 +10843,8 @@ function drawTree(surface, options) {
10799
10843
  const theme = surface.theme;
10800
10844
  const flat = [];
10801
10845
  flatten(options.nodes, 0, [], flat);
10846
+ const scrollbar = options.scrollbar ?? false;
10847
+ const width = surface.width - (scrollbar ? 1 : 0);
10802
10848
  const offset = resolveOffset(options.offset, options.selected, surface.height, flat.length, options.followSelection);
10803
10849
  const guides = options.guides !== false;
10804
10850
  const guideColor = options.guideColor ?? mix(theme.border, theme.foreground, 0.15);
@@ -10808,9 +10854,10 @@ function drawTree(surface, options) {
10808
10854
  if (!entry)
10809
10855
  break;
10810
10856
  const selected = options.selected === index;
10811
- const bg = selected ? theme.selection : options.background;
10812
- if (selected)
10813
- surface.fillRect(0, i, surface.width, 1, { bg: theme.selection });
10857
+ const hovered = !selected && options.hovered === index;
10858
+ const bg = selected ? theme.selection : hovered ? hoverBg(theme) : options.background;
10859
+ if (selected || hovered)
10860
+ surface.fillRect(0, i, width, 1, { bg });
10814
10861
  let prefix = "";
10815
10862
  if (guides) {
10816
10863
  for (let d = 0; d < entry.depth; d++)
@@ -10820,7 +10867,7 @@ function drawTree(surface, options) {
10820
10867
  prefix = " ".repeat(entry.depth);
10821
10868
  }
10822
10869
  const valuesWidth = (entry.node.values ?? []).reduce((a, v) => a + v.width + 1, 0);
10823
- const labelWidth = Math.max(0, surface.width - valuesWidth);
10870
+ const labelWidth = Math.max(0, width - valuesWidth);
10824
10871
  surface.text(0, i, truncate(prefix, labelWidth), { fg: guideColor, bg });
10825
10872
  const px = Math.min(stringWidth(prefix), labelWidth);
10826
10873
  surface.text(px, i, truncate(entry.node.label, Math.max(0, labelWidth - px)), {
@@ -10836,6 +10883,10 @@ function drawTree(surface, options) {
10836
10883
  });
10837
10884
  vx += value.width + 1;
10838
10885
  }
10886
+ options.onRow?.(entry.node, index, i);
10887
+ }
10888
+ if (scrollbar && flat.length > surface.height && surface.height > 0) {
10889
+ drawScrollbar(surface, surface.width - 1, 0, surface.height, flat.length, offset);
10839
10890
  }
10840
10891
  }
10841
10892
  function drawLog(surface, options) {
@@ -10885,7 +10936,7 @@ function drawLog(surface, options) {
10885
10936
  }
10886
10937
  }
10887
10938
  var init_table = __esm({
10888
- "../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/widgets/table.js"() {
10939
+ "../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/widgets/table.js"() {
10889
10940
  "use strict";
10890
10941
  init_buffer();
10891
10942
  init_color();
@@ -10896,7 +10947,7 @@ var init_table = __esm({
10896
10947
  }
10897
10948
  });
10898
10949
 
10899
- // ../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/widgets/meters.js
10950
+ // ../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/widgets/meters.js
10900
10951
  function clampRatio(value) {
10901
10952
  return value > 1 ? 1 : value > 0 ? value : 0;
10902
10953
  }
@@ -11089,7 +11140,7 @@ function drawColumns(surface, options) {
11089
11140
  }
11090
11141
  }
11091
11142
  var init_meters = __esm({
11092
- "../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/widgets/meters.js"() {
11143
+ "../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/widgets/meters.js"() {
11093
11144
  "use strict";
11094
11145
  init_buffer();
11095
11146
  init_color();
@@ -11100,7 +11151,7 @@ var init_meters = __esm({
11100
11151
  }
11101
11152
  });
11102
11153
 
11103
- // ../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/widgets/controls.js
11154
+ // ../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/widgets/controls.js
11104
11155
  function variantColor(surface, options) {
11105
11156
  const t = surface.theme;
11106
11157
  if (options.color)
@@ -11233,6 +11284,7 @@ function drawModal(root, options) {
11233
11284
  const surface = root.sub(x, y, width, height);
11234
11285
  const inner = surface.box({
11235
11286
  title: options.title,
11287
+ titleRightPadding: options.titleRightPadding,
11236
11288
  titleAlign: options.align ?? "center",
11237
11289
  border: "rounded",
11238
11290
  borderColor: options.color ?? theme.borderFocused,
@@ -11318,7 +11370,7 @@ function drawTooltip(root, options) {
11318
11370
  inner.text(0, 0, truncate(options.text, inner.width), { fg: theme.foreground });
11319
11371
  }
11320
11372
  var init_controls = __esm({
11321
- "../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/widgets/controls.js"() {
11373
+ "../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/widgets/controls.js"() {
11322
11374
  "use strict";
11323
11375
  init_buffer();
11324
11376
  init_color();
@@ -11327,9 +11379,64 @@ var init_controls = __esm({
11327
11379
  }
11328
11380
  });
11329
11381
 
11330
- // ../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/widgets/index.js
11382
+ // ../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/widgets/spinner.js
11383
+ function spinnerFrame(elapsed, frames, interval = 80) {
11384
+ if (frames.length === 0)
11385
+ return "";
11386
+ const step = Math.max(1, interval);
11387
+ return frames[Math.floor(Math.max(0, elapsed) / step) % frames.length] ?? "";
11388
+ }
11389
+ function drawSpinner(surface, options) {
11390
+ if (surface.empty)
11391
+ return 0;
11392
+ const theme = surface.theme;
11393
+ const named = typeof options.frames === "string" ? SPINNER_FRAMES[options.frames] : options.frames;
11394
+ const frames = named ?? SPINNER_FRAMES.dots;
11395
+ const active = options.active ?? true;
11396
+ const glyph = active ? spinnerFrame(options.elapsed, frames, options.interval) : options.doneGlyph ?? "\u2713";
11397
+ const color = options.color ?? (active ? theme.accent : theme.success);
11398
+ const labelColor = options.labelColor ?? theme.foreground;
11399
+ const bg = options.background;
11400
+ const glyphWidth = stringWidth(glyph);
11401
+ const width = surface.width;
11402
+ const labelRoom = Math.max(0, width - glyphWidth - 1);
11403
+ const label = options.label && labelRoom > 0 ? truncate(options.label, labelRoom) : "";
11404
+ const labelWidth = label ? 1 + stringWidth(label) : 0;
11405
+ const leftWidth = glyphWidth + labelWidth;
11406
+ const readWidth = options.text ? stringWidth(options.text) : 0;
11407
+ const readout = readWidth > 0 && leftWidth + 1 + readWidth <= width ? options.text : "";
11408
+ const total = Math.min(width, readout ? leftWidth + 1 + readWidth : leftWidth);
11409
+ const x0 = options.align === "right" ? width - total : options.align === "center" ? Math.floor((width - total) / 2) : 0;
11410
+ const x = Math.max(0, x0);
11411
+ if (bg !== void 0)
11412
+ surface.fill({ bg });
11413
+ surface.text(x, 0, glyph, { fg: color, bg, attrs: Attr.Bold });
11414
+ if (label)
11415
+ surface.text(x + glyphWidth + 1, 0, label, { fg: labelColor, bg });
11416
+ if (readout) {
11417
+ const rx = options.align === "center" ? x + leftWidth + 1 : width - readWidth;
11418
+ surface.text(rx, 0, readout, { fg: theme.muted, bg });
11419
+ }
11420
+ return total;
11421
+ }
11422
+ var SPINNER_FRAMES;
11423
+ var init_spinner = __esm({
11424
+ "../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/widgets/spinner.js"() {
11425
+ "use strict";
11426
+ init_buffer();
11427
+ init_unicode();
11428
+ SPINNER_FRAMES = {
11429
+ dots: ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"],
11430
+ arc: ["\u25DC", "\u25E0", "\u25DD", "\u25DE", "\u25E1", "\u25DF"],
11431
+ line: ["\u2500", "\u2572", "\u2502", "\u2571"],
11432
+ ascii: ["|", "/", "-", "\\"]
11433
+ };
11434
+ }
11435
+ });
11436
+
11437
+ // ../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/widgets/index.js
11331
11438
  var init_widgets = __esm({
11332
- "../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/widgets/index.js"() {
11439
+ "../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/widgets/index.js"() {
11333
11440
  "use strict";
11334
11441
  init_text();
11335
11442
  init_calendar();
@@ -11341,10 +11448,75 @@ var init_widgets = __esm({
11341
11448
  init_table();
11342
11449
  init_meters();
11343
11450
  init_controls();
11451
+ init_spinner();
11452
+ }
11453
+ });
11454
+
11455
+ // ../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/markdown.js
11456
+ function markdownText(value) {
11457
+ return stripAnsi(value).replace(/[\u0000-\u0008\u000b-\u001f\u007f]/g, "").replace(/([\\`*_{}\[\]<>#|!])/g, "\\$1");
11458
+ }
11459
+ function clipboardSequence(text, tmux = false) {
11460
+ const payload = Buffer.from(text, "utf8").toString("base64");
11461
+ if (payload.length > 1e5)
11462
+ throw new RangeError("Markdown exceeds the terminal clipboard limit.");
11463
+ const sequence = `\x1B]52;c;${payload}\x07`;
11464
+ return tmux ? `\x1BPtmux;${sequence.replace(/\x1b/g, "\x1B\x1B")}\x1B\\` : sequence;
11465
+ }
11466
+ var MarkdownSummary;
11467
+ var init_markdown = __esm({
11468
+ "../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/markdown.js"() {
11469
+ "use strict";
11470
+ init_ansi();
11471
+ init_richtext();
11472
+ MarkdownSummary = class _MarkdownSummary {
11473
+ blocks = [];
11474
+ add(block) {
11475
+ this.blocks.push(block);
11476
+ }
11477
+ child() {
11478
+ const child = new _MarkdownSummary();
11479
+ this.add(() => child.body());
11480
+ return child;
11481
+ }
11482
+ text(value) {
11483
+ this.add(markdownText(toSpanLines(value).map((line) => line.map((s) => s.text).join("")).join("\n")));
11484
+ }
11485
+ values(rows) {
11486
+ this.add(rows.filter((row) => row.label || row.value).map(({ label, value }) => {
11487
+ const key = markdownText(label.replace(/:\s*$/, "")).replace(/\s*\n\s*/g, " ");
11488
+ const content = markdownText(value).replace(/\n/g, "\n ");
11489
+ return key ? `- **${key}:** ${content}` : `- ${content}`;
11490
+ }).join("\n"));
11491
+ }
11492
+ series(values, label = "Series", format = String) {
11493
+ const finite = values.filter(Number.isFinite);
11494
+ if (!finite.length) {
11495
+ this.values([{ label, value: "No samples" }]);
11496
+ return;
11497
+ }
11498
+ const latest = values.at(-1);
11499
+ const min = finite.reduce((a, b) => Math.min(a, b), Infinity);
11500
+ const max = finite.reduce((a, b) => Math.max(a, b), -Infinity);
11501
+ this.values([{ label, value: `Latest: ${latest !== void 0 && Number.isFinite(latest) ? format(latest) : "unavailable"}; min: ${format(min)}; max: ${format(max)}; ${finite.length} samples` }]);
11502
+ }
11503
+ body() {
11504
+ return this.blocks.map((block) => typeof block === "function" ? block() : block).filter((block) => block.trim()).join("\n\n");
11505
+ }
11506
+ document(title, subtitle, context, footer2) {
11507
+ return [
11508
+ `## ${markdownText(title || "Summary").replace(/\s*\n\s*/g, " ")}`,
11509
+ context ? markdownText(context) : "",
11510
+ subtitle ? markdownText(subtitle) : "",
11511
+ this.body(),
11512
+ footer2 ? markdownText(footer2) : ""
11513
+ ].filter(Boolean).join("\n\n") + "\n";
11514
+ }
11515
+ };
11344
11516
  }
11345
11517
  });
11346
11518
 
11347
- // ../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/ui.js
11519
+ // ../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/ui.js
11348
11520
  function dispatchHit(regions, event) {
11349
11521
  for (let i = regions.length - 1; i >= 0; i--) {
11350
11522
  const hit = regions[i];
@@ -11374,7 +11546,7 @@ function countClicks(previous, press) {
11374
11546
  }
11375
11547
  var DOUBLE_CLICK_MS, Container, GridContainer;
11376
11548
  var init_ui = __esm({
11377
- "../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/ui.js"() {
11549
+ "../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/ui.js"() {
11378
11550
  "use strict";
11379
11551
  init_layout();
11380
11552
  init_unicode();
@@ -11382,8 +11554,11 @@ var init_ui = __esm({
11382
11554
  init_braille();
11383
11555
  init_canvas();
11384
11556
  init_widgets();
11557
+ init_markdown();
11558
+ init_surface();
11385
11559
  DOUBLE_CLICK_MS = 400;
11386
11560
  Container = class _Container {
11561
+ summary;
11387
11562
  surface;
11388
11563
  ctx;
11389
11564
  direction;
@@ -11391,7 +11566,8 @@ var init_ui = __esm({
11391
11566
  gap;
11392
11567
  justify;
11393
11568
  inner;
11394
- constructor(surface, ctx, direction = "column", options = {}) {
11569
+ constructor(surface, ctx, direction = "column", options = {}, summary) {
11570
+ this.summary = summary;
11395
11571
  this.surface = surface;
11396
11572
  this.ctx = ctx;
11397
11573
  this.direction = direction;
@@ -11469,16 +11645,18 @@ var init_ui = __esm({
11469
11645
  // ---------------------------------------------------------------- layout
11470
11646
  /** A horizontal container. Children default to equal shares. */
11471
11647
  row(options = {}, build) {
11648
+ const summary = this.summary?.child();
11472
11649
  return this.add((surface) => {
11473
- const container = new _Container(surface, this.ctx, "row", options);
11650
+ const container = new _Container(surface, this.ctx, "row", options, summary);
11474
11651
  build?.(container);
11475
11652
  container.flush();
11476
11653
  }, this.sizeOf(options, "fill"), options.bordered ?? false);
11477
11654
  }
11478
11655
  /** A vertical container. */
11479
11656
  column(options = {}, build) {
11657
+ const summary = this.summary?.child();
11480
11658
  return this.add((surface) => {
11481
- const container = new _Container(surface, this.ctx, "column", options);
11659
+ const container = new _Container(surface, this.ctx, "column", options, summary);
11482
11660
  build?.(container);
11483
11661
  container.flush();
11484
11662
  }, this.sizeOf(options, "fill"), options.bordered ?? false);
@@ -11492,8 +11670,9 @@ var init_ui = __esm({
11492
11670
  * });
11493
11671
  */
11494
11672
  grid(options = {}, build) {
11673
+ const summary = this.summary?.child();
11495
11674
  return this.add((surface) => {
11496
- const container = new GridContainer(surface, this.ctx, options);
11675
+ const container = new GridContainer(surface, this.ctx, options, summary);
11497
11676
  build?.(container);
11498
11677
  container.flush();
11499
11678
  }, this.sizeOf(options, "fill"), options.bordered ?? false);
@@ -11501,18 +11680,25 @@ var init_ui = __esm({
11501
11680
  /** A bordered panel. The callback receives its interior as a column. */
11502
11681
  panel(options = {}, build) {
11503
11682
  const focus = options.focusable ? this.ctx.registerFocus() : void 0;
11683
+ const copy = options.copyMarkdown ?? this.ctx.copyMarkdown ?? false;
11684
+ const summary = options.copyMarkdown !== false && (copy || this.summary) ? new MarkdownSummary() : void 0;
11685
+ if (summary)
11686
+ this.summary?.add(() => summary.body() ? summary.document(options.title, options.subtitle, void 0, options.footer) : "");
11504
11687
  return this.add((surface) => {
11505
11688
  if (options.onClick) {
11506
11689
  const onClick = options.onClick;
11507
11690
  this.ctx.hit({ rect: surface.hitRect(), onClick: (x, y, button, clicks = 1) => onClick(x, y, button, clicks) });
11508
11691
  }
11509
11692
  const focused = options.focused ?? focus?.focused ?? false;
11693
+ const canCopy = copy !== false && !!this.ctx.copyText && surface.width >= 9 && (options.border ?? "rounded") !== "none" && resolveSides(options.sides).top;
11694
+ const copyWidth = surface.width >= 18 ? 6 : 3;
11510
11695
  const boxOptions = {
11511
11696
  title: options.title,
11512
11697
  titleAlign: options.titleAlign,
11513
11698
  titleColor: options.titleColor,
11514
11699
  subtitle: options.subtitle,
11515
11700
  subtitleColor: options.subtitleColor,
11701
+ titleRightPadding: canCopy ? copyWidth + 2 : 0,
11516
11702
  footer: options.footer,
11517
11703
  border: options.border ?? "rounded",
11518
11704
  ...options.sides === void 0 ? {} : { sides: options.sides },
@@ -11524,9 +11710,22 @@ var init_ui = __esm({
11524
11710
  const container = new _Container(interior, this.ctx, "column", {
11525
11711
  gap: options.gap,
11526
11712
  padding: options.padding ?? [0, 1]
11527
- });
11713
+ }, summary);
11528
11714
  build?.(container);
11529
11715
  container.flush();
11716
+ if (canCopy && (copy !== true || summary?.body())) {
11717
+ const action = () => this.ctx.copyText?.(() => typeof copy === "function" ? copy() : typeof copy === "string" ? copy : summary.document(options.title, options.subtitle, this.ctx.markdownContext, options.footer));
11718
+ const copyFocus = this.ctx.registerFocus(action, true);
11719
+ const target = surface.sub(surface.width - copyWidth - 2, 0, copyWidth, 1);
11720
+ const glyph = this.ctx.capabilities.unicode ? "\u29C9" : "C";
11721
+ drawButton(target, { label: copyWidth === 6 ? `${glyph} MD` : glyph, variant: "ghost", focused: copyFocus.focused });
11722
+ this.ctx.hit({ rect: target.hitRect(), onClick: (_x, _y, button) => {
11723
+ if (button === "left")
11724
+ action();
11725
+ } });
11726
+ } else if (canCopy) {
11727
+ surface.box({ ...boxOptions, titleRightPadding: 0, fill: false });
11728
+ }
11530
11729
  }, this.sizeOf(options, "fill"), (options.border ?? "rounded") !== "none");
11531
11730
  }
11532
11731
  /** A panel without a border — a grouping box that costs no rows. */
@@ -11553,6 +11752,7 @@ var init_ui = __esm({
11553
11752
  * paragraph reserves the rows it will actually occupy once wrapped.
11554
11753
  */
11555
11754
  text(content, options = {}) {
11755
+ this.summary?.text(content);
11556
11756
  const lines = isRich(content) ? (options.wrap ? wrapRich(content, this.crossWidth) : toSpanLines(content)).length : options.wrap ? wrap(content, this.crossWidth).length : content.split("\n").length;
11557
11757
  return this.add((s) => drawText(s, content, options), this.sizeOf(options, "auto", lines));
11558
11758
  }
@@ -11565,10 +11765,30 @@ var init_ui = __esm({
11565
11765
  return this.text(content, { fg: this.theme.title, bold: true, ...options });
11566
11766
  }
11567
11767
  badge(options) {
11768
+ this.summary?.text(options.text);
11568
11769
  return this.add((s) => drawBadge(s, options), this.sizeOf(options, "auto", 1));
11569
11770
  }
11771
+ /**
11772
+ * A busy indicator that animates on its own. The frame comes from the app
11773
+ * clock, and while the spinner is active the container asks for another
11774
+ * frame after this one, so the caller never runs a timer. Pass
11775
+ * `active: false` when the work is done and the line settles on a tick.
11776
+ */
11777
+ spinner(options) {
11778
+ if (options.label)
11779
+ this.summary?.values([{ label: "Status", value: options.label }]);
11780
+ const still = this.ctx.reducedMotion;
11781
+ if ((options.active ?? true) && !still)
11782
+ this.ctx.invalidate();
11783
+ const elapsed = still ? 0 : options.elapsed ?? this.ctx.elapsed;
11784
+ const unicode = this.ctx.capabilities.unicode;
11785
+ const frames = options.frames ?? (unicode ? "dots" : "ascii");
11786
+ const doneGlyph = options.doneGlyph ?? (unicode ? "\u2713" : "*");
11787
+ return this.add((s) => drawSpinner(s, { ...options, elapsed, frames, doneGlyph }), this.sizeOf(options, "auto", 1));
11788
+ }
11570
11789
  /** Aligned label/value pairs. */
11571
11790
  keyValues(rows, options = {}) {
11791
+ this.summary?.values(rows);
11572
11792
  return this.add((s) => drawKeyValues(s, { ...options, rows }), this.sizeOf(options, "auto", rows.length));
11573
11793
  }
11574
11794
  // ------------------------------------------------------------------ data
@@ -11624,11 +11844,12 @@ var init_ui = __esm({
11624
11844
  }
11625
11845
  /** Register the widget's rect so the wheel and clicks reach it. */
11626
11846
  attachScroll(surface, handlers, headerRows = 0) {
11627
- if (!handlers.onScroll && !handlers.onSelectRow && !handlers.onActivateRow && !handlers.onFocus)
11847
+ if (!handlers.onScroll && !handlers.onSelectRow && !handlers.onActivateRow && !handlers.onFocus && !handlers.onHoverRow)
11628
11848
  return;
11629
11849
  this.ctx.hit({
11630
11850
  rect: surface.hitRect(),
11631
11851
  onScroll: handlers.onScroll ? (delta) => handlers.onScroll?.(delta) : void 0,
11852
+ onHover: handlers.onHoverRow ? (_x, y) => handlers.onHoverRow?.(y >= headerRows ? y - headerRows : null) : void 0,
11632
11853
  onClick: (_x, y, _button, clicks = 1) => {
11633
11854
  handlers.onFocus?.();
11634
11855
  if (y < headerRows)
@@ -11648,19 +11869,25 @@ var init_ui = __esm({
11648
11869
  // --------------------------------------------------------------- metrics
11649
11870
  /** `label ████████░░░ 42%` */
11650
11871
  meter(options) {
11872
+ this.summary?.values([{ label: options.label ?? "Value", value: options.text ?? `${Math.round((options.max ? options.value / options.max : options.value) * 100)}%` }]);
11651
11873
  return this.add((s) => drawMeter(s, options), this.sizeOfData(options, "auto", "max", 1));
11652
11874
  }
11653
11875
  /** A stack or grid of meters. */
11654
11876
  meters(items, options = {}) {
11877
+ this.summary?.values(items.map((item) => ({ label: item.label ?? "Value", value: item.text ?? `${Math.round((item.max ? item.value / item.max : item.value) * 100)}%` })));
11655
11878
  const columns = Math.max(1, options.columns ?? 1);
11656
11879
  const rows = Math.ceil(items.length / columns);
11657
11880
  return this.add((s) => drawMeters(s, { ...options, items }), this.sizeOf(options, "auto", rows));
11658
11881
  }
11659
11882
  progress(options) {
11883
+ this.summary?.values([{ label: options.label ?? "Progress", value: options.showCount ? `${options.value}/${options.max ?? 1}` : `${Math.round(options.value / (options.max ?? 1) * 100)}%` }]);
11660
11884
  return this.add((s) => drawProgress(s, options), this.sizeOfData(options, "auto", "max", 1));
11661
11885
  }
11662
11886
  /** Braille line/area graph. Fills the space it is given. */
11663
11887
  graph(options) {
11888
+ for (const series of options.series ?? [{ values: options.values ?? [] }]) {
11889
+ this.summary?.series(series.values, series.label, options.axisFormat);
11890
+ }
11664
11891
  return this.add((s) => drawGraph(s, options), this.sizeOfData(options, "fill", "min-max"));
11665
11892
  }
11666
11893
  /**
@@ -11706,6 +11933,10 @@ var init_ui = __esm({
11706
11933
  return this.graph({ ...options, series });
11707
11934
  }
11708
11935
  sparkline(options) {
11936
+ if (options.text)
11937
+ this.summary?.values([{ label: options.label ?? "Value", value: options.text }]);
11938
+ else
11939
+ this.summary?.series(options.values, options.label);
11709
11940
  return this.add((s) => drawSparklineWidget(s, options), this.sizeOfData(options, "auto", "min-max", 1));
11710
11941
  }
11711
11942
  histogram(options) {
@@ -11713,6 +11944,7 @@ var init_ui = __esm({
11713
11944
  }
11714
11945
  /** A semicircular dial. Wants at least 9x5. */
11715
11946
  gauge(options) {
11947
+ this.summary?.values([{ label: "Gauge", value: options.label ?? `${Math.round(options.value * 100)}%` }]);
11716
11948
  return this.add((s) => gauge(s, options), this.sizeOf(options, "fill"));
11717
11949
  }
11718
11950
  donut(options) {
@@ -11723,6 +11955,19 @@ var init_ui = __esm({
11723
11955
  return this.add((s) => drawHeatBar(s, options), this.sizeOf(options, "auto", 1));
11724
11956
  }
11725
11957
  // ---------------------------------------------------------------- inputs
11958
+ /** A compact copy-as-Markdown button for a status strip or custom pane. */
11959
+ copyButton(options) {
11960
+ const action = () => this.ctx.copyText?.(options.markdown);
11961
+ const focus = this.ctx.registerFocus(action, true);
11962
+ const label = options.label ?? (this.ctx.capabilities.unicode ? "\u29C9 MD" : "C MD");
11963
+ return this.add((surface) => {
11964
+ drawButton(surface, { label, focused: focus.focused, variant: "ghost", disabled: !this.ctx.copyText });
11965
+ this.ctx.hit({ rect: surface.hitRect(), onClick: (_x, _y, button) => {
11966
+ if (button === "left")
11967
+ action();
11968
+ } });
11969
+ }, this.sizeOf({ ...options, width: options.width ?? stringWidth(label) + 2 }, "auto", 1));
11970
+ }
11726
11971
  /** A button. Pass `onPress` and it joins the Tab order automatically. */
11727
11972
  button(options) {
11728
11973
  const focus = this.ctx.registerFocus(options.onPress);
@@ -11794,10 +12039,21 @@ var init_ui = __esm({
11794
12039
  }, this.sizeOf(options, "auto", 1));
11795
12040
  }
11796
12041
  // -------------------------------------------------------------- overlays
11797
- /** A centred dialog drawn above everything else this frame. */
12042
+ /** A centred dialog. Tab/arrows move focus; Enter/Space activate; Esc dismisses. */
11798
12043
  modal(options, build) {
11799
12044
  this.ctx.overlay((root) => {
11800
- const inner = drawModal(root, options);
12045
+ const copy = options.copyMarkdown ?? this.ctx.copyMarkdown ?? false;
12046
+ const summary = new MarkdownSummary();
12047
+ if (options.message)
12048
+ summary.text(options.message);
12049
+ const canCopy = copy !== false && !!this.ctx.copyText && Math.min(options.width ?? 60, root.width - 4) >= 18;
12050
+ const buttons = options.buttons?.map((button) => {
12051
+ if (!button.onPress)
12052
+ return button;
12053
+ const focus = this.ctx.registerFocus(button.onPress);
12054
+ return { ...button, focused: button.focused ?? focus.focused };
12055
+ });
12056
+ const inner = drawModal(root, { ...options, buttons, titleRightPadding: canCopy ? 8 : 0 });
11801
12057
  this.ctx.hit({ rect: root.hitRect(), onClick: () => options.onDismiss?.() });
11802
12058
  const interior = inner.hitRect();
11803
12059
  this.ctx.hit({
@@ -11816,11 +12072,21 @@ var init_ui = __esm({
11816
12072
  });
11817
12073
  }
11818
12074
  if (build) {
11819
- const container = new _Container(inner, this.ctx, "column", { padding: [1, 1] });
12075
+ const container = new _Container(inner, this.ctx, "column", { padding: [1, 1] }, summary);
11820
12076
  build(container);
11821
12077
  container.flush();
11822
12078
  }
11823
- });
12079
+ if (canCopy && (copy !== true || summary.body())) {
12080
+ const action = () => this.ctx.copyText?.(() => typeof copy === "function" ? copy() : typeof copy === "string" ? copy : summary.document(options.title, void 0, this.ctx.markdownContext));
12081
+ const focus = this.ctx.registerFocus(action, true);
12082
+ const target = root.region({ x: interior.x + interior.width - 7, y: interior.y - 1, width: 6, height: 1 });
12083
+ drawButton(target, { label: this.ctx.capabilities.unicode ? "\u29C9 MD" : "C MD", variant: "ghost", focused: focus.focused });
12084
+ this.ctx.hit({ rect: target.hitRect(), onClick: (_x, _y, button) => {
12085
+ if (button === "left")
12086
+ action();
12087
+ } });
12088
+ }
12089
+ }, { modal: true, onDismiss: options.onDismiss, onKey: options.onKey });
11824
12090
  return this;
11825
12091
  }
11826
12092
  commandPalette(options) {
@@ -11900,11 +12166,13 @@ var init_ui = __esm({
11900
12166
  }
11901
12167
  };
11902
12168
  GridContainer = class {
12169
+ summary;
11903
12170
  surface;
11904
12171
  ctx;
11905
12172
  options;
11906
12173
  cells = [];
11907
- constructor(surface, ctx, options) {
12174
+ constructor(surface, ctx, options, summary) {
12175
+ this.summary = summary;
11908
12176
  this.surface = options.padding ? surface.inset(options.padding) : surface;
11909
12177
  this.ctx = ctx;
11910
12178
  this.options = options;
@@ -11937,22 +12205,25 @@ var init_ui = __esm({
11937
12205
  }
11938
12206
  /** A panel occupying the next free cell (or several, with colSpan/rowSpan). */
11939
12207
  panel(options = {}, build) {
12208
+ const summary = this.summary?.child();
11940
12209
  return this.push(options, (surface) => {
11941
- const container = new Container(surface, this.ctx, "column");
12210
+ const container = new Container(surface, this.ctx, "column", {}, summary);
11942
12211
  container.panel(options, build);
11943
12212
  container.flush();
11944
12213
  }, (options.border ?? "rounded") !== "none");
11945
12214
  }
11946
12215
  cell(options = {}, build) {
12216
+ const summary = this.summary?.child();
11947
12217
  return this.push(options, (surface) => {
11948
- const container = new Container(surface, this.ctx, "column", options);
12218
+ const container = new Container(surface, this.ctx, "column", options, summary);
11949
12219
  build?.(container);
11950
12220
  container.flush();
11951
12221
  }, options.bordered ?? false);
11952
12222
  }
11953
12223
  row(options = {}, build) {
12224
+ const summary = this.summary?.child();
11954
12225
  return this.push(options, (surface) => {
11955
- const container = new Container(surface, this.ctx, "row", options);
12226
+ const container = new Container(surface, this.ctx, "row", options, summary);
11956
12227
  build?.(container);
11957
12228
  container.flush();
11958
12229
  }, options.bordered ?? false);
@@ -12024,13 +12295,13 @@ var init_ui = __esm({
12024
12295
  }
12025
12296
  });
12026
12297
 
12027
- // ../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/app.js
12298
+ // ../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/app.js
12028
12299
  async function createApp(options = {}) {
12029
12300
  return new App(options);
12030
12301
  }
12031
12302
  var App;
12032
12303
  var init_app = __esm({
12033
- "../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/app.js"() {
12304
+ "../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/app.js"() {
12034
12305
  "use strict";
12035
12306
  init_buffer();
12036
12307
  init_diff();
@@ -12040,6 +12311,8 @@ var init_app = __esm({
12040
12311
  init_surface();
12041
12312
  init_ui();
12042
12313
  init_input();
12314
+ init_markdown();
12315
+ init_unicode();
12043
12316
  App = class {
12044
12317
  terminal;
12045
12318
  capabilities;
@@ -12064,8 +12337,14 @@ var init_app = __esm({
12064
12337
  focusIndex = 0;
12065
12338
  focusCount = 0;
12066
12339
  focusActions = [];
12340
+ focusConsumesKey = [];
12341
+ focusEngaged = false;
12342
+ copyNotice = null;
12343
+ copyTimer = null;
12067
12344
  hits = [];
12068
12345
  overlays = [];
12346
+ modal;
12347
+ backgroundFocusIndex = 0;
12069
12348
  lastStats = { frame: 0, renderMs: 0, changedCells: 0, dirtyRows: 0, bytes: 0, fps: 0 };
12070
12349
  constructor(options = {}) {
12071
12350
  this.options = options;
@@ -12092,6 +12371,31 @@ var init_app = __esm({
12092
12371
  get stats() {
12093
12372
  return this.lastStats;
12094
12373
  }
12374
+ /** Copy a user-requested summary. OSC 52 requires terminal clipboard support. */
12375
+ async copyToClipboard(value) {
12376
+ try {
12377
+ const text = typeof value === "function" ? value() : value;
12378
+ if (this.options.clipboard)
12379
+ await this.options.clipboard(text);
12380
+ else {
12381
+ if (!this.capabilities.tty)
12382
+ throw new Error("Clipboard needs an interactive terminal.");
12383
+ this.terminal.write(clipboardSequence(text, !!process.env.TMUX));
12384
+ }
12385
+ this.copyNotice = { text: this.options.clipboard ? "Markdown copied" : "Markdown copy sent", failed: false };
12386
+ } catch (error) {
12387
+ this.copyNotice = { text: `Copy failed: ${error instanceof Error ? error.message : String(error)}`, failed: true };
12388
+ }
12389
+ if (this.copyTimer)
12390
+ clearTimeout(this.copyTimer);
12391
+ this.copyTimer = setTimeout(() => {
12392
+ this.copyNotice = null;
12393
+ this.copyTimer = null;
12394
+ this.invalidate();
12395
+ }, 3e3);
12396
+ this.copyTimer.unref?.();
12397
+ this.invalidate();
12398
+ }
12095
12399
  /** Register the view. Called on every frame; keep it pure and cheap. */
12096
12400
  render(fn) {
12097
12401
  this.renderFn = fn;
@@ -12146,7 +12450,8 @@ var init_app = __esm({
12146
12450
  focusNext(delta = 1) {
12147
12451
  if (this.focusCount === 0)
12148
12452
  return;
12149
- this.focusIndex = (this.focusIndex + delta + this.focusCount) % this.focusCount;
12453
+ this.focusIndex = this.focusConsumesKey.some(Boolean) && !this.focusEngaged && !this.modal ? delta < 0 ? this.focusCount - 1 : 0 : (this.focusIndex + delta + this.focusCount) % this.focusCount;
12454
+ this.focusEngaged = true;
12150
12455
  this.dirty = true;
12151
12456
  }
12152
12457
  /** Activate the focused control, as Enter does. */
@@ -12204,6 +12509,7 @@ var init_app = __esm({
12204
12509
  elapsed: Date.now() - this.startedAt,
12205
12510
  focusIndex: -1,
12206
12511
  collapseBorders: this.options.collapseBorders ?? false,
12512
+ reducedMotion: this.options.reducedMotion ?? false,
12207
12513
  registerFocus: () => ({ index: -1, focused: false }),
12208
12514
  hit: () => {
12209
12515
  },
@@ -12252,6 +12558,10 @@ var init_app = __esm({
12252
12558
  }
12253
12559
  /** Stop the loop and restore the terminal. */
12254
12560
  stop() {
12561
+ if (this.copyTimer)
12562
+ clearTimeout(this.copyTimer);
12563
+ this.copyTimer = null;
12564
+ this.copyNotice = null;
12255
12565
  if (!this.running)
12256
12566
  return;
12257
12567
  this.running = false;
@@ -12279,12 +12589,35 @@ var init_app = __esm({
12279
12589
  return;
12280
12590
  }
12281
12591
  if (this.options.focusNavigation !== false) {
12592
+ if (!this.modal && !["tab", "enter", "space"].includes(event.name))
12593
+ this.focusEngaged = false;
12282
12594
  if (event.name === "tab") {
12283
12595
  this.focusNext(event.shift ? -1 : 1);
12596
+ if (this.modal || this.focusConsumesKey.some(Boolean))
12597
+ return;
12598
+ } else if (this.modal && ["left", "right", "up", "down"].includes(event.name)) {
12599
+ this.focusNext(event.name === "left" || event.name === "up" ? -1 : 1);
12600
+ return;
12284
12601
  } else if (event.name === "enter" || event.name === "space") {
12285
- this.activateFocused();
12602
+ const copyFocused = this.focusConsumesKey[this.focusIndex];
12603
+ const active = !copyFocused || this.focusEngaged || this.modal;
12604
+ const consumed = active && (this.modal || copyFocused) && this.focusActions[this.focusIndex];
12605
+ if (active)
12606
+ this.activateFocused();
12607
+ if (consumed)
12608
+ return;
12286
12609
  }
12287
12610
  }
12611
+ if (this.modal && event.name === "escape" && this.modal.onDismiss) {
12612
+ this.modal.onDismiss();
12613
+ this.dirty = true;
12614
+ return;
12615
+ }
12616
+ if (this.modal?.onKey) {
12617
+ this.modal.onKey(event);
12618
+ this.dirty = true;
12619
+ return;
12620
+ }
12288
12621
  this.emit("key", event);
12289
12622
  this.dirty = true;
12290
12623
  return;
@@ -12313,6 +12646,8 @@ var init_app = __esm({
12313
12646
  return { ...event, clicks };
12314
12647
  }
12315
12648
  dispatchMouse(event) {
12649
+ if (event.action === "press" && !this.modal)
12650
+ this.focusEngaged = false;
12316
12651
  if (dispatchHit(this.hits, event))
12317
12652
  this.dirty = true;
12318
12653
  }
@@ -12331,7 +12666,15 @@ var init_app = __esm({
12331
12666
  this.hits = [];
12332
12667
  this.overlays = [];
12333
12668
  this.focusActions = [];
12669
+ this.focusConsumesKey = [];
12334
12670
  let focusCursor = 0;
12671
+ const wasModal = this.modal !== void 0;
12672
+ const modalFocusIndex = this.focusIndex;
12673
+ if (wasModal)
12674
+ this.focusIndex = this.backgroundFocusIndex;
12675
+ else
12676
+ this.backgroundFocusIndex = this.focusIndex;
12677
+ this.modal = void 0;
12335
12678
  const ctx = {
12336
12679
  theme: this.theme,
12337
12680
  capabilities: this.capabilities,
@@ -12341,14 +12684,21 @@ var init_app = __esm({
12341
12684
  elapsed: Date.now() - this.startedAt,
12342
12685
  focusIndex: this.focusIndex,
12343
12686
  collapseBorders: this.options.collapseBorders ?? false,
12344
- registerFocus: (action) => {
12687
+ reducedMotion: this.options.reducedMotion ?? false,
12688
+ copyMarkdown: this.options.copyMarkdown,
12689
+ markdownContext: typeof this.options.markdownContext === "function" ? this.options.markdownContext() : this.options.markdownContext,
12690
+ copyText: (text) => {
12691
+ void this.copyToClipboard(text);
12692
+ },
12693
+ registerFocus: (action, consumeKey = false) => {
12345
12694
  const index = focusCursor++;
12346
12695
  if (action)
12347
12696
  this.focusActions[index] = action;
12348
- return { index, focused: index === this.focusIndex };
12697
+ this.focusConsumesKey[index] = consumeKey;
12698
+ return { index, focused: index === this.focusIndex && (!consumeKey || this.focusEngaged || !!this.modal) };
12349
12699
  },
12350
12700
  hit: (region) => this.hits.push(region),
12351
- overlay: (draw) => this.overlays.push(draw),
12701
+ overlay: (draw, options) => this.overlays.push({ draw, options }),
12352
12702
  invalidate: () => this.invalidate()
12353
12703
  };
12354
12704
  const root = createSurface(this.current, this.theme);
@@ -12365,11 +12715,29 @@ var init_app = __esm({
12365
12715
  app: this
12366
12716
  });
12367
12717
  container.flush();
12368
- for (const overlay of this.overlays)
12369
- overlay(root);
12718
+ for (const overlay of this.overlays) {
12719
+ if (overlay.options?.modal) {
12720
+ this.focusIndex = wasModal ? modalFocusIndex : 0;
12721
+ ctx.focusIndex = this.focusIndex;
12722
+ focusCursor = 0;
12723
+ this.focusActions = [];
12724
+ this.focusConsumesKey = [];
12725
+ this.modal = overlay.options;
12726
+ }
12727
+ overlay.draw(root);
12728
+ }
12729
+ if (this.copyNotice) {
12730
+ const label = truncate(` ${this.copyNotice.text} `, root.width);
12731
+ root.text(Math.max(0, root.width - stringWidth(label)), root.height - 1, label, {
12732
+ fg: this.copyNotice.failed ? this.theme.danger : this.theme.success,
12733
+ bg: this.theme.surface
12734
+ });
12735
+ }
12370
12736
  this.focusCount = Math.max(focusCursor, 0);
12371
- if (this.focusCount > 0 && this.focusIndex >= this.focusCount)
12737
+ if (this.focusCount > 0 && this.focusIndex >= this.focusCount) {
12372
12738
  this.focusIndex = 0;
12739
+ this.dirty = true;
12740
+ }
12373
12741
  const result = this.encoder.encode(this.previous, this.current, this.forceRepaint);
12374
12742
  this.forceRepaint = false;
12375
12743
  let output = result.output;
@@ -12399,9 +12767,9 @@ var init_app = __esm({
12399
12767
  }
12400
12768
  });
12401
12769
 
12402
- // ../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/index.js
12770
+ // ../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/index.js
12403
12771
  var init_dist = __esm({
12404
- "../../node_modules/.pnpm/@profullstack+hqtui@0.5.0/node_modules/@profullstack/hqtui/dist/index.js"() {
12772
+ "../../node_modules/.pnpm/@profullstack+hqtui@0.7.0/node_modules/@profullstack/hqtui/dist/index.js"() {
12405
12773
  "use strict";
12406
12774
  init_app();
12407
12775
  init_color();
@@ -12688,20 +13056,27 @@ function initialState(now = Date.now()) {
12688
13056
  busy: false,
12689
13057
  moduleIndex: 0,
12690
13058
  moduleFilter: null,
13059
+ sourceFilter: null,
12691
13060
  showNoise: false
12692
13061
  };
12693
13062
  }
12694
13063
  function isNoise(event) {
12695
- return (event.severity === "low" || event.severity === "info") && /^Client error 4\d\d:/.test(event.message);
13064
+ if (event.severity !== "low" && event.severity !== "info") return false;
13065
+ if (/^Client error 4\d\d:/.test(event.message)) return true;
13066
+ return /\b(veth|docker|br-|cni|cali|flannel|vxlan)[\w.-]*: entered (promiscuous|allmulticast) mode|\(unregistering\): left (promiscuous|allmulticast) mode/.test(event.message);
13067
+ }
13068
+ function matchesFilters(state, e) {
13069
+ return (!state.moduleFilter || e.module === state.moduleFilter) && (!state.sourceFilter || e.source_ip === state.sourceFilter);
12696
13070
  }
12697
13071
  function visibleEvents(state) {
12698
- return state.events.filter(
12699
- (e) => (!state.moduleFilter || e.module === state.moduleFilter) && (state.showNoise || !isNoise(e))
12700
- );
13072
+ return state.events.filter((e) => matchesFilters(state, e) && (state.showNoise || !isNoise(e)));
12701
13073
  }
12702
13074
  function hiddenNoise(state) {
12703
13075
  if (state.showNoise) return 0;
12704
- return state.events.filter((e) => (!state.moduleFilter || e.module === state.moduleFilter) && isNoise(e)).length;
13076
+ return state.events.filter((e) => matchesFilters(state, e) && isNoise(e)).length;
13077
+ }
13078
+ function hasFilter(state) {
13079
+ return Boolean(state.moduleFilter || state.sourceFilter);
12705
13080
  }
12706
13081
  function isBanned(state, ip) {
12707
13082
  return state.bans.some((b) => b.ip === ip);
@@ -12838,6 +13213,14 @@ function reducer(state, action) {
12838
13213
  }
12839
13214
  case "clear_module_filter":
12840
13215
  return { ...state, moduleFilter: null, scrollBack: 0 };
13216
+ case "toggle_source_filter": {
13217
+ const ip = selectedIp(state);
13218
+ if (!ip) return state;
13219
+ const sourceFilter = state.sourceFilter === ip ? null : ip;
13220
+ return { ...state, sourceFilter, scrollBack: 0 };
13221
+ }
13222
+ case "clear_source_filter":
13223
+ return { ...state, sourceFilter: null, scrollBack: 0 };
12841
13224
  case "toggle_noise":
12842
13225
  return { ...state, showNoise: !state.showNoise, scrollBack: 0 };
12843
13226
  case "counters":
@@ -12873,6 +13256,7 @@ function reducer(state, action) {
12873
13256
  firewall: state.firewall,
12874
13257
  focus: state.focus,
12875
13258
  moduleFilter: state.moduleFilter,
13259
+ sourceFilter: state.sourceFilter,
12876
13260
  moduleIndex: state.moduleIndex,
12877
13261
  showNoise: state.showNoise
12878
13262
  };
@@ -13168,13 +13552,17 @@ function noiseNote(state) {
13168
13552
  const hidden = hiddenNoise(state);
13169
13553
  return hidden > 0 ? `${hidden} routine 4xx hidden \xB7 n shows` : void 0;
13170
13554
  }
13555
+ function filterLabel(state) {
13556
+ return [state.moduleFilter, state.sourceFilter ? `src ${state.sourceFilter}` : null].filter(Boolean).join(" \xB7 ");
13557
+ }
13171
13558
  function feedPanel(parent, state, theme, options) {
13172
13559
  const following = state.scrollBack === 0;
13173
13560
  const shown = visibleEvents(state);
13174
- const filtered = state.moduleFilter !== null;
13561
+ const filtered = hasFilter(state);
13562
+ const label = filterLabel(state);
13175
13563
  parent.panel(
13176
13564
  {
13177
- title: filtered ? ` LIVE EVENTS \xB7 ${state.moduleFilter} ` : " LIVE EVENTS ",
13565
+ title: filtered ? ` LIVE EVENTS \xB7 ${label} ` : " LIVE EVENTS ",
13178
13566
  size: "2.4fr",
13179
13567
  border: "rounded",
13180
13568
  borderColor: state.connection === "live" ? theme.borderFocused : theme.border,
@@ -13186,7 +13574,7 @@ function feedPanel(parent, state, theme, options) {
13186
13574
  (panel) => {
13187
13575
  if (filtered && shown.length === 0 && state.events.length > 0) {
13188
13576
  panel.spacer(1);
13189
- panel.text(`No events from ${state.moduleFilter} yet.`, { fg: theme.muted, align: "center" });
13577
+ panel.text(`No events from ${label} yet.`, { fg: theme.muted, align: "center" });
13190
13578
  panel.spacer(1);
13191
13579
  panel.label("esc shows everything again", { fg: theme.muted, align: "center" });
13192
13580
  return;
@@ -13239,7 +13627,7 @@ function threatsPanel(parent, state, theme, options) {
13239
13627
  border: "rounded",
13240
13628
  borderColor: focused ? theme.borderFocused : theme.border,
13241
13629
  titleColor: theme.primary,
13242
- subtitle: focused ? "b ban \xB7 u unban" : void 0,
13630
+ subtitle: focused ? "click filters feed \xB7 b ban \xB7 u unban" : void 0,
13243
13631
  subtitleColor: theme.muted,
13244
13632
  padding: [0, 1]
13245
13633
  },
@@ -13264,12 +13652,13 @@ function threatsPanel(parent, state, theme, options) {
13264
13652
  onSelectRow: options.onThreatSelect,
13265
13653
  columns: [
13266
13654
  {
13267
- // A source is either banned, protected, or neither — and which one
13268
- // it is decides what the b key will do to it.
13655
+ // ▶ marks the source the feed is filtered to; otherwise the glyph
13656
+ // says whether this source is banned, protected, or neither — which
13657
+ // decides what the b key will do to it.
13269
13658
  key: "ip",
13270
13659
  width: 2,
13271
- render: (s) => isBanned(state, s.ip) ? "\u2716" : isProtectedRow(state, s.ip) ? "\u26CA" : " ",
13272
- color: (s) => isBanned(state, s.ip) ? severityColors.critical : isProtectedRow(state, s.ip) ? theme.success : theme.muted
13660
+ render: (s) => state.sourceFilter === s.ip ? "\u25B6" : isBanned(state, s.ip) ? "\u2716" : isProtectedRow(state, s.ip) ? "\u26CA" : " ",
13661
+ color: (s) => state.sourceFilter === s.ip ? theme.primary : isBanned(state, s.ip) ? severityColors.critical : isProtectedRow(state, s.ip) ? theme.success : theme.muted
13273
13662
  },
13274
13663
  { key: "ip", width: "fill", color: () => theme.foreground },
13275
13664
  {
@@ -13334,7 +13723,7 @@ function bansPanel(parent, state, theme, options) {
13334
13723
  }
13335
13724
  if (state.bans.length === 0) {
13336
13725
  panel.label("nothing banned", { fg: theme.muted });
13337
- panel.label(fw.dry_run ? "dry-run: bans are simulated" : "bans: 1m \u2192 2m \u2192 3m \u2192 5m \u2192 8m", {
13726
+ panel.label(fw.dry_run ? "dry-run: bans are simulated" : "bans: 5m \u2192 10m \u2192 20m \u2192 40m", {
13338
13727
  fg: fw.dry_run ? severityColors.medium : theme.muted
13339
13728
  });
13340
13729
  return;
@@ -13399,7 +13788,7 @@ function footer(ui, state, theme) {
13399
13788
  { key: "q", label: "quit" },
13400
13789
  { key: "tab", label: state.focus },
13401
13790
  { key: "\u2191\u2193", label: onFeed ? "scroll" : "select" },
13402
- ...state.focus === "modules" ? [{ key: "\u23CE", label: state.moduleFilter ? "unfilter" : "filter" }] : [{ key: "b", label: "ban" }, { key: "u", label: "unban" }],
13791
+ ...state.focus === "modules" ? [{ key: "\u23CE", label: state.moduleFilter ? "unfilter" : "filter" }] : state.focus === "threats" || state.focus === "bans" ? [{ key: "\u23CE", label: state.sourceFilter ? "unfilter" : "filter" }, { key: "b", label: "ban" }, { key: "u", label: "unban" }] : [{ key: "b", label: "ban" }, { key: "u", label: "unban" }],
13403
13792
  { key: "p", label: state.paused ? "resume" : "pause" },
13404
13793
  { key: "r", label: "reset" },
13405
13794
  { key: "n", label: state.showNoise ? "hide 4xx" : "show 4xx" }
@@ -13413,6 +13802,7 @@ function footer(ui, state, theme) {
13413
13802
  color: severityColors.medium
13414
13803
  },
13415
13804
  { label: state.moduleFilter ? `filter: ${state.moduleFilter}` : "", color: theme.primary },
13805
+ { label: state.sourceFilter ? `src: ${state.sourceFilter}` : "", color: theme.primary },
13416
13806
  {
13417
13807
  label: state.firewall ? `${state.bans.length} banned${state.firewall.dry_run ? " (dry-run)" : ""}` : "",
13418
13808
  color: state.firewall?.dry_run ? severityColors.medium : theme.muted
@@ -13647,7 +14037,8 @@ async function startDashboard(options = {}) {
13647
14037
  app.on("key", (event) => {
13648
14038
  switch (event.key) {
13649
14039
  case "escape":
13650
- if (state.moduleFilter) dispatch({ type: "clear_module_filter" });
14040
+ if (state.sourceFilter) dispatch({ type: "clear_source_filter" });
14041
+ else if (state.moduleFilter) dispatch({ type: "clear_module_filter" });
13651
14042
  else quit();
13652
14043
  break;
13653
14044
  case "q":
@@ -13656,7 +14047,8 @@ async function startDashboard(options = {}) {
13656
14047
  break;
13657
14048
  case "enter":
13658
14049
  case "return":
13659
- dispatch({ type: "toggle_module_filter" });
14050
+ if (state.focus === "modules") dispatch({ type: "toggle_module_filter" });
14051
+ else if (state.focus === "threats" || state.focus === "bans") dispatch({ type: "toggle_source_filter" });
13660
14052
  break;
13661
14053
  case "p":
13662
14054
  case "space":
@@ -13705,15 +14097,18 @@ async function startDashboard(options = {}) {
13705
14097
  renderDashboard(ui, state, theme, {
13706
14098
  demo: options.demo,
13707
14099
  onFeedScroll: (delta) => dispatch({ type: "scroll", delta: -delta }),
13708
- // One click both focuses the panel and picks the row — the operator
13709
- // should not have to click to focus and click again to select.
14100
+ // One click focuses the panel, picks the row, and filters the feed to that
14101
+ // source — "what has this one IP done" in a single click. Clicking the
14102
+ // same row again clears the filter.
13710
14103
  onThreatSelect: (row) => {
13711
14104
  dispatch({ type: "focus", focus: "threats" });
13712
14105
  dispatch({ type: "select_at", index: row });
14106
+ dispatch({ type: "toggle_source_filter" });
13713
14107
  },
13714
14108
  onBanSelect: (row) => {
13715
14109
  dispatch({ type: "focus", focus: "bans" });
13716
14110
  dispatch({ type: "select_at", index: row });
14111
+ dispatch({ type: "toggle_source_filter" });
13717
14112
  },
13718
14113
  // One click on a module both selects it and pins the feed to it; a
13719
14114
  // second click on the same module releases the feed.
@@ -23535,7 +23930,7 @@ function ansiRegex({ onlyFirst = false } = {}) {
23535
23930
 
23536
23931
  // ../../node_modules/.pnpm/strip-ansi@7.2.0/node_modules/strip-ansi/index.js
23537
23932
  var regex = ansiRegex();
23538
- function stripAnsi(string) {
23933
+ function stripAnsi2(string) {
23539
23934
  if (typeof string !== "string") {
23540
23935
  throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
23541
23936
  }
@@ -23652,7 +24047,7 @@ function stringWidth2(string, options = {}) {
23652
24047
  countAnsiEscapeCodes = false
23653
24048
  } = options;
23654
24049
  if (!countAnsiEscapeCodes) {
23655
- string = stripAnsi(string);
24050
+ string = stripAnsi2(string);
23656
24051
  }
23657
24052
  if (string.length === 0) {
23658
24053
  return 0;
@@ -23899,7 +24294,7 @@ var Ora = class {
23899
24294
  const fullSuffixText = this.#getFullSuffixText(this.#suffixText, "-");
23900
24295
  const fullText = " ".repeat(this.#indent) + fullPrefixText + "--" + this.#text + "--" + fullSuffixText;
23901
24296
  this.#lineCount = 0;
23902
- for (const line of stripAnsi(fullText).split("\n")) {
24297
+ for (const line of stripAnsi2(fullText).split("\n")) {
23903
24298
  this.#lineCount += Math.max(1, Math.ceil(stringWidth2(line, { countAnsiEscapeCodes: true }) / columns));
23904
24299
  }
23905
24300
  }
@@ -33462,6 +33857,39 @@ var DEFAULT_RULES = [
33462
33857
  description: "Block source IP performing exploit probes"
33463
33858
  },
33464
33859
  enabled: true
33860
+ },
33861
+ {
33862
+ // A real network card entering promiscuous mode can mean someone is
33863
+ // sniffing traffic on the host. The kernel also logs this constantly for
33864
+ // container veth/bridge interfaces, which is normal (a bridge port must be
33865
+ // promiscuous to forward frames), so the negative lookahead excludes every
33866
+ // virtual interface kind and only a physical/primary NIC trips this.
33867
+ id: "nic-promiscuous-mode",
33868
+ title: "Network Interface Entered Promiscuous Mode",
33869
+ description: "A non-virtual network interface entered promiscuous mode, which can indicate packet sniffing",
33870
+ version: "1.0.0",
33871
+ category: "system",
33872
+ severity: "medium",
33873
+ source_types: ["user-journal", "system"],
33874
+ match: {
33875
+ field: "message",
33876
+ operator: "regex",
33877
+ // "[kernel] enp11s0: entered promiscuous mode" trips; veth*, docker*,
33878
+ // br-*, bridge, lo, tap*, vxlan*, cni*, cali*, flannel*, virbr*, kube*
33879
+ // and tailscale* do not.
33880
+ value: "\\b(?!veth|docker|br-|bridge|lo:|lo\\b|tap|vxlan|cni|cali|flannel|virbr|kube|tailscale)[A-Za-z][\\w.-]*: entered promiscuous mode"
33881
+ },
33882
+ threshold: 1,
33883
+ window_seconds: 60,
33884
+ // A legitimate tcpdump flaps it; do not re-alert for an hour.
33885
+ cooldown_seconds: 3600,
33886
+ tags: ["system", "network", "sniffing", "host-integrity"],
33887
+ remediation: {
33888
+ // Host integrity, no attacker address to ban — surface it, do not block.
33889
+ action: "alert",
33890
+ description: "Confirm whether a capture tool or new bridge is expected on this host"
33891
+ },
33892
+ enabled: true
33465
33893
  }
33466
33894
  ];
33467
33895
 
@@ -34990,7 +35418,7 @@ function nextSteps() {
34990
35418
  }
34991
35419
  steps.push({
34992
35420
  heading: "Open the live dashboard",
34993
- hint: "react-blessed TUI \u2014 subscribes to events from the daemon.",
35421
+ hint: "hqtui dashboard \u2014 subscribes to events from the daemon.",
34994
35422
  cmd: "threatcrush tui"
34995
35423
  });
34996
35424
  return steps;