@gen3/frontend 0.10.54 → 0.10.56

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 (224) hide show
  1. package/dist/cjs/index.js +2013 -111
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/dts/components/Content/TextContent.d.ts +6 -2
  4. package/dist/dts/components/Content/TextContent.d.ts.map +1 -1
  5. package/dist/dts/components/Content/TextContent.js +25 -4
  6. package/dist/dts/components/Content/TextContent.js.map +1 -1
  7. package/dist/dts/components/Login/LoginAccountButton.d.ts +4 -1
  8. package/dist/dts/components/Login/LoginAccountButton.d.ts.map +1 -1
  9. package/dist/dts/components/Login/LoginAccountButton.js +5 -2
  10. package/dist/dts/components/Login/LoginAccountButton.js.map +1 -1
  11. package/dist/dts/components/Login/LoginButton.d.ts.map +1 -1
  12. package/dist/dts/components/Login/LoginButton.js +4 -2
  13. package/dist/dts/components/Login/LoginButton.js.map +1 -1
  14. package/dist/dts/components/Login/LoginPanel.d.ts.map +1 -1
  15. package/dist/dts/components/Login/LoginPanel.js +1 -4
  16. package/dist/dts/components/Login/LoginPanel.js.map +1 -1
  17. package/dist/dts/components/MessageCards/CardContainer.d.ts +1 -0
  18. package/dist/dts/components/MessageCards/CardContainer.d.ts.map +1 -1
  19. package/dist/dts/components/MessageCards/CardContainer.js +2 -2
  20. package/dist/dts/components/MessageCards/CardContainer.js.map +1 -1
  21. package/dist/dts/components/MessageCards/MessageCard.d.ts +1 -0
  22. package/dist/dts/components/MessageCards/MessageCard.d.ts.map +1 -1
  23. package/dist/dts/components/MessageCards/MessageCard.js +2 -2
  24. package/dist/dts/components/MessageCards/MessageCard.js.map +1 -1
  25. package/dist/dts/components/NewTabLink.d.ts +8 -0
  26. package/dist/dts/components/NewTabLink.d.ts.map +1 -0
  27. package/dist/dts/components/NewTabLink.js +7 -0
  28. package/dist/dts/components/NewTabLink.js.map +1 -0
  29. package/dist/dts/components/charts/echarts/VerticalBarChart.d.ts +7 -0
  30. package/dist/dts/components/charts/echarts/VerticalBarChart.d.ts.map +1 -1
  31. package/dist/dts/components/charts/echarts/VerticalBarChart.js +7 -1
  32. package/dist/dts/components/charts/echarts/VerticalBarChart.js.map +1 -1
  33. package/dist/dts/features/Analysis/AnalysisCardEditor.d.ts.map +1 -1
  34. package/dist/dts/features/Analysis/AnalysisCardEditor.js +0 -1
  35. package/dist/dts/features/Analysis/AnalysisCardEditor.js.map +1 -1
  36. package/dist/dts/features/CohortBuilder/QueryExpressionSection.d.ts +6 -4
  37. package/dist/dts/features/CohortBuilder/QueryExpressionSection.d.ts.map +1 -1
  38. package/dist/dts/features/CohortBuilder/QueryExpressionSection.js +7 -7
  39. package/dist/dts/features/CohortBuilder/QueryExpressionSection.js.map +1 -1
  40. package/dist/dts/features/CohortBuilder/QueryRepresentation.d.ts +3 -2
  41. package/dist/dts/features/CohortBuilder/QueryRepresentation.d.ts.map +1 -1
  42. package/dist/dts/features/CohortBuilder/QueryRepresentation.js +33 -24
  43. package/dist/dts/features/CohortBuilder/QueryRepresentation.js.map +1 -1
  44. package/dist/dts/features/DataLibrary/DataLibrary.d.ts +4 -0
  45. package/dist/dts/features/DataLibrary/DataLibrary.d.ts.map +1 -0
  46. package/dist/dts/features/DataLibrary/DataLibrary.js +19 -0
  47. package/dist/dts/features/DataLibrary/DataLibrary.js.map +1 -0
  48. package/dist/dts/features/DataLibrary/DataLibraryLists.d.ts +5 -0
  49. package/dist/dts/features/DataLibrary/DataLibraryLists.d.ts.map +1 -0
  50. package/dist/dts/features/DataLibrary/DataLibraryLists.js +39 -0
  51. package/dist/dts/features/DataLibrary/DataLibraryLists.js.map +1 -0
  52. package/dist/dts/features/DataLibrary/DatalistAccordionItem.d.ts +21 -0
  53. package/dist/dts/features/DataLibrary/DatalistAccordionItem.d.ts.map +1 -0
  54. package/dist/dts/features/DataLibrary/DatalistAccordionItem.js +178 -0
  55. package/dist/dts/features/DataLibrary/DatalistAccordionItem.js.map +1 -0
  56. package/dist/dts/features/DataLibrary/DatasetAccordionControl.d.ts +16 -0
  57. package/dist/dts/features/DataLibrary/DatasetAccordionControl.d.ts.map +1 -0
  58. package/dist/dts/features/DataLibrary/DatasetAccordionControl.js +45 -0
  59. package/dist/dts/features/DataLibrary/DatasetAccordionControl.js.map +1 -0
  60. package/dist/dts/features/DataLibrary/EmptyList.d.ts +4 -0
  61. package/dist/dts/features/DataLibrary/EmptyList.d.ts.map +1 -0
  62. package/dist/dts/features/DataLibrary/EmptyList.js +8 -0
  63. package/dist/dts/features/DataLibrary/EmptyList.js.map +1 -0
  64. package/dist/dts/features/DataLibrary/QueryDetails.d.ts +5 -0
  65. package/dist/dts/features/DataLibrary/QueryDetails.d.ts.map +1 -0
  66. package/dist/dts/features/DataLibrary/QueryDetails.js +20 -0
  67. package/dist/dts/features/DataLibrary/QueryDetails.js.map +1 -0
  68. package/dist/dts/features/DataLibrary/SearchAndActions.d.ts +10 -0
  69. package/dist/dts/features/DataLibrary/SearchAndActions.d.ts.map +1 -0
  70. package/dist/dts/features/DataLibrary/SearchAndActions.js +18 -0
  71. package/dist/dts/features/DataLibrary/SearchAndActions.js.map +1 -0
  72. package/dist/dts/features/DataLibrary/index.d.ts +5 -0
  73. package/dist/dts/features/DataLibrary/index.d.ts.map +1 -0
  74. package/dist/dts/features/DataLibrary/index.js +3 -0
  75. package/dist/dts/features/DataLibrary/index.js.map +1 -0
  76. package/dist/dts/features/DataLibrary/modals/SelectedItemsModal.d.ts +9 -0
  77. package/dist/dts/features/DataLibrary/modals/SelectedItemsModal.d.ts.map +1 -0
  78. package/dist/dts/features/DataLibrary/modals/SelectedItemsModal.js +191 -0
  79. package/dist/dts/features/DataLibrary/modals/SelectedItemsModal.js.map +1 -0
  80. package/dist/dts/features/DataLibrary/modals/utils.d.ts +2 -0
  81. package/dist/dts/features/DataLibrary/modals/utils.d.ts.map +1 -0
  82. package/dist/dts/features/DataLibrary/modals/utils.js +45 -0
  83. package/dist/dts/features/DataLibrary/modals/utils.js.map +1 -0
  84. package/dist/dts/features/DataLibrary/selection/SelectionContext.d.ts +67 -0
  85. package/dist/dts/features/DataLibrary/selection/SelectionContext.d.ts.map +1 -0
  86. package/dist/dts/features/DataLibrary/selection/SelectionContext.js +151 -0
  87. package/dist/dts/features/DataLibrary/selection/SelectionContext.js.map +1 -0
  88. package/dist/dts/features/DataLibrary/selection/exportActions.d.ts +3 -0
  89. package/dist/dts/features/DataLibrary/selection/exportActions.d.ts.map +1 -0
  90. package/dist/dts/features/DataLibrary/selection/exportActions.js +119 -0
  91. package/dist/dts/features/DataLibrary/selection/exportActions.js.map +1 -0
  92. package/dist/dts/features/DataLibrary/selection/registeredActions.d.ts +12 -0
  93. package/dist/dts/features/DataLibrary/selection/registeredActions.d.ts.map +1 -0
  94. package/dist/dts/features/DataLibrary/selection/registeredActions.js +29 -0
  95. package/dist/dts/features/DataLibrary/selection/registeredActions.js.map +1 -0
  96. package/dist/dts/features/DataLibrary/selection/selectedItemActions.d.ts +16 -0
  97. package/dist/dts/features/DataLibrary/selection/selectedItemActions.d.ts.map +1 -0
  98. package/dist/dts/features/DataLibrary/selection/selectedItemActions.js +76 -0
  99. package/dist/dts/features/DataLibrary/selection/selectedItemActions.js.map +1 -0
  100. package/dist/dts/features/DataLibrary/selection/selection.d.ts +32 -0
  101. package/dist/dts/features/DataLibrary/selection/selection.d.ts.map +1 -0
  102. package/dist/dts/features/DataLibrary/selection/selection.js +88 -0
  103. package/dist/dts/features/DataLibrary/selection/selection.js.map +1 -0
  104. package/dist/dts/features/DataLibrary/selection/tests/SelectionContext.unit.test.d.ts +2 -0
  105. package/dist/dts/features/DataLibrary/selection/tests/SelectionContext.unit.test.d.ts.map +1 -0
  106. package/dist/dts/features/DataLibrary/selection/tests/SelectionContext.unit.test.js +176 -0
  107. package/dist/dts/features/DataLibrary/selection/tests/SelectionContext.unit.test.js.map +1 -0
  108. package/dist/dts/features/DataLibrary/selection/tests/utils.unit.test.d.ts +2 -0
  109. package/dist/dts/features/DataLibrary/selection/tests/utils.unit.test.d.ts.map +1 -0
  110. package/dist/dts/features/DataLibrary/selection/tests/utils.unit.test.js +79 -0
  111. package/dist/dts/features/DataLibrary/selection/tests/utils.unit.test.js.map +1 -0
  112. package/dist/dts/features/DataLibrary/selection/types.d.ts +31 -0
  113. package/dist/dts/features/DataLibrary/selection/types.d.ts.map +1 -0
  114. package/dist/dts/features/DataLibrary/selection/types.js +2 -0
  115. package/dist/dts/features/DataLibrary/selection/types.js.map +1 -0
  116. package/dist/dts/features/DataLibrary/selection/utils.d.ts +15 -0
  117. package/dist/dts/features/DataLibrary/selection/utils.d.ts.map +1 -0
  118. package/dist/dts/features/DataLibrary/selection/utils.js +85 -0
  119. package/dist/dts/features/DataLibrary/selection/utils.js.map +1 -0
  120. package/dist/dts/features/DataLibrary/tables/AdditionalDataTable.d.ts +8 -0
  121. package/dist/dts/features/DataLibrary/tables/AdditionalDataTable.d.ts.map +1 -0
  122. package/dist/dts/features/DataLibrary/tables/AdditionalDataTable.js +36 -0
  123. package/dist/dts/features/DataLibrary/tables/AdditionalDataTable.js.map +1 -0
  124. package/dist/dts/features/DataLibrary/tables/DatalistContentsPanel.d.ts +1 -0
  125. package/dist/dts/features/DataLibrary/tables/DatalistContentsPanel.d.ts.map +1 -0
  126. package/dist/dts/features/DataLibrary/tables/DatalistContentsPanel.js +130 -0
  127. package/dist/dts/features/DataLibrary/tables/DatalistContentsPanel.js.map +1 -0
  128. package/dist/dts/features/DataLibrary/tables/DatasetContentsTable.d.ts +10 -0
  129. package/dist/dts/features/DataLibrary/tables/DatasetContentsTable.d.ts.map +1 -0
  130. package/dist/dts/features/DataLibrary/tables/DatasetContentsTable.js +149 -0
  131. package/dist/dts/features/DataLibrary/tables/DatasetContentsTable.js.map +1 -0
  132. package/dist/dts/features/DataLibrary/tables/FilesTable.d.ts +11 -0
  133. package/dist/dts/features/DataLibrary/tables/FilesTable.d.ts.map +1 -0
  134. package/dist/dts/features/DataLibrary/tables/FilesTable.js +57 -0
  135. package/dist/dts/features/DataLibrary/tables/FilesTable.js.map +1 -0
  136. package/dist/dts/features/DataLibrary/tables/QueriesTable.d.ts +9 -0
  137. package/dist/dts/features/DataLibrary/tables/QueriesTable.d.ts.map +1 -0
  138. package/dist/dts/features/DataLibrary/tables/QueriesTable.js +36 -0
  139. package/dist/dts/features/DataLibrary/tables/QueriesTable.js.map +1 -0
  140. package/dist/dts/features/DataLibrary/tables/SelectedItemsTable.d.ts +12 -0
  141. package/dist/dts/features/DataLibrary/tables/SelectedItemsTable.d.ts.map +1 -0
  142. package/dist/dts/features/DataLibrary/tables/SelectedItemsTable.js +156 -0
  143. package/dist/dts/features/DataLibrary/tables/SelectedItemsTable.js.map +1 -0
  144. package/dist/dts/features/DataLibrary/tables/tableSettings.d.ts +3 -0
  145. package/dist/dts/features/DataLibrary/tables/tableSettings.d.ts.map +1 -0
  146. package/dist/dts/features/DataLibrary/tables/tableSettings.js +64 -0
  147. package/dist/dts/features/DataLibrary/tables/tableSettings.js.map +1 -0
  148. package/dist/dts/features/DataLibrary/tests/utils.unit.test.d.ts +2 -0
  149. package/dist/dts/features/DataLibrary/tests/utils.unit.test.d.ts.map +1 -0
  150. package/dist/dts/features/DataLibrary/tests/utils.unit.test.js +43 -0
  151. package/dist/dts/features/DataLibrary/tests/utils.unit.test.js.map +1 -0
  152. package/dist/dts/features/DataLibrary/types.d.ts +48 -0
  153. package/dist/dts/features/DataLibrary/types.d.ts.map +1 -0
  154. package/dist/dts/features/DataLibrary/types.js +25 -0
  155. package/dist/dts/features/DataLibrary/types.js.map +1 -0
  156. package/dist/dts/features/DataLibrary/utils.d.ts +28 -0
  157. package/dist/dts/features/DataLibrary/utils.d.ts.map +1 -0
  158. package/dist/dts/features/DataLibrary/utils.js +68 -0
  159. package/dist/dts/features/DataLibrary/utils.js.map +1 -0
  160. package/dist/dts/features/Discovery/ActionBar/DownloadAsZipButton.d.ts.map +1 -1
  161. package/dist/dts/features/Discovery/ActionBar/DownloadAsZipButton.js +0 -1
  162. package/dist/dts/features/Discovery/ActionBar/DownloadAsZipButton.js.map +1 -1
  163. package/dist/dts/features/Discovery/TableRenderers/DataAccessCellRenderers.d.ts.map +1 -1
  164. package/dist/dts/features/Discovery/TableRenderers/DataAccessCellRenderers.js +3 -3
  165. package/dist/dts/features/Discovery/TableRenderers/DataAccessCellRenderers.js.map +1 -1
  166. package/dist/dts/features/Navigation/Footer/FooterColumn.d.ts.map +1 -1
  167. package/dist/dts/features/Navigation/Footer/FooterColumn.js +3 -2
  168. package/dist/dts/features/Navigation/Footer/FooterColumn.js.map +1 -1
  169. package/dist/dts/features/Navigation/Header.d.ts.map +1 -1
  170. package/dist/dts/features/Navigation/Header.js +1 -0
  171. package/dist/dts/features/Navigation/Header.js.map +1 -1
  172. package/dist/dts/features/Navigation/NavigationBar.d.ts.map +1 -1
  173. package/dist/dts/features/Navigation/NavigationBar.js +1 -1
  174. package/dist/dts/features/Navigation/NavigationBar.js.map +1 -1
  175. package/dist/dts/features/Navigation/NavigationBarButton.d.ts +2 -1
  176. package/dist/dts/features/Navigation/NavigationBarButton.d.ts.map +1 -1
  177. package/dist/dts/features/Navigation/NavigationBarButton.js +5 -4
  178. package/dist/dts/features/Navigation/NavigationBarButton.js.map +1 -1
  179. package/dist/dts/features/Navigation/NavigationLogo.js +1 -1
  180. package/dist/dts/features/Navigation/TopBar.d.ts.map +1 -1
  181. package/dist/dts/features/Navigation/TopBar.js +2 -1
  182. package/dist/dts/features/Navigation/TopBar.js.map +1 -1
  183. package/dist/dts/features/Navigation/types.d.ts +7 -6
  184. package/dist/dts/features/Navigation/types.d.ts.map +1 -1
  185. package/dist/dts/features/Workspace/NotebookCard.d.ts.map +1 -1
  186. package/dist/dts/features/Workspace/NotebookCard.js +0 -1
  187. package/dist/dts/features/Workspace/NotebookCard.js.map +1 -1
  188. package/dist/dts/index.d.ts +2 -1
  189. package/dist/dts/index.d.ts.map +1 -1
  190. package/dist/dts/index.js +2 -1
  191. package/dist/dts/index.js.map +1 -1
  192. package/dist/dts/lib/content/filesystem.js +1 -1
  193. package/dist/dts/lib/content/filesystem.js.map +1 -1
  194. package/dist/dts/pages/DataLibrary/DataLibrary.d.ts +8 -0
  195. package/dist/dts/pages/DataLibrary/DataLibrary.d.ts.map +1 -0
  196. package/dist/dts/pages/DataLibrary/DataLibrary.js +24 -0
  197. package/dist/dts/pages/DataLibrary/DataLibrary.js.map +1 -0
  198. package/dist/dts/pages/DataLibrary/data.d.ts +4 -0
  199. package/dist/dts/pages/DataLibrary/data.d.ts.map +1 -0
  200. package/dist/dts/pages/DataLibrary/data.js +81 -0
  201. package/dist/dts/pages/DataLibrary/data.js.map +1 -0
  202. package/dist/dts/pages/DataLibrary/index.d.ts +3 -0
  203. package/dist/dts/pages/DataLibrary/index.d.ts.map +1 -0
  204. package/dist/dts/pages/DataLibrary/index.js +3 -0
  205. package/dist/dts/pages/DataLibrary/index.js.map +1 -0
  206. package/dist/dts/pages/Explorer/data.d.ts.map +1 -1
  207. package/dist/dts/pages/Explorer/data.js.map +1 -1
  208. package/dist/dts/utils/date.d.ts +17 -0
  209. package/dist/dts/utils/date.d.ts.map +1 -0
  210. package/dist/dts/utils/date.js +41 -0
  211. package/dist/dts/utils/date.js.map +1 -0
  212. package/dist/dts/utils/mergeDefaultTailwindClassnames.d.ts +1 -0
  213. package/dist/dts/utils/mergeDefaultTailwindClassnames.d.ts.map +1 -1
  214. package/dist/dts/utils/mergeDefaultTailwindClassnames.js +1 -0
  215. package/dist/dts/utils/mergeDefaultTailwindClassnames.js.map +1 -1
  216. package/dist/dts/utils/tests/date.unit.test.d.ts +2 -0
  217. package/dist/dts/utils/tests/date.unit.test.d.ts.map +1 -0
  218. package/dist/dts/utils/tests/date.unit.test.js +89 -0
  219. package/dist/dts/utils/tests/date.unit.test.js.map +1 -0
  220. package/dist/esm/index.js +2017 -117
  221. package/dist/esm/index.js.map +1 -1
  222. package/dist/index.d.ts +74 -9
  223. package/dist/tsconfig.tsbuildinfo +1 -1
  224. package/package.json +5 -5
