take4-console 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/CHANGELOG.md +287 -0
  2. package/LICENSE +21 -0
  3. package/README.md +986 -0
  4. package/dist/Screen/InterfaceBuilder.d.mts +43 -0
  5. package/dist/Screen/InterfaceBuilder.d.mts.map +1 -0
  6. package/dist/Screen/InterfaceBuilder.mjs +355 -0
  7. package/dist/Screen/InterfaceBuilder.mjs.map +1 -0
  8. package/dist/Screen/Pos.d.mts +52 -0
  9. package/dist/Screen/Pos.d.mts.map +1 -0
  10. package/dist/Screen/Pos.mjs +105 -0
  11. package/dist/Screen/Pos.mjs.map +1 -0
  12. package/dist/Screen/Region.d.mts +31 -0
  13. package/dist/Screen/Region.d.mts.map +1 -0
  14. package/dist/Screen/Region.mjs +73 -0
  15. package/dist/Screen/Region.mjs.map +1 -0
  16. package/dist/Screen/RegistryHolder.d.mts +6 -0
  17. package/dist/Screen/RegistryHolder.d.mts.map +1 -0
  18. package/dist/Screen/RegistryHolder.mjs +14 -0
  19. package/dist/Screen/RegistryHolder.mjs.map +1 -0
  20. package/dist/Screen/Screen.d.mts +25 -0
  21. package/dist/Screen/Screen.d.mts.map +1 -0
  22. package/dist/Screen/Screen.mjs +100 -0
  23. package/dist/Screen/Screen.mjs.map +1 -0
  24. package/dist/Screen/Size.d.mts +23 -0
  25. package/dist/Screen/Size.d.mts.map +1 -0
  26. package/dist/Screen/Size.mjs +48 -0
  27. package/dist/Screen/Size.mjs.map +1 -0
  28. package/dist/Screen/StyleRegistry.d.mts +32 -0
  29. package/dist/Screen/StyleRegistry.d.mts.map +1 -0
  30. package/dist/Screen/StyleRegistry.mjs +80 -0
  31. package/dist/Screen/StyleRegistry.mjs.map +1 -0
  32. package/dist/Screen/Window.d.mts +121 -0
  33. package/dist/Screen/Window.d.mts.map +1 -0
  34. package/dist/Screen/Window.mjs +407 -0
  35. package/dist/Screen/Window.mjs.map +1 -0
  36. package/dist/Screen/WindowManager.d.mts +86 -0
  37. package/dist/Screen/WindowManager.d.mts.map +1 -0
  38. package/dist/Screen/WindowManager.mjs +399 -0
  39. package/dist/Screen/WindowManager.mjs.map +1 -0
  40. package/dist/Screen/controls/BarChart.d.mts +29 -0
  41. package/dist/Screen/controls/BarChart.d.mts.map +1 -0
  42. package/dist/Screen/controls/BarChart.mjs +90 -0
  43. package/dist/Screen/controls/BarChart.mjs.map +1 -0
  44. package/dist/Screen/controls/Button.d.mts +16 -0
  45. package/dist/Screen/controls/Button.d.mts.map +1 -0
  46. package/dist/Screen/controls/Button.mjs +34 -0
  47. package/dist/Screen/controls/Button.mjs.map +1 -0
  48. package/dist/Screen/controls/Checkbox.d.mts +23 -0
  49. package/dist/Screen/controls/Checkbox.d.mts.map +1 -0
  50. package/dist/Screen/controls/Checkbox.mjs +55 -0
  51. package/dist/Screen/controls/Checkbox.mjs.map +1 -0
  52. package/dist/Screen/controls/LineChart.d.mts +29 -0
  53. package/dist/Screen/controls/LineChart.d.mts.map +1 -0
  54. package/dist/Screen/controls/LineChart.mjs +172 -0
  55. package/dist/Screen/controls/LineChart.mjs.map +1 -0
  56. package/dist/Screen/controls/ListBox.d.mts +34 -0
  57. package/dist/Screen/controls/ListBox.d.mts.map +1 -0
  58. package/dist/Screen/controls/ListBox.mjs +138 -0
  59. package/dist/Screen/controls/ListBox.mjs.map +1 -0
  60. package/dist/Screen/controls/ProgressBar.d.mts +26 -0
  61. package/dist/Screen/controls/ProgressBar.d.mts.map +1 -0
  62. package/dist/Screen/controls/ProgressBar.mjs +70 -0
  63. package/dist/Screen/controls/ProgressBar.mjs.map +1 -0
  64. package/dist/Screen/controls/ProgressBarV.d.mts +22 -0
  65. package/dist/Screen/controls/ProgressBarV.d.mts.map +1 -0
  66. package/dist/Screen/controls/ProgressBarV.mjs +61 -0
  67. package/dist/Screen/controls/ProgressBarV.mjs.map +1 -0
  68. package/dist/Screen/controls/Radio.d.mts +23 -0
  69. package/dist/Screen/controls/Radio.d.mts.map +1 -0
  70. package/dist/Screen/controls/Radio.mjs +55 -0
  71. package/dist/Screen/controls/Radio.mjs.map +1 -0
  72. package/dist/Screen/controls/Sparkline.d.mts +29 -0
  73. package/dist/Screen/controls/Sparkline.d.mts.map +1 -0
  74. package/dist/Screen/controls/Sparkline.mjs +82 -0
  75. package/dist/Screen/controls/Sparkline.mjs.map +1 -0
  76. package/dist/Screen/controls/Spinner.d.mts +37 -0
  77. package/dist/Screen/controls/Spinner.d.mts.map +1 -0
  78. package/dist/Screen/controls/Spinner.mjs +87 -0
  79. package/dist/Screen/controls/Spinner.mjs.map +1 -0
  80. package/dist/Screen/controls/StatusLED.d.mts +22 -0
  81. package/dist/Screen/controls/StatusLED.d.mts.map +1 -0
  82. package/dist/Screen/controls/StatusLED.mjs +51 -0
  83. package/dist/Screen/controls/StatusLED.mjs.map +1 -0
  84. package/dist/Screen/controls/Tabs.d.mts +42 -0
  85. package/dist/Screen/controls/Tabs.d.mts.map +1 -0
  86. package/dist/Screen/controls/Tabs.mjs +126 -0
  87. package/dist/Screen/controls/Tabs.mjs.map +1 -0
  88. package/dist/Screen/controls/TextArea.d.mts +41 -0
  89. package/dist/Screen/controls/TextArea.d.mts.map +1 -0
  90. package/dist/Screen/controls/TextArea.mjs +197 -0
  91. package/dist/Screen/controls/TextArea.mjs.map +1 -0
  92. package/dist/Screen/controls/TextBox.d.mts +35 -0
  93. package/dist/Screen/controls/TextBox.d.mts.map +1 -0
  94. package/dist/Screen/controls/TextBox.mjs +135 -0
  95. package/dist/Screen/controls/TextBox.mjs.map +1 -0
  96. package/dist/Screen/types.d.mts +399 -0
  97. package/dist/Screen/types.d.mts.map +1 -0
  98. package/dist/Screen/types.mjs +22 -0
  99. package/dist/Screen/types.mjs.map +1 -0
  100. package/dist/index.d.mts +26 -0
  101. package/dist/index.d.mts.map +1 -0
  102. package/dist/index.mjs +41 -0
  103. package/dist/index.mjs.map +1 -0
  104. package/package.json +72 -0
  105. package/src/Screen/InterfaceBuilder.mts +403 -0
  106. package/src/Screen/Pos.mts +119 -0
  107. package/src/Screen/Region.mts +88 -0
  108. package/src/Screen/RegistryHolder.mts +16 -0
  109. package/src/Screen/Screen.mts +103 -0
  110. package/src/Screen/Size.mts +55 -0
  111. package/src/Screen/StyleRegistry.mts +95 -0
  112. package/src/Screen/Window.mts +439 -0
  113. package/src/Screen/WindowManager.mts +472 -0
  114. package/src/Screen/controls/BarChart.mts +109 -0
  115. package/src/Screen/controls/Button.mts +40 -0
  116. package/src/Screen/controls/Checkbox.mts +66 -0
  117. package/src/Screen/controls/LineChart.mts +202 -0
  118. package/src/Screen/controls/ListBox.mts +154 -0
  119. package/src/Screen/controls/ProgressBar.mts +88 -0
  120. package/src/Screen/controls/ProgressBarV.mts +77 -0
  121. package/src/Screen/controls/Radio.mts +66 -0
  122. package/src/Screen/controls/Sparkline.mts +101 -0
  123. package/src/Screen/controls/Spinner.mts +102 -0
  124. package/src/Screen/controls/StatusLED.mts +65 -0
  125. package/src/Screen/controls/Tabs.mts +140 -0
  126. package/src/Screen/controls/TextArea.mts +194 -0
  127. package/src/Screen/controls/TextBox.mts +139 -0
  128. package/src/Screen/types.mts +416 -0
  129. package/src/demo.mts +171 -0
  130. package/src/index.mts +105 -0
  131. package/src/layout.yaml +236 -0
