@cccsaurora/clue-ui 1.3.0-dev.404 → 1.3.0

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 (224) hide show
  1. package/ActionForm-CHOSKfvu.js +4403 -0
  2. package/AnnotationDetails-Bqq6Ymmg.js +160 -0
  3. package/AnnotationPreview-CqXmC-j8.js +140 -0
  4. package/ClueEnrichContext-DL6aGe1k.js +432 -0
  5. package/FlexOne-BXWFOd1T.js +6 -0
  6. package/_MapCache-DRK-s2eK.js +179 -0
  7. package/_Set-DrS_bbSV.js +6 -0
  8. package/_Uint8Array-D9R2N9Lp.js +98 -0
  9. package/_arrayIncludes-Dcl_29E6.js +25 -0
  10. package/_arrayPush-DBJIuK2V.js +8 -0
  11. package/_baseAssignValue-Bx1cxHj5.js +12 -0
  12. package/_baseClone-DRhywkxm.js +211 -0
  13. package/_baseExtremum-DodEaEyF.js +16 -0
  14. package/_baseFlatten-CD9NgrYE.js +72 -0
  15. package/_baseGet-bVwDaGrA.js +80 -0
  16. package/_baseGetTag-CxDaTem-.js +25 -0
  17. package/_baseIsEqual-C-FKsm1J.js +150 -0
  18. package/_baseIteratee-D0FhC5bC.js +95 -0
  19. package/_baseRest-D_eW2E0d.js +8 -0
  20. package/_baseSlice-M5RKzt1A.js +10 -0
  21. package/_baseSum-wEbgNeUs.js +10 -0
  22. package/_baseUniq-D3N8igOm.js +41 -0
  23. package/_cacheHas-Wgl-hw34.js +22 -0
  24. package/_commonjsHelpers-C6fGbg64.js +6 -0
  25. package/_createAggregator-BVj8IAuF.js +53 -0
  26. package/_defineProperty-BZU4WKA3.js +11 -0
  27. package/_getPrototype-BGBCg-aX.js +5 -0
  28. package/_getTag-B7R9qBo7.js +73 -0
  29. package/_isIterateeCall-Dm0VTAYy.js +13 -0
  30. package/_setToArray-Ck4YZu0Z.js +9 -0
  31. package/cloneDeep-fV59zwUf.js +8 -0
  32. package/components/AnnotationBody.js +35 -49
  33. package/components/AnnotationDetailPopover.js +30 -36
  34. package/components/AnnotationDetails.js +7 -7
  35. package/components/AnnotationEntry.js +35 -35
  36. package/components/AnnotationPreview.js +5 -5
  37. package/components/ClassificationChip.js +23 -44
  38. package/components/CountBadge.js +26 -31
  39. package/components/EnrichedCard.js +97 -110
  40. package/components/EnrichedChip.js +105 -130
  41. package/components/EnrichedTypography.js +107 -133
  42. package/components/ErrorBoundary.js +24 -28
  43. package/components/RetryFailedEnrichments.js +9 -10
  44. package/components/SourcePicker.js +49 -57
  45. package/components/actions/ActionForm.js +4 -4
  46. package/components/actions/ExecutePopover.js +59 -75
  47. package/components/actions/ResultModal.js +4 -4
  48. package/components/actions/form/schemaAdapter.js +23 -39
  49. package/components/actions/formats/FileResult.js +59 -86
  50. package/components/actions/formats/index.js +25 -29
  51. package/components/display/graph/ExpandMoreButton.js +10 -10
  52. package/components/display/graph/elements/NodeCard.js +91 -111
  53. package/components/display/graph/elements/NodeTag.js +13 -15
  54. package/components/display/graph/index.js +202 -261
  55. package/components/display/graph/visualizations/Leaf.js +70 -89
  56. package/components/display/graph/visualizations/cloud/index.js +81 -98
  57. package/components/display/graph/visualizations/icons/BaseIcon.js +21 -26
  58. package/components/display/graph/visualizations/icons/BugIcon.js +12 -12
  59. package/components/display/graph/visualizations/icons/HostIcon.js +12 -12
  60. package/components/display/graph/visualizations/icons/NetworkIcon.js +12 -12
  61. package/components/display/graph/visualizations/icons/ProcessIcon.js +12 -12
  62. package/components/display/graph/visualizations/icons/TargetIcon.js +13 -13
  63. package/components/display/graph/visualizations/icons/index.js +13 -14
  64. package/components/display/graph/visualizations/panels/NodePanel.js +8 -10
  65. package/components/display/graph/visualizations/tree/BundleLine.js +81 -108
  66. package/components/display/graph/visualizations/tree/Triangle.js +13 -13
  67. package/components/display/graph/visualizations/tree/index.js +306 -408
  68. package/components/display/icons/Iconified.js +12 -27
  69. package/components/display/json/index.js +4 -4
  70. package/components/display/markdown/index.js +5770 -8678
  71. package/components/enrichment/EnrichPopover.js +46 -54
  72. package/components/fetchers/Fetcher.js +123 -166
  73. package/components/fetchers/FetcherResultView.js +27 -31
  74. package/components/fetchers/PreviewModal.js +16 -17
  75. package/components/fetchers/StatusChip.js +17 -21
  76. package/components/group/Entry.js +11 -13
  77. package/components/group/Group.js +10 -13
  78. package/components/group/GroupControl.js +65 -76
  79. package/components/stats/QueryStatus.js +32 -45
  80. package/countBy-B3rNuG4T.js +8 -0
  81. package/data/event.js +4 -6
  82. package/database/globals.js +2 -2
  83. package/database/index.js +3 -3
  84. package/database/replication.js +4 -4
  85. package/get-Bil3mzRD.js +8 -0
  86. package/groupBy-CrJC7sGa.js +8 -0
  87. package/hooks/ClueActionContext.js +6 -6
  88. package/hooks/ClueComponentContext.js +23 -29
  89. package/hooks/ClueConfigProvider.js +12 -14
  90. package/hooks/ClueDatabaseContext.js +23 -35
  91. package/hooks/ClueEnrichContext.js +11 -11
  92. package/hooks/ClueFetcherContext.js +56 -83
  93. package/hooks/ClueGroupContext.js +14 -17
  94. package/hooks/CluePopupContext.js +5 -5
  95. package/hooks/ClueProvider.js +11 -13
  96. package/hooks/ClueUIPluginContext.js +35 -49
  97. package/hooks/selectors.js +7 -7
  98. package/hooks/useActionResult.js +3 -3
  99. package/hooks/useAnnotations.js +32 -48
  100. package/hooks/useClue.js +4 -6
  101. package/hooks/useClueActions.js +3 -3
  102. package/hooks/useClueConfig.js +4 -6
  103. package/hooks/useClueTypeConfig.js +24 -49
  104. package/hooks/useClueUIPlugins.js +7 -8
  105. package/hooks/useComparator.js +435 -722
  106. package/hooks/useErrors.js +18 -22
  107. package/hooks/useFetcherResult.js +24 -33
  108. package/hooks/useMyHighlights.js +36 -66
  109. package/hooks/useMyLocalStorage.js +37 -66
  110. package/iconify-Ptb5dTKy.js +1270 -0
  111. package/icons/Action.js +49 -66
  112. package/icons/Assessment.js +69 -85
  113. package/icons/Context.js +63 -77
  114. package/icons/Opinion.js +60 -76
  115. package/icons/iconMap.js +2 -2
  116. package/identity-ByMq8VxU.js +6 -0
  117. package/index-BH-gBhtO.js +2282 -0
  118. package/index-BM9Sve5T.js +571 -0
  119. package/index-Cj4d5cGz.js +357 -0
  120. package/index-Dh2PP9h8.js +11747 -0
  121. package/index-DoFpWPHo.js +975 -0
  122. package/index-DzVIklWY.js +6464 -0
  123. package/isArguments-BWcXOE6a.js +24 -0
  124. package/isArray-WzO_os3q.js +4 -0
  125. package/isEmpty-DKxrY-_M.js +22 -0
  126. package/isNil-CjWwlQS3.js +6 -0
  127. package/isObject-B53jY8Qg.js +7 -0
  128. package/isObjectLike-CYbdrIBr.js +6 -0
  129. package/isSymbol-DE1Kcy2M.js +9 -0
  130. package/last-7CdUxN0r.js +7 -0
  131. package/main.js +62 -62
  132. package/maxBy-BOWDkL_D.js +8 -0
  133. package/package.json +1 -1
  134. package/plugins/ClueUIPlugin.js +96 -163
  135. package/plugins/file/index.js +15 -15
  136. package/plugins/graph/index.js +26 -29
  137. package/plugins/image/index.js +24 -28
  138. package/plugins/json/index.js +21 -21
  139. package/plugins/markdown/index.js +18 -18
  140. package/plugins/registry.js +6 -6
  141. package/plugins/store.js +4 -4
  142. package/plugins/test/index.js +17 -17
  143. package/plugins/utils.js +12 -13
  144. package/replication-WkKbPdwG.js +8453 -0
  145. package/sessionStorage-DFMae61b.js +90 -0
  146. package/sortBy-BHe812lF.js +74 -0
  147. package/store-DClHBq7r.js +1169 -0
  148. package/sumBy-B7f_bP_k.js +8 -0
  149. package/text/Frequency.js +23 -42
  150. package/toFinite-CBrE65MP.js +14 -0
  151. package/toNumber-CxmWey0f.js +31 -0
  152. package/uniq-B4UZ671_.js +7 -0
  153. package/utils/chain.js +65 -92
  154. package/utils/classificationParser.js +256 -519
  155. package/utils/constants.js +11 -37
  156. package/utils/graph.js +45 -72
  157. package/utils/hashUtil.js +7 -7
  158. package/utils/line.js +81 -131
  159. package/utils/loggerUtil.js +3 -5
  160. package/utils/sessionStorage.js +7 -7
  161. package/utils/time.js +427 -447
  162. package/utils/utils.js +10 -10
  163. package/utils/window.js +10 -21
  164. package/utils-SpTOhPYl.js +147 -0
  165. package/ActionForm-CqKcnDWC.js +0 -6099
  166. package/AnnotationDetails-BlPd3T8k.js +0 -176
  167. package/AnnotationPreview-Bl447SKT.js +0 -188
  168. package/ClueEnrichContext-B3YrTCaJ.js +0 -567
  169. package/FlexOne-BSYAhhtG.js +0 -9
  170. package/_MapCache-kuEY_iOH.js +0 -220
  171. package/_Set-BrSMTlHn.js +0 -6
  172. package/_Uint8Array-OPpgYQj7.js +0 -123
  173. package/_arrayIncludes-BNqL-9ZP.js +0 -31
  174. package/_arrayPush-CBkQqaE_.js +0 -10
  175. package/_baseAssignValue-CNUVPOBW.js +0 -16
  176. package/_baseClone-9FaRd1R2.js +0 -287
  177. package/_baseExtremum-wOGT4Dgw.js +0 -18
  178. package/_baseFlatten-Co6QHDlG.js +0 -92
  179. package/_baseGet-Cmp6FztG.js +0 -109
  180. package/_baseGetTag-Hj-0NTYF.js +0 -44
  181. package/_baseIsEqual-1CpU47TZ.js +0 -211
  182. package/_baseIteratee-BN7Vbe5g.js +0 -126
  183. package/_baseRest-BZ_hQ9PC.js +0 -8
  184. package/_baseSlice-GAv_YFTT.js +0 -20
  185. package/_baseSum-D0WC1dN0.js +0 -13
  186. package/_baseUniq-BnvS3JHL.js +0 -63
  187. package/_cacheHas-_aF2y2Xv.js +0 -25
  188. package/_commonjsHelpers-CUmg6egw.js +0 -6
  189. package/_createAggregator-BUZrP_is.js +0 -63
  190. package/_defineProperty-DolZLKmv.js +0 -12
  191. package/_getPrototype-Bb4gm-5m.js +0 -5
  192. package/_getTag-CML_cXiN.js +0 -105
  193. package/_isIterateeCall-B1IFEqVv.js +0 -17
  194. package/_setToArray-CqyqC8ib.js +0 -10
  195. package/cloneDeep-l3UkXG5M.js +0 -8
  196. package/countBy-Bqcp3VCs.js +0 -14
  197. package/get-CdMThM8x.js +0 -8
  198. package/groupBy-BVV07EGQ.js +0 -14
  199. package/iconify-DJxl6dC-.js +0 -1789
  200. package/identity-CPGTqrE4.js +0 -6
  201. package/index-CAvu7vwt.js +0 -1172
  202. package/index-CVUD9o3t.js +0 -15768
  203. package/index-DUEubgWN.js +0 -464
  204. package/index-Dj1N4IQP.js +0 -9314
  205. package/index-DpJxD74E.js +0 -3272
  206. package/index-_gpzM2Px.js +0 -702
  207. package/isArguments-CuYlEuhP.js +0 -27
  208. package/isArray-RJPfgWqI.js +0 -4
  209. package/isEmpty-BE656RUK.js +0 -30
  210. package/isNil-CIubwp4T.js +0 -6
  211. package/isObject-FTY-5JQX.js +0 -7
  212. package/isObjectLike-CeENW9FN.js +0 -6
  213. package/isSymbol-D_H4HPZQ.js +0 -9
  214. package/last-CUCl67Im.js +0 -7
  215. package/maxBy-BjjQmX5t.js +0 -8
  216. package/replication--gLEZw8a.js +0 -11777
  217. package/sessionStorage-B68y-wnE.js +0 -140
  218. package/sortBy-B8JVsLQY.js +0 -95
  219. package/store-B9sjQbcS.js +0 -2163
  220. package/sumBy-D-HCzM2i.js +0 -8
  221. package/toFinite-meZTg4Su.js +0 -16
  222. package/toNumber-B5JaA1vX.js +0 -39
  223. package/uniq-CahZPAwp.js +0 -7
  224. package/utils-CEySTPtg.js +0 -224
