@overmap-ai/core 1.0.53-team-links.1 → 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 +1360 -1742
  2. package/dist/overmap-core.js.map +1 -1
  3. package/dist/overmap-core.umd.cjs +1363 -1745
  4. package/dist/overmap-core.umd.cjs.map +1 -1
  5. package/dist/sdk/sdk.d.ts +6 -7
  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,44 +6694,33 @@ 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
- void this.client.userFormTeamLinks.refreshStore().then();
7157
6715
  });
7158
6716
  }
7159
6717
  if (currentProjectId) {
7160
- const [_offlineAttachments, promise] = this.client.attachments.fetchAll(currentProjectId);
7161
- void promise.then((result) => {
7162
- const {
7163
- issue_attachments,
7164
- component_type_attachments,
7165
- component_attachments,
7166
- project_attachments,
7167
- document_attachments
7168
- } = result;
7169
- store.dispatch(setIssueAttachments(issue_attachments));
7170
- store.dispatch(setComponentAttachments(component_attachments));
7171
- store.dispatch(setComponentTypeAttachments(component_type_attachments));
7172
- store.dispatch(setProjectAttachments(project_attachments));
7173
- store.dispatch(setDocumentAttachments(document_attachments));
7174
- });
7175
6718
  void this.client.documents.refreshStore().then(() => {
7176
- void this.client.documentTeamLinks.refreshStore().then();
6719
+ void this.client.documentAttachments.refreshStore().then();
7177
6720
  });
6721
+ void this.client.documents.refreshStore();
7178
6722
  void this.client.issueUpdates.refreshStore();
7179
- void this.client.issueTypes.refreshStore().then(() => {
7180
- void this.client.issueTypeTeamLinks.refreshStore().then();
7181
- });
6723
+ void this.client.issueTypes.refreshStore();
7182
6724
  }
7183
6725
  store.dispatch(setIsFetchingInitialData(false));
7184
6726
  if (overwrite) {
@@ -7277,6 +6819,7 @@ class ProjectFileService extends BaseApiService {
7277
6819
  });
7278
6820
  return promise;
7279
6821
  }
6822
+ // TODO: This needs to be seperated into a update and create method
7280
6823
  saveActive() {
7281
6824
  const { store } = this.client;
7282
6825
  const state = store.getState();
@@ -7342,6 +6885,48 @@ class ProjectFileService extends BaseApiService {
7342
6885
  });
7343
6886
  }
