@willh/copilotstatusline 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15800,6 +15800,191 @@ var init_catalog = __esm(() => {
15800
15800
  cache = new Map;
15801
15801
  });
15802
15802
 
15803
+ // src/utils/ansi.ts
15804
+ function styleText(value, foreground, background = "none", bold = false, colorLevel = 2) {
15805
+ if (colorLevel === 0 || value === "") {
15806
+ return value;
15807
+ }
15808
+ const codes = [];
15809
+ if (bold) {
15810
+ codes.push(1);
15811
+ }
15812
+ const foregroundCode = foregroundCodes[foreground];
15813
+ const backgroundCode = backgroundCodes[background];
15814
+ if (foregroundCode !== null) {
15815
+ codes.push(foregroundCode);
15816
+ }
15817
+ if (backgroundCode !== null) {
15818
+ codes.push(backgroundCode);
15819
+ }
15820
+ return codes.length === 0 ? value : `\x1B[${codes.join(";")}m${value}\x1B[0m`;
15821
+ }
15822
+ function powerlineArrow(value, foreground, background, colorLevel) {
15823
+ return styleText(value, foreground, background, false, colorLevel);
15824
+ }
15825
+ var foregroundCodes, backgroundCodes;
15826
+ var init_ansi = __esm(() => {
15827
+ foregroundCodes = {
15828
+ none: null,
15829
+ black: 30,
15830
+ red: 31,
15831
+ green: 32,
15832
+ yellow: 33,
15833
+ blue: 34,
15834
+ magenta: 35,
15835
+ cyan: 36,
15836
+ white: 37,
15837
+ brightBlack: 90,
15838
+ brightRed: 91,
15839
+ brightGreen: 92,
15840
+ brightYellow: 93,
15841
+ brightBlue: 94,
15842
+ brightMagenta: 95,
15843
+ brightCyan: 96,
15844
+ brightWhite: 97
15845
+ };
15846
+ backgroundCodes = {
15847
+ none: null,
15848
+ black: 40,
15849
+ red: 41,
15850
+ green: 42,
15851
+ yellow: 43,
15852
+ blue: 44,
15853
+ magenta: 45,
15854
+ cyan: 46,
15855
+ white: 47,
15856
+ brightBlack: 100,
15857
+ brightRed: 101,
15858
+ brightGreen: 102,
15859
+ brightYellow: 103,
15860
+ brightBlue: 104,
15861
+ brightMagenta: 105,
15862
+ brightCyan: 106,
15863
+ brightWhite: 107
15864
+ };
15865
+ });
15866
+
15867
+ // src/utils/renderer.ts
15868
+ function terminalWidth(override) {
15869
+ if (override !== undefined && override > 0) {
15870
+ return override;
15871
+ }
15872
+ const fromEnvironment = Number(process.env.COLUMNS);
15873
+ if (Number.isFinite(fromEnvironment) && fromEnvironment > 0) {
15874
+ return fromEnvironment;
15875
+ }
15876
+ return process.stdout.columns > 0 ? process.stdout.columns : 120;
15877
+ }
15878
+ function truncate(value, width) {
15879
+ if (width <= 0) {
15880
+ return "";
15881
+ }
15882
+ if (visibleWidth(value) <= width) {
15883
+ return value;
15884
+ }
15885
+ if (width === 1) {
15886
+ return "…";
15887
+ }
15888
+ const reset = value.includes("\x1B[") ? "\x1B[0m" : "";
15889
+ return `${sliceAnsi(value, 0, width - 1)}…${reset}`;
15890
+ }
15891
+ function renderStandardLine(widgets, settings, status, width) {
15892
+ const parts = widgets.flatMap((widget2) => {
15893
+ const value = renderWidget(widget2, {
15894
+ status,
15895
+ terminalWidth: width,
15896
+ gitCacheTtlSeconds: settings.gitCacheTtlSeconds
15897
+ });
15898
+ if (value === null) {
15899
+ return [];
15900
+ }
15901
+ return [{
15902
+ widget: widget2,
15903
+ value: value === FLEX ? FLEX : styleText(value, widget2.color, widget2.backgroundColor, widget2.bold, settings.colorLevel)
15904
+ }];
15905
+ });
15906
+ let output = "";
15907
+ for (const [index, part] of parts.entries()) {
15908
+ const previous = parts[index - 1];
15909
+ const needsSeparator = index > 0 && part.value !== FLEX && previous?.value !== FLEX && !part.widget.merge;
15910
+ if (needsSeparator) {
15911
+ output += settings.defaultSeparator;
15912
+ }
15913
+ output += part.value;
15914
+ }
15915
+ if (output.includes(FLEX)) {
15916
+ const fixedWidth = visibleWidth(output.replaceAll(FLEX, ""));
15917
+ const flexCount = output.split(FLEX).length - 1;
15918
+ const available = Math.max(1, width - fixedWidth);
15919
+ const each = Math.floor(available / flexCount);
15920
+ let remainder = available % flexCount;
15921
+ output = output.replaceAll(FLEX, () => {
15922
+ const spaces = each + (remainder > 0 ? 1 : 0);
15923
+ remainder = Math.max(0, remainder - 1);
15924
+ return " ".repeat(spaces);
15925
+ });
15926
+ }
15927
+ return truncate(output, width);
15928
+ }
15929
+ function renderPowerlineLine(widgets, settings, status, width) {
15930
+ const rendered = widgets.flatMap((widget2, index) => {
15931
+ const value = renderWidget(widget2, {
15932
+ status,
15933
+ terminalWidth: width,
15934
+ gitCacheTtlSeconds: settings.gitCacheTtlSeconds
15935
+ });
15936
+ if (value === null) {
15937
+ return [];
15938
+ }
15939
+ if (value === FLEX) {
15940
+ return [{ value, background: "none" }];
15941
+ }
15942
+ const background = widget2.backgroundColor === "none" ? POWERLINE_BACKGROUNDS[index % POWERLINE_BACKGROUNDS.length] ?? "blue" : widget2.backgroundColor;
15943
+ const foreground = background === "yellow" || background === "brightYellow" ? "black" : "brightWhite";
15944
+ return [{
15945
+ value: styleText(` ${value} `, foreground, background, widget2.bold, settings.colorLevel),
15946
+ background
15947
+ }];
15948
+ });
15949
+ let output = "";
15950
+ for (const [index, part] of rendered.entries()) {
15951
+ if (part.value === FLEX) {
15952
+ output += FLEX;
15953
+ continue;
15954
+ }
15955
+ output += part.value;
15956
+ const next = rendered[index + 1];
15957
+ const nextBackground = next?.value === FLEX ? "none" : next?.background ?? "none";
15958
+ output += powerlineArrow(settings.powerline.separator, part.background, nextBackground, settings.colorLevel);
15959
+ }
15960
+ if (output.includes(FLEX)) {
15961
+ const available = Math.max(1, width - visibleWidth(output.replaceAll(FLEX, "")));
15962
+ output = output.replaceAll(FLEX, " ".repeat(available));
15963
+ }
15964
+ return truncate(output, width);
15965
+ }
15966
+ function renderStatusLines(status, settings, options = {}) {
15967
+ const width = terminalWidth(options.terminalWidth);
15968
+ return settings.lines.flatMap((line) => {
15969
+ const rendered = settings.powerline.enabled ? renderPowerlineLine(line, settings, status, width) : renderStandardLine(line, settings, status, width);
15970
+ return visibleWidth(rendered) === 0 ? [] : [rendered];
15971
+ });
15972
+ }
15973
+ var FLEX = "__COPILOTSTATUSLINE_FLEX__", POWERLINE_BACKGROUNDS;
15974
+ var init_renderer = __esm(() => {
15975
+ init_slice_ansi();
15976
+ init_catalog();
15977
+ init_ansi();
15978
+ init_format();
15979
+ POWERLINE_BACKGROUNDS = [
15980
+ "blue",
15981
+ "magenta",
15982
+ "cyan",
15983
+ "green",
15984
+ "yellow"
15985
+ ];
15986
+ });
15987
+
15803
15988
  // node_modules/react/cjs/react.development.js
