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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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,6 +6644,7 @@ 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
6831
6648
  async _processInitialData(data, overwrite) {
6832
6649
  var _a2, _b, _c;
6833
6650
  const workspaces = {};
@@ -6888,8 +6705,11 @@ class MainService extends BaseApiService {
6888
6705
  currentOrgId = firstOrg.id;
6889
6706
  }
6890
6707
  if (currentOrgId) {
6891
- await this.client.organizations.fetchInitialOrganizationData(currentOrgId, false);
6892
- void this.client.teams.refreshStore();
6708
+ const initialOrgData = await this.client.organizations.fetchInitialOrganizationData(currentOrgId, false);
6709
+ currentOrgId = initialOrgData.organization.id;
6710
+ }
6711
+ if (!currentOrgId) {
6712
+ throw new Error("No organization found");
6893
6713
  }
6894
6714
  if (!isProjectIdValid) {
6895
6715
  if (validProjects.length !== 0) {
@@ -6913,13 +6733,6 @@ class MainService extends BaseApiService {
6913
6733
  store.dispatch(setActiveProjectId(currentProjectId));
6914
6734
  }
6915
6735
  }
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
6736
  let currentWorkspaceId;
6924
6737
  const oldWorkspaceId = this.client.store.getState().workspaceReducer.activeWorkspaceId;
6925
6738
  if (overwrite || !oldWorkspaceId) {
@@ -6927,44 +6740,44 @@ class MainService extends BaseApiService {
6927
6740
  } else {
6928
6741
  currentWorkspaceId = oldWorkspaceId;
6929
6742
  }
6930
- if (currentWorkspaceId && currentProjectId) {
6743
+ if (currentWorkspaceId) {
6931
6744
  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
- });
6745
+ }
6746
+ if (currentProjectId) {
6747
+ void this.client.projectAccesses.refreshStore();
6937
6748
  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);
6749
+ void this.client.projectAttachments.refreshStore();
6750
+ let issuesPromise;
6751
+ void Promise.allSettled([
6752
+ this.client.categories.refreshStore(),
6753
+ this.client.issueTypes.refreshStore()
6754
+ ]).then(() => {
6755
+ issuesPromise = this.client.issues.refreshStore();
6756
+ });
6757
+ void Promise.allSettled([
6758
+ this.client.componentTypes.refreshStore(),
6759
+ this.client.componentStages.refreshStore()
6760
+ ]).then(() => {
6761
+ void this.client.components.refreshStore(overwrite).then(() => {
6762
+ void this.client.componentStageCompletions.refreshStore();
6763
+ void this.client.componentTypeAttachments.refreshStore();
6764
+ void this.client.componentAttachments.refreshStore();
6941
6765
  });
6942
6766
  });
6767
+ void this.client.documents.refreshStore().then(() => {
6768
+ void this.client.documentAttachments.refreshStore();
6769
+ });
6943
6770
  void this.client.userForms.refreshStore().then(() => {
6944
6771
  void this.client.userFormSubmissions.refreshStore();
6945
6772
  });
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
6773
  void this.client.agent.refreshStore();
6774
+ void this.fetchProjectUsers();
6775
+ await issuesPromise;
6776
+ void this.client.issueAttachments.refreshStore();
6777
+ void this.client.issueComments.refreshStore();
6778
+ void this.client.issueUpdates.refreshStore();
6967
6779
  }
6780
+ void this.client.teams.refreshStore();
6968
6781
  store.dispatch(setIsFetchingInitialData(false));
6969
6782
  if (overwrite) {
6970
6783
  console.log("Overwriting data");
@@ -7062,6 +6875,7 @@ class ProjectFileService extends BaseApiService {
7062
6875
  });
7063
6876
  return promise;
7064
6877
  }
6878
+ // TODO: This needs to be seperated into a update and create method
7065
6879
  saveActive() {
7066
6880
  const { store } = this.client;
7067
6881
  const state = store.getState();
@@ -7127,6 +6941,48 @@ class ProjectFileService extends BaseApiService {
7127
6941
  });
7128
6942
  }
7129
6943
  }
