quantum-component-library 1.4.48-dev.0 → 1.4.48-dev.2

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