polyv-live-cli 1.1.4 → 1.1.7

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 (329) hide show
  1. package/dist/commands/account.commands.d.ts +3 -0
  2. package/dist/commands/account.commands.d.ts.map +1 -0
  3. package/dist/commands/account.commands.js +386 -0
  4. package/dist/commands/account.commands.js.map +1 -0
  5. package/dist/commands/channel.commands.d.ts.map +1 -1
  6. package/dist/commands/channel.commands.js +84 -60
  7. package/dist/commands/channel.commands.js.map +1 -1
  8. package/dist/commands/index.d.ts +3 -0
  9. package/dist/commands/index.d.ts.map +1 -1
  10. package/dist/commands/index.js +7 -1
  11. package/dist/commands/index.js.map +1 -1
  12. package/dist/commands/monitor.commands.d.ts +12 -0
  13. package/dist/commands/monitor.commands.d.ts.map +1 -0
  14. package/dist/commands/monitor.commands.js +75 -0
  15. package/dist/commands/monitor.commands.js.map +1 -0
  16. package/dist/commands/stream.commands.d.ts.map +1 -1
  17. package/dist/commands/stream.commands.js +141 -63
  18. package/dist/commands/stream.commands.js.map +1 -1
  19. package/dist/commands/use.commands.d.ts +9 -0
  20. package/dist/commands/use.commands.d.ts.map +1 -0
  21. package/dist/commands/use.commands.js +66 -0
  22. package/dist/commands/use.commands.js.map +1 -0
  23. package/dist/components/alert.panel.d.ts +98 -0
  24. package/dist/components/alert.panel.d.ts.map +1 -0
  25. package/dist/components/alert.panel.js +1001 -0
  26. package/dist/components/alert.panel.js.map +1 -0
  27. package/dist/components/base.component.d.ts +61 -0
  28. package/dist/components/base.component.d.ts.map +1 -0
  29. package/dist/components/base.component.js +346 -0
  30. package/dist/components/base.component.js.map +1 -0
  31. package/dist/components/batch-operations.dialog.d.ts +58 -0
  32. package/dist/components/batch-operations.dialog.d.ts.map +1 -0
  33. package/dist/components/batch-operations.dialog.js +340 -0
  34. package/dist/components/batch-operations.dialog.js.map +1 -0
  35. package/dist/components/channel-details.popup.d.ts +55 -0
  36. package/dist/components/channel-details.popup.d.ts.map +1 -0
  37. package/dist/components/channel-details.popup.js +416 -0
  38. package/dist/components/channel-details.popup.js.map +1 -0
  39. package/dist/components/channel-status.panel.d.ts +129 -0
  40. package/dist/components/channel-status.panel.d.ts.map +1 -0
  41. package/dist/components/channel-status.panel.js +858 -0
  42. package/dist/components/channel-status.panel.js.map +1 -0
  43. package/dist/components/component-registry.d.ts +36 -0
  44. package/dist/components/component-registry.d.ts.map +1 -0
  45. package/dist/components/component-registry.js +119 -0
  46. package/dist/components/component-registry.js.map +1 -0
  47. package/dist/components/context-menu-factory.d.ts +13 -0
  48. package/dist/components/context-menu-factory.d.ts.map +1 -0
  49. package/dist/components/context-menu-factory.js +341 -0
  50. package/dist/components/context-menu-factory.js.map +1 -0
  51. package/dist/components/context-menu.d.ts +54 -0
  52. package/dist/components/context-menu.d.ts.map +1 -0
  53. package/dist/components/context-menu.js +235 -0
  54. package/dist/components/context-menu.js.map +1 -0
  55. package/dist/components/grid-manager.d.ts +52 -0
  56. package/dist/components/grid-manager.d.ts.map +1 -0
  57. package/dist/components/grid-manager.js +404 -0
  58. package/dist/components/grid-manager.js.map +1 -0
  59. package/dist/components/help-panel.d.ts +34 -0
  60. package/dist/components/help-panel.d.ts.map +1 -0
  61. package/dist/components/help-panel.js +249 -0
  62. package/dist/components/help-panel.js.map +1 -0
  63. package/dist/components/index.d.ts +21 -0
  64. package/dist/components/index.d.ts.map +1 -0
  65. package/dist/components/index.js +43 -0
  66. package/dist/components/index.js.map +1 -0
  67. package/dist/components/interaction-manager.d.ts +47 -0
  68. package/dist/components/interaction-manager.d.ts.map +1 -0
  69. package/dist/components/interaction-manager.js +597 -0
  70. package/dist/components/interaction-manager.js.map +1 -0
  71. package/dist/components/layout-manager.d.ts +76 -0
  72. package/dist/components/layout-manager.d.ts.map +1 -0
  73. package/dist/components/layout-manager.js +538 -0
  74. package/dist/components/layout-manager.js.map +1 -0
  75. package/dist/components/monitoring-dashboard.d.ts +85 -0
  76. package/dist/components/monitoring-dashboard.d.ts.map +1 -0
  77. package/dist/components/monitoring-dashboard.js +908 -0
  78. package/dist/components/monitoring-dashboard.js.map +1 -0
  79. package/dist/components/search-panel.d.ts +80 -0
  80. package/dist/components/search-panel.d.ts.map +1 -0
  81. package/dist/components/search-panel.js +585 -0
  82. package/dist/components/search-panel.js.map +1 -0
  83. package/dist/components/status-bar.d.ts +77 -0
  84. package/dist/components/status-bar.d.ts.map +1 -0
  85. package/dist/components/status-bar.js +482 -0
  86. package/dist/components/status-bar.js.map +1 -0
  87. package/dist/components/status.component.d.ts +16 -0
  88. package/dist/components/status.component.d.ts.map +1 -0
  89. package/dist/components/status.component.js +79 -0
  90. package/dist/components/status.component.js.map +1 -0
  91. package/dist/components/stream-metrics.panel.d.ts +86 -0
  92. package/dist/components/stream-metrics.panel.d.ts.map +1 -0
  93. package/dist/components/stream-metrics.panel.js +395 -0
  94. package/dist/components/stream-metrics.panel.js.map +1 -0
  95. package/dist/components/system-resource.panel.d.ts +78 -0
  96. package/dist/components/system-resource.panel.d.ts.map +1 -0
  97. package/dist/components/system-resource.panel.js +642 -0
  98. package/dist/components/system-resource.panel.js.map +1 -0
  99. package/dist/components/tooltip.d.ts +35 -0
  100. package/dist/components/tooltip.d.ts.map +1 -0
  101. package/dist/components/tooltip.js +156 -0
  102. package/dist/components/tooltip.js.map +1 -0
  103. package/dist/config/account-config.d.ts +27 -0
  104. package/dist/config/account-config.d.ts.map +1 -0
  105. package/dist/config/account-config.js +358 -0
  106. package/dist/config/account-config.js.map +1 -0
  107. package/dist/config/account-crypto.d.ts +17 -0
  108. package/dist/config/account-crypto.d.ts.map +1 -0
  109. package/dist/config/account-crypto.js +129 -0
  110. package/dist/config/account-crypto.js.map +1 -0
  111. package/dist/config/account-encryption.d.ts +35 -0
  112. package/dist/config/account-encryption.d.ts.map +1 -0
  113. package/dist/config/account-encryption.js +207 -0
  114. package/dist/config/account-encryption.js.map +1 -0
  115. package/dist/config/auth-adapter.d.ts +23 -0
  116. package/dist/config/auth-adapter.d.ts.map +1 -0
  117. package/dist/config/auth-adapter.js +49 -0
  118. package/dist/config/auth-adapter.js.map +1 -0
  119. package/dist/config/auth-provider.d.ts +27 -0
  120. package/dist/config/auth-provider.d.ts.map +1 -0
  121. package/dist/config/auth-provider.js +54 -0
  122. package/dist/config/auth-provider.js.map +1 -0
  123. package/dist/config/auth-source-manager.d.ts +61 -0
  124. package/dist/config/auth-source-manager.d.ts.map +1 -0
  125. package/dist/config/auth-source-manager.js +402 -0
  126. package/dist/config/auth-source-manager.js.map +1 -0
  127. package/dist/config/config-io.d.ts +63 -0
  128. package/dist/config/config-io.d.ts.map +1 -0
  129. package/dist/config/config-io.js +352 -0
  130. package/dist/config/config-io.js.map +1 -0
  131. package/dist/config/config-manager.d.ts +51 -0
  132. package/dist/config/config-manager.d.ts.map +1 -0
  133. package/dist/config/config-manager.js +404 -0
  134. package/dist/config/config-manager.js.map +1 -0
  135. package/dist/config/config-recovery-manager.d.ts +67 -0
  136. package/dist/config/config-recovery-manager.d.ts.map +1 -0
  137. package/dist/config/config-recovery-manager.js +593 -0
  138. package/dist/config/config-recovery-manager.js.map +1 -0
  139. package/dist/config/config-validator.d.ts +27 -0
  140. package/dist/config/config-validator.d.ts.map +1 -0
  141. package/dist/config/config-validator.js +421 -0
  142. package/dist/config/config-validator.js.map +1 -0
  143. package/dist/config/config-version-manager.d.ts +44 -0
  144. package/dist/config/config-version-manager.d.ts.map +1 -0
  145. package/dist/config/config-version-manager.js +319 -0
  146. package/dist/config/config-version-manager.js.map +1 -0
  147. package/dist/config/custom-theme-builder.d.ts +88 -0
  148. package/dist/config/custom-theme-builder.d.ts.map +1 -0
  149. package/dist/config/custom-theme-builder.js +458 -0
  150. package/dist/config/custom-theme-builder.js.map +1 -0
  151. package/dist/config/file-permission-manager.d.ts +41 -0
  152. package/dist/config/file-permission-manager.d.ts.map +1 -0
  153. package/dist/config/file-permission-manager.js +290 -0
  154. package/dist/config/file-permission-manager.js.map +1 -0
  155. package/dist/config/layout-manager.d.ts +60 -0
  156. package/dist/config/layout-manager.d.ts.map +1 -0
  157. package/dist/config/layout-manager.js +596 -0
  158. package/dist/config/layout-manager.js.map +1 -0
  159. package/dist/config/monitoring.d.ts +27 -0
  160. package/dist/config/monitoring.d.ts.map +1 -0
  161. package/dist/config/monitoring.js +276 -0
  162. package/dist/config/monitoring.js.map +1 -0
  163. package/dist/config/secure-account-manager.d.ts +54 -0
  164. package/dist/config/secure-account-manager.d.ts.map +1 -0
  165. package/dist/config/secure-account-manager.js +438 -0
  166. package/dist/config/secure-account-manager.js.map +1 -0
  167. package/dist/config/session-state.d.ts +37 -0
  168. package/dist/config/session-state.d.ts.map +1 -0
  169. package/dist/config/session-state.js +207 -0
  170. package/dist/config/session-state.js.map +1 -0
  171. package/dist/config/session-storage.d.ts +21 -0
  172. package/dist/config/session-storage.d.ts.map +1 -0
  173. package/dist/config/session-storage.js +235 -0
  174. package/dist/config/session-storage.js.map +1 -0
  175. package/dist/config/theme-manager.d.ts +53 -0
  176. package/dist/config/theme-manager.d.ts.map +1 -0
  177. package/dist/config/theme-manager.js +491 -0
  178. package/dist/config/theme-manager.js.map +1 -0
  179. package/dist/handlers/monitor.handler.d.ts +28 -0
  180. package/dist/handlers/monitor.handler.d.ts.map +1 -0
  181. package/dist/handlers/monitor.handler.js +457 -0
  182. package/dist/handlers/monitor.handler.js.map +1 -0
  183. package/dist/handlers/stream.handler.d.ts.map +1 -1
  184. package/dist/handlers/stream.handler.js +6 -0
  185. package/dist/handlers/stream.handler.js.map +1 -1
  186. package/dist/handlers/use.handler.d.ts +13 -0
  187. package/dist/handlers/use.handler.d.ts.map +1 -0
  188. package/dist/handlers/use.handler.js +118 -0
  189. package/dist/handlers/use.handler.js.map +1 -0
  190. package/dist/index.d.ts +2 -1
  191. package/dist/index.d.ts.map +1 -1
  192. package/dist/index.js +24 -12
  193. package/dist/index.js.map +1 -1
  194. package/dist/performance/adaptive-polling.d.ts +69 -0
  195. package/dist/performance/adaptive-polling.d.ts.map +1 -0
  196. package/dist/performance/adaptive-polling.js +313 -0
  197. package/dist/performance/adaptive-polling.js.map +1 -0
  198. package/dist/performance/api-analytics.d.ts +137 -0
  199. package/dist/performance/api-analytics.d.ts.map +1 -0
  200. package/dist/performance/api-analytics.js +351 -0
  201. package/dist/performance/api-analytics.js.map +1 -0
  202. package/dist/performance/api-optimizer.d.ts +66 -0
  203. package/dist/performance/api-optimizer.d.ts.map +1 -0
  204. package/dist/performance/api-optimizer.js +368 -0
  205. package/dist/performance/api-optimizer.js.map +1 -0
  206. package/dist/performance/batch-request-manager.d.ts +90 -0
  207. package/dist/performance/batch-request-manager.d.ts.map +1 -0
  208. package/dist/performance/batch-request-manager.js +355 -0
  209. package/dist/performance/batch-request-manager.js.map +1 -0
  210. package/dist/performance/change-detector.d.ts +75 -0
  211. package/dist/performance/change-detector.d.ts.map +1 -0
  212. package/dist/performance/change-detector.js +421 -0
  213. package/dist/performance/change-detector.js.map +1 -0
  214. package/dist/performance/connection-pool-manager.d.ts +99 -0
  215. package/dist/performance/connection-pool-manager.d.ts.map +1 -0
  216. package/dist/performance/connection-pool-manager.js +474 -0
  217. package/dist/performance/connection-pool-manager.js.map +1 -0
  218. package/dist/performance/error-recovery-manager.d.ts +134 -0
  219. package/dist/performance/error-recovery-manager.d.ts.map +1 -0
  220. package/dist/performance/error-recovery-manager.js +673 -0
  221. package/dist/performance/error-recovery-manager.js.map +1 -0
  222. package/dist/performance/fallback-manager.d.ts +123 -0
  223. package/dist/performance/fallback-manager.d.ts.map +1 -0
  224. package/dist/performance/fallback-manager.js +524 -0
  225. package/dist/performance/fallback-manager.js.map +1 -0
  226. package/dist/performance/index.d.ts +25 -0
  227. package/dist/performance/index.d.ts.map +1 -0
  228. package/dist/performance/index.js +28 -0
  229. package/dist/performance/index.js.map +1 -0
  230. package/dist/performance/memory-manager.d.ts +97 -0
  231. package/dist/performance/memory-manager.d.ts.map +1 -0
  232. package/dist/performance/memory-manager.js +417 -0
  233. package/dist/performance/memory-manager.js.map +1 -0
  234. package/dist/performance/performance-monitor.d.ts +149 -0
  235. package/dist/performance/performance-monitor.d.ts.map +1 -0
  236. package/dist/performance/performance-monitor.js +513 -0
  237. package/dist/performance/performance-monitor.js.map +1 -0
  238. package/dist/performance/performance-optimizer.d.ts +110 -0
  239. package/dist/performance/performance-optimizer.d.ts.map +1 -0
  240. package/dist/performance/performance-optimizer.js +476 -0
  241. package/dist/performance/performance-optimizer.js.map +1 -0
  242. package/dist/performance/render-optimizer.d.ts +95 -0
  243. package/dist/performance/render-optimizer.d.ts.map +1 -0
  244. package/dist/performance/render-optimizer.js +408 -0
  245. package/dist/performance/render-optimizer.js.map +1 -0
  246. package/dist/services/index.d.ts +4 -1
  247. package/dist/services/index.d.ts.map +1 -1
  248. package/dist/services/index.js +3 -1
  249. package/dist/services/index.js.map +1 -1
  250. package/dist/services/system-resource.service.d.ts +168 -0
  251. package/dist/services/system-resource.service.d.ts.map +1 -0
  252. package/dist/services/system-resource.service.js +544 -0
  253. package/dist/services/system-resource.service.js.map +1 -0
  254. package/dist/types/account.types.d.ts +79 -0
  255. package/dist/types/account.types.d.ts.map +1 -0
  256. package/dist/types/account.types.js +23 -0
  257. package/dist/types/account.types.js.map +1 -0
  258. package/dist/types/alert.d.ts +147 -0
  259. package/dist/types/alert.d.ts.map +1 -0
  260. package/dist/types/alert.js +3 -0
  261. package/dist/types/alert.js.map +1 -0
  262. package/dist/types/auth-source.types.d.ts +62 -0
  263. package/dist/types/auth-source.types.d.ts.map +1 -0
  264. package/dist/types/auth-source.types.js +25 -0
  265. package/dist/types/auth-source.types.js.map +1 -0
  266. package/dist/types/index.d.ts +3 -0
  267. package/dist/types/index.d.ts.map +1 -1
  268. package/dist/types/index.js +2 -0
  269. package/dist/types/index.js.map +1 -1
  270. package/dist/types/interaction.d.ts +147 -0
  271. package/dist/types/interaction.d.ts.map +1 -0
  272. package/dist/types/interaction.js +3 -0
  273. package/dist/types/interaction.js.map +1 -0
  274. package/dist/types/monitoring.d.ts +233 -0
  275. package/dist/types/monitoring.d.ts.map +1 -0
  276. package/dist/types/monitoring.js +35 -0
  277. package/dist/types/monitoring.js.map +1 -0
  278. package/dist/types/session.types.d.ts +43 -0
  279. package/dist/types/session.types.d.ts.map +1 -0
  280. package/dist/types/session.types.js +27 -0
  281. package/dist/types/session.types.js.map +1 -0
  282. package/dist/utils/alert-history-manager.d.ts +72 -0
  283. package/dist/utils/alert-history-manager.d.ts.map +1 -0
  284. package/dist/utils/alert-history-manager.js +492 -0
  285. package/dist/utils/alert-history-manager.js.map +1 -0
  286. package/dist/utils/alert-manager.d.ts +75 -0
  287. package/dist/utils/alert-manager.d.ts.map +1 -0
  288. package/dist/utils/alert-manager.js +348 -0
  289. package/dist/utils/alert-manager.js.map +1 -0
  290. package/dist/utils/alert-rule-manager.d.ts +51 -0
  291. package/dist/utils/alert-rule-manager.d.ts.map +1 -0
  292. package/dist/utils/alert-rule-manager.js +515 -0
  293. package/dist/utils/alert-rule-manager.js.map +1 -0
  294. package/dist/utils/auth-diagnostics.d.ts +47 -0
  295. package/dist/utils/auth-diagnostics.d.ts.map +1 -0
  296. package/dist/utils/auth-diagnostics.js +245 -0
  297. package/dist/utils/auth-diagnostics.js.map +1 -0
  298. package/dist/utils/data-manager.d.ts +53 -0
  299. package/dist/utils/data-manager.d.ts.map +1 -0
  300. package/dist/utils/data-manager.js +228 -0
  301. package/dist/utils/data-manager.js.map +1 -0
  302. package/dist/utils/formatter.d.ts +5 -0
  303. package/dist/utils/formatter.d.ts.map +1 -1
  304. package/dist/utils/formatter.js +19 -0
  305. package/dist/utils/formatter.js.map +1 -1
  306. package/dist/utils/index.d.ts +6 -0
  307. package/dist/utils/index.d.ts.map +1 -1
  308. package/dist/utils/index.js +6 -0
  309. package/dist/utils/index.js.map +1 -1
  310. package/dist/utils/keyboard-handler.d.ts +32 -0
  311. package/dist/utils/keyboard-handler.d.ts.map +1 -0
  312. package/dist/utils/keyboard-handler.js +193 -0
  313. package/dist/utils/keyboard-handler.js.map +1 -0
  314. package/dist/utils/mouse-handler.d.ts +61 -0
  315. package/dist/utils/mouse-handler.d.ts.map +1 -0
  316. package/dist/utils/mouse-handler.js +192 -0
  317. package/dist/utils/mouse-handler.js.map +1 -0
  318. package/dist/utils/stream-verification.d.ts.map +1 -1
  319. package/dist/utils/stream-verification.js +2 -13
  320. package/dist/utils/stream-verification.js.map +1 -1
  321. package/dist/utils/terminal.d.ts +24 -0
  322. package/dist/utils/terminal.d.ts.map +1 -0
  323. package/dist/utils/terminal.js +148 -0
  324. package/dist/utils/terminal.js.map +1 -0
  325. package/dist/utils/time-series.processor.d.ts +65 -0
  326. package/dist/utils/time-series.processor.d.ts.map +1 -0
  327. package/dist/utils/time-series.processor.js +263 -0
  328. package/dist/utils/time-series.processor.js.map +1 -0
  329. package/package.json +40 -4