15804
15989
  var require_react_development = __commonJS((exports, module) => {
15805
15990
  (function() {
@@ -50772,7 +50957,7 @@ var renderer = (node, isScreenReaderEnabled) => {
50772
50957
  staticOutput: ""
50773
50958
  };
50774
50959
  }, renderer_default;
50775
- var init_renderer = __esm(async () => {
50960
+ var init_renderer2 = __esm(async () => {
50776
50961
  init_output();
50777
50962
  await init_render_node_to_output();
50778
50963
  renderer_default = renderer;
@@ -51907,7 +52092,7 @@ var init_ink = __esm(async () => {
51907
52092
  await __promiseAll([
51908
52093
  init_src(),
51909
52094
  init_reconciler(),
51910
- init_renderer(),
52095
+ init_renderer2(),
51911
52096
  init_dom()
51912
52097
  ]);
51913
52098
  import_react13 = __toESM(require_react(), 1);
@@ -51968,6 +52153,13 @@ var init_Static = __esm(() => {
51968
52153
  });
51969
52154
 
51970
52155
  // node_modules/ink/build/components/Transform.js
52156
+ function Transform({ children, transform: transform3, accessibilityLabel }) {
52157
+ const { isScreenReaderEnabled } = import_react15.useContext(accessibilityContext);
52158
+ if (children === undefined || children === null) {
52159
+ return null;
52160
+ }
52161
+ return import_react15.default.createElement("ink-text", { style: { flexGrow: 0, flexShrink: 1, flexDirection: "row" }, internal_transform: transform3 }, isScreenReaderEnabled && accessibilityLabel ? accessibilityLabel : children);
52162
+ }
51971
52163
  var import_react15;
51972
52164
  var init_Transform = __esm(() => {
51973
52165
  init_AccessibilityContext();
@@ -52310,534 +52502,9 @@ var init_build2 = __esm(async () => {
52310
52502
  ]);
52311
52503
  });
52312
52504
 
52313
- // node_modules/is-unicode-supported/index.js
52314
- import process14 from "node:process";
52315
- function isUnicodeSupported() {
52316
- const { env: env3 } = process14;
52317
- const { TERM, TERM_PROGRAM } = env3;
52318
- if (process14.platform !== "win32") {
52319
- return TERM !== "linux";
52320
- }
52321
- return Boolean(env3.WT_SESSION) || Boolean(env3.TERMINUS_SUBLIME) || env3.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env3.TERMINAL_EMULATOR === "JetBrains-JediTerm";
52322
- }
52323
- var init_is_unicode_supported = () => {};
52324
-
52325
- // node_modules/figures/index.js
52326
- var common, specialMainSymbols, specialFallbackSymbols, mainSymbols, fallbackSymbols, shouldUseMain, figures, figures_default, replacements;
52327
- var init_figures = __esm(() => {
52328
- init_is_unicode_supported();
52329
- common = {
52330
- circleQuestionMark: "(?)",
52331
- questionMarkPrefix: "(?)",
52332
- square: "█",
52333
- squareDarkShade: "▓",
52334
- squareMediumShade: "▒",
52335
- squareLightShade: "░",
52336
- squareTop: "▀",
52337
- squareBottom: "▄",
52338
- squareLeft: "▌",
52339
- squareRight: "▐",
52340
- squareCenter: "■",
52341
- bullet: "●",
52342
- dot: "․",
52343
- ellipsis: "…",
52344
- pointerSmall: "›",
52345
- triangleUp: "▲",
52346
- triangleUpSmall: "▴",
52347
- triangleDown: "▼",
52348
- triangleDownSmall: "▾",
52349
- triangleLeftSmall: "◂",
52350
- triangleRightSmall: "▸",
52351
- home: "⌂",
52352
- heart: "♥",
52353
- musicNote: "♪",
52354
- musicNoteBeamed: "♫",
52355
- arrowUp: "↑",
52356
- arrowDown: "↓",
52357
- arrowLeft: "←",
52358
- arrowRight: "→",
52359
- arrowLeftRight: "↔",
52360
- arrowUpDown: "↕",
52361
- almostEqual: "≈",
52362
- notEqual: "≠",
52363
- lessOrEqual: "≤",
52364
- greaterOrEqual: "≥",
52365
- identical: "≡",
52366
- infinity: "∞",
52367
- subscriptZero: "₀",
52368
- subscriptOne: "₁",
52369
- subscriptTwo: "₂",
52370
- subscriptThree: "₃",
52371
- subscriptFour: "₄",
52372
- subscriptFive: "₅",
52373
- subscriptSix: "₆",
52374
- subscriptSeven: "₇",
52375
- subscriptEight: "₈",
52376
- subscriptNine: "₉",
52377
- oneHalf: "½",
52378
- oneThird: "⅓",
52379
- oneQuarter: "¼",
52380
- oneFifth: "⅕",
52381
- oneSixth: "⅙",
52382
- oneEighth: "⅛",
52383
- twoThirds: "⅔",
52384
- twoFifths: "⅖",
52385
- threeQuarters: "¾",
52386
- threeFifths: "⅗",
52387
- threeEighths: "⅜",
52388
- fourFifths: "⅘",
52389
- fiveSixths: "⅚",
52390
- fiveEighths: "⅝",
52391
- sevenEighths: "⅞",
52392
- line: "─",
52393
- lineBold: "━",
52394
- lineDouble: "═",
52395
- lineDashed0: "┄",
52396
- lineDashed1: "┅",
52397
- lineDashed2: "┈",
52398
- lineDashed3: "┉",
52399
- lineDashed4: "╌",
52400
- lineDashed5: "╍",
52401
- lineDashed6: "╴",
52402
- lineDashed7: "╶",
52403
- lineDashed8: "╸",
52404
- lineDashed9: "╺",
52405
- lineDashed10: "╼",
52406
- lineDashed11: "╾",
52407
- lineDashed12: "−",
52408
- lineDashed13: "–",
52409
- lineDashed14: "‐",
52410
- lineDashed15: "⁃",
52411
- lineVertical: "│",
52412
- lineVerticalBold: "┃",
52413
- lineVerticalDouble: "║",
52414
- lineVerticalDashed0: "┆",
52415
- lineVerticalDashed1: "┇",
52416
- lineVerticalDashed2: "┊",
52417
- lineVerticalDashed3: "┋",
52418
- lineVerticalDashed4: "╎",
52419
- lineVerticalDashed5: "╏",
52420
- lineVerticalDashed6: "╵",
52421
- lineVerticalDashed7: "╷",
52422
- lineVerticalDashed8: "╹",
52423
- lineVerticalDashed9: "╻",
52424
- lineVerticalDashed10: "╽",
52425
- lineVerticalDashed11: "╿",
52426
- lineDownLeft: "┐",
52427
- lineDownLeftArc: "╮",
52428
- lineDownBoldLeftBold: "┓",
52429
- lineDownBoldLeft: "┒",
52430
- lineDownLeftBold: "┑",
52431
- lineDownDoubleLeftDouble: "╗",
52432
- lineDownDoubleLeft: "╖",
52433
- lineDownLeftDouble: "╕",
52434
- lineDownRight: "┌",
52435
- lineDownRightArc: "╭",
52436
- lineDownBoldRightBold: "┏",
52437
- lineDownBoldRight: "┎",
52438
- lineDownRightBold: "┍",
52439
- lineDownDoubleRightDouble: "╔",
52440
- lineDownDoubleRight: "╓",
52441
- lineDownRightDouble: "╒",
52442
- lineUpLeft: "┘",
52443
- lineUpLeftArc: "╯",
52444
- lineUpBoldLeftBold: "┛",
52445
- lineUpBoldLeft: "┚",
52446
- lineUpLeftBold: "┙",
52447
- lineUpDoubleLeftDouble: "╝",
52448
- lineUpDoubleLeft: "╜",
52449
- lineUpLeftDouble: "╛",
52450
- lineUpRight: "└",
52451
- lineUpRightArc: "╰",
52452
- lineUpBoldRightBold: "┗",
52453
- lineUpBoldRight: "┖",
52454
- lineUpRightBold: "┕",
52455
- lineUpDoubleRightDouble: "╚",
52456
- lineUpDoubleRight: "╙",
52457
- lineUpRightDouble: "╘",
52458
- lineUpDownLeft: "┤",
52459
- lineUpBoldDownBoldLeftBold: "┫",
52460
- lineUpBoldDownBoldLeft: "┨",
52461
- lineUpDownLeftBold: "┥",
52462
- lineUpBoldDownLeftBold: "┩",
52463
- lineUpDownBoldLeftBold: "┪",
52464
- lineUpDownBoldLeft: "┧",
52465
- lineUpBoldDownLeft: "┦",
52466
- lineUpDoubleDownDoubleLeftDouble: "╣",
52467
- lineUpDoubleDownDoubleLeft: "╢",
52468
- lineUpDownLeftDouble: "╡",
52469
- lineUpDownRight: "├",
52470
- lineUpBoldDownBoldRightBold: "┣",
52471
- lineUpBoldDownBoldRight: "┠",
52472
- lineUpDownRightBold: "┝",
52473
- lineUpBoldDownRightBold: "┡",
52474
- lineUpDownBoldRightBold: "┢",
52475
- lineUpDownBoldRight: "┟",
52476
- lineUpBoldDownRight: "┞",
52477
- lineUpDoubleDownDoubleRightDouble: "╠",
52478
- lineUpDoubleDownDoubleRight: "╟",
52479
- lineUpDownRightDouble: "╞",
52480
- lineDownLeftRight: "┬",
52481
- lineDownBoldLeftBoldRightBold: "┳",
52482
- lineDownLeftBoldRightBold: "┯",
52483
- lineDownBoldLeftRight: "┰",
52484
- lineDownBoldLeftBoldRight: "┱",
52485
- lineDownBoldLeftRightBold: "┲",
52486
- lineDownLeftRightBold: "┮",
52487
- lineDownLeftBoldRight: "┭",
52488
- lineDownDoubleLeftDoubleRightDouble: "╦",
52489
- lineDownDoubleLeftRight: "╥",
52490
- lineDownLeftDoubleRightDouble: "╤",
52491
- lineUpLeftRight: "┴",
52492
- lineUpBoldLeftBoldRightBold: "┻",
52493
- lineUpLeftBoldRightBold: "┷",
52494
- lineUpBoldLeftRight: "┸",
52495
- lineUpBoldLeftBoldRight: "┹",
52496
- lineUpBoldLeftRightBold: "┺",
52497
- lineUpLeftRightBold: "┶",
52498
- lineUpLeftBoldRight: "┵",
52499
- lineUpDoubleLeftDoubleRightDouble: "╩",
52500
- lineUpDoubleLeftRight: "╨",
52501
- lineUpLeftDoubleRightDouble: "╧",
52502
- lineUpDownLeftRight: "┼",
52503
- lineUpBoldDownBoldLeftBoldRightBold: "╋",
52504
- lineUpDownBoldLeftBoldRightBold: "╈",
52505
- lineUpBoldDownLeftBoldRightBold: "╇",
52506
- lineUpBoldDownBoldLeftRightBold: "╊",
52507
- lineUpBoldDownBoldLeftBoldRight: "╉",
52508
- lineUpBoldDownLeftRight: "╀",
52509
- lineUpDownBoldLeftRight: "╁",
52510
- lineUpDownLeftBoldRight: "┽",
52511
- lineUpDownLeftRightBold: "┾",
52512
- lineUpBoldDownBoldLeftRight: "╂",
52513
- lineUpDownLeftBoldRightBold: "┿",
52514
- lineUpBoldDownLeftBoldRight: "╃",
52515
- lineUpBoldDownLeftRightBold: "╄",
52516
- lineUpDownBoldLeftBoldRight: "╅",
52517
- lineUpDownBoldLeftRightBold: "╆",
52518
- lineUpDoubleDownDoubleLeftDoubleRightDouble: "╬",
52519
- lineUpDoubleDownDoubleLeftRight: "╫",
52520
- lineUpDownLeftDoubleRightDouble: "╪",
52521
- lineCross: "╳",
52522
- lineBackslash: "╲",
52523
- lineSlash: "╱"
52524
- };
52525
- specialMainSymbols = {
52526
- tick: "✔",
52527
- info: "ℹ",
52528
- warning: "⚠",
52529
- cross: "✘",
52530
- squareSmall: "◻",
52531
- squareSmallFilled: "◼",
52532
- circle: "◯",
52533
- circleFilled: "◉",
52534
- circleDotted: "◌",
52535
- circleDouble: "◎",
52536
- circleCircle: "ⓞ",
52537
- circleCross: "ⓧ",
52538
- circlePipe: "Ⓘ",
52539
- radioOn: "◉",
52540
- radioOff: "◯",
52541
- checkboxOn: "☒",
52542
- checkboxOff: "☐",
52543
- checkboxCircleOn: "ⓧ",
52544
- checkboxCircleOff: "Ⓘ",
52545
- pointer: "❯",
52546
- triangleUpOutline: "△",
52547
- triangleLeft: "◀",
52548
- triangleRight: "▶",
52549
- lozenge: "◆",
52550
- lozengeOutline: "◇",
52551
- hamburger: "☰",
52552
- smiley: "㋡",
52553
- mustache: "෴",
52554
- star: "★",
52555
- play: "▶",
52556
- nodejs: "⬢",
52557
- oneSeventh: "⅐",
52558
- oneNinth: "⅑",
52559
- oneTenth: "⅒"
52560
- };
52561
- specialFallbackSymbols = {
52562
- tick: "√",
52563
- info: "i",
52564
- warning: "‼",
52565
- cross: "×",
52566
- squareSmall: "□",
52567
- squareSmallFilled: "■",
52568
- circle: "( )",
52569
- circleFilled: "(*)",
52570
- circleDotted: "( )",
52571
- circleDouble: "( )",
52572
- circleCircle: "(○)",
52573
- circleCross: "(×)",
52574
- circlePipe: "(│)",
52575
- radioOn: "(*)",
52576
- radioOff: "( )",
52577
- checkboxOn: "[×]",
52578
- checkboxOff: "[ ]",
52579
- checkboxCircleOn: "(×)",
52580
- checkboxCircleOff: "( )",
52581
- pointer: ">",
52582
- triangleUpOutline: "∆",
52583
- triangleLeft: "◄",
52584
- triangleRight: "►",
52585
- lozenge: "♦",
52586
- lozengeOutline: "◊",
52587
- hamburger: "≡",
52588
- smiley: "☺",
52589
- mustache: "┌─┐",
52590
- star: "✶",
52591
- play: "►",
52592
- nodejs: "♦",
52593
- oneSeventh: "1/7",
52594
- oneNinth: "1/9",
52595
- oneTenth: "1/10"
52596
- };
52597
- mainSymbols = { ...common, ...specialMainSymbols };
52598
- fallbackSymbols = { ...common, ...specialFallbackSymbols };
52599
- shouldUseMain = isUnicodeSupported();
52600
- figures = shouldUseMain ? mainSymbols : fallbackSymbols;
52601
- figures_default = figures;
52602
- replacements = Object.entries(specialMainSymbols);
52603
- });
52604
-
52605
- // node_modules/ink-select-input/build/Indicator.js
52606
- function Indicator({ isSelected = false }) {
52607
- return import_react26.default.createElement(Box_default, { marginRight: 1 }, isSelected ? import_react26.default.createElement(Text, { color: "blue" }, figures_default.pointer) : import_react26.default.createElement(Text, null, " "));
52608
- }
52609
- var import_react26, Indicator_default;
52610
- var init_Indicator = __esm(async () => {
52611
- init_figures();
52612
- await init_build2();
52613
- import_react26 = __toESM(require_react(), 1);
52614
- Indicator_default = Indicator;
52615
- });
52616
-
52617
- // node_modules/ink-select-input/build/Item.js
52618
- function Item({ isSelected = false, label }) {
52619
- return React11.createElement(Text, { color: isSelected ? "blue" : undefined }, label);
52620
- }
52621
- var React11, Item_default;
52622
- var init_Item = __esm(async () => {
52623
- await init_build2();
52624
- React11 = __toESM(require_react(), 1);
52625
- Item_default = Item;
52626
- });
52627
-
52628
- // node_modules/to-rotated/index.js
52629
- function toRotated(array2, steps) {
52630
- if (!Array.isArray(array2)) {
52631
- throw new TypeError(`Expected an array, got \`${typeof array2}\`.`);
52632
- }
52633
- if (!Number.isSafeInteger(steps)) {
52634
- throw new TypeError(`The \`steps\` parameter must be an integer, got ${steps}.`);
52635
- }
52636
- const { length } = array2;
52637
- if (length === 0) {
52638
- return [...array2];
52639
- }
52640
- const normalizedSteps = (steps % length + length) % length;
52641
- if (normalizedSteps === 0) {
52642
- return [...array2];
52643
- }
52644
- return [
52645
- ...array2.slice(-normalizedSteps),
52646
- ...array2.slice(0, -normalizedSteps)
52647
- ];
52648
- }
52649
-
52650
- // node_modules/ink-select-input/build/SelectInput.js
52651
- import { isDeepStrictEqual } from "node:util";
52652
- function SelectInput({ items = [], isFocused = true, initialIndex = 0, indicatorComponent = Indicator_default, itemComponent = Item_default, limit: customLimit, onSelect, onHighlight }) {
52653
- const hasLimit = typeof customLimit === "number" && items.length > customLimit;
52654
- const limit = hasLimit ? Math.min(customLimit, items.length) : items.length;
52655
- const lastIndex = limit - 1;
52656
- const [rotateIndex, setRotateIndex] = import_react27.useState(initialIndex > lastIndex ? lastIndex - initialIndex : 0);
52657
- const [selectedIndex, setSelectedIndex] = import_react27.useState(initialIndex ? initialIndex > lastIndex ? lastIndex : initialIndex : 0);
52658
- const previousItems = import_react27.useRef(items);
52659
- import_react27.useEffect(() => {
52660
- if (!isDeepStrictEqual(previousItems.current.map((item) => item.value), items.map((item) => item.value))) {
52661
- setRotateIndex(0);
52662
- setSelectedIndex(0);
52663
- }
52664
- previousItems.current = items;
52665
- }, [items]);
52666
- use_input_default(import_react27.useCallback((input, key) => {
52667
- if (input === "k" || key.upArrow) {
52668
- const lastIndex2 = (hasLimit ? limit : items.length) - 1;
52669
- const atFirstIndex = selectedIndex === 0;
52670
- const nextIndex = hasLimit ? selectedIndex : lastIndex2;
52671
- const nextRotateIndex = atFirstIndex ? rotateIndex + 1 : rotateIndex;
52672
- const nextSelectedIndex = atFirstIndex ? nextIndex : selectedIndex - 1;
52673
- setRotateIndex(nextRotateIndex);
52674
- setSelectedIndex(nextSelectedIndex);
52675
- const slicedItems2 = hasLimit ? toRotated(items, nextRotateIndex).slice(0, limit) : items;
52676
- if (typeof onHighlight === "function") {
52677
- onHighlight(slicedItems2[nextSelectedIndex]);
52678
- }
52679
- }
52680
- if (input === "j" || key.downArrow) {
52681
- const atLastIndex = selectedIndex === (hasLimit ? limit : items.length) - 1;
52682
- const nextIndex = hasLimit ? selectedIndex : 0;
52683
- const nextRotateIndex = atLastIndex ? rotateIndex - 1 : rotateIndex;
52684
- const nextSelectedIndex = atLastIndex ? nextIndex : selectedIndex + 1;
52685
- setRotateIndex(nextRotateIndex);
52686
- setSelectedIndex(nextSelectedIndex);
52687
- const slicedItems2 = hasLimit ? toRotated(items, nextRotateIndex).slice(0, limit) : items;
52688
- if (typeof onHighlight === "function") {
52689
- onHighlight(slicedItems2[nextSelectedIndex]);
52690
- }
52691
- }
52692
- if (/^[1-9]$/.test(input)) {
52693
- const targetIndex = Number.parseInt(input, 10) - 1;
52694
- const visibleItems = hasLimit ? toRotated(items, rotateIndex).slice(0, limit) : items;
52695
- if (targetIndex >= 0 && targetIndex < visibleItems.length) {
52696
- const selectedItem = visibleItems[targetIndex];
52697
- if (selectedItem) {
52698
- onSelect?.(selectedItem);
52699
- }
52700
- }
52701
- }
52702
- if (key.return) {
52703
- const slicedItems2 = hasLimit ? toRotated(items, rotateIndex).slice(0, limit) : items;
52704
- if (typeof onSelect === "function") {
52705
- onSelect(slicedItems2[selectedIndex]);
52706
- }
52707
- }
52708
- }, [
52709
- hasLimit,
52710
- limit,
52711
- rotateIndex,
52712
- selectedIndex,
52713
- items,
52714
- onSelect,
52715
- onHighlight
52716
- ]), { isActive: isFocused });
52717
- const slicedItems = hasLimit ? toRotated(items, rotateIndex).slice(0, limit) : items;
52718
- return import_react27.default.createElement(Box_default, { flexDirection: "column" }, slicedItems.map((item, index) => {
52719
- const isSelected = index === selectedIndex;
52720
- return import_react27.default.createElement(Box_default, { key: item.key ?? item.value }, import_react27.default.createElement(indicatorComponent, { isSelected }), import_react27.default.createElement(itemComponent, { ...item, isSelected }));
52721
- }));
52722
- }
52723
- var import_react27, SelectInput_default;
52724
- var init_SelectInput = __esm(async () => {
52725
- await __promiseAll([
52726
- init_build2(),
52727
- init_Indicator(),
52728
- init_Item()
52729
- ]);
52730
- import_react27 = __toESM(require_react(), 1);
52731
- SelectInput_default = SelectInput;
52732
- });
52733
-
52734
- // node_modules/ink-select-input/build/index.js
52735
- var init_build3 = __esm(async () => {
52736
- await __promiseAll([
52737
- init_Indicator(),
52738
- init_Item(),
52739
- init_SelectInput()
52740
- ]);
52741
- });
52742
-
52743
- // node_modules/ink-text-input/build/index.js
52744
- function TextInput({ value: originalValue, placeholder = "", focus = true, mask, highlightPastedText = false, showCursor = true, onChange, onSubmit }) {
52745
- const [state, setState] = import_react28.useState({
52746
- cursorOffset: (originalValue || "").length,
52747
- cursorWidth: 0
52748
- });
52749
- const { cursorOffset, cursorWidth } = state;
52750
- import_react28.useEffect(() => {
52751
- setState((previousState) => {
52752
- if (!focus || !showCursor) {
52753
- return previousState;
52754
- }
52755
- const newValue = originalValue || "";
52756
- if (previousState.cursorOffset > newValue.length - 1) {
52757
- return {
52758
- cursorOffset: newValue.length,
52759
- cursorWidth: 0
52760
- };
52761
- }
52762
- return previousState;
52763
- });
52764
- }, [originalValue, focus, showCursor]);
52765
- const cursorActualWidth = highlightPastedText ? cursorWidth : 0;
52766
- const value = mask ? mask.repeat(originalValue.length) : originalValue;
52767
- let renderedValue = value;
52768
- let renderedPlaceholder = placeholder ? source_default.grey(placeholder) : undefined;
52769
- if (showCursor && focus) {
52770
- renderedPlaceholder = placeholder.length > 0 ? source_default.inverse(placeholder[0]) + source_default.grey(placeholder.slice(1)) : source_default.inverse(" ");
52771
- renderedValue = value.length > 0 ? "" : source_default.inverse(" ");
52772
- let i = 0;
52773
- for (const char of value) {
52774
- renderedValue += i >= cursorOffset - cursorActualWidth && i <= cursorOffset ? source_default.inverse(char) : char;
52775
- i++;
52776
- }
52777
- if (value.length > 0 && cursorOffset === value.length) {
52778
- renderedValue += source_default.inverse(" ");
52779
- }
52780
- }
52781
- use_input_default((input, key) => {
52782
- if (key.upArrow || key.downArrow || key.ctrl && input === "c" || key.tab || key.shift && key.tab) {
52783
- return;
52784
- }
52785
- if (key.return) {
52786
- if (onSubmit) {
52787
- onSubmit(originalValue);
52788
- }
52789
- return;
52790
- }
52791
- let nextCursorOffset = cursorOffset;
52792
- let nextValue = originalValue;
52793
- let nextCursorWidth = 0;
52794
- if (key.leftArrow) {
52795
- if (showCursor) {
52796
- nextCursorOffset--;
52797
- }
52798
- } else if (key.rightArrow) {
52799
- if (showCursor) {
52800
- nextCursorOffset++;
52801
- }
52802
- } else if (key.backspace || key.delete) {
52803
- if (cursorOffset > 0) {
52804
- nextValue = originalValue.slice(0, cursorOffset - 1) + originalValue.slice(cursorOffset, originalValue.length);
52805
- nextCursorOffset--;
52806
- }
52807
- } else {
52808
- nextValue = originalValue.slice(0, cursorOffset) + input + originalValue.slice(cursorOffset, originalValue.length);
52809
- nextCursorOffset += input.length;
52810
- if (input.length > 1) {
52811
- nextCursorWidth = input.length;
52812
- }
52813
- }
52814
- if (cursorOffset < 0) {
52815
- nextCursorOffset = 0;
52816
- }
52817
- if (cursorOffset > originalValue.length) {
52818
- nextCursorOffset = originalValue.length;
52819
- }
52820
- setState({
52821
- cursorOffset: nextCursorOffset,
52822
- cursorWidth: nextCursorWidth
52823
- });
52824
- if (nextValue !== originalValue) {
52825
- onChange(nextValue);
52826
- }
52827
- }, { isActive: focus });
52828
- return import_react28.default.createElement(Text, null, placeholder ? value.length > 0 ? renderedValue : renderedPlaceholder : renderedValue);
52829
- }
52830
- var import_react28, build_default;
52831
- var init_build4 = __esm(async () => {
52832
- init_source();
52833
- await init_build2();
52834
- import_react28 = __toESM(require_react(), 1);
52835
- build_default = TextInput;
52836
- });
52837
-
52838
- // node_modules/react/cjs/react-jsx-dev-runtime.development.js
52839
- var require_react_jsx_dev_runtime_development = __commonJS((exports) => {
52840
- var React14 = __toESM(require_react());
52505
+ // node_modules/react/cjs/react-jsx-runtime.development.js
52506
+ var require_react_jsx_runtime_development = __commonJS((exports) => {
52507
+ var React10 = __toESM(require_react());
52841
52508
  (function() {
52842
52509
  function getComponentNameFromType(type) {
52843
52510
  if (type == null)
@@ -53029,17 +52696,1905 @@ React keys must be passed directly to JSX without using spread:
53029
52696
  function isValidElement(object2) {
53030
52697
  return typeof object2 === "object" && object2 !== null && object2.$$typeof === REACT_ELEMENT_TYPE;
53031
52698
  }
53032
- var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = React14.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, hasOwnProperty = Object.prototype.hasOwnProperty, isArrayImpl = Array.isArray, createTask = console.createTask ? console.createTask : function() {
52699
+ var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = React10.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, hasOwnProperty = Object.prototype.hasOwnProperty, isArrayImpl = Array.isArray, createTask = console.createTask ? console.createTask : function() {
53033
52700
  return null;
53034
52701
  };
53035
- React14 = {
52702
+ React10 = {
53036
52703
  react_stack_bottom_frame: function(callStackForError) {
53037
52704
  return callStackForError();
53038
52705
  }
53039
52706
  };
53040
52707
  var specialPropKeyWarningShown;
53041
52708
  var didWarnAboutElementRef = {};
53042
- var unknownOwnerDebugStack = React14.react_stack_bottom_frame.bind(React14, UnknownOwner)();
52709
+ var unknownOwnerDebugStack = React10.react_stack_bottom_frame.bind(React10, UnknownOwner)();
52710
+ var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
52711
+ var didWarnAboutKeySpread = {};
52712
+ exports.Fragment = REACT_FRAGMENT_TYPE;
52713
+ exports.jsx = function(type, config2, maybeKey) {
52714
+ var trackActualOwner = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
52715
+ return jsxDEVImpl(type, config2, maybeKey, false, trackActualOwner ? Error("react-stack-top-frame") : unknownOwnerDebugStack, trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask);
52716
+ };
52717
+ exports.jsxs = function(type, config2, maybeKey) {
52718
+ var trackActualOwner = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
52719
+ return jsxDEVImpl(type, config2, maybeKey, true, trackActualOwner ? Error("react-stack-top-frame") : unknownOwnerDebugStack, trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask);
52720
+ };
52721
+ })();
52722
+ });
52723
+
52724
+ // node_modules/react/jsx-runtime.js
52725
+ var require_jsx_runtime = __commonJS((exports, module) => {
52726
+ var react_jsx_runtime_development = __toESM(require_react_jsx_runtime_development());
52727
+ if (false) {} else {
52728
+ module.exports = react_jsx_runtime_development;
52729
+ }
52730
+ });
52731
+
52732
+ // node_modules/tinycolor2/cjs/tinycolor.js
52733
+ var require_tinycolor = __commonJS((exports, module) => {
52734
+ (function(global2, factory) {
52735
+ typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, global2.tinycolor = factory());
52736
+ })(exports, function() {
52737
+ function _typeof(obj) {
52738
+ "@babel/helpers - typeof";
52739
+ return _typeof = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) {
52740
+ return typeof obj2;
52741
+ } : function(obj2) {
52742
+ return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
52743
+ }, _typeof(obj);
52744
+ }
52745
+ var trimLeft = /^\s+/;
52746
+ var trimRight = /\s+$/;
52747
+ function tinycolor(color, opts) {
52748
+ color = color ? color : "";
52749
+ opts = opts || {};
52750
+ if (color instanceof tinycolor) {
52751
+ return color;
52752
+ }
52753
+ if (!(this instanceof tinycolor)) {
52754
+ return new tinycolor(color, opts);
52755
+ }
52756
+ var rgb = inputToRGB(color);
52757
+ this._originalInput = color, this._r = rgb.r, this._g = rgb.g, this._b = rgb.b, this._a = rgb.a, this._roundA = Math.round(100 * this._a) / 100, this._format = opts.format || rgb.format;
52758
+ this._gradientType = opts.gradientType;
52759
+ if (this._r < 1)
52760
+ this._r = Math.round(this._r);
52761
+ if (this._g < 1)
52762
+ this._g = Math.round(this._g);
52763
+ if (this._b < 1)
52764
+ this._b = Math.round(this._b);
52765
+ this._ok = rgb.ok;
52766
+ }
52767
+ tinycolor.prototype = {
52768
+ isDark: function isDark() {
52769
+ return this.getBrightness() < 128;
52770
+ },
52771
+ isLight: function isLight() {
52772
+ return !this.isDark();
52773
+ },
52774
+ isValid: function isValid() {
52775
+ return this._ok;
52776
+ },
52777
+ getOriginalInput: function getOriginalInput() {
52778
+ return this._originalInput;
52779
+ },
52780
+ getFormat: function getFormat() {
52781
+ return this._format;
52782
+ },
52783
+ getAlpha: function getAlpha() {
52784
+ return this._a;
52785
+ },
52786
+ getBrightness: function getBrightness() {
52787
+ var rgb = this.toRgb();
52788
+ return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;
52789
+ },
52790
+ getLuminance: function getLuminance() {
52791
+ var rgb = this.toRgb();
52792
+ var RsRGB, GsRGB, BsRGB, R, G, B;
52793
+ RsRGB = rgb.r / 255;
52794
+ GsRGB = rgb.g / 255;
52795
+ BsRGB = rgb.b / 255;
52796
+ if (RsRGB <= 0.03928)
52797
+ R = RsRGB / 12.92;
52798
+ else
52799
+ R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
52800
+ if (GsRGB <= 0.03928)
52801
+ G = GsRGB / 12.92;
52802
+ else
52803
+ G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
52804
+ if (BsRGB <= 0.03928)
52805
+ B = BsRGB / 12.92;
52806
+ else
52807
+ B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
52808
+ return 0.2126 * R + 0.7152 * G + 0.0722 * B;
52809
+ },
52810
+ setAlpha: function setAlpha(value) {
52811
+ this._a = boundAlpha(value);
52812
+ this._roundA = Math.round(100 * this._a) / 100;
52813
+ return this;
52814
+ },
52815
+ toHsv: function toHsv() {
52816
+ var hsv = rgbToHsv(this._r, this._g, this._b);
52817
+ return {
52818
+ h: hsv.h * 360,
52819
+ s: hsv.s,
52820
+ v: hsv.v,
52821
+ a: this._a
52822
+ };
52823
+ },
52824
+ toHsvString: function toHsvString() {
52825
+ var hsv = rgbToHsv(this._r, this._g, this._b);
52826
+ var h = Math.round(hsv.h * 360), s = Math.round(hsv.s * 100), v = Math.round(hsv.v * 100);
52827
+ return this._a == 1 ? "hsv(" + h + ", " + s + "%, " + v + "%)" : "hsva(" + h + ", " + s + "%, " + v + "%, " + this._roundA + ")";
52828
+ },
52829
+ toHsl: function toHsl() {
52830
+ var hsl = rgbToHsl(this._r, this._g, this._b);
52831
+ return {
52832
+ h: hsl.h * 360,
52833
+ s: hsl.s,
52834
+ l: hsl.l,
52835
+ a: this._a
52836
+ };
52837
+ },
52838
+ toHslString: function toHslString() {
52839
+ var hsl = rgbToHsl(this._r, this._g, this._b);
52840
+ var h = Math.round(hsl.h * 360), s = Math.round(hsl.s * 100), l = Math.round(hsl.l * 100);
52841
+ return this._a == 1 ? "hsl(" + h + ", " + s + "%, " + l + "%)" : "hsla(" + h + ", " + s + "%, " + l + "%, " + this._roundA + ")";
52842
+ },
52843
+ toHex: function toHex(allow3Char) {
52844
+ return rgbToHex(this._r, this._g, this._b, allow3Char);
52845
+ },
52846
+ toHexString: function toHexString(allow3Char) {
52847
+ return "#" + this.toHex(allow3Char);
52848
+ },
52849
+ toHex8: function toHex8(allow4Char) {
52850
+ return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);
52851
+ },
52852
+ toHex8String: function toHex8String(allow4Char) {
52853
+ return "#" + this.toHex8(allow4Char);
52854
+ },
52855
+ toRgb: function toRgb() {
52856
+ return {
52857
+ r: Math.round(this._r),
52858
+ g: Math.round(this._g),
52859
+ b: Math.round(this._b),
52860
+ a: this._a
52861
+ };
52862
+ },
52863
+ toRgbString: function toRgbString() {
52864
+ return this._a == 1 ? "rgb(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ")" : "rgba(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ", " + this._roundA + ")";
52865
+ },
52866
+ toPercentageRgb: function toPercentageRgb() {
52867
+ return {
52868
+ r: Math.round(bound01(this._r, 255) * 100) + "%",
52869
+ g: Math.round(bound01(this._g, 255) * 100) + "%",
52870
+ b: Math.round(bound01(this._b, 255) * 100) + "%",
52871
+ a: this._a
52872
+ };
52873
+ },
52874
+ toPercentageRgbString: function toPercentageRgbString() {
52875
+ return this._a == 1 ? "rgb(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%)" : "rgba(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")";
52876
+ },
52877
+ toName: function toName() {
52878
+ if (this._a === 0) {
52879
+ return "transparent";
52880
+ }
52881
+ if (this._a < 1) {
52882
+ return false;
52883
+ }
52884
+ return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
52885
+ },
52886
+ toFilter: function toFilter(secondColor) {
52887
+ var hex8String = "#" + rgbaToArgbHex(this._r, this._g, this._b, this._a);
52888
+ var secondHex8String = hex8String;
52889
+ var gradientType = this._gradientType ? "GradientType = 1, " : "";
52890
+ if (secondColor) {
52891
+ var s = tinycolor(secondColor);
52892
+ secondHex8String = "#" + rgbaToArgbHex(s._r, s._g, s._b, s._a);
52893
+ }
52894
+ return "progid:DXImageTransform.Microsoft.gradient(" + gradientType + "startColorstr=" + hex8String + ",endColorstr=" + secondHex8String + ")";
52895
+ },
52896
+ toString: function toString2(format) {
52897
+ var formatSet = !!format;
52898
+ format = format || this._format;
52899
+ var formattedString = false;
52900
+ var hasAlpha = this._a < 1 && this._a >= 0;
52901
+ var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name");
52902
+ if (needsAlphaFormat) {
52903
+ if (format === "name" && this._a === 0) {
52904
+ return this.toName();
52905
+ }
52906
+ return this.toRgbString();
52907
+ }
52908
+ if (format === "rgb") {
52909
+ formattedString = this.toRgbString();
52910
+ }
52911
+ if (format === "prgb") {
52912
+ formattedString = this.toPercentageRgbString();
52913
+ }
52914
+ if (format === "hex" || format === "hex6") {
52915
+ formattedString = this.toHexString();
52916
+ }
52917
+ if (format === "hex3") {
52918
+ formattedString = this.toHexString(true);
52919
+ }
52920
+ if (format === "hex4") {
52921
+ formattedString = this.toHex8String(true);
52922
+ }
52923
+ if (format === "hex8") {
52924
+ formattedString = this.toHex8String();
52925
+ }
52926
+ if (format === "name") {
52927
+ formattedString = this.toName();
52928
+ }
52929
+ if (format === "hsl") {
52930
+ formattedString = this.toHslString();
52931
+ }
52932
+ if (format === "hsv") {
52933
+ formattedString = this.toHsvString();
52934
+ }
52935
+ return formattedString || this.toHexString();
52936
+ },
52937
+ clone: function clone3() {
52938
+ return tinycolor(this.toString());
52939
+ },
52940
+ _applyModification: function _applyModification(fn, args) {
52941
+ var color = fn.apply(null, [this].concat([].slice.call(args)));
52942
+ this._r = color._r;
52943
+ this._g = color._g;
52944
+ this._b = color._b;
52945
+ this.setAlpha(color._a);
52946
+ return this;
52947
+ },
52948
+ lighten: function lighten() {
52949
+ return this._applyModification(_lighten, arguments);
52950
+ },
52951
+ brighten: function brighten() {
52952
+ return this._applyModification(_brighten, arguments);
52953
+ },
52954
+ darken: function darken() {
52955
+ return this._applyModification(_darken, arguments);
52956
+ },
52957
+ desaturate: function desaturate() {
52958
+ return this._applyModification(_desaturate, arguments);
52959
+ },
52960
+ saturate: function saturate() {
52961
+ return this._applyModification(_saturate, arguments);
52962
+ },
52963
+ greyscale: function greyscale() {
52964
+ return this._applyModification(_greyscale, arguments);
52965
+ },
52966
+ spin: function spin() {
52967
+ return this._applyModification(_spin, arguments);
52968
+ },
52969
+ _applyCombination: function _applyCombination(fn, args) {
52970
+ return fn.apply(null, [this].concat([].slice.call(args)));
52971
+ },
52972
+ analogous: function analogous() {
52973
+ return this._applyCombination(_analogous, arguments);
52974
+ },
52975
+ complement: function complement() {
52976
+ return this._applyCombination(_complement, arguments);
52977
+ },
52978
+ monochromatic: function monochromatic() {
52979
+ return this._applyCombination(_monochromatic, arguments);
52980
+ },
52981
+ splitcomplement: function splitcomplement() {
52982
+ return this._applyCombination(_splitcomplement, arguments);
52983
+ },
52984
+ triad: function triad() {
52985
+ return this._applyCombination(polyad, [3]);
52986
+ },
52987
+ tetrad: function tetrad() {
52988
+ return this._applyCombination(polyad, [4]);
52989
+ }
52990
+ };
52991
+ tinycolor.fromRatio = function(color, opts) {
52992
+ if (_typeof(color) == "object") {
52993
+ var newColor = {};
52994
+ for (var i in color) {
52995
+ if (color.hasOwnProperty(i)) {
52996
+ if (i === "a") {
52997
+ newColor[i] = color[i];
52998
+ } else {
52999
+ newColor[i] = convertToPercentage(color[i]);
53000
+ }
53001
+ }
53002
+ }
53003
+ color = newColor;
53004
+ }
53005
+ return tinycolor(color, opts);
53006
+ };
53007
+ function inputToRGB(color) {
53008
+ var rgb = {
53009
+ r: 0,
53010
+ g: 0,
53011
+ b: 0
53012
+ };
53013
+ var a = 1;
53014
+ var s = null;
53015
+ var v = null;
53016
+ var l = null;
53017
+ var ok = false;
53018
+ var format = false;
53019
+ if (typeof color == "string") {
53020
+ color = stringInputToObject(color);
53021
+ }
53022
+ if (_typeof(color) == "object") {
53023
+ if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
53024
+ rgb = rgbToRgb(color.r, color.g, color.b);
53025
+ ok = true;
53026
+ format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
53027
+ } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
53028
+ s = convertToPercentage(color.s);
53029
+ v = convertToPercentage(color.v);
53030
+ rgb = hsvToRgb(color.h, s, v);
53031
+ ok = true;
53032
+ format = "hsv";
53033
+ } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
53034
+ s = convertToPercentage(color.s);
53035
+ l = convertToPercentage(color.l);
53036
+ rgb = hslToRgb(color.h, s, l);
53037
+ ok = true;
53038
+ format = "hsl";
53039
+ }
53040
+ if (color.hasOwnProperty("a")) {
53041
+ a = color.a;
53042
+ }
53043
+ }
53044
+ a = boundAlpha(a);
53045
+ return {
53046
+ ok,
53047
+ format: color.format || format,
53048
+ r: Math.min(255, Math.max(rgb.r, 0)),
53049
+ g: Math.min(255, Math.max(rgb.g, 0)),
53050
+ b: Math.min(255, Math.max(rgb.b, 0)),
53051
+ a
53052
+ };
53053
+ }
53054
+ function rgbToRgb(r, g, b) {
53055
+ return {
53056
+ r: bound01(r, 255) * 255,
53057
+ g: bound01(g, 255) * 255,
53058
+ b: bound01(b, 255) * 255
53059
+ };
53060
+ }
53061
+ function rgbToHsl(r, g, b) {
53062
+ r = bound01(r, 255);
53063
+ g = bound01(g, 255);
53064
+ b = bound01(b, 255);
53065
+ var max2 = Math.max(r, g, b), min2 = Math.min(r, g, b);
53066
+ var h, s, l = (max2 + min2) / 2;
53067
+ if (max2 == min2) {
53068
+ h = s = 0;
53069
+ } else {
53070
+ var d = max2 - min2;
53071
+ s = l > 0.5 ? d / (2 - max2 - min2) : d / (max2 + min2);
53072
+ switch (max2) {
53073
+ case r:
53074
+ h = (g - b) / d + (g < b ? 6 : 0);
53075
+ break;
53076
+ case g:
53077
+ h = (b - r) / d + 2;
53078
+ break;
53079
+ case b:
53080
+ h = (r - g) / d + 4;
53081
+ break;
53082
+ }
53083
+ h /= 6;
53084
+ }
53085
+ return {
53086
+ h,
53087
+ s,
53088
+ l
53089
+ };
53090
+ }
53091
+ function hslToRgb(h, s, l) {
53092
+ var r, g, b;
53093
+ h = bound01(h, 360);
53094
+ s = bound01(s, 100);
53095
+ l = bound01(l, 100);
53096
+ function hue2rgb(p2, q2, t) {
53097
+ if (t < 0)
53098
+ t += 1;
53099
+ if (t > 1)
53100
+ t -= 1;
53101
+ if (t < 1 / 6)
53102
+ return p2 + (q2 - p2) * 6 * t;
53103
+ if (t < 1 / 2)
53104
+ return q2;
53105
+ if (t < 2 / 3)
53106
+ return p2 + (q2 - p2) * (2 / 3 - t) * 6;
53107
+ return p2;
53108
+ }
53109
+ if (s === 0) {
53110
+ r = g = b = l;
53111
+ } else {
53112
+ var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
53113
+ var p = 2 * l - q;
53114
+ r = hue2rgb(p, q, h + 1 / 3);
53115
+ g = hue2rgb(p, q, h);
53116
+ b = hue2rgb(p, q, h - 1 / 3);
53117
+ }
53118
+ return {
53119
+ r: r * 255,
53120
+ g: g * 255,
53121
+ b: b * 255
53122
+ };
53123
+ }
53124
+ function rgbToHsv(r, g, b) {
53125
+ r = bound01(r, 255);
53126
+ g = bound01(g, 255);
53127
+ b = bound01(b, 255);
53128
+ var max2 = Math.max(r, g, b), min2 = Math.min(r, g, b);
53129
+ var h, s, v = max2;
53130
+ var d = max2 - min2;
53131
+ s = max2 === 0 ? 0 : d / max2;
53132
+ if (max2 == min2) {
53133
+ h = 0;
53134
+ } else {
53135
+ switch (max2) {
53136
+ case r:
53137
+ h = (g - b) / d + (g < b ? 6 : 0);
53138
+ break;
53139
+ case g:
53140
+ h = (b - r) / d + 2;
53141
+ break;
53142
+ case b:
53143
+ h = (r - g) / d + 4;
53144
+ break;
53145
+ }
53146
+ h /= 6;
53147
+ }
53148
+ return {
53149
+ h,
53150
+ s,
53151
+ v
53152
+ };
53153
+ }
53154
+ function hsvToRgb(h, s, v) {
53155
+ h = bound01(h, 360) * 6;
53156
+ s = bound01(s, 100);
53157
+ v = bound01(v, 100);
53158
+ var i = Math.floor(h), f = h - i, p = v * (1 - s), q = v * (1 - f * s), t = v * (1 - (1 - f) * s), mod = i % 6, r = [v, q, p, p, t, v][mod], g = [t, v, v, q, p, p][mod], b = [p, p, t, v, v, q][mod];
53159
+ return {
53160
+ r: r * 255,
53161
+ g: g * 255,
53162
+ b: b * 255
53163
+ };
53164
+ }
53165
+ function rgbToHex(r, g, b, allow3Char) {
53166
+ var hex3 = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];
53167
+ if (allow3Char && hex3[0].charAt(0) == hex3[0].charAt(1) && hex3[1].charAt(0) == hex3[1].charAt(1) && hex3[2].charAt(0) == hex3[2].charAt(1)) {
53168
+ return hex3[0].charAt(0) + hex3[1].charAt(0) + hex3[2].charAt(0);
53169
+ }
53170
+ return hex3.join("");
53171
+ }
53172
+ function rgbaToHex(r, g, b, a, allow4Char) {
53173
+ var hex3 = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16)), pad2(convertDecimalToHex(a))];
53174
+ if (allow4Char && hex3[0].charAt(0) == hex3[0].charAt(1) && hex3[1].charAt(0) == hex3[1].charAt(1) && hex3[2].charAt(0) == hex3[2].charAt(1) && hex3[3].charAt(0) == hex3[3].charAt(1)) {
53175
+ return hex3[0].charAt(0) + hex3[1].charAt(0) + hex3[2].charAt(0) + hex3[3].charAt(0);
53176
+ }
53177
+ return hex3.join("");
53178
+ }
53179
+ function rgbaToArgbHex(r, g, b, a) {
53180
+ var hex3 = [pad2(convertDecimalToHex(a)), pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];
53181
+ return hex3.join("");
53182
+ }
53183
+ tinycolor.equals = function(color1, color2) {
53184
+ if (!color1 || !color2)
53185
+ return false;
53186
+ return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();
53187
+ };
53188
+ tinycolor.random = function() {
53189
+ return tinycolor.fromRatio({
53190
+ r: Math.random(),
53191
+ g: Math.random(),
53192
+ b: Math.random()
53193
+ });
53194
+ };
53195
+ function _desaturate(color, amount) {
53196
+ amount = amount === 0 ? 0 : amount || 10;
53197
+ var hsl = tinycolor(color).toHsl();
53198
+ hsl.s -= amount / 100;
53199
+ hsl.s = clamp01(hsl.s);
53200
+ return tinycolor(hsl);
53201
+ }
53202
+ function _saturate(color, amount) {
53203
+ amount = amount === 0 ? 0 : amount || 10;
53204
+ var hsl = tinycolor(color).toHsl();
53205
+ hsl.s += amount / 100;
53206
+ hsl.s = clamp01(hsl.s);
53207
+ return tinycolor(hsl);
53208
+ }
53209
+ function _greyscale(color) {
53210
+ return tinycolor(color).desaturate(100);
53211
+ }
53212
+ function _lighten(color, amount) {
53213
+ amount = amount === 0 ? 0 : amount || 10;
53214
+ var hsl = tinycolor(color).toHsl();
53215
+ hsl.l += amount / 100;
53216
+ hsl.l = clamp01(hsl.l);
53217
+ return tinycolor(hsl);
53218
+ }
53219
+ function _brighten(color, amount) {
53220
+ amount = amount === 0 ? 0 : amount || 10;
53221
+ var rgb = tinycolor(color).toRgb();
53222
+ rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
53223
+ rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
53224
+ rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
53225
+ return tinycolor(rgb);
53226
+ }
53227
+ function _darken(color, amount) {
53228
+ amount = amount === 0 ? 0 : amount || 10;
53229
+ var hsl = tinycolor(color).toHsl();
53230
+ hsl.l -= amount / 100;
53231
+ hsl.l = clamp01(hsl.l);
53232
+ return tinycolor(hsl);
53233
+ }
53234
+ function _spin(color, amount) {
53235
+ var hsl = tinycolor(color).toHsl();
53236
+ var hue = (hsl.h + amount) % 360;
53237
+ hsl.h = hue < 0 ? 360 + hue : hue;
53238
+ return tinycolor(hsl);
53239
+ }
53240
+ function _complement(color) {
53241
+ var hsl = tinycolor(color).toHsl();
53242
+ hsl.h = (hsl.h + 180) % 360;
53243
+ return tinycolor(hsl);
53244
+ }
53245
+ function polyad(color, number4) {
53246
+ if (isNaN(number4) || number4 <= 0) {
53247
+ throw new Error("Argument to polyad must be a positive number");
53248
+ }
53249
+ var hsl = tinycolor(color).toHsl();
53250
+ var result2 = [tinycolor(color)];
53251
+ var step = 360 / number4;
53252
+ for (var i = 1;i < number4; i++) {
53253
+ result2.push(tinycolor({
53254
+ h: (hsl.h + i * step) % 360,
53255
+ s: hsl.s,
53256
+ l: hsl.l
53257
+ }));
53258
+ }
53259
+ return result2;
53260
+ }
53261
+ function _splitcomplement(color) {
53262
+ var hsl = tinycolor(color).toHsl();
53263
+ var h = hsl.h;
53264
+ return [tinycolor(color), tinycolor({
53265
+ h: (h + 72) % 360,
53266
+ s: hsl.s,
53267
+ l: hsl.l
53268
+ }), tinycolor({
53269
+ h: (h + 216) % 360,
53270
+ s: hsl.s,
53271
+ l: hsl.l
53272
+ })];
53273
+ }
53274
+ function _analogous(color, results, slices) {
53275
+ results = results || 6;
53276
+ slices = slices || 30;
53277
+ var hsl = tinycolor(color).toHsl();
53278
+ var part = 360 / slices;
53279
+ var ret = [tinycolor(color)];
53280
+ for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360;--results; ) {
53281
+ hsl.h = (hsl.h + part) % 360;
53282
+ ret.push(tinycolor(hsl));
53283
+ }
53284
+ return ret;
53285
+ }
53286
+ function _monochromatic(color, results) {
53287
+ results = results || 6;
53288
+ var hsv = tinycolor(color).toHsv();
53289
+ var { h, s, v } = hsv;
53290
+ var ret = [];
53291
+ var modification = 1 / results;
53292
+ while (results--) {
53293
+ ret.push(tinycolor({
53294
+ h,
53295
+ s,
53296
+ v
53297
+ }));
53298
+ v = (v + modification) % 1;
53299
+ }
53300
+ return ret;
53301
+ }
53302
+ tinycolor.mix = function(color1, color2, amount) {
53303
+ amount = amount === 0 ? 0 : amount || 50;
53304
+ var rgb1 = tinycolor(color1).toRgb();
53305
+ var rgb2 = tinycolor(color2).toRgb();
53306
+ var p = amount / 100;
53307
+ var rgba = {
53308
+ r: (rgb2.r - rgb1.r) * p + rgb1.r,
53309
+ g: (rgb2.g - rgb1.g) * p + rgb1.g,
53310
+ b: (rgb2.b - rgb1.b) * p + rgb1.b,
53311
+ a: (rgb2.a - rgb1.a) * p + rgb1.a
53312
+ };
53313
+ return tinycolor(rgba);
53314
+ };
53315
+ tinycolor.readability = function(color1, color2) {
53316
+ var c1 = tinycolor(color1);
53317
+ var c2 = tinycolor(color2);
53318
+ return (Math.max(c1.getLuminance(), c2.getLuminance()) + 0.05) / (Math.min(c1.getLuminance(), c2.getLuminance()) + 0.05);
53319
+ };
53320
+ tinycolor.isReadable = function(color1, color2, wcag2) {
53321
+ var readability = tinycolor.readability(color1, color2);
53322
+ var wcag2Parms, out;
53323
+ out = false;
53324
+ wcag2Parms = validateWCAG2Parms(wcag2);
53325
+ switch (wcag2Parms.level + wcag2Parms.size) {
53326
+ case "AAsmall":
53327
+ case "AAAlarge":
53328
+ out = readability >= 4.5;
53329
+ break;
53330
+ case "AAlarge":
53331
+ out = readability >= 3;
53332
+ break;
53333
+ case "AAAsmall":
53334
+ out = readability >= 7;
53335
+ break;
53336
+ }
53337
+ return out;
53338
+ };
53339
+ tinycolor.mostReadable = function(baseColor, colorList, args) {
53340
+ var bestColor = null;
53341
+ var bestScore = 0;
53342
+ var readability;
53343
+ var includeFallbackColors, level, size2;
53344
+ args = args || {};
53345
+ includeFallbackColors = args.includeFallbackColors;
53346
+ level = args.level;
53347
+ size2 = args.size;
53348
+ for (var i = 0;i < colorList.length; i++) {
53349
+ readability = tinycolor.readability(baseColor, colorList[i]);
53350
+ if (readability > bestScore) {
53351
+ bestScore = readability;
53352
+ bestColor = tinycolor(colorList[i]);
53353
+ }
53354
+ }
53355
+ if (tinycolor.isReadable(baseColor, bestColor, {
53356
+ level,
53357
+ size: size2
53358
+ }) || !includeFallbackColors) {
53359
+ return bestColor;
53360
+ } else {
53361
+ args.includeFallbackColors = false;
53362
+ return tinycolor.mostReadable(baseColor, ["#fff", "#000"], args);
53363
+ }
53364
+ };
53365
+ var names = tinycolor.names = {
53366
+ aliceblue: "f0f8ff",
53367
+ antiquewhite: "faebd7",
53368
+ aqua: "0ff",
53369
+ aquamarine: "7fffd4",
53370
+ azure: "f0ffff",
53371
+ beige: "f5f5dc",
53372
+ bisque: "ffe4c4",
53373
+ black: "000",
53374
+ blanchedalmond: "ffebcd",
53375
+ blue: "00f",
53376
+ blueviolet: "8a2be2",
53377
+ brown: "a52a2a",
53378
+ burlywood: "deb887",
53379
+ burntsienna: "ea7e5d",
53380
+ cadetblue: "5f9ea0",
53381
+ chartreuse: "7fff00",
53382
+ chocolate: "d2691e",
53383
+ coral: "ff7f50",
53384
+ cornflowerblue: "6495ed",
53385
+ cornsilk: "fff8dc",
53386
+ crimson: "dc143c",
53387
+ cyan: "0ff",
53388
+ darkblue: "00008b",
53389
+ darkcyan: "008b8b",
53390
+ darkgoldenrod: "b8860b",
53391
+ darkgray: "a9a9a9",
53392
+ darkgreen: "006400",
53393
+ darkgrey: "a9a9a9",
53394
+ darkkhaki: "bdb76b",
53395
+ darkmagenta: "8b008b",
53396
+ darkolivegreen: "556b2f",
53397
+ darkorange: "ff8c00",
53398
+ darkorchid: "9932cc",
53399
+ darkred: "8b0000",
53400
+ darksalmon: "e9967a",
53401
+ darkseagreen: "8fbc8f",
53402
+ darkslateblue: "483d8b",
53403
+ darkslategray: "2f4f4f",
53404
+ darkslategrey: "2f4f4f",
53405
+ darkturquoise: "00ced1",
53406
+ darkviolet: "9400d3",
53407
+ deeppink: "ff1493",
53408
+ deepskyblue: "00bfff",
53409
+ dimgray: "696969",
53410
+ dimgrey: "696969",
53411
+ dodgerblue: "1e90ff",
53412
+ firebrick: "b22222",
53413
+ floralwhite: "fffaf0",
53414
+ forestgreen: "228b22",
53415
+ fuchsia: "f0f",
53416
+ gainsboro: "dcdcdc",
53417
+ ghostwhite: "f8f8ff",
53418
+ gold: "ffd700",
53419
+ goldenrod: "daa520",
53420
+ gray: "808080",
53421
+ green: "008000",
53422
+ greenyellow: "adff2f",
53423
+ grey: "808080",
53424
+ honeydew: "f0fff0",
53425
+ hotpink: "ff69b4",
53426
+ indianred: "cd5c5c",
53427
+ indigo: "4b0082",
53428
+ ivory: "fffff0",
53429
+ khaki: "f0e68c",
53430
+ lavender: "e6e6fa",
53431
+ lavenderblush: "fff0f5",
53432
+ lawngreen: "7cfc00",
53433
+ lemonchiffon: "fffacd",
53434
+ lightblue: "add8e6",
53435
+ lightcoral: "f08080",
53436
+ lightcyan: "e0ffff",
53437
+ lightgoldenrodyellow: "fafad2",
53438
+ lightgray: "d3d3d3",
53439
+ lightgreen: "90ee90",
53440
+ lightgrey: "d3d3d3",
53441
+ lightpink: "ffb6c1",
53442
+ lightsalmon: "ffa07a",
53443
+ lightseagreen: "20b2aa",
53444
+ lightskyblue: "87cefa",
53445
+ lightslategray: "789",
53446
+ lightslategrey: "789",
53447
+ lightsteelblue: "b0c4de",
53448
+ lightyellow: "ffffe0",
53449
+ lime: "0f0",
53450
+ limegreen: "32cd32",
53451
+ linen: "faf0e6",
53452
+ magenta: "f0f",
53453
+ maroon: "800000",
53454
+ mediumaquamarine: "66cdaa",
53455
+ mediumblue: "0000cd",
53456
+ mediumorchid: "ba55d3",
53457
+ mediumpurple: "9370db",
53458
+ mediumseagreen: "3cb371",
53459
+ mediumslateblue: "7b68ee",
53460
+ mediumspringgreen: "00fa9a",
53461
+ mediumturquoise: "48d1cc",
53462
+ mediumvioletred: "c71585",
53463
+ midnightblue: "191970",
53464
+ mintcream: "f5fffa",
53465
+ mistyrose: "ffe4e1",
53466
+ moccasin: "ffe4b5",
53467
+ navajowhite: "ffdead",
53468
+ navy: "000080",
53469
+ oldlace: "fdf5e6",
53470
+ olive: "808000",
53471
+ olivedrab: "6b8e23",
53472
+ orange: "ffa500",
53473
+ orangered: "ff4500",
53474
+ orchid: "da70d6",
53475
+ palegoldenrod: "eee8aa",
53476
+ palegreen: "98fb98",
53477
+ paleturquoise: "afeeee",
53478
+ palevioletred: "db7093",
53479
+ papayawhip: "ffefd5",
53480
+ peachpuff: "ffdab9",
53481
+ peru: "cd853f",
53482
+ pink: "ffc0cb",
53483
+ plum: "dda0dd",
53484
+ powderblue: "b0e0e6",
53485
+ purple: "800080",
53486
+ rebeccapurple: "663399",
53487
+ red: "f00",
53488
+ rosybrown: "bc8f8f",
53489
+ royalblue: "4169e1",
53490
+ saddlebrown: "8b4513",
53491
+ salmon: "fa8072",
53492
+ sandybrown: "f4a460",
53493
+ seagreen: "2e8b57",
53494
+ seashell: "fff5ee",
53495
+ sienna: "a0522d",
53496
+ silver: "c0c0c0",
53497
+ skyblue: "87ceeb",
53498
+ slateblue: "6a5acd",
53499
+ slategray: "708090",
53500
+ slategrey: "708090",
53501
+ snow: "fffafa",
53502
+ springgreen: "00ff7f",
53503
+ steelblue: "4682b4",
53504
+ tan: "d2b48c",
53505
+ teal: "008080",
53506
+ thistle: "d8bfd8",
53507
+ tomato: "ff6347",
53508
+ turquoise: "40e0d0",
53509
+ violet: "ee82ee",
53510
+ wheat: "f5deb3",
53511
+ white: "fff",
53512
+ whitesmoke: "f5f5f5",
53513
+ yellow: "ff0",
53514
+ yellowgreen: "9acd32"
53515
+ };
53516
+ var hexNames = tinycolor.hexNames = flip2(names);
53517
+ function flip2(o) {
53518
+ var flipped = {};
53519
+ for (var i in o) {
53520
+ if (o.hasOwnProperty(i)) {
53521
+ flipped[o[i]] = i;
53522
+ }
53523
+ }
53524
+ return flipped;
53525
+ }
53526
+ function boundAlpha(a) {
53527
+ a = parseFloat(a);
53528
+ if (isNaN(a) || a < 0 || a > 1) {
53529
+ a = 1;
53530
+ }
53531
+ return a;
53532
+ }
53533
+ function bound01(n, max2) {
53534
+ if (isOnePointZero(n))
53535
+ n = "100%";
53536
+ var processPercent = isPercentage(n);
53537
+ n = Math.min(max2, Math.max(0, parseFloat(n)));
53538
+ if (processPercent) {
53539
+ n = parseInt(n * max2, 10) / 100;
53540
+ }
53541
+ if (Math.abs(n - max2) < 0.000001) {
53542
+ return 1;
53543
+ }
53544
+ return n % max2 / parseFloat(max2);
53545
+ }
53546
+ function clamp01(val) {
53547
+ return Math.min(1, Math.max(0, val));
53548
+ }
53549
+ function parseIntFromHex(val) {
53550
+ return parseInt(val, 16);
53551
+ }
53552
+ function isOnePointZero(n) {
53553
+ return typeof n == "string" && n.indexOf(".") != -1 && parseFloat(n) === 1;
53554
+ }
53555
+ function isPercentage(n) {
53556
+ return typeof n === "string" && n.indexOf("%") != -1;
53557
+ }
53558
+ function pad2(c) {
53559
+ return c.length == 1 ? "0" + c : "" + c;
53560
+ }
53561
+ function convertToPercentage(n) {
53562
+ if (n <= 1) {
53563
+ n = n * 100 + "%";
53564
+ }
53565
+ return n;
53566
+ }
53567
+ function convertDecimalToHex(d) {
53568
+ return Math.round(parseFloat(d) * 255).toString(16);
53569
+ }
53570
+ function convertHexToDecimal(h) {
53571
+ return parseIntFromHex(h) / 255;
53572
+ }
53573
+ var matchers = function() {
53574
+ var CSS_INTEGER = "[-\\+]?\\d+%?";
53575
+ var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
53576
+ var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";
53577
+ var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
53578
+ var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
53579
+ return {
53580
+ CSS_UNIT: new RegExp(CSS_UNIT),
53581
+ rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
53582
+ rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
53583
+ hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
53584
+ hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
53585
+ hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
53586
+ hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
53587
+ hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
53588
+ hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
53589
+ hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
53590
+ hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
53591
+ };
53592
+ }();
53593
+ function isValidCSSUnit(color) {
53594
+ return !!matchers.CSS_UNIT.exec(color);
53595
+ }
53596
+ function stringInputToObject(color) {
53597
+ color = color.replace(trimLeft, "").replace(trimRight, "").toLowerCase();
53598
+ var named = false;
53599
+ if (names[color]) {
53600
+ color = names[color];
53601
+ named = true;
53602
+ } else if (color == "transparent") {
53603
+ return {
53604
+ r: 0,
53605
+ g: 0,
53606
+ b: 0,
53607
+ a: 0,
53608
+ format: "name"
53609
+ };
53610
+ }
53611
+ var match;
53612
+ if (match = matchers.rgb.exec(color)) {
53613
+ return {
53614
+ r: match[1],
53615
+ g: match[2],
53616
+ b: match[3]
53617
+ };
53618
+ }
53619
+ if (match = matchers.rgba.exec(color)) {
53620
+ return {
53621
+ r: match[1],
53622
+ g: match[2],
53623
+ b: match[3],
53624
+ a: match[4]
53625
+ };
53626
+ }
53627
+ if (match = matchers.hsl.exec(color)) {
53628
+ return {
53629
+ h: match[1],
53630
+ s: match[2],
53631
+ l: match[3]
53632
+ };
53633
+ }
53634
+ if (match = matchers.hsla.exec(color)) {
53635
+ return {
53636
+ h: match[1],
53637
+ s: match[2],
53638
+ l: match[3],
53639
+ a: match[4]
53640
+ };
53641
+ }
53642
+ if (match = matchers.hsv.exec(color)) {
53643
+ return {
53644
+ h: match[1],
53645
+ s: match[2],
53646
+ v: match[3]
53647
+ };
53648
+ }
53649
+ if (match = matchers.hsva.exec(color)) {
53650
+ return {
53651
+ h: match[1],
53652
+ s: match[2],
53653
+ v: match[3],
53654
+ a: match[4]
53655
+ };
53656
+ }
53657
+ if (match = matchers.hex8.exec(color)) {
53658
+ return {
53659
+ r: parseIntFromHex(match[1]),
53660
+ g: parseIntFromHex(match[2]),
53661
+ b: parseIntFromHex(match[3]),
53662
+ a: convertHexToDecimal(match[4]),
53663
+ format: named ? "name" : "hex8"
53664
+ };
53665
+ }
53666
+ if (match = matchers.hex6.exec(color)) {
53667
+ return {
53668
+ r: parseIntFromHex(match[1]),
53669
+ g: parseIntFromHex(match[2]),
53670
+ b: parseIntFromHex(match[3]),
53671
+ format: named ? "name" : "hex"
53672
+ };
53673
+ }
53674
+ if (match = matchers.hex4.exec(color)) {
53675
+ return {
53676
+ r: parseIntFromHex(match[1] + "" + match[1]),
53677
+ g: parseIntFromHex(match[2] + "" + match[2]),
53678
+ b: parseIntFromHex(match[3] + "" + match[3]),
53679
+ a: convertHexToDecimal(match[4] + "" + match[4]),
53680
+ format: named ? "name" : "hex8"
53681
+ };
53682
+ }
53683
+ if (match = matchers.hex3.exec(color)) {
53684
+ return {
53685
+ r: parseIntFromHex(match[1] + "" + match[1]),
53686
+ g: parseIntFromHex(match[2] + "" + match[2]),
53687
+ b: parseIntFromHex(match[3] + "" + match[3]),
53688
+ format: named ? "name" : "hex"
53689
+ };
53690
+ }
53691
+ return false;
53692
+ }
53693
+ function validateWCAG2Parms(parms) {
53694
+ var level, size2;
53695
+ parms = parms || {
53696
+ level: "AA",
53697
+ size: "small"
53698
+ };
53699
+ level = (parms.level || "AA").toUpperCase();
53700
+ size2 = (parms.size || "small").toLowerCase();
53701
+ if (level !== "AA" && level !== "AAA") {
53702
+ level = "AA";
53703
+ }
53704
+ if (size2 !== "small" && size2 !== "large") {
53705
+ size2 = "small";
53706
+ }
53707
+ return {
53708
+ level,
53709
+ size: size2
53710
+ };
53711
+ }
53712
+ return tinycolor;
53713
+ });
53714
+ });
53715
+
53716
+ // node_modules/tinygradient/index.js
53717
+ var require_tinygradient = __commonJS((exports, module) => {
53718
+ var tinycolor = require_tinycolor();
53719
+ var RGBA_MAX = { r: 256, g: 256, b: 256, a: 1 };
53720
+ var HSVA_MAX = { h: 360, s: 1, v: 1, a: 1 };
53721
+ function stepize(start, end, steps) {
53722
+ let step = {};
53723
+ for (let k in start) {
53724
+ if (start.hasOwnProperty(k)) {
53725
+ step[k] = steps === 0 ? 0 : (end[k] - start[k]) / steps;
53726
+ }
53727
+ }
53728
+ return step;
53729
+ }
53730
+ function interpolate(step, start, i, max2) {
53731
+ let color = {};
53732
+ for (let k in start) {
53733
+ if (start.hasOwnProperty(k)) {
53734
+ color[k] = step[k] * i + start[k];
53735
+ color[k] = color[k] < 0 ? color[k] + max2[k] : max2[k] !== 1 ? color[k] % max2[k] : color[k];
53736
+ }
53737
+ }
53738
+ return color;
53739
+ }
53740
+ function interpolateRgb(stop1, stop2, steps) {
53741
+ const start = stop1.color.toRgb();
53742
+ const end = stop2.color.toRgb();
53743
+ const step = stepize(start, end, steps);
53744
+ let gradient = [stop1.color];
53745
+ for (let i = 1;i < steps; i++) {
53746
+ const color = interpolate(step, start, i, RGBA_MAX);
53747
+ gradient.push(tinycolor(color));
53748
+ }
53749
+ return gradient;
53750
+ }
53751
+ function interpolateHsv(stop1, stop2, steps, mode) {
53752
+ const start = stop1.color.toHsv();
53753
+ const end = stop2.color.toHsv();
53754
+ if (start.s === 0 || end.s === 0) {
53755
+ return interpolateRgb(stop1, stop2, steps);
53756
+ }
53757
+ let trigonometric;
53758
+ if (typeof mode === "boolean") {
53759
+ trigonometric = mode;
53760
+ } else {
53761
+ const trigShortest = start.h < end.h && end.h - start.h < 180 || start.h > end.h && start.h - end.h > 180;
53762
+ trigonometric = mode === "long" && trigShortest || mode === "short" && !trigShortest;
53763
+ }
53764
+ const step = stepize(start, end, steps);
53765
+ let gradient = [stop1.color];
53766
+ let diff2;
53767
+ if (start.h <= end.h && !trigonometric || start.h >= end.h && trigonometric) {
53768
+ diff2 = end.h - start.h;
53769
+ } else if (trigonometric) {
53770
+ diff2 = 360 - end.h + start.h;
53771
+ } else {
53772
+ diff2 = 360 - start.h + end.h;
53773
+ }
53774
+ step.h = Math.pow(-1, trigonometric ? 1 : 0) * Math.abs(diff2) / steps;
53775
+ for (let i = 1;i < steps; i++) {
53776
+ const color = interpolate(step, start, i, HSVA_MAX);
53777
+ gradient.push(tinycolor(color));
53778
+ }
53779
+ return gradient;
53780
+ }
53781
+ function computeSubsteps(stops, steps) {
53782
+ const l = stops.length;
53783
+ steps = parseInt(steps, 10);
53784
+ if (isNaN(steps) || steps < 2) {
53785
+ throw new Error("Invalid number of steps (< 2)");
53786
+ }
53787
+ if (steps < l) {
53788
+ throw new Error("Number of steps cannot be inferior to number of stops");
53789
+ }
53790
+ let substeps = [];
53791
+ for (let i = 1;i < l; i++) {
53792
+ const step = (steps - 1) * (stops[i].pos - stops[i - 1].pos);
53793
+ substeps.push(Math.max(1, Math.round(step)));
53794
+ }
53795
+ let totalSubsteps = 1;
53796
+ for (let n = l - 1;n--; )
53797
+ totalSubsteps += substeps[n];
53798
+ while (totalSubsteps !== steps) {
53799
+ if (totalSubsteps < steps) {
53800
+ const min2 = Math.min.apply(null, substeps);
53801
+ substeps[substeps.indexOf(min2)]++;
53802
+ totalSubsteps++;
53803
+ } else {
53804
+ const max2 = Math.max.apply(null, substeps);
53805
+ substeps[substeps.indexOf(max2)]--;
53806
+ totalSubsteps--;
53807
+ }
53808
+ }
53809
+ return substeps;
53810
+ }
53811
+ function computeAt(stops, pos, method2, max2) {
53812
+ if (pos < 0 || pos > 1) {
53813
+ throw new Error("Position must be between 0 and 1");
53814
+ }
53815
+ let start, end;
53816
+ for (let i = 0, l = stops.length;i < l - 1; i++) {
53817
+ if (pos >= stops[i].pos && pos < stops[i + 1].pos) {
53818
+ start = stops[i];
53819
+ end = stops[i + 1];
53820
+ break;
53821
+ }
53822
+ }
53823
+ if (!start) {
53824
+ start = end = stops[stops.length - 1];
53825
+ }
53826
+ const step = stepize(start.color[method2](), end.color[method2](), (end.pos - start.pos) * 100);
53827
+ const color = interpolate(step, start.color[method2](), (pos - start.pos) * 100, max2);
53828
+ return tinycolor(color);
53829
+ }
53830
+
53831
+ class TinyGradient {
53832
+ constructor(stops) {
53833
+ if (stops.length < 2) {
53834
+ throw new Error("Invalid number of stops (< 2)");
53835
+ }
53836
+ const havingPositions = stops[0].pos !== undefined;
53837
+ let l = stops.length;
53838
+ let p = -1;
53839
+ let lastColorLess = false;
53840
+ this.stops = stops.map((stop, i) => {
53841
+ const hasPosition = stop.pos !== undefined;
53842
+ if (havingPositions ^ hasPosition) {
53843
+ throw new Error("Cannot mix positionned and not posionned color stops");
53844
+ }
53845
+ if (hasPosition) {
53846
+ const hasColor = stop.color !== undefined;
53847
+ if (!hasColor && (lastColorLess || i === 0 || i === l - 1)) {
53848
+ throw new Error("Cannot define two consecutive position-only stops");
53849
+ }
53850
+ lastColorLess = !hasColor;
53851
+ stop = {
53852
+ color: hasColor ? tinycolor(stop.color) : null,
53853
+ colorLess: !hasColor,
53854
+ pos: stop.pos
53855
+ };
53856
+ if (stop.pos < 0 || stop.pos > 1) {
53857
+ throw new Error("Color stops positions must be between 0 and 1");
53858
+ } else if (stop.pos < p) {
53859
+ throw new Error("Color stops positions are not ordered");
53860
+ }
53861
+ p = stop.pos;
53862
+ } else {
53863
+ stop = {
53864
+ color: tinycolor(stop.color !== undefined ? stop.color : stop),
53865
+ pos: i / (l - 1)
53866
+ };
53867
+ }
53868
+ return stop;
53869
+ });
53870
+ if (this.stops[0].pos !== 0) {
53871
+ this.stops.unshift({
53872
+ color: this.stops[0].color,
53873
+ pos: 0
53874
+ });
53875
+ l++;
53876
+ }
53877
+ if (this.stops[l - 1].pos !== 1) {
53878
+ this.stops.push({
53879
+ color: this.stops[l - 1].color,
53880
+ pos: 1
53881
+ });
53882
+ }
53883
+ }
53884
+ reverse() {
53885
+ let stops = [];
53886
+ this.stops.forEach(function(stop) {
53887
+ stops.push({
53888
+ color: stop.color,
53889
+ pos: 1 - stop.pos
53890
+ });
53891
+ });
53892
+ return new TinyGradient(stops.reverse());
53893
+ }
53894
+ loop() {
53895
+ let stops1 = [];
53896
+ let stops2 = [];
53897
+ this.stops.forEach((stop) => {
53898
+ stops1.push({
53899
+ color: stop.color,
53900
+ pos: stop.pos / 2
53901
+ });
53902
+ });
53903
+ this.stops.slice(0, -1).forEach((stop) => {
53904
+ stops2.push({
53905
+ color: stop.color,
53906
+ pos: 1 - stop.pos / 2
53907
+ });
53908
+ });
53909
+ return new TinyGradient(stops1.concat(stops2.reverse()));
53910
+ }
53911
+ rgb(steps) {
53912
+ const substeps = computeSubsteps(this.stops, steps);
53913
+ let gradient = [];
53914
+ this.stops.forEach((stop, i) => {
53915
+ if (stop.colorLess) {
53916
+ stop.color = interpolateRgb(this.stops[i - 1], this.stops[i + 1], 2)[1];
53917
+ }
53918
+ });
53919
+ for (let i = 0, l = this.stops.length;i < l - 1; i++) {
53920
+ const rgb = interpolateRgb(this.stops[i], this.stops[i + 1], substeps[i]);
53921
+ gradient.splice(gradient.length, 0, ...rgb);
53922
+ }
53923
+ gradient.push(this.stops[this.stops.length - 1].color);
53924
+ return gradient;
53925
+ }
53926
+ hsv(steps, mode) {
53927
+ const substeps = computeSubsteps(this.stops, steps);
53928
+ let gradient = [];
53929
+ this.stops.forEach((stop, i) => {
53930
+ if (stop.colorLess) {
53931
+ stop.color = interpolateHsv(this.stops[i - 1], this.stops[i + 1], 2, mode)[1];
53932
+ }
53933
+ });
53934
+ for (let i = 0, l = this.stops.length;i < l - 1; i++) {
53935
+ const hsv = interpolateHsv(this.stops[i], this.stops[i + 1], substeps[i], mode);
53936
+ gradient.splice(gradient.length, 0, ...hsv);
53937
+ }
53938
+ gradient.push(this.stops[this.stops.length - 1].color);
53939
+ return gradient;
53940
+ }
53941
+ css(mode, direction) {
53942
+ mode = mode || "linear";
53943
+ direction = direction || (mode === "linear" ? "to right" : "ellipse at center");
53944
+ let css = mode + "-gradient(" + direction;
53945
+ this.stops.forEach(function(stop) {
53946
+ css += ", " + (stop.colorLess ? "" : stop.color.toRgbString() + " ") + stop.pos * 100 + "%";
53947
+ });
53948
+ css += ")";
53949
+ return css;
53950
+ }
53951
+ rgbAt(pos) {
53952
+ return computeAt(this.stops, pos, "toRgb", RGBA_MAX);
53953
+ }
53954
+ hsvAt(pos) {
53955
+ return computeAt(this.stops, pos, "toHsv", HSVA_MAX);
53956
+ }
53957
+ }
53958
+ module.exports = function(stops) {
53959
+ if (arguments.length === 1) {
53960
+ if (!Array.isArray(arguments[0])) {
53961
+ throw new Error('"stops" is not an array');
53962
+ }
53963
+ stops = arguments[0];
53964
+ } else {
53965
+ stops = Array.prototype.slice.call(arguments);
53966
+ }
53967
+ return new TinyGradient(stops);
53968
+ };
53969
+ });
53970
+
53971
+ // node_modules/gradient-string/dist/index.js
53972
+ function applyGradient(str, gradient2, opts) {
53973
+ const options = validateOptions(opts);
53974
+ const colorsCount = Math.max(str.replace(/\s/g, "").length, gradient2.stops.length);
53975
+ const colors = getColors(gradient2, options, colorsCount);
53976
+ let result2 = "";
53977
+ for (const s of str) {
53978
+ result2 += s.match(/\s/g) ? s : source_default.hex(colors.shift()?.toHex() || "#000")(s);
53979
+ }
53980
+ return result2;
53981
+ }
53982
+ function multiline(str, gradient2, opts) {
53983
+ const options = validateOptions(opts);
53984
+ const lines = str.split(`
53985
+ `);
53986
+ const maxLength = Math.max(...lines.map((l) => l.length), gradient2.stops.length);
53987
+ const colors = getColors(gradient2, options, maxLength);
53988
+ const results = [];
53989
+ for (const line of lines) {
53990
+ const lineColors = colors.slice(0);
53991
+ let lineResult = "";
53992
+ for (const l of line) {
53993
+ lineResult += source_default.hex(lineColors.shift()?.toHex() || "#000")(l);
53994
+ }
53995
+ results.push(lineResult);
53996
+ }
53997
+ return results.join(`
53998
+ `);
53999
+ }
54000
+ function validateOptions(opts) {
54001
+ const options = { interpolation: "rgb", hsvSpin: "short", ...opts };
54002
+ if (opts !== undefined && typeof opts !== "object") {
54003
+ throw new TypeError(`Expected \`options\` to be an \`object\`, got \`${typeof opts}\``);
54004
+ }
54005
+ if (typeof options.interpolation !== "string") {
54006
+ throw new TypeError(`Expected \`options.interpolation\` to be \`rgb\` or \`hsv\`, got \`${typeof options.interpolation}\``);
54007
+ }
54008
+ if (options.interpolation.toLowerCase() === "hsv" && typeof options.hsvSpin !== "string") {
54009
+ throw new TypeError(`Expected \`options.hsvSpin\` to be a \`short\` or \`long\`, got \`${typeof options.hsvSpin}\``);
54010
+ }
54011
+ return options;
54012
+ }
54013
+ function gradientAlias(alias) {
54014
+ const result2 = (str) => gradient(...alias.colors)(str, alias.options);
54015
+ result2.multiline = (str = "") => gradient(...alias.colors).multiline(str, alias.options);
54016
+ return result2;
54017
+ }
54018
+ var import_tinygradient, gradient = (...colors) => {
54019
+ let gradient2;
54020
+ let options;
54021
+ if (colors.length === 0) {
54022
+ throw new Error("Missing gradient colors");
54023
+ }
54024
+ if (!Array.isArray(colors[0])) {
54025
+ if (colors.length === 1) {
54026
+ throw new Error(`Expected an array of colors, received ${JSON.stringify(colors[0])}`);
54027
+ }
54028
+ gradient2 = import_tinygradient.default(...colors);
54029
+ } else {
54030
+ gradient2 = import_tinygradient.default(colors[0]);
54031
+ options = validateOptions(colors[1]);
54032
+ }
54033
+ const fn = (str, deprecatedOptions) => {
54034
+ return applyGradient(str ? str.toString() : "", gradient2, deprecatedOptions ?? options);
54035
+ };
54036
+ fn.multiline = (str, deprecatedOptions) => multiline(str ? str.toString() : "", gradient2, deprecatedOptions ?? options);
54037
+ return fn;
54038
+ }, getColors = (gradient2, options, count) => {
54039
+ return options.interpolation?.toLowerCase() === "hsv" ? gradient2.hsv(count, options.hsvSpin?.toLowerCase() || false) : gradient2.rgb(count);
54040
+ }, aliases, dist_default4, atlas, cristal, teen, mind, morning, vice, passion, fruit, instagram, retro, summer, rainbow, pastel;
54041
+ var init_dist4 = __esm(() => {
54042
+ init_source();
54043
+ import_tinygradient = __toESM(require_tinygradient(), 1);
54044
+ aliases = {
54045
+ atlas: { colors: ["#feac5e", "#c779d0", "#4bc0c8"], options: {} },
54046
+ cristal: { colors: ["#bdfff3", "#4ac29a"], options: {} },
54047
+ teen: { colors: ["#77a1d3", "#79cbca", "#e684ae"], options: {} },
54048
+ mind: { colors: ["#473b7b", "#3584a7", "#30d2be"], options: {} },
54049
+ morning: { colors: ["#ff5f6d", "#ffc371"], options: { interpolation: "hsv" } },
54050
+ vice: { colors: ["#5ee7df", "#b490ca"], options: { interpolation: "hsv" } },
54051
+ passion: { colors: ["#f43b47", "#453a94"], options: {} },
54052
+ fruit: { colors: ["#ff4e50", "#f9d423"], options: {} },
54053
+ instagram: { colors: ["#833ab4", "#fd1d1d", "#fcb045"], options: {} },
54054
+ retro: {
54055
+ colors: ["#3f51b1", "#5a55ae", "#7b5fac", "#8f6aae", "#a86aa4", "#cc6b8e", "#f18271", "#f3a469", "#f7c978"],
54056
+ options: {}
54057
+ },
54058
+ summer: { colors: ["#fdbb2d", "#22c1c3"], options: {} },
54059
+ rainbow: { colors: ["#ff0000", "#ff0100"], options: { interpolation: "hsv", hsvSpin: "long" } },
54060
+ pastel: { colors: ["#74ebd5", "#74ecd5"], options: { interpolation: "hsv", hsvSpin: "long" } }
54061
+ };
54062
+ dist_default4 = gradient;
54063
+ atlas = gradientAlias(aliases.atlas);
54064
+ cristal = gradientAlias(aliases.cristal);
54065
+ teen = gradientAlias(aliases.teen);
54066
+ mind = gradientAlias(aliases.mind);
54067
+ morning = gradientAlias(aliases.morning);
54068
+ vice = gradientAlias(aliases.vice);
54069
+ passion = gradientAlias(aliases.passion);
54070
+ fruit = gradientAlias(aliases.fruit);
54071
+ instagram = gradientAlias(aliases.instagram);
54072
+ retro = gradientAlias(aliases.retro);
54073
+ summer = gradientAlias(aliases.summer);
54074
+ rainbow = gradientAlias(aliases.rainbow);
54075
+ pastel = gradientAlias(aliases.pastel);
54076
+ gradient.atlas = atlas;
54077
+ gradient.cristal = cristal;
54078
+ gradient.teen = teen;
54079
+ gradient.mind = mind;
54080
+ gradient.morning = morning;
54081
+ gradient.vice = vice;
54082
+ gradient.passion = passion;
54083
+ gradient.fruit = fruit;
54084
+ gradient.instagram = instagram;
54085
+ gradient.retro = retro;
54086
+ gradient.summer = summer;
54087
+ gradient.rainbow = rainbow;
54088
+ gradient.pastel = pastel;
54089
+ });
54090
+
54091
+ // node_modules/ink-gradient/dist/index.js
54092
+ var import_jsx_runtime, import_react26, Gradient = (props) => {
54093
+ if (props.name && props.colors) {
54094
+ throw new Error("The `name` and `colors` props are mutually exclusive");
54095
+ }
54096
+ let gradient2;
54097
+ if (props.name) {
54098
+ gradient2 = dist_default4[props.name];
54099
+ } else if (props.colors) {
54100
+ gradient2 = dist_default4(props.colors);
54101
+ } else {
54102
+ throw new Error("Either `name` or `colors` prop must be provided");
54103
+ }
54104
+ const applyGradient2 = (text) => gradient2.multiline(stripAnsi(text));
54105
+ const containsBoxDescendant = (nodeChildren) => {
54106
+ let hasBox = false;
54107
+ const search = (value) => {
54108
+ import_react26.Children.forEach(value, (child) => {
54109
+ if (hasBox) {
54110
+ return;
54111
+ }
54112
+ if (!import_react26.isValidElement(child)) {
54113
+ return;
54114
+ }
54115
+ if (child.type === Box_default) {
54116
+ hasBox = true;
54117
+ return;
54118
+ }
54119
+ const childProps = child.props;
54120
+ if (Object.hasOwn(childProps, "children")) {
54121
+ search(childProps["children"]);
54122
+ }
54123
+ });
54124
+ };
54125
+ search(nodeChildren);
54126
+ return hasBox;
54127
+ };
54128
+ const hasChildrenProp = (props2) => Object.hasOwn(props2, "children");
54129
+ const isPlainTextNode = (node) => typeof node === "string" || typeof node === "number";
54130
+ const isNonRenderableChild = (node) => node === null || node === undefined || typeof node === "boolean";
54131
+ const childrenCount = import_react26.Children.count(props.children);
54132
+ if (isPlainTextNode(props.children)) {
54133
+ return import_jsx_runtime.jsx(Transform, { transform: applyGradient2, children: props.children });
54134
+ }
54135
+ if (childrenCount === 1 && !containsBoxDescendant(props.children)) {
54136
+ return import_jsx_runtime.jsx(Transform, { transform: applyGradient2, children: props.children });
54137
+ }
54138
+ const applyGradientToChildren = (children) => {
54139
+ const nodes = [];
54140
+ let bufferedText = "";
54141
+ let nodeIndex = 0;
54142
+ const createKey = () => `gradient-node-${nodeIndex++}`;
54143
+ const pushTransformed = (node, key) => {
54144
+ nodes.push(import_jsx_runtime.jsx(Transform, { transform: applyGradient2, children: node }, key));
54145
+ };
54146
+ const flushText = () => {
54147
+ if (bufferedText === "") {
54148
+ return;
54149
+ }
54150
+ const text = bufferedText;
54151
+ bufferedText = "";
54152
+ pushTransformed(import_jsx_runtime.jsx(Text, { children: text }), createKey());
54153
+ };
54154
+ import_react26.Children.forEach(children, (child) => {
54155
+ if (isNonRenderableChild(child)) {
54156
+ return;
54157
+ }
54158
+ if (isPlainTextNode(child)) {
54159
+ bufferedText += String(child);
54160
+ return;
54161
+ }
54162
+ flushText();
54163
+ if (import_react26.isValidElement(child)) {
54164
+ const childKey = child.key ?? createKey();
54165
+ const childProps = child.props;
54166
+ if (child.type === Text) {
54167
+ pushTransformed(child, childKey);
54168
+ return;
54169
+ }
54170
+ if (child.type === Box_default) {
54171
+ if (hasChildrenProp(childProps)) {
54172
+ const childChildren = childProps["children"];
54173
+ nodes.push(import_react26.cloneElement(child, { key: childKey }, applyGradientToChildren(childChildren)));
54174
+ return;
54175
+ }
54176
+ nodes.push(import_react26.cloneElement(child, { key: childKey }));
54177
+ return;
54178
+ }
54179
+ if (hasChildrenProp(childProps)) {
54180
+ const childChildren = childProps["children"];
54181
+ if (!containsBoxDescendant(childChildren)) {
54182
+ pushTransformed(child, childKey);
54183
+ return;
54184
+ }
54185
+ nodes.push(import_react26.cloneElement(child, { key: childKey }, applyGradientToChildren(childChildren)));
54186
+ return;
54187
+ }
54188
+ pushTransformed(child, childKey);
54189
+ return;
54190
+ }
54191
+ nodes.push(child);
54192
+ });
54193
+ flushText();
54194
+ return nodes;
54195
+ };
54196
+ return import_jsx_runtime.jsx(import_jsx_runtime.Fragment, { children: applyGradientToChildren(props.children) });
54197
+ }, dist_default5;
54198
+ var init_dist5 = __esm(async () => {
54199
+ init_dist4();
54200
+ init_strip_ansi();
54201
+ await init_build2();
54202
+ import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
54203
+ import_react26 = __toESM(require_react(), 1);
54204
+ dist_default5 = Gradient;
54205
+ });
54206
+
54207
+ // node_modules/ink-text-input/build/index.js
54208
+ function TextInput({ value: originalValue, placeholder = "", focus = true, mask, highlightPastedText = false, showCursor = true, onChange, onSubmit }) {
54209
+ const [state, setState] = import_react27.useState({
54210
+ cursorOffset: (originalValue || "").length,
54211
+ cursorWidth: 0
54212
+ });
54213
+ const { cursorOffset, cursorWidth } = state;
54214
+ import_react27.useEffect(() => {
54215
+ setState((previousState) => {
54216
+ if (!focus || !showCursor) {
54217
+ return previousState;
54218
+ }
54219
+ const newValue = originalValue || "";
54220
+ if (previousState.cursorOffset > newValue.length - 1) {
54221
+ return {
54222
+ cursorOffset: newValue.length,
54223
+ cursorWidth: 0
54224
+ };
54225
+ }
54226
+ return previousState;
54227
+ });
54228
+ }, [originalValue, focus, showCursor]);
54229
+ const cursorActualWidth = highlightPastedText ? cursorWidth : 0;
54230
+ const value = mask ? mask.repeat(originalValue.length) : originalValue;
54231
+ let renderedValue = value;
54232
+ let renderedPlaceholder = placeholder ? source_default.grey(placeholder) : undefined;
54233
+ if (showCursor && focus) {
54234
+ renderedPlaceholder = placeholder.length > 0 ? source_default.inverse(placeholder[0]) + source_default.grey(placeholder.slice(1)) : source_default.inverse(" ");
54235
+ renderedValue = value.length > 0 ? "" : source_default.inverse(" ");
54236
+ let i = 0;
54237
+ for (const char of value) {
54238
+ renderedValue += i >= cursorOffset - cursorActualWidth && i <= cursorOffset ? source_default.inverse(char) : char;
54239
+ i++;
54240
+ }
54241
+ if (value.length > 0 && cursorOffset === value.length) {
54242
+ renderedValue += source_default.inverse(" ");
54243
+ }
54244
+ }
54245
+ use_input_default((input, key) => {
54246
+ if (key.upArrow || key.downArrow || key.ctrl && input === "c" || key.tab || key.shift && key.tab) {
54247
+ return;
54248
+ }
54249
+ if (key.return) {
54250
+ if (onSubmit) {
54251
+ onSubmit(originalValue);
54252
+ }
54253
+ return;
54254
+ }
54255
+ let nextCursorOffset = cursorOffset;
54256
+ let nextValue = originalValue;
54257
+ let nextCursorWidth = 0;
54258
+ if (key.leftArrow) {
54259
+ if (showCursor) {
54260
+ nextCursorOffset--;
54261
+ }
54262
+ } else if (key.rightArrow) {
54263
+ if (showCursor) {
54264
+ nextCursorOffset++;
54265
+ }
54266
+ } else if (key.backspace || key.delete) {
54267
+ if (cursorOffset > 0) {
54268
+ nextValue = originalValue.slice(0, cursorOffset - 1) + originalValue.slice(cursorOffset, originalValue.length);
54269
+ nextCursorOffset--;
54270
+ }
54271
+ } else {
54272
+ nextValue = originalValue.slice(0, cursorOffset) + input + originalValue.slice(cursorOffset, originalValue.length);
54273
+ nextCursorOffset += input.length;
54274
+ if (input.length > 1) {
54275
+ nextCursorWidth = input.length;
54276
+ }
54277
+ }
54278
+ if (cursorOffset < 0) {
54279
+ nextCursorOffset = 0;
54280
+ }
54281
+ if (cursorOffset > originalValue.length) {
54282
+ nextCursorOffset = originalValue.length;
54283
+ }
54284
+ setState({
54285
+ cursorOffset: nextCursorOffset,
54286
+ cursorWidth: nextCursorWidth
54287
+ });
54288
+ if (nextValue !== originalValue) {
54289
+ onChange(nextValue);
54290
+ }
54291
+ }, { isActive: focus });
54292
+ return import_react27.default.createElement(Text, null, placeholder ? value.length > 0 ? renderedValue : renderedPlaceholder : renderedValue);
54293
+ }
54294
+ var import_react27, build_default;
54295
+ var init_build3 = __esm(async () => {
54296
+ init_source();
54297
+ await init_build2();
54298
+ import_react27 = __toESM(require_react(), 1);
54299
+ build_default = TextInput;
54300
+ });
54301
+
54302
+ // package.json
54303
+ var package_default;
54304
+ var init_package = __esm(() => {
54305
+ package_default = {
54306
+ name: "@willh/copilotstatusline",
54307
+ version: "0.2.0",
54308
+ bugs: {
54309
+ url: "https://github.com/doggy8088/copilotstatusline/issues"
54310
+ },
54311
+ description: "A customizable status line formatter for GitHub Copilot CLI",
54312
+ main: "./dist/copilotstatusline.js",
54313
+ module: "./dist/copilotstatusline.js",
54314
+ type: "module",
54315
+ bin: {
54316
+ copilotstatusline: "./dist/copilotstatusline.js"
54317
+ },
54318
+ exports: {
54319
+ ".": {
54320
+ import: "./dist/copilotstatusline.js",
54321
+ default: "./dist/copilotstatusline.js"
54322
+ },
54323
+ "./package.json": "./package.json"
54324
+ },
54325
+ files: [
54326
+ "dist/",
54327
+ "docs/",
54328
+ "NOTICE"
54329
+ ],
54330
+ scripts: {
54331
+ start: "bun run src/copilotstatusline.ts",
54332
+ build: "rm -rf dist/* && bun build src/copilotstatusline.ts --target=node --outfile=dist/copilotstatusline.js --target-version=22",
54333
+ postbuild: "bun run scripts/replace-version.ts",
54334
+ example: "bun run src/copilotstatusline.ts < scripts/payload.example.json",
54335
+ prepublishOnly: "bun run build",
54336
+ lint: "bun tsc --noEmit && eslint . --config eslint.config.js --max-warnings=0",
54337
+ "lint:fix": "bun tsc --noEmit && eslint . --config eslint.config.js --max-warnings=0 --fix",
54338
+ docs: "typedoc",
54339
+ "docs:clean": "rm -rf typedoc"
54340
+ },
54341
+ devDependencies: {
54342
+ "@eslint/js": "^10.0.1",
54343
+ "@stylistic/eslint-plugin": "^5.2.3",
54344
+ "@types/bun": "latest",
54345
+ "@types/react": "^19.1.10",
54346
+ eslint: "^10.0.0",
54347
+ "eslint-import-resolver-typescript": "^4.4.4",
54348
+ "eslint-plugin-import-newlines": "^2.0.0",
54349
+ "eslint-plugin-import-x": "^4.16.2",
54350
+ "eslint-plugin-react": "^7.37.5",
54351
+ "eslint-plugin-react-hooks": "^7.0.1",
54352
+ globals: "^17.3.0",
54353
+ ink: "6.2.0",
54354
+ "ink-gradient": "^4.0.0",
54355
+ "ink-select-input": "^6.2.0",
54356
+ "ink-text-input": "^6.0.0",
54357
+ react: "19.2.7",
54358
+ "slice-ansi": "^7.1.2",
54359
+ "string-width": "^8.1.0",
54360
+ "strip-ansi": "^7.1.0",
54361
+ typedoc: "^0.28.12",
54362
+ typescript: "^6.0.2",
54363
+ "typescript-eslint": "^8.39.1",
54364
+ vitest: "^4.0.18",
54365
+ zod: "^4.0.17"
54366
+ },
54367
+ keywords: [
54368
+ "github-copilot",
54369
+ "copilot-cli",
54370
+ "cli",
54371
+ "status-line",
54372
+ "terminal"
54373
+ ],
54374
+ author: "",
54375
+ license: "MIT",
54376
+ repository: {
54377
+ type: "git",
54378
+ url: "git+https://github.com/doggy8088/copilotstatusline.git"
54379
+ },
54380
+ homepage: "https://github.com/doggy8088/copilotstatusline#readme",
54381
+ publishConfig: {
54382
+ access: "public"
54383
+ },
54384
+ engines: {
54385
+ node: ">=22.0.0"
54386
+ },
54387
+ trustedDependencies: [
54388
+ "unrs-resolver"
54389
+ ]
54390
+ };
54391
+ });
54392
+
54393
+ // node_modules/react/cjs/react-jsx-dev-runtime.development.js
54394
+ var require_react_jsx_dev_runtime_development = __commonJS((exports) => {
54395
+ var React11 = __toESM(require_react());
54396
+ (function() {
54397
+ function getComponentNameFromType(type) {
54398
+ if (type == null)
54399
+ return null;
54400
+ if (typeof type === "function")
54401
+ return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null;
54402
+ if (typeof type === "string")
54403
+ return type;
54404
+ switch (type) {
54405
+ case REACT_FRAGMENT_TYPE:
54406
+ return "Fragment";
54407
+ case REACT_PROFILER_TYPE:
54408
+ return "Profiler";
54409
+ case REACT_STRICT_MODE_TYPE:
54410
+ return "StrictMode";
54411
+ case REACT_SUSPENSE_TYPE:
54412
+ return "Suspense";
54413
+ case REACT_SUSPENSE_LIST_TYPE:
54414
+ return "SuspenseList";
54415
+ case REACT_ACTIVITY_TYPE:
54416
+ return "Activity";
54417
+ }
54418
+ if (typeof type === "object")
54419
+ switch (typeof type.tag === "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), type.$$typeof) {
54420
+ case REACT_PORTAL_TYPE:
54421
+ return "Portal";
54422
+ case REACT_CONTEXT_TYPE:
54423
+ return type.displayName || "Context";
54424
+ case REACT_CONSUMER_TYPE:
54425
+ return (type._context.displayName || "Context") + ".Consumer";
54426
+ case REACT_FORWARD_REF_TYPE:
54427
+ var innerType = type.render;
54428
+ type = type.displayName;
54429
+ type || (type = innerType.displayName || innerType.name || "", type = type !== "" ? "ForwardRef(" + type + ")" : "ForwardRef");
54430
+ return type;
54431
+ case REACT_MEMO_TYPE:
54432
+ return innerType = type.displayName || null, innerType !== null ? innerType : getComponentNameFromType(type.type) || "Memo";
54433
+ case REACT_LAZY_TYPE:
54434
+ innerType = type._payload;
54435
+ type = type._init;
54436
+ try {
54437
+ return getComponentNameFromType(type(innerType));
54438
+ } catch (x) {}
54439
+ }
54440
+ return null;
54441
+ }
54442
+ function testStringCoercion(value) {
54443
+ return "" + value;
54444
+ }
54445
+ function checkKeyStringCoercion(value) {
54446
+ try {
54447
+ testStringCoercion(value);
54448
+ var JSCompiler_inline_result = false;
54449
+ } catch (e) {
54450
+ JSCompiler_inline_result = true;
54451
+ }
54452
+ if (JSCompiler_inline_result) {
54453
+ JSCompiler_inline_result = console;
54454
+ var JSCompiler_temp_const = JSCompiler_inline_result.error;
54455
+ var JSCompiler_inline_result$jscomp$0 = typeof Symbol === "function" && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
54456
+ JSCompiler_temp_const.call(JSCompiler_inline_result, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", JSCompiler_inline_result$jscomp$0);
54457
+ return testStringCoercion(value);
54458
+ }
54459
+ }
54460
+ function getTaskName(type) {
54461
+ if (type === REACT_FRAGMENT_TYPE)
54462
+ return "<>";
54463
+ if (typeof type === "object" && type !== null && type.$$typeof === REACT_LAZY_TYPE)
54464
+ return "<...>";
54465
+ try {
54466
+ var name = getComponentNameFromType(type);
54467
+ return name ? "<" + name + ">" : "<...>";
54468
+ } catch (x) {
54469
+ return "<...>";
54470
+ }
54471
+ }
54472
+ function getOwner() {
54473
+ var dispatcher = ReactSharedInternals.A;
54474
+ return dispatcher === null ? null : dispatcher.getOwner();
54475
+ }
54476
+ function UnknownOwner() {
54477
+ return Error("react-stack-top-frame");
54478
+ }
54479
+ function hasValidKey(config2) {
54480
+ if (hasOwnProperty.call(config2, "key")) {
54481
+ var getter = Object.getOwnPropertyDescriptor(config2, "key").get;
54482
+ if (getter && getter.isReactWarning)
54483
+ return false;
54484
+ }
54485
+ return config2.key !== undefined;
54486
+ }
54487
+ function defineKeyPropWarningGetter(props, displayName) {
54488
+ function warnAboutAccessingKey() {
54489
+ specialPropKeyWarningShown || (specialPropKeyWarningShown = true, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", displayName));
54490
+ }
54491
+ warnAboutAccessingKey.isReactWarning = true;
54492
+ Object.defineProperty(props, "key", {
54493
+ get: warnAboutAccessingKey,
54494
+ configurable: true
54495
+ });
54496
+ }
54497
+ function elementRefGetterWithDeprecationWarning() {
54498
+ var componentName = getComponentNameFromType(this.type);
54499
+ didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = true, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."));
54500
+ componentName = this.props.ref;
54501
+ return componentName !== undefined ? componentName : null;
54502
+ }
54503
+ function ReactElement(type, key, props, owner, debugStack, debugTask) {
54504
+ var refProp = props.ref;
54505
+ type = {
54506
+ $$typeof: REACT_ELEMENT_TYPE,
54507
+ type,
54508
+ key,
54509
+ props,
54510
+ _owner: owner
54511
+ };
54512
+ (refProp !== undefined ? refProp : null) !== null ? Object.defineProperty(type, "ref", {
54513
+ enumerable: false,
54514
+ get: elementRefGetterWithDeprecationWarning
54515
+ }) : Object.defineProperty(type, "ref", { enumerable: false, value: null });
54516
+ type._store = {};
54517
+ Object.defineProperty(type._store, "validated", {
54518
+ configurable: false,
54519
+ enumerable: false,
54520
+ writable: true,
54521
+ value: 0
54522
+ });
54523
+ Object.defineProperty(type, "_debugInfo", {
54524
+ configurable: false,
54525
+ enumerable: false,
54526
+ writable: true,
54527
+ value: null
54528
+ });
54529
+ Object.defineProperty(type, "_debugStack", {
54530
+ configurable: false,
54531
+ enumerable: false,
54532
+ writable: true,
54533
+ value: debugStack
54534
+ });
54535
+ Object.defineProperty(type, "_debugTask", {
54536
+ configurable: false,
54537
+ enumerable: false,
54538
+ writable: true,
54539
+ value: debugTask
54540
+ });
54541
+ Object.freeze && (Object.freeze(type.props), Object.freeze(type));
54542
+ return type;
54543
+ }
54544
+ function jsxDEVImpl(type, config2, maybeKey, isStaticChildren, debugStack, debugTask) {
54545
+ var children = config2.children;
54546
+ if (children !== undefined)
54547
+ if (isStaticChildren)
54548
+ if (isArrayImpl(children)) {
54549
+ for (isStaticChildren = 0;isStaticChildren < children.length; isStaticChildren++)
54550
+ validateChildKeys(children[isStaticChildren]);
54551
+ Object.freeze && Object.freeze(children);
54552
+ } else
54553
+ console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
54554
+ else
54555
+ validateChildKeys(children);
54556
+ if (hasOwnProperty.call(config2, "key")) {
54557
+ children = getComponentNameFromType(type);
54558
+ var keys2 = Object.keys(config2).filter(function(k) {
54559
+ return k !== "key";
54560
+ });
54561
+ isStaticChildren = 0 < keys2.length ? "{key: someKey, " + keys2.join(": ..., ") + ": ...}" : "{key: someKey}";
54562
+ didWarnAboutKeySpread[children + isStaticChildren] || (keys2 = 0 < keys2.length ? "{" + keys2.join(": ..., ") + ": ...}" : "{}", console.error(`A props object containing a "key" prop is being spread into JSX:
54563
+ let props = %s;
54564
+ <%s {...props} />
54565
+ React keys must be passed directly to JSX without using spread:
54566
+ let props = %s;
54567
+ <%s key={someKey} {...props} />`, isStaticChildren, children, keys2, children), didWarnAboutKeySpread[children + isStaticChildren] = true);
54568
+ }
54569
+ children = null;
54570
+ maybeKey !== undefined && (checkKeyStringCoercion(maybeKey), children = "" + maybeKey);
54571
+ hasValidKey(config2) && (checkKeyStringCoercion(config2.key), children = "" + config2.key);
54572
+ if ("key" in config2) {
54573
+ maybeKey = {};
54574
+ for (var propName in config2)
54575
+ propName !== "key" && (maybeKey[propName] = config2[propName]);
54576
+ } else
54577
+ maybeKey = config2;
54578
+ children && defineKeyPropWarningGetter(maybeKey, typeof type === "function" ? type.displayName || type.name || "Unknown" : type);
54579
+ return ReactElement(type, children, maybeKey, getOwner(), debugStack, debugTask);
54580
+ }
54581
+ function validateChildKeys(node) {
54582
+ isValidElement2(node) ? node._store && (node._store.validated = 1) : typeof node === "object" && node !== null && node.$$typeof === REACT_LAZY_TYPE && (node._payload.status === "fulfilled" ? isValidElement2(node._payload.value) && node._payload.value._store && (node._payload.value._store.validated = 1) : node._store && (node._store.validated = 1));
54583
+ }
54584
+ function isValidElement2(object2) {
54585
+ return typeof object2 === "object" && object2 !== null && object2.$$typeof === REACT_ELEMENT_TYPE;
54586
+ }
54587
+ var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = React11.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, hasOwnProperty = Object.prototype.hasOwnProperty, isArrayImpl = Array.isArray, createTask = console.createTask ? console.createTask : function() {
54588
+ return null;
54589
+ };
54590
+ React11 = {
54591
+ react_stack_bottom_frame: function(callStackForError) {
54592
+ return callStackForError();
54593
+ }
54594
+ };
54595
+ var specialPropKeyWarningShown;
54596
+ var didWarnAboutElementRef = {};
54597
+ var unknownOwnerDebugStack = React11.react_stack_bottom_frame.bind(React11, UnknownOwner)();
53043
54598
  var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
53044
54599
  var didWarnAboutKeySpread = {};
53045
54600
  exports.Fragment = REACT_FRAGMENT_TYPE;
@@ -53050,21 +54605,710 @@ React keys must be passed directly to JSX without using spread:
53050
54605
  })();
53051
54606
  });
53052
54607
 
53053
- // node_modules/react/jsx-dev-runtime.js
53054
- var require_jsx_dev_runtime = __commonJS((exports, module) => {
53055
- var react_jsx_dev_runtime_development = __toESM(require_react_jsx_dev_runtime_development());
53056
- if (false) {} else {
53057
- module.exports = react_jsx_dev_runtime_development;
54608
+ // node_modules/react/jsx-dev-runtime.js
54609
+ var require_jsx_dev_runtime = __commonJS((exports, module) => {
54610
+ var react_jsx_dev_runtime_development = __toESM(require_react_jsx_dev_runtime_development());
54611
+ if (false) {} else {
54612
+ module.exports = react_jsx_dev_runtime_development;
54613
+ }
54614
+ });
54615
+
54616
+ // src/tui/components/List.tsx
54617
+ function List({
54618
+ items,
54619
+ onSelect,
54620
+ onSelectionChange,
54621
+ initialSelection = 0,
54622
+ showBackButton = false,
54623
+ color = "green",
54624
+ ...boxProps
54625
+ }) {
54626
+ const [selectedIndex, setSelectedIndex] = import_react28.useState(initialSelection);
54627
+ const latestSelectionChange = import_react28.useRef(onSelectionChange);
54628
+ const renderedItems = import_react28.useMemo(() => showBackButton ? [...items, "-", { label: "← Back", value: "back" }] : items, [items, showBackButton]);
54629
+ const selectableItems = renderedItems.filter((item) => item !== "-" && !item.disabled);
54630
+ const selectedItem = selectableItems[selectedIndex];
54631
+ const selectedValue = selectedItem?.value;
54632
+ const actualIndex = renderedItems.findIndex((item) => item === selectedItem);
54633
+ import_react28.useEffect(() => {
54634
+ latestSelectionChange.current = onSelectionChange;
54635
+ }, [onSelectionChange]);
54636
+ import_react28.useEffect(() => {
54637
+ setSelectedIndex(Math.min(initialSelection, Math.max(0, selectableItems.length - 1)));
54638
+ }, [initialSelection, selectableItems.length]);
54639
+ import_react28.useEffect(() => {
54640
+ if (selectedValue !== undefined) {
54641
+ latestSelectionChange.current?.(selectedValue, selectedIndex);
54642
+ }
54643
+ }, [selectedIndex, selectedValue]);
54644
+ use_input_default((_, key) => {
54645
+ if (selectableItems.length === 0) {
54646
+ return;
54647
+ }
54648
+ if (key.upArrow) {
54649
+ setSelectedIndex((index) => index === 0 ? selectableItems.length - 1 : index - 1);
54650
+ } else if (key.downArrow) {
54651
+ setSelectedIndex((index) => index === selectableItems.length - 1 ? 0 : index + 1);
54652
+ } else if (key.return && selectedItem !== undefined) {
54653
+ onSelect(selectedItem.value, selectedIndex);
54654
+ }
54655
+ });
54656
+ return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
54657
+ flexDirection: "column",
54658
+ ...boxProps,
54659
+ children: [
54660
+ renderedItems.map((item, index) => item === "-" ? /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
54661
+ children: " "
54662
+ }, index, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ListItem, {
54663
+ isSelected: index === actualIndex,
54664
+ color,
54665
+ disabled: item.disabled,
54666
+ children: /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
54667
+ children: [
54668
+ item.label,
54669
+ item.sublabel === undefined ? null : /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
54670
+ dimColor: index !== actualIndex,
54671
+ children: [
54672
+ " ",
54673
+ item.sublabel
54674
+ ]
54675
+ }, undefined, true, undefined, this)
54676
+ ]
54677
+ }, undefined, true, undefined, this)
54678
+ }, `${String(item.value)}-${index}`, false, undefined, this)),
54679
+ selectedItem?.description === undefined ? null : /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
54680
+ marginTop: 1,
54681
+ paddingLeft: 2,
54682
+ children: /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
54683
+ dimColor: true,
54684
+ wrap: "wrap",
54685
+ children: selectedItem.description
54686
+ }, undefined, false, undefined, this)
54687
+ }, undefined, false, undefined, this)
54688
+ ]
54689
+ }, undefined, true, undefined, this);
54690
+ }
54691
+ function ListItem({ children, isSelected, color, disabled }) {
54692
+ return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
54693
+ color: isSelected ? color : undefined,
54694
+ dimColor: disabled,
54695
+ children: [
54696
+ isSelected ? "▶ " : " ",
54697
+ children
54698
+ ]
54699
+ }, undefined, true, undefined, this);
54700
+ }
54701
+ var import_react28, jsx_dev_runtime;
54702
+ var init_List = __esm(async () => {
54703
+ await init_build2();
54704
+ import_react28 = __toESM(require_react(), 1);
54705
+ jsx_dev_runtime = __toESM(require_jsx_dev_runtime(), 1);
54706
+ });
54707
+
54708
+ // src/tui/components/ColorEditor.tsx
54709
+ function cycleColor(color, direction) {
54710
+ const current = COLORS.indexOf(color);
54711
+ const next = (current + direction + COLORS.length) % COLORS.length;
54712
+ return COLORS[next] ?? "none";
54713
+ }
54714
+ function ClearColorsConfirmation({
54715
+ onConfirm,
54716
+ onCancel
54717
+ }) {
54718
+ use_input_default((_, key) => {
54719
+ if (key.escape) {
54720
+ onCancel();
54721
+ }
54722
+ });
54723
+ return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
54724
+ flexDirection: "column",
54725
+ children: [
54726
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
54727
+ bold: true,
54728
+ color: "yellow",
54729
+ children: "Confirm Clear All Colors"
54730
+ }, undefined, false, undefined, this),
54731
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
54732
+ marginTop: 1,
54733
+ flexDirection: "column",
54734
+ children: [
54735
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
54736
+ children: "Reset every widget on this line to its default styling?"
54737
+ }, undefined, false, undefined, this),
54738
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
54739
+ color: "red",
54740
+ children: "This action cannot be undone."
54741
+ }, undefined, false, undefined, this)
54742
+ ]
54743
+ }, undefined, true, undefined, this),
54744
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(List, {
54745
+ marginTop: 1,
54746
+ color: "cyan",
54747
+ items: [
54748
+ { label: "Reset colors", value: "confirm" },
54749
+ { label: "← Cancel", value: "cancel" }
54750
+ ],
54751
+ onSelect: (value) => {
54752
+ if (value === "confirm") {
54753
+ onConfirm();
54754
+ } else {
54755
+ onCancel();
54756
+ }
54757
+ }
54758
+ }, undefined, false, undefined, this)
54759
+ ]
54760
+ }, undefined, true, undefined, this);
54761
+ }
54762
+ function resetWidgetStyle(widget2) {
54763
+ const catalog = WIDGET_CATALOG.find((entry) => entry.type === widget2.type);
54764
+ return {
54765
+ ...widget2,
54766
+ color: catalog?.defaultColor ?? "none",
54767
+ backgroundColor: "none",
54768
+ bold: false
54769
+ };
54770
+ }
54771
+ function ColorEditor({
54772
+ widgets,
54773
+ lineNumber,
54774
+ settings,
54775
+ onUpdate,
54776
+ onBack
54777
+ }) {
54778
+ const [selectedIndex, setSelectedIndex] = import_react29.useState(0);
54779
+ const [editingBackground, setEditingBackground] = import_react29.useState(false);
54780
+ const [showClearConfirmation, setShowClearConfirmation] = import_react29.useState(false);
54781
+ const selectedWidget = widgets[selectedIndex];
54782
+ const currentColor = selectedWidget === undefined ? "none" : editingBackground ? selectedWidget.backgroundColor : selectedWidget.color;
54783
+ const colorNumber = COLORS.indexOf(currentColor) + 1;
54784
+ use_input_default((input, key) => {
54785
+ if (showClearConfirmation) {
54786
+ return;
54787
+ }
54788
+ if (widgets.length === 0) {
54789
+ if (key.escape || input !== "") {
54790
+ onBack();
54791
+ }
54792
+ return;
54793
+ }
54794
+ if (key.upArrow || key.downArrow) {
54795
+ const direction = key.upArrow ? -1 : 1;
54796
+ setSelectedIndex((selectedIndex + direction + widgets.length) % widgets.length);
54797
+ } else if ((key.leftArrow || key.rightArrow) && selectedWidget !== undefined) {
54798
+ const direction = key.leftArrow ? -1 : 1;
54799
+ const field = editingBackground ? "backgroundColor" : "color";
54800
+ onUpdate(widgets.map((widget2, index) => index === selectedIndex ? { ...widget2, [field]: cycleColor(widget2[field], direction) } : widget2));
54801
+ } else if (input === "f") {
54802
+ setEditingBackground((value) => !value);
54803
+ } else if (input === "b" && selectedWidget !== undefined) {
54804
+ onUpdate(widgets.map((widget2, index) => index === selectedIndex ? { ...widget2, bold: !widget2.bold } : widget2));
54805
+ } else if (input === "r" && selectedWidget !== undefined) {
54806
+ onUpdate(widgets.map((widget2, index) => index === selectedIndex ? resetWidgetStyle(widget2) : widget2));
54807
+ } else if (input === "c") {
54808
+ setShowClearConfirmation(true);
54809
+ } else if (key.escape) {
54810
+ onBack();
54811
+ }
54812
+ });
54813
+ if (showClearConfirmation) {
54814
+ return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ClearColorsConfirmation, {
54815
+ onCancel: () => {
54816
+ setShowClearConfirmation(false);
54817
+ },
54818
+ onConfirm: () => {
54819
+ onUpdate(widgets.map(resetWidgetStyle));
54820
+ setShowClearConfirmation(false);
54821
+ }
54822
+ }, undefined, false, undefined, this);
54823
+ }
54824
+ if (widgets.length === 0) {
54825
+ return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
54826
+ flexDirection: "column",
54827
+ children: [
54828
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
54829
+ bold: true,
54830
+ children: [
54831
+ "Configure Colors — Line",
54832
+ " ",
54833
+ lineNumber
54834
+ ]
54835
+ }, undefined, true, undefined, this),
54836
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
54837
+ marginTop: 1,
54838
+ children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
54839
+ dimColor: true,
54840
+ children: "No colorable widgets in this status line."
54841
+ }, undefined, false, undefined, this)
54842
+ }, undefined, false, undefined, this),
54843
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
54844
+ dimColor: true,
54845
+ children: "Add a widget first to continue."
54846
+ }, undefined, false, undefined, this),
54847
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
54848
+ marginTop: 1,
54849
+ children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
54850
+ children: "Press any key to go back..."
54851
+ }, undefined, false, undefined, this)
54852
+ }, undefined, false, undefined, this)
54853
+ ]
54854
+ }, undefined, true, undefined, this);
54855
+ }
54856
+ const selectedName = selectedWidget === undefined ? "" : WIDGET_CATALOG.find((entry) => entry.type === selectedWidget.type)?.name ?? selectedWidget.type;
54857
+ const styleIndicators = [selectedWidget?.bold ? "[BOLD]" : null].filter((value) => value !== null).join(" ");
54858
+ return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
54859
+ flexDirection: "column",
54860
+ children: [
54861
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
54862
+ bold: true,
54863
+ children: [
54864
+ "Configure Colors — Line",
54865
+ " ",
54866
+ lineNumber,
54867
+ editingBackground ? /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
54868
+ color: "yellow",
54869
+ children: " [Background Mode]"
54870
+ }, undefined, false, undefined, this) : null
54871
+ ]
54872
+ }, undefined, true, undefined, this),
54873
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
54874
+ dimColor: true,
54875
+ children: [
54876
+ "↑↓ select, ←→ cycle",
54877
+ " ",
54878
+ editingBackground ? "background" : "foreground",
54879
+ ", (f) toggle bg/fg, (b)old, (r)eset, (c)lear all, ESC back"
54880
+ ]
54881
+ }, undefined, true, undefined, this),
54882
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
54883
+ marginTop: 1,
54884
+ children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
54885
+ children: [
54886
+ "Current",
54887
+ " ",
54888
+ editingBackground ? "background" : "foreground",
54889
+ " ",
54890
+ "(",
54891
+ colorNumber,
54892
+ "/",
54893
+ COLORS.length,
54894
+ "):",
54895
+ " ",
54896
+ styleText(currentColor === "none" ? "(none)" : currentColor, editingBackground ? "white" : currentColor, editingBackground ? currentColor : "none", false, settings.colorLevel),
54897
+ styleIndicators === "" ? null : ` ${styleIndicators}`
54898
+ ]
54899
+ }, undefined, true, undefined, this)
54900
+ }, undefined, false, undefined, this),
54901
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
54902
+ marginTop: 1,
54903
+ flexDirection: "column",
54904
+ children: widgets.map((widget2, index) => {
54905
+ const selected = index === selectedIndex;
54906
+ const label = `${index + 1}: ${WIDGET_CATALOG.find((entry) => entry.type === widget2.type)?.name ?? widget2.type}`;
54907
+ return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
54908
+ color: selected ? "green" : undefined,
54909
+ children: [
54910
+ selected ? "▶ " : " ",
54911
+ styleText(label, widget2.color, widget2.backgroundColor, widget2.bold, settings.colorLevel)
54912
+ ]
54913
+ }, widget2.id, true, undefined, this);
54914
+ })
54915
+ }, undefined, false, undefined, this),
54916
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
54917
+ marginTop: 1,
54918
+ paddingLeft: 2,
54919
+ children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
54920
+ dimColor: true,
54921
+ children: selectedName
54922
+ }, undefined, false, undefined, this)
54923
+ }, undefined, false, undefined, this)
54924
+ ]
54925
+ }, undefined, true, undefined, this);
54926
+ }
54927
+ var import_react29, jsx_dev_runtime2;
54928
+ var init_ColorEditor = __esm(async () => {
54929
+ init_Settings();
54930
+ init_ansi();
54931
+ init_catalog();
54932
+ await __promiseAll([
54933
+ init_build2(),
54934
+ init_List()
54935
+ ]);
54936
+ import_react29 = __toESM(require_react(), 1);
54937
+ jsx_dev_runtime2 = __toESM(require_jsx_dev_runtime(), 1);
54938
+ });
54939
+
54940
+ // src/tui/components/LineSelector.tsx
54941
+ function DeleteConfirmation({
54942
+ lineNumber,
54943
+ onConfirm,
54944
+ onCancel
54945
+ }) {
54946
+ use_input_default((_, key) => {
54947
+ if (key.escape) {
54948
+ onCancel();
54949
+ }
54950
+ });
54951
+ return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
54952
+ flexDirection: "column",
54953
+ children: [
54954
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
54955
+ bold: true,
54956
+ color: "yellow",
54957
+ children: "Confirm Delete Line"
54958
+ }, undefined, false, undefined, this),
54959
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
54960
+ marginTop: 1,
54961
+ children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
54962
+ children: [
54963
+ "Delete Line",
54964
+ " ",
54965
+ lineNumber,
54966
+ " ",
54967
+ "and all widgets in it?"
54968
+ ]
54969
+ }, undefined, true, undefined, this)
54970
+ }, undefined, false, undefined, this),
54971
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(List, {
54972
+ marginTop: 1,
54973
+ items: [
54974
+ { label: "Delete line", value: "confirm" },
54975
+ { label: "← Cancel", value: "cancel" }
54976
+ ],
54977
+ color: "cyan",
54978
+ onSelect: (value) => {
54979
+ if (value === "confirm") {
54980
+ onConfirm();
54981
+ } else {
54982
+ onCancel();
54983
+ }
54984
+ }
54985
+ }, undefined, false, undefined, this)
54986
+ ]
54987
+ }, undefined, true, undefined, this);
54988
+ }
54989
+ function LineSelector({
54990
+ lines,
54991
+ title = "Select Line to Edit",
54992
+ allowEditing = false,
54993
+ initialSelection = 0,
54994
+ onSelect,
54995
+ onBack,
54996
+ onLinesUpdate
54997
+ }) {
54998
+ const [selectedIndex, setSelectedIndex] = import_react30.useState(initialSelection);
54999
+ const [moveMode, setMoveMode] = import_react30.useState(false);
55000
+ const [showDeleteConfirmation, setShowDeleteConfirmation] = import_react30.useState(false);
55001
+ import_react30.useEffect(() => {
55002
+ setSelectedIndex((index) => Math.min(index, Math.max(0, lines.length - 1)));
55003
+ }, [lines.length]);
55004
+ use_input_default((input, key) => {
55005
+ if (showDeleteConfirmation) {
55006
+ return;
55007
+ }
55008
+ if (moveMode) {
55009
+ if ((key.upArrow || key.downArrow) && lines.length > 1) {
55010
+ const direction = key.upArrow ? -1 : 1;
55011
+ const target = (selectedIndex + direction + lines.length) % lines.length;
55012
+ const reordered = [...lines];
55013
+ const current = reordered[selectedIndex];
55014
+ const replacement = reordered[target];
55015
+ if (current !== undefined && replacement !== undefined) {
55016
+ reordered[selectedIndex] = replacement;
55017
+ reordered[target] = current;
55018
+ onLinesUpdate(reordered);
55019
+ setSelectedIndex(target);
55020
+ }
55021
+ } else if (key.escape || key.return) {
55022
+ setMoveMode(false);
55023
+ }
55024
+ return;
55025
+ }
55026
+ if (input === "a" && allowEditing) {
55027
+ onLinesUpdate([...lines, []]);
55028
+ setSelectedIndex(lines.length);
55029
+ } else if (input === "d" && allowEditing && lines.length > 1) {
55030
+ setShowDeleteConfirmation(true);
55031
+ } else if (input === "m" && allowEditing && lines.length > 1) {
55032
+ setMoveMode(true);
55033
+ } else if (key.escape) {
55034
+ onBack();
55035
+ }
55036
+ });
55037
+ if (showDeleteConfirmation) {
55038
+ return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(DeleteConfirmation, {
55039
+ lineNumber: selectedIndex + 1,
55040
+ onCancel: () => {
55041
+ setShowDeleteConfirmation(false);
55042
+ },
55043
+ onConfirm: () => {
55044
+ const remaining = lines.filter((_, index) => index !== selectedIndex);
55045
+ onLinesUpdate(remaining);
55046
+ setSelectedIndex(Math.max(0, selectedIndex - 1));
55047
+ setShowDeleteConfirmation(false);
55048
+ }
55049
+ }, undefined, false, undefined, this);
55050
+ }
55051
+ const lineItems = lines.map((line, index) => ({
55052
+ label: `☰ Line ${index + 1}`,
55053
+ sublabel: `(${line.length === 0 ? "empty" : `${line.length} ${line.length === 1 ? "widget" : "widgets"}`})`,
55054
+ value: index
55055
+ }));
55056
+ return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
55057
+ flexDirection: "column",
55058
+ children: [
55059
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
55060
+ bold: true,
55061
+ children: [
55062
+ title,
55063
+ moveMode ? /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
55064
+ color: "blue",
55065
+ children: " [MOVE MODE]"
55066
+ }, undefined, false, undefined, this) : null
55067
+ ]
55068
+ }, undefined, true, undefined, this),
55069
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
55070
+ dimColor: true,
55071
+ children: "Choose which status line to configure"
55072
+ }, undefined, false, undefined, this),
55073
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
55074
+ dimColor: true,
55075
+ children: moveMode ? "↑↓ to move line, ESC or Enter to exit move mode" : allowEditing ? "(a) append line, (d) delete line, (m) move line, ESC back" : "ESC to go back"
55076
+ }, undefined, false, undefined, this),
55077
+ moveMode ? /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
55078
+ marginTop: 1,
55079
+ flexDirection: "column",
55080
+ children: lineItems.map((item, index) => /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
55081
+ color: index === selectedIndex ? "blue" : undefined,
55082
+ children: [
55083
+ index === selectedIndex ? "◆ " : " ",
55084
+ item.label,
55085
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
55086
+ dimColor: index !== selectedIndex,
55087
+ children: [
55088
+ " ",
55089
+ item.sublabel
55090
+ ]
55091
+ }, undefined, true, undefined, this)
55092
+ ]
55093
+ }, item.value, true, undefined, this))
55094
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(List, {
55095
+ items: lineItems,
55096
+ marginTop: 1,
55097
+ initialSelection: selectedIndex,
55098
+ showBackButton: true,
55099
+ onSelectionChange: (_, index) => {
55100
+ setSelectedIndex(index);
55101
+ },
55102
+ onSelect: (value) => {
55103
+ if (value === "back") {
55104
+ onBack();
55105
+ } else {
55106
+ onSelect(value);
55107
+ }
55108
+ }
55109
+ }, undefined, false, undefined, this)
55110
+ ]
55111
+ }, undefined, true, undefined, this);
55112
+ }
55113
+ var import_react30, jsx_dev_runtime3;
55114
+ var init_LineSelector = __esm(async () => {
55115
+ await __promiseAll([
55116
+ init_build2(),
55117
+ init_List()
55118
+ ]);
55119
+ import_react30 = __toESM(require_react(), 1);
55120
+ jsx_dev_runtime3 = __toESM(require_jsx_dev_runtime(), 1);
55121
+ });
55122
+
55123
+ // src/tui/components/MainMenu.tsx
55124
+ function installationItem(integration) {
55125
+ if (integration?.installed === true) {
55126
+ return {
55127
+ label: "\uD83E\uDDF0 Manage Installation",
55128
+ value: "installation",
55129
+ description: "Repair, change, or remove the Copilot CLI status line command"
55130
+ };
53058
55131
  }
55132
+ return {
55133
+ label: "\uD83D\uDCE6 Install to Copilot CLI",
55134
+ value: "installation",
55135
+ description: "Add copilotstatusline to the user-level Copilot CLI settings"
55136
+ };
55137
+ }
55138
+ function menuItems(integration, hasChanges) {
55139
+ return [
55140
+ {
55141
+ label: "\uD83D\uDCDD Edit Lines",
55142
+ value: "lines",
55143
+ description: "Configure any number of status lines and choose which widgets appear in each line"
55144
+ },
55145
+ {
55146
+ label: "\uD83C\uDFA8 Edit Colors",
55147
+ value: "colors",
55148
+ description: "Customize each widget foreground, background, and bold styling"
55149
+ },
55150
+ {
55151
+ label: "⚡ Powerline Setup",
55152
+ value: "powerline",
55153
+ description: "Enable Powerline rendering and configure its separator character"
55154
+ },
55155
+ "-",
55156
+ {
55157
+ label: "\uD83D\uDCBB Terminal Options",
55158
+ value: "terminal",
55159
+ description: "Configure the terminal color level used by the formatter"
55160
+ },
55161
+ {
55162
+ label: "\uD83C\uDF10 Global Overrides",
55163
+ value: "overrides",
55164
+ description: "Set the default separator applied between widgets"
55165
+ },
55166
+ "-",
55167
+ installationItem(integration),
55168
+ "-",
55169
+ hasChanges ? {
55170
+ label: "\uD83D\uDCBE Save & Exit",
55171
+ value: "save",
55172
+ description: "Save all changes and exit the configuration tool"
55173
+ } : {
55174
+ label: "\uD83D\uDEAA Exit",
55175
+ value: "exit",
55176
+ description: "Exit the configuration tool"
55177
+ },
55178
+ ...hasChanges ? [{
55179
+ label: "❌ Exit without saving",
55180
+ value: "exit",
55181
+ description: "Discard changes made during this session"
55182
+ }] : [],
55183
+ "-",
55184
+ {
55185
+ label: "⭐ Like copilotstatusline? Star us on GitHub",
55186
+ value: "github",
55187
+ description: "Open the copilotstatusline GitHub repository in your browser"
55188
+ }
55189
+ ];
55190
+ }
55191
+ function MainMenu({
55192
+ integration,
55193
+ hasChanges,
55194
+ initialSelection = 0,
55195
+ onSelect
55196
+ }) {
55197
+ return /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Box_default, {
55198
+ flexDirection: "column",
55199
+ children: [
55200
+ /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(Text, {
55201
+ bold: true,
55202
+ children: "Main Menu"
55203
+ }, undefined, false, undefined, this),
55204
+ /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(List, {
55205
+ items: menuItems(integration, hasChanges),
55206
+ marginTop: 1,
55207
+ initialSelection,
55208
+ onSelect: (value, index) => {
55209
+ if (value !== "back") {
55210
+ onSelect(value, index);
55211
+ }
55212
+ }
55213
+ }, undefined, false, undefined, this)
55214
+ ]
55215
+ }, undefined, true, undefined, this);
55216
+ }
55217
+ var jsx_dev_runtime4;
55218
+ var init_MainMenu = __esm(async () => {
55219
+ await __promiseAll([
55220
+ init_build2(),
55221
+ init_List()
55222
+ ]);
55223
+ jsx_dev_runtime4 = __toESM(require_jsx_dev_runtime(), 1);
53059
55224
  });
