@cccsaurora/clue-ui 1.0.2 → 1.1.0-dev.11

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 (180) hide show
  1. package/ActionForm-D4ryHO0M.js +436 -0
  2. package/AnnotationDetails-YAPoqw3R.js +175 -0
  3. package/AnnotationPreview-DiQDjt9s.js +188 -0
  4. package/ClueEnrichContext-DIn6g8tw.js +522 -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-CUmg6egw.js +6 -0
  20. package/_createAggregator-BpVy5xMi.js +63 -0
  21. package/_getPrototype-D1LAdQKO.js +5 -0
  22. package/_getTag-D3ToyefI.js +126 -0
  23. package/cloneDeep-CjP5k9zW.js +8 -0
  24. package/components/AnnotationBody.js +49 -34
  25. package/components/AnnotationDetailPopover.js +36 -30
  26. package/components/AnnotationDetails.js +6 -6
  27. package/components/AnnotationEntry.js +50 -47
  28. package/components/AnnotationPreview.js +5 -5
  29. package/components/ClassificationChip.js +44 -23
  30. package/components/CountBadge.js +31 -26
  31. package/components/EnrichedCard.js +104 -92
  32. package/components/EnrichedChip.js +134 -109
  33. package/components/EnrichedTypography.js +136 -110
  34. package/components/ErrorBoundary.js +28 -24
  35. package/components/RetryFailedEnrichments.js +10 -9
  36. package/components/SourcePicker.js +57 -49
  37. package/components/actions/ActionForm.js +4 -4
  38. package/components/actions/ExecutePopover.js +64 -50
  39. package/components/actions/ResultModal.js +37 -34
  40. package/components/actions/form/schemaAdapter.js +39 -20
  41. package/components/display/graph/ExpandMoreButton.js +10 -10
  42. package/components/display/graph/elements/NodeCard.js +92 -76
  43. package/components/display/graph/elements/NodeTag.js +15 -13
  44. package/components/display/graph/index.js +258 -200
  45. package/components/display/graph/visualizations/Leaf.js +88 -69
  46. package/components/display/graph/visualizations/cloud/index.js +98 -81
  47. package/components/display/graph/visualizations/icons/BaseIcon.js +26 -21
  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 +14 -13
  54. package/components/display/graph/visualizations/panels/NodePanel.js +10 -8
  55. package/components/display/graph/visualizations/tree/BundleLine.js +108 -81
  56. package/components/display/graph/visualizations/tree/Triangle.js +13 -13
  57. package/components/display/graph/visualizations/tree/index.js +407 -305
  58. package/components/display/icons/Iconified.js +27 -12
  59. package/components/display/json/index.js +4 -4
  60. package/components/display/markdown/DynamicTabs.js +22 -17
  61. package/components/display/markdown/index.js +8527 -5670
  62. package/components/display/markdown/markdownPlugins/tabs.js +1 -1
  63. package/components/enrichment/EnrichPopover.js +55 -47
  64. package/components/fetchers/Fetcher.js +123 -95
  65. package/components/fetchers/PreviewModal.js +20 -17
  66. package/components/fetchers/StatusChip.js +22 -18
  67. package/components/group/Entry.js +13 -11
  68. package/components/group/Group.js +13 -10
  69. package/components/group/GroupControl.js +76 -65
  70. package/components/stats/QueryStatus.js +37 -28
  71. package/countBy-C69WslUA.js +14 -0
  72. package/data/event.js +6 -4
  73. package/database/index.js +2 -2
  74. package/debounce-bV0h5FC5.js +92 -0
  75. package/get-D3C3lEU3.js +8 -0
  76. package/groupBy-DC2oOuBN.js +14 -0
  77. package/hooks/ClueActionContext.js +6 -6
  78. package/hooks/ClueComponentContext.js +29 -23
  79. package/hooks/ClueConfigProvider.js +14 -12
  80. package/hooks/ClueDatabaseContext.js +19 -13
  81. package/hooks/ClueEnrichContext.js +8 -8
  82. package/hooks/ClueFetcherContext.js +74 -46
  83. package/hooks/ClueGroupContext.js +17 -14
  84. package/hooks/CluePopupContext.js +5 -5
  85. package/hooks/ClueProvider.js +12 -10
  86. package/hooks/selectors.js +22 -11
  87. package/hooks/useAnnotations.js +45 -29
  88. package/hooks/useClue.js +6 -4
  89. package/hooks/useClueActions.js +3 -3
  90. package/hooks/useClueConfig.js +5 -5
  91. package/hooks/useClueTypeConfig.js +3 -3
  92. package/hooks/useComparator.js +722 -435
  93. package/hooks/useErrors.js +22 -18
  94. package/hooks/useMyHighlights.js +66 -36
  95. package/hooks/useMyLocalStorage.js +63 -43
  96. package/iconify-CXMreGTg.js +1782 -0
  97. package/icons/Action.js +66 -49
  98. package/icons/Assessment.js +84 -68
  99. package/icons/Context.js +75 -61
  100. package/icons/Opinion.js +77 -65
  101. package/icons/iconMap.js +2 -2
  102. package/identity-CPGTqrE4.js +6 -0
  103. package/index-BDVjGvMI.js +696 -0
  104. package/index-BHPT3qoB.js +1172 -0
  105. package/index-BMxyILVD.js +465 -0
  106. package/index-BbPn6-Mw.js +15750 -0
  107. package/index-Dz1kF2MU.js +17654 -0
  108. package/isEmpty-BQkZubqU.js +29 -0
  109. package/isNil-CIubwp4T.js +6 -0
  110. package/isObject-FTY-5JQX.js +7 -0
  111. package/isObjectLike-OAgjjZye.js +48 -0
  112. package/isSymbol-Xd2FsJyp.js +8 -0
  113. package/last-CUCl67Im.js +7 -0
  114. package/main.js +58 -58
  115. package/package.json +1 -1
  116. package/sortBy-B-UKp4GT.js +100 -0
  117. package/sumBy-MYkDPHZL.js +8 -0
  118. package/tabs-xGuUGsJd.js +254 -0
  119. package/text/Frequency.js +42 -23
  120. package/toFinite-Bc55msYj.js +16 -0
  121. package/toNumber-DPxy1FBy.js +39 -0
  122. package/useClueTypeConfig-CH-nGq6a.js +3184 -0
  123. package/utils/chain.js +91 -64
  124. package/utils/classificationParser.js +519 -256
  125. package/utils/constants.js +35 -10
  126. package/utils/graph.js +72 -45
  127. package/utils/hashUtil.js +7 -7
  128. package/utils/line.js +131 -81
  129. package/utils/loggerUtil.js +5 -3
  130. package/utils/sessionStorage.js +41 -29
  131. package/utils/utils.js +9 -9
  132. package/utils/window.js +21 -10
  133. package/utils-Dr4wbKBZ.js +4182 -0
  134. package/ActionForm-BtTv0s4P.js +0 -340
  135. package/AnnotationDetails-D5tBIeEw.js +0 -160
  136. package/AnnotationPreview-CZr_CcZC.js +0 -140
  137. package/ClueEnrichContext-DH9lqjwH.js +0 -401
  138. package/FlexOne-BXWFOd1T.js +0 -6
  139. package/_Map-DXNg_Z-q.js +0 -54
  140. package/_MapCache-Cu25RRDU.js +0 -129
  141. package/_Uint8Array-DlJCtTvG.js +0 -102
  142. package/_baseAssignValue-CUmzp727.js +0 -20
  143. package/_baseClone-BlMmRXeX.js +0 -208
  144. package/_baseExtremum-P_0akmCi.js +0 -27
  145. package/_baseFlatten-CN7vDNEQ.js +0 -72
  146. package/_baseGet-Dgf6_xCm.js +0 -80
  147. package/_baseIsEqual-Cpjtfb3Q.js +0 -173
  148. package/_baseIteratee-CP1bocOX.js +0 -95
  149. package/_baseSlice-M5RKzt1A.js +0 -10
  150. package/_baseSum-wEbgNeUs.js +0 -10
  151. package/_baseUniq-tMFmk80M.js +0 -61
  152. package/_commonjsHelpers-C6fGbg64.js +0 -6
  153. package/_createAggregator-B4Cav8ZM.js +0 -53
  154. package/_getPrototype-CHAFQYL_.js +0 -5
  155. package/_getTag-BV_UoLYG.js +0 -90
  156. package/cloneDeep-BPVpFBzJ.js +0 -8
  157. package/countBy-DOutsa_w.js +0 -8
  158. package/debounce-DryYcbJ4.js +0 -56
  159. package/get-Bow1vKwx.js +0 -8
  160. package/groupBy-BheQYl6f.js +0 -8
  161. package/iconify-BBckr5AQ.js +0 -1263
  162. package/identity-ByMq8VxU.js +0 -6
  163. package/index-BUcHmehh.js +0 -975
  164. package/index-Bo-v5IAc.js +0 -12754
  165. package/index-CnaCBNrd.js +0 -358
  166. package/index-E7g8cRyW.js +0 -568
  167. package/index-p5_wX7q1.js +0 -11729
  168. package/isEmpty-g47Qir2A.js +0 -21
  169. package/isNil-CjWwlQS3.js +0 -6
  170. package/isObject-B53jY8Qg.js +0 -7
  171. package/isObjectLike-BatpeCIi.js +0 -29
  172. package/isSymbol-C3_SC0Qp.js +0 -8
  173. package/last-7CdUxN0r.js +0 -7
  174. package/sortBy-ITdmD17L.js +0 -79
  175. package/sumBy-DxJUU2E8.js +0 -8
  176. package/tabs-CgADNA57.js +0 -195
  177. package/toFinite-BMy6GObD.js +0 -14
  178. package/toNumber-YVhnnJv4.js +0 -31
  179. package/useClueTypeConfig-CneP98N_.js +0 -2260
  180. package/utils-CD0rFIFU.js +0 -2704
