@cccsaurora/clue-ui 1.2.1-patch.256 → 1.3.0-dev.255

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 (181) hide show
  1. package/ActionForm-C0aE9HUv.js +5941 -0
  2. package/AnnotationDetails-CEou0vCc.js +175 -0
  3. package/AnnotationPreview-CLMVD6Ec.js +188 -0
  4. package/ClueEnrichContext-BkD9ZwM9.js +541 -0
  5. package/FlexOne-BSYAhhtG.js +9 -0
  6. package/_MapCache-WmuDdwuH.js +222 -0
  7. package/_Uint8Array-DdG4KLKn.js +128 -0
  8. package/_baseAssignValue-CGTuELqU.js +25 -0
  9. package/_baseClone-BpWiBnMp.js +283 -0
  10. package/_baseExtremum-BY663UjY.js +33 -0
  11. package/_baseFlatten-B69cDsaV.js +92 -0
  12. package/_baseGet-Bx3A4Qfp.js +108 -0
  13. package/_baseIsEqual-B4IufFlL.js +208 -0
  14. package/_baseIteratee-7AQvAy1o.js +126 -0
  15. package/_baseSlice-GAv_YFTT.js +20 -0
  16. package/_baseSum-D0WC1dN0.js +13 -0
  17. package/_baseUniq-B8fK6hI-.js +115 -0
  18. package/_commonjsHelpers-DWwsNxpa.js +8 -0
  19. package/_createAggregator-CwGPThny.js +63 -0
  20. package/_getPrototype-CblfEidB.js +5 -0
  21. package/_getTag-jwz4XLoZ.js +126 -0
  22. package/_setToArray-CaPKQhcz.js +33 -0
  23. package/cloneDeep-DmUylbkM.js +8 -0
  24. package/components/AnnotationBody.js +49 -35
  25. package/components/AnnotationDetailPopover.js +36 -30
  26. package/components/AnnotationDetails.js +7 -7
  27. package/components/AnnotationEntry.js +35 -35
  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 +75 -59
  39. package/components/actions/ResultModal.js +4 -4
  40. package/components/actions/form/schemaAdapter.js +39 -23
  41. package/components/actions/formats/FileResult.js +86 -59
  42. package/components/actions/formats/index.js +21 -10
  43. package/components/display/graph/ExpandMoreButton.js +10 -10
  44. package/components/display/graph/elements/NodeCard.js +111 -91
  45. package/components/display/graph/elements/NodeTag.js +15 -13
  46. package/components/display/graph/index.js +261 -202
  47. package/components/display/graph/visualizations/Leaf.js +88 -69
  48. package/components/display/graph/visualizations/cloud/index.js +98 -81
  49. package/components/display/graph/visualizations/icons/BaseIcon.js +26 -21
  50. package/components/display/graph/visualizations/icons/BugIcon.js +12 -12
  51. package/components/display/graph/visualizations/icons/HostIcon.js +12 -12
  52. package/components/display/graph/visualizations/icons/NetworkIcon.js +12 -12
  53. package/components/display/graph/visualizations/icons/ProcessIcon.js +12 -12
  54. package/components/display/graph/visualizations/icons/TargetIcon.js +13 -13
  55. package/components/display/graph/visualizations/icons/index.js +14 -13
  56. package/components/display/graph/visualizations/panels/NodePanel.js +10 -8
  57. package/components/display/graph/visualizations/tree/BundleLine.js +108 -81
  58. package/components/display/graph/visualizations/tree/Triangle.js +13 -13
  59. package/components/display/graph/visualizations/tree/index.js +407 -306
  60. package/components/display/icons/Iconified.js +27 -12
  61. package/components/display/json/index.js +4 -4
  62. package/components/display/markdown/index.js +8678 -5770
  63. package/components/enrichment/EnrichPopover.js +54 -46
  64. package/components/fetchers/Fetcher.js +155 -117
  65. package/components/fetchers/PreviewModal.js +20 -17
  66. package/components/fetchers/StatusChip.js +21 -17
  67. package/components/group/Entry.js +13 -11
  68. package/components/group/Group.js +13 -10
  69. package/components/group/GroupControl.js +76 -65
  70. package/components/stats/QueryStatus.js +43 -33
  71. package/countBy-DqlU5OwT.js +14 -0
  72. package/data/event.js +6 -4
  73. package/database/index.js +2 -2
  74. package/debounce-bV0h5FC5.js +92 -0
  75. package/get-DSsNkRQs.js +8 -0
  76. package/groupBy-ChDRT7uy.js +14 -0
  77. package/hooks/ClueActionContext.js +6 -6
  78. package/hooks/ClueComponentContext.js +29 -23
  79. package/hooks/ClueConfigProvider.js +14 -12
  80. package/hooks/ClueDatabaseContext.js +19 -13
  81. package/hooks/ClueEnrichContext.js +8 -8
  82. package/hooks/ClueFetcherContext.js +83 -56
  83. package/hooks/ClueGroupContext.js +17 -14
  84. package/hooks/CluePopupContext.js +5 -5
  85. package/hooks/ClueProvider.js +12 -10
  86. package/hooks/selectors.js +7 -7
  87. package/hooks/useActionResult.js +2 -2
  88. package/hooks/useAnnotations.js +47 -31
  89. package/hooks/useClue.js +6 -4
  90. package/hooks/useClueActions.js +3 -3
  91. package/hooks/useClueConfig.js +6 -4
  92. package/hooks/useClueTypeConfig.js +3 -3
  93. package/hooks/useComparator.js +722 -435
  94. package/hooks/useErrors.js +22 -18
  95. package/hooks/useFetcherResult.js +33 -24
  96. package/hooks/useMyHighlights.js +66 -36
  97. package/hooks/useMyLocalStorage.js +66 -37
  98. package/iconify-CXMreGTg.js +1782 -0
  99. package/icons/Action.js +66 -49
  100. package/icons/Assessment.js +84 -69
  101. package/icons/Context.js +77 -63
  102. package/icons/Opinion.js +78 -60
  103. package/icons/iconMap.js +2 -2
  104. package/identity-CPGTqrE4.js +6 -0
  105. package/index-AMfoEg_6.js +696 -0
  106. package/index-B6C2a_Lg.js +1172 -0
  107. package/index-C12gPw2W.js +17698 -0
  108. package/index-DCKkHTvx.js +15750 -0
  109. package/index-UkW8Sur3.js +465 -0
  110. package/isNil-CIubwp4T.js +6 -0
  111. package/isObject-FTY-5JQX.js +7 -0
  112. package/isObjectLike-OAgjjZye.js +48 -0
  113. package/isSymbol-Xd2FsJyp.js +8 -0
  114. package/last-CUCl67Im.js +7 -0
  115. package/main.js +60 -60
  116. package/package.json +1 -1
  117. package/sortBy-C7mGPI_D.js +100 -0
  118. package/sumBy-CGALjmwQ.js +8 -0
  119. package/text/Frequency.js +42 -23
  120. package/toFinite-Bc55msYj.js +16 -0
  121. package/toNumber-DPxy1FBy.js +39 -0
  122. package/useClueTypeConfig-D2tf4-NM.js +3289 -0
  123. package/utils/chain.js +91 -65
  124. package/utils/classificationParser.js +519 -256
  125. package/utils/constants.js +35 -10
  126. package/utils/graph.js +72 -45
  127. package/utils/hashUtil.js +7 -7
  128. package/utils/line.js +131 -81
  129. package/utils/loggerUtil.js +5 -3
  130. package/utils/sessionStorage.js +41 -27
  131. package/utils/time.js +423 -423
  132. package/utils/utils.js +9 -9
  133. package/utils/window.js +21 -10
  134. package/utils-71DpzFrA.js +199 -0
  135. package/ActionForm-DlOXqMUx.js +0 -4460
  136. package/AnnotationDetails-Bk-p0F6h.js +0 -160
  137. package/AnnotationPreview-jzZvkCxJ.js +0 -140
  138. package/ClueEnrichContext-KqRuuWNS.js +0 -418
  139. package/FlexOne-BXWFOd1T.js +0 -6
  140. package/_MapCache-BiTi0iqu.js +0 -180
  141. package/_Uint8Array-BQNOM9Rr.js +0 -101
  142. package/_baseAssignValue-CNMLQZco.js +0 -20
  143. package/_baseClone-BnT-6pyM.js +0 -207
  144. package/_baseExtremum-Ca2EHgy2.js +0 -16
  145. package/_baseFlatten-Bfr_Molw.js +0 -72
  146. package/_baseGet-DSZygzyq.js +0 -79
  147. package/_baseIsEqual-VgvaAFZG.js +0 -147
  148. package/_baseIteratee-Dbfsw5z8.js +0 -95
  149. package/_baseSlice-M5RKzt1A.js +0 -10
  150. package/_baseSum-wEbgNeUs.js +0 -10
  151. package/_baseUniq-BJcj69PL.js +0 -79
  152. package/_commonjsHelpers-DaMA6jEr.js +0 -8
  153. package/_createAggregator-k3TuAnxT.js +0 -53
  154. package/_getPrototype-Cr1Mk7BC.js +0 -5
  155. package/_getTag-CK2Sffaq.js +0 -90
  156. package/_isIterateeCall-DkJP7Rbx.js +0 -13
  157. package/_setToArray-C7yMOeww.js +0 -29
  158. package/cloneDeep-CF8TtLHr.js +0 -8
  159. package/countBy-CdYegFSu.js +0 -8
  160. package/debounce-DryYcbJ4.js +0 -56
  161. package/get-CH7kz5Ix.js +0 -8
  162. package/groupBy-br8xmD2R.js +0 -8
  163. package/iconify-BBckr5AQ.js +0 -1263
  164. package/identity-ByMq8VxU.js +0 -6
  165. package/index-BHAe_V9n.js +0 -12768
  166. package/index-BK-zfYhR.js +0 -358
  167. package/index-CA5CUNZO.js +0 -975
  168. package/index-Dj5C04IX.js +0 -568
  169. package/index-p5_wX7q1.js +0 -11729
  170. package/isNil-CjWwlQS3.js +0 -6
  171. package/isObject-B53jY8Qg.js +0 -7
  172. package/isObjectLike-BatpeCIi.js +0 -29
  173. package/isSymbol-C3_SC0Qp.js +0 -8
  174. package/last-7CdUxN0r.js +0 -7
  175. package/maxBy-Bc0dYHcO.js +0 -8
  176. package/sortBy-DY2JBf9n.js +0 -75
  177. package/sumBy-DuMASLPd.js +0 -8
  178. package/toFinite-BMy6GObD.js +0 -14
  179. package/toNumber-YVhnnJv4.js +0 -31
  180. package/useClueTypeConfig-Ct9Ygter.js +0 -2292
  181. package/utils-DmwSUrum.js +0 -129
