@cccsaurora/clue-ui 1.0.4 → 1.1.0-dev.100

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (201) hide show
  1. package/ActionForm-ByeOzpc4.js +555 -0
  2. package/AnnotationDetails-DknbKDyl.js +175 -0
  3. package/AnnotationPreview-CQwKs8se.js +188 -0
  4. package/ClueEnrichContext-6NJfXpUB.js +536 -0
  5. package/FlexOne-BSYAhhtG.js +9 -0
  6. package/_Map-kgDsDYxq.js +64 -0
  7. package/_MapCache-DabaaWfq.js +161 -0
  8. package/_Uint8Array-BlVVH1tp.js +129 -0
  9. package/_baseAssignValue-CNbcU6Nb.js +25 -0
  10. package/_baseClone-D3a8Pa4T.js +284 -0
  11. package/_baseExtremum-B1o1zHjR.js +33 -0
  12. package/_baseFlatten-D4huXoEI.js +92 -0
  13. package/_baseGet-BSK_nnoz.js +109 -0
  14. package/_baseIsEqual-B5xLoweL.js +238 -0
  15. package/_baseIteratee-p6Nj07-n.js +126 -0
  16. package/_baseSlice-GAv_YFTT.js +20 -0
  17. package/_baseSum-D0WC1dN0.js +13 -0
  18. package/_baseUniq-CpupKWcL.js +89 -0
  19. package/_commonjsHelpers-DWwsNxpa.js +8 -0
  20. package/_createAggregator-BpVy5xMi.js +63 -0
  21. package/_getPrototype-D1LAdQKO.js +5 -0
  22. package/_getTag-D3ToyefI.js +126 -0
  23. package/api/lookup/index.d.ts +1 -1
  24. package/api/lookup/types.d.ts +2 -2
  25. package/api/lookup/types_detection.d.ts +2 -2
  26. package/cloneDeep-CjP5k9zW.js +8 -0
  27. package/components/AnnotationBody.js +49 -34
  28. package/components/AnnotationDetailPopover.js +36 -30
  29. package/components/AnnotationDetails.js +6 -6
  30. package/components/AnnotationEntry.js +50 -47
  31. package/components/AnnotationPreview.js +5 -5
  32. package/components/ClassificationChip.d.ts +2 -1
  33. package/components/ClassificationChip.js +44 -23
  34. package/components/CountBadge.js +31 -26
  35. package/components/EnrichedCard.js +110 -92
  36. package/components/EnrichedChip.js +130 -111
  37. package/components/EnrichedTypography.d.ts +1 -1
  38. package/components/EnrichedTypography.js +133 -112
  39. package/components/ErrorBoundary.js +28 -24
  40. package/components/RetryFailedEnrichments.js +10 -9
  41. package/components/SourcePicker.js +57 -49
  42. package/components/actions/ActionForm.js +4 -4
  43. package/components/actions/ExecutePopover.js +64 -50
  44. package/components/actions/ResultModal.js +12 -41
  45. package/components/actions/form/schemaAdapter.js +40 -20
  46. package/components/display/graph/ExpandMoreButton.js +10 -10
  47. package/components/display/graph/elements/NodeCard.js +114 -76
  48. package/components/display/graph/elements/NodeTag.js +15 -13
  49. package/components/display/graph/index.js +267 -210
  50. package/components/display/graph/visualizations/Leaf.js +88 -69
  51. package/components/display/graph/visualizations/cloud/index.js +98 -81
  52. package/components/display/graph/visualizations/icons/BaseIcon.js +26 -21
  53. package/components/display/graph/visualizations/icons/BugIcon.js +12 -12
  54. package/components/display/graph/visualizations/icons/HostIcon.js +12 -12
  55. package/components/display/graph/visualizations/icons/NetworkIcon.js +12 -12
  56. package/components/display/graph/visualizations/icons/ProcessIcon.js +12 -12
  57. package/components/display/graph/visualizations/icons/TargetIcon.js +13 -13
  58. package/components/display/graph/visualizations/icons/index.js +14 -13
  59. package/components/display/graph/visualizations/panels/NodePanel.js +10 -8
  60. package/components/display/graph/visualizations/tree/BundleLine.js +108 -81
  61. package/components/display/graph/visualizations/tree/Triangle.js +13 -13
  62. package/components/display/graph/visualizations/tree/index.js +407 -305
  63. package/components/display/icons/Iconified.js +27 -12
  64. package/components/display/json/index.js +4 -4
  65. package/components/display/markdown/index.js +8696 -5668
  66. package/components/enrichment/EnrichPopover.js +55 -47
  67. package/components/fetchers/Fetcher.js +123 -95
  68. package/components/fetchers/PreviewModal.js +20 -17
  69. package/components/fetchers/StatusChip.js +21 -18
  70. package/components/group/Entry.js +13 -11
  71. package/components/group/Group.js +13 -10
  72. package/components/group/GroupControl.js +78 -66
  73. package/components/stats/QueryStatus.js +44 -31
  74. package/countBy-C69WslUA.js +14 -0
  75. package/data/event.js +6 -4
  76. package/database/index.js +2 -2
  77. package/debounce-bV0h5FC5.js +92 -0
  78. package/en/translation.json +39 -59
  79. package/fr/translation.json +37 -56
  80. package/get-D3C3lEU3.js +8 -0
  81. package/groupBy-DC2oOuBN.js +14 -0
  82. package/hooks/ClueActionContext.d.ts +26 -0
  83. package/hooks/ClueActionContext.js +8 -7
  84. package/hooks/ClueComponentContext.js +29 -23
  85. package/hooks/ClueConfigProvider.js +14 -12
  86. package/hooks/ClueDatabaseContext.js +19 -13
  87. package/hooks/ClueEnrichContext.js +8 -8
  88. package/hooks/ClueEnrichProps.d.ts +3 -1
  89. package/hooks/ClueFetcherContext.js +74 -46
  90. package/hooks/ClueGroupContext.js +17 -14
  91. package/hooks/CluePopupContext.js +5 -5
  92. package/hooks/ClueProvider.js +12 -10
  93. package/hooks/selectors.d.ts +4 -5
  94. package/hooks/selectors.js +21 -11
  95. package/hooks/useActionResult.d.ts +14 -0
  96. package/hooks/useActionResult.js +5 -0
  97. package/hooks/useAnnotations.js +45 -29
  98. package/hooks/useClue.js +6 -4
  99. package/hooks/useClueActions.d.ts +1 -1
  100. package/hooks/useClueActions.js +3 -3
  101. package/hooks/useClueConfig.d.ts +2 -1
  102. package/hooks/useClueConfig.js +6 -6
  103. package/hooks/useClueTypeConfig.js +3 -3
  104. package/hooks/useComparator.js +722 -435
  105. package/hooks/useErrors.js +22 -18
  106. package/hooks/useMyHighlights.js +66 -36
  107. package/hooks/useMyLocalStorage.d.ts +4 -3
  108. package/hooks/useMyLocalStorage.js +66 -46
  109. package/iconify-CXMreGTg.js +1782 -0
  110. package/icons/Action.js +66 -49
  111. package/icons/Assessment.js +84 -68
  112. package/icons/Context.js +78 -61
  113. package/icons/Opinion.js +77 -65
  114. package/icons/iconMap.js +2 -2
  115. package/identity-CPGTqrE4.js +6 -0
  116. package/index-BDVjGvMI.js +696 -0
  117. package/index-BbPn6-Mw.js +15750 -0
  118. package/index-Bi21Wb23.js +465 -0
  119. package/index-C3lkTD69.js +1172 -0
  120. package/index-CC12Ux-9.js +17654 -0
  121. package/isEmpty-BQkZubqU.js +29 -0
  122. package/isNil-CIubwp4T.js +6 -0
  123. package/isObject-FTY-5JQX.js +7 -0
  124. package/isObjectLike-OAgjjZye.js +48 -0
  125. package/isSymbol-Xd2FsJyp.js +8 -0
  126. package/last-CUCl67Im.js +7 -0
  127. package/main.js +62 -62
  128. package/package.json +3 -3
  129. package/sortBy-B-UKp4GT.js +100 -0
  130. package/sumBy-MYkDPHZL.js +8 -0
  131. package/text/Frequency.js +42 -23
  132. package/toFinite-Bc55msYj.js +16 -0
  133. package/toNumber-DPxy1FBy.js +39 -0
  134. package/types/RunningActionData.d.ts +4 -3
  135. package/types/action.d.ts +10 -1
  136. package/useClueTypeConfig-XvGvIw2S.js +3201 -0
  137. package/utils/chain.js +91 -64
  138. package/utils/classificationParser.js +519 -256
  139. package/utils/constants.js +35 -10
  140. package/utils/graph.js +72 -45
  141. package/utils/hashUtil.js +7 -7
  142. package/utils/line.js +131 -81
  143. package/utils/loggerUtil.d.ts +1 -1
  144. package/utils/loggerUtil.js +6 -4
  145. package/utils/sessionStorage.js +41 -29
  146. package/utils/time.d.ts +3 -0
  147. package/utils/time.js +536 -0
  148. package/utils/utils.js +10 -9
  149. package/utils/window.js +21 -10
  150. package/utils-7OtvGnmf.js +200 -0
  151. package/ActionForm-Sw7D-KOE.js +0 -340
  152. package/AnnotationDetails-BoX61_IF.js +0 -160
  153. package/AnnotationPreview-dYinoSA9.js +0 -140
  154. package/ClueEnrichContext-CvCIPOMC.js +0 -412
  155. package/FlexOne-BXWFOd1T.js +0 -6
  156. package/_Map-DXNg_Z-q.js +0 -54
  157. package/_MapCache-Cu25RRDU.js +0 -129
  158. package/_Uint8Array-DlJCtTvG.js +0 -102
  159. package/_baseAssignValue-CUmzp727.js +0 -20
  160. package/_baseClone-BlMmRXeX.js +0 -208
  161. package/_baseExtremum-P_0akmCi.js +0 -27
  162. package/_baseFlatten-CN7vDNEQ.js +0 -72
  163. package/_baseGet-Dgf6_xCm.js +0 -80
  164. package/_baseIsEqual-Cpjtfb3Q.js +0 -173
  165. package/_baseIteratee-CP1bocOX.js +0 -95
  166. package/_baseSlice-M5RKzt1A.js +0 -10
  167. package/_baseSum-wEbgNeUs.js +0 -10
  168. package/_baseUniq-tMFmk80M.js +0 -61
  169. package/_commonjsHelpers-C6fGbg64.js +0 -6
  170. package/_createAggregator-B4Cav8ZM.js +0 -53
  171. package/_getPrototype-CHAFQYL_.js +0 -5
  172. package/_getTag-BV_UoLYG.js +0 -90
  173. package/cloneDeep-BPVpFBzJ.js +0 -8
  174. package/components/display/markdown/DynamicTabs.d.ts +0 -8
  175. package/components/display/markdown/DynamicTabs.js +0 -21
  176. package/components/display/markdown/markdownPlugins/tabs.d.ts +0 -3
  177. package/components/display/markdown/markdownPlugins/tabs.js +0 -4
  178. package/countBy-DOutsa_w.js +0 -8
  179. package/debounce-DryYcbJ4.js +0 -56
  180. package/get-Bow1vKwx.js +0 -8
  181. package/groupBy-BheQYl6f.js +0 -8
  182. package/iconify-BBckr5AQ.js +0 -1263
  183. package/identity-ByMq8VxU.js +0 -6
  184. package/index-CnaCBNrd.js +0 -358
  185. package/index-E7g8cRyW.js +0 -568
  186. package/index-V7wwd05F.js +0 -975
  187. package/index-p5_wX7q1.js +0 -11729
  188. package/index-pQg5VUAZ.js +0 -12734
  189. package/isEmpty-g47Qir2A.js +0 -21
  190. package/isNil-CjWwlQS3.js +0 -6
  191. package/isObject-B53jY8Qg.js +0 -7
  192. package/isObjectLike-BatpeCIi.js +0 -29
  193. package/isSymbol-C3_SC0Qp.js +0 -8
  194. package/last-7CdUxN0r.js +0 -7
  195. package/sortBy-ITdmD17L.js +0 -79
  196. package/sumBy-DxJUU2E8.js +0 -8
  197. package/tabs-CgADNA57.js +0 -195
  198. package/toFinite-BMy6GObD.js +0 -14
  199. package/toNumber-YVhnnJv4.js +0 -31
  200. package/useClueTypeConfig-CneP98N_.js +0 -2260
  201. package/utils-CD0rFIFU.js +0 -2704
