@localstack/appinspector-ui 1.0.72 → 1.0.74
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.cjs +2564 -688
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2546 -655
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -1,10 +1,21 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __require = /* @__PURE__ */ ((x2) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x2, {
|
|
8
|
+
get: (a3, b3) => (typeof require !== "undefined" ? require : a3)[b3]
|
|
9
|
+
}) : x2)(function(x2) {
|
|
10
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
11
|
+
throw Error('Dynamic require of "' + x2 + '" is not supported');
|
|
12
|
+
});
|
|
5
13
|
var __esm = (fn, res) => function __init() {
|
|
6
14
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
7
15
|
};
|
|
16
|
+
var __commonJS = (cb2, mod) => function __require2() {
|
|
17
|
+
return mod || (0, cb2[__getOwnPropNames(cb2)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
18
|
+
};
|
|
8
19
|
var __export = (target, all) => {
|
|
9
20
|
for (var name in all)
|
|
10
21
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -17,42 +28,148 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
28
|
}
|
|
18
29
|
return to;
|
|
19
30
|
};
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
//
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
"node_modules/framer-motion/node_modules/@emotion/memoize/dist/memoize.browser.esm.js"() {
|
|
31
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
32
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
33
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
34
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
35
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
36
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
37
|
+
mod
|
|
38
|
+
));
|
|
39
|
+
|
|
40
|
+
// node_modules/toggle-selection/index.js
|
|
41
|
+
var require_toggle_selection = __commonJS({
|
|
42
|
+
"node_modules/toggle-selection/index.js"(exports, module) {
|
|
33
43
|
"use strict";
|
|
34
|
-
|
|
44
|
+
module.exports = function() {
|
|
45
|
+
var selection = document.getSelection();
|
|
46
|
+
if (!selection.rangeCount) {
|
|
47
|
+
return function() {
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
var active = document.activeElement;
|
|
51
|
+
var ranges = [];
|
|
52
|
+
for (var i2 = 0; i2 < selection.rangeCount; i2++) {
|
|
53
|
+
ranges.push(selection.getRangeAt(i2));
|
|
54
|
+
}
|
|
55
|
+
switch (active.tagName.toUpperCase()) {
|
|
56
|
+
// .toUpperCase handles XHTML
|
|
57
|
+
case "INPUT":
|
|
58
|
+
case "TEXTAREA":
|
|
59
|
+
active.blur();
|
|
60
|
+
break;
|
|
61
|
+
default:
|
|
62
|
+
active = null;
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
selection.removeAllRanges();
|
|
66
|
+
return function() {
|
|
67
|
+
selection.type === "Caret" && selection.removeAllRanges();
|
|
68
|
+
if (!selection.rangeCount) {
|
|
69
|
+
ranges.forEach(function(range) {
|
|
70
|
+
selection.addRange(range);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
active && active.focus();
|
|
74
|
+
};
|
|
75
|
+
};
|
|
35
76
|
}
|
|
36
77
|
});
|
|
37
78
|
|
|
38
|
-
// node_modules/
|
|
39
|
-
var
|
|
40
|
-
|
|
41
|
-
default: () => is_prop_valid_browser_esm_default
|
|
42
|
-
});
|
|
43
|
-
var reactPropsRegex, index, is_prop_valid_browser_esm_default;
|
|
44
|
-
var init_is_prop_valid_browser_esm = __esm({
|
|
45
|
-
"node_modules/framer-motion/node_modules/@emotion/is-prop-valid/dist/is-prop-valid.browser.esm.js"() {
|
|
79
|
+
// node_modules/copy-to-clipboard/index.js
|
|
80
|
+
var require_copy_to_clipboard = __commonJS({
|
|
81
|
+
"node_modules/copy-to-clipboard/index.js"(exports, module) {
|
|
46
82
|
"use strict";
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
83
|
+
var deselectCurrent = require_toggle_selection();
|
|
84
|
+
var clipboardToIE11Formatting = {
|
|
85
|
+
"text/plain": "Text",
|
|
86
|
+
"text/html": "Url",
|
|
87
|
+
"default": "Text"
|
|
88
|
+
};
|
|
89
|
+
var defaultMessage = "Copy to clipboard: #{key}, Enter";
|
|
90
|
+
function format2(message) {
|
|
91
|
+
var copyKey = (/mac os x/i.test(navigator.userAgent) ? "\u2318" : "Ctrl") + "+C";
|
|
92
|
+
return message.replace(/#{\s*key\s*}/g, copyKey);
|
|
93
|
+
}
|
|
94
|
+
function copy(text2, options) {
|
|
95
|
+
var debug2, message, reselectPrevious, range, selection, mark, success = false;
|
|
96
|
+
if (!options) {
|
|
97
|
+
options = {};
|
|
98
|
+
}
|
|
99
|
+
debug2 = options.debug || false;
|
|
100
|
+
try {
|
|
101
|
+
reselectPrevious = deselectCurrent();
|
|
102
|
+
range = document.createRange();
|
|
103
|
+
selection = document.getSelection();
|
|
104
|
+
mark = document.createElement("span");
|
|
105
|
+
mark.textContent = text2;
|
|
106
|
+
mark.ariaHidden = "true";
|
|
107
|
+
mark.style.all = "unset";
|
|
108
|
+
mark.style.position = "fixed";
|
|
109
|
+
mark.style.top = 0;
|
|
110
|
+
mark.style.clip = "rect(0, 0, 0, 0)";
|
|
111
|
+
mark.style.whiteSpace = "pre";
|
|
112
|
+
mark.style.webkitUserSelect = "text";
|
|
113
|
+
mark.style.MozUserSelect = "text";
|
|
114
|
+
mark.style.msUserSelect = "text";
|
|
115
|
+
mark.style.userSelect = "text";
|
|
116
|
+
mark.addEventListener("copy", function(e2) {
|
|
117
|
+
e2.stopPropagation();
|
|
118
|
+
if (options.format) {
|
|
119
|
+
e2.preventDefault();
|
|
120
|
+
if (typeof e2.clipboardData === "undefined") {
|
|
121
|
+
debug2 && console.warn("unable to use e.clipboardData");
|
|
122
|
+
debug2 && console.warn("trying IE specific stuff");
|
|
123
|
+
window.clipboardData.clearData();
|
|
124
|
+
var format3 = clipboardToIE11Formatting[options.format] || clipboardToIE11Formatting["default"];
|
|
125
|
+
window.clipboardData.setData(format3, text2);
|
|
126
|
+
} else {
|
|
127
|
+
e2.clipboardData.clearData();
|
|
128
|
+
e2.clipboardData.setData(options.format, text2);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (options.onCopy) {
|
|
132
|
+
e2.preventDefault();
|
|
133
|
+
options.onCopy(e2.clipboardData);
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
document.body.appendChild(mark);
|
|
137
|
+
range.selectNodeContents(mark);
|
|
138
|
+
selection.addRange(range);
|
|
139
|
+
var successful = document.execCommand("copy");
|
|
140
|
+
if (!successful) {
|
|
141
|
+
throw new Error("copy command was unsuccessful");
|
|
142
|
+
}
|
|
143
|
+
success = true;
|
|
144
|
+
} catch (err) {
|
|
145
|
+
debug2 && console.error("unable to copy using execCommand: ", err);
|
|
146
|
+
debug2 && console.warn("trying IE specific stuff");
|
|
147
|
+
try {
|
|
148
|
+
window.clipboardData.setData(options.format || "text", text2);
|
|
149
|
+
options.onCopy && options.onCopy(window.clipboardData);
|
|
150
|
+
success = true;
|
|
151
|
+
} catch (err2) {
|
|
152
|
+
debug2 && console.error("unable to copy using clipboardData: ", err2);
|
|
153
|
+
debug2 && console.error("falling back to prompt");
|
|
154
|
+
message = format2("message" in options ? options.message : defaultMessage);
|
|
155
|
+
window.prompt(message, text2);
|
|
156
|
+
}
|
|
157
|
+
} finally {
|
|
158
|
+
if (selection) {
|
|
159
|
+
if (typeof selection.removeRange == "function") {
|
|
160
|
+
selection.removeRange(range);
|
|
161
|
+
} else {
|
|
162
|
+
selection.removeAllRanges();
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
if (mark) {
|
|
166
|
+
document.body.removeChild(mark);
|
|
167
|
+
}
|
|
168
|
+
reselectPrevious();
|
|
52
169
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
170
|
+
return success;
|
|
171
|
+
}
|
|
172
|
+
module.exports = copy;
|
|
56
173
|
}
|
|
57
174
|
});
|
|
58
175
|
|
|
@@ -366,8 +483,8 @@ var init_event_streams = __esm({
|
|
|
366
483
|
});
|
|
367
484
|
|
|
368
485
|
// src/pages/spans-list-page.tsx
|
|
369
|
-
import { Box as
|
|
370
|
-
import { useCallback as
|
|
486
|
+
import { Box as Box18 } from "@mui/material";
|
|
487
|
+
import { useCallback as useCallback10, useState as useState15 } from "react";
|
|
371
488
|
|
|
372
489
|
// src/components/spans-list/spans-list.tsx
|
|
373
490
|
import { Alert, Box as Box4, Button as Button2 } from "@mui/material";
|
|
@@ -452,7 +569,7 @@ function memo(getDeps, fn, opts) {
|
|
|
452
569
|
let depTime;
|
|
453
570
|
if (opts.key && opts.debug) depTime = Date.now();
|
|
454
571
|
const newDeps = getDeps(depArgs);
|
|
455
|
-
const depsChanged = newDeps.length !== deps.length || newDeps.some((dep,
|
|
572
|
+
const depsChanged = newDeps.length !== deps.length || newDeps.some((dep, index) => deps[index] !== dep);
|
|
456
573
|
if (!depsChanged) {
|
|
457
574
|
return result;
|
|
458
575
|
}
|
|
@@ -752,9 +869,9 @@ function buildHeaderGroups(allColumns, columnsToGroup, table, headerFamily) {
|
|
|
752
869
|
createHeaderGroup(pendingParentHeaders, depth - 1);
|
|
753
870
|
}
|
|
754
871
|
};
|
|
755
|
-
const bottomHeaders = columnsToGroup.map((column,
|
|
872
|
+
const bottomHeaders = columnsToGroup.map((column, index) => createHeader(table, column, {
|
|
756
873
|
depth: maxDepth2,
|
|
757
|
-
index
|
|
874
|
+
index
|
|
758
875
|
}));
|
|
759
876
|
createHeaderGroup(bottomHeaders, maxDepth2 - 1);
|
|
760
877
|
headerGroups.reverse();
|
|
@@ -2901,9 +3018,9 @@ function createTable(options) {
|
|
|
2901
3018
|
setState: (updater) => {
|
|
2902
3019
|
table.options.onStateChange == null || table.options.onStateChange(updater);
|
|
2903
3020
|
},
|
|
2904
|
-
_getRowId: (row,
|
|
3021
|
+
_getRowId: (row, index, parent) => {
|
|
2905
3022
|
var _table$options$getRow;
|
|
2906
|
-
return (_table$options$getRow = table.options.getRowId == null ? void 0 : table.options.getRowId(row,
|
|
3023
|
+
return (_table$options$getRow = table.options.getRowId == null ? void 0 : table.options.getRowId(row, index, parent)) != null ? _table$options$getRow : `${parent ? [parent.id, index].join(".") : index}`;
|
|
2907
3024
|
},
|
|
2908
3025
|
getCoreRowModel: () => {
|
|
2909
3026
|
if (!table._getCoreRowModel) {
|
|
@@ -2994,8 +3111,8 @@ function createTable(options) {
|
|
|
2994
3111
|
}
|
|
2995
3112
|
};
|
|
2996
3113
|
Object.assign(table, coreInstance);
|
|
2997
|
-
for (let
|
|
2998
|
-
const feature = table._features[
|
|
3114
|
+
for (let index = 0; index < table._features.length; index++) {
|
|
3115
|
+
const feature = table._features[index];
|
|
2999
3116
|
feature == null || feature.createTable == null || feature.createTable(table);
|
|
3000
3117
|
}
|
|
3001
3118
|
return table;
|
|
@@ -3228,14 +3345,14 @@ function __values(o2) {
|
|
|
3228
3345
|
function __read(o2, n2) {
|
|
3229
3346
|
var m2 = typeof Symbol === "function" && o2[Symbol.iterator];
|
|
3230
3347
|
if (!m2) return o2;
|
|
3231
|
-
var i2 = m2.call(o2),
|
|
3348
|
+
var i2 = m2.call(o2), r3, ar = [], e2;
|
|
3232
3349
|
try {
|
|
3233
|
-
while ((n2 === void 0 || n2-- > 0) && !(
|
|
3350
|
+
while ((n2 === void 0 || n2-- > 0) && !(r3 = i2.next()).done) ar.push(r3.value);
|
|
3234
3351
|
} catch (error) {
|
|
3235
3352
|
e2 = { error };
|
|
3236
3353
|
} finally {
|
|
3237
3354
|
try {
|
|
3238
|
-
if (
|
|
3355
|
+
if (r3 && !r3.done && (m2 = i2["return"])) m2.call(i2);
|
|
3239
3356
|
} finally {
|
|
3240
3357
|
if (e2) throw e2.error;
|
|
3241
3358
|
}
|
|
@@ -3951,27 +4068,27 @@ var rgba = {
|
|
|
3951
4068
|
|
|
3952
4069
|
// node_modules/style-value-types/dist/es/color/hex.mjs
|
|
3953
4070
|
function parseHex(v2) {
|
|
3954
|
-
let
|
|
4071
|
+
let r3 = "";
|
|
3955
4072
|
let g2 = "";
|
|
3956
4073
|
let b3 = "";
|
|
3957
4074
|
let a3 = "";
|
|
3958
4075
|
if (v2.length > 5) {
|
|
3959
|
-
|
|
4076
|
+
r3 = v2.substr(1, 2);
|
|
3960
4077
|
g2 = v2.substr(3, 2);
|
|
3961
4078
|
b3 = v2.substr(5, 2);
|
|
3962
4079
|
a3 = v2.substr(7, 2);
|
|
3963
4080
|
} else {
|
|
3964
|
-
|
|
4081
|
+
r3 = v2.substr(1, 1);
|
|
3965
4082
|
g2 = v2.substr(2, 1);
|
|
3966
4083
|
b3 = v2.substr(3, 1);
|
|
3967
4084
|
a3 = v2.substr(4, 1);
|
|
3968
|
-
|
|
4085
|
+
r3 += r3;
|
|
3969
4086
|
g2 += g2;
|
|
3970
4087
|
b3 += b3;
|
|
3971
4088
|
a3 += a3;
|
|
3972
4089
|
}
|
|
3973
4090
|
return {
|
|
3974
|
-
red: parseInt(
|
|
4091
|
+
red: parseInt(r3, 16),
|
|
3975
4092
|
green: parseInt(g2, 16),
|
|
3976
4093
|
blue: parseInt(b3, 16),
|
|
3977
4094
|
alpha: a3 ? parseInt(a3, 16) / 255 : 1
|
|
@@ -4307,7 +4424,7 @@ function loadExternalIsValidProp(isValidProp) {
|
|
|
4307
4424
|
};
|
|
4308
4425
|
}
|
|
4309
4426
|
try {
|
|
4310
|
-
loadExternalIsValidProp((
|
|
4427
|
+
loadExternalIsValidProp(__require("@emotion/is-prop-valid").default);
|
|
4311
4428
|
} catch (_a2) {
|
|
4312
4429
|
}
|
|
4313
4430
|
function filterProps(props, isDom, forwardMotionProps) {
|
|
@@ -4574,8 +4691,8 @@ function makeLatestValues(props, context, presenceContext, scrapeMotionValues) {
|
|
|
4574
4691
|
for (var key2 in target) {
|
|
4575
4692
|
var valueTarget = target[key2];
|
|
4576
4693
|
if (Array.isArray(valueTarget)) {
|
|
4577
|
-
var
|
|
4578
|
-
valueTarget = valueTarget[
|
|
4694
|
+
var index = initialAnimationIsBlocked ? valueTarget.length - 1 : 0;
|
|
4695
|
+
valueTarget = valueTarget[index];
|
|
4579
4696
|
}
|
|
4580
4697
|
if (valueTarget !== null) {
|
|
4581
4698
|
values[key2] = valueTarget;
|
|
@@ -5386,9 +5503,9 @@ function createRenderStep(runNextFrame2) {
|
|
|
5386
5503
|
return callback;
|
|
5387
5504
|
},
|
|
5388
5505
|
cancel: (callback) => {
|
|
5389
|
-
const
|
|
5390
|
-
if (
|
|
5391
|
-
toRunNextFrame.splice(
|
|
5506
|
+
const index = toRunNextFrame.indexOf(callback);
|
|
5507
|
+
if (index !== -1)
|
|
5508
|
+
toRunNextFrame.splice(index, 1);
|
|
5392
5509
|
toKeepAlive.delete(callback);
|
|
5393
5510
|
},
|
|
5394
5511
|
process: (frameData) => {
|
|
@@ -6250,8 +6367,8 @@ function addUniqueItem(arr, item) {
|
|
|
6250
6367
|
arr.indexOf(item) === -1 && arr.push(item);
|
|
6251
6368
|
}
|
|
6252
6369
|
function removeItem(arr, item) {
|
|
6253
|
-
var
|
|
6254
|
-
|
|
6370
|
+
var index = arr.indexOf(item);
|
|
6371
|
+
index > -1 && arr.splice(index, 1);
|
|
6255
6372
|
}
|
|
6256
6373
|
|
|
6257
6374
|
// node_modules/framer-motion/dist/es/utils/subscription-manager.mjs
|
|
@@ -12804,8 +12921,8 @@ var SpansDataGrid = ({
|
|
|
12804
12921
|
hasRows && !hasMoreForward && /* @__PURE__ */ jsx124(StreamBoundaryRow, { colSpan: columnCount, label: LABEL_END_OF_STREAM }),
|
|
12805
12922
|
hasRows && /* @__PURE__ */ jsx124(AnimatePresence, { initial: false, children: (() => {
|
|
12806
12923
|
const reversed = [];
|
|
12807
|
-
for (let
|
|
12808
|
-
const row = rows.at(
|
|
12924
|
+
for (let index = rows.length - 1; index >= 0; index--) {
|
|
12925
|
+
const row = rows.at(index);
|
|
12809
12926
|
reversed.push(
|
|
12810
12927
|
/* @__PURE__ */ jsx124(SpansDataGridRow, { row }, row.original.span_id)
|
|
12811
12928
|
);
|
|
@@ -13843,169 +13960,1979 @@ var useSpans = () => {
|
|
|
13843
13960
|
|
|
13844
13961
|
// src/pages/trace-graph-page.tsx
|
|
13845
13962
|
import { ArrowBack } from "@mui/icons-material";
|
|
13846
|
-
import { Box as
|
|
13963
|
+
import { Box as Box17, Button as Button5, Drawer, Paper as Paper3 } from "@mui/material";
|
|
13847
13964
|
import { styled } from "@mui/material/styles";
|
|
13848
13965
|
import { ReactFlowProvider } from "@xyflow/react";
|
|
13849
|
-
import { useCallback as
|
|
13966
|
+
import { useCallback as useCallback9, useEffect as useEffect19, useRef as useRef14, useState as useState14 } from "react";
|
|
13850
13967
|
|
|
13851
13968
|
// src/components/event-details/event-details.tsx
|
|
13852
|
-
import {
|
|
13853
|
-
import {
|
|
13854
|
-
|
|
13855
|
-
//
|
|
13856
|
-
|
|
13857
|
-
|
|
13858
|
-
|
|
13969
|
+
import { Close as Close2 } from "@mui/icons-material";
|
|
13970
|
+
import { Box as Box13, Chip as Chip3, Divider as Divider2, FormControlLabel as FormControlLabel2, IconButton as IconButton3, Stack as Stack2, Switch, Typography as Typography9, useTheme as useTheme3 } from "@mui/material";
|
|
13971
|
+
|
|
13972
|
+
// node_modules/@textea/json-viewer/dist/index.mjs
|
|
13973
|
+
var import_copy_to_clipboard = __toESM(require_copy_to_clipboard(), 1);
|
|
13974
|
+
import { jsx as jsx129, jsxs as jsxs123, Fragment as Fragment5 } from "react/jsx-runtime";
|
|
13975
|
+
import { Box as Box6, InputBase, NoSsr, SvgIcon, createTheme, ThemeProvider, Paper as Paper2 } from "@mui/material";
|
|
13976
|
+
import { createContext as createContext9, useContext as useContext16, useState as useState8, useRef as useRef11, useCallback as useCallback8, useMemo as useMemo7, useEffect as useEffect15, memo as memo9 } from "react";
|
|
13977
|
+
import { create, useStore, createStore } from "zustand";
|
|
13978
|
+
function r(e2) {
|
|
13979
|
+
var t2, f2, n2 = "";
|
|
13980
|
+
if ("string" == typeof e2 || "number" == typeof e2) n2 += e2;
|
|
13981
|
+
else if ("object" == typeof e2) if (Array.isArray(e2)) {
|
|
13982
|
+
var o2 = e2.length;
|
|
13983
|
+
for (t2 = 0; t2 < o2; t2++) e2[t2] && (f2 = r(e2[t2])) && (n2 && (n2 += " "), n2 += f2);
|
|
13984
|
+
} else for (f2 in e2) e2[f2] && (n2 && (n2 += " "), n2 += f2);
|
|
13985
|
+
return n2;
|
|
13986
|
+
}
|
|
13987
|
+
function clsx() {
|
|
13988
|
+
for (var e2, t2, f2 = 0, n2 = "", o2 = arguments.length; f2 < o2; f2++) (e2 = arguments[f2]) && (t2 = r(e2)) && (n2 && (n2 += " "), n2 += t2);
|
|
13989
|
+
return n2;
|
|
13990
|
+
}
|
|
13991
|
+
var lightColorspace = {
|
|
13992
|
+
scheme: "Light Theme",
|
|
13993
|
+
author: "mac gainor (https://github.com/mac-s-g)",
|
|
13994
|
+
base00: "rgba(0, 0, 0, 0)",
|
|
13995
|
+
base01: "rgb(245, 245, 245)",
|
|
13996
|
+
base02: "rgb(235, 235, 235)",
|
|
13997
|
+
base03: "#93a1a1",
|
|
13998
|
+
base04: "rgba(0, 0, 0, 0.3)",
|
|
13999
|
+
base05: "#586e75",
|
|
14000
|
+
base06: "#073642",
|
|
14001
|
+
base07: "#002b36",
|
|
14002
|
+
base08: "#d33682",
|
|
14003
|
+
base09: "#cb4b16",
|
|
14004
|
+
base0A: "#ffd500",
|
|
14005
|
+
base0B: "#859900",
|
|
14006
|
+
base0C: "#6c71c4",
|
|
14007
|
+
base0D: "#586e75",
|
|
14008
|
+
base0E: "#2aa198",
|
|
14009
|
+
base0F: "#268bd2"
|
|
14010
|
+
};
|
|
14011
|
+
var darkColorspace = {
|
|
14012
|
+
scheme: "Dark Theme",
|
|
14013
|
+
author: "Chris Kempson (http://chriskempson.com)",
|
|
14014
|
+
base00: "#181818",
|
|
14015
|
+
base01: "#282828",
|
|
14016
|
+
base02: "#383838",
|
|
14017
|
+
base03: "#585858",
|
|
14018
|
+
base04: "#b8b8b8",
|
|
14019
|
+
base05: "#d8d8d8",
|
|
14020
|
+
base06: "#e8e8e8",
|
|
14021
|
+
base07: "#f8f8f8",
|
|
14022
|
+
base08: "#ab4642",
|
|
14023
|
+
base09: "#dc9656",
|
|
14024
|
+
base0A: "#f7ca88",
|
|
14025
|
+
base0B: "#a1b56c",
|
|
14026
|
+
base0C: "#86c1b9",
|
|
14027
|
+
base0D: "#7cafc2",
|
|
14028
|
+
base0E: "#ba8baf",
|
|
14029
|
+
base0F: "#a16946"
|
|
14030
|
+
};
|
|
14031
|
+
var DefaultKeyRenderer = () => null;
|
|
14032
|
+
DefaultKeyRenderer.when = () => false;
|
|
14033
|
+
var createJsonViewerStore = (props) => {
|
|
14034
|
+
return create()((set, get) => {
|
|
14035
|
+
var _props_rootName, _props_indentWidth, _props_keyRenderer, _props_enableAdd, _props_enableDelete, _props_enableClipboard, _props_editable, _props_onChange, _props_onCopy, _props_onSelect, _props_onAdd, _props_onDelete, _props_defaultInspectDepth, _props_defaultInspectControl, _props_maxDisplayLength, _props_groupArraysAfterLength, _props_collapseStringsAfterLength, _props_objectSortKeys, _props_quotesOnKeys, _props_displayDataTypes, _props_displaySize, _props_displayComma, _props_highlightUpdates;
|
|
14036
|
+
return {
|
|
14037
|
+
// provided by user
|
|
14038
|
+
rootName: (_props_rootName = props.rootName) !== null && _props_rootName !== void 0 ? _props_rootName : "root",
|
|
14039
|
+
indentWidth: (_props_indentWidth = props.indentWidth) !== null && _props_indentWidth !== void 0 ? _props_indentWidth : 3,
|
|
14040
|
+
keyRenderer: (_props_keyRenderer = props.keyRenderer) !== null && _props_keyRenderer !== void 0 ? _props_keyRenderer : DefaultKeyRenderer,
|
|
14041
|
+
enableAdd: (_props_enableAdd = props.enableAdd) !== null && _props_enableAdd !== void 0 ? _props_enableAdd : false,
|
|
14042
|
+
enableDelete: (_props_enableDelete = props.enableDelete) !== null && _props_enableDelete !== void 0 ? _props_enableDelete : false,
|
|
14043
|
+
enableClipboard: (_props_enableClipboard = props.enableClipboard) !== null && _props_enableClipboard !== void 0 ? _props_enableClipboard : true,
|
|
14044
|
+
editable: (_props_editable = props.editable) !== null && _props_editable !== void 0 ? _props_editable : false,
|
|
14045
|
+
onChange: (_props_onChange = props.onChange) !== null && _props_onChange !== void 0 ? _props_onChange : () => {
|
|
14046
|
+
},
|
|
14047
|
+
onCopy: (_props_onCopy = props.onCopy) !== null && _props_onCopy !== void 0 ? _props_onCopy : void 0,
|
|
14048
|
+
onSelect: (_props_onSelect = props.onSelect) !== null && _props_onSelect !== void 0 ? _props_onSelect : void 0,
|
|
14049
|
+
onAdd: (_props_onAdd = props.onAdd) !== null && _props_onAdd !== void 0 ? _props_onAdd : void 0,
|
|
14050
|
+
onDelete: (_props_onDelete = props.onDelete) !== null && _props_onDelete !== void 0 ? _props_onDelete : void 0,
|
|
14051
|
+
defaultInspectDepth: (_props_defaultInspectDepth = props.defaultInspectDepth) !== null && _props_defaultInspectDepth !== void 0 ? _props_defaultInspectDepth : 5,
|
|
14052
|
+
defaultInspectControl: (_props_defaultInspectControl = props.defaultInspectControl) !== null && _props_defaultInspectControl !== void 0 ? _props_defaultInspectControl : void 0,
|
|
14053
|
+
maxDisplayLength: (_props_maxDisplayLength = props.maxDisplayLength) !== null && _props_maxDisplayLength !== void 0 ? _props_maxDisplayLength : 30,
|
|
14054
|
+
groupArraysAfterLength: (_props_groupArraysAfterLength = props.groupArraysAfterLength) !== null && _props_groupArraysAfterLength !== void 0 ? _props_groupArraysAfterLength : 100,
|
|
14055
|
+
collapseStringsAfterLength: props.collapseStringsAfterLength === false ? Number.MAX_VALUE : (_props_collapseStringsAfterLength = props.collapseStringsAfterLength) !== null && _props_collapseStringsAfterLength !== void 0 ? _props_collapseStringsAfterLength : 50,
|
|
14056
|
+
objectSortKeys: (_props_objectSortKeys = props.objectSortKeys) !== null && _props_objectSortKeys !== void 0 ? _props_objectSortKeys : false,
|
|
14057
|
+
quotesOnKeys: (_props_quotesOnKeys = props.quotesOnKeys) !== null && _props_quotesOnKeys !== void 0 ? _props_quotesOnKeys : true,
|
|
14058
|
+
displayDataTypes: (_props_displayDataTypes = props.displayDataTypes) !== null && _props_displayDataTypes !== void 0 ? _props_displayDataTypes : true,
|
|
14059
|
+
displaySize: (_props_displaySize = props.displaySize) !== null && _props_displaySize !== void 0 ? _props_displaySize : true,
|
|
14060
|
+
displayComma: (_props_displayComma = props.displayComma) !== null && _props_displayComma !== void 0 ? _props_displayComma : false,
|
|
14061
|
+
highlightUpdates: (_props_highlightUpdates = props.highlightUpdates) !== null && _props_highlightUpdates !== void 0 ? _props_highlightUpdates : false,
|
|
14062
|
+
// internal state
|
|
14063
|
+
inspectCache: {},
|
|
14064
|
+
hoverPath: null,
|
|
14065
|
+
colorspace: lightColorspace,
|
|
14066
|
+
value: props.value,
|
|
14067
|
+
prevValue: void 0,
|
|
14068
|
+
getInspectCache: (path, nestedIndex) => {
|
|
14069
|
+
const target = nestedIndex !== void 0 ? path.join(".") + "[".concat(nestedIndex, "]nt") : path.join(".");
|
|
14070
|
+
return get().inspectCache[target];
|
|
14071
|
+
},
|
|
14072
|
+
setInspectCache: (path, action, nestedIndex) => {
|
|
14073
|
+
const target = nestedIndex !== void 0 ? path.join(".") + "[".concat(nestedIndex, "]nt") : path.join(".");
|
|
14074
|
+
set((state) => ({
|
|
14075
|
+
inspectCache: {
|
|
14076
|
+
...state.inspectCache,
|
|
14077
|
+
[target]: typeof action === "function" ? action(state.inspectCache[target]) : action
|
|
14078
|
+
}
|
|
14079
|
+
}));
|
|
14080
|
+
},
|
|
14081
|
+
setHover: (path, nestedIndex) => {
|
|
14082
|
+
set({
|
|
14083
|
+
hoverPath: path ? {
|
|
14084
|
+
path,
|
|
14085
|
+
nestedIndex
|
|
14086
|
+
} : null
|
|
14087
|
+
});
|
|
14088
|
+
}
|
|
14089
|
+
};
|
|
14090
|
+
});
|
|
14091
|
+
};
|
|
14092
|
+
var JsonViewerStoreContext = createContext9(void 0);
|
|
14093
|
+
JsonViewerStoreContext.Provider;
|
|
14094
|
+
var useJsonViewerStore = (selector2, equalityFn) => {
|
|
14095
|
+
const store = useContext16(JsonViewerStoreContext);
|
|
14096
|
+
return useStore(store, selector2, equalityFn);
|
|
14097
|
+
};
|
|
14098
|
+
var useTextColor = () => {
|
|
14099
|
+
return useJsonViewerStore((store) => store.colorspace.base07);
|
|
14100
|
+
};
|
|
14101
|
+
var objectCtorString = Object.prototype.constructor.toString();
|
|
14102
|
+
function isPlainObject(value) {
|
|
14103
|
+
if (!value || typeof value !== "object") return false;
|
|
14104
|
+
const proto = Object.getPrototypeOf(value);
|
|
14105
|
+
if (proto === null) return true;
|
|
14106
|
+
const Ctor = Object.hasOwnProperty.call(proto, "constructor") && proto.constructor;
|
|
14107
|
+
if (Ctor === Object) return true;
|
|
14108
|
+
return typeof Ctor === "function" && Function.toString.call(Ctor) === objectCtorString;
|
|
14109
|
+
}
|
|
14110
|
+
var isCycleReference = (root, path, value) => {
|
|
14111
|
+
if (root === null || value === null) {
|
|
14112
|
+
return false;
|
|
13859
14113
|
}
|
|
13860
|
-
if (
|
|
13861
|
-
return
|
|
14114
|
+
if (typeof root !== "object") {
|
|
14115
|
+
return false;
|
|
13862
14116
|
}
|
|
13863
|
-
if (
|
|
13864
|
-
return
|
|
14117
|
+
if (typeof value !== "object") {
|
|
14118
|
+
return false;
|
|
13865
14119
|
}
|
|
13866
|
-
|
|
13867
|
-
|
|
13868
|
-
|
|
13869
|
-
|
|
13870
|
-
|
|
13871
|
-
|
|
13872
|
-
|
|
13873
|
-
|
|
13874
|
-
|
|
13875
|
-
|
|
13876
|
-
|
|
13877
|
-
return "Implicitly Allowed";
|
|
14120
|
+
if (Object.is(root, value) && path.length !== 0) {
|
|
14121
|
+
return "";
|
|
14122
|
+
}
|
|
14123
|
+
const currentPath = [];
|
|
14124
|
+
const arr = [
|
|
14125
|
+
...path
|
|
14126
|
+
];
|
|
14127
|
+
let currentRoot = root;
|
|
14128
|
+
while (currentRoot !== value || arr.length !== 0) {
|
|
14129
|
+
if (typeof currentRoot !== "object" || currentRoot === null) {
|
|
14130
|
+
return false;
|
|
13878
14131
|
}
|
|
13879
|
-
|
|
13880
|
-
return
|
|
14132
|
+
if (Object.is(currentRoot, value)) {
|
|
14133
|
+
return currentPath.reduce((path2, value2, currentIndex) => {
|
|
14134
|
+
if (typeof value2 === "number") {
|
|
14135
|
+
return path2 + "[".concat(value2, "]");
|
|
14136
|
+
}
|
|
14137
|
+
return path2 + "".concat(currentIndex === 0 ? "" : ".").concat(value2);
|
|
14138
|
+
}, "");
|
|
13881
14139
|
}
|
|
14140
|
+
const target = arr.shift();
|
|
14141
|
+
currentPath.push(target);
|
|
14142
|
+
currentRoot = currentRoot[target];
|
|
14143
|
+
}
|
|
14144
|
+
return false;
|
|
14145
|
+
};
|
|
14146
|
+
function getValueSize(value) {
|
|
14147
|
+
if (value === null || void 0) {
|
|
14148
|
+
return 0;
|
|
14149
|
+
} else if (Array.isArray(value)) {
|
|
14150
|
+
return value.length;
|
|
14151
|
+
} else if (value instanceof Map || value instanceof Set) {
|
|
14152
|
+
return value.size;
|
|
14153
|
+
} else if (value instanceof Date) {
|
|
14154
|
+
return 1;
|
|
14155
|
+
} else if (typeof value === "object") {
|
|
14156
|
+
return Object.keys(value).length;
|
|
14157
|
+
} else if (typeof value === "string") {
|
|
14158
|
+
return value.length;
|
|
13882
14159
|
}
|
|
14160
|
+
return 1;
|
|
13883
14161
|
}
|
|
13884
|
-
function
|
|
13885
|
-
|
|
13886
|
-
|
|
13887
|
-
|
|
13888
|
-
|
|
13889
|
-
|
|
13890
|
-
case "explicitly_denied": {
|
|
13891
|
-
return "error.main";
|
|
13892
|
-
}
|
|
13893
|
-
case "implicitly_denied": {
|
|
13894
|
-
return "warning.main";
|
|
13895
|
-
}
|
|
14162
|
+
function segmentArray(arr, size) {
|
|
14163
|
+
const result = [];
|
|
14164
|
+
let index = 0;
|
|
14165
|
+
while (index < arr.length) {
|
|
14166
|
+
result.push(arr.slice(index, index + size));
|
|
14167
|
+
index += size;
|
|
13896
14168
|
}
|
|
14169
|
+
return result;
|
|
13897
14170
|
}
|
|
13898
|
-
function
|
|
13899
|
-
|
|
13900
|
-
|
|
13901
|
-
|
|
13902
|
-
|
|
13903
|
-
|
|
13904
|
-
|
|
13905
|
-
|
|
13906
|
-
|
|
13907
|
-
|
|
14171
|
+
function safeStringify(obj, space) {
|
|
14172
|
+
const seenValues = [];
|
|
14173
|
+
function replacer(key, value) {
|
|
14174
|
+
if (typeof value === "bigint") return value.toString();
|
|
14175
|
+
if (value instanceof Map) {
|
|
14176
|
+
if ("toJSON" in value && typeof value.toJSON === "function") return value.toJSON();
|
|
14177
|
+
if (value.size === 0) return {};
|
|
14178
|
+
if (seenValues.includes(value)) return "[Circular]";
|
|
14179
|
+
seenValues.push(value);
|
|
14180
|
+
const entries = Array.from(value.entries());
|
|
14181
|
+
if (entries.every((param) => {
|
|
14182
|
+
let [key2] = param;
|
|
14183
|
+
return typeof key2 === "string" || typeof key2 === "number";
|
|
14184
|
+
})) {
|
|
14185
|
+
return Object.fromEntries(entries);
|
|
13908
14186
|
}
|
|
14187
|
+
return {};
|
|
13909
14188
|
}
|
|
13910
|
-
if (
|
|
13911
|
-
|
|
13912
|
-
|
|
13913
|
-
|
|
14189
|
+
if (value instanceof Set) {
|
|
14190
|
+
if ("toJSON" in value && typeof value.toJSON === "function") return value.toJSON();
|
|
14191
|
+
if (seenValues.includes(value)) return "[Circular]";
|
|
14192
|
+
seenValues.push(value);
|
|
14193
|
+
return Array.from(value.values());
|
|
14194
|
+
}
|
|
14195
|
+
if (typeof value === "object" && value !== null && Object.keys(value).length) {
|
|
14196
|
+
const stackSize = seenValues.length;
|
|
14197
|
+
if (stackSize) {
|
|
14198
|
+
for (let n2 = stackSize - 1; n2 >= 0 && seenValues[n2][key] !== value; --n2) {
|
|
14199
|
+
seenValues.pop();
|
|
14200
|
+
}
|
|
14201
|
+
if (seenValues.includes(value)) return "[Circular]";
|
|
13914
14202
|
}
|
|
14203
|
+
seenValues.push(value);
|
|
13915
14204
|
}
|
|
13916
|
-
|
|
13917
|
-
|
|
13918
|
-
|
|
13919
|
-
|
|
13920
|
-
|
|
14205
|
+
return value;
|
|
14206
|
+
}
|
|
14207
|
+
return JSON.stringify(obj, replacer, space);
|
|
14208
|
+
}
|
|
14209
|
+
async function copyString(value) {
|
|
14210
|
+
if ("clipboard" in navigator) {
|
|
14211
|
+
try {
|
|
14212
|
+
await navigator.clipboard.writeText(value);
|
|
14213
|
+
} catch {
|
|
13921
14214
|
}
|
|
13922
|
-
return {
|
|
13923
|
-
details: {
|
|
13924
|
-
actions,
|
|
13925
|
-
explicitAllows: payload.explicit_allow_count,
|
|
13926
|
-
explicitDenies: payload.explicit_deny_count,
|
|
13927
|
-
implicitDenies: payload.implicit_deny_count,
|
|
13928
|
-
resources
|
|
13929
|
-
},
|
|
13930
|
-
operation: payload.operation,
|
|
13931
|
-
permission,
|
|
13932
|
-
principal: payload.principal_arn,
|
|
13933
|
-
service: payload.service
|
|
13934
|
-
};
|
|
13935
|
-
} catch (error) {
|
|
13936
|
-
console.error("Error parsing IAM event payload:", error);
|
|
13937
|
-
return void 0;
|
|
13938
14215
|
}
|
|
14216
|
+
(0, import_copy_to_clipboard.default)(value);
|
|
13939
14217
|
}
|
|
13940
|
-
|
|
13941
|
-
|
|
13942
|
-
|
|
13943
|
-
|
|
13944
|
-
|
|
13945
|
-
|
|
13946
|
-
|
|
13947
|
-
|
|
13948
|
-
|
|
13949
|
-
|
|
13950
|
-
|
|
13951
|
-
|
|
13952
|
-
|
|
13953
|
-
|
|
13954
|
-
|
|
13955
|
-
|
|
13956
|
-
|
|
13957
|
-
|
|
13958
|
-
|
|
13959
|
-
|
|
14218
|
+
function useClipboard() {
|
|
14219
|
+
let { timeout = 2e3 } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
14220
|
+
const [copied, setCopied] = useState8(false);
|
|
14221
|
+
const copyTimeout = useRef11(null);
|
|
14222
|
+
const handleCopyResult = useCallback8((value) => {
|
|
14223
|
+
const current = copyTimeout.current;
|
|
14224
|
+
if (current) {
|
|
14225
|
+
window.clearTimeout(current);
|
|
14226
|
+
}
|
|
14227
|
+
copyTimeout.current = window.setTimeout(() => setCopied(false), timeout);
|
|
14228
|
+
setCopied(value);
|
|
14229
|
+
}, [
|
|
14230
|
+
timeout
|
|
14231
|
+
]);
|
|
14232
|
+
const onCopy = useJsonViewerStore((store) => store.onCopy);
|
|
14233
|
+
const copy = useCallback8(async (path, value) => {
|
|
14234
|
+
if (typeof onCopy === "function") {
|
|
14235
|
+
try {
|
|
14236
|
+
await onCopy(path, value, copyString);
|
|
14237
|
+
handleCopyResult(true);
|
|
14238
|
+
} catch (error) {
|
|
14239
|
+
console.error("error when copy ".concat(path.length === 0 ? "src" : "src[".concat(path.join(".")), "]"), error);
|
|
13960
14240
|
}
|
|
13961
|
-
|
|
13962
|
-
|
|
14241
|
+
} else {
|
|
14242
|
+
try {
|
|
14243
|
+
const valueToCopy = safeStringify(typeof value === "function" ? value.toString() : value, " ");
|
|
14244
|
+
await copyString(valueToCopy);
|
|
14245
|
+
handleCopyResult(true);
|
|
14246
|
+
} catch (error) {
|
|
14247
|
+
console.error("error when copy ".concat(path.length === 0 ? "src" : "src[".concat(path.join(".")), "]"), error);
|
|
13963
14248
|
}
|
|
13964
|
-
return {
|
|
13965
|
-
details: detailsParts.join("\n"),
|
|
13966
|
-
headline: headline2,
|
|
13967
|
-
message: messageParts.join("\n")
|
|
13968
|
-
};
|
|
13969
14249
|
}
|
|
13970
|
-
}
|
|
13971
|
-
|
|
13972
|
-
|
|
13973
|
-
|
|
13974
|
-
|
|
13975
|
-
|
|
13976
|
-
|
|
13977
|
-
|
|
13978
|
-
|
|
13979
|
-
|
|
13980
|
-
return {
|
|
13981
|
-
|
|
13982
|
-
|
|
13983
|
-
|
|
13984
|
-
|
|
13985
|
-
|
|
13986
|
-
|
|
13987
|
-
|
|
13988
|
-
|
|
13989
|
-
|
|
13990
|
-
|
|
13991
|
-
|
|
13992
|
-
|
|
13993
|
-
|
|
13994
|
-
|
|
13995
|
-
|
|
13996
|
-
|
|
13997
|
-
|
|
13998
|
-
|
|
14250
|
+
}, [
|
|
14251
|
+
handleCopyResult,
|
|
14252
|
+
onCopy
|
|
14253
|
+
]);
|
|
14254
|
+
const reset = useCallback8(() => {
|
|
14255
|
+
setCopied(false);
|
|
14256
|
+
if (copyTimeout.current) {
|
|
14257
|
+
clearTimeout(copyTimeout.current);
|
|
14258
|
+
}
|
|
14259
|
+
}, []);
|
|
14260
|
+
return {
|
|
14261
|
+
copy,
|
|
14262
|
+
reset,
|
|
14263
|
+
copied
|
|
14264
|
+
};
|
|
14265
|
+
}
|
|
14266
|
+
function useIsCycleReference(path, value) {
|
|
14267
|
+
const rootValue = useJsonViewerStore((store) => store.value);
|
|
14268
|
+
return useMemo7(() => isCycleReference(rootValue, path, value), [
|
|
14269
|
+
path,
|
|
14270
|
+
value,
|
|
14271
|
+
rootValue
|
|
14272
|
+
]);
|
|
14273
|
+
}
|
|
14274
|
+
function useInspect(path, value, nestedIndex) {
|
|
14275
|
+
const depth = path.length;
|
|
14276
|
+
const isTrap = useIsCycleReference(path, value);
|
|
14277
|
+
const getInspectCache = useJsonViewerStore((store) => store.getInspectCache);
|
|
14278
|
+
const setInspectCache = useJsonViewerStore((store) => store.setInspectCache);
|
|
14279
|
+
const defaultInspectDepth = useJsonViewerStore((store) => store.defaultInspectDepth);
|
|
14280
|
+
const defaultInspectControl = useJsonViewerStore((store) => store.defaultInspectControl);
|
|
14281
|
+
useEffect15(() => {
|
|
14282
|
+
const inspect2 = getInspectCache(path, nestedIndex);
|
|
14283
|
+
if (inspect2 !== void 0) {
|
|
14284
|
+
return;
|
|
14285
|
+
}
|
|
14286
|
+
if (nestedIndex !== void 0) {
|
|
14287
|
+
setInspectCache(path, false, nestedIndex);
|
|
14288
|
+
return;
|
|
13999
14289
|
}
|
|
14290
|
+
const shouldInspect = isTrap ? false : typeof defaultInspectControl === "function" ? defaultInspectControl(path, value) : depth < defaultInspectDepth;
|
|
14291
|
+
setInspectCache(path, shouldInspect);
|
|
14292
|
+
}, [
|
|
14293
|
+
defaultInspectDepth,
|
|
14294
|
+
defaultInspectControl,
|
|
14295
|
+
depth,
|
|
14296
|
+
getInspectCache,
|
|
14297
|
+
isTrap,
|
|
14298
|
+
nestedIndex,
|
|
14299
|
+
path,
|
|
14300
|
+
value,
|
|
14301
|
+
setInspectCache
|
|
14302
|
+
]);
|
|
14303
|
+
const [inspect, set] = useState8(() => {
|
|
14304
|
+
const shouldInspect = getInspectCache(path, nestedIndex);
|
|
14305
|
+
if (shouldInspect !== void 0) {
|
|
14306
|
+
return shouldInspect;
|
|
14307
|
+
}
|
|
14308
|
+
if (nestedIndex !== void 0) {
|
|
14309
|
+
return false;
|
|
14310
|
+
}
|
|
14311
|
+
return isTrap ? false : typeof defaultInspectControl === "function" ? defaultInspectControl(path, value) : depth < defaultInspectDepth;
|
|
14312
|
+
});
|
|
14313
|
+
const setInspect = useCallback8((apply) => {
|
|
14314
|
+
set((oldState) => {
|
|
14315
|
+
const newState = typeof apply === "boolean" ? apply : apply(oldState);
|
|
14316
|
+
setInspectCache(path, newState, nestedIndex);
|
|
14317
|
+
return newState;
|
|
14318
|
+
});
|
|
14319
|
+
}, [
|
|
14320
|
+
nestedIndex,
|
|
14321
|
+
path,
|
|
14322
|
+
setInspectCache
|
|
14323
|
+
]);
|
|
14324
|
+
return [
|
|
14325
|
+
inspect,
|
|
14326
|
+
setInspect
|
|
14327
|
+
];
|
|
14328
|
+
}
|
|
14329
|
+
var DataBox = (props) => /* @__PURE__ */ jsx129(Box6, {
|
|
14330
|
+
component: "div",
|
|
14331
|
+
...props,
|
|
14332
|
+
sx: {
|
|
14333
|
+
display: "inline-block",
|
|
14334
|
+
...props.sx
|
|
14000
14335
|
}
|
|
14336
|
+
});
|
|
14337
|
+
var DataTypeLabel = (param) => {
|
|
14338
|
+
let { dataType, enable = true } = param;
|
|
14339
|
+
if (!enable) return null;
|
|
14340
|
+
return /* @__PURE__ */ jsx129(DataBox, {
|
|
14341
|
+
className: "data-type-label",
|
|
14342
|
+
sx: {
|
|
14343
|
+
mx: 0.5,
|
|
14344
|
+
fontSize: "0.7rem",
|
|
14345
|
+
opacity: 0.8,
|
|
14346
|
+
userSelect: "none"
|
|
14347
|
+
},
|
|
14348
|
+
children: dataType
|
|
14349
|
+
});
|
|
14350
|
+
};
|
|
14351
|
+
function defineEasyType(param) {
|
|
14352
|
+
let { is, serialize, deserialize, type, colorKey, displayTypeLabel = true, Renderer } = param;
|
|
14353
|
+
const Render = /* @__PURE__ */ memo9(Renderer);
|
|
14354
|
+
const EasyType = (props) => {
|
|
14355
|
+
const storeDisplayDataTypes = useJsonViewerStore((store) => store.displayDataTypes);
|
|
14356
|
+
const color2 = useJsonViewerStore((store) => store.colorspace[colorKey]);
|
|
14357
|
+
const onSelect = useJsonViewerStore((store) => store.onSelect);
|
|
14358
|
+
return /* @__PURE__ */ jsxs123(DataBox, {
|
|
14359
|
+
onClick: () => onSelect === null || onSelect === void 0 ? void 0 : onSelect(props.path, props.value),
|
|
14360
|
+
sx: {
|
|
14361
|
+
color: color2
|
|
14362
|
+
},
|
|
14363
|
+
children: [
|
|
14364
|
+
displayTypeLabel && storeDisplayDataTypes && /* @__PURE__ */ jsx129(DataTypeLabel, {
|
|
14365
|
+
dataType: type
|
|
14366
|
+
}),
|
|
14367
|
+
/* @__PURE__ */ jsx129(DataBox, {
|
|
14368
|
+
className: "".concat(type, "-value"),
|
|
14369
|
+
children: /* @__PURE__ */ jsx129(Render, {
|
|
14370
|
+
path: props.path,
|
|
14371
|
+
inspect: props.inspect,
|
|
14372
|
+
setInspect: props.setInspect,
|
|
14373
|
+
value: props.value,
|
|
14374
|
+
prevValue: props.prevValue
|
|
14375
|
+
})
|
|
14376
|
+
})
|
|
14377
|
+
]
|
|
14378
|
+
});
|
|
14379
|
+
};
|
|
14380
|
+
EasyType.displayName = "easy-".concat(type, "-type");
|
|
14381
|
+
if (!serialize || !deserialize) {
|
|
14382
|
+
return {
|
|
14383
|
+
is,
|
|
14384
|
+
Component: EasyType
|
|
14385
|
+
};
|
|
14386
|
+
}
|
|
14387
|
+
const EasyTypeEditor = (param2) => {
|
|
14388
|
+
let { value, setValue, abortEditing, commitEditing } = param2;
|
|
14389
|
+
const color2 = useJsonViewerStore((store) => store.colorspace[colorKey]);
|
|
14390
|
+
const handleKeyDown = useCallback8((event) => {
|
|
14391
|
+
if (event.key === "Enter") {
|
|
14392
|
+
event.preventDefault();
|
|
14393
|
+
commitEditing(value);
|
|
14394
|
+
}
|
|
14395
|
+
if (event.key === "Escape") {
|
|
14396
|
+
event.preventDefault();
|
|
14397
|
+
abortEditing();
|
|
14398
|
+
}
|
|
14399
|
+
}, [
|
|
14400
|
+
abortEditing,
|
|
14401
|
+
commitEditing,
|
|
14402
|
+
value
|
|
14403
|
+
]);
|
|
14404
|
+
const handleChange = useCallback8((event) => {
|
|
14405
|
+
setValue(event.target.value);
|
|
14406
|
+
}, [
|
|
14407
|
+
setValue
|
|
14408
|
+
]);
|
|
14409
|
+
return /* @__PURE__ */ jsx129(InputBase, {
|
|
14410
|
+
autoFocus: true,
|
|
14411
|
+
value,
|
|
14412
|
+
onChange: handleChange,
|
|
14413
|
+
onKeyDown: handleKeyDown,
|
|
14414
|
+
size: "small",
|
|
14415
|
+
multiline: true,
|
|
14416
|
+
sx: {
|
|
14417
|
+
color: color2,
|
|
14418
|
+
padding: 0.5,
|
|
14419
|
+
borderStyle: "solid",
|
|
14420
|
+
borderColor: "black",
|
|
14421
|
+
borderWidth: 1,
|
|
14422
|
+
fontSize: "0.8rem",
|
|
14423
|
+
fontFamily: "monospace",
|
|
14424
|
+
display: "inline-flex"
|
|
14425
|
+
}
|
|
14426
|
+
});
|
|
14427
|
+
};
|
|
14428
|
+
EasyTypeEditor.displayName = "easy-".concat(type, "-type-editor");
|
|
14001
14429
|
return {
|
|
14002
|
-
|
|
14003
|
-
|
|
14004
|
-
|
|
14430
|
+
is,
|
|
14431
|
+
serialize,
|
|
14432
|
+
deserialize,
|
|
14433
|
+
Component: EasyType,
|
|
14434
|
+
Editor: EasyTypeEditor
|
|
14005
14435
|
};
|
|
14436
|
+
}
|
|
14437
|
+
var booleanType = defineEasyType({
|
|
14438
|
+
is: (value) => typeof value === "boolean",
|
|
14439
|
+
type: "bool",
|
|
14440
|
+
colorKey: "base0E",
|
|
14441
|
+
serialize: (value) => value.toString(),
|
|
14442
|
+
deserialize: (value) => {
|
|
14443
|
+
if (value === "true") return true;
|
|
14444
|
+
if (value === "false") return false;
|
|
14445
|
+
throw new Error("Invalid boolean value");
|
|
14446
|
+
},
|
|
14447
|
+
Renderer: (param) => {
|
|
14448
|
+
let { value } = param;
|
|
14449
|
+
return /* @__PURE__ */ jsx129(Fragment5, {
|
|
14450
|
+
children: value ? "true" : "false"
|
|
14451
|
+
});
|
|
14452
|
+
}
|
|
14453
|
+
});
|
|
14454
|
+
var displayOptions = {
|
|
14455
|
+
weekday: "short",
|
|
14456
|
+
year: "numeric",
|
|
14457
|
+
month: "short",
|
|
14458
|
+
day: "numeric",
|
|
14459
|
+
hour: "2-digit",
|
|
14460
|
+
minute: "2-digit"
|
|
14461
|
+
};
|
|
14462
|
+
var dateType = defineEasyType({
|
|
14463
|
+
is: (value) => value instanceof Date,
|
|
14464
|
+
type: "date",
|
|
14465
|
+
colorKey: "base0D",
|
|
14466
|
+
Renderer: (param) => {
|
|
14467
|
+
let { value } = param;
|
|
14468
|
+
return /* @__PURE__ */ jsx129(Fragment5, {
|
|
14469
|
+
children: value.toLocaleTimeString("en-us", displayOptions)
|
|
14470
|
+
});
|
|
14471
|
+
}
|
|
14472
|
+
});
|
|
14473
|
+
var functionBody = (func) => {
|
|
14474
|
+
const funcString = func.toString();
|
|
14475
|
+
let isUsualFunction = true;
|
|
14476
|
+
const parenthesisPos = funcString.indexOf(")");
|
|
14477
|
+
const arrowPos = funcString.indexOf("=>");
|
|
14478
|
+
if (arrowPos !== -1 && arrowPos > parenthesisPos) {
|
|
14479
|
+
isUsualFunction = false;
|
|
14480
|
+
}
|
|
14481
|
+
if (isUsualFunction) {
|
|
14482
|
+
return funcString.substring(funcString.indexOf("{", parenthesisPos) + 1, funcString.lastIndexOf("}"));
|
|
14483
|
+
}
|
|
14484
|
+
return funcString.substring(funcString.indexOf("=>") + 2);
|
|
14485
|
+
};
|
|
14486
|
+
var functionName = (func) => {
|
|
14487
|
+
const funcString = func.toString();
|
|
14488
|
+
const isUsualFunction = funcString.indexOf("function") !== -1;
|
|
14489
|
+
if (isUsualFunction) {
|
|
14490
|
+
return funcString.substring(8, funcString.indexOf("{")).trim();
|
|
14491
|
+
}
|
|
14492
|
+
return funcString.substring(0, funcString.indexOf("=>") + 2).trim();
|
|
14493
|
+
};
|
|
14494
|
+
var lb = "{";
|
|
14495
|
+
var rb = "}";
|
|
14496
|
+
var PreFunctionType = (props) => {
|
|
14497
|
+
return /* @__PURE__ */ jsxs123(NoSsr, {
|
|
14498
|
+
children: [
|
|
14499
|
+
/* @__PURE__ */ jsx129(DataTypeLabel, {
|
|
14500
|
+
dataType: "function"
|
|
14501
|
+
}),
|
|
14502
|
+
/* @__PURE__ */ jsxs123(Box6, {
|
|
14503
|
+
component: "span",
|
|
14504
|
+
className: "data-function-start",
|
|
14505
|
+
sx: {
|
|
14506
|
+
letterSpacing: 0.5
|
|
14507
|
+
},
|
|
14508
|
+
children: [
|
|
14509
|
+
functionName(props.value),
|
|
14510
|
+
" ",
|
|
14511
|
+
lb
|
|
14512
|
+
]
|
|
14513
|
+
})
|
|
14514
|
+
]
|
|
14515
|
+
});
|
|
14006
14516
|
};
|
|
14007
|
-
var
|
|
14008
|
-
|
|
14517
|
+
var PostFunctionType = () => {
|
|
14518
|
+
return /* @__PURE__ */ jsx129(NoSsr, {
|
|
14519
|
+
children: /* @__PURE__ */ jsx129(Box6, {
|
|
14520
|
+
component: "span",
|
|
14521
|
+
className: "data-function-end",
|
|
14522
|
+
children: rb
|
|
14523
|
+
})
|
|
14524
|
+
});
|
|
14525
|
+
};
|
|
14526
|
+
var FunctionType = (props) => {
|
|
14527
|
+
const functionColor = useJsonViewerStore((store) => store.colorspace.base05);
|
|
14528
|
+
return /* @__PURE__ */ jsx129(NoSsr, {
|
|
14529
|
+
children: /* @__PURE__ */ jsx129(Box6, {
|
|
14530
|
+
className: "data-function",
|
|
14531
|
+
sx: {
|
|
14532
|
+
display: props.inspect ? "block" : "inline-block",
|
|
14533
|
+
pl: props.inspect ? 2 : 0,
|
|
14534
|
+
color: functionColor
|
|
14535
|
+
},
|
|
14536
|
+
children: props.inspect ? functionBody(props.value) : /* @__PURE__ */ jsx129(Box6, {
|
|
14537
|
+
component: "span",
|
|
14538
|
+
className: "data-function-body",
|
|
14539
|
+
onClick: () => props.setInspect(true),
|
|
14540
|
+
sx: {
|
|
14541
|
+
"&:hover": {
|
|
14542
|
+
cursor: "pointer"
|
|
14543
|
+
},
|
|
14544
|
+
padding: 0.5
|
|
14545
|
+
},
|
|
14546
|
+
children: "\u2026"
|
|
14547
|
+
})
|
|
14548
|
+
})
|
|
14549
|
+
});
|
|
14550
|
+
};
|
|
14551
|
+
var functionType = {
|
|
14552
|
+
is: (value) => typeof value === "function",
|
|
14553
|
+
Component: FunctionType,
|
|
14554
|
+
PreComponent: PreFunctionType,
|
|
14555
|
+
PostComponent: PostFunctionType
|
|
14556
|
+
};
|
|
14557
|
+
var nullType = defineEasyType({
|
|
14558
|
+
is: (value) => value === null,
|
|
14559
|
+
type: "null",
|
|
14560
|
+
colorKey: "base08",
|
|
14561
|
+
displayTypeLabel: false,
|
|
14562
|
+
Renderer: () => {
|
|
14563
|
+
const backgroundColor = useJsonViewerStore((store) => store.colorspace.base02);
|
|
14564
|
+
return /* @__PURE__ */ jsx129(Box6, {
|
|
14565
|
+
sx: {
|
|
14566
|
+
fontSize: "0.8rem",
|
|
14567
|
+
backgroundColor,
|
|
14568
|
+
fontWeight: "bold",
|
|
14569
|
+
borderRadius: "3px",
|
|
14570
|
+
padding: "0.5px 2px"
|
|
14571
|
+
},
|
|
14572
|
+
children: "NULL"
|
|
14573
|
+
});
|
|
14574
|
+
}
|
|
14575
|
+
});
|
|
14576
|
+
var isInt = (n2) => n2 % 1 === 0;
|
|
14577
|
+
var nanType = defineEasyType({
|
|
14578
|
+
is: (value) => typeof value === "number" && isNaN(value),
|
|
14579
|
+
type: "NaN",
|
|
14580
|
+
colorKey: "base08",
|
|
14581
|
+
displayTypeLabel: false,
|
|
14582
|
+
serialize: () => "NaN",
|
|
14583
|
+
// allow deserialize the value back to number
|
|
14584
|
+
deserialize: (value) => parseFloat(value),
|
|
14585
|
+
Renderer: () => {
|
|
14586
|
+
const backgroundColor = useJsonViewerStore((store) => store.colorspace.base02);
|
|
14587
|
+
return /* @__PURE__ */ jsx129(Box6, {
|
|
14588
|
+
sx: {
|
|
14589
|
+
backgroundColor,
|
|
14590
|
+
fontSize: "0.8rem",
|
|
14591
|
+
fontWeight: "bold",
|
|
14592
|
+
borderRadius: "3px",
|
|
14593
|
+
padding: "0.5px 2px"
|
|
14594
|
+
},
|
|
14595
|
+
children: "NaN"
|
|
14596
|
+
});
|
|
14597
|
+
}
|
|
14598
|
+
});
|
|
14599
|
+
var floatType = defineEasyType({
|
|
14600
|
+
is: (value) => typeof value === "number" && !isInt(value) && !isNaN(value),
|
|
14601
|
+
type: "float",
|
|
14602
|
+
colorKey: "base0B",
|
|
14603
|
+
serialize: (value) => value.toString(),
|
|
14604
|
+
deserialize: (value) => parseFloat(value),
|
|
14605
|
+
Renderer: (param) => {
|
|
14606
|
+
let { value } = param;
|
|
14607
|
+
return /* @__PURE__ */ jsx129(Fragment5, {
|
|
14608
|
+
children: value
|
|
14609
|
+
});
|
|
14610
|
+
}
|
|
14611
|
+
});
|
|
14612
|
+
var intType = defineEasyType({
|
|
14613
|
+
is: (value) => typeof value === "number" && isInt(value),
|
|
14614
|
+
type: "int",
|
|
14615
|
+
colorKey: "base0F",
|
|
14616
|
+
serialize: (value) => value.toString(),
|
|
14617
|
+
// allow deserialize the value to float
|
|
14618
|
+
deserialize: (value) => parseFloat(value),
|
|
14619
|
+
Renderer: (param) => {
|
|
14620
|
+
let { value } = param;
|
|
14621
|
+
return /* @__PURE__ */ jsx129(Fragment5, {
|
|
14622
|
+
children: value
|
|
14623
|
+
});
|
|
14624
|
+
}
|
|
14625
|
+
});
|
|
14626
|
+
var bigIntType = defineEasyType({
|
|
14627
|
+
is: (value) => typeof value === "bigint",
|
|
14628
|
+
type: "bigint",
|
|
14629
|
+
colorKey: "base0F",
|
|
14630
|
+
serialize: (value) => value.toString(),
|
|
14631
|
+
deserialize: (value) => BigInt(value.replace(/\D/g, "")),
|
|
14632
|
+
Renderer: (param) => {
|
|
14633
|
+
let { value } = param;
|
|
14634
|
+
return /* @__PURE__ */ jsx129(Fragment5, {
|
|
14635
|
+
children: "".concat(value, "n")
|
|
14636
|
+
});
|
|
14637
|
+
}
|
|
14638
|
+
});
|
|
14639
|
+
var BaseIcon = (param) => {
|
|
14640
|
+
let { d: d2, ...props } = param;
|
|
14641
|
+
return /* @__PURE__ */ jsx129(SvgIcon, {
|
|
14642
|
+
...props,
|
|
14643
|
+
children: /* @__PURE__ */ jsx129("path", {
|
|
14644
|
+
d: d2
|
|
14645
|
+
})
|
|
14646
|
+
});
|
|
14647
|
+
};
|
|
14648
|
+
var AddBox = "M19 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 16H5V5h14zm-8-2h2v-4h4v-2h-4V7h-2v4H7v2h4z";
|
|
14649
|
+
var Check = "M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z";
|
|
14650
|
+
var ChevronRight = "M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z";
|
|
14651
|
+
var CircularArrows = "M 12 2 C 10.615 1.998 9.214625 2.2867656 7.890625 2.8847656 L 8.9003906 4.6328125 C 9.9043906 4.2098125 10.957 3.998 12 4 C 15.080783 4 17.738521 5.7633175 19.074219 8.3222656 L 17.125 9 L 21.25 11 L 22.875 7 L 20.998047 7.6523438 C 19.377701 4.3110398 15.95585 2 12 2 z M 6.5097656 4.4882812 L 2.2324219 5.0820312 L 3.734375 6.3808594 C 1.6515335 9.4550558 1.3615962 13.574578 3.3398438 17 C 4.0308437 18.201 4.9801562 19.268234 6.1601562 20.115234 L 7.1699219 18.367188 C 6.3019219 17.710187 5.5922656 16.904 5.0722656 16 C 3.5320014 13.332354 3.729203 10.148679 5.2773438 7.7128906 L 6.8398438 9.0625 L 6.5097656 4.4882812 z M 19.929688 13 C 19.794687 14.08 19.450734 15.098 18.927734 16 C 17.386985 18.668487 14.531361 20.090637 11.646484 19.966797 L 12.035156 17.9375 L 8.2402344 20.511719 L 10.892578 23.917969 L 11.265625 21.966797 C 14.968963 22.233766 18.681899 20.426323 20.660156 17 C 21.355156 15.801 21.805219 14.445 21.949219 13 L 19.929688 13 z";
|
|
14652
|
+
var Close = "M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z";
|
|
14653
|
+
var ContentCopy = "M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z";
|
|
14654
|
+
var Edit = "M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z";
|
|
14655
|
+
var ExpandMore = "M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z";
|
|
14656
|
+
var Delete = "M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM8 9h8v10H8zm7.5-5l-1-1h-5l-1 1H5v2h14V4z";
|
|
14657
|
+
var AddBoxIcon = (props) => {
|
|
14658
|
+
return /* @__PURE__ */ jsx129(BaseIcon, {
|
|
14659
|
+
d: AddBox,
|
|
14660
|
+
...props
|
|
14661
|
+
});
|
|
14662
|
+
};
|
|
14663
|
+
var CheckIcon = (props) => {
|
|
14664
|
+
return /* @__PURE__ */ jsx129(BaseIcon, {
|
|
14665
|
+
d: Check,
|
|
14666
|
+
...props
|
|
14667
|
+
});
|
|
14668
|
+
};
|
|
14669
|
+
var ChevronRightIcon = (props) => {
|
|
14670
|
+
return /* @__PURE__ */ jsx129(BaseIcon, {
|
|
14671
|
+
d: ChevronRight,
|
|
14672
|
+
...props
|
|
14673
|
+
});
|
|
14674
|
+
};
|
|
14675
|
+
var CircularArrowsIcon = (props) => {
|
|
14676
|
+
return /* @__PURE__ */ jsx129(BaseIcon, {
|
|
14677
|
+
d: CircularArrows,
|
|
14678
|
+
...props
|
|
14679
|
+
});
|
|
14680
|
+
};
|
|
14681
|
+
var CloseIcon = (props) => {
|
|
14682
|
+
return /* @__PURE__ */ jsx129(BaseIcon, {
|
|
14683
|
+
d: Close,
|
|
14684
|
+
...props
|
|
14685
|
+
});
|
|
14686
|
+
};
|
|
14687
|
+
var ContentCopyIcon = (props) => {
|
|
14688
|
+
return /* @__PURE__ */ jsx129(BaseIcon, {
|
|
14689
|
+
d: ContentCopy,
|
|
14690
|
+
...props
|
|
14691
|
+
});
|
|
14692
|
+
};
|
|
14693
|
+
var EditIcon = (props) => {
|
|
14694
|
+
return /* @__PURE__ */ jsx129(BaseIcon, {
|
|
14695
|
+
d: Edit,
|
|
14696
|
+
...props
|
|
14697
|
+
});
|
|
14698
|
+
};
|
|
14699
|
+
var ExpandMoreIcon = (props) => {
|
|
14700
|
+
return /* @__PURE__ */ jsx129(BaseIcon, {
|
|
14701
|
+
d: ExpandMore,
|
|
14702
|
+
...props
|
|
14703
|
+
});
|
|
14704
|
+
};
|
|
14705
|
+
var DeleteIcon = (props) => {
|
|
14706
|
+
return /* @__PURE__ */ jsx129(BaseIcon, {
|
|
14707
|
+
d: Delete,
|
|
14708
|
+
...props
|
|
14709
|
+
});
|
|
14710
|
+
};
|
|
14711
|
+
var objectLb = "{";
|
|
14712
|
+
var arrayLb = "[";
|
|
14713
|
+
var objectRb = "}";
|
|
14714
|
+
var arrayRb = "]";
|
|
14715
|
+
function inspectMetadata(value) {
|
|
14716
|
+
const length = getValueSize(value);
|
|
14717
|
+
let name = "";
|
|
14718
|
+
if (value instanceof Map || value instanceof Set) {
|
|
14719
|
+
name = value[Symbol.toStringTag];
|
|
14720
|
+
}
|
|
14721
|
+
if (Object.prototype.hasOwnProperty.call(value, Symbol.toStringTag)) {
|
|
14722
|
+
name = value[Symbol.toStringTag];
|
|
14723
|
+
}
|
|
14724
|
+
return "".concat(length, " Items").concat(name ? " (".concat(name, ")") : "");
|
|
14725
|
+
}
|
|
14726
|
+
var PreObjectType = (props) => {
|
|
14727
|
+
const metadataColor = useJsonViewerStore((store) => store.colorspace.base04);
|
|
14728
|
+
const textColor = useTextColor();
|
|
14729
|
+
const isArrayLike = useMemo7(() => Array.isArray(props.value) || props.value instanceof Set, [
|
|
14730
|
+
props.value
|
|
14731
|
+
]);
|
|
14732
|
+
const isEmptyValue = useMemo7(() => getValueSize(props.value) === 0, [
|
|
14733
|
+
props.value
|
|
14734
|
+
]);
|
|
14735
|
+
const sizeOfValue = useMemo7(() => inspectMetadata(props.value), [
|
|
14736
|
+
props.value
|
|
14737
|
+
]);
|
|
14738
|
+
const displaySize = useJsonViewerStore((store) => store.displaySize);
|
|
14739
|
+
const shouldDisplaySize = useMemo7(() => typeof displaySize === "function" ? displaySize(props.path, props.value) : displaySize, [
|
|
14740
|
+
displaySize,
|
|
14741
|
+
props.path,
|
|
14742
|
+
props.value
|
|
14743
|
+
]);
|
|
14744
|
+
const isTrap = useIsCycleReference(props.path, props.value);
|
|
14745
|
+
return /* @__PURE__ */ jsxs123(Box6, {
|
|
14746
|
+
component: "span",
|
|
14747
|
+
className: "data-object-start",
|
|
14748
|
+
sx: {
|
|
14749
|
+
letterSpacing: 0.5
|
|
14750
|
+
},
|
|
14751
|
+
children: [
|
|
14752
|
+
isArrayLike ? arrayLb : objectLb,
|
|
14753
|
+
shouldDisplaySize && props.inspect && !isEmptyValue && /* @__PURE__ */ jsx129(Box6, {
|
|
14754
|
+
component: "span",
|
|
14755
|
+
sx: {
|
|
14756
|
+
pl: 0.5,
|
|
14757
|
+
fontStyle: "italic",
|
|
14758
|
+
color: metadataColor,
|
|
14759
|
+
userSelect: "none"
|
|
14760
|
+
},
|
|
14761
|
+
children: sizeOfValue
|
|
14762
|
+
}),
|
|
14763
|
+
isTrap && !props.inspect && /* @__PURE__ */ jsxs123(Fragment5, {
|
|
14764
|
+
children: [
|
|
14765
|
+
/* @__PURE__ */ jsx129(CircularArrowsIcon, {
|
|
14766
|
+
sx: {
|
|
14767
|
+
fontSize: 12,
|
|
14768
|
+
color: textColor,
|
|
14769
|
+
mx: 0.5
|
|
14770
|
+
}
|
|
14771
|
+
}),
|
|
14772
|
+
/* @__PURE__ */ jsx129(DataBox, {
|
|
14773
|
+
sx: {
|
|
14774
|
+
cursor: "pointer",
|
|
14775
|
+
userSelect: "none"
|
|
14776
|
+
},
|
|
14777
|
+
children: isTrap
|
|
14778
|
+
})
|
|
14779
|
+
]
|
|
14780
|
+
})
|
|
14781
|
+
]
|
|
14782
|
+
});
|
|
14783
|
+
};
|
|
14784
|
+
var PostObjectType = (props) => {
|
|
14785
|
+
const metadataColor = useJsonViewerStore((store) => store.colorspace.base04);
|
|
14786
|
+
const textColor = useTextColor();
|
|
14787
|
+
const isArrayLike = useMemo7(() => Array.isArray(props.value) || props.value instanceof Set, [
|
|
14788
|
+
props.value
|
|
14789
|
+
]);
|
|
14790
|
+
const isEmptyValue = useMemo7(() => getValueSize(props.value) === 0, [
|
|
14791
|
+
props.value
|
|
14792
|
+
]);
|
|
14793
|
+
const sizeOfValue = useMemo7(() => inspectMetadata(props.value), [
|
|
14794
|
+
props.value
|
|
14795
|
+
]);
|
|
14796
|
+
const displaySize = useJsonViewerStore((store) => store.displaySize);
|
|
14797
|
+
const shouldDisplaySize = useMemo7(() => typeof displaySize === "function" ? displaySize(props.path, props.value) : displaySize, [
|
|
14798
|
+
displaySize,
|
|
14799
|
+
props.path,
|
|
14800
|
+
props.value
|
|
14801
|
+
]);
|
|
14802
|
+
return /* @__PURE__ */ jsxs123(Box6, {
|
|
14803
|
+
component: "span",
|
|
14804
|
+
className: "data-object-end",
|
|
14805
|
+
sx: {
|
|
14806
|
+
lineHeight: 1.5,
|
|
14807
|
+
color: textColor,
|
|
14808
|
+
letterSpacing: 0.5,
|
|
14809
|
+
opacity: 0.8
|
|
14810
|
+
},
|
|
14811
|
+
children: [
|
|
14812
|
+
isArrayLike ? arrayRb : objectRb,
|
|
14813
|
+
shouldDisplaySize && (isEmptyValue || !props.inspect) ? /* @__PURE__ */ jsx129(Box6, {
|
|
14814
|
+
component: "span",
|
|
14815
|
+
sx: {
|
|
14816
|
+
pl: 0.5,
|
|
14817
|
+
fontStyle: "italic",
|
|
14818
|
+
color: metadataColor,
|
|
14819
|
+
userSelect: "none"
|
|
14820
|
+
},
|
|
14821
|
+
children: sizeOfValue
|
|
14822
|
+
}) : null
|
|
14823
|
+
]
|
|
14824
|
+
});
|
|
14825
|
+
};
|
|
14826
|
+
function getIterator(value) {
|
|
14827
|
+
return typeof (value === null || value === void 0 ? void 0 : value[Symbol.iterator]) === "function";
|
|
14828
|
+
}
|
|
14829
|
+
var ObjectType = (props) => {
|
|
14830
|
+
const keyColor = useTextColor();
|
|
14831
|
+
const borderColor = useJsonViewerStore((store) => store.colorspace.base02);
|
|
14832
|
+
const groupArraysAfterLength = useJsonViewerStore((store) => store.groupArraysAfterLength);
|
|
14833
|
+
const isTrap = useIsCycleReference(props.path, props.value);
|
|
14834
|
+
const [displayLength, setDisplayLength] = useState8(useJsonViewerStore((store) => store.maxDisplayLength));
|
|
14835
|
+
const objectSortKeys = useJsonViewerStore((store) => store.objectSortKeys);
|
|
14836
|
+
const elements = useMemo7(() => {
|
|
14837
|
+
if (!props.inspect) {
|
|
14838
|
+
return null;
|
|
14839
|
+
}
|
|
14840
|
+
const value = props.value;
|
|
14841
|
+
const iterator = getIterator(value);
|
|
14842
|
+
if (iterator && !Array.isArray(value)) {
|
|
14843
|
+
const elements3 = [];
|
|
14844
|
+
if (value instanceof Map) {
|
|
14845
|
+
const lastIndex2 = value.size - 1;
|
|
14846
|
+
let index = 0;
|
|
14847
|
+
value.forEach((value2, k2) => {
|
|
14848
|
+
const key = k2.toString();
|
|
14849
|
+
const path = [
|
|
14850
|
+
...props.path,
|
|
14851
|
+
key
|
|
14852
|
+
];
|
|
14853
|
+
elements3.push(/* @__PURE__ */ jsx129(DataKeyPair, {
|
|
14854
|
+
path,
|
|
14855
|
+
value: value2,
|
|
14856
|
+
prevValue: props.prevValue instanceof Map ? props.prevValue.get(k2) : void 0,
|
|
14857
|
+
editable: false,
|
|
14858
|
+
last: index === lastIndex2
|
|
14859
|
+
}, key));
|
|
14860
|
+
index++;
|
|
14861
|
+
});
|
|
14862
|
+
} else {
|
|
14863
|
+
const iterator2 = value[Symbol.iterator]();
|
|
14864
|
+
let result = iterator2.next();
|
|
14865
|
+
let count2 = 0;
|
|
14866
|
+
while (true) {
|
|
14867
|
+
const nextResult = iterator2.next();
|
|
14868
|
+
var _nextResult_done;
|
|
14869
|
+
elements3.push(/* @__PURE__ */ jsx129(DataKeyPair, {
|
|
14870
|
+
path: [
|
|
14871
|
+
...props.path,
|
|
14872
|
+
"iterator:".concat(count2)
|
|
14873
|
+
],
|
|
14874
|
+
value: result.value,
|
|
14875
|
+
nestedIndex: count2,
|
|
14876
|
+
editable: false,
|
|
14877
|
+
last: (_nextResult_done = nextResult.done) !== null && _nextResult_done !== void 0 ? _nextResult_done : false
|
|
14878
|
+
}, count2));
|
|
14879
|
+
if (nextResult.done) {
|
|
14880
|
+
break;
|
|
14881
|
+
}
|
|
14882
|
+
count2++;
|
|
14883
|
+
result = nextResult;
|
|
14884
|
+
}
|
|
14885
|
+
}
|
|
14886
|
+
return elements3;
|
|
14887
|
+
}
|
|
14888
|
+
if (Array.isArray(value)) {
|
|
14889
|
+
const lastIndex2 = value.length - 1;
|
|
14890
|
+
if (value.length <= groupArraysAfterLength) {
|
|
14891
|
+
const elements4 = value.slice(0, displayLength).map((value2, _index) => {
|
|
14892
|
+
const index = props.nestedIndex ? props.nestedIndex * groupArraysAfterLength + _index : _index;
|
|
14893
|
+
const path = [
|
|
14894
|
+
...props.path,
|
|
14895
|
+
index
|
|
14896
|
+
];
|
|
14897
|
+
return /* @__PURE__ */ jsx129(DataKeyPair, {
|
|
14898
|
+
path,
|
|
14899
|
+
value: value2,
|
|
14900
|
+
prevValue: Array.isArray(props.prevValue) ? props.prevValue[index] : void 0,
|
|
14901
|
+
last: _index === lastIndex2
|
|
14902
|
+
}, index);
|
|
14903
|
+
});
|
|
14904
|
+
if (value.length > displayLength) {
|
|
14905
|
+
const rest = value.length - displayLength;
|
|
14906
|
+
elements4.push(/* @__PURE__ */ jsxs123(DataBox, {
|
|
14907
|
+
sx: {
|
|
14908
|
+
cursor: "pointer",
|
|
14909
|
+
lineHeight: 1.5,
|
|
14910
|
+
color: keyColor,
|
|
14911
|
+
letterSpacing: 0.5,
|
|
14912
|
+
opacity: 0.8,
|
|
14913
|
+
userSelect: "none"
|
|
14914
|
+
},
|
|
14915
|
+
onClick: () => setDisplayLength((length) => length * 2),
|
|
14916
|
+
children: [
|
|
14917
|
+
"hidden ",
|
|
14918
|
+
rest,
|
|
14919
|
+
" items\u2026"
|
|
14920
|
+
]
|
|
14921
|
+
}, "last"));
|
|
14922
|
+
}
|
|
14923
|
+
return elements4;
|
|
14924
|
+
}
|
|
14925
|
+
const elements3 = segmentArray(value, groupArraysAfterLength);
|
|
14926
|
+
const prevElements = Array.isArray(props.prevValue) ? segmentArray(props.prevValue, groupArraysAfterLength) : void 0;
|
|
14927
|
+
const elementsLastIndex = elements3.length - 1;
|
|
14928
|
+
return elements3.map((list, index) => {
|
|
14929
|
+
return /* @__PURE__ */ jsx129(DataKeyPair, {
|
|
14930
|
+
path: props.path,
|
|
14931
|
+
value: list,
|
|
14932
|
+
nestedIndex: index,
|
|
14933
|
+
prevValue: prevElements === null || prevElements === void 0 ? void 0 : prevElements[index],
|
|
14934
|
+
last: index === elementsLastIndex
|
|
14935
|
+
}, index);
|
|
14936
|
+
});
|
|
14937
|
+
}
|
|
14938
|
+
let entries = Object.entries(value);
|
|
14939
|
+
if (objectSortKeys) {
|
|
14940
|
+
entries = objectSortKeys === true ? entries.sort((param, param1) => {
|
|
14941
|
+
let [a3] = param, [b3] = param1;
|
|
14942
|
+
return a3.localeCompare(b3);
|
|
14943
|
+
}) : entries.sort((param, param1) => {
|
|
14944
|
+
let [a3] = param, [b3] = param1;
|
|
14945
|
+
return objectSortKeys(a3, b3);
|
|
14946
|
+
});
|
|
14947
|
+
}
|
|
14948
|
+
const lastIndex = entries.length - 1;
|
|
14949
|
+
const elements2 = entries.slice(0, displayLength).map((param, index) => {
|
|
14950
|
+
let [key, value2] = param;
|
|
14951
|
+
var _props_prevValue;
|
|
14952
|
+
const path = [
|
|
14953
|
+
...props.path,
|
|
14954
|
+
key
|
|
14955
|
+
];
|
|
14956
|
+
return /* @__PURE__ */ jsx129(DataKeyPair, {
|
|
14957
|
+
path,
|
|
14958
|
+
value: value2,
|
|
14959
|
+
prevValue: (_props_prevValue = props.prevValue) === null || _props_prevValue === void 0 ? void 0 : _props_prevValue[key],
|
|
14960
|
+
last: index === lastIndex
|
|
14961
|
+
}, key);
|
|
14962
|
+
});
|
|
14963
|
+
if (entries.length > displayLength) {
|
|
14964
|
+
const rest = entries.length - displayLength;
|
|
14965
|
+
elements2.push(/* @__PURE__ */ jsxs123(DataBox, {
|
|
14966
|
+
sx: {
|
|
14967
|
+
cursor: "pointer",
|
|
14968
|
+
lineHeight: 1.5,
|
|
14969
|
+
color: keyColor,
|
|
14970
|
+
letterSpacing: 0.5,
|
|
14971
|
+
opacity: 0.8,
|
|
14972
|
+
userSelect: "none"
|
|
14973
|
+
},
|
|
14974
|
+
onClick: () => setDisplayLength((length) => length * 2),
|
|
14975
|
+
children: [
|
|
14976
|
+
"hidden ",
|
|
14977
|
+
rest,
|
|
14978
|
+
" items\u2026"
|
|
14979
|
+
]
|
|
14980
|
+
}, "last"));
|
|
14981
|
+
}
|
|
14982
|
+
return elements2;
|
|
14983
|
+
}, [
|
|
14984
|
+
props.inspect,
|
|
14985
|
+
props.value,
|
|
14986
|
+
props.prevValue,
|
|
14987
|
+
props.path,
|
|
14988
|
+
props.nestedIndex,
|
|
14989
|
+
groupArraysAfterLength,
|
|
14990
|
+
displayLength,
|
|
14991
|
+
keyColor,
|
|
14992
|
+
objectSortKeys
|
|
14993
|
+
]);
|
|
14994
|
+
const marginLeft = props.inspect ? 0.6 : 0;
|
|
14995
|
+
const width = useJsonViewerStore((store) => store.indentWidth);
|
|
14996
|
+
const indentWidth = props.inspect ? width - marginLeft : width;
|
|
14997
|
+
const isEmptyValue = useMemo7(() => getValueSize(props.value) === 0, [
|
|
14998
|
+
props.value
|
|
14999
|
+
]);
|
|
15000
|
+
if (isEmptyValue) {
|
|
15001
|
+
return null;
|
|
15002
|
+
}
|
|
15003
|
+
return /* @__PURE__ */ jsx129(Box6, {
|
|
15004
|
+
className: "data-object",
|
|
15005
|
+
sx: {
|
|
15006
|
+
display: props.inspect ? "block" : "inline-block",
|
|
15007
|
+
pl: props.inspect ? indentWidth - 0.6 : 0,
|
|
15008
|
+
marginLeft,
|
|
15009
|
+
color: keyColor,
|
|
15010
|
+
borderLeft: props.inspect ? "1px solid ".concat(borderColor) : "none"
|
|
15011
|
+
},
|
|
15012
|
+
children: props.inspect ? elements : !isTrap && /* @__PURE__ */ jsx129(Box6, {
|
|
15013
|
+
component: "span",
|
|
15014
|
+
className: "data-object-body",
|
|
15015
|
+
onClick: () => props.setInspect(true),
|
|
15016
|
+
sx: {
|
|
15017
|
+
"&:hover": {
|
|
15018
|
+
cursor: "pointer"
|
|
15019
|
+
},
|
|
15020
|
+
padding: 0.5,
|
|
15021
|
+
userSelect: "none"
|
|
15022
|
+
},
|
|
15023
|
+
children: "\u2026"
|
|
15024
|
+
})
|
|
15025
|
+
});
|
|
15026
|
+
};
|
|
15027
|
+
var objectType = {
|
|
15028
|
+
is: (value) => typeof value === "object",
|
|
15029
|
+
Component: ObjectType,
|
|
15030
|
+
PreComponent: PreObjectType,
|
|
15031
|
+
PostComponent: PostObjectType
|
|
15032
|
+
};
|
|
15033
|
+
var stringType = defineEasyType({
|
|
15034
|
+
is: (value) => typeof value === "string",
|
|
15035
|
+
type: "string",
|
|
15036
|
+
colorKey: "base09",
|
|
15037
|
+
serialize: (value) => value,
|
|
15038
|
+
deserialize: (value) => value,
|
|
15039
|
+
Renderer: (props) => {
|
|
15040
|
+
const [showRest, setShowRest] = useState8(false);
|
|
15041
|
+
const collapseStringsAfterLength = useJsonViewerStore((store) => store.collapseStringsAfterLength);
|
|
15042
|
+
const value = showRest ? props.value : props.value.slice(0, collapseStringsAfterLength);
|
|
15043
|
+
const hasRest = props.value.length > collapseStringsAfterLength;
|
|
15044
|
+
return /* @__PURE__ */ jsxs123(Box6, {
|
|
15045
|
+
component: "span",
|
|
15046
|
+
sx: {
|
|
15047
|
+
overflowWrap: "anywhere",
|
|
15048
|
+
cursor: hasRest ? "pointer" : "inherit"
|
|
15049
|
+
},
|
|
15050
|
+
onClick: () => {
|
|
15051
|
+
var _window_getSelection;
|
|
15052
|
+
if (((_window_getSelection = window.getSelection()) === null || _window_getSelection === void 0 ? void 0 : _window_getSelection.type) === "Range") {
|
|
15053
|
+
return;
|
|
15054
|
+
}
|
|
15055
|
+
if (hasRest) {
|
|
15056
|
+
setShowRest((value2) => !value2);
|
|
15057
|
+
}
|
|
15058
|
+
},
|
|
15059
|
+
children: [
|
|
15060
|
+
'"',
|
|
15061
|
+
value,
|
|
15062
|
+
hasRest && !showRest && /* @__PURE__ */ jsx129(Box6, {
|
|
15063
|
+
component: "span",
|
|
15064
|
+
sx: {
|
|
15065
|
+
padding: 0.5
|
|
15066
|
+
},
|
|
15067
|
+
children: "\u2026"
|
|
15068
|
+
}),
|
|
15069
|
+
'"'
|
|
15070
|
+
]
|
|
15071
|
+
});
|
|
15072
|
+
}
|
|
15073
|
+
});
|
|
15074
|
+
var undefinedType = defineEasyType({
|
|
15075
|
+
is: (value) => value === void 0,
|
|
15076
|
+
type: "undefined",
|
|
15077
|
+
colorKey: "base05",
|
|
15078
|
+
displayTypeLabel: false,
|
|
15079
|
+
Renderer: () => {
|
|
15080
|
+
const backgroundColor = useJsonViewerStore((store) => store.colorspace.base02);
|
|
15081
|
+
return /* @__PURE__ */ jsx129(Box6, {
|
|
15082
|
+
sx: {
|
|
15083
|
+
fontSize: "0.7rem",
|
|
15084
|
+
backgroundColor,
|
|
15085
|
+
borderRadius: "3px",
|
|
15086
|
+
padding: "0.5px 2px"
|
|
15087
|
+
},
|
|
15088
|
+
children: "undefined"
|
|
15089
|
+
});
|
|
15090
|
+
}
|
|
15091
|
+
});
|
|
15092
|
+
function memorizeDataType(dataType) {
|
|
15093
|
+
function compare(prevProps, nextProps) {
|
|
15094
|
+
var _prevProps_path, _nextProps_path;
|
|
15095
|
+
return Object.is(prevProps.value, nextProps.value) && prevProps.inspect && nextProps.inspect && ((_prevProps_path = prevProps.path) === null || _prevProps_path === void 0 ? void 0 : _prevProps_path.join(".")) === ((_nextProps_path = nextProps.path) === null || _nextProps_path === void 0 ? void 0 : _nextProps_path.join("."));
|
|
15096
|
+
}
|
|
15097
|
+
dataType.Component = /* @__PURE__ */ memo9(dataType.Component, compare);
|
|
15098
|
+
if (dataType.Editor) {
|
|
15099
|
+
dataType.Editor = /* @__PURE__ */ memo9(dataType.Editor, function compare2(prevProps, nextProps) {
|
|
15100
|
+
return Object.is(prevProps.value, nextProps.value);
|
|
15101
|
+
});
|
|
15102
|
+
}
|
|
15103
|
+
if (dataType.PreComponent) {
|
|
15104
|
+
dataType.PreComponent = /* @__PURE__ */ memo9(dataType.PreComponent, compare);
|
|
15105
|
+
}
|
|
15106
|
+
if (dataType.PostComponent) {
|
|
15107
|
+
dataType.PostComponent = /* @__PURE__ */ memo9(dataType.PostComponent, compare);
|
|
15108
|
+
}
|
|
15109
|
+
return dataType;
|
|
15110
|
+
}
|
|
15111
|
+
var predefinedTypes = [
|
|
15112
|
+
memorizeDataType(booleanType),
|
|
15113
|
+
memorizeDataType(dateType),
|
|
15114
|
+
memorizeDataType(nullType),
|
|
15115
|
+
memorizeDataType(undefinedType),
|
|
15116
|
+
memorizeDataType(stringType),
|
|
15117
|
+
memorizeDataType(functionType),
|
|
15118
|
+
memorizeDataType(nanType),
|
|
15119
|
+
memorizeDataType(intType),
|
|
15120
|
+
memorizeDataType(floatType),
|
|
15121
|
+
memorizeDataType(bigIntType)
|
|
15122
|
+
];
|
|
15123
|
+
var createTypeRegistryStore = () => {
|
|
15124
|
+
return createStore()((set) => ({
|
|
15125
|
+
registry: predefinedTypes,
|
|
15126
|
+
registerTypes: (setState) => {
|
|
15127
|
+
set((state) => ({
|
|
15128
|
+
registry: typeof setState === "function" ? setState(state.registry) : setState
|
|
15129
|
+
}));
|
|
15130
|
+
}
|
|
15131
|
+
}));
|
|
15132
|
+
};
|
|
15133
|
+
var TypeRegistryStoreContext = /* @__PURE__ */ createContext9(void 0);
|
|
15134
|
+
TypeRegistryStoreContext.Provider;
|
|
15135
|
+
var useTypeRegistryStore = (selector2, equalityFn) => {
|
|
15136
|
+
const store = useContext16(TypeRegistryStoreContext);
|
|
15137
|
+
return useStore(store, selector2, equalityFn);
|
|
15138
|
+
};
|
|
15139
|
+
function matchTypeComponents(value, path, registry) {
|
|
15140
|
+
let potential;
|
|
15141
|
+
for (const T of registry) {
|
|
15142
|
+
if (T.is(value, path)) {
|
|
15143
|
+
potential = T;
|
|
15144
|
+
}
|
|
15145
|
+
}
|
|
15146
|
+
if (potential === void 0) {
|
|
15147
|
+
if (typeof value === "object") {
|
|
15148
|
+
return objectType;
|
|
15149
|
+
}
|
|
15150
|
+
throw new Error("No type matched for value: ".concat(value));
|
|
15151
|
+
}
|
|
15152
|
+
return potential;
|
|
15153
|
+
}
|
|
15154
|
+
function useTypeComponents(value, path) {
|
|
15155
|
+
const registry = useTypeRegistryStore((store) => store.registry);
|
|
15156
|
+
return useMemo7(() => matchTypeComponents(value, path, registry), [
|
|
15157
|
+
value,
|
|
15158
|
+
path,
|
|
15159
|
+
registry
|
|
15160
|
+
]);
|
|
15161
|
+
}
|
|
15162
|
+
var IconBox = (props) => /* @__PURE__ */ jsx129(Box6, {
|
|
15163
|
+
component: "span",
|
|
15164
|
+
...props,
|
|
15165
|
+
sx: {
|
|
15166
|
+
cursor: "pointer",
|
|
15167
|
+
paddingLeft: "0.7rem",
|
|
15168
|
+
...props.sx
|
|
15169
|
+
}
|
|
15170
|
+
});
|
|
15171
|
+
var DataKeyPair = (props) => {
|
|
15172
|
+
const { value, prevValue, path, nestedIndex, last } = props;
|
|
15173
|
+
const { Component, PreComponent, PostComponent, Editor, serialize, deserialize } = useTypeComponents(value, path);
|
|
15174
|
+
var _props_editable;
|
|
15175
|
+
const propsEditable = (_props_editable = props.editable) !== null && _props_editable !== void 0 ? _props_editable : void 0;
|
|
15176
|
+
const storeEditable = useJsonViewerStore((store) => store.editable);
|
|
15177
|
+
const editable = useMemo7(() => {
|
|
15178
|
+
if (storeEditable === false) {
|
|
15179
|
+
return false;
|
|
15180
|
+
}
|
|
15181
|
+
if (propsEditable === false) {
|
|
15182
|
+
return false;
|
|
15183
|
+
}
|
|
15184
|
+
if (typeof storeEditable === "function") {
|
|
15185
|
+
return !!storeEditable(path, value);
|
|
15186
|
+
}
|
|
15187
|
+
return storeEditable;
|
|
15188
|
+
}, [
|
|
15189
|
+
path,
|
|
15190
|
+
propsEditable,
|
|
15191
|
+
storeEditable,
|
|
15192
|
+
value
|
|
15193
|
+
]);
|
|
15194
|
+
const [tempValue, setTempValue] = useState8("");
|
|
15195
|
+
const depth = path.length;
|
|
15196
|
+
const key = path[depth - 1];
|
|
15197
|
+
const hoverPath = useJsonViewerStore((store) => store.hoverPath);
|
|
15198
|
+
const isHover = useMemo7(() => {
|
|
15199
|
+
return hoverPath && path.every((value2, index) => value2 === hoverPath.path[index] && nestedIndex === hoverPath.nestedIndex);
|
|
15200
|
+
}, [
|
|
15201
|
+
hoverPath,
|
|
15202
|
+
path,
|
|
15203
|
+
nestedIndex
|
|
15204
|
+
]);
|
|
15205
|
+
const setHover = useJsonViewerStore((store) => store.setHover);
|
|
15206
|
+
const root = useJsonViewerStore((store) => store.value);
|
|
15207
|
+
const [inspect, setInspect] = useInspect(path, value, nestedIndex);
|
|
15208
|
+
const [editing, setEditing] = useState8(false);
|
|
15209
|
+
const onChange = useJsonViewerStore((store) => store.onChange);
|
|
15210
|
+
const keyColor = useTextColor();
|
|
15211
|
+
const numberKeyColor = useJsonViewerStore((store) => store.colorspace.base0C);
|
|
15212
|
+
const highlightColor = useJsonViewerStore((store) => store.colorspace.base0A);
|
|
15213
|
+
const displayComma = useJsonViewerStore((store) => store.displayComma);
|
|
15214
|
+
const quotesOnKeys = useJsonViewerStore((store) => store.quotesOnKeys);
|
|
15215
|
+
const rootName = useJsonViewerStore((store) => store.rootName);
|
|
15216
|
+
const isRoot = root === value;
|
|
15217
|
+
const isNumberKey = Number.isInteger(Number(key));
|
|
15218
|
+
const storeEnableAdd = useJsonViewerStore((store) => store.enableAdd);
|
|
15219
|
+
const onAdd = useJsonViewerStore((store) => store.onAdd);
|
|
15220
|
+
const enableAdd = useMemo7(() => {
|
|
15221
|
+
if (!onAdd || nestedIndex !== void 0) return false;
|
|
15222
|
+
if (storeEnableAdd === false) {
|
|
15223
|
+
return false;
|
|
15224
|
+
}
|
|
15225
|
+
if (propsEditable === false) {
|
|
15226
|
+
return false;
|
|
15227
|
+
}
|
|
15228
|
+
if (typeof storeEnableAdd === "function") {
|
|
15229
|
+
return !!storeEnableAdd(path, value);
|
|
15230
|
+
}
|
|
15231
|
+
if (Array.isArray(value) || isPlainObject(value)) {
|
|
15232
|
+
return true;
|
|
15233
|
+
}
|
|
15234
|
+
return false;
|
|
15235
|
+
}, [
|
|
15236
|
+
onAdd,
|
|
15237
|
+
nestedIndex,
|
|
15238
|
+
path,
|
|
15239
|
+
storeEnableAdd,
|
|
15240
|
+
propsEditable,
|
|
15241
|
+
value
|
|
15242
|
+
]);
|
|
15243
|
+
const storeEnableDelete = useJsonViewerStore((store) => store.enableDelete);
|
|
15244
|
+
const onDelete = useJsonViewerStore((store) => store.onDelete);
|
|
15245
|
+
const enableDelete = useMemo7(() => {
|
|
15246
|
+
if (!onDelete || nestedIndex !== void 0) return false;
|
|
15247
|
+
if (isRoot) {
|
|
15248
|
+
return false;
|
|
15249
|
+
}
|
|
15250
|
+
if (storeEnableDelete === false) {
|
|
15251
|
+
return false;
|
|
15252
|
+
}
|
|
15253
|
+
if (propsEditable === false) {
|
|
15254
|
+
return false;
|
|
15255
|
+
}
|
|
15256
|
+
if (typeof storeEnableDelete === "function") {
|
|
15257
|
+
return !!storeEnableDelete(path, value);
|
|
15258
|
+
}
|
|
15259
|
+
return storeEnableDelete;
|
|
15260
|
+
}, [
|
|
15261
|
+
onDelete,
|
|
15262
|
+
nestedIndex,
|
|
15263
|
+
isRoot,
|
|
15264
|
+
path,
|
|
15265
|
+
storeEnableDelete,
|
|
15266
|
+
propsEditable,
|
|
15267
|
+
value
|
|
15268
|
+
]);
|
|
15269
|
+
const enableClipboard = useJsonViewerStore((store) => store.enableClipboard);
|
|
15270
|
+
const { copy, copied } = useClipboard();
|
|
15271
|
+
const highlightUpdates = useJsonViewerStore((store) => store.highlightUpdates);
|
|
15272
|
+
const isHighlight = useMemo7(() => {
|
|
15273
|
+
if (!highlightUpdates || prevValue === void 0) return false;
|
|
15274
|
+
if (typeof value !== typeof prevValue) {
|
|
15275
|
+
return true;
|
|
15276
|
+
}
|
|
15277
|
+
if (typeof value === "number") {
|
|
15278
|
+
if (isNaN(value) && isNaN(prevValue)) return false;
|
|
15279
|
+
return value !== prevValue;
|
|
15280
|
+
}
|
|
15281
|
+
if (Array.isArray(value) !== Array.isArray(prevValue)) {
|
|
15282
|
+
return true;
|
|
15283
|
+
}
|
|
15284
|
+
if (typeof value === "object" || typeof value === "function") {
|
|
15285
|
+
return false;
|
|
15286
|
+
}
|
|
15287
|
+
if (value !== prevValue) {
|
|
15288
|
+
return true;
|
|
15289
|
+
}
|
|
15290
|
+
return false;
|
|
15291
|
+
}, [
|
|
15292
|
+
highlightUpdates,
|
|
15293
|
+
prevValue,
|
|
15294
|
+
value
|
|
15295
|
+
]);
|
|
15296
|
+
const highlightContainer = useRef11();
|
|
15297
|
+
useEffect15(() => {
|
|
15298
|
+
if (highlightContainer.current && isHighlight && "animate" in highlightContainer.current) {
|
|
15299
|
+
highlightContainer.current.animate([
|
|
15300
|
+
{
|
|
15301
|
+
backgroundColor: highlightColor
|
|
15302
|
+
},
|
|
15303
|
+
{
|
|
15304
|
+
backgroundColor: ""
|
|
15305
|
+
}
|
|
15306
|
+
], {
|
|
15307
|
+
duration: 1e3,
|
|
15308
|
+
easing: "ease-in"
|
|
15309
|
+
});
|
|
15310
|
+
}
|
|
15311
|
+
}, [
|
|
15312
|
+
highlightColor,
|
|
15313
|
+
isHighlight,
|
|
15314
|
+
prevValue,
|
|
15315
|
+
value
|
|
15316
|
+
]);
|
|
15317
|
+
const startEditing = useCallback8((event) => {
|
|
15318
|
+
event.preventDefault();
|
|
15319
|
+
if (serialize) setTempValue(serialize(value));
|
|
15320
|
+
setEditing(true);
|
|
15321
|
+
}, [
|
|
15322
|
+
serialize,
|
|
15323
|
+
value
|
|
15324
|
+
]);
|
|
15325
|
+
const abortEditing = useCallback8(() => {
|
|
15326
|
+
setEditing(false);
|
|
15327
|
+
setTempValue("");
|
|
15328
|
+
}, [
|
|
15329
|
+
setEditing,
|
|
15330
|
+
setTempValue
|
|
15331
|
+
]);
|
|
15332
|
+
const commitEditing = useCallback8((newValue) => {
|
|
15333
|
+
setEditing(false);
|
|
15334
|
+
if (!deserialize) return;
|
|
15335
|
+
try {
|
|
15336
|
+
onChange(path, value, deserialize(newValue));
|
|
15337
|
+
} catch (e2) {
|
|
15338
|
+
}
|
|
15339
|
+
}, [
|
|
15340
|
+
setEditing,
|
|
15341
|
+
deserialize,
|
|
15342
|
+
onChange,
|
|
15343
|
+
path,
|
|
15344
|
+
value
|
|
15345
|
+
]);
|
|
15346
|
+
const actionIcons = useMemo7(() => {
|
|
15347
|
+
if (editing) {
|
|
15348
|
+
return /* @__PURE__ */ jsxs123(Fragment5, {
|
|
15349
|
+
children: [
|
|
15350
|
+
/* @__PURE__ */ jsx129(IconBox, {
|
|
15351
|
+
children: /* @__PURE__ */ jsx129(CloseIcon, {
|
|
15352
|
+
sx: {
|
|
15353
|
+
fontSize: ".8rem"
|
|
15354
|
+
},
|
|
15355
|
+
onClick: abortEditing
|
|
15356
|
+
})
|
|
15357
|
+
}),
|
|
15358
|
+
/* @__PURE__ */ jsx129(IconBox, {
|
|
15359
|
+
children: /* @__PURE__ */ jsx129(CheckIcon, {
|
|
15360
|
+
sx: {
|
|
15361
|
+
fontSize: ".8rem"
|
|
15362
|
+
},
|
|
15363
|
+
onClick: () => commitEditing(tempValue)
|
|
15364
|
+
})
|
|
15365
|
+
})
|
|
15366
|
+
]
|
|
15367
|
+
});
|
|
15368
|
+
}
|
|
15369
|
+
return /* @__PURE__ */ jsxs123(Fragment5, {
|
|
15370
|
+
children: [
|
|
15371
|
+
enableClipboard && /* @__PURE__ */ jsx129(IconBox, {
|
|
15372
|
+
onClick: (event) => {
|
|
15373
|
+
event.preventDefault();
|
|
15374
|
+
try {
|
|
15375
|
+
copy(path, value, copyString);
|
|
15376
|
+
} catch (e2) {
|
|
15377
|
+
console.error(e2);
|
|
15378
|
+
}
|
|
15379
|
+
},
|
|
15380
|
+
children: copied ? /* @__PURE__ */ jsx129(CheckIcon, {
|
|
15381
|
+
sx: {
|
|
15382
|
+
fontSize: ".8rem"
|
|
15383
|
+
}
|
|
15384
|
+
}) : /* @__PURE__ */ jsx129(ContentCopyIcon, {
|
|
15385
|
+
sx: {
|
|
15386
|
+
fontSize: ".8rem"
|
|
15387
|
+
}
|
|
15388
|
+
})
|
|
15389
|
+
}),
|
|
15390
|
+
Editor && editable && serialize && deserialize && /* @__PURE__ */ jsx129(IconBox, {
|
|
15391
|
+
onClick: startEditing,
|
|
15392
|
+
children: /* @__PURE__ */ jsx129(EditIcon, {
|
|
15393
|
+
sx: {
|
|
15394
|
+
fontSize: ".8rem"
|
|
15395
|
+
}
|
|
15396
|
+
})
|
|
15397
|
+
}),
|
|
15398
|
+
enableAdd && /* @__PURE__ */ jsx129(IconBox, {
|
|
15399
|
+
onClick: (event) => {
|
|
15400
|
+
event.preventDefault();
|
|
15401
|
+
onAdd === null || onAdd === void 0 ? void 0 : onAdd(path);
|
|
15402
|
+
},
|
|
15403
|
+
children: /* @__PURE__ */ jsx129(AddBoxIcon, {
|
|
15404
|
+
sx: {
|
|
15405
|
+
fontSize: ".8rem"
|
|
15406
|
+
}
|
|
15407
|
+
})
|
|
15408
|
+
}),
|
|
15409
|
+
enableDelete && /* @__PURE__ */ jsx129(IconBox, {
|
|
15410
|
+
onClick: (event) => {
|
|
15411
|
+
event.preventDefault();
|
|
15412
|
+
onDelete === null || onDelete === void 0 ? void 0 : onDelete(path, value);
|
|
15413
|
+
},
|
|
15414
|
+
children: /* @__PURE__ */ jsx129(DeleteIcon, {
|
|
15415
|
+
sx: {
|
|
15416
|
+
fontSize: ".9rem"
|
|
15417
|
+
}
|
|
15418
|
+
})
|
|
15419
|
+
})
|
|
15420
|
+
]
|
|
15421
|
+
});
|
|
15422
|
+
}, [
|
|
15423
|
+
Editor,
|
|
15424
|
+
serialize,
|
|
15425
|
+
deserialize,
|
|
15426
|
+
copied,
|
|
15427
|
+
copy,
|
|
15428
|
+
editable,
|
|
15429
|
+
editing,
|
|
15430
|
+
enableClipboard,
|
|
15431
|
+
enableAdd,
|
|
15432
|
+
enableDelete,
|
|
15433
|
+
tempValue,
|
|
15434
|
+
path,
|
|
15435
|
+
value,
|
|
15436
|
+
onAdd,
|
|
15437
|
+
onDelete,
|
|
15438
|
+
startEditing,
|
|
15439
|
+
abortEditing,
|
|
15440
|
+
commitEditing
|
|
15441
|
+
]);
|
|
15442
|
+
const isEmptyValue = useMemo7(() => getValueSize(value) === 0, [
|
|
15443
|
+
value
|
|
15444
|
+
]);
|
|
15445
|
+
const expandable = !isEmptyValue && !!(PreComponent && PostComponent);
|
|
15446
|
+
const KeyRenderer = useJsonViewerStore((store) => store.keyRenderer);
|
|
15447
|
+
const downstreamProps = useMemo7(() => ({
|
|
15448
|
+
path,
|
|
15449
|
+
inspect,
|
|
15450
|
+
setInspect,
|
|
15451
|
+
value,
|
|
15452
|
+
prevValue,
|
|
15453
|
+
nestedIndex
|
|
15454
|
+
}), [
|
|
15455
|
+
inspect,
|
|
15456
|
+
path,
|
|
15457
|
+
setInspect,
|
|
15458
|
+
value,
|
|
15459
|
+
prevValue,
|
|
15460
|
+
nestedIndex
|
|
15461
|
+
]);
|
|
15462
|
+
return /* @__PURE__ */ jsxs123(Box6, {
|
|
15463
|
+
className: "data-key-pair",
|
|
15464
|
+
"data-testid": "data-key-pair" + path.join("."),
|
|
15465
|
+
sx: {
|
|
15466
|
+
userSelect: "text"
|
|
15467
|
+
},
|
|
15468
|
+
onMouseEnter: useCallback8(() => setHover(path, nestedIndex), [
|
|
15469
|
+
setHover,
|
|
15470
|
+
path,
|
|
15471
|
+
nestedIndex
|
|
15472
|
+
]),
|
|
15473
|
+
children: [
|
|
15474
|
+
/* @__PURE__ */ jsxs123(DataBox, {
|
|
15475
|
+
component: "span",
|
|
15476
|
+
className: "data-key",
|
|
15477
|
+
sx: {
|
|
15478
|
+
lineHeight: 1.5,
|
|
15479
|
+
color: keyColor,
|
|
15480
|
+
letterSpacing: 0.5,
|
|
15481
|
+
opacity: 0.8
|
|
15482
|
+
},
|
|
15483
|
+
onClick: useCallback8((event) => {
|
|
15484
|
+
if (event.isDefaultPrevented()) {
|
|
15485
|
+
return;
|
|
15486
|
+
}
|
|
15487
|
+
if (!isEmptyValue) {
|
|
15488
|
+
setInspect((state) => !state);
|
|
15489
|
+
}
|
|
15490
|
+
}, [
|
|
15491
|
+
isEmptyValue,
|
|
15492
|
+
setInspect
|
|
15493
|
+
]),
|
|
15494
|
+
children: [
|
|
15495
|
+
expandable ? inspect ? /* @__PURE__ */ jsx129(ExpandMoreIcon, {
|
|
15496
|
+
className: "data-key-toggle-expanded",
|
|
15497
|
+
sx: {
|
|
15498
|
+
fontSize: ".8rem",
|
|
15499
|
+
"&:hover": {
|
|
15500
|
+
cursor: "pointer"
|
|
15501
|
+
}
|
|
15502
|
+
}
|
|
15503
|
+
}) : /* @__PURE__ */ jsx129(ChevronRightIcon, {
|
|
15504
|
+
className: "data-key-toggle-collapsed",
|
|
15505
|
+
sx: {
|
|
15506
|
+
fontSize: ".8rem",
|
|
15507
|
+
"&:hover": {
|
|
15508
|
+
cursor: "pointer"
|
|
15509
|
+
}
|
|
15510
|
+
}
|
|
15511
|
+
}) : null,
|
|
15512
|
+
/* @__PURE__ */ jsx129(Box6, {
|
|
15513
|
+
ref: highlightContainer,
|
|
15514
|
+
className: "data-key-key",
|
|
15515
|
+
component: "span",
|
|
15516
|
+
children: isRoot && depth === 0 ? rootName !== false ? quotesOnKeys ? /* @__PURE__ */ jsxs123(Fragment5, {
|
|
15517
|
+
children: [
|
|
15518
|
+
'"',
|
|
15519
|
+
rootName,
|
|
15520
|
+
'"'
|
|
15521
|
+
]
|
|
15522
|
+
}) : /* @__PURE__ */ jsx129(Fragment5, {
|
|
15523
|
+
children: rootName
|
|
15524
|
+
}) : null : KeyRenderer.when(downstreamProps) ? /* @__PURE__ */ jsx129(KeyRenderer, {
|
|
15525
|
+
...downstreamProps
|
|
15526
|
+
}) : nestedIndex === void 0 && (isNumberKey ? /* @__PURE__ */ jsx129(Box6, {
|
|
15527
|
+
component: "span",
|
|
15528
|
+
style: {
|
|
15529
|
+
color: numberKeyColor,
|
|
15530
|
+
userSelect: isNumberKey ? "none" : "auto"
|
|
15531
|
+
},
|
|
15532
|
+
children: key
|
|
15533
|
+
}) : quotesOnKeys ? /* @__PURE__ */ jsxs123(Fragment5, {
|
|
15534
|
+
children: [
|
|
15535
|
+
'"',
|
|
15536
|
+
key,
|
|
15537
|
+
'"'
|
|
15538
|
+
]
|
|
15539
|
+
}) : /* @__PURE__ */ jsx129(Fragment5, {
|
|
15540
|
+
children: key
|
|
15541
|
+
}))
|
|
15542
|
+
}),
|
|
15543
|
+
isRoot ? rootName !== false && /* @__PURE__ */ jsx129(DataBox, {
|
|
15544
|
+
className: "data-key-colon",
|
|
15545
|
+
sx: {
|
|
15546
|
+
mr: 0.5
|
|
15547
|
+
},
|
|
15548
|
+
children: ":"
|
|
15549
|
+
}) : nestedIndex === void 0 && /* @__PURE__ */ jsx129(DataBox, {
|
|
15550
|
+
className: "data-key-colon",
|
|
15551
|
+
sx: {
|
|
15552
|
+
mr: 0.5,
|
|
15553
|
+
".data-key-key:empty + &": {
|
|
15554
|
+
display: "none"
|
|
15555
|
+
},
|
|
15556
|
+
userSelect: isNumberKey ? "none" : "auto"
|
|
15557
|
+
},
|
|
15558
|
+
children: ":"
|
|
15559
|
+
}),
|
|
15560
|
+
PreComponent && /* @__PURE__ */ jsx129(PreComponent, {
|
|
15561
|
+
...downstreamProps
|
|
15562
|
+
}),
|
|
15563
|
+
isHover && expandable && inspect && actionIcons
|
|
15564
|
+
]
|
|
15565
|
+
}),
|
|
15566
|
+
editing && editable ? Editor && /* @__PURE__ */ jsx129(Editor, {
|
|
15567
|
+
path,
|
|
15568
|
+
value: tempValue,
|
|
15569
|
+
setValue: setTempValue,
|
|
15570
|
+
abortEditing,
|
|
15571
|
+
commitEditing
|
|
15572
|
+
}) : Component ? /* @__PURE__ */ jsx129(Component, {
|
|
15573
|
+
...downstreamProps
|
|
15574
|
+
}) : /* @__PURE__ */ jsx129(Box6, {
|
|
15575
|
+
component: "span",
|
|
15576
|
+
className: "data-value-fallback",
|
|
15577
|
+
children: "fallback: ".concat(value)
|
|
15578
|
+
}),
|
|
15579
|
+
PostComponent && /* @__PURE__ */ jsx129(PostComponent, {
|
|
15580
|
+
...downstreamProps
|
|
15581
|
+
}),
|
|
15582
|
+
!last && displayComma && /* @__PURE__ */ jsx129(DataBox, {
|
|
15583
|
+
children: ","
|
|
15584
|
+
}),
|
|
15585
|
+
isHover && expandable && !inspect && actionIcons,
|
|
15586
|
+
isHover && !expandable && actionIcons,
|
|
15587
|
+
!isHover && editing && actionIcons
|
|
15588
|
+
]
|
|
15589
|
+
});
|
|
15590
|
+
};
|
|
15591
|
+
var query = "(prefers-color-scheme: dark)";
|
|
15592
|
+
function useThemeDetector() {
|
|
15593
|
+
const [isDark, setIsDark] = useState8(false);
|
|
15594
|
+
useEffect15(() => {
|
|
15595
|
+
const listener = (e2) => setIsDark(e2.matches);
|
|
15596
|
+
setIsDark(window.matchMedia(query).matches);
|
|
15597
|
+
const queryMedia = window.matchMedia(query);
|
|
15598
|
+
queryMedia.addEventListener("change", listener);
|
|
15599
|
+
return () => queryMedia.removeEventListener("change", listener);
|
|
15600
|
+
}, []);
|
|
15601
|
+
return isDark;
|
|
15602
|
+
}
|
|
15603
|
+
function useSetIfNotUndefinedEffect(key, value) {
|
|
15604
|
+
const { setState } = useContext16(JsonViewerStoreContext);
|
|
15605
|
+
useEffect15(() => {
|
|
15606
|
+
if (value !== void 0) {
|
|
15607
|
+
setState({
|
|
15608
|
+
[key]: value
|
|
15609
|
+
});
|
|
15610
|
+
}
|
|
15611
|
+
}, [
|
|
15612
|
+
key,
|
|
15613
|
+
value,
|
|
15614
|
+
setState
|
|
15615
|
+
]);
|
|
15616
|
+
}
|
|
15617
|
+
var JsonViewerInner = (props) => {
|
|
15618
|
+
const { setState } = useContext16(JsonViewerStoreContext);
|
|
15619
|
+
useEffect15(() => {
|
|
15620
|
+
setState((state) => ({
|
|
15621
|
+
prevValue: state.value,
|
|
15622
|
+
value: props.value
|
|
15623
|
+
}));
|
|
15624
|
+
}, [
|
|
15625
|
+
props.value,
|
|
15626
|
+
setState
|
|
15627
|
+
]);
|
|
15628
|
+
useSetIfNotUndefinedEffect("rootName", props.rootName);
|
|
15629
|
+
useSetIfNotUndefinedEffect("indentWidth", props.indentWidth);
|
|
15630
|
+
useSetIfNotUndefinedEffect("keyRenderer", props.keyRenderer);
|
|
15631
|
+
useSetIfNotUndefinedEffect("enableAdd", props.enableAdd);
|
|
15632
|
+
useSetIfNotUndefinedEffect("enableDelete", props.enableDelete);
|
|
15633
|
+
useSetIfNotUndefinedEffect("enableClipboard", props.enableClipboard);
|
|
15634
|
+
useSetIfNotUndefinedEffect("editable", props.editable);
|
|
15635
|
+
useSetIfNotUndefinedEffect("onChange", props.onChange);
|
|
15636
|
+
useSetIfNotUndefinedEffect("onCopy", props.onCopy);
|
|
15637
|
+
useSetIfNotUndefinedEffect("onSelect", props.onSelect);
|
|
15638
|
+
useSetIfNotUndefinedEffect("onAdd", props.onAdd);
|
|
15639
|
+
useSetIfNotUndefinedEffect("onDelete", props.onDelete);
|
|
15640
|
+
useSetIfNotUndefinedEffect("maxDisplayLength", props.maxDisplayLength);
|
|
15641
|
+
useSetIfNotUndefinedEffect("groupArraysAfterLength", props.groupArraysAfterLength);
|
|
15642
|
+
useSetIfNotUndefinedEffect("quotesOnKeys", props.quotesOnKeys);
|
|
15643
|
+
useSetIfNotUndefinedEffect("displayDataTypes", props.displayDataTypes);
|
|
15644
|
+
useSetIfNotUndefinedEffect("displaySize", props.displaySize);
|
|
15645
|
+
useSetIfNotUndefinedEffect("displayComma", props.displayComma);
|
|
15646
|
+
useSetIfNotUndefinedEffect("highlightUpdates", props.highlightUpdates);
|
|
15647
|
+
useEffect15(() => {
|
|
15648
|
+
if (props.theme === "light") {
|
|
15649
|
+
setState({
|
|
15650
|
+
colorspace: lightColorspace
|
|
15651
|
+
});
|
|
15652
|
+
} else if (props.theme === "dark") {
|
|
15653
|
+
setState({
|
|
15654
|
+
colorspace: darkColorspace
|
|
15655
|
+
});
|
|
15656
|
+
} else if (typeof props.theme === "object") {
|
|
15657
|
+
setState({
|
|
15658
|
+
colorspace: props.theme
|
|
15659
|
+
});
|
|
15660
|
+
}
|
|
15661
|
+
}, [
|
|
15662
|
+
setState,
|
|
15663
|
+
props.theme
|
|
15664
|
+
]);
|
|
15665
|
+
const themeCls = useMemo7(() => {
|
|
15666
|
+
if (typeof props.theme === "object") return "json-viewer-theme-custom";
|
|
15667
|
+
return props.theme === "dark" ? "json-viewer-theme-dark" : "json-viewer-theme-light";
|
|
15668
|
+
}, [
|
|
15669
|
+
props.theme
|
|
15670
|
+
]);
|
|
15671
|
+
const onceRef = useRef11(true);
|
|
15672
|
+
const registerTypes = useTypeRegistryStore((store) => store.registerTypes);
|
|
15673
|
+
if (onceRef.current) {
|
|
15674
|
+
const allTypes = props.valueTypes ? [
|
|
15675
|
+
...predefinedTypes,
|
|
15676
|
+
...props.valueTypes
|
|
15677
|
+
] : [
|
|
15678
|
+
...predefinedTypes
|
|
15679
|
+
];
|
|
15680
|
+
registerTypes(allTypes);
|
|
15681
|
+
onceRef.current = false;
|
|
15682
|
+
}
|
|
15683
|
+
useEffect15(() => {
|
|
15684
|
+
const allTypes = props.valueTypes ? [
|
|
15685
|
+
...predefinedTypes,
|
|
15686
|
+
...props.valueTypes
|
|
15687
|
+
] : [
|
|
15688
|
+
...predefinedTypes
|
|
15689
|
+
];
|
|
15690
|
+
registerTypes(allTypes);
|
|
15691
|
+
}, [
|
|
15692
|
+
props.valueTypes,
|
|
15693
|
+
registerTypes
|
|
15694
|
+
]);
|
|
15695
|
+
const value = useJsonViewerStore((store) => store.value);
|
|
15696
|
+
const prevValue = useJsonViewerStore((store) => store.prevValue);
|
|
15697
|
+
const emptyPath = useMemo7(() => [], []);
|
|
15698
|
+
const setHover = useJsonViewerStore((store) => store.setHover);
|
|
15699
|
+
const onMouseLeave = useCallback8(() => setHover(null), [
|
|
15700
|
+
setHover
|
|
15701
|
+
]);
|
|
15702
|
+
return /* @__PURE__ */ jsx129(Paper2, {
|
|
15703
|
+
elevation: 0,
|
|
15704
|
+
className: clsx(themeCls, props.className),
|
|
15705
|
+
style: props.style,
|
|
15706
|
+
sx: {
|
|
15707
|
+
fontFamily: "monospace",
|
|
15708
|
+
userSelect: "none",
|
|
15709
|
+
contentVisibility: "auto",
|
|
15710
|
+
...props.sx
|
|
15711
|
+
},
|
|
15712
|
+
onMouseLeave,
|
|
15713
|
+
children: /* @__PURE__ */ jsx129(DataKeyPair, {
|
|
15714
|
+
value,
|
|
15715
|
+
prevValue,
|
|
15716
|
+
path: emptyPath,
|
|
15717
|
+
last: true
|
|
15718
|
+
})
|
|
15719
|
+
});
|
|
15720
|
+
};
|
|
15721
|
+
var JsonViewer = function JsonViewer2(props) {
|
|
15722
|
+
if (true) {
|
|
15723
|
+
if ("displayObjectSize" in props) {
|
|
15724
|
+
console.error("`displayObjectSize` is deprecated. Use `displaySize` instead.\nSee https://viewer.textea.io/migration/migration-v3#raname-displayobjectsize-to-displaysize for more information.");
|
|
15725
|
+
}
|
|
15726
|
+
}
|
|
15727
|
+
const isAutoDarkTheme = useThemeDetector();
|
|
15728
|
+
const themeType = useMemo7(() => {
|
|
15729
|
+
var _props_theme;
|
|
15730
|
+
return props.theme === "auto" ? isAutoDarkTheme ? "dark" : "light" : (_props_theme = props.theme) !== null && _props_theme !== void 0 ? _props_theme : "light";
|
|
15731
|
+
}, [
|
|
15732
|
+
isAutoDarkTheme,
|
|
15733
|
+
props.theme
|
|
15734
|
+
]);
|
|
15735
|
+
const theme = useMemo7(() => {
|
|
15736
|
+
const backgroundColor = typeof themeType === "object" ? themeType.base00 : themeType === "dark" ? darkColorspace.base00 : lightColorspace.base00;
|
|
15737
|
+
const foregroundColor = typeof themeType === "object" ? themeType.base07 : themeType === "dark" ? darkColorspace.base07 : lightColorspace.base07;
|
|
15738
|
+
return createTheme({
|
|
15739
|
+
components: {
|
|
15740
|
+
MuiPaper: {
|
|
15741
|
+
styleOverrides: {
|
|
15742
|
+
root: {
|
|
15743
|
+
backgroundColor,
|
|
15744
|
+
color: foregroundColor
|
|
15745
|
+
}
|
|
15746
|
+
}
|
|
15747
|
+
}
|
|
15748
|
+
},
|
|
15749
|
+
palette: {
|
|
15750
|
+
mode: themeType === "dark" ? "dark" : "light",
|
|
15751
|
+
background: {
|
|
15752
|
+
default: backgroundColor
|
|
15753
|
+
}
|
|
15754
|
+
}
|
|
15755
|
+
});
|
|
15756
|
+
}, [
|
|
15757
|
+
themeType
|
|
15758
|
+
]);
|
|
15759
|
+
const mixedProps = {
|
|
15760
|
+
...props,
|
|
15761
|
+
theme: themeType
|
|
15762
|
+
};
|
|
15763
|
+
const jsonViewerStore = useMemo7(() => createJsonViewerStore(props), []);
|
|
15764
|
+
const typeRegistryStore = useMemo7(() => createTypeRegistryStore(), []);
|
|
15765
|
+
return /* @__PURE__ */ jsx129(ThemeProvider, {
|
|
15766
|
+
theme,
|
|
15767
|
+
children: /* @__PURE__ */ jsx129(TypeRegistryStoreContext.Provider, {
|
|
15768
|
+
value: typeRegistryStore,
|
|
15769
|
+
children: /* @__PURE__ */ jsx129(JsonViewerStoreContext.Provider, {
|
|
15770
|
+
value: jsonViewerStore,
|
|
15771
|
+
children: /* @__PURE__ */ jsx129(JsonViewerInner, {
|
|
15772
|
+
...mixedProps
|
|
15773
|
+
})
|
|
15774
|
+
})
|
|
15775
|
+
})
|
|
15776
|
+
});
|
|
15777
|
+
};
|
|
15778
|
+
|
|
15779
|
+
// src/components/event-details/event-details.tsx
|
|
15780
|
+
import { memo as memo10, useMemo as useMemo11, useState as useState13 } from "react";
|
|
15781
|
+
|
|
15782
|
+
// src/utils/iam-utils.ts
|
|
15783
|
+
function determinePermissionStatus(payload) {
|
|
15784
|
+
if (payload.explicit_deny_count && payload.explicit_deny_count > 0) {
|
|
15785
|
+
return "explicitly_denied";
|
|
15786
|
+
}
|
|
15787
|
+
if (payload.is_allowed && payload.explicit_allow_count && payload.explicit_allow_count > 0) {
|
|
15788
|
+
return "explicitly_allowed";
|
|
15789
|
+
}
|
|
15790
|
+
if (payload.is_allowed) {
|
|
15791
|
+
return "implicitly_allowed";
|
|
15792
|
+
}
|
|
15793
|
+
return "implicitly_denied";
|
|
15794
|
+
}
|
|
15795
|
+
function formatPermissionStatus(status) {
|
|
15796
|
+
switch (status) {
|
|
15797
|
+
case "explicitly_allowed": {
|
|
15798
|
+
return "Explicitly Allowed";
|
|
15799
|
+
}
|
|
15800
|
+
case "explicitly_denied": {
|
|
15801
|
+
return "Explicitly Denied";
|
|
15802
|
+
}
|
|
15803
|
+
case "implicitly_allowed": {
|
|
15804
|
+
return "Implicitly Allowed";
|
|
15805
|
+
}
|
|
15806
|
+
case "implicitly_denied": {
|
|
15807
|
+
return "Implicitly Denied";
|
|
15808
|
+
}
|
|
15809
|
+
}
|
|
15810
|
+
}
|
|
15811
|
+
function getPermissionStatusColor(status) {
|
|
15812
|
+
switch (status) {
|
|
15813
|
+
case "explicitly_allowed":
|
|
15814
|
+
case "implicitly_allowed": {
|
|
15815
|
+
return "success.main";
|
|
15816
|
+
}
|
|
15817
|
+
case "explicitly_denied": {
|
|
15818
|
+
return "error.main";
|
|
15819
|
+
}
|
|
15820
|
+
case "implicitly_denied": {
|
|
15821
|
+
return "warning.main";
|
|
15822
|
+
}
|
|
15823
|
+
}
|
|
15824
|
+
}
|
|
15825
|
+
function parseIAMEvent(payloadString) {
|
|
15826
|
+
try {
|
|
15827
|
+
const payload = JSON.parse(payloadString);
|
|
15828
|
+
const permission = determinePermissionStatus(payload);
|
|
15829
|
+
const actions = [];
|
|
15830
|
+
const resources = [];
|
|
15831
|
+
if (payload.explicit_allows) {
|
|
15832
|
+
for (const allow of payload.explicit_allows) {
|
|
15833
|
+
if (!actions.includes(allow.action)) actions.push(allow.action);
|
|
15834
|
+
if (!resources.includes(allow.resource)) resources.push(allow.resource);
|
|
15835
|
+
}
|
|
15836
|
+
}
|
|
15837
|
+
if (payload.explicit_denies) {
|
|
15838
|
+
for (const deny of payload.explicit_denies) {
|
|
15839
|
+
if (!actions.includes(deny.action)) actions.push(deny.action);
|
|
15840
|
+
if (!resources.includes(deny.resource)) resources.push(deny.resource);
|
|
15841
|
+
}
|
|
15842
|
+
}
|
|
15843
|
+
if (payload.implicit_denies) {
|
|
15844
|
+
for (const deny of payload.implicit_denies) {
|
|
15845
|
+
if (!actions.includes(deny.action)) actions.push(deny.action);
|
|
15846
|
+
if (!resources.includes(deny.resource)) resources.push(deny.resource);
|
|
15847
|
+
}
|
|
15848
|
+
}
|
|
15849
|
+
return {
|
|
15850
|
+
details: {
|
|
15851
|
+
actions,
|
|
15852
|
+
explicitAllows: payload.explicit_allow_count,
|
|
15853
|
+
explicitDenies: payload.explicit_deny_count,
|
|
15854
|
+
implicitDenies: payload.implicit_deny_count,
|
|
15855
|
+
resources
|
|
15856
|
+
},
|
|
15857
|
+
operation: payload.operation,
|
|
15858
|
+
permission,
|
|
15859
|
+
principal: payload.principal_arn,
|
|
15860
|
+
service: payload.service
|
|
15861
|
+
};
|
|
15862
|
+
} catch (error) {
|
|
15863
|
+
console.error("Error parsing IAM event payload:", error);
|
|
15864
|
+
return void 0;
|
|
15865
|
+
}
|
|
15866
|
+
}
|
|
15867
|
+
|
|
15868
|
+
// src/utils/event-utils.ts
|
|
15869
|
+
var iamEventParser = (eventName, attributes) => {
|
|
15870
|
+
if (attributes?.payload && typeof attributes.payload === "string") {
|
|
15871
|
+
const parsedIAM = parseIAMEvent(attributes.payload);
|
|
15872
|
+
if (parsedIAM) {
|
|
15873
|
+
const headline2 = `${parsedIAM.service}:${parsedIAM.operation} - ${formatPermissionStatus(parsedIAM.permission)}`;
|
|
15874
|
+
const messageParts = [`Principal: ${parsedIAM.principal}`];
|
|
15875
|
+
if (parsedIAM.details.actions && parsedIAM.details.actions.length > 0) {
|
|
15876
|
+
messageParts.push(`Actions: ${parsedIAM.details.actions.join(", ")}`);
|
|
15877
|
+
}
|
|
15878
|
+
if (parsedIAM.details.resources && parsedIAM.details.resources.length > 0) {
|
|
15879
|
+
messageParts.push(`Resources: ${parsedIAM.details.resources.join(", ")}`);
|
|
15880
|
+
}
|
|
15881
|
+
const detailsParts = [];
|
|
15882
|
+
if (parsedIAM.details.explicitAllows !== void 0) {
|
|
15883
|
+
detailsParts.push(`Explicit Allows: ${String(parsedIAM.details.explicitAllows)}`);
|
|
15884
|
+
}
|
|
15885
|
+
if (parsedIAM.details.explicitDenies !== void 0) {
|
|
15886
|
+
detailsParts.push(`Explicit Denies: ${String(parsedIAM.details.explicitDenies)}`);
|
|
15887
|
+
}
|
|
15888
|
+
if (parsedIAM.details.implicitDenies !== void 0) {
|
|
15889
|
+
detailsParts.push(`Implicit Denies: ${String(parsedIAM.details.implicitDenies)}`);
|
|
15890
|
+
}
|
|
15891
|
+
return {
|
|
15892
|
+
details: detailsParts.join("\n"),
|
|
15893
|
+
headline: headline2,
|
|
15894
|
+
message: messageParts.join("\n")
|
|
15895
|
+
};
|
|
15896
|
+
}
|
|
15897
|
+
}
|
|
15898
|
+
const headline = eventName || "IAM Event";
|
|
15899
|
+
const message = typeof attributes?.message === "string" ? attributes.message : "";
|
|
15900
|
+
const details = typeof attributes?.details === "string" ? attributes.details : "";
|
|
15901
|
+
return { details, headline, message };
|
|
15902
|
+
};
|
|
15903
|
+
var defaultEventParser = (eventName, attributes) => {
|
|
15904
|
+
const headline = eventName || "Event";
|
|
15905
|
+
const message = typeof attributes?.message === "string" ? attributes.message : "";
|
|
15906
|
+
const details = JSON.stringify(attributes ?? {}, void 0, 2);
|
|
15907
|
+
return { details, headline, message };
|
|
15908
|
+
};
|
|
15909
|
+
var eventParsers = {
|
|
15910
|
+
"iam.error": iamEventParser,
|
|
15911
|
+
"iam.event": iamEventParser,
|
|
15912
|
+
"iam.warning": iamEventParser
|
|
15913
|
+
};
|
|
15914
|
+
var parseEventMessage = (event) => {
|
|
15915
|
+
if (event.event_type && event.name) {
|
|
15916
|
+
try {
|
|
15917
|
+
const parser = eventParsers[event.event_type] ?? defaultEventParser;
|
|
15918
|
+
return parser(event.name, event.attributes);
|
|
15919
|
+
} catch (error) {
|
|
15920
|
+
console.error(`Error parsing event for type ${event.event_type}:`, error);
|
|
15921
|
+
return {
|
|
15922
|
+
details: "",
|
|
15923
|
+
headline: event.name || "Unknown Event",
|
|
15924
|
+
message: JSON.stringify(event.attributes)
|
|
15925
|
+
};
|
|
15926
|
+
}
|
|
15927
|
+
}
|
|
15928
|
+
return {
|
|
15929
|
+
details: JSON.stringify(event.attributes ?? {}),
|
|
15930
|
+
headline: event.name || "Event",
|
|
15931
|
+
message: typeof event.attributes?.message === "string" ? event.attributes.message : ""
|
|
15932
|
+
};
|
|
15933
|
+
};
|
|
15934
|
+
var EventLevel = {
|
|
15935
|
+
LevelError: 4,
|
|
14009
15936
|
LevelInfo: 1,
|
|
14010
15937
|
LevelNone: 0,
|
|
14011
15938
|
LevelPermission: 2,
|
|
@@ -14046,45 +15973,10 @@ var getEventGroupsByType = (events) => {
|
|
|
14046
15973
|
return groups;
|
|
14047
15974
|
};
|
|
14048
15975
|
|
|
14049
|
-
// src/components/event-details/event-details-header.tsx
|
|
14050
|
-
import { Close } from "@mui/icons-material";
|
|
14051
|
-
import { Box as Box6, IconButton, Typography as Typography4 } from "@mui/material";
|
|
14052
|
-
import { jsx as jsx129, jsxs as jsxs123 } from "react/jsx-runtime";
|
|
14053
|
-
var EventDetailsHeader = ({ event, onClose }) => {
|
|
14054
|
-
return /* @__PURE__ */ jsxs123(
|
|
14055
|
-
Box6,
|
|
14056
|
-
{
|
|
14057
|
-
sx: {
|
|
14058
|
-
alignItems: "center",
|
|
14059
|
-
borderBottom: "1px solid",
|
|
14060
|
-
borderColor: "divider",
|
|
14061
|
-
display: "flex",
|
|
14062
|
-
justifyContent: "space-between",
|
|
14063
|
-
p: 2
|
|
14064
|
-
},
|
|
14065
|
-
children: [
|
|
14066
|
-
/* @__PURE__ */ jsxs123(Box6, { children: [
|
|
14067
|
-
/* @__PURE__ */ jsx129(Typography4, { sx: { fontWeight: 600 }, variant: "h6", children: "Event Details" }),
|
|
14068
|
-
/* @__PURE__ */ jsxs123(Typography4, { color: "text.secondary", variant: "body2", children: [
|
|
14069
|
-
event.service_name,
|
|
14070
|
-
" ",
|
|
14071
|
-
"-",
|
|
14072
|
-
event.operation_name
|
|
14073
|
-
] })
|
|
14074
|
-
] }),
|
|
14075
|
-
onClose && /* @__PURE__ */ jsx129(IconButton, { onClick: onClose, size: "small", children: /* @__PURE__ */ jsx129(Close, {}) })
|
|
14076
|
-
]
|
|
14077
|
-
}
|
|
14078
|
-
);
|
|
14079
|
-
};
|
|
14080
|
-
|
|
14081
|
-
// src/components/event-details/event-section.tsx
|
|
14082
|
-
import { Box as Box12 } from "@mui/material";
|
|
14083
|
-
|
|
14084
15976
|
// src/components/event-details/event-detail.tsx
|
|
14085
15977
|
import { KeyboardArrowDown as KeyboardArrowDown2, KeyboardArrowRight as KeyboardArrowRight2 } from "@mui/icons-material";
|
|
14086
|
-
import { Box as Box10, Grid as Grid3, IconButton as
|
|
14087
|
-
import { useEffect as
|
|
15978
|
+
import { Box as Box10, Grid as Grid3, IconButton as IconButton2, Typography as Typography6 } from "@mui/material";
|
|
15979
|
+
import { useEffect as useEffect16, useMemo as useMemo9, useRef as useRef12, useState as useState10 } from "react";
|
|
14088
15980
|
|
|
14089
15981
|
// src/components/status-icon.tsx
|
|
14090
15982
|
import { Cancel, CheckCircle, Error as Error2, Info, RemoveCircle } from "@mui/icons-material";
|
|
@@ -14112,11 +16004,11 @@ var StatusIcon = ({ errorLevel }) => {
|
|
|
14112
16004
|
|
|
14113
16005
|
// src/components/event-details/iam-event-detail.tsx
|
|
14114
16006
|
import { CheckCircle as CheckCircle2, Error as ErrorIcon, Warning } from "@mui/icons-material";
|
|
14115
|
-
import { Box as Box8, Chip, Grid as Grid2, Typography as
|
|
16007
|
+
import { Box as Box8, Chip, Grid as Grid2, Typography as Typography4 } from "@mui/material";
|
|
14116
16008
|
import { jsx as jsx131, jsxs as jsxs124 } from "react/jsx-runtime";
|
|
14117
16009
|
var DetailRow = ({ content, label }) => /* @__PURE__ */ jsxs124(Grid2, { container: true, spacing: 0, sx: { mb: 1 }, children: [
|
|
14118
16010
|
/* @__PURE__ */ jsx131(Grid2, { item: true, sx: { pr: 1 }, xs: 3, children: /* @__PURE__ */ jsx131(
|
|
14119
|
-
|
|
16011
|
+
Typography4,
|
|
14120
16012
|
{
|
|
14121
16013
|
sx: {
|
|
14122
16014
|
color: "text.secondary",
|
|
@@ -14127,7 +16019,7 @@ var DetailRow = ({ content, label }) => /* @__PURE__ */ jsxs124(Grid2, { contain
|
|
|
14127
16019
|
}
|
|
14128
16020
|
) }),
|
|
14129
16021
|
/* @__PURE__ */ jsx131(Grid2, { item: true, xs: 9, children: typeof content === "string" ? /* @__PURE__ */ jsx131(
|
|
14130
|
-
|
|
16022
|
+
Typography4,
|
|
14131
16023
|
{
|
|
14132
16024
|
sx: {
|
|
14133
16025
|
color: "text.primary",
|
|
@@ -14155,11 +16047,11 @@ var PermissionIcon = ({ status }) => {
|
|
|
14155
16047
|
var IAMEventDetail = ({ event }) => {
|
|
14156
16048
|
const payloadString = event.attributes?.payload;
|
|
14157
16049
|
if (!payloadString) {
|
|
14158
|
-
return /* @__PURE__ */ jsx131(Box8, { sx: { p: 2 }, children: /* @__PURE__ */ jsx131(
|
|
16050
|
+
return /* @__PURE__ */ jsx131(Box8, { sx: { p: 2 }, children: /* @__PURE__ */ jsx131(Typography4, { sx: { fontWeight: 600 }, variant: "body2", children: "No IAM policy evaluation data available" }) });
|
|
14159
16051
|
}
|
|
14160
16052
|
const parsedIAM = parseIAMEvent(payloadString);
|
|
14161
16053
|
if (!parsedIAM) {
|
|
14162
|
-
return /* @__PURE__ */ jsx131(Box8, { sx: { p: 2 }, children: /* @__PURE__ */ jsx131(
|
|
16054
|
+
return /* @__PURE__ */ jsx131(Box8, { sx: { p: 2 }, children: /* @__PURE__ */ jsx131(Typography4, { sx: { fontWeight: 600 }, variant: "body2", children: "Failed to parse IAM event data" }) });
|
|
14163
16055
|
}
|
|
14164
16056
|
return /* @__PURE__ */ jsxs124(Box8, { sx: { p: 2 }, children: [
|
|
14165
16057
|
/* @__PURE__ */ jsx131(Box8, { sx: { mb: 2 }, children: /* @__PURE__ */ jsx131(
|
|
@@ -14181,7 +16073,7 @@ var IAMEventDetail = ({ event }) => {
|
|
|
14181
16073
|
DetailRow,
|
|
14182
16074
|
{
|
|
14183
16075
|
content: /* @__PURE__ */ jsx131(Box8, { children: parsedIAM.details.actions.map((action) => /* @__PURE__ */ jsx131(
|
|
14184
|
-
|
|
16076
|
+
Typography4,
|
|
14185
16077
|
{
|
|
14186
16078
|
sx: {
|
|
14187
16079
|
color: "text.primary"
|
|
@@ -14198,7 +16090,7 @@ var IAMEventDetail = ({ event }) => {
|
|
|
14198
16090
|
DetailRow,
|
|
14199
16091
|
{
|
|
14200
16092
|
content: /* @__PURE__ */ jsx131(Box8, { children: parsedIAM.details.resources.map((resource) => /* @__PURE__ */ jsx131(
|
|
14201
|
-
|
|
16093
|
+
Typography4,
|
|
14202
16094
|
{
|
|
14203
16095
|
sx: {
|
|
14204
16096
|
color: "text.primary",
|
|
@@ -14213,19 +16105,19 @@ var IAMEventDetail = ({ event }) => {
|
|
|
14213
16105
|
}
|
|
14214
16106
|
),
|
|
14215
16107
|
/* @__PURE__ */ jsxs124(Box8, { sx: { mt: 2 }, children: [
|
|
14216
|
-
/* @__PURE__ */ jsx131(
|
|
16108
|
+
/* @__PURE__ */ jsx131(Typography4, { sx: { fontWeight: 600, mb: 1 }, variant: "caption", children: "Policy Evaluation" }),
|
|
14217
16109
|
/* @__PURE__ */ jsxs124(Grid2, { container: true, spacing: 2, children: [
|
|
14218
16110
|
parsedIAM.details.explicitAllows !== void 0 && /* @__PURE__ */ jsx131(Grid2, { item: true, xs: 4, children: /* @__PURE__ */ jsxs124(Box8, { sx: { textAlign: "center" }, children: [
|
|
14219
|
-
/* @__PURE__ */ jsx131(
|
|
14220
|
-
/* @__PURE__ */ jsx131(
|
|
16111
|
+
/* @__PURE__ */ jsx131(Typography4, { color: "success.main", sx: { fontWeight: "bold" }, variant: "h6", children: parsedIAM.details.explicitAllows }),
|
|
16112
|
+
/* @__PURE__ */ jsx131(Typography4, { sx: { fontWeight: 600 }, variant: "caption", children: "Explicit Allows" })
|
|
14221
16113
|
] }) }),
|
|
14222
16114
|
parsedIAM.details.explicitDenies !== void 0 && /* @__PURE__ */ jsx131(Grid2, { item: true, xs: 4, children: /* @__PURE__ */ jsxs124(Box8, { sx: { textAlign: "center" }, children: [
|
|
14223
|
-
/* @__PURE__ */ jsx131(
|
|
14224
|
-
/* @__PURE__ */ jsx131(
|
|
16115
|
+
/* @__PURE__ */ jsx131(Typography4, { color: "error.main", sx: { fontWeight: "bold" }, variant: "h6", children: parsedIAM.details.explicitDenies }),
|
|
16116
|
+
/* @__PURE__ */ jsx131(Typography4, { sx: { fontWeight: 600 }, variant: "caption", children: "Explicit Denies" })
|
|
14225
16117
|
] }) }),
|
|
14226
16118
|
parsedIAM.details.implicitDenies !== void 0 && /* @__PURE__ */ jsx131(Grid2, { item: true, xs: 4, children: /* @__PURE__ */ jsxs124(Box8, { sx: { textAlign: "center" }, children: [
|
|
14227
|
-
/* @__PURE__ */ jsx131(
|
|
14228
|
-
/* @__PURE__ */ jsx131(
|
|
16119
|
+
/* @__PURE__ */ jsx131(Typography4, { color: "warning.main", sx: { fontWeight: "bold" }, variant: "h6", children: parsedIAM.details.implicitDenies }),
|
|
16120
|
+
/* @__PURE__ */ jsx131(Typography4, { sx: { fontWeight: 600 }, variant: "caption", children: "Implicit Denies" })
|
|
14229
16121
|
] }) })
|
|
14230
16122
|
] })
|
|
14231
16123
|
] })
|
|
@@ -14234,8 +16126,8 @@ var IAMEventDetail = ({ event }) => {
|
|
|
14234
16126
|
|
|
14235
16127
|
// src/components/event-details/iam-permission-detail.tsx
|
|
14236
16128
|
import { KeyboardArrowDown, KeyboardArrowRight } from "@mui/icons-material";
|
|
14237
|
-
import { Box as Box9, Chip as Chip2, IconButton
|
|
14238
|
-
import { useMemo as
|
|
16129
|
+
import { Box as Box9, Chip as Chip2, IconButton, Typography as Typography5 } from "@mui/material";
|
|
16130
|
+
import { useMemo as useMemo8, useState as useState9 } from "react";
|
|
14239
16131
|
import { jsx as jsx132, jsxs as jsxs125 } from "react/jsx-runtime";
|
|
14240
16132
|
var getChipColors = (status) => {
|
|
14241
16133
|
const isAllowed = status === "explicitly_allowed" || status === "implicitly_allowed";
|
|
@@ -14245,8 +16137,8 @@ var getChipColors = (status) => {
|
|
|
14245
16137
|
};
|
|
14246
16138
|
};
|
|
14247
16139
|
var IAMPermissionItem = ({ event }) => {
|
|
14248
|
-
const [isOpen, setIsOpen] =
|
|
14249
|
-
const parsedData =
|
|
16140
|
+
const [isOpen, setIsOpen] = useState9(false);
|
|
16141
|
+
const parsedData = useMemo8(() => {
|
|
14250
16142
|
const payloadString = event.attributes?.payload;
|
|
14251
16143
|
if (!payloadString) {
|
|
14252
16144
|
return;
|
|
@@ -14266,7 +16158,7 @@ var IAMPermissionItem = ({ event }) => {
|
|
|
14266
16158
|
const { chipColors, parsedIAM } = parsedData;
|
|
14267
16159
|
return /* @__PURE__ */ jsxs125(Box9, { sx: { mb: 1 }, children: [
|
|
14268
16160
|
/* @__PURE__ */ jsxs125(Box9, { sx: { alignItems: "center", display: "flex" }, children: [
|
|
14269
|
-
/* @__PURE__ */ jsx132(
|
|
16161
|
+
/* @__PURE__ */ jsx132(IconButton, { onClick: () => {
|
|
14270
16162
|
setIsOpen(!isOpen);
|
|
14271
16163
|
}, size: "small", sx: { mr: 1, p: 0 }, children: isOpen ? /* @__PURE__ */ jsx132(KeyboardArrowDown, {}) : /* @__PURE__ */ jsx132(KeyboardArrowRight, {}) }),
|
|
14272
16164
|
/* @__PURE__ */ jsx132(
|
|
@@ -14282,18 +16174,18 @@ var IAMPermissionItem = ({ event }) => {
|
|
|
14282
16174
|
)
|
|
14283
16175
|
] }),
|
|
14284
16176
|
isOpen && /* @__PURE__ */ jsx132(Box9, { sx: { ml: 4, mt: 1 }, children: /* @__PURE__ */ jsxs125(Box9, { children: [
|
|
14285
|
-
/* @__PURE__ */ jsx132(
|
|
14286
|
-
/* @__PURE__ */ jsx132(
|
|
16177
|
+
/* @__PURE__ */ jsx132(Typography5, { sx: { fontWeight: 600 }, variant: "caption", children: "Principal" }),
|
|
16178
|
+
/* @__PURE__ */ jsx132(Typography5, { variant: "body2", children: parsedIAM.principal })
|
|
14287
16179
|
] }) })
|
|
14288
16180
|
] });
|
|
14289
16181
|
};
|
|
14290
16182
|
var IAMPermissionDetail = ({ events }) => /* @__PURE__ */ jsx132(Box9, { sx: { mt: 2 }, children: events.map((event) => /* @__PURE__ */ jsx132(IAMPermissionItem, { event }, `${event.span_id}-${event.event_id}`)) });
|
|
14291
16183
|
|
|
14292
16184
|
// src/components/event-details/event-detail.tsx
|
|
14293
|
-
import { Fragment as
|
|
16185
|
+
import { Fragment as Fragment6, jsx as jsx133, jsxs as jsxs126 } from "react/jsx-runtime";
|
|
14294
16186
|
var DetailRow2 = ({ content, label }) => /* @__PURE__ */ jsxs126(Grid3, { container: true, spacing: 0, sx: { mb: 1 }, children: [
|
|
14295
16187
|
/* @__PURE__ */ jsx133(Grid3, { item: true, sx: { pr: 1 }, xs: 3, children: /* @__PURE__ */ jsx133(
|
|
14296
|
-
|
|
16188
|
+
Typography6,
|
|
14297
16189
|
{
|
|
14298
16190
|
sx: {
|
|
14299
16191
|
color: "text.primary",
|
|
@@ -14304,7 +16196,7 @@ var DetailRow2 = ({ content, label }) => /* @__PURE__ */ jsxs126(Grid3, { contai
|
|
|
14304
16196
|
}
|
|
14305
16197
|
) }),
|
|
14306
16198
|
/* @__PURE__ */ jsx133(Grid3, { item: true, xs: 9, children: typeof content === "string" ? /* @__PURE__ */ jsx133(
|
|
14307
|
-
|
|
16199
|
+
Typography6,
|
|
14308
16200
|
{
|
|
14309
16201
|
sx: {
|
|
14310
16202
|
color: "text.primary",
|
|
@@ -14316,15 +16208,15 @@ var DetailRow2 = ({ content, label }) => /* @__PURE__ */ jsxs126(Grid3, { contai
|
|
|
14316
16208
|
) : content })
|
|
14317
16209
|
] });
|
|
14318
16210
|
var EventMessage = ({ event }) => {
|
|
14319
|
-
const [isOpen, setIsOpen] =
|
|
14320
|
-
const [isOverflowing, setIsOverflowing] =
|
|
14321
|
-
const textReference =
|
|
14322
|
-
const parsedMessage =
|
|
14323
|
-
const isIAMPolicyEvent =
|
|
16211
|
+
const [isOpen, setIsOpen] = useState10(false);
|
|
16212
|
+
const [isOverflowing, setIsOverflowing] = useState10(false);
|
|
16213
|
+
const textReference = useRef12(null);
|
|
16214
|
+
const parsedMessage = useMemo9(() => parseEventMessage(event), [event]);
|
|
16215
|
+
const isIAMPolicyEvent = useMemo9(
|
|
14324
16216
|
() => event.event_type === "iam.policy_evaluation" && event.attributes?.payload && typeof event.attributes.payload === "string",
|
|
14325
16217
|
[event]
|
|
14326
16218
|
);
|
|
14327
|
-
|
|
16219
|
+
useEffect16(() => {
|
|
14328
16220
|
const checkOverflow = () => {
|
|
14329
16221
|
const element = textReference.current;
|
|
14330
16222
|
if (element) {
|
|
@@ -14337,18 +16229,18 @@ var EventMessage = ({ event }) => {
|
|
|
14337
16229
|
window.removeEventListener("resize", checkOverflow);
|
|
14338
16230
|
};
|
|
14339
16231
|
}, [parsedMessage.headline]);
|
|
14340
|
-
const hasAdditionalContent =
|
|
16232
|
+
const hasAdditionalContent = useMemo9(
|
|
14341
16233
|
() => parsedMessage.message || parsedMessage.details || isIAMPolicyEvent,
|
|
14342
16234
|
[parsedMessage.message, parsedMessage.details, isIAMPolicyEvent]
|
|
14343
16235
|
);
|
|
14344
|
-
const shouldShowToggle =
|
|
16236
|
+
const shouldShowToggle = useMemo9(
|
|
14345
16237
|
() => isOverflowing || hasAdditionalContent,
|
|
14346
16238
|
[isOverflowing, hasAdditionalContent]
|
|
14347
16239
|
);
|
|
14348
16240
|
return /* @__PURE__ */ jsxs126(Box10, { sx: { display: "flex", flexDirection: "column" }, children: [
|
|
14349
16241
|
/* @__PURE__ */ jsxs126(Box10, { sx: { alignItems: "flex-start", display: "flex" }, children: [
|
|
14350
16242
|
Boolean(shouldShowToggle) && /* @__PURE__ */ jsx133(
|
|
14351
|
-
|
|
16243
|
+
IconButton2,
|
|
14352
16244
|
{
|
|
14353
16245
|
onClick: () => {
|
|
14354
16246
|
setIsOpen(!isOpen);
|
|
@@ -14359,7 +16251,7 @@ var EventMessage = ({ event }) => {
|
|
|
14359
16251
|
}
|
|
14360
16252
|
),
|
|
14361
16253
|
/* @__PURE__ */ jsx133(
|
|
14362
|
-
|
|
16254
|
+
Typography6,
|
|
14363
16255
|
{
|
|
14364
16256
|
ref: textReference,
|
|
14365
16257
|
sx: {
|
|
@@ -14376,7 +16268,7 @@ var EventMessage = ({ event }) => {
|
|
|
14376
16268
|
}
|
|
14377
16269
|
)
|
|
14378
16270
|
] }),
|
|
14379
|
-
isOpen && /* @__PURE__ */ jsx133(Box10, { sx: { ml: 4, mt: 1 }, children: isIAMPolicyEvent ? /* @__PURE__ */ jsx133(IAMEventDetail, { event }) : /* @__PURE__ */ jsxs126(
|
|
16271
|
+
isOpen && /* @__PURE__ */ jsx133(Box10, { sx: { ml: 4, mt: 1 }, children: isIAMPolicyEvent ? /* @__PURE__ */ jsx133(IAMEventDetail, { event }) : /* @__PURE__ */ jsxs126(Fragment6, { children: [
|
|
14380
16272
|
Boolean(parsedMessage.message) && /* @__PURE__ */ jsx133(DetailRow2, { content: parsedMessage.message, label: "Message:" }),
|
|
14381
16273
|
Boolean(parsedMessage.details) && /* @__PURE__ */ jsx133(DetailRow2, { content: parsedMessage.details, label: "Details:" })
|
|
14382
16274
|
] }) })
|
|
@@ -14417,7 +16309,7 @@ var EventDetail = ({
|
|
|
14417
16309
|
mb: 1
|
|
14418
16310
|
},
|
|
14419
16311
|
children: /* @__PURE__ */ jsx133(
|
|
14420
|
-
|
|
16312
|
+
Typography6,
|
|
14421
16313
|
{
|
|
14422
16314
|
sx: {
|
|
14423
16315
|
alignItems: "left",
|
|
@@ -14448,7 +16340,7 @@ var EventDetail = ({
|
|
|
14448
16340
|
children: [
|
|
14449
16341
|
/* @__PURE__ */ jsx133(StatusIcon, { errorLevel: eventLevel }),
|
|
14450
16342
|
/* @__PURE__ */ jsx133(
|
|
14451
|
-
|
|
16343
|
+
Typography6,
|
|
14452
16344
|
{
|
|
14453
16345
|
sx: {
|
|
14454
16346
|
alignItems: "left",
|
|
@@ -14480,85 +16372,6 @@ var EventDetail = ({
|
|
|
14480
16372
|
] });
|
|
14481
16373
|
};
|
|
14482
16374
|
|
|
14483
|
-
// src/components/event-details/toggle-section.tsx
|
|
14484
|
-
import { KeyboardArrowDown as KeyboardArrowDown3, KeyboardArrowRight as KeyboardArrowRight3 } from "@mui/icons-material";
|
|
14485
|
-
import { Box as Box11, Typography as Typography8 } from "@mui/material";
|
|
14486
|
-
import { useState as useState10 } from "react";
|
|
14487
|
-
import { jsx as jsx134, jsxs as jsxs127 } from "react/jsx-runtime";
|
|
14488
|
-
var ToggleSection = ({ children, headline, initialOpen = true }) => {
|
|
14489
|
-
const [isOpen, setIsOpen] = useState10(initialOpen);
|
|
14490
|
-
return /* @__PURE__ */ jsxs127(Box11, { sx: { mt: 4 }, children: [
|
|
14491
|
-
/* @__PURE__ */ jsx134(
|
|
14492
|
-
Box11,
|
|
14493
|
-
{
|
|
14494
|
-
onClick: () => {
|
|
14495
|
-
setIsOpen(!isOpen);
|
|
14496
|
-
},
|
|
14497
|
-
sx: {
|
|
14498
|
-
cursor: "pointer",
|
|
14499
|
-
mb: 1
|
|
14500
|
-
},
|
|
14501
|
-
children: /* @__PURE__ */ jsxs127(
|
|
14502
|
-
Box11,
|
|
14503
|
-
{
|
|
14504
|
-
role: "button",
|
|
14505
|
-
sx: {
|
|
14506
|
-
alignItems: "center",
|
|
14507
|
-
display: "flex",
|
|
14508
|
-
gap: 1
|
|
14509
|
-
},
|
|
14510
|
-
children: [
|
|
14511
|
-
/* @__PURE__ */ jsx134(Typography8, { sx: { fontWeight: 600 }, variant: "subtitle2", children: headline }),
|
|
14512
|
-
isOpen ? /* @__PURE__ */ jsx134(KeyboardArrowDown3, { sx: { color: "text.secondary", height: 20, width: 20 } }) : /* @__PURE__ */ jsx134(KeyboardArrowRight3, { sx: { color: "text.secondary", height: 20, width: 20 } })
|
|
14513
|
-
]
|
|
14514
|
-
}
|
|
14515
|
-
)
|
|
14516
|
-
}
|
|
14517
|
-
),
|
|
14518
|
-
isOpen && /* @__PURE__ */ jsx134(Box11, { children })
|
|
14519
|
-
] });
|
|
14520
|
-
};
|
|
14521
|
-
|
|
14522
|
-
// src/components/event-details/event-section.tsx
|
|
14523
|
-
import { jsx as jsx135, jsxs as jsxs128 } from "react/jsx-runtime";
|
|
14524
|
-
var EventSection = ({
|
|
14525
|
-
eventGroups,
|
|
14526
|
-
headline
|
|
14527
|
-
}) => /* @__PURE__ */ jsx135(ToggleSection, { headline, children: /* @__PURE__ */ jsxs128(Box12, { children: [
|
|
14528
|
-
eventGroups.errors && /* @__PURE__ */ jsx135(
|
|
14529
|
-
EventDetail,
|
|
14530
|
-
{
|
|
14531
|
-
displayText: "Error",
|
|
14532
|
-
events: eventGroups.errors,
|
|
14533
|
-
type: "error"
|
|
14534
|
-
}
|
|
14535
|
-
),
|
|
14536
|
-
eventGroups.warnings && /* @__PURE__ */ jsx135(
|
|
14537
|
-
EventDetail,
|
|
14538
|
-
{
|
|
14539
|
-
displayText: "Warning",
|
|
14540
|
-
events: eventGroups.warnings,
|
|
14541
|
-
type: "warning"
|
|
14542
|
-
}
|
|
14543
|
-
),
|
|
14544
|
-
eventGroups.permissions && /* @__PURE__ */ jsx135(
|
|
14545
|
-
EventDetail,
|
|
14546
|
-
{
|
|
14547
|
-
displayText: "IAM Permission",
|
|
14548
|
-
events: eventGroups.permissions,
|
|
14549
|
-
type: "permission"
|
|
14550
|
-
}
|
|
14551
|
-
),
|
|
14552
|
-
eventGroups.info && /* @__PURE__ */ jsx135(
|
|
14553
|
-
EventDetail,
|
|
14554
|
-
{
|
|
14555
|
-
displayText: "Info",
|
|
14556
|
-
events: eventGroups.info,
|
|
14557
|
-
type: "info"
|
|
14558
|
-
}
|
|
14559
|
-
)
|
|
14560
|
-
] }) });
|
|
14561
|
-
|
|
14562
16375
|
// node_modules/@smithy/protocol-http/dist-es/extensions/httpExtensionConfiguration.js
|
|
14563
16376
|
var getHttpHandlerExtensionConfiguration = (runtimeConfig) => {
|
|
14564
16377
|
return {
|
|
@@ -14649,9 +16462,9 @@ var HttpRequest = class _HttpRequest {
|
|
|
14649
16462
|
return _HttpRequest.clone(this);
|
|
14650
16463
|
}
|
|
14651
16464
|
};
|
|
14652
|
-
function cloneQuery(
|
|
14653
|
-
return Object.keys(
|
|
14654
|
-
const param =
|
|
16465
|
+
function cloneQuery(query2) {
|
|
16466
|
+
return Object.keys(query2).reduce((carry, paramName) => {
|
|
16467
|
+
const param = query2[paramName];
|
|
14655
16468
|
return {
|
|
14656
16469
|
...carry,
|
|
14657
16470
|
[paramName]: Array.isArray(param) ? [...param] : param
|
|
@@ -15023,10 +16836,10 @@ var escapeUri = (uri) => encodeURIComponent(uri).replace(/[!'()*]/g, hexEncode);
|
|
|
15023
16836
|
var hexEncode = (c3) => `%${c3.charCodeAt(0).toString(16).toUpperCase()}`;
|
|
15024
16837
|
|
|
15025
16838
|
// node_modules/@smithy/querystring-builder/dist-es/index.js
|
|
15026
|
-
function buildQueryString(
|
|
16839
|
+
function buildQueryString(query2) {
|
|
15027
16840
|
const parts = [];
|
|
15028
|
-
for (let key of Object.keys(
|
|
15029
|
-
const value =
|
|
16841
|
+
for (let key of Object.keys(query2).sort()) {
|
|
16842
|
+
const value = query2[key];
|
|
15030
16843
|
key = escapeUri(key);
|
|
15031
16844
|
if (Array.isArray(value)) {
|
|
15032
16845
|
for (let i2 = 0, iLen = value.length; i2 < iLen; i2++) {
|
|
@@ -15393,7 +17206,7 @@ var findHeader = (pattern, headers) => {
|
|
|
15393
17206
|
|
|
15394
17207
|
// node_modules/@smithy/querystring-parser/dist-es/index.js
|
|
15395
17208
|
function parseQueryString(querystring) {
|
|
15396
|
-
const
|
|
17209
|
+
const query2 = {};
|
|
15397
17210
|
querystring = querystring.replace(/^\?/, "");
|
|
15398
17211
|
if (querystring) {
|
|
15399
17212
|
for (const pair of querystring.split("&")) {
|
|
@@ -15402,16 +17215,16 @@ function parseQueryString(querystring) {
|
|
|
15402
17215
|
if (value) {
|
|
15403
17216
|
value = decodeURIComponent(value);
|
|
15404
17217
|
}
|
|
15405
|
-
if (!(key in
|
|
15406
|
-
|
|
15407
|
-
} else if (Array.isArray(
|
|
15408
|
-
|
|
17218
|
+
if (!(key in query2)) {
|
|
17219
|
+
query2[key] = value;
|
|
17220
|
+
} else if (Array.isArray(query2[key])) {
|
|
17221
|
+
query2[key].push(value);
|
|
15409
17222
|
} else {
|
|
15410
|
-
|
|
17223
|
+
query2[key] = [query2[key], value];
|
|
15411
17224
|
}
|
|
15412
17225
|
}
|
|
15413
17226
|
}
|
|
15414
|
-
return
|
|
17227
|
+
return query2;
|
|
15415
17228
|
}
|
|
15416
17229
|
|
|
15417
17230
|
// node_modules/@smithy/url-parser/dist-es/index.js
|
|
@@ -15420,16 +17233,16 @@ var parseUrl = (url) => {
|
|
|
15420
17233
|
return parseUrl(new URL(url));
|
|
15421
17234
|
}
|
|
15422
17235
|
const { hostname, pathname, port, protocol, search } = url;
|
|
15423
|
-
let
|
|
17236
|
+
let query2;
|
|
15424
17237
|
if (search) {
|
|
15425
|
-
|
|
17238
|
+
query2 = parseQueryString(search);
|
|
15426
17239
|
}
|
|
15427
17240
|
return {
|
|
15428
17241
|
hostname,
|
|
15429
17242
|
port: port ? parseInt(port) : void 0,
|
|
15430
17243
|
protocol,
|
|
15431
17244
|
path: pathname,
|
|
15432
|
-
query
|
|
17245
|
+
query: query2
|
|
15433
17246
|
};
|
|
15434
17247
|
};
|
|
15435
17248
|
|
|
@@ -15832,8 +17645,8 @@ var TypeRegistry = class _TypeRegistry {
|
|
|
15832
17645
|
}
|
|
15833
17646
|
register(shapeId, schema) {
|
|
15834
17647
|
const qualifiedName = this.normalizeShapeId(shapeId);
|
|
15835
|
-
for (const
|
|
15836
|
-
|
|
17648
|
+
for (const r3 of [this, _TypeRegistry.for(qualifiedName.split("#")[0])]) {
|
|
17649
|
+
r3.schemas.set(qualifiedName, schema);
|
|
15837
17650
|
}
|
|
15838
17651
|
}
|
|
15839
17652
|
getSchema(shapeId) {
|
|
@@ -15846,9 +17659,9 @@ var TypeRegistry = class _TypeRegistry {
|
|
|
15846
17659
|
registerError(es, ctor) {
|
|
15847
17660
|
const $error = es;
|
|
15848
17661
|
const ns = $error[1];
|
|
15849
|
-
for (const
|
|
15850
|
-
|
|
15851
|
-
|
|
17662
|
+
for (const r3 of [this, _TypeRegistry.for(ns)]) {
|
|
17663
|
+
r3.schemas.set(ns + "#" + $error[2], $error);
|
|
17664
|
+
r3.exceptions.set($error, ctor);
|
|
15852
17665
|
}
|
|
15853
17666
|
}
|
|
15854
17667
|
getErrorCtor(es) {
|
|
@@ -16366,7 +18179,7 @@ var HttpProtocol = class extends SerdeContext {
|
|
|
16366
18179
|
var RpcProtocol = class extends HttpProtocol {
|
|
16367
18180
|
async serializeRequest(operationSchema, input, context) {
|
|
16368
18181
|
const serializer = this.serializer;
|
|
16369
|
-
const
|
|
18182
|
+
const query2 = {};
|
|
16370
18183
|
const headers = {};
|
|
16371
18184
|
const endpoint = await context.endpoint();
|
|
16372
18185
|
const ns = NormalizedSchema.of(operationSchema?.input);
|
|
@@ -16378,7 +18191,7 @@ var RpcProtocol = class extends HttpProtocol {
|
|
|
16378
18191
|
port: void 0,
|
|
16379
18192
|
path: "/",
|
|
16380
18193
|
fragment: void 0,
|
|
16381
|
-
query,
|
|
18194
|
+
query: query2,
|
|
16382
18195
|
headers,
|
|
16383
18196
|
body: void 0
|
|
16384
18197
|
});
|
|
@@ -16412,7 +18225,7 @@ var RpcProtocol = class extends HttpProtocol {
|
|
|
16412
18225
|
}
|
|
16413
18226
|
}
|
|
16414
18227
|
request.headers = Object.assign(request.headers, headers);
|
|
16415
|
-
request.query =
|
|
18228
|
+
request.query = query2;
|
|
16416
18229
|
request.body = payload;
|
|
16417
18230
|
request.method = "POST";
|
|
16418
18231
|
return request;
|
|
@@ -16703,13 +18516,13 @@ var getAttrPathList = (path) => {
|
|
|
16703
18516
|
};
|
|
16704
18517
|
|
|
16705
18518
|
// node_modules/@smithy/util-endpoints/dist-es/lib/getAttr.js
|
|
16706
|
-
var getAttr = (value, path) => getAttrPathList(path).reduce((acc,
|
|
18519
|
+
var getAttr = (value, path) => getAttrPathList(path).reduce((acc, index) => {
|
|
16707
18520
|
if (typeof acc !== "object") {
|
|
16708
|
-
throw new EndpointError(`Index '${
|
|
18521
|
+
throw new EndpointError(`Index '${index}' in '${path}' not found in '${JSON.stringify(value)}'`);
|
|
16709
18522
|
} else if (Array.isArray(acc)) {
|
|
16710
|
-
return acc[parseInt(
|
|
18523
|
+
return acc[parseInt(index)];
|
|
16711
18524
|
}
|
|
16712
|
-
return acc[
|
|
18525
|
+
return acc[index];
|
|
16713
18526
|
}, value);
|
|
16714
18527
|
|
|
16715
18528
|
// node_modules/@smithy/util-endpoints/dist-es/lib/isSet.js
|
|
@@ -16730,9 +18543,9 @@ var parseURL = (value) => {
|
|
|
16730
18543
|
return value;
|
|
16731
18544
|
}
|
|
16732
18545
|
if (typeof value === "object" && "hostname" in value) {
|
|
16733
|
-
const { hostname: hostname2, port, protocol: protocol2 = "", path = "", query = {} } = value;
|
|
18546
|
+
const { hostname: hostname2, port, protocol: protocol2 = "", path = "", query: query2 = {} } = value;
|
|
16734
18547
|
const url = new URL(`${protocol2}//${hostname2}${port ? `:${port}` : ""}${path}`);
|
|
16735
|
-
url.search = Object.entries(
|
|
18548
|
+
url.search = Object.entries(query2).map(([k2, v2]) => `${k2}=${v2}`).join("&");
|
|
16736
18549
|
return url;
|
|
16737
18550
|
}
|
|
16738
18551
|
return new URL(value);
|
|
@@ -17516,7 +19329,7 @@ var AwsSdkSigV4Signer = class {
|
|
|
17516
19329
|
};
|
|
17517
19330
|
|
|
17518
19331
|
// node_modules/@smithy/property-provider/dist-es/memoize.js
|
|
17519
|
-
var
|
|
19332
|
+
var memoize = (provider, isExpired, requiresRefresh) => {
|
|
17520
19333
|
let resolved;
|
|
17521
19334
|
let pending;
|
|
17522
19335
|
let hasResult;
|
|
@@ -17811,18 +19624,18 @@ var hasHeader = (soughtHeader, headers) => {
|
|
|
17811
19624
|
|
|
17812
19625
|
// node_modules/@smithy/signature-v4/dist-es/moveHeadersToQuery.js
|
|
17813
19626
|
var moveHeadersToQuery = (request, options = {}) => {
|
|
17814
|
-
const { headers, query = {} } = HttpRequest.clone(request);
|
|
19627
|
+
const { headers, query: query2 = {} } = HttpRequest.clone(request);
|
|
17815
19628
|
for (const name of Object.keys(headers)) {
|
|
17816
19629
|
const lname = name.toLowerCase();
|
|
17817
19630
|
if (lname.slice(0, 6) === "x-amz-" && !options.unhoistableHeaders?.has(lname) || options.hoistableHeaders?.has(lname)) {
|
|
17818
|
-
|
|
19631
|
+
query2[name] = headers[name];
|
|
17819
19632
|
delete headers[name];
|
|
17820
19633
|
}
|
|
17821
19634
|
}
|
|
17822
19635
|
return {
|
|
17823
19636
|
...request,
|
|
17824
19637
|
headers,
|
|
17825
|
-
query
|
|
19638
|
+
query: query2
|
|
17826
19639
|
};
|
|
17827
19640
|
};
|
|
17828
19641
|
|
|
@@ -17841,16 +19654,16 @@ var prepareRequest = (request) => {
|
|
|
17841
19654
|
init_dist_es();
|
|
17842
19655
|
|
|
17843
19656
|
// node_modules/@smithy/signature-v4/dist-es/getCanonicalQuery.js
|
|
17844
|
-
var getCanonicalQuery = ({ query = {} }) => {
|
|
19657
|
+
var getCanonicalQuery = ({ query: query2 = {} }) => {
|
|
17845
19658
|
const keys = [];
|
|
17846
19659
|
const serialized = {};
|
|
17847
|
-
for (const key of Object.keys(
|
|
19660
|
+
for (const key of Object.keys(query2)) {
|
|
17848
19661
|
if (key.toLowerCase() === SIGNATURE_HEADER) {
|
|
17849
19662
|
continue;
|
|
17850
19663
|
}
|
|
17851
19664
|
const encodedKey = escapeUri(key);
|
|
17852
19665
|
keys.push(encodedKey);
|
|
17853
|
-
const value =
|
|
19666
|
+
const value = query2[key];
|
|
17854
19667
|
if (typeof value === "string") {
|
|
17855
19668
|
serialized[encodedKey] = `${encodedKey}=${escapeUri(value)}`;
|
|
17856
19669
|
} else if (Array.isArray(value)) {
|
|
@@ -19956,8 +21769,8 @@ var escapeUserAgent = (userAgentPair) => {
|
|
|
19956
21769
|
if (prefix === "api") {
|
|
19957
21770
|
uaName = uaName.toLowerCase();
|
|
19958
21771
|
}
|
|
19959
|
-
return [prefix, uaName, version].filter((item) => item && item.length > 0).reduce((acc, item,
|
|
19960
|
-
switch (
|
|
21772
|
+
return [prefix, uaName, version].filter((item) => item && item.length > 0).reduce((acc, item, index) => {
|
|
21773
|
+
switch (index) {
|
|
19961
21774
|
case 0:
|
|
19962
21775
|
return item;
|
|
19963
21776
|
case 1:
|
|
@@ -21078,11 +22891,11 @@ var Sha2563 = (
|
|
|
21078
22891
|
|
|
21079
22892
|
// node_modules/@aws-sdk/util-user-agent-browser/dist-es/index.js
|
|
21080
22893
|
var createDefaultUserAgentProvider = ({ serviceId, clientVersion }) => async (config) => {
|
|
21081
|
-
const
|
|
21082
|
-
const uaString =
|
|
21083
|
-
const osName =
|
|
22894
|
+
const navigator2 = typeof window !== "undefined" ? window.navigator : void 0;
|
|
22895
|
+
const uaString = navigator2?.userAgent ?? "";
|
|
22896
|
+
const osName = navigator2?.userAgentData?.platform ?? fallback.os(uaString) ?? "other";
|
|
21084
22897
|
const osVersion = void 0;
|
|
21085
|
-
const brands =
|
|
22898
|
+
const brands = navigator2?.userAgentData?.brands ?? [];
|
|
21086
22899
|
const brand = brands[brands.length - 1];
|
|
21087
22900
|
const browserName = brand?.brand ?? fallback.browser(uaString) ?? "unknown";
|
|
21088
22901
|
const browserVersion = brand?.version ?? "unknown";
|
|
@@ -22024,7 +23837,7 @@ var invalidProvider = (message) => () => Promise.reject(message);
|
|
|
22024
23837
|
var DEFAULTS_MODE_OPTIONS = ["in-region", "cross-region", "mobile", "standard", "legacy"];
|
|
22025
23838
|
|
|
22026
23839
|
// node_modules/@smithy/util-defaults-mode-browser/dist-es/resolveDefaultsModeConfig.js
|
|
22027
|
-
var resolveDefaultsModeConfig = ({ defaultsMode } = {}) =>
|
|
23840
|
+
var resolveDefaultsModeConfig = ({ defaultsMode } = {}) => memoize(async () => {
|
|
22028
23841
|
const mode = typeof defaultsMode === "function" ? await defaultsMode() : defaultsMode;
|
|
22029
23842
|
switch (mode?.toLowerCase()) {
|
|
22030
23843
|
case "auto":
|
|
@@ -22042,15 +23855,15 @@ var resolveDefaultsModeConfig = ({ defaultsMode } = {}) => memoize2(async () =>
|
|
|
22042
23855
|
}
|
|
22043
23856
|
});
|
|
22044
23857
|
var useMobileConfiguration = () => {
|
|
22045
|
-
const
|
|
22046
|
-
if (
|
|
22047
|
-
const { effectiveType, rtt, downlink } =
|
|
23858
|
+
const navigator2 = window?.navigator;
|
|
23859
|
+
if (navigator2?.connection) {
|
|
23860
|
+
const { effectiveType, rtt, downlink } = navigator2?.connection;
|
|
22048
23861
|
const slow = typeof effectiveType === "string" && effectiveType !== "4g" || Number(rtt) > 100 || Number(downlink) < 10;
|
|
22049
23862
|
if (slow) {
|
|
22050
23863
|
return true;
|
|
22051
23864
|
}
|
|
22052
23865
|
}
|
|
22053
|
-
return
|
|
23866
|
+
return navigator2?.userAgentData?.mobile || typeof navigator2?.maxTouchPoints === "number" && navigator2?.maxTouchPoints > 1;
|
|
22054
23867
|
};
|
|
22055
23868
|
|
|
22056
23869
|
// node_modules/@aws-sdk/client-cloudwatch-logs/dist-es/runtimeConfig.shared.js
|
|
@@ -22078,10 +23891,10 @@ var n = {};
|
|
|
22078
23891
|
var o = { [x]: "Region" };
|
|
22079
23892
|
var p = { [v]: "getAttr", [w]: [{ [x]: g }, "supportsFIPS"] };
|
|
22080
23893
|
var q = { [v]: c2, [w]: [true, { [v]: "getAttr", [w]: [{ [x]: g }, "supportsDualStack"] }] };
|
|
22081
|
-
var
|
|
23894
|
+
var r2 = [l];
|
|
22082
23895
|
var s = [m];
|
|
22083
23896
|
var t = [o];
|
|
22084
|
-
var _data = { version: "1.0", parameters: { Region: i, UseDualStack: j, UseFIPS: j, Endpoint: i }, rules: [{ conditions: [{ [v]: b2, [w]: [k] }], rules: [{ conditions:
|
|
23897
|
+
var _data = { version: "1.0", parameters: { Region: i, UseDualStack: j, UseFIPS: j, Endpoint: i }, rules: [{ conditions: [{ [v]: b2, [w]: [k] }], rules: [{ conditions: r2, error: "Invalid Configuration: FIPS and custom endpoint are not supported", type: d }, { conditions: s, error: "Invalid Configuration: Dualstack and custom endpoint are not supported", type: d }, { endpoint: { url: k, properties: n, headers: n }, type: e }], type: f }, { conditions: [{ [v]: b2, [w]: t }], rules: [{ conditions: [{ [v]: "aws.partition", [w]: t, assign: g }], rules: [{ conditions: [l, m], rules: [{ conditions: [{ [v]: c2, [w]: [a2, p] }, q], rules: [{ endpoint: { url: "https://logs-fips.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: n, headers: n }, type: e }], type: f }, { error: "FIPS and DualStack are enabled, but this partition does not support one or both", type: d }], type: f }, { conditions: r2, rules: [{ conditions: [{ [v]: c2, [w]: [p, a2] }], rules: [{ conditions: [{ [v]: h, [w]: [o, "us-gov-east-1"] }], endpoint: { url: "https://logs.us-gov-east-1.amazonaws.com", properties: n, headers: n }, type: e }, { conditions: [{ [v]: h, [w]: [o, "us-gov-west-1"] }], endpoint: { url: "https://logs.us-gov-west-1.amazonaws.com", properties: n, headers: n }, type: e }, { endpoint: { url: "https://logs-fips.{Region}.{PartitionResult#dnsSuffix}", properties: n, headers: n }, type: e }], type: f }, { error: "FIPS is enabled but this partition does not support FIPS", type: d }], type: f }, { conditions: s, rules: [{ conditions: [q], rules: [{ endpoint: { url: "https://logs.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: n, headers: n }, type: e }], type: f }, { error: "DualStack is enabled but this partition does not support DualStack", type: d }], type: f }, { endpoint: { url: "https://logs.{Region}.{PartitionResult#dnsSuffix}", properties: n, headers: n }, type: e }], type: f }], type: f }, { error: "Invalid Configuration: Missing Region", type: d }] };
|
|
22085
23898
|
var ruleSet = _data;
|
|
22086
23899
|
|
|
22087
23900
|
// node_modules/@aws-sdk/client-cloudwatch-logs/dist-es/endpoint/endpointResolver.js
|
|
@@ -24146,11 +25959,11 @@ var getHttpAuthExtensionConfiguration = (runtimeConfig) => {
|
|
|
24146
25959
|
let _credentials = runtimeConfig.credentials;
|
|
24147
25960
|
return {
|
|
24148
25961
|
setHttpAuthScheme(httpAuthScheme) {
|
|
24149
|
-
const
|
|
24150
|
-
if (
|
|
25962
|
+
const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId);
|
|
25963
|
+
if (index === -1) {
|
|
24151
25964
|
_httpAuthSchemes.push(httpAuthScheme);
|
|
24152
25965
|
} else {
|
|
24153
|
-
_httpAuthSchemes.splice(
|
|
25966
|
+
_httpAuthSchemes.splice(index, 1, httpAuthScheme);
|
|
24154
25967
|
}
|
|
24155
25968
|
},
|
|
24156
25969
|
httpAuthSchemes() {
|
|
@@ -24246,17 +26059,17 @@ var QueryStatus = {
|
|
|
24246
26059
|
};
|
|
24247
26060
|
|
|
24248
26061
|
// src/components/event-details/lambda-invoke-logs-section.tsx
|
|
24249
|
-
import { Box as
|
|
24250
|
-
import { useEffect as
|
|
24251
|
-
import { jsx as
|
|
26062
|
+
import { Box as Box11, CircularProgress as CircularProgress2, Stack, Typography as Typography7 } from "@mui/material";
|
|
26063
|
+
import { useEffect as useEffect17, useMemo as useMemo10, useRef as useRef13, useState as useState11 } from "react";
|
|
26064
|
+
import { jsx as jsx134, jsxs as jsxs127 } from "react/jsx-runtime";
|
|
24252
26065
|
var POLL_INTERVAL_MS = 1e3;
|
|
24253
26066
|
async function pollQueryResults(client, queryId) {
|
|
24254
26067
|
return client.send(new GetQueryResultsCommand({ queryId }));
|
|
24255
26068
|
}
|
|
24256
|
-
async function startLambdaLogsQuery(client,
|
|
26069
|
+
async function startLambdaLogsQuery(client, functionName2, requestId, startTimeSec, endTimeSec) {
|
|
24257
26070
|
const response = await client.send(new StartQueryCommand({
|
|
24258
26071
|
endTime: endTimeSec,
|
|
24259
|
-
logGroupName: `/aws/lambda/${
|
|
26072
|
+
logGroupName: `/aws/lambda/${functionName2}`,
|
|
24260
26073
|
queryString: `fields @timestamp, @message | filter @requestId = "${requestId}" | sort @timestamp asc`,
|
|
24261
26074
|
startTime: startTimeSec
|
|
24262
26075
|
}));
|
|
@@ -24265,7 +26078,7 @@ async function startLambdaLogsQuery(client, functionName, requestId, startTimeSe
|
|
|
24265
26078
|
}
|
|
24266
26079
|
function useCloudWatchLogsClient(region) {
|
|
24267
26080
|
const { localstackEndpoint } = useAppInspector();
|
|
24268
|
-
const client =
|
|
26081
|
+
const client = useMemo10(() => new CloudWatchLogsClient({
|
|
24269
26082
|
credentials: {
|
|
24270
26083
|
accessKeyId: "test",
|
|
24271
26084
|
secretAccessKey: "test"
|
|
@@ -24275,19 +26088,19 @@ function useCloudWatchLogsClient(region) {
|
|
|
24275
26088
|
}), [region, localstackEndpoint]);
|
|
24276
26089
|
return client;
|
|
24277
26090
|
}
|
|
24278
|
-
function useLambdaInvokeLogs(
|
|
26091
|
+
function useLambdaInvokeLogs(functionName2, requestId, region, startTimeNano, endTimeNano) {
|
|
24279
26092
|
const [loading, setLoading] = useState11(true);
|
|
24280
26093
|
const [logs, setLogs] = useState11([]);
|
|
24281
26094
|
const [error, setError] = useState11();
|
|
24282
|
-
const pollTimerRef =
|
|
26095
|
+
const pollTimerRef = useRef13(null);
|
|
24283
26096
|
const cloudWatchLogs = useCloudWatchLogsClient(region);
|
|
24284
|
-
|
|
26097
|
+
useEffect17(() => {
|
|
24285
26098
|
let cancelled = false;
|
|
24286
26099
|
const startTimeSec = Math.floor(Number(BigInt(startTimeNano) / BigInt(1e9)));
|
|
24287
26100
|
const endTimeSec = Math.ceil(Number(BigInt(endTimeNano) / BigInt(1e9)));
|
|
24288
26101
|
async function run() {
|
|
24289
26102
|
try {
|
|
24290
|
-
const queryId = await startLambdaLogsQuery(cloudWatchLogs,
|
|
26103
|
+
const queryId = await startLambdaLogsQuery(cloudWatchLogs, functionName2, requestId, startTimeSec - 60, endTimeSec + 60);
|
|
24291
26104
|
const poll = async () => {
|
|
24292
26105
|
if (cancelled) return;
|
|
24293
26106
|
try {
|
|
@@ -24332,42 +26145,85 @@ function useLambdaInvokeLogs(functionName, requestId, region, startTimeNano, end
|
|
|
24332
26145
|
cancelled = true;
|
|
24333
26146
|
if (pollTimerRef.current !== null) clearTimeout(pollTimerRef.current);
|
|
24334
26147
|
};
|
|
24335
|
-
}, [
|
|
26148
|
+
}, [functionName2, requestId, region, startTimeNano, endTimeNano]);
|
|
24336
26149
|
return { error, loading, logs };
|
|
24337
26150
|
}
|
|
24338
|
-
var LambdaInvokeLogsSection = ({ endTimeNano, functionName, region, requestId, startTimeNano }) => {
|
|
24339
|
-
const { error, loading, logs } = useLambdaInvokeLogs(
|
|
26151
|
+
var LambdaInvokeLogsSection = ({ endTimeNano, functionName: functionName2, region, requestId, startTimeNano }) => {
|
|
26152
|
+
const { error, loading, logs } = useLambdaInvokeLogs(functionName2, requestId, region, startTimeNano, endTimeNano);
|
|
24340
26153
|
if (loading) {
|
|
24341
|
-
return /* @__PURE__ */
|
|
24342
|
-
/* @__PURE__ */
|
|
24343
|
-
/* @__PURE__ */
|
|
26154
|
+
return /* @__PURE__ */ jsxs127(Stack, { alignItems: "center", direction: "row", spacing: 1, children: [
|
|
26155
|
+
/* @__PURE__ */ jsx134(CircularProgress2, { size: 14 }),
|
|
26156
|
+
/* @__PURE__ */ jsx134(Typography7, { color: "text.secondary", variant: "body2", children: "Loading logs\u2026" })
|
|
24344
26157
|
] });
|
|
24345
26158
|
}
|
|
24346
26159
|
if (error !== void 0) {
|
|
24347
|
-
return /* @__PURE__ */
|
|
26160
|
+
return /* @__PURE__ */ jsx134(Typography7, { color: "error", variant: "body2", children: error.message });
|
|
24348
26161
|
}
|
|
24349
26162
|
if (logs.length === 0) {
|
|
24350
|
-
return /* @__PURE__ */
|
|
26163
|
+
return /* @__PURE__ */ jsx134(Typography7, { color: "text.secondary", variant: "body2", children: "No logs found for this invocation." });
|
|
24351
26164
|
}
|
|
24352
|
-
return /* @__PURE__ */
|
|
26165
|
+
return /* @__PURE__ */ jsx134(Box11, { sx: { backgroundColor: (theme) => theme.palette.background.default, borderRadius: 1, p: 1 }, children: /* @__PURE__ */ jsx134("pre", { style: { margin: 0, overflow: "auto" }, children: logs.map((log) => /* @__PURE__ */ jsx134(Typography7, { variant: "body2", children: `[${log.timestamp}] ${log.message}` }, log.ptr)) }) });
|
|
24353
26166
|
};
|
|
24354
26167
|
|
|
24355
|
-
// src/components/event-details/
|
|
24356
|
-
import {
|
|
24357
|
-
|
|
24358
|
-
|
|
24359
|
-
|
|
24360
|
-
|
|
24361
|
-
|
|
24362
|
-
|
|
24363
|
-
|
|
24364
|
-
|
|
24365
|
-
|
|
24366
|
-
|
|
24367
|
-
|
|
24368
|
-
|
|
24369
|
-
|
|
26168
|
+
// src/components/event-details/toggle-section.tsx
|
|
26169
|
+
import { KeyboardArrowDown as KeyboardArrowDown3, KeyboardArrowRight as KeyboardArrowRight3 } from "@mui/icons-material";
|
|
26170
|
+
import { Box as Box12, Typography as Typography8 } from "@mui/material";
|
|
26171
|
+
import { useState as useState12 } from "react";
|
|
26172
|
+
import { jsx as jsx135, jsxs as jsxs128 } from "react/jsx-runtime";
|
|
26173
|
+
var ToggleSection = ({ action, children, headline, initialOpen = true }) => {
|
|
26174
|
+
const [isOpen, setIsOpen] = useState12(initialOpen);
|
|
26175
|
+
return /* @__PURE__ */ jsxs128(Box12, { sx: { mt: 4 }, children: [
|
|
26176
|
+
/* @__PURE__ */ jsxs128(
|
|
26177
|
+
Box12,
|
|
26178
|
+
{
|
|
26179
|
+
onClick: () => {
|
|
26180
|
+
setIsOpen(!isOpen);
|
|
26181
|
+
},
|
|
26182
|
+
sx: {
|
|
26183
|
+
alignItems: "center",
|
|
26184
|
+
cursor: "pointer",
|
|
26185
|
+
display: "flex",
|
|
26186
|
+
justifyContent: "space-between",
|
|
26187
|
+
mb: 1
|
|
26188
|
+
},
|
|
26189
|
+
children: [
|
|
26190
|
+
/* @__PURE__ */ jsxs128(
|
|
26191
|
+
Box12,
|
|
26192
|
+
{
|
|
26193
|
+
role: "button",
|
|
26194
|
+
sx: {
|
|
26195
|
+
alignItems: "center",
|
|
26196
|
+
display: "flex",
|
|
26197
|
+
gap: 1
|
|
26198
|
+
},
|
|
26199
|
+
children: [
|
|
26200
|
+
/* @__PURE__ */ jsx135(Typography8, { sx: { fontWeight: 600 }, variant: "subtitle2", children: headline }),
|
|
26201
|
+
isOpen ? /* @__PURE__ */ jsx135(KeyboardArrowDown3, { sx: { color: "text.secondary", height: 20, width: 20 } }) : /* @__PURE__ */ jsx135(KeyboardArrowRight3, { sx: { color: "text.secondary", height: 20, width: 20 } })
|
|
26202
|
+
]
|
|
26203
|
+
}
|
|
26204
|
+
),
|
|
26205
|
+
action !== false && /* @__PURE__ */ jsx135(Box12, { onClick: (event) => {
|
|
26206
|
+
event.stopPropagation();
|
|
26207
|
+
}, children: action })
|
|
26208
|
+
]
|
|
26209
|
+
}
|
|
26210
|
+
),
|
|
26211
|
+
isOpen && /* @__PURE__ */ jsx135(Box12, { children })
|
|
26212
|
+
] });
|
|
24370
26213
|
};
|
|
26214
|
+
|
|
26215
|
+
// src/components/event-details/event-details.tsx
|
|
26216
|
+
import { Fragment as Fragment7, jsx as jsx136, jsxs as jsxs129 } from "react/jsx-runtime";
|
|
26217
|
+
function tryParseJson(value) {
|
|
26218
|
+
if (typeof value !== "string") {
|
|
26219
|
+
return value;
|
|
26220
|
+
}
|
|
26221
|
+
try {
|
|
26222
|
+
return JSON.parse(value);
|
|
26223
|
+
} catch {
|
|
26224
|
+
return value;
|
|
26225
|
+
}
|
|
26226
|
+
}
|
|
24371
26227
|
var checkIsLambdaInvoke = (span) => {
|
|
24372
26228
|
if (span.service_name !== "lambda") {
|
|
24373
26229
|
return false;
|
|
@@ -24375,97 +26231,157 @@ var checkIsLambdaInvoke = (span) => {
|
|
|
24375
26231
|
const operationName = span.operation_name.toLowerCase();
|
|
24376
26232
|
return operationName === "invoke" || operationName === "invokewithresponsestream" || operationName === "invokeasync";
|
|
24377
26233
|
};
|
|
26234
|
+
var checkIsSqsSendMessage = (span) => {
|
|
26235
|
+
if (span.service_name !== "sqs") {
|
|
26236
|
+
return false;
|
|
26237
|
+
}
|
|
26238
|
+
return span.operation_name.startsWith("SendMessage");
|
|
26239
|
+
};
|
|
24378
26240
|
var EventDetails = ({ onClose, selectedEvent }) => {
|
|
24379
|
-
const
|
|
24380
|
-
|
|
24381
|
-
|
|
24382
|
-
|
|
24383
|
-
const
|
|
24384
|
-
const resourceArn = typeof selectedEvent?.attributes?.["localstack.aws.resource_arn"] === "string" ? selectedEvent.attributes["localstack.aws.resource_arn"] : void 0;
|
|
26241
|
+
const eventGroups = useMemo11(
|
|
26242
|
+
() => getEventGroupsByType(selectedEvent?.events ?? []),
|
|
26243
|
+
[selectedEvent?.events]
|
|
26244
|
+
);
|
|
26245
|
+
const [parseNestedJson, setParseNestedJson] = useState13(true);
|
|
24385
26246
|
if (!selectedEvent) {
|
|
24386
|
-
return /* @__PURE__ */
|
|
26247
|
+
return /* @__PURE__ */ jsx136(Box13, { sx: { p: 3, textAlign: "center" }, children: /* @__PURE__ */ jsx136(Typography9, { color: "text.secondary", variant: "body2", children: "Select an event to view details" }) });
|
|
24387
26248
|
}
|
|
24388
26249
|
const isLambdaInvoke = checkIsLambdaInvoke(selectedEvent);
|
|
24389
|
-
|
|
24390
|
-
|
|
24391
|
-
|
|
24392
|
-
|
|
24393
|
-
|
|
24394
|
-
|
|
24395
|
-
|
|
24396
|
-
|
|
24397
|
-
|
|
24398
|
-
|
|
24399
|
-
|
|
24400
|
-
|
|
24401
|
-
|
|
24402
|
-
|
|
24403
|
-
|
|
24404
|
-
|
|
24405
|
-
|
|
24406
|
-
|
|
24407
|
-
|
|
24408
|
-
|
|
24409
|
-
|
|
24410
|
-
|
|
24411
|
-
|
|
24412
|
-
|
|
24413
|
-
|
|
24414
|
-
|
|
26250
|
+
const isSqsSendMessage = checkIsSqsSendMessage(selectedEvent);
|
|
26251
|
+
const requestId = typeof selectedEvent.attributes?.["localstack.request_id"] === "string" ? selectedEvent.attributes["localstack.request_id"] : void 0;
|
|
26252
|
+
const resourceArn = typeof selectedEvent.attributes?.["localstack.aws.resource_arn"] === "string" ? selectedEvent.attributes["localstack.aws.resource_arn"] : void 0;
|
|
26253
|
+
const requestPayload = tryParseJson(selectedEvent.attributes?.["localstack.aws.service.request"]);
|
|
26254
|
+
if (parseNestedJson) {
|
|
26255
|
+
if (isLambdaInvoke && requestPayload && typeof requestPayload === "object" && "Payload" in requestPayload) {
|
|
26256
|
+
requestPayload.Payload = tryParseJson(requestPayload.Payload);
|
|
26257
|
+
} else if (isSqsSendMessage && requestPayload && typeof requestPayload === "object" && "MessageBody" in requestPayload) {
|
|
26258
|
+
requestPayload.MessageBody = tryParseJson(requestPayload.MessageBody);
|
|
26259
|
+
}
|
|
26260
|
+
}
|
|
26261
|
+
const responsePayload = tryParseJson(selectedEvent.attributes?.["localstack.aws.service.response"]);
|
|
26262
|
+
if (parseNestedJson && isLambdaInvoke && responsePayload && typeof responsePayload === "object" && "Payload" in responsePayload) {
|
|
26263
|
+
responsePayload.Payload = tryParseJson(responsePayload.Payload);
|
|
26264
|
+
}
|
|
26265
|
+
const exceptionPayload = tryParseJson(selectedEvent.attributes?.["localstack.aws.service.exception"]);
|
|
26266
|
+
const hasPayloads = requestPayload !== void 0 || responsePayload !== void 0 || exceptionPayload !== void 0;
|
|
26267
|
+
const duration = selectedEvent.end_time_unix_nano ? ((BigInt(selectedEvent.end_time_unix_nano) - BigInt(selectedEvent.start_time_unix_nano)) / BigInt("1000000")).toString() : void 0;
|
|
26268
|
+
return /* @__PURE__ */ jsxs129(Box13, { "data-testid": "event-details", sx: { display: "flex", flexDirection: "column", height: "100%" }, children: [
|
|
26269
|
+
/* @__PURE__ */ jsxs129(
|
|
26270
|
+
Box13,
|
|
26271
|
+
{
|
|
26272
|
+
sx: {
|
|
26273
|
+
alignItems: "center",
|
|
26274
|
+
borderBottom: "1px solid",
|
|
26275
|
+
borderColor: "divider",
|
|
26276
|
+
display: "flex",
|
|
26277
|
+
justifyContent: "space-between",
|
|
26278
|
+
px: 2,
|
|
26279
|
+
py: 1
|
|
26280
|
+
},
|
|
26281
|
+
children: [
|
|
26282
|
+
/* @__PURE__ */ jsx136(Box13, { children: /* @__PURE__ */ jsx136(Typography9, { sx: { fontWeight: 600 }, variant: "h6", children: "Operation Details" }) }),
|
|
26283
|
+
onClose && /* @__PURE__ */ jsx136(IconButton3, { onClick: onClose, size: "small", children: /* @__PURE__ */ jsx136(Close2, {}) })
|
|
26284
|
+
]
|
|
26285
|
+
}
|
|
26286
|
+
),
|
|
26287
|
+
/* @__PURE__ */ jsx136(Box13, { sx: { flexGrow: 1, overflow: "auto", p: 2 }, children: /* @__PURE__ */ jsxs129(Stack2, { spacing: 2, children: [
|
|
26288
|
+
/* @__PURE__ */ jsx136(ToggleSection, { headline: "Basic Information", children: /* @__PURE__ */ jsxs129(Stack2, { spacing: 1, children: [
|
|
26289
|
+
/* @__PURE__ */ jsxs129(Box13, { sx: { display: "grid", gap: 2, gridTemplateColumns: "1.3fr 1fr" }, children: [
|
|
26290
|
+
/* @__PURE__ */ jsxs129(Box13, { children: [
|
|
26291
|
+
/* @__PURE__ */ jsx136(Typography9, { sx: { fontWeight: 600 }, variant: "caption", children: "Service" }),
|
|
26292
|
+
/* @__PURE__ */ jsx136(Typography9, { variant: "body2", children: selectedEvent.service_name })
|
|
26293
|
+
] }),
|
|
26294
|
+
/* @__PURE__ */ jsxs129(Box13, { children: [
|
|
26295
|
+
/* @__PURE__ */ jsx136(Typography9, { sx: { fontWeight: 600 }, variant: "caption", children: "Operation" }),
|
|
26296
|
+
/* @__PURE__ */ jsx136(Typography9, { variant: "body2", children: selectedEvent.operation_name })
|
|
26297
|
+
] })
|
|
24415
26298
|
] }),
|
|
24416
|
-
/* @__PURE__ */
|
|
24417
|
-
/* @__PURE__ */
|
|
24418
|
-
/* @__PURE__ */
|
|
26299
|
+
/* @__PURE__ */ jsxs129(Box13, { children: [
|
|
26300
|
+
/* @__PURE__ */ jsx136(Typography9, { sx: { fontWeight: 600 }, variant: "caption", children: "Resource" }),
|
|
26301
|
+
/* @__PURE__ */ jsx136(Typography9, { variant: "body2", children: selectedEvent.resource_name })
|
|
24419
26302
|
] }),
|
|
24420
|
-
Boolean(
|
|
24421
|
-
/* @__PURE__ */
|
|
24422
|
-
/* @__PURE__ */
|
|
26303
|
+
Boolean(resourceArn) && /* @__PURE__ */ jsxs129(Box13, { children: [
|
|
26304
|
+
/* @__PURE__ */ jsx136(Typography9, { sx: { fontWeight: 600 }, variant: "caption", children: "Resource ARN" }),
|
|
26305
|
+
/* @__PURE__ */ jsx136(Typography9, { variant: "body2", children: resourceArn })
|
|
24423
26306
|
] }),
|
|
24424
|
-
|
|
24425
|
-
/* @__PURE__ */
|
|
24426
|
-
|
|
24427
|
-
|
|
24428
|
-
|
|
24429
|
-
|
|
24430
|
-
|
|
24431
|
-
|
|
24432
|
-
|
|
24433
|
-
/* @__PURE__ */ jsx137(Typography10, { variant: "body2", children: unixNanoToDate(selectedEvent.start_time_unix_nano)?.toISOString() })
|
|
26307
|
+
/* @__PURE__ */ jsxs129(Box13, { sx: { display: "grid", gap: 1, gridTemplateColumns: "1.3fr 1fr" }, children: [
|
|
26308
|
+
/* @__PURE__ */ jsxs129(Box13, { children: [
|
|
26309
|
+
/* @__PURE__ */ jsx136(Typography9, { sx: { fontWeight: 600 }, variant: "caption", children: "Account" }),
|
|
26310
|
+
/* @__PURE__ */ jsx136(Typography9, { variant: "body2", children: selectedEvent.account_id })
|
|
26311
|
+
] }),
|
|
26312
|
+
/* @__PURE__ */ jsxs129(Box13, { children: [
|
|
26313
|
+
/* @__PURE__ */ jsx136(Typography9, { sx: { fontWeight: 600 }, variant: "caption", children: "Region" }),
|
|
26314
|
+
/* @__PURE__ */ jsx136(Typography9, { variant: "body2", children: selectedEvent.region })
|
|
26315
|
+
] })
|
|
24434
26316
|
] }),
|
|
24435
|
-
|
|
24436
|
-
/* @__PURE__ */
|
|
24437
|
-
|
|
24438
|
-
(
|
|
24439
|
-
|
|
24440
|
-
|
|
26317
|
+
/* @__PURE__ */ jsxs129(Box13, { sx: { display: "grid", gap: 1, gridTemplateColumns: duration === void 0 ? "1fr" : "1.3fr 1fr" }, children: [
|
|
26318
|
+
/* @__PURE__ */ jsxs129(Box13, { children: [
|
|
26319
|
+
/* @__PURE__ */ jsx136(Typography9, { sx: { fontWeight: 600 }, variant: "caption", children: "Start Time" }),
|
|
26320
|
+
/* @__PURE__ */ jsx136(Typography9, { variant: "body2", children: unixNanoToDate(selectedEvent.start_time_unix_nano)?.toISOString() })
|
|
26321
|
+
] }),
|
|
26322
|
+
duration !== void 0 && /* @__PURE__ */ jsxs129(Box13, { children: [
|
|
26323
|
+
/* @__PURE__ */ jsx136(Typography9, { sx: { fontWeight: 600 }, variant: "caption", children: "Duration" }),
|
|
26324
|
+
/* @__PURE__ */ jsxs129(Typography9, { variant: "body2", children: [
|
|
26325
|
+
duration,
|
|
26326
|
+
"ms"
|
|
26327
|
+
] })
|
|
24441
26328
|
] })
|
|
26329
|
+
] }),
|
|
26330
|
+
/* @__PURE__ */ jsxs129(Box13, { children: [
|
|
26331
|
+
/* @__PURE__ */ jsx136(Typography9, { sx: { fontWeight: 600 }, variant: "caption", children: "Status" }),
|
|
26332
|
+
/* @__PURE__ */ jsx136(Stack2, { alignItems: "center", direction: "row", flexWrap: "wrap", gap: 1, sx: { mb: eventGroups.errors || eventGroups.warnings ? 1 : 0 }, children: /* @__PURE__ */ jsx136(
|
|
26333
|
+
Chip3,
|
|
26334
|
+
{
|
|
26335
|
+
color: selectedEvent.status_code === 2 ? "error" : selectedEvent.status_code === 1 ? "success" : "default",
|
|
26336
|
+
label: selectedEvent.status_code === 2 ? "Error" : selectedEvent.status_code === 1 ? "OK" : "Unset",
|
|
26337
|
+
size: "small"
|
|
26338
|
+
}
|
|
26339
|
+
) })
|
|
24442
26340
|
] })
|
|
24443
26341
|
] }) }),
|
|
24444
|
-
/* @__PURE__ */
|
|
24445
|
-
/* @__PURE__ */
|
|
24446
|
-
/* @__PURE__ */
|
|
24447
|
-
|
|
24448
|
-
|
|
24449
|
-
|
|
24450
|
-
|
|
24451
|
-
|
|
24452
|
-
|
|
24453
|
-
|
|
24454
|
-
|
|
24455
|
-
] }) }),
|
|
24456
|
-
selectedEvent.events.length > 0 && /* @__PURE__ */ jsxs130(Fragment6, { children: [
|
|
24457
|
-
/* @__PURE__ */ jsx137(Divider2, {}),
|
|
24458
|
-
/* @__PURE__ */ jsx137(
|
|
24459
|
-
EventSection,
|
|
26342
|
+
/* @__PURE__ */ jsx136(Divider2, {}),
|
|
26343
|
+
/* @__PURE__ */ jsxs129(ToggleSection, { headline: "Permissions", children: [
|
|
26344
|
+
!eventGroups.permissions && !eventGroups.errors && !eventGroups.warnings && /* @__PURE__ */ jsx136(Typography9, { color: "text.secondary", variant: "body2", children: "There is no permission information available. Are IAM Policy Streams enabled?" }),
|
|
26345
|
+
eventGroups.permissions && /* @__PURE__ */ jsx136(EventDetail, { displayText: "Permissions", events: eventGroups.permissions, type: "permission" }),
|
|
26346
|
+
eventGroups.errors && /* @__PURE__ */ jsx136(EventDetail, { displayText: "Error", events: eventGroups.errors, type: "error" }),
|
|
26347
|
+
eventGroups.warnings && /* @__PURE__ */ jsx136(EventDetail, { displayText: "Warning", events: eventGroups.warnings, type: "warning" })
|
|
26348
|
+
] }),
|
|
26349
|
+
hasPayloads && /* @__PURE__ */ jsxs129(Fragment7, { children: [
|
|
26350
|
+
/* @__PURE__ */ jsx136(Divider2, {}),
|
|
26351
|
+
/* @__PURE__ */ jsx136(
|
|
26352
|
+
ToggleSection,
|
|
24460
26353
|
{
|
|
24461
|
-
|
|
24462
|
-
|
|
26354
|
+
action: /* @__PURE__ */ jsx136(
|
|
26355
|
+
FormControlLabel2,
|
|
26356
|
+
{
|
|
26357
|
+
control: /* @__PURE__ */ jsx136(Switch, { checked: !parseNestedJson, onChange: (event) => {
|
|
26358
|
+
setParseNestedJson(!event.target.checked);
|
|
26359
|
+
}, size: "small" }),
|
|
26360
|
+
label: /* @__PURE__ */ jsx136(Typography9, { variant: "caption", children: "View raw data" }),
|
|
26361
|
+
sx: { mr: 0 }
|
|
26362
|
+
}
|
|
26363
|
+
),
|
|
26364
|
+
headline: "Payloads",
|
|
26365
|
+
children: /* @__PURE__ */ jsxs129(Stack2, { spacing: 2, children: [
|
|
26366
|
+
requestPayload !== void 0 && /* @__PURE__ */ jsxs129(Box13, { children: [
|
|
26367
|
+
/* @__PURE__ */ jsx136(Typography9, { sx: { fontWeight: 600 }, variant: "caption", children: "Request" }),
|
|
26368
|
+
/* @__PURE__ */ jsx136(PayloadViewer, { value: requestPayload })
|
|
26369
|
+
] }),
|
|
26370
|
+
responsePayload !== void 0 && /* @__PURE__ */ jsxs129(Box13, { children: [
|
|
26371
|
+
/* @__PURE__ */ jsx136(Typography9, { sx: { fontWeight: 600 }, variant: "caption", children: "Response" }),
|
|
26372
|
+
/* @__PURE__ */ jsx136(PayloadViewer, { value: responsePayload })
|
|
26373
|
+
] }),
|
|
26374
|
+
exceptionPayload !== void 0 && /* @__PURE__ */ jsxs129(Box13, { children: [
|
|
26375
|
+
/* @__PURE__ */ jsx136(Typography9, { sx: { fontWeight: 600 }, variant: "caption", children: "Exception" }),
|
|
26376
|
+
/* @__PURE__ */ jsx136(PayloadViewer, { value: exceptionPayload })
|
|
26377
|
+
] })
|
|
26378
|
+
] })
|
|
24463
26379
|
}
|
|
24464
26380
|
)
|
|
24465
26381
|
] }),
|
|
24466
|
-
isLambdaInvoke && requestId !== void 0 && /* @__PURE__ */
|
|
24467
|
-
/* @__PURE__ */
|
|
24468
|
-
/* @__PURE__ */
|
|
26382
|
+
isLambdaInvoke && requestId !== void 0 && /* @__PURE__ */ jsxs129(Fragment7, { children: [
|
|
26383
|
+
/* @__PURE__ */ jsx136(Divider2, {}),
|
|
26384
|
+
/* @__PURE__ */ jsx136(ToggleSection, { headline: "Lambda Logs", children: /* @__PURE__ */ jsx136(
|
|
24469
26385
|
LambdaInvokeLogsSection,
|
|
24470
26386
|
{
|
|
24471
26387
|
endTimeNano: selectedEvent.end_time_unix_nano ?? selectedEvent.start_time_unix_nano,
|
|
@@ -24476,58 +26392,72 @@ var EventDetails = ({ onClose, selectedEvent }) => {
|
|
|
24476
26392
|
}
|
|
24477
26393
|
) })
|
|
24478
26394
|
] }),
|
|
24479
|
-
|
|
24480
|
-
|
|
24481
|
-
/* @__PURE__ */
|
|
24482
|
-
/* @__PURE__ */
|
|
24483
|
-
|
|
24484
|
-
] },
|
|
24485
|
-
|
|
26395
|
+
/* @__PURE__ */ jsx136(Divider2, {}),
|
|
26396
|
+
/* @__PURE__ */ jsx136(ToggleSection, { headline: "Advanced Information", initialOpen: false, children: /* @__PURE__ */ jsxs129(Stack2, { spacing: 1, children: [
|
|
26397
|
+
/* @__PURE__ */ jsxs129(Box13, { children: [
|
|
26398
|
+
/* @__PURE__ */ jsx136(Typography9, { sx: { fontWeight: 600 }, variant: "caption", children: "Span ID" }),
|
|
26399
|
+
/* @__PURE__ */ jsx136(Typography9, { variant: "body2", children: selectedEvent.span_id })
|
|
26400
|
+
] }),
|
|
26401
|
+
/* @__PURE__ */ jsxs129(Box13, { children: [
|
|
26402
|
+
/* @__PURE__ */ jsx136(Typography9, { sx: { fontWeight: 600 }, variant: "caption", children: "Trace ID" }),
|
|
26403
|
+
/* @__PURE__ */ jsx136(Typography9, { variant: "body2", children: selectedEvent.trace_id })
|
|
26404
|
+
] }),
|
|
26405
|
+
requestId !== void 0 && /* @__PURE__ */ jsxs129(Box13, { children: [
|
|
26406
|
+
/* @__PURE__ */ jsx136(Typography9, { sx: { fontWeight: 600 }, variant: "caption", children: "Request ID" }),
|
|
26407
|
+
/* @__PURE__ */ jsx136(Typography9, { variant: "body2", children: requestId })
|
|
26408
|
+
] }),
|
|
26409
|
+
eventGroups.info && /* @__PURE__ */ jsx136(EventDetail, { displayText: "Info", events: eventGroups.info, type: "info" })
|
|
26410
|
+
] }) })
|
|
24486
26411
|
] }) })
|
|
24487
26412
|
] });
|
|
24488
26413
|
};
|
|
24489
|
-
|
|
24490
|
-
|
|
24491
|
-
|
|
24492
|
-
|
|
24493
|
-
|
|
24494
|
-
|
|
24495
|
-
|
|
24496
|
-
|
|
24497
|
-
|
|
26414
|
+
var PayloadViewer = memo10(({ value }) => {
|
|
26415
|
+
const theme = useTheme3();
|
|
26416
|
+
return /* @__PURE__ */ jsx136(Box13, { sx: { backgroundColor: "background.default", borderRadius: 1, fontSize: 12, overflow: "auto", p: 1 }, children: /* @__PURE__ */ jsx136(
|
|
26417
|
+
JsonViewer,
|
|
26418
|
+
{
|
|
26419
|
+
displayDataTypes: false,
|
|
26420
|
+
displaySize: false,
|
|
26421
|
+
enableClipboard: false,
|
|
26422
|
+
rootName: false,
|
|
26423
|
+
theme: theme.palette.mode,
|
|
26424
|
+
value
|
|
26425
|
+
}
|
|
26426
|
+
) });
|
|
26427
|
+
});
|
|
24498
26428
|
|
|
24499
26429
|
// src/components/trace-graph/trace-graph.tsx
|
|
24500
26430
|
import "@xyflow/react/dist/base.css";
|
|
24501
|
-
import { Alert as Alert3, Button as Button4, useTheme as
|
|
26431
|
+
import { Alert as Alert3, Button as Button4, useTheme as useTheme4 } from "@mui/material";
|
|
24502
26432
|
import { Background, MarkerType, Position as Position2, ReactFlow, useEdgesState, useNodesState } from "@xyflow/react";
|
|
24503
|
-
import { useEffect as
|
|
26433
|
+
import { useEffect as useEffect18 } from "react";
|
|
24504
26434
|
|
|
24505
26435
|
// src/components/trace-graph/service-node.tsx
|
|
24506
|
-
import { Box as
|
|
26436
|
+
import { Box as Box15, Stack as Stack3, Typography as Typography10 } from "@mui/material";
|
|
24507
26437
|
import "@xyflow/react/dist/style.css";
|
|
24508
26438
|
import { Handle, Position } from "@xyflow/react";
|
|
24509
|
-
import { memo as
|
|
26439
|
+
import { memo as memo11 } from "react";
|
|
24510
26440
|
|
|
24511
26441
|
// src/components/trace-graph/problem-indicator.tsx
|
|
24512
26442
|
import { Error as ErrorIcon2, Info as Info2, Warning as Warning2 } from "@mui/icons-material";
|
|
24513
|
-
import { Box as
|
|
24514
|
-
import { useMemo as
|
|
24515
|
-
import { jsx as
|
|
26443
|
+
import { Box as Box14, Tooltip as Tooltip3 } from "@mui/material";
|
|
26444
|
+
import { useMemo as useMemo12 } from "react";
|
|
26445
|
+
import { jsx as jsx137 } from "react/jsx-runtime";
|
|
24516
26446
|
var ProblemIndicator = ({ error }) => {
|
|
24517
|
-
const icon =
|
|
26447
|
+
const icon = useMemo12(() => {
|
|
24518
26448
|
switch (error.level) {
|
|
24519
26449
|
case "error": {
|
|
24520
|
-
return /* @__PURE__ */
|
|
26450
|
+
return /* @__PURE__ */ jsx137(ErrorIcon2, { sx: { color: "#d32f2f", fontSize: "14px" } });
|
|
24521
26451
|
}
|
|
24522
26452
|
case "warning": {
|
|
24523
|
-
return /* @__PURE__ */
|
|
26453
|
+
return /* @__PURE__ */ jsx137(Warning2, { sx: { color: "#ff9800", fontSize: "14px" } });
|
|
24524
26454
|
}
|
|
24525
26455
|
default: {
|
|
24526
|
-
return /* @__PURE__ */
|
|
26456
|
+
return /* @__PURE__ */ jsx137(Info2, { sx: { color: "#2196f3", fontSize: "14px" } });
|
|
24527
26457
|
}
|
|
24528
26458
|
}
|
|
24529
26459
|
}, [error.level]);
|
|
24530
|
-
const color2 =
|
|
26460
|
+
const color2 = useMemo12(() => {
|
|
24531
26461
|
switch (error.level) {
|
|
24532
26462
|
case "error": {
|
|
24533
26463
|
return "#d32f2f";
|
|
@@ -24540,8 +26470,8 @@ var ProblemIndicator = ({ error }) => {
|
|
|
24540
26470
|
}
|
|
24541
26471
|
}
|
|
24542
26472
|
}, [error.level]);
|
|
24543
|
-
return /* @__PURE__ */
|
|
24544
|
-
|
|
26473
|
+
return /* @__PURE__ */ jsx137(Tooltip3, { arrow: true, title: error.message ?? "Issue detected", children: /* @__PURE__ */ jsx137(
|
|
26474
|
+
Box14,
|
|
24545
26475
|
{
|
|
24546
26476
|
sx: {
|
|
24547
26477
|
alignItems: "center",
|
|
@@ -24560,17 +26490,17 @@ var ProblemIndicator = ({ error }) => {
|
|
|
24560
26490
|
};
|
|
24561
26491
|
|
|
24562
26492
|
// src/components/trace-graph/service-node.tsx
|
|
24563
|
-
import { jsx as
|
|
26493
|
+
import { jsx as jsx138, jsxs as jsxs130 } from "react/jsx-runtime";
|
|
24564
26494
|
var handleStyle = {
|
|
24565
26495
|
backgroundColor: "white",
|
|
24566
26496
|
borderColor: "lightgray",
|
|
24567
26497
|
opacity: 0
|
|
24568
26498
|
};
|
|
24569
|
-
var ServiceNode =
|
|
26499
|
+
var ServiceNode = memo11(({ data, selected }) => {
|
|
24570
26500
|
const hasErrors = (data.event.errors && data.event.errors.length > 0) ?? false;
|
|
24571
|
-
return /* @__PURE__ */
|
|
24572
|
-
/* @__PURE__ */
|
|
24573
|
-
|
|
26501
|
+
return /* @__PURE__ */ jsxs130(Box15, { sx: { maxWidth: 200 }, children: [
|
|
26502
|
+
/* @__PURE__ */ jsxs130(
|
|
26503
|
+
Box15,
|
|
24574
26504
|
{
|
|
24575
26505
|
role: "button",
|
|
24576
26506
|
sx: {
|
|
@@ -24590,9 +26520,9 @@ var ServiceNode = memo9(({ data, selected }) => {
|
|
|
24590
26520
|
},
|
|
24591
26521
|
tabIndex: 0,
|
|
24592
26522
|
children: [
|
|
24593
|
-
/* @__PURE__ */
|
|
24594
|
-
/* @__PURE__ */
|
|
24595
|
-
/* @__PURE__ */
|
|
26523
|
+
/* @__PURE__ */ jsx138(Handle, { position: Position.Left, style: handleStyle, type: "target" }),
|
|
26524
|
+
/* @__PURE__ */ jsx138(Handle, { position: Position.Right, style: handleStyle, type: "source" }),
|
|
26525
|
+
/* @__PURE__ */ jsx138(
|
|
24596
26526
|
ServiceCell,
|
|
24597
26527
|
{
|
|
24598
26528
|
height: "32px",
|
|
@@ -24605,7 +26535,7 @@ var ServiceNode = memo9(({ data, selected }) => {
|
|
|
24605
26535
|
]
|
|
24606
26536
|
}
|
|
24607
26537
|
),
|
|
24608
|
-
/* @__PURE__ */
|
|
26538
|
+
/* @__PURE__ */ jsxs130(
|
|
24609
26539
|
Stack3,
|
|
24610
26540
|
{
|
|
24611
26541
|
alignItems: "center",
|
|
@@ -24616,7 +26546,7 @@ var ServiceNode = memo9(({ data, selected }) => {
|
|
|
24616
26546
|
mt: 0.5
|
|
24617
26547
|
},
|
|
24618
26548
|
children: [
|
|
24619
|
-
hasErrors && /* @__PURE__ */
|
|
26549
|
+
hasErrors && /* @__PURE__ */ jsx138(
|
|
24620
26550
|
Stack3,
|
|
24621
26551
|
{
|
|
24622
26552
|
direction: "row",
|
|
@@ -24625,11 +26555,11 @@ var ServiceNode = memo9(({ data, selected }) => {
|
|
|
24625
26555
|
flexWrap: "wrap",
|
|
24626
26556
|
gap: "2px"
|
|
24627
26557
|
},
|
|
24628
|
-
children: data.event.errors?.map((error) => /* @__PURE__ */
|
|
26558
|
+
children: data.event.errors?.map((error) => /* @__PURE__ */ jsx138(ProblemIndicator, { error }, error.span_id))
|
|
24629
26559
|
}
|
|
24630
26560
|
),
|
|
24631
|
-
/* @__PURE__ */
|
|
24632
|
-
|
|
26561
|
+
/* @__PURE__ */ jsx138(
|
|
26562
|
+
Typography10,
|
|
24633
26563
|
{
|
|
24634
26564
|
sx: {
|
|
24635
26565
|
fontSize: "0.9rem",
|
|
@@ -24680,57 +26610,18 @@ var getLayoutedNodesAndEdges = (inputNodes, inputEdges) => {
|
|
|
24680
26610
|
|
|
24681
26611
|
// src/components/trace-graph/xyflow/controls.tsx
|
|
24682
26612
|
import { Add, FitScreen, Remove } from "@mui/icons-material";
|
|
24683
|
-
import { Box as
|
|
24684
|
-
import { useReactFlow, useStore } from "@xyflow/react";
|
|
24685
|
-
import { memo as
|
|
24686
|
-
|
|
24687
|
-
|
|
24688
|
-
function shallow$1(objA, objB) {
|
|
24689
|
-
if (Object.is(objA, objB)) {
|
|
24690
|
-
return true;
|
|
24691
|
-
}
|
|
24692
|
-
if (typeof objA !== "object" || objA === null || typeof objB !== "object" || objB === null) {
|
|
24693
|
-
return false;
|
|
24694
|
-
}
|
|
24695
|
-
if (objA instanceof Map && objB instanceof Map) {
|
|
24696
|
-
if (objA.size !== objB.size) return false;
|
|
24697
|
-
for (const [key, value] of objA) {
|
|
24698
|
-
if (!Object.is(value, objB.get(key))) {
|
|
24699
|
-
return false;
|
|
24700
|
-
}
|
|
24701
|
-
}
|
|
24702
|
-
return true;
|
|
24703
|
-
}
|
|
24704
|
-
if (objA instanceof Set && objB instanceof Set) {
|
|
24705
|
-
if (objA.size !== objB.size) return false;
|
|
24706
|
-
for (const value of objA) {
|
|
24707
|
-
if (!objB.has(value)) {
|
|
24708
|
-
return false;
|
|
24709
|
-
}
|
|
24710
|
-
}
|
|
24711
|
-
return true;
|
|
24712
|
-
}
|
|
24713
|
-
const keysA = Object.keys(objA);
|
|
24714
|
-
if (keysA.length !== Object.keys(objB).length) {
|
|
24715
|
-
return false;
|
|
24716
|
-
}
|
|
24717
|
-
for (const keyA of keysA) {
|
|
24718
|
-
if (!Object.prototype.hasOwnProperty.call(objB, keyA) || !Object.is(objA[keyA], objB[keyA])) {
|
|
24719
|
-
return false;
|
|
24720
|
-
}
|
|
24721
|
-
}
|
|
24722
|
-
return true;
|
|
24723
|
-
}
|
|
24724
|
-
|
|
24725
|
-
// src/components/trace-graph/xyflow/controls.tsx
|
|
24726
|
-
import { jsx as jsx140, jsxs as jsxs132 } from "react/jsx-runtime";
|
|
26613
|
+
import { Box as Box16, IconButton as IconButton4 } from "@mui/material";
|
|
26614
|
+
import { useReactFlow, useStore as useStore2 } from "@xyflow/react";
|
|
26615
|
+
import { memo as memo12 } from "react";
|
|
26616
|
+
import { shallow } from "zustand/shallow";
|
|
26617
|
+
import { jsx as jsx139, jsxs as jsxs131 } from "react/jsx-runtime";
|
|
24727
26618
|
var selector = (s2) => ({
|
|
24728
26619
|
isInteractive: s2.nodesDraggable || s2.nodesConnectable || s2.elementsSelectable,
|
|
24729
26620
|
maxZoomReached: s2.transform[2] >= s2.maxZoom,
|
|
24730
26621
|
minZoomReached: s2.transform[2] <= s2.minZoom
|
|
24731
26622
|
});
|
|
24732
|
-
var Controls =
|
|
24733
|
-
const { maxZoomReached, minZoomReached } =
|
|
26623
|
+
var Controls = memo12(() => {
|
|
26624
|
+
const { maxZoomReached, minZoomReached } = useStore2(selector, shallow);
|
|
24734
26625
|
const { fitView, zoomIn, zoomOut } = useReactFlow();
|
|
24735
26626
|
const onZoomInHandler = () => {
|
|
24736
26627
|
void zoomIn();
|
|
@@ -24741,8 +26632,8 @@ var Controls = memo10(() => {
|
|
|
24741
26632
|
const onFitViewHandler = () => {
|
|
24742
26633
|
void fitView();
|
|
24743
26634
|
};
|
|
24744
|
-
return /* @__PURE__ */
|
|
24745
|
-
|
|
26635
|
+
return /* @__PURE__ */ jsxs131(
|
|
26636
|
+
Box16,
|
|
24746
26637
|
{
|
|
24747
26638
|
sx: {
|
|
24748
26639
|
bottom: 0,
|
|
@@ -24755,33 +26646,33 @@ var Controls = memo10(() => {
|
|
|
24755
26646
|
zIndex: 5
|
|
24756
26647
|
},
|
|
24757
26648
|
children: [
|
|
24758
|
-
/* @__PURE__ */
|
|
26649
|
+
/* @__PURE__ */ jsx139(
|
|
24759
26650
|
IconButton4,
|
|
24760
26651
|
{
|
|
24761
26652
|
className: "react-flow__controls-zoomin",
|
|
24762
26653
|
disabled: maxZoomReached,
|
|
24763
26654
|
onClick: onZoomInHandler,
|
|
24764
26655
|
size: "small",
|
|
24765
|
-
children: /* @__PURE__ */
|
|
26656
|
+
children: /* @__PURE__ */ jsx139(Add, {})
|
|
24766
26657
|
}
|
|
24767
26658
|
),
|
|
24768
|
-
/* @__PURE__ */
|
|
26659
|
+
/* @__PURE__ */ jsx139(
|
|
24769
26660
|
IconButton4,
|
|
24770
26661
|
{
|
|
24771
26662
|
className: "react-flow__controls-zoomout",
|
|
24772
26663
|
disabled: minZoomReached,
|
|
24773
26664
|
onClick: onZoomOutHandler,
|
|
24774
26665
|
size: "small",
|
|
24775
|
-
children: /* @__PURE__ */
|
|
26666
|
+
children: /* @__PURE__ */ jsx139(Remove, {})
|
|
24776
26667
|
}
|
|
24777
26668
|
),
|
|
24778
|
-
/* @__PURE__ */
|
|
26669
|
+
/* @__PURE__ */ jsx139(
|
|
24779
26670
|
IconButton4,
|
|
24780
26671
|
{
|
|
24781
26672
|
className: "react-flow__controls-fitview",
|
|
24782
26673
|
onClick: onFitViewHandler,
|
|
24783
26674
|
size: "small",
|
|
24784
|
-
children: /* @__PURE__ */
|
|
26675
|
+
children: /* @__PURE__ */ jsx139(FitScreen, {})
|
|
24785
26676
|
}
|
|
24786
26677
|
)
|
|
24787
26678
|
]
|
|
@@ -24790,7 +26681,7 @@ var Controls = memo10(() => {
|
|
|
24790
26681
|
});
|
|
24791
26682
|
|
|
24792
26683
|
// src/components/trace-graph/trace-graph.tsx
|
|
24793
|
-
import { Fragment as
|
|
26684
|
+
import { Fragment as Fragment8, jsx as jsx140, jsxs as jsxs132 } from "react/jsx-runtime";
|
|
24794
26685
|
var nodeTypes = {
|
|
24795
26686
|
service: ServiceNode
|
|
24796
26687
|
};
|
|
@@ -24802,7 +26693,7 @@ var TraceGraph = ({
|
|
|
24802
26693
|
}) => {
|
|
24803
26694
|
const [nodes, setNodes, onNodesChange] = useNodesState([]);
|
|
24804
26695
|
const [edges, setEdges] = useEdgesState([]);
|
|
24805
|
-
|
|
26696
|
+
useEffect18(() => {
|
|
24806
26697
|
const allNodes = [];
|
|
24807
26698
|
const allEdges = [];
|
|
24808
26699
|
for (const span of spans.data ?? []) {
|
|
@@ -24852,12 +26743,12 @@ var TraceGraph = ({
|
|
|
24852
26743
|
setNodes(layoutedNodes);
|
|
24853
26744
|
setEdges(layoutedEdges);
|
|
24854
26745
|
}, [spans.data, initialFocusEventId, setNodes, setEdges]);
|
|
24855
|
-
const theme =
|
|
24856
|
-
return /* @__PURE__ */
|
|
24857
|
-
spans.error && /* @__PURE__ */
|
|
26746
|
+
const theme = useTheme4();
|
|
26747
|
+
return /* @__PURE__ */ jsxs132(Fragment8, { children: [
|
|
26748
|
+
spans.error && /* @__PURE__ */ jsxs132(
|
|
24858
26749
|
Alert3,
|
|
24859
26750
|
{
|
|
24860
|
-
action: /* @__PURE__ */
|
|
26751
|
+
action: /* @__PURE__ */ jsx140(Button4, { onClick: () => {
|
|
24861
26752
|
onRefresh();
|
|
24862
26753
|
}, children: "Retry" }),
|
|
24863
26754
|
severity: "error",
|
|
@@ -24868,7 +26759,7 @@ var TraceGraph = ({
|
|
|
24868
26759
|
]
|
|
24869
26760
|
}
|
|
24870
26761
|
),
|
|
24871
|
-
/* @__PURE__ */
|
|
26762
|
+
/* @__PURE__ */ jsxs132(
|
|
24872
26763
|
ReactFlow,
|
|
24873
26764
|
{
|
|
24874
26765
|
"data-testid": "trace-graph",
|
|
@@ -24886,8 +26777,8 @@ var TraceGraph = ({
|
|
|
24886
26777
|
onNodesChange,
|
|
24887
26778
|
selectNodesOnDrag: false,
|
|
24888
26779
|
children: [
|
|
24889
|
-
/* @__PURE__ */
|
|
24890
|
-
/* @__PURE__ */
|
|
26780
|
+
/* @__PURE__ */ jsx140(Controls, {}),
|
|
26781
|
+
/* @__PURE__ */ jsx140(
|
|
24891
26782
|
Background,
|
|
24892
26783
|
{
|
|
24893
26784
|
bgColor: theme.palette.background.paper,
|
|
@@ -24901,7 +26792,7 @@ var TraceGraph = ({
|
|
|
24901
26792
|
};
|
|
24902
26793
|
|
|
24903
26794
|
// src/pages/trace-graph-page.tsx
|
|
24904
|
-
import { Fragment as
|
|
26795
|
+
import { Fragment as Fragment9, jsx as jsx141, jsxs as jsxs133 } from "react/jsx-runtime";
|
|
24905
26796
|
var HEADER_HEIGHT = 56;
|
|
24906
26797
|
var DRAWER_WIDTH = "35%";
|
|
24907
26798
|
var Main = styled("main", { shouldForwardProp: (property) => property !== "open" })(({ open, theme }) => ({
|
|
@@ -24949,8 +26840,8 @@ var TraceGraphView = ({
|
|
|
24949
26840
|
traceId
|
|
24950
26841
|
}) => {
|
|
24951
26842
|
const shouldShowStatusMessage = Boolean(statusError) || status?.status === "DISABLED";
|
|
24952
|
-
return /* @__PURE__ */
|
|
24953
|
-
|
|
26843
|
+
return /* @__PURE__ */ jsxs133(
|
|
26844
|
+
Box17,
|
|
24954
26845
|
{
|
|
24955
26846
|
"data-testid": "trace-graph-page",
|
|
24956
26847
|
sx: {
|
|
@@ -24962,14 +26853,14 @@ var TraceGraphView = ({
|
|
|
24962
26853
|
overflow: "hidden"
|
|
24963
26854
|
},
|
|
24964
26855
|
children: [
|
|
24965
|
-
/* @__PURE__ */
|
|
24966
|
-
/* @__PURE__ */
|
|
26856
|
+
/* @__PURE__ */ jsxs133(Box17, { sx: { display: "flex", width: "100%" }, children: [
|
|
26857
|
+
/* @__PURE__ */ jsx141(Button5, { onClick: () => {
|
|
24967
26858
|
navigateToSpansList();
|
|
24968
|
-
}, startIcon: /* @__PURE__ */
|
|
24969
|
-
/* @__PURE__ */
|
|
26859
|
+
}, startIcon: /* @__PURE__ */ jsx141(ArrowBack, {}), children: "Go back" }),
|
|
26860
|
+
/* @__PURE__ */ jsx141(Box17, { sx: { flexGrow: 1 } })
|
|
24970
26861
|
] }),
|
|
24971
|
-
/* @__PURE__ */
|
|
24972
|
-
|
|
26862
|
+
/* @__PURE__ */ jsx141(
|
|
26863
|
+
Paper3,
|
|
24973
26864
|
{
|
|
24974
26865
|
sx: {
|
|
24975
26866
|
display: "flex",
|
|
@@ -24978,22 +26869,22 @@ var TraceGraphView = ({
|
|
|
24978
26869
|
position: "relative",
|
|
24979
26870
|
width: "100%"
|
|
24980
26871
|
},
|
|
24981
|
-
children: shouldShowStatusMessage ? /* @__PURE__ */
|
|
26872
|
+
children: shouldShowStatusMessage ? /* @__PURE__ */ jsx141(
|
|
24982
26873
|
StatusMessage,
|
|
24983
26874
|
{
|
|
24984
26875
|
error: statusError,
|
|
24985
26876
|
onRetry: handleRetry,
|
|
24986
26877
|
status
|
|
24987
26878
|
}
|
|
24988
|
-
) : /* @__PURE__ */
|
|
24989
|
-
/* @__PURE__ */
|
|
24990
|
-
|
|
26879
|
+
) : /* @__PURE__ */ jsxs133(Fragment9, { children: [
|
|
26880
|
+
/* @__PURE__ */ jsx141(Main, { open, children: /* @__PURE__ */ jsx141(
|
|
26881
|
+
Box17,
|
|
24991
26882
|
{
|
|
24992
26883
|
sx: {
|
|
24993
26884
|
height: "100%",
|
|
24994
26885
|
overflow: "auto"
|
|
24995
26886
|
},
|
|
24996
|
-
children: traceId !== void 0 && /* @__PURE__ */
|
|
26887
|
+
children: traceId !== void 0 && /* @__PURE__ */ jsx141(ReactFlowProvider, { children: /* @__PURE__ */ jsx141(
|
|
24997
26888
|
TraceGraph,
|
|
24998
26889
|
{
|
|
24999
26890
|
initialFocusEventId: spanId,
|
|
@@ -25010,7 +26901,7 @@ var TraceGraphView = ({
|
|
|
25010
26901
|
) })
|
|
25011
26902
|
}
|
|
25012
26903
|
) }),
|
|
25013
|
-
/* @__PURE__ */
|
|
26904
|
+
/* @__PURE__ */ jsx141(StyledDrawer, { anchor: "right", open, variant: "persistent", children: /* @__PURE__ */ jsx141(EventDetails, { onClose: handleClose, selectedEvent }) })
|
|
25014
26905
|
] })
|
|
25015
26906
|
}
|
|
25016
26907
|
)
|
|
@@ -25027,7 +26918,7 @@ async function fetchConnectedTraces(api, traceIds, allSpans = /* @__PURE__ */ ne
|
|
|
25027
26918
|
const traceResponses = await Promise.all(
|
|
25028
26919
|
newTraceIds.map((id2) => api.getSpans({ trace_id: id2 }))
|
|
25029
26920
|
);
|
|
25030
|
-
const currentBatchSpans = traceResponses.flatMap((
|
|
26921
|
+
const currentBatchSpans = traceResponses.flatMap((r3) => r3.spans);
|
|
25031
26922
|
const currentSpanIds = currentBatchSpans.map((s2) => s2.span_id);
|
|
25032
26923
|
for (const span of currentBatchSpans) {
|
|
25033
26924
|
allSpans.set(span.span_id, span);
|
|
@@ -25054,10 +26945,10 @@ async function fetchConnectedTraces(api, traceIds, allSpans = /* @__PURE__ */ ne
|
|
|
25054
26945
|
}
|
|
25055
26946
|
var TraceGraphPage = ({ onClose, spanId, traceId }) => {
|
|
25056
26947
|
const api = useAppInspectorApi();
|
|
25057
|
-
const [spans, setSpans] =
|
|
25058
|
-
const [loading, setLoading] =
|
|
25059
|
-
const [fetchError, setFetchError] =
|
|
25060
|
-
const fetchSpans =
|
|
26948
|
+
const [spans, setSpans] = useState14();
|
|
26949
|
+
const [loading, setLoading] = useState14(false);
|
|
26950
|
+
const [fetchError, setFetchError] = useState14();
|
|
26951
|
+
const fetchSpans = useCallback9(async () => {
|
|
25061
26952
|
setLoading(true);
|
|
25062
26953
|
try {
|
|
25063
26954
|
const spans2 = await fetchConnectedTraces(api, [traceId]);
|
|
@@ -25070,31 +26961,31 @@ var TraceGraphPage = ({ onClose, spanId, traceId }) => {
|
|
|
25070
26961
|
setLoading(false);
|
|
25071
26962
|
}
|
|
25072
26963
|
}, [api, traceId]);
|
|
25073
|
-
|
|
26964
|
+
useEffect19(() => {
|
|
25074
26965
|
void fetchSpans();
|
|
25075
26966
|
}, [fetchSpans]);
|
|
25076
|
-
const [open, setOpen] =
|
|
25077
|
-
const [selectedEvent, setSelectedEvent] =
|
|
25078
|
-
const spansReference =
|
|
25079
|
-
|
|
26967
|
+
const [open, setOpen] = useState14(true);
|
|
26968
|
+
const [selectedEvent, setSelectedEvent] = useState14(() => spans?.find((span) => span.span_id === spanId));
|
|
26969
|
+
const spansReference = useRef14();
|
|
26970
|
+
useEffect19(() => {
|
|
25080
26971
|
if (!spansReference.current && spans) {
|
|
25081
26972
|
setSelectedEvent(spans.find((span) => span.span_id === spanId));
|
|
25082
26973
|
spansReference.current = spans;
|
|
25083
26974
|
}
|
|
25084
26975
|
}, [spans, setSelectedEvent, spanId]);
|
|
25085
26976
|
const { checkStatus, error: statusError, status } = useStatus();
|
|
25086
|
-
const handleEventSelect =
|
|
26977
|
+
const handleEventSelect = useCallback9((spanId2) => {
|
|
25087
26978
|
const span = spans?.find((s2) => s2.span_id === spanId2);
|
|
25088
26979
|
setSelectedEvent(span);
|
|
25089
26980
|
setOpen(true);
|
|
25090
26981
|
}, [spans]);
|
|
25091
|
-
const handleRetry =
|
|
26982
|
+
const handleRetry = useCallback9(() => {
|
|
25092
26983
|
void checkStatus();
|
|
25093
26984
|
}, [checkStatus]);
|
|
25094
|
-
const navigateToSpansList =
|
|
26985
|
+
const navigateToSpansList = useCallback9(() => {
|
|
25095
26986
|
onClose?.();
|
|
25096
26987
|
}, [onClose]);
|
|
25097
|
-
return /* @__PURE__ */
|
|
26988
|
+
return /* @__PURE__ */ jsx141(
|
|
25098
26989
|
TraceGraphView,
|
|
25099
26990
|
{
|
|
25100
26991
|
fetchError,
|
|
@@ -25118,7 +27009,7 @@ var TraceGraphPage = ({ onClose, spanId, traceId }) => {
|
|
|
25118
27009
|
};
|
|
25119
27010
|
|
|
25120
27011
|
// src/pages/spans-list-page.tsx
|
|
25121
|
-
import { Fragment as
|
|
27012
|
+
import { Fragment as Fragment10, jsx as jsx142, jsxs as jsxs134 } from "react/jsx-runtime";
|
|
25122
27013
|
var SpansListPage = () => {
|
|
25123
27014
|
const {
|
|
25124
27015
|
checkStatus,
|
|
@@ -25137,23 +27028,23 @@ var SpansListPage = () => {
|
|
|
25137
27028
|
streamPaused,
|
|
25138
27029
|
toggleStream
|
|
25139
27030
|
} = useSpans();
|
|
25140
|
-
const clearSpansSync =
|
|
27031
|
+
const clearSpansSync = useCallback10(() => {
|
|
25141
27032
|
void clearSpans();
|
|
25142
27033
|
}, [clearSpans]);
|
|
25143
27034
|
const [order2, setOrder] = useLocalStorage("spans-order", "oldest_first");
|
|
25144
|
-
const [selectedTraceId, setSelectedTraceId] =
|
|
25145
|
-
const [selectedSpanId, setSelectedSpanId] =
|
|
25146
|
-
const navigateToSpan =
|
|
27035
|
+
const [selectedTraceId, setSelectedTraceId] = useState15();
|
|
27036
|
+
const [selectedSpanId, setSelectedSpanId] = useState15();
|
|
27037
|
+
const navigateToSpan = useCallback10((span) => {
|
|
25147
27038
|
setSelectedTraceId(span.trace_id);
|
|
25148
27039
|
setSelectedSpanId(span.span_id);
|
|
25149
27040
|
}, []);
|
|
25150
|
-
const handleRetry =
|
|
27041
|
+
const handleRetry = useCallback10(() => {
|
|
25151
27042
|
void checkStatus();
|
|
25152
27043
|
}, [checkStatus]);
|
|
25153
27044
|
const shouldShowStatusMessage = Boolean(statusError) || status?.status === "DISABLED";
|
|
25154
|
-
return /* @__PURE__ */
|
|
25155
|
-
/* @__PURE__ */
|
|
25156
|
-
|
|
27045
|
+
return /* @__PURE__ */ jsxs134(Fragment10, { children: [
|
|
27046
|
+
/* @__PURE__ */ jsx142(
|
|
27047
|
+
Box18,
|
|
25157
27048
|
{
|
|
25158
27049
|
"data-testid": "spans-list-page",
|
|
25159
27050
|
sx: {
|
|
@@ -25167,14 +27058,14 @@ var SpansListPage = () => {
|
|
|
25167
27058
|
visibility: selectedTraceId === void 0 ? "visible" : "hidden",
|
|
25168
27059
|
width: "100%"
|
|
25169
27060
|
},
|
|
25170
|
-
children: shouldShowStatusMessage ? /* @__PURE__ */
|
|
27061
|
+
children: shouldShowStatusMessage ? /* @__PURE__ */ jsx142(
|
|
25171
27062
|
StatusMessage,
|
|
25172
27063
|
{
|
|
25173
27064
|
error: statusError,
|
|
25174
27065
|
onRetry: handleRetry,
|
|
25175
27066
|
status
|
|
25176
27067
|
}
|
|
25177
|
-
) : /* @__PURE__ */
|
|
27068
|
+
) : /* @__PURE__ */ jsx142(
|
|
25178
27069
|
SpansList,
|
|
25179
27070
|
{
|
|
25180
27071
|
clearingSpans,
|
|
@@ -25196,7 +27087,7 @@ var SpansListPage = () => {
|
|
|
25196
27087
|
)
|
|
25197
27088
|
}
|
|
25198
27089
|
),
|
|
25199
|
-
selectedTraceId !== void 0 && /* @__PURE__ */
|
|
27090
|
+
selectedTraceId !== void 0 && /* @__PURE__ */ jsx142(TraceGraphPage, { onClose: () => {
|
|
25200
27091
|
setSelectedTraceId(void 0);
|
|
25201
27092
|
}, spanId: selectedSpanId, traceId: selectedTraceId })
|
|
25202
27093
|
] });
|