@cccsaurora/clue-ui 1.2.3-dev.266 → 1.2.3

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 (183) hide show
  1. package/ActionForm-DlOXqMUx.js +4460 -0
  2. package/AnnotationDetails-Bk-p0F6h.js +160 -0
  3. package/AnnotationPreview-jzZvkCxJ.js +140 -0
  4. package/ClueEnrichContext-KqRuuWNS.js +418 -0
  5. package/FlexOne-BXWFOd1T.js +6 -0
  6. package/_MapCache-BiTi0iqu.js +180 -0
  7. package/_Uint8Array-BQNOM9Rr.js +101 -0
  8. package/_baseAssignValue-CNMLQZco.js +20 -0
  9. package/_baseClone-BnT-6pyM.js +207 -0
  10. package/_baseExtremum-Ca2EHgy2.js +16 -0
  11. package/_baseFlatten-Bfr_Molw.js +72 -0
  12. package/_baseGet-DSZygzyq.js +79 -0
  13. package/_baseIsEqual-VgvaAFZG.js +147 -0
  14. package/_baseIteratee-Dbfsw5z8.js +95 -0
  15. package/_baseSlice-M5RKzt1A.js +10 -0
  16. package/_baseSum-wEbgNeUs.js +10 -0
  17. package/_baseUniq-BJcj69PL.js +79 -0
  18. package/_commonjsHelpers-DaMA6jEr.js +8 -0
  19. package/_createAggregator-k3TuAnxT.js +53 -0
  20. package/_getPrototype-Cr1Mk7BC.js +5 -0
  21. package/_getTag-CK2Sffaq.js +90 -0
  22. package/_isIterateeCall-DkJP7Rbx.js +13 -0
  23. package/_setToArray-C7yMOeww.js +29 -0
  24. package/cloneDeep-CF8TtLHr.js +8 -0
  25. package/components/AnnotationBody.js +35 -49
  26. package/components/AnnotationDetailPopover.js +30 -36
  27. package/components/AnnotationDetails.js +7 -7
  28. package/components/AnnotationEntry.js +35 -35
  29. package/components/AnnotationPreview.js +5 -5
  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 +59 -75
  40. package/components/actions/ResultModal.js +4 -4
  41. package/components/actions/form/schemaAdapter.js +23 -39
  42. package/components/actions/formats/FileResult.js +59 -86
  43. package/components/actions/formats/index.js +10 -21
  44. package/components/display/graph/ExpandMoreButton.js +10 -10
  45. package/components/display/graph/elements/NodeCard.js +91 -111
  46. package/components/display/graph/elements/NodeTag.js +13 -15
  47. package/components/display/graph/index.js +202 -261
  48. package/components/display/graph/visualizations/Leaf.js +69 -88
  49. package/components/display/graph/visualizations/cloud/index.js +81 -98
  50. package/components/display/graph/visualizations/icons/BaseIcon.js +21 -26
  51. package/components/display/graph/visualizations/icons/BugIcon.js +12 -12
  52. package/components/display/graph/visualizations/icons/HostIcon.js +12 -12
  53. package/components/display/graph/visualizations/icons/NetworkIcon.js +12 -12
  54. package/components/display/graph/visualizations/icons/ProcessIcon.js +12 -12
  55. package/components/display/graph/visualizations/icons/TargetIcon.js +13 -13
  56. package/components/display/graph/visualizations/icons/index.js +13 -14
  57. package/components/display/graph/visualizations/panels/NodePanel.js +8 -10
  58. package/components/display/graph/visualizations/tree/BundleLine.js +81 -108
  59. package/components/display/graph/visualizations/tree/Triangle.js +13 -13
  60. package/components/display/graph/visualizations/tree/index.js +306 -408
  61. package/components/display/icons/Iconified.js +12 -27
  62. package/components/display/json/index.js +4 -4
  63. package/components/display/markdown/index.js +5770 -8678
  64. package/components/enrichment/EnrichPopover.js +46 -54
  65. package/components/fetchers/Fetcher.js +119 -158
  66. package/components/fetchers/PreviewModal.js +17 -20
  67. package/components/fetchers/StatusChip.js +17 -21
  68. package/components/group/Entry.js +11 -13
  69. package/components/group/Group.js +10 -13
  70. package/components/group/GroupControl.js +65 -76
  71. package/components/stats/QueryStatus.js +33 -43
  72. package/countBy-CdYegFSu.js +8 -0
  73. package/data/event.js +4 -6
  74. package/database/index.js +2 -2
  75. package/debounce-DryYcbJ4.js +56 -0
  76. package/get-CH7kz5Ix.js +8 -0
  77. package/groupBy-br8xmD2R.js +8 -0
  78. package/hooks/ClueActionContext.js +6 -6
  79. package/hooks/ClueComponentContext.js +23 -29
  80. package/hooks/ClueConfigProvider.js +12 -14
  81. package/hooks/ClueDatabaseContext.js +13 -19
  82. package/hooks/ClueEnrichContext.js +8 -8
  83. package/hooks/ClueFetcherContext.js +56 -83
  84. package/hooks/ClueGroupContext.js +14 -17
  85. package/hooks/CluePopupContext.js +5 -5
  86. package/hooks/ClueProvider.js +10 -12
  87. package/hooks/selectors.js +7 -7
  88. package/hooks/useActionResult.js +2 -2
  89. package/hooks/useAnnotations.js +31 -47
  90. package/hooks/useClue.js +4 -6
  91. package/hooks/useClueActions.js +3 -3
  92. package/hooks/useClueConfig.js +4 -6
  93. package/hooks/useClueTypeConfig.js +3 -3
  94. package/hooks/useComparator.js +435 -722
  95. package/hooks/useErrors.js +18 -22
  96. package/hooks/useFetcherResult.js +24 -33
  97. package/hooks/useMyHighlights.js +36 -66
  98. package/hooks/useMyLocalStorage.js +37 -66
  99. package/iconify-BBckr5AQ.js +1263 -0
  100. package/icons/Action.js +49 -66
  101. package/icons/Assessment.js +69 -85
  102. package/icons/Context.js +63 -77
  103. package/icons/Opinion.js +60 -76
  104. package/icons/iconMap.js +2 -2
  105. package/identity-ByMq8VxU.js +6 -0
  106. package/index-BHAe_V9n.js +12768 -0
  107. package/index-BK-zfYhR.js +358 -0
  108. package/index-CA5CUNZO.js +975 -0
  109. package/index-Dj5C04IX.js +568 -0
  110. package/index-p5_wX7q1.js +11729 -0
  111. package/isNil-CjWwlQS3.js +6 -0
  112. package/isObject-B53jY8Qg.js +7 -0
  113. package/isObjectLike-BatpeCIi.js +29 -0
  114. package/isSymbol-C3_SC0Qp.js +8 -0
  115. package/last-7CdUxN0r.js +7 -0
  116. package/main.js +60 -60
  117. package/maxBy-Bc0dYHcO.js +8 -0
  118. package/package.json +1 -1
  119. package/sortBy-DY2JBf9n.js +75 -0
  120. package/sumBy-DuMASLPd.js +8 -0
  121. package/text/Frequency.js +23 -42
  122. package/toFinite-BMy6GObD.js +14 -0
  123. package/toNumber-YVhnnJv4.js +31 -0
  124. package/useClueTypeConfig-Ct9Ygter.js +2292 -0
  125. package/utils/chain.js +65 -92
  126. package/utils/classificationParser.js +256 -519
  127. package/utils/constants.js +10 -35
  128. package/utils/graph.js +45 -72
  129. package/utils/hashUtil.js +7 -7
  130. package/utils/line.js +81 -131
  131. package/utils/loggerUtil.js +3 -5
  132. package/utils/sessionStorage.js +27 -41
  133. package/utils/time.js +423 -423
  134. package/utils/utils.js +9 -9
  135. package/utils/window.js +10 -21
  136. package/utils-DmwSUrum.js +129 -0
  137. package/ActionForm-uDp92tN2.js +0 -5941
  138. package/AnnotationDetails-DGYfOiWm.js +0 -175
  139. package/AnnotationPreview-bHObsb3P.js +0 -188
  140. package/ClueEnrichContext-CJEJxrgs.js +0 -541
  141. package/FlexOne-BSYAhhtG.js +0 -9
  142. package/_MapCache-WmuDdwuH.js +0 -222
  143. package/_Uint8Array-B7JqpgFX.js +0 -128
  144. package/_baseAssignValue-CGTuELqU.js +0 -25
  145. package/_baseClone-CkNrTyhm.js +0 -283
  146. package/_baseExtremum-kob8QXyt.js +0 -18
  147. package/_baseFlatten-jIR_sN_-.js +0 -92
  148. package/_baseGet-Bx3A4Qfp.js +0 -108
  149. package/_baseIsEqual-C5OTWzTk.js +0 -208
  150. package/_baseIteratee-avi7MX2o.js +0 -126
  151. package/_baseSlice-GAv_YFTT.js +0 -20
  152. package/_baseSum-D0WC1dN0.js +0 -13
  153. package/_baseUniq-BI9GIHMF.js +0 -115
  154. package/_commonjsHelpers-DWwsNxpa.js +0 -8
  155. package/_createAggregator-QD8MzKwe.js +0 -63
  156. package/_getPrototype-CU0j_POw.js +0 -5
  157. package/_getTag-Ckxxfr88.js +0 -126
  158. package/_isIterateeCall-Ds3sw2SF.js +0 -17
  159. package/_setToArray-CaPKQhcz.js +0 -33
  160. package/cloneDeep-DJrLSw8W.js +0 -8
  161. package/countBy-c6S3dvSW.js +0 -14
  162. package/debounce-bV0h5FC5.js +0 -92
  163. package/get-DSsNkRQs.js +0 -8
  164. package/groupBy-xqz-n0Vd.js +0 -14
  165. package/iconify-CXMreGTg.js +0 -1782
  166. package/identity-CPGTqrE4.js +0 -6
  167. package/index-AMfoEg_6.js +0 -696
  168. package/index-B6C2a_Lg.js +0 -1172
  169. package/index-C12gPw2W.js +0 -17698
  170. package/index-DCKkHTvx.js +0 -15750
  171. package/index-JcKyZeoY.js +0 -465
  172. package/isNil-CIubwp4T.js +0 -6
  173. package/isObject-FTY-5JQX.js +0 -7
  174. package/isObjectLike-OAgjjZye.js +0 -48
  175. package/isSymbol-Xd2FsJyp.js +0 -8
  176. package/last-CUCl67Im.js +0 -7
  177. package/maxBy-IKHzFrCS.js +0 -8
  178. package/sortBy-DfSj8IoJ.js +0 -96
  179. package/sumBy-D-hb_NY-.js +0 -8
  180. package/toFinite-Bc55msYj.js +0 -16
  181. package/toNumber-DPxy1FBy.js +0 -39
  182. package/useClueTypeConfig-Z1LFp01b.js +0 -3289
  183. package/utils-HmNPuoDB.js +0 -199
