@overmap-ai/core 1.0.53-add-agent-conversations.10 → 1.0.53-add-agent-conversations.12

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.
@@ -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";
@@ -1578,6 +1578,9 @@ const selectIssueCountOfCategory = (categoryId) => (state) => {
1578
1578
  return Object.values(state.issueReducer.issues).filter((issue) => issue.category === categoryId).length;
1579
1579
  };
1580
1580
  const categoryReducer = categorySlice.reducer;
1581
+ function setAttachment(state, action) {
1582
+ state.attachments[action.payload.offline_id] = action.payload;
1583
+ }
1581
1584
  function setAttachments(state, action) {
1582
1585
  state.attachments = {};
1583
1586
  for (const attachment of action.payload) {
@@ -1602,6 +1605,15 @@ function updateAttachment(state, action) {
1602
1605
  throw new Error(`Attachment ${action.payload.offline_id} does not exist.`);
1603
1606
  }
1604
1607
  }
1608
+ function updateAttachments(state, action) {
1609
+ for (const attachment of action.payload) {
1610
+ if (attachment.offline_id in state.attachments) {
1611
+ state.attachments[attachment.offline_id] = attachment;
1612
+ } else {
1613
+ throw new Error(`Attachment ${attachment.offline_id} does not exist.`);
1614
+ }
1615
+ }
1616
+ }
1605
1617
  function removeAttachment(state, action) {
1606
1618
  if (action.payload in state.attachments) {
1607
1619
  delete state.attachments[action.payload];
@@ -1635,12 +1647,6 @@ const componentSlice = createSlice({
1635
1647
  state.components = toOfflineIdRecord(action.payload);
1636
1648
  prevComponents = null;
1637
1649
  },
1638
- setComponentAttachments: setAttachments,
1639
- addComponentAttachment: addAttachment,
1640
- addComponentAttachments: addAttachments,
1641
- updateComponentAttachment: updateAttachment,
1642
- removeComponentAttachment: removeAttachment,
1643
- removeComponentAttachments: removeAttachments,
1644
1650
  updateComponent: (state, action) => {
1645
1651
  if (action.payload.offline_id in state.components) {
1646
1652
  state.components[action.payload.offline_id] = action.payload;
@@ -1665,9 +1671,35 @@ const componentSlice = createSlice({
1665
1671
  }
1666
1672
  }
1667
1673
  prevComponents = null;
1668
- }
1674
+ },
1675
+ // Attachments
1676
+ setComponentAttachment: setAttachment,
1677
+ setComponentAttachments: setAttachments,
1678
+ addComponentAttachment: addAttachment,
1679
+ addComponentAttachments: addAttachments,
1680
+ updateComponentAttachment: updateAttachment,
1681
+ updateComponentAttachments: updateAttachments,
1682
+ removeComponentAttachment: removeAttachment,
1683
+ removeComponentAttachments: removeAttachments
1669
1684
  }
1670
1685
  });
1686
+ const {
1687
+ addComponent,
1688
+ updateComponent,
1689
+ removeComponent,
1690
+ addComponentsInBatches,
1691
+ setComponents,
1692
+ removeAllComponentsOfType,
1693
+ // Attachments
1694
+ setComponentAttachment,
1695
+ setComponentAttachments,
1696
+ addComponentAttachment,
1697
+ addComponentAttachments,
1698
+ updateComponentAttachment,
1699
+ updateComponentAttachments,
1700
+ removeComponentAttachment,
1701
+ removeComponentAttachments
1702
+ } = componentSlice.actions;
1671
1703
  let prevComponents = null;
1672
1704
  const selectComponents = (state) => {
1673
1705
  if (!prevComponents) {
@@ -1762,20 +1794,6 @@ const selectAttachmentsOfComponentByType = restructureCreateSelectorWithArgs(
1762
1794
  }
1763
1795
  )
1764
1796
  );
1765
- const {
1766
- addComponent,
1767
- updateComponent,
1768
- removeComponent,
1769
- addComponentsInBatches,
1770
- setComponents,
1771
- setComponentAttachments,
1772
- addComponentAttachment,
1773
- addComponentAttachments,
1774
- updateComponentAttachment,
1775
- removeComponentAttachment,
1776
- removeComponentAttachments,
1777
- removeAllComponentsOfType
1778
- } = componentSlice.actions;
1779
1797
  const componentReducer = componentSlice.reducer;
1780
1798
  const initialState$p = {
1781
1799
  completionsByComponentId: {}
@@ -1966,20 +1984,38 @@ const componentTypeSlice = createSlice({
1966
1984
  setComponentTypes: (state, action) => {
1967
1985
  state.componentTypes = toOfflineIdRecord(action.payload);
1968
1986
  },
1969
- setComponentTypeAttachments: setAttachments,
1970
- addComponentTypeAttachment: addAttachment,
1971
- addComponentTypeAttachments: addAttachments,
1972
- updateComponentTypeAttachment: updateAttachment,
1973
- removeComponentTypeAttachment: removeAttachment,
1974
- removeComponentTypeAttachments: removeAttachments,
1975
1987
  toggleComponentTypeVisibility: (state, action) => {
1976
1988
  state.hiddenComponentTypeIds[action.payload] = !state.hiddenComponentTypeIds[action.payload];
1977
1989
  },
1978
1990
  deleteComponentType: (state, action) => {
1979
1991
  delete state.componentTypes[action.payload];
1980
- }
1992
+ },
1993
+ // Attachments
1994
+ setComponentTypeAttachment: setAttachment,
1995
+ setComponentTypeAttachments: setAttachments,
1996
+ addComponentTypeAttachment: addAttachment,
1997
+ addComponentTypeAttachments: addAttachments,
1998
+ updateComponentTypeAttachment: updateAttachment,
1999
+ updateComponentTypeAttachments: updateAttachments,
2000
+ removeComponentTypeAttachment: removeAttachment,
2001
+ removeComponentTypeAttachments: removeAttachments
1981
2002
  }
1982
2003
  });
2004
+ const {
2005
+ addComponentType,
2006
+ setComponentTypes,
2007
+ toggleComponentTypeVisibility,
2008
+ deleteComponentType,
2009
+ // Attachmet
2010
+ setComponentTypeAttachment,
2011
+ setComponentTypeAttachments,
2012
+ addComponentTypeAttachment,
2013
+ addComponentTypeAttachments,
2014
+ updateComponentTypeAttachment,
2015
+ updateComponentTypeAttachments,
2016
+ removeComponentTypeAttachment,
2017
+ removeComponentTypeAttachments
2018
+ } = componentTypeSlice.actions;
1983
2019
  const selectComponentTypesMapping = (state) => state.componentTypeReducer.componentTypes;
1984
2020
  const selectComponentTypes = createSelector(
1985
2021
  [selectComponentTypesMapping],
@@ -2056,18 +2092,6 @@ const selectAttachmentsOfComponentTypeByType = restructureCreateSelectorWithArgs
2056
2092
  }
2057
2093
  )
2058
2094
  );
2059
- const {
2060
- addComponentType,
2061
- setComponentTypes,
2062
- setComponentTypeAttachments,
2063
- addComponentTypeAttachment,
2064
- addComponentTypeAttachments,
2065
- updateComponentTypeAttachment,
2066
- removeComponentTypeAttachment,
2067
- removeComponentTypeAttachments,
2068
- toggleComponentTypeVisibility,
2069
- deleteComponentType
2070
- } = componentTypeSlice.actions;
2071
2095
  const componentTypeReducer = componentTypeSlice.reducer;
2072
2096
  const initialState$m = {
2073
2097
  workspaces: {},
@@ -2157,7 +2181,6 @@ const issueSlice = createSlice({
2157
2181
  state.issues[issue.offline_id] = issue;
2158
2182
  });
2159
2183
  },