53060
55225
 
53061
- // src/tui/App.tsx
55226
+ // src/tui/components/StatusLinePreview.tsx
55227
+ function StatusLinePreview({ settings, terminalWidth: terminalWidth2 }) {
55228
+ const renderedLines = import_react31.useMemo(() => renderStatusLines(PREVIEW_STATUS, settings, { terminalWidth: Math.max(1, terminalWidth2 - 2) }), [settings, terminalWidth2]);
55229
+ return /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
55230
+ flexDirection: "column",
55231
+ children: [
55232
+ /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Box_default, {
55233
+ borderStyle: "round",
55234
+ borderColor: "gray",
55235
+ borderDimColor: true,
55236
+ width: "100%",
55237
+ paddingLeft: 1,
55238
+ children: /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
55239
+ children: [
55240
+ ">",
55241
+ /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
55242
+ dimColor: true,
55243
+ children: " Preview (ctrl+s to save configuration at any time)"
55244
+ }, undefined, false, undefined, this)
55245
+ ]
55246
+ }, undefined, true, undefined, this)
55247
+ }, undefined, false, undefined, this),
55248
+ renderedLines.length === 0 ? /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
55249
+ dimColor: true,
55250
+ children: " (empty status line)"
55251
+ }, undefined, false, undefined, this) : renderedLines.map((line, index) => /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(Text, {
55252
+ wrap: "truncate",
55253
+ children: [
55254
+ " ",
55255
+ line
55256
+ ]
55257
+ }, index, true, undefined, this))
55258
+ ]
55259
+ }, undefined, true, undefined, this);
55260
+ }
55261
+ var import_react31, jsx_dev_runtime5, PREVIEW_STATUS;
55262
+ var init_StatusLinePreview = __esm(async () => {
55263
+ init_renderer();
55264
+ await init_build2();
55265
+ import_react31 = __toESM(require_react(), 1);
55266
+ jsx_dev_runtime5 = __toESM(require_jsx_dev_runtime(), 1);
55267
+ PREVIEW_STATUS = {
55268
+ sessionId: "a196c973",
55269
+ sessionName: "copilotstatusline",
55270
+ cwd: process.cwd(),
55271
+ version: "1.0.71",
55272
+ modelId: "gpt-5.4",
55273
+ modelName: "GPT-5.4",
55274
+ reasoningEffort: "high",
55275
+ allowAll: false,
55276
+ context: {
55277
+ inputTokens: 698833,
55278
+ outputTokens: 5726,
55279
+ cacheReadTokens: 582656,
55280
+ cacheWriteTokens: 0,
55281
+ reasoningTokens: 2880,
55282
+ totalTokens: 704559,
55283
+ lastCallInputTokens: 34890,
55284
+ lastCallOutputTokens: 1320,
55285
+ currentTokens: 56320,
55286
+ limitTokens: 200000,
55287
+ usedPercentage: 28.16
55288
+ },
55289
+ cost: {
55290
+ apiDurationMs: 15420,
55291
+ durationMs: 48210,
55292
+ premiumRequests: 2,
55293
+ linesAdded: 84,
55294
+ linesRemoved: 17
55295
+ }
55296
+ };
55297
+ });
55298
+
55299
+ // src/tui/components/WidgetEditor.tsx
53062
55300
  import { randomUUID } from "node:crypto";
