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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (201) hide show
  1. package/ActionForm-ByeOzpc4.js +555 -0
  2. package/AnnotationDetails-DknbKDyl.js +175 -0
  3. package/AnnotationPreview-CQwKs8se.js +188 -0
  4. package/ClueEnrichContext-6NJfXpUB.js +536 -0
  5. package/FlexOne-BSYAhhtG.js +9 -0
  6. package/_Map-kgDsDYxq.js +64 -0
  7. package/_MapCache-DabaaWfq.js +161 -0
  8. package/_Uint8Array-BlVVH1tp.js +129 -0
  9. package/_baseAssignValue-CNbcU6Nb.js +25 -0
  10. package/_baseClone-D3a8Pa4T.js +284 -0
  11. package/_baseExtremum-B1o1zHjR.js +33 -0
  12. package/_baseFlatten-D4huXoEI.js +92 -0
  13. package/_baseGet-BSK_nnoz.js +109 -0
  14. package/_baseIsEqual-B5xLoweL.js +238 -0
  15. package/_baseIteratee-p6Nj07-n.js +126 -0
  16. package/_baseSlice-GAv_YFTT.js +20 -0
  17. package/_baseSum-D0WC1dN0.js +13 -0
  18. package/_baseUniq-CpupKWcL.js +89 -0
  19. package/_commonjsHelpers-DWwsNxpa.js +8 -0
  20. package/_createAggregator-BpVy5xMi.js +63 -0
  21. package/_getPrototype-D1LAdQKO.js +5 -0
  22. package/_getTag-D3ToyefI.js +126 -0
  23. package/api/lookup/index.d.ts +1 -1
  24. package/api/lookup/types.d.ts +2 -2
  25. package/api/lookup/types_detection.d.ts +2 -2
  26. package/cloneDeep-CjP5k9zW.js +8 -0
  27. package/components/AnnotationBody.js +49 -34
  28. package/components/AnnotationDetailPopover.js +36 -30
  29. package/components/AnnotationDetails.js +6 -6
  30. package/components/AnnotationEntry.js +50 -47
  31. package/components/AnnotationPreview.js +5 -5
  32. package/components/ClassificationChip.d.ts +2 -1
  33. package/components/ClassificationChip.js +44 -23
  34. package/components/CountBadge.js +31 -26
  35. package/components/EnrichedCard.js +110 -92
  36. package/components/EnrichedChip.js +130 -111
  37. package/components/EnrichedTypography.d.ts +1 -1
  38. package/components/EnrichedTypography.js +133 -112
  39. package/components/ErrorBoundary.js +28 -24
  40. package/components/RetryFailedEnrichments.js +10 -9
  41. package/components/SourcePicker.js +57 -49
  42. package/components/actions/ActionForm.js +4 -4
  43. package/components/actions/ExecutePopover.js +64 -50
  44. package/components/actions/ResultModal.js +12 -41
  45. package/components/actions/form/schemaAdapter.js +40 -20
  46. package/components/display/graph/ExpandMoreButton.js +10 -10
  47. package/components/display/graph/elements/NodeCard.js +114 -76
  48. package/components/display/graph/elements/NodeTag.js +15 -13
  49. package/components/display/graph/index.js +267 -210
  50. package/components/display/graph/visualizations/Leaf.js +88 -69
  51. package/components/display/graph/visualizations/cloud/index.js +98 -81
  52. package/components/display/graph/visualizations/icons/BaseIcon.js +26 -21
  53. package/components/display/graph/visualizations/icons/BugIcon.js +12 -12
  54. package/components/display/graph/visualizations/icons/HostIcon.js +12 -12
  55. package/components/display/graph/visualizations/icons/NetworkIcon.js +12 -12
  56. package/components/display/graph/visualizations/icons/ProcessIcon.js +12 -12
  57. package/components/display/graph/visualizations/icons/TargetIcon.js +13 -13
  58. package/components/display/graph/visualizations/icons/index.js +14 -13
  59. package/components/display/graph/visualizations/panels/NodePanel.js +10 -8
  60. package/components/display/graph/visualizations/tree/BundleLine.js +108 -81
  61. package/components/display/graph/visualizations/tree/Triangle.js +13 -13
  62. package/components/display/graph/visualizations/tree/index.js +407 -305
  63. package/components/display/icons/Iconified.js +27 -12
  64. package/components/display/json/index.js +4 -4
  65. package/components/display/markdown/index.js +8696 -5668
  66. package/components/enrichment/EnrichPopover.js +55 -47
  67. package/components/fetchers/Fetcher.js +123 -95
  68. package/components/fetchers/PreviewModal.js +20 -17
  69. package/components/fetchers/StatusChip.js +21 -18
  70. package/components/group/Entry.js +13 -11
  71. package/components/group/Group.js +13 -10
  72. package/components/group/GroupControl.js +78 -66
  73. package/components/stats/QueryStatus.js +44 -31
  74. package/countBy-C69WslUA.js +14 -0
  75. package/data/event.js +6 -4
  76. package/database/index.js +2 -2
  77. package/debounce-bV0h5FC5.js +92 -0
  78. package/en/translation.json +39 -59
  79. package/fr/translation.json +37 -56
  80. package/get-D3C3lEU3.js +8 -0
  81. package/groupBy-DC2oOuBN.js +14 -0
  82. package/hooks/ClueActionContext.d.ts +26 -0
  83. package/hooks/ClueActionContext.js +8 -7
  84. package/hooks/ClueComponentContext.js +29 -23
  85. package/hooks/ClueConfigProvider.js +14 -12
  86. package/hooks/ClueDatabaseContext.js +19 -13
  87. package/hooks/ClueEnrichContext.js +8 -8
  88. package/hooks/ClueEnrichProps.d.ts +3 -1
  89. package/hooks/ClueFetcherContext.js +74 -46
  90. package/hooks/ClueGroupContext.js +17 -14
  91. package/hooks/CluePopupContext.js +5 -5
  92. package/hooks/ClueProvider.js +12 -10
  93. package/hooks/selectors.d.ts +4 -5
  94. package/hooks/selectors.js +21 -11
  95. package/hooks/useActionResult.d.ts +14 -0
  96. package/hooks/useActionResult.js +5 -0
  97. package/hooks/useAnnotations.js +45 -29
  98. package/hooks/useClue.js +6 -4
  99. package/hooks/useClueActions.d.ts +1 -1
  100. package/hooks/useClueActions.js +3 -3
  101. package/hooks/useClueConfig.d.ts +2 -1
  102. package/hooks/useClueConfig.js +6 -6
  103. package/hooks/useClueTypeConfig.js +3 -3
  104. package/hooks/useComparator.js +722 -435
  105. package/hooks/useErrors.js +22 -18
  106. package/hooks/useMyHighlights.js +66 -36
  107. package/hooks/useMyLocalStorage.d.ts +4 -3
  108. package/hooks/useMyLocalStorage.js +66 -46
  109. package/iconify-CXMreGTg.js +1782 -0
  110. package/icons/Action.js +66 -49
  111. package/icons/Assessment.js +84 -68
  112. package/icons/Context.js +78 -61
  113. package/icons/Opinion.js +77 -65
  114. package/icons/iconMap.js +2 -2
  115. package/identity-CPGTqrE4.js +6 -0
  116. package/index-BDVjGvMI.js +696 -0
  117. package/index-BbPn6-Mw.js +15750 -0
  118. package/index-Bi21Wb23.js +465 -0
  119. package/index-C3lkTD69.js +1172 -0
  120. package/index-CC12Ux-9.js +17654 -0
  121. package/isEmpty-BQkZubqU.js +29 -0
  122. package/isNil-CIubwp4T.js +6 -0
  123. package/isObject-FTY-5JQX.js +7 -0
  124. package/isObjectLike-OAgjjZye.js +48 -0
  125. package/isSymbol-Xd2FsJyp.js +8 -0
  126. package/last-CUCl67Im.js +7 -0
  127. package/main.js +62 -62
  128. package/package.json +3 -3
  129. package/sortBy-B-UKp4GT.js +100 -0
  130. package/sumBy-MYkDPHZL.js +8 -0
  131. package/text/Frequency.js +42 -23
  132. package/toFinite-Bc55msYj.js +16 -0
  133. package/toNumber-DPxy1FBy.js +39 -0
  134. package/types/RunningActionData.d.ts +4 -3
  135. package/types/action.d.ts +10 -1
  136. package/useClueTypeConfig-XvGvIw2S.js +3201 -0
  137. package/utils/chain.js +91 -64
  138. package/utils/classificationParser.js +519 -256
  139. package/utils/constants.js +35 -10
  140. package/utils/graph.js +72 -45
  141. package/utils/hashUtil.js +7 -7
  142. package/utils/line.js +131 -81
  143. package/utils/loggerUtil.d.ts +1 -1
  144. package/utils/loggerUtil.js +6 -4
  145. package/utils/sessionStorage.js +41 -29
  146. package/utils/time.d.ts +3 -0
  147. package/utils/time.js +536 -0
  148. package/utils/utils.js +10 -9
  149. package/utils/window.js +21 -10
  150. package/utils-7OtvGnmf.js +200 -0
  151. package/ActionForm-Sw7D-KOE.js +0 -340
  152. package/AnnotationDetails-BoX61_IF.js +0 -160
  153. package/AnnotationPreview-dYinoSA9.js +0 -140
  154. package/ClueEnrichContext-CvCIPOMC.js +0 -412
  155. package/FlexOne-BXWFOd1T.js +0 -6
  156. package/_Map-DXNg_Z-q.js +0 -54
  157. package/_MapCache-Cu25RRDU.js +0 -129
  158. package/_Uint8Array-DlJCtTvG.js +0 -102
  159. package/_baseAssignValue-CUmzp727.js +0 -20
  160. package/_baseClone-BlMmRXeX.js +0 -208
  161. package/_baseExtremum-P_0akmCi.js +0 -27
  162. package/_baseFlatten-CN7vDNEQ.js +0 -72
  163. package/_baseGet-Dgf6_xCm.js +0 -80
  164. package/_baseIsEqual-Cpjtfb3Q.js +0 -173
  165. package/_baseIteratee-CP1bocOX.js +0 -95
  166. package/_baseSlice-M5RKzt1A.js +0 -10
  167. package/_baseSum-wEbgNeUs.js +0 -10
  168. package/_baseUniq-tMFmk80M.js +0 -61
  169. package/_commonjsHelpers-C6fGbg64.js +0 -6
  170. package/_createAggregator-B4Cav8ZM.js +0 -53
  171. package/_getPrototype-CHAFQYL_.js +0 -5
  172. package/_getTag-BV_UoLYG.js +0 -90
  173. package/cloneDeep-BPVpFBzJ.js +0 -8
  174. package/components/display/markdown/DynamicTabs.d.ts +0 -8
  175. package/components/display/markdown/DynamicTabs.js +0 -21
  176. package/components/display/markdown/markdownPlugins/tabs.d.ts +0 -3
  177. package/components/display/markdown/markdownPlugins/tabs.js +0 -4
  178. package/countBy-DOutsa_w.js +0 -8
  179. package/debounce-DryYcbJ4.js +0 -56
  180. package/get-Bow1vKwx.js +0 -8
  181. package/groupBy-BheQYl6f.js +0 -8
  182. package/iconify-BBckr5AQ.js +0 -1263
  183. package/identity-ByMq8VxU.js +0 -6
  184. package/index-CnaCBNrd.js +0 -358
  185. package/index-E7g8cRyW.js +0 -568
  186. package/index-V7wwd05F.js +0 -975
  187. package/index-p5_wX7q1.js +0 -11729
  188. package/index-pQg5VUAZ.js +0 -12734
  189. package/isEmpty-g47Qir2A.js +0 -21
  190. package/isNil-CjWwlQS3.js +0 -6
  191. package/isObject-B53jY8Qg.js +0 -7
  192. package/isObjectLike-BatpeCIi.js +0 -29
  193. package/isSymbol-C3_SC0Qp.js +0 -8
  194. package/last-7CdUxN0r.js +0 -7
  195. package/sortBy-ITdmD17L.js +0 -79
  196. package/sumBy-DxJUU2E8.js +0 -8
  197. package/tabs-CgADNA57.js +0 -195
  198. package/toFinite-BMy6GObD.js +0 -14
  199. package/toNumber-YVhnnJv4.js +0 -31
  200. package/useClueTypeConfig-CneP98N_.js +0 -2260
  201. package/utils-CD0rFIFU.js +0 -2704
