@module-federation/devtools 2.3.3 → 2.5.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.
Files changed (48) hide show
  1. package/README.md +3 -0
  2. package/dist/es/App.js +17 -2
  3. package/dist/es/App_module.css +3 -3
  4. package/dist/es/component/LoadingTrace/index.js +944 -0
  5. package/dist/es/component/LoadingTrace/index.module.js +5 -0
  6. package/dist/es/component/LoadingTrace/index_module.css +876 -0
  7. package/dist/es/i18n/index.js +178 -0
  8. package/dist/es/utils/chrome/fast-refresh.js +297 -173
  9. package/dist/es/utils/chrome/index.js +3 -4
  10. package/dist/es/utils/chrome/messages.js +7 -1
  11. package/dist/es/utils/chrome/observability-plugin.js +93 -0
  12. package/dist/es/utils/chrome/observability-shared.js +99 -0
  13. package/dist/es/utils/chrome/observability.js +208 -0
  14. package/dist/es/utils/chrome/override-remote.js +2 -42
  15. package/dist/es/utils/chrome/post-message-listener.js +14 -0
  16. package/dist/es/utils/chrome/snapshot-plugin.js +2 -36
  17. package/dist/es/utils/data/index.js +5 -25
  18. package/dist/es/vendor/basic-proxy-core.js +155 -0
  19. package/dist/es/worker/index.js +27 -8
  20. package/dist/lib/App.js +17 -2
  21. package/dist/lib/App_module.css +3 -3
  22. package/dist/lib/component/LoadingTrace/index.js +954 -0
  23. package/dist/lib/component/LoadingTrace/index.module.js +25 -0
  24. package/dist/lib/component/LoadingTrace/index_module.css +876 -0
  25. package/dist/lib/i18n/index.js +178 -0
  26. package/dist/lib/utils/chrome/fast-refresh.js +250 -135
  27. package/dist/lib/utils/chrome/index.js +3 -4
  28. package/dist/lib/utils/chrome/messages.js +11 -2
  29. package/dist/lib/utils/chrome/observability-plugin.js +86 -0
  30. package/dist/lib/utils/chrome/observability-shared.js +126 -0
  31. package/dist/lib/utils/chrome/observability.js +234 -0
  32. package/dist/lib/utils/chrome/override-remote.js +5 -52
  33. package/dist/lib/utils/chrome/post-message-listener.js +11 -0
  34. package/dist/lib/utils/chrome/snapshot-plugin.js +5 -46
  35. package/dist/lib/utils/data/index.js +6 -28
  36. package/dist/lib/vendor/basic-proxy-core.js +147 -0
  37. package/dist/lib/worker/index.js +27 -8
  38. package/dist/types/src/component/LoadingTrace/index.d.ts +6 -0
  39. package/dist/types/src/utils/chrome/messages.d.ts +3 -0
  40. package/dist/types/src/utils/chrome/observability-plugin.d.ts +1 -0
  41. package/dist/types/src/utils/chrome/observability-shared.d.ts +41 -0
  42. package/dist/types/src/utils/chrome/observability.d.ts +110 -0
  43. package/dist/types/src/utils/chrome/snapshot-plugin.d.ts +0 -3
  44. package/dist/types/src/utils/data/index.d.ts +0 -1
  45. package/package.json +4 -3
  46. package/dist/es/utils/data/snapshot.js +0 -82
  47. package/dist/lib/utils/data/snapshot.js +0 -107
  48. package/dist/types/src/utils/data/snapshot.d.ts +0 -3