@@ -1,79 +1,87 @@
1
- import { jsxs as y, Fragment as C, jsx as e } from "react/jsx-runtime";
2
- import { useTheme as k, Tooltip as S, IconButton as E, CircularProgress as f, Button as z, Popover as I, Paper as j, Stack as c, Box as P, Typography as B, Divider as O } from "@mui/material";
3
- import { d as T, b as p, e as w } from "../../ActionForm-DlOXqMUx.js";
4
- import { useState as m, useRef as M, useCallback as D, useEffect as F } from "react";
5
- import g from "../display/icons/Iconified.js";
6
- const H = ({ show: t = !1, size: b = "small", selector: n }) => {
7
- const { t: s } = T((i) => i.i18next), h = k(), a = p((i) => i.availableSources), u = p((i) => i.enrich), [x, o] = m(t), [r, d] = m(!1), l = M(null), v = D(
8
- async (i) => {
9
- d(!0);
1
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
+ import { useTheme, Tooltip, IconButton, CircularProgress, Button, Popover, Paper, Stack, Box, Typography, Divider } from "@mui/material";
3
+ import { d as useClueComponentSelector, b as useClueEnrichSelector, e as capitalize } from "../../ActionForm-C0aE9HUv.js";
4
+ import { useState, useRef, useCallback, useEffect } from "react";
5
+ import Iconified from "../display/icons/Iconified.js";
6
+ const EnrichPopover = ({ show = false, size = "small", selector }) => {
7
+ const { t } = useClueComponentSelector((ctx) => ctx.i18next);
8
+ const theme = useTheme();
9
+ const availableSources = useClueEnrichSelector((ctx) => ctx.availableSources);
10
+ const _enrich = useClueEnrichSelector((ctx) => ctx.enrich);
11
+ const [showEnrichMenu, setShowEnrichMenu] = useState(show);
12
+ const [loading, setLoading] = useState(false);
13
+ const enrichEl = useRef(null);
14
+ const enrich = useCallback(
15
+ async (_source) => {
16
+ setLoading(true);
10
17
  try {
11
- await u(n.type, n.value, {
12
- classification: n.classification,
18
+ await _enrich(selector.type, selector.value, {
19
+ classification: selector.classification,
13
20
  timeout: 30,
14
- force: !0,
15
- noCache: !0,
16
- sources: [i],
17
- append: !0
21
+ force: true,
22
+ noCache: true,
23
+ sources: [_source],
24
+ append: true
18
25
  });
19
26
  } finally {
20
- d(!1);
27
+ setLoading(false);
21
28
  }
22
29
  },
23
- [u, n.classification, n.type, n.value]
30
+ [_enrich, selector.classification, selector.type, selector.value]
24
31
  );
25
- return F(() => {
26
- o(t);
27
- }, [t]), /* @__PURE__ */ y(C, { children: [
28
- b === "small" ? /* @__PURE__ */ e(S, { ref: l, title: s("enrich"), children: /* @__PURE__ */ e("span", { style: { alignSelf: "center" }, children: /* @__PURE__ */ e(
29
- E,
32
+ useEffect(() => {
33
+ setShowEnrichMenu(show);
34
+ }, [show]);
35
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
36
+ size === "small" ? /* @__PURE__ */ jsx(Tooltip, { ref: enrichEl, title: t("enrich"), children: /* @__PURE__ */ jsx("span", { style: { alignSelf: "center" }, children: /* @__PURE__ */ jsx(
37
+ IconButton,
30
38
  {
31
- onClick: () => o(!0),
32
- disabled: Object.keys(a).length < 1 || r,
39
+ onClick: () => setShowEnrichMenu(true),
40
+ disabled: Object.keys(availableSources).length < 1 || loading,
33
41
  color: "info",
34
- children: r ? /* @__PURE__ */ e(f, { color: "info", size: "24px" }) : /* @__PURE__ */ e(g, { icon: "ic:baseline-auto-fix-high" })
42
+ children: loading ? /* @__PURE__ */ jsx(CircularProgress, { color: "info", size: "24px" }) : /* @__PURE__ */ jsx(Iconified, { icon: "ic:baseline-auto-fix-high" })
35
43
  }
36
- ) }) }) : /* @__PURE__ */ e(
37
- z,
44
+ ) }) }) : /* @__PURE__ */ jsx(
45
+ Button,
38
46
  {
39
- ref: l,
47
+ ref: enrichEl,
40
48
  variant: "outlined",
41
49
  color: "info",
42
- disabled: Object.keys(a).length < 1 || r,
43
- startIcon: r ? /* @__PURE__ */ e(f, { color: "info", size: "20px" }) : /* @__PURE__ */ e(g, { icon: "ic:baseline-auto-fix-high" }),
50
+ disabled: Object.keys(availableSources).length < 1 || loading,
51
+ startIcon: loading ? /* @__PURE__ */ jsx(CircularProgress, { color: "info", size: "20px" }) : /* @__PURE__ */ jsx(Iconified, { icon: "ic:baseline-auto-fix-high" }),
44
52
  sx: { alignSelf: "stretch" },
45
- onClick: () => o(!0),
46
- children: s("enrich")
53
+ onClick: () => setShowEnrichMenu(true),
54
+ children: t("enrich")
47
55
  }
48
56
  ),
49
- /* @__PURE__ */ e(
50
- I,
57
+ /* @__PURE__ */ jsx(
58
+ Popover,
51
59
  {
52
60
  sx: { zIndex: 2e3 },
53
- open: x,
54
- disablePortal: !0,
55
- onClose: () => o(!1),
56
- anchorEl: l.current,
61
+ open: showEnrichMenu,
62
+ disablePortal: true,
63
+ onClose: () => setShowEnrichMenu(false),
64
+ anchorEl: enrichEl.current,
57
65
  anchorOrigin: { horizontal: "left", vertical: "bottom" },
58
- children: /* @__PURE__ */ e(j, { onClick: () => o(!1), children: /* @__PURE__ */ e(c, { divider: /* @__PURE__ */ e(O, { flexItem: !0, orientation: "horizontal" }), children: a.map((i) => /* @__PURE__ */ e(
59
- P,
66
+ children: /* @__PURE__ */ jsx(Paper, { onClick: () => setShowEnrichMenu(false), children: /* @__PURE__ */ jsx(Stack, { divider: /* @__PURE__ */ jsx(Divider, { flexItem: true, orientation: "horizontal" }), children: availableSources.map((_source) => /* @__PURE__ */ jsx(
67
+ Box,
60
68
  {
61
69
  sx: {
62
70
  px: 3,
63
71
  py: 1,
64
72
  cursor: "pointer",
65
- transition: h.transitions.create("background-color"),
66
- "&:hover": { backgroundColor: h.palette.background.default }
73
+ transition: theme.transitions.create("background-color"),
74
+ "&:hover": { backgroundColor: theme.palette.background.default }
67
75
  },
68
- onClick: () => v(i),
69
- children: /* @__PURE__ */ e(c, { children: /* @__PURE__ */ e(c, { direction: "row", spacing: 1, alignItems: "center", children: /* @__PURE__ */ e(B, { variant: "body1", children: i.split("-").map(w).join(" ") }) }) })
76
+ onClick: () => enrich(_source),
77
+ children: /* @__PURE__ */ jsx(Stack, { children: /* @__PURE__ */ jsx(Stack, { direction: "row", spacing: 1, alignItems: "center", children: /* @__PURE__ */ jsx(Typography, { variant: "body1", children: _source.split("-").map(capitalize).join(" ") }) }) })
70
78
  },
71
- i
79
+ _source
72
80
  )) }) })
73
81
  }
74
82
  )
75
83
  ] });
76
84
  };
77
85
  export {
78
- H as default
86
+ EnrichPopover as default
79
87
  };
@@ -1,104 +1,141 @@
1
- import { jsx as i, jsxs as m } from "react/jsx-runtime";
2
- import { I as H } from "../../iconify-BBckr5AQ.js";
3
- import { useTheme as V, Skeleton as I, Chip as q, Tooltip as J, Stack as u, Typography as K, LinearProgress as Q, Paper as U, Box as X, IconButton as Y } from "@mui/material";
4
- import { F as L } from "../../FlexOne-BXWFOd1T.js";
5
- import S from "../display/icons/Iconified.js";
6
- import { J as Z } from "../../index-BK-zfYhR.js";
7
- import { ClueComponentContext as $ } from "../../hooks/ClueComponentContext.js";
8
- import { c as h } from "../../ActionForm-DlOXqMUx.js";
9
- import p, { useState as b, useRef as k, useMemo as P, useEffect as N, memo as ee } from "react";
10
- import { u as ie } from "../../index-Dj5C04IX.js";
11
- import ne from "../display/graph/index.js";
12
- import te from "../display/markdown/index.js";
13
- import re from "./PreviewModal.js";
14
- import oe from "./StatusChip.js";
15
- const ae = p.memo(
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { I as Icon } from "../../iconify-CXMreGTg.js";
3
+ import { useTheme, Skeleton, Chip, Tooltip, Stack, Typography, LinearProgress, Paper, Box, IconButton } from "@mui/material";
4
+ import { F as FlexOne } from "../../FlexOne-BSYAhhtG.js";
5
+ import Iconified from "../display/icons/Iconified.js";
6
+ import { J as JSONViewer } from "../../index-UkW8Sur3.js";
7
+ import { ClueComponentContext } from "../../hooks/ClueComponentContext.js";
8
+ import { c as useClueFetcherSelector } from "../../ActionForm-C0aE9HUv.js";
9
+ import React__default, { useState, useRef, useMemo, useEffect, memo } from "react";
10
+ import { u as useContextSelector } from "../../index-AMfoEg_6.js";
11
+ import Graph from "../display/graph/index.js";
12
+ import Markdown from "../display/markdown/index.js";
13
+ import PreviewModal from "./PreviewModal.js";
14
+ import StatusChip from "./StatusChip.js";
15
+ const Fetcher = React__default.memo(
16
16
  ({
17
- type: s,
18
- value: x,
19
- classification: g,
20
- fetcherId: a,
17
+ type,
18
+ value,
19
+ classification,
20
+ fetcherId,
21
21
  slotProps: {
22
- paper: r = {},
23
- preview: O = {},
24
- stack: o = {},
25
- image: W = {},
26
- chip: v = {},
27
- skeleton: t = {}
22
+ paper: paperProps = {},
23
+ preview: previewProps = {},
24
+ stack: stackProps = {},
25
+ image: imageProps = {},
26
+ chip: chipProps = {},
27
+ skeleton: skeletonProps = {}
28
28
  } = {}
29
29
  }) => {
30
- var z, M, T, j;
31
- const d = V(), w = h((n) => n.fetchers), F = h((n) => n.fetchSelector), R = h((n) => n.getFetcherStatus), D = h((n) => n.fetchCompleted), { t: l } = ie($, (n) => n == null ? void 0 : n.i18next), [e, f] = b(null), [E, A] = b(!0), [G, _] = b(!1), y = k(null), C = P(() => e == null ? void 0 : e.task_id, [e == null ? void 0 : e.task_id]);
32
- if (N(() => {
33
- if ((e == null ? void 0 : e.outcome) !== "pending" || !C) return;
34
- let n = !1;
35
- const B = async () => {
36
- const c = await R(a, C);
37
- if (!c)
38
- f({ outcome: "failure", done: !0, error: "Missing result", link: "" });
39
- else if (c.outcome === "success" || c.outcome === "failure")
40
- f({ ...c, done: !0 });
41
- else {
42
- if (n) return;
43
- f({ ...c }), y.current = setTimeout(B, 2e3);
30
+ var _a, _b, _c, _d;
31
+ const theme = useTheme();
32
+ const fetchers = useClueFetcherSelector((ctx) => ctx.fetchers);
33
+ const fetchSelector = useClueFetcherSelector((ctx) => ctx.fetchSelector);
34
+ const getFetcherStatus = useClueFetcherSelector((ctx) => ctx.getFetcherStatus);
35
+ const fetchCompleted = useClueFetcherSelector((ctx) => ctx.fetchCompleted);
36
+ const { t } = useContextSelector(ClueComponentContext, (ctx) => ctx == null ? void 0 : ctx.i18next);
37
+ const [result, setResult] = useState(null);
38
+ const [loading, setLoading] = useState(true);
39
+ const [showPreview, setShowPreview] = useState(false);
40
+ const timeoutRef = useRef(null);
41
+ const taskId = useMemo(() => result == null ? void 0 : result.task_id, [result == null ? void 0 : result.task_id]);
42
+ useEffect(() => {
43
+ if ((result == null ? void 0 : result.outcome) !== "pending" || !taskId) return;
44
+ let cancelled = false;
45
+ const poll = async () => {
46
+ const res = await getFetcherStatus(fetcherId, taskId);
47
+ if (!res) {
48
+ setResult({ outcome: "failure", done: true, error: "Missing result", link: "" });
49
+ } else if (res.outcome === "success" || res.outcome === "failure") {
50
+ setResult({ ...res, done: true });
51
+ } else {
52
+ if (cancelled) return;
53
+ setResult({ ...res });
54
+ timeoutRef.current = setTimeout(poll, 2e3);
44
55
  }
45
56
  };
46
- return B(), () => {
47
- n = !0, y.current && clearTimeout(y.current);
57
+ poll();
58
+ return () => {
59
+ cancelled = true;
60
+ if (timeoutRef.current) clearTimeout(timeoutRef.current);
48
61
  };
49
- }, [a, R, e == null ? void 0 : e.outcome, C]), N(() => {
62
+ }, [fetcherId, getFetcherStatus, result == null ? void 0 : result.outcome, taskId]);
63
+ useEffect(() => {
50
64
  (async () => {
51
65
  try {
52
- A(!0), f(await F(a, { type: s, value: x, classification: g }));
66
+ setLoading(true);
67
+ setResult(await fetchSelector(fetcherId, { type, value, classification }));
53
68
  } catch {
54
- A(!1);
69
+ setLoading(false);
55
70
  }
56
71
  })();
57
- }, [g, F, a, s, x]), D)
58
- if (a)
59
- if (a.includes(".")) {
60
- if (!(a in w))
61
- return console.warn("Fetcher ID does not correspond to a registered fetcher. Component will not render."), null;
62
- } else return console.warn(
72
+ }, [classification, fetchSelector, fetcherId, type, value]);
73
+ if (fetchCompleted) {
74
+ if (!fetcherId) {
75
+ console.warn("Missing fetcher Id. Component will not render.");
76
+ return null;
77
+ } else if (!fetcherId.includes(".")) {
78
+ console.warn(
63
79
  "Invalid fetcher id. Must be in the format '<plugin_id>.<fetcher_id>'. Component will not render."
64
- ), null;
65
- else return console.warn("Missing fetcher Id. Component will not render."), null;
66
- else
67
- return null;
68
- return E ? ((z = w[a]) == null ? void 0 : z.format) === "status" ? /* @__PURE__ */ i(
69
- I,
70
- {
71
- variant: "rounded",
72
- height: "32px",
73
- width: "150px",
74
- ...t,
75
- sx: [
76
- { borderRadius: "16px" },
77
- ...Array.isArray(t == null ? void 0 : t.sx) ? t == null ? void 0 : t.sx : [t == null ? void 0 : t.sx]
78
- ]
80
+ );
81
+ return null;
82
+ } else if (!(fetcherId in fetchers)) {
83
+ console.warn("Fetcher ID does not correspond to a registered fetcher. Component will not render.");
84
+ return null;
79
85
  }
80
- ) : /* @__PURE__ */ i(I, { variant: "rounded", height: "325px", width: "300px", ...t }) : (e == null ? void 0 : e.outcome) === "failure" && w[a].format === "status" ? /* @__PURE__ */ i(
81
- q,
82
- {
83
- icon: /* @__PURE__ */ i(J, { title: e.error, children: /* @__PURE__ */ i(H, { icon: "mdi:information-outline", fontSize: "1.25rem" }) }),
84
- label: l("error"),
85
- color: "error",
86
- ...v
86
+ } else {
87
+ return null;
88
+ }
89
+ if (loading) {
90
+ if (((_a = fetchers[fetcherId]) == null ? void 0 : _a.format) === "status") {
91
+ return /* @__PURE__ */ jsx(
92
+ Skeleton,
93
+ {
94
+ variant: "rounded",
95
+ height: "32px",
96
+ width: "150px",
97
+ ...skeletonProps,
98
+ sx: [
99
+ { borderRadius: "16px" },
100
+ ...Array.isArray(skeletonProps == null ? void 0 : skeletonProps.sx) ? skeletonProps == null ? void 0 : skeletonProps.sx : [skeletonProps == null ? void 0 : skeletonProps.sx]
101
+ ]
102
+ }
103
+ );
104
+ } else {
105
+ return /* @__PURE__ */ jsx(Skeleton, { variant: "rounded", height: "325px", width: "300px", ...skeletonProps });
87
106
  }
88
- ) : e.outcome === "pending" ? /* @__PURE__ */ m(u, { flex: 1, sx: { pt: 2, alignItems: "center" }, spacing: 1, children: [
89
- ((M = e.data) == null ? void 0 : M.summary) && /* @__PURE__ */ i(K, { variant: "caption", children: e.data.summary }),
90
- /* @__PURE__ */ i(
91
- Q,
107
+ }
108
+ if ((result == null ? void 0 : result.outcome) === "failure" && fetchers[fetcherId].format === "status") {
109
+ return /* @__PURE__ */ jsx(
110
+ Chip,
92
111
  {
93
- variant: (T = e.data) != null && T.progress ? "determinate" : "indeterminate",
94
- value: ((j = e.data) == null ? void 0 : j.progress) * 100,
95
- sx: { maxWidth: 500, width: "100%", borderRadius: d.shape.borderRadius }
112
+ icon: /* @__PURE__ */ jsx(Tooltip, { title: result.error, children: /* @__PURE__ */ jsx(Icon, { icon: "mdi:information-outline", fontSize: "1.25rem" }) }),
113
+ label: t("error"),
114
+ color: "error",
115
+ ...chipProps
96
116
  }
97
- )
98
- ] }) : (e == null ? void 0 : e.format) === "status" ? /* @__PURE__ */ i(oe, { data: e.data, ...v }) : /* @__PURE__ */ i(
99
- U,
117
+ );
118
+ }
119
+ if (result.outcome === "pending") {
120
+ return /* @__PURE__ */ jsxs(Stack, { flex: 1, sx: { pt: 2, alignItems: "center" }, spacing: 1, children: [
121
+ ((_b = result.data) == null ? void 0 : _b.summary) && /* @__PURE__ */ jsx(Typography, { variant: "caption", children: result.data.summary }),
122
+ /* @__PURE__ */ jsx(
123
+ LinearProgress,
124
+ {
125
+ variant: ((_c = result.data) == null ? void 0 : _c.progress) ? "determinate" : "indeterminate",
126
+ value: ((_d = result.data) == null ? void 0 : _d.progress) * 100,
127
+ sx: { maxWidth: 500, width: "100%", borderRadius: theme.shape.borderRadius }
128
+ }
129
+ )
130
+ ] });
131
+ }
132
+ if ((result == null ? void 0 : result.format) === "status") {
133
+ return /* @__PURE__ */ jsx(StatusChip, { data: result.data, ...chipProps });
134
+ }
135
+ return /* @__PURE__ */ jsx(
136
+ Paper,
100
137
  {
101
- ...r,
138
+ ...paperProps,
102
139
  sx: [
103
140
  {
104
141
  p: 1,
@@ -107,16 +144,16 @@ const ae = p.memo(
107
144
  width: "100%",
108
145
  minWidth: "300px"
109
146
  },
110
- ...Array.isArray(r == null ? void 0 : r.sx) ? r == null ? void 0 : r.sx : [r == null ? void 0 : r.sx]
147
+ ...Array.isArray(paperProps == null ? void 0 : paperProps.sx) ? paperProps == null ? void 0 : paperProps.sx : [paperProps == null ? void 0 : paperProps.sx]
111
148
  ],
112
- children: /* @__PURE__ */ m(
113
- u,
149
+ children: /* @__PURE__ */ jsxs(
150
+ Stack,
114
151
  {
115
152
  sx: {
116
153
  "& > img": {
117
154
  borderRadius: "3px",
118
155
  cursor: "zoom-in",
119
- transition: d.transitions.create("border-color", { duration: d.transitions.duration.shortest }),
156
+ transition: theme.transitions.create("border-color", { duration: theme.transitions.duration.shortest }),
120
157
  border: "3px solid transparent",
121
158
  "&:hover": {
122
159
  borderColor: "primary.main"
@@ -124,64 +161,65 @@ const ae = p.memo(
124
161
  }
125
162
  },
126
163
  children: [
127
- (e == null ? void 0 : e.outcome) === "failure" && /* @__PURE__ */ i("code", { style: { color: d.palette.error.main }, children: /* @__PURE__ */ i("pre", { style: { marginTop: 0, marginBottom: 0 }, children: e.error }) }),
128
- (e == null ? void 0 : e.format) === "markdown" && /* @__PURE__ */ i(te, { md: e.data }),
129
- (e == null ? void 0 : e.format) === "image" && /* @__PURE__ */ i("img", { src: e.data.image, alt: e.data.alt, ...W, onClick: () => _(!0) }),
130
- (e == null ? void 0 : e.format) === "json" && /* @__PURE__ */ i(X, { sx: { ".react-json-view": { backgroundColor: "transparent !important" } }, children: /* @__PURE__ */ i(Z, { data: e.data }) }),
131
- (e == null ? void 0 : e.format) === "graph" && /* @__PURE__ */ i(ne, { graph: e.data, sx: { minHeight: "600px" } }),
132
- /* @__PURE__ */ i(L, {}),
133
- /* @__PURE__ */ m(
134
- u,
164
+ (result == null ? void 0 : result.outcome) === "failure" && /* @__PURE__ */ jsx("code", { style: { color: theme.palette.error.main }, children: /* @__PURE__ */ jsx("pre", { style: { marginTop: 0, marginBottom: 0 }, children: result.error }) }),
165
+ (result == null ? void 0 : result.format) === "markdown" && /* @__PURE__ */ jsx(Markdown, { md: result.data }),
166
+ (result == null ? void 0 : result.format) === "image" && /* @__PURE__ */ jsx("img", { src: result.data.image, alt: result.data.alt, ...imageProps, onClick: () => setShowPreview(true) }),
167
+ (result == null ? void 0 : result.format) === "json" && /* @__PURE__ */ jsx(Box, { sx: { ".react-json-view": { backgroundColor: "transparent !important" } }, children: /* @__PURE__ */ jsx(JSONViewer, { data: result.data }) }),
168
+ (result == null ? void 0 : result.format) === "graph" && /* @__PURE__ */ jsx(Graph, { graph: result.data, sx: { minHeight: "600px" } }),
169
+ /* @__PURE__ */ jsx(FlexOne, {}),
170
+ /* @__PURE__ */ jsxs(
171
+ Stack,
135
172
  {
136
173
  direction: "row",
137
174
  spacing: 1,
138
- ...o,
175
+ ...stackProps,
139
176
  sx: [
140
177
  {
141
- py: d.spacing(0.5),
178
+ py: theme.spacing(0.5),
142
179
  display: "flex",
143
180
  alignItems: "center"
144
181
  },
145
- ...Array.isArray(o == null ? void 0 : o.sx) ? o == null ? void 0 : o.sx : [o == null ? void 0 : o.sx]
182
+ ...Array.isArray(stackProps == null ? void 0 : stackProps.sx) ? stackProps == null ? void 0 : stackProps.sx : [stackProps == null ? void 0 : stackProps.sx]
146
183
  ],
147
184
  children: [
148
- /* @__PURE__ */ i(S, { icon: "ic:baseline-landscape", color: "primary", fontSize: "small" }),
149
- /* @__PURE__ */ i(
150
- J,
185
+ /* @__PURE__ */ jsx(Iconified, { icon: "ic:baseline-landscape", color: "primary", fontSize: "small" }),
186
+ /* @__PURE__ */ jsx(
187
+ Tooltip,
151
188
  {
152
- title: /* @__PURE__ */ m(u, { spacing: 0.5, children: [
153
- /* @__PURE__ */ m("span", { children: [
154
- l("type"),
189
+ title: /* @__PURE__ */ jsxs(Stack, { spacing: 0.5, children: [
190
+ /* @__PURE__ */ jsxs("span", { children: [
191
+ t("type"),
155
192
  ": ",
156
- s
193
+ type
157
194
  ] }),
158
- /* @__PURE__ */ m("span", { children: [
159
- l("value"),
195
+ /* @__PURE__ */ jsxs("span", { children: [
196
+ t("value"),
160
197
  ": ",
161
- x
198
+ value
162
199
  ] }),
163
- /* @__PURE__ */ m("span", { children: [
164
- l("classification"),
200
+ /* @__PURE__ */ jsxs("span", { children: [
201
+ t("classification"),
165
202
  ": ",
166
- g ?? "N/A"
203
+ classification ?? "N/A"
167
204
  ] })
168
205
  ] }),
169
- children: /* @__PURE__ */ i(S, { icon: "ic:outline-info", fontSize: "small" })
206
+ children: /* @__PURE__ */ jsx(Iconified, { icon: "ic:outline-info", fontSize: "small" })
170
207
  }
171
208
  ),
172
- /* @__PURE__ */ i(L, {}),
173
- (e == null ? void 0 : e.link) && /* @__PURE__ */ i(Y, { size: "small", component: "a", href: e.link, children: /* @__PURE__ */ i(S, { icon: "ic:baseline-open-in-new", fontSize: "small" }) })
209
+ /* @__PURE__ */ jsx(FlexOne, {}),
210
+ (result == null ? void 0 : result.link) && /* @__PURE__ */ jsx(IconButton, { size: "small", component: "a", href: result.link, children: /* @__PURE__ */ jsx(Iconified, { icon: "ic:baseline-open-in-new", fontSize: "small" }) })
174
211
  ]
175
212
  }
176
213
  ),
177
- /* @__PURE__ */ i(re, { ...O, open: G, result: e, onClose: () => _(!1) })
214
+ /* @__PURE__ */ jsx(PreviewModal, { ...previewProps, open: showPreview, result, onClose: () => setShowPreview(false) })
178
215
  ]
179
216
  }
180
217
  )
181
218
  }
182
219
  );
183
220
  }
184
- ), be = ee(ae);
221
+ );
222
+ const Fetcher_default = memo(Fetcher);
185
223
  export {
186
- be as default
224
+ Fetcher_default as default
187
225
  };
@@ -1,19 +1,22 @@
1
- import { jsx as m } from "react/jsx-runtime";
2
- import { Modal as n, Paper as f } from "@mui/material";
3
- import { memo as l } from "react";
4
- const c = ({ result: i, onClose: d, open: x = !1, ...a }) => /* @__PURE__ */ m(
5
- n,
6
- {
7
- open: x,
8
- sx: [
9
- { display: "flex", alignItems: "center", justifyContent: "center" },
10
- ...Array.isArray(a == null ? void 0 : a.sx) ? a == null ? void 0 : a.sx : [a == null ? void 0 : a.sx]
11
- ],
12
- onClose: d,
13
- ...a,
14
- children: /* @__PURE__ */ m(f, { sx: { maxHeight: "90%", maxWidth: "90%", p: 2, overflow: "auto" }, children: (i == null ? void 0 : i.format) === "image" && /* @__PURE__ */ m("img", { src: i.data.image, alt: i.data.alt, style: { maxWidth: "100%" } }) })
15
- }
16
- ), t = l(c);
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Modal, Paper } from "@mui/material";
3
+ import { memo } from "react";
4
+ const PreviewModal = ({ result, onClose, open = false, ...otherProps }) => {
5
+ return /* @__PURE__ */ jsx(
6
+ Modal,
7
+ {
8
+ open,
9
+ sx: [
10
+ { display: "flex", alignItems: "center", justifyContent: "center" },
11
+ ...Array.isArray(otherProps == null ? void 0 : otherProps.sx) ? otherProps == null ? void 0 : otherProps.sx : [otherProps == null ? void 0 : otherProps.sx]
12
+ ],
13
+ onClose,
14
+ ...otherProps,
15
+ children: /* @__PURE__ */ jsx(Paper, { sx: { maxHeight: "90%", maxWidth: "90%", p: 2, overflow: "auto" }, children: (result == null ? void 0 : result.format) === "image" && /* @__PURE__ */ jsx("img", { src: result.data.image, alt: result.data.alt, style: { maxWidth: "100%" } }) })
16
+ }
17
+ );
18
+ };
19
+ const PreviewModal$1 = memo(PreviewModal);
17
20
  export {
18
- t as default
21
+ PreviewModal$1 as default
19
22
  };
@@ -1,25 +1,29 @@
1
- import { jsx as l } from "react/jsx-runtime";
2
- import { I as r } from "../../iconify-BBckr5AQ.js";
3
- import { useTheme as i, Chip as x } from "@mui/material";
4
- import { ClueComponentContext as g } from "../../hooks/ClueComponentContext.js";
5
- import { u as C } from "../../index-Dj5C04IX.js";
6
- const S = ({ data: e, ...n }) => {
7
- var t;
8
- const m = i(), { i18n: f, t: u } = C(g, (o) => o.i18next);
9
- return e != null && e.empty ? null : /* @__PURE__ */ l(
10
- x,
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { I as Icon } from "../../iconify-CXMreGTg.js";
3
+ import { useTheme, Chip } from "@mui/material";
4
+ import { ClueComponentContext } from "../../hooks/ClueComponentContext.js";
5
+ import { u as useContextSelector } from "../../index-AMfoEg_6.js";
6
+ const StatusChip = ({ data, ...chipProps }) => {
7
+ var _a;
8
+ const theme = useTheme();
9
+ const { i18n, t } = useContextSelector(ClueComponentContext, (ctx) => ctx.i18next);
10
+ if (data == null ? void 0 : data.empty) {
11
+ return null;
12
+ }
13
+ return /* @__PURE__ */ jsx(
14
+ Chip,
11
15
  {
12
- icon: e.icon && /* @__PURE__ */ l(r, { icon: e.icon, fontSize: "1.25rem" }),
13
- deleteIcon: /* @__PURE__ */ l("a", { href: e.link, rel: "noreferrer", target: "_blank", style: { display: "flex", alignItems: "center" }, children: /* @__PURE__ */ l(r, { icon: "mdi:open-in-new", color: m.palette.text.primary, fontSize: "1.25rem" }) }),
14
- ...n,
15
- label: ((t = e.labels.find((o) => o.language === f.language) ?? e.labels[0]) == null ? void 0 : t.label) ?? u("unknown"),
16
+ icon: data.icon && /* @__PURE__ */ jsx(Icon, { icon: data.icon, fontSize: "1.25rem" }),
17
+ deleteIcon: /* @__PURE__ */ jsx("a", { href: data.link, rel: "noreferrer", target: "_blank", style: { display: "flex", alignItems: "center" }, children: /* @__PURE__ */ jsx(Icon, { icon: "mdi:open-in-new", color: theme.palette.text.primary, fontSize: "1.25rem" }) }),
18
+ ...chipProps,
19
+ label: ((_a = data.labels.find((label) => label.language === i18n.language) ?? data.labels[0]) == null ? void 0 : _a.label) ?? t("unknown"),
16
20
  sx: [
17
- ...Array.isArray(n == null ? void 0 : n.sx) ? n == null ? void 0 : n.sx : [n == null ? void 0 : n.sx],
18
- e.color && { backgroundColor: e.color }
21
+ ...Array.isArray(chipProps == null ? void 0 : chipProps.sx) ? chipProps == null ? void 0 : chipProps.sx : [chipProps == null ? void 0 : chipProps.sx],
22
+ data.color && { backgroundColor: data.color }
19
23
  ]
20
24
  }
21
25
  );
22
26
  };
23
27
  export {
24
- S as default
28
+ StatusChip as default
25
29
  };
@@ -1,13 +1,15 @@
1
- import { ClueGroupContext as s } from "../../hooks/ClueGroupContext.js";
2
- import { i as u } from "../../utils-DmwSUrum.js";
3
- import { memo as a, useEffect as i } from "react";
4
- import { u as l } from "../../index-Dj5C04IX.js";
5
- const n = ({ children: f, entry: t, selected: e = !1 }) => {
6
- const r = l(s, (o) => o == null ? void 0 : o.setValues);
7
- return i(() => {
8
- r == null || r((o) => [...o.filter((m) => !u(m, t)), ...e ? [t] : []]);
9
- }, [t, e, r]), f;
10
- }, q = a(n);
1
+ import { ClueGroupContext } from "../../hooks/ClueGroupContext.js";
2
+ import { i as isEqual } from "../../utils-71DpzFrA.js";
3
+ import { memo, useEffect } from "react";
4
+ import { u as useContextSelector } from "../../index-AMfoEg_6.js";
5
+ const Entry = ({ children, entry, selected = false }) => {
6
+ const setValues = useContextSelector(ClueGroupContext, (ctx) => ctx == null ? void 0 : ctx.setValues);
7
+ useEffect(() => {
8
+ setValues == null ? void 0 : setValues((_values) => [..._values.filter((value) => !isEqual(value, entry)), ...selected ? [entry] : []]);
9
+ }, [entry, selected, setValues]);
10
+ return children;
11
+ };
12
+ const Entry_default = memo(Entry);
11
13
  export {
12
- q as default
14
+ Entry_default as default
13
15
  };
@@ -1,12 +1,15 @@
1
- import { jsx as t, jsxs as i } from "react/jsx-runtime";
2
- import { Stack as u } from "@mui/material";
3
- import { ClueGroupProvider as c } from "../../hooks/ClueGroupContext.js";
4
- import { memo as f } from "react";
5
- import n from "./GroupControl.js";
6
- const a = ({ children: o, showHeader: m = !0, slotProps: r, ...e }) => /* @__PURE__ */ t(c, { ...e, children: m ? /* @__PURE__ */ i(u, { direction: "column", alignSelf: "stretch", ...(r == null ? void 0 : r.stack) ?? {}, children: [
7
- /* @__PURE__ */ t(n, {}),
8
- o
9
- ] }) : o }), h = f(a);
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Stack } from "@mui/material";
3
+ import { ClueGroupProvider } from "../../hooks/ClueGroupContext.js";
4
+ import { memo } from "react";
5
+ import GroupControl from "./GroupControl.js";
6
+ const Group = ({ children, showHeader = true, slotProps, ...groupProps }) => {
7
+ return /* @__PURE__ */ jsx(ClueGroupProvider, { ...groupProps, children: showHeader ? /* @__PURE__ */ jsxs(Stack, { direction: "column", alignSelf: "stretch", ...(slotProps == null ? void 0 : slotProps.stack) ?? {}, children: [
8
+ /* @__PURE__ */ jsx(GroupControl, {}),
9
+ children
10
+ ] }) : children });
11
+ };
12
+ const Group_default = memo(Group);
10
13
  export {
11
- h as default
14
+ Group_default as default
12
15
  };