@@ -0,0 +1,858 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ChannelStatusPanel = void 0;
7
+ const blessed_1 = __importDefault(require("blessed"));
8
+ const blessed_contrib_1 = require("blessed-contrib");
9
+ const base_component_1 = require("./base.component");
10
+ const channel_details_popup_1 = require("./channel-details.popup");
11
+ const batch_operations_dialog_1 = require("./batch-operations.dialog");
12
+ class ChannelStatusPanel extends base_component_1.BaseComponent {
13
+ constructor(config, eventBus) {
14
+ super(config, eventBus);
15
+ this.channels = [];
16
+ this.filteredChannels = [];
17
+ this.selectedChannels = new Set();
18
+ this.currentIndex = 0;
19
+ this.selectionStartIndex = -1;
20
+ this.isRangeSelecting = false;
21
+ this.lastJumpPosition = 0;
22
+ this.navigationHistory = [];
23
+ this.sortConfig = {
24
+ field: config.sortField || 'name',
25
+ order: config.sortOrder || 'asc'
26
+ };
27
+ this.filterConfig = config.filters || {};
28
+ this.lastUpdateTime = new Date();
29
+ }
30
+ createWidget() {
31
+ this.container = blessed_1.default.box({
32
+ label: ' Channel Status Monitor ',
33
+ border: { type: 'line' },
34
+ style: {
35
+ fg: 'white',
36
+ bg: 'black',
37
+ border: { fg: 'cyan' }
38
+ },
39
+ top: this.config.position.y,
40
+ left: this.config.position.x,
41
+ width: this.config.position.width,
42
+ height: this.config.position.height,
43
+ scrollable: false,
44
+ mouse: true,
45
+ keys: true,
46
+ vi: true,
47
+ tags: true
48
+ });
49
+ this.headerBox = blessed_1.default.box({
50
+ parent: this.container,
51
+ top: 0,
52
+ left: 0,
53
+ width: '100%',
54
+ height: 2,
55
+ content: this.getHeaderContent(),
56
+ style: { fg: 'yellow' },
57
+ tags: true
58
+ });
59
+ this.footerBox = blessed_1.default.box({
60
+ parent: this.container,
61
+ bottom: 0,
62
+ left: 0,
63
+ width: '100%',
64
+ height: 2,
65
+ content: this.getFooterContent(),
66
+ style: { fg: 'gray' },
67
+ tags: true
68
+ });
69
+ const tableConfig = {
70
+ keys: true,
71
+ interactive: true,
72
+ columnSpacing: 2,
73
+ columnWidth: this.getConfig().columnWidths || [20, 12, 10, 10, 15, 15],
74
+ style: {
75
+ fg: 'white',
76
+ bg: 'black',
77
+ border: { fg: 'gray' },
78
+ header: { fg: 'cyan', bold: true },
79
+ cell: { fg: 'white' },
80
+ selected: { bg: 'blue', fg: 'white' }
81
+ }
82
+ };
83
+ this.table = (0, blessed_contrib_1.table)(tableConfig);
84
+ this.table.parent = this.container;
85
+ this.table.top = 2;
86
+ this.table.left = 0;
87
+ this.table.width = '100%';
88
+ this.table.height = 'bottom-2';
89
+ this.noDataBox = blessed_1.default.box({
90
+ parent: this.container,
91
+ top: 'center',
92
+ left: 'center',
93
+ width: 'shrink',
94
+ height: 'shrink',
95
+ content: this.getNoDataMessage(),
96
+ style: { fg: 'gray' },
97
+ tags: true,
98
+ hidden: true
99
+ });
100
+ this.widget = this.container;
101
+ this.initializeDetailsPopup();
102
+ this.initializeBatchDialog();
103
+ this.setupKeyBindings();
104
+ this.updateTableDisplay();
105
+ }
106
+ initializeDetailsPopup() {
107
+ this.detailsPopup = new channel_details_popup_1.ChannelDetailsPopup({
108
+ screen: this.widget.screen,
109
+ eventBus: this.eventBus,
110
+ showColors: this.getConfig().showColors,
111
+ refreshInterval: this.getConfig().refreshInterval
112
+ });
113
+ }
114
+ initializeBatchDialog() {
115
+ this.batchDialog = new batch_operations_dialog_1.BatchOperationsDialog({
116
+ screen: this.widget.screen,
117
+ eventBus: this.eventBus,
118
+ showColors: this.getConfig().showColors
119
+ });
120
+ }
121
+ setupKeyBindings() {
122
+ this.container.key(['up', 'k'], () => {
123
+ this.moveSelection(-1);
124
+ });
125
+ this.container.key(['down', 'j'], () => {
126
+ this.moveSelection(1);
127
+ });
128
+ this.container.key(['pageup'], () => {
129
+ this.moveSelection(-10);
130
+ });
131
+ this.container.key(['pagedown'], () => {
132
+ this.moveSelection(10);
133
+ });
134
+ this.container.key(['home'], () => {
135
+ this.moveToTop();
136
+ });
137
+ this.container.key(['end'], () => {
138
+ this.moveToBottom();
139
+ });
140
+ this.container.key(['space'], () => {
141
+ this.toggleSelection();
142
+ });
143
+ this.container.key(['enter'], () => {
144
+ this.showChannelDetails();
145
+ });
146
+ this.container.key(['s'], () => {
147
+ this.cycleSortField();
148
+ });
149
+ this.container.key(['S'], () => {
150
+ this.toggleSortOrder();
151
+ });
152
+ this.container.key(['f'], () => {
153
+ this.showFilterDialog();
154
+ });
155
+ this.container.key(['F'], () => {
156
+ this.showAdvancedFilterDialog();
157
+ });
158
+ this.container.key(['c'], () => {
159
+ this.clearFilters();
160
+ });
161
+ this.container.key(['1'], () => {
162
+ this.quickFilterByStatus('live');
163
+ });
164
+ this.container.key(['2'], () => {
165
+ this.quickFilterByStatus('waiting');
166
+ });
167
+ this.container.key(['3'], () => {
168
+ this.quickFilterByStatus('end');
169
+ });
170
+ this.container.key(['4'], () => {
171
+ this.quickFilterByStatus('banpush');
172
+ });
173
+ this.container.key(['r', 'R', 'f5'], () => {
174
+ this.requestUpdate();
175
+ });
176
+ this.container.key(['a'], () => {
177
+ this.selectAll();
178
+ });
179
+ this.container.key(['A'], () => {
180
+ this.deselectAll();
181
+ });
182
+ this.container.key(['d'], () => {
183
+ this.showBatchOperations();
184
+ });
185
+ this.container.key(['g'], () => {
186
+ this.moveToTop();
187
+ });
188
+ this.container.key(['G'], () => {
189
+ this.moveToBottom();
190
+ });
191
+ this.container.key(['ctrl+f'], () => {
192
+ this.showQuickJumpDialog();
193
+ });
194
+ this.container.key(['ctrl+g'], () => {
195
+ this.showGoToLineDialog();
196
+ });
197
+ this.container.key(['shift+up', 'shift+k'], () => {
198
+ this.extendSelectionUp();
199
+ });
200
+ this.container.key(['shift+down', 'shift+j'], () => {
201
+ this.extendSelectionDown();
202
+ });
203
+ this.container.key(['ctrl+c'], () => {
204
+ this.copySelectionInfo();
205
+ });
206
+ }
207
+ render() {
208
+ if (this.isDestroyed || !this.widget)
209
+ return;
210
+ try {
211
+ this.updateHeader();
212
+ this.updateFooter();
213
+ this.updateTableDisplay();
214
+ this.widget.screen?.render();
215
+ }
216
+ catch (error) {
217
+ this.handleError(error instanceof Error ? error : new Error('Unknown render error'));
218
+ }
219
+ }
220
+ update(data) {
221
+ if (this.isDestroyed)
222
+ return;
223
+ try {
224
+ let channelsArray;
225
+ if (Array.isArray(data)) {
226
+ channelsArray = data;
227
+ }
228
+ else if ('channels' in data && Array.isArray(data.channels)) {
229
+ channelsArray = data.channels;
230
+ }
231
+ else {
232
+ channelsArray = [data];
233
+ }
234
+ this.channels = channelsArray.map(channel => this.convertToStatusInfo(channel));
235
+ this.applyFiltersAndSort();
236
+ this.lastUpdateTime = new Date();
237
+ this.updateState({ lastUpdate: this.lastUpdateTime });
238
+ if (this.channels.length === 0) {
239
+ this.noDataBox.show();
240
+ this.table.hide();
241
+ }
242
+ else {
243
+ this.noDataBox.hide();
244
+ this.table.show();
245
+ }
246
+ this.updateStatusColors();
247
+ }
248
+ catch (error) {
249
+ this.handleError(error instanceof Error ? error : new Error('Failed to update channel status'));
250
+ }
251
+ }
252
+ convertToStatusInfo(channel) {
253
+ const selectedChannels = this.selectedChannels || new Set();
254
+ return {
255
+ channelId: channel.channelId.toString(),
256
+ name: channel.name,
257
+ status: channel.watchStatus,
258
+ statusText: channel.watchStatusText,
259
+ viewerCount: channel.pageView || 0,
260
+ maxViewer: channel.maxViewer || 0,
261
+ publisher: channel.publisher || '',
262
+ startTime: channel.startTime || 0,
263
+ endTime: channel.endTime || 0,
264
+ createdTime: channel.createdTime || 0,
265
+ selected: selectedChannels.has(channel.channelId.toString())
266
+ };
267
+ }
268
+ compareValues(a, b) {
269
+ if (a === undefined && b === undefined)
270
+ return 0;
271
+ if (a === undefined)
272
+ return 1;
273
+ if (b === undefined)
274
+ return -1;
275
+ if (typeof a === 'string' && typeof b === 'string') {
276
+ return a.localeCompare(b);
277
+ }
278
+ if (typeof a === 'number' && typeof b === 'number') {
279
+ return a - b;
280
+ }
281
+ return String(a).localeCompare(String(b));
282
+ }
283
+ applyFiltersAndSort() {
284
+ const channels = this.channels || [];
285
+ this.filteredChannels = channels.filter(channel => {
286
+ if (this.filterConfig.status && this.filterConfig.status.length > 0) {
287
+ if (!this.filterConfig.status.includes(channel.status)) {
288
+ return false;
289
+ }
290
+ }
291
+ if (this.filterConfig.searchTerm) {
292
+ const searchTerms = this.filterConfig.searchTerm.toLowerCase().split(' ').filter(term => term.length > 0);
293
+ const searchableText = `${channel.name} ${channel.channelId} ${channel.publisher} ${channel.statusText}`.toLowerCase();
294
+ const allTermsMatch = searchTerms.every(term => searchableText.includes(term));
295
+ if (!allTermsMatch) {
296
+ return false;
297
+ }
298
+ }
299
+ if (this.filterConfig.viewerCountMin !== undefined && channel.viewerCount < this.filterConfig.viewerCountMin) {
300
+ return false;
301
+ }
302
+ if (this.filterConfig.viewerCountMax !== undefined && channel.viewerCount > this.filterConfig.viewerCountMax) {
303
+ return false;
304
+ }
305
+ if (this.filterConfig.publisherFilter) {
306
+ const publisherFilter = this.filterConfig.publisherFilter.toLowerCase();
307
+ if (!channel.publisher.toLowerCase().includes(publisherFilter)) {
308
+ return false;
309
+ }
310
+ }
311
+ if (this.filterConfig.dateRange) {
312
+ const channelDate = new Date(channel.createdTime);
313
+ if (this.filterConfig.dateRange.startDate && channelDate < this.filterConfig.dateRange.startDate) {
314
+ return false;
315
+ }
316
+ if (this.filterConfig.dateRange.endDate && channelDate > this.filterConfig.dateRange.endDate) {
317
+ return false;
318
+ }
319
+ }
320
+ return true;
321
+ });
322
+ this.filteredChannels.sort((a, b) => {
323
+ const aVal = a[this.sortConfig.field];
324
+ const bVal = b[this.sortConfig.field];
325
+ let comparison = this.compareValues(aVal, bVal);
326
+ if (comparison === 0 && this.sortConfig.secondaryField) {
327
+ const aSecVal = a[this.sortConfig.secondaryField];
328
+ const bSecVal = b[this.sortConfig.secondaryField];
329
+ comparison = this.compareValues(aSecVal, bSecVal);
330
+ if (this.sortConfig.secondaryOrder === 'desc') {
331
+ comparison = -comparison;
332
+ }
333
+ }
334
+ return this.sortConfig.order === 'asc' ? comparison : -comparison;
335
+ });
336
+ const filteredChannels = this.filteredChannels || [];
337
+ if (this.currentIndex >= filteredChannels.length) {
338
+ this.currentIndex = Math.max(0, filteredChannels.length - 1);
339
+ }
340
+ }
341
+ updateTableDisplay() {
342
+ if (!this.table)
343
+ return;
344
+ const headers = ['Channel Name', 'Status', 'Viewers', 'Max', 'Publisher', 'Created'];
345
+ const data = [];
346
+ const channels = this.filteredChannels || [];
347
+ const selectedChannels = this.selectedChannels || new Set();
348
+ for (let i = 0; i < channels.length; i++) {
349
+ const channel = channels[i];
350
+ if (!channel)
351
+ continue;
352
+ const isSelected = selectedChannels.has(channel.channelId);
353
+ const isCurrent = i === this.currentIndex;
354
+ const row = [
355
+ this.formatCellValue(channel.name, isSelected, isCurrent),
356
+ this.formatStatusCell(channel.status, channel.statusText, isSelected, isCurrent),
357
+ this.formatCellValue(channel.viewerCount.toString(), isSelected, isCurrent),
358
+ this.formatCellValue(channel.maxViewer.toString(), isSelected, isCurrent),
359
+ this.formatCellValue(channel.publisher, isSelected, isCurrent),
360
+ this.formatCellValue(this.formatDate(new Date(channel.createdTime)), isSelected, isCurrent)
361
+ ];
362
+ data.push(row);
363
+ }
364
+ this.table.setData({
365
+ headers,
366
+ data
367
+ });
368
+ }
369
+ formatCellValue(value, isSelected, isCurrent) {
370
+ if (isCurrent) {
371
+ return `{inverse}${isSelected ? '✓ ' : ''}${value}{/inverse}`;
372
+ }
373
+ return isSelected ? `{cyan-fg}✓ ${value}{/cyan-fg}` : value;
374
+ }
375
+ formatStatusCell(status, statusText, isSelected, isCurrent) {
376
+ const colors = this.getStatusColors(status);
377
+ const safeColor = this.getTerminalSafeColor(colors.fg);
378
+ const prefix = isCurrent ? '{inverse}' : '';
379
+ const suffix = isCurrent ? '{/inverse}' : '';
380
+ const checkmark = isSelected ? '✓ ' : '';
381
+ const icon = colors.icon || '';
382
+ const healthLevel = this.getStatusHealthLevel(status);
383
+ let statusDisplay = statusText;
384
+ switch (healthLevel) {
385
+ case 'healthy':
386
+ statusDisplay = `${icon} ${statusText}`;
387
+ break;
388
+ case 'warning':
389
+ statusDisplay = `${icon} ${statusText}`;
390
+ break;
391
+ case 'error':
392
+ statusDisplay = `${icon} ${statusText}`;
393
+ break;
394
+ }
395
+ return `${prefix}{${safeColor}-fg}${checkmark}${statusDisplay}{/${safeColor}-fg}${suffix}`;
396
+ }
397
+ updateStatusColors() {
398
+ this.throttledRender();
399
+ this.emit('component:statusChanged', {
400
+ componentId: this.state.id,
401
+ healthSummary: this.getChannelHealthSummary(),
402
+ timestamp: new Date()
403
+ });
404
+ }
405
+ getChannelHealthSummary() {
406
+ const channels = this.filteredChannels || [];
407
+ const summary = { healthy: 0, warning: 0, error: 0 };
408
+ channels.forEach(channel => {
409
+ const healthLevel = this.getStatusHealthLevel(channel.status);
410
+ summary[healthLevel]++;
411
+ });
412
+ return summary;
413
+ }
414
+ getStatusColors(status) {
415
+ switch (status) {
416
+ case 'live':
417
+ return { fg: 'green', icon: '●' };
418
+ case 'waiting':
419
+ return { fg: 'yellow', icon: '◯' };
420
+ case 'end':
421
+ return { fg: 'gray', icon: '◦' };
422
+ case 'unStart':
423
+ return { fg: 'gray', icon: '◦' };
424
+ case 'banpush':
425
+ return { fg: 'red', icon: '✖' };
426
+ case 'playback':
427
+ return { fg: 'blue', icon: '▶' };
428
+ default:
429
+ return { fg: 'white', icon: '?' };
430
+ }
431
+ }
432
+ getTerminalSafeColor(color) {
433
+ const config = this.getConfig();
434
+ if (!config.showColors) {
435
+ return 'white';
436
+ }
437
+ const colorMapping = {
438
+ 'green': 'green',
439
+ 'yellow': 'yellow',
440
+ 'red': 'red',
441
+ 'blue': 'blue',
442
+ 'gray': 'gray',
443
+ 'white': 'white'
444
+ };
445
+ return colorMapping[color] || 'white';
446
+ }
447
+ getStatusHealthLevel(status) {
448
+ switch (status) {
449
+ case 'live':
450
+ return 'healthy';
451
+ case 'waiting':
452
+ case 'playback':
453
+ return 'warning';
454
+ case 'banpush':
455
+ return 'error';
456
+ case 'end':
457
+ case 'unStart':
458
+ default:
459
+ return 'warning';
460
+ }
461
+ }
462
+ formatDate(date) {
463
+ return date.toLocaleDateString();
464
+ }
465
+ updateHeader() {
466
+ this.headerBox.setContent(this.getHeaderContent());
467
+ }
468
+ updateFooter() {
469
+ this.footerBox.setContent(this.getFooterContent());
470
+ }
471
+ getHeaderContent() {
472
+ const total = this.channels?.length || 0;
473
+ const filtered = this.filteredChannels?.length || 0;
474
+ const selected = this.selectedChannels?.size || 0;
475
+ const lastUpdate = this.lastUpdateTime?.toLocaleTimeString() || 'Never';
476
+ const health = this.getChannelHealthSummary();
477
+ const healthDisplay = `{green-fg}●${health.healthy}{/green-fg} {yellow-fg}◯${health.warning}{/yellow-fg} {red-fg}✖${health.error}{/red-fg}`;
478
+ return `Total: {bold}${total}{/bold} | Displayed: {bold}${filtered}{/bold} | Selected: {cyan-fg}${selected}{/cyan-fg} | Health: ${healthDisplay} | Updated: {gray-fg}${lastUpdate}{/gray-fg}`;
479
+ }
480
+ getFooterContent() {
481
+ const activeFilters = this.filterConfig ? Object.keys(this.filterConfig).length : 0;
482
+ const filterInfo = activeFilters > 0 ? `{yellow-fg}[${activeFilters} filters]{/yellow-fg}` : '';
483
+ const sortInfo = this.sortConfig?.secondaryField ? `{cyan-fg}[Multi-sort]{/cyan-fg}` : '';
484
+ return `{gray-fg}↑↓: Navigate | Space: Select | Enter: Details | S: Sort | Shift+S: Order | F: Filter | Shift+F: Advanced | 1-4: Quick Filter | C: Clear | R: Refresh{/gray-fg} ${filterInfo} ${sortInfo}`;
485
+ }
486
+ getNoDataMessage() {
487
+ return '{center}{gray-fg}No channel data available{/gray-fg}\n{center}{gray-fg}Waiting for channel information...{/gray-fg}{/center}';
488
+ }
489
+ moveSelection(delta) {
490
+ const channels = this.filteredChannels || [];
491
+ if (channels.length === 0)
492
+ return;
493
+ this.currentIndex = Math.max(0, Math.min(channels.length - 1, this.currentIndex + delta));
494
+ this.throttledRender();
495
+ }
496
+ moveToTop() {
497
+ this.saveNavigationHistory();
498
+ this.currentIndex = 0;
499
+ this.isRangeSelecting = false;
500
+ this.throttledRender();
501
+ this.emitNavigationEvent('moveToTop');
502
+ }
503
+ moveToBottom() {
504
+ const channels = this.filteredChannels || [];
505
+ this.saveNavigationHistory();
506
+ this.currentIndex = Math.max(0, channels.length - 1);
507
+ this.isRangeSelecting = false;
508
+ this.throttledRender();
509
+ this.emitNavigationEvent('moveToBottom');
510
+ }
511
+ showQuickJumpDialog() {
512
+ this.emit('component:quickJumpDialog', {
513
+ componentId: this.state.id,
514
+ currentIndex: this.currentIndex,
515
+ totalItems: this.filteredChannels?.length || 0,
516
+ timestamp: new Date()
517
+ });
518
+ }
519
+ showGoToLineDialog() {
520
+ this.emit('component:goToLineDialog', {
521
+ componentId: this.state.id,
522
+ currentLine: this.currentIndex + 1,
523
+ totalLines: this.filteredChannels?.length || 0,
524
+ timestamp: new Date()
525
+ });
526
+ }
527
+ extendSelectionUp() {
528
+ const channels = this.filteredChannels || [];
529
+ if (channels.length === 0)
530
+ return;
531
+ if (!this.isRangeSelecting) {
532
+ this.selectionStartIndex = this.currentIndex;
533
+ this.isRangeSelecting = true;
534
+ }
535
+ const newIndex = Math.max(0, this.currentIndex - 1);
536
+ this.updateRangeSelection(newIndex);
537
+ }
538
+ extendSelectionDown() {
539
+ const channels = this.filteredChannels || [];
540
+ if (channels.length === 0)
541
+ return;
542
+ if (!this.isRangeSelecting) {
543
+ this.selectionStartIndex = this.currentIndex;
544
+ this.isRangeSelecting = true;
545
+ }
546
+ const newIndex = Math.min(channels.length - 1, this.currentIndex + 1);
547
+ this.updateRangeSelection(newIndex);
548
+ }
549
+ updateRangeSelection(newIndex) {
550
+ const channels = this.filteredChannels || [];
551
+ const selectedChannels = this.selectedChannels || new Set();
552
+ if (this.selectionStartIndex === -1)
553
+ return;
554
+ this.clearRangeSelection();
555
+ const startIndex = Math.min(this.selectionStartIndex, newIndex);
556
+ const endIndex = Math.max(this.selectionStartIndex, newIndex);
557
+ for (let i = startIndex; i <= endIndex; i++) {
558
+ const channel = channels[i];
559
+ if (channel) {
560
+ selectedChannels.add(channel.channelId);
561
+ }
562
+ }
563
+ this.currentIndex = newIndex;
564
+ this.throttledRender();
565
+ }
566
+ clearRangeSelection() {
567
+ }
568
+ copySelectionInfo() {
569
+ const selectedChannels = this.selectedChannels || new Set();
570
+ const channels = this.filteredChannels || [];
571
+ if (selectedChannels.size === 0 && this.currentIndex < channels.length) {
572
+ const currentChannel = channels[this.currentIndex];
573
+ if (currentChannel) {
574
+ this.copyChannelInfo(currentChannel);
575
+ }
576
+ }
577
+ else {
578
+ const selectedChannelData = channels.filter(c => selectedChannels.has(c.channelId));
579
+ this.copyMultipleChannelsInfo(selectedChannelData);
580
+ }
581
+ }
582
+ copyChannelInfo(channel) {
583
+ const info = `${channel.name} (${channel.channelId}) - ${channel.statusText} - ${channel.viewerCount} viewers`;
584
+ this.emit('component:copyToClipboard', {
585
+ componentId: this.state.id,
586
+ content: info,
587
+ type: 'singleChannel',
588
+ channel,
589
+ timestamp: new Date()
590
+ });
591
+ }
592
+ copyMultipleChannelsInfo(channels) {
593
+ const info = channels.map(c => `${c.name} (${c.channelId}) - ${c.statusText} - ${c.viewerCount} viewers`).join('\n');
594
+ this.emit('component:copyToClipboard', {
595
+ componentId: this.state.id,
596
+ content: info,
597
+ type: 'multipleChannels',
598
+ channels,
599
+ count: channels.length,
600
+ timestamp: new Date()
601
+ });
602
+ }
603
+ saveNavigationHistory() {
604
+ if (this.currentIndex !== this.lastJumpPosition) {
605
+ this.navigationHistory.push(this.lastJumpPosition);
606
+ if (this.navigationHistory.length > 10) {
607
+ this.navigationHistory.shift();
608
+ }
609
+ this.lastJumpPosition = this.currentIndex;
610
+ }
611
+ }
612
+ emitNavigationEvent(action) {
613
+ this.emit('component:navigation', {
614
+ componentId: this.state.id,
615
+ action,
616
+ currentIndex: this.currentIndex,
617
+ totalItems: this.filteredChannels?.length || 0,
618
+ timestamp: new Date()
619
+ });
620
+ }
621
+ jumpToLine(lineNumber) {
622
+ const channels = this.filteredChannels || [];
623
+ const targetIndex = lineNumber - 1;
624
+ if (targetIndex >= 0 && targetIndex < channels.length) {
625
+ this.saveNavigationHistory();
626
+ this.currentIndex = targetIndex;
627
+ this.isRangeSelecting = false;
628
+ this.throttledRender();
629
+ this.emitNavigationEvent('jumpToLine');
630
+ return true;
631
+ }
632
+ return false;
633
+ }
634
+ jumpToChannel(searchTerm) {
635
+ const channels = this.filteredChannels || [];
636
+ const lowerSearchTerm = searchTerm.toLowerCase();
637
+ const targetIndex = channels.findIndex(channel => channel.channelId.toLowerCase().includes(lowerSearchTerm) ||
638
+ channel.name.toLowerCase().includes(lowerSearchTerm));
639
+ if (targetIndex !== -1) {
640
+ this.saveNavigationHistory();
641
+ this.currentIndex = targetIndex;
642
+ this.isRangeSelecting = false;
643
+ this.throttledRender();
644
+ this.emitNavigationEvent('jumpToChannel');
645
+ return true;
646
+ }
647
+ return false;
648
+ }
649
+ toggleSelection() {
650
+ const channels = this.filteredChannels || [];
651
+ const selectedChannels = this.selectedChannels || new Set();
652
+ if (channels.length === 0)
653
+ return;
654
+ const currentChannel = channels[this.currentIndex];
655
+ if (!currentChannel)
656
+ return;
657
+ if (selectedChannels.has(currentChannel.channelId)) {
658
+ selectedChannels.delete(currentChannel.channelId);
659
+ }
660
+ else {
661
+ selectedChannels.add(currentChannel.channelId);
662
+ }
663
+ this.throttledRender();
664
+ }
665
+ selectAll() {
666
+ const channels = this.filteredChannels || [];
667
+ const selectedChannels = this.selectedChannels || new Set();
668
+ channels.forEach(channel => {
669
+ selectedChannels.add(channel.channelId);
670
+ });
671
+ this.throttledRender();
672
+ }
673
+ deselectAll() {
674
+ const selectedChannels = this.selectedChannels || new Set();
675
+ selectedChannels.clear();
676
+ this.throttledRender();
677
+ }
678
+ cycleSortField() {
679
+ const fields = ['name', 'status', 'viewerCount', 'maxViewer', 'publisher', 'createdTime'];
680
+ const currentIndex = fields.indexOf(this.sortConfig.field);
681
+ const nextIndex = (currentIndex + 1) % fields.length;
682
+ const nextField = fields[nextIndex];
683
+ if (nextField) {
684
+ if (this.sortConfig.secondaryField) {
685
+ this.sortConfig.field = this.sortConfig.secondaryField;
686
+ this.sortConfig.order = this.sortConfig.secondaryOrder || 'asc';
687
+ delete this.sortConfig.secondaryField;
688
+ delete this.sortConfig.secondaryOrder;
689
+ }
690
+ else {
691
+ this.sortConfig.field = nextField;
692
+ }
693
+ }
694
+ this.applyFiltersAndSort();
695
+ this.throttledRender();
696
+ this.emit('component:sortChanged', {
697
+ componentId: this.state.id,
698
+ sortConfig: this.sortConfig,
699
+ timestamp: new Date()
700
+ });
701
+ }
702
+ toggleSortOrder() {
703
+ this.sortConfig.order = this.sortConfig.order === 'asc' ? 'desc' : 'asc';
704
+ this.applyFiltersAndSort();
705
+ this.throttledRender();
706
+ this.emit('component:sortChanged', {
707
+ componentId: this.state.id,
708
+ sortConfig: this.sortConfig,
709
+ timestamp: new Date()
710
+ });
711
+ }
712
+ setMultiFieldSort(primary, primaryOrder, secondary, secondaryOrder) {
713
+ const newConfig = {
714
+ field: primary,
715
+ order: primaryOrder
716
+ };
717
+ if (secondary !== undefined) {
718
+ newConfig.secondaryField = secondary;
719
+ }
720
+ if (secondaryOrder !== undefined) {
721
+ newConfig.secondaryOrder = secondaryOrder;
722
+ }
723
+ this.sortConfig = newConfig;
724
+ this.applyFiltersAndSort();
725
+ this.throttledRender();
726
+ this.emit('component:sortChanged', {
727
+ componentId: this.state.id,
728
+ sortConfig: this.sortConfig,
729
+ changeType: 'multiField',
730
+ timestamp: new Date()
731
+ });
732
+ }
733
+ showFilterDialog() {
734
+ this.emit('component:filterDialog', {
735
+ componentId: this.state.id,
736
+ currentFilter: this.filterConfig,
737
+ type: 'basic',
738
+ timestamp: new Date()
739
+ });
740
+ }
741
+ showAdvancedFilterDialog() {
742
+ this.emit('component:advancedFilterDialog', {
743
+ componentId: this.state.id,
744
+ currentFilter: this.filterConfig,
745
+ availableFields: ['viewerCount', 'publisher', 'createdTime'],
746
+ timestamp: new Date()
747
+ });
748
+ }
749
+ quickFilterByStatus(status) {
750
+ if (this.filterConfig.status?.includes(status)) {
751
+ this.filterConfig.status = this.filterConfig.status.filter(s => s !== status);
752
+ if (this.filterConfig.status.length === 0) {
753
+ delete this.filterConfig.status;
754
+ }
755
+ }
756
+ else {
757
+ if (!this.filterConfig.status) {
758
+ this.filterConfig.status = [];
759
+ }
760
+ this.filterConfig.status.push(status);
761
+ }
762
+ this.applyFiltersAndSort();
763
+ this.throttledRender();
764
+ this.emit('component:filterChanged', {
765
+ componentId: this.state.id,
766
+ filter: this.filterConfig,
767
+ changeType: 'quickFilter',
768
+ status,
769
+ timestamp: new Date()
770
+ });
771
+ }
772
+ clearFilters() {
773
+ const hadFilters = Object.keys(this.filterConfig).length > 0;
774
+ this.filterConfig = {};
775
+ this.applyFiltersAndSort();
776
+ this.throttledRender();
777
+ if (hadFilters) {
778
+ this.emit('component:filtersCleared', {
779
+ componentId: this.state.id,
780
+ timestamp: new Date()
781
+ });
782
+ }
783
+ }
784
+ setAdvancedFilter(filter) {
785
+ this.filterConfig = { ...this.filterConfig, ...filter };
786
+ this.applyFiltersAndSort();
787
+ this.throttledRender();
788
+ this.emit('component:filterChanged', {
789
+ componentId: this.state.id,
790
+ filter: this.filterConfig,
791
+ changeType: 'advanced',
792
+ timestamp: new Date()
793
+ });
794
+ }
795
+ showChannelDetails() {
796
+ const channels = this.filteredChannels || [];
797
+ if (channels.length === 0)
798
+ return;
799
+ const currentChannel = channels[this.currentIndex];
800
+ if (!currentChannel)
801
+ return;
802
+ this.detailsPopup.show(currentChannel);
803
+ this.emit('component:showDetails', {
804
+ componentId: this.state.id,
805
+ channelId: currentChannel.channelId,
806
+ channel: currentChannel,
807
+ timestamp: new Date()
808
+ });
809
+ }
810
+ showBatchOperations() {
811
+ const selectedChannels = this.selectedChannels || new Set();
812
+ if (selectedChannels.size === 0)
813
+ return;
814
+ this.batchDialog.show(Array.from(selectedChannels));
815
+ this.emit('component:batchOperations', {
816
+ componentId: this.state.id,
817
+ selectedChannels: Array.from(selectedChannels),
818
+ timestamp: new Date()
819
+ });
820
+ }
821
+ getConfig() {
822
+ return this.config;
823
+ }
824
+ getSelectedChannels() {
825
+ return Array.from(this.selectedChannels || new Set());
826
+ }
827
+ getCurrentChannel() {
828
+ const channels = this.filteredChannels || [];
829
+ return channels[this.currentIndex] || null;
830
+ }
831
+ setFilter(filter) {
832
+ this.filterConfig = filter;
833
+ this.applyFiltersAndSort();
834
+ this.throttledRender();
835
+ }
836
+ setSort(sort) {
837
+ this.sortConfig = sort;
838
+ this.applyFiltersAndSort();
839
+ this.throttledRender();
840
+ }
841
+ destroy() {
842
+ this.stopRefresh();
843
+ this.channels = [];
844
+ this.filteredChannels = [];
845
+ if (this.selectedChannels) {
846
+ this.selectedChannels.clear();
847
+ }
848
+ if (this.detailsPopup) {
849
+ this.detailsPopup.destroy();
850
+ }
851
+ if (this.batchDialog) {
852
+ this.batchDialog.destroy();
853
+ }
854
+ super.destroy();
855
+ }
856
+ }
857
+ exports.ChannelStatusPanel = ChannelStatusPanel;
858
+ //# sourceMappingURL=channel-status.panel.js.map