@cccsaurora/clue-ui 1.0.1-dev.70 → 1.0.2-patch.38

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 (184) hide show
  1. package/ActionForm-Sw7D-KOE.js +340 -0
  2. package/AnnotationDetails-BoX61_IF.js +160 -0
  3. package/AnnotationPreview-dYinoSA9.js +140 -0
  4. package/ClueEnrichContext-CvCIPOMC.js +412 -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-C6fGbg64.js +6 -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 +34 -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.js +23 -44
  30. package/components/CountBadge.js +26 -31
  31. package/components/EnrichedCard.js +92 -104
  32. package/components/EnrichedChip.js +109 -134
  33. package/components/EnrichedTypography.js +110 -136
  34. package/components/ErrorBoundary.js +24 -28
  35. package/components/RetryFailedEnrichments.js +9 -10
  36. package/components/SourcePicker.js +49 -57
  37. package/components/actions/ActionForm.js +4 -4
  38. package/components/actions/ExecutePopover.js +50 -64
  39. package/components/actions/ResultModal.js +34 -37
  40. package/components/actions/form/schemaAdapter.js +20 -39
  41. package/components/display/graph/ExpandMoreButton.js +10 -10
  42. package/components/display/graph/elements/NodeCard.js +76 -92
  43. package/components/display/graph/elements/NodeTag.js +13 -15
  44. package/components/display/graph/index.js +200 -258
  45. package/components/display/graph/visualizations/Leaf.js +69 -88
  46. package/components/display/graph/visualizations/cloud/index.js +81 -98
  47. package/components/display/graph/visualizations/icons/BaseIcon.js +21 -26
  48. package/components/display/graph/visualizations/icons/BugIcon.js +12 -12
  49. package/components/display/graph/visualizations/icons/HostIcon.js +12 -12
  50. package/components/display/graph/visualizations/icons/NetworkIcon.js +12 -12
  51. package/components/display/graph/visualizations/icons/ProcessIcon.js +12 -12
  52. package/components/display/graph/visualizations/icons/TargetIcon.js +13 -13
  53. package/components/display/graph/visualizations/icons/index.js +13 -14
  54. package/components/display/graph/visualizations/panels/NodePanel.js +8 -10
  55. package/components/display/graph/visualizations/tree/BundleLine.js +81 -108
  56. package/components/display/graph/visualizations/tree/Triangle.js +13 -13
  57. package/components/display/graph/visualizations/tree/index.js +305 -407
  58. package/components/display/icons/Iconified.js +12 -27
  59. package/components/display/json/index.js +4 -4
  60. package/components/display/markdown/DynamicTabs.js +17 -22
  61. package/components/display/markdown/index.js +5674 -8531
  62. package/components/display/markdown/markdownPlugins/tabs.js +1 -1
  63. package/components/enrichment/EnrichPopover.js +47 -55
  64. package/components/fetchers/Fetcher.js +95 -123
  65. package/components/fetchers/PreviewModal.js +17 -20
  66. package/components/fetchers/StatusChip.js +18 -22
  67. package/components/group/Entry.js +11 -13
  68. package/components/group/Group.js +10 -13
  69. package/components/group/GroupControl.js +65 -76
  70. package/components/stats/QueryStatus.js +28 -37
  71. package/countBy-DOutsa_w.js +8 -0
  72. package/data/event.js +4 -6
  73. package/database/index.js +2 -2
  74. package/debounce-DryYcbJ4.js +56 -0
  75. package/get-Bow1vKwx.js +8 -0
  76. package/groupBy-BheQYl6f.js +8 -0
  77. package/hooks/ClueActionContext.js +6 -6
  78. package/hooks/ClueComponentContext.js +23 -29
  79. package/hooks/ClueConfigProvider.js +12 -14
  80. package/hooks/ClueDatabaseContext.js +13 -19
  81. package/hooks/ClueEnrichContext.js +8 -8
  82. package/hooks/ClueEnrichContextType.d.ts +7 -0
  83. package/hooks/ClueFetcherContext.js +46 -74
  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 +11 -22
  88. package/hooks/useAnnotations.js +29 -45
  89. package/hooks/useClue.js +4 -6
  90. package/hooks/useClueActions.js +3 -3
  91. package/hooks/useClueConfig.js +5 -5
  92. package/hooks/useClueTypeConfig.js +3 -3
  93. package/hooks/useComparator.js +435 -722
  94. package/hooks/useErrors.js +18 -22
  95. package/hooks/useMyHighlights.js +36 -66
  96. package/hooks/useMyLocalStorage.js +43 -63
  97. package/iconify-BBckr5AQ.js +1263 -0
  98. package/icons/Action.js +49 -66
  99. package/icons/Assessment.js +68 -84
  100. package/icons/Context.js +61 -75
  101. package/icons/Opinion.js +65 -77
  102. package/icons/iconMap.js +2 -2
  103. package/identity-ByMq8VxU.js +6 -0
  104. package/index-CnaCBNrd.js +358 -0
  105. package/index-E7g8cRyW.js +568 -0
  106. package/index-V7wwd05F.js +975 -0
  107. package/index-p5_wX7q1.js +11729 -0
  108. package/index-pQg5VUAZ.js +12734 -0
  109. package/isEmpty-g47Qir2A.js +21 -0
  110. package/isNil-CjWwlQS3.js +6 -0
  111. package/isObject-B53jY8Qg.js +7 -0
  112. package/isObjectLike-BatpeCIi.js +29 -0
  113. package/isSymbol-C3_SC0Qp.js +8 -0
  114. package/last-7CdUxN0r.js +7 -0
  115. package/main.d.ts +3 -2
  116. package/main.js +62 -58
  117. package/package.json +1 -1
  118. package/sortBy-ITdmD17L.js +79 -0
  119. package/sumBy-DxJUU2E8.js +8 -0
  120. package/tabs-CgADNA57.js +195 -0
  121. package/text/Frequency.js +23 -42
  122. package/toFinite-BMy6GObD.js +14 -0
  123. package/toNumber-YVhnnJv4.js +31 -0
  124. package/types/config.d.ts +4 -1
  125. package/useClueTypeConfig-CneP98N_.js +2260 -0
  126. package/utils/chain.js +64 -91
  127. package/utils/classificationParser.d.ts +8 -8
  128. package/utils/classificationParser.js +257 -520
  129. package/utils/constants.js +10 -35
  130. package/utils/graph.js +45 -72
  131. package/utils/hashUtil.js +7 -7
  132. package/utils/line.js +81 -131
  133. package/utils/loggerUtil.js +3 -5
  134. package/utils/sessionStorage.js +29 -41
  135. package/utils/utils.js +9 -9
  136. package/utils/window.js +10 -21
  137. package/utils-CD0rFIFU.js +2704 -0
  138. package/ActionForm-D4ryHO0M.js +0 -436
  139. package/AnnotationDetails-YAPoqw3R.js +0 -175
  140. package/AnnotationPreview-DiQDjt9s.js +0 -188
  141. package/ClueEnrichContext-DIn6g8tw.js +0 -522
  142. package/FlexOne-BSYAhhtG.js +0 -9
  143. package/_Map-kgDsDYxq.js +0 -64
  144. package/_MapCache-DabaaWfq.js +0 -161
  145. package/_Uint8Array-BlVVH1tp.js +0 -129
  146. package/_baseAssignValue-CNbcU6Nb.js +0 -25
  147. package/_baseClone-D3a8Pa4T.js +0 -284
  148. package/_baseExtremum-B1o1zHjR.js +0 -33
  149. package/_baseFlatten-D4huXoEI.js +0 -92
  150. package/_baseGet-BSK_nnoz.js +0 -109
  151. package/_baseIsEqual-B5xLoweL.js +0 -238
  152. package/_baseIteratee-p6Nj07-n.js +0 -126
  153. package/_baseSlice-GAv_YFTT.js +0 -20
  154. package/_baseSum-D0WC1dN0.js +0 -13
  155. package/_baseUniq-CpupKWcL.js +0 -89
  156. package/_commonjsHelpers-CUmg6egw.js +0 -6
  157. package/_createAggregator-BpVy5xMi.js +0 -63
  158. package/_getPrototype-D1LAdQKO.js +0 -5
  159. package/_getTag-D3ToyefI.js +0 -126
  160. package/cloneDeep-CjP5k9zW.js +0 -8
  161. package/countBy-C69WslUA.js +0 -14
  162. package/debounce-bV0h5FC5.js +0 -92
  163. package/get-D3C3lEU3.js +0 -8
  164. package/groupBy-DC2oOuBN.js +0 -14
  165. package/iconify-CXMreGTg.js +0 -1782
  166. package/identity-CPGTqrE4.js +0 -6
  167. package/index-BDVjGvMI.js +0 -696
  168. package/index-BHPT3qoB.js +0 -1172
  169. package/index-BMxyILVD.js +0 -465
  170. package/index-BbPn6-Mw.js +0 -15750
  171. package/index-Dz1kF2MU.js +0 -17654
  172. package/isEmpty-BQkZubqU.js +0 -29
  173. package/isNil-CIubwp4T.js +0 -6
  174. package/isObject-FTY-5JQX.js +0 -7
  175. package/isObjectLike-OAgjjZye.js +0 -48
  176. package/isSymbol-Xd2FsJyp.js +0 -8
  177. package/last-CUCl67Im.js +0 -7
  178. package/sortBy-B-UKp4GT.js +0 -100
  179. package/sumBy-MYkDPHZL.js +0 -8
  180. package/tabs-xGuUGsJd.js +0 -254
  181. package/toFinite-Bc55msYj.js +0 -16
  182. package/toNumber-DPxy1FBy.js +0 -39
  183. package/useClueTypeConfig-CH-nGq6a.js +0 -3184
  184. package/utils-Dr4wbKBZ.js +0 -4182
