@cccsaurora/clue-ui 1.1.3 → 1.2.0-dev.106

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 (178) 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/cloneDeep-CjP5k9zW.js +8 -0
  24. package/components/AnnotationBody.js +49 -35
  25. package/components/AnnotationDetailPopover.js +36 -30
  26. package/components/AnnotationDetails.js +6 -6
  27. package/components/AnnotationEntry.js +50 -47
  28. package/components/AnnotationPreview.js +5 -5
  29. package/components/ClassificationChip.js +44 -23
  30. package/components/CountBadge.js +31 -26
  31. package/components/EnrichedCard.js +110 -97
  32. package/components/EnrichedChip.js +130 -105
  33. package/components/EnrichedTypography.js +133 -107
  34. package/components/ErrorBoundary.js +28 -24
  35. package/components/RetryFailedEnrichments.js +10 -9
  36. package/components/SourcePicker.js +57 -49
  37. package/components/actions/ActionForm.js +4 -4
  38. package/components/actions/ExecutePopover.js +64 -50
  39. package/components/actions/ResultModal.js +5 -5
  40. package/components/actions/form/schemaAdapter.js +39 -23
  41. package/components/display/graph/ExpandMoreButton.js +10 -10
  42. package/components/display/graph/elements/NodeCard.js +111 -91
  43. package/components/display/graph/elements/NodeTag.js +15 -13
  44. package/components/display/graph/index.js +261 -202
  45. package/components/display/graph/visualizations/Leaf.js +88 -69
  46. package/components/display/graph/visualizations/cloud/index.js +98 -81
  47. package/components/display/graph/visualizations/icons/BaseIcon.js +26 -21
  48. package/components/display/graph/visualizations/icons/BugIcon.js +12 -12
  49. package/components/display/graph/visualizations/icons/HostIcon.js +12 -12
  50. package/components/display/graph/visualizations/icons/NetworkIcon.js +12 -12
  51. package/components/display/graph/visualizations/icons/ProcessIcon.js +12 -12
  52. package/components/display/graph/visualizations/icons/TargetIcon.js +13 -13
  53. package/components/display/graph/visualizations/icons/index.js +14 -13
  54. package/components/display/graph/visualizations/panels/NodePanel.js +10 -8
  55. package/components/display/graph/visualizations/tree/BundleLine.js +108 -81
  56. package/components/display/graph/visualizations/tree/Triangle.js +13 -13
  57. package/components/display/graph/visualizations/tree/index.js +407 -305
  58. package/components/display/icons/Iconified.js +27 -12
  59. package/components/display/json/index.js +4 -4
  60. package/components/display/markdown/index.js +8658 -5757
  61. package/components/enrichment/EnrichPopover.js +55 -47
  62. package/components/fetchers/Fetcher.js +123 -95
  63. package/components/fetchers/PreviewModal.js +20 -17
  64. package/components/fetchers/StatusChip.js +21 -17
  65. package/components/group/Entry.js +13 -11
  66. package/components/group/Group.js +13 -10
  67. package/components/group/GroupControl.js +77 -66
  68. package/components/stats/QueryStatus.js +40 -35
  69. package/countBy-C69WslUA.js +14 -0
  70. package/data/event.js +6 -4
  71. package/database/index.js +2 -2
  72. package/debounce-bV0h5FC5.js +92 -0
  73. package/get-D3C3lEU3.js +8 -0
  74. package/groupBy-DC2oOuBN.js +14 -0
  75. package/hooks/ClueActionContext.js +7 -7
  76. package/hooks/ClueComponentContext.js +29 -23
  77. package/hooks/ClueConfigProvider.js +14 -12
  78. package/hooks/ClueDatabaseContext.js +19 -13
  79. package/hooks/ClueEnrichContext.js +8 -8
  80. package/hooks/ClueFetcherContext.js +74 -46
  81. package/hooks/ClueGroupContext.js +17 -14
  82. package/hooks/CluePopupContext.js +5 -5
  83. package/hooks/ClueProvider.js +12 -10
  84. package/hooks/selectors.js +21 -10
  85. package/hooks/useActionResult.js +2 -2
  86. package/hooks/useAnnotations.js +44 -32
  87. package/hooks/useClue.js +6 -4
  88. package/hooks/useClueActions.js +3 -3
  89. package/hooks/useClueConfig.js +6 -4
  90. package/hooks/useClueTypeConfig.js +3 -3
  91. package/hooks/useComparator.js +722 -435
  92. package/hooks/useErrors.js +22 -18
  93. package/hooks/useMyHighlights.js +66 -36
  94. package/hooks/useMyLocalStorage.js +66 -37
  95. package/iconify-CXMreGTg.js +1782 -0
  96. package/icons/Action.js +66 -49
  97. package/icons/Assessment.js +84 -68
  98. package/icons/Context.js +77 -63
  99. package/icons/Opinion.js +77 -65
  100. package/icons/iconMap.js +2 -2
  101. package/identity-CPGTqrE4.js +6 -0
  102. package/index-BDVjGvMI.js +696 -0
  103. package/index-BbPn6-Mw.js +15750 -0
  104. package/index-Bi21Wb23.js +465 -0
  105. package/index-C3lkTD69.js +1172 -0
  106. package/index-CC12Ux-9.js +17654 -0
  107. package/isEmpty-BQkZubqU.js +29 -0
  108. package/isNil-CIubwp4T.js +6 -0
  109. package/isObject-FTY-5JQX.js +7 -0
  110. package/isObjectLike-OAgjjZye.js +48 -0
  111. package/isSymbol-Xd2FsJyp.js +8 -0
  112. package/last-CUCl67Im.js +7 -0
  113. package/main.js +62 -62
  114. package/package.json +1 -1
  115. package/sortBy-B-UKp4GT.js +100 -0
  116. package/sumBy-MYkDPHZL.js +8 -0
  117. package/text/Frequency.js +42 -23
  118. package/toFinite-Bc55msYj.js +16 -0
  119. package/toNumber-DPxy1FBy.js +39 -0
  120. package/useClueTypeConfig-XvGvIw2S.js +3201 -0
  121. package/utils/chain.js +91 -64
  122. package/utils/classificationParser.js +519 -256
  123. package/utils/constants.js +35 -10
  124. package/utils/graph.js +72 -45
  125. package/utils/hashUtil.js +7 -7
  126. package/utils/line.js +131 -81
  127. package/utils/loggerUtil.js +5 -3
  128. package/utils/sessionStorage.js +41 -27
  129. package/utils/time.js +423 -423
  130. package/utils/utils.js +9 -9
  131. package/utils/window.js +21 -10
  132. package/utils-7OtvGnmf.js +200 -0
  133. package/ActionForm-myEAs2UC.js +0 -435
  134. package/AnnotationDetails-BChWwaXw.js +0 -160
  135. package/AnnotationPreview-D060vmy2.js +0 -140
  136. package/ClueEnrichContext-DJNjbXu_.js +0 -418
  137. package/FlexOne-BXWFOd1T.js +0 -6
  138. package/_Map-DXNg_Z-q.js +0 -54
  139. package/_MapCache-Cu25RRDU.js +0 -129
  140. package/_Uint8Array-DlJCtTvG.js +0 -102
  141. package/_baseAssignValue-CUmzp727.js +0 -20
  142. package/_baseClone-BlMmRXeX.js +0 -208
  143. package/_baseExtremum-P_0akmCi.js +0 -27
  144. package/_baseFlatten-CN7vDNEQ.js +0 -72
  145. package/_baseGet-Dgf6_xCm.js +0 -80
  146. package/_baseIsEqual-Cpjtfb3Q.js +0 -173
  147. package/_baseIteratee-CP1bocOX.js +0 -95
  148. package/_baseSlice-M5RKzt1A.js +0 -10
  149. package/_baseSum-wEbgNeUs.js +0 -10
  150. package/_baseUniq-tMFmk80M.js +0 -61
  151. package/_commonjsHelpers-DaMA6jEr.js +0 -8
  152. package/_createAggregator-B4Cav8ZM.js +0 -53
  153. package/_getPrototype-CHAFQYL_.js +0 -5
  154. package/_getTag-BV_UoLYG.js +0 -90
  155. package/cloneDeep-BPVpFBzJ.js +0 -8
  156. package/countBy-DOutsa_w.js +0 -8
  157. package/debounce-DryYcbJ4.js +0 -56
  158. package/get-Bow1vKwx.js +0 -8
  159. package/groupBy-BheQYl6f.js +0 -8
  160. package/iconify-BBckr5AQ.js +0 -1263
  161. package/identity-ByMq8VxU.js +0 -6
  162. package/index-BXxfAxFt.js +0 -12734
  163. package/index-C15OYgRY.js +0 -358
  164. package/index-E7g8cRyW.js +0 -568
  165. package/index-p5_wX7q1.js +0 -11729
  166. package/index-vF6IyBhz.js +0 -975
  167. package/isEmpty-g47Qir2A.js +0 -21
  168. package/isNil-CjWwlQS3.js +0 -6
  169. package/isObject-B53jY8Qg.js +0 -7
  170. package/isObjectLike-BatpeCIi.js +0 -29
  171. package/isSymbol-C3_SC0Qp.js +0 -8
  172. package/last-7CdUxN0r.js +0 -7
  173. package/sortBy-ITdmD17L.js +0 -79
  174. package/sumBy-DxJUU2E8.js +0 -8
  175. package/toFinite-BMy6GObD.js +0 -14
  176. package/toNumber-YVhnnJv4.js +0 -31
  177. package/useClueTypeConfig-DyeBcXQX.js +0 -2214
  178. package/utils-BnmI_6N8.js +0 -130
