@cccsaurora/clue-ui 1.2.3-dev.266 → 1.2.3

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 (183) hide show
  1. package/ActionForm-DlOXqMUx.js +4460 -0
  2. package/AnnotationDetails-Bk-p0F6h.js +160 -0
  3. package/AnnotationPreview-jzZvkCxJ.js +140 -0
  4. package/ClueEnrichContext-KqRuuWNS.js +418 -0
  5. package/FlexOne-BXWFOd1T.js +6 -0
  6. package/_MapCache-BiTi0iqu.js +180 -0
  7. package/_Uint8Array-BQNOM9Rr.js +101 -0
  8. package/_baseAssignValue-CNMLQZco.js +20 -0
  9. package/_baseClone-BnT-6pyM.js +207 -0
  10. package/_baseExtremum-Ca2EHgy2.js +16 -0
  11. package/_baseFlatten-Bfr_Molw.js +72 -0
  12. package/_baseGet-DSZygzyq.js +79 -0
  13. package/_baseIsEqual-VgvaAFZG.js +147 -0
  14. package/_baseIteratee-Dbfsw5z8.js +95 -0
  15. package/_baseSlice-M5RKzt1A.js +10 -0
  16. package/_baseSum-wEbgNeUs.js +10 -0
  17. package/_baseUniq-BJcj69PL.js +79 -0
  18. package/_commonjsHelpers-DaMA6jEr.js +8 -0
  19. package/_createAggregator-k3TuAnxT.js +53 -0
  20. package/_getPrototype-Cr1Mk7BC.js +5 -0
  21. package/_getTag-CK2Sffaq.js +90 -0
  22. package/_isIterateeCall-DkJP7Rbx.js +13 -0
  23. package/_setToArray-C7yMOeww.js +29 -0
  24. package/cloneDeep-CF8TtLHr.js +8 -0
  25. package/components/AnnotationBody.js +35 -49
  26. package/components/AnnotationDetailPopover.js +30 -36
  27. package/components/AnnotationDetails.js +7 -7
  28. package/components/AnnotationEntry.js +35 -35
  29. package/components/AnnotationPreview.js +5 -5
  30. package/components/ClassificationChip.js +23 -44
  31. package/components/CountBadge.js +26 -31
  32. package/components/EnrichedCard.js +97 -110
  33. package/components/EnrichedChip.js +105 -130
  34. package/components/EnrichedTypography.js +107 -133
  35. package/components/ErrorBoundary.js +24 -28
  36. package/components/RetryFailedEnrichments.js +9 -10
  37. package/components/SourcePicker.js +49 -57
  38. package/components/actions/ActionForm.js +4 -4
  39. package/components/actions/ExecutePopover.js +59 -75
  40. package/components/actions/ResultModal.js +4 -4
  41. package/components/actions/form/schemaAdapter.js +23 -39
  42. package/components/actions/formats/FileResult.js +59 -86
  43. package/components/actions/formats/index.js +10 -21
  44. package/components/display/graph/ExpandMoreButton.js +10 -10
  45. package/components/display/graph/elements/NodeCard.js +91 -111
  46. package/components/display/graph/elements/NodeTag.js +13 -15
  47. package/components/display/graph/index.js +202 -261
  48. package/components/display/graph/visualizations/Leaf.js +69 -88
  49. package/components/display/graph/visualizations/cloud/index.js +81 -98
  50. package/components/display/graph/visualizations/icons/BaseIcon.js +21 -26
  51. package/components/display/graph/visualizations/icons/BugIcon.js +12 -12
  52. package/components/display/graph/visualizations/icons/HostIcon.js +12 -12
  53. package/components/display/graph/visualizations/icons/NetworkIcon.js +12 -12
  54. package/components/display/graph/visualizations/icons/ProcessIcon.js +12 -12
  55. package/components/display/graph/visualizations/icons/TargetIcon.js +13 -13
  56. package/components/display/graph/visualizations/icons/index.js +13 -14
  57. package/components/display/graph/visualizations/panels/NodePanel.js +8 -10
  58. package/components/display/graph/visualizations/tree/BundleLine.js +81 -108
  59. package/components/display/graph/visualizations/tree/Triangle.js +13 -13
  60. package/components/display/graph/visualizations/tree/index.js +306 -408
  61. package/components/display/icons/Iconified.js +12 -27
  62. package/components/display/json/index.js +4 -4
  63. package/components/display/markdown/index.js +5770 -8678
  64. package/components/enrichment/EnrichPopover.js +46 -54
  65. package/components/fetchers/Fetcher.js +119 -158
  66. package/components/fetchers/PreviewModal.js +17 -20
  67. package/components/fetchers/StatusChip.js +17 -21
  68. package/components/group/Entry.js +11 -13
  69. package/components/group/Group.js +10 -13
  70. package/components/group/GroupControl.js +65 -76
  71. package/components/stats/QueryStatus.js +33 -43
  72. package/countBy-CdYegFSu.js +8 -0
  73. package/data/event.js +4 -6
  74. package/database/index.js +2 -2
  75. package/debounce-DryYcbJ4.js +56 -0
  76. package/get-CH7kz5Ix.js +8 -0
  77. package/groupBy-br8xmD2R.js +8 -0
  78. package/hooks/ClueActionContext.js +6 -6
  79. package/hooks/ClueComponentContext.js +23 -29
  80. package/hooks/ClueConfigProvider.js +12 -14
  81. package/hooks/ClueDatabaseContext.js +13 -19
  82. package/hooks/ClueEnrichContext.js +8 -8
  83. package/hooks/ClueFetcherContext.js +56 -83
  84. package/hooks/ClueGroupContext.js +14 -17
  85. package/hooks/CluePopupContext.js +5 -5
  86. package/hooks/ClueProvider.js +10 -12
  87. package/hooks/selectors.js +7 -7
  88. package/hooks/useActionResult.js +2 -2
  89. package/hooks/useAnnotations.js +31 -47
  90. package/hooks/useClue.js +4 -6
  91. package/hooks/useClueActions.js +3 -3
  92. package/hooks/useClueConfig.js +4 -6
  93. package/hooks/useClueTypeConfig.js +3 -3
  94. package/hooks/useComparator.js +435 -722
  95. package/hooks/useErrors.js +18 -22
  96. package/hooks/useFetcherResult.js +24 -33
  97. package/hooks/useMyHighlights.js +36 -66
  98. package/hooks/useMyLocalStorage.js +37 -66
  99. package/iconify-BBckr5AQ.js +1263 -0
  100. package/icons/Action.js +49 -66
  101. package/icons/Assessment.js +69 -85
  102. package/icons/Context.js +63 -77
  103. package/icons/Opinion.js +60 -76
  104. package/icons/iconMap.js +2 -2
  105. package/identity-ByMq8VxU.js +6 -0
  106. package/index-BHAe_V9n.js +12768 -0
  107. package/index-BK-zfYhR.js +358 -0
  108. package/index-CA5CUNZO.js +975 -0
  109. package/index-Dj5C04IX.js +568 -0
  110. package/index-p5_wX7q1.js +11729 -0
  111. package/isNil-CjWwlQS3.js +6 -0
  112. package/isObject-B53jY8Qg.js +7 -0
  113. package/isObjectLike-BatpeCIi.js +29 -0
  114. package/isSymbol-C3_SC0Qp.js +8 -0
  115. package/last-7CdUxN0r.js +7 -0
  116. package/main.js +60 -60
  117. package/maxBy-Bc0dYHcO.js +8 -0
  118. package/package.json +1 -1
  119. package/sortBy-DY2JBf9n.js +75 -0
  120. package/sumBy-DuMASLPd.js +8 -0
  121. package/text/Frequency.js +23 -42
  122. package/toFinite-BMy6GObD.js +14 -0
  123. package/toNumber-YVhnnJv4.js +31 -0
  124. package/useClueTypeConfig-Ct9Ygter.js +2292 -0
  125. package/utils/chain.js +65 -92
  126. package/utils/classificationParser.js +256 -519
  127. package/utils/constants.js +10 -35
  128. package/utils/graph.js +45 -72
  129. package/utils/hashUtil.js +7 -7
  130. package/utils/line.js +81 -131
  131. package/utils/loggerUtil.js +3 -5
  132. package/utils/sessionStorage.js +27 -41
  133. package/utils/time.js +423 -423
  134. package/utils/utils.js +9 -9
  135. package/utils/window.js +10 -21
  136. package/utils-DmwSUrum.js +129 -0
  137. package/ActionForm-uDp92tN2.js +0 -5941
  138. package/AnnotationDetails-DGYfOiWm.js +0 -175
  139. package/AnnotationPreview-bHObsb3P.js +0 -188
  140. package/ClueEnrichContext-CJEJxrgs.js +0 -541
  141. package/FlexOne-BSYAhhtG.js +0 -9
  142. package/_MapCache-WmuDdwuH.js +0 -222
  143. package/_Uint8Array-B7JqpgFX.js +0 -128
  144. package/_baseAssignValue-CGTuELqU.js +0 -25
  145. package/_baseClone-CkNrTyhm.js +0 -283
  146. package/_baseExtremum-kob8QXyt.js +0 -18
  147. package/_baseFlatten-jIR_sN_-.js +0 -92
  148. package/_baseGet-Bx3A4Qfp.js +0 -108
  149. package/_baseIsEqual-C5OTWzTk.js +0 -208
  150. package/_baseIteratee-avi7MX2o.js +0 -126
  151. package/_baseSlice-GAv_YFTT.js +0 -20
  152. package/_baseSum-D0WC1dN0.js +0 -13
  153. package/_baseUniq-BI9GIHMF.js +0 -115
  154. package/_commonjsHelpers-DWwsNxpa.js +0 -8
  155. package/_createAggregator-QD8MzKwe.js +0 -63
  156. package/_getPrototype-CU0j_POw.js +0 -5
  157. package/_getTag-Ckxxfr88.js +0 -126
  158. package/_isIterateeCall-Ds3sw2SF.js +0 -17
  159. package/_setToArray-CaPKQhcz.js +0 -33
  160. package/cloneDeep-DJrLSw8W.js +0 -8
  161. package/countBy-c6S3dvSW.js +0 -14
  162. package/debounce-bV0h5FC5.js +0 -92
  163. package/get-DSsNkRQs.js +0 -8
  164. package/groupBy-xqz-n0Vd.js +0 -14
  165. package/iconify-CXMreGTg.js +0 -1782
  166. package/identity-CPGTqrE4.js +0 -6
  167. package/index-AMfoEg_6.js +0 -696
  168. package/index-B6C2a_Lg.js +0 -1172
  169. package/index-C12gPw2W.js +0 -17698
  170. package/index-DCKkHTvx.js +0 -15750
  171. package/index-JcKyZeoY.js +0 -465
  172. package/isNil-CIubwp4T.js +0 -6
  173. package/isObject-FTY-5JQX.js +0 -7
  174. package/isObjectLike-OAgjjZye.js +0 -48
  175. package/isSymbol-Xd2FsJyp.js +0 -8
  176. package/last-CUCl67Im.js +0 -7
  177. package/maxBy-IKHzFrCS.js +0 -8
  178. package/sortBy-DfSj8IoJ.js +0 -96
  179. package/sumBy-D-hb_NY-.js +0 -8
  180. package/toFinite-Bc55msYj.js +0 -16
  181. package/toNumber-DPxy1FBy.js +0 -39
  182. package/useClueTypeConfig-Z1LFp01b.js +0 -3289
  183. package/utils-HmNPuoDB.js +0 -199