7344
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
+ }
7345
6930
  class ProjectService extends BaseApiService {
7346
6931
  /**
7347
6932
  * Creates a new project. Due to the nature of project creation,
@@ -7559,7 +7144,7 @@ class UserFormService extends BaseApiService {
7559
7144
  const currentUser = state.userReducer.currentUser;
7560
7145
  const activeWorkspaceId = state.workspaceReducer.activeWorkspaceId;
7561
7146
  const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
7562
- const offlineFormPayload = offline({});
7147
+ const offlineFormPayload = offline({ ...ownerAttrs });
7563
7148
  const offlineRevisionPayload = offline({ ...initialRevision, submitted_at: submittedAt });
7564
7149
  const retForm = {
7565
7150
  ...offlineFormPayload,
@@ -7723,8 +7308,6 @@ class UserFormService extends BaseApiService {
7723
7308
  if (userFormRevisions && userFormRevisions.length > 0) {
7724
7309
  store.dispatch(deleteFormRevisions(userFormRevisions.map(({ offline_id }) => offline_id)));
7725
7310
  }
7726
- const userFormTeamLinks = selectUserFormLinksOfForm(formId2)(state) ?? [];
7727
- store.dispatch(deleteUserFormTeamLinks(userFormTeamLinks.map((link) => link.offline_id)));
7728
7311
  store.dispatch(deleteForm(formId2));
7729
7312
  try {
7730
7313
  return await this.enqueueRequest({
@@ -7742,7 +7325,6 @@ class UserFormService extends BaseApiService {
7742
7325
  if (userFormSubmissions && userFormSubmissions.length > 0) {
7743
7326
  store.dispatch(addFormSubmissions(userFormSubmissions));
7744
7327
  }
7745
- store.dispatch(setUserFormTeamLinks(userFormTeamLinks));
7746
7328
  throw e;
7747
7329
  }
7748
7330
  }
@@ -8687,8 +8269,7 @@ class DocumentService extends BaseApiService {
8687
8269
  }
8688
8270
  delete(documentId) {
8689
8271
  const { store } = this.client;
8690
- const state = store.getState();
8691
- const documentsMapping = selectDocumentsMapping(state);
8272
+ const documentsMapping = selectDocumentsMapping(store.getState());
8692
8273
  const documentToBeDeleted = documentsMapping[documentId];
8693
8274
  if (!documentToBeDeleted) {
8694
8275
  throw new Error(
@@ -8696,9 +8277,7 @@ class DocumentService extends BaseApiService {
8696
8277
  );
8697
8278
  }
8698
8279
  const parentDocument = documentToBeDeleted.parent_document ? documentsMapping[documentToBeDeleted.parent_document] : void 0;
8699
- const documentTeamLinks = selectDocumentTeamLinksOfDocument(documentId)(state) ?? [];
8700
8280
  store.dispatch(removeDocuments([documentId]));
8701
- store.dispatch(deleteDocumentTeamLinks(documentTeamLinks.map((link) => link.offline_id)));
8702
8281
  const promise = this.enqueueRequest({
8703
8282
  description: "Delete Document",
8704
8283
  method: HttpMethod.DELETE,
@@ -8713,7 +8292,6 @@ class DocumentService extends BaseApiService {
8713
8292
  if (parentDocument) {
8714
8293
  store.dispatch(updateDocuments([parentDocument]));
8715
8294
  }
8716
- store.dispatch(setDocumentTeamLinks(documentTeamLinks));
8717
8295
  });
8718
8296
  return promise;
8719
8297
  }
@@ -8740,6 +8318,48 @@ class DocumentService extends BaseApiService {
8740
8318
  store.dispatch(addDocuments(await organizationDocumentsPromise));
8741
8319
  }
8742
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
+ }
8743
8363
  class AgentService extends BaseApiService {
8744
8364
  /**
8745
8365
  * Prompt the agent with a message.
@@ -8835,13 +8455,7 @@ class TeamService extends BaseApiService {
8835
8455
  if (!team) {
8836
8456
  throw new Error(`Expected team with id ${teamId} to exist`);
8837
8457
  }
8838
- const documentTeamLinks = selectDocumentTeamLinksOfTeam(team.offline_id)(state) ?? [];
8839
- const issueTypeTeamLinks = selectIssueTypeTeamLinksOfTeam(team.offline_id)(state) ?? [];
8840
- const userFormTeamLinks = selectUserFormLinksOfTeam(team.offline_id)(state) ?? [];
8841
8458
  store.dispatch(deleteTeam(teamId));
8842
- store.dispatch(deleteDocumentTeamLinks(documentTeamLinks.map((link) => link.offline_id)));
8843
- store.dispatch(deleteIssueTypeTeamLinks(issueTypeTeamLinks.map((link) => link.offline_id)));
8844
- store.dispatch(deleteUserFormTeamLinks(userFormTeamLinks.map((link) => link.offline_id)));
8845
8459
  try {
8846
8460
  return await this.enqueueRequest({
8847
8461
  description: "Delete team",
@@ -8852,9 +8466,6 @@ class TeamService extends BaseApiService {
8852
8466
  });
8853
8467
  } catch (e) {
8854
8468
  store.dispatch(setTeam(team));
8855
- store.dispatch(setDocumentTeamLinks(documentTeamLinks));
8856
- store.dispatch(setIssueTypeTeamLinks(issueTypeTeamLinks));
8857
- store.dispatch(setUserFormTeamLinks(userFormTeamLinks));
8858
8469
  throw e;
8859
8470
  }
8860
8471
  }
@@ -8917,178 +8528,12 @@ class TeamService extends BaseApiService {
8917
8528
  store.dispatch(setTeams(result));
8918
8529
  }
8919
8530
  }
8920
- class DocumentTeamLinkService extends BaseApiService {
8921
- add(payload) {
8922
- const { store } = this.client;
8923
- const offlineDocumentTeamLink = offline({
8924
- ...payload,
8925
- submitted_at: (/* @__PURE__ */ new Date()).toISOString()
8926
- });
8927
- store.dispatch(addDocumentTeamLink(offlineDocumentTeamLink));
8928
- const promise = this.enqueueRequest({
8929
- method: HttpMethod.POST,
8930
- url: `/organizations/teams/${payload.team}/link-document/`,
8931
- payload: offlineDocumentTeamLink,
8932
- blockers: [payload.team, payload.document],
8933
- blocks: [offlineDocumentTeamLink.offline_id]
8934
- });
8935
- promise.then((createdDocumentLink) => {
8936
- store.dispatch(setDocumentTeamLink(createdDocumentLink));
8937
- }).catch(() => {
8938
- store.dispatch(deleteDocumentTeamLink(offlineDocumentTeamLink.offline_id));
8939
- });
8940
- return [offlineDocumentTeamLink, promise];
8941
- }
8942
- delete(documentTeamLinkId) {
8943
- const { store } = this.client;
8944
- const documentTeamLink = store.getState().documentTeamLinkReducer.documentTeamLinks[documentTeamLinkId];
8945
- if (!documentTeamLink) {
8946
- throw new Error(`No document team link found for ${documentTeamLinkId}`);
8947
- }
8948
- store.dispatch(deleteDocumentTeamLink(documentTeamLinkId));
8949
- const promise = this.enqueueRequest({
8950
- method: HttpMethod.DELETE,
8951
- url: `/organizations/teams/document-links/${documentTeamLinkId}/`,
8952
- blockers: [documentTeamLinkId],
8953
- blocks: [documentTeamLinkId]
8954
- });
8955
- promise.catch(() => {
8956
- store.dispatch(setDocumentTeamLink(documentTeamLink));
8957
- });
8958
- return promise;
8959
- }
8960
- async refreshStore() {
8961
- const { store } = this.client;
8962
- const activeOrganizationId = store.getState().organizationReducer.activeOrganizationId;
8963
- if (!activeOrganizationId) {
8964
- throw new Error(`No active organization, got ${activeOrganizationId} for activeOrganizationId.`);
8965
- }
8966
- const result = await this.enqueueRequest({
8967
- method: HttpMethod.GET,
8968
- url: `/organizations/${activeOrganizationId}/teams/document-links/`,
8969
- blockers: [],
8970
- blocks: []
8971
- });
8972
- store.dispatch(setDocumentTeamLinks(result));
8973
- }
8974
- }
8975
- class IssueTypeTeamLinkService extends BaseApiService {
8976
- add(payload) {
8977
- const { store } = this.client;
8978
- const offlineIssueTypeTeamLink = offline({
8979
- ...payload,
8980
- submitted_at: (/* @__PURE__ */ new Date()).toISOString()
8981
- });
8982
- store.dispatch(addIssueTypeTeamLink(offlineIssueTypeTeamLink));
8983
- const promise = this.enqueueRequest({
8984
- method: HttpMethod.POST,
8985
- url: `/organizations/teams/${payload.team}/link-issue-type/`,
8986
- payload: offlineIssueTypeTeamLink,
8987
- blockers: [payload.team, payload.issue_type],
8988
- blocks: [offlineIssueTypeTeamLink.offline_id]
8989
- });
8990
- promise.then((createdIssueTypeLink) => {
8991
- store.dispatch(setIssueTypeTeamLink(createdIssueTypeLink));
8992
- }).catch(() => {
8993
- store.dispatch(deleteIssueTypeTeamLink(offlineIssueTypeTeamLink.offline_id));
8994
- });
8995
- return [offlineIssueTypeTeamLink, promise];
8996
- }
8997
- delete(issueTypeTeamLinkId) {
8998
- const { store } = this.client;
8999
- const issueTypeTeamLink = store.getState().issueTypeTeamLinkReducer.issueTypeTeamLinks[issueTypeTeamLinkId];
9000
- if (!issueTypeTeamLink) {
9001
- throw new Error(`No issue type team link found for ${issueTypeTeamLinkId}`);
9002
- }
9003
- store.dispatch(deleteIssueTypeTeamLink(issueTypeTeamLinkId));
9004
- const promise = this.enqueueRequest({
9005
- method: HttpMethod.DELETE,
9006
- url: `/organizations/teams/issue-type-links/${issueTypeTeamLinkId}/`,
9007
- blockers: [issueTypeTeamLink.offline_id],
9008
- blocks: [issueTypeTeamLink.offline_id]
9009
- });
9010
- promise.catch(() => {
9011
- store.dispatch(setIssueTypeTeamLink(issueTypeTeamLink));
9012
- });
9013
- return promise;
9014
- }
9015
- async refreshStore() {
9016
- const { store } = this.client;
9017
- const activeOrganizationId = store.getState().organizationReducer.activeOrganizationId;
9018
- if (!activeOrganizationId) {
9019
- throw new Error(`No active organization, got ${activeOrganizationId} for activeOrganizationId.`);
9020
- }
9021
- const result = await this.enqueueRequest({
9022
- method: HttpMethod.GET,
9023
- url: `/organizations/${activeOrganizationId}/teams/issue-type-links/`,
9024
- blockers: [],
9025
- blocks: []
9026
- });
9027
- store.dispatch(setIssueTypeTeamLinks(result));
9028
- }
9029
- }
9030
- class UserFormTeamLinkService extends BaseApiService {
9031
- add(payload) {
9032
- const { store } = this.client;
9033
- const offlineUserFormTeamLink = offline({
9034
- ...payload,
9035
- submitted_at: (/* @__PURE__ */ new Date()).toISOString()
9036
- });
9037
- store.dispatch(addUserFormTeamLink(offlineUserFormTeamLink));
9038
- const promise = this.enqueueRequest({
9039
- method: HttpMethod.POST,
9040
- url: `/organizations/teams/${payload.team}/link-form/`,
9041
- payload: offlineUserFormTeamLink,
9042
- blockers: [payload.team, payload.form],
9043
- blocks: [offlineUserFormTeamLink.offline_id]
9044
- });
9045
- promise.then((createdUserFormLink) => {
9046
- store.dispatch(setUserFormTeamLink(createdUserFormLink));
9047
- }).catch(() => {
9048
- store.dispatch(deleteUserFormTeamLink(offlineUserFormTeamLink.offline_id));
9049
- });
9050
- return [offlineUserFormTeamLink, promise];
9051
- }
9052
- delete(userFormTeamLinkId) {
9053
- const { store } = this.client;
9054
- const userFormTeamLink = store.getState().userFormTeamLinkReducer.userFormTeamLinks[userFormTeamLinkId];
9055
- if (!userFormTeamLink) {
9056
- throw new Error(`No user form team link found for ${userFormTeamLinkId}`);
9057
- }
9058
- store.dispatch(deleteUserFormTeamLink(userFormTeamLinkId));
9059
- const promise = this.enqueueRequest({
9060
- method: HttpMethod.DELETE,
9061
- url: `/organizations/teams/form-links/${userFormTeamLinkId}/`,
9062
- blockers: [userFormTeamLink.offline_id],
9063
- blocks: [userFormTeamLink.offline_id]
9064
- });
9065
- promise.catch(() => {
9066
- store.dispatch(setUserFormTeamLink(userFormTeamLink));
9067
- });
9068
- return promise;
9069
- }
9070
- async refreshStore() {
9071
- const { store } = this.client;
9072
- const activeOrganizationId = store.getState().organizationReducer.activeOrganizationId;
9073
- if (!activeOrganizationId) {
9074
- throw new Error(`No active organization, got ${activeOrganizationId} for activeOrganizationId.`);
9075
- }
9076
- const result = await this.enqueueRequest({
9077
- method: HttpMethod.GET,
9078
- url: `/organizations/${activeOrganizationId}/teams/form-links/`,
9079
- blockers: [],
9080
- blocks: []
9081
- });
9082
- store.dispatch(setUserFormTeamLinks(result));
9083
- }
9084
- }
9085
8531
  class OvermapSDK {
9086
8532
  constructor(apiUrl, store) {
9087
8533
  __publicField(this, "API_URL");
9088
8534
  __publicField(this, "store");
9089
8535
  __publicField(this, "agent", new AgentService(this));
9090
8536
  __publicField(this, "files", new FileService(this));
9091
- __publicField(this, "attachments", new AttachmentService(this));
9092
8537
  __publicField(this, "auth", new AuthService(this));
9093
8538
  __publicField(this, "categories", new CategoryService(this));
9094
8539
  __publicField(this, "projectAccesses", new ProjectAccessService(this));
@@ -9098,24 +8543,26 @@ class OvermapSDK {
9098
8543
  __publicField(this, "issueTypes", new IssueTypeService(this));
9099
8544
  __publicField(this, "issueComments", new IssueCommentService(this));
9100
8545
  __publicField(this, "issueUpdates", new IssueUpdateService(this));
8546
+ __publicField(this, "issueAttachments", new IssueAttachmentService(this));
9101
8547
  __publicField(this, "workspaces", new WorkspaceService(this));
9102
8548
  __publicField(this, "main", new MainService(this));
9103
8549
  __publicField(this, "components", new ComponentService(this));
8550
+ __publicField(this, "componentAttachments", new ComponentAttachmentService(this));
9104
8551
  __publicField(this, "componentTypes", new ComponentTypeService(this));
8552
+ __publicField(this, "componentTypeAttachments", new ComponentTypeAttachmentService(this));
9105
8553
  __publicField(this, "componentStages", new ComponentStageService(this));
9106
8554
  __publicField(this, "componentStageCompletions", new ComponentStageCompletionService(this));
9107
8555
  __publicField(this, "userForms", new UserFormService(this));
9108
8556
  __publicField(this, "userFormSubmissions", new UserFormSubmissionService(this));
9109
8557
  __publicField(this, "projects", new ProjectService(this));
9110
8558
  __publicField(this, "projectFiles", new ProjectFileService(this));
8559
+ __publicField(this, "projectAttachments", new ProjectAttachmentService(this));
9111
8560
  __publicField(this, "emailVerification", new EmailVerificationService(this));
9112
8561
  __publicField(this, "emailDomains", new EmailDomainsService(this));
9113
8562
  __publicField(this, "licenses", new LicenseService(this));
9114
8563
  __publicField(this, "documents", new DocumentService(this));
9115
8564
  __publicField(this, "teams", new TeamService(this));
9116
- __publicField(this, "documentTeamLinks", new DocumentTeamLinkService(this));
9117
- __publicField(this, "issueTypeTeamLinks", new IssueTypeTeamLinkService(this));
9118
- __publicField(this, "userFormTeamLinks", new UserFormTeamLinkService(this));
8565
+ __publicField(this, "documentAttachments", new DocumentAttachmentService(this));
9119
8566
  this.API_URL = apiUrl;
9120
8567
  this.store = store;
9121
8568
  }
@@ -9298,405 +8745,151 @@ const FullScreenImagePreview = memo((props) => {
9298
8745
  },
9299
8746
  [name, file]
9300
8747
  );
9301
- return /* @__PURE__ */ jsxs(Fragment, { children: [
9302
- /* @__PURE__ */ jsx(
9303
- "button",
9304
- {
9305
- className: styles$c.FullScreenImageContainer,
9306
- type: "button",
9307
- onClick: () => {
9308
- setShowPreview(false);
9309
- },
9310
- children: /* @__PURE__ */ jsx(
9311
- "img",
9312
- {
9313
- className: styles$c.FullScreenImage,
9314
- src: url,
9315
- alt: name,
9316
- onClick: (e) => {
9317
- e.stopPropagation();
9318
- }
9319
- }
9320
- )
9321
- }
9322
- ),
9323
- /* @__PURE__ */ jsxs(Flex$1, { className: styles$c.TopBarContainer, align: "center", children: [
9324
- /* @__PURE__ */ jsx(
9325
- IconButton,
9326
- {
9327
- className: styles$c.longIconButton,
9328
- variant: "soft",
9329
- "aria-label": "Exit preview",
9330
- onClick: () => {
9331
- setShowPreview(false);
9332
- },
9333
- children: /* @__PURE__ */ jsx(RiIcon, { icon: "RiArrowLeftLine" })
9334
- }
9335
- ),
9336
- /* @__PURE__ */ jsx(Text$1, { className: styles$c.fileName, children: name }),
9337
- /* @__PURE__ */ jsx(
9338
- IconButton,
9339
- {
9340
- className: styles$c.longIconButton,
9341
- variant: "soft",
9342
- "aria-label": `Download ${name}`,
9343
- onClick: handleDownload,
9344
- children: /* @__PURE__ */ jsx(RiIcon, { icon: "RiDownload2Line" })
9345
- }
9346
- )
9347
- ] })
9348
- ] });
9349
- });
9350
- FullScreenImagePreview.displayName = "FullScreenImagePreview";
9351
- const InputWithLabel = (props) => {
9352
- const { label, children, size, severity, inputId, labelId, image, flexProps } = props;
9353
- const [resolvedImage, setResolvedImage] = useState(void 0);
9354
- const [showImagePreview, setShowImagePreview] = useState(false);
9355
- useEffect(() => {
9356
- if (image instanceof Promise) {
9357
- image.then(setResolvedImage).catch(console.error);
9358
- } else {
9359
- setResolvedImage(image);
9360
- }
9361
- }, [image]);
9362
- const resolvedImageURL = resolvedImage ? URL.createObjectURL(resolvedImage) : void 0;
9363
- return /* @__PURE__ */ jsxs(Flex$1, { direction: "column", gap: "2", children: [
9364
- resolvedImage && /* @__PURE__ */ jsxs(Fragment, { children: [
9365
- /* @__PURE__ */ jsx(
9366
- "img",
9367
- {
9368
- className: styles$c.previewImage,
9369
- src: resolvedImageURL,
9370
- alt: resolvedImage.name,
9371
- onClick: () => {
9372
- setShowImagePreview(true);
9373
- }
9374
- }
9375
- ),
9376
- showImagePreview && /* @__PURE__ */ jsx(
9377
- FullScreenImagePreview,
9378
- {
9379
- file: resolvedImage,
9380
- url: resolvedImageURL,
9381
- name: resolvedImage.name,
9382
- setShowPreview: setShowImagePreview
9383
- }
9384
- )
9385
- ] }),
9386
- /* @__PURE__ */ jsx(Flex$1, { direction: "column", gap: "1", asChild: true, ...flexProps, children: /* @__PURE__ */ jsxs("label", { htmlFor: inputId, children: [
9387
- /* @__PURE__ */ jsx(Text$1, { size, severity, id: labelId, children: label }),
9388
- children
9389
- ] }) })
9390
- ] });
9391
- };
9392
- const InputWithHelpText = (props) => {
9393
- const { helpText, children, severity } = props;
9394
- return /* @__PURE__ */ jsxs(Flex$1, { direction: "column", gap: "1", children: [
9395
- children,
9396
- /* @__PURE__ */ jsx(Flex$1, { direction: "column", children: /* @__PURE__ */ jsx(Text$1, { size: "1", severity, className: styles$c.description, children: helpText }) })
9397
- ] });
9398
- };
9399
- const InputWithLabelAndHelpText = (props) => {
9400
- const { children, ...restProps } = props;
9401
- return /* @__PURE__ */ jsx(InputWithHelpText, { ...restProps, children });
9402
- };
9403
- const useFormikInput = (props) => {
9404
- const { id, field, formId: formId2, size, showInputOnly, ...rest } = props;
9405
- const [fieldProps, meta, helpers] = useField(field.getId());
9406
- const { touched } = meta;
9407
- const helpText = meta.error ?? field.description;
9408
- const severity = meta.error ? "danger" : void 0;
9409
- const inputId = id ?? `${formId2}-${field.getId()}-input`;
9410
- const labelId = `${inputId}-label`;
9411
- const label = field.required ? `${field.label} *` : field.label;
9412
- const fieldPropsWithValidation = useMemo(() => {
9413
- const handleChange = (e) => {
9414
- const value = field.getValueFromChangeEvent(e);
9415
- void helpers.setValue(value, false).then();
9416
- if (touched || !field.onlyValidateAfterTouched) {
9417
- helpers.setError(field.getError(value));
9418
- }
9419
- };
9420
- const handleBlur = (e) => {
9421
- void helpers.setTouched(true, false).then();
9422
- helpers.setError(field.getError(field.getValueFromChangeEvent(e)));
9423
- };
9424
- return {
9425
- ...fieldProps,
9426
- onChange: handleChange,
9427
- onBlur: handleBlur
9428
- };
9429
- }, [field, fieldProps, helpers, touched]);
9430
- return [
9431
- {
9432
- helpText,
9433
- size,
9434
- severity,
9435
- inputId,
9436
- labelId,
9437
- label,
9438
- showInputOnly,
9439
- fieldProps: fieldPropsWithValidation,
9440
- helpers,
9441
- field
9442
- },
9443
- { ...rest, "aria-labelledby": labelId }
9444
- ];
9445
- };
9446
- const truthyValues = [true, "true"];
9447
- const BooleanInput = memo((props) => {
9448
- const [{ inputId, labelId, size, severity, showInputOnly, field, fieldProps }, rest] = useFormikInput(props);
9449
- let [{ helpText, label }] = useFormikInput(props);
9450
- helpText = showInputOnly ? null : helpText;
9451
- label = showInputOnly ? "" : label;
9452
- const color = useSeverityColor(severity);
9453
- const value = truthyValues.includes(fieldProps.value);
9454
- return /* @__PURE__ */ jsx(InputWithLabelAndHelpText, { helpText, severity, children: /* @__PURE__ */ jsx(
9455
- InputWithLabel,
9456
- {
9457
- size,
9458
- severity,
9459
- inputId,
9460
- labelId,
9461
- label,
9462
- image: showInputOnly ? void 0 : field.image,
9463
- flexProps: { direction: "row-reverse", justify: "end", align: "center", gap: "2" },
9464
- children: /* @__PURE__ */ jsx(
9465
- Checkbox,
9466
- {
9467
- ...rest,
9468
- ...fieldProps,
9469
- id: inputId,
9470
- color,
9471
- value: value.toString(),
9472
- checked: value,
9473
- onCheckedChange: fieldProps.onChange,
9474
- onChange: void 0,
9475
- onBlur: void 0
9476
- }
9477
- )
9478
- }
9479
- ) });
9480
- });
9481
- BooleanInput.displayName = "BooleanInput";
9482
- var DefaultContext = {
9483
- color: void 0,
9484
- size: void 0,
9485
- className: void 0,
9486
- style: void 0,
9487
- attr: void 0
9488
- };
9489
- var IconContext = React__default.createContext && /* @__PURE__ */ React__default.createContext(DefaultContext);
9490
- var _excluded = ["attr", "size", "title"];
9491
- function _objectWithoutProperties(source, excluded) {
9492
- if (source == null)
9493
- return {};
9494
- var target = _objectWithoutPropertiesLoose(source, excluded);
9495
- var key, i;
9496
- if (Object.getOwnPropertySymbols) {
9497
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
9498
- for (i = 0; i < sourceSymbolKeys.length; i++) {
9499
- key = sourceSymbolKeys[i];
9500
- if (excluded.indexOf(key) >= 0)
9501
- continue;
9502
- if (!Object.prototype.propertyIsEnumerable.call(source, key))
9503
- continue;
9504
- target[key] = source[key];
9505
- }
9506
- }
9507
- return target;
9508
- }
9509
- function _objectWithoutPropertiesLoose(source, excluded) {
9510
- if (source == null)
9511
- return {};
9512
- var target = {};
9513
- for (var key in source) {
9514
- if (Object.prototype.hasOwnProperty.call(source, key)) {
9515
- if (excluded.indexOf(key) >= 0)
9516
- continue;
9517
- target[key] = source[key];
9518
- }
9519
- }
9520
- return target;
9521
- }
9522
- function _extends$1() {
9523
- _extends$1 = Object.assign ? Object.assign.bind() : function(target) {
9524
- for (var i = 1; i < arguments.length; i++) {
9525
- var source = arguments[i];
9526
- for (var key in source) {
9527
- if (Object.prototype.hasOwnProperty.call(source, key)) {
9528
- target[key] = source[key];
9529
- }
9530
- }
9531
- }
9532
- return target;
9533
- };
9534
- return _extends$1.apply(this, arguments);
9535
- }
9536
- function ownKeys(e, r) {
9537
- var t = Object.keys(e);
9538
- if (Object.getOwnPropertySymbols) {
9539
- var o = Object.getOwnPropertySymbols(e);
9540
- r && (o = o.filter(function(r2) {
9541
- return Object.getOwnPropertyDescriptor(e, r2).enumerable;
9542
- })), t.push.apply(t, o);
9543
- }
9544
- return t;
9545
- }
9546
- function _objectSpread(e) {
9547
- for (var r = 1; r < arguments.length; r++) {
9548
- var t = null != arguments[r] ? arguments[r] : {};
9549
- r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
9550
- _defineProperty(e, r2, t[r2]);
9551
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
9552
- Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
9553
- });
9554
- }
9555
- return e;
9556
- }
9557
- function _defineProperty(obj, key, value) {
9558
- key = _toPropertyKey(key);
9559
- if (key in obj) {
9560
- Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
9561
- } else {
9562
- obj[key] = value;
9563
- }
9564
- return obj;
9565
- }
9566
- function _toPropertyKey(t) {
9567
- var i = _toPrimitive(t, "string");
9568
- return "symbol" == typeof i ? i : i + "";
9569
- }
9570
- function _toPrimitive(t, r) {
9571
- if ("object" != typeof t || !t)
9572
- return t;
9573
- var e = t[Symbol.toPrimitive];
9574
- if (void 0 !== e) {
9575
- var i = e.call(t, r || "default");
9576
- if ("object" != typeof i)
9577
- return i;
9578
- throw new TypeError("@@toPrimitive must return a primitive value.");
9579
- }
9580
- return ("string" === r ? String : Number)(t);
9581
- }
9582
- function Tree2Element(tree) {
9583
- return tree && tree.map((node, i) => /* @__PURE__ */ React__default.createElement(node.tag, _objectSpread({
9584
- key: i
9585
- }, node.attr), Tree2Element(node.child)));
9586
- }
9587
- function GenIcon(data) {
9588
- return (props) => /* @__PURE__ */ React__default.createElement(IconBase, _extends$1({
9589
- attr: _objectSpread({}, data.attr)
9590
- }, props), Tree2Element(data.child));
9591
- }
9592
- function IconBase(props) {
9593
- var elem = (conf) => {
9594
- var {
9595
- attr,
9596
- size,
9597
- title: title2
9598
- } = props, svgProps = _objectWithoutProperties(props, _excluded);
9599
- var computedSize = size || conf.size || "1em";
9600
- var className;
9601
- if (conf.className)
9602
- className = conf.className;
9603
- if (props.className)
9604
- className = (className ? className + " " : "") + props.className;
9605
- return /* @__PURE__ */ React__default.createElement("svg", _extends$1({
9606
- stroke: "currentColor",
9607
- fill: "currentColor",
9608
- strokeWidth: "0"
9609
- }, conf.attr, attr, svgProps, {
9610
- className,
9611
- style: _objectSpread(_objectSpread({
9612
- color: props.color || conf.color
9613
- }, conf.style), props.style),
9614
- height: computedSize,
9615
- width: computedSize,
9616
- xmlns: "http://www.w3.org/2000/svg"
9617
- }), title2 && /* @__PURE__ */ React__default.createElement("title", null, title2), props.children);
9618
- };
9619
- return IconContext !== void 0 ? /* @__PURE__ */ React__default.createElement(IconContext.Consumer, null, (conf) => elem(conf)) : elem(DefaultContext);
9620
- }
9621
- function RiArrowDownLine(props) {
9622
- 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);
9623
- }
9624
- function RiArrowUpLine(props) {
9625
- 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);
9626
- }
9627
- function RiCalendarLine(props) {
9628
- 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);
9629
- }
9630
- function RiQrCodeLine(props) {
9631
- 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);
9632
- }
9633
- function RiFileCopyLine(props) {
9634
- 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);
9635
- }
9636
- function RiAlignJustify(props) {
9637
- return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M3 4H21V6H3V4ZM3 19H21V21H3V19ZM3 14H21V16H3V14ZM3 9H21V11H3V9Z" }, "child": [] }] })(props);
9638
- }
9639
- function RiHashtag(props) {
9640
- 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);
9641
- }
9642
- function RiInputField(props) {
9643
- 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);
9644
- }
9645
- function RiListCheck(props) {
9646
- 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);
9647
- }
9648
- function RiImageLine(props) {
9649
- 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);
9650
- }
9651
- function RiCheckboxCircleLine(props) {
9652
- 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);
9653
- }
9654
- function RiCheckboxLine(props) {
9655
- 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);
9656
- }
9657
- function RiDeleteBin2Line(props) {
9658
- 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);
9659
- }
9660
- function RiMenuFoldLine(props) {
9661
- 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);
9662
- }
9663
- function RiUpload2Line(props) {
9664
- 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);
9665
- }
9666
- const emptyBooleanField = {
9667
- ...emptyBaseField,
9668
- 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
+ ] });
9669
8838
  };