53063
- function cycleColor(color) {
53064
- const index = COLORS.indexOf(color);
53065
- return COLORS[(index + 1) % COLORS.length] ?? "none";
55301
+ function makeWidget(type) {
55302
+ const catalog = WIDGET_CATALOG.find((entry) => entry.type === type);
55303
+ const extra = type === "custom-text" ? { value: "text" } : type === "custom-command" ? { command: "printf ok" } : type === "separator" ? { value: "|" } : {};
55304
+ return WidgetConfigSchema.parse({
55305
+ id: randomUUID(),
55306
+ type,
55307
+ color: catalog?.defaultColor ?? "none",
55308
+ ...extra
55309
+ });
53066
55310
  }
53067
- function primaryEditableField(widget2) {
55311
+ function editableValueField(widget2) {
53068
55312
  if (widget2?.type === "custom-command") {
53069
55313
  return "command";
53070
55314
  }
@@ -53073,58 +55317,113 @@ function primaryEditableField(widget2) {
53073
55317
  }
53074
55318
  return null;
53075
55319
  }
53076
- function Header({ integration }) {
53077
- const status = integration === null ? "Copilot settings unavailable" : integration.installed ? `${integration.visible ? "Installed" : "Installed · custom footer hidden"} · Copilot ${integration.version ?? "unknown"}` : "Not installed";
53078
- return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
55320
+ function widgetDisplay(widget2) {
55321
+ const catalog = WIDGET_CATALOG.find((entry) => entry.type === widget2.type);
55322
+ const detail = widget2.type === "custom-text" ? widget2.value : widget2.type === "custom-command" ? widget2.command : widget2.type === "separator" ? widget2.value : undefined;
55323
+ return detail === undefined || detail === "" ? catalog?.name ?? widget2.type : `${catalog?.name ?? widget2.type}: ${detail}`;
55324
+ }
55325
+ function ClearLineConfirmation({
55326
+ lineNumber,
55327
+ onConfirm,
55328
+ onCancel
55329
+ }) {
55330
+ use_input_default((_, key) => {
55331
+ if (key.escape) {
55332
+ onCancel();
55333
+ }
55334
+ });
55335
+ return /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Box_default, {
53079
55336
  flexDirection: "column",
53080
- marginBottom: 1,
53081
55337
  children: [
53082
- /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
55338
+ /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
53083
55339
  bold: true,
53084
- color: "cyan",
53085
- children: "copilotstatusline"
55340
+ color: "yellow",
55341
+ children: "Confirm Clear Line"
53086
55342
  }, undefined, false, undefined, this),
53087
- /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
53088
- dimColor: true,
53089
- children: status
55343
+ /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Box_default, {
55344
+ marginTop: 1,
55345
+ children: /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
55346
+ children: [
55347
+ "Remove every widget from Line",
55348
+ " ",
55349
+ lineNumber,
55350
+ "?"
55351
+ ]
55352
+ }, undefined, true, undefined, this)
55353
+ }, undefined, false, undefined, this),
55354
+ /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(List, {
55355
+ marginTop: 1,
55356
+ color: "cyan",
55357
+ items: [
55358
+ { label: "Clear line", value: "confirm" },
55359
+ { label: "← Cancel", value: "cancel" }
55360
+ ],
55361
+ onSelect: (value) => {
55362
+ if (value === "confirm") {
55363
+ onConfirm();
55364
+ } else {
55365
+ onCancel();
55366
+ }
55367
+ }
53090
55368
  }, undefined, false, undefined, this)
53091
55369
  ]
