@vitalens/panel 0.0.0-stage → 0.1.1

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 ADDED
@@ -0,0 +1,1266 @@
1
+ import { computed as T, shallowRef as lt, ref as D, watch as j, onBeforeUnmount as xe, defineComponent as it, onMounted as ut, nextTick as ct, onErrorCaptured as pt, openBlock as p, createElementBlock as f, createElementVNode as s, toDisplayString as h, Fragment as U, normalizeClass as B, unref as F, createTextVNode as Me, createCommentVNode as W, createStaticVNode as ft, renderList as H, withDirectives as dt, vModelText as _t } from "vue";
2
+ import { LineChart as mt } from "echarts/charts";
3
+ import { GridComponent as vt, TooltipComponent as ht, LegendComponent as yt } from "echarts/components";
4
+ import { use as bt, init as gt } from "echarts/core";
5
+ import { CanvasRenderer as kt } from "echarts/renderers";
6
+ const Ne = 60 * 1e3, Pe = 60 * Ne, Tt = 2 * Pe, wt = 1e3, Ct = 5, Rt = /* @__PURE__ */ new Set([
7
+ "error",
8
+ "request",
9
+ "longTask",
10
+ "event",
11
+ "exposure"
12
+ ]);
13
+ function Z(a, o) {
14
+ var b;
15
+ const r = a.filter((C) => Number.isFinite(C)).sort((C, I) => C - I);
16
+ if (r.length === 0) return null;
17
+ const l = Math.min(r.length - 1, Math.max(0, Math.ceil(r.length * o) - 1));
18
+ return (b = r[l]) != null ? b : null;
19
+ }
20
+ function St() {
21
+ return {
22
+ vital: 0,
23
+ error: 0,
24
+ request: 0,
25
+ route: 0,
26
+ resource: 0,
27
+ longTask: 0,
28
+ event: 0,
29
+ exposure: 0
30
+ };
31
+ }
32
+ function ue(a) {
33
+ return a < 10 ? `0${a}` : String(a);
34
+ }
35
+ function Lt(a, o) {
36
+ const r = new Date(a), l = ue(r.getMonth() + 1), b = ue(r.getDate()), C = ue(r.getHours());
37
+ return o === "hour" ? `${l}-${b} ${C}:00` : `${C}:${ue(r.getMinutes())}`;
38
+ }
39
+ function $t(a) {
40
+ let o = Number.POSITIVE_INFINITY, r = Number.NEGATIVE_INFINITY;
41
+ for (const l of a)
42
+ Number.isFinite(l.timestamp) && (l.timestamp < o && (o = l.timestamp), l.timestamp > r && (r = l.timestamp));
43
+ return !Number.isFinite(o) || !Number.isFinite(r) ? "minute" : r - o >= Tt ? "hour" : "minute";
44
+ }
45
+ function ve(a, o) {
46
+ return Array.from(a, ([r, l]) => {
47
+ const b = {
48
+ key: r,
49
+ label: l.label,
50
+ count: l.count
51
+ };
52
+ return l.totalDuration > 0 && l.count > 0 && (b.avgDurationMs = l.totalDuration / l.count), b;
53
+ }).sort((r, l) => l.count - r.count || r.label.localeCompare(l.label)).slice(0, o);
54
+ }
55
+ function he(a) {
56
+ return a.type !== "error" ? 1 : a.count && a.count > 0 ? a.count : 1;
57
+ }
58
+ function Mt(a) {
59
+ var P;
60
+ const o = Math.max(1, Math.trunc((P = a.topLimit) != null ? P : Ct)), r = T(() => {
61
+ const v = St(), _ = {
62
+ LCP: [],
63
+ INP: [],
64
+ CLS: [],
65
+ FCP: [],
66
+ TTFB: []
67
+ };
68
+ let d = 0, y = 0, g = 0, m = 0;
69
+ for (const w of a.records())
70
+ switch (v[w.type] += 1, m += 1, w.type) {
71
+ case "vital":
72
+ _[w.name].push(w.value);
73
+ break;
74
+ case "error":
75
+ d += he(w);
76
+ break;
77
+ case "request":
78
+ w.durationMs > wt && (y += 1);
79
+ break;
80
+ case "longTask":
81
+ g += 1;
82
+ break;
83
+ }
84
+ const S = {
85
+ LCP: Z(_.LCP, 0.75),
86
+ INP: Z(_.INP, 0.75),
87
+ CLS: Z(_.CLS, 0.75),
88
+ FCP: Z(_.FCP, 0.75),
89
+ TTFB: Z(_.TTFB, 0.75)
90
+ };
91
+ return {
92
+ total: m,
93
+ vitals: S,
94
+ errors: d,
95
+ slowRequests: y,
96
+ longTasks: g,
97
+ byType: v
98
+ };
99
+ }), l = T(() => {
100
+ const v = a.records().filter((m) => Rt.has(m.type)), _ = $t(v), d = _ === "hour" ? Pe : Ne, y = /* @__PURE__ */ new Map();
101
+ for (const m of v) {
102
+ if (!Number.isFinite(m.timestamp)) continue;
103
+ const S = Math.floor(m.timestamp / d) * d;
104
+ let w = y.get(S);
105
+ switch (w || (w = {
106
+ bucket: S,
107
+ label: Lt(S, _),
108
+ errors: 0,
109
+ requests: 0,
110
+ longTasks: 0,
111
+ events: 0
112
+ }, y.set(S, w)), m.type) {
113
+ case "error":
114
+ w.errors += he(m);
115
+ break;
116
+ case "request":
117
+ w.requests += 1;
118
+ break;
119
+ case "longTask":
120
+ w.longTasks += 1;
121
+ break;
122
+ case "event":
123
+ case "exposure":
124
+ w.events += 1;
125
+ break;
126
+ }
127
+ }
128
+ const g = Array.from(y.values()).sort((m, S) => m.bucket - S.bucket);
129
+ return { granularity: _, points: g };
130
+ }), b = T(() => l.value.points), C = T(() => l.value.granularity), I = T(() => {
131
+ var _;
132
+ const v = /* @__PURE__ */ new Map();
133
+ for (const d of a.records()) {
134
+ if (d.type !== "route") continue;
135
+ const y = d.to.path || d.to.fullPath || "(未知路由)", g = (_ = v.get(y)) != null ? _ : { label: y, count: 0, totalDuration: 0 };
136
+ g.count += 1, g.totalDuration += Number.isFinite(d.durationMs) ? d.durationMs : 0, v.set(y, g);
137
+ }
138
+ return ve(v, o);
139
+ }), R = T(() => {
140
+ var _;
141
+ const v = /* @__PURE__ */ new Map();
142
+ for (const d of a.records()) {
143
+ if (d.type !== "error") continue;
144
+ const y = d.fingerprint || d.message, g = d.message || d.name || "(未知错误)", m = (_ = v.get(y)) != null ? _ : { label: g, count: 0, totalDuration: 0 };
145
+ m.count += he(d), v.set(y, m);
146
+ }
147
+ return ve(v, o);
148
+ }), $ = T(() => {
149
+ var _;
150
+ const v = /* @__PURE__ */ new Map();
151
+ for (const d of a.records()) {
152
+ if (d.type !== "event" && d.type !== "exposure") continue;
153
+ const y = d.name || "(未命名事件)", g = (_ = v.get(y)) != null ? _ : { label: y, count: 0, totalDuration: 0 };
154
+ g.count += 1, v.set(y, g);
155
+ }
156
+ return ve(v, o);
157
+ });
158
+ return {
159
+ overview: r,
160
+ trend: b,
161
+ trendGranularity: C,
162
+ topRoutes: I,
163
+ topErrors: R,
164
+ topEvents: $
165
+ };
166
+ }
167
+ const ye = 5e3, Ee = 1e3, Ie = 1e3, Et = 1e3;
168
+ function ee(a) {
169
+ return a instanceof Error ? a.message : String(a);
170
+ }
171
+ function It(a, o) {
172
+ return a.timestamp !== o.timestamp ? o.timestamp - a.timestamp : a.id === o.id ? 0 : a.id < o.id ? -1 : 1;
173
+ }
174
+ function xt(a) {
175
+ const o = a.replace(/[^\w-]+/g, "-") || "export", r = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
176
+ return `vitalens-${o}-${r}.json`;
177
+ }
178
+ function Nt(a, o) {
179
+ try {
180
+ if (typeof document == "undefined" || typeof URL == "undefined" || typeof URL.createObjectURL != "function") return;
181
+ const r = URL.createObjectURL(a), l = document.createElement("a");
182
+ l.href = r, l.download = xt(o), l.rel = "noopener", document.body.appendChild(l), l.click(), l.remove(), setTimeout(() => {
183
+ try {
184
+ typeof URL.revokeObjectURL == "function" && URL.revokeObjectURL(r);
185
+ } catch {
186
+ }
187
+ }, 0);
188
+ } catch {
189
+ }
190
+ }
191
+ function Pt(a) {
192
+ const o = lt([]), r = D(!1), l = D(""), b = D(!0);
193
+ let C = [], I = [], R = /* @__PURE__ */ new Map(), $ = [], P = !1, v = 0, _, d, y = !1;
194
+ function g() {
195
+ const i = a.appId(), u = /* @__PURE__ */ new Map(), k = (A) => {
196
+ for (const x of A)
197
+ i && x.appId !== i || Number.isFinite(x.timestamp) && u.set(x.id, x);
198
+ };
199
+ k(C), k(I), k(Array.from(R.values()));
200
+ const M = Array.from(u.values()).sort(It);
201
+ o.value = M.length > ye ? M.slice(0, ye) : M;
202
+ }
203
+ function m() {
204
+ if (R.size <= Ee) return;
205
+ const i = R.size - Ee;
206
+ let u = 0;
207
+ for (const k of R.keys())
208
+ if (R.delete(k), u += 1, u >= i) break;
209
+ }
210
+ function S() {
211
+ if ($.length !== 0) {
212
+ for (const i of $)
213
+ R.delete(i.id), R.set(i.id, i);
214
+ $ = [], m(), g();
215
+ }
216
+ }
217
+ function w() {
218
+ !b.value || P || typeof document != "undefined" && document.visibilityState === "hidden" || S();
219
+ }
220
+ function ce(i) {
221
+ if (i.length === 0) return;
222
+ const u = $.concat(i);
223
+ $ = u.length > Ie ? u.slice(u.length - Ie) : u;
224
+ }
225
+ function te() {
226
+ typeof document != "undefined" && document.visibilityState === "visible" && w();
227
+ }
228
+ function ne() {
229
+ const i = a.perf();
230
+ if (!(!i || _ || !b.value)) {
231
+ try {
232
+ _ = i.subscribe((u) => {
233
+ ce(u);
234
+ });
235
+ } catch (u) {
236
+ l.value = `订阅实时数据失败:${ee(u)}`;
237
+ return;
238
+ }
239
+ d = setInterval(w, Et), typeof document != "undefined" && !y && (document.addEventListener("visibilitychange", te), y = !0);
240
+ }
241
+ }
242
+ function O() {
243
+ if (_) {
244
+ try {
245
+ _();
246
+ } catch {
247
+ }
248
+ _ = void 0;
249
+ }
250
+ d !== void 0 && (clearInterval(d), d = void 0), typeof document != "undefined" && y && (document.removeEventListener("visibilitychange", te), y = !1);
251
+ }
252
+ async function q() {
253
+ const i = ++v;
254
+ r.value = !0;
255
+ try {
256
+ const u = a.perf();
257
+ if (!u) {
258
+ if (i !== v) return;
259
+ C = [], l.value = "";
260
+ return;
261
+ }
262
+ const k = { order: "desc", limit: ye }, M = await u.query(k);
263
+ if (i !== v) return;
264
+ C = M, l.value = "";
265
+ } catch (u) {
266
+ if (i !== v) return;
267
+ l.value = `读取本地数据失败:${ee(u)}`;
268
+ } finally {
269
+ i === v && (r.value = !1, g());
270
+ }
271
+ }
272
+ function L(i) {
273
+ if (i !== b.value) {
274
+ if (!i) {
275
+ S(), b.value = !1, O();
276
+ return;
277
+ }
278
+ b.value = !0, a.perf() && (ne(), q());
279
+ }
280
+ }
281
+ async function G(i) {
282
+ const u = a.perf();
283
+ if (!u)
284
+ return l.value = "缺少 perf 实例,无法导入", 0;
285
+ P = !0, r.value = !0;
286
+ try {
287
+ const k = await u.importAll(i);
288
+ return await q(), k;
289
+ } catch (k) {
290
+ return l.value = `导入失败:${ee(k)}`, 0;
291
+ } finally {
292
+ P = !1, r.value = !1;
293
+ }
294
+ }
295
+ async function V() {
296
+ var i, u, k, M;
297
+ try {
298
+ const A = a.perf();
299
+ let x;
300
+ if (A)
301
+ x = await A.exportAll();
302
+ else {
303
+ const fe = {
304
+ formatVersion: 1,
305
+ appId: (i = a.appId()) != null ? i : "",
306
+ exportedAt: (/* @__PURE__ */ new Date()).toISOString(),
307
+ records: o.value
308
+ };
309
+ x = new Blob([JSON.stringify(fe, null, 2)], { type: "application/json" });
310
+ }
311
+ const pe = (M = (k = a.appId()) != null ? k : (u = a.perf()) == null ? void 0 : u.config.appId) != null ? M : "export";
312
+ return Nt(x, pe), x;
313
+ } catch (A) {
314
+ return l.value = `导出失败:${ee(A)}`, null;
315
+ }
316
+ }
317
+ async function ae() {
318
+ const i = a.perf();
319
+ if (!i)
320
+ return l.value = "缺少 perf 实例,无法清空", !1;
321
+ r.value = !0;
322
+ try {
323
+ return await i.clear(), C = [], R = /* @__PURE__ */ new Map(), $ = [], l.value = "", g(), !0;
324
+ } catch (u) {
325
+ return l.value = `清空失败:${ee(u)}`, !1;
326
+ } finally {
327
+ r.value = !1;
328
+ }
329
+ }
330
+ return j(
331
+ () => a.perf(),
332
+ (i, u) => {
333
+ i !== u && (O(), $ = [], R = /* @__PURE__ */ new Map(), i ? (b.value && ne(), q()) : (C = [], g()));
334
+ },
335
+ { immediate: !0 }
336
+ ), j(
337
+ () => a.records(),
338
+ (i) => {
339
+ I = i != null ? i : [], g();
340
+ },
341
+ { immediate: !0 }
342
+ ), j(
343
+ () => a.appId(),
344
+ () => {
345
+ g();
346
+ }
347
+ ), xe(() => {
348
+ O(), $ = [], R = /* @__PURE__ */ new Map(), C = [], I = [];
349
+ }), {
350
+ records: o,
351
+ loading: r,
352
+ error: l,
353
+ realtime: b,
354
+ refresh: q,
355
+ importFile: G,
356
+ exportFile: V,
357
+ clearLocal: ae,
358
+ setRealtime: L
359
+ };
360
+ }
361
+ const Ft = 1e3, Ot = 1e3, At = 2e3, Fe = {
362
+ LCP: { good: 2500, warn: 4e3, unit: "ms", hint: "≤2500ms 良好 / ≤4000ms 预警" },
363
+ INP: { good: 200, warn: 500, unit: "ms", hint: "≤200ms 良好 / ≤500ms 预警" },
364
+ CLS: { good: 0.1, warn: 0.25, unit: "", hint: "≤0.1 良好 / ≤0.25 预警" },
365
+ FCP: { good: 1800, warn: 3e3, unit: "ms", hint: "≤1800ms 良好 / ≤3000ms 预警" },
366
+ TTFB: { good: 800, warn: 1800, unit: "ms", hint: "≤800ms 良好 / ≤1800ms 预警" }
367
+ };
368
+ function Dt(a, o, r) {
369
+ return a === null || !Number.isFinite(a) ? "neutral" : a <= o ? "good" : a <= r ? "warn" : "poor";
370
+ }
371
+ function qt(a, o) {
372
+ const r = Fe[a];
373
+ return Dt(o, r.good, r.warn);
374
+ }
375
+ function Ut(a) {
376
+ return a === void 0 || !Number.isFinite(a) ? "neutral" : a >= 400 ? "poor" : "good";
377
+ }
378
+ function Vt(a) {
379
+ return !a.success || a.status !== void 0 && Number.isFinite(a.status) && a.status >= 400 ? "poor" : a.durationMs >= Ft ? "warn" : "good";
380
+ }
381
+ function zt(a) {
382
+ return a.durationMs >= Ot ? "warn" : "good";
383
+ }
384
+ function Bt(a) {
385
+ var o;
386
+ return a.failed ? "poor" : ((o = a.durationMs) != null ? o : 0) >= At ? "warn" : "good";
387
+ }
388
+ const Ht = {
389
+ class: "perf-panel",
390
+ "aria-label": "性能面板"
391
+ }, jt = {
392
+ key: 0,
393
+ class: "perf-panel__fallback",
394
+ role: "alert"
395
+ }, Gt = { class: "perf-panel__fallback-text" }, Wt = { class: "perf-panel__header" }, Yt = { class: "perf-panel__heading" }, Qt = { class: "perf-panel__title-row" }, Jt = { class: "perf-panel__subtitle" }, Xt = ["data-realtime"], Kt = { class: "perf-panel__subtitle-item" }, Zt = { class: "perf-panel__subtitle-item" }, en = {
396
+ key: 0,
397
+ class: "perf-panel__subtitle-item perf-panel__subtitle-item--loading"
398
+ }, tn = { class: "perf-panel__actions" }, nn = {
399
+ class: "perf-panel__action-group",
400
+ role: "group",
401
+ "aria-label": "刷新与导出"
402
+ }, an = ["disabled"], sn = {
403
+ class: "perf-panel__action-group",
404
+ role: "group",
405
+ "aria-label": "导入与清空"
406
+ }, rn = ["disabled"], on = ["disabled"], ln = { class: "perf-panel__switch" }, un = ["checked", "disabled"], cn = {
407
+ key: 0,
408
+ class: "perf-panel__notice",
409
+ role: "alert"
410
+ }, pn = {
411
+ key: 1,
412
+ class: "perf-panel__empty"
413
+ }, fn = {
414
+ key: 2,
415
+ class: "perf-panel__empty"
416
+ }, dn = {
417
+ class: "perf-panel__section",
418
+ "aria-label": "概览"
419
+ }, _n = { class: "perf-panel__overview" }, mn = ["data-metric", "data-tone"], vn = { class: "perf-panel__card-head" }, hn = { class: "perf-panel__card-label" }, yn = { class: "perf-panel__card-body" }, bn = { class: "perf-panel__card-value" }, gn = {
420
+ key: 0,
421
+ class: "perf-panel__card-unit"
422
+ }, kn = { class: "perf-panel__card-hint" }, Tn = {
423
+ class: "perf-panel__section",
424
+ "aria-label": "趋势"
425
+ }, wn = { class: "perf-panel__section-head" }, Cn = { class: "perf-panel__section-title-group" }, Rn = { class: "perf-panel__section-meta" }, Sn = { class: "perf-panel__section-meta" }, Ln = { class: "perf-panel__chart-wrap" }, $n = {
426
+ key: 0,
427
+ class: "perf-panel__chart-empty"
428
+ }, Mn = {
429
+ key: 0,
430
+ class: "perf-panel__notice"
431
+ }, En = {
432
+ class: "perf-panel__section",
433
+ "aria-label": "Top 排行"
434
+ }, In = { class: "perf-panel__top-grid" }, xn = { class: "perf-panel__top-title" }, Nn = {
435
+ key: 0,
436
+ class: "perf-panel__top-list"
437
+ }, Pn = ["title"], Fn = { class: "perf-panel__top-count" }, On = {
438
+ key: 1,
439
+ class: "perf-panel__top-empty"
440
+ }, An = {
441
+ class: "perf-panel__section",
442
+ "aria-label": "明细"
443
+ }, Dn = { class: "perf-panel__details-head" }, qn = { class: "perf-panel__section-title-group" }, Un = { class: "perf-panel__section-meta" }, Vn = {
444
+ class: "perf-panel__tabs",
445
+ role: "tablist",
446
+ "aria-label": "明细分类"
447
+ }, zn = ["aria-selected", "data-tab", "onClick"], Bn = { class: "perf-panel__tab-count" }, Hn = { class: "perf-panel__table-wrap" }, jn = {
448
+ key: 0,
449
+ class: "perf-panel__table"
450
+ }, Gn = ["data-column"], Wn = ["data-column", "data-tone", "title"], Yn = {
451
+ key: 1,
452
+ class: "perf-panel__cell-text"
453
+ }, Qn = {
454
+ key: 1,
455
+ class: "perf-panel__empty perf-panel__empty--inline"
456
+ }, Jn = {
457
+ key: 0,
458
+ class: "perf-panel__pagination"
459
+ }, Xn = { class: "perf-panel__pagination-info" }, Kn = { class: "perf-panel__pagination-actions" }, Zn = ["disabled"], ea = ["disabled"], be = 20, ta = /* @__PURE__ */ it({
460
+ name: "PerfPanel",
461
+ __name: "PerfPanel",
462
+ props: {
463
+ perf: {},
464
+ records: { default: () => [] },
465
+ appId: {}
466
+ },
467
+ setup(a) {
468
+ const o = a;
469
+ bt([mt, vt, ht, yt, kt]);
470
+ const r = ["#d54941", "#3f6ad8", "#c87f2c", "#2f8f6b"], l = [
471
+ "--perf-panel-chart-error",
472
+ "--perf-panel-chart-request",
473
+ "--perf-panel-chart-long-task",
474
+ "--perf-panel-chart-event"
475
+ ], b = {
476
+ error: ["error"],
477
+ request: ["request"],
478
+ route: ["route"],
479
+ resource: ["resource"],
480
+ event: ["event", "exposure"]
481
+ }, C = [
482
+ {
483
+ tab: "error",
484
+ label: "错误",
485
+ columns: [
486
+ { key: "time", label: "时间" },
487
+ { key: "source", label: "来源", kind: "chip" },
488
+ { key: "name", label: "名称" },
489
+ { key: "message", label: "消息" },
490
+ { key: "route", label: "路由" },
491
+ { key: "component", label: "组件" }
492
+ ]
493
+ },
494
+ {
495
+ tab: "request",
496
+ label: "请求",
497
+ columns: [
498
+ { key: "time", label: "时间" },
499
+ { key: "method", label: "方法", kind: "chip" },
500
+ { key: "url", label: "URL", kind: "mono" },
501
+ { key: "query", label: "Query", kind: "mono" },
502
+ { key: "status", label: "状态", kind: "chip" },
503
+ { key: "duration", label: "耗时" },
504
+ { key: "result", label: "结果", kind: "chip" }
505
+ ]
506
+ },
507
+ {
508
+ tab: "route",
509
+ label: "路由",
510
+ columns: [
511
+ { key: "time", label: "时间" },
512
+ { key: "from", label: "来源" },
513
+ { key: "to", label: "目标" },
514
+ { key: "navigation", label: "类型", kind: "chip" },
515
+ { key: "duration", label: "耗时" }
516
+ ]
517
+ },
518
+ {
519
+ tab: "resource",
520
+ label: "资源",
521
+ columns: [
522
+ { key: "time", label: "时间" },
523
+ { key: "url", label: "URL", kind: "mono" },
524
+ { key: "initiator", label: "发起方" },
525
+ { key: "duration", label: "耗时" },
526
+ { key: "result", label: "结果", kind: "chip" }
527
+ ]
528
+ },
529
+ {
530
+ tab: "event",
531
+ label: "埋点",
532
+ columns: [
533
+ { key: "time", label: "时间" },
534
+ { key: "kind", label: "类型", kind: "chip" },
535
+ { key: "name", label: "名称" },
536
+ { key: "source", label: "来源", kind: "chip" },
537
+ { key: "route", label: "路由" },
538
+ { key: "props", label: "属性", kind: "mono" }
539
+ ]
540
+ }
541
+ ], {
542
+ records: I,
543
+ loading: R,
544
+ error: $,
545
+ realtime: P,
546
+ refresh: v,
547
+ importFile: _,
548
+ exportFile: d,
549
+ clearLocal: y,
550
+ setRealtime: g
551
+ } = Pt({
552
+ perf: () => o.perf,
553
+ records: () => o.records,
554
+ appId: () => o.appId
555
+ }), { overview: m, trend: S, trendGranularity: w, topRoutes: ce, topErrors: te, topEvents: ne } = Mt({
556
+ records: () => I.value
557
+ }), O = D("error"), q = D(""), L = D(1), G = D(""), V = D(""), ae = D(null), i = D(null);
558
+ let u = null, k = null, M = !1;
559
+ const A = T(() => I.value.length), x = T(() => o.perf ? "本地数据" : "注入数据"), pe = T(() => o.perf ? P.value ? "实时已开启" : "实时已暂停" : "实时不可用"), fe = T(() => o.perf && P.value ? "perf-panel__dot--good" : "perf-panel__dot--neutral");
560
+ function Y(e, n) {
561
+ const t = Fe[e];
562
+ return {
563
+ key: e,
564
+ label: `${e} p75`,
565
+ value: Ve(e, n),
566
+ unit: t.unit,
567
+ tone: qt(e, n),
568
+ hint: t.hint
569
+ };
570
+ }
571
+ const Oe = T(() => {
572
+ const e = m.value.vitals, n = m.value.byType.request, t = m.value.total === 0 ? "neutral" : m.value.errors > 0 ? "poor" : "good", c = n === 0 ? "neutral" : m.value.slowRequests > 0 ? "warn" : "good", z = m.value.longTasks > 0 ? "warn" : "neutral";
573
+ return [
574
+ Y("LCP", e.LCP),
575
+ Y("INP", e.INP),
576
+ Y("CLS", e.CLS),
577
+ Y("FCP", e.FCP),
578
+ Y("TTFB", e.TTFB),
579
+ {
580
+ key: "errors",
581
+ label: "错误数",
582
+ value: String(m.value.errors),
583
+ unit: "条",
584
+ tone: t,
585
+ hint: ">0 标红"
586
+ },
587
+ {
588
+ key: "slowRequests",
589
+ label: "慢请求",
590
+ value: String(m.value.slowRequests),
591
+ unit: "条",
592
+ tone: c,
593
+ hint: "≥1000ms 标橙"
594
+ },
595
+ {
596
+ key: "longTasks",
597
+ label: "长任务",
598
+ value: String(m.value.longTasks),
599
+ unit: "个",
600
+ tone: z,
601
+ hint: "≥50ms 标橙"
602
+ }
603
+ ];
604
+ }), Ae = T(() => [
605
+ { key: "routes", title: "Top 路由", items: ce.value },
606
+ { key: "errors", title: "Top 错误", items: te.value },
607
+ { key: "events", title: "Top 埋点", items: ne.value }
608
+ ]), De = T(() => b[O.value]), qe = T(() => {
609
+ const e = De.value, n = q.value.trim().toLowerCase();
610
+ return I.value.filter((t) => e.includes(t.type) ? n.length === 0 ? !0 : ze(t).toLowerCase().includes(n) : !1);
611
+ }), ge = T(() => qe.value.map(Be)), se = T(() => ge.value.length), re = T(() => Math.max(1, Math.ceil(se.value / be))), ke = T(() => {
612
+ const e = (L.value - 1) * be;
613
+ return ge.value.slice(e, e + be);
614
+ }), Te = T(
615
+ () => {
616
+ var e, n;
617
+ return (n = (e = C.find((t) => t.tab === O.value)) == null ? void 0 : e.columns) != null ? n : [];
618
+ }
619
+ );
620
+ function oe(e) {
621
+ return e instanceof Error ? e.message : String(e);
622
+ }
623
+ function Q(e) {
624
+ return e < 10 ? `0${e}` : String(e);
625
+ }
626
+ function Ue(e) {
627
+ if (!Number.isFinite(e)) return "—";
628
+ const n = new Date(e), t = Q(n.getMonth() + 1), c = Q(n.getDate());
629
+ return `${t}-${c} ${Q(n.getHours())}:${Q(n.getMinutes())}:${Q(n.getSeconds())}`;
630
+ }
631
+ function le(e) {
632
+ return Number.isFinite(e) ? e >= 1e3 ? `${(e / 1e3).toFixed(2)} s` : `${Math.round(e)} ms` : "—";
633
+ }
634
+ function Ve(e, n) {
635
+ return n === null || !Number.isFinite(n) ? "—" : e === "CLS" ? n.toFixed(3) : String(Math.round(n));
636
+ }
637
+ function N(e) {
638
+ return e && (e.path || e.fullPath || e.name) || "—";
639
+ }
640
+ function we(e) {
641
+ if (!e) return "—";
642
+ const n = Object.entries(e);
643
+ return n.length === 0 ? "—" : n.map(([t, c]) => `${t}=${c}`).join("&");
644
+ }
645
+ function ie(e) {
646
+ if (!e) return "—";
647
+ try {
648
+ const n = JSON.stringify(e);
649
+ return typeof n == "string" ? n : "—";
650
+ } catch {
651
+ return "[无法序列化]";
652
+ }
653
+ }
654
+ function ze(e) {
655
+ var n, t, c, z, J, X, K, E;
656
+ switch (e.type) {
657
+ case "vital":
658
+ return `${e.name} ${e.value}`;
659
+ case "error":
660
+ return `${e.message} ${(n = e.name) != null ? n : ""} ${e.source} ${e.fingerprint} ${(t = e.component) != null ? t : ""} ${(c = e.stack) != null ? c : ""} ${N(e.route)}`;
661
+ case "request":
662
+ return `${e.method} ${e.url} ${we(e.query)} ${(z = e.status) != null ? z : ""}`;
663
+ case "route":
664
+ return `${N(e.to)} ${N(e.from)}`;
665
+ case "resource":
666
+ return `${e.url} ${(J = e.initiatorType) != null ? J : ""}`;
667
+ case "longTask":
668
+ return `${(X = e.name) != null ? X : ""} ${e.durationMs}`;
669
+ case "event":
670
+ return `${e.name} ${(K = e.source) != null ? K : ""} ${N(e.route)} ${ie(e.props)}`;
671
+ case "exposure":
672
+ return `${e.name} ${(E = e.target) != null ? E : ""} ${N(e.route)} ${ie(e.props)}`;
673
+ }
674
+ }
675
+ function Be(e) {
676
+ var t, c, z, J, X, K;
677
+ const n = Ue(e.timestamp);
678
+ switch (e.type) {
679
+ case "error":
680
+ return {
681
+ id: e.id,
682
+ timestamp: e.timestamp,
683
+ cells: {
684
+ time: n,
685
+ source: e.source,
686
+ name: (t = e.name) != null ? t : "—",
687
+ message: e.message,
688
+ route: N(e.route),
689
+ component: (c = e.component) != null ? c : "—"
690
+ },
691
+ tones: { message: "poor", name: "poor" },
692
+ rowTone: "poor"
693
+ };
694
+ case "request": {
695
+ const E = Vt(e);
696
+ return {
697
+ id: e.id,
698
+ timestamp: e.timestamp,
699
+ cells: {
700
+ time: n,
701
+ method: e.method,
702
+ url: e.url,
703
+ query: we(e.query),
704
+ status: e.status === void 0 ? "—" : String(e.status),
705
+ duration: le(e.durationMs),
706
+ result: e.success ? "成功" : "失败"
707
+ },
708
+ tones: {
709
+ status: Ut(e.status),
710
+ duration: E,
711
+ result: e.success ? "good" : "poor"
712
+ },
713
+ rowTone: E === "poor" ? "poor" : E === "warn" ? "warn" : void 0
714
+ };
715
+ }
716
+ case "route": {
717
+ const E = zt(e);
718
+ return {
719
+ id: e.id,
720
+ timestamp: e.timestamp,
721
+ cells: {
722
+ time: n,
723
+ from: N(e.from),
724
+ to: N(e.to),
725
+ navigation: e.navigation === "initial" ? "首次" : "SPA",
726
+ duration: le(e.durationMs)
727
+ },
728
+ tones: { duration: E },
729
+ rowTone: E === "warn" ? "warn" : void 0
730
+ };
731
+ }
732
+ case "resource": {
733
+ const E = Bt(e);
734
+ return {
735
+ id: e.id,
736
+ timestamp: e.timestamp,
737
+ cells: {
738
+ time: n,
739
+ url: e.url,
740
+ initiator: (z = e.initiatorType) != null ? z : "—",
741
+ duration: e.durationMs === void 0 ? "—" : le(e.durationMs),
742
+ result: e.failed ? "失败" : "成功"
743
+ },
744
+ tones: {
745
+ duration: E,
746
+ result: e.failed ? "poor" : "good"
747
+ },
748
+ rowTone: E === "poor" ? "poor" : E === "warn" ? "warn" : void 0
749
+ };
750
+ }
751
+ case "event":
752
+ return {
753
+ id: e.id,
754
+ timestamp: e.timestamp,
755
+ cells: {
756
+ time: n,
757
+ kind: "事件",
758
+ name: e.name,
759
+ source: (J = e.source) != null ? J : "manual",
760
+ route: N(e.route),
761
+ props: ie(e.props)
762
+ },
763
+ tones: { kind: "neutral", source: "neutral" }
764
+ };
765
+ case "exposure":
766
+ return {
767
+ id: e.id,
768
+ timestamp: e.timestamp,
769
+ cells: {
770
+ time: n,
771
+ kind: "曝光",
772
+ name: e.name,
773
+ source: "exposure",
774
+ route: N(e.route),
775
+ props: ie(e.props)
776
+ },
777
+ tones: { kind: "neutral", source: "neutral" }
778
+ };
779
+ case "vital":
780
+ return {
781
+ id: e.id,
782
+ timestamp: e.timestamp,
783
+ cells: {
784
+ time: n,
785
+ kind: "Vital",
786
+ name: e.name,
787
+ source: (X = e.rating) != null ? X : "—",
788
+ route: N(e.route),
789
+ props: String(e.value)
790
+ }
791
+ };
792
+ case "longTask":
793
+ return {
794
+ id: e.id,
795
+ timestamp: e.timestamp,
796
+ cells: {
797
+ time: n,
798
+ kind: "长任务",
799
+ name: (K = e.name) != null ? K : "—",
800
+ source: "longTask",
801
+ route: N(e.route),
802
+ props: le(e.durationMs)
803
+ }
804
+ };
805
+ }
806
+ }
807
+ function de(e, n) {
808
+ var t;
809
+ return (t = e.cells[n.key]) != null ? t : "—";
810
+ }
811
+ function Ce(e, n) {
812
+ var t;
813
+ return (t = e.tones) == null ? void 0 : t[n.key];
814
+ }
815
+ function He(e, n) {
816
+ var t, c;
817
+ return (c = (t = e.tones) == null ? void 0 : t[n.key]) != null ? c : "neutral";
818
+ }
819
+ function je(e, n) {
820
+ const t = [`perf-panel__cell--${n.key}`];
821
+ n.kind === "mono" && t.push("perf-panel__cell--mono"), n.kind === "chip" && t.push("perf-panel__cell--chip");
822
+ const c = Ce(e, n);
823
+ return c && t.push(`perf-panel__tone--${c}`), t;
824
+ }
825
+ function Ge(e) {
826
+ return e.rowTone ? [`perf-panel__row--${e.rowTone}`] : [];
827
+ }
828
+ function We(e) {
829
+ const n = b[e];
830
+ let t = 0;
831
+ for (const c of I.value)
832
+ n.includes(c.type) && (t += 1);
833
+ return t;
834
+ }
835
+ function Ye(e) {
836
+ O.value = e;
837
+ }
838
+ function Qe() {
839
+ L.value > 1 && (L.value -= 1);
840
+ }
841
+ function Je() {
842
+ L.value < re.value && (L.value += 1);
843
+ }
844
+ function Xe() {
845
+ G.value = "";
846
+ }
847
+ async function Ke() {
848
+ await v();
849
+ }
850
+ async function Ze() {
851
+ await d();
852
+ }
853
+ function et() {
854
+ var e;
855
+ if (o.perf)
856
+ try {
857
+ (e = ae.value) == null || e.click();
858
+ } catch {
859
+ }
860
+ }
861
+ async function tt(e) {
862
+ var c;
863
+ const n = e.target;
864
+ if (!(n instanceof HTMLInputElement)) return;
865
+ const t = (c = n.files) == null ? void 0 : c[0];
866
+ try {
867
+ n.value = "";
868
+ } catch {
869
+ }
870
+ t && await _(t);
871
+ }
872
+ async function nt() {
873
+ if (o.perf) {
874
+ if (typeof window != "undefined") {
875
+ let e = !1;
876
+ try {
877
+ e = window.confirm("确定清空本地性能数据吗?");
878
+ } catch {
879
+ e = !1;
880
+ }
881
+ if (!e) return;
882
+ }
883
+ await y();
884
+ }
885
+ }
886
+ function at(e) {
887
+ const n = e.target;
888
+ n instanceof HTMLInputElement && g(n.checked);
889
+ }
890
+ function st(e) {
891
+ if (!e) return [...r];
892
+ try {
893
+ const n = getComputedStyle(e);
894
+ return l.map((t, c) => n.getPropertyValue(t).trim() || r[c] || "#8f959e");
895
+ } catch {
896
+ return [...r];
897
+ }
898
+ }
899
+ function rt(e, n) {
900
+ return {
901
+ animation: !1,
902
+ color: st(n),
903
+ grid: { top: 36, right: 16, bottom: 8, left: 8, containLabel: !0 },
904
+ legend: { top: 0, icon: "circle", itemWidth: 8, itemHeight: 8, textStyle: { fontSize: 12 } },
905
+ tooltip: { trigger: "axis" },
906
+ xAxis: {
907
+ type: "category",
908
+ boundaryGap: !1,
909
+ data: e.map((t) => t.label),
910
+ axisLabel: { hideOverlap: !0 }
911
+ },
912
+ yAxis: {
913
+ type: "value",
914
+ minInterval: 1,
915
+ splitLine: { lineStyle: { type: "dashed" } }
916
+ },
917
+ series: [
918
+ { name: "错误", type: "line", symbol: "circle", symbolSize: 5, data: e.map((t) => t.errors) },
919
+ { name: "请求", type: "line", symbol: "circle", symbolSize: 5, data: e.map((t) => t.requests) },
920
+ { name: "长任务", type: "line", symbol: "circle", symbolSize: 5, data: e.map((t) => t.longTasks) },
921
+ { name: "埋点", type: "line", symbol: "circle", symbolSize: 5, data: e.map((t) => t.events) }
922
+ ]
923
+ };
924
+ }
925
+ function Re() {
926
+ if (u)
927
+ try {
928
+ u.setOption(rt(S.value, i.value), !0), V.value = "";
929
+ } catch (e) {
930
+ V.value = `图表渲染失败:${oe(e)}`;
931
+ }
932
+ }
933
+ function ot() {
934
+ if (u) return;
935
+ const e = i.value;
936
+ if (!(!e || typeof window == "undefined") && !(e.clientWidth <= 0 || e.clientHeight <= 0))
937
+ try {
938
+ u = gt(e), Re();
939
+ } catch (n) {
940
+ u = null, V.value = `图表初始化失败:${oe(n)}`;
941
+ }
942
+ }
943
+ function _e() {
944
+ ot(), Re();
945
+ }
946
+ function me() {
947
+ if (i.value) {
948
+ if (!u) {
949
+ _e();
950
+ return;
951
+ }
952
+ try {
953
+ u.resize();
954
+ } catch (e) {
955
+ V.value = `图表尺寸更新失败:${oe(e)}`;
956
+ }
957
+ }
958
+ }
959
+ function Se() {
960
+ if (k || M) return;
961
+ const e = i.value;
962
+ if (e) {
963
+ if (typeof ResizeObserver != "undefined")
964
+ try {
965
+ k = new ResizeObserver(() => {
966
+ me();
967
+ }), k.observe(e);
968
+ return;
969
+ } catch {
970
+ k = null;
971
+ }
972
+ typeof window != "undefined" && (window.addEventListener("resize", me), M = !0);
973
+ }
974
+ }
975
+ function Le() {
976
+ k && (k.disconnect(), k = null), M && typeof window != "undefined" && (window.removeEventListener("resize", me), M = !1);
977
+ }
978
+ function $e() {
979
+ if (u) {
980
+ try {
981
+ u.dispose();
982
+ } catch {
983
+ }
984
+ u = null;
985
+ }
986
+ }
987
+ return j(O, () => {
988
+ L.value = 1;
989
+ }), j(q, () => {
990
+ L.value = 1;
991
+ }), j(re, (e) => {
992
+ L.value > e && (L.value = e);
993
+ }), j(
994
+ S,
995
+ () => {
996
+ if (!i.value) {
997
+ $e(), Le();
998
+ return;
999
+ }
1000
+ Se(), _e();
1001
+ },
1002
+ { flush: "post" }
1003
+ ), ut(() => {
1004
+ Se(), ct().then(() => {
1005
+ _e();
1006
+ });
1007
+ }), xe(() => {
1008
+ Le(), $e();
1009
+ }), pt((e) => (G.value = `面板内部错误:${oe(e)}`, !1)), (e, n) => (p(), f("section", Ht, [
1010
+ G.value ? (p(), f("div", jt, [
1011
+ n[1] || (n[1] = s("p", { class: "perf-panel__fallback-title" }, "性能面板渲染失败", -1)),
1012
+ s("p", Gt, h(G.value), 1),
1013
+ s("button", {
1014
+ class: "perf-panel__button",
1015
+ type: "button",
1016
+ onClick: Xe
1017
+ }, "重试")
1018
+ ])) : (p(), f(U, { key: 1 }, [
1019
+ s("header", Wt, [
1020
+ s("div", Yt, [
1021
+ s("div", Qt, [
1022
+ n[2] || (n[2] = s("h2", { class: "perf-panel__title" }, "性能面板", -1)),
1023
+ s("span", {
1024
+ class: B(["perf-panel__source-chip", a.perf ? "perf-panel__source-chip--local" : "perf-panel__source-chip--injected"])
1025
+ }, h(x.value), 3)
1026
+ ]),
1027
+ s("p", Jt, [
1028
+ s("span", {
1029
+ class: "perf-panel__subtitle-item",
1030
+ "data-realtime": a.perf ? F(P) ? "on" : "off" : "unavailable"
1031
+ }, [
1032
+ s("i", {
1033
+ class: B(["perf-panel__dot", fe.value])
1034
+ }, null, 2),
1035
+ Me(" " + h(pe.value), 1)
1036
+ ], 8, Xt),
1037
+ n[3] || (n[3] = s("span", {
1038
+ class: "perf-panel__sep",
1039
+ "aria-hidden": "true"
1040
+ }, "·", -1)),
1041
+ s("span", Kt, "共 " + h(A.value) + " 条记录", 1),
1042
+ n[4] || (n[4] = s("span", {
1043
+ class: "perf-panel__sep",
1044
+ "aria-hidden": "true"
1045
+ }, "·", -1)),
1046
+ s("span", Zt, h(x.value), 1),
1047
+ F(R) ? (p(), f("span", en, "加载中…")) : W("", !0)
1048
+ ])
1049
+ ]),
1050
+ s("div", tn, [
1051
+ s("div", nn, [
1052
+ s("button", {
1053
+ class: "perf-panel__button perf-panel__button--primary",
1054
+ type: "button",
1055
+ "data-action": "refresh",
1056
+ disabled: F(R),
1057
+ onClick: Ke
1058
+ }, " 刷新 ", 8, an),
1059
+ s("button", {
1060
+ class: "perf-panel__button",
1061
+ type: "button",
1062
+ "data-action": "export",
1063
+ onClick: Ze
1064
+ }, "导出 JSON")
1065
+ ]),
1066
+ s("div", sn, [
1067
+ s("button", {
1068
+ class: "perf-panel__button",
1069
+ type: "button",
1070
+ "data-action": "import",
1071
+ disabled: !a.perf,
1072
+ onClick: et
1073
+ }, " 导入 JSON ", 8, rn),
1074
+ s("button", {
1075
+ class: "perf-panel__button perf-panel__button--danger",
1076
+ type: "button",
1077
+ "data-action": "clear",
1078
+ disabled: !a.perf || F(R),
1079
+ onClick: nt
1080
+ }, " 清空 ", 8, on)
1081
+ ]),
1082
+ s("label", ln, [
1083
+ s("input", {
1084
+ type: "checkbox",
1085
+ "data-action": "realtime",
1086
+ checked: F(P),
1087
+ disabled: !a.perf,
1088
+ onChange: at
1089
+ }, null, 40, un),
1090
+ n[5] || (n[5] = s("span", null, "实时", -1))
1091
+ ]),
1092
+ s("input", {
1093
+ ref_key: "fileInput",
1094
+ ref: ae,
1095
+ class: "perf-panel__file-input",
1096
+ type: "file",
1097
+ accept: "application/json,.json",
1098
+ onChange: tt
1099
+ }, null, 544)
1100
+ ])
1101
+ ]),
1102
+ F($) ? (p(), f("p", cn, h(F($)), 1)) : W("", !0),
1103
+ F(R) && A.value === 0 ? (p(), f("p", pn, "加载中…")) : A.value === 0 ? (p(), f("p", fn, "暂无性能数据")) : (p(), f(U, { key: 3 }, [
1104
+ s("section", dn, [
1105
+ n[6] || (n[6] = ft('<div class="perf-panel__section-head" data-v-0a9a1651><div class="perf-panel__section-title-group" data-v-0a9a1651><h3 class="perf-panel__section-title" data-v-0a9a1651>概览</h3><span class="perf-panel__section-meta" data-v-0a9a1651>Web Vitals p75 · 按标准阈值着色</span></div><div class="perf-panel__legend" aria-label="状态图例" data-v-0a9a1651><span class="perf-panel__legend-item" data-v-0a9a1651><i class="perf-panel__dot perf-panel__dot--good" data-v-0a9a1651></i>良好 </span><span class="perf-panel__legend-item" data-v-0a9a1651><i class="perf-panel__dot perf-panel__dot--warn" data-v-0a9a1651></i>需关注 </span><span class="perf-panel__legend-item" data-v-0a9a1651><i class="perf-panel__dot perf-panel__dot--poor" data-v-0a9a1651></i>较差 </span><span class="perf-panel__legend-item" data-v-0a9a1651><i class="perf-panel__dot perf-panel__dot--neutral" data-v-0a9a1651></i>无数据 </span></div></div>', 1)),
1106
+ s("div", _n, [
1107
+ (p(!0), f(U, null, H(Oe.value, (t) => (p(), f("article", {
1108
+ key: t.key,
1109
+ class: B(["perf-panel__card", `perf-panel__card--${t.tone}`]),
1110
+ "data-metric": t.key,
1111
+ "data-tone": t.tone
1112
+ }, [
1113
+ s("div", vn, [
1114
+ s("i", {
1115
+ class: B(["perf-panel__dot", `perf-panel__dot--${t.tone}`])
1116
+ }, null, 2),
1117
+ s("span", hn, h(t.label), 1)
1118
+ ]),
1119
+ s("div", yn, [
1120
+ s("span", bn, h(t.value), 1),
1121
+ t.unit ? (p(), f("span", gn, h(t.unit), 1)) : W("", !0)
1122
+ ]),
1123
+ s("span", kn, h(t.hint), 1)
1124
+ ], 10, mn))), 128))
1125
+ ])
1126
+ ]),
1127
+ s("section", Tn, [
1128
+ s("div", wn, [
1129
+ s("div", Cn, [
1130
+ n[7] || (n[7] = s("h3", { class: "perf-panel__section-title" }, "趋势", -1)),
1131
+ s("span", Rn, h(F(w) === "hour" ? "按小时聚合" : "按分钟聚合"), 1)
1132
+ ]),
1133
+ s("span", Sn, h(F(S).length) + " 个时间桶", 1)
1134
+ ]),
1135
+ s("div", Ln, [
1136
+ s("div", {
1137
+ ref_key: "chartEl",
1138
+ ref: i,
1139
+ class: "perf-panel__chart"
1140
+ }, null, 512),
1141
+ F(S).length === 0 ? (p(), f("p", $n, "暂无趋势数据")) : W("", !0)
1142
+ ]),
1143
+ V.value ? (p(), f("p", Mn, h(V.value), 1)) : W("", !0)
1144
+ ]),
1145
+ s("section", En, [
1146
+ n[8] || (n[8] = s("div", { class: "perf-panel__section-head" }, [
1147
+ s("h3", { class: "perf-panel__section-title" }, "Top 排行"),
1148
+ s("span", { class: "perf-panel__section-meta" }, "按出现次数排序")
1149
+ ], -1)),
1150
+ s("div", In, [
1151
+ (p(!0), f(U, null, H(Ae.value, (t) => (p(), f("div", {
1152
+ key: t.key,
1153
+ class: "perf-panel__top"
1154
+ }, [
1155
+ s("h4", xn, h(t.title), 1),
1156
+ t.items.length > 0 ? (p(), f("ol", Nn, [
1157
+ (p(!0), f(U, null, H(t.items, (c) => (p(), f("li", {
1158
+ key: c.key,
1159
+ class: "perf-panel__top-item"
1160
+ }, [
1161
+ s("span", {
1162
+ class: "perf-panel__top-label",
1163
+ title: c.label
1164
+ }, h(c.label), 9, Pn),
1165
+ s("span", Fn, h(c.count), 1)
1166
+ ]))), 128))
1167
+ ])) : (p(), f("p", On, "暂无"))
1168
+ ]))), 128))
1169
+ ])
1170
+ ]),
1171
+ s("section", An, [
1172
+ s("div", Dn, [
1173
+ s("div", qn, [
1174
+ n[9] || (n[9] = s("h3", { class: "perf-panel__section-title" }, "明细", -1)),
1175
+ s("span", Un, "共 " + h(se.value) + " 条", 1)
1176
+ ]),
1177
+ dt(s("input", {
1178
+ "onUpdate:modelValue": n[0] || (n[0] = (t) => q.value = t),
1179
+ class: "perf-panel__search",
1180
+ type: "search",
1181
+ placeholder: "搜索 URL / Query / 消息 / 事件名",
1182
+ "aria-label": "搜索明细"
1183
+ }, null, 512), [
1184
+ [_t, q.value]
1185
+ ])
1186
+ ]),
1187
+ s("div", Vn, [
1188
+ (p(), f(U, null, H(C, (t) => s("button", {
1189
+ key: t.tab,
1190
+ class: B(["perf-panel__tab", { "perf-panel__tab--active": t.tab === O.value }]),
1191
+ type: "button",
1192
+ role: "tab",
1193
+ "aria-selected": t.tab === O.value,
1194
+ "data-tab": t.tab,
1195
+ onClick: (c) => Ye(t.tab)
1196
+ }, [
1197
+ Me(h(t.label) + " ", 1),
1198
+ s("span", Bn, h(We(t.tab)), 1)
1199
+ ], 10, zn)), 64))
1200
+ ]),
1201
+ s("div", Hn, [
1202
+ ke.value.length > 0 ? (p(), f("table", jn, [
1203
+ s("thead", null, [
1204
+ s("tr", null, [
1205
+ (p(!0), f(U, null, H(Te.value, (t) => (p(), f("th", {
1206
+ key: t.key,
1207
+ scope: "col",
1208
+ "data-column": t.key
1209
+ }, h(t.label), 9, Gn))), 128))
1210
+ ])
1211
+ ]),
1212
+ s("tbody", null, [
1213
+ (p(!0), f(U, null, H(ke.value, (t) => (p(), f("tr", {
1214
+ key: t.id,
1215
+ class: B(Ge(t))
1216
+ }, [
1217
+ (p(!0), f(U, null, H(Te.value, (c) => (p(), f("td", {
1218
+ key: c.key,
1219
+ class: B(je(t, c)),
1220
+ "data-column": c.key,
1221
+ "data-tone": Ce(t, c),
1222
+ title: de(t, c)
1223
+ }, [
1224
+ c.kind === "chip" ? (p(), f("span", {
1225
+ key: 0,
1226
+ class: B(["perf-panel__chip", `perf-panel__chip--${He(t, c)}`])
1227
+ }, h(de(t, c)), 3)) : (p(), f("span", Yn, h(de(t, c)), 1))
1228
+ ], 10, Wn))), 128))
1229
+ ], 2))), 128))
1230
+ ])
1231
+ ])) : (p(), f("p", Qn, "当前分类暂无数据"))
1232
+ ]),
1233
+ se.value > 0 ? (p(), f("div", Jn, [
1234
+ s("span", Xn, "第 " + h(L.value) + " / " + h(re.value) + " 页,共 " + h(se.value) + " 条", 1),
1235
+ s("div", Kn, [
1236
+ s("button", {
1237
+ class: "perf-panel__button",
1238
+ type: "button",
1239
+ "data-action": "prev-page",
1240
+ disabled: L.value <= 1,
1241
+ onClick: Qe
1242
+ }, " 上一页 ", 8, Zn),
1243
+ s("button", {
1244
+ class: "perf-panel__button",
1245
+ type: "button",
1246
+ "data-action": "next-page",
1247
+ disabled: L.value >= re.value,
1248
+ onClick: Je
1249
+ }, " 下一页 ", 8, ea)
1250
+ ])
1251
+ ])) : W("", !0)
1252
+ ])
1253
+ ], 64))
1254
+ ], 64))
1255
+ ]));
1256
+ }
1257
+ }), na = (a, o) => {
1258
+ const r = a.__vccOpts || a;
1259
+ for (const [l, b] of o)
1260
+ r[l] = b;
1261
+ return r;
1262
+ }, ia = /* @__PURE__ */ na(ta, [["__scopeId", "data-v-0a9a1651"]]);
1263
+ export {
1264
+ ia as PerfPanel
1265
+ };
1266
+ //# sourceMappingURL=index.js.map