@@ -1,92 +1,103 @@
1
- import { jsx as r, jsxs as m } from "react/jsx-runtime";
2
- import { Card as S, Stack as y, Box as b, Typography as E, Autocomplete as v, TextField as x, Button as I, CircularProgress as z } from "@mui/material";
3
- import { F as _ } from "../../FlexOne-BXWFOd1T.js";
4
- import k from "../display/icons/Iconified.js";
5
- import { SNACKBAR_EVENT_ID as w } from "../../data/event.js";
6
- import { ClueGroupContext as j } from "../../hooks/ClueGroupContext.js";
7
- import { useClueComponentSelector as A, useClueEnrichSelector as u } from "../../hooks/selectors.js";
8
- import { safeDispatchEvent as B } from "../../utils/window.js";
9
- import { c as F } from "../../ActionForm-BtTv0s4P.js";
10
- import { useState as d, useMemo as O, useCallback as T } from "react";
11
- import { u as D } from "../../index-E7g8cRyW.js";
12
- import G from "../actions/ExecutePopover.js";
13
- const U = () => {
14
- const { t: n } = A((e) => e.i18next), { type: t, values: o, classification: a } = D(j, (e) => ({
15
- type: e == null ? void 0 : e.type,
16
- values: e == null ? void 0 : e.values,
17
- classification: e == null ? void 0 : e.classification
18
- })), f = u((e) => e.availableSources), c = u((e) => e.bulkEnrich), [i, p] = d(!1), [s, h] = d([]), C = O(
19
- () => (o ?? []).map((e) => ({ value: e, type: t, classification: a })),
20
- [a, t, o]
21
- ), g = T(async () => {
22
- if (!i)
23
- try {
24
- p(!0), await c(
25
- (o ?? []).map((e) => ({ type: t, value: e })),
26
- { force: !0, sources: s }
27
- );
28
- } catch (e) {
29
- console.error(e), B(
30
- new CustomEvent(w, {
31
- detail: {
32
- message: e.toString(),
33
- level: "error"
34
- }
35
- })
36
- );
37
- } finally {
38
- p(!1);
39
- }
40
- }, [c, i, s, t, o]);
41
- return /* @__PURE__ */ r(S, { sx: { p: 1 }, children: /* @__PURE__ */ m(y, { direction: "row", spacing: 1, alignItems: "center", children: [
42
- /* @__PURE__ */ r(
43
- b,
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Card, Stack, Box, Typography, Autocomplete, TextField, Button, CircularProgress } from "@mui/material";
3
+ import { F as FlexOne } from "../../FlexOne-BSYAhhtG.js";
4
+ import Iconified from "../display/icons/Iconified.js";
5
+ import { SNACKBAR_EVENT_ID } from "../../data/event.js";
6
+ import { ClueGroupContext } from "../../hooks/ClueGroupContext.js";
7
+ import { useClueComponentSelector, useClueEnrichSelector } from "../../hooks/selectors.js";
8
+ import { safeDispatchEvent } from "../../utils/window.js";
9
+ import { c as capitalize } from "../../ActionForm-D4ryHO0M.js";
10
+ import { useState, useMemo, useCallback } from "react";
11
+ import { u as useContextSelector } from "../../index-BDVjGvMI.js";
12
+ import ExecutePopover from "../actions/ExecutePopover.js";
13
+ const GroupControl = () => {
14
+ const { t } = useClueComponentSelector((ctx) => ctx.i18next);
15
+ const { type, values, classification } = useContextSelector(ClueGroupContext, (ctx) => ({
16
+ type: ctx == null ? void 0 : ctx.type,
17
+ values: ctx == null ? void 0 : ctx.values,
18
+ classification: ctx == null ? void 0 : ctx.classification
19
+ }));
20
+ const sources = useClueEnrichSelector((ctx) => ctx.availableSources);
21
+ const enrich = useClueEnrichSelector((ctx) => ctx.bulkEnrich);
22
+ const [loading, setLoading] = useState(false);
23
+ const [selectedSources, setSelectedSources] = useState([]);
24
+ const fullValues = useMemo(
25
+ () => (values ?? []).map((value) => ({ value, type, classification })),
26
+ [classification, type, values]
27
+ );
28
+ const runEnrichment = useCallback(async () => {
29
+ if (loading) {
30
+ return;
31
+ }
32
+ try {
33
+ setLoading(true);
34
+ await enrich(
35
+ (values ?? []).map((value) => ({ type, value })),
36
+ { force: true, sources: selectedSources }
37
+ );
38
+ } catch (e) {
39
+ console.error(e);
40
+ safeDispatchEvent(
41
+ new CustomEvent(SNACKBAR_EVENT_ID, {
42
+ detail: {
43
+ message: e.toString(),
44
+ level: "error"
45
+ }
46
+ })
47
+ );
48
+ } finally {
49
+ setLoading(false);
50
+ }
51
+ }, [enrich, loading, selectedSources, type, values]);
52
+ return /* @__PURE__ */ jsx(Card, { sx: { p: 1 }, children: /* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", children: [
53
+ /* @__PURE__ */ jsx(
54
+ Box,
44
55
  {
45
- sx: (e) => ({
56
+ sx: (theme) => ({
46
57
  border: "thin solid",
47
58
  alignSelf: "stretch",
48
59
  display: "flex",
49
60
  alignItems: "center",
50
61
  px: 1,
51
62
  borderRadius: "5px",
52
- borderColor: e.palette.divider
63
+ borderColor: theme.palette.divider
53
64
  }),
54
- children: /* @__PURE__ */ m(E, { color: "text.secondary", children: [
55
- (o == null ? void 0 : o.length) ?? 0,
65
+ children: /* @__PURE__ */ jsxs(Typography, { color: "text.secondary", children: [
66
+ (values == null ? void 0 : values.length) ?? 0,
56
67
  " selected"
57
68
  ] })
58
69
  }
59
70
  ),
60
- /* @__PURE__ */ r(_, {}),
61
- /* @__PURE__ */ r(
62
- v,
71
+ /* @__PURE__ */ jsx(FlexOne, {}),
72
+ /* @__PURE__ */ jsx(
73
+ Autocomplete,
63
74
  {
64
75
  size: "small",
65
- multiple: !0,
66
- options: f,
76
+ multiple: true,
77
+ options: sources,
67
78
  sx: { minWidth: "400px" },
68
- renderInput: (e) => /* @__PURE__ */ r(x, { size: "small", placeholder: n("sources"), ...e }),
69
- value: s,
70
- onChange: (e, l) => h(l),
71
- disableCloseOnSelect: !0,
72
- getOptionLabel: (e) => e.split(/[_-]/).map((l) => F(l)).join(" ")
79
+ renderInput: (params) => /* @__PURE__ */ jsx(TextField, { size: "small", placeholder: t("sources"), ...params }),
80
+ value: selectedSources,
81
+ onChange: (__, value) => setSelectedSources(value),
82
+ disableCloseOnSelect: true,
83
+ getOptionLabel: (opt) => opt.split(/[_-]/).map((word) => capitalize(word)).join(" ")
73
84
  }
74
85
  ),
75
- /* @__PURE__ */ r(
76
- I,
86
+ /* @__PURE__ */ jsx(
87
+ Button,
77
88
  {
78
89
  variant: "outlined",
79
90
  color: "info",
80
- disabled: (o == null ? void 0 : o.length) < 1 || i,
81
- startIcon: i ? /* @__PURE__ */ r(z, { color: "info", size: "20px" }) : /* @__PURE__ */ r(k, { icon: "ic:outline-play-arrow" }),
91
+ disabled: (values == null ? void 0 : values.length) < 1 || loading,
92
+ startIcon: loading ? /* @__PURE__ */ jsx(CircularProgress, { color: "info", size: "20px" }) : /* @__PURE__ */ jsx(Iconified, { icon: "ic:outline-play-arrow" }),
82
93
  sx: { alignSelf: "stretch" },
83
- onClick: g,
84
- children: n("enrich")
94
+ onClick: runEnrichment,
95
+ children: t("enrich")
85
96
  }
86
97
  ),
87
- /* @__PURE__ */ r(G, { selectors: C, size: "medium", multiples: !0 })
98
+ /* @__PURE__ */ jsx(ExecutePopover, { selectors: fullValues, size: "medium", multiples: true })
88
99
  ] }) });
89
100
  };
90
101
  export {
91
- U as default
102
+ GroupControl as default
92
103
  };
@@ -1,52 +1,61 @@
1
- import { jsxs as s } from "react/jsx-runtime";
2
- import { Stack as d, Typography as r } from "@mui/material";
3
- import { ClueDatabaseContext as b } from "../../hooks/ClueDatabaseContext.js";
4
- import { useClueEnrichSelector as f } from "../../hooks/selectors.js";
5
- import { useContext as C, useState as n, useEffect as g } from "react";
6
- const $ = () => {
7
- const e = C(b), c = f((t) => t.ready), [u, l] = n(0), [a, p] = n(0), [i, m] = n(0);
8
- return g(() => {
9
- if (!c)
1
+ import { jsxs } from "react/jsx-runtime";
2
+ import { Stack, Typography } from "@mui/material";
3
+ import { ClueDatabaseContext } from "../../hooks/ClueDatabaseContext.js";
4
+ import { useClueEnrichSelector } from "../../hooks/selectors.js";
5
+ import { useContext, useState, useEffect } from "react";
6
+ const QueryStatus = () => {
7
+ const database = useContext(ClueDatabaseContext);
8
+ const ready = useClueEnrichSelector((ctx) => ctx.ready);
9
+ const [pendingCount, setPendingCount] = useState(0);
10
+ const [inProgressCount, setInProgressCount] = useState(0);
11
+ const [completeCount, setCompleteCount] = useState(0);
12
+ useEffect(() => {
13
+ if (!ready) {
10
14
  return;
11
- const t = [
12
- e.status.count({ selector: { status: "pending" } }).$.subscribe(l),
13
- e.status.count({ selector: { status: "in-progress" } }).$.subscribe(p),
14
- e.status.count({ selector: { status: "complete" } }).$.subscribe(m)
15
+ }
16
+ const observables = [
17
+ database.status.count({ selector: { status: "pending" } }).$.subscribe(setPendingCount),
18
+ database.status.count({ selector: { status: "in-progress" } }).$.subscribe(setInProgressCount),
19
+ database.status.count({ selector: { status: "complete" } }).$.subscribe(setCompleteCount)
15
20
  ];
16
21
  return () => {
17
22
  try {
18
- t.forEach((o) => o.unsubscribe());
19
- } catch (o) {
20
- console.warn(o);
23
+ observables.forEach((_observable) => _observable.unsubscribe());
24
+ } catch (e) {
25
+ console.warn(e);
21
26
  }
22
27
  };
23
- }, [e, c]), u + a + i < 1 ? null : /* @__PURE__ */ s(
24
- d,
28
+ }, [database, ready]);
29
+ if (pendingCount + inProgressCount + completeCount < 1) {
30
+ return null;
31
+ }
32
+ return /* @__PURE__ */ jsxs(
33
+ Stack,
25
34
  {
26
35
  spacing: 1,
27
- sx: (t) => ({
28
- border: `thin solid ${t.palette.divider}`,
29
- borderRadius: t.spacing(0.5),
36
+ sx: (theme) => ({
37
+ border: `thin solid ${theme.palette.divider}`,
38
+ borderRadius: theme.spacing(0.5),
30
39
  mx: 1,
31
40
  p: 1
32
41
  }),
33
42
  children: [
34
- /* @__PURE__ */ s(r, { sx: { fontFamily: "monospace" }, children: [
43
+ /* @__PURE__ */ jsxs(Typography, { sx: { fontFamily: "monospace" }, children: [
35
44
  "Pending: ",
36
- u
45
+ pendingCount
37
46
  ] }),
38
- /* @__PURE__ */ s(r, { sx: { fontFamily: "monospace" }, children: [
47
+ /* @__PURE__ */ jsxs(Typography, { sx: { fontFamily: "monospace" }, children: [
39
48
  "In Progress: ",
40
- a
49
+ inProgressCount
41
50
  ] }),
42
- /* @__PURE__ */ s(r, { sx: { fontFamily: "monospace" }, children: [
51
+ /* @__PURE__ */ jsxs(Typography, { sx: { fontFamily: "monospace" }, children: [
43
52
  "Complete: ",
44
- i
53
+ completeCount
45
54
  ] })
46
55
  ]
47
56
  }
48
57
  );
49
58
  };
50
59
  export {
51
- $ as default
60
+ QueryStatus as default
52
61
  };
@@ -0,0 +1,14 @@
1
+ import { b as baseAssignValue } from "./_baseAssignValue-CNbcU6Nb.js";
2
+ import { c as createAggregator } from "./_createAggregator-BpVy5xMi.js";
3
+ var objectProto = Object.prototype;
4
+ var hasOwnProperty = objectProto.hasOwnProperty;
5
+ var countBy = createAggregator(function(result, value, key) {
6
+ if (hasOwnProperty.call(result, key)) {
7
+ ++result[key];
8
+ } else {
9
+ baseAssignValue(result, key, 1);
10
+ }
11
+ });
12
+ export {
13
+ countBy as c
14
+ };
package/data/event.js CHANGED
@@ -1,6 +1,8 @@
1
- const o = "snackbar.message", s = "clue.showPopup", E = "clue.hidePopup";
1
+ const SNACKBAR_EVENT_ID = "snackbar.message";
2
+ const SHOW_EVENT_ID = "clue.showPopup";
3
+ const HIDE_EVENT_ID = "clue.hidePopup";
2
4
  export {
3
- E as HIDE_EVENT_ID,
4
- s as SHOW_EVENT_ID,
5
- o as SNACKBAR_EVENT_ID
5
+ HIDE_EVENT_ID,
6
+ SHOW_EVENT_ID,
7
+ SNACKBAR_EVENT_ID
6
8
  };
package/database/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { b as f } from "../index-Bo-v5IAc.js";
1
+ import { b } from "../index-Dz1kF2MU.js";
2
2
  export {
3
- f as default
3
+ b as default
4
4
  };
@@ -0,0 +1,92 @@
1
+ import { i as isObject } from "./isObject-FTY-5JQX.js";
2
+ import { r as root } from "./isObjectLike-OAgjjZye.js";
3
+ import { t as toNumber } from "./toNumber-DPxy1FBy.js";
4
+ var now = function() {
5
+ return root.Date.now();
6
+ };
7
+ var FUNC_ERROR_TEXT = "Expected a function";
8
+ var nativeMax = Math.max, nativeMin = Math.min;
9
+ function debounce(func, wait, options) {
10
+ var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
11
+ if (typeof func != "function") {
12
+ throw new TypeError(FUNC_ERROR_TEXT);
13
+ }
14
+ wait = toNumber(wait) || 0;
15
+ if (isObject(options)) {
16
+ leading = !!options.leading;
17
+ maxing = "maxWait" in options;
18
+ maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
19
+ trailing = "trailing" in options ? !!options.trailing : trailing;
20
+ }
21
+ function invokeFunc(time) {
22
+ var args = lastArgs, thisArg = lastThis;
23
+ lastArgs = lastThis = void 0;
24
+ lastInvokeTime = time;
25
+ result = func.apply(thisArg, args);
26
+ return result;
27
+ }
28
+ function leadingEdge(time) {
29
+ lastInvokeTime = time;
30
+ timerId = setTimeout(timerExpired, wait);
31
+ return leading ? invokeFunc(time) : result;
32
+ }
33
+ function remainingWait(time) {
34
+ var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
35
+ return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
36
+ }
37
+ function shouldInvoke(time) {
38
+ var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
39
+ return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
40
+ }
41
+ function timerExpired() {
42
+ var time = now();
43
+ if (shouldInvoke(time)) {
44
+ return trailingEdge(time);
45
+ }
46
+ timerId = setTimeout(timerExpired, remainingWait(time));
47
+ }
48
+ function trailingEdge(time) {
49
+ timerId = void 0;
50
+ if (trailing && lastArgs) {
51
+ return invokeFunc(time);
52
+ }
53
+ lastArgs = lastThis = void 0;
54
+ return result;
55
+ }
56
+ function cancel() {
57
+ if (timerId !== void 0) {
58
+ clearTimeout(timerId);
59
+ }
60
+ lastInvokeTime = 0;
61
+ lastArgs = lastCallTime = lastThis = timerId = void 0;
62
+ }
63
+ function flush() {
64
+ return timerId === void 0 ? result : trailingEdge(now());
65
+ }
66
+ function debounced() {
67
+ var time = now(), isInvoking = shouldInvoke(time);
68
+ lastArgs = arguments;
69
+ lastThis = this;
70
+ lastCallTime = time;
71
+ if (isInvoking) {
72
+ if (timerId === void 0) {
73
+ return leadingEdge(lastCallTime);
74
+ }
75
+ if (maxing) {
76
+ clearTimeout(timerId);
77
+ timerId = setTimeout(timerExpired, wait);
78
+ return invokeFunc(lastCallTime);
79
+ }
80
+ }
81
+ if (timerId === void 0) {
82
+ timerId = setTimeout(timerExpired, wait);
83
+ }
84
+ return result;
85
+ }
86
+ debounced.cancel = cancel;
87
+ debounced.flush = flush;
88
+ return debounced;
89
+ }
90
+ export {
91
+ debounce as d
92
+ };
@@ -0,0 +1,8 @@
1
+ import { b as baseGet } from "./_baseGet-BSK_nnoz.js";
2
+ function get(object, path, defaultValue) {
3
+ var result = object == null ? void 0 : baseGet(object, path);
4
+ return result === void 0 ? defaultValue : result;
5
+ }
6
+ export {
7
+ get as g
8
+ };
@@ -0,0 +1,14 @@
1
+ import { b as baseAssignValue } from "./_baseAssignValue-CNbcU6Nb.js";
2
+ import { c as createAggregator } from "./_createAggregator-BpVy5xMi.js";
3
+ var objectProto = Object.prototype;
4
+ var hasOwnProperty = objectProto.hasOwnProperty;
5
+ var groupBy = createAggregator(function(result, value, key) {
6
+ if (hasOwnProperty.call(result, key)) {
7
+ result[key].push(value);
8
+ } else {
9
+ baseAssignValue(result, key, [value]);
10
+ }
11
+ });
12
+ export {
13
+ groupBy as g
14
+ };
@@ -1,18 +1,18 @@
1
1
  import "react/jsx-runtime";
2
2
  import "@mui/material";
3
- import "../index-Bo-v5IAc.js";
4
- import "../useClueTypeConfig-CneP98N_.js";
5
- import { a as A, C as d } from "../ActionForm-BtTv0s4P.js";
3
+ import "../index-Dz1kF2MU.js";
4
+ import "../useClueTypeConfig-CH-nGq6a.js";
5
+ import { a, C } from "../ActionForm-D4ryHO0M.js";
6
6
  import "../components/actions/ResultModal.js";
7
7
  import "../components/display/icons/Iconified.js";
8
8
  import "../components/ErrorBoundary.js";
9
9
  import "../data/event.js";
10
10
  import "../utils/window.js";
11
11
  import "react";
12
- import "../index-E7g8cRyW.js";
12
+ import "../index-BDVjGvMI.js";
13
13
  import "./ClueComponentContext.js";
14
14
  import "./useClue.js";
15
15
  export {
16
- A as ClueActionContext,
17
- d as ClueActionProvider
16
+ a as ClueActionContext,
17
+ C as ClueActionProvider
18
18
  };
@@ -1,34 +1,40 @@
1
- import { jsx as n } from "react/jsx-runtime";
2
- import { useMemo as m } from "react";
3
- import { useTranslation as l } from "react-i18next";
4
- import { c as i } from "../index-E7g8cRyW.js";
5
- const u = i(null), p = ({
6
- children: t,
7
- ReactJson: o
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useMemo } from "react";
3
+ import { useTranslation } from "react-i18next";
4
+ import { c as createContext } from "../index-BDVjGvMI.js";
5
+ const ClueComponentContext = createContext(null);
6
+ const ClueComponentI18nProvider = ({
7
+ children,
8
+ ReactJson
8
9
  }) => {
9
- const r = l(), e = m(
10
+ const i18next = useTranslation();
11
+ const context = useMemo(
10
12
  () => ({
11
- ReactJson: o,
12
- i18next: r
13
+ ReactJson,
14
+ i18next
13
15
  }),
14
- [o, r]
16
+ [ReactJson, i18next]
15
17
  );
16
- return /* @__PURE__ */ n(u.Provider, { value: e, children: t });
17
- }, f = ({
18
- children: t,
19
- ReactJson: o,
20
- i18next: r = null
18
+ return /* @__PURE__ */ jsx(ClueComponentContext.Provider, { value: context, children });
19
+ };
20
+ const ClueComponentProvider = ({
21
+ children,
22
+ ReactJson,
23
+ i18next = null
21
24
  }) => {
22
- const e = m(
25
+ const context = useMemo(
23
26
  () => ({
24
- ReactJson: o,
25
- i18next: r
27
+ ReactJson,
28
+ i18next
26
29
  }),
27
- [o, r]
30
+ [ReactJson, i18next]
28
31
  );
29
- return r ? /* @__PURE__ */ n(u.Provider, { value: e, children: t }) : /* @__PURE__ */ n(p, { ReactJson: o, children: t });
32
+ if (!i18next) {
33
+ return /* @__PURE__ */ jsx(ClueComponentI18nProvider, { ReactJson, children });
34
+ }
35
+ return /* @__PURE__ */ jsx(ClueComponentContext.Provider, { value: context, children });
30
36
  };
31
37
  export {
32
- u as ClueComponentContext,
33
- f as ClueComponentProvider
38
+ ClueComponentContext,
39
+ ClueComponentProvider
34
40
  };
@@ -1,21 +1,23 @@
1
- import { jsx as i } from "react/jsx-runtime";
2
- import { createContext as c, useState as u, useMemo as f } from "react";
3
- const l = c(null), g = ({ children: t, config: e }) => {
4
- const [o, n] = u(
5
- e ?? {
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { createContext, useState, useMemo } from "react";
3
+ const ClueConfigContext = createContext(null);
4
+ const ClueConfigProvider = ({ children, config: _config }) => {
5
+ const [config, setConfig] = useState(
6
+ _config ?? {
6
7
  configuration: null,
7
8
  c12nDef: null
8
9
  }
9
- ), r = f(
10
+ );
11
+ const context = useMemo(
10
12
  () => ({
11
- config: o,
12
- setConfig: n
13
+ config,
14
+ setConfig
13
15
  }),
14
- [o, n]
16
+ [config, setConfig]
15
17
  );
16
- return /* @__PURE__ */ i(l.Provider, { value: r, children: t });
18
+ return /* @__PURE__ */ jsx(ClueConfigContext.Provider, { value: context, children });
17
19
  };
18
20
  export {
19
- l as ClueConfigContext,
20
- g as ClueConfigProvider
21
+ ClueConfigContext,
22
+ ClueConfigProvider
21
23
  };
@@ -1,17 +1,23 @@
1
- import { jsx as s } from "react/jsx-runtime";
2
- import { b as u } from "../index-Bo-v5IAc.js";
3
- import { createContext as l, useState as n, useEffect as i } from "react";
4
- const m = l(null), p = ({
5
- children: a,
6
- database: e,
7
- databaseConfig: t
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { b as buildDatabase } from "../index-Dz1kF2MU.js";
3
+ import { createContext, useState, useEffect } from "react";
4
+ const ClueDatabaseContext = createContext(null);
5
+ const ClueDatabaseProvider = ({
6
+ children,
7
+ database: _database,
8
+ databaseConfig
8
9
  }) => {
9
- const [o, r] = n();
10
- return i(() => {
11
- e ? r(e) : u(t).then(r);
12
- }, [e, t]), /* @__PURE__ */ s(m.Provider, { value: o, children: a });
10
+ const [database, setDatabase] = useState();
11
+ useEffect(() => {
12
+ if (_database) {
13
+ setDatabase(_database);
14
+ } else {
15
+ buildDatabase(databaseConfig).then(setDatabase);
16
+ }
17
+ }, [_database, databaseConfig]);
18
+ return /* @__PURE__ */ jsx(ClueDatabaseContext.Provider, { value: database, children });
13
19
  };
14
20
  export {
15
- m as ClueDatabaseContext,
16
- p as ClueDatabaseProvider
21
+ ClueDatabaseContext,
22
+ ClueDatabaseProvider
17
23
  };
@@ -1,15 +1,15 @@
1
1
  import "react/jsx-runtime";
2
- import "../iconify-BBckr5AQ.js";
3
- import "../useClueTypeConfig-CneP98N_.js";
2
+ import "../iconify-CXMreGTg.js";
3
+ import "../useClueTypeConfig-CH-nGq6a.js";
4
4
  import "../utils/loggerUtil.js";
5
- import { C as l, a as s } from "../ClueEnrichContext-DH9lqjwH.js";
6
- import "../debounce-DryYcbJ4.js";
7
- import "../groupBy-BheQYl6f.js";
5
+ import { C, a } from "../ClueEnrichContext-DIn6g8tw.js";
6
+ import "../debounce-bV0h5FC5.js";
7
+ import "../groupBy-DC2oOuBN.js";
8
8
  import "react";
9
- import "../index-E7g8cRyW.js";
9
+ import "../index-BDVjGvMI.js";
10
10
  import "./ClueDatabaseContext.js";
11
11
  import "./useClueConfig.js";
12
12
  export {
13
- l as ClueEnrichContext,
14
- s as ClueEnrichProvider
13
+ C as ClueEnrichContext,
14
+ a as ClueEnrichProvider
15
15
  };