53092
55370
  }, undefined, true, undefined, this);
53093
55371
  }
53094
- function WidgetEditor({ settings, onChange, onBack }) {
53095
- const [lineIndex, setLineIndex] = import_react29.useState(0);
53096
- const [selectedIndex, setSelectedIndex] = import_react29.useState(0);
53097
- const [adding, setAdding] = import_react29.useState(false);
53098
- const [editingField, setEditingField] = import_react29.useState(null);
53099
- const [editingValue, setEditingValue] = import_react29.useState("");
53100
- const currentLine = settings.lines[lineIndex] ?? [];
53101
- const selectedWidget = currentLine[selectedIndex];
53102
- const updateSelected = import_react29.useCallback((update2) => {
53103
- if (selectedWidget === undefined) {
55372
+ function WidgetEditor({
55373
+ widgets,
55374
+ lineNumber,
55375
+ settings,
55376
+ onUpdate,
55377
+ onBack
55378
+ }) {
55379
+ const [selectedIndex, setSelectedIndex] = import_react32.useState(0);
55380
+ const [moveMode, setMoveMode] = import_react32.useState(false);
55381
+ const [picker, setPicker] = import_react32.useState(null);
55382
+ const [editingField, setEditingField] = import_react32.useState(null);
55383
+ const [editingValue, setEditingValue] = import_react32.useState("");
55384
+ const [showClearConfirmation, setShowClearConfirmation] = import_react32.useState(false);
55385
+ const currentWidget = widgets[selectedIndex];
55386
+ const filteredCatalog = import_react32.useMemo(() => {
55387
+ const query = picker?.query.trim().toLocaleLowerCase() ?? "";
55388
+ if (query === "") {
55389
+ return WIDGET_CATALOG;
55390
+ }
55391
+ return WIDGET_CATALOG.filter((entry) => [entry.name, entry.type, entry.description].some((value) => value.toLocaleLowerCase().includes(query)));
55392
+ }, [picker?.query]);
55393
+ const pickerIndex = picker === null ? -1 : filteredCatalog.findIndex((entry) => entry.type === picker.selectedType);
55394
+ const selectedPickerEntry = filteredCatalog[Math.max(0, pickerIndex)];
55395
+ const openPicker = (action) => {
55396
+ setPicker({
55397
+ action,
55398
+ query: "",
55399
+ selectedType: action === "change" ? currentWidget?.type ?? WIDGET_CATALOG[0]?.type ?? null : WIDGET_CATALOG[0]?.type ?? null
55400
+ });
55401
+ };
55402
+ const applyPicker = (type) => {
55403
+ if (picker === null) {
53104
55404
  return;
53105
55405
  }
53106
- const lines = settings.lines.map((line, index) => index === lineIndex ? line.map((widget2, widgetIndex) => widgetIndex === selectedIndex ? update2(widget2) : widget2) : line);
53107
- onChange({ ...settings, lines });
53108
- }, [lineIndex, onChange, selectedIndex, selectedWidget, settings]);
53109
- const startEditing = import_react29.useCallback((field) => {
53110
- if (selectedWidget === undefined) {
55406
+ if (picker.action === "change" && currentWidget !== undefined) {
55407
+ const replacement = makeWidget(type);
55408
+ onUpdate(widgets.map((widget2, index) => index === selectedIndex ? { ...replacement, id: widget2.id } : widget2));
55409
+ } else {
55410
+ const insertAt = picker.action === "add" ? widgets.length === 0 ? 0 : selectedIndex + 1 : selectedIndex;
55411
+ const next = [...widgets];
55412
+ next.splice(insertAt, 0, makeWidget(type));
55413
+ onUpdate(next);
55414
+ setSelectedIndex(insertAt);
55415
+ }
55416
+ setPicker(null);
55417
+ };
55418
+ const startEditing = (field) => {
55419
+ if (currentWidget === undefined) {
53111
55420
  return;
53112
55421
  }
53113
55422
  setEditingField(field);
53114
- setEditingValue(selectedWidget[field] ?? "");
53115
- }, [selectedWidget]);
53116
- const finishEditing = import_react29.useCallback((value) => {
53117
- if (editingField !== null) {
53118
- updateSelected((widget2) => ({ ...widget2, [editingField]: value }));
53119
- }
53120
- setEditingField(null);
53121
- setEditingValue("");
53122
- }, [editingField, updateSelected]);
55423
+ setEditingValue(currentWidget[field] ?? "");
55424
+ };
53123
55425
  use_input_default((input, key) => {
53124
- if (adding) {
53125
- if (key.escape) {
53126
- setAdding(false);
53127
- }
55426
+ if (showClearConfirmation) {
53128
55427
  return;
53129
55428
  }
53130
55429
  if (editingField !== null) {
@@ -53134,60 +55433,91 @@ function WidgetEditor({ settings, onChange, onBack }) {
53134
55433
  }
53135
55434
  return;
53136
55435
  }
53137
- if (key.escape) {
53138
- onBack();
53139
- } else if (key.upArrow) {
53140
- setSelectedIndex((value) => Math.max(0, value - 1));
53141
- } else if (key.downArrow) {
53142
- setSelectedIndex((value) => Math.min(Math.max(0, currentLine.length - 1), value + 1));
53143
- } else if (key.tab) {
53144
- setLineIndex((value) => (value + 1) % settings.lines.length);
53145
- setSelectedIndex(0);
55436
+ if (picker !== null) {
55437
+ if (key.escape) {
55438
+ if (picker.query === "") {
55439
+ setPicker(null);
55440
+ } else {
55441
+ setPicker({ ...picker, query: "", selectedType: WIDGET_CATALOG[0]?.type ?? null });
55442
+ }
55443
+ } else if (key.upArrow || key.downArrow) {
55444
+ if (filteredCatalog.length === 0) {
55445
+ return;
55446
+ }
55447
+ const current = pickerIndex < 0 ? 0 : pickerIndex;
55448
+ const direction = key.upArrow ? -1 : 1;
55449
+ const nextIndex = (current + direction + filteredCatalog.length) % filteredCatalog.length;
55450
+ setPicker({ ...picker, selectedType: filteredCatalog[nextIndex]?.type ?? null });
55451
+ } else if (key.return && selectedPickerEntry !== undefined) {
55452
+ applyPicker(selectedPickerEntry.type);
55453
+ } else if (key.backspace || key.delete) {
55454
+ const query = picker.query.slice(0, -1);
55455
+ const firstMatch = WIDGET_CATALOG.find((entry) => [entry.name, entry.type, entry.description].some((value) => value.toLocaleLowerCase().includes(query.toLocaleLowerCase())));
55456
+ setPicker({ ...picker, query, selectedType: firstMatch?.type ?? null });
55457
+ } else if (input !== "" && !key.ctrl && !key.meta && !key.tab) {
55458
+ const query = picker.query + input;
55459
+ const firstMatch = WIDGET_CATALOG.find((entry) => [entry.name, entry.type, entry.description].some((value) => value.toLocaleLowerCase().includes(query.toLocaleLowerCase())));
55460
+ setPicker({ ...picker, query, selectedType: firstMatch?.type ?? null });
55461
+ }
55462
+ return;
55463
+ }
55464
+ if (moveMode) {
55465
+ if ((key.upArrow || key.downArrow) && widgets.length > 1) {
55466
+ const direction = key.upArrow ? -1 : 1;
55467
+ const target = (selectedIndex + direction + widgets.length) % widgets.length;
55468
+ const reordered = [...widgets];
55469
+ const current = reordered[selectedIndex];
55470
+ const replacement = reordered[target];
55471
+ if (current !== undefined && replacement !== undefined) {
55472
+ reordered[selectedIndex] = replacement;
55473
+ reordered[target] = current;
55474
+ onUpdate(reordered);
55475
+ setSelectedIndex(target);
55476
+ }
55477
+ } else if (key.escape || key.return) {
55478
+ setMoveMode(false);
55479
+ }
55480
+ return;
55481
+ }
55482
+ if (key.ctrl || key.meta) {
55483
+ return;
55484
+ }
55485
+ if ((key.upArrow || key.downArrow) && widgets.length > 0) {
55486
+ const direction = key.upArrow ? -1 : 1;
55487
+ setSelectedIndex((selectedIndex + direction + widgets.length) % widgets.length);
55488
+ } else if ((key.leftArrow || key.rightArrow) && currentWidget !== undefined) {
55489
+ openPicker("change");
55490
+ } else if (key.return && currentWidget !== undefined) {
55491
+ setMoveMode(true);
53146
55492
  } else if (input === "a") {
53147
- setAdding(true);
53148
- } else if (input === "n") {
53149
- onChange({ ...settings, lines: [...settings.lines, []] });
53150
- setLineIndex(settings.lines.length);
53151
- setSelectedIndex(0);
53152
- } else if (input === "d" && settings.lines.length > 1) {
53153
- const lines = settings.lines.filter((_, index) => index !== lineIndex);
53154
- onChange({ ...settings, lines });
53155
- setLineIndex((value) => Math.max(0, Math.min(value, lines.length - 1)));
53156
- setSelectedIndex(0);
53157
- } else if (input === "x" && currentLine[selectedIndex] !== undefined) {
53158
- const lines = settings.lines.map((line, index) => index === lineIndex ? line.filter((_, widgetIndex) => widgetIndex !== selectedIndex) : line);
53159
- onChange({ ...settings, lines });
53160
- setSelectedIndex((value) => Math.max(0, value - 1));
53161
- } else if ((input === "[" || input === "]") && currentLine[selectedIndex] !== undefined) {
53162
- const offset = input === "[" ? -1 : 1;
53163
- const target = Math.max(0, Math.min(currentLine.length - 1, selectedIndex + offset));
53164
- if (target !== selectedIndex) {
53165
- const reordered = [...currentLine];
53166
- const [item] = reordered.splice(selectedIndex, 1);
53167
- if (item !== undefined) {
53168
- reordered.splice(target, 0, item);
53169
- }
53170
- const lines = settings.lines.map((line, index) => index === lineIndex ? reordered : line);
53171
- onChange({ ...settings, lines });
53172
- setSelectedIndex(target);
53173
- }
53174
- } else if (input === "c" && currentLine[selectedIndex] !== undefined) {
53175
- updateSelected((widget2) => ({ ...widget2, color: cycleColor(widget2.color) }));
53176
- } else if (input === "g" && currentLine[selectedIndex] !== undefined) {
53177
- updateSelected((widget2) => ({
53178
- ...widget2,
53179
- backgroundColor: cycleColor(widget2.backgroundColor)
53180
- }));
53181
- } else if (input === "b" && currentLine[selectedIndex] !== undefined) {
53182
- updateSelected((widget2) => ({ ...widget2, bold: !widget2.bold }));
53183
- } else if (input === "r" && currentLine[selectedIndex] !== undefined) {
53184
- updateSelected((widget2) => ({ ...widget2, raw: !widget2.raw }));
53185
- } else if (input === "m" && currentLine[selectedIndex] !== undefined) {
53186
- updateSelected((widget2) => ({ ...widget2, merge: !widget2.merge }));
53187
- } else if (input === "z" && currentLine[selectedIndex] !== undefined) {
53188
- updateSelected((widget2) => ({ ...widget2, hideWhenZero: !widget2.hideWhenZero }));
55493
+ openPicker("add");
55494
+ } else if (input === "i") {
55495
+ openPicker("insert");
55496
+ } else if (input === "d" && currentWidget !== undefined) {
55497
+ const next = widgets.filter((_, index) => index !== selectedIndex);
55498
+ onUpdate(next);
55499
+ setSelectedIndex(Math.max(0, Math.min(selectedIndex, next.length - 1)));
55500
+ } else if (input === "k" && currentWidget !== undefined) {
55501
+ const clone3 = { ...currentWidget, id: randomUUID() };
55502
+ const next = [...widgets];
55503
+ next.splice(selectedIndex + 1, 0, clone3);
55504
+ onUpdate(next);
55505
+ setSelectedIndex(selectedIndex + 1);
55506
+ } else if (input === "c" && widgets.length > 0) {
55507
+ setShowClearConfirmation(true);
55508
+ } else if (input === "r" && currentWidget !== undefined) {
55509
+ onUpdate(widgets.map((widget2, index) => index === selectedIndex ? { ...widget2, raw: !widget2.raw } : widget2));
55510
+ } else if (input === "m" && currentWidget !== undefined && selectedIndex < widgets.length - 1) {
55511
+ onUpdate(widgets.map((widget2, index) => index === selectedIndex ? { ...widget2, merge: !widget2.merge } : widget2));
55512
+ } else if (input === "z" && currentWidget !== undefined) {
55513
+ onUpdate(widgets.map((widget2, index) => index === selectedIndex ? { ...widget2, hideWhenZero: !widget2.hideWhenZero } : widget2));
55514
+ } else if (input === " " && currentWidget?.type === "separator") {
55515
+ const separators = ["|", "-", ",", " "];
55516
+ const current = separators.indexOf(currentWidget.value ?? "|");
55517
+ const value = separators[(current + 1) % separators.length] ?? "|";
55518
+ onUpdate(widgets.map((widget2, index) => index === selectedIndex ? { ...widget2, value } : widget2));
53189
55519
  } else if (input === "e") {
53190
- const field = primaryEditableField(selectedWidget);
55520
+ const field = editableValueField(currentWidget);
53191
55521
  if (field !== null) {
53192
55522
  startEditing(field);
53193
55523
  }
@@ -53195,280 +55525,841 @@ function WidgetEditor({ settings, onChange, onBack }) {
53195
55525
  startEditing("prefix");
53196
55526
  } else if (input === "s") {
53197
55527
  startEditing("suffix");
55528
+ } else if (key.escape) {
55529
+ onBack();
53198
55530
  }
53199
55531
  });
53200
- const addWidget = import_react29.useCallback((type) => {
53201
- const catalog = WIDGET_CATALOG.find((entry) => entry.type === type);
53202
- const extra = type === "custom-text" ? { value: "text" } : type === "custom-command" ? { command: "printf ok" } : type === "separator" ? { value: "|" } : {};
53203
- const created = WidgetConfigSchema.parse({
53204
- id: randomUUID(),
53205
- type,
53206
- color: catalog?.defaultColor ?? "none",
53207
- ...extra
53208
- });
53209
- const lines = settings.lines.map((line, index) => index === lineIndex ? [...line, created] : line);
53210
- onChange({ ...settings, lines });
53211
- setSelectedIndex(currentLine.length);
53212
- setAdding(false);
53213
- }, [currentLine.length, lineIndex, onChange, settings]);
53214
- if (adding) {
53215
- return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
55532
+ if (showClearConfirmation) {
55533
+ return /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(ClearLineConfirmation, {
55534
+ lineNumber,
55535
+ onCancel: () => {
55536
+ setShowClearConfirmation(false);
55537
+ },
55538
+ onConfirm: () => {
55539
+ onUpdate([]);
55540
+ setSelectedIndex(0);
55541
+ setShowClearConfirmation(false);
55542
+ }
55543
+ }, undefined, false, undefined, this);
55544
+ }
55545
+ if (editingField !== null) {
55546
+ return /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Box_default, {
53216
55547
  flexDirection: "column",
53217
55548
  children: [
53218
- /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
55549
+ /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
53219
55550
  bold: true,
53220
- children: "Add widget"
53221
- }, undefined, false, undefined, this),
53222
- /* @__PURE__ */ jsx_dev_runtime.jsxDEV(SelectInput_default, {
53223
- items: WIDGET_CATALOG.map((entry) => ({
53224
- label: `${entry.name} — ${entry.description}`,
53225
- value: entry.type
53226
- })),
53227
- onSelect: (item) => {
53228
- addWidget(item.value);
53229
- }
53230
- }, undefined, false, undefined, this),
53231
- /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
55551
+ children: [
55552
+ "Edit",
55553
+ " ",
55554
+ editingField,
55555
+ " ",
55556
+ "— Line",
55557
+ " ",
55558
+ lineNumber
55559
+ ]
55560
+ }, undefined, true, undefined, this),
55561
+ /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Box_default, {
55562
+ marginTop: 1,
55563
+ children: [
55564
+ /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
55565
+ color: "cyan",
55566
+ children: "> "
55567
+ }, undefined, false, undefined, this),
55568
+ /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(build_default, {
55569
+ value: editingValue,
55570
+ onChange: setEditingValue,
55571
+ onSubmit: (value) => {
55572
+ onUpdate(widgets.map((widget2, index) => index === selectedIndex ? { ...widget2, [editingField]: value } : widget2));
55573
+ setEditingField(null);
55574
+ setEditingValue("");
55575
+ }
55576
+ }, undefined, false, undefined, this)
55577
+ ]
55578
+ }, undefined, true, undefined, this),
55579
+ /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
53232
55580
  dimColor: true,
53233
- children: "Esc cancels."
55581
+ children: "Enter apply, ESC cancel"
53234
55582
  }, undefined, false, undefined, this)
53235
55583
  ]
53236
55584
  }, undefined, true, undefined, this);