@@ -1,32 +1,36 @@
1
- import { jsx as r, jsxs as o } from "react/jsx-runtime";
2
- import { Box as n, Accordion as i, AccordionSummary as a, Typography as t, AccordionDetails as s } from "@mui/material";
3
- import c from "./display/icons/Iconified.js";
4
- import d from "react";
5
- class f extends d.Component {
6
- constructor(e) {
7
- super(e), this.state = { hasError: !1, error: null };
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Box, Accordion, AccordionSummary, Typography, AccordionDetails } from "@mui/material";
3
+ import Iconified from "./display/icons/Iconified.js";
4
+ import React__default from "react";
5
+ class ErrorBoundary extends React__default.Component {
6
+ constructor(props) {
7
+ super(props);
8
+ this.state = { hasError: false, error: null };
8
9
  }
9
- static getDerivedStateFromError(e) {
10
- return { hasError: !0, error: e };
10
+ static getDerivedStateFromError(error) {
11
+ return { hasError: true, error };
11
12
  }
12
- componentDidCatch(e) {
13
- this.setState({ hasError: !0, error: e });
13
+ componentDidCatch(error) {
14
+ this.setState({ hasError: true, error });
14
15
  }
15
16
  render() {
16
- return this.state.hasError ? /* @__PURE__ */ r(n, { pt: 6, textAlign: "center", fontSize: 20, children: /* @__PURE__ */ o(i, { elevation: 0, children: [
17
- /* @__PURE__ */ r(
18
- a,
19
- {
20
- expandIcon: /* @__PURE__ */ r(c, { icon: "ic:baseline-expand-more" }),
21
- "aria-controls": "panel1-content",
22
- id: "panel1-header",
23
- children: /* @__PURE__ */ r(t, { align: "center", sx: { width: "100%", fontSize: "1.2rem" }, variant: "h5", children: this.state.error.message })
24
- }
25
- ),
26
- /* @__PURE__ */ r(s, { children: /* @__PURE__ */ r("code", { children: /* @__PURE__ */ r(t, { variant: "h6", children: this.state.error.stack }) }) })
27
- ] }) }) : this.props.children;
17
+ if (this.state.hasError) {
18
+ return /* @__PURE__ */ jsx(Box, { pt: 6, textAlign: "center", fontSize: 20, children: /* @__PURE__ */ jsxs(Accordion, { elevation: 0, children: [
19
+ /* @__PURE__ */ jsx(
20
+ AccordionSummary,
21
+ {
22
+ expandIcon: /* @__PURE__ */ jsx(Iconified, { icon: "ic:baseline-expand-more" }),
23
+ "aria-controls": "panel1-content",
24
+ id: "panel1-header",
25
+ children: /* @__PURE__ */ jsx(Typography, { align: "center", sx: { width: "100%", fontSize: "1.2rem" }, variant: "h5", children: this.state.error.message })
26
+ }
27
+ ),
28
+ /* @__PURE__ */ jsx(AccordionDetails, { children: /* @__PURE__ */ jsx("code", { children: /* @__PURE__ */ jsx(Typography, { variant: "h6", children: this.state.error.stack }) }) })
29
+ ] }) });
30
+ }
31
+ return this.props.children;
28
32
  }
29
33
  }
30
34
  export {
31
- f as default
35
+ ErrorBoundary as default
32
36
  };
@@ -1,12 +1,13 @@
1
- import { jsx as n } from "react/jsx-runtime";
2
- import { Button as o } from "@mui/material";
3
- import { ClueComponentContext as i } from "../hooks/ClueComponentContext.js";
4
- import { useClueEnrichSelector as c } from "../hooks/selectors.js";
5
- import { u as m } from "../index-E7g8cRyW.js";
6
- const a = () => {
7
- const t = c((e) => e.enrichFailedEnrichments), { t: r } = m(i, (e) => e.i18next);
8
- return /* @__PURE__ */ n(o, { onClick: t, children: r("retry.enrich") });
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Button } from "@mui/material";
3
+ import { ClueComponentContext } from "../hooks/ClueComponentContext.js";
4
+ import { useClueEnrichSelector } from "../hooks/selectors.js";
5
+ import { u as useContextSelector } from "../index-BDVjGvMI.js";
6
+ const RetryFailedEnrichments = () => {
7
+ const enrichFailedEnrichments = useClueEnrichSelector((ctx) => ctx.enrichFailedEnrichments);
8
+ const { t } = useContextSelector(ClueComponentContext, (ctx) => ctx.i18next);
9
+ return /* @__PURE__ */ jsx(Button, { onClick: enrichFailedEnrichments, children: t("retry.enrich") });
9
10
  };
10
11
  export {
11
- a as default
12
+ RetryFailedEnrichments as default
12
13
  };
@@ -1,90 +1,98 @@
1
- import { jsxs as n, Fragment as v, jsx as l } from "react/jsx-runtime";
2
- import { Button as b, Popover as w, TextField as z, Divider as F, Stack as _, FormControlLabel as m, Checkbox as d } from "@mui/material";
3
- import { useClueComponentSelector as E, useClueEnrichSelector as a } from "../hooks/selectors.js";
4
- import { memo as P, useState as g, useEffect as T } from "react";
5
- const L = () => {
6
- const { t: r } = E((e) => e.i18next), o = a((e) => e.availableSources), t = a((e) => e.sources), c = a((e) => e.setSources), [s, i] = g(null), [h, x] = g(), C = (e) => {
7
- i(e.currentTarget);
8
- }, f = () => {
9
- i(null);
1
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
+ import { Button, Popover, TextField, Divider, Stack, FormControlLabel, Checkbox } from "@mui/material";
3
+ import { useClueComponentSelector, useClueEnrichSelector } from "../hooks/selectors.js";
4
+ import { memo, useState, useEffect } from "react";
5
+ const SourcePicker = () => {
6
+ const { t } = useClueComponentSelector((ctx) => ctx.i18next);
7
+ const availableSources = useClueEnrichSelector((state) => state.availableSources);
8
+ const sources = useClueEnrichSelector((state) => state.sources);
9
+ const setSources = useClueEnrichSelector((state) => state.setSources);
10
+ const [anchorEl, setAnchorEl] = useState(null);
11
+ const [sourceFilter, setSourceFilter] = useState();
12
+ const handleClick = (event) => {
13
+ setAnchorEl(event.currentTarget);
10
14
  };
11
- T(() => {
12
- c(o);
13
- }, [o]);
14
- const u = s ? "sources-popover" : void 0;
15
- return /* @__PURE__ */ n(v, { children: [
16
- /* @__PURE__ */ n(b, { "aria-describedby": u, variant: "outlined", onClick: C, children: [
17
- r("sources"),
15
+ const handleClose = () => {
16
+ setAnchorEl(null);
17
+ };
18
+ useEffect(() => {
19
+ setSources(availableSources);
20
+ }, [availableSources]);
21
+ const id = !!anchorEl ? "sources-popover" : void 0;
22
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
23
+ /* @__PURE__ */ jsxs(Button, { "aria-describedby": id, variant: "outlined", onClick: handleClick, children: [
24
+ t("sources"),
18
25
  " (",
19
- t.length === o.length ? r("all") : t.length,
26
+ sources.length === availableSources.length ? t("all") : sources.length,
20
27
  ")"
21
28
  ] }),
22
- /* @__PURE__ */ n(
23
- w,
29
+ /* @__PURE__ */ jsxs(
30
+ Popover,
24
31
  {
25
- id: u,
26
- open: !!s,
27
- anchorEl: s,
28
- onClose: f,
32
+ id,
33
+ open: !!anchorEl,
34
+ anchorEl,
35
+ onClose: handleClose,
29
36
  anchorOrigin: {
30
37
  vertical: "bottom",
31
38
  horizontal: "left"
32
39
  },
33
40
  children: [
34
- /* @__PURE__ */ l(
35
- z,
41
+ /* @__PURE__ */ jsx(
42
+ TextField,
36
43
  {
37
- fullWidth: !0,
44
+ fullWidth: true,
38
45
  sx: { p: 1, width: "350px" },
39
- placeholder: r("quicksearch.placeholder"),
40
- onChange: (e) => x(e.target.value.toLowerCase())
46
+ placeholder: t("quicksearch.placeholder"),
47
+ onChange: (event) => setSourceFilter(event.target.value.toLowerCase())
41
48
  }
42
49
  ),
43
- /* @__PURE__ */ l(F, { orientation: "horizontal" }),
44
- /* @__PURE__ */ n(_, { spacing: 0.5, m: 1, sx: { maxHeight: "500px", overflow: "auto" }, onClick: (e) => e.stopPropagation(), children: [
45
- /* @__PURE__ */ l(
46
- m,
50
+ /* @__PURE__ */ jsx(Divider, { orientation: "horizontal" }),
51
+ /* @__PURE__ */ jsxs(Stack, { spacing: 0.5, m: 1, sx: { maxHeight: "500px", overflow: "auto" }, onClick: (e) => e.stopPropagation(), children: [
52
+ /* @__PURE__ */ jsx(
53
+ FormControlLabel,
47
54
  {
48
- control: /* @__PURE__ */ l(
49
- d,
55
+ control: /* @__PURE__ */ jsx(
56
+ Checkbox,
50
57
  {
51
58
  size: "small",
52
- checked: t.length === o.length,
59
+ checked: sources.length === availableSources.length,
53
60
  sx: { mr: 1 },
54
- onChange: (e, p) => {
55
- c(p ? o : []);
61
+ onChange: (__, checked) => {
62
+ setSources(checked ? availableSources : []);
56
63
  }
57
64
  }
58
65
  ),
59
- label: t.length < o.length ? r("sources.select.all") : r("sources.select.none"),
66
+ label: sources.length < availableSources.length ? t("sources.select.all") : t("sources.select.none"),
60
67
  sx: { whiteSpace: "nowrap", textTransform: "capitalize" }
61
68
  }
62
69
  ),
63
- o.filter((e) => !h || e.toLowerCase().includes(h)).map((e) => /* @__PURE__ */ l(
64
- m,
70
+ availableSources.filter((source) => !sourceFilter || source.toLowerCase().includes(sourceFilter)).map((source) => /* @__PURE__ */ jsx(
71
+ FormControlLabel,
65
72
  {
66
- control: /* @__PURE__ */ l(
67
- d,
73
+ control: /* @__PURE__ */ jsx(
74
+ Checkbox,
68
75
  {
69
76
  size: "small",
70
- checked: t.includes(e),
71
- onChange: (p, S) => {
72
- c(S ? [...t, e] : t.filter((k) => k !== e));
77
+ checked: sources.includes(source),
78
+ onChange: (__, checked) => {
79
+ setSources(checked ? [...sources, source] : sources.filter((src) => src !== source));
73
80
  },
74
81
  sx: { mr: 1 }
75
82
  }
76
83
  ),
77
- label: e.replace(/[_-]/g, " "),
84
+ label: source.replace(/[_-]/g, " "),
78
85
  sx: { whiteSpace: "nowrap", textTransform: "capitalize" }
79
86
  },
80
- e
87
+ source
81
88
  ))
82
89
  ] })
83
90
  ]
84
91
  }
85
92
  )
86
93
  ] });
87
- }, B = P(L);
94
+ };
95
+ const SourcePicker$1 = memo(SourcePicker);
88
96
  export {
89
- B as default
97
+ SourcePicker$1 as default
90
98
  };
@@ -3,12 +3,12 @@ import "@jsonforms/material-renderers";
3
3
  import "@jsonforms/react";
4
4
  import "@mui/material";
5
5
  import "../display/icons/Iconified.js";
6
- import "../../index-CnaCBNrd.js";
6
+ import "../../index-Bi21Wb23.js";
7
7
  import "../../hooks/ClueComponentContext.js";
8
- import { A } from "../../ActionForm-Sw7D-KOE.js";
9
- import "../../utils-CD0rFIFU.js";
8
+ import { A } from "../../ActionForm-ByeOzpc4.js";
9
+ import "../../utils-7OtvGnmf.js";
10
10
  import "react";
11
- import "../../index-E7g8cRyW.js";
11
+ import "../../index-BDVjGvMI.js";
12
12
  import "../ErrorBoundary.js";
13
13
  import "./form/schemaAdapter.js";
14
14
  export {
@@ -1,79 +1,93 @@
1
- import { jsxs as f, Fragment as j, jsx as e } from "react/jsx-runtime";
2
- import { I as z } from "../../iconify-BBckr5AQ.js";
3
- import { useTheme as O, Tooltip as P, IconButton as D, CircularProgress as v, Button as w, Popover as B, Paper as M, Stack as p, Box as T, Typography as A, Divider as F } from "@mui/material";
4
- import E from "../display/icons/Iconified.js";
5
- import { ClueComponentContext as R } from "../../hooks/ClueComponentContext.js";
6
- import { useClueActionsSelector as c } from "../../hooks/selectors.js";
7
- import q from "../../hooks/useClueConfig.js";
8
- import { isAccessible as G } from "../../utils/classificationParser.js";
9
- import { useState as H, useRef as J, useMemo as K, useEffect as I } from "react";
10
- import { u as L } from "../../index-E7g8cRyW.js";
11
- import N from "../ClassificationChip.js";
12
- const ie = ({ show: s = !1, size: S = "small", selectors: i, multiples: m = !1 }) => {
13
- const { t: d } = L(R, (o) => o.i18next), h = O(), x = c((o) => o.availableActions), g = c((o) => o.refreshActions), _ = c((o) => o.executeAction), l = c((o) => o.loading), { config: b } = q(), [a, n] = H(s), u = J(null), y = K(
1
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
+ import { I as Icon } from "../../iconify-CXMreGTg.js";
3
+ import { useTheme, Tooltip, IconButton, CircularProgress, Button, Popover, Paper, Stack, Box, Typography, Divider } from "@mui/material";
4
+ import Iconified from "../display/icons/Iconified.js";
5
+ import { ClueComponentContext } from "../../hooks/ClueComponentContext.js";
6
+ import { useClueActionsSelector } from "../../hooks/selectors.js";
7
+ import useClueConfig from "../../hooks/useClueConfig.js";
8
+ import { isAccessible } from "../../utils/classificationParser.js";
9
+ import { useState, useRef, useMemo, useEffect } from "react";
10
+ import { u as useContextSelector } from "../../index-BDVjGvMI.js";
11
+ import ClassificationChip from "../ClassificationChip.js";
12
+ const ExecutePopover = ({ show = false, size = "small", selectors, multiples = false }) => {
13
+ const { t } = useContextSelector(ClueComponentContext, (ctx) => ctx.i18next);
14
+ const theme = useTheme();
15
+ const availableActions = useClueActionsSelector((ctx) => ctx.availableActions);
16
+ const refreshActions = useClueActionsSelector((ctx) => ctx.refreshActions);
17
+ const executeAction = useClueActionsSelector((ctx) => ctx.executeAction);
18
+ const loading = useClueActionsSelector((ctx) => ctx.loading);
19
+ const { config } = useClueConfig();
20
+ const [showExecuteMenu, setShowExecuteMenu] = useState(show);
21
+ const executeEl = useRef(null);
22
+ const actions = useMemo(
14
23
  () => Object.fromEntries(
15
- Object.entries(x).filter(
16
- ([o, t]) => {
17
- var k;
18
- return (!((k = t.supported_types) != null && k.length) || i.every((r) => t.supported_types.includes(r == null ? void 0 : r.type))) && (!m || t.accept_multiple || i.length === 1) && i.every((r) => G(t.classification, r.classification, b.c12nDef));
24
+ Object.entries(availableActions).filter(
25
+ ([__, action]) => {
26
+ var _a;
27
+ return (!((_a = action.supported_types) == null ? void 0 : _a.length) || selectors.every((value) => action.supported_types.includes(value == null ? void 0 : value.type))) && (!multiples || action.accept_multiple || selectors.length === 1) && selectors.every((value) => isAccessible(action.classification, value.classification, config.c12nDef));
19
28
  }
20
29
  )
21
30
  ),
22
- [x, b.c12nDef, m, i]
23
- ), C = Object.keys(y).length < 1 || l || i.length < 1;
24
- return I(() => {
25
- n(s);
26
- }, [s]), I(() => {
27
- a && g();
28
- }, [g, a]), /* @__PURE__ */ f(j, { children: [
29
- S === "small" ? /* @__PURE__ */ e(P, { ref: u, title: d("actions.execute"), children: /* @__PURE__ */ e("span", { style: { alignSelf: "center" }, children: /* @__PURE__ */ e(D, { onClick: () => n(!0), disabled: C, color: "success", children: l ? /* @__PURE__ */ e(v, { color: "success", size: "24px" }) : /* @__PURE__ */ e(E, { icon: "ic:outline-play-arrow" }) }) }) }) : /* @__PURE__ */ e(
30
- w,
31
+ [availableActions, config.c12nDef, multiples, selectors]
32
+ );
33
+ const actionDisabled = Object.keys(actions).length < 1 || loading || selectors.length < 1;
34
+ useEffect(() => {
35
+ setShowExecuteMenu(show);
36
+ }, [show]);
37
+ useEffect(() => {
38
+ if (showExecuteMenu) {
39
+ refreshActions();
40
+ }
41
+ }, [refreshActions, showExecuteMenu]);
42
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
43
+ size === "small" ? /* @__PURE__ */ jsx(Tooltip, { ref: executeEl, title: t("actions.execute"), children: /* @__PURE__ */ jsx("span", { style: { alignSelf: "center" }, children: /* @__PURE__ */ jsx(IconButton, { onClick: () => setShowExecuteMenu(true), disabled: actionDisabled, color: "success", children: loading ? /* @__PURE__ */ jsx(CircularProgress, { color: "success", size: "24px" }) : /* @__PURE__ */ jsx(Iconified, { icon: "ic:outline-play-arrow" }) }) }) }) : /* @__PURE__ */ jsx(
44
+ Button,
31
45
  {
32
- ref: u,
46
+ ref: executeEl,
33
47
  variant: "outlined",
34
48
  color: "success",
35
- disabled: C,
36
- startIcon: l ? /* @__PURE__ */ e(v, { color: "success", size: "20px" }) : /* @__PURE__ */ e(E, { icon: "ic:outline-play-arrow" }),
49
+ disabled: actionDisabled,
50
+ startIcon: loading ? /* @__PURE__ */ jsx(CircularProgress, { color: "success", size: "20px" }) : /* @__PURE__ */ jsx(Iconified, { icon: "ic:outline-play-arrow" }),
37
51
  sx: { alignSelf: "stretch" },
38
- onClick: () => n(!0),
39
- children: d("actions.execute")
52
+ onClick: () => setShowExecuteMenu(true),
53
+ children: t("actions.execute")
40
54
  }
41
55
  ),
42
- /* @__PURE__ */ e(
43
- B,
56
+ /* @__PURE__ */ jsx(
57
+ Popover,
44
58
  {
45
59
  sx: { zIndex: 2e3 },
46
- open: a,
47
- disablePortal: !0,
48
- onClose: () => n(!1),
49
- anchorEl: u.current,
60
+ open: showExecuteMenu,
61
+ disablePortal: true,
62
+ onClose: () => setShowExecuteMenu(false),
63
+ anchorEl: executeEl.current,
50
64
  anchorOrigin: { horizontal: "left", vertical: "bottom" },
51
- children: /* @__PURE__ */ e(M, { onClick: () => n(!1), children: /* @__PURE__ */ e(p, { divider: /* @__PURE__ */ e(F, { flexItem: !0, orientation: "horizontal" }), children: Object.entries(y).map(([o, t]) => /* @__PURE__ */ e(
52
- T,
65
+ children: /* @__PURE__ */ jsx(Paper, { onClick: () => setShowExecuteMenu(false), children: /* @__PURE__ */ jsx(Stack, { divider: /* @__PURE__ */ jsx(Divider, { flexItem: true, orientation: "horizontal" }), children: Object.entries(actions).map(([actionId, action]) => /* @__PURE__ */ jsx(
66
+ Box,
53
67
  {
54
68
  sx: {
55
69
  px: 3,
56
70
  py: 1,
57
71
  cursor: "pointer",
58
- transition: h.transitions.create("background-color"),
59
- "&:hover": { backgroundColor: h.palette.background.default }
72
+ transition: theme.transitions.create("background-color"),
73
+ "&:hover": { backgroundColor: theme.palette.background.default }
60
74
  },
61
- onClick: () => _(o, i),
62
- children: /* @__PURE__ */ f(p, { children: [
63
- /* @__PURE__ */ f(p, { direction: "row", spacing: 1, alignItems: "center", children: [
64
- t.action_icon && /* @__PURE__ */ e(z, { icon: t.action_icon }),
65
- /* @__PURE__ */ e(A, { variant: "body1", children: t.name }),
66
- /* @__PURE__ */ e(N, { size: "small", classification: t.classification })
75
+ onClick: () => executeAction(actionId, selectors),
76
+ children: /* @__PURE__ */ jsxs(Stack, { children: [
77
+ /* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", children: [
78
+ action.action_icon && /* @__PURE__ */ jsx(Icon, { icon: action.action_icon }),
79
+ /* @__PURE__ */ jsx(Typography, { variant: "body1", children: action.name }),
80
+ /* @__PURE__ */ jsx(ClassificationChip, { size: "small", classification: action.classification })
67
81
  ] }),
68
- t.summary && /* @__PURE__ */ e(A, { variant: "caption", color: "text.secondary", children: t.summary })
82
+ action.summary && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: action.summary })
69
83
  ] })
70
84
  },
71
- o
85
+ actionId
72
86
  )) }) })
73
87
  }
74
88
  )
75
89
  ] });
76
90
  };
77
91
  export {
78
- ie as default
92
+ ExecutePopover as default
79
93
  };
@@ -1,43 +1,14 @@
1
- import { jsx as o, jsxs as n } from "react/jsx-runtime";
2
- import { I as p } from "../../iconify-BBckr5AQ.js";
3
- import { Modal as d, Paper as s, Stack as e, Typography as r, Divider as f, Button as m } from "@mui/material";
4
- import { J as h } from "../../index-CnaCBNrd.js";
5
- import x from "../display/markdown/index.js";
6
- import { ClueComponentContext as y } from "../../hooks/ClueComponentContext.js";
7
- import { memo as u } from "react";
8
- import { u as g } from "../../index-E7g8cRyW.js";
9
- import v from "../ClassificationChip.js";
10
- import C from "../ErrorBoundary.js";
11
- const k = ({ result: i, onClose: a, show: l = !1 }) => {
12
- const { t: c } = g(y, (t) => t.i18next);
13
- if (!i)
14
- return null;
15
- try {
16
- return /* @__PURE__ */ o(d, { open: l, sx: { display: "flex", alignItems: "center", justifyContent: "center" }, onClose: a, children: /* @__PURE__ */ o(s, { sx: { maxHeight: "80%", maxWidth: "80%", height: "100%", p: 2, minWidth: "750px" }, children: /* @__PURE__ */ n(e, { spacing: 1, height: "100%", children: [
17
- /* @__PURE__ */ n(e, { direction: "row", spacing: 1, alignItems: "center", children: [
18
- i.action.action_icon && /* @__PURE__ */ o(p, { height: "1.5rem", icon: i.action.action_icon }),
19
- /* @__PURE__ */ o(r, { variant: "h5", children: i.action.name }),
20
- i.action.supported_types && /* @__PURE__ */ o(r, { variant: "caption", color: "text.secondary", children: i.action.supported_types.map((t) => t.toUpperCase()).join(", ") }),
21
- /* @__PURE__ */ o("div", { style: { flex: 1 } }),
22
- /* @__PURE__ */ o(v, { size: "small", classification: i.action.classification })
23
- ] }),
24
- /* @__PURE__ */ o(r, { variant: "body1", children: i.action.summary }),
25
- /* @__PURE__ */ o(f, { flexItem: !0 }),
26
- /* @__PURE__ */ n(C, { children: [
27
- i.format === "markdown" && /* @__PURE__ */ o(x, { md: i.output }),
28
- i.format === "json" && /* @__PURE__ */ o(h, { data: i.output, collapse: !0, forceCompact: !0 })
29
- ] }),
30
- /* @__PURE__ */ o("div", { style: { flex: 1 } }),
31
- /* @__PURE__ */ n(e, { direction: "row", spacing: 1, children: [
32
- /* @__PURE__ */ o("div", { style: { flex: 1 } }),
33
- i.link && /* @__PURE__ */ o(m, { variant: "outlined", component: "a", target: "_blank", href: i.link, children: c("details.open") }),
34
- /* @__PURE__ */ o(m, { variant: "outlined", color: "error", onClick: a, children: c("close") })
35
- ] })
36
- ] }) }) });
37
- } catch (t) {
38
- return console.warn(t), null;
39
- }
40
- }, W = u(k);
1
+ import "react/jsx-runtime";
2
+ import "../../iconify-CXMreGTg.js";
3
+ import "@mui/material";
4
+ import "../../index-Bi21Wb23.js";
5
+ import "../display/markdown/index.js";
6
+ import "../../hooks/ClueComponentContext.js";
7
+ import { R } from "../../ActionForm-ByeOzpc4.js";
8
+ import "react";
9
+ import "../../index-BDVjGvMI.js";
10
+ import "../ClassificationChip.js";
11
+ import "../ErrorBoundary.js";
41
12
  export {
42
- W as default
13
+ R as default
43
14
  };
@@ -1,28 +1,48 @@
1
- import { c as i } from "../../../cloneDeep-BPVpFBzJ.js";
2
- import { g as y } from "../../../get-Bow1vKwx.js";
3
- const c = (p) => {
4
- const r = [], l = i(p), a = {
5
- ...l,
1
+ import { c as cloneDeep } from "../../../cloneDeep-CjP5k9zW.js";
2
+ import { g as get } from "../../../get-D3C3lEU3.js";
3
+ const adaptSchema = (_schema) => {
4
+ const requiredFields = [];
5
+ const schema = cloneDeep(_schema);
6
+ const newSchema = {
7
+ ...schema,
6
8
  properties: Object.fromEntries(
7
- Object.entries(l.properties ?? {}).filter(([e]) => !["raw_data", "selector", "selectors"].includes(e)).map(([e, t]) => {
8
- var n, o;
9
- if (r.push(e), typeof t == "boolean")
10
- return [e, t];
11
- if (((n = t.anyOf) == null ? void 0 : n.length) === 2) {
12
- if (typeof t.anyOf[1] == "boolean")
13
- return [e, t];
14
- t.anyOf[1].type === "null" && typeof t.anyOf[0] != "boolean" && (t.anyOf[0].enum && (t.enum = t.anyOf[0].enum), t.type = [...Array.isArray(t.anyOf[0].type) ? t.anyOf[0].type : [t.anyOf[0].type], "null"], delete t.anyOf, r.pop());
9
+ Object.entries(schema.properties ?? {}).filter(([name]) => !["raw_data", "selector", "selectors", "context"].includes(name)).map(([name, def]) => {
10
+ var _a, _b;
11
+ requiredFields.push(name);
12
+ if (typeof def === "boolean") {
13
+ return [name, def];
15
14
  }
16
- return ((o = t.allOf) == null ? void 0 : o.length) > 0 && typeof t.allOf[0] != "boolean" && t.allOf[0].$ref && (t = {
17
- ...t,
18
- ...y(l, t.allOf[0].$ref.replace("#/", "").replaceAll("/", ".")),
19
- title: t.title
20
- }, delete t.allOf), [e, t];
15
+ if (((_a = def.anyOf) == null ? void 0 : _a.length) === 2) {
16
+ if (typeof def.anyOf[1] === "boolean") {
17
+ return [name, def];
18
+ }
19
+ if (def.anyOf[1].type === "null" && typeof def.anyOf[0] !== "boolean") {
20
+ if (def.anyOf[0].enum) {
21
+ def.enum = def.anyOf[0].enum;
22
+ }
23
+ def.type = [...Array.isArray(def.anyOf[0].type) ? def.anyOf[0].type : [def.anyOf[0].type], "null"];
24
+ delete def.anyOf;
25
+ requiredFields.pop();
26
+ }
27
+ }
28
+ if (((_b = def.allOf) == null ? void 0 : _b.length) > 0) {
29
+ if (typeof def.allOf[0] !== "boolean" && def.allOf[0].$ref) {
30
+ const newDef = {
31
+ ...def,
32
+ ...get(schema, def.allOf[0].$ref.replace("#/", "").replaceAll("/", ".")),
33
+ title: def.title
34
+ };
35
+ delete newDef.allOf;
36
+ return [name, newDef];
37
+ }
38
+ }
39
+ return [name, def];
21
40
  })
22
41
  )
23
42
  };
24
- return a.required = r, a;
43
+ newSchema.required = requiredFields;
44
+ return newSchema;
25
45
  };
26
46
  export {
27
- c as adaptSchema
47
+ adaptSchema
28
48
  };
@@ -1,18 +1,18 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import { IconButton as a } from "@mui/material";
3
- const m = (t) => {
4
- const { expand: o, ...r } = t;
5
- return /* @__PURE__ */ e(
6
- a,
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { IconButton } from "@mui/material";
3
+ const ExpandMoreButton = (props) => {
4
+ const { expand, ...other } = props;
5
+ return /* @__PURE__ */ jsx(
6
+ IconButton,
7
7
  {
8
- ...r,
8
+ ...other,
9
9
  sx: {
10
- transform: o ? "rotate(180deg)" : "rotate(0deg)",
11
- transition: (n) => n.transitions.create("transform")
10
+ transform: !expand ? "rotate(0deg)" : "rotate(180deg)",
11
+ transition: (theme) => theme.transitions.create("transform")
12
12
  }
13
13
  }
14
14
  );
15
15
  };
16
16
  export {
17
- m as default
17
+ ExpandMoreButton as default
18
18
  };