@@ -1,194 +1,255 @@
1
- import { jsx as i, jsxs as l, Fragment as ye } from "react/jsx-runtime";
2
- import { useMemo as m, useRef as ee, useState as u, useEffect as z, useCallback as f, createElement as ke } from "react";
3
- import { useTheme as we, lighten as te, darken as oe, Stack as x, Card as R, Typography as Ce, alpha as ne, Autocomplete as ze, TextField as he, FormControl as Se, InputLabel as Ee, Select as Ie, MenuItem as Ne, IconButton as Oe, Collapse as Me } from "@mui/material";
4
- import { p as Pe } from "../../../index-CnaCBNrd.js";
5
- import { z as Fe, i as M, s as p, t as Re, p as ie } from "../../../index-p5_wX7q1.js";
6
- import Te from "../../../hooks/useComparator.js";
7
- import { useMyLocalStorageItem as T } from "../../../hooks/useMyLocalStorage.js";
8
- import { StorageKey as L } from "../../../utils/constants.js";
9
- import { g as Le } from "../../../get-Bow1vKwx.js";
10
- import { cssImportant as k } from "../../../utils/graph.js";
11
- import ae from "../icons/Iconified.js";
12
- import Ae from "./ExpandMoreButton.js";
13
- import Be from "./visualizations/cloud/index.js";
14
- import $e from "./visualizations/panels/NodePanel.js";
15
- import je from "./visualizations/tree/index.js";
16
- const et = ({ graph: t, sx: re = {} }) => {
17
- var X, Z, U, Y, q;
18
- const o = we(), h = m(() => o.palette.mode === "dark", [o]), { runComparator: A } = Te(), r = ee(), se = ee(), [P] = T(L.SHOW_MOUSE_POS, !1), [w] = T(L.SHOW_COORDINATES, !1), [S] = T(L.PANEL_LOCATION, "vertical"), [le, ce] = u(["0", "0"]), [de, me] = u(["0", "0"]), [E, B] = u(!1), $ = m(() => ((t == null ? void 0 : t.data) ?? []).flat(2).map((e) => e.id), [t == null ? void 0 : t.data]), v = m(() => Fe().scaleExtent([0.1, 6]), []), [s, I] = u(M), [N, ue] = u(""), [C, j] = u([]), [O, H] = u(
19
- ((Z = (X = t == null ? void 0 : t.metadata.display) == null ? void 0 : X.visualization) == null ? void 0 : Z.type) ?? "tree"
20
- ), [pe, F] = u(!1);
21
- z(() => {
22
- B(C.length > 0);
23
- }, [C]);
24
- const b = m(
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+ import { useMemo, useRef, useState, useEffect, useCallback, createElement } from "react";
3
+ import { useTheme, lighten, darken, Stack, Card, Typography, alpha, Autocomplete, TextField, FormControl, InputLabel, Select, MenuItem, IconButton, Collapse } from "@mui/material";
4
+ import { p as parseEvent } from "../../../index-Bi21Wb23.js";
5
+ import { z as zoom, i as identity, s as select, t as transform, p as pointer } from "../../../index-BbPn6-Mw.js";
6
+ import { ClueComponentContext } from "../../../hooks/ClueComponentContext.js";
7
+ import useComparator from "../../../hooks/useComparator.js";
8
+ import { useMyLocalStorageItem } from "../../../hooks/useMyLocalStorage.js";
9
+ import { StorageKey } from "../../../utils/constants.js";
10
+ import { g as get } from "../../../get-D3C3lEU3.js";
11
+ import { u as useContextSelector } from "../../../index-BDVjGvMI.js";
12
+ import { cssImportant } from "../../../utils/graph.js";
13
+ import Iconified from "../icons/Iconified.js";
14
+ import ExpandMoreButton from "./ExpandMoreButton.js";
15
+ import Cloud from "./visualizations/cloud/index.js";
16
+ import NodePanel from "./visualizations/panels/NodePanel.js";
17
+ import Tree from "./visualizations/tree/index.js";
18
+ const Graph = ({ graph, sx = {} }) => {
19
+ var _a, _b, _c, _d, _e;
20
+ const { t } = useContextSelector(ClueComponentContext, (ctx) => ctx.i18next);
21
+ const theme = useTheme();
22
+ const isDark = useMemo(() => theme.palette.mode === "dark", [theme]);
23
+ const { runComparator } = useComparator();
24
+ const svgRef = useRef();
25
+ const pointRef = useRef();
26
+ const [showMousePos] = useMyLocalStorageItem(StorageKey.SHOW_MOUSE_POS, false);
27
+ const [showCoordinates] = useMyLocalStorageItem(StorageKey.SHOW_COORDINATES, false);
28
+ const [panelLocation] = useMyLocalStorageItem(StorageKey.PANEL_LOCATION, "vertical");
29
+ const [relativeMousePos, setRelativeMousePos] = useState(["0", "0"]);
30
+ const [absoluteMousePos, setAbsoluteMousePos] = useState(["0", "0"]);
31
+ const [showPanel, setShowPanel] = useState(false);
32
+ const nodeIds = useMemo(() => ((graph == null ? void 0 : graph.data) ?? []).flat(2).map((node) => node.id), [graph == null ? void 0 : graph.data]);
33
+ const zoom$1 = useMemo(() => zoom().scaleExtent([0.1, 6]), []);
34
+ const [currentZoom, setCurrentZoom] = useState(identity);
35
+ const [nodeId, setNodeId] = useState("");
36
+ const [selectedNodeIds, setSelectedNodeIds] = useState([]);
37
+ const [viz, setViz] = useState(
38
+ ((_b = (_a = graph == null ? void 0 : graph.metadata.display) == null ? void 0 : _a.visualization) == null ? void 0 : _b.type) ?? "tree"
39
+ );
40
+ const [hasError, setHasError] = useState(false);
41
+ useEffect(() => {
42
+ setShowPanel(selectedNodeIds.length > 0);
43
+ }, [selectedNodeIds]);
44
+ const labelKeys = useMemo(
25
45
  () => {
26
- var e, n;
27
- return (n = (e = t == null ? void 0 : t.metadata.display) == null ? void 0 : e.displayField) == null ? void 0 : n.filter((a) => (a.zoom ?? Number.MAX_SAFE_INTEGER) > s.k);
46
+ var _a2, _b2;
47
+ return (_b2 = (_a2 = graph == null ? void 0 : graph.metadata.display) == null ? void 0 : _a2.displayField) == null ? void 0 : _b2.filter((entry) => (entry.zoom ?? Number.MAX_SAFE_INTEGER) > currentZoom.k);
28
48
  },
29
- [(U = t == null ? void 0 : t.metadata.display) == null ? void 0 : U.displayField, s.k]
30
- ), fe = f((e) => {
31
- ue(e);
32
- }, []), V = f((e) => {
33
- const n = e === "view" ? e : `node-${e ?? "will\\%never\\$ever\\*exist"}`;
34
- return p(`#${n}`);
35
- }, []), _ = f(() => {
36
- if (!N) {
37
- F(!0);
49
+ [(_c = graph == null ? void 0 : graph.metadata.display) == null ? void 0 : _c.displayField, currentZoom.k]
50
+ );
51
+ const onNodeChange = useCallback((node) => {
52
+ setNodeId(node);
53
+ }, []);
54
+ const checkForNode = useCallback((_nodeId) => {
55
+ const selector = _nodeId === "view" ? _nodeId : `node-${_nodeId ?? "will\\%never\\$ever\\*exist"}`;
56
+ return select(`#${selector}`);
57
+ }, []);
58
+ const selectNode = useCallback(() => {
59
+ if (!nodeId) {
60
+ setHasError(true);
38
61
  return;
39
62
  }
40
- const e = V(N.replace(/[^A-Za-z0-9]*/g, ""));
41
- if (e.empty()) {
42
- F(!0);
63
+ const nodeToGet = checkForNode(nodeId.replace(/[^A-Za-z0-9]*/g, ""));
64
+ if (nodeToGet.empty()) {
65
+ setHasError(true);
43
66
  return;
44
67
  }
45
- F(!1), j([N]);
46
- const n = r.current.getBoundingClientRect(), a = p(r.current), d = e.node().getBBox();
47
- a.transition().duration(500).call(
48
- v.transform,
49
- M.translate(n.width / 2, n.height / 2).scale(4).translate(-d.x, -d.y)
68
+ setHasError(false);
69
+ setSelectedNodeIds([nodeId]);
70
+ const clientRect = svgRef.current.getBoundingClientRect();
71
+ const svg = select(svgRef.current);
72
+ const box = nodeToGet.node().getBBox();
73
+ svg.transition().duration(500).call(
74
+ zoom$1.transform,
75
+ identity.translate(clientRect.width / 2, clientRect.height / 2).scale(4).translate(-box.x, -box.y)
50
76
  );
51
- }, [V, N, v.transform]), xe = f(
52
- (e) => {
53
- const n = Pe(e);
54
- n.isCtrl && n.isEnter && _();
77
+ }, [checkForNode, nodeId, zoom$1.transform]);
78
+ const onKeyPress = useCallback(
79
+ (event) => {
80
+ const parsedEvent = parseEvent(event);
81
+ if (parsedEvent.isCtrl && parsedEvent.isEnter) {
82
+ selectNode();
83
+ }
55
84
  },
56
- [_]
57
- ), ve = f((e) => ((t == null ? void 0 : t.data) ?? []).flat().find((n) => n.id === e), [t == null ? void 0 : t.data]), g = f(
58
- (e = !1) => {
59
- if (!t)
85
+ [selectNode]
86
+ );
87
+ const findNode = useCallback((id) => ((graph == null ? void 0 : graph.data) ?? []).flat().find((n) => n.id === id), [graph == null ? void 0 : graph.data]);
88
+ const resetZoom = useCallback(
89
+ (instant = false) => {
90
+ if (!graph) {
60
91
  return;
61
- const n = p(r.current).select("#view").node().getBBox(), a = r.current.getBoundingClientRect(), d = Math.min(a.width / (n.width + 25), (a.height - 96) / n.height);
62
- let y = p(r.current);
63
- e || (y = y.transition().duration(500)), y.call(
64
- v.transform,
65
- M.translate(a.width / 2, (a.height + 96) / 2).scale(d).translate(-n.width / 2, -n.height / 2 - 10)
92
+ }
93
+ const box = select(svgRef.current).select("#view").node().getBBox();
94
+ const clientRect = svgRef.current.getBoundingClientRect();
95
+ const zoomLevel = Math.min(clientRect.width / (box.width + 25), (clientRect.height - 96) / box.height);
96
+ let selection = select(svgRef.current);
97
+ if (!instant) {
98
+ selection = selection.transition().duration(500);
99
+ }
100
+ selection.call(
101
+ zoom$1.transform,
102
+ identity.translate(clientRect.width / 2, (clientRect.height + 96) / 2).scale(zoomLevel).translate(-box.width / 2, -box.height / 2 - 10)
66
103
  );
67
104
  },
68
- [v.transform, t]
69
- ), D = f((e) => j(e), []);
70
- z(() => {
71
- t && (se.current = r.current.createSVGPoint(), p(r.current).call(
72
- v.on("zoom", (e) => {
73
- I == null || I(e.transform), p(r.current).select("#view").attr("transform", e.transform);
105
+ [zoom$1.transform, graph]
106
+ );
107
+ const onNodeSelectionChanged = useCallback((_nodeIds) => setSelectedNodeIds(_nodeIds), []);
108
+ useEffect(() => {
109
+ if (!graph) {
110
+ return;
111
+ }
112
+ pointRef.current = svgRef.current.createSVGPoint();
113
+ select(svgRef.current).call(
114
+ zoom$1.on("zoom", (event) => {
115
+ setCurrentZoom == null ? void 0 : setCurrentZoom(event.transform);
116
+ select(svgRef.current).select("#view").attr("transform", event.transform);
74
117
  })
75
- ));
76
- }, [I, v, O, t]), z(() => {
77
- P && p(r.current).on("mousemove", (e) => {
78
- const n = Re(p(r.current).select("#view").node());
79
- me(n.invert(ie(e)).map((a) => a.toFixed(0))), ce(ie(e).map((a) => a.toFixed(0)));
80
- });
81
- }, [P, t]), z(() => {
82
- g();
83
- }, [O, t == null ? void 0 : t.data]), z(() => {
84
- var e, n, a, d;
85
- (n = (e = t == null ? void 0 : t.metadata.display) == null ? void 0 : e.visualization) != null && n.type && H((d = (a = t == null ? void 0 : t.metadata.display) == null ? void 0 : a.visualization) == null ? void 0 : d.type);
86
- }, [(q = (Y = t == null ? void 0 : t.metadata.display) == null ? void 0 : Y.visualization) == null ? void 0 : q.type]);
87
- const G = m(
118
+ );
119
+ }, [setCurrentZoom, zoom$1, viz, graph]);
120
+ useEffect(() => {
121
+ if (showMousePos) {
122
+ select(svgRef.current).on("mousemove", (event) => {
123
+ const _zoom = transform(select(svgRef.current).select("#view").node());
124
+ setAbsoluteMousePos(_zoom.invert(pointer(event)).map((n) => n.toFixed(0)));
125
+ setRelativeMousePos(pointer(event).map((n) => n.toFixed(0)));
126
+ });
127
+ }
128
+ }, [showMousePos, graph]);
129
+ useEffect(() => {
130
+ resetZoom();
131
+ }, [viz, graph == null ? void 0 : graph.data]);
132
+ useEffect(() => {
133
+ var _a2, _b2, _c2, _d2;
134
+ if ((_b2 = (_a2 = graph == null ? void 0 : graph.metadata.display) == null ? void 0 : _a2.visualization) == null ? void 0 : _b2.type) {
135
+ setViz((_d2 = (_c2 = graph == null ? void 0 : graph.metadata.display) == null ? void 0 : _c2.visualization) == null ? void 0 : _d2.type);
136
+ }
137
+ }, [(_e = (_d = graph == null ? void 0 : graph.metadata.display) == null ? void 0 : _d.visualization) == null ? void 0 : _e.type]);
138
+ const treeOptions = useMemo(
88
139
  () => ({
89
- textColor: o.palette.text.primary,
90
- backgroundColor: o.palette.background.paper,
140
+ textColor: theme.palette.text.primary,
141
+ backgroundColor: theme.palette.background.paper,
91
142
  nodeColor: {
92
- border: (h ? te : oe)(o.palette.background.paper, 0.3),
143
+ border: (isDark ? lighten : darken)(theme.palette.background.paper, 0.3),
93
144
  center: "white"
94
145
  }
95
146
  }),
96
- [h, o.palette.background.paper, o.palette.text.primary]
97
- ), W = m(
147
+ [isDark, theme.palette.background.paper, theme.palette.text.primary]
148
+ );
149
+ const cloudOptions = useMemo(
98
150
  () => ({
99
- textColor: o.palette.text.primary,
100
- backgroundColor: o.palette.background.paper,
151
+ textColor: theme.palette.text.primary,
152
+ backgroundColor: theme.palette.background.paper,
101
153
  nodeColor: {
102
- border: (h ? te : oe)(o.palette.background.paper, 0.3),
154
+ border: (isDark ? lighten : darken)(theme.palette.background.paper, 0.3),
103
155
  center: "white"
104
156
  }
105
157
  }),
106
- [h, o.palette.background.paper, o.palette.text.primary]
107
- ), K = m(
158
+ [isDark, theme.palette.background.paper, theme.palette.text.primary]
159
+ );
160
+ const visualizations = useMemo(
108
161
  () => ({
109
- tree: () => /* @__PURE__ */ i(
110
- je,
162
+ tree: () => /* @__PURE__ */ jsx(
163
+ Tree,
111
164
  {
112
- svgRef: r,
113
- graph: t,
114
- labelKeys: b,
115
- onNodeSelectionChanged: D,
116
- zoom: s,
117
- options: G
165
+ svgRef,
166
+ graph,
167
+ labelKeys,
168
+ onNodeSelectionChanged,
169
+ zoom: currentZoom,
170
+ options: treeOptions
118
171
  }
119
172
  ),
120
- cloud: () => /* @__PURE__ */ i(Be, { svgRef: r, graph: t, options: W })
173
+ cloud: () => /* @__PURE__ */ jsx(Cloud, { svgRef, graph, options: cloudOptions })
121
174
  }),
122
- [W, s, t, b, D, G]
123
- ), be = m(() => $.flatMap((e) => {
124
- var y, J;
125
- const n = (((y = t == null ? void 0 : t.data) == null ? void 0 : y.flat()) ?? []).find((c) => c.id === e);
126
- return n ? (((J = b == null ? void 0 : b.filter((c) => A(c, n)).pop()) == null ? void 0 : J.label) ?? "id").split(",").map((c) => {
127
- var Q;
128
- return (Q = Le(n, c)) == null ? void 0 : Q.toString();
129
- }).filter((c) => !!c).map((c) => ({ id: e, value: c.trim() })) : { id: e, value: e };
130
- }), [t == null ? void 0 : t.data, b, $, A]);
131
- return /* @__PURE__ */ l(
132
- x,
175
+ [cloudOptions, currentZoom, graph, labelKeys, onNodeSelectionChanged, treeOptions]
176
+ );
177
+ const suggestions = useMemo(() => {
178
+ return nodeIds.flatMap((id) => {
179
+ var _a2, _b2;
180
+ const node = (((_a2 = graph == null ? void 0 : graph.data) == null ? void 0 : _a2.flat()) ?? []).find((_node) => _node.id === id);
181
+ if (!node) {
182
+ return { id, value: id };
183
+ }
184
+ const key = ((_b2 = labelKeys == null ? void 0 : labelKeys.filter((comparator) => runComparator(comparator, node)).pop()) == null ? void 0 : _b2.label) ?? "id";
185
+ const value = key.split(",").map((_key) => {
186
+ var _a3;
187
+ return (_a3 = get(node, _key)) == null ? void 0 : _a3.toString();
188
+ }).filter((val) => !!val).map((_value) => ({ id, value: _value.trim() }));
189
+ return value;
190
+ });
191
+ }, [graph == null ? void 0 : graph.data, labelKeys, nodeIds, runComparator]);
192
+ return /* @__PURE__ */ jsxs(
193
+ Stack,
133
194
  {
134
- direction: S === "vertical" ? "row" : "column",
195
+ direction: panelLocation === "vertical" ? "row" : "column",
135
196
  spacing: 1,
136
197
  overflow: "hidden",
137
198
  height: "100%",
138
199
  width: "100%",
139
- sx: re,
200
+ sx,
140
201
  children: [
141
- /* @__PURE__ */ i(x, { direction: "column", spacing: 1, sx: { position: "relative", flex: 1 }, children: /* @__PURE__ */ l(
142
- R,
202
+ /* @__PURE__ */ jsx(Stack, { direction: "column", spacing: 1, sx: { position: "relative", flex: 1 }, children: /* @__PURE__ */ jsxs(
203
+ Card,
143
204
  {
144
205
  variant: "outlined",
145
206
  sx: {
146
207
  flex: 1,
147
208
  position: "relative",
148
- maxHeight: `calc(100vh - 64px - ${o.spacing(1)})`,
209
+ maxHeight: `calc(100vh - 64px - ${theme.spacing(1)})`,
149
210
  "& #viz": {
150
- maxHeight: `calc(100vh - 64px - ${o.spacing(1)})`,
211
+ maxHeight: `calc(100vh - 64px - ${theme.spacing(1)})`,
151
212
  width: "100%",
152
213
  height: "100%",
153
- backgroundColor: o.palette.background.paper
214
+ backgroundColor: theme.palette.background.paper
154
215
  },
155
216
  "& .path": {
156
- transition: o.transitions.create(["opacity"], {
157
- duration: o.transitions.duration.short
217
+ transition: theme.transitions.create(["opacity"], {
218
+ duration: theme.transitions.duration.short
158
219
  })
159
220
  },
160
221
  "& .node": {
161
222
  cursor: "pointer",
162
223
  "& > path, & > text, & > polygon, & circle": {
163
- transition: o.transitions.create(["stroke", "fill", "fill-opacity", "stroke-opacity"], {
164
- duration: o.transitions.duration.short
224
+ transition: theme.transitions.create(["stroke", "fill", "fill-opacity", "stroke-opacity"], {
225
+ duration: theme.transitions.duration.short
165
226
  })
166
227
  },
167
228
  "&.hover > .center": {
168
- stroke: k(o.palette.primary.main)
229
+ stroke: cssImportant(theme.palette.primary.main)
169
230
  },
170
231
  "&.hover > .border": {
171
- stroke: k(o.palette.primary.dark)
232
+ stroke: cssImportant(theme.palette.primary.dark)
172
233
  },
173
234
  "&.selected > .center": {
174
- stroke: k(o.palette.success.main)
235
+ stroke: cssImportant(theme.palette.success.main)
175
236
  },
176
237
  "&.selected > .border": {
177
- stroke: k(o.palette.success.dark)
238
+ stroke: cssImportant(theme.palette.success.dark)
178
239
  },
179
240
  "&.selected.hover > .center": {
180
- stroke: k(o.palette.primary.main)
241
+ stroke: cssImportant(theme.palette.primary.main)
181
242
  },
182
243
  "&.selected.hover > .border": {
183
- stroke: k(o.palette.primary.dark)
244
+ stroke: cssImportant(theme.palette.primary.dark)
184
245
  }
185
246
  }
186
247
  },
187
248
  children: [
188
- t ? K[O]() : /* @__PURE__ */ l(ye, { children: [
189
- /* @__PURE__ */ i("svg", { id: "viz", ref: r, children: /* @__PURE__ */ i("g", { id: "view" }) }),
190
- /* @__PURE__ */ i(
191
- Ce,
249
+ graph ? visualizations[viz]() : /* @__PURE__ */ jsxs(Fragment, { children: [
250
+ /* @__PURE__ */ jsx("svg", { id: "viz", ref: svgRef, children: /* @__PURE__ */ jsx("g", { id: "view" }) }),
251
+ /* @__PURE__ */ jsx(
252
+ Typography,
192
253
  {
193
254
  variant: "h1",
194
255
  color: "text.secondary",
@@ -199,23 +260,23 @@ const et = ({ graph: t, sx: re = {} }) => {
199
260
  opacity: 0.3,
200
261
  transform: "translateX(-50%) translateY(-50%)"
201
262
  },
202
- children: "No dataset has been selected!"
263
+ children: t("graph.no.dataset")
203
264
  }
204
265
  )
205
266
  ] }),
206
- /* @__PURE__ */ i(
207
- x,
267
+ /* @__PURE__ */ jsx(
268
+ Stack,
208
269
  {
209
270
  direction: "column",
210
271
  spacing: 1,
211
272
  sx: {
212
273
  position: "absolute",
213
- top: o.spacing(1),
214
- left: o.spacing(1),
215
- right: o.spacing(1)
274
+ top: theme.spacing(1),
275
+ left: theme.spacing(1),
276
+ right: theme.spacing(1)
216
277
  },
217
- children: /* @__PURE__ */ l(
218
- x,
278
+ children: /* @__PURE__ */ jsxs(
279
+ Stack,
219
280
  {
220
281
  direction: "row",
221
282
  spacing: 1,
@@ -223,62 +284,55 @@ const et = ({ graph: t, sx: re = {} }) => {
223
284
  "& > div:first-of-type": {
224
285
  flex: 1,
225
286
  maxWidth: "775px",
226
- backgroundColor: ne(o.palette.background.paper, 0.8)
287
+ backgroundColor: alpha(theme.palette.background.paper, 0.8)
227
288
  }
228
289
  },
229
290
  children: [
230
- /* @__PURE__ */ i(
231
- ze,
291
+ /* @__PURE__ */ jsx(
292
+ Autocomplete,
232
293
  {
233
- disablePortal: !0,
234
- onChange: (e, n) => fe(n.id),
235
- onKeyDown: xe,
236
- options: be,
294
+ disablePortal: true,
295
+ onChange: (__, value) => onNodeChange(value.id),
296
+ onKeyDown: onKeyPress,
297
+ options: suggestions,
237
298
  sx: { width: "400px" },
238
- getOptionLabel: (e) => e.value,
239
- filterOptions: (e, n) => e.filter((a) => a.value.toLowerCase().includes(n.inputValue)),
240
- renderOption: (e, n) => /* @__PURE__ */ ke("li", { ...e, key: n.id + n.value }, n.value),
241
- renderInput: (e) => /* @__PURE__ */ i(
242
- he,
243
- {
244
- ...e,
245
- error: pe,
246
- label: "Enter a node ID, and press [ctrl + enter] to select it. [ctrl + space] will open an autocomplete menu."
247
- }
248
- )
299
+ getOptionLabel: (option) => option.value,
300
+ filterOptions: (options, state) => options.filter((opt) => opt.value.toLowerCase().includes(state.inputValue)),
301
+ renderOption: (props, option) => /* @__PURE__ */ createElement("li", { ...props, key: option.id + option.value }, option.value),
302
+ renderInput: (params) => /* @__PURE__ */ jsx(TextField, { ...params, error: hasError, label: t("graph.node.input.label") })
249
303
  }
250
304
  ),
251
- /* @__PURE__ */ l(Se, { sx: { minWidth: "150px", backgroundColor: ne(o.palette.background.paper, 0.8) }, children: [
252
- /* @__PURE__ */ i(Ee, { id: "viz-label", children: "Visualization" }),
253
- /* @__PURE__ */ i(
254
- Ie,
305
+ /* @__PURE__ */ jsxs(FormControl, { sx: { minWidth: "150px", backgroundColor: alpha(theme.palette.background.paper, 0.8) }, children: [
306
+ /* @__PURE__ */ jsx(InputLabel, { id: "viz-label", children: t("graph.visualization") }),
307
+ /* @__PURE__ */ jsx(
308
+ Select,
255
309
  {
256
- label: "Visualization",
310
+ label: t("graph.visualization"),
257
311
  labelId: "viz-label",
258
- value: O,
259
- onChange: (e) => H(e.target.value),
312
+ value: viz,
313
+ onChange: (event) => setViz(event.target.value),
260
314
  sx: { textTransform: "capitalize" },
261
- children: Object.keys(K).map((e) => /* @__PURE__ */ i(Ne, { value: e, sx: { textTransform: "capitalize" }, children: e }, e))
315
+ children: Object.keys(visualizations).map((_viz) => /* @__PURE__ */ jsx(MenuItem, { value: _viz, sx: { textTransform: "capitalize" }, children: _viz }, _viz))
262
316
  }
263
317
  )
264
318
  ] }),
265
- /* @__PURE__ */ i(
266
- Ae,
319
+ /* @__PURE__ */ jsx(
320
+ ExpandMoreButton,
267
321
  {
268
- disabled: C.length < 1,
269
- expand: E,
270
- onClick: () => B(!E),
271
- "aria-expanded": E,
272
- "aria-label": "show more",
322
+ disabled: selectedNodeIds.length < 1,
323
+ expand: showPanel,
324
+ onClick: () => setShowPanel(!showPanel),
325
+ "aria-expanded": showPanel,
326
+ "aria-label": t("graph.show.more"),
273
327
  size: "small",
274
328
  sx: {
275
329
  marginLeft: "auto !important",
276
330
  alignSelf: "center"
277
331
  },
278
- children: /* @__PURE__ */ i(
279
- ae,
332
+ children: /* @__PURE__ */ jsx(
333
+ Iconified,
280
334
  {
281
- icon: S === "vertical" ? "ic:baseline-chevron-left" : "ic:baseline-expand-more",
335
+ icon: panelLocation === "vertical" ? "ic:baseline-chevron-left" : "ic:baseline-expand-more",
282
336
  fontSize: "medium"
283
337
  }
284
338
  )
@@ -289,61 +343,64 @@ const et = ({ graph: t, sx: re = {} }) => {
289
343
  )
290
344
  }
291
345
  ),
292
- /* @__PURE__ */ i(
293
- R,
346
+ /* @__PURE__ */ jsx(
347
+ Card,
294
348
  {
295
- variant: w ? "elevation" : "outlined",
296
- elevation: w ? 4 : 0,
349
+ variant: showCoordinates ? "elevation" : "outlined",
350
+ elevation: showCoordinates ? 4 : 0,
297
351
  sx: {
298
352
  position: "absolute",
299
- bottom: o.spacing(0.5),
300
- right: o.spacing(0.5),
353
+ bottom: theme.spacing(0.5),
354
+ right: theme.spacing(0.5),
301
355
  px: 1,
302
356
  py: 0.5,
303
357
  border: "none !important"
304
358
  },
305
- children: /* @__PURE__ */ l(x, { direction: "row", spacing: 0.5, alignItems: "center", children: [
306
- w && /* @__PURE__ */ l("span", { children: [
307
- s.x.toFixed(0),
359
+ children: /* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 0.5, alignItems: "center", children: [
360
+ showCoordinates && /* @__PURE__ */ jsxs("span", { children: [
361
+ currentZoom.x.toFixed(0),
308
362
  ", ",
309
- s.y.toFixed(0),
363
+ currentZoom.y.toFixed(0),
310
364
  " (",
311
- s.k.toFixed(2),
312
- "x)"
365
+ currentZoom.k.toFixed(2),
366
+ "x",
367
+ ")"
313
368
  ] }),
314
- /* @__PURE__ */ i(
315
- Oe,
369
+ /* @__PURE__ */ jsx(
370
+ IconButton,
316
371
  {
317
- size: w ? "small" : "medium",
318
- onClick: () => g(),
319
- disabled: s.k === M.k && s.x === 0 && s.y === 0,
320
- children: /* @__PURE__ */ i(ae, { icon: "ic:baseline-refresh", fontSize: w ? "small" : "medium" })
372
+ size: showCoordinates ? "small" : "medium",
373
+ onClick: () => resetZoom(),
374
+ disabled: currentZoom.k === identity.k && currentZoom.x === 0 && currentZoom.y === 0,
375
+ children: /* @__PURE__ */ jsx(Iconified, { icon: "ic:baseline-refresh", fontSize: showCoordinates ? "small" : "medium" })
321
376
  }
322
377
  )
323
378
  ] })
324
379
  }
325
380
  ),
326
- P && /* @__PURE__ */ i(
327
- R,
381
+ showMousePos && /* @__PURE__ */ jsx(
382
+ Card,
328
383
  {
329
384
  variant: "elevation",
330
385
  elevation: 4,
331
386
  sx: {
332
387
  position: "absolute",
333
- bottom: o.spacing(0.5),
334
- left: o.spacing(0.5),
388
+ bottom: theme.spacing(0.5),
389
+ left: theme.spacing(0.5),
335
390
  px: 1,
336
391
  py: 0.5
337
392
  },
338
- children: /* @__PURE__ */ i("code", { children: /* @__PURE__ */ l(x, { direction: "row", spacing: 1, children: [
339
- /* @__PURE__ */ l("span", { children: [
340
- "(abs: ",
341
- de.join(", "),
393
+ children: /* @__PURE__ */ jsx("code", { children: /* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 1, children: [
394
+ /* @__PURE__ */ jsxs("span", { children: [
395
+ "(",
396
+ "abs: ",
397
+ absoluteMousePos.join(", "),
342
398
  ")"
343
399
  ] }),
344
- /* @__PURE__ */ l("span", { children: [
345
- "(rel: ",
346
- le.join(", "),
400
+ /* @__PURE__ */ jsxs("span", { children: [
401
+ "(",
402
+ "rel: ",
403
+ relativeMousePos.join(", "),
347
404
  ")"
348
405
  ] })
349
406
  ] }) })
@@ -352,21 +409,21 @@ const et = ({ graph: t, sx: re = {} }) => {
352
409
  ]
353
410
  }
354
411
  ) }),
355
- /* @__PURE__ */ i(
356
- Me,
412
+ /* @__PURE__ */ jsx(
413
+ Collapse,
357
414
  {
358
- in: E && C.length > 0,
359
- orientation: S === "vertical" ? "horizontal" : "vertical",
360
- appear: !0,
361
- unmountOnExit: !0,
362
- children: /* @__PURE__ */ i(
363
- x,
415
+ in: showPanel && selectedNodeIds.length > 0,
416
+ orientation: panelLocation === "vertical" ? "horizontal" : "vertical",
417
+ appear: true,
418
+ unmountOnExit: true,
419
+ children: /* @__PURE__ */ jsx(
420
+ Stack,
364
421
  {
365
422
  direction: "column",
366
423
  spacing: 1,
367
- sx: S === "vertical" ? { width: "450px", height: "100%" } : { width: "100%", height: "300px" },
424
+ sx: panelLocation === "vertical" ? { width: "450px", height: "100%" } : { width: "100%", height: "300px" },
368
425
  pb: 1,
369
- children: /* @__PURE__ */ i($e, { selectedNodeIds: C, findNode: ve })
426
+ children: /* @__PURE__ */ jsx(NodePanel, { selectedNodeIds, findNode })
370
427
  }
371
428
  )
372
429
  }
@@ -376,5 +433,5 @@ const et = ({ graph: t, sx: re = {} }) => {
376
433
  );
377
434
  };
378
435
  export {
379
- et as default
436
+ Graph as default
380
437
  };