package/icons/Action.js CHANGED
@@ -1,90 +1,73 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { I as Icon } from "../iconify-DJxl6dC-.js";
3
- import { useTheme, Stack, Divider, Typography } from "@mui/material";
4
- import CountBadge from "../components/CountBadge.js";
5
- import { C as CluePopupContext } from "../AnnotationPreview-Bl447SKT.js";
6
- import { b as useClueActions } from "../ActionForm-CqKcnDWC.js";
7
- import { g as groupBy } from "../groupBy-BVV07EGQ.js";
8
- import { memo, useRef, useMemo, useEffect } from "react";
9
- import { a as useContextSelector } from "../index-_gpzM2Px.js";
10
- const ResultDetails = ({ result }) => {
11
- return /* @__PURE__ */ jsxs(Stack, { p: 1, children: [
12
- /* @__PURE__ */ jsx(Typography, { variant: "body1", children: result.action.name }),
13
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: result.summary })
14
- ] });
15
- };
16
- const ActionIcon = ({ value, counters = true, disableTooltip = false, ...otherProps }) => {
17
- const theme = useTheme();
18
- const showInfo = useContextSelector(CluePopupContext, (state) => state.showInfo);
19
- const closeInfo = useContextSelector(CluePopupContext, (state) => state.closeInfo);
20
- const successAnchorRef = useRef();
21
- const failureAnchorRef = useRef();
22
- const { getActionResults } = useClueActions();
23
- const actionResults = useMemo(
24
- () => getActionResults(value.type, value.value, value.classification),
25
- [getActionResults, value.classification, value.type, value.value]
1
+ import { jsx as e, jsxs as z } from "react/jsx-runtime";
2
+ import { I } from "../iconify-Ptb5dTKy.js";
3
+ import { useTheme as b, Stack as i, Divider as l, Typography as C } from "@mui/material";
4
+ import R from "../components/CountBadge.js";
5
+ import { C as v } from "../AnnotationPreview-CqXmC-j8.js";
6
+ import { b as j } from "../ActionForm-CHOSKfvu.js";
7
+ import { g as B } from "../groupBy-CrJC7sGa.js";
8
+ import { memo as D, useRef as A, useMemo as s, useEffect as L } from "react";
9
+ import { a as M } from "../index-BM9Sve5T.js";
10
+ const k = ({ result: o }) => /* @__PURE__ */ z(i, { p: 1, children: [
11
+ /* @__PURE__ */ e(C, { variant: "body1", children: o.action.name }),
12
+ /* @__PURE__ */ e(C, { variant: "caption", color: "text.secondary", children: o.summary })
13
+ ] }), O = ({ value: o, counters: f = !0, disableTooltip: c = !1, ...d }) => {
14
+ const p = b(), h = M(v, (t) => t.showInfo), a = M(v, (t) => t.closeInfo), y = A(), g = A(), { getActionResults: x } = j(), n = s(
15
+ () => x(o.type, o.value, o.classification),
16
+ [x, o.classification, o.type, o.value]
26
17
  );
27
- useEffect(() => {
28
- if (disableTooltip) {
29
- closeInfo("context", value);
30
- }
31
- }, [disableTooltip]);
32
- const [successes, failures] = useMemo(() => {
33
- const outcomes = groupBy(actionResults, (result) => result.outcome);
34
- return [outcomes.success ?? [], outcomes.failure ?? []];
35
- }, [actionResults]);
36
- const successContent = useMemo(() => {
37
- const entries = successes.map((result) => /* @__PURE__ */ jsx(ResultDetails, { result }, result.actionId));
38
- return /* @__PURE__ */ jsx(Stack, { spacing: 1, divider: /* @__PURE__ */ jsx(Divider, { flexItem: true, orientation: "horizontal" }), children: entries });
39
- }, [successes]);
40
- const failureContent = useMemo(() => {
41
- const entries = failures.map((result) => /* @__PURE__ */ jsx(ResultDetails, { result }, result.summary));
42
- return /* @__PURE__ */ jsx(Stack, { spacing: 1, divider: /* @__PURE__ */ jsx(Divider, { flexItem: true, orientation: "horizontal" }), children: entries });
43
- }, [failures]);
44
- if ((actionResults == null ? void 0 : actionResults.length) < 1) {
45
- return null;
46
- }
47
- return /* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 1, children: [
48
- /* @__PURE__ */ jsx(Divider, { flexItem: true, orientation: "vertical" }),
49
- successes.length > 0 && /* @__PURE__ */ jsx(
18
+ L(() => {
19
+ c && a("context", o);
20
+ }, [c]);
21
+ const [m, u] = s(() => {
22
+ const t = B(n, (r) => r.outcome);
23
+ return [t.success ?? [], t.failure ?? []];
24
+ }, [n]), S = s(() => {
25
+ const t = m.map((r) => /* @__PURE__ */ e(k, { result: r }, r.actionId));
26
+ return /* @__PURE__ */ e(i, { spacing: 1, divider: /* @__PURE__ */ e(l, { flexItem: !0, orientation: "horizontal" }), children: t });
27
+ }, [m]), w = s(() => {
28
+ const t = u.map((r) => /* @__PURE__ */ e(k, { result: r }, r.summary));
29
+ return /* @__PURE__ */ e(i, { spacing: 1, divider: /* @__PURE__ */ e(l, { flexItem: !0, orientation: "horizontal" }), children: t });
30
+ }, [u]);
31
+ return (n == null ? void 0 : n.length) < 1 ? null : /* @__PURE__ */ z(i, { direction: "row", spacing: 1, children: [
32
+ /* @__PURE__ */ e(l, { flexItem: !0, orientation: "vertical" }),
33
+ m.length > 0 && /* @__PURE__ */ e(
50
34
  "span",
51
35
  {
52
- ref: successAnchorRef,
36
+ ref: y,
53
37
  style: { display: "flex" },
54
- onMouseOver: disableTooltip ? void 0 : () => showInfo("actionResults", successAnchorRef.current, value, { content: successContent }),
55
- onMouseLeave: disableTooltip ? void 0 : () => closeInfo("actionResults", value),
56
- children: /* @__PURE__ */ jsx(CountBadge, { disabled: !counters, count: actionResults.filter((result) => result.outcome === "success").length, children: /* @__PURE__ */ jsx(
57
- Icon,
38
+ onMouseOver: c ? void 0 : () => h("actionResults", y.current, o, { content: S }),
39
+ onMouseLeave: c ? void 0 : () => a("actionResults", o),
40
+ children: /* @__PURE__ */ e(R, { disabled: !f, count: n.filter((t) => t.outcome === "success").length, children: /* @__PURE__ */ e(
41
+ I,
58
42
  {
59
43
  icon: "material-symbols:bookmark-check-rounded",
60
- color: theme.palette.success.main,
44
+ color: p.palette.success.main,
61
45
  fontSize: "1.5em",
62
- ...otherProps
46
+ ...d
63
47
  }
64
48
  ) })
65
49
  }
66
50
  ),
67
- failures.length > 0 && /* @__PURE__ */ jsx(
51
+ u.length > 0 && /* @__PURE__ */ e(
68
52
  "span",
69
53
  {
70
- ref: failureAnchorRef,
54
+ ref: g,
71
55
  style: { display: "flex" },
72
- onMouseOver: disableTooltip ? void 0 : () => showInfo("actionResults", failureAnchorRef.current, value, { content: failureContent }),
73
- onMouseLeave: disableTooltip ? void 0 : () => closeInfo("actionResults", value),
74
- children: /* @__PURE__ */ jsx(CountBadge, { disabled: !counters, count: actionResults.filter((result) => result.outcome === "failure").length, children: /* @__PURE__ */ jsx(
75
- Icon,
56
+ onMouseOver: c ? void 0 : () => h("actionResults", g.current, o, { content: w }),
57
+ onMouseLeave: c ? void 0 : () => a("actionResults", o),
58
+ children: /* @__PURE__ */ e(R, { disabled: !f, count: n.filter((t) => t.outcome === "failure").length, children: /* @__PURE__ */ e(
59
+ I,
76
60
  {
77
61
  icon: "material-symbols:cancel-presentation-rounded",
78
- color: theme.palette.error.main,
62
+ color: p.palette.error.main,
79
63
  fontSize: "1.5em",
80
- ...otherProps
64
+ ...d
81
65
  }
82
66
  ) })
83
67
  }
84
68
  )
85
69
  ] });
86
- };
87
- const ActionIcon$1 = memo(ActionIcon);
70
+ }, P = D(O);
88
71
  export {
89
- ActionIcon$1 as default
72
+ P as default
90
73
  };
@@ -1,124 +1,108 @@
1
- import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
- import { I as Icon } from "../iconify-DJxl6dC-.js";
3
- import { useTheme, Stack, Chip, Divider, Grid, Tooltip } from "@mui/material";
4
- import CountBadge from "../components/CountBadge.js";
5
- import { C as CluePopupContext } from "../AnnotationPreview-Bl447SKT.js";
6
- import { g as groupBy } from "../groupBy-BVV07EGQ.js";
7
- import { l as last } from "../last-CUCl67Im.js";
8
- import { m as maxBy } from "../maxBy-BjjQmX5t.js";
9
- import { s as sortBy } from "../sortBy-B8JVsLQY.js";
10
- import { s as sumBy } from "../sumBy-D-HCzM2i.js";
11
- import { memo, useRef, useState, useMemo, useEffect } from "react";
12
- import { a as useContextSelector } from "../index-_gpzM2Px.js";
13
- const AssessmentIcon = ({ annotations, value, counters = true, disableTooltip = false, ubiquitous = false, ...otherProps }) => {
14
- const theme = useTheme();
15
- const showInfo = useContextSelector(CluePopupContext, (state) => state.showInfo);
16
- const closeInfo = useContextSelector(CluePopupContext, (state) => state.closeInfo);
17
- const anchorRef = useRef();
18
- const [showTooltip, setShowTooltip] = useState(false);
19
- const assessmentAnnotations = useMemo(
20
- () => annotations.filter((annotation) => (annotation == null ? void 0 : annotation.type) === "assessment" && (annotation == null ? void 0 : annotation.ubiquitous) === ubiquitous),
21
- [annotations, ubiquitous]
22
- );
23
- const sortedAssessments = useMemo(
24
- () => Object.entries(groupBy(assessmentAnnotations, "value")).map(([_value, _annotations]) => [
25
- _value,
26
- sumBy(_annotations, "quantity")
1
+ import { jsxs as b, Fragment as k, jsx as s } from "react/jsx-runtime";
2
+ import { I as l } from "../iconify-Ptb5dTKy.js";
3
+ import { useTheme as j, Stack as y, Chip as I, Divider as q, Grid as C, Tooltip as A } from "@mui/material";
4
+ import z from "../components/CountBadge.js";
5
+ import { C as w } from "../AnnotationPreview-CqXmC-j8.js";
6
+ import { g as O } from "../groupBy-CrJC7sGa.js";
7
+ import { l as P } from "../last-7CdUxN0r.js";
8
+ import { m as L } from "../maxBy-BOWDkL_D.js";
9
+ import { s as R } from "../sortBy-BHe812lF.js";
10
+ import { s as W } from "../sumBy-B7f_bP_k.js";
11
+ import { memo as D, useRef as E, useState as F, useMemo as d, useEffect as G } from "react";
12
+ import { a as S } from "../index-BM9Sve5T.js";
13
+ const H = ({ annotations: u, value: i, counters: f = !0, disableTooltip: r = !1, ubiquitous: h = !1, ...v }) => {
14
+ const t = j(), g = S(w, (e) => e.showInfo), x = S(w, (e) => e.closeInfo), c = E(), [$, B] = F(!1), o = d(
15
+ () => u.filter((e) => (e == null ? void 0 : e.type) === "assessment" && (e == null ? void 0 : e.ubiquitous) === h),
16
+ [u, h]
17
+ ), m = d(
18
+ () => Object.entries(O(o, "value")).map(([e, p]) => [
19
+ e,
20
+ W(p, "quantity")
27
21
  ]),
28
- [assessmentAnnotations]
29
- );
30
- const popularAssessment = useMemo(() => maxBy(sortedAssessments, last), [sortedAssessments]);
31
- useEffect(() => {
32
- if (disableTooltip) {
33
- setShowTooltip(false);
34
- }
35
- }, [disableTooltip]);
36
- if ((assessmentAnnotations == null ? void 0 : assessmentAnnotations.length) < 1) {
22
+ [o]
23
+ ), n = d(() => L(m, P), [m]);
24
+ if (G(() => {
25
+ r && B(!1);
26
+ }, [r]), (o == null ? void 0 : o.length) < 1)
37
27
  return null;
38
- }
39
- const tooltipProps = {
28
+ const M = {
40
29
  tooltip: {
41
30
  sx: {
42
31
  maxWidth: "500px",
43
- backgroundColor: theme.palette.background.paper,
44
- border: `thin solid ${theme.palette.divider}`,
32
+ backgroundColor: t.palette.background.paper,
33
+ border: `thin solid ${t.palette.divider}`,
45
34
  p: 1,
46
- boxShadow: theme.shadows[2]
35
+ boxShadow: t.shadows[2]
47
36
  }
48
37
  }
49
- };
50
- const tooltipContent = /* @__PURE__ */ jsxs(Stack, { spacing: 1, onClick: (e) => e.stopPropagation(), children: [
51
- assessmentAnnotations.length > 1 && /* @__PURE__ */ jsxs(Fragment, { children: [
52
- /* @__PURE__ */ jsx(Stack, { direction: "row", children: sortedAssessments.map(([type, count]) => /* @__PURE__ */ jsx(
53
- Chip,
38
+ }, a = /* @__PURE__ */ b(y, { spacing: 1, onClick: (e) => e.stopPropagation(), children: [
39
+ o.length > 1 && /* @__PURE__ */ b(k, { children: [
40
+ /* @__PURE__ */ s(y, { direction: "row", children: m.map(([e, p]) => /* @__PURE__ */ s(
41
+ I,
54
42
  {
55
43
  size: "small",
56
44
  variant: "outlined",
57
- label: `${type}: ${count}`,
58
- icon: /* @__PURE__ */ jsx(
59
- Icon,
45
+ label: `${e}: ${p}`,
46
+ icon: /* @__PURE__ */ s(
47
+ l,
60
48
  {
61
- icon: ["trivial", "recon", "attempt", "compromise", "mitigated"].includes(type) ? "healthicons:hazardous" : "fluent-mdl2:ribbon-solid"
49
+ icon: ["trivial", "recon", "attempt", "compromise", "mitigated"].includes(e) ? "healthicons:hazardous" : "fluent-mdl2:ribbon-solid"
62
50
  }
63
51
  ),
64
- color: ["trivial", "recon", "attempt", "compromise", "mitigated"].includes(type) ? "error" : "success"
52
+ color: ["trivial", "recon", "attempt", "compromise", "mitigated"].includes(e) ? "error" : "success"
65
53
  },
66
- type
54
+ e
67
55
  )) }),
68
- /* @__PURE__ */ jsx(Divider, { orientation: "horizontal", flexItem: true })
56
+ /* @__PURE__ */ s(q, { orientation: "horizontal", flexItem: !0 })
69
57
  ] }),
70
- /* @__PURE__ */ jsx(
71
- Grid,
58
+ /* @__PURE__ */ s(
59
+ C,
72
60
  {
73
61
  sx: {
74
- mt: assessmentAnnotations.length < 2 && `${theme.spacing(-0.5)} !important`,
75
- ml: `${theme.spacing(-0.5)} !important`
62
+ mt: o.length < 2 && `${t.spacing(-0.5)} !important`,
63
+ ml: `${t.spacing(-0.5)} !important`
76
64
  },
77
- container: true,
65
+ container: !0,
78
66
  spacing: 0.5,
79
67
  maxWidth: "500px",
80
- children: sortBy(assessmentAnnotations, "value").map((annotation) => /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(
81
- Chip,
68
+ children: R(o, "value").map((e) => /* @__PURE__ */ s(C, { item: !0, children: /* @__PURE__ */ s(
69
+ I,
82
70
  {
83
71
  size: "small",
84
72
  variant: "outlined",
85
- label: annotation.analytic + (annotation.quantity > 1 ? ` (x${annotation.quantity})` : ""),
86
- icon: /* @__PURE__ */ jsx(
87
- Icon,
73
+ label: e.analytic + (e.quantity > 1 ? ` (x${e.quantity})` : ""),
74
+ icon: /* @__PURE__ */ s(
75
+ l,
88
76
  {
89
- icon: ["trivial", "recon", "attempt", "compromise", "mitigated"].includes(annotation.value) ? "healthicons:hazardous" : "fluent-mdl2:ribbon-solid"
77
+ icon: ["trivial", "recon", "attempt", "compromise", "mitigated"].includes(e.value) ? "healthicons:hazardous" : "fluent-mdl2:ribbon-solid"
90
78
  }
91
79
  ),
92
- color: ["trivial", "recon", "attempt", "compromise", "mitigated"].includes(annotation.value) ? "error" : "success"
80
+ color: ["trivial", "recon", "attempt", "compromise", "mitigated"].includes(e.value) ? "error" : "success"
93
81
  }
94
- ) }, annotation.analytic + annotation.value))
82
+ ) }, e.analytic + e.value))
95
83
  }
96
84
  )
97
85
  ] });
98
- if (["trivial", "recon", "attempt", "compromise", "mitigated"].includes(popularAssessment[0])) {
99
- return /* @__PURE__ */ jsx(
100
- "span",
101
- {
102
- ref: anchorRef,
103
- style: { display: "flex" },
104
- onMouseOver: disableTooltip ? void 0 : () => showInfo("assessment", anchorRef.current, value, { content: tooltipContent }),
105
- onMouseLeave: disableTooltip ? void 0 : () => closeInfo("assessment", value),
106
- children: /* @__PURE__ */ jsx(CountBadge, { disabled: !counters, color: "error", count: popularAssessment[1], children: /* @__PURE__ */ jsx(Icon, { fontSize: "1.5em", ...otherProps, icon: "healthicons:hazardous", color: theme.palette.error.main }) })
107
- }
108
- );
109
- }
110
- return /* @__PURE__ */ jsx(
86
+ return ["trivial", "recon", "attempt", "compromise", "mitigated"].includes(n[0]) ? /* @__PURE__ */ s(
111
87
  "span",
112
88
  {
113
- ref: anchorRef,
89
+ ref: c,
114
90
  style: { display: "flex" },
115
- onMouseOver: disableTooltip ? void 0 : () => showInfo("assessment", anchorRef.current, value, { content: tooltipContent }),
116
- onMouseLeave: disableTooltip ? void 0 : () => closeInfo("assessment", value),
117
- children: /* @__PURE__ */ jsx(Tooltip, { disableInteractive: true, componentsProps: tooltipProps, open: showTooltip, title: tooltipContent, children: /* @__PURE__ */ jsx(CountBadge, { disabled: !counters, count: popularAssessment[1], children: /* @__PURE__ */ jsx(Icon, { fontSize: "1.5em", ...otherProps, icon: "fluent-mdl2:ribbon-solid", color: theme.palette.success.main }) }) })
91
+ onMouseOver: r ? void 0 : () => g("assessment", c.current, i, { content: a }),
92
+ onMouseLeave: r ? void 0 : () => x("assessment", i),
93
+ children: /* @__PURE__ */ s(z, { disabled: !f, color: "error", count: n[1], children: /* @__PURE__ */ s(l, { fontSize: "1.5em", ...v, icon: "healthicons:hazardous", color: t.palette.error.main }) })
94
+ }
95
+ ) : /* @__PURE__ */ s(
96
+ "span",
97
+ {
98
+ ref: c,
99
+ style: { display: "flex" },
100
+ onMouseOver: r ? void 0 : () => g("assessment", c.current, i, { content: a }),
101
+ onMouseLeave: r ? void 0 : () => x("assessment", i),
102
+ children: /* @__PURE__ */ s(A, { disableInteractive: !0, componentsProps: M, open: $, title: a, children: /* @__PURE__ */ s(z, { disabled: !f, count: n[1], children: /* @__PURE__ */ s(l, { fontSize: "1.5em", ...v, icon: "fluent-mdl2:ribbon-solid", color: t.palette.success.main }) }) })
118
103
  }
119
104
  );
120
- };
121
- const AssessmentIcon$1 = memo(AssessmentIcon);
105
+ }, se = D(H);
122
106
  export {
123
- AssessmentIcon$1 as default
107
+ se as default
124
108
  };
package/icons/Context.js CHANGED
@@ -1,86 +1,72 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { I as Icon } from "../iconify-DJxl6dC-.js";
3
- import { Stack, Divider } from "@mui/material";
4
- import AnnotationEntry from "../components/AnnotationEntry.js";
5
- import CountBadge from "../components/CountBadge.js";
6
- import Iconified from "../components/display/icons/Iconified.js";
7
- import { C as CluePopupContext } from "../AnnotationPreview-Bl447SKT.js";
8
- import { g as groupBy } from "../groupBy-BVV07EGQ.js";
9
- import { memo, useRef, useMemo, useEffect } from "react";
10
- import { a as useContextSelector } from "../index-_gpzM2Px.js";
11
- const ContextIcon = ({
12
- annotations,
13
- value,
14
- counters = true,
15
- disableTooltip = false,
16
- showExtraIcon = false,
17
- ubiquitous = false,
18
- ...otherProps
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { I as w } from "../iconify-Ptb5dTKy.js";
3
+ import { Stack as u, Divider as z } from "@mui/material";
4
+ import v from "../components/AnnotationEntry.js";
5
+ import E from "../components/CountBadge.js";
6
+ import M from "../components/display/icons/Iconified.js";
7
+ import { C as x } from "../AnnotationPreview-CqXmC-j8.js";
8
+ import { g as O } from "../groupBy-CrJC7sGa.js";
9
+ import { memo as j, useRef as k, useMemo as h, useEffect as B } from "react";
10
+ import { a as g } from "../index-BM9Sve5T.js";
11
+ const R = ({
12
+ annotations: l,
13
+ value: c,
14
+ counters: y = !0,
15
+ disableTooltip: n = !1,
16
+ showExtraIcon: I = !1,
17
+ ubiquitous: m = !1,
18
+ ...r
19
19
  }) => {
20
- const showInfo = useContextSelector(CluePopupContext, (state) => state.showInfo);
21
- const closeInfo = useContextSelector(CluePopupContext, (state) => state.closeInfo);
22
- const anchorRef = useRef();
23
- const contextAnnotations = useMemo(
24
- () => annotations.filter((annotation) => annotation.type === "context" && annotation.ubiquitous === ubiquitous),
25
- [annotations, ubiquitous]
20
+ const C = g(x, (e) => e.showInfo), p = g(x, (e) => e.closeInfo), a = k(), t = h(
21
+ () => l.filter((e) => e.type === "context" && e.ubiquitous === m),
22
+ [l, m]
23
+ ), s = h(
24
+ () => t.filter((e) => e.icon || e.analytic_icon),
25
+ [t]
26
26
  );
27
- const additionalIcons = useMemo(
28
- () => contextAnnotations.filter((annotation) => annotation.icon || annotation.analytic_icon),
29
- [contextAnnotations]
30
- );
31
- useEffect(() => {
32
- if (disableTooltip) {
33
- closeInfo("context", value);
34
- }
35
- }, [disableTooltip]);
36
- if ((contextAnnotations == null ? void 0 : contextAnnotations.length) < 1) {
27
+ if (B(() => {
28
+ n && p("context", c);
29
+ }, [n]), (t == null ? void 0 : t.length) < 1)
37
30
  return null;
38
- }
39
- const icons = [];
40
- if (additionalIcons.length) {
41
- Object.entries(groupBy(additionalIcons, (annotation) => annotation.icon || annotation.analytic_icon)).forEach(
42
- ([icon, _annotations]) => icons.push(
43
- /* @__PURE__ */ jsx(
44
- "span",
45
- {
46
- ref: anchorRef,
47
- style: { display: "flex" },
48
- onMouseOver: disableTooltip ? void 0 : () => showInfo("context", anchorRef.current, value, {
49
- content: /* @__PURE__ */ jsx(
50
- Stack,
51
- {
52
- onClick: (e) => e.stopPropagation(),
53
- spacing: 1,
54
- divider: /* @__PURE__ */ jsx(Divider, { flexItem: true, orientation: "horizontal" }),
55
- children: _annotations.map((annotation) => /* @__PURE__ */ jsx(AnnotationEntry, { annotation }, JSON.stringify(annotation)))
56
- }
57
- )
58
- }),
59
- onMouseLeave: disableTooltip ? void 0 : () => closeInfo("context", value),
60
- children: /* @__PURE__ */ jsx(
61
- Icon,
31
+ const f = [];
32
+ s.length && Object.entries(O(s, (e) => e.icon || e.analytic_icon)).forEach(
33
+ ([e, S]) => f.push(
34
+ /* @__PURE__ */ o(
35
+ "span",
36
+ {
37
+ ref: a,
38
+ style: { display: "flex" },
39
+ onMouseOver: n ? void 0 : () => C("context", a.current, c, {
40
+ content: /* @__PURE__ */ o(
41
+ u,
62
42
  {
63
- icon,
64
- fontSize: otherProps.fontSize ?? "1.25em",
65
- style: { filter: "drop-shadow(0px 0px 1px rgb(0 0 0 / 0.4))", ...otherProps.style ?? {} },
66
- ...otherProps
43
+ onClick: (i) => i.stopPropagation(),
44
+ spacing: 1,
45
+ divider: /* @__PURE__ */ o(z, { flexItem: !0, orientation: "horizontal" }),
46
+ children: S.map((i) => /* @__PURE__ */ o(v, { annotation: i }, JSON.stringify(i)))
67
47
  }
68
48
  )
69
- },
70
- icon
71
- )
49
+ }),
50
+ onMouseLeave: n ? void 0 : () => p("context", c),
51
+ children: /* @__PURE__ */ o(
52
+ w,
53
+ {
54
+ icon: e,
55
+ fontSize: r.fontSize ?? "1.25em",
56
+ style: { filter: "drop-shadow(0px 0px 1px rgb(0 0 0 / 0.4))", ...r.style ?? {} },
57
+ ...r
58
+ }
59
+ )
60
+ },
61
+ e
72
62
  )
73
- );
74
- }
75
- const additionalSize = contextAnnotations.length - additionalIcons.length;
76
- if (additionalSize > 0 && showExtraIcon) {
77
- icons.push(
78
- /* @__PURE__ */ jsx(CountBadge, { disabled: !counters, count: additionalSize, children: /* @__PURE__ */ jsx(Iconified, { icon: "ic:baseline-newspaper", style: { zIndex: 2, ...otherProps.style ?? {} } }) }, "extra")
79
- );
80
- }
81
- return /* @__PURE__ */ jsx(Stack, { direction: "row", spacing: 1, children: icons });
82
- };
83
- const ContextIcon$1 = memo(ContextIcon);
63
+ )
64
+ );
65
+ const d = t.length - s.length;
66
+ return d > 0 && I && f.push(
67
+ /* @__PURE__ */ o(E, { disabled: !y, count: d, children: /* @__PURE__ */ o(M, { icon: "ic:baseline-newspaper", style: { zIndex: 2, ...r.style ?? {} } }) }, "extra")
68
+ ), /* @__PURE__ */ o(u, { direction: "row", spacing: 1, children: f });
69
+ }, G = j(R);
84
70
  export {
85
- ContextIcon$1 as default
71
+ G as default
86
72
  };