6944
+ class ProjectAttachmentService extends BaseAttachmentService {
6945
+ constructor() {
6946
+ super(...arguments);
6947
+ __publicField(this, "attachmentModel", AttachmentModel.Project);
6948
+ }
6949
+ buildOfflineAttachment(data) {
6950
+ return offline({
6951
+ file: URL.createObjectURL(data.file),
6952
+ file_sha1: data.sha1,
6953
+ created_by: data.createdBy,
6954
+ file_name: data.file.name,
6955
+ file_type: data.file.type,
6956
+ submitted_at: data.submittedAt,
6957
+ description: data.description,
6958
+ project: data.modelId
6959
+ });
6960
+ }
6961
+ async attachFilesToProject(files, projectId) {
6962
+ return this.attachFiles(files, projectId, this.buildOfflineAttachment.bind(this), {
6963
+ addAttachments: addProjectAttachments,
6964
+ updateAttachments: updateProjectAttachments,
6965
+ removeAttachments: removeProjectAttachments
6966
+ });
6967
+ }
6968
+ deleteProjectAttachment(attachmentId) {
6969
+ return this.deleteAttachment(
6970
+ attachmentId,
6971
+ {
6972
+ setAttachment: setProjectAttachment,
6973
+ removeAttachment: removeProjectAttachment
6974
+ },
6975
+ {
6976
+ selectAttachment: selectProjectAttachment
6977
+ }
6978
+ );
6979
+ }
6980
+ async refreshStore() {
6981
+ return this.getAttachments({
6982
+ setAttachments: setProjectAttachments
6983
+ });
6984
+ }
6985
+ }
7130
6986
  class ProjectService extends BaseApiService {
7131
6987
  /**
7132
6988
  * Creates a new project. Due to the nature of project creation,
@@ -8518,6 +8374,48 @@ class DocumentService extends BaseApiService {
8518
8374
  store.dispatch(addDocuments(await organizationDocumentsPromise));
8519
8375
  }
8520
8376
  }
8377
+ class DocumentAttachmentService extends BaseAttachmentService {
8378
+ constructor() {
8379
+ super(...arguments);
8380
+ __publicField(this, "attachmentModel", AttachmentModel.Document);
8381
+ }
8382
+ buildOfflineAttachment(data) {
8383
+ return offline({
8384
+ file: URL.createObjectURL(data.file),
8385
+ file_sha1: data.sha1,
8386
+ created_by: data.createdBy,
8387
+ file_name: data.file.name,
8388
+ file_type: data.file.type,
8389
+ submitted_at: data.submittedAt,
8390
+ description: data.description,
8391
+ document: data.modelId
8392
+ });
8393
+ }
8394
+ async attachFilesToDocument(files, documentId) {
8395
+ return this.attachFiles(files, documentId, this.buildOfflineAttachment.bind(this), {
8396
+ addAttachments: addDocumentAttachments,
8397
+ updateAttachments: updateDocumentAttachments,
8398
+ removeAttachments: removeDocumentAttachments
8399
+ });
8400
+ }
8401
+ deleteDocumentAttachment(attachmentId) {
8402
+ return this.deleteAttachment(
8403
+ attachmentId,
8404
+ {
8405
+ setAttachment: setDocumentAttachment,
8406
+ removeAttachment: removeDocumentAttachment
8407
+ },
8408
+ {
8409
+ selectAttachment: selectDocumentAttachment
8410
+ }
8411
+ );
8412
+ }
8413
+ async refreshStore() {
8414
+ return this.getAttachments({
8415
+ setAttachments: setDocumentAttachments
8416
+ });
8417
+ }
8418
+ }
8521
8419
  class AgentService extends BaseApiService {
8522
8420
  async startConversation(prompt) {
8523
8421
  const activeProjectId = this.client.store.getState().projectReducer.activeProjectId;
@@ -8752,7 +8650,6 @@ class OvermapSDK {
8752
8650
  __publicField(this, "store");
8753
8651
  __publicField(this, "agent", new AgentService(this));
8754
8652
  __publicField(this, "files", new FileService(this));
8755
- __publicField(this, "attachments", new AttachmentService(this));
8756
8653
  __publicField(this, "auth", new AuthService(this));
8757
8654
  __publicField(this, "categories", new CategoryService(this));
8758
8655
  __publicField(this, "projectAccesses", new ProjectAccessService(this));
@@ -8762,21 +8659,26 @@ class OvermapSDK {
8762
8659
  __publicField(this, "issueTypes", new IssueTypeService(this));
8763
8660
  __publicField(this, "issueComments", new IssueCommentService(this));
8764
8661
  __publicField(this, "issueUpdates", new IssueUpdateService(this));
8662
+ __publicField(this, "issueAttachments", new IssueAttachmentService(this));
8765
8663
  __publicField(this, "workspaces", new WorkspaceService(this));
8766
8664
  __publicField(this, "main", new MainService(this));
8767
8665
  __publicField(this, "components", new ComponentService(this));
8666
+ __publicField(this, "componentAttachments", new ComponentAttachmentService(this));
8768
8667
  __publicField(this, "componentTypes", new ComponentTypeService(this));
8668
+ __publicField(this, "componentTypeAttachments", new ComponentTypeAttachmentService(this));
8769
8669
  __publicField(this, "componentStages", new ComponentStageService(this));
8770
8670
  __publicField(this, "componentStageCompletions", new ComponentStageCompletionService(this));
8771
8671
  __publicField(this, "userForms", new UserFormService(this));
8772
8672
  __publicField(this, "userFormSubmissions", new UserFormSubmissionService(this));
8773
8673
  __publicField(this, "projects", new ProjectService(this));
8774
8674
  __publicField(this, "projectFiles", new ProjectFileService(this));
8675
+ __publicField(this, "projectAttachments", new ProjectAttachmentService(this));
8775
8676
  __publicField(this, "emailVerification", new EmailVerificationService(this));
8776
8677
  __publicField(this, "emailDomains", new EmailDomainsService(this));
8777
8678
  __publicField(this, "licenses", new LicenseService(this));
8778
8679
  __publicField(this, "documents", new DocumentService(this));
8779
8680
  __publicField(this, "teams", new TeamService(this));
8681
+ __publicField(this, "documentAttachments", new DocumentAttachmentService(this));
8780
8682
  this.API_URL = apiUrl;
8781
8683
  this.store = store;
8782
8684
  }
@@ -8959,405 +8861,151 @@ const FullScreenImagePreview = memo((props) => {
8959
8861
  },
8960
8862
  [name, file]
8961
8863
  );
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"
8864
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
8865
+ /* @__PURE__ */ jsx(
8866
+ "button",
8867
+ {
8868
+ className: styles$c.FullScreenImageContainer,
8869
+ type: "button",
8870
+ onClick: () => {
8871
+ setShowPreview(false);
8872
+ },
8873
+ children: /* @__PURE__ */ jsx(
8874
+ "img",
8875
+ {
8876
+ className: styles$c.FullScreenImage,
8877
+ src: url,
8878
+ alt: name,
8879
+ onClick: (e) => {
8880
+ e.stopPropagation();
8881
+ }
8882
+ }
8883
+ )
8884
+ }
8885
+ ),
8886
+ /* @__PURE__ */ jsxs(Flex$1, { className: styles$c.TopBarContainer, align: "center", children: [
8887
+ /* @__PURE__ */ jsx(
8888
+ IconButton,
8889
+ {
8890
+ className: styles$c.longIconButton,
8891
+ variant: "soft",
8892
+ "aria-label": "Exit preview",
8893
+ onClick: () => {
8894
+ setShowPreview(false);
8895
+ },
8896
+ children: /* @__PURE__ */ jsx(RiIcon, { icon: "RiArrowLeftLine" })
8897
+ }
8898
+ ),
8899
+ /* @__PURE__ */ jsx(Text$1, { className: styles$c.fileName, children: name }),
8900
+ /* @__PURE__ */ jsx(
8901
+ IconButton,
8902
+ {
8903
+ className: styles$c.longIconButton,
8904
+ variant: "soft",
8905
+ "aria-label": `Download ${name}`,
8906
+ onClick: handleDownload,
8907
+ children: /* @__PURE__ */ jsx(RiIcon, { icon: "RiDownload2Line" })
8908
+ }
8909
+ )
8910
+ ] })
8911
+ ] });
8912
+ });
8913
+ FullScreenImagePreview.displayName = "FullScreenImagePreview";
8914
+ const InputWithLabel = (props) => {
8915
+ const { label, children, size, severity, inputId, labelId, image, flexProps } = props;
8916
+ const [resolvedImage, setResolvedImage] = useState(void 0);
8917
+ const [showImagePreview, setShowImagePreview] = useState(false);
8918
+ useEffect(() => {
8919
+ if (image instanceof Promise) {
8920
+ image.then(setResolvedImage).catch(console.error);
8921
+ } else {
8922
+ setResolvedImage(image);
8923
+ }
8924
+ }, [image]);
8925
+ const resolvedImageURL = resolvedImage ? URL.createObjectURL(resolvedImage) : void 0;
8926
+ return /* @__PURE__ */ jsxs(Flex$1, { direction: "column", gap: "2", children: [
8927
+ resolvedImage && /* @__PURE__ */ jsxs(Fragment, { children: [
8928
+ /* @__PURE__ */ jsx(
8929
+ "img",
8930
+ {
8931
+ className: styles$c.previewImage,
8932
+ src: resolvedImageURL,
8933
+ alt: resolvedImage.name,
8934
+ onClick: () => {
8935
+ setShowImagePreview(true);
8936
+ }
8937
+ }
8938
+ ),
8939
+ showImagePreview && /* @__PURE__ */ jsx(
8940
+ FullScreenImagePreview,
8941
+ {
8942
+ file: resolvedImage,
8943
+ url: resolvedImageURL,
8944
+ name: resolvedImage.name,
8945
+ setShowPreview: setShowImagePreview
8946
+ }
8947
+ )
8948
+ ] }),
8949
+ /* @__PURE__ */ jsx(Flex$1, { direction: "column", gap: "1", asChild: true, ...flexProps, children: /* @__PURE__ */ jsxs("label", { htmlFor: inputId, children: [
8950
+ /* @__PURE__ */ jsx(Text$1, { size, severity, id: labelId, children: label }),
8951
+ children
8952
+ ] }) })
8953
+ ] });
9330
8954
  };
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
- }
8955
+ const InputWithHelpText = (props) => {
8956
+ const { helpText, children, severity } = props;
8957
+ return /* @__PURE__ */ jsxs(Flex$1, { direction: "column", gap: "1", children: [
8958
+ children,
8959
+ /* @__PURE__ */ jsx(Flex$1, { direction: "column", children: /* @__PURE__ */ jsx(Text$1, { size: "1", severity, className: styles$c.description, children: helpText }) })
8960
+ ] });
8961
+ };
8962
+ const InputWithLabelAndHelpText = (props) => {
8963
+ const { children, ...restProps } = props;
8964
+ return /* @__PURE__ */ jsx(InputWithHelpText, { ...restProps, children });
8965
+ };
8966
+ const useFormikInput = (props) => {
8967
+ const { id, field, formId: formId2, size, showInputOnly, ...rest } = props;
8968
+ const [fieldProps, meta, helpers] = useField(field.getId());
8969
+ const { touched } = meta;
8970
+ const helpText = meta.error ?? field.description;
8971
+ const severity = meta.error ? "danger" : void 0;
8972
+ const inputId = id ?? `${formId2}-${field.getId()}-input`;
8973
+ const labelId = `${inputId}-label`;
8974
+ const label = field.required ? `${field.label} *` : field.label;
8975
+ const fieldPropsWithValidation = useMemo(() => {
8976
+ const handleChange = (e) => {
8977
+ const value = field.getValueFromChangeEvent(e);
8978
+ void helpers.setValue(value, false).then();
8979
+ if (touched || !field.onlyValidateAfterTouched) {
8980
+ helpers.setError(field.getError(value));
8981
+ }
8982
+ };
8983
+ const handleBlur = (e) => {
8984
+ void helpers.setTouched(true, false).then();
8985
+ helpers.setError(field.getError(field.getValueFromChangeEvent(e)));
8986
+ };
8987
+ return {
8988
+ ...fieldProps,
8989
+ onChange: handleChange,
8990
+ onBlur: handleBlur
8991
+ };
8992
+ }, [field, fieldProps, helpers, touched]);
8993
+ return [
8994
+ {
8995
+ helpText,
8996
+ size,
8997
+ severity,
8998
+ inputId,
8999
+ labelId,
9000
+ label,
9001
+ showInputOnly,
9002
+ fieldProps: fieldPropsWithValidation,
9003
+ helpers,
9004
+ field
9005
+ },
9006
+ { ...rest, "aria-labelledby": labelId }
9007
+ ];
9356
9008
  };
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
9009
  function getDefaultExportFromCjs(x) {
9362
9010
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
9363
9011
  }
@@ -9410,8 +9058,8 @@ var classnames = { exports: {} };
9410
9058
  })(classnames);
9411
9059
  var classnamesExports = classnames.exports;
9412
9060
  const classNames = /* @__PURE__ */ getDefaultExportFromCjs(classnamesExports);
