@cccsaurora/clue-ui 1.1.0-dev.91 → 1.1.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 (179) hide show
  1. package/ActionForm-myEAs2UC.js +435 -0
  2. package/AnnotationDetails-BdfWMISw.js +160 -0
  3. package/AnnotationPreview-CKMGCoUH.js +140 -0
  4. package/ClueEnrichContext-CrFpdYhh.js +414 -0
  5. package/FlexOne-BXWFOd1T.js +6 -0
  6. package/_Map-DXNg_Z-q.js +54 -0
  7. package/_MapCache-Cu25RRDU.js +129 -0
  8. package/_Uint8Array-DlJCtTvG.js +102 -0
  9. package/_baseAssignValue-CUmzp727.js +20 -0
  10. package/_baseClone-BlMmRXeX.js +208 -0
  11. package/_baseExtremum-P_0akmCi.js +27 -0
  12. package/_baseFlatten-CN7vDNEQ.js +72 -0
  13. package/_baseGet-Dgf6_xCm.js +80 -0
  14. package/_baseIsEqual-Cpjtfb3Q.js +173 -0
  15. package/_baseIteratee-CP1bocOX.js +95 -0
  16. package/_baseSlice-M5RKzt1A.js +10 -0
  17. package/_baseSum-wEbgNeUs.js +10 -0
  18. package/_baseUniq-tMFmk80M.js +61 -0
  19. package/_commonjsHelpers-DaMA6jEr.js +8 -0
  20. package/_createAggregator-B4Cav8ZM.js +53 -0
  21. package/_getPrototype-CHAFQYL_.js +5 -0
  22. package/_getTag-BV_UoLYG.js +90 -0
  23. package/cloneDeep-BPVpFBzJ.js +8 -0
  24. package/components/AnnotationBody.js +35 -49
  25. package/components/AnnotationDetailPopover.js +30 -36
  26. package/components/AnnotationDetails.js +6 -6
  27. package/components/AnnotationEntry.js +47 -50
  28. package/components/AnnotationPreview.js +5 -5
  29. package/components/ClassificationChip.d.ts +2 -1
  30. package/components/ClassificationChip.js +23 -44
  31. package/components/CountBadge.js +26 -31
  32. package/components/EnrichedCard.js +97 -110
  33. package/components/EnrichedChip.js +105 -130
  34. package/components/EnrichedTypography.js +107 -133
  35. package/components/ErrorBoundary.js +24 -28
  36. package/components/RetryFailedEnrichments.js +9 -10
  37. package/components/SourcePicker.js +49 -57
  38. package/components/actions/ActionForm.js +4 -4
  39. package/components/actions/ExecutePopover.js +50 -64
  40. package/components/actions/ResultModal.js +5 -5
  41. package/components/actions/form/schemaAdapter.js +23 -38
  42. package/components/display/graph/ExpandMoreButton.js +10 -10
  43. package/components/display/graph/elements/NodeCard.js +94 -92
  44. package/components/display/graph/elements/NodeTag.js +13 -15
  45. package/components/display/graph/index.js +202 -261
  46. package/components/display/graph/visualizations/Leaf.js +69 -88
  47. package/components/display/graph/visualizations/cloud/index.js +81 -98
  48. package/components/display/graph/visualizations/icons/BaseIcon.js +21 -26
  49. package/components/display/graph/visualizations/icons/BugIcon.js +12 -12
  50. package/components/display/graph/visualizations/icons/HostIcon.js +12 -12
  51. package/components/display/graph/visualizations/icons/NetworkIcon.js +12 -12
  52. package/components/display/graph/visualizations/icons/ProcessIcon.js +12 -12
  53. package/components/display/graph/visualizations/icons/TargetIcon.js +13 -13
  54. package/components/display/graph/visualizations/icons/index.js +13 -14
  55. package/components/display/graph/visualizations/panels/NodePanel.js +8 -10
  56. package/components/display/graph/visualizations/tree/BundleLine.js +81 -108
  57. package/components/display/graph/visualizations/tree/Triangle.js +13 -13
  58. package/components/display/graph/visualizations/tree/index.js +305 -407
  59. package/components/display/icons/Iconified.js +12 -27
  60. package/components/display/json/index.js +4 -4
  61. package/components/display/markdown/index.js +5761 -8662
  62. package/components/enrichment/EnrichPopover.js +47 -55
  63. package/components/fetchers/Fetcher.js +95 -123
  64. package/components/fetchers/PreviewModal.js +17 -20
  65. package/components/fetchers/StatusChip.js +17 -21
  66. package/components/group/Entry.js +11 -13
  67. package/components/group/Group.js +10 -13
  68. package/components/group/GroupControl.js +66 -77
  69. package/components/stats/QueryStatus.js +31 -41
  70. package/countBy-DOutsa_w.js +8 -0
  71. package/data/event.js +4 -6
  72. package/database/index.js +2 -2
  73. package/debounce-DryYcbJ4.js +56 -0
  74. package/get-Bow1vKwx.js +8 -0
  75. package/groupBy-BheQYl6f.js +8 -0
  76. package/hooks/ClueActionContext.js +7 -7
  77. package/hooks/ClueComponentContext.js +23 -29
  78. package/hooks/ClueConfigProvider.js +12 -14
  79. package/hooks/ClueDatabaseContext.js +13 -19
  80. package/hooks/ClueEnrichContext.js +8 -8
  81. package/hooks/ClueFetcherContext.js +46 -74
  82. package/hooks/ClueGroupContext.js +14 -17
  83. package/hooks/CluePopupContext.js +5 -5
  84. package/hooks/ClueProvider.js +10 -12
  85. package/hooks/selectors.js +10 -21
  86. package/hooks/useActionResult.js +2 -2
  87. package/hooks/useAnnotations.js +29 -45
  88. package/hooks/useClue.js +4 -6
  89. package/hooks/useClueActions.js +3 -3
  90. package/hooks/useClueConfig.js +4 -6
  91. package/hooks/useClueTypeConfig.js +3 -3
  92. package/hooks/useComparator.js +435 -722
  93. package/hooks/useErrors.js +18 -22
  94. package/hooks/useMyHighlights.js +36 -66
  95. package/hooks/useMyLocalStorage.js +37 -66
  96. package/iconify-BBckr5AQ.js +1263 -0
  97. package/icons/Action.js +49 -66
  98. package/icons/Assessment.js +68 -84
  99. package/icons/Context.js +63 -77
  100. package/icons/Opinion.js +65 -77
  101. package/icons/iconMap.js +2 -2
  102. package/identity-ByMq8VxU.js +6 -0
  103. package/index-BXxfAxFt.js +12734 -0
  104. package/index-C15OYgRY.js +358 -0
  105. package/index-E7g8cRyW.js +568 -0
  106. package/index-p5_wX7q1.js +11729 -0
  107. package/index-vF6IyBhz.js +975 -0
  108. package/isEmpty-g47Qir2A.js +21 -0
  109. package/isNil-CjWwlQS3.js +6 -0
  110. package/isObject-B53jY8Qg.js +7 -0
  111. package/isObjectLike-BatpeCIi.js +29 -0
  112. package/isSymbol-C3_SC0Qp.js +8 -0
  113. package/last-7CdUxN0r.js +7 -0
  114. package/main.js +62 -62
  115. package/package.json +2 -2
  116. package/sortBy-ITdmD17L.js +79 -0
  117. package/sumBy-DxJUU2E8.js +8 -0
  118. package/text/Frequency.js +23 -42
  119. package/toFinite-BMy6GObD.js +14 -0
  120. package/toNumber-YVhnnJv4.js +31 -0
  121. package/useClueTypeConfig-DyeBcXQX.js +2214 -0
  122. package/utils/chain.js +64 -91
  123. package/utils/classificationParser.js +256 -519
  124. package/utils/constants.js +10 -35
  125. package/utils/graph.js +45 -72
  126. package/utils/hashUtil.js +7 -7
  127. package/utils/line.js +81 -131
  128. package/utils/loggerUtil.js +3 -5
  129. package/utils/sessionStorage.js +27 -41
  130. package/utils/time.js +423 -423
  131. package/utils/utils.js +9 -9
  132. package/utils/window.js +10 -21
  133. package/utils-BnmI_6N8.js +130 -0
  134. package/ActionForm-ByeOzpc4.js +0 -555
  135. package/AnnotationDetails-DknbKDyl.js +0 -175
  136. package/AnnotationPreview-CQwKs8se.js +0 -188
  137. package/ClueEnrichContext-6NJfXpUB.js +0 -536
  138. package/FlexOne-BSYAhhtG.js +0 -9
  139. package/_Map-kgDsDYxq.js +0 -64
  140. package/_MapCache-DabaaWfq.js +0 -161
  141. package/_Uint8Array-BlVVH1tp.js +0 -129
  142. package/_baseAssignValue-CNbcU6Nb.js +0 -25
  143. package/_baseClone-D3a8Pa4T.js +0 -284
  144. package/_baseExtremum-B1o1zHjR.js +0 -33
  145. package/_baseFlatten-D4huXoEI.js +0 -92
  146. package/_baseGet-BSK_nnoz.js +0 -109
  147. package/_baseIsEqual-B5xLoweL.js +0 -238
  148. package/_baseIteratee-p6Nj07-n.js +0 -126
  149. package/_baseSlice-GAv_YFTT.js +0 -20
  150. package/_baseSum-D0WC1dN0.js +0 -13
  151. package/_baseUniq-CpupKWcL.js +0 -89
  152. package/_commonjsHelpers-DWwsNxpa.js +0 -8
  153. package/_createAggregator-BpVy5xMi.js +0 -63
  154. package/_getPrototype-D1LAdQKO.js +0 -5
  155. package/_getTag-D3ToyefI.js +0 -126
  156. package/cloneDeep-CjP5k9zW.js +0 -8
  157. package/countBy-C69WslUA.js +0 -14
  158. package/debounce-bV0h5FC5.js +0 -92
  159. package/get-D3C3lEU3.js +0 -8
  160. package/groupBy-DC2oOuBN.js +0 -14
  161. package/iconify-CXMreGTg.js +0 -1782
  162. package/identity-CPGTqrE4.js +0 -6
  163. package/index-BDVjGvMI.js +0 -696
  164. package/index-BbPn6-Mw.js +0 -15750
  165. package/index-Bi21Wb23.js +0 -465
  166. package/index-C3lkTD69.js +0 -1172
  167. package/index-CC12Ux-9.js +0 -17654
  168. package/isEmpty-BQkZubqU.js +0 -29
  169. package/isNil-CIubwp4T.js +0 -6
  170. package/isObject-FTY-5JQX.js +0 -7
  171. package/isObjectLike-OAgjjZye.js +0 -48
  172. package/isSymbol-Xd2FsJyp.js +0 -8
  173. package/last-CUCl67Im.js +0 -7
  174. package/sortBy-B-UKp4GT.js +0 -100
  175. package/sumBy-MYkDPHZL.js +0 -8
  176. package/toFinite-Bc55msYj.js +0 -16
  177. package/toNumber-DPxy1FBy.js +0 -39
  178. package/useClueTypeConfig-XvGvIw2S.js +0 -3201
  179. package/utils-7OtvGnmf.js +0 -200
