@overmap-ai/core 1.0.53-team-links.0 → 1.0.53

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 (38) hide show
  1. package/dist/overmap-core.js +1359 -1624
  2. package/dist/overmap-core.js.map +1 -1
  3. package/dist/overmap-core.umd.cjs +1362 -1627
  4. package/dist/overmap-core.umd.cjs.map +1 -1
  5. package/dist/sdk/sdk.d.ts +6 -3
  6. package/dist/sdk/services/AgentService.d.ts +1 -1
  7. package/dist/sdk/services/BaseAttachmentService.d.ts +31 -0
  8. package/dist/sdk/services/ComponentAttachmentService.d.ts +10 -0
  9. package/dist/sdk/services/ComponentTypeAttachmentService.d.ts +10 -0
  10. package/dist/sdk/services/DocumentAttachmentService.d.ts +10 -0
  11. package/dist/sdk/services/IssueAttachmentService.d.ts +10 -0
  12. package/dist/sdk/services/IssueService.d.ts +1 -1
  13. package/dist/sdk/services/ProjectAttachmentService.d.ts +10 -0
  14. package/dist/sdk/services/index.d.ts +5 -2
  15. package/dist/store/slices/categorySlice.d.ts +0 -3
  16. package/dist/store/slices/componentSlice.d.ts +15 -7
  17. package/dist/store/slices/componentTypeSlice.d.ts +16 -8
  18. package/dist/store/slices/documentSlice.d.ts +10 -5
  19. package/dist/store/slices/formRevisionSlice.d.ts +30 -33
  20. package/dist/store/slices/index.d.ts +0 -3
  21. package/dist/store/slices/issueSlice.d.ts +33 -24
  22. package/dist/store/slices/projectFileSlice.d.ts +0 -3
  23. package/dist/store/slices/projectSlice.d.ts +12 -3
  24. package/dist/store/slices/utils.d.ts +3 -2
  25. package/dist/store/slices/workspaceSlice.d.ts +0 -3
  26. package/dist/store/store.d.ts +1 -10
  27. package/dist/typings/models/attachments.d.ts +7 -0
  28. package/dist/typings/models/base.d.ts +0 -5
  29. package/dist/typings/models/projects.d.ts +4 -5
  30. package/dist/typings/models/teams.d.ts +0 -15
  31. package/package.json +1 -1
  32. package/dist/sdk/services/AttachmentService.d.ts +0 -46
  33. package/dist/sdk/services/DocumentTeamLinkService.d.ts +0 -8
  34. package/dist/sdk/services/IssueTypeTeamLinkService.d.ts +0 -8
  35. package/dist/sdk/services/UserFormTeamLinkService.d.ts +0 -8
  36. package/dist/store/slices/documentTeamLinkSlice.d.ts +0 -20
  37. package/dist/store/slices/issueTypeTeamLinkSlice.d.ts +0 -20
  38. package/dist/store/slices/userFormTeamLinkSlice.d.ts +0 -20
@@ -8,7 +8,7 @@ var _a;
8
8
  import * as React from "react";
9
9
  import React__default, { useState, useEffect, useRef, memo, useMemo, useCallback, createContext, createElement, useContext, forwardRef, Children, isValidElement, cloneElement, Fragment as Fragment$1, useLayoutEffect, useReducer, lazy, Suspense } from "react";
10
10
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
11
- import { unsafeShowToast, AlertDialogProvider, ToastProvider, DefaultTheme, Flex as Flex$1, IconButton, RiIcon, Text as Text$1, useSeverityColor, Checkbox, TextArea, Select, useToast, Badge, MultiSelect, Overlay, Button, Spinner, useViewportSize, ButtonGroup, IconColorUtility, Tooltip, Popover, useSize, ToggleButton, Separator, OvermapItem, ButtonList, divButtonProps, OvermapDropdownMenu, Input, useAlertDialog } from "@overmap-ai/blocks";
11
+ import { unsafeShowToast, AlertDialogProvider, ToastProvider, DefaultTheme, Flex as Flex$1, IconButton, RiIcon, Text as Text$1, useSeverityColor, TextArea, Select, useToast, Badge, MultiSelect, Overlay, Button, Spinner, useViewportSize, ButtonGroup, IconColorUtility, Tooltip, Popover, useSize, ToggleButton, Separator, OvermapItem, ButtonList, divButtonProps, OvermapDropdownMenu, Checkbox as Checkbox$1, Input, useAlertDialog } from "@overmap-ai/blocks";
12
12
  import { DepGraph } from "dependency-graph";
13
13
  import { offline as offline$1 } from "@redux-offline/redux-offline";
14
14
  import offlineConfig from "@redux-offline/redux-offline/lib/defaults";
@@ -24,6 +24,7 @@ import jwtDecode from "jwt-decode";
24
24
  import { RESET_STATE } from "@redux-offline/redux-offline/lib/constants";
25
25
  import { openDB } from "idb";
26
26
  import { useField, useFormikContext, useFormik, FormikProvider } from "formik";
27
+ import { flushSync } from "react-dom";
27
28
  import get from "lodash.get";
28
29
  import Linkify from "linkify-react";
29
30
  import { DragDropContext, Droppable, Draggable } from "@hello-pangea/dnd";
@@ -32,7 +33,6 @@ import { read, utils } from "xlsx";
32
33
  import { pdfjs, Document, Page } from "react-pdf";
33
34
  import "react-pdf/dist/Page/AnnotationLayer.css";
34
35
  import "react-pdf/dist/Page/TextLayer.css";
35
- import { flushSync } from "react-dom";
36
36
  import { ReactSketchCanvas } from "react-sketch-canvas";
37
37
  import set from "lodash.set";
38
38
  import cloneDeep from "lodash.clonedeep";
@@ -678,15 +678,15 @@ const wrapMigration = (migrator) => (state) => {
678
678
  };
679
679
  const migrations = [initialVersioning, signOut, signOut, createOutboxState];
680
680
  const manifest = Object.fromEntries(migrations.map((migration2, i) => [i, wrapMigration(migration2)]));