9413
- function _extends() {
9414
- _extends = Object.assign ? Object.assign.bind() : function(target) {
9061
+ function _extends$1() {
9062
+ _extends$1 = Object.assign ? Object.assign.bind() : function(target) {
9415
9063
  for (var i = 1; i < arguments.length; i++) {
9416
9064
  var source = arguments[i];
9417
9065
  for (var key in source) {
@@ -9422,7 +9070,7 @@ function _extends() {
9422
9070
  }
9423
9071
  return target;
9424
9072
  };
9425
- return _extends.apply(this, arguments);
9073
+ return _extends$1.apply(this, arguments);
9426
9074
  }
9427
9075
  function $e42e1063c40fb3ef$export$b9ecd428b558ff10(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
9428
9076
  return function handleEvent(event) {
@@ -9553,11 +9201,11 @@ const $5e63c961fc1ce211$export$8c6ed5c666ac1360 = /* @__PURE__ */ forwardRef((pr
9553
9201
  } else
9554
9202
  return child;
9555
9203
  });
9556
- return /* @__PURE__ */ createElement($5e63c961fc1ce211$var$SlotClone, _extends({}, slotProps, {
9204
+ return /* @__PURE__ */ createElement($5e63c961fc1ce211$var$SlotClone, _extends$1({}, slotProps, {
9557
9205
  ref: forwardedRef
9558
9206
  }), /* @__PURE__ */ isValidElement(newElement) ? /* @__PURE__ */ cloneElement(newElement, void 0, newChildren) : null);
9559
9207
  }
9560
- return /* @__PURE__ */ createElement($5e63c961fc1ce211$var$SlotClone, _extends({}, slotProps, {
9208
+ return /* @__PURE__ */ createElement($5e63c961fc1ce211$var$SlotClone, _extends$1({}, slotProps, {
9561
9209
  ref: forwardedRef
9562
9210
  }), children);
9563
9211
  });
@@ -9635,7 +9283,7 @@ const $8927f6f2acc4f386$export$250ffa63cdc0d034 = $8927f6f2acc4f386$var$NODES.re
9635
9283
  useEffect(() => {
9636
9284
  window[Symbol.for("radix-ui")] = true;
9637
9285
  }, []);
9638
- return /* @__PURE__ */ createElement(Comp, _extends({}, primitiveProps, {
9286
+ return /* @__PURE__ */ createElement(Comp, _extends$1({}, primitiveProps, {
9639
9287
  ref: forwardedRef
9640
9288
  }));
9641
9289
  });
@@ -10194,9 +9842,9 @@ const Inset = React.forwardRef((props, forwardedRef) => {
10194
9842
  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
9843
  });
10196
9844
  Inset.displayName = "Inset";
10197
- const sizes$8 = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
9845
+ const sizes$9 = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
10198
9846
  const headingPropDefs = {
10199
- size: { type: "enum", values: sizes$8, default: "6", responsive: true },
9847
+ size: { type: "enum", values: sizes$9, default: "6", responsive: true },
10200
9848
  weight: { ...weightProp, default: "bold" },
10201
9849
  align: alignProp,
10202
9850
  trim: trimProp,
@@ -10209,9 +9857,9 @@ const Heading = React.forwardRef((props, forwardedRef) => {
10209
9857
  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
9858
  });
10211
9859
  Heading.displayName = "Heading";
10212
- const sizes$7 = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
9860
+ const sizes$8 = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
10213
9861
  const textPropDefs = {
10214
- size: { type: "enum", values: sizes$7, default: void 0, responsive: true },
9862
+ size: { type: "enum", values: sizes$8, default: void 0, responsive: true },
10215
9863
  weight: weightProp,
10216
9864
  align: alignProp,
10217
9865
  trim: trimProp,
@@ -10224,11 +9872,11 @@ const Text = React.forwardRef((props, forwardedRef) => {
10224
9872
  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
9873
  });
10226
9874
  Text.displayName = "Text";
10227
- const sizes$6 = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
10228
- const variants$4 = ["solid", "soft", "outline", "ghost"];
9875
+ const sizes$7 = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
9876
+ const variants$5 = ["solid", "soft", "outline", "ghost"];
10229
9877
  const codePropDefs = {
10230
- size: { type: "enum", values: sizes$6, default: void 0, responsive: true },
10231
- variant: { type: "enum", values: variants$4, default: "soft" },
9878
+ size: { type: "enum", values: sizes$7, default: void 0, responsive: true },
9879
+ variant: { type: "enum", values: variants$5, default: "soft" },
10232
9880
  weight: weightProp,
10233
9881
  color: colorProp,
10234
9882
  highContrast: highContrastProp
@@ -10258,6 +9906,202 @@ function $010c2913dbd2fe3d$export$5cae361ad82dce8b(value) {
10258
9906
  value
10259
9907
  ]);
10260
9908
  }
9909
+ const $e698a72e93240346$var$CHECKBOX_NAME = "Checkbox";
9910
+ const [$e698a72e93240346$var$createCheckboxContext, $e698a72e93240346$export$b566c4ff5488ea01] = $c512c27ab02ef895$export$50c7b4e9d9f19c1($e698a72e93240346$var$CHECKBOX_NAME);
9911
+ const [$e698a72e93240346$var$CheckboxProvider, $e698a72e93240346$var$useCheckboxContext] = $e698a72e93240346$var$createCheckboxContext($e698a72e93240346$var$CHECKBOX_NAME);
9912
+ const $e698a72e93240346$export$48513f6b9f8ce62d = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
9913
+ const { __scopeCheckbox, name, checked: checkedProp, defaultChecked, required, disabled, value = "on", onCheckedChange, ...checkboxProps } = props;
9914
+ const [button, setButton] = useState(null);
9915
+ const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(
9916
+ forwardedRef,
9917
+ (node) => setButton(node)
9918
+ );
9919
+ const hasConsumerStoppedPropagationRef = useRef(false);
9920
+ const isFormControl = button ? Boolean(button.closest("form")) : true;
9921
+ const [checked = false, setChecked] = $71cd76cc60e0454e$export$6f32135080cb4c3({
9922
+ prop: checkedProp,
9923
+ defaultProp: defaultChecked,
9924
+ onChange: onCheckedChange
9925
+ });
9926
+ const initialCheckedStateRef = useRef(checked);
9927
+ useEffect(() => {
9928
+ const form = button === null || button === void 0 ? void 0 : button.form;
9929
+ if (form) {
9930
+ const reset = () => setChecked(initialCheckedStateRef.current);
9931
+ form.addEventListener("reset", reset);
9932
+ return () => form.removeEventListener("reset", reset);
9933
+ }
9934
+ }, [
9935
+ button,
9936
+ setChecked
9937
+ ]);
9938
+ return /* @__PURE__ */ createElement($e698a72e93240346$var$CheckboxProvider, {
9939
+ scope: __scopeCheckbox,
9940
+ state: checked,
9941
+ disabled
9942
+ }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.button, _extends$1({
9943
+ type: "button",
9944
+ role: "checkbox",
9945
+ "aria-checked": $e698a72e93240346$var$isIndeterminate(checked) ? "mixed" : checked,
9946
+ "aria-required": required,
9947
+ "data-state": $e698a72e93240346$var$getState(checked),
9948
+ "data-disabled": disabled ? "" : void 0,
9949
+ disabled,
9950
+ value
9951
+ }, checkboxProps, {
9952
+ ref: composedRefs,
9953
+ onKeyDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onKeyDown, (event) => {
9954
+ if (event.key === "Enter")
9955
+ event.preventDefault();
9956
+ }),
9957
+ onClick: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onClick, (event) => {
9958
+ setChecked(
9959
+ (prevChecked) => $e698a72e93240346$var$isIndeterminate(prevChecked) ? true : !prevChecked
9960
+ );
9961
+ if (isFormControl) {
9962
+ hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
9963
+ if (!hasConsumerStoppedPropagationRef.current)
9964
+ event.stopPropagation();
9965
+ }
9966
+ })
9967
+ })), isFormControl && /* @__PURE__ */ createElement($e698a72e93240346$var$BubbleInput, {
9968
+ control: button,
9969
+ bubbles: !hasConsumerStoppedPropagationRef.current,
9970
+ name,
9971
+ value,
9972
+ checked,
9973
+ required,
9974
+ disabled,
9975
+ style: {
9976
+ transform: "translateX(-100%)"
9977
+ }
9978
+ }));
9979
+ });
9980
+ const $e698a72e93240346$var$INDICATOR_NAME = "CheckboxIndicator";
9981
+ const $e698a72e93240346$export$59aad738f51d1c05 = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
9982
+ const { __scopeCheckbox, forceMount, ...indicatorProps } = props;
9983
+ const context = $e698a72e93240346$var$useCheckboxContext($e698a72e93240346$var$INDICATOR_NAME, __scopeCheckbox);
9984
+ return /* @__PURE__ */ createElement($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
9985
+ present: forceMount || $e698a72e93240346$var$isIndeterminate(context.state) || context.state === true
9986
+ }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends$1({
9987
+ "data-state": $e698a72e93240346$var$getState(context.state),
9988
+ "data-disabled": context.disabled ? "" : void 0
9989
+ }, indicatorProps, {
9990
+ ref: forwardedRef,
9991
+ style: {
9992
+ pointerEvents: "none",
9993
+ ...props.style
9994
+ }
9995
+ })));
9996
+ });
9997
+ const $e698a72e93240346$var$BubbleInput = (props) => {
9998
+ const { control, checked, bubbles = true, ...inputProps } = props;
9999
+ const ref = useRef(null);
10000
+ const prevChecked = $010c2913dbd2fe3d$export$5cae361ad82dce8b(checked);
10001
+ const controlSize = $db6c3485150b8e66$export$1ab7ae714698c4b8(control);
10002
+ useEffect(() => {
10003
+ const input = ref.current;
10004
+ const inputProto = window.HTMLInputElement.prototype;
10005
+ const descriptor = Object.getOwnPropertyDescriptor(inputProto, "checked");
10006
+ const setChecked = descriptor.set;
10007
+ if (prevChecked !== checked && setChecked) {
10008
+ const event = new Event("click", {
10009
+ bubbles
10010
+ });
10011
+ input.indeterminate = $e698a72e93240346$var$isIndeterminate(checked);
10012
+ setChecked.call(input, $e698a72e93240346$var$isIndeterminate(checked) ? false : checked);
10013
+ input.dispatchEvent(event);
10014
+ }
10015
+ }, [
10016
+ prevChecked,
10017
+ checked,
10018
+ bubbles
10019
+ ]);
10020
+ return /* @__PURE__ */ createElement("input", _extends$1({
10021
+ type: "checkbox",
10022
+ "aria-hidden": true,
10023
+ defaultChecked: $e698a72e93240346$var$isIndeterminate(checked) ? false : checked
10024
+ }, inputProps, {
10025
+ tabIndex: -1,
10026
+ ref,
10027
+ style: {
10028
+ ...props.style,
10029
+ ...controlSize,
10030
+ position: "absolute",
10031
+ pointerEvents: "none",
10032
+ opacity: 0,
10033
+ margin: 0
10034
+ }
10035
+ }));
10036
+ };
10037
+ function $e698a72e93240346$var$isIndeterminate(checked) {
10038
+ return checked === "indeterminate";
10039
+ }
10040
+ function $e698a72e93240346$var$getState(checked) {
10041
+ return $e698a72e93240346$var$isIndeterminate(checked) ? "indeterminate" : checked ? "checked" : "unchecked";
10042
+ }
10043
+ const $e698a72e93240346$export$be92b6f5f03c0fe9 = $e698a72e93240346$export$48513f6b9f8ce62d;
10044
+ const $e698a72e93240346$export$adb584737d712b70 = $e698a72e93240346$export$59aad738f51d1c05;
10045
+ const sizes$6 = ["1", "2", "3"];
10046
+ const variants$4 = ["classic", "surface", "soft"];
10047
+ const checkboxPropDefs = {
10048
+ size: { type: "enum", values: sizes$6, default: "2", responsive: true },
10049
+ variant: { type: "enum", values: variants$4, default: "surface" },
10050
+ color: colorProp,
10051
+ highContrast: highContrastProp
10052
+ };
10053
+ const ThickCheckIcon = React.forwardRef(({ color = "currentColor", ...props }, forwardedRef) => {
10054
+ return React.createElement(
10055
+ "svg",
10056
+ { width: "9", height: "9", viewBox: "0 0 9 9", fill: color, xmlns: "http://www.w3.org/2000/svg", ...props, ref: forwardedRef },
10057
+ 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" })
10058
+ );
10059
+ });
10060
+ ThickCheckIcon.displayName = "ThickCheckIcon";
10061
+ const ChevronDownIcon = React.forwardRef(({ color = "currentColor", ...props }, forwardedRef) => {
10062
+ return React.createElement(
10063
+ "svg",
10064
+ { width: "9", height: "9", viewBox: "0 0 9 9", fill: color, xmlns: "http://www.w3.org/2000/svg", ...props, ref: forwardedRef },
10065
+ 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" })
10066
+ );
10067
+ });
10068
+ ChevronDownIcon.displayName = "ChevronDownIcon";
10069
+ const ThickChevronRightIcon = React.forwardRef(({ color = "currentColor", ...props }, forwardedRef) => {
10070
+ return React.createElement(
10071
+ "svg",
10072
+ { width: "9", height: "9", viewBox: "0 0 9 9", fill: color, xmlns: "http://www.w3.org/2000/svg", ...props, ref: forwardedRef },
10073
+ 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" })
10074
+ );
10075
+ });
10076
+ ThickChevronRightIcon.displayName = "ThickChevronRightIcon";
10077
+ const InfoCircledIcon = React.forwardRef(({ color = "currentColor", ...props }, forwardedRef) => {
10078
+ return React.createElement(
10079
+ "svg",
10080
+ { width: "15", height: "15", viewBox: "0 0 15 15", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, ref: forwardedRef },
10081
+ 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" })
10082
+ );
10083
+ });
10084
+ InfoCircledIcon.displayName = "InfoCircledIcon";
10085
+ const Checkbox = React.forwardRef((props, forwardedRef) => {
10086
+ const { rest: marginRest, ...marginProps } = extractMarginProps(props);
10087
+ const { className, style, size = checkboxPropDefs.size.default, variant = checkboxPropDefs.variant.default, color = checkboxPropDefs.color.default, highContrast = checkboxPropDefs.highContrast.default, ...checkboxProps } = marginRest;
10088
+ return React.createElement(
10089
+ "span",
10090
+ { className: classNames("rt-CheckboxRoot", className, withBreakpoints(size, "rt-r-size"), withMarginProps(marginProps)), style },
10091
+ React.createElement(
10092
+ $e698a72e93240346$export$be92b6f5f03c0fe9,
10093
+ { "data-accent-color": color, ...checkboxProps, ref: forwardedRef, className: classNames("rt-reset", "rt-CheckboxButton", `rt-variant-${variant}`, {
10094
+ "rt-high-contrast": highContrast
10095
+ }) },
10096
+ React.createElement(
10097
+ $e698a72e93240346$export$adb584737d712b70,
10098
+ { className: "rt-CheckboxIndicator" },
10099
+ React.createElement(ThickCheckIcon, { className: "rt-CheckboxIndicatorIcon" })
10100
+ )
10101
+ )
10102
+ );
10103
+ });
10104
+ Checkbox.displayName = "Checkbox";
10261
10105
  function $e02a7d9cb1dc128c$export$c74125a8e3af6bb2(name) {
10262
10106
  const PROVIDER_NAME = name + "CollectionProvider";
10263
10107
  const [createCollectionContext, createCollectionScope] = $c512c27ab02ef895$export$50c7b4e9d9f19c1(PROVIDER_NAME);
@@ -10349,7 +10193,7 @@ const $d7bdfb9eb0fdf311$export$8699f7c8af148338 = /* @__PURE__ */ forwardRef((pr
10349
10193
  scope: props.__scopeRovingFocusGroup
10350
10194
  }, /* @__PURE__ */ createElement($d7bdfb9eb0fdf311$var$Collection.Slot, {
10351
10195
  scope: props.__scopeRovingFocusGroup
10352
- }, /* @__PURE__ */ createElement($d7bdfb9eb0fdf311$var$RovingFocusGroupImpl, _extends({}, props, {
10196
+ }, /* @__PURE__ */ createElement($d7bdfb9eb0fdf311$var$RovingFocusGroupImpl, _extends$1({}, props, {
10353
10197
  ref: forwardedRef
10354
10198
  }))));
10355
10199
  });
@@ -10405,7 +10249,7 @@ const $d7bdfb9eb0fdf311$var$RovingFocusGroupImpl = /* @__PURE__ */ forwardRef((p
10405
10249
  ),
10406
10250
  []
10407
10251
  )
10408
- }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
10252
+ }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends$1({
10409
10253
  tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,
10410
10254
  "data-orientation": orientation
10411
10255
  }, groupProps, {
@@ -10475,7 +10319,7 @@ const $d7bdfb9eb0fdf311$export$ab9df7c53fe8454 = /* @__PURE__ */ forwardRef((pro
10475
10319
  id,
10476
10320
  focusable,
10477
10321
  active
10478
- }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends({
10322
+ }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends$1({
10479
10323
  tabIndex: isCurrentTabStop ? 0 : -1,
10480
10324
  "data-orientation": context.orientation
10481
10325
  }, itemProps, {
@@ -10615,7 +10459,7 @@ const $57acba87d6e25586$export$ccf8d8d7bbf3c2cc = /* @__PURE__ */ forwardRef((pr
10615
10459
  onScrollbarYEnabledChange: setScrollbarYEnabled,
10616
10460
  onCornerWidthChange: setCornerWidth,
10617
10461
  onCornerHeightChange: setCornerHeight
10618
- }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
10462
+ }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends$1({
10619
10463
  dir: direction
10620
10464
  }, scrollAreaProps, {
10621
10465
  ref: composedRefs,
@@ -10638,7 +10482,7 @@ const $57acba87d6e25586$export$a21cbf9f11fca853 = /* @__PURE__ */ forwardRef((pr
10638
10482
  dangerouslySetInnerHTML: {
10639
10483
  __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
10484
  }
10641
- }), /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
10485
+ }), /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends$1({
10642
10486
  "data-radix-scroll-area-viewport": ""
10643
10487
  }, viewportProps, {
10644
10488
  ref: composedRefs,
@@ -10682,16 +10526,16 @@ const $57acba87d6e25586$export$2fabd85d0eba3c57 = /* @__PURE__ */ forwardRef((pr
10682
10526
  onScrollbarXEnabledChange,
10683
10527
  onScrollbarYEnabledChange
10684
10528
  ]);
10685
- return context.type === "hover" ? /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarHover, _extends({}, scrollbarProps, {
10529
+ return context.type === "hover" ? /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarHover, _extends$1({}, scrollbarProps, {
10686
10530
  ref: forwardedRef,
10687
10531
  forceMount
10688
- })) : context.type === "scroll" ? /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarScroll, _extends({}, scrollbarProps, {
10532
+ })) : context.type === "scroll" ? /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarScroll, _extends$1({}, scrollbarProps, {
10689
10533
  ref: forwardedRef,
10690
10534
  forceMount
10691
- })) : context.type === "auto" ? /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarAuto, _extends({}, scrollbarProps, {
10535
+ })) : context.type === "auto" ? /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarAuto, _extends$1({}, scrollbarProps, {
10692
10536
  ref: forwardedRef,
10693
10537
  forceMount
10694
- })) : context.type === "always" ? /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarVisible, _extends({}, scrollbarProps, {
10538
+ })) : context.type === "always" ? /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarVisible, _extends$1({}, scrollbarProps, {
10695
10539
  ref: forwardedRef
10696
10540
  })) : null;
10697
10541
  });
@@ -10727,7 +10571,7 @@ const $57acba87d6e25586$var$ScrollAreaScrollbarHover = /* @__PURE__ */ forwardRe
10727
10571
  ]);
