@websublime/vite-plugin-open-api-devtools 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,847 @@
1
+ import { ref as T, computed as v, defineComponent as ue, createElementBlock as u, openBlock as o, createVNode as x, createElementVNode as e, unref as a, normalizeClass as R, toDisplayString as c, createCommentVNode as k, createTextVNode as A, createBlock as $, resolveDynamicComponent as S, withDirectives as V, Fragment as M, renderList as j, vShow as W, withModifiers as me, onMounted as pe, onUnmounted as he, watch as ge } from "vue";
2
+ import { g as fe, C as N, a as Z, S as ye, X as _e, F as be, b as xe } from "./format-CE7KDbll.js";
3
+ import { c as de, C as P, Z as ve, _ as ce, u as ke } from "./main-AUiFaD93.js";
4
+ import { T as qe, a as Ce } from "./triangle-alert-ZH4fYFnz.js";
5
+ import { defineStore as $e } from "pinia";
6
+ const oe = de("check", [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]]);
7
+ const Se = de("circle-check-big", [
8
+ ["path", { d: "M21.801 10A10 10 0 1 1 17 3.335", key: "yps3ct" }],
9
+ ["path", { d: "m9 11 3 3L22 4", key: "1pflzl" }]
10
+ ]);
11
+ const re = de("copy", [
12
+ ["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
13
+ ["path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2", key: "zix9uf" }]
14
+ ]), Te = $e("timeline", () => {
15
+ const n = T([]), s = T(!1), r = T(null), d = T({
16
+ methods: [],
17
+ statusCodes: [],
18
+ searchQuery: "",
19
+ simulatedOnly: null
20
+ }), q = T(null), g = T(500), p = /* @__PURE__ */ new Map();
21
+ function z(t) {
22
+ return t < 200 ? "1xx" : t < 300 ? "2xx" : t < 400 ? "3xx" : t < 500 ? "4xx" : "5xx";
23
+ }
24
+ const H = v(() => {
25
+ let t = n.value;
26
+ if (d.value.searchQuery.trim()) {
27
+ const i = d.value.searchQuery.toLowerCase().trim();
28
+ t = t.filter((m) => m.request.path.toLowerCase().includes(i) || m.request.operationId.toLowerCase().includes(i));
29
+ }
30
+ return d.value.methods.length > 0 && (t = t.filter(
31
+ (i) => d.value.methods.includes(i.request.method.toUpperCase())
32
+ )), d.value.statusCodes.length > 0 && (t = t.filter((i) => {
33
+ if (i.status === null) return !1;
34
+ const m = z(i.status);
35
+ return d.value.statusCodes.includes(m);
36
+ })), d.value.simulatedOnly !== null && (t = t.filter((i) => i.simulated === d.value.simulatedOnly)), t;
37
+ }), B = v(() => q.value ? n.value.find((t) => t.id === q.value) ?? null : null), Q = v(() => n.value.length), O = v(() => n.value.filter((t) => t.response !== null).length), D = v(() => n.value.filter((t) => t.response === null).length), w = v(() => {
38
+ const t = {
39
+ "1xx": 0,
40
+ "2xx": 0,
41
+ "3xx": 0,
42
+ "4xx": 0,
43
+ "5xx": 0
44
+ };
45
+ for (const i of n.value)
46
+ if (i.status !== null) {
47
+ const m = z(i.status);
48
+ t[m]++;
49
+ }
50
+ return t;
51
+ }), L = v(() => {
52
+ const t = n.value.filter((m) => m.duration !== null);
53
+ if (t.length === 0) return 0;
54
+ const i = t.reduce((m, E) => m + (E.duration ?? 0), 0);
55
+ return Math.round(i / t.length);
56
+ });
57
+ function U(t) {
58
+ const i = {
59
+ id: t.id,
60
+ request: t,
61
+ response: null,
62
+ status: null,
63
+ duration: null,
64
+ simulated: !1
65
+ }, m = p.get(t.id);
66
+ m && (l(i, m), p.delete(t.id)), n.value.unshift(i), n.value.length > g.value && (n.value = n.value.slice(0, g.value));
67
+ }
68
+ function b(t) {
69
+ const i = n.value.find((m) => m.id === t.requestId);
70
+ if (i)
71
+ l(i, t), p.delete(t.requestId);
72
+ else if (p.set(t.requestId, t), p.size > 100) {
73
+ const m = f(t);
74
+ n.value.unshift(m), p.delete(t.requestId), n.value.length > g.value && (n.value = n.value.slice(0, g.value));
75
+ }
76
+ }
77
+ function l(t, i) {
78
+ t.response = i, t.status = i.status, t.duration = i.duration, t.simulated = i.simulated;
79
+ }
80
+ function f(t) {
81
+ const i = {
82
+ id: t.requestId,
83
+ method: "UNKNOWN",
84
+ path: "/unknown",
85
+ operationId: "unknown",
86
+ timestamp: Date.now(),
87
+ // Use current time as fallback
88
+ headers: {},
89
+ query: {},
90
+ body: void 0
91
+ };
92
+ return {
93
+ id: t.requestId,
94
+ request: i,
95
+ response: t,
96
+ status: t.status,
97
+ duration: t.duration,
98
+ simulated: t.simulated
99
+ };
100
+ }
101
+ function C(t) {
102
+ for (const [i, m] of p) {
103
+ const E = t.get(i);
104
+ E ? (l(E, m), p.delete(i)) : (t.set(i, f(m)), p.delete(i));
105
+ }
106
+ }
107
+ function se(t, i) {
108
+ for (const [m, E] of i) {
109
+ const I = t.get(m);
110
+ I ? l(I, E) : p.set(m, E);
111
+ }
112
+ }
113
+ function ne(t) {
114
+ for (const [i, m] of p)
115
+ t.has(i) || (t.set(i, f(m)), p.delete(i));
116
+ }
117
+ function ie(t) {
118
+ const i = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map();
119
+ for (const I of t.entries)
120
+ if (I.type === "request") {
121
+ const F = I.data;
122
+ i.set(F.id, {
123
+ id: F.id,
124
+ request: F,
125
+ response: null,
126
+ status: null,
127
+ duration: null,
128
+ simulated: !1
129
+ });
130
+ } else if (I.type === "response") {
131
+ const F = I.data;
132
+ m.set(F.requestId, F);
133
+ }
134
+ C(i), se(i, m), ne(i);
135
+ const E = Array.from(i.values()).sort(
136
+ (I, F) => F.request.timestamp - I.request.timestamp
137
+ );
138
+ n.value = E.slice(0, g.value), r.value = null;
139
+ }
140
+ function G() {
141
+ n.value = [], q.value = null, p.clear();
142
+ }
143
+ function le(t) {
144
+ s.value = t;
145
+ }
146
+ function J(t) {
147
+ r.value = t, s.value = !1;
148
+ }
149
+ function K() {
150
+ r.value = null;
151
+ }
152
+ function X(t) {
153
+ d.value.searchQuery = t;
154
+ }
155
+ function Y(t) {
156
+ const i = d.value.methods.indexOf(t);
157
+ i === -1 ? d.value.methods.push(t) : d.value.methods.splice(i, 1);
158
+ }
159
+ function ee(t) {
160
+ const i = d.value.statusCodes.indexOf(t);
161
+ i === -1 ? d.value.statusCodes.push(t) : d.value.statusCodes.splice(i, 1);
162
+ }
163
+ function te(t) {
164
+ d.value.simulatedOnly = t;
165
+ }
166
+ function y() {
167
+ d.value = {
168
+ methods: [],
169
+ statusCodes: [],
170
+ searchQuery: "",
171
+ simulatedOnly: null
172
+ };
173
+ }
174
+ function _() {
175
+ return d.value.searchQuery.trim() !== "" || d.value.methods.length > 0 || d.value.statusCodes.length > 0 || d.value.simulatedOnly !== null;
176
+ }
177
+ function h(t) {
178
+ q.value = t;
179
+ }
180
+ function ae(t) {
181
+ const i = Math.max(1, t);
182
+ g.value = i, n.value.length > i && (n.value = n.value.slice(0, i));
183
+ }
184
+ return {
185
+ // State
186
+ entries: n,
187
+ isLoading: s,
188
+ error: r,
189
+ filter: d,
190
+ selectedEntryId: q,
191
+ maxEntries: g,
192
+ // Getters
193
+ filteredEntries: H,
194
+ selectedEntry: B,
195
+ totalCount: Q,
196
+ completedCount: O,
197
+ pendingCount: D,
198
+ statusCounts: w,
199
+ averageDuration: L,
200
+ // Actions
201
+ addRequest: U,
202
+ addResponse: b,
203
+ setTimelineData: ie,
204
+ clearTimeline: G,
205
+ setLoading: le,
206
+ setError: J,
207
+ clearError: K,
208
+ setSearchQuery: X,
209
+ toggleMethodFilter: Y,
210
+ toggleStatusFilter: ee,
211
+ setSimulatedFilter: te,
212
+ clearFilters: y,
213
+ hasActiveFilters: _,
214
+ selectEntry: h,
215
+ setMaxEntries: ae
216
+ };
217
+ }), Be = { class: "timeline-detail" }, we = {
218
+ key: 0,
219
+ class: "timeline-detail__empty"
220
+ }, Ee = {
221
+ key: 1,
222
+ class: "timeline-detail__content"
223
+ }, Ie = { class: "timeline-detail__header" }, Re = { class: "timeline-detail__summary" }, ze = { class: "timeline-detail__path font-mono" }, Oe = { class: "timeline-detail__meta" }, De = {
224
+ key: 1,
225
+ class: "status-badge status-badge--pending"
226
+ }, Fe = { class: "timeline-detail__duration" }, He = {
227
+ key: 2,
228
+ class: "timeline-detail__simulated",
229
+ title: "Simulated response"
230
+ }, Qe = { class: "timeline-detail__actions" }, Le = { class: "timeline-detail__info" }, Me = { class: "timeline-detail__info-item" }, Ae = { class: "timeline-detail__info-value font-mono" }, Ne = { class: "timeline-detail__info-item" }, je = { class: "timeline-detail__info-value font-mono" }, Pe = { class: "timeline-detail__info-item" }, Ue = { class: "timeline-detail__info-value font-mono" }, Je = { class: "timeline-detail__section" }, Ve = {
231
+ key: 0,
232
+ class: "timeline-detail__subsection"
233
+ }, We = ["aria-expanded"], Ze = { class: "text-muted" }, Ge = {
234
+ id: "requestQuery-panel",
235
+ class: "timeline-detail__subsection-content"
236
+ }, Ke = { class: "timeline-detail__kv-key font-mono" }, Xe = { class: "timeline-detail__kv-value font-mono" }, Ye = {
237
+ key: 1,
238
+ class: "timeline-detail__subsection"
239
+ }, et = ["aria-expanded"], tt = { class: "text-muted" }, st = {
240
+ id: "requestHeaders-panel",
241
+ class: "timeline-detail__subsection-content"
242
+ }, nt = { class: "timeline-detail__kv-key font-mono" }, it = { class: "timeline-detail__kv-value font-mono" }, lt = {
243
+ key: 2,
244
+ class: "timeline-detail__subsection"
245
+ }, at = {
246
+ class: "timeline-detail__subsection-header",
247
+ role: "group"
248
+ }, ot = ["aria-expanded"], rt = {
249
+ id: "requestBody-panel",
250
+ class: "timeline-detail__subsection-content"
251
+ }, ut = { class: "timeline-detail__json" }, dt = {
252
+ key: 0,
253
+ class: "timeline-detail__section"
254
+ }, ct = {
255
+ key: 0,
256
+ class: "timeline-detail__subsection"
257
+ }, mt = ["aria-expanded"], yt = { class: "text-muted" }, _t = {
258
+ id: "responseHeaders-panel",
259
+ class: "timeline-detail__subsection-content"
260
+ }, ft = { class: "timeline-detail__kv-key font-mono" }, vt = { class: "timeline-detail__kv-value font-mono" }, pt = {
261
+ key: 1,
262
+ class: "timeline-detail__subsection"
263
+ }, ht = {
264
+ class: "timeline-detail__subsection-header",
265
+ role: "group"
266
+ }, gt = ["aria-expanded"], bt = {
267
+ id: "responseBody-panel",
268
+ class: "timeline-detail__subsection-content"
269
+ }, xt = { class: "timeline-detail__json" }, kt = {
270
+ key: 1,
271
+ class: "timeline-detail__section timeline-detail__section--pending"
272
+ }, qt = { class: "timeline-detail__pending" }, Ct = /* @__PURE__ */ ue({
273
+ __name: "TimelineDetail",
274
+ props: {
275
+ entry: {}
276
+ },
277
+ setup(n) {
278
+ const s = n, r = T({
279
+ requestHeaders: !0,
280
+ requestQuery: !0,
281
+ requestBody: !0,
282
+ responseHeaders: !0,
283
+ responseBody: !0
284
+ }), d = T(null), q = v(() => s.entry ? new Date(s.entry.request.timestamp).toLocaleString("en-US", {
285
+ year: "numeric",
286
+ month: "short",
287
+ day: "numeric",
288
+ hour: "2-digit",
289
+ minute: "2-digit",
290
+ second: "2-digit",
291
+ fractionalSecondDigits: 3,
292
+ hour12: !1
293
+ }) : ""), g = v(() => s.entry?.duration == null ? "pending..." : s.entry.duration < 1e3 ? `${s.entry.duration}ms` : `${(s.entry.duration / 1e3).toFixed(2)}s`), p = v(() => s.entry?.status ? s.entry.status < 200 ? "status-badge--1xx" : s.entry.status < 300 ? "status-badge--2xx" : s.entry.status < 400 ? "status-badge--3xx" : s.entry.status < 500 ? "status-badge--4xx" : "status-badge--5xx" : "status-badge--pending"), z = v(() => s.entry?.request.query ? Object.keys(s.entry.request.query).length > 0 : !1), H = v(() => s.entry?.request.headers ? Object.keys(s.entry.request.headers).length > 0 : !1), B = v(() => s.entry?.request.body !== void 0 && s.entry?.request.body !== null), Q = v(() => s.entry?.response?.headers ? Object.keys(s.entry.response.headers).length > 0 : !1), O = v(() => s.entry?.response?.body !== void 0 && s.entry?.response?.body !== null);
294
+ function D(b) {
295
+ try {
296
+ return JSON.stringify(b, null, 2);
297
+ } catch {
298
+ return String(b);
299
+ }
300
+ }
301
+ function w(b) {
302
+ r.value[b] = !r.value[b];
303
+ }
304
+ async function L(b, l) {
305
+ try {
306
+ await navigator.clipboard.writeText(b), d.value = l, setTimeout(() => {
307
+ d.value = null;
308
+ }, 2e3);
309
+ } catch (f) {
310
+ console.error("Failed to copy:", f);
311
+ }
312
+ }
313
+ async function U() {
314
+ if (!s.entry) return;
315
+ const b = {
316
+ request: s.entry.request,
317
+ response: s.entry.response
318
+ };
319
+ await L(JSON.stringify(b, null, 2), "full");
320
+ }
321
+ return (b, l) => (o(), u("div", Be, [
322
+ n.entry ? (o(), u("div", Ee, [
323
+ e("div", Ie, [
324
+ e("div", Re, [
325
+ e("span", {
326
+ class: R(["method-badge", `method-badge--${n.entry.request.method.toLowerCase()}`])
327
+ }, c(a(fe)(n.entry.request.method)), 3),
328
+ e("span", ze, c(n.entry.request.path), 1)
329
+ ]),
330
+ e("div", Oe, [
331
+ n.entry.status !== null ? (o(), u("span", {
332
+ key: 0,
333
+ class: R(["status-badge", p.value])
334
+ }, c(n.entry.status), 3)) : (o(), u("span", De, "pending")),
335
+ e("span", Fe, [
336
+ x(a(P), { size: 14 }),
337
+ A(" " + c(g.value), 1)
338
+ ]),
339
+ n.entry.simulated ? (o(), u("span", He, [
340
+ x(a(ve), { size: 14 }),
341
+ l[9] || (l[9] = A(" Simulated ", -1))
342
+ ])) : k("", !0)
343
+ ]),
344
+ e("div", Qe, [
345
+ e("button", {
346
+ type: "button",
347
+ class: "btn btn--ghost btn--sm",
348
+ title: "Copy as JSON",
349
+ onClick: U
350
+ }, [
351
+ (o(), $(S(d.value === "full" ? a(oe) : a(re)), { size: 14 })),
352
+ A(" " + c(d.value === "full" ? "Copied!" : "Copy JSON"), 1)
353
+ ])
354
+ ])
355
+ ]),
356
+ e("div", Le, [
357
+ e("div", Me, [
358
+ l[10] || (l[10] = e("span", { class: "timeline-detail__info-label" }, "Timestamp", -1)),
359
+ e("span", Ae, c(q.value), 1)
360
+ ]),
361
+ e("div", Ne, [
362
+ l[11] || (l[11] = e("span", { class: "timeline-detail__info-label" }, "Operation ID", -1)),
363
+ e("span", je, c(n.entry.request.operationId), 1)
364
+ ]),
365
+ e("div", Pe, [
366
+ l[12] || (l[12] = e("span", { class: "timeline-detail__info-label" }, "Request ID", -1)),
367
+ e("span", Ue, c(n.entry.id), 1)
368
+ ])
369
+ ]),
370
+ e("div", Je, [
371
+ l[16] || (l[16] = e("h3", { class: "timeline-detail__section-title" }, "Request", -1)),
372
+ z.value ? (o(), u("div", Ve, [
373
+ e("button", {
374
+ type: "button",
375
+ class: "timeline-detail__subsection-header",
376
+ "aria-expanded": r.value.requestQuery,
377
+ "aria-controls": "requestQuery-panel",
378
+ onClick: l[0] || (l[0] = (f) => w("requestQuery"))
379
+ }, [
380
+ (o(), $(S(r.value.requestQuery ? a(N) : a(Z)), { size: 16 })),
381
+ l[13] || (l[13] = e("span", null, "Query Parameters", -1)),
382
+ e("span", Ze, "(" + c(Object.keys(n.entry.request.query).length) + ")", 1)
383
+ ], 8, We),
384
+ V(e("div", Ge, [
385
+ (o(!0), u(M, null, j(n.entry.request.query, (f, C) => (o(), u("div", {
386
+ key: C,
387
+ class: "timeline-detail__kv-row"
388
+ }, [
389
+ e("span", Ke, c(C), 1),
390
+ e("span", Xe, c(Array.isArray(f) ? f.join(", ") : f), 1)
391
+ ]))), 128))
392
+ ], 512), [
393
+ [W, r.value.requestQuery]
394
+ ])
395
+ ])) : k("", !0),
396
+ H.value ? (o(), u("div", Ye, [
397
+ e("button", {
398
+ type: "button",
399
+ class: "timeline-detail__subsection-header",
400
+ "aria-expanded": r.value.requestHeaders,
401
+ "aria-controls": "requestHeaders-panel",
402
+ onClick: l[1] || (l[1] = (f) => w("requestHeaders"))
403
+ }, [
404
+ (o(), $(S(r.value.requestHeaders ? a(N) : a(Z)), { size: 16 })),
405
+ l[14] || (l[14] = e("span", null, "Headers", -1)),
406
+ e("span", tt, "(" + c(Object.keys(n.entry.request.headers).length) + ")", 1)
407
+ ], 8, et),
408
+ V(e("div", st, [
409
+ (o(!0), u(M, null, j(n.entry.request.headers, (f, C) => (o(), u("div", {
410
+ key: C,
411
+ class: "timeline-detail__kv-row"
412
+ }, [
413
+ e("span", nt, c(C), 1),
414
+ e("span", it, c(f), 1)
415
+ ]))), 128))
416
+ ], 512), [
417
+ [W, r.value.requestHeaders]
418
+ ])
419
+ ])) : k("", !0),
420
+ B.value ? (o(), u("div", lt, [
421
+ e("div", at, [
422
+ e("button", {
423
+ type: "button",
424
+ class: "timeline-detail__subsection-toggle",
425
+ "aria-expanded": r.value.requestBody,
426
+ "aria-controls": "requestBody-panel",
427
+ onClick: l[2] || (l[2] = (f) => w("requestBody"))
428
+ }, [
429
+ (o(), $(S(r.value.requestBody ? a(N) : a(Z)), { size: 16 })),
430
+ l[15] || (l[15] = e("span", null, "Body", -1))
431
+ ], 8, ot),
432
+ e("button", {
433
+ type: "button",
434
+ class: "btn btn--ghost btn--icon btn--sm",
435
+ title: "Copy body",
436
+ onClick: l[3] || (l[3] = me((f) => L(D(n.entry.request.body), "reqBody"), ["stop"]))
437
+ }, [
438
+ (o(), $(S(d.value === "reqBody" ? a(oe) : a(re)), { size: 12 }))
439
+ ])
440
+ ]),
441
+ V(e("div", rt, [
442
+ e("pre", ut, c(D(n.entry.request.body)), 1)
443
+ ], 512), [
444
+ [W, r.value.requestBody]
445
+ ])
446
+ ])) : k("", !0)
447
+ ]),
448
+ n.entry.response ? (o(), u("div", dt, [
449
+ l[19] || (l[19] = e("h3", { class: "timeline-detail__section-title" }, "Response", -1)),
450
+ Q.value ? (o(), u("div", ct, [
451
+ e("button", {
452
+ type: "button",
453
+ class: "timeline-detail__subsection-header",
454
+ "aria-expanded": r.value.responseHeaders,
455
+ "aria-controls": "responseHeaders-panel",
456
+ onClick: l[4] || (l[4] = (f) => w("responseHeaders"))
457
+ }, [
458
+ (o(), $(S(r.value.responseHeaders ? a(N) : a(Z)), { size: 16 })),
459
+ l[17] || (l[17] = e("span", null, "Headers", -1)),
460
+ e("span", yt, "(" + c(Object.keys(n.entry.response.headers).length) + ")", 1)
461
+ ], 8, mt),
462
+ V(e("div", _t, [
463
+ (o(!0), u(M, null, j(n.entry.response.headers, (f, C) => (o(), u("div", {
464
+ key: C,
465
+ class: "timeline-detail__kv-row"
466
+ }, [
467
+ e("span", ft, c(C), 1),
468
+ e("span", vt, c(f), 1)
469
+ ]))), 128))
470
+ ], 512), [
471
+ [W, r.value.responseHeaders]
472
+ ])
473
+ ])) : k("", !0),
474
+ O.value ? (o(), u("div", pt, [
475
+ e("div", ht, [
476
+ e("button", {
477
+ type: "button",
478
+ class: "timeline-detail__subsection-toggle",
479
+ "aria-expanded": r.value.responseBody,
480
+ "aria-controls": "responseBody-panel",
481
+ onClick: l[5] || (l[5] = (f) => w("responseBody"))
482
+ }, [
483
+ (o(), $(S(r.value.responseBody ? a(N) : a(Z)), { size: 16 })),
484
+ l[18] || (l[18] = e("span", null, "Body", -1))
485
+ ], 8, gt),
486
+ e("button", {
487
+ type: "button",
488
+ class: "btn btn--ghost btn--icon btn--sm",
489
+ title: "Copy body",
490
+ onClick: l[6] || (l[6] = me((f) => L(D(n.entry.response.body), "resBody"), ["stop"]))
491
+ }, [
492
+ (o(), $(S(d.value === "resBody" ? a(oe) : a(re)), { size: 12 }))
493
+ ])
494
+ ]),
495
+ V(e("div", bt, [
496
+ e("pre", xt, c(D(n.entry.response.body)), 1)
497
+ ], 512), [
498
+ [W, r.value.responseBody]
499
+ ])
500
+ ])) : k("", !0)
501
+ ])) : (o(), u("div", kt, [
502
+ l[21] || (l[21] = e("h3", { class: "timeline-detail__section-title" }, "Response", -1)),
503
+ e("div", qt, [
504
+ x(a(P), {
505
+ size: 24,
506
+ class: "timeline-detail__pending-icon"
507
+ }),
508
+ l[20] || (l[20] = e("span", { class: "text-muted" }, "Waiting for response...", -1))
509
+ ])
510
+ ]))
511
+ ])) : (o(), u("div", we, [
512
+ x(a(P), {
513
+ size: 48,
514
+ class: "timeline-detail__empty-icon"
515
+ }),
516
+ l[7] || (l[7] = e("h3", { class: "timeline-detail__empty-title" }, "Select an entry", -1)),
517
+ l[8] || (l[8] = e("p", { class: "timeline-detail__empty-description" }, " Click on a timeline entry to view its details. ", -1))
518
+ ]))
519
+ ]));
520
+ }
521
+ }), $t = /* @__PURE__ */ ce(Ct, [["__scopeId", "data-v-b4bdd2d2"]]), St = { class: "timeline-entry__time font-mono text-muted" }, Tt = { class: "timeline-entry__method" }, Bt = { class: "timeline-entry__path font-mono" }, wt = { class: "timeline-entry__status" }, Et = {
522
+ key: 1,
523
+ class: "status-badge status-badge--pending"
524
+ }, It = { class: "timeline-entry__duration font-mono text-muted" }, Rt = {
525
+ key: 0,
526
+ class: "timeline-entry__simulated",
527
+ title: "Simulated response"
528
+ }, zt = /* @__PURE__ */ ue({
529
+ __name: "TimelineEntry",
530
+ props: {
531
+ entry: {},
532
+ isSelected: { type: Boolean, default: !1 }
533
+ },
534
+ emits: ["select"],
535
+ setup(n, { emit: s }) {
536
+ const r = n, d = s, q = v(() => new Date(r.entry.request.timestamp).toLocaleTimeString("en-US", {
537
+ hour12: !1,
538
+ hour: "2-digit",
539
+ minute: "2-digit",
540
+ second: "2-digit",
541
+ fractionalSecondDigits: 3
542
+ })), g = v(() => r.entry.duration === null ? "pending..." : r.entry.duration < 1e3 ? `${r.entry.duration}ms` : `${(r.entry.duration / 1e3).toFixed(2)}s`), p = v(() => r.entry.status === null ? "status-badge--pending" : r.entry.status < 200 ? "status-badge--1xx" : r.entry.status < 300 ? "status-badge--2xx" : r.entry.status < 400 ? "status-badge--3xx" : r.entry.status < 500 ? "status-badge--4xx" : "status-badge--5xx"), z = v(() => r.entry.status === null ? P : r.entry.status < 400 ? Se : qe), H = v(() => r.entry.response === null);
543
+ function B() {
544
+ d("select", r.entry.id);
545
+ }
546
+ return (Q, O) => (o(), u("button", {
547
+ type: "button",
548
+ class: R([
549
+ "timeline-entry",
550
+ { "timeline-entry--selected": n.isSelected },
551
+ { "timeline-entry--pending": H.value },
552
+ { "timeline-entry--simulated": n.entry.simulated }
553
+ ]),
554
+ onClick: B
555
+ }, [
556
+ e("div", St, c(q.value), 1),
557
+ e("div", Tt, [
558
+ e("span", {
559
+ class: R(["method-badge", `method-badge--${n.entry.request.method.toLowerCase()}`])
560
+ }, c(a(fe)(n.entry.request.method)), 3)
561
+ ]),
562
+ e("div", Bt, c(n.entry.request.path), 1),
563
+ e("div", wt, [
564
+ n.entry.status !== null ? (o(), u("span", {
565
+ key: 0,
566
+ class: R(["status-badge", p.value])
567
+ }, [
568
+ (o(), $(S(z.value), { size: 12 })),
569
+ A(" " + c(n.entry.status), 1)
570
+ ], 2)) : (o(), u("span", Et, [
571
+ x(a(P), { size: 12 }),
572
+ O[0] || (O[0] = A(" pending ", -1))
573
+ ]))
574
+ ]),
575
+ e("div", It, c(g.value), 1),
576
+ n.entry.simulated ? (o(), u("div", Rt, [
577
+ x(a(ve), { size: 14 })
578
+ ])) : k("", !0)
579
+ ], 2));
580
+ }
581
+ }), Ot = /* @__PURE__ */ ce(zt, [["__scopeId", "data-v-a073dbdf"]]), Dt = { class: "timeline-page" }, Ft = { class: "timeline-toolbar" }, Ht = { class: "timeline-search" }, Qt = ["value"], Lt = ["aria-expanded"], Mt = {
582
+ key: 0,
583
+ class: "timeline-filter-toggle__badge"
584
+ }, At = { class: "timeline-stats" }, Nt = { class: "timeline-stats__item" }, jt = {
585
+ key: 0,
586
+ class: "timeline-stats__separator"
587
+ }, Pt = {
588
+ key: 1,
589
+ class: "timeline-stats__item"
590
+ }, Ut = ["disabled"], Jt = {
591
+ key: 0,
592
+ class: "timeline-filters"
593
+ }, Vt = { class: "timeline-filters__section" }, Wt = { class: "timeline-filters__methods" }, Zt = ["onClick"], Gt = { class: "timeline-filters__section" }, Kt = { class: "timeline-filters__status" }, Xt = ["onClick"], Yt = { class: "timeline-filters__status-count" }, es = { class: "timeline-filters__section" }, ts = { class: "timeline-filters__type" }, ss = {
594
+ key: 0,
595
+ class: "timeline-filters__actions"
596
+ }, ns = { class: "timeline-content" }, is = {
597
+ key: 0,
598
+ class: "timeline-loading"
599
+ }, ls = {
600
+ key: 1,
601
+ class: "timeline-error"
602
+ }, as = { class: "timeline-error__message" }, os = {
603
+ key: 2,
604
+ class: "timeline-empty empty-state"
605
+ }, rs = {
606
+ key: 3,
607
+ class: "timeline-empty empty-state"
608
+ }, us = { class: "timeline-list-panel" }, ds = { class: "timeline-list" }, cs = { class: "timeline-detail-panel" }, ms = /* @__PURE__ */ ue({
609
+ __name: "TimelinePage",
610
+ setup(n) {
611
+ const s = Te(), { send: r, on: d, connected: q } = ke(), g = T(!1), p = T(null), z = [
612
+ "GET",
613
+ "POST",
614
+ "PUT",
615
+ "PATCH",
616
+ "DELETE",
617
+ "OPTIONS",
618
+ "HEAD",
619
+ "TRACE"
620
+ ], H = ["2xx", "3xx", "4xx", "5xx"];
621
+ function B() {
622
+ q.value && (s.setLoading(!0), r({ type: "get:timeline" }));
623
+ }
624
+ function Q(y) {
625
+ s.setTimelineData(y), s.setLoading(!1);
626
+ }
627
+ function O(y) {
628
+ s.addRequest(y);
629
+ }
630
+ function D(y) {
631
+ s.addResponse(y);
632
+ }
633
+ function w() {
634
+ s.clearTimeline();
635
+ }
636
+ function L() {
637
+ r({ type: "clear:timeline" }), s.clearTimeline();
638
+ }
639
+ function U(y) {
640
+ s.selectEntry(y);
641
+ }
642
+ function b(y) {
643
+ const _ = y.target;
644
+ s.setSearchQuery(_.value);
645
+ }
646
+ function l() {
647
+ s.setSearchQuery(""), p.value?.focus();
648
+ }
649
+ function f(y) {
650
+ s.toggleMethodFilter(y);
651
+ }
652
+ function C(y) {
653
+ return s.filter.methods.includes(y);
654
+ }
655
+ function se(y) {
656
+ s.toggleStatusFilter(y);
657
+ }
658
+ function ne(y) {
659
+ return s.filter.statusCodes.includes(y);
660
+ }
661
+ function ie() {
662
+ const y = s.filter.simulatedOnly;
663
+ s.setSimulatedFilter(y === !0 ? null : !0);
664
+ }
665
+ function G() {
666
+ s.clearFilters();
667
+ }
668
+ function le() {
669
+ g.value = !g.value;
670
+ }
671
+ const J = v(() => s.hasActiveFilters()), K = v(() => s.filter.methods.length + s.filter.statusCodes.length + (s.filter.simulatedOnly !== null ? 1 : 0));
672
+ let X = null, Y = null, ee = null, te = null;
673
+ return pe(() => {
674
+ X = d("timeline", Q), Y = d("request", O), ee = d("response", D), te = d("timeline:cleared", w), q.value && B();
675
+ }), he(() => {
676
+ X?.(), Y?.(), ee?.(), te?.();
677
+ }), ge(q, (y) => {
678
+ y && B();
679
+ }), (y, _) => (o(), u("div", Dt, [
680
+ e("div", Ft, [
681
+ e("div", Ht, [
682
+ x(a(ye), {
683
+ size: 16,
684
+ class: "timeline-search__icon"
685
+ }),
686
+ e("input", {
687
+ ref_key: "searchInputRef",
688
+ ref: p,
689
+ type: "text",
690
+ class: "timeline-search__input input",
691
+ placeholder: "Search by path or operation...",
692
+ value: a(s).filter.searchQuery,
693
+ onInput: b
694
+ }, null, 40, Qt),
695
+ a(s).filter.searchQuery ? (o(), u("button", {
696
+ key: 0,
697
+ type: "button",
698
+ class: "timeline-search__clear btn btn--ghost btn--icon",
699
+ title: "Clear search",
700
+ onClick: l
701
+ }, [
702
+ x(a(_e), { size: 14 })
703
+ ])) : k("", !0)
704
+ ]),
705
+ e("button", {
706
+ type: "button",
707
+ class: R([
708
+ "timeline-filter-toggle btn btn--secondary",
709
+ { "timeline-filter-toggle--active": J.value }
710
+ ]),
711
+ "aria-expanded": g.value,
712
+ onClick: le
713
+ }, [
714
+ x(a(be), { size: 16 }),
715
+ _[0] || (_[0] = e("span", null, "Filters", -1)),
716
+ K.value > 0 ? (o(), u("span", Mt, c(K.value), 1)) : k("", !0),
717
+ (o(), $(S(g.value ? a(xe) : a(N)), { size: 14 }))
718
+ ], 10, Lt),
719
+ e("div", At, [
720
+ e("span", Nt, c(a(s).filteredEntries.length) + " requests ", 1),
721
+ a(s).averageDuration > 0 ? (o(), u("span", jt, "|")) : k("", !0),
722
+ a(s).averageDuration > 0 ? (o(), u("span", Pt, " avg " + c(a(s).averageDuration) + "ms ", 1)) : k("", !0)
723
+ ]),
724
+ e("button", {
725
+ type: "button",
726
+ class: "btn btn--secondary btn--icon",
727
+ title: "Clear timeline",
728
+ disabled: a(s).entries.length === 0,
729
+ onClick: L
730
+ }, [
731
+ x(a(Ce), { size: 16 })
732
+ ], 8, Ut)
733
+ ]),
734
+ g.value ? (o(), u("div", Jt, [
735
+ e("div", Vt, [
736
+ _[1] || (_[1] = e("h4", { class: "timeline-filters__title" }, "Methods", -1)),
737
+ e("div", Wt, [
738
+ (o(), u(M, null, j(z, (h) => e("button", {
739
+ key: h,
740
+ type: "button",
741
+ class: R([
742
+ "method-badge",
743
+ `method-badge--${h.toLowerCase()}`,
744
+ { "method-badge--inactive": !C(h) && a(s).filter.methods.length > 0 }
745
+ ]),
746
+ onClick: (ae) => f(h)
747
+ }, c(h), 11, Zt)), 64))
748
+ ])
749
+ ]),
750
+ e("div", Gt, [
751
+ _[2] || (_[2] = e("h4", { class: "timeline-filters__title" }, "Status", -1)),
752
+ e("div", Kt, [
753
+ (o(), u(M, null, j(H, (h) => e("button", {
754
+ key: h,
755
+ type: "button",
756
+ class: R([
757
+ "timeline-filters__status-btn",
758
+ `timeline-filters__status-btn--${h}`,
759
+ { "timeline-filters__status-btn--active": ne(h) }
760
+ ]),
761
+ onClick: (ae) => se(h)
762
+ }, [
763
+ A(c(h) + " ", 1),
764
+ e("span", Yt, " (" + c(a(s).statusCounts[h]) + ") ", 1)
765
+ ], 10, Xt)), 64))
766
+ ])
767
+ ]),
768
+ e("div", es, [
769
+ _[3] || (_[3] = e("h4", { class: "timeline-filters__title" }, "Type", -1)),
770
+ e("div", ts, [
771
+ e("button", {
772
+ type: "button",
773
+ class: R([
774
+ "timeline-filters__status-btn",
775
+ { "timeline-filters__status-btn--active": a(s).filter.simulatedOnly }
776
+ ]),
777
+ onClick: ie
778
+ }, " Simulated only ", 2)
779
+ ])
780
+ ]),
781
+ J.value ? (o(), u("div", ss, [
782
+ e("button", {
783
+ type: "button",
784
+ class: "btn btn--ghost",
785
+ onClick: G
786
+ }, [
787
+ x(a(_e), { size: 14 }),
788
+ _[4] || (_[4] = A(" Clear all filters ", -1))
789
+ ])
790
+ ])) : k("", !0)
791
+ ])) : k("", !0),
792
+ e("div", ns, [
793
+ a(s).isLoading ? (o(), u("div", is, [..._[5] || (_[5] = [
794
+ e("div", { class: "timeline-loading__spinner" }, null, -1),
795
+ e("span", { class: "text-muted" }, "Loading timeline...", -1)
796
+ ])])) : a(s).error ? (o(), u("div", ls, [
797
+ e("p", as, c(a(s).error), 1),
798
+ e("button", {
799
+ type: "button",
800
+ class: "btn btn--primary",
801
+ onClick: B
802
+ }, " Retry ")
803
+ ])) : a(s).entries.length === 0 ? (o(), u("div", os, [
804
+ x(a(P), {
805
+ size: 48,
806
+ class: "empty-state__icon"
807
+ }),
808
+ _[6] || (_[6] = e("h3", { class: "empty-state__title" }, "No requests yet", -1)),
809
+ _[7] || (_[7] = e("p", { class: "empty-state__description" }, " API requests will appear here in real-time as they are made. ", -1))
810
+ ])) : a(s).filteredEntries.length === 0 ? (o(), u("div", rs, [
811
+ x(a(ye), {
812
+ size: 48,
813
+ class: "empty-state__icon"
814
+ }),
815
+ _[8] || (_[8] = e("h3", { class: "empty-state__title" }, "No matching requests", -1)),
816
+ _[9] || (_[9] = e("p", { class: "empty-state__description" }, " Try adjusting your search or filters. ", -1)),
817
+ J.value ? (o(), u("button", {
818
+ key: 0,
819
+ type: "button",
820
+ class: "btn btn--secondary",
821
+ onClick: G
822
+ }, " Clear filters ")) : k("", !0)
823
+ ])) : (o(), u(M, { key: 4 }, [
824
+ e("div", us, [
825
+ e("div", ds, [
826
+ (o(!0), u(M, null, j(a(s).filteredEntries, (h) => (o(), $(Ot, {
827
+ key: h.id,
828
+ entry: h,
829
+ "is-selected": a(s).selectedEntryId === h.id,
830
+ onSelect: U
831
+ }, null, 8, ["entry", "is-selected"]))), 128))
832
+ ])
833
+ ]),
834
+ e("div", cs, [
835
+ x($t, {
836
+ entry: a(s).selectedEntry
837
+ }, null, 8, ["entry"])
838
+ ])
839
+ ], 64))
840
+ ])
841
+ ]));
842
+ }
843
+ }), hs = /* @__PURE__ */ ce(ms, [["__scopeId", "data-v-a5c73778"]]);
844
+ export {
845
+ hs as default
846
+ };
847
+ //# sourceMappingURL=TimelinePage-CMchXIlE.js.map