@@ -0,0 +1,435 @@
1
+ import { jsx as o, jsxs as p } from "react/jsx-runtime";
2
+ import { materialRenderers as Je, materialCells as Oe } from "@jsonforms/material-renderers";
3
+ import { JsonForms as Pe } from "@jsonforms/react";
4
+ import { Modal as ne, Paper as ae, Stack as n, Typography as b, Divider as Z, LinearProgress as ze, Button as P, IconButton as He, Box as O, CircularProgress as Ve, Collapse as qe } from "@mui/material";
5
+ import ue from "./components/display/icons/Iconified.js";
6
+ import { J as Y } from "./index-C15OYgRY.js";
7
+ import { ClueComponentContext as W } from "./hooks/ClueComponentContext.js";
8
+ import { A as Be } from "./index-BXxfAxFt.js";
9
+ import { a as K } from "./useClueTypeConfig-DyeBcXQX.js";
10
+ import { d as he } from "./_baseGet-Dgf6_xCm.js";
11
+ import { b as Ne } from "./_baseSlice-M5RKzt1A.js";
12
+ import { i as Te } from "./utils-BnmI_6N8.js";
13
+ import { useState as w, useRef as Le, useMemo as S, useEffect as Q, memo as xe, useCallback as E } from "react";
14
+ import { u as A, c as Ue, a as Ge } from "./index-E7g8cRyW.js";
15
+ import z from "./components/ErrorBoundary.js";
16
+ import { adaptSchema as Ke } from "./components/actions/form/schemaAdapter.js";
17
+ import { I as Ze } from "./iconify-BBckr5AQ.js";
18
+ import pe from "./components/display/markdown/index.js";
19
+ import Ye from "./components/ClassificationChip.js";
20
+ import { SNACKBAR_EVENT_ID as B } from "./data/event.js";
21
+ import { dayjs as Qe } from "./utils/time.js";
22
+ import { safeDispatchEvent as N } from "./utils/window.js";
23
+ import Xe from "./hooks/useClue.js";
24
+ import { i as ge } from "./isNil-CjWwlQS3.js";
25
+ function We(e, l, c) {
26
+ var i = e.length;
27
+ return c = c === void 0 ? i : c, !l && c >= i ? e : Ne(e, l, c);
28
+ }
29
+ var Ae = "\\ud800-\\udfff", De = "\\u0300-\\u036f", eo = "\\ufe20-\\ufe2f", oo = "\\u20d0-\\u20ff", ro = De + eo + oo, so = "\\ufe0e\\ufe0f", to = "\\u200d", lo = RegExp("[" + to + Ae + ro + so + "]");
30
+ function ye(e) {
31
+ return lo.test(e);
32
+ }
33
+ function co(e) {
34
+ return e.split("");
35
+ }
36
+ var Ce = "\\ud800-\\udfff", io = "\\u0300-\\u036f", mo = "\\ufe20-\\ufe2f", fo = "\\u20d0-\\u20ff", po = io + mo + fo, no = "\\ufe0e\\ufe0f", ao = "[" + Ce + "]", X = "[" + po + "]", g = "\\ud83c[\\udffb-\\udfff]", uo = "(?:" + X + "|" + g + ")", ve = "[^" + Ce + "]", we = "(?:\\ud83c[\\udde6-\\uddff]){2}", Re = "[\\ud800-\\udbff][\\udc00-\\udfff]", ho = "\\u200d", be = uo + "?", ke = "[" + no + "]?", xo = "(?:" + ho + "(?:" + [ve, we, Re].join("|") + ")" + ke + be + ")*", yo = ke + be + xo, Co = "(?:" + [ve + X + "?", X, we, Re, ao].join("|") + ")", vo = RegExp(g + "(?=" + g + ")|" + Co + yo, "g");
37
+ function wo(e) {
38
+ return e.match(vo) || [];
39
+ }
40
+ function Ro(e) {
41
+ return ye(e) ? wo(e) : co(e);
42
+ }
43
+ function bo(e) {
44
+ return function(l) {
45
+ l = he(l);
46
+ var c = ye(l) ? Ro(l) : void 0, i = c ? c[0] : l.charAt(0), r = c ? We(c, 1).join("") : l.slice(1);
47
+ return i[e]() + r;
48
+ };
49
+ }
50
+ var ko = bo("toUpperCase");
51
+ function Eo(e) {
52
+ return ko(he(e).toLowerCase());
53
+ }
54
+ const So = (e, l = 2e3) => {
55
+ const [c, i] = w(e), r = Le(null), { getActionStatus: x } = Se(), a = S(() => e == null ? void 0 : e.task_id, [e == null ? void 0 : e.task_id]), f = S(() => e == null ? void 0 : e.actionId, [e == null ? void 0 : e.actionId]);
56
+ return Q(() => {
57
+ if ((e == null ? void 0 : e.outcome) !== "pending" || !a) return;
58
+ let y = !1;
59
+ const u = async () => {
60
+ const h = await x(f, a);
61
+ if (!h)
62
+ i({ outcome: "failure", done: !0 });
63
+ else if (h.outcome === "success" || h.outcome === "failure")
64
+ i({ ...h, done: !0 });
65
+ else {
66
+ if (y) return;
67
+ i({ ...h }), r.current = setTimeout(u, l);
68
+ }
69
+ };
70
+ return u(), () => {
71
+ y = !0, r.current && clearTimeout(r.current);
72
+ };
73
+ }, [f, x, l, e == null ? void 0 : e.outcome, a]), Q(() => {
74
+ i(e);
75
+ }, [e]), S(
76
+ () => e || c ? { ...e, ...c } : void 0,
77
+ [e, c]
78
+ );
79
+ }, Mo = ({ result: e, onClose: l, show: c = !1 }) => {
80
+ var x, a;
81
+ const { t: i } = A(W, (f) => f.i18next), r = So(e);
82
+ return r ? /* @__PURE__ */ o(ne, { open: c, sx: { display: "flex", alignItems: "center", justifyContent: "center" }, onClose: l, children: /* @__PURE__ */ o(ae, { sx: { maxHeight: "80%", maxWidth: "80%", height: "100%", p: 2, minWidth: "750px" }, children: /* @__PURE__ */ o(z, { children: /* @__PURE__ */ p(n, { spacing: 1, height: "100%", children: [
83
+ /* @__PURE__ */ p(n, { direction: "row", spacing: 1, alignItems: "center", children: [
84
+ r.action.action_icon && /* @__PURE__ */ o(Ze, { height: "1.5rem", icon: r.action.action_icon }),
85
+ /* @__PURE__ */ o(b, { variant: "h5", children: r.action.name }),
86
+ r.action.supported_types && /* @__PURE__ */ o(b, { variant: "caption", color: "text.secondary", children: r.action.supported_types.map((f) => f.toUpperCase()).join(", ") }),
87
+ /* @__PURE__ */ o("div", { style: { flex: 1 } }),
88
+ /* @__PURE__ */ o(Ye, { size: "small", classification: r.action.classification })
89
+ ] }),
90
+ /* @__PURE__ */ o(b, { variant: "body1", children: r.action.summary }),
91
+ /* @__PURE__ */ o(Z, { flexItem: !0 }),
92
+ r.done ? /* @__PURE__ */ o(z, { children: r.format === "markdown" ? /* @__PURE__ */ o(pe, { md: r.output }) : r.format === "json" ? /* @__PURE__ */ o(Y, { data: r.output, collapse: !0, forceCompact: !0 }) : /* @__PURE__ */ p(n, { sx: { overflowY: "auto" }, children: [
93
+ /* @__PURE__ */ o(pe, { md: "`" + r.format + "` is not recognized as a format in this application." }),
94
+ /* @__PURE__ */ o(Y, { data: r, collapse: !0, forceCompact: !0 })
95
+ ] }) }) : /* @__PURE__ */ p(n, { flex: 1, sx: { pt: 2, alignItems: "center" }, spacing: 1, children: [
96
+ r.summary && /* @__PURE__ */ o(b, { variant: "caption", children: r.summary }),
97
+ /* @__PURE__ */ o(
98
+ ze,
99
+ {
100
+ variant: (x = r.output) != null && x.progress ? "determinate" : "indeterminate",
101
+ value: ((a = r.output) == null ? void 0 : a.progress) * 100,
102
+ sx: { maxWidth: 500, width: "100%", borderRadius: (f) => f.shape.borderRadius }
103
+ }
104
+ )
105
+ ] }),
106
+ /* @__PURE__ */ o("div", { style: { flex: 1 } }),
107
+ /* @__PURE__ */ p(n, { direction: "row", spacing: 1, children: [
108
+ /* @__PURE__ */ o("div", { style: { flex: 1 } }),
109
+ r.link && /* @__PURE__ */ o(P, { variant: "outlined", component: "a", target: "_blank", href: r.link, children: i("details.open") }),
110
+ /* @__PURE__ */ o(P, { variant: "outlined", color: "error", onClick: l, children: i("close") })
111
+ ] })
112
+ ] }) }) }) }) : null;
113
+ }, jo = xe(Mo), Fo = new Be({ removeAdditional: !0, coerceTypes: !0, strict: !1 }), Ee = Ue(null), rr = ({
114
+ baseURL: e,
115
+ children: l,
116
+ classification: c,
117
+ includeContext: i,
118
+ getToken: r,
119
+ onNetworkCall: x
120
+ }) => {
121
+ const { t: a, i18n: f } = A(W, (s) => s.i18next), { ready: y } = Xe(), [u, h] = w(null), [H, m] = w({}), [T, F] = w(!1), [t, C] = w(null), [k, M] = w(!1), [$, Me] = w({}), j = S(() => {
122
+ const s = {}, v = r == null ? void 0 : r();
123
+ return v && (s.Authorization = `Bearer ${v}`), x ? x({ baseURL: e, headers: s }) : { baseURL: e, headers: s };
124
+ }, [e, r, x]), L = E(async () => {
125
+ if (!y)
126
+ return;
127
+ const s = await K.actions.get(j);
128
+ return s && Me(s), s;
129
+ }, [y, j]);
130
+ Q(() => {
131
+ L();
132
+ }, [e, y]);
133
+ const V = E(
134
+ (s, v, R) => JSON.stringify({ type: s, value: v, classification: R ?? c }),
135
+ [c]
136
+ ), D = E(
137
+ async (s, v, R, Fe) => {
138
+ const { forceMenu: se, onComplete: q, skipMenu: $e, skipResultModal: te, timeout: le, includeContext: _e, extraContext: ce } = {
139
+ forceMenu: !1,
140
+ skipMenu: !1,
141
+ onComplete: null,
142
+ timeout: null,
143
+ includeContext: i ?? !1,
144
+ extraContext: null,
145
+ ...Fe
146
+ };
147
+ if (!Object.keys($).includes(s))
148
+ throw new Error("Invalid action id");
149
+ const ie = v.map(
150
+ (d) => d.type === "telemetry" ? { ...d, value: JSON.stringify(d.value) } : d
151
+ ), _ = $[s], U = Fo.compile(_.params), G = { selectors: ie, ...R };
152
+ let I = null;
153
+ if (_e && (I = {
154
+ timestamp: Qe().toISOString(),
155
+ url: window.location,
156
+ language: (f == null ? void 0 : f.language) ?? "en"
157
+ }), ge(ce) || (I = {
158
+ ...I ?? {},
159
+ ...ce
160
+ }), M(!0), !U(G) || se) {
161
+ if ($e && !se)
162
+ throw console.error(`Form is not valid (${U.errors.length} errors)`), new Error("Form is not completed");
163
+ (u == null ? void 0 : u.id) === s && (console.error(`Form is not valid (${U.errors.length} errors)`), N(
164
+ new CustomEvent(B, {
165
+ detail: {
166
+ message: a("action.error.validation"),
167
+ level: "error"
168
+ }
169
+ })
170
+ )), h({
171
+ id: s,
172
+ action: _,
173
+ selectors: v,
174
+ params: G ?? {},
175
+ context: I,
176
+ onComplete: q,
177
+ timeout: le
178
+ });
179
+ return;
180
+ }
181
+ try {
182
+ const d = await K.actions.post(
183
+ s,
184
+ ie,
185
+ G ?? {},
186
+ I,
187
+ { timeout: le },
188
+ j
189
+ ), de = { ...d, actionId: s, action: _ };
190
+ q == null || q(de), m((me) => {
191
+ const Ie = v.map((J) => V(J.type, J.value, J.classification));
192
+ return {
193
+ ...me,
194
+ ...Ie.reduce(
195
+ (J, fe) => ({
196
+ ...J,
197
+ [fe]: [...me[fe] ?? [], de]
198
+ }),
199
+ {}
200
+ )
201
+ };
202
+ }), N(
203
+ new CustomEvent(B, {
204
+ detail: {
205
+ message: /* @__PURE__ */ p(n, { direction: "row", alignItems: "center", spacing: 0.5, width: "100%", children: [
206
+ /* @__PURE__ */ o(b, { children: d.summary }),
207
+ d.link && /* @__PURE__ */ o(He, { component: "a", href: d.link, size: "small", target: "_blank", children: /* @__PURE__ */ o(ue, { icon: "ic:baseline-open-in-new", fontSize: "small" }) })
208
+ ] }),
209
+ timeout: d.link ? null : 5e3,
210
+ level: d.outcome === "success" ? "success" : d.outcome === "pending" ? "info" : "error",
211
+ options: {
212
+ style: {
213
+ minWidth: 0
214
+ },
215
+ SnackbarProps: {
216
+ style: {
217
+ minWidth: 0
218
+ }
219
+ }
220
+ }
221
+ }
222
+ })
223
+ ), d.outcome === "success" && h(null), d.outcome === "pending" && (C({ ...d, actionId: s, action: _ }), te || F(!0)), d.format && (C({ ...d, actionId: s, action: _ }), d.format !== "pivot" && !te ? F(!0) : window.open(d.output, "_blank", "noreferrer"));
224
+ } catch (d) {
225
+ N(
226
+ new CustomEvent(B, {
227
+ detail: {
228
+ message: d.toString(),
229
+ level: "error"
230
+ }
231
+ })
232
+ );
233
+ } finally {
234
+ M(!1);
235
+ }
236
+ },
237
+ [$, i, V, f == null ? void 0 : f.language, j, u == null ? void 0 : u.id, a]
238
+ ), ee = E(
239
+ async (s, v) => {
240
+ try {
241
+ return await K.actions.status.get(s, v, {}, j);
242
+ } catch (R) {
243
+ N(
244
+ new CustomEvent(B, {
245
+ detail: {
246
+ message: R.toString(),
247
+ level: "error"
248
+ }
249
+ })
250
+ );
251
+ }
252
+ },
253
+ [j]
254
+ ), oe = E(() => {
255
+ h(null), M(!1);
256
+ }, []), re = E(
257
+ (s, v, R) => H[V(s, v, R)] ?? [],
258
+ [H, V]
259
+ ), je = S(
260
+ () => ({
261
+ availableActions: $,
262
+ executeAction: D,
263
+ cancelAction: oe,
264
+ getActionStatus: ee,
265
+ getActionResults: re,
266
+ loading: k,
267
+ refreshActions: L
268
+ }),
269
+ [$, oe, D, re, ee, k, L]
270
+ );
271
+ return /* @__PURE__ */ p(Ee.Provider, { value: je, children: [
272
+ l,
273
+ /* @__PURE__ */ p(z, { children: [
274
+ u && /* @__PURE__ */ o(Io, { runningActionData: u }),
275
+ /* @__PURE__ */ o(
276
+ jo,
277
+ {
278
+ show: T && !!t,
279
+ result: t,
280
+ onClose: () => F(!1)
281
+ }
282
+ )
283
+ ] })
284
+ ] });
285
+ }, Se = () => Ge(Ee), $o = Je.map((e) => ({
286
+ ...e,
287
+ renderer: ({ ...l }) => /* @__PURE__ */ o(z, { children: /* @__PURE__ */ o(e.renderer, { ...l }) })
288
+ })), _o = ({ runningActionData: e }) => {
289
+ const { executeAction: l, cancelAction: c } = Se(), { t: i } = A(W, (t) => t.i18next), [r, x] = w(!1), [a, f] = w(null), [y, u] = w(e == null ? void 0 : e.params), [h, H] = w(!1), m = S(
290
+ () => e != null && e.action ? { ...Ke(e.action.params), ...e.action.extra_schema ?? {} } : null,
291
+ [e == null ? void 0 : e.action]
292
+ ), T = S(
293
+ () => ({
294
+ type: "VerticalLayout",
295
+ elements: Object.entries((m == null ? void 0 : m.properties) ?? {}).sort(([t, C], [k, M]) => C.order || M.order ? C.order - M.order : +(m == null ? void 0 : m.required.includes(t)) - +(m == null ? void 0 : m.required.includes(k))).map(([t, C]) => {
296
+ var k;
297
+ return {
298
+ type: "Control",
299
+ scope: `#/properties/${t}`,
300
+ options: {
301
+ autocomplete: !!C.enum || ((k = C.options) == null ? void 0 : k.autocomplete),
302
+ showUnfocusedDescription: !0,
303
+ ...C.options
304
+ },
305
+ rule: C.rule
306
+ };
307
+ })
308
+ }),
309
+ [m == null ? void 0 : m.properties, m == null ? void 0 : m.required]
310
+ ), F = E(async () => {
311
+ try {
312
+ x(!0);
313
+ const t = {};
314
+ e != null && e.onComplete && (t.onComplete = e == null ? void 0 : e.onComplete), e != null && e.timeout && (t.timeout = e == null ? void 0 : e.timeout), await l(e == null ? void 0 : e.id, e == null ? void 0 : e.selectors, y, t);
315
+ } catch (t) {
316
+ console.error(t);
317
+ } finally {
318
+ x(!1);
319
+ }
320
+ }, [
321
+ l,
322
+ e == null ? void 0 : e.id,
323
+ e == null ? void 0 : e.selectors,
324
+ e == null ? void 0 : e.onComplete,
325
+ e == null ? void 0 : e.timeout,
326
+ y
327
+ ]);
328
+ if (e != null && e.action)
329
+ try {
330
+ return /* @__PURE__ */ o(ne, { open: !0, sx: { display: "flex", alignItems: "center", justifyContent: "center" }, onClose: c, children: /* @__PURE__ */ o(
331
+ ae,
332
+ {
333
+ sx: { maxHeight: "80%", maxWidth: "80%", height: "100%", px: 2, pt: 2, minWidth: "750px", overflow: "auto" },
334
+ children: /* @__PURE__ */ p(
335
+ n,
336
+ {
337
+ spacing: 1,
338
+ height: "100%",
339
+ sx: {
340
+ ".MuiFormHelperText-root": {
341
+ marginLeft: "0 !important",
342
+ "&:last-of-type": { mb: 3 }
343
+ }
344
+ },
345
+ children: [
346
+ /* @__PURE__ */ p(n, { direction: "row", spacing: 1, children: [
347
+ /* @__PURE__ */ p(n, { direction: "column", spacing: 1, children: [
348
+ /* @__PURE__ */ p(b, { variant: "h5", children: [
349
+ i("actions.executing"),
350
+ " ",
351
+ e == null ? void 0 : e.action.id.replace(/_/g, " ").split(" ").map(Eo).join(" ")
352
+ ] }),
353
+ (e == null ? void 0 : e.action.summary) && /* @__PURE__ */ o(b, { variant: "body1", color: "text.secondary", sx: { pb: 1.5 }, children: e == null ? void 0 : e.action.summary })
354
+ ] }),
355
+ /* @__PURE__ */ o(O, { flex: 1 }),
356
+ /* @__PURE__ */ o(O, { alignContent: "end", children: /* @__PURE__ */ o(
357
+ P,
358
+ {
359
+ variant: "outlined",
360
+ onClick: () => H((t) => !t),
361
+ startIcon: /* @__PURE__ */ o(
362
+ O,
363
+ {
364
+ component: "span",
365
+ sx: (t) => ({
366
+ transition: t.transitions.create("transform"),
367
+ transform: h ? "rotate(180deg)" : "rotate(0deg)"
368
+ }),
369
+ children: /* @__PURE__ */ o(ue, { icon: "ic:baseline-keyboard-double-arrow-right" })
370
+ }
371
+ ),
372
+ children: i(h ? "actions.json.hide" : "actions.json.show")
373
+ }
374
+ ) })
375
+ ] }),
376
+ /* @__PURE__ */ o(Z, { orientation: "horizontal", variant: "middle" }),
377
+ /* @__PURE__ */ o(O, { pt: 1.5 }),
378
+ /* @__PURE__ */ p(n, { flexGrow: 1, direction: "row", spacing: 1, children: [
379
+ /* @__PURE__ */ p(n, { direction: "column", flexGrow: 1, children: [
380
+ /* @__PURE__ */ o(z, { children: /* @__PURE__ */ o(
381
+ Pe,
382
+ {
383
+ schema: m,
384
+ uischema: T,
385
+ renderers: $o,
386
+ cells: Oe,
387
+ data: y,
388
+ onChange: ({ data: t, errors: C }) => {
389
+ Te(t, y) || u(t), f(C);
390
+ },
391
+ config: {}
392
+ }
393
+ ) }),
394
+ /* @__PURE__ */ p(n, { direction: "row", spacing: 1, pb: 1, children: [
395
+ /* @__PURE__ */ o("div", { style: { flex: 1 } }),
396
+ /* @__PURE__ */ o(P, { color: "error", variant: "outlined", onClick: c, children: i("cancel") }),
397
+ /* @__PURE__ */ o(
398
+ P,
399
+ {
400
+ color: "success",
401
+ variant: "outlined",
402
+ disabled: r || (a == null ? void 0 : a.length) > 0,
403
+ onClick: F,
404
+ endIcon: r && /* @__PURE__ */ o(Ve, { color: "inherit", size: 18 }),
405
+ children: i("actions.execute")
406
+ }
407
+ )
408
+ ] })
409
+ ] }),
410
+ /* @__PURE__ */ o(qe, { orientation: "horizontal", in: h, unmountOnExit: !0, mountOnEnter: !0, children: /* @__PURE__ */ p(n, { direction: "row", height: "100%", spacing: 1, children: [
411
+ /* @__PURE__ */ o(Z, { orientation: "vertical" }),
412
+ /* @__PURE__ */ p(n, { children: [
413
+ /* @__PURE__ */ o(b, { variant: "h5", children: i("action.data") }),
414
+ /* @__PURE__ */ o(O, { width: 600, height: "100%", children: /* @__PURE__ */ o(Y, { data: y, slotProps: { stack: { height: "100%" }, json: { name: !1 } } }) })
415
+ ] })
416
+ ] }) })
417
+ ] })
418
+ ]
419
+ }
420
+ )
421
+ }
422
+ ) });
423
+ } catch (t) {
424
+ return console.warn(t), null;
425
+ }
426
+ }, Io = xe(_o);
427
+ export {
428
+ Io as A,
429
+ rr as C,
430
+ jo as R,
431
+ Ee as a,
432
+ So as b,
433
+ Eo as c,
434
+ Se as u
435
+ };
@@ -0,0 +1,160 @@
1
+ import { jsxs as a, jsx as o } from "react/jsx-runtime";
2
+ import { I as u } from "./iconify-BBckr5AQ.js";
3
+ import { useTheme as M, Stack as l, Typography as s, Tooltip as x, Box as A, IconButton as E, CircularProgress as N, Chip as z, Accordion as $, AccordionSummary as j, AccordionDetails as _, Divider as S } from "@mui/material";
4
+ import g from "./components/display/icons/Iconified.js";
5
+ import { SNACKBAR_EVENT_ID as O } from "./data/event.js";
6
+ import { ClueComponentContext as F } from "./hooks/ClueComponentContext.js";
7
+ import { useClueEnrichSelector as H } from "./hooks/selectors.js";
8
+ import K from "./hooks/useAnnotations.js";
9
+ import L from "./hooks/useErrors.js";
10
+ import { ICON_MAP as T } from "./icons/iconMap.js";
11
+ import { safeDispatchEvent as U } from "./utils/window.js";
12
+ import { g as V } from "./groupBy-BheQYl6f.js";
13
+ import { u as W } from "./ClueEnrichContext-CrFpdYhh.js";
14
+ import { memo as G, useState as J, useMemo as k, useCallback as P, useEffect as Q } from "react";
15
+ import { u as X } from "./index-E7g8cRyW.js";
16
+ import Y from "./components/actions/ExecutePopover.js";
17
+ import Z from "./components/AnnotationEntry.js";
18
+ import q from "./components/ClassificationChip.js";
19
+ import R from "./components/enrichment/EnrichPopover.js";
20
+ function w(i) {
21
+ return i === null;
22
+ }
23
+ const ii = ({ enrichRequest: i, setReady: d, updatePosition: p }) => {
24
+ const v = M(), { t: c } = X(F, (n) => n.i18next), [r, I] = J("all"), y = H((n) => n.enrich), [t, C] = K(
25
+ i == null ? void 0 : i.type,
26
+ i == null ? void 0 : i.value,
27
+ i == null ? void 0 : i.classification,
28
+ { skipEnrichment: !0 }
29
+ ), m = L(i == null ? void 0 : i.value), B = k(
30
+ () => ["all", ...W((t ?? []).map((n) => n.type))],
31
+ [t]
32
+ ), b = k(() => V(t ?? [], "type"), [t]), h = P(async () => {
33
+ await y(i.type, i.value, {
34
+ classification: i.classification,
35
+ timeout: 15,
36
+ force: !0
37
+ });
38
+ }, [i, y]);
39
+ return Q(() => {
40
+ d && (d(i && !w(t)), p == null || p());
41
+ }, [t, i, d, p]), i && !w(t) && /* @__PURE__ */ a(l, { direction: "column", sx: { p: 1, width: "100%" }, spacing: 1, children: [
42
+ /* @__PURE__ */ a(l, { spacing: 1, children: [
43
+ /* @__PURE__ */ a(l, { direction: "row", spacing: 1, children: [
44
+ /* @__PURE__ */ a(l, { children: [
45
+ /* @__PURE__ */ a(l, { direction: "row", spacing: 1, children: [
46
+ /* @__PURE__ */ o(s, { variant: "body1", fontWeight: "bold", children: "Clue" }),
47
+ i.classification && /* @__PURE__ */ o(q, { size: "small", classification: i.classification })
48
+ ] }),
49
+ /* @__PURE__ */ a(s, { variant: "caption", color: "text.secondary", children: [
50
+ i.type.toLocaleUpperCase(),
51
+ " ",
52
+ c("enrichment")
53
+ ] })
54
+ ] }),
55
+ /* @__PURE__ */ o("div", { style: { flex: 1 } }),
56
+ /* @__PURE__ */ o(x, { title: c("refresh"), children: /* @__PURE__ */ o(A, { sx: { alignSelf: "center", m: -1 }, children: /* @__PURE__ */ o(E, { onClick: () => h(), disabled: C, children: C ? /* @__PURE__ */ o(N, { variant: "indeterminate", size: 20 }) : /* @__PURE__ */ o(g, { icon: "ic:baseline-replay", fontSize: "small" }) }) }) }),
57
+ /* @__PURE__ */ o(x, { title: c("clipboard"), children: /* @__PURE__ */ o(
58
+ E,
59
+ {
60
+ sx: { alignSelf: "center", m: -1 },
61
+ onClick: () => {
62
+ navigator.clipboard.writeText(i.value), U(
63
+ new CustomEvent(O, {
64
+ detail: {
65
+ message: `${i.value} ${c("clipboard.success")}`,
66
+ level: "success"
67
+ }
68
+ })
69
+ );
70
+ },
71
+ children: /* @__PURE__ */ o(g, { icon: "ic:outline-assignment", fontSize: "small" })
72
+ }
73
+ ) }),
74
+ /* @__PURE__ */ o(R, { selector: i }),
75
+ /* @__PURE__ */ o(Y, { selectors: [i] })
76
+ ] }),
77
+ /* @__PURE__ */ a(l, { direction: "row", spacing: 0.5, children: [
78
+ B.map((n, e) => /* @__PURE__ */ o(
79
+ z,
80
+ {
81
+ size: "small",
82
+ variant: n === r ? "filled" : "outlined",
83
+ icon: T[n] && /* @__PURE__ */ o(u, { icon: T[n] }),
84
+ label: /* @__PURE__ */ a(s, { variant: "caption", textTransform: "capitalize", children: [
85
+ n,
86
+ ":",
87
+ " ",
88
+ n === "all" ? t.length : t.filter((f) => f.type === n).length
89
+ ] }),
90
+ onClick: () => I(n)
91
+ },
92
+ e
93
+ )),
94
+ (m == null ? void 0 : m.length) > 0 && /* @__PURE__ */ o(
95
+ x,
96
+ {
97
+ title: /* @__PURE__ */ o("div", { onClick: (n) => n.stopPropagation(), children: m.map((n, e) => /* @__PURE__ */ a("div", { children: [
98
+ /* @__PURE__ */ o("span", { style: { textTransform: "capitalize" }, children: n.source.replace(/-/g, " ") }),
99
+ ":",
100
+ " ",
101
+ n.message
102
+ ] }, e)) }),
103
+ children: /* @__PURE__ */ o(
104
+ z,
105
+ {
106
+ size: "small",
107
+ variant: "outlined",
108
+ icon: /* @__PURE__ */ o(u, { icon: "material-symbols:timer-outline", color: v.palette.error.main }),
109
+ label: /* @__PURE__ */ a(s, { variant: "caption", textTransform: "capitalize", children: [
110
+ c("annotation.failed"),
111
+ ": ",
112
+ m.length
113
+ ] }),
114
+ onClick: h
115
+ }
116
+ )
117
+ }
118
+ )
119
+ ] })
120
+ ] }),
121
+ /* @__PURE__ */ o(A, {}),
122
+ Object.keys(b).filter((n) => !r || r === "all" || n === r).map((n, e) => /* @__PURE__ */ a(
123
+ $,
124
+ {
125
+ defaultExpanded: !0,
126
+ sx: {
127
+ marginTop: `${v.spacing(1)} !important`,
128
+ marginBottom: "0 !important",
129
+ "&:before": { height: 0 }
130
+ },
131
+ children: [
132
+ r === "all" && /* @__PURE__ */ o(
133
+ j,
134
+ {
135
+ expandIcon: /* @__PURE__ */ o(g, { icon: "ic:baseline-arrow-drop-down" }),
136
+ sx: {
137
+ minHeight: "initial !important",
138
+ mt: 0.5,
139
+ mb: 0,
140
+ px: 1,
141
+ "& .MuiAccordionSummary-content": { my: 0.5, mx: 0 },
142
+ "& .MuiAccordionSummary-content.Mui-expanded": { my: 0.5, mx: 0 }
143
+ },
144
+ children: /* @__PURE__ */ o(s, { variant: "body1", textTransform: "capitalize", children: n }, n)
145
+ }
146
+ ),
147
+ /* @__PURE__ */ a(_, { sx: { px: 1 }, children: [
148
+ r === "all" && /* @__PURE__ */ o(S, { orientation: "horizontal", sx: { mb: 1 } }),
149
+ /* @__PURE__ */ o(l, { spacing: 1, divider: /* @__PURE__ */ o(S, { orientation: "horizontal", flexItem: !0 }), children: b[n].map((f, D) => /* @__PURE__ */ o(Z, { annotation: f }, D)) })
150
+ ] })
151
+ ]
152
+ },
153
+ e
154
+ ))
155
+ ] });
156
+ }, hi = G(ii);
157
+ export {
158
+ hi as A,
159
+ w as i
160
+ };