package/dist/esm/index.js CHANGED
@@ -1,24 +1,24 @@
1
1
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
  import React__default, { createContext, useState, useMemo, useContext, useCallback, useEffect, useRef, createElement, forwardRef, useReducer } from 'react';
4
- import { useUserAuth, useCoreSelector, selectUserDetails, useGetAuthzMappingsQuery, useGetWorkspaceStatusQuery, useTerminateWorkspaceMutation, selectRequestedWorkspaceStatus, useCoreDispatch, WorkspaceStatus, setActiveWorkspaceStatus, setRequestedWorkspaceStatus, useLazyFetchUserDetailsQuery, selectUserAuthStatus, GEN3_REDIRECT_URL, showModal, Modals, GEN3_FENCE_API, isAuthenticated, useGetLoginProvidersQuery, hideModal, useGetCSRFQuery, selectCurrentModal, fieldNameToTitle, useIsUserLoggedIn, useGetMDSQuery, selectAuthzMappingData, useGetAggMDSQuery, useAskQuestionMutation, useGetIndexAggMDSQuery, useGetTagsQuery, updateCohortFilter, selectIndexedFilterByName, isOperationWithField, removeCohortFilter, trimFirstFieldNameToTitle, selectCohortFilters, handleOperation, selectCurrentCohortId, setCohortFilter, clearCohortFilters, selectCurrentCohortName, useGeneralGQLQuery, selectIndexFilters, useGetRawDataAndTotalCountsQuery, Accessibility, downloadFromGuppyToBlob, downloadJSONDataFromGuppy, useGetAggsQuery, extractEnumFilterValue, useGetCountsQuery, selectHeadersWithCSRFToken, GEN3_GUPPY_API, useLaunchWorkspaceMutation, useGetWorkspacePayModelsQuery, selectActiveWorkspaceStatus, isFetchBaseQueryError, setActiveWorkspace, selectWorkspaceStatusFromService, selectActiveWorkspaceId, useGetWorkspaceOptionsQuery, GEN3_WORKSPACE_API, useGetExternalLoginsQuery, isWorkspaceRunningOrStopping, useSetCurrentPayModelMutation, PodStatus, PodConditionType, GEN3_COMMONS_NAME, createAppStore, createGen3AppWithOwnStore, createAppApiForRTKQ, getGen3AppId, CoreProvider, useGetCredentialsQuery, useRemoveCredentialMutation, useAddNewCredentialMutation, useGetDictionaryQuery, useGetProjectsDetailsQuery, useGetSubmissionsQuery, useLazyGetCrosswalkDataQuery } from '@gen3/core';
5
- import { LoadingOverlay, Card, Group, Avatar, Text, Checkbox, Stack, Tooltip, UnstyledButton, ThemeIcon, Box, Select, Button, Divider, Textarea, FileButton, Anchor, Modal, Grid, Table, ColorSwatch, useMantineTheme, Loader, Center, Paper, Menu, Badge, Alert, Tabs, Accordion, Drawer, CopyButton, factory, useProps, getStyleObject, SegmentedControl, Switch, Autocomplete, TextInput, Title, ActionIcon, NumberInput, RangeSlider, MultiSelect, Transition, rem, Stepper, Image as Image$1, NavLink, Flex, ScrollArea, MantineProvider, createTheme, Highlight, List, FileInput } from '@mantine/core';
4
+ import { useUserAuth, useCoreSelector, selectUserDetails, useGetAuthzMappingsQuery, useGetWorkspaceStatusQuery, useTerminateWorkspaceMutation, selectRequestedWorkspaceStatus, useCoreDispatch, WorkspaceStatus, setActiveWorkspaceStatus, setRequestedWorkspaceStatus, useLazyFetchUserDetailsQuery, selectUserAuthStatus, GEN3_REDIRECT_URL, showModal, Modals, GEN3_FENCE_API, isAuthenticated, useGetLoginProvidersQuery, hideModal, useGetCSRFQuery, selectCurrentModal, fieldNameToTitle, useIsUserLoggedIn, useGetMDSQuery, selectAuthzMappingData, useGetAggMDSQuery, useAskQuestionMutation, useGetIndexAggMDSQuery, useGetTagsQuery, updateCohortFilter, selectIndexedFilterByName, isOperationWithField, removeCohortFilter, trimFirstFieldNameToTitle, selectCohortFilters, handleOperation, selectCurrentCohortId, setCohortFilter, clearCohortFilters, selectCurrentCohortName, useGeneralGQLQuery, selectIndexFilters, useGetRawDataAndTotalCountsQuery, Accessibility, downloadFromGuppyToBlob, downloadJSONDataFromGuppy, useGetAggsQuery, extractEnumFilterValue, useGetCountsQuery, selectHeadersWithCSRFToken, GEN3_GUPPY_API, useLaunchWorkspaceMutation, useGetWorkspacePayModelsQuery, selectActiveWorkspaceStatus, isFetchBaseQueryError, setActiveWorkspace, selectWorkspaceStatusFromService, selectActiveWorkspaceId, useGetWorkspaceOptionsQuery, GEN3_WORKSPACE_API, useGetExternalLoginsQuery, isWorkspaceRunningOrStopping, useSetCurrentPayModelMutation, PodStatus, PodConditionType, GEN3_COMMONS_NAME, createAppStore, createGen3AppWithOwnStore, createAppApiForRTKQ, getGen3AppId, CoreProvider, useGetCredentialsQuery, useRemoveCredentialMutation, useAddNewCredentialMutation, useGetDictionaryQuery, useGetProjectsDetailsQuery, useGetSubmissionsQuery, isCohortItem, isFileItem, fetchFencePresignedURL, HTTPError, isFilterSet, getNumberOfItemsInDatalist, isAdditionalDataItem, getTimestamp, useDataLibrary, useLazyGetCrosswalkDataQuery } from '@gen3/core';
5
+ import { LoadingOverlay, Card, Group, Avatar, Text, Checkbox, Stack, Tooltip, UnstyledButton, ThemeIcon, Box, Select, Button, Divider, Textarea, FileButton, Anchor, Modal, Grid, Table, ColorSwatch, useMantineTheme, Loader, Center, Paper, Menu, Badge, Alert, Tabs, Accordion, Drawer, CopyButton, factory, useProps, getStyleObject, SegmentedControl, Switch, Autocomplete, TextInput, Title, ActionIcon, NumberInput, RangeSlider, MultiSelect, Transition, rem, Stepper, Image as Image$1, NavLink, Flex, ScrollArea, MantineProvider, createTheme, Highlight, List, FileInput, CloseButton } from '@mantine/core';
6
6
  import { useDeepCompareEffect, useDeepCompareMemo, useDeepCompareCallback } from 'use-deep-compare';
7
7
  import { useRouter } from 'next/router';
8
8
  import { usePathname } from 'next/navigation';
9
- import { MdLogin, MdClose, MdKeyboardDoubleArrowLeft, MdUndo, MdSearch, MdInfo, MdExpandLess, MdExpandMore, MdFlip, MdAddCircle, MdRemoveCircle, MdOutlineArrowBack, MdOutlineArrowForward, MdKeyboardArrowDown, MdKeyboardArrowUp, MdDownload, MdFormatQuote, MdOutlineSearch, MdOutlineBarChart, MdGroup, MdDelete } from 'react-icons/md';
9
+ import { MdLogin, MdClose, MdKeyboardDoubleArrowLeft, MdUndo, MdSearch, MdInfo, MdExpandLess, MdExpandMore, MdFlip, MdAddCircle, MdRemoveCircle, MdOutlineArrowBack, MdOutlineArrowForward, MdKeyboardArrowDown, MdKeyboardArrowUp, MdDownload, MdFormatQuote, MdOutlineSearch, MdOutlineBarChart, MdGroup, MdDelete, MdOutlineRemoveCircle } from 'react-icons/md';
10
10
  import 'swr';
11
11
  import { getCookie, deleteCookie, setCookie } from 'cookies-next';
12
12
  import { decodeJwt } from 'jose';
13
13
  import { notifications, showNotification, cleanNotifications, Notifications } from '@mantine/notifications';
14
+ import { twMerge } from 'tailwind-merge';
14
15
  import { IconAlertTriangle } from '@tabler/icons-react';
15
16
  import Markdown from 'react-markdown';
16
17
  import remarkGfm from 'remark-gfm';
17
- import { twMerge } from 'tailwind-merge';
18
18
  import { isArray, toString, capitalize as capitalize$1, get, partial, omit } from 'lodash';
19
19
  import { useCookies } from 'react-cookie';
20
20
  import FileSaver from 'file-saver';
21
- import { useClipboard, useResizeObserver, useDisclosure, useElementSize, useDidUpdate, mergeRefs, useReducedMotion, useMediaQuery, useFullscreen, useLocalStorage, useScrollIntoView } from '@mantine/hooks';
21
+ import { useClipboard, useResizeObserver, useDisclosure, useElementSize, useDidUpdate, mergeRefs, useReducedMotion, useMediaQuery, useFullscreen, useLocalStorage, useScrollIntoView, getHotkeyHandler } from '@mantine/hooks';
22
22
  import { defaultComposer } from 'default-composer';
23
23
  import { Icon, addCollection } from '@iconify/react';
24
24
  import { init, getInstanceByDom } from 'echarts';
@@ -43,7 +43,7 @@ import sum from 'lodash/sum';
43
43
  import tw from 'tailwind-styled-components';
44
44
  import 'universal-cookie';
45
45
  import { RiCloseCircleLine } from 'react-icons/ri';
46
- import { IoMdArrowDropdown, IoMdRefresh, IoMdLogIn } from 'react-icons/io';
46
+ import { IoMdArrowDropdown, IoMdRefresh, IoMdLogIn, IoMdInformationCircleOutline } from 'react-icons/io';
47
47
  import GraphiQL from 'graphiql';
48
48
  import { modals, ModalsProvider } from '@mantine/modals';
49
49
  import { BsArrowsFullscreen } from 'react-icons/bs';
@@ -586,6 +586,36 @@ var LoginButtonVisibility;
586
586
  LoginButtonVisibility["LogoutOnly"] = "logoutOnly";
587
587
  })(LoginButtonVisibility || (LoginButtonVisibility = {}));
588
588
 