@@ -0,0 +1,954 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __defProps = Object.defineProperties;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
+ var __getProtoOf = Object.getPrototypeOf;
10
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
11
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
+ var __spreadValues = (a, b) => {
14
+ for (var prop in b || (b = {}))
15
+ if (__hasOwnProp.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ if (__getOwnPropSymbols)
18
+ for (var prop of __getOwnPropSymbols(b)) {
19
+ if (__propIsEnum.call(b, prop))
20
+ __defNormalProp(a, prop, b[prop]);
21
+ }
22
+ return a;
23
+ };
24
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
25
+ var __export = (target, all) => {
26
+ for (var name in all)
27
+ __defProp(target, name, { get: all[name], enumerable: true });
28
+ };
29
+ var __copyProps = (to, from, except, desc) => {
30
+ if (from && typeof from === "object" || typeof from === "function") {
31
+ for (let key of __getOwnPropNames(from))
32
+ if (!__hasOwnProp.call(to, key) && key !== except)
33
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
34
+ }
35
+ return to;
36
+ };
37
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
38
+ // If the importer is in node compatibility mode or this is not an ESM
39
+ // file that has been converted to a CommonJS file using a Babel-
40
+ // compatible transform (i.e. "__esModule" has not been set), then set
41
+ // "default" to the CommonJS "module.exports" for node compatibility.
42
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
43
+ mod
44
+ ));
45
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
46
+ var __async = (__this, __arguments, generator) => {
47
+ return new Promise((resolve, reject) => {
48
+ var fulfilled = (value) => {
49
+ try {
50
+ step(generator.next(value));
51
+ } catch (e) {
52
+ reject(e);
53
+ }
54
+ };
55
+ var rejected = (value) => {
56
+ try {
57
+ step(generator.throw(value));
58
+ } catch (e) {
59
+ reject(e);
60
+ }
61
+ };
62
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
63
+ step((generator = generator.apply(__this, __arguments)).next());
64
+ });
65
+ };
66
+ var LoadingTrace_exports = {};
67
+ __export(LoadingTrace_exports, {
68
+ default: () => LoadingTrace_default
69
+ });
70
+ module.exports = __toCommonJS(LoadingTrace_exports);
71
+ var import_jsx_runtime = require("react/jsx-runtime");
72
+ var import_react = require("react");
73
+ var import_web_react = require("@arco-design/web-react");
74
+ var import_icon = require("@arco-design/web-react/icon");
75
+ var import_react_i18next = require("react-i18next");
76
+ var import_observability = require("../../utils/chrome/observability");
77
+ var import_observability_shared = require("../../utils/chrome/observability-shared");
78
+ var import_messages = require("../../utils/chrome/messages");
79
+ var import_index = __toESM(require("./index.module"));
80
+ const FieldLabel = ({ label, tip }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: import_index.default.labelWithHelp, children: [
81
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.labelText, children: label }),
82
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
83
+ "span",
84
+ {
85
+ className: import_index.default.helpIcon,
86
+ "data-tip": tip,
87
+ tabIndex: 0,
88
+ "aria-label": tip,
89
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icon.IconQuestionCircle, {})
90
+ }
91
+ ),
92
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.labelColon, children: ":" })
93
+ ] });
94
+ const SegmentedControl = ({
95
+ value,
96
+ options,
97
+ onChange
98
+ }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.segmentedControl, role: "group", children: options.map((option) => {
99
+ const isActive = option.value === value;
100
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
101
+ "button",
102
+ {
103
+ type: "button",
104
+ className: `${import_index.default.segmentButton} ${isActive ? import_index.default.segmentButtonActive : ""}`,
105
+ "aria-pressed": isActive,
106
+ onClick: () => onChange(option.value),
107
+ children: option.label
108
+ },
109
+ option.value
110
+ );
111
+ }) });
112
+ const formatTime = (timestamp) => {
113
+ if (!timestamp) {
114
+ return "-";
115
+ }
116
+ try {
117
+ return new Date(timestamp).toLocaleTimeString();
118
+ } catch (e) {
119
+ return "-";
120
+ }
121
+ };
122
+ const getReportTitle = (report) => {
123
+ var _a, _b;
124
+ return report.requestId || ((_a = report.remote) == null ? void 0 : _a.name) || ((_b = report.shared) == null ? void 0 : _b.name) || report.traceId || "unknown";
125
+ };
126
+ const getReportOutcome = (report) => {
127
+ var _a;
128
+ return ((_a = report.summary) == null ? void 0 : _a.outcome) || report.status || "pending";
129
+ };
130
+ const parseStableVersion = (version) => {
131
+ const matched = version == null ? void 0 : version.match(/^(\d+)\.(\d+)\.(\d+)(?:\+[\w.-]+)?$/);
132
+ if (!matched) {
133
+ return null;
134
+ }
135
+ return {
136
+ major: Number(matched[1]),
137
+ minor: Number(matched[2]),
138
+ patch: Number(matched[3])
139
+ };
140
+ };
141
+ const isVersionLessThan = (version, target) => {
142
+ if (!version) {
143
+ return false;
144
+ }
145
+ if (version.major !== target.major) {
146
+ return version.major < target.major;
147
+ }
148
+ if (version.minor !== target.minor) {
149
+ return version.minor < target.minor;
150
+ }
151
+ return version.patch < target.patch;
152
+ };
153
+ const getLimitedObservabilityLabel = (report) => {
154
+ const runtimeVersion = parseStableVersion(report.runtimeVersion);
155
+ if (runtimeVersion && isVersionLessThan(runtimeVersion, { major: 2, minor: 5, patch: 0 })) {
156
+ return "lowVersion";
157
+ }
158
+ if (!report.runtimeVersion) {
159
+ return "unknownVersion";
160
+ }
161
+ return void 0;
162
+ };
163
+ const getReportState = (report) => {
164
+ var _a;
165
+ const outcome = getReportOutcome(report);
166
+ const limitedObservability = getLimitedObservabilityLabel(report);
167
+ if (outcome === "recovered" || ((_a = report.summary) == null ? void 0 : _a.recovered)) {
168
+ return "recovered";
169
+ }
170
+ if (report.status === "error" || outcome === "failed" || report.failedPhase || report.errorMessage) {
171
+ return "failed";
172
+ }
173
+ if (outcome === "pending" && report.status === "success" && limitedObservability) {
174
+ return "success";
175
+ }
176
+ if (outcome === "pending") {
177
+ return "pending";
178
+ }
179
+ if (report.status === "success") {
180
+ return "success";
181
+ }
182
+ return "pending";
183
+ };
184
+ const getEventStatusState = (status) => {
185
+ switch (status) {
186
+ case "success":
187
+ case "complete":
188
+ return "success";
189
+ case "error":
190
+ case "failed":
191
+ return "failed";
192
+ case "start":
193
+ case "pending":
194
+ return "pending";
195
+ default:
196
+ return "neutral";
197
+ }
198
+ };
199
+ const getReportSearchText = (report) => {
200
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
201
+ return [
202
+ getReportTitle(report),
203
+ report.traceId,
204
+ report.status,
205
+ getReportOutcome(report),
206
+ report.hostName,
207
+ report.runtimeVersion,
208
+ (_a = report.remote) == null ? void 0 : _a.name,
209
+ (_b = report.remote) == null ? void 0 : _b.alias,
210
+ (_c = report.remote) == null ? void 0 : _c.entry,
211
+ (_d = report.shared) == null ? void 0 : _d.name,
212
+ (_e = report.shared) == null ? void 0 : _e.provider,
213
+ (_f = report.shared) == null ? void 0 : _f.requiredVersion,
214
+ (_g = report.shared) == null ? void 0 : _g.selectedVersion,
215
+ (_i = (_h = report.shared) == null ? void 0 : _h.availableVersions) == null ? void 0 : _i.join(" "),
216
+ report.expose,
217
+ report.failedPhase,
218
+ report.errorCode,
219
+ report.errorName,
220
+ report.errorMessage,
221
+ report.ownerHint,
222
+ ((_j = report.summary) == null ? void 0 : _j.recovered) ? "recovered" : void 0,
223
+ (_k = report.summary) == null ? void 0 : _k.lastPhase,
224
+ (_l = report.diagnosis) == null ? void 0 : _l.title,
225
+ (_n = (_m = report.loadedBefore) == null ? void 0 : _m.consumers) == null ? void 0 : _n.map(
226
+ (consumer) => [consumer.name, ...consumer.exposes || []].join(" ")
227
+ ).join(" "),
228
+ report.__scope
229
+ ].filter(Boolean).join(" ").toLowerCase();
230
+ };
231
+ const fuzzyMatchReport = (report, keyword) => {
232
+ const tokens = keyword.trim().toLowerCase().split(/\s+/).filter(Boolean);
233
+ if (!tokens.length) {
234
+ return true;
235
+ }
236
+ const haystack = getReportSearchText(report);
237
+ return tokens.every((token) => haystack.includes(token));
238
+ };
239
+ const downloadJson = (name, data) => {
240
+ const blob = new Blob([`${JSON.stringify(data, null, 2)}
241
+ `], {
242
+ type: "application/json;charset=utf-8"
243
+ });
244
+ const url = URL.createObjectURL(blob);
245
+ const anchor = document.createElement("a");
246
+ anchor.href = url;
247
+ anchor.download = name;
248
+ anchor.click();
249
+ URL.revokeObjectURL(url);
250
+ };
251
+ const formatCurrentLoadValue = (value) => {
252
+ if (value === false) {
253
+ return "false";
254
+ }
255
+ if (value === true) {
256
+ return "true";
257
+ }
258
+ if (typeof value === "number") {
259
+ return String(value);
260
+ }
261
+ return value || void 0;
262
+ };
263
+ const getConfigSignature = (config) => JSON.stringify((0, import_observability_shared.normalizeObservabilityDevtoolsConfig)(config));
264
+ const getLoadingTraceTabKey = (tabId) => typeof tabId === "number" ? String(tabId) : "unknown";
265
+ const LoadingTrace = ({ tabId, resetKey = 0 }) => {
266
+ var _a, _b;
267
+ const { t } = (0, import_react_i18next.useTranslation)();
268
+ const [config, setConfig] = (0, import_react.useState)(
269
+ import_observability_shared.DEFAULT_OBSERVABILITY_DEVTOOLS_CONFIG
270
+ );
271
+ const [savedConfig, setSavedConfig] = (0, import_react.useState)(
272
+ import_observability_shared.DEFAULT_OBSERVABILITY_DEVTOOLS_CONFIG
273
+ );
274
+ const [stored, setStored] = (0, import_react.useState)(false);
275
+ const [reports, setReports] = (0, import_react.useState)([]);
276
+ const [scopes, setScopes] = (0, import_react.useState)([]);
277
+ const [hasUserObservabilityPlugin, setHasUserObservabilityPlugin] = (0, import_react.useState)(false);
278
+ const [selectedTraceId, setSelectedTraceId] = (0, import_react.useState)();
279
+ const [busy, setBusy] = (0, import_react.useState)(false);
280
+ const [statusText, setStatusText] = (0, import_react.useState)("");
281
+ const [showConfigPanel, setShowConfigPanel] = (0, import_react.useState)(false);
282
+ const [reportKeyword, setReportKeyword] = (0, import_react.useState)("");
283
+ const refreshTimersRef = (0, import_react.useRef)([]);
284
+ const userPluginPollTimerRef = (0, import_react.useRef)(
285
+ null
286
+ );
287
+ const tabCacheRef = (0, import_react.useRef)(/* @__PURE__ */ new Map());
288
+ const activeTabKey = (0, import_react.useMemo)(() => getLoadingTraceTabKey(tabId), [tabId]);
289
+ const activeTabKeyRef = (0, import_react.useRef)(activeTabKey);
290
+ const resetKeyRef = (0, import_react.useRef)(resetKey);
291
+ const filteredReports = (0, import_react.useMemo)(
292
+ () => reports.filter((report) => fuzzyMatchReport(report, reportKeyword)),
293
+ [reports, reportKeyword]
294
+ );
295
+ const selectedReport = (0, import_react.useMemo)(
296
+ () => filteredReports.find((report) => report.traceId === selectedTraceId) || filteredReports[0],
297
+ [filteredReports, selectedTraceId]
298
+ );
299
+ const latestReport = reports[0];
300
+ const isObservabilityEnabled = stored && config.enabled !== false;
301
+ const isConfigDirty = (0, import_react.useMemo)(
302
+ () => getConfigSignature(config) !== getConfigSignature(savedConfig),
303
+ [config, savedConfig]
304
+ );
305
+ const levelOptions = (0, import_react.useMemo)(
306
+ () => [
307
+ {
308
+ label: t("loadingTrace.config.verbose"),
309
+ value: "verbose"
310
+ },
311
+ {
312
+ label: t("loadingTrace.config.summary"),
313
+ value: "summary"
314
+ },
315
+ {
316
+ label: t("loadingTrace.config.error"),
317
+ value: "error"
318
+ }
319
+ ],
320
+ [t]
321
+ );
322
+ const shouldShowApplyButton = !isObservabilityEnabled || isConfigDirty;
323
+ const emptyDescription = (0, import_react.useMemo)(() => {
324
+ if (!hasUserObservabilityPlugin && !isObservabilityEnabled) {
325
+ return t("loadingTrace.emptyEnableChrome");
326
+ }
327
+ return t("loadingTrace.empty");
328
+ }, [hasUserObservabilityPlugin, isObservabilityEnabled, t]);
329
+ const sourceStateLabel = isObservabilityEnabled ? "ON" : hasUserObservabilityPlugin ? "CUSTOM" : "OFF";
330
+ const eventCount = (0, import_react.useMemo)(
331
+ () => reports.reduce(
332
+ (count, report) => {
333
+ var _a2;
334
+ return count + (((_a2 = report.events) == null ? void 0 : _a2.length) || 0);
335
+ },
336
+ 0
337
+ ),
338
+ [reports]
339
+ );
340
+ const applyTabCache = (0, import_react.useCallback)(
341
+ (tabKey, update) => {
342
+ const current = tabCacheRef.current.get(tabKey) || {
343
+ reports: [],
344
+ selectedTraceId: void 0
345
+ };
346
+ const next = typeof update === "function" ? update(current) : update;
347
+ tabCacheRef.current.set(tabKey, next);
348
+ if (activeTabKeyRef.current === tabKey) {
349
+ setReports(next.reports);
350
+ setSelectedTraceId(next.selectedTraceId);
351
+ }
352
+ return next;
353
+ },
354
+ []
355
+ );
356
+ const clearTabCache = (0, import_react.useCallback)(
357
+ (tabKey) => applyTabCache(tabKey, {
358
+ reports: [],
359
+ selectedTraceId: void 0
360
+ }),
361
+ [applyTabCache]
362
+ );
363
+ const refreshSnapshot = (0, import_react.useCallback)(
364
+ (..._0) => __async(void 0, [..._0], function* (targetTabKey = activeTabKeyRef.current) {
365
+ var _a2;
366
+ const snapshot = yield (0, import_observability.readObservabilitySnapshot)();
367
+ setConfig(snapshot.config);
368
+ setSavedConfig(snapshot.config);
369
+ setStored(snapshot.stored);
370
+ setScopes(snapshot.scopes);
371
+ setHasUserObservabilityPlugin(snapshot.hasUserObservabilityPlugin);
372
+ const cached = tabCacheRef.current.get(targetTabKey) || {
373
+ reports: [],
374
+ selectedTraceId: void 0
375
+ };
376
+ const mergedReports = (0, import_observability.mergeObservabilityReports)(
377
+ cached.reports,
378
+ snapshot.reports
379
+ );
380
+ const nextCache = applyTabCache(targetTabKey, {
381
+ reports: mergedReports,
382
+ selectedTraceId: cached.selectedTraceId || ((_a2 = snapshot.reports[0]) == null ? void 0 : _a2.traceId)
383
+ });
384
+ return __spreadProps(__spreadValues({}, snapshot), {
385
+ reports: nextCache.reports
386
+ });
387
+ }),
388
+ [applyTabCache]
389
+ );
390
+ const clearScheduledRefresh = (0, import_react.useCallback)(() => {
391
+ refreshTimersRef.current.forEach((timer) => clearTimeout(timer));
392
+ refreshTimersRef.current = [];
393
+ }, []);
394
+ const scheduleRefreshBurst = (0, import_react.useCallback)(() => {
395
+ clearScheduledRefresh();
396
+ const delays = [200, 600, 1200, 2400];
397
+ const targetTabKey = activeTabKeyRef.current;
398
+ refreshTimersRef.current = delays.map(
399
+ (delay, index) => setTimeout(() => __async(void 0, null, function* () {
400
+ const snapshot = yield refreshSnapshot(targetTabKey);
401
+ const isLast = index === delays.length - 1;
402
+ if (snapshot.reports.length) {
403
+ setStatusText(t("loadingTrace.status.synced"));
404
+ clearScheduledRefresh();
405
+ return;
406
+ }
407
+ if (isLast) {
408
+ setStatusText(t("loadingTrace.status.noReports"));
409
+ }
410
+ }), delay)
411
+ );
412
+ }, [clearScheduledRefresh, refreshSnapshot, t]);
413
+ (0, import_react.useEffect)(() => {
414
+ activeTabKeyRef.current = activeTabKey;
415
+ const cached = tabCacheRef.current.get(activeTabKey);
416
+ setReports((cached == null ? void 0 : cached.reports) || []);
417
+ setSelectedTraceId(cached == null ? void 0 : cached.selectedTraceId);
418
+ setReportKeyword("");
419
+ }, [activeTabKey]);
420
+ (0, import_react.useEffect)(() => {
421
+ if (resetKey === resetKeyRef.current) {
422
+ return;
423
+ }
424
+ resetKeyRef.current = resetKey;
425
+ clearScheduledRefresh();
426
+ clearTabCache(activeTabKeyRef.current);
427
+ setStatusText(t("loadingTrace.status.noReports"));
428
+ }, [clearScheduledRefresh, clearTabCache, resetKey, t]);
429
+ (0, import_react.useEffect)(() => {
430
+ let cancelled = false;
431
+ const load = () => __async(void 0, null, function* () {
432
+ try {
433
+ const pageConfig = yield (0, import_observability.readObservabilityConfig)();
434
+ if (!cancelled) {
435
+ setConfig(pageConfig);
436
+ setSavedConfig(pageConfig);
437
+ }
438
+ const snapshot = yield refreshSnapshot();
439
+ if (!cancelled) {
440
+ setStatusText(
441
+ snapshot.stored ? t("loadingTrace.status.enabled") : snapshot.hasUserObservabilityPlugin ? t("loadingTrace.status.userPlugin") : t("loadingTrace.status.disabled")
442
+ );
443
+ }
444
+ } catch (error) {
445
+ if (!cancelled) {
446
+ setStatusText(t("loadingTrace.status.unavailable"));
447
+ }
448
+ }
449
+ });
450
+ void load();
451
+ return () => {
452
+ cancelled = true;
453
+ clearScheduledRefresh();
454
+ };
455
+ }, [clearScheduledRefresh, refreshSnapshot, t, tabId]);
456
+ (0, import_react.useEffect)(() => {
457
+ if (userPluginPollTimerRef.current) {
458
+ clearInterval(userPluginPollTimerRef.current);
459
+ userPluginPollTimerRef.current = null;
460
+ }
461
+ if (!hasUserObservabilityPlugin) {
462
+ return;
463
+ }
464
+ let polling = false;
465
+ userPluginPollTimerRef.current = setInterval(() => __async(void 0, null, function* () {
466
+ if (polling) {
467
+ return;
468
+ }
469
+ polling = true;
470
+ try {
471
+ const snapshot = yield refreshSnapshot(activeTabKeyRef.current);
472
+ if (snapshot.reports.length) {
473
+ setStatusText(t("loadingTrace.status.synced"));
474
+ }
475
+ } finally {
476
+ polling = false;
477
+ }
478
+ }), 1500);
479
+ return () => {
480
+ if (userPluginPollTimerRef.current) {
481
+ clearInterval(userPluginPollTimerRef.current);
482
+ userPluginPollTimerRef.current = null;
483
+ }
484
+ };
485
+ }, [hasUserObservabilityPlugin, refreshSnapshot, t]);
486
+ (0, import_react.useEffect)(() => {
487
+ const onMessage = (message, sender) => {
488
+ var _a2, _b2;
489
+ if ((message == null ? void 0 : message.type) !== import_messages.MESSAGE_OBSERVABILITY_DEVTOOLS_EVENT) {
490
+ return;
491
+ }
492
+ const senderTabId = (_a2 = sender == null ? void 0 : sender.tab) == null ? void 0 : _a2.id;
493
+ const messageTabKey = getLoadingTraceTabKey(senderTabId || tabId);
494
+ const isCurrentTabMessage = !tabId || !senderTabId || senderTabId === tabId;
495
+ const payload = message.data;
496
+ if ((payload == null ? void 0 : payload.config) && isCurrentTabMessage) {
497
+ const nextConfig = (0, import_observability_shared.normalizeObservabilityDevtoolsConfig)(payload.config);
498
+ setConfig(nextConfig);
499
+ setSavedConfig(nextConfig);
500
+ setStored(payload.config.enabled !== false);
501
+ }
502
+ if ((payload == null ? void 0 : payload.kind) === "installed" && isCurrentTabMessage) {
503
+ setStatusText(t("loadingTrace.status.enabled"));
504
+ scheduleRefreshBurst();
505
+ }
506
+ if ((_b2 = payload == null ? void 0 : payload.report) == null ? void 0 : _b2.traceId) {
507
+ const report = __spreadProps(__spreadValues({}, payload.report), {
508
+ __scope: payload.scope || payload.report.__scope
509
+ });
510
+ applyTabCache(messageTabKey, (current) => ({
511
+ reports: (0, import_observability.mergeObservabilityReports)(current.reports, [report]),
512
+ selectedTraceId: current.selectedTraceId || report.traceId
513
+ }));
514
+ if (isCurrentTabMessage) {
515
+ clearScheduledRefresh();
516
+ setStatusText(t("loadingTrace.status.synced"));
517
+ }
518
+ }
519
+ };
520
+ chrome.runtime.onMessage.addListener(onMessage);
521
+ return () => chrome.runtime.onMessage.removeListener(onMessage);
522
+ }, [applyTabCache, clearScheduledRefresh, scheduleRefreshBurst, tabId, t]);
523
+ const updateConfig = (patch) => {
524
+ setConfig(
525
+ (current) => (0, import_observability_shared.normalizeObservabilityDevtoolsConfig)(__spreadValues(__spreadValues({}, current), patch))
526
+ );
527
+ };
528
+ const applyAndReload = () => __async(void 0, null, function* () {
529
+ setBusy(true);
530
+ try {
531
+ const nextConfig = (0, import_observability_shared.normalizeObservabilityDevtoolsConfig)(__spreadProps(__spreadValues({}, config), {
532
+ enabled: true
533
+ }));
534
+ yield (0, import_observability.applyObservabilityConfig)(nextConfig);
535
+ setConfig(nextConfig);
536
+ setSavedConfig(nextConfig);
537
+ setStored(true);
538
+ clearTabCache(activeTabKeyRef.current);
539
+ setStatusText(t("loadingTrace.status.reloading"));
540
+ yield (0, import_observability.reloadInspectedPage)();
541
+ scheduleRefreshBurst();
542
+ } finally {
543
+ setBusy(false);
544
+ }
545
+ });
546
+ const confirmApply = () => {
547
+ import_web_react.Modal.confirm({
548
+ title: isObservabilityEnabled ? t("loadingTrace.confirm.updateTitle") : t("loadingTrace.confirm.observeTitle"),
549
+ content: t("loadingTrace.confirm.content"),
550
+ okText: t("loadingTrace.actions.confirm"),
551
+ cancelText: t("loadingTrace.actions.cancel"),
552
+ onOk: () => applyAndReload()
553
+ });
554
+ };
555
+ const disableAndReload = () => __async(void 0, null, function* () {
556
+ setBusy(true);
557
+ try {
558
+ yield (0, import_observability.disableObservabilityConfig)();
559
+ clearScheduledRefresh();
560
+ setStored(false);
561
+ clearTabCache(activeTabKeyRef.current);
562
+ setStatusText(t("loadingTrace.status.disabled"));
563
+ yield (0, import_observability.reloadInspectedPage)();
564
+ } finally {
565
+ setBusy(false);
566
+ }
567
+ });
568
+ const handleRefresh = () => __async(void 0, null, function* () {
569
+ setBusy(true);
570
+ try {
571
+ const snapshot = yield refreshSnapshot();
572
+ setStatusText(
573
+ snapshot.reports.length ? t("loadingTrace.status.synced") : t("loadingTrace.status.noReports")
574
+ );
575
+ } finally {
576
+ setBusy(false);
577
+ }
578
+ });
579
+ const handleExport = () => {
580
+ downloadJson(`mf-observability-${Date.now()}.json`, {
581
+ exportedAt: (/* @__PURE__ */ new Date()).toISOString(),
582
+ config,
583
+ scopes,
584
+ reports
585
+ });
586
+ };
587
+ const currentLoadRows = (0, import_react.useMemo)(() => {
588
+ var _a2, _b2, _c, _d;
589
+ if (!selectedReport) {
590
+ return [];
591
+ }
592
+ const rows = [
593
+ {
594
+ labelKey: "consumer",
595
+ value: selectedReport.hostName
596
+ }
597
+ ];
598
+ if (selectedReport.shared) {
599
+ rows.push(
600
+ {
601
+ labelKey: "shared",
602
+ value: selectedReport.shared.name
603
+ },
604
+ {
605
+ labelKey: "provider",
606
+ value: selectedReport.shared.provider
607
+ },
608
+ {
609
+ labelKey: "requiredVersion",
610
+ value: selectedReport.shared.requiredVersion
611
+ },
612
+ {
613
+ labelKey: "selectedVersion",
614
+ value: selectedReport.shared.selectedVersion
615
+ },
616
+ {
617
+ labelKey: "availableVersions",
618
+ value: (_a2 = selectedReport.shared.availableVersions) == null ? void 0 : _a2.join(", ")
619
+ }
620
+ );
621
+ } else {
622
+ rows.push(
623
+ {
624
+ labelKey: "request",
625
+ value: selectedReport.requestId
626
+ },
627
+ {
628
+ labelKey: "producer",
629
+ value: ((_b2 = selectedReport.remote) == null ? void 0 : _b2.alias) || ((_c = selectedReport.remote) == null ? void 0 : _c.name)
630
+ },
631
+ {
632
+ labelKey: "remoteName",
633
+ value: (_d = selectedReport.remote) == null ? void 0 : _d.name
634
+ },
635
+ {
636
+ labelKey: "expose",
637
+ value: selectedReport.expose
638
+ }
639
+ );
640
+ }
641
+ return rows.filter((row) => formatCurrentLoadValue(row.value));
642
+ }, [selectedReport]);
643
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.wrapper, children: [
644
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: import_index.default.toolbar, children: [
645
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.titleGroup, children: [
646
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.title, children: t("loadingTrace.title") }),
647
+ statusText ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.subtitle, children: statusText }) : null
648
+ ] }),
649
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.actions, children: [
650
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
651
+ import_web_react.Button,
652
+ {
653
+ className: `${import_index.default.configButton} ${showConfigPanel ? import_index.default.configButtonActive : ""}`,
654
+ shape: "circle",
655
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icon.IconSettings, {}),
656
+ "aria-pressed": showConfigPanel,
657
+ title: t("loadingTrace.actions.config"),
658
+ onClick: () => setShowConfigPanel((visible) => !visible)
659
+ }
660
+ ),
661
+ shouldShowApplyButton ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
662
+ import_web_react.Button,
663
+ {
664
+ className: import_index.default.primaryAction,
665
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icon.IconPlayArrow, {}),
666
+ loading: busy,
667
+ onClick: confirmApply,
668
+ children: isObservabilityEnabled ? t("loadingTrace.actions.updateConfig") : t("loadingTrace.actions.observeNow")
669
+ }
670
+ ) : null,
671
+ isObservabilityEnabled ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_web_react.Button, { loading: busy, onClick: disableAndReload, children: t("loadingTrace.actions.disable") }) : null,
672
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_web_react.Button, { icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icon.IconRefresh, {}), loading: busy, onClick: handleRefresh, children: t("loadingTrace.actions.refresh") }),
673
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
674
+ import_web_react.Button,
675
+ {
676
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icon.IconDownload, {}),
677
+ disabled: !reports.length,
678
+ onClick: handleExport,
679
+ children: t("loadingTrace.actions.export")
680
+ }
681
+ )
682
+ ] })
683
+ ] }),
684
+ showConfigPanel ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: import_index.default.configGrid, children: [
685
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: import_index.default.field, children: [
686
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
687
+ FieldLabel,
688
+ {
689
+ label: t("loadingTrace.config.level"),
690
+ tip: t("loadingTrace.config.levelTip")
691
+ }
692
+ ),
693
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
694
+ SegmentedControl,
695
+ {
696
+ value: config.level,
697
+ options: levelOptions,
698
+ onChange: (level) => updateConfig({ level })
699
+ }
700
+ )
701
+ ] }),
702
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: import_index.default.field, children: [
703
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
704
+ FieldLabel,
705
+ {
706
+ label: t("loadingTrace.config.console"),
707
+ tip: t("loadingTrace.config.consoleTip")
708
+ }
709
+ ),
710
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
711
+ import_web_react.Switch,
712
+ {
713
+ checked: config.console,
714
+ onChange: (checked) => updateConfig({ console: checked })
715
+ }
716
+ )
717
+ ] })
718
+ ] }) }) : null,
719
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
720
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: import_index.default.stats, children: [
721
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
722
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: import_index.default.statValueWithHelp, children: [
723
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.statValue, children: sourceStateLabel }),
724
+ sourceStateLabel === "CUSTOM" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
725
+ "span",
726
+ {
727
+ className: `${import_index.default.inlineHelpIcon} ${import_index.default.statHelpIcon}`,
728
+ "data-tip": t("loadingTrace.stats.customTip"),
729
+ tabIndex: 0,
730
+ "aria-label": t("loadingTrace.stats.customTip"),
731
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icon.IconQuestionCircle, {})
732
+ }
733
+ ) : null
734
+ ] }),
735
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.statLabel, children: t("loadingTrace.stats.state") })
736
+ ] }),
737
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
738
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.statValue, children: reports.length }),
739
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.statLabel, children: t("loadingTrace.stats.reports") })
740
+ ] }),
741
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
742
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.statValue, children: eventCount }),
743
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.statLabel, children: t("loadingTrace.stats.events") })
744
+ ] }),
745
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
746
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.statValue, children: ((_a = latestReport == null ? void 0 : latestReport.summary) == null ? void 0 : _a.outcome) || "-" }),
747
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.statLabel, children: t("loadingTrace.stats.latest") })
748
+ ] })
749
+ ] }),
750
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
751
+ "section",
752
+ {
753
+ className: `${import_index.default.viewer} ${reports.length ? "" : import_index.default.viewerEmpty}`,
754
+ children: reports.length ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
755
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.reportList, children: [
756
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.reportFilter, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
757
+ import_web_react.Input,
758
+ {
759
+ className: import_index.default.reportSearch,
760
+ prefix: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icon.IconSearch, {}),
761
+ allowClear: true,
762
+ placeholder: t("loadingTrace.reports.search"),
763
+ value: reportKeyword,
764
+ onChange: (value) => setReportKeyword(value)
765
+ }
766
+ ) }),
767
+ filteredReports.length ? filteredReports.map((report) => {
768
+ const state = getReportState(report);
769
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
770
+ "button",
771
+ {
772
+ type: "button",
773
+ className: `${import_index.default.reportItem} ${(selectedReport == null ? void 0 : selectedReport.traceId) === report.traceId ? import_index.default.activeReport : ""}`,
774
+ onClick: () => applyTabCache(activeTabKeyRef.current, (current) => __spreadProps(__spreadValues({}, current), {
775
+ selectedTraceId: report.traceId
776
+ })),
777
+ children: [
778
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.reportTitle, children: getReportTitle(report) }),
779
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.reportTagRow, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
780
+ "span",
781
+ {
782
+ className: `${import_index.default.statusTag} ${import_index.default[`statusTag${state}`]}`,
783
+ children: t(`loadingTrace.reports.${state}`)
784
+ }
785
+ ) }),
786
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.reportMeta, children: formatTime(report.updatedAt) })
787
+ ]
788
+ },
789
+ report.traceId
790
+ );
791
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.emptyPanel, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_web_react.Empty, { description: t("loadingTrace.reports.noMatch") }) })
792
+ ] }),
793
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.timeline, children: selectedReport ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
794
+ (() => {
795
+ const limitedObservability = getLimitedObservabilityLabel(selectedReport);
796
+ const observabilityScopeLabel = (0, import_observability.getObservabilityReportScopeLabel)(selectedReport);
797
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.reportHeader, children: [
798
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
799
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.reportHeading, children: getReportTitle(selectedReport) }),
800
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.traceId, children: selectedReport.traceId })
801
+ ] }),
802
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.tags, children: [
803
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
804
+ "span",
805
+ {
806
+ className: `${import_index.default.statusTag} ${import_index.default[`statusTag${getReportState(selectedReport)}`]}`,
807
+ children: t(
808
+ `loadingTrace.reports.${getReportState(selectedReport)}`
809
+ )
810
+ }
811
+ ),
812
+ observabilityScopeLabel ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.limitedTag, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: observabilityScopeLabel }) }) : null,
813
+ limitedObservability ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: import_index.default.limitedTag, children: [
814
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: t("loadingTrace.reports.limited") }),
815
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
816
+ "span",
817
+ {
818
+ className: import_index.default.inlineHelpIcon,
819
+ "data-tip": t(
820
+ `loadingTrace.reports.${limitedObservability}Tip`
821
+ ),
822
+ tabIndex: 0,
823
+ "aria-label": t(
824
+ `loadingTrace.reports.${limitedObservability}Tip`
825
+ ),
826
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icon.IconQuestionCircle, {})
827
+ }
828
+ )
829
+ ] }) : null
830
+ ] })
831
+ ] });
832
+ })(),
833
+ currentLoadRows.length ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.currentLoad, children: [
834
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.currentLoadHeader, children: [
835
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.currentLoadTitle, children: t("loadingTrace.currentLoad.title") }),
836
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.currentLoadSummary, children: selectedReport.shared ? t("loadingTrace.currentLoad.sharedReport") : t("loadingTrace.currentLoad.remoteReport") })
837
+ ] }),
838
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.currentLoadRows, children: currentLoadRows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
839
+ "div",
840
+ {
841
+ className: import_index.default.currentLoadRow,
842
+ children: [
843
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.currentLoadLabel, children: t(`loadingTrace.currentLoad.${row.labelKey}`) }),
844
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.currentLoadValue, children: formatCurrentLoadValue(row.value) })
845
+ ]
846
+ },
847
+ row.labelKey
848
+ )) })
849
+ ] }) : null,
850
+ ((_b = selectedReport.diagnosis) == null ? void 0 : _b.title) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.diagnosis, children: selectedReport.diagnosis.title }) : null,
851
+ selectedReport.loadedBefore ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.loadedBefore, children: [
852
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.loadedBeforeHeader, children: [
853
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.loadedBeforeTitle, children: t("loadingTrace.loadedBefore.title") }),
854
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.loadedBeforeSummary, children: t("loadingTrace.loadedBefore.consumerCount", {
855
+ count: selectedReport.loadedBefore.consumers.length
856
+ }) })
857
+ ] }),
858
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.loadedBeforeTags, children: [
859
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
860
+ "span",
861
+ {
862
+ className: `${import_index.default.loadedBeforeTag} ${import_index.default.loadedBeforeTagSuccess}`,
863
+ children: t("loadingTrace.loadedBefore.producerLoaded")
864
+ }
865
+ ),
866
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
867
+ "span",
868
+ {
869
+ className: `${import_index.default.loadedBeforeTag} ${selectedReport.loadedBefore.expose ? import_index.default.loadedBeforeTagSuccess : import_index.default.loadedBeforeTagNeutral}`,
870
+ children: selectedReport.loadedBefore.expose ? t("loadingTrace.loadedBefore.exposeLoaded") : t("loadingTrace.loadedBefore.exposeNotLoaded")
871
+ }
872
+ )
873
+ ] }),
874
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.loadedBeforeConsumers, children: selectedReport.loadedBefore.consumers.map(
875
+ (consumer, index) => {
876
+ var _a2;
877
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
878
+ "div",
879
+ {
880
+ className: import_index.default.loadedBeforeConsumer,
881
+ children: [
882
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.loadedBeforeRow, children: [
883
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.loadedBeforeLabel, children: t("loadingTrace.loadedBefore.consumer") }),
884
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.loadedBeforeName, children: consumer.name || t(
885
+ "loadingTrace.loadedBefore.unknownConsumer"
886
+ ) })
887
+ ] }),
888
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.loadedBeforeRow, children: [
889
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.loadedBeforeLabel, children: t("loadingTrace.loadedBefore.status") }),
890
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.loadedBeforeMeta, children: [
891
+ consumer.remoteEntryExports ? t(
892
+ "loadingTrace.loadedBefore.entryReady"
893
+ ) : t(
894
+ "loadingTrace.loadedBefore.entryMissing"
895
+ ),
896
+ consumer.containerInitialized ? t(
897
+ "loadingTrace.loadedBefore.initReady"
898
+ ) : t(
899
+ "loadingTrace.loadedBefore.initMissing"
900
+ )
901
+ ].join(" · ") })
902
+ ] }),
903
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.loadedBeforeRow, children: [
904
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.loadedBeforeLabel, children: t("loadingTrace.loadedBefore.exposes") }),
905
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.loadedBeforeExposes, children: ((_a2 = consumer.exposes) == null ? void 0 : _a2.length) ? consumer.exposes.join(", ") : t(
906
+ "loadingTrace.loadedBefore.noExposes"
907
+ ) })
908
+ ] })
909
+ ]
910
+ },
911
+ `${consumer.name || "consumer"}-${index}`
912
+ );
913
+ }
914
+ ) })
915
+ ] }) : null,
916
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.eventList, children: (selectedReport.events || []).map((event, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
917
+ "div",
918
+ {
919
+ className: import_index.default.eventItem,
920
+ children: [
921
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.eventTime, children: formatTime(event.timestamp) }),
922
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.eventBody, children: [
923
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.eventMain, children: [
924
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.phase, children: event.phase }),
925
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
926
+ "span",
927
+ {
928
+ className: `${import_index.default.eventStatusTag} ${import_index.default[`eventStatusTag${getEventStatusState(
929
+ event.status
930
+ )}`]}`,
931
+ children: event.status
932
+ }
933
+ ),
934
+ event.recovered ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.eventRecoveredTag, children: t("loadingTrace.reports.eventRecovered") }) : null,
935
+ event.duration !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: import_index.default.duration, children: [
936
+ event.duration,
937
+ "ms"
938
+ ] }) : null
939
+ ] }),
940
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.eventMeta, children: event.message || event.lifecycle || event.requestId || "-" }),
941
+ event.errorMessage ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.error, children: event.errorCode ? `${event.errorCode}: ${event.errorMessage}` : event.errorMessage }) : null
942
+ ] })
943
+ ]
944
+ },
945
+ `${event.traceId}-${event.phase}-${event.timestamp}-${index}`
946
+ )) })
947
+ ] }) : null })
948
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.emptyPanel, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_web_react.Empty, { description: emptyDescription }) })
949
+ }
950
+ )
951
+ ] })
952
+ ] });
953
+ };
954
+ var LoadingTrace_default = LoadingTrace;