tv-console 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,2 +1,402 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e={enabled:!0,maxEntries:100,position:"top-right",width:"400px",height:"300px",backgroundColor:"rgba(0, 0, 0, 0.8)",textColor:"#ffffff",fontSize:"14px",opacity:.9,showTimestamp:!0,className:"tv-console",zIndex:9999,showLogLevel:!0,logLevels:["log","info","warn","error","debug"],formatter:e=>`${`[${e.timestamp.toLocaleTimeString()}]`} ${`[${e.level.toUpperCase()}]`} ${e.message}`.trim(),focusKey:"12345",unfocusKey:"Escape",onFocus:()=>{},onUnfocus:()=>{},enableKeyboardNav:!0,showFocusIndicator:!0};class t{constructor(t={}){Object.defineProperty(this,"config",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"logs",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"isVisible",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"originalConsole",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_isFocused",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"keyBuffer",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"keyBufferTimeout",{enumerable:!0,configurable:!0,writable:!0,value:null}),this.config={...e,...t},this.originalConsole=console,this.initialize()}initialize(){this.config.enabled&&(this.createContainer(),this.interceptConsole(),this.setupKeyboardListeners(),this.render())}createContainer(){this.container=document.createElement("div"),this.container.className=this.config.className,this.container.tabIndex=this.config.enableKeyboardNav?0:-1,this.container.style.cssText=`\n position: fixed;\n ${this.getPositionStyles()}\n width: ${this.config.width};\n height: ${this.config.height};\n background-color: ${this.config.backgroundColor};\n color: ${this.config.textColor};\n font-family: 'Courier New', monospace;\n font-size: ${this.config.fontSize};\n padding: 10px;\n border-radius: 5px;\n overflow-y: auto;\n z-index: ${this.config.zIndex};\n opacity: ${this.config.opacity};\n display: none;\n word-wrap: break-word;\n white-space: pre-wrap;\n box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);\n outline: none;\n `,document.body.appendChild(this.container)}getPositionStyles(){switch(this.config.position){case"top-left":return"top: 10px; left: 10px;";case"top-right":default:return"top: 10px; right: 10px;";case"bottom-left":return"bottom: 10px; left: 10px;";case"bottom-right":return"bottom: 10px; right: 10px;"}}interceptConsole(){["log","info","warn","error","debug"].forEach(e=>{const t=this.originalConsole[e];this.originalConsole[e]=(...i)=>{t.apply(this.originalConsole,i),this.addLog(e,...i)}})}addLog(e,...t){if(!this.config.enabled||!this.config.logLevels.includes(e))return;const i=t.map(e=>this.formatArgument(e)).join(" "),o={id:Date.now().toString()+Math.random().toString(36).substr(2,9),level:e,message:i,timestamp:new Date,data:t,stack:"error"===e?(new Error).stack:void 0};this.logs.push(o),this.logs.length>this.config.maxEntries&&(this.logs=this.logs.slice(-this.config.maxEntries)),this.render()}formatArgument(e){if(null===e)return"null";if(void 0===e)return"undefined";if(e instanceof Error)return`Error: ${e.message}\nStack: ${e.stack||"No stack trace available"}`;if("object"==typeof e)try{return JSON.stringify(e,null,2)}catch{if(e.toString&&e.toString!==Object.prototype.toString)return e.toString();const t=Object.keys(e);return t.length>0?`[Object with keys: ${t.join(", ")}]`:"[Empty Object]"}return"function"==typeof e?`[Function: ${e.name||"anonymous"}]`:String(e)}render(){if(!this.container)return;const e=this.logs.filter(e=>this.config.logLevels.includes(e.level)).map(e=>{const t=this.config.formatter(e);return`<div class="${`tv-console-${e.level}`}">${this.escapeHtml(t)}</div>`});this.container.innerHTML=e.join(""),this.container.scrollTop=this.container.scrollHeight}escapeHtml(e){const t=document.createElement("div");return t.textContent=e,t.innerHTML}setupKeyboardListeners(){document.addEventListener("keydown",e=>{this.handleKeyDown(e)})}handleKeyDown(e){if(this.config.focusKey&&(this.keyBuffer+=e.key,this.keyBufferTimeout&&clearTimeout(this.keyBufferTimeout),this.keyBufferTimeout=window.setTimeout(()=>{this.keyBuffer=""},2e3),this.keyBuffer.includes(this.config.focusKey)))return this.focus(),this.keyBuffer="",void e.preventDefault();if(this.config.unfocusKey&&e.key===this.config.unfocusKey&&this._isFocused)return this.unfocus(),void e.preventDefault();if(this._isFocused&&this.config.enableKeyboardNav&&this.container)switch(e.key){case"ArrowUp":this.container.scrollTop-=20,e.preventDefault();break;case"ArrowDown":this.container.scrollTop+=20,e.preventDefault();break;case"PageUp":this.container.scrollTop-=this.container.clientHeight,e.preventDefault();break;case"PageDown":this.container.scrollTop+=this.container.clientHeight,e.preventDefault();break;case"Home":this.container.scrollTop=0,e.preventDefault();break;case"End":this.container.scrollTop=this.container.scrollHeight,e.preventDefault()}}log(...e){this.addLog("log",...e)}info(...e){this.addLog("info",...e)}warn(...e){this.addLog("warn",...e)}error(...e){this.addLog("error",...e)}debug(...e){this.addLog("debug",...e)}clear(){this.logs=[],this.render()}show(){this.container&&(this.container.style.display="block",this.isVisible=!0)}hide(){this.container&&(this.container.style.display="none",this.isVisible=!1)}toggle(){this.isVisible?this.hide():this.show()}focus(){this.container&&!this._isFocused&&(this._isFocused=!0,this.container.focus(),this.config.showFocusIndicator&&(this.container.style.border="2px solid #00ff00",this.container.style.boxShadow="0 0 10px rgba(0, 255, 0, 0.5)"),this.config.onFocus&&this.config.onFocus(),console.log("TV Console focused - Use arrow keys to scroll, Escape to unfocus"))}unfocus(){this.container&&this._isFocused&&(this._isFocused=!1,this.container.blur(),this.config.showFocusIndicator&&(this.container.style.border="",this.container.style.boxShadow="0 2px 10px rgba(0, 0, 0, 0.3)"),this.config.onUnfocus&&this.config.onUnfocus())}isFocused(){return this._isFocused}destroy(){this.container&&(document.body.removeChild(this.container),this.container=null),Object.assign(console,this.originalConsole)}getLogs(){return[...this.logs]}setConfig(e){this.config={...this.config,...e},this.container&&(this.container.style.cssText=`\n position: fixed;\n ${this.getPositionStyles()}\n width: ${this.config.width};\n height: ${this.config.height};\n background-color: ${this.config.backgroundColor};\n color: ${this.config.textColor};\n font-family: 'Courier New', monospace;\n font-size: ${this.config.fontSize};\n padding: 10px;\n border-radius: 5px;\n overflow-y: auto;\n z-index: ${this.config.zIndex};\n opacity: ${this.config.opacity};\n display: ${this.isVisible?"block":"none"};\n word-wrap: break-word;\n white-space: pre-wrap;\n box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);\n outline: none;\n `,this.container.tabIndex=this.config.enableKeyboardNav?0:-1),this.render()}exportLogs(){return this.logs.map(e=>`[${e.timestamp.toISOString()}] [${e.level.toUpperCase()}] ${e.message}`).join("\n")}}exports.TVConsole=t,exports.default=t;
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const DEFAULT_CONFIG = {
6
+ enabled: true,
7
+ maxEntries: 100,
8
+ position: 'top-right',
9
+ width: '400px',
10
+ height: '300px',
11
+ backgroundColor: 'rgba(0, 0, 0, 0.8)',
12
+ textColor: '#ffffff',
13
+ fontSize: '14px',
14
+ opacity: 0.9,
15
+ showTimestamp: true,
16
+ className: 'tv-console',
17
+ zIndex: 9999,
18
+ showLogLevel: true,
19
+ logLevels: ['log', 'info', 'warn', 'error', 'debug'],
20
+ formatter: (entry) => {
21
+ const timestamp = entry.timestamp.toLocaleTimeString();
22
+ const level = `[${entry.level.toUpperCase()}]` ;
23
+ const prefix = `[${timestamp}]` ;
24
+ return `${prefix} ${level} ${entry.message}`.trim();
25
+ },
26
+ focusKey: '12345',
27
+ unfocusKey: 'Escape',
28
+ onFocus: () => { },
29
+ onUnfocus: () => { },
30
+ enableKeyboardNav: true,
31
+ showFocusIndicator: true
32
+ };
33
+ class TVConsole {
34
+ constructor(config = {}) {
35
+ Object.defineProperty(this, "config", {
36
+ enumerable: true,
37
+ configurable: true,
38
+ writable: true,
39
+ value: void 0
40
+ });
41
+ Object.defineProperty(this, "logs", {
42
+ enumerable: true,
43
+ configurable: true,
44
+ writable: true,
45
+ value: []
46
+ });
47
+ Object.defineProperty(this, "container", {
48
+ enumerable: true,
49
+ configurable: true,
50
+ writable: true,
51
+ value: null
52
+ });
53
+ Object.defineProperty(this, "isVisible", {
54
+ enumerable: true,
55
+ configurable: true,
56
+ writable: true,
57
+ value: false
58
+ });
59
+ Object.defineProperty(this, "originalConsole", {
60
+ enumerable: true,
61
+ configurable: true,
62
+ writable: true,
63
+ value: void 0
64
+ });
65
+ Object.defineProperty(this, "_isFocused", {
66
+ enumerable: true,
67
+ configurable: true,
68
+ writable: true,
69
+ value: false
70
+ });
71
+ Object.defineProperty(this, "keyBuffer", {
72
+ enumerable: true,
73
+ configurable: true,
74
+ writable: true,
75
+ value: ''
76
+ });
77
+ Object.defineProperty(this, "keyBufferTimeout", {
78
+ enumerable: true,
79
+ configurable: true,
80
+ writable: true,
81
+ value: null
82
+ });
83
+ this.config = { ...DEFAULT_CONFIG, ...config };
84
+ this.originalConsole = console;
85
+ this.initialize();
86
+ }
87
+ initialize() {
88
+ if (!this.config.enabled)
89
+ return;
90
+ this.createContainer();
91
+ this.interceptConsole();
92
+ this.setupKeyboardListeners();
93
+ this.render();
94
+ }
95
+ createContainer() {
96
+ this.container = document.createElement('div');
97
+ this.container.className = this.config.className;
98
+ this.container.tabIndex = this.config.enableKeyboardNav ? 0 : -1;
99
+ this.container.style.cssText = `
100
+ position: fixed;
101
+ ${this.getPositionStyles()}
102
+ width: ${this.config.width};
103
+ height: ${this.config.height};
104
+ background-color: ${this.config.backgroundColor};
105
+ color: ${this.config.textColor};
106
+ font-family: 'Courier New', monospace;
107
+ font-size: ${this.config.fontSize};
108
+ padding: 10px;
109
+ border-radius: 5px;
110
+ overflow-y: auto;
111
+ z-index: ${this.config.zIndex};
112
+ opacity: ${this.config.opacity};
113
+ display: none;
114
+ word-wrap: break-word;
115
+ white-space: pre-wrap;
116
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
117
+ outline: none;
118
+ `;
119
+ document.body.appendChild(this.container);
120
+ }
121
+ getPositionStyles() {
122
+ switch (this.config.position) {
123
+ case 'top-left':
124
+ return 'top: 10px; left: 10px;';
125
+ case 'top-right':
126
+ return 'top: 10px; right: 10px;';
127
+ case 'bottom-left':
128
+ return 'bottom: 10px; left: 10px;';
129
+ case 'bottom-right':
130
+ return 'bottom: 10px; right: 10px;';
131
+ default:
132
+ return 'top: 10px; right: 10px;';
133
+ }
134
+ }
135
+ interceptConsole() {
136
+ const methods = ['log', 'info', 'warn', 'error', 'debug'];
137
+ methods.forEach(method => {
138
+ const original = this.originalConsole[method];
139
+ this.originalConsole[method] = (...args) => {
140
+ // Call original console method
141
+ original.apply(this.originalConsole, args);
142
+ // Add to TV console
143
+ this.addLog(method, ...args);
144
+ };
145
+ });
146
+ }
147
+ addLog(level, ...args) {
148
+ if (!this.config.enabled || !this.config.logLevels.includes(level)) {
149
+ return;
150
+ }
151
+ const message = args.map(arg => this.formatArgument(arg)).join(' ');
152
+ const entry = {
153
+ id: Date.now().toString() + Math.random().toString(36).substr(2, 9),
154
+ level,
155
+ message,
156
+ timestamp: new Date(),
157
+ data: args,
158
+ stack: level === 'error' ? new Error().stack : undefined
159
+ };
160
+ this.logs.push(entry);
161
+ // Keep only the latest entries
162
+ if (this.logs.length > this.config.maxEntries) {
163
+ this.logs = this.logs.slice(-this.config.maxEntries);
164
+ }
165
+ this.render();
166
+ }
167
+ formatArgument(arg) {
168
+ if (arg === null)
169
+ return 'null';
170
+ if (arg === undefined)
171
+ return 'undefined';
172
+ // Handle Error objects specifically
173
+ if (arg instanceof Error) {
174
+ return `Error: ${arg.message}\nStack: ${arg.stack || 'No stack trace available'}`;
175
+ }
176
+ // Handle other objects
177
+ if (typeof arg === 'object') {
178
+ try {
179
+ // Try JSON.stringify first
180
+ return JSON.stringify(arg, null, 2);
181
+ }
182
+ catch {
183
+ // If JSON.stringify fails, try to get a meaningful string representation
184
+ if (arg.toString && arg.toString !== Object.prototype.toString) {
185
+ return arg.toString();
186
+ }
187
+ // For objects that don't have a custom toString, show their keys
188
+ const keys = Object.keys(arg);
189
+ if (keys.length > 0) {
190
+ return `[Object with keys: ${keys.join(', ')}]`;
191
+ }
192
+ else {
193
+ return '[Empty Object]';
194
+ }
195
+ }
196
+ }
197
+ // Handle functions
198
+ if (typeof arg === 'function') {
199
+ return `[Function: ${arg.name || 'anonymous'}]`;
200
+ }
201
+ // Handle other primitive types
202
+ return String(arg);
203
+ }
204
+ render() {
205
+ if (!this.container)
206
+ return;
207
+ const filteredLogs = this.logs.filter(log => this.config.logLevels.includes(log.level));
208
+ const formattedLogs = filteredLogs.map(log => {
209
+ const formatted = this.config.formatter(log);
210
+ const levelClass = `tv-console-${log.level}`;
211
+ return `<div class="${levelClass}">${this.escapeHtml(formatted)}</div>`;
212
+ });
213
+ this.container.innerHTML = formattedLogs.join('');
214
+ // Auto-scroll to the bottom to show the most recent logs
215
+ this.container.scrollTop = this.container.scrollHeight;
216
+ }
217
+ escapeHtml(text) {
218
+ const div = document.createElement('div');
219
+ div.textContent = text;
220
+ return div.innerHTML;
221
+ }
222
+ setupKeyboardListeners() {
223
+ document.addEventListener('keydown', (event) => {
224
+ this.handleKeyDown(event);
225
+ });
226
+ }
227
+ handleKeyDown(event) {
228
+ // Handle focus key combination
229
+ if (this.config.focusKey) {
230
+ this.keyBuffer += event.key;
231
+ // Clear buffer after 2 seconds of inactivity
232
+ if (this.keyBufferTimeout) {
233
+ clearTimeout(this.keyBufferTimeout);
234
+ }
235
+ this.keyBufferTimeout = window.setTimeout(() => {
236
+ this.keyBuffer = '';
237
+ }, 2000);
238
+ // Check if key combination matches
239
+ if (this.keyBuffer.includes(this.config.focusKey)) {
240
+ this.focus();
241
+ this.keyBuffer = '';
242
+ event.preventDefault();
243
+ return;
244
+ }
245
+ }
246
+ // Handle unfocus key
247
+ if (this.config.unfocusKey && event.key === this.config.unfocusKey && this._isFocused) {
248
+ this.unfocus();
249
+ event.preventDefault();
250
+ return;
251
+ }
252
+ // Handle keyboard navigation when focused
253
+ if (this._isFocused && this.config.enableKeyboardNav && this.container) {
254
+ switch (event.key) {
255
+ case 'ArrowUp':
256
+ this.container.scrollTop -= 20;
257
+ event.preventDefault();
258
+ break;
259
+ case 'ArrowDown':
260
+ this.container.scrollTop += 20;
261
+ event.preventDefault();
262
+ break;
263
+ case 'PageUp':
264
+ this.container.scrollTop -= this.container.clientHeight;
265
+ event.preventDefault();
266
+ break;
267
+ case 'PageDown':
268
+ this.container.scrollTop += this.container.clientHeight;
269
+ event.preventDefault();
270
+ break;
271
+ case 'Home':
272
+ this.container.scrollTop = 0;
273
+ event.preventDefault();
274
+ break;
275
+ case 'End':
276
+ this.container.scrollTop = this.container.scrollHeight;
277
+ event.preventDefault();
278
+ break;
279
+ }
280
+ }
281
+ }
282
+ // Public API methods
283
+ log(...args) {
284
+ this.addLog('log', ...args);
285
+ }
286
+ info(...args) {
287
+ this.addLog('info', ...args);
288
+ }
289
+ warn(...args) {
290
+ this.addLog('warn', ...args);
291
+ }
292
+ error(...args) {
293
+ this.addLog('error', ...args);
294
+ }
295
+ debug(...args) {
296
+ this.addLog('debug', ...args);
297
+ }
298
+ clear() {
299
+ this.logs = [];
300
+ this.render();
301
+ }
302
+ show() {
303
+ if (this.container) {
304
+ this.container.style.display = 'block';
305
+ this.isVisible = true;
306
+ }
307
+ }
308
+ hide() {
309
+ if (this.container) {
310
+ this.container.style.display = 'none';
311
+ this.isVisible = false;
312
+ }
313
+ }
314
+ toggle() {
315
+ if (this.isVisible) {
316
+ this.hide();
317
+ }
318
+ else {
319
+ this.show();
320
+ }
321
+ }
322
+ focus() {
323
+ if (!this.container || this._isFocused)
324
+ return;
325
+ this._isFocused = true;
326
+ this.container.focus();
327
+ if (this.config.showFocusIndicator) {
328
+ this.container.style.border = '2px solid #00ff00';
329
+ this.container.style.boxShadow = '0 0 10px rgba(0, 255, 0, 0.5)';
330
+ }
331
+ // Call onFocus callback if provided
332
+ if (this.config.onFocus) {
333
+ this.config.onFocus();
334
+ }
335
+ console.log('TV Console focused - Use arrow keys to scroll, Escape to unfocus');
336
+ }
337
+ unfocus() {
338
+ if (!this.container || !this._isFocused)
339
+ return;
340
+ this._isFocused = false;
341
+ this.container.blur();
342
+ if (this.config.showFocusIndicator) {
343
+ this.container.style.border = '';
344
+ this.container.style.boxShadow = '0 2px 10px rgba(0, 0, 0, 0.3)';
345
+ }
346
+ // Call onUnfocus callback if provided
347
+ if (this.config.onUnfocus) {
348
+ this.config.onUnfocus();
349
+ }
350
+ }
351
+ isFocused() {
352
+ return this._isFocused;
353
+ }
354
+ destroy() {
355
+ if (this.container) {
356
+ document.body.removeChild(this.container);
357
+ this.container = null;
358
+ }
359
+ // Restore original console methods
360
+ Object.assign(console, this.originalConsole);
361
+ }
362
+ getLogs() {
363
+ return [...this.logs];
364
+ }
365
+ setConfig(config) {
366
+ this.config = { ...this.config, ...config };
367
+ if (this.container) {
368
+ this.container.style.cssText = `
369
+ position: fixed;
370
+ ${this.getPositionStyles()}
371
+ width: ${this.config.width};
372
+ height: ${this.config.height};
373
+ background-color: ${this.config.backgroundColor};
374
+ color: ${this.config.textColor};
375
+ font-family: 'Courier New', monospace;
376
+ font-size: ${this.config.fontSize};
377
+ padding: 10px;
378
+ border-radius: 5px;
379
+ overflow-y: auto;
380
+ z-index: ${this.config.zIndex};
381
+ opacity: ${this.config.opacity};
382
+ display: ${this.isVisible ? 'block' : 'none'};
383
+ word-wrap: break-word;
384
+ white-space: pre-wrap;
385
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
386
+ outline: none;
387
+ `;
388
+ this.container.tabIndex = this.config.enableKeyboardNav ? 0 : -1;
389
+ }
390
+ this.render();
391
+ }
392
+ exportLogs() {
393
+ return this.logs.map(log => {
394
+ const timestamp = log.timestamp.toISOString();
395
+ return `[${timestamp}] [${log.level.toUpperCase()}] ${log.message}`;
396
+ }).join('\n');
397
+ }
398
+ }
399
+
400
+ exports.TVConsole = TVConsole;
401
+ exports.default = TVConsole;
2
402
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/tv-console.ts"],"sourcesContent":["import type { TVConsoleConfig, LogLevel, LogEntry, TVConsoleInstance } from './types';\n\nconst DEFAULT_CONFIG: Required<TVConsoleConfig> = {\n enabled: true,\n maxEntries: 100,\n position: 'top-right',\n width: '400px',\n height: '300px',\n backgroundColor: 'rgba(0, 0, 0, 0.8)',\n textColor: '#ffffff',\n fontSize: '14px',\n opacity: 0.9,\n showTimestamp: true,\n className: 'tv-console',\n zIndex: 9999,\n showLogLevel: true,\n logLevels: ['log', 'info', 'warn', 'error', 'debug'],\n formatter: (entry: LogEntry) => {\n const timestamp = entry.timestamp.toLocaleTimeString();\n const level = DEFAULT_CONFIG.showLogLevel ? `[${entry.level.toUpperCase()}]` : '';\n const prefix = DEFAULT_CONFIG.showTimestamp ? `[${timestamp}]` : '';\n return `${prefix} ${level} ${entry.message}`.trim();\n },\n focusKey: '12345',\n unfocusKey: 'Escape',\n onFocus: () => {},\n onUnfocus: () => {},\n enableKeyboardNav: true,\n showFocusIndicator: true\n};\n\nexport class TVConsole implements TVConsoleInstance {\n private config: Required<TVConsoleConfig>;\n private logs: LogEntry[] = [];\n private container: HTMLDivElement | null = null;\n private isVisible = false;\n private originalConsole: Console;\n private _isFocused = false;\n private keyBuffer = '';\n private keyBufferTimeout: number | null = null;\n\n constructor(config: TVConsoleConfig = {}) {\n this.config = { ...DEFAULT_CONFIG, ...config };\n this.originalConsole = console;\n this.initialize();\n }\n\n private initialize(): void {\n if (!this.config.enabled) return;\n\n this.createContainer();\n this.interceptConsole();\n this.setupKeyboardListeners();\n this.render();\n }\n\n private createContainer(): void {\n this.container = document.createElement('div');\n this.container.className = this.config.className;\n this.container.tabIndex = this.config.enableKeyboardNav ? 0 : -1;\n this.container.style.cssText = `\n position: fixed;\n ${this.getPositionStyles()}\n width: ${this.config.width};\n height: ${this.config.height};\n background-color: ${this.config.backgroundColor};\n color: ${this.config.textColor};\n font-family: 'Courier New', monospace;\n font-size: ${this.config.fontSize};\n padding: 10px;\n border-radius: 5px;\n overflow-y: auto;\n z-index: ${this.config.zIndex};\n opacity: ${this.config.opacity};\n display: none;\n word-wrap: break-word;\n white-space: pre-wrap;\n box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);\n outline: none;\n `;\n\n document.body.appendChild(this.container);\n }\n\n private getPositionStyles(): string {\n switch (this.config.position) {\n case 'top-left':\n return 'top: 10px; left: 10px;';\n case 'top-right':\n return 'top: 10px; right: 10px;';\n case 'bottom-left':\n return 'bottom: 10px; left: 10px;';\n case 'bottom-right':\n return 'bottom: 10px; right: 10px;';\n default:\n return 'top: 10px; right: 10px;';\n }\n }\n\n private interceptConsole(): void {\n const methods: LogLevel[] = ['log', 'info', 'warn', 'error', 'debug'];\n \n methods.forEach(method => {\n const original = this.originalConsole[method];\n this.originalConsole[method] = (...args: any[]) => {\n // Call original console method\n original.apply(this.originalConsole, args);\n \n // Add to TV console\n this.addLog(method, ...args);\n };\n });\n }\n\n private addLog(level: LogLevel, ...args: any[]): void {\n if (!this.config.enabled || !this.config.logLevels.includes(level)) {\n return;\n }\n\n const message = args.map(arg => this.formatArgument(arg)).join(' ');\n const entry: LogEntry = {\n id: Date.now().toString() + Math.random().toString(36).substr(2, 9),\n level,\n message,\n timestamp: new Date(),\n data: args,\n stack: level === 'error' ? new Error().stack : undefined\n };\n\n this.logs.push(entry);\n\n // Keep only the latest entries\n if (this.logs.length > this.config.maxEntries) {\n this.logs = this.logs.slice(-this.config.maxEntries);\n }\n\n this.render();\n }\n\n private formatArgument(arg: any): string {\n if (arg === null) return 'null';\n if (arg === undefined) return 'undefined';\n \n // Handle Error objects specifically\n if (arg instanceof Error) {\n return `Error: ${arg.message}\\nStack: ${arg.stack || 'No stack trace available'}`;\n }\n \n // Handle other objects\n if (typeof arg === 'object') {\n try {\n // Try JSON.stringify first\n return JSON.stringify(arg, null, 2);\n } catch {\n // If JSON.stringify fails, try to get a meaningful string representation\n if (arg.toString && arg.toString !== Object.prototype.toString) {\n return arg.toString();\n }\n \n // For objects that don't have a custom toString, show their keys\n const keys = Object.keys(arg);\n if (keys.length > 0) {\n return `[Object with keys: ${keys.join(', ')}]`;\n } else {\n return '[Empty Object]';\n }\n }\n }\n \n // Handle functions\n if (typeof arg === 'function') {\n return `[Function: ${arg.name || 'anonymous'}]`;\n }\n \n // Handle other primitive types\n return String(arg);\n }\n\n private render(): void {\n if (!this.container) return;\n\n const filteredLogs = this.logs.filter(log => \n this.config.logLevels.includes(log.level)\n );\n\n const formattedLogs = filteredLogs.map(log => {\n const formatted = this.config.formatter(log);\n const levelClass = `tv-console-${log.level}`;\n return `<div class=\"${levelClass}\">${this.escapeHtml(formatted)}</div>`;\n });\n\n this.container.innerHTML = formattedLogs.join('');\n \n // Auto-scroll to the bottom to show the most recent logs\n this.container.scrollTop = this.container.scrollHeight;\n }\n\n private escapeHtml(text: string): string {\n const div = document.createElement('div');\n div.textContent = text;\n return div.innerHTML;\n }\n\n private setupKeyboardListeners(): void {\n document.addEventListener('keydown', (event) => {\n this.handleKeyDown(event);\n });\n }\n\n private handleKeyDown(event: KeyboardEvent): void {\n // Handle focus key combination\n if (this.config.focusKey) {\n this.keyBuffer += event.key;\n \n // Clear buffer after 2 seconds of inactivity\n if (this.keyBufferTimeout) {\n clearTimeout(this.keyBufferTimeout);\n }\n this.keyBufferTimeout = window.setTimeout(() => {\n this.keyBuffer = '';\n }, 2000);\n\n // Check if key combination matches\n if (this.keyBuffer.includes(this.config.focusKey)) {\n this.focus();\n this.keyBuffer = '';\n event.preventDefault();\n return;\n }\n }\n\n // Handle unfocus key\n if (this.config.unfocusKey && event.key === this.config.unfocusKey && this._isFocused) {\n this.unfocus();\n event.preventDefault();\n return;\n }\n\n // Handle keyboard navigation when focused\n if (this._isFocused && this.config.enableKeyboardNav && this.container) {\n switch (event.key) {\n case 'ArrowUp':\n this.container.scrollTop -= 20;\n event.preventDefault();\n break;\n case 'ArrowDown':\n this.container.scrollTop += 20;\n event.preventDefault();\n break;\n case 'PageUp':\n this.container.scrollTop -= this.container.clientHeight;\n event.preventDefault();\n break;\n case 'PageDown':\n this.container.scrollTop += this.container.clientHeight;\n event.preventDefault();\n break;\n case 'Home':\n this.container.scrollTop = 0;\n event.preventDefault();\n break;\n case 'End':\n this.container.scrollTop = this.container.scrollHeight;\n event.preventDefault();\n break;\n }\n }\n }\n\n // Public API methods\n log(...args: any[]): void {\n this.addLog('log', ...args);\n }\n\n info(...args: any[]): void {\n this.addLog('info', ...args);\n }\n\n warn(...args: any[]): void {\n this.addLog('warn', ...args);\n }\n\n error(...args: any[]): void {\n this.addLog('error', ...args);\n }\n\n debug(...args: any[]): void {\n this.addLog('debug', ...args);\n }\n\n clear(): void {\n this.logs = [];\n this.render();\n }\n\n show(): void {\n if (this.container) {\n this.container.style.display = 'block';\n this.isVisible = true;\n }\n }\n\n hide(): void {\n if (this.container) {\n this.container.style.display = 'none';\n this.isVisible = false;\n }\n }\n\n toggle(): void {\n if (this.isVisible) {\n this.hide();\n } else {\n this.show();\n }\n }\n\n focus(): void {\n if (!this.container || this._isFocused) return;\n \n this._isFocused = true;\n this.container.focus();\n \n if (this.config.showFocusIndicator) {\n this.container.style.border = '2px solid #00ff00';\n this.container.style.boxShadow = '0 0 10px rgba(0, 255, 0, 0.5)';\n }\n \n // Call onFocus callback if provided\n if (this.config.onFocus) {\n this.config.onFocus();\n }\n \n console.log('TV Console focused - Use arrow keys to scroll, Escape to unfocus');\n }\n\n unfocus(): void {\n if (!this.container || !this._isFocused) return;\n \n this._isFocused = false;\n this.container.blur();\n \n if (this.config.showFocusIndicator) {\n this.container.style.border = '';\n this.container.style.boxShadow = '0 2px 10px rgba(0, 0, 0, 0.3)';\n }\n \n // Call onUnfocus callback if provided\n if (this.config.onUnfocus) {\n this.config.onUnfocus();\n }\n }\n\n isFocused(): boolean {\n return this._isFocused;\n }\n\n destroy(): void {\n if (this.container) {\n document.body.removeChild(this.container);\n this.container = null;\n }\n \n // Restore original console methods\n Object.assign(console, this.originalConsole);\n }\n\n getLogs(): LogEntry[] {\n return [...this.logs];\n }\n\n setConfig(config: Partial<TVConsoleConfig>): void {\n this.config = { ...this.config, ...config };\n \n if (this.container) {\n this.container.style.cssText = `\n position: fixed;\n ${this.getPositionStyles()}\n width: ${this.config.width};\n height: ${this.config.height};\n background-color: ${this.config.backgroundColor};\n color: ${this.config.textColor};\n font-family: 'Courier New', monospace;\n font-size: ${this.config.fontSize};\n padding: 10px;\n border-radius: 5px;\n overflow-y: auto;\n z-index: ${this.config.zIndex};\n opacity: ${this.config.opacity};\n display: ${this.isVisible ? 'block' : 'none'};\n word-wrap: break-word;\n white-space: pre-wrap;\n box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);\n outline: none;\n `;\n this.container.tabIndex = this.config.enableKeyboardNav ? 0 : -1;\n }\n \n this.render();\n }\n\n exportLogs(): string {\n return this.logs.map(log => {\n const timestamp = log.timestamp.toISOString();\n return `[${timestamp}] [${log.level.toUpperCase()}] ${log.message}`;\n }).join('\\n');\n }\n} "],"names":["DEFAULT_CONFIG","enabled","maxEntries","position","width","height","backgroundColor","textColor","fontSize","opacity","showTimestamp","className","zIndex","showLogLevel","logLevels","formatter","entry","timestamp","toLocaleTimeString","level","toUpperCase","message","trim","focusKey","unfocusKey","onFocus","onUnfocus","enableKeyboardNav","showFocusIndicator","TVConsole","constructor","config","Object","defineProperty","this","originalConsole","console","initialize","createContainer","interceptConsole","setupKeyboardListeners","render","container","document","createElement","tabIndex","style","cssText","getPositionStyles","body","appendChild","forEach","method","original","args","apply","addLog","includes","map","arg","formatArgument","join","id","Date","now","toString","Math","random","substr","data","stack","Error","undefined","logs","push","length","slice","JSON","stringify","prototype","keys","name","String","formattedLogs","filter","log","formatted","escapeHtml","innerHTML","scrollTop","scrollHeight","text","div","textContent","addEventListener","event","handleKeyDown","keyBuffer","key","keyBufferTimeout","clearTimeout","window","setTimeout","focus","preventDefault","_isFocused","unfocus","clientHeight","info","warn","error","debug","clear","show","display","isVisible","hide","toggle","border","boxShadow","blur","isFocused","destroy","removeChild","assign","getLogs","setConfig","exportLogs","toISOString"],"mappings":"oEAEA,MAAMA,EAA4C,CAChDC,SAAS,EACTC,WAAY,IACZC,SAAU,YACVC,MAAO,QACPC,OAAQ,QACRC,gBAAiB,qBACjBC,UAAW,UACXC,SAAU,OACVC,QAAS,GACTC,eAAe,EACfC,UAAW,aACXC,OAAQ,KACRC,cAAc,EACdC,UAAW,CAAC,MAAO,OAAQ,OAAQ,QAAS,SAC5CC,UAAYC,GAIH,GADuC,IAF5BA,EAAMC,UAAUC,2BACU,IAAIF,EAAMG,MAAMC,oBAE/BJ,EAAMK,UAAUC,OAE/CC,SAAU,QACVC,WAAY,SACZC,QAAS,OACTC,UAAW,OACXC,mBAAmB,EACnBC,oBAAoB,SAGTC,EAUX,WAAAC,CAAYC,EAA0B,IAT9BC,OAAAC,eAAAC,KAAA,SAAA,0DACAF,OAAAC,eAAAC,KAAA,OAAA,iDAAmB,KACnBF,OAAAC,eAAAC,KAAA,YAAA,iDAAmC,OACnCF,OAAAC,eAAAC,KAAA,YAAA,kDAAY,IACZF,OAAAC,eAAAC,KAAA,kBAAA,0DACAF,OAAAC,eAAAC,KAAA,aAAA,kDAAa,IACbF,OAAAC,eAAAC,KAAA,YAAA,iDAAY,KACZF,OAAAC,eAAAC,KAAA,mBAAA,iDAAkC,OAGxCA,KAAKH,OAAS,IAAK/B,KAAmB+B,GACtCG,KAAKC,gBAAkBC,QACvBF,KAAKG,YACN,CAEO,UAAAA,GACDH,KAAKH,OAAO9B,UAEjBiC,KAAKI,kBACLJ,KAAKK,mBACLL,KAAKM,yBACLN,KAAKO,SACN,CAEO,eAAAH,GACNJ,KAAKQ,UAAYC,SAASC,cAAc,OACxCV,KAAKQ,UAAU/B,UAAYuB,KAAKH,OAAOpB,UACvCuB,KAAKQ,UAAUG,SAAWX,KAAK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sF,GACE,OAAO7F,KAAKuC,KAAKf,IAAI2B,GAEZ,IADWA,EAAIpE,UAAU+G,mBACN3C,EAAIlE,MAAMC,kBAAkBiE,EAAIhE,WACzDwC,KAAK,KACT"}
1
+ {"version":3,"file":"index.js","sources":["../src/tv-console.ts"],"sourcesContent":["import type { TVConsoleConfig, LogLevel, LogEntry, TVConsoleInstance } from './types';\n\nconst DEFAULT_CONFIG: Required<TVConsoleConfig> = {\n enabled: true,\n maxEntries: 100,\n position: 'top-right',\n width: '400px',\n height: '300px',\n backgroundColor: 'rgba(0, 0, 0, 0.8)',\n textColor: '#ffffff',\n fontSize: '14px',\n opacity: 0.9,\n showTimestamp: true,\n className: 'tv-console',\n zIndex: 9999,\n showLogLevel: true,\n logLevels: ['log', 'info', 'warn', 'error', 'debug'],\n formatter: (entry: LogEntry) => {\n const timestamp = entry.timestamp.toLocaleTimeString();\n const level = DEFAULT_CONFIG.showLogLevel ? `[${entry.level.toUpperCase()}]` : '';\n const prefix = DEFAULT_CONFIG.showTimestamp ? `[${timestamp}]` : '';\n return `${prefix} ${level} ${entry.message}`.trim();\n },\n focusKey: '12345',\n unfocusKey: 'Escape',\n onFocus: () => {},\n onUnfocus: () => {},\n enableKeyboardNav: true,\n showFocusIndicator: true\n};\n\nexport class TVConsole implements TVConsoleInstance {\n private config: Required<TVConsoleConfig>;\n private logs: LogEntry[] = [];\n private container: HTMLDivElement | null = null;\n private isVisible = false;\n private originalConsole: Console;\n private _isFocused = false;\n private keyBuffer = '';\n private keyBufferTimeout: number | null = null;\n\n constructor(config: TVConsoleConfig = {}) {\n this.config = { ...DEFAULT_CONFIG, ...config };\n this.originalConsole = console;\n this.initialize();\n }\n\n private initialize(): void {\n if (!this.config.enabled) return;\n\n this.createContainer();\n this.interceptConsole();\n this.setupKeyboardListeners();\n this.render();\n }\n\n private createContainer(): void {\n this.container = document.createElement('div');\n this.container.className = this.config.className;\n this.container.tabIndex = this.config.enableKeyboardNav ? 0 : -1;\n this.container.style.cssText = `\n position: fixed;\n ${this.getPositionStyles()}\n width: ${this.config.width};\n height: ${this.config.height};\n background-color: ${this.config.backgroundColor};\n color: ${this.config.textColor};\n font-family: 'Courier New', monospace;\n font-size: ${this.config.fontSize};\n padding: 10px;\n border-radius: 5px;\n overflow-y: auto;\n z-index: ${this.config.zIndex};\n opacity: ${this.config.opacity};\n display: none;\n word-wrap: break-word;\n white-space: pre-wrap;\n box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);\n outline: none;\n `;\n\n document.body.appendChild(this.container);\n }\n\n private getPositionStyles(): string {\n switch (this.config.position) {\n case 'top-left':\n return 'top: 10px; left: 10px;';\n case 'top-right':\n return 'top: 10px; right: 10px;';\n case 'bottom-left':\n return 'bottom: 10px; left: 10px;';\n case 'bottom-right':\n return 'bottom: 10px; right: 10px;';\n default:\n return 'top: 10px; right: 10px;';\n }\n }\n\n private interceptConsole(): void {\n const methods: LogLevel[] = ['log', 'info', 'warn', 'error', 'debug'];\n \n methods.forEach(method => {\n const original = this.originalConsole[method];\n this.originalConsole[method] = (...args: any[]) => {\n // Call original console method\n original.apply(this.originalConsole, args);\n \n // Add to TV console\n this.addLog(method, ...args);\n };\n });\n }\n\n private addLog(level: LogLevel, ...args: any[]): void {\n if (!this.config.enabled || !this.config.logLevels.includes(level)) {\n return;\n }\n\n const message = args.map(arg => this.formatArgument(arg)).join(' ');\n const entry: LogEntry = {\n id: Date.now().toString() + Math.random().toString(36).substr(2, 9),\n level,\n message,\n timestamp: new Date(),\n data: args,\n stack: level === 'error' ? new Error().stack : undefined\n };\n\n this.logs.push(entry);\n\n // Keep only the latest entries\n if (this.logs.length > this.config.maxEntries) {\n this.logs = this.logs.slice(-this.config.maxEntries);\n }\n\n this.render();\n }\n\n private formatArgument(arg: any): string {\n if (arg === null) return 'null';\n if (arg === undefined) return 'undefined';\n \n // Handle Error objects specifically\n if (arg instanceof Error) {\n return `Error: ${arg.message}\\nStack: ${arg.stack || 'No stack trace available'}`;\n }\n \n // Handle other objects\n if (typeof arg === 'object') {\n try {\n // Try JSON.stringify first\n return JSON.stringify(arg, null, 2);\n } catch {\n // If JSON.stringify fails, try to get a meaningful string representation\n if (arg.toString && arg.toString !== Object.prototype.toString) {\n return arg.toString();\n }\n \n // For objects that don't have a custom toString, show their keys\n const keys = Object.keys(arg);\n if (keys.length > 0) {\n return `[Object with keys: ${keys.join(', ')}]`;\n } else {\n return '[Empty Object]';\n }\n }\n }\n \n // Handle functions\n if (typeof arg === 'function') {\n return `[Function: ${arg.name || 'anonymous'}]`;\n }\n \n // Handle other primitive types\n return String(arg);\n }\n\n private render(): void {\n if (!this.container) return;\n\n const filteredLogs = this.logs.filter(log => \n this.config.logLevels.includes(log.level)\n );\n\n const formattedLogs = filteredLogs.map(log => {\n const formatted = this.config.formatter(log);\n const levelClass = `tv-console-${log.level}`;\n return `<div class=\"${levelClass}\">${this.escapeHtml(formatted)}</div>`;\n });\n\n this.container.innerHTML = formattedLogs.join('');\n \n // Auto-scroll to the bottom to show the most recent logs\n this.container.scrollTop = this.container.scrollHeight;\n }\n\n private escapeHtml(text: string): string {\n const div = document.createElement('div');\n div.textContent = text;\n return div.innerHTML;\n }\n\n private setupKeyboardListeners(): void {\n document.addEventListener('keydown', (event) => {\n this.handleKeyDown(event);\n });\n }\n\n private handleKeyDown(event: KeyboardEvent): void {\n // Handle focus key combination\n if (this.config.focusKey) {\n this.keyBuffer += event.key;\n \n // Clear buffer after 2 seconds of inactivity\n if (this.keyBufferTimeout) {\n clearTimeout(this.keyBufferTimeout);\n }\n this.keyBufferTimeout = window.setTimeout(() => {\n this.keyBuffer = '';\n }, 2000);\n\n // Check if key combination matches\n if (this.keyBuffer.includes(this.config.focusKey)) {\n this.focus();\n this.keyBuffer = '';\n event.preventDefault();\n return;\n }\n }\n\n // Handle unfocus key\n if (this.config.unfocusKey && event.key === this.config.unfocusKey && this._isFocused) {\n this.unfocus();\n event.preventDefault();\n return;\n }\n\n // Handle keyboard navigation when focused\n if (this._isFocused && this.config.enableKeyboardNav && this.container) {\n switch (event.key) {\n case 'ArrowUp':\n this.container.scrollTop -= 20;\n event.preventDefault();\n break;\n case 'ArrowDown':\n this.container.scrollTop += 20;\n event.preventDefault();\n break;\n case 'PageUp':\n this.container.scrollTop -= this.container.clientHeight;\n event.preventDefault();\n break;\n case 'PageDown':\n this.container.scrollTop += this.container.clientHeight;\n event.preventDefault();\n break;\n case 'Home':\n this.container.scrollTop = 0;\n event.preventDefault();\n break;\n case 'End':\n this.container.scrollTop = this.container.scrollHeight;\n event.preventDefault();\n break;\n }\n }\n }\n\n // Public API methods\n log(...args: any[]): void {\n this.addLog('log', ...args);\n }\n\n info(...args: any[]): void {\n this.addLog('info', ...args);\n }\n\n warn(...args: any[]): void {\n this.addLog('warn', ...args);\n }\n\n error(...args: any[]): void {\n this.addLog('error', ...args);\n }\n\n debug(...args: any[]): void {\n this.addLog('debug', ...args);\n }\n\n clear(): void {\n this.logs = [];\n this.render();\n }\n\n show(): void {\n if (this.container) {\n this.container.style.display = 'block';\n this.isVisible = true;\n }\n }\n\n hide(): void {\n if (this.container) {\n this.container.style.display = 'none';\n this.isVisible = false;\n }\n }\n\n toggle(): void {\n if (this.isVisible) {\n this.hide();\n } else {\n this.show();\n }\n }\n\n focus(): void {\n if (!this.container || this._isFocused) return;\n \n this._isFocused = true;\n this.container.focus();\n \n if (this.config.showFocusIndicator) {\n this.container.style.border = '2px solid #00ff00';\n this.container.style.boxShadow = '0 0 10px rgba(0, 255, 0, 0.5)';\n }\n \n // Call onFocus callback if provided\n if (this.config.onFocus) {\n this.config.onFocus();\n }\n \n console.log('TV Console focused - Use arrow keys to scroll, Escape to unfocus');\n }\n\n unfocus(): void {\n if (!this.container || !this._isFocused) return;\n \n this._isFocused = false;\n this.container.blur();\n \n if (this.config.showFocusIndicator) {\n this.container.style.border = '';\n this.container.style.boxShadow = '0 2px 10px rgba(0, 0, 0, 0.3)';\n }\n \n // Call onUnfocus callback if provided\n if (this.config.onUnfocus) {\n this.config.onUnfocus();\n }\n }\n\n isFocused(): boolean {\n return this._isFocused;\n }\n\n destroy(): void {\n if (this.container) {\n document.body.removeChild(this.container);\n this.container = null;\n }\n \n // Restore original console methods\n Object.assign(console, this.originalConsole);\n }\n\n getLogs(): LogEntry[] {\n return [...this.logs];\n }\n\n setConfig(config: Partial<TVConsoleConfig>): void {\n this.config = { ...this.config, ...config };\n \n if (this.container) {\n this.container.style.cssText = `\n position: fixed;\n ${this.getPositionStyles()}\n width: ${this.config.width};\n height: ${this.config.height};\n background-color: ${this.config.backgroundColor};\n color: ${this.config.textColor};\n font-family: 'Courier New', monospace;\n font-size: ${this.config.fontSize};\n padding: 10px;\n border-radius: 5px;\n overflow-y: auto;\n z-index: ${this.config.zIndex};\n opacity: ${this.config.opacity};\n display: ${this.isVisible ? 'block' : 'none'};\n word-wrap: break-word;\n white-space: pre-wrap;\n box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);\n outline: none;\n `;\n this.container.tabIndex = this.config.enableKeyboardNav ? 0 : -1;\n }\n \n this.render();\n }\n\n exportLogs(): string {\n return this.logs.map(log => {\n const timestamp = log.timestamp.toISOString();\n return `[${timestamp}] [${log.level.toUpperCase()}] ${log.message}`;\n }).join('\\n');\n }\n} "],"names":[],"mappings":";;;;AAEA,MAAM,cAAc,GAA8B;AAChD,IAAA,OAAO,EAAE,IAAI;AACb,IAAA,UAAU,EAAE,GAAG;AACf,IAAA,QAAQ,EAAE,WAAW;AACrB,IAAA,KAAK,EAAE,OAAO;AACd,IAAA,MAAM,EAAE,OAAO;AACf,IAAA,eAAe,EAAE,oBAAoB;AACrC,IAAA,SAAS,EAAE,SAAS;AACpB,IAAA,QAAQ,EAAE,MAAM;AAChB,IAAA,OAAO,EAAE,GAAG;AACZ,IAAA,aAAa,EAAE,IAAI;AACnB,IAAA,SAAS,EAAE,YAAY;AACvB,IAAA,MAAM,EAAE,IAAI;AACZ,IAAA,YAAY,EAAE,IAAI;IAClB,SAAS,EAAE,CAAC,KAAK,EAAE,MA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