quantum-component-library 1.4.66 → 1.4.67

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.
@@ -1,48 +1,48 @@
1
1
  import { j as e } from "./react-jsx-runtime-vendor-OVHDjVDe.js";
2
2
  import "./moment-vendor-DMLRxgRE.js";
3
- import { Flex as Le, InputGroup as lt, InputLeftElement as Ft, Icon as vt, Input as ve, FormLabel as Pe, ButtonGroup as Ae, Tooltip as st, Button as ne, Box as re, RangeSlider as Pt, RangeSliderMark as nt, Text as k, RangeSliderTrack as _t, RangeSliderFilledTrack as Et, RangeSliderThumb as ct, Select as dt, NumberInput as ut, NumberInputField as mt, HStack as Z, Tag as $e, FormControl as J, TableContainer as zt, Table as Bt, Thead as Ut, Tr as ht, Th as De, Tbody as Wt, Td as Ue, Image as Qt, useToast as Ct, VStack as ue, RadioGroup as wt, Radio as Xe, Alert as Ze, AlertIcon as Ve, Spinner as It, useDisclosure as qt, Modal as Kt, ModalOverlay as Yt, ModalContent as Ht, ModalHeader as Jt, ModalCloseButton as Xt, ModalBody as Zt, ModalFooter as Vt, Badge as Me, IconButton as en, Tabs as tn, TabList as nn, Tab as pt, TabPanels as sn, TabPanel as gt, Textarea as We, Switch as on } from "@chakra-ui/react";
4
- import { useMemo as T, useState as z, useEffect as ce, useCallback as F, createContext as rn, useContext as an, memo as ke, useRef as ln } from "react";
5
- import { getFragmentData as M } from "./generated.js";
6
- import { G as ot, M as je, a as be, b as St, c as cn, C as rt, d as Lt, e as kt, R as Ge, f as Fe, T as Oe, A as Ce, g as dn, h as Mt, U as Ot, i as Ye, j as At, k as un, l as mn, m as hn, n as pn, o as gn, p as xn } from "./graphql-DAkuEEbq.js";
7
- import { c as He } from "./utils-cn-CgdSr4hO.js";
3
+ import { Flex as Me, InputGroup as ct, InputLeftElement as Pt, Icon as Ct, Input as ye, FormLabel as _e, ButtonGroup as Ne, Tooltip as rt, Button as te, Box as se, RangeSlider as _t, RangeSliderMark as st, Text as M, RangeSliderTrack as Et, RangeSliderFilledTrack as zt, RangeSliderThumb as dt, Select as ut, NumberInput as mt, NumberInputField as ht, HStack as V, Tag as Ge, FormControl as X, TableContainer as Bt, Table as Ut, Thead as Wt, Tr as pt, Th as De, Tbody as Qt, Td as We, IconButton as ot, Image as qt, useToast as wt, VStack as ue, RadioGroup as It, Radio as Ze, Alert as Ve, AlertIcon as et, Spinner as St, useDisclosure as Kt, Modal as Ht, ModalOverlay as Yt, ModalContent as Jt, ModalHeader as Xt, ModalCloseButton as Zt, ModalBody as Vt, ModalFooter as en, Badge as Oe, Tabs as tn, TabList as nn, Tab as gt, TabPanels as sn, TabPanel as xt, Textarea as Qe, Switch as on } from "@chakra-ui/react";
4
+ import { useMemo as N, useState as q, useEffect as ce, useCallback as _, createContext as rn, useContext as an, memo as Ae, useRef as ln } from "react";
5
+ import { getFragmentData as A } from "./generated.js";
6
+ import { G as at, M as je, a as be, b as Lt, c as cn, C as it, d as kt, e as Mt, R as Fe, f as Pe, T as Te, A as ve, g as dn, h as At, U as Ot, i as Ye, j as Tt, k as un, l as mn, m as hn, n as pn, o as gn, p as xn } from "./graphql-DAkuEEbq.js";
7
+ import { c as Je } from "./utils-cn-CgdSr4hO.js";
8
8
  import "./lodash-vendor-CY4G3-79.js";
9
- import { useClient as at, useQuery as we, useMutation as fe } from "urql";
9
+ import { useClient as lt, useQuery as Ce, useMutation as fe } from "urql";
10
10
  import { useUiLabelContext as xe, useAllPartParameters as fn } from "./hooks.js";
11
11
  import { u as jn } from "./ufuzzy-vendor-Dl0ZI6Av.js";
12
12
  import { s as he } from "./react-select-vendor-B0QF8gkj.js";