@@ -0,0 +1,61 @@
1
+ import { Window } from '../Window.mjs';
2
+ import { getRegistry } from '../RegistryHolder.mjs';
3
+ /** Character used for the filled portion of the bar. */
4
+ const CHAR_FILL = '█';
5
+ /** Character used for the empty portion of the bar. */
6
+ const CHAR_EMPTY = '░';
7
+ /** A vertical read-only progress bar that fills from the bottom upward using block characters. */
8
+ export class ProgressBarV extends Window {
9
+ value;
10
+ max;
11
+ fillStyleId;
12
+ emptyStyleId;
13
+ /** Creates a ProgressBarV from window properties and optional control-specific properties.
14
+ * Uses the global StyleRegistry set by the Screen constructor. */
15
+ constructor(wp, cp) {
16
+ super(wp);
17
+ this.max = Math.max(1, cp?.max ?? 100);
18
+ this.value = Math.max(0, Math.min(cp?.value ?? 0, this.max));
19
+ const reg = getRegistry();
20
+ this.fillStyleId = reg.register({ background: cp?.fillColor ?? 75 });
21
+ this.emptyStyleId = reg.register({ background: cp?.emptyColor ?? 237 });
22
+ }
23
+ /** Sets the current value (clamped to 0–max). Call render() afterwards. */
24
+ setValue(value) {
25
+ this.value = Math.max(0, Math.min(value, this.max));
26
+ }
27
+ /** Returns the current value. */
28
+ getValue() {
29
+ return this.value;
30
+ }
31
+ /** Sets the maximum value (minimum 1). Call render() afterwards. */
32
+ setMax(max) {
33
+ this.max = Math.max(1, max);
34
+ this.value = Math.min(this.value, this.max);
35
+ }
36
+ /** Returns the maximum value. */
37
+ getMax() {
38
+ return this.max;
39
+ }
40
+ render() {
41
+ this.clear();
42
+ const { width, height } = this.getInnerSize();
43
+ const { x: ox, y: oy } = this.getInnerOffset();
44
+ if (width < 1 || height < 1) {
45
+ super.render();
46
+ return;
47
+ }
48
+ const ratio = this.max > 0 ? Math.min(1, Math.max(0, this.value / this.max)) : 0;
49
+ const filledRows = Math.round(ratio * height);
50
+ for (let row = 0; row < height; row++) {
51
+ const isFilled = row >= (height - filledRows);
52
+ const char = isFilled ? CHAR_FILL : CHAR_EMPTY;
53
+ const styleId = isFilled ? this.fillStyleId : this.emptyStyleId;
54
+ for (let col = 0; col < width; col++) {
55
+ this.setCell(ox + col, oy + row, char, styleId);
56
+ }
57
+ }
58
+ super.render();
59
+ }
60
+ }
61
+ //# sourceMappingURL=ProgressBarV.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProgressBarV.mjs","sourceRoot":"","sources":["../../../src/Screen/controls/ProgressBarV.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,wDAAwD;AACxD,MAAM,SAAS,GAAI,GAAG,CAAC;AACvB,uDAAuD;AACvD,MAAM,UAAU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AK,EAAE,GAAG,EAAE,EAAE,CAAC;gBACtC,IAAI,CAAC,OAAO,CAAC,EAAE,GAAG,GAAG,EAAE,EAAE,GAAG,GAAG,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;YACjD,CAAC;QACF,CAAC;QAED,KAAK,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;CACD"}
@@ -0,0 +1,23 @@
1
+ import type { RadioProperties, WindowProperties } from '../types.mjs';
2
+ import { Window } from '../Window.mjs';
3
+ /** A single-selection radio control rendering `(●) label` (selected) or `( ) label` (unselected).
4
+ * Width is derived automatically from the label length when size is not provided.
5
+ * Group management (ensuring at most one is selected) is the caller's responsibility. */
6
+ export declare class Radio extends Window {
7
+ private checked;
8
+ private onChange?;
9
+ private checkedStyleId;
10
+ /** Creates a Radio button from window properties and optional control-specific properties.
11
+ * When wp.size is omitted, width is computed from wp.label automatically.
12
+ * Uses the global StyleRegistry set by the Screen constructor. */
13
+ constructor(wp: WindowProperties, cp?: RadioProperties);
14
+ /** Sets the selected state. */
15
+ setChecked(checked: boolean): void;
16
+ /** Returns the current selected state. */
17
+ isChecked(): boolean;
18
+ /** Processes a key press; Space selects this radio button and fires onChange. */
19
+ handleKey(key: string): void;
20
+ /** Rebuilds the radio button: draws indicator and label with appropriate styles. */
21
+ render(): void;
22
+ }
23
+ //# sourceMappingURL=Radio.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Radio.d.mts","sourceRoot":"","sources":["../../../src/Screen/controls/Radio.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAW,MAAM,cAAc,CAAC;AAE/E,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAOvC;;0FAE0F;AAC1F,qBAAa,KAAM,SAAQ,MAAM;IAChC,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,QAAQ,CAAC,CAA6B;IAC9C,OAAO,CAAC,cAAc,CAAU;IAEhC;;uEAEmE;gBAChD,EAAE,EAAE,gBAAgB,EAAE,EAAE,CAAC,EAAE,eAAe;IAW7D,+BAA+B;IACxB,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAIzC,0CAA0C;IACnC,SAAS,IAAI,OAAO;IAI3B,iFAAiF;IAC1E,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAQnC,oFAAoF;IACpE,MAAM,IAAI,IAAI;CAc9B"}
@@ -0,0 +1,55 @@
1
+ import { BUILTIN_TEXT_CHECKED } from '../types.mjs';
2
+ import { Window } from '../Window.mjs';
3
+ import { Size } from '../Size.mjs';
4
+ import { getRegistry } from '../RegistryHolder.mjs';
5
+ /** Width of the indicator prefix: `(●) ` = 4 columns. */
6
+ const INDICATOR_WIDTH = 4;
7
+ /** A single-selection radio control rendering `(●) label` (selected) or `( ) label` (unselected).
8
+ * Width is derived automatically from the label length when size is not provided.
9
+ * Group management (ensuring at most one is selected) is the caller's responsibility. */
10
+ export class Radio extends Window {
11
+ checked;
12
+ onChange;
13
+ checkedStyleId;
14
+ /** Creates a Radio button from window properties and optional control-specific properties.
15
+ * When wp.size is omitted, width is computed from wp.label automatically.
16
+ * Uses the global StyleRegistry set by the Screen constructor. */
17
+ constructor(wp, cp) {
18
+ const label = wp.label ?? '';
19
+ const size = wp.size ?? new Size(INDICATOR_WIDTH + label.length, 1);
20
+ super({ ...wp, size });
21
+ this.checked = cp?.checked ?? false;
22
+ this.onChange = cp?.onChange;
23
+ this.checkedStyleId = getRegistry().getNamed(BUILTIN_TEXT_CHECKED);
24
+ }
25
+ /** Sets the selected state. */
26
+ setChecked(checked) {
27
+ this.checked = checked;
28
+ }
29
+ /** Returns the current selected state. */
30
+ isChecked() {
31
+ return this.checked;
32
+ }
33
+ /** Processes a key press; Space selects this radio button and fires onChange. */
34
+ handleKey(key) {
35
+ if (this.disabled)
36
+ return;
37
+ if (key === ' ' || key === 'space') {
38
+ this.checked = true;
39
+ this.onChange?.(true);
40
+ }
41
+ }
42
+ /** Rebuilds the radio button: draws indicator and label with appropriate styles. */
43
+ render() {
44
+ this.clear();
45
+ const indicator = this.checked ? '(●)' : '( )';
46
+ // For indicator: use checkedStyleId when checked (and not disabled); auto-pick otherwise.
47
+ const indicatorStyle = (!this.disabled && this.checked) ? this.checkedStyleId : undefined;
48
+ // Write indicator (first 3 chars) and label separately to allow distinct colouring.
49
+ // Label uses auto-style (disabled/focused/normal via writeText).
50
+ this.writeText(indicator, { style: indicatorStyle });
51
+ this.writeText(` ${this.label}`, { x: INDICATOR_WIDTH - 1 });
52
+ super.render();
53
+ }
54
+ }
55
+ //# sourceMappingURL=Radio.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Radio.mjs","sourceRoot":"","sources":["../../../src/Screen/controls/Radio.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,yDAAyD;AACzD,MAAM,eAAe,GAAG,CAAC,CAAC;AAE1B;;0FAE0F;AAC1F,MAAM,OAAO,KAAM,SAAQ,MAAM;IACxB,OAAO,CAAU;IACjB,QAAQ,CAA8B;IACtC,cAAc,CAAU;IAEhC;;uEAEmE;IACnE,YAAmB,EAAoB,EAAE,EAAoB;QAC5D,MAAM,KAAK,GAAG,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC;QAC7B,MAAM,IAAI,GAAI,EAAE,CAAC,IAAI,IAAI,IAAI,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QACrE,KAAK,CAAC,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;QAEvB,IAAI,CAAC,OAAO,GAAI,EAAE,EAAE,OAAO,IAAK,KAAK,CAAC;QACtC,IAA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WindowProperties } from '../types.mjs';
2
+ import { Window } from '../Window.mjs';
3
+ /** A one-row inline sparkline chart using block-character glyphs. Ideal for
4
+ * tucking a live trend indicator into status bars, table rows, or tight
5
+ * spaces where a full LineChart would be overkill. The control can be any
6
+ * height, but only the last row is used for the glyphs. */
7
+ export declare class Sparkline extends Window {
8
+ private data;
9
+ private minValue;
10
+ private maxValue;
11
+ private glyphStyleId;
12
+ /** Creates a Sparkline from window properties and optional control-specific properties.
13
+ * Uses the global StyleRegistry set by the Screen constructor. */
14
+ constructor(wp: WindowProperties, cp?: SparklineProperties);
15
+ /** Sets the data series. Call render() afterwards. */
16
+ setData(data: number[]): void;
17
+ /** Returns the current data series. */
18
+ getData(): number[];
19
+ /** Sets the minimum value. Pass undefined to derive from data. Call render() afterwards. */
20
+ setMin(min: number | undefined): void;
21
+ /** Returns the configured minimum value, or undefined if derived from data. */
22
+ getMin(): number | undefined;
23
+ /** Sets the maximum value. Pass undefined to derive from data. Call render() afterwards. */
24
+ setMax(max: number | undefined): void;
25
+ /** Returns the configured maximum value, or undefined if derived from data. */
26
+ getMax(): number | undefined;
27
+ render(): void;
28
+ }
29
+ //# sourceMappingURL=Sparkline.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sparkline.d.mts","sourceRoot":"","sources":["../../../src/Screen/controls/Sparkline.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAW,MAAM,cAAc,CAAC;AACnF,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAMvC;;;4DAG4D;AAC5D,qBAAa,SAAU,SAAQ,MAAM;IACpC,OAAO,CAAC,IAAI,CAAe;IAC3B,OAAO,CAAC,QAAQ,CAAqB;IACrC,OAAO,CAAC,QAAQ,CAAqB;IAErC,OAAO,CAAC,YAAY,CAAU;IAE9B;uEACmE;gBAChD,EAAE,EAAE,gBAAgB,EAAE,EAAE,CAAC,EAAE,mBAAmB;IAUjE,sDAAsD;IAC/C,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI;IAIpC,uCAAuC;IAChC,OAAO,IAAI,MAAM,EAAE;IAI1B,4FAA4F;IACrF,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAI5C,+EAA+E;IACxE,MAAM,IAAI,MAAM,GAAG,SAAS;IAInC,4FAA4F;IACrF,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAI5C,+EAA+E;IACxE,MAAM,IAAI,MAAM,GAAG,SAAS;IAInB,MAAM,IAAI,IAAI;CAwC9B"}
@@ -0,0 +1,82 @@
1
+ import { Window } from '../Window.mjs';
2
+ import { getRegistry } from '../RegistryHolder.mjs';
3
+ /** Eight-level block character ramp from empty → full. */
4
+ const RAMP = [' ', '▁', '▂', '▃', '▄', '▅', '▆', '▇', '█'];
5
+ /** A one-row inline sparkline chart using block-character glyphs. Ideal for
6
+ * tucking a live trend indicator into status bars, table rows, or tight
7
+ * spaces where a full LineChart would be overkill. The control can be any
8
+ * height, but only the last row is used for the glyphs. */
9
+ export class Sparkline extends Window {
10
+ data;
11
+ minValue;
12
+ maxValue;
13
+ glyphStyleId;
14
+ /** Creates a Sparkline from window properties and optional control-specific properties.
15
+ * Uses the global StyleRegistry set by the Screen constructor. */
16
+ constructor(wp, cp) {
17
+ super(wp);
18
+ this.data = cp?.data ?? [];
19
+ this.minValue = cp?.min;
20
+ this.maxValue = cp?.max;
21
+ this.glyphStyleId = getRegistry().register({ foreground: cp?.color ?? 75 });
22
+ }
23
+ /** Sets the data series. Call render() afterwards. */
24
+ setData(data) {
25
+ this.data = data;
26
+ }
27
+ /** Returns the current data series. */
28
+ getData() {
29
+ return this.data;
30
+ }
31
+ /** Sets the minimum value. Pass undefined to derive from data. Call render() afterwards. */
32
+ setMin(min) {
33
+ this.minValue = min;
34
+ }
35
+ /** Returns the configured minimum value, or undefined if derived from data. */
36
+ getMin() {
37
+ return this.minValue;
38
+ }
39
+ /** Sets the maximum value. Pass undefined to derive from data. Call render() afterwards. */
40
+ setMax(max) {
41
+ this.maxValue = max;
42
+ }
43
+ /** Returns the configured maximum value, or undefined if derived from data. */
44
+ getMax() {
45
+ return this.maxValue;
46
+ }
47
+ render() {
48
+ this.clear();
49
+ const { width, height } = this.getInnerSize();
50
+ const { x: ox, y: oy } = this.getInnerOffset();
51
+ if (width < 1 || height < 1 || this.data.length === 0) {
52
+ super.render();
53
+ return;
54
+ }
55
+ const dataMin = this.minValue ?? Math.min(...this.data);
56
+ const dataMax = this.maxValue ?? Math.max(...this.data);
57
+ const range = dataMax - dataMin;
58
+ // Glyphs live on the bottom-most row of the inner area; any rows above
59
+ // remain blank (useful when the caller wants the sparkline aligned to
60
+ // the baseline of a taller container).
61
+ const row = oy + height - 1;
62
+ for (let c = 0; c < width; c++) {
63
+ // Map column → fractional data index so that width != data.length still works.
64
+ let value;
65
+ if (this.data.length === 1) {
66
+ value = this.data[0];
67
+ }
68
+ else {
69
+ const t = (c / Math.max(1, width - 1)) * (this.data.length - 1);
70
+ const i0 = Math.floor(t);
71
+ const i1 = Math.min(i0 + 1, this.data.length - 1);
72
+ const frac = t - i0;
73
+ value = this.data[i0] * (1 - frac) + this.data[i1] * frac;
74
+ }
75
+ const norm = range > 0 ? Math.min(1, Math.max(0, (value - dataMin) / range)) : 0.5;
76
+ const level = Math.round(norm * (RAMP.length - 1));
77
+ this.setCell(ox + c, row, RAMP[level], this.glyphStyleId);
78
+ }
79
+ super.render();
80
+ }
81
+ }
82
+ //# sourceMappingURL=Sparkline.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sparkline.mjs","sourceRoot":"","sources":["../../../src/Screen/controls/Sparkline.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,0DAA0D;AAC1D,MAAM,IAAI,GAAG,CAAC,GAA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AM,EAAE,GAAK,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;gBACpD,MAAM,IAAI,GAAG,CAAC,GAAG,EAAE,CAAC;gBACpB,KAAK,GAAQ,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC;YAChE,CAAC;YAED,MAAM,IAAI,GAAI,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,GAAG,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;YACpF,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;YACnD,IAAI,CAAC,OAAO,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QAC3D,CAAC;QAED,KAAK,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;CACD"}
@@ -0,0 +1,37 @@
1
+ import type { SpinnerProperties, WindowProperties } from '../types.mjs';
2
+ import { Window } from '../Window.mjs';
3
+ /** Animation style name → frame sequence. */
4
+ declare const SPINNER_FRAMES: Record<'braille' | 'dots' | 'line' | 'circle' | 'arrow', string[]>;
5
+ /** A read-only animated loader indicator. Holds an animation frame index that
6
+ * advances manually via step() — typically driven by setInterval() in the
7
+ * demo, but any external clock source will do. The glyph is rendered to the
8
+ * left of an optional text label. */
9
+ export declare class Spinner extends Window {
10
+ private styleName;
11
+ private frames;
12
+ private frame;
13
+ private running;
14
+ private glyphStyleId;
15
+ private labelStyleId;
16
+ /** Creates a Spinner from window properties and optional control-specific properties.
17
+ * When wp.size is omitted, width is auto-computed as max(frameWidth) + (label ? 1 + label.length : 0).
18
+ * Uses the global StyleRegistry set by the Screen constructor. */
19
+ constructor(wp: WindowProperties, cp?: SpinnerProperties);
20
+ /** Advances the animation by one frame. No-op when running is false. */
21
+ step(): void;
22
+ /** Sets the current frame index directly. Wraps into the valid range. */
23
+ setFrame(frame: number): void;
24
+ /** Returns the current frame index. */
25
+ getFrame(): number;
26
+ /** Starts or resumes the animation. step() will advance frames again. */
27
+ start(): void;
28
+ /** Pauses the animation. step() becomes a no-op; the current frame stays visible. */
29
+ stop(): void;
30
+ /** Returns whether the spinner is currently animating. */
31
+ isRunning(): boolean;
32
+ /** Returns the animation style name. */
33
+ getStyleName(): keyof typeof SPINNER_FRAMES;
34
+ render(): void;
35
+ }
36
+ export {};
37
+ //# sourceMappingURL=Spinner.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Spinner.d.mts","sourceRoot":"","sources":["../../../src/Screen/controls/Spinner.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAW,MAAM,cAAc,CAAC;AAEjF,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAIvC,6CAA6C;AAC7C,QAAA,MAAM,cAAc,EAAE,MAAM,CAAC,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,EAAE,MAAM,EAAE,CAMtF,CAAC;AAEF;;;sCAGsC;AACtC,qBAAa,OAAQ,SAAQ,MAAM;IAClC,OAAO,CAAC,SAAS,CAA8B;IAC/C,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,KAAK,CAAa;IAC1B,OAAO,CAAC,OAAO,CAAY;IAC3B,OAAO,CAAC,YAAY,CAAU;IAC9B,OAAO,CAAC,YAAY,CAAU;IAE9B;;uEAEmE;gBAChD,EAAE,EAAE,gBAAgB,EAAE,EAAE,CAAC,EAAE,iBAAiB;IAoB/D,wEAAwE;IACjE,IAAI,IAAI,IAAI;IAKnB,yEAAyE;IAClE,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAKpC,uCAAuC;IAChC,QAAQ,IAAI,MAAM;IAIzB,yEAAyE;IAClE,KAAK,IAAI,IAAI;IAIpB,qFAAqF;IAC9E,IAAI,IAAI,IAAI;IAInB,0DAA0D;IACnD,SAAS,IAAI,OAAO;IAI3B,wCAAwC;IACjC,YAAY,IAAI,MAAM,OAAO,cAAc;IAIlC,MAAM,IAAI,IAAI;CAc9B"}
@@ -0,0 +1,87 @@
1
+ import { BUILTIN_TEXT } from '../types.mjs';
2
+ import { Window } from '../Window.mjs';
3
+ import { Size } from '../Size.mjs';
4
+ import { getRegistry } from '../RegistryHolder.mjs';
5
+ /** Animation style name → frame sequence. */
6
+ const SPINNER_FRAMES = {
7
+ braille: ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'],
8
+ dots: ['. ', '.. ', '...', ' ..', ' .', ' '],
9
+ line: ['|', '/', '-', '\\'],
10
+ circle: ['◐', '◓', '◑', '◒'],
11
+ arrow: ['←', '↖', '↑', '↗', '→', '↘', '↓', '↙'],
12
+ };
13
+ /** A read-only animated loader indicator. Holds an animation frame index that
14
+ * advances manually via step() — typically driven by setInterval() in the
15
+ * demo, but any external clock source will do. The glyph is rendered to the
16
+ * left of an optional text label. */
17
+ export class Spinner extends Window {
18
+ styleName;
19
+ frames;
20
+ frame;
21
+ running;
22
+ glyphStyleId;
23
+ labelStyleId;
24
+ /** Creates a Spinner from window properties and optional control-specific properties.
25
+ * When wp.size is omitted, width is auto-computed as max(frameWidth) + (label ? 1 + label.length : 0).
26
+ * Uses the global StyleRegistry set by the Screen constructor. */
27
+ constructor(wp, cp) {
28
+ const reg = getRegistry();
29
+ const styleName = cp?.style ?? 'braille';
30
+ const frames = SPINNER_FRAMES[styleName];
31
+ const label = wp.label ?? '';
32
+ const glyphW = Math.max(...frames.map(f => [...f].length));
33
+ const width = glyphW + (label.length > 0 ? 1 + label.length : 0);
34
+ const size = wp.size ?? new Size(Math.max(1, width), 1);
35
+ super({ ...wp, size });
36
+ this.styleName = styleName;
37
+ this.frames = frames;
38
+ this.frame = ((cp?.frame ?? 0) % frames.length + frames.length) % frames.length;
39
+ this.running = cp?.running ?? true;
40
+ this.glyphStyleId = reg.register({ foreground: cp?.color ?? 75, bold: true });
41
+ this.labelStyleId = reg.getNamed(BUILTIN_TEXT);
42
+ }
43
+ /** Advances the animation by one frame. No-op when running is false. */
44
+ step() {
45
+ if (!this.running || this.frames.length === 0)
46
+ return;
47
+ this.frame = (this.frame + 1) % this.frames.length;
48
+ }
49
+ /** Sets the current frame index directly. Wraps into the valid range. */
50
+ setFrame(frame) {
51
+ if (this.frames.length === 0)
52
+ return;
53
+ this.frame = ((frame % this.frames.length) + this.frames.length) % this.frames.length;
54
+ }
55
+ /** Returns the current frame index. */
56
+ getFrame() {
57
+ return this.frame;
58
+ }
59
+ /** Starts or resumes the animation. step() will advance frames again. */
60
+ start() {
61
+ this.running = true;
62
+ }
63
+ /** Pauses the animation. step() becomes a no-op; the current frame stays visible. */
64
+ stop() {
65
+ this.running = false;
66
+ }
67
+ /** Returns whether the spinner is currently animating. */
68
+ isRunning() {
69
+ return this.running;
70
+ }
71
+ /** Returns the animation style name. */
72
+ getStyleName() {
73
+ return this.styleName;
74
+ }
75
+ render() {
76
+ this.clear();
77
+ const glyph = this.frames[this.frame] ?? '';
78
+ this.writeText(glyph, { x: 0, y: 0, style: this.glyphStyleId });
79
+ if (this.label.length > 0) {
80
+ // Leave one space between glyph and label.
81
+ const glyphW = Math.max(...this.frames.map(f => [...f].length));
82
+ this.writeText(' ' + this.label, { x: glyphW, y: 0, style: this.labelStyleId });
83
+ }
84
+ super.render();
85
+ }
86
+ }
87
+ //# sourceMappingURL=Spinner.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Spin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C,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YAChE,IAAI,CAAC,SAAS,CAAC,GAAG,GAAG,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;QACjF,CAAC;QAED,KAAK,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;CACD"}
@@ -0,0 +1,22 @@
1
+ import type { StatusLEDProperties, WindowProperties } from '../types.mjs';
2
+ import { Window } from '../Window.mjs';
3
+ /** A read-only status indicator rendered as a coloured dot with an optional text label.
4
+ * The control auto-sizes its width to fit the label when size is not provided. */
5
+ export declare class StatusLED extends Window {
6
+ private state;
7
+ private offStyleId;
8
+ private okStyleId;
9
+ private warnStyleId;
10
+ private errorStyleId;
11
+ private textStyleId;
12
+ /** Creates a StatusLED from window properties and optional control-specific properties.
13
+ * When wp.size is omitted, width is auto-computed as 2 + label.length.
14
+ * Uses the global StyleRegistry set by the Screen constructor. */
15
+ constructor(wp: WindowProperties, cp?: StatusLEDProperties);
16
+ /** Sets the current LED state. Call render() afterwards to update the display. */
17
+ setState(state: 'ok' | 'warn' | 'error' | 'off'): void;
18
+ /** Returns the current LED state. */
19
+ getState(): 'ok' | 'warn' | 'error' | 'off';
20
+ render(): void;
21
+ }
22
+ //# sourceMappingURL=StatusLED.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StatusLED.d.mts","sourceRoot":"","sources":["../../../src/Screen/controls/StatusLED.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAW,MAAM,cAAc,CAAC;AACnF,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAOvC;mFACmF;AACnF,qBAAa,SAAU,SAAQ,MAAM;IACpC,OAAO,CAAC,KAAK,CAAmC;IAEhD,OAAO,CAAC,UAAU,CAAY;IAC9B,OAAO,CAAC,SAAS,CAAa;IAC9B,OAAO,CAAC,WAAW,CAAW;IAC9B,OAAO,CAAC,YAAY,CAAU;IAC9B,OAAO,CAAC,WAAW,CAAW;IAE9B;;uEAEmE;gBAChD,EAAE,EAAE,gBAAgB,EAAE,EAAE,CAAC,EAAE,mBAAmB;IAgBjE,kFAAkF;IAC3E,QAAQ,CAAC,KAAK,EAAE,IAAI,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,IAAI;IAI7D,qCAAqC;IAC9B,QAAQ,IAAI,IAAI,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK;IAIlC,MAAM,IAAI,IAAI;CAgB9B"}
@@ -0,0 +1,51 @@
1
+ import { Window } from '../Window.mjs';
2
+ import { Size } from '../Size.mjs';
3
+ import { getRegistry } from '../RegistryHolder.mjs';
4
+ /** Width of the indicator dot and trailing space ('● '). */
5
+ const DOT_WIDTH = 2;
6
+ /** A read-only status indicator rendered as a coloured dot with an optional text label.
7
+ * The control auto-sizes its width to fit the label when size is not provided. */
8
+ export class StatusLED extends Window {
9
+ state;
10
+ offStyleId;
11
+ okStyleId;
12
+ warnStyleId;
13
+ errorStyleId;
14
+ textStyleId;
15
+ /** Creates a StatusLED from window properties and optional control-specific properties.
16
+ * When wp.size is omitted, width is auto-computed as 2 + label.length.
17
+ * Uses the global StyleRegistry set by the Screen constructor. */
18
+ constructor(wp, cp) {
19
+ const reg = getRegistry();
20
+ const label = wp.label ?? '';
21
+ const size = wp.size ?? new Size(DOT_WIDTH + label.length, 1);
22
+ super({ ...wp, size });
23
+ this.state = cp?.state ?? 'off';
24
+ this.offStyleId = reg.register({ foreground: 240 });
25
+ this.okStyleId = reg.register({ foreground: 76 });
26
+ this.warnStyleId = reg.register({ foreground: 226 });
27
+ this.errorStyleId = reg.register({ foreground: 196 });
28
+ this.textStyleId = reg.register({ foreground: 252 });
29
+ }
30
+ /** Sets the current LED state. Call render() afterwards to update the display. */
31
+ setState(state) {
32
+ this.state = state;
33
+ }
34
+ /** Returns the current LED state. */
35
+ getState() {
36
+ return this.state;
37
+ }
38
+ render() {
39
+ this.clear();
40
+ const dotStyle = this.state === 'ok' ? this.okStyleId
41
+ : this.state === 'warn' ? this.warnStyleId
42
+ : this.state === 'error' ? this.errorStyleId
43
+ : this.offStyleId;
44
+ this.writeText('●', { x: 0, y: 0, style: dotStyle });
45
+ if (this.label.length > 0) {
46
+ this.writeText(' ' + this.label, { x: 1, y: 0, style: this.textStyleId });
47
+ }
48
+ super.render();
49
+ }
50
+ }
51
+ //# sourceMappingURL=StatusLED.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StatusLED.mjs","sourceRoot":"","sources":["../../../src/Screen/controls/StatusLED.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,4DAA4D;AAC5D,MAAM,SAAS,GAAG,CAAC,CAAC;AAEpB;mFACmF;AACnF,MAAM,OAAO,SAAU,SAAQ,MAAM;IAC5B,KAAK,CAAmC;IAExC,UAAU,CAAY;IACtB,SAAS,CAAa;IACtB,WAAW,CAAW;IACtB,YAAY,CAAU;IACtB,WAAW,CAAW;IAE9B;;uEAEmE;IACnE,YAAmB,EAAoB,EAAE,EAAwB;QAChE,MAAM,GAAG,GAAK,WAAW,EAAE,CAAC;QAC5B,MAAM,KAAK,GAAG,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC;QAC7B,MAAM,IAAI,GAAI,EAAE,CAAC,IAAI,IAAI,IAAI,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QAE/D,KAAK,CAAC,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;QAEvB,IAAI,CAAC,KAAK,GAAG,EAAE,EAAE,KA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AC,EAAE,CAAC;YAC3B,IAAI,CAAC,SAAS,CAAC,GAAG,GAAG,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;QAC3E,CAAC;QAED,KAAK,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;CACD"}
@@ -0,0 +1,42 @@
1
+ import type { TabsProperties, WindowProperties } from '../types.mjs';
2
+ import { Window } from '../Window.mjs';
3
+ /** A tabbed container. Renders a header row with tab titles and shows only the
4
+ * children associated with the active tab index. Other children added via the
5
+ * regular addChild() are treated as "pinned" and stay visible regardless of
6
+ * which tab is active.
7
+ *
8
+ * Keyboard: ← / → cycle tabs while focused. Tab / Shift-Tab remain reserved
9
+ * for the WindowManager focus cycle, so they are never intercepted here. */
10
+ export declare class Tabs extends Window {
11
+ private titles;
12
+ private activeIndex;
13
+ private onChange?;
14
+ /** Maps each tagged child to its tab index. Untagged children are always visible. */
15
+ private childTab;
16
+ private activeTextStyleId;
17
+ private separatorStyleId;
18
+ /** Creates a Tabs control from window properties and optional control-specific properties.
19
+ * Uses the global StyleRegistry set by the Screen constructor. */
20
+ constructor(wp: WindowProperties, cp?: TabsProperties);
21
+ /** Adds a child window and associates it with the given tab index. Children
22
+ * added this way are only rendered while their tab is active. */
23
+ addChildToTab(tabIndex: number, child: Window): void;
24
+ /** Replaces the tab titles. Clamps activeIndex into the new range. */
25
+ setTitles(titles: string[]): void;
26
+ /** Returns the current tab titles. */
27
+ getTitles(): string[];
28
+ /** Sets the active tab index. Clamped to the valid range. Fires onChange if it differs. */
29
+ setActiveIndex(index: number): void;
30
+ /** Returns the currently active tab index. */
31
+ getActiveIndex(): number;
32
+ /** Processes a key press; Left/Right arrows cycle through tabs (no wrap-around). */
33
+ handleKey(key: string): void;
34
+ /** Rebuilds the tabs: draws header row, composites only the active tab's children.
35
+ * Note: content is NOT cleared on each render, so user-written decorations (e.g. sparkline
36
+ * labels placed via writeText) survive across frames. The header row is fully overwritten. */
37
+ render(): void;
38
+ /** Writes the header row (tab titles + separators) into content at y=0. The full
39
+ * width of the row is overwritten so that title changes never leave stale glyphs. */
40
+ private drawHeader;
41
+ }
42
+ //# sourceMappingURL=Tabs.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tabs.d.mts","sourceRoot":"","sources":["../../../src/Screen/controls/Tabs.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAW,MAAM,cAAc,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAGvC;;;;;;6EAM6E;AAC7E,qBAAa,IAAK,SAAQ,MAAM;IAC/B,OAAO,CAAC,MAAM,CAAW;IACzB,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,QAAQ,CAAC,CAAyC;IAC1D,qFAAqF;IACrF,OAAO,CAAC,QAAQ,CAAsB;IACtC,OAAO,CAAC,iBAAiB,CAAU;IACnC,OAAO,CAAC,gBAAgB,CAAU;IAElC;uEACmE;gBAChD,EAAE,EAAE,gBAAgB,EAAE,EAAE,CAAC,EAAE,cAAc;IAiB5D;sEACkE;IAC3D,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAK3D,sEAAsE;IAC/D,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI;IAKxC,sCAAsC;IAC/B,SAAS,IAAI,MAAM,EAAE;IAI5B,2FAA2F;IACpF,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAY1C,8CAA8C;IACvC,cAAc,IAAI,MAAM;IAI/B,oFAAoF;IAC7E,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IASnC;;mGAE+F;IAC/E,MAAM,IAAI,IAAI;IAiB9B;0FACsF;IACtF,OAAO,CAAC,UAAU;CAgClB"}