@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.cjs
CHANGED
|
@@ -8,6 +8,9 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
8
8
|
var __esm = (fn, res) => function __init() {
|
|
9
9
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
10
10
|
};
|
|
11
|
+
var __commonJS = (cb2, mod) => function __require() {
|
|
12
|
+
return mod || (0, cb2[__getOwnPropNames(cb2)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
13
|
+
};
|
|
11
14
|
var __export = (target, all) => {
|
|
12
15
|
for (var name in all)
|
|
13
16
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -30,40 +33,139 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
33
|
));
|
|
31
34
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
35
|
|
|
33
|
-
// node_modules/
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return function(arg) {
|
|
37
|
-
if (cache2[arg] === void 0) cache2[arg] = fn(arg);
|
|
38
|
-
return cache2[arg];
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
var memoize_browser_esm_default;
|
|
42
|
-
var init_memoize_browser_esm = __esm({
|
|
43
|
-
"node_modules/framer-motion/node_modules/@emotion/memoize/dist/memoize.browser.esm.js"() {
|
|
36
|
+
// node_modules/toggle-selection/index.js
|
|
37
|
+
var require_toggle_selection = __commonJS({
|
|
38
|
+
"node_modules/toggle-selection/index.js"(exports, module2) {
|
|
44
39
|
"use strict";
|
|
45
|
-
|
|
40
|
+
module2.exports = function() {
|
|
41
|
+
var selection = document.getSelection();
|
|
42
|
+
if (!selection.rangeCount) {
|
|
43
|
+
return function() {
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
var active = document.activeElement;
|
|
47
|
+
var ranges = [];
|
|
48
|
+
for (var i2 = 0; i2 < selection.rangeCount; i2++) {
|
|
49
|
+
ranges.push(selection.getRangeAt(i2));
|
|
50
|
+
}
|
|
51
|
+
switch (active.tagName.toUpperCase()) {
|
|
52
|
+
// .toUpperCase handles XHTML
|
|
53
|
+
case "INPUT":
|
|
54
|
+
case "TEXTAREA":
|
|
55
|
+
active.blur();
|
|
56
|
+
break;
|
|
57
|
+
default:
|
|
58
|
+
active = null;
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
selection.removeAllRanges();
|
|
62
|
+
return function() {
|
|
63
|
+
selection.type === "Caret" && selection.removeAllRanges();
|
|
64
|
+
if (!selection.rangeCount) {
|
|
65
|
+
ranges.forEach(function(range) {
|
|
66
|
+
selection.addRange(range);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
active && active.focus();
|
|
70
|
+
};
|
|
71
|
+
};
|
|
46
72
|
}
|
|
47
73
|
});
|
|
48
74
|
|
|
49
|
-
// node_modules/
|
|
50
|
-
var
|
|
51
|
-
|
|
52
|
-
default: () => is_prop_valid_browser_esm_default
|
|
53
|
-
});
|
|
54
|
-
var reactPropsRegex, index, is_prop_valid_browser_esm_default;
|
|
55
|
-
var init_is_prop_valid_browser_esm = __esm({
|
|
56
|
-
"node_modules/framer-motion/node_modules/@emotion/is-prop-valid/dist/is-prop-valid.browser.esm.js"() {
|
|
75
|
+
// node_modules/copy-to-clipboard/index.js
|
|
76
|
+
var require_copy_to_clipboard = __commonJS({
|
|
77
|
+
"node_modules/copy-to-clipboard/index.js"(exports, module2) {
|
|
57
78
|
"use strict";
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
79
|
+
var deselectCurrent = require_toggle_selection();
|
|
80
|
+
var clipboardToIE11Formatting = {
|
|
81
|
+
"text/plain": "Text",
|
|
82
|
+
"text/html": "Url",
|
|
83
|
+
"default": "Text"
|
|
84
|
+
};
|
|
85
|
+
var defaultMessage = "Copy to clipboard: #{key}, Enter";
|
|
86
|
+
function format2(message) {
|
|
87
|
+
var copyKey = (/mac os x/i.test(navigator.userAgent) ? "\u2318" : "Ctrl") + "+C";
|
|
88
|
+
return message.replace(/#{\s*key\s*}/g, copyKey);
|
|
89
|
+
}
|
|
90
|
+
function copy(text2, options) {
|
|
91
|
+
var debug2, message, reselectPrevious, range, selection, mark, success = false;
|
|
92
|
+
if (!options) {
|
|
93
|
+
options = {};
|
|
94
|
+
}
|
|
95
|
+
debug2 = options.debug || false;
|
|
96
|
+
try {
|
|
97
|
+
reselectPrevious = deselectCurrent();
|
|
98
|
+
range = document.createRange();
|
|
99
|
+
selection = document.getSelection();
|
|
100
|
+
mark = document.createElement("span");
|
|
101
|
+
mark.textContent = text2;
|
|
102
|
+
mark.ariaHidden = "true";
|
|
103
|
+
mark.style.all = "unset";
|
|
104
|
+
mark.style.position = "fixed";
|
|
105
|
+
mark.style.top = 0;
|
|
106
|
+
mark.style.clip = "rect(0, 0, 0, 0)";
|
|
107
|
+
mark.style.whiteSpace = "pre";
|
|
108
|
+
mark.style.webkitUserSelect = "text";
|
|
109
|
+
mark.style.MozUserSelect = "text";
|
|
110
|
+
mark.style.msUserSelect = "text";
|
|
111
|
+
mark.style.userSelect = "text";
|
|
112
|
+
mark.addEventListener("copy", function(e2) {
|
|
113
|
+
e2.stopPropagation();
|
|
114
|
+
if (options.format) {
|
|
115
|
+
e2.preventDefault();
|
|
116
|
+
if (typeof e2.clipboardData === "undefined") {
|
|
117
|
+
debug2 && console.warn("unable to use e.clipboardData");
|
|
118
|
+
debug2 && console.warn("trying IE specific stuff");
|
|
119
|
+
window.clipboardData.clearData();
|
|
120
|
+
var format3 = clipboardToIE11Formatting[options.format] || clipboardToIE11Formatting["default"];
|
|
121
|
+
window.clipboardData.setData(format3, text2);
|
|
122
|
+
} else {
|
|
123
|
+
e2.clipboardData.clearData();
|
|
124
|
+
e2.clipboardData.setData(options.format, text2);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (options.onCopy) {
|
|
128
|
+
e2.preventDefault();
|
|
129
|
+
options.onCopy(e2.clipboardData);
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
document.body.appendChild(mark);
|
|
133
|
+
range.selectNodeContents(mark);
|
|
134
|
+
selection.addRange(range);
|
|
135
|
+
var successful = document.execCommand("copy");
|
|
136
|
+
if (!successful) {
|
|
137
|
+
throw new Error("copy command was unsuccessful");
|
|
138
|
+
}
|
|
139
|
+
success = true;
|
|
140
|
+
} catch (err) {
|
|
141
|
+
debug2 && console.error("unable to copy using execCommand: ", err);
|
|
142
|
+
debug2 && console.warn("trying IE specific stuff");
|
|
143
|
+
try {
|
|
144
|
+
window.clipboardData.setData(options.format || "text", text2);
|
|
145
|
+
options.onCopy && options.onCopy(window.clipboardData);
|
|
146
|
+
success = true;
|
|
147
|
+
} catch (err2) {
|
|
148
|
+
debug2 && console.error("unable to copy using clipboardData: ", err2);
|
|
149
|
+
debug2 && console.error("falling back to prompt");
|
|
150
|
+
message = format2("message" in options ? options.message : defaultMessage);
|
|
151
|
+
window.prompt(message, text2);
|
|
152
|
+
}
|
|
153
|
+
} finally {
|
|
154
|
+
if (selection) {
|
|
155
|
+
if (typeof selection.removeRange == "function") {
|
|
156
|
+
selection.removeRange(range);
|
|
157
|
+
} else {
|
|
158
|
+
selection.removeAllRanges();
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
if (mark) {
|
|
162
|
+
document.body.removeChild(mark);
|
|
163
|
+
}
|
|
164
|
+
reselectPrevious();
|
|
63
165
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
166
|
+
return success;
|
|
167
|
+
}
|
|
168
|
+
module2.exports = copy;
|
|
67
169
|
}
|
|
68
170
|
});
|
|
69
171
|
|
|
@@ -385,8 +487,8 @@ __export(index_exports, {
|
|
|
385
487
|
module.exports = __toCommonJS(index_exports);
|
|
386
488
|
|
|
387
489
|
// src/pages/spans-list-page.tsx
|
|
388
|
-
var
|
|
389
|
-
var
|
|
490
|
+
var import_material20 = require("@mui/material");
|
|
491
|
+
var import_react63 = require("react");
|
|
390
492
|
|
|
391
493
|
// src/components/spans-list/spans-list.tsx
|
|
392
494
|
var import_material5 = require("@mui/material");
|
|
@@ -454,7 +556,7 @@ function memo(getDeps, fn, opts) {
|
|
|
454
556
|
let depTime;
|
|
455
557
|
if (opts.key && opts.debug) depTime = Date.now();
|
|
456
558
|
const newDeps = getDeps(depArgs);
|
|
457
|
-
const depsChanged = newDeps.length !== deps.length || newDeps.some((dep,
|
|
559
|
+
const depsChanged = newDeps.length !== deps.length || newDeps.some((dep, index) => deps[index] !== dep);
|
|
458
560
|
if (!depsChanged) {
|
|
459
561
|
return result;
|
|
460
562
|
}
|
|
@@ -754,9 +856,9 @@ function buildHeaderGroups(allColumns, columnsToGroup, table, headerFamily) {
|
|
|
754
856
|
createHeaderGroup(pendingParentHeaders, depth - 1);
|
|
755
857
|
}
|
|
756
858
|
};
|
|
757
|
-
const bottomHeaders = columnsToGroup.map((column,
|
|
859
|
+
const bottomHeaders = columnsToGroup.map((column, index) => createHeader(table, column, {
|
|
758
860
|
depth: maxDepth2,
|
|
759
|
-
index
|
|
861
|
+
index
|
|
760
862
|
}));
|
|
761
863
|
createHeaderGroup(bottomHeaders, maxDepth2 - 1);
|
|
762
864
|
headerGroups.reverse();
|
|
@@ -2903,9 +3005,9 @@ function createTable(options) {
|
|
|
2903
3005
|
setState: (updater) => {
|
|
2904
3006
|
table.options.onStateChange == null || table.options.onStateChange(updater);
|
|
2905
3007
|
},
|
|
2906
|
-
_getRowId: (row,
|
|
3008
|
+
_getRowId: (row, index, parent) => {
|
|
2907
3009
|
var _table$options$getRow;
|
|
2908
|
-
return (_table$options$getRow = table.options.getRowId == null ? void 0 : table.options.getRowId(row,
|
|
3010
|
+
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}`;
|
|
2909
3011
|
},
|
|
2910
3012
|
getCoreRowModel: () => {
|
|
2911
3013
|
if (!table._getCoreRowModel) {
|
|
@@ -2996,8 +3098,8 @@ function createTable(options) {
|
|
|
2996
3098
|
}
|
|
2997
3099
|
};
|
|
2998
3100
|
Object.assign(table, coreInstance);
|
|
2999
|
-
for (let
|
|
3000
|
-
const feature = table._features[
|
|
3101
|
+
for (let index = 0; index < table._features.length; index++) {
|
|
3102
|
+
const feature = table._features[index];
|
|
3001
3103
|
feature == null || feature.createTable == null || feature.createTable(table);
|
|
3002
3104
|
}
|
|
3003
3105
|
return table;
|
|
@@ -3230,14 +3332,14 @@ function __values(o2) {
|
|
|
3230
3332
|
function __read(o2, n2) {
|
|
3231
3333
|
var m2 = typeof Symbol === "function" && o2[Symbol.iterator];
|
|
3232
3334
|
if (!m2) return o2;
|
|
3233
|
-
var i2 = m2.call(o2),
|
|
3335
|
+
var i2 = m2.call(o2), r3, ar = [], e2;
|
|
3234
3336
|
try {
|
|
3235
|
-
while ((n2 === void 0 || n2-- > 0) && !(
|
|
3337
|
+
while ((n2 === void 0 || n2-- > 0) && !(r3 = i2.next()).done) ar.push(r3.value);
|
|
3236
3338
|
} catch (error) {
|
|
3237
3339
|
e2 = { error };
|
|
3238
3340
|
} finally {
|
|
3239
3341
|
try {
|
|
3240
|
-
if (
|
|
3342
|
+
if (r3 && !r3.done && (m2 = i2["return"])) m2.call(i2);
|
|
3241
3343
|
} finally {
|
|
3242
3344
|
if (e2) throw e2.error;
|
|
3243
3345
|
}
|
|
@@ -3953,27 +4055,27 @@ var rgba = {
|
|
|
3953
4055
|
|
|
3954
4056
|
// node_modules/style-value-types/dist/es/color/hex.mjs
|
|
3955
4057
|
function parseHex(v2) {
|
|
3956
|
-
let
|
|
4058
|
+
let r3 = "";
|
|
3957
4059
|
let g2 = "";
|
|
3958
4060
|
let b3 = "";
|
|
3959
4061
|
let a3 = "";
|
|
3960
4062
|
if (v2.length > 5) {
|
|
3961
|
-
|
|
4063
|
+
r3 = v2.substr(1, 2);
|
|
3962
4064
|
g2 = v2.substr(3, 2);
|
|
3963
4065
|
b3 = v2.substr(5, 2);
|
|
3964
4066
|
a3 = v2.substr(7, 2);
|
|
3965
4067
|
} else {
|
|
3966
|
-
|
|
4068
|
+
r3 = v2.substr(1, 1);
|
|
3967
4069
|
g2 = v2.substr(2, 1);
|
|
3968
4070
|
b3 = v2.substr(3, 1);
|
|
3969
4071
|
a3 = v2.substr(4, 1);
|
|
3970
|
-
|
|
4072
|
+
r3 += r3;
|
|
3971
4073
|
g2 += g2;
|
|
3972
4074
|
b3 += b3;
|
|
3973
4075
|
a3 += a3;
|
|
3974
4076
|
}
|
|
3975
4077
|
return {
|
|
3976
|
-
red: parseInt(
|
|
4078
|
+
red: parseInt(r3, 16),
|
|
3977
4079
|
green: parseInt(g2, 16),
|
|
3978
4080
|
blue: parseInt(b3, 16),
|
|
3979
4081
|
alpha: a3 ? parseInt(a3, 16) / 255 : 1
|
|
@@ -4309,7 +4411,7 @@ function loadExternalIsValidProp(isValidProp) {
|
|
|
4309
4411
|
};
|
|
4310
4412
|
}
|
|
4311
4413
|
try {
|
|
4312
|
-
loadExternalIsValidProp((
|
|
4414
|
+
loadExternalIsValidProp(require("@emotion/is-prop-valid").default);
|
|
4313
4415
|
} catch (_a2) {
|
|
4314
4416
|
}
|
|
4315
4417
|
function filterProps(props, isDom, forwardMotionProps) {
|
|
@@ -4576,8 +4678,8 @@ function makeLatestValues(props, context, presenceContext, scrapeMotionValues) {
|
|
|
4576
4678
|
for (var key2 in target) {
|
|
4577
4679
|
var valueTarget = target[key2];
|
|
4578
4680
|
if (Array.isArray(valueTarget)) {
|
|
4579
|
-
var
|
|
4580
|
-
valueTarget = valueTarget[
|
|
4681
|
+
var index = initialAnimationIsBlocked ? valueTarget.length - 1 : 0;
|
|
4682
|
+
valueTarget = valueTarget[index];
|
|
4581
4683
|
}
|
|
4582
4684
|
if (valueTarget !== null) {
|
|
4583
4685
|
values[key2] = valueTarget;
|
|
@@ -5388,9 +5490,9 @@ function createRenderStep(runNextFrame2) {
|
|
|
5388
5490
|
return callback;
|
|
5389
5491
|
},
|
|
5390
5492
|
cancel: (callback) => {
|
|
5391
|
-
const
|
|
5392
|
-
if (
|
|
5393
|
-
toRunNextFrame.splice(
|
|
5493
|
+
const index = toRunNextFrame.indexOf(callback);
|
|
5494
|
+
if (index !== -1)
|
|
5495
|
+
toRunNextFrame.splice(index, 1);
|
|
5394
5496
|
toKeepAlive.delete(callback);
|
|
5395
5497
|
},
|
|
5396
5498
|
process: (frameData) => {
|
|
@@ -6252,8 +6354,8 @@ function addUniqueItem(arr, item) {
|
|
|
6252
6354
|
arr.indexOf(item) === -1 && arr.push(item);
|
|
6253
6355
|
}
|
|
6254
6356
|
function removeItem(arr, item) {
|
|
6255
|
-
var
|
|
6256
|
-
|
|
6357
|
+
var index = arr.indexOf(item);
|
|
6358
|
+
index > -1 && arr.splice(index, 1);
|
|
6257
6359
|
}
|
|
6258
6360
|
|
|
6259
6361
|
// node_modules/framer-motion/dist/es/utils/subscription-manager.mjs
|
|
@@ -12806,8 +12908,8 @@ var SpansDataGrid = ({
|
|
|
12806
12908
|
hasRows && !hasMoreForward && /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(StreamBoundaryRow, { colSpan: columnCount, label: LABEL_END_OF_STREAM }),
|
|
12807
12909
|
hasRows && /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(AnimatePresence, { initial: false, children: (() => {
|
|
12808
12910
|
const reversed = [];
|
|
12809
|
-
for (let
|
|
12810
|
-
const row = rows.at(
|
|
12911
|
+
for (let index = rows.length - 1; index >= 0; index--) {
|
|
12912
|
+
const row = rows.at(index);
|
|
12811
12913
|
reversed.push(
|
|
12812
12914
|
/* @__PURE__ */ (0, import_jsx_runtime124.jsx)(SpansDataGridRow, { row }, row.original.span_id)
|
|
12813
12915
|
);
|
|
@@ -13845,275 +13947,2050 @@ var useSpans = () => {
|
|
|
13845
13947
|
|
|
13846
13948
|
// src/pages/trace-graph-page.tsx
|
|
13847
13949
|
var import_icons_material11 = require("@mui/icons-material");
|
|
13848
|
-
var
|
|
13950
|
+
var import_material19 = require("@mui/material");
|
|
13849
13951
|
var import_styles = require("@mui/material/styles");
|
|
13850
|
-
var
|
|
13851
|
-
var
|
|
13952
|
+
var import_react61 = require("@xyflow/react");
|
|
13953
|
+
var import_react62 = require("react");
|
|
13852
13954
|
|
|
13853
13955
|
// src/components/event-details/event-details.tsx
|
|
13854
|
-
var
|
|
13855
|
-
var
|
|
13956
|
+
var import_icons_material8 = require("@mui/icons-material");
|
|
13957
|
+
var import_material14 = require("@mui/material");
|
|
13856
13958
|
|
|
13857
|
-
//
|
|
13858
|
-
|
|
13859
|
-
|
|
13860
|
-
|
|
13959
|
+
// node_modules/@textea/json-viewer/dist/index.mjs
|
|
13960
|
+
var import_jsx_runtime129 = require("react/jsx-runtime");
|
|
13961
|
+
var import_material7 = require("@mui/material");
|
|
13962
|
+
var import_react48 = require("react");
|
|
13963
|
+
var import_zustand = require("zustand");
|
|
13964
|
+
var import_copy_to_clipboard = __toESM(require_copy_to_clipboard(), 1);
|
|
13965
|
+
function r(e2) {
|
|
13966
|
+
var t2, f2, n2 = "";
|
|
13967
|
+
if ("string" == typeof e2 || "number" == typeof e2) n2 += e2;
|
|
13968
|
+
else if ("object" == typeof e2) if (Array.isArray(e2)) {
|
|
13969
|
+
var o2 = e2.length;
|
|
13970
|
+
for (t2 = 0; t2 < o2; t2++) e2[t2] && (f2 = r(e2[t2])) && (n2 && (n2 += " "), n2 += f2);
|
|
13971
|
+
} else for (f2 in e2) e2[f2] && (n2 && (n2 += " "), n2 += f2);
|
|
13972
|
+
return n2;
|
|
13973
|
+
}
|
|
13974
|
+
function clsx() {
|
|
13975
|
+
for (var e2, t2, f2 = 0, n2 = "", o2 = arguments.length; f2 < o2; f2++) (e2 = arguments[f2]) && (t2 = r(e2)) && (n2 && (n2 += " "), n2 += t2);
|
|
13976
|
+
return n2;
|
|
13977
|
+
}
|
|
13978
|
+
var lightColorspace = {
|
|
13979
|
+
scheme: "Light Theme",
|
|
13980
|
+
author: "mac gainor (https://github.com/mac-s-g)",
|
|
13981
|
+
base00: "rgba(0, 0, 0, 0)",
|
|
13982
|
+
base01: "rgb(245, 245, 245)",
|
|
13983
|
+
base02: "rgb(235, 235, 235)",
|
|
13984
|
+
base03: "#93a1a1",
|
|
13985
|
+
base04: "rgba(0, 0, 0, 0.3)",
|
|
13986
|
+
base05: "#586e75",
|
|
13987
|
+
base06: "#073642",
|
|
13988
|
+
base07: "#002b36",
|
|
13989
|
+
base08: "#d33682",
|
|
13990
|
+
base09: "#cb4b16",
|
|
13991
|
+
base0A: "#ffd500",
|
|
13992
|
+
base0B: "#859900",
|
|
13993
|
+
base0C: "#6c71c4",
|
|
13994
|
+
base0D: "#586e75",
|
|
13995
|
+
base0E: "#2aa198",
|
|
13996
|
+
base0F: "#268bd2"
|
|
13997
|
+
};
|
|
13998
|
+
var darkColorspace = {
|
|
13999
|
+
scheme: "Dark Theme",
|
|
14000
|
+
author: "Chris Kempson (http://chriskempson.com)",
|
|
14001
|
+
base00: "#181818",
|
|
14002
|
+
base01: "#282828",
|
|
14003
|
+
base02: "#383838",
|
|
14004
|
+
base03: "#585858",
|
|
14005
|
+
base04: "#b8b8b8",
|
|
14006
|
+
base05: "#d8d8d8",
|
|
14007
|
+
base06: "#e8e8e8",
|
|
14008
|
+
base07: "#f8f8f8",
|
|
14009
|
+
base08: "#ab4642",
|
|
14010
|
+
base09: "#dc9656",
|
|
14011
|
+
base0A: "#f7ca88",
|
|
14012
|
+
base0B: "#a1b56c",
|
|
14013
|
+
base0C: "#86c1b9",
|
|
14014
|
+
base0D: "#7cafc2",
|
|
14015
|
+
base0E: "#ba8baf",
|
|
14016
|
+
base0F: "#a16946"
|
|
14017
|
+
};
|
|
14018
|
+
var DefaultKeyRenderer = () => null;
|
|
14019
|
+
DefaultKeyRenderer.when = () => false;
|
|
14020
|
+
var createJsonViewerStore = (props) => {
|
|
14021
|
+
return (0, import_zustand.create)()((set, get) => {
|
|
14022
|
+
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;
|
|
14023
|
+
return {
|
|
14024
|
+
// provided by user
|
|
14025
|
+
rootName: (_props_rootName = props.rootName) !== null && _props_rootName !== void 0 ? _props_rootName : "root",
|
|
14026
|
+
indentWidth: (_props_indentWidth = props.indentWidth) !== null && _props_indentWidth !== void 0 ? _props_indentWidth : 3,
|
|
14027
|
+
keyRenderer: (_props_keyRenderer = props.keyRenderer) !== null && _props_keyRenderer !== void 0 ? _props_keyRenderer : DefaultKeyRenderer,
|
|
14028
|
+
enableAdd: (_props_enableAdd = props.enableAdd) !== null && _props_enableAdd !== void 0 ? _props_enableAdd : false,
|
|
14029
|
+
enableDelete: (_props_enableDelete = props.enableDelete) !== null && _props_enableDelete !== void 0 ? _props_enableDelete : false,
|
|
14030
|
+
enableClipboard: (_props_enableClipboard = props.enableClipboard) !== null && _props_enableClipboard !== void 0 ? _props_enableClipboard : true,
|
|
14031
|
+
editable: (_props_editable = props.editable) !== null && _props_editable !== void 0 ? _props_editable : false,
|
|
14032
|
+
onChange: (_props_onChange = props.onChange) !== null && _props_onChange !== void 0 ? _props_onChange : () => {
|
|
14033
|
+
},
|
|
14034
|
+
onCopy: (_props_onCopy = props.onCopy) !== null && _props_onCopy !== void 0 ? _props_onCopy : void 0,
|
|
14035
|
+
onSelect: (_props_onSelect = props.onSelect) !== null && _props_onSelect !== void 0 ? _props_onSelect : void 0,
|
|
14036
|
+
onAdd: (_props_onAdd = props.onAdd) !== null && _props_onAdd !== void 0 ? _props_onAdd : void 0,
|
|
14037
|
+
onDelete: (_props_onDelete = props.onDelete) !== null && _props_onDelete !== void 0 ? _props_onDelete : void 0,
|
|
14038
|
+
defaultInspectDepth: (_props_defaultInspectDepth = props.defaultInspectDepth) !== null && _props_defaultInspectDepth !== void 0 ? _props_defaultInspectDepth : 5,
|
|
14039
|
+
defaultInspectControl: (_props_defaultInspectControl = props.defaultInspectControl) !== null && _props_defaultInspectControl !== void 0 ? _props_defaultInspectControl : void 0,
|
|
14040
|
+
maxDisplayLength: (_props_maxDisplayLength = props.maxDisplayLength) !== null && _props_maxDisplayLength !== void 0 ? _props_maxDisplayLength : 30,
|
|
14041
|
+
groupArraysAfterLength: (_props_groupArraysAfterLength = props.groupArraysAfterLength) !== null && _props_groupArraysAfterLength !== void 0 ? _props_groupArraysAfterLength : 100,
|
|
14042
|
+
collapseStringsAfterLength: props.collapseStringsAfterLength === false ? Number.MAX_VALUE : (_props_collapseStringsAfterLength = props.collapseStringsAfterLength) !== null && _props_collapseStringsAfterLength !== void 0 ? _props_collapseStringsAfterLength : 50,
|
|
14043
|
+
objectSortKeys: (_props_objectSortKeys = props.objectSortKeys) !== null && _props_objectSortKeys !== void 0 ? _props_objectSortKeys : false,
|
|
14044
|
+
quotesOnKeys: (_props_quotesOnKeys = props.quotesOnKeys) !== null && _props_quotesOnKeys !== void 0 ? _props_quotesOnKeys : true,
|
|
14045
|
+
displayDataTypes: (_props_displayDataTypes = props.displayDataTypes) !== null && _props_displayDataTypes !== void 0 ? _props_displayDataTypes : true,
|
|
14046
|
+
displaySize: (_props_displaySize = props.displaySize) !== null && _props_displaySize !== void 0 ? _props_displaySize : true,
|
|
14047
|
+
displayComma: (_props_displayComma = props.displayComma) !== null && _props_displayComma !== void 0 ? _props_displayComma : false,
|
|
14048
|
+
highlightUpdates: (_props_highlightUpdates = props.highlightUpdates) !== null && _props_highlightUpdates !== void 0 ? _props_highlightUpdates : false,
|
|
14049
|
+
// internal state
|
|
14050
|
+
inspectCache: {},
|
|
14051
|
+
hoverPath: null,
|
|
14052
|
+
colorspace: lightColorspace,
|
|
14053
|
+
value: props.value,
|
|
14054
|
+
prevValue: void 0,
|
|
14055
|
+
getInspectCache: (path, nestedIndex) => {
|
|
14056
|
+
const target = nestedIndex !== void 0 ? path.join(".") + "[".concat(nestedIndex, "]nt") : path.join(".");
|
|
14057
|
+
return get().inspectCache[target];
|
|
14058
|
+
},
|
|
14059
|
+
setInspectCache: (path, action, nestedIndex) => {
|
|
14060
|
+
const target = nestedIndex !== void 0 ? path.join(".") + "[".concat(nestedIndex, "]nt") : path.join(".");
|
|
14061
|
+
set((state) => ({
|
|
14062
|
+
inspectCache: {
|
|
14063
|
+
...state.inspectCache,
|
|
14064
|
+
[target]: typeof action === "function" ? action(state.inspectCache[target]) : action
|
|
14065
|
+
}
|
|
14066
|
+
}));
|
|
14067
|
+
},
|
|
14068
|
+
setHover: (path, nestedIndex) => {
|
|
14069
|
+
set({
|
|
14070
|
+
hoverPath: path ? {
|
|
14071
|
+
path,
|
|
14072
|
+
nestedIndex
|
|
14073
|
+
} : null
|
|
14074
|
+
});
|
|
14075
|
+
}
|
|
14076
|
+
};
|
|
14077
|
+
});
|
|
14078
|
+
};
|
|
14079
|
+
var JsonViewerStoreContext = (0, import_react48.createContext)(void 0);
|
|
14080
|
+
JsonViewerStoreContext.Provider;
|
|
14081
|
+
var useJsonViewerStore = (selector2, equalityFn) => {
|
|
14082
|
+
const store = (0, import_react48.useContext)(JsonViewerStoreContext);
|
|
14083
|
+
return (0, import_zustand.useStore)(store, selector2, equalityFn);
|
|
14084
|
+
};
|
|
14085
|
+
var useTextColor = () => {
|
|
14086
|
+
return useJsonViewerStore((store) => store.colorspace.base07);
|
|
14087
|
+
};
|
|
14088
|
+
var objectCtorString = Object.prototype.constructor.toString();
|
|
14089
|
+
function isPlainObject(value) {
|
|
14090
|
+
if (!value || typeof value !== "object") return false;
|
|
14091
|
+
const proto = Object.getPrototypeOf(value);
|
|
14092
|
+
if (proto === null) return true;
|
|
14093
|
+
const Ctor = Object.hasOwnProperty.call(proto, "constructor") && proto.constructor;
|
|
14094
|
+
if (Ctor === Object) return true;
|
|
14095
|
+
return typeof Ctor === "function" && Function.toString.call(Ctor) === objectCtorString;
|
|
14096
|
+
}
|
|
14097
|
+
var isCycleReference = (root, path, value) => {
|
|
14098
|
+
if (root === null || value === null) {
|
|
14099
|
+
return false;
|
|
13861
14100
|
}
|
|
13862
|
-
if (
|
|
13863
|
-
return
|
|
14101
|
+
if (typeof root !== "object") {
|
|
14102
|
+
return false;
|
|
13864
14103
|
}
|
|
13865
|
-
if (
|
|
13866
|
-
return
|
|
14104
|
+
if (typeof value !== "object") {
|
|
14105
|
+
return false;
|
|
13867
14106
|
}
|
|
13868
|
-
|
|
13869
|
-
|
|
13870
|
-
|
|
13871
|
-
|
|
13872
|
-
|
|
13873
|
-
|
|
13874
|
-
|
|
13875
|
-
|
|
13876
|
-
|
|
13877
|
-
|
|
13878
|
-
|
|
13879
|
-
return "Implicitly Allowed";
|
|
14107
|
+
if (Object.is(root, value) && path.length !== 0) {
|
|
14108
|
+
return "";
|
|
14109
|
+
}
|
|
14110
|
+
const currentPath = [];
|
|
14111
|
+
const arr = [
|
|
14112
|
+
...path
|
|
14113
|
+
];
|
|
14114
|
+
let currentRoot = root;
|
|
14115
|
+
while (currentRoot !== value || arr.length !== 0) {
|
|
14116
|
+
if (typeof currentRoot !== "object" || currentRoot === null) {
|
|
14117
|
+
return false;
|
|
13880
14118
|
}
|
|
13881
|
-
|
|
13882
|
-
return
|
|
14119
|
+
if (Object.is(currentRoot, value)) {
|
|
14120
|
+
return currentPath.reduce((path2, value2, currentIndex) => {
|
|
14121
|
+
if (typeof value2 === "number") {
|
|
14122
|
+
return path2 + "[".concat(value2, "]");
|
|
14123
|
+
}
|
|
14124
|
+
return path2 + "".concat(currentIndex === 0 ? "" : ".").concat(value2);
|
|
14125
|
+
}, "");
|
|
13883
14126
|
}
|
|
14127
|
+
const target = arr.shift();
|
|
14128
|
+
currentPath.push(target);
|
|
14129
|
+
currentRoot = currentRoot[target];
|
|
14130
|
+
}
|
|
14131
|
+
return false;
|
|
14132
|
+
};
|
|
14133
|
+
function getValueSize(value) {
|
|
14134
|
+
if (value === null || void 0) {
|
|
14135
|
+
return 0;
|
|
14136
|
+
} else if (Array.isArray(value)) {
|
|
14137
|
+
return value.length;
|
|
14138
|
+
} else if (value instanceof Map || value instanceof Set) {
|
|
14139
|
+
return value.size;
|
|
14140
|
+
} else if (value instanceof Date) {
|
|
14141
|
+
return 1;
|
|
14142
|
+
} else if (typeof value === "object") {
|
|
14143
|
+
return Object.keys(value).length;
|
|
14144
|
+
} else if (typeof value === "string") {
|
|
14145
|
+
return value.length;
|
|
13884
14146
|
}
|
|
14147
|
+
return 1;
|
|
13885
14148
|
}
|
|
13886
|
-
function
|
|
13887
|
-
|
|
13888
|
-
|
|
13889
|
-
|
|
13890
|
-
|
|
13891
|
-
|
|
13892
|
-
case "explicitly_denied": {
|
|
13893
|
-
return "error.main";
|
|
13894
|
-
}
|
|
13895
|
-
case "implicitly_denied": {
|
|
13896
|
-
return "warning.main";
|
|
13897
|
-
}
|
|
14149
|
+
function segmentArray(arr, size) {
|
|
14150
|
+
const result = [];
|
|
14151
|
+
let index = 0;
|
|
14152
|
+
while (index < arr.length) {
|
|
14153
|
+
result.push(arr.slice(index, index + size));
|
|
14154
|
+
index += size;
|
|
13898
14155
|
}
|
|
14156
|
+
return result;
|
|
13899
14157
|
}
|
|
13900
|
-
function
|
|
13901
|
-
|
|
13902
|
-
|
|
13903
|
-
|
|
13904
|
-
|
|
13905
|
-
|
|
13906
|
-
|
|
13907
|
-
|
|
13908
|
-
|
|
13909
|
-
|
|
14158
|
+
function safeStringify(obj, space) {
|
|
14159
|
+
const seenValues = [];
|
|
14160
|
+
function replacer(key, value) {
|
|
14161
|
+
if (typeof value === "bigint") return value.toString();
|
|
14162
|
+
if (value instanceof Map) {
|
|
14163
|
+
if ("toJSON" in value && typeof value.toJSON === "function") return value.toJSON();
|
|
14164
|
+
if (value.size === 0) return {};
|
|
14165
|
+
if (seenValues.includes(value)) return "[Circular]";
|
|
14166
|
+
seenValues.push(value);
|
|
14167
|
+
const entries = Array.from(value.entries());
|
|
14168
|
+
if (entries.every((param) => {
|
|
14169
|
+
let [key2] = param;
|
|
14170
|
+
return typeof key2 === "string" || typeof key2 === "number";
|
|
14171
|
+
})) {
|
|
14172
|
+
return Object.fromEntries(entries);
|
|
13910
14173
|
}
|
|
14174
|
+
return {};
|
|
13911
14175
|
}
|
|
13912
|
-
if (
|
|
13913
|
-
|
|
13914
|
-
|
|
13915
|
-
|
|
14176
|
+
if (value instanceof Set) {
|
|
14177
|
+
if ("toJSON" in value && typeof value.toJSON === "function") return value.toJSON();
|
|
14178
|
+
if (seenValues.includes(value)) return "[Circular]";
|
|
14179
|
+
seenValues.push(value);
|
|
14180
|
+
return Array.from(value.values());
|
|
14181
|
+
}
|
|
14182
|
+
if (typeof value === "object" && value !== null && Object.keys(value).length) {
|
|
14183
|
+
const stackSize = seenValues.length;
|
|
14184
|
+
if (stackSize) {
|
|
14185
|
+
for (let n2 = stackSize - 1; n2 >= 0 && seenValues[n2][key] !== value; --n2) {
|
|
14186
|
+
seenValues.pop();
|
|
14187
|
+
}
|
|
14188
|
+
if (seenValues.includes(value)) return "[Circular]";
|
|
13916
14189
|
}
|
|
14190
|
+
seenValues.push(value);
|
|
13917
14191
|
}
|
|
13918
|
-
|
|
13919
|
-
|
|
13920
|
-
|
|
13921
|
-
|
|
13922
|
-
|
|
14192
|
+
return value;
|
|
14193
|
+
}
|
|
14194
|
+
return JSON.stringify(obj, replacer, space);
|
|
14195
|
+
}
|
|
14196
|
+
async function copyString(value) {
|
|
14197
|
+
if ("clipboard" in navigator) {
|
|
14198
|
+
try {
|
|
14199
|
+
await navigator.clipboard.writeText(value);
|
|
14200
|
+
} catch {
|
|
13923
14201
|
}
|
|
13924
|
-
return {
|
|
13925
|
-
details: {
|
|
13926
|
-
actions,
|
|
13927
|
-
explicitAllows: payload.explicit_allow_count,
|
|
13928
|
-
explicitDenies: payload.explicit_deny_count,
|
|
13929
|
-
implicitDenies: payload.implicit_deny_count,
|
|
13930
|
-
resources
|
|
13931
|
-
},
|
|
13932
|
-
operation: payload.operation,
|
|
13933
|
-
permission,
|
|
13934
|
-
principal: payload.principal_arn,
|
|
13935
|
-
service: payload.service
|
|
13936
|
-
};
|
|
13937
|
-
} catch (error) {
|
|
13938
|
-
console.error("Error parsing IAM event payload:", error);
|
|
13939
|
-
return void 0;
|
|
13940
14202
|
}
|
|
14203
|
+
(0, import_copy_to_clipboard.default)(value);
|
|
13941
14204
|
}
|
|
13942
|
-
|
|
13943
|
-
|
|
13944
|
-
|
|
13945
|
-
|
|
13946
|
-
|
|
13947
|
-
|
|
13948
|
-
|
|
13949
|
-
|
|
13950
|
-
|
|
13951
|
-
|
|
13952
|
-
|
|
13953
|
-
|
|
13954
|
-
|
|
13955
|
-
|
|
13956
|
-
|
|
13957
|
-
|
|
13958
|
-
|
|
13959
|
-
|
|
13960
|
-
|
|
13961
|
-
|
|
14205
|
+
function useClipboard() {
|
|
14206
|
+
let { timeout = 2e3 } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
14207
|
+
const [copied, setCopied] = (0, import_react48.useState)(false);
|
|
14208
|
+
const copyTimeout = (0, import_react48.useRef)(null);
|
|
14209
|
+
const handleCopyResult = (0, import_react48.useCallback)((value) => {
|
|
14210
|
+
const current = copyTimeout.current;
|
|
14211
|
+
if (current) {
|
|
14212
|
+
window.clearTimeout(current);
|
|
14213
|
+
}
|
|
14214
|
+
copyTimeout.current = window.setTimeout(() => setCopied(false), timeout);
|
|
14215
|
+
setCopied(value);
|
|
14216
|
+
}, [
|
|
14217
|
+
timeout
|
|
14218
|
+
]);
|
|
14219
|
+
const onCopy = useJsonViewerStore((store) => store.onCopy);
|
|
14220
|
+
const copy = (0, import_react48.useCallback)(async (path, value) => {
|
|
14221
|
+
if (typeof onCopy === "function") {
|
|
14222
|
+
try {
|
|
14223
|
+
await onCopy(path, value, copyString);
|
|
14224
|
+
handleCopyResult(true);
|
|
14225
|
+
} catch (error) {
|
|
14226
|
+
console.error("error when copy ".concat(path.length === 0 ? "src" : "src[".concat(path.join(".")), "]"), error);
|
|
13962
14227
|
}
|
|
13963
|
-
|
|
13964
|
-
|
|
14228
|
+
} else {
|
|
14229
|
+
try {
|
|
14230
|
+
const valueToCopy = safeStringify(typeof value === "function" ? value.toString() : value, " ");
|
|
14231
|
+
await copyString(valueToCopy);
|
|
14232
|
+
handleCopyResult(true);
|
|
14233
|
+
} catch (error) {
|
|
14234
|
+
console.error("error when copy ".concat(path.length === 0 ? "src" : "src[".concat(path.join(".")), "]"), error);
|
|
13965
14235
|
}
|
|
13966
|
-
return {
|
|
13967
|
-
details: detailsParts.join("\n"),
|
|
13968
|
-
headline: headline2,
|
|
13969
|
-
message: messageParts.join("\n")
|
|
13970
|
-
};
|
|
13971
14236
|
}
|
|
13972
|
-
}
|
|
13973
|
-
|
|
13974
|
-
|
|
13975
|
-
|
|
13976
|
-
|
|
13977
|
-
|
|
13978
|
-
|
|
13979
|
-
|
|
13980
|
-
const message = typeof attributes?.message === "string" ? attributes.message : "";
|
|
13981
|
-
const details = JSON.stringify(attributes ?? {}, void 0, 2);
|
|
13982
|
-
return { details, headline, message };
|
|
13983
|
-
};
|
|
13984
|
-
var eventParsers = {
|
|
13985
|
-
"iam.error": iamEventParser,
|
|
13986
|
-
"iam.event": iamEventParser,
|
|
13987
|
-
"iam.warning": iamEventParser
|
|
13988
|
-
};
|
|
13989
|
-
var parseEventMessage = (event) => {
|
|
13990
|
-
if (event.event_type && event.name) {
|
|
13991
|
-
try {
|
|
13992
|
-
const parser = eventParsers[event.event_type] ?? defaultEventParser;
|
|
13993
|
-
return parser(event.name, event.attributes);
|
|
13994
|
-
} catch (error) {
|
|
13995
|
-
console.error(`Error parsing event for type ${event.event_type}:`, error);
|
|
13996
|
-
return {
|
|
13997
|
-
details: "",
|
|
13998
|
-
headline: event.name || "Unknown Event",
|
|
13999
|
-
message: JSON.stringify(event.attributes)
|
|
14000
|
-
};
|
|
14237
|
+
}, [
|
|
14238
|
+
handleCopyResult,
|
|
14239
|
+
onCopy
|
|
14240
|
+
]);
|
|
14241
|
+
const reset = (0, import_react48.useCallback)(() => {
|
|
14242
|
+
setCopied(false);
|
|
14243
|
+
if (copyTimeout.current) {
|
|
14244
|
+
clearTimeout(copyTimeout.current);
|
|
14001
14245
|
}
|
|
14002
|
-
}
|
|
14246
|
+
}, []);
|
|
14003
14247
|
return {
|
|
14004
|
-
|
|
14005
|
-
|
|
14006
|
-
|
|
14248
|
+
copy,
|
|
14249
|
+
reset,
|
|
14250
|
+
copied
|
|
14007
14251
|
};
|
|
14008
|
-
}
|
|
14009
|
-
|
|
14010
|
-
|
|
14011
|
-
|
|
14012
|
-
|
|
14013
|
-
|
|
14014
|
-
|
|
14015
|
-
|
|
14016
|
-
|
|
14017
|
-
|
|
14018
|
-
|
|
14019
|
-
|
|
14020
|
-
|
|
14021
|
-
|
|
14022
|
-
|
|
14023
|
-
|
|
14024
|
-
|
|
14025
|
-
|
|
14026
|
-
|
|
14027
|
-
|
|
14028
|
-
for (const event of events) {
|
|
14029
|
-
const group4 = getEventGroup(event.event_type);
|
|
14030
|
-
switch (group4) {
|
|
14031
|
-
case "error": {
|
|
14032
|
-
groups.errors = [...groups.errors ?? [], event];
|
|
14033
|
-
break;
|
|
14034
|
-
}
|
|
14035
|
-
case "permission": {
|
|
14036
|
-
groups.permissions = [...groups.permissions ?? [], event];
|
|
14037
|
-
break;
|
|
14038
|
-
}
|
|
14039
|
-
case "warning": {
|
|
14040
|
-
groups.warnings = [...groups.warnings ?? [], event];
|
|
14041
|
-
break;
|
|
14042
|
-
}
|
|
14043
|
-
default: {
|
|
14044
|
-
groups.info = [...groups.info ?? [], event];
|
|
14045
|
-
}
|
|
14252
|
+
}
|
|
14253
|
+
function useIsCycleReference(path, value) {
|
|
14254
|
+
const rootValue = useJsonViewerStore((store) => store.value);
|
|
14255
|
+
return (0, import_react48.useMemo)(() => isCycleReference(rootValue, path, value), [
|
|
14256
|
+
path,
|
|
14257
|
+
value,
|
|
14258
|
+
rootValue
|
|
14259
|
+
]);
|
|
14260
|
+
}
|
|
14261
|
+
function useInspect(path, value, nestedIndex) {
|
|
14262
|
+
const depth = path.length;
|
|
14263
|
+
const isTrap = useIsCycleReference(path, value);
|
|
14264
|
+
const getInspectCache = useJsonViewerStore((store) => store.getInspectCache);
|
|
14265
|
+
const setInspectCache = useJsonViewerStore((store) => store.setInspectCache);
|
|
14266
|
+
const defaultInspectDepth = useJsonViewerStore((store) => store.defaultInspectDepth);
|
|
14267
|
+
const defaultInspectControl = useJsonViewerStore((store) => store.defaultInspectControl);
|
|
14268
|
+
(0, import_react48.useEffect)(() => {
|
|
14269
|
+
const inspect2 = getInspectCache(path, nestedIndex);
|
|
14270
|
+
if (inspect2 !== void 0) {
|
|
14271
|
+
return;
|
|
14046
14272
|
}
|
|
14047
|
-
|
|
14048
|
-
|
|
14049
|
-
|
|
14050
|
-
|
|
14051
|
-
|
|
14052
|
-
|
|
14053
|
-
|
|
14054
|
-
|
|
14055
|
-
|
|
14056
|
-
|
|
14057
|
-
|
|
14058
|
-
|
|
14273
|
+
if (nestedIndex !== void 0) {
|
|
14274
|
+
setInspectCache(path, false, nestedIndex);
|
|
14275
|
+
return;
|
|
14276
|
+
}
|
|
14277
|
+
const shouldInspect = isTrap ? false : typeof defaultInspectControl === "function" ? defaultInspectControl(path, value) : depth < defaultInspectDepth;
|
|
14278
|
+
setInspectCache(path, shouldInspect);
|
|
14279
|
+
}, [
|
|
14280
|
+
defaultInspectDepth,
|
|
14281
|
+
defaultInspectControl,
|
|
14282
|
+
depth,
|
|
14283
|
+
getInspectCache,
|
|
14284
|
+
isTrap,
|
|
14285
|
+
nestedIndex,
|
|
14286
|
+
path,
|
|
14287
|
+
value,
|
|
14288
|
+
setInspectCache
|
|
14289
|
+
]);
|
|
14290
|
+
const [inspect, set] = (0, import_react48.useState)(() => {
|
|
14291
|
+
const shouldInspect = getInspectCache(path, nestedIndex);
|
|
14292
|
+
if (shouldInspect !== void 0) {
|
|
14293
|
+
return shouldInspect;
|
|
14294
|
+
}
|
|
14295
|
+
if (nestedIndex !== void 0) {
|
|
14296
|
+
return false;
|
|
14297
|
+
}
|
|
14298
|
+
return isTrap ? false : typeof defaultInspectControl === "function" ? defaultInspectControl(path, value) : depth < defaultInspectDepth;
|
|
14299
|
+
});
|
|
14300
|
+
const setInspect = (0, import_react48.useCallback)((apply) => {
|
|
14301
|
+
set((oldState) => {
|
|
14302
|
+
const newState = typeof apply === "boolean" ? apply : apply(oldState);
|
|
14303
|
+
setInspectCache(path, newState, nestedIndex);
|
|
14304
|
+
return newState;
|
|
14305
|
+
});
|
|
14306
|
+
}, [
|
|
14307
|
+
nestedIndex,
|
|
14308
|
+
path,
|
|
14309
|
+
setInspectCache
|
|
14310
|
+
]);
|
|
14311
|
+
return [
|
|
14312
|
+
inspect,
|
|
14313
|
+
setInspect
|
|
14314
|
+
];
|
|
14315
|
+
}
|
|
14316
|
+
var DataBox = (props) => /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_material7.Box, {
|
|
14317
|
+
component: "div",
|
|
14318
|
+
...props,
|
|
14319
|
+
sx: {
|
|
14320
|
+
display: "inline-block",
|
|
14321
|
+
...props.sx
|
|
14322
|
+
}
|
|
14323
|
+
});
|
|
14324
|
+
var DataTypeLabel = (param) => {
|
|
14325
|
+
let { dataType, enable = true } = param;
|
|
14326
|
+
if (!enable) return null;
|
|
14327
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(DataBox, {
|
|
14328
|
+
className: "data-type-label",
|
|
14329
|
+
sx: {
|
|
14330
|
+
mx: 0.5,
|
|
14331
|
+
fontSize: "0.7rem",
|
|
14332
|
+
opacity: 0.8,
|
|
14333
|
+
userSelect: "none"
|
|
14334
|
+
},
|
|
14335
|
+
children: dataType
|
|
14336
|
+
});
|
|
14337
|
+
};
|
|
14338
|
+
function defineEasyType(param) {
|
|
14339
|
+
let { is, serialize, deserialize, type, colorKey, displayTypeLabel = true, Renderer } = param;
|
|
14340
|
+
const Render = /* @__PURE__ */ (0, import_react48.memo)(Renderer);
|
|
14341
|
+
const EasyType = (props) => {
|
|
14342
|
+
const storeDisplayDataTypes = useJsonViewerStore((store) => store.displayDataTypes);
|
|
14343
|
+
const color2 = useJsonViewerStore((store) => store.colorspace[colorKey]);
|
|
14344
|
+
const onSelect = useJsonViewerStore((store) => store.onSelect);
|
|
14345
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(DataBox, {
|
|
14346
|
+
onClick: () => onSelect === null || onSelect === void 0 ? void 0 : onSelect(props.path, props.value),
|
|
14059
14347
|
sx: {
|
|
14060
|
-
|
|
14061
|
-
borderBottom: "1px solid",
|
|
14062
|
-
borderColor: "divider",
|
|
14063
|
-
display: "flex",
|
|
14064
|
-
justifyContent: "space-between",
|
|
14065
|
-
p: 2
|
|
14348
|
+
color: color2
|
|
14066
14349
|
},
|
|
14067
14350
|
children: [
|
|
14068
|
-
/* @__PURE__ */ (0, import_jsx_runtime129.
|
|
14069
|
-
|
|
14070
|
-
|
|
14071
|
-
|
|
14072
|
-
|
|
14073
|
-
|
|
14074
|
-
|
|
14075
|
-
|
|
14076
|
-
|
|
14077
|
-
|
|
14351
|
+
displayTypeLabel && storeDisplayDataTypes && /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(DataTypeLabel, {
|
|
14352
|
+
dataType: type
|
|
14353
|
+
}),
|
|
14354
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)(DataBox, {
|
|
14355
|
+
className: "".concat(type, "-value"),
|
|
14356
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(Render, {
|
|
14357
|
+
path: props.path,
|
|
14358
|
+
inspect: props.inspect,
|
|
14359
|
+
setInspect: props.setInspect,
|
|
14360
|
+
value: props.value,
|
|
14361
|
+
prevValue: props.prevValue
|
|
14362
|
+
})
|
|
14363
|
+
})
|
|
14364
|
+
]
|
|
14365
|
+
});
|
|
14366
|
+
};
|
|
14367
|
+
EasyType.displayName = "easy-".concat(type, "-type");
|
|
14368
|
+
if (!serialize || !deserialize) {
|
|
14369
|
+
return {
|
|
14370
|
+
is,
|
|
14371
|
+
Component: EasyType
|
|
14372
|
+
};
|
|
14373
|
+
}
|
|
14374
|
+
const EasyTypeEditor = (param2) => {
|
|
14375
|
+
let { value, setValue, abortEditing, commitEditing } = param2;
|
|
14376
|
+
const color2 = useJsonViewerStore((store) => store.colorspace[colorKey]);
|
|
14377
|
+
const handleKeyDown = (0, import_react48.useCallback)((event) => {
|
|
14378
|
+
if (event.key === "Enter") {
|
|
14379
|
+
event.preventDefault();
|
|
14380
|
+
commitEditing(value);
|
|
14381
|
+
}
|
|
14382
|
+
if (event.key === "Escape") {
|
|
14383
|
+
event.preventDefault();
|
|
14384
|
+
abortEditing();
|
|
14385
|
+
}
|
|
14386
|
+
}, [
|
|
14387
|
+
abortEditing,
|
|
14388
|
+
commitEditing,
|
|
14389
|
+
value
|
|
14390
|
+
]);
|
|
14391
|
+
const handleChange = (0, import_react48.useCallback)((event) => {
|
|
14392
|
+
setValue(event.target.value);
|
|
14393
|
+
}, [
|
|
14394
|
+
setValue
|
|
14395
|
+
]);
|
|
14396
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_material7.InputBase, {
|
|
14397
|
+
autoFocus: true,
|
|
14398
|
+
value,
|
|
14399
|
+
onChange: handleChange,
|
|
14400
|
+
onKeyDown: handleKeyDown,
|
|
14401
|
+
size: "small",
|
|
14402
|
+
multiline: true,
|
|
14403
|
+
sx: {
|
|
14404
|
+
color: color2,
|
|
14405
|
+
padding: 0.5,
|
|
14406
|
+
borderStyle: "solid",
|
|
14407
|
+
borderColor: "black",
|
|
14408
|
+
borderWidth: 1,
|
|
14409
|
+
fontSize: "0.8rem",
|
|
14410
|
+
fontFamily: "monospace",
|
|
14411
|
+
display: "inline-flex"
|
|
14412
|
+
}
|
|
14413
|
+
});
|
|
14414
|
+
};
|
|
14415
|
+
EasyTypeEditor.displayName = "easy-".concat(type, "-type-editor");
|
|
14416
|
+
return {
|
|
14417
|
+
is,
|
|
14418
|
+
serialize,
|
|
14419
|
+
deserialize,
|
|
14420
|
+
Component: EasyType,
|
|
14421
|
+
Editor: EasyTypeEditor
|
|
14422
|
+
};
|
|
14423
|
+
}
|
|
14424
|
+
var booleanType = defineEasyType({
|
|
14425
|
+
is: (value) => typeof value === "boolean",
|
|
14426
|
+
type: "bool",
|
|
14427
|
+
colorKey: "base0E",
|
|
14428
|
+
serialize: (value) => value.toString(),
|
|
14429
|
+
deserialize: (value) => {
|
|
14430
|
+
if (value === "true") return true;
|
|
14431
|
+
if (value === "false") return false;
|
|
14432
|
+
throw new Error("Invalid boolean value");
|
|
14433
|
+
},
|
|
14434
|
+
Renderer: (param) => {
|
|
14435
|
+
let { value } = param;
|
|
14436
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_jsx_runtime129.Fragment, {
|
|
14437
|
+
children: value ? "true" : "false"
|
|
14438
|
+
});
|
|
14439
|
+
}
|
|
14440
|
+
});
|
|
14441
|
+
var displayOptions = {
|
|
14442
|
+
weekday: "short",
|
|
14443
|
+
year: "numeric",
|
|
14444
|
+
month: "short",
|
|
14445
|
+
day: "numeric",
|
|
14446
|
+
hour: "2-digit",
|
|
14447
|
+
minute: "2-digit"
|
|
14448
|
+
};
|
|
14449
|
+
var dateType = defineEasyType({
|
|
14450
|
+
is: (value) => value instanceof Date,
|
|
14451
|
+
type: "date",
|
|
14452
|
+
colorKey: "base0D",
|
|
14453
|
+
Renderer: (param) => {
|
|
14454
|
+
let { value } = param;
|
|
14455
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_jsx_runtime129.Fragment, {
|
|
14456
|
+
children: value.toLocaleTimeString("en-us", displayOptions)
|
|
14457
|
+
});
|
|
14458
|
+
}
|
|
14459
|
+
});
|
|
14460
|
+
var functionBody = (func) => {
|
|
14461
|
+
const funcString = func.toString();
|
|
14462
|
+
let isUsualFunction = true;
|
|
14463
|
+
const parenthesisPos = funcString.indexOf(")");
|
|
14464
|
+
const arrowPos = funcString.indexOf("=>");
|
|
14465
|
+
if (arrowPos !== -1 && arrowPos > parenthesisPos) {
|
|
14466
|
+
isUsualFunction = false;
|
|
14467
|
+
}
|
|
14468
|
+
if (isUsualFunction) {
|
|
14469
|
+
return funcString.substring(funcString.indexOf("{", parenthesisPos) + 1, funcString.lastIndexOf("}"));
|
|
14470
|
+
}
|
|
14471
|
+
return funcString.substring(funcString.indexOf("=>") + 2);
|
|
14472
|
+
};
|
|
14473
|
+
var functionName = (func) => {
|
|
14474
|
+
const funcString = func.toString();
|
|
14475
|
+
const isUsualFunction = funcString.indexOf("function") !== -1;
|
|
14476
|
+
if (isUsualFunction) {
|
|
14477
|
+
return funcString.substring(8, funcString.indexOf("{")).trim();
|
|
14478
|
+
}
|
|
14479
|
+
return funcString.substring(0, funcString.indexOf("=>") + 2).trim();
|
|
14480
|
+
};
|
|
14481
|
+
var lb = "{";
|
|
14482
|
+
var rb = "}";
|
|
14483
|
+
var PreFunctionType = (props) => {
|
|
14484
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(import_material7.NoSsr, {
|
|
14485
|
+
children: [
|
|
14486
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)(DataTypeLabel, {
|
|
14487
|
+
dataType: "function"
|
|
14488
|
+
}),
|
|
14489
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(import_material7.Box, {
|
|
14490
|
+
component: "span",
|
|
14491
|
+
className: "data-function-start",
|
|
14492
|
+
sx: {
|
|
14493
|
+
letterSpacing: 0.5
|
|
14494
|
+
},
|
|
14495
|
+
children: [
|
|
14496
|
+
functionName(props.value),
|
|
14497
|
+
" ",
|
|
14498
|
+
lb
|
|
14499
|
+
]
|
|
14500
|
+
})
|
|
14501
|
+
]
|
|
14502
|
+
});
|
|
14503
|
+
};
|
|
14504
|
+
var PostFunctionType = () => {
|
|
14505
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_material7.NoSsr, {
|
|
14506
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_material7.Box, {
|
|
14507
|
+
component: "span",
|
|
14508
|
+
className: "data-function-end",
|
|
14509
|
+
children: rb
|
|
14510
|
+
})
|
|
14511
|
+
});
|
|
14512
|
+
};
|
|
14513
|
+
var FunctionType = (props) => {
|
|
14514
|
+
const functionColor = useJsonViewerStore((store) => store.colorspace.base05);
|
|
14515
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_material7.NoSsr, {
|
|
14516
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_material7.Box, {
|
|
14517
|
+
className: "data-function",
|
|
14518
|
+
sx: {
|
|
14519
|
+
display: props.inspect ? "block" : "inline-block",
|
|
14520
|
+
pl: props.inspect ? 2 : 0,
|
|
14521
|
+
color: functionColor
|
|
14522
|
+
},
|
|
14523
|
+
children: props.inspect ? functionBody(props.value) : /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_material7.Box, {
|
|
14524
|
+
component: "span",
|
|
14525
|
+
className: "data-function-body",
|
|
14526
|
+
onClick: () => props.setInspect(true),
|
|
14527
|
+
sx: {
|
|
14528
|
+
"&:hover": {
|
|
14529
|
+
cursor: "pointer"
|
|
14530
|
+
},
|
|
14531
|
+
padding: 0.5
|
|
14532
|
+
},
|
|
14533
|
+
children: "\u2026"
|
|
14534
|
+
})
|
|
14535
|
+
})
|
|
14536
|
+
});
|
|
14537
|
+
};
|
|
14538
|
+
var functionType = {
|
|
14539
|
+
is: (value) => typeof value === "function",
|
|
14540
|
+
Component: FunctionType,
|
|
14541
|
+
PreComponent: PreFunctionType,
|
|
14542
|
+
PostComponent: PostFunctionType
|
|
14543
|
+
};
|
|
14544
|
+
var nullType = defineEasyType({
|
|
14545
|
+
is: (value) => value === null,
|
|
14546
|
+
type: "null",
|
|
14547
|
+
colorKey: "base08",
|
|
14548
|
+
displayTypeLabel: false,
|
|
14549
|
+
Renderer: () => {
|
|
14550
|
+
const backgroundColor = useJsonViewerStore((store) => store.colorspace.base02);
|
|
14551
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_material7.Box, {
|
|
14552
|
+
sx: {
|
|
14553
|
+
fontSize: "0.8rem",
|
|
14554
|
+
backgroundColor,
|
|
14555
|
+
fontWeight: "bold",
|
|
14556
|
+
borderRadius: "3px",
|
|
14557
|
+
padding: "0.5px 2px"
|
|
14558
|
+
},
|
|
14559
|
+
children: "NULL"
|
|
14560
|
+
});
|
|
14561
|
+
}
|
|
14562
|
+
});
|
|
14563
|
+
var isInt = (n2) => n2 % 1 === 0;
|
|
14564
|
+
var nanType = defineEasyType({
|
|
14565
|
+
is: (value) => typeof value === "number" && isNaN(value),
|
|
14566
|
+
type: "NaN",
|
|
14567
|
+
colorKey: "base08",
|
|
14568
|
+
displayTypeLabel: false,
|
|
14569
|
+
serialize: () => "NaN",
|
|
14570
|
+
// allow deserialize the value back to number
|
|
14571
|
+
deserialize: (value) => parseFloat(value),
|
|
14572
|
+
Renderer: () => {
|
|
14573
|
+
const backgroundColor = useJsonViewerStore((store) => store.colorspace.base02);
|
|
14574
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_material7.Box, {
|
|
14575
|
+
sx: {
|
|
14576
|
+
backgroundColor,
|
|
14577
|
+
fontSize: "0.8rem",
|
|
14578
|
+
fontWeight: "bold",
|
|
14579
|
+
borderRadius: "3px",
|
|
14580
|
+
padding: "0.5px 2px"
|
|
14581
|
+
},
|
|
14582
|
+
children: "NaN"
|
|
14583
|
+
});
|
|
14584
|
+
}
|
|
14585
|
+
});
|
|
14586
|
+
var floatType = defineEasyType({
|
|
14587
|
+
is: (value) => typeof value === "number" && !isInt(value) && !isNaN(value),
|
|
14588
|
+
type: "float",
|
|
14589
|
+
colorKey: "base0B",
|
|
14590
|
+
serialize: (value) => value.toString(),
|
|
14591
|
+
deserialize: (value) => parseFloat(value),
|
|
14592
|
+
Renderer: (param) => {
|
|
14593
|
+
let { value } = param;
|
|
14594
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_jsx_runtime129.Fragment, {
|
|
14595
|
+
children: value
|
|
14596
|
+
});
|
|
14597
|
+
}
|
|
14598
|
+
});
|
|
14599
|
+
var intType = defineEasyType({
|
|
14600
|
+
is: (value) => typeof value === "number" && isInt(value),
|
|
14601
|
+
type: "int",
|
|
14602
|
+
colorKey: "base0F",
|
|
14603
|
+
serialize: (value) => value.toString(),
|
|
14604
|
+
// allow deserialize the value to float
|
|
14605
|
+
deserialize: (value) => parseFloat(value),
|
|
14606
|
+
Renderer: (param) => {
|
|
14607
|
+
let { value } = param;
|
|
14608
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_jsx_runtime129.Fragment, {
|
|
14609
|
+
children: value
|
|
14610
|
+
});
|
|
14611
|
+
}
|
|
14612
|
+
});
|
|
14613
|
+
var bigIntType = defineEasyType({
|
|
14614
|
+
is: (value) => typeof value === "bigint",
|
|
14615
|
+
type: "bigint",
|
|
14616
|
+
colorKey: "base0F",
|
|
14617
|
+
serialize: (value) => value.toString(),
|
|
14618
|
+
deserialize: (value) => BigInt(value.replace(/\D/g, "")),
|
|
14619
|
+
Renderer: (param) => {
|
|
14620
|
+
let { value } = param;
|
|
14621
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_jsx_runtime129.Fragment, {
|
|
14622
|
+
children: "".concat(value, "n")
|
|
14623
|
+
});
|
|
14624
|
+
}
|
|
14625
|
+
});
|
|
14626
|
+
var BaseIcon = (param) => {
|
|
14627
|
+
let { d: d2, ...props } = param;
|
|
14628
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_material7.SvgIcon, {
|
|
14629
|
+
...props,
|
|
14630
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)("path", {
|
|
14631
|
+
d: d2
|
|
14632
|
+
})
|
|
14633
|
+
});
|
|
14634
|
+
};
|
|
14635
|
+
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";
|
|
14636
|
+
var Check = "M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z";
|
|
14637
|
+
var ChevronRight = "M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z";
|
|
14638
|
+
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";
|
|
14639
|
+
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";
|
|
14640
|
+
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";
|
|
14641
|
+
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";
|
|
14642
|
+
var ExpandMore = "M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z";
|
|
14643
|
+
var Delete = "M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM8 9h8v10H8zm7.5-5l-1-1h-5l-1 1H5v2h14V4z";
|
|
14644
|
+
var AddBoxIcon = (props) => {
|
|
14645
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(BaseIcon, {
|
|
14646
|
+
d: AddBox,
|
|
14647
|
+
...props
|
|
14648
|
+
});
|
|
14649
|
+
};
|
|
14650
|
+
var CheckIcon = (props) => {
|
|
14651
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(BaseIcon, {
|
|
14652
|
+
d: Check,
|
|
14653
|
+
...props
|
|
14654
|
+
});
|
|
14655
|
+
};
|
|
14656
|
+
var ChevronRightIcon = (props) => {
|
|
14657
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(BaseIcon, {
|
|
14658
|
+
d: ChevronRight,
|
|
14659
|
+
...props
|
|
14660
|
+
});
|
|
14661
|
+
};
|
|
14662
|
+
var CircularArrowsIcon = (props) => {
|
|
14663
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(BaseIcon, {
|
|
14664
|
+
d: CircularArrows,
|
|
14665
|
+
...props
|
|
14666
|
+
});
|
|
14667
|
+
};
|
|
14668
|
+
var CloseIcon = (props) => {
|
|
14669
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(BaseIcon, {
|
|
14670
|
+
d: Close,
|
|
14671
|
+
...props
|
|
14672
|
+
});
|
|
14673
|
+
};
|
|
14674
|
+
var ContentCopyIcon = (props) => {
|
|
14675
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(BaseIcon, {
|
|
14676
|
+
d: ContentCopy,
|
|
14677
|
+
...props
|
|
14678
|
+
});
|
|
14679
|
+
};
|
|
14680
|
+
var EditIcon = (props) => {
|
|
14681
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(BaseIcon, {
|
|
14682
|
+
d: Edit,
|
|
14683
|
+
...props
|
|
14684
|
+
});
|
|
14685
|
+
};
|
|
14686
|
+
var ExpandMoreIcon = (props) => {
|
|
14687
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(BaseIcon, {
|
|
14688
|
+
d: ExpandMore,
|
|
14689
|
+
...props
|
|
14690
|
+
});
|
|
14691
|
+
};
|
|
14692
|
+
var DeleteIcon = (props) => {
|
|
14693
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(BaseIcon, {
|
|
14694
|
+
d: Delete,
|
|
14695
|
+
...props
|
|
14696
|
+
});
|
|
14697
|
+
};
|
|
14698
|
+
var objectLb = "{";
|
|
14699
|
+
var arrayLb = "[";
|
|
14700
|
+
var objectRb = "}";
|
|
14701
|
+
var arrayRb = "]";
|
|
14702
|
+
function inspectMetadata(value) {
|
|
14703
|
+
const length = getValueSize(value);
|
|
14704
|
+
let name = "";
|
|
14705
|
+
if (value instanceof Map || value instanceof Set) {
|
|
14706
|
+
name = value[Symbol.toStringTag];
|
|
14707
|
+
}
|
|
14708
|
+
if (Object.prototype.hasOwnProperty.call(value, Symbol.toStringTag)) {
|
|
14709
|
+
name = value[Symbol.toStringTag];
|
|
14710
|
+
}
|
|
14711
|
+
return "".concat(length, " Items").concat(name ? " (".concat(name, ")") : "");
|
|
14712
|
+
}
|
|
14713
|
+
var PreObjectType = (props) => {
|
|
14714
|
+
const metadataColor = useJsonViewerStore((store) => store.colorspace.base04);
|
|
14715
|
+
const textColor = useTextColor();
|
|
14716
|
+
const isArrayLike = (0, import_react48.useMemo)(() => Array.isArray(props.value) || props.value instanceof Set, [
|
|
14717
|
+
props.value
|
|
14718
|
+
]);
|
|
14719
|
+
const isEmptyValue = (0, import_react48.useMemo)(() => getValueSize(props.value) === 0, [
|
|
14720
|
+
props.value
|
|
14721
|
+
]);
|
|
14722
|
+
const sizeOfValue = (0, import_react48.useMemo)(() => inspectMetadata(props.value), [
|
|
14723
|
+
props.value
|
|
14724
|
+
]);
|
|
14725
|
+
const displaySize = useJsonViewerStore((store) => store.displaySize);
|
|
14726
|
+
const shouldDisplaySize = (0, import_react48.useMemo)(() => typeof displaySize === "function" ? displaySize(props.path, props.value) : displaySize, [
|
|
14727
|
+
displaySize,
|
|
14728
|
+
props.path,
|
|
14729
|
+
props.value
|
|
14730
|
+
]);
|
|
14731
|
+
const isTrap = useIsCycleReference(props.path, props.value);
|
|
14732
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(import_material7.Box, {
|
|
14733
|
+
component: "span",
|
|
14734
|
+
className: "data-object-start",
|
|
14735
|
+
sx: {
|
|
14736
|
+
letterSpacing: 0.5
|
|
14737
|
+
},
|
|
14738
|
+
children: [
|
|
14739
|
+
isArrayLike ? arrayLb : objectLb,
|
|
14740
|
+
shouldDisplaySize && props.inspect && !isEmptyValue && /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_material7.Box, {
|
|
14741
|
+
component: "span",
|
|
14742
|
+
sx: {
|
|
14743
|
+
pl: 0.5,
|
|
14744
|
+
fontStyle: "italic",
|
|
14745
|
+
color: metadataColor,
|
|
14746
|
+
userSelect: "none"
|
|
14747
|
+
},
|
|
14748
|
+
children: sizeOfValue
|
|
14749
|
+
}),
|
|
14750
|
+
isTrap && !props.inspect && /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(import_jsx_runtime129.Fragment, {
|
|
14751
|
+
children: [
|
|
14752
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)(CircularArrowsIcon, {
|
|
14753
|
+
sx: {
|
|
14754
|
+
fontSize: 12,
|
|
14755
|
+
color: textColor,
|
|
14756
|
+
mx: 0.5
|
|
14757
|
+
}
|
|
14758
|
+
}),
|
|
14759
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)(DataBox, {
|
|
14760
|
+
sx: {
|
|
14761
|
+
cursor: "pointer",
|
|
14762
|
+
userSelect: "none"
|
|
14763
|
+
},
|
|
14764
|
+
children: isTrap
|
|
14765
|
+
})
|
|
14766
|
+
]
|
|
14767
|
+
})
|
|
14768
|
+
]
|
|
14769
|
+
});
|
|
14770
|
+
};
|
|
14771
|
+
var PostObjectType = (props) => {
|
|
14772
|
+
const metadataColor = useJsonViewerStore((store) => store.colorspace.base04);
|
|
14773
|
+
const textColor = useTextColor();
|
|
14774
|
+
const isArrayLike = (0, import_react48.useMemo)(() => Array.isArray(props.value) || props.value instanceof Set, [
|
|
14775
|
+
props.value
|
|
14776
|
+
]);
|
|
14777
|
+
const isEmptyValue = (0, import_react48.useMemo)(() => getValueSize(props.value) === 0, [
|
|
14778
|
+
props.value
|
|
14779
|
+
]);
|
|
14780
|
+
const sizeOfValue = (0, import_react48.useMemo)(() => inspectMetadata(props.value), [
|
|
14781
|
+
props.value
|
|
14782
|
+
]);
|
|
14783
|
+
const displaySize = useJsonViewerStore((store) => store.displaySize);
|
|
14784
|
+
const shouldDisplaySize = (0, import_react48.useMemo)(() => typeof displaySize === "function" ? displaySize(props.path, props.value) : displaySize, [
|
|
14785
|
+
displaySize,
|
|
14786
|
+
props.path,
|
|
14787
|
+
props.value
|
|
14788
|
+
]);
|
|
14789
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(import_material7.Box, {
|
|
14790
|
+
component: "span",
|
|
14791
|
+
className: "data-object-end",
|
|
14792
|
+
sx: {
|
|
14793
|
+
lineHeight: 1.5,
|
|
14794
|
+
color: textColor,
|
|
14795
|
+
letterSpacing: 0.5,
|
|
14796
|
+
opacity: 0.8
|
|
14797
|
+
},
|
|
14798
|
+
children: [
|
|
14799
|
+
isArrayLike ? arrayRb : objectRb,
|
|
14800
|
+
shouldDisplaySize && (isEmptyValue || !props.inspect) ? /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_material7.Box, {
|
|
14801
|
+
component: "span",
|
|
14802
|
+
sx: {
|
|
14803
|
+
pl: 0.5,
|
|
14804
|
+
fontStyle: "italic",
|
|
14805
|
+
color: metadataColor,
|
|
14806
|
+
userSelect: "none"
|
|
14807
|
+
},
|
|
14808
|
+
children: sizeOfValue
|
|
14809
|
+
}) : null
|
|
14810
|
+
]
|
|
14811
|
+
});
|
|
14812
|
+
};
|
|
14813
|
+
function getIterator(value) {
|
|
14814
|
+
return typeof (value === null || value === void 0 ? void 0 : value[Symbol.iterator]) === "function";
|
|
14815
|
+
}
|
|
14816
|
+
var ObjectType = (props) => {
|
|
14817
|
+
const keyColor = useTextColor();
|
|
14818
|
+
const borderColor = useJsonViewerStore((store) => store.colorspace.base02);
|
|
14819
|
+
const groupArraysAfterLength = useJsonViewerStore((store) => store.groupArraysAfterLength);
|
|
14820
|
+
const isTrap = useIsCycleReference(props.path, props.value);
|
|
14821
|
+
const [displayLength, setDisplayLength] = (0, import_react48.useState)(useJsonViewerStore((store) => store.maxDisplayLength));
|
|
14822
|
+
const objectSortKeys = useJsonViewerStore((store) => store.objectSortKeys);
|
|
14823
|
+
const elements = (0, import_react48.useMemo)(() => {
|
|
14824
|
+
if (!props.inspect) {
|
|
14825
|
+
return null;
|
|
14826
|
+
}
|
|
14827
|
+
const value = props.value;
|
|
14828
|
+
const iterator = getIterator(value);
|
|
14829
|
+
if (iterator && !Array.isArray(value)) {
|
|
14830
|
+
const elements3 = [];
|
|
14831
|
+
if (value instanceof Map) {
|
|
14832
|
+
const lastIndex2 = value.size - 1;
|
|
14833
|
+
let index = 0;
|
|
14834
|
+
value.forEach((value2, k2) => {
|
|
14835
|
+
const key = k2.toString();
|
|
14836
|
+
const path = [
|
|
14837
|
+
...props.path,
|
|
14838
|
+
key
|
|
14839
|
+
];
|
|
14840
|
+
elements3.push(/* @__PURE__ */ (0, import_jsx_runtime129.jsx)(DataKeyPair, {
|
|
14841
|
+
path,
|
|
14842
|
+
value: value2,
|
|
14843
|
+
prevValue: props.prevValue instanceof Map ? props.prevValue.get(k2) : void 0,
|
|
14844
|
+
editable: false,
|
|
14845
|
+
last: index === lastIndex2
|
|
14846
|
+
}, key));
|
|
14847
|
+
index++;
|
|
14848
|
+
});
|
|
14849
|
+
} else {
|
|
14850
|
+
const iterator2 = value[Symbol.iterator]();
|
|
14851
|
+
let result = iterator2.next();
|
|
14852
|
+
let count2 = 0;
|
|
14853
|
+
while (true) {
|
|
14854
|
+
const nextResult = iterator2.next();
|
|
14855
|
+
var _nextResult_done;
|
|
14856
|
+
elements3.push(/* @__PURE__ */ (0, import_jsx_runtime129.jsx)(DataKeyPair, {
|
|
14857
|
+
path: [
|
|
14858
|
+
...props.path,
|
|
14859
|
+
"iterator:".concat(count2)
|
|
14860
|
+
],
|
|
14861
|
+
value: result.value,
|
|
14862
|
+
nestedIndex: count2,
|
|
14863
|
+
editable: false,
|
|
14864
|
+
last: (_nextResult_done = nextResult.done) !== null && _nextResult_done !== void 0 ? _nextResult_done : false
|
|
14865
|
+
}, count2));
|
|
14866
|
+
if (nextResult.done) {
|
|
14867
|
+
break;
|
|
14868
|
+
}
|
|
14869
|
+
count2++;
|
|
14870
|
+
result = nextResult;
|
|
14871
|
+
}
|
|
14872
|
+
}
|
|
14873
|
+
return elements3;
|
|
14874
|
+
}
|
|
14875
|
+
if (Array.isArray(value)) {
|
|
14876
|
+
const lastIndex2 = value.length - 1;
|
|
14877
|
+
if (value.length <= groupArraysAfterLength) {
|
|
14878
|
+
const elements4 = value.slice(0, displayLength).map((value2, _index) => {
|
|
14879
|
+
const index = props.nestedIndex ? props.nestedIndex * groupArraysAfterLength + _index : _index;
|
|
14880
|
+
const path = [
|
|
14881
|
+
...props.path,
|
|
14882
|
+
index
|
|
14883
|
+
];
|
|
14884
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(DataKeyPair, {
|
|
14885
|
+
path,
|
|
14886
|
+
value: value2,
|
|
14887
|
+
prevValue: Array.isArray(props.prevValue) ? props.prevValue[index] : void 0,
|
|
14888
|
+
last: _index === lastIndex2
|
|
14889
|
+
}, index);
|
|
14890
|
+
});
|
|
14891
|
+
if (value.length > displayLength) {
|
|
14892
|
+
const rest = value.length - displayLength;
|
|
14893
|
+
elements4.push(/* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(DataBox, {
|
|
14894
|
+
sx: {
|
|
14895
|
+
cursor: "pointer",
|
|
14896
|
+
lineHeight: 1.5,
|
|
14897
|
+
color: keyColor,
|
|
14898
|
+
letterSpacing: 0.5,
|
|
14899
|
+
opacity: 0.8,
|
|
14900
|
+
userSelect: "none"
|
|
14901
|
+
},
|
|
14902
|
+
onClick: () => setDisplayLength((length) => length * 2),
|
|
14903
|
+
children: [
|
|
14904
|
+
"hidden ",
|
|
14905
|
+
rest,
|
|
14906
|
+
" items\u2026"
|
|
14907
|
+
]
|
|
14908
|
+
}, "last"));
|
|
14909
|
+
}
|
|
14910
|
+
return elements4;
|
|
14911
|
+
}
|
|
14912
|
+
const elements3 = segmentArray(value, groupArraysAfterLength);
|
|
14913
|
+
const prevElements = Array.isArray(props.prevValue) ? segmentArray(props.prevValue, groupArraysAfterLength) : void 0;
|
|
14914
|
+
const elementsLastIndex = elements3.length - 1;
|
|
14915
|
+
return elements3.map((list, index) => {
|
|
14916
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(DataKeyPair, {
|
|
14917
|
+
path: props.path,
|
|
14918
|
+
value: list,
|
|
14919
|
+
nestedIndex: index,
|
|
14920
|
+
prevValue: prevElements === null || prevElements === void 0 ? void 0 : prevElements[index],
|
|
14921
|
+
last: index === elementsLastIndex
|
|
14922
|
+
}, index);
|
|
14923
|
+
});
|
|
14924
|
+
}
|
|
14925
|
+
let entries = Object.entries(value);
|
|
14926
|
+
if (objectSortKeys) {
|
|
14927
|
+
entries = objectSortKeys === true ? entries.sort((param, param1) => {
|
|
14928
|
+
let [a3] = param, [b3] = param1;
|
|
14929
|
+
return a3.localeCompare(b3);
|
|
14930
|
+
}) : entries.sort((param, param1) => {
|
|
14931
|
+
let [a3] = param, [b3] = param1;
|
|
14932
|
+
return objectSortKeys(a3, b3);
|
|
14933
|
+
});
|
|
14934
|
+
}
|
|
14935
|
+
const lastIndex = entries.length - 1;
|
|
14936
|
+
const elements2 = entries.slice(0, displayLength).map((param, index) => {
|
|
14937
|
+
let [key, value2] = param;
|
|
14938
|
+
var _props_prevValue;
|
|
14939
|
+
const path = [
|
|
14940
|
+
...props.path,
|
|
14941
|
+
key
|
|
14942
|
+
];
|
|
14943
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(DataKeyPair, {
|
|
14944
|
+
path,
|
|
14945
|
+
value: value2,
|
|
14946
|
+
prevValue: (_props_prevValue = props.prevValue) === null || _props_prevValue === void 0 ? void 0 : _props_prevValue[key],
|
|
14947
|
+
last: index === lastIndex
|
|
14948
|
+
}, key);
|
|
14949
|
+
});
|
|
14950
|
+
if (entries.length > displayLength) {
|
|
14951
|
+
const rest = entries.length - displayLength;
|
|
14952
|
+
elements2.push(/* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(DataBox, {
|
|
14953
|
+
sx: {
|
|
14954
|
+
cursor: "pointer",
|
|
14955
|
+
lineHeight: 1.5,
|
|
14956
|
+
color: keyColor,
|
|
14957
|
+
letterSpacing: 0.5,
|
|
14958
|
+
opacity: 0.8,
|
|
14959
|
+
userSelect: "none"
|
|
14960
|
+
},
|
|
14961
|
+
onClick: () => setDisplayLength((length) => length * 2),
|
|
14962
|
+
children: [
|
|
14963
|
+
"hidden ",
|
|
14964
|
+
rest,
|
|
14965
|
+
" items\u2026"
|
|
14966
|
+
]
|
|
14967
|
+
}, "last"));
|
|
14968
|
+
}
|
|
14969
|
+
return elements2;
|
|
14970
|
+
}, [
|
|
14971
|
+
props.inspect,
|
|
14972
|
+
props.value,
|
|
14973
|
+
props.prevValue,
|
|
14974
|
+
props.path,
|
|
14975
|
+
props.nestedIndex,
|
|
14976
|
+
groupArraysAfterLength,
|
|
14977
|
+
displayLength,
|
|
14978
|
+
keyColor,
|
|
14979
|
+
objectSortKeys
|
|
14980
|
+
]);
|
|
14981
|
+
const marginLeft = props.inspect ? 0.6 : 0;
|
|
14982
|
+
const width = useJsonViewerStore((store) => store.indentWidth);
|
|
14983
|
+
const indentWidth = props.inspect ? width - marginLeft : width;
|
|
14984
|
+
const isEmptyValue = (0, import_react48.useMemo)(() => getValueSize(props.value) === 0, [
|
|
14985
|
+
props.value
|
|
14986
|
+
]);
|
|
14987
|
+
if (isEmptyValue) {
|
|
14988
|
+
return null;
|
|
14989
|
+
}
|
|
14990
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_material7.Box, {
|
|
14991
|
+
className: "data-object",
|
|
14992
|
+
sx: {
|
|
14993
|
+
display: props.inspect ? "block" : "inline-block",
|
|
14994
|
+
pl: props.inspect ? indentWidth - 0.6 : 0,
|
|
14995
|
+
marginLeft,
|
|
14996
|
+
color: keyColor,
|
|
14997
|
+
borderLeft: props.inspect ? "1px solid ".concat(borderColor) : "none"
|
|
14998
|
+
},
|
|
14999
|
+
children: props.inspect ? elements : !isTrap && /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_material7.Box, {
|
|
15000
|
+
component: "span",
|
|
15001
|
+
className: "data-object-body",
|
|
15002
|
+
onClick: () => props.setInspect(true),
|
|
15003
|
+
sx: {
|
|
15004
|
+
"&:hover": {
|
|
15005
|
+
cursor: "pointer"
|
|
15006
|
+
},
|
|
15007
|
+
padding: 0.5,
|
|
15008
|
+
userSelect: "none"
|
|
15009
|
+
},
|
|
15010
|
+
children: "\u2026"
|
|
15011
|
+
})
|
|
15012
|
+
});
|
|
15013
|
+
};
|
|
15014
|
+
var objectType = {
|
|
15015
|
+
is: (value) => typeof value === "object",
|
|
15016
|
+
Component: ObjectType,
|
|
15017
|
+
PreComponent: PreObjectType,
|
|
15018
|
+
PostComponent: PostObjectType
|
|
15019
|
+
};
|
|
15020
|
+
var stringType = defineEasyType({
|
|
15021
|
+
is: (value) => typeof value === "string",
|
|
15022
|
+
type: "string",
|
|
15023
|
+
colorKey: "base09",
|
|
15024
|
+
serialize: (value) => value,
|
|
15025
|
+
deserialize: (value) => value,
|
|
15026
|
+
Renderer: (props) => {
|
|
15027
|
+
const [showRest, setShowRest] = (0, import_react48.useState)(false);
|
|
15028
|
+
const collapseStringsAfterLength = useJsonViewerStore((store) => store.collapseStringsAfterLength);
|
|
15029
|
+
const value = showRest ? props.value : props.value.slice(0, collapseStringsAfterLength);
|
|
15030
|
+
const hasRest = props.value.length > collapseStringsAfterLength;
|
|
15031
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(import_material7.Box, {
|
|
15032
|
+
component: "span",
|
|
15033
|
+
sx: {
|
|
15034
|
+
overflowWrap: "anywhere",
|
|
15035
|
+
cursor: hasRest ? "pointer" : "inherit"
|
|
15036
|
+
},
|
|
15037
|
+
onClick: () => {
|
|
15038
|
+
var _window_getSelection;
|
|
15039
|
+
if (((_window_getSelection = window.getSelection()) === null || _window_getSelection === void 0 ? void 0 : _window_getSelection.type) === "Range") {
|
|
15040
|
+
return;
|
|
15041
|
+
}
|
|
15042
|
+
if (hasRest) {
|
|
15043
|
+
setShowRest((value2) => !value2);
|
|
15044
|
+
}
|
|
15045
|
+
},
|
|
15046
|
+
children: [
|
|
15047
|
+
'"',
|
|
15048
|
+
value,
|
|
15049
|
+
hasRest && !showRest && /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_material7.Box, {
|
|
15050
|
+
component: "span",
|
|
15051
|
+
sx: {
|
|
15052
|
+
padding: 0.5
|
|
15053
|
+
},
|
|
15054
|
+
children: "\u2026"
|
|
15055
|
+
}),
|
|
15056
|
+
'"'
|
|
15057
|
+
]
|
|
15058
|
+
});
|
|
15059
|
+
}
|
|
15060
|
+
});
|
|
15061
|
+
var undefinedType = defineEasyType({
|
|
15062
|
+
is: (value) => value === void 0,
|
|
15063
|
+
type: "undefined",
|
|
15064
|
+
colorKey: "base05",
|
|
15065
|
+
displayTypeLabel: false,
|
|
15066
|
+
Renderer: () => {
|
|
15067
|
+
const backgroundColor = useJsonViewerStore((store) => store.colorspace.base02);
|
|
15068
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_material7.Box, {
|
|
15069
|
+
sx: {
|
|
15070
|
+
fontSize: "0.7rem",
|
|
15071
|
+
backgroundColor,
|
|
15072
|
+
borderRadius: "3px",
|
|
15073
|
+
padding: "0.5px 2px"
|
|
15074
|
+
},
|
|
15075
|
+
children: "undefined"
|
|
15076
|
+
});
|
|
15077
|
+
}
|
|
15078
|
+
});
|
|
15079
|
+
function memorizeDataType(dataType) {
|
|
15080
|
+
function compare(prevProps, nextProps) {
|
|
15081
|
+
var _prevProps_path, _nextProps_path;
|
|
15082
|
+
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("."));
|
|
15083
|
+
}
|
|
15084
|
+
dataType.Component = /* @__PURE__ */ (0, import_react48.memo)(dataType.Component, compare);
|
|
15085
|
+
if (dataType.Editor) {
|
|
15086
|
+
dataType.Editor = /* @__PURE__ */ (0, import_react48.memo)(dataType.Editor, function compare2(prevProps, nextProps) {
|
|
15087
|
+
return Object.is(prevProps.value, nextProps.value);
|
|
15088
|
+
});
|
|
15089
|
+
}
|
|
15090
|
+
if (dataType.PreComponent) {
|
|
15091
|
+
dataType.PreComponent = /* @__PURE__ */ (0, import_react48.memo)(dataType.PreComponent, compare);
|
|
15092
|
+
}
|
|
15093
|
+
if (dataType.PostComponent) {
|
|
15094
|
+
dataType.PostComponent = /* @__PURE__ */ (0, import_react48.memo)(dataType.PostComponent, compare);
|
|
15095
|
+
}
|
|
15096
|
+
return dataType;
|
|
15097
|
+
}
|
|
15098
|
+
var predefinedTypes = [
|
|
15099
|
+
memorizeDataType(booleanType),
|
|
15100
|
+
memorizeDataType(dateType),
|
|
15101
|
+
memorizeDataType(nullType),
|
|
15102
|
+
memorizeDataType(undefinedType),
|
|
15103
|
+
memorizeDataType(stringType),
|
|
15104
|
+
memorizeDataType(functionType),
|
|
15105
|
+
memorizeDataType(nanType),
|
|
15106
|
+
memorizeDataType(intType),
|
|
15107
|
+
memorizeDataType(floatType),
|
|
15108
|
+
memorizeDataType(bigIntType)
|
|
15109
|
+
];
|
|
15110
|
+
var createTypeRegistryStore = () => {
|
|
15111
|
+
return (0, import_zustand.createStore)()((set) => ({
|
|
15112
|
+
registry: predefinedTypes,
|
|
15113
|
+
registerTypes: (setState) => {
|
|
15114
|
+
set((state) => ({
|
|
15115
|
+
registry: typeof setState === "function" ? setState(state.registry) : setState
|
|
15116
|
+
}));
|
|
15117
|
+
}
|
|
15118
|
+
}));
|
|
15119
|
+
};
|
|
15120
|
+
var TypeRegistryStoreContext = /* @__PURE__ */ (0, import_react48.createContext)(void 0);
|
|
15121
|
+
TypeRegistryStoreContext.Provider;
|
|
15122
|
+
var useTypeRegistryStore = (selector2, equalityFn) => {
|
|
15123
|
+
const store = (0, import_react48.useContext)(TypeRegistryStoreContext);
|
|
15124
|
+
return (0, import_zustand.useStore)(store, selector2, equalityFn);
|
|
15125
|
+
};
|
|
15126
|
+
function matchTypeComponents(value, path, registry) {
|
|
15127
|
+
let potential;
|
|
15128
|
+
for (const T of registry) {
|
|
15129
|
+
if (T.is(value, path)) {
|
|
15130
|
+
potential = T;
|
|
15131
|
+
}
|
|
15132
|
+
}
|
|
15133
|
+
if (potential === void 0) {
|
|
15134
|
+
if (typeof value === "object") {
|
|
15135
|
+
return objectType;
|
|
15136
|
+
}
|
|
15137
|
+
throw new Error("No type matched for value: ".concat(value));
|
|
15138
|
+
}
|
|
15139
|
+
return potential;
|
|
15140
|
+
}
|
|
15141
|
+
function useTypeComponents(value, path) {
|
|
15142
|
+
const registry = useTypeRegistryStore((store) => store.registry);
|
|
15143
|
+
return (0, import_react48.useMemo)(() => matchTypeComponents(value, path, registry), [
|
|
15144
|
+
value,
|
|
15145
|
+
path,
|
|
15146
|
+
registry
|
|
15147
|
+
]);
|
|
15148
|
+
}
|
|
15149
|
+
var IconBox = (props) => /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_material7.Box, {
|
|
15150
|
+
component: "span",
|
|
15151
|
+
...props,
|
|
15152
|
+
sx: {
|
|
15153
|
+
cursor: "pointer",
|
|
15154
|
+
paddingLeft: "0.7rem",
|
|
15155
|
+
...props.sx
|
|
15156
|
+
}
|
|
15157
|
+
});
|
|
15158
|
+
var DataKeyPair = (props) => {
|
|
15159
|
+
const { value, prevValue, path, nestedIndex, last } = props;
|
|
15160
|
+
const { Component, PreComponent, PostComponent, Editor, serialize, deserialize } = useTypeComponents(value, path);
|
|
15161
|
+
var _props_editable;
|
|
15162
|
+
const propsEditable = (_props_editable = props.editable) !== null && _props_editable !== void 0 ? _props_editable : void 0;
|
|
15163
|
+
const storeEditable = useJsonViewerStore((store) => store.editable);
|
|
15164
|
+
const editable = (0, import_react48.useMemo)(() => {
|
|
15165
|
+
if (storeEditable === false) {
|
|
15166
|
+
return false;
|
|
15167
|
+
}
|
|
15168
|
+
if (propsEditable === false) {
|
|
15169
|
+
return false;
|
|
15170
|
+
}
|
|
15171
|
+
if (typeof storeEditable === "function") {
|
|
15172
|
+
return !!storeEditable(path, value);
|
|
15173
|
+
}
|
|
15174
|
+
return storeEditable;
|
|
15175
|
+
}, [
|
|
15176
|
+
path,
|
|
15177
|
+
propsEditable,
|
|
15178
|
+
storeEditable,
|
|
15179
|
+
value
|
|
15180
|
+
]);
|
|
15181
|
+
const [tempValue, setTempValue] = (0, import_react48.useState)("");
|
|
15182
|
+
const depth = path.length;
|
|
15183
|
+
const key = path[depth - 1];
|
|
15184
|
+
const hoverPath = useJsonViewerStore((store) => store.hoverPath);
|
|
15185
|
+
const isHover = (0, import_react48.useMemo)(() => {
|
|
15186
|
+
return hoverPath && path.every((value2, index) => value2 === hoverPath.path[index] && nestedIndex === hoverPath.nestedIndex);
|
|
15187
|
+
}, [
|
|
15188
|
+
hoverPath,
|
|
15189
|
+
path,
|
|
15190
|
+
nestedIndex
|
|
15191
|
+
]);
|
|
15192
|
+
const setHover = useJsonViewerStore((store) => store.setHover);
|
|
15193
|
+
const root = useJsonViewerStore((store) => store.value);
|
|
15194
|
+
const [inspect, setInspect] = useInspect(path, value, nestedIndex);
|
|
15195
|
+
const [editing, setEditing] = (0, import_react48.useState)(false);
|
|
15196
|
+
const onChange = useJsonViewerStore((store) => store.onChange);
|
|
15197
|
+
const keyColor = useTextColor();
|
|
15198
|
+
const numberKeyColor = useJsonViewerStore((store) => store.colorspace.base0C);
|
|
15199
|
+
const highlightColor = useJsonViewerStore((store) => store.colorspace.base0A);
|
|
15200
|
+
const displayComma = useJsonViewerStore((store) => store.displayComma);
|
|
15201
|
+
const quotesOnKeys = useJsonViewerStore((store) => store.quotesOnKeys);
|
|
15202
|
+
const rootName = useJsonViewerStore((store) => store.rootName);
|
|
15203
|
+
const isRoot = root === value;
|
|
15204
|
+
const isNumberKey = Number.isInteger(Number(key));
|
|
15205
|
+
const storeEnableAdd = useJsonViewerStore((store) => store.enableAdd);
|
|
15206
|
+
const onAdd = useJsonViewerStore((store) => store.onAdd);
|
|
15207
|
+
const enableAdd = (0, import_react48.useMemo)(() => {
|
|
15208
|
+
if (!onAdd || nestedIndex !== void 0) return false;
|
|
15209
|
+
if (storeEnableAdd === false) {
|
|
15210
|
+
return false;
|
|
15211
|
+
}
|
|
15212
|
+
if (propsEditable === false) {
|
|
15213
|
+
return false;
|
|
15214
|
+
}
|
|
15215
|
+
if (typeof storeEnableAdd === "function") {
|
|
15216
|
+
return !!storeEnableAdd(path, value);
|
|
15217
|
+
}
|
|
15218
|
+
if (Array.isArray(value) || isPlainObject(value)) {
|
|
15219
|
+
return true;
|
|
15220
|
+
}
|
|
15221
|
+
return false;
|
|
15222
|
+
}, [
|
|
15223
|
+
onAdd,
|
|
15224
|
+
nestedIndex,
|
|
15225
|
+
path,
|
|
15226
|
+
storeEnableAdd,
|
|
15227
|
+
propsEditable,
|
|
15228
|
+
value
|
|
15229
|
+
]);
|
|
15230
|
+
const storeEnableDelete = useJsonViewerStore((store) => store.enableDelete);
|
|
15231
|
+
const onDelete = useJsonViewerStore((store) => store.onDelete);
|
|
15232
|
+
const enableDelete = (0, import_react48.useMemo)(() => {
|
|
15233
|
+
if (!onDelete || nestedIndex !== void 0) return false;
|
|
15234
|
+
if (isRoot) {
|
|
15235
|
+
return false;
|
|
15236
|
+
}
|
|
15237
|
+
if (storeEnableDelete === false) {
|
|
15238
|
+
return false;
|
|
15239
|
+
}
|
|
15240
|
+
if (propsEditable === false) {
|
|
15241
|
+
return false;
|
|
15242
|
+
}
|
|
15243
|
+
if (typeof storeEnableDelete === "function") {
|
|
15244
|
+
return !!storeEnableDelete(path, value);
|
|
15245
|
+
}
|
|
15246
|
+
return storeEnableDelete;
|
|
15247
|
+
}, [
|
|
15248
|
+
onDelete,
|
|
15249
|
+
nestedIndex,
|
|
15250
|
+
isRoot,
|
|
15251
|
+
path,
|
|
15252
|
+
storeEnableDelete,
|
|
15253
|
+
propsEditable,
|
|
15254
|
+
value
|
|
15255
|
+
]);
|
|
15256
|
+
const enableClipboard = useJsonViewerStore((store) => store.enableClipboard);
|
|
15257
|
+
const { copy, copied } = useClipboard();
|
|
15258
|
+
const highlightUpdates = useJsonViewerStore((store) => store.highlightUpdates);
|
|
15259
|
+
const isHighlight = (0, import_react48.useMemo)(() => {
|
|
15260
|
+
if (!highlightUpdates || prevValue === void 0) return false;
|
|
15261
|
+
if (typeof value !== typeof prevValue) {
|
|
15262
|
+
return true;
|
|
15263
|
+
}
|
|
15264
|
+
if (typeof value === "number") {
|
|
15265
|
+
if (isNaN(value) && isNaN(prevValue)) return false;
|
|
15266
|
+
return value !== prevValue;
|
|
15267
|
+
}
|
|
15268
|
+
if (Array.isArray(value) !== Array.isArray(prevValue)) {
|
|
15269
|
+
return true;
|
|
15270
|
+
}
|
|
15271
|
+
if (typeof value === "object" || typeof value === "function") {
|
|
15272
|
+
return false;
|
|
15273
|
+
}
|
|
15274
|
+
if (value !== prevValue) {
|
|
15275
|
+
return true;
|
|
15276
|
+
}
|
|
15277
|
+
return false;
|
|
15278
|
+
}, [
|
|
15279
|
+
highlightUpdates,
|
|
15280
|
+
prevValue,
|
|
15281
|
+
value
|
|
15282
|
+
]);
|
|
15283
|
+
const highlightContainer = (0, import_react48.useRef)();
|
|
15284
|
+
(0, import_react48.useEffect)(() => {
|
|
15285
|
+
if (highlightContainer.current && isHighlight && "animate" in highlightContainer.current) {
|
|
15286
|
+
highlightContainer.current.animate([
|
|
15287
|
+
{
|
|
15288
|
+
backgroundColor: highlightColor
|
|
15289
|
+
},
|
|
15290
|
+
{
|
|
15291
|
+
backgroundColor: ""
|
|
15292
|
+
}
|
|
15293
|
+
], {
|
|
15294
|
+
duration: 1e3,
|
|
15295
|
+
easing: "ease-in"
|
|
15296
|
+
});
|
|
15297
|
+
}
|
|
15298
|
+
}, [
|
|
15299
|
+
highlightColor,
|
|
15300
|
+
isHighlight,
|
|
15301
|
+
prevValue,
|
|
15302
|
+
value
|
|
15303
|
+
]);
|
|
15304
|
+
const startEditing = (0, import_react48.useCallback)((event) => {
|
|
15305
|
+
event.preventDefault();
|
|
15306
|
+
if (serialize) setTempValue(serialize(value));
|
|
15307
|
+
setEditing(true);
|
|
15308
|
+
}, [
|
|
15309
|
+
serialize,
|
|
15310
|
+
value
|
|
15311
|
+
]);
|
|
15312
|
+
const abortEditing = (0, import_react48.useCallback)(() => {
|
|
15313
|
+
setEditing(false);
|
|
15314
|
+
setTempValue("");
|
|
15315
|
+
}, [
|
|
15316
|
+
setEditing,
|
|
15317
|
+
setTempValue
|
|
15318
|
+
]);
|
|
15319
|
+
const commitEditing = (0, import_react48.useCallback)((newValue) => {
|
|
15320
|
+
setEditing(false);
|
|
15321
|
+
if (!deserialize) return;
|
|
15322
|
+
try {
|
|
15323
|
+
onChange(path, value, deserialize(newValue));
|
|
15324
|
+
} catch (e2) {
|
|
15325
|
+
}
|
|
15326
|
+
}, [
|
|
15327
|
+
setEditing,
|
|
15328
|
+
deserialize,
|
|
15329
|
+
onChange,
|
|
15330
|
+
path,
|
|
15331
|
+
value
|
|
15332
|
+
]);
|
|
15333
|
+
const actionIcons = (0, import_react48.useMemo)(() => {
|
|
15334
|
+
if (editing) {
|
|
15335
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(import_jsx_runtime129.Fragment, {
|
|
15336
|
+
children: [
|
|
15337
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)(IconBox, {
|
|
15338
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(CloseIcon, {
|
|
15339
|
+
sx: {
|
|
15340
|
+
fontSize: ".8rem"
|
|
15341
|
+
},
|
|
15342
|
+
onClick: abortEditing
|
|
15343
|
+
})
|
|
15344
|
+
}),
|
|
15345
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)(IconBox, {
|
|
15346
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(CheckIcon, {
|
|
15347
|
+
sx: {
|
|
15348
|
+
fontSize: ".8rem"
|
|
15349
|
+
},
|
|
15350
|
+
onClick: () => commitEditing(tempValue)
|
|
15351
|
+
})
|
|
15352
|
+
})
|
|
15353
|
+
]
|
|
15354
|
+
});
|
|
15355
|
+
}
|
|
15356
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(import_jsx_runtime129.Fragment, {
|
|
15357
|
+
children: [
|
|
15358
|
+
enableClipboard && /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(IconBox, {
|
|
15359
|
+
onClick: (event) => {
|
|
15360
|
+
event.preventDefault();
|
|
15361
|
+
try {
|
|
15362
|
+
copy(path, value, copyString);
|
|
15363
|
+
} catch (e2) {
|
|
15364
|
+
console.error(e2);
|
|
15365
|
+
}
|
|
15366
|
+
},
|
|
15367
|
+
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(CheckIcon, {
|
|
15368
|
+
sx: {
|
|
15369
|
+
fontSize: ".8rem"
|
|
15370
|
+
}
|
|
15371
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(ContentCopyIcon, {
|
|
15372
|
+
sx: {
|
|
15373
|
+
fontSize: ".8rem"
|
|
15374
|
+
}
|
|
15375
|
+
})
|
|
15376
|
+
}),
|
|
15377
|
+
Editor && editable && serialize && deserialize && /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(IconBox, {
|
|
15378
|
+
onClick: startEditing,
|
|
15379
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(EditIcon, {
|
|
15380
|
+
sx: {
|
|
15381
|
+
fontSize: ".8rem"
|
|
15382
|
+
}
|
|
15383
|
+
})
|
|
15384
|
+
}),
|
|
15385
|
+
enableAdd && /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(IconBox, {
|
|
15386
|
+
onClick: (event) => {
|
|
15387
|
+
event.preventDefault();
|
|
15388
|
+
onAdd === null || onAdd === void 0 ? void 0 : onAdd(path);
|
|
15389
|
+
},
|
|
15390
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(AddBoxIcon, {
|
|
15391
|
+
sx: {
|
|
15392
|
+
fontSize: ".8rem"
|
|
15393
|
+
}
|
|
15394
|
+
})
|
|
15395
|
+
}),
|
|
15396
|
+
enableDelete && /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(IconBox, {
|
|
15397
|
+
onClick: (event) => {
|
|
15398
|
+
event.preventDefault();
|
|
15399
|
+
onDelete === null || onDelete === void 0 ? void 0 : onDelete(path, value);
|
|
15400
|
+
},
|
|
15401
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(DeleteIcon, {
|
|
15402
|
+
sx: {
|
|
15403
|
+
fontSize: ".9rem"
|
|
15404
|
+
}
|
|
15405
|
+
})
|
|
15406
|
+
})
|
|
14078
15407
|
]
|
|
15408
|
+
});
|
|
15409
|
+
}, [
|
|
15410
|
+
Editor,
|
|
15411
|
+
serialize,
|
|
15412
|
+
deserialize,
|
|
15413
|
+
copied,
|
|
15414
|
+
copy,
|
|
15415
|
+
editable,
|
|
15416
|
+
editing,
|
|
15417
|
+
enableClipboard,
|
|
15418
|
+
enableAdd,
|
|
15419
|
+
enableDelete,
|
|
15420
|
+
tempValue,
|
|
15421
|
+
path,
|
|
15422
|
+
value,
|
|
15423
|
+
onAdd,
|
|
15424
|
+
onDelete,
|
|
15425
|
+
startEditing,
|
|
15426
|
+
abortEditing,
|
|
15427
|
+
commitEditing
|
|
15428
|
+
]);
|
|
15429
|
+
const isEmptyValue = (0, import_react48.useMemo)(() => getValueSize(value) === 0, [
|
|
15430
|
+
value
|
|
15431
|
+
]);
|
|
15432
|
+
const expandable = !isEmptyValue && !!(PreComponent && PostComponent);
|
|
15433
|
+
const KeyRenderer = useJsonViewerStore((store) => store.keyRenderer);
|
|
15434
|
+
const downstreamProps = (0, import_react48.useMemo)(() => ({
|
|
15435
|
+
path,
|
|
15436
|
+
inspect,
|
|
15437
|
+
setInspect,
|
|
15438
|
+
value,
|
|
15439
|
+
prevValue,
|
|
15440
|
+
nestedIndex
|
|
15441
|
+
}), [
|
|
15442
|
+
inspect,
|
|
15443
|
+
path,
|
|
15444
|
+
setInspect,
|
|
15445
|
+
value,
|
|
15446
|
+
prevValue,
|
|
15447
|
+
nestedIndex
|
|
15448
|
+
]);
|
|
15449
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(import_material7.Box, {
|
|
15450
|
+
className: "data-key-pair",
|
|
15451
|
+
"data-testid": "data-key-pair" + path.join("."),
|
|
15452
|
+
sx: {
|
|
15453
|
+
userSelect: "text"
|
|
15454
|
+
},
|
|
15455
|
+
onMouseEnter: (0, import_react48.useCallback)(() => setHover(path, nestedIndex), [
|
|
15456
|
+
setHover,
|
|
15457
|
+
path,
|
|
15458
|
+
nestedIndex
|
|
15459
|
+
]),
|
|
15460
|
+
children: [
|
|
15461
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(DataBox, {
|
|
15462
|
+
component: "span",
|
|
15463
|
+
className: "data-key",
|
|
15464
|
+
sx: {
|
|
15465
|
+
lineHeight: 1.5,
|
|
15466
|
+
color: keyColor,
|
|
15467
|
+
letterSpacing: 0.5,
|
|
15468
|
+
opacity: 0.8
|
|
15469
|
+
},
|
|
15470
|
+
onClick: (0, import_react48.useCallback)((event) => {
|
|
15471
|
+
if (event.isDefaultPrevented()) {
|
|
15472
|
+
return;
|
|
15473
|
+
}
|
|
15474
|
+
if (!isEmptyValue) {
|
|
15475
|
+
setInspect((state) => !state);
|
|
15476
|
+
}
|
|
15477
|
+
}, [
|
|
15478
|
+
isEmptyValue,
|
|
15479
|
+
setInspect
|
|
15480
|
+
]),
|
|
15481
|
+
children: [
|
|
15482
|
+
expandable ? inspect ? /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(ExpandMoreIcon, {
|
|
15483
|
+
className: "data-key-toggle-expanded",
|
|
15484
|
+
sx: {
|
|
15485
|
+
fontSize: ".8rem",
|
|
15486
|
+
"&:hover": {
|
|
15487
|
+
cursor: "pointer"
|
|
15488
|
+
}
|
|
15489
|
+
}
|
|
15490
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(ChevronRightIcon, {
|
|
15491
|
+
className: "data-key-toggle-collapsed",
|
|
15492
|
+
sx: {
|
|
15493
|
+
fontSize: ".8rem",
|
|
15494
|
+
"&:hover": {
|
|
15495
|
+
cursor: "pointer"
|
|
15496
|
+
}
|
|
15497
|
+
}
|
|
15498
|
+
}) : null,
|
|
15499
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_material7.Box, {
|
|
15500
|
+
ref: highlightContainer,
|
|
15501
|
+
className: "data-key-key",
|
|
15502
|
+
component: "span",
|
|
15503
|
+
children: isRoot && depth === 0 ? rootName !== false ? quotesOnKeys ? /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(import_jsx_runtime129.Fragment, {
|
|
15504
|
+
children: [
|
|
15505
|
+
'"',
|
|
15506
|
+
rootName,
|
|
15507
|
+
'"'
|
|
15508
|
+
]
|
|
15509
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_jsx_runtime129.Fragment, {
|
|
15510
|
+
children: rootName
|
|
15511
|
+
}) : null : KeyRenderer.when(downstreamProps) ? /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(KeyRenderer, {
|
|
15512
|
+
...downstreamProps
|
|
15513
|
+
}) : nestedIndex === void 0 && (isNumberKey ? /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_material7.Box, {
|
|
15514
|
+
component: "span",
|
|
15515
|
+
style: {
|
|
15516
|
+
color: numberKeyColor,
|
|
15517
|
+
userSelect: isNumberKey ? "none" : "auto"
|
|
15518
|
+
},
|
|
15519
|
+
children: key
|
|
15520
|
+
}) : quotesOnKeys ? /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(import_jsx_runtime129.Fragment, {
|
|
15521
|
+
children: [
|
|
15522
|
+
'"',
|
|
15523
|
+
key,
|
|
15524
|
+
'"'
|
|
15525
|
+
]
|
|
15526
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_jsx_runtime129.Fragment, {
|
|
15527
|
+
children: key
|
|
15528
|
+
}))
|
|
15529
|
+
}),
|
|
15530
|
+
isRoot ? rootName !== false && /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(DataBox, {
|
|
15531
|
+
className: "data-key-colon",
|
|
15532
|
+
sx: {
|
|
15533
|
+
mr: 0.5
|
|
15534
|
+
},
|
|
15535
|
+
children: ":"
|
|
15536
|
+
}) : nestedIndex === void 0 && /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(DataBox, {
|
|
15537
|
+
className: "data-key-colon",
|
|
15538
|
+
sx: {
|
|
15539
|
+
mr: 0.5,
|
|
15540
|
+
".data-key-key:empty + &": {
|
|
15541
|
+
display: "none"
|
|
15542
|
+
},
|
|
15543
|
+
userSelect: isNumberKey ? "none" : "auto"
|
|
15544
|
+
},
|
|
15545
|
+
children: ":"
|
|
15546
|
+
}),
|
|
15547
|
+
PreComponent && /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(PreComponent, {
|
|
15548
|
+
...downstreamProps
|
|
15549
|
+
}),
|
|
15550
|
+
isHover && expandable && inspect && actionIcons
|
|
15551
|
+
]
|
|
15552
|
+
}),
|
|
15553
|
+
editing && editable ? Editor && /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(Editor, {
|
|
15554
|
+
path,
|
|
15555
|
+
value: tempValue,
|
|
15556
|
+
setValue: setTempValue,
|
|
15557
|
+
abortEditing,
|
|
15558
|
+
commitEditing
|
|
15559
|
+
}) : Component ? /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(Component, {
|
|
15560
|
+
...downstreamProps
|
|
15561
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_material7.Box, {
|
|
15562
|
+
component: "span",
|
|
15563
|
+
className: "data-value-fallback",
|
|
15564
|
+
children: "fallback: ".concat(value)
|
|
15565
|
+
}),
|
|
15566
|
+
PostComponent && /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(PostComponent, {
|
|
15567
|
+
...downstreamProps
|
|
15568
|
+
}),
|
|
15569
|
+
!last && displayComma && /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(DataBox, {
|
|
15570
|
+
children: ","
|
|
15571
|
+
}),
|
|
15572
|
+
isHover && expandable && !inspect && actionIcons,
|
|
15573
|
+
isHover && !expandable && actionIcons,
|
|
15574
|
+
!isHover && editing && actionIcons
|
|
15575
|
+
]
|
|
15576
|
+
});
|
|
15577
|
+
};
|
|
15578
|
+
var query = "(prefers-color-scheme: dark)";
|
|
15579
|
+
function useThemeDetector() {
|
|
15580
|
+
const [isDark, setIsDark] = (0, import_react48.useState)(false);
|
|
15581
|
+
(0, import_react48.useEffect)(() => {
|
|
15582
|
+
const listener = (e2) => setIsDark(e2.matches);
|
|
15583
|
+
setIsDark(window.matchMedia(query).matches);
|
|
15584
|
+
const queryMedia = window.matchMedia(query);
|
|
15585
|
+
queryMedia.addEventListener("change", listener);
|
|
15586
|
+
return () => queryMedia.removeEventListener("change", listener);
|
|
15587
|
+
}, []);
|
|
15588
|
+
return isDark;
|
|
15589
|
+
}
|
|
15590
|
+
function useSetIfNotUndefinedEffect(key, value) {
|
|
15591
|
+
const { setState } = (0, import_react48.useContext)(JsonViewerStoreContext);
|
|
15592
|
+
(0, import_react48.useEffect)(() => {
|
|
15593
|
+
if (value !== void 0) {
|
|
15594
|
+
setState({
|
|
15595
|
+
[key]: value
|
|
15596
|
+
});
|
|
15597
|
+
}
|
|
15598
|
+
}, [
|
|
15599
|
+
key,
|
|
15600
|
+
value,
|
|
15601
|
+
setState
|
|
15602
|
+
]);
|
|
15603
|
+
}
|
|
15604
|
+
var JsonViewerInner = (props) => {
|
|
15605
|
+
const { setState } = (0, import_react48.useContext)(JsonViewerStoreContext);
|
|
15606
|
+
(0, import_react48.useEffect)(() => {
|
|
15607
|
+
setState((state) => ({
|
|
15608
|
+
prevValue: state.value,
|
|
15609
|
+
value: props.value
|
|
15610
|
+
}));
|
|
15611
|
+
}, [
|
|
15612
|
+
props.value,
|
|
15613
|
+
setState
|
|
15614
|
+
]);
|
|
15615
|
+
useSetIfNotUndefinedEffect("rootName", props.rootName);
|
|
15616
|
+
useSetIfNotUndefinedEffect("indentWidth", props.indentWidth);
|
|
15617
|
+
useSetIfNotUndefinedEffect("keyRenderer", props.keyRenderer);
|
|
15618
|
+
useSetIfNotUndefinedEffect("enableAdd", props.enableAdd);
|
|
15619
|
+
useSetIfNotUndefinedEffect("enableDelete", props.enableDelete);
|
|
15620
|
+
useSetIfNotUndefinedEffect("enableClipboard", props.enableClipboard);
|
|
15621
|
+
useSetIfNotUndefinedEffect("editable", props.editable);
|
|
15622
|
+
useSetIfNotUndefinedEffect("onChange", props.onChange);
|
|
15623
|
+
useSetIfNotUndefinedEffect("onCopy", props.onCopy);
|
|
15624
|
+
useSetIfNotUndefinedEffect("onSelect", props.onSelect);
|
|
15625
|
+
useSetIfNotUndefinedEffect("onAdd", props.onAdd);
|
|
15626
|
+
useSetIfNotUndefinedEffect("onDelete", props.onDelete);
|
|
15627
|
+
useSetIfNotUndefinedEffect("maxDisplayLength", props.maxDisplayLength);
|
|
15628
|
+
useSetIfNotUndefinedEffect("groupArraysAfterLength", props.groupArraysAfterLength);
|
|
15629
|
+
useSetIfNotUndefinedEffect("quotesOnKeys", props.quotesOnKeys);
|
|
15630
|
+
useSetIfNotUndefinedEffect("displayDataTypes", props.displayDataTypes);
|
|
15631
|
+
useSetIfNotUndefinedEffect("displaySize", props.displaySize);
|
|
15632
|
+
useSetIfNotUndefinedEffect("displayComma", props.displayComma);
|
|
15633
|
+
useSetIfNotUndefinedEffect("highlightUpdates", props.highlightUpdates);
|
|
15634
|
+
(0, import_react48.useEffect)(() => {
|
|
15635
|
+
if (props.theme === "light") {
|
|
15636
|
+
setState({
|
|
15637
|
+
colorspace: lightColorspace
|
|
15638
|
+
});
|
|
15639
|
+
} else if (props.theme === "dark") {
|
|
15640
|
+
setState({
|
|
15641
|
+
colorspace: darkColorspace
|
|
15642
|
+
});
|
|
15643
|
+
} else if (typeof props.theme === "object") {
|
|
15644
|
+
setState({
|
|
15645
|
+
colorspace: props.theme
|
|
15646
|
+
});
|
|
15647
|
+
}
|
|
15648
|
+
}, [
|
|
15649
|
+
setState,
|
|
15650
|
+
props.theme
|
|
15651
|
+
]);
|
|
15652
|
+
const themeCls = (0, import_react48.useMemo)(() => {
|
|
15653
|
+
if (typeof props.theme === "object") return "json-viewer-theme-custom";
|
|
15654
|
+
return props.theme === "dark" ? "json-viewer-theme-dark" : "json-viewer-theme-light";
|
|
15655
|
+
}, [
|
|
15656
|
+
props.theme
|
|
15657
|
+
]);
|
|
15658
|
+
const onceRef = (0, import_react48.useRef)(true);
|
|
15659
|
+
const registerTypes = useTypeRegistryStore((store) => store.registerTypes);
|
|
15660
|
+
if (onceRef.current) {
|
|
15661
|
+
const allTypes = props.valueTypes ? [
|
|
15662
|
+
...predefinedTypes,
|
|
15663
|
+
...props.valueTypes
|
|
15664
|
+
] : [
|
|
15665
|
+
...predefinedTypes
|
|
15666
|
+
];
|
|
15667
|
+
registerTypes(allTypes);
|
|
15668
|
+
onceRef.current = false;
|
|
15669
|
+
}
|
|
15670
|
+
(0, import_react48.useEffect)(() => {
|
|
15671
|
+
const allTypes = props.valueTypes ? [
|
|
15672
|
+
...predefinedTypes,
|
|
15673
|
+
...props.valueTypes
|
|
15674
|
+
] : [
|
|
15675
|
+
...predefinedTypes
|
|
15676
|
+
];
|
|
15677
|
+
registerTypes(allTypes);
|
|
15678
|
+
}, [
|
|
15679
|
+
props.valueTypes,
|
|
15680
|
+
registerTypes
|
|
15681
|
+
]);
|
|
15682
|
+
const value = useJsonViewerStore((store) => store.value);
|
|
15683
|
+
const prevValue = useJsonViewerStore((store) => store.prevValue);
|
|
15684
|
+
const emptyPath = (0, import_react48.useMemo)(() => [], []);
|
|
15685
|
+
const setHover = useJsonViewerStore((store) => store.setHover);
|
|
15686
|
+
const onMouseLeave = (0, import_react48.useCallback)(() => setHover(null), [
|
|
15687
|
+
setHover
|
|
15688
|
+
]);
|
|
15689
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_material7.Paper, {
|
|
15690
|
+
elevation: 0,
|
|
15691
|
+
className: clsx(themeCls, props.className),
|
|
15692
|
+
style: props.style,
|
|
15693
|
+
sx: {
|
|
15694
|
+
fontFamily: "monospace",
|
|
15695
|
+
userSelect: "none",
|
|
15696
|
+
contentVisibility: "auto",
|
|
15697
|
+
...props.sx
|
|
15698
|
+
},
|
|
15699
|
+
onMouseLeave,
|
|
15700
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(DataKeyPair, {
|
|
15701
|
+
value,
|
|
15702
|
+
prevValue,
|
|
15703
|
+
path: emptyPath,
|
|
15704
|
+
last: true
|
|
15705
|
+
})
|
|
15706
|
+
});
|
|
15707
|
+
};
|
|
15708
|
+
var JsonViewer = function JsonViewer2(props) {
|
|
15709
|
+
if (true) {
|
|
15710
|
+
if ("displayObjectSize" in props) {
|
|
15711
|
+
console.error("`displayObjectSize` is deprecated. Use `displaySize` instead.\nSee https://viewer.textea.io/migration/migration-v3#raname-displayobjectsize-to-displaysize for more information.");
|
|
15712
|
+
}
|
|
15713
|
+
}
|
|
15714
|
+
const isAutoDarkTheme = useThemeDetector();
|
|
15715
|
+
const themeType = (0, import_react48.useMemo)(() => {
|
|
15716
|
+
var _props_theme;
|
|
15717
|
+
return props.theme === "auto" ? isAutoDarkTheme ? "dark" : "light" : (_props_theme = props.theme) !== null && _props_theme !== void 0 ? _props_theme : "light";
|
|
15718
|
+
}, [
|
|
15719
|
+
isAutoDarkTheme,
|
|
15720
|
+
props.theme
|
|
15721
|
+
]);
|
|
15722
|
+
const theme = (0, import_react48.useMemo)(() => {
|
|
15723
|
+
const backgroundColor = typeof themeType === "object" ? themeType.base00 : themeType === "dark" ? darkColorspace.base00 : lightColorspace.base00;
|
|
15724
|
+
const foregroundColor = typeof themeType === "object" ? themeType.base07 : themeType === "dark" ? darkColorspace.base07 : lightColorspace.base07;
|
|
15725
|
+
return (0, import_material7.createTheme)({
|
|
15726
|
+
components: {
|
|
15727
|
+
MuiPaper: {
|
|
15728
|
+
styleOverrides: {
|
|
15729
|
+
root: {
|
|
15730
|
+
backgroundColor,
|
|
15731
|
+
color: foregroundColor
|
|
15732
|
+
}
|
|
15733
|
+
}
|
|
15734
|
+
}
|
|
15735
|
+
},
|
|
15736
|
+
palette: {
|
|
15737
|
+
mode: themeType === "dark" ? "dark" : "light",
|
|
15738
|
+
background: {
|
|
15739
|
+
default: backgroundColor
|
|
15740
|
+
}
|
|
15741
|
+
}
|
|
15742
|
+
});
|
|
15743
|
+
}, [
|
|
15744
|
+
themeType
|
|
15745
|
+
]);
|
|
15746
|
+
const mixedProps = {
|
|
15747
|
+
...props,
|
|
15748
|
+
theme: themeType
|
|
15749
|
+
};
|
|
15750
|
+
const jsonViewerStore = (0, import_react48.useMemo)(() => createJsonViewerStore(props), []);
|
|
15751
|
+
const typeRegistryStore = (0, import_react48.useMemo)(() => createTypeRegistryStore(), []);
|
|
15752
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_material7.ThemeProvider, {
|
|
15753
|
+
theme,
|
|
15754
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(TypeRegistryStoreContext.Provider, {
|
|
15755
|
+
value: typeRegistryStore,
|
|
15756
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(JsonViewerStoreContext.Provider, {
|
|
15757
|
+
value: jsonViewerStore,
|
|
15758
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(JsonViewerInner, {
|
|
15759
|
+
...mixedProps
|
|
15760
|
+
})
|
|
15761
|
+
})
|
|
15762
|
+
})
|
|
15763
|
+
});
|
|
15764
|
+
};
|
|
15765
|
+
|
|
15766
|
+
// src/components/event-details/event-details.tsx
|
|
15767
|
+
var import_react53 = require("react");
|
|
15768
|
+
|
|
15769
|
+
// src/utils/iam-utils.ts
|
|
15770
|
+
function determinePermissionStatus(payload) {
|
|
15771
|
+
if (payload.explicit_deny_count && payload.explicit_deny_count > 0) {
|
|
15772
|
+
return "explicitly_denied";
|
|
15773
|
+
}
|
|
15774
|
+
if (payload.is_allowed && payload.explicit_allow_count && payload.explicit_allow_count > 0) {
|
|
15775
|
+
return "explicitly_allowed";
|
|
15776
|
+
}
|
|
15777
|
+
if (payload.is_allowed) {
|
|
15778
|
+
return "implicitly_allowed";
|
|
15779
|
+
}
|
|
15780
|
+
return "implicitly_denied";
|
|
15781
|
+
}
|
|
15782
|
+
function formatPermissionStatus(status) {
|
|
15783
|
+
switch (status) {
|
|
15784
|
+
case "explicitly_allowed": {
|
|
15785
|
+
return "Explicitly Allowed";
|
|
15786
|
+
}
|
|
15787
|
+
case "explicitly_denied": {
|
|
15788
|
+
return "Explicitly Denied";
|
|
15789
|
+
}
|
|
15790
|
+
case "implicitly_allowed": {
|
|
15791
|
+
return "Implicitly Allowed";
|
|
15792
|
+
}
|
|
15793
|
+
case "implicitly_denied": {
|
|
15794
|
+
return "Implicitly Denied";
|
|
15795
|
+
}
|
|
15796
|
+
}
|
|
15797
|
+
}
|
|
15798
|
+
function getPermissionStatusColor(status) {
|
|
15799
|
+
switch (status) {
|
|
15800
|
+
case "explicitly_allowed":
|
|
15801
|
+
case "implicitly_allowed": {
|
|
15802
|
+
return "success.main";
|
|
15803
|
+
}
|
|
15804
|
+
case "explicitly_denied": {
|
|
15805
|
+
return "error.main";
|
|
15806
|
+
}
|
|
15807
|
+
case "implicitly_denied": {
|
|
15808
|
+
return "warning.main";
|
|
15809
|
+
}
|
|
15810
|
+
}
|
|
15811
|
+
}
|
|
15812
|
+
function parseIAMEvent(payloadString) {
|
|
15813
|
+
try {
|
|
15814
|
+
const payload = JSON.parse(payloadString);
|
|
15815
|
+
const permission = determinePermissionStatus(payload);
|
|
15816
|
+
const actions = [];
|
|
15817
|
+
const resources = [];
|
|
15818
|
+
if (payload.explicit_allows) {
|
|
15819
|
+
for (const allow of payload.explicit_allows) {
|
|
15820
|
+
if (!actions.includes(allow.action)) actions.push(allow.action);
|
|
15821
|
+
if (!resources.includes(allow.resource)) resources.push(allow.resource);
|
|
15822
|
+
}
|
|
15823
|
+
}
|
|
15824
|
+
if (payload.explicit_denies) {
|
|
15825
|
+
for (const deny of payload.explicit_denies) {
|
|
15826
|
+
if (!actions.includes(deny.action)) actions.push(deny.action);
|
|
15827
|
+
if (!resources.includes(deny.resource)) resources.push(deny.resource);
|
|
15828
|
+
}
|
|
15829
|
+
}
|
|
15830
|
+
if (payload.implicit_denies) {
|
|
15831
|
+
for (const deny of payload.implicit_denies) {
|
|
15832
|
+
if (!actions.includes(deny.action)) actions.push(deny.action);
|
|
15833
|
+
if (!resources.includes(deny.resource)) resources.push(deny.resource);
|
|
15834
|
+
}
|
|
15835
|
+
}
|
|
15836
|
+
return {
|
|
15837
|
+
details: {
|
|
15838
|
+
actions,
|
|
15839
|
+
explicitAllows: payload.explicit_allow_count,
|
|
15840
|
+
explicitDenies: payload.explicit_deny_count,
|
|
15841
|
+
implicitDenies: payload.implicit_deny_count,
|
|
15842
|
+
resources
|
|
15843
|
+
},
|
|
15844
|
+
operation: payload.operation,
|
|
15845
|
+
permission,
|
|
15846
|
+
principal: payload.principal_arn,
|
|
15847
|
+
service: payload.service
|
|
15848
|
+
};
|
|
15849
|
+
} catch (error) {
|
|
15850
|
+
console.error("Error parsing IAM event payload:", error);
|
|
15851
|
+
return void 0;
|
|
15852
|
+
}
|
|
15853
|
+
}
|
|
15854
|
+
|
|
15855
|
+
// src/utils/event-utils.ts
|
|
15856
|
+
var iamEventParser = (eventName, attributes) => {
|
|
15857
|
+
if (attributes?.payload && typeof attributes.payload === "string") {
|
|
15858
|
+
const parsedIAM = parseIAMEvent(attributes.payload);
|
|
15859
|
+
if (parsedIAM) {
|
|
15860
|
+
const headline2 = `${parsedIAM.service}:${parsedIAM.operation} - ${formatPermissionStatus(parsedIAM.permission)}`;
|
|
15861
|
+
const messageParts = [`Principal: ${parsedIAM.principal}`];
|
|
15862
|
+
if (parsedIAM.details.actions && parsedIAM.details.actions.length > 0) {
|
|
15863
|
+
messageParts.push(`Actions: ${parsedIAM.details.actions.join(", ")}`);
|
|
15864
|
+
}
|
|
15865
|
+
if (parsedIAM.details.resources && parsedIAM.details.resources.length > 0) {
|
|
15866
|
+
messageParts.push(`Resources: ${parsedIAM.details.resources.join(", ")}`);
|
|
15867
|
+
}
|
|
15868
|
+
const detailsParts = [];
|
|
15869
|
+
if (parsedIAM.details.explicitAllows !== void 0) {
|
|
15870
|
+
detailsParts.push(`Explicit Allows: ${String(parsedIAM.details.explicitAllows)}`);
|
|
15871
|
+
}
|
|
15872
|
+
if (parsedIAM.details.explicitDenies !== void 0) {
|
|
15873
|
+
detailsParts.push(`Explicit Denies: ${String(parsedIAM.details.explicitDenies)}`);
|
|
15874
|
+
}
|
|
15875
|
+
if (parsedIAM.details.implicitDenies !== void 0) {
|
|
15876
|
+
detailsParts.push(`Implicit Denies: ${String(parsedIAM.details.implicitDenies)}`);
|
|
15877
|
+
}
|
|
15878
|
+
return {
|
|
15879
|
+
details: detailsParts.join("\n"),
|
|
15880
|
+
headline: headline2,
|
|
15881
|
+
message: messageParts.join("\n")
|
|
15882
|
+
};
|
|
15883
|
+
}
|
|
15884
|
+
}
|
|
15885
|
+
const headline = eventName || "IAM Event";
|
|
15886
|
+
const message = typeof attributes?.message === "string" ? attributes.message : "";
|
|
15887
|
+
const details = typeof attributes?.details === "string" ? attributes.details : "";
|
|
15888
|
+
return { details, headline, message };
|
|
15889
|
+
};
|
|
15890
|
+
var defaultEventParser = (eventName, attributes) => {
|
|
15891
|
+
const headline = eventName || "Event";
|
|
15892
|
+
const message = typeof attributes?.message === "string" ? attributes.message : "";
|
|
15893
|
+
const details = JSON.stringify(attributes ?? {}, void 0, 2);
|
|
15894
|
+
return { details, headline, message };
|
|
15895
|
+
};
|
|
15896
|
+
var eventParsers = {
|
|
15897
|
+
"iam.error": iamEventParser,
|
|
15898
|
+
"iam.event": iamEventParser,
|
|
15899
|
+
"iam.warning": iamEventParser
|
|
15900
|
+
};
|
|
15901
|
+
var parseEventMessage = (event) => {
|
|
15902
|
+
if (event.event_type && event.name) {
|
|
15903
|
+
try {
|
|
15904
|
+
const parser = eventParsers[event.event_type] ?? defaultEventParser;
|
|
15905
|
+
return parser(event.name, event.attributes);
|
|
15906
|
+
} catch (error) {
|
|
15907
|
+
console.error(`Error parsing event for type ${event.event_type}:`, error);
|
|
15908
|
+
return {
|
|
15909
|
+
details: "",
|
|
15910
|
+
headline: event.name || "Unknown Event",
|
|
15911
|
+
message: JSON.stringify(event.attributes)
|
|
15912
|
+
};
|
|
14079
15913
|
}
|
|
14080
|
-
|
|
15914
|
+
}
|
|
15915
|
+
return {
|
|
15916
|
+
details: JSON.stringify(event.attributes ?? {}),
|
|
15917
|
+
headline: event.name || "Event",
|
|
15918
|
+
message: typeof event.attributes?.message === "string" ? event.attributes.message : ""
|
|
15919
|
+
};
|
|
15920
|
+
};
|
|
15921
|
+
var EventLevel = {
|
|
15922
|
+
LevelError: 4,
|
|
15923
|
+
LevelInfo: 1,
|
|
15924
|
+
LevelNone: 0,
|
|
15925
|
+
LevelPermission: 2,
|
|
15926
|
+
LevelWarning: 3
|
|
15927
|
+
};
|
|
15928
|
+
var getEventGroup = (eventType) => {
|
|
15929
|
+
if (!eventType) return "info";
|
|
15930
|
+
if (eventType.includes("error")) return "error";
|
|
15931
|
+
if (eventType.includes("warning")) return "warning";
|
|
15932
|
+
if (eventType.includes("iam")) return "permission";
|
|
15933
|
+
return "info";
|
|
15934
|
+
};
|
|
15935
|
+
var getEventGroupsByType = (events) => {
|
|
15936
|
+
if (events.length === 0) {
|
|
15937
|
+
return {};
|
|
15938
|
+
}
|
|
15939
|
+
const groups = {};
|
|
15940
|
+
for (const event of events) {
|
|
15941
|
+
const group4 = getEventGroup(event.event_type);
|
|
15942
|
+
switch (group4) {
|
|
15943
|
+
case "error": {
|
|
15944
|
+
groups.errors = [...groups.errors ?? [], event];
|
|
15945
|
+
break;
|
|
15946
|
+
}
|
|
15947
|
+
case "permission": {
|
|
15948
|
+
groups.permissions = [...groups.permissions ?? [], event];
|
|
15949
|
+
break;
|
|
15950
|
+
}
|
|
15951
|
+
case "warning": {
|
|
15952
|
+
groups.warnings = [...groups.warnings ?? [], event];
|
|
15953
|
+
break;
|
|
15954
|
+
}
|
|
15955
|
+
default: {
|
|
15956
|
+
groups.info = [...groups.info ?? [], event];
|
|
15957
|
+
}
|
|
15958
|
+
}
|
|
15959
|
+
}
|
|
15960
|
+
return groups;
|
|
14081
15961
|
};
|
|
14082
|
-
|
|
14083
|
-
// src/components/event-details/event-section.tsx
|
|
14084
|
-
var import_material13 = require("@mui/material");
|
|
14085
15962
|
|
|
14086
15963
|
// src/components/event-details/event-detail.tsx
|
|
14087
|
-
var
|
|
15964
|
+
var import_icons_material6 = require("@mui/icons-material");
|
|
14088
15965
|
var import_material11 = require("@mui/material");
|
|
14089
|
-
var
|
|
15966
|
+
var import_react50 = require("react");
|
|
14090
15967
|
|
|
14091
15968
|
// src/components/status-icon.tsx
|
|
14092
|
-
var
|
|
15969
|
+
var import_icons_material3 = require("@mui/icons-material");
|
|
14093
15970
|
var import_material8 = require("@mui/material");
|
|
14094
15971
|
var import_jsx_runtime130 = require("react/jsx-runtime");
|
|
14095
15972
|
var StatusIcon = ({ errorLevel }) => {
|
|
14096
15973
|
switch (errorLevel) {
|
|
14097
15974
|
case EventLevel.LevelError: {
|
|
14098
|
-
return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
|
|
15975
|
+
return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(import_icons_material3.Cancel, { sx: { color: "red" } });
|
|
14099
15976
|
}
|
|
14100
15977
|
case EventLevel.LevelInfo: {
|
|
14101
|
-
return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
|
|
15978
|
+
return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(import_icons_material3.Info, { sx: { color: "gray" } });
|
|
14102
15979
|
}
|
|
14103
15980
|
case EventLevel.LevelPermission: {
|
|
14104
|
-
return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
|
|
15981
|
+
return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(import_icons_material3.RemoveCircle, { sx: { color: "blue" } });
|
|
14105
15982
|
}
|
|
14106
15983
|
case EventLevel.LevelWarning: {
|
|
14107
|
-
return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
|
|
15984
|
+
return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(import_icons_material3.Error, { sx: { color: "orange" } });
|
|
14108
15985
|
}
|
|
14109
15986
|
default: {
|
|
14110
|
-
return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
|
|
15987
|
+
return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(import_icons_material3.CheckCircle, { sx: { color: "lightgray" } });
|
|
14111
15988
|
}
|
|
14112
15989
|
}
|
|
14113
15990
|
};
|
|
14114
15991
|
|
|
14115
15992
|
// src/components/event-details/iam-event-detail.tsx
|
|
14116
|
-
var
|
|
15993
|
+
var import_icons_material4 = require("@mui/icons-material");
|
|
14117
15994
|
var import_material9 = require("@mui/material");
|
|
14118
15995
|
var import_jsx_runtime131 = require("react/jsx-runtime");
|
|
14119
15996
|
var DetailRow = ({ content, label }) => /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(import_material9.Grid, { container: true, spacing: 0, sx: { mb: 1 }, children: [
|
|
@@ -14144,13 +16021,13 @@ var PermissionIcon = ({ status }) => {
|
|
|
14144
16021
|
switch (status) {
|
|
14145
16022
|
case "explicitly_allowed":
|
|
14146
16023
|
case "implicitly_allowed": {
|
|
14147
|
-
return /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
|
|
16024
|
+
return /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(import_icons_material4.CheckCircle, { sx: { color: "success.main", fontSize: "1rem" } });
|
|
14148
16025
|
}
|
|
14149
16026
|
case "explicitly_denied": {
|
|
14150
|
-
return /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
|
|
16027
|
+
return /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(import_icons_material4.Error, { sx: { color: "error.main", fontSize: "1rem" } });
|
|
14151
16028
|
}
|
|
14152
16029
|
case "implicitly_denied": {
|
|
14153
|
-
return /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
|
|
16030
|
+
return /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(import_icons_material4.Warning, { sx: { color: "warning.main", fontSize: "1rem" } });
|
|
14154
16031
|
}
|
|
14155
16032
|
}
|
|
14156
16033
|
};
|
|
@@ -14235,9 +16112,9 @@ var IAMEventDetail = ({ event }) => {
|
|
|
14235
16112
|
};
|
|
14236
16113
|
|
|
14237
16114
|
// src/components/event-details/iam-permission-detail.tsx
|
|
14238
|
-
var
|
|
16115
|
+
var import_icons_material5 = require("@mui/icons-material");
|
|
14239
16116
|
var import_material10 = require("@mui/material");
|
|
14240
|
-
var
|
|
16117
|
+
var import_react49 = require("react");
|
|
14241
16118
|
var import_jsx_runtime132 = require("react/jsx-runtime");
|
|
14242
16119
|
var getChipColors = (status) => {
|
|
14243
16120
|
const isAllowed = status === "explicitly_allowed" || status === "implicitly_allowed";
|
|
@@ -14247,8 +16124,8 @@ var getChipColors = (status) => {
|
|
|
14247
16124
|
};
|
|
14248
16125
|
};
|
|
14249
16126
|
var IAMPermissionItem = ({ event }) => {
|
|
14250
|
-
const [isOpen, setIsOpen] = (0,
|
|
14251
|
-
const parsedData = (0,
|
|
16127
|
+
const [isOpen, setIsOpen] = (0, import_react49.useState)(false);
|
|
16128
|
+
const parsedData = (0, import_react49.useMemo)(() => {
|
|
14252
16129
|
const payloadString = event.attributes?.payload;
|
|
14253
16130
|
if (!payloadString) {
|
|
14254
16131
|
return;
|
|
@@ -14270,7 +16147,7 @@ var IAMPermissionItem = ({ event }) => {
|
|
|
14270
16147
|
/* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(import_material10.Box, { sx: { alignItems: "center", display: "flex" }, children: [
|
|
14271
16148
|
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(import_material10.IconButton, { onClick: () => {
|
|
14272
16149
|
setIsOpen(!isOpen);
|
|
14273
|
-
}, size: "small", sx: { mr: 1, p: 0 }, children: isOpen ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
|
|
16150
|
+
}, size: "small", sx: { mr: 1, p: 0 }, children: isOpen ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(import_icons_material5.KeyboardArrowDown, {}) : /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(import_icons_material5.KeyboardArrowRight, {}) }),
|
|
14274
16151
|
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
|
|
14275
16152
|
import_material10.Chip,
|
|
14276
16153
|
{
|
|
@@ -14318,15 +16195,15 @@ var DetailRow2 = ({ content, label }) => /* @__PURE__ */ (0, import_jsx_runtime1
|
|
|
14318
16195
|
) : content })
|
|
14319
16196
|
] });
|
|
14320
16197
|
var EventMessage = ({ event }) => {
|
|
14321
|
-
const [isOpen, setIsOpen] = (0,
|
|
14322
|
-
const [isOverflowing, setIsOverflowing] = (0,
|
|
14323
|
-
const textReference = (0,
|
|
14324
|
-
const parsedMessage = (0,
|
|
14325
|
-
const isIAMPolicyEvent = (0,
|
|
16198
|
+
const [isOpen, setIsOpen] = (0, import_react50.useState)(false);
|
|
16199
|
+
const [isOverflowing, setIsOverflowing] = (0, import_react50.useState)(false);
|
|
16200
|
+
const textReference = (0, import_react50.useRef)(null);
|
|
16201
|
+
const parsedMessage = (0, import_react50.useMemo)(() => parseEventMessage(event), [event]);
|
|
16202
|
+
const isIAMPolicyEvent = (0, import_react50.useMemo)(
|
|
14326
16203
|
() => event.event_type === "iam.policy_evaluation" && event.attributes?.payload && typeof event.attributes.payload === "string",
|
|
14327
16204
|
[event]
|
|
14328
16205
|
);
|
|
14329
|
-
(0,
|
|
16206
|
+
(0, import_react50.useEffect)(() => {
|
|
14330
16207
|
const checkOverflow = () => {
|
|
14331
16208
|
const element = textReference.current;
|
|
14332
16209
|
if (element) {
|
|
@@ -14339,11 +16216,11 @@ var EventMessage = ({ event }) => {
|
|
|
14339
16216
|
window.removeEventListener("resize", checkOverflow);
|
|
14340
16217
|
};
|
|
14341
16218
|
}, [parsedMessage.headline]);
|
|
14342
|
-
const hasAdditionalContent = (0,
|
|
16219
|
+
const hasAdditionalContent = (0, import_react50.useMemo)(
|
|
14343
16220
|
() => parsedMessage.message || parsedMessage.details || isIAMPolicyEvent,
|
|
14344
16221
|
[parsedMessage.message, parsedMessage.details, isIAMPolicyEvent]
|
|
14345
16222
|
);
|
|
14346
|
-
const shouldShowToggle = (0,
|
|
16223
|
+
const shouldShowToggle = (0, import_react50.useMemo)(
|
|
14347
16224
|
() => isOverflowing || hasAdditionalContent,
|
|
14348
16225
|
[isOverflowing, hasAdditionalContent]
|
|
14349
16226
|
);
|
|
@@ -14357,7 +16234,7 @@ var EventMessage = ({ event }) => {
|
|
|
14357
16234
|
},
|
|
14358
16235
|
size: "small",
|
|
14359
16236
|
sx: { mr: 1, mt: -0.5, p: 0 },
|
|
14360
|
-
children: isOpen ? /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
16237
|
+
children: isOpen ? /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_icons_material6.KeyboardArrowDown, {}) : /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_icons_material6.KeyboardArrowRight, {})
|
|
14361
16238
|
}
|
|
14362
16239
|
),
|
|
14363
16240
|
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
@@ -14482,85 +16359,6 @@ var EventDetail = ({
|
|
|
14482
16359
|
] });
|
|
14483
16360
|
};
|
|
14484
16361
|
|
|
14485
|
-
// src/components/event-details/toggle-section.tsx
|
|
14486
|
-
var import_icons_material8 = require("@mui/icons-material");
|
|
14487
|
-
var import_material12 = require("@mui/material");
|
|
14488
|
-
var import_react50 = require("react");
|
|
14489
|
-
var import_jsx_runtime134 = require("react/jsx-runtime");
|
|
14490
|
-
var ToggleSection = ({ children, headline, initialOpen = true }) => {
|
|
14491
|
-
const [isOpen, setIsOpen] = (0, import_react50.useState)(initialOpen);
|
|
14492
|
-
return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(import_material12.Box, { sx: { mt: 4 }, children: [
|
|
14493
|
-
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
|
|
14494
|
-
import_material12.Box,
|
|
14495
|
-
{
|
|
14496
|
-
onClick: () => {
|
|
14497
|
-
setIsOpen(!isOpen);
|
|
14498
|
-
},
|
|
14499
|
-
sx: {
|
|
14500
|
-
cursor: "pointer",
|
|
14501
|
-
mb: 1
|
|
14502
|
-
},
|
|
14503
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(
|
|
14504
|
-
import_material12.Box,
|
|
14505
|
-
{
|
|
14506
|
-
role: "button",
|
|
14507
|
-
sx: {
|
|
14508
|
-
alignItems: "center",
|
|
14509
|
-
display: "flex",
|
|
14510
|
-
gap: 1
|
|
14511
|
-
},
|
|
14512
|
-
children: [
|
|
14513
|
-
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_material12.Typography, { sx: { fontWeight: 600 }, variant: "subtitle2", children: headline }),
|
|
14514
|
-
isOpen ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_icons_material8.KeyboardArrowDown, { sx: { color: "text.secondary", height: 20, width: 20 } }) : /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_icons_material8.KeyboardArrowRight, { sx: { color: "text.secondary", height: 20, width: 20 } })
|
|
14515
|
-
]
|
|
14516
|
-
}
|
|
14517
|
-
)
|
|
14518
|
-
}
|
|
14519
|
-
),
|
|
14520
|
-
isOpen && /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_material12.Box, { children })
|
|
14521
|
-
] });
|
|
14522
|
-
};
|
|
14523
|
-
|
|
14524
|
-
// src/components/event-details/event-section.tsx
|
|
14525
|
-
var import_jsx_runtime135 = require("react/jsx-runtime");
|
|
14526
|
-
var EventSection = ({
|
|
14527
|
-
eventGroups,
|
|
14528
|
-
headline
|
|
14529
|
-
}) => /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(ToggleSection, { headline, children: /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(import_material13.Box, { children: [
|
|
14530
|
-
eventGroups.errors && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
14531
|
-
EventDetail,
|
|
14532
|
-
{
|
|
14533
|
-
displayText: "Error",
|
|
14534
|
-
events: eventGroups.errors,
|
|
14535
|
-
type: "error"
|
|
14536
|
-
}
|
|
14537
|
-
),
|
|
14538
|
-
eventGroups.warnings && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
14539
|
-
EventDetail,
|
|
14540
|
-
{
|
|
14541
|
-
displayText: "Warning",
|
|
14542
|
-
events: eventGroups.warnings,
|
|
14543
|
-
type: "warning"
|
|
14544
|
-
}
|
|
14545
|
-
),
|
|
14546
|
-
eventGroups.permissions && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
14547
|
-
EventDetail,
|
|
14548
|
-
{
|
|
14549
|
-
displayText: "IAM Permission",
|
|
14550
|
-
events: eventGroups.permissions,
|
|
14551
|
-
type: "permission"
|
|
14552
|
-
}
|
|
14553
|
-
),
|
|
14554
|
-
eventGroups.info && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
14555
|
-
EventDetail,
|
|
14556
|
-
{
|
|
14557
|
-
displayText: "Info",
|
|
14558
|
-
events: eventGroups.info,
|
|
14559
|
-
type: "info"
|
|
14560
|
-
}
|
|
14561
|
-
)
|
|
14562
|
-
] }) });
|
|
14563
|
-
|
|
14564
16362
|
// node_modules/@smithy/protocol-http/dist-es/extensions/httpExtensionConfiguration.js
|
|
14565
16363
|
var getHttpHandlerExtensionConfiguration = (runtimeConfig) => {
|
|
14566
16364
|
return {
|
|
@@ -14651,9 +16449,9 @@ var HttpRequest = class _HttpRequest {
|
|
|
14651
16449
|
return _HttpRequest.clone(this);
|
|
14652
16450
|
}
|
|
14653
16451
|
};
|
|
14654
|
-
function cloneQuery(
|
|
14655
|
-
return Object.keys(
|
|
14656
|
-
const param =
|
|
16452
|
+
function cloneQuery(query2) {
|
|
16453
|
+
return Object.keys(query2).reduce((carry, paramName) => {
|
|
16454
|
+
const param = query2[paramName];
|
|
14657
16455
|
return {
|
|
14658
16456
|
...carry,
|
|
14659
16457
|
[paramName]: Array.isArray(param) ? [...param] : param
|
|
@@ -15025,10 +16823,10 @@ var escapeUri = (uri) => encodeURIComponent(uri).replace(/[!'()*]/g, hexEncode);
|
|
|
15025
16823
|
var hexEncode = (c3) => `%${c3.charCodeAt(0).toString(16).toUpperCase()}`;
|
|
15026
16824
|
|
|
15027
16825
|
// node_modules/@smithy/querystring-builder/dist-es/index.js
|
|
15028
|
-
function buildQueryString(
|
|
16826
|
+
function buildQueryString(query2) {
|
|
15029
16827
|
const parts = [];
|
|
15030
|
-
for (let key of Object.keys(
|
|
15031
|
-
const value =
|
|
16828
|
+
for (let key of Object.keys(query2).sort()) {
|
|
16829
|
+
const value = query2[key];
|
|
15032
16830
|
key = escapeUri(key);
|
|
15033
16831
|
if (Array.isArray(value)) {
|
|
15034
16832
|
for (let i2 = 0, iLen = value.length; i2 < iLen; i2++) {
|
|
@@ -15395,7 +17193,7 @@ var findHeader = (pattern, headers) => {
|
|
|
15395
17193
|
|
|
15396
17194
|
// node_modules/@smithy/querystring-parser/dist-es/index.js
|
|
15397
17195
|
function parseQueryString(querystring) {
|
|
15398
|
-
const
|
|
17196
|
+
const query2 = {};
|
|
15399
17197
|
querystring = querystring.replace(/^\?/, "");
|
|
15400
17198
|
if (querystring) {
|
|
15401
17199
|
for (const pair of querystring.split("&")) {
|
|
@@ -15404,16 +17202,16 @@ function parseQueryString(querystring) {
|
|
|
15404
17202
|
if (value) {
|
|
15405
17203
|
value = decodeURIComponent(value);
|
|
15406
17204
|
}
|
|
15407
|
-
if (!(key in
|
|
15408
|
-
|
|
15409
|
-
} else if (Array.isArray(
|
|
15410
|
-
|
|
17205
|
+
if (!(key in query2)) {
|
|
17206
|
+
query2[key] = value;
|
|
17207
|
+
} else if (Array.isArray(query2[key])) {
|
|
17208
|
+
query2[key].push(value);
|
|
15411
17209
|
} else {
|
|
15412
|
-
|
|
17210
|
+
query2[key] = [query2[key], value];
|
|
15413
17211
|
}
|
|
15414
17212
|
}
|
|
15415
17213
|
}
|
|
15416
|
-
return
|
|
17214
|
+
return query2;
|
|
15417
17215
|
}
|
|
15418
17216
|
|
|
15419
17217
|
// node_modules/@smithy/url-parser/dist-es/index.js
|
|
@@ -15422,16 +17220,16 @@ var parseUrl = (url) => {
|
|
|
15422
17220
|
return parseUrl(new URL(url));
|
|
15423
17221
|
}
|
|
15424
17222
|
const { hostname, pathname, port, protocol, search } = url;
|
|
15425
|
-
let
|
|
17223
|
+
let query2;
|
|
15426
17224
|
if (search) {
|
|
15427
|
-
|
|
17225
|
+
query2 = parseQueryString(search);
|
|
15428
17226
|
}
|
|
15429
17227
|
return {
|
|
15430
17228
|
hostname,
|
|
15431
17229
|
port: port ? parseInt(port) : void 0,
|
|
15432
17230
|
protocol,
|
|
15433
17231
|
path: pathname,
|
|
15434
|
-
query
|
|
17232
|
+
query: query2
|
|
15435
17233
|
};
|
|
15436
17234
|
};
|
|
15437
17235
|
|
|
@@ -15834,8 +17632,8 @@ var TypeRegistry = class _TypeRegistry {
|
|
|
15834
17632
|
}
|
|
15835
17633
|
register(shapeId, schema) {
|
|
15836
17634
|
const qualifiedName = this.normalizeShapeId(shapeId);
|
|
15837
|
-
for (const
|
|
15838
|
-
|
|
17635
|
+
for (const r3 of [this, _TypeRegistry.for(qualifiedName.split("#")[0])]) {
|
|
17636
|
+
r3.schemas.set(qualifiedName, schema);
|
|
15839
17637
|
}
|
|
15840
17638
|
}
|
|
15841
17639
|
getSchema(shapeId) {
|
|
@@ -15848,9 +17646,9 @@ var TypeRegistry = class _TypeRegistry {
|
|
|
15848
17646
|
registerError(es, ctor) {
|
|
15849
17647
|
const $error = es;
|
|
15850
17648
|
const ns = $error[1];
|
|
15851
|
-
for (const
|
|
15852
|
-
|
|
15853
|
-
|
|
17649
|
+
for (const r3 of [this, _TypeRegistry.for(ns)]) {
|
|
17650
|
+
r3.schemas.set(ns + "#" + $error[2], $error);
|
|
17651
|
+
r3.exceptions.set($error, ctor);
|
|
15854
17652
|
}
|
|
15855
17653
|
}
|
|
15856
17654
|
getErrorCtor(es) {
|
|
@@ -16368,7 +18166,7 @@ var HttpProtocol = class extends SerdeContext {
|
|
|
16368
18166
|
var RpcProtocol = class extends HttpProtocol {
|
|
16369
18167
|
async serializeRequest(operationSchema, input, context) {
|
|
16370
18168
|
const serializer = this.serializer;
|
|
16371
|
-
const
|
|
18169
|
+
const query2 = {};
|
|
16372
18170
|
const headers = {};
|
|
16373
18171
|
const endpoint = await context.endpoint();
|
|
16374
18172
|
const ns = NormalizedSchema.of(operationSchema?.input);
|
|
@@ -16380,7 +18178,7 @@ var RpcProtocol = class extends HttpProtocol {
|
|
|
16380
18178
|
port: void 0,
|
|
16381
18179
|
path: "/",
|
|
16382
18180
|
fragment: void 0,
|
|
16383
|
-
query,
|
|
18181
|
+
query: query2,
|
|
16384
18182
|
headers,
|
|
16385
18183
|
body: void 0
|
|
16386
18184
|
});
|
|
@@ -16414,7 +18212,7 @@ var RpcProtocol = class extends HttpProtocol {
|
|
|
16414
18212
|
}
|
|
16415
18213
|
}
|
|
16416
18214
|
request.headers = Object.assign(request.headers, headers);
|
|
16417
|
-
request.query =
|
|
18215
|
+
request.query = query2;
|
|
16418
18216
|
request.body = payload;
|
|
16419
18217
|
request.method = "POST";
|
|
16420
18218
|
return request;
|
|
@@ -16705,13 +18503,13 @@ var getAttrPathList = (path) => {
|
|
|
16705
18503
|
};
|
|
16706
18504
|
|
|
16707
18505
|
// node_modules/@smithy/util-endpoints/dist-es/lib/getAttr.js
|
|
16708
|
-
var getAttr = (value, path) => getAttrPathList(path).reduce((acc,
|
|
18506
|
+
var getAttr = (value, path) => getAttrPathList(path).reduce((acc, index) => {
|
|
16709
18507
|
if (typeof acc !== "object") {
|
|
16710
|
-
throw new EndpointError(`Index '${
|
|
18508
|
+
throw new EndpointError(`Index '${index}' in '${path}' not found in '${JSON.stringify(value)}'`);
|
|
16711
18509
|
} else if (Array.isArray(acc)) {
|
|
16712
|
-
return acc[parseInt(
|
|
18510
|
+
return acc[parseInt(index)];
|
|
16713
18511
|
}
|
|
16714
|
-
return acc[
|
|
18512
|
+
return acc[index];
|
|
16715
18513
|
}, value);
|
|
16716
18514
|
|
|
16717
18515
|
// node_modules/@smithy/util-endpoints/dist-es/lib/isSet.js
|
|
@@ -16732,9 +18530,9 @@ var parseURL = (value) => {
|
|
|
16732
18530
|
return value;
|
|
16733
18531
|
}
|
|
16734
18532
|
if (typeof value === "object" && "hostname" in value) {
|
|
16735
|
-
const { hostname: hostname2, port, protocol: protocol2 = "", path = "", query = {} } = value;
|
|
18533
|
+
const { hostname: hostname2, port, protocol: protocol2 = "", path = "", query: query2 = {} } = value;
|
|
16736
18534
|
const url = new URL(`${protocol2}//${hostname2}${port ? `:${port}` : ""}${path}`);
|
|
16737
|
-
url.search = Object.entries(
|
|
18535
|
+
url.search = Object.entries(query2).map(([k2, v2]) => `${k2}=${v2}`).join("&");
|
|
16738
18536
|
return url;
|
|
16739
18537
|
}
|
|
16740
18538
|
return new URL(value);
|
|
@@ -17518,7 +19316,7 @@ var AwsSdkSigV4Signer = class {
|
|
|
17518
19316
|
};
|
|
17519
19317
|
|
|
17520
19318
|
// node_modules/@smithy/property-provider/dist-es/memoize.js
|
|
17521
|
-
var
|
|
19319
|
+
var memoize = (provider, isExpired, requiresRefresh) => {
|
|
17522
19320
|
let resolved;
|
|
17523
19321
|
let pending;
|
|
17524
19322
|
let hasResult;
|
|
@@ -17813,18 +19611,18 @@ var hasHeader = (soughtHeader, headers) => {
|
|
|
17813
19611
|
|
|
17814
19612
|
// node_modules/@smithy/signature-v4/dist-es/moveHeadersToQuery.js
|
|
17815
19613
|
var moveHeadersToQuery = (request, options = {}) => {
|
|
17816
|
-
const { headers, query = {} } = HttpRequest.clone(request);
|
|
19614
|
+
const { headers, query: query2 = {} } = HttpRequest.clone(request);
|
|
17817
19615
|
for (const name of Object.keys(headers)) {
|
|
17818
19616
|
const lname = name.toLowerCase();
|
|
17819
19617
|
if (lname.slice(0, 6) === "x-amz-" && !options.unhoistableHeaders?.has(lname) || options.hoistableHeaders?.has(lname)) {
|
|
17820
|
-
|
|
19618
|
+
query2[name] = headers[name];
|
|
17821
19619
|
delete headers[name];
|
|
17822
19620
|
}
|
|
17823
19621
|
}
|
|
17824
19622
|
return {
|
|
17825
19623
|
...request,
|
|
17826
19624
|
headers,
|
|
17827
|
-
query
|
|
19625
|
+
query: query2
|
|
17828
19626
|
};
|
|
17829
19627
|
};
|
|
17830
19628
|
|
|
@@ -17843,16 +19641,16 @@ var prepareRequest = (request) => {
|
|
|
17843
19641
|
init_dist_es();
|
|
17844
19642
|
|
|
17845
19643
|
// node_modules/@smithy/signature-v4/dist-es/getCanonicalQuery.js
|
|
17846
|
-
var getCanonicalQuery = ({ query = {} }) => {
|
|
19644
|
+
var getCanonicalQuery = ({ query: query2 = {} }) => {
|
|
17847
19645
|
const keys = [];
|
|
17848
19646
|
const serialized = {};
|
|
17849
|
-
for (const key of Object.keys(
|
|
19647
|
+
for (const key of Object.keys(query2)) {
|
|
17850
19648
|
if (key.toLowerCase() === SIGNATURE_HEADER) {
|
|
17851
19649
|
continue;
|
|
17852
19650
|
}
|
|
17853
19651
|
const encodedKey = escapeUri(key);
|
|
17854
19652
|
keys.push(encodedKey);
|
|
17855
|
-
const value =
|
|
19653
|
+
const value = query2[key];
|
|
17856
19654
|
if (typeof value === "string") {
|
|
17857
19655
|
serialized[encodedKey] = `${encodedKey}=${escapeUri(value)}`;
|
|
17858
19656
|
} else if (Array.isArray(value)) {
|
|
@@ -19958,8 +21756,8 @@ var escapeUserAgent = (userAgentPair) => {
|
|
|
19958
21756
|
if (prefix === "api") {
|
|
19959
21757
|
uaName = uaName.toLowerCase();
|
|
19960
21758
|
}
|
|
19961
|
-
return [prefix, uaName, version].filter((item) => item && item.length > 0).reduce((acc, item,
|
|
19962
|
-
switch (
|
|
21759
|
+
return [prefix, uaName, version].filter((item) => item && item.length > 0).reduce((acc, item, index) => {
|
|
21760
|
+
switch (index) {
|
|
19963
21761
|
case 0:
|
|
19964
21762
|
return item;
|
|
19965
21763
|
case 1:
|
|
@@ -21080,11 +22878,11 @@ var Sha2563 = (
|
|
|
21080
22878
|
|
|
21081
22879
|
// node_modules/@aws-sdk/util-user-agent-browser/dist-es/index.js
|
|
21082
22880
|
var createDefaultUserAgentProvider = ({ serviceId, clientVersion }) => async (config) => {
|
|
21083
|
-
const
|
|
21084
|
-
const uaString =
|
|
21085
|
-
const osName =
|
|
22881
|
+
const navigator2 = typeof window !== "undefined" ? window.navigator : void 0;
|
|
22882
|
+
const uaString = navigator2?.userAgent ?? "";
|
|
22883
|
+
const osName = navigator2?.userAgentData?.platform ?? fallback.os(uaString) ?? "other";
|
|
21086
22884
|
const osVersion = void 0;
|
|
21087
|
-
const brands =
|
|
22885
|
+
const brands = navigator2?.userAgentData?.brands ?? [];
|
|
21088
22886
|
const brand = brands[brands.length - 1];
|
|
21089
22887
|
const browserName = brand?.brand ?? fallback.browser(uaString) ?? "unknown";
|
|
21090
22888
|
const browserVersion = brand?.version ?? "unknown";
|
|
@@ -22026,7 +23824,7 @@ var invalidProvider = (message) => () => Promise.reject(message);
|
|
|
22026
23824
|
var DEFAULTS_MODE_OPTIONS = ["in-region", "cross-region", "mobile", "standard", "legacy"];
|
|
22027
23825
|
|
|
22028
23826
|
// node_modules/@smithy/util-defaults-mode-browser/dist-es/resolveDefaultsModeConfig.js
|
|
22029
|
-
var resolveDefaultsModeConfig = ({ defaultsMode } = {}) =>
|
|
23827
|
+
var resolveDefaultsModeConfig = ({ defaultsMode } = {}) => memoize(async () => {
|
|
22030
23828
|
const mode = typeof defaultsMode === "function" ? await defaultsMode() : defaultsMode;
|
|
22031
23829
|
switch (mode?.toLowerCase()) {
|
|
22032
23830
|
case "auto":
|
|
@@ -22044,15 +23842,15 @@ var resolveDefaultsModeConfig = ({ defaultsMode } = {}) => memoize2(async () =>
|
|
|
22044
23842
|
}
|
|
22045
23843
|
});
|
|
22046
23844
|
var useMobileConfiguration = () => {
|
|
22047
|
-
const
|
|
22048
|
-
if (
|
|
22049
|
-
const { effectiveType, rtt, downlink } =
|
|
23845
|
+
const navigator2 = window?.navigator;
|
|
23846
|
+
if (navigator2?.connection) {
|
|
23847
|
+
const { effectiveType, rtt, downlink } = navigator2?.connection;
|
|
22050
23848
|
const slow = typeof effectiveType === "string" && effectiveType !== "4g" || Number(rtt) > 100 || Number(downlink) < 10;
|
|
22051
23849
|
if (slow) {
|
|
22052
23850
|
return true;
|
|
22053
23851
|
}
|
|
22054
23852
|
}
|
|
22055
|
-
return
|
|
23853
|
+
return navigator2?.userAgentData?.mobile || typeof navigator2?.maxTouchPoints === "number" && navigator2?.maxTouchPoints > 1;
|
|
22056
23854
|
};
|
|
22057
23855
|
|
|
22058
23856
|
// node_modules/@aws-sdk/client-cloudwatch-logs/dist-es/runtimeConfig.shared.js
|
|
@@ -22080,10 +23878,10 @@ var n = {};
|
|
|
22080
23878
|
var o = { [x]: "Region" };
|
|
22081
23879
|
var p = { [v]: "getAttr", [w]: [{ [x]: g }, "supportsFIPS"] };
|
|
22082
23880
|
var q = { [v]: c2, [w]: [true, { [v]: "getAttr", [w]: [{ [x]: g }, "supportsDualStack"] }] };
|
|
22083
|
-
var
|
|
23881
|
+
var r2 = [l];
|
|
22084
23882
|
var s = [m];
|
|
22085
23883
|
var t = [o];
|
|
22086
|
-
var _data = { version: "1.0", parameters: { Region: i, UseDualStack: j, UseFIPS: j, Endpoint: i }, rules: [{ conditions: [{ [v]: b2, [w]: [k] }], rules: [{ conditions:
|
|
23884
|
+
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 }] };
|
|
22087
23885
|
var ruleSet = _data;
|
|
22088
23886
|
|
|
22089
23887
|
// node_modules/@aws-sdk/client-cloudwatch-logs/dist-es/endpoint/endpointResolver.js
|
|
@@ -24148,11 +25946,11 @@ var getHttpAuthExtensionConfiguration = (runtimeConfig) => {
|
|
|
24148
25946
|
let _credentials = runtimeConfig.credentials;
|
|
24149
25947
|
return {
|
|
24150
25948
|
setHttpAuthScheme(httpAuthScheme) {
|
|
24151
|
-
const
|
|
24152
|
-
if (
|
|
25949
|
+
const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId);
|
|
25950
|
+
if (index === -1) {
|
|
24153
25951
|
_httpAuthSchemes.push(httpAuthScheme);
|
|
24154
25952
|
} else {
|
|
24155
|
-
_httpAuthSchemes.splice(
|
|
25953
|
+
_httpAuthSchemes.splice(index, 1, httpAuthScheme);
|
|
24156
25954
|
}
|
|
24157
25955
|
},
|
|
24158
25956
|
httpAuthSchemes() {
|
|
@@ -24248,17 +26046,17 @@ var QueryStatus = {
|
|
|
24248
26046
|
};
|
|
24249
26047
|
|
|
24250
26048
|
// src/components/event-details/lambda-invoke-logs-section.tsx
|
|
24251
|
-
var
|
|
26049
|
+
var import_material12 = require("@mui/material");
|
|
24252
26050
|
var import_react51 = require("react");
|
|
24253
|
-
var
|
|
26051
|
+
var import_jsx_runtime134 = require("react/jsx-runtime");
|
|
24254
26052
|
var POLL_INTERVAL_MS = 1e3;
|
|
24255
26053
|
async function pollQueryResults(client, queryId) {
|
|
24256
26054
|
return client.send(new GetQueryResultsCommand({ queryId }));
|
|
24257
26055
|
}
|
|
24258
|
-
async function startLambdaLogsQuery(client,
|
|
26056
|
+
async function startLambdaLogsQuery(client, functionName2, requestId, startTimeSec, endTimeSec) {
|
|
24259
26057
|
const response = await client.send(new StartQueryCommand({
|
|
24260
26058
|
endTime: endTimeSec,
|
|
24261
|
-
logGroupName: `/aws/lambda/${
|
|
26059
|
+
logGroupName: `/aws/lambda/${functionName2}`,
|
|
24262
26060
|
queryString: `fields @timestamp, @message | filter @requestId = "${requestId}" | sort @timestamp asc`,
|
|
24263
26061
|
startTime: startTimeSec
|
|
24264
26062
|
}));
|
|
@@ -24277,7 +26075,7 @@ function useCloudWatchLogsClient(region) {
|
|
|
24277
26075
|
}), [region, localstackEndpoint]);
|
|
24278
26076
|
return client;
|
|
24279
26077
|
}
|
|
24280
|
-
function useLambdaInvokeLogs(
|
|
26078
|
+
function useLambdaInvokeLogs(functionName2, requestId, region, startTimeNano, endTimeNano) {
|
|
24281
26079
|
const [loading, setLoading] = (0, import_react51.useState)(true);
|
|
24282
26080
|
const [logs, setLogs] = (0, import_react51.useState)([]);
|
|
24283
26081
|
const [error, setError] = (0, import_react51.useState)();
|
|
@@ -24289,7 +26087,7 @@ function useLambdaInvokeLogs(functionName, requestId, region, startTimeNano, end
|
|
|
24289
26087
|
const endTimeSec = Math.ceil(Number(BigInt(endTimeNano) / BigInt(1e9)));
|
|
24290
26088
|
async function run() {
|
|
24291
26089
|
try {
|
|
24292
|
-
const queryId = await startLambdaLogsQuery(cloudWatchLogs,
|
|
26090
|
+
const queryId = await startLambdaLogsQuery(cloudWatchLogs, functionName2, requestId, startTimeSec - 60, endTimeSec + 60);
|
|
24293
26091
|
const poll = async () => {
|
|
24294
26092
|
if (cancelled) return;
|
|
24295
26093
|
try {
|
|
@@ -24334,42 +26132,85 @@ function useLambdaInvokeLogs(functionName, requestId, region, startTimeNano, end
|
|
|
24334
26132
|
cancelled = true;
|
|
24335
26133
|
if (pollTimerRef.current !== null) clearTimeout(pollTimerRef.current);
|
|
24336
26134
|
};
|
|
24337
|
-
}, [
|
|
26135
|
+
}, [functionName2, requestId, region, startTimeNano, endTimeNano]);
|
|
24338
26136
|
return { error, loading, logs };
|
|
24339
26137
|
}
|
|
24340
|
-
var LambdaInvokeLogsSection = ({ endTimeNano, functionName, region, requestId, startTimeNano }) => {
|
|
24341
|
-
const { error, loading, logs } = useLambdaInvokeLogs(
|
|
26138
|
+
var LambdaInvokeLogsSection = ({ endTimeNano, functionName: functionName2, region, requestId, startTimeNano }) => {
|
|
26139
|
+
const { error, loading, logs } = useLambdaInvokeLogs(functionName2, requestId, region, startTimeNano, endTimeNano);
|
|
24342
26140
|
if (loading) {
|
|
24343
|
-
return /* @__PURE__ */ (0,
|
|
24344
|
-
/* @__PURE__ */ (0,
|
|
24345
|
-
/* @__PURE__ */ (0,
|
|
26141
|
+
return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(import_material12.Stack, { alignItems: "center", direction: "row", spacing: 1, children: [
|
|
26142
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_material12.CircularProgress, { size: 14 }),
|
|
26143
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_material12.Typography, { color: "text.secondary", variant: "body2", children: "Loading logs\u2026" })
|
|
24346
26144
|
] });
|
|
24347
26145
|
}
|
|
24348
26146
|
if (error !== void 0) {
|
|
24349
|
-
return /* @__PURE__ */ (0,
|
|
26147
|
+
return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_material12.Typography, { color: "error", variant: "body2", children: error.message });
|
|
24350
26148
|
}
|
|
24351
26149
|
if (logs.length === 0) {
|
|
24352
|
-
return /* @__PURE__ */ (0,
|
|
26150
|
+
return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_material12.Typography, { color: "text.secondary", variant: "body2", children: "No logs found for this invocation." });
|
|
24353
26151
|
}
|
|
24354
|
-
return /* @__PURE__ */ (0,
|
|
26152
|
+
return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_material12.Box, { sx: { backgroundColor: (theme) => theme.palette.background.default, borderRadius: 1, p: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("pre", { style: { margin: 0, overflow: "auto" }, children: logs.map((log) => /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_material12.Typography, { variant: "body2", children: `[${log.timestamp}] ${log.message}` }, log.ptr)) }) });
|
|
24355
26153
|
};
|
|
24356
26154
|
|
|
24357
|
-
// src/components/event-details/
|
|
24358
|
-
var
|
|
24359
|
-
var
|
|
24360
|
-
|
|
24361
|
-
|
|
24362
|
-
|
|
24363
|
-
|
|
24364
|
-
|
|
24365
|
-
|
|
24366
|
-
|
|
24367
|
-
|
|
24368
|
-
|
|
24369
|
-
|
|
24370
|
-
|
|
24371
|
-
|
|
26155
|
+
// src/components/event-details/toggle-section.tsx
|
|
26156
|
+
var import_icons_material7 = require("@mui/icons-material");
|
|
26157
|
+
var import_material13 = require("@mui/material");
|
|
26158
|
+
var import_react52 = require("react");
|
|
26159
|
+
var import_jsx_runtime135 = require("react/jsx-runtime");
|
|
26160
|
+
var ToggleSection = ({ action, children, headline, initialOpen = true }) => {
|
|
26161
|
+
const [isOpen, setIsOpen] = (0, import_react52.useState)(initialOpen);
|
|
26162
|
+
return /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(import_material13.Box, { sx: { mt: 4 }, children: [
|
|
26163
|
+
/* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(
|
|
26164
|
+
import_material13.Box,
|
|
26165
|
+
{
|
|
26166
|
+
onClick: () => {
|
|
26167
|
+
setIsOpen(!isOpen);
|
|
26168
|
+
},
|
|
26169
|
+
sx: {
|
|
26170
|
+
alignItems: "center",
|
|
26171
|
+
cursor: "pointer",
|
|
26172
|
+
display: "flex",
|
|
26173
|
+
justifyContent: "space-between",
|
|
26174
|
+
mb: 1
|
|
26175
|
+
},
|
|
26176
|
+
children: [
|
|
26177
|
+
/* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(
|
|
26178
|
+
import_material13.Box,
|
|
26179
|
+
{
|
|
26180
|
+
role: "button",
|
|
26181
|
+
sx: {
|
|
26182
|
+
alignItems: "center",
|
|
26183
|
+
display: "flex",
|
|
26184
|
+
gap: 1
|
|
26185
|
+
},
|
|
26186
|
+
children: [
|
|
26187
|
+
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(import_material13.Typography, { sx: { fontWeight: 600 }, variant: "subtitle2", children: headline }),
|
|
26188
|
+
isOpen ? /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(import_icons_material7.KeyboardArrowDown, { sx: { color: "text.secondary", height: 20, width: 20 } }) : /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(import_icons_material7.KeyboardArrowRight, { sx: { color: "text.secondary", height: 20, width: 20 } })
|
|
26189
|
+
]
|
|
26190
|
+
}
|
|
26191
|
+
),
|
|
26192
|
+
action !== false && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(import_material13.Box, { onClick: (event) => {
|
|
26193
|
+
event.stopPropagation();
|
|
26194
|
+
}, children: action })
|
|
26195
|
+
]
|
|
26196
|
+
}
|
|
26197
|
+
),
|
|
26198
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(import_material13.Box, { children })
|
|
26199
|
+
] });
|
|
24372
26200
|
};
|
|
26201
|
+
|
|
26202
|
+
// src/components/event-details/event-details.tsx
|
|
26203
|
+
var import_jsx_runtime136 = require("react/jsx-runtime");
|
|
26204
|
+
function tryParseJson(value) {
|
|
26205
|
+
if (typeof value !== "string") {
|
|
26206
|
+
return value;
|
|
26207
|
+
}
|
|
26208
|
+
try {
|
|
26209
|
+
return JSON.parse(value);
|
|
26210
|
+
} catch {
|
|
26211
|
+
return value;
|
|
26212
|
+
}
|
|
26213
|
+
}
|
|
24373
26214
|
var checkIsLambdaInvoke = (span) => {
|
|
24374
26215
|
if (span.service_name !== "lambda") {
|
|
24375
26216
|
return false;
|
|
@@ -24377,97 +26218,157 @@ var checkIsLambdaInvoke = (span) => {
|
|
|
24377
26218
|
const operationName = span.operation_name.toLowerCase();
|
|
24378
26219
|
return operationName === "invoke" || operationName === "invokewithresponsestream" || operationName === "invokeasync";
|
|
24379
26220
|
};
|
|
26221
|
+
var checkIsSqsSendMessage = (span) => {
|
|
26222
|
+
if (span.service_name !== "sqs") {
|
|
26223
|
+
return false;
|
|
26224
|
+
}
|
|
26225
|
+
return span.operation_name.startsWith("SendMessage");
|
|
26226
|
+
};
|
|
24380
26227
|
var EventDetails = ({ onClose, selectedEvent }) => {
|
|
24381
|
-
const
|
|
24382
|
-
|
|
24383
|
-
|
|
24384
|
-
|
|
24385
|
-
const
|
|
24386
|
-
const resourceArn = typeof selectedEvent?.attributes?.["localstack.aws.resource_arn"] === "string" ? selectedEvent.attributes["localstack.aws.resource_arn"] : void 0;
|
|
26228
|
+
const eventGroups = (0, import_react53.useMemo)(
|
|
26229
|
+
() => getEventGroupsByType(selectedEvent?.events ?? []),
|
|
26230
|
+
[selectedEvent?.events]
|
|
26231
|
+
);
|
|
26232
|
+
const [parseNestedJson, setParseNestedJson] = (0, import_react53.useState)(true);
|
|
24387
26233
|
if (!selectedEvent) {
|
|
24388
|
-
return /* @__PURE__ */ (0,
|
|
26234
|
+
return /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Box, { sx: { p: 3, textAlign: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Typography, { color: "text.secondary", variant: "body2", children: "Select an event to view details" }) });
|
|
24389
26235
|
}
|
|
24390
26236
|
const isLambdaInvoke = checkIsLambdaInvoke(selectedEvent);
|
|
24391
|
-
|
|
24392
|
-
|
|
24393
|
-
|
|
24394
|
-
|
|
24395
|
-
|
|
24396
|
-
|
|
24397
|
-
|
|
24398
|
-
|
|
24399
|
-
|
|
24400
|
-
|
|
24401
|
-
|
|
24402
|
-
|
|
24403
|
-
|
|
24404
|
-
|
|
24405
|
-
|
|
24406
|
-
|
|
24407
|
-
|
|
24408
|
-
|
|
24409
|
-
|
|
24410
|
-
|
|
24411
|
-
|
|
24412
|
-
|
|
24413
|
-
|
|
24414
|
-
|
|
24415
|
-
|
|
24416
|
-
|
|
26237
|
+
const isSqsSendMessage = checkIsSqsSendMessage(selectedEvent);
|
|
26238
|
+
const requestId = typeof selectedEvent.attributes?.["localstack.request_id"] === "string" ? selectedEvent.attributes["localstack.request_id"] : void 0;
|
|
26239
|
+
const resourceArn = typeof selectedEvent.attributes?.["localstack.aws.resource_arn"] === "string" ? selectedEvent.attributes["localstack.aws.resource_arn"] : void 0;
|
|
26240
|
+
const requestPayload = tryParseJson(selectedEvent.attributes?.["localstack.aws.service.request"]);
|
|
26241
|
+
if (parseNestedJson) {
|
|
26242
|
+
if (isLambdaInvoke && requestPayload && typeof requestPayload === "object" && "Payload" in requestPayload) {
|
|
26243
|
+
requestPayload.Payload = tryParseJson(requestPayload.Payload);
|
|
26244
|
+
} else if (isSqsSendMessage && requestPayload && typeof requestPayload === "object" && "MessageBody" in requestPayload) {
|
|
26245
|
+
requestPayload.MessageBody = tryParseJson(requestPayload.MessageBody);
|
|
26246
|
+
}
|
|
26247
|
+
}
|
|
26248
|
+
const responsePayload = tryParseJson(selectedEvent.attributes?.["localstack.aws.service.response"]);
|
|
26249
|
+
if (parseNestedJson && isLambdaInvoke && responsePayload && typeof responsePayload === "object" && "Payload" in responsePayload) {
|
|
26250
|
+
responsePayload.Payload = tryParseJson(responsePayload.Payload);
|
|
26251
|
+
}
|
|
26252
|
+
const exceptionPayload = tryParseJson(selectedEvent.attributes?.["localstack.aws.service.exception"]);
|
|
26253
|
+
const hasPayloads = requestPayload !== void 0 || responsePayload !== void 0 || exceptionPayload !== void 0;
|
|
26254
|
+
const duration = selectedEvent.end_time_unix_nano ? ((BigInt(selectedEvent.end_time_unix_nano) - BigInt(selectedEvent.start_time_unix_nano)) / BigInt("1000000")).toString() : void 0;
|
|
26255
|
+
return /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_material14.Box, { "data-testid": "event-details", sx: { display: "flex", flexDirection: "column", height: "100%" }, children: [
|
|
26256
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(
|
|
26257
|
+
import_material14.Box,
|
|
26258
|
+
{
|
|
26259
|
+
sx: {
|
|
26260
|
+
alignItems: "center",
|
|
26261
|
+
borderBottom: "1px solid",
|
|
26262
|
+
borderColor: "divider",
|
|
26263
|
+
display: "flex",
|
|
26264
|
+
justifyContent: "space-between",
|
|
26265
|
+
px: 2,
|
|
26266
|
+
py: 1
|
|
26267
|
+
},
|
|
26268
|
+
children: [
|
|
26269
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Box, { children: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Typography, { sx: { fontWeight: 600 }, variant: "h6", children: "Operation Details" }) }),
|
|
26270
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.IconButton, { onClick: onClose, size: "small", children: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_icons_material8.Close, {}) })
|
|
26271
|
+
]
|
|
26272
|
+
}
|
|
26273
|
+
),
|
|
26274
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Box, { sx: { flexGrow: 1, overflow: "auto", p: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_material14.Stack, { spacing: 2, children: [
|
|
26275
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(ToggleSection, { headline: "Basic Information", children: /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_material14.Stack, { spacing: 1, children: [
|
|
26276
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_material14.Box, { sx: { display: "grid", gap: 2, gridTemplateColumns: "1.3fr 1fr" }, children: [
|
|
26277
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_material14.Box, { children: [
|
|
26278
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: "Service" }),
|
|
26279
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Typography, { variant: "body2", children: selectedEvent.service_name })
|
|
26280
|
+
] }),
|
|
26281
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_material14.Box, { children: [
|
|
26282
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: "Operation" }),
|
|
26283
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Typography, { variant: "body2", children: selectedEvent.operation_name })
|
|
26284
|
+
] })
|
|
24417
26285
|
] }),
|
|
24418
|
-
/* @__PURE__ */ (0,
|
|
24419
|
-
/* @__PURE__ */ (0,
|
|
24420
|
-
/* @__PURE__ */ (0,
|
|
26286
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_material14.Box, { children: [
|
|
26287
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: "Resource" }),
|
|
26288
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Typography, { variant: "body2", children: selectedEvent.resource_name })
|
|
24421
26289
|
] }),
|
|
24422
|
-
Boolean(
|
|
24423
|
-
/* @__PURE__ */ (0,
|
|
24424
|
-
/* @__PURE__ */ (0,
|
|
26290
|
+
Boolean(resourceArn) && /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_material14.Box, { children: [
|
|
26291
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: "Resource ARN" }),
|
|
26292
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Typography, { variant: "body2", children: resourceArn })
|
|
24425
26293
|
] }),
|
|
24426
|
-
|
|
24427
|
-
/* @__PURE__ */ (0,
|
|
24428
|
-
|
|
24429
|
-
|
|
24430
|
-
|
|
24431
|
-
|
|
24432
|
-
|
|
24433
|
-
|
|
24434
|
-
|
|
24435
|
-
/* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_material15.Typography, { variant: "body2", children: unixNanoToDate(selectedEvent.start_time_unix_nano)?.toISOString() })
|
|
26294
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_material14.Box, { sx: { display: "grid", gap: 1, gridTemplateColumns: "1.3fr 1fr" }, children: [
|
|
26295
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_material14.Box, { children: [
|
|
26296
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: "Account" }),
|
|
26297
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Typography, { variant: "body2", children: selectedEvent.account_id })
|
|
26298
|
+
] }),
|
|
26299
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_material14.Box, { children: [
|
|
26300
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: "Region" }),
|
|
26301
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Typography, { variant: "body2", children: selectedEvent.region })
|
|
26302
|
+
] })
|
|
24436
26303
|
] }),
|
|
24437
|
-
|
|
24438
|
-
/* @__PURE__ */ (0,
|
|
24439
|
-
|
|
24440
|
-
((
|
|
24441
|
-
|
|
24442
|
-
|
|
26304
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_material14.Box, { sx: { display: "grid", gap: 1, gridTemplateColumns: duration === void 0 ? "1fr" : "1.3fr 1fr" }, children: [
|
|
26305
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_material14.Box, { children: [
|
|
26306
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: "Start Time" }),
|
|
26307
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Typography, { variant: "body2", children: unixNanoToDate(selectedEvent.start_time_unix_nano)?.toISOString() })
|
|
26308
|
+
] }),
|
|
26309
|
+
duration !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_material14.Box, { children: [
|
|
26310
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: "Duration" }),
|
|
26311
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_material14.Typography, { variant: "body2", children: [
|
|
26312
|
+
duration,
|
|
26313
|
+
"ms"
|
|
26314
|
+
] })
|
|
24443
26315
|
] })
|
|
26316
|
+
] }),
|
|
26317
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_material14.Box, { children: [
|
|
26318
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: "Status" }),
|
|
26319
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Stack, { alignItems: "center", direction: "row", flexWrap: "wrap", gap: 1, sx: { mb: eventGroups.errors || eventGroups.warnings ? 1 : 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
|
|
26320
|
+
import_material14.Chip,
|
|
26321
|
+
{
|
|
26322
|
+
color: selectedEvent.status_code === 2 ? "error" : selectedEvent.status_code === 1 ? "success" : "default",
|
|
26323
|
+
label: selectedEvent.status_code === 2 ? "Error" : selectedEvent.status_code === 1 ? "OK" : "Unset",
|
|
26324
|
+
size: "small"
|
|
26325
|
+
}
|
|
26326
|
+
) })
|
|
24444
26327
|
] })
|
|
24445
26328
|
] }) }),
|
|
24446
|
-
/* @__PURE__ */ (0,
|
|
24447
|
-
/* @__PURE__ */ (0,
|
|
24448
|
-
/* @__PURE__ */ (0,
|
|
24449
|
-
|
|
24450
|
-
|
|
24451
|
-
|
|
24452
|
-
|
|
24453
|
-
|
|
24454
|
-
|
|
24455
|
-
)
|
|
24456
|
-
|
|
24457
|
-
] }) }),
|
|
24458
|
-
selectedEvent.events.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)(import_jsx_runtime137.Fragment, { children: [
|
|
24459
|
-
/* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_material15.Divider, {}),
|
|
24460
|
-
/* @__PURE__ */ (0, import_jsx_runtime137.jsx)(
|
|
24461
|
-
EventSection,
|
|
26329
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Divider, {}),
|
|
26330
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(ToggleSection, { headline: "Permissions", children: [
|
|
26331
|
+
!eventGroups.permissions && !eventGroups.errors && !eventGroups.warnings && /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Typography, { color: "text.secondary", variant: "body2", children: "There is no permission information available. Are IAM Policy Streams enabled?" }),
|
|
26332
|
+
eventGroups.permissions && /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(EventDetail, { displayText: "Permissions", events: eventGroups.permissions, type: "permission" }),
|
|
26333
|
+
eventGroups.errors && /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(EventDetail, { displayText: "Error", events: eventGroups.errors, type: "error" }),
|
|
26334
|
+
eventGroups.warnings && /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(EventDetail, { displayText: "Warning", events: eventGroups.warnings, type: "warning" })
|
|
26335
|
+
] }),
|
|
26336
|
+
hasPayloads && /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_jsx_runtime136.Fragment, { children: [
|
|
26337
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Divider, {}),
|
|
26338
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
|
|
26339
|
+
ToggleSection,
|
|
24462
26340
|
{
|
|
24463
|
-
|
|
24464
|
-
|
|
26341
|
+
action: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
|
|
26342
|
+
import_material14.FormControlLabel,
|
|
26343
|
+
{
|
|
26344
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Switch, { checked: !parseNestedJson, onChange: (event) => {
|
|
26345
|
+
setParseNestedJson(!event.target.checked);
|
|
26346
|
+
}, size: "small" }),
|
|
26347
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Typography, { variant: "caption", children: "View raw data" }),
|
|
26348
|
+
sx: { mr: 0 }
|
|
26349
|
+
}
|
|
26350
|
+
),
|
|
26351
|
+
headline: "Payloads",
|
|
26352
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_material14.Stack, { spacing: 2, children: [
|
|
26353
|
+
requestPayload !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_material14.Box, { children: [
|
|
26354
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: "Request" }),
|
|
26355
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(PayloadViewer, { value: requestPayload })
|
|
26356
|
+
] }),
|
|
26357
|
+
responsePayload !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_material14.Box, { children: [
|
|
26358
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: "Response" }),
|
|
26359
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(PayloadViewer, { value: responsePayload })
|
|
26360
|
+
] }),
|
|
26361
|
+
exceptionPayload !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_material14.Box, { children: [
|
|
26362
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: "Exception" }),
|
|
26363
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(PayloadViewer, { value: exceptionPayload })
|
|
26364
|
+
] })
|
|
26365
|
+
] })
|
|
24465
26366
|
}
|
|
24466
26367
|
)
|
|
24467
26368
|
] }),
|
|
24468
|
-
isLambdaInvoke && requestId !== void 0 && /* @__PURE__ */ (0,
|
|
24469
|
-
/* @__PURE__ */ (0,
|
|
24470
|
-
/* @__PURE__ */ (0,
|
|
26369
|
+
isLambdaInvoke && requestId !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_jsx_runtime136.Fragment, { children: [
|
|
26370
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Divider, {}),
|
|
26371
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(ToggleSection, { headline: "Lambda Logs", children: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
|
|
24471
26372
|
LambdaInvokeLogsSection,
|
|
24472
26373
|
{
|
|
24473
26374
|
endTimeNano: selectedEvent.end_time_unix_nano ?? selectedEvent.start_time_unix_nano,
|
|
@@ -24478,58 +26379,72 @@ var EventDetails = ({ onClose, selectedEvent }) => {
|
|
|
24478
26379
|
}
|
|
24479
26380
|
) })
|
|
24480
26381
|
] }),
|
|
24481
|
-
|
|
24482
|
-
|
|
24483
|
-
/* @__PURE__ */ (0,
|
|
24484
|
-
/* @__PURE__ */ (0,
|
|
24485
|
-
|
|
24486
|
-
] },
|
|
24487
|
-
|
|
26382
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Divider, {}),
|
|
26383
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(ToggleSection, { headline: "Advanced Information", initialOpen: false, children: /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_material14.Stack, { spacing: 1, children: [
|
|
26384
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_material14.Box, { children: [
|
|
26385
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: "Span ID" }),
|
|
26386
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Typography, { variant: "body2", children: selectedEvent.span_id })
|
|
26387
|
+
] }),
|
|
26388
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_material14.Box, { children: [
|
|
26389
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: "Trace ID" }),
|
|
26390
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Typography, { variant: "body2", children: selectedEvent.trace_id })
|
|
26391
|
+
] }),
|
|
26392
|
+
requestId !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_material14.Box, { children: [
|
|
26393
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: "Request ID" }),
|
|
26394
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Typography, { variant: "body2", children: requestId })
|
|
26395
|
+
] }),
|
|
26396
|
+
eventGroups.info && /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(EventDetail, { displayText: "Info", events: eventGroups.info, type: "info" })
|
|
26397
|
+
] }) })
|
|
24488
26398
|
] }) })
|
|
24489
26399
|
] });
|
|
24490
26400
|
};
|
|
24491
|
-
|
|
24492
|
-
|
|
24493
|
-
|
|
24494
|
-
|
|
24495
|
-
|
|
24496
|
-
|
|
24497
|
-
|
|
24498
|
-
|
|
24499
|
-
|
|
26401
|
+
var PayloadViewer = (0, import_react53.memo)(({ value }) => {
|
|
26402
|
+
const theme = (0, import_material14.useTheme)();
|
|
26403
|
+
return /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Box, { sx: { backgroundColor: "background.default", borderRadius: 1, fontSize: 12, overflow: "auto", p: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
|
|
26404
|
+
JsonViewer,
|
|
26405
|
+
{
|
|
26406
|
+
displayDataTypes: false,
|
|
26407
|
+
displaySize: false,
|
|
26408
|
+
enableClipboard: false,
|
|
26409
|
+
rootName: false,
|
|
26410
|
+
theme: theme.palette.mode,
|
|
26411
|
+
value
|
|
26412
|
+
}
|
|
26413
|
+
) });
|
|
26414
|
+
});
|
|
24500
26415
|
|
|
24501
26416
|
// src/components/trace-graph/trace-graph.tsx
|
|
24502
26417
|
var import_base = require("@xyflow/react/dist/base.css");
|
|
24503
|
-
var
|
|
24504
|
-
var
|
|
24505
|
-
var
|
|
26418
|
+
var import_material18 = require("@mui/material");
|
|
26419
|
+
var import_react59 = require("@xyflow/react");
|
|
26420
|
+
var import_react60 = require("react");
|
|
24506
26421
|
|
|
24507
26422
|
// src/components/trace-graph/service-node.tsx
|
|
24508
|
-
var
|
|
26423
|
+
var import_material16 = require("@mui/material");
|
|
24509
26424
|
var import_style = require("@xyflow/react/dist/style.css");
|
|
24510
|
-
var
|
|
24511
|
-
var
|
|
26425
|
+
var import_react55 = require("@xyflow/react");
|
|
26426
|
+
var import_react56 = require("react");
|
|
24512
26427
|
|
|
24513
26428
|
// src/components/trace-graph/problem-indicator.tsx
|
|
24514
26429
|
var import_icons_material9 = require("@mui/icons-material");
|
|
24515
|
-
var
|
|
24516
|
-
var
|
|
24517
|
-
var
|
|
26430
|
+
var import_material15 = require("@mui/material");
|
|
26431
|
+
var import_react54 = require("react");
|
|
26432
|
+
var import_jsx_runtime137 = require("react/jsx-runtime");
|
|
24518
26433
|
var ProblemIndicator = ({ error }) => {
|
|
24519
|
-
const icon = (0,
|
|
26434
|
+
const icon = (0, import_react54.useMemo)(() => {
|
|
24520
26435
|
switch (error.level) {
|
|
24521
26436
|
case "error": {
|
|
24522
|
-
return /* @__PURE__ */ (0,
|
|
26437
|
+
return /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_icons_material9.Error, { sx: { color: "#d32f2f", fontSize: "14px" } });
|
|
24523
26438
|
}
|
|
24524
26439
|
case "warning": {
|
|
24525
|
-
return /* @__PURE__ */ (0,
|
|
26440
|
+
return /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_icons_material9.Warning, { sx: { color: "#ff9800", fontSize: "14px" } });
|
|
24526
26441
|
}
|
|
24527
26442
|
default: {
|
|
24528
|
-
return /* @__PURE__ */ (0,
|
|
26443
|
+
return /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_icons_material9.Info, { sx: { color: "#2196f3", fontSize: "14px" } });
|
|
24529
26444
|
}
|
|
24530
26445
|
}
|
|
24531
26446
|
}, [error.level]);
|
|
24532
|
-
const color2 = (0,
|
|
26447
|
+
const color2 = (0, import_react54.useMemo)(() => {
|
|
24533
26448
|
switch (error.level) {
|
|
24534
26449
|
case "error": {
|
|
24535
26450
|
return "#d32f2f";
|
|
@@ -24542,8 +26457,8 @@ var ProblemIndicator = ({ error }) => {
|
|
|
24542
26457
|
}
|
|
24543
26458
|
}
|
|
24544
26459
|
}, [error.level]);
|
|
24545
|
-
return /* @__PURE__ */ (0,
|
|
24546
|
-
|
|
26460
|
+
return /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_material15.Tooltip, { arrow: true, title: error.message ?? "Issue detected", children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(
|
|
26461
|
+
import_material15.Box,
|
|
24547
26462
|
{
|
|
24548
26463
|
sx: {
|
|
24549
26464
|
alignItems: "center",
|
|
@@ -24562,17 +26477,17 @@ var ProblemIndicator = ({ error }) => {
|
|
|
24562
26477
|
};
|
|
24563
26478
|
|
|
24564
26479
|
// src/components/trace-graph/service-node.tsx
|
|
24565
|
-
var
|
|
26480
|
+
var import_jsx_runtime138 = require("react/jsx-runtime");
|
|
24566
26481
|
var handleStyle = {
|
|
24567
26482
|
backgroundColor: "white",
|
|
24568
26483
|
borderColor: "lightgray",
|
|
24569
26484
|
opacity: 0
|
|
24570
26485
|
};
|
|
24571
|
-
var ServiceNode = (0,
|
|
26486
|
+
var ServiceNode = (0, import_react56.memo)(({ data, selected }) => {
|
|
24572
26487
|
const hasErrors = (data.event.errors && data.event.errors.length > 0) ?? false;
|
|
24573
|
-
return /* @__PURE__ */ (0,
|
|
24574
|
-
/* @__PURE__ */ (0,
|
|
24575
|
-
|
|
26488
|
+
return /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(import_material16.Box, { sx: { maxWidth: 200 }, children: [
|
|
26489
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(
|
|
26490
|
+
import_material16.Box,
|
|
24576
26491
|
{
|
|
24577
26492
|
role: "button",
|
|
24578
26493
|
sx: {
|
|
@@ -24592,9 +26507,9 @@ var ServiceNode = (0, import_react55.memo)(({ data, selected }) => {
|
|
|
24592
26507
|
},
|
|
24593
26508
|
tabIndex: 0,
|
|
24594
26509
|
children: [
|
|
24595
|
-
/* @__PURE__ */ (0,
|
|
24596
|
-
/* @__PURE__ */ (0,
|
|
24597
|
-
/* @__PURE__ */ (0,
|
|
26510
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)(import_react55.Handle, { position: import_react55.Position.Left, style: handleStyle, type: "target" }),
|
|
26511
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)(import_react55.Handle, { position: import_react55.Position.Right, style: handleStyle, type: "source" }),
|
|
26512
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
|
|
24598
26513
|
ServiceCell,
|
|
24599
26514
|
{
|
|
24600
26515
|
height: "32px",
|
|
@@ -24607,8 +26522,8 @@ var ServiceNode = (0, import_react55.memo)(({ data, selected }) => {
|
|
|
24607
26522
|
]
|
|
24608
26523
|
}
|
|
24609
26524
|
),
|
|
24610
|
-
/* @__PURE__ */ (0,
|
|
24611
|
-
|
|
26525
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(
|
|
26526
|
+
import_material16.Stack,
|
|
24612
26527
|
{
|
|
24613
26528
|
alignItems: "center",
|
|
24614
26529
|
direction: "row",
|
|
@@ -24618,8 +26533,8 @@ var ServiceNode = (0, import_react55.memo)(({ data, selected }) => {
|
|
|
24618
26533
|
mt: 0.5
|
|
24619
26534
|
},
|
|
24620
26535
|
children: [
|
|
24621
|
-
hasErrors && /* @__PURE__ */ (0,
|
|
24622
|
-
|
|
26536
|
+
hasErrors && /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
|
|
26537
|
+
import_material16.Stack,
|
|
24623
26538
|
{
|
|
24624
26539
|
direction: "row",
|
|
24625
26540
|
spacing: 0.5,
|
|
@@ -24627,11 +26542,11 @@ var ServiceNode = (0, import_react55.memo)(({ data, selected }) => {
|
|
|
24627
26542
|
flexWrap: "wrap",
|
|
24628
26543
|
gap: "2px"
|
|
24629
26544
|
},
|
|
24630
|
-
children: data.event.errors?.map((error) => /* @__PURE__ */ (0,
|
|
26545
|
+
children: data.event.errors?.map((error) => /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(ProblemIndicator, { error }, error.span_id))
|
|
24631
26546
|
}
|
|
24632
26547
|
),
|
|
24633
|
-
/* @__PURE__ */ (0,
|
|
24634
|
-
|
|
26548
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
|
|
26549
|
+
import_material16.Typography,
|
|
24635
26550
|
{
|
|
24636
26551
|
sx: {
|
|
24637
26552
|
fontSize: "0.9rem",
|
|
@@ -24682,58 +26597,19 @@ var getLayoutedNodesAndEdges = (inputNodes, inputEdges) => {
|
|
|
24682
26597
|
|
|
24683
26598
|
// src/components/trace-graph/xyflow/controls.tsx
|
|
24684
26599
|
var import_icons_material10 = require("@mui/icons-material");
|
|
24685
|
-
var
|
|
24686
|
-
var
|
|
24687
|
-
var
|
|
24688
|
-
|
|
24689
|
-
|
|
24690
|
-
function shallow$1(objA, objB) {
|
|
24691
|
-
if (Object.is(objA, objB)) {
|
|
24692
|
-
return true;
|
|
24693
|
-
}
|
|
24694
|
-
if (typeof objA !== "object" || objA === null || typeof objB !== "object" || objB === null) {
|
|
24695
|
-
return false;
|
|
24696
|
-
}
|
|
24697
|
-
if (objA instanceof Map && objB instanceof Map) {
|
|
24698
|
-
if (objA.size !== objB.size) return false;
|
|
24699
|
-
for (const [key, value] of objA) {
|
|
24700
|
-
if (!Object.is(value, objB.get(key))) {
|
|
24701
|
-
return false;
|
|
24702
|
-
}
|
|
24703
|
-
}
|
|
24704
|
-
return true;
|
|
24705
|
-
}
|
|
24706
|
-
if (objA instanceof Set && objB instanceof Set) {
|
|
24707
|
-
if (objA.size !== objB.size) return false;
|
|
24708
|
-
for (const value of objA) {
|
|
24709
|
-
if (!objB.has(value)) {
|
|
24710
|
-
return false;
|
|
24711
|
-
}
|
|
24712
|
-
}
|
|
24713
|
-
return true;
|
|
24714
|
-
}
|
|
24715
|
-
const keysA = Object.keys(objA);
|
|
24716
|
-
if (keysA.length !== Object.keys(objB).length) {
|
|
24717
|
-
return false;
|
|
24718
|
-
}
|
|
24719
|
-
for (const keyA of keysA) {
|
|
24720
|
-
if (!Object.prototype.hasOwnProperty.call(objB, keyA) || !Object.is(objA[keyA], objB[keyA])) {
|
|
24721
|
-
return false;
|
|
24722
|
-
}
|
|
24723
|
-
}
|
|
24724
|
-
return true;
|
|
24725
|
-
}
|
|
24726
|
-
|
|
24727
|
-
// src/components/trace-graph/xyflow/controls.tsx
|
|
24728
|
-
var import_jsx_runtime140 = require("react/jsx-runtime");
|
|
26600
|
+
var import_material17 = require("@mui/material");
|
|
26601
|
+
var import_react57 = require("@xyflow/react");
|
|
26602
|
+
var import_react58 = require("react");
|
|
26603
|
+
var import_shallow = require("zustand/shallow");
|
|
26604
|
+
var import_jsx_runtime139 = require("react/jsx-runtime");
|
|
24729
26605
|
var selector = (s2) => ({
|
|
24730
26606
|
isInteractive: s2.nodesDraggable || s2.nodesConnectable || s2.elementsSelectable,
|
|
24731
26607
|
maxZoomReached: s2.transform[2] >= s2.maxZoom,
|
|
24732
26608
|
minZoomReached: s2.transform[2] <= s2.minZoom
|
|
24733
26609
|
});
|
|
24734
|
-
var Controls = (0,
|
|
24735
|
-
const { maxZoomReached, minZoomReached } = (0,
|
|
24736
|
-
const { fitView, zoomIn, zoomOut } = (0,
|
|
26610
|
+
var Controls = (0, import_react58.memo)(() => {
|
|
26611
|
+
const { maxZoomReached, minZoomReached } = (0, import_react57.useStore)(selector, import_shallow.shallow);
|
|
26612
|
+
const { fitView, zoomIn, zoomOut } = (0, import_react57.useReactFlow)();
|
|
24737
26613
|
const onZoomInHandler = () => {
|
|
24738
26614
|
void zoomIn();
|
|
24739
26615
|
};
|
|
@@ -24743,8 +26619,8 @@ var Controls = (0, import_react57.memo)(() => {
|
|
|
24743
26619
|
const onFitViewHandler = () => {
|
|
24744
26620
|
void fitView();
|
|
24745
26621
|
};
|
|
24746
|
-
return /* @__PURE__ */ (0,
|
|
24747
|
-
|
|
26622
|
+
return /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)(
|
|
26623
|
+
import_material17.Box,
|
|
24748
26624
|
{
|
|
24749
26625
|
sx: {
|
|
24750
26626
|
bottom: 0,
|
|
@@ -24757,33 +26633,33 @@ var Controls = (0, import_react57.memo)(() => {
|
|
|
24757
26633
|
zIndex: 5
|
|
24758
26634
|
},
|
|
24759
26635
|
children: [
|
|
24760
|
-
/* @__PURE__ */ (0,
|
|
24761
|
-
|
|
26636
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
|
|
26637
|
+
import_material17.IconButton,
|
|
24762
26638
|
{
|
|
24763
26639
|
className: "react-flow__controls-zoomin",
|
|
24764
26640
|
disabled: maxZoomReached,
|
|
24765
26641
|
onClick: onZoomInHandler,
|
|
24766
26642
|
size: "small",
|
|
24767
|
-
children: /* @__PURE__ */ (0,
|
|
26643
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(import_icons_material10.Add, {})
|
|
24768
26644
|
}
|
|
24769
26645
|
),
|
|
24770
|
-
/* @__PURE__ */ (0,
|
|
24771
|
-
|
|
26646
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
|
|
26647
|
+
import_material17.IconButton,
|
|
24772
26648
|
{
|
|
24773
26649
|
className: "react-flow__controls-zoomout",
|
|
24774
26650
|
disabled: minZoomReached,
|
|
24775
26651
|
onClick: onZoomOutHandler,
|
|
24776
26652
|
size: "small",
|
|
24777
|
-
children: /* @__PURE__ */ (0,
|
|
26653
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(import_icons_material10.Remove, {})
|
|
24778
26654
|
}
|
|
24779
26655
|
),
|
|
24780
|
-
/* @__PURE__ */ (0,
|
|
24781
|
-
|
|
26656
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
|
|
26657
|
+
import_material17.IconButton,
|
|
24782
26658
|
{
|
|
24783
26659
|
className: "react-flow__controls-fitview",
|
|
24784
26660
|
onClick: onFitViewHandler,
|
|
24785
26661
|
size: "small",
|
|
24786
|
-
children: /* @__PURE__ */ (0,
|
|
26662
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(import_icons_material10.FitScreen, {})
|
|
24787
26663
|
}
|
|
24788
26664
|
)
|
|
24789
26665
|
]
|
|
@@ -24792,7 +26668,7 @@ var Controls = (0, import_react57.memo)(() => {
|
|
|
24792
26668
|
});
|
|
24793
26669
|
|
|
24794
26670
|
// src/components/trace-graph/trace-graph.tsx
|
|
24795
|
-
var
|
|
26671
|
+
var import_jsx_runtime140 = require("react/jsx-runtime");
|
|
24796
26672
|
var nodeTypes = {
|
|
24797
26673
|
service: ServiceNode
|
|
24798
26674
|
};
|
|
@@ -24802,9 +26678,9 @@ var TraceGraph = ({
|
|
|
24802
26678
|
onRefresh,
|
|
24803
26679
|
spans
|
|
24804
26680
|
}) => {
|
|
24805
|
-
const [nodes, setNodes, onNodesChange] = (0,
|
|
24806
|
-
const [edges, setEdges] = (0,
|
|
24807
|
-
(0,
|
|
26681
|
+
const [nodes, setNodes, onNodesChange] = (0, import_react59.useNodesState)([]);
|
|
26682
|
+
const [edges, setEdges] = (0, import_react59.useEdgesState)([]);
|
|
26683
|
+
(0, import_react60.useEffect)(() => {
|
|
24808
26684
|
const allNodes = [];
|
|
24809
26685
|
const allEdges = [];
|
|
24810
26686
|
for (const span of spans.data ?? []) {
|
|
@@ -24819,15 +26695,15 @@ var TraceGraph = ({
|
|
|
24819
26695
|
},
|
|
24820
26696
|
id: span.span_id,
|
|
24821
26697
|
position: { x: 0, y: 0 },
|
|
24822
|
-
sourcePosition:
|
|
24823
|
-
targetPosition:
|
|
26698
|
+
sourcePosition: import_react59.Position.Right,
|
|
26699
|
+
targetPosition: import_react59.Position.Left,
|
|
24824
26700
|
type: "service"
|
|
24825
26701
|
});
|
|
24826
26702
|
if (span.parent_span_id !== null) {
|
|
24827
26703
|
allEdges.push({
|
|
24828
26704
|
animated: false,
|
|
24829
26705
|
id: `e-${span.parent_span_id}-${span.span_id}`,
|
|
24830
|
-
markerEnd: { color: "lightgray", height: 16, type:
|
|
26706
|
+
markerEnd: { color: "lightgray", height: 16, type: import_react59.MarkerType.Arrow, width: 16 },
|
|
24831
26707
|
source: span.parent_span_id,
|
|
24832
26708
|
style: { stroke: "lightgray", strokeWidth: 1 },
|
|
24833
26709
|
target: span.span_id
|
|
@@ -24836,7 +26712,7 @@ var TraceGraph = ({
|
|
|
24836
26712
|
for (const linkedSpanId of span.linked_span_ids ?? []) {
|
|
24837
26713
|
allEdges.push({
|
|
24838
26714
|
id: `e-link-${linkedSpanId}-${span.span_id}`,
|
|
24839
|
-
markerEnd: { color: "lightgray", height: 16, type:
|
|
26715
|
+
markerEnd: { color: "lightgray", height: 16, type: import_react59.MarkerType.Arrow, width: 16 },
|
|
24840
26716
|
source: linkedSpanId,
|
|
24841
26717
|
style: { stroke: "lightgray", strokeWidth: 1 },
|
|
24842
26718
|
// animated: true,
|
|
@@ -24854,12 +26730,12 @@ var TraceGraph = ({
|
|
|
24854
26730
|
setNodes(layoutedNodes);
|
|
24855
26731
|
setEdges(layoutedEdges);
|
|
24856
26732
|
}, [spans.data, initialFocusEventId, setNodes, setEdges]);
|
|
24857
|
-
const theme = (0,
|
|
24858
|
-
return /* @__PURE__ */ (0,
|
|
24859
|
-
spans.error && /* @__PURE__ */ (0,
|
|
24860
|
-
|
|
26733
|
+
const theme = (0, import_material18.useTheme)();
|
|
26734
|
+
return /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)(import_jsx_runtime140.Fragment, { children: [
|
|
26735
|
+
spans.error && /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)(
|
|
26736
|
+
import_material18.Alert,
|
|
24861
26737
|
{
|
|
24862
|
-
action: /* @__PURE__ */ (0,
|
|
26738
|
+
action: /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(import_material18.Button, { onClick: () => {
|
|
24863
26739
|
onRefresh();
|
|
24864
26740
|
}, children: "Retry" }),
|
|
24865
26741
|
severity: "error",
|
|
@@ -24870,8 +26746,8 @@ var TraceGraph = ({
|
|
|
24870
26746
|
]
|
|
24871
26747
|
}
|
|
24872
26748
|
),
|
|
24873
|
-
/* @__PURE__ */ (0,
|
|
24874
|
-
|
|
26749
|
+
/* @__PURE__ */ (0, import_jsx_runtime140.jsxs)(
|
|
26750
|
+
import_react59.ReactFlow,
|
|
24875
26751
|
{
|
|
24876
26752
|
"data-testid": "trace-graph",
|
|
24877
26753
|
edges,
|
|
@@ -24888,9 +26764,9 @@ var TraceGraph = ({
|
|
|
24888
26764
|
onNodesChange,
|
|
24889
26765
|
selectNodesOnDrag: false,
|
|
24890
26766
|
children: [
|
|
24891
|
-
/* @__PURE__ */ (0,
|
|
24892
|
-
/* @__PURE__ */ (0,
|
|
24893
|
-
|
|
26767
|
+
/* @__PURE__ */ (0, import_jsx_runtime140.jsx)(Controls, {}),
|
|
26768
|
+
/* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
|
|
26769
|
+
import_react59.Background,
|
|
24894
26770
|
{
|
|
24895
26771
|
bgColor: theme.palette.background.paper,
|
|
24896
26772
|
color: theme.palette.text.disabled
|
|
@@ -24903,7 +26779,7 @@ var TraceGraph = ({
|
|
|
24903
26779
|
};
|
|
24904
26780
|
|
|
24905
26781
|
// src/pages/trace-graph-page.tsx
|
|
24906
|
-
var
|
|
26782
|
+
var import_jsx_runtime141 = require("react/jsx-runtime");
|
|
24907
26783
|
var HEADER_HEIGHT = 56;
|
|
24908
26784
|
var DRAWER_WIDTH = "35%";
|
|
24909
26785
|
var Main = (0, import_styles.styled)("main", { shouldForwardProp: (property) => property !== "open" })(({ open, theme }) => ({
|
|
@@ -24921,7 +26797,7 @@ var Main = (0, import_styles.styled)("main", { shouldForwardProp: (property) =>
|
|
|
24921
26797
|
})
|
|
24922
26798
|
}
|
|
24923
26799
|
}));
|
|
24924
|
-
var StyledDrawer = (0, import_styles.styled)(
|
|
26800
|
+
var StyledDrawer = (0, import_styles.styled)(import_material19.Drawer)(() => ({
|
|
24925
26801
|
"& .MuiDrawer-paper": {
|
|
24926
26802
|
bottom: 0,
|
|
24927
26803
|
boxSizing: "border-box",
|
|
@@ -24951,8 +26827,8 @@ var TraceGraphView = ({
|
|
|
24951
26827
|
traceId
|
|
24952
26828
|
}) => {
|
|
24953
26829
|
const shouldShowStatusMessage = Boolean(statusError) || status?.status === "DISABLED";
|
|
24954
|
-
return /* @__PURE__ */ (0,
|
|
24955
|
-
|
|
26830
|
+
return /* @__PURE__ */ (0, import_jsx_runtime141.jsxs)(
|
|
26831
|
+
import_material19.Box,
|
|
24956
26832
|
{
|
|
24957
26833
|
"data-testid": "trace-graph-page",
|
|
24958
26834
|
sx: {
|
|
@@ -24964,14 +26840,14 @@ var TraceGraphView = ({
|
|
|
24964
26840
|
overflow: "hidden"
|
|
24965
26841
|
},
|
|
24966
26842
|
children: [
|
|
24967
|
-
/* @__PURE__ */ (0,
|
|
24968
|
-
/* @__PURE__ */ (0,
|
|
26843
|
+
/* @__PURE__ */ (0, import_jsx_runtime141.jsxs)(import_material19.Box, { sx: { display: "flex", width: "100%" }, children: [
|
|
26844
|
+
/* @__PURE__ */ (0, import_jsx_runtime141.jsx)(import_material19.Button, { onClick: () => {
|
|
24969
26845
|
navigateToSpansList();
|
|
24970
|
-
}, startIcon: /* @__PURE__ */ (0,
|
|
24971
|
-
/* @__PURE__ */ (0,
|
|
26846
|
+
}, startIcon: /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(import_icons_material11.ArrowBack, {}), children: "Go back" }),
|
|
26847
|
+
/* @__PURE__ */ (0, import_jsx_runtime141.jsx)(import_material19.Box, { sx: { flexGrow: 1 } })
|
|
24972
26848
|
] }),
|
|
24973
|
-
/* @__PURE__ */ (0,
|
|
24974
|
-
|
|
26849
|
+
/* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
|
|
26850
|
+
import_material19.Paper,
|
|
24975
26851
|
{
|
|
24976
26852
|
sx: {
|
|
24977
26853
|
display: "flex",
|
|
@@ -24980,22 +26856,22 @@ var TraceGraphView = ({
|
|
|
24980
26856
|
position: "relative",
|
|
24981
26857
|
width: "100%"
|
|
24982
26858
|
},
|
|
24983
|
-
children: shouldShowStatusMessage ? /* @__PURE__ */ (0,
|
|
26859
|
+
children: shouldShowStatusMessage ? /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
|
|
24984
26860
|
StatusMessage,
|
|
24985
26861
|
{
|
|
24986
26862
|
error: statusError,
|
|
24987
26863
|
onRetry: handleRetry,
|
|
24988
26864
|
status
|
|
24989
26865
|
}
|
|
24990
|
-
) : /* @__PURE__ */ (0,
|
|
24991
|
-
/* @__PURE__ */ (0,
|
|
24992
|
-
|
|
26866
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime141.jsxs)(import_jsx_runtime141.Fragment, { children: [
|
|
26867
|
+
/* @__PURE__ */ (0, import_jsx_runtime141.jsx)(Main, { open, children: /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
|
|
26868
|
+
import_material19.Box,
|
|
24993
26869
|
{
|
|
24994
26870
|
sx: {
|
|
24995
26871
|
height: "100%",
|
|
24996
26872
|
overflow: "auto"
|
|
24997
26873
|
},
|
|
24998
|
-
children: traceId !== void 0 && /* @__PURE__ */ (0,
|
|
26874
|
+
children: traceId !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(import_react61.ReactFlowProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
|
|
24999
26875
|
TraceGraph,
|
|
25000
26876
|
{
|
|
25001
26877
|
initialFocusEventId: spanId,
|
|
@@ -25012,7 +26888,7 @@ var TraceGraphView = ({
|
|
|
25012
26888
|
) })
|
|
25013
26889
|
}
|
|
25014
26890
|
) }),
|
|
25015
|
-
/* @__PURE__ */ (0,
|
|
26891
|
+
/* @__PURE__ */ (0, import_jsx_runtime141.jsx)(StyledDrawer, { anchor: "right", open, variant: "persistent", children: /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(EventDetails, { onClose: handleClose, selectedEvent }) })
|
|
25016
26892
|
] })
|
|
25017
26893
|
}
|
|
25018
26894
|
)
|
|
@@ -25029,7 +26905,7 @@ async function fetchConnectedTraces(api, traceIds, allSpans = /* @__PURE__ */ ne
|
|
|
25029
26905
|
const traceResponses = await Promise.all(
|
|
25030
26906
|
newTraceIds.map((id2) => api.getSpans({ trace_id: id2 }))
|
|
25031
26907
|
);
|
|
25032
|
-
const currentBatchSpans = traceResponses.flatMap((
|
|
26908
|
+
const currentBatchSpans = traceResponses.flatMap((r3) => r3.spans);
|
|
25033
26909
|
const currentSpanIds = currentBatchSpans.map((s2) => s2.span_id);
|
|
25034
26910
|
for (const span of currentBatchSpans) {
|
|
25035
26911
|
allSpans.set(span.span_id, span);
|
|
@@ -25056,10 +26932,10 @@ async function fetchConnectedTraces(api, traceIds, allSpans = /* @__PURE__ */ ne
|
|
|
25056
26932
|
}
|
|
25057
26933
|
var TraceGraphPage = ({ onClose, spanId, traceId }) => {
|
|
25058
26934
|
const api = useAppInspectorApi();
|
|
25059
|
-
const [spans, setSpans] = (0,
|
|
25060
|
-
const [loading, setLoading] = (0,
|
|
25061
|
-
const [fetchError, setFetchError] = (0,
|
|
25062
|
-
const fetchSpans = (0,
|
|
26935
|
+
const [spans, setSpans] = (0, import_react62.useState)();
|
|
26936
|
+
const [loading, setLoading] = (0, import_react62.useState)(false);
|
|
26937
|
+
const [fetchError, setFetchError] = (0, import_react62.useState)();
|
|
26938
|
+
const fetchSpans = (0, import_react62.useCallback)(async () => {
|
|
25063
26939
|
setLoading(true);
|
|
25064
26940
|
try {
|
|
25065
26941
|
const spans2 = await fetchConnectedTraces(api, [traceId]);
|
|
@@ -25072,31 +26948,31 @@ var TraceGraphPage = ({ onClose, spanId, traceId }) => {
|
|
|
25072
26948
|
setLoading(false);
|
|
25073
26949
|
}
|
|
25074
26950
|
}, [api, traceId]);
|
|
25075
|
-
(0,
|
|
26951
|
+
(0, import_react62.useEffect)(() => {
|
|
25076
26952
|
void fetchSpans();
|
|
25077
26953
|
}, [fetchSpans]);
|
|
25078
|
-
const [open, setOpen] = (0,
|
|
25079
|
-
const [selectedEvent, setSelectedEvent] = (0,
|
|
25080
|
-
const spansReference = (0,
|
|
25081
|
-
(0,
|
|
26954
|
+
const [open, setOpen] = (0, import_react62.useState)(true);
|
|
26955
|
+
const [selectedEvent, setSelectedEvent] = (0, import_react62.useState)(() => spans?.find((span) => span.span_id === spanId));
|
|
26956
|
+
const spansReference = (0, import_react62.useRef)();
|
|
26957
|
+
(0, import_react62.useEffect)(() => {
|
|
25082
26958
|
if (!spansReference.current && spans) {
|
|
25083
26959
|
setSelectedEvent(spans.find((span) => span.span_id === spanId));
|
|
25084
26960
|
spansReference.current = spans;
|
|
25085
26961
|
}
|
|
25086
26962
|
}, [spans, setSelectedEvent, spanId]);
|
|
25087
26963
|
const { checkStatus, error: statusError, status } = useStatus();
|
|
25088
|
-
const handleEventSelect = (0,
|
|
26964
|
+
const handleEventSelect = (0, import_react62.useCallback)((spanId2) => {
|
|
25089
26965
|
const span = spans?.find((s2) => s2.span_id === spanId2);
|
|
25090
26966
|
setSelectedEvent(span);
|
|
25091
26967
|
setOpen(true);
|
|
25092
26968
|
}, [spans]);
|
|
25093
|
-
const handleRetry = (0,
|
|
26969
|
+
const handleRetry = (0, import_react62.useCallback)(() => {
|
|
25094
26970
|
void checkStatus();
|
|
25095
26971
|
}, [checkStatus]);
|
|
25096
|
-
const navigateToSpansList = (0,
|
|
26972
|
+
const navigateToSpansList = (0, import_react62.useCallback)(() => {
|
|
25097
26973
|
onClose?.();
|
|
25098
26974
|
}, [onClose]);
|
|
25099
|
-
return /* @__PURE__ */ (0,
|
|
26975
|
+
return /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
|
|
25100
26976
|
TraceGraphView,
|
|
25101
26977
|
{
|
|
25102
26978
|
fetchError,
|
|
@@ -25120,7 +26996,7 @@ var TraceGraphPage = ({ onClose, spanId, traceId }) => {
|
|
|
25120
26996
|
};
|
|
25121
26997
|
|
|
25122
26998
|
// src/pages/spans-list-page.tsx
|
|
25123
|
-
var
|
|
26999
|
+
var import_jsx_runtime142 = require("react/jsx-runtime");
|
|
25124
27000
|
var SpansListPage = () => {
|
|
25125
27001
|
const {
|
|
25126
27002
|
checkStatus,
|
|
@@ -25139,23 +27015,23 @@ var SpansListPage = () => {
|
|
|
25139
27015
|
streamPaused,
|
|
25140
27016
|
toggleStream
|
|
25141
27017
|
} = useSpans();
|
|
25142
|
-
const clearSpansSync = (0,
|
|
27018
|
+
const clearSpansSync = (0, import_react63.useCallback)(() => {
|
|
25143
27019
|
void clearSpans();
|
|
25144
27020
|
}, [clearSpans]);
|
|
25145
27021
|
const [order2, setOrder] = useLocalStorage("spans-order", "oldest_first");
|
|
25146
|
-
const [selectedTraceId, setSelectedTraceId] = (0,
|
|
25147
|
-
const [selectedSpanId, setSelectedSpanId] = (0,
|
|
25148
|
-
const navigateToSpan = (0,
|
|
27022
|
+
const [selectedTraceId, setSelectedTraceId] = (0, import_react63.useState)();
|
|
27023
|
+
const [selectedSpanId, setSelectedSpanId] = (0, import_react63.useState)();
|
|
27024
|
+
const navigateToSpan = (0, import_react63.useCallback)((span) => {
|
|
25149
27025
|
setSelectedTraceId(span.trace_id);
|
|
25150
27026
|
setSelectedSpanId(span.span_id);
|
|
25151
27027
|
}, []);
|
|
25152
|
-
const handleRetry = (0,
|
|
27028
|
+
const handleRetry = (0, import_react63.useCallback)(() => {
|
|
25153
27029
|
void checkStatus();
|
|
25154
27030
|
}, [checkStatus]);
|
|
25155
27031
|
const shouldShowStatusMessage = Boolean(statusError) || status?.status === "DISABLED";
|
|
25156
|
-
return /* @__PURE__ */ (0,
|
|
25157
|
-
/* @__PURE__ */ (0,
|
|
25158
|
-
|
|
27032
|
+
return /* @__PURE__ */ (0, import_jsx_runtime142.jsxs)(import_jsx_runtime142.Fragment, { children: [
|
|
27033
|
+
/* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
|
|
27034
|
+
import_material20.Box,
|
|
25159
27035
|
{
|
|
25160
27036
|
"data-testid": "spans-list-page",
|
|
25161
27037
|
sx: {
|
|
@@ -25169,14 +27045,14 @@ var SpansListPage = () => {
|
|
|
25169
27045
|
visibility: selectedTraceId === void 0 ? "visible" : "hidden",
|
|
25170
27046
|
width: "100%"
|
|
25171
27047
|
},
|
|
25172
|
-
children: shouldShowStatusMessage ? /* @__PURE__ */ (0,
|
|
27048
|
+
children: shouldShowStatusMessage ? /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
|
|
25173
27049
|
StatusMessage,
|
|
25174
27050
|
{
|
|
25175
27051
|
error: statusError,
|
|
25176
27052
|
onRetry: handleRetry,
|
|
25177
27053
|
status
|
|
25178
27054
|
}
|
|
25179
|
-
) : /* @__PURE__ */ (0,
|
|
27055
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
|
|
25180
27056
|
SpansList,
|
|
25181
27057
|
{
|
|
25182
27058
|
clearingSpans,
|
|
@@ -25198,7 +27074,7 @@ var SpansListPage = () => {
|
|
|
25198
27074
|
)
|
|
25199
27075
|
}
|
|
25200
27076
|
),
|
|
25201
|
-
selectedTraceId !== void 0 && /* @__PURE__ */ (0,
|
|
27077
|
+
selectedTraceId !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(TraceGraphPage, { onClose: () => {
|
|
25202
27078
|
setSelectedTraceId(void 0);
|
|
25203
27079
|
}, spanId: selectedSpanId, traceId: selectedTraceId })
|
|
25204
27080
|
] });
|