package/icons/Opinion.js CHANGED
@@ -1,113 +1,125 @@
1
- import { jsxs as d, jsx as r, Fragment as $ } from "react/jsx-runtime";
2
- import { I as u } from "../iconify-BBckr5AQ.js";
3
- import { useTheme as B, Stack as x, Chip as v, Divider as O, Grid as y } from "@mui/material";
4
- import k from "../components/CountBadge.js";
5
- import { C as b } from "../AnnotationPreview-D060vmy2.js";
6
- import j from "../utils/chain.js";
7
- import { g as q } from "../groupBy-BheQYl6f.js";
8
- import { s as M } from "../sortBy-ITdmD17L.js";
9
- import { s as S } from "../sumBy-DxJUU2E8.js";
10
- import { memo as R, useRef as D, useMemo as a, useCallback as E, useEffect as F } from "react";
11
- import { u as I } from "../index-E7g8cRyW.js";
12
- const G = ({ annotations: m, value: l, counters: C = !0, disableTooltip: c = !1, ubiquitous: p = !1, ...f }) => {
13
- const i = B(), w = I(b, (e) => e.showInfo), h = I(b, (e) => e.closeInfo), g = D(), s = a(
14
- () => m.filter((e) => e.type === "opinion" && e.ubiquitous === p),
15
- [m, p]
16
- ), o = a(
17
- () => j(
18
- Object.entries(q(s, "value")).map(([e, t]) => [
19
- e,
20
- S(t, "quantity")
1
+ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
+ import { I as Icon } from "../iconify-CXMreGTg.js";
3
+ import { useTheme, Stack, Chip, Divider, Grid } from "@mui/material";
4
+ import CountBadge from "../components/CountBadge.js";
5
+ import { C as CluePopupContext } from "../AnnotationPreview-CQwKs8se.js";
6
+ import chain from "../utils/chain.js";
7
+ import { g as groupBy } from "../groupBy-DC2oOuBN.js";
8
+ import { s as sortBy } from "../sortBy-B-UKp4GT.js";
9
+ import { s as sumBy } from "../sumBy-MYkDPHZL.js";
10
+ import { memo, useRef, useMemo, useCallback, useEffect } from "react";
11
+ import { u as useContextSelector } from "../index-BDVjGvMI.js";
12
+ const OpinionIcon = ({ annotations, value, counters = true, disableTooltip = false, ubiquitous = false, ...otherProps }) => {
13
+ const theme = useTheme();
14
+ const showInfo = useContextSelector(CluePopupContext, (state) => state.showInfo);
15
+ const closeInfo = useContextSelector(CluePopupContext, (state) => state.closeInfo);
16
+ const anchorRef = useRef();
17
+ const opinionAnnotations = useMemo(
18
+ () => annotations.filter((annotation) => annotation.type === "opinion" && annotation.ubiquitous === ubiquitous),
19
+ [annotations, ubiquitous]
20
+ );
21
+ const sortedOpinions = useMemo(
22
+ () => chain(
23
+ Object.entries(groupBy(opinionAnnotations, "value")).map(([_value, _annotations]) => [
24
+ _value,
25
+ sumBy(_annotations, "quantity")
21
26
  ])
22
- ).sortBy(([e, t]) => t).reverse().value(),
23
- [s]
24
- ), n = E(
25
- (e) => e === "benign" ? "mdi:shield-check" : e === "suspicious" ? "mdi:warning-outline" : e === "obscure" ? "bi:eye-slash-fill" : "mdi:warning-decagram",
27
+ ).sortBy(([__, count]) => count).reverse().value(),
28
+ [opinionAnnotations]
29
+ );
30
+ const icon = useCallback(
31
+ (_opinion) => _opinion === "benign" ? "mdi:shield-check" : _opinion === "suspicious" ? "mdi:warning-outline" : _opinion === "obscure" ? "bi:eye-slash-fill" : "mdi:warning-decagram",
26
32
  []
27
33
  );
28
- F(() => {
29
- c && h("opinion", l);
30
- }, [c]);
31
- const z = a(
32
- () => /* @__PURE__ */ d(x, { spacing: 1, onClick: (e) => e.stopPropagation(), children: [
33
- s.length > 1 && /* @__PURE__ */ d($, { children: [
34
- /* @__PURE__ */ r(x, { direction: "row", children: o.map(([e, t]) => /* @__PURE__ */ r(
35
- v,
34
+ useEffect(() => {
35
+ if (disableTooltip) {
36
+ closeInfo("opinion", value);
37
+ }
38
+ }, [disableTooltip]);
39
+ const tooltipContent = useMemo(
40
+ () => /* @__PURE__ */ jsxs(Stack, { spacing: 1, onClick: (e) => e.stopPropagation(), children: [
41
+ opinionAnnotations.length > 1 && /* @__PURE__ */ jsxs(Fragment, { children: [
42
+ /* @__PURE__ */ jsx(Stack, { direction: "row", children: sortedOpinions.map(([type, count]) => /* @__PURE__ */ jsx(
43
+ Chip,
36
44
  {
37
45
  size: "small",
38
46
  variant: "outlined",
39
- label: `${e}: ${t}`,
40
- icon: /* @__PURE__ */ r(u, { icon: n(e) }),
47
+ label: `${type}: ${count}`,
48
+ icon: /* @__PURE__ */ jsx(Icon, { icon: icon(type) }),
41
49
  sx: { textTransform: "capitalize" },
42
50
  color: {
43
51
  benign: "success",
44
52
  suspicious: "warning",
45
53
  obscure: "error",
46
54
  malicious: "error"
47
- }[e]
55
+ }[type]
48
56
  },
49
- e
57
+ type
50
58
  )) }),
51
- /* @__PURE__ */ r(O, { orientation: "horizontal", flexItem: !0 })
59
+ /* @__PURE__ */ jsx(Divider, { orientation: "horizontal", flexItem: true })
52
60
  ] }),
53
- /* @__PURE__ */ r(
54
- y,
61
+ /* @__PURE__ */ jsx(
62
+ Grid,
55
63
  {
56
64
  sx: {
57
- mt: s.length < 2 && `${i.spacing(-0.5)} !important`,
58
- ml: `${i.spacing(-0.5)} !important`
65
+ mt: opinionAnnotations.length < 2 && `${theme.spacing(-0.5)} !important`,
66
+ ml: `${theme.spacing(-0.5)} !important`
59
67
  },
60
- container: !0,
68
+ container: true,
61
69
  spacing: 0.5,
62
70
  maxWidth: "500px",
63
- children: M(s, "value").map((e) => /* @__PURE__ */ r(y, { item: !0, children: /* @__PURE__ */ r(
64
- v,
71
+ children: sortBy(opinionAnnotations, "value").map((annotation) => /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(
72
+ Chip,
65
73
  {
66
74
  size: "small",
67
75
  variant: "outlined",
68
- label: (e.analytic ?? e.author) + (e.quantity > 1 ? ` (x${e.quantity})` : ""),
69
- icon: /* @__PURE__ */ r(u, { icon: n(e.value) }),
76
+ label: (annotation.analytic ?? annotation.author) + (annotation.quantity > 1 ? ` (x${annotation.quantity})` : ""),
77
+ icon: /* @__PURE__ */ jsx(Icon, { icon: icon(annotation.value) }),
70
78
  color: {
71
79
  benign: "success",
72
80
  suspicious: "warning",
73
81
  obscure: "error",
74
82
  malicious: "error"
75
- }[e.value]
83
+ }[annotation.value]
76
84
  }
77
- ) }, (e.analytic ?? e.author) + e.value))
85
+ ) }, (annotation.analytic ?? annotation.author) + annotation.value))
78
86
  }
79
87
  )
80
88
  ] }),
81
- [n, s, o, i]
89
+ [icon, opinionAnnotations, sortedOpinions, theme]
82
90
  );
83
- return (s == null ? void 0 : s.length) < 1 ? null : /* @__PURE__ */ r(
91
+ if ((opinionAnnotations == null ? void 0 : opinionAnnotations.length) < 1) {
92
+ return null;
93
+ }
94
+ return /* @__PURE__ */ jsx(
84
95
  "span",
85
96
  {
86
- ref: g,
97
+ ref: anchorRef,
87
98
  style: { display: "flex" },
88
- onMouseOver: c ? void 0 : () => w("assessment", g.current, l, { content: z }),
89
- onMouseLeave: c ? void 0 : () => h("assessment", l),
90
- children: /* @__PURE__ */ r(k, { disabled: !C, count: o[0][1], children: /* @__PURE__ */ r(
91
- u,
99
+ onMouseOver: disableTooltip ? void 0 : () => showInfo("assessment", anchorRef.current, value, { content: tooltipContent }),
100
+ onMouseLeave: disableTooltip ? void 0 : () => closeInfo("assessment", value),
101
+ children: /* @__PURE__ */ jsx(CountBadge, { disabled: !counters, count: sortedOpinions[0][1], children: /* @__PURE__ */ jsx(
102
+ Icon,
92
103
  {
93
104
  fontSize: "1.25em",
94
- ...f,
95
- icon: n(o[0][0]),
105
+ ...otherProps,
106
+ icon: icon(sortedOpinions[0][0]),
96
107
  color: {
97
- benign: i.palette.success.light,
98
- suspicious: i.palette.warning.light,
99
- obscure: i.palette.error.light,
100
- malicious: i.palette.error.light
101
- }[o[0][0]],
108
+ benign: theme.palette.success.light,
109
+ suspicious: theme.palette.warning.light,
110
+ obscure: theme.palette.error.light,
111
+ malicious: theme.palette.error.light
112
+ }[sortedOpinions[0][0]],
102
113
  style: {
103
114
  zIndex: 2,
104
- ...f.style ?? {}
115
+ ...otherProps.style ?? {}
105
116
  }
106
117
  }
107
118
  ) })
108
119
  }
109
120
  );
110
- }, Y = R(G);
121
+ };
122
+ const OpinionIcon$1 = memo(OpinionIcon);
111
123
  export {
112
- Y as default
124
+ OpinionIcon$1 as default
113
125
  };
package/icons/iconMap.js CHANGED
@@ -1,4 +1,4 @@
1
- const o = {
1
+ const ICON_MAP = {
2
2
  context: "material-symbols:contextual-token",
3
3
  opinion: "material-symbols:how-to-vote-rounded",
4
4
  mitigation: "material-symbols:shield-locked-rounded",
@@ -6,5 +6,5 @@ const o = {
6
6
  assessment: "material-symbols:menu-book"
7
7
  };
8
8
  export {
9
- o as ICON_MAP
9
+ ICON_MAP
10
10
  };
@@ -0,0 +1,6 @@
1
+ function identity(value) {
2
+ return value;
3
+ }
4
+ export {
5
+ identity as i
6
+ };