@nice2dev/ui-monitoring 1.0.10

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.mjs ADDED
@@ -0,0 +1,1561 @@
1
+ import { jsxs as t, jsx as e, Fragment as X } from "react/jsx-runtime";
2
+ import { useState as s, useMemo as Z } from "react";
3
+ const V = {
4
+ trace: { color: "var(--text-muted, #888)", bg: "#88888822", icon: "⋯" },
5
+ debug: { color: "var(--color-accent, #8b5cf6)", bg: "#8b5cf622", icon: "🔍" },
6
+ info: { color: "var(--color-primary, #3b82f6)", bg: "#3b82f622", icon: "â„šī¸" },
7
+ warn: { color: "var(--color-warning, #f59e0b)", bg: "#f59e0b22", icon: "âš ī¸" },
8
+ error: { color: "var(--color-error, #ef4444)", bg: "#ef444422", icon: "❌" },
9
+ fatal: { color: "var(--color-error, #dc2626)", bg: "#dc262622", icon: "💀" }
10
+ }, te = [
11
+ { label: "Last 5 min", value: "now-5m" },
12
+ { label: "Last 15 min", value: "now-15m" },
13
+ { label: "Last 30 min", value: "now-30m" },
14
+ { label: "Last 1 hour", value: "now-1h" },
15
+ { label: "Last 3 hours", value: "now-3h" },
16
+ { label: "Last 6 hours", value: "now-6h" },
17
+ { label: "Last 12 hours", value: "now-12h" },
18
+ { label: "Last 24 hours", value: "now-24h" },
19
+ { label: "Last 7 days", value: "now-7d" }
20
+ ], ae = ({
21
+ logs: p,
22
+ streams: z,
23
+ totalCount: T,
24
+ isLoading: u,
25
+ savedQueries: A,
26
+ patterns: b = [],
27
+ onQueryExecute: O,
28
+ onQuerySave: _,
29
+ onQueryDelete: H,
30
+ onStreamToggle: J,
31
+ onLogClick: W,
32
+ onExport: C,
33
+ onTailStart: P,
34
+ onTailStop: Q,
35
+ isTailing: R = !1,
36
+ className: y,
37
+ style: j,
38
+ "data-testid": q
39
+ }) => {
40
+ const [L, I] = s(""), [N, $] = s("now-1h"), [G, ee] = s(1e3), [B, K] = s(
41
+ /* @__PURE__ */ new Set(["trace", "debug", "info", "warn", "error", "fatal"])
42
+ ), [m, M] = s(/* @__PURE__ */ new Set()), [Y, D] = s(null), [o, n] = s(!1), [i, g] = s(""), [c, S] = s("logs"), [x, k] = s(""), a = Z(() => p.filter((r) => !(!B.has(r.level) || x && !r.message.toLowerCase().includes(x.toLowerCase()))), [p, B, x]), h = Z(() => {
43
+ const r = {
44
+ trace: 0,
45
+ debug: 0,
46
+ info: 0,
47
+ warn: 0,
48
+ error: 0,
49
+ fatal: 0
50
+ };
51
+ return p.forEach((d) => r[d.level]++), r;
52
+ }, [p]), f = () => {
53
+ O({
54
+ query: L,
55
+ timeRange: { from: N, to: "now" },
56
+ limit: G,
57
+ direction: "backward"
58
+ });
59
+ }, v = (r) => {
60
+ M((d) => {
61
+ const l = new Set(d);
62
+ return l.has(r) ? l.delete(r) : l.add(r), l;
63
+ });
64
+ }, U = (r) => {
65
+ K((d) => {
66
+ const l = new Set(d);
67
+ return l.has(r) ? l.delete(r) : l.add(r), l;
68
+ });
69
+ }, E = () => {
70
+ i.trim() && (_(i, L), n(!1), g(""));
71
+ }, F = (r) => {
72
+ if (!x)
73
+ return r;
74
+ const d = new RegExp(`(${x})`, "gi");
75
+ return r.replace(
76
+ d,
77
+ '<mark style="background: #f59e0b; color: black; padding: 0 2px; border-radius: 2px;">$1</mark>'
78
+ );
79
+ };
80
+ return /* @__PURE__ */ t(
81
+ "div",
82
+ {
83
+ className: `nice-log-explorer ${y || ""}`,
84
+ style: {
85
+ display: "flex",
86
+ flexDirection: "column",
87
+ height: "100%",
88
+ background: "var(--bg-elevated, #1e1e1e)",
89
+ color: "var(--text-primary, #e0e0e0)",
90
+ ...j
91
+ },
92
+ "data-testid": q,
93
+ children: [
94
+ /* @__PURE__ */ t(
95
+ "div",
96
+ {
97
+ style: {
98
+ padding: "12px 16px",
99
+ borderBottom: "1px solid var(--border-color, #333)",
100
+ background: "var(--bg-elevated, #252525)"
101
+ },
102
+ children: [
103
+ /* @__PURE__ */ t("div", { style: { display: "flex", gap: "8px", marginBottom: "12px" }, children: [
104
+ /* @__PURE__ */ e(
105
+ "input",
106
+ {
107
+ type: "text",
108
+ value: L,
109
+ onChange: (r) => I(r.target.value),
110
+ placeholder: 'Enter query... e.g., {service="api"} |= "error"',
111
+ onKeyDown: (r) => r.key === "Enter" && f(),
112
+ style: {
113
+ flex: 1,
114
+ padding: "10px 16px",
115
+ borderRadius: "8px",
116
+ border: "1px solid var(--border-color, #444)",
117
+ background: "var(--bg-elevated, #1e1e1e)",
118
+ color: "var(--bg-primary, #fff)",
119
+ fontSize: "13px",
120
+ fontFamily: "monospace"
121
+ }
122
+ }
123
+ ),
124
+ /* @__PURE__ */ e(
125
+ "select",
126
+ {
127
+ value: N,
128
+ onChange: (r) => $(r.target.value),
129
+ style: {
130
+ padding: "10px 12px",
131
+ borderRadius: "8px",
132
+ border: "1px solid var(--border-color, #444)",
133
+ background: "var(--bg-elevated, #1e1e1e)",
134
+ color: "var(--bg-primary, #fff)",
135
+ fontSize: "12px"
136
+ },
137
+ children: te.map((r) => /* @__PURE__ */ e("option", { value: r.value, children: r.label }, r.value))
138
+ }
139
+ ),
140
+ /* @__PURE__ */ t(
141
+ "button",
142
+ {
143
+ onClick: f,
144
+ disabled: u,
145
+ style: {
146
+ padding: "10px 24px",
147
+ borderRadius: "8px",
148
+ border: "none",
149
+ background: "var(--color-primary, #3b82f6)",
150
+ color: "var(--bg-primary, #fff)",
151
+ cursor: u ? "not-allowed" : "pointer",
152
+ fontSize: "13px",
153
+ fontWeight: 500,
154
+ opacity: u ? 0.7 : 1
155
+ },
156
+ children: [
157
+ u ? "âŗ" : "🔍",
158
+ " Search"
159
+ ]
160
+ }
161
+ ),
162
+ /* @__PURE__ */ e(
163
+ "button",
164
+ {
165
+ onClick: () => n(!0),
166
+ style: {
167
+ padding: "10px 12px",
168
+ borderRadius: "8px",
169
+ border: "none",
170
+ background: "var(--bg-tertiary, #333)",
171
+ color: "var(--bg-primary, #fff)",
172
+ cursor: "pointer",
173
+ fontSize: "12px"
174
+ },
175
+ children: "💾"
176
+ }
177
+ ),
178
+ P && /* @__PURE__ */ e(
179
+ "button",
180
+ {
181
+ onClick: R ? Q : P,
182
+ style: {
183
+ padding: "10px 16px",
184
+ borderRadius: "8px",
185
+ border: "none",
186
+ background: R ? "var(--color-success, #22c55e)" : "var(--bg-tertiary, #333)",
187
+ color: "var(--bg-primary, #fff)",
188
+ cursor: "pointer",
189
+ fontSize: "12px"
190
+ },
191
+ children: R ? "⏚ Stop" : "â–ļ Tail"
192
+ }
193
+ )
194
+ ] }),
195
+ /* @__PURE__ */ t("div", { style: { display: "flex", gap: "8px", alignItems: "center" }, children: [
196
+ /* @__PURE__ */ e("span", { style: { fontSize: "11px", color: "var(--text-muted, #888)" }, children: "Levels:" }),
197
+ Object.keys(V).map((r) => {
198
+ const d = V[r], l = h[r], w = B.has(r);
199
+ return /* @__PURE__ */ t(
200
+ "button",
201
+ {
202
+ onClick: () => U(r),
203
+ style: {
204
+ display: "flex",
205
+ alignItems: "center",
206
+ gap: "4px",
207
+ padding: "4px 10px",
208
+ borderRadius: "4px",
209
+ border: "none",
210
+ background: w ? d.bg : "transparent",
211
+ color: w ? d.color : "var(--text-muted, #666)",
212
+ cursor: "pointer",
213
+ fontSize: "11px",
214
+ opacity: w ? 1 : 0.5
215
+ },
216
+ children: [
217
+ r.toUpperCase(),
218
+ " (",
219
+ l,
220
+ ")"
221
+ ]
222
+ },
223
+ r
224
+ );
225
+ }),
226
+ /* @__PURE__ */ e("div", { style: { flex: 1 } }),
227
+ /* @__PURE__ */ e(
228
+ "input",
229
+ {
230
+ type: "text",
231
+ value: x,
232
+ onChange: (r) => k(r.target.value),
233
+ placeholder: "Filter results...",
234
+ style: {
235
+ padding: "4px 8px",
236
+ borderRadius: "4px",
237
+ border: "1px solid var(--border-color, #444)",
238
+ background: "var(--bg-elevated, #1e1e1e)",
239
+ color: "var(--bg-primary, #fff)",
240
+ fontSize: "11px",
241
+ width: "150px"
242
+ }
243
+ }
244
+ )
245
+ ] })
246
+ ]
247
+ }
248
+ ),
249
+ /* @__PURE__ */ t("div", { style: { flex: 1, display: "flex", overflow: "hidden" }, children: [
250
+ /* @__PURE__ */ t(
251
+ "div",
252
+ {
253
+ style: {
254
+ width: "220px",
255
+ borderRight: "1px solid var(--border-color, #333)",
256
+ display: "flex",
257
+ flexDirection: "column",
258
+ overflow: "hidden"
259
+ },
260
+ children: [
261
+ /* @__PURE__ */ t("div", { style: { flex: 1, overflow: "auto", padding: "12px" }, children: [
262
+ /* @__PURE__ */ e(
263
+ "h4",
264
+ {
265
+ style: {
266
+ margin: "0 0 8px 0",
267
+ fontSize: "11px",
268
+ color: "var(--text-muted, #888)",
269
+ textTransform: "uppercase"
270
+ },
271
+ children: "Log Streams"
272
+ }
273
+ ),
274
+ z.map((r) => /* @__PURE__ */ t(
275
+ "label",
276
+ {
277
+ style: {
278
+ display: "flex",
279
+ alignItems: "center",
280
+ gap: "8px",
281
+ padding: "6px 0",
282
+ cursor: "pointer",
283
+ fontSize: "12px"
284
+ },
285
+ children: [
286
+ /* @__PURE__ */ e(
287
+ "input",
288
+ {
289
+ type: "checkbox",
290
+ defaultChecked: !0,
291
+ onChange: (d) => J(r.id, d.target.checked)
292
+ }
293
+ ),
294
+ /* @__PURE__ */ e(
295
+ "span",
296
+ {
297
+ style: {
298
+ width: "8px",
299
+ height: "8px",
300
+ borderRadius: "50%",
301
+ background: r.color
302
+ }
303
+ }
304
+ ),
305
+ /* @__PURE__ */ e("span", { children: r.name })
306
+ ]
307
+ },
308
+ r.id
309
+ )),
310
+ z.length === 0 && /* @__PURE__ */ e("div", { style: { color: "var(--text-muted, #666)", fontSize: "11px" }, children: "No streams discovered" })
311
+ ] }),
312
+ /* @__PURE__ */ t(
313
+ "div",
314
+ {
315
+ style: {
316
+ borderTop: "1px solid var(--border-color, #333)",
317
+ padding: "12px",
318
+ maxHeight: "200px",
319
+ overflow: "auto"
320
+ },
321
+ children: [
322
+ /* @__PURE__ */ e(
323
+ "h4",
324
+ {
325
+ style: {
326
+ margin: "0 0 8px 0",
327
+ fontSize: "11px",
328
+ color: "var(--text-muted, #888)",
329
+ textTransform: "uppercase"
330
+ },
331
+ children: "Saved Queries"
332
+ }
333
+ ),
334
+ A.map((r) => /* @__PURE__ */ t(
335
+ "div",
336
+ {
337
+ style: {
338
+ display: "flex",
339
+ alignItems: "center",
340
+ gap: "8px",
341
+ padding: "6px 8px",
342
+ marginBottom: "4px",
343
+ background: "var(--bg-elevated, #252525)",
344
+ borderRadius: "4px",
345
+ cursor: "pointer",
346
+ fontSize: "11px"
347
+ },
348
+ onClick: () => I(r.query),
349
+ children: [
350
+ /* @__PURE__ */ e(
351
+ "span",
352
+ {
353
+ style: {
354
+ flex: 1,
355
+ overflow: "hidden",
356
+ textOverflow: "ellipsis",
357
+ whiteSpace: "nowrap"
358
+ },
359
+ children: r.name
360
+ }
361
+ ),
362
+ /* @__PURE__ */ e(
363
+ "button",
364
+ {
365
+ onClick: (d) => {
366
+ d.stopPropagation(), H(r.id);
367
+ },
368
+ style: {
369
+ background: "none",
370
+ border: "none",
371
+ color: "var(--text-muted, #666)",
372
+ cursor: "pointer",
373
+ fontSize: "10px"
374
+ },
375
+ children: "✕"
376
+ }
377
+ )
378
+ ]
379
+ },
380
+ r.id
381
+ )),
382
+ A.length === 0 && /* @__PURE__ */ e("div", { style: { color: "var(--text-muted, #666)", fontSize: "11px" }, children: "No saved queries" })
383
+ ]
384
+ }
385
+ )
386
+ ]
387
+ }
388
+ ),
389
+ /* @__PURE__ */ t("div", { style: { flex: 1, display: "flex", flexDirection: "column", overflow: "hidden" }, children: [
390
+ /* @__PURE__ */ t("div", { style: { display: "flex", borderBottom: "1px solid var(--border-color, #333)" }, children: [
391
+ [
392
+ { id: "logs", label: `📜 Logs (${a.length})` },
393
+ { id: "patterns", label: `đŸ”Ŧ Patterns (${b.length})` }
394
+ ].map((r) => /* @__PURE__ */ e(
395
+ "button",
396
+ {
397
+ onClick: () => S(r.id),
398
+ style: {
399
+ padding: "10px 20px",
400
+ border: "none",
401
+ background: c === r.id ? "var(--bg-elevated, #1e1e1e)" : "transparent",
402
+ color: c === r.id ? "var(--bg-primary, #fff)" : "var(--text-muted, #888)",
403
+ cursor: "pointer",
404
+ fontSize: "12px",
405
+ borderBottom: c === r.id ? "2px solid #3b82f6" : "2px solid transparent"
406
+ },
407
+ children: r.label
408
+ },
409
+ r.id
410
+ )),
411
+ /* @__PURE__ */ e("div", { style: { flex: 1 } }),
412
+ /* @__PURE__ */ t("div", { style: { display: "flex", gap: "8px", padding: "8px" }, children: [
413
+ /* @__PURE__ */ e(
414
+ "button",
415
+ {
416
+ onClick: () => C("json"),
417
+ style: {
418
+ padding: "4px 8px",
419
+ borderRadius: "4px",
420
+ border: "none",
421
+ background: "var(--bg-tertiary, #333)",
422
+ color: "var(--bg-primary, #fff)",
423
+ cursor: "pointer",
424
+ fontSize: "10px"
425
+ },
426
+ children: "JSON"
427
+ }
428
+ ),
429
+ /* @__PURE__ */ e(
430
+ "button",
431
+ {
432
+ onClick: () => C("csv"),
433
+ style: {
434
+ padding: "4px 8px",
435
+ borderRadius: "4px",
436
+ border: "none",
437
+ background: "var(--bg-tertiary, #333)",
438
+ color: "var(--bg-primary, #fff)",
439
+ cursor: "pointer",
440
+ fontSize: "10px"
441
+ },
442
+ children: "CSV"
443
+ }
444
+ )
445
+ ] })
446
+ ] }),
447
+ c === "logs" && /* @__PURE__ */ t("div", { style: { flex: 1, overflow: "auto", fontFamily: "monospace", fontSize: "12px" }, children: [
448
+ a.map((r) => {
449
+ const d = V[r.level], l = m.has(r.id);
450
+ return /* @__PURE__ */ t("div", { style: { borderBottom: "1px solid #252525" }, children: [
451
+ /* @__PURE__ */ t(
452
+ "div",
453
+ {
454
+ onClick: () => v(r.id),
455
+ style: {
456
+ display: "flex",
457
+ alignItems: "flex-start",
458
+ gap: "8px",
459
+ padding: "6px 12px",
460
+ cursor: "pointer",
461
+ background: l ? "var(--bg-elevated, #252525)" : "transparent"
462
+ },
463
+ children: [
464
+ /* @__PURE__ */ e(
465
+ "span",
466
+ {
467
+ style: {
468
+ color: "var(--text-muted, #666)",
469
+ fontSize: "10px",
470
+ minWidth: "160px"
471
+ },
472
+ children: new Date(r.timestamp).toISOString()
473
+ }
474
+ ),
475
+ /* @__PURE__ */ e(
476
+ "span",
477
+ {
478
+ style: {
479
+ padding: "2px 6px",
480
+ borderRadius: "4px",
481
+ background: d.bg,
482
+ color: d.color,
483
+ fontSize: "10px",
484
+ fontWeight: 500,
485
+ minWidth: "50px",
486
+ textAlign: "center"
487
+ },
488
+ children: r.level.toUpperCase()
489
+ }
490
+ ),
491
+ r.service && /* @__PURE__ */ t(
492
+ "span",
493
+ {
494
+ style: {
495
+ color: "var(--color-accent, #8b5cf6)",
496
+ fontSize: "10px",
497
+ minWidth: "80px"
498
+ },
499
+ children: [
500
+ "[",
501
+ r.service,
502
+ "]"
503
+ ]
504
+ }
505
+ ),
506
+ /* @__PURE__ */ e(
507
+ "span",
508
+ {
509
+ style: { flex: 1, whiteSpace: "pre-wrap", wordBreak: "break-all" },
510
+ dangerouslySetInnerHTML: { __html: F(r.message) }
511
+ }
512
+ )
513
+ ]
514
+ }
515
+ ),
516
+ l && /* @__PURE__ */ t(
517
+ "div",
518
+ {
519
+ style: {
520
+ padding: "12px 12px 12px 200px",
521
+ background: "var(--bg-elevated, #252525)",
522
+ borderTop: "1px solid var(--border-color, #333)"
523
+ },
524
+ children: [
525
+ /* @__PURE__ */ t(
526
+ "div",
527
+ {
528
+ style: {
529
+ display: "grid",
530
+ gridTemplateColumns: "repeat(3, 1fr)",
531
+ gap: "12px",
532
+ marginBottom: "12px"
533
+ },
534
+ children: [
535
+ /* @__PURE__ */ t("div", { children: [
536
+ /* @__PURE__ */ e(
537
+ "div",
538
+ {
539
+ style: {
540
+ fontSize: "10px",
541
+ color: "var(--text-muted, #888)",
542
+ marginBottom: "2px"
543
+ },
544
+ children: "Source"
545
+ }
546
+ ),
547
+ /* @__PURE__ */ e("div", { style: { fontSize: "11px" }, children: r.source })
548
+ ] }),
549
+ r.host && /* @__PURE__ */ t("div", { children: [
550
+ /* @__PURE__ */ e(
551
+ "div",
552
+ {
553
+ style: {
554
+ fontSize: "10px",
555
+ color: "var(--text-muted, #888)",
556
+ marginBottom: "2px"
557
+ },
558
+ children: "Host"
559
+ }
560
+ ),
561
+ /* @__PURE__ */ e("div", { style: { fontSize: "11px" }, children: r.host })
562
+ ] }),
563
+ r.traceId && /* @__PURE__ */ t("div", { children: [
564
+ /* @__PURE__ */ e(
565
+ "div",
566
+ {
567
+ style: {
568
+ fontSize: "10px",
569
+ color: "var(--text-muted, #888)",
570
+ marginBottom: "2px"
571
+ },
572
+ children: "Trace ID"
573
+ }
574
+ ),
575
+ /* @__PURE__ */ e("div", { style: { fontSize: "11px", fontFamily: "monospace" }, children: r.traceId })
576
+ ] })
577
+ ]
578
+ }
579
+ ),
580
+ Object.keys(r.attributes).length > 0 && /* @__PURE__ */ t("div", { style: { marginBottom: "12px" }, children: [
581
+ /* @__PURE__ */ e(
582
+ "div",
583
+ {
584
+ style: {
585
+ fontSize: "10px",
586
+ color: "var(--text-muted, #888)",
587
+ marginBottom: "4px"
588
+ },
589
+ children: "Attributes"
590
+ }
591
+ ),
592
+ /* @__PURE__ */ e("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: Object.entries(r.attributes).map(([w, re]) => /* @__PURE__ */ t(
593
+ "span",
594
+ {
595
+ style: {
596
+ padding: "2px 8px",
597
+ background: "var(--bg-tertiary, #333)",
598
+ borderRadius: "4px",
599
+ fontSize: "10px"
600
+ },
601
+ children: [
602
+ w,
603
+ "=",
604
+ String(re)
605
+ ]
606
+ },
607
+ w
608
+ )) })
609
+ ] }),
610
+ r.stackTrace && /* @__PURE__ */ t("div", { children: [
611
+ /* @__PURE__ */ e(
612
+ "div",
613
+ {
614
+ style: {
615
+ fontSize: "10px",
616
+ color: "var(--text-muted, #888)",
617
+ marginBottom: "4px"
618
+ },
619
+ children: "Stack Trace"
620
+ }
621
+ ),
622
+ /* @__PURE__ */ e(
623
+ "pre",
624
+ {
625
+ style: {
626
+ margin: 0,
627
+ padding: "8px",
628
+ background: "var(--bg-elevated, #1e1e1e)",
629
+ borderRadius: "4px",
630
+ fontSize: "10px",
631
+ overflow: "auto",
632
+ maxHeight: "200px",
633
+ color: "var(--color-error, #ef4444)"
634
+ },
635
+ children: r.stackTrace
636
+ }
637
+ )
638
+ ] }),
639
+ /* @__PURE__ */ t("div", { style: { marginTop: "12px", display: "flex", gap: "8px" }, children: [
640
+ /* @__PURE__ */ e(
641
+ "button",
642
+ {
643
+ onClick: () => W(r),
644
+ style: {
645
+ padding: "4px 12px",
646
+ borderRadius: "4px",
647
+ border: "none",
648
+ background: "var(--color-primary, #3b82f6)",
649
+ color: "var(--bg-primary, #fff)",
650
+ cursor: "pointer",
651
+ fontSize: "10px"
652
+ },
653
+ children: "View Details"
654
+ }
655
+ ),
656
+ r.traceId && /* @__PURE__ */ e(
657
+ "button",
658
+ {
659
+ onClick: () => I(`{traceId="${r.traceId}"}`),
660
+ style: {
661
+ padding: "4px 12px",
662
+ borderRadius: "4px",
663
+ border: "none",
664
+ background: "var(--bg-tertiary, #333)",
665
+ color: "var(--bg-primary, #fff)",
666
+ cursor: "pointer",
667
+ fontSize: "10px"
668
+ },
669
+ children: "Show Trace"
670
+ }
671
+ )
672
+ ] })
673
+ ]
674
+ }
675
+ )
676
+ ] }, r.id);
677
+ }),
678
+ a.length === 0 && !u && /* @__PURE__ */ t(
679
+ "div",
680
+ {
681
+ style: { padding: "48px", textAlign: "center", color: "var(--text-muted, #666)" },
682
+ children: [
683
+ /* @__PURE__ */ e("span", { style: { fontSize: "48px" }, children: "📭" }),
684
+ /* @__PURE__ */ e("p", { style: { marginTop: "16px" }, children: "No logs match your query" })
685
+ ]
686
+ }
687
+ ),
688
+ u && /* @__PURE__ */ t(
689
+ "div",
690
+ {
691
+ style: { padding: "48px", textAlign: "center", color: "var(--text-muted, #666)" },
692
+ children: [
693
+ /* @__PURE__ */ e("span", { style: { fontSize: "48px" }, children: "âŗ" }),
694
+ /* @__PURE__ */ e("p", { style: { marginTop: "16px" }, children: "Loading logs..." })
695
+ ]
696
+ }
697
+ )
698
+ ] }),
699
+ c === "patterns" && /* @__PURE__ */ t("div", { style: { flex: 1, overflow: "auto", padding: "16px" }, children: [
700
+ b.map((r) => {
701
+ const d = V[r.level];
702
+ return /* @__PURE__ */ t(
703
+ "div",
704
+ {
705
+ style: {
706
+ marginBottom: "12px",
707
+ padding: "16px",
708
+ background: "var(--bg-elevated, #252525)",
709
+ borderRadius: "8px",
710
+ borderLeft: `3px solid ${d.color}`
711
+ },
712
+ children: [
713
+ /* @__PURE__ */ t(
714
+ "div",
715
+ {
716
+ style: {
717
+ display: "flex",
718
+ justifyContent: "space-between",
719
+ alignItems: "center",
720
+ marginBottom: "8px"
721
+ },
722
+ children: [
723
+ /* @__PURE__ */ e("span", { style: { fontFamily: "monospace", fontSize: "12px", fontWeight: 500 }, children: r.pattern }),
724
+ /* @__PURE__ */ t(
725
+ "span",
726
+ {
727
+ style: {
728
+ padding: "2px 8px",
729
+ background: "var(--bg-tertiary, #333)",
730
+ borderRadius: "4px",
731
+ fontSize: "11px"
732
+ },
733
+ children: [
734
+ r.count,
735
+ " occurrences"
736
+ ]
737
+ }
738
+ )
739
+ ]
740
+ }
741
+ ),
742
+ /* @__PURE__ */ t("div", { style: { fontSize: "11px", color: "var(--text-muted, #888)" }, children: [
743
+ "Sample: ",
744
+ r.samples[0]
745
+ ] })
746
+ ]
747
+ },
748
+ r.id
749
+ );
750
+ }),
751
+ b.length === 0 && /* @__PURE__ */ e(
752
+ "div",
753
+ {
754
+ style: { padding: "48px", textAlign: "center", color: "var(--text-muted, #666)" },
755
+ children: /* @__PURE__ */ e("p", { children: "No patterns detected. Run a query first." })
756
+ }
757
+ )
758
+ ] })
759
+ ] })
760
+ ] }),
761
+ o && /* @__PURE__ */ e(
762
+ "div",
763
+ {
764
+ style: {
765
+ position: "fixed",
766
+ inset: 0,
767
+ background: "rgba(0,0,0,0.7)",
768
+ display: "flex",
769
+ alignItems: "center",
770
+ justifyContent: "center",
771
+ zIndex: 1e3
772
+ },
773
+ children: /* @__PURE__ */ t(
774
+ "div",
775
+ {
776
+ style: {
777
+ width: "400px",
778
+ background: "var(--bg-elevated, #252525)",
779
+ borderRadius: "12px",
780
+ padding: "24px"
781
+ },
782
+ children: [
783
+ /* @__PURE__ */ e("h3", { style: { margin: "0 0 16px 0", fontSize: "14px" }, children: "Save Query" }),
784
+ /* @__PURE__ */ e(
785
+ "input",
786
+ {
787
+ type: "text",
788
+ value: i,
789
+ onChange: (r) => g(r.target.value),
790
+ placeholder: "Query name...",
791
+ style: {
792
+ width: "100%",
793
+ padding: "10px",
794
+ borderRadius: "8px",
795
+ border: "1px solid var(--border-color, #444)",
796
+ background: "var(--bg-elevated, #1e1e1e)",
797
+ color: "var(--bg-primary, #fff)",
798
+ fontSize: "13px",
799
+ marginBottom: "16px"
800
+ }
801
+ }
802
+ ),
803
+ /* @__PURE__ */ t("div", { style: { display: "flex", justifyContent: "flex-end", gap: "8px" }, children: [
804
+ /* @__PURE__ */ e(
805
+ "button",
806
+ {
807
+ onClick: () => n(!1),
808
+ style: {
809
+ padding: "8px 16px",
810
+ borderRadius: "6px",
811
+ border: "none",
812
+ background: "var(--bg-tertiary, #333)",
813
+ color: "var(--bg-primary, #fff)",
814
+ cursor: "pointer"
815
+ },
816
+ children: "Cancel"
817
+ }
818
+ ),
819
+ /* @__PURE__ */ e(
820
+ "button",
821
+ {
822
+ onClick: E,
823
+ style: {
824
+ padding: "8px 16px",
825
+ borderRadius: "6px",
826
+ border: "none",
827
+ background: "var(--color-primary, #3b82f6)",
828
+ color: "var(--bg-primary, #fff)",
829
+ cursor: "pointer"
830
+ },
831
+ children: "Save"
832
+ }
833
+ )
834
+ ] })
835
+ ]
836
+ }
837
+ )
838
+ }
839
+ )
840
+ ]
841
+ }
842
+ );
843
+ }, oe = {
844
+ critical: { color: "var(--color-error, #ef4444)", icon: "🔴" },
845
+ warning: { color: "var(--color-warning, #f59e0b)", icon: "🟡" },
846
+ info: { color: "var(--color-primary, #3b82f6)", icon: "đŸ”ĩ" }
847
+ }, ne = [
848
+ { from: "now-5m", to: "now", display: "Last 5 minutes" },
849
+ { from: "now-15m", to: "now", display: "Last 15 minutes" },
850
+ { from: "now-1h", to: "now", display: "Last 1 hour" },
851
+ { from: "now-3h", to: "now", display: "Last 3 hours" },
852
+ { from: "now-6h", to: "now", display: "Last 6 hours" },
853
+ { from: "now-12h", to: "now", display: "Last 12 hours" },
854
+ { from: "now-24h", to: "now", display: "Last 24 hours" },
855
+ { from: "now-7d", to: "now", display: "Last 7 days" },
856
+ { from: "now-30d", to: "now", display: "Last 30 days" }
857
+ ], le = ({
858
+ dashboard: p,
859
+ metrics: z,
860
+ alerts: T = [],
861
+ timeRanges: u = ne,
862
+ onTimeRangeChange: A,
863
+ onVariableChange: b,
864
+ onPanelEdit: O,
865
+ onPanelAdd: _,
866
+ onPanelRemove: H,
867
+ onPanelMove: J,
868
+ onAlertAcknowledge: W,
869
+ onAlertSilence: C,
870
+ onQueryExecute: P,
871
+ onDashboardSave: Q,
872
+ onRefresh: R,
873
+ isEditing: y = !1,
874
+ onEditModeToggle: j,
875
+ className: q,
876
+ style: L,
877
+ "data-testid": I
878
+ }) => {
879
+ const [N, $] = s(!1), [G, ee] = s(!0), [B, K] = s(null), m = T.filter((o) => o.status === "firing"), M = (o) => {
880
+ var i, g, c;
881
+ const n = (i = o.queries[0]) != null && i.expression ? z[o.queries[0].expression] : null;
882
+ switch (o.type) {
883
+ case "stat":
884
+ return /* @__PURE__ */ t(
885
+ "div",
886
+ {
887
+ style: {
888
+ display: "flex",
889
+ alignItems: "center",
890
+ justifyContent: "center",
891
+ height: "100%",
892
+ flexDirection: "column"
893
+ },
894
+ children: [
895
+ /* @__PURE__ */ e(
896
+ "div",
897
+ {
898
+ style: {
899
+ fontSize: "48px",
900
+ fontWeight: 600,
901
+ color: n ? D(n.currentValue, o.thresholds) : "var(--text-primary, #e0e0e0)"
902
+ },
903
+ children: (n == null ? void 0 : n.currentValue.toFixed(2)) ?? "-"
904
+ }
905
+ ),
906
+ (n == null ? void 0 : n.unit) && /* @__PURE__ */ e("div", { style: { fontSize: "14px", color: "var(--text-muted, #888)", marginTop: "4px" }, children: n.unit })
907
+ ]
908
+ }
909
+ );
910
+ case "gauge":
911
+ const S = (n == null ? void 0 : n.currentValue) ?? 0, x = ((c = (g = o.thresholds) == null ? void 0 : g[o.thresholds.length - 1]) == null ? void 0 : c.value) ?? 100, k = Math.min(S / x * 100, 100);
912
+ return /* @__PURE__ */ e(
913
+ "div",
914
+ {
915
+ style: {
916
+ display: "flex",
917
+ flexDirection: "column",
918
+ alignItems: "center",
919
+ justifyContent: "center",
920
+ height: "100%"
921
+ },
922
+ children: /* @__PURE__ */ t("svg", { viewBox: "0 0 100 60", style: { width: "100%", maxWidth: "200px" }, children: [
923
+ /* @__PURE__ */ e("path", { d: "M 10 50 A 40 40 0 0 1 90 50", fill: "none", stroke: "#333", strokeWidth: "8" }),
924
+ /* @__PURE__ */ e(
925
+ "path",
926
+ {
927
+ d: "M 10 50 A 40 40 0 0 1 90 50",
928
+ fill: "none",
929
+ stroke: D(S, o.thresholds),
930
+ strokeWidth: "8",
931
+ strokeDasharray: `${k * 1.26} 126`
932
+ }
933
+ ),
934
+ /* @__PURE__ */ e("text", { x: "50", y: "45", textAnchor: "middle", fill: "#e0e0e0", fontSize: "16", fontWeight: "600", children: S.toFixed(1) })
935
+ ] })
936
+ }
937
+ );
938
+ case "timeseries":
939
+ return Y(o, n);
940
+ case "table":
941
+ return /* @__PURE__ */ e("div", { style: { overflow: "auto", height: "100%" }, children: /* @__PURE__ */ t("table", { style: { width: "100%", fontSize: "11px", borderCollapse: "collapse" }, children: [
942
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ t("tr", { style: { background: "var(--bg-elevated, #252525)" }, children: [
943
+ /* @__PURE__ */ e(
944
+ "th",
945
+ {
946
+ style: {
947
+ padding: "6px 8px",
948
+ textAlign: "left",
949
+ borderBottom: "1px solid var(--border-color, #333)"
950
+ },
951
+ children: "Time"
952
+ }
953
+ ),
954
+ /* @__PURE__ */ e(
955
+ "th",
956
+ {
957
+ style: {
958
+ padding: "6px 8px",
959
+ textAlign: "right",
960
+ borderBottom: "1px solid var(--border-color, #333)"
961
+ },
962
+ children: "Value"
963
+ }
964
+ )
965
+ ] }) }),
966
+ /* @__PURE__ */ e("tbody", { children: n == null ? void 0 : n.values.slice(-10).reverse().map((a, h) => /* @__PURE__ */ t("tr", { children: [
967
+ /* @__PURE__ */ e(
968
+ "td",
969
+ {
970
+ style: {
971
+ padding: "4px 8px",
972
+ borderBottom: "1px solid var(--border-color, #333)"
973
+ },
974
+ children: new Date(a.timestamp).toLocaleTimeString()
975
+ }
976
+ ),
977
+ /* @__PURE__ */ t(
978
+ "td",
979
+ {
980
+ style: {
981
+ padding: "4px 8px",
982
+ borderBottom: "1px solid var(--border-color, #333)",
983
+ textAlign: "right"
984
+ },
985
+ children: [
986
+ a.value.toFixed(2),
987
+ " ",
988
+ n.unit
989
+ ]
990
+ }
991
+ )
992
+ ] }, h)) })
993
+ ] }) });
994
+ case "bar_gauge":
995
+ return /* @__PURE__ */ e(
996
+ "div",
997
+ {
998
+ style: {
999
+ padding: "8px",
1000
+ height: "100%",
1001
+ display: "flex",
1002
+ flexDirection: "column",
1003
+ justifyContent: "center"
1004
+ },
1005
+ children: o.queries.map((a, h) => {
1006
+ var E, F;
1007
+ const f = z[a.expression], v = (f == null ? void 0 : f.currentValue) ?? 0, U = ((F = (E = o.thresholds) == null ? void 0 : E[o.thresholds.length - 1]) == null ? void 0 : F.value) ?? 100;
1008
+ return /* @__PURE__ */ t("div", { style: { marginBottom: "8px" }, children: [
1009
+ /* @__PURE__ */ t(
1010
+ "div",
1011
+ {
1012
+ style: {
1013
+ display: "flex",
1014
+ justifyContent: "space-between",
1015
+ fontSize: "11px",
1016
+ marginBottom: "4px"
1017
+ },
1018
+ children: [
1019
+ /* @__PURE__ */ e("span", { children: a.legendFormat ?? a.expression }),
1020
+ /* @__PURE__ */ e("span", { children: v.toFixed(1) })
1021
+ ]
1022
+ }
1023
+ ),
1024
+ /* @__PURE__ */ e(
1025
+ "div",
1026
+ {
1027
+ style: {
1028
+ height: "16px",
1029
+ background: "var(--bg-tertiary, #333)",
1030
+ borderRadius: "4px",
1031
+ overflow: "hidden"
1032
+ },
1033
+ children: /* @__PURE__ */ e(
1034
+ "div",
1035
+ {
1036
+ style: {
1037
+ height: "100%",
1038
+ width: `${v / U * 100}%`,
1039
+ background: D(v, o.thresholds),
1040
+ borderRadius: "4px"
1041
+ }
1042
+ }
1043
+ )
1044
+ }
1045
+ )
1046
+ ] }, h);
1047
+ })
1048
+ }
1049
+ );
1050
+ case "text":
1051
+ return /* @__PURE__ */ e("div", { style: { padding: "12px", fontSize: "12px", lineHeight: "1.6" }, children: o.description });
1052
+ default:
1053
+ return /* @__PURE__ */ e("div", { style: { padding: "12px", color: "var(--text-muted, #666)" }, children: "Unsupported panel type" });
1054
+ }
1055
+ }, Y = (o, n) => {
1056
+ const i = (n == null ? void 0 : n.values) ?? [];
1057
+ if (i.length === 0)
1058
+ return /* @__PURE__ */ e(
1059
+ "div",
1060
+ {
1061
+ style: {
1062
+ display: "flex",
1063
+ alignItems: "center",
1064
+ justifyContent: "center",
1065
+ height: "100%",
1066
+ color: "var(--text-muted, #666)"
1067
+ },
1068
+ children: "No data"
1069
+ }
1070
+ );
1071
+ const g = i.map((a) => a.value), c = Math.min(...g), x = Math.max(...g) - c || 1, k = i.map((a, h) => {
1072
+ const f = h / (i.length - 1) * 100, v = 100 - (a.value - c) / x * 80;
1073
+ return `${f},${v}`;
1074
+ }).join(" ");
1075
+ return /* @__PURE__ */ t(
1076
+ "svg",
1077
+ {
1078
+ viewBox: "0 0 100 100",
1079
+ preserveAspectRatio: "none",
1080
+ style: { width: "100%", height: "100%" },
1081
+ children: [
1082
+ [0, 25, 50, 75, 100].map((a) => /* @__PURE__ */ e("line", { x1: "0", y1: a, x2: "100", y2: a, stroke: "#333", strokeWidth: "0.5" }, a)),
1083
+ o.chartType === "area" || o.chartType === "stacked_area" ? /* @__PURE__ */ e("polygon", { points: `0,100 ${k} 100,100`, fill: "rgba(59, 130, 246, 0.2)" }) : null,
1084
+ /* @__PURE__ */ e("polyline", { points: k, fill: "none", stroke: "#3b82f6", strokeWidth: "1" })
1085
+ ]
1086
+ }
1087
+ );
1088
+ }, D = (o, n) => {
1089
+ if (!n || n.length === 0)
1090
+ return "var(--color-primary, #3b82f6)";
1091
+ for (let i = n.length - 1; i >= 0; i--)
1092
+ if (o >= n[i].value)
1093
+ return n[i].color;
1094
+ return "var(--color-success, #22c55e)";
1095
+ };
1096
+ return /* @__PURE__ */ t(
1097
+ "div",
1098
+ {
1099
+ className: `nice-metrics-dashboard ${q || ""}`,
1100
+ style: {
1101
+ display: "flex",
1102
+ flexDirection: "column",
1103
+ height: "100%",
1104
+ background: "var(--bg-elevated, #1e1e1e)",
1105
+ color: "var(--text-primary, #e0e0e0)",
1106
+ ...L
1107
+ },
1108
+ "data-testid": I,
1109
+ children: [
1110
+ /* @__PURE__ */ t(
1111
+ "div",
1112
+ {
1113
+ style: {
1114
+ display: "flex",
1115
+ alignItems: "center",
1116
+ gap: "12px",
1117
+ padding: "12px 16px",
1118
+ borderBottom: "1px solid var(--border-color, #333)",
1119
+ background: "var(--bg-elevated, #252525)"
1120
+ },
1121
+ children: [
1122
+ /* @__PURE__ */ e("span", { style: { fontSize: "20px" }, children: "📊" }),
1123
+ /* @__PURE__ */ e("span", { style: { fontWeight: 500, fontSize: "14px" }, children: p.name }),
1124
+ /* @__PURE__ */ e("div", { style: { flex: 1 } }),
1125
+ m.length > 0 && /* @__PURE__ */ t(
1126
+ "button",
1127
+ {
1128
+ onClick: () => $(!0),
1129
+ style: {
1130
+ display: "flex",
1131
+ alignItems: "center",
1132
+ gap: "6px",
1133
+ padding: "6px 12px",
1134
+ borderRadius: "4px",
1135
+ border: "none",
1136
+ background: "#ef444422",
1137
+ color: "var(--color-error, #ef4444)",
1138
+ cursor: "pointer",
1139
+ fontSize: "12px"
1140
+ },
1141
+ children: [
1142
+ "🔴 ",
1143
+ m.length,
1144
+ " Alert",
1145
+ m.length !== 1 && "s"
1146
+ ]
1147
+ }
1148
+ ),
1149
+ /* @__PURE__ */ e(
1150
+ "select",
1151
+ {
1152
+ value: p.timeRange.display,
1153
+ onChange: (o) => {
1154
+ const n = u.find((i) => i.display === o.target.value);
1155
+ n && A(n);
1156
+ },
1157
+ style: {
1158
+ padding: "6px 12px",
1159
+ borderRadius: "4px",
1160
+ border: "1px solid var(--border-color, #444)",
1161
+ background: "var(--bg-elevated, #1e1e1e)",
1162
+ color: "var(--bg-primary, #fff)",
1163
+ fontSize: "12px"
1164
+ },
1165
+ children: u.map((o) => /* @__PURE__ */ e("option", { value: o.display, children: o.display }, o.display))
1166
+ }
1167
+ ),
1168
+ /* @__PURE__ */ e(
1169
+ "button",
1170
+ {
1171
+ onClick: R,
1172
+ style: {
1173
+ padding: "6px 12px",
1174
+ borderRadius: "4px",
1175
+ border: "none",
1176
+ background: "var(--bg-tertiary, #333)",
1177
+ color: "var(--bg-primary, #fff)",
1178
+ cursor: "pointer",
1179
+ fontSize: "12px"
1180
+ },
1181
+ children: "🔄 Refresh"
1182
+ }
1183
+ ),
1184
+ y ? /* @__PURE__ */ t(X, { children: [
1185
+ /* @__PURE__ */ e(
1186
+ "button",
1187
+ {
1188
+ onClick: _,
1189
+ style: {
1190
+ padding: "6px 12px",
1191
+ borderRadius: "4px",
1192
+ border: "none",
1193
+ background: "var(--color-primary, #3b82f6)",
1194
+ color: "var(--bg-primary, #fff)",
1195
+ cursor: "pointer",
1196
+ fontSize: "12px"
1197
+ },
1198
+ children: "+ Add Panel"
1199
+ }
1200
+ ),
1201
+ /* @__PURE__ */ e(
1202
+ "button",
1203
+ {
1204
+ onClick: Q,
1205
+ style: {
1206
+ padding: "6px 12px",
1207
+ borderRadius: "4px",
1208
+ border: "none",
1209
+ background: "var(--color-success, #22c55e)",
1210
+ color: "var(--bg-primary, #fff)",
1211
+ cursor: "pointer",
1212
+ fontSize: "12px"
1213
+ },
1214
+ children: "💾 Save"
1215
+ }
1216
+ )
1217
+ ] }) : null,
1218
+ j && /* @__PURE__ */ e(
1219
+ "button",
1220
+ {
1221
+ onClick: j,
1222
+ style: {
1223
+ padding: "6px 12px",
1224
+ borderRadius: "4px",
1225
+ border: "none",
1226
+ background: y ? "var(--color-warning, #f59e0b)" : "var(--bg-tertiary, #333)",
1227
+ color: "var(--bg-primary, #fff)",
1228
+ cursor: "pointer",
1229
+ fontSize: "12px"
1230
+ },
1231
+ children: y ? "✓ Done" : "âœī¸ Edit"
1232
+ }
1233
+ )
1234
+ ]
1235
+ }
1236
+ ),
1237
+ p.variables.length > 0 && G && /* @__PURE__ */ e(
1238
+ "div",
1239
+ {
1240
+ style: {
1241
+ display: "flex",
1242
+ flexWrap: "wrap",
1243
+ gap: "12px",
1244
+ padding: "12px 16px",
1245
+ borderBottom: "1px solid var(--border-color, #333)",
1246
+ background: "var(--bg-elevated, #252525)"
1247
+ },
1248
+ children: p.variables.map((o) => {
1249
+ var n;
1250
+ return /* @__PURE__ */ t("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
1251
+ /* @__PURE__ */ t("label", { style: { fontSize: "11px", color: "var(--text-muted, #888)" }, children: [
1252
+ o.label,
1253
+ ":"
1254
+ ] }),
1255
+ o.type === "textbox" ? /* @__PURE__ */ e(
1256
+ "input",
1257
+ {
1258
+ type: "text",
1259
+ value: o.current,
1260
+ onChange: (i) => b(o.id, i.target.value),
1261
+ style: {
1262
+ padding: "4px 8px",
1263
+ borderRadius: "4px",
1264
+ border: "1px solid var(--border-color, #444)",
1265
+ background: "var(--bg-elevated, #1e1e1e)",
1266
+ color: "var(--bg-primary, #fff)",
1267
+ fontSize: "11px",
1268
+ width: "120px"
1269
+ }
1270
+ }
1271
+ ) : /* @__PURE__ */ e(
1272
+ "select",
1273
+ {
1274
+ value: o.current,
1275
+ onChange: (i) => b(o.id, i.target.value),
1276
+ style: {
1277
+ padding: "4px 8px",
1278
+ borderRadius: "4px",
1279
+ border: "1px solid var(--border-color, #444)",
1280
+ background: "var(--bg-elevated, #1e1e1e)",
1281
+ color: "var(--bg-primary, #fff)",
1282
+ fontSize: "11px"
1283
+ },
1284
+ children: (n = o.options) == null ? void 0 : n.map((i) => /* @__PURE__ */ e("option", { value: i, children: i }, i))
1285
+ }
1286
+ )
1287
+ ] }, o.id);
1288
+ })
1289
+ }
1290
+ ),
1291
+ /* @__PURE__ */ e("div", { style: { flex: 1, overflow: "auto", padding: "16px" }, children: /* @__PURE__ */ e(
1292
+ "div",
1293
+ {
1294
+ style: {
1295
+ display: "grid",
1296
+ gridTemplateColumns: "repeat(12, 1fr)",
1297
+ gridAutoRows: "minmax(100px, auto)",
1298
+ gap: "16px"
1299
+ },
1300
+ children: p.panels.map((o) => /* @__PURE__ */ t(
1301
+ "div",
1302
+ {
1303
+ style: {
1304
+ gridColumn: `span ${o.position.w}`,
1305
+ gridRow: `span ${o.position.h}`,
1306
+ background: "var(--bg-elevated, #252525)",
1307
+ borderRadius: "8px",
1308
+ overflow: "hidden",
1309
+ border: B === o.id ? "2px solid #3b82f6" : "1px solid var(--border-color, #333)"
1310
+ },
1311
+ children: [
1312
+ /* @__PURE__ */ t(
1313
+ "div",
1314
+ {
1315
+ style: {
1316
+ display: "flex",
1317
+ alignItems: "center",
1318
+ padding: "8px 12px",
1319
+ borderBottom: "1px solid var(--border-color, #333)",
1320
+ background: "var(--bg-elevated, #1e1e1e)"
1321
+ },
1322
+ children: [
1323
+ /* @__PURE__ */ e("span", { style: { flex: 1, fontSize: "12px", fontWeight: 500 }, children: o.title }),
1324
+ y && /* @__PURE__ */ t(X, { children: [
1325
+ /* @__PURE__ */ e(
1326
+ "button",
1327
+ {
1328
+ onClick: () => O(o),
1329
+ style: {
1330
+ padding: "2px 6px",
1331
+ marginLeft: "4px",
1332
+ borderRadius: "4px",
1333
+ border: "none",
1334
+ background: "var(--bg-tertiary, #333)",
1335
+ color: "var(--text-muted, #888)",
1336
+ cursor: "pointer",
1337
+ fontSize: "10px"
1338
+ },
1339
+ children: "âœī¸"
1340
+ }
1341
+ ),
1342
+ /* @__PURE__ */ e(
1343
+ "button",
1344
+ {
1345
+ onClick: () => H(o.id),
1346
+ style: {
1347
+ padding: "2px 6px",
1348
+ marginLeft: "4px",
1349
+ borderRadius: "4px",
1350
+ border: "none",
1351
+ background: "var(--color-error, #ef4444)",
1352
+ color: "var(--bg-primary, #fff)",
1353
+ cursor: "pointer",
1354
+ fontSize: "10px"
1355
+ },
1356
+ children: "✕"
1357
+ }
1358
+ )
1359
+ ] })
1360
+ ]
1361
+ }
1362
+ ),
1363
+ /* @__PURE__ */ e("div", { style: { height: "calc(100% - 40px)" }, children: M(o) })
1364
+ ]
1365
+ },
1366
+ o.id
1367
+ ))
1368
+ }
1369
+ ) }),
1370
+ N && /* @__PURE__ */ e(
1371
+ "div",
1372
+ {
1373
+ style: {
1374
+ position: "fixed",
1375
+ inset: 0,
1376
+ background: "rgba(0,0,0,0.7)",
1377
+ display: "flex",
1378
+ alignItems: "center",
1379
+ justifyContent: "center",
1380
+ zIndex: 1e3
1381
+ },
1382
+ children: /* @__PURE__ */ t(
1383
+ "div",
1384
+ {
1385
+ style: {
1386
+ width: "600px",
1387
+ maxHeight: "80vh",
1388
+ background: "var(--bg-elevated, #252525)",
1389
+ borderRadius: "12px",
1390
+ overflow: "hidden"
1391
+ },
1392
+ children: [
1393
+ /* @__PURE__ */ t(
1394
+ "div",
1395
+ {
1396
+ style: {
1397
+ display: "flex",
1398
+ justifyContent: "space-between",
1399
+ alignItems: "center",
1400
+ padding: "16px",
1401
+ borderBottom: "1px solid var(--border-color, #333)"
1402
+ },
1403
+ children: [
1404
+ /* @__PURE__ */ t("span", { style: { fontWeight: 600 }, children: [
1405
+ "Active Alerts (",
1406
+ m.length,
1407
+ ")"
1408
+ ] }),
1409
+ /* @__PURE__ */ e(
1410
+ "button",
1411
+ {
1412
+ onClick: () => $(!1),
1413
+ style: {
1414
+ background: "none",
1415
+ border: "none",
1416
+ color: "var(--text-muted, #888)",
1417
+ cursor: "pointer",
1418
+ fontSize: "18px"
1419
+ },
1420
+ children: "✕"
1421
+ }
1422
+ )
1423
+ ]
1424
+ }
1425
+ ),
1426
+ /* @__PURE__ */ t("div", { style: { maxHeight: "60vh", overflow: "auto" }, children: [
1427
+ T.map((o) => {
1428
+ const n = oe[o.severity];
1429
+ return /* @__PURE__ */ t(
1430
+ "div",
1431
+ {
1432
+ style: {
1433
+ padding: "16px",
1434
+ borderBottom: "1px solid var(--border-color, #333)",
1435
+ borderLeft: `4px solid ${n.color}`
1436
+ },
1437
+ children: [
1438
+ /* @__PURE__ */ t(
1439
+ "div",
1440
+ {
1441
+ style: {
1442
+ display: "flex",
1443
+ alignItems: "center",
1444
+ gap: "8px",
1445
+ marginBottom: "8px"
1446
+ },
1447
+ children: [
1448
+ /* @__PURE__ */ e("span", { children: n.icon }),
1449
+ /* @__PURE__ */ e("span", { style: { fontWeight: 500 }, children: o.name }),
1450
+ /* @__PURE__ */ e(
1451
+ "span",
1452
+ {
1453
+ style: {
1454
+ marginLeft: "auto",
1455
+ padding: "2px 8px",
1456
+ borderRadius: "4px",
1457
+ background: o.status === "firing" ? "#ef444422" : "#22c55e22",
1458
+ color: o.status === "firing" ? "var(--color-error, #ef4444)" : "var(--color-success, #22c55e)",
1459
+ fontSize: "10px"
1460
+ },
1461
+ children: o.status
1462
+ }
1463
+ )
1464
+ ]
1465
+ }
1466
+ ),
1467
+ /* @__PURE__ */ e(
1468
+ "p",
1469
+ {
1470
+ style: {
1471
+ margin: "0 0 8px 0",
1472
+ fontSize: "12px",
1473
+ color: "var(--text-muted, #888)"
1474
+ },
1475
+ children: o.message
1476
+ }
1477
+ ),
1478
+ /* @__PURE__ */ t(
1479
+ "div",
1480
+ {
1481
+ style: {
1482
+ display: "flex",
1483
+ gap: "8px",
1484
+ fontSize: "11px",
1485
+ color: "var(--text-muted, #666)"
1486
+ },
1487
+ children: [
1488
+ /* @__PURE__ */ t("span", { children: [
1489
+ "Value: ",
1490
+ o.value
1491
+ ] }),
1492
+ /* @__PURE__ */ e("span", { children: "â€ĸ" }),
1493
+ /* @__PURE__ */ t("span", { children: [
1494
+ "Threshold: ",
1495
+ o.threshold
1496
+ ] }),
1497
+ /* @__PURE__ */ e("span", { children: "â€ĸ" }),
1498
+ /* @__PURE__ */ e("span", { children: new Date(o.startsAt).toLocaleString() })
1499
+ ]
1500
+ }
1501
+ ),
1502
+ o.status === "firing" && W && /* @__PURE__ */ t("div", { style: { marginTop: "12px", display: "flex", gap: "8px" }, children: [
1503
+ /* @__PURE__ */ e(
1504
+ "button",
1505
+ {
1506
+ onClick: () => W(o.id),
1507
+ style: {
1508
+ padding: "4px 12px",
1509
+ borderRadius: "4px",
1510
+ border: "none",
1511
+ background: "var(--color-primary, #3b82f6)",
1512
+ color: "var(--bg-primary, #fff)",
1513
+ cursor: "pointer",
1514
+ fontSize: "11px"
1515
+ },
1516
+ children: "Acknowledge"
1517
+ }
1518
+ ),
1519
+ C && /* @__PURE__ */ e(
1520
+ "button",
1521
+ {
1522
+ onClick: () => C(o.id, 36e5),
1523
+ style: {
1524
+ padding: "4px 12px",
1525
+ borderRadius: "4px",
1526
+ border: "none",
1527
+ background: "var(--bg-tertiary, #333)",
1528
+ color: "var(--bg-primary, #fff)",
1529
+ cursor: "pointer",
1530
+ fontSize: "11px"
1531
+ },
1532
+ children: "Silence 1h"
1533
+ }
1534
+ )
1535
+ ] })
1536
+ ]
1537
+ },
1538
+ o.id
1539
+ );
1540
+ }),
1541
+ T.length === 0 && /* @__PURE__ */ e(
1542
+ "div",
1543
+ {
1544
+ style: { padding: "24px", textAlign: "center", color: "var(--text-muted, #666)" },
1545
+ children: "No alerts"
1546
+ }
1547
+ )
1548
+ ] })
1549
+ ]
1550
+ }
1551
+ )
1552
+ }
1553
+ )
1554
+ ]
1555
+ }
1556
+ );
1557
+ };
1558
+ export {
1559
+ ae as NiceLogExplorer,
1560
+ le as NiceMetricsDashboard
1561
+ };