681
- const initialState$u = {
681
+ const initialState$r = {
682
682
  accessToken: "",
683
683
  refreshToken: "",
684
684
  isLoggedIn: false
685
685
  };
686
686
  const authSlice = createSlice({
687
687
  name: "auth",
688
- initialState: initialState$u,
689
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$u)),
688
+ initialState: initialState$r,
689
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$r)),
690
690
  reducers: {
691
691
  setTokens: (state, action) => {
692
692
  state.accessToken = action.payload.accessToken;
@@ -1430,7 +1430,7 @@ const getLocalRelativeDateString = memoize((date, min, max) => {
1430
1430
  return getLocalDateString(date);
1431
1431
  return relative.format(days, "days");
1432
1432
  });
1433
- const initialState$t = {
1433
+ const initialState$q = {
1434
1434
  categories: {},
1435
1435
  usedCategoryColors: [],
1436
1436
  categoryVisibility: {
@@ -1440,8 +1440,8 @@ const initialState$t = {
1440
1440
  };
1441
1441
  const categorySlice = createSlice({
1442
1442
  name: "categories",
1443
- initialState: initialState$t,
1444
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$t)),
1443
+ initialState: initialState$q,
1444
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$q)),
1445
1445
  reducers: {
1446
1446
  setCategories: (state, action) => {
1447
1447
  if (!Array.isArray(action.payload))
@@ -1577,6 +1577,9 @@ const selectIssueCountOfCategory = (categoryId) => (state) => {
1577
1577
  return Object.values(state.issueReducer.issues).filter((issue) => issue.category === categoryId).length;
1578
1578
  };
1579
1579
  const categoryReducer = categorySlice.reducer;
1580
+ function setAttachment(state, action) {
1581
+ state.attachments[action.payload.offline_id] = action.payload;
1582
+ }
1580
1583
  function setAttachments(state, action) {
1581
1584
  state.attachments = {};
1582
1585
  for (const attachment of action.payload) {
@@ -1601,6 +1604,15 @@ function updateAttachment(state, action) {
1601
1604
  throw new Error(`Attachment ${action.payload.offline_id} does not exist.`);
1602
1605
  }
1603
1606
  }
1607
+ function updateAttachments(state, action) {
1608
+ for (const attachment of action.payload) {
1609
+ if (attachment.offline_id in state.attachments) {
1610
+ state.attachments[attachment.offline_id] = attachment;
1611
+ } else {
1612
+ throw new Error(`Attachment ${attachment.offline_id} does not exist.`);
1613
+ }
1614
+ }
1615
+ }
1604
1616
  function removeAttachment(state, action) {
1605
1617
  if (action.payload in state.attachments) {
1606
1618
  delete state.attachments[action.payload];
@@ -1613,14 +1625,14 @@ function removeAttachments(state, action) {
1613
1625
  delete state.attachments[attachmentId];
1614
1626
  }
1615
1627
  }
1616
- const initialState$s = {
1628
+ const initialState$p = {
1617
1629
  components: {},
1618
1630
  attachments: {}
1619
1631
  };
1620
1632
  const componentSlice = createSlice({
1621
1633
  name: "components",
1622
- initialState: initialState$s,
1623
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$s)),
1634
+ initialState: initialState$p,
1635
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$p)),
1624
1636
  reducers: {
1625
1637
  addComponent: (state, action) => {
1626
1638
  state.components[action.payload.offline_id] = action.payload;
@@ -1634,12 +1646,6 @@ const componentSlice = createSlice({
1634
1646
  state.components = toOfflineIdRecord(action.payload);
1635
1647
  prevComponents = null;
1636
1648
  },
1637
- setComponentAttachments: setAttachments,
1638
- addComponentAttachment: addAttachment,
1639
- addComponentAttachments: addAttachments,
1640
- updateComponentAttachment: updateAttachment,
1641
- removeComponentAttachment: removeAttachment,
1642
- removeComponentAttachments: removeAttachments,
1643
1649
  updateComponent: (state, action) => {
1644
1650
  if (action.payload.offline_id in state.components) {
1645
1651
  state.components[action.payload.offline_id] = action.payload;
@@ -1664,9 +1670,35 @@ const componentSlice = createSlice({
1664
1670
  }
1665
1671
  }
1666
1672
  prevComponents = null;
1667
- }
1673
+ },
1674
+ // Attachments
1675
+ setComponentAttachment: setAttachment,
1676
+ setComponentAttachments: setAttachments,
1677
+ addComponentAttachment: addAttachment,
1678
+ addComponentAttachments: addAttachments,
1679
+ updateComponentAttachment: updateAttachment,
1680
+ updateComponentAttachments: updateAttachments,
1681
+ removeComponentAttachment: removeAttachment,
1682
+ removeComponentAttachments: removeAttachments
1668
1683
  }
1669
1684
  });
1685
+ const {
1686
+ addComponent,
1687
+ updateComponent,
1688
+ removeComponent,
1689
+ addComponentsInBatches,
1690
+ setComponents,
1691
+ removeAllComponentsOfType,
1692
+ // Attachments
1693
+ setComponentAttachment,
1694
+ setComponentAttachments,
1695
+ addComponentAttachment,
1696
+ addComponentAttachments,
1697
+ updateComponentAttachment,
1698
+ updateComponentAttachments,
1699
+ removeComponentAttachment,
1700
+ removeComponentAttachments
1701
+ } = componentSlice.actions;
1670
1702
  let prevComponents = null;
1671
1703
  const selectComponents = (state) => {
1672
1704
  if (!prevComponents) {
@@ -1761,28 +1793,14 @@ const selectAttachmentsOfComponentByType = restructureCreateSelectorWithArgs(
1761
1793
  }
1762
1794
  )
1763
1795
  );
1764
- const {
1765
- addComponent,
1766
- updateComponent,
1767
- removeComponent,
1768
- addComponentsInBatches,
1769
- setComponents,
1770
- setComponentAttachments,
1771
- addComponentAttachment,
1772
- addComponentAttachments,
1773
- updateComponentAttachment,
1774
- removeComponentAttachment,
1775
- removeComponentAttachments,
1776
- removeAllComponentsOfType
1777
- } = componentSlice.actions;
1778
1796
  const componentReducer = componentSlice.reducer;
1779
- const initialState$r = {
1797
+ const initialState$o = {
1780
1798
  completionsByComponentId: {}
1781
1799
  };
1782
1800
  const componentStageCompletionSlice = createSlice({
1783
1801
  name: "componentStageCompletions",
1784
- initialState: initialState$r,
1785
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$r)),
1802
+ initialState: initialState$o,
1803
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$o)),
1786
1804
  reducers: {
1787
1805
  addStageCompletion: (state, action) => {
1788
1806
  let stageToCompletionDateMapping = state.completionsByComponentId[action.payload.component];
@@ -1833,13 +1851,13 @@ const selectCompletedStageIdsForComponent = (component) => (state) => {
1833
1851
  return Object.keys(state.componentStageCompletionReducer.completionsByComponentId[component.offline_id] ?? {});
1834
1852
  };
1835
1853
  const componentStageCompletionReducer = componentStageCompletionSlice.reducer;
1836
- const initialState$q = {
1854
+ const initialState$n = {
1837
1855
  stages: {}
1838
1856
  };
1839
1857
  const componentStageSlice = createSlice({
1840
1858
  name: "componentStages",
1841
- initialState: initialState$q,
1842
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$q)),
1859
+ initialState: initialState$n,
1860
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$n)),
1843
1861
  reducers: {
1844
1862
  addStages: (state, action) => {
1845
1863
  Object.assign(state.stages, toOfflineIdRecord(action.payload));
@@ -1949,15 +1967,15 @@ const selectStageFormIdsFromStageIds = restructureCreateSelectorWithArgs(
1949
1967
  );
1950
1968
  const { addStages, updateStages, removeStages, linkStageToForm, unlinkStageToForm } = componentStageSlice.actions;
1951
1969
  const componentStageReducer = componentStageSlice.reducer;
1952
- const initialState$p = {
1970
+ const initialState$m = {
1953
1971
  componentTypes: {},
1954
1972
  hiddenComponentTypeIds: {},
1955
1973
  attachments: {}
1956
1974
  };
1957
1975
  const componentTypeSlice = createSlice({
1958
1976
  name: "componentTypes",
1959
- initialState: initialState$p,
1960
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$p)),
1977
+ initialState: initialState$m,
1978
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$m)),
1961
1979
  reducers: {
1962
1980
  addComponentType: (state, action) => {
1963
1981
  state.componentTypes[action.payload.offline_id] = action.payload;
@@ -1965,20 +1983,38 @@ const componentTypeSlice = createSlice({
1965
1983
  setComponentTypes: (state, action) => {
1966
1984
  state.componentTypes = toOfflineIdRecord(action.payload);
1967
1985
  },
1968
- setComponentTypeAttachments: setAttachments,
1969
- addComponentTypeAttachment: addAttachment,
1970
- addComponentTypeAttachments: addAttachments,
1971
- updateComponentTypeAttachment: updateAttachment,
1972
- removeComponentTypeAttachment: removeAttachment,
1973
- removeComponentTypeAttachments: removeAttachments,
1974
1986
  toggleComponentTypeVisibility: (state, action) => {
1975
1987
  state.hiddenComponentTypeIds[action.payload] = !state.hiddenComponentTypeIds[action.payload];
1976
1988
  },
1977
1989
  deleteComponentType: (state, action) => {
1978
1990
  delete state.componentTypes[action.payload];
1979
- }
1991
+ },
1992
+ // Attachments
1993
+ setComponentTypeAttachment: setAttachment,
1994
+ setComponentTypeAttachments: setAttachments,
1995
+ addComponentTypeAttachment: addAttachment,
1996
+ addComponentTypeAttachments: addAttachments,
1997
+ updateComponentTypeAttachment: updateAttachment,
1998
+ updateComponentTypeAttachments: updateAttachments,
1999
+ removeComponentTypeAttachment: removeAttachment,
2000
+ removeComponentTypeAttachments: removeAttachments
1980
2001
  }
1981
2002
  });
2003
+ const {
2004
+ addComponentType,
2005
+ setComponentTypes,
2006
+ toggleComponentTypeVisibility,
2007
+ deleteComponentType,
2008
+ // Attachmet
2009
+ setComponentTypeAttachment,
2010
+ setComponentTypeAttachments,
2011
+ addComponentTypeAttachment,
2012
+ addComponentTypeAttachments,
2013
+ updateComponentTypeAttachment,
2014
+ updateComponentTypeAttachments,
2015
+ removeComponentTypeAttachment,
2016
+ removeComponentTypeAttachments
2017
+ } = componentTypeSlice.actions;
1982
2018
  const selectComponentTypesMapping = (state) => state.componentTypeReducer.componentTypes;
1983
2019
  const selectComponentTypes = createSelector(
1984
2020
  [selectComponentTypesMapping],
@@ -2055,26 +2091,14 @@ const selectAttachmentsOfComponentTypeByType = restructureCreateSelectorWithArgs
2055
2091
  }
2056
2092
  )
2057
2093
  );
2058
- const {
2059
- addComponentType,
2060
- setComponentTypes,
2061
- setComponentTypeAttachments,
2062
- addComponentTypeAttachment,
2063
- addComponentTypeAttachments,
2064
- updateComponentTypeAttachment,
2065
- removeComponentTypeAttachment,
2066
- removeComponentTypeAttachments,
2067
- toggleComponentTypeVisibility,
2068
- deleteComponentType
2069
- } = componentTypeSlice.actions;
2070
2094
  const componentTypeReducer = componentTypeSlice.reducer;
2071
- const initialState$o = {
2095
+ const initialState$l = {
2072
2096
  workspaces: {},
2073
2097
  activeWorkspaceId: null
2074
2098
  };
2075
2099
  const workspaceSlice = createSlice({
2076
2100
  name: "workspace",
2077
- initialState: initialState$o,
2101
+ initialState: initialState$l,
2078
2102
  // The `reducers` field lets us define reducers and generate associated actions
2079
2103
  reducers: {
2080
2104
  setWorkspaces: (state, action) => {
@@ -2131,7 +2155,7 @@ const selectPermittedWorkspaceIds = createSelector(
2131
2155
  );
2132
2156
  const workspaceReducer = workspaceSlice.reducer;
2133
2157
  const maxRecentIssues = 10;
2134
- const initialState$n = {
2158
+ const initialState$k = {
2135
2159
  issues: {},
2136
2160
  attachments: {},
2137
2161
  comments: {},
@@ -2143,9 +2167,9 @@ const initialState$n = {
2143
2167
  };
2144
2168
  const issueSlice = createSlice({
2145
2169
  name: "issues",
2146
- initialState: initialState$n,
2170
+ initialState: initialState$k,
2147
2171
  extraReducers: (builder) => builder.addCase("RESET", (state) => {
2148
- Object.assign(state, initialState$n);
2172
+ Object.assign(state, initialState$k);
2149
2173
  }),
2150
2174
  reducers: {
2151
2175
  setIssues: (state, action) => {
@@ -2156,7 +2180,6 @@ const issueSlice = createSlice({
2156
2180
  state.issues[issue.offline_id] = issue;
2157
2181
  });
2158
2182
  },
2159
- setIssueAttachments: setAttachments,
2160
2183
  setIssueUpdates: (state, action) => {
2161
2184
  if (action.payload.filter(onlyUniqueOfflineIds).length !== action.payload.length) {
2162
2185
  throw new Error("Tried to use setIssues reducer with duplicate ID's");
@@ -2186,8 +2209,6 @@ const issueSlice = createSlice({
2186
2209
  state.issues[issue.offline_id] = issue;
2187
2210
  }
2188
2211
  },
2189
- addIssueAttachment: addAttachment,
2190
- addIssueAttachments: addAttachments,
2191
2212
  addIssueUpdate: (state, action) => {
2192
2213
  if (action.payload.offline_id in state.updates) {
2193
2214
  throw new Error(`Tried to add duplicate issue update with offline_id: ${action.payload.offline_id}`);
@@ -2209,7 +2230,6 @@ const issueSlice = createSlice({
2209
2230
  throw new Error(`Tried to update issue with ID that doesn't exist: ${action.payload.offline_id}`);
2210
2231
  }
2211
2232
  },
2212
- updateIssueAttachment: updateAttachment,
2213
2233
  removeIssue: (state, action) => {
2214
2234
  if (action.payload in state.issues) {
2215
2235
  delete state.issues[action.payload];
@@ -2222,7 +2242,6 @@ const issueSlice = createSlice({
2222
2242
  delete state.issues[issueId];
2223
2243
  }
2224
2244
  },
2225
- removeIssueAttachment: removeAttachment,
2226
2245
  removeIssueUpdate: (state, action) => {
2227
2246
  if (action.payload in state.updates) {
2228
2247
  delete state.updates[action.payload];
@@ -2319,12 +2338,19 @@ const issueSlice = createSlice({
2319
2338
  if (indexToRemove !== -1) {
2320
2339
  state.recentIssueIds.splice(indexToRemove, 1);
2321
2340
  }
2322
- }
2341
+ },
2342
+ // Attachments
2343
+ setIssueAttachment: setAttachment,
2344
+ setIssueAttachments: setAttachments,
2345
+ addIssueAttachment: addAttachment,
2346
+ addIssueAttachments: addAttachments,
2347
+ updateIssueAttachment: updateAttachment,
2348
+ updateIssueAttachments: updateAttachments,
2349
+ removeIssueAttachment: removeAttachment,
2350
+ removeIssueAttachments: removeAttachments
2323
2351
  }
2324
2352
  });
2325
2353
  const {
2326
- addIssueAttachment,
2327
- addIssueAttachments,
2328
2354
  addIssue,
2329
2355
  addIssues,
2330
2356
  addIssueUpdate,
@@ -2332,7 +2358,6 @@ const {
2332
2358
  addOrReplaceIssueComment,
2333
2359
  addToRecentIssues,
2334
2360
  cleanRecentIssues,
2335
- removeIssueAttachment,
2336
2361
  removeAttachmentsOfIssue,
2337
2362
  removeIssue,
2338
2363
  removeIssues,
@@ -2341,13 +2366,20 @@ const {
2341
2366
  removeRecentIssue,
2342
2367
  resetRecentIssues,
2343
2368
  setActiveIssueId,
2344
- setIssueAttachments,
2345
2369
  setIssueUpdates,
2346
2370
  setIssues,
2347
2371
  setVisibleStatuses,
2348
2372
  setVisibleUserIds,
2349
- updateIssueAttachment,
2350
2373
  updateIssue,
2374
+ // Attachments
2375
+ setIssueAttachment,
2376
+ setIssueAttachments,
2377
+ addIssueAttachment,
2378
+ addIssueAttachments,
2379
+ updateIssueAttachment,
2380
+ updateIssueAttachments,
2381
+ removeIssueAttachment,
2382
+ removeIssueAttachments,
2351
2383
  // Commments
2352
2384
  addIssueComment,
2353
2385
  addIssueComments,
@@ -2570,14 +2602,14 @@ const selectRecentIssuesAsSearchResults = createSelector(
2570
2602
  }
2571
2603
  );
2572
2604
  const issueReducer = issueSlice.reducer;
2573
- const initialState$m = {
2605
+ const initialState$j = {
2574
2606
  issueTypes: {}
2575
2607
  };
2576
2608
  const issueTypeSlice = createSlice({
2577
2609
  name: "issueTypes",
2578
- initialState: initialState$m,
2610
+ initialState: initialState$j,
2579
2611
  extraReducers: (builder) => builder.addCase("RESET", (state) => {
2580
- Object.assign(state, initialState$m);
2612
+ Object.assign(state, initialState$j);
2581
2613
  }),
2582
2614
  reducers: {
2583
2615
  setIssueTypes: (state, action) => {
@@ -2644,15 +2676,15 @@ const selectIssuesOfIssueTypeCount = (issueTypeId) => (state) => {
2644
2676
  return ((_a2 = selectIssuesOfIssueType(issueTypeId)(state)) == null ? void 0 : _a2.length) ?? 0;
2645
2677
  };
2646
2678
  const issueTypeReducer = issueTypeSlice.reducer;
2647
- const initialState$l = {
2679
+ const initialState$i = {
2648
2680
  s3Urls: {}
2649
2681
  };
2650
2682
  const msPerHour = 1e3 * 60 * 60;
2651
2683
  const msPerWeek = msPerHour * 24 * 7;
2652
2684
  const fileSlice = createSlice({
2653
2685
  name: "file",
2654
- initialState: initialState$l,
2655
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$l)),
2686
+ initialState: initialState$i,
2687
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$i)),
2656
2688
  reducers: {
2657
2689
  setUploadUrl: (state, action) => {
2658
2690
  const { url, fields, sha1 } = action.payload;
@@ -2679,7 +2711,7 @@ const selectUploadUrl = (sha1) => (state) => {
2679
2711
  return url;
2680
2712
  };
2681
2713
  const fileReducer = fileSlice.reducer;
2682
- const initialState$k = {
2714
+ const initialState$h = {
2683
2715
  // TODO: Change first MapStyle.SATELLITE to MaptStyle.None when project creation map is fixed
2684
2716
  mapStyle: MapStyle.SATELLITE,
2685
2717
  showTooltips: false,
@@ -2687,8 +2719,8 @@ const initialState$k = {
2687
2719
  };
2688
2720
  const mapSlice = createSlice({
2689
2721
  name: "map",
2690
- initialState: initialState$k,
2691
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$k)),
2722
+ initialState: initialState$h,
2723
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$h)),
2692
2724
  reducers: {
2693
2725
  setMapStyle: (state, action) => {
2694
2726
  state.mapStyle = action.payload;
@@ -2716,6 +2748,14 @@ var OrganizationAccessLevel = /* @__PURE__ */ ((OrganizationAccessLevel2) => {
2716
2748
  OrganizationAccessLevel2[OrganizationAccessLevel2["ADMIN"] = 2] = "ADMIN";
2717
2749
  return OrganizationAccessLevel2;
2718
2750
  })(OrganizationAccessLevel || {});
2751
+ var AttachmentModel = /* @__PURE__ */ ((AttachmentModel2) => {
2752
+ AttachmentModel2["Issue"] = "issue";
2753
+ AttachmentModel2["Component"] = "component";
2754
+ AttachmentModel2["ComponentType"] = "component_type";
2755
+ AttachmentModel2["Project"] = "project";
2756
+ AttachmentModel2["Document"] = "document";
2757
+ return AttachmentModel2;
2758
+ })(AttachmentModel || {});
2719
2759
  var IssueUpdateChange = /* @__PURE__ */ ((IssueUpdateChange2) => {
2720
2760
  IssueUpdateChange2["STATUS"] = "status";
2721
2761
  IssueUpdateChange2["PRIORITY"] = "priority";
@@ -2757,7 +2797,7 @@ var LicenseStatus = /* @__PURE__ */ ((LicenseStatus2) => {
2757
2797
  LicenseStatus2[LicenseStatus2["PAST_DUE"] = 8] = "PAST_DUE";
2758
2798
  return LicenseStatus2;
2759
2799
  })(LicenseStatus || {});
2760
- const initialState$j = {
2800
+ const initialState$g = {
2761
2801
  users: {},
2762
2802
  currentUser: {
2763
2803
  id: 0,
@@ -2768,8 +2808,8 @@ const initialState$j = {
2768
2808
  };
2769
2809
  const userSlice = createSlice({
2770
2810
  name: "users",
2771
- initialState: initialState$j,
2772
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$j)),
2811
+ initialState: initialState$g,
2812
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$g)),
2773
2813
  reducers: {
2774
2814
  setUsers: (state, action) => {
2775
2815
  const usersMapping = {};
@@ -2831,13 +2871,13 @@ const selectUser = (userId) => (state) => {
2831
2871
  const selectUsersAsMapping = (state) => state.userReducer.users;
2832
2872
  const selectFavouriteProjects = (state) => state.userReducer.currentUser.profile.favourite_project_ids;
2833
2873
  const userReducer = userSlice.reducer;
2834
- const initialState$i = {
2874
+ const initialState$f = {
2835
2875
  organizationAccesses: {}
2836
2876
  };
2837
2877
  const organizationAccessSlice = createSlice({
2838
2878
  name: "organizationAccess",
2839
- initialState: initialState$i,
2840
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$i)),
2879
+ initialState: initialState$f,
2880
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$f)),
2841
2881
  reducers: {
2842
2882
  setOrganizationAccesses: (state, action) => {
2843
2883
  if (!Array.isArray(action.payload))
@@ -2900,13 +2940,13 @@ const selectOrganizationAccessUserMapping = (state) => {
2900
2940
  return organizationAccesses;
2901
2941
  };
2902
2942
  const organizationAccessReducer = organizationAccessSlice.reducer;
2903
- const initialState$h = {
2943
+ const initialState$e = {
2904
2944
  licenses: {}
2905
2945
  };
2906
2946
  const licenseSlice = createSlice({
2907
2947
  name: "license",
2908
- initialState: initialState$h,
2909
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$h)),
2948
+ initialState: initialState$e,
2949
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$e)),
2910
2950
  reducers: {
2911
2951
  setLicenses: (state, action) => {
2912
2952
  if (!Array.isArray(action.payload))
@@ -2951,13 +2991,13 @@ const selectLicensesForProjectsMapping = createSelector(
2951
2991
  (licenses) => Object.values(licenses).filter((license) => license.project).reduce((accum, license) => ({ ...accum, [license.project]: license }), {})
2952
2992
  );
2953
2993
  const licenseReducer = licenseSlice.reducer;
2954
- const initialState$g = {
2994
+ const initialState$d = {
2955
2995
  projectAccesses: {}
2956
2996
  };
2957
2997
  const projectAccessSlice = createSlice({
2958
2998
  name: "projectAccess",
2959
- initialState: initialState$g,
2960
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$g)),
2999
+ initialState: initialState$d,
3000
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$d)),
2961
3001
  reducers: {
2962
3002
  setProjectAccesses: (state, action) => {
2963
3003
  if (!Array.isArray(action.payload))
@@ -3025,7 +3065,7 @@ const selectProjectAccessUserMapping = (state) => {
3025
3065
  return projectAccesses;
3026
3066
  };
3027
3067
  const projectAccessReducer = projectAccessSlice.reducer;
3028
- const initialState$f = {
3068
+ const initialState$c = {
3029
3069
  projects: {},
3030
3070
  activeProjectId: null,
3031
3071
  recentProjectIds: [],
@@ -3035,7 +3075,7 @@ const initialState$f = {
3035
3075
  };
3036
3076
  const projectSlice = createSlice({
3037
3077
  name: "projects",
3038
- initialState: initialState$f,
3078
+ initialState: initialState$c,
3039
3079
  reducers: {
3040
3080
  setProjects: (state, action) => {
3041
3081
  const projectsMap = {};
@@ -3103,11 +3143,13 @@ const projectSlice = createSlice({
3103
3143
  throw new Error("Update form submissions count: no active project");
3104
3144
  }
3105
3145
  },
3106
- // Attachment related
3146
+ // Attachments
3147
+ setProjectAttachment: setAttachment,
3107
3148
  setProjectAttachments: setAttachments,
3108
3149
  addProjectAttachment: addAttachment,
3109
3150
  addProjectAttachments: addAttachments,
3110
3151
  updateProjectAttachment: updateAttachment,
3152
+ updateProjectAttachments: updateAttachments,
3111
3153
  removeProjectAttachment: removeAttachment,
3112
3154
  removeProjectAttachments: removeAttachments
3113
3155
  }
@@ -3122,11 +3164,13 @@ const {
3122
3164
  acceptProjectInvite,
3123
3165
  addActiveProjectIssuesCount,
3124
3166
  addActiveProjectFormSubmissionsCount,
3125
- // Attachment related
3167
+ // Attachments
3168
+ setProjectAttachment,
3126
3169
  setProjectAttachments,
3127
3170
  addProjectAttachment,
3128
3171
  addProjectAttachments,
3129
3172
  updateProjectAttachment,
3173
+ updateProjectAttachments,
3130
3174
  removeProjectAttachment,
3131
3175
  removeProjectAttachments
3132
3176
  } = projectSlice.actions;
@@ -3197,6 +3241,9 @@ const selectAllProjectAttachments = createSelector(
3197
3241
  [selectProjectAttachmentMapping],
3198
3242
  (mapping) => Object.values(mapping)
3199
3243
  );
3244
+ const selectProjectAttachment = (attachmentId) => (state) => {
3245
+ return state.projectReducer.attachments[attachmentId];
3246
+ };
3200
3247
  const selectAttachmentsOfProject = restructureCreateSelectorWithArgs(
3201
3248
  createSelector(
3202
3249
  [selectAllProjectAttachments, (_state, projectId) => projectId],
@@ -3222,14 +3269,14 @@ const selectAttachmentsOfProjectByType = restructureCreateSelectorWithArgs(
3222
3269
  }
3223
3270
  )
3224
3271
  );
3225
- const initialState$e = {
3272
+ const initialState$b = {
3226
3273
  organizations: {},
3227
3274
  activeOrganizationId: null
3228
3275
  };
3229
3276
  const organizationSlice = createSlice({
3230
3277
  name: "organizations",
3231
- initialState: initialState$e,
3232
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$e)),
3278
+ initialState: initialState$b,
3279
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$b)),
3233
3280
  reducers: {
3234
3281
  setOrganizations: (state, action) => {
3235
3282
  for (const org of action.payload) {
@@ -3348,14 +3395,14 @@ const createOfflineAction = (request2, baseUrl) => {
3348
3395
  }
3349
3396
  };
3350
3397
  };
3351
- const initialState$d = {
3398
+ const initialState$a = {
3352
3399
  deletedRequests: [],
3353
3400
  latestRetryTime: 0
3354
3401
  };
3355
3402
  const outboxSlice = createSlice({
3356
3403
  name: "outbox",
3357
- initialState: initialState$d,
3358
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$d)),
3404
+ initialState: initialState$a,
3405
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$a)),
3359
3406
  reducers: {
3360
3407
  // enqueueActions is a reducer that does nothing but enqueue API request to the Redux Offline outbox
3361
3408
  // Whenever an issue is being created, a reducer addIssue() is responsible for adding it to the offline store
@@ -3387,7 +3434,7 @@ const selectDeletedRequests = (state) => state.outboxReducer.deletedRequests;
3387
3434
  const selectLatestRetryTime = (state) => state.outboxReducer.latestRetryTime;
3388
3435
  const { enqueueRequest, markForDeletion, markAsDeleted, _setLatestRetryTime } = outboxSlice.actions;
3389
3436
  const outboxReducer = outboxSlice.reducer;
3390
- const initialState$c = {
3437
+ const initialState$9 = {
3391
3438
  projectFiles: {},
3392
3439
  activeProjectFileId: null,
3393
3440
  isImportingProjectFile: false,
@@ -3395,8 +3442,8 @@ const initialState$c = {
3395
3442
  };
3396
3443
  const projectFileSlice = createSlice({
3397
3444
  name: "projectFiles",
3398
- initialState: initialState$c,
3399
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$c)),
3445
+ initialState: initialState$9,
3446
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$9)),
3400
3447
  reducers: {
3401
3448
  addOrReplaceProjectFiles: (state, action) => {
3402
3449
  for (let fileObj of action.payload) {
@@ -3497,12 +3544,12 @@ const selectProjectFiles = createSelector(
3497
3544
  const selectActiveProjectFileId = (state) => state.projectFileReducer.activeProjectFileId;
3498
3545
  const selectIsImportingProjectFile = (state) => state.projectFileReducer.isImportingProjectFile;
3499
3546
  const projectFileReducer = projectFileSlice.reducer;
3500
- const initialState$b = {
3547
+ const initialState$8 = {
3501
3548
  isRehydrated: false
3502
3549
  };
3503
3550
  const rehydratedSlice = createSlice({
3504
3551
  name: "rehydrated",
3505
- initialState: initialState$b,
3552
+ initialState: initialState$8,
3506
3553
  // The `reducers` field lets us define reducers and generate associated actions
3507
3554
  reducers: {
3508
3555
  setRehydrated: (state, action) => {
@@ -3512,7 +3559,7 @@ const rehydratedSlice = createSlice({
3512
3559
  });
3513
3560
  const selectRehydrated = (state) => state.rehydratedReducer.isRehydrated;
3514
3561
  const rehydratedReducer = rehydratedSlice.reducer;
3515
- const initialState$a = {
3562
+ const initialState$7 = {
3516
3563
  useIssueTemplate: false,
3517
3564
  placementMode: false,
3518
3565
  enableClustering: false,
@@ -3529,8 +3576,8 @@ const initialState$a = {
3529
3576
  };
3530
3577
  const settingSlice = createSlice({
3531
3578
  name: "settings",
3532
- initialState: initialState$a,
3533
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$a)),
3579
+ initialState: initialState$7,
3580
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$7)),
3534
3581
  reducers: {
3535
3582
  setEnableDuplicateIssues: (state, action) => {
3536
3583
  state.useIssueTemplate = action.payload;
@@ -3589,14 +3636,14 @@ const formRevisionSortFn = (formRevisionA, formRevisionB) => {
3589
3636
  return revisionA < revisionB ? -1 : 1;
3590
3637
  }
3591
3638
  };
3592
- const initialState$9 = {
3639
+ const initialState$6 = {
3593
3640
  formRevisions: {},
3594
3641
  attachments: {}
3595
3642
  };
3596
3643
  const formRevisionsSlice = createSlice({
3597
3644
  name: "formRevisions",
3598
- initialState: initialState$9,
3599
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$9)),
3645
+ initialState: initialState$6,
3646
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$6)),
3600
3647
  reducers: {
3601
3648
  // revision related actions
3602
3649
  setFormRevision: (state, action) => {
@@ -3776,13 +3823,13 @@ const selectAttachmentsOfFormRevision = restructureCreateSelectorWithArgs(
3776
3823
  )
3777
3824
  );
3778
3825
  const formRevisionReducer = formRevisionsSlice.reducer;
3779
- const initialState$8 = {
3826
+ const initialState$5 = {
3780
3827
  forms: {}
3781
3828
  };
3782
3829
  const formSlice = createSlice({
3783
3830
  name: "forms",
3784
- initialState: initialState$8,
3785
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$8)),
3831
+ initialState: initialState$5,
3832
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$5)),
3786
3833
  reducers: {
3787
3834
  setForms: (state, action) => {
3788
3835
  state.forms = {};
@@ -3887,14 +3934,14 @@ const selectGeneralFormCount = createSelector([selectFormMapping], (userForms) =
3887
3934
  return Object.values(userForms).filter((form) => !form.component_type).length;
3888
3935
  });
3889
3936
  const formReducer = formSlice.reducer;
3890
- const initialState$7 = {
3937
+ const initialState$4 = {
3891
3938
  formSubmissions: {},
3892
3939
  attachments: {}
3893
3940
  };
3894
3941
  const formSubmissionSlice = createSlice({
3895
3942
  name: "formSubmissions",
3896
- initialState: initialState$7,
3897
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$7)),
3943
+ initialState: initialState$4,
3944
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$4)),
3898
3945
  reducers: {
3899
3946
  setFormSubmission: (state, action) => {
3900
3947
  state.formSubmissions[action.payload.offline_id] = action.payload;
@@ -4131,12 +4178,12 @@ const selectAttachmentsOfFormSubmission = restructureCreateSelectorWithArgs(
4131
4178
  )
4132
4179
  );
4133
4180
  const formSubmissionReducer = formSubmissionSlice.reducer;
4134
- const initialState$6 = {
4181
+ const initialState$3 = {
4135
4182
  emailDomains: {}
4136
4183
  };
4137
4184
  const emailDomainsSlice = createSlice({
4138
4185
  name: "emailDomains",
4139
- initialState: initialState$6,
4186
+ initialState: initialState$3,
4140
4187
  reducers: {
4141
4188
  setEmailDomains: (state, action) => {
4142
4189
  const emailDomains = {};
@@ -4163,15 +4210,15 @@ const selectSortedEmailDomains = (state) => Object.values(state.emailDomainsRedu
4163
4210
  (ed1, ed2) => ed1.domain.localeCompare(ed2.domain)
4164
4211
  );
4165
4212
  const emailDomainsReducer = emailDomainsSlice.reducer;
4166
- const initialState$5 = {
4213
+ const initialState$2 = {
4167
4214
  documents: {},
4168
4215
  attachments: {}
4169
4216
  };
4170
4217
  const documentSlice = createSlice({
4171
4218
  name: "documents",
4172
- initialState: initialState$5,
4219
+ initialState: initialState$2,
4173
4220
  extraReducers: (builder) => builder.addCase("RESET", (state) => {
4174
- Object.assign(state, initialState$5);
4221
+ Object.assign(state, initialState$2);
4175
4222
  }),
4176
4223
  reducers: {
4177
4224
  setDocuments: (state, action) => {
@@ -4312,10 +4359,13 @@ const documentSlice = createSlice({
4312
4359
  delete state.documents[documentId];
4313
4360
  }
4314
4361
  },
4362
+ // Attachments
4363
+ setDocumentAttachment: setAttachment,
4315
4364
  setDocumentAttachments: setAttachments,
4316
4365
  addDocumentAttachment: addAttachment,
4317
4366
  addDocumentAttachments: addAttachments,
4318
4367
  updateDocumentAttachment: updateAttachment,
4368
+ updateDocumentAttachments: updateAttachments,
4319
4369
  removeDocumentAttachment: removeAttachment,
4320
4370
  removeDocumentAttachments: removeAttachments
4321
4371
  }
@@ -4326,10 +4376,13 @@ const {
4326
4376
  updateDocuments,
4327
4377
  moveDocument,
4328
4378
  removeDocuments,
4379
+ // Attachments
4380
+ setDocumentAttachment,
4329
4381
  setDocumentAttachments,
4330
4382
  addDocumentAttachment,
4331
4383
  addDocumentAttachments,
4332
4384
  updateDocumentAttachment,
4385
+ updateDocumentAttachments,
4333
4386
  removeDocumentAttachment,
4334
4387
  removeDocumentAttachments
4335
4388
  } = documentSlice.actions;
@@ -4396,13 +4449,13 @@ const selectAttachmentsOfDocumentByType = restructureCreateSelectorWithArgs(
4396
4449
  )
4397
4450
  );
4398
4451
  const documentsReducer = documentSlice.reducer;
4399
- const initialState$4 = {
4452
+ const initialState$1 = {
4400
4453
  teams: {}
4401
4454
  };
4402
4455
  const teamSlice = createSlice({
4403
4456
  name: "teams",
4404
- initialState: initialState$4,
4405
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$4)),
4457
+ initialState: initialState$1,
4458
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$1)),
4406
4459
  reducers: {
4407
4460
  setTeam: (state, action) => {
4408
4461
  state.teams[action.payload.offline_id] = action.payload;
@@ -4452,262 +4505,8 @@ const selectTeamsOfUser = restructureCreateSelectorWithArgs(
4452
4505
  })
4453
4506
  );
4454
4507
  const teamReducer = teamSlice.reducer;
4455
- const initialState$3 = {
4456
- documentTeamLinks: {}
4457
- };
4458
- const documentTeamLinkSlice = createSlice({
4459
- name: "documentTeamLink",
4460
- initialState: initialState$3,
4461
- extraReducers: (builder) => builder.addCase("RESET", (state) => {
4462
- Object.assign(state, initialState$3);
4463
- }),
4464
- reducers: {
4465
- setDocumentTeamLink: (state, action) => {
4466
- state.documentTeamLinks[action.payload.offline_id] = action.payload;
4467
- },
4468
- setDocumentTeamLinks: (state, action) => {
4469
- for (const documentTeamLink of action.payload) {
4470
- state.documentTeamLinks[documentTeamLink.offline_id] = documentTeamLink;
4471
- }
4472
- },
4473
- addDocumentTeamLink: (state, action) => {
4474
- if (action.payload.offline_id in state.documentTeamLinks) {
4475
- throw new Error(`DocumentTeamLink with offline_id ${action.payload.offline_id} already exists`);
4476
- }
4477
- state.documentTeamLinks[action.payload.offline_id] = action.payload;
4478
- },
4479
- deleteDocumentTeamLink: (state, action) => {
4480
- if (!(action.payload in state.documentTeamLinks)) {
4481
- throw new Error(`DocumentTeamLink with offline_id ${action.payload} does not exist`);
4482
- }
4483
- delete state.documentTeamLinks[action.payload];
4484
- },
4485
- deleteDocumentTeamLinks: (state, action) => {
4486
- for (const offlineId of action.payload) {
4487
- if (!(offlineId in state.documentTeamLinks)) {
4488
- throw new Error(`DocumentTeamLink with offline_id ${offlineId} does not exist`);
4489
- }
4490
- }
4491
- for (const offlineId of action.payload) {
4492
- delete state.documentTeamLinks[offlineId];
4493
- }
4494
- }
4495
- }
4496
- });
4497
- const {
4498
- setDocumentTeamLink,
4499
- setDocumentTeamLinks,
4500
- addDocumentTeamLink,
4501
- deleteDocumentTeamLink,
4502
- deleteDocumentTeamLinks
4503
- } = documentTeamLinkSlice.actions;
4504
- const selectDocumentTeamLinksMapping = (state) => state.documentTeamLinkReducer.documentTeamLinks;
4505
- const selectDocumentTeamLinks = (state) => Object.values(state.documentTeamLinkReducer.documentTeamLinks);
4506
- const selectDocumentTeamLinksOfDocument = restructureCreateSelectorWithArgs(
4507
- createSelector(
4508
- [selectDocumentTeamLinks, (_, documentId) => documentId],
4509
- (documentTeamLinks, documentId) => {
4510
- return documentTeamLinks.filter((documentTeamLink) => documentTeamLink.document === documentId);
4511
- }
4512
- )
4513
- );
4514
- const selectDocumentTeamLinksOfTeam = restructureCreateSelectorWithArgs(
4515
- createSelector([selectDocumentTeamLinks, (_, teamId) => teamId], (documentTeamLinks, teamId) => {
4516
- return documentTeamLinks.filter((documentTeamLink) => documentTeamLink.team === teamId);
4517
- })
4518
- );
4519
- const selectDocumentsLinkedToTeam = restructureCreateSelectorWithArgs(
4520
- createSelector(
4521
- [
4522
- selectDocumentTeamLinks,
4523
- (state) => state.documentsReducer.documents,
4524
- (_, teamId) => teamId
4525
- ],
4526
- (documentTeamLinks, documents, teamId) => {
4527
- return documentTeamLinks.filter((documentTeamLink) => documentTeamLink.team === teamId).map((documentTeamLink) => documents[documentTeamLink.document]).filter((document2) => !!document2);
4528
- }
4529
- )
4530
- );
4531
- const selectTeamsLinkedToDocument = restructureCreateSelectorWithArgs(
4532
- createSelector(
4533
- [selectDocumentTeamLinks, (state) => state.teamReducer.teams, (_, documentId) => documentId],
4534
- (documentTeamLinks, teams, documentId) => {
4535
- return documentTeamLinks.filter((documentTeamLink) => documentTeamLink.document === documentId).map((documentTeamLink) => teams[documentTeamLink.team]).filter((team) => !!team);
4536
- }
4537
- )
4538
- );
4539
- const documentTeamLinkReducer = documentTeamLinkSlice.reducer;
4540
- const initialState$2 = {
4541
- issueTypeTeamLinks: {}
4542
- };
4543
- const issueTypeTeamLinkSlice = createSlice({
4544
- name: "issueTypeTeamLink",
4545
- initialState: initialState$2,
4546
- extraReducers: (builder) => builder.addCase("RESET", (state) => {
4547
- Object.assign(state, initialState$2);
4548
- }),
4549
- reducers: {
4550
- setIssueTypeTeamLink: (state, action) => {
4551
- state.issueTypeTeamLinks[action.payload.offline_id] = action.payload;
4552
- },
4553
- setIssueTypeTeamLinks: (state, action) => {
4554
- state.issueTypeTeamLinks = {};
4555
- for (const issueTypeTeamLink of action.payload) {
4556
- state.issueTypeTeamLinks[issueTypeTeamLink.offline_id] = issueTypeTeamLink;
4557
- }
4558
- },
4559
- addIssueTypeTeamLink: (state, action) => {
4560
- if (action.payload.offline_id in state.issueTypeTeamLinks) {
4561
- throw new Error(`IssueTypeTeamLink with offline_id ${action.payload.offline_id} already exists`);
4562
- }
4563
- state.issueTypeTeamLinks[action.payload.offline_id] = action.payload;
4564
- },
4565
- deleteIssueTypeTeamLink: (state, action) => {
4566
- if (!(action.payload in state.issueTypeTeamLinks)) {
4567
- throw new Error(`IssueTypeTeamLink with offline_id ${action.payload} does not exist`);
4568
- }
4569
- delete state.issueTypeTeamLinks[action.payload];
4570
- },
4571
- deleteIssueTypeTeamLinks: (state, action) => {
4572
- for (const offlineId of action.payload) {
4573
- if (!(offlineId in state.issueTypeTeamLinks)) {
4574
- throw new Error(`IssueTypeTeamLink with offline_id ${offlineId} does not exist`);
4575
- }
4576
- }
4577
- for (const offlineId of action.payload) {
4578
- delete state.issueTypeTeamLinks[offlineId];
4579
- }
4580
- }
4581
- }
4582
- });
4583
- const {
4584
- setIssueTypeTeamLink,
4585
- setIssueTypeTeamLinks,
4586
- addIssueTypeTeamLink,
4587
- deleteIssueTypeTeamLink,
4588
- deleteIssueTypeTeamLinks
4589
- } = issueTypeTeamLinkSlice.actions;
4590
- const selectIssueTypeTeamLinkMapping = (state) => state.issueTypeTeamLinkReducer.issueTypeTeamLinks;
4591
- const selectIssueTypeTeamLinks = (state) => Object.values(state.issueTypeTeamLinkReducer.issueTypeTeamLinks);
4592
- const selectIssueTypeTeamLinksOfIssueType = restructureCreateSelectorWithArgs(
4593
- createSelector(
4594
- [selectIssueTypeTeamLinks, (_, issueTypeId) => issueTypeId],
4595
- (issueTypeTeamLinks, issueTypeId) => {
4596
- return issueTypeTeamLinks.filter((issueTypeTeamLink) => issueTypeTeamLink.issue_type === issueTypeId);
4597
- }
4598
- )
4599
- );
4600
- const selectIssueTypeTeamLinksOfTeam = restructureCreateSelectorWithArgs(
4601
- createSelector([selectIssueTypeTeamLinks, (_, teamId) => teamId], (issueTypeTeamLinks, teamId) => {
4602
- return issueTypeTeamLinks.filter((issueTypeTeamLink) => issueTypeTeamLink.team === teamId);
4603
- })
4604
- );
4605
- const selectIssueTypesLinkedToTeam = restructureCreateSelectorWithArgs(
4606
- createSelector(
4607
- [
4608
- selectIssueTypeTeamLinks,
4609
- (state) => state.issueTypeReducer.issueTypes,
4610
- (_, teamId) => teamId
4611
- ],
4612
- (issueTypeTeamLinks, issueTypes, teamId) => {
4613
- return issueTypeTeamLinks.filter((issueTypeTeamLink) => issueTypeTeamLink.team === teamId).map((issueTypeTeamLink) => issueTypes[issueTypeTeamLink.issue_type]).filter((issueType) => !!issueType);
4614
- }
4615
- )
4616
- );
4617
- const selectTeamsLinkedToIssueType = restructureCreateSelectorWithArgs(
4618
- createSelector(
4619
- [
4620
- selectIssueTypeTeamLinks,
4621
- (state) => state.teamReducer.teams,
4622
- (_, issueTypeId) => issueTypeId
4623
- ],
4624
- (issueTypeTeamLinks, teams, issueTypeId) => {
4625
- return issueTypeTeamLinks.filter((issueTypeTeamLink) => issueTypeTeamLink.issue_type === issueTypeId).map((issueTypeTeamLink) => teams[issueTypeTeamLink.team]).filter((team) => !!team);
4626
- }
4627
- )
4628
- );
4629
- const issueTypeTeamLinkReducer = issueTypeTeamLinkSlice.reducer;
4630
- const initialState$1 = {
4631
- userFormTeamLinks: {}
4632
- };
4633
- const userFormTeamLinkSlice = createSlice({
4634
- name: "userFormTeamLink",
4635
- initialState: initialState$1,
4636
- extraReducers: (builder) => builder.addCase("RESET", (state) => {
4637
- Object.assign(state, initialState$1);
4638
- }),
4639
- reducers: {
4640
- setUserFormTeamLink: (state, action) => {
4641
- state.userFormTeamLinks[action.payload.offline_id] = action.payload;
4642
- },
4643
- setUserFormTeamLinks: (state, action) => {
4644
- state.userFormTeamLinks = {};
4645
- for (const userFormTeamLink of action.payload) {
4646
- state.userFormTeamLinks[userFormTeamLink.offline_id] = userFormTeamLink;
4647
- }
4648
- },
4649
- addUserFormTeamLink: (state, action) => {
4650
- if (action.payload.offline_id in state.userFormTeamLinks) {
4651
- throw new Error(`UserFormTeamLink with offline_id ${action.payload.offline_id} already exists`);
4652
- }
4653
- state.userFormTeamLinks[action.payload.offline_id] = action.payload;
4654
- },
4655
- deleteUserFormTeamLink: (state, action) => {
4656
- if (!(action.payload in state.userFormTeamLinks)) {
4657
- throw new Error(`UserFormTeamLink with offline_id ${action.payload} does not exist`);
4658
- }
4659
- delete state.userFormTeamLinks[action.payload];
4660
- },
4661
- deleteUserFormTeamLinks: (state, action) => {
4662
- for (const offlineId of action.payload) {
4663
- if (!(offlineId in state.userFormTeamLinks)) {
4664
- throw new Error(`UserFormTeamLink with offline_id ${offlineId} does not exist`);
4665
- }
4666
- }
4667
- for (const offlineId of action.payload) {
4668
- delete state.userFormTeamLinks[offlineId];
4669
- }
4670
- }
4671
- }
4672
- });
4673
- const {
4674
- setUserFormTeamLink,
4675
- setUserFormTeamLinks,
4676
- addUserFormTeamLink,
4677
- deleteUserFormTeamLink,
4678
- deleteUserFormTeamLinks
4679
- } = userFormTeamLinkSlice.actions;
4680
- const selectUserFormTeamLinkMapping = (state) => state.userFormTeamLinkReducer.userFormTeamLinks;
4681
- const selectUserFormTeamLinks = (state) => Object.values(state.userFormTeamLinkReducer.userFormTeamLinks);
4682
- const selectUserFormLinksOfTeam = restructureCreateSelectorWithArgs(
4683
- createSelector([selectUserFormTeamLinks, (_, teamId) => teamId], (userFormTeamLinks, teamId) => {
4684
- return userFormTeamLinks.filter((userFormTeamLink) => userFormTeamLink.team === teamId);
4685
- })
4686
- );
4687
- const selectUserFormLinksOfForm = restructureCreateSelectorWithArgs(
4688
- createSelector([selectUserFormTeamLinks, (_, formId2) => formId2], (userFormTeamLinks, formId2) => {
4689
- return userFormTeamLinks.filter((userFormTeamLink) => userFormTeamLink.form === formId2);
4690
- })
4691
- );
4692
- const selectUserFormsLinkedToTeam = restructureCreateSelectorWithArgs(
4693
- createSelector(
4694
- [selectUserFormTeamLinks, (state) => state.formReducer.forms, (_, teamId) => teamId],
4695
- (userFormTeamLinks, userForms, teamId) => {
4696
- return userFormTeamLinks.filter((userFormTeamLink) => userFormTeamLink.team === teamId).map((userFormTeamLink) => userForms[userFormTeamLink.form]).filter((form) => !!form);
4697
- }
4698
- )
4699
- );
4700
- const selectTeamsLinkedToUserForm = restructureCreateSelectorWithArgs(
4701
- createSelector(
4702
- [selectUserFormTeamLinks, (state) => state.teamReducer.teams, (_, formId2) => formId2],
4703
- (userFormTeamLinks, teams, formId2) => {
4704
- return userFormTeamLinks.filter((userFormTeamLink) => userFormTeamLink.form === formId2).map((userFormTeamLink) => teams[userFormTeamLink.team]).filter((team) => !!team);
4705
- }
4706
- )
4707
- );
4708
- const userFormTeamLinkReducer = userFormTeamLinkSlice.reducer;
4709
- const initialState = {
4710
- version: 0
4508
+ const initialState = {
4509
+ version: 0
4711
4510
  };
4712
4511
  const versioningSlice = createSlice({
4713
4512
  name: "versioning",
@@ -4756,10 +4555,7 @@ const overmapReducers = {
4756
4555
  emailDomainsReducer,
4757
4556
  licenseReducer,
4758
4557
  documentsReducer,
4759
- teamReducer,
4760
- documentTeamLinkReducer,
4761
- issueTypeTeamLinkReducer,
4762
- userFormTeamLinkReducer
4558
+ teamReducer
4763
4559
  };
4764
4560
  const overmapReducer = combineReducers(overmapReducers);
4765
4561
  const resetStore = "RESET";
@@ -5276,642 +5072,95 @@ class BaseApiService {
5276
5072
  return promise;
5277
5073
  }
5278
5074
  }
5279
- class AttachmentService extends BaseApiService {
5280
- fetchAll(projectId) {
5281
- const promise = this.enqueueRequest({
5282
- description: "Fetch attachments",
5283
- method: HttpMethod.GET,
5284
- url: `/attachments/${projectId}/`,
5285
- blocks: [],
5286
- blockers: []
5287
- });
5288
- const state = this.client.store.getState();
5289
- const allAttachments = {
5290
- issue_attachments: Object.values(state.issueReducer.attachments),
5291
- component_attachments: Object.values(state.componentReducer.attachments),
5292
- component_type_attachments: Object.values(state.componentTypeReducer.attachments),
5293
- project_attachments: Object.values(state.projectReducer.attachments),
5294
- document_attachments: Object.values(state.documentsReducer.attachments)
5295
- };
5296
- return [allAttachments, promise];
5297
- }
5298
- // Attachments aren't models, so we use the OptimisticGenericResult type instead
5299
- async addIssueAttachment(attachmentPayload) {
5300
- const { issue, file_sha1, offline_id } = attachmentPayload;
5301
- if (!attachmentPayload.file.objectURL) {
5302
- throw new Error("Expected attachmentPayload.file.objectURL to be defined.");
5303
- }
5304
- const offlineAttachment = {
5305
- ...attachmentPayload,
5306
- file: attachmentPayload.file.objectURL,
5307
- file_name: attachmentPayload.file.name,
5308
- file_type: attachmentPayload.file.type,
5309
- submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
5310
- created_by: this.client.store.getState().userReducer.currentUser.id
5311
- };
5312
- await this.client.files.addCache(attachmentPayload.file, file_sha1);
5313
- this.client.store.dispatch(addIssueAttachment(offlineAttachment));
5314
- const [fileProps] = await this.client.files.uploadFileToS3(file_sha1);
5315
- const promise = this.enqueueRequest({
5316
- description: "Create attachment",
5317
- method: HttpMethod.POST,
5318
- url: `/issues/${issue}/attach/`,
5319
- blocks: [offline_id, issue],
5320
- blockers: [file_sha1],
5321
- payload: {
5322
- ...offlineAttachment,
5323
- ...fileProps
5324
- }
5325
- });
5326
- promise.catch((error2) => {
5327
- this.client.store.dispatch(removeIssueAttachment(offlineAttachment.offline_id));
5328
- throw error2;
5329
- });
5330
- return [offlineAttachment, promise];
5331
- }
5332
- async addComponentAttachment(attachmentPayload) {
5333
- const { component, file_sha1, offline_id } = attachmentPayload;
5334
- if (!attachmentPayload.file.objectURL) {
5335
- throw new Error("Expected attachmentPayload.file.objectURL to be defined.");
5336
- }
5337
- const offlineAttachment = {
5338
- ...attachmentPayload,
5339
- file: attachmentPayload.file.objectURL,
5340
- file_name: attachmentPayload.file.name,
5341
- file_type: attachmentPayload.file.type,
5342
- submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
5343
- created_by: this.client.store.getState().userReducer.currentUser.id
5344
- };
5345
- await this.client.files.addCache(attachmentPayload.file, file_sha1);
5346
- this.client.store.dispatch(addComponentAttachment(offlineAttachment));
5347
- const [fileProps] = await this.client.files.uploadFileToS3(file_sha1);
5348
- const promise = this.enqueueRequest({
5349
- description: "Create attachment",
5350
- method: HttpMethod.POST,
5351
- url: `/components/${component}/attach/`,
5352
- blocks: [offline_id, component],
5353
- blockers: [file_sha1],
5354
- payload: {
5355
- ...offlineAttachment,
5356
- ...fileProps
5357
- }
5358
- });
5359
- promise.catch((error2) => {
5360
- this.client.store.dispatch(removeComponentAttachment(offlineAttachment.offline_id));
5361
- throw error2;
5362
- });
5363
- return [offlineAttachment, promise];
5364
- }
5365
- async addComponentTypeAttachment(attachmentPayload) {
5366
- const { component_type, file_sha1, offline_id } = attachmentPayload;
5367
- if (!attachmentPayload.file.objectURL) {
5368
- throw new Error("Expected attachmentPayload.file.objectURL to be defined.");
5369
- }
5370
- const offlineAttachment = {
5371
- ...attachmentPayload,
5372
- file: attachmentPayload.file.objectURL,
5373
- file_name: attachmentPayload.file.name,
5374
- file_type: attachmentPayload.file.type,
5375
- submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
5376
- created_by: this.client.store.getState().userReducer.currentUser.id
5377
- };
5378
- await this.client.files.addCache(attachmentPayload.file, file_sha1);
5379
- this.client.store.dispatch(addComponentTypeAttachment(offlineAttachment));
5380
- const [fileProps] = await this.client.files.uploadFileToS3(file_sha1);
5381
- const promise = this.enqueueRequest({
5382
- description: "Create attachment",
5383
- method: HttpMethod.POST,
5384
- url: `/components/types/${component_type}/attach/`,
5385
- blocks: [offline_id, component_type],
5386
- blockers: [file_sha1],
5387
- payload: {
5388
- ...offlineAttachment,
5389
- ...fileProps
5390
- }
5391
- });
5392
- promise.catch((error2) => {
5393
- this.client.store.dispatch(removeComponentTypeAttachment(offlineAttachment.offline_id));
5394
- throw error2;
5395
- });
5396
- return [offlineAttachment, promise];
5397
- }
5398
- async addDocumentAttachment(attachmentPayload) {
5399
- const { description: description2, document: document2, file_sha1, offline_id } = attachmentPayload;
5400
- if (!attachmentPayload.file.objectURL) {
5401
- throw new Error("Expected attachmentPayload.file.objectURL to be defined.");
5402
- }
5403
- const offlineAttachment = {
5404
- ...attachmentPayload,
5405
- file: attachmentPayload.file.objectURL,
5406
- file_name: attachmentPayload.file.name,
5407
- file_type: attachmentPayload.file.type,
5408
- submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
5409
- created_by: this.client.store.getState().userReducer.currentUser.id
5410
- };
5411
- await this.client.files.addCache(attachmentPayload.file, file_sha1);
5412
- this.client.store.dispatch(addDocumentAttachment(offlineAttachment));
5413
- const [fileProps] = await this.client.files.uploadFileToS3(file_sha1);
5414
- const promise = this.enqueueRequest({
5415
- description: "Create attachment",
5416
- method: HttpMethod.POST,
5417
- url: `/documents/${document2}/attach/`,
5418
- blocks: [offline_id, document2],
5419
- blockers: [file_sha1],
5420
- payload: {
5421
- offline_id,
5422
- document: document2,
5423
- description: description2 ?? "",
5424
- submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
5425
- ...fileProps
5426
- }
5427
- });
5428
- promise.catch((error2) => {
5429
- this.client.store.dispatch(removeDocumentAttachment(offlineAttachment.offline_id));
5430
- throw error2;
5431
- });
5432
- return [offlineAttachment, promise];
5433
- }
5434
- /** the outer Promise is needed to await the hashing of each file, which is required before offline use. If wanting to
5435
- * attach promise handlers to the request to add the attachment in the backend, apply it on the promise returned from the
5436
- * OptimisticModelResult. */
5437
- attachFilesToIssue(filesToSubmit, issueId) {
5438
- return filesToSubmit.map((file) => {
5439
- if (!(file instanceof File)) {
5440
- throw new Error("Expected a File instance.");
5441
- }
5442
- const photoAttachmentPromise = async (file2) => {
5443
- const hash = await hashFile(file2);
5444
- const attachment = offline({
5445
- file: file2,
5446
- file_name: file2.name,
5447
- file_type: file2.type,
5448
- issue: issueId,
5449
- file_sha1: hash,
5450
- submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
5451
- created_by: this.client.store.getState().userReducer.currentUser.id
5452
- });
5453
- return this.addIssueAttachment(attachment);
5454
- };
5455
- return photoAttachmentPromise(file);
5456
- });
5457
- }
5458
- attachFilesToComponent(filesToSubmit, componentId) {
5459
- return filesToSubmit.map((file) => {
5460
- if (!(file instanceof File)) {
5461
- throw new Error("Expected a File instance.");
5462
- }
5463
- const photoAttachmentPromise = async (file2) => {
5464
- const hash = await hashFile(file2);
5465
- const attachment = offline({
5466
- file: file2,
5467
- file_name: file2.name,
5468
- file_type: file2.type,
5469
- component: componentId,
5470
- file_sha1: hash,
5471
- submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
5472
- created_by: this.client.store.getState().userReducer.currentUser.id
5473
- });
5474
- return this.addComponentAttachment(attachment);
5475
- };
5476
- return photoAttachmentPromise(file);
5477
- });
5478
- }
5479
- attachFilesToComponentType(filesToSubmit, componentTypeId) {
5480
- return filesToSubmit.map((file) => {
5481
- if (!(file instanceof File)) {
5482
- throw new Error("Expected a File instance.");
5483
- }
5484
- const photoAttachmentPromise = async (file2) => {
5485
- const hash = await hashFile(file2);
5486
- const attachment = offline({
5487
- file: file2,
5488
- file_name: file2.name,
5489
- file_type: file2.type,
5490
- component_type: componentTypeId,
5491
- file_sha1: hash,
5492
- submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
5493
- created_by: this.client.store.getState().userReducer.currentUser.id
5494
- });
5495
- return this.addComponentTypeAttachment(attachment);
5496
- };
5497
- return photoAttachmentPromise(file);
5498
- });
5499
- }
5500
- attachFilesToDocument(filesToSubmit, documentId) {
5501
- return filesToSubmit.map((file) => {
5502
- if (!(file instanceof File)) {
5503
- throw new Error("Expected a File instance.");
5504
- }
5505
- const photoAttachmentPromise = async (file2) => {
5506
- const hash = await hashFile(file2);
5507
- const attachment = offline({
5508
- file: file2,
5509
- file_name: file2.name,
5510
- file_type: file2.type,
5511
- document: documentId,
5512
- file_sha1: hash,
5513
- submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
5514
- created_by: this.client.store.getState().userReducer.currentUser.id
5515
- });
5516
- return this.addDocumentAttachment(attachment);
5517
- };
5518
- return photoAttachmentPromise(file);
5519
- });
5520
- }
5521
- async replaceIssueAttachmentFile(attachmentId, newFile) {
5522
- const { store } = this.client;
5523
- const attachment = store.getState().issueReducer.attachments[attachmentId];
5524
- if (!attachment)
5525
- throw new Error(`Attachment ${attachmentId} not found`);
5526
- let oldFile = void 0;
5527
- const newSha1 = await hashFile(newFile);
5528
- const performRequest2 = async () => {
5529
- oldFile = await this.client.files.fetchCache(attachment.file_sha1);
5530
- if (!oldFile) {
5531
- console.error(`Failed to fetch old file from cache for sha1 ${attachment.file_sha1}.`);
5532
- }
5533
- if (!newFile.objectURL) {
5534
- throw new Error(`newFile["objectURL"] is unexpectedly ${newFile.objectURL}`);
5535
- }
5536
- store.dispatch(
5537
- updateIssueAttachment({ ...attachment, file_sha1: newSha1, file: URL.createObjectURL(newFile) })
5538
- );
5539
- await this.client.files.addCache(newFile, newSha1);
5540
- const [fileProps] = await this.client.files.uploadFileToS3(newSha1).catch((e) => {
5541
- store.dispatch(updateIssueAttachment(attachment));
5075
+ const EXPIRING_SOON_THRESHOLD = 1800;
5076
+ function parseTokens(response) {
5077
+ if (!response.access)
5078
+ throw new Error("Missing access token");
5079
+ if (!response.refresh)
5080
+ throw new Error("Missing refresh token");
5081
+ return { accessToken: response.access, refreshToken: response.refresh };
5082
+ }
5083
+ class AuthService extends BaseApiService {
5084
+ constructor() {
5085
+ super(...arguments);
5086
+ __publicField(this, "_getAccessToken", () => this.client.store.getState().authReducer.accessToken);
5087
+ __publicField(this, "_getRefreshToken", () => this.client.store.getState().authReducer.refreshToken);
5088
+ // _getTokenPair and _getRenewedTokens don't need to use enqueueRequest from the BaseApiService because
5089
+ // they are very simple. However, if we need robust error handling or want these operations to queue in the Outbox,
5090
+ // we will use enqueueRequest.
5091
+ /**
5092
+ * Takes credentials and gets a token pair
5093
+ * @async
5094
+ * @param credentials The username and password for obtaining a token pair
5095
+ * @param logoutOnFailure Whether to log out if the request fails
5096
+ * @returns An array containing two elements: 1) a Promise for the access and refresh tokens, and 2) the UUID of the
5097
+ * request, so the request can be cancelled if necessary.
5098
+ */
5099
+ __publicField(this, "_getTokenPair", (credentials, logoutOnFailure = true) => {
5100
+ const uuid = v4();
5101
+ const responsePromise = this.enqueueRequest({
5102
+ uuid,
5103
+ description: "Get token pair",
5104
+ method: HttpMethod.POST,
5105
+ url: "/api/token/",
5106
+ payload: credentials,
5107
+ isAuthNeeded: false,
5108
+ checkAuth: false,
5109
+ blockers: [],
5110
+ blocks: []
5111
+ }).then(parseTokens).catch((e) => {
5112
+ if (logoutOnFailure) {
5113
+ void this.logout().then();
5114
+ }
5542
5115
  throw e;
5543
5116
  });
5544
- const promise2 = this.enqueueRequest({
5545
- description: "Edit attachment",
5546
- method: HttpMethod.PATCH,
5547
- url: `/attachments/issues/${attachment.offline_id}/`,
5548
- isResponseBlob: false,
5549
- payload: fileProps,
5550
- blockers: [attachmentId, newSha1],
5551
- blocks: [attachmentId, newSha1]
5117
+ return [responsePromise, uuid];
5118
+ });
5119
+ /**
5120
+ * Takes refresh token and gets a new token pair
5121
+ * @async
5122
+ * @param {string} refreshToken The refresh token used to get new tokens
5123
+ * @returns {Promise<TokenPair>} The new access and refresh tokens
5124
+ */
5125
+ __publicField(this, "_getRenewedTokens", async (refreshToken) => {
5126
+ const promise = this.enqueueRequest({
5127
+ description: "Get renewed tokens",
5128
+ method: HttpMethod.POST,
5129
+ url: "/api/token/refresh/",
5130
+ payload: { refresh: refreshToken },
5131
+ isAuthNeeded: false,
5132
+ blockers: [],
5133
+ blocks: [],
5134
+ // Don't wait for an auth check since this is a refresh token request.
5135
+ checkAuth: false,
5136
+ // Don't wait for other requests to finish, or we might end up in a deadlock.
5137
+ immediate: true
5138
+ }).catch((e) => {
5139
+ console.error("Could not renew tokens; logging out due to error:", e);
5140
+ void this.logout();
5141
+ return void 0;
5552
5142
  });
5143
+ let response = void 0;
5553
5144
  try {
5554
- const result = await promise2;
5555
- void this.client.files.removeCache(attachment.file_sha1);
5556
- return result;
5145
+ response = await promise;
5557
5146
  } catch (e) {
5558
- if (oldFile) {
5559
- store.dispatch(
5560
- updateIssueAttachment({
5561
- ...attachment,
5562
- file_sha1: attachment.file_sha1,
5563
- file: URL.createObjectURL(oldFile)
5564
- })
5565
- );
5566
- }
5567
- throw e;
5147
+ await this.logout();
5568
5148
  }
5569
- };
5570
- const offlineAttachment = {
5571
- ...attachment,
5572
- file_sha1: newSha1,
5573
- file: URL.createObjectURL(newFile)
5574
- };
5575
- const promise = performRequest2();
5576
- return [offlineAttachment, promise];
5149
+ if (!response)
5150
+ return void 0;
5151
+ if (!response.access)
5152
+ throw new Error("Missing access token");
5153
+ if (!response.refresh)
5154
+ throw new Error("Missing refresh token");
5155
+ return { accessToken: response.access, refreshToken: response.refresh };
5156
+ });
5577
5157
  }
5578
- async replaceComponentAttachmentFile(attachmentId, newFile) {
5579
- const { store } = this.client;
5580
- const attachment = store.getState().componentReducer.attachments[attachmentId];
5581
- if (!attachment)
5582
- throw new Error(`Attachment ${attachmentId} not found`);
5583
- let oldFile = void 0;
5584
- const newSha1 = await hashFile(newFile);
5585
- const performRequest2 = async () => {
5586
- oldFile = await this.client.files.fetchCache(attachment.file_sha1);
5587
- if (!oldFile) {
5588
- console.error(`Failed to fetch old file from cache for sha1 ${attachment.file_sha1}.`);
5589
- }
5590
- if (!newFile.objectURL) {
5591
- throw new Error(`newFile["objectURL"] is unexpectedly ${newFile.objectURL}`);
5592
- }
5593
- store.dispatch(
5594
- updateComponentAttachment({ ...attachment, file_sha1: newSha1, file: URL.createObjectURL(newFile) })
5595
- );
5596
- await this.client.files.addCache(newFile, newSha1);
5597
- const [fileProps] = await this.client.files.uploadFileToS3(newSha1).catch((e) => {
5598
- store.dispatch(updateComponentAttachment(attachment));
5599
- throw e;
5600
- });
5601
- const promise2 = this.enqueueRequest({
5602
- description: "Edit attachment",
5603
- method: HttpMethod.PATCH,
5604
- url: `/attachments/components/${attachment.offline_id}/`,
5605
- isResponseBlob: false,
5606
- payload: fileProps,
5607
- blockers: [attachmentId, newSha1],
5608
- blocks: [attachmentId, newSha1]
5609
- });
5610
- try {
5611
- const result = await promise2;
5612
- void this.client.files.removeCache(attachment.file_sha1);
5613
- return result;
5614
- } catch (e) {
5615
- if (oldFile) {
5616
- store.dispatch(
5617
- updateComponentAttachment({
5618
- ...attachment,
5619
- file_sha1: attachment.file_sha1,
5620
- file: URL.createObjectURL(oldFile)
5621
- })
5622
- );
5623
- }
5624
- throw e;
5625
- }
5626
- };
5627
- const offlineAttachment = {
5628
- ...attachment,
5629
- file_sha1: newSha1,
5630
- file: URL.createObjectURL(newFile)
5631
- };
5632
- const promise = performRequest2();
5633
- return [offlineAttachment, promise];
5634
- }
5635
- async replaceComponentTypeAttachmentFile(attachmentId, newFile) {
5636
- const { store } = this.client;
5637
- const attachment = store.getState().componentTypeReducer.attachments[attachmentId];
5638
- if (!attachment)
5639
- throw new Error(`Attachment ${attachmentId} not found`);
5640
- let oldFile = void 0;
5641
- const newSha1 = await hashFile(newFile);
5642
- const performRequest2 = async () => {
5643
- oldFile = await this.client.files.fetchCache(attachment.file_sha1);
5644
- if (!oldFile) {
5645
- console.error(`Failed to fetch old file from cache for sha1 ${attachment.file_sha1}.`);
5646
- }
5647
- if (!newFile.objectURL) {
5648
- throw new Error(`newFile["objectURL"] is unexpectedly ${newFile.objectURL}`);
5649
- }
5650
- store.dispatch(
5651
- updateComponentTypeAttachment({
5652
- ...attachment,
5653
- file_sha1: newSha1,
5654
- file: URL.createObjectURL(newFile)
5655
- })
5656
- );
5657
- await this.client.files.addCache(newFile, newSha1);
5658
- const [fileProps] = await this.client.files.uploadFileToS3(newSha1).catch((e) => {
5659
- store.dispatch(updateComponentTypeAttachment(attachment));
5660
- throw e;
5661
- });
5662
- const promise2 = this.enqueueRequest({
5663
- description: "Edit attachment",
5664
- method: HttpMethod.PATCH,
5665
- url: `/attachments/component_types/${attachment.offline_id}/`,
5666
- isResponseBlob: false,
5667
- payload: fileProps,
5668
- blockers: [attachmentId, newSha1],
5669
- blocks: [attachmentId, newSha1]
5670
- });
5671
- try {
5672
- const result = await promise2;
5673
- void this.client.files.removeCache(attachment.file_sha1);
5674
- return result;
5675
- } catch (e) {
5676
- if (oldFile) {
5677
- store.dispatch(
5678
- updateComponentTypeAttachment({
5679
- ...attachment,
5680
- file_sha1: attachment.file_sha1,
5681
- file: URL.createObjectURL(oldFile)
5682
- })
5683
- );
5684
- }
5685
- throw e;
5686
- }
5687
- };
5688
- const offlineAttachment = {
5689
- ...attachment,
5690
- file_sha1: newSha1,
5691
- file: URL.createObjectURL(newFile)
5692
- };
5693
- const promise = performRequest2();
5694
- return [offlineAttachment, promise];
5695
- }
5696
- async replaceDocumentAttachmentFile(attachmentId, newFile) {
5697
- const { store } = this.client;
5698
- const attachment = store.getState().documentsReducer.attachments[attachmentId];
5699
- if (!attachment)
5700
- throw new Error(`Attachment ${attachmentId} not found`);
5701
- let oldFile = void 0;
5702
- const newSha1 = await hashFile(newFile);
5703
- const performRequest2 = async () => {
5704
- oldFile = await this.client.files.fetchCache(attachment.file_sha1);
5705
- if (!oldFile) {
5706
- console.error(`Failed to fetch old file from cache for sha1 ${attachment.file_sha1}.`);
5707
- }
5708
- if (!newFile.objectURL) {
5709
- throw new Error(`newFile["objectURL"] is unexpectedly ${newFile.objectURL}`);
5710
- }
5711
- store.dispatch(
5712
- updateDocumentAttachment({
5713
- ...attachment,
5714
- file_sha1: newSha1,
5715
- file: URL.createObjectURL(newFile)
5716
- })
5717
- );
5718
- await this.client.files.addCache(newFile, newSha1);
5719
- const [fileProps] = await this.client.files.uploadFileToS3(newSha1).catch((e) => {
5720
- store.dispatch(updateDocumentAttachment(attachment));
5721
- throw e;
5722
- });
5723
- const promise2 = this.enqueueRequest({
5724
- description: "Edit attachment",
5725
- method: HttpMethod.PATCH,
5726
- url: `/attachments/documents/${attachment.offline_id}/`,
5727
- isResponseBlob: false,
5728
- payload: fileProps,
5729
- blockers: [attachmentId, newSha1],
5730
- blocks: [attachmentId, newSha1]
5731
- });
5732
- try {
5733
- const result = await promise2;
5734
- void this.client.files.removeCache(attachment.file_sha1);
5735
- return result;
5736
- } catch (e) {
5737
- if (oldFile) {
5738
- store.dispatch(
5739
- updateDocumentAttachment({
5740
- ...attachment,
5741
- file_sha1: attachment.file_sha1,
5742
- file: URL.createObjectURL(oldFile)
5743
- })
5744
- );
5745
- }
5746
- throw e;
5747
- }
5748
- };
5749
- const offlineAttachment = {
5750
- ...attachment,
5751
- file_sha1: newSha1,
5752
- file: URL.createObjectURL(newFile)
5753
- };
5754
- const promise = performRequest2();
5755
- return [offlineAttachment, promise];
5756
- }
5757
- /**
5758
- * Deletes an attachment and associated data in the cloud, in the Redux store and the cache.
5759
- * @param issueAttachmentId
5760
- */
5761
- deleteIssueAttachment(issueAttachmentId) {
5762
- const { store } = this.client;
5763
- const attachment = selectIssueAttachmentMapping(store.getState())[issueAttachmentId];
5764
- if (!attachment) {
5765
- throw new Error(`Attachment ${issueAttachmentId} not found`);
5766
- }
5767
- store.dispatch(removeIssueAttachment(issueAttachmentId));
5768
- void this.client.files.removeCache(attachment.file_sha1);
5769
- return this.enqueueRequest({
5770
- description: "Delete attachment",
5771
- method: HttpMethod.DELETE,
5772
- url: `/attachments/issues/${issueAttachmentId}/`,
5773
- blockers: [issueAttachmentId],
5774
- blocks: [issueAttachmentId]
5775
- });
5776
- }
5777
- deleteComponentAttachment(componentAttachmentId) {
5778
- const { store } = this.client;
5779
- const attachment = selectComponentAttachmentMapping(store.getState())[componentAttachmentId];
5780
- if (!attachment) {
5781
- throw new Error(`Attachment ${componentAttachmentId} not found`);
5782
- }
5783
- store.dispatch(removeComponentAttachment(componentAttachmentId));
5784
- void this.client.files.removeCache(attachment.file_sha1);
5785
- return this.enqueueRequest({
5786
- description: "Delete attachment",
5787
- method: HttpMethod.DELETE,
5788
- url: `/attachments/components/${componentAttachmentId}/`,
5789
- blockers: [componentAttachmentId],
5790
- blocks: [componentAttachmentId]
5791
- });
5792
- }
5793
- deleteComponentTypeAttachment(componentTypeAttachmentId) {
5794
- const { store } = this.client;
5795
- const attachment = selectComponentTypeAttachmentMapping(store.getState())[componentTypeAttachmentId];
5796
- if (!attachment) {
5797
- throw new Error(`Attachment ${componentTypeAttachmentId} not found`);
5798
- }
5799
- store.dispatch(removeComponentTypeAttachment(componentTypeAttachmentId));
5800
- void this.client.files.removeCache(attachment.file_sha1);
5801
- return this.enqueueRequest({
5802
- description: "Delete attachment",
5803
- method: HttpMethod.DELETE,
5804
- url: `/attachments/component_types/${componentTypeAttachmentId}/`,
5805
- blockers: [componentTypeAttachmentId],
5806
- blocks: [componentTypeAttachmentId]
5807
- });
5808
- }
5809
- deleteDocumentAttachment(documentAttachmentId) {
5810
- const { store } = this.client;
5811
- const attachment = store.getState().documentsReducer.attachments[documentAttachmentId];
5812
- if (!attachment) {
5813
- throw new Error(`Attachment ${documentAttachmentId} not found`);
5814
- }
5815
- store.dispatch(removeDocumentAttachment(documentAttachmentId));
5816
- void this.client.files.removeCache(attachment.file_sha1);
5817
- return this.enqueueRequest({
5818
- description: "Delete document attachment",
5819
- method: HttpMethod.DELETE,
5820
- url: `/attachments/documents/${documentAttachmentId}/`,
5821
- blockers: [documentAttachmentId],
5822
- blocks: [documentAttachmentId]
5823
- });
5824
- }
5825
- }
5826
- const EXPIRING_SOON_THRESHOLD = 1800;
5827
- function parseTokens(response) {
5828
- if (!response.access)
5829
- throw new Error("Missing access token");
5830
- if (!response.refresh)
5831
- throw new Error("Missing refresh token");
5832
- return { accessToken: response.access, refreshToken: response.refresh };
5833
- }
5834
- class AuthService extends BaseApiService {
5835
- constructor() {
5836
- super(...arguments);
5837
- __publicField(this, "_getAccessToken", () => this.client.store.getState().authReducer.accessToken);
5838
- __publicField(this, "_getRefreshToken", () => this.client.store.getState().authReducer.refreshToken);
5839
- // _getTokenPair and _getRenewedTokens don't need to use enqueueRequest from the BaseApiService because
5840
- // they are very simple. However, if we need robust error handling or want these operations to queue in the Outbox,
5841
- // we will use enqueueRequest.
5842
- /**
5843
- * Takes credentials and gets a token pair
5844
- * @async
5845
- * @param credentials The username and password for obtaining a token pair
5846
- * @param logoutOnFailure Whether to log out if the request fails
5847
- * @returns An array containing two elements: 1) a Promise for the access and refresh tokens, and 2) the UUID of the
5848
- * request, so the request can be cancelled if necessary.
5849
- */
5850
- __publicField(this, "_getTokenPair", (credentials, logoutOnFailure = true) => {
5851
- const uuid = v4();
5852
- const responsePromise = this.enqueueRequest({
5853
- uuid,
5854
- description: "Get token pair",
5855
- method: HttpMethod.POST,
5856
- url: "/api/token/",
5857
- payload: credentials,
5858
- isAuthNeeded: false,
5859
- checkAuth: false,
5860
- blockers: [],
5861
- blocks: []
5862
- }).then(parseTokens).catch((e) => {
5863
- if (logoutOnFailure) {
5864
- void this.logout().then();
5865
- }
5866
- throw e;
5867
- });
5868
- return [responsePromise, uuid];
5869
- });
5870
- /**
5871
- * Takes refresh token and gets a new token pair
5872
- * @async
5873
- * @param {string} refreshToken The refresh token used to get new tokens
5874
- * @returns {Promise<TokenPair>} The new access and refresh tokens
5875
- */
5876
- __publicField(this, "_getRenewedTokens", async (refreshToken) => {
5877
- const promise = this.enqueueRequest({
5878
- description: "Get renewed tokens",
5879
- method: HttpMethod.POST,
5880
- url: "/api/token/refresh/",
5881
- payload: { refresh: refreshToken },
5882
- isAuthNeeded: false,
5883
- blockers: [],
5884
- blocks: [],
5885
- // Don't wait for an auth check since this is a refresh token request.
5886
- checkAuth: false,
5887
- // Don't wait for other requests to finish, or we might end up in a deadlock.
5888
- immediate: true
5889
- }).catch((e) => {
5890
- console.error("Could not renew tokens; logging out due to error:", e);
5891
- void this.logout();
5892
- return void 0;
5893
- });
5894
- let response = void 0;
5895
- try {
5896
- response = await promise;
5897
- } catch (e) {
5898
- await this.logout();
5899
- }
5900
- if (!response)
5901
- return void 0;
5902
- if (!response.access)
5903
- throw new Error("Missing access token");
5904
- if (!response.refresh)
5905
- throw new Error("Missing refresh token");
5906
- return { accessToken: response.access, refreshToken: response.refresh };
5907
- });
5908
- }
5909
- /**
5910
- * Attempts to log into Hemora using given credentials
5911
- * @param {string} username
5912
- * @param {string} password
5913
- */
5914
- async login(username, password) {
5158
+ /**
5159
+ * Attempts to log into Hemora using given credentials
5160
+ * @param {string} username
5161
+ * @param {string} password
5162
+ */
5163
+ async login(username, password) {
5915
5164
  const { store } = this.client;
5916
5165
  const [promise, uuid] = this._getTokenPair({ username, password }, false);
5917
5166
  const initialDataUuid = v4();
@@ -6514,6 +5763,221 @@ class ComponentStageService extends BaseApiService {
6514
5763
  store.dispatch(addStages(result));
6515
5764
  }
6516
5765
  }
5766
+ const AttachmentModelMeta = {
5767
+ [AttachmentModel.Issue]: {
5768
+ name: "issue",
5769
+ attachUrlPrefix: "/issues",
5770
+ deleteUrlPrefix: "/issues",
5771
+ fetchUrlPostfix: "/issue-attachments"
5772
+ },
5773
+ [AttachmentModel.Component]: {
5774
+ name: "component",
5775
+ attachUrlPrefix: "/components",
5776
+ deleteUrlPrefix: "/components",
5777
+ fetchUrlPostfix: "/component-attachments"
5778
+ },
5779
+ [AttachmentModel.ComponentType]: {
5780
+ name: "component type",
5781
+ attachUrlPrefix: "/components/types",
5782
+ deleteUrlPrefix: "/components/types",
5783
+ fetchUrlPostfix: "/component-type-attachments"
5784
+ },
5785
+ [AttachmentModel.Project]: {
5786
+ name: "component project",
5787
+ attachUrlPrefix: "/projects",
5788
+ deleteUrlPrefix: "/projects",
5789
+ fetchUrlPostfix: "/attachments"
5790
+ },
5791
+ [AttachmentModel.Document]: {
5792
+ name: "document",
5793
+ attachUrlPrefix: "/documents",
5794
+ deleteUrlPrefix: "/documents",
5795
+ fetchUrlPostfix: "/document-attachments"
5796
+ }
5797
+ };
5798
+ class BaseAttachmentService extends BaseApiService {
5799
+ getNumberOfAttachmentsWithSha1(sha1) {
5800
+ const {
5801
+ issueReducer: issueReducer2,
5802
+ componentReducer: componentReducer2,
5803
+ componentTypeReducer: componentTypeReducer2,
5804
+ documentsReducer: documentsReducer2,
5805
+ projectReducer: projectReducer2,
5806
+ formSubmissionReducer: formSubmissionReducer2,
5807
+ formRevisionReducer: formRevisionReducer2
5808
+ } = this.client.store.getState();
5809
+ const objectsWithSha1 = [].concat(
5810
+ Object.values(issueReducer2.attachments),
5811
+ Object.values(componentReducer2.attachments),
5812
+ Object.values(componentTypeReducer2.attachments),
5813
+ Object.values(documentsReducer2.attachments),
5814
+ Object.values(projectReducer2.attachments),
5815
+ Object.values(formRevisionReducer2.attachments),
5816
+ Object.values(formSubmissionReducer2.attachments)
5817
+ );
5818
+ return objectsWithSha1.filter((object) => object.file_sha1 === sha1).length;
5819
+ }
5820
+ processPresignedUrls(presignedUrls) {
5821
+ for (const [sha1, presignedUrl] of Object.entries(presignedUrls)) {
5822
+ void this.enqueueRequest({
5823
+ url: presignedUrl.url,
5824
+ description: "Upload file to S3",
5825
+ method: HttpMethod.POST,
5826
+ isExternalUrl: true,
5827
+ isAuthNeeded: false,
5828
+ attachmentHash: sha1,
5829
+ // TODO: can we use the sha1 as the blocker?
5830
+ blockers: [`s3-${presignedUrl.fields.key}`],
5831
+ blocks: [sha1],
5832
+ s3url: presignedUrl
5833
+ });
5834
+ }
5835
+ }
5836
+ // Note that currently the fetching of attachments for all models dependds on the active projectId. This may change in the future. And
5837
+ // so for some attachment model services, this method will have to be overridden.
5838
+ async getAttachments(actions) {
5839
+ const { store } = this.client;
5840
+ const activeProjectId = store.getState().projectReducer.activeProjectId;
5841
+ const meta = AttachmentModelMeta[this.attachmentModel];
5842
+ const result = await this.enqueueRequest({
5843
+ description: `Get ${meta.name} attachments`,
5844
+ method: HttpMethod.GET,
5845
+ url: `/projects/${activeProjectId}${meta.fetchUrlPostfix}/`,
5846
+ blocks: [],
5847
+ blockers: []
5848
+ });
5849
+ store.dispatch(actions.setAttachments(result));
5850
+ }
5851
+ async attachFiles(files, modelId, buildOfflineAttachment, actions) {
5852
+ const { store } = this.client;
5853
+ const currentUser = store.getState().userReducer.currentUser;
5854
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
5855
+ const offlineAttachments = [];
5856
+ const attachmentPayloads = [];
5857
+ const filePayloads = {};
5858
+ for (const file of files) {
5859
+ const sha1 = await hashFile(file);
5860
+ if (!(sha1 in filePayloads)) {
5861
+ filePayloads[sha1] = {
5862
+ sha1,
5863
+ file_type: file.type,
5864
+ extension: file.name.split(".").pop(),
5865
+ size: file.size
5866
+ };
5867
+ await this.client.files.addCache(file, sha1);
5868
+ }
5869
+ const offlineAttachment = buildOfflineAttachment({
5870
+ file,
5871
+ sha1,
5872
+ submittedAt,
5873
+ createdBy: currentUser.id,
5874
+ description: "",
5875
+ modelId
5876
+ });
5877
+ offlineAttachments.push(offlineAttachment);
5878
+ attachmentPayloads.push({
5879
+ offline_id: offlineAttachment.offline_id,
5880
+ name: offlineAttachment.file_name,
5881
+ sha1: offlineAttachment.file_sha1,
5882
+ description: offlineAttachment.description
5883
+ });
5884
+ }
5885
+ store.dispatch(actions.addAttachments(offlineAttachments));
5886
+ const meta = AttachmentModelMeta[this.attachmentModel];
5887
+ const promise = this.enqueueRequest({
5888
+ description: `Attach files to ${meta.name}`,
5889
+ method: HttpMethod.POST,
5890
+ url: `${meta.attachUrlPrefix}/${modelId}/attach/`,
5891
+ payload: {
5892
+ submitted_at: submittedAt,
5893
+ attachments: attachmentPayloads,
5894
+ files: Object.values(filePayloads)
5895
+ },
5896
+ blocks: offlineAttachments.map((attachment) => attachment.offline_id),
5897
+ blockers: offlineAttachments.map((attachment) => attachment.file_sha1)
5898
+ });
5899
+ promise.then(({ attachments, presigned_urls }) => {
5900
+ store.dispatch(actions.updateAttachments(attachments));
5901
+ this.processPresignedUrls(presigned_urls);
5902
+ }).catch(() => {
5903
+ store.dispatch(actions.removeAttachments(offlineAttachments.map((attachment) => attachment.offline_id)));
5904
+ });
5905
+ return [offlineAttachments, promise.then(({ attachments }) => attachments)];
5906
+ }
5907
+ async deleteAttachment(attachmendId, actions, selectors) {
5908
+ const { store } = this.client;
5909
+ const attachment = selectors.selectAttachment(attachmendId)(store.getState());
5910
+ if (!attachment) {
5911
+ throw new Error(
5912
+ `Attempting to delete attachment with offline_id ${attachmendId} that does not exist in the store`
5913
+ );
5914
+ }
5915
+ store.dispatch(actions.removeAttachment(attachment.offline_id));
5916
+ const meta = AttachmentModelMeta[this.attachmentModel];
5917
+ const promise = this.enqueueRequest({
5918
+ description: "Delete attachment",
5919
+ method: HttpMethod.DELETE,
5920
+ url: `${meta.deleteUrlPrefix}/attachments/${attachmendId}/`,
5921
+ blockers: [attachmendId],
5922
+ blocks: []
5923
+ });
5924
+ promise.then(() => {
5925
+ if (this.getNumberOfAttachmentsWithSha1(attachment.file_sha1) === 0) {
5926
+ void this.client.files.removeCache(attachment.file_sha1);
5927
+ }
5928
+ }).catch(() => {
5929
+ store.dispatch(actions.setAttachment(attachment));
5930
+ });
5931
+ return promise;
5932
+ }
5933
+ }
5934
+ class ComponentAttachmentService extends BaseAttachmentService {
5935
+ constructor() {
5936
+ super(...arguments);
5937
+ __publicField(this, "attachmentModel", AttachmentModel.Component);
5938
+ }
5939
+ buildOfflineAttachment(data) {
5940
+ return offline({
5941
+ file: URL.createObjectURL(data.file),
5942
+ file_sha1: data.sha1,
5943
+ created_by: data.createdBy,
5944
+ file_name: data.file.name,
5945
+ file_type: data.file.type,
5946
+ submitted_at: data.submittedAt,
5947
+ description: data.description,
5948
+ component: data.modelId
5949
+ });
5950
+ }
5951
+ async attachFilesToComponent(files, componentId) {
5952
+ return this.attachFiles(
5953
+ files,
5954
+ componentId,
5955
+ this.buildOfflineAttachment.bind(this),
5956
+ {
5957
+ addAttachments: addComponentAttachments,
5958
+ updateAttachments: updateComponentAttachments,
5959
+ removeAttachments: removeComponentAttachments
5960
+ }
5961
+ );
5962
+ }
5963
+ deleteComponentAttachment(attachmentId) {
5964
+ return this.deleteAttachment(
5965
+ attachmentId,
5966
+ {
5967
+ setAttachment: setComponentAttachment,
5968
+ removeAttachment: removeComponentAttachment
5969
+ },
5970
+ {
5971
+ selectAttachment: selectComponentAttachment
5972
+ }
5973
+ );
5974
+ }
5975
+ async refreshStore() {
5976
+ return this.getAttachments({
5977
+ setAttachments: setComponentAttachments
5978
+ });
5979
+ }
5980
+ }
6517
5981
  class ComponentTypeService extends BaseApiService {
6518
5982
  add(componentType) {
6519
5983
  const offlineComponentType = offline(componentType);
@@ -6586,10 +6050,57 @@ class ComponentTypeService extends BaseApiService {
6586
6050
  store.dispatch(setComponentTypes(result));
6587
6051
  }
6588
6052
  }
6589
- class IssueCommentService extends BaseApiService {
6590
- // Omit author and submitted_at since these will always be set internally
6591
- add(comment) {
6592
- const { store } = this.client;
6053
+ class ComponentTypeAttachmentService extends BaseAttachmentService {
6054
+ constructor() {
6055
+ super(...arguments);
6056
+ __publicField(this, "attachmentModel", AttachmentModel.ComponentType);
6057
+ }
6058
+ buildOfflineAttachment(data) {
6059
+ return offline({
6060
+ file: URL.createObjectURL(data.file),
6061
+ file_sha1: data.sha1,
6062
+ created_by: data.createdBy,
6063
+ file_name: data.file.name,
6064
+ file_type: data.file.type,
6065
+ submitted_at: data.submittedAt,
6066
+ description: data.description,
6067
+ component_type: data.modelId
6068
+ });
6069
+ }
6070
+ async attachFilesToComponentType(files, componentTypeId) {
6071
+ return this.attachFiles(
6072
+ files,
6073
+ componentTypeId,
6074
+ this.buildOfflineAttachment.bind(this),
6075
+ {
6076
+ addAttachments: addComponentTypeAttachments,
6077
+ updateAttachments: updateComponentTypeAttachments,
6078
+ removeAttachments: removeComponentTypeAttachments
6079
+ }
6080
+ );
6081
+ }
6082
+ deleteComponentTypeAttachment(attachmentId) {
6083
+ return this.deleteAttachment(
6084
+ attachmentId,
6085
+ {
6086
+ setAttachment: setComponentTypeAttachment,
6087
+ removeAttachment: removeComponentTypeAttachment
6088
+ },
6089
+ {
6090
+ selectAttachment: selectComponentTypeAttachment
6091
+ }
6092
+ );
6093
+ }
6094
+ async refreshStore() {
6095
+ return this.getAttachments({
6096
+ setAttachments: setComponentTypeAttachments
6097
+ });
6098
+ }
6099
+ }
6100
+ class IssueCommentService extends BaseApiService {
6101
+ // Omit author and submitted_at since these will always be set internally
6102
+ add(comment) {
6103
+ const { store } = this.client;
6593
6104
  const offlineComment = offline({
6594
6105
  ...comment,
6595
6106
  author: store.getState().userReducer.currentUser.id,
@@ -6682,11 +6193,53 @@ class IssueUpdateService extends BaseApiService {
6682
6193
  store.dispatch(setIssueUpdates(filteredResult));
6683
6194
  }
6684
6195
  }
6196
+ class IssueAttachmentService extends BaseAttachmentService {
6197
+ constructor() {
6198
+ super(...arguments);
6199
+ __publicField(this, "attachmentModel", AttachmentModel.Issue);
6200
+ }
6201
+ buildOfflineAttachment(data) {
6202
+ return offline({
6203
+ file: URL.createObjectURL(data.file),
6204
+ file_sha1: data.sha1,
6205
+ created_by: data.createdBy,
6206
+ file_name: data.file.name,
6207
+ file_type: data.file.type,
6208
+ submitted_at: data.submittedAt,
6209
+ description: data.description,
6210
+ issue: data.modelId
6211
+ });
6212
+ }
6213
+ async attachFilesToIssue(files, issueId) {
6214
+ return this.attachFiles(files, issueId, this.buildOfflineAttachment.bind(this), {
6215
+ addAttachments: addIssueAttachments,
6216
+ updateAttachments: updateIssueAttachments,
6217
+ removeAttachments: removeIssueAttachments
6218
+ });
6219
+ }
6220
+ deleteIssueAttachment(attachmentId) {
6221
+ return this.deleteAttachment(
6222
+ attachmentId,
6223
+ {
6224
+ setAttachment: setIssueAttachment,
6225
+ removeAttachment: removeIssueAttachment
6226
+ },
6227
+ {
6228
+ selectAttachment: selectIssueAttachment
6229
+ }
6230
+ );
6231
+ }
6232
+ async refreshStore() {
6233
+ return this.getAttachments({
6234
+ setAttachments: setIssueAttachments
6235
+ });
6236
+ }
6237
+ }
6685
6238
  class IssueService extends BaseApiService {
6686
6239
  // Basic CRUD functions
6687
6240
  // TODO: Once all models are represented in `Created<TModel>`, use `Created` in `OptimisticModelResult`, so we don't
6688
6241
  // have to repeat it for all optimistic model results (all optimistic results are created).
6689
- add(issue, issue_type = null) {
6242
+ add(issue, issueType = null) {
6690
6243
  const { store } = this.client;
6691
6244
  const dateWithoutMilliseconds = /* @__PURE__ */ new Date();
6692
6245
  const state = store.getState();
@@ -6713,7 +6266,7 @@ class IssueService extends BaseApiService {
6713
6266
  url: "/issues/",
6714
6267
  queryParams: {
6715
6268
  workspace_id: workspaceId,
6716
- ...issue_type ? { issue_type } : {}
6269
+ ...issueType ? { issue_type: issueType } : {}
6717
6270
  },
6718
6271
  payload: issuePayload,
6719
6272
  blockers: [
@@ -6850,7 +6403,7 @@ class IssueService extends BaseApiService {
6850
6403
  this.client.store.dispatch(updateIssue(issueToBeUpdated));
6851
6404
  this.client.store.dispatch(removeIssueUpdate(offlineIssueUpdate.offline_id));
6852
6405
  });
6853
- const fullIssue = this.client.store.getState().issueReducer.issues[issue.offline_id];
6406
+ const fullIssue = state.issueReducer.issues[issue.offline_id];
6854
6407
  return [fullIssue, promise];
6855
6408
  }
6856
6409
  async remove(id) {
@@ -6901,14 +6454,15 @@ class IssueService extends BaseApiService {
6901
6454
  class IssueTypeService extends BaseApiService {
6902
6455
  add(payload) {
6903
6456
  const { store } = this.client;
6904
- const activeOrganizationId = store.getState().organizationReducer.activeOrganizationId;
6457
+ const state = store.getState();
6458
+ const activeOrganizationId = state.organizationReducer.activeOrganizationId;
6905
6459
  if (!activeOrganizationId) {
6906
6460
  throw new Error(`No active organization, got ${activeOrganizationId} for activeOrganizationId.`);
6907
6461
  }
6908
6462
  const offlineIssueType = offline({
6909
6463
  ...payload,
6910
6464
  submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
6911
- created_by: store.getState().userReducer.currentUser.id,
6465
+ created_by: state.userReducer.currentUser.id,
6912
6466
  organization: activeOrganizationId
6913
6467
  });
6914
6468
  store.dispatch(addIssueType(offlineIssueType));
@@ -6961,25 +6515,23 @@ class IssueTypeService extends BaseApiService {
6961
6515
  }
6962
6516
  delete(issueTypeId) {
6963
6517
  const { store } = this.client;
6964
- const issueTypeToDelete = store.getState().issueTypeReducer.issueTypes[issueTypeId];
6518
+ const state = store.getState();
6519
+ const issueTypeToDelete = state.issueTypeReducer.issueTypes[issueTypeId];
6965
6520
  if (!issueTypeToDelete) {
6966
6521
  throw new Error(`IssueType with offline_id ${issueTypeId} does not exist in the store.`);
6967
6522
  }
6968
- const issuesOfIssueType = selectIssuesOfIssueType(issueTypeId)(store.getState()) ?? [];
6969
- const issueTypeTeamLinks = selectIssueTypeTeamLinksOfIssueType(issueTypeId)(store.getState()) ?? [];
6523
+ const issuesOfIssueType = selectIssuesOfIssueType(issueTypeId)(state) ?? [];
6970
6524
  store.dispatch(removeIssueType(issueTypeId));
6971
6525
  store.dispatch(removeIssues(issuesOfIssueType.map((issue) => issue.offline_id)));
6972
- store.dispatch(deleteIssueTypeTeamLinks(issueTypeTeamLinks.map((link) => link.offline_id)));
6973
6526
  const promise = this.enqueueRequest({
6974
6527
  method: HttpMethod.DELETE,
6975
6528
  url: `/issues/types/${issueTypeId}/`,
6976
6529
  blockers: [issueTypeId],
6977
- blocks: [issueTypeId]
6530
+ blocks: []
6978
6531
  });
6979
6532
  promise.catch(() => {
6980
6533
  store.dispatch(setIssueType(issueTypeToDelete));
6981
6534
  store.dispatch(addIssues(issuesOfIssueType));
6982
- store.dispatch(setIssueTypeTeamLinks(issueTypeTeamLinks));
6983
6535
  });
6984
6536
  return promise;
6985
6537
  }
@@ -7129,6 +6681,7 @@ class MainService extends BaseApiService {
7129
6681
  const usersResult = await usersResultPromise;
7130
6682
  await projectAccessRefreshPromise;
7131
6683
  store.dispatch(addUsers(usersResult));
6684
+ void this.client.projectAttachments.refreshStore();
7132
6685
  }
7133
6686
  let currentWorkspaceId;
7134
6687
  const oldWorkspaceId = this.client.store.getState().workspaceReducer.activeWorkspaceId;
@@ -7141,35 +6694,29 @@ class MainService extends BaseApiService {
7141
6694
  store.dispatch(setActiveWorkspaceId(currentWorkspaceId));
7142
6695
  void this.client.categories.refreshStore().then(() => {
7143
6696
  void this.client.issues.refreshStore().then(() => {
6697
+ void this.client.issueAttachments.refreshStore().then();
7144
6698
  void this.client.issueComments.refreshStore().then();
6699
+ void this.client.issueUpdates.refreshStore().then();
7145
6700
  });
7146
6701
  });
7147
6702
  void this.client.projectFiles.refreshStore().then();
7148
6703
  void this.client.componentTypes.refreshStore().then(() => {
7149
- void this.client.componentStages.refreshStore().then(() => {
7150
- void this.client.components.refreshStore(overwrite).then();
6704
+ void this.client.componentTypeAttachments.refreshStore().then(() => {
6705
+ void this.client.componentStages.refreshStore().then(() => {
6706
+ void this.client.components.refreshStore(overwrite).then(() => {
6707
+ void this.client.componentAttachments.refreshStore().then();
6708
+ });
6709
+ });
6710
+ void this.client.componentStageCompletions.refreshStore().then();
7151
6711
  });
7152
- void this.client.componentStageCompletions.refreshStore().then();
7153
6712
  });
7154
6713
  void this.client.userForms.refreshStore().then(() => {
7155
6714
  void this.client.userFormSubmissions.refreshStore().then();
7156
6715
  });
7157
6716
  }
7158
6717
  if (currentProjectId) {
7159
- const [_offlineAttachments, promise] = this.client.attachments.fetchAll(currentProjectId);
7160
- void promise.then((result) => {
7161
- const {
7162
- issue_attachments,
7163
- component_type_attachments,
7164
- component_attachments,
7165
- project_attachments,
7166
- document_attachments
7167
- } = result;
7168
- store.dispatch(setIssueAttachments(issue_attachments));
7169
- store.dispatch(setComponentAttachments(component_attachments));
7170
- store.dispatch(setComponentTypeAttachments(component_type_attachments));
7171
- store.dispatch(setProjectAttachments(project_attachments));
7172
- store.dispatch(setDocumentAttachments(document_attachments));
6718
+ void this.client.documents.refreshStore().then(() => {
6719
+ void this.client.documentAttachments.refreshStore().then();
7173
6720
  });
7174
6721
  void this.client.documents.refreshStore();
7175
6722
  void this.client.issueUpdates.refreshStore();
@@ -7272,6 +6819,7 @@ class ProjectFileService extends BaseApiService {
7272
6819
  });
7273
6820
  return promise;
7274
6821
  }
6822
+ // TODO: This needs to be seperated into a update and create method
7275
6823
  saveActive() {
7276
6824
  const { store } = this.client;
7277
6825
  const state = store.getState();
@@ -7337,6 +6885,48 @@ class ProjectFileService extends BaseApiService {
7337
6885
  });
7338
6886
  }
7339
6887
  }
6888
+ class ProjectAttachmentService extends BaseAttachmentService {
6889
+ constructor() {
6890
+ super(...arguments);
6891
+ __publicField(this, "attachmentModel", AttachmentModel.Project);
6892
+ }
6893
+ buildOfflineAttachment(data) {
6894
+ return offline({
6895
+ file: URL.createObjectURL(data.file),
6896
+ file_sha1: data.sha1,
6897
+ created_by: data.createdBy,
6898
+ file_name: data.file.name,
6899
+ file_type: data.file.type,
6900
+ submitted_at: data.submittedAt,
6901
+ description: data.description,
6902
+ project: data.modelId
6903
+ });
6904
+ }
6905
+ async attachFilesToProject(files, projectId) {
6906
+ return this.attachFiles(files, projectId, this.buildOfflineAttachment.bind(this), {
6907
+ addAttachments: addProjectAttachments,
6908
+ updateAttachments: updateProjectAttachments,
6909
+ removeAttachments: removeProjectAttachments
6910
+ });
6911
+ }
6912
+ deleteProjectAttachment(attachmentId) {
6913
+ return this.deleteAttachment(
6914
+ attachmentId,
6915
+ {
6916
+ setAttachment: setProjectAttachment,
6917
+ removeAttachment: removeProjectAttachment
6918
+ },
6919
+ {
6920
+ selectAttachment: selectProjectAttachment
6921
+ }
6922
+ );
6923
+ }
6924
+ async refreshStore() {
6925
+ return this.getAttachments({
6926
+ setAttachments: setProjectAttachments
6927
+ });
6928
+ }
6929
+ }
7340
6930
  class ProjectService extends BaseApiService {
7341
6931
  /**
7342
6932
  * Creates a new project. Due to the nature of project creation,
@@ -7554,7 +7144,7 @@ class UserFormService extends BaseApiService {
7554
7144
  const currentUser = state.userReducer.currentUser;
7555
7145
  const activeWorkspaceId = state.workspaceReducer.activeWorkspaceId;
7556
7146
  const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
7557
- const offlineFormPayload = offline({});
7147
+ const offlineFormPayload = offline({ ...ownerAttrs });
7558
7148
  const offlineRevisionPayload = offline({ ...initialRevision, submitted_at: submittedAt });
7559
7149
  const retForm = {
7560
7150
  ...offlineFormPayload,
@@ -7718,8 +7308,6 @@ class UserFormService extends BaseApiService {
7718
7308
  if (userFormRevisions && userFormRevisions.length > 0) {
7719
7309
  store.dispatch(deleteFormRevisions(userFormRevisions.map(({ offline_id }) => offline_id)));
7720
7310
  }
7721
- const userFormTeamLinks = selectUserFormLinksOfForm(formId2)(state) ?? [];
7722
- store.dispatch(deleteUserFormTeamLinks(userFormTeamLinks.map((link) => link.offline_id)));
7723
7311
  store.dispatch(deleteForm(formId2));
7724
7312
  try {
7725
7313
  return await this.enqueueRequest({
@@ -7737,7 +7325,6 @@ class UserFormService extends BaseApiService {
7737
7325
  if (userFormSubmissions && userFormSubmissions.length > 0) {
7738
7326
  store.dispatch(addFormSubmissions(userFormSubmissions));
7739
7327
  }
7740
- store.dispatch(setUserFormTeamLinks(userFormTeamLinks));
7741
7328
  throw e;
7742
7329
  }
7743
7330
  }
@@ -8682,8 +8269,7 @@ class DocumentService extends BaseApiService {
8682
8269
  }
8683
8270
  delete(documentId) {
8684
8271
  const { store } = this.client;
8685
- const state = store.getState();
8686
- const documentsMapping = selectDocumentsMapping(state);
8272
+ const documentsMapping = selectDocumentsMapping(store.getState());
8687
8273
  const documentToBeDeleted = documentsMapping[documentId];
8688
8274
  if (!documentToBeDeleted) {
8689
8275
  throw new Error(
@@ -8691,9 +8277,7 @@ class DocumentService extends BaseApiService {
8691
8277
  );
8692
8278
  }
8693
8279
  const parentDocument = documentToBeDeleted.parent_document ? documentsMapping[documentToBeDeleted.parent_document] : void 0;
8694
- const documentTeamLinks = selectDocumentTeamLinksOfDocument(documentId)(state) ?? [];
8695
8280
  store.dispatch(removeDocuments([documentId]));
8696
- store.dispatch(deleteDocumentTeamLinks(documentTeamLinks.map((link) => link.offline_id)));
8697
8281
  const promise = this.enqueueRequest({
8698
8282
  description: "Delete Document",
8699
8283
  method: HttpMethod.DELETE,
@@ -8708,7 +8292,6 @@ class DocumentService extends BaseApiService {
8708
8292
  if (parentDocument) {
8709
8293
  store.dispatch(updateDocuments([parentDocument]));
8710
8294
  }
8711
- store.dispatch(setDocumentTeamLinks(documentTeamLinks));
8712
8295
  });
8713
8296
  return promise;
8714
8297
  }
@@ -8735,6 +8318,48 @@ class DocumentService extends BaseApiService {
8735
8318
  store.dispatch(addDocuments(await organizationDocumentsPromise));
8736
8319
  }
8737
8320
  }
8321
+ class DocumentAttachmentService extends BaseAttachmentService {
8322
+ constructor() {
8323
+ super(...arguments);
8324
+ __publicField(this, "attachmentModel", AttachmentModel.Document);
8325
+ }
8326
+ buildOfflineAttachment(data) {
8327
+ return offline({
8328
+ file: URL.createObjectURL(data.file),
8329
+ file_sha1: data.sha1,
8330
+ created_by: data.createdBy,
8331
+ file_name: data.file.name,
8332
+ file_type: data.file.type,
8333
+ submitted_at: data.submittedAt,
8334
+ description: data.description,
8335
+ document: data.modelId
8336
+ });
8337
+ }
8338
+ async attachFilesToDocument(files, documentId) {
8339
+ return this.attachFiles(files, documentId, this.buildOfflineAttachment.bind(this), {
8340
+ addAttachments: addDocumentAttachments,
8341
+ updateAttachments: updateDocumentAttachments,
8342
+ removeAttachments: removeDocumentAttachments
8343
+ });
8344
+ }
8345
+ deleteDocumentAttachment(attachmentId) {
8346
+ return this.deleteAttachment(
8347
+ attachmentId,
8348
+ {
8349
+ setAttachment: setDocumentAttachment,
8350
+ removeAttachment: removeDocumentAttachment
8351
+ },
8352
+ {
8353
+ selectAttachment: selectDocumentAttachment
8354
+ }
8355
+ );
8356
+ }
8357
+ async refreshStore() {
8358
+ return this.getAttachments({
8359
+ setAttachments: setDocumentAttachments
8360
+ });
8361
+ }
8362
+ }
8738
8363
  class AgentService extends BaseApiService {
8739
8364
  /**
8740
8365
  * Prompt the agent with a message.
@@ -8830,13 +8455,7 @@ class TeamService extends BaseApiService {
8830
8455
  if (!team) {
8831
8456
  throw new Error(`Expected team with id ${teamId} to exist`);
8832
8457
  }
8833
- const documentTeamLinks = selectDocumentTeamLinksOfTeam(team.offline_id)(state) ?? [];
8834
- const issueTypeTeamLinks = selectIssueTypeTeamLinksOfTeam(team.offline_id)(state) ?? [];
8835
- const userFormTeamLinks = selectUserFormLinksOfTeam(team.offline_id)(state) ?? [];
8836
8458
  store.dispatch(deleteTeam(teamId));
8837
- store.dispatch(deleteDocumentTeamLinks(documentTeamLinks.map((link) => link.offline_id)));
8838
- store.dispatch(deleteIssueTypeTeamLinks(issueTypeTeamLinks.map((link) => link.offline_id)));
8839
- store.dispatch(deleteUserFormTeamLinks(userFormTeamLinks.map((link) => link.offline_id)));
8840
8459
  try {
8841
8460
  return await this.enqueueRequest({
8842
8461
  description: "Delete team",
@@ -8847,9 +8466,6 @@ class TeamService extends BaseApiService {
8847
8466
  });
8848
8467
  } catch (e) {
8849
8468
  store.dispatch(setTeam(team));
8850
- store.dispatch(setDocumentTeamLinks(documentTeamLinks));
8851
- store.dispatch(setIssueTypeTeamLinks(issueTypeTeamLinks));
8852
- store.dispatch(setUserFormTeamLinks(userFormTeamLinks));
8853
8469
  throw e;
8854
8470
  }
8855
8471
  }
@@ -8912,68 +8528,12 @@ class TeamService extends BaseApiService {
8912
8528
  store.dispatch(setTeams(result));
8913
8529
  }
8914
8530
  }
8915
- class DocumentTeamLinkService extends BaseApiService {
8916
- add(payload) {
8917
- const { store } = this.client;
8918
- const offlineDocumentTeamLink = offline({
8919
- ...payload,
8920
- submitted_at: (/* @__PURE__ */ new Date()).toISOString()
8921
- });
8922
- store.dispatch(addDocumentTeamLink(offlineDocumentTeamLink));
8923
- const promise = this.enqueueRequest({
8924
- method: HttpMethod.POST,
8925
- url: `/organizations/teams/${payload.team}/link-document/`,
8926
- payload: offlineDocumentTeamLink,
8927
- blockers: [payload.team, payload.document],
8928
- blocks: [offlineDocumentTeamLink.offline_id]
8929
- });
8930
- promise.then((createdDocumentLink) => {
8931
- store.dispatch(setDocumentTeamLink(createdDocumentLink));
8932
- }).catch(() => {
8933
- store.dispatch(deleteDocumentTeamLink(offlineDocumentTeamLink.offline_id));
8934
- });
8935
- return [offlineDocumentTeamLink, promise];
8936
- }
8937
- delete(documentTeamLinkId) {
8938
- const { store } = this.client;
8939
- const documentTeamLink = store.getState().documentTeamLinkReducer.documentTeamLinks[documentTeamLinkId];
8940
- if (!documentTeamLink) {
8941
- throw new Error(`No document team link found for ${documentTeamLinkId}`);
8942
- }
8943
- store.dispatch(deleteDocumentTeamLink(documentTeamLinkId));
8944
- const promise = this.enqueueRequest({
8945
- method: HttpMethod.DELETE,
8946
- url: `/organizations/teams/document-links/${documentTeamLinkId}/`,
8947
- blockers: [documentTeamLinkId],
8948
- blocks: [documentTeamLinkId]
8949
- });
8950
- promise.catch(() => {
8951
- store.dispatch(setDocumentTeamLink(documentTeamLink));
8952
- });
8953
- return promise;
8954
- }
8955
- async refreshStore() {
8956
- const { store } = this.client;
8957
- const activeOrganizationId = store.getState().organizationReducer.activeOrganizationId;
8958
- if (!activeOrganizationId) {
8959
- throw new Error(`No active organization, got ${activeOrganizationId} for activeOrganizationId.`);
8960
- }
8961
- const result = await this.enqueueRequest({
8962
- method: HttpMethod.GET,
8963
- url: `/organizations/${activeOrganizationId}/teams/document-links/`,
8964
- blockers: [],
8965
- blocks: []
8966
- });
8967
- store.dispatch(setDocumentTeamLinks(result));
8968
- }
8969
- }
8970
8531
  class OvermapSDK {
8971
8532
  constructor(apiUrl, store) {
8972
8533
  __publicField(this, "API_URL");
8973
8534
  __publicField(this, "store");
8974
8535
  __publicField(this, "agent", new AgentService(this));
8975
8536
  __publicField(this, "files", new FileService(this));
8976
- __publicField(this, "attachments", new AttachmentService(this));
8977
8537
  __publicField(this, "auth", new AuthService(this));
8978
8538
  __publicField(this, "categories", new CategoryService(this));
8979
8539
  __publicField(this, "projectAccesses", new ProjectAccessService(this));
@@ -8983,22 +8543,26 @@ class OvermapSDK {
8983
8543
  __publicField(this, "issueTypes", new IssueTypeService(this));
8984
8544
  __publicField(this, "issueComments", new IssueCommentService(this));
8985
8545
  __publicField(this, "issueUpdates", new IssueUpdateService(this));
8546
+ __publicField(this, "issueAttachments", new IssueAttachmentService(this));
8986
8547
  __publicField(this, "workspaces", new WorkspaceService(this));
8987
8548
  __publicField(this, "main", new MainService(this));
8988
8549
  __publicField(this, "components", new ComponentService(this));
8550
+ __publicField(this, "componentAttachments", new ComponentAttachmentService(this));
8989
8551
  __publicField(this, "componentTypes", new ComponentTypeService(this));
8552
+ __publicField(this, "componentTypeAttachments", new ComponentTypeAttachmentService(this));
8990
8553
  __publicField(this, "componentStages", new ComponentStageService(this));
8991
8554
  __publicField(this, "componentStageCompletions", new ComponentStageCompletionService(this));
8992
8555
  __publicField(this, "userForms", new UserFormService(this));
8993
8556
  __publicField(this, "userFormSubmissions", new UserFormSubmissionService(this));
8994
8557
  __publicField(this, "projects", new ProjectService(this));
8995
8558
  __publicField(this, "projectFiles", new ProjectFileService(this));
8559
+ __publicField(this, "projectAttachments", new ProjectAttachmentService(this));
8996
8560
  __publicField(this, "emailVerification", new EmailVerificationService(this));
8997
8561
  __publicField(this, "emailDomains", new EmailDomainsService(this));
8998
8562
  __publicField(this, "licenses", new LicenseService(this));
8999
8563
  __publicField(this, "documents", new DocumentService(this));
9000
8564
  __publicField(this, "teams", new TeamService(this));
9001
- __publicField(this, "documentTeamLinks", new DocumentTeamLinkService(this));
8565
+ __publicField(this, "documentAttachments", new DocumentAttachmentService(this));
9002
8566
  this.API_URL = apiUrl;
9003
8567
  this.store = store;
9004
8568
  }
@@ -9181,405 +8745,151 @@ const FullScreenImagePreview = memo((props) => {
9181
8745
  },
9182
8746
  [name, file]
9183
8747
  );
9184
- return /* @__PURE__ */ jsxs(Fragment, { children: [
9185
- /* @__PURE__ */ jsx(
9186
- "button",
9187
- {
9188
- className: styles$c.FullScreenImageContainer,
9189
- type: "button",
9190
- onClick: () => {
9191
- setShowPreview(false);
9192
- },
9193
- children: /* @__PURE__ */ jsx(
9194
- "img",
9195
- {
9196
- className: styles$c.FullScreenImage,
9197
- src: url,
9198
- alt: name,
9199
- onClick: (e) => {
9200
- e.stopPropagation();
9201
- }
9202
- }
9203
- )
9204
- }
9205
- ),
9206
- /* @__PURE__ */ jsxs(Flex$1, { className: styles$c.TopBarContainer, align: "center", children: [
9207
- /* @__PURE__ */ jsx(
9208
- IconButton,
9209
- {
9210
- className: styles$c.longIconButton,
9211
- variant: "soft",
9212
- "aria-label": "Exit preview",
9213
- onClick: () => {
9214
- setShowPreview(false);
9215
- },
9216
- children: /* @__PURE__ */ jsx(RiIcon, { icon: "RiArrowLeftLine" })
9217
- }
9218
- ),
9219
- /* @__PURE__ */ jsx(Text$1, { className: styles$c.fileName, children: name }),
9220
- /* @__PURE__ */ jsx(
9221
- IconButton,
9222
- {
9223
- className: styles$c.longIconButton,
9224
- variant: "soft",
9225
- "aria-label": `Download ${name}`,
9226
- onClick: handleDownload,
9227
- children: /* @__PURE__ */ jsx(RiIcon, { icon: "RiDownload2Line" })
9228
- }
9229
- )
9230
- ] })
9231
- ] });
9232
- });
9233
- FullScreenImagePreview.displayName = "FullScreenImagePreview";
9234
- const InputWithLabel = (props) => {
9235
- const { label, children, size, severity, inputId, labelId, image, flexProps } = props;
9236
- const [resolvedImage, setResolvedImage] = useState(void 0);
9237
- const [showImagePreview, setShowImagePreview] = useState(false);
9238
- useEffect(() => {
9239
- if (image instanceof Promise) {
9240
- image.then(setResolvedImage).catch(console.error);
9241
- } else {
9242
- setResolvedImage(image);
9243
- }
9244
- }, [image]);
9245
- const resolvedImageURL = resolvedImage ? URL.createObjectURL(resolvedImage) : void 0;
9246
- return /* @__PURE__ */ jsxs(Flex$1, { direction: "column", gap: "2", children: [
9247
- resolvedImage && /* @__PURE__ */ jsxs(Fragment, { children: [
9248
- /* @__PURE__ */ jsx(
9249
- "img",
9250
- {
9251
- className: styles$c.previewImage,
9252
- src: resolvedImageURL,
9253
- alt: resolvedImage.name,
9254
- onClick: () => {
9255
- setShowImagePreview(true);
9256
- }
9257
- }
9258
- ),
9259
- showImagePreview && /* @__PURE__ */ jsx(
9260
- FullScreenImagePreview,
9261
- {
9262
- file: resolvedImage,
9263
- url: resolvedImageURL,
9264
- name: resolvedImage.name,
9265
- setShowPreview: setShowImagePreview
9266
- }
9267
- )
9268
- ] }),
9269
- /* @__PURE__ */ jsx(Flex$1, { direction: "column", gap: "1", asChild: true, ...flexProps, children: /* @__PURE__ */ jsxs("label", { htmlFor: inputId, children: [
9270
- /* @__PURE__ */ jsx(Text$1, { size, severity, id: labelId, children: label }),
9271
- children
9272
- ] }) })
9273
- ] });
9274
- };
9275
- const InputWithHelpText = (props) => {
9276
- const { helpText, children, severity } = props;
9277
- return /* @__PURE__ */ jsxs(Flex$1, { direction: "column", gap: "1", children: [
9278
- children,
9279
- /* @__PURE__ */ jsx(Flex$1, { direction: "column", children: /* @__PURE__ */ jsx(Text$1, { size: "1", severity, className: styles$c.description, children: helpText }) })
9280
- ] });
9281
- };
9282
- const InputWithLabelAndHelpText = (props) => {
9283
- const { children, ...restProps } = props;
9284
- return /* @__PURE__ */ jsx(InputWithHelpText, { ...restProps, children });
9285
- };
9286
- const useFormikInput = (props) => {
9287
- const { id, field, formId: formId2, size, showInputOnly, ...rest } = props;
9288
- const [fieldProps, meta, helpers] = useField(field.getId());
9289
- const { touched } = meta;
9290
- const helpText = meta.error ?? field.description;
9291
- const severity = meta.error ? "danger" : void 0;
9292
- const inputId = id ?? `${formId2}-${field.getId()}-input`;
9293
- const labelId = `${inputId}-label`;
9294
- const label = field.required ? `${field.label} *` : field.label;
9295
- const fieldPropsWithValidation = useMemo(() => {
9296
- const handleChange = (e) => {
9297
- const value = field.getValueFromChangeEvent(e);
9298
- void helpers.setValue(value, false).then();
9299
- if (touched || !field.onlyValidateAfterTouched) {
9300
- helpers.setError(field.getError(value));
9301
- }
9302
- };
9303
- const handleBlur = (e) => {
9304
- void helpers.setTouched(true, false).then();
9305
- helpers.setError(field.getError(field.getValueFromChangeEvent(e)));
9306
- };
9307
- return {
9308
- ...fieldProps,
9309
- onChange: handleChange,
9310
- onBlur: handleBlur
9311
- };
9312
- }, [field, fieldProps, helpers, touched]);
9313
- return [
9314
- {
9315
- helpText,
9316
- size,
9317
- severity,
9318
- inputId,
9319
- labelId,
9320
- label,
9321
- showInputOnly,
9322
- fieldProps: fieldPropsWithValidation,
9323
- helpers,
9324
- field
9325
- },
9326
- { ...rest, "aria-labelledby": labelId }
9327
- ];
9328
- };
9329
- const truthyValues = [true, "true"];
9330
- const BooleanInput = memo((props) => {
9331
- const [{ inputId, labelId, size, severity, showInputOnly, field, fieldProps }, rest] = useFormikInput(props);
9332
- let [{ helpText, label }] = useFormikInput(props);
9333
- helpText = showInputOnly ? null : helpText;
9334
- label = showInputOnly ? "" : label;
9335
- const color = useSeverityColor(severity);
9336
- const value = truthyValues.includes(fieldProps.value);
9337
- return /* @__PURE__ */ jsx(InputWithLabelAndHelpText, { helpText, severity, children: /* @__PURE__ */ jsx(
9338
- InputWithLabel,
9339
- {
9340
- size,
9341
- severity,
9342
- inputId,
9343
- labelId,
9344
- label,
9345
- image: showInputOnly ? void 0 : field.image,
9346
- flexProps: { direction: "row-reverse", justify: "end", align: "center", gap: "2" },
9347
- children: /* @__PURE__ */ jsx(
9348
- Checkbox,
9349
- {
9350
- ...rest,
9351
- ...fieldProps,
9352
- id: inputId,
9353
- color,
9354
- value: value.toString(),
9355
- checked: value,
9356
- onCheckedChange: fieldProps.onChange,
9357
- onChange: void 0,
9358
- onBlur: void 0
9359
- }
9360
- )
9361
- }
9362
- ) });
9363
- });
9364
- BooleanInput.displayName = "BooleanInput";
9365
- var DefaultContext = {
9366
- color: void 0,
9367
- size: void 0,
9368
- className: void 0,
9369
- style: void 0,
9370
- attr: void 0
9371
- };
9372
- var IconContext = React__default.createContext && /* @__PURE__ */ React__default.createContext(DefaultContext);
9373
- var _excluded = ["attr", "size", "title"];
9374
- function _objectWithoutProperties(source, excluded) {
9375
- if (source == null)
9376
- return {};
9377
- var target = _objectWithoutPropertiesLoose(source, excluded);
9378
- var key, i;
9379
- if (Object.getOwnPropertySymbols) {
9380
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
9381
- for (i = 0; i < sourceSymbolKeys.length; i++) {
9382
- key = sourceSymbolKeys[i];
9383
- if (excluded.indexOf(key) >= 0)
9384
- continue;
9385
- if (!Object.prototype.propertyIsEnumerable.call(source, key))
9386
- continue;
9387
- target[key] = source[key];
9388
- }
9389
- }
9390
- return target;
9391
- }
9392
- function _objectWithoutPropertiesLoose(source, excluded) {
9393
- if (source == null)
9394
- return {};
9395
- var target = {};
9396
- for (var key in source) {
9397
- if (Object.prototype.hasOwnProperty.call(source, key)) {
9398
- if (excluded.indexOf(key) >= 0)
9399
- continue;
9400
- target[key] = source[key];
9401
- }
9402
- }
9403
- return target;
9404
- }
9405
- function _extends$1() {
9406
- _extends$1 = Object.assign ? Object.assign.bind() : function(target) {
9407
- for (var i = 1; i < arguments.length; i++) {
9408
- var source = arguments[i];
9409
- for (var key in source) {
9410
- if (Object.prototype.hasOwnProperty.call(source, key)) {
9411
- target[key] = source[key];
9412
- }
9413
- }
9414
- }
9415
- return target;
9416
- };
9417
- return _extends$1.apply(this, arguments);
9418
- }
9419
- function ownKeys(e, r) {
9420
- var t = Object.keys(e);
9421
- if (Object.getOwnPropertySymbols) {
9422
- var o = Object.getOwnPropertySymbols(e);
9423
- r && (o = o.filter(function(r2) {
9424
- return Object.getOwnPropertyDescriptor(e, r2).enumerable;
9425
- })), t.push.apply(t, o);
9426
- }
9427
- return t;
9428
- }
9429
- function _objectSpread(e) {
9430
- for (var r = 1; r < arguments.length; r++) {
9431
- var t = null != arguments[r] ? arguments[r] : {};
9432
- r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
9433
- _defineProperty(e, r2, t[r2]);
9434
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
9435
- Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
9436
- });
9437
- }
9438
- return e;
9439
- }
9440
- function _defineProperty(obj, key, value) {
9441
- key = _toPropertyKey(key);
9442
- if (key in obj) {
9443
- Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
9444
- } else {
9445
- obj[key] = value;
9446
- }
9447
- return obj;
9448
- }
9449
- function _toPropertyKey(t) {
9450
- var i = _toPrimitive(t, "string");
9451
- return "symbol" == typeof i ? i : i + "";
9452
- }
9453
- function _toPrimitive(t, r) {
9454
- if ("object" != typeof t || !t)
9455
- return t;
9456
- var e = t[Symbol.toPrimitive];
9457
- if (void 0 !== e) {
9458
- var i = e.call(t, r || "default");
9459
- if ("object" != typeof i)
9460
- return i;
9461
- throw new TypeError("@@toPrimitive must return a primitive value.");
9462
- }
9463
- return ("string" === r ? String : Number)(t);
9464
- }
9465
- function Tree2Element(tree) {
9466
- return tree && tree.map((node, i) => /* @__PURE__ */ React__default.createElement(node.tag, _objectSpread({
9467
- key: i
9468
- }, node.attr), Tree2Element(node.child)));
9469
- }
9470
- function GenIcon(data) {
9471
- return (props) => /* @__PURE__ */ React__default.createElement(IconBase, _extends$1({
9472
- attr: _objectSpread({}, data.attr)
9473
- }, props), Tree2Element(data.child));
9474
- }
9475
- function IconBase(props) {
9476
- var elem = (conf) => {
9477
- var {
9478
- attr,
9479
- size,
9480
- title: title2
9481
- } = props, svgProps = _objectWithoutProperties(props, _excluded);
9482
- var computedSize = size || conf.size || "1em";
9483
- var className;
9484
- if (conf.className)
9485
- className = conf.className;
9486
- if (props.className)
9487
- className = (className ? className + " " : "") + props.className;
9488
- return /* @__PURE__ */ React__default.createElement("svg", _extends$1({
9489
- stroke: "currentColor",
9490
- fill: "currentColor",
9491
- strokeWidth: "0"
9492
- }, conf.attr, attr, svgProps, {
9493
- className,
9494
- style: _objectSpread(_objectSpread({
9495
- color: props.color || conf.color
9496
- }, conf.style), props.style),
9497
- height: computedSize,
9498
- width: computedSize,
9499
- xmlns: "http://www.w3.org/2000/svg"
9500
- }), title2 && /* @__PURE__ */ React__default.createElement("title", null, title2), props.children);
9501
- };
9502
- return IconContext !== void 0 ? /* @__PURE__ */ React__default.createElement(IconContext.Consumer, null, (conf) => elem(conf)) : elem(DefaultContext);
9503
- }
9504
- function RiArrowDownLine(props) {
9505
- return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M13.0001 16.1716L18.3641 10.8076L19.7783 12.2218L12.0001 20L4.22192 12.2218L5.63614 10.8076L11.0001 16.1716V4H13.0001V16.1716Z" }, "child": [] }] })(props);
9506
- }
9507
- function RiArrowUpLine(props) {
9508
- return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M13.0001 7.82843V20H11.0001V7.82843L5.63614 13.1924L4.22192 11.7782L12.0001 4L19.7783 11.7782L18.3641 13.1924L13.0001 7.82843Z" }, "child": [] }] })(props);
9509
- }
9510
- function RiCalendarLine(props) {
9511
- return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M9 1V3H15V1H17V3H21C21.5523 3 22 3.44772 22 4V20C22 20.5523 21.5523 21 21 21H3C2.44772 21 2 20.5523 2 20V4C2 3.44772 2.44772 3 3 3H7V1H9ZM20 11H4V19H20V11ZM7 5H4V9H20V5H17V7H15V5H9V7H7V5Z" }, "child": [] }] })(props);
9512
- }
9513
- function RiQrCodeLine(props) {
9514
- return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M16 17V16H13V13H16V15H18V17H17V19H15V21H13V18H15V17H16ZM21 21H17V19H19V17H21V21ZM3 3H11V11H3V3ZM5 5V9H9V5H5ZM13 3H21V11H13V3ZM15 5V9H19V5H15ZM3 13H11V21H3V13ZM5 15V19H9V15H5ZM18 13H21V15H18V13ZM6 6H8V8H6V6ZM6 16H8V18H6V16ZM16 6H18V8H16V6Z" }, "child": [] }] })(props);
9515
- }
9516
- function RiFileCopyLine(props) {
9517
- return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M6.9998 6V3C6.9998 2.44772 7.44752 2 7.9998 2H19.9998C20.5521 2 20.9998 2.44772 20.9998 3V17C20.9998 17.5523 20.5521 18 19.9998 18H16.9998V20.9991C16.9998 21.5519 16.5499 22 15.993 22H4.00666C3.45059 22 3 21.5554 3 20.9991L3.0026 7.00087C3.0027 6.44811 3.45264 6 4.00942 6H6.9998ZM5.00242 8L5.00019 20H14.9998V8H5.00242ZM8.9998 6H16.9998V16H18.9998V4H8.9998V6Z" }, "child": [] }] })(props);
9518
- }
9519
- function RiAlignJustify(props) {
9520
- return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M3 4H21V6H3V4ZM3 19H21V21H3V19ZM3 14H21V16H3V14ZM3 9H21V11H3V9Z" }, "child": [] }] })(props);
9521
- }
9522
- function RiHashtag(props) {
9523
- return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M7.78428 14L8.2047 10H4V8H8.41491L8.94043 3H10.9514L10.4259 8H14.4149L14.9404 3H16.9514L16.4259 8H20V10H16.2157L15.7953 14H20V16H15.5851L15.0596 21H13.0486L13.5741 16H9.58509L9.05957 21H7.04855L7.57407 16H4V14H7.78428ZM9.7953 14H13.7843L14.2047 10H10.2157L9.7953 14Z" }, "child": [] }] })(props);
9524
- }
9525
- function RiInputField(props) {
9526
- return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M8 5H11V19H8V21H16V19H13V5H16V3H8V5ZM2 7C1.44772 7 1 7.44772 1 8V16C1 16.5523 1.44772 17 2 17H8V15H3V9H8V7H2ZM16 9H21V15H16V17H22C22.5523 17 23 16.5523 23 16V8C23 7.44772 22.5523 7 22 7H16V9Z" }, "child": [] }] })(props);
9527
- }
9528
- function RiListCheck(props) {
9529
- return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M8 4H21V6H8V4ZM3 3.5H6V6.5H3V3.5ZM3 10.5H6V13.5H3V10.5ZM3 17.5H6V20.5H3V17.5ZM8 11H21V13H8V11ZM8 18H21V20H8V18Z" }, "child": [] }] })(props);
9530
- }
9531
- function RiImageLine(props) {
9532
- return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M2.9918 21C2.44405 21 2 20.5551 2 20.0066V3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082C21.556 3 22 3.44495 22 3.9934V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918ZM20 15V5H4V19L14 9L20 15ZM20 17.8284L14 11.8284L6.82843 19H20V17.8284ZM8 11C6.89543 11 6 10.1046 6 9C6 7.89543 6.89543 7 8 7C9.10457 7 10 7.89543 10 9C10 10.1046 9.10457 11 8 11Z" }, "child": [] }] })(props);
9533
- }
9534
- function RiCheckboxCircleLine(props) {
9535
- return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM11.0026 16L6.75999 11.7574L8.17421 10.3431L11.0026 13.1716L16.6595 7.51472L18.0737 8.92893L11.0026 16Z" }, "child": [] }] })(props);
9536
- }
9537
- function RiCheckboxLine(props) {
9538
- return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M4 3H20C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3ZM5 5V19H19V5H5ZM11.0026 16L6.75999 11.7574L8.17421 10.3431L11.0026 13.1716L16.6595 7.51472L18.0737 8.92893L11.0026 16Z" }, "child": [] }] })(props);
9539
- }
9540
- function RiDeleteBin2Line(props) {
9541
- return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M17 6H22V8H20V21C20 21.5523 19.5523 22 19 22H5C4.44772 22 4 21.5523 4 21V8H2V6H7V3C7 2.44772 7.44772 2 8 2H16C16.5523 2 17 2.44772 17 3V6ZM18 8H6V20H18V8ZM13.4142 13.9997L15.182 15.7675L13.7678 17.1817L12 15.4139L10.2322 17.1817L8.81802 15.7675L10.5858 13.9997L8.81802 12.232L10.2322 10.8178L12 12.5855L13.7678 10.8178L15.182 12.232L13.4142 13.9997ZM9 4V6H15V4H9Z" }, "child": [] }] })(props);
9542
- }
9543
- function RiMenuFoldLine(props) {
9544
- return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M21 17.9995V19.9995H3V17.9995H21ZM6.59619 3.90332L8.01041 5.31753L4.82843 8.49951L8.01041 11.6815L6.59619 13.0957L2 8.49951L6.59619 3.90332ZM21 10.9995V12.9995H12V10.9995H21ZM21 3.99951V5.99951H12V3.99951H21Z" }, "child": [] }] })(props);
9545
- }
9546
- function RiUpload2Line(props) {
9547
- return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M4 19H20V12H22V20C22 20.5523 21.5523 21 21 21H3C2.44772 21 2 20.5523 2 20V12H4V19ZM13 9V16H11V9H6L12 3L18 9H13Z" }, "child": [] }] })(props);
9548
- }
9549
- const emptyBooleanField = {
9550
- ...emptyBaseField,
9551
- type: "boolean"
8748
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
8749
+ /* @__PURE__ */ jsx(
8750
+ "button",
8751
+ {
8752
+ className: styles$c.FullScreenImageContainer,
8753
+ type: "button",
8754
+ onClick: () => {
8755
+ setShowPreview(false);
8756
+ },
8757
+ children: /* @__PURE__ */ jsx(
8758
+ "img",
8759
+ {
8760
+ className: styles$c.FullScreenImage,
8761
+ src: url,
8762
+ alt: name,
8763
+ onClick: (e) => {
8764
+ e.stopPropagation();
8765
+ }
8766
+ }
8767
+ )
8768
+ }
8769
+ ),
8770
+ /* @__PURE__ */ jsxs(Flex$1, { className: styles$c.TopBarContainer, align: "center", children: [
8771
+ /* @__PURE__ */ jsx(
8772
+ IconButton,
8773
+ {
8774
+ className: styles$c.longIconButton,
8775
+ variant: "soft",
8776
+ "aria-label": "Exit preview",
8777
+ onClick: () => {
8778
+ setShowPreview(false);
8779
+ },
8780
+ children: /* @__PURE__ */ jsx(RiIcon, { icon: "RiArrowLeftLine" })
8781
+ }
8782
+ ),
8783
+ /* @__PURE__ */ jsx(Text$1, { className: styles$c.fileName, children: name }),
8784
+ /* @__PURE__ */ jsx(
8785
+ IconButton,
8786
+ {
8787
+ className: styles$c.longIconButton,
8788
+ variant: "soft",
8789
+ "aria-label": `Download ${name}`,
8790
+ onClick: handleDownload,
8791
+ children: /* @__PURE__ */ jsx(RiIcon, { icon: "RiDownload2Line" })
8792
+ }
8793
+ )
8794
+ ] })
8795
+ ] });
8796
+ });
8797
+ FullScreenImagePreview.displayName = "FullScreenImagePreview";
8798
+ const InputWithLabel = (props) => {
8799
+ const { label, children, size, severity, inputId, labelId, image, flexProps } = props;
8800
+ const [resolvedImage, setResolvedImage] = useState(void 0);
8801
+ const [showImagePreview, setShowImagePreview] = useState(false);
8802
+ useEffect(() => {
8803
+ if (image instanceof Promise) {
8804
+ image.then(setResolvedImage).catch(console.error);
8805
+ } else {
8806
+ setResolvedImage(image);
8807
+ }
8808
+ }, [image]);
8809
+ const resolvedImageURL = resolvedImage ? URL.createObjectURL(resolvedImage) : void 0;
8810
+ return /* @__PURE__ */ jsxs(Flex$1, { direction: "column", gap: "2", children: [
8811
+ resolvedImage && /* @__PURE__ */ jsxs(Fragment, { children: [
8812
+ /* @__PURE__ */ jsx(
8813
+ "img",
8814
+ {
8815
+ className: styles$c.previewImage,
8816
+ src: resolvedImageURL,
8817
+ alt: resolvedImage.name,
8818
+ onClick: () => {
8819
+ setShowImagePreview(true);
8820
+ }
8821
+ }
8822
+ ),
8823
+ showImagePreview && /* @__PURE__ */ jsx(
8824
+ FullScreenImagePreview,
8825
+ {
8826
+ file: resolvedImage,
8827
+ url: resolvedImageURL,
8828
+ name: resolvedImage.name,
8829
+ setShowPreview: setShowImagePreview
8830
+ }
8831
+ )
8832
+ ] }),
8833
+ /* @__PURE__ */ jsx(Flex$1, { direction: "column", gap: "1", asChild: true, ...flexProps, children: /* @__PURE__ */ jsxs("label", { htmlFor: inputId, children: [
8834
+ /* @__PURE__ */ jsx(Text$1, { size, severity, id: labelId, children: label }),
8835
+ children
8836
+ ] }) })
8837
+ ] });
9552
8838
  };
9553
- const _BooleanField = class _BooleanField extends BaseField {
9554
- constructor(options) {
9555
- super({ ...options, type: "boolean" });
9556
- __publicField(this, "onlyValidateAfterTouched", false);
9557
- }
9558
- // if a BooleanField is required, `false` is considered blank
9559
- isBlank(value) {
9560
- return this.required && !value;
9561
- }
9562
- getValueFromChangeEvent(event) {
9563
- if (typeof event === "boolean")
9564
- return event;
9565
- return event.target.checked;
9566
- }
9567
- serialize() {
9568
- return super._serialize();
9569
- }
9570
- static deserialize(data) {
9571
- if (data.type !== "boolean")
9572
- throw new Error("Type mismatch.");
9573
- return new _BooleanField(data);
9574
- }
9575
- getInput(props) {
9576
- return /* @__PURE__ */ jsx(BooleanInput, { ...props, field: this });
9577
- }
8839
+ const InputWithHelpText = (props) => {
8840
+ const { helpText, children, severity } = props;
8841
+ return /* @__PURE__ */ jsxs(Flex$1, { direction: "column", gap: "1", children: [
8842
+ children,
8843
+ /* @__PURE__ */ jsx(Flex$1, { direction: "column", children: /* @__PURE__ */ jsx(Text$1, { size: "1", severity, className: styles$c.description, children: helpText }) })
8844
+ ] });
8845
+ };
8846
+ const InputWithLabelAndHelpText = (props) => {
8847
+ const { children, ...restProps } = props;
8848
+ return /* @__PURE__ */ jsx(InputWithHelpText, { ...restProps, children });
8849
+ };
8850
+ const useFormikInput = (props) => {
8851
+ const { id, field, formId: formId2, size, showInputOnly, ...rest } = props;
8852
+ const [fieldProps, meta, helpers] = useField(field.getId());
8853
+ const { touched } = meta;
8854
+ const helpText = meta.error ?? field.description;
8855
+ const severity = meta.error ? "danger" : void 0;
8856
+ const inputId = id ?? `${formId2}-${field.getId()}-input`;
8857
+ const labelId = `${inputId}-label`;
8858
+ const label = field.required ? `${field.label} *` : field.label;
8859
+ const fieldPropsWithValidation = useMemo(() => {
8860
+ const handleChange = (e) => {
8861
+ const value = field.getValueFromChangeEvent(e);
8862
+ void helpers.setValue(value, false).then();
8863
+ if (touched || !field.onlyValidateAfterTouched) {
8864
+ helpers.setError(field.getError(value));
8865
+ }
8866
+ };
8867
+ const handleBlur = (e) => {
8868
+ void helpers.setTouched(true, false).then();
8869
+ helpers.setError(field.getError(field.getValueFromChangeEvent(e)));
8870
+ };
8871
+ return {
8872
+ ...fieldProps,
8873
+ onChange: handleChange,
8874
+ onBlur: handleBlur
8875
+ };
8876
+ }, [field, fieldProps, helpers, touched]);
8877
+ return [
8878
+ {
8879
+ helpText,
8880
+ size,
8881
+ severity,
8882
+ inputId,
8883
+ labelId,
8884
+ label,
8885
+ showInputOnly,
8886
+ fieldProps: fieldPropsWithValidation,
8887
+ helpers,
8888
+ field
8889
+ },
8890
+ { ...rest, "aria-labelledby": labelId }
8891
+ ];
9578
8892
  };
9579
- __publicField(_BooleanField, "fieldTypeName", "Checkbox");
9580
- __publicField(_BooleanField, "fieldTypeDescription", "Perfect for both optional and required yes/no questions.");
9581
- __publicField(_BooleanField, "Icon", RiCheckboxCircleLine);
9582
- let BooleanField = _BooleanField;
9583
8893
  function getDefaultExportFromCjs(x) {
9584
8894
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
9585
8895
  }
@@ -9632,8 +8942,8 @@ var classnames = { exports: {} };
9632
8942
  })(classnames);
9633
8943
  var classnamesExports = classnames.exports;
9634
8944
  const classNames = /* @__PURE__ */ getDefaultExportFromCjs(classnamesExports);
9635
- function _extends() {
9636
- _extends = Object.assign ? Object.assign.bind() : function(target) {
8945
+ function _extends$1() {
8946
+ _extends$1 = Object.assign ? Object.assign.bind() : function(target) {
9637
8947
  for (var i = 1; i < arguments.length; i++) {
9638
8948
  var source = arguments[i];
9639
8949
  for (var key in source) {
@@ -9644,7 +8954,7 @@ function _extends() {
9644
8954
  }
9645
8955
  return target;
9646
8956
  };
9647
- return _extends.apply(this, arguments);
8957
+ return _extends$1.apply(this, arguments);
9648
8958
  }
9649
8959
  function $e42e1063c40fb3ef$export$b9ecd428b558ff10(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
9650
8960
  return function handleEvent(event) {
@@ -9775,11 +9085,11 @@ const $5e63c961fc1ce211$export$8c6ed5c666ac1360 = /* @__PURE__ */ forwardRef((pr
9775
9085
  } else
9776
9086
  return child;
9777
9087
  });
9778
- return /* @__PURE__ */ createElement($5e63c961fc1ce211$var$SlotClone, _extends({}, slotProps, {
9088
+ return /* @__PURE__ */ createElement($5e63c961fc1ce211$var$SlotClone, _extends$1({}, slotProps, {
9779
9089
  ref: forwardedRef
9780
9090
  }), /* @__PURE__ */ isValidElement(newElement) ? /* @__PURE__ */ cloneElement(newElement, void 0, newChildren) : null);
9781
9091
  }
9782
- return /* @__PURE__ */ createElement($5e63c961fc1ce211$var$SlotClone, _extends({}, slotProps, {
9092
+ return /* @__PURE__ */ createElement($5e63c961fc1ce211$var$SlotClone, _extends$1({}, slotProps, {
9783
9093
  ref: forwardedRef
9784
9094
  }), children);
9785
9095
  });
@@ -9857,7 +9167,7 @@ const $8927f6f2acc4f386$export$250ffa63cdc0d034 = $8927f6f2acc4f386$var$NODES.re
9857
9167
  useEffect(() => {
9858
9168
  window[Symbol.for("radix-ui")] = true;
9859
9169
  }, []);
9860
- return /* @__PURE__ */ createElement(Comp, _extends({}, primitiveProps, {
9170
+ return /* @__PURE__ */ createElement(Comp, _extends$1({}, primitiveProps, {
9861
9171
  ref: forwardedRef
9862
9172
  }));
9863
9173
  });
@@ -10416,9 +9726,9 @@ const Inset = React.forwardRef((props, forwardedRef) => {
10416
9726
  return React.createElement("div", { ...insetProps, ref: forwardedRef, className: classNames("rt-Inset", className, withBreakpoints(side, "rt-r-side"), withBreakpoints(clip, "rt-r-clip"), withBreakpoints(p, "rt-r-p"), withBreakpoints(px, "rt-r-px"), withBreakpoints(py, "rt-r-py"), withBreakpoints(pt, "rt-r-pt"), withBreakpoints(pr, "rt-r-pr"), withBreakpoints(pb, "rt-r-pb"), withBreakpoints(pl, "rt-r-pl"), withMarginProps(marginProps)) });
10417
9727
  });
10418
9728
  Inset.displayName = "Inset";
10419
- const sizes$8 = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
9729
+ const sizes$9 = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
10420
9730
  const headingPropDefs = {
10421
- size: { type: "enum", values: sizes$8, default: "6", responsive: true },
9731
+ size: { type: "enum", values: sizes$9, default: "6", responsive: true },
10422
9732
  weight: { ...weightProp, default: "bold" },
10423
9733
  align: alignProp,
10424
9734
  trim: trimProp,
@@ -10431,9 +9741,9 @@ const Heading = React.forwardRef((props, forwardedRef) => {
10431
9741
  return React.createElement($5e63c961fc1ce211$export$8c6ed5c666ac1360, { "data-accent-color": color, ...headingProps, ref: forwardedRef, className: classNames("rt-Heading", className, withBreakpoints(size, "rt-r-size"), withBreakpoints(weight, "rt-r-weight"), withBreakpoints(align, "rt-r-ta"), withBreakpoints(trim, "rt-r-lt"), { "rt-high-contrast": highContrast }, withMarginProps(marginProps)) }, asChild ? children : React.createElement(Tag, null, children));
10432
9742
  });
10433
9743
  Heading.displayName = "Heading";
10434
- const sizes$7 = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
9744
+ const sizes$8 = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
10435
9745
  const textPropDefs = {
10436
- size: { type: "enum", values: sizes$7, default: void 0, responsive: true },
9746
+ size: { type: "enum", values: sizes$8, default: void 0, responsive: true },
10437
9747
  weight: weightProp,
10438
9748
  align: alignProp,
10439
9749
  trim: trimProp,
@@ -10446,11 +9756,11 @@ const Text = React.forwardRef((props, forwardedRef) => {
10446
9756
  return React.createElement($5e63c961fc1ce211$export$8c6ed5c666ac1360, { "data-accent-color": color, ...textProps, ref: forwardedRef, className: classNames("rt-Text", className, withBreakpoints(size, "rt-r-size"), withBreakpoints(weight, "rt-r-weight"), withBreakpoints(align, "rt-r-ta"), withBreakpoints(trim, "rt-r-lt"), { "rt-high-contrast": highContrast }, withMarginProps(marginProps)) }, asChild ? children : React.createElement(Tag, null, children));
10447
9757
  });
10448
9758
  Text.displayName = "Text";
10449
- const sizes$6 = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
10450
- const variants$4 = ["solid", "soft", "outline", "ghost"];
9759
+ const sizes$7 = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
9760
+ const variants$5 = ["solid", "soft", "outline", "ghost"];
10451
9761
  const codePropDefs = {
10452
- size: { type: "enum", values: sizes$6, default: void 0, responsive: true },
10453
- variant: { type: "enum", values: variants$4, default: "soft" },
9762
+ size: { type: "enum", values: sizes$7, default: void 0, responsive: true },
9763
+ variant: { type: "enum", values: variants$5, default: "soft" },
10454
9764
  weight: weightProp,
10455
9765
  color: colorProp,
10456
9766
  highContrast: highContrastProp
@@ -10480,6 +9790,202 @@ function $010c2913dbd2fe3d$export$5cae361ad82dce8b(value) {
10480
9790
  value
10481
9791
  ]);
10482
9792
  }
9793
+ const $e698a72e93240346$var$CHECKBOX_NAME = "Checkbox";
9794
+ const [$e698a72e93240346$var$createCheckboxContext, $e698a72e93240346$export$b566c4ff5488ea01] = $c512c27ab02ef895$export$50c7b4e9d9f19c1($e698a72e93240346$var$CHECKBOX_NAME);
9795
+ const [$e698a72e93240346$var$CheckboxProvider, $e698a72e93240346$var$useCheckboxContext] = $e698a72e93240346$var$createCheckboxContext($e698a72e93240346$var$CHECKBOX_NAME);
9796
+ const $e698a72e93240346$export$48513f6b9f8ce62d = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
9797
+ const { __scopeCheckbox, name, checked: checkedProp, defaultChecked, required, disabled, value = "on", onCheckedChange, ...checkboxProps } = props;
9798
+ const [button, setButton] = useState(null);
9799
+ const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(
9800
+ forwardedRef,
9801
+ (node) => setButton(node)
9802
+ );
9803
+ const hasConsumerStoppedPropagationRef = useRef(false);
9804
+ const isFormControl = button ? Boolean(button.closest("form")) : true;
9805
+ const [checked = false, setChecked] = $71cd76cc60e0454e$export$6f32135080cb4c3({
9806
+ prop: checkedProp,
9807
+ defaultProp: defaultChecked,
9808
+ onChange: onCheckedChange
9809
+ });
9810
+ const initialCheckedStateRef = useRef(checked);
9811
+ useEffect(() => {
9812
+ const form = button === null || button === void 0 ? void 0 : button.form;
9813
+ if (form) {
9814
+ const reset = () => setChecked(initialCheckedStateRef.current);
9815
+ form.addEventListener("reset", reset);
9816
+ return () => form.removeEventListener("reset", reset);
9817
+ }
9818
+ }, [
9819
+ button,
9820
+ setChecked
9821
+ ]);
9822
+ return /* @__PURE__ */ createElement($e698a72e93240346$var$CheckboxProvider, {
9823
+ scope: __scopeCheckbox,
9824
+ state: checked,
9825
+ disabled
9826
+ }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.button, _extends$1({
9827
+ type: "button",
9828
+ role: "checkbox",
9829
+ "aria-checked": $e698a72e93240346$var$isIndeterminate(checked) ? "mixed" : checked,
9830
+ "aria-required": required,
9831
+ "data-state": $e698a72e93240346$var$getState(checked),
9832
+ "data-disabled": disabled ? "" : void 0,
9833
+ disabled,
9834
+ value
9835
+ }, checkboxProps, {
9836
+ ref: composedRefs,
9837
+ onKeyDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onKeyDown, (event) => {
9838
+ if (event.key === "Enter")
9839
+ event.preventDefault();
9840
+ }),
9841
+ onClick: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onClick, (event) => {
9842
+ setChecked(
9843
+ (prevChecked) => $e698a72e93240346$var$isIndeterminate(prevChecked) ? true : !prevChecked
9844
+ );
9845
+ if (isFormControl) {
9846
+ hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
9847
+ if (!hasConsumerStoppedPropagationRef.current)
9848
+ event.stopPropagation();
9849
+ }
9850
+ })
9851
+ })), isFormControl && /* @__PURE__ */ createElement($e698a72e93240346$var$BubbleInput, {
9852
+ control: button,
9853
+ bubbles: !hasConsumerStoppedPropagationRef.current,
9854
+ name,
9855
+ value,
9856
+ checked,
9857
+ required,
9858
+ disabled,
9859
+ style: {
9860
+ transform: "translateX(-100%)"
9861
+ }
9862
+ }));
9863
+ });
9864
+ const $e698a72e93240346$var$INDICATOR_NAME = "CheckboxIndicator";
9865
+ const $e698a72e93240346$export$59aad738f51d1c05 = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
9866
+ const { __scopeCheckbox, forceMount, ...indicatorProps } = props;
9867
+ const context = $e698a72e93240346$var$useCheckboxContext($e698a72e93240346$var$INDICATOR_NAME, __scopeCheckbox);
9868
+ return /* @__PURE__ */ createElement($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
9869
+ present: forceMount || $e698a72e93240346$var$isIndeterminate(context.state) || context.state === true
9870
+ }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends$1({
9871
+ "data-state": $e698a72e93240346$var$getState(context.state),
9872
+ "data-disabled": context.disabled ? "" : void 0
9873
+ }, indicatorProps, {
9874
+ ref: forwardedRef,
9875
+ style: {
9876
+ pointerEvents: "none",
9877
+ ...props.style
9878
+ }
9879
+ })));
9880
+ });
9881
+ const $e698a72e93240346$var$BubbleInput = (props) => {
9882
+ const { control, checked, bubbles = true, ...inputProps } = props;
9883
+ const ref = useRef(null);
9884
+ const prevChecked = $010c2913dbd2fe3d$export$5cae361ad82dce8b(checked);
9885
+ const controlSize = $db6c3485150b8e66$export$1ab7ae714698c4b8(control);
9886
+ useEffect(() => {
9887
+ const input = ref.current;
9888
+ const inputProto = window.HTMLInputElement.prototype;
9889
+ const descriptor = Object.getOwnPropertyDescriptor(inputProto, "checked");
9890
+ const setChecked = descriptor.set;
9891
+ if (prevChecked !== checked && setChecked) {
9892
+ const event = new Event("click", {
9893
+ bubbles
9894
+ });
9895
+ input.indeterminate = $e698a72e93240346$var$isIndeterminate(checked);
9896
+ setChecked.call(input, $e698a72e93240346$var$isIndeterminate(checked) ? false : checked);
9897
+ input.dispatchEvent(event);
9898
+ }
9899
+ }, [
9900
+ prevChecked,
9901
+ checked,
9902
+ bubbles
9903
+ ]);
9904
+ return /* @__PURE__ */ createElement("input", _extends$1({
9905
+ type: "checkbox",
9906
+ "aria-hidden": true,
9907
+ defaultChecked: $e698a72e93240346$var$isIndeterminate(checked) ? false : checked
9908
+ }, inputProps, {
9909
+ tabIndex: -1,
9910
+ ref,
9911
+ style: {
9912
+ ...props.style,
9913
+ ...controlSize,
9914
+ position: "absolute",
9915
+ pointerEvents: "none",
9916
+ opacity: 0,
9917
+ margin: 0
9918
+ }
9919
+ }));
9920
+ };
9921
+ function $e698a72e93240346$var$isIndeterminate(checked) {
9922
+ return checked === "indeterminate";
9923
+ }
9924
+ function $e698a72e93240346$var$getState(checked) {
9925
+ return $e698a72e93240346$var$isIndeterminate(checked) ? "indeterminate" : checked ? "checked" : "unchecked";
9926
+ }
9927
+ const $e698a72e93240346$export$be92b6f5f03c0fe9 = $e698a72e93240346$export$48513f6b9f8ce62d;
9928
+ const $e698a72e93240346$export$adb584737d712b70 = $e698a72e93240346$export$59aad738f51d1c05;
9929
+ const sizes$6 = ["1", "2", "3"];
9930
+ const variants$4 = ["classic", "surface", "soft"];
9931
+ const checkboxPropDefs = {
9932
+ size: { type: "enum", values: sizes$6, default: "2", responsive: true },
9933
+ variant: { type: "enum", values: variants$4, default: "surface" },
9934
+ color: colorProp,
9935
+ highContrast: highContrastProp
9936
+ };
9937
+ const ThickCheckIcon = React.forwardRef(({ color = "currentColor", ...props }, forwardedRef) => {
9938
+ return React.createElement(
9939
+ "svg",
9940
+ { width: "9", height: "9", viewBox: "0 0 9 9", fill: color, xmlns: "http://www.w3.org/2000/svg", ...props, ref: forwardedRef },
9941
+ React.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M8.53547 0.62293C8.88226 0.849446 8.97976 1.3142 8.75325 1.66099L4.5083 8.1599C4.38833 8.34356 4.19397 8.4655 3.9764 8.49358C3.75883 8.52167 3.53987 8.45309 3.3772 8.30591L0.616113 5.80777C0.308959 5.52987 0.285246 5.05559 0.563148 4.74844C0.84105 4.44128 1.31533 4.41757 1.62249 4.69547L3.73256 6.60459L7.49741 0.840706C7.72393 0.493916 8.18868 0.396414 8.53547 0.62293Z" })
9942
+ );
9943
+ });
9944
+ ThickCheckIcon.displayName = "ThickCheckIcon";
9945
+ const ChevronDownIcon = React.forwardRef(({ color = "currentColor", ...props }, forwardedRef) => {
9946
+ return React.createElement(
9947
+ "svg",
9948
+ { width: "9", height: "9", viewBox: "0 0 9 9", fill: color, xmlns: "http://www.w3.org/2000/svg", ...props, ref: forwardedRef },
9949
+ React.createElement("path", { d: "M0.135232 3.15803C0.324102 2.95657 0.640521 2.94637 0.841971 3.13523L4.5 6.56464L8.158 3.13523C8.3595 2.94637 8.6759 2.95657 8.8648 3.15803C9.0536 3.35949 9.0434 3.67591 8.842 3.86477L4.84197 7.6148C4.64964 7.7951 4.35036 7.7951 4.15803 7.6148L0.158031 3.86477C-0.0434285 3.67591 -0.0536285 3.35949 0.135232 3.15803Z" })
9950
+ );
9951
+ });
9952
+ ChevronDownIcon.displayName = "ChevronDownIcon";
9953
+ const ThickChevronRightIcon = React.forwardRef(({ color = "currentColor", ...props }, forwardedRef) => {
9954
+ return React.createElement(
9955
+ "svg",
9956
+ { width: "9", height: "9", viewBox: "0 0 9 9", fill: color, xmlns: "http://www.w3.org/2000/svg", ...props, ref: forwardedRef },
9957
+ React.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M3.23826 0.201711C3.54108 -0.0809141 4.01567 -0.0645489 4.29829 0.238264L7.79829 3.98826C8.06724 4.27642 8.06724 4.72359 7.79829 5.01174L4.29829 8.76174C4.01567 9.06455 3.54108 9.08092 3.23826 8.79829C2.93545 8.51567 2.91909 8.04108 3.20171 7.73826L6.22409 4.5L3.20171 1.26174C2.91909 0.958928 2.93545 0.484337 3.23826 0.201711Z" })
9958
+ );
9959
+ });
9960
+ ThickChevronRightIcon.displayName = "ThickChevronRightIcon";
9961
+ const InfoCircledIcon = React.forwardRef(({ color = "currentColor", ...props }, forwardedRef) => {
9962
+ return React.createElement(
9963
+ "svg",
9964
+ { width: "15", height: "15", viewBox: "0 0 15 15", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, ref: forwardedRef },
9965
+ React.createElement("path", { d: "M7.49991 0.876892C3.84222 0.876892 0.877075 3.84204 0.877075 7.49972C0.877075 11.1574 3.84222 14.1226 7.49991 14.1226C11.1576 14.1226 14.1227 11.1574 14.1227 7.49972C14.1227 3.84204 11.1576 0.876892 7.49991 0.876892ZM1.82707 7.49972C1.82707 4.36671 4.36689 1.82689 7.49991 1.82689C10.6329 1.82689 13.1727 4.36671 13.1727 7.49972C13.1727 10.6327 10.6329 13.1726 7.49991 13.1726C4.36689 13.1726 1.82707 10.6327 1.82707 7.49972ZM8.24992 4.49999C8.24992 4.9142 7.91413 5.24999 7.49992 5.24999C7.08571 5.24999 6.74992 4.9142 6.74992 4.49999C6.74992 4.08577 7.08571 3.74999 7.49992 3.74999C7.91413 3.74999 8.24992 4.08577 8.24992 4.49999ZM6.00003 5.99999H6.50003H7.50003C7.77618 5.99999 8.00003 6.22384 8.00003 6.49999V9.99999H8.50003H9.00003V11H8.50003H7.50003H6.50003H6.00003V9.99999H6.50003H7.00003V6.99999H6.50003H6.00003V5.99999Z", fill: color, fillRule: "evenodd", clipRule: "evenodd" })
9966
+ );
9967
+ });
9968
+ InfoCircledIcon.displayName = "InfoCircledIcon";
9969
+ const Checkbox = React.forwardRef((props, forwardedRef) => {
9970
+ const { rest: marginRest, ...marginProps } = extractMarginProps(props);
9971
+ const { className, style, size = checkboxPropDefs.size.default, variant = checkboxPropDefs.variant.default, color = checkboxPropDefs.color.default, highContrast = checkboxPropDefs.highContrast.default, ...checkboxProps } = marginRest;
9972
+ return React.createElement(
9973
+ "span",
9974
+ { className: classNames("rt-CheckboxRoot", className, withBreakpoints(size, "rt-r-size"), withMarginProps(marginProps)), style },
9975
+ React.createElement(
9976
+ $e698a72e93240346$export$be92b6f5f03c0fe9,
9977
+ { "data-accent-color": color, ...checkboxProps, ref: forwardedRef, className: classNames("rt-reset", "rt-CheckboxButton", `rt-variant-${variant}`, {
9978
+ "rt-high-contrast": highContrast
9979
+ }) },
9980
+ React.createElement(
9981
+ $e698a72e93240346$export$adb584737d712b70,
9982
+ { className: "rt-CheckboxIndicator" },
9983
+ React.createElement(ThickCheckIcon, { className: "rt-CheckboxIndicatorIcon" })
9984
+ )
9985
+ )
9986
+ );
9987
+ });
9988
+ Checkbox.displayName = "Checkbox";
10483
9989
  function $e02a7d9cb1dc128c$export$c74125a8e3af6bb2(name) {
10484
9990
  const PROVIDER_NAME = name + "CollectionProvider";
10485
9991
  const [createCollectionContext, createCollectionScope] = $c512c27ab02ef895$export$50c7b4e9d9f19c1(PROVIDER_NAME);
@@ -10571,7 +10077,7 @@ const $d7bdfb9eb0fdf311$export$8699f7c8af148338 = /* @__PURE__ */ forwardRef((pr
10571
10077
  scope: props.__scopeRovingFocusGroup
10572
10078
  }, /* @__PURE__ */ createElement($d7bdfb9eb0fdf311$var$Collection.Slot, {
10573
10079
  scope: props.__scopeRovingFocusGroup
10574
- }, /* @__PURE__ */ createElement($d7bdfb9eb0fdf311$var$RovingFocusGroupImpl, _extends({}, props, {
10080
+ }, /* @__PURE__ */ createElement($d7bdfb9eb0fdf311$var$RovingFocusGroupImpl, _extends$1({}, props, {
10575
10081
  ref: forwardedRef
10576
10082
  }))));
10577
10083
  });
@@ -10627,7 +10133,7 @@ const $d7bdfb9eb0fdf311$var$RovingFocusGroupImpl = /* @__PURE__ */ forwardRef((p
10627
10133
  ),
10628
10134
  []
10629
10135
  )
10630
- }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
10136
+ }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends$1({
10631
10137
  tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,
10632
10138
  "data-orientation": orientation
10633
10139
  }, groupProps, {
@@ -10697,7 +10203,7 @@ const $d7bdfb9eb0fdf311$export$ab9df7c53fe8454 = /* @__PURE__ */ forwardRef((pro
10697
10203
  id,
10698
10204
  focusable,
10699
10205
  active
10700
- }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends({
10206
+ }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends$1({
10701
10207
  tabIndex: isCurrentTabStop ? 0 : -1,
10702
10208
  "data-orientation": context.orientation
10703
10209
  }, itemProps, {
@@ -10837,7 +10343,7 @@ const $57acba87d6e25586$export$ccf8d8d7bbf3c2cc = /* @__PURE__ */ forwardRef((pr
10837
10343
  onScrollbarYEnabledChange: setScrollbarYEnabled,
10838
10344
  onCornerWidthChange: setCornerWidth,
10839
10345
  onCornerHeightChange: setCornerHeight
10840
- }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
10346
+ }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends$1({
10841
10347
  dir: direction
10842
10348
  }, scrollAreaProps, {
10843
10349
  ref: composedRefs,
@@ -10860,7 +10366,7 @@ const $57acba87d6e25586$export$a21cbf9f11fca853 = /* @__PURE__ */ forwardRef((pr
10860
10366
  dangerouslySetInnerHTML: {
10861
10367
  __html: `[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}`
10862
10368
  }
10863
- }), /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
10369
+ }), /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends$1({
10864
10370
  "data-radix-scroll-area-viewport": ""
10865
10371
  }, viewportProps, {
10866
10372
  ref: composedRefs,
@@ -10904,16 +10410,16 @@ const $57acba87d6e25586$export$2fabd85d0eba3c57 = /* @__PURE__ */ forwardRef((pr
10904
10410
  onScrollbarXEnabledChange,
10905
10411
  onScrollbarYEnabledChange
10906
10412
  ]);
10907
- return context.type === "hover" ? /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarHover, _extends({}, scrollbarProps, {
10413
+ return context.type === "hover" ? /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarHover, _extends$1({}, scrollbarProps, {
10908
10414
  ref: forwardedRef,
10909
10415
  forceMount
10910
- })) : context.type === "scroll" ? /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarScroll, _extends({}, scrollbarProps, {
10416
+ })) : context.type === "scroll" ? /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarScroll, _extends$1({}, scrollbarProps, {
10911
10417
  ref: forwardedRef,
10912
10418
  forceMount
10913
- })) : context.type === "auto" ? /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarAuto, _extends({}, scrollbarProps, {
10419
+ })) : context.type === "auto" ? /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarAuto, _extends$1({}, scrollbarProps, {
10914
10420
  ref: forwardedRef,
10915
10421
  forceMount
10916
- })) : context.type === "always" ? /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarVisible, _extends({}, scrollbarProps, {
10422
+ })) : context.type === "always" ? /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarVisible, _extends$1({}, scrollbarProps, {
10917
10423
  ref: forwardedRef
10918
10424
  })) : null;
10919
10425
  });
@@ -10949,7 +10455,7 @@ const $57acba87d6e25586$var$ScrollAreaScrollbarHover = /* @__PURE__ */ forwardRe
10949
10455
  ]);
10950
10456
  return /* @__PURE__ */ createElement($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
10951
10457
  present: forceMount || visible
10952
- }, /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarAuto, _extends({
10458
+ }, /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarAuto, _extends$1({
10953
10459
  "data-state": visible ? "visible" : "hidden"
10954
10460
  }, scrollbarProps, {
10955
10461
  ref: forwardedRef
@@ -11019,7 +10525,7 @@ const $57acba87d6e25586$var$ScrollAreaScrollbarScroll = /* @__PURE__ */ forwardR
11019
10525
  ]);
11020
10526
  return /* @__PURE__ */ createElement($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
11021
10527
  present: forceMount || state !== "hidden"
11022
- }, /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarVisible, _extends({
10528
+ }, /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarVisible, _extends$1({
11023
10529
  "data-state": state === "hidden" ? "hidden" : "visible"
11024
10530
  }, scrollbarProps, {
11025
10531
  ref: forwardedRef,
@@ -11049,7 +10555,7 @@ const $57acba87d6e25586$var$ScrollAreaScrollbarAuto = /* @__PURE__ */ forwardRef
11049
10555
  $57acba87d6e25586$var$useResizeObserver(context.content, handleResize);
11050
10556
  return /* @__PURE__ */ createElement($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
11051
10557
  present: forceMount || visible
11052
- }, /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarVisible, _extends({
10558
+ }, /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarVisible, _extends$1({
11053
10559
  "data-state": visible ? "visible" : "hidden"
11054
10560
  }, scrollbarProps, {
11055
10561
  ref: forwardedRef
@@ -11083,7 +10589,7 @@ const $57acba87d6e25586$var$ScrollAreaScrollbarVisible = /* @__PURE__ */ forward
11083
10589
  return $57acba87d6e25586$var$getScrollPositionFromPointer(pointerPos, pointerOffsetRef.current, sizes2, dir);
11084
10590
  }
11085
10591
  if (orientation === "horizontal")
11086
- return /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarX, _extends({}, commonProps, {
10592
+ return /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarX, _extends$1({}, commonProps, {
11087
10593
  ref: forwardedRef,
11088
10594
  onThumbPositionChange: () => {
11089
10595
  if (context.viewport && thumbRef.current) {
@@ -11102,7 +10608,7 @@ const $57acba87d6e25586$var$ScrollAreaScrollbarVisible = /* @__PURE__ */ forward
11102
10608
  }
11103
10609
  }));
11104
10610
  if (orientation === "vertical")
11105
- return /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarY, _extends({}, commonProps, {
10611
+ return /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarY, _extends$1({}, commonProps, {
11106
10612
  ref: forwardedRef,
11107
10613
  onThumbPositionChange: () => {
11108
10614
  if (context.viewport && thumbRef.current) {
@@ -11134,7 +10640,7 @@ const $57acba87d6e25586$var$ScrollAreaScrollbarX = /* @__PURE__ */ forwardRef((p
11134
10640
  }, [
11135
10641
  ref
11136
10642
  ]);
11137
- return /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarImpl, _extends({
10643
+ return /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarImpl, _extends$1({
11138
10644
  "data-orientation": "horizontal"
11139
10645
  }, scrollbarProps, {
11140
10646
  ref: composeRefs,
@@ -11182,7 +10688,7 @@ const $57acba87d6e25586$var$ScrollAreaScrollbarY = /* @__PURE__ */ forwardRef((p
11182
10688
  }, [
11183
10689
  ref
11184
10690
  ]);
11185
- return /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarImpl, _extends({
10691
+ return /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarImpl, _extends$1({
11186
10692
  "data-orientation": "vertical"
11187
10693
  }, scrollbarProps, {
11188
10694
  ref: composeRefs,
@@ -11278,7 +10784,7 @@ const $57acba87d6e25586$var$ScrollAreaScrollbarImpl = /* @__PURE__ */ forwardRef
11278
10784
  onThumbPointerUp: $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onThumbPointerUp),
11279
10785
  onThumbPositionChange: handleThumbPositionChange,
11280
10786
  onThumbPointerDown: $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onThumbPointerDown)
11281
- }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, scrollbarProps, {
10787
+ }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends$1({}, scrollbarProps, {
11282
10788
  ref: composeRefs,
11283
10789
  style: {
11284
10790
  position: "absolute",
@@ -11315,7 +10821,7 @@ const $57acba87d6e25586$export$9fba1154677d7cd2 = /* @__PURE__ */ forwardRef((pr
11315
10821
  const scrollbarContext = $57acba87d6e25586$var$useScrollbarContext($57acba87d6e25586$var$THUMB_NAME, props.__scopeScrollArea);
11316
10822
  return /* @__PURE__ */ createElement($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
11317
10823
  present: forceMount || scrollbarContext.hasThumb
11318
- }, /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaThumbImpl, _extends({
10824
+ }, /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaThumbImpl, _extends$1({
11319
10825
  ref: forwardedRef
11320
10826
  }, thumbProps)));
11321
10827
  });
@@ -11355,7 +10861,7 @@ const $57acba87d6e25586$var$ScrollAreaThumbImpl = /* @__PURE__ */ forwardRef((pr
11355
10861
  debounceScrollEnd,
11356
10862
  onThumbPositionChange
11357
10863
  ]);
11358
- return /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
10864
+ return /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends$1({
11359
10865
  "data-state": scrollbarContext.hasThumb ? "visible" : "hidden"
11360
10866
  }, thumbProps, {
11361
10867
  ref: composedRef,
@@ -11382,7 +10888,7 @@ const $57acba87d6e25586$export$56969d565df7cc4b = /* @__PURE__ */ forwardRef((pr
11382
10888
  const context = $57acba87d6e25586$var$useScrollAreaContext($57acba87d6e25586$var$CORNER_NAME, props.__scopeScrollArea);
11383
10889
  const hasBothScrollbarsVisible = Boolean(context.scrollbarX && context.scrollbarY);
11384
10890
  const hasCorner = context.type !== "scroll" && hasBothScrollbarsVisible;
11385
- return hasCorner ? /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaCornerImpl, _extends({}, props, {
10891
+ return hasCorner ? /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaCornerImpl, _extends$1({}, props, {
11386
10892
  ref: forwardedRef
11387
10893
  })) : null;
11388
10894
  });
@@ -11404,7 +10910,7 @@ const $57acba87d6e25586$var$ScrollAreaCornerImpl = /* @__PURE__ */ forwardRef((p
11404
10910
  context.onCornerWidthChange(width);
11405
10911
  setWidth(width);
11406
10912
  });
11407
- return hasSize ? /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, cornerProps, {
10913
+ return hasSize ? /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends$1({}, cornerProps, {
11408
10914
  ref: forwardedRef,
11409
10915
  style: {
11410
10916
  width: width1,
@@ -11665,7 +11171,7 @@ const $faa2e61a3361514f$export$472062a354075cee = /* @__PURE__ */ forwardRef((pr
11665
11171
  scope: props.__scopeSlider
11666
11172
  }, /* @__PURE__ */ createElement($faa2e61a3361514f$var$Collection.Slot, {
11667
11173
  scope: props.__scopeSlider
11668
- }, /* @__PURE__ */ createElement(SliderOrientation, _extends({
11174
+ }, /* @__PURE__ */ createElement(SliderOrientation, _extends$1({
11669
11175
  "aria-disabled": disabled,
11670
11176
  "data-disabled": disabled ? "" : void 0
11671
11177
  }, sliderProps, {
@@ -11747,7 +11253,7 @@ const $faa2e61a3361514f$var$SliderHorizontal = /* @__PURE__ */ forwardRef((props
11747
11253
  endEdge: isSlidingFromLeft ? "right" : "left",
11748
11254
  direction: isSlidingFromLeft ? 1 : -1,
11749
11255
  size: "width"
11750
- }, /* @__PURE__ */ createElement($faa2e61a3361514f$var$SliderImpl, _extends({
11256
+ }, /* @__PURE__ */ createElement($faa2e61a3361514f$var$SliderImpl, _extends$1({
11751
11257
  dir: direction,
11752
11258
  "data-orientation": "horizontal"
11753
11259
  }, sliderProps, {
@@ -11807,7 +11313,7 @@ const $faa2e61a3361514f$var$SliderVertical = /* @__PURE__ */ forwardRef((props,
11807
11313
  endEdge: isSlidingFromBottom ? "top" : "bottom",
11808
11314
  size: "height",
11809
11315
  direction: isSlidingFromBottom ? 1 : -1
11810
- }, /* @__PURE__ */ createElement($faa2e61a3361514f$var$SliderImpl, _extends({
11316
+ }, /* @__PURE__ */ createElement($faa2e61a3361514f$var$SliderImpl, _extends$1({
11811
11317
  "data-orientation": "vertical"
11812
11318
  }, sliderProps, {
11813
11319
  ref,
@@ -11840,7 +11346,7 @@ const $faa2e61a3361514f$var$SliderVertical = /* @__PURE__ */ forwardRef((props,
11840
11346
  const $faa2e61a3361514f$var$SliderImpl = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
11841
11347
  const { __scopeSlider, onSlideStart, onSlideMove, onSlideEnd, onHomeKeyDown, onEndKeyDown, onStepKeyDown, ...sliderProps } = props;
11842
11348
  const context = $faa2e61a3361514f$var$useSliderContext($faa2e61a3361514f$var$SLIDER_NAME, __scopeSlider);
11843
- return /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends({}, sliderProps, {
11349
+ return /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends$1({}, sliderProps, {
11844
11350
  ref: forwardedRef,
11845
11351
  onKeyDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onKeyDown, (event) => {
11846
11352
  if (event.key === "Home") {
@@ -11881,7 +11387,7 @@ const $faa2e61a3361514f$var$TRACK_NAME = "SliderTrack";
11881
11387
  const $faa2e61a3361514f$export$105594979f116971 = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
11882
11388
  const { __scopeSlider, ...trackProps } = props;
11883
11389
  const context = $faa2e61a3361514f$var$useSliderContext($faa2e61a3361514f$var$TRACK_NAME, __scopeSlider);
11884
- return /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends({
11390
+ return /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends$1({
11885
11391
  "data-disabled": context.disabled ? "" : void 0,
11886
11392
  "data-orientation": context.orientation
11887
11393
  }, trackProps, {
@@ -11901,7 +11407,7 @@ const $faa2e61a3361514f$export$a5cf38a7a000fe77 = /* @__PURE__ */ forwardRef((pr
11901
11407
  );
11902
11408
  const offsetStart = valuesCount > 1 ? Math.min(...percentages) : 0;
11903
11409
  const offsetEnd = 100 - Math.max(...percentages);
11904
- return /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends({
11410
+ return /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends$1({
11905
11411
  "data-orientation": context.orientation,
11906
11412
  "data-disabled": context.disabled ? "" : void 0
11907
11413
  }, rangeProps, {
@@ -11930,7 +11436,7 @@ const $faa2e61a3361514f$export$2c1b491743890dec = /* @__PURE__ */ forwardRef((pr
11930
11436
  thumb
11931
11437
  ]
11932
11438
  );
11933
- return /* @__PURE__ */ createElement($faa2e61a3361514f$var$SliderThumbImpl, _extends({}, props, {
11439
+ return /* @__PURE__ */ createElement($faa2e61a3361514f$var$SliderThumbImpl, _extends$1({}, props, {
11934
11440
  ref: composedRefs,
11935
11441
  index: index2
11936
11442
  }));
@@ -11969,7 +11475,7 @@ const $faa2e61a3361514f$var$SliderThumbImpl = /* @__PURE__ */ forwardRef((props,
11969
11475
  }
11970
11476
  }, /* @__PURE__ */ createElement($faa2e61a3361514f$var$Collection.ItemSlot, {
11971
11477
  scope: props.__scopeSlider
11972
- }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends({
11478
+ }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends$1({
11973
11479
  role: "slider",
11974
11480
  "aria-label": props["aria-label"] || label,
11975
11481
  "aria-valuemin": context.min,
@@ -12009,7 +11515,7 @@ const $faa2e61a3361514f$var$BubbleInput = (props) => {
12009
11515
  prevValue,
12010
11516
  value
12011
11517
  ]);
12012
- return /* @__PURE__ */ createElement("input", _extends({
11518
+ return /* @__PURE__ */ createElement("input", _extends$1({
12013
11519
  style: {
12014
11520
  display: "none"
12015
11521
  }
@@ -12228,7 +11734,7 @@ const $cddcb0b647441e34$export$e2255cf6045e8d47 = /* @__PURE__ */ forwardRef((pr
12228
11734
  scope: __scopeAvatar,
12229
11735
  imageLoadingStatus,
12230
11736
  onImageLoadingStatusChange: setImageLoadingStatus
12231
- }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends({}, avatarProps, {
11737
+ }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends$1({}, avatarProps, {
12232
11738
  ref: forwardedRef
12233
11739
  })));
12234
11740
  });
@@ -12249,7 +11755,7 @@ const $cddcb0b647441e34$export$2cd8ae1985206fe8 = /* @__PURE__ */ forwardRef((pr
12249
11755
  imageLoadingStatus,
12250
11756
  handleLoadingStatusChange
12251
11757
  ]);
12252
- return imageLoadingStatus === "loaded" ? /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.img, _extends({}, imageProps, {
11758
+ return imageLoadingStatus === "loaded" ? /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.img, _extends$1({}, imageProps, {
12253
11759
  ref: forwardedRef,
12254
11760
  src
12255
11761
  })) : null;
@@ -12270,7 +11776,7 @@ const $cddcb0b647441e34$export$69fffb6a9571fbfe = /* @__PURE__ */ forwardRef((pr
12270
11776
  }, [
12271
11777
  delayMs
12272
11778
  ]);
12273
- return canRender && context.imageLoadingStatus !== "loaded" ? /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends({}, fallbackProps, {
11779
+ return canRender && context.imageLoadingStatus !== "loaded" ? /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends$1({}, fallbackProps, {
12274
11780
  ref: forwardedRef
12275
11781
  })) : null;
12276
11782
  });
@@ -12374,7 +11880,7 @@ const $69cb30bb0017df05$export$b2539bed5023c21c = /* @__PURE__ */ forwardRef((pr
12374
11880
  orientation,
12375
11881
  dir: direction,
12376
11882
  activationMode
12377
- }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
11883
+ }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends$1({
12378
11884
  dir: direction,
12379
11885
  "data-orientation": orientation
12380
11886
  }, tabsProps, {
@@ -12386,13 +11892,13 @@ const $69cb30bb0017df05$export$9712d22edc0d78c1 = /* @__PURE__ */ forwardRef((pr
12386
11892
  const { __scopeTabs, loop = true, ...listProps } = props;
12387
11893
  const context = $69cb30bb0017df05$var$useTabsContext($69cb30bb0017df05$var$TAB_LIST_NAME, __scopeTabs);
12388
11894
  const rovingFocusGroupScope = $69cb30bb0017df05$var$useRovingFocusGroupScope(__scopeTabs);
12389
- return /* @__PURE__ */ createElement($d7bdfb9eb0fdf311$export$be92b6f5f03c0fe9, _extends({
11895
+ return /* @__PURE__ */ createElement($d7bdfb9eb0fdf311$export$be92b6f5f03c0fe9, _extends$1({
12390
11896
  asChild: true
12391
11897
  }, rovingFocusGroupScope, {
12392
11898
  orientation: context.orientation,
12393
11899
  dir: context.dir,
12394
11900
  loop
12395
- }), /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
11901
+ }), /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends$1({
12396
11902
  role: "tablist",
12397
11903
  "aria-orientation": context.orientation
12398
11904
  }, listProps, {
@@ -12407,12 +11913,12 @@ const $69cb30bb0017df05$export$8114b9fdfdf9f3ba = /* @__PURE__ */ forwardRef((pr
12407
11913
  const triggerId = $69cb30bb0017df05$var$makeTriggerId(context.baseId, value);
12408
11914
  const contentId = $69cb30bb0017df05$var$makeContentId(context.baseId, value);
12409
11915
  const isSelected = value === context.value;
12410
- return /* @__PURE__ */ createElement($d7bdfb9eb0fdf311$export$6d08773d2e66f8f2, _extends({
11916
+ return /* @__PURE__ */ createElement($d7bdfb9eb0fdf311$export$6d08773d2e66f8f2, _extends$1({
12411
11917
  asChild: true
12412
11918
  }, rovingFocusGroupScope, {
12413
11919
  focusable: !disabled,
12414
11920
  active: isSelected
12415
- }), /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.button, _extends({
11921
+ }), /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.button, _extends$1({
12416
11922
  type: "button",
12417
11923
  role: "tab",
12418
11924
  "aria-selected": isSelected,
@@ -12462,7 +11968,7 @@ const $69cb30bb0017df05$export$bd905d70e8fd2ebb = /* @__PURE__ */ forwardRef((pr
12462
11968
  {
12463
11969
  present: forceMount || isSelected
12464
11970
  },
12465
- ({ present }) => /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
11971
+ ({ present }) => /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends$1({
12466
11972
  "data-state": isSelected ? "active" : "inactive",
12467
11973
  "data-orientation": context.orientation,
12468
11974
  role: "tabpanel",
@@ -12522,6 +12028,260 @@ const Tabs = Object.assign({}, {
12522
12028
  Trigger: TabsTrigger,
12523
12029
  Content: TabsContent
12524
12030
  });
12031
+ const truthyValues = [true, "true"];
12032
+ const BooleanInput = memo((props) => {
12033
+ const [{ inputId, labelId, size, severity, showInputOnly, field, fieldProps }, rest] = useFormikInput(props);
12034
+ let [{ helpText, label }] = useFormikInput(props);
12035
+ helpText = showInputOnly ? null : helpText;
12036
+ label = showInputOnly ? "" : label;
12037
+ const color = useSeverityColor(severity);
12038
+ const value = truthyValues.includes(fieldProps.value);
12039
+ return /* @__PURE__ */ jsx(InputWithLabelAndHelpText, { helpText, severity, children: /* @__PURE__ */ jsx(
12040
+ InputWithLabel,
12041
+ {
12042
+ size,
12043
+ severity,
12044
+ inputId,
12045
+ labelId,
12046
+ label,
12047
+ image: showInputOnly ? void 0 : field.image,
12048
+ flexProps: { direction: "row-reverse", justify: "end", align: "center", gap: "2" },
12049
+ children: /* @__PURE__ */ jsx(
12050
+ Checkbox,
12051
+ {
12052
+ ...rest,
12053
+ ...fieldProps,
12054
+ id: inputId,
12055
+ color,
12056
+ value: value.toString(),
12057
+ checked: value,
12058
+ onCheckedChange: fieldProps.onChange,
12059
+ onChange: void 0,
12060
+ onBlur: void 0
12061
+ }
12062
+ )
12063
+ }
12064
+ ) });
12065
+ });
12066
+ BooleanInput.displayName = "BooleanInput";
12067
+ var DefaultContext = {
12068
+ color: void 0,
12069
+ size: void 0,
12070
+ className: void 0,
12071
+ style: void 0,
12072
+ attr: void 0
12073
+ };
12074
+ var IconContext = React__default.createContext && /* @__PURE__ */ React__default.createContext(DefaultContext);
12075
+ var _excluded = ["attr", "size", "title"];
12076
+ function _objectWithoutProperties(source, excluded) {
12077
+ if (source == null)
12078
+ return {};
12079
+ var target = _objectWithoutPropertiesLoose(source, excluded);
12080
+ var key, i;
12081
+ if (Object.getOwnPropertySymbols) {
12082
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
12083
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
12084
+ key = sourceSymbolKeys[i];
12085
+ if (excluded.indexOf(key) >= 0)
12086
+ continue;
12087
+ if (!Object.prototype.propertyIsEnumerable.call(source, key))
12088
+ continue;
12089
+ target[key] = source[key];
12090
+ }
12091
+ }
12092
+ return target;
12093
+ }
12094
+ function _objectWithoutPropertiesLoose(source, excluded) {
12095
+ if (source == null)
12096
+ return {};
12097
+ var target = {};
12098
+ for (var key in source) {
12099
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
12100
+ if (excluded.indexOf(key) >= 0)
12101
+ continue;
12102
+ target[key] = source[key];
12103
+ }
12104
+ }
12105
+ return target;
12106
+ }
12107
+ function _extends() {
12108
+ _extends = Object.assign ? Object.assign.bind() : function(target) {
12109
+ for (var i = 1; i < arguments.length; i++) {
12110
+ var source = arguments[i];
12111
+ for (var key in source) {
12112
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
12113
+ target[key] = source[key];
12114
+ }
12115
+ }
12116
+ }
12117
+ return target;
12118
+ };
12119
+ return _extends.apply(this, arguments);
12120
+ }
12121
+ function ownKeys(e, r) {
12122
+ var t = Object.keys(e);
12123
+ if (Object.getOwnPropertySymbols) {
12124
+ var o = Object.getOwnPropertySymbols(e);
12125
+ r && (o = o.filter(function(r2) {
12126
+ return Object.getOwnPropertyDescriptor(e, r2).enumerable;
12127
+ })), t.push.apply(t, o);
12128
+ }
12129
+ return t;
12130
+ }
12131
+ function _objectSpread(e) {
12132
+ for (var r = 1; r < arguments.length; r++) {
12133
+ var t = null != arguments[r] ? arguments[r] : {};
12134
+ r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
12135
+ _defineProperty(e, r2, t[r2]);
12136
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
12137
+ Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
12138
+ });
12139
+ }
12140
+ return e;
12141
+ }
12142
+ function _defineProperty(obj, key, value) {
12143
+ key = _toPropertyKey(key);
12144
+ if (key in obj) {
12145
+ Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
12146
+ } else {
12147
+ obj[key] = value;
12148
+ }
12149
+ return obj;
12150
+ }
12151
+ function _toPropertyKey(t) {
12152
+ var i = _toPrimitive(t, "string");
12153
+ return "symbol" == typeof i ? i : i + "";
12154
+ }
12155
+ function _toPrimitive(t, r) {
12156
+ if ("object" != typeof t || !t)
12157
+ return t;
12158
+ var e = t[Symbol.toPrimitive];
12159
+ if (void 0 !== e) {
12160
+ var i = e.call(t, r || "default");
12161
+ if ("object" != typeof i)
12162
+ return i;
12163
+ throw new TypeError("@@toPrimitive must return a primitive value.");
12164
+ }
12165
+ return ("string" === r ? String : Number)(t);
12166
+ }
12167
+ function Tree2Element(tree) {
12168
+ return tree && tree.map((node, i) => /* @__PURE__ */ React__default.createElement(node.tag, _objectSpread({
12169
+ key: i
12170
+ }, node.attr), Tree2Element(node.child)));
12171
+ }
12172
+ function GenIcon(data) {
12173
+ return (props) => /* @__PURE__ */ React__default.createElement(IconBase, _extends({
12174
+ attr: _objectSpread({}, data.attr)
12175
+ }, props), Tree2Element(data.child));
12176
+ }
12177
+ function IconBase(props) {
12178
+ var elem = (conf) => {
12179
+ var {
12180
+ attr,
12181
+ size,
12182
+ title: title2
12183
+ } = props, svgProps = _objectWithoutProperties(props, _excluded);
12184
+ var computedSize = size || conf.size || "1em";
12185
+ var className;
12186
+ if (conf.className)
12187
+ className = conf.className;
12188
+ if (props.className)
12189
+ className = (className ? className + " " : "") + props.className;
12190
+ return /* @__PURE__ */ React__default.createElement("svg", _extends({
12191
+ stroke: "currentColor",
12192
+ fill: "currentColor",
12193
+ strokeWidth: "0"
12194
+ }, conf.attr, attr, svgProps, {
12195
+ className,
12196
+ style: _objectSpread(_objectSpread({
12197
+ color: props.color || conf.color
12198
+ }, conf.style), props.style),
12199
+ height: computedSize,
12200
+ width: computedSize,
12201
+ xmlns: "http://www.w3.org/2000/svg"
12202
+ }), title2 && /* @__PURE__ */ React__default.createElement("title", null, title2), props.children);
12203
+ };
12204
+ return IconContext !== void 0 ? /* @__PURE__ */ React__default.createElement(IconContext.Consumer, null, (conf) => elem(conf)) : elem(DefaultContext);
12205
+ }
12206
+ function RiArrowDownLine(props) {
12207
+ return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M13.0001 16.1716L18.3641 10.8076L19.7783 12.2218L12.0001 20L4.22192 12.2218L5.63614 10.8076L11.0001 16.1716V4H13.0001V16.1716Z" }, "child": [] }] })(props);
12208
+ }
12209
+ function RiArrowUpLine(props) {
12210
+ return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M13.0001 7.82843V20H11.0001V7.82843L5.63614 13.1924L4.22192 11.7782L12.0001 4L19.7783 11.7782L18.3641 13.1924L13.0001 7.82843Z" }, "child": [] }] })(props);
12211
+ }
12212
+ function RiCalendarLine(props) {
12213
+ return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M9 1V3H15V1H17V3H21C21.5523 3 22 3.44772 22 4V20C22 20.5523 21.5523 21 21 21H3C2.44772 21 2 20.5523 2 20V4C2 3.44772 2.44772 3 3 3H7V1H9ZM20 11H4V19H20V11ZM7 5H4V9H20V5H17V7H15V5H9V7H7V5Z" }, "child": [] }] })(props);
12214
+ }
12215
+ function RiQrCodeLine(props) {
12216
+ return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M16 17V16H13V13H16V15H18V17H17V19H15V21H13V18H15V17H16ZM21 21H17V19H19V17H21V21ZM3 3H11V11H3V3ZM5 5V9H9V5H5ZM13 3H21V11H13V3ZM15 5V9H19V5H15ZM3 13H11V21H3V13ZM5 15V19H9V15H5ZM18 13H21V15H18V13ZM6 6H8V8H6V6ZM6 16H8V18H6V16ZM16 6H18V8H16V6Z" }, "child": [] }] })(props);
12217
+ }
12218
+ function RiFileCopyLine(props) {
12219
+ return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M6.9998 6V3C6.9998 2.44772 7.44752 2 7.9998 2H19.9998C20.5521 2 20.9998 2.44772 20.9998 3V17C20.9998 17.5523 20.5521 18 19.9998 18H16.9998V20.9991C16.9998 21.5519 16.5499 22 15.993 22H4.00666C3.45059 22 3 21.5554 3 20.9991L3.0026 7.00087C3.0027 6.44811 3.45264 6 4.00942 6H6.9998ZM5.00242 8L5.00019 20H14.9998V8H5.00242ZM8.9998 6H16.9998V16H18.9998V4H8.9998V6Z" }, "child": [] }] })(props);
12220
+ }
12221
+ function RiAlignJustify(props) {
12222
+ return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M3 4H21V6H3V4ZM3 19H21V21H3V19ZM3 14H21V16H3V14ZM3 9H21V11H3V9Z" }, "child": [] }] })(props);
12223
+ }
12224
+ function RiHashtag(props) {
12225
+ return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M7.78428 14L8.2047 10H4V8H8.41491L8.94043 3H10.9514L10.4259 8H14.4149L14.9404 3H16.9514L16.4259 8H20V10H16.2157L15.7953 14H20V16H15.5851L15.0596 21H13.0486L13.5741 16H9.58509L9.05957 21H7.04855L7.57407 16H4V14H7.78428ZM9.7953 14H13.7843L14.2047 10H10.2157L9.7953 14Z" }, "child": [] }] })(props);
12226
+ }
12227
+ function RiInputField(props) {
12228
+ return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M8 5H11V19H8V21H16V19H13V5H16V3H8V5ZM2 7C1.44772 7 1 7.44772 1 8V16C1 16.5523 1.44772 17 2 17H8V15H3V9H8V7H2ZM16 9H21V15H16V17H22C22.5523 17 23 16.5523 23 16V8C23 7.44772 22.5523 7 22 7H16V9Z" }, "child": [] }] })(props);
12229
+ }
12230
+ function RiListCheck(props) {
12231
+ return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M8 4H21V6H8V4ZM3 3.5H6V6.5H3V3.5ZM3 10.5H6V13.5H3V10.5ZM3 17.5H6V20.5H3V17.5ZM8 11H21V13H8V11ZM8 18H21V20H8V18Z" }, "child": [] }] })(props);
12232
+ }
12233
+ function RiImageLine(props) {
12234
+ return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M2.9918 21C2.44405 21 2 20.5551 2 20.0066V3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082C21.556 3 22 3.44495 22 3.9934V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918ZM20 15V5H4V19L14 9L20 15ZM20 17.8284L14 11.8284L6.82843 19H20V17.8284ZM8 11C6.89543 11 6 10.1046 6 9C6 7.89543 6.89543 7 8 7C9.10457 7 10 7.89543 10 9C10 10.1046 9.10457 11 8 11Z" }, "child": [] }] })(props);
12235
+ }
12236
+ function RiCheckboxCircleLine(props) {
12237
+ return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM11.0026 16L6.75999 11.7574L8.17421 10.3431L11.0026 13.1716L16.6595 7.51472L18.0737 8.92893L11.0026 16Z" }, "child": [] }] })(props);
12238
+ }
12239
+ function RiCheckboxLine(props) {
12240
+ return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M4 3H20C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3ZM5 5V19H19V5H5ZM11.0026 16L6.75999 11.7574L8.17421 10.3431L11.0026 13.1716L16.6595 7.51472L18.0737 8.92893L11.0026 16Z" }, "child": [] }] })(props);
12241
+ }
12242
+ function RiDeleteBin2Line(props) {
12243
+ return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M17 6H22V8H20V21C20 21.5523 19.5523 22 19 22H5C4.44772 22 4 21.5523 4 21V8H2V6H7V3C7 2.44772 7.44772 2 8 2H16C16.5523 2 17 2.44772 17 3V6ZM18 8H6V20H18V8ZM13.4142 13.9997L15.182 15.7675L13.7678 17.1817L12 15.4139L10.2322 17.1817L8.81802 15.7675L10.5858 13.9997L8.81802 12.232L10.2322 10.8178L12 12.5855L13.7678 10.8178L15.182 12.232L13.4142 13.9997ZM9 4V6H15V4H9Z" }, "child": [] }] })(props);
12244
+ }
12245
+ function RiMenuFoldLine(props) {
12246
+ return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M21 17.9995V19.9995H3V17.9995H21ZM6.59619 3.90332L8.01041 5.31753L4.82843 8.49951L8.01041 11.6815L6.59619 13.0957L2 8.49951L6.59619 3.90332ZM21 10.9995V12.9995H12V10.9995H21ZM21 3.99951V5.99951H12V3.99951H21Z" }, "child": [] }] })(props);
12247
+ }
12248
+ function RiUpload2Line(props) {
12249
+ return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M4 19H20V12H22V20C22 20.5523 21.5523 21 21 21H3C2.44772 21 2 20.5523 2 20V12H4V19ZM13 9V16H11V9H6L12 3L18 9H13Z" }, "child": [] }] })(props);
12250
+ }
12251
+ const emptyBooleanField = {
12252
+ ...emptyBaseField,
12253
+ type: "boolean"
12254
+ };
12255
+ const _BooleanField = class _BooleanField extends BaseField {
12256
+ constructor(options) {
12257
+ super({ ...options, type: "boolean" });
12258
+ __publicField(this, "onlyValidateAfterTouched", false);
12259
+ }
12260
+ // if a BooleanField is required, `false` is considered blank
12261
+ isBlank(value) {
12262
+ return this.required && !value;
12263
+ }
12264
+ getValueFromChangeEvent(event) {
12265
+ if (typeof event === "boolean")
12266
+ return event;
12267
+ return event.target.checked;
12268
+ }
12269
+ serialize() {
12270
+ return super._serialize();
12271
+ }
12272
+ static deserialize(data) {
12273
+ if (data.type !== "boolean")
12274
+ throw new Error("Type mismatch.");
12275
+ return new _BooleanField(data);
12276
+ }
12277
+ getInput(props) {
12278
+ return /* @__PURE__ */ jsx(BooleanInput, { ...props, field: this });
12279
+ }
12280
+ };
12281
+ __publicField(_BooleanField, "fieldTypeName", "Checkbox");
12282
+ __publicField(_BooleanField, "fieldTypeDescription", "Perfect for both optional and required yes/no questions.");
12283
+ __publicField(_BooleanField, "Icon", RiCheckboxCircleLine);
12284
+ let BooleanField = _BooleanField;
12525
12285
  const NumberInput = memo((props) => {
12526
12286
  const [{ inputId, labelId, size, severity, showInputOnly, field, fieldProps }, rest] = useFormikInput(props);
12527
12287
  let [{ helpText, label }] = useFormikInput(props);
@@ -13627,7 +13387,7 @@ const QrInput = memo((props) => {
13627
13387
  ] }),
13628
13388
  value && /* @__PURE__ */ jsx(Text, { color: "jade", size: "1", children: /* @__PURE__ */ jsx(RiIcon, { icon: "RiCheckLine", style: { verticalAlign: "bottom" } }) })
13629
13389
  ] }),
13630
- value && /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(Flex, { width: "max-content", gap: "2", align: "center", children: [
13390
+ !!value && /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(Flex, { width: "max-content", gap: "2", align: "center", children: [
13631
13391
  /* @__PURE__ */ jsx(Code, { color: "gray", highContrast: true, children: value }),
13632
13392
  /* @__PURE__ */ jsx(
13633
13393
  IconButton,
@@ -13667,9 +13427,7 @@ const QrScanner = memo((props) => {
13667
13427
  }
13668
13428
  );
13669
13429
  setIsScannerLoading(true);
13670
- qrScanner.start().then(() => {
13671
- setIsScannerLoading(false);
13672
- }).catch(() => {
13430
+ void qrScanner.start().finally(() => {
13673
13431
  setIsScannerLoading(false);
13674
13432
  });
13675
13433
  }, [onQrScan]);
@@ -16067,7 +15825,7 @@ const FieldBuilder = memo((props) => {
16067
15825
  {
16068
15826
  name: `${parentPath}.${index2}.required`,
16069
15827
  render: ({ setValue, value }) => /* @__PURE__ */ jsx(
16070
- Checkbox,
15828
+ Checkbox$1,
16071
15829
  {
16072
15830
  checked: value,
16073
15831
  onCheckedChange: setValue,
@@ -16831,7 +16589,7 @@ const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
16831
16589
  export {
16832
16590
  APIError,
16833
16591
  AgentService,
16834
- AttachmentService,
16592
+ AttachmentModel,
16835
16593
  AuthService,
16836
16594
  BaseApiService,
16837
16595
  BaseField,
@@ -16842,17 +16600,19 @@ export {
16842
16600
  ColorPicker,
16843
16601
  Colors,
16844
16602
  ColorsToString,
16603
+ ComponentAttachmentService,
16845
16604
  ComponentService,
16846
16605
  ComponentStageColors,
16847
16606
  ComponentStageCompletionService,
16848
16607
  ComponentStageService,
16608
+ ComponentTypeAttachmentService,
16849
16609
  ComponentTypeService,
16850
16610
  DEFAULT_ISSUE_PRIORITY,
16851
16611
  DEFAULT_ISSUE_STATUS,
16852
16612
  DateField,
16853
16613
  DateInput,
16614
+ DocumentAttachmentService,
16854
16615
  DocumentService,
16855
- DocumentTeamLinkService,
16856
16616
  EmailDomainsService,
16857
16617
  EmailVerificationService,
16858
16618
  FieldSection,
@@ -16875,6 +16635,7 @@ export {
16875
16635
  InputWithHelpText,
16876
16636
  InputWithLabel,
16877
16637
  InputWithLabelAndHelpText,
16638
+ IssueAttachmentService,
16878
16639
  IssueCommentService,
16879
16640
  IssuePriority,
16880
16641
  IssueService,
@@ -16907,6 +16668,7 @@ export {
16907
16668
  PatchFormProvider,
16908
16669
  ProjectAccessLevel,
16909
16670
  ProjectAccessService,
16671
+ ProjectAttachmentService,
16910
16672
  ProjectFileService,
16911
16673
  ProjectService,
16912
16674
  ProjectType,
@@ -16946,7 +16708,6 @@ export {
16946
16708
  addComponentsInBatches,
16947
16709
  addDocumentAttachment,
16948
16710
  addDocumentAttachments,
16949
- addDocumentTeamLink,
16950
16711
  addDocuments,
16951
16712
  addEmailDomain,
16952
16713
  addFavouriteProjectId,
@@ -16966,7 +16727,6 @@ export {
16966
16727
  addIssueComment,
16967
16728
  addIssueComments,
16968
16729
  addIssueType,
16969
- addIssueTypeTeamLink,
16970
16730
  addIssueUpdate,
16971
16731
  addIssueUpdates,
16972
16732
  addIssues,
@@ -16984,7 +16744,6 @@ export {
16984
16744
  addStages,
16985
16745
  addTeam,
16986
16746
  addToRecentIssues,
16987
- addUserFormTeamLink,
16988
16747
  addUsers,
16989
16748
  addWorkspace,
16990
16749
  areArraysEqual,
@@ -17016,8 +16775,6 @@ export {
17016
16775
  defaultBadgeColor,
17017
16776
  defaultStore,
17018
16777
  deleteComponentType,
17019
- deleteDocumentTeamLink,
17020
- deleteDocumentTeamLinks,
17021
16778
  deleteForm,
17022
16779
  deleteFormRevision,
17023
16780
  deleteFormRevisionAttachment,
@@ -17027,19 +16784,13 @@ export {
17027
16784
  deleteFormSubmissionAttachment,
17028
16785
  deleteFormSubmissionAttachments,
17029
16786
  deleteFormSubmissions,
17030
- deleteIssueTypeTeamLink,
17031
- deleteIssueTypeTeamLinks,
17032
16787
  deleteProject,
17033
16788
  deleteTeam,
17034
- deleteUserFormTeamLink,
17035
- deleteUserFormTeamLinks,
17036
16789
  dequeue,
17037
16790
  deserialize,
17038
16791
  deserializeField,
17039
16792
  discard,
17040
16793
  documentSlice,
17041
- documentTeamLinkReducer,
17042
- documentTeamLinkSlice,
17043
16794
  documentsReducer,
17044
16795
  downloadFile,
17045
16796
  downloadInMemoryFile,
@@ -17092,8 +16843,6 @@ export {
17092
16843
  issueToSearchResult,
17093
16844
  issueTypeReducer,
17094
16845
  issueTypeSlice,
17095
- issueTypeTeamLinkReducer,
17096
- issueTypeTeamLinkSlice,
17097
16846
  licenseReducer,
17098
16847
  licenseSlice,
17099
16848
  linkStageToForm,
@@ -17150,6 +16899,7 @@ export {
17150
16899
  removeFavouriteProjectId,
17151
16900
  removeIssue,
17152
16901
  removeIssueAttachment,
16902
+ removeIssueAttachments,
17153
16903
  removeIssueComment,
17154
16904
  removeIssueComments,
17155
16905
  removeIssueType,
@@ -17243,12 +16993,7 @@ export {
17243
16993
  selectDocument,
17244
16994
  selectDocumentAttachment,
17245
16995
  selectDocumentAttachmentMapping,
17246
- selectDocumentTeamLinks,
17247
- selectDocumentTeamLinksMapping,
17248
- selectDocumentTeamLinksOfDocument,
17249
- selectDocumentTeamLinksOfTeam,
17250
16996
  selectDocuments,
17251
- selectDocumentsLinkedToTeam,
17252
16997
  selectDocumentsMapping,
17253
16998
  selectEmailDomainsAsMapping,
17254
16999
  selectEnableClustering,
@@ -17294,12 +17039,7 @@ export {
17294
17039
  selectIssueMapping,
17295
17040
  selectIssueType,
17296
17041
  selectIssueTypeMapping,
17297
- selectIssueTypeTeamLinkMapping,
17298
- selectIssueTypeTeamLinks,
17299
- selectIssueTypeTeamLinksOfIssueType,
17300
- selectIssueTypeTeamLinksOfTeam,
17301
17042
  selectIssueTypes,
17302
- selectIssueTypesLinkedToTeam,
17303
17043
  selectIssueTypesOfOrganization,
17304
17044
  selectIssueUpdateMapping,
17305
17045
  selectIssueUpdatesOfIssue,
@@ -17334,6 +17074,7 @@ export {
17334
17074
  selectProjectAccessForUser,
17335
17075
  selectProjectAccessUserMapping,
17336
17076
  selectProjectAccesses,
17077
+ selectProjectAttachment,
17337
17078
  selectProjectAttachmentMapping,
17338
17079
  selectProjectFileVisibility,
17339
17080
  selectProjectFiles,
@@ -17362,21 +17103,13 @@ export {
17362
17103
  selectStagesFromStageIds,
17363
17104
  selectTeam,
17364
17105
  selectTeams,
17365
- selectTeamsLinkedToDocument,
17366
- selectTeamsLinkedToIssueType,
17367
- selectTeamsLinkedToUserForm,
17368
17106
  selectTeamsMapping,
17369
17107
  selectTeamsOfOrganization,
17370
17108
  selectTeamsOfUser,
17371
17109
  selectUploadUrl,
17372
17110
  selectUsedColors,
17373
17111
  selectUser,
17374
- selectUserFormLinksOfForm,
17375
- selectUserFormLinksOfTeam,
17376
17112
  selectUserFormRevisionAttachmentsMapping,
17377
- selectUserFormTeamLinkMapping,
17378
- selectUserFormTeamLinks,
17379
- selectUserFormsLinkedToTeam,
17380
17113
  selectUsersAsMapping,
17381
17114
  selectVisibleStatuses,
17382
17115
  selectVisibleUserIds,
@@ -17391,15 +17124,16 @@ export {
17391
17124
  setAppearance,
17392
17125
  setCategories,
17393
17126
  setCenterMapToProject,
17127
+ setComponentAttachment,
17394
17128
  setComponentAttachments,
17129
+ setComponentTypeAttachment,
17395
17130
  setComponentTypeAttachments,
17396
17131
  setComponentTypes,
17397
17132
  setComponents,
17398
17133
  setCreateProjectType,
17399
17134
  setCurrentUser,
17135
+ setDocumentAttachment,
17400
17136
  setDocumentAttachments,
17401
- setDocumentTeamLink,
17402
- setDocumentTeamLinks,
17403
17137
  setDocuments,
17404
17138
  setEmailDomains,
17405
17139
  setEnableClustering,
@@ -17415,12 +17149,11 @@ export {
17415
17149
  setIsFetchingInitialData,
17416
17150
  setIsImportingProjectFile,
17417
17151
  setIsLoading,
17152
+ setIssueAttachment,
17418
17153
  setIssueAttachments,
17419
17154
  setIssueComment,
17420
17155
  setIssueComments,
17421
17156
  setIssueType,
17422
- setIssueTypeTeamLink,
17423
- setIssueTypeTeamLinks,
17424
17157
  setIssueTypes,
17425
17158
  setIssueUpdates,
17426
17159
  setIssues,
@@ -17431,6 +17164,7 @@ export {
17431
17164
  setOrganizations,
17432
17165
  setProfilePicture,
17433
17166
  setProjectAccesses,
17167
+ setProjectAttachment,
17434
17168
  setProjectAttachments,
17435
17169
  setProjectFileVisible,
17436
17170
  setProjects,
@@ -17442,8 +17176,6 @@ export {
17442
17176
  setTokens,
17443
17177
  setTourStep,
17444
17178
  setUploadUrl,
17445
- setUserFormTeamLink,
17446
- setUserFormTeamLinks,
17447
17179
  setUsers,
17448
17180
  setVisibleStatuses,
17449
17181
  setVisibleUserIds,
@@ -17467,20 +17199,25 @@ export {
17467
17199
  updateActiveOrganization,
17468
17200
  updateComponent,
17469
17201
  updateComponentAttachment,
17202
+ updateComponentAttachments,
17470
17203
  updateComponentTypeAttachment,
17204
+ updateComponentTypeAttachments,
17471
17205
  updateDocumentAttachment,
17206
+ updateDocumentAttachments,
17472
17207
  updateDocuments,
17473
17208
  updateFormSubmission,
17474
17209
  updateFormSubmissionAttachments,
17475
17210
  updateFormSubmissions,
17476
17211
  updateIssue,
17477
17212
  updateIssueAttachment,
17213
+ updateIssueAttachments,
17478
17214
  updateIssueType,
17479
17215
  updateLicense,
17480
17216
  updateOrCreateProject,
17481
17217
  updateOrganizationAccess,
17482
17218
  updateProjectAccess,
17483
17219
  updateProjectAttachment,
17220
+ updateProjectAttachments,
17484
17221
  updateStages,
17485
17222
  updateTeam,
17486
17223
  useAppDispatch,
@@ -17492,8 +17229,6 @@ export {
17492
17229
  useFormikInput,
17493
17230
  useMemoCompare,
17494
17231
  useSDK,
17495
- userFormTeamLinkReducer,
17496
- userFormTeamLinkSlice,
17497
17232
  userReducer,
17498
17233
  userSlice,
17499
17234
  valueIsFile,