@@ -1,55 +1,41 @@
1
- import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
- import { useTheme, colors, Box } from "@mui/material";
3
- import useComparator from "../../../../../hooks/useComparator.js";
4
- import useMyHighlights from "../../../../../hooks/useMyHighlights.js";
5
- import { useMyLocalStorageItem } from "../../../../../hooks/useMyLocalStorage.js";
6
- import { StorageKey, BUNDLE_SEPARATOR } from "../../../../../utils/constants.js";
7
- import { c as cloneDeep } from "../../../../../cloneDeep-DJrLSw8W.js";
8
- import { g as get } from "../../../../../get-DSsNkRQs.js";
9
- import { i as isNil } from "../../../../../isNil-CIubwp4T.js";
10
- import { b as baseExtremum, a as baseGt } from "../../../../../_baseExtremum-kob8QXyt.js";
11
- import { i as identity } from "../../../../../identity-CPGTqrE4.js";
12
- import { i as isIterateeCall } from "../../../../../_isIterateeCall-Ds3sw2SF.js";
13
- import { t as toFinite } from "../../../../../toFinite-Bc55msYj.js";
14
- import { b as baseSum } from "../../../../../_baseSum-D0WC1dN0.js";
15
- import { memo, useMemo } from "react";
16
- import NodeCard from "../../elements/NodeCard.js";
17
- import getIcon from "../icons/index.js";
18
- import Leaf from "../Leaf.js";
19
- import BundleLine from "./BundleLine.js";
20
- function max(array) {
21
- return array && array.length ? baseExtremum(array, identity, baseGt) : void 0;
1
+ import { jsxs as it, jsx as L, Fragment as At } from "react/jsx-runtime";
2
+ import { useTheme as Bt, colors as wt, Box as Ft } from "@mui/material";
3
+ import It from "../../../../../hooks/useComparator.js";
4
+ import Wt from "../../../../../hooks/useMyHighlights.js";
5
+ import { useMyLocalStorageItem as Ot } from "../../../../../hooks/useMyLocalStorage.js";
6
+ import { StorageKey as Pt, BUNDLE_SEPARATOR as Ht } from "../../../../../utils/constants.js";
7
+ import { c as Xt } from "../../../../../cloneDeep-CF8TtLHr.js";
8
+ import { g as Tt } from "../../../../../get-CH7kz5Ix.js";
9
+ import { i as Yt } from "../../../../../isNil-CjWwlQS3.js";
10
+ import { b as $t, a as jt } from "../../../../../_baseExtremum-Ca2EHgy2.js";
11
+ import { i as Nt } from "../../../../../identity-ByMq8VxU.js";
12
+ import { i as Ut } from "../../../../../_isIterateeCall-DkJP7Rbx.js";
13
+ import { t as et } from "../../../../../toFinite-BMy6GObD.js";
14
+ import { b as Gt } from "../../../../../_baseSum-wEbgNeUs.js";
15
+ import { memo as Vt, useMemo as S } from "react";
16
+ import qt from "../../elements/NodeCard.js";
17
+ import zt from "../icons/index.js";
18
+ import Jt from "../Leaf.js";
19
+ import Qt from "./BundleLine.js";
20
+ function kt(c) {
21
+ return c && c.length ? $t(c, Nt, jt) : void 0;
22
22
  }
23
- var nativeCeil = Math.ceil, nativeMax = Math.max;
24
- function baseRange(start, end, step, fromRight) {
25
- var index = -1, length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), result = Array(length);
26
- while (length--) {
27
- result[++index] = start;
28
- start += step;
29
- }
30
- return result;
23
+ var Zt = Math.ceil, Kt = Math.max;
24
+ function ti(c, n, r, h) {
25
+ for (var d = -1, _ = Kt(Zt((n - c) / (r || 1)), 0), v = Array(_); _--; )
26
+ v[++d] = c, c += r;
27
+ return v;
31
28
  }
32
- function createRange(fromRight) {
33
- return function(start, end, step) {
34
- if (step && typeof step != "number" && isIterateeCall(start, end, step)) {
35
- end = step = void 0;
36
- }
37
- start = toFinite(start);
38
- if (end === void 0) {
39
- end = start;
40
- start = 0;
41
- } else {
42
- end = toFinite(end);
43
- }
44
- step = step === void 0 ? start < end ? 1 : -1 : toFinite(step);
45
- return baseRange(start, end, step);
29
+ function ii(c) {
30
+ return function(n, r, h) {
31
+ return h && typeof h != "number" && Ut(n, r, h) && (r = h = void 0), n = et(n), r === void 0 ? (r = n, n = 0) : r = et(r), h = h === void 0 ? n < r ? 1 : -1 : et(h), ti(n, r, h);
46
32
  };
47
33
  }
48
- var range = createRange();
49
- function sum(array) {
50
- return array && array.length ? baseSum(array, identity) : 0;
34
+ var ei = ii();
35
+ function ni(c) {
36
+ return c && c.length ? Gt(c, Nt) : 0;
51
37
  }
52
- const DEFAULT_OPTIONS = {
38
+ const nt = {
53
39
  textColor: "white",
54
40
  nodeColor: {
55
41
  border: "grey",
@@ -64,423 +50,335 @@ const DEFAULT_OPTIONS = {
64
50
  linePaddingX: 10,
65
51
  linePaddingY: 10,
66
52
  lineWidth: 3,
67
- enableEntryPadding: true,
68
- truncateLabels: true,
69
- enableTimestamps: true,
53
+ enableEntryPadding: !0,
54
+ truncateLabels: !0,
55
+ enableTimestamps: !0,
70
56
  iconOrientation: "vertical",
71
57
  lineDirection: "horizontal",
72
58
  rowStep: null,
73
59
  // We'll make this dynamic
74
- belowPrevious: false
60
+ belowPrevious: !1
75
61
  };
76
- DEFAULT_OPTIONS.rowStep = DEFAULT_OPTIONS.ySpacing * 2;
77
- const Tree = ({ svgRef, graph, labelKeys, onNodeSelectionChanged, zoom, options = {} }) => {
78
- var _a, _b, _c;
79
- const combinedOptions = useMemo(
62
+ nt.rowStep = nt.ySpacing * 2;
63
+ const ai = ({ svgRef: c, graph: n, labelKeys: r, onNodeSelectionChanged: h, zoom: d, options: _ = {} }) => {
64
+ var gt, xt, vt;
65
+ const v = S(
80
66
  () => {
81
- var _a2, _b2;
67
+ var i, o;
82
68
  return {
83
- ...DEFAULT_OPTIONS,
84
- ...options,
85
- ...((_b2 = (_a2 = graph == null ? void 0 : graph.metadata.display) == null ? void 0 : _a2.visualization) == null ? void 0 : _b2.config) ?? {}
69
+ ...nt,
70
+ ..._,
71
+ ...((o = (i = n == null ? void 0 : n.metadata.display) == null ? void 0 : i.visualization) == null ? void 0 : o.config) ?? {}
86
72
  };
87
73
  },
88
- [(_b = (_a = graph == null ? void 0 : graph.metadata.display) == null ? void 0 : _a.visualization) == null ? void 0 : _b.config, options]
89
- );
90
- const {
91
- xSpacing: baseXSpacing,
92
- ySpacing: baseYSpacing,
93
- linePaddingX: baseLinePaddingX,
94
- linePaddingY: baseLinePaddingY
95
- } = combinedOptions;
96
- const { runComparators, runComparator } = useComparator();
97
- const { onNodeHoveredChanged, onNodeClicked, nodeOpacities, highlightedPath, highlightedNodes, hoveredNode } = useMyHighlights(graph, (nodeIds) => onNodeSelectionChanged(nodeIds));
98
- const theme = useTheme();
99
- const isDark = useMemo(() => theme.palette.mode === "dark", [theme]);
100
- const [showCardsSettings] = useMyLocalStorageItem(StorageKey.SHOW_CARDS, false);
101
- const [cardCutoff] = useMyLocalStorageItem(StorageKey.CARD_CUTOFF, 2.5);
102
- const showCards = useMemo(() => zoom.k > cardCutoff && showCardsSettings, [cardCutoff, showCardsSettings, zoom.k]);
103
- const levels = useMemo(
104
- () => graph.data.map(
105
- (level, levelIndex) => level.map((node) => ({
106
- ...node,
107
- parents: node == null ? void 0 : node.edges,
108
- level: levelIndex
74
+ [(xt = (gt = n == null ? void 0 : n.metadata.display) == null ? void 0 : gt.visualization) == null ? void 0 : xt.config, _]
75
+ ), {
76
+ xSpacing: at,
77
+ ySpacing: ot,
78
+ linePaddingX: rt,
79
+ linePaddingY: st
80
+ } = v, { runComparators: lt, runComparator: W } = It(), { onNodeHoveredChanged: A, onNodeClicked: ct, nodeOpacities: H, highlightedPath: dt, highlightedNodes: ft, hoveredNode: pt } = Wt(n, (i) => h(i)), u = Bt(), ut = S(() => u.palette.mode === "dark", [u]), [X] = Ot(Pt.SHOW_CARDS, !1), [mt] = Ot(Pt.CARD_CUTOFF, 2.5), Y = S(() => d.k > mt && X, [mt, X, d.k]), w = S(
81
+ () => n.data.map(
82
+ (i, o) => i.map((l) => ({
83
+ ...l,
84
+ parents: l == null ? void 0 : l.edges,
85
+ level: o
109
86
  }))
110
87
  ),
111
- [graph.data]
112
- );
113
- const flatNodes = useMemo(() => levels.flat(), [levels]);
114
- const [xSpacing, linePaddingX, ySpacing, linePaddingY] = useMemo(() => {
115
- const baseValues = [
116
- [baseXSpacing, baseLinePaddingX],
117
- [baseYSpacing, baseLinePaddingY]
88
+ [n.data]
89
+ ), C = S(() => w.flat(), [w]), [$, j, ht, M] = S(() => {
90
+ const i = [
91
+ [at, rt],
92
+ [ot, st]
118
93
  ];
119
- if (zoom.k > 1 && showCardsSettings) {
120
- return baseValues.flatMap(
121
- (arr, index) => arr.map((_v) => _v * Math.pow(2.5 - index * 1.25, Math.min(zoom.k, 2.5) - 1))
122
- );
123
- } else {
124
- return baseValues.flat();
125
- }
126
- }, [baseLinePaddingX, baseLinePaddingY, baseXSpacing, baseYSpacing, showCardsSettings, zoom.k]);
127
- let portBounds;
128
- if (!graph || !svgRef.current) {
129
- portBounds = [
94
+ return d.k > 1 && X ? i.flatMap(
95
+ (o, l) => o.map((s) => s * Math.pow(2.5 - l * 1.25, Math.min(d.k, 2.5) - 1))
96
+ ) : i.flat();
97
+ }, [rt, st, at, ot, X, d.k]);
98
+ let B;
99
+ if (!n || !c.current)
100
+ B = [
130
101
  [0, 0],
131
102
  [0, 0]
132
103
  ];
133
- } else {
134
- const data = svgRef.current.getBoundingClientRect();
135
- portBounds = [zoom.invert([0, 0]), zoom.invert([data.width, data.height])];
104
+ else {
105
+ const i = c.current.getBoundingClientRect();
106
+ B = [d.invert([0, 0]), d.invert([i.width, i.height])];
136
107
  }
137
- const bundles = useMemo(() => {
138
- const bundlesDict = {};
139
- flatNodes.forEach((node) => {
140
- if (!node.parents) {
108
+ const U = S(() => {
109
+ const i = {};
110
+ return C.forEach((o) => {
111
+ if (!o.parents)
141
112
  return;
142
- }
143
- const bundleId = node.parents.join(BUNDLE_SEPARATOR);
144
- if (bundlesDict[bundleId]) {
145
- bundlesDict[bundleId].destinations.push(node);
146
- } else {
147
- bundlesDict[bundleId] = {
148
- id: bundleId,
149
- sources: node.parents.map((parent) => flatNodes.find((_node) => _node.id === parent)),
150
- destinations: [node]
151
- };
152
- }
153
- });
154
- return Object.values(bundlesDict);
155
- }, [flatNodes]);
156
- const layoutData = useMemo(() => {
113
+ const l = o.parents.join(Ht);
114
+ i[l] ? i[l].destinations.push(o) : i[l] = {
115
+ id: l,
116
+ sources: o.parents.map((s) => C.find((E) => E.id === s)),
117
+ destinations: [o]
118
+ };
119
+ }), Object.values(i);
120
+ }, [C]), G = S(() => {
157
121
  const {
158
- letterSize,
159
- letterWidth,
160
- enableEntryPadding,
161
- truncateLabels,
162
- rowStep,
163
- belowPrevious
164
- } = combinedOptions;
165
- let currentX = 0;
166
- let currentY = 0;
167
- const nodeLocations = {};
168
- const linesByLevel = {};
169
- const paddingByLevel = {};
170
- const inputs = {};
171
- const outputs = {};
172
- levels.forEach((level, levelIndex) => {
173
- let longestLabel = 0;
174
- level.forEach((node) => {
175
- var _a2;
176
- const validKeys = labelKeys == null ? void 0 : labelKeys.filter((_comparator) => runComparator(_comparator, node));
177
- const labelKey = (_a2 = validKeys == null ? void 0 : validKeys.pop()) == null ? void 0 : _a2.label;
178
- const labelRows = (labelKey == null ? void 0 : labelKey.split(",").map((key) => get(node, key)).filter((val) => !!val)) ?? [];
179
- if (labelRows.length < 1) {
180
- node.id.split("\n").forEach((line) => labelRows.push(line));
181
- }
182
- const labelHeight = labelRows.length * letterSize;
183
- currentY += labelHeight;
184
- nodeLocations[node.id] = [+currentX, +currentY, -linePaddingY];
185
- currentY += ySpacing;
186
- if (enableEntryPadding) {
187
- longestLabel = Math.max(longestLabel, max((labelRows == null ? void 0 : labelRows.map((row) => row.toString().length)) ?? [node.id.length]));
188
- }
122
+ letterSize: i,
123
+ letterWidth: o,
124
+ enableEntryPadding: l,
125
+ truncateLabels: s,
126
+ rowStep: E,
127
+ belowPrevious: F
128
+ } = v;
129
+ let V = 0, O = 0;
130
+ const P = {}, T = {}, R = {}, k = {}, D = {};
131
+ return w.forEach((e, a) => {
132
+ let b = 0;
133
+ e.forEach((f) => {
134
+ var q;
135
+ const g = r == null ? void 0 : r.filter((t) => W(t, f)), m = (q = g == null ? void 0 : g.pop()) == null ? void 0 : q.label, p = (m == null ? void 0 : m.split(",").map((t) => Tt(f, t)).filter((t) => !!t)) ?? [];
136
+ p.length < 1 && f.id.split(`
137
+ `).forEach((t) => p.push(t));
138
+ const I = p.length * i;
139
+ O += I, P[f.id] = [+V, +O, -M], O += ht, l && (b = Math.max(b, kt((p == null ? void 0 : p.map((t) => t.toString().length)) ?? [f.id.length])));
140
+ }), V += $ + (s ? Math.min(b, 44) : b) * o, F ? O += E : O = (a + 1) * E;
141
+ }), U.forEach((e) => {
142
+ e.sources.forEach((a) => {
143
+ D[a.id] || (D[a.id] = /* @__PURE__ */ new Set()), D[a.id].add(e.id);
144
+ }), e.destinations.forEach((a) => {
145
+ Yt(T[a.level]) && (T[a.level] = /* @__PURE__ */ new Set()), k[a.id] || (k[a.id] = /* @__PURE__ */ new Set()), T[a.level].add(e.id), k[a.id].add(e.id);
189
146
  });
190
- currentX += xSpacing + (!truncateLabels ? longestLabel : Math.min(longestLabel, 44)) * letterWidth;
191
- if (!belowPrevious) {
192
- currentY = (levelIndex + 1) * rowStep;
193
- } else {
194
- currentY += rowStep;
195
- }
196
- });
197
- bundles.forEach((bundle) => {
198
- bundle.sources.forEach((source) => {
199
- if (!outputs[source.id]) {
200
- outputs[source.id] = /* @__PURE__ */ new Set();
201
- }
202
- outputs[source.id].add(bundle.id);
147
+ }), Object.entries(T).forEach(([e, a]) => R[e] = a.size), w.forEach((e, a) => {
148
+ const f = ei(a + 1).map((m) => R[m] ?? 0), g = ni(f) * j;
149
+ e.forEach((m) => {
150
+ P[m.id][0] += g;
203
151
  });
204
- bundle.destinations.forEach((dest) => {
205
- if (isNil(linesByLevel[dest.level])) {
206
- linesByLevel[dest.level] = /* @__PURE__ */ new Set();
207
- }
208
- if (!inputs[dest.id]) {
209
- inputs[dest.id] = /* @__PURE__ */ new Set();
210
- }
211
- linesByLevel[dest.level].add(bundle.id);
212
- inputs[dest.id].add(bundle.id);
152
+ }), C.forEach((e) => {
153
+ var f, g, m;
154
+ let a = kt([((f = k[e.id]) == null ? void 0 : f.size) - 1, ((g = D[e.id]) == null ? void 0 : g.size) - 1, 0]) * M;
155
+ (m = k[e.id]) != null && m.has(e.id) && (a += M), P[e.id][2] = a;
156
+ const b = w[e.level].findIndex((p) => p.id === e.id);
157
+ w[e.level].filter((p, I) => b < I).forEach((p) => {
158
+ P[p.id][1] += a;
213
159
  });
214
- });
215
- Object.entries(linesByLevel).forEach(([level, lines]) => paddingByLevel[level] = lines.size);
216
- levels.forEach((level, levelIndex) => {
217
- const indexesSoFar = range(levelIndex + 1);
218
- const paddingArray = indexesSoFar.map((_levelIndex) => paddingByLevel[_levelIndex] ?? 0);
219
- const totalPadding = sum(paddingArray) * linePaddingX;
220
- level.forEach((node) => {
221
- nodeLocations[node.id][0] += totalPadding;
222
- });
223
- });
224
- flatNodes.forEach((node) => {
225
- var _a2, _b2, _c2;
226
- let maxHeight = max([((_a2 = inputs[node.id]) == null ? void 0 : _a2.size) - 1, ((_b2 = outputs[node.id]) == null ? void 0 : _b2.size) - 1, 0]) * linePaddingY;
227
- if ((_c2 = inputs[node.id]) == null ? void 0 : _c2.has(node.id)) {
228
- maxHeight += linePaddingY;
229
- }
230
- nodeLocations[node.id][2] = maxHeight;
231
- const levelIndex = levels[node.level].findIndex((_node) => _node.id === node.id);
232
- levels[node.level].filter((__, index) => levelIndex < index).forEach((_node) => {
233
- nodeLocations[_node.id][1] += maxHeight;
234
- });
235
- });
236
- return {
237
- nodeLocations,
238
- linesByLevel,
239
- paddingByLevel
160
+ }), {
161
+ nodeLocations: P,
162
+ linesByLevel: T,
163
+ paddingByLevel: R
240
164
  };
241
165
  }, [
242
- bundles,
243
- combinedOptions,
244
- flatNodes,
245
- labelKeys,
246
- levels,
247
- linePaddingX,
248
- linePaddingY,
249
- runComparator,
250
- xSpacing,
251
- ySpacing
252
- ]);
253
- const [timestamps, bundleElements, nodes] = useMemo(() => {
166
+ U,
167
+ v,
168
+ C,
169
+ r,
170
+ w,
171
+ j,
172
+ M,
173
+ W,
174
+ $,
175
+ ht
176
+ ]), [Mt, Rt, Dt] = S(() => {
254
177
  const {
255
- textColor,
256
- letterSize,
257
- letterWidth,
258
- nodeRadius,
259
- nodeColor,
260
- maxArcRadius,
261
- lineWidth,
262
- truncateLabels,
263
- enableTimestamps,
264
- belowPrevious,
265
- iconOrientation,
266
- lineDirection,
267
- colorTheme
268
- } = combinedOptions;
269
- const { nodeLocations, linesByLevel, paddingByLevel } = layoutData;
270
- const _nodes = [];
271
- const _timestamps = [];
272
- flatNodes.forEach((node) => {
273
- var _a2, _b2, _c2, _d;
274
- const [x, y, _height] = nodeLocations[node.id];
275
- const labelKey = ((_a2 = labelKeys == null ? void 0 : labelKeys.filter((_comparator) => runComparator(_comparator, node)).pop()) == null ? void 0 : _a2.label) ?? "id";
276
- let label = labelKey == null ? void 0 : labelKey.split(",").map((key) => {
277
- let labelSection = get(node, key);
278
- if (labelSection && truncateLabels && labelSection.length > 44) {
279
- labelSection = labelSection.replace(/^(.{32}).+$/, "$1 (TRUNCATED)");
280
- }
281
- return labelSection;
282
- }).filter((section) => !!section).join("\n");
283
- if (!label) {
284
- if (node.id.length > 44) {
285
- label = node.id.replace(/^(.{32}).+$/, "$1 (TRUNCATED)");
286
- } else {
287
- label = node.id;
288
- }
289
- }
290
- if (belowPrevious && enableTimestamps && (node.timestamp || node.annotation)) {
291
- _timestamps.push(
292
- /* @__PURE__ */ jsxs(
293
- "g",
294
- {
295
- style: {
296
- cursor: "default",
297
- fontFamily: '"Lucida Console", monospace',
298
- fontSize: letterSize * 0.75 + "px"
299
- },
300
- children: [
301
- /* @__PURE__ */ jsx(
178
+ textColor: i,
179
+ letterSize: o,
180
+ letterWidth: l,
181
+ nodeRadius: s,
182
+ nodeColor: E,
183
+ maxArcRadius: F,
184
+ lineWidth: V,
185
+ truncateLabels: O,
186
+ enableTimestamps: P,
187
+ belowPrevious: T,
188
+ iconOrientation: R,
189
+ lineDirection: k,
190
+ colorTheme: D
191
+ } = v, { nodeLocations: e, linesByLevel: a, paddingByLevel: b } = G, f = [], g = [];
192
+ C.forEach((t) => {
193
+ var St, Ct, bt, Et;
194
+ const [yt, z, Z] = e[t.id], K = ((St = r == null ? void 0 : r.filter((y) => W(y, t)).pop()) == null ? void 0 : St.label) ?? "id";
195
+ let J = K == null ? void 0 : K.split(",").map((y) => {
196
+ let x = Tt(t, y);
197
+ return x && O && x.length > 44 && (x = x.replace(/^(.{32}).+$/, "$1 (TRUNCATED)")), x;
198
+ }).filter((y) => !!y).join(`
199
+ `);
200
+ if (J || (t.id.length > 44 ? J = t.id.replace(/^(.{32}).+$/, "$1 (TRUNCATED)") : J = t.id), T && P && (t.timestamp || t.annotation) && g.push(
201
+ /* @__PURE__ */ it(
202
+ "g",
203
+ {
204
+ style: {
205
+ cursor: "default",
206
+ fontFamily: '"Lucida Console", monospace',
207
+ fontSize: o * 0.75 + "px"
208
+ },
209
+ children: [
210
+ /* @__PURE__ */ L(
211
+ "text",
212
+ {
213
+ x: B[0][0] + $,
214
+ y: z + (Z + s) / 2,
215
+ fill: u.palette.getContrastText(u.palette.background.paper),
216
+ style: {
217
+ fillOpacity: H(t.id) / 2,
218
+ transition: u.transitions.create(["fill-opacity"], {
219
+ duration: u.transitions.duration.short
220
+ })
221
+ },
222
+ children: t.timestamp
223
+ }
224
+ ),
225
+ t.annotation && t.annotation.split(`
226
+ `).map((y, x) => {
227
+ var Q;
228
+ return /* @__PURE__ */ L(
302
229
  "text",
303
230
  {
304
- x: portBounds[0][0] + xSpacing,
305
- y: y + (_height + nodeRadius) / 2,
306
- fill: theme.palette.getContrastText(theme.palette.background.paper),
231
+ x: B[0][0] + (((Q = t.timestamp) == null ? void 0 : Q.length) ?? 0) * l,
232
+ y: z + (Z + s) / 2 + x * o,
233
+ fill: ut ? wt.orange[300] : wt.blue[900],
307
234
  style: {
308
- fillOpacity: nodeOpacities(node.id) / 2,
309
- transition: theme.transitions.create(["fill-opacity"], {
310
- duration: theme.transitions.duration.short
235
+ fillOpacity: H(t.id),
236
+ transition: u.transitions.create(["fill-opacity"], {
237
+ duration: u.transitions.duration.short
311
238
  })
312
239
  },
313
- children: node.timestamp
314
- }
315
- ),
316
- node.annotation && node.annotation.split("\n").map((line, index) => {
317
- var _a3;
318
- return /* @__PURE__ */ jsx(
319
- "text",
320
- {
321
- x: portBounds[0][0] + (((_a3 = node.timestamp) == null ? void 0 : _a3.length) ?? 0) * letterWidth,
322
- y: y + (_height + nodeRadius) / 2 + index * letterSize,
323
- fill: isDark ? colors.orange[300] : colors.blue[900],
324
- style: {
325
- fillOpacity: nodeOpacities(node.id),
326
- transition: theme.transitions.create(["fill-opacity"], {
327
- duration: theme.transitions.duration.short
328
- })
329
- },
330
- children: line
331
- },
332
- line
333
- );
334
- })
335
- ]
336
- },
337
- node.id + "-timestamp"
338
- )
339
- );
340
- }
341
- if (!showCards) {
342
- const style = runComparators(
343
- (_c2 = (_b2 = graph.metadata.display) == null ? void 0 : _b2.styles) == null ? void 0 : _c2.filter((comparator) => comparator.type === "node"),
344
- node
345
- );
346
- const nodeOpacity = nodeOpacities(node.id);
347
- const icons = (_d = node.icons) == null ? void 0 : _d.map((icon) => [icon, getIcon(icon)]).filter(([__, icon]) => !!icon).map(([icon, Icon], index) => /* @__PURE__ */ jsx(
348
- Icon,
240
+ children: y
241
+ },
242
+ y
243
+ );
244
+ })
245
+ ]
246
+ },
247
+ t.id + "-timestamp"
248
+ )
249
+ ), !Y) {
250
+ const y = lt(
251
+ (bt = (Ct = n.metadata.display) == null ? void 0 : Ct.styles) == null ? void 0 : bt.filter((N) => N.type === "node"),
252
+ t
253
+ ), x = H(t.id), Q = (Et = t.icons) == null ? void 0 : Et.map((N) => [N, zt(N)]).filter(([N, tt]) => !!tt).map(([N, tt], Lt) => /* @__PURE__ */ L(
254
+ tt,
349
255
  {
350
- x: x - nodeRadius * 3 * (iconOrientation === "horizontal" ? index + 1 : 0),
351
- y: y - nodeRadius * 3 * (iconOrientation === "vertical" ? index + 1 : 0),
352
- size: letterSize * 1.5,
256
+ x: yt - s * 3 * (R === "horizontal" ? Lt + 1 : 0),
257
+ y: z - s * 3 * (R === "vertical" ? Lt + 1 : 0),
258
+ size: o * 1.5,
353
259
  style: {
354
- fillOpacity: nodeOpacity
260
+ fillOpacity: x
355
261
  },
356
262
  circleStyle: {
357
- fillOpacity: nodeOpacity
263
+ fillOpacity: x
358
264
  }
359
265
  },
360
- icon
266
+ N
361
267
  ));
362
- _nodes.push(
363
- /* @__PURE__ */ jsx(
364
- Leaf,
268
+ f.push(
269
+ /* @__PURE__ */ L(
270
+ Jt,
365
271
  {
366
- alwaysShowText: true,
367
- nodeId: node.id,
368
- label,
369
- height: _height,
370
- x,
371
- y,
372
- style,
373
- nodeRadius,
374
- nodeColor,
375
- nodeOpacity,
376
- letterSize,
377
- letterWidth,
378
- textColor,
379
- selected: highlightedNodes.has(node.id),
380
- onHoverChanged: onNodeHoveredChanged,
381
- onClick: onNodeClicked,
382
- children: icons
272
+ alwaysShowText: !0,
273
+ nodeId: t.id,
274
+ label: J,
275
+ height: Z,
276
+ x: yt,
277
+ y: z,
278
+ style: y,
279
+ nodeRadius: s,
280
+ nodeColor: E,
281
+ nodeOpacity: x,
282
+ letterSize: o,
283
+ letterWidth: l,
284
+ textColor: i,
285
+ selected: ft.has(t.id),
286
+ onHoverChanged: A,
287
+ onClick: ct,
288
+ children: Q
383
289
  },
384
- node.id
290
+ t.id
385
291
  )
386
292
  );
387
293
  }
388
294
  });
389
- const readonlyNodeLocations = cloneDeep(nodeLocations);
390
- const outputsByNode = {};
391
- const inputsByNode = {};
392
- const _bundleElements = bundles.map((bundle) => {
393
- return /* @__PURE__ */ jsx(
394
- BundleLine,
395
- {
396
- lineDirection,
397
- linesByLevel,
398
- paddingByLevel,
399
- nodeLocations: readonlyNodeLocations,
400
- outputsByNode,
401
- inputsByNode,
402
- bundle,
403
- maxArcRadius,
404
- lineWidth,
405
- linePaddingX,
406
- linePaddingY,
407
- highlightedPath,
408
- colorTheme
409
- },
410
- bundle.id
411
- );
412
- });
413
- return [_timestamps, _bundleElements, _nodes];
295
+ const m = Xt(e), p = {}, I = {}, q = U.map((t) => /* @__PURE__ */ L(
296
+ Qt,
297
+ {
298
+ lineDirection: k,
299
+ linesByLevel: a,
300
+ paddingByLevel: b,
301
+ nodeLocations: m,
302
+ outputsByNode: p,
303
+ inputsByNode: I,
304
+ bundle: t,
305
+ maxArcRadius: F,
306
+ lineWidth: V,
307
+ linePaddingX: j,
308
+ linePaddingY: M,
309
+ highlightedPath: dt,
310
+ colorTheme: D
311
+ },
312
+ t.id
313
+ ));
314
+ return [g, q, f];
414
315
  }, [
415
- bundles,
416
- combinedOptions,
417
- (_c = graph.metadata.display) == null ? void 0 : _c.styles,
418
- flatNodes,
419
- highlightedNodes,
420
- highlightedPath,
421
- isDark,
422
- labelKeys,
423
- layoutData,
424
- linePaddingX,
425
- linePaddingY,
426
- nodeOpacities,
427
- onNodeClicked,
428
- onNodeHoveredChanged,
429
- portBounds,
430
- runComparator,
431
- runComparators,
432
- showCards,
433
- theme.palette,
434
- theme.transitions,
435
- xSpacing
436
- ]);
437
- const cards = useMemo(() => {
438
- const { nodeRadius, lineWidth } = combinedOptions;
439
- const { nodeLocations } = layoutData;
440
- return flatNodes.filter((node) => showCards || hoveredNode === node.id).map((node) => {
441
- const [x, y] = nodeLocations[node.id];
442
- return /* @__PURE__ */ jsx(
443
- Box,
316
+ U,
317
+ v,
318
+ (vt = n.metadata.display) == null ? void 0 : vt.styles,
319
+ C,
320
+ ft,
321
+ dt,
322
+ ut,
323
+ r,
324
+ G,
325
+ j,
326
+ M,
327
+ H,
328
+ ct,
329
+ A,
330
+ B,
331
+ W,
332
+ lt,
333
+ Y,
334
+ u.palette,
335
+ u.transitions,
336
+ $
337
+ ]), _t = S(() => {
338
+ const { nodeRadius: i, lineWidth: o } = v, { nodeLocations: l } = G;
339
+ return C.filter((s) => Y || pt === s.id).map((s) => {
340
+ const [E, F] = l[s.id];
341
+ return /* @__PURE__ */ L(
342
+ Ft,
444
343
  {
445
- onMouseOver: () => onNodeHoveredChanged(node.id, true),
446
- onMouseLeave: () => setTimeout(() => onNodeHoveredChanged(node.id, false), 100),
344
+ onMouseOver: () => A(s.id, !0),
345
+ onMouseLeave: () => setTimeout(() => A(s.id, !1), 100),
447
346
  sx: {
448
347
  position: "absolute",
449
- left: zoom.k * x + zoom.x,
450
- top: zoom.k * y + zoom.y,
451
- transform: `translateX(-${nodeRadius * 2}px) translateY(${lineWidth}px)`,
452
- backgroundColor: theme.palette.background.paper,
348
+ left: d.k * E + d.x,
349
+ top: d.k * F + d.y,
350
+ transform: `translateX(-${i * 2}px) translateY(${o}px)`,
351
+ backgroundColor: u.palette.background.paper,
453
352
  maxWidth: "450px",
454
353
  maxHeight: "500px",
455
354
  overflow: "auto"
456
355
  },
457
- children: /* @__PURE__ */ jsx(NodeCard, { node })
356
+ children: /* @__PURE__ */ L(qt, { node: s })
458
357
  },
459
- node.id
358
+ s.id
460
359
  );
461
360
  });
462
361
  }, [
463
- combinedOptions,
464
- flatNodes,
465
- hoveredNode,
466
- layoutData,
467
- onNodeHoveredChanged,
468
- showCards,
469
- theme.palette.background.paper,
470
- zoom.k,
471
- zoom.x,
472
- zoom.y
362
+ v,
363
+ C,
364
+ pt,
365
+ G,
366
+ A,
367
+ Y,
368
+ u.palette.background.paper,
369
+ d.k,
370
+ d.x,
371
+ d.y
473
372
  ]);
474
- return /* @__PURE__ */ jsxs(Fragment, { children: [
475
- /* @__PURE__ */ jsx("svg", { id: "viz", ref: svgRef, children: /* @__PURE__ */ jsxs("g", { id: "view", children: [
476
- timestamps,
477
- bundleElements,
478
- nodes
373
+ return /* @__PURE__ */ it(At, { children: [
374
+ /* @__PURE__ */ L("svg", { id: "viz", ref: c, children: /* @__PURE__ */ it("g", { id: "view", children: [
375
+ Mt,
376
+ Rt,
377
+ Dt
479
378
  ] }) }),
480
- cards
379
+ _t
481
380
  ] });
482
- };
483
- const Tree$1 = memo(Tree);
381
+ }, Li = Vt(ai);
484
382
  export {
485
- Tree$1 as default
383
+ Li as default
486
384
  };