@@ -1,88 +1,60 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { a as api } from "../useClueTypeConfig-CH-nGq6a.js";
3
- import { useState, useRef, useCallback, useEffect, useMemo } from "react";
4
- import { c as createContext } from "../index-BDVjGvMI.js";
5
- import useClue from "./useClue.js";
6
- import useClueConfig from "./useClueConfig.js";
7
- const ClueFetcherContext = createContext(null);
8
- const ClueFetcherProvider = ({
9
- baseURL,
10
- children,
11
- classification: _defaultClassification,
12
- getToken,
13
- onNetworkCall
1
+ import { jsx as $ } from "react/jsx-runtime";
2
+ import { a as R } from "../useClueTypeConfig-CneP98N_.js";
3
+ import { useState as m, useRef as j, useCallback as F, useEffect as d, useMemo as H } from "react";
4
+ import { c as J } from "../index-E7g8cRyW.js";
5
+ import K from "./useClue.js";
6
+ import M from "./useClueConfig.js";
7
+ const O = J(null), W = ({
8
+ baseURL: f,
9
+ children: q,
10
+ classification: v,
11
+ getToken: s,
12
+ onNetworkCall: c
14
13
  }) => {
15
- var _a, _b;
16
- const clueConfig = useClueConfig();
17
- const { ready } = useClue();
18
- const [defaultClassification, setDefaultClasification] = useState(_defaultClassification);
19
- const [fetchCompleted, setFetchCompleted] = useState(false);
20
- const [fetchers, setFetchers] = useState({});
21
- const fetchRequests = useRef({});
22
- const getHashKey = useCallback(
23
- ({ type, value, classification }) => JSON.stringify({ type, value, classification: classification ?? defaultClassification }),
24
- [defaultClassification]
25
- );
26
- const fetchSelector = useCallback(
27
- async (fetcherId, selector) => {
28
- var _a2;
29
- if ((_a2 = fetchRequests.current[fetcherId]) == null ? void 0 : _a2[getHashKey(selector)]) {
30
- return fetchRequests.current[fetcherId][getHashKey(selector)];
31
- }
14
+ var E, y;
15
+ const a = M(), { ready: C } = K(), [o, z] = m(v), [h, A] = m(!1), [p, B] = m({}), i = j({}), u = F(
16
+ ({ type: t, value: e, classification: r }) => JSON.stringify({ type: t, value: e, classification: r ?? o }),
17
+ [o]
18
+ ), D = F(
19
+ async (t, e) => {
20
+ var r;
21
+ if ((r = i.current[t]) != null && r[u(e)])
22
+ return i.current[t][u(e)];
32
23
  try {
33
- const headers = {};
34
- const token = getToken == null ? void 0 : getToken();
35
- if (token) {
36
- headers.Authorization = `Bearer ${token}`;
37
- }
38
- let requestConfig = { baseURL, headers };
39
- if (onNetworkCall) {
40
- requestConfig = onNetworkCall(requestConfig);
41
- }
42
- const result = api.fetchers.post(fetcherId, selector, requestConfig);
43
- if (!fetchRequests.current[fetcherId]) {
44
- fetchRequests.current[fetcherId] = {};
45
- }
46
- fetchRequests.current[fetcherId][getHashKey(selector)] = result;
47
- return await result;
24
+ const n = {}, S = s == null ? void 0 : s();
25
+ S && (n.Authorization = `Bearer ${S}`);
26
+ let l = { baseURL: f, headers: n };
27
+ c && (l = c(l));
28
+ const x = R.fetchers.post(t, e, l);
29
+ return i.current[t] || (i.current[t] = {}), i.current[t][u(e)] = x, await x;
48
30
  } catch {
49
31
  return null;
50
32
  }
51
33
  },
52
- [baseURL, getHashKey, getToken, onNetworkCall]
34
+ [f, u, s, c]
53
35
  );
54
- useEffect(() => {
55
- var _a2, _b2, _c, _d;
56
- if (!defaultClassification && ((_b2 = (_a2 = clueConfig.config) == null ? void 0 : _a2.c12nDef) == null ? void 0 : _b2.UNRESTRICTED)) {
57
- setDefaultClasification((_d = (_c = clueConfig.config) == null ? void 0 : _c.c12nDef) == null ? void 0 : _d.UNRESTRICTED);
58
- }
59
- }, [(_b = (_a = clueConfig.config) == null ? void 0 : _a.c12nDef) == null ? void 0 : _b.UNRESTRICTED, defaultClassification]);
60
- useEffect(() => {
61
- if (!ready) {
36
+ d(() => {
37
+ var t, e, r, n;
38
+ !o && ((e = (t = a.config) == null ? void 0 : t.c12nDef) != null && e.UNRESTRICTED) && z((n = (r = a.config) == null ? void 0 : r.c12nDef) == null ? void 0 : n.UNRESTRICTED);
39
+ }, [(y = (E = a.config) == null ? void 0 : E.c12nDef) == null ? void 0 : y.UNRESTRICTED, o]), d(() => {
40
+ if (!C)
62
41
  return;
63
- }
64
- const headers = {};
65
- const token = getToken == null ? void 0 : getToken();
66
- if (token) {
67
- headers.Authorization = `Bearer ${token}`;
68
- }
69
- let requestConfig = { baseURL, headers };
70
- if (onNetworkCall) {
71
- requestConfig = onNetworkCall(requestConfig);
72
- }
73
- api.fetchers.get(requestConfig).then(setFetchers).finally(() => setFetchCompleted(true));
74
- }, [baseURL, ready]);
75
- const context = useMemo(
42
+ const t = {}, e = s == null ? void 0 : s();
43
+ e && (t.Authorization = `Bearer ${e}`);
44
+ let r = { baseURL: f, headers: t };
45
+ c && (r = c(r)), R.fetchers.get(r).then(B).finally(() => A(!0));
46
+ }, [f, C]);
47
+ const P = H(
76
48
  () => ({
77
- fetchSelector,
78
- fetchers,
79
- fetchCompleted
49
+ fetchSelector: D,
50
+ fetchers: p,
51
+ fetchCompleted: h
80
52
  }),
81
- [fetchCompleted, fetchSelector, fetchers]
53
+ [h, D, p]
82
54
  );
83
- return /* @__PURE__ */ jsx(ClueFetcherContext.Provider, { value: context, children });
55
+ return /* @__PURE__ */ $(O.Provider, { value: P, children: q });
84
56
  };
85
57
  export {
86
- ClueFetcherContext,
87
- ClueFetcherProvider
58
+ O as ClueFetcherContext,
59
+ W as ClueFetcherProvider
88
60
  };
@@ -1,23 +1,20 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { useState, useMemo } from "react";
3
- import { c as createContext } from "../index-BDVjGvMI.js";
4
- import { useClueEnrichSelector } from "./selectors.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 n } from "react/jsx-runtime";
2
+ import { useState as a, useMemo as c } from "react";
3
+ import { c as m } from "../index-E7g8cRyW.js";
4
+ import { useClueEnrichSelector as f } from "./selectors.js";
5
+ const C = m(null), G = ({ children: s, type: o, classification: t }) => {
6
+ const e = f((l) => l.defaultClassification), [r, u] = a([]), i = 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__ */ n(C.Provider, { value: i, 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-DiQDjt9s.js";
3
+ import { C as a, a as P } from "../AnnotationPreview-dYinoSA9.js";
4
4
  import "../data/event.js";
5
5
  import "../utils/window.js";
6
- import "../AnnotationDetails-YAPoqw3R.js";
6
+ import "../AnnotationDetails-BoX61_IF.js";
7
7
  import "react";
8
- import "../index-BDVjGvMI.js";
8
+ import "../index-E7g8cRyW.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-D4ryHO0M.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-DIn6g8tw.js";
7
- import { ClueFetcherProvider } from "./ClueFetcherContext.js";
8
- import { a as CluePopupProvider } from "../AnnotationPreview-DiQDjt9s.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-Sw7D-KOE.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-CvCIPOMC.js";
7
+ import { ClueFetcherProvider as l } from "./ClueFetcherContext.js";
8
+ import { a as c } from "../AnnotationPreview-dYinoSA9.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,24 +1,13 @@
1
- import { u as useContextSelector } from "../index-BDVjGvMI.js";
2
- import { a as ClueActionContext } from "../ActionForm-D4ryHO0M.js";
3
- import { ClueComponentContext } from "./ClueComponentContext.js";
4
- import { C as ClueEnrichContext } from "../ClueEnrichContext-DIn6g8tw.js";
5
- import { ClueFetcherContext } from "./ClueFetcherContext.js";
6
- const useClueFetcherSelector = (selector) => {
7
- return useContextSelector(ClueFetcherContext, selector);
8
- };
9
- const useClueActionsSelector = (selector) => {
10
- return useContextSelector(ClueActionContext, selector);
11
- };
12
- const useClueEnrichSelector = (selector) => {
13
- return useContextSelector(ClueEnrichContext, selector);
14
- };
15
- const useClueComponentSelector = (selector) => {
16
- return useContextSelector(ClueComponentContext, selector);
17
- };
1
+ import { u as t } from "../index-E7g8cRyW.js";
2
+ import { a as o } from "../ActionForm-Sw7D-KOE.js";
3
+ import { ClueComponentContext as r } from "./ClueComponentContext.js";
4
+ import { C as n } from "../ClueEnrichContext-CvCIPOMC.js";
5
+ import { ClueFetcherContext as u } from "./ClueFetcherContext.js";
6
+ const i = (e) => t(u, e), p = (e) => t(o, e), a = (e) => t(n, e), f = (e) => t(r, e);
18
7
  export {
19
- useClueEnrichSelector as default,
20
- useClueActionsSelector,
21
- useClueComponentSelector,
22
- useClueEnrichSelector,
23
- useClueFetcherSelector
8
+ a as default,
9
+ p as useClueActionsSelector,
10
+ f as useClueComponentSelector,
11
+ a as useClueEnrichSelector,
12
+ i as useClueFetcherSelector
24
13
  };
@@ -1,65 +1,49 @@
1
- import { b as uniqBy } from "../ClueEnrichContext-DIn6g8tw.js";
2
- import { useContext, useMemo, useState, useEffect } from "react";
3
- import { ClueDatabaseContext } from "./ClueDatabaseContext.js";
4
- import { useClueEnrichSelector } from "./selectors.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 { b as p } from "../ClueEnrichContext-CvCIPOMC.js";
2
+ import { useContext as q, useMemo as g, useState as h, useEffect as a } from "react";
3
+ import { ClueDatabaseContext as A } from "./ClueDatabaseContext.js";
4
+ import { useClueEnrichSelector as c } from "./selectors.js";
5
+ const D = (e, s, u, { skipEnrichment: f } = { skipEnrichment: !1 }) => {
6
+ const n = q(A), l = c((t) => t.defaultClassification), b = c((t) => t.ready), m = c((t) => t.availableSources), d = c((t) => t.queueEnrich), o = g(
7
+ () => u ?? l,
8
+ [u, l]
9
+ ), [C, $] = h(!1), [S, x] = h([]), r = g(
10
+ () => b && !!e && !!s && !!o,
11
+ [o, b, e, s]
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 a(() => {
14
+ if (!r || !(n != null && n.status))
23
15
  return;
24
- }
25
- const observable = database.status.count({ selector: { type, value, classification, status: "in-progress" } }).$.subscribe((_count) => setLoading(_count > 0));
16
+ const t = n.status.count({ selector: { type: e, value: s, classification: o, status: "in-progress" } }).$.subscribe((i) => $(i > 0));
26
17
  return () => {
27
- observable == null ? void 0 : observable.unsubscribe();
18
+ t == null || t.unsubscribe();
28
19
  };
29
- }, [classification, database, ready, type, value]);
30
- useEffect(() => {
31
- if (skipEnrichment || availableSources.length < 1 || !ready) {
32
- return;
33
- }
34
- queueEnrich(type, value, classification);
35
- }, [availableSources.length, classification, queueEnrich, ready, skipEnrichment, type, value]);
36
- useEffect(() => {
37
- if (!ready) {
20
+ }, [o, n, r, e, s]), a(() => {
21
+ f || m.length < 1 || !r || d(e, s, o);
22
+ }, [m.length, o, d, r, f, e, s]), a(() => {
23
+ if (!r)
38
24
  return;
39
- }
40
- const observable = database.selectors.find({
25
+ const t = n.selectors.find({
41
26
  selector: {
42
27
  // Use regex instead of exact value for case-insensitivity
43
- value: { $regex: `^${value}$`, $options: "i" }
28
+ value: { $regex: `^${s}$`, $options: "i" }
44
29
  }
45
30
  }).$.subscribe(
46
- (result) => setAnnotations(
47
- uniqBy(
48
- result.flatMap((entry) => entry.getAnnotations()),
31
+ (i) => x(
32
+ p(
33
+ i.flatMap((E) => E.getAnnotations()),
49
34
  JSON.stringify
50
35
  )
51
36
  )
52
37
  );
53
38
  return () => {
54
39
  try {
55
- observable.unsubscribe();
56
- } catch (e) {
57
- console.warn(e);
40
+ t.unsubscribe();
41
+ } catch (i) {
42
+ console.warn(i);
58
43
  }
59
44
  };
60
- }, [database, ready, value]);
61
- return [annotations, loading];
45
+ }, [n, r, s]), [S, C];
62
46
  };
63
47
  export {
64
- useAnnotations as default
48
+ D as default
65
49
  };
package/hooks/useClue.js CHANGED
@@ -1,8 +1,6 @@
1
- import { a as useContext } from "../index-BDVjGvMI.js";
2
- import { C as ClueEnrichContext } from "../ClueEnrichContext-DIn6g8tw.js";
3
- const useClue = () => {
4
- return useContext(ClueEnrichContext);
5
- };
1
+ import { a as t } from "../index-E7g8cRyW.js";
2
+ import { C as e } from "../ClueEnrichContext-CvCIPOMC.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 "../index-BDVjGvMI.js";
2
- import { u } from "../ActionForm-D4ryHO0M.js";
1
+ import "../index-E7g8cRyW.js";
2
+ import { u as a } from "../ActionForm-Sw7D-KOE.js";
3
3
  export {
4
- u as default
4
+ a as default
5
5
  };
@@ -1,8 +1,8 @@
1
- import { ClueConfigContext } from "./ClueConfigProvider.js";
2
- import { useContext } from "react";
3
- function useClueConfig() {
4
- return useContext(ClueConfigContext);
1
+ import { ClueConfigContext as o } from "./ClueConfigProvider.js";
2
+ import { useContext as t } from "react";
3
+ function r() {
4
+ return t(o);
5
5
  }
6
6
  export {
7
- useClueConfig as default
7
+ r as default
8
8
  };
@@ -1,7 +1,7 @@
1
- import { u } from "../useClueTypeConfig-CH-nGq6a.js";
1
+ import { u as i } from "../useClueTypeConfig-CneP98N_.js";
2
2
  import "../utils/loggerUtil.js";
3
- import "../isEmpty-BQkZubqU.js";
3
+ import "../isEmpty-g47Qir2A.js";
4
4
  import "react";
5
5
  export {
6
- u as default
6
+ i as default
7
7
  };