53237
55585
  }
53238
- if (editingField !== null) {
53239
- return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
55586
+ if (picker !== null) {
55587
+ const action = picker.action === "change" ? "Change Widget" : picker.action === "insert" ? "Insert Widget" : "Add Widget";
55588
+ return /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Box_default, {
53240
55589
  flexDirection: "column",
53241
55590
  children: [
53242
- /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
55591
+ /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
53243
55592
  bold: true,
53244
55593
  children: [
53245
- "Edit",
53246
- editingField
55594
+ "Edit Line",
55595
+ " ",
55596
+ lineNumber,
55597
+ /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
55598
+ color: "cyan",
55599
+ children: ` [${action.toUpperCase()}]`
55600
+ }, undefined, false, undefined, this)
53247
55601
  ]
53248
55602
  }, undefined, true, undefined, this),
53249
- /* @__PURE__ */ jsx_dev_runtime.jsxDEV(build_default, {
53250
- value: editingValue,
53251
- onChange: setEditingValue,
53252
- onSubmit: finishEditing
53253
- }, undefined, false, undefined, this),
53254
- /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
55603
+ /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
53255
55604
  dimColor: true,
53256
- children: "Enter applies · Esc cancels"
55605
+ children: "↑↓ select widget, type to search, Enter apply, ESC clear/cancel"
55606
+ }, undefined, false, undefined, this),
55607
+ /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
55608
+ children: [
55609
+ /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
55610
+ dimColor: true,
55611
+ children: "Search: "
55612
+ }, undefined, false, undefined, this),
55613
+ /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
55614
+ color: "cyan",
55615
+ children: picker.query === "" ? "(none)" : picker.query
55616
+ }, undefined, false, undefined, this)
55617
+ ]
55618
+ }, undefined, true, undefined, this),
55619
+ /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Box_default, {
55620
+ marginTop: 1,
55621
+ flexDirection: "column",
55622
+ children: filteredCatalog.length === 0 ? /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
55623
+ dimColor: true,
55624
+ children: "No widgets match the search."
55625
+ }, undefined, false, undefined, this) : filteredCatalog.map((entry, index) => {
55626
+ const selected = entry.type === selectedPickerEntry?.type;
55627
+ return /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
55628
+ color: selected ? "green" : undefined,
55629
+ children: [
55630
+ selected ? "▶ " : " ",
55631
+ index + 1,
55632
+ ".",
55633
+ " ",
55634
+ entry.name
55635
+ ]
55636
+ }, entry.type, true, undefined, this);
55637
+ })
55638
+ }, undefined, false, undefined, this),
55639
+ selectedPickerEntry === undefined ? null : /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Box_default, {
55640
+ marginTop: 1,
55641
+ paddingLeft: 2,
55642
+ children: /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
55643
+ dimColor: true,
55644
+ children: selectedPickerEntry.description
55645
+ }, undefined, false, undefined, this)
53257
55646
  }, undefined, false, undefined, this)
