quantum-component-library 1.4.47-dev.4 → 1.4.47-dev.6

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,51 @@
1
1
  import { j as e } from "./react-jsx-runtime-vendor-OVHDjVDe.js";
2
- import { Flex as me, InputGroup as Le, InputLeftElement as lt, Icon as Ue, Input as je, FormLabel as We, Box as J, TableContainer as Be, Table as Qe, Thead as qe, Tr as Se, Th as ce, Tbody as He, Td as he, ButtonGroup as pe, Tooltip as at, Button as X, RangeSlider as ct, RangeSliderMark as Ne, Text as b, RangeSliderTrack as dt, RangeSliderFilledTrack as ut, RangeSliderThumb as Fe, Select as Re, NumberInput as ke, NumberInputField as De, HStack as te, Tag as fe, Checkbox as ht, useToast as Ye, VStack as ee, FormControl as B, RadioGroup as Je, Radio as Te, Alert as Ae, AlertIcon as Me, Spinner as Xe, useDisclosure as mt, Modal as pt, ModalOverlay as gt, ModalContent as xt, ModalHeader as jt, ModalCloseButton as ft, ModalBody as vt, ModalFooter as yt, IconButton as bt, Textarea as Ee } from "@chakra-ui/react";
3
- import { useMemo as D, useState as z, useCallback as R, useRef as Ct, useEffect as se, memo as Oe } from "react";
2
+ import { Flex as me, InputGroup as Le, InputLeftElement as lt, Icon as We, Input as je, FormLabel as Ue, Box as J, TableContainer as Be, Table as Qe, Thead as qe, Tr as Se, Th as ce, Tbody as He, Td as he, ButtonGroup as pe, Tooltip as at, Button as X, RangeSlider as ct, RangeSliderMark as Ne, Text as w, RangeSliderTrack as dt, RangeSliderFilledTrack as ut, RangeSliderThumb as Fe, Select as Re, NumberInput as ke, NumberInputField as De, HStack as te, Tag as fe, Checkbox as ht, useToast as Ye, VStack as ee, FormControl as B, RadioGroup as Je, Radio as Ae, Alert as Te, AlertIcon as Me, Spinner as Xe, useDisclosure as mt, Modal as pt, ModalOverlay as gt, ModalContent as xt, ModalHeader as jt, ModalCloseButton as ft, ModalBody as vt, ModalFooter as yt, IconButton as bt, Textarea as Ee } from "@chakra-ui/react";
3
+ import { useMemo as k, useState as z, useCallback as F, useRef as Ct, useEffect as ne, memo as Oe } from "react";
4
4
  import { u as wt } from "./ufuzzy-vendor-Dl0ZI6Av.js";
5
- import { s as ne } from "./react-select-vendor-BlY9Il4Q.js";
6
- import { F as St, a as Tt } from "./react-icons-vendor-TETORdU9.js";
5
+ import { s as se } from "./react-select-vendor-BlY9Il4Q.js";
6
+ import { F as St, a as At } from "./react-icons-vendor-TETORdU9.js";
7
7
  import { u as le, a as oe } from "./graphql-vendor-B0NjgbDB.js";
8
- import { g as _, T as Ce, S as P, a as At, A as Mt, b as Ot } from "./generated-CB1E0us8.js";
9
- import { M as de, A as ae, G as Ke, a as Nt, C as Ie, b as Ve, c as Ze, d as we, e as et, f as It, U as tt, g as st, h as Lt, i as Ft, j as nt, k as Rt, l as kt, m as Dt } from "./graphql-BqoQHgu9.js";
10
- import { D as Et, H as zt, u as Pt, a as $t } from "./react-dnd-vendor-D4nn9Mqx.js";
11
- import { getSegmentNameWithPlane as ot, getJointNameWithPlane as rt, getJointAngleDirectionName as _t, getSegmentAngleDirectionName as Gt, getNormativeJointRange as Ut, mapSessionTypeEnumToLabel as ze, getActivityKindFromActivityType as Wt, mapActivityTypeEnumToLabel as Pe } from "./services.js";
12
- import { availablePlanes as $e, getAnalysisPartIdNoSide as ve } from "./types.js";
8
+ import { getFragmentData as _ } from "./generated.js";
9
+ import { M as de, A as ae, G as Ze, a as Tt, C as Ie, b as Ke, c as Ve, d as Ce, e as et, f as Mt, U as tt, g as nt, h as Ot, i as Nt, j as st, k as It, l as Lt, m as Ft } from "./graphql-CvUc6Vdv.js";
10
+ import { D as Rt, H as kt, u as Dt, a as Et } from "./react-dnd-vendor-D4nn9Mqx.js";
11
+ import { ThresholdKind as we, SensorLocation as $, SessionType as zt, ActionLaterality as $t, ActivityType as Pt } from "./generated-graphql.js";
12
+ import { getSegmentNameWithPlane as ot, getJointNameWithPlane as rt, getJointAngleDirectionName as _t, getSegmentAngleDirectionName as Gt, getNormativeJointRange as Wt, mapSessionTypeEnumToLabel as ze, getActivityKindFromActivityType as Ut, mapActivityTypeEnumToLabel as $e } from "./services.js";
13
+ import { availablePlanes as Pe, getAnalysisPartIdNoSide as ve } from "./types.js";
13
14
  import { thresholdsToParameters as Bt, parametersToThresholds as _e, cn as Qt } from "./utils.js";
14
15
  import { usePartOptionsForSensorLocations as qt } from "./hooks.js";