2160
- setIssueAttachments: setAttachments,
2161
2184
  setIssueUpdates: (state, action) => {
2162
2185
  if (action.payload.filter(onlyUniqueOfflineIds).length !== action.payload.length) {
2163
2186
  throw new Error("Tried to use setIssues reducer with duplicate ID's");
@@ -2187,8 +2210,6 @@ const issueSlice = createSlice({
2187
2210
  state.issues[issue.offline_id] = issue;
2188
2211
  }
2189
2212
  },
2190
- addIssueAttachment: addAttachment,
2191
- addIssueAttachments: addAttachments,
2192
2213
  addIssueUpdate: (state, action) => {
2193
2214
  if (action.payload.offline_id in state.updates) {
2194
2215
  throw new Error(`Tried to add duplicate issue update with offline_id: ${action.payload.offline_id}`);
@@ -2210,7 +2231,6 @@ const issueSlice = createSlice({
2210
2231
  throw new Error(`Tried to update issue with ID that doesn't exist: ${action.payload.offline_id}`);
2211
2232
  }
2212
2233
  },
2213
- updateIssueAttachment: updateAttachment,
2214
2234
  removeIssue: (state, action) => {
2215
2235
  if (action.payload in state.issues) {
2216
2236
  delete state.issues[action.payload];
@@ -2223,7 +2243,6 @@ const issueSlice = createSlice({
2223
2243
  delete state.issues[issueId];
2224
2244
  }
2225
2245
  },
2226
- removeIssueAttachment: removeAttachment,
2227
2246
  removeIssueUpdate: (state, action) => {
2228
2247
  if (action.payload in state.updates) {
2229
2248
  delete state.updates[action.payload];
@@ -2320,12 +2339,19 @@ const issueSlice = createSlice({
2320
2339
  if (indexToRemove !== -1) {
2321
2340
  state.recentIssueIds.splice(indexToRemove, 1);
2322
2341
  }
2323
- }
2342
+ },
2343
+ // Attachments
2344
+ setIssueAttachment: setAttachment,
2345
+ setIssueAttachments: setAttachments,
2346
+ addIssueAttachment: addAttachment,
2347
+ addIssueAttachments: addAttachments,
2348
+ updateIssueAttachment: updateAttachment,
2349
+ updateIssueAttachments: updateAttachments,
2350
+ removeIssueAttachment: removeAttachment,
2351
+ removeIssueAttachments: removeAttachments
2324
2352
  }
2325
2353
  });
2326
2354
  const {
2327
- addIssueAttachment,
2328
- addIssueAttachments,
2329
2355
  addIssue,
2330
2356
  addIssues,
2331
2357
  addIssueUpdate,
@@ -2333,7 +2359,6 @@ const {
2333
2359
  addOrReplaceIssueComment,
2334
2360
  addToRecentIssues,
2335
2361
  cleanRecentIssues,
2336
- removeIssueAttachment,
2337
2362
  removeAttachmentsOfIssue,
2338
2363
  removeIssue,
2339
2364
  removeIssues,
@@ -2342,13 +2367,20 @@ const {
2342
2367
  removeRecentIssue,
2343
2368
  resetRecentIssues,
2344
2369
  setActiveIssueId,
2345
- setIssueAttachments,
2346
2370
  setIssueUpdates,
2347
2371
  setIssues,
2348
2372
  setVisibleStatuses,
2349
2373
  setVisibleUserIds,
2350
- updateIssueAttachment,
2351
2374
  updateIssue,
2375
+ // Attachments
2376
+ setIssueAttachment,
2377
+ setIssueAttachments,
2378
+ addIssueAttachment,
2379
+ addIssueAttachments,
2380
+ updateIssueAttachment,
2381
+ updateIssueAttachments,
2382
+ removeIssueAttachment,
2383
+ removeIssueAttachments,
2352
2384
  // Commments
2353
2385
  addIssueComment,
2354
2386
  addIssueComments,
@@ -2717,6 +2749,14 @@ var OrganizationAccessLevel = /* @__PURE__ */ ((OrganizationAccessLevel2) => {
2717
2749
  OrganizationAccessLevel2[OrganizationAccessLevel2["ADMIN"] = 2] = "ADMIN";
2718
2750
  return OrganizationAccessLevel2;
2719
2751
  })(OrganizationAccessLevel || {});
2752
+ var AttachmentModel = /* @__PURE__ */ ((AttachmentModel2) => {
2753
+ AttachmentModel2["Issue"] = "issue";
2754
+ AttachmentModel2["Component"] = "component";
2755
+ AttachmentModel2["ComponentType"] = "component_type";
2756
+ AttachmentModel2["Project"] = "project";
2757
+ AttachmentModel2["Document"] = "document";
2758
+ return AttachmentModel2;
2759
+ })(AttachmentModel || {});
2720
2760
  var IssueUpdateChange = /* @__PURE__ */ ((IssueUpdateChange2) => {
2721
2761
  IssueUpdateChange2["STATUS"] = "status";
2722
2762
  IssueUpdateChange2["PRIORITY"] = "priority";
@@ -3104,11 +3144,13 @@ const projectSlice = createSlice({
3104
3144
  throw new Error("Update form submissions count: no active project");
3105
3145
  }
3106
3146
  },
3107
- // Attachment related
3147
+ // Attachments
3148
+ setProjectAttachment: setAttachment,
3108
3149
  setProjectAttachments: setAttachments,
3109
3150
  addProjectAttachment: addAttachment,
3110
3151
  addProjectAttachments: addAttachments,
3111
3152
  updateProjectAttachment: updateAttachment,
3153
+ updateProjectAttachments: updateAttachments,
3112
3154
  removeProjectAttachment: removeAttachment,
3113
3155
  removeProjectAttachments: removeAttachments
3114
3156
  }
@@ -3123,11 +3165,13 @@ const {
3123
3165
  acceptProjectInvite,
3124
3166
  addActiveProjectIssuesCount,
3125
3167
  addActiveProjectFormSubmissionsCount,
3126
- // Attachment related
3168
+ // Attachments
3169
+ setProjectAttachment,
3127
3170
  setProjectAttachments,
3128
3171
  addProjectAttachment,
3129
3172
  addProjectAttachments,
3130
3173
  updateProjectAttachment,
3174
+ updateProjectAttachments,
3131
3175
  removeProjectAttachment,
3132
3176
  removeProjectAttachments
3133
3177
  } = projectSlice.actions;
@@ -3198,6 +3242,9 @@ const selectAllProjectAttachments = createSelector(
3198
3242
  [selectProjectAttachmentMapping],
3199
3243
  (mapping) => Object.values(mapping)
3200
3244
  );
3245
+ const selectProjectAttachment = (attachmentId) => (state) => {
3246
+ return state.projectReducer.attachments[attachmentId];
3247
+ };
3201
3248
  const selectAttachmentsOfProject = restructureCreateSelectorWithArgs(
3202
3249
  createSelector(
3203
3250
  [selectAllProjectAttachments, (_state, projectId) => projectId],
@@ -4313,10 +4360,13 @@ const documentSlice = createSlice({
4313
4360
  delete state.documents[documentId];
4314
4361
  }
4315
4362
  },
4363
+ // Attachments
4364
+ setDocumentAttachment: setAttachment,
4316
4365
  setDocumentAttachments: setAttachments,
4317
4366
  addDocumentAttachment: addAttachment,
4318
4367
  addDocumentAttachments: addAttachments,
4319
4368
  updateDocumentAttachment: updateAttachment,
4369
+ updateDocumentAttachments: updateAttachments,
4320
4370
  removeDocumentAttachment: removeAttachment,
4321
4371
  removeDocumentAttachments: removeAttachments
4322
4372
  }
@@ -4327,10 +4377,13 @@ const {
4327
4377
  updateDocuments,
4328
4378
  moveDocument,
4329
4379
  removeDocuments,
4380
+ // Attachments
4381
+ setDocumentAttachment,
4330
4382
  setDocumentAttachments,
4331
4383
  addDocumentAttachment,
4332
4384
  addDocumentAttachments,
4333
4385
  updateDocumentAttachment,
4386
+ updateDocumentAttachments,
4334
4387
  removeDocumentAttachment,
4335
4388
  removeDocumentAttachments
4336
4389
  } = documentSlice.actions;
@@ -5069,635 +5122,88 @@ class BaseApiService {
5069
5122
  return promise;
5070
5123
  }
5071
5124
  }
5072
- class AttachmentService extends BaseApiService {
5073
- fetchAll(projectId) {
5074
- const promise = this.enqueueRequest({
5075
- description: "Fetch attachments",
5076
- method: HttpMethod.GET,
5077
- url: `/attachments/${projectId}/`,
5078
- blocks: [],
5079
- blockers: []
5080
- });
5081
- const state = this.client.store.getState();
5082
- const allAttachments = {
5083
- issue_attachments: Object.values(state.issueReducer.attachments),
5084
- component_attachments: Object.values(state.componentReducer.attachments),
5085
- component_type_attachments: Object.values(state.componentTypeReducer.attachments),
5086
- project_attachments: Object.values(state.projectReducer.attachments),
5087
- document_attachments: Object.values(state.documentsReducer.attachments)
5088
- };
5089
- return [allAttachments, promise];
5090
- }
5091
- // Attachments aren't models, so we use the OptimisticGenericResult type instead
5092
- async addIssueAttachment(attachmentPayload) {
5093
- const { issue, file_sha1, offline_id } = attachmentPayload;
5094
- if (!attachmentPayload.file.objectURL) {
5095
- throw new Error("Expected attachmentPayload.file.objectURL to be defined.");
5096
- }
5097
- const offlineAttachment = {
5098
- ...attachmentPayload,
5099
- file: attachmentPayload.file.objectURL,
5100
- file_name: attachmentPayload.file.name,
5101
- file_type: attachmentPayload.file.type,
5102
- submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
5103
- created_by: this.client.store.getState().userReducer.currentUser.id
5104
- };
5105
- await this.client.files.addCache(attachmentPayload.file, file_sha1);
5106
- this.client.store.dispatch(addIssueAttachment(offlineAttachment));
5107
- const [fileProps] = await this.client.files.uploadFileToS3(file_sha1);
5108
- const promise = this.enqueueRequest({
5109
- description: "Create attachment",
5110
- method: HttpMethod.POST,
5111
- url: `/issues/${issue}/attach/`,
5112
- blocks: [offline_id, issue],
5113
- blockers: [file_sha1],
5114
- payload: {
5115
- ...offlineAttachment,
5116
- ...fileProps
5117
- }
5118
- });
5119
- promise.catch((error2) => {
5120
- this.client.store.dispatch(removeIssueAttachment(offlineAttachment.offline_id));
5121
- throw error2;
5122
- });
5123
- return [offlineAttachment, promise];
5124
- }
5125
- async addComponentAttachment(attachmentPayload) {
5126
- const { component, file_sha1, offline_id } = attachmentPayload;
5127
- if (!attachmentPayload.file.objectURL) {
5128
- throw new Error("Expected attachmentPayload.file.objectURL to be defined.");
5129
- }
5130
- const offlineAttachment = {
5131
- ...attachmentPayload,
5132
- file: attachmentPayload.file.objectURL,
5133
- file_name: attachmentPayload.file.name,
5134
- file_type: attachmentPayload.file.type,
5135
- submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
5136
- created_by: this.client.store.getState().userReducer.currentUser.id
5137
- };
5138
- await this.client.files.addCache(attachmentPayload.file, file_sha1);
5139
- this.client.store.dispatch(addComponentAttachment(offlineAttachment));
5140
- const [fileProps] = await this.client.files.uploadFileToS3(file_sha1);
5141
- const promise = this.enqueueRequest({
5142
- description: "Create attachment",
5143
- method: HttpMethod.POST,
5144
- url: `/components/${component}/attach/`,
5145
- blocks: [offline_id, component],
5146
- blockers: [file_sha1],
5147
- payload: {
5148
- ...offlineAttachment,
5149
- ...fileProps
5150
- }
5151
- });
5152
- promise.catch((error2) => {
5153
- this.client.store.dispatch(removeComponentAttachment(offlineAttachment.offline_id));
5154
- throw error2;
5155
- });
5156
- return [offlineAttachment, promise];
5157
- }
5158
- async addComponentTypeAttachment(attachmentPayload) {
5159
- const { component_type, file_sha1, offline_id } = attachmentPayload;
5160
- if (!attachmentPayload.file.objectURL) {
5161
- throw new Error("Expected attachmentPayload.file.objectURL to be defined.");
5162
- }
5163
- const offlineAttachment = {
5164
- ...attachmentPayload,
5165
- file: attachmentPayload.file.objectURL,
5166
- file_name: attachmentPayload.file.name,
5167
- file_type: attachmentPayload.file.type,
5168
- submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
5169
- created_by: this.client.store.getState().userReducer.currentUser.id
5170
- };
5171
- await this.client.files.addCache(attachmentPayload.file, file_sha1);
5172
- this.client.store.dispatch(addComponentTypeAttachment(offlineAttachment));
5173
- const [fileProps] = await this.client.files.uploadFileToS3(file_sha1);
5174
- const promise = this.enqueueRequest({
5175
- description: "Create attachment",
5176
- method: HttpMethod.POST,
5177
- url: `/components/types/${component_type}/attach/`,
5178
- blocks: [offline_id, component_type],
5179
- blockers: [file_sha1],
5180
- payload: {
5181
- ...offlineAttachment,
5182
- ...fileProps
5183
- }
5184
- });
5185
- promise.catch((error2) => {
5186
- this.client.store.dispatch(removeComponentTypeAttachment(offlineAttachment.offline_id));
5187
- throw error2;
5188
- });
5189
- return [offlineAttachment, promise];
5190
- }
5191
- async addDocumentAttachment(attachmentPayload) {
5192
- const { description: description2, document: document2, file_sha1, offline_id } = attachmentPayload;
5193
- if (!attachmentPayload.file.objectURL) {
5194
- throw new Error("Expected attachmentPayload.file.objectURL to be defined.");
5195
- }
5196
- const offlineAttachment = {
5197
- ...attachmentPayload,
5198
- file: attachmentPayload.file.objectURL,
5199
- file_name: attachmentPayload.file.name,
5200
- file_type: attachmentPayload.file.type,
5201
- submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
5202
- created_by: this.client.store.getState().userReducer.currentUser.id
5203
- };
5204
- await this.client.files.addCache(attachmentPayload.file, file_sha1);
5205
- this.client.store.dispatch(addDocumentAttachment(offlineAttachment));
5206
- const [fileProps] = await this.client.files.uploadFileToS3(file_sha1);
5207
- const promise = this.enqueueRequest({
5208
- description: "Create attachment",
5209
- method: HttpMethod.POST,
5210
- url: `/documents/${document2}/attach/`,
5211
- blocks: [offline_id, document2],
5212
- blockers: [file_sha1],
5213
- payload: {
5214
- offline_id,
5215
- document: document2,
5216
- description: description2 ?? "",
5217
- submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
5218
- ...fileProps
5219
- }
5220
- });
5221
- promise.catch((error2) => {
5222
- this.client.store.dispatch(removeDocumentAttachment(offlineAttachment.offline_id));
5223
- throw error2;
5224
- });
5225
- return [offlineAttachment, promise];
5226
- }
5227
- /** the outer Promise is needed to await the hashing of each file, which is required before offline use. If wanting to
5228
- * attach promise handlers to the request to add the attachment in the backend, apply it on the promise returned from the
5229
- * OptimisticModelResult. */
5230
- attachFilesToIssue(filesToSubmit, issueId) {
5231
- return filesToSubmit.map((file) => {
5232
- if (!(file instanceof File)) {
5233
- throw new Error("Expected a File instance.");
5234
- }
5235
- const photoAttachmentPromise = async (file2) => {
5236
- const hash = await hashFile(file2);
5237
- const attachment = offline({
5238
- file: file2,
5239
- file_name: file2.name,
5240
- file_type: file2.type,
5241
- issue: issueId,
5242
- file_sha1: hash,
5243
- submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
5244
- created_by: this.client.store.getState().userReducer.currentUser.id
5245
- });
5246
- return this.addIssueAttachment(attachment);
5247
- };
5248
- return photoAttachmentPromise(file);
5249
- });
5250
- }
5251
- attachFilesToComponent(filesToSubmit, componentId) {
5252
- return filesToSubmit.map((file) => {
5253
- if (!(file instanceof File)) {
5254
- throw new Error("Expected a File instance.");
5255
- }
5256
- const photoAttachmentPromise = async (file2) => {
5257
- const hash = await hashFile(file2);
5258
- const attachment = offline({
5259
- file: file2,
5260
- file_name: file2.name,
5261
- file_type: file2.type,
5262
- component: componentId,
5263
- file_sha1: hash,
5264
- submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
5265
- created_by: this.client.store.getState().userReducer.currentUser.id
5266
- });
5267
- return this.addComponentAttachment(attachment);
5268
- };
5269
- return photoAttachmentPromise(file);
5270
- });
5271
- }
5272
- attachFilesToComponentType(filesToSubmit, componentTypeId) {
5273
- return filesToSubmit.map((file) => {
5274
- if (!(file instanceof File)) {
5275
- throw new Error("Expected a File instance.");
5276
- }
5277
- const photoAttachmentPromise = async (file2) => {
5278
- const hash = await hashFile(file2);
5279
- const attachment = offline({
5280
- file: file2,
5281
- file_name: file2.name,
5282
- file_type: file2.type,
5283
- component_type: componentTypeId,
5284
- file_sha1: hash,
5285
- submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
5286
- created_by: this.client.store.getState().userReducer.currentUser.id
5287
- });
5288
- return this.addComponentTypeAttachment(attachment);
5289
- };
5290
- return photoAttachmentPromise(file);
5291
- });
5292
- }
5293
- attachFilesToDocument(filesToSubmit, documentId) {
5294
- return filesToSubmit.map((file) => {
5295
- if (!(file instanceof File)) {
5296
- throw new Error("Expected a File instance.");
5297
- }
5298
- const photoAttachmentPromise = async (file2) => {
5299
- const hash = await hashFile(file2);
5300
- const attachment = offline({
5301
- file: file2,
5302
- file_name: file2.name,
5303
- file_type: file2.type,
5304
- document: documentId,
5305
- file_sha1: hash,
5306
- submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
5307
- created_by: this.client.store.getState().userReducer.currentUser.id
5308
- });
5309
- return this.addDocumentAttachment(attachment);
5310
- };
5311
- return photoAttachmentPromise(file);
5312
- });
5313
- }
5314
- async replaceIssueAttachmentFile(attachmentId, newFile) {
5315
- const { store } = this.client;
5316
- const attachment = store.getState().issueReducer.attachments[attachmentId];
5317
- if (!attachment)
5318
- throw new Error(`Attachment ${attachmentId} not found`);
5319
- let oldFile = void 0;
5320
- const newSha1 = await hashFile(newFile);
5321
- const performRequest2 = async () => {
5322
- oldFile = await this.client.files.fetchCache(attachment.file_sha1);
5323
- if (!oldFile) {
5324
- console.error(`Failed to fetch old file from cache for sha1 ${attachment.file_sha1}.`);
5325
- }
5326
- if (!newFile.objectURL) {
5327
- throw new Error(`newFile["objectURL"] is unexpectedly ${newFile.objectURL}`);
5328
- }
5329
- store.dispatch(
5330
- updateIssueAttachment({ ...attachment, file_sha1: newSha1, file: URL.createObjectURL(newFile) })
5331
- );
5332
- await this.client.files.addCache(newFile, newSha1);
5333
- const [fileProps] = await this.client.files.uploadFileToS3(newSha1).catch((e) => {
5334
- store.dispatch(updateIssueAttachment(attachment));
5125
+ const EXPIRING_SOON_THRESHOLD = 1800;
5126
+ function parseTokens(response) {
5127
+ if (!response.access)
5128
+ throw new Error("Missing access token");
5129
+ if (!response.refresh)
5130
+ throw new Error("Missing refresh token");
5131
+ return { accessToken: response.access, refreshToken: response.refresh };
5132
+ }
5133
+ class AuthService extends BaseApiService {
5134
+ constructor() {
5135
+ super(...arguments);
5136
+ __publicField(this, "_getAccessToken", () => this.client.store.getState().authReducer.accessToken);
5137
+ __publicField(this, "_getRefreshToken", () => this.client.store.getState().authReducer.refreshToken);
5138
+ // _getTokenPair and _getRenewedTokens don't need to use enqueueRequest from the BaseApiService because
5139
+ // they are very simple. However, if we need robust error handling or want these operations to queue in the Outbox,
5140
+ // we will use enqueueRequest.
5141
+ /**
5142
+ * Takes credentials and gets a token pair
5143
+ * @async
5144
+ * @param credentials The username and password for obtaining a token pair
5145
+ * @param logoutOnFailure Whether to log out if the request fails
5146
+ * @returns An array containing two elements: 1) a Promise for the access and refresh tokens, and 2) the UUID of the
5147
+ * request, so the request can be cancelled if necessary.
5148
+ */
5149
+ __publicField(this, "_getTokenPair", (credentials, logoutOnFailure = true) => {
5150
+ const uuid = v4();
5151
+ const responsePromise = this.enqueueRequest({
5152
+ uuid,
5153
+ description: "Get token pair",
5154
+ method: HttpMethod.POST,
5155
+ url: "/api/token/",
5156
+ payload: credentials,
5157
+ isAuthNeeded: false,
5158
+ checkAuth: false,
5159
+ blockers: [],
5160
+ blocks: []
5161
+ }).then(parseTokens).catch((e) => {
5162
+ if (logoutOnFailure) {
5163
+ void this.logout().then();
5164
+ }
5335
5165
  throw e;
5336
5166
  });
5337
- const promise2 = this.enqueueRequest({
5338
- description: "Edit attachment",
5339
- method: HttpMethod.PATCH,
5340
- url: `/attachments/issues/${attachment.offline_id}/`,
5341
- isResponseBlob: false,
5342
- payload: fileProps,
5343
- blockers: [attachmentId, newSha1],
5344
- blocks: [attachmentId, newSha1]
5167
+ return [responsePromise, uuid];
5168
+ });
5169
+ /**
5170
+ * Takes refresh token and gets a new token pair
5171
+ * @async
5172
+ * @param {string} refreshToken The refresh token used to get new tokens
5173
+ * @returns {Promise<TokenPair>} The new access and refresh tokens
5174
+ */
5175
+ __publicField(this, "_getRenewedTokens", async (refreshToken) => {
5176
+ const promise = this.enqueueRequest({
5177
+ description: "Get renewed tokens",
5178
+ method: HttpMethod.POST,
5179
+ url: "/api/token/refresh/",
5180
+ payload: { refresh: refreshToken },
5181
+ isAuthNeeded: false,
5182
+ blockers: [],
5183
+ blocks: [],
5184
+ // Don't wait for an auth check since this is a refresh token request.
5185
+ checkAuth: false,
5186
+ // Don't wait for other requests to finish, or we might end up in a deadlock.
5187
+ immediate: true
5188
+ }).catch((e) => {
5189
+ console.error("Could not renew tokens; logging out due to error:", e);
5190
+ void this.logout();
5191
+ return void 0;
5345
5192
  });
5193
+ let response = void 0;
5346
5194
  try {
5347
- const result = await promise2;
5348
- void this.client.files.removeCache(attachment.file_sha1);
5349
- return result;
5195
+ response = await promise;
5350
5196
  } catch (e) {
5351
- if (oldFile) {
5352
- store.dispatch(
5353
- updateIssueAttachment({
5354
- ...attachment,
5355
- file_sha1: attachment.file_sha1,
5356
- file: URL.createObjectURL(oldFile)
5357
- })
5358
- );
5359
- }
5360
- throw e;
5197
+ await this.logout();
5361
5198
  }
5362
- };
5363
- const offlineAttachment = {
5364
- ...attachment,
5365
- file_sha1: newSha1,
5366
- file: URL.createObjectURL(newFile)
5367
- };
5368
- const promise = performRequest2();
5369
- return [offlineAttachment, promise];
5370
- }
5371
- async replaceComponentAttachmentFile(attachmentId, newFile) {
5372
- const { store } = this.client;
5373
- const attachment = store.getState().componentReducer.attachments[attachmentId];
5374
- if (!attachment)
5375
- throw new Error(`Attachment ${attachmentId} not found`);
5376
- let oldFile = void 0;
5377
- const newSha1 = await hashFile(newFile);
5378
- const performRequest2 = async () => {
5379
- oldFile = await this.client.files.fetchCache(attachment.file_sha1);
5380
- if (!oldFile) {
5381
- console.error(`Failed to fetch old file from cache for sha1 ${attachment.file_sha1}.`);
5382
- }
5383
- if (!newFile.objectURL) {
5384
- throw new Error(`newFile["objectURL"] is unexpectedly ${newFile.objectURL}`);
5385
- }
5386
- store.dispatch(
5387
- updateComponentAttachment({ ...attachment, file_sha1: newSha1, file: URL.createObjectURL(newFile) })
5388
- );
5389
- await this.client.files.addCache(newFile, newSha1);
5390
- const [fileProps] = await this.client.files.uploadFileToS3(newSha1).catch((e) => {
5391
- store.dispatch(updateComponentAttachment(attachment));
5392
- throw e;
5393
- });
5394
- const promise2 = this.enqueueRequest({
5395
- description: "Edit attachment",
5396
- method: HttpMethod.PATCH,
5397
- url: `/attachments/components/${attachment.offline_id}/`,
5398
- isResponseBlob: false,
5399
- payload: fileProps,
5400
- blockers: [attachmentId, newSha1],
5401
- blocks: [attachmentId, newSha1]
5402
- });
5403
- try {
5404
- const result = await promise2;
5405
- void this.client.files.removeCache(attachment.file_sha1);
5406
- return result;
5407
- } catch (e) {
5408
- if (oldFile) {
5409
- store.dispatch(
5410
- updateComponentAttachment({
5411
- ...attachment,
5412
- file_sha1: attachment.file_sha1,
5413
- file: URL.createObjectURL(oldFile)
5414
- })
5415
- );
5416
- }
5417
- throw e;
5418
- }
5419
- };
5420
- const offlineAttachment = {
5421
- ...attachment,
5422
- file_sha1: newSha1,
5423
- file: URL.createObjectURL(newFile)
5424
- };
5425
- const promise = performRequest2();
5426
- return [offlineAttachment, promise];
5427
- }
5428
- async replaceComponentTypeAttachmentFile(attachmentId, newFile) {
5429
- const { store } = this.client;
5430
- const attachment = store.getState().componentTypeReducer.attachments[attachmentId];
5431
- if (!attachment)
5432
- throw new Error(`Attachment ${attachmentId} not found`);
5433
- let oldFile = void 0;
5434
- const newSha1 = await hashFile(newFile);
5435
- const performRequest2 = async () => {
5436
- oldFile = await this.client.files.fetchCache(attachment.file_sha1);
5437
- if (!oldFile) {
5438
- console.error(`Failed to fetch old file from cache for sha1 ${attachment.file_sha1}.`);
5439
- }
5440
- if (!newFile.objectURL) {
5441
- throw new Error(`newFile["objectURL"] is unexpectedly ${newFile.objectURL}`);
5442
- }
5443
- store.dispatch(
5444
- updateComponentTypeAttachment({
5445
- ...attachment,
5446
- file_sha1: newSha1,
5447
- file: URL.createObjectURL(newFile)
5448
- })
5449
- );
5450
- await this.client.files.addCache(newFile, newSha1);
5451
- const [fileProps] = await this.client.files.uploadFileToS3(newSha1).catch((e) => {
5452
- store.dispatch(updateComponentTypeAttachment(attachment));
5453
- throw e;
5454
- });
5455
- const promise2 = this.enqueueRequest({
5456
- description: "Edit attachment",
5457
- method: HttpMethod.PATCH,
5458
- url: `/attachments/component_types/${attachment.offline_id}/`,
5459
- isResponseBlob: false,
5460
- payload: fileProps,
5461
- blockers: [attachmentId, newSha1],
5462
- blocks: [attachmentId, newSha1]
5463
- });
5464
- try {
5465
- const result = await promise2;
5466
- void this.client.files.removeCache(attachment.file_sha1);
5467
- return result;
5468
- } catch (e) {
5469
- if (oldFile) {
5470
- store.dispatch(
5471
- updateComponentTypeAttachment({
5472
- ...attachment,
5473
- file_sha1: attachment.file_sha1,
5474
- file: URL.createObjectURL(oldFile)
5475
- })
5476
- );
5477
- }
5478
- throw e;
5479
- }
5480
- };
5481
- const offlineAttachment = {
5482
- ...attachment,
5483
- file_sha1: newSha1,
5484
- file: URL.createObjectURL(newFile)
5485
- };
5486
- const promise = performRequest2();
5487
- return [offlineAttachment, promise];
5488
- }
5489
- async replaceDocumentAttachmentFile(attachmentId, newFile) {
5490
- const { store } = this.client;
5491
- const attachment = store.getState().documentsReducer.attachments[attachmentId];
5492
- if (!attachment)
5493
- throw new Error(`Attachment ${attachmentId} not found`);
5494
- let oldFile = void 0;
5495
- const newSha1 = await hashFile(newFile);
5496
- const performRequest2 = async () => {
5497
- oldFile = await this.client.files.fetchCache(attachment.file_sha1);
5498
- if (!oldFile) {
5499
- console.error(`Failed to fetch old file from cache for sha1 ${attachment.file_sha1}.`);
5500
- }
5501
- if (!newFile.objectURL) {
5502
- throw new Error(`newFile["objectURL"] is unexpectedly ${newFile.objectURL}`);
5503
- }
5504
- store.dispatch(
5505
- updateDocumentAttachment({
5506
- ...attachment,
5507
- file_sha1: newSha1,
5508
- file: URL.createObjectURL(newFile)
5509
- })
5510
- );
5511
- await this.client.files.addCache(newFile, newSha1);
5512
- const [fileProps] = await this.client.files.uploadFileToS3(newSha1).catch((e) => {
5513
- store.dispatch(updateDocumentAttachment(attachment));
5514
- throw e;
5515
- });
5516
- const promise2 = this.enqueueRequest({
5517
- description: "Edit attachment",
5518
- method: HttpMethod.PATCH,
5519
- url: `/attachments/documents/${attachment.offline_id}/`,
5520
- isResponseBlob: false,
5521
- payload: fileProps,
5522
- blockers: [attachmentId, newSha1],
5523
- blocks: [attachmentId, newSha1]
5524
- });
5525
- try {
5526
- const result = await promise2;
5527
- void this.client.files.removeCache(attachment.file_sha1);
5528
- return result;
5529
- } catch (e) {
5530
- if (oldFile) {
5531
- store.dispatch(
5532
- updateDocumentAttachment({
5533
- ...attachment,
5534
- file_sha1: attachment.file_sha1,
5535
- file: URL.createObjectURL(oldFile)
5536
- })
5537
- );
5538
- }
5539
- throw e;
5540
- }
5541
- };
5542
- const offlineAttachment = {
5543
- ...attachment,
5544
- file_sha1: newSha1,
5545
- file: URL.createObjectURL(newFile)
5546
- };
5547
- const promise = performRequest2();
5548
- return [offlineAttachment, promise];
5549
- }
5550
- /**
5551
- * Deletes an attachment and associated data in the cloud, in the Redux store and the cache.
5552
- * @param issueAttachmentId
5553
- */
5554
- deleteIssueAttachment(issueAttachmentId) {
5555
- const { store } = this.client;
5556
- const attachment = selectIssueAttachmentMapping(store.getState())[issueAttachmentId];
5557
- if (!attachment) {
5558
- throw new Error(`Attachment ${issueAttachmentId} not found`);
5559
- }
5560
- store.dispatch(removeIssueAttachment(issueAttachmentId));
5561
- void this.client.files.removeCache(attachment.file_sha1);
5562
- return this.enqueueRequest({
5563
- description: "Delete attachment",
5564
- method: HttpMethod.DELETE,
5565
- url: `/attachments/issues/${issueAttachmentId}/`,
5566
- blockers: [issueAttachmentId],
5567
- blocks: [issueAttachmentId]
5568
- });
5569
- }
5570
- deleteComponentAttachment(componentAttachmentId) {
5571
- const { store } = this.client;
5572
- const attachment = selectComponentAttachmentMapping(store.getState())[componentAttachmentId];
5573
- if (!attachment) {
5574
- throw new Error(`Attachment ${componentAttachmentId} not found`);
5575
- }
5576
- store.dispatch(removeComponentAttachment(componentAttachmentId));
5577
- void this.client.files.removeCache(attachment.file_sha1);
5578
- return this.enqueueRequest({
5579
- description: "Delete attachment",
5580
- method: HttpMethod.DELETE,
5581
- url: `/attachments/components/${componentAttachmentId}/`,
5582
- blockers: [componentAttachmentId],
5583
- blocks: [componentAttachmentId]
5584
- });
5585
- }
5586
- deleteComponentTypeAttachment(componentTypeAttachmentId) {
5587
- const { store } = this.client;
5588
- const attachment = selectComponentTypeAttachmentMapping(store.getState())[componentTypeAttachmentId];
5589
- if (!attachment) {
5590
- throw new Error(`Attachment ${componentTypeAttachmentId} not found`);
5591
- }
5592
- store.dispatch(removeComponentTypeAttachment(componentTypeAttachmentId));
5593
- void this.client.files.removeCache(attachment.file_sha1);
5594
- return this.enqueueRequest({
5595
- description: "Delete attachment",
5596
- method: HttpMethod.DELETE,
5597
- url: `/attachments/component_types/${componentTypeAttachmentId}/`,
5598
- blockers: [componentTypeAttachmentId],
5599
- blocks: [componentTypeAttachmentId]
5600
- });
5601
- }
5602
- deleteDocumentAttachment(documentAttachmentId) {
5603
- const { store } = this.client;
5604
- const attachment = store.getState().documentsReducer.attachments[documentAttachmentId];
5605
- if (!attachment) {
5606
- throw new Error(`Attachment ${documentAttachmentId} not found`);
5607
- }
5608
- store.dispatch(removeDocumentAttachment(documentAttachmentId));
5609
- void this.client.files.removeCache(attachment.file_sha1);
5610
- return this.enqueueRequest({
5611
- description: "Delete document attachment",
5612
- method: HttpMethod.DELETE,
5613
- url: `/attachments/documents/${documentAttachmentId}/`,
5614
- blockers: [documentAttachmentId],
5615
- blocks: [documentAttachmentId]
5616
- });
5617
- }
5618
- }
5619
- const EXPIRING_SOON_THRESHOLD = 1800;
5620
- function parseTokens(response) {
5621
- if (!response.access)
5622
- throw new Error("Missing access token");
5623
- if (!response.refresh)
5624
- throw new Error("Missing refresh token");
5625
- return { accessToken: response.access, refreshToken: response.refresh };
5626
- }
5627
- class AuthService extends BaseApiService {
5628
- constructor() {
5629
- super(...arguments);
5630
- __publicField(this, "_getAccessToken", () => this.client.store.getState().authReducer.accessToken);
5631
- __publicField(this, "_getRefreshToken", () => this.client.store.getState().authReducer.refreshToken);
5632
- // _getTokenPair and _getRenewedTokens don't need to use enqueueRequest from the BaseApiService because
5633
- // they are very simple. However, if we need robust error handling or want these operations to queue in the Outbox,
5634
- // we will use enqueueRequest.
5635
- /**
5636
- * Takes credentials and gets a token pair
5637
- * @async
5638
- * @param credentials The username and password for obtaining a token pair
5639
- * @param logoutOnFailure Whether to log out if the request fails
5640
- * @returns An array containing two elements: 1) a Promise for the access and refresh tokens, and 2) the UUID of the
5641
- * request, so the request can be cancelled if necessary.
5642
- */
5643
- __publicField(this, "_getTokenPair", (credentials, logoutOnFailure = true) => {
5644
- const uuid = v4();
5645
- const responsePromise = this.enqueueRequest({
5646
- uuid,
5647
- description: "Get token pair",
5648
- method: HttpMethod.POST,
5649
- url: "/api/token/",
5650
- payload: credentials,
5651
- isAuthNeeded: false,
5652
- checkAuth: false,
5653
- blockers: [],
5654
- blocks: []
5655
- }).then(parseTokens).catch((e) => {
5656
- if (logoutOnFailure) {
5657
- void this.logout().then();
5658
- }
5659
- throw e;
5660
- });
5661
- return [responsePromise, uuid];
5662
- });
5663
- /**
5664
- * Takes refresh token and gets a new token pair
5665
- * @async
5666
- * @param {string} refreshToken The refresh token used to get new tokens
5667
- * @returns {Promise<TokenPair>} The new access and refresh tokens
5668
- */
5669
- __publicField(this, "_getRenewedTokens", async (refreshToken) => {
5670
- const promise = this.enqueueRequest({
5671
- description: "Get renewed tokens",
5672
- method: HttpMethod.POST,
5673
- url: "/api/token/refresh/",
5674
- payload: { refresh: refreshToken },
5675
- isAuthNeeded: false,
5676
- blockers: [],
5677
- blocks: [],
5678
- // Don't wait for an auth check since this is a refresh token request.
5679
- checkAuth: false,
5680
- // Don't wait for other requests to finish, or we might end up in a deadlock.
5681
- immediate: true
5682
- }).catch((e) => {
5683
- console.error("Could not renew tokens; logging out due to error:", e);
5684
- void this.logout();
5685
- return void 0;
5686
- });
5687
- let response = void 0;
5688
- try {
5689
- response = await promise;
5690
- } catch (e) {
5691
- await this.logout();
5692
- }
5693
- if (!response)
5694
- return void 0;
5695
- if (!response.access)
5696
- throw new Error("Missing access token");
5697
- if (!response.refresh)
5698
- throw new Error("Missing refresh token");
5699
- return { accessToken: response.access, refreshToken: response.refresh };
5700
- });
5199
+ if (!response)
5200
+ return void 0;
5201
+ if (!response.access)
5202
+ throw new Error("Missing access token");
5203
+ if (!response.refresh)
5204
+ throw new Error("Missing refresh token");
5205
+ return { accessToken: response.access, refreshToken: response.refresh };
5206
+ });
5701
5207
  }
5702
5208
  /**
5703
5209
  * Attempts to log into Hemora using given credentials
@@ -6307,6 +5813,221 @@ class ComponentStageService extends BaseApiService {
6307
5813
  store.dispatch(addStages(result));
6308
5814
  }
6309
5815
  }
5816
+ const AttachmentModelMeta = {
5817
+ [AttachmentModel.Issue]: {
5818
+ name: "issue",
5819
+ attachUrlPrefix: "/issues",
5820
+ deleteUrlPrefix: "/issues",
5821
+ fetchUrlPostfix: "/issue-attachments"
5822
+ },
5823
+ [AttachmentModel.Component]: {
5824
+ name: "component",
5825
+ attachUrlPrefix: "/components",
5826
+ deleteUrlPrefix: "/components",
5827
+ fetchUrlPostfix: "/component-attachments"
5828
+ },
5829
+ [AttachmentModel.ComponentType]: {
5830
+ name: "component type",
5831
+ attachUrlPrefix: "/components/types",
5832
+ deleteUrlPrefix: "/components/types",
5833
+ fetchUrlPostfix: "/component-type-attachments"
5834
+ },
5835
+ [AttachmentModel.Project]: {
5836
+ name: "component project",
5837
+ attachUrlPrefix: "/projects",
5838
+ deleteUrlPrefix: "/projects",
5839
+ fetchUrlPostfix: "/attachments"
5840
+ },
5841
+ [AttachmentModel.Document]: {
5842
+ name: "document",
5843
+ attachUrlPrefix: "/documents",
5844
+ deleteUrlPrefix: "/documents",
5845
+ fetchUrlPostfix: "/document-attachments"
5846
+ }
5847
+ };
5848
+ class BaseAttachmentService extends BaseApiService {
5849
+ getNumberOfAttachmentsWithSha1(sha1) {
5850
+ const {
5851
+ issueReducer: issueReducer2,
5852
+ componentReducer: componentReducer2,
5853
+ componentTypeReducer: componentTypeReducer2,
5854
+ documentsReducer: documentsReducer2,
5855
+ projectReducer: projectReducer2,
5856
+ formSubmissionReducer: formSubmissionReducer2,
5857
+ formRevisionReducer: formRevisionReducer2
5858
+ } = this.client.store.getState();
5859
+ const objectsWithSha1 = [].concat(
5860
+ Object.values(issueReducer2.attachments),
5861
+ Object.values(componentReducer2.attachments),
5862
+ Object.values(componentTypeReducer2.attachments),
5863
+ Object.values(documentsReducer2.attachments),
5864
+ Object.values(projectReducer2.attachments),
5865
+ Object.values(formRevisionReducer2.attachments),
5866
+ Object.values(formSubmissionReducer2.attachments)
5867
+ );
5868
+ return objectsWithSha1.filter((object) => object.file_sha1 === sha1).length;
5869
+ }
5870
+ processPresignedUrls(presignedUrls) {
5871
+ for (const [sha1, presignedUrl] of Object.entries(presignedUrls)) {
5872
+ void this.enqueueRequest({
5873
+ url: presignedUrl.url,
5874
+ description: "Upload file to S3",
5875
+ method: HttpMethod.POST,
5876
+ isExternalUrl: true,
5877
+ isAuthNeeded: false,
5878
+ attachmentHash: sha1,
5879
+ // TODO: can we use the sha1 as the blocker?
5880
+ blockers: [`s3-${presignedUrl.fields.key}`],
5881
+ blocks: [sha1],
5882
+ s3url: presignedUrl
5883
+ });
5884
+ }
5885
+ }
5886
+ // Note that currently the fetching of attachments for all models dependds on the active projectId. This may change in the future. And
5887
+ // so for some attachment model services, this method will have to be overridden.
5888
+ async getAttachments(actions) {
5889
+ const { store } = this.client;
5890
+ const activeProjectId = store.getState().projectReducer.activeProjectId;
5891
+ const meta = AttachmentModelMeta[this.attachmentModel];
5892
+ const result = await this.enqueueRequest({
5893
+ description: `Get ${meta.name} attachments`,
5894
+ method: HttpMethod.GET,
5895
+ url: `/projects/${activeProjectId}${meta.fetchUrlPostfix}/`,
5896
+ blocks: [],
5897
+ blockers: []
5898
+ });
5899
+ store.dispatch(actions.setAttachments(result));
5900
+ }
5901
+ async attachFiles(files, modelId, buildOfflineAttachment, actions) {
5902
+ const { store } = this.client;
5903
+ const currentUser = store.getState().userReducer.currentUser;
5904
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
5905
+ const offlineAttachments = [];
5906
+ const attachmentPayloads = [];
5907
+ const filePayloads = {};
5908
+ for (const file of files) {
5909
+ const sha1 = await hashFile(file);
5910
+ if (!(sha1 in filePayloads)) {
5911
+ filePayloads[sha1] = {
5912
+ sha1,
5913
+ file_type: file.type,
5914
+ extension: file.name.split(".").pop(),
5915
+ size: file.size
5916
+ };
5917
+ await this.client.files.addCache(file, sha1);
5918
+ }
5919
+ const offlineAttachment = buildOfflineAttachment({
5920
+ file,
5921
+ sha1,
5922
+ submittedAt,
5923
+ createdBy: currentUser.id,
5924
+ description: "",
5925
+ modelId
5926
+ });
5927
+ offlineAttachments.push(offlineAttachment);
5928
+ attachmentPayloads.push({
5929
+ offline_id: offlineAttachment.offline_id,
5930
+ name: offlineAttachment.file_name,
5931
+ sha1: offlineAttachment.file_sha1,
5932
+ description: offlineAttachment.description
5933
+ });
5934
+ }
5935
+ store.dispatch(actions.addAttachments(offlineAttachments));
5936
+ const meta = AttachmentModelMeta[this.attachmentModel];
5937
+ const promise = this.enqueueRequest({
5938
+ description: `Attach files to ${meta.name}`,
5939
+ method: HttpMethod.POST,
5940
+ url: `${meta.attachUrlPrefix}/${modelId}/attach/`,
5941
+ payload: {
5942
+ submitted_at: submittedAt,
5943
+ attachments: attachmentPayloads,
5944
+ files: Object.values(filePayloads)
5945
+ },
5946
+ blocks: offlineAttachments.map((attachment) => attachment.offline_id),
5947
+ blockers: offlineAttachments.map((attachment) => attachment.file_sha1)
5948
+ });
5949
+ promise.then(({ attachments, presigned_urls }) => {
5950
+ store.dispatch(actions.updateAttachments(attachments));
5951
+ this.processPresignedUrls(presigned_urls);
5952
+ }).catch(() => {
5953
+ store.dispatch(actions.removeAttachments(offlineAttachments.map((attachment) => attachment.offline_id)));
5954
+ });
5955
+ return [offlineAttachments, promise.then(({ attachments }) => attachments)];
5956
+ }
5957
+ async deleteAttachment(attachmendId, actions, selectors) {
5958
+ const { store } = this.client;
5959
+ const attachment = selectors.selectAttachment(attachmendId)(store.getState());
5960
+ if (!attachment) {
5961
+ throw new Error(
5962
+ `Attempting to delete attachment with offline_id ${attachmendId} that does not exist in the store`
5963
+ );
5964
+ }
5965
+ store.dispatch(actions.removeAttachment(attachment.offline_id));
5966
+ const meta = AttachmentModelMeta[this.attachmentModel];
5967
+ const promise = this.enqueueRequest({
5968
+ description: "Delete attachment",
5969
+ method: HttpMethod.DELETE,
5970
+ url: `${meta.deleteUrlPrefix}/attachments/${attachmendId}/`,
5971
+ blockers: [attachmendId],
5972
+ blocks: []
5973
+ });
5974
+ promise.then(() => {
5975
+ if (this.getNumberOfAttachmentsWithSha1(attachment.file_sha1) === 0) {
5976
+ void this.client.files.removeCache(attachment.file_sha1);
5977
+ }
5978
+ }).catch(() => {
5979
+ store.dispatch(actions.setAttachment(attachment));
5980
+ });
5981
+ return promise;
5982
+ }
5983
+ }
5984
+ class ComponentAttachmentService extends BaseAttachmentService {
5985
+ constructor() {
5986
+ super(...arguments);
5987
+ __publicField(this, "attachmentModel", AttachmentModel.Component);
5988
+ }
5989
+ buildOfflineAttachment(data) {
5990
+ return offline({
5991
+ file: URL.createObjectURL(data.file),
5992
+ file_sha1: data.sha1,
5993
+ created_by: data.createdBy,
5994
+ file_name: data.file.name,
5995
+ file_type: data.file.type,
5996
+ submitted_at: data.submittedAt,
5997
+ description: data.description,
5998
+ component: data.modelId
5999
+ });
6000
+ }
6001
+ async attachFilesToComponent(files, componentId) {
6002
+ return this.attachFiles(
6003
+ files,
6004
+ componentId,
6005
+ this.buildOfflineAttachment.bind(this),
6006
+ {
6007
+ addAttachments: addComponentAttachments,
6008
+ updateAttachments: updateComponentAttachments,
6009
+ removeAttachments: removeComponentAttachments
6010
+ }
6011
+ );
6012
+ }
6013
+ deleteComponentAttachment(attachmentId) {
6014
+ return this.deleteAttachment(
6015
+ attachmentId,
6016
+ {
6017
+ setAttachment: setComponentAttachment,
6018
+ removeAttachment: removeComponentAttachment
6019
+ },
6020
+ {
6021
+ selectAttachment: selectComponentAttachment
6022
+ }
6023
+ );
6024
+ }
6025
+ async refreshStore() {
6026
+ return this.getAttachments({
6027
+ setAttachments: setComponentAttachments
6028
+ });
6029
+ }
6030
+ }
6310
6031
  class ComponentTypeService extends BaseApiService {
6311
6032
  add(componentType) {
6312
6033
  const offlineComponentType = offline(componentType);
@@ -6379,11 +6100,58 @@ class ComponentTypeService extends BaseApiService {
6379
6100
  store.dispatch(setComponentTypes(result));
6380
6101
  }
6381
6102
  }
6382
- class IssueCommentService extends BaseApiService {
6383
- // Omit author and submitted_at since these will always be set internally
6384
- add(comment) {
6385
- const { store } = this.client;
6386
- const offlineComment = offline({
6103
+ class ComponentTypeAttachmentService extends BaseAttachmentService {
6104
+ constructor() {
6105
+ super(...arguments);
6106
+ __publicField(this, "attachmentModel", AttachmentModel.ComponentType);
6107
+ }
6108
+ buildOfflineAttachment(data) {
6109
+ return offline({
6110
+ file: URL.createObjectURL(data.file),
6111
+ file_sha1: data.sha1,
6112
+ created_by: data.createdBy,
6113
+ file_name: data.file.name,
6114
+ file_type: data.file.type,
6115
+ submitted_at: data.submittedAt,
6116
+ description: data.description,
6117
+ component_type: data.modelId
6118
+ });
6119
+ }
6120
+ async attachFilesToComponentType(files, componentTypeId) {
6121
+ return this.attachFiles(
6122
+ files,
6123
+ componentTypeId,
6124
+ this.buildOfflineAttachment.bind(this),
6125
+ {
6126
+ addAttachments: addComponentTypeAttachments,
6127
+ updateAttachments: updateComponentTypeAttachments,
6128
+ removeAttachments: removeComponentTypeAttachments
6129
+ }
6130
+ );
6131
+ }
6132
+ deleteComponentTypeAttachment(attachmentId) {
6133
+ return this.deleteAttachment(
6134
+ attachmentId,
6135
+ {
6136
+ setAttachment: setComponentTypeAttachment,
6137
+ removeAttachment: removeComponentTypeAttachment
6138
+ },
6139
+ {
6140
+ selectAttachment: selectComponentTypeAttachment
6141
+ }
6142
+ );
6143
+ }
6144
+ async refreshStore() {
6145
+ return this.getAttachments({
6146
+ setAttachments: setComponentTypeAttachments
6147
+ });
6148
+ }
6149
+ }
6150
+ class IssueCommentService extends BaseApiService {
6151
+ // Omit author and submitted_at since these will always be set internally
6152
+ add(comment) {
6153
+ const { store } = this.client;
6154
+ const offlineComment = offline({
6387
6155
  ...comment,
6388
6156
  author: store.getState().userReducer.currentUser.id,
6389
6157
  submitted_at: (/* @__PURE__ */ new Date()).toISOString()
@@ -6475,11 +6243,53 @@ class IssueUpdateService extends BaseApiService {
6475
6243
  store.dispatch(setIssueUpdates(filteredResult));
6476
6244
  }
6477
6245
  }
6246
+ class IssueAttachmentService extends BaseAttachmentService {
6247
+ constructor() {
6248
+ super(...arguments);
6249
+ __publicField(this, "attachmentModel", AttachmentModel.Issue);
6250
+ }
6251
+ buildOfflineAttachment(data) {
6252
+ return offline({
6253
+ file: URL.createObjectURL(data.file),
6254
+ file_sha1: data.sha1,
6255
+ created_by: data.createdBy,
6256
+ file_name: data.file.name,
6257
+ file_type: data.file.type,
6258
+ submitted_at: data.submittedAt,
6259
+ description: data.description,
6260
+ issue: data.modelId
6261
+ });
6262
+ }
6263
+ async attachFilesToIssue(files, issueId) {
6264
+ return this.attachFiles(files, issueId, this.buildOfflineAttachment.bind(this), {
6265
+ addAttachments: addIssueAttachments,
6266
+ updateAttachments: updateIssueAttachments,
6267
+ removeAttachments: removeIssueAttachments
6268
+ });
6269
+ }
6270
+ deleteIssueAttachment(attachmentId) {
6271
+ return this.deleteAttachment(
6272
+ attachmentId,
6273
+ {
6274
+ setAttachment: setIssueAttachment,
6275
+ removeAttachment: removeIssueAttachment
6276
+ },
6277
+ {
6278
+ selectAttachment: selectIssueAttachment
6279
+ }
6280
+ );
6281
+ }
6282
+ async refreshStore() {
6283
+ return this.getAttachments({
6284
+ setAttachments: setIssueAttachments
6285
+ });
6286
+ }
6287
+ }
6478
6288
  class IssueService extends BaseApiService {
6479
6289
  // Basic CRUD functions
6480
6290
  // TODO: Once all models are represented in `Created<TModel>`, use `Created` in `OptimisticModelResult`, so we don't
6481
6291
  // have to repeat it for all optimistic model results (all optimistic results are created).
6482
- add(issue, issue_type = null) {
6292
+ add(issue, issueType = null) {
6483
6293
  const { store } = this.client;
6484
6294
  const dateWithoutMilliseconds = /* @__PURE__ */ new Date();
6485
6295
  const state = store.getState();
@@ -6506,7 +6316,7 @@ class IssueService extends BaseApiService {
6506
6316
  url: "/issues/",
6507
6317
  queryParams: {
6508
6318
  workspace_id: workspaceId,
6509
- ...issue_type ? { issue_type } : {}
6319
+ ...issueType ? { issue_type: issueType } : {}
6510
6320
  },
6511
6321
  payload: issuePayload,
6512
6322
  blockers: [
@@ -6643,7 +6453,7 @@ class IssueService extends BaseApiService {
6643
6453
  this.client.store.dispatch(updateIssue(issueToBeUpdated));
6644
6454
  this.client.store.dispatch(removeIssueUpdate(offlineIssueUpdate.offline_id));
6645
6455
  });
6646
- const fullIssue = this.client.store.getState().issueReducer.issues[issue.offline_id];
6456
+ const fullIssue = state.issueReducer.issues[issue.offline_id];
6647
6457
  return [fullIssue, promise];
6648
6458
  }
6649
6459
  async remove(id) {
@@ -6694,14 +6504,15 @@ class IssueService extends BaseApiService {
6694
6504
  class IssueTypeService extends BaseApiService {
6695
6505
  add(payload) {
6696
6506
  const { store } = this.client;
6697
- const activeOrganizationId = store.getState().organizationReducer.activeOrganizationId;
6507
+ const state = store.getState();
6508
+ const activeOrganizationId = state.organizationReducer.activeOrganizationId;
6698
6509
  if (!activeOrganizationId) {
6699
6510
  throw new Error(`No active organization, got ${activeOrganizationId} for activeOrganizationId.`);
6700
6511
  }
6701
6512
  const offlineIssueType = offline({
6702
6513
  ...payload,
6703
6514
  submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
6704
- created_by: store.getState().userReducer.currentUser.id,
6515
+ created_by: state.userReducer.currentUser.id,
6705
6516
  organization: activeOrganizationId
6706
6517
  });
6707
6518
  store.dispatch(addIssueType(offlineIssueType));
@@ -6754,11 +6565,12 @@ class IssueTypeService extends BaseApiService {
6754
6565
  }
6755
6566
  delete(issueTypeId) {
6756
6567
  const { store } = this.client;
6757
- const issueTypeToDelete = store.getState().issueTypeReducer.issueTypes[issueTypeId];
6568
+ const state = store.getState();
6569
+ const issueTypeToDelete = state.issueTypeReducer.issueTypes[issueTypeId];
6758
6570
  if (!issueTypeToDelete) {
6759
6571
  throw new Error(`IssueType with offline_id ${issueTypeId} does not exist in the store.`);
6760
6572
  }
6761
- const issuesOfIssueType = selectIssuesOfIssueType(issueTypeId)(store.getState()) ?? [];
6573
+ const issuesOfIssueType = selectIssuesOfIssueType(issueTypeId)(state) ?? [];
6762
6574
  store.dispatch(removeIssueType(issueTypeId));
6763
6575
  store.dispatch(removeIssues(issuesOfIssueType.map((issue) => issue.offline_id)));
6764
6576
  const promise = this.enqueueRequest({
@@ -6807,13 +6619,17 @@ class MainService extends BaseApiService {
6807
6619
  return result;
6808
6620
  });
6809
6621
  }
6810
- async fetchProjectUsers(projectId) {
6622
+ async fetchProjectUsers() {
6623
+ const projectId = this.client.store.getState().projectReducer.activeProjectId;
6811
6624
  return this.enqueueRequest({
6812
6625
  description: "Fetch users",
6813
6626
  method: HttpMethod.GET,
6814
6627
  url: `/projects/${projectId}/users/`,
6815
6628
  blockers: [],
6816
6629
  blocks: []
6630
+ }).then((users) => {
6631
+ this.client.store.dispatch(addUsers(users));
6632
+ return users;
6817
6633
  });
6818
6634
  }
6819
6635
  async fetchOrganizationUsers(orgId) {
@@ -6828,11 +6644,12 @@ class MainService extends BaseApiService {
6828
6644
  // TODO:
6829
6645
  // Don't accept updateStore in ComponentService.list. Just return the offline objects and promise. Here, if
6830
6646
  // overwrite, use setComponents. Otherwise, use bulkAddComponents.
6647
+ // TODO: This needs major cleanup. Send less in the initial data: Only the basic project info and anything needed
6648
+ // literally immediately.
6831
6649
  async _processInitialData(data, overwrite) {
6832
6650
  var _a2, _b, _c;
6833
6651
  const workspaces = {};
6834
6652
  const projects = [];
6835
- const categories = [];
6836
6653
  const projectsData = data.projects;
6837
6654
  const { store } = this.client;
6838
6655
  const oldProjectId = (_a2 = projectsData.find(
@@ -6856,18 +6673,12 @@ class MainService extends BaseApiService {
6856
6673
  isProjectIdValid = true;
6857
6674
  for (const workspaceData of projectData.workspaces) {
6858
6675
  const workspace = { ...workspaceData, project: projectData.id };
6859
- if (workspace.categories) {
6860
- for (const category of workspace.categories) {
6861
- categories.push(category);
6862
- }
6863
- }
6864
6676
  delete workspace.categories;
6865
6677
  workspaces[workspace.offline_id] = workspace;
6866
6678
  }
6867
6679
  }
6868
6680
  }
6869
6681
  store.dispatch(setCurrentUser(data.user));
6870
- store.dispatch(addUsers(data.project_owners));
6871
6682
  store.dispatch(setLicenses(data.licenses));
6872
6683
  const organizationsData = data.organizations;
6873
6684
  store.dispatch(setOrganizations(organizationsData));
@@ -6888,8 +6699,11 @@ class MainService extends BaseApiService {
6888
6699
  currentOrgId = firstOrg.id;
6889
6700
  }
6890
6701
  if (currentOrgId) {
6891
- await this.client.organizations.fetchInitialOrganizationData(currentOrgId, false);
6892
- void this.client.teams.refreshStore();
6702
+ const initialOrgData = await this.client.organizations.fetchInitialOrganizationData(currentOrgId, false);
6703
+ currentOrgId = initialOrgData.organization.id;
6704
+ }
6705
+ if (!currentOrgId) {
6706
+ throw new Error("No organization found");
6893
6707
  }
6894
6708
  if (!isProjectIdValid) {
6895
6709
  if (validProjects.length !== 0) {
@@ -6899,12 +6713,6 @@ class MainService extends BaseApiService {
6899
6713
  if (projectData) {
6900
6714
  for (const workspaceData of projectData.workspaces) {
6901
6715
  const workspace = { ...workspaceData, project: projectData.id };
6902
- if (workspace.categories) {
6903
- for (const category of workspace.categories) {
6904
- categories.push(category);
6905
- }
6906
- }
6907
- delete workspace.categories;
6908
6716
  workspaces[workspace.offline_id] = workspace;
6909
6717
  }
6910
6718
  }
@@ -6913,13 +6721,6 @@ class MainService extends BaseApiService {
6913
6721
  store.dispatch(setActiveProjectId(currentProjectId));
6914
6722
  }
6915
6723
  }
6916
- if (currentProjectId) {
6917
- const usersResultPromise = this.fetchProjectUsers(currentProjectId);
6918
- const projectAccessRefreshPromise = this.client.projectAccesses.refreshStore();
6919
- const usersResult = await usersResultPromise;
6920
- await projectAccessRefreshPromise;
6921
- store.dispatch(addUsers(usersResult));
6922
- }
6923
6724
  let currentWorkspaceId;
6924
6725
  const oldWorkspaceId = this.client.store.getState().workspaceReducer.activeWorkspaceId;
6925
6726
  if (overwrite || !oldWorkspaceId) {
@@ -6927,56 +6728,54 @@ class MainService extends BaseApiService {
6927
6728
  } else {
6928
6729
  currentWorkspaceId = oldWorkspaceId;
6929
6730
  }
6930
- if (currentWorkspaceId && currentProjectId) {
6731
+ if (currentWorkspaceId) {
6931
6732
  store.dispatch(setActiveWorkspaceId(currentWorkspaceId));
6932
- void this.client.categories.refreshStore().then(() => {
6933
- void this.client.issues.refreshStore().then(() => {
6934
- void this.client.issueComments.refreshStore();
6935
- });
6936
- });
6733
+ }
6734
+ if (currentProjectId) {
6735
+ void this.client.projectAccesses.refreshStore();
6937
6736
  void this.client.projectFiles.refreshStore();
6938
- void this.client.componentTypes.refreshStore().then(() => {
6939
- void this.client.componentStages.refreshStore().then(() => {
6940
- void this.client.components.refreshStore(overwrite);
6737
+ void this.client.projectAttachments.refreshStore();
6738
+ let issuesPromise;
6739
+ void Promise.allSettled([
6740
+ this.client.categories.refreshStore(),
6741
+ this.client.issueTypes.refreshStore()
6742
+ ]).then(() => {
6743
+ issuesPromise = this.client.issues.refreshStore();
6744
+ });
6745
+ void Promise.allSettled([
6746
+ this.client.componentTypes.refreshStore(),
6747
+ this.client.componentStages.refreshStore()
6748
+ ]).then(() => {
6749
+ void this.client.components.refreshStore(overwrite).then(() => {
6750
+ void this.client.componentStageCompletions.refreshStore();
6751
+ void this.client.componentTypeAttachments.refreshStore();
6752
+ void this.client.componentAttachments.refreshStore();
6941
6753
  });
6942
6754
  });
6755
+ void this.client.documents.refreshStore().then(() => {
6756
+ void this.client.documentAttachments.refreshStore();
6757
+ });
6943
6758
  void this.client.userForms.refreshStore().then(() => {
6944
6759
  void this.client.userFormSubmissions.refreshStore();
6945
6760
  });
6946
- }
6947
- if (currentProjectId) {
6948
- const [_offlineAttachments, promise] = this.client.attachments.fetchAll(currentProjectId);
6949
- void promise.then((result) => {
6950
- const {
6951
- issue_attachments,
6952
- component_type_attachments,
6953
- component_attachments,
6954
- project_attachments,
6955
- document_attachments
6956
- } = result;
6957
- store.dispatch(setIssueAttachments(issue_attachments));
6958
- store.dispatch(setComponentAttachments(component_attachments));
6959
- store.dispatch(setComponentTypeAttachments(component_type_attachments));
6960
- store.dispatch(setProjectAttachments(project_attachments));
6961
- store.dispatch(setDocumentAttachments(document_attachments));
6962
- });
6963
- void this.client.documents.refreshStore();
6964
- void this.client.issueUpdates.refreshStore();
6965
- void this.client.issueTypes.refreshStore();
6966
6761
  void this.client.agent.refreshStore();
6762
+ void this.fetchProjectUsers();
6763
+ await issuesPromise;
6764
+ void this.client.issueAttachments.refreshStore();
6765
+ void this.client.issueComments.refreshStore();
6766
+ void this.client.issueUpdates.refreshStore();
6967
6767
  }
6768
+ void this.client.teams.refreshStore();
6968
6769
  store.dispatch(setIsFetchingInitialData(false));
6969
6770
  if (overwrite) {
6970
6771
  console.log("Overwriting data");
6971
6772
  store.dispatch(setProjects(projects));
6972
6773
  store.dispatch(setWorkspaces(workspaces));
6973
- store.dispatch(setCategories(categories));
6974
6774
  store.dispatch(resetRecentIssues());
6975
6775
  } else {
6976
6776
  console.log("Updating data (collisions will be replaced)");
6977
6777
  store.dispatch(addOrReplaceProjects(projects));
6978
6778
  store.dispatch(addOrReplaceWorkspaces(workspaces));
6979
- store.dispatch(addOrReplaceCategories(categories));
6980
6779
  }
6981
6780
  }
6982
6781
  }
@@ -7062,6 +6861,7 @@ class ProjectFileService extends BaseApiService {
7062
6861
  });
7063
6862
  return promise;
7064
6863
  }
6864
+ // TODO: This needs to be seperated into a update and create method
7065
6865
  saveActive() {
7066
6866
  const { store } = this.client;
7067
6867
  const state = store.getState();
@@ -7127,6 +6927,48 @@ class ProjectFileService extends BaseApiService {
7127
6927
  });
7128
6928
  }
7129
6929
  }
6930
+ class ProjectAttachmentService extends BaseAttachmentService {
6931
+ constructor() {
6932
+ super(...arguments);
6933
+ __publicField(this, "attachmentModel", AttachmentModel.Project);
6934
+ }
6935
+ buildOfflineAttachment(data) {
6936
+ return offline({
6937
+ file: URL.createObjectURL(data.file),
6938
+ file_sha1: data.sha1,
6939
+ created_by: data.createdBy,
6940
+ file_name: data.file.name,
6941
+ file_type: data.file.type,
6942
+ submitted_at: data.submittedAt,
6943
+ description: data.description,
6944
+ project: data.modelId
6945
+ });
6946
+ }
6947
+ async attachFilesToProject(files, projectId) {
6948
+ return this.attachFiles(files, projectId, this.buildOfflineAttachment.bind(this), {
6949
+ addAttachments: addProjectAttachments,
6950
+ updateAttachments: updateProjectAttachments,
6951
+ removeAttachments: removeProjectAttachments
6952
+ });
6953
+ }
6954
+ deleteProjectAttachment(attachmentId) {
6955
+ return this.deleteAttachment(
6956
+ attachmentId,
6957
+ {
6958
+ setAttachment: setProjectAttachment,
6959
+ removeAttachment: removeProjectAttachment
6960
+ },
6961
+ {
6962
+ selectAttachment: selectProjectAttachment
6963
+ }
6964
+ );
6965
+ }
6966
+ async refreshStore() {
6967
+ return this.getAttachments({
6968
+ setAttachments: setProjectAttachments
6969
+ });
6970
+ }
6971
+ }
7130
6972
  class ProjectService extends BaseApiService {
7131
6973
  /**
7132
6974
  * Creates a new project. Due to the nature of project creation,
@@ -8518,6 +8360,48 @@ class DocumentService extends BaseApiService {
8518
8360
  store.dispatch(addDocuments(await organizationDocumentsPromise));
8519
8361
  }
8520
8362
  }
8363
+ class DocumentAttachmentService extends BaseAttachmentService {
8364
+ constructor() {
8365
+ super(...arguments);
8366
+ __publicField(this, "attachmentModel", AttachmentModel.Document);
8367
+ }
8368
+ buildOfflineAttachment(data) {
8369
+ return offline({
8370
+ file: URL.createObjectURL(data.file),
8371
+ file_sha1: data.sha1,
8372
+ created_by: data.createdBy,
8373
+ file_name: data.file.name,
8374
+ file_type: data.file.type,
8375
+ submitted_at: data.submittedAt,
8376
+ description: data.description,
8377
+ document: data.modelId
8378
+ });
8379
+ }
8380
+ async attachFilesToDocument(files, documentId) {
8381
+ return this.attachFiles(files, documentId, this.buildOfflineAttachment.bind(this), {
8382
+ addAttachments: addDocumentAttachments,
8383
+ updateAttachments: updateDocumentAttachments,
8384
+ removeAttachments: removeDocumentAttachments
8385
+ });
8386
+ }
8387
+ deleteDocumentAttachment(attachmentId) {
8388
+ return this.deleteAttachment(
8389
+ attachmentId,
8390
+ {
8391
+ setAttachment: setDocumentAttachment,
8392
+ removeAttachment: removeDocumentAttachment
8393
+ },
8394
+ {
8395
+ selectAttachment: selectDocumentAttachment
8396
+ }
8397
+ );
8398
+ }
8399
+ async refreshStore() {
8400
+ return this.getAttachments({
8401
+ setAttachments: setDocumentAttachments
8402
+ });
8403
+ }
8404
+ }
8521
8405
  class AgentService extends BaseApiService {
8522
8406
  async startConversation(prompt) {
8523
8407
  const activeProjectId = this.client.store.getState().projectReducer.activeProjectId;
@@ -8752,7 +8636,6 @@ class OvermapSDK {
8752
8636
  __publicField(this, "store");
8753
8637
  __publicField(this, "agent", new AgentService(this));
8754
8638
  __publicField(this, "files", new FileService(this));
8755
- __publicField(this, "attachments", new AttachmentService(this));
8756
8639
  __publicField(this, "auth", new AuthService(this));
8757
8640
  __publicField(this, "categories", new CategoryService(this));
8758
8641
  __publicField(this, "projectAccesses", new ProjectAccessService(this));
@@ -8762,21 +8645,26 @@ class OvermapSDK {
8762
8645
  __publicField(this, "issueTypes", new IssueTypeService(this));
8763
8646
  __publicField(this, "issueComments", new IssueCommentService(this));
8764
8647
  __publicField(this, "issueUpdates", new IssueUpdateService(this));
8648
+ __publicField(this, "issueAttachments", new IssueAttachmentService(this));
8765
8649
  __publicField(this, "workspaces", new WorkspaceService(this));
8766
8650
  __publicField(this, "main", new MainService(this));
8767
8651
  __publicField(this, "components", new ComponentService(this));
8652
+ __publicField(this, "componentAttachments", new ComponentAttachmentService(this));
8768
8653
  __publicField(this, "componentTypes", new ComponentTypeService(this));
8654
+ __publicField(this, "componentTypeAttachments", new ComponentTypeAttachmentService(this));
8769
8655
  __publicField(this, "componentStages", new ComponentStageService(this));
8770
8656
  __publicField(this, "componentStageCompletions", new ComponentStageCompletionService(this));
8771
8657
  __publicField(this, "userForms", new UserFormService(this));
8772
8658
  __publicField(this, "userFormSubmissions", new UserFormSubmissionService(this));
8773
8659
  __publicField(this, "projects", new ProjectService(this));
8774
8660
  __publicField(this, "projectFiles", new ProjectFileService(this));
8661
+ __publicField(this, "projectAttachments", new ProjectAttachmentService(this));
8775
8662
  __publicField(this, "emailVerification", new EmailVerificationService(this));
8776
8663
  __publicField(this, "emailDomains", new EmailDomainsService(this));
8777
8664
  __publicField(this, "licenses", new LicenseService(this));
8778
8665
  __publicField(this, "documents", new DocumentService(this));
8779
8666
  __publicField(this, "teams", new TeamService(this));
8667
+ __publicField(this, "documentAttachments", new DocumentAttachmentService(this));
8780
8668
  this.API_URL = apiUrl;
8781
8669
  this.store = store;
8782
8670
  }
@@ -8959,405 +8847,151 @@ const FullScreenImagePreview = memo((props) => {
8959
8847
  },
8960
8848
  [name, file]
8961
8849
  );
8962
- return /* @__PURE__ */ jsxs(Fragment, { children: [
8963
- /* @__PURE__ */ jsx(
8964
- "button",
8965
- {
8966
- className: styles$c.FullScreenImageContainer,
8967
- type: "button",
8968
- onClick: () => {
8969
- setShowPreview(false);
8970
- },
8971
- children: /* @__PURE__ */ jsx(
8972
- "img",
8973
- {
8974
- className: styles$c.FullScreenImage,
8975
- src: url,
8976
- alt: name,
8977
- onClick: (e) => {
8978
- e.stopPropagation();
8979
- }
8980
- }
8981
- )
8982
- }
8983
- ),
8984
- /* @__PURE__ */ jsxs(Flex$1, { className: styles$c.TopBarContainer, align: "center", children: [
8985
- /* @__PURE__ */ jsx(
8986
- IconButton,
8987
- {
8988
- className: styles$c.longIconButton,
8989
- variant: "soft",
8990
- "aria-label": "Exit preview",
8991
- onClick: () => {
8992
- setShowPreview(false);
8993
- },
8994
- children: /* @__PURE__ */ jsx(RiIcon, { icon: "RiArrowLeftLine" })
8995
- }
8996
- ),
8997
- /* @__PURE__ */ jsx(Text$1, { className: styles$c.fileName, children: name }),
8998
- /* @__PURE__ */ jsx(
8999
- IconButton,
9000
- {
9001
- className: styles$c.longIconButton,
9002
- variant: "soft",
9003
- "aria-label": `Download ${name}`,
9004
- onClick: handleDownload,
9005
- children: /* @__PURE__ */ jsx(RiIcon, { icon: "RiDownload2Line" })
9006
- }
9007
- )
9008
- ] })
9009
- ] });
9010
- });
9011
- FullScreenImagePreview.displayName = "FullScreenImagePreview";
9012
- const InputWithLabel = (props) => {
9013
- const { label, children, size, severity, inputId, labelId, image, flexProps } = props;
9014
- const [resolvedImage, setResolvedImage] = useState(void 0);
9015
- const [showImagePreview, setShowImagePreview] = useState(false);
9016
- useEffect(() => {
9017
- if (image instanceof Promise) {
9018
- image.then(setResolvedImage).catch(console.error);
9019
- } else {
9020
- setResolvedImage(image);
9021
- }
9022
- }, [image]);
9023
- const resolvedImageURL = resolvedImage ? URL.createObjectURL(resolvedImage) : void 0;
9024
- return /* @__PURE__ */ jsxs(Flex$1, { direction: "column", gap: "2", children: [
9025
- resolvedImage && /* @__PURE__ */ jsxs(Fragment, { children: [
9026
- /* @__PURE__ */ jsx(
9027
- "img",
9028
- {
9029
- className: styles$c.previewImage,
9030
- src: resolvedImageURL,
9031
- alt: resolvedImage.name,
9032
- onClick: () => {
9033
- setShowImagePreview(true);
9034
- }
9035
- }
9036
- ),
9037
- showImagePreview && /* @__PURE__ */ jsx(
9038
- FullScreenImagePreview,
9039
- {
9040
- file: resolvedImage,
9041
- url: resolvedImageURL,
9042
- name: resolvedImage.name,
9043
- setShowPreview: setShowImagePreview
9044
- }
9045
- )
9046
- ] }),
9047
- /* @__PURE__ */ jsx(Flex$1, { direction: "column", gap: "1", asChild: true, ...flexProps, children: /* @__PURE__ */ jsxs("label", { htmlFor: inputId, children: [
9048
- /* @__PURE__ */ jsx(Text$1, { size, severity, id: labelId, children: label }),
9049
- children
9050
- ] }) })
9051
- ] });
9052
- };
9053
- const InputWithHelpText = (props) => {
9054
- const { helpText, children, severity } = props;
9055
- return /* @__PURE__ */ jsxs(Flex$1, { direction: "column", gap: "1", children: [
9056
- children,
9057
- /* @__PURE__ */ jsx(Flex$1, { direction: "column", children: /* @__PURE__ */ jsx(Text$1, { size: "1", severity, className: styles$c.description, children: helpText }) })
9058
- ] });
9059
- };
9060
- const InputWithLabelAndHelpText = (props) => {
9061
- const { children, ...restProps } = props;
9062
- return /* @__PURE__ */ jsx(InputWithHelpText, { ...restProps, children });
9063
- };
9064
- const useFormikInput = (props) => {
9065
- const { id, field, formId: formId2, size, showInputOnly, ...rest } = props;
9066
- const [fieldProps, meta, helpers] = useField(field.getId());
9067
- const { touched } = meta;
9068
- const helpText = meta.error ?? field.description;
9069
- const severity = meta.error ? "danger" : void 0;
9070
- const inputId = id ?? `${formId2}-${field.getId()}-input`;
9071
- const labelId = `${inputId}-label`;
9072
- const label = field.required ? `${field.label} *` : field.label;
9073
- const fieldPropsWithValidation = useMemo(() => {
9074
- const handleChange = (e) => {
9075
- const value = field.getValueFromChangeEvent(e);
9076
- void helpers.setValue(value, false).then();
9077
- if (touched || !field.onlyValidateAfterTouched) {
9078
- helpers.setError(field.getError(value));
9079
- }
9080
- };
9081
- const handleBlur = (e) => {
9082
- void helpers.setTouched(true, false).then();
9083
- helpers.setError(field.getError(field.getValueFromChangeEvent(e)));
9084
- };
9085
- return {
9086
- ...fieldProps,
9087
- onChange: handleChange,
9088
- onBlur: handleBlur
9089
- };
9090
- }, [field, fieldProps, helpers, touched]);
9091
- return [
9092
- {
9093
- helpText,
9094
- size,
9095
- severity,
9096
- inputId,
9097
- labelId,
9098
- label,
9099
- showInputOnly,
9100
- fieldProps: fieldPropsWithValidation,
9101
- helpers,
9102
- field
9103
- },
9104
- { ...rest, "aria-labelledby": labelId }
9105
- ];
9106
- };
9107
- const truthyValues = [true, "true"];
9108
- const BooleanInput = memo((props) => {
9109
- const [{ inputId, labelId, size, severity, showInputOnly, field, fieldProps }, rest] = useFormikInput(props);
9110
- let [{ helpText, label }] = useFormikInput(props);
9111
- helpText = showInputOnly ? null : helpText;
9112
- label = showInputOnly ? "" : label;
9113
- const color = useSeverityColor(severity);
9114
- const value = truthyValues.includes(fieldProps.value);
9115
- return /* @__PURE__ */ jsx(InputWithLabelAndHelpText, { helpText, severity, children: /* @__PURE__ */ jsx(
9116
- InputWithLabel,
9117
- {
9118
- size,
9119
- severity,
9120
- inputId,
9121
- labelId,
9122
- label,
9123
- image: showInputOnly ? void 0 : field.image,
9124
- flexProps: { direction: "row-reverse", justify: "end", align: "center", gap: "2" },
9125
- children: /* @__PURE__ */ jsx(
9126
- Checkbox,
9127
- {
9128
- ...rest,
9129
- ...fieldProps,
9130
- id: inputId,
9131
- color,
9132
- value: value.toString(),
9133
- checked: value,
9134
- onCheckedChange: fieldProps.onChange,
9135
- onChange: void 0,
9136
- onBlur: void 0
9137
- }
9138
- )
9139
- }
9140
- ) });
9141
- });
9142
- BooleanInput.displayName = "BooleanInput";
9143
- var DefaultContext = {
9144
- color: void 0,
9145
- size: void 0,
9146
- className: void 0,
9147
- style: void 0,
9148
- attr: void 0
9149
- };
9150
- var IconContext = React__default.createContext && /* @__PURE__ */ React__default.createContext(DefaultContext);
9151
- var _excluded = ["attr", "size", "title"];
9152
- function _objectWithoutProperties(source, excluded) {
9153
- if (source == null)
9154
- return {};
9155
- var target = _objectWithoutPropertiesLoose(source, excluded);
9156
- var key, i;
9157
- if (Object.getOwnPropertySymbols) {
9158
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
9159
- for (i = 0; i < sourceSymbolKeys.length; i++) {
9160
- key = sourceSymbolKeys[i];
9161
- if (excluded.indexOf(key) >= 0)
9162
- continue;
9163
- if (!Object.prototype.propertyIsEnumerable.call(source, key))
9164
- continue;
9165
- target[key] = source[key];
9166
- }
9167
- }
9168
- return target;
9169
- }
9170
- function _objectWithoutPropertiesLoose(source, excluded) {
9171
- if (source == null)
9172
- return {};
9173
- var target = {};
9174
- for (var key in source) {
9175
- if (Object.prototype.hasOwnProperty.call(source, key)) {
9176
- if (excluded.indexOf(key) >= 0)
9177
- continue;
9178
- target[key] = source[key];
9179
- }
9180
- }
9181
- return target;
9182
- }
9183
- function _extends$1() {
9184
- _extends$1 = Object.assign ? Object.assign.bind() : function(target) {
9185
- for (var i = 1; i < arguments.length; i++) {
9186
- var source = arguments[i];
9187
- for (var key in source) {
9188
- if (Object.prototype.hasOwnProperty.call(source, key)) {
9189
- target[key] = source[key];
9190
- }
9191
- }
9192
- }
9193
- return target;
9194
- };
9195
- return _extends$1.apply(this, arguments);
9196
- }
9197
- function ownKeys(e, r) {
9198
- var t = Object.keys(e);
9199
- if (Object.getOwnPropertySymbols) {
9200
- var o = Object.getOwnPropertySymbols(e);
9201
- r && (o = o.filter(function(r2) {
9202
- return Object.getOwnPropertyDescriptor(e, r2).enumerable;
9203
- })), t.push.apply(t, o);
9204
- }
9205
- return t;
9206
- }
9207
- function _objectSpread(e) {
9208
- for (var r = 1; r < arguments.length; r++) {
9209
- var t = null != arguments[r] ? arguments[r] : {};
9210
- r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
9211
- _defineProperty(e, r2, t[r2]);
9212
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
9213
- Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
9214
- });
9215
- }
9216
- return e;
9217
- }
9218
- function _defineProperty(obj, key, value) {
9219
- key = _toPropertyKey(key);
9220
- if (key in obj) {
9221
- Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
9222
- } else {
9223
- obj[key] = value;
9224
- }
9225
- return obj;
9226
- }
9227
- function _toPropertyKey(t) {
9228
- var i = _toPrimitive(t, "string");
9229
- return "symbol" == typeof i ? i : i + "";
9230
- }
9231
- function _toPrimitive(t, r) {
9232
- if ("object" != typeof t || !t)
9233
- return t;
9234
- var e = t[Symbol.toPrimitive];
9235
- if (void 0 !== e) {
9236
- var i = e.call(t, r || "default");
9237
- if ("object" != typeof i)
9238
- return i;
9239
- throw new TypeError("@@toPrimitive must return a primitive value.");
9240
- }
9241
- return ("string" === r ? String : Number)(t);
9242
- }
9243
- function Tree2Element(tree) {
9244
- return tree && tree.map((node, i) => /* @__PURE__ */ React__default.createElement(node.tag, _objectSpread({
9245
- key: i
9246
- }, node.attr), Tree2Element(node.child)));
9247
- }
9248
- function GenIcon(data) {
9249
- return (props) => /* @__PURE__ */ React__default.createElement(IconBase, _extends$1({
9250
- attr: _objectSpread({}, data.attr)
9251
- }, props), Tree2Element(data.child));
9252
- }
9253
- function IconBase(props) {
9254
- var elem = (conf) => {
9255
- var {
9256
- attr,
9257
- size,
9258
- title: title2
9259
- } = props, svgProps = _objectWithoutProperties(props, _excluded);
9260
- var computedSize = size || conf.size || "1em";
9261
- var className;
9262
- if (conf.className)
9263
- className = conf.className;
9264
- if (props.className)
9265
- className = (className ? className + " " : "") + props.className;
9266
- return /* @__PURE__ */ React__default.createElement("svg", _extends$1({
9267
- stroke: "currentColor",
9268
- fill: "currentColor",
9269
- strokeWidth: "0"
9270
- }, conf.attr, attr, svgProps, {
9271
- className,
9272
- style: _objectSpread(_objectSpread({
9273
- color: props.color || conf.color
9274
- }, conf.style), props.style),
9275
- height: computedSize,
9276
- width: computedSize,
9277
- xmlns: "http://www.w3.org/2000/svg"
9278
- }), title2 && /* @__PURE__ */ React__default.createElement("title", null, title2), props.children);
9279
- };
9280
- return IconContext !== void 0 ? /* @__PURE__ */ React__default.createElement(IconContext.Consumer, null, (conf) => elem(conf)) : elem(DefaultContext);
9281
- }
9282
- function RiArrowDownLine(props) {
9283
- 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);
9284
- }
9285
- function RiArrowUpLine(props) {
9286
- 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);
9287
- }
9288
- function RiCalendarLine(props) {
9289
- 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);
9290
- }
9291
- function RiQrCodeLine(props) {
9292
- 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);
9293
- }
9294
- function RiFileCopyLine(props) {
9295
- 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);
9296
- }
9297
- function RiAlignJustify(props) {
9298
- return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M3 4H21V6H3V4ZM3 19H21V21H3V19ZM3 14H21V16H3V14ZM3 9H21V11H3V9Z" }, "child": [] }] })(props);
9299
- }
9300
- function RiHashtag(props) {
9301
- 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);
9302
- }
9303
- function RiInputField(props) {
9304
- 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);
9305
- }
9306
- function RiListCheck(props) {
9307
- 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);
9308
- }
9309
- function RiImageLine(props) {
9310
- 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);
9311
- }
9312
- function RiCheckboxCircleLine(props) {
9313
- 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);
9314
- }
9315
- function RiCheckboxLine(props) {
9316
- 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);
9317
- }
9318
- function RiDeleteBin2Line(props) {
9319
- 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);
9320
- }
9321
- function RiMenuFoldLine(props) {
9322
- 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);
9323
- }
9324
- function RiUpload2Line(props) {
9325
- 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);
9326
- }
9327
- const emptyBooleanField = {
9328
- ...emptyBaseField,
9329
- type: "boolean"
8850
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
8851
+ /* @__PURE__ */ jsx(
8852
+ "button",
8853
+ {
8854
+ className: styles$c.FullScreenImageContainer,
8855
+ type: "button",
8856
+ onClick: () => {
8857
+ setShowPreview(false);
8858
+ },
8859
+ children: /* @__PURE__ */ jsx(
8860
+ "img",
8861
+ {
8862
+ className: styles$c.FullScreenImage,
8863
+ src: url,
8864
+ alt: name,
8865
+ onClick: (e) => {
8866
+ e.stopPropagation();
8867
+ }
8868
+ }
8869
+ )
8870
+ }
8871
+ ),
8872
+ /* @__PURE__ */ jsxs(Flex$1, { className: styles$c.TopBarContainer, align: "center", children: [
8873
+ /* @__PURE__ */ jsx(
8874
+ IconButton,
8875
+ {
8876
+ className: styles$c.longIconButton,
8877
+ variant: "soft",
8878
+ "aria-label": "Exit preview",
8879
+ onClick: () => {
8880
+ setShowPreview(false);
8881
+ },
8882
+ children: /* @__PURE__ */ jsx(RiIcon, { icon: "RiArrowLeftLine" })
8883
+ }
8884
+ ),
8885
+ /* @__PURE__ */ jsx(Text$1, { className: styles$c.fileName, children: name }),
8886
+ /* @__PURE__ */ jsx(
8887
+ IconButton,
8888
+ {
8889
+ className: styles$c.longIconButton,
8890
+ variant: "soft",
8891
+ "aria-label": `Download ${name}`,
8892
+ onClick: handleDownload,
8893
+ children: /* @__PURE__ */ jsx(RiIcon, { icon: "RiDownload2Line" })
8894
+ }
8895
+ )
8896
+ ] })
8897
+ ] });
8898
+ });
8899
+ FullScreenImagePreview.displayName = "FullScreenImagePreview";
8900
+ const InputWithLabel = (props) => {
8901
+ const { label, children, size, severity, inputId, labelId, image, flexProps } = props;
8902
+ const [resolvedImage, setResolvedImage] = useState(void 0);
8903
+ const [showImagePreview, setShowImagePreview] = useState(false);
8904
+ useEffect(() => {
8905
+ if (image instanceof Promise) {
8906
+ image.then(setResolvedImage).catch(console.error);
8907
+ } else {
8908
+ setResolvedImage(image);
8909
+ }
8910
+ }, [image]);
8911
+ const resolvedImageURL = resolvedImage ? URL.createObjectURL(resolvedImage) : void 0;
8912
+ return /* @__PURE__ */ jsxs(Flex$1, { direction: "column", gap: "2", children: [
8913
+ resolvedImage && /* @__PURE__ */ jsxs(Fragment, { children: [
8914
+ /* @__PURE__ */ jsx(
8915
+ "img",
8916
+ {
8917
+ className: styles$c.previewImage,
8918
+ src: resolvedImageURL,
8919
+ alt: resolvedImage.name,
8920
+ onClick: () => {
8921
+ setShowImagePreview(true);
8922
+ }
8923
+ }
8924
+ ),
8925
+ showImagePreview && /* @__PURE__ */ jsx(
8926
+ FullScreenImagePreview,
8927
+ {
8928
+ file: resolvedImage,
8929
+ url: resolvedImageURL,
8930
+ name: resolvedImage.name,
8931
+ setShowPreview: setShowImagePreview
8932
+ }
8933
+ )
8934
+ ] }),
8935
+ /* @__PURE__ */ jsx(Flex$1, { direction: "column", gap: "1", asChild: true, ...flexProps, children: /* @__PURE__ */ jsxs("label", { htmlFor: inputId, children: [
8936
+ /* @__PURE__ */ jsx(Text$1, { size, severity, id: labelId, children: label }),
8937
+ children
8938
+ ] }) })
8939
+ ] });
9330
8940
  };
9331
- const _BooleanField = class _BooleanField extends BaseField {
9332
- constructor(options) {
9333
- super({ ...options, type: "boolean" });
9334
- __publicField(this, "onlyValidateAfterTouched", false);
9335
- }
9336
- // if a BooleanField is required, `false` is considered blank
9337
- isBlank(value) {
9338
- return this.required && !value;
9339
- }
9340
- getValueFromChangeEvent(event) {
9341
- if (typeof event === "boolean")
9342
- return event;
9343
- return event.target.checked;
9344
- }
9345
- serialize() {
9346
- return super._serialize();
9347
- }
9348
- static deserialize(data) {
9349
- if (data.type !== "boolean")
9350
- throw new Error("Type mismatch.");
9351
- return new _BooleanField(data);
9352
- }
9353
- getInput(props) {
9354
- return /* @__PURE__ */ jsx(BooleanInput, { ...props, field: this });
9355
- }
8941
+ const InputWithHelpText = (props) => {
8942
+ const { helpText, children, severity } = props;
8943
+ return /* @__PURE__ */ jsxs(Flex$1, { direction: "column", gap: "1", children: [
8944
+ children,
8945
+ /* @__PURE__ */ jsx(Flex$1, { direction: "column", children: /* @__PURE__ */ jsx(Text$1, { size: "1", severity, className: styles$c.description, children: helpText }) })
8946
+ ] });
8947
+ };
8948
+ const InputWithLabelAndHelpText = (props) => {
8949
+ const { children, ...restProps } = props;
8950
+ return /* @__PURE__ */ jsx(InputWithHelpText, { ...restProps, children });
8951
+ };
8952
+ const useFormikInput = (props) => {
8953
+ const { id, field, formId: formId2, size, showInputOnly, ...rest } = props;
8954
+ const [fieldProps, meta, helpers] = useField(field.getId());
8955
+ const { touched } = meta;
8956
+ const helpText = meta.error ?? field.description;
8957
+ const severity = meta.error ? "danger" : void 0;
8958
+ const inputId = id ?? `${formId2}-${field.getId()}-input`;
8959
+ const labelId = `${inputId}-label`;
8960
+ const label = field.required ? `${field.label} *` : field.label;
8961
+ const fieldPropsWithValidation = useMemo(() => {
8962
+ const handleChange = (e) => {
8963
+ const value = field.getValueFromChangeEvent(e);
8964
+ void helpers.setValue(value, false).then();
8965
+ if (touched || !field.onlyValidateAfterTouched) {
8966
+ helpers.setError(field.getError(value));
8967
+ }
8968
+ };
8969
+ const handleBlur = (e) => {
8970
+ void helpers.setTouched(true, false).then();
8971
+ helpers.setError(field.getError(field.getValueFromChangeEvent(e)));
8972
+ };
8973
+ return {
8974
+ ...fieldProps,
8975
+ onChange: handleChange,
8976
+ onBlur: handleBlur
8977
+ };
8978
+ }, [field, fieldProps, helpers, touched]);
8979
+ return [
8980
+ {
8981
+ helpText,
8982
+ size,
8983
+ severity,
8984
+ inputId,
8985
+ labelId,
8986
+ label,
8987
+ showInputOnly,
8988
+ fieldProps: fieldPropsWithValidation,
8989
+ helpers,
8990
+ field
8991
+ },
8992
+ { ...rest, "aria-labelledby": labelId }
8993
+ ];
9356
8994
  };
9357
- __publicField(_BooleanField, "fieldTypeName", "Checkbox");
9358
- __publicField(_BooleanField, "fieldTypeDescription", "Perfect for both optional and required yes/no questions.");
9359
- __publicField(_BooleanField, "Icon", RiCheckboxCircleLine);
9360
- let BooleanField = _BooleanField;
9361
8995
  function getDefaultExportFromCjs(x) {
9362
8996
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
9363
8997
  }
@@ -9410,8 +9044,8 @@ var classnames = { exports: {} };
9410
9044
  })(classnames);
9411
9045
  var classnamesExports = classnames.exports;
9412
9046
  const classNames = /* @__PURE__ */ getDefaultExportFromCjs(classnamesExports);
9413
- function _extends() {
9414
- _extends = Object.assign ? Object.assign.bind() : function(target) {
9047
+ function _extends$1() {
9048
+ _extends$1 = Object.assign ? Object.assign.bind() : function(target) {
9415
9049
  for (var i = 1; i < arguments.length; i++) {
9416
9050
  var source = arguments[i];
9417
9051
  for (var key in source) {
@@ -9422,7 +9056,7 @@ function _extends() {
9422
9056
  }
9423
9057
  return target;
9424
9058
  };
9425
- return _extends.apply(this, arguments);
9059
+ return _extends$1.apply(this, arguments);
9426
9060
  }
9427
9061
  function $e42e1063c40fb3ef$export$b9ecd428b558ff10(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
9428
9062
  return function handleEvent(event) {
@@ -9553,11 +9187,11 @@ const $5e63c961fc1ce211$export$8c6ed5c666ac1360 = /* @__PURE__ */ forwardRef((pr
9553
9187
  } else
9554
9188
  return child;
9555
9189
  });
9556
- return /* @__PURE__ */ createElement($5e63c961fc1ce211$var$SlotClone, _extends({}, slotProps, {
9190
+ return /* @__PURE__ */ createElement($5e63c961fc1ce211$var$SlotClone, _extends$1({}, slotProps, {
9557
9191
  ref: forwardedRef
9558
9192
  }), /* @__PURE__ */ isValidElement(newElement) ? /* @__PURE__ */ cloneElement(newElement, void 0, newChildren) : null);
9559
9193
  }
9560
- return /* @__PURE__ */ createElement($5e63c961fc1ce211$var$SlotClone, _extends({}, slotProps, {
9194
+ return /* @__PURE__ */ createElement($5e63c961fc1ce211$var$SlotClone, _extends$1({}, slotProps, {
9561
9195
  ref: forwardedRef
9562
9196
  }), children);
9563
9197
  });
@@ -9635,7 +9269,7 @@ const $8927f6f2acc4f386$export$250ffa63cdc0d034 = $8927f6f2acc4f386$var$NODES.re
9635
9269
  useEffect(() => {
9636
9270
  window[Symbol.for("radix-ui")] = true;
9637
9271
  }, []);
9638
- return /* @__PURE__ */ createElement(Comp, _extends({}, primitiveProps, {
9272
+ return /* @__PURE__ */ createElement(Comp, _extends$1({}, primitiveProps, {
9639
9273
  ref: forwardedRef
9640
9274
  }));
9641
9275
  });
@@ -10194,9 +9828,9 @@ const Inset = React.forwardRef((props, forwardedRef) => {
10194
9828
  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)) });
10195
9829
  });
10196
9830
  Inset.displayName = "Inset";
10197
- const sizes$8 = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
9831
+ const sizes$9 = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
10198
9832
  const headingPropDefs = {
10199
- size: { type: "enum", values: sizes$8, default: "6", responsive: true },
9833
+ size: { type: "enum", values: sizes$9, default: "6", responsive: true },
10200
9834
  weight: { ...weightProp, default: "bold" },
10201
9835
  align: alignProp,
10202
9836
  trim: trimProp,
@@ -10209,9 +9843,9 @@ const Heading = React.forwardRef((props, forwardedRef) => {
10209
9843
  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));
10210
9844
  });
10211
9845
  Heading.displayName = "Heading";
10212
- const sizes$7 = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
9846
+ const sizes$8 = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
10213
9847
  const textPropDefs = {
10214
- size: { type: "enum", values: sizes$7, default: void 0, responsive: true },
9848
+ size: { type: "enum", values: sizes$8, default: void 0, responsive: true },
10215
9849
  weight: weightProp,
10216
9850
  align: alignProp,
10217
9851
  trim: trimProp,
@@ -10224,11 +9858,11 @@ const Text = React.forwardRef((props, forwardedRef) => {
10224
9858
  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));
10225
9859
  });
10226
9860
  Text.displayName = "Text";
10227
- const sizes$6 = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
10228
- const variants$4 = ["solid", "soft", "outline", "ghost"];
9861
+ const sizes$7 = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
9862
+ const variants$5 = ["solid", "soft", "outline", "ghost"];
10229
9863
  const codePropDefs = {
10230
- size: { type: "enum", values: sizes$6, default: void 0, responsive: true },
10231
- variant: { type: "enum", values: variants$4, default: "soft" },
9864
+ size: { type: "enum", values: sizes$7, default: void 0, responsive: true },
9865
+ variant: { type: "enum", values: variants$5, default: "soft" },
10232
9866
  weight: weightProp,
10233
9867
  color: colorProp,
10234
9868
  highContrast: highContrastProp
@@ -10258,6 +9892,202 @@ function $010c2913dbd2fe3d$export$5cae361ad82dce8b(value) {
10258
9892
  value
10259
9893
  ]);
10260
9894
  }
9895
+ const $e698a72e93240346$var$CHECKBOX_NAME = "Checkbox";
9896
+ const [$e698a72e93240346$var$createCheckboxContext, $e698a72e93240346$export$b566c4ff5488ea01] = $c512c27ab02ef895$export$50c7b4e9d9f19c1($e698a72e93240346$var$CHECKBOX_NAME);
9897
+ const [$e698a72e93240346$var$CheckboxProvider, $e698a72e93240346$var$useCheckboxContext] = $e698a72e93240346$var$createCheckboxContext($e698a72e93240346$var$CHECKBOX_NAME);
9898
+ const $e698a72e93240346$export$48513f6b9f8ce62d = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
9899
+ const { __scopeCheckbox, name, checked: checkedProp, defaultChecked, required, disabled, value = "on", onCheckedChange, ...checkboxProps } = props;
9900
+ const [button, setButton] = useState(null);
9901
+ const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(
9902
+ forwardedRef,
9903
+ (node) => setButton(node)
9904
+ );
9905
+ const hasConsumerStoppedPropagationRef = useRef(false);
9906
+ const isFormControl = button ? Boolean(button.closest("form")) : true;
9907
+ const [checked = false, setChecked] = $71cd76cc60e0454e$export$6f32135080cb4c3({
9908
+ prop: checkedProp,
9909
+ defaultProp: defaultChecked,
9910
+ onChange: onCheckedChange
9911
+ });
9912
+ const initialCheckedStateRef = useRef(checked);
9913
+ useEffect(() => {
9914
+ const form = button === null || button === void 0 ? void 0 : button.form;
9915
+ if (form) {
9916
+ const reset = () => setChecked(initialCheckedStateRef.current);
9917
+ form.addEventListener("reset", reset);
9918
+ return () => form.removeEventListener("reset", reset);
9919
+ }
9920
+ }, [
9921
+ button,
9922
+ setChecked
9923
+ ]);
9924
+ return /* @__PURE__ */ createElement($e698a72e93240346$var$CheckboxProvider, {
9925
+ scope: __scopeCheckbox,
9926
+ state: checked,
9927
+ disabled
9928
+ }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.button, _extends$1({
9929
+ type: "button",
9930
+ role: "checkbox",
9931
+ "aria-checked": $e698a72e93240346$var$isIndeterminate(checked) ? "mixed" : checked,
9932
+ "aria-required": required,
9933
+ "data-state": $e698a72e93240346$var$getState(checked),
9934
+ "data-disabled": disabled ? "" : void 0,
9935
+ disabled,
9936
+ value
9937
+ }, checkboxProps, {
9938
+ ref: composedRefs,
9939
+ onKeyDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onKeyDown, (event) => {
9940
+ if (event.key === "Enter")
9941
+ event.preventDefault();
9942
+ }),
9943
+ onClick: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onClick, (event) => {
9944
+ setChecked(
9945
+ (prevChecked) => $e698a72e93240346$var$isIndeterminate(prevChecked) ? true : !prevChecked
9946
+ );
9947
+ if (isFormControl) {
9948
+ hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
9949
+ if (!hasConsumerStoppedPropagationRef.current)
9950
+ event.stopPropagation();
9951
+ }
9952
+ })
9953
+ })), isFormControl && /* @__PURE__ */ createElement($e698a72e93240346$var$BubbleInput, {
9954
+ control: button,
9955
+ bubbles: !hasConsumerStoppedPropagationRef.current,
9956
+ name,
9957
+ value,
9958
+ checked,
9959
+ required,
9960
+ disabled,
9961
+ style: {
9962
+ transform: "translateX(-100%)"
9963
+ }
9964
+ }));
9965
+ });
9966
+ const $e698a72e93240346$var$INDICATOR_NAME = "CheckboxIndicator";
9967
+ const $e698a72e93240346$export$59aad738f51d1c05 = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
9968
+ const { __scopeCheckbox, forceMount, ...indicatorProps } = props;
9969
+ const context = $e698a72e93240346$var$useCheckboxContext($e698a72e93240346$var$INDICATOR_NAME, __scopeCheckbox);
9970
+ return /* @__PURE__ */ createElement($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
9971
+ present: forceMount || $e698a72e93240346$var$isIndeterminate(context.state) || context.state === true
9972
+ }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends$1({
9973
+ "data-state": $e698a72e93240346$var$getState(context.state),
9974
+ "data-disabled": context.disabled ? "" : void 0
9975
+ }, indicatorProps, {
9976
+ ref: forwardedRef,
9977
+ style: {
9978
+ pointerEvents: "none",
9979
+ ...props.style
9980
+ }
9981
+ })));
9982
+ });
9983
+ const $e698a72e93240346$var$BubbleInput = (props) => {
9984
+ const { control, checked, bubbles = true, ...inputProps } = props;
9985
+ const ref = useRef(null);
9986
+ const prevChecked = $010c2913dbd2fe3d$export$5cae361ad82dce8b(checked);
9987
+ const controlSize = $db6c3485150b8e66$export$1ab7ae714698c4b8(control);
9988
+ useEffect(() => {
9989
+ const input = ref.current;
9990
+ const inputProto = window.HTMLInputElement.prototype;
9991
+ const descriptor = Object.getOwnPropertyDescriptor(inputProto, "checked");
9992
+ const setChecked = descriptor.set;
9993
+ if (prevChecked !== checked && setChecked) {
9994
+ const event = new Event("click", {
9995
+ bubbles
9996
+ });
9997
+ input.indeterminate = $e698a72e93240346$var$isIndeterminate(checked);
9998
+ setChecked.call(input, $e698a72e93240346$var$isIndeterminate(checked) ? false : checked);
9999
+ input.dispatchEvent(event);
10000
+ }
10001
+ }, [
10002
+ prevChecked,
10003
+ checked,
10004
+ bubbles
10005
+ ]);
10006
+ return /* @__PURE__ */ createElement("input", _extends$1({
10007
+ type: "checkbox",
10008
+ "aria-hidden": true,
10009
+ defaultChecked: $e698a72e93240346$var$isIndeterminate(checked) ? false : checked
10010
+ }, inputProps, {
10011
+ tabIndex: -1,
10012
+ ref,
10013
+ style: {
10014
+ ...props.style,
10015
+ ...controlSize,
10016
+ position: "absolute",
10017
+ pointerEvents: "none",
10018
+ opacity: 0,
10019
+ margin: 0
10020
+ }
10021
+ }));
10022
+ };
10023
+ function $e698a72e93240346$var$isIndeterminate(checked) {
10024
+ return checked === "indeterminate";
10025
+ }
10026
+ function $e698a72e93240346$var$getState(checked) {
10027
+ return $e698a72e93240346$var$isIndeterminate(checked) ? "indeterminate" : checked ? "checked" : "unchecked";
10028
+ }
10029
+ const $e698a72e93240346$export$be92b6f5f03c0fe9 = $e698a72e93240346$export$48513f6b9f8ce62d;
10030
+ const $e698a72e93240346$export$adb584737d712b70 = $e698a72e93240346$export$59aad738f51d1c05;
10031
+ const sizes$6 = ["1", "2", "3"];
10032
+ const variants$4 = ["classic", "surface", "soft"];
10033
+ const checkboxPropDefs = {
10034
+ size: { type: "enum", values: sizes$6, default: "2", responsive: true },
10035
+ variant: { type: "enum", values: variants$4, default: "surface" },
10036
+ color: colorProp,
10037
+ highContrast: highContrastProp
10038
+ };
10039
+ const ThickCheckIcon = React.forwardRef(({ color = "currentColor", ...props }, forwardedRef) => {
10040
+ return React.createElement(
10041
+ "svg",
10042
+ { width: "9", height: "9", viewBox: "0 0 9 9", fill: color, xmlns: "http://www.w3.org/2000/svg", ...props, ref: forwardedRef },
10043
+ 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" })
10044
+ );
10045
+ });
10046
+ ThickCheckIcon.displayName = "ThickCheckIcon";
10047
+ const ChevronDownIcon = React.forwardRef(({ color = "currentColor", ...props }, forwardedRef) => {
10048
+ return React.createElement(
10049
+ "svg",
10050
+ { width: "9", height: "9", viewBox: "0 0 9 9", fill: color, xmlns: "http://www.w3.org/2000/svg", ...props, ref: forwardedRef },
10051
+ 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" })
10052
+ );
10053
+ });
10054
+ ChevronDownIcon.displayName = "ChevronDownIcon";
10055
+ const ThickChevronRightIcon = React.forwardRef(({ color = "currentColor", ...props }, forwardedRef) => {
10056
+ return React.createElement(
10057
+ "svg",
10058
+ { width: "9", height: "9", viewBox: "0 0 9 9", fill: color, xmlns: "http://www.w3.org/2000/svg", ...props, ref: forwardedRef },
10059
+ 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" })
10060
+ );
10061
+ });
10062
+ ThickChevronRightIcon.displayName = "ThickChevronRightIcon";
10063
+ const InfoCircledIcon = React.forwardRef(({ color = "currentColor", ...props }, forwardedRef) => {
10064
+ return React.createElement(
10065
+ "svg",
10066
+ { width: "15", height: "15", viewBox: "0 0 15 15", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, ref: forwardedRef },
10067
+ 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" })
10068
+ );
10069
+ });
10070
+ InfoCircledIcon.displayName = "InfoCircledIcon";
10071
+ const Checkbox = React.forwardRef((props, forwardedRef) => {
10072
+ const { rest: marginRest, ...marginProps } = extractMarginProps(props);
10073
+ const { className, style, size = checkboxPropDefs.size.default, variant = checkboxPropDefs.variant.default, color = checkboxPropDefs.color.default, highContrast = checkboxPropDefs.highContrast.default, ...checkboxProps } = marginRest;
10074
+ return React.createElement(
10075
+ "span",
10076
+ { className: classNames("rt-CheckboxRoot", className, withBreakpoints(size, "rt-r-size"), withMarginProps(marginProps)), style },
10077
+ React.createElement(
10078
+ $e698a72e93240346$export$be92b6f5f03c0fe9,
10079
+ { "data-accent-color": color, ...checkboxProps, ref: forwardedRef, className: classNames("rt-reset", "rt-CheckboxButton", `rt-variant-${variant}`, {
10080
+ "rt-high-contrast": highContrast
10081
+ }) },
10082
+ React.createElement(
10083
+ $e698a72e93240346$export$adb584737d712b70,
10084
+ { className: "rt-CheckboxIndicator" },
10085
+ React.createElement(ThickCheckIcon, { className: "rt-CheckboxIndicatorIcon" })
10086
+ )
10087
+ )
10088
+ );
10089
+ });
10090
+ Checkbox.displayName = "Checkbox";
10261
10091
  function $e02a7d9cb1dc128c$export$c74125a8e3af6bb2(name) {
10262
10092
  const PROVIDER_NAME = name + "CollectionProvider";
10263
10093
  const [createCollectionContext, createCollectionScope] = $c512c27ab02ef895$export$50c7b4e9d9f19c1(PROVIDER_NAME);
@@ -10349,7 +10179,7 @@ const $d7bdfb9eb0fdf311$export$8699f7c8af148338 = /* @__PURE__ */ forwardRef((pr
10349
10179
  scope: props.__scopeRovingFocusGroup
10350
10180
  }, /* @__PURE__ */ createElement($d7bdfb9eb0fdf311$var$Collection.Slot, {
10351
10181
  scope: props.__scopeRovingFocusGroup
10352
- }, /* @__PURE__ */ createElement($d7bdfb9eb0fdf311$var$RovingFocusGroupImpl, _extends({}, props, {
10182
+ }, /* @__PURE__ */ createElement($d7bdfb9eb0fdf311$var$RovingFocusGroupImpl, _extends$1({}, props, {
10353
10183
  ref: forwardedRef
10354
10184
  }))));
10355
10185
  });
@@ -10405,7 +10235,7 @@ const $d7bdfb9eb0fdf311$var$RovingFocusGroupImpl = /* @__PURE__ */ forwardRef((p
10405
10235
  ),
10406
10236
  []
10407
10237
  )
10408
- }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
10238
+ }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends$1({
10409
10239
  tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,
10410
10240
  "data-orientation": orientation
10411
10241
  }, groupProps, {
@@ -10475,7 +10305,7 @@ const $d7bdfb9eb0fdf311$export$ab9df7c53fe8454 = /* @__PURE__ */ forwardRef((pro
10475
10305
  id,
10476
10306
  focusable,
10477
10307
  active
10478
- }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends({
10308
+ }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends$1({
10479
10309
  tabIndex: isCurrentTabStop ? 0 : -1,
10480
10310
  "data-orientation": context.orientation
10481
10311
  }, itemProps, {
@@ -10615,7 +10445,7 @@ const $57acba87d6e25586$export$ccf8d8d7bbf3c2cc = /* @__PURE__ */ forwardRef((pr
10615
10445
  onScrollbarYEnabledChange: setScrollbarYEnabled,
10616
10446
  onCornerWidthChange: setCornerWidth,
10617
10447
  onCornerHeightChange: setCornerHeight
10618
- }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
10448
+ }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends$1({
10619
10449
  dir: direction
10620
10450
  }, scrollAreaProps, {
10621
10451
  ref: composedRefs,
@@ -10638,7 +10468,7 @@ const $57acba87d6e25586$export$a21cbf9f11fca853 = /* @__PURE__ */ forwardRef((pr
10638
10468
  dangerouslySetInnerHTML: {
10639
10469
  __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}`
10640
10470
  }
10641
- }), /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
10471
+ }), /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends$1({
10642
10472
  "data-radix-scroll-area-viewport": ""
10643
10473
  }, viewportProps, {
10644
10474
  ref: composedRefs,
@@ -10682,16 +10512,16 @@ const $57acba87d6e25586$export$2fabd85d0eba3c57 = /* @__PURE__ */ forwardRef((pr
10682
10512
  onScrollbarXEnabledChange,
10683
10513
  onScrollbarYEnabledChange
10684
10514
  ]);
10685
- return context.type === "hover" ? /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarHover, _extends({}, scrollbarProps, {
10515
+ return context.type === "hover" ? /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarHover, _extends$1({}, scrollbarProps, {
10686
10516
  ref: forwardedRef,
10687
10517
  forceMount
10688
- })) : context.type === "scroll" ? /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarScroll, _extends({}, scrollbarProps, {
10518
+ })) : context.type === "scroll" ? /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarScroll, _extends$1({}, scrollbarProps, {
10689
10519
  ref: forwardedRef,
10690
10520
  forceMount
10691
- })) : context.type === "auto" ? /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarAuto, _extends({}, scrollbarProps, {
10521
+ })) : context.type === "auto" ? /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarAuto, _extends$1({}, scrollbarProps, {
10692
10522
  ref: forwardedRef,
10693
10523
  forceMount
10694
- })) : context.type === "always" ? /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarVisible, _extends({}, scrollbarProps, {
10524
+ })) : context.type === "always" ? /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarVisible, _extends$1({}, scrollbarProps, {
10695
10525
  ref: forwardedRef
10696
10526
  })) : null;
10697
10527
  });
@@ -10727,7 +10557,7 @@ const $57acba87d6e25586$var$ScrollAreaScrollbarHover = /* @__PURE__ */ forwardRe
10727
10557
  ]);
10728
10558
  return /* @__PURE__ */ createElement($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
10729
10559
  present: forceMount || visible
10730
- }, /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarAuto, _extends({
10560
+ }, /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarAuto, _extends$1({
10731
10561
  "data-state": visible ? "visible" : "hidden"
10732
10562
  }, scrollbarProps, {
10733
10563
  ref: forwardedRef
@@ -10797,7 +10627,7 @@ const $57acba87d6e25586$var$ScrollAreaScrollbarScroll = /* @__PURE__ */ forwardR
10797
10627
  ]);
10798
10628
  return /* @__PURE__ */ createElement($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
10799
10629
  present: forceMount || state !== "hidden"
10800
- }, /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarVisible, _extends({
10630
+ }, /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarVisible, _extends$1({
10801
10631
  "data-state": state === "hidden" ? "hidden" : "visible"
10802
10632
  }, scrollbarProps, {
10803
10633
  ref: forwardedRef,
@@ -10827,7 +10657,7 @@ const $57acba87d6e25586$var$ScrollAreaScrollbarAuto = /* @__PURE__ */ forwardRef
10827
10657
  $57acba87d6e25586$var$useResizeObserver(context.content, handleResize);
10828
10658
  return /* @__PURE__ */ createElement($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
10829
10659
  present: forceMount || visible
10830
- }, /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarVisible, _extends({
10660
+ }, /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarVisible, _extends$1({
10831
10661
  "data-state": visible ? "visible" : "hidden"
10832
10662
  }, scrollbarProps, {
10833
10663
  ref: forwardedRef
@@ -10861,7 +10691,7 @@ const $57acba87d6e25586$var$ScrollAreaScrollbarVisible = /* @__PURE__ */ forward
10861
10691
  return $57acba87d6e25586$var$getScrollPositionFromPointer(pointerPos, pointerOffsetRef.current, sizes2, dir);
10862
10692
  }
10863
10693
  if (orientation === "horizontal")
10864
- return /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarX, _extends({}, commonProps, {
10694
+ return /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarX, _extends$1({}, commonProps, {
10865
10695
  ref: forwardedRef,
10866
10696
  onThumbPositionChange: () => {
10867
10697
  if (context.viewport && thumbRef.current) {
@@ -10880,7 +10710,7 @@ const $57acba87d6e25586$var$ScrollAreaScrollbarVisible = /* @__PURE__ */ forward
10880
10710
  }
10881
10711
  }));
10882
10712
  if (orientation === "vertical")
10883
- return /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarY, _extends({}, commonProps, {
10713
+ return /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarY, _extends$1({}, commonProps, {
10884
10714
  ref: forwardedRef,
10885
10715
  onThumbPositionChange: () => {
10886
10716
  if (context.viewport && thumbRef.current) {
@@ -10912,7 +10742,7 @@ const $57acba87d6e25586$var$ScrollAreaScrollbarX = /* @__PURE__ */ forwardRef((p
10912
10742
  }, [
10913
10743
  ref
10914
10744
  ]);
10915
- return /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarImpl, _extends({
10745
+ return /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarImpl, _extends$1({
10916
10746
  "data-orientation": "horizontal"
10917
10747
  }, scrollbarProps, {
10918
10748
  ref: composeRefs,
@@ -10960,7 +10790,7 @@ const $57acba87d6e25586$var$ScrollAreaScrollbarY = /* @__PURE__ */ forwardRef((p
10960
10790
  }, [
10961
10791
  ref
10962
10792
  ]);
10963
- return /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarImpl, _extends({
10793
+ return /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarImpl, _extends$1({
10964
10794
  "data-orientation": "vertical"
10965
10795
  }, scrollbarProps, {
10966
10796
  ref: composeRefs,
@@ -11056,7 +10886,7 @@ const $57acba87d6e25586$var$ScrollAreaScrollbarImpl = /* @__PURE__ */ forwardRef
11056
10886
  onThumbPointerUp: $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onThumbPointerUp),
11057
10887
  onThumbPositionChange: handleThumbPositionChange,
11058
10888
  onThumbPointerDown: $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onThumbPointerDown)
11059
- }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, scrollbarProps, {
10889
+ }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends$1({}, scrollbarProps, {
11060
10890
  ref: composeRefs,
11061
10891
  style: {
11062
10892
  position: "absolute",
@@ -11093,7 +10923,7 @@ const $57acba87d6e25586$export$9fba1154677d7cd2 = /* @__PURE__ */ forwardRef((pr
11093
10923
  const scrollbarContext = $57acba87d6e25586$var$useScrollbarContext($57acba87d6e25586$var$THUMB_NAME, props.__scopeScrollArea);
11094
10924
  return /* @__PURE__ */ createElement($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
11095
10925
  present: forceMount || scrollbarContext.hasThumb
11096
- }, /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaThumbImpl, _extends({
10926
+ }, /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaThumbImpl, _extends$1({
11097
10927
  ref: forwardedRef
11098
10928
  }, thumbProps)));
11099
10929
  });
@@ -11133,7 +10963,7 @@ const $57acba87d6e25586$var$ScrollAreaThumbImpl = /* @__PURE__ */ forwardRef((pr
11133
10963
  debounceScrollEnd,
11134
10964
  onThumbPositionChange
11135
10965
  ]);
11136
- return /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
10966
+ return /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends$1({
11137
10967
  "data-state": scrollbarContext.hasThumb ? "visible" : "hidden"
11138
10968
  }, thumbProps, {
11139
10969
  ref: composedRef,
@@ -11160,7 +10990,7 @@ const $57acba87d6e25586$export$56969d565df7cc4b = /* @__PURE__ */ forwardRef((pr
11160
10990
  const context = $57acba87d6e25586$var$useScrollAreaContext($57acba87d6e25586$var$CORNER_NAME, props.__scopeScrollArea);
11161
10991
  const hasBothScrollbarsVisible = Boolean(context.scrollbarX && context.scrollbarY);
11162
10992
  const hasCorner = context.type !== "scroll" && hasBothScrollbarsVisible;
11163
- return hasCorner ? /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaCornerImpl, _extends({}, props, {
10993
+ return hasCorner ? /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaCornerImpl, _extends$1({}, props, {
11164
10994
  ref: forwardedRef
11165
10995
  })) : null;
11166
10996
  });
@@ -11182,7 +11012,7 @@ const $57acba87d6e25586$var$ScrollAreaCornerImpl = /* @__PURE__ */ forwardRef((p
11182
11012
  context.onCornerWidthChange(width);
11183
11013
  setWidth(width);
11184
11014
  });
11185
- return hasSize ? /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, cornerProps, {
11015
+ return hasSize ? /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends$1({}, cornerProps, {
11186
11016
  ref: forwardedRef,
11187
11017
  style: {
11188
11018
  width: width1,
@@ -11443,7 +11273,7 @@ const $faa2e61a3361514f$export$472062a354075cee = /* @__PURE__ */ forwardRef((pr
11443
11273
  scope: props.__scopeSlider
11444
11274
  }, /* @__PURE__ */ createElement($faa2e61a3361514f$var$Collection.Slot, {
11445
11275
  scope: props.__scopeSlider
11446
- }, /* @__PURE__ */ createElement(SliderOrientation, _extends({
11276
+ }, /* @__PURE__ */ createElement(SliderOrientation, _extends$1({
11447
11277
  "aria-disabled": disabled,
11448
11278
  "data-disabled": disabled ? "" : void 0
11449
11279
  }, sliderProps, {
@@ -11525,7 +11355,7 @@ const $faa2e61a3361514f$var$SliderHorizontal = /* @__PURE__ */ forwardRef((props
11525
11355
  endEdge: isSlidingFromLeft ? "right" : "left",
11526
11356
  direction: isSlidingFromLeft ? 1 : -1,
11527
11357
  size: "width"
11528
- }, /* @__PURE__ */ createElement($faa2e61a3361514f$var$SliderImpl, _extends({
11358
+ }, /* @__PURE__ */ createElement($faa2e61a3361514f$var$SliderImpl, _extends$1({
11529
11359
  dir: direction,
11530
11360
  "data-orientation": "horizontal"
11531
11361
  }, sliderProps, {
@@ -11585,7 +11415,7 @@ const $faa2e61a3361514f$var$SliderVertical = /* @__PURE__ */ forwardRef((props,
11585
11415
  endEdge: isSlidingFromBottom ? "top" : "bottom",
11586
11416
  size: "height",
11587
11417
  direction: isSlidingFromBottom ? 1 : -1
11588
- }, /* @__PURE__ */ createElement($faa2e61a3361514f$var$SliderImpl, _extends({
11418
+ }, /* @__PURE__ */ createElement($faa2e61a3361514f$var$SliderImpl, _extends$1({
11589
11419
  "data-orientation": "vertical"
11590
11420
  }, sliderProps, {
11591
11421
  ref,
@@ -11618,7 +11448,7 @@ const $faa2e61a3361514f$var$SliderVertical = /* @__PURE__ */ forwardRef((props,
11618
11448
  const $faa2e61a3361514f$var$SliderImpl = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
11619
11449
  const { __scopeSlider, onSlideStart, onSlideMove, onSlideEnd, onHomeKeyDown, onEndKeyDown, onStepKeyDown, ...sliderProps } = props;
11620
11450
  const context = $faa2e61a3361514f$var$useSliderContext($faa2e61a3361514f$var$SLIDER_NAME, __scopeSlider);
11621
- return /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends({}, sliderProps, {
11451
+ return /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends$1({}, sliderProps, {
11622
11452
  ref: forwardedRef,
11623
11453
  onKeyDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onKeyDown, (event) => {
11624
11454
  if (event.key === "Home") {
@@ -11659,7 +11489,7 @@ const $faa2e61a3361514f$var$TRACK_NAME = "SliderTrack";
11659
11489
  const $faa2e61a3361514f$export$105594979f116971 = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
11660
11490
  const { __scopeSlider, ...trackProps } = props;
11661
11491
  const context = $faa2e61a3361514f$var$useSliderContext($faa2e61a3361514f$var$TRACK_NAME, __scopeSlider);
11662
- return /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends({
11492
+ return /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends$1({
11663
11493
  "data-disabled": context.disabled ? "" : void 0,
11664
11494
  "data-orientation": context.orientation
11665
11495
  }, trackProps, {
@@ -11679,7 +11509,7 @@ const $faa2e61a3361514f$export$a5cf38a7a000fe77 = /* @__PURE__ */ forwardRef((pr
11679
11509
  );
11680
11510
  const offsetStart = valuesCount > 1 ? Math.min(...percentages) : 0;
11681
11511
  const offsetEnd = 100 - Math.max(...percentages);
11682
- return /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends({
11512
+ return /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends$1({
11683
11513
  "data-orientation": context.orientation,
11684
11514
  "data-disabled": context.disabled ? "" : void 0
11685
11515
  }, rangeProps, {
@@ -11708,7 +11538,7 @@ const $faa2e61a3361514f$export$2c1b491743890dec = /* @__PURE__ */ forwardRef((pr
11708
11538
  thumb
11709
11539
  ]
11710
11540
  );
11711
- return /* @__PURE__ */ createElement($faa2e61a3361514f$var$SliderThumbImpl, _extends({}, props, {
11541
+ return /* @__PURE__ */ createElement($faa2e61a3361514f$var$SliderThumbImpl, _extends$1({}, props, {
11712
11542
  ref: composedRefs,
11713
11543
  index: index2
11714
11544
  }));
@@ -11747,7 +11577,7 @@ const $faa2e61a3361514f$var$SliderThumbImpl = /* @__PURE__ */ forwardRef((props,
11747
11577
  }
11748
11578
  }, /* @__PURE__ */ createElement($faa2e61a3361514f$var$Collection.ItemSlot, {
11749
11579
  scope: props.__scopeSlider
11750
- }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends({
11580
+ }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends$1({
11751
11581
  role: "slider",
11752
11582
  "aria-label": props["aria-label"] || label,
11753
11583
  "aria-valuemin": context.min,
@@ -11787,7 +11617,7 @@ const $faa2e61a3361514f$var$BubbleInput = (props) => {
11787
11617
  prevValue,
11788
11618
  value
11789
11619
  ]);
11790
- return /* @__PURE__ */ createElement("input", _extends({
11620
+ return /* @__PURE__ */ createElement("input", _extends$1({
11791
11621
  style: {
11792
11622
  display: "none"
11793
11623
  }
@@ -12006,7 +11836,7 @@ const $cddcb0b647441e34$export$e2255cf6045e8d47 = /* @__PURE__ */ forwardRef((pr
12006
11836
  scope: __scopeAvatar,
12007
11837
  imageLoadingStatus,
12008
11838
  onImageLoadingStatusChange: setImageLoadingStatus
12009
- }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends({}, avatarProps, {
11839
+ }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends$1({}, avatarProps, {
12010
11840
  ref: forwardedRef
12011
11841
  })));
12012
11842
  });
@@ -12027,7 +11857,7 @@ const $cddcb0b647441e34$export$2cd8ae1985206fe8 = /* @__PURE__ */ forwardRef((pr
12027
11857
  imageLoadingStatus,
12028
11858
  handleLoadingStatusChange
12029
11859
  ]);
12030
- return imageLoadingStatus === "loaded" ? /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.img, _extends({}, imageProps, {
11860
+ return imageLoadingStatus === "loaded" ? /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.img, _extends$1({}, imageProps, {
12031
11861
  ref: forwardedRef,
12032
11862
  src
12033
11863
  })) : null;
@@ -12048,7 +11878,7 @@ const $cddcb0b647441e34$export$69fffb6a9571fbfe = /* @__PURE__ */ forwardRef((pr
12048
11878
  }, [
12049
11879
  delayMs
12050
11880
  ]);
12051
- return canRender && context.imageLoadingStatus !== "loaded" ? /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends({}, fallbackProps, {
11881
+ return canRender && context.imageLoadingStatus !== "loaded" ? /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends$1({}, fallbackProps, {
12052
11882
  ref: forwardedRef
12053
11883
  })) : null;
12054
11884
  });
@@ -12152,7 +11982,7 @@ const $69cb30bb0017df05$export$b2539bed5023c21c = /* @__PURE__ */ forwardRef((pr
12152
11982
  orientation,
12153
11983
  dir: direction,
12154
11984
  activationMode
12155
- }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
11985
+ }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends$1({
12156
11986
  dir: direction,
12157
11987
  "data-orientation": orientation
12158
11988
  }, tabsProps, {
@@ -12164,13 +11994,13 @@ const $69cb30bb0017df05$export$9712d22edc0d78c1 = /* @__PURE__ */ forwardRef((pr
12164
11994
  const { __scopeTabs, loop = true, ...listProps } = props;
12165
11995
  const context = $69cb30bb0017df05$var$useTabsContext($69cb30bb0017df05$var$TAB_LIST_NAME, __scopeTabs);
12166
11996
  const rovingFocusGroupScope = $69cb30bb0017df05$var$useRovingFocusGroupScope(__scopeTabs);
12167
- return /* @__PURE__ */ createElement($d7bdfb9eb0fdf311$export$be92b6f5f03c0fe9, _extends({
11997
+ return /* @__PURE__ */ createElement($d7bdfb9eb0fdf311$export$be92b6f5f03c0fe9, _extends$1({
12168
11998
  asChild: true
12169
11999
  }, rovingFocusGroupScope, {
12170
12000
  orientation: context.orientation,
12171
12001
  dir: context.dir,
12172
12002
  loop
12173
- }), /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
12003
+ }), /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends$1({
12174
12004
  role: "tablist",
12175
12005
  "aria-orientation": context.orientation
12176
12006
  }, listProps, {
@@ -12185,12 +12015,12 @@ const $69cb30bb0017df05$export$8114b9fdfdf9f3ba = /* @__PURE__ */ forwardRef((pr
12185
12015
  const triggerId = $69cb30bb0017df05$var$makeTriggerId(context.baseId, value);
12186
12016
  const contentId = $69cb30bb0017df05$var$makeContentId(context.baseId, value);
12187
12017
  const isSelected = value === context.value;
12188
- return /* @__PURE__ */ createElement($d7bdfb9eb0fdf311$export$6d08773d2e66f8f2, _extends({
12018
+ return /* @__PURE__ */ createElement($d7bdfb9eb0fdf311$export$6d08773d2e66f8f2, _extends$1({
12189
12019
  asChild: true
12190
12020
  }, rovingFocusGroupScope, {
12191
12021
  focusable: !disabled,
12192
12022
  active: isSelected
12193
- }), /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.button, _extends({
12023
+ }), /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.button, _extends$1({
12194
12024
  type: "button",
12195
12025
  role: "tab",
12196
12026
  "aria-selected": isSelected,
@@ -12240,7 +12070,7 @@ const $69cb30bb0017df05$export$bd905d70e8fd2ebb = /* @__PURE__ */ forwardRef((pr
12240
12070
  {
12241
12071
  present: forceMount || isSelected
12242
12072
  },
12243
- ({ present }) => /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
12073
+ ({ present }) => /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends$1({
12244
12074
  "data-state": isSelected ? "active" : "inactive",
12245
12075
  "data-orientation": context.orientation,
12246
12076
  role: "tabpanel",
@@ -12300,6 +12130,260 @@ const Tabs = Object.assign({}, {
12300
12130
  Trigger: TabsTrigger,
12301
12131
  Content: TabsContent
12302
12132
  });
12133
+ const truthyValues = [true, "true"];
12134
+ const BooleanInput = memo((props) => {
12135
+ const [{ inputId, labelId, size, severity, showInputOnly, field, fieldProps }, rest] = useFormikInput(props);
12136
+ let [{ helpText, label }] = useFormikInput(props);
12137
+ helpText = showInputOnly ? null : helpText;
12138
+ label = showInputOnly ? "" : label;
12139
+ const color = useSeverityColor(severity);
12140
+ const value = truthyValues.includes(fieldProps.value);
12141
+ return /* @__PURE__ */ jsx(InputWithLabelAndHelpText, { helpText, severity, children: /* @__PURE__ */ jsx(
12142
+ InputWithLabel,
12143
+ {
12144
+ size,
12145
+ severity,
12146
+ inputId,
12147
+ labelId,
12148
+ label,
12149
+ image: showInputOnly ? void 0 : field.image,
12150
+ flexProps: { direction: "row-reverse", justify: "end", align: "center", gap: "2" },
12151
+ children: /* @__PURE__ */ jsx(
12152
+ Checkbox,
12153
+ {
12154
+ ...rest,
12155
+ ...fieldProps,
12156
+ id: inputId,
12157
+ color,
12158
+ value: value.toString(),
12159
+ checked: value,
12160
+ onCheckedChange: fieldProps.onChange,
12161
+ onChange: void 0,
12162
+ onBlur: void 0
12163
+ }
12164
+ )
12165
+ }
12166
+ ) });
12167
+ });
12168
+ BooleanInput.displayName = "BooleanInput";
12169
+ var DefaultContext = {
12170
+ color: void 0,
12171
+ size: void 0,
12172
+ className: void 0,
12173
+ style: void 0,
12174
+ attr: void 0
12175
+ };
12176
+ var IconContext = React__default.createContext && /* @__PURE__ */ React__default.createContext(DefaultContext);
12177
+ var _excluded = ["attr", "size", "title"];
12178
+ function _objectWithoutProperties(source, excluded) {
12179
+ if (source == null)
12180
+ return {};
12181
+ var target = _objectWithoutPropertiesLoose(source, excluded);
12182
+ var key, i;
12183
+ if (Object.getOwnPropertySymbols) {
12184
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
12185
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
12186
+ key = sourceSymbolKeys[i];
12187
+ if (excluded.indexOf(key) >= 0)
12188
+ continue;
12189
+ if (!Object.prototype.propertyIsEnumerable.call(source, key))
12190
+ continue;
12191
+ target[key] = source[key];
12192
+ }
12193
+ }
12194
+ return target;
12195
+ }
12196
+ function _objectWithoutPropertiesLoose(source, excluded) {
12197
+ if (source == null)
12198
+ return {};
12199
+ var target = {};
12200
+ for (var key in source) {
12201
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
12202
+ if (excluded.indexOf(key) >= 0)
12203
+ continue;
12204
+ target[key] = source[key];
12205
+ }
12206
+ }
12207
+ return target;
12208
+ }
12209
+ function _extends() {
12210
+ _extends = Object.assign ? Object.assign.bind() : function(target) {
12211
+ for (var i = 1; i < arguments.length; i++) {
12212
+ var source = arguments[i];
12213
+ for (var key in source) {
12214
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
12215
+ target[key] = source[key];
12216
+ }
12217
+ }
12218
+ }
12219
+ return target;
12220
+ };
12221
+ return _extends.apply(this, arguments);
12222
+ }
12223
+ function ownKeys(e, r) {
12224
+ var t = Object.keys(e);
12225
+ if (Object.getOwnPropertySymbols) {
12226
+ var o = Object.getOwnPropertySymbols(e);
12227
+ r && (o = o.filter(function(r2) {
12228
+ return Object.getOwnPropertyDescriptor(e, r2).enumerable;
12229
+ })), t.push.apply(t, o);
12230
+ }
12231
+ return t;
12232
+ }
12233
+ function _objectSpread(e) {
12234
+ for (var r = 1; r < arguments.length; r++) {
12235
+ var t = null != arguments[r] ? arguments[r] : {};
12236
+ r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
12237
+ _defineProperty(e, r2, t[r2]);
12238
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
12239
+ Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
12240
+ });
12241
+ }
12242
+ return e;
12243
+ }
12244
+ function _defineProperty(obj, key, value) {
12245
+ key = _toPropertyKey(key);
12246
+ if (key in obj) {
12247
+ Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
12248
+ } else {
12249
+ obj[key] = value;
12250
+ }
12251
+ return obj;
12252
+ }
12253
+ function _toPropertyKey(t) {
12254
+ var i = _toPrimitive(t, "string");
12255
+ return "symbol" == typeof i ? i : i + "";
12256
+ }
12257
+ function _toPrimitive(t, r) {
12258
+ if ("object" != typeof t || !t)
12259
+ return t;
12260
+ var e = t[Symbol.toPrimitive];
12261
+ if (void 0 !== e) {
12262
+ var i = e.call(t, r || "default");
12263
+ if ("object" != typeof i)
12264
+ return i;
12265
+ throw new TypeError("@@toPrimitive must return a primitive value.");
12266
+ }
12267
+ return ("string" === r ? String : Number)(t);
12268
+ }
12269
+ function Tree2Element(tree) {
12270
+ return tree && tree.map((node, i) => /* @__PURE__ */ React__default.createElement(node.tag, _objectSpread({
12271
+ key: i
12272
+ }, node.attr), Tree2Element(node.child)));
12273
+ }
12274
+ function GenIcon(data) {
12275
+ return (props) => /* @__PURE__ */ React__default.createElement(IconBase, _extends({
12276
+ attr: _objectSpread({}, data.attr)
12277
+ }, props), Tree2Element(data.child));
12278
+ }
12279
+ function IconBase(props) {
12280
+ var elem = (conf) => {
12281
+ var {
12282
+ attr,
12283
+ size,
12284
+ title: title2
12285
+ } = props, svgProps = _objectWithoutProperties(props, _excluded);
12286
+ var computedSize = size || conf.size || "1em";
12287
+ var className;
12288
+ if (conf.className)
12289
+ className = conf.className;
12290
+ if (props.className)
12291
+ className = (className ? className + " " : "") + props.className;
12292
+ return /* @__PURE__ */ React__default.createElement("svg", _extends({
12293
+ stroke: "currentColor",
12294
+ fill: "currentColor",
12295
+ strokeWidth: "0"
12296
+ }, conf.attr, attr, svgProps, {
12297
+ className,
12298
+ style: _objectSpread(_objectSpread({
12299
+ color: props.color || conf.color
12300
+ }, conf.style), props.style),
12301
+ height: computedSize,
12302
+ width: computedSize,
12303
+ xmlns: "http://www.w3.org/2000/svg"
12304
+ }), title2 && /* @__PURE__ */ React__default.createElement("title", null, title2), props.children);
12305
+ };
12306
+ return IconContext !== void 0 ? /* @__PURE__ */ React__default.createElement(IconContext.Consumer, null, (conf) => elem(conf)) : elem(DefaultContext);
12307
+ }
12308
+ function RiArrowDownLine(props) {
12309
+ 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);
12310
+ }
12311
+ function RiArrowUpLine(props) {
12312
+ 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);
12313
+ }
12314
+ function RiCalendarLine(props) {
12315
+ 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);
12316
+ }
12317
+ function RiQrCodeLine(props) {
12318
+ 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);
12319
+ }
12320
+ function RiFileCopyLine(props) {
12321
+ 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);
12322
+ }
12323
+ function RiAlignJustify(props) {
12324
+ return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M3 4H21V6H3V4ZM3 19H21V21H3V19ZM3 14H21V16H3V14ZM3 9H21V11H3V9Z" }, "child": [] }] })(props);
12325
+ }
12326
+ function RiHashtag(props) {
12327
+ 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);
12328
+ }
12329
+ function RiInputField(props) {
12330
+ 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);
12331
+ }
12332
+ function RiListCheck(props) {
12333
+ 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);
12334
+ }
12335
+ function RiImageLine(props) {
12336
+ 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);
12337
+ }
12338
+ function RiCheckboxCircleLine(props) {
12339
+ 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);
12340
+ }
12341
+ function RiCheckboxLine(props) {
12342
+ 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);
12343
+ }
12344
+ function RiDeleteBin2Line(props) {
12345
+ 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);
12346
+ }
12347
+ function RiMenuFoldLine(props) {
12348
+ 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);
12349
+ }
12350
+ function RiUpload2Line(props) {
12351
+ 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);
12352
+ }
12353
+ const emptyBooleanField = {
12354
+ ...emptyBaseField,
12355
+ type: "boolean"
12356
+ };
12357
+ const _BooleanField = class _BooleanField extends BaseField {
12358
+ constructor(options) {
12359
+ super({ ...options, type: "boolean" });
12360
+ __publicField(this, "onlyValidateAfterTouched", false);
12361
+ }
12362
+ // if a BooleanField is required, `false` is considered blank
12363
+ isBlank(value) {
12364
+ return this.required && !value;
12365
+ }
12366
+ getValueFromChangeEvent(event) {
12367
+ if (typeof event === "boolean")
12368
+ return event;
12369
+ return event.target.checked;
12370
+ }
12371
+ serialize() {
12372
+ return super._serialize();
12373
+ }
12374
+ static deserialize(data) {
12375
+ if (data.type !== "boolean")
12376
+ throw new Error("Type mismatch.");
12377
+ return new _BooleanField(data);
12378
+ }
12379
+ getInput(props) {
12380
+ return /* @__PURE__ */ jsx(BooleanInput, { ...props, field: this });
12381
+ }
12382
+ };
12383
+ __publicField(_BooleanField, "fieldTypeName", "Checkbox");
12384
+ __publicField(_BooleanField, "fieldTypeDescription", "Perfect for both optional and required yes/no questions.");
12385
+ __publicField(_BooleanField, "Icon", RiCheckboxCircleLine);
12386
+ let BooleanField = _BooleanField;
12303
12387
  const NumberInput = memo((props) => {
12304
12388
  const [{ inputId, labelId, size, severity, showInputOnly, field, fieldProps }, rest] = useFormikInput(props);
12305
12389
  let [{ helpText, label }] = useFormikInput(props);
@@ -13405,7 +13489,7 @@ const QrInput = memo((props) => {
13405
13489
  ] }),
13406
13490
  value && /* @__PURE__ */ jsx(Text, { color: "jade", size: "1", children: /* @__PURE__ */ jsx(RiIcon, { icon: "RiCheckLine", style: { verticalAlign: "bottom" } }) })
13407
13491
  ] }),
13408
- value && /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(Flex, { width: "max-content", gap: "2", align: "center", children: [
13492
+ !!value && /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(Flex, { width: "max-content", gap: "2", align: "center", children: [
13409
13493
  /* @__PURE__ */ jsx(Code, { color: "gray", highContrast: true, children: value }),
13410
13494
  /* @__PURE__ */ jsx(
13411
13495
  IconButton,
@@ -13445,9 +13529,7 @@ const QrScanner = memo((props) => {
13445
13529
  }
13446
13530
  );
13447
13531
  setIsScannerLoading(true);
13448
- qrScanner.start().then(() => {
13449
- setIsScannerLoading(false);
13450
- }).catch(() => {
13532
+ void qrScanner.start().finally(() => {
13451
13533
  setIsScannerLoading(false);
13452
13534
  });
13453
13535
  }, [onQrScan]);
@@ -15845,7 +15927,7 @@ const FieldBuilder = memo((props) => {
15845
15927
  {
15846
15928
  name: `${parentPath}.${index2}.required`,
15847
15929
  render: ({ setValue, value }) => /* @__PURE__ */ jsx(
15848
- Checkbox,
15930
+ Checkbox$1,
15849
15931
  {
15850
15932
  checked: value,
15851
15933
  onCheckedChange: setValue,
@@ -16609,7 +16691,7 @@ const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
16609
16691
  export {
16610
16692
  APIError,
16611
16693
  AgentService,
16612
- AttachmentService,
16694
+ AttachmentModel,
16613
16695
  AuthService,
16614
16696
  BaseApiService,
16615
16697
  BaseField,
@@ -16620,15 +16702,18 @@ export {
16620
16702
  ColorPicker,
16621
16703
  Colors,
16622
16704
  ColorsToString,
16705
+ ComponentAttachmentService,
16623
16706
  ComponentService,
16624
16707
  ComponentStageColors,
16625
16708
  ComponentStageCompletionService,
16626
16709
  ComponentStageService,
16710
+ ComponentTypeAttachmentService,
16627
16711
  ComponentTypeService,
16628
16712
  DEFAULT_ISSUE_PRIORITY,
16629
16713
  DEFAULT_ISSUE_STATUS,
16630
16714
  DateField,
16631
16715
  DateInput,
16716
+ DocumentAttachmentService,
16632
16717
  DocumentService,
16633
16718
  EmailDomainsService,
16634
16719
  EmailVerificationService,
@@ -16652,6 +16737,7 @@ export {
16652
16737
  InputWithHelpText,
16653
16738
  InputWithLabel,
16654
16739
  InputWithLabelAndHelpText,
16740
+ IssueAttachmentService,
16655
16741
  IssueCommentService,
16656
16742
  IssuePriority,
16657
16743
  IssueService,
@@ -16684,6 +16770,7 @@ export {
16684
16770
  PatchFormProvider,
16685
16771
  ProjectAccessLevel,
16686
16772
  ProjectAccessService,
16773
+ ProjectAttachmentService,
16687
16774
  ProjectFileService,
16688
16775
  ProjectService,
16689
16776
  ProjectType,
@@ -16918,6 +17005,7 @@ export {
16918
17005
  removeFavouriteProjectId,
16919
17006
  removeIssue,
16920
17007
  removeIssueAttachment,
17008
+ removeIssueAttachments,
16921
17009
  removeIssueComment,
16922
17010
  removeIssueComments,
16923
17011
  removeIssueType,
@@ -17095,6 +17183,7 @@ export {
17095
17183
  selectProjectAccessForUser,
17096
17184
  selectProjectAccessUserMapping,
17097
17185
  selectProjectAccesses,
17186
+ selectProjectAttachment,
17098
17187
  selectProjectAttachmentMapping,
17099
17188
  selectProjectFileVisibility,
17100
17189
  selectProjectFiles,
@@ -17144,7 +17233,9 @@ export {
17144
17233
  setAppearance,
17145
17234
  setCategories,
17146
17235
  setCenterMapToProject,
17236
+ setComponentAttachment,
17147
17237
  setComponentAttachments,
17238
+ setComponentTypeAttachment,
17148
17239
  setComponentTypeAttachments,
17149
17240
  setComponentTypes,
17150
17241
  setComponents,
@@ -17152,6 +17243,7 @@ export {
17152
17243
  setConversations,
17153
17244
  setCreateProjectType,
17154
17245
  setCurrentUser,
17246
+ setDocumentAttachment,
17155
17247
  setDocumentAttachments,
17156
17248
  setDocuments,
17157
17249
  setEmailDomains,
@@ -17168,6 +17260,7 @@ export {
17168
17260
  setIsFetchingInitialData,
17169
17261
  setIsImportingProjectFile,
17170
17262
  setIsLoading,
17263
+ setIssueAttachment,
17171
17264
  setIssueAttachments,
17172
17265
  setIssueComment,
17173
17266
  setIssueComments,
@@ -17182,6 +17275,7 @@ export {
17182
17275
  setOrganizations,
17183
17276
  setProfilePicture,
17184
17277
  setProjectAccesses,
17278
+ setProjectAttachment,
17185
17279
  setProjectAttachments,
17186
17280
  setProjectFileVisible,
17187
17281
  setProjects,
@@ -17216,21 +17310,26 @@ export {
17216
17310
  updateActiveOrganization,
17217
17311
  updateComponent,
17218
17312
  updateComponentAttachment,
17313
+ updateComponentAttachments,
17219
17314
  updateComponentTypeAttachment,
17315
+ updateComponentTypeAttachments,
17220
17316
  updateConversation,
17221
17317
  updateDocumentAttachment,
17318
+ updateDocumentAttachments,
17222
17319
  updateDocuments,
17223
17320
  updateFormSubmission,
17224
17321
  updateFormSubmissionAttachments,
17225
17322
  updateFormSubmissions,
17226
17323
  updateIssue,
17227
17324
  updateIssueAttachment,
17325
+ updateIssueAttachments,
17228
17326
  updateIssueType,
17229
17327
  updateLicense,
17230
17328
  updateOrCreateProject,
17231
17329
  updateOrganizationAccess,
17232
17330
  updateProjectAccess,
17233
17331
  updateProjectAttachment,
17332
+ updateProjectAttachments,
17234
17333
  updateStages,
17235
17334
  updateTeam,
17236
17335
  useAppDispatch,