53258
55647
  ]
53259
55648
  }, undefined, true, undefined, this);
53260
55649
  }
53261
- return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
55650
+ return /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Box_default, {
53262
55651
  flexDirection: "column",
53263
55652
  children: [
53264
- /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
55653
+ /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
53265
55654
  bold: true,
53266
55655
  children: [
53267
- "Line",
53268
- lineIndex + 1,
55656
+ "Edit Line",
53269
55657
  " ",
53270
- "of",
53271
- settings.lines.length
55658
+ lineNumber,
55659
+ moveMode ? /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
55660
+ color: "blue",
55661
+ children: " [MOVE MODE]"
55662
+ }, undefined, false, undefined, this) : null
53272
55663
  ]
53273
55664
  }, undefined, true, undefined, this),
53274
- currentLine.length === 0 ? /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
55665
+ /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
53275
55666
  dimColor: true,
53276
- children: "Empty line"
53277
- }, undefined, false, undefined, this) : currentLine.map((widget2, index) => /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
53278
- children: [
53279
- index === selectedIndex ? "❯ " : " ",
53280
- widget2.type,
53281
- " ",
53282
- /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
53283
- dimColor: true,
55667
+ children: moveMode ? "↑↓ move widget, ESC or Enter exit move mode" : "↑↓ select, ←→ change, Enter move, (a)dd, (i)nsert, (k) clone, (d)elete, (c)lear"
55668
+ }, undefined, false, undefined, this),
55669
+ /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
55670
+ dimColor: true,
55671
+ children: moveMode ? " " : "(e)dit value, (p)refix, (s)uffix, (r)aw, (m)erge, hide-(z)ero, ESC back"
55672
+ }, undefined, false, undefined, this),
55673
+ settings.powerline.enabled ? /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
55674
+ color: "yellow",
55675
+ children: "Powerline mode active: segment backgrounds are visible in Edit Colors"
55676
+ }, undefined, false, undefined, this) : null,
55677
+ /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Box_default, {
55678
+ marginTop: 1,
55679
+ flexDirection: "column",
55680
+ children: widgets.length === 0 ? /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
55681
+ dimColor: true,
55682
+ children: "No widgets. Press 'a' to add one."
55683
+ }, undefined, false, undefined, this) : widgets.map((widget2, index) => {
55684
+ const selected = index === selectedIndex;
55685
+ const modifiers = [
55686
+ widget2.raw ? "raw value" : null,
55687
+ widget2.merge ? "merged→" : null,
55688
+ widget2.hideWhenZero ? "hide zero" : null
55689
+ ].filter((value) => value !== null).join(", ");
55690
+ return /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
55691
+ color: selected ? moveMode ? "blue" : "green" : undefined,
53284
55692
  children: [
53285
- widget2.color,
53286
- widget2.bold ? " bold" : "",
53287
- widget2.raw ? " raw" : "",
53288
- widget2.merge ? " merged" : "",
53289
- widget2.hideWhenZero ? " hide-zero" : ""
55693
+ selected ? moveMode ? "◆ " : "▶ " : " ",
55694
+ index + 1,
55695
+ ".",
55696
+ " ",
55697
+ widgetDisplay(widget2),
55698
+ modifiers === "" ? null : /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
55699
+ dimColor: true,
55700
+ children: ` (${modifiers})`
55701
+ }, undefined, false, undefined, this)
53290
55702
  ]
53291
- }, undefined, true, undefined, this)
53292
- ]
53293
- }, widget2.id, true, undefined, this)),
53294
- /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
55703
+ }, widget2.id, true, undefined, this);
55704
+ })
55705
+ }, undefined, false, undefined, this),
55706
+ currentWidget === undefined ? null : /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Box_default, {
55707
+ marginTop: 1,
55708
+ paddingLeft: 2,
55709
+ children: /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(Text, {
55710
+ dimColor: true,
55711
+ children: WIDGET_CATALOG.find((entry) => entry.type === currentWidget.type)?.description
55712
+ }, undefined, false, undefined, this)
55713
+ }, undefined, false, undefined, this)
55714
+ ]
55715
+ }, undefined, true, undefined, this);
55716
+ }
55717
+ var import_react32, jsx_dev_runtime6;
55718
+ var init_WidgetEditor = __esm(async () => {
55719
+ init_Settings();
55720
+ init_catalog();
55721
+ await __promiseAll([
55722
+ init_build2(),
55723
+ init_build3(),
55724
+ init_List()
55725
+ ]);
55726
+ import_react32 = __toESM(require_react(), 1);
55727
+ jsx_dev_runtime6 = __toESM(require_jsx_dev_runtime(), 1);
55728
+ });
55729
+
55730
+ // src/tui/App.tsx
55731
+ import { spawn } from "node:child_process";
55732
+ function GradientTitle() {
55733
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
55734
+ bold: true,
55735
+ children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(dist_default5, {
55736
+ name: "retro",
55737
+ children: "CopilotStatusline Configuration"
55738
+ }, undefined, false, undefined, this)
55739
+ }, undefined, false, undefined, this);
55740
+ }
55741
+ function PowerlineSetup({ settings, onChange, onBack }) {
55742
+ const [editingSeparator, setEditingSeparator] = import_react33.useState(false);
55743
+ const [separator, setSeparator] = import_react33.useState(settings.powerline.separator);
55744
+ use_input_default((_, key) => {
55745
+ if (key.escape) {
55746
+ if (editingSeparator) {
55747
+ setEditingSeparator(false);
55748
+ setSeparator(settings.powerline.separator);
55749
+ } else {
55750
+ onBack();
55751
+ }
55752
+ }
55753
+ });
55754
+ if (editingSeparator) {
55755
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Box_default, {
55756
+ flexDirection: "column",
55757
+ children: [
55758
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
55759
+ bold: true,
55760
+ children: "Edit Powerline Separator"
55761
+ }, undefined, false, undefined, this),
55762
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Box_default, {
55763
+ marginTop: 1,
55764
+ children: [
55765
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
55766
+ color: "cyan",
55767
+ children: "> "
55768
+ }, undefined, false, undefined, this),
55769
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(build_default, {
55770
+ value: separator,
55771
+ onChange: setSeparator,
55772
+ onSubmit: (value) => {
55773
+ onChange({
55774
+ ...settings,
55775
+ powerline: { ...settings.powerline, separator: value || "" }
55776
+ });
55777
+ setEditingSeparator(false);
55778
+ }
55779
+ }, undefined, false, undefined, this)
55780
+ ]
55781
+ }, undefined, true, undefined, this),
55782
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
55783
+ dimColor: true,
55784
+ children: "Enter apply, ESC cancel"
55785
+ }, undefined, false, undefined, this)
55786
+ ]
55787
+ }, undefined, true, undefined, this);
55788
+ }
55789
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Box_default, {
55790
+ flexDirection: "column",
55791
+ children: [
55792
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
55793
+ bold: true,
55794
+ children: "Powerline Setup"
55795
+ }, undefined, false, undefined, this),
55796
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
55797
+ dimColor: true,
55798
+ children: "Configure segment rendering and separators"
55799
+ }, undefined, false, undefined, this),
55800
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(List, {
55801
+ marginTop: 1,
55802
+ showBackButton: true,
55803
+ items: [
55804
+ {
55805
+ label: settings.powerline.enabled ? "◉ Powerline enabled" : "○ Powerline disabled",
55806
+ value: "toggle",
55807
+ description: "Toggle filled Powerline segments in the status line renderer"
55808
+ },
55809
+ {
55810
+ label: `Separator: ${settings.powerline.separator}`,
55811
+ value: "separator",
55812
+ description: "Change the Powerline transition glyph"
55813
+ }
55814
+ ],
55815
+ onSelect: (value) => {
55816
+ if (value === "back") {
55817
+ onBack();
55818
+ } else if (value === "toggle") {
55819
+ onChange({
55820
+ ...settings,
55821
+ powerline: {
55822
+ ...settings.powerline,
55823
+ enabled: !settings.powerline.enabled
55824
+ }
55825
+ });
55826
+ } else {
55827
+ setSeparator(settings.powerline.separator);
55828
+ setEditingSeparator(true);
55829
+ }
55830
+ }
55831
+ }, undefined, false, undefined, this)
55832
+ ]
55833
+ }, undefined, true, undefined, this);
55834
+ }
55835
+ function TerminalOptions({ settings, onChange, onBack }) {
55836
+ use_input_default((_, key) => {
55837
+ if (key.escape) {
55838
+ onBack();
55839
+ }
55840
+ });
55841
+ const levels = [
55842
+ { label: "No colors", value: 0, description: "Disable ANSI color output" },
55843
+ { label: "16 colors", value: 1, description: "Use the basic ANSI terminal palette" },
55844
+ { label: "256 colors", value: 2, description: "Use the extended terminal palette" },
55845
+ { label: "True color", value: 3, description: "Use 24-bit terminal color output" }
55846
+ ].map((entry) => ({
55847
+ ...entry,
55848
+ label: `${entry.value === settings.colorLevel ? "◉" : "○"} ${entry.label}`
55849
+ }));
55850
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Box_default, {
55851
+ flexDirection: "column",
55852
+ children: [
55853
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
55854
+ bold: true,
55855
+ children: "Terminal Options"
55856
+ }, undefined, false, undefined, this),
55857
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
55858
+ dimColor: true,
55859
+ children: "Select the color capability used for rendering"
55860
+ }, undefined, false, undefined, this),
55861
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(List, {
55862
+ marginTop: 1,
55863
+ items: levels,
55864
+ initialSelection: settings.colorLevel,
55865
+ showBackButton: true,
55866
+ onSelect: (value) => {
55867
+ if (value === "back") {
55868
+ onBack();
55869
+ } else {
55870
+ onChange({ ...settings, colorLevel: value });
55871
+ }
55872
+ }
55873
+ }, undefined, false, undefined, this)
55874
+ ]
55875
+ }, undefined, true, undefined, this);
55876
+ }
55877
+ function GlobalOverrides({ settings, onChange, onBack }) {
55878
+ const [separator, setSeparator] = import_react33.useState(settings.defaultSeparator);
55879
+ use_input_default((_, key) => {
55880
+ if (key.escape) {
55881
+ onBack();
55882
+ }
55883
+ });
55884
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Box_default, {
55885
+ flexDirection: "column",
55886
+ children: [
55887
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
55888
+ bold: true,
55889
+ children: "Global Overrides"
55890
+ }, undefined, false, undefined, this),
55891
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
55892
+ dimColor: true,
55893
+ children: "Default separator inserted between visible widgets"
55894
+ }, undefined, false, undefined, this),
55895
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Box_default, {
53295
55896
  marginTop: 1,
53296
- flexDirection: "column",
53297
55897
  children: [
53298
- /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
53299
- dimColor: true,
53300
- children: "↑↓ select · Tab next line · a add · x remove · [ ] move"
53301
- }, undefined, false, undefined, this),
53302
- /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
53303
- dimColor: true,
53304
- children: "c fg · g bg · b bold · r raw · m merge · z hide zero"
55898
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
55899
+ color: "cyan",
55900
+ children: "> "
53305
55901
  }, undefined, false, undefined, this),
53306
- /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
53307
- dimColor: true,
53308
- children: "e value/command · p prefix · s suffix · n new · d delete · Esc back"
55902
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(build_default, {
55903
+ value: separator,
55904
+ onChange: setSeparator,
55905
+ onSubmit: (value) => {
55906
+ onChange({ ...settings, defaultSeparator: value });
55907
+ onBack();
55908
+ }
53309
55909
  }, undefined, false, undefined, this)
53310
55910
  ]
53311
- }, undefined, true, undefined, this)
55911
+ }, undefined, true, undefined, this),
55912
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
55913
+ dimColor: true,
55914
+ children: "Enter apply, ESC cancel"
55915
+ }, undefined, false, undefined, this)
55916
+ ]
55917
+ }, undefined, true, undefined, this);
55918
+ }
55919
+ function InstallationMenu({
55920
+ integration,
55921
+ busy,
55922
+ onInstall,
55923
+ onUninstall,
55924
+ onBack
55925
+ }) {
55926
+ use_input_default((_, key) => {
55927
+ if (key.escape && !busy) {
55928
+ onBack();
55929
+ }
55930
+ });
55931
+ const items = [
55932
+ {
55933
+ label: "npx -y @willh/copilotstatusline@latest",
55934
+ value: "npm",
55935
+ description: "Use the latest npm package for each Copilot CLI status refresh"
55936
+ },
55937
+ {
55938
+ label: "bunx -y @willh/copilotstatusline@latest",
55939
+ value: "bunx",
55940
+ description: "Use the latest npm package through Bun for each status refresh"
55941
+ },
55942
+ {
55943
+ label: "Global copilotstatusline binary",
55944
+ value: "global",
55945
+ description: "Use the copilotstatusline command already available on PATH"
55946
+ },
55947
+ ...integration?.installed === true ? [
55948
+ "-",
55949
+ {
55950
+ label: "Uninstall from Copilot CLI",
55951
+ value: "uninstall",
55952
+ description: "Remove only the status line command owned by this package"
55953
+ }
55954
+ ] : []
55955
+ ];
55956
+ if (busy) {
55957
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Box_default, {
55958
+ flexDirection: "column",
55959
+ children: [
55960
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
55961
+ bold: true,
55962
+ children: "Manage Installation"
55963
+ }, undefined, false, undefined, this),
55964
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Box_default, {
55965
+ marginTop: 1,
55966
+ children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
55967
+ color: "cyan",
55968
+ children: "Working…"
55969
+ }, undefined, false, undefined, this)
55970
+ }, undefined, false, undefined, this)
55971
+ ]
55972
+ }, undefined, true, undefined, this);
55973
+ }
55974
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Box_default, {
55975
+ flexDirection: "column",
55976
+ children: [
55977
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
55978
+ bold: true,
55979
+ children: integration?.installed === true ? "Manage Installation" : "Install to Copilot CLI"
55980
+ }, undefined, false, undefined, this),
55981
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
55982
+ dimColor: true,
55983
+ children: "User-level Copilot settings only"
55984
+ }, undefined, false, undefined, this),
55985
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(List, {
55986
+ marginTop: 1,
55987
+ items,
55988
+ showBackButton: true,
55989
+ onSelect: (value) => {
55990
+ if (value === "back") {
55991
+ onBack();
55992
+ } else if (value === "uninstall") {
55993
+ onUninstall();
55994
+ } else {
55995
+ onInstall(value);
55996
+ }
55997
+ }
55998
+ }, undefined, false, undefined, this)
53312
55999
  ]
53313
56000
  }, undefined, true, undefined, this);
53314
56001
  }