15
16
  const Ht = ({
16
- setSearch: n,
17
- actions: s,
18
- updateUseCases: o
17
+ setSearch: s,
18
+ actions: n,
19
+ updateUseCases: o,
20
+ hideUseCaseFilter: a = !1
19
21
  }) => {
20
- const c = D(
21
- () => s?.flatMap((i) => i.useCases).filter((i, l, u) => u.findIndex((x) => x.id === i.id) === l).map((i) => ({
22
- label: i.name,
23
- value: i.id
22
+ const c = k(
23
+ () => n?.flatMap((r) => r.useCases).filter((r, d, j) => j.findIndex((l) => l.id === r.id) === d).map((r) => ({
24
+ label: r.name,
25
+ value: r.id
24
26
  })) || [],
25
- [s]
27
+ [n]
26
28
  );
27
29
  return /* @__PURE__ */ e.jsxs(me, { width: "100%", alignContent: "space-evenly", gap: 4, children: [
28
- /* @__PURE__ */ e.jsxs(Le, { size: "md", children: [
29
- /* @__PURE__ */ e.jsx(lt, { children: /* @__PURE__ */ e.jsx(Ue, { as: St, color: "gray.300" }) }),
30
+ /* @__PURE__ */ e.jsxs(Le, { size: "md", flex: 1, children: [
31
+ /* @__PURE__ */ e.jsx(lt, { children: /* @__PURE__ */ e.jsx(We, { as: St, color: "gray.300" }) }),
30
32
  /* @__PURE__ */ e.jsx(
31
33
  je,
32
34
  {
33
35
  placeholder: "Search by name...",
34
- maxW: "30rem",
35
- onChange: (i) => n(i.target.value)
36
+ width: "100%",
37
+ maxW: a ? void 0 : "30rem",
38
+ onChange: (r) => s(r.target.value)
36
39
  }
37
40
  )
38
41
  ] }),
39
- /* @__PURE__ */ e.jsx(Le, { size: "md", children: /* @__PURE__ */ e.jsx(
40
- ne,
42
+ !a && /* @__PURE__ */ e.jsx(Le, { size: "md", children: /* @__PURE__ */ e.jsx(
43
+ se,
41
44
  {
42
45
  size: "md",
43
46
  chakraStyles: {
44
- container: (i) => ({
45
- ...i,
47
+ container: (r) => ({
48
+ ...r,
46
49
  width: "100%"
47
50
  })
48
51
  },
@@ -50,192 +53,192 @@ const Ht = ({
50
53
  placeholder: "Filter use case",
51
54
  isMulti: !0,
52
55
  options: c,
53
- onChange: (i) => o(i.map((l) => l.value))
56
+ onChange: (r) => o(r.map((d) => d.value))
54
57
  }
55
58
  ) })
56
59
  ] });
57
60
  }, re = ({
58
- children: n
59
- }) => /* @__PURE__ */ e.jsx(We, { fontWeight: "bold", fontFamily: "sans-serif", fontSize: "large", children: n }), Yt = ({ value: n, onChange: s }) => {
61
+ children: s
62
+ }) => /* @__PURE__ */ e.jsx(Ue, { fontWeight: "bold", fontFamily: "sans-serif", fontSize: "large", children: s }), Yt = ({ value: s, onChange: n }) => {
60
63
  const o = z(
61
64
  () => Math.random().toString(36).substring(2, 15)
62
- )[0], c = R(
63
- (i, l) => {
64
- s((u) => {
65
- const x = [...u], [a] = x.splice(i, 1);
66
- return x.splice(l, 0, a), x;
65
+ )[0], a = F(
66
+ (c, r) => {
67
+ n((d) => {
68
+ const j = [...d], [l] = j.splice(c, 1);
69
+ return j.splice(r, 0, l), j;
67
70
  });
68
71
  },
69
- [s]
72
+ [n]
70
73
  );
71
- return /* @__PURE__ */ e.jsx(J, { children: /* @__PURE__ */ e.jsx(Et, { backend: zt, children: /* @__PURE__ */ e.jsx(Be, { children: /* @__PURE__ */ e.jsxs(Qe, { variant: "simple", size: "md", children: [
74
+ return /* @__PURE__ */ e.jsx(J, { children: /* @__PURE__ */ e.jsx(Rt, { backend: kt, children: /* @__PURE__ */ e.jsx(Be, { children: /* @__PURE__ */ e.jsxs(Qe, { variant: "simple", size: "md", children: [
72
75
  /* @__PURE__ */ e.jsx(qe, { children: /* @__PURE__ */ e.jsxs(Se, { children: [
73
76
  /* @__PURE__ */ e.jsx(ce, { children: "Order" }),
74
77
  /* @__PURE__ */ e.jsx(ce, { children: "Name" })
75
78
  ] }) }),
76
- /* @__PURE__ */ e.jsx(He, { children: n.map((i, l) => /* @__PURE__ */ e.jsx(
79
+ /* @__PURE__ */ e.jsx(He, { children: s.map((c, r) => /* @__PURE__ */ e.jsx(
77
80
  Jt,
78
81
  {
79
82
  listKey: o,
80
- index: l,
81
- id: i.id,
82
- name: i.name,
83
- move: c
83
+ index: r,
84
+ id: c.id,
85
+ name: c.name,
86
+ move: a
84
87
  },
85
- i.id
88
+ c.id
86
89
  )) })
87
90
  ] }) }) }) });
88
- }, Jt = ({ listKey: n, index: s, id: o, name: c, move: i }) => {
89
- const l = Ct(null), [{ handlerId: u }, x] = Pt({
90
- accept: n,
91
- collect: (j) => ({
92
- handlerId: j.getHandlerId()?.toString() ?? ""
91
+ }, Jt = ({ listKey: s, index: n, id: o, name: a, move: c }) => {
92
+ const r = Ct(null), [{ handlerId: d }, j] = Dt({
93
+ accept: s,
94
+ collect: (f) => ({
95
+ handlerId: f.getHandlerId()?.toString() ?? ""
93
96
  }),
94
- hover: (j, f) => {
95
- if (!l.current)
97
+ hover: (f, v) => {
98
+ if (!r.current)
96
99
  return;
97
- const r = j.index, d = s;
98
- if (r === d)
100
+ const i = f.index, u = n;
101
+ if (i === u)
99
102
  return;
100
- const p = l.current?.getBoundingClientRect(), g = (p.bottom - p.top) / 2, A = f.getClientOffset().y - p.top;
101
- r < d && A < g || r > d && A > g || (i(r, d), j.index = d);
103
+ const p = r.current?.getBoundingClientRect(), g = (p.bottom - p.top) / 2, T = v.getClientOffset().y - p.top;
104
+ i < u && T < g || i > u && T > g || (c(i, u), f.index = u);
102
105
  }
103
- }), [{ isDragging: a }, w] = $t({
104
- type: n,
105
- item: () => ({ id: o, index: s }),
106
- collect: (j) => ({
107
- isDragging: j.isDragging()
106
+ }), [{ isDragging: l }, S] = Et({
107
+ type: s,
108
+ item: () => ({ id: o, index: n }),
109
+ collect: (f) => ({
110
+ isDragging: f.isDragging()
108
111
  })
109
- }), I = a ? 0.6 : 1, m = a ? "grabbing" : "grab";
110
- return w(x(l)), /* @__PURE__ */ e.jsxs(Se, { ref: l, style: { opacity: I, cursor: m }, "data-handler-id": u, children: [
111
- /* @__PURE__ */ e.jsx(he, { children: s + 1 }),
112
- /* @__PURE__ */ e.jsx(he, { children: c })
112
+ }), N = l ? 0.6 : 1, h = l ? "grabbing" : "grab";
113
+ return S(j(r)), /* @__PURE__ */ e.jsxs(Se, { ref: r, style: { opacity: N, cursor: h }, "data-handler-id": d, children: [
114
+ /* @__PURE__ */ e.jsx(he, { children: n + 1 }),
115
+ /* @__PURE__ */ e.jsx(he, { children: a })
113
116
  ] });
114
117
  }, Xt = ({
115
- items: n,
116
- onChange: s,
118
+ items: s,
119
+ onChange: n,
117
120
  selectedItem: o,
118
- isDisabled: c,
119
- selectedProps: i,
120
- buttonProps: l
121
+ isDisabled: a,
122
+ selectedProps: c,
123
+ buttonProps: r
121
124
  }) => {
122
- const u = (a) => a === o || a.value === o, x = (a) => u(a) ? { ...l, ...i } : l;
123
- return /* @__PURE__ */ e.jsx(pe, { isAttached: !0, isDisabled: c, children: n.map((a, w) => /* @__PURE__ */ e.jsx(
125
+ const d = (l) => l === o || l.value === o, j = (l) => d(l) ? { ...r, ...c } : r;
126
+ return /* @__PURE__ */ e.jsx(pe, { isAttached: !0, isDisabled: a, children: s.map((l, S) => /* @__PURE__ */ e.jsx(
124
127
  at,
125
128
  {
126
- label: a.tooltip,
129
+ label: l.tooltip,
127
130
  openDelay: 50,
128
131
  closeDelay: 200,
129
132
  placement: "top",
130
- visibility: a.tooltip ? "visible" : "hidden",
133
+ visibility: l.tooltip ? "visible" : "hidden",
131
134
  hasArrow: !0,
132
135
  children: /* @__PURE__ */ e.jsx(
133
136
  X,
134
137
  {
135
- onClick: () => u(a) ? null : s(a, w),
136
- isDisabled: a.disabled,
137
- ...x(a),
138
- children: a.label
138
+ onClick: () => d(l) ? null : n(l, S),
139
+ isDisabled: l.disabled,
140
+ ...j(l),
141
+ children: l.label
139
142
  }
140
143
  )
141
144
  },
142
- w
145
+ S
143
146
  )) });
144
- }, ye = (n, s) => s < 0 ? -1 * Math.abs(n) : Math.abs(n), Kt = ({
145
- isReversed: n,
146
- min: s,
147
+ }, ye = (s, n) => n < 0 ? -1 * Math.abs(s) : Math.abs(s), Zt = ({
148
+ isReversed: s,
149
+ min: n,
147
150
  max: o,
148
- value: c,
149
- onChange: i,
150
- inputProps: l,
151
- size: u,
152
- zeroMarker: x,
153
- formatValue: a,
154
- valueLabel: w,
155
- positiveNegativeLabels: I,
156
- isDisabled: m,
157
- ...j
151
+ value: a,
152
+ onChange: c,
153
+ inputProps: r,
154
+ size: d,
155
+ zeroMarker: j,
156
+ formatValue: l,
157
+ valueLabel: S,
158
+ positiveNegativeLabels: N,
159
+ isDisabled: h,
160
+ ...f
158
161
  }) => {
159
- const [f, r] = z([void 0, void 0]), d = f[0], p = f[1], g = x && s < -5 && o > 5, y = Number(c?.[0] ?? p ?? s) > 0 ? 1 : -1, A = Number(c?.[1] ?? p ?? o) < 0 ? -1 : 1, C = I?.[0] === I?.[1], T = c?.[0], M = c?.[1];
160
- se(() => {
161
- T !== void 0 && M !== void 0 && r([T.toFixed(0), M.toFixed(0)]);
162
- }, [T, M, r]);
163
- const E = R(
164
- ([v, $]) => {
165
- v < $ && r([v.toFixed(0), $.toFixed(0)]);
166
- },
167
- [r]
168
- ), O = R(
169
- ([v, $]) => {
170
- v < $ && i([v, $]);
162
+ const [v, i] = z([void 0, void 0]), u = v[0], p = v[1], g = j && n < -5 && o > 5, y = Number(a?.[0] ?? p ?? n) > 0 ? 1 : -1, T = Number(a?.[1] ?? p ?? o) < 0 ? -1 : 1, D = N?.[0] === N?.[1], C = a?.[0], x = a?.[1];
163
+ ne(() => {
164
+ C !== void 0 && x !== void 0 && i([C.toFixed(0), x.toFixed(0)]);
165
+ }, [C, x, i]);
166
+ const E = F(
167
+ ([b, P]) => {
168
+ b < P && i([b.toFixed(0), P.toFixed(0)]);
171
169
  },
172
170
  [i]
173
- ), Q = R(() => {
174
- r(([v, $]) => {
175
- const q = isNaN(Number(v)) ? s : Number(v), t = isNaN(Number($)) ? o : Number($), h = ye(Number(q), y), S = ye(Number(t), A), F = y < 0 ? Math.max(h, s) : Math.min(h, o), L = A < 0 ? Math.max(S, s) : Math.min(S, o);
176
- return F > L ? (i([L, F]), [L.toFixed(0), F.toFixed(0)]) : (i([F, L]), [F.toFixed(0), L.toFixed(0)]);
171
+ ), M = F(
172
+ ([b, P]) => {
173
+ b < P && c([b, P]);
174
+ },
175
+ [c]
176
+ ), Q = F(() => {
177
+ i(([b, P]) => {
178
+ const q = isNaN(Number(b)) ? n : Number(b), t = isNaN(Number(P)) ? o : Number(P), m = ye(Number(q), y), A = ye(Number(t), T), L = y < 0 ? Math.max(m, n) : Math.min(m, o), I = T < 0 ? Math.max(A, n) : Math.min(A, o);
179
+ return L > I ? (c([I, L]), [I.toFixed(0), L.toFixed(0)]) : (c([L, I]), [L.toFixed(0), I.toFixed(0)]);
177
180
  });
178
- }, [i, r, y, A, s, o]), K = R(
179
- (v) => {
180
- const $ = v === "" || isNaN(Number(v)) ? v : ye(Number(v), y);
181
- r(([q, t]) => [$.toString(), t]);
181
+ }, [c, i, y, T, n, o]), Z = F(
182
+ (b) => {
183
+ const P = b === "" || isNaN(Number(b)) ? b : ye(Number(b), y);
184
+ i(([q, t]) => [P.toString(), t]);
182
185
  },
183
- [r, y]
184
- ), Y = R(
185
- (v) => {
186
- const $ = v === "" || isNaN(Number(v)) ? v : ye(Number(v), A);
187
- r(([q, t]) => [q, $.toString()]);
186
+ [i, y]
187
+ ), Y = F(
188
+ (b) => {
189
+ const P = b === "" || isNaN(Number(b)) ? b : ye(Number(b), T);
190
+ i(([q, t]) => [q, P.toString()]);
188
191
  },
189
- [r, A]
190
- ), k = D(
191
- () => u === "xs" ? "0.75rem" : void 0,
192
- [u]
193
- ), V = R(
194
- (v, $) => {
195
- const q = Number($.target.value);
196
- if (!d || !p || ![-1, 1].includes(q))
192
+ [i, T]
193
+ ), R = k(
194
+ () => d === "xs" ? "0.75rem" : void 0,
195
+ [d]
196
+ ), K = F(
197
+ (b, P) => {
198
+ const q = Number(P.target.value);
199
+ if (!u || !p || ![-1, 1].includes(q))
197
200
  return;
198
- const t = (F) => q < 0 ? -1 * Math.abs(F) : Math.abs(F), h = v ? t(Number(d)) : Number(d), S = v ? Number(p) : t(Number(p));
199
- h > S ? i([S, h]) : i([h, S]);
201
+ const t = (L) => q < 0 ? -1 * Math.abs(L) : Math.abs(L), m = b ? t(Number(u)) : Number(u), A = b ? Number(p) : t(Number(p));
202
+ m > A ? c([A, m]) : c([m, A]);
200
203
  },
201
- [d, p, i]
204
+ [u, p, c]
202
205
  );
203
- return /* @__PURE__ */ e.jsxs(me, { direction: "column", ...j, children: [
206
+ return /* @__PURE__ */ e.jsxs(me, { direction: "column", ...f, children: [
204
207
  /* @__PURE__ */ e.jsx(J, { pt: "1em", mb: "-0.5em", children: /* @__PURE__ */ e.jsxs(
205
208
  ct,
206
209
  {
207
210
  "aria-label": ["min", "max"],
208
- isReversed: n,
209
- value: [Number(d ?? s), Number(p ?? o)],
211
+ isReversed: s,
212
+ value: [Number(u ?? n), Number(p ?? o)],
210
213
  max: o,
211
- min: s,
214
+ min: n,
212
215
  minStepsBetweenThumbs: 3,
213
216
  step: 1,
214
217
  onChange: E,
215
- onChangeEnd: O,
216
- isDisabled: m,
218
+ onChangeEnd: M,
219
+ isDisabled: h,
217
220
  children: [
218
- /* @__PURE__ */ e.jsx(Ne, { value: s, top: "-1em", children: /* @__PURE__ */ e.jsx(
219
- b,
221
+ /* @__PURE__ */ e.jsx(Ne, { value: n, top: "-1em", children: /* @__PURE__ */ e.jsx(
222
+ w,
220
223
  {
221
- fontSize: u ?? "sm",
224
+ fontSize: d ?? "sm",
222
225
  fontWeight: "semibold",
223
226
  whiteSpace: "nowrap",
224
- children: a ? a?.(s) : s
227
+ children: l ? l?.(n) : n
225
228
  }
226
229
  ) }),
227
230
  /* @__PURE__ */ e.jsx(Ne, { value: o, top: "-1em", children: /* @__PURE__ */ e.jsx(
228
- b,
231
+ w,
229
232
  {
230
- fontSize: u ?? "sm",
233
+ fontSize: d ?? "sm",
231
234
  fontWeight: "semibold",
232
235
  style: { transform: "translateX(-100%)" },
233
236
  whiteSpace: "nowrap",
234
- children: a ? a(o) : o
237
+ children: l ? l(o) : o
235
238
  }
236
239
  ) }),
237
240
  g && /* @__PURE__ */ e.jsxs(Ne, { value: 0, top: "-1em", pos: "relative", children: [
238
- /* @__PURE__ */ e.jsx(b, { fontSize: u, fontWeight: "semibold", children: a?.(0) ?? "0" }),
241
+ /* @__PURE__ */ e.jsx(w, { fontSize: d, fontWeight: "semibold", children: l?.(0) ?? "0" }),
239
242
  /* @__PURE__ */ e.jsx(
240
243
  J,
241
244
  {
@@ -249,33 +252,33 @@ const Ht = ({
249
252
  )
250
253
  ] }),
251
254
  /* @__PURE__ */ e.jsx(dt, { children: /* @__PURE__ */ e.jsx(ut, {}) }),
252
- /* @__PURE__ */ e.jsx(Fe, { index: 0, w: k, h: k }),
253
- /* @__PURE__ */ e.jsx(Fe, { index: 1, w: k, h: k })
255
+ /* @__PURE__ */ e.jsx(Fe, { index: 0, w: R, h: R }),
256
+ /* @__PURE__ */ e.jsx(Fe, { index: 1, w: R, h: R })
254
257
  ]
255
258
  }
256
259
  ) }),
257
- w && /* @__PURE__ */ e.jsxs(
260
+ S && /* @__PURE__ */ e.jsxs(
258
261
  me,
259
262
  {
260
- direction: n ? "row-reverse" : "row",
263
+ direction: s ? "row-reverse" : "row",
261
264
  justifyContent: "space-between",
262
265
  children: [
263
266
  /* @__PURE__ */ e.jsx(
264
- b,
267
+ w,
265
268
  {
266
- fontSize: u ?? "sm",
269
+ fontSize: d ?? "sm",
267
270
  fontWeight: "semibold",
268
271
  whiteSpace: "nowrap",
269
- children: w(s)
272
+ children: S(n)
270
273
  }
271
274
  ),
272
275
  /* @__PURE__ */ e.jsx(
273
- b,
276
+ w,
274
277
  {
275
- fontSize: u ?? "sm",
278
+ fontSize: d ?? "sm",
276
279
  fontWeight: "semibold",
277
280
  whiteSpace: "nowrap",
278
- children: w(o)
281
+ children: S(o)
279
282
  }
280
283
  )
281
284
  ]
@@ -284,23 +287,23 @@ const Ht = ({
284
287
  /* @__PURE__ */ e.jsxs(
285
288
  me,
286
289
  {
287
- direction: n ? "row-reverse" : "row",
290
+ direction: s ? "row-reverse" : "row",
288
291
  justifyContent: "center",
289
292
  alignItems: "center",
290
293
  gap: "0.125em",
291
294
  children: [
292
- I && /* @__PURE__ */ e.jsxs(
295
+ N && /* @__PURE__ */ e.jsxs(
293
296
  Re,
294
297
  {
295
298
  width: "auto",
296
- size: u,
299
+ size: d,
297
300
  fontWeight: "bold",
298
301
  value: y,
299
- onChange: (v) => V(!0, v),
300
- isDisabled: C || m,
302
+ onChange: (b) => K(!0, b),
303
+ isDisabled: D || h,
301
304
  children: [
302
- /* @__PURE__ */ e.jsx("option", { value: -1, children: I[0] }),
303
- /* @__PURE__ */ e.jsx("option", { value: 1, children: I[1] })
305
+ /* @__PURE__ */ e.jsx("option", { value: -1, children: N[0] }),
306
+ /* @__PURE__ */ e.jsx("option", { value: 1, children: N[1] })
304
307
  ]
305
308
  }
306
309
  ),
@@ -308,17 +311,17 @@ const Ht = ({
308
311
  ke,
309
312
  {
310
313
  precision: 0,
311
- size: u ?? "sm",
314
+ size: d ?? "sm",
312
315
  min: 0,
313
- max: y < 0 ? Math.abs(s) : M ?? o,
314
- value: d === "" ? "" : Math.abs(Number(d ?? s)),
315
- onChange: K,
316
+ max: y < 0 ? Math.abs(n) : x ?? o,
317
+ value: u === "" ? "" : Math.abs(Number(u ?? n)),
318
+ onChange: Z,
316
319
  onBlur: Q,
317
320
  borderWidth: 1,
318
321
  borderRadius: 3,
319
322
  borderColor: "#ccc",
320
- isDisabled: m,
321
- ...l,
323
+ isDisabled: h,
324
+ ...r,
322
325
  children: /* @__PURE__ */ e.jsx(
323
326
  De,
324
327
  {
@@ -332,9 +335,9 @@ const Ht = ({
332
335
  /* @__PURE__ */ e.jsx(
333
336
  ke,
334
337
  {
335
- size: u ?? "sm",
338
+ size: d ?? "sm",
336
339
  min: 0,
337
- max: A < 0 ? Math.abs(T ?? s) : o,
340
+ max: T < 0 ? Math.abs(C ?? n) : o,
338
341
  precision: 0,
339
342
  value: p === "" ? "" : Math.abs(Number(p ?? o)),
340
343
  onChange: Y,
@@ -342,8 +345,8 @@ const Ht = ({
342
345
  borderWidth: 1,
343
346
  borderRadius: 3,
344
347
  borderColor: "#ccc",
345
- isDisabled: m,
346
- ...l,
348
+ isDisabled: h,
349
+ ...r,
347
350
  children: /* @__PURE__ */ e.jsx(
348
351
  De,
349
352
  {
@@ -354,18 +357,18 @@ const Ht = ({
354
357
  )
355
358
  }
356
359
  ),
357
- I && /* @__PURE__ */ e.jsxs(
360
+ N && /* @__PURE__ */ e.jsxs(
358
361
  Re,
359
362
  {
360
363
  width: "auto",
361
- size: u,
364
+ size: d,
362
365
  fontWeight: "bold",
363
- value: A,
364
- onChange: (v) => V(!1, v),
365
- isDisabled: C || m,
366
+ value: T,
367
+ onChange: (b) => K(!1, b),
368
+ isDisabled: D || h,
366
369
  children: [
367
- /* @__PURE__ */ e.jsx("option", { value: -1, children: I[0] }),
368
- /* @__PURE__ */ e.jsx("option", { value: 1, children: I[1] })
370
+ /* @__PURE__ */ e.jsx("option", { value: -1, children: N[0] }),
371
+ /* @__PURE__ */ e.jsx("option", { value: 1, children: N[1] })
369
372
  ]
370
373
  }
371
374
  )
@@ -373,72 +376,78 @@ const Ht = ({
373
376
  }
374
377
  )
375
378
  ] });
376
- }, Vt = ({ tags: n, containerProps: s, ...o }) => /* @__PURE__ */ e.jsx(te, { ...s, children: n.map((c, i) => /* @__PURE__ */ e.jsx(fe, { ...o, children: c }, i)) }), Zt = new wt({}), es = (n, s) => {
377
- if (!s || !s.trim().length)
378
- return n;
379
- const o = n.map((i) => i.name ?? "");
380
- return Zt.filter(o, s)?.map((i) => n[i]) ?? [];
381
- }, ts = (n, s) => !s || s.length == 0 ? n : n.filter(
382
- (o) => o.useCases.some((c) => s.includes(c.id))
383
- ), ss = ({
384
- actions: n,
385
- totalActions: s,
379
+ }, Kt = ({ tags: s, containerProps: n, ...o }) => /* @__PURE__ */ e.jsx(te, { ...n, children: s.map((a, c) => /* @__PURE__ */ e.jsx(fe, { ...o, children: a }, c)) }), Vt = new wt({}), en = (s, n) => {
380
+ if (!n || !n.trim().length)
381
+ return s;
382
+ const o = s.map((c) => c.name ?? "");
383
+ return Vt.filter(o, n)?.map((c) => s[c]) ?? [];
384
+ }, tn = (s) => !s || s.length === 0 ? "None" : s.map(
385
+ (n) => (
386
+ // Convert camelCase to separate words (e.g., 'LeftFoot' -> 'Left Foot')
387
+ n.replace(/([A-Z])/g, " $1").trim()
388
+ )
389
+ ).join(", "), nn = (s, n) => !n || n.length == 0 ? s : s.filter(
390
+ (o) => o.useCases.some((a) => n.includes(a.id))
391
+ ), sn = ({
392
+ actions: s,
393
+ totalActions: n,
386
394
  onCreate: o,
387
- onDelete: c,
388
- onEdit: i,
389
- onSelected: l,
390
- onDuplicate: u,
391
- disableMultiSelect: x,
392
- disableDelete: a,
393
- disableEdit: w,
394
- disableCreate: I,
395
- tableProps: m,
396
- ...j
395
+ onDelete: a,
396
+ onEdit: c,
397
+ onSelected: r,
398
+ onDuplicate: d,
399
+ disableMultiSelect: j,
400
+ disableDelete: l,
401
+ disableEdit: S,
402
+ disableCreate: N,
403
+ hideUseCase: h = !0,
404
+ tableProps: f,
405
+ ...v
397
406
  }) => {
398
- const [f, r] = z(""), [d, p] = z(), g = D(() => {
399
- if (!n)
407
+ const [i, u] = z(""), [p, g] = z(), y = k(() => {
408
+ if (!s)
400
409
  return;
401
- const C = es(n, f);
402
- return ts(C, d).sort((M, E) => M.name.localeCompare(E.name));
403
- }, [n, f, d]), y = R(() => {
404
- if (!c)
410
+ const C = en(s, i);
411
+ return (h ? C : nn(C, p)).sort((E, M) => E.name.localeCompare(M.name));
412
+ }, [s, i, p, h]), T = F(() => {
413
+ if (!a)
405
414
  return;
406
- const C = n.filter((T) => T.selected).map((T) => T.id);
407
- c(C);
408
- }, [n, c]), A = R(() => {
409
- if (!u)
415
+ const C = s.filter((x) => x.selected).map((x) => x.id);
416
+ a(C);
417
+ }, [s, a]), D = F(() => {
418
+ if (!d)
410
419
  return;
411
- const C = n.filter((T) => T.selected);
412
- u(C.map((T) => T.id)), l && C.forEach((T) => l(T, !1));
413
- }, [n, u, l]);
414
- return /* @__PURE__ */ e.jsxs(J, { ...j, children: [
420
+ const C = s.filter((x) => x.selected);
421
+ d(C.map((x) => x.id)), r && C.forEach((x) => r(x, !1));
422
+ }, [s, d, r]);
423
+ return /* @__PURE__ */ e.jsxs(J, { ...v, children: [
415
424
  /* @__PURE__ */ e.jsxs(me, { alignContent: "space-between", gap: 4, children: [
416
- (o || c || u) && /* @__PURE__ */ e.jsxs(pe, { mb: "1rem", gap: 4, children: [
425
+ (o || a || d) && /* @__PURE__ */ e.jsxs(pe, { mb: "1rem", gap: 4, children: [
417
426
  o && /* @__PURE__ */ e.jsx(
418
427
  X,
419
428
  {
420
- isDisabled: !o || I,
429
+ isDisabled: !o || N,
421
430
  colorScheme: "blackAlpha",
422
431
  backgroundColor: "gray.700",
423
432
  onClick: o,
424
433
  children: "Create New Activity"
425
434
  }
426
435
  ),
427
- c && !x && /* @__PURE__ */ e.jsx(
436
+ a && !j && /* @__PURE__ */ e.jsx(
428
437
  X,
429
438
  {
430
439
  colorScheme: "gray",
431
- isDisabled: n.length <= 0 || !c || a,
432
- onClick: y,
440
+ isDisabled: s.length <= 0 || !a || l,
441
+ onClick: T,
433
442
  children: "Delete Selected"
434
443
  }
435
444
  ),
436
- u && !x && /* @__PURE__ */ e.jsx(
445
+ d && !j && /* @__PURE__ */ e.jsx(
437
446
  X,
438
447
  {
439
448
  colorScheme: "gray",
440
- isDisabled: n.length <= 0,
441
- onClick: A,
449
+ isDisabled: s.length <= 0,
450
+ onClick: D,
442
451
  children: "Duplicate Selected"
443
452
  }
444
453
  )
@@ -446,66 +455,67 @@ const Ht = ({
446
455
  /* @__PURE__ */ e.jsx(
447
456
  Ht,
448
457
  {
449
- setSearch: r,
450
- actions: n,
451
- updateUseCases: p
458
+ setSearch: u,
459
+ actions: s,
460
+ updateUseCases: g,
461
+ hideUseCaseFilter: h
452
462
  }
453
463
  )
454
464
  ] }),
455
- /* @__PURE__ */ e.jsx(Be, { mr: "2rem", overflowX: "hidden", ...m, children: /* @__PURE__ */ e.jsxs(Qe, { size: "md", variant: "simple", children: [
465
+ /* @__PURE__ */ e.jsx(Be, { mr: "2rem", overflowX: "hidden", ...f, children: /* @__PURE__ */ e.jsxs(Qe, { size: "md", variant: "simple", children: [
456
466
  /* @__PURE__ */ e.jsx(qe, { position: "sticky", top: 0, bg: "white", zIndex: 1, children: /* @__PURE__ */ e.jsxs(Se, { children: [
457
467
  /* @__PURE__ */ e.jsxs(ce, { fontWeight: "normal", children: [
458
468
  "(showing ",
459
- g?.length ?? 0,
469
+ y?.length ?? 0,
460
470
  " of",
461
471
  " ",
462
- s ?? n.length,
472
+ n ?? s.length,
463
473
  ")"
464
474
  ] }),
465
475
  /* @__PURE__ */ e.jsx(ce, { children: "Name" }),
466
- /* @__PURE__ */ e.jsx(ce, { children: "Sensor Count" }),
467
- /* @__PURE__ */ e.jsx(ce, { children: "Use Case" }),
476
+ /* @__PURE__ */ e.jsx(ce, { children: "Sensor Locations" }),
477
+ !h && /* @__PURE__ */ e.jsx(ce, { children: "Use Case" }),
468
478
  /* @__PURE__ */ e.jsx(ce, {})
469
479
  ] }) }),
470
- /* @__PURE__ */ e.jsx(He, { children: g?.map((C) => /* @__PURE__ */ e.jsxs(
480
+ /* @__PURE__ */ e.jsx(He, { children: y?.map((C) => /* @__PURE__ */ e.jsxs(
471
481
  Se,
472
482
  {
473
- title: x && C.selected ? "This activity is selected. Click it again to deselect." : void 0,
474
- bg: x && C.selected ? "gray.200" : void 0,
483
+ title: j && C.selected ? "This activity is selected. Click it again to deselect." : void 0,
484
+ bg: j && C.selected ? "gray.200" : void 0,
475
485
  _hover: {
476
- bg: x && !C.selected ? "#f7f7f7" : void 0
486
+ bg: j && !C.selected ? "#f7f7f7" : void 0
477
487
  },
478
- cursor: x ? "pointer" : "default",
479
- onClick: () => x ? l?.(C, !C.selected) : void 0,
488
+ cursor: j ? "pointer" : "default",
489
+ onClick: () => j ? r?.(C, !C.selected) : void 0,
480
490
  children: [
481
491
  /* @__PURE__ */ e.jsx(he, { children: /* @__PURE__ */ e.jsxs(me, { children: [
482
- l && !x && /* @__PURE__ */ e.jsx(
492
+ r && !j && /* @__PURE__ */ e.jsx(
483
493
  ht,
484
494
  {
485
495
  isChecked: C.selected,
486
- onChange: (T) => l(C, T.target.checked)
496
+ onChange: (x) => r(C, x.target.checked)
487
497
  }
488
498
  ),
489
- i && /* @__PURE__ */ e.jsx(
499
+ c && /* @__PURE__ */ e.jsx(
490
500
  X,
491
501
  {
492
- disabled: w,
502
+ disabled: S,
493
503
  ml: "1em",
494
504
  size: "sm",
495
505
  variant: "link",
496
506
  colorScheme: "blue",
497
- onClick: () => i(C.id),
507
+ onClick: () => c(C.id),
498
508
  children: "edit"
499
509
  }
500
510
  )
501
511
  ] }) }),
502
512
  /* @__PURE__ */ e.jsx(he, { whiteSpace: "break-spaces", children: C.name }),
503
- /* @__PURE__ */ e.jsx(he, { maxW: "20rem", children: C.sensorLocations.length }),
504
- /* @__PURE__ */ e.jsx(he, { maxW: "20rem", children: /* @__PURE__ */ e.jsx(
505
- Vt,
513
+ /* @__PURE__ */ e.jsx(he, { maxW: "20rem", whiteSpace: "break-spaces", children: tn(C.sensorLocations) }),
514
+ !h && /* @__PURE__ */ e.jsx(he, { maxW: "20rem", children: /* @__PURE__ */ e.jsx(
515
+ Kt,
506
516
  {
507
517
  containerProps: { flexWrap: "wrap" },
508
- tags: C.useCases?.map((T) => T.name) ?? []
518
+ tags: C.useCases?.map((x) => x.name) ?? []
509
519
  }
510
520
  ) })
511
521
  ]
@@ -514,48 +524,48 @@ const Ht = ({
514
524
  )) })
515
525
  ] }) })
516
526
  ] });
517
- }, Os = ({
518
- onSave: n,
519
- onCancel: s,
527
+ }, Ln = ({
528
+ onSave: s,
529
+ onCancel: n,
520
530
  onError: o,
521
- hideButtons: c = !1,
522
- setButtonDisabled: i,
523
- setButtonOnClick: l,
524
- quantumOwned: u
531
+ hideButtons: a = !1,
532
+ setButtonDisabled: c,
533
+ setButtonOnClick: r,
534
+ quantumOwned: d
525
535
  }) => {
526
- const x = Ye(), [a, w] = z("copy"), [I, m] = z(""), [j, f] = z([]), [r, d] = z(!1), [p] = le({
527
- query: Ke
536
+ const j = Ye(), [l, S] = z("copy"), [N, h] = z(""), [f, v] = z([]), [i, u] = z(!1), [p] = le({
537
+ query: Ze
528
538
  }), [g] = le({
529
- query: Nt,
530
- variables: { groupId: I },
531
- pause: !I
539
+ query: Tt,
540
+ variables: { groupId: N },
541
+ pause: !N
532
542
  // Only run when group is selected
533
- }), [, y] = oe(Ie), [, A] = oe(
534
- Ve
535
- ), C = D(() => p.data?.groups ? p.data.groups.map(
536
- (t) => _(Ze, t)
537
- ) : [], [p.data]), T = D(() => g.data ? g.data.actions.map(
538
- (h) => _(ae, h)
539
- ) : [], [g.data]), M = D(() => T.filter(
540
- (t) => j.includes(t.id)
541
- ), [T, j]), E = R(
543
+ }), [, y] = oe(Ie), [, T] = oe(
544
+ Ke
545
+ ), D = k(() => p.data?.groups ? p.data.groups.map(
546
+ (t) => _(Ve, t)
547
+ ) : [], [p.data]), C = k(() => g.data ? g.data.actions.map(
548
+ (m) => _(ae, m)
549
+ ) : [], [g.data]), x = k(() => C.filter(
550
+ (t) => f.includes(t.id)
551
+ ), [C, f]), E = F(
542
552
  (t) => {
543
- const h = t?.value || "";
544
- m(h), f([]);
553
+ const m = t?.value || "";
554
+ h(m), v([]);
545
555
  },
546
556
  []
547
- ), O = R(
557
+ ), M = F(
548
558
  (t) => {
549
- const h = t.map((S) => S.value);
550
- f(h);
559
+ const m = t.map((A) => A.value);
560
+ v(m);
551
561
  },
552
562
  []
553
- ), Q = R(
563
+ ), Q = F(
554
564
  async (t) => {
555
- const h = _(
565
+ const m = _(
556
566
  de,
557
567
  t.categories
558
- ), S = {
568
+ ), A = {
559
569
  ...t,
560
570
  name: `${t.name} (Copy)`,
561
571
  // Add "(Copy)" suffix to distinguish
@@ -565,128 +575,128 @@ const Ht = ({
565
575
  laterality: t.laterality,
566
576
  activityKind: t.activityKind,
567
577
  sensorLocations: t.sensorLocations,
568
- thresholds: t.thresholds.map((L) => ({
569
- ...L,
578
+ thresholds: t.thresholds.map((I) => ({
579
+ ...I,
570
580
  id: void 0
571
581
  })),
572
- categories: h?.map((L) => L.id),
573
- quantumOwned: u,
582
+ categories: m?.map((I) => I.id),
583
+ quantumOwned: d,
574
584
  id: void 0
575
- }, F = await y({ fields: S });
576
- if (F.error)
577
- throw new Error(F.error.message);
578
- if (F.data?.createAction)
579
- return _(ae, F.data.createAction);
585
+ }, L = await y({ fields: A });
586
+ if (L.error)
587
+ throw new Error(L.error.message);
588
+ if (L.data?.createAction)
589
+ return _(ae, L.data.createAction);
580
590
  throw new Error("No action data returned");
581
591
  },
582
- [y, u]
583
- ), K = R(
592
+ [y, d]
593
+ ), Z = F(
584
594
  async (t) => {
585
- const h = await A({ id: t.id });
586
- if (h.error)
587
- throw new Error(h.error.message);
588
- if (h.data?.convertActionToQuantumOwned)
595
+ const m = await T({ id: t.id });
596
+ if (m.error)
597
+ throw new Error(m.error.message);
598
+ if (m.data?.convertActionToQuantumOwned)
589
599
  return _(
590
600
  ae,
591
- h.data.convertActionToQuantumOwned
601
+ m.data.convertActionToQuantumOwned
592
602
  );
593
603
  throw new Error("No action data returned");
594
604
  },
595
- [A]
596
- ), Y = R(async () => {
597
- if (d(!0), !M.length) {
605
+ [T]
606
+ ), Y = F(async () => {
607
+ if (u(!0), !x.length) {
598
608
  const t = new Error(
599
- `No activities selected for ${a === "copy" ? "copying" : "converting"}`
609
+ `No activities selected for ${l === "copy" ? "copying" : "converting"}`
600
610
  );
601
- o?.(t), d(!1);
611
+ o?.(t), u(!1);
602
612
  return;
603
613
  }
604
614
  try {
605
615
  const t = [];
606
- let h = 0;
607
- const S = a === "copy" ? Q : K, F = a === "copy" ? "copy" : "convert";
608
- for (const L of M)
616
+ let m = 0;
617
+ const A = l === "copy" ? Q : Z, L = l === "copy" ? "copy" : "convert";
618
+ for (const I of x)
609
619
  try {
610
- const U = await S(L);
611
- t.push(U);
612
- } catch (U) {
620
+ const W = await A(I);
621
+ t.push(W);
622
+ } catch (W) {
613
623
  console.error(
614
- `Failed to ${F} activity "${L.name}":`,
615
- U
616
- ), h++;
624
+ `Failed to ${L} activity "${I.name}":`,
625
+ W
626
+ ), m++;
617
627
  }
618
628
  if (t.length > 0) {
619
- const L = t.length, U = M.length, H = a === "copy" ? "copied" : "converted", W = a === "copy" ? "copy" : "convert";
620
- x({
621
- title: h > 0 ? `Partial ${W} completed` : `Activities ${H} successfully`,
622
- description: h > 0 ? `${L} of ${U} activities ${H} successfully` : `${L} activit${L > 1 ? "ies" : "y"} ${H} successfully`,
623
- status: h > 0 ? "warning" : "success",
629
+ const I = t.length, W = x.length, H = l === "copy" ? "copied" : "converted", U = l === "copy" ? "copy" : "convert";
630
+ j({
631
+ title: m > 0 ? `Partial ${U} completed` : `Activities ${H} successfully`,
632
+ description: m > 0 ? `${I} of ${W} activities ${H} successfully` : `${I} activit${I > 1 ? "ies" : "y"} ${H} successfully`,
633
+ status: m > 0 ? "warning" : "success",
624
634
  duration: 3e3,
625
635
  isClosable: !0
626
- }), n?.(), m(""), f([]);
636
+ }), s?.(), h(""), v([]);
627
637
  } else
628
- throw new Error(`Failed to ${F} any activities`);
638
+ throw new Error(`Failed to ${L} any activities`);
629
639
  } catch (t) {
630
- const h = a === "copy" ? "copy" : "convert", S = t instanceof Error ? t.message : `Failed to ${h} activities`;
631
- x({
632
- title: `${a === "copy" ? "Copy" : "Convert"} failed`,
633
- description: S,
640
+ const m = l === "copy" ? "copy" : "convert", A = t instanceof Error ? t.message : `Failed to ${m} activities`;
641
+ j({
642
+ title: `${l === "copy" ? "Copy" : "Convert"} failed`,
643
+ description: A,
634
644
  status: "error",
635
645
  duration: 5e3,
636
646
  isClosable: !0
637
- }), o?.(t instanceof Error ? t : new Error(S));
647
+ }), o?.(t instanceof Error ? t : new Error(A));
638
648
  } finally {
639
- d(!1);
649
+ u(!1);
640
650
  }
641
651
  }, [
642
- M,
643
- a,
644
- Q,
645
- K,
646
652
  x,
647
- n,
653
+ l,
654
+ Q,
655
+ Z,
656
+ j,
657
+ s,
648
658
  o
649
- ]), k = R(() => {
650
- m(""), f([]), w("copy"), s?.();
651
- }, [s]);
652
- se(() => {
653
- i && i({
659
+ ]), R = F(() => {
660
+ h(""), v([]), S("copy"), n?.();
661
+ }, [n]);
662
+ ne(() => {
663
+ c && c({
654
664
  cancelButton: !1,
655
- saveButton: M.length === 0 || r
665
+ saveButton: x.length === 0 || i
656
666
  });
657
- }, [M.length, r, i]), se(() => {
658
- l && l({
659
- cancelButton: k,
667
+ }, [x.length, i, c]), ne(() => {
668
+ r && r({
669
+ cancelButton: R,
660
670
  saveButton: Y
661
671
  });
662
- }, [l, k, Y]);
663
- const V = D(() => C.map((t) => ({
672
+ }, [r, R, Y]);
673
+ const K = k(() => D.map((t) => ({
664
674
  value: t.id,
665
675
  label: t.name
666
- })), [C]), v = D(() => T.filter((t) => a === "copy" ? !0 : !t.quantumOwned).map((t) => ({
676
+ })), [D]), b = k(() => C.filter((t) => l === "copy" ? !0 : !t.quantumOwned).map((t) => ({
667
677
  value: t.id,
668
678
  label: t.name,
669
679
  // Add custom data to identify quantum-owned actions for UI display
670
680
  isQuantumOwned: t.quantumOwned
671
- })), [T, a]), $ = p.fetching, q = g.fetching;
681
+ })), [C, l]), P = p.fetching, q = g.fetching;
672
682
  return /* @__PURE__ */ e.jsx(J, { children: /* @__PURE__ */ e.jsxs(ee, { spacing: 6, align: "stretch", children: [
673
- u && /* @__PURE__ */ e.jsxs(B, { children: [
683
+ d && /* @__PURE__ */ e.jsxs(B, { children: [
674
684
  /* @__PURE__ */ e.jsx(re, { children: "Operation Mode" }),
675
685
  /* @__PURE__ */ e.jsx(
676
686
  Je,
677
687
  {
678
- value: a,
688
+ value: l,
679
689
  onChange: (t) => {
680
- w(t), f([]);
690
+ S(t), v([]);
681
691
  },
682
692
  children: /* @__PURE__ */ e.jsxs(te, { spacing: 6, children: [
683
- /* @__PURE__ */ e.jsx(Te, { value: "copy", colorScheme: "blue", children: /* @__PURE__ */ e.jsxs(ee, { align: "start", spacing: 1, children: [
684
- /* @__PURE__ */ e.jsx(b, { fontWeight: "medium", children: "Copy Activities" }),
685
- /* @__PURE__ */ e.jsx(b, { fontSize: "sm", color: "gray.600", children: "Create new activities based on selected ones" })
693
+ /* @__PURE__ */ e.jsx(Ae, { value: "copy", colorScheme: "blue", children: /* @__PURE__ */ e.jsxs(ee, { align: "start", spacing: 1, children: [
694
+ /* @__PURE__ */ e.jsx(w, { fontWeight: "medium", children: "Copy Activities" }),
695
+ /* @__PURE__ */ e.jsx(w, { fontSize: "sm", color: "gray.600", children: "Create new activities based on selected ones" })
686
696
  ] }) }),
687
- /* @__PURE__ */ e.jsx(Te, { value: "convert", colorScheme: "green", children: /* @__PURE__ */ e.jsxs(ee, { align: "start", spacing: 1, children: [
688
- /* @__PURE__ */ e.jsx(b, { fontWeight: "medium", children: "Convert to Quantum Owned" }),
689
- /* @__PURE__ */ e.jsx(b, { fontSize: "sm", color: "gray.600", children: "Convert existing activities to quantum-owned" })
697
+ /* @__PURE__ */ e.jsx(Ae, { value: "convert", colorScheme: "green", children: /* @__PURE__ */ e.jsxs(ee, { align: "start", spacing: 1, children: [
698
+ /* @__PURE__ */ e.jsx(w, { fontWeight: "medium", children: "Convert to Quantum Owned" }),
699
+ /* @__PURE__ */ e.jsx(w, { fontSize: "sm", color: "gray.600", children: "Convert existing activities to quantum-owned" })
690
700
  ] }) })
691
701
  ] })
692
702
  }
@@ -695,71 +705,71 @@ const Ht = ({
695
705
  /* @__PURE__ */ e.jsxs(B, { children: [
696
706
  /* @__PURE__ */ e.jsx(re, { children: "Select Source Group" }),
697
707
  /* @__PURE__ */ e.jsx(
698
- ne,
708
+ se,
699
709
  {
700
710
  placeholder: "Choose a group...",
701
- options: V,
702
- value: V.find((t) => t.value === I) || null,
711
+ options: K,
712
+ value: K.find((t) => t.value === N) || null,
703
713
  onChange: E,
704
- isLoading: $,
705
- isDisabled: $,
714
+ isLoading: P,
715
+ isDisabled: P,
706
716
  isClearable: !0
707
717
  }
708
718
  ),
709
- p.error && /* @__PURE__ */ e.jsxs(Ae, { status: "error", mt: 2, children: [
719
+ p.error && /* @__PURE__ */ e.jsxs(Te, { status: "error", mt: 2, children: [
710
720
  /* @__PURE__ */ e.jsx(Me, {}),
711
- /* @__PURE__ */ e.jsxs(b, { fontSize: "sm", children: [
721
+ /* @__PURE__ */ e.jsxs(w, { fontSize: "sm", children: [
712
722
  "Failed to load groups: ",
713
723
  p.error.message
714
724
  ] })
715
725
  ] })
716
726
  ] }),
717
- I && /* @__PURE__ */ e.jsxs(B, { children: [
727
+ N && /* @__PURE__ */ e.jsxs(B, { children: [
718
728
  /* @__PURE__ */ e.jsxs(re, { children: [
719
729
  "Select Activities to",
720
730
  " ",
721
- a === "copy" ? "Copy" : "Convert"
731
+ l === "copy" ? "Copy" : "Convert"
722
732
  ] }),
723
733
  q ? /* @__PURE__ */ e.jsxs(te, { children: [
724
734
  /* @__PURE__ */ e.jsx(Xe, { size: "sm" }),
725
- /* @__PURE__ */ e.jsx(b, { fontSize: "sm", color: "gray.600", children: "Loading activities..." })
735
+ /* @__PURE__ */ e.jsx(w, { fontSize: "sm", color: "gray.600", children: "Loading activities..." })
726
736
  ] }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
727
737
  /* @__PURE__ */ e.jsx(
728
- ne,
738
+ se,
729
739
  {
730
- placeholder: `Choose activities to ${a}...`,
731
- options: v,
732
- value: v.filter(
733
- (t) => j.includes(t.value)
740
+ placeholder: `Choose activities to ${l}...`,
741
+ options: b,
742
+ value: b.filter(
743
+ (t) => f.includes(t.value)
734
744
  ),
735
- onChange: O,
736
- isDisabled: v.length === 0,
745
+ onChange: M,
746
+ isDisabled: b.length === 0,
737
747
  isClearable: !0,
738
748
  isMulti: !0,
739
749
  closeMenuOnSelect: !1,
740
- formatOptionLabel: (t, { context: h }) => /* @__PURE__ */ e.jsxs(te, { justify: "space-between", w: "100%", children: [
750
+ formatOptionLabel: (t, { context: m }) => /* @__PURE__ */ e.jsxs(te, { justify: "space-between", w: "100%", children: [
741
751
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
742
- /* @__PURE__ */ e.jsx(b, { children: t.label }),
743
- h === "value" && t.isQuantumOwned && /* @__PURE__ */ e.jsx(b, { color: "blue", fontSize: "xs", children: "(Quantum Owned)" })
752
+ /* @__PURE__ */ e.jsx(w, { children: t.label }),
753
+ m === "value" && t.isQuantumOwned && /* @__PURE__ */ e.jsx(w, { color: "blue", fontSize: "xs", children: "(Quantum Owned)" })
744
754
  ] }),
745
- t.isQuantumOwned && h === "menu" && /* @__PURE__ */ e.jsx(fe, { size: "sm", colorScheme: "blue", variant: "solid", children: "Quantum Owned" })
755
+ t.isQuantumOwned && m === "menu" && /* @__PURE__ */ e.jsx(fe, { size: "sm", colorScheme: "blue", variant: "solid", children: "Quantum Owned" })
746
756
  ] })
747
757
  }
748
758
  ),
749
- v.length === 0 && /* @__PURE__ */ e.jsx(b, { fontSize: "sm", color: "gray.500", mt: 2, children: "No activities found" })
759
+ b.length === 0 && /* @__PURE__ */ e.jsx(w, { fontSize: "sm", color: "gray.500", mt: 2, children: "No activities found" })
750
760
  ] }),
751
- g.error && /* @__PURE__ */ e.jsxs(Ae, { status: "error", mt: 2, children: [
761
+ g.error && /* @__PURE__ */ e.jsxs(Te, { status: "error", mt: 2, children: [
752
762
  /* @__PURE__ */ e.jsx(Me, {}),
753
- /* @__PURE__ */ e.jsxs(b, { fontSize: "sm", children: [
763
+ /* @__PURE__ */ e.jsxs(w, { fontSize: "sm", children: [
754
764
  "Failed to load activities: ",
755
765
  g.error.message
756
766
  ] })
757
767
  ] })
758
768
  ] }),
759
- M.length > 0 && /* @__PURE__ */ e.jsxs(J, { p: 4, bg: "gray.50", borderRadius: "md", children: [
760
- /* @__PURE__ */ e.jsx(b, { fontWeight: "semibold", mb: 3, children: M.length === 1 ? `Activity to ${a === "copy" ? "Copy" : "Convert"}:` : `${M.length} Activities to ${a === "copy" ? "Copy" : "Convert"}:` }),
769
+ x.length > 0 && /* @__PURE__ */ e.jsxs(J, { p: 4, bg: "gray.50", borderRadius: "md", children: [
770
+ /* @__PURE__ */ e.jsx(w, { fontWeight: "semibold", mb: 3, children: x.length === 1 ? `Activity to ${l === "copy" ? "Copy" : "Convert"}:` : `${x.length} Activities to ${l === "copy" ? "Copy" : "Convert"}:` }),
761
771
  /* @__PURE__ */ e.jsxs(ee, { align: "start", spacing: 3, children: [
762
- M.map((t, h) => /* @__PURE__ */ e.jsxs(
772
+ x.map((t, m) => /* @__PURE__ */ e.jsxs(
763
773
  J,
764
774
  {
765
775
  w: "100%",
@@ -770,8 +780,8 @@ const Ht = ({
770
780
  borderColor: "gray.200",
771
781
  children: [
772
782
  /* @__PURE__ */ e.jsxs(te, { justify: "space-between", align: "start", mb: 2, children: [
773
- /* @__PURE__ */ e.jsxs(b, { fontWeight: "medium", fontSize: "sm", children: [
774
- h + 1,
783
+ /* @__PURE__ */ e.jsxs(w, { fontWeight: "medium", fontSize: "sm", children: [
784
+ m + 1,
775
785
  ". ",
776
786
  t.name
777
787
  ] }),
@@ -785,35 +795,35 @@ const Ht = ({
785
795
  fontSize: "sm",
786
796
  color: "gray.600",
787
797
  children: [
788
- t.description && /* @__PURE__ */ e.jsxs(b, { children: [
798
+ t.description && /* @__PURE__ */ e.jsxs(w, { children: [
789
799
  /* @__PURE__ */ e.jsx("strong", { children: "Description:" }),
790
800
  " ",
791
801
  t.description
792
802
  ] }),
793
- /* @__PURE__ */ e.jsxs(b, { children: [
803
+ /* @__PURE__ */ e.jsxs(w, { children: [
794
804
  /* @__PURE__ */ e.jsx("strong", { children: "Type:" }),
795
805
  " ",
796
806
  t.activityKind
797
807
  ] }),
798
- /* @__PURE__ */ e.jsxs(b, { children: [
808
+ /* @__PURE__ */ e.jsxs(w, { children: [
799
809
  /* @__PURE__ */ e.jsx("strong", { children: "Laterality:" }),
800
810
  " ",
801
811
  t.laterality
802
812
  ] }),
803
- /* @__PURE__ */ e.jsxs(b, { children: [
813
+ /* @__PURE__ */ e.jsxs(w, { children: [
804
814
  /* @__PURE__ */ e.jsx("strong", { children: "Sensor Locations:" }),
805
815
  " ",
806
816
  t.sensorLocations.length
807
817
  ] }),
808
- /* @__PURE__ */ e.jsxs(b, { children: [
818
+ /* @__PURE__ */ e.jsxs(w, { children: [
809
819
  /* @__PURE__ */ e.jsx("strong", { children: "Thresholds:" }),
810
820
  " ",
811
821
  t.thresholds.length
812
822
  ] }),
813
- /* @__PURE__ */ e.jsxs(b, { children: [
823
+ /* @__PURE__ */ e.jsxs(w, { children: [
814
824
  /* @__PURE__ */ e.jsx("strong", { children: "Use Cases:" }),
815
825
  " ",
816
- t.useCases.map((S) => S.name).join(", ") || "None"
826
+ t.useCases.map((A) => A.name).join(", ") || "None"
817
827
  ] })
818
828
  ]
819
829
  }
@@ -822,7 +832,7 @@ const Ht = ({
822
832
  },
823
833
  t.id
824
834
  )),
825
- M.length > 1 && /* @__PURE__ */ e.jsx(
835
+ x.length > 1 && /* @__PURE__ */ e.jsx(
826
836
  J,
827
837
  {
828
838
  w: "100%",
@@ -831,266 +841,266 @@ const Ht = ({
831
841
  borderRadius: "md",
832
842
  border: "1px solid",
833
843
  borderColor: "blue.200",
834
- children: /* @__PURE__ */ e.jsxs(b, { fontSize: "sm", fontWeight: "medium", color: "blue.800", children: [
844
+ children: /* @__PURE__ */ e.jsxs(w, { fontSize: "sm", fontWeight: "medium", color: "blue.800", children: [
835
845
  "Total: ",
836
- M.length,
846
+ x.length,
837
847
  " activities will be",
838
848
  " ",
839
- a === "copy" ? "copied" : "converted"
849
+ l === "copy" ? "copied" : "converted"
840
850
  ] })
841
851
  }
842
852
  )
843
853
  ] })
844
854
  ] }),
845
- !c && /* @__PURE__ */ e.jsxs(pe, { spacing: 4, justifyContent: "flex-end", children: [
855
+ !a && /* @__PURE__ */ e.jsxs(pe, { spacing: 4, justifyContent: "flex-end", children: [
846
856
  /* @__PURE__ */ e.jsx(
847
857
  X,
848
858
  {
849
859
  variant: "outline",
850
- onClick: k,
851
- isDisabled: r,
860
+ onClick: R,
861
+ isDisabled: i,
852
862
  children: "Cancel"
853
863
  }
854
864
  ),
855
865
  /* @__PURE__ */ e.jsxs(
856
866
  X,
857
867
  {
858
- colorScheme: a === "copy" ? "blue" : "green",
868
+ colorScheme: l === "copy" ? "blue" : "green",
859
869
  onClick: Y,
860
- isDisabled: M.length === 0 || r,
861
- isLoading: r,
862
- loadingText: `${a === "copy" ? "Copying" : "Converting"}...`,
870
+ isDisabled: x.length === 0 || i,
871
+ isLoading: i,
872
+ loadingText: `${l === "copy" ? "Copying" : "Converting"}...`,
863
873
  children: [
864
- a === "copy" ? "Copy" : "Convert",
874
+ l === "copy" ? "Copy" : "Convert",
865
875
  " ",
866
- M.length === 1 ? "Activity" : `${M.length} Activities`
876
+ x.length === 1 ? "Activity" : `${x.length} Activities`
867
877
  ]
868
878
  }
869
879
  )
870
880
  ] })
871
881
  ] }) });
872
- }, Ns = ({
873
- onSave: n,
874
- onCancel: s,
882
+ }, Fn = ({
883
+ onSave: s,
884
+ onCancel: n,
875
885
  onError: o,
876
- hideButtons: c = !1,
877
- setButtonDisabled: i,
878
- setButtonOnClick: l,
879
- quantumOwned: u
886
+ hideButtons: a = !1,
887
+ setButtonDisabled: c,
888
+ setButtonOnClick: r,
889
+ quantumOwned: d
880
890
  }) => {
881
- const x = Ye(), [a, w] = z(""), [I, m] = z([]), [j, f] = z(!1), [r, d] = z("copy"), [p] = le({
882
- query: Ke
891
+ const j = Ye(), [l, S] = z(""), [N, h] = z([]), [f, v] = z(!1), [i, u] = z("copy"), [p] = le({
892
+ query: Ze
883
893
  }), [g] = le({
884
- query: It,
885
- variables: { groupId: a },
886
- pause: !a
894
+ query: Mt,
895
+ variables: { groupId: l },
896
+ pause: !l
887
897
  // Only run when group is selected
888
- }), [, y] = oe(st), [, A] = oe(tt), [, C] = oe(Ie), [, T] = oe(
889
- Ve
890
- ), M = D(() => p.data?.groups ? p.data.groups.map(
891
- (t) => _(Ze, t)
892
- ) : [], [p.data]), E = D(() => g.data?.modules ? _(
893
- we,
898
+ }), [, y] = oe(nt), [, T] = oe(tt), [, D] = oe(Ie), [, C] = oe(
899
+ Ke
900
+ ), x = k(() => p.data?.groups ? p.data.groups.map(
901
+ (t) => _(Ve, t)
902
+ ) : [], [p.data]), E = k(() => g.data?.modules ? _(
903
+ Ce,
894
904
  g.data?.modules
895
- ).map((h) => {
896
- const S = _(
905
+ ).map((m) => {
906
+ const A = _(
897
907
  et,
898
- h.moduleActions
908
+ m.moduleActions
899
909
  );
900
910
  return {
901
- ...h,
902
- moduleActions: S.map((F) => ({
903
- ...F,
904
- action: _(ae, F.action)
911
+ ...m,
912
+ moduleActions: A.map((L) => ({
913
+ ...L,
914
+ action: _(ae, L.action)
905
915
  })),
906
916
  categories: _(
907
917
  de,
908
- h.categories
918
+ m.categories
909
919
  )
910
920
  };
911
- }) : [], [g.data]), O = D(() => E.filter(
912
- (t) => I.includes(t.id)
913
- ), [E, I]), Q = R(
921
+ }) : [], [g.data]), M = k(() => E.filter(
922
+ (t) => N.includes(t.id)
923
+ ), [E, N]), Q = F(
914
924
  (t) => {
915
- const h = t?.value || "";
916
- w(h), m([]);
925
+ const m = t?.value || "";
926
+ S(m), h([]);
917
927
  },
918
928
  []
919
- ), K = R(
929
+ ), Z = F(
920
930
  (t) => {
921
- const h = t.map((S) => S.value);
922
- m(h);
931
+ const m = t.map((A) => A.value);
932
+ h(m);
923
933
  },
924
934
  []
925
- ), Y = R(async () => {
926
- if (f(!0), !O.length) {
927
- f(!1);
935
+ ), Y = F(async () => {
936
+ if (v(!0), !M.length) {
937
+ v(!1);
928
938
  const t = new Error(
929
- `No modules selected for ${r === "convert" ? "converting" : "copying"}`
939
+ `No modules selected for ${i === "convert" ? "converting" : "copying"}`
930
940
  );
931
941
  o?.(t);
932
942
  return;
933
943
  }
934
944
  try {
935
945
  const t = [];
936
- let h = 0;
937
- for (const S of O)
946
+ let m = 0;
947
+ for (const A of M)
938
948
  try {
939
- let F = S.moduleActions.map((L) => L.actionId);
940
- if (u) {
941
- const L = S.moduleActions.map((W) => W.action), U = async (W) => {
942
- if (r === "copy") {
943
- if (W.quantumOwned) return W;
949
+ let L = A.moduleActions.map((I) => I.actionId);
950
+ if (d) {
951
+ const I = A.moduleActions.map((U) => U.action), W = async (U) => {
952
+ if (i === "copy") {
953
+ if (U.quantumOwned) return U;
944
954
  const ue = _(
945
955
  de,
946
- W.categories
956
+ U.categories
947
957
  ), xe = {
948
- ...W,
958
+ ...U,
949
959
  quantumOwned: !0,
950
- thresholds: W.thresholds.map((G) => ({
960
+ thresholds: U.thresholds.map((G) => ({
951
961
  ...G,
952
962
  id: void 0
953
963
  })),
954
964
  categories: ue?.map((G) => G.id),
955
965
  id: void 0
956
- }, N = await C({ fields: xe });
957
- return N.error || !N.data?.createAction ? null : _(
966
+ }, O = await D({ fields: xe });
967
+ return O.error || !O.data?.createAction ? null : _(
958
968
  ae,
959
- N.data.createAction
969
+ O.data.createAction
960
970
  );
961
971
  }
962
- if (W.quantumOwned) return W;
963
- const ge = await T({
964
- id: W.id
972
+ if (U.quantumOwned) return U;
973
+ const ge = await C({
974
+ id: U.id
965
975
  });
966
976
  return ge.error || !ge.data?.convertActionToQuantumOwned ? null : _(
967
977
  ae,
968
978
  ge.data.convertActionToQuantumOwned
969
979
  );
970
980
  };
971
- F = (await Promise.all(
972
- L.map(U)
973
- )).filter((W) => !!W).map((W) => W.id);
981
+ L = (await Promise.all(
982
+ I.map(W)
983
+ )).filter((U) => !!U).map((U) => U.id);
974
984
  }
975
- if (r === "convert") {
976
- const L = {
977
- name: S.name,
978
- description: S.description || void 0,
979
- actions: F,
980
- categories: S.categories.map((H) => H.id),
985
+ if (i === "convert") {
986
+ const I = {
987
+ name: A.name,
988
+ description: A.description || void 0,
989
+ actions: L,
990
+ categories: A.categories.map((H) => H.id),
981
991
  quantumOwned: !0
982
- }, U = await A({
983
- id: S.id,
984
- input: L
992
+ }, W = await T({
993
+ id: A.id,
994
+ input: I
985
995
  });
986
- if (U.error) throw new Error(U.error.message);
987
- if (U.data?.updateModule) {
996
+ if (W.error) throw new Error(W.error.message);
997
+ if (W.data?.updateModule) {
988
998
  const H = _(
989
- we,
990
- U.data.updateModule
999
+ Ce,
1000
+ W.data.updateModule
991
1001
  );
992
1002
  t.push(H);
993
1003
  }
994
1004
  } else {
995
- const L = {
996
- name: `${S.name} (Copy)`,
997
- description: S.description || void 0,
998
- actions: F,
999
- categories: S.categories.map((H) => H.id),
1000
- quantumOwned: u
1001
- }, U = await y({ input: L });
1002
- if (U.error) throw new Error(U.error.message);
1003
- if (U.data?.createModule) {
1005
+ const I = {
1006
+ name: `${A.name} (Copy)`,
1007
+ description: A.description || void 0,
1008
+ actions: L,
1009
+ categories: A.categories.map((H) => H.id),
1010
+ quantumOwned: d
1011
+ }, W = await y({ input: I });
1012
+ if (W.error) throw new Error(W.error.message);
1013
+ if (W.data?.createModule) {
1004
1014
  const H = _(
1005
- we,
1006
- U.data.createModule
1015
+ Ce,
1016
+ W.data.createModule
1007
1017
  );
1008
1018
  t.push(H);
1009
1019
  }
1010
1020
  }
1011
- } catch (F) {
1021
+ } catch (L) {
1012
1022
  console.error(
1013
- `Failed to ${r === "convert" ? "convert" : "copy"} module "${S.name}":`,
1014
- F
1015
- ), h++;
1023
+ `Failed to ${i === "convert" ? "convert" : "copy"} module "${A.name}":`,
1024
+ L
1025
+ ), m++;
1016
1026
  }
1017
1027
  if (t.length > 0) {
1018
- const S = t.length, F = O.length;
1019
- x({
1020
- title: h > 0 ? `Partial ${r === "convert" ? "convert" : "copy"} completed` : `Modules ${r === "convert" ? "converted" : "copied"} successfully`,
1021
- description: h > 0 ? `${S} of ${F} modules ${r === "convert" ? "converted" : "copied"} successfully` : `${S} module${S > 1 ? "s" : ""} ${r === "convert" ? "converted" : "copied"} successfully`,
1022
- status: h > 0 ? "warning" : "success",
1028
+ const A = t.length, L = M.length;
1029
+ j({
1030
+ title: m > 0 ? `Partial ${i === "convert" ? "convert" : "copy"} completed` : `Modules ${i === "convert" ? "converted" : "copied"} successfully`,
1031
+ description: m > 0 ? `${A} of ${L} modules ${i === "convert" ? "converted" : "copied"} successfully` : `${A} module${A > 1 ? "s" : ""} ${i === "convert" ? "converted" : "copied"} successfully`,
1032
+ status: m > 0 ? "warning" : "success",
1023
1033
  duration: 3e3,
1024
1034
  isClosable: !0
1025
- }), t.length > 0 && n?.(), w(""), m([]);
1035
+ }), t.length > 0 && s?.(), S(""), h([]);
1026
1036
  } else
1027
1037
  throw new Error(
1028
- `Failed to ${r === "convert" ? "convert" : "copy"} any modules`
1038
+ `Failed to ${i === "convert" ? "convert" : "copy"} any modules`
1029
1039
  );
1030
1040
  } catch (t) {
1031
- const h = t instanceof Error ? t.message : `Failed to ${r === "convert" ? "convert" : "copy"} modules`;
1032
- x({
1033
- title: r === "convert" ? "Convert failed" : "Copy failed",
1034
- description: h,
1041
+ const m = t instanceof Error ? t.message : `Failed to ${i === "convert" ? "convert" : "copy"} modules`;
1042
+ j({
1043
+ title: i === "convert" ? "Convert failed" : "Copy failed",
1044
+ description: m,
1035
1045
  status: "error",
1036
1046
  duration: 5e3,
1037
1047
  isClosable: !0
1038
- }), o?.(t instanceof Error ? t : new Error(h));
1048
+ }), o?.(t instanceof Error ? t : new Error(m));
1039
1049
  } finally {
1040
- f(!1);
1050
+ v(!1);
1041
1051
  }
1042
1052
  }, [
1043
- O,
1053
+ M,
1044
1054
  y,
1045
- A,
1046
- x,
1047
- n,
1055
+ T,
1056
+ j,
1057
+ s,
1048
1058
  o,
1049
- u,
1059
+ d,
1060
+ D,
1050
1061
  C,
1051
- T,
1052
- r
1053
- ]), k = R(() => {
1054
- w(""), m([]), d("copy"), s?.();
1055
- }, [s]);
1056
- se(() => {
1057
- i && i({
1062
+ i
1063
+ ]), R = F(() => {
1064
+ S(""), h([]), u("copy"), n?.();
1065
+ }, [n]);
1066
+ ne(() => {
1067
+ c && c({
1058
1068
  cancelButton: !1,
1059
- saveButton: O.length === 0 || j
1069
+ saveButton: M.length === 0 || f
1060
1070
  });
1061
- }, [O.length, j, i]), se(() => {
1062
- l && l({
1063
- cancelButton: k,
1071
+ }, [M.length, f, c]), ne(() => {
1072
+ r && r({
1073
+ cancelButton: R,
1064
1074
  saveButton: Y
1065
1075
  });
1066
- }, [l, k, Y]);
1067
- const V = D(() => M.map((t) => ({
1076
+ }, [r, R, Y]);
1077
+ const K = k(() => x.map((t) => ({
1068
1078
  value: t.id,
1069
1079
  label: t.name
1070
- })), [M]), v = D(() => E.filter((t) => r === "copy" ? !0 : !t.quantumOwned).map((t) => ({
1080
+ })), [x]), b = k(() => E.filter((t) => i === "copy" ? !0 : !t.quantumOwned).map((t) => ({
1071
1081
  value: t.id,
1072
1082
  label: t.name,
1073
1083
  // Add custom data to identify quantum-owned modules
1074
1084
  isQuantumOwned: t.quantumOwned
1075
- })), [E, r]), $ = p.fetching, q = g.fetching;
1085
+ })), [E, i]), P = p.fetching, q = g.fetching;
1076
1086
  return /* @__PURE__ */ e.jsx(J, { children: /* @__PURE__ */ e.jsxs(ee, { spacing: 6, align: "stretch", children: [
1077
- u && /* @__PURE__ */ e.jsxs(B, { children: [
1087
+ d && /* @__PURE__ */ e.jsxs(B, { children: [
1078
1088
  /* @__PURE__ */ e.jsx(re, { children: "Operation Mode" }),
1079
1089
  /* @__PURE__ */ e.jsx(
1080
1090
  Je,
1081
1091
  {
1082
- value: r,
1092
+ value: i,
1083
1093
  onChange: (t) => {
1084
- d(t), m([]);
1094
+ u(t), h([]);
1085
1095
  },
1086
1096
  children: /* @__PURE__ */ e.jsxs(te, { spacing: 6, children: [
1087
- /* @__PURE__ */ e.jsx(Te, { value: "copy", colorScheme: "blue", children: /* @__PURE__ */ e.jsxs(ee, { align: "start", spacing: 1, children: [
1088
- /* @__PURE__ */ e.jsx(b, { fontWeight: "medium", children: "Copy Modules" }),
1089
- /* @__PURE__ */ e.jsx(b, { fontSize: "sm", color: "gray.600", children: "Create new modules based on selected ones" })
1097
+ /* @__PURE__ */ e.jsx(Ae, { value: "copy", colorScheme: "blue", children: /* @__PURE__ */ e.jsxs(ee, { align: "start", spacing: 1, children: [
1098
+ /* @__PURE__ */ e.jsx(w, { fontWeight: "medium", children: "Copy Modules" }),
1099
+ /* @__PURE__ */ e.jsx(w, { fontSize: "sm", color: "gray.600", children: "Create new modules based on selected ones" })
1090
1100
  ] }) }),
1091
- /* @__PURE__ */ e.jsx(Te, { value: "convert", colorScheme: "green", children: /* @__PURE__ */ e.jsxs(ee, { align: "start", spacing: 1, children: [
1092
- /* @__PURE__ */ e.jsx(b, { fontWeight: "medium", children: "Convert to Quantum Owned" }),
1093
- /* @__PURE__ */ e.jsx(b, { fontSize: "sm", color: "gray.600", children: "Convert existing modules to quantum-owned" })
1101
+ /* @__PURE__ */ e.jsx(Ae, { value: "convert", colorScheme: "green", children: /* @__PURE__ */ e.jsxs(ee, { align: "start", spacing: 1, children: [
1102
+ /* @__PURE__ */ e.jsx(w, { fontWeight: "medium", children: "Convert to Quantum Owned" }),
1103
+ /* @__PURE__ */ e.jsx(w, { fontSize: "sm", color: "gray.600", children: "Convert existing modules to quantum-owned" })
1094
1104
  ] }) })
1095
1105
  ] })
1096
1106
  }
@@ -1099,67 +1109,67 @@ const Ht = ({
1099
1109
  /* @__PURE__ */ e.jsxs(B, { children: [
1100
1110
  /* @__PURE__ */ e.jsx(re, { children: "Select Source Group" }),
1101
1111
  /* @__PURE__ */ e.jsx(
1102
- ne,
1112
+ se,
1103
1113
  {
1104
1114
  placeholder: "Choose a group...",
1105
- options: V,
1106
- value: V.find((t) => t.value === a) || null,
1115
+ options: K,
1116
+ value: K.find((t) => t.value === l) || null,
1107
1117
  onChange: Q,
1108
- isLoading: $,
1109
- isDisabled: $,
1118
+ isLoading: P,
1119
+ isDisabled: P,
1110
1120
  isClearable: !0
1111
1121
  }
1112
1122
  ),
1113
- p.error && /* @__PURE__ */ e.jsxs(Ae, { status: "error", mt: 2, children: [
1123
+ p.error && /* @__PURE__ */ e.jsxs(Te, { status: "error", mt: 2, children: [
1114
1124
  /* @__PURE__ */ e.jsx(Me, {}),
1115
- /* @__PURE__ */ e.jsxs(b, { fontSize: "sm", children: [
1125
+ /* @__PURE__ */ e.jsxs(w, { fontSize: "sm", children: [
1116
1126
  "Failed to load groups: ",
1117
1127
  p.error.message
1118
1128
  ] })
1119
1129
  ] })
1120
1130
  ] }),
1121
- a && /* @__PURE__ */ e.jsxs(B, { children: [
1122
- /* @__PURE__ */ e.jsx(re, { children: r === "convert" ? "Select Module to Convert" : "Select Module to Copy" }),
1131
+ l && /* @__PURE__ */ e.jsxs(B, { children: [
1132
+ /* @__PURE__ */ e.jsx(re, { children: i === "convert" ? "Select Module to Convert" : "Select Module to Copy" }),
1123
1133
  q ? /* @__PURE__ */ e.jsxs(te, { children: [
1124
1134
  /* @__PURE__ */ e.jsx(Xe, { size: "sm" }),
1125
- /* @__PURE__ */ e.jsx(b, { fontSize: "sm", color: "gray.600", children: "Loading modules..." })
1135
+ /* @__PURE__ */ e.jsx(w, { fontSize: "sm", color: "gray.600", children: "Loading modules..." })
1126
1136
  ] }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1127
1137
  /* @__PURE__ */ e.jsx(
1128
- ne,
1138
+ se,
1129
1139
  {
1130
- placeholder: r === "convert" ? "Choose modules to convert..." : "Choose modules to copy...",
1131
- options: v,
1132
- value: v.filter(
1133
- (t) => I.includes(t.value)
1140
+ placeholder: i === "convert" ? "Choose modules to convert..." : "Choose modules to copy...",
1141
+ options: b,
1142
+ value: b.filter(
1143
+ (t) => N.includes(t.value)
1134
1144
  ),
1135
- onChange: K,
1136
- isDisabled: v.length === 0,
1145
+ onChange: Z,
1146
+ isDisabled: b.length === 0,
1137
1147
  isClearable: !0,
1138
1148
  isMulti: !0,
1139
1149
  closeMenuOnSelect: !1,
1140
- formatOptionLabel: (t, { context: h }) => /* @__PURE__ */ e.jsxs(te, { justify: "space-between", w: "100%", children: [
1150
+ formatOptionLabel: (t, { context: m }) => /* @__PURE__ */ e.jsxs(te, { justify: "space-between", w: "100%", children: [
1141
1151
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
1142
- /* @__PURE__ */ e.jsx(b, { children: t.label }),
1143
- h === "value" && t.isQuantumOwned && /* @__PURE__ */ e.jsx(b, { color: "blue", fontSize: "xs", children: "(Quantum Owned)" })
1152
+ /* @__PURE__ */ e.jsx(w, { children: t.label }),
1153
+ m === "value" && t.isQuantumOwned && /* @__PURE__ */ e.jsx(w, { color: "blue", fontSize: "xs", children: "(Quantum Owned)" })
1144
1154
  ] }),
1145
- t.isQuantumOwned && h === "menu" && /* @__PURE__ */ e.jsx(fe, { size: "sm", colorScheme: "blue", variant: "solid", children: "Quantum Owned" })
1155
+ t.isQuantumOwned && m === "menu" && /* @__PURE__ */ e.jsx(fe, { size: "sm", colorScheme: "blue", variant: "solid", children: "Quantum Owned" })
1146
1156
  ] })
1147
1157
  }
1148
1158
  ),
1149
- v.length === 0 && /* @__PURE__ */ e.jsx(b, { fontSize: "sm", color: "gray.500", mt: 2, children: "No modules found in this group" })
1159
+ b.length === 0 && /* @__PURE__ */ e.jsx(w, { fontSize: "sm", color: "gray.500", mt: 2, children: "No modules found in this group" })
1150
1160
  ] }),
1151
- g.error && /* @__PURE__ */ e.jsxs(Ae, { status: "error", mt: 2, children: [
1161
+ g.error && /* @__PURE__ */ e.jsxs(Te, { status: "error", mt: 2, children: [
1152
1162
  /* @__PURE__ */ e.jsx(Me, {}),
1153
- /* @__PURE__ */ e.jsxs(b, { fontSize: "sm", children: [
1163
+ /* @__PURE__ */ e.jsxs(w, { fontSize: "sm", children: [
1154
1164
  "Failed to load modules: ",
1155
1165
  g.error.message
1156
1166
  ] })
1157
1167
  ] })
1158
1168
  ] }),
1159
- O.length > 0 && /* @__PURE__ */ e.jsxs(J, { p: 4, bg: "gray.50", borderRadius: "md", children: [
1160
- /* @__PURE__ */ e.jsx(b, { fontWeight: "semibold", mb: 3, children: O.length === 1 ? `Module to ${r === "copy" ? "Copy" : "Convert"}` : `${O.length} Modules to ${r === "copy" ? "Copy" : "Convert"}` }),
1169
+ M.length > 0 && /* @__PURE__ */ e.jsxs(J, { p: 4, bg: "gray.50", borderRadius: "md", children: [
1170
+ /* @__PURE__ */ e.jsx(w, { fontWeight: "semibold", mb: 3, children: M.length === 1 ? `Module to ${i === "copy" ? "Copy" : "Convert"}` : `${M.length} Modules to ${i === "copy" ? "Copy" : "Convert"}` }),
1161
1171
  /* @__PURE__ */ e.jsxs(ee, { align: "start", spacing: 3, children: [
1162
- O.map((t, h) => /* @__PURE__ */ e.jsxs(
1172
+ M.map((t, m) => /* @__PURE__ */ e.jsxs(
1163
1173
  J,
1164
1174
  {
1165
1175
  w: "100%",
@@ -1170,8 +1180,8 @@ const Ht = ({
1170
1180
  borderColor: "gray.200",
1171
1181
  children: [
1172
1182
  /* @__PURE__ */ e.jsxs(te, { justify: "space-between", align: "start", mb: 2, children: [
1173
- /* @__PURE__ */ e.jsxs(b, { fontWeight: "medium", fontSize: "sm", children: [
1174
- h + 1,
1183
+ /* @__PURE__ */ e.jsxs(w, { fontWeight: "medium", fontSize: "sm", children: [
1184
+ m + 1,
1175
1185
  ". ",
1176
1186
  t.name
1177
1187
  ] }),
@@ -1185,20 +1195,20 @@ const Ht = ({
1185
1195
  fontSize: "sm",
1186
1196
  color: "gray.600",
1187
1197
  children: [
1188
- t.description && /* @__PURE__ */ e.jsxs(b, { children: [
1198
+ t.description && /* @__PURE__ */ e.jsxs(w, { children: [
1189
1199
  /* @__PURE__ */ e.jsx("strong", { children: "Description:" }),
1190
1200
  " ",
1191
1201
  t.description
1192
1202
  ] }),
1193
- /* @__PURE__ */ e.jsxs(b, { children: [
1203
+ /* @__PURE__ */ e.jsxs(w, { children: [
1194
1204
  /* @__PURE__ */ e.jsx("strong", { children: "Actions:" }),
1195
1205
  " ",
1196
1206
  t.moduleActions.length
1197
1207
  ] }),
1198
- /* @__PURE__ */ e.jsxs(b, { children: [
1208
+ /* @__PURE__ */ e.jsxs(w, { children: [
1199
1209
  /* @__PURE__ */ e.jsx("strong", { children: "Categories:" }),
1200
1210
  " ",
1201
- t.categories.map((S) => S.name).join(", ") || "None"
1211
+ t.categories.map((A) => A.name).join(", ") || "None"
1202
1212
  ] })
1203
1213
  ]
1204
1214
  }
@@ -1207,7 +1217,7 @@ const Ht = ({
1207
1217
  },
1208
1218
  t.id
1209
1219
  )),
1210
- O.length > 1 && /* @__PURE__ */ e.jsx(
1220
+ M.length > 1 && /* @__PURE__ */ e.jsx(
1211
1221
  J,
1212
1222
  {
1213
1223
  w: "100%",
@@ -1216,16 +1226,16 @@ const Ht = ({
1216
1226
  borderRadius: "md",
1217
1227
  border: "1px solid",
1218
1228
  borderColor: "blue.200",
1219
- children: /* @__PURE__ */ e.jsxs(b, { fontSize: "sm", fontWeight: "medium", color: "blue.800", children: [
1229
+ children: /* @__PURE__ */ e.jsxs(w, { fontSize: "sm", fontWeight: "medium", color: "blue.800", children: [
1220
1230
  "Total: ",
1221
- O.length,
1231
+ M.length,
1222
1232
  " modules will be",
1223
1233
  " ",
1224
- r === "copy" ? "copied" : "converted"
1234
+ i === "copy" ? "copied" : "converted"
1225
1235
  ] })
1226
1236
  }
1227
1237
  ),
1228
- u && O.filter((t) => t.moduleActions.some((h) => !h.action.quantumOwned)).length > 0 && /* @__PURE__ */ e.jsx(
1238
+ d && M.filter((t) => t.moduleActions.some((m) => !m.action.quantumOwned)).length > 0 && /* @__PURE__ */ e.jsx(
1229
1239
  J,
1230
1240
  {
1231
1241
  p: 2,
@@ -1233,105 +1243,105 @@ const Ht = ({
1233
1243
  borderRadius: "md",
1234
1244
  border: "1px solid",
1235
1245
  borderColor: "yellow.200",
1236
- children: /* @__PURE__ */ e.jsx(b, { fontSize: "sm", fontWeight: "medium", color: "yellow.800", children: r === "convert" ? "Converting Modules will convert non QM-Owned Actions to QM-Owned" : "Copying Modules with Non QM-Owned Actions will create corresponding QM-Owned Actions" })
1246
+ children: /* @__PURE__ */ e.jsx(w, { fontSize: "sm", fontWeight: "medium", color: "yellow.800", children: i === "convert" ? "Converting Modules will convert non QM-Owned Actions to QM-Owned" : "Copying Modules with Non QM-Owned Actions will create corresponding QM-Owned Actions" })
1237
1247
  }
1238
1248
  )
1239
1249
  ] })
1240
1250
  ] }),
1241
- !c && /* @__PURE__ */ e.jsxs(pe, { spacing: 4, justifyContent: "flex-end", children: [
1251
+ !a && /* @__PURE__ */ e.jsxs(pe, { spacing: 4, justifyContent: "flex-end", children: [
1242
1252
  /* @__PURE__ */ e.jsx(
1243
1253
  X,
1244
1254
  {
1245
1255
  variant: "outline",
1246
- onClick: k,
1247
- isDisabled: j,
1256
+ onClick: R,
1257
+ isDisabled: f,
1248
1258
  children: "Cancel"
1249
1259
  }
1250
1260
  ),
1251
1261
  /* @__PURE__ */ e.jsxs(
1252
1262
  X,
1253
1263
  {
1254
- colorScheme: r === "copy" ? "blue" : "green",
1264
+ colorScheme: i === "copy" ? "blue" : "green",
1255
1265
  onClick: Y,
1256
- isDisabled: O.length === 0 || j,
1257
- isLoading: j,
1258
- loadingText: `${r === "copy" ? "Copying" : "Converting"}...`,
1266
+ isDisabled: M.length === 0 || f,
1267
+ isLoading: f,
1268
+ loadingText: `${i === "copy" ? "Copying" : "Converting"}...`,
1259
1269
  children: [
1260
- r === "copy" ? "Copy" : "Convert",
1270
+ i === "copy" ? "Copy" : "Convert",
1261
1271
  " ",
1262
- O.length === 1 ? "Module" : `${O.length} Modules`
1272
+ M.length === 1 ? "Module" : `${M.length} Modules`
1263
1273
  ]
1264
1274
  }
1265
1275
  )
1266
1276
  ] })
1267
1277
  ] }) });
1268
- }, ns = ({
1269
- name: n,
1270
- setName: s,
1278
+ }, on = ({
1279
+ name: s,
1280
+ setName: n,
1271
1281
  actions: o,
1272
- selectedActionIds: c,
1273
- setSelectedActionIds: i,
1274
- availableCategories: l,
1275
- selectedCategoryIds: u,
1276
- setSelectedCategoryIds: x,
1277
- description: a,
1278
- setDescription: w,
1279
- ...I
1282
+ selectedActionIds: a,
1283
+ setSelectedActionIds: c,
1284
+ availableCategories: r,
1285
+ selectedCategoryIds: d,
1286
+ setSelectedCategoryIds: j,
1287
+ description: l,
1288
+ setDescription: S,
1289
+ ...N
1280
1290
  }) => {
1281
- const m = mt(), j = D(() => o.map((y) => ({
1291
+ const h = mt(), f = k(() => o.map((y) => ({
1282
1292
  ...y,
1283
- selected: c.includes(y.id)
1284
- })), [o, c]), f = D(() => o.reduce((y, A) => (y[A.id] = A, y), {}), [o]), r = D(
1285
- () => c.map((y) => f[y]),
1286
- [j, c]
1287
- ), d = R(
1288
- (y, A) => {
1289
- i(A ? [...c, y.id] : c.filter((C) => C !== y.id));
1293
+ selected: a.includes(y.id)
1294
+ })), [o, a]), v = k(() => o.reduce((y, T) => (y[T.id] = T, y), {}), [o]), i = k(
1295
+ () => a.map((y) => v[y]),
1296
+ [f, a]
1297
+ ), u = F(
1298
+ (y, T) => {
1299
+ c(T ? [...a, y.id] : a.filter((D) => D !== y.id));
1290
1300
  },
1291
- [c, i]
1292
- ), p = R(
1301
+ [a, c]
1302
+ ), p = F(
1293
1303
  (y) => {
1294
- s(y.target.value);
1304
+ n(y.target.value);
1295
1305
  },
1296
- [s]
1297
- ), g = R(
1306
+ [n]
1307
+ ), g = F(
1298
1308
  (y) => {
1299
- w?.(y.target.value);
1309
+ S?.(y.target.value);
1300
1310
  },
1301
- [w]
1311
+ [S]
1302
1312
  );
1303
- return /* @__PURE__ */ e.jsxs(J, { ...I, children: [
1313
+ return /* @__PURE__ */ e.jsxs(J, { ...N, children: [
1304
1314
  /* @__PURE__ */ e.jsxs(te, { gap: "2rem", children: [
1305
- /* @__PURE__ */ e.jsx(os, { name: n ?? "", onInputChange: p }),
1315
+ /* @__PURE__ */ e.jsx(rn, { name: s ?? "", onInputChange: p }),
1306
1316
  /* @__PURE__ */ e.jsx(
1307
- rs,
1317
+ ln,
1308
1318
  {
1309
- availableCategories: l,
1310
- value: u,
1311
- onChange: x
1319
+ availableCategories: r,
1320
+ value: d,
1321
+ onChange: j
1312
1322
  }
1313
1323
  )
1314
1324
  ] }),
1315
1325
  /* @__PURE__ */ e.jsx(
1316
- is,
1326
+ an,
1317
1327
  {
1318
- description: a ?? "",
1328
+ description: l ?? "",
1319
1329
  onInputChange: g
1320
1330
  }
1321
1331
  ),
1322
1332
  /* @__PURE__ */ e.jsx(
1323
- ls,
1333
+ cn,
1324
1334
  {
1325
- value: r,
1326
- onChange: i,
1327
- onAdjustActivities: () => m.onOpen()
1335
+ value: i,
1336
+ onChange: c,
1337
+ onAdjustActivities: () => h.onOpen()
1328
1338
  }
1329
1339
  ),
1330
1340
  /* @__PURE__ */ e.jsxs(
1331
1341
  pt,
1332
1342
  {
1333
- isOpen: m.isOpen,
1334
- onClose: m.onClose,
1343
+ isOpen: h.isOpen,
1344
+ onClose: h.onClose,
1335
1345
  size: "6xl",
1336
1346
  children: [
1337
1347
  /* @__PURE__ */ e.jsx(gt, {}),
@@ -1339,10 +1349,10 @@ const Ht = ({
1339
1349
  /* @__PURE__ */ e.jsx(jt, { children: "Select Activities" }),
1340
1350
  /* @__PURE__ */ e.jsx(ft, {}),
1341
1351
  /* @__PURE__ */ e.jsx(vt, { children: /* @__PURE__ */ e.jsx(
1342
- ss,
1352
+ sn,
1343
1353
  {
1344
- actions: j,
1345
- onSelected: d,
1354
+ actions: f,
1355
+ onSelected: u,
1346
1356
  disableCreate: !0,
1347
1357
  disableDelete: !0,
1348
1358
  tableProps: {
@@ -1355,8 +1365,8 @@ const Ht = ({
1355
1365
  X,
1356
1366
  {
1357
1367
  colorScheme: "blue",
1358
- onClick: m.onClose,
1359
- isDisabled: c.length === 0,
1368
+ onClick: h.onClose,
1369
+ isDisabled: a.length === 0,
1360
1370
  children: "Done"
1361
1371
  }
1362
1372
  ) })
@@ -1365,92 +1375,92 @@ const Ht = ({
1365
1375
  }
1366
1376
  )
1367
1377
  ] });
1368
- }, os = Oe(
1378
+ }, rn = Oe(
1369
1379
  ({
1370
- name: n,
1371
- onInputChange: s
1380
+ name: s,
1381
+ onInputChange: n
1372
1382
  }) => /* @__PURE__ */ e.jsxs(B, { mb: 4, children: [
1373
1383
  /* @__PURE__ */ e.jsx(re, { children: "Module Name" }),
1374
1384
  /* @__PURE__ */ e.jsx(
1375
1385
  je,
1376
1386
  {
1377
1387
  placeholder: "i.e. ACL RTP Test Battery",
1378
- value: n,
1379
- onChange: s,
1388
+ value: s,
1389
+ onChange: n,
1380
1390
  isRequired: !0
1381
1391
  }
1382
1392
  )
1383
1393
  ] })
1384
- ), rs = Oe(
1394
+ ), ln = Oe(
1385
1395
  ({
1386
- availableCategories: n,
1387
- value: s,
1396
+ availableCategories: s,
1397
+ value: n,
1388
1398
  onChange: o
1389
1399
  }) => {
1390
- const c = D(() => [
1391
- ...n,
1400
+ const a = k(() => [
1401
+ ...s,
1392
1402
  {
1393
1403
  id: "other",
1394
1404
  name: "Other"
1395
1405
  }
1396
- ], [n]), i = D(() => c.map((l) => ({
1397
- value: l.id,
1398
- label: l.name
1399
- })), [c]);
1406
+ ], [s]), c = k(() => a.map((r) => ({
1407
+ value: r.id,
1408
+ label: r.name
1409
+ })), [a]);
1400
1410
  return /* @__PURE__ */ e.jsxs(B, { mb: 4, children: [
1401
1411
  /* @__PURE__ */ e.jsx(re, { children: "Module Category" }),
1402
1412
  /* @__PURE__ */ e.jsx(
1403
- ne,
1413
+ se,
1404
1414
  {
1405
- isDisabled: n.length === 0,
1415
+ isDisabled: s.length === 0,
1406
1416
  isClearable: !0,
1407
- options: i,
1408
- value: c.filter((l) => s.includes(l.id)).map((l) => ({
1409
- value: l.id,
1410
- label: l.name
1417
+ options: c,
1418
+ value: a.filter((r) => n.includes(r.id)).map((r) => ({
1419
+ value: r.id,
1420
+ label: r.name
1411
1421
  })),
1412
- onChange: (l) => o(l ? [l.value] : []),
1422
+ onChange: (r) => o(r ? [r.value] : []),
1413
1423
  placeholder: "Select category"
1414
1424
  }
1415
1425
  )
1416
1426
  ] });
1417
1427
  }
1418
- ), is = Oe(
1428
+ ), an = Oe(
1419
1429
  ({
1420
- description: n,
1421
- onInputChange: s
1430
+ description: s,
1431
+ onInputChange: n
1422
1432
  }) => /* @__PURE__ */ e.jsxs(B, { mb: 4, children: [
1423
1433
  /* @__PURE__ */ e.jsx(re, { children: /* @__PURE__ */ e.jsxs("span", { children: [
1424
1434
  "Description",
1425
- /* @__PURE__ */ e.jsx(b, { fontSize: "sm", color: "gray.500", children: "Briefly describe the objective of this module. Max 40 words." })
1435
+ /* @__PURE__ */ e.jsx(w, { fontSize: "sm", color: "gray.500", children: "Briefly describe the objective of this module. Max 40 words." })
1426
1436
  ] }) }),
1427
1437
  /* @__PURE__ */ e.jsx(
1428
1438
  je,
1429
1439
  {
1430
1440
  placeholder: "i.e. Assess readiness to return to play post-ACL reconstruction",
1431
- value: n,
1432
- onChange: s
1441
+ value: s,
1442
+ onChange: n
1433
1443
  }
1434
1444
  )
1435
1445
  ] })
1436
- ), ls = Oe(
1446
+ ), cn = Oe(
1437
1447
  ({
1438
- value: n,
1439
- onChange: s,
1448
+ value: s,
1449
+ onChange: n,
1440
1450
  onAdjustActivities: o
1441
1451
  }) => {
1442
- const c = D(
1443
- () => n.map((i) => ({
1444
- id: i.id,
1445
- name: i.name
1452
+ const a = k(
1453
+ () => s.map((c) => ({
1454
+ id: c.id,
1455
+ name: c.name
1446
1456
  })),
1447
- [n]
1457
+ [s]
1448
1458
  );
1449
1459
  return /* @__PURE__ */ e.jsxs(B, { mb: 4, children: [
1450
1460
  /* @__PURE__ */ e.jsxs(te, { justifyContent: "space-between", children: [
1451
1461
  /* @__PURE__ */ e.jsx(re, { children: /* @__PURE__ */ e.jsxs("span", { children: [
1452
1462
  "Activities",
1453
- /* @__PURE__ */ e.jsx(b, { fontSize: "sm", color: "gray.500", children: "Drag and drop to reorder the activities in this module." })
1463
+ /* @__PURE__ */ e.jsx(w, { fontSize: "sm", color: "gray.500", children: "Drag and drop to reorder the activities in this module." })
1454
1464
  ] }) }),
1455
1465
  /* @__PURE__ */ e.jsx(
1456
1466
  X,
@@ -1463,7 +1473,7 @@ const Ht = ({
1463
1473
  }
1464
1474
  )
1465
1475
  ] }),
1466
- c.length === 0 ? /* @__PURE__ */ e.jsx(ee, { children: /* @__PURE__ */ e.jsxs(b, { color: "gray.500", fontSize: "lg", mb: "4rem", mt: "4rem", children: [
1476
+ a.length === 0 ? /* @__PURE__ */ e.jsx(ee, { children: /* @__PURE__ */ e.jsxs(w, { color: "gray.500", fontSize: "lg", mb: "4rem", mt: "4rem", children: [
1467
1477
  "No activities selected for this module.",
1468
1478
  /* @__PURE__ */ e.jsx(
1469
1479
  X,
@@ -1479,81 +1489,81 @@ const Ht = ({
1479
1489
  ] }) }) : /* @__PURE__ */ e.jsx(
1480
1490
  Yt,
1481
1491
  {
1482
- value: c,
1483
- onChange: (i) => {
1484
- const l = i(c);
1485
- s(l.map((u) => u.id));
1492
+ value: a,
1493
+ onChange: (c) => {
1494
+ const r = c(a);
1495
+ n(r.map((d) => d.id));
1486
1496
  }
1487
1497
  }
1488
1498
  )
1489
1499
  ] });
1490
1500
  }
1491
- ), as = ({
1492
- value: n,
1493
- onChange: s,
1501
+ ), dn = ({
1502
+ value: s,
1503
+ onChange: n,
1494
1504
  forceKind: o,
1495
- disableRemove: c,
1496
- disableKind: i,
1497
- lockRanges: l,
1498
- ...u
1505
+ disableRemove: a,
1506
+ disableKind: c,
1507
+ lockRanges: r,
1508
+ ...d
1499
1509
  }) => {
1500
- const x = D(() => [...n].sort((m, j) => {
1501
- const f = $e.indexOf(m.plane), r = $e.indexOf(j.plane);
1502
- return f - r;
1503
- }), [n]), a = R((m) => "segment" in m.id ? ot(m.id.segment, m.plane, !0) ?? "Unknown" : rt(m.id.joint, m.plane, !0) ?? "Unknown", []), w = R(
1504
- (m, j) => {
1505
- const f = x.findIndex(
1506
- (d) => d.id === j.id && d.plane === j.plane
1510
+ const j = k(() => [...s].sort((h, f) => {
1511
+ const v = Pe.indexOf(h.plane), i = Pe.indexOf(f.plane);
1512
+ return v - i;
1513
+ }), [s]), l = F((h) => "segment" in h.id ? ot(h.id.segment, h.plane, !0) ?? "Unknown" : rt(h.id.joint, h.plane, !0) ?? "Unknown", []), S = F(
1514
+ (h, f) => {
1515
+ const v = j.findIndex(
1516
+ (u) => u.id === f.id && u.plane === f.plane
1507
1517
  );
1508
- let r = [...x];
1509
- o && (j = { ...j, kind: o }), r[f] = j, l && (r = r.map((d) => ({
1510
- ...d,
1511
- min: j.min,
1512
- max: j.max
1513
- }))), s(r);
1518
+ let i = [...j];
1519
+ o && (f = { ...f, kind: o }), i[v] = f, r && (i = i.map((u) => ({
1520
+ ...u,
1521
+ min: f.min,
1522
+ max: f.max
1523
+ }))), n(i);
1514
1524
  },
1515
- [s, x, o, l]
1516
- ), I = R(
1517
- (m) => {
1518
- const j = x.filter(
1519
- (f) => f.id !== m.id || f.plane !== m.plane
1525
+ [n, j, o, r]
1526
+ ), N = F(
1527
+ (h) => {
1528
+ const f = j.filter(
1529
+ (v) => v.id !== h.id || v.plane !== h.plane
1520
1530
  );
1521
- s(j);
1531
+ n(f);
1522
1532
  },
1523
- [s, x]
1533
+ [n, j]
1524
1534
  );
1525
- return /* @__PURE__ */ e.jsx(ee, { alignItems: "flex-start", overflowY: "auto", ...u, children: x.map((m, j) => /* @__PURE__ */ e.jsx(
1526
- cs,
1535
+ return /* @__PURE__ */ e.jsx(ee, { alignItems: "flex-start", overflowY: "auto", ...d, children: j.map((h, f) => /* @__PURE__ */ e.jsx(
1536
+ un,
1527
1537
  {
1528
- label: a(m),
1529
- parameter: m,
1530
- onChange: (f) => w(j, f),
1531
- onRemove: c ? void 0 : () => I(m),
1538
+ label: l(h),
1539
+ parameter: h,
1540
+ onChange: (v) => S(f, v),
1541
+ onRemove: a ? void 0 : () => N(h),
1532
1542
  forceKind: o,
1533
- disableKind: i
1543
+ disableKind: c
1534
1544
  },
1535
- `${JSON.stringify(m.id)}-${m.plane}`
1545
+ `${JSON.stringify(h.id)}-${h.plane}`
1536
1546
  )) });
1537
- }, cs = ({
1538
- label: n,
1539
- parameter: s,
1547
+ }, un = ({
1548
+ label: s,
1549
+ parameter: n,
1540
1550
  onChange: o,
1541
- onRemove: c,
1542
- forceKind: i,
1543
- disableKind: l
1551
+ onRemove: a,
1552
+ forceKind: c,
1553
+ disableKind: r
1544
1554
  }) => {
1545
- const u = R(
1546
- (w) => "joint" in s.id ? _t(
1547
- s.id.joint,
1548
- s.plane,
1549
- w < 0 ? -1 : 1
1555
+ const d = F(
1556
+ (S) => "joint" in n.id ? _t(
1557
+ n.id.joint,
1558
+ n.plane,
1559
+ S < 0 ? -1 : 1
1550
1560
  ) : Gt(
1551
- s.id.segment,
1552
- s.plane,
1553
- w < 0 ? -1 : 1
1561
+ n.id.segment,
1562
+ n.plane,
1563
+ S < 0 ? -1 : 1
1554
1564
  ),
1555
- [s]
1556
- ), { min: x, max: a } = "joint" in s.id ? Ut(s.id.joint, s.plane) : { min: -180, max: 180 };
1565
+ [n]
1566
+ ), { min: j, max: l } = "joint" in n.id ? Wt(n.id.joint, n.plane) : { min: -180, max: 180 };
1557
1567
  return /* @__PURE__ */ e.jsxs(
1558
1568
  ee,
1559
1569
  {
@@ -1567,31 +1577,31 @@ const Ht = ({
1567
1577
  children: [
1568
1578
  /* @__PURE__ */ e.jsxs(te, { w: "100%", children: [
1569
1579
  /* @__PURE__ */ e.jsx(
1570
- b,
1580
+ w,
1571
1581
  {
1572
1582
  fontSize: "sm",
1573
1583
  flex: 1,
1574
1584
  textTransform: "capitalize",
1575
1585
  fontWeight: "semibold",
1576
- children: n
1586
+ children: s
1577
1587
  }
1578
1588
  ),
1579
- c && /* @__PURE__ */ e.jsx(
1589
+ a && /* @__PURE__ */ e.jsx(
1580
1590
  bt,
1581
1591
  {
1582
1592
  size: "xs",
1583
1593
  variant: "ghost",
1584
1594
  "aria-label": "delete",
1585
- icon: /* @__PURE__ */ e.jsx(Ue, { as: Tt }),
1586
- onClick: c
1595
+ icon: /* @__PURE__ */ e.jsx(We, { as: At }),
1596
+ onClick: a
1587
1597
  }
1588
1598
  ),
1589
- !i && /* @__PURE__ */ e.jsx(
1599
+ !c && /* @__PURE__ */ e.jsx(
1590
1600
  Xt,
1591
1601
  {
1592
- selectedItem: s?.kind ?? Ce.Limit,
1593
- onChange: ({ value: w }) => o({ ...s, kind: w }),
1594
- isDisabled: l,
1602
+ selectedItem: n?.kind ?? we.Limit,
1603
+ onChange: ({ value: S }) => o({ ...n, kind: S }),
1604
+ isDisabled: r,
1595
1605
  buttonProps: {
1596
1606
  size: "sm",
1597
1607
  variant: "outline",
@@ -1602,295 +1612,295 @@ const Ht = ({
1602
1612
  colorScheme: "teal"
1603
1613
  },
1604
1614
  items: [
1605
- { value: Ce.Limit, label: "limit" },
1606
- { value: Ce.Target, label: "target" }
1615
+ { value: we.Limit, label: "limit" },
1616
+ { value: we.Target, label: "target" }
1607
1617
  ]
1608
1618
  }
1609
1619
  )
1610
1620
  ] }),
1611
1621
  /* @__PURE__ */ e.jsx(
1612
- Kt,
1622
+ Zt,
1613
1623
  {
1614
1624
  w: "100%",
1615
1625
  size: "xs",
1616
- min: x,
1617
- max: a,
1626
+ min: j,
1627
+ max: l,
1618
1628
  zeroMarker: !0,
1619
- value: [s.min, s.max],
1620
- onChange: (w) => o({ ...s, min: w[0], max: w[1] }),
1621
- formatValue: (w) => `${Math.abs(w)}°`,
1622
- valueLabel: (w) => u(w) ?? "",
1623
- positiveNegativeLabels: u(0) ? [u(-1) ?? "", u(1) ?? ""] : void 0
1629
+ value: [n.min, n.max],
1630
+ onChange: (S) => o({ ...n, min: S[0], max: S[1] }),
1631
+ formatValue: (S) => `${Math.abs(S)}°`,
1632
+ valueLabel: (S) => d(S) ?? "",
1633
+ positiveNegativeLabels: d(0) ? [d(-1) ?? "", d(1) ?? ""] : void 0
1624
1634
  }
1625
1635
  )
1626
1636
  ]
1627
1637
  }
1628
1638
  );
1629
- }, be = (n, s) => "segment" in n && "segment" in s && n.segment === s.segment || "joint" in n && "joint" in s && n.joint === s.joint, ds = ({
1630
- options: n,
1631
- value: s,
1639
+ }, be = (s, n) => "segment" in s && "segment" in n && s.segment === n.segment || "joint" in s && "joint" in n && s.joint === n.joint, hn = ({
1640
+ options: s,
1641
+ value: n,
1632
1642
  onChange: o,
1633
- forceKind: c,
1634
- singleValue: i,
1635
- singleValueSideless: l,
1636
- editOnly: u,
1637
- disableKind: x,
1638
- maxParameters: a,
1639
- ...w
1643
+ forceKind: a,
1644
+ singleValue: c,
1645
+ singleValueSideless: r,
1646
+ editOnly: d,
1647
+ disableKind: j,
1648
+ maxParameters: l,
1649
+ ...S
1640
1650
  }) => {
1641
- const I = l ? 2 : a, m = D(
1642
- () => n.map((d) => ({
1643
- label: "segment" in d.id ? ot(d.id.segment, d.plane, !0) ?? "Unknown" : rt(d.id.joint, d.plane, !0) ?? "Unknown",
1644
- value: d.id,
1645
- plane: d.plane
1651
+ const N = r ? 2 : l, h = k(
1652
+ () => s.map((u) => ({
1653
+ label: "segment" in u.id ? ot(u.id.segment, u.plane, !0) ?? "Unknown" : rt(u.id.joint, u.plane, !0) ?? "Unknown",
1654
+ value: u.id,
1655
+ plane: u.plane
1646
1656
  })),
1647
- [n]
1648
- ), j = D(() => {
1649
- if (!l || s.length === 0)
1650
- return m;
1651
- const d = s[0];
1652
- return m.filter(
1653
- (p) => ve(p.value) === ve(d.id) && p.plane === d.plane
1657
+ [s]
1658
+ ), f = k(() => {
1659
+ if (!r || n.length === 0)
1660
+ return h;
1661
+ const u = n[0];
1662
+ return h.filter(
1663
+ (p) => ve(p.value) === ve(u.id) && p.plane === u.plane
1654
1664
  );
1655
- }, [m, s, l]), f = D(
1656
- () => m.filter(
1657
- (d) => s.some((p) => be(p.id, d.value) && p.plane === d.plane)
1665
+ }, [h, n, r]), v = k(
1666
+ () => h.filter(
1667
+ (u) => n.some((p) => be(p.id, u.value) && p.plane === u.plane)
1658
1668
  ),
1659
- [m, s]
1660
- ), r = R(
1661
- (d) => {
1662
- const p = d.map((g) => {
1663
- const y = s.find(
1669
+ [h, n]
1670
+ ), i = F(
1671
+ (u) => {
1672
+ const p = u.map((g) => {
1673
+ const y = n.find(
1664
1674
  (E) => be(E.id, g.value) && E.plane === g.plane
1665
- ), A = n.find(
1675
+ ), T = s.find(
1666
1676
  (E) => be(E.id, g.value) && E.plane === g.plane
1667
- ), C = l ? s.find(
1677
+ ), D = r ? n.find(
1668
1678
  (E) => ve(E.id) === ve(g.value) && E.plane === g.plane
1669
- ) : void 0, T = C && !y ? C.min : A && A.min ? A.min : 0, M = C && !y ? C.max : A && A.max ? A.max : 0;
1679
+ ) : void 0, C = D && !y ? D.min : T && T.min ? T.min : 0, x = D && !y ? D.max : T && T.max ? T.max : 0;
1670
1680
  return y ?? {
1671
1681
  id: g.value,
1672
1682
  plane: g.plane,
1673
- min: T,
1674
- max: M,
1675
- kind: c ?? Ce.Limit
1683
+ min: C,
1684
+ max: x,
1685
+ kind: a ?? we.Limit
1676
1686
  };
1677
1687
  });
1678
1688
  o(p);
1679
1689
  },
1680
- [o, s, n, c, l]
1690
+ [o, n, s, a, r]
1681
1691
  );
1682
- return se(() => {
1683
- const d = s.filter(
1684
- (p) => n.some((g) => be(g.id, p.id) && g.plane === p.plane)
1692
+ return ne(() => {
1693
+ const u = n.filter(
1694
+ (p) => s.some((g) => be(g.id, p.id) && g.plane === p.plane)
1685
1695
  );
1686
- d.length !== s.length && o(d);
1687
- }, [n, o]), /* @__PURE__ */ e.jsxs(J, { ...w, children: [
1696
+ u.length !== n.length && o(u);
1697
+ }, [s, o]), /* @__PURE__ */ e.jsxs(J, { ...S, children: [
1688
1698
  /* @__PURE__ */ e.jsx(
1689
- ne,
1699
+ se,
1690
1700
  {
1691
- isMulti: !i,
1692
- placeholder: s.length ? `${s.length} selected` : "Search...",
1693
- value: f,
1694
- isDisabled: u || f.length >= (I ?? 1 / 0),
1695
- onChange: (d) => Array.isArray(d) ? r([...d]) : r(d !== null ? [d] : []),
1696
- options: j,
1701
+ isMulti: !c,
1702
+ placeholder: n.length ? `${n.length} selected` : "Search...",
1703
+ value: v,
1704
+ isDisabled: d || v.length >= (N ?? 1 / 0),
1705
+ onChange: (u) => Array.isArray(u) ? i([...u]) : i(u !== null ? [u] : []),
1706
+ options: f,
1697
1707
  controlShouldRenderValue: !1
1698
1708
  }
1699
1709
  ),
1700
1710
  /* @__PURE__ */ e.jsx(
1701
- as,
1711
+ dn,
1702
1712
  {
1703
1713
  marginTop: 2,
1704
1714
  maxH: "28rem",
1705
- value: s,
1715
+ value: n,
1706
1716
  onChange: o,
1707
- forceKind: c,
1708
- disableKind: x,
1709
- lockRanges: l
1717
+ forceKind: a,
1718
+ disableKind: j,
1719
+ lockRanges: r
1710
1720
  }
1711
1721
  )
1712
1722
  ] });
1713
- }, it = (n) => {
1714
- switch (n) {
1715
- case P.Thorax:
1723
+ }, it = (s) => {
1724
+ switch (s) {
1725
+ case $.Thorax:
1716
1726
  return "Thorax";
1717
- case P.CenterBack:
1727
+ case $.CenterBack:
1718
1728
  return "Center Back";
1719
- case P.Pelvis:
1729
+ case $.Pelvis:
1720
1730
  return "Pelvis";
1721
- case P.LeftThigh:
1731
+ case $.LeftThigh:
1722
1732
  return "Left Thigh";
1723
- case P.RightThigh:
1733
+ case $.RightThigh:
1724
1734
  return "Right Thigh";
1725
- case P.LeftShank:
1735
+ case $.LeftShank:
1726
1736
  return "Left Shank";
1727
- case P.RightShank:
1737
+ case $.RightShank:
1728
1738
  return "Right Shank";
1729
- case P.LeftFoot:
1739
+ case $.LeftFoot:
1730
1740
  return "Left Foot";
1731
- case P.RightFoot:
1741
+ case $.RightFoot:
1732
1742
  return "Right Foot";
1733
- case P.LeftUpperArm:
1743
+ case $.LeftUpperArm:
1734
1744
  return "Left Upper Arm";
1735
- case P.RightUpperArm:
1745
+ case $.RightUpperArm:
1736
1746
  return "Right Upper Arm";
1737
- case P.LeftForearm:
1747
+ case $.LeftForearm:
1738
1748
  return "Left Forearm";
1739
- case P.RightForearm:
1749
+ case $.RightForearm:
1740
1750
  return "Right Forearm";
1741
- case P.Head:
1751
+ case $.Head:
1742
1752
  return "Head";
1743
1753
  }
1744
- return console.warn(`Unknown sensor location: ${n}`), "Unknown";
1745
- }, us = 6, hs = [
1746
- P.LeftFoot,
1747
- P.LeftShank,
1748
- P.LeftThigh,
1749
- P.Pelvis,
1750
- P.RightFoot,
1751
- P.RightShank,
1752
- P.RightThigh,
1753
- P.Thorax,
1754
- P.CenterBack,
1755
- P.Head
1756
- ], ms = hs.map((n) => ({
1757
- label: it(n),
1758
- value: n
1759
- })), Ge = (n, s) => n.map((o) => ({ label: s ? s(o) : o, value: o })), Is = ({
1760
- id: n,
1761
- onError: s,
1754
+ return console.warn(`Unknown sensor location: ${s}`), "Unknown";
1755
+ }, mn = 6, pn = [
1756
+ $.LeftFoot,
1757
+ $.LeftShank,
1758
+ $.LeftThigh,
1759
+ $.Pelvis,
1760
+ $.RightFoot,
1761
+ $.RightShank,
1762
+ $.RightThigh,
1763
+ $.Thorax,
1764
+ $.CenterBack,
1765
+ $.Head
1766
+ ], gn = pn.map((s) => ({
1767
+ label: it(s),
1768
+ value: s
1769
+ })), Ge = (s, n) => s.map((o) => ({ label: n ? n(o) : o, value: o })), Rn = ({
1770
+ id: s,
1771
+ onError: n,
1762
1772
  onCancel: o,
1763
- onSave: c,
1764
- hideButtons: i,
1765
- setButtonOnClick: l,
1766
- setButtonDisabled: u,
1767
- quantumOwned: x
1773
+ onSave: a,
1774
+ hideButtons: c,
1775
+ setButtonOnClick: r,
1776
+ setButtonDisabled: d,
1777
+ quantumOwned: j
1768
1778
  }) => {
1769
- const [{ fetching: a }, w] = oe(Ie), [{ fetching: I }, m] = oe(Lt), [{ data: j }] = le({
1770
- query: Ft,
1771
- variables: { id: n ?? "" },
1772
- pause: !n
1773
- }), f = _(
1779
+ const [{ fetching: l }, S] = oe(Ie), [{ fetching: N }, h] = oe(Ot), [{ data: f }] = le({
1780
+ query: Nt,
1781
+ variables: { id: s ?? "" },
1782
+ pause: !s
1783
+ }), v = _(
1774
1784
  ae,
1775
- j?.getActionById
1776
- ), r = a || I, d = !!f && !!n, [p, g] = z(""), [y, A] = z(""), [C, T] = z(""), [M, E] = z(""), [O, Q] = z(), [K, Y] = z([]), [k, V] = z([]), [v, $] = z([]), q = D(
1777
- () => k.map((N) => N.value),
1778
- [k]
1779
- ), t = qt(q), [{ data: h }] = le({
1780
- query: nt
1781
- }), S = D(() => _(
1785
+ f?.getActionById
1786
+ ), i = l || N, u = !!v && !!s, [p, g] = z(""), [y, T] = z(""), [D, C] = z(""), [x, E] = z(""), [M, Q] = z(), [Z, Y] = z([]), [R, K] = z([]), [b, P] = z([]), q = k(
1787
+ () => R.map((O) => O.value),
1788
+ [R]
1789
+ ), t = qt(q), [{ data: m }] = le({
1790
+ query: st
1791
+ }), A = k(() => _(
1782
1792
  de,
1783
- h?.moduleCategories
1793
+ m?.moduleCategories
1784
1794
  )?.map((G) => ({
1785
1795
  label: G.name,
1786
1796
  value: G.id
1787
- })), [h?.moduleCategories]), F = D(
1788
- () => Ge(Object.values(At), ze),
1797
+ })), [m?.moduleCategories]), L = k(
1798
+ () => Ge(Object.values(zt), ze),
1789
1799
  []
1790
- ), [L, U] = z([]), H = p.length > 0, [W, ge] = z({});
1791
- se(() => {
1792
- if (f) {
1793
- const N = _(
1800
+ ), [I, W] = z([]), H = p.length > 0, [U, ge] = z({});
1801
+ ne(() => {
1802
+ if (v) {
1803
+ const O = _(
1794
1804
  de,
1795
- f.categories
1805
+ v.categories
1796
1806
  ), G = {
1797
- name: f.name,
1798
- activityType: f.activityType ?? void 0,
1799
- description: f.description || "",
1800
- cameraPlacement: f.cameraPlacement || "",
1801
- videoLink: f.videoLink || "",
1802
- sessionType: f.sessionType.map((Z) => ({
1803
- label: ze(Z),
1804
- value: Z
1807
+ name: v.name,
1808
+ activityType: v.activityType ?? void 0,
1809
+ description: v.description || "",
1810
+ cameraPlacement: v.cameraPlacement || "",
1811
+ videoLink: v.videoLink || "",
1812
+ sessionType: v.sessionType.map((V) => ({
1813
+ label: ze(V),
1814
+ value: V
1805
1815
  })),
1806
- categories: N?.map((Z) => Z.id) || [],
1807
- sensorLocations: f.sensorLocations.map((Z) => ({
1808
- label: it(Z),
1809
- value: Z
1816
+ categories: O?.map((V) => V.id) || [],
1817
+ sensorLocations: v.sensorLocations.map((V) => ({
1818
+ label: it(V),
1819
+ value: V
1810
1820
  })),
1811
- thresholds: Bt(f.thresholds)
1821
+ thresholds: Bt(v.thresholds)
1812
1822
  };
1813
- g(G.name), Q(G.activityType ?? void 0), A(G.description), T(G.cameraPlacement), E(G.videoLink), Y(G.sessionType), $(N?.map((Z) => Z.id) || []), V(G.sensorLocations), U(G.thresholds), ge(G);
1823
+ g(G.name), Q(G.activityType ?? void 0), T(G.description), C(G.cameraPlacement), E(G.videoLink), Y(G.sessionType), P(O?.map((V) => V.id) || []), K(G.sensorLocations), W(G.thresholds), ge(G);
1814
1824
  }
1815
- }, [f]);
1816
- const ue = D(
1817
- () => JSON.stringify(W) !== JSON.stringify({
1825
+ }, [v]);
1826
+ const ue = k(
1827
+ () => JSON.stringify(U) !== JSON.stringify({
1818
1828
  name: p,
1819
1829
  description: y,
1820
- cameraPlacement: C,
1821
- videoLink: M,
1822
- activityType: O,
1823
- sessionType: K.map((N) => N.value),
1824
- categories: v,
1830
+ cameraPlacement: D,
1831
+ videoLink: x,
1832
+ activityType: M,
1833
+ sessionType: Z.map((O) => O.value),
1834
+ categories: b,
1825
1835
  sensorLocations: q,
1826
- thresholds: _e(L)
1836
+ thresholds: _e(I)
1827
1837
  }),
1828
1838
  [
1829
- W,
1839
+ U,
1830
1840
  p,
1831
1841
  q,
1832
1842
  y,
1833
- C,
1843
+ D,
1844
+ x,
1834
1845
  M,
1835
- O,
1836
- K,
1837
- v,
1838
- L
1846
+ Z,
1847
+ b,
1848
+ I
1839
1849
  ]
1840
- ), xe = R(() => {
1841
- const N = {
1850
+ ), xe = F(() => {
1851
+ const O = {
1842
1852
  name: p,
1843
1853
  description: y,
1844
- cameraPlacement: C,
1845
- videoLink: M,
1846
- activityType: O,
1847
- activityKind: Wt(O),
1848
- sessionType: K.map((Z) => Z.value),
1849
- categories: v,
1854
+ cameraPlacement: D,
1855
+ videoLink: x,
1856
+ activityType: M,
1857
+ activityKind: Ut(M),
1858
+ sessionType: Z.map((V) => V.value),
1859
+ categories: b,
1850
1860
  sensorLocations: q,
1851
- thresholds: _e(L),
1861
+ thresholds: _e(I),
1852
1862
  // Backend requires laterality; keep existing default since UI no longer edits it
1853
- laterality: Mt.Either,
1854
- quantumOwned: x
1863
+ laterality: $t.Either,
1864
+ quantumOwned: j
1855
1865
  };
1856
1866
  let G;
1857
- d && n ? G = m({
1858
- id: n,
1859
- fields: N
1860
- }) : G = w({
1861
- fields: N
1862
- }), G.then(({ error: Z }) => {
1863
- Z ? s(Z) : c();
1867
+ u && s ? G = h({
1868
+ id: s,
1869
+ fields: O
1870
+ }) : G = S({
1871
+ fields: O
1872
+ }), G.then(({ error: V }) => {
1873
+ V ? n(V) : a();
1864
1874
  });
1865
1875
  }, [
1866
- x,
1867
- w,
1868
- m,
1869
- n,
1876
+ j,
1877
+ S,
1878
+ h,
1879
+ s,
1870
1880
  p,
1871
1881
  q,
1872
1882
  y,
1873
- C,
1883
+ D,
1884
+ x,
1874
1885
  M,
1875
- O,
1876
- K,
1877
- v,
1878
- d,
1879
- L,
1880
- c,
1881
- s
1886
+ Z,
1887
+ b,
1888
+ u,
1889
+ I,
1890
+ a,
1891
+ n
1882
1892
  ]);
1883
- return se(() => {
1884
- u && u({
1885
- cancelButton: r,
1886
- saveButton: r || !H || !ue
1893
+ return ne(() => {
1894
+ d && d({
1895
+ cancelButton: i,
1896
+ saveButton: i || !H || !ue
1887
1897
  });
1888
- }, [r, u, H, ue]), se(() => {
1889
- l && l({
1898
+ }, [i, d, H, ue]), ne(() => {
1899
+ r && r({
1890
1900
  cancelButton: o,
1891
1901
  saveButton: xe
1892
1902
  });
1893
- }, [l, o, xe]), console.log(H, ue, r, W), /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-2 gap-4 w-full", children: [
1903
+ }, [r, o, xe]), console.log(H, ue, i, U), /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-2 gap-4 w-full", children: [
1894
1904
  /* @__PURE__ */ e.jsxs("div", { className: "col-span-2 lg:col-span-1 flex flex-col gap-4", children: [
1895
1905
  /* @__PURE__ */ e.jsxs(B, { children: [
1896
1906
  /* @__PURE__ */ e.jsx(ie, { children: "Name" }),
@@ -1898,7 +1908,7 @@ const Ht = ({
1898
1908
  je,
1899
1909
  {
1900
1910
  value: p,
1901
- onChange: (N) => g(N.target.value),
1911
+ onChange: (O) => g(O.target.value),
1902
1912
  type: "text",
1903
1913
  placeholder: "i.e. Lunge & Return"
1904
1914
  }
@@ -1907,18 +1917,18 @@ const Ht = ({
1907
1917
  /* @__PURE__ */ e.jsxs(B, { children: [
1908
1918
  /* @__PURE__ */ e.jsx(ie, { children: "Activity Type" }),
1909
1919
  /* @__PURE__ */ e.jsx(
1910
- ne,
1920
+ se,
1911
1921
  {
1912
1922
  isClearable: !0,
1913
1923
  isMulti: !1,
1914
- value: O ? {
1915
- label: Pe(O),
1916
- value: O
1924
+ value: M ? {
1925
+ label: $e(M),
1926
+ value: M
1917
1927
  } : null,
1918
- onChange: (N) => Q(N?.value),
1928
+ onChange: (O) => Q(O?.value),
1919
1929
  options: Ge(
1920
- Object.values(Ot),
1921
- Pe
1930
+ Object.values(Pt),
1931
+ $e
1922
1932
  ),
1923
1933
  placeholder: "(optional) Select activity type"
1924
1934
  }
@@ -1929,8 +1939,8 @@ const Ht = ({
1929
1939
  /* @__PURE__ */ e.jsx(
1930
1940
  Ee,
1931
1941
  {
1932
- value: C,
1933
- onChange: (N) => T(N.target.value),
1942
+ value: D,
1943
+ onChange: (O) => C(O.target.value),
1934
1944
  rows: 2,
1935
1945
  placeholder: "(optional) Describe camera setup, placement, angles"
1936
1946
  }
@@ -1941,8 +1951,8 @@ const Ht = ({
1941
1951
  /* @__PURE__ */ e.jsx(
1942
1952
  je,
1943
1953
  {
1944
- value: M,
1945
- onChange: (N) => E(N.target.value),
1954
+ value: x,
1955
+ onChange: (O) => E(O.target.value),
1946
1956
  type: "url",
1947
1957
  placeholder: "(optional) https://..."
1948
1958
  }
@@ -1954,7 +1964,7 @@ const Ht = ({
1954
1964
  Ee,
1955
1965
  {
1956
1966
  value: y,
1957
- onChange: (N) => A(N.target.value),
1967
+ onChange: (O) => T(O.target.value),
1958
1968
  rows: 2,
1959
1969
  placeholder: "(optional) Describe how to perform the test or exercise"
1960
1970
  }
@@ -1963,18 +1973,18 @@ const Ht = ({
1963
1973
  /* @__PURE__ */ e.jsxs(B, { children: [
1964
1974
  /* @__PURE__ */ e.jsx(ie, { children: "Link to Category" }),
1965
1975
  /* @__PURE__ */ e.jsx(
1966
- ne,
1976
+ se,
1967
1977
  {
1968
1978
  isMulti: !0,
1969
- value: S?.filter(
1970
- (N) => v.includes(N.value)
1979
+ value: A?.filter(
1980
+ (O) => b.includes(O.value)
1971
1981
  ),
1972
- onChange: (N) => $(
1973
- (N ?? []).map(
1982
+ onChange: (O) => P(
1983
+ (O ?? []).map(
1974
1984
  (G) => G.value
1975
1985
  )
1976
1986
  ),
1977
- options: S,
1987
+ options: A,
1978
1988
  placeholder: "Select one or more categories"
1979
1989
  }
1980
1990
  )
@@ -1982,14 +1992,14 @@ const Ht = ({
1982
1992
  /* @__PURE__ */ e.jsxs(B, { children: [
1983
1993
  /* @__PURE__ */ e.jsx(ie, { children: "Session Types" }),
1984
1994
  /* @__PURE__ */ e.jsx(
1985
- ne,
1995
+ se,
1986
1996
  {
1987
1997
  isMulti: !0,
1988
- value: K,
1989
- onChange: (N) => Y(
1990
- N ?? []
1998
+ value: Z,
1999
+ onChange: (O) => Y(
2000
+ O ?? []
1991
2001
  ),
1992
- options: F,
2002
+ options: L,
1993
2003
  placeholder: "Select one or more session types"
1994
2004
  }
1995
2005
  )
@@ -1999,24 +2009,24 @@ const Ht = ({
1999
2009
  /* @__PURE__ */ e.jsxs(B, { children: [
2000
2010
  /* @__PURE__ */ e.jsx(ie, { children: "Sensor Locations" }),
2001
2011
  /* @__PURE__ */ e.jsx(
2002
- ne,
2012
+ se,
2003
2013
  {
2004
2014
  isMulti: !0,
2005
- value: k,
2006
- onChange: (N) => V([...N]),
2007
- options: ms,
2008
- isOptionDisabled: () => k.length >= us
2015
+ value: R,
2016
+ onChange: (O) => K([...O]),
2017
+ options: gn,
2018
+ isOptionDisabled: () => R.length >= mn
2009
2019
  }
2010
2020
  )
2011
2021
  ] }),
2012
2022
  /* @__PURE__ */ e.jsxs(B, { children: [
2013
2023
  /* @__PURE__ */ e.jsx(ie, { children: "Default Parameters" }),
2014
2024
  /* @__PURE__ */ e.jsx(
2015
- ds,
2025
+ hn,
2016
2026
  {
2017
2027
  options: t,
2018
- value: L,
2019
- onChange: U
2028
+ value: I,
2029
+ onChange: W
2020
2030
  }
2021
2031
  )
2022
2032
  ] })
@@ -2024,15 +2034,15 @@ const Ht = ({
2024
2034
  /* @__PURE__ */ e.jsx(
2025
2035
  "div",
2026
2036
  {
2027
- className: Qt("col-span-2 flex justify-end", i && "hidden"),
2037
+ className: Qt("col-span-2 flex justify-end", c && "hidden"),
2028
2038
  children: /* @__PURE__ */ e.jsxs(pe, { mt: 16, gap: 4, children: [
2029
- /* @__PURE__ */ e.jsx(X, { colorScheme: "gray", isDisabled: r, onClick: o, children: "Cancel" }),
2039
+ /* @__PURE__ */ e.jsx(X, { colorScheme: "gray", isDisabled: i, onClick: o, children: "Cancel" }),
2030
2040
  /* @__PURE__ */ e.jsx(
2031
2041
  X,
2032
2042
  {
2033
2043
  colorScheme: "blue",
2034
- isDisabled: r || !H || !ue,
2035
- isLoading: r,
2044
+ isDisabled: i || !H || !ue,
2045
+ isLoading: i,
2036
2046
  onClick: xe,
2037
2047
  children: "Save changes"
2038
2048
  }
@@ -2041,101 +2051,101 @@ const Ht = ({
2041
2051
  }
2042
2052
  )
2043
2053
  ] });
2044
- }, ie = ({ children: n }) => /* @__PURE__ */ e.jsx(We, { fontWeight: "bold", fontFamily: "sans-serif", fontSize: "large", children: n }), Ls = ({
2045
- id: n,
2046
- onCancel: s,
2054
+ }, ie = ({ children: s }) => /* @__PURE__ */ e.jsx(Ue, { fontWeight: "bold", fontFamily: "sans-serif", fontSize: "large", children: s }), kn = ({
2055
+ id: s,
2056
+ onCancel: n,
2047
2057
  onSave: o,
2048
- onError: c,
2049
- hideButtons: i,
2050
- quantumOwned: l,
2051
- setButtonOnClick: u,
2052
- setButtonDisabled: x
2058
+ onError: a,
2059
+ hideButtons: c,
2060
+ quantumOwned: r,
2061
+ setButtonOnClick: d,
2062
+ setButtonDisabled: j
2053
2063
  }) => {
2054
- const [{ data: a }] = le({
2055
- query: l ? Rt : kt
2056
- }), [{ data: w }] = le({
2057
- query: Dt,
2058
- variables: { id: n },
2059
- pause: !n
2060
- }), [{ data: I }] = le({
2061
- query: nt
2062
- }), m = _(
2064
+ const [{ data: l }] = le({
2065
+ query: r ? It : Lt
2066
+ }), [{ data: S }] = le({
2067
+ query: Ft,
2068
+ variables: { id: s },
2069
+ pause: !s
2070
+ }), [{ data: N }] = le({
2071
+ query: st
2072
+ }), h = _(
2063
2073
  de,
2064
- I?.moduleCategories
2065
- ), [{ fetching: j }, f] = oe(tt), [{ fetching: r }, d] = oe(st), p = _(
2074
+ N?.moduleCategories
2075
+ ), [{ fetching: f }, v] = oe(tt), [{ fetching: i }, u] = oe(nt), p = _(
2066
2076
  ae,
2067
- l ? a?.quantumOwnedActions : a?.actions
2068
- ) ?? [], g = _(we, w?.module), y = _(et, g?.moduleActions) ?? [], [A, C] = z([
2069
- ...y.map((k) => k.actionId) ?? []
2070
- ]), [T, M] = z(g?.name ?? ""), [E, O] = z([]), [Q, K] = z(g?.description ?? "");
2071
- se(() => {
2072
- g && (C(y.map((k) => k.actionId)), M(g.name), K(g.description ?? ""), O(
2077
+ r ? l?.quantumOwnedActions : l?.actions
2078
+ ) ?? [], g = _(Ce, S?.module), y = _(et, g?.moduleActions) ?? [], [T, D] = z([
2079
+ ...y.map((R) => R.actionId) ?? []
2080
+ ]), [C, x] = z(g?.name ?? ""), [E, M] = z([]), [Q, Z] = z(g?.description ?? "");
2081
+ ne(() => {
2082
+ g && (D(y.map((R) => R.actionId)), x(g.name), Z(g.description ?? ""), M(
2073
2083
  g.categories.map(
2074
- (k) => _(de, k).id
2084
+ (R) => _(de, R).id
2075
2085
  ) ?? []
2076
2086
  ));
2077
2087
  }, [g, y]);
2078
- const Y = R(() => {
2079
- let k;
2080
- const V = {
2081
- actions: A,
2082
- name: T,
2083
- categories: E.filter((v) => v !== "other"),
2088
+ const Y = F(() => {
2089
+ let R;
2090
+ const K = {
2091
+ actions: T,
2092
+ name: C,
2093
+ categories: E.filter((b) => b !== "other"),
2084
2094
  description: Q,
2085
- quantumOwned: l
2095
+ quantumOwned: r
2086
2096
  };
2087
- g ? k = f({
2097
+ g ? R = v({
2088
2098
  id: g.id,
2089
- input: V
2090
- }) : k = d({
2091
- input: V
2092
- }), k.then(({ error: v }) => {
2093
- v ? c(v) : o();
2099
+ input: K
2100
+ }) : R = u({
2101
+ input: K
2102
+ }), R.then(({ error: b }) => {
2103
+ b ? a(b) : o();
2094
2104
  });
2095
2105
  }, [
2096
- d,
2097
- f,
2098
- A,
2106
+ u,
2107
+ v,
2099
2108
  T,
2109
+ C,
2100
2110
  Q,
2101
2111
  E,
2102
2112
  g,
2103
2113
  o,
2104
- c
2114
+ a
2105
2115
  ]);
2106
- return se(() => {
2107
- x && x({
2108
- cancelButton: j || r,
2109
- saveButton: j || r || !T || Q.trim().split(/\s+/).filter(Boolean).length > 40
2116
+ return ne(() => {
2117
+ j && j({
2118
+ cancelButton: f || i,
2119
+ saveButton: f || i || !C || Q.trim().split(/\s+/).filter(Boolean).length > 40
2110
2120
  });
2111
- }, [x, j, r, A, T, Q]), se(() => {
2112
- u && u({
2113
- cancelButton: s,
2121
+ }, [j, f, i, T, C, Q]), ne(() => {
2122
+ d && d({
2123
+ cancelButton: n,
2114
2124
  saveButton: Y
2115
2125
  });
2116
- }, [u, s, Y]), /* @__PURE__ */ e.jsxs(J, { width: "100%", children: [
2126
+ }, [d, n, Y]), /* @__PURE__ */ e.jsxs(J, { width: "100%", children: [
2117
2127
  /* @__PURE__ */ e.jsx(
2118
- ns,
2128
+ on,
2119
2129
  {
2120
- name: T,
2121
- setName: M,
2130
+ name: C,
2131
+ setName: x,
2122
2132
  actions: p,
2123
- selectedActionIds: A,
2124
- setSelectedActionIds: C,
2125
- availableCategories: m ?? [],
2133
+ selectedActionIds: T,
2134
+ setSelectedActionIds: D,
2135
+ availableCategories: h ?? [],
2126
2136
  selectedCategoryIds: E,
2127
- setSelectedCategoryIds: O,
2137
+ setSelectedCategoryIds: M,
2128
2138
  description: Q,
2129
- setDescription: K
2139
+ setDescription: Z
2130
2140
  }
2131
2141
  ),
2132
- !i && /* @__PURE__ */ e.jsx(te, { justifyContent: "flex-start", children: /* @__PURE__ */ e.jsxs(pe, { mt: 16, gap: 4, children: [
2142
+ !c && /* @__PURE__ */ e.jsx(te, { justifyContent: "flex-start", children: /* @__PURE__ */ e.jsxs(pe, { mt: 16, gap: 4, children: [
2133
2143
  /* @__PURE__ */ e.jsx(
2134
2144
  X,
2135
2145
  {
2136
2146
  colorScheme: "gray",
2137
- isDisabled: j || r,
2138
- onClick: s,
2147
+ isDisabled: f || i,
2148
+ onClick: n,
2139
2149
  children: "Cancel"
2140
2150
  }
2141
2151
  ),
@@ -2143,8 +2153,8 @@ const Ht = ({
2143
2153
  X,
2144
2154
  {
2145
2155
  colorScheme: "blue",
2146
- isDisabled: j || r || !T || Q.trim().split(/\s+/).filter(Boolean).length > 40,
2147
- isLoading: j || r,
2156
+ isDisabled: f || i || !C || Q.trim().split(/\s+/).filter(Boolean).length > 40,
2157
+ isLoading: f || i,
2148
2158
  onClick: Y,
2149
2159
  children: "Save"
2150
2160
  }
@@ -2153,12 +2163,12 @@ const Ht = ({
2153
2163
  ] });
2154
2164
  };
2155
2165
  export {
2156
- ss as ActivityList,
2157
- Os as CopyActivityForm,
2158
- Ns as CopyModuleForm,
2159
- ns as ModuleForm,
2160
- as as ParameterEditList,
2161
- ds as ParameterEditSelect,
2162
- Is as UpsertActivityForm,
2163
- Ls as UpsertModuleForm
2166
+ sn as ActivityList,
2167
+ Ln as CopyActivityForm,
2168
+ Fn as CopyModuleForm,
2169
+ on as ModuleForm,
2170
+ dn as ParameterEditList,
2171
+ hn as ParameterEditSelect,
2172
+ Rn as UpsertActivityForm,
2173
+ kn as UpsertModuleForm
2164
2174
  };