10728
10572
  return /* @__PURE__ */ createElement($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
10729
10573
  present: forceMount || visible
10730
- }, /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarAuto, _extends({
10574
+ }, /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarAuto, _extends$1({
10731
10575
  "data-state": visible ? "visible" : "hidden"
10732
10576
  }, scrollbarProps, {
10733
10577
  ref: forwardedRef
@@ -10797,7 +10641,7 @@ const $57acba87d6e25586$var$ScrollAreaScrollbarScroll = /* @__PURE__ */ forwardR
10797
10641
  ]);
10798
10642
  return /* @__PURE__ */ createElement($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
10799
10643
  present: forceMount || state !== "hidden"
10800
- }, /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarVisible, _extends({
10644
+ }, /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarVisible, _extends$1({
10801
10645
  "data-state": state === "hidden" ? "hidden" : "visible"
10802
10646
  }, scrollbarProps, {
10803
10647
  ref: forwardedRef,
@@ -10827,7 +10671,7 @@ const $57acba87d6e25586$var$ScrollAreaScrollbarAuto = /* @__PURE__ */ forwardRef
10827
10671
  $57acba87d6e25586$var$useResizeObserver(context.content, handleResize);
10828
10672
  return /* @__PURE__ */ createElement($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
10829
10673
  present: forceMount || visible
10830
- }, /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarVisible, _extends({
10674
+ }, /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarVisible, _extends$1({
10831
10675
  "data-state": visible ? "visible" : "hidden"
10832
10676
  }, scrollbarProps, {
10833
10677
  ref: forwardedRef
@@ -10861,7 +10705,7 @@ const $57acba87d6e25586$var$ScrollAreaScrollbarVisible = /* @__PURE__ */ forward
10861
10705
  return $57acba87d6e25586$var$getScrollPositionFromPointer(pointerPos, pointerOffsetRef.current, sizes2, dir);
10862
10706
  }
10863
10707
  if (orientation === "horizontal")
10864
- return /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarX, _extends({}, commonProps, {
10708
+ return /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarX, _extends$1({}, commonProps, {
10865
10709
  ref: forwardedRef,
10866
10710
  onThumbPositionChange: () => {
10867
10711
  if (context.viewport && thumbRef.current) {
@@ -10880,7 +10724,7 @@ const $57acba87d6e25586$var$ScrollAreaScrollbarVisible = /* @__PURE__ */ forward
10880
10724
  }
10881
10725
  }));
10882
10726
  if (orientation === "vertical")
10883
- return /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarY, _extends({}, commonProps, {
10727
+ return /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarY, _extends$1({}, commonProps, {
10884
10728
  ref: forwardedRef,
10885
10729
  onThumbPositionChange: () => {
10886
10730
  if (context.viewport && thumbRef.current) {
@@ -10912,7 +10756,7 @@ const $57acba87d6e25586$var$ScrollAreaScrollbarX = /* @__PURE__ */ forwardRef((p
10912
10756
  }, [
10913
10757
  ref
10914
10758
  ]);
10915
- return /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarImpl, _extends({
10759
+ return /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarImpl, _extends$1({
10916
10760
  "data-orientation": "horizontal"
10917
10761
  }, scrollbarProps, {
10918
10762
  ref: composeRefs,
@@ -10960,7 +10804,7 @@ const $57acba87d6e25586$var$ScrollAreaScrollbarY = /* @__PURE__ */ forwardRef((p
10960
10804
  }, [
10961
10805
  ref
10962
10806
  ]);
10963
- return /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarImpl, _extends({
10807
+ return /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaScrollbarImpl, _extends$1({
10964
10808
  "data-orientation": "vertical"
10965
10809
  }, scrollbarProps, {
10966
10810
  ref: composeRefs,
@@ -11056,7 +10900,7 @@ const $57acba87d6e25586$var$ScrollAreaScrollbarImpl = /* @__PURE__ */ forwardRef
11056
10900
  onThumbPointerUp: $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onThumbPointerUp),
11057
10901
  onThumbPositionChange: handleThumbPositionChange,
11058
10902
  onThumbPointerDown: $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onThumbPointerDown)
11059
- }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, scrollbarProps, {
10903
+ }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends$1({}, scrollbarProps, {
11060
10904
  ref: composeRefs,
11061
10905
  style: {
11062
10906
  position: "absolute",
@@ -11093,7 +10937,7 @@ const $57acba87d6e25586$export$9fba1154677d7cd2 = /* @__PURE__ */ forwardRef((pr
11093
10937
  const scrollbarContext = $57acba87d6e25586$var$useScrollbarContext($57acba87d6e25586$var$THUMB_NAME, props.__scopeScrollArea);
11094
10938
  return /* @__PURE__ */ createElement($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
11095
10939
  present: forceMount || scrollbarContext.hasThumb
11096
- }, /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaThumbImpl, _extends({
10940
+ }, /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaThumbImpl, _extends$1({
11097
10941
  ref: forwardedRef
11098
10942
  }, thumbProps)));
11099
10943
  });
@@ -11133,7 +10977,7 @@ const $57acba87d6e25586$var$ScrollAreaThumbImpl = /* @__PURE__ */ forwardRef((pr
11133
10977
  debounceScrollEnd,
11134
10978
  onThumbPositionChange
11135
10979
  ]);
11136
- return /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
10980
+ return /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends$1({
11137
10981
  "data-state": scrollbarContext.hasThumb ? "visible" : "hidden"
11138
10982
  }, thumbProps, {
11139
10983
  ref: composedRef,
@@ -11160,7 +11004,7 @@ const $57acba87d6e25586$export$56969d565df7cc4b = /* @__PURE__ */ forwardRef((pr
11160
11004
  const context = $57acba87d6e25586$var$useScrollAreaContext($57acba87d6e25586$var$CORNER_NAME, props.__scopeScrollArea);
11161
11005
  const hasBothScrollbarsVisible = Boolean(context.scrollbarX && context.scrollbarY);
11162
11006
  const hasCorner = context.type !== "scroll" && hasBothScrollbarsVisible;
11163
- return hasCorner ? /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaCornerImpl, _extends({}, props, {
11007
+ return hasCorner ? /* @__PURE__ */ createElement($57acba87d6e25586$var$ScrollAreaCornerImpl, _extends$1({}, props, {
11164
11008
  ref: forwardedRef
11165
11009
  })) : null;
11166
11010
  });
@@ -11182,7 +11026,7 @@ const $57acba87d6e25586$var$ScrollAreaCornerImpl = /* @__PURE__ */ forwardRef((p
11182
11026
  context.onCornerWidthChange(width);
11183
11027
  setWidth(width);
11184
11028
  });
11185
- return hasSize ? /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, cornerProps, {
11029
+ return hasSize ? /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends$1({}, cornerProps, {
11186
11030
  ref: forwardedRef,
11187
11031
  style: {
11188
11032
  width: width1,
@@ -11443,7 +11287,7 @@ const $faa2e61a3361514f$export$472062a354075cee = /* @__PURE__ */ forwardRef((pr
11443
11287
  scope: props.__scopeSlider
11444
11288
  }, /* @__PURE__ */ createElement($faa2e61a3361514f$var$Collection.Slot, {
11445
11289
  scope: props.__scopeSlider
11446
- }, /* @__PURE__ */ createElement(SliderOrientation, _extends({
11290
+ }, /* @__PURE__ */ createElement(SliderOrientation, _extends$1({
11447
11291
  "aria-disabled": disabled,
11448
11292
  "data-disabled": disabled ? "" : void 0
11449
11293
  }, sliderProps, {
@@ -11525,7 +11369,7 @@ const $faa2e61a3361514f$var$SliderHorizontal = /* @__PURE__ */ forwardRef((props
11525
11369
  endEdge: isSlidingFromLeft ? "right" : "left",
11526
11370
  direction: isSlidingFromLeft ? 1 : -1,
11527
11371
  size: "width"
11528
- }, /* @__PURE__ */ createElement($faa2e61a3361514f$var$SliderImpl, _extends({
11372
+ }, /* @__PURE__ */ createElement($faa2e61a3361514f$var$SliderImpl, _extends$1({
11529
11373
  dir: direction,
11530
11374
  "data-orientation": "horizontal"
11531
11375
  }, sliderProps, {
@@ -11585,7 +11429,7 @@ const $faa2e61a3361514f$var$SliderVertical = /* @__PURE__ */ forwardRef((props,
11585
11429
  endEdge: isSlidingFromBottom ? "top" : "bottom",
11586
11430
  size: "height",
11587
11431
  direction: isSlidingFromBottom ? 1 : -1
11588
- }, /* @__PURE__ */ createElement($faa2e61a3361514f$var$SliderImpl, _extends({
11432
+ }, /* @__PURE__ */ createElement($faa2e61a3361514f$var$SliderImpl, _extends$1({
11589
11433
  "data-orientation": "vertical"
11590
11434
  }, sliderProps, {
11591
11435
  ref,
@@ -11618,7 +11462,7 @@ const $faa2e61a3361514f$var$SliderVertical = /* @__PURE__ */ forwardRef((props,
11618
11462
  const $faa2e61a3361514f$var$SliderImpl = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
11619
11463
  const { __scopeSlider, onSlideStart, onSlideMove, onSlideEnd, onHomeKeyDown, onEndKeyDown, onStepKeyDown, ...sliderProps } = props;
11620
11464
  const context = $faa2e61a3361514f$var$useSliderContext($faa2e61a3361514f$var$SLIDER_NAME, __scopeSlider);
11621
- return /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends({}, sliderProps, {
11465
+ return /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends$1({}, sliderProps, {
11622
11466
  ref: forwardedRef,
11623
11467
  onKeyDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onKeyDown, (event) => {
11624
11468
  if (event.key === "Home") {
@@ -11659,7 +11503,7 @@ const $faa2e61a3361514f$var$TRACK_NAME = "SliderTrack";
11659
11503
  const $faa2e61a3361514f$export$105594979f116971 = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
11660
11504
  const { __scopeSlider, ...trackProps } = props;
11661
11505
  const context = $faa2e61a3361514f$var$useSliderContext($faa2e61a3361514f$var$TRACK_NAME, __scopeSlider);
11662
- return /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends({
11506
+ return /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends$1({
11663
11507
  "data-disabled": context.disabled ? "" : void 0,
11664
11508
  "data-orientation": context.orientation
11665
11509
  }, trackProps, {
@@ -11679,7 +11523,7 @@ const $faa2e61a3361514f$export$a5cf38a7a000fe77 = /* @__PURE__ */ forwardRef((pr
11679
11523
  );
11680
11524
  const offsetStart = valuesCount > 1 ? Math.min(...percentages) : 0;
11681
11525
  const offsetEnd = 100 - Math.max(...percentages);
11682
- return /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends({
11526
+ return /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends$1({
11683
11527
  "data-orientation": context.orientation,
11684
11528
  "data-disabled": context.disabled ? "" : void 0
11685
11529
  }, rangeProps, {
@@ -11708,7 +11552,7 @@ const $faa2e61a3361514f$export$2c1b491743890dec = /* @__PURE__ */ forwardRef((pr
11708
11552
  thumb
11709
11553
  ]
11710
11554
  );
11711
- return /* @__PURE__ */ createElement($faa2e61a3361514f$var$SliderThumbImpl, _extends({}, props, {
11555
+ return /* @__PURE__ */ createElement($faa2e61a3361514f$var$SliderThumbImpl, _extends$1({}, props, {
11712
11556
  ref: composedRefs,
11713
11557
  index: index2
11714
11558
  }));
@@ -11747,7 +11591,7 @@ const $faa2e61a3361514f$var$SliderThumbImpl = /* @__PURE__ */ forwardRef((props,
11747
11591
  }
11748
11592
  }, /* @__PURE__ */ createElement($faa2e61a3361514f$var$Collection.ItemSlot, {
11749
11593
  scope: props.__scopeSlider
11750
- }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends({
11594
+ }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends$1({
11751
11595
  role: "slider",
11752
11596
  "aria-label": props["aria-label"] || label,
11753
11597
  "aria-valuemin": context.min,
@@ -11787,7 +11631,7 @@ const $faa2e61a3361514f$var$BubbleInput = (props) => {
11787
11631
  prevValue,
11788
11632
  value
11789
11633
  ]);
11790
- return /* @__PURE__ */ createElement("input", _extends({
11634
+ return /* @__PURE__ */ createElement("input", _extends$1({
11791
11635
  style: {
11792
11636
  display: "none"
11793
11637
  }
@@ -12006,7 +11850,7 @@ const $cddcb0b647441e34$export$e2255cf6045e8d47 = /* @__PURE__ */ forwardRef((pr
12006
11850
  scope: __scopeAvatar,
12007
11851
  imageLoadingStatus,
12008
11852
  onImageLoadingStatusChange: setImageLoadingStatus
12009
- }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends({}, avatarProps, {
11853
+ }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends$1({}, avatarProps, {
12010
11854
  ref: forwardedRef
12011
11855
  })));
12012
11856
  });
@@ -12027,7 +11871,7 @@ const $cddcb0b647441e34$export$2cd8ae1985206fe8 = /* @__PURE__ */ forwardRef((pr
12027
11871
  imageLoadingStatus,
12028
11872
  handleLoadingStatusChange
12029
11873
  ]);
12030
- return imageLoadingStatus === "loaded" ? /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.img, _extends({}, imageProps, {
11874
+ return imageLoadingStatus === "loaded" ? /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.img, _extends$1({}, imageProps, {
12031
11875
  ref: forwardedRef,
12032
11876
  src
12033
11877
  })) : null;
@@ -12048,7 +11892,7 @@ const $cddcb0b647441e34$export$69fffb6a9571fbfe = /* @__PURE__ */ forwardRef((pr
12048
11892
  }, [
12049
11893
  delayMs
12050
11894
  ]);
12051
- return canRender && context.imageLoadingStatus !== "loaded" ? /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends({}, fallbackProps, {
11895
+ return canRender && context.imageLoadingStatus !== "loaded" ? /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends$1({}, fallbackProps, {
12052
11896
  ref: forwardedRef
12053
11897
  })) : null;
12054
11898
  });
@@ -12152,7 +11996,7 @@ const $69cb30bb0017df05$export$b2539bed5023c21c = /* @__PURE__ */ forwardRef((pr
12152
11996
  orientation,
12153
11997
  dir: direction,
12154
11998
  activationMode
12155
- }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
11999
+ }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends$1({
12156
12000
  dir: direction,
12157
12001
  "data-orientation": orientation
12158
12002
  }, tabsProps, {
@@ -12164,13 +12008,13 @@ const $69cb30bb0017df05$export$9712d22edc0d78c1 = /* @__PURE__ */ forwardRef((pr
12164
12008
  const { __scopeTabs, loop = true, ...listProps } = props;
12165
12009
  const context = $69cb30bb0017df05$var$useTabsContext($69cb30bb0017df05$var$TAB_LIST_NAME, __scopeTabs);
12166
12010
  const rovingFocusGroupScope = $69cb30bb0017df05$var$useRovingFocusGroupScope(__scopeTabs);
12167
- return /* @__PURE__ */ createElement($d7bdfb9eb0fdf311$export$be92b6f5f03c0fe9, _extends({
12011
+ return /* @__PURE__ */ createElement($d7bdfb9eb0fdf311$export$be92b6f5f03c0fe9, _extends$1({
12168
12012
  asChild: true
12169
12013
  }, rovingFocusGroupScope, {
12170
12014
  orientation: context.orientation,
12171
12015
  dir: context.dir,
12172
12016
  loop
12173
- }), /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
12017
+ }), /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends$1({
12174
12018
  role: "tablist",
12175
12019
  "aria-orientation": context.orientation
12176
12020
  }, listProps, {
@@ -12185,12 +12029,12 @@ const $69cb30bb0017df05$export$8114b9fdfdf9f3ba = /* @__PURE__ */ forwardRef((pr
12185
12029
  const triggerId = $69cb30bb0017df05$var$makeTriggerId(context.baseId, value);
12186
12030
  const contentId = $69cb30bb0017df05$var$makeContentId(context.baseId, value);
12187
12031
  const isSelected = value === context.value;
12188
- return /* @__PURE__ */ createElement($d7bdfb9eb0fdf311$export$6d08773d2e66f8f2, _extends({
12032
+ return /* @__PURE__ */ createElement($d7bdfb9eb0fdf311$export$6d08773d2e66f8f2, _extends$1({
12189
12033
  asChild: true
12190
12034
  }, rovingFocusGroupScope, {
12191
12035
  focusable: !disabled,
12192
12036
  active: isSelected
12193
- }), /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.button, _extends({
12037
+ }), /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.button, _extends$1({
12194
12038
  type: "button",
12195
12039
  role: "tab",
12196
12040
  "aria-selected": isSelected,
@@ -12240,7 +12084,7 @@ const $69cb30bb0017df05$export$bd905d70e8fd2ebb = /* @__PURE__ */ forwardRef((pr
12240
12084
  {
12241
12085
  present: forceMount || isSelected
12242
12086
  },
12243
- ({ present }) => /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
12087
+ ({ present }) => /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends$1({
12244
12088
  "data-state": isSelected ? "active" : "inactive",
12245
12089
  "data-orientation": context.orientation,
12246
12090
  role: "tabpanel",
@@ -12300,6 +12144,260 @@ const Tabs = Object.assign({}, {
12300
12144
  Trigger: TabsTrigger,
12301
12145
  Content: TabsContent
12302
12146
  });
12147
+ const truthyValues = [true, "true"];
12148
+ const BooleanInput = memo((props) => {
12149
+ const [{ inputId, labelId, size, severity, showInputOnly, field, fieldProps }, rest] = useFormikInput(props);
12150
+ let [{ helpText, label }] = useFormikInput(props);
12151
+ helpText = showInputOnly ? null : helpText;
12152
+ label = showInputOnly ? "" : label;
12153
+ const color = useSeverityColor(severity);
12154
+ const value = truthyValues.includes(fieldProps.value);
12155
+ return /* @__PURE__ */ jsx(InputWithLabelAndHelpText, { helpText, severity, children: /* @__PURE__ */ jsx(
12156
+ InputWithLabel,
12157
+ {
12158
+ size,
12159
+ severity,
12160
+ inputId,
12161
+ labelId,
12162
+ label,
12163
+ image: showInputOnly ? void 0 : field.image,
12164
+ flexProps: { direction: "row-reverse", justify: "end", align: "center", gap: "2" },
12165
+ children: /* @__PURE__ */ jsx(
12166
+ Checkbox,
12167
+ {
12168
+ ...rest,
12169
+ ...fieldProps,
12170
+ id: inputId,
12171
+ color,
12172
+ value: value.toString(),
12173
+ checked: value,
12174
+ onCheckedChange: fieldProps.onChange,
12175
+ onChange: void 0,
12176
+ onBlur: void 0
12177
+ }
12178
+ )
12179
+ }
12180
+ ) });
12181
+ });
12182
+ BooleanInput.displayName = "BooleanInput";
12183
+ var DefaultContext = {
12184
+ color: void 0,
12185
+ size: void 0,
12186
+ className: void 0,
12187
+ style: void 0,
12188
+ attr: void 0
12189
+ };
12190
+ var IconContext = React__default.createContext && /* @__PURE__ */ React__default.createContext(DefaultContext);
12191
+ var _excluded = ["attr", "size", "title"];
12192
+ function _objectWithoutProperties(source, excluded) {
12193
+ if (source == null)
12194
+ return {};
12195
+ var target = _objectWithoutPropertiesLoose(source, excluded);
12196
+ var key, i;
12197
+ if (Object.getOwnPropertySymbols) {
12198
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
12199
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
12200
+ key = sourceSymbolKeys[i];
12201
+ if (excluded.indexOf(key) >= 0)
12202
+ continue;
12203
+ if (!Object.prototype.propertyIsEnumerable.call(source, key))
12204
+ continue;
12205
+ target[key] = source[key];
12206
+ }
12207
+ }
12208
+ return target;
12209
+ }
12210
+ function _objectWithoutPropertiesLoose(source, excluded) {
12211
+ if (source == null)
12212
+ return {};
12213
+ var target = {};
12214
+ for (var key in source) {
12215
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
12216
+ if (excluded.indexOf(key) >= 0)
12217
+ continue;
12218
+ target[key] = source[key];
12219
+ }
12220
+ }
12221
+ return target;
12222
+ }
12223
+ function _extends() {
12224
+ _extends = Object.assign ? Object.assign.bind() : function(target) {
12225
+ for (var i = 1; i < arguments.length; i++) {
12226
+ var source = arguments[i];
12227
+ for (var key in source) {
12228
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
12229
+ target[key] = source[key];
12230
+ }
12231
+ }
12232
+ }
12233
+ return target;
12234
+ };
12235
+ return _extends.apply(this, arguments);
12236
+ }
12237
+ function ownKeys(e, r) {
12238
+ var t = Object.keys(e);
12239
+ if (Object.getOwnPropertySymbols) {
12240
+ var o = Object.getOwnPropertySymbols(e);
12241
+ r && (o = o.filter(function(r2) {
12242
+ return Object.getOwnPropertyDescriptor(e, r2).enumerable;
12243
+ })), t.push.apply(t, o);
12244
+ }
12245
+ return t;
12246
+ }
12247
+ function _objectSpread(e) {
12248
+ for (var r = 1; r < arguments.length; r++) {
12249
+ var t = null != arguments[r] ? arguments[r] : {};
12250
+ r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
12251
+ _defineProperty(e, r2, t[r2]);
12252
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
12253
+ Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
12254
+ });
12255
+ }
12256
+ return e;
12257
+ }
12258
+ function _defineProperty(obj, key, value) {
12259
+ key = _toPropertyKey(key);
12260
+ if (key in obj) {
12261
+ Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
12262
+ } else {
12263
+ obj[key] = value;
12264
+ }
12265
+ return obj;
12266
+ }
12267
+ function _toPropertyKey(t) {
12268
+ var i = _toPrimitive(t, "string");
12269
+ return "symbol" == typeof i ? i : i + "";
12270
+ }
12271
+ function _toPrimitive(t, r) {
12272
+ if ("object" != typeof t || !t)
12273
+ return t;
12274
+ var e = t[Symbol.toPrimitive];
12275
+ if (void 0 !== e) {
12276
+ var i = e.call(t, r || "default");
12277
+ if ("object" != typeof i)
12278
+ return i;
12279
+ throw new TypeError("@@toPrimitive must return a primitive value.");
12280
+ }
12281
+ return ("string" === r ? String : Number)(t);
12282
+ }
12283
+ function Tree2Element(tree) {
12284
+ return tree && tree.map((node, i) => /* @__PURE__ */ React__default.createElement(node.tag, _objectSpread({
12285
+ key: i
12286
+ }, node.attr), Tree2Element(node.child)));
12287
+ }
12288
+ function GenIcon(data) {
12289
+ return (props) => /* @__PURE__ */ React__default.createElement(IconBase, _extends({
12290
+ attr: _objectSpread({}, data.attr)
12291
+ }, props), Tree2Element(data.child));
12292
+ }
12293
+ function IconBase(props) {
12294
+ var elem = (conf) => {
12295
+ var {
12296
+ attr,
12297
+ size,
12298
+ title: title2
12299
+ } = props, svgProps = _objectWithoutProperties(props, _excluded);
12300
+ var computedSize = size || conf.size || "1em";
12301
+ var className;
12302
+ if (conf.className)
12303
+ className = conf.className;
12304
+ if (props.className)
12305
+ className = (className ? className + " " : "") + props.className;
12306
+ return /* @__PURE__ */ React__default.createElement("svg", _extends({
12307
+ stroke: "currentColor",
12308
+ fill: "currentColor",
12309
+ strokeWidth: "0"
12310
+ }, conf.attr, attr, svgProps, {
12311
+ className,
12312
+ style: _objectSpread(_objectSpread({
12313
+ color: props.color || conf.color
12314
+ }, conf.style), props.style),
12315
+ height: computedSize,
12316
+ width: computedSize,
12317
+ xmlns: "http://www.w3.org/2000/svg"
12318
+ }), title2 && /* @__PURE__ */ React__default.createElement("title", null, title2), props.children);
12319
+ };
12320
+ return IconContext !== void 0 ? /* @__PURE__ */ React__default.createElement(IconContext.Consumer, null, (conf) => elem(conf)) : elem(DefaultContext);
12321
+ }
12322
+ function RiArrowDownLine(props) {
12323
+ 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);
12324
+ }
12325
+ function RiArrowUpLine(props) {
12326
+ 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);
12327
+ }
12328
+ function RiCalendarLine(props) {
12329
+ 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);
12330
+ }
12331
+ function RiQrCodeLine(props) {
12332
+ 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);
12333
+ }
12334
+ function RiFileCopyLine(props) {
12335
+ 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);
12336
+ }
12337
+ function RiAlignJustify(props) {
12338
+ return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M3 4H21V6H3V4ZM3 19H21V21H3V19ZM3 14H21V16H3V14ZM3 9H21V11H3V9Z" }, "child": [] }] })(props);
12339
+ }
12340
+ function RiHashtag(props) {
12341
+ 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);
12342
+ }
12343
+ function RiInputField(props) {
12344
+ 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);
12345
+ }
12346
+ function RiListCheck(props) {
12347
+ 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);
12348
+ }
12349
+ function RiImageLine(props) {
12350
+ 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);
12351
+ }
12352
+ function RiCheckboxCircleLine(props) {
12353
+ 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);
12354
+ }
12355
+ function RiCheckboxLine(props) {
12356
+ 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);
12357
+ }
12358
+ function RiDeleteBin2Line(props) {
12359
+ 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);
12360
+ }
12361
+ function RiMenuFoldLine(props) {
12362
+ 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);
12363
+ }
12364
+ function RiUpload2Line(props) {
12365
+ 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);
12366
+ }
12367
+ const emptyBooleanField = {
12368
+ ...emptyBaseField,
12369
+ type: "boolean"
12370
+ };
12371
+ const _BooleanField = class _BooleanField extends BaseField {
12372
+ constructor(options) {
12373
+ super({ ...options, type: "boolean" });
12374
+ __publicField(this, "onlyValidateAfterTouched", false);
12375
+ }
12376
+ // if a BooleanField is required, `false` is considered blank
12377
+ isBlank(value) {
12378
+ return this.required && !value;
12379
+ }
12380
+ getValueFromChangeEvent(event) {
12381
+ if (typeof event === "boolean")
12382
+ return event;
12383
+ return event.target.checked;
12384
+ }
12385
+ serialize() {
12386
+ return super._serialize();
12387
+ }
12388
+ static deserialize(data) {
12389
+ if (data.type !== "boolean")
12390
+ throw new Error("Type mismatch.");
12391
+ return new _BooleanField(data);
12392
+ }
12393
+ getInput(props) {
12394
+ return /* @__PURE__ */ jsx(BooleanInput, { ...props, field: this });
12395
+ }
12396
+ };
12397
+ __publicField(_BooleanField, "fieldTypeName", "Checkbox");
12398
+ __publicField(_BooleanField, "fieldTypeDescription", "Perfect for both optional and required yes/no questions.");
12399
+ __publicField(_BooleanField, "Icon", RiCheckboxCircleLine);
12400
+ let BooleanField = _BooleanField;
12303
12401
  const NumberInput = memo((props) => {
12304
12402
  const [{ inputId, labelId, size, severity, showInputOnly, field, fieldProps }, rest] = useFormikInput(props);
12305
12403
  let [{ helpText, label }] = useFormikInput(props);
@@ -13405,7 +13503,7 @@ const QrInput = memo((props) => {
13405
13503
  ] }),
13406
13504
  value && /* @__PURE__ */ jsx(Text, { color: "jade", size: "1", children: /* @__PURE__ */ jsx(RiIcon, { icon: "RiCheckLine", style: { verticalAlign: "bottom" } }) })
13407
13505
  ] }),
13408
- value && /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(Flex, { width: "max-content", gap: "2", align: "center", children: [
13506
+ !!value && /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(Flex, { width: "max-content", gap: "2", align: "center", children: [
13409
13507
  /* @__PURE__ */ jsx(Code, { color: "gray", highContrast: true, children: value }),
13410
13508
  /* @__PURE__ */ jsx(
13411
13509
  IconButton,
@@ -13445,9 +13543,7 @@ const QrScanner = memo((props) => {
13445
13543
  }
13446
13544
  );
13447
13545
  setIsScannerLoading(true);
13448
- qrScanner.start().then(() => {
13449
- setIsScannerLoading(false);
13450
- }).catch(() => {
13546
+ void qrScanner.start().finally(() => {
13451
13547
  setIsScannerLoading(false);
13452
13548
  });
13453
13549
  }, [onQrScan]);
@@ -15845,7 +15941,7 @@ const FieldBuilder = memo((props) => {
15845
15941
  {
15846
15942
  name: `${parentPath}.${index2}.required`,
15847
15943
  render: ({ setValue, value }) => /* @__PURE__ */ jsx(
15848
- Checkbox,
15944
+ Checkbox$1,
15849
15945
  {
15850
15946
  checked: value,
15851
15947
  onCheckedChange: setValue,
@@ -16609,7 +16705,7 @@ const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
16609
16705
  export {
16610
16706
  APIError,
16611
16707
  AgentService,
16612
- AttachmentService,
16708
+ AttachmentModel,
16613
16709
  AuthService,
16614
16710
  BaseApiService,
16615
16711
  BaseField,
@@ -16620,15 +16716,18 @@ export {
16620
16716
  ColorPicker,
16621
16717
  Colors,
16622
16718
  ColorsToString,
16719
+ ComponentAttachmentService,
16623
16720
  ComponentService,
16624
16721
  ComponentStageColors,
16625
16722
  ComponentStageCompletionService,
16626
16723
  ComponentStageService,
16724
+ ComponentTypeAttachmentService,
16627
16725
  ComponentTypeService,
16628
16726
  DEFAULT_ISSUE_PRIORITY,
16629
16727
  DEFAULT_ISSUE_STATUS,
16630
16728
  DateField,
16631
16729
  DateInput,
16730
+ DocumentAttachmentService,
16632
16731
  DocumentService,
16633
16732
  EmailDomainsService,
16634
16733
  EmailVerificationService,
@@ -16652,6 +16751,7 @@ export {
16652
16751
  InputWithHelpText,
16653
16752
  InputWithLabel,
16654
16753
  InputWithLabelAndHelpText,
16754
+ IssueAttachmentService,
16655
16755
  IssueCommentService,
16656
16756
  IssuePriority,
16657
16757
  IssueService,
@@ -16684,6 +16784,7 @@ export {
16684
16784
  PatchFormProvider,
16685
16785
  ProjectAccessLevel,
16686
16786
  ProjectAccessService,
16787
+ ProjectAttachmentService,
16687
16788
  ProjectFileService,
16688
16789
  ProjectService,
16689
16790
  ProjectType,
@@ -16918,6 +17019,7 @@ export {
16918
17019
  removeFavouriteProjectId,
16919
17020
  removeIssue,
16920
17021
  removeIssueAttachment,
17022
+ removeIssueAttachments,
16921
17023
  removeIssueComment,
16922
17024
  removeIssueComments,
16923
17025
  removeIssueType,
@@ -17095,6 +17197,7 @@ export {
17095
17197
  selectProjectAccessForUser,
17096
17198
  selectProjectAccessUserMapping,
17097
17199
  selectProjectAccesses,
17200
+ selectProjectAttachment,
17098
17201
  selectProjectAttachmentMapping,
17099
17202
  selectProjectFileVisibility,
17100
17203
  selectProjectFiles,
@@ -17144,7 +17247,9 @@ export {
17144
17247
  setAppearance,
17145
17248
  setCategories,
17146
17249
  setCenterMapToProject,
17250
+ setComponentAttachment,
17147
17251
  setComponentAttachments,
17252
+ setComponentTypeAttachment,
17148
17253
  setComponentTypeAttachments,
17149
17254
  setComponentTypes,
17150
17255
  setComponents,
@@ -17152,6 +17257,7 @@ export {
17152
17257
  setConversations,
17153
17258
  setCreateProjectType,
17154
17259
  setCurrentUser,
17260
+ setDocumentAttachment,
17155
17261
  setDocumentAttachments,
17156
17262
  setDocuments,
17157
17263
  setEmailDomains,
@@ -17168,6 +17274,7 @@ export {
17168
17274
  setIsFetchingInitialData,
17169
17275
  setIsImportingProjectFile,
17170
17276
  setIsLoading,
17277
+ setIssueAttachment,
17171
17278
  setIssueAttachments,
17172
17279
  setIssueComment,
17173
17280
  setIssueComments,
@@ -17182,6 +17289,7 @@ export {
17182
17289
  setOrganizations,
17183
17290
  setProfilePicture,
17184
17291
  setProjectAccesses,
17292
+ setProjectAttachment,
17185
17293
  setProjectAttachments,
17186
17294
  setProjectFileVisible,
17187
17295
  setProjects,
@@ -17216,21 +17324,26 @@ export {
17216
17324
  updateActiveOrganization,
17217
17325
  updateComponent,
17218
17326
  updateComponentAttachment,
17327
+ updateComponentAttachments,
17219
17328
  updateComponentTypeAttachment,
17329
+ updateComponentTypeAttachments,
17220
17330
  updateConversation,
17221
17331
  updateDocumentAttachment,
17332
+ updateDocumentAttachments,
17222
17333
  updateDocuments,
17223
17334
  updateFormSubmission,
17224
17335
  updateFormSubmissionAttachments,
17225
17336
  updateFormSubmissions,
17226
17337
  updateIssue,
17227
17338
  updateIssueAttachment,
17339
+ updateIssueAttachments,
17228
17340
  updateIssueType,
17229
17341
  updateLicense,
17230
17342
  updateOrCreateProject,
17231
17343
  updateOrganizationAccess,
17232
17344
  updateProjectAccess,
17233
17345
  updateProjectAttachment,
17346
+ updateProjectAttachments,
17234
17347
  updateStages,
17235
17348
  updateTeam,
17236
17349
  useAppDispatch,