53315
- function App2({ settings: initialSettings, integration: initialIntegration }) {
56002
+ function openProjectRepository() {
56003
+ const url2 = "https://github.com/doggy8088/copilotstatusline";
56004
+ const command = process.platform === "darwin" ? "open" : process.platform === "win32" ? "cmd" : "xdg-open";
56005
+ const args = process.platform === "win32" ? ["/c", "start", "", url2] : [url2];
56006
+ const child = spawn(command, args, { detached: true, stdio: "ignore" });
56007
+ child.unref();
56008
+ }
56009
+ function App2({
56010
+ settings: initialSettings,
56011
+ integration: initialIntegration
56012
+ }) {
53316
56013
  const { exit } = use_app_default();
53317
- const [settings, setSettings] = import_react29.useState(initialSettings);
53318
- const [integration, setIntegration] = import_react29.useState(initialIntegration);
53319
- const [screen, setScreen] = import_react29.useState("menu");
53320
- const [message, setMessage] = import_react29.useState(getSettingsLoadError());
53321
- const [busy, setBusy] = import_react29.useState(false);
53322
- const refreshIntegration = import_react29.useCallback(async () => {
53323
- setIntegration(await inspectCopilotIntegration());
56014
+ const [settings, setSettings] = import_react33.useState(initialSettings);
56015
+ const [savedSettings, setSavedSettings] = import_react33.useState(initialSettings);
56016
+ const [integration, setIntegration] = import_react33.useState(initialIntegration);
56017
+ const [screen, setScreen] = import_react33.useState("main");
56018
+ const [selectedLine, setSelectedLine] = import_react33.useState(0);
56019
+ const [mainSelection, setMainSelection] = import_react33.useState(0);
56020
+ const [terminalWidth2, setTerminalWidth] = import_react33.useState(process.stdout.columns || 120);
56021
+ const [flashMessage, setFlashMessage] = import_react33.useState(null);
56022
+ const [busy, setBusy] = import_react33.useState(false);
56023
+ const [loadError2, setLoadError] = import_react33.useState(getSettingsLoadError());
56024
+ const [pendingSaveExit, setPendingSaveExit] = import_react33.useState(false);
56025
+ const hasChanges = import_react33.useMemo(() => JSON.stringify(settings) !== JSON.stringify(savedSettings), [savedSettings, settings]);
56026
+ import_react33.useEffect(() => {
56027
+ const handleResize = () => {
56028
+ setTerminalWidth(process.stdout.columns || 120);
56029
+ };
56030
+ process.stdout.on("resize", handleResize);
56031
+ return () => {
56032
+ process.stdout.off("resize", handleResize);
56033
+ };
53324
56034
  }, []);
53325
- const handleMenu = import_react29.useCallback(async (value) => {
53326
- if (value === "edit") {
53327
- setScreen("editor");
53328
- return;
53329
- }
53330
- if (value === "powerline") {
53331
- setSettings((current) => ({
53332
- ...current,
53333
- powerline: { ...current.powerline, enabled: !current.powerline.enabled }
53334
- }));
53335
- setMessage(`Powerline ${settings.powerline.enabled ? "disabled" : "enabled"}`);
53336
- return;
53337
- }
53338
- if (value === "install") {
53339
- setScreen("install");
53340
- return;
53341
- }
53342
- if (value === "uninstall") {
53343
- setBusy(true);
53344
- try {
53345
- const removed = await uninstallCopilotStatusLine();
53346
- setMessage(removed ? "Copilot integration removed." : "No owned integration was found.");
53347
- await refreshIntegration();
53348
- } catch (error51) {
53349
- setMessage(error51 instanceof Error ? error51.message : String(error51));
53350
- } finally {
53351
- setBusy(false);
53352
- }
56035
+ import_react33.useEffect(() => {
56036
+ if (flashMessage === null) {
53353
56037
  return;
53354
56038
  }
53355
- if (value === "save") {
53356
- setBusy(true);
53357
- try {
53358
- await saveSettings(settings);
56039
+ const timer = setTimeout(() => {
56040
+ setFlashMessage(null);
56041
+ }, 2000);
56042
+ return () => {
56043
+ clearTimeout(timer);
56044
+ };
56045
+ }, [flashMessage]);
56046
+ const performSave = import_react33.useCallback(async (exitAfterSave) => {
56047
+ try {
56048
+ await saveSettings(settings);
56049
+ setSavedSettings(settings);
56050
+ setLoadError(null);
56051
+ if (exitAfterSave) {
53359
56052
  exit();
53360
- } catch (error51) {
53361
- setMessage(error51 instanceof Error ? error51.message : String(error51));
53362
- setBusy(false);
56053
+ } else {
56054
+ setFlashMessage({ text: "✓ Configuration saved", color: "green" });
53363
56055
  }
53364
- return;
56056
+ } catch (error51) {
56057
+ setFlashMessage({
56058
+ text: error51 instanceof Error ? error51.message : String(error51),
56059
+ color: "red"
56060
+ });
53365
56061
  }
53366
- exit();
53367
- }, [exit, refreshIntegration, settings]);
53368
- const handleInstall = import_react29.useCallback(async (mode) => {
53369
- if (mode === "back") {
53370
- setScreen("menu");
56062
+ }, [exit, settings]);
56063
+ const requestSave = import_react33.useCallback((exitAfterSave) => {
56064
+ if (loadError2 !== null) {
56065
+ setPendingSaveExit(exitAfterSave);
56066
+ setScreen("confirmSave");
53371
56067
  return;
53372
56068
  }
56069
+ performSave(exitAfterSave);
56070
+ }, [loadError2, performSave]);
56071
+ use_input_default((input, key) => {
56072
+ if (key.ctrl && input === "c") {
56073
+ exit();
56074
+ } else if (key.ctrl && input === "s" && screen !== "confirmSave") {
56075
+ requestSave(false);
56076
+ }
56077
+ });
56078
+ const refreshIntegration = import_react33.useCallback(async () => {
56079
+ setIntegration(await inspectCopilotIntegration().catch(() => null));
56080
+ }, []);
56081
+ const handleInstall = import_react33.useCallback(async (mode) => {
53373
56082
  setBusy(true);
53374
56083
  try {
53375
56084
  await installCopilotStatusLine(mode, isSettingsPathCustom() ? getSettingsPath() : undefined);
53376
56085
  await refreshIntegration();
53377
- setMessage(`Installed with ${mode}.`);
53378
- setScreen("menu");
56086
+ setFlashMessage({ text: `Installed with ${mode}`, color: "green" });
56087
+ setScreen("main");
53379
56088
  } catch (error51) {
53380
- setMessage(error51 instanceof Error ? error51.message : String(error51));
56089
+ setFlashMessage({
56090
+ text: error51 instanceof Error ? error51.message : String(error51),
56091
+ color: "red"
56092
+ });
53381
56093
  } finally {
53382
56094
  setBusy(false);
53383
56095
  }
53384
56096
  }, [refreshIntegration]);
53385
- return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
56097
+ const handleUninstall = import_react33.useCallback(async () => {
56098
+ setBusy(true);
56099
+ try {
56100
+ const removed = await uninstallCopilotStatusLine();
56101
+ await refreshIntegration();
56102
+ setFlashMessage({
56103
+ text: removed ? "Copilot integration removed" : "No owned integration was found",
56104
+ color: removed ? "green" : "yellow"
56105
+ });
56106
+ setScreen("main");
56107
+ } catch (error51) {
56108
+ setFlashMessage({
56109
+ text: error51 instanceof Error ? error51.message : String(error51),
56110
+ color: "red"
56111
+ });
56112
+ } finally {
56113
+ setBusy(false);
56114
+ }
56115
+ }, [refreshIntegration]);
56116
+ const handleMainMenu = (value, index) => {
56117
+ setMainSelection(index);
56118
+ switch (value) {
56119
+ case "lines":
56120
+ setScreen("lines");
56121
+ break;
56122
+ case "colors":
56123
+ setScreen("colorLines");
56124
+ break;
56125
+ case "powerline":
56126
+ setScreen("powerline");
56127
+ break;
56128
+ case "terminal":
56129
+ setScreen("terminal");
56130
+ break;
56131
+ case "overrides":
56132
+ setScreen("overrides");
56133
+ break;
56134
+ case "installation":
56135
+ setScreen("installation");
56136
+ break;
56137
+ case "save":
56138
+ requestSave(true);
56139
+ break;
56140
+ case "github":
56141
+ openProjectRepository();
56142
+ setFlashMessage({ text: "Opened project repository", color: "green" });
56143
+ break;
56144
+ case "exit":
56145
+ exit();
56146
+ break;
56147
+ }
56148
+ };
56149
+ const updateSelectedLine = (widgets) => {
56150
+ setSettings((current) => ({
56151
+ ...current,
56152
+ lines: current.lines.map((line, index) => index === selectedLine ? widgets : line)
56153
+ }));
56154
+ };
56155
+ const screenContent = (() => {
56156
+ switch (screen) {
56157
+ case "lines":
56158
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(LineSelector, {
56159
+ lines: settings.lines,
56160
+ allowEditing: true,
56161
+ initialSelection: selectedLine,
56162
+ onLinesUpdate: (lines) => {
56163
+ setSettings({ ...settings, lines });
56164
+ },
56165
+ onSelect: (lineIndex) => {
56166
+ setSelectedLine(lineIndex);
56167
+ setScreen("items");
56168
+ },
56169
+ onBack: () => {
56170
+ setScreen("main");
56171
+ }
56172
+ }, undefined, false, undefined, this);
56173
+ case "items":
56174
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(WidgetEditor, {
56175
+ widgets: settings.lines[selectedLine] ?? [],
56176
+ lineNumber: selectedLine + 1,
56177
+ settings,
56178
+ onUpdate: updateSelectedLine,
56179
+ onBack: () => {
56180
+ setScreen("lines");
56181
+ }
56182
+ }, undefined, false, undefined, this);
56183
+ case "colorLines":
56184
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(LineSelector, {
56185
+ lines: settings.lines,
56186
+ title: "Select Line to Configure Colors",
56187
+ initialSelection: selectedLine,
56188
+ onLinesUpdate: (lines) => {
56189
+ setSettings({ ...settings, lines });
56190
+ },
56191
+ onSelect: (lineIndex) => {
56192
+ setSelectedLine(lineIndex);
56193
+ setScreen("colors");
56194
+ },
56195
+ onBack: () => {
56196
+ setScreen("main");
56197
+ }
56198
+ }, undefined, false, undefined, this);
56199
+ case "colors":
56200
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ColorEditor, {
56201
+ widgets: settings.lines[selectedLine] ?? [],
56202
+ lineNumber: selectedLine + 1,
56203
+ settings,
56204
+ onUpdate: updateSelectedLine,
56205
+ onBack: () => {
56206
+ setScreen("colorLines");
56207
+ }
56208
+ }, undefined, false, undefined, this);
56209
+ case "powerline":
56210
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(PowerlineSetup, {
56211
+ settings,
56212
+ onChange: setSettings,
56213
+ onBack: () => {
56214
+ setScreen("main");
56215
+ }
56216
+ }, undefined, false, undefined, this);
56217
+ case "terminal":
56218
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(TerminalOptions, {
56219
+ settings,
56220
+ onChange: setSettings,
56221
+ onBack: () => {
56222
+ setScreen("main");
56223
+ }
56224
+ }, undefined, false, undefined, this);
56225
+ case "overrides":
56226
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(GlobalOverrides, {
56227
+ settings,
56228
+ onChange: setSettings,
56229
+ onBack: () => {
56230
+ setScreen("main");
56231
+ }
56232
+ }, undefined, false, undefined, this);
56233
+ case "installation":
56234
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(InstallationMenu, {
56235
+ integration,
56236
+ busy,
56237
+ onInstall: (mode) => {
56238
+ handleInstall(mode);
56239
+ },
56240
+ onUninstall: () => {
56241
+ handleUninstall();
56242
+ },
56243
+ onBack: () => {
56244
+ setScreen("main");
56245
+ }
56246
+ }, undefined, false, undefined, this);
56247
+ case "confirmSave":
56248
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Box_default, {
56249
+ flexDirection: "column",
56250
+ children: [
56251
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
56252
+ bold: true,
56253
+ color: "yellow",
56254
+ children: "Replace Invalid Configuration?"
56255
+ }, undefined, false, undefined, this),
56256
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Box_default, {
56257
+ marginTop: 1,
56258
+ children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
56259
+ color: "red",
56260
+ wrap: "wrap",
56261
+ children: loadError2
56262
+ }, undefined, false, undefined, this)
56263
+ }, undefined, false, undefined, this),
56264
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
56265
+ dimColor: true,
56266
+ children: "Saving replaces the malformed file with the current configuration."
56267
+ }, undefined, false, undefined, this),
56268
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(List, {
56269
+ marginTop: 1,
56270
+ color: "cyan",
56271
+ items: [
56272
+ { label: "Replace configuration", value: "replace" },
56273
+ { label: "← Cancel", value: "cancel" }
56274
+ ],
56275
+ onSelect: (value) => {
56276
+ if (value === "replace") {
56277
+ setScreen("main");
56278
+ performSave(pendingSaveExit);
56279
+ } else {
56280
+ setScreen("main");
56281
+ }
56282
+ }
56283
+ }, undefined, false, undefined, this)
56284
+ ]
56285
+ }, undefined, true, undefined, this);
56286
+ case "main":
56287
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(MainMenu, {
56288
+ integration,
56289
+ hasChanges,
56290
+ initialSelection: mainSelection,
56291
+ onSelect: handleMainMenu
56292
+ }, undefined, false, undefined, this);
56293
+ }
56294
+ })();
56295
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Box_default, {
53386
56296
  flexDirection: "column",
53387
- paddingX: 1,
53388
56297
  children: [
53389
- /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Header, {
53390
- integration
53391
- }, undefined, false, undefined, this),
53392
- message === null ? null : /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
56298
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Box_default, {
53393
56299
  marginBottom: 1,
53394
- children: /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
53395
- color: "yellow",
53396
- children: message
53397
- }, undefined, false, undefined, this)
53398
- }, undefined, false, undefined, this),
53399
- busy ? /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
53400
- children: "Working…"
53401
- }, undefined, false, undefined, this) : screen === "editor" ? /* @__PURE__ */ jsx_dev_runtime.jsxDEV(WidgetEditor, {
53402
- settings,
53403
- onChange: setSettings,
53404
- onBack: () => {
53405
- setScreen("menu");
53406
- }
53407
- }, undefined, false, undefined, this) : screen === "install" ? /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
53408
- flexDirection: "column",
53409
56300
  children: [
53410
- /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
56301
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(GradientTitle, {}, undefined, false, undefined, this),
56302
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
53411
56303
  bold: true,
53412
- children: "Install command"
53413
- }, undefined, false, undefined, this),
53414
- /* @__PURE__ */ jsx_dev_runtime.jsxDEV(SelectInput_default, {
53415
- items: INSTALL_ITEMS,
53416
- onSelect: (item) => void handleInstall(item.value)
53417
- }, undefined, false, undefined, this)
53418
- ]
53419
- }, undefined, true, undefined, this) : /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
53420
- flexDirection: "column",
53421
- children: [
53422
- /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
53423
56304
  dimColor: true,
53424
56305
  children: [
53425
- "Config:",
53426
- getSettingsPath()
56306
+ " | v",
56307
+ package_default.version
53427
56308
  ]
53428
56309
  }, undefined, true, undefined, this),
53429
- /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
53430
- dimColor: true,
56310
+ flashMessage === null ? null : /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
56311
+ bold: true,
56312
+ color: flashMessage.color,
53431
56313
  children: [
53432
- "Powerline:",
53433
- settings.powerline.enabled ? "on" : "off"
56314
+ " ",
56315
+ flashMessage.text
53434
56316
  ]
53435
- }, undefined, true, undefined, this),
53436
- /* @__PURE__ */ jsx_dev_runtime.jsxDEV(SelectInput_default, {
53437
- items: MENU_ITEMS,
53438
- onSelect: (item) => void handleMenu(item.value)
53439
- }, undefined, false, undefined, this)
56317
+ }, undefined, true, undefined, this)
56318
+ ]
56319
+ }, undefined, true, undefined, this),
56320
+ loadError2 === null || screen === "confirmSave" ? null : /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
56321
+ color: "red",
56322
+ wrap: "wrap",
56323
+ children: [
56324
+ "⚠",
56325
+ " ",
56326
+ loadError2,
56327
+ " — showing defaults; saving requires confirmation."
53440
56328
  ]
53441
- }, undefined, true, undefined, this)
56329
+ }, undefined, true, undefined, this),
56330
+ isSettingsPathCustom() ? /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Text, {
56331
+ dimColor: true,
56332
+ children: `Config: ${getSettingsPath()}`
56333
+ }, undefined, false, undefined, this) : null,
56334
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(StatusLinePreview, {
56335
+ settings,
56336
+ terminalWidth: terminalWidth2
56337
+ }, undefined, false, undefined, this),
56338
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Box_default, {
56339
+ marginTop: 1,
56340
+ children: screenContent
56341
+ }, undefined, false, undefined, this)
53442
56342
  ]
53443
56343
  }, undefined, true, undefined, this);
53444
56344
  }
53445
- var import_react29, jsx_dev_runtime, MENU_ITEMS, INSTALL_ITEMS;
56345
+ var import_react33, jsx_dev_runtime7;
53446
56346
  var init_App2 = __esm(async () => {
53447
- init_Settings();
56347
+ init_package();
53448
56348
  init_app_settings();
53449
56349
  init_copilot_settings();
53450
- init_catalog();
53451
56350
  await __promiseAll([
53452
56351
  init_build2(),
56352
+ init_dist5(),
53453
56353
  init_build3(),
53454
- init_build4()
56354
+ init_ColorEditor(),
56355
+ init_LineSelector(),
56356
+ init_List(),
56357
+ init_MainMenu(),
56358
+ init_StatusLinePreview(),
56359
+ init_WidgetEditor()
53455
56360
  ]);
53456
- import_react29 = __toESM(require_react(), 1);
53457
- jsx_dev_runtime = __toESM(require_jsx_dev_runtime(), 1);
53458
- MENU_ITEMS = [
53459
- { label: "Edit status lines", value: "edit" },
53460
- { label: "Toggle Powerline", value: "powerline" },
53461
- { label: "Install or repair Copilot integration", value: "install" },
53462
- { label: "Uninstall Copilot integration", value: "uninstall" },
53463
- { label: "Save and exit", value: "save" },
53464
- { label: "Exit without saving", value: "exit" }
53465
- ];
53466
- INSTALL_ITEMS = [
53467
- { label: "npx -y @willh/copilotstatusline@latest", value: "npm" },
53468
- { label: "bunx -y @willh/copilotstatusline@latest", value: "bunx" },
53469
- { label: "Global copilotstatusline binary", value: "global" },
53470
- { label: "Back", value: "back" }
53471
- ];
56361
+ import_react33 = __toESM(require_react(), 1);
56362
+ jsx_dev_runtime7 = __toESM(require_jsx_dev_runtime(), 1);
53472
56363
  });
53473
56364
 
53474
56365
  // src/tui/index.tsx
@@ -53481,10 +56372,10 @@ async function runTui() {
53481
56372
  loadSettings({ createIfMissing: true }),
53482
56373
  inspectCopilotIntegration().catch(() => null)
53483
56374
  ]);
53484
- const instance = render_default(import_react30.default.createElement(App2, { settings, integration }));
56375
+ const instance = render_default(import_react34.default.createElement(App2, { settings, integration }));
53485
56376
  await instance.waitUntilExit();
53486
56377
  }
53487
- var import_react30;
56378
+ var import_react34;
53488
56379
  var init_tui = __esm(async () => {
53489
56380
  init_app_settings();
53490
56381
  init_copilot_settings();
@@ -53492,7 +56383,7 @@ var init_tui = __esm(async () => {
53492
56383
  init_build2(),
53493
56384
  init_App2()
53494
56385
  ]);
53495
- import_react30 = __toESM(require_react(), 1);
56386
+ import_react34 = __toESM(require_react(), 1);
53496
56387
  });
53497
56388
 
53498
56389
  // src/types/copilot-status.ts
@@ -53599,190 +56490,8 @@ function normalizeCopilotStatus(status) {
53599
56490
  // src/copilotstatusline.ts
53600
56491
  init_app_settings();
53601
56492
  init_copilot_settings();
53602
-
53603
- // src/utils/renderer.ts
53604
- init_slice_ansi();
53605
- init_catalog();
53606
-
53607
- // src/utils/ansi.ts
53608
- var foregroundCodes = {
53609
- none: null,
53610
- black: 30,
53611
- red: 31,
53612
- green: 32,
53613
- yellow: 33,
53614
- blue: 34,
53615
- magenta: 35,
53616
- cyan: 36,
53617
- white: 37,
53618
- brightBlack: 90,
53619
- brightRed: 91,
53620
- brightGreen: 92,
53621
- brightYellow: 93,
53622
- brightBlue: 94,
53623
- brightMagenta: 95,
53624
- brightCyan: 96,
53625
- brightWhite: 97
53626
- };
53627
- var backgroundCodes = {
53628
- none: null,
53629
- black: 40,
53630
- red: 41,
53631
- green: 42,
53632
- yellow: 43,
53633
- blue: 44,
53634
- magenta: 45,
53635
- cyan: 46,
53636
- white: 47,
53637
- brightBlack: 100,
53638
- brightRed: 101,
53639
- brightGreen: 102,
53640
- brightYellow: 103,
53641
- brightBlue: 104,
53642
- brightMagenta: 105,
53643
- brightCyan: 106,
53644
- brightWhite: 107
53645
- };
53646
- function styleText(value, foreground, background = "none", bold = false, colorLevel = 2) {
53647
- if (colorLevel === 0 || value === "") {
53648
- return value;
53649
- }
53650
- const codes = [];
53651
- if (bold) {
53652
- codes.push(1);
53653
- }
53654
- const foregroundCode = foregroundCodes[foreground];
53655
- const backgroundCode = backgroundCodes[background];
53656
- if (foregroundCode !== null) {
53657
- codes.push(foregroundCode);
53658
- }
53659
- if (backgroundCode !== null) {
53660
- codes.push(backgroundCode);
53661
- }
53662
- return codes.length === 0 ? value : `\x1B[${codes.join(";")}m${value}\x1B[0m`;
53663
- }
53664
- function powerlineArrow(value, foreground, background, colorLevel) {
53665
- return styleText(value, foreground, background, false, colorLevel);
53666
- }
53667
-
53668
- // src/utils/renderer.ts
53669
- init_format();
53670
- var FLEX = "__COPILOTSTATUSLINE_FLEX__";
53671
- var POWERLINE_BACKGROUNDS = [
53672
- "blue",
53673
- "magenta",
53674
- "cyan",
53675
- "green",
53676
- "yellow"
53677
- ];
53678
- function terminalWidth(override) {
53679
- if (override !== undefined && override > 0) {
53680
- return override;
53681
- }
53682
- const fromEnvironment = Number(process.env.COLUMNS);
53683
- if (Number.isFinite(fromEnvironment) && fromEnvironment > 0) {
53684
- return fromEnvironment;
53685
- }
53686
- return process.stdout.columns > 0 ? process.stdout.columns : 120;
53687
- }
53688
- function truncate(value, width) {
53689
- if (width <= 0) {
53690
- return "";
53691
- }
53692
- if (visibleWidth(value) <= width) {
53693
- return value;
53694
- }
53695
- if (width === 1) {
53696
- return "…";
53697
- }
53698
- const reset = value.includes("\x1B[") ? "\x1B[0m" : "";
53699
- return `${sliceAnsi(value, 0, width - 1)}…${reset}`;
53700
- }
53701
- function renderStandardLine(widgets, settings, status, width) {
53702
- const parts = widgets.flatMap((widget2) => {
53703
- const value = renderWidget(widget2, {
53704
- status,
53705
- terminalWidth: width,
53706
- gitCacheTtlSeconds: settings.gitCacheTtlSeconds
53707
- });
53708
- if (value === null) {
53709
- return [];
53710
- }
53711
- return [{
53712
- widget: widget2,
53713
- value: value === FLEX ? FLEX : styleText(value, widget2.color, widget2.backgroundColor, widget2.bold, settings.colorLevel)
53714
- }];
53715
- });
53716
- let output = "";
53717
- for (const [index, part] of parts.entries()) {
53718
- const previous = parts[index - 1];
53719
- const needsSeparator = index > 0 && part.value !== FLEX && previous?.value !== FLEX && !part.widget.merge;
53720
- if (needsSeparator) {
53721
- output += settings.defaultSeparator;
53722
- }
53723
- output += part.value;
53724
- }
53725
- if (output.includes(FLEX)) {
53726
- const fixedWidth = visibleWidth(output.replaceAll(FLEX, ""));
53727
- const flexCount = output.split(FLEX).length - 1;
53728
- const available = Math.max(1, width - fixedWidth);
53729
- const each = Math.floor(available / flexCount);
53730
- let remainder = available % flexCount;
53731
- output = output.replaceAll(FLEX, () => {
53732
- const spaces = each + (remainder > 0 ? 1 : 0);
53733
- remainder = Math.max(0, remainder - 1);
53734
- return " ".repeat(spaces);
53735
- });
53736
- }
53737
- return truncate(output, width);
53738
- }
53739
- function renderPowerlineLine(widgets, settings, status, width) {
53740
- const rendered = widgets.flatMap((widget2, index) => {
53741
- const value = renderWidget(widget2, {
53742
- status,
53743
- terminalWidth: width,
53744
- gitCacheTtlSeconds: settings.gitCacheTtlSeconds
53745
- });
53746
- if (value === null) {
53747
- return [];
53748
- }
53749
- if (value === FLEX) {
53750
- return [{ value, background: "none" }];
53751
- }
53752
- const background = widget2.backgroundColor === "none" ? POWERLINE_BACKGROUNDS[index % POWERLINE_BACKGROUNDS.length] ?? "blue" : widget2.backgroundColor;
53753
- const foreground = background === "yellow" || background === "brightYellow" ? "black" : "brightWhite";
53754
- return [{
53755
- value: styleText(` ${value} `, foreground, background, widget2.bold, settings.colorLevel),
53756
- background
53757
- }];
53758
- });
53759
- let output = "";
53760
- for (const [index, part] of rendered.entries()) {
53761
- if (part.value === FLEX) {
53762
- output += FLEX;
53763
- continue;
53764
- }
53765
- output += part.value;
53766
- const next = rendered[index + 1];
53767
- const nextBackground = next?.value === FLEX ? "none" : next?.background ?? "none";
53768
- output += powerlineArrow(settings.powerline.separator, part.background, nextBackground, settings.colorLevel);
53769
- }
53770
- if (output.includes(FLEX)) {
53771
- const available = Math.max(1, width - visibleWidth(output.replaceAll(FLEX, "")));
53772
- output = output.replaceAll(FLEX, " ".repeat(available));
53773
- }
53774
- return truncate(output, width);
53775
- }
53776
- function renderStatusLines(status, settings, options = {}) {
53777
- const width = terminalWidth(options.terminalWidth);
53778
- return settings.lines.flatMap((line) => {
53779
- const rendered = settings.powerline.enabled ? renderPowerlineLine(line, settings, status, width) : renderStandardLine(line, settings, status, width);
53780
- return visibleWidth(rendered) === 0 ? [] : [rendered];
53781
- });
53782
- }
53783
-
53784
- // src/copilotstatusline.ts
53785
- var PACKAGE_VERSION = "0.1.1";
56493
+ init_renderer();
56494
+ var PACKAGE_VERSION = "0.2.0";
53786
56495
  async function readStdin() {
53787
56496
  process.stdin.setEncoding("utf8");
53788
56497
  const chunks = [];