9670
- const _BooleanField = class _BooleanField extends BaseField {
9671
- constructor(options) {
9672
- super({ ...options, type: "boolean" });
9673
- __publicField(this, "onlyValidateAfterTouched", false);
9674
- }
9675
- // if a BooleanField is required, `false` is considered blank
9676
- isBlank(value) {
9677
- return this.required && !value;
9678
- }
9679
- getValueFromChangeEvent(event) {
9680
- if (typeof event === "boolean")
9681
- return event;
9682
- return event.target.checked;
9683
- }
9684
- serialize() {
9685
- return super._serialize();
9686
- }
9687
- static deserialize(data) {
9688
- if (data.type !== "boolean")
9689
- throw new Error("Type mismatch.");
9690
- return new _BooleanField(data);
9691
- }
9692
- getInput(props) {
9693
- return /* @__PURE__ */ jsx(BooleanInput, { ...props, field: this });
9694
- }
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
+ ];
9695
8892
  };
9696
- __publicField(_BooleanField, "fieldTypeName", "Checkbox");
9697
- __publicField(_BooleanField, "fieldTypeDescription", "Perfect for both optional and required yes/no questions.");
9698
- __publicField(_BooleanField, "Icon", RiCheckboxCircleLine);
9699
- let BooleanField = _BooleanField;
9700
8893
  function getDefaultExportFromCjs(x) {
9701
8894
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
9702
8895
  }