589
+ /**
590
+ * Merges default and user values for Tailwind classnames.
591
+ *
592
+ * @param {RecordType} defaultValues - The default values for the classnames.
593
+ * @param {RecordType} userValues - The user-defined values for the classnames.
594
+ * @param {StylingMergeMode} mode - Whether to merge or replace the default and user values. Default is merge.
595
+ * @returns {RecordType} - The merged default and user values for the classnames.
596
+ */ const mergeDefaultTailwindClassnames = (defaultValues, { mode = 'merge', ...userValues })=>{
597
+ const defaultKeys = Object.keys(defaultValues);
598
+ const mergedValues = {
599
+ ...defaultValues
600
+ };
601
+ if (mode === 'merge') {
602
+ defaultKeys.forEach((key)=>{
603
+ if (userValues[key]) {
604
+ mergedValues[key] = twMerge(defaultValues[key], userValues[key]);
605
+ }
606
+ });
607
+ }
608
+ if (mode === 'replace') {
609
+ defaultKeys.forEach((key)=>{
610
+ if (userValues[key]) {
611
+ mergedValues[key] = userValues[key];
612
+ }
613
+ });
614
+ }
615
+ return mergedValues;
616
+ };
617
+ const mergeTailwindClassnameWithDefault = (userValues, defaultValues)=>userValues ? twMerge(defaultValues, userValues) : defaultValues;
618
+
589
619
  const handleSelected = async (isAuthenticated, router, referrer, endSession)=>{
590
620
  if (!isAuthenticated) await router.push(`Login?redirect=${referrer}`);
591
621
  else {
@@ -595,7 +625,7 @@ const handleSelected = async (isAuthenticated, router, referrer, endSession)=>{
595
625
  const LoginButton = ({ icon = /*#__PURE__*/ jsx(MdLogin, {
596
626
  className: "pl-1",
597
627
  size: '1.55rem'
598
- }), hideText = false, className = 'flex flex-nowrap items-center font-content text-secondary-contrast-lighter align-middle border-b-2 hover:border-accent border-transparent mx-2', tooltip, visibility })=>{
628
+ }), hideText = false, className = undefined, tooltip, visibility })=>{
599
629
  const router = useRouter();
600
630
  const pathname = usePathname();
601
631
  const { endSession } = useContext(SessionContext) ?? {
@@ -604,6 +634,7 @@ const LoginButton = ({ icon = /*#__PURE__*/ jsx(MdLogin, {
604
634
  const userStatus = useCoreSelector((state)=>selectUserAuthStatus(state));
605
635
  const authenticated = isAuthenticated(userStatus);
606
636
  if (visibility === LoginButtonVisibility.LogoutOnly && !authenticated) return null;
637
+ const mergedClassname = mergeTailwindClassnameWithDefault(className, 'flex flex-nowrap items-center font-content text-secondary-contrast-lighter align-middle border-b-2 hover:border-accent border-transparent mx-2');
607
638
  return /*#__PURE__*/ jsx(Tooltip, {
608
639
  label: tooltip,
609
640
  position: "bottom",
@@ -615,7 +646,7 @@ const LoginButton = ({ icon = /*#__PURE__*/ jsx(MdLogin, {
615
646
  children: /*#__PURE__*/ jsx(UnstyledButton, {
616
647
  onClick: ()=>handleSelected(authenticated, router, pathname, endSession),
617
648
  children: /*#__PURE__*/ jsxs("div", {
618
- className: `flex items-center font-medium font-heading ${className}`,
649
+ className: mergedClassname,
619
650
  children: [
620
651
  !hideText ? authenticated ? 'Logout' : 'Login' : null,
621
652
  icon
@@ -625,10 +656,10 @@ const LoginButton = ({ icon = /*#__PURE__*/ jsx(MdLogin, {
625
656
  });
626
657
  };
627
658
 
628
- const CardContainer = ({ children })=>/*#__PURE__*/ jsx("div", {
629
- className: "flex justify-center pt-2 items-center",
659
+ const CardContainer = ({ children, width = 'w-1/2' })=>/*#__PURE__*/ jsx("div", {
660
+ className: `flex justify-center pt-2 items-center m-2 ${width ?? ''}`,
630
661
  children: /*#__PURE__*/ jsx(Card, {
631
- shadow: "sm",
662
+ shadow: "xs",
632
663
  p: "md",
633
664
  className: "bg-base-lightest border-2 border-base-lighter",
634
665
  children: /*#__PURE__*/ jsx(Group, {
@@ -645,7 +676,8 @@ const MessageText = ({ message, color })=>/*#__PURE__*/ jsx(Text, {
645
676
  fw: 500,
646
677
  children: message
647
678
  });
648
- const MessageCard = ({ message, icon, size = 'lg', color = 'utility.5' })=>/*#__PURE__*/ jsxs(CardContainer, {
679
+ const MessageCard = ({ message, icon, size = 'lg', color = 'utility.5', width = 'w-1/2' })=>/*#__PURE__*/ jsxs(CardContainer, {
680
+ width: width,
649
681
  children: [
650
682
  /*#__PURE__*/ jsx(ThemeIcon, {
651
683
  color: color,
@@ -878,8 +910,11 @@ var ContentType;
878
910
  ContentType["TextArray"] = "textArray";
879
911
  ContentType["Html"] = "html";
880
912
  ContentType["Markdown"] = "markdown";
913
+ ContentType["TextWithEmail"] = "textWithEmail";
914
+ ContentType["TextWithLink"] = "textWithLink";
915
+ ContentType["Link"] = "link";
881
916
  })(ContentType || (ContentType = {}));
882
- const TextContent = ({ text, className = 'inline text-base-contrast color-red-500 font-medium margin-block-start-1 margin-block-end-1', type = "text" })=>{
917
+ const TextContent = ({ text, className = 'inline text-base-contrast color-red-500 font-medium margin-block-start-1 margin-block-end-1', type = "text", email = undefined, link = undefined })=>{
883
918
  switch(type){
884
919
  case "html":
885
920
  {
@@ -947,6 +982,48 @@ const TextContent = ({ text, className = 'inline text-base-contrast color-red-50
947
982
  })
948
983
  });
949
984
  }
985
+ case "textWithEmail":
986
+ {
987
+ const DEFAULT_STYLE = 'inline color-ink font-medium margin-block-start-1 margin-block-end-1';
988
+ const mergedClassname = className ? twMerge(DEFAULT_STYLE, className) : DEFAULT_STYLE;
989
+ const textString = Array.isArray(text) ? text.join('') : text;
990
+ return /*#__PURE__*/ jsx("div", {
991
+ className: mergedClassname,
992
+ children: /*#__PURE__*/ jsxs("span", {
993
+ children: [
994
+ textString,
995
+ email && /*#__PURE__*/ jsx(Anchor, {
996
+ classNames: {
997
+ root: mergedClassname
998
+ },
999
+ href: `mailto:${email}`,
1000
+ children: ` ${email}.`
1001
+ })
1002
+ ]
1003
+ })
1004
+ });
1005
+ }
1006
+ case "textWithLink":
1007
+ {
1008
+ const DEFAULT_STYLE = 'inline color-ink font-medium margin-block-start-1 margin-block-end-1';
1009
+ const mergedClassname = className ? twMerge(DEFAULT_STYLE, className) : DEFAULT_STYLE;
1010
+ const textString = Array.isArray(text) ? text.join('') : text;
1011
+ return /*#__PURE__*/ jsx("div", {
1012
+ className: mergedClassname,
1013
+ children: /*#__PURE__*/ jsxs("span", {
1014
+ children: [
1015
+ textString,
1016
+ link && /*#__PURE__*/ jsx(Anchor, {
1017
+ classNames: {
1018
+ root: mergedClassname
1019
+ },
1020
+ href: link,
1021
+ children: ` ${email}.`
1022
+ })
1023
+ ]
1024
+ })
1025
+ });
1026
+ }
950
1027
  case "text":
951
1028
  default:
952
1029
  return /*#__PURE__*/ jsx("div", {
@@ -958,28 +1035,6 @@ const TextContent = ({ text, className = 'inline text-base-contrast color-red-50
958
1035
  }
959
1036
  };
960
1037
 
961
- const DEFAULT_STYLE = 'inline color-ink font-medium margin-block-start-1 margin-block-end-1';
962
- const ContactWithEmailContent = ({ text, email, className })=>{
963
- const mergedClassname = className ? twMerge(DEFAULT_STYLE, className) : DEFAULT_STYLE;
964
- const textString = Array.isArray(text) ? text.join(' ') : text;
965
- // TODO: add better support for classnames
966
- return /*#__PURE__*/ jsx("div", {
967
- className: mergedClassname,
968
- children: /*#__PURE__*/ jsxs("span", {
969
- children: [
970
- textString,
971
- email && /*#__PURE__*/ jsx(Anchor, {
972
- classNames: {
973
- root: mergedClassname
974
- },
975
- href: `mailto:${email}`,
976
- children: ` ${email}.`
977
- })
978
- ]
979
- })
980
- });
981
- };
982
-
983
1038
  const filterRedirect = (redirect)=>{
984
1039
  let redirectPath = '';
985
1040
  if (Array.isArray(redirect)) {
@@ -1035,10 +1090,7 @@ const LoginPanel = (loginConfig)=>{
1035
1090
  loginConfig?.showCredentialsLogin && process.env.NODE_ENV === 'development' && /*#__PURE__*/ jsx(CredentialsLogin, {
1036
1091
  handleLogin: handleCredentialsLogin
1037
1092
  }),
1038
- bottomContent?.map((content, index)=>content?.email ? /*#__PURE__*/ createElement(ContactWithEmailContent, {
1039
- ...content,
1040
- key: `bottomContent-${index}`
1041
- }) : /*#__PURE__*/ createElement(TextContent, {
1093
+ bottomContent?.map((content, index)=>/*#__PURE__*/ createElement(TextContent, {
1042
1094
  ...content,
1043
1095
  key: `bottomContent-${index}`
1044
1096
  }))
@@ -2375,35 +2427,6 @@ const extractClassName = (key, classNames)=>{
2375
2427
  return '';
2376
2428
  };
2377
2429
 
2378
- /**
2379
- * Merges default and user values for Tailwind classnames.
2380
- *
2381
- * @param {RecordType} defaultValues - The default values for the classnames.
2382
- * @param {RecordType} userValues - The user-defined values for the classnames.
2383
- * @param {StylingMergeMode} mode - Whether to merge or replace the default and user values. Default is merge.
2384
- * @returns {RecordType} - The merged default and user values for the classnames.
2385
- */ const mergeDefaultTailwindClassnames = (defaultValues, { mode = 'merge', ...userValues })=>{
2386
- const defaultKeys = Object.keys(defaultValues);
2387
- const mergedValues = {
2388
- ...defaultValues
2389
- };
2390
- if (mode === 'merge') {
2391
- defaultKeys.forEach((key)=>{
2392
- if (userValues[key]) {
2393
- mergedValues[key] = twMerge(defaultValues[key], userValues[key]);
2394
- }
2395
- });
2396
- }
2397
- if (mode === 'replace') {
2398
- defaultKeys.forEach((key)=>{
2399
- if (userValues[key]) {
2400
- mergedValues[key] = userValues[key];
2401
- }
2402
- });
2403
- }
2404
- return mergedValues;
2405
- };
2406
-
2407
2430
  const isPropertyKey = (value)=>{
2408
2431
  return typeof value === 'string' || typeof value === 'number' || typeof value === 'symbol';
2409
2432
  };
@@ -2454,8 +2477,9 @@ const FooterRowComponent = ({ item, rowClassname })=>{
2454
2477
  case 'Links':
2455
2478
  {
2456
2479
  const links = item[itemType];
2480
+ const mergedClassname = mergeTailwindClassnameWithDefault(className, 'flex space-x-1');
2457
2481
  return /*#__PURE__*/ jsx("div", {
2458
- className: `flex flex-no-wrap space-x-4 ${className ?? ''}`,
2482
+ className: mergedClassname,
2459
2483
  children: links?.links.map((link, i)=>{
2460
2484
  return /*#__PURE__*/ jsxs(React__default.Fragment, {
2461
2485
  children: [
@@ -2590,19 +2614,20 @@ const Gen3Link = ({ className, href, linkType, text, showExternalIcon = false })
2590
2614
  });
2591
2615
  };
2592
2616
 
2593
- const LoginAccountButton = ()=>{
2617
+ const LoginAccountButton = ({ className = undefined })=>{
2594
2618
  const router = useRouter();
2595
2619
  const handleSelected = async ()=>{
2596
2620
  await router.push('Profile');
2597
2621
  };
2598
2622
  const userStatus = useCoreSelector((state)=>selectUserAuthStatus(state));
2599
2623
  const userInfo = useCoreSelector((state)=>selectUserDetails(state));
2624
+ const mergedClassname = mergeTailwindClassnameWithDefault(className, 'flex flex-nowrap items-center align-middle border-b-2 hover:border-accent border-transparent');
2600
2625
  if (userStatus && isAuthenticated(userStatus)) {
2601
2626
  return /*#__PURE__*/ jsx(UnstyledButton, {
2602
2627
  className: "mx-2",
2603
2628
  onClick: ()=>handleSelected(),
2604
2629
  children: /*#__PURE__*/ jsx("div", {
2605
- className: "flex flex-nowrap items-center align-middle border-b-2 hover:border-accent border-transparent",
2630
+ className: mergedClassname,
2606
2631
  children: userInfo?.username
2607
2632
  })
2608
2633
  });
@@ -2669,7 +2694,8 @@ const processTopBarItems = (items, showLogin)=>{
2669
2694
  };
2670
2695
  const TopBar = ({ items, loginButtonVisibility = LoginButtonVisibility.Hidden, classNames = {} })=>{
2671
2696
  const classNamesDefaults = {
2672
- root: 'flex justify-end items-center align-middle w-100 bg-secondary-lighter'
2697
+ root: 'flex justify-end items-center align-middle w-100 bg-secondary-lighter',
2698
+ login: 'font-content hover:border-accent'
2673
2699
  };
2674
2700
  const mergedClassnames = mergeDefaultTailwindClassnames(classNamesDefaults, classNames);
2675
2701
  return /*#__PURE__*/ jsx("div", {
@@ -2681,9 +2707,12 @@ const TopBar = ({ items, loginButtonVisibility = LoginButtonVisibility.Hidden, c
2681
2707
  className: "flex items-center align-middle",
2682
2708
  children: [
2683
2709
  processTopBarItems(items, loginButtonVisibility === LoginButtonVisibility.Visible),
2684
- loginButtonVisibility != LoginButtonVisibility.Hidden ? /*#__PURE__*/ jsx(LoginAccountButton, {}) : null,
2710
+ loginButtonVisibility != LoginButtonVisibility.Hidden ? /*#__PURE__*/ jsx(LoginAccountButton, {
2711
+ className: extractClassName('login', mergedClassnames)
2712
+ }) : null,
2685
2713
  loginButtonVisibility != LoginButtonVisibility.Hidden ? /*#__PURE__*/ jsx(LoginButton, {
2686
- visibility: loginButtonVisibility
2714
+ visibility: loginButtonVisibility,
2715
+ className: extractClassName('login', mergedClassnames)
2687
2716
  }) : null
2688
2717
  ]
2689
2718
  })
@@ -2712,7 +2741,7 @@ const TopBar = ({ items, loginButtonVisibility = LoginButtonVisibility.Hidden, c
2712
2741
 
2713
2742
  const NavigationLogo = ({ src, title, description, width, height, divider = false, basePath = '', classNames = {} })=>{
2714
2743
  const classNamesDefaults = {
2715
- root: 'relative flex py-2 justify-start items-center align-middle font-heading font-bold tracking-wide text-xl ml-[5px] mr-[20px]',
2744
+ root: 'relative flex py-0 justify-start items-center align-middle font-heading font-bold tracking-wide text-xl ml-[5px] mr-[20px]',
2716
2745
  link: 'relative object-contain',
2717
2746
  logo: 'px-3',
2718
2747
  title: 'border-solid border-base-darker ml-1 mr-3',
@@ -2760,9 +2789,10 @@ const NavigationLogo = ({ src, title, description, width, height, divider = fals
2760
2789
  * @param name - the name of the button
2761
2790
  * @param iconHeight - the height of the icon
2762
2791
  * @param classNames - the class names to use for root, label, icon/tooltip and arrow'
2763
- */ const NavigationBarButton = ({ tooltip, icon, href, name, iconHeight = '27px', classNames = {} })=>{
2792
+ * @param noBasePath - set to true to avoid prepending a basePath to the link
2793
+ */ const NavigationBarButton = ({ tooltip, icon, href, name, iconHeight = '27px', classNames = {}, noBasePath = false })=>{
2764
2794
  const classNamesDefaults = {
2765
- root: `flex flex-col flex-nowrap px-3 py-2 pt-4 items-center align-center text-primary hover:text-accent opacity-80 hover:opacity-100`,
2795
+ root: 'flex flex-col flex-nowrap px-3 py-2 pt-4 items-center align-center text-primary hover:text-accent opacity-80 hover:opacity-100',
2766
2796
  label: 'pt-1.5 body-typo font-heading text-sm text-nowrap',
2767
2797
  icon: 'mt-0.5 ml-1',
2768
2798
  ...TooltipStyle
@@ -2771,13 +2801,31 @@ const NavigationLogo = ({ src, title, description, width, height, divider = fals
2771
2801
  return /*#__PURE__*/ jsx(React__default.Fragment, {
2772
2802
  children: /*#__PURE__*/ jsx(Tooltip, {
2773
2803
  label: tooltip,
2804
+ disabled: !tooltip,
2774
2805
  multiline: true,
2775
2806
  position: "bottom",
2776
2807
  arrowSize: 8,
2777
2808
  withArrow: true,
2778
2809
  zIndex: 1000,
2779
2810
  w: 220,
2780
- children: /*#__PURE__*/ jsx(Link, {
2811
+ children: noBasePath ? /*#__PURE__*/ jsx("a", {
2812
+ href: `${href}`,
2813
+ children: /*#__PURE__*/ jsxs("div", {
2814
+ className: extractClassName('root', mergedClassnames),
2815
+ role: "navigation",
2816
+ children: [
2817
+ /*#__PURE__*/ jsx(Icon, {
2818
+ height: iconHeight,
2819
+ icon: icon,
2820
+ className: extractClassName('icon', mergedClassnames)
2821
+ }),
2822
+ /*#__PURE__*/ jsx("p", {
2823
+ className: extractClassName('label', mergedClassnames),
2824
+ children: name
2825
+ })
2826
+ ]
2827
+ })
2828
+ }) : /*#__PURE__*/ jsx(Link, {
2781
2829
  href: `${// need this to preserve running in hybrid mode
2782
2830
  process.env.NEXT_PUBLIC_PORTAL_BASENAME && process.env.NEXT_PUBLIC_PORTAL_BASENAME !== '/' ? process.env.NEXT_PUBLIC_PORTAL_BASENAME : ''}${href}`,
2783
2831
  children: /*#__PURE__*/ jsxs("div", {
@@ -2847,7 +2895,8 @@ const NavigationLogo = ({ src, title, description, width, height, divider = fals
2847
2895
  icon: x.icon,
2848
2896
  href: x.href,
2849
2897
  name: x.name,
2850
- classNames: x.classNames
2898
+ classNames: x.classNames,
2899
+ noBasePath: x?.noBasePath
2851
2900
  })
2852
2901
  }, `${x.name}-${index}`);
2853
2902
  })
@@ -3014,6 +3063,7 @@ const HorizontalNavigationBar = ({ actions, items, logo = undefined, loginIcon =
3014
3063
  * @param {string} props.type - The type of header to render. Default value is 'original'.
3015
3064
  * @returns {JSX.Element} - The rendered Header component.
3016
3065
  */ const Header = ({ top, navigation, banners, type = 'original' })=>{
3066
+ console.log('top', top);
3017
3067
  return type === 'horizontal' ? /*#__PURE__*/ jsxs("div", {
3018
3068
  className: "w-full",
3019
3069
  children: [
@@ -3359,14 +3409,14 @@ var AccessLevel;
3359
3409
  const DataAccessCellRenderer = ({ value })=>{
3360
3410
  if (value === AccessLevel.PENDING) {
3361
3411
  return /*#__PURE__*/ jsx(LuClock, {
3362
- color: "green",
3363
- children: "You have access to this study."
3412
+ color: "yellow",
3413
+ children: "Your access to this study is pending."
3364
3414
  });
3365
3415
  }
3366
3416
  if (value === AccessLevel.NOT_AVAILABLE) {
3367
3417
  return /*#__PURE__*/ jsx(LuCircleSlash, {
3368
- color: "green",
3369
- children: "You have access to this study."
3418
+ color: "red",
3419
+ children: "Cannot determine access to this study. Please contact the study owner."
3370
3420
  });
3371
3421
  }
3372
3422
  if (value === AccessLevel.ACCESSIBLE) {
@@ -3377,8 +3427,8 @@ const DataAccessCellRenderer = ({ value })=>{
3377
3427
  }
3378
3428
  if (value === AccessLevel.UNACCESSIBLE) {
3379
3429
  return /*#__PURE__*/ jsx(LuLock, {
3380
- color: "green",
3381
- children: "You have access to this study."
3430
+ color: "red",
3431
+ children: "You do not have access to this study."
3382
3432
  });
3383
3433
  }
3384
3434
  return /*#__PURE__*/ jsx(React__default.Fragment, {});
@@ -5064,7 +5114,7 @@ const BuildSummaryStatisticPanel = (summaries = [])=>{
5064
5114
  }
5065
5115
  });
5066
5116
  };
5067
- const columns = [
5117
+ const columns$3 = [
5068
5118
  'grid-cols-0',
5069
5119
  'grid-cols-1',
5070
5120
  'grid-cols-2',
@@ -5079,7 +5129,7 @@ const columns = [
5079
5129
  ];
5080
5130
  const SummaryStatisticPanel = ({ summaries })=>{
5081
5131
  return /*#__PURE__*/ jsx("div", {
5082
- className: `grid ${columns[summaries.length]} grow shrink-0 divide-x-2 divide-accent`,
5132
+ className: `grid ${columns$3[summaries.length]} grow shrink-0 divide-x-2 divide-accent`,
5083
5133
  children: BuildSummaryStatisticPanel(summaries)
5084
5134
  });
5085
5135
  };
@@ -8028,7 +8078,7 @@ const isRangeOperation = (x)=>{
8028
8078
  const isNestedFilter = (x)=>{
8029
8079
  return 'path' in x;
8030
8080
  };
8031
- const IncludeExcludeQueryElement = ({ index, field, path, operator, operands })=>{
8081
+ const IncludeExcludeQueryElement = ({ index, field, path, operator, operands, displayOnly = false })=>{
8032
8082
  const dispatch = useCoreDispatch();
8033
8083
  const [queryExpressionsExpanded, setQueryExpressionsExpanded] = useContext(QueryExpressionsExpandedContext);
8034
8084
  const currentCohortId = useCoreSelector((state)=>selectCurrentCohortId(state));
@@ -8091,12 +8141,12 @@ const IncludeExcludeQueryElement = ({ index, field, path, operator, operands })=
8091
8141
  variant: "filled",
8092
8142
  color: "accent.5",
8093
8143
  size: "md",
8094
- pr: 0,
8095
- className: "normal-case items-center max-w-[162px] cursor-pointer pl-2 pr-0 hover:bg-accent-darker",
8096
- rightSection: /*#__PURE__*/ jsx(RemoveButton, {
8144
+ className: `normal-case items-center max-w-[162px] cursor-pointer hover:bg-accent-darker pl-2 ${displayOnly ? 'pr-3' : 'pr-0'}`,
8145
+ rightSection: !displayOnly && /*#__PURE__*/ jsx(RemoveButton, {
8097
8146
  value: value
8098
8147
  }),
8099
8148
  onClick: ()=>{
8149
+ if (displayOnly) return;
8100
8150
  const newOperands = operandsArray.filter((o)=>o !== x);
8101
8151
  const fieldToUpdate = path && path != '.' ? [
8102
8152
  path,
@@ -8138,7 +8188,7 @@ const IncludeExcludeQueryElement = ({ index, field, path, operator, operands })=
8138
8188
  ]
8139
8189
  });
8140
8190
  };
8141
- const ComparisonElement = ({ index, filter, showLabel = true })=>{
8191
+ const ComparisonElement = ({ index, filter, showLabel = true, displayOnly = false })=>{
8142
8192
  const coreDispatch = useCoreDispatch();
8143
8193
  // fix the code below
8144
8194
  const handleKeepMember = (keep)=>{
@@ -8158,7 +8208,10 @@ const ComparisonElement = ({ index, filter, showLabel = true })=>{
8158
8208
  children: [
8159
8209
  /*#__PURE__*/ jsx("button", {
8160
8210
  className: "h-[25px] w-[25px] mx-2 rounded-[50%] bg-accent-cool-lightest text-accent-cool-lightest-contrast pb-1",
8161
- onClick: ()=>handleKeepMember(filter),
8211
+ onClick: ()=>{
8212
+ if (displayOnly) return;
8213
+ handleKeepMember(filter);
8214
+ },
8162
8215
  children: filter.operator
8163
8216
  }),
8164
8217
  /*#__PURE__*/ jsx(QueryRepresentationText, {
@@ -8211,7 +8264,7 @@ const ClosedRangeQueryElement = ({ index, lower, upper, op = 'and' })=>{
8211
8264
  })
8212
8265
  });
8213
8266
  };
8214
- const QueryElement = ({ index, field, path, children })=>{
8267
+ const QueryElement = ({ index, field, path, children, displayOnly = false })=>{
8215
8268
  const coreDispatch = useCoreDispatch();
8216
8269
  const [, setQueryExpressionsExpanded] = useContext(QueryExpressionsExpandedContext);
8217
8270
  const currentCohortId = useCoreSelector((state)=>selectCurrentCohortId(state));
@@ -8233,7 +8286,7 @@ const QueryElement = ({ index, field, path, children })=>{
8233
8286
  return /*#__PURE__*/ jsxs(QueryItemContainer, {
8234
8287
  children: [
8235
8288
  children,
8236
- /*#__PURE__*/ jsx("button", {
8289
+ !displayOnly && /*#__PURE__*/ jsx("button", {
8237
8290
  className: "bg-accent-vivid p-0 m-0 h-full rounded-r-sm text-white hover:bg-accent-darker",
8238
8291
  onClick: handleRemoveFilter,
8239
8292
  "aria-label": `remove ${fieldNameToTitle(field)}`,
@@ -8248,85 +8301,102 @@ const QueryElement = ({ index, field, path, children })=>{
8248
8301
  /**
8249
8302
  * Processes a Filter into a component representation
8250
8303
  */ class CohortFilterToComponent {
8251
- constructor(index, path = '.'){
8304
+ constructor(index, path = '.', displayOnly = false){
8252
8305
  this.handleIncludes = (f)=>/*#__PURE__*/ jsx(QueryElement, {
8253
8306
  ...f,
8254
8307
  index: this.index,
8255
8308
  path: this.path,
8309
+ displayOnly: this.displayOnly,
8256
8310
  children: /*#__PURE__*/ jsx(IncludeExcludeQueryElement, {
8257
8311
  ...f,
8258
8312
  index: this.index,
8259
- path: this.path
8313
+ path: this.path,
8314
+ displayOnly: this.displayOnly
8260
8315
  })
8261
8316
  }, f.field);
8262
8317
  this.handleExcludes = (f)=>/*#__PURE__*/ jsx(QueryElement, {
8263
8318
  ...f,
8264
8319
  index: this.index,
8265
8320
  path: this.path,
8321
+ displayOnly: this.displayOnly,
8266
8322
  children: /*#__PURE__*/ jsx(IncludeExcludeQueryElement, {
8267
8323
  ...f,
8268
8324
  index: this.index,
8269
- path: this.path
8325
+ path: this.path,
8326
+ displayOnly: this.displayOnly
8270
8327
  })
8271
8328
  }, f.field);
8272
8329
  this.handleEquals = (f)=>/*#__PURE__*/ jsx(QueryElement, {
8273
8330
  ...f,
8274
8331
  index: this.index,
8275
8332
  path: this.path,
8333
+ displayOnly: this.displayOnly,
8276
8334
  children: /*#__PURE__*/ jsx(ComparisonElement, {
8277
8335
  filter: f,
8278
- index: this.index
8336
+ index: this.index,
8337
+ displayOnly: this.displayOnly
8279
8338
  })
8280
8339
  }, f.field);
8281
8340
  this.handleNotEquals = (f)=>/*#__PURE__*/ jsx(QueryElement, {
8282
8341
  ...f,
8283
8342
  index: this.index,
8284
8343
  path: this.path,
8344
+ displayOnly: this.displayOnly,
8285
8345
  children: /*#__PURE__*/ jsx(ComparisonElement, {
8286
8346
  filter: f,
8287
- index: this.index
8347
+ index: this.index,
8348
+ displayOnly: this.displayOnly
8288
8349
  })
8289
8350
  }, f.field);
8290
8351
  this.handleLessThan = (f)=>/*#__PURE__*/ jsx(QueryElement, {
8291
8352
  ...f,
8292
8353
  index: this.index,
8293
8354
  path: this.path,
8355
+ displayOnly: this.displayOnly,
8294
8356
  children: /*#__PURE__*/ jsx(ComparisonElement, {
8295
8357
  filter: f,
8296
- index: this.index
8358
+ index: this.index,
8359
+ displayOnly: this.displayOnly
8297
8360
  })
8298
8361
  }, f.field);
8299
8362
  this.handleLessThanOrEquals = (f)=>/*#__PURE__*/ jsx(QueryElement, {
8300
8363
  ...f,
8301
8364
  index: this.index,
8302
8365
  path: this.path,
8366
+ displayOnly: this.displayOnly,
8303
8367
  children: /*#__PURE__*/ jsx(ComparisonElement, {
8304
8368
  filter: f,
8305
- index: this.index
8369
+ index: this.index,
8370
+ displayOnly: this.displayOnly
8306
8371
  })
8307
8372
  }, f.field);
8308
8373
  this.handleGreaterThan = (f)=>/*#__PURE__*/ jsx(QueryElement, {
8309
8374
  ...f,
8310
8375
  index: this.index,
8311
8376
  path: this.path,
8377
+ displayOnly: this.displayOnly,
8312
8378
  children: /*#__PURE__*/ jsx(ComparisonElement, {
8313
8379
  filter: f,
8314
- index: this.index
8380
+ index: this.index,
8381
+ displayOnly: this.displayOnly
8315
8382
  })
8316
8383
  }, f.field);
8317
8384
  this.handleGreaterThanOrEquals = (f)=>/*#__PURE__*/ jsx(QueryElement, {
8318
8385
  ...f,
8319
8386
  index: this.index,
8320
8387
  path: this.path,
8388
+ displayOnly: this.displayOnly,
8321
8389
  children: /*#__PURE__*/ jsx(ComparisonElement, {
8322
8390
  filter: f,
8323
- index: this.index
8391
+ index: this.index,
8392
+ displayOnly: this.displayOnly
8324
8393
  })
8325
8394
  }, f.field);
8326
8395
  this.handleExists = (f)=>/*#__PURE__*/ jsx(QueryElement, {
8327
8396
  ...f,
8328
8397
  index: this.index,
8329
8398
  path: this.path,
8399
+ displayOnly: this.displayOnly,
8330
8400
  children: /*#__PURE__*/ jsx(ExistsElement, {
8331
8401
  ...f
8332
8402
  })
@@ -8335,6 +8405,7 @@ const QueryElement = ({ index, field, path, children })=>{
8335
8405
  ...f,
8336
8406
  index: this.index,
8337
8407
  path: this.path,
8408
+ displayOnly: this.displayOnly,
8338
8409
  children: /*#__PURE__*/ jsx(ExistsElement, {
8339
8410
  ...f
8340
8411
  })
@@ -8343,9 +8414,11 @@ const QueryElement = ({ index, field, path, children })=>{
8343
8414
  ...f,
8344
8415
  index: this.index,
8345
8416
  path: this.path,
8417
+ displayOnly: this.displayOnly,
8346
8418
  children: /*#__PURE__*/ jsx(IncludeExcludeQueryElement, {
8347
8419
  ...f,
8348
- index: this.index
8420
+ index: this.index,
8421
+ displayOnly: this.displayOnly
8349
8422
  })
8350
8423
  }, f.field);
8351
8424
  this.handleIntersection = (f)=>{
@@ -8379,17 +8452,18 @@ const QueryElement = ({ index, field, path, children })=>{
8379
8452
  return convertFilterToComponent(newOp, this.index, [
8380
8453
  op.path,
8381
8454
  op.operand.path
8382
- ].join('.'));
8455
+ ].join('.'), this.displayOnly);
8383
8456
  } else {
8384
- return convertFilterToComponent(op.operand, this.index, op.path);
8457
+ return convertFilterToComponent(op.operand, this.index, op.path, this.displayOnly);
8385
8458
  }
8386
8459
  };
8387
8460
  this.index = index;
8388
8461
  this.path = path;
8462
+ this.displayOnly = displayOnly;
8389
8463
  }
8390
8464
  }
8391
- const convertFilterToComponent = (filter, index, path = '.')=>{
8392
- const handler = new CohortFilterToComponent(index, path);
8465
+ const convertFilterToComponent = (filter, index, path = '.', displayOnly = false)=>{
8466
+ const handler = new CohortFilterToComponent(index, path, displayOnly);
8393
8467
  return handleOperation(handler, filter);
8394
8468
  };
8395
8469
 
@@ -8599,7 +8673,7 @@ const reducer = (state, action)=>{
8599
8673
  }
8600
8674
  }
8601
8675
  };
8602
- const QueryExpressionSection = ({ index, filters, currentCohortName, currentCohortId })=>{
8676
+ const QueryExpressionSection = ({ index, filters, currentCohortName, currentCohortId, displayOnly = false, showTitle = true })=>{
8603
8677
  const [expandedState, setExpandedState] = useReducer(reducer, {});
8604
8678
  const [filtersSectionCollapsed, setFiltersSectionCollapsed] = useState(true);
8605
8679
  const filtersRef = useRef(null);
@@ -8656,14 +8730,14 @@ const QueryExpressionSection = ({ index, filters, currentCohortName, currentCoho
8656
8730
  "data-testid": "text-cohort-filters-top-row",
8657
8731
  className: "flex flex-row py-2 items-center border-secondary-darkest border-b-1",
8658
8732
  children: [
8659
- /*#__PURE__*/ jsx(OverflowTooltippedLabel, {
8733
+ showTitle && /*#__PURE__*/ jsx(OverflowTooltippedLabel, {
8660
8734
  label: currentCohortName,
8661
8735
  className: "font-bold text-secondary-contrast-darkest ml-3 max-w-[260px]",
8662
8736
  children: currentCohortName
8663
8737
  }),
8664
8738
  /*#__PURE__*/ jsxs(React__default.Fragment, {
8665
8739
  children: [
8666
- /*#__PURE__*/ jsx("button", {
8740
+ !displayOnly && /*#__PURE__*/ jsx("button", {
8667
8741
  "data-testid": "button-clear-all-cohort-filters",
8668
8742
  className: `text-sm font-montserrat ml-2 px-1 hover:bg-primary-darkest hover:text-primary-content-lightest hover:rounded-md ${noFilters ? 'hidden' : 'cursor-pointer text-secondary-contrast-darkest'}`,
8669
8743
  onClick: clearAllFilters,
@@ -8748,7 +8822,7 @@ const QueryExpressionSection = ({ index, filters, currentCohortName, currentCoho
8748
8822
  className: "font-content",
8749
8823
  children: "No filters currently applied."
8750
8824
  }) : Object.keys(filters.root).map((k)=>{
8751
- return convertFilterToComponent(filters.root[k], index);
8825
+ return convertFilterToComponent(filters.root[k], index, '.', displayOnly);
8752
8826
  })
8753
8827
  })
8754
8828
  ]
@@ -10375,7 +10449,6 @@ const NotebookCard = ({ info })=>{
10375
10449
  const { status } = useCoreSelector(selectWorkspaceStatusFromService);
10376
10450
  const requestedStatus = useCoreSelector(selectRequestedWorkspaceStatus);
10377
10451
  const workspaceId = useCoreSelector(selectActiveWorkspaceId);
10378
- console.log('NotebookCard: ', requestedStatus, workspaceId, status);
10379
10452
  return /*#__PURE__*/ jsxs(Card, {
10380
10453
  withBorder: true,
10381
10454
  radius: "xs",
@@ -11205,7 +11278,7 @@ class FilesystemContent {
11205
11278
  }
11206
11279
  async get(filepath) {
11207
11280
  try {
11208
- return await JSON.parse(fs.readFileSync(path.join(this.rootPath, filepath)).toString('utf-8'));
11281
+ return await JSON.parse(fs.readFileSync(path.join(this.rootPath, filepath)).toString('utf8'));
11209
11282
  } catch (err) {
11210
11283
  throw new Error(`Cannot process ${filepath}`);
11211
11284
  }
@@ -16628,7 +16701,6 @@ const AnalysisCardEditor = ()=>{
16628
16701
  });
16629
16702
  if (Array.isArray(withImages)) {
16630
16703
  updateHistory(withImages);
16631
- console.log('Imported cards:', withImages);
16632
16704
  }
16633
16705
  } catch (error) {
16634
16706
  alert('Invalid file format');
@@ -17195,6 +17267,1834 @@ const NotebookLitePageGetStaticProps = async ()=>{
17195
17267
  };
17196
17268
  };
17197
17269
 
17270
+ const getDataLibraryItem = (dataLibrary, listId, dataId, fileId)=>{
17271
+ if (!(listId in dataLibrary)) return undefined;
17272
+ if (!(dataId in dataLibrary[listId].items)) return undefined;
17273
+ const datasetOrCohort = dataLibrary[listId].items[dataId];
17274
+ const { name } = datasetOrCohort;
17275
+ if (isCohortItem(datasetOrCohort)) {
17276
+ return {
17277
+ ...datasetOrCohort,
17278
+ datasetId: dataId,
17279
+ datasetName: name
17280
+ };
17281
+ } else {
17282
+ if (!fileId) return undefined;
17283
+ if (!(fileId in datasetOrCohort.items)) return undefined;
17284
+ if (isFileItem(datasetOrCohort.items[fileId])) {
17285
+ return {
17286
+ datasetName: name,
17287
+ datasetId: dataId,
17288
+ ...datasetOrCohort.items[fileId]
17289
+ };
17290
+ }
17291
+ return undefined;
17292
+ }
17293
+ };
17294
+ const getSelectionPaths = (selections)=>{
17295
+ const paths = [];
17296
+ for (const [listId, listMembers] of Object.entries(selections)){
17297
+ for (const [memberId, member] of Object.entries(listMembers)){
17298
+ if (Object.keys(member.objectIds).length === 0) {
17299
+ // If there are no objectIds, add a path with undefined objectId
17300
+ paths.push({
17301
+ listId,
17302
+ memberId
17303
+ });
17304
+ } else {
17305
+ for (const [objectId, isSelected] of Object.entries(member.objectIds)){
17306
+ if (isSelected) {
17307
+ paths.push({
17308
+ listId,
17309
+ memberId,
17310
+ objectId
17311
+ });
17312
+ }
17313
+ }
17314
+ }
17315
+ }
17316
+ }
17317
+ return paths;
17318
+ };
17319
+ const getSelectedItemsFromDataLibrary = (selections, dataLibrary)=>{
17320
+ const selectedPaths = getSelectionPaths(selections);
17321
+ const uniqueItems = new Map();
17322
+ selectedPaths.forEach((path)=>{
17323
+ const item = getDataLibraryItem(dataLibrary, path.listId, path.memberId, path.objectId);
17324
+ if (item) {
17325
+ const key = getUniqueItemKey(item);
17326
+ uniqueItems.set(key, item);
17327
+ }
17328
+ });
17329
+ return Array.from(uniqueItems.values());
17330
+ };
17331
+ const getUniqueItemKey = (item)=>{
17332
+ if (isCohortItem(item)) {
17333
+ // For CohortItems
17334
+ return `cohort_${item.datasetId}`;
17335
+ } else {
17336
+ // For FileItems
17337
+ return `file_${item.datasetId}_${item.id}`;
17338
+ }
17339
+ };
17340
+
17341
+ // Create the context
17342
+ const DataLibrarySelectionContext = /*#__PURE__*/ createContext(undefined);
17343
+ // Reducer function
17344
+ const dataLibrarySelectionReducer = (selections, action)=>{
17345
+ switch(action.type){
17346
+ case 'UPDATE_DATA_LIBRARY_SELECTION':
17347
+ return {
17348
+ ...selections,
17349
+ [action.payload.listId]: action.payload.members
17350
+ };
17351
+ case 'UPDATE_DATALIST_MEMBER_SELECTION':
17352
+ if (Object.keys(action.payload.selection).length === 0) {
17353
+ // need to remove the dataset
17354
+ const { [action.payload.listId]: { [action.payload.memberId]: _unused, ...restState } } = selections;
17355
+ if (Object.keys(restState).length === 0) {
17356
+ const { [action.payload.listId]: _unused2, ...restList } = selections;
17357
+ return restList;
17358
+ }
17359
+ return {
17360
+ ...selections,
17361
+ [action.payload.listId]: {
17362
+ ...restState
17363
+ }
17364
+ };
17365
+ }
17366
+ return {
17367
+ ...selections,
17368
+ [action.payload.listId]: {
17369
+ ...selections[action.payload.listId],
17370
+ [action.payload.memberId]: {
17371
+ id: action.payload.memberId,
17372
+ objectIds: action.payload.selection
17373
+ }
17374
+ }
17375
+ };
17376
+ case 'DELETE_DATA_LIBRARY_LIST':
17377
+ {
17378
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
17379
+ const { [action.payload.listId]: _unused, ...restState } = selections;
17380
+ return restState;
17381
+ }
17382
+ case 'DELETE_DATA_LIBRARY_LIST_MEMBER':
17383
+ {
17384
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
17385
+ if (!(action.payload.listId in selections)) return selections;
17386
+ const { [action.payload.listId]: { [action.payload.memberId]: _unused, ...restState } } = selections;
17387
+ return {
17388
+ ...selections,
17389
+ [action.payload.listId]: {
17390
+ ...restState
17391
+ }
17392
+ };
17393
+ }
17394
+ case 'CLEAR_DATA_LIBRARY_SELECTION':
17395
+ return {};
17396
+ default:
17397
+ return selections;
17398
+ }
17399
+ };
17400
+ // Provider component
17401
+ const DataLibrarySelectionProvider = ({ children })=>{
17402
+ const [selections, dispatch] = useReducer(dataLibrarySelectionReducer, {});
17403
+ const [gatheredItems, setGatheredItems] = useState([]);
17404
+ const updateSelections = (listId, members)=>{
17405
+ dispatch(updateDataLibrarySelection(listId, members));
17406
+ };
17407
+ const updateListMemberSelections = (listId, memberId, selection)=>{
17408
+ dispatch(updateDataLibraryListMemberSelection(listId, memberId, selection));
17409
+ };
17410
+ const clearSelections = ()=>{
17411
+ dispatch(clearDataLibrarySelection());
17412
+ };
17413
+ const removeList = (listId)=>{
17414
+ dispatch(removeDataLibrarySelection(listId));
17415
+ };
17416
+ const removeListMember = (listId, memberId)=>{
17417
+ dispatch(removeDataLibraryMemberSelection(listId, memberId));
17418
+ };
17419
+ const gatherSelectedItems = (dataLibrary)=>{
17420
+ if (dataLibrary) {
17421
+ const gatheredItems = getSelectedItemsFromDataLibrary(selections, dataLibrary);
17422
+ setGatheredItems(gatheredItems);
17423
+ }
17424
+ };
17425
+ return /*#__PURE__*/ jsx(DataLibrarySelectionContext.Provider, {
17426
+ value: {
17427
+ selections,
17428
+ gatheredItems,
17429
+ dispatch,
17430
+ updateSelections,
17431
+ updateListMemberSelections,
17432
+ clearSelections,
17433
+ removeList,
17434
+ removeListMember,
17435
+ gatherSelectedItems
17436
+ },
17437
+ children: children
17438
+ });
17439
+ };
17440
+ // Custom hook for using the data library
17441
+ const useDataLibrarySelection = ()=>{
17442
+ const context = useContext(DataLibrarySelectionContext);
17443
+ if (!context) {
17444
+ throw new Error('useDataLibrary must be used within a DataLibraryProvider');
17445
+ }
17446
+ return context;
17447
+ };
17448
+ const updateDataLibrarySelection = (listId, members)=>({
17449
+ type: 'UPDATE_DATA_LIBRARY_SELECTION',
17450
+ payload: {
17451
+ listId,
17452
+ members
17453
+ }
17454
+ });
17455
+ const updateDataLibraryListMemberSelection = (listId, memberId, selection)=>({
17456
+ type: 'UPDATE_DATALIST_MEMBER_SELECTION',
17457
+ payload: {
17458
+ listId,
17459
+ memberId,
17460
+ selection
17461
+ }
17462
+ });
17463
+ const clearDataLibrarySelection = ()=>({
17464
+ type: 'CLEAR_DATA_LIBRARY_SELECTION'
17465
+ });
17466
+ const removeDataLibrarySelection = (listId)=>({
17467
+ type: 'DELETE_DATA_LIBRARY_LIST',
17468
+ payload: {
17469
+ listId
17470
+ }
17471
+ });
17472
+ const removeDataLibraryMemberSelection = (listId, memberId)=>({
17473
+ type: 'DELETE_DATA_LIBRARY_LIST_MEMBER',
17474
+ payload: {
17475
+ listId,
17476
+ memberId
17477
+ }
17478
+ });
17479
+ const getNumberOfDataSetItemsSelected = (selections, listId, itemId)=>{
17480
+ return Object.keys(selections?.[listId]?.[itemId]?.objectIds ?? {}).length;
17481
+ };
17482
+ const getNumberOfSelectedItemsInList = (selections, listId)=>{
17483
+ if (!(listId in selections)) return -1; // return -1 indicating there is no listId in selection
17484
+ return Object.keys(selections[listId]).reduce((count, datasetId)=>{
17485
+ try {
17486
+ return count + getNumberOfDataSetItemsSelected(selections, listId, datasetId);
17487
+ } catch (error) {
17488
+ console.error(`Failed to get number of selected items for dataset ${datasetId} in list ${listId}:`, error);
17489
+ return count;
17490
+ }
17491
+ }, 0);
17492
+ };
17493
+ const isListInSelection = (listId, selections)=>listId in selections;
17494
+
17495
+ const IconSize = {
17496
+ xs: 14,
17497
+ sm: 16,
17498
+ md: 20,
17499
+ lg: 24,
17500
+ xl: 32,
17501
+ 'xl-2': 36
17502
+ };
17503
+
17504
+ const SearchAndActions = ({ createList, gatherData, size = 'sm' })=>{
17505
+ const { selections, clearSelections } = useDataLibrarySelection();
17506
+ const retrieveDisabled = Object.keys(selections).length === 0;
17507
+ const iconSize = IconSize[size] || IconSize['sm'];
17508
+ return /*#__PURE__*/ jsx("div", {
17509
+ className: "flex justify-between p-2 bg-primary-dark text-primary-contrast-dark",
17510
+ children: /*#__PURE__*/ jsxs(Group, {
17511
+ children: [
17512
+ /*#__PURE__*/ jsx(Tooltip, {
17513
+ label: "Retrieve selections",
17514
+ children: /*#__PURE__*/ jsx(Button, {
17515
+ disabled: retrieveDisabled,
17516
+ // disabled={Object.keys(selections).length === 0}
17517
+ size: `compact-${size}`,
17518
+ variant: "outline",
17519
+ onClick: ()=>gatherData(),
17520
+ "aria-label": "Retrieve Selected Data",
17521
+ classNames: {
17522
+ root: 'bg-base-max hover:bg-base-light'
17523
+ },
17524
+ children: "Retrieve Selected"
17525
+ })
17526
+ }),
17527
+ /*#__PURE__*/ jsx(Tooltip, {
17528
+ label: "Clear selections",
17529
+ children: /*#__PURE__*/ jsx(ActionIcon, {
17530
+ disabled: retrieveDisabled,
17531
+ variant: "outline",
17532
+ size: size,
17533
+ onClick: ()=>{
17534
+ clearSelections();
17535
+ },
17536
+ color: "accent-contrast.4",
17537
+ "aria-label": "clear selections",
17538
+ children: /*#__PURE__*/ jsx(Icon, {
17539
+ icon: "gen3:clear-list",
17540
+ width: iconSize,
17541
+ height: iconSize
17542
+ })
17543
+ })
17544
+ })
17545
+ ]
17546
+ })
17547
+ });
17548
+ };
17549
+
17550
+ const HTTPUserFriendlyErrorMessages = {
17551
+ // 4xx Client Errors
17552
+ 400: 'Sorry, there was a problem with your request. Please check the information you provided and try again.',
17553
+ 401: 'Please sign in to access this content. If you need to create an account, please contact support.',
17554
+ 402: 'This feature requires payment to continue. Please update your subscription.',
17555
+ 403: "You don't have permission to access this. If you think this is a mistake, please contact support.",
17556
+ 404: "We couldn't find what you're looking for. The link might be broken or the content may have been moved.",
17557
+ 405: 'This action is not supported. Please try a different approach.',
17558
+ 406: "Your browser sent a request that this server couldn't understand. Try updating your browser.",
17559
+ 407: 'Please authenticate with the network proxy first.',
17560
+ 408: 'The request took too long to complete. Please check your internet connection and try again.',
17561
+ 409: 'There was a conflict with your request. Someone might have modified the same content.',
17562
+ 410: 'This content has been permanently removed and is no longer available.',
17563
+ 411: 'There was a technical problem with your request. Please try again.',
17564
+ 412: "Some conditions for this request weren't met. Please try again.",
17565
+ 413: "The file you're trying to upload is too large. Please choose a smaller file.",
17566
+ 414: 'The web address is too long. Please try a shorter URL.',
17567
+ 415: 'This type of file is not supported. Please try a different format.',
17568
+ 416: 'The requested content range is not available.',
17569
+ 417: "Your request couldn't be completed as expected. Please try again.",
17570
+ 418: 'Unusual error occurred. Please try again or contact support if the problem persists.',
17571
+ 421: 'Your request was sent to the wrong server. Please try again.',
17572
+ 422: "We couldn't process your request. Please check the information and try again.",
17573
+ 423: 'This resource is temporarily locked. Please try again in a few moments.',
17574
+ 424: 'The request failed because it depends on another request that failed.',
17575
+ 425: 'Your request was processed too early. Please try again in a moment.',
17576
+ 426: 'You need to upgrade your browser or app to continue.',
17577
+ 428: "Some required conditions weren't met. Please check all requirements and try again.",
17578
+ 429: "You've made too many requests. Please wait a while before trying again.",
17579
+ 431: 'Request failed because the headers are too large. Please simplify your request.',
17580
+ 451: 'This content is not available for legal reasons.',
17581
+ // 5xx Server Errors
17582
+ 500: "Something went wrong on our end. We're working to fix it. Please try again later.",
17583
+ 501: "This feature isn't available yet. Check back later.",
17584
+ 502: "We're having trouble connecting to our servers. Please try again in a few minutes.",
17585
+ 503: "Our service is temporarily unavailable. We're working to restore it as quickly as possible.",
17586
+ 504: 'The server took too long to respond. Please try again later.',
17587
+ 505: "Your browser's HTTP version isn't supported. Please try updating your browser.",
17588
+ 506: 'We encountered a configuration error.',
17589
+ 507: "We're out of storage space.",
17590
+ 508: 'We detected an infinite loop in our servers.',
17591
+ 510: 'This server requires additional extensions to process your request.',
17592
+ 511: 'Please sign in to the network before continuing.'
17593
+ };
17594
+
17595
+ const SelectedItemsTableHeader = ({ numberOfItems, numberOfWarnings, size = 'sm' })=>{
17596
+ const iconSize = IconSize[size] || IconSize['sm'];
17597
+ return /*#__PURE__*/ jsxs("div", {
17598
+ className: "flex items-center bg-primary-darker px-4 py-2 mt-2 min-h-10 text-heading",
17599
+ children: [
17600
+ numberOfItems > 0 && /*#__PURE__*/ jsxs("div", {
17601
+ className: "flex items-center flex-nowrap overflow-ellipsis text-primary-contrast-darker",
17602
+ children: [
17603
+ /*#__PURE__*/ jsx(Text, {
17604
+ fw: 600,
17605
+ size: size,
17606
+ className: "mr-1 ",
17607
+ children: numberOfItems
17608
+ }),
17609
+ /*#__PURE__*/ jsx(Text, {
17610
+ fw: 400,
17611
+ size: size,
17612
+ className: "mr-1 text-primary-contrast-lighter",
17613
+ children: "selected"
17614
+ })
17615
+ ]
17616
+ }),
17617
+ numberOfItems > 0 && numberOfWarnings > 0 && /*#__PURE__*/ jsx(Icon, {
17618
+ icon: "gen3:dot",
17619
+ className: "text-primary-contrast-lighter",
17620
+ width: iconSize,
17621
+ height: iconSize
17622
+ }),
17623
+ numberOfWarnings > 0 && /*#__PURE__*/ jsxs("div", {
17624
+ className: "flex items-center flex-nowrap overflow-ellipsis",
17625
+ children: [
17626
+ /*#__PURE__*/ jsx(Icon, {
17627
+ icon: "gen3:warning",
17628
+ width: iconSize,
17629
+ height: iconSize,
17630
+ className: "text-utility-warning m-1"
17631
+ }),
17632
+ /*#__PURE__*/ jsx(Text, {
17633
+ fw: 600,
17634
+ size: size,
17635
+ className: "mr-1 text-primary-contrast-lighter",
17636
+ children: numberOfWarnings
17637
+ }),
17638
+ /*#__PURE__*/ jsx(Text, {
17639
+ fw: 400,
17640
+ size: size,
17641
+ className: "text-primary-contrast-lighter",
17642
+ children: `${numberOfWarnings == 1 ? 'warning' : 'warnings'}`
17643
+ })
17644
+ ]
17645
+ })
17646
+ ]
17647
+ });
17648
+ };
17649
+ const SelectedItemsTable = ({ validatedItems, rowSelection, setRowSelection, size = 'sm' })=>{
17650
+ const handleRowSelectionChange = (updater)=>{
17651
+ let value = {};
17652
+ setRowSelection((prevSelection)=>{
17653
+ value = updater instanceof Function ? updater(prevSelection) : updater;
17654
+ return value;
17655
+ });
17656
+ };
17657
+ const iconSize = IconSize[size] || IconSize['sm'];
17658
+ const columns = useMemo(()=>[
17659
+ {
17660
+ accessorKey: 'valid',
17661
+ enableHiding: true,
17662
+ size: 40,
17663
+ maxSize: 50,
17664
+ header: 'Valid',
17665
+ Cell: ({ row })=>{
17666
+ if (row.original.valid === undefined) return /*#__PURE__*/ jsx("span", {});
17667
+ if (!row.original.valid) {
17668
+ return /*#__PURE__*/ jsx(Tooltip, {
17669
+ label: row.original?.messages?.join('\n') ?? 'Unknown Error',
17670
+ children: /*#__PURE__*/ jsx(Icon, {
17671
+ icon: "gen3:warning",
17672
+ width: iconSize,
17673
+ height: iconSize,
17674
+ className: "text-utility-warning text-xl",
17675
+ children: /*#__PURE__*/ jsx(Text, {
17676
+ fw: 400,
17677
+ size: size,
17678
+ children: row.original?.messages?.length
17679
+ })
17680
+ })
17681
+ });
17682
+ } else {
17683
+ return /*#__PURE__*/ jsx(Icon, {
17684
+ icon: "gen3:check-fill",
17685
+ width: iconSize,
17686
+ height: iconSize,
17687
+ className: "text-utility-success"
17688
+ });
17689
+ }
17690
+ }
17691
+ },
17692
+ {
17693
+ accessorKey: 'id',
17694
+ header: 'Id'
17695
+ },
17696
+ {
17697
+ accessorKey: 'description',
17698
+ header: 'Description',
17699
+ size: 150,
17700
+ maxSize: 250,
17701
+ Cell: ({ cell })=>{
17702
+ return /*#__PURE__*/ jsx(Text, {
17703
+ fw: 400,
17704
+ size: size,
17705
+ lineClamp: 2,
17706
+ children: cell.getValue() ?? 'N/A'
17707
+ });
17708
+ }
17709
+ },
17710
+ {
17711
+ accessorKey: 'type',
17712
+ header: 'Type'
17713
+ },
17714
+ {
17715
+ accessorKey: 'size',
17716
+ header: 'Size'
17717
+ },
17718
+ {
17719
+ accessorKey: 'datasetId',
17720
+ header: 'Dataset ID'
17721
+ }
17722
+ ], [
17723
+ iconSize,
17724
+ size
17725
+ ]);
17726
+ const tableRows = useDeepCompareMemo(()=>{
17727
+ let hasInvalidRows = false;
17728
+ const rows = validatedItems.map((item)=>{
17729
+ if (!item.valid) hasInvalidRows = true;
17730
+ if (isCohortItem(item)) {
17731
+ return {
17732
+ id: item.id,
17733
+ name: item.name,
17734
+ description: item.description,
17735
+ type: item.itemType,
17736
+ size: undefined,
17737
+ datasetName: item.name,
17738
+ datasetId: item.datasetId,
17739
+ valid: item.valid,
17740
+ messages: item?.errorMessages
17741
+ };
17742
+ }
17743
+ return {
17744
+ id: item.id,
17745
+ name: item.name,
17746
+ description: item.description,
17747
+ type: item.type,
17748
+ size: item.size,
17749
+ datasetId: item.datasetId,
17750
+ datasetName: item.datasetName,
17751
+ valid: item.valid,
17752
+ messages: item?.errorMessages
17753
+ };
17754
+ });
17755
+ return {
17756
+ rows,
17757
+ hasInvalidRows
17758
+ };
17759
+ }, [
17760
+ validatedItems
17761
+ ]);
17762
+ const table = useMantineReactTable({
17763
+ columns,
17764
+ data: tableRows.rows,
17765
+ enableColumnResizing: false,
17766
+ icons: TableIcons,
17767
+ enableTopToolbar: false,
17768
+ enableRowSelection: true,
17769
+ enableBottomToolbar: tableRows.rows.length > 10,
17770
+ enablePagination: tableRows.rows.length > 10,
17771
+ enableRowActions: false,
17772
+ enableStickyFooter: true,
17773
+ enableStickyHeader: true,
17774
+ enableHiding: true,
17775
+ onRowSelectionChange: handleRowSelectionChange,
17776
+ state: {
17777
+ rowSelection
17778
+ },
17779
+ initialState: {
17780
+ density: 'xs',
17781
+ columnPinning: {
17782
+ left: [
17783
+ 'mrt-row-select',
17784
+ 'mrt-row-expand'
17785
+ ],
17786
+ right: [
17787
+ 'mrt-row-actions'
17788
+ ]
17789
+ }
17790
+ },
17791
+ layoutMode: 'semantic',
17792
+ mantineDetailPanelProps: {
17793
+ style: {
17794
+ boxShadow: '0 -2px 0px 0px var(--table-border-color) inset'
17795
+ }
17796
+ },
17797
+ mantineTableProps: {
17798
+ style: {
17799
+ backgroundColor: 'var(--mantine-color-base-1)',
17800
+ '--mrt-striped-row-background-color': 'var(--mantine-color-base-3)'
17801
+ }
17802
+ },
17803
+ mantineTableHeadCellProps: {
17804
+ style: {
17805
+ backgroundColor: 'var(--mantine-color-table-1)',
17806
+ color: 'var(--mantine-color-table-contrast-1)',
17807
+ textAlign: 'center',
17808
+ padding: '0.25rem 0.5rem 0.25rem 0.5rem',
17809
+ fontWeight: 600,
17810
+ fontSize: `var(--mantine-font-size-${size})`
17811
+ }
17812
+ }
17813
+ });
17814
+ return /*#__PURE__*/ jsxs("div", {
17815
+ className: "flex flex-col ml-8",
17816
+ children: [
17817
+ /*#__PURE__*/ jsx(SelectedItemsTableHeader, {
17818
+ numberOfItems: Object.keys(rowSelection).length,
17819
+ numberOfWarnings: tableRows.rows.filter((x)=>x.valid === false).length,
17820
+ size: size
17821
+ }),
17822
+ /*#__PURE__*/ jsx("div", {
17823
+ className: "mt-2",
17824
+ children: /*#__PURE__*/ jsx(MantineReactTable, {
17825
+ table: table
17826
+ })
17827
+ })
17828
+ ]
17829
+ });
17830
+ };
17831
+
17832
+ const isArrayField = (value)=>Array.isArray(value);
17833
+ const isNumeric = (value)=>typeof value === 'number' && !isNaN(value);
17834
+ const evaluateItemRule = (rule, item)=>{
17835
+ switch(rule.operator){
17836
+ case 'equals':
17837
+ case 'not':
17838
+ {
17839
+ const fieldValue = item[rule.field];
17840
+ return rule.operator === 'equals' ? fieldValue === rule.value : fieldValue !== rule.value;
17841
+ }
17842
+ case 'includes':
17843
+ case 'excludes':
17844
+ {
17845
+ const fieldValue = item[rule.field];
17846
+ if (!isArrayField(fieldValue)) return false;
17847
+ return rule.operator === 'includes' ? fieldValue.includes(rule.value) : !fieldValue.includes(rule.value);
17848
+ }
17849
+ case 'greater':
17850
+ case 'less':
17851
+ {
17852
+ const fieldValue = item[rule.field];
17853
+ if (isNumeric(fieldValue) && isNumeric(rule.value)) return rule.operator === 'greater' ? fieldValue > rule.value : fieldValue < rule.value;
17854
+ return false;
17855
+ }
17856
+ default:
17857
+ return false;
17858
+ }
17859
+ };
17860
+ const evaluateGroupRule = (rule, items)=>{
17861
+ switch(rule.operator){
17862
+ case 'count':
17863
+ {
17864
+ const fieldValue = items.map((item)=>item[rule.field]);
17865
+ return fieldValue.length === rule.total;
17866
+ }
17867
+ }
17868
+ };
17869
+ /**
17870
+ * Retrieves an action configuration from a set of actions by its unique identifier.
17871
+ *
17872
+ * @param {ActionsConfig} actions - An array of action configurations.
17873
+ * @param {string} id - The unique identifier of the desired action configuration.
17874
+ * @returns {DataLibraryActionConfig | undefined} The action configuration with the matching identifier, or undefined if not found.
17875
+ */ const getActionById = (actions, id)=>{
17876
+ if (!id) return undefined;
17877
+ return actions.find((action)=>action.id === id);
17878
+ };
17879
+ const doesItemFailRule = (item, action)=>{
17880
+ return action?.itemRules?.reduce((acc, rule)=>{
17881
+ if (!evaluateItemRule(rule, item)) {
17882
+ acc.push(rule.errorMessage);
17883
+ }
17884
+ return acc;
17885
+ }, []) ?? [];
17886
+ };
17887
+ const doesGroupFailRule = (items, action)=>{
17888
+ return action?.groupRules?.reduce((acc, rule)=>{
17889
+ if (!evaluateGroupRule(rule, items)) {
17890
+ acc.push(rule.errorMessage);
17891
+ }
17892
+ return acc;
17893
+ }, []) ?? [];
17894
+ };
17895
+
17896
+ const PRESIGNED_URL_TEMPLATE_VARIABLE = '{{PRESIGNED_URL}}';
17897
+ const isSendExistingPFBToURLParameters = (value)=>{
17898
+ if (!value || typeof value !== 'object') {
17899
+ return false;
17900
+ }
17901
+ const candidate = value;
17902
+ return 'targetURLTemplate' in candidate && typeof candidate.targetURLTemplate === 'string';
17903
+ };
17904
+ const sendExistingPFBToURL = async (validatedSelections, params, done = ()=>null, error = ()=>null, onAbort = ()=>null, signal = undefined)=>{
17905
+ if (!isSendExistingPFBToURLParameters(params)) {
17906
+ console.error('Invalid parameters for sendPFBToURL action:', params);
17907
+ return;
17908
+ }
17909
+ const { targetURLTemplate } = params;
17910
+ // get the selection
17911
+ if (validatedSelections.length !== 1 || !isFileItem(validatedSelections[0])) {
17912
+ notifications.show({
17913
+ id: 'data-library-send-existing-pfb-to-url-validate-length',
17914
+ position: 'bottom-center',
17915
+ withCloseButton: true,
17916
+ autoClose: 5000,
17917
+ title: 'Action Error',
17918
+ message: 'Invalid data passed to send PFB to URL',
17919
+ color: 'red',
17920
+ loading: false
17921
+ });
17922
+ return;
17923
+ }
17924
+ const { guid } = validatedSelections[0];
17925
+ // get the pre-signed URL for the selected PFB
17926
+ try {
17927
+ const presignedURL = await fetchFencePresignedURL({
17928
+ guid: guid,
17929
+ onAbort: onAbort,
17930
+ signal: signal
17931
+ });
17932
+ // the PFB export target URL is a template URL that should have a {{PRESIGNED_URL}} template
17933
+ // variable in it.
17934
+ const signedURL = encodeURIComponent(presignedURL);
17935
+ const targetURL = targetURLTemplate.replace(PRESIGNED_URL_TEMPLATE_VARIABLE, signedURL);
17936
+ return new Promise(()=>{
17937
+ if (window) window.open(targetURL, '_blank', 'noopener,noreferrer');
17938
+ if (done) done(targetURL);
17939
+ });
17940
+ } catch (e) {
17941
+ return new Promise(()=>{
17942
+ error(e);
17943
+ });
17944
+ }
17945
+ };
17946
+
17947
+ const registeredDataLibraryActions = {};
17948
+ const NullAction = ()=>{
17949
+ return new Promise((done)=>{
17950
+ if (done) done();
17951
+ });
17952
+ };
17953
+ const registerAction = (actionName, action)=>{
17954
+ registeredDataLibraryActions[actionName] = action;
17955
+ };
17956
+ const findAction = (actionName)=>{
17957
+ if (actionName === undefined) {
17958
+ console.error('DataLibrary: findAction: no name provided');
17959
+ return undefined;
17960
+ }
17961
+ if (!(actionName in registeredDataLibraryActions)) {
17962
+ console.error('getButtonAction: no action found for', actionName);
17963
+ return undefined;
17964
+ }
17965
+ return registeredDataLibraryActions[actionName];
17966
+ };
17967
+ const registerDefaultDataLibraryActions = ()=>{
17968
+ registerAction('export-pfb-to-url', {
17969
+ action: sendExistingPFBToURL
17970
+ });
17971
+ };
17972
+ registerDefaultDataLibraryActions();
17973
+
17974
+ const ModalHeader = ()=>{
17975
+ return /*#__PURE__*/ jsx("div", {
17976
+ className: "flex justify-between items-center",
17977
+ children: /*#__PURE__*/ jsx(Text, {
17978
+ fw: 600,
17979
+ className: "text-heading",
17980
+ children: "Retrieve Data"
17981
+ })
17982
+ });
17983
+ };
17984
+ const bindAction = (action)=>{
17985
+ const actionFunction = findAction(action.actionFunction);
17986
+ if (!actionFunction) {
17987
+ return NullAction;
17988
+ }
17989
+ return actionFunction.action;
17990
+ };
17991
+ const SelectedItemsModal = (props)=>{
17992
+ const [value, setValue] = useState(null);
17993
+ const { actions } = props;
17994
+ const { gatheredItems } = useDataLibrarySelection();
17995
+ const [rowSelection, setRowSelection] = useState({});
17996
+ const [actionFunction, setActionFunction] = useState({
17997
+ action: NullAction
17998
+ });
17999
+ const [actionConfig, setActionConfig] = useState(null);
18000
+ const [isRunning, setIsRunning] = useState(false);
18001
+ const destinations = useMemo(()=>{
18002
+ return actions.map((action)=>{
18003
+ return {
18004
+ label: action.label,
18005
+ value: action.id
18006
+ };
18007
+ });
18008
+ }, [
18009
+ actions
18010
+ ]);
18011
+ const onError = (error)=>{
18012
+ setIsRunning(false);
18013
+ if (error instanceof HTTPError) {
18014
+ notifications.show({
18015
+ id: 'data-library-selection-action-error',
18016
+ position: 'bottom-center',
18017
+ withCloseButton: true,
18018
+ autoClose: 5000,
18019
+ title: 'Action Error',
18020
+ message: HTTPUserFriendlyErrorMessages[error.status],
18021
+ color: 'red',
18022
+ icon: /*#__PURE__*/ jsx(Icon, {
18023
+ icon: "gen3:outline-error"
18024
+ }),
18025
+ loading: false
18026
+ });
18027
+ }
18028
+ };
18029
+ const onDone = (arg)=>{
18030
+ setIsRunning(false);
18031
+ notifications.show({
18032
+ id: 'data-library-selection-action-done',
18033
+ position: 'bottom-center',
18034
+ withCloseButton: true,
18035
+ autoClose: 5000,
18036
+ title: 'Submission Complete',
18037
+ message: actionConfig ? `${actionConfig.label} completed successfully` : 'Completed successfully',
18038
+ loading: false
18039
+ });
18040
+ };
18041
+ const setSelectionAction = useCallback((actionId)=>{
18042
+ const actionConfig = getActionById(actions, actionId);
18043
+ if (actionConfig) {
18044
+ setActionConfig(actionConfig);
18045
+ const action = bindAction(actionConfig);
18046
+ if (action) setActionFunction({
18047
+ action: action,
18048
+ parameters: actionConfig.parameters
18049
+ });
18050
+ return;
18051
+ }
18052
+ setActionFunction({
18053
+ action: NullAction
18054
+ });
18055
+ }, [
18056
+ actions
18057
+ ]);
18058
+ const validatedLibrarySelections = useDeepCompareMemo(()=>{
18059
+ // get the action
18060
+ const action = getActionById(actions, value?.value);
18061
+ // if there are no actions then everything is valid
18062
+ if (!action) return gatheredItems.map((item)=>{
18063
+ return {
18064
+ ...item,
18065
+ valid: undefined
18066
+ };
18067
+ });
18068
+ // get all selected items
18069
+ const selectedActionItems = gatheredItems.filter((_, index)=>Object.hasOwn(rowSelection, index));
18070
+ // apply group rules of action if any fail then add error message and set flag
18071
+ const groupFailsRule = doesGroupFailRule(selectedActionItems, action);
18072
+ const validItems = gatheredItems.map((item, index)=>{
18073
+ if (rowSelection[index]) {
18074
+ // if selected then validate item rules
18075
+ const itemFailsRule = doesItemFailRule(item, action);
18076
+ const itemAndGroupTestMessages = [
18077
+ ...itemFailsRule,
18078
+ ...groupFailsRule
18079
+ ];
18080
+ if (itemAndGroupTestMessages.length > 0) return {
18081
+ ...item,
18082
+ valid: false,
18083
+ errorMessages: itemAndGroupTestMessages
18084
+ };
18085
+ // defaults return true
18086
+ return {
18087
+ ...item,
18088
+ valid: true
18089
+ };
18090
+ } else return {
18091
+ ...item,
18092
+ valid: undefined
18093
+ };
18094
+ });
18095
+ return validItems;
18096
+ }, [
18097
+ gatheredItems,
18098
+ rowSelection,
18099
+ actions,
18100
+ value
18101
+ ]);
18102
+ const actionButtonDisabled = actionFunction.action === NullAction || validatedLibrarySelections.length === 0 || validatedLibrarySelections.some((x)=>x.valid === false);
18103
+ return /*#__PURE__*/ jsx(Modal, {
18104
+ ...props,
18105
+ closeOnEscape: true,
18106
+ centered: true,
18107
+ withinPortal: false,
18108
+ title: /*#__PURE__*/ jsx(ModalHeader, {}),
18109
+ classNames: {
18110
+ header: 'm-0 p-2 min-h-10 bg-primary-lightest',
18111
+ content: 'scroll-smooth'
18112
+ },
18113
+ overlayProps: {
18114
+ opacity: 0.5
18115
+ },
18116
+ children: /*#__PURE__*/ jsxs(Stack, {
18117
+ children: [
18118
+ /*#__PURE__*/ jsx(SelectedItemsTable, {
18119
+ validatedItems: validatedLibrarySelections,
18120
+ rowSelection: rowSelection,
18121
+ setRowSelection: setRowSelection
18122
+ }),
18123
+ /*#__PURE__*/ jsxs(Group, {
18124
+ justify: "space-between",
18125
+ children: [
18126
+ /*#__PURE__*/ jsxs(Group, {
18127
+ children: [
18128
+ /*#__PURE__*/ jsx(Text, {
18129
+ fw: 600,
18130
+ children: "Destination:"
18131
+ }),
18132
+ /*#__PURE__*/ jsx(Select, {
18133
+ data: destinations,
18134
+ value: value ? value.value : null,
18135
+ onChange: (value, option)=>{
18136
+ setValue(option);
18137
+ if (value) setSelectionAction(value);
18138
+ else setActionFunction({
18139
+ action: NullAction
18140
+ });
18141
+ }
18142
+ })
18143
+ ]
18144
+ }),
18145
+ /*#__PURE__*/ jsx(Button, {
18146
+ loading: isRunning,
18147
+ rightSection: actionConfig?.rightIcon ? /*#__PURE__*/ jsx(Icon, {
18148
+ icon: actionConfig?.rightIcon
18149
+ }) : undefined,
18150
+ disabled: actionButtonDisabled,
18151
+ onClick: async ()=>{
18152
+ setIsRunning(true);
18153
+ await actionFunction.action(validatedLibrarySelections, actionFunction.parameters, onDone, onError);
18154
+ },
18155
+ children: actionConfig ? actionConfig.buttonLabel : 'Submit'
18156
+ })
18157
+ ]
18158
+ })
18159
+ ]
18160
+ })
18161
+ });
18162
+ };
18163
+
18164
+ /**
18165
+ * Extracts and consolidates GUIDs and IDs from dataset contents into a single object.
18166
+ *
18167
+ * @param {DatasetContents} dataset - The dataset containing files and queries to extract IDs from.
18168
+ * @returns {SelectedMembers} An object where each key is a unique identifier from the dataset,
18169
+ * with a boolean value set to true.
18170
+ */ const getObjectIds = (dataset)=>{
18171
+ return [
18172
+ ...dataset.files.map((file)=>file.id),
18173
+ ...dataset.queries.map((query)=>query.id)
18174
+ ].reduce((acc, key)=>{
18175
+ acc[key] = true;
18176
+ return acc;
18177
+ }, {});
18178
+ };
18179
+ /**
18180
+ * Function that generates a mapping of dataset IDs to their respective member objects.
18181
+ *
18182
+ * @param {Array<string>} datasetIds - Array of dataset IDs to be processed.
18183
+ * @param {DatalistMembers} datasetContents - Object containing details about dataset members.
18184
+ * @returns {ListMembers} - An object mapping each dataset ID to its respective member objects.
18185
+ */ const selectAllDatasetMembers = (datasetIds, datasetContents)=>{
18186
+ return datasetIds.reduce((acc, datasetId)=>{
18187
+ acc[datasetId] = {
18188
+ id: datasetId,
18189
+ objectIds: getObjectIds(datasetContents[datasetId])
18190
+ };
18191
+ return acc;
18192
+ }, {});
18193
+ };
18194
+ /**
18195
+ * Retrieves the members of a given dataset or cohort.
18196
+ *
18197
+ * This function takes either a dataset or a cohort item and returns an
18198
+ * object representing the selected members. In the case of a cohort item,
18199
+ * it returns an object with the cohort's ID set to true. For a dataset,
18200
+ * it iterates through the dataset items and sets the keys of file items
18201
+ * to true in the returned object.
18202
+ *
18203
+ * @param {RegisteredDataListEntry | CohortItem} dataSetOrCohort - The dataset or cohort item to process.
18204
+ * @returns {SelectedMembers} An object representing the selected members.
18205
+ */ const getDatasetMembers = (dataSetOrCohort)=>{
18206
+ if (isCohortItem(dataSetOrCohort)) {
18207
+ return {
18208
+ [dataSetOrCohort.id]: true
18209
+ };
18210
+ }
18211
+ return Object.entries(dataSetOrCohort.items).reduce((acc, [key, item])=>{
18212
+ if (isFileItem(item)) acc[key] = true;
18213
+ return acc;
18214
+ }, {});
18215
+ };
18216
+ /**
18217
+ * Selects all list items from the provided data list and transforms them into a ListMembers structure.
18218
+ *
18219
+ * @param {Datalist} members - The data list containing items to be transformed.
18220
+ * @return {ListMembers} - Transformed structure containing the selected list items with dataset IDs and their corresponding object IDs.
18221
+ */ const selectAllListItems = (members)=>{
18222
+ return Object.entries(members.items).reduce((acc, [datasetId, datasetContents])=>{
18223
+ if (isCohortItem(datasetContents)) {
18224
+ acc[datasetId] = {
18225
+ id: datasetId,
18226
+ objectIds: {
18227
+ [datasetId]: true
18228
+ }
18229
+ };
18230
+ } else acc[datasetId] = {
18231
+ id: datasetId,
18232
+ objectIds: getDatasetMembers(datasetContents)
18233
+ };
18234
+ return acc;
18235
+ }, {});
18236
+ };
18237
+
18238
+ const EmptyList = ()=>{
18239
+ return /*#__PURE__*/ jsxs(Group, {
18240
+ gap: "xs",
18241
+ classNames: {
18242
+ root: 'w-100'
18243
+ },
18244
+ children: [
18245
+ /*#__PURE__*/ jsx("span", {
18246
+ className: "text-utility-warning",
18247
+ children: /*#__PURE__*/ jsx(IoMdInformationCircleOutline, {
18248
+ size: "1.5rem"
18249
+ })
18250
+ }),
18251
+ /*#__PURE__*/ jsx(Text, {
18252
+ fw: 600,
18253
+ children: "list is empty"
18254
+ })
18255
+ ]
18256
+ });
18257
+ };
18258
+
18259
+ /**
18260
+ * Formats a given date string into a specific format.
18261
+ *
18262
+ * @param {string} datestr - The date string to be formatted.
18263
+ * @returns {string} The formatted date string.
18264
+ * @throws {Error} Throws an error if the provided date string is invalid or the format is incorrect.
18265
+ *
18266
+ * The function parses the provided date string into a timestamp.
18267
+ */ const formatDate = (datestr)=>{
18268
+ const timestamp = Date.parse(datestr);
18269
+ if (isNaN(timestamp)) {
18270
+ throw new Error('Invalid date string');
18271
+ }
18272
+ const date = new Date(timestamp);
18273
+ const parts = new Intl.DateTimeFormat('en-US', {
18274
+ month: 'short',
18275
+ day: 'numeric',
18276
+ year: 'numeric',
18277
+ hour: '2-digit',
18278
+ minute: '2-digit',
18279
+ second: '2-digit',
18280
+ hour12: false,
18281
+ timeZone: 'UTC'
18282
+ }).formatToParts(date).filter((p)=>p.type !== 'literal') // Filter out literal types like spaces and commas
18283
+ .map((p)=>p.value);
18284
+ if (parts.length !== 6) throw new Error('format date wrong length');
18285
+ const day = parts.slice(0, 3).join('-');
18286
+ const time = parts.slice(3).join(':');
18287
+ return `${day} ${time}`;
18288
+ };
18289
+
18290
+ const DatasetAccordionControl = ({ listName, numberOfItems, updatedTime, createdTime, updateHandler, deleteListHandler, selectListHandler, selectedState, size = 'sm', ...props })=>{
18291
+ const [value, setValue] = useState(undefined);
18292
+ const handleUpdateName = ()=>{
18293
+ updateHandler({
18294
+ name: value
18295
+ });
18296
+ setValue(undefined);
18297
+ };
18298
+ const theme = useMantineTheme();
18299
+ const iconSize = IconSize[size] || IconSize['sm'];
18300
+ return /*#__PURE__*/ jsxs("div", {
18301
+ className: "flex justify-start w-full items-center px-4 group-data-[active]:bg-secondary-lightest",
18302
+ children: [
18303
+ /*#__PURE__*/ jsxs("div", {
18304
+ className: "flex items-center w-1/4",
18305
+ children: [
18306
+ /*#__PURE__*/ jsx(Checkbox, {
18307
+ size: size,
18308
+ onChange: (event)=>{
18309
+ selectListHandler(event.currentTarget.checked);
18310
+ event.stopPropagation();
18311
+ },
18312
+ checked: selectedState == 'checked',
18313
+ indeterminate: selectedState == 'indeterminate'
18314
+ }),
18315
+ /*#__PURE__*/ jsx(Accordion.Control, {
18316
+ ...props,
18317
+ className: "w-4 mr-3"
18318
+ }),
18319
+ value ? /*#__PURE__*/ jsx(TextInput, {
18320
+ size: size,
18321
+ classNames: {
18322
+ root: 'ml-2',
18323
+ input: 'font-bold'
18324
+ },
18325
+ value: value,
18326
+ onChange: (e)=>setValue(e.target.value),
18327
+ onKeyDown: getHotkeyHandler([
18328
+ [
18329
+ 'Enter',
18330
+ handleUpdateName
18331
+ ]
18332
+ ]),
18333
+ rightSection: /*#__PURE__*/ jsx(CloseButton, {
18334
+ "aria-label": "Clear input",
18335
+ onClick: ()=>setValue(undefined),
18336
+ style: {
18337
+ display: value ? undefined : 'none'
18338
+ }
18339
+ })
18340
+ }) : /*#__PURE__*/ jsxs("div", {
18341
+ className: "flex items-center justify-end",
18342
+ children: [
18343
+ /*#__PURE__*/ jsx(Text, {
18344
+ fw: 600,
18345
+ className: "ml-2 w-100 py-2 mr-2",
18346
+ "aria-label": listName,
18347
+ size: size,
18348
+ children: listName
18349
+ }),
18350
+ /*#__PURE__*/ jsx(Tooltip, {
18351
+ label: "Change name of list",
18352
+ children: /*#__PURE__*/ jsx(ActionIcon, {
18353
+ color: "accent.4",
18354
+ variant: "transparent",
18355
+ "aria-label": "Change datalist name",
18356
+ onClick: ()=>setValue(listName),
18357
+ children: /*#__PURE__*/ jsx(Icon, {
18358
+ icon: "gen3:edit",
18359
+ height: iconSize,
18360
+ width: iconSize,
18361
+ color: theme.colors.accent[4]
18362
+ })
18363
+ })
18364
+ })
18365
+ ]
18366
+ })
18367
+ ]
18368
+ }),
18369
+ /*#__PURE__*/ jsxs("div", {
18370
+ className: "flex items-center ml-auto space-x-2",
18371
+ children: [
18372
+ numberOfItems === 0 && /*#__PURE__*/ jsx(EmptyList, {}),
18373
+ /*#__PURE__*/ jsxs("div", {
18374
+ className: "flex items-center space-x-2",
18375
+ children: [
18376
+ /*#__PURE__*/ jsx(Text, {
18377
+ fw: 600,
18378
+ c: "base-contrast.2",
18379
+ tt: "uppercase",
18380
+ size: size,
18381
+ children: "Created:"
18382
+ }),
18383
+ /*#__PURE__*/ jsx(Text, {
18384
+ fw: 500,
18385
+ c: "base-contrast.2",
18386
+ size: size,
18387
+ children: formatDate(createdTime)
18388
+ }),
18389
+ /*#__PURE__*/ jsx(Icon, {
18390
+ icon: "gen3:dot",
18391
+ height: iconSize,
18392
+ width: iconSize,
18393
+ color: theme.colors.accent[4]
18394
+ }),
18395
+ /*#__PURE__*/ jsx(Text, {
18396
+ fw: 600,
18397
+ c: "base-contrast.2",
18398
+ tt: "uppercase",
18399
+ size: size,
18400
+ children: "Updated:"
18401
+ }),
18402
+ /*#__PURE__*/ jsx(Text, {
18403
+ fw: 500,
18404
+ c: "base-contrast.2",
18405
+ size: size,
18406
+ children: formatDate(updatedTime)
18407
+ })
18408
+ ]
18409
+ }),
18410
+ /*#__PURE__*/ jsx(Tooltip, {
18411
+ label: `Delete ${listName}. Will not delete dataset`,
18412
+ children: /*#__PURE__*/ jsx(ActionIcon, {
18413
+ color: "accent.4",
18414
+ variant: "transparent",
18415
+ "aria-label": "delete list",
18416
+ onClick: ()=>deleteListHandler(),
18417
+ children: /*#__PURE__*/ jsx(Icon, {
18418
+ icon: "gen3:delete",
18419
+ height: iconSize,
18420
+ width: iconSize,
18421
+ color: theme.colors.primary[5]
18422
+ })
18423
+ })
18424
+ })
18425
+ ]
18426
+ })
18427
+ ]
18428
+ });
18429
+ };
18430
+
18431
+ const commonTableSettings = (size = 'sm')=>{
18432
+ return {
18433
+ enableColumnResizing: false,
18434
+ icons: TableIcons,
18435
+ enableTopToolbar: false,
18436
+ enableColumnFilters: false,
18437
+ enableColumnActions: false,
18438
+ enableRowActions: true,
18439
+ enableColumnOrdering: false,
18440
+ enableFacetedValues: true,
18441
+ enableGrouping: false,
18442
+ enableColumnPinning: false,
18443
+ enableRowSelection: true,
18444
+ enablePagination: false,
18445
+ enableSelectAll: false,
18446
+ enableExpandAll: false,
18447
+ displayColumnDefOptions: {
18448
+ 'mrt-row-select': {
18449
+ size: 5,
18450
+ header: ''
18451
+ },
18452
+ 'mrt-row-expand': {
18453
+ size: 5,
18454
+ header: ''
18455
+ },
18456
+ 'mrt-row-actions': {
18457
+ header: ''
18458
+ }
18459
+ },
18460
+ initialState: {
18461
+ density: 'xs',
18462
+ columnPinning: {
18463
+ left: [
18464
+ 'mrt-row-select',
18465
+ 'mrt-row-expand'
18466
+ ],
18467
+ right: [
18468
+ 'mrt-row-actions'
18469
+ ]
18470
+ }
18471
+ },
18472
+ layoutMode: 'semantic',
18473
+ mantineDetailPanelProps: {
18474
+ style: {
18475
+ boxShadow: '0 -2px 0px 0px var(--table-border-color) inset'
18476
+ }
18477
+ },
18478
+ mantineTableProps: {
18479
+ style: {
18480
+ backgroundColor: 'var(--mantine-color-base-1)',
18481
+ '--mrt-striped-row-background-color': 'var(--mantine-color-base-3)',
18482
+ fontSize: `var(--mantine-font-size-${size})`
18483
+ }
18484
+ },
18485
+ mantineTableHeadCellProps: {
18486
+ style: {
18487
+ backgroundColor: 'var(--mantine-color-table-1)',
18488
+ color: 'var(--mantine-color-table-contrast-1)',
18489
+ textAlign: 'center',
18490
+ fontWeight: 600,
18491
+ fontSize: `var(--mantine-font-size-${size})`,
18492
+ textTransform: 'uppercase'
18493
+ }
18494
+ }
18495
+ };
18496
+ };
18497
+
18498
+ const columns$2 = [
18499
+ {
18500
+ accessorKey: 'name',
18501
+ header: 'Name'
18502
+ },
18503
+ {
18504
+ accessorKey: 'description',
18505
+ header: 'Description'
18506
+ },
18507
+ {
18508
+ accessorKey: 'documentation',
18509
+ header: 'Documentation'
18510
+ }
18511
+ ];
18512
+ const AdditionalDataTableTable = ({ data, header, size = 'sm' })=>{
18513
+ const table = useMantineReactTable({
18514
+ columns: columns$2,
18515
+ data: data,
18516
+ ...commonTableSettings(size),
18517
+ enableRowActions: false,
18518
+ enableRowSelection: false,
18519
+ enableBottomToolbar: data.length > 10,
18520
+ enablePagination: data.length > 10
18521
+ });
18522
+ return /*#__PURE__*/ jsxs("div", {
18523
+ className: "flex flex-col w-inherit gap-y-1",
18524
+ children: [
18525
+ /*#__PURE__*/ jsx(Text, {
18526
+ fw: 600,
18527
+ fs: "md",
18528
+ c: "secondary.5",
18529
+ tt: "uppercase",
18530
+ children: header
18531
+ }),
18532
+ /*#__PURE__*/ jsx(MantineReactTable, {
18533
+ table: table
18534
+ })
18535
+ ]
18536
+ });
18537
+ };
18538
+
18539
+ const columns$1 = [
18540
+ {
18541
+ accessorKey: 'name',
18542
+ header: 'Name'
18543
+ },
18544
+ {
18545
+ accessorKey: 'description',
18546
+ header: 'Description'
18547
+ },
18548
+ {
18549
+ accessorKey: 'type',
18550
+ header: 'Type'
18551
+ },
18552
+ {
18553
+ accessorKey: 'size',
18554
+ header: 'Size'
18555
+ }
18556
+ ];
18557
+ const FilesTable = ({ listId, datasetId, data, header, size = 'sm' })=>{
18558
+ const [rowSelection, setRowSelection] = useState({});
18559
+ const { selections, updateListMemberSelections } = useDataLibrarySelection();
18560
+ useEffect(()=>{
18561
+ const sel = selections?.[listId]?.[datasetId]?.objectIds ?? {};
18562
+ setRowSelection(sel);
18563
+ }, [
18564
+ listId,
18565
+ datasetId,
18566
+ selections
18567
+ ]);
18568
+ const handleRowSelectionChange = (updater)=>{
18569
+ let value = {};
18570
+ setRowSelection((prevSelection)=>{
18571
+ value = updater instanceof Function ? updater(prevSelection) : updater;
18572
+ return value;
18573
+ });
18574
+ updateListMemberSelections(listId, datasetId, value);
18575
+ };
18576
+ const table = useMantineReactTable({
18577
+ columns: columns$1,
18578
+ data: data,
18579
+ ...commonTableSettings(size),
18580
+ enableBottomToolbar: data.length > 10,
18581
+ enablePagination: data.length > 10,
18582
+ enableRowActions: true,
18583
+ enableHiding: true,
18584
+ getRowId: (originalRow)=>originalRow.id,
18585
+ onRowSelectionChange: handleRowSelectionChange,
18586
+ state: {
18587
+ rowSelection
18588
+ }
18589
+ });
18590
+ return /*#__PURE__*/ jsxs("div", {
18591
+ className: "flex flex-col gap-y-1",
18592
+ children: [
18593
+ /*#__PURE__*/ jsx(Text, {
18594
+ fw: 600,
18595
+ fs: size,
18596
+ c: "secondary.5",
18597
+ tt: "uppercase",
18598
+ children: header
18599
+ }),
18600
+ /*#__PURE__*/ jsx(MantineReactTable, {
18601
+ table: table
18602
+ })
18603
+ ]
18604
+ });
18605
+ };
18606
+
18607
+ const LabeledText = ({ label, text })=>{
18608
+ return /*#__PURE__*/ jsxs("div", {
18609
+ className: "flex p-1 space-x-2",
18610
+ children: [
18611
+ /*#__PURE__*/ jsxs(Text, {
18612
+ fw: 600,
18613
+ children: [
18614
+ label,
18615
+ ":"
18616
+ ]
18617
+ }),
18618
+ /*#__PURE__*/ jsxs(Text, {
18619
+ fw: 400,
18620
+ children: [
18621
+ " ",
18622
+ text
18623
+ ]
18624
+ })
18625
+ ]
18626
+ });
18627
+ };
18628
+ const QueryDetails = ({ name, schemaVersion, index, data, id })=>{
18629
+ if (!data) {
18630
+ return /*#__PURE__*/ jsx(ErrorCard, {
18631
+ message: "No cohort query"
18632
+ });
18633
+ }
18634
+ return /*#__PURE__*/ jsxs("div", {
18635
+ className: "flex flex-col",
18636
+ children: [
18637
+ /*#__PURE__*/ jsxs(Group, {
18638
+ classNames: {
18639
+ root: 'p-2 bg-base-lighter rounded-t-lg border-2 border-b-0 border-base-light'
18640
+ },
18641
+ children: [
18642
+ /*#__PURE__*/ jsx(Text, {
18643
+ fw: 700,
18644
+ children: name
18645
+ }),
18646
+ /*#__PURE__*/ jsx(LabeledText, {
18647
+ label: "Index:",
18648
+ text: index
18649
+ }),
18650
+ /*#__PURE__*/ jsx(LabeledText, {
18651
+ label: "Schema Version:",
18652
+ text: schemaVersion
18653
+ }),
18654
+ /*#__PURE__*/ jsx(LabeledText, {
18655
+ label: "ID:",
18656
+ text: id
18657
+ })
18658
+ ]
18659
+ }),
18660
+ /*#__PURE__*/ jsx("div", {
18661
+ className: "p-2 overflow-scroll w-full bg-base-lighter rounded-b-lg border-2 border-t-0 border-base-light",
18662
+ children: isFilterSet(data) ? /*#__PURE__*/ jsx(QueryExpressionSection, {
18663
+ currentCohortId: id,
18664
+ index: index,
18665
+ currentCohortName: name,
18666
+ filters: data,
18667
+ displayOnly: true,
18668
+ showTitle: false
18669
+ }) : /*#__PURE__*/ jsx(Text, {
18670
+ fw: 400,
18671
+ children: JSON.stringify(data, null, 2)
18672
+ })
18673
+ })
18674
+ ]
18675
+ });
18676
+ };
18677
+
18678
+ /**
18679
+ * Component that manages a List items, which are composed of Dataset and/or Cohorts
18680
+ */ const columns = [
18681
+ {
18682
+ accessorKey: 'name',
18683
+ header: 'Name'
18684
+ },
18685
+ {
18686
+ accessorKey: 'id',
18687
+ header: 'Id'
18688
+ },
18689
+ {
18690
+ accessorKey: 'numFiles',
18691
+ header: '# Files'
18692
+ },
18693
+ {
18694
+ accessorKey: 'isAddDataSource',
18695
+ header: 'Additional Data Sources'
18696
+ }
18697
+ ];
18698
+ const DataSetContentsTable = ({ listId, data, removeList, size = 'sm' })=>{
18699
+ const [rowSelection, setRowSelection] = useState({});
18700
+ const { selections, updateSelections } = useDataLibrarySelection();
18701
+ // build the rows
18702
+ const rows = useDeepCompareMemo(()=>Object.keys(data).map((key)=>{
18703
+ return {
18704
+ name: data[key].name,
18705
+ id: data[key].id,
18706
+ numFiles: data[key]?.files.length || 0,
18707
+ numItems: (data[key]?.files.length || 0) + (data[key]?.queries.length || 0),
18708
+ isAddDataSource: data[key]?.additionalData.length !== 0 ? 'True' : 'False',
18709
+ isCohort: data[key]?.queries.length !== 0 ? 'True' : 'False'
18710
+ };
18711
+ }), [
18712
+ data
18713
+ ]);
18714
+ /**
18715
+ * Handles the change in row selection.
18716
+ *
18717
+ * @param {MRT_Updater<MRT_RowSelectionState>} updater - A function or value
18718
+ * that provides the new state of row selection. If a function is provided,
18719
+ * it will be called with the previous selection state.
18720
+ *
18721
+ * This function updates the state of selected rows by transforming the
18722
+ * updater's value. It generates a mapping of selected members for each
18723
+ * dataset, containing the dataset ID and an object representing the selected
18724
+ * object IDs. It then updates the selections for a given list and filters
18725
+ * the values to indicate whether each dataset has any selected objects.
18726
+ */ const handleRowSelectionChange = (updater)=>{
18727
+ setRowSelection((prevSelection)=>{
18728
+ const value = updater instanceof Function ? updater(prevSelection) : updater;
18729
+ const members = selectAllDatasetMembers(Object.keys(value), data);
18730
+ updateSelections(listId, members);
18731
+ return Object.keys(members).reduce((acc, key)=>{
18732
+ acc[key] = Object.keys(members[key].objectIds).length > 0;
18733
+ return acc;
18734
+ }, {});
18735
+ });
18736
+ };
18737
+ useDeepCompareEffect(()=>{
18738
+ if (!selections[listId]) {
18739
+ // not found in selections, unselect all
18740
+ setRowSelection({});
18741
+ return;
18742
+ }
18743
+ const filteredValues = Object.keys(selections[listId]).reduce((acc, key)=>{
18744
+ const objectIds = selections[listId][key]?.objectIds;
18745
+ if (!objectIds) {
18746
+ console.warn(`Object IDs for key ${key} in list ${listId} are not available`);
18747
+ return acc;
18748
+ }
18749
+ acc[key] = Object.keys(objectIds).length > 0;
18750
+ return acc;
18751
+ }, {});
18752
+ setRowSelection(filteredValues);
18753
+ }, [
18754
+ setRowSelection,
18755
+ selections,
18756
+ listId
18757
+ ]);
18758
+ const table = useMantineReactTable({
18759
+ columns: columns,
18760
+ data: rows,
18761
+ ...commonTableSettings(size),
18762
+ getRowId: (originalRow)=>originalRow.id,
18763
+ onRowSelectionChange: handleRowSelectionChange,
18764
+ enableSelectAll: false,
18765
+ enableBottomToolbar: rows.length > 10,
18766
+ enablePagination: rows.length > 10,
18767
+ enableRowSelection: true,
18768
+ state: {
18769
+ rowSelection
18770
+ },
18771
+ renderEmptyRowsFallback: ()=>/*#__PURE__*/ jsx(EmptyList, {}),
18772
+ defaultColumn: {
18773
+ minSize: 2
18774
+ },
18775
+ displayColumnDefOptions: {
18776
+ 'mrt-row-select': {
18777
+ size: 5,
18778
+ maxSize: 5,
18779
+ header: ''
18780
+ },
18781
+ 'mrt-row-expand': {
18782
+ size: 5,
18783
+ maxSize: 5,
18784
+ header: ''
18785
+ },
18786
+ 'mrt-row-actions': {
18787
+ size: 10,
18788
+ header: ''
18789
+ }
18790
+ },
18791
+ mantineSelectCheckboxProps: ({ row })=>{
18792
+ const selectedCount = getNumberOfDataSetItemsSelected(selections, listId, row.id);
18793
+ const isIndeterminate = selectedCount > 0 && selectedCount != row.original.numItems;
18794
+ return {
18795
+ indeterminate: isIndeterminate,
18796
+ ...isIndeterminate ? {
18797
+ checked: false
18798
+ } : {}
18799
+ };
18800
+ },
18801
+ renderRowActions: ({ row })=>/*#__PURE__*/ jsx(Tooltip, {
18802
+ label: row.original.isCohort ? 'Remove cohort from list' : 'Remove dataset from list',
18803
+ children: /*#__PURE__*/ jsxs(Button, {
18804
+ variant: "transparent",
18805
+ "aria-label": `remove ${row.original.isCohort ? 'cohort' : 'dataset'} ${row.original.name} from list`,
18806
+ onClick: ()=>{
18807
+ removeList(row.id);
18808
+ },
18809
+ children: [
18810
+ /*#__PURE__*/ jsx(MdOutlineRemoveCircle, {
18811
+ size: "1.5rem"
18812
+ }),
18813
+ row.original.itemType
18814
+ ]
18815
+ })
18816
+ }),
18817
+ mantineDetailPanelProps: {
18818
+ style: {
18819
+ padding: '0px',
18820
+ margin: '0px'
18821
+ }
18822
+ },
18823
+ renderDetailPanel: ({ row })=>{
18824
+ const rowData = data[row.id];
18825
+ return /*#__PURE__*/ jsxs("div", {
18826
+ className: "flex flex-col w-full gap-y-4 pr-4",
18827
+ children: [
18828
+ rowData?.files.length > 0 && /*#__PURE__*/ jsx(FilesTable, {
18829
+ header: 'Files',
18830
+ datasetId: rowData.id,
18831
+ listId: listId,
18832
+ data: rowData?.files
18833
+ }),
18834
+ rowData.additionalData.length > 0 && /*#__PURE__*/ jsx(AdditionalDataTableTable, {
18835
+ header: 'Additional Data',
18836
+ data: rowData?.additionalData
18837
+ }),
18838
+ /*#__PURE__*/ jsx(Stack, {
18839
+ children: rowData?.queries.map((query)=>/*#__PURE__*/ createElement(QueryDetails, {
18840
+ header: "Queries",
18841
+ ...query,
18842
+ key: query.id
18843
+ }))
18844
+ })
18845
+ ]
18846
+ });
18847
+ }
18848
+ });
18849
+ return /*#__PURE__*/ jsx("div", {
18850
+ className: "flex flex-col w-full mr-8",
18851
+ children: /*#__PURE__*/ jsx(MantineReactTable, {
18852
+ table: table
18853
+ })
18854
+ });
18855
+ };
18856
+
18857
+ /**
18858
+ * Renders an accordion item with data list details.
18859
+ *
18860
+ * @param {Object} dataListAccordionItemParams - Parameters for the DataListAccordionItem.
18861
+ * @param {Object} dataListAccordionItemParams.dataList - The data list to be displayed in the accordion item.
18862
+ * @param {Function} dataListAccordionItemParams.updateListInDataLibrary - Function to update the list in the data library.
18863
+ * @param {Function} dataListAccordionItemParams.deleteListFromDataLibrary - Function to delete the list from the data library.
18864
+ *
18865
+ * @return {JSX.Element} A rendered accordion item component with controls for data list updates and deletions.
18866
+ */ const DatalistAccordionItem = ({ dataList, updateListInDataLibrary, deleteListFromDataLibrary, size = 'sm' })=>{
18867
+ const [selectedState, setSelectedState] = useState('unchecked');
18868
+ const { id: listId, name: listName } = dataList;
18869
+ const numberOfItemsInList = useMemo(()=>{
18870
+ return getNumberOfItemsInDatalist(dataList);
18871
+ }, [
18872
+ dataList
18873
+ ]);
18874
+ const { selections, updateSelections, removeListMember, removeList } = useDataLibrarySelection();
18875
+ const updateList = async (update)=>{
18876
+ await updateListInDataLibrary(listId, {
18877
+ ...dataList,
18878
+ ...update,
18879
+ updatedTime: getTimestamp()
18880
+ });
18881
+ };
18882
+ const tableRowData = useMemo(()=>Object.entries(dataList.items).reduce((acc, [datasetId, dataItem])=>{
18883
+ const [queries, files, additionalData] = [
18884
+ [],
18885
+ [],
18886
+ []
18887
+ ];
18888
+ if (isCohortItem(dataItem)) {
18889
+ queries.push({
18890
+ ...dataItem,
18891
+ description: '',
18892
+ index: dataItem.index,
18893
+ id: datasetId
18894
+ });
18895
+ } else {
18896
+ // handle RegisteredDataListEntry
18897
+ Object.entries(dataItem.items).forEach(([itemId, item])=>{
18898
+ if (isFileItem(item)) {
18899
+ files.push({
18900
+ ...item,
18901
+ id: itemId
18902
+ });
18903
+ } else if (isAdditionalDataItem(item)) {
18904
+ additionalData.push(item);
18905
+ } else {
18906
+ console.warn('DataLibrary: unknown item', item);
18907
+ }
18908
+ });
18909
+ }
18910
+ // return the
18911
+ acc[datasetId] = {
18912
+ id: datasetId,
18913
+ name: dataItem.name,
18914
+ queries: queries,
18915
+ files: files,
18916
+ additionalData: additionalData
18917
+ };
18918
+ return acc;
18919
+ }, {}), [
18920
+ dataList
18921
+ ]);
18922
+ useEffect(()=>{
18923
+ // list is not in selection
18924
+ if (!isListInSelection(listId, selections)) {
18925
+ setSelectedState('unchecked');
18926
+ return;
18927
+ }
18928
+ const numberOfSelectedItemsInList = getNumberOfSelectedItemsInList(selections, listId);
18929
+ // everything in the list is selected
18930
+ if (numberOfSelectedItemsInList == numberOfItemsInList) {
18931
+ setSelectedState('checked');
18932
+ return;
18933
+ }
18934
+ // list is not in selections
18935
+ if (numberOfSelectedItemsInList === 0) {
18936
+ setSelectedState('unchecked');
18937
+ return;
18938
+ }
18939
+ // some checked items
18940
+ if (numberOfSelectedItemsInList < numberOfItemsInList) setSelectedState('indeterminate');
18941
+ }, [
18942
+ listId,
18943
+ numberOfItemsInList,
18944
+ selections
18945
+ ]);
18946
+ const removeItemFromList = async (itemId)=>{
18947
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
18948
+ const { [itemId]: _removedKey, ...newObject } = dataList.items;
18949
+ await updateListInDataLibrary(listId, {
18950
+ ...dataList,
18951
+ items: newObject,
18952
+ updatedTime: getTimestamp()
18953
+ });
18954
+ // update selections
18955
+ removeListMember(listId, itemId);
18956
+ };
18957
+ const handleSelectList = (checked)=>{
18958
+ if (!checked) {
18959
+ removeList(listId);
18960
+ return;
18961
+ }
18962
+ const selectAllDatasets = selectAllListItems(dataList);
18963
+ updateSelections(listId, selectAllDatasets); // select all the datasets in the list
18964
+ };
18965
+ return /*#__PURE__*/ jsxs(Accordion.Item, {
18966
+ value: listName,
18967
+ className: "group",
18968
+ children: [
18969
+ /*#__PURE__*/ jsx(DatasetAccordionControl, {
18970
+ listName: listName,
18971
+ numberOfItems: numberOfItemsInList,
18972
+ updatedTime: dataList.updatedTime,
18973
+ createdTime: dataList.createdTime,
18974
+ updateHandler: updateList,
18975
+ deleteListHandler: ()=>deleteListFromDataLibrary(listId),
18976
+ selectListHandler: handleSelectList,
18977
+ selectedState: selectedState,
18978
+ size: size
18979
+ }),
18980
+ /*#__PURE__*/ jsx(Accordion.Panel, {
18981
+ children: /*#__PURE__*/ jsx(DataSetContentsTable, {
18982
+ listId: listId,
18983
+ data: tableRowData,
18984
+ removeList: removeItemFromList,
18985
+ size: size
18986
+ })
18987
+ })
18988
+ ]
18989
+ }, listName);
18990
+ };
18991
+
18992
+ const DataLibraryLists = ({ useAPI, actions, size })=>{
18993
+ const { dataLibrary, isError, isLoading, error: dataLibraryError, addListToDataLibrary, updateListInDataLibrary, deleteListFromDataLibrary } = useDataLibrary(useAPI);
18994
+ const [selectedItemsOpen, { open, close }] = useDisclosure(false);
18995
+ const { gatherSelectedItems } = useDataLibrarySelection();
18996
+ const gatherData = ()=>{
18997
+ gatherSelectedItems(dataLibrary);
18998
+ open();
18999
+ };
19000
+ if (isError) {
19001
+ let message = 'There was a error getting the library';
19002
+ if (dataLibraryError && 'data' in dataLibraryError && dataLibraryError?.status in HTTPUserFriendlyErrorMessages) {
19003
+ message = HTTPUserFriendlyErrorMessages[dataLibraryError?.status];
19004
+ }
19005
+ return /*#__PURE__*/ jsx("div", {
19006
+ className: "flex flex-col w-full ml-2",
19007
+ children: /*#__PURE__*/ jsx(Center, {
19008
+ children: /*#__PURE__*/ jsx(ErrorCard, {
19009
+ message: message
19010
+ })
19011
+ })
19012
+ });
19013
+ }
19014
+ return /*#__PURE__*/ jsxs("div", {
19015
+ className: "flex flex-col w-full ml-2",
19016
+ children: [
19017
+ /*#__PURE__*/ jsx(LoadingOverlay, {
19018
+ visible: isLoading
19019
+ }),
19020
+ /*#__PURE__*/ jsx(SelectedItemsModal, {
19021
+ opened: selectedItemsOpen,
19022
+ onClose: close,
19023
+ size: "auto",
19024
+ actions: actions
19025
+ }),
19026
+ /*#__PURE__*/ jsx(SearchAndActions, {
19027
+ createList: addListToDataLibrary,
19028
+ gatherData: gatherData
19029
+ }),
19030
+ /*#__PURE__*/ jsx("div", {
19031
+ className: "flex items-center",
19032
+ children: /*#__PURE__*/ jsx(Accordion, {
19033
+ chevronPosition: "left",
19034
+ classNames: {
19035
+ root: 'w-full',
19036
+ control: 'data-active:bg-secondary-lightest'
19037
+ },
19038
+ children: dataLibrary && Object.values(dataLibrary).map((datalist)=>{
19039
+ return /*#__PURE__*/ jsx(DatalistAccordionItem, {
19040
+ dataList: datalist,
19041
+ size: size,
19042
+ updateListInDataLibrary: updateListInDataLibrary,
19043
+ deleteListFromDataLibrary: deleteListFromDataLibrary
19044
+ }, datalist.id);
19045
+ })
19046
+ })
19047
+ })
19048
+ ]
19049
+ });
19050
+ };
19051
+
19052
+ const DataLibrary = (config)=>{
19053
+ return /*#__PURE__*/ jsx(DataLibrarySelectionProvider, {
19054
+ children: /*#__PURE__*/ jsx(DataLibraryLists, {
19055
+ ...config
19056
+ })
19057
+ });
19058
+ };
19059
+
19060
+ const DataLibraryPage = ({ headerProps, footerProps, config })=>{
19061
+ return /*#__PURE__*/ jsx(NavPageLayout, {
19062
+ headerProps,
19063
+ footerProps,
19064
+ headerData: {
19065
+ title: 'Gen3 DataLibrary Page',
19066
+ content: 'DataLibrary Data',
19067
+ key: 'gen3-data-library-page'
19068
+ },
19069
+ children: /*#__PURE__*/ jsx(DataLibrary, {
19070
+ ...config
19071
+ })
19072
+ });
19073
+ };
19074
+
19075
+ const DataLibraryPageGetServerSideProps = async ()=>{
19076
+ try {
19077
+ const datalibraryConfig = await ContentSource.get(`config/${GEN3_COMMONS_NAME}/dataLibrary.json`);
19078
+ return {
19079
+ props: {
19080
+ ...await getNavPageLayoutPropsFromConfig(),
19081
+ config: datalibraryConfig
19082
+ }
19083
+ };
19084
+ } catch (err) {
19085
+ console.error(err);
19086
+ return {
19087
+ props: {
19088
+ ...await getNavPageLayoutPropsFromConfig(),
19089
+ config: {
19090
+ useAPI: false,
19091
+ actions: []
19092
+ }
19093
+ }
19094
+ };
19095
+ }
19096
+ };
19097
+
17198
19098
  const CrosswalkTable = ({ mapping, data, isFetching, isError, tableMessage, showSubmittedIdInTable })=>{
17199
19099
  const cols = useMemo(()=>{
17200
19100
  return [
@@ -17767,5 +19667,5 @@ async function credentialsLogout(req, res) {
17767
19667
  res.redirect(307, '/');
17768
19668
  }
17769
19669
 
17770
- export { AISearchPageGetServerSideProps, AdminAuthZPageGetServerSideProps, AiSearch, AISearchPage as AiSearchPage, AnalysisCenter, AnalysisEditorPage, AnalysisEditorPageGetServerSideProps, AnalysisPage, AnalysisPageGetServerSideProps, AuthzPage, BaseModal, Charts, CohortBuilder, ColorThemePage, ColorThemePageGetServerSideProps, ContentSource, CreateCredentialsAPIKeyModal, CrosswalkPage, CrosswalkPageGetServerSideProps, Custom404Page, DictionaryPage, DictionaryPageGetServerSideProps, DiscoveryCellRendererFactory, DiscoveryProvider as DiscoveryConfigProvider, DiscoveryIndexPanel, DiscoveryPage, DiscoveryPageGetServerSideProps, DiscoveryRowRendererFactory, EnumFacetChart, ErrorCard, ExplorerPage, ExplorerPageGetServerSideProps, ExplorerTableCellRendererFactory, ExplorerTableDetailsPanelFactory, FirstTimeModal, Footer, Gen3Link, Gen3ModalsProvider, Gen3Provider, GqlQueryEditor$1 as GqlQueryEditor, Header, HoverLink, LandingPage, LandingPageGetStaticProps, LoginButton, LoginPage, LoginPageGetServerSideProps, LoginPanel, LoginProvidersPanel, NavPageLayout, NavigationBar, NavigationButton, NoAccessModal, NotebookLitePage, NotebookLitePageGetStaticProps, ProfilePage, ProfilePageGetServerSideProps, ProfileProvider, ProtectedContent, QueryPage, QueryPageGetServerSideProps, ReactECharts, ResourcesFilters, SPECIAL_CASE_FIELDS, SessionExpiredModal, StudyGroup, SubmissionPage, SubmissionPageGetServerSideProps, TagCloud, TailwindConfig, User, Workspace, WorkspaceNoAccessPage, WorkspaceNoAccessPageServerSideProps, WorkspacePage, WorkspacePageGetServerSideProps, capitalize, computeRowSpan, create10ColorAccessibleContrast, create10ColorPallet, credentialsLogin, credentialsLogout, extractObjectKey, focusStyles, getCurrentUnixTimestamp, getNavPageLayoutPropsFromConfig, getParamsValueAsString, getTagInfo, hasOwnProperty, isArrayOfString, isPropertyKey, isTextTransform$1 as isTextTransform, processLabel$1 as processLabel, processRangeKeyLabel, registerCohortBuilderDefaultPreviewRenderers, registerCohortDiscoveryApp, registerCohortDiversityApp, registerDefaultDiscoveryDataLoaders, registerDiscoveryDefaultCellRenderers, registerDiscoveryDefaultStudyPreviewRenderers, registerExplorerDefaultCellRenderers, removeKey$1 as removeKey, resourcePathFromProjectID, sessionLogout, sessionToken, stripTrailingSlash, toDisplayName, truncateString, unixTimeToString, useDiscoveryContext, userHasMethodForServiceOnResource$1 as userHasMethodForServiceOnResource };
19670
+ export { AISearchPageGetServerSideProps, AdminAuthZPageGetServerSideProps, AiSearch, AISearchPage as AiSearchPage, AnalysisCenter, AnalysisEditorPage, AnalysisEditorPageGetServerSideProps, AnalysisPage, AnalysisPageGetServerSideProps, AuthzPage, BaseModal, Charts, CohortBuilder, ColorThemePage, ColorThemePageGetServerSideProps, ContentSource, CreateCredentialsAPIKeyModal, CrosswalkPage, CrosswalkPageGetServerSideProps, Custom404Page, DataLibraryPage, DataLibraryPageGetServerSideProps, DictionaryPage, DictionaryPageGetServerSideProps, DiscoveryCellRendererFactory, DiscoveryProvider as DiscoveryConfigProvider, DiscoveryIndexPanel, DiscoveryPage, DiscoveryPageGetServerSideProps, DiscoveryRowRendererFactory, EnumFacetChart, ErrorCard, ExplorerPage, ExplorerPageGetServerSideProps, ExplorerTableCellRendererFactory, ExplorerTableDetailsPanelFactory, FirstTimeModal, Footer, Gen3Link, Gen3ModalsProvider, Gen3Provider, GqlQueryEditor$1 as GqlQueryEditor, Header, HoverLink, LandingPage, LandingPageGetStaticProps, LoginButton, LoginPage, LoginPageGetServerSideProps, LoginPanel, LoginProvidersPanel, NavPageLayout, NavigationBar, NavigationButton, NoAccessModal, NotebookLitePage, NotebookLitePageGetStaticProps, ProfilePage, ProfilePageGetServerSideProps, ProfileProvider, ProtectedContent, QueryPage, QueryPageGetServerSideProps, ReactECharts, ResourcesFilters, SPECIAL_CASE_FIELDS, SessionExpiredModal, StudyGroup, SubmissionPage, SubmissionPageGetServerSideProps, TagCloud, TailwindConfig, User, Workspace, WorkspaceNoAccessPage, WorkspaceNoAccessPageServerSideProps, WorkspacePage, WorkspacePageGetServerSideProps, capitalize, computeRowSpan, create10ColorAccessibleContrast, create10ColorPallet, credentialsLogin, credentialsLogout, extractObjectKey, focusStyles, getCurrentUnixTimestamp, getNavPageLayoutPropsFromConfig, getParamsValueAsString, getTagInfo, hasOwnProperty, isArrayOfString, isPropertyKey, isTextTransform$1 as isTextTransform, processLabel$1 as processLabel, processRangeKeyLabel, registerCohortBuilderDefaultPreviewRenderers, registerCohortDiscoveryApp, registerCohortDiversityApp, registerDefaultDiscoveryDataLoaders, registerDiscoveryDefaultCellRenderers, registerDiscoveryDefaultStudyPreviewRenderers, registerExplorerDefaultCellRenderers, removeKey$1 as removeKey, resourcePathFromProjectID, sessionLogout, sessionToken, stripTrailingSlash, toDisplayName, truncateString, unixTimeToString, useDiscoveryContext, userHasMethodForServiceOnResource$1 as userHasMethodForServiceOnResource };
17771
19671
  //# sourceMappingURL=index.js.map