13
- import { F as bn, a as yn, b as vn, c as Cn } from "./react-icons-vendor-CMsTQrA0.js";
14
- import { reportKindName as Se } from "./services.js";
15
- import { D as wn, H as In, u as Sn, a as Ln } from "./react-dnd-vendor-DYesaYGm.js";
16
- import { g as Tt, a as Nt, b as kn, c as Mn, d as On, e as xt, f as ft } from "./services-human-D5IllQkM.js";
17
- import { ThresholdKind as Je, ReportKind as ae, ActionLaterality as An, SensorLocation as me } from "./generated-graphql.js";
18
- import { availablePlanes as jt, getAnalysisPartIdNoSide as Qe } from "./types.js";
19
- const Tn = ({
20
- setSearch: o,
21
- actions: s,
22
- updateUseCases: a,
13
+ import { F as bn, a as yn, b as vn, c as Cn, d as wn, e as In } from "./react-icons-vendor-DqOJrTLA.js";
14
+ import { reportKindName as ke } from "./services.js";
15
+ import { D as Sn, H as Ln, u as kn, a as Mn } from "./react-dnd-vendor-DYesaYGm.js";
16
+ import { g as Nt, a as Rt, b as An, c as On, d as Tn, e as ft, f as jt } from "./services-human-D5IllQkM.js";
17
+ import { ThresholdKind as Xe, ReportKind as ie, ActionLaterality as Nn, SensorLocation as me } from "./generated-graphql.js";
18
+ import { availablePlanes as bt, getAnalysisPartIdNoSide as qe } from "./types.js";
19
+ const Rn = ({
20
+ setSearch: s,
21
+ actions: n,
22
+ updateUseCases: r,
23
23
  hideUseCaseFilter: p = !1
24
24
  }) => {
25
- const m = T(
26
- () => s?.flatMap((h) => h.useCases).filter((h, c, b) => b.findIndex((n) => n.id === h.id) === c).map((h) => ({
25
+ const m = N(
26
+ () => n?.flatMap((h) => h.useCases).filter((h, c, b) => b.findIndex((t) => t.id === h.id) === c).map((h) => ({
27
27
  label: h.name,
28
28
  value: h.id
29
29
  })) || [],
30
- [s]
30
+ [n]
31
31
  );
32
- return /* @__PURE__ */ e.jsxs(Le, { width: "100%", alignContent: "space-evenly", gap: 4, children: [
33
- /* @__PURE__ */ e.jsxs(lt, { size: "md", flex: 1, children: [
34
- /* @__PURE__ */ e.jsx(Ft, { children: /* @__PURE__ */ e.jsx(vt, { as: bn, color: "gray.300" }) }),
32
+ return /* @__PURE__ */ e.jsxs(Me, { width: "100%", alignContent: "space-evenly", gap: 4, children: [
33
+ /* @__PURE__ */ e.jsxs(ct, { size: "md", flex: 1, children: [
34
+ /* @__PURE__ */ e.jsx(Pt, { children: /* @__PURE__ */ e.jsx(Ct, { as: bn, color: "gray.300" }) }),
35
35
  /* @__PURE__ */ e.jsx(
36
- ve,
36
+ ye,
37
37
  {
38
38
  placeholder: "Search by name...",
39
39
  width: "100%",
40
40
  maxW: p ? void 0 : "30rem",
41
- onChange: (h) => o(h.target.value)
41
+ onChange: (h) => s(h.target.value)
42
42
  }
43
43
  )
44
44
  ] }),
45
- !p && /* @__PURE__ */ e.jsx(lt, { size: "md", children: /* @__PURE__ */ e.jsx(
45
+ !p && /* @__PURE__ */ e.jsx(ct, { size: "md", children: /* @__PURE__ */ e.jsx(
46
46
  he,
47
47
  {
48
48
  size: "md",
@@ -56,139 +56,139 @@ const Tn = ({
56
56
  placeholder: "Filter use case",
57
57
  isMulti: !0,
58
58
  options: m,
59
- onChange: (h) => a(h.map((c) => c.value))
59
+ onChange: (h) => r(h.map((c) => c.value))
60
60
  }
61
61
  ) })
62
62
  ] });
63
63
  }, ge = ({
64
- children: o
65
- }) => /* @__PURE__ */ e.jsx(Pe, { fontWeight: "bold", fontFamily: "sans-serif", fontSize: "large", children: o }), Nn = ({
66
- items: o,
67
- onChange: s,
68
- selectedItem: a,
64
+ children: s
65
+ }) => /* @__PURE__ */ e.jsx(_e, { fontWeight: "bold", fontFamily: "sans-serif", fontSize: "large", children: s }), $n = ({
66
+ items: s,
67
+ onChange: n,
68
+ selectedItem: r,
69
69
  isDisabled: p,
70
70
  selectedProps: m,
71
71
  buttonProps: h
72
72
  }) => {
73
- const c = (n) => n === a || n.value === a, b = (n) => c(n) ? { ...h, ...m } : h;
74
- return /* @__PURE__ */ e.jsx(Ae, { isAttached: !0, isDisabled: p, children: o.map((n, r) => /* @__PURE__ */ e.jsx(
75
- st,
73
+ const c = (t) => t === r || t.value === r, b = (t) => c(t) ? { ...h, ...m } : h;
74
+ return /* @__PURE__ */ e.jsx(Ne, { isAttached: !0, isDisabled: p, children: s.map((t, o) => /* @__PURE__ */ e.jsx(
75
+ rt,
76
76
  {
77
- label: n.tooltip,
77
+ label: t.tooltip,
78
78
  openDelay: 50,
79
79
  closeDelay: 200,
80
80
  placement: "top",
81
- visibility: n.tooltip ? "visible" : "hidden",
81
+ visibility: t.tooltip ? "visible" : "hidden",
82
82
  hasArrow: !0,
83
83
  children: /* @__PURE__ */ e.jsx(
84
- ne,
84
+ te,
85
85
  {
86
- onClick: () => c(n) ? null : s(n, r),
87
- isDisabled: n.disabled,
88
- ...b(n),
89
- children: n.label
86
+ onClick: () => c(t) ? null : n(t, o),
87
+ isDisabled: t.disabled,
88
+ ...b(t),
89
+ children: t.label
90
90
  }
91
91
  )
92
92
  },
93
- r
93
+ o
94
94
  )) });
95
- }, qe = (o, s) => s < 0 ? -1 * Math.abs(o) : Math.abs(o), Rn = ({
96
- isReversed: o,
97
- min: s,
98
- max: a,
95
+ }, Ke = (s, n) => n < 0 ? -1 * Math.abs(s) : Math.abs(s), Dn = ({
96
+ isReversed: s,
97
+ min: n,
98
+ max: r,
99
99
  value: p,
100
100
  onChange: m,
101
101
  inputProps: h,
102
102
  size: c,
103
103
  zeroMarker: b,
104
- formatValue: n,
105
- valueLabel: r,
106
- positiveNegativeLabels: d,
104
+ formatValue: t,
105
+ valueLabel: o,
106
+ positiveNegativeLabels: u,
107
107
  isDisabled: y,
108
108
  ...j
109
109
  }) => {
110
- const [v, C] = z([void 0, void 0]), I = v[0], x = v[1], u = b && s < -5 && a > 5, S = Number(p?.[0] ?? x ?? s) > 0 ? 1 : -1, g = Number(p?.[1] ?? x ?? a) < 0 ? -1 : 1, w = d?.[0] === d?.[1], O = p?.[0], B = p?.[1];
110
+ const [w, I] = q([void 0, void 0]), L = w[0], x = w[1], d = b && n < -5 && r > 5, k = Number(p?.[0] ?? x ?? n) > 0 ? 1 : -1, g = Number(p?.[1] ?? x ?? r) < 0 ? -1 : 1, R = u?.[0] === u?.[1], v = p?.[0], E = p?.[1];
111
111
  ce(() => {
112
- O !== void 0 && B !== void 0 && C([O.toFixed(0), B.toFixed(0)]);
113
- }, [O, B, C]);
114
- const A = F(
115
- ([N, E]) => {
116
- N < E && C([N.toFixed(0), E.toFixed(0)]);
112
+ v !== void 0 && E !== void 0 && I([v.toFixed(0), E.toFixed(0)]);
113
+ }, [v, E, I]);
114
+ const $ = _(
115
+ ([T, B]) => {
116
+ T < B && I([T.toFixed(0), B.toFixed(0)]);
117
117
  },
118
- [C]
119
- ), R = F(
120
- ([N, E]) => {
121
- N < E && m([N, E]);
118
+ [I]
119
+ ), O = _(
120
+ ([T, B]) => {
121
+ T < B && m([T, B]);
122
122
  },
123
123
  [m]
124
- ), X = F(() => {
125
- C(([N, E]) => {
126
- const Y = isNaN(Number(N)) ? s : Number(N), _ = isNaN(Number(E)) ? a : Number(E), q = qe(Number(Y), S), i = qe(Number(_), g), t = S < 0 ? Math.max(q, s) : Math.min(q, a), l = g < 0 ? Math.max(i, s) : Math.min(i, a);
127
- return t > l ? (m([l, t]), [l.toFixed(0), t.toFixed(0)]) : (m([t, l]), [t.toFixed(0), l.toFixed(0)]);
124
+ ), K = _(() => {
125
+ I(([T, B]) => {
126
+ const J = isNaN(Number(T)) ? n : Number(T), U = isNaN(Number(B)) ? r : Number(B), H = Ke(Number(J), k), i = Ke(Number(U), g), a = k < 0 ? Math.max(H, n) : Math.min(H, r), C = g < 0 ? Math.max(i, n) : Math.min(i, r);
127
+ return a > C ? (m([C, a]), [C.toFixed(0), a.toFixed(0)]) : (m([a, C]), [a.toFixed(0), C.toFixed(0)]);
128
128
  });
129
- }, [m, C, S, g, s, a]), se = F(
130
- (N) => {
131
- const E = N === "" || isNaN(Number(N)) ? N : qe(Number(N), S);
132
- C(([Y, _]) => [E.toString(), _]);
129
+ }, [m, I, k, g, n, r]), oe = _(
130
+ (T) => {
131
+ const B = T === "" || isNaN(Number(T)) ? T : Ke(Number(T), k);
132
+ I(([J, U]) => [B.toString(), U]);
133
133
  },
134
- [C, S]
135
- ), D = F(
136
- (N) => {
137
- const E = N === "" || isNaN(Number(N)) ? N : qe(Number(N), g);
138
- C(([Y, _]) => [Y, E.toString()]);
134
+ [I, k]
135
+ ), D = _(
136
+ (T) => {
137
+ const B = T === "" || isNaN(Number(T)) ? T : Ke(Number(T), g);
138
+ I(([J, U]) => [J, B.toString()]);
139
139
  },
140
- [C, g]
141
- ), V = T(
140
+ [I, g]
141
+ ), ae = N(
142
142
  () => c === "xs" ? "0.75rem" : void 0,
143
143
  [c]
144
- ), ee = F(
145
- (N, E) => {
146
- const Y = Number(E.target.value);
147
- if (!I || !x || ![-1, 1].includes(Y))
144
+ ), Z = _(
145
+ (T, B) => {
146
+ const J = Number(B.target.value);
147
+ if (!L || !x || ![-1, 1].includes(J))
148
148
  return;
149
- const _ = (t) => Y < 0 ? -1 * Math.abs(t) : Math.abs(t), q = N ? _(Number(I)) : Number(I), i = N ? Number(x) : _(Number(x));
150
- q > i ? m([i, q]) : m([q, i]);
149
+ const U = (a) => J < 0 ? -1 * Math.abs(a) : Math.abs(a), H = T ? U(Number(L)) : Number(L), i = T ? Number(x) : U(Number(x));
150
+ H > i ? m([i, H]) : m([H, i]);
151
151
  },
152
- [I, x, m]
152
+ [L, x, m]
153
153
  );
154
- return /* @__PURE__ */ e.jsxs(Le, { direction: "column", ...j, children: [
155
- /* @__PURE__ */ e.jsx(re, { pt: "1em", mb: "-0.5em", children: /* @__PURE__ */ e.jsxs(
156
- Pt,
154
+ return /* @__PURE__ */ e.jsxs(Me, { direction: "column", ...j, children: [
155
+ /* @__PURE__ */ e.jsx(se, { pt: "1em", mb: "-0.5em", children: /* @__PURE__ */ e.jsxs(
156
+ _t,
157
157
  {
158
158
  "aria-label": ["min", "max"],
159
- isReversed: o,
160
- value: [Number(I ?? s), Number(x ?? a)],
161
- max: a,
162
- min: s,
159
+ isReversed: s,
160
+ value: [Number(L ?? n), Number(x ?? r)],
161
+ max: r,
162
+ min: n,
163
163
  minStepsBetweenThumbs: 3,
164
164
  step: 1,
165
- onChange: A,
166
- onChangeEnd: R,
165
+ onChange: $,
166
+ onChangeEnd: O,
167
167
  isDisabled: y,
168
168
  children: [
169
- /* @__PURE__ */ e.jsx(nt, { value: s, top: "-1em", children: /* @__PURE__ */ e.jsx(
170
- k,
169
+ /* @__PURE__ */ e.jsx(st, { value: n, top: "-1em", children: /* @__PURE__ */ e.jsx(
170
+ M,
171
171
  {
172
172
  fontSize: c ?? "sm",
173
173
  fontWeight: "semibold",
174
174
  whiteSpace: "nowrap",
175
- children: n ? n?.(s) : s
175
+ children: t ? t?.(n) : n
176
176
  }
177
177
  ) }),
178
- /* @__PURE__ */ e.jsx(nt, { value: a, top: "-1em", children: /* @__PURE__ */ e.jsx(
179
- k,
178
+ /* @__PURE__ */ e.jsx(st, { value: r, top: "-1em", children: /* @__PURE__ */ e.jsx(
179
+ M,
180
180
  {
181
181
  fontSize: c ?? "sm",
182
182
  fontWeight: "semibold",
183
183
  style: { transform: "translateX(-100%)" },
184
184
  whiteSpace: "nowrap",
185
- children: n ? n(a) : a
185
+ children: t ? t(r) : r
186
186
  }
187
187
  ) }),
188
- u && /* @__PURE__ */ e.jsxs(nt, { value: 0, top: "-1em", pos: "relative", children: [
189
- /* @__PURE__ */ e.jsx(k, { fontSize: c, fontWeight: "semibold", children: n?.(0) ?? "0" }),
188
+ d && /* @__PURE__ */ e.jsxs(st, { value: 0, top: "-1em", pos: "relative", children: [
189
+ /* @__PURE__ */ e.jsx(M, { fontSize: c, fontWeight: "semibold", children: t?.(0) ?? "0" }),
190
190
  /* @__PURE__ */ e.jsx(
191
- re,
191
+ se,
192
192
  {
193
193
  position: "absolute",
194
194
  width: "2px",
@@ -199,79 +199,79 @@ const Tn = ({
199
199
  }
200
200
  )
201
201
  ] }),
202
- /* @__PURE__ */ e.jsx(_t, { children: /* @__PURE__ */ e.jsx(Et, {}) }),
203
- /* @__PURE__ */ e.jsx(ct, { index: 0, w: V, h: V }),
204
- /* @__PURE__ */ e.jsx(ct, { index: 1, w: V, h: V })
202
+ /* @__PURE__ */ e.jsx(Et, { children: /* @__PURE__ */ e.jsx(zt, {}) }),
203
+ /* @__PURE__ */ e.jsx(dt, { index: 0, w: ae, h: ae }),
204
+ /* @__PURE__ */ e.jsx(dt, { index: 1, w: ae, h: ae })
205
205
  ]
206
206
  }
207
207
  ) }),
208
- r && /* @__PURE__ */ e.jsxs(
209
- Le,
208
+ o && /* @__PURE__ */ e.jsxs(
209
+ Me,
210
210
  {
211
- direction: o ? "row-reverse" : "row",
211
+ direction: s ? "row-reverse" : "row",
212
212
  justifyContent: "space-between",
213
213
  children: [
214
214
  /* @__PURE__ */ e.jsx(
215
- k,
215
+ M,
216
216
  {
217
217
  fontSize: c ?? "sm",
218
218
  fontWeight: "semibold",
219
219
  whiteSpace: "nowrap",
220
- children: r(s)
220
+ children: o(n)
221
221
  }
222
222
  ),
223
223
  /* @__PURE__ */ e.jsx(
224
- k,
224
+ M,
225
225
  {
226
226
  fontSize: c ?? "sm",
227
227
  fontWeight: "semibold",
228
228
  whiteSpace: "nowrap",
229
- children: r(a)
229
+ children: o(r)
230
230
  }
231
231
  )
232
232
  ]
233
233
  }
234
234
  ),
235
235
  /* @__PURE__ */ e.jsxs(
236
- Le,
236
+ Me,
237
237
  {
238
- direction: o ? "row-reverse" : "row",
238
+ direction: s ? "row-reverse" : "row",
239
239
  justifyContent: "center",
240
240
  alignItems: "center",
241
241
  gap: "0.125em",
242
242
  children: [
243
- d && /* @__PURE__ */ e.jsxs(
244
- dt,
243
+ u && /* @__PURE__ */ e.jsxs(
244
+ ut,
245
245
  {
246
246
  width: "auto",
247
247
  size: c,
248
248
  fontWeight: "bold",
249
- value: S,
250
- onChange: (N) => ee(!0, N),
251
- isDisabled: w || y,
249
+ value: k,
250
+ onChange: (T) => Z(!0, T),
251
+ isDisabled: R || y,
252
252
  children: [
253
- /* @__PURE__ */ e.jsx("option", { value: -1, children: d[0] }),
254
- /* @__PURE__ */ e.jsx("option", { value: 1, children: d[1] })
253
+ /* @__PURE__ */ e.jsx("option", { value: -1, children: u[0] }),
254
+ /* @__PURE__ */ e.jsx("option", { value: 1, children: u[1] })
255
255
  ]
256
256
  }
257
257
  ),
258
258
  /* @__PURE__ */ e.jsx(
259
- ut,
259
+ mt,
260
260
  {
261
261
  precision: 0,
262
262
  size: c ?? "sm",
263
263
  min: 0,
264
- max: S < 0 ? Math.abs(s) : B ?? a,
265
- value: I === "" ? "" : Math.abs(Number(I ?? s)),
266
- onChange: se,
267
- onBlur: X,
264
+ max: k < 0 ? Math.abs(n) : E ?? r,
265
+ value: L === "" ? "" : Math.abs(Number(L ?? n)),
266
+ onChange: oe,
267
+ onBlur: K,
268
268
  borderWidth: 1,
269
269
  borderRadius: 3,
270
270
  borderColor: "#ccc",
271
271
  isDisabled: y,
272
272
  ...h,
273
273
  children: /* @__PURE__ */ e.jsx(
274
- mt,
274
+ ht,
275
275
  {
276
276
  backgroundColor: "#fff",
277
277
  paddingRight: 0,
@@ -281,22 +281,22 @@ const Tn = ({
281
281
  }
282
282
  ),
283
283
  /* @__PURE__ */ e.jsx(
284
- ut,
284
+ mt,
285
285
  {
286
286
  size: c ?? "sm",
287
287
  min: 0,
288
- max: g < 0 ? Math.abs(O ?? s) : a,
288
+ max: g < 0 ? Math.abs(v ?? n) : r,
289
289
  precision: 0,
290
- value: x === "" ? "" : Math.abs(Number(x ?? a)),
290
+ value: x === "" ? "" : Math.abs(Number(x ?? r)),
291
291
  onChange: D,
292
- onBlur: X,
292
+ onBlur: K,
293
293
  borderWidth: 1,
294
294
  borderRadius: 3,
295
295
  borderColor: "#ccc",
296
296
  isDisabled: y,
297
297
  ...h,
298
298
  children: /* @__PURE__ */ e.jsx(
299
- mt,
299
+ ht,
300
300
  {
301
301
  backgroundColor: "#fff",
302
302
  paddingRight: 0,
@@ -305,18 +305,18 @@ const Tn = ({
305
305
  )
306
306
  }
307
307
  ),
308
- d && /* @__PURE__ */ e.jsxs(
309
- dt,
308
+ u && /* @__PURE__ */ e.jsxs(
309
+ ut,
310
310
  {
311
311
  width: "auto",
312
312
  size: c,
313
313
  fontWeight: "bold",
314
314
  value: g,
315
- onChange: (N) => ee(!1, N),
316
- isDisabled: w || y,
315
+ onChange: (T) => Z(!1, T),
316
+ isDisabled: R || y,
317
317
  children: [
318
- /* @__PURE__ */ e.jsx("option", { value: -1, children: d[0] }),
319
- /* @__PURE__ */ e.jsx("option", { value: 1, children: d[1] })
318
+ /* @__PURE__ */ e.jsx("option", { value: -1, children: u[0] }),
319
+ /* @__PURE__ */ e.jsx("option", { value: 1, children: u[1] })
320
320
  ]
321
321
  }
322
322
  )
@@ -324,20 +324,20 @@ const Tn = ({
324
324
  }
325
325
  )
326
326
  ] });
327
- }, Dn = ({ tags: o, containerProps: s, ...a }) => /* @__PURE__ */ e.jsx(Z, { ...s, children: o.map((p, m) => /* @__PURE__ */ e.jsx($e, { ...a, children: p }, m)) }), $n = new jn({}), Gn = ({
328
- action: o,
329
- quantumIconSrc: s
327
+ }, Gn = ({ tags: s, containerProps: n, ...r }) => /* @__PURE__ */ e.jsx(V, { ...n, children: s.map((p, m) => /* @__PURE__ */ e.jsx(Ge, { ...r, children: p }, m)) }), Fn = new jn({}), Pn = ({
328
+ action: s,
329
+ quantumIconSrc: n
330
330
  }) => {
331
- const { getLabel: a } = xe(), p = T(() => ({
332
- actionLowerCase: a("action").toLocaleLowerCase()
333
- }), [a]);
334
- return o.quantumOwned ? /* @__PURE__ */ e.jsx(
335
- st,
331
+ const { getLabel: r } = xe(), p = N(() => ({
332
+ actionLowerCase: r("action").toLocaleLowerCase()
333
+ }), [r]);
334
+ return s.quantumOwned ? /* @__PURE__ */ e.jsx(
335
+ rt,
336
336
  {
337
337
  label: `This ${p.actionLowerCase} is owned by Quantum`,
338
338
  "aria-label": "Quantum owned",
339
339
  children: /* @__PURE__ */ e.jsx(
340
- re,
340
+ se,
341
341
  {
342
342
  boxSize: "1.5em",
343
343
  borderRadius: "full",
@@ -346,9 +346,9 @@ const Tn = ({
346
346
  alignItems: "center",
347
347
  justifyContent: "center",
348
348
  children: /* @__PURE__ */ e.jsx(
349
- Qt,
349
+ qt,
350
350
  {
351
- src: s,
351
+ src: n,
352
352
  boxSize: "1em",
353
353
  alt: `Quantum-owned ${p.actionLowerCase}`
354
354
  }
@@ -357,228 +357,230 @@ const Tn = ({
357
357
  )
358
358
  }
359
359
  ) : null;
360
- }, Fn = (o, s) => {
361
- if (!s || !s.trim().length)
362
- return o;
363
- const a = o.map((m) => m.name ?? "");
364
- return $n.filter(a, s)?.map((m) => o[m]) ?? [];
365
- }, Pn = (o) => !o || o.length === 0 ? "None" : o.map(
366
- (s) => (
360
+ }, _n = (s, n) => {
361
+ if (!n || !n.trim().length)
362
+ return s;
363
+ const r = s.map((m) => m.name ?? "");
364
+ return Fn.filter(r, n)?.map((m) => s[m]) ?? [];
365
+ }, En = (s) => !s || s.length === 0 ? "None" : s.map(
366
+ (n) => (
367
367
  // Convert camelCase to separate words (e.g., 'LeftFoot' -> 'Left Foot')
368
- s.replace(/([A-Z])/g, " $1").trim()
368
+ n.replace(/([A-Z])/g, " $1").trim()
369
369
  )
370
- ).join(", "), _n = (o, s) => !s || s.length == 0 ? o : o.filter(
371
- (a) => a.useCases?.some((p) => s.includes(p.id)) ?? !1
372
- ), En = (o, s, a) => !s || s.length === 0 ? o : o.filter((p) => {
370
+ ).join(", "), zn = (s, n) => !n || n.length == 0 ? s : s.filter(
371
+ (r) => r.useCases?.some((p) => n.includes(p.id)) ?? !1
372
+ ), Bn = (s, n, r) => !n || n.length === 0 ? s : s.filter((p) => {
373
373
  const m = {};
374
- return s.forEach((h) => {
375
- for (const [c, b] of Object.entries(a || {}))
376
- if (b.some((n) => n.id === h)) {
374
+ return n.forEach((h) => {
375
+ for (const [c, b] of Object.entries(r || {}))
376
+ if (b.some((t) => t.id === h)) {
377
377
  m[c] || (m[c] = []), m[c].push(h);
378
378
  break;
379
379
  }
380
380
  }), Object.entries(m).every(
381
381
  ([h, c]) => {
382
- const b = p.metadataGroups?.find((y) => M(je, y).key === h);
382
+ const b = p.metadataGroups?.find((y) => A(je, y).key === h);
383
383
  if (!b)
384
384
  return !1;
385
- const n = M(
385
+ const t = A(
386
386
  je,
387
387
  b
388
- ), d = M(
388
+ ), u = A(
389
389
  be,
390
- n.data
390
+ t.data
391
391
  ).map((y) => y.id);
392
392
  return c.some(
393
- (y) => d.includes(y)
393
+ (y) => u.includes(y)
394
394
  );
395
395
  }
396
396
  );
397
- }), zn = ({
398
- actions: o,
399
- totalActions: s,
400
- onCreate: a,
397
+ }), Un = ({
398
+ actions: s,
399
+ totalActions: n,
400
+ onCreate: r,
401
401
  onDelete: p,
402
402
  onEdit: m,
403
403
  onView: h,
404
404
  onSelected: c,
405
405
  onDuplicate: b,
406
- disableMultiSelect: n,
407
- disableDelete: r,
408
- disableEdit: d,
406
+ disableMultiSelect: t,
407
+ disableDelete: o,
408
+ disableEdit: u,
409
409
  disableCreate: y,
410
410
  hideUseCase: j = !0,
411
- showMetadataFilters: v = !0,
412
- tableProps: C,
413
- containerProps: I,
414
- quantumIconSrc: x = "/favicon.ico"
411
+ showMetadataFilters: w = !0,
412
+ tableProps: I,
413
+ containerProps: L,
414
+ quantumIconSrc: x = "/favicon.ico",
415
+ allowDuplicateSelection: d = !1,
416
+ getSelectedCount: k
415
417
  }) => {
416
- const [u, S] = z(""), [g, w] = z(), [O, B] = z([]), [A, R] = z({}), { getLabel: X } = xe(), se = at(), D = T(() => ({
417
- action: X("action"),
418
- actionPlural: X("action_plural"),
419
- actionLowerCase: X("action").toLocaleLowerCase(),
420
- actionPluralLowerCase: X("action_plural").toLocaleLowerCase()
421
- }), [X]), V = T(() => [
418
+ const [g, R] = q(""), [v, E] = q(), [$, O] = q([]), [K, oe] = q({}), { getLabel: D } = xe(), ae = lt(), Z = N(() => ({
419
+ action: D("action"),
420
+ actionPlural: D("action_plural"),
421
+ actionLowerCase: D("action").toLocaleLowerCase(),
422
+ actionPluralLowerCase: D("action_plural").toLocaleLowerCase()
423
+ }), [D]), T = N(() => [
422
424
  { key: "module_category", label: "Link Category", multi: !0 },
423
- { key: "activity_type", label: `${D.action} Type`, multi: !0 },
425
+ { key: "activity_type", label: `${Z.action} Type`, multi: !0 },
424
426
  { key: "session_type", label: "Session Type", multi: !0 },
425
427
  { key: "body_region", label: "Body Region", multi: !0 },
426
428
  { key: "sport", label: "Sport", multi: !0 }
427
- ], [D.action]);
429
+ ], [Z.action]);
428
430
  ce(() => {
429
- if (!v)
431
+ if (!w)
430
432
  return;
431
- const t = V.map(
432
- (l) => se.query(ot, { key: l.key })
433
+ const l = T.map(
434
+ (S) => ae.query(at, { key: S.key })
433
435
  );
434
- Promise.all(t).then((l) => {
435
- const L = {};
436
- l.forEach((W) => {
437
- if (W.error || !W.data) return;
438
- const K = M(
436
+ Promise.all(l).then((S) => {
437
+ const W = {};
438
+ S.forEach((G) => {
439
+ if (G.error || !G.data) return;
440
+ const Q = A(
439
441
  je,
440
- W.data.getMetadataByKey
441
- ), Q = M(
442
+ G.data.getMetadataByKey
443
+ ), Y = A(
442
444
  be,
443
- K.data
445
+ Q.data
444
446
  );
445
- L[K.key] = Q.map((U) => ({
446
- label: U.label || U.value,
447
- value: U.value,
448
- id: U.id
447
+ W[Q.key] = Y.map((re) => ({
448
+ label: re.label || re.value,
449
+ value: re.value,
450
+ id: re.id
449
451
  }));
450
- }), R(L);
452
+ }), oe(W);
451
453
  });
452
- }, [se, V, v]);
453
- const ee = T(() => {
454
- if (!o)
454
+ }, [ae, T, w]);
455
+ const B = N(() => {
456
+ if (!s)
455
457
  return;
456
- const t = Fn(o, u), l = j ? t : _n(t, g);
457
- return v ? En(
458
- l,
459
- O,
460
- A
461
- ) : l;
458
+ const l = _n(s, g), S = j ? l : zn(l, v);
459
+ return w ? Bn(
460
+ S,
461
+ $,
462
+ K
463
+ ) : S;
462
464
  }, [
463
- o,
464
- u,
465
+ s,
465
466
  g,
466
- j,
467
467
  v,
468
- O,
469
- A
470
- ]), N = F(() => {
468
+ j,
469
+ w,
470
+ $,
471
+ K
472
+ ]), J = _(() => {
471
473
  if (!p)
472
474
  return;
473
- const l = o.filter(
474
- (L) => L.selected && !L.quantumOwned
475
- ).map((L) => L.id);
476
- p(l);
477
- }, [o, p]), E = F(() => {
475
+ const S = s.filter(
476
+ (W) => W.selected && !W.quantumOwned
477
+ ).map((W) => W.id);
478
+ p(S);
479
+ }, [s, p]), U = _(() => {
478
480
  if (!b)
479
481
  return;
480
- const t = o.filter((l) => l.selected);
481
- b(t.map((l) => l.id)), c && t.forEach((l) => c(l, !1));
482
- }, [o, b, c]), Y = T(() => o.some((t) => t.selected && !t.quantumOwned), [o]), _ = T(() => o.some((t) => t.selected), [o]), q = T(() => o.some((t) => t.selected && t.quantumOwned), [o]), i = F(
483
- (t, l) => {
484
- const L = V.find((K) => K.key === t);
485
- if (!L) return;
486
- const W = L.multi ? (l ?? []).map((K) => K.id) : l ? [l.id] : [];
487
- B((K) => [...K.filter((U) => Object.values(A).flat().find((ie) => ie.id === U) && !Object.keys(A).find(
488
- (ie) => A[ie]?.some(
489
- (ye) => ye.id === U && ie === t
482
+ const l = s.filter((S) => S.selected);
483
+ b(l.map((S) => S.id)), c && l.forEach((S) => c(S, !1));
484
+ }, [s, b, c]), H = N(() => s.some((l) => l.selected && !l.quantumOwned), [s]), i = N(() => s.some((l) => l.selected), [s]), a = N(() => s.some((l) => l.selected && l.quantumOwned), [s]), C = _(
485
+ (l, S) => {
486
+ const W = T.find((Q) => Q.key === l);
487
+ if (!W) return;
488
+ const G = W.multi ? (S ?? []).map((Q) => Q.id) : S ? [S.id] : [];
489
+ O((Q) => [...Q.filter((re) => Object.values(K).flat().find((Ie) => Ie.id === re) && !Object.keys(K).find(
490
+ (Ie) => K[Ie]?.some(
491
+ (Se) => Se.id === re && Ie === l
490
492
  )
491
- )), ...W]);
493
+ )), ...G]);
492
494
  },
493
- [V, A]
495
+ [T, K]
494
496
  );
495
- return /* @__PURE__ */ e.jsxs(re, { ...I, children: [
496
- /* @__PURE__ */ e.jsxs(Le, { alignContent: "space-between", gap: 4, children: [
497
- (a || p || b) && /* @__PURE__ */ e.jsxs(Ae, { mb: "1rem", gap: 4, children: [
498
- a && /* @__PURE__ */ e.jsxs(
499
- ne,
497
+ return /* @__PURE__ */ e.jsxs(se, { ...L, children: [
498
+ /* @__PURE__ */ e.jsxs(Me, { alignContent: "space-between", gap: 4, children: [
499
+ (r || p || b) && /* @__PURE__ */ e.jsxs(Ne, { mb: "1rem", gap: 4, children: [
500
+ r && /* @__PURE__ */ e.jsxs(
501
+ te,
500
502
  {
501
- isDisabled: !a || y,
503
+ isDisabled: !r || y,
502
504
  colorScheme: "blackAlpha",
503
505
  backgroundColor: "gray.700",
504
- onClick: a,
506
+ onClick: r,
505
507
  children: [
506
508
  "Create New ",
507
- D.action
509
+ Z.action
508
510
  ]
509
511
  }
510
512
  ),
511
- p && !n && /* @__PURE__ */ e.jsx(
512
- st,
513
+ p && !t && /* @__PURE__ */ e.jsx(
514
+ rt,
513
515
  {
514
- label: q ? Y ? `Quantum-owned ${D.actionPluralLowerCase} are selected and will be skipped` : `Selected ${D.actionPluralLowerCase} are quantum-owned and cannot be deleted` : void 0,
516
+ label: a ? H ? `Quantum-owned ${Z.actionPluralLowerCase} are selected and will be skipped` : `Selected ${Z.actionPluralLowerCase} are quantum-owned and cannot be deleted` : void 0,
515
517
  shouldWrapChildren: !0,
516
518
  children: /* @__PURE__ */ e.jsx(
517
- ne,
519
+ te,
518
520
  {
519
521
  colorScheme: "gray",
520
- isDisabled: !Y || !p || r,
521
- onClick: N,
522
+ isDisabled: !H || !p || o,
523
+ onClick: J,
522
524
  children: "Delete Selected"
523
525
  }
524
526
  )
525
527
  }
526
528
  ),
527
- b && !n && /* @__PURE__ */ e.jsx(
528
- ne,
529
+ b && !t && /* @__PURE__ */ e.jsx(
530
+ te,
529
531
  {
530
532
  colorScheme: "gray",
531
- isDisabled: !_,
532
- onClick: E,
533
+ isDisabled: !i,
534
+ onClick: U,
533
535
  children: "Duplicate Selected"
534
536
  }
535
537
  )
536
538
  ] }),
537
539
  /* @__PURE__ */ e.jsx(
538
- Tn,
540
+ Rn,
539
541
  {
540
- setSearch: S,
541
- actions: o,
542
- updateUseCases: w,
542
+ setSearch: R,
543
+ actions: s,
544
+ updateUseCases: E,
543
545
  hideUseCaseFilter: j
544
546
  }
545
547
  )
546
548
  ] }),
547
- v && A && /* @__PURE__ */ e.jsx(re, { my: 4, children: /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4", children: V.map((t) => /* @__PURE__ */ e.jsxs(J, { children: [
548
- /* @__PURE__ */ e.jsx(Pe, { fontSize: "sm", children: t.label }),
549
+ w && K && /* @__PURE__ */ e.jsx(se, { my: 4, children: /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4", children: T.map((l) => /* @__PURE__ */ e.jsxs(X, { children: [
550
+ /* @__PURE__ */ e.jsx(_e, { fontSize: "sm", children: l.label }),
549
551
  /* @__PURE__ */ e.jsx(
550
552
  he,
551
553
  {
552
554
  chakraStyles: {
553
- menu: (l) => ({
554
- ...l,
555
+ menu: (S) => ({
556
+ ...S,
555
557
  zIndex: 2
556
558
  })
557
559
  },
558
- isMulti: t.multi,
559
- value: A[t.key]?.filter(
560
- (l) => O.includes(l.id)
560
+ isMulti: l.multi,
561
+ value: K[l.key]?.filter(
562
+ (S) => $.includes(S.id)
561
563
  ),
562
- onChange: (l) => {
563
- i(
564
- t.key,
565
- l
564
+ onChange: (S) => {
565
+ C(
566
+ l.key,
567
+ S
566
568
  );
567
569
  },
568
- options: A[t.key],
569
- placeholder: `Select ${t.multi ? "one or more" : "one"} ${t.label.toLowerCase()}`,
570
- isClearable: t.multi
570
+ options: K[l.key],
571
+ placeholder: `Select ${l.multi ? "one or more" : "one"} ${l.label.toLowerCase()}`,
572
+ isClearable: l.multi
571
573
  }
572
574
  )
573
- ] }, t.key)) }) }),
574
- /* @__PURE__ */ e.jsx(zt, { mr: "2rem", overflowX: "hidden", ...C, children: /* @__PURE__ */ e.jsxs(Bt, { size: "md", variant: "simple", children: [
575
- /* @__PURE__ */ e.jsx(Ut, { position: "sticky", top: 0, bg: "white", zIndex: 1, children: /* @__PURE__ */ e.jsxs(ht, { children: [
575
+ ] }, l.key)) }) }),
576
+ /* @__PURE__ */ e.jsx(Bt, { mr: "2rem", overflowX: "hidden", ...I, children: /* @__PURE__ */ e.jsxs(Ut, { size: "md", variant: "simple", children: [
577
+ /* @__PURE__ */ e.jsx(Wt, { position: "sticky", top: 0, bg: "white", zIndex: 1, children: /* @__PURE__ */ e.jsxs(pt, { children: [
576
578
  /* @__PURE__ */ e.jsxs(De, { fontWeight: "normal", children: [
577
579
  "(showing ",
578
- ee?.length ?? 0,
580
+ B?.length ?? 0,
579
581
  " of",
580
582
  " ",
581
- s ?? o.length,
583
+ n ?? s.length,
582
584
  ")"
583
585
  ] }),
584
586
  /* @__PURE__ */ e.jsx(De, { children: "Name" }),
@@ -586,138 +588,181 @@ const Tn = ({
586
588
  !j && /* @__PURE__ */ e.jsx(De, { children: "Use Case" }),
587
589
  /* @__PURE__ */ e.jsx(De, {})
588
590
  ] }) }),
589
- /* @__PURE__ */ e.jsx(Wt, { children: ee?.map((t) => /* @__PURE__ */ e.jsxs(
590
- ht,
591
- {
592
- className: He(
593
- "hover:bg-[#f7f7f7]",
594
- !n && "cursor-pointer",
595
- t.selected && "bg-gray-200"
596
- ),
597
- onClick: () => {
598
- n || c?.(t, !t.selected);
599
- },
600
- children: [
601
- /* @__PURE__ */ e.jsx(Ue, { children: /* @__PURE__ */ e.jsxs(Le, { children: [
602
- !n && /* @__PURE__ */ e.jsx(e.Fragment, { children: t.selected ? /* @__PURE__ */ e.jsx(yn, { className: "text-blue-500" }) : /* @__PURE__ */ e.jsx(vn, { className: "text-gray-400" }) }),
603
- (t.quantumOwned || !m) && h && /* @__PURE__ */ e.jsx(
604
- ne,
605
- {
606
- ml: "1em",
607
- size: "sm",
608
- variant: "link",
609
- colorScheme: "blue",
610
- onClick: (l) => {
611
- l.stopPropagation(), h(t.id);
612
- },
613
- children: "View"
614
- }
615
- ),
616
- !t.quantumOwned && m && /* @__PURE__ */ e.jsx(
617
- ne,
618
- {
619
- isDisabled: d,
620
- ml: "1em",
621
- size: "sm",
622
- variant: "link",
623
- colorScheme: "blue",
624
- onClick: (l) => {
625
- l.stopPropagation(), m(t.id);
626
- },
627
- children: "Edit"
628
- }
629
- )
630
- ] }) }),
631
- /* @__PURE__ */ e.jsx(Ue, { whiteSpace: "break-spaces", children: /* @__PURE__ */ e.jsxs(Le, { align: "center", gap: 2, children: [
632
- /* @__PURE__ */ e.jsx(
591
+ /* @__PURE__ */ e.jsx(Qt, { children: B?.map((l) => {
592
+ const S = d ? k?.(l.id) ?? 0 : 0, W = d ? S > 0 : !!l.selected;
593
+ return /* @__PURE__ */ e.jsxs(
594
+ pt,
595
+ {
596
+ className: Je(
597
+ "hover:bg-[#f7f7f7]",
598
+ !t && !d && "cursor-pointer",
599
+ W && "bg-gray-200"
600
+ ),
601
+ onClick: () => {
602
+ t || d || c?.(l, !l.selected);
603
+ },
604
+ children: [
605
+ /* @__PURE__ */ e.jsx(We, { children: /* @__PURE__ */ e.jsxs(Me, { alignItems: "center", children: [
606
+ !t && d ? /* @__PURE__ */ e.jsxs(
607
+ V,
608
+ {
609
+ spacing: 1,
610
+ onClick: (G) => G.stopPropagation(),
611
+ children: [
612
+ /* @__PURE__ */ e.jsx(
613
+ ot,
614
+ {
615
+ "aria-label": "Remove one instance",
616
+ icon: /* @__PURE__ */ e.jsx(yn, {}),
617
+ size: "xs",
618
+ variant: "outline",
619
+ isDisabled: S === 0,
620
+ onClick: () => c?.(l, !1)
621
+ }
622
+ ),
623
+ /* @__PURE__ */ e.jsx(
624
+ M,
625
+ {
626
+ minW: "1.5rem",
627
+ textAlign: "center",
628
+ fontWeight: S > 0 ? "semibold" : "normal",
629
+ color: S > 0 ? "blue.600" : "gray.500",
630
+ children: S
631
+ }
632
+ ),
633
+ /* @__PURE__ */ e.jsx(
634
+ ot,
635
+ {
636
+ "aria-label": "Add one instance",
637
+ icon: /* @__PURE__ */ e.jsx(vn, {}),
638
+ size: "xs",
639
+ variant: "outline",
640
+ colorScheme: "blue",
641
+ onClick: () => c?.(l, !0)
642
+ }
643
+ )
644
+ ]
645
+ }
646
+ ) : t ? null : /* @__PURE__ */ e.jsx(e.Fragment, { children: l.selected ? /* @__PURE__ */ e.jsx(Cn, { className: "text-blue-500" }) : /* @__PURE__ */ e.jsx(wn, { className: "text-gray-400" }) }),
647
+ (l.quantumOwned || !m) && h && /* @__PURE__ */ e.jsx(
648
+ te,
649
+ {
650
+ ml: "1em",
651
+ size: "sm",
652
+ variant: "link",
653
+ colorScheme: "blue",
654
+ onClick: (G) => {
655
+ G.stopPropagation(), h(l.id);
656
+ },
657
+ children: "View"
658
+ }
659
+ ),
660
+ !l.quantumOwned && m && /* @__PURE__ */ e.jsx(
661
+ te,
662
+ {
663
+ isDisabled: u,
664
+ ml: "1em",
665
+ size: "sm",
666
+ variant: "link",
667
+ colorScheme: "blue",
668
+ onClick: (G) => {
669
+ G.stopPropagation(), m(l.id);
670
+ },
671
+ children: "Edit"
672
+ }
673
+ )
674
+ ] }) }),
675
+ /* @__PURE__ */ e.jsx(We, { whiteSpace: "break-spaces", children: /* @__PURE__ */ e.jsxs(Me, { align: "center", gap: 2, children: [
676
+ /* @__PURE__ */ e.jsx(
677
+ Pn,
678
+ {
679
+ action: l,
680
+ quantumIconSrc: x
681
+ }
682
+ ),
683
+ l.name
684
+ ] }) }),
685
+ /* @__PURE__ */ e.jsx(We, { maxW: "20rem", whiteSpace: "break-spaces", children: En(l.sensorLocations) }),
686
+ !j && /* @__PURE__ */ e.jsx(We, { maxW: "20rem", children: /* @__PURE__ */ e.jsx(
633
687
  Gn,
634
688
  {
635
- action: t,
636
- quantumIconSrc: x
689
+ containerProps: { flexWrap: "wrap" },
690
+ tags: l.useCases?.map((G) => G.name) ?? []
637
691
  }
638
- ),
639
- t.name
640
- ] }) }),
641
- /* @__PURE__ */ e.jsx(Ue, { maxW: "20rem", whiteSpace: "break-spaces", children: Pn(t.sensorLocations) }),
642
- !j && /* @__PURE__ */ e.jsx(Ue, { maxW: "20rem", children: /* @__PURE__ */ e.jsx(
643
- Dn,
644
- {
645
- containerProps: { flexWrap: "wrap" },
646
- tags: t.useCases?.map((l) => l.name) ?? []
647
- }
648
- ) })
649
- ]
650
- },
651
- t.id
652
- )) })
692
+ ) })
693
+ ]
694
+ },
695
+ l.id
696
+ );
697
+ }) })
653
698
  ] }) })
654
699
  ] });
655
- }, fs = ({
656
- onSave: o,
657
- onCancel: s,
658
- onError: a,
700
+ }, bs = ({
701
+ onSave: s,
702
+ onCancel: n,
703
+ onError: r,
659
704
  hideButtons: p = !1,
660
705
  setButtonDisabled: m,
661
706
  setButtonOnClick: h,
662
707
  quantumOwned: c
663
708
  }) => {
664
- const b = Ct(), { getLabel: n } = xe(), r = T(() => ({
665
- singular: n("action"),
666
- plural: n("action_plural"),
667
- pluralLowerCase: n("action_plural").toLowerCase(),
668
- singularLowerCase: n("action").toLowerCase()
669
- }), [n]), [d, y] = z("copy"), [j, v] = z(""), [C, I] = z([]), [x, u] = z(!1), [S] = we({
670
- query: St
671
- }), [g] = we({
709
+ const b = wt(), { getLabel: t } = xe(), o = N(() => ({
710
+ singular: t("action"),
711
+ plural: t("action_plural"),
712
+ pluralLowerCase: t("action_plural").toLowerCase(),
713
+ singularLowerCase: t("action").toLowerCase()
714
+ }), [t]), [u, y] = q("copy"), [j, w] = q(""), [I, L] = q([]), [x, d] = q(!1), [k] = Ce({
715
+ query: Lt
716
+ }), [g] = Ce({
672
717
  query: cn,
673
718
  variables: { groupId: j },
674
719
  pause: !j
675
720
  // Only run when group is selected
676
- }), [, w] = fe(rt), [, O] = fe(
677
- Lt
678
- ), B = T(() => S.data?.groups ? S.data.groups.map(
679
- (i) => M(kt, i)
680
- ) : [], [S.data]), A = T(() => g.data ? g.data.actions.map((t) => {
681
- const l = M(Ce, t), L = M(
682
- Ge,
683
- l.reports
684
- ), W = M(
721
+ }), [, R] = fe(it), [, v] = fe(
722
+ kt
723
+ ), E = N(() => k.data?.groups ? k.data.groups.map(
724
+ (i) => A(Mt, i)
725
+ ) : [], [k.data]), $ = N(() => g.data ? g.data.actions.map((a) => {
726
+ const C = A(ve, a), l = A(
685
727
  Fe,
686
- l.categories
687
- ), Q = M(
728
+ C.reports
729
+ ), S = A(
730
+ Pe,
731
+ C.categories
732
+ ), G = A(
688
733
  je,
689
- l.metadataGroups
690
- ).map((U) => ({
691
- ...U,
692
- data: U.data.map((H) => M(be, H))
734
+ C.metadataGroups
735
+ ).map((Q) => ({
736
+ ...Q,
737
+ data: Q.data.map((Y) => A(be, Y))
693
738
  }));
694
739
  return {
695
- ...l,
696
- thresholds: M(Oe, l.thresholds),
697
- reports: L.map((U) => ({
698
- ...U,
699
- thresholds: M(Oe, U.thresholds)
740
+ ...C,
741
+ thresholds: A(Te, C.thresholds),
742
+ reports: l.map((Q) => ({
743
+ ...Q,
744
+ thresholds: A(Te, Q.thresholds)
700
745
  })),
701
- categories: W,
702
- metadataGroups: Q
746
+ categories: S,
747
+ metadataGroups: G
703
748
  };
704
- }) : [], [g.data]), R = T(() => A.filter(
705
- (i) => C.includes(i.id)
706
- ), [A, C]), X = F(
749
+ }) : [], [g.data]), O = N(() => $.filter(
750
+ (i) => I.includes(i.id)
751
+ ), [$, I]), K = _(
707
752
  (i) => {
708
- const t = i?.value || "";
709
- v(t), I([]);
753
+ const a = i?.value || "";
754
+ w(a), L([]);
710
755
  },
711
756
  []
712
- ), se = F(
757
+ ), oe = _(
713
758
  (i) => {
714
- const t = i.map((l) => l.value);
715
- I(t);
759
+ const a = i.map((C) => C.value);
760
+ L(a);
716
761
  },
717
762
  []
718
- ), D = F(
763
+ ), D = _(
719
764
  async (i) => {
720
- const t = {
765
+ const a = {
721
766
  ...i,
722
767
  name: `${i.name} (Copy)`,
723
768
  // Add "(Copy)" suffix to distinguish
@@ -727,153 +772,153 @@ const Tn = ({
727
772
  laterality: i.laterality,
728
773
  activityKind: i.activityKind,
729
774
  sensorLocations: i.sensorLocations,
730
- thresholds: i.thresholds.map((L) => ({
731
- ...L,
775
+ thresholds: i.thresholds.map((l) => ({
776
+ ...l,
732
777
  id: void 0
733
778
  })),
734
- categories: i.categories.map((L) => L.id),
779
+ categories: i.categories.map((l) => l.id),
735
780
  quantumOwned: c,
736
- metadataItemIds: i.metadataGroups.flatMap((L) => L.data.map((W) => W.id)).filter((L) => L !== void 0),
737
- reports: i.reports.map((L) => ({
738
- ...L,
781
+ metadataItemIds: i.metadataGroups.flatMap((l) => l.data.map((S) => S.id)).filter((l) => l !== void 0),
782
+ reports: i.reports.map((l) => ({
783
+ ...l,
739
784
  id: void 0,
740
- thresholds: L.thresholds.map((W) => ({
741
- ...W,
785
+ thresholds: l.thresholds.map((S) => ({
786
+ ...S,
742
787
  id: void 0
743
788
  }))
744
789
  })),
745
790
  id: void 0
746
- }, l = await w({ fields: t });
747
- if (l.error) throw new Error(l.error.message);
748
- if (l.data?.createAction)
749
- return M(Ce, l.data.createAction);
791
+ }, C = await R({ fields: a });
792
+ if (C.error) throw new Error(C.error.message);
793
+ if (C.data?.createAction)
794
+ return A(ve, C.data.createAction);
750
795
  throw new Error("No action data returned");
751
796
  },
752
- [w, c]
753
- ), V = F(
797
+ [R, c]
798
+ ), ae = _(
754
799
  async (i) => {
755
- const t = await O({ id: i.id });
756
- if (t.error)
757
- throw new Error(t.error.message);
758
- if (t.data?.convertActionToQuantumOwned)
759
- return M(
760
- Ce,
761
- t.data.convertActionToQuantumOwned
800
+ const a = await v({ id: i.id });
801
+ if (a.error)
802
+ throw new Error(a.error.message);
803
+ if (a.data?.convertActionToQuantumOwned)
804
+ return A(
805
+ ve,
806
+ a.data.convertActionToQuantumOwned
762
807
  );
763
808
  throw new Error("No action data returned");
764
809
  },
765
- [O]
766
- ), ee = F(async () => {
767
- if (u(!0), !R.length) {
810
+ [v]
811
+ ), Z = _(async () => {
812
+ if (d(!0), !O.length) {
768
813
  const i = new Error(
769
- `No ${r.pluralLowerCase} selected for ${d === "copy" ? "copying" : "converting"}`
814
+ `No ${o.pluralLowerCase} selected for ${u === "copy" ? "copying" : "converting"}`
770
815
  );
771
- a?.(i), u(!1);
816
+ r?.(i), d(!1);
772
817
  return;
773
818
  }
774
819
  try {
775
820
  const i = [];
776
- let t = 0;
777
- const l = d === "copy" ? D : V, L = d === "copy" ? "copy" : "convert";
778
- for (const W of R)
821
+ let a = 0;
822
+ const C = u === "copy" ? D : ae, l = u === "copy" ? "copy" : "convert";
823
+ for (const S of O)
779
824
  try {
780
- const K = await l(W);
781
- i.push(K);
782
- } catch (K) {
825
+ const W = await C(S);
826
+ i.push(W);
827
+ } catch (W) {
783
828
  console.error(
784
- `Failed to ${L} ${r.singularLowerCase} "${W.name}":`,
785
- K
786
- ), t++;
829
+ `Failed to ${l} ${o.singularLowerCase} "${S.name}":`,
830
+ W
831
+ ), a++;
787
832
  }
788
833
  if (i.length > 0) {
789
- const W = i.length, K = R.length, Q = d === "copy" ? "copied" : "converted", U = d === "copy" ? "copy" : "convert";
834
+ const S = i.length, W = O.length, G = u === "copy" ? "copied" : "converted", Q = u === "copy" ? "copy" : "convert";
790
835
  b({
791
- title: t > 0 ? `Partial ${U} completed` : `${r.plural} ${Q} successfully`,
792
- description: t > 0 ? `${W} of ${K} ${r.pluralLowerCase} ${Q} successfully` : `${W} ${W > 1 ? r.pluralLowerCase : r.singularLowerCase} ${Q} successfully`,
793
- status: t > 0 ? "warning" : "success",
836
+ title: a > 0 ? `Partial ${Q} completed` : `${o.plural} ${G} successfully`,
837
+ description: a > 0 ? `${S} of ${W} ${o.pluralLowerCase} ${G} successfully` : `${S} ${S > 1 ? o.pluralLowerCase : o.singularLowerCase} ${G} successfully`,
838
+ status: a > 0 ? "warning" : "success",
794
839
  duration: 3e3,
795
840
  isClosable: !0
796
- }), o?.(), v(""), I([]);
841
+ }), s?.(), w(""), L([]);
797
842
  } else
798
843
  throw new Error(
799
- `Failed to ${L} any ${r.pluralLowerCase}`
844
+ `Failed to ${l} any ${o.pluralLowerCase}`
800
845
  );
801
846
  } catch (i) {
802
- const t = d === "copy" ? "copy" : "convert", l = i instanceof Error ? i.message : `Failed to ${t} ${r.pluralLowerCase}`;
847
+ const a = u === "copy" ? "copy" : "convert", C = i instanceof Error ? i.message : `Failed to ${a} ${o.pluralLowerCase}`;
803
848
  b({
804
- title: `${d === "copy" ? "Copy" : "Convert"} failed`,
805
- description: l,
849
+ title: `${u === "copy" ? "Copy" : "Convert"} failed`,
850
+ description: C,
806
851
  status: "error",
807
852
  duration: 5e3,
808
853
  isClosable: !0
809
- }), a?.(i instanceof Error ? i : new Error(l));
854
+ }), r?.(i instanceof Error ? i : new Error(C));
810
855
  } finally {
811
- u(!1);
856
+ d(!1);
812
857
  }
813
858
  }, [
814
- R,
815
- d,
859
+ O,
860
+ u,
816
861
  D,
817
- V,
862
+ ae,
818
863
  b,
819
- o,
820
- a,
821
- r
822
- ]), N = F(() => {
823
- v(""), I([]), y("copy"), s?.();
824
- }, [s]);
864
+ s,
865
+ r,
866
+ o
867
+ ]), T = _(() => {
868
+ w(""), L([]), y("copy"), n?.();
869
+ }, [n]);
825
870
  ce(() => {
826
871
  m && m({
827
872
  cancelButton: !1,
828
- saveButton: R.length === 0 || x
873
+ saveButton: O.length === 0 || x
829
874
  });
830
- }, [R.length, x, m]), ce(() => {
875
+ }, [O.length, x, m]), ce(() => {
831
876
  h && h({
832
- cancelButton: N,
833
- saveButton: ee
877
+ cancelButton: T,
878
+ saveButton: Z
834
879
  });
835
- }, [h, N, ee]);
836
- const E = T(() => B.map((i) => ({
880
+ }, [h, T, Z]);
881
+ const B = N(() => E.map((i) => ({
837
882
  value: i.id,
838
883
  label: i.name
839
- })), [B]), Y = T(() => A.filter((i) => d === "copy" ? !0 : !i.quantumOwned).map((i) => ({
884
+ })), [E]), J = N(() => $.filter((i) => u === "copy" ? !0 : !i.quantumOwned).map((i) => ({
840
885
  value: i.id,
841
886
  label: i.name,
842
887
  // Add custom data to identify quantum-owned actions for UI display
843
888
  isQuantumOwned: i.quantumOwned
844
- })), [A, d]), _ = S.fetching, q = g.fetching;
845
- return /* @__PURE__ */ e.jsx(re, { children: /* @__PURE__ */ e.jsxs(ue, { spacing: 6, align: "stretch", children: [
846
- c && /* @__PURE__ */ e.jsxs(J, { children: [
889
+ })), [$, u]), U = k.fetching, H = g.fetching;
890
+ return /* @__PURE__ */ e.jsx(se, { children: /* @__PURE__ */ e.jsxs(ue, { spacing: 6, align: "stretch", children: [
891
+ c && /* @__PURE__ */ e.jsxs(X, { children: [
847
892
  /* @__PURE__ */ e.jsx(ge, { children: "Operation Mode" }),
848
893
  /* @__PURE__ */ e.jsx(
849
- wt,
894
+ It,
850
895
  {
851
- value: d,
896
+ value: u,
852
897
  onChange: (i) => {
853
- y(i), I([]);
898
+ y(i), L([]);
854
899
  },
855
- children: /* @__PURE__ */ e.jsxs(Z, { spacing: 6, children: [
856
- /* @__PURE__ */ e.jsx(Xe, { value: "copy", colorScheme: "blue", children: /* @__PURE__ */ e.jsxs(ue, { align: "start", spacing: 1, children: [
857
- /* @__PURE__ */ e.jsxs(k, { fontWeight: "medium", children: [
900
+ children: /* @__PURE__ */ e.jsxs(V, { spacing: 6, children: [
901
+ /* @__PURE__ */ e.jsx(Ze, { value: "copy", colorScheme: "blue", children: /* @__PURE__ */ e.jsxs(ue, { align: "start", spacing: 1, children: [
902
+ /* @__PURE__ */ e.jsxs(M, { fontWeight: "medium", children: [
858
903
  "Copy ",
859
- r.plural
904
+ o.plural
860
905
  ] }),
861
- /* @__PURE__ */ e.jsxs(k, { fontSize: "sm", color: "gray.600", children: [
906
+ /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", color: "gray.600", children: [
862
907
  "Create new ",
863
- r.plural.toLocaleLowerCase(),
908
+ o.plural.toLocaleLowerCase(),
864
909
  " ",
865
910
  "based on selected ones"
866
911
  ] })
867
912
  ] }) }),
868
- /* @__PURE__ */ e.jsx(Xe, { value: "convert", colorScheme: "green", children: /* @__PURE__ */ e.jsxs(ue, { align: "start", spacing: 1, children: [
869
- /* @__PURE__ */ e.jsxs(k, { fontWeight: "medium", children: [
913
+ /* @__PURE__ */ e.jsx(Ze, { value: "convert", colorScheme: "green", children: /* @__PURE__ */ e.jsxs(ue, { align: "start", spacing: 1, children: [
914
+ /* @__PURE__ */ e.jsxs(M, { fontWeight: "medium", children: [
870
915
  "Convert to Quantum Owned ",
871
- r.singular
916
+ o.singular
872
917
  ] }),
873
- /* @__PURE__ */ e.jsxs(k, { fontSize: "sm", color: "gray.600", children: [
918
+ /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", color: "gray.600", children: [
874
919
  "Convert existing",
875
920
  " ",
876
- r.plural.toLocaleLowerCase(),
921
+ o.plural.toLocaleLowerCase(),
877
922
  " to quantum-owned"
878
923
  ] })
879
924
  ] }) })
@@ -881,88 +926,88 @@ const Tn = ({
881
926
  }
882
927
  )
883
928
  ] }),
884
- /* @__PURE__ */ e.jsxs(J, { children: [
929
+ /* @__PURE__ */ e.jsxs(X, { children: [
885
930
  /* @__PURE__ */ e.jsx(ge, { children: "Select Source Group" }),
886
931
  /* @__PURE__ */ e.jsx(
887
932
  he,
888
933
  {
889
934
  placeholder: "Choose a group...",
890
- options: E,
891
- value: E.find((i) => i.value === j) || null,
892
- onChange: X,
893
- isLoading: _,
894
- isDisabled: _,
935
+ options: B,
936
+ value: B.find((i) => i.value === j) || null,
937
+ onChange: K,
938
+ isLoading: U,
939
+ isDisabled: U,
895
940
  isClearable: !0
896
941
  }
897
942
  ),
898
- S.error && /* @__PURE__ */ e.jsxs(Ze, { status: "error", mt: 2, children: [
899
- /* @__PURE__ */ e.jsx(Ve, {}),
900
- /* @__PURE__ */ e.jsxs(k, { fontSize: "sm", children: [
943
+ k.error && /* @__PURE__ */ e.jsxs(Ve, { status: "error", mt: 2, children: [
944
+ /* @__PURE__ */ e.jsx(et, {}),
945
+ /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", children: [
901
946
  "Failed to load groups: ",
902
- S.error.message
947
+ k.error.message
903
948
  ] })
904
949
  ] })
905
950
  ] }),
906
- j && /* @__PURE__ */ e.jsxs(J, { children: [
951
+ j && /* @__PURE__ */ e.jsxs(X, { children: [
907
952
  /* @__PURE__ */ e.jsxs(ge, { children: [
908
953
  "Select ",
909
- r.plural,
954
+ o.plural,
910
955
  " to",
911
956
  " ",
912
- d === "copy" ? "Copy" : "Convert"
957
+ u === "copy" ? "Copy" : "Convert"
913
958
  ] }),
914
- q ? /* @__PURE__ */ e.jsxs(Z, { children: [
915
- /* @__PURE__ */ e.jsx(It, { size: "sm" }),
916
- /* @__PURE__ */ e.jsxs(k, { fontSize: "sm", color: "gray.600", children: [
959
+ H ? /* @__PURE__ */ e.jsxs(V, { children: [
960
+ /* @__PURE__ */ e.jsx(St, { size: "sm" }),
961
+ /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", color: "gray.600", children: [
917
962
  "Loading ",
918
- r.pluralLowerCase,
963
+ o.pluralLowerCase,
919
964
  "..."
920
965
  ] })
921
966
  ] }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
922
967
  /* @__PURE__ */ e.jsx(
923
968
  he,
924
969
  {
925
- placeholder: `Choose ${r.pluralLowerCase} to ${d}...`,
926
- options: Y,
927
- value: Y.filter(
928
- (i) => C.includes(i.value)
970
+ placeholder: `Choose ${o.pluralLowerCase} to ${u}...`,
971
+ options: J,
972
+ value: J.filter(
973
+ (i) => I.includes(i.value)
929
974
  ),
930
- onChange: se,
931
- isDisabled: Y.length === 0,
975
+ onChange: oe,
976
+ isDisabled: J.length === 0,
932
977
  isClearable: !0,
933
978
  isMulti: !0,
934
979
  closeMenuOnSelect: !1,
935
- formatOptionLabel: (i, { context: t }) => /* @__PURE__ */ e.jsxs(Z, { justify: "space-between", w: "100%", children: [
980
+ formatOptionLabel: (i, { context: a }) => /* @__PURE__ */ e.jsxs(V, { justify: "space-between", w: "100%", children: [
936
981
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
937
- /* @__PURE__ */ e.jsx(k, { children: i.label }),
938
- t === "value" && i.isQuantumOwned && /* @__PURE__ */ e.jsx(k, { color: "blue", fontSize: "xs", children: "(Quantum Owned)" })
982
+ /* @__PURE__ */ e.jsx(M, { children: i.label }),
983
+ a === "value" && i.isQuantumOwned && /* @__PURE__ */ e.jsx(M, { color: "blue", fontSize: "xs", children: "(Quantum Owned)" })
939
984
  ] }),
940
- i.isQuantumOwned && t === "menu" && /* @__PURE__ */ e.jsx($e, { size: "sm", colorScheme: "blue", variant: "solid", children: "Quantum Owned" })
985
+ i.isQuantumOwned && a === "menu" && /* @__PURE__ */ e.jsx(Ge, { size: "sm", colorScheme: "blue", variant: "solid", children: "Quantum Owned" })
941
986
  ] })
942
987
  }
943
988
  ),
944
- Y.length === 0 && /* @__PURE__ */ e.jsxs(k, { fontSize: "sm", color: "gray.500", mt: 2, children: [
989
+ J.length === 0 && /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", color: "gray.500", mt: 2, children: [
945
990
  "No ",
946
- r.pluralLowerCase,
991
+ o.pluralLowerCase,
947
992
  " found"
948
993
  ] })
949
994
  ] }),
950
- g.error && /* @__PURE__ */ e.jsxs(Ze, { status: "error", mt: 2, children: [
951
- /* @__PURE__ */ e.jsx(Ve, {}),
952
- /* @__PURE__ */ e.jsxs(k, { fontSize: "sm", children: [
995
+ g.error && /* @__PURE__ */ e.jsxs(Ve, { status: "error", mt: 2, children: [
996
+ /* @__PURE__ */ e.jsx(et, {}),
997
+ /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", children: [
953
998
  "Failed to load ",
954
- r.pluralLowerCase,
999
+ o.pluralLowerCase,
955
1000
  ":",
956
1001
  " ",
957
1002
  g.error.message
958
1003
  ] })
959
1004
  ] })
960
1005
  ] }),
961
- R.length > 0 && /* @__PURE__ */ e.jsxs(re, { p: 4, bg: "gray.50", borderRadius: "md", children: [
962
- /* @__PURE__ */ e.jsx(k, { fontWeight: "semibold", mb: 3, children: R.length === 1 ? `${r.singular} to ${d === "copy" ? "Copy" : "Convert"}:` : `${R.length} ${r.plural} to ${d === "copy" ? "Copy" : "Convert"}:` }),
1006
+ O.length > 0 && /* @__PURE__ */ e.jsxs(se, { p: 4, bg: "gray.50", borderRadius: "md", children: [
1007
+ /* @__PURE__ */ e.jsx(M, { fontWeight: "semibold", mb: 3, children: O.length === 1 ? `${o.singular} to ${u === "copy" ? "Copy" : "Convert"}:` : `${O.length} ${o.plural} to ${u === "copy" ? "Copy" : "Convert"}:` }),
963
1008
  /* @__PURE__ */ e.jsxs(ue, { align: "start", spacing: 3, children: [
964
- R.map((i, t) => /* @__PURE__ */ e.jsxs(
965
- re,
1009
+ O.map((i, a) => /* @__PURE__ */ e.jsxs(
1010
+ se,
966
1011
  {
967
1012
  w: "100%",
968
1013
  p: 3,
@@ -971,13 +1016,13 @@ const Tn = ({
971
1016
  border: "1px solid",
972
1017
  borderColor: "gray.200",
973
1018
  children: [
974
- /* @__PURE__ */ e.jsxs(Z, { justify: "space-between", align: "start", mb: 2, children: [
975
- /* @__PURE__ */ e.jsxs(k, { fontWeight: "medium", fontSize: "sm", children: [
976
- t + 1,
1019
+ /* @__PURE__ */ e.jsxs(V, { justify: "space-between", align: "start", mb: 2, children: [
1020
+ /* @__PURE__ */ e.jsxs(M, { fontWeight: "medium", fontSize: "sm", children: [
1021
+ a + 1,
977
1022
  ". ",
978
1023
  i.name
979
1024
  ] }),
980
- i.quantumOwned && /* @__PURE__ */ e.jsx($e, { size: "sm", colorScheme: "blue", variant: "solid", children: "Quantum Owned" })
1025
+ i.quantumOwned && /* @__PURE__ */ e.jsx(Ge, { size: "sm", colorScheme: "blue", variant: "solid", children: "Quantum Owned" })
981
1026
  ] }),
982
1027
  /* @__PURE__ */ e.jsxs(
983
1028
  ue,
@@ -987,35 +1032,35 @@ const Tn = ({
987
1032
  fontSize: "sm",
988
1033
  color: "gray.600",
989
1034
  children: [
990
- i.description && /* @__PURE__ */ e.jsxs(k, { children: [
1035
+ i.description && /* @__PURE__ */ e.jsxs(M, { children: [
991
1036
  /* @__PURE__ */ e.jsx("strong", { children: "Description:" }),
992
1037
  " ",
993
1038
  i.description
994
1039
  ] }),
995
- /* @__PURE__ */ e.jsxs(k, { children: [
1040
+ /* @__PURE__ */ e.jsxs(M, { children: [
996
1041
  /* @__PURE__ */ e.jsx("strong", { children: "Type:" }),
997
1042
  " ",
998
1043
  i.activityKind
999
1044
  ] }),
1000
- /* @__PURE__ */ e.jsxs(k, { children: [
1045
+ /* @__PURE__ */ e.jsxs(M, { children: [
1001
1046
  /* @__PURE__ */ e.jsx("strong", { children: "Laterality:" }),
1002
1047
  " ",
1003
1048
  i.laterality
1004
1049
  ] }),
1005
- /* @__PURE__ */ e.jsxs(k, { children: [
1050
+ /* @__PURE__ */ e.jsxs(M, { children: [
1006
1051
  /* @__PURE__ */ e.jsx("strong", { children: "Sensor Locations:" }),
1007
1052
  " ",
1008
1053
  i.sensorLocations.length
1009
1054
  ] }),
1010
- /* @__PURE__ */ e.jsxs(k, { children: [
1055
+ /* @__PURE__ */ e.jsxs(M, { children: [
1011
1056
  /* @__PURE__ */ e.jsx("strong", { children: "Thresholds:" }),
1012
1057
  " ",
1013
1058
  i.thresholds.length
1014
1059
  ] }),
1015
- /* @__PURE__ */ e.jsxs(k, { children: [
1060
+ /* @__PURE__ */ e.jsxs(M, { children: [
1016
1061
  /* @__PURE__ */ e.jsx("strong", { children: "Use Cases:" }),
1017
1062
  " ",
1018
- i.useCases.map((l) => l.name).join(", ") || "None"
1063
+ i.useCases.map((C) => C.name).join(", ") || "None"
1019
1064
  ] })
1020
1065
  ]
1021
1066
  }
@@ -1024,8 +1069,8 @@ const Tn = ({
1024
1069
  },
1025
1070
  i.id
1026
1071
  )),
1027
- R.length > 1 && /* @__PURE__ */ e.jsx(
1028
- re,
1072
+ O.length > 1 && /* @__PURE__ */ e.jsx(
1073
+ se,
1029
1074
  {
1030
1075
  w: "100%",
1031
1076
  p: 2,
@@ -1033,320 +1078,320 @@ const Tn = ({
1033
1078
  borderRadius: "md",
1034
1079
  border: "1px solid",
1035
1080
  borderColor: "blue.200",
1036
- children: /* @__PURE__ */ e.jsxs(k, { fontSize: "sm", fontWeight: "medium", color: "blue.800", children: [
1081
+ children: /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", fontWeight: "medium", color: "blue.800", children: [
1037
1082
  "Total: ",
1038
- R.length,
1083
+ O.length,
1039
1084
  " ",
1040
- r.pluralLowerCase,
1085
+ o.pluralLowerCase,
1041
1086
  " will be",
1042
1087
  " ",
1043
- d === "copy" ? "copied" : "converted"
1088
+ u === "copy" ? "copied" : "converted"
1044
1089
  ] })
1045
1090
  }
1046
1091
  )
1047
1092
  ] })
1048
1093
  ] }),
1049
- !p && /* @__PURE__ */ e.jsxs(Ae, { spacing: 4, justifyContent: "flex-end", children: [
1094
+ !p && /* @__PURE__ */ e.jsxs(Ne, { spacing: 4, justifyContent: "flex-end", children: [
1050
1095
  /* @__PURE__ */ e.jsx(
1051
- ne,
1096
+ te,
1052
1097
  {
1053
1098
  variant: "outline",
1054
- onClick: N,
1099
+ onClick: T,
1055
1100
  isDisabled: x,
1056
1101
  children: "Cancel"
1057
1102
  }
1058
1103
  ),
1059
1104
  /* @__PURE__ */ e.jsxs(
1060
- ne,
1105
+ te,
1061
1106
  {
1062
- colorScheme: d === "copy" ? "blue" : "green",
1063
- onClick: ee,
1064
- isDisabled: R.length === 0 || x,
1107
+ colorScheme: u === "copy" ? "blue" : "green",
1108
+ onClick: Z,
1109
+ isDisabled: O.length === 0 || x,
1065
1110
  isLoading: x,
1066
- loadingText: `${d === "copy" ? "Copying" : "Converting"}...`,
1111
+ loadingText: `${u === "copy" ? "Copying" : "Converting"}...`,
1067
1112
  children: [
1068
- d === "copy" ? "Copy" : "Convert",
1113
+ u === "copy" ? "Copy" : "Convert",
1069
1114
  " ",
1070
- R.length === 1 ? r.singular : `${R.length} ${r.plural}`
1115
+ O.length === 1 ? o.singular : `${O.length} ${o.plural}`
1071
1116
  ]
1072
1117
  }
1073
1118
  )
1074
1119
  ] })
1075
1120
  ] }) });
1076
- }, js = ({
1077
- onSave: o,
1078
- onCancel: s,
1079
- onError: a,
1121
+ }, ys = ({
1122
+ onSave: s,
1123
+ onCancel: n,
1124
+ onError: r,
1080
1125
  hideButtons: p = !1,
1081
1126
  setButtonDisabled: m,
1082
1127
  setButtonOnClick: h,
1083
1128
  quantumOwned: c
1084
1129
  }) => {
1085
- const b = Ct(), { getLabel: n } = xe(), r = T(() => ({
1086
- singular: n("module"),
1087
- plural: n("module_plural"),
1088
- pluralLowerCase: n("module_plural").toLowerCase(),
1089
- singularLowerCase: n("module").toLowerCase()
1090
- }), [n]), d = T(() => ({
1091
- singular: n("action"),
1092
- plural: n("action_plural"),
1093
- pluralLowerCase: n("action_plural").toLowerCase(),
1094
- singularLowerCase: n("action").toLowerCase()
1095
- }), [n]), [y, j] = z(""), [v, C] = z([]), [I, x] = z(!1), [u, S] = z("copy"), [g] = we({
1096
- query: St
1097
- }), [w] = we({
1130
+ const b = wt(), { getLabel: t } = xe(), o = N(() => ({
1131
+ singular: t("module"),
1132
+ plural: t("module_plural"),
1133
+ pluralLowerCase: t("module_plural").toLowerCase(),
1134
+ singularLowerCase: t("module").toLowerCase()
1135
+ }), [t]), u = N(() => ({
1136
+ singular: t("action"),
1137
+ plural: t("action_plural"),
1138
+ pluralLowerCase: t("action_plural").toLowerCase(),
1139
+ singularLowerCase: t("action").toLowerCase()
1140
+ }), [t]), [y, j] = q(""), [w, I] = q([]), [L, x] = q(!1), [d, k] = q("copy"), [g] = Ce({
1141
+ query: Lt
1142
+ }), [R] = Ce({
1098
1143
  query: dn,
1099
1144
  variables: { groupId: y },
1100
1145
  pause: !y
1101
1146
  // Only run when group is selected
1102
- }), [, O] = fe(Mt), [, B] = fe(Ot), [, A] = fe(rt), [, R] = fe(
1103
- Lt
1104
- ), X = T(() => g.data?.groups ? g.data.groups.map(
1105
- (t) => M(kt, t)
1106
- ) : [], [g.data]), se = T(() => w.data?.modules ? M(
1147
+ }), [, v] = fe(At), [, E] = fe(Ot), [, $] = fe(it), [, O] = fe(
1148
+ kt
1149
+ ), K = N(() => g.data?.groups ? g.data.groups.map(
1150
+ (a) => A(Mt, a)
1151
+ ) : [], [g.data]), oe = N(() => R.data?.modules ? A(
1107
1152
  Ye,
1108
- w.data?.modules
1109
- ).map((l) => {
1110
- const L = M(
1111
- At,
1112
- l.moduleActions
1113
- ), K = M(
1153
+ R.data?.modules
1154
+ ).map((C) => {
1155
+ const l = A(
1156
+ Tt,
1157
+ C.moduleActions
1158
+ ), W = A(
1114
1159
  je,
1115
- l.metadataGroups
1116
- ).map((Q) => M(be, Q.data)).flat();
1160
+ C.metadataGroups
1161
+ ).map((G) => A(be, G.data)).flat();
1117
1162
  return {
1118
- ...l,
1119
- moduleActions: L.map((Q) => ({
1120
- ...Q,
1121
- action: M(Ce, Q.action)
1163
+ ...C,
1164
+ moduleActions: l.map((G) => ({
1165
+ ...G,
1166
+ action: A(ve, G.action)
1122
1167
  })),
1123
- categories: M(
1124
- Fe,
1125
- l.categories
1168
+ categories: A(
1169
+ Pe,
1170
+ C.categories
1126
1171
  ),
1127
- metadataItems: K
1172
+ metadataItems: W
1128
1173
  };
1129
- }) : [], [w.data]), D = T(() => se.filter(
1130
- (t) => v.includes(t.id)
1131
- ), [se, v]), V = F(
1132
- (t) => {
1133
- const l = t?.value || "";
1134
- j(l), C([]);
1174
+ }) : [], [R.data]), D = N(() => oe.filter(
1175
+ (a) => w.includes(a.id)
1176
+ ), [oe, w]), ae = _(
1177
+ (a) => {
1178
+ const C = a?.value || "";
1179
+ j(C), I([]);
1135
1180
  },
1136
1181
  []
1137
- ), ee = F(
1138
- (t) => {
1139
- const l = t.map((L) => L.value);
1140
- C(l);
1182
+ ), Z = _(
1183
+ (a) => {
1184
+ const C = a.map((l) => l.value);
1185
+ I(C);
1141
1186
  },
1142
1187
  []
1143
- ), N = F(async () => {
1188
+ ), T = _(async () => {
1144
1189
  if (x(!0), !D.length) {
1145
1190
  x(!1);
1146
- const t = new Error(
1147
- `No modules selected for ${u === "convert" ? "converting" : "copying"}`
1191
+ const a = new Error(
1192
+ `No modules selected for ${d === "convert" ? "converting" : "copying"}`
1148
1193
  );
1149
- a?.(t);
1194
+ r?.(a);
1150
1195
  return;
1151
1196
  }
1152
1197
  try {
1153
- const t = [];
1154
- let l = 0;
1155
- for (const L of D)
1198
+ const a = [];
1199
+ let C = 0;
1200
+ for (const l of D)
1156
1201
  try {
1157
- let W = L.moduleActions.map((K) => K.actionId);
1202
+ let S = l.moduleActions.map((W) => W.actionId);
1158
1203
  if (c) {
1159
- const K = L.moduleActions.map((H) => H.action), Q = async (H) => {
1160
- if (u === "copy") {
1161
- if (H.quantumOwned) return H;
1162
- const ye = M(
1163
- Fe,
1164
- H.categories
1165
- ), Te = M(
1204
+ const W = l.moduleActions.map((Y) => Y.action), G = async (Y) => {
1205
+ if (d === "copy") {
1206
+ if (Y.quantumOwned) return Y;
1207
+ const we = A(
1208
+ Pe,
1209
+ Y.categories
1210
+ ), Se = A(
1166
1211
  je,
1167
- H.metadataGroups
1168
- ).map((pe) => M(
1212
+ Y.metadataGroups
1213
+ ).map((pe) => A(
1169
1214
  be,
1170
1215
  pe.data
1171
- ).map((Re) => Re.id)).flat(), ze = M(
1172
- Ge,
1173
- H.reports
1216
+ ).map(($e) => $e.id)).flat(), Be = A(
1217
+ Fe,
1218
+ Y.reports
1174
1219
  ).map((pe) => ({
1175
1220
  ...pe,
1176
1221
  id: void 0,
1177
- thresholds: M(
1178
- Oe,
1222
+ thresholds: A(
1223
+ Te,
1179
1224
  pe.thresholds
1180
- ).map((Re) => ({
1181
- ...Re,
1225
+ ).map(($e) => ({
1226
+ ...$e,
1182
1227
  id: void 0
1183
1228
  }))
1184
- })), et = M(
1185
- Oe,
1186
- H.thresholds
1229
+ })), tt = A(
1230
+ Te,
1231
+ Y.thresholds
1187
1232
  ).map((pe) => ({
1188
1233
  ...pe,
1189
1234
  id: void 0
1190
- })), Ne = {
1191
- ...H,
1235
+ })), Re = {
1236
+ ...Y,
1192
1237
  quantumOwned: !0,
1193
- thresholds: et,
1194
- categories: ye?.map((pe) => pe.id),
1195
- reports: ze,
1196
- metadataIds: Te,
1238
+ thresholds: tt,
1239
+ categories: we?.map((pe) => pe.id),
1240
+ reports: Be,
1241
+ metadataIds: Se,
1197
1242
  id: void 0
1198
- }, Ie = await A({ fields: Ne });
1199
- return Ie.error || !Ie.data?.createAction ? null : M(
1200
- Ce,
1201
- Ie.data.createAction
1243
+ }, Le = await $({ fields: Re });
1244
+ return Le.error || !Le.data?.createAction ? null : A(
1245
+ ve,
1246
+ Le.data.createAction
1202
1247
  );
1203
1248
  }
1204
- if (H.quantumOwned) return H;
1205
- const ie = await R({
1206
- id: H.id
1249
+ if (Y.quantumOwned) return Y;
1250
+ const re = await O({
1251
+ id: Y.id
1207
1252
  });
1208
- return ie.error || !ie.data?.convertActionToQuantumOwned ? null : M(
1209
- Ce,
1210
- ie.data.convertActionToQuantumOwned
1253
+ return re.error || !re.data?.convertActionToQuantumOwned ? null : A(
1254
+ ve,
1255
+ re.data.convertActionToQuantumOwned
1211
1256
  );
1212
1257
  };
1213
- W = (await Promise.all(
1214
- K.map(Q)
1215
- )).filter((H) => !!H?.id).map((H) => H.id);
1258
+ S = (await Promise.all(
1259
+ W.map(G)
1260
+ )).filter((Y) => !!Y?.id).map((Y) => Y.id);
1216
1261
  }
1217
- if (u === "convert") {
1218
- const K = {
1219
- name: L.name,
1220
- description: L.description || void 0,
1221
- actions: W,
1222
- categories: L.categories.map((U) => U.id),
1262
+ if (d === "convert") {
1263
+ const W = {
1264
+ name: l.name,
1265
+ description: l.description || void 0,
1266
+ actions: S,
1267
+ categories: l.categories.map((Q) => Q.id),
1223
1268
  quantumOwned: !0
1224
- }, Q = await B({
1225
- id: L.id,
1226
- input: K
1269
+ }, G = await E({
1270
+ id: l.id,
1271
+ input: W
1227
1272
  });
1228
- if (Q.error) throw new Error(Q.error.message);
1229
- if (Q.data?.updateModule) {
1230
- const U = M(
1273
+ if (G.error) throw new Error(G.error.message);
1274
+ if (G.data?.updateModule) {
1275
+ const Q = A(
1231
1276
  Ye,
1232
- Q.data.updateModule
1277
+ G.data.updateModule
1233
1278
  );
1234
- t.push(U);
1279
+ a.push(Q);
1235
1280
  }
1236
1281
  } else {
1237
- const K = {
1238
- name: `${L.name} (Copy)`,
1239
- description: L.description || void 0,
1240
- moduleActions: L.moduleActions.map((U) => ({
1241
- actionId: U.actionId,
1242
- reportId: U.reportId ?? void 0
1282
+ const W = {
1283
+ name: `${l.name} (Copy)`,
1284
+ description: l.description || void 0,
1285
+ moduleActions: l.moduleActions.map((Q) => ({
1286
+ actionId: Q.actionId,
1287
+ reportId: Q.reportId ?? void 0
1243
1288
  })),
1244
- categories: L.categories.map((U) => U.id),
1289
+ categories: l.categories.map((Q) => Q.id),
1245
1290
  quantumOwned: c,
1246
- metadataItemIds: L.metadataItems.map((U) => U.id)
1247
- }, Q = await O({ input: K });
1248
- if (Q.error) throw new Error(Q.error.message);
1249
- if (Q.data?.createModule) {
1250
- const U = M(
1291
+ metadataItemIds: l.metadataItems.map((Q) => Q.id)
1292
+ }, G = await v({ input: W });
1293
+ if (G.error) throw new Error(G.error.message);
1294
+ if (G.data?.createModule) {
1295
+ const Q = A(
1251
1296
  Ye,
1252
- Q.data.createModule
1297
+ G.data.createModule
1253
1298
  );
1254
- t.push(U);
1299
+ a.push(Q);
1255
1300
  }
1256
1301
  }
1257
- } catch (W) {
1302
+ } catch (S) {
1258
1303
  console.error(
1259
- `Failed to ${u === "convert" ? "convert" : "copy"} module "${L.name}":`,
1260
- W
1261
- ), l++;
1304
+ `Failed to ${d === "convert" ? "convert" : "copy"} module "${l.name}":`,
1305
+ S
1306
+ ), C++;
1262
1307
  }
1263
- if (t.length > 0) {
1264
- const L = t.length, W = D.length;
1308
+ if (a.length > 0) {
1309
+ const l = a.length, S = D.length;
1265
1310
  b({
1266
- title: l > 0 ? `Partial ${u === "convert" ? "convert" : "copy"} completed` : `${r.plural} ${u === "convert" ? "converted" : "copied"} successfully`,
1267
- description: l > 0 ? `${L} of ${W} ${r.plural} ${u === "convert" ? "converted" : "copied"} successfully` : `${L} ${L > 1 ? r.plural : r.singular} ${u === "convert" ? "converted" : "copied"} successfully`,
1268
- status: l > 0 ? "warning" : "success",
1311
+ title: C > 0 ? `Partial ${d === "convert" ? "convert" : "copy"} completed` : `${o.plural} ${d === "convert" ? "converted" : "copied"} successfully`,
1312
+ description: C > 0 ? `${l} of ${S} ${o.plural} ${d === "convert" ? "converted" : "copied"} successfully` : `${l} ${l > 1 ? o.plural : o.singular} ${d === "convert" ? "converted" : "copied"} successfully`,
1313
+ status: C > 0 ? "warning" : "success",
1269
1314
  duration: 3e3,
1270
1315
  isClosable: !0
1271
- }), t.length > 0 && o?.(), j(""), C([]);
1316
+ }), a.length > 0 && s?.(), j(""), I([]);
1272
1317
  } else
1273
1318
  throw new Error(
1274
- `Failed to ${u === "convert" ? "convert" : "copy"} any modules`
1319
+ `Failed to ${d === "convert" ? "convert" : "copy"} any modules`
1275
1320
  );
1276
- } catch (t) {
1277
- const l = t instanceof Error ? t.message : `Failed to ${u === "convert" ? "convert" : "copy"} modules`;
1321
+ } catch (a) {
1322
+ const C = a instanceof Error ? a.message : `Failed to ${d === "convert" ? "convert" : "copy"} modules`;
1278
1323
  b({
1279
- title: u === "convert" ? "Convert failed" : "Copy failed",
1280
- description: l,
1324
+ title: d === "convert" ? "Convert failed" : "Copy failed",
1325
+ description: C,
1281
1326
  status: "error",
1282
1327
  duration: 5e3,
1283
1328
  isClosable: !0
1284
- }), a?.(t instanceof Error ? t : new Error(l));
1329
+ }), r?.(a instanceof Error ? a : new Error(C));
1285
1330
  } finally {
1286
1331
  x(!1);
1287
1332
  }
1288
1333
  }, [
1289
1334
  D,
1290
- O,
1291
- B,
1335
+ v,
1336
+ E,
1292
1337
  b,
1293
- o,
1294
- a,
1338
+ s,
1339
+ r,
1295
1340
  c,
1296
- A,
1297
- R,
1298
- u,
1299
- r
1300
- ]), E = F(() => {
1301
- j(""), C([]), S("copy"), s?.();
1302
- }, [s]);
1341
+ $,
1342
+ O,
1343
+ d,
1344
+ o
1345
+ ]), B = _(() => {
1346
+ j(""), I([]), k("copy"), n?.();
1347
+ }, [n]);
1303
1348
  ce(() => {
1304
1349
  m && m({
1305
1350
  cancelButton: !1,
1306
- saveButton: D.length === 0 || I
1351
+ saveButton: D.length === 0 || L
1307
1352
  });
1308
- }, [D.length, I, m]), ce(() => {
1353
+ }, [D.length, L, m]), ce(() => {
1309
1354
  h && h({
1310
- cancelButton: E,
1311
- saveButton: N
1355
+ cancelButton: B,
1356
+ saveButton: T
1312
1357
  });
1313
- }, [h, E, N]);
1314
- const Y = T(() => X.map((t) => ({
1315
- value: t.id,
1316
- label: t.name
1317
- })), [X]), _ = T(() => se.filter((t) => u === "copy" ? !0 : !t.quantumOwned).map((t) => ({
1318
- value: t.id,
1319
- label: t.name,
1358
+ }, [h, B, T]);
1359
+ const J = N(() => K.map((a) => ({
1360
+ value: a.id,
1361
+ label: a.name
1362
+ })), [K]), U = N(() => oe.filter((a) => d === "copy" ? !0 : !a.quantumOwned).map((a) => ({
1363
+ value: a.id,
1364
+ label: a.name,
1320
1365
  // Add custom data to identify quantum-owned modules
1321
- isQuantumOwned: t.quantumOwned
1322
- })), [se, u]), q = g.fetching, i = w.fetching;
1323
- return /* @__PURE__ */ e.jsx(re, { children: /* @__PURE__ */ e.jsxs(ue, { spacing: 6, align: "stretch", children: [
1324
- c && /* @__PURE__ */ e.jsxs(J, { children: [
1366
+ isQuantumOwned: a.quantumOwned
1367
+ })), [oe, d]), H = g.fetching, i = R.fetching;
1368
+ return /* @__PURE__ */ e.jsx(se, { children: /* @__PURE__ */ e.jsxs(ue, { spacing: 6, align: "stretch", children: [
1369
+ c && /* @__PURE__ */ e.jsxs(X, { children: [
1325
1370
  /* @__PURE__ */ e.jsx(ge, { children: "Operation Mode" }),
1326
1371
  /* @__PURE__ */ e.jsx(
1327
- wt,
1372
+ It,
1328
1373
  {
1329
- value: u,
1330
- onChange: (t) => {
1331
- S(t), C([]);
1374
+ value: d,
1375
+ onChange: (a) => {
1376
+ k(a), I([]);
1332
1377
  },
1333
- children: /* @__PURE__ */ e.jsxs(Z, { spacing: 6, children: [
1334
- /* @__PURE__ */ e.jsx(Xe, { value: "copy", colorScheme: "blue", children: /* @__PURE__ */ e.jsxs(ue, { align: "start", spacing: 1, children: [
1335
- /* @__PURE__ */ e.jsxs(k, { fontWeight: "medium", children: [
1378
+ children: /* @__PURE__ */ e.jsxs(V, { spacing: 6, children: [
1379
+ /* @__PURE__ */ e.jsx(Ze, { value: "copy", colorScheme: "blue", children: /* @__PURE__ */ e.jsxs(ue, { align: "start", spacing: 1, children: [
1380
+ /* @__PURE__ */ e.jsxs(M, { fontWeight: "medium", children: [
1336
1381
  "Copy ",
1337
- r.plural
1382
+ o.plural
1338
1383
  ] }),
1339
- /* @__PURE__ */ e.jsxs(k, { fontSize: "sm", color: "gray.600", children: [
1384
+ /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", color: "gray.600", children: [
1340
1385
  "Create new ",
1341
- r.pluralLowerCase,
1386
+ o.pluralLowerCase,
1342
1387
  " based on selected ones"
1343
1388
  ] })
1344
1389
  ] }) }),
1345
- /* @__PURE__ */ e.jsx(Xe, { value: "convert", colorScheme: "green", children: /* @__PURE__ */ e.jsxs(ue, { align: "start", spacing: 1, children: [
1346
- /* @__PURE__ */ e.jsx(k, { fontWeight: "medium", children: "Convert to Quantum Owned" }),
1347
- /* @__PURE__ */ e.jsxs(k, { fontSize: "sm", color: "gray.600", children: [
1390
+ /* @__PURE__ */ e.jsx(Ze, { value: "convert", colorScheme: "green", children: /* @__PURE__ */ e.jsxs(ue, { align: "start", spacing: 1, children: [
1391
+ /* @__PURE__ */ e.jsx(M, { fontWeight: "medium", children: "Convert to Quantum Owned" }),
1392
+ /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", color: "gray.600", children: [
1348
1393
  "Convert existing ",
1349
- r.pluralLowerCase,
1394
+ o.pluralLowerCase,
1350
1395
  " to quantum-owned"
1351
1396
  ] })
1352
1397
  ] }) })
@@ -1354,82 +1399,82 @@ const Tn = ({
1354
1399
  }
1355
1400
  )
1356
1401
  ] }),
1357
- /* @__PURE__ */ e.jsxs(J, { children: [
1402
+ /* @__PURE__ */ e.jsxs(X, { children: [
1358
1403
  /* @__PURE__ */ e.jsx(ge, { children: "Select Source Group" }),
1359
1404
  /* @__PURE__ */ e.jsx(
1360
1405
  he,
1361
1406
  {
1362
1407
  placeholder: "Choose a group...",
1363
- options: Y,
1364
- value: Y.find((t) => t.value === y) || null,
1365
- onChange: V,
1366
- isLoading: q,
1367
- isDisabled: q,
1408
+ options: J,
1409
+ value: J.find((a) => a.value === y) || null,
1410
+ onChange: ae,
1411
+ isLoading: H,
1412
+ isDisabled: H,
1368
1413
  isClearable: !0
1369
1414
  }
1370
1415
  ),
1371
- g.error && /* @__PURE__ */ e.jsxs(Ze, { status: "error", mt: 2, children: [
1372
- /* @__PURE__ */ e.jsx(Ve, {}),
1373
- /* @__PURE__ */ e.jsxs(k, { fontSize: "sm", children: [
1416
+ g.error && /* @__PURE__ */ e.jsxs(Ve, { status: "error", mt: 2, children: [
1417
+ /* @__PURE__ */ e.jsx(et, {}),
1418
+ /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", children: [
1374
1419
  "Failed to load groups: ",
1375
1420
  g.error.message
1376
1421
  ] })
1377
1422
  ] })
1378
1423
  ] }),
1379
- y && /* @__PURE__ */ e.jsxs(J, { children: [
1380
- /* @__PURE__ */ e.jsx(ge, { children: u === "convert" ? `Select ${r.plural} to Convert` : `Select ${r.plural} to Copy` }),
1381
- i ? /* @__PURE__ */ e.jsxs(Z, { children: [
1382
- /* @__PURE__ */ e.jsx(It, { size: "sm" }),
1383
- /* @__PURE__ */ e.jsxs(k, { fontSize: "sm", color: "gray.600", children: [
1424
+ y && /* @__PURE__ */ e.jsxs(X, { children: [
1425
+ /* @__PURE__ */ e.jsx(ge, { children: d === "convert" ? `Select ${o.plural} to Convert` : `Select ${o.plural} to Copy` }),
1426
+ i ? /* @__PURE__ */ e.jsxs(V, { children: [
1427
+ /* @__PURE__ */ e.jsx(St, { size: "sm" }),
1428
+ /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", color: "gray.600", children: [
1384
1429
  "Loading ",
1385
- r.pluralLowerCase,
1430
+ o.pluralLowerCase,
1386
1431
  "..."
1387
1432
  ] })
1388
1433
  ] }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1389
1434
  /* @__PURE__ */ e.jsx(
1390
1435
  he,
1391
1436
  {
1392
- placeholder: u === "convert" ? `Choose ${r.pluralLowerCase} to convert...` : `Choose ${r.pluralLowerCase} to copy...`,
1393
- options: _,
1394
- value: _.filter(
1395
- (t) => v.includes(t.value)
1437
+ placeholder: d === "convert" ? `Choose ${o.pluralLowerCase} to convert...` : `Choose ${o.pluralLowerCase} to copy...`,
1438
+ options: U,
1439
+ value: U.filter(
1440
+ (a) => w.includes(a.value)
1396
1441
  ),
1397
- onChange: ee,
1398
- isDisabled: _.length === 0,
1442
+ onChange: Z,
1443
+ isDisabled: U.length === 0,
1399
1444
  isClearable: !0,
1400
1445
  isMulti: !0,
1401
1446
  closeMenuOnSelect: !1,
1402
- formatOptionLabel: (t, { context: l }) => /* @__PURE__ */ e.jsxs(Z, { justify: "space-between", w: "100%", children: [
1447
+ formatOptionLabel: (a, { context: C }) => /* @__PURE__ */ e.jsxs(V, { justify: "space-between", w: "100%", children: [
1403
1448
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
1404
- /* @__PURE__ */ e.jsx(k, { children: t.label }),
1405
- l === "value" && t.isQuantumOwned && /* @__PURE__ */ e.jsx(k, { color: "blue", fontSize: "xs", children: "(Quantum Owned)" })
1449
+ /* @__PURE__ */ e.jsx(M, { children: a.label }),
1450
+ C === "value" && a.isQuantumOwned && /* @__PURE__ */ e.jsx(M, { color: "blue", fontSize: "xs", children: "(Quantum Owned)" })
1406
1451
  ] }),
1407
- t.isQuantumOwned && l === "menu" && /* @__PURE__ */ e.jsx($e, { size: "sm", colorScheme: "blue", variant: "solid", children: "Quantum Owned" })
1452
+ a.isQuantumOwned && C === "menu" && /* @__PURE__ */ e.jsx(Ge, { size: "sm", colorScheme: "blue", variant: "solid", children: "Quantum Owned" })
1408
1453
  ] })
1409
1454
  }
1410
1455
  ),
1411
- _.length === 0 && /* @__PURE__ */ e.jsxs(k, { fontSize: "sm", color: "gray.500", mt: 2, children: [
1456
+ U.length === 0 && /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", color: "gray.500", mt: 2, children: [
1412
1457
  "No ",
1413
- r.pluralLowerCase,
1458
+ o.pluralLowerCase,
1414
1459
  " found in this group"
1415
1460
  ] })
1416
1461
  ] }),
1417
- w.error && /* @__PURE__ */ e.jsxs(Ze, { status: "error", mt: 2, children: [
1418
- /* @__PURE__ */ e.jsx(Ve, {}),
1419
- /* @__PURE__ */ e.jsxs(k, { fontSize: "sm", children: [
1462
+ R.error && /* @__PURE__ */ e.jsxs(Ve, { status: "error", mt: 2, children: [
1463
+ /* @__PURE__ */ e.jsx(et, {}),
1464
+ /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", children: [
1420
1465
  "Failed to load ",
1421
- r.pluralLowerCase,
1466
+ o.pluralLowerCase,
1422
1467
  ":",
1423
1468
  " ",
1424
- w.error.message
1469
+ R.error.message
1425
1470
  ] })
1426
1471
  ] })
1427
1472
  ] }),
1428
- D.length > 0 && /* @__PURE__ */ e.jsxs(re, { p: 4, bg: "gray.50", borderRadius: "md", children: [
1429
- /* @__PURE__ */ e.jsx(k, { fontWeight: "semibold", mb: 3, children: D.length === 1 ? `${r.singular} to ${u === "copy" ? "Copy" : "Convert"}` : `${D.length} ${r.plural} to ${u === "copy" ? "Copy" : "Convert"}` }),
1473
+ D.length > 0 && /* @__PURE__ */ e.jsxs(se, { p: 4, bg: "gray.50", borderRadius: "md", children: [
1474
+ /* @__PURE__ */ e.jsx(M, { fontWeight: "semibold", mb: 3, children: D.length === 1 ? `${o.singular} to ${d === "copy" ? "Copy" : "Convert"}` : `${D.length} ${o.plural} to ${d === "copy" ? "Copy" : "Convert"}` }),
1430
1475
  /* @__PURE__ */ e.jsxs(ue, { align: "start", spacing: 3, children: [
1431
- D.map((t, l) => /* @__PURE__ */ e.jsxs(
1432
- re,
1476
+ D.map((a, C) => /* @__PURE__ */ e.jsxs(
1477
+ se,
1433
1478
  {
1434
1479
  w: "100%",
1435
1480
  p: 3,
@@ -1438,13 +1483,13 @@ const Tn = ({
1438
1483
  border: "1px solid",
1439
1484
  borderColor: "gray.200",
1440
1485
  children: [
1441
- /* @__PURE__ */ e.jsxs(Z, { justify: "space-between", align: "start", mb: 2, children: [
1442
- /* @__PURE__ */ e.jsxs(k, { fontWeight: "medium", fontSize: "sm", children: [
1443
- l + 1,
1486
+ /* @__PURE__ */ e.jsxs(V, { justify: "space-between", align: "start", mb: 2, children: [
1487
+ /* @__PURE__ */ e.jsxs(M, { fontWeight: "medium", fontSize: "sm", children: [
1488
+ C + 1,
1444
1489
  ". ",
1445
- t.name
1490
+ a.name
1446
1491
  ] }),
1447
- t.quantumOwned && /* @__PURE__ */ e.jsx($e, { size: "sm", colorScheme: "blue", variant: "solid", children: "Quantum Owned" })
1492
+ a.quantumOwned && /* @__PURE__ */ e.jsx(Ge, { size: "sm", colorScheme: "blue", variant: "solid", children: "Quantum Owned" })
1448
1493
  ] }),
1449
1494
  /* @__PURE__ */ e.jsxs(
1450
1495
  ue,
@@ -1454,30 +1499,30 @@ const Tn = ({
1454
1499
  fontSize: "sm",
1455
1500
  color: "gray.600",
1456
1501
  children: [
1457
- t.description && /* @__PURE__ */ e.jsxs(k, { children: [
1502
+ a.description && /* @__PURE__ */ e.jsxs(M, { children: [
1458
1503
  /* @__PURE__ */ e.jsx("strong", { children: "Description:" }),
1459
1504
  " ",
1460
- t.description
1505
+ a.description
1461
1506
  ] }),
1462
- /* @__PURE__ */ e.jsxs(k, { children: [
1507
+ /* @__PURE__ */ e.jsxs(M, { children: [
1463
1508
  /* @__PURE__ */ e.jsx("strong", { children: "Activities:" }),
1464
1509
  " ",
1465
- t.moduleActions.length
1510
+ a.moduleActions.length
1466
1511
  ] }),
1467
- /* @__PURE__ */ e.jsxs(k, { children: [
1512
+ /* @__PURE__ */ e.jsxs(M, { children: [
1468
1513
  /* @__PURE__ */ e.jsx("strong", { children: "Categories:" }),
1469
1514
  " ",
1470
- t.categories.map((L) => L.name).join(", ") || "None"
1515
+ a.categories.map((l) => l.name).join(", ") || "None"
1471
1516
  ] })
1472
1517
  ]
1473
1518
  }
1474
1519
  )
1475
1520
  ]
1476
1521
  },
1477
- t.id
1522
+ a.id
1478
1523
  )),
1479
1524
  D.length > 1 && /* @__PURE__ */ e.jsx(
1480
- re,
1525
+ se,
1481
1526
  {
1482
1527
  w: "100%",
1483
1528
  p: 2,
@@ -1485,113 +1530,126 @@ const Tn = ({
1485
1530
  borderRadius: "md",
1486
1531
  border: "1px solid",
1487
1532
  borderColor: "blue.200",
1488
- children: /* @__PURE__ */ e.jsxs(k, { fontSize: "sm", fontWeight: "medium", color: "blue.800", children: [
1533
+ children: /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", fontWeight: "medium", color: "blue.800", children: [
1489
1534
  "Total: ",
1490
1535
  D.length,
1491
1536
  " ",
1492
- r.pluralLowerCase,
1537
+ o.pluralLowerCase,
1493
1538
  " will be",
1494
1539
  " ",
1495
- u === "copy" ? "copied" : "converted"
1540
+ d === "copy" ? "copied" : "converted"
1496
1541
  ] })
1497
1542
  }
1498
1543
  ),
1499
- c && D.filter((t) => t.moduleActions.some((l) => !l.action.quantumOwned)).length > 0 && /* @__PURE__ */ e.jsx(
1500
- re,
1544
+ c && D.filter((a) => a.moduleActions.some((C) => !C.action.quantumOwned)).length > 0 && /* @__PURE__ */ e.jsx(
1545
+ se,
1501
1546
  {
1502
1547
  p: 2,
1503
1548
  bg: "yellow.50",
1504
1549
  borderRadius: "md",
1505
1550
  border: "1px solid",
1506
1551
  borderColor: "yellow.200",
1507
- children: /* @__PURE__ */ e.jsx(k, { fontSize: "sm", fontWeight: "medium", color: "yellow.800", children: u === "convert" ? `Converting ${r.plural} will convert non QM-Owned ${d.plural} to QM-Owned ${d.plural}` : `Copying ${r.plural} with Non QM-Owned ${d.plural} will create corresponding QM-Owned ${d.plural}` })
1552
+ children: /* @__PURE__ */ e.jsx(M, { fontSize: "sm", fontWeight: "medium", color: "yellow.800", children: d === "convert" ? `Converting ${o.plural} will convert non QM-Owned ${u.plural} to QM-Owned ${u.plural}` : `Copying ${o.plural} with Non QM-Owned ${u.plural} will create corresponding QM-Owned ${u.plural}` })
1508
1553
  }
1509
1554
  )
1510
1555
  ] })
1511
1556
  ] }),
1512
- !p && /* @__PURE__ */ e.jsxs(Ae, { spacing: 4, justifyContent: "flex-end", children: [
1557
+ !p && /* @__PURE__ */ e.jsxs(Ne, { spacing: 4, justifyContent: "flex-end", children: [
1513
1558
  /* @__PURE__ */ e.jsx(
1514
- ne,
1559
+ te,
1515
1560
  {
1516
1561
  variant: "outline",
1517
- onClick: E,
1518
- isDisabled: I,
1562
+ onClick: B,
1563
+ isDisabled: L,
1519
1564
  children: "Cancel"
1520
1565
  }
1521
1566
  ),
1522
1567
  /* @__PURE__ */ e.jsxs(
1523
- ne,
1568
+ te,
1524
1569
  {
1525
- colorScheme: u === "copy" ? "blue" : "green",
1526
- onClick: N,
1527
- isDisabled: D.length === 0 || I,
1528
- isLoading: I,
1529
- loadingText: `${u === "copy" ? "Copying" : "Converting"}...`,
1570
+ colorScheme: d === "copy" ? "blue" : "green",
1571
+ onClick: T,
1572
+ isDisabled: D.length === 0 || L,
1573
+ isLoading: L,
1574
+ loadingText: `${d === "copy" ? "Copying" : "Converting"}...`,
1530
1575
  children: [
1531
- u === "copy" ? "Copy" : "Convert",
1576
+ d === "copy" ? "Copy" : "Convert",
1532
1577
  " ",
1533
- D.length === 1 ? r.singular : `${D.length} ${r.plural}`
1578
+ D.length === 1 ? o.singular : `${D.length} ${o.plural}`
1534
1579
  ]
1535
1580
  }
1536
1581
  )
1537
1582
  ] })
1538
1583
  ] }) });
1539
- }, Rt = rn(void 0), _e = () => {
1540
- const o = an(Rt);
1541
- if (!o)
1584
+ }, $t = rn(void 0), Ee = () => {
1585
+ const s = an($t);
1586
+ if (!s)
1542
1587
  throw new Error(
1543
1588
  "useUpsertModuleFormContext must be used within a UpsertModuleFormProvider"
1544
1589
  );
1545
- return o;
1546
- }, Bn = ({
1547
- name: o,
1548
- setName: s,
1549
- actions: a,
1590
+ return s;
1591
+ }, Wn = ({
1592
+ name: s,
1593
+ setName: n,
1594
+ actions: r,
1550
1595
  moduleActionEntries: p,
1551
1596
  setModuleActionEntries: m,
1552
1597
  availableCategories: h,
1553
1598
  selectedCategoryIds: c,
1554
1599
  setSelectedCategoryIds: b,
1555
- description: n,
1556
- setDescription: r,
1557
- selectedMetadataIds: d,
1600
+ description: t,
1601
+ setDescription: o,
1602
+ selectedMetadataIds: u,
1558
1603
  setSelectedMetadataIds: y,
1559
1604
  ...j
1560
1605
  }) => {
1561
- const v = qt(), C = T(() => [...new Set(p.map((w) => w.actionId))], [p]), I = T(() => a.map((w) => ({
1562
- ...w,
1563
- selected: C.includes(w.id)
1564
- })), [a, C]), x = T(() => a.reduce((w, O) => (w[O.id] = O, w), {}), [a]), u = F(
1565
- (w, O) => {
1566
- if (O) {
1567
- const B = {
1606
+ const w = Kt(), I = N(() => {
1607
+ const v = {};
1608
+ return p.forEach((E) => {
1609
+ v[E.actionId] = (v[E.actionId] ?? 0) + 1;
1610
+ }), v;
1611
+ }, [p]), L = _(
1612
+ (v) => I[v] ?? 0,
1613
+ [I]
1614
+ ), x = N(() => r.map((v) => ({
1615
+ ...v,
1616
+ selected: (I[v.id] ?? 0) > 0
1617
+ })), [r, I]), d = N(() => r.reduce((v, E) => (v[E.id] = E, v), {}), [r]), k = _(
1618
+ (v, E) => {
1619
+ if (E) {
1620
+ const $ = {
1568
1621
  key: crypto.randomUUID(),
1569
- actionId: w.id,
1622
+ actionId: v.id,
1570
1623
  reportId: null
1571
1624
  };
1572
- m((A) => [...A, B]);
1625
+ m((O) => [...O, $]);
1573
1626
  } else
1574
- m(
1575
- (B) => B.filter((A) => A.actionId !== w.id)
1576
- );
1627
+ m(($) => {
1628
+ for (let O = $.length - 1; O >= 0; O--)
1629
+ if ($[O].actionId === v.id) {
1630
+ const K = [...$];
1631
+ return K.splice(O, 1), K;
1632
+ }
1633
+ return $;
1634
+ });
1577
1635
  },
1578
1636
  [m]
1579
- ), S = F(
1580
- (w) => {
1581
- s(w.target.value);
1637
+ ), g = _(
1638
+ (v) => {
1639
+ n(v.target.value);
1582
1640
  },
1583
- [s]
1584
- ), g = F(
1585
- (w) => {
1586
- r?.(w.target.value);
1641
+ [n]
1642
+ ), R = _(
1643
+ (v) => {
1644
+ o?.(v.target.value);
1587
1645
  },
1588
- [r]
1646
+ [o]
1589
1647
  );
1590
- return /* @__PURE__ */ e.jsxs(re, { ...j, children: [
1591
- /* @__PURE__ */ e.jsxs(Z, { gap: "2rem", children: [
1592
- /* @__PURE__ */ e.jsx(Un, { name: o ?? "", onInputChange: S }),
1648
+ return /* @__PURE__ */ e.jsxs(se, { ...j, children: [
1649
+ /* @__PURE__ */ e.jsxs(V, { gap: "2rem", children: [
1650
+ /* @__PURE__ */ e.jsx(Qn, { name: s ?? "", onInputChange: g }),
1593
1651
  /* @__PURE__ */ e.jsx(
1594
- Wn,
1652
+ qn,
1595
1653
  {
1596
1654
  availableCategories: h,
1597
1655
  value: c,
@@ -1600,44 +1658,46 @@ const Tn = ({
1600
1658
  )
1601
1659
  ] }),
1602
1660
  /* @__PURE__ */ e.jsx(
1603
- Qn,
1661
+ Kn,
1604
1662
  {
1605
- description: n ?? "",
1606
- onInputChange: g
1663
+ description: t ?? "",
1664
+ onInputChange: R
1607
1665
  }
1608
1666
  ),
1609
1667
  /* @__PURE__ */ e.jsx(
1610
- Hn,
1668
+ Xn,
1611
1669
  {
1612
- selectedMetadataIds: d,
1670
+ selectedMetadataIds: u,
1613
1671
  setSelectedMetadataIds: y
1614
1672
  }
1615
1673
  ),
1616
1674
  /* @__PURE__ */ e.jsx(
1617
- qn,
1675
+ Hn,
1618
1676
  {
1619
1677
  moduleActionEntries: p,
1620
1678
  setModuleActionEntries: m,
1621
- actionsById: x,
1622
- onAdjustActivities: () => v.onOpen()
1679
+ actionsById: d,
1680
+ onAdjustActivities: () => w.onOpen()
1623
1681
  }
1624
1682
  ),
1625
1683
  /* @__PURE__ */ e.jsxs(
1626
- Kt,
1684
+ Ht,
1627
1685
  {
1628
- isOpen: v.isOpen,
1629
- onClose: v.onClose,
1686
+ isOpen: w.isOpen,
1687
+ onClose: w.onClose,
1630
1688
  size: "6xl",
1631
1689
  children: [
1632
1690
  /* @__PURE__ */ e.jsx(Yt, {}),
1633
- /* @__PURE__ */ e.jsxs(Ht, { children: [
1634
- /* @__PURE__ */ e.jsx(Jt, { children: "Select Activities" }),
1635
- /* @__PURE__ */ e.jsx(Xt, {}),
1636
- /* @__PURE__ */ e.jsx(Zt, { children: /* @__PURE__ */ e.jsx(
1637
- zn,
1691
+ /* @__PURE__ */ e.jsxs(Jt, { children: [
1692
+ /* @__PURE__ */ e.jsx(Xt, { children: "Select Activities" }),
1693
+ /* @__PURE__ */ e.jsx(Zt, {}),
1694
+ /* @__PURE__ */ e.jsx(Vt, { children: /* @__PURE__ */ e.jsx(
1695
+ Un,
1638
1696
  {
1639
- actions: I,
1640
- onSelected: u,
1697
+ actions: x,
1698
+ onSelected: k,
1699
+ allowDuplicateSelection: !0,
1700
+ getSelectedCount: L,
1641
1701
  disableCreate: !0,
1642
1702
  disableDelete: !0,
1643
1703
  tableProps: {
@@ -1646,11 +1706,11 @@ const Tn = ({
1646
1706
  }
1647
1707
  }
1648
1708
  ) }),
1649
- /* @__PURE__ */ e.jsx(Vt, { children: /* @__PURE__ */ e.jsx(
1650
- ne,
1709
+ /* @__PURE__ */ e.jsx(en, { children: /* @__PURE__ */ e.jsx(
1710
+ te,
1651
1711
  {
1652
1712
  colorScheme: "blue",
1653
- onClick: v.onClose,
1713
+ onClick: w.onClose,
1654
1714
  isDisabled: p.length === 0,
1655
1715
  children: "Done"
1656
1716
  }
@@ -1660,46 +1720,46 @@ const Tn = ({
1660
1720
  }
1661
1721
  )
1662
1722
  ] });
1663
- }, Un = ke(
1723
+ }, Qn = Ae(
1664
1724
  ({
1665
- name: o,
1666
- onInputChange: s
1725
+ name: s,
1726
+ onInputChange: n
1667
1727
  }) => {
1668
- const { getLabel: a } = xe(), p = a("module"), { isView: m } = _e();
1669
- return /* @__PURE__ */ e.jsxs(J, { mb: 4, children: [
1728
+ const { getLabel: r } = xe(), p = r("module"), { isView: m } = Ee();
1729
+ return /* @__PURE__ */ e.jsxs(X, { mb: 4, children: [
1670
1730
  /* @__PURE__ */ e.jsxs(ge, { children: [
1671
1731
  p,
1672
1732
  " Name"
1673
1733
  ] }),
1674
1734
  /* @__PURE__ */ e.jsx(
1675
- ve,
1735
+ ye,
1676
1736
  {
1677
1737
  placeholder: "i.e. ACL RTP Test Battery",
1678
- value: o,
1679
- onChange: s,
1738
+ value: s,
1739
+ onChange: n,
1680
1740
  isRequired: !0,
1681
1741
  isDisabled: m
1682
1742
  }
1683
1743
  )
1684
1744
  ] });
1685
1745
  }
1686
- ), Wn = ke(
1746
+ ), qn = Ae(
1687
1747
  ({
1688
- availableCategories: o,
1689
- value: s,
1690
- onChange: a
1748
+ availableCategories: s,
1749
+ value: n,
1750
+ onChange: r
1691
1751
  }) => {
1692
- const { getLabel: p } = xe(), m = p("module"), { isView: h } = _e(), c = T(() => [
1693
- ...o,
1752
+ const { getLabel: p } = xe(), m = p("module"), { isView: h } = Ee(), c = N(() => [
1753
+ ...s,
1694
1754
  {
1695
1755
  id: "other",
1696
1756
  name: "Other"
1697
1757
  }
1698
- ], [o]), b = T(() => c.map((n) => ({
1699
- value: n.id,
1700
- label: n.name
1758
+ ], [s]), b = N(() => c.map((t) => ({
1759
+ value: t.id,
1760
+ label: t.name
1701
1761
  })), [c]);
1702
- return /* @__PURE__ */ e.jsxs(J, { mb: 4, children: [
1762
+ return /* @__PURE__ */ e.jsxs(X, { mb: 4, children: [
1703
1763
  /* @__PURE__ */ e.jsxs(ge, { children: [
1704
1764
  m,
1705
1765
  " Category"
@@ -1707,28 +1767,28 @@ const Tn = ({
1707
1767
  /* @__PURE__ */ e.jsx(
1708
1768
  he,
1709
1769
  {
1710
- isDisabled: o.length === 0 || h,
1770
+ isDisabled: s.length === 0 || h,
1711
1771
  options: b,
1712
- value: s.length === 0 ? { value: "other", label: "Other" } : c.filter((n) => s.includes(n.id)).map((n) => ({
1713
- value: n.id,
1714
- label: n.name
1772
+ value: n.length === 0 ? { value: "other", label: "Other" } : c.filter((t) => n.includes(t.id)).map((t) => ({
1773
+ value: t.id,
1774
+ label: t.name
1715
1775
  }))[0],
1716
- onChange: (n) => a(n ? [n.value] : []),
1776
+ onChange: (t) => r(t ? [t.value] : []),
1717
1777
  placeholder: "Select category"
1718
1778
  }
1719
1779
  )
1720
1780
  ] });
1721
1781
  }
1722
- ), Qn = ke(
1782
+ ), Kn = Ae(
1723
1783
  ({
1724
- description: o,
1725
- onInputChange: s
1784
+ description: s,
1785
+ onInputChange: n
1726
1786
  }) => {
1727
- const { getLabel: a } = xe(), p = a("module"), { isView: m } = _e();
1728
- return /* @__PURE__ */ e.jsxs(J, { mb: 4, children: [
1787
+ const { getLabel: r } = xe(), p = r("module"), { isView: m } = Ee();
1788
+ return /* @__PURE__ */ e.jsxs(X, { mb: 4, children: [
1729
1789
  /* @__PURE__ */ e.jsx(ge, { children: /* @__PURE__ */ e.jsxs("span", { children: [
1730
1790
  "Description",
1731
- /* @__PURE__ */ e.jsxs(k, { fontSize: "sm", color: "gray.500", children: [
1791
+ /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", color: "gray.500", children: [
1732
1792
  "Briefly describe the objective of this",
1733
1793
  " ",
1734
1794
  p.toLocaleLowerCase(),
@@ -1736,47 +1796,47 @@ const Tn = ({
1736
1796
  ] })
1737
1797
  ] }) }),
1738
1798
  /* @__PURE__ */ e.jsx(
1739
- ve,
1799
+ ye,
1740
1800
  {
1741
1801
  placeholder: "i.e. Assess readiness to return to play post-ACL reconstruction",
1742
- value: o,
1743
- onChange: s,
1802
+ value: s,
1803
+ onChange: n,
1744
1804
  isDisabled: m
1745
1805
  }
1746
1806
  )
1747
1807
  ] });
1748
1808
  }
1749
- ), qn = ke(
1809
+ ), Hn = Ae(
1750
1810
  ({
1751
- moduleActionEntries: o,
1752
- setModuleActionEntries: s,
1753
- actionsById: a,
1811
+ moduleActionEntries: s,
1812
+ setModuleActionEntries: n,
1813
+ actionsById: r,
1754
1814
  onAdjustActivities: p
1755
1815
  }) => {
1756
- const { getLabel: m } = xe(), { isView: h } = _e(), c = T(() => ({
1816
+ const { getLabel: m } = xe(), { isView: h } = Ee(), c = N(() => ({
1757
1817
  module: m("module"),
1758
1818
  moduleLowerCase: m("module").toLocaleLowerCase(),
1759
1819
  action: m("action"),
1760
1820
  actionPlural: m("action_plural"),
1761
1821
  actionPluralLowerCase: m("action_plural").toLocaleLowerCase()
1762
- }), [m]), b = T(
1763
- () => o.map((n) => {
1764
- const r = a[n.actionId];
1765
- return r ? {
1766
- key: n.key,
1767
- actionId: n.actionId,
1768
- name: r.name,
1769
- reports: M(Ge, r.reports) || [],
1770
- selectedReportId: n.reportId
1822
+ }), [m]), b = N(
1823
+ () => s.map((t) => {
1824
+ const o = r[t.actionId];
1825
+ return o ? {
1826
+ key: t.key,
1827
+ actionId: t.actionId,
1828
+ name: o.name,
1829
+ reports: A(Fe, o.reports) || [],
1830
+ selectedReportId: t.reportId
1771
1831
  } : null;
1772
1832
  }).filter(Boolean),
1773
- [o, a]
1833
+ [s, r]
1774
1834
  );
1775
- return /* @__PURE__ */ e.jsxs(J, { mb: 4, children: [
1776
- /* @__PURE__ */ e.jsxs(Z, { justifyContent: "space-between", children: [
1835
+ return /* @__PURE__ */ e.jsxs(X, { mb: 4, children: [
1836
+ /* @__PURE__ */ e.jsxs(V, { justifyContent: "space-between", children: [
1777
1837
  /* @__PURE__ */ e.jsx(ge, { children: /* @__PURE__ */ e.jsxs("span", { children: [
1778
1838
  c.actionPlural,
1779
- !h && /* @__PURE__ */ e.jsxs(k, { fontSize: "sm", color: "gray.500", children: [
1839
+ !h && /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", color: "gray.500", children: [
1780
1840
  "Drag and drop to reorder the ",
1781
1841
  c.actionPluralLowerCase,
1782
1842
  " ",
@@ -1786,7 +1846,7 @@ const Tn = ({
1786
1846
  ] })
1787
1847
  ] }) }),
1788
1848
  !h && /* @__PURE__ */ e.jsxs(
1789
- ne,
1849
+ te,
1790
1850
  {
1791
1851
  size: "sm",
1792
1852
  variant: "solid",
@@ -1799,7 +1859,7 @@ const Tn = ({
1799
1859
  }
1800
1860
  )
1801
1861
  ] }),
1802
- b.length === 0 ? /* @__PURE__ */ e.jsx(ue, { children: /* @__PURE__ */ e.jsxs(k, { color: "gray.500", fontSize: "lg", mb: "4rem", mt: "4rem", children: [
1862
+ b.length === 0 ? /* @__PURE__ */ e.jsx(ue, { children: /* @__PURE__ */ e.jsxs(M, { color: "gray.500", fontSize: "lg", mb: "4rem", mt: "4rem", children: [
1803
1863
  "No ",
1804
1864
  c.actionPluralLowerCase,
1805
1865
  " selected for this",
@@ -1807,7 +1867,7 @@ const Tn = ({
1807
1867
  c.moduleLowerCase,
1808
1868
  ".",
1809
1869
  !h && /* @__PURE__ */ e.jsxs(
1810
- ne,
1870
+ te,
1811
1871
  {
1812
1872
  ml: "0.5em",
1813
1873
  size: "sm",
@@ -1822,22 +1882,22 @@ const Tn = ({
1822
1882
  }
1823
1883
  )
1824
1884
  ] }) }) : /* @__PURE__ */ e.jsx(
1825
- Kn,
1885
+ Yn,
1826
1886
  {
1827
1887
  value: b,
1828
- onChange: (n) => {
1829
- s((r) => {
1830
- const d = r.map((j) => {
1831
- const v = a[j.actionId];
1832
- return v ? {
1888
+ onChange: (t) => {
1889
+ n((o) => {
1890
+ const u = o.map((j) => {
1891
+ const w = r[j.actionId];
1892
+ return w ? {
1833
1893
  key: j.key,
1834
1894
  actionId: j.actionId,
1835
- name: v.name,
1836
- reports: M(Ge, v.reports) || [],
1895
+ name: w.name,
1896
+ reports: A(Fe, w.reports) || [],
1837
1897
  selectedReportId: j.reportId
1838
1898
  } : null;
1839
1899
  }).filter(Boolean);
1840
- return n(d).map((j) => ({
1900
+ return t(u).map((j) => ({
1841
1901
  key: j.key,
1842
1902
  actionId: j.actionId,
1843
1903
  reportId: j.selectedReportId
@@ -1845,143 +1905,143 @@ const Tn = ({
1845
1905
  });
1846
1906
  },
1847
1907
  disabled: h,
1848
- setModuleActionEntries: s
1908
+ setModuleActionEntries: n
1849
1909
  }
1850
1910
  )
1851
1911
  ] });
1852
1912
  }
1853
- ), Kn = ke(
1913
+ ), Yn = Ae(
1854
1914
  ({
1855
- value: o,
1856
- onChange: s,
1857
- disabled: a,
1915
+ value: s,
1916
+ onChange: n,
1917
+ disabled: r,
1858
1918
  setModuleActionEntries: p
1859
1919
  }) => {
1860
- const [m] = z(
1920
+ const [m] = q(
1861
1921
  () => Math.random().toString(36).substring(2, 15)
1862
- ), h = F(
1863
- (n, r) => {
1864
- a || s((d) => {
1865
- const y = [...d], [j] = y.splice(n, 1);
1866
- return y.splice(r, 0, j), y;
1922
+ ), h = _(
1923
+ (t, o) => {
1924
+ r || n((u) => {
1925
+ const y = [...u], [j] = y.splice(t, 1);
1926
+ return y.splice(o, 0, j), y;
1867
1927
  });
1868
1928
  },
1869
- [s, a]
1870
- ), c = F(
1871
- (n) => {
1872
- p((r) => {
1873
- const d = r.findIndex((C) => C.key === n);
1874
- if (d === -1) return r;
1875
- const y = r[d], j = {
1929
+ [n, r]
1930
+ ), c = _(
1931
+ (t) => {
1932
+ p((o) => {
1933
+ const u = o.findIndex((I) => I.key === t);
1934
+ if (u === -1) return o;
1935
+ const y = o[u], j = {
1876
1936
  key: crypto.randomUUID(),
1877
1937
  actionId: y.actionId,
1878
1938
  reportId: null
1879
- }, v = [...r];
1880
- return v.splice(d + 1, 0, j), v;
1939
+ }, w = [...o];
1940
+ return w.splice(u + 1, 0, j), w;
1881
1941
  });
1882
1942
  },
1883
1943
  [p]
1884
- ), b = F(
1885
- (n) => {
1944
+ ), b = _(
1945
+ (t) => {
1886
1946
  p(
1887
- (r) => r.filter((d) => d.key !== n)
1947
+ (o) => o.filter((u) => u.key !== t)
1888
1948
  );
1889
1949
  },
1890
1950
  [p]
1891
1951
  );
1892
- return /* @__PURE__ */ e.jsx(re, { children: /* @__PURE__ */ e.jsx(wn, { backend: In, children: /* @__PURE__ */ e.jsx(ue, { spacing: 3, align: "stretch", children: o.map((n, r) => /* @__PURE__ */ e.jsx(
1893
- Yn,
1952
+ return /* @__PURE__ */ e.jsx(se, { children: /* @__PURE__ */ e.jsx(Sn, { backend: Ln, children: /* @__PURE__ */ e.jsx(ue, { spacing: 3, align: "stretch", children: s.map((t, o) => /* @__PURE__ */ e.jsx(
1953
+ Jn,
1894
1954
  {
1895
1955
  listKey: m,
1896
- item: n,
1897
- index: r,
1898
- disabled: !!a,
1956
+ item: t,
1957
+ index: o,
1958
+ disabled: !!r,
1899
1959
  move: h,
1900
- onReportChange: (d) => {
1960
+ onReportChange: (u) => {
1901
1961
  p(
1902
1962
  (y) => y.map(
1903
- (j) => j.key === n.key ? { ...j, reportId: d } : j
1963
+ (j) => j.key === t.key ? { ...j, reportId: u } : j
1904
1964
  )
1905
1965
  );
1906
1966
  },
1907
- onDuplicate: () => c(n.key),
1908
- onRemove: () => b(n.key)
1967
+ onDuplicate: () => c(t.key),
1968
+ onRemove: () => b(t.key)
1909
1969
  },
1910
- n.key
1970
+ t.key
1911
1971
  )) }) }) });
1912
1972
  }
1913
- ), Yn = ke(
1973
+ ), Jn = Ae(
1914
1974
  ({
1915
- listKey: o,
1916
- item: s,
1917
- index: a,
1975
+ listKey: s,
1976
+ item: n,
1977
+ index: r,
1918
1978
  disabled: p,
1919
1979
  move: m,
1920
1980
  onReportChange: h,
1921
1981
  onDuplicate: c,
1922
1982
  onRemove: b
1923
1983
  }) => {
1924
- const n = ln(null), { getLabel: r } = xe(), d = r("action"), [{ handlerId: y }, j] = Sn({
1925
- accept: o,
1984
+ const t = ln(null), { getLabel: o } = xe(), u = o("action"), [{ handlerId: y }, j] = kn({
1985
+ accept: s,
1926
1986
  collect: (g) => ({
1927
1987
  handlerId: g.getHandlerId()?.toString() ?? ""
1928
1988
  }),
1929
- hover: (g, w) => {
1930
- if (!n.current)
1989
+ hover: (g, R) => {
1990
+ if (!t.current)
1931
1991
  return;
1932
- const O = g.index, B = a;
1933
- if (O === B)
1992
+ const v = g.index, E = r;
1993
+ if (v === E)
1934
1994
  return;
1935
- const A = n.current?.getBoundingClientRect(), R = (A.bottom - A.top) / 2, se = w.getClientOffset().y - A.top;
1936
- O < B && se < R || O > B && se > R || (m(O, B), g.index = B);
1995
+ const $ = t.current?.getBoundingClientRect(), O = ($.bottom - $.top) / 2, oe = R.getClientOffset().y - $.top;
1996
+ v < E && oe < O || v > E && oe > O || (m(v, E), g.index = E);
1937
1997
  }
1938
- }), [{ isDragging: v }, C] = Ln({
1939
- type: o,
1940
- item: () => ({ id: s.key, index: a }),
1998
+ }), [{ isDragging: w }, I] = Mn({
1999
+ type: s,
2000
+ item: () => ({ id: n.key, index: r }),
1941
2001
  collect: (g) => ({
1942
2002
  isDragging: g.isDragging()
1943
2003
  }),
1944
2004
  canDrag: !p
1945
- }), I = T(() => `action-report-label-${s.key}`, [s.key]), x = T(() => [
2005
+ }), L = N(() => `action-report-label-${n.key}`, [n.key]), x = N(() => [
1946
2006
  { value: null, label: "No Report" },
1947
- ...s.reports.map((g) => {
1948
- const w = g.name && g.name.length > 0 ? g.name : "No Name", O = Se(g.reportKind);
2007
+ ...n.reports.map((g) => {
2008
+ const R = g.name && g.name.length > 0 ? g.name : "No Name", v = ke(g.reportKind);
1949
2009
  return {
1950
2010
  value: g.id,
1951
- label: `${w} (${O})`
2011
+ label: `${R} (${v})`
1952
2012
  };
1953
2013
  })
1954
- ], [s.reports]), u = v ? 0.6 : 1, S = p ? "default" : v ? "grabbing" : "grab";
1955
- return C(j(n)), /* @__PURE__ */ e.jsx(
1956
- re,
2014
+ ], [n.reports]), d = w ? 0.6 : 1, k = p ? "default" : w ? "grabbing" : "grab";
2015
+ return I(j(t)), /* @__PURE__ */ e.jsx(
2016
+ se,
1957
2017
  {
1958
- ref: n,
2018
+ ref: t,
1959
2019
  p: 3,
1960
2020
  border: "1px solid",
1961
2021
  borderColor: "gray.200",
1962
2022
  borderRadius: "md",
1963
2023
  bg: "gray.50",
1964
- style: { opacity: u, cursor: S },
2024
+ style: { opacity: d, cursor: k },
1965
2025
  "data-handler-id": y,
1966
- children: /* @__PURE__ */ e.jsxs(Z, { justify: "space-between", align: "center", children: [
1967
- /* @__PURE__ */ e.jsxs(Z, { spacing: 3, children: [
1968
- /* @__PURE__ */ e.jsxs(k, { fontWeight: "semibold", minW: "2rem", children: [
1969
- a + 1,
2026
+ children: /* @__PURE__ */ e.jsxs(V, { justify: "space-between", align: "center", children: [
2027
+ /* @__PURE__ */ e.jsxs(V, { spacing: 3, children: [
2028
+ /* @__PURE__ */ e.jsxs(M, { fontWeight: "semibold", minW: "2rem", children: [
2029
+ r + 1,
1970
2030
  "."
1971
2031
  ] }),
1972
- /* @__PURE__ */ e.jsx(k, { fontWeight: "medium", children: s.name })
2032
+ /* @__PURE__ */ e.jsx(M, { fontWeight: "medium", children: n.name })
1973
2033
  ] }),
1974
- /* @__PURE__ */ e.jsxs(Z, { spacing: 3, align: "center", children: [
1975
- /* @__PURE__ */ e.jsxs(k, { id: I, fontSize: "sm", color: "gray.600", children: [
1976
- d,
2034
+ /* @__PURE__ */ e.jsxs(V, { spacing: 3, align: "center", children: [
2035
+ /* @__PURE__ */ e.jsxs(M, { id: L, fontSize: "sm", color: "gray.600", children: [
2036
+ u,
1977
2037
  " Report:"
1978
2038
  ] }),
1979
- /* @__PURE__ */ e.jsx(re, { width: { base: "100%", md: "350px" }, children: /* @__PURE__ */ e.jsx(
2039
+ /* @__PURE__ */ e.jsx(se, { width: { base: "100%", md: "350px" }, children: /* @__PURE__ */ e.jsx(
1980
2040
  he,
1981
2041
  {
1982
- "aria-labelledby": I,
2042
+ "aria-labelledby": L,
1983
2043
  value: x.find(
1984
- (g) => g.value === s.selectedReportId
2044
+ (g) => g.value === n.selectedReportId
1985
2045
  ),
1986
2046
  onChange: (g) => {
1987
2047
  h(g?.value || null);
@@ -1991,9 +2051,9 @@ const Tn = ({
1991
2051
  isDisabled: p
1992
2052
  }
1993
2053
  ) }),
1994
- !p && /* @__PURE__ */ e.jsxs(Z, { spacing: 1, children: [
2054
+ !p && /* @__PURE__ */ e.jsxs(V, { spacing: 1, children: [
1995
2055
  /* @__PURE__ */ e.jsx(
1996
- ne,
2056
+ te,
1997
2057
  {
1998
2058
  size: "xs",
1999
2059
  variant: "ghost",
@@ -2004,7 +2064,7 @@ const Tn = ({
2004
2064
  }
2005
2065
  ),
2006
2066
  /* @__PURE__ */ e.jsx(
2007
- ne,
2067
+ te,
2008
2068
  {
2009
2069
  size: "xs",
2010
2070
  variant: "ghost",
@@ -2020,48 +2080,48 @@ const Tn = ({
2020
2080
  }
2021
2081
  );
2022
2082
  }
2023
- ), Hn = ke(
2083
+ ), Xn = Ae(
2024
2084
  ({
2025
- selectedMetadataIds: o,
2026
- setSelectedMetadataIds: s
2085
+ selectedMetadataIds: s,
2086
+ setSelectedMetadataIds: n
2027
2087
  }) => {
2028
- const { getLabel: a } = xe(), { isView: p, metadataOptions: m } = _e(), h = T(() => [
2088
+ const { getLabel: r } = xe(), { isView: p, metadataOptions: m } = Ee(), h = N(() => [
2029
2089
  {
2030
2090
  key: "activity_type",
2031
- label: `${a("action")} Type`,
2091
+ label: `${r("action")} Type`,
2032
2092
  multi: !0
2033
2093
  },
2034
2094
  { key: "session_type", label: "Session Type", multi: !0 },
2035
2095
  { key: "body_region", label: "Body Region", multi: !0 },
2036
2096
  { key: "sport", label: "Sport", multi: !0 }
2037
- ], [a]), c = F(
2038
- (b, n) => {
2039
- const r = h.find((y) => y.key === b);
2040
- if (!r) return;
2041
- const d = r.multi ? (n ?? []).map((y) => y.id) : n ? [n.id] : [];
2042
- s((y) => [...y.filter((v) => Object.values(m || {}).flat().find((I) => I.id === v) && !Object.keys(m || {}).find(
2043
- (I) => m?.[I]?.some(
2044
- (x) => x.id === v && I === b
2097
+ ], [r]), c = _(
2098
+ (b, t) => {
2099
+ const o = h.find((y) => y.key === b);
2100
+ if (!o) return;
2101
+ const u = o.multi ? (t ?? []).map((y) => y.id) : t ? [t.id] : [];
2102
+ n((y) => [...y.filter((w) => Object.values(m || {}).flat().find((L) => L.id === w) && !Object.keys(m || {}).find(
2103
+ (L) => m?.[L]?.some(
2104
+ (x) => x.id === w && L === b
2045
2105
  )
2046
- )), ...d]);
2106
+ )), ...u]);
2047
2107
  },
2048
- [h, m, s]
2108
+ [h, m, n]
2049
2109
  );
2050
- return m ? /* @__PURE__ */ e.jsxs(J, { mb: 4, children: [
2110
+ return m ? /* @__PURE__ */ e.jsxs(X, { mb: 4, children: [
2051
2111
  /* @__PURE__ */ e.jsx(ge, { children: "Metadata Tags" }),
2052
- /* @__PURE__ */ e.jsx(Z, { gap: "1rem", align: "start", children: h.map((b) => /* @__PURE__ */ e.jsxs(J, { flex: "1", children: [
2053
- /* @__PURE__ */ e.jsx(Pe, { fontSize: "sm", children: b.label }),
2112
+ /* @__PURE__ */ e.jsx(V, { gap: "1rem", align: "start", children: h.map((b) => /* @__PURE__ */ e.jsxs(X, { flex: "1", children: [
2113
+ /* @__PURE__ */ e.jsx(_e, { fontSize: "sm", children: b.label }),
2054
2114
  /* @__PURE__ */ e.jsx(
2055
2115
  he,
2056
2116
  {
2057
2117
  isMulti: b.multi,
2058
2118
  value: m[b.key]?.filter(
2059
- (n) => o.includes(n.id)
2119
+ (t) => s.includes(t.id)
2060
2120
  ),
2061
- onChange: (n) => {
2121
+ onChange: (t) => {
2062
2122
  c(
2063
2123
  b.key,
2064
- n
2124
+ t
2065
2125
  );
2066
2126
  },
2067
2127
  options: m[b.key],
@@ -2073,75 +2133,75 @@ const Tn = ({
2073
2133
  ] }, b.key)) })
2074
2134
  ] }) : null;
2075
2135
  }
2076
- ), Jn = ({
2077
- value: o,
2078
- onChange: s,
2079
- forceKind: a,
2136
+ ), Zn = ({
2137
+ value: s,
2138
+ onChange: n,
2139
+ forceKind: r,
2080
2140
  disableRemove: p,
2081
2141
  disableKind: m,
2082
2142
  isDisabled: h,
2083
2143
  lockRanges: c,
2084
2144
  ...b
2085
2145
  }) => {
2086
- const n = T(() => [...o].sort((j, v) => {
2087
- const C = jt.indexOf(j.plane), I = jt.indexOf(v.plane);
2088
- return C - I;
2089
- }), [o]), r = F((j) => "segment" in j.id ? Tt(j.id.segment, j.plane, !0) ?? "Unknown" : Nt(j.id.joint, j.plane, !0) ?? "Unknown", []), d = F(
2090
- (j, v) => {
2091
- const C = n.findIndex(
2092
- (x) => x.id === v.id && x.plane === v.plane
2146
+ const t = N(() => [...s].sort((j, w) => {
2147
+ const I = bt.indexOf(j.plane), L = bt.indexOf(w.plane);
2148
+ return I - L;
2149
+ }), [s]), o = _((j) => "segment" in j.id ? Nt(j.id.segment, j.plane, !0) ?? "Unknown" : Rt(j.id.joint, j.plane, !0) ?? "Unknown", []), u = _(
2150
+ (j, w) => {
2151
+ const I = t.findIndex(
2152
+ (x) => x.id === w.id && x.plane === w.plane
2093
2153
  );
2094
- let I = [...n];
2095
- a && (v = { ...v, kind: a }), I[C] = v, c && (I = I.map((x) => ({
2154
+ let L = [...t];
2155
+ r && (w = { ...w, kind: r }), L[I] = w, c && (L = L.map((x) => ({
2096
2156
  ...x,
2097
- min: v.min,
2098
- max: v.max
2099
- }))), s(I);
2157
+ min: w.min,
2158
+ max: w.max
2159
+ }))), n(L);
2100
2160
  },
2101
- [s, n, a, c]
2102
- ), y = F(
2161
+ [n, t, r, c]
2162
+ ), y = _(
2103
2163
  (j) => {
2104
- const v = n.filter(
2105
- (C) => C.id !== j.id || C.plane !== j.plane
2164
+ const w = t.filter(
2165
+ (I) => I.id !== j.id || I.plane !== j.plane
2106
2166
  );
2107
- s(v);
2167
+ n(w);
2108
2168
  },
2109
- [s, n]
2169
+ [n, t]
2110
2170
  );
2111
- return /* @__PURE__ */ e.jsx(ue, { alignItems: "flex-start", overflowY: "auto", ...b, children: n.map((j, v) => /* @__PURE__ */ e.jsx(
2112
- Xn,
2171
+ return /* @__PURE__ */ e.jsx(ue, { alignItems: "flex-start", overflowY: "auto", ...b, children: t.map((j, w) => /* @__PURE__ */ e.jsx(
2172
+ Vn,
2113
2173
  {
2114
- label: r(j),
2174
+ label: o(j),
2115
2175
  parameter: j,
2116
- onChange: (C) => d(v, C),
2176
+ onChange: (I) => u(w, I),
2117
2177
  onRemove: p || h ? void 0 : () => y(j),
2118
- forceKind: a,
2178
+ forceKind: r,
2119
2179
  disableKind: m || h,
2120
2180
  isDisabled: h
2121
2181
  },
2122
2182
  `${JSON.stringify(j.id)}-${j.plane}`
2123
2183
  )) });
2124
- }, Xn = ({
2125
- label: o,
2126
- parameter: s,
2127
- onChange: a,
2184
+ }, Vn = ({
2185
+ label: s,
2186
+ parameter: n,
2187
+ onChange: r,
2128
2188
  onRemove: p,
2129
2189
  forceKind: m,
2130
2190
  disableKind: h,
2131
2191
  isDisabled: c
2132
2192
  }) => {
2133
- const b = F(
2134
- (d) => "joint" in s.id ? kn(
2135
- s.id.joint,
2136
- s.plane,
2137
- d < 0 ? -1 : 1
2138
- ) : Mn(
2139
- s.id.segment,
2140
- s.plane,
2141
- d < 0 ? -1 : 1
2193
+ const b = _(
2194
+ (u) => "joint" in n.id ? An(
2195
+ n.id.joint,
2196
+ n.plane,
2197
+ u < 0 ? -1 : 1
2198
+ ) : On(
2199
+ n.id.segment,
2200
+ n.plane,
2201
+ u < 0 ? -1 : 1
2142
2202
  ),
2143
- [s]
2144
- ), { min: n, max: r } = "joint" in s.id ? On(s.id.joint, s.plane) : { min: -180, max: 180 };
2203
+ [n]
2204
+ ), { min: t, max: o } = "joint" in n.id ? Tn(n.id.joint, n.plane) : { min: -180, max: 180 };
2145
2205
  return /* @__PURE__ */ e.jsxs(
2146
2206
  ue,
2147
2207
  {
@@ -2153,36 +2213,36 @@ const Tn = ({
2153
2213
  overflow: "hidden",
2154
2214
  flexShrink: "0",
2155
2215
  children: [
2156
- /* @__PURE__ */ e.jsxs(Z, { w: "100%", alignItems: "center", children: [
2216
+ /* @__PURE__ */ e.jsxs(V, { w: "100%", alignItems: "center", children: [
2157
2217
  /* @__PURE__ */ e.jsx(
2158
- k,
2218
+ M,
2159
2219
  {
2160
2220
  fontSize: "sm",
2161
2221
  flex: 1,
2162
2222
  textTransform: "capitalize",
2163
2223
  fontWeight: "semibold",
2164
- children: o
2224
+ children: s
2165
2225
  }
2166
2226
  ),
2167
- s.sensorOnly ? /* @__PURE__ */ e.jsx(Me, { size: "sm", colorScheme: "orange", variant: "subtle", children: "Sensor" }) : /* @__PURE__ */ e.jsxs(Z, { spacing: 1, children: [
2168
- /* @__PURE__ */ e.jsx(Me, { size: "sm", colorScheme: "blue", variant: "subtle", children: "Pose" }),
2169
- /* @__PURE__ */ e.jsx(Me, { size: "sm", colorScheme: "orange", variant: "subtle", children: "Sensor" })
2227
+ n.sensorOnly ? /* @__PURE__ */ e.jsx(Oe, { size: "sm", colorScheme: "orange", variant: "subtle", children: "Sensor" }) : /* @__PURE__ */ e.jsxs(V, { spacing: 1, children: [
2228
+ /* @__PURE__ */ e.jsx(Oe, { size: "sm", colorScheme: "blue", variant: "subtle", children: "Pose" }),
2229
+ /* @__PURE__ */ e.jsx(Oe, { size: "sm", colorScheme: "orange", variant: "subtle", children: "Sensor" })
2170
2230
  ] }),
2171
2231
  p && !c && /* @__PURE__ */ e.jsx(
2172
- en,
2232
+ ot,
2173
2233
  {
2174
2234
  size: "xs",
2175
2235
  variant: "ghost",
2176
2236
  "aria-label": "delete",
2177
- icon: /* @__PURE__ */ e.jsx(vt, { as: Cn }),
2237
+ icon: /* @__PURE__ */ e.jsx(Ct, { as: In }),
2178
2238
  onClick: p
2179
2239
  }
2180
2240
  ),
2181
2241
  !m && /* @__PURE__ */ e.jsx(
2182
- Nn,
2242
+ $n,
2183
2243
  {
2184
- selectedItem: s?.kind ?? Je.Limit,
2185
- onChange: ({ value: d }) => a({ ...s, kind: d }),
2244
+ selectedItem: n?.kind ?? Xe.Limit,
2245
+ onChange: ({ value: u }) => r({ ...n, kind: u }),
2186
2246
  isDisabled: h || c,
2187
2247
  buttonProps: {
2188
2248
  size: "sm",
@@ -2194,24 +2254,24 @@ const Tn = ({
2194
2254
  colorScheme: "teal"
2195
2255
  },
2196
2256
  items: [
2197
- { value: Je.Limit, label: "limit" },
2198
- { value: Je.Target, label: "target" }
2257
+ { value: Xe.Limit, label: "limit" },
2258
+ { value: Xe.Target, label: "target" }
2199
2259
  ]
2200
2260
  }
2201
2261
  )
2202
2262
  ] }),
2203
2263
  /* @__PURE__ */ e.jsx(
2204
- Rn,
2264
+ Dn,
2205
2265
  {
2206
2266
  w: "100%",
2207
2267
  size: "xs",
2208
- min: n,
2209
- max: r,
2268
+ min: t,
2269
+ max: o,
2210
2270
  zeroMarker: !0,
2211
- value: [s.min, s.max],
2212
- onChange: (d) => a({ ...s, min: d[0], max: d[1] }),
2213
- formatValue: (d) => `${Math.abs(d)}°`,
2214
- valueLabel: (d) => b(d) ?? "",
2271
+ value: [n.min, n.max],
2272
+ onChange: (u) => r({ ...n, min: u[0], max: u[1] }),
2273
+ formatValue: (u) => `${Math.abs(u)}°`,
2274
+ valueLabel: (u) => b(u) ?? "",
2215
2275
  positiveNegativeLabels: b(0) ? [b(-1) ?? "", b(1) ?? ""] : void 0,
2216
2276
  isDisabled: c
2217
2277
  }
@@ -2219,38 +2279,38 @@ const Tn = ({
2219
2279
  ]
2220
2280
  }
2221
2281
  );
2222
- }, Ke = (o, s) => "segment" in o && "segment" in s && o.segment === s.segment || "joint" in o && "joint" in s && o.joint === s.joint, bt = ({
2223
- options: o,
2224
- value: s,
2225
- onChange: a,
2282
+ }, He = (s, n) => "segment" in s && "segment" in n && s.segment === n.segment || "joint" in s && "joint" in n && s.joint === n.joint, yt = ({
2283
+ options: s,
2284
+ value: n,
2285
+ onChange: r,
2226
2286
  forceKind: p,
2227
2287
  singleValue: m,
2228
2288
  singleValueSideless: h,
2229
2289
  editOnly: c,
2230
2290
  disableKind: b,
2231
- maxParameters: n,
2232
- ...r
2291
+ maxParameters: t,
2292
+ ...o
2233
2293
  }) => {
2234
- const d = h ? 2 : n, y = T(() => {
2294
+ const u = h ? 2 : t, y = N(() => {
2235
2295
  const x = /* @__PURE__ */ new Map();
2236
- return o.forEach((u) => {
2237
- const S = "joint" in u.id;
2238
- let g, w;
2239
- if (S ? (g = Nt(u.id.joint, u.plane, !0) ?? "Unknown", w = `joint:${u.id.joint}`) : (g = Tt(u.id.segment, u.plane, !0) ?? "Unknown", w = `segment:${u.id.segment}`), !x.has(w)) {
2240
- const A = S ? xt(u.id.joint) ?? "Unknown Joint" : xt(u.id.segment) ?? "Unknown Segment";
2241
- x.set(w, {
2242
- label: A,
2296
+ return s.forEach((d) => {
2297
+ const k = "joint" in d.id;
2298
+ let g, R;
2299
+ if (k ? (g = Rt(d.id.joint, d.plane, !0) ?? "Unknown", R = `joint:${d.id.joint}`) : (g = Nt(d.id.segment, d.plane, !0) ?? "Unknown", R = `segment:${d.id.segment}`), !x.has(R)) {
2300
+ const $ = k ? ft(d.id.joint) ?? "Unknown Joint" : ft(d.id.segment) ?? "Unknown Segment";
2301
+ x.set(R, {
2302
+ label: $,
2243
2303
  options: []
2244
2304
  });
2245
2305
  }
2246
- const O = x.get(w), B = [
2306
+ const v = x.get(R), E = [
2247
2307
  g,
2248
- S ? u.id.joint : u.id.segment,
2249
- u.plane
2250
- ].filter(Boolean).map((A) => String(A).toLowerCase().replace(/\s+|_/g, ""));
2251
- O.options.push({
2308
+ k ? d.id.joint : d.id.segment,
2309
+ d.plane
2310
+ ].filter(Boolean).map(($) => String($).toLowerCase().replace(/\s+|_/g, ""));
2311
+ v.options.push({
2252
2312
  label: /* @__PURE__ */ e.jsxs(
2253
- Z,
2313
+ V,
2254
2314
  {
2255
2315
  spacing: 2,
2256
2316
  justify: "space-between",
@@ -2258,89 +2318,89 @@ const Tn = ({
2258
2318
  w: "100%",
2259
2319
  pl: 3,
2260
2320
  children: [
2261
- /* @__PURE__ */ e.jsx(k, { children: g }),
2262
- u.sensorOnly ? /* @__PURE__ */ e.jsx(Me, { size: "sm", colorScheme: "orange", variant: "subtle", children: "Sensor" }) : /* @__PURE__ */ e.jsxs(Z, { spacing: 1, children: [
2263
- /* @__PURE__ */ e.jsx(Me, { size: "sm", colorScheme: "blue", variant: "subtle", children: "Pose" }),
2264
- /* @__PURE__ */ e.jsx(Me, { size: "sm", colorScheme: "orange", variant: "subtle", children: "Sensor" })
2321
+ /* @__PURE__ */ e.jsx(M, { children: g }),
2322
+ d.sensorOnly ? /* @__PURE__ */ e.jsx(Oe, { size: "sm", colorScheme: "orange", variant: "subtle", children: "Sensor" }) : /* @__PURE__ */ e.jsxs(V, { spacing: 1, children: [
2323
+ /* @__PURE__ */ e.jsx(Oe, { size: "sm", colorScheme: "blue", variant: "subtle", children: "Pose" }),
2324
+ /* @__PURE__ */ e.jsx(Oe, { size: "sm", colorScheme: "orange", variant: "subtle", children: "Sensor" })
2265
2325
  ] })
2266
2326
  ]
2267
2327
  }
2268
2328
  ),
2269
- value: u.id,
2270
- plane: u.plane,
2271
- sensorOnly: u.sensorOnly,
2272
- searchTokens: B
2329
+ value: d.id,
2330
+ plane: d.plane,
2331
+ sensorOnly: d.sensorOnly,
2332
+ searchTokens: E
2273
2333
  });
2274
2334
  }), Array.from(x.values());
2275
- }, [o]), j = T(() => {
2276
- if (!h || s.length === 0)
2335
+ }, [s]), j = N(() => {
2336
+ if (!h || n.length === 0)
2277
2337
  return y;
2278
- const x = s[0];
2279
- return y.map((u) => ({
2280
- ...u,
2281
- options: u.options.filter(
2282
- (S) => Qe(S.value) === Qe(x.id) && S.plane === x.plane
2338
+ const x = n[0];
2339
+ return y.map((d) => ({
2340
+ ...d,
2341
+ options: d.options.filter(
2342
+ (k) => qe(k.value) === qe(x.id) && k.plane === x.plane
2283
2343
  )
2284
- })).filter((u) => u.options.length > 0);
2285
- }, [y, s, h]), v = T(() => y.flatMap((u) => u.options).filter(
2286
- (u) => s.some((S) => Ke(S.id, u.value) && S.plane === u.plane)
2287
- ), [y, s]), C = F((x, u) => {
2288
- if (!u) return !0;
2289
- const S = u.toLowerCase().replace(/\s+|_/g, ""), g = x.data;
2344
+ })).filter((d) => d.options.length > 0);
2345
+ }, [y, n, h]), w = N(() => y.flatMap((d) => d.options).filter(
2346
+ (d) => n.some((k) => He(k.id, d.value) && k.plane === d.plane)
2347
+ ), [y, n]), I = _((x, d) => {
2348
+ if (!d) return !0;
2349
+ const k = d.toLowerCase().replace(/\s+|_/g, ""), g = x.data;
2290
2350
  return !g || !g.searchTokens ? !1 : g.searchTokens.some(
2291
- (w) => w.includes(S)
2351
+ (R) => R.includes(k)
2292
2352
  );
2293
- }, []), I = F(
2353
+ }, []), L = _(
2294
2354
  (x) => {
2295
- const u = x.map((S) => {
2296
- const g = s.find(
2297
- (R) => Ke(R.id, S.value) && R.plane === S.plane
2298
- ), w = o.find(
2299
- (R) => Ke(R.id, S.value) && R.plane === S.plane
2300
- ), O = h ? s.find(
2301
- (R) => Qe(R.id) === Qe(S.value) && R.plane === S.plane
2302
- ) : void 0, B = O && !g ? O.min : w && w.min ? w.min : 0, A = O && !g ? O.max : w && w.max ? w.max : 0;
2355
+ const d = x.map((k) => {
2356
+ const g = n.find(
2357
+ (O) => He(O.id, k.value) && O.plane === k.plane
2358
+ ), R = s.find(
2359
+ (O) => He(O.id, k.value) && O.plane === k.plane
2360
+ ), v = h ? n.find(
2361
+ (O) => qe(O.id) === qe(k.value) && O.plane === k.plane
2362
+ ) : void 0, E = v && !g ? v.min : R && R.min ? R.min : 0, $ = v && !g ? v.max : R && R.max ? R.max : 0;
2303
2363
  return g ?? {
2304
- id: S.value,
2305
- plane: S.plane,
2306
- min: B,
2307
- max: A,
2308
- sensorOnly: S.sensorOnly,
2309
- kind: p ?? Je.Limit
2364
+ id: k.value,
2365
+ plane: k.plane,
2366
+ min: E,
2367
+ max: $,
2368
+ sensorOnly: k.sensorOnly,
2369
+ kind: p ?? Xe.Limit
2310
2370
  };
2311
2371
  });
2312
- a(u);
2372
+ r(d);
2313
2373
  },
2314
- [a, s, o, p, h]
2374
+ [r, n, s, p, h]
2315
2375
  );
2316
2376
  return ce(() => {
2317
- const x = s.filter(
2318
- (u) => o.some((S) => Ke(S.id, u.id) && S.plane === u.plane)
2377
+ const x = n.filter(
2378
+ (d) => s.some((k) => He(k.id, d.id) && k.plane === d.plane)
2319
2379
  );
2320
- x.length !== s.length && a(x);
2321
- }, [o, a, s]), /* @__PURE__ */ e.jsxs(re, { ...r, children: [
2380
+ x.length !== n.length && r(x);
2381
+ }, [s, r, n]), /* @__PURE__ */ e.jsxs(se, { ...o, children: [
2322
2382
  /* @__PURE__ */ e.jsx(
2323
2383
  he,
2324
2384
  {
2325
2385
  isMulti: !m,
2326
- placeholder: s.length ? `${s.length} selected` : "Search...",
2327
- value: v,
2328
- isDisabled: c || v.length >= (d ?? 1 / 0),
2329
- onChange: (x) => Array.isArray(x) ? I([...x]) : I(x !== null ? [x] : []),
2386
+ placeholder: n.length ? `${n.length} selected` : "Search...",
2387
+ value: w,
2388
+ isDisabled: c || w.length >= (u ?? 1 / 0),
2389
+ onChange: (x) => Array.isArray(x) ? L([...x]) : L(x !== null ? [x] : []),
2330
2390
  options: j,
2331
2391
  controlShouldRenderValue: !1,
2332
2392
  formatOptionLabel: (x) => x.label,
2333
- filterOption: C,
2393
+ filterOption: I,
2334
2394
  isSearchable: !0
2335
2395
  }
2336
2396
  ),
2337
2397
  /* @__PURE__ */ e.jsx(
2338
- Jn,
2398
+ Zn,
2339
2399
  {
2340
2400
  marginTop: 2,
2341
2401
  maxH: "28rem",
2342
- value: s,
2343
- onChange: a,
2402
+ value: n,
2403
+ onChange: r,
2344
2404
  forceKind: p,
2345
2405
  disableKind: b,
2346
2406
  isDisabled: c,
@@ -2348,8 +2408,8 @@ const Tn = ({
2348
2408
  }
2349
2409
  )
2350
2410
  ] });
2351
- }, yt = (o) => {
2352
- switch (o) {
2411
+ }, vt = (s) => {
2412
+ switch (s) {
2353
2413
  case me.Thorax:
2354
2414
  return "Thorax";
2355
2415
  case me.CenterBack:
@@ -2379,39 +2439,39 @@ const Tn = ({
2379
2439
  case me.Head:
2380
2440
  return "Head";
2381
2441
  }
2382
- }, bs = ({
2383
- id: o,
2384
- onError: s,
2385
- onCancel: a,
2442
+ }, vs = ({
2443
+ id: s,
2444
+ onError: n,
2445
+ onCancel: r,
2386
2446
  onSave: p,
2387
2447
  hideButtons: m,
2388
2448
  setButtonOnClick: h,
2389
2449
  setButtonDisabled: c,
2390
2450
  quantumOwned: b,
2391
- isView: n
2451
+ isView: t
2392
2452
  }) => {
2393
- const r = at(), [{ fetching: d }, y] = fe(rt), [{ fetching: j }, v] = fe(un), [{ data: C }] = we({
2453
+ const o = lt(), [{ fetching: u }, y] = fe(it), [{ fetching: j }, w] = fe(un), [{ data: I }] = Ce({
2394
2454
  query: mn,
2395
- variables: { id: o ?? "" },
2396
- pause: !o
2397
- }), I = T(() => {
2398
- const f = M(
2399
- Ce,
2400
- C?.getActionById
2455
+ variables: { id: s ?? "" },
2456
+ pause: !s
2457
+ }), L = N(() => {
2458
+ const f = A(
2459
+ ve,
2460
+ I?.getActionById
2401
2461
  );
2402
2462
  if (!f) return null;
2403
- const G = (M(Ge, f.reports) || []).map(($) => ({
2404
- ...$,
2405
- thresholds: M(Oe, $.thresholds)
2463
+ const P = (A(Fe, f.reports) || []).map((F) => ({
2464
+ ...F,
2465
+ thresholds: A(Te, F.thresholds)
2406
2466
  }));
2407
2467
  return {
2408
2468
  ...f,
2409
- thresholds: M(Oe, f.thresholds),
2410
- reports: G
2469
+ thresholds: A(Te, f.thresholds),
2470
+ reports: P
2411
2471
  };
2412
- }, [C]), x = d || j, u = !!I && !!o, { getLabel: S } = xe(), g = T(() => ({
2413
- action: S("action")
2414
- }), [S]), w = T(() => [
2472
+ }, [I]), x = u || j, d = !!L && !!s, { getLabel: k } = xe(), g = N(() => ({
2473
+ action: k("action")
2474
+ }), [k]), R = N(() => [
2415
2475
  { key: "module_category", label: "Link Category", multi: !0 },
2416
2476
  { key: "activity_type", label: `${g.action} Type`, multi: !1 },
2417
2477
  { key: "session_type", label: "Session Type", multi: !0 },
@@ -2422,367 +2482,367 @@ const Tn = ({
2422
2482
  label: "Activity Motion Direction",
2423
2483
  multi: !0
2424
2484
  }
2425
- ], [g.action]), [O, B] = z(""), [A, R] = z(""), [X, se] = z(""), [D, V] = z(""), [ee, N] = z([]), [E, Y] = z({}), [_, q] = z(null), [i, t] = z(""), [l, L] = z([]), [W, K] = z([]), [Q, U] = z(""), [H, ie] = z([]), ye = fn(), it = T(() => ye.filter((f) => f.sensorOnly), [ye]), Te = [
2485
+ ], [g.action]), [v, E] = q(""), [$, O] = q(""), [K, oe] = q(""), [D, ae] = q(""), [Z, T] = q([]), [B, J] = q({}), [U, H] = q(null), [i, a] = q(""), [C, l] = q([]), [S, W] = q([]), [G, Q] = q(""), [Y, re] = q([]), we = fn(), Ie = N(() => we.filter((f) => f.sensorOnly), [we]), Se = [
2426
2486
  {
2427
- label: Se(ae.GeneralActivity),
2428
- value: ae.GeneralActivity
2487
+ label: ke(ie.GeneralActivity),
2488
+ value: ie.GeneralActivity
2429
2489
  },
2430
2490
  {
2431
- label: Se(ae.MovementCoordination),
2432
- value: ae.MovementCoordination
2491
+ label: ke(ie.MovementCoordination),
2492
+ value: ie.MovementCoordination
2433
2493
  },
2434
- { label: Se(ae.Range), value: ae.Range },
2494
+ { label: ke(ie.Range), value: ie.Range },
2435
2495
  {
2436
- label: Se(ae.StabilityBalance),
2437
- value: ae.StabilityBalance
2496
+ label: ke(ie.StabilityBalance),
2497
+ value: ie.StabilityBalance
2438
2498
  },
2439
2499
  {
2440
- label: Se(ae.PointOfInterest),
2441
- value: ae.PointOfInterest
2500
+ label: ke(ie.PointOfInterest),
2501
+ value: ie.PointOfInterest
2442
2502
  }
2443
- ], Ee = T(() => O.trim().length > 0, [O]), [ze, et] = z({});
2503
+ ], ze = N(() => v.trim().length > 0, [v]), [Be, tt] = q({});
2444
2504
  ce(() => {
2445
- const f = w.map(
2446
- (P) => r.query(ot, { key: P.key })
2505
+ const f = R.map(
2506
+ (z) => o.query(at, { key: z.key })
2447
2507
  );
2448
- Promise.all(f).then((P) => {
2449
- const G = {};
2450
- P.forEach(($) => {
2451
- if ($.error || !$.data) return;
2452
- const oe = M(
2508
+ Promise.all(f).then((z) => {
2509
+ const P = {};
2510
+ z.forEach((F) => {
2511
+ if (F.error || !F.data) return;
2512
+ const ne = A(
2453
2513
  je,
2454
- $.data.getMetadataByKey
2455
- ), te = M(
2514
+ F.data.getMetadataByKey
2515
+ ), ee = A(
2456
2516
  be,
2457
- oe.data
2517
+ ne.data
2458
2518
  );
2459
- G[oe.key] = te.map((de) => ({
2519
+ P[ne.key] = ee.map((de) => ({
2460
2520
  label: de.label || de.value,
2461
2521
  value: de.value,
2462
2522
  id: de.id
2463
2523
  }));
2464
- }), Y(G);
2524
+ }), J(P);
2465
2525
  });
2466
- }, [r, w]), ce(() => {
2467
- if (I) {
2468
- const P = M(
2526
+ }, [o, R]), ce(() => {
2527
+ if (L) {
2528
+ const z = A(
2469
2529
  je,
2470
- I.metadataGroups
2530
+ L.metadataGroups
2471
2531
  ).map(
2472
- (oe) => oe.data.map((te) => M(be, te).id)
2473
- ), G = I.reports.map((oe) => ({
2474
- id: oe.id,
2475
- name: oe.name ?? "",
2476
- instructions: oe.instructions ?? "",
2477
- kind: oe.reportKind,
2478
- autoGenerate: oe.autoGenerate ?? !1,
2479
- parameters: oe.thresholds.map((te) => ({
2532
+ (ne) => ne.data.map((ee) => A(be, ee).id)
2533
+ ), P = L.reports.map((ne) => ({
2534
+ id: ne.id,
2535
+ name: ne.name ?? "",
2536
+ instructions: ne.instructions ?? "",
2537
+ kind: ne.reportKind,
2538
+ autoGenerate: ne.autoGenerate ?? !1,
2539
+ parameters: ne.thresholds.map((ee) => ({
2480
2540
  id: {
2481
- [te.partKind]: te.partId
2541
+ [ee.partKind]: ee.partId
2482
2542
  },
2483
- kind: te.kind,
2484
- min: te.min,
2485
- max: te.max,
2486
- plane: te.partDimension,
2487
- oldId: te.id,
2488
- sensorOnly: it.some((de) => {
2489
- const tt = de.id[te.partKind];
2490
- return tt ? tt === te.partId && de.plane === te.partDimension : !1;
2543
+ kind: ee.kind,
2544
+ min: ee.min,
2545
+ max: ee.max,
2546
+ plane: ee.partDimension,
2547
+ oldId: ee.id,
2548
+ sensorOnly: Ie.some((de) => {
2549
+ const nt = de.id[ee.partKind];
2550
+ return nt ? nt === ee.partId && de.plane === ee.partDimension : !1;
2491
2551
  })
2492
2552
  })),
2493
- sensorLocations: oe.sensorLocations
2494
- })), $ = {
2495
- name: I.name,
2496
- description: I.description || "",
2497
- cameraPlacement: I.cameraPlacement || "",
2498
- videoLink: I.videoLink || "",
2499
- metadataIds: P.flat(),
2500
- reports: G
2553
+ sensorLocations: ne.sensorLocations
2554
+ })), F = {
2555
+ name: L.name,
2556
+ description: L.description || "",
2557
+ cameraPlacement: L.cameraPlacement || "",
2558
+ videoLink: L.videoLink || "",
2559
+ metadataIds: z.flat(),
2560
+ reports: P
2501
2561
  };
2502
- B($.name), R($.description), se($.cameraPlacement), V($.videoLink), N($.metadataIds), ie(G), et($);
2562
+ E(F.name), O(F.description), oe(F.cameraPlacement), ae(F.videoLink), T(F.metadataIds), re(P), tt(F);
2503
2563
  }
2504
- }, [I]);
2505
- const Ne = T(
2506
- () => JSON.stringify(ze) !== JSON.stringify({
2507
- name: O,
2508
- description: A,
2509
- cameraPlacement: X,
2564
+ }, [L]);
2565
+ const Re = N(
2566
+ () => JSON.stringify(Be) !== JSON.stringify({
2567
+ name: v,
2568
+ description: $,
2569
+ cameraPlacement: K,
2510
2570
  videoLink: D,
2511
- metadataIds: ee,
2512
- reports: H
2571
+ metadataIds: Z,
2572
+ reports: Y
2513
2573
  }),
2514
2574
  [
2515
- ze,
2516
- O,
2517
- A,
2518
- X,
2575
+ Be,
2576
+ v,
2577
+ $,
2578
+ K,
2519
2579
  D,
2520
- ee,
2521
- H
2580
+ Z,
2581
+ Y
2522
2582
  ]
2523
- ), Ie = F(() => {
2583
+ ), Le = _(() => {
2524
2584
  const f = {
2525
- name: O,
2526
- description: A,
2527
- cameraPlacement: X,
2585
+ name: v,
2586
+ description: $,
2587
+ cameraPlacement: K,
2528
2588
  videoLink: D,
2529
- metadataItemIds: ee,
2589
+ metadataItemIds: Z,
2530
2590
  // Backend requires laterality; keep existing default since UI no longer edits it
2531
- laterality: An.Either,
2591
+ laterality: Nn.Either,
2532
2592
  quantumOwned: b,
2533
2593
  //Backend requires session type; keep existing default since UI no longer edits it
2534
2594
  sessionType: [],
2535
2595
  // Backend requires thresholds; use empty array since reports handle parameters now
2536
2596
  thresholds: [],
2537
2597
  // Include reports data
2538
- reports: H.map((G) => ({
2539
- id: G.isNew ? void 0 : G.id,
2540
- name: G.name,
2541
- reportKind: G.kind,
2542
- sensorLocations: G.sensorLocations,
2543
- instructions: G.instructions,
2544
- autoGenerate: G.autoGenerate ?? !1,
2545
- thresholds: G.parameters.map(($) => ({
2546
- id: $.oldId,
2547
- kind: $.kind,
2548
- min: $.min,
2549
- max: $.max,
2550
- partKind: "joint" in $.id ? "joint" : "segment",
2551
- partId: "joint" in $.id ? $.id.joint : $.id.segment,
2552
- partDimension: $.plane
2598
+ reports: Y.map((P) => ({
2599
+ id: P.isNew ? void 0 : P.id,
2600
+ name: P.name,
2601
+ reportKind: P.kind,
2602
+ sensorLocations: P.sensorLocations,
2603
+ instructions: P.instructions,
2604
+ autoGenerate: P.autoGenerate ?? !1,
2605
+ thresholds: P.parameters.map((F) => ({
2606
+ id: F.oldId,
2607
+ kind: F.kind,
2608
+ min: F.min,
2609
+ max: F.max,
2610
+ partKind: "joint" in F.id ? "joint" : "segment",
2611
+ partId: "joint" in F.id ? F.id.joint : F.id.segment,
2612
+ partDimension: F.plane
2553
2613
  }))
2554
2614
  }))
2555
2615
  };
2556
- let P;
2557
- u && o ? P = v({
2558
- id: o,
2616
+ let z;
2617
+ d && s ? z = w({
2618
+ id: s,
2559
2619
  fields: f
2560
- }) : P = y({
2620
+ }) : z = y({
2561
2621
  fields: f
2562
- }), P.then(({ error: G }) => {
2563
- G ? s(G) : p();
2622
+ }), z.then(({ error: P }) => {
2623
+ P ? n(P) : p();
2564
2624
  });
2565
2625
  }, [
2566
2626
  b,
2567
2627
  y,
2628
+ w,
2629
+ s,
2568
2630
  v,
2569
- o,
2570
- O,
2571
- A,
2572
- X,
2631
+ $,
2632
+ K,
2573
2633
  D,
2574
- ee,
2575
- H,
2576
- u,
2634
+ Z,
2635
+ Y,
2636
+ d,
2577
2637
  p,
2578
- s
2638
+ n
2579
2639
  ]);
2580
2640
  ce(() => {
2581
2641
  c && c({
2582
2642
  cancelButton: x,
2583
- saveButton: n ? !0 : x || !Ee || !Ne
2643
+ saveButton: t ? !0 : x || !ze || !Re
2584
2644
  });
2585
- }, [x, c, Ee, Ne, n]), ce(() => {
2645
+ }, [x, c, ze, Re, t]), ce(() => {
2586
2646
  h && h({
2587
- cancelButton: a,
2588
- saveButton: n ? () => {
2589
- } : Ie
2647
+ cancelButton: r,
2648
+ saveButton: t ? () => {
2649
+ } : Le
2590
2650
  });
2591
- }, [h, a, Ie, n]);
2592
- const pe = F(
2651
+ }, [h, r, Le, t]);
2652
+ const pe = _(
2593
2653
  (f) => {
2594
- const P = ft(
2654
+ const z = jt(
2595
2655
  f.map(
2596
- (G) => "joint" in G.id ? G.id.joint : G.id.segment
2656
+ (P) => "joint" in P.id ? P.id.joint : P.id.segment
2597
2657
  )
2598
2658
  );
2599
- K(P);
2659
+ W(z);
2600
2660
  },
2601
2661
  []
2602
2662
  );
2603
2663
  ce(() => {
2604
- pe(l);
2605
- }, [l, pe]);
2606
- const Re = F(() => {
2607
- if (!_ || !i.trim())
2664
+ pe(C);
2665
+ }, [C, pe]);
2666
+ const $e = _(() => {
2667
+ if (!U || !i.trim())
2608
2668
  return;
2609
- const f = _ === ae.PointOfInterest, P = {
2669
+ const f = U === ie.PointOfInterest, z = {
2610
2670
  id: Date.now().toString(),
2611
2671
  // Temporary ID
2612
2672
  name: i.trim(),
2613
- kind: _,
2614
- parameters: f ? [] : l,
2615
- sensorLocations: f ? [] : W,
2616
- instructions: f ? Q : "",
2673
+ kind: U,
2674
+ parameters: f ? [] : C,
2675
+ sensorLocations: f ? [] : S,
2676
+ instructions: f ? G : "",
2617
2677
  autoGenerate: !1,
2618
2678
  isNew: !0
2619
2679
  };
2620
- ie((G) => [...G, P]), q(null), t(""), L([]), K([]), U("");
2680
+ re((P) => [...P, z]), H(null), a(""), l([]), W([]), Q("");
2621
2681
  }, [
2622
- _,
2682
+ U,
2623
2683
  i,
2624
- l,
2625
- W,
2626
- Q
2627
- ]), Dt = F((f) => {
2628
- ie((P) => P.filter((G) => G.id !== f));
2629
- }, []), $t = (f, P) => {
2630
- const G = w.find((oe) => oe.key === f);
2631
- if (!G) return;
2632
- const $ = G.multi ? (P ?? []).map(
2633
- (oe) => oe.id
2634
- ) : P ? [P.id] : [];
2635
- N((oe) => [...oe.filter((de) => Object.values(E).flat().find((Be) => Be.id === de) && !Object.keys(E).find(
2636
- (Be) => E[Be]?.some(
2637
- (Gt) => Gt.id === de && Be === f
2684
+ C,
2685
+ S,
2686
+ G
2687
+ ]), Dt = _((f) => {
2688
+ re((z) => z.filter((P) => P.id !== f));
2689
+ }, []), Gt = (f, z) => {
2690
+ const P = R.find((ne) => ne.key === f);
2691
+ if (!P) return;
2692
+ const F = P.multi ? (z ?? []).map(
2693
+ (ne) => ne.id
2694
+ ) : z ? [z.id] : [];
2695
+ T((ne) => [...ne.filter((de) => Object.values(B).flat().find((Ue) => Ue.id === de) && !Object.keys(B).find(
2696
+ (Ue) => B[Ue]?.some(
2697
+ (Ft) => Ft.id === de && Ue === f
2638
2698
  )
2639
- )), ...$]);
2699
+ )), ...F]);
2640
2700
  };
2641
2701
  return /* @__PURE__ */ e.jsxs(ue, { spacing: 4, w: "full", align: "stretch", children: [
2642
2702
  /* @__PURE__ */ e.jsxs(tn, { children: [
2643
2703
  /* @__PURE__ */ e.jsxs(nn, { children: [
2644
- /* @__PURE__ */ e.jsx(pt, { children: "Activity Configuration" }),
2645
- /* @__PURE__ */ e.jsx(pt, { children: "Reports Configuration" })
2704
+ /* @__PURE__ */ e.jsx(gt, { children: "Activity Configuration" }),
2705
+ /* @__PURE__ */ e.jsx(gt, { children: "Reports Configuration" })
2646
2706
  ] }),
2647
2707
  /* @__PURE__ */ e.jsxs(sn, { children: [
2648
- /* @__PURE__ */ e.jsx(gt, { px: 0, children: /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-6", children: [
2708
+ /* @__PURE__ */ e.jsx(xt, { px: 0, children: /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-6", children: [
2649
2709
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
2650
- /* @__PURE__ */ e.jsxs(J, { children: [
2710
+ /* @__PURE__ */ e.jsxs(X, { children: [
2651
2711
  /* @__PURE__ */ e.jsx(le, { children: "Name" }),
2652
2712
  /* @__PURE__ */ e.jsx(
2653
- ve,
2713
+ ye,
2654
2714
  {
2655
- value: O,
2656
- onChange: (f) => B(f.target.value),
2715
+ value: v,
2716
+ onChange: (f) => E(f.target.value),
2657
2717
  type: "text",
2658
2718
  placeholder: "i.e. Lunge & Return",
2659
- isDisabled: n
2719
+ isDisabled: t
2660
2720
  }
2661
2721
  )
2662
2722
  ] }),
2663
- /* @__PURE__ */ e.jsxs(J, { children: [
2723
+ /* @__PURE__ */ e.jsxs(X, { children: [
2664
2724
  /* @__PURE__ */ e.jsx(le, { children: "Camera Placement" }),
2665
2725
  /* @__PURE__ */ e.jsx(
2666
- We,
2726
+ Qe,
2667
2727
  {
2668
- value: X,
2669
- onChange: (f) => se(f.target.value),
2728
+ value: K,
2729
+ onChange: (f) => oe(f.target.value),
2670
2730
  rows: 2,
2671
2731
  placeholder: "(optional) Describe camera setup, placement, angles",
2672
- isDisabled: n
2732
+ isDisabled: t
2673
2733
  }
2674
2734
  )
2675
2735
  ] }),
2676
- /* @__PURE__ */ e.jsxs(J, { children: [
2736
+ /* @__PURE__ */ e.jsxs(X, { children: [
2677
2737
  /* @__PURE__ */ e.jsx(le, { children: "Video Link" }),
2678
2738
  /* @__PURE__ */ e.jsx(
2679
- ve,
2739
+ ye,
2680
2740
  {
2681
2741
  value: D,
2682
- onChange: (f) => V(f.target.value),
2742
+ onChange: (f) => ae(f.target.value),
2683
2743
  type: "url",
2684
2744
  placeholder: "(optional) https://...",
2685
- isDisabled: n
2745
+ isDisabled: t
2686
2746
  }
2687
2747
  )
2688
2748
  ] }),
2689
- /* @__PURE__ */ e.jsxs(J, { children: [
2749
+ /* @__PURE__ */ e.jsxs(X, { children: [
2690
2750
  /* @__PURE__ */ e.jsx(le, { children: "Description" }),
2691
2751
  /* @__PURE__ */ e.jsx(
2692
- We,
2752
+ Qe,
2693
2753
  {
2694
- value: A,
2695
- onChange: (f) => R(f.target.value),
2754
+ value: $,
2755
+ onChange: (f) => O(f.target.value),
2696
2756
  rows: 2,
2697
2757
  placeholder: "(optional) Describe how to perform the test or exercise",
2698
- isDisabled: n
2758
+ isDisabled: t
2699
2759
  }
2700
2760
  )
2701
2761
  ] })
2702
2762
  ] }),
2703
2763
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
2704
2764
  /* @__PURE__ */ e.jsx(le, { children: "Metadata Tags" }),
2705
- w.map((f) => /* @__PURE__ */ e.jsxs(J, { children: [
2765
+ R.map((f) => /* @__PURE__ */ e.jsxs(X, { children: [
2706
2766
  /* @__PURE__ */ e.jsx(le, { children: f.label }),
2707
2767
  /* @__PURE__ */ e.jsx(
2708
2768
  he,
2709
2769
  {
2710
2770
  isMulti: f.multi,
2711
- value: E[f.key]?.filter(
2712
- (P) => ee.includes(P.id)
2771
+ value: B[f.key]?.filter(
2772
+ (z) => Z.includes(z.id)
2713
2773
  ),
2714
- onChange: (P) => {
2715
- $t(f.key, P);
2774
+ onChange: (z) => {
2775
+ Gt(f.key, z);
2716
2776
  },
2717
- options: E[f.key],
2777
+ options: B[f.key],
2718
2778
  placeholder: `Select ${f.multi ? "one or more" : "one"} ${f.label.toLowerCase()}`,
2719
- isDisabled: n,
2779
+ isDisabled: t,
2720
2780
  isClearable: f.multi
2721
2781
  }
2722
2782
  )
2723
2783
  ] }, f.key))
2724
2784
  ] })
2725
2785
  ] }) }),
2726
- /* @__PURE__ */ e.jsx(gt, { px: 0, children: /* @__PURE__ */ e.jsxs(
2786
+ /* @__PURE__ */ e.jsx(xt, { px: 0, children: /* @__PURE__ */ e.jsxs(
2727
2787
  "div",
2728
2788
  {
2729
- className: He(
2789
+ className: Je(
2730
2790
  "grid grid-cols-1 gap-6",
2731
- !n && "md:grid-cols-2"
2791
+ !t && "md:grid-cols-2"
2732
2792
  ),
2733
2793
  children: [
2734
- /* @__PURE__ */ e.jsxs("div", { className: He("space-y-4", n && "hidden"), children: [
2794
+ /* @__PURE__ */ e.jsxs("div", { className: Je("space-y-4", t && "hidden"), children: [
2735
2795
  /* @__PURE__ */ e.jsx(le, { children: "Add New Report" }),
2736
- /* @__PURE__ */ e.jsxs(J, { children: [
2796
+ /* @__PURE__ */ e.jsxs(X, { children: [
2737
2797
  /* @__PURE__ */ e.jsx(le, { children: "Report Name" }),
2738
2798
  /* @__PURE__ */ e.jsx(
2739
- ve,
2799
+ ye,
2740
2800
  {
2741
2801
  value: i,
2742
- onChange: (f) => t(f.target.value),
2802
+ onChange: (f) => a(f.target.value),
2743
2803
  maxLength: 120,
2744
2804
  type: "text",
2745
2805
  placeholder: "Enter report name...",
2746
- isDisabled: n
2806
+ isDisabled: t
2747
2807
  }
2748
2808
  )
2749
2809
  ] }),
2750
- /* @__PURE__ */ e.jsxs(J, { children: [
2810
+ /* @__PURE__ */ e.jsxs(X, { children: [
2751
2811
  /* @__PURE__ */ e.jsx(le, { children: "Report Type" }),
2752
2812
  /* @__PURE__ */ e.jsx(
2753
2813
  he,
2754
2814
  {
2755
- value: _ ? Te.find(
2756
- (f) => f.value === _
2815
+ value: U ? Se.find(
2816
+ (f) => f.value === U
2757
2817
  ) : null,
2758
- onChange: (f) => q(f?.value || null),
2759
- options: Te,
2818
+ onChange: (f) => H(f?.value || null),
2819
+ options: Se,
2760
2820
  placeholder: "Select report type...",
2761
- isDisabled: n,
2821
+ isDisabled: t,
2762
2822
  isClearable: !0
2763
2823
  }
2764
2824
  )
2765
2825
  ] }),
2766
- _ !== ae.PointOfInterest && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
2767
- /* @__PURE__ */ e.jsxs(J, { children: [
2826
+ U !== ie.PointOfInterest && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
2827
+ /* @__PURE__ */ e.jsxs(X, { children: [
2768
2828
  /* @__PURE__ */ e.jsx(le, { children: "Default Parameters" }),
2769
2829
  /* @__PURE__ */ e.jsx(
2770
- bt,
2830
+ yt,
2771
2831
  {
2772
- options: ye,
2773
- value: l,
2774
- onChange: L,
2775
- editOnly: n
2832
+ options: we,
2833
+ value: C,
2834
+ onChange: l,
2835
+ editOnly: t
2776
2836
  }
2777
2837
  )
2778
2838
  ] }),
2779
- /* @__PURE__ */ e.jsxs(J, { children: [
2839
+ /* @__PURE__ */ e.jsxs(X, { children: [
2780
2840
  /* @__PURE__ */ e.jsx(le, { children: "Sensor Locations" }),
2781
2841
  /* @__PURE__ */ e.jsx(
2782
- ve,
2842
+ ye,
2783
2843
  {
2784
- value: W.map(
2785
- (f) => yt(f)
2844
+ value: S.map(
2845
+ (f) => vt(f)
2786
2846
  ).join(", "),
2787
2847
  placeholder: "Auto-filled based on parameters...",
2788
2848
  isDisabled: !0
@@ -2790,40 +2850,40 @@ const Tn = ({
2790
2850
  )
2791
2851
  ] })
2792
2852
  ] }),
2793
- _ === ae.PointOfInterest && /* @__PURE__ */ e.jsxs(J, { children: [
2853
+ U === ie.PointOfInterest && /* @__PURE__ */ e.jsxs(X, { children: [
2794
2854
  /* @__PURE__ */ e.jsx(le, { children: "Instructions" }),
2795
2855
  /* @__PURE__ */ e.jsx(
2796
- We,
2856
+ Qe,
2797
2857
  {
2798
- value: Q,
2799
- onChange: (f) => U(f.target.value),
2858
+ value: G,
2859
+ onChange: (f) => Q(f.target.value),
2800
2860
  rows: 3,
2801
2861
  placeholder: "Enter specific instructions for this report...",
2802
- isDisabled: n
2862
+ isDisabled: t
2803
2863
  }
2804
2864
  )
2805
2865
  ] }),
2806
2866
  /* @__PURE__ */ e.jsx("div", { className: "w-full flex justify-end", children: /* @__PURE__ */ e.jsx(
2807
- ne,
2867
+ te,
2808
2868
  {
2809
2869
  colorScheme: "blue",
2810
- onClick: Re,
2811
- isDisabled: !_ || !i.trim() || n || Te.length === 0 || _ !== ae.PointOfInterest && l.length === 0,
2870
+ onClick: $e,
2871
+ isDisabled: !U || !i.trim() || t || Se.length === 0 || U !== ie.PointOfInterest && C.length === 0,
2812
2872
  children: "Add Report"
2813
2873
  }
2814
2874
  ) })
2815
2875
  ] }),
2816
2876
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
2817
2877
  /* @__PURE__ */ e.jsx(le, { children: "Configured Reports" }),
2818
- H.length === 0 ? /* @__PURE__ */ e.jsx(k, { fontSize: "sm", color: "gray.500", children: "No reports created yet" }) : /* @__PURE__ */ e.jsx("div", { className: "space-y-3", children: H.map((f) => /* @__PURE__ */ e.jsxs(
2878
+ Y.length === 0 ? /* @__PURE__ */ e.jsx(M, { fontSize: "sm", color: "gray.500", children: "No reports created yet" }) : /* @__PURE__ */ e.jsx("div", { className: "space-y-3", children: Y.map((f) => /* @__PURE__ */ e.jsxs(
2819
2879
  "div",
2820
2880
  {
2821
2881
  className: "p-3 border border-gray-200 rounded-md bg-gray-50 flex flex-col gap-2",
2822
2882
  children: [
2823
2883
  /* @__PURE__ */ e.jsxs("div", { className: "flex justify-between items-start", children: [
2824
- /* @__PURE__ */ e.jsx(k, { fontSize: "sm", color: "gray.600", children: Se(f.kind) }),
2825
- !n && /* @__PURE__ */ e.jsx(
2826
- ne,
2884
+ /* @__PURE__ */ e.jsx(M, { fontSize: "sm", color: "gray.600", children: ke(f.kind) }),
2885
+ !t && /* @__PURE__ */ e.jsx(
2886
+ te,
2827
2887
  {
2828
2888
  size: "xs",
2829
2889
  colorScheme: "red",
@@ -2833,25 +2893,25 @@ const Tn = ({
2833
2893
  }
2834
2894
  )
2835
2895
  ] }),
2836
- /* @__PURE__ */ e.jsxs(J, { children: [
2896
+ /* @__PURE__ */ e.jsxs(X, { children: [
2837
2897
  /* @__PURE__ */ e.jsx(le, { children: "Report Name" }),
2838
2898
  /* @__PURE__ */ e.jsx(
2839
- ve,
2899
+ ye,
2840
2900
  {
2841
2901
  value: f.name,
2842
- onChange: (P) => ie(
2843
- (G) => G.map(
2844
- ($) => $.id === f.id ? { ...$, name: P.target.value } : $
2902
+ onChange: (z) => re(
2903
+ (P) => P.map(
2904
+ (F) => F.id === f.id ? { ...F, name: z.target.value } : F
2845
2905
  )
2846
2906
  ),
2847
2907
  placeholder: "Enter report name...",
2848
- isDisabled: n
2908
+ isDisabled: t
2849
2909
  }
2850
2910
  )
2851
2911
  ] }),
2852
- /* @__PURE__ */ e.jsxs(J, { display: "flex", alignItems: "center", children: [
2912
+ /* @__PURE__ */ e.jsxs(X, { display: "flex", alignItems: "center", children: [
2853
2913
  /* @__PURE__ */ e.jsx(
2854
- Pe,
2914
+ _e,
2855
2915
  {
2856
2916
  htmlFor: `auto-generate-${f.id}`,
2857
2917
  mb: "0",
@@ -2863,56 +2923,56 @@ const Tn = ({
2863
2923
  {
2864
2924
  id: `auto-generate-${f.id}`,
2865
2925
  isChecked: f.autoGenerate ?? !1,
2866
- onChange: (P) => ie(
2867
- (G) => G.map(
2868
- ($) => $.id === f.id ? { ...$, autoGenerate: P.target.checked } : $
2926
+ onChange: (z) => re(
2927
+ (P) => P.map(
2928
+ (F) => F.id === f.id ? { ...F, autoGenerate: z.target.checked } : F
2869
2929
  )
2870
2930
  ),
2871
- isDisabled: n
2931
+ isDisabled: t
2872
2932
  }
2873
2933
  )
2874
2934
  ] }),
2875
- f.kind === ae.PointOfInterest && /* @__PURE__ */ e.jsxs(J, { children: [
2935
+ f.kind === ie.PointOfInterest && /* @__PURE__ */ e.jsxs(X, { children: [
2876
2936
  /* @__PURE__ */ e.jsx(le, { children: "Instructions" }),
2877
2937
  /* @__PURE__ */ e.jsx(
2878
- We,
2938
+ Qe,
2879
2939
  {
2880
2940
  value: f.instructions,
2881
- onChange: (P) => ie(
2882
- (G) => G.map(
2883
- ($) => $.id === f.id ? { ...$, instructions: P.target.value } : $
2941
+ onChange: (z) => re(
2942
+ (P) => P.map(
2943
+ (F) => F.id === f.id ? { ...F, instructions: z.target.value } : F
2884
2944
  )
2885
2945
  ),
2886
2946
  rows: 3,
2887
2947
  placeholder: "Enter specific instructions for this report...",
2888
- isDisabled: n
2948
+ isDisabled: t
2889
2949
  }
2890
2950
  )
2891
2951
  ] }),
2892
- f.kind !== ae.PointOfInterest && /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col", children: [
2952
+ f.kind !== ie.PointOfInterest && /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col", children: [
2893
2953
  /* @__PURE__ */ e.jsx(le, { children: "Default Parameters" }),
2894
2954
  /* @__PURE__ */ e.jsx(
2895
- bt,
2955
+ yt,
2896
2956
  {
2897
- options: ye,
2957
+ options: we,
2898
2958
  value: f.parameters,
2899
- onChange: (P) => {
2900
- const G = (te) => "joint" in te.id ? te.id.joint : te.id.segment, $ = P.map(G), oe = ft($);
2901
- ie(
2902
- (te) => te.map(
2903
- (de) => de.id === f.id ? { ...de, parameters: P, sensorLocations: oe } : de
2959
+ onChange: (z) => {
2960
+ const P = (ee) => "joint" in ee.id ? ee.id.joint : ee.id.segment, F = z.map(P), ne = jt(F);
2961
+ re(
2962
+ (ee) => ee.map(
2963
+ (de) => de.id === f.id ? { ...de, parameters: z, sensorLocations: ne } : de
2904
2964
  )
2905
2965
  );
2906
2966
  },
2907
- editOnly: n
2967
+ editOnly: t
2908
2968
  }
2909
2969
  )
2910
2970
  ] }),
2911
- f.kind !== ae.PointOfInterest && /* @__PURE__ */ e.jsxs(k, { fontSize: "sm", color: "gray.600", children: [
2971
+ f.kind !== ie.PointOfInterest && /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", color: "gray.600", children: [
2912
2972
  "Sensors:",
2913
2973
  " ",
2914
2974
  f.sensorLocations.map(
2915
- (P) => yt(P)
2975
+ (z) => vt(z)
2916
2976
  ).join(", ")
2917
2977
  ] })
2918
2978
  ]
@@ -2926,19 +2986,19 @@ const Tn = ({
2926
2986
  ] })
2927
2987
  ] }),
2928
2988
  /* @__PURE__ */ e.jsx(
2929
- Z,
2989
+ V,
2930
2990
  {
2931
2991
  justify: "end",
2932
- className: He((m || n) && "!hidden"),
2933
- children: /* @__PURE__ */ e.jsxs(Ae, { gap: 4, children: [
2934
- /* @__PURE__ */ e.jsx(ne, { colorScheme: "gray", isDisabled: x, onClick: a, children: "Cancel" }),
2992
+ className: Je((m || t) && "!hidden"),
2993
+ children: /* @__PURE__ */ e.jsxs(Ne, { gap: 4, children: [
2994
+ /* @__PURE__ */ e.jsx(te, { colorScheme: "gray", isDisabled: x, onClick: r, children: "Cancel" }),
2935
2995
  /* @__PURE__ */ e.jsx(
2936
- ne,
2996
+ te,
2937
2997
  {
2938
2998
  colorScheme: "blue",
2939
- isDisabled: x || !Ee || !Ne,
2999
+ isDisabled: x || !ze || !Re,
2940
3000
  isLoading: x,
2941
- onClick: Ie,
3001
+ onClick: Le,
2942
3002
  children: "Save changes"
2943
3003
  }
2944
3004
  )
@@ -2946,168 +3006,168 @@ const Tn = ({
2946
3006
  }
2947
3007
  )
2948
3008
  ] });
2949
- }, le = ({ children: o }) => /* @__PURE__ */ e.jsx(Pe, { fontWeight: "bold", fontFamily: "sans-serif", fontSize: "large", children: o }), Zn = ({
2950
- children: o,
2951
- isView: s,
2952
- metadataKeys: a
3009
+ }, le = ({ children: s }) => /* @__PURE__ */ e.jsx(_e, { fontWeight: "bold", fontFamily: "sans-serif", fontSize: "large", children: s }), es = ({
3010
+ children: s,
3011
+ isView: n,
3012
+ metadataKeys: r
2953
3013
  }) => {
2954
- const [p, m] = z({}), h = at();
3014
+ const [p, m] = q({}), h = lt();
2955
3015
  return ce(() => {
2956
3016
  let c = !1;
2957
3017
  return (async () => {
2958
- const n = (a ?? []).map(
2959
- (y) => h.query(ot, { key: y }).toPromise()
2960
- ), r = await Promise.all(n), d = {};
2961
- for (const y of r) {
3018
+ const t = (r ?? []).map(
3019
+ (y) => h.query(at, { key: y }).toPromise()
3020
+ ), o = await Promise.all(t), u = {};
3021
+ for (const y of o) {
2962
3022
  if (y.error || !y.data?.getMetadataByKey) continue;
2963
- const j = M(
3023
+ const j = A(
2964
3024
  je,
2965
3025
  y.data.getMetadataByKey
2966
3026
  );
2967
3027
  if (!j) continue;
2968
- const v = M(be, j.data) ?? [];
2969
- d[j.key] = v.map((C) => ({
2970
- label: C.label || C.value,
2971
- value: C.value,
2972
- id: C.id
3028
+ const w = A(be, j.data) ?? [];
3029
+ u[j.key] = w.map((I) => ({
3030
+ label: I.label || I.value,
3031
+ value: I.value,
3032
+ id: I.id
2973
3033
  }));
2974
3034
  }
2975
- c || m(d);
3035
+ c || m(u);
2976
3036
  })(), () => {
2977
3037
  c = !0;
2978
3038
  };
2979
- }, [h, a]), /* @__PURE__ */ e.jsx(Rt.Provider, { value: { isView: s, metadataOptions: p }, children: o });
2980
- }, ys = ({
2981
- id: o,
2982
- onCancel: s,
2983
- onSave: a,
3039
+ }, [h, r]), /* @__PURE__ */ e.jsx($t.Provider, { value: { isView: n, metadataOptions: p }, children: s });
3040
+ }, Cs = ({
3041
+ id: s,
3042
+ onCancel: n,
3043
+ onSave: r,
2984
3044
  onError: p,
2985
3045
  hideButtons: m,
2986
3046
  quantumOwned: h,
2987
3047
  setButtonOnClick: c,
2988
3048
  setButtonDisabled: b,
2989
- isView: n
3049
+ isView: t
2990
3050
  }) => {
2991
- const [{ data: r, fetching: d }] = we({
3051
+ const [{ data: o, fetching: u }] = Ce({
2992
3052
  query: h ? hn : pn
2993
- }), [{ data: y }] = we({
3053
+ }), [{ data: y }] = Ce({
2994
3054
  query: gn,
2995
- variables: { id: o },
2996
- pause: !o
2997
- }), [{ data: j }] = we({
3055
+ variables: { id: s },
3056
+ pause: !s
3057
+ }), [{ data: j }] = Ce({
2998
3058
  query: xn
2999
- }), v = M(
3000
- Fe,
3059
+ }), w = A(
3060
+ Pe,
3001
3061
  j?.moduleCategories
3002
- ), [{ fetching: C }, I] = fe(Ot), [{ fetching: x }, u] = fe(Mt), S = T(() => !r || d ? [] : M(
3003
- Ce,
3004
- h ? r?.quantumOwnedActions ?? [] : r?.actions ?? []
3005
- ).filter((_) => !!_?.id), [r, h, d]), g = M(Ye, y?.module), w = T(() => M(At, g?.moduleActions) ?? [], [g?.moduleActions]), [O, B] = z([]), [A, R] = z(g?.name ?? ""), [X, se] = z([]), [D, V] = z(g?.description ?? ""), [ee, N] = z([]);
3062
+ ), [{ fetching: I }, L] = fe(Ot), [{ fetching: x }, d] = fe(At), k = N(() => !o || u ? [] : A(
3063
+ ve,
3064
+ h ? o?.quantumOwnedActions ?? [] : o?.actions ?? []
3065
+ ).filter((U) => !!U?.id), [o, h, u]), g = A(Ye, y?.module), R = N(() => A(Tt, g?.moduleActions) ?? [], [g?.moduleActions]), [v, E] = q([]), [$, O] = q(g?.name ?? ""), [K, oe] = q([]), [D, ae] = q(g?.description ?? ""), [Z, T] = q([]);
3006
3066
  ce(() => {
3007
3067
  if (g) {
3008
- const Y = w.map((i, t) => ({
3009
- key: i.id ?? `${i.actionId}-${t}`,
3068
+ const J = R.map((i, a) => ({
3069
+ key: i.id ?? `${i.actionId}-${a}`,
3010
3070
  actionId: i.actionId,
3011
3071
  reportId: i.reportId || null
3012
3072
  }));
3013
- B(Y), R(g.name), V(g.description ?? ""), se(
3073
+ E(J), O(g.name), ae(g.description ?? ""), oe(
3014
3074
  g.categories.map(
3015
- (i) => M(Fe, i).id
3075
+ (i) => A(Pe, i).id
3016
3076
  ) ?? []
3017
3077
  );
3018
- const q = M(
3078
+ const H = A(
3019
3079
  je,
3020
3080
  g.metadataGroups
3021
3081
  ).map(
3022
- (i) => i.data.map((t) => M(be, t).id)
3082
+ (i) => i.data.map((a) => A(be, a).id)
3023
3083
  );
3024
- N(q.flat());
3084
+ T(H.flat());
3025
3085
  }
3026
- }, [g, w]);
3027
- const E = F(() => {
3028
- let Y;
3029
- const _ = {
3030
- moduleActions: O.map((q) => ({
3031
- actionId: q.actionId,
3032
- reportId: q.reportId ?? void 0
3086
+ }, [g, R]);
3087
+ const B = _(() => {
3088
+ let J;
3089
+ const U = {
3090
+ moduleActions: v.map((H) => ({
3091
+ actionId: H.actionId,
3092
+ reportId: H.reportId ?? void 0
3033
3093
  })),
3034
- name: A,
3035
- categories: X.filter((q) => q !== "other"),
3094
+ name: $,
3095
+ categories: K.filter((H) => H !== "other"),
3036
3096
  description: D,
3037
3097
  quantumOwned: h,
3038
- metadataItemIds: ee
3098
+ metadataItemIds: Z
3039
3099
  };
3040
- g ? Y = I({
3100
+ g ? J = L({
3041
3101
  id: g.id,
3042
- input: _
3043
- }) : Y = u({
3044
- input: _
3045
- }), Y.then(({ error: q }) => {
3046
- q ? p(q instanceof Error ? q : new Error(String(q))) : a();
3102
+ input: U
3103
+ }) : J = d({
3104
+ input: U
3105
+ }), J.then(({ error: H }) => {
3106
+ H ? p(H instanceof Error ? H : new Error(String(H))) : r();
3047
3107
  });
3048
3108
  }, [
3049
- u,
3050
- I,
3051
- O,
3052
- A,
3109
+ d,
3110
+ L,
3111
+ v,
3112
+ $,
3053
3113
  D,
3054
- X,
3055
- ee,
3114
+ K,
3115
+ Z,
3056
3116
  g,
3057
- a,
3117
+ r,
3058
3118
  p,
3059
3119
  h
3060
3120
  ]);
3061
3121
  return ce(() => {
3062
3122
  b && b({
3063
- cancelButton: C || x,
3064
- saveButton: C || x || !A || D.trim().split(/\s+/).filter(Boolean).length > 40
3123
+ cancelButton: I || x,
3124
+ saveButton: I || x || !$ || D.trim().split(/\s+/).filter(Boolean).length > 40
3065
3125
  });
3066
- }, [b, C, x, O, A, D]), ce(() => {
3126
+ }, [b, I, x, v, $, D]), ce(() => {
3067
3127
  c && c({
3068
- cancelButton: s,
3069
- saveButton: E
3128
+ cancelButton: n,
3129
+ saveButton: B
3070
3130
  });
3071
- }, [c, s, E]), /* @__PURE__ */ e.jsx(re, { width: "100%", children: /* @__PURE__ */ e.jsxs(
3072
- Zn,
3131
+ }, [c, n, B]), /* @__PURE__ */ e.jsx(se, { width: "100%", children: /* @__PURE__ */ e.jsxs(
3132
+ es,
3073
3133
  {
3074
- isView: n,
3134
+ isView: t,
3075
3135
  metadataKeys: ["activity_type", "session_type", "body_region", "sport"],
3076
3136
  children: [
3077
3137
  /* @__PURE__ */ e.jsx(
3078
- Bn,
3138
+ Wn,
3079
3139
  {
3080
- name: A,
3081
- setName: R,
3082
- actions: S,
3083
- moduleActionEntries: O,
3084
- setModuleActionEntries: B,
3085
- availableCategories: v ?? [],
3086
- selectedCategoryIds: X,
3087
- setSelectedCategoryIds: se,
3140
+ name: $,
3141
+ setName: O,
3142
+ actions: k,
3143
+ moduleActionEntries: v,
3144
+ setModuleActionEntries: E,
3145
+ availableCategories: w ?? [],
3146
+ selectedCategoryIds: K,
3147
+ setSelectedCategoryIds: oe,
3088
3148
  description: D,
3089
- setDescription: V,
3090
- selectedMetadataIds: ee,
3091
- setSelectedMetadataIds: N
3149
+ setDescription: ae,
3150
+ selectedMetadataIds: Z,
3151
+ setSelectedMetadataIds: T
3092
3152
  }
3093
3153
  ),
3094
- !m && !n && /* @__PURE__ */ e.jsx(Z, { justifyContent: "flex-start", children: /* @__PURE__ */ e.jsxs(Ae, { mt: 16, gap: 4, children: [
3154
+ !m && !t && /* @__PURE__ */ e.jsx(V, { justifyContent: "flex-start", children: /* @__PURE__ */ e.jsxs(Ne, { mt: 16, gap: 4, children: [
3095
3155
  /* @__PURE__ */ e.jsx(
3096
- ne,
3156
+ te,
3097
3157
  {
3098
3158
  colorScheme: "gray",
3099
- isDisabled: C || x,
3100
- onClick: s,
3159
+ isDisabled: I || x,
3160
+ onClick: n,
3101
3161
  children: "Cancel"
3102
3162
  }
3103
3163
  ),
3104
3164
  /* @__PURE__ */ e.jsx(
3105
- ne,
3165
+ te,
3106
3166
  {
3107
3167
  colorScheme: "blue",
3108
- isDisabled: C || x || !A || D.trim().split(/\s+/).filter(Boolean).length > 40,
3109
- isLoading: C || x,
3110
- onClick: E,
3168
+ isDisabled: I || x || !$ || D.trim().split(/\s+/).filter(Boolean).length > 40,
3169
+ isLoading: I || x,
3170
+ onClick: B,
3111
3171
  children: "Save"
3112
3172
  }
3113
3173
  )
@@ -3117,12 +3177,12 @@ const Tn = ({
3117
3177
  ) });
3118
3178
  };
3119
3179
  export {
3120
- zn as ActivityList,
3121
- fs as CopyActivityForm,
3122
- js as CopyModuleForm,
3123
- Bn as ModuleForm,
3124
- Jn as ParameterEditList,
3125
- bt as ParameterEditSelect,
3126
- bs as UpsertActivityForm,
3127
- ys as UpsertModuleForm
3180
+ Un as ActivityList,
3181
+ bs as CopyActivityForm,
3182
+ ys as CopyModuleForm,
3183
+ Wn as ModuleForm,
3184
+ Zn as ParameterEditList,
3185
+ yt as ParameterEditSelect,
3186
+ vs as UpsertActivityForm,
3187
+ Cs as UpsertModuleForm
3128
3188
  };