@@ -9749,8 +8942,8 @@ var classnames = { exports: {} };
9749
8942
  })(classnames);
9750
8943
  var classnamesExports = classnames.exports;
9751
8944
  const classNames = /* @__PURE__ */ getDefaultExportFromCjs(classnamesExports);
9752
- function _extends() {
9753
- _extends = Object.assign ? Object.assign.bind() : function(target) {
8945
+ function _extends$1() {
8946
+ _extends$1 = Object.assign ? Object.assign.bind() : function(target) {
9754
8947
  for (var i = 1; i < arguments.length; i++) {
9755
8948
  var source = arguments[i];
9756
8949
  for (var key in source) {
@@ -9761,7 +8954,7 @@ function _extends() {
9761
8954
  }
9762
8955
  return target;
9763
8956
  };
9764
- return _extends.apply(this, arguments);
8957
+ return _extends$1.apply(this, arguments);
9765
8958
  }
9766
8959
  function $e42e1063c40fb3ef$export$b9ecd428b558ff10(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
9767
8960
  return function handleEvent(event) {
@@ -9892,11 +9085,11 @@ const $5e63c961fc1ce211$export$8c6ed5c666ac1360 = /* @__PURE__ */ forwardRef((pr
9892
9085
  } else
9893
9086
  return child;
9894
9087
  });
9895
- return /* @__PURE__ */ createElement($5e63c961fc1ce211$var$SlotClone, _extends({}, slotProps, {
9088
+ return /* @__PURE__ */ createElement($5e63c961fc1ce211$var$SlotClone, _extends$1({}, slotProps, {
9896
9089
  ref: forwardedRef
9897
9090
  }), /* @__PURE__ */ isValidElement(newElement) ? /* @__PURE__ */ cloneElement(newElement, void 0, newChildren) : null);
9898
9091
  }
9899
- return /* @__PURE__ */ createElement($5e63c961fc1ce211$var$SlotClone, _extends({}, slotProps, {
9092
+ return /* @__PURE__ */ createElement($5e63c961fc1ce211$var$SlotClone, _extends$1({}, slotProps, {
9900
9093
  ref: forwardedRef
9901
9094
  }), children);
9902
9095
  });
@@ -9974,7 +9167,7 @@ const $8927f6f2acc4f386$export$250ffa63cdc0d034 = $8927f6f2acc4f386$var$NODES.re
9974
9167
  useEffect(() => {
9975
9168
  window[Symbol.for("radix-ui")] = true;
9976
9169
  }, []);
9977
- return /* @__PURE__ */ createElement(Comp, _extends({}, primitiveProps, {
9170
+ return /* @__PURE__ */ createElement(Comp, _extends$1({}, primitiveProps, {
9978
9171
  ref: forwardedRef
9979
9172
  }));
9980
9173
  });
@@ -10533,9 +9726,9 @@ const Inset = React.forwardRef((props, forwardedRef) => {
10533
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)) });
10534
9727
  });
10535
9728
  Inset.displayName = "Inset";
10536
- 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"];
10537
9730
  const headingPropDefs = {
10538
- size: { type: "enum", values: sizes$8, default: "6", responsive: true },
9731
+ size: { type: "enum", values: sizes$9, default: "6", responsive: true },
10539
9732
  weight: { ...weightProp, default: "bold" },
10540
9733
  align: alignProp,
10541
9734
  trim: trimProp,
@@ -10548,9 +9741,9 @@ const Heading = React.forwardRef((props, forwardedRef) => {
10548
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));
10549
9742
  });
10550
9743
  Heading.displayName = "Heading";
10551
- 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"];
10552
9745
  const textPropDefs = {
10553
- size: { type: "enum", values: sizes$7, default: void 0, responsive: true },
9746
+ size: { type: "enum", values: sizes$8, default: void 0, responsive: true },
10554
9747
  weight: weightProp,
10555
9748
  align: alignProp,
10556
9749
  trim: trimProp,
@@ -10563,11 +9756,11 @@ const Text = React.forwardRef((props, forwardedRef) => {
10563
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));
10564
9757
  });
10565
9758
  Text.displayName = "Text";
10566
- const sizes$6 = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
10567
- 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"];
10568
9761
  const codePropDefs = {
10569
- size: { type: "enum", values: sizes$6, default: void 0, responsive: true },
10570
- 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" },
10571
9764
  weight: weightProp,
10572
9765
  color: colorProp,
10573
9766
  highContrast: highContrastProp
@@ -10597,6 +9790,202 @@ function $010c2913dbd2fe3d$export$5cae361ad82dce8b(value) {
10597
9790
  value
10598
9791
  ]);
10599
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";
10600
9989
  function $e02a7d9cb1dc128c$export$c74125a8e3af6bb2(name) {
10601
9990
  const PROVIDER_NAME = name + "CollectionProvider";
10602
9991
  const [createCollectionContext, createCollectionScope] = $c512c27ab02ef895$export$50c7b4e9d9f19c1(PROVIDER_NAME);
@@ -10688,7 +10077,7 @@ const $d7bdfb9eb0fdf311$export$8699f7c8af148338 = /* @__PURE__ */ forwardRef((pr
10688
10077
  scope: props.__scopeRovingFocusGroup
10689
10078
  }, /* @__PURE__ */ createElement($d7bdfb9eb0fdf311$var$Collection.Slot, {
10690
10079
  scope: props.__scopeRovingFocusGroup
10691
- }, /* @__PURE__ */ createElement($d7bdfb9eb0fdf311$var$RovingFocusGroupImpl, _extends({}, props, {
10080
+ }, /* @__PURE__ */ createElement($d7bdfb9eb0fdf311$var$RovingFocusGroupImpl, _extends$1({}, props, {
10692
10081
  ref: forwardedRef
10693
10082
  }))));
10694
10083
  });
@@ -10744,7 +10133,7 @@ const $d7bdfb9eb0fdf311$var$RovingFocusGroupImpl = /* @__PURE__ */ forwardRef((p
10744
10133
  ),
10745
10134
  []
10746
10135
  )
10747
- }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
10136
+ }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends$1({
10748
10137
  tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,
10749
10138
  "data-orientation": orientation
10750
10139
  }, groupProps, {
@@ -10814,7 +10203,7 @@ const $d7bdfb9eb0fdf311$export$ab9df7c53fe8454 = /* @__PURE__ */ forwardRef((pro
10814
10203
  id,
10815
10204
  focusable,
10816
10205
  active
10817
- }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends({
10206
+ }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends$1({
10818
10207
  tabIndex: isCurrentTabStop ? 0 : -1,
10819
10208
  "data-orientation": context.orientation
10820
10209
  }, itemProps, {
@@ -10954,7 +10343,7 @@ const $57acba87d6e25586$export$ccf8d8d7bbf3c2cc = /* @__PURE__ */ forwardRef((pr
10954
10343
  onScrollbarYEnabledChange: setScrollbarYEnabled,
10955
10344
  onCornerWidthChange: setCornerWidth,
10956
10345
  onCornerHeightChange: setCornerHeight
10957
- }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
10346
+ }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends$1({
10958
10347
  dir: direction
10959
10348
  }, scrollAreaProps, {
10960
10349
  ref: composedRefs,
@@ -10977,7 +10366,7 @@ const $57acba87d6e25586$export$a21cbf9f11fca853 = /* @__PURE__ */ forwardRef((pr
10977
10366
  dangerouslySetInnerHTML: {
10978
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}`
10979
10368
  }
10980
- }), /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
10369
+ }), /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends$1({
10981
10370
  "data-radix-scroll-area-viewport": ""
10982
10371
  }, viewportProps, {
10983
10372
  ref: composedRefs,
@@ -11021,16 +10410,16 @@ const $57acba87d6e25586$export$2fabd85d0eba3c57 = /* @__PURE__ */ forwardRef((pr
11021
10410
  onScrollbarXEnabledChange,
11022
10411
  onScrollbarYEnabledChange
11023
10412
  ]);
11024
- return context.type === "hover" ? /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarHover, _extends({}, scrollbarProps, {
10413
+ return context.type === "hover" ? /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarHover, _extends$1({}, scrollbarProps, {
11025
10414
  ref: forwardedRef,
11026
10415
  forceMount
11027
- })) : context.type === "scroll" ? /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarScroll, _extends({}, scrollbarProps, {
10416
+ })) : context.type === "scroll" ? /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarScroll, _extends$1({}, scrollbarProps, {
11028
10417
  ref: forwardedRef,
11029
10418
  forceMount
11030
- })) : context.type === "auto" ? /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarAuto, _extends({}, scrollbarProps, {
10419
+ })) : context.type === "auto" ? /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarAuto, _extends$1({}, scrollbarProps, {
11031
10420
  ref: forwardedRef,
11032
10421
  forceMount
11033
- })) : context.type === "always" ? /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarVisible, _extends({}, scrollbarProps, {
10422
+ })) : context.type === "always" ? /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarVisible, _extends$1({}, scrollbarProps, {
11034
10423
  ref: forwardedRef
11035
10424
  })) : null;
11036
10425
  });
@@ -11066,7 +10455,7 @@ const $57acba87d6e25586$var$ScrollAreaScrollbarHover = /* @__PURE__ */ forwardRe
11066
10455
  ]);
11067
10456
  return /* @__PURE__ */ createElement($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
11068
10457
  present: forceMount || visible
11069
- }, /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarAuto, _extends({
10458
+ }, /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarAuto, _extends$1({
11070
10459
  "data-state": visible ? "visible" : "hidden"
11071
10460
  }, scrollbarProps, {
11072
10461
  ref: forwardedRef
@@ -11136,7 +10525,7 @@ const $57acba87d6e25586$var$ScrollAreaScrollbarScroll = /* @__PURE__ */ forwardR
11136
10525
  ]);
11137
10526
  return /* @__PURE__ */ createElement($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
11138
10527
  present: forceMount || state !== "hidden"
11139
- }, /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarVisible, _extends({
10528
+ }, /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarVisible, _extends$1({
11140
10529
  "data-state": state === "hidden" ? "hidden" : "visible"
11141
10530
  }, scrollbarProps, {
11142
10531
  ref: forwardedRef,
@@ -11166,7 +10555,7 @@ const $57acba87d6e25586$var$ScrollAreaScrollbarAuto = /* @__PURE__ */ forwardRef
11166
10555
  $57acba87d6e25586$var$useResizeObserver(context.content, handleResize);
11167
10556
  return /* @__PURE__ */ createElement($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
11168
10557
  present: forceMount || visible
11169
- }, /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarVisible, _extends({
10558
+ }, /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarVisible, _extends$1({
11170
10559
  "data-state": visible ? "visible" : "hidden"
11171
10560
  }, scrollbarProps, {
11172
10561
  ref: forwardedRef
@@ -11200,7 +10589,7 @@ const $57acba87d6e25586$var$ScrollAreaScrollbarVisible = /* @__PURE__ */ forward
11200
10589
  return $57acba87d6e25586$var$getScrollPositionFromPointer(pointerPos, pointerOffsetRef.current, sizes2, dir);
11201
10590
  }
11202
10591
  if (orientation === "horizontal")
11203
- return /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarX, _extends({}, commonProps, {
10592
+ return /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarX, _extends$1({}, commonProps, {
11204
10593
  ref: forwardedRef,
11205
10594
  onThumbPositionChange: () => {
11206
10595
  if (context.viewport && thumbRef.current) {
@@ -11219,7 +10608,7 @@ const $57acba87d6e25586$var$ScrollAreaScrollbarVisible = /* @__PURE__ */ forward
11219
10608
  }
11220
10609
  }));
11221
10610
  if (orientation === "vertical")
11222
- return /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarY, _extends({}, commonProps, {
10611
+ return /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarY, _extends$1({}, commonProps, {
11223
10612
  ref: forwardedRef,
11224
10613
  onThumbPositionChange: () => {
11225
10614
  if (context.viewport && thumbRef.current) {
@@ -11251,7 +10640,7 @@ const $57acba87d6e25586$var$ScrollAreaScrollbarX = /* @__PURE__ */ forwardRef((p
11251
10640
  }, [
11252
10641
  ref
11253
10642
  ]);
11254
- return /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarImpl, _extends({
10643
+ return /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarImpl, _extends$1({
11255
10644
  "data-orientation": "horizontal"
11256
10645
  }, scrollbarProps, {
11257
10646
  ref: composeRefs,
@@ -11299,7 +10688,7 @@ const $57acba87d6e25586$var$ScrollAreaScrollbarY = /* @__PURE__ */ forwardRef((p
11299
10688
  }, [
11300
10689
  ref
11301
10690
  ]);
11302
- return /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarImpl, _extends({
10691
+ return /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarImpl, _extends$1({
11303
10692
  "data-orientation": "vertical"
11304
10693
  }, scrollbarProps, {
11305
10694
  ref: composeRefs,
@@ -11395,7 +10784,7 @@ const $57acba87d6e25586$var$ScrollAreaScrollbarImpl = /* @__PURE__ */ forwardRef
11395
10784
  onThumbPointerUp: $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onThumbPointerUp),
11396
10785
  onThumbPositionChange: handleThumbPositionChange,
11397
10786
  onThumbPointerDown: $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onThumbPointerDown)
11398
- }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, scrollbarProps, {
10787
+ }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends$1({}, scrollbarProps, {
11399
10788
  ref: composeRefs,
11400
10789
  style: {
11401
10790
  position: "absolute",
@@ -11432,7 +10821,7 @@ const $57acba87d6e25586$export$9fba1154677d7cd2 = /* @__PURE__ */ forwardRef((pr
11432
10821
  const scrollbarContext = $57acba87d6e25586$var$useScrollbarContext($57acba87d6e25586$var$THUMB_NAME, props.__scopeScrollArea);
11433
10822
  return /* @__PURE__ */ createElement($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
11434
10823
  present: forceMount || scrollbarContext.hasThumb
11435
- }, /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaThumbImpl, _extends({
10824
+ }, /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaThumbImpl, _extends$1({
11436
10825
  ref: forwardedRef
11437
10826
  }, thumbProps)));
11438
10827
  });
@@ -11472,7 +10861,7 @@ const $57acba87d6e25586$var$ScrollAreaThumbImpl = /* @__PURE__ */ forwardRef((pr
11472
10861
  debounceScrollEnd,
11473
10862
  onThumbPositionChange
11474
10863
  ]);
11475
- return /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
10864
+ return /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends$1({
11476
10865
  "data-state": scrollbarContext.hasThumb ? "visible" : "hidden"
11477
10866
  }, thumbProps, {
11478
10867
  ref: composedRef,
@@ -11499,7 +10888,7 @@ const $57acba87d6e25586$export$56969d565df7cc4b = /* @__PURE__ */ forwardRef((pr
11499
10888
  const context = $57acba87d6e25586$var$useScrollAreaContext($57acba87d6e25586$var$CORNER_NAME, props.__scopeScrollArea);
11500
10889
  const hasBothScrollbarsVisible = Boolean(context.scrollbarX && context.scrollbarY);
11501
10890
  const hasCorner = context.type !== "scroll" && hasBothScrollbarsVisible;
11502
- return hasCorner ? /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaCornerImpl, _extends({}, props, {
10891
+ return hasCorner ? /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaCornerImpl, _extends$1({}, props, {
11503
10892
  ref: forwardedRef
11504
10893
  })) : null;
11505
10894
  });
@@ -11521,7 +10910,7 @@ const $57acba87d6e25586$var$ScrollAreaCornerImpl = /* @__PURE__ */ forwardRef((p
11521
10910
  context.onCornerWidthChange(width);
11522
10911
  setWidth(width);
11523
10912
  });
11524
- return hasSize ? /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, cornerProps, {
10913
+ return hasSize ? /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends$1({}, cornerProps, {
11525
10914
  ref: forwardedRef,
11526
10915
  style: {
11527
10916
  width: width1,
@@ -11782,7 +11171,7 @@ const $faa2e61a3361514f$export$472062a354075cee = /* @__PURE__ */ forwardRef((pr
11782
11171
  scope: props.__scopeSlider
11783
11172
  }, /* @__PURE__ */ createElement($faa2e61a3361514f$var$Collection.Slot, {
11784
11173
  scope: props.__scopeSlider
11785
- }, /* @__PURE__ */ createElement(SliderOrientation, _extends({
11174
+ }, /* @__PURE__ */ createElement(SliderOrientation, _extends$1({
11786
11175
  "aria-disabled": disabled,
11787
11176
  "data-disabled": disabled ? "" : void 0
11788
11177
  }, sliderProps, {
@@ -11864,7 +11253,7 @@ const $faa2e61a3361514f$var$SliderHorizontal = /* @__PURE__ */ forwardRef((props
11864
11253
  endEdge: isSlidingFromLeft ? "right" : "left",
11865
11254
  direction: isSlidingFromLeft ? 1 : -1,
11866
11255
  size: "width"
11867
- }, /* @__PURE__ */ createElement($faa2e61a3361514f$var$SliderImpl, _extends({
11256
+ }, /* @__PURE__ */ createElement($faa2e61a3361514f$var$SliderImpl, _extends$1({
11868
11257
  dir: direction,
11869
11258
  "data-orientation": "horizontal"
11870
11259
  }, sliderProps, {
@@ -11924,7 +11313,7 @@ const $faa2e61a3361514f$var$SliderVertical = /* @__PURE__ */ forwardRef((props,
11924
11313
  endEdge: isSlidingFromBottom ? "top" : "bottom",
11925
11314
  size: "height",
11926
11315
  direction: isSlidingFromBottom ? 1 : -1
11927
- }, /* @__PURE__ */ createElement($faa2e61a3361514f$var$SliderImpl, _extends({
11316
+ }, /* @__PURE__ */ createElement($faa2e61a3361514f$var$SliderImpl, _extends$1({
11928
11317
  "data-orientation": "vertical"
11929
11318
  }, sliderProps, {
11930
11319
  ref,
@@ -11957,7 +11346,7 @@ const $faa2e61a3361514f$var$SliderVertical = /* @__PURE__ */ forwardRef((props,
11957
11346
  const $faa2e61a3361514f$var$SliderImpl = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
11958
11347
  const { __scopeSlider, onSlideStart, onSlideMove, onSlideEnd, onHomeKeyDown, onEndKeyDown, onStepKeyDown, ...sliderProps } = props;
11959
11348
  const context = $faa2e61a3361514f$var$useSliderContext($faa2e61a3361514f$var$SLIDER_NAME, __scopeSlider);
11960
- return /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends({}, sliderProps, {
11349
+ return /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends$1({}, sliderProps, {
11961
11350
  ref: forwardedRef,
11962
11351
  onKeyDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onKeyDown, (event) => {
11963
11352
  if (event.key === "Home") {
@@ -11998,7 +11387,7 @@ const $faa2e61a3361514f$var$TRACK_NAME = "SliderTrack";
11998
11387
  const $faa2e61a3361514f$export$105594979f116971 = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
11999
11388
  const { __scopeSlider, ...trackProps } = props;
12000
11389
  const context = $faa2e61a3361514f$var$useSliderContext($faa2e61a3361514f$var$TRACK_NAME, __scopeSlider);
12001
- return /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends({
11390
+ return /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends$1({
12002
11391
  "data-disabled": context.disabled ? "" : void 0,
12003
11392
  "data-orientation": context.orientation
12004
11393
  }, trackProps, {
@@ -12018,7 +11407,7 @@ const $faa2e61a3361514f$export$a5cf38a7a000fe77 = /* @__PURE__ */ forwardRef((pr
12018
11407
  );
12019
11408
  const offsetStart = valuesCount > 1 ? Math.min(...percentages) : 0;
12020
11409
  const offsetEnd = 100 - Math.max(...percentages);
12021
- return /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends({
11410
+ return /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends$1({
12022
11411
  "data-orientation": context.orientation,
12023
11412
  "data-disabled": context.disabled ? "" : void 0
12024
11413
  }, rangeProps, {
@@ -12047,7 +11436,7 @@ const $faa2e61a3361514f$export$2c1b491743890dec = /* @__PURE__ */ forwardRef((pr
12047
11436
  thumb
12048
11437
  ]
12049
11438
  );
12050
- return /* @__PURE__ */ createElement($faa2e61a3361514f$var$SliderThumbImpl, _extends({}, props, {
11439
+ return /* @__PURE__ */ createElement($faa2e61a3361514f$var$SliderThumbImpl, _extends$1({}, props, {
12051
11440
  ref: composedRefs,
12052
11441
  index: index2
12053
11442
  }));
@@ -12086,7 +11475,7 @@ const $faa2e61a3361514f$var$SliderThumbImpl = /* @__PURE__ */ forwardRef((props,
12086
11475
  }
12087
11476
  }, /* @__PURE__ */ createElement($faa2e61a3361514f$var$Collection.ItemSlot, {
12088
11477
  scope: props.__scopeSlider
12089
- }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends({
11478
+ }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends$1({
12090
11479
  role: "slider",
12091
11480
  "aria-label": props["aria-label"] || label,
12092
11481
  "aria-valuemin": context.min,
@@ -12126,7 +11515,7 @@ const $faa2e61a3361514f$var$BubbleInput = (props) => {
12126
11515
  prevValue,
12127
11516
  value
12128
11517
  ]);
12129
- return /* @__PURE__ */ createElement("input", _extends({
11518
+ return /* @__PURE__ */ createElement("input", _extends$1({
12130
11519
  style: {
12131
11520
  display: "none"
12132
11521
  }
@@ -12345,7 +11734,7 @@ const $cddcb0b647441e34$export$e2255cf6045e8d47 = /* @__PURE__ */ forwardRef((pr
12345
11734
  scope: __scopeAvatar,
12346
11735
  imageLoadingStatus,
12347
11736
  onImageLoadingStatusChange: setImageLoadingStatus
12348
- }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends({}, avatarProps, {
11737
+ }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends$1({}, avatarProps, {
12349
11738
  ref: forwardedRef
12350
11739
  })));
12351
11740
  });
@@ -12366,7 +11755,7 @@ const $cddcb0b647441e34$export$2cd8ae1985206fe8 = /* @__PURE__ */ forwardRef((pr
12366
11755
  imageLoadingStatus,
12367
11756
  handleLoadingStatusChange
12368
11757
  ]);
12369
- return imageLoadingStatus === "loaded" ? /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.img, _extends({}, imageProps, {
11758
+ return imageLoadingStatus === "loaded" ? /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.img, _extends$1({}, imageProps, {
12370
11759
  ref: forwardedRef,
12371
11760
  src
12372
11761
  })) : null;
@@ -12387,7 +11776,7 @@ const $cddcb0b647441e34$export$69fffb6a9571fbfe = /* @__PURE__ */ forwardRef((pr
12387
11776
  }, [
12388
11777
  delayMs
12389
11778
  ]);
12390
- 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, {
12391
11780
  ref: forwardedRef
12392
11781
  })) : null;
12393
11782
  });
@@ -12491,7 +11880,7 @@ const $69cb30bb0017df05$export$b2539bed5023c21c = /* @__PURE__ */ forwardRef((pr
12491
11880
  orientation,
12492
11881
  dir: direction,
12493
11882
  activationMode
12494
- }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
11883
+ }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends$1({
12495
11884
  dir: direction,
12496
11885
  "data-orientation": orientation
12497
11886
  }, tabsProps, {
@@ -12503,13 +11892,13 @@ const $69cb30bb0017df05$export$9712d22edc0d78c1 = /* @__PURE__ */ forwardRef((pr
12503
11892
  const { __scopeTabs, loop = true, ...listProps } = props;
12504
11893
  const context = $69cb30bb0017df05$var$useTabsContext($69cb30bb0017df05$var$TAB_LIST_NAME, __scopeTabs);
12505
11894
  const rovingFocusGroupScope = $69cb30bb0017df05$var$useRovingFocusGroupScope(__scopeTabs);
12506
- return /* @__PURE__ */ createElement($d7bdfb9eb0fdf311$export$be92b6f5f03c0fe9, _extends({
11895
+ return /* @__PURE__ */ createElement($d7bdfb9eb0fdf311$export$be92b6f5f03c0fe9, _extends$1({
12507
11896
  asChild: true
12508
11897
  }, rovingFocusGroupScope, {
12509
11898
  orientation: context.orientation,
12510
11899
  dir: context.dir,
12511
11900
  loop
12512
- }), /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
11901
+ }), /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends$1({
12513
11902
  role: "tablist",
12514
11903
  "aria-orientation": context.orientation
12515
11904
  }, listProps, {
@@ -12524,12 +11913,12 @@ const $69cb30bb0017df05$export$8114b9fdfdf9f3ba = /* @__PURE__ */ forwardRef((pr
12524
11913
  const triggerId = $69cb30bb0017df05$var$makeTriggerId(context.baseId, value);
12525
11914
  const contentId = $69cb30bb0017df05$var$makeContentId(context.baseId, value);
12526
11915
  const isSelected = value === context.value;
12527
- return /* @__PURE__ */ createElement($d7bdfb9eb0fdf311$export$6d08773d2e66f8f2, _extends({
11916
+ return /* @__PURE__ */ createElement($d7bdfb9eb0fdf311$export$6d08773d2e66f8f2, _extends$1({
12528
11917
  asChild: true
12529
11918
  }, rovingFocusGroupScope, {
12530
11919
  focusable: !disabled,
12531
11920
  active: isSelected
12532
- }), /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.button, _extends({
11921
+ }), /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.button, _extends$1({
12533
11922
  type: "button",
12534
11923
  role: "tab",
12535
11924
  "aria-selected": isSelected,
@@ -12579,7 +11968,7 @@ const $69cb30bb0017df05$export$bd905d70e8fd2ebb = /* @__PURE__ */ forwardRef((pr
12579
11968
  {
12580
11969
  present: forceMount || isSelected
12581
11970
  },
12582
- ({ present }) => /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
11971
+ ({ present }) => /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends$1({
12583
11972
  "data-state": isSelected ? "active" : "inactive",
12584
11973
  "data-orientation": context.orientation,
12585
11974
  role: "tabpanel",
@@ -12639,6 +12028,260 @@ const Tabs = Object.assign({}, {
12639
12028
  Trigger: TabsTrigger,
12640
12029
  Content: TabsContent
12641
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;
12642
12285
  const NumberInput = memo((props) => {
12643
12286
  const [{ inputId, labelId, size, severity, showInputOnly, field, fieldProps }, rest] = useFormikInput(props);
12644
12287
  let [{ helpText, label }] = useFormikInput(props);
@@ -13744,7 +13387,7 @@ const QrInput = memo((props) => {
13744
13387
  ] }),
13745
13388
  value && /* @__PURE__ */ jsx(Text, { color: "jade", size: "1", children: /* @__PURE__ */ jsx(RiIcon, { icon: "RiCheckLine", style: { verticalAlign: "bottom" } }) })
13746
13389
  ] }),
13747
- 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: [
13748
13391
  /* @__PURE__ */ jsx(Code, { color: "gray", highContrast: true, children: value }),
13749
13392
  /* @__PURE__ */ jsx(
13750
13393
  IconButton,
@@ -13784,9 +13427,7 @@ const QrScanner = memo((props) => {
13784
13427
  }
13785
13428
  );
13786
13429
  setIsScannerLoading(true);
13787
- qrScanner.start().then(() => {
13788
- setIsScannerLoading(false);
13789
- }).catch(() => {
13430
+ void qrScanner.start().finally(() => {
13790
13431
  setIsScannerLoading(false);
13791
13432
  });
13792
13433
  }, [onQrScan]);
@@ -16184,7 +15825,7 @@ const FieldBuilder = memo((props) => {
16184
15825
  {
16185
15826
  name: `${parentPath}.${index2}.required`,
16186
15827
  render: ({ setValue, value }) => /* @__PURE__ */ jsx(
16187
- Checkbox,
15828
+ Checkbox$1,
16188
15829
  {
16189
15830
  checked: value,
16190
15831
  onCheckedChange: setValue,
@@ -16948,7 +16589,7 @@ const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
16948
16589
  export {
16949
16590
  APIError,
16950
16591
  AgentService,
16951
- AttachmentService,
16592
+ AttachmentModel,
16952
16593
  AuthService,
16953
16594
  BaseApiService,
16954
16595
  BaseField,
@@ -16959,17 +16600,19 @@ export {
16959
16600
  ColorPicker,
16960
16601
  Colors,
16961
16602
  ColorsToString,
16603
+ ComponentAttachmentService,
16962
16604
  ComponentService,
16963
16605
  ComponentStageColors,
16964
16606
  ComponentStageCompletionService,
16965
16607
  ComponentStageService,
16608
+ ComponentTypeAttachmentService,
16966
16609
  ComponentTypeService,
16967
16610
  DEFAULT_ISSUE_PRIORITY,
16968
16611
  DEFAULT_ISSUE_STATUS,
16969
16612
  DateField,
16970
16613
  DateInput,
16614
+ DocumentAttachmentService,
16971
16615
  DocumentService,
16972
- DocumentTeamLinkService,
16973
16616
  EmailDomainsService,
16974
16617
  EmailVerificationService,
16975
16618
  FieldSection,
@@ -16992,6 +16635,7 @@ export {
16992
16635
  InputWithHelpText,
16993
16636
  InputWithLabel,
16994
16637
  InputWithLabelAndHelpText,
16638
+ IssueAttachmentService,
16995
16639
  IssueCommentService,
16996
16640
  IssuePriority,
16997
16641
  IssueService,
@@ -17024,6 +16668,7 @@ export {
17024
16668
  PatchFormProvider,
17025
16669
  ProjectAccessLevel,
17026
16670
  ProjectAccessService,
16671
+ ProjectAttachmentService,
17027
16672
  ProjectFileService,
17028
16673
  ProjectService,
17029
16674
  ProjectType,
@@ -17063,7 +16708,6 @@ export {
17063
16708
  addComponentsInBatches,
17064
16709
  addDocumentAttachment,
17065
16710
  addDocumentAttachments,
17066
- addDocumentTeamLink,
17067
16711
  addDocuments,
17068
16712
  addEmailDomain,
17069
16713
  addFavouriteProjectId,
@@ -17083,7 +16727,6 @@ export {
17083
16727
  addIssueComment,
17084
16728
  addIssueComments,
17085
16729
  addIssueType,
17086
- addIssueTypeTeamLink,
17087
16730
  addIssueUpdate,
17088
16731
  addIssueUpdates,
17089
16732
  addIssues,
@@ -17101,7 +16744,6 @@ export {
17101
16744
  addStages,
17102
16745
  addTeam,
17103
16746
  addToRecentIssues,
17104
- addUserFormTeamLink,
17105
16747
  addUsers,
17106
16748
  addWorkspace,
17107
16749
  areArraysEqual,
@@ -17133,8 +16775,6 @@ export {
17133
16775
  defaultBadgeColor,
17134
16776
  defaultStore,
17135
16777
  deleteComponentType,
17136
- deleteDocumentTeamLink,
17137
- deleteDocumentTeamLinks,
17138
16778
  deleteForm,
17139
16779
  deleteFormRevision,
17140
16780
  deleteFormRevisionAttachment,
@@ -17144,19 +16784,13 @@ export {
17144
16784
  deleteFormSubmissionAttachment,
17145
16785
  deleteFormSubmissionAttachments,
17146
16786
  deleteFormSubmissions,
17147
- deleteIssueTypeTeamLink,
17148
- deleteIssueTypeTeamLinks,
17149
16787
  deleteProject,
17150
16788
  deleteTeam,
17151
- deleteUserFormTeamLink,
17152
- deleteUserFormTeamLinks,
17153
16789
  dequeue,
17154
16790
  deserialize,
17155
16791
  deserializeField,
17156
16792
  discard,
17157
16793
  documentSlice,
17158
- documentTeamLinkReducer,
17159
- documentTeamLinkSlice,
17160
16794
  documentsReducer,
17161
16795
  downloadFile,
17162
16796
  downloadInMemoryFile,
@@ -17209,8 +16843,6 @@ export {
17209
16843
  issueToSearchResult,
17210
16844
  issueTypeReducer,
17211
16845
  issueTypeSlice,
17212
- issueTypeTeamLinkReducer,
17213
- issueTypeTeamLinkSlice,
17214
16846
  licenseReducer,
17215
16847
  licenseSlice,
17216
16848
  linkStageToForm,
@@ -17267,6 +16899,7 @@ export {
17267
16899
  removeFavouriteProjectId,
17268
16900
  removeIssue,
17269
16901
  removeIssueAttachment,
16902
+ removeIssueAttachments,
17270
16903
  removeIssueComment,
17271
16904
  removeIssueComments,
17272
16905
  removeIssueType,
@@ -17360,12 +16993,7 @@ export {
17360
16993
  selectDocument,
17361
16994
  selectDocumentAttachment,
17362
16995
  selectDocumentAttachmentMapping,
17363
- selectDocumentTeamLinks,
17364
- selectDocumentTeamLinksMapping,
17365
- selectDocumentTeamLinksOfDocument,
17366
- selectDocumentTeamLinksOfTeam,
17367
16996
  selectDocuments,
17368
- selectDocumentsLinkedToTeam,
17369
16997
  selectDocumentsMapping,
17370
16998
  selectEmailDomainsAsMapping,
17371
16999
  selectEnableClustering,
@@ -17411,12 +17039,7 @@ export {
17411
17039
  selectIssueMapping,
17412
17040
  selectIssueType,
17413
17041
  selectIssueTypeMapping,
17414
- selectIssueTypeTeamLinkMapping,
17415
- selectIssueTypeTeamLinks,
17416
- selectIssueTypeTeamLinksOfIssueType,
17417
- selectIssueTypeTeamLinksOfTeam,
17418
17042
  selectIssueTypes,
17419
- selectIssueTypesLinkedToTeam,
17420
17043
  selectIssueTypesOfOrganization,
17421
17044
  selectIssueUpdateMapping,
17422
17045
  selectIssueUpdatesOfIssue,
@@ -17451,6 +17074,7 @@ export {
17451
17074
  selectProjectAccessForUser,
17452
17075
  selectProjectAccessUserMapping,
17453
17076
  selectProjectAccesses,
17077
+ selectProjectAttachment,
17454
17078
  selectProjectAttachmentMapping,
17455
17079
  selectProjectFileVisibility,
17456
17080
  selectProjectFiles,
@@ -17479,21 +17103,13 @@ export {
17479
17103
  selectStagesFromStageIds,
17480
17104
  selectTeam,
17481
17105
  selectTeams,
17482
- selectTeamsLinkedToDocument,
17483
- selectTeamsLinkedToIssueType,
17484
- selectTeamsLinkedToUserForm,
17485
17106
  selectTeamsMapping,
17486
17107
  selectTeamsOfOrganization,
17487
17108
  selectTeamsOfUser,
17488
17109
  selectUploadUrl,
17489
17110
  selectUsedColors,
17490
17111
  selectUser,
17491
- selectUserFormLinksOfForm,
17492
- selectUserFormLinksOfTeam,
17493
17112
  selectUserFormRevisionAttachmentsMapping,
17494
- selectUserFormTeamLinkMapping,
17495
- selectUserFormTeamLinks,
17496
- selectUserFormsLinkedToTeam,
17497
17113
  selectUsersAsMapping,
17498
17114
  selectVisibleStatuses,
17499
17115
  selectVisibleUserIds,
@@ -17508,15 +17124,16 @@ export {
17508
17124
  setAppearance,
17509
17125
  setCategories,
17510
17126
  setCenterMapToProject,
17127
+ setComponentAttachment,
17511
17128
  setComponentAttachments,
17129
+ setComponentTypeAttachment,
17512
17130
  setComponentTypeAttachments,
17513
17131
  setComponentTypes,
17514
17132
  setComponents,
17515
17133
  setCreateProjectType,
17516
17134
  setCurrentUser,
17135
+ setDocumentAttachment,
17517
17136
  setDocumentAttachments,
17518
- setDocumentTeamLink,
17519
- setDocumentTeamLinks,
17520
17137
  setDocuments,
17521
17138
  setEmailDomains,
17522
17139
  setEnableClustering,
@@ -17532,12 +17149,11 @@ export {
17532
17149
  setIsFetchingInitialData,
17533
17150
  setIsImportingProjectFile,
17534
17151
  setIsLoading,
17152
+ setIssueAttachment,
17535
17153
  setIssueAttachments,
17536
17154
  setIssueComment,
17537
17155
  setIssueComments,
17538
17156
  setIssueType,
17539
- setIssueTypeTeamLink,
17540
- setIssueTypeTeamLinks,
17541
17157
  setIssueTypes,
17542
17158
  setIssueUpdates,
17543
17159
  setIssues,
@@ -17548,6 +17164,7 @@ export {
17548
17164
  setOrganizations,
17549
17165
  setProfilePicture,
17550
17166
  setProjectAccesses,
17167
+ setProjectAttachment,
17551
17168
  setProjectAttachments,
17552
17169
  setProjectFileVisible,
17553
17170
  setProjects,
@@ -17559,8 +17176,6 @@ export {
17559
17176
  setTokens,
17560
17177
  setTourStep,
17561
17178
  setUploadUrl,
17562
- setUserFormTeamLink,
17563
- setUserFormTeamLinks,
17564
17179
  setUsers,
17565
17180
  setVisibleStatuses,
17566
17181
  setVisibleUserIds,
@@ -17584,20 +17199,25 @@ export {
17584
17199
  updateActiveOrganization,
17585
17200
  updateComponent,
17586
17201
  updateComponentAttachment,
17202
+ updateComponentAttachments,
17587
17203
  updateComponentTypeAttachment,
17204
+ updateComponentTypeAttachments,
17588
17205
  updateDocumentAttachment,
17206
+ updateDocumentAttachments,
17589
17207
  updateDocuments,
17590
17208
  updateFormSubmission,
17591
17209
  updateFormSubmissionAttachments,
17592
17210
  updateFormSubmissions,
17593
17211
  updateIssue,
17594
17212
  updateIssueAttachment,
17213
+ updateIssueAttachments,
17595
17214
  updateIssueType,
17596
17215
  updateLicense,
17597
17216
  updateOrCreateProject,
17598
17217
  updateOrganizationAccess,
17599
17218
  updateProjectAccess,
17600
17219
  updateProjectAttachment,
17220
+ updateProjectAttachments,
17601
17221
  updateStages,
17602
17222
  updateTeam,
17603
17223
  useAppDispatch,
@@ -17609,8 +17229,6 @@ export {
17609
17229
  useFormikInput,
17610
17230
  useMemoCompare,
17611
17231
  useSDK,
17612
- userFormTeamLinkReducer,
17613
- userFormTeamLinkSlice,
17614
17232
  userReducer,
17615
17233
  userSlice,
17616
17234
  valueIsFile,