@@ -1,107 +1,80 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { a as api } from "../useClueTypeConfig-Z1LFp01b.js";
3
- import { SNACKBAR_EVENT_ID } from "../data/event.js";
4
- import { safeDispatchEvent } from "../utils/window.js";
5
- import { useState, useRef, useMemo, useCallback, useEffect } from "react";
6
- import { c as createContext } from "../index-AMfoEg_6.js";
7
- import useClue from "./useClue.js";
8
- import useClueConfig from "./useClueConfig.js";
9
- const ClueFetcherContext = createContext(null);
10
- const ClueFetcherProvider = ({
11
- baseURL,
12
- children,
13
- classification: _defaultClassification,
14
- getToken,
15
- onNetworkCall
1
+ import { jsx as P } from "react/jsx-runtime";
2
+ import { a as l } from "../useClueTypeConfig-Ct9Ygter.js";
3
+ import { SNACKBAR_EVENT_ID as R } from "../data/event.js";
4
+ import { safeDispatchEvent as x } from "../utils/window.js";
5
+ import { useState as C, useRef as T, useMemo as F, useCallback as h, useEffect as d } from "react";
6
+ import { c as _ } from "../index-Dj5C04IX.js";
7
+ import j from "./useClue.js";
8
+ import z from "./useClueConfig.js";
9
+ const H = _(null), U = ({
10
+ baseURL: c,
11
+ children: N,
12
+ classification: A,
13
+ getToken: i,
14
+ onNetworkCall: u
16
15
  }) => {
17
- var _a, _b;
18
- const clueConfig = useClueConfig();
19
- const { ready } = useClue();
20
- const [defaultClassification, setDefaultClasification] = useState(_defaultClassification);
21
- const [fetchCompleted, setFetchCompleted] = useState(false);
22
- const [fetchers, setFetchers] = useState({});
23
- const fetchRequests = useRef({});
24
- const requestConfig = useMemo(() => {
25
- const headers = {};
26
- const token = getToken == null ? void 0 : getToken();
27
- if (token) {
28
- headers.Authorization = `Bearer ${token}`;
29
- }
30
- const baseConfig = { baseURL, headers };
31
- return onNetworkCall ? onNetworkCall(baseConfig) : { baseURL, headers };
32
- }, [baseURL, getToken, onNetworkCall]);
33
- const getHashKey = useCallback(
34
- ({ type, value, classification }) => JSON.stringify({ type, value, classification: classification ?? defaultClassification }),
35
- [defaultClassification]
36
- );
37
- const fetchSelector = useCallback(
38
- async (fetcherId, selector) => {
39
- var _a2;
40
- if ((_a2 = fetchRequests.current[fetcherId]) == null ? void 0 : _a2[getHashKey(selector)]) {
41
- return fetchRequests.current[fetcherId][getHashKey(selector)];
42
- }
16
+ var v, y;
17
+ const m = z(), { ready: p } = j(), [a, q] = C(A), [g, w] = C(!1), [E, B] = C({}), n = T({}), o = F(() => {
18
+ const t = {}, e = i == null ? void 0 : i();
19
+ return e && (t.Authorization = `Bearer ${e}`), u ? u({ baseURL: c, headers: t }) : { baseURL: c, headers: t };
20
+ }, [c, i, u]), f = h(
21
+ ({ type: t, value: e, classification: r }) => JSON.stringify({ type: t, value: e, classification: r ?? a }),
22
+ [a]
23
+ ), S = h(
24
+ async (t, e) => {
25
+ var r;
26
+ if ((r = n.current[t]) != null && r[f(e)])
27
+ return n.current[t][f(e)];
43
28
  try {
44
- const result = api.fetchers.post(fetcherId, selector, requestConfig);
45
- if (!fetchRequests.current[fetcherId]) {
46
- fetchRequests.current[fetcherId] = {};
47
- }
48
- fetchRequests.current[fetcherId][getHashKey(selector)] = result;
49
- return await result;
50
- } catch (e) {
51
- safeDispatchEvent(
52
- new CustomEvent(SNACKBAR_EVENT_ID, {
29
+ const s = l.fetchers.post(t, e, o);
30
+ return n.current[t] || (n.current[t] = {}), n.current[t][f(e)] = s, await s;
31
+ } catch (s) {
32
+ x(
33
+ new CustomEvent(R, {
53
34
  detail: {
54
- message: e.toString(),
35
+ message: s.toString(),
55
36
  level: "error"
56
37
  }
57
38
  })
58
39
  );
59
40
  }
60
41
  },
61
- [getHashKey, requestConfig]
62
- );
63
- const getFetcherStatus = useCallback(
64
- async (fetcherId, taskId) => {
42
+ [f, o]
43
+ ), D = h(
44
+ async (t, e) => {
65
45
  try {
66
- const res = await api.fetchers.status.get(fetcherId, taskId, {}, requestConfig);
67
- return res;
68
- } catch (e) {
69
- safeDispatchEvent(
70
- new CustomEvent(SNACKBAR_EVENT_ID, {
46
+ return await l.fetchers.status.get(t, e, {}, o);
47
+ } catch (r) {
48
+ x(
49
+ new CustomEvent(R, {
71
50
  detail: {
72
- message: e.toString(),
51
+ message: r.toString(),
73
52
  level: "error"
74
53
  }
75
54
  })
76
55
  );
77
56
  }
78
57
  },
79
- [requestConfig]
58
+ [o]
80
59
  );
81
- useEffect(() => {
82
- var _a2, _b2, _c, _d;
83
- if (!defaultClassification && ((_b2 = (_a2 = clueConfig.config) == null ? void 0 : _a2.c12nDef) == null ? void 0 : _b2.UNRESTRICTED)) {
84
- setDefaultClasification((_d = (_c = clueConfig.config) == null ? void 0 : _c.c12nDef) == null ? void 0 : _d.UNRESTRICTED);
85
- }
86
- }, [(_b = (_a = clueConfig.config) == null ? void 0 : _a.c12nDef) == null ? void 0 : _b.UNRESTRICTED, defaultClassification]);
87
- useEffect(() => {
88
- if (!ready) {
89
- return;
90
- }
91
- api.fetchers.get(requestConfig).then(setFetchers).finally(() => setFetchCompleted(true));
92
- }, [baseURL, ready]);
93
- const context = useMemo(
60
+ d(() => {
61
+ var t, e, r, s;
62
+ !a && ((e = (t = m.config) == null ? void 0 : t.c12nDef) != null && e.UNRESTRICTED) && q((s = (r = m.config) == null ? void 0 : r.c12nDef) == null ? void 0 : s.UNRESTRICTED);
63
+ }, [(y = (v = m.config) == null ? void 0 : v.c12nDef) == null ? void 0 : y.UNRESTRICTED, a]), d(() => {
64
+ p && l.fetchers.get(o).then(B).finally(() => w(!0));
65
+ }, [c, p]);
66
+ const K = F(
94
67
  () => ({
95
- fetchSelector,
96
- getFetcherStatus,
97
- fetchers,
98
- fetchCompleted
68
+ fetchSelector: S,
69
+ getFetcherStatus: D,
70
+ fetchers: E,
71
+ fetchCompleted: g
99
72
  }),
100
- [fetchCompleted, fetchSelector, fetchers, getFetcherStatus]
73
+ [g, S, E, D]
101
74
  );
102
- return /* @__PURE__ */ jsx(ClueFetcherContext.Provider, { value: context, children });
75
+ return /* @__PURE__ */ P(H.Provider, { value: K, children: N });
103
76
  };
104
77
  export {
105
- ClueFetcherContext,
106
- ClueFetcherProvider
78
+ H as ClueFetcherContext,
79
+ U as ClueFetcherProvider
107
80
  };
@@ -1,23 +1,20 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { useState, useMemo } from "react";
3
- import { c as createContext } from "../index-AMfoEg_6.js";
4
- import { b as useClueEnrichSelector } from "../ActionForm-uDp92tN2.js";
5
- const ClueGroupContext = createContext(null);
6
- const ClueGroupProvider = ({ children, type, classification }) => {
7
- const defaultClassification = useClueEnrichSelector((ctx) => ctx.defaultClassification);
8
- const [values, setValues] = useState([]);
9
- const context = useMemo(
1
+ import { jsx as l } from "react/jsx-runtime";
2
+ import { useState as n, useMemo as c } from "react";
3
+ import { c as m } from "../index-Dj5C04IX.js";
4
+ import { b as f } from "../ActionForm-DlOXqMUx.js";
5
+ const C = m(null), G = ({ children: s, type: o, classification: t }) => {
6
+ const e = f((i) => i.defaultClassification), [r, u] = n([]), a = c(
10
7
  () => ({
11
- type,
12
- values,
13
- setValues,
14
- classification: classification ?? defaultClassification
8
+ type: o,
9
+ values: r,
10
+ setValues: u,
11
+ classification: t ?? e
15
12
  }),
16
- [classification, defaultClassification, type, values]
13
+ [t, e, o, r]
17
14
  );
18
- return /* @__PURE__ */ jsx(ClueGroupContext.Provider, { value: context, children });
15
+ return /* @__PURE__ */ l(C.Provider, { value: a, children: s });
19
16
  };
20
17
  export {
21
- ClueGroupContext,
22
- ClueGroupProvider
18
+ C as ClueGroupContext,
19
+ G as ClueGroupProvider
23
20
  };
@@ -1,12 +1,12 @@
1
1
  import "react/jsx-runtime";
2
2
  import "../components/AnnotationDetailPopover.js";
3
- import { C, a } from "../AnnotationPreview-bHObsb3P.js";
3
+ import { C as a, a as P } from "../AnnotationPreview-jzZvkCxJ.js";
4
4
  import "../data/event.js";
5
5
  import "../utils/window.js";
6
- import "../AnnotationDetails-DGYfOiWm.js";
6
+ import "../AnnotationDetails-Bk-p0F6h.js";
7
7
  import "react";
8
- import "../index-AMfoEg_6.js";
8
+ import "../index-Dj5C04IX.js";
9
9
  export {
10
- C as CluePopupContext,
11
- a as CluePopupProvider
10
+ a as CluePopupContext,
11
+ P as CluePopupProvider
12
12
  };
@@ -1,14 +1,12 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { C as ClueActionProvider } from "../ActionForm-uDp92tN2.js";
3
- import { ClueComponentProvider } from "./ClueComponentContext.js";
4
- import { ClueConfigProvider } from "./ClueConfigProvider.js";
5
- import { ClueDatabaseProvider } from "./ClueDatabaseContext.js";
6
- import { a as ClueEnrichProvider } from "../ClueEnrichContext-CJEJxrgs.js";
7
- import { ClueFetcherProvider } from "./ClueFetcherContext.js";
8
- import { a as CluePopupProvider } from "../AnnotationPreview-bHObsb3P.js";
9
- const ClueProvider = ({ children, ...props }) => {
10
- return /* @__PURE__ */ jsx(ClueComponentProvider, { ...props, children: /* @__PURE__ */ jsx(ClueConfigProvider, { config: props.config, children: /* @__PURE__ */ jsx(ClueDatabaseProvider, { ...props, children: /* @__PURE__ */ jsx(ClueEnrichProvider, { ...props, children: /* @__PURE__ */ jsx(ClueFetcherProvider, { ...props, children: /* @__PURE__ */ jsx(ClueActionProvider, { ...props, children: /* @__PURE__ */ jsx(CluePopupProvider, { children }) }) }) }) }) }) });
11
- };
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { C as i } from "../ActionForm-DlOXqMUx.js";
3
+ import { ClueComponentProvider as m } from "./ClueComponentContext.js";
4
+ import { ClueConfigProvider as n } from "./ClueConfigProvider.js";
5
+ import { ClueDatabaseProvider as t } from "./ClueDatabaseContext.js";
6
+ import { a as d } from "../ClueEnrichContext-KqRuuWNS.js";
7
+ import { ClueFetcherProvider as l } from "./ClueFetcherContext.js";
8
+ import { a as c } from "../AnnotationPreview-jzZvkCxJ.js";
9
+ const p = ({ children: o, ...e }) => /* @__PURE__ */ r(m, { ...e, children: /* @__PURE__ */ r(n, { config: e.config, children: /* @__PURE__ */ r(t, { ...e, children: /* @__PURE__ */ r(d, { ...e, children: /* @__PURE__ */ r(l, { ...e, children: /* @__PURE__ */ r(i, { ...e, children: /* @__PURE__ */ r(c, { children: o }) }) }) }) }) }) });
12
10
  export {
13
- ClueProvider
11
+ p as ClueProvider
14
12
  };
@@ -1,11 +1,11 @@
1
- import { a, d, b, c } from "../ActionForm-uDp92tN2.js";
1
+ import { a as l, d as u, b as i, c as m } from "../ActionForm-DlOXqMUx.js";
2
2
  import "./ClueComponentContext.js";
3
- import "../ClueEnrichContext-CJEJxrgs.js";
3
+ import "../ClueEnrichContext-KqRuuWNS.js";
4
4
  import "./ClueFetcherContext.js";
5
- import "../index-AMfoEg_6.js";
5
+ import "../index-Dj5C04IX.js";
6
6
  export {
7
- a as useClueActionsSelector,
8
- d as useClueComponentSelector,
9
- b as useClueEnrichSelector,
10
- c as useClueFetcherSelector
7
+ l as useClueActionsSelector,
8
+ u as useClueComponentSelector,
9
+ i as useClueEnrichSelector,
10
+ m as useClueFetcherSelector
11
11
  };
@@ -1,5 +1,5 @@
1
1
  import "react";
2
- import { f } from "../ActionForm-uDp92tN2.js";
2
+ import { f as r } from "../ActionForm-DlOXqMUx.js";
3
3
  export {
4
- f as useActionResult
4
+ r as useActionResult
5
5
  };
@@ -1,76 +1,60 @@
1
- import { u as uniqBy } from "../ClueEnrichContext-CJEJxrgs.js";
2
- import { useContext, useMemo, useState, useEffect } from "react";
3
- import { ClueDatabaseContext } from "./ClueDatabaseContext.js";
4
- import { b as useClueEnrichSelector } from "../ActionForm-uDp92tN2.js";
5
- const useAnnotations = (type, value, _classification, { skipEnrichment } = { skipEnrichment: false }) => {
6
- const database = useContext(ClueDatabaseContext);
7
- const defaultClassification = useClueEnrichSelector((ctx) => ctx.defaultClassification);
8
- const enrichReady = useClueEnrichSelector((ctx) => ctx.ready);
9
- const availableSources = useClueEnrichSelector((ctx) => ctx.availableSources);
10
- const queueEnrich = useClueEnrichSelector((state) => state.queueEnrich);
11
- const classification = useMemo(
12
- () => _classification ?? defaultClassification,
13
- [_classification, defaultClassification]
1
+ import { u as p } from "../ClueEnrichContext-KqRuuWNS.js";
2
+ import { useContext as q, useMemo as d, useState as h, useEffect as u } from "react";
3
+ import { ClueDatabaseContext as A } from "./ClueDatabaseContext.js";
4
+ import { b as i } from "../ActionForm-DlOXqMUx.js";
5
+ const D = (n, o, l, { skipEnrichment: a } = { skipEnrichment: !1 }) => {
6
+ const s = q(A), f = i((t) => t.defaultClassification), m = i((t) => t.ready), g = i((t) => t.availableSources), b = i((t) => t.queueEnrich), e = d(
7
+ () => l ?? f,
8
+ [l, f]
9
+ ), [$, C] = h(!1), [S, x] = h([]), r = d(
10
+ () => m && !!n && !!o && !!e,
11
+ [e, m, n, o]
14
12
  );
15
- const [loading, setLoading] = useState(false);
16
- const [annotations, setAnnotations] = useState([]);
17
- const ready = useMemo(
18
- () => enrichReady && !!type && !!value && !!classification,
19
- [classification, enrichReady, type, value]
20
- );
21
- useEffect(() => {
22
- if (!ready || !(database == null ? void 0 : database.status)) {
13
+ return u(() => {
14
+ if (!r || !(s != null && s.status))
23
15
  return;
24
- }
25
- if (database == null ? void 0 : database.status.closed) {
16
+ if (s != null && s.status.closed) {
26
17
  console.warn("Status collection is closed");
27
18
  return;
28
19
  }
29
- const observable = database.status.count({ selector: { type, value, classification, status: "in-progress" } }).$.subscribe((_count) => setLoading(_count > 0));
20
+ const t = s.status.count({ selector: { type: n, value: o, classification: e, status: "in-progress" } }).$.subscribe((c) => C(c > 0));
30
21
  return () => {
31
- observable == null ? void 0 : observable.unsubscribe();
22
+ t == null || t.unsubscribe();
32
23
  };
33
- }, [classification, database, ready, type, value]);
34
- useEffect(() => {
35
- if (skipEnrichment || availableSources.length < 1 || !ready) {
24
+ }, [e, s, r, n, o]), u(() => {
25
+ a || g.length < 1 || !r || b(n, o, e);
26
+ }, [g.length, e, b, r, a, n, o]), u(() => {
27
+ if (!r || !(s != null && s.selectors) || s.selectors.closed)
36
28
  return;
37
- }
38
- queueEnrich(type, value, classification);
39
- }, [availableSources.length, classification, queueEnrich, ready, skipEnrichment, type, value]);
40
- useEffect(() => {
41
- if (!ready || !(database == null ? void 0 : database.selectors) || database.selectors.closed) {
42
- return;
43
- }
44
- const observable = database.selectors.find({
29
+ const t = s.selectors.find({
45
30
  selector: {
46
31
  $or: [
47
32
  {
48
33
  // Use regex instead of exact value for case-insensitivity
49
- value: { $regex: `^${value}$`, $options: "i" }
34
+ value: { $regex: `^${o}$`, $options: "i" }
50
35
  },
51
36
  {
52
- value
37
+ value: o
53
38
  }
54
39
  ]
55
40
  }
56
41
  }).$.subscribe(
57
- (result) => setAnnotations(
58
- uniqBy(
59
- result.flatMap((entry) => entry.getAnnotations()),
42
+ (c) => x(
43
+ p(
44
+ c.flatMap((E) => E.getAnnotations()),
60
45
  JSON.stringify
61
46
  )
62
47
  )
63
48
  );
64
49
  return () => {
65
50
  try {
66
- observable.unsubscribe();
67
- } catch (e) {
68
- console.warn(e);
51
+ t.unsubscribe();
52
+ } catch (c) {
53
+ console.warn(c);
69
54
  }
70
55
  };
71
- }, [database, ready, value]);
72
- return [annotations, loading];
56
+ }, [s, r, o]), [S, $];
73
57
  };
74
58
  export {
75
- useAnnotations as default
59
+ D as default
76
60
  };
package/hooks/useClue.js CHANGED
@@ -1,8 +1,6 @@
1
- import { a as useContext } from "../index-AMfoEg_6.js";
2
- import { C as ClueEnrichContext } from "../ClueEnrichContext-CJEJxrgs.js";
3
- const useClue = () => {
4
- return useContext(ClueEnrichContext);
5
- };
1
+ import { a as t } from "../index-Dj5C04IX.js";
2
+ import { C as e } from "../ClueEnrichContext-KqRuuWNS.js";
3
+ const s = () => t(e);
6
4
  export {
7
- useClue as default
5
+ s as default
8
6
  };
@@ -1,5 +1,5 @@
1
- import { u } from "../ActionForm-uDp92tN2.js";
2
- import "../index-AMfoEg_6.js";
1
+ import { u as a } from "../ActionForm-DlOXqMUx.js";
2
+ import "../index-Dj5C04IX.js";
3
3
  export {
4
- u as default
4
+ a as default
5
5
  };
@@ -1,8 +1,6 @@
1
- import { ClueConfigContext } from "./ClueConfigProvider.js";
2
- import { useContext } from "react";
3
- const useClueConfig = () => {
4
- return useContext(ClueConfigContext);
5
- };
1
+ import { ClueConfigContext as o } from "./ClueConfigProvider.js";
2
+ import { useContext as t } from "react";
3
+ const n = () => t(o);
6
4
  export {
7
- useClueConfig as default
5
+ n as default
8
6
  };
@@ -1,7 +1,7 @@
1
- import { b } from "../useClueTypeConfig-Z1LFp01b.js";
1
+ import { b as i } from "../useClueTypeConfig-Ct9Ygter.js";
2
2
  import "../utils/loggerUtil.js";
3
- import "../_baseUniq-BI9GIHMF.js";
3
+ import "../_baseUniq-BJcj69PL.js";
4
4
  import "react";
5
5
  export {
6
- b as default
6
+ i as default
7
7
  };