quantum-component-library 1.4.48-dev.1 → 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 _e, InputLeftElement as ut, Icon as qe, Input as fe, FormLabel as Ye, Box as Z, TableContainer as He, Table as Je, Thead as Xe, Tr as Me, Th as he, Tbody as Ze, Td as ge, ButtonGroup as xe, Tooltip as Ee, Button as K, RangeSlider as ht, RangeSliderMark as Le, Text as v, RangeSliderTrack as mt, RangeSliderFilledTrack as pt, RangeSliderThumb as Ge, Select as Pe, NumberInput as $e, NumberInputField as We, HStack as ne, Tag as je, Checkbox as gt, Image as xt, useToast as Ke, VStack as te, FormControl as X, 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 Ue } from "@chakra-ui/react";
3
- import { useMemo as D, useState as P, useCallback as L, 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 z } from "./generated.js";
9
- import { M as ve, a as De, A as de, G as tt, b as kt, c as Fe, C as ze, d as nt, e as st, f as Se, g as ot, h as Lt, U as rt, i as it, j as Rt, k as Dt, l as Ft, m as Et, n as zt, o as _t, p as Gt } from "./graphql-Cts9cAoH.js";
10
- import { D as Pt, H as $t, u as Wt, a as Ut } from "./react-dnd-vendor-D4nn9Mqx.js";
11
- import { ThresholdKind as Ae, SensorLocation as W, 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
+ return /* @__PURE__ */ e.jsxs(ge, { width: "100%", alignContent: "space-evenly", gap: 4, children: [
30
31
  /* @__PURE__ */ e.jsxs(_e, { size: "md", flex: 1, children: [
31
- /* @__PURE__ */ e.jsx(ut, { children: /* @__PURE__ */ e.jsx(qe, { as: It, color: "gray.300" }) }),
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(_e, { 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,77 +54,77 @@ 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 = P(
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 = L(
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(Z, { children: /* @__PURE__ */ e.jsx(Pt, { backend: $t, 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(ge, { children: n + 1 }),
115
- /* @__PURE__ */ e.jsx(ge, { 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(xe, { isAttached: !0, isDisabled: c, children: s.map((o, O) => /* @__PURE__ */ e.jsx(
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(
127
128
  Ee,
128
129
  {
129
130
  label: o.tooltip,
@@ -135,110 +136,110 @@ const Zt = ({
135
136
  children: /* @__PURE__ */ e.jsx(
136
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] = P([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 = L(
167
- ([j, U]) => {
168
- j < U && a([j.toFixed(0), U.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 = L(
172
- ([j, U]) => {
173
- j < U && u([j, U]);
171
+ [f]
172
+ ), q = R(
173
+ ([w, P]) => {
174
+ w < P && u([w, P]);
174
175
  },
175
176
  [u]
176
- ), Y = L(() => {
177
- a(([j, U]) => {
178
- const J = isNaN(Number(j)) ? n : Number(j), t = isNaN(Number(U)) ? i : Number(U), h = Ce(Number(J), x), w = Ce(Number(t), S), R = x < 0 ? Math.max(h, n) : Math.min(h, i), G = S < 0 ? Math.max(w, n) : Math.min(w, i);
179
- return R > G ? (u([G, R]), [G.toFixed(0), R.toFixed(0)]) : (u([R, G]), [R.toFixed(0), G.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 = L(
182
- (j) => {
183
- const U = j === "" || isNaN(Number(j)) ? j : Ce(Number(j), x);
184
- a(([J, t]) => [U.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
- ), k = L(
188
- (j) => {
189
- const U = j === "" || isNaN(Number(j)) ? j : Ce(Number(j), S);
190
- a(([J, t]) => [J, U.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]
196
- ), V = L(
197
- (j, U) => {
198
- const J = Number(U.target.value);
199
- if (!l || !m || ![-1, 1].includes(J))
193
+ [f, M]
194
+ ), L = D(
195
+ () => c === "xs" ? "0.75rem" : void 0,
196
+ [c]
197
+ ), V = R(
198
+ (w, P) => {
199
+ const J = Number(P.target.value);
200
+ if (!s || !g || ![-1, 1].includes(J))
200
201
  return;
201
- const t = (R) => J < 0 ? -1 * Math.abs(R) : Math.abs(R), 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
+ return /* @__PURE__ */ e.jsxs(ge, { direction: "column", ...h, children: [
207
208
  /* @__PURE__ */ e.jsx(Z, { pt: "1em", mb: "-0.5em", children: /* @__PURE__ */ e.jsxs(
208
- ht,
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
244
  Z,
244
245
  {
@@ -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(Ge, { index: 0, w: T, h: T }),
256
- /* @__PURE__ */ e.jsx(Ge, { 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
+ S && /* @__PURE__ */ e.jsxs(
296
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
- $e,
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: Y,
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
- We,
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
- $e,
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: k,
344
- onBlur: Y,
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
- We,
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
+ S && /* @__PURE__ */ e.jsxs(
361
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,10 +377,10 @@ 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(
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(
383
384
  Ee,
384
385
  {
385
386
  label: "This activity is owned by Quantum",
@@ -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,438 +405,438 @@ 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] = P(""), [x, S] = P(), 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]), _ = L(() => {
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 k = s.filter(
446
- (T) => T.selected && !T.quantumOwned
447
- ).map((T) => T.id);
448
- c(k);
449
- }, [s, c]), M = L(() => {
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((k) => k.selected);
453
- b(f.map((k) => k.id)), d && f.forEach((k) => d(k, !1));
454
- }, [s, b, d]), E = D(() => s.some((f) => f.selected && !f.quantumOwned), [s]), N = D(() => s.some((f) => f.selected), [s]), Y = D(() => s.some((f) => f.selected && f.quantumOwned), [s]);
455
- return /* @__PURE__ */ e.jsxs(Z, { ...a, children: [
456
- /* @__PURE__ */ e.jsxs(me, { alignContent: "space-between", gap: 4, children: [
457
- (i || c || b) && /* @__PURE__ */ e.jsxs(xe, { mb: "1rem", gap: 4, children: [
458
- i && /* @__PURE__ */ e.jsx(
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(
459
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
+ d && !o && /* @__PURE__ */ e.jsx(
469
470
  Ee,
470
471
  {
471
- label: Y ? 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
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
+ p && !o && /* @__PURE__ */ e.jsx(
485
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(ge, { 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: (k) => d(f, k.target.checked)
537
+ onChange: (E) => c(v, E.target.checked)
537
538
  }
538
539
  ),
539
- (f.quantumOwned || !u) && r && /* @__PURE__ */ e.jsx(
540
+ (v.quantumOwned || !u) && l && /* @__PURE__ */ e.jsx(
540
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
+ !v.quantumOwned && u && /* @__PURE__ */ e.jsx(
551
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(ge, { 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(ge, { maxW: "20rem", whiteSpace: "break-spaces", children: an(f.sensorLocations) }),
574
- !p && /* @__PURE__ */ e.jsx(ge, { 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((k) => k.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] = P("copy"), [y, A] = P(""), [p, C] = P([]), [a, l] = P(!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(ze), [, S] = re(
604
- nt
605
- ), F = D(() => m.data?.groups ? m.data.groups.map(
606
- (t) => z(st, t)
607
- ) : [], [m.data]), _ = D(() => g.data ? g.data.actions.map(
608
- (h) => z(de, h)
609
- ) : [], [g.data]), M = D(() => _.filter(
610
- (t) => p.includes(t.id)
611
- ), [_, p]), E = L(
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 = L(
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
- ), Y = L(
624
- async (t) => {
625
- const h = z(
626
- ve,
627
- t.categories
628
- ), R = z(
624
+ ), N = R(
625
+ async (i) => {
626
+ const m = $(
627
+ be,
628
+ i.categories
629
+ ), A = $(
629
630
  De,
630
- t.metadataGroups
631
+ i.metadataGroups
631
632
  ).flatMap(
632
- (B) => B.data.map((Q) => z(Fe, Q).id)
633
- ), G = {
634
- ...t,
635
- name: `${t.name} (Copy)`,
633
+ (B) => B.data.map((Y) => $(Fe, Y).id)
634
+ ), T = {
635
+ ...i,
636
+ name: `${i.name} (Copy)`,
636
637
  // Add "(Copy)" suffix to distinguish
637
- description: t.description || void 0,
638
- instructionsPointOfInterest: t.instructionsPointOfInterest || void 0,
639
- instructionsMovementReport: t.instructionsMovementReport || void 0,
640
- laterality: t.laterality,
641
- activityKind: t.activityKind,
642
- sensorLocations: t.sensorLocations,
643
- thresholds: t.thresholds.map((B) => ({
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) => ({
644
645
  ...B,
645
646
  id: void 0
646
647
  })),
647
- categories: h?.map((B) => B.id),
648
- quantumOwned: d,
649
- metadataItemIds: R,
648
+ categories: m?.map((B) => B.id),
649
+ quantumOwned: c,
650
+ metadataItemIds: A,
650
651
  id: void 0
651
- }, $ = await x({ fields: G });
652
- if ($.error)
653
- throw new Error($.error.message);
654
- if ($.data?.createAction)
655
- return z(de, $.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);
656
657
  throw new Error("No action data returned");
657
658
  },
658
- [x, d]
659
- ), f = L(
660
- async (t) => {
661
- const h = await S({ id: t.id });
662
- if (h.error)
663
- throw new Error(h.error.message);
664
- if (h.data?.convertActionToQuantumOwned)
665
- return z(
666
- de,
667
- 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
668
669
  );
669
670
  throw new Error("No action data returned");
670
671
  },
671
- [S]
672
- ), k = L(async () => {
673
- if (l(!0), !M.length) {
674
- const t = new Error(
672
+ [M]
673
+ ), E = R(async () => {
674
+ if (s(!0), !I.length) {
675
+ const i = new Error(
675
676
  `No activities selected for ${o === "copy" ? "copying" : "converting"}`
676
677
  );
677
- i?.(t), l(!1);
678
+ r?.(i), s(!1);
678
679
  return;
679
680
  }
680
681
  try {
681
- const t = [];
682
- let h = 0;
683
- const w = o === "copy" ? Y : f, R = o === "copy" ? "copy" : "convert";
684
- for (const G 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)
685
686
  try {
686
- const $ = await w(G);
687
- t.push($);
688
- } catch ($) {
687
+ const U = await a(T);
688
+ i.push(U);
689
+ } catch (U) {
689
690
  console.error(
690
- `Failed to ${R} activity "${G.name}":`,
691
- $
692
- ), h++;
691
+ `Failed to ${A} activity "${T.name}":`,
692
+ U
693
+ ), m++;
693
694
  }
694
- if (t.length > 0) {
695
- const G = t.length, $ = M.length, B = o === "copy" ? "copied" : "converted", Q = o === "copy" ? "copy" : "convert";
696
- b({
697
- title: h > 0 ? `Partial ${Q} completed` : `Activities ${B} successfully`,
698
- description: h > 0 ? `${G} of ${$} activities ${B} successfully` : `${G} activit${G > 1 ? "ies" : "y"} ${B} successfully`,
699
- 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",
700
701
  duration: 3e3,
701
702
  isClosable: !0
702
- }), s?.(), A(""), C([]);
703
+ }), n?.(), O(""), C([]);
703
704
  } else
704
- throw new Error(`Failed to ${R} any activities`);
705
- } catch (t) {
706
- const h = o === "copy" ? "copy" : "convert", w = t instanceof Error ? t.message : `Failed to ${h} activities`;
707
- 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({
708
709
  title: `${o === "copy" ? "Copy" : "Convert"} failed`,
709
- description: w,
710
+ description: a,
710
711
  status: "error",
711
712
  duration: 5e3,
712
713
  isClosable: !0
713
- }), i?.(t instanceof Error ? t : new Error(w));
714
+ }), r?.(i instanceof Error ? i : new Error(a));
714
715
  } finally {
715
- l(!1);
716
+ s(!1);
716
717
  }
717
718
  }, [
718
- M,
719
+ I,
719
720
  o,
720
- Y,
721
- f,
722
- b,
723
- s,
724
- i
725
- ]), T = L(() => {
726
- A(""), C([]), O("copy"), n?.();
727
- }, [n]);
721
+ N,
722
+ v,
723
+ p,
724
+ n,
725
+ r
726
+ ]), L = R(() => {
727
+ O(""), C([]), k("copy"), t?.();
728
+ }, [t]);
728
729
  se(() => {
729
730
  u && u({
730
731
  cancelButton: !1,
731
- saveButton: M.length === 0 || a
732
+ saveButton: I.length === 0 || f
732
733
  });
733
- }, [M.length, a, u]), se(() => {
734
- r && r({
735
- cancelButton: T,
736
- saveButton: k
734
+ }, [I.length, f, u]), se(() => {
735
+ l && l({
736
+ cancelButton: L,
737
+ saveButton: E
737
738
  });
738
- }, [r, T, k]);
739
- const V = D(() => F.map((t) => ({
740
- value: t.id,
741
- label: t.name
742
- })), [F]), j = D(() => _.filter((t) => o === "copy" ? !0 : !t.quantumOwned).map((t) => ({
743
- value: t.id,
744
- 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,
745
746
  // Add custom data to identify quantum-owned actions for UI display
746
- isQuantumOwned: t.quantumOwned
747
- })), [_, o]), U = m.fetching, J = g.fetching;
747
+ isQuantumOwned: i.quantumOwned
748
+ })), [z, o]), P = g.fetching, J = j.fetching;
748
749
  return /* @__PURE__ */ e.jsx(Z, { children: /* @__PURE__ */ e.jsxs(te, { spacing: 6, align: "stretch", children: [
749
- d && /* @__PURE__ */ e.jsxs(X, { children: [
750
- /* @__PURE__ */ e.jsx(ie, { children: "Operation Mode" }),
750
+ c && /* @__PURE__ */ e.jsxs(X, { children: [
751
+ /* @__PURE__ */ e.jsx(ae, { children: "Operation Mode" }),
751
752
  /* @__PURE__ */ e.jsx(
752
- Ve,
753
+ et,
753
754
  {
754
755
  value: o,
755
- onChange: (t) => {
756
- O(t), C([]);
756
+ onChange: (i) => {
757
+ k(i), C([]);
757
758
  },
758
759
  children: /* @__PURE__ */ e.jsxs(ne, { spacing: 6, children: [
759
- /* @__PURE__ */ e.jsx(Te, { value: "copy", colorScheme: "blue", children: /* @__PURE__ */ e.jsxs(te, { align: "start", spacing: 1, children: [
760
- /* @__PURE__ */ e.jsx(v, { fontWeight: "medium", children: "Copy Activities" }),
761
- /* @__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" })
762
763
  ] }) }),
763
- /* @__PURE__ */ e.jsx(Te, { value: "convert", colorScheme: "green", children: /* @__PURE__ */ e.jsxs(te, { align: "start", spacing: 1, children: [
764
- /* @__PURE__ */ e.jsx(v, { fontWeight: "medium", children: "Convert to Quantum Owned" }),
765
- /* @__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" })
766
767
  ] }) })
767
768
  ] })
768
769
  }
769
770
  )
770
771
  ] }),
771
772
  /* @__PURE__ */ e.jsxs(X, { children: [
772
- /* @__PURE__ */ e.jsx(ie, { children: "Select Source Group" }),
773
+ /* @__PURE__ */ e.jsx(ae, { children: "Select Source Group" }),
773
774
  /* @__PURE__ */ e.jsx(
774
- ae,
775
+ le,
775
776
  {
776
777
  placeholder: "Choose a group...",
777
778
  options: V,
778
- value: V.find((t) => t.value === y) || null,
779
- onChange: E,
780
- isLoading: U,
781
- isDisabled: U,
779
+ value: V.find((i) => i.value === S) || null,
780
+ onChange: _,
781
+ isLoading: P,
782
+ isDisabled: P,
782
783
  isClearable: !0
783
784
  }
784
785
  ),
785
- m.error && /* @__PURE__ */ e.jsxs(Ie, { status: "error", mt: 2, children: [
786
- /* @__PURE__ */ e.jsx(Oe, {}),
787
- /* @__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: [
788
789
  "Failed to load groups: ",
789
- m.error.message
790
+ g.error.message
790
791
  ] })
791
792
  ] })
792
793
  ] }),
793
- y && /* @__PURE__ */ e.jsxs(X, { children: [
794
- /* @__PURE__ */ e.jsxs(ie, { children: [
794
+ S && /* @__PURE__ */ e.jsxs(X, { children: [
795
+ /* @__PURE__ */ e.jsxs(ae, { children: [
795
796
  "Select Activities to",
796
797
  " ",
797
798
  o === "copy" ? "Copy" : "Convert"
798
799
  ] }),
799
800
  J ? /* @__PURE__ */ e.jsxs(ne, { children: [
800
- /* @__PURE__ */ e.jsx(et, { size: "sm" }),
801
- /* @__PURE__ */ e.jsx(v, { fontSize: "sm", color: "gray.600", children: "Loading activities..." })
801
+ /* @__PURE__ */ e.jsx(tt, { size: "sm" }),
802
+ /* @__PURE__ */ e.jsx(y, { fontSize: "sm", color: "gray.600", children: "Loading activities..." })
802
803
  ] }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
803
804
  /* @__PURE__ */ e.jsx(
804
- ae,
805
+ le,
805
806
  {
806
807
  placeholder: `Choose activities to ${o}...`,
807
- options: j,
808
- value: j.filter(
809
- (t) => p.includes(t.value)
808
+ options: w,
809
+ value: w.filter(
810
+ (i) => h.includes(i.value)
810
811
  ),
811
- onChange: N,
812
- isDisabled: j.length === 0,
812
+ onChange: q,
813
+ isDisabled: w.length === 0,
813
814
  isClearable: !0,
814
815
  isMulti: !0,
815
816
  closeMenuOnSelect: !1,
816
- 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: [
817
818
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
818
- /* @__PURE__ */ e.jsx(v, { children: t.label }),
819
- 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)" })
820
821
  ] }),
821
- 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" })
822
823
  ] })
823
824
  }
824
825
  ),
825
- 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" })
826
827
  ] }),
827
- g.error && /* @__PURE__ */ e.jsxs(Ie, { status: "error", mt: 2, children: [
828
- /* @__PURE__ */ e.jsx(Oe, {}),
829
- /* @__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: [
830
831
  "Failed to load activities: ",
831
- g.error.message
832
+ j.error.message
832
833
  ] })
833
834
  ] })
834
835
  ] }),
835
- M.length > 0 && /* @__PURE__ */ e.jsxs(Z, { p: 4, bg: "gray.50", borderRadius: "md", children: [
836
- /* @__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"}:` }),
837
838
  /* @__PURE__ */ e.jsxs(te, { align: "start", spacing: 3, children: [
838
- M.map((t, h) => /* @__PURE__ */ e.jsxs(
839
+ I.map((i, m) => /* @__PURE__ */ e.jsxs(
839
840
  Z,
840
841
  {
841
842
  w: "100%",
@@ -846,12 +847,12 @@ const Zt = ({
846
847
  borderColor: "gray.200",
847
848
  children: [
848
849
  /* @__PURE__ */ e.jsxs(ne, { justify: "space-between", align: "start", mb: 2, children: [
849
- /* @__PURE__ */ e.jsxs(v, { fontWeight: "medium", fontSize: "sm", children: [
850
- h + 1,
850
+ /* @__PURE__ */ e.jsxs(y, { fontWeight: "medium", fontSize: "sm", children: [
851
+ m + 1,
851
852
  ". ",
852
- t.name
853
+ i.name
853
854
  ] }),
854
- 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" })
855
856
  ] }),
856
857
  /* @__PURE__ */ e.jsxs(
857
858
  te,
@@ -861,44 +862,44 @@ const Zt = ({
861
862
  fontSize: "sm",
862
863
  color: "gray.600",
863
864
  children: [
864
- t.description && /* @__PURE__ */ e.jsxs(v, { children: [
865
+ i.description && /* @__PURE__ */ e.jsxs(y, { children: [
865
866
  /* @__PURE__ */ e.jsx("strong", { children: "Description:" }),
866
867
  " ",
867
- t.description
868
+ i.description
868
869
  ] }),
869
- /* @__PURE__ */ e.jsxs(v, { children: [
870
+ /* @__PURE__ */ e.jsxs(y, { children: [
870
871
  /* @__PURE__ */ e.jsx("strong", { children: "Type:" }),
871
872
  " ",
872
- t.activityKind
873
+ i.activityKind
873
874
  ] }),
874
- /* @__PURE__ */ e.jsxs(v, { children: [
875
+ /* @__PURE__ */ e.jsxs(y, { children: [
875
876
  /* @__PURE__ */ e.jsx("strong", { children: "Laterality:" }),
876
877
  " ",
877
- t.laterality
878
+ i.laterality
878
879
  ] }),
879
- /* @__PURE__ */ e.jsxs(v, { children: [
880
+ /* @__PURE__ */ e.jsxs(y, { children: [
880
881
  /* @__PURE__ */ e.jsx("strong", { children: "Sensor Locations:" }),
881
882
  " ",
882
- t.sensorLocations.length
883
+ i.sensorLocations.length
883
884
  ] }),
884
- /* @__PURE__ */ e.jsxs(v, { children: [
885
+ /* @__PURE__ */ e.jsxs(y, { children: [
885
886
  /* @__PURE__ */ e.jsx("strong", { children: "Thresholds:" }),
886
887
  " ",
887
- t.thresholds.length
888
+ i.thresholds.length
888
889
  ] }),
889
- /* @__PURE__ */ e.jsxs(v, { children: [
890
+ /* @__PURE__ */ e.jsxs(y, { children: [
890
891
  /* @__PURE__ */ e.jsx("strong", { children: "Use Cases:" }),
891
892
  " ",
892
- t.useCases.map((w) => w.name).join(", ") || "None"
893
+ i.useCases.map((a) => a.name).join(", ") || "None"
893
894
  ] })
894
895
  ]
895
896
  }
896
897
  )
897
898
  ]
898
899
  },
899
- t.id
900
+ i.id
900
901
  )),
901
- M.length > 1 && /* @__PURE__ */ e.jsx(
902
+ I.length > 1 && /* @__PURE__ */ e.jsx(
902
903
  Z,
903
904
  {
904
905
  w: "100%",
@@ -907,9 +908,9 @@ const Zt = ({
907
908
  borderRadius: "md",
908
909
  border: "1px solid",
909
910
  borderColor: "blue.200",
910
- 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: [
911
912
  "Total: ",
912
- M.length,
913
+ I.length,
913
914
  " activities will be",
914
915
  " ",
915
916
  o === "copy" ? "copied" : "converted"
@@ -918,13 +919,13 @@ const Zt = ({
918
919
  )
919
920
  ] })
920
921
  ] }),
921
- !c && /* @__PURE__ */ e.jsxs(xe, { spacing: 4, justifyContent: "flex-end", children: [
922
+ !d && /* @__PURE__ */ e.jsxs(fe, { spacing: 4, justifyContent: "flex-end", children: [
922
923
  /* @__PURE__ */ e.jsx(
923
924
  K,
924
925
  {
925
926
  variant: "outline",
926
- onClick: T,
927
- isDisabled: a,
927
+ onClick: L,
928
+ isDisabled: f,
928
929
  children: "Cancel"
929
930
  }
930
931
  ),
@@ -932,310 +933,333 @@ const Zt = ({
932
933
  K,
933
934
  {
934
935
  colorScheme: o === "copy" ? "blue" : "green",
935
- onClick: k,
936
- isDisabled: M.length === 0 || a,
937
- isLoading: a,
936
+ onClick: E,
937
+ isDisabled: I.length === 0 || f,
938
+ isLoading: f,
938
939
  loadingText: `${o === "copy" ? "Copying" : "Converting"}...`,
939
940
  children: [
940
941
  o === "copy" ? "Copy" : "Convert",
941
942
  " ",
942
- M.length === 1 ? "Activity" : `${M.length} Activities`
943
+ I.length === 1 ? "Activity" : `${I.length} Activities`
943
944
  ]
944
945
  }
945
946
  )
946
947
  ] })
947
948
  ] }) });
948
- }, _n = ({
949
- onSave: s,
950
- onCancel: n,
951
- onError: i,
952
- hideButtons: c = !1,
949
+ }, Gn = ({
950
+ onSave: n,
951
+ onCancel: t,
952
+ onError: r,
953
+ hideButtons: d = !1,
953
954
  setButtonDisabled: u,
954
- setButtonOnClick: r,
955
- quantumOwned: d
955
+ setButtonOnClick: l,
956
+ quantumOwned: c
956
957
  }) => {
957
- const b = Ke(), [o, O] = P(""), [y, A] = P([]), [p, C] = P(!1), [a, l] = P("copy"), [m] = ce({
958
- query: tt
959
- }), [g] = ce({
960
- query: Lt,
961
- variables: { groupId: o },
962
- 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
963
964
  // Only run when group is selected
964
- }), [, x] = re(it), [, S] = re(rt), [, F] = re(ze), [, _] = re(
965
- nt
966
- ), M = D(() => m.data?.groups ? m.data.groups.map(
967
- (t) => z(st, t)
968
- ) : [], [m.data]), E = D(() => g.data?.modules ? z(
969
- Se,
970
- g.data?.modules
971
- ).map((h) => {
972
- const w = z(
973
- ot,
974
- 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
975
976
  );
976
977
  return {
977
- ...h,
978
- moduleActions: w.map((R) => ({
979
- ...R,
980
- action: z(de, R.action)
978
+ ...A,
979
+ moduleActions: T.map((U) => ({
980
+ ...U,
981
+ action: $(ue, U.action)
981
982
  })),
982
- categories: z(
983
- ve,
984
- h.categories
983
+ categories: $(
984
+ be,
985
+ A.categories
985
986
  )
986
987
  };
987
- }) : [], [g.data]), N = D(() => E.filter(
988
- (t) => y.includes(t.id)
989
- ), [E, y]), Y = L(
990
- (t) => {
991
- const h = t?.value || "";
992
- 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([]);
993
994
  },
994
995
  []
995
- ), f = L(
996
- (t) => {
997
- const h = t.map((w) => w.value);
998
- A(h);
996
+ ), E = R(
997
+ (a) => {
998
+ const A = a.map((T) => T.value);
999
+ h(A);
999
1000
  },
1000
1001
  []
1001
- ), k = L(async () => {
1002
- if (C(!0), !N.length) {
1003
- C(!1);
1004
- const t = new Error(
1005
- `No modules selected for ${a === "convert" ? "converting" : "copying"}`
1002
+ ), L = R(async () => {
1003
+ if (f(!0), !N.length) {
1004
+ f(!1);
1005
+ const a = new Error(
1006
+ `No modules selected for ${s === "convert" ? "converting" : "copying"}`
1006
1007
  );
1007
- i?.(t);
1008
+ r?.(a);
1008
1009
  return;
1009
1010
  }
1010
1011
  try {
1011
- const t = [];
1012
- let h = 0;
1013
- for (const w of N)
1012
+ const a = [];
1013
+ let A = 0;
1014
+ for (const T of N)
1014
1015
  try {
1015
- let R = w.moduleActions.map((G) => G.actionId);
1016
- if (d) {
1017
- const G = w.moduleActions.map((Q) => Q.action), $ = async (Q) => {
1018
- if (a === "copy") {
1019
- if (Q.quantumOwned) return Q;
1020
- const I = z(
1021
- ve,
1022
- Q.categories
1023
- ), H = {
1024
- ...Q,
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,
1025
1026
  quantumOwned: !0,
1026
- thresholds: Q.thresholds.map((ee) => ({
1027
- ...ee,
1027
+ thresholds: b.thresholds.map((he) => ({
1028
+ ...he,
1028
1029
  id: void 0
1029
1030
  })),
1030
- categories: I?.map((ee) => ee.id),
1031
+ categories: H?.map((he) => he.id),
1031
1032
  id: void 0
1032
- }, q = await F({ fields: H });
1033
- return q.error || !q.data?.createAction ? null : z(
1034
- de,
1035
- q.data.createAction
1033
+ }, ee = await z({ fields: oe });
1034
+ return ee.error || !ee.data?.createAction ? null : $(
1035
+ ue,
1036
+ ee.data.createAction
1036
1037
  );
1037
1038
  }
1038
- if (Q.quantumOwned) return Q;
1039
- const pe = await _({
1040
- id: Q.id
1039
+ if (b.quantumOwned) return b;
1040
+ const Q = await I({
1041
+ id: b.id
1041
1042
  });
1042
- return pe.error || !pe.data?.convertActionToQuantumOwned ? null : z(
1043
- de,
1044
- pe.data.convertActionToQuantumOwned
1043
+ return Q.error || !Q.data?.convertActionToQuantumOwned ? null : $(
1044
+ ue,
1045
+ Q.data.convertActionToQuantumOwned
1045
1046
  );
1046
1047
  };
1047
- R = (await Promise.all(
1048
- G.map($)
1049
- )).filter((Q) => !!Q).map((Q) => Q.id);
1048
+ U = (await Promise.all(
1049
+ B.map(Y)
1050
+ )).filter((b) => !!b).map((b) => b.id);
1050
1051
  }
1051
- if (a === "convert") {
1052
- const G = {
1053
- name: w.name,
1054
- description: w.description || void 0,
1055
- actions: R,
1056
- categories: w.categories.map((B) => B.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),
1057
1058
  quantumOwned: !0
1058
- }, $ = await S({
1059
- id: w.id,
1060
- input: G
1059
+ }, Y = await F({
1060
+ id: T.id,
1061
+ input: B
1061
1062
  });
1062
- if ($.error) throw new Error($.error.message);
1063
- if ($.data?.updateModule) {
1064
- const B = z(
1065
- Se,
1066
- $.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
1067
1068
  );
1068
- t.push(B);
1069
+ a.push(re);
1069
1070
  }
1070
1071
  } else {
1071
- const G = {
1072
- name: `${w.name} (Copy)`,
1073
- description: w.description || void 0,
1074
- actions: R,
1075
- categories: w.categories.map((B) => B.id),
1076
- quantumOwned: d
1077
- }, $ = await x({ input: G });
1078
- if ($.error) throw new Error($.error.message);
1079
- if ($.data?.createModule) {
1080
- const B = z(
1081
- Se,
1082
- $.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
1083
1084
  );
1084
- t.push(B);
1085
+ a.push(re);
1085
1086
  }
1086
1087
  }
1087
- } catch (R) {
1088
+ } catch (U) {
1088
1089
  console.error(
1089
- `Failed to ${a === "convert" ? "convert" : "copy"} module "${w.name}":`,
1090
- R
1091
- ), h++;
1090
+ `Failed to ${s === "convert" ? "convert" : "copy"} module "${T.name}":`,
1091
+ U
1092
+ ), A++;
1092
1093
  }
1093
- if (t.length > 0) {
1094
- const w = t.length, R = N.length;
1095
- b({
1096
- title: h > 0 ? `Partial ${a === "convert" ? "convert" : "copy"} completed` : `Modules ${a === "convert" ? "converted" : "copied"} successfully`,
1097
- description: h > 0 ? `${w} of ${R} modules ${a === "convert" ? "converted" : "copied"} successfully` : `${w} module${w > 1 ? "s" : ""} ${a === "convert" ? "converted" : "copied"} successfully`,
1098
- 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",
1099
1100
  duration: 3e3,
1100
1101
  isClosable: !0
1101
- }), t.length > 0 && s?.(), O(""), A([]);
1102
+ }), a.length > 0 && n?.(), S(""), h([]);
1102
1103
  } else
1103
1104
  throw new Error(
1104
- `Failed to ${a === "convert" ? "convert" : "copy"} any modules`
1105
+ `Failed to ${s === "convert" ? "convert" : "copy"} any modules`
1105
1106
  );
1106
- } catch (t) {
1107
- const h = t instanceof Error ? t.message : `Failed to ${a === "convert" ? "convert" : "copy"} modules`;
1108
- b({
1109
- title: a === "convert" ? "Convert failed" : "Copy failed",
1110
- 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,
1111
1112
  status: "error",
1112
1113
  duration: 5e3,
1113
1114
  isClosable: !0
1114
- }), i?.(t instanceof Error ? t : new Error(h));
1115
+ }), r?.(a instanceof Error ? a : new Error(A));
1115
1116
  } finally {
1116
- C(!1);
1117
+ f(!1);
1117
1118
  }
1118
1119
  }, [
1119
1120
  N,
1120
- x,
1121
- S,
1122
- b,
1123
- s,
1124
- i,
1125
- d,
1121
+ M,
1126
1122
  F,
1127
- _,
1128
- a
1129
- ]), T = L(() => {
1130
- O(""), A([]), l("copy"), n?.();
1131
- }, [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]);
1132
1133
  se(() => {
1133
1134
  u && u({
1134
1135
  cancelButton: !1,
1135
- saveButton: N.length === 0 || p
1136
+ saveButton: N.length === 0 || C
1136
1137
  });
1137
- }, [N.length, p, u]), se(() => {
1138
- r && r({
1139
- cancelButton: T,
1140
- saveButton: k
1138
+ }, [N.length, C, u]), se(() => {
1139
+ l && l({
1140
+ cancelButton: V,
1141
+ saveButton: L
1141
1142
  });
1142
- }, [r, T, k]);
1143
- const V = D(() => M.map((t) => ({
1144
- value: t.id,
1145
- label: t.name
1146
- })), [M]), j = D(() => E.filter((t) => a === "copy" ? !0 : !t.quantumOwned).map((t) => ({
1147
- value: t.id,
1148
- 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,
1149
1150
  // Add custom data to identify quantum-owned modules
1150
- isQuantumOwned: t.quantumOwned
1151
- })), [E, a]), U = m.fetching, J = g.fetching;
1151
+ isQuantumOwned: a.quantumOwned
1152
+ })), [q, s]), J = j.fetching, i = x.fetching, m = o("module");
1152
1153
  return /* @__PURE__ */ e.jsx(Z, { children: /* @__PURE__ */ e.jsxs(te, { spacing: 6, align: "stretch", children: [
1153
- d && /* @__PURE__ */ e.jsxs(X, { children: [
1154
- /* @__PURE__ */ e.jsx(ie, { children: "Operation Mode" }),
1154
+ c && /* @__PURE__ */ e.jsxs(X, { children: [
1155
+ /* @__PURE__ */ e.jsx(ae, { children: "Operation Mode" }),
1155
1156
  /* @__PURE__ */ e.jsx(
1156
- Ve,
1157
+ et,
1157
1158
  {
1158
- value: a,
1159
- onChange: (t) => {
1160
- l(t), A([]);
1159
+ value: s,
1160
+ onChange: (a) => {
1161
+ g(a), h([]);
1161
1162
  },
1162
1163
  children: /* @__PURE__ */ e.jsxs(ne, { spacing: 6, children: [
1163
- /* @__PURE__ */ e.jsx(Te, { value: "copy", colorScheme: "blue", children: /* @__PURE__ */ e.jsxs(te, { align: "start", spacing: 1, children: [
1164
- /* @__PURE__ */ e.jsx(v, { fontWeight: "medium", children: "Copy Modules" }),
1165
- /* @__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
+ ] })
1166
1175
  ] }) }),
1167
- /* @__PURE__ */ e.jsx(Te, { value: "convert", colorScheme: "green", children: /* @__PURE__ */ e.jsxs(te, { align: "start", spacing: 1, children: [
1168
- /* @__PURE__ */ e.jsx(v, { fontWeight: "medium", children: "Convert to Quantum Owned" }),
1169
- /* @__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
+ ] })
1170
1183
  ] }) })
1171
1184
  ] })
1172
1185
  }
1173
1186
  )
1174
1187
  ] }),
1175
1188
  /* @__PURE__ */ e.jsxs(X, { children: [
1176
- /* @__PURE__ */ e.jsx(ie, { children: "Select Source Group" }),
1189
+ /* @__PURE__ */ e.jsx(ae, { children: "Select Source Group" }),
1177
1190
  /* @__PURE__ */ e.jsx(
1178
- ae,
1191
+ le,
1179
1192
  {
1180
1193
  placeholder: "Choose a group...",
1181
- options: V,
1182
- value: V.find((t) => t.value === o) || null,
1183
- onChange: Y,
1184
- isLoading: U,
1185
- isDisabled: U,
1194
+ options: w,
1195
+ value: w.find((a) => a.value === k) || null,
1196
+ onChange: v,
1197
+ isLoading: J,
1198
+ isDisabled: J,
1186
1199
  isClearable: !0
1187
1200
  }
1188
1201
  ),
1189
- m.error && /* @__PURE__ */ e.jsxs(Ie, { status: "error", mt: 2, children: [
1190
- /* @__PURE__ */ e.jsx(Oe, {}),
1191
- /* @__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: [
1192
1205
  "Failed to load groups: ",
1193
- m.error.message
1206
+ j.error.message
1194
1207
  ] })
1195
1208
  ] })
1196
1209
  ] }),
1197
- o && /* @__PURE__ */ e.jsxs(X, { children: [
1198
- /* @__PURE__ */ e.jsx(ie, { children: a === "convert" ? "Select Module to Convert" : "Select Module to Copy" }),
1199
- J ? /* @__PURE__ */ e.jsxs(ne, { children: [
1200
- /* @__PURE__ */ e.jsx(et, { size: "sm" }),
1201
- /* @__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
+ ] })
1202
1219
  ] }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1203
1220
  /* @__PURE__ */ e.jsx(
1204
- ae,
1221
+ le,
1205
1222
  {
1206
- placeholder: a === "convert" ? "Choose modules to convert..." : "Choose modules to copy...",
1207
- options: j,
1208
- value: j.filter(
1209
- (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)
1210
1227
  ),
1211
- onChange: f,
1212
- isDisabled: j.length === 0,
1228
+ onChange: E,
1229
+ isDisabled: P.length === 0,
1213
1230
  isClearable: !0,
1214
1231
  isMulti: !0,
1215
1232
  closeMenuOnSelect: !1,
1216
- 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: [
1217
1234
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
1218
- /* @__PURE__ */ e.jsx(v, { children: t.label }),
1219
- 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)" })
1220
1237
  ] }),
1221
- 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" })
1222
1239
  ] })
1223
1240
  }
1224
1241
  ),
1225
- 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
+ ] })
1226
1247
  ] }),
1227
- g.error && /* @__PURE__ */ e.jsxs(Ie, { status: "error", mt: 2, children: [
1228
- /* @__PURE__ */ e.jsx(Oe, {}),
1229
- /* @__PURE__ */ e.jsxs(v, { fontSize: "sm", children: [
1230
- "Failed to load modules: ",
1231
- 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
1232
1256
  ] })
1233
1257
  ] })
1234
1258
  ] }),
1235
1259
  N.length > 0 && /* @__PURE__ */ e.jsxs(Z, { p: 4, bg: "gray.50", borderRadius: "md", children: [
1236
- /* @__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"}` }),
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"}` }),
1237
1261
  /* @__PURE__ */ e.jsxs(te, { align: "start", spacing: 3, children: [
1238
- N.map((t, h) => /* @__PURE__ */ e.jsxs(
1262
+ N.map((a, A) => /* @__PURE__ */ e.jsxs(
1239
1263
  Z,
1240
1264
  {
1241
1265
  w: "100%",
@@ -1246,12 +1270,12 @@ const Zt = ({
1246
1270
  borderColor: "gray.200",
1247
1271
  children: [
1248
1272
  /* @__PURE__ */ e.jsxs(ne, { justify: "space-between", align: "start", mb: 2, children: [
1249
- /* @__PURE__ */ e.jsxs(v, { fontWeight: "medium", fontSize: "sm", children: [
1250
- h + 1,
1273
+ /* @__PURE__ */ e.jsxs(y, { fontWeight: "medium", fontSize: "sm", children: [
1274
+ A + 1,
1251
1275
  ". ",
1252
- t.name
1276
+ a.name
1253
1277
  ] }),
1254
- 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" })
1255
1279
  ] }),
1256
1280
  /* @__PURE__ */ e.jsxs(
1257
1281
  te,
@@ -1261,27 +1285,27 @@ const Zt = ({
1261
1285
  fontSize: "sm",
1262
1286
  color: "gray.600",
1263
1287
  children: [
1264
- t.description && /* @__PURE__ */ e.jsxs(v, { children: [
1288
+ a.description && /* @__PURE__ */ e.jsxs(y, { children: [
1265
1289
  /* @__PURE__ */ e.jsx("strong", { children: "Description:" }),
1266
1290
  " ",
1267
- t.description
1291
+ a.description
1268
1292
  ] }),
1269
- /* @__PURE__ */ e.jsxs(v, { children: [
1270
- /* @__PURE__ */ e.jsx("strong", { children: "Actions:" }),
1293
+ /* @__PURE__ */ e.jsxs(y, { children: [
1294
+ /* @__PURE__ */ e.jsx("strong", { children: "Activities:" }),
1271
1295
  " ",
1272
- t.moduleActions.length
1296
+ a.moduleActions.length
1273
1297
  ] }),
1274
- /* @__PURE__ */ e.jsxs(v, { children: [
1298
+ /* @__PURE__ */ e.jsxs(y, { children: [
1275
1299
  /* @__PURE__ */ e.jsx("strong", { children: "Categories:" }),
1276
1300
  " ",
1277
- t.categories.map((w) => w.name).join(", ") || "None"
1301
+ a.categories.map((T) => T.name).join(", ") || "None"
1278
1302
  ] })
1279
1303
  ]
1280
1304
  }
1281
1305
  )
1282
1306
  ]
1283
1307
  },
1284
- t.id
1308
+ a.id
1285
1309
  )),
1286
1310
  N.length > 1 && /* @__PURE__ */ e.jsx(
1287
1311
  Z,
@@ -1292,16 +1316,18 @@ const Zt = ({
1292
1316
  borderRadius: "md",
1293
1317
  border: "1px solid",
1294
1318
  borderColor: "blue.200",
1295
- 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: [
1296
1320
  "Total: ",
1297
1321
  N.length,
1298
- " modules will be",
1299
1322
  " ",
1300
- a === "copy" ? "copied" : "converted"
1323
+ m,
1324
+ "s will be",
1325
+ " ",
1326
+ s === "copy" ? "copied" : "converted"
1301
1327
  ] })
1302
1328
  }
1303
1329
  ),
1304
- d && N.filter((t) => t.moduleActions.some((h) => !h.action.quantumOwned)).length > 0 && /* @__PURE__ */ e.jsx(
1330
+ c && N.filter((a) => a.moduleActions.some((A) => !A.action.quantumOwned)).length > 0 && /* @__PURE__ */ e.jsx(
1305
1331
  Z,
1306
1332
  {
1307
1333
  p: 2,
@@ -1309,116 +1335,116 @@ const Zt = ({
1309
1335
  borderRadius: "md",
1310
1336
  border: "1px solid",
1311
1337
  borderColor: "yellow.200",
1312
- 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` })
1313
1339
  }
1314
1340
  )
1315
1341
  ] })
1316
1342
  ] }),
1317
- !c && /* @__PURE__ */ e.jsxs(xe, { spacing: 4, justifyContent: "flex-end", children: [
1343
+ !d && /* @__PURE__ */ e.jsxs(fe, { spacing: 4, justifyContent: "flex-end", children: [
1318
1344
  /* @__PURE__ */ e.jsx(
1319
1345
  K,
1320
1346
  {
1321
1347
  variant: "outline",
1322
- onClick: T,
1323
- isDisabled: p,
1348
+ onClick: V,
1349
+ isDisabled: C,
1324
1350
  children: "Cancel"
1325
1351
  }
1326
1352
  ),
1327
1353
  /* @__PURE__ */ e.jsxs(
1328
1354
  K,
1329
1355
  {
1330
- colorScheme: a === "copy" ? "blue" : "green",
1331
- onClick: k,
1332
- isDisabled: N.length === 0 || p,
1333
- isLoading: p,
1334
- loadingText: `${a === "copy" ? "Copying" : "Converting"}...`,
1356
+ colorScheme: s === "copy" ? "blue" : "green",
1357
+ onClick: L,
1358
+ isDisabled: N.length === 0 || C,
1359
+ isLoading: C,
1360
+ loadingText: `${s === "copy" ? "Copying" : "Converting"}...`,
1335
1361
  children: [
1336
- a === "copy" ? "Copy" : "Convert",
1362
+ s === "copy" ? "Copy" : "Convert",
1337
1363
  " ",
1338
- N.length === 1 ? "Module" : `${N.length} Modules`
1364
+ N.length === 1 ? m : `${N.length} ${m}s`
1339
1365
  ]
1340
1366
  }
1341
1367
  )
1342
1368
  ] })
1343
1369
  ] }) });
1344
- }, dn = ({
1345
- name: s,
1346
- setName: n,
1347
- actions: i,
1348
- selectedActionIds: c,
1370
+ }, un = ({
1371
+ name: n,
1372
+ setName: t,
1373
+ actions: r,
1374
+ selectedActionIds: d,
1349
1375
  setSelectedActionIds: u,
1350
- availableCategories: r,
1351
- selectedCategoryIds: d,
1352
- setSelectedCategoryIds: b,
1376
+ availableCategories: l,
1377
+ selectedCategoryIds: c,
1378
+ setSelectedCategoryIds: p,
1353
1379
  description: o,
1354
- setDescription: O,
1355
- ...y
1380
+ setDescription: k,
1381
+ ...S
1356
1382
  }) => {
1357
- const A = ft(), p = D(() => i.map((x) => ({
1383
+ const O = jt(), h = D(() => r.map((x) => ({
1358
1384
  ...x,
1359
- selected: c.includes(x.id)
1360
- })), [i, c]), C = D(() => i.reduce((x, S) => (x[S.id] = S, x), {}), [i]), a = D(
1361
- () => c.map((x) => C[x]),
1362
- [c, C]
1363
- ), l = L(
1364
- (x, S) => {
1365
- 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));
1366
1392
  },
1367
- [c, u]
1368
- ), m = L(
1393
+ [d, u]
1394
+ ), g = R(
1369
1395
  (x) => {
1370
- n(x.target.value);
1396
+ t(x.target.value);
1371
1397
  },
1372
- [n]
1373
- ), g = L(
1398
+ [t]
1399
+ ), j = R(
1374
1400
  (x) => {
1375
- O?.(x.target.value);
1401
+ k?.(x.target.value);
1376
1402
  },
1377
- [O]
1403
+ [k]
1378
1404
  );
1379
- return /* @__PURE__ */ e.jsxs(Z, { ...y, children: [
1405
+ return /* @__PURE__ */ e.jsxs(Z, { ...S, children: [
1380
1406
  /* @__PURE__ */ e.jsxs(ne, { gap: "2rem", children: [
1381
- /* @__PURE__ */ e.jsx(un, { name: s ?? "", onInputChange: m }),
1407
+ /* @__PURE__ */ e.jsx(hn, { name: n ?? "", onInputChange: g }),
1382
1408
  /* @__PURE__ */ e.jsx(
1383
- hn,
1409
+ mn,
1384
1410
  {
1385
- availableCategories: r,
1386
- value: d,
1387
- onChange: b
1411
+ availableCategories: l,
1412
+ value: c,
1413
+ onChange: p
1388
1414
  }
1389
1415
  )
1390
1416
  ] }),
1391
1417
  /* @__PURE__ */ e.jsx(
1392
- mn,
1418
+ pn,
1393
1419
  {
1394
1420
  description: o ?? "",
1395
- onInputChange: g
1421
+ onInputChange: j
1396
1422
  }
1397
1423
  ),
1398
1424
  /* @__PURE__ */ e.jsx(
1399
- pn,
1425
+ gn,
1400
1426
  {
1401
- value: a,
1427
+ value: f,
1402
1428
  onChange: u,
1403
- onAdjustActivities: () => A.onOpen()
1429
+ onAdjustActivities: () => O.onOpen()
1404
1430
  }
1405
1431
  ),
1406
1432
  /* @__PURE__ */ e.jsxs(
1407
- jt,
1433
+ vt,
1408
1434
  {
1409
- isOpen: A.isOpen,
1410
- onClose: A.onClose,
1435
+ isOpen: O.isOpen,
1436
+ onClose: O.onClose,
1411
1437
  size: "6xl",
1412
1438
  children: [
1413
- /* @__PURE__ */ e.jsx(vt, {}),
1414
- /* @__PURE__ */ e.jsxs(bt, { children: [
1415
- /* @__PURE__ */ e.jsx(yt, { children: "Select Activities" }),
1416
- /* @__PURE__ */ e.jsx(Ct, {}),
1417
- /* @__PURE__ */ e.jsx(wt, { children: /* @__PURE__ */ e.jsx(
1418
- 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,
1419
1445
  {
1420
- actions: p,
1421
- onSelected: l,
1446
+ actions: h,
1447
+ onSelected: s,
1422
1448
  disableCreate: !0,
1423
1449
  disableDelete: !0,
1424
1450
  tableProps: {
@@ -1427,12 +1453,12 @@ const Zt = ({
1427
1453
  }
1428
1454
  }
1429
1455
  ) }),
1430
- /* @__PURE__ */ e.jsx(St, { children: /* @__PURE__ */ e.jsx(
1456
+ /* @__PURE__ */ e.jsx(At, { children: /* @__PURE__ */ e.jsx(
1431
1457
  K,
1432
1458
  {
1433
1459
  colorScheme: "blue",
1434
- onClick: A.onClose,
1435
- isDisabled: c.length === 0,
1460
+ onClick: O.onClose,
1461
+ isDisabled: d.length === 0,
1436
1462
  children: "Done"
1437
1463
  }
1438
1464
  ) })
@@ -1441,91 +1467,100 @@ const Zt = ({
1441
1467
  }
1442
1468
  )
1443
1469
  ] });
1444
- }, un = Ne(
1470
+ }, hn = Le(
1445
1471
  ({
1446
- name: s,
1447
- onInputChange: n
1448
- }) => /* @__PURE__ */ e.jsxs(X, { mb: 4, children: [
1449
- /* @__PURE__ */ e.jsx(ie, { children: "Module Name" }),
1450
- /* @__PURE__ */ e.jsx(
1451
- fe,
1452
- {
1453
- placeholder: "i.e. ACL RTP Test Battery",
1454
- value: s,
1455
- onChange: n,
1456
- isRequired: !0
1457
- }
1458
- )
1459
- ] })
1460
- ), 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(
1461
1493
  ({
1462
- availableCategories: s,
1463
- value: n,
1464
- onChange: i
1494
+ availableCategories: n,
1495
+ value: t,
1496
+ onChange: r
1465
1497
  }) => {
1466
- const c = D(() => [
1467
- ...s,
1498
+ const { getLabel: d } = ze(), u = d("module"), l = D(() => [
1499
+ ...n,
1468
1500
  {
1469
1501
  id: "other",
1470
1502
  name: "Other"
1471
1503
  }
1472
- ], [s]), u = D(() => c.map((r) => ({
1473
- value: r.id,
1474
- label: r.name
1475
- })), [c]);
1504
+ ], [n]), c = D(() => l.map((p) => ({
1505
+ value: p.id,
1506
+ label: p.name
1507
+ })), [l]);
1476
1508
  return /* @__PURE__ */ e.jsxs(X, { mb: 4, children: [
1477
- /* @__PURE__ */ e.jsx(ie, { children: "Module Category" }),
1509
+ /* @__PURE__ */ e.jsxs(ae, { children: [
1510
+ u,
1511
+ " Category"
1512
+ ] }),
1478
1513
  /* @__PURE__ */ e.jsx(
1479
- ae,
1514
+ le,
1480
1515
  {
1481
- isDisabled: s.length === 0,
1482
- options: u,
1483
- value: n.length === 0 ? { value: "other", label: "Other" } : c.filter((r) => n.includes(r.id)).map((r) => ({
1484
- value: r.id,
1485
- 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
1486
1521
  }))[0],
1487
- onChange: (r) => i(r ? [r.value] : []),
1522
+ onChange: (p) => r(p ? [p.value] : []),
1488
1523
  placeholder: "Select category"
1489
1524
  }
1490
1525
  )
1491
1526
  ] });
1492
1527
  }
1493
- ), mn = Ne(
1528
+ ), pn = Le(
1494
1529
  ({
1495
- description: s,
1496
- onInputChange: n
1530
+ description: n,
1531
+ onInputChange: t
1497
1532
  }) => /* @__PURE__ */ e.jsxs(X, { mb: 4, children: [
1498
- /* @__PURE__ */ e.jsx(ie, { children: /* @__PURE__ */ e.jsxs("span", { children: [
1533
+ /* @__PURE__ */ e.jsx(ae, { children: /* @__PURE__ */ e.jsxs("span", { children: [
1499
1534
  "Description",
1500
- /* @__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." })
1501
1536
  ] }) }),
1502
1537
  /* @__PURE__ */ e.jsx(
1503
- fe,
1538
+ je,
1504
1539
  {
1505
1540
  placeholder: "i.e. Assess readiness to return to play post-ACL reconstruction",
1506
- value: s,
1507
- onChange: n
1541
+ value: n,
1542
+ onChange: t
1508
1543
  }
1509
1544
  )
1510
1545
  ] })
1511
- ), pn = Ne(
1546
+ ), gn = Le(
1512
1547
  ({
1513
- value: s,
1514
- onChange: n,
1515
- onAdjustActivities: i
1548
+ value: n,
1549
+ onChange: t,
1550
+ onAdjustActivities: r
1516
1551
  }) => {
1517
- const c = D(
1518
- () => s.map((u) => ({
1552
+ const d = D(
1553
+ () => n.map((u) => ({
1519
1554
  id: u.id,
1520
1555
  name: u.name
1521
1556
  })),
1522
- [s]
1557
+ [n]
1523
1558
  );
1524
1559
  return /* @__PURE__ */ e.jsxs(X, { mb: 4, children: [
1525
1560
  /* @__PURE__ */ e.jsxs(ne, { justifyContent: "space-between", children: [
1526
- /* @__PURE__ */ e.jsx(ie, { children: /* @__PURE__ */ e.jsxs("span", { children: [
1561
+ /* @__PURE__ */ e.jsx(ae, { children: /* @__PURE__ */ e.jsxs("span", { children: [
1527
1562
  "Activities",
1528
- /* @__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." })
1529
1564
  ] }) }),
1530
1565
  /* @__PURE__ */ e.jsx(
1531
1566
  K,
@@ -1533,12 +1568,12 @@ const Zt = ({
1533
1568
  size: "sm",
1534
1569
  variant: "solid",
1535
1570
  colorScheme: "blue",
1536
- onClick: i,
1571
+ onClick: r,
1537
1572
  children: "Add / Remove Activities"
1538
1573
  }
1539
1574
  )
1540
1575
  ] }),
1541
- 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: [
1542
1577
  "No activities selected for this module.",
1543
1578
  /* @__PURE__ */ e.jsx(
1544
1579
  K,
@@ -1547,91 +1582,91 @@ const Zt = ({
1547
1582
  size: "sm",
1548
1583
  variant: "link",
1549
1584
  colorScheme: "blue",
1550
- onClick: i,
1585
+ onClick: r,
1551
1586
  children: "Add activities."
1552
1587
  }
1553
1588
  )
1554
1589
  ] }) }) : /* @__PURE__ */ e.jsx(
1555
- Kt,
1590
+ Vt,
1556
1591
  {
1557
- value: c,
1592
+ value: d,
1558
1593
  onChange: (u) => {
1559
- const r = u(c);
1560
- n(r.map((d) => d.id));
1594
+ const l = u(d);
1595
+ t(l.map((c) => c.id));
1561
1596
  }
1562
1597
  }
1563
1598
  )
1564
1599
  ] });
1565
1600
  }
1566
- ), gn = ({
1567
- value: s,
1568
- onChange: n,
1569
- forceKind: i,
1570
- disableRemove: c,
1601
+ ), xn = ({
1602
+ value: n,
1603
+ onChange: t,
1604
+ forceKind: r,
1605
+ disableRemove: d,
1571
1606
  disableKind: u,
1572
- isDisabled: r,
1573
- lockRanges: d,
1574
- ...b
1607
+ isDisabled: l,
1608
+ lockRanges: c,
1609
+ ...p
1575
1610
  }) => {
1576
- const o = D(() => [...s].sort((p, C) => {
1577
- const a = Be.indexOf(p.plane), l = Be.indexOf(C.plane);
1578
- return a - l;
1579
- }), [s]), O = L((p) => "segment" in p.id ? at(p.id.segment, p.plane, !0) ?? "Unknown" : lt(p.id.joint, p.plane, !0) ?? "Unknown", []), y = L(
1580
- (p, C) => {
1581
- const a = o.findIndex(
1582
- (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
1583
1618
  );
1584
- let l = [...o];
1585
- i && (C = { ...C, kind: i }), l[a] = C, d && (l = l.map((m) => ({
1586
- ...m,
1619
+ let s = [...o];
1620
+ r && (C = { ...C, kind: r }), s[f] = C, c && (s = s.map((g) => ({
1621
+ ...g,
1587
1622
  min: C.min,
1588
1623
  max: C.max
1589
- }))), n(l);
1624
+ }))), t(s);
1590
1625
  },
1591
- [n, o, i, d]
1592
- ), A = L(
1593
- (p) => {
1626
+ [t, o, r, c]
1627
+ ), O = R(
1628
+ (h) => {
1594
1629
  const C = o.filter(
1595
- (a) => a.id !== p.id || a.plane !== p.plane
1630
+ (f) => f.id !== h.id || f.plane !== h.plane
1596
1631
  );
1597
- n(C);
1632
+ t(C);
1598
1633
  },
1599
- [n, o]
1634
+ [t, o]
1600
1635
  );
1601
- return /* @__PURE__ */ e.jsx(te, { alignItems: "flex-start", overflowY: "auto", ...b, children: o.map((p, C) => /* @__PURE__ */ e.jsx(
1602
- xn,
1636
+ return /* @__PURE__ */ e.jsx(te, { alignItems: "flex-start", overflowY: "auto", ...p, children: o.map((h, C) => /* @__PURE__ */ e.jsx(
1637
+ fn,
1603
1638
  {
1604
- label: O(p),
1605
- parameter: p,
1606
- onChange: (a) => y(C, a),
1607
- onRemove: c || r ? void 0 : () => A(p),
1608
- forceKind: i,
1609
- disableKind: u || r,
1610
- 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
1611
1646
  },
1612
- `${JSON.stringify(p.id)}-${p.plane}`
1647
+ `${JSON.stringify(h.id)}-${h.plane}`
1613
1648
  )) });
1614
- }, xn = ({
1615
- label: s,
1616
- parameter: n,
1617
- onChange: i,
1618
- onRemove: c,
1649
+ }, fn = ({
1650
+ label: n,
1651
+ parameter: t,
1652
+ onChange: r,
1653
+ onRemove: d,
1619
1654
  forceKind: u,
1620
- disableKind: r,
1621
- isDisabled: d
1655
+ disableKind: l,
1656
+ isDisabled: c
1622
1657
  }) => {
1623
- const b = L(
1624
- (y) => "joint" in n.id ? Qt(
1625
- n.id.joint,
1626
- n.plane,
1627
- y < 0 ? -1 : 1
1628
- ) : qt(
1629
- n.id.segment,
1630
- n.plane,
1631
- 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
1632
1667
  ),
1633
- [n]
1634
- ), { 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 };
1635
1670
  return /* @__PURE__ */ e.jsxs(
1636
1671
  te,
1637
1672
  {
@@ -1645,31 +1680,31 @@ const Zt = ({
1645
1680
  children: [
1646
1681
  /* @__PURE__ */ e.jsxs(ne, { w: "100%", children: [
1647
1682
  /* @__PURE__ */ e.jsx(
1648
- v,
1683
+ y,
1649
1684
  {
1650
1685
  fontSize: "sm",
1651
1686
  flex: 1,
1652
1687
  textTransform: "capitalize",
1653
1688
  fontWeight: "semibold",
1654
- children: s
1689
+ children: n
1655
1690
  }
1656
1691
  ),
1657
- c && !d && /* @__PURE__ */ e.jsx(
1658
- At,
1692
+ d && !c && /* @__PURE__ */ e.jsx(
1693
+ Mt,
1659
1694
  {
1660
1695
  size: "xs",
1661
1696
  variant: "ghost",
1662
1697
  "aria-label": "delete",
1663
- icon: /* @__PURE__ */ e.jsx(qe, { as: Ot }),
1664
- onClick: c
1698
+ icon: /* @__PURE__ */ e.jsx(Ye, { as: Nt }),
1699
+ onClick: d
1665
1700
  }
1666
1701
  ),
1667
1702
  !u && /* @__PURE__ */ e.jsx(
1668
- en,
1703
+ tn,
1669
1704
  {
1670
- selectedItem: n?.kind ?? Ae.Limit,
1671
- onChange: ({ value: y }) => i({ ...n, kind: y }),
1672
- isDisabled: r || d,
1705
+ selectedItem: t?.kind ?? Me.Limit,
1706
+ onChange: ({ value: S }) => r({ ...t, kind: S }),
1707
+ isDisabled: l || c,
1673
1708
  buttonProps: {
1674
1709
  size: "sm",
1675
1710
  variant: "outline",
@@ -1680,118 +1715,118 @@ const Zt = ({
1680
1715
  colorScheme: "teal"
1681
1716
  },
1682
1717
  items: [
1683
- { value: Ae.Limit, label: "limit" },
1684
- { value: Ae.Target, label: "target" }
1718
+ { value: Me.Limit, label: "limit" },
1719
+ { value: Me.Target, label: "target" }
1685
1720
  ]
1686
1721
  }
1687
1722
  )
1688
1723
  ] }),
1689
1724
  /* @__PURE__ */ e.jsx(
1690
- tn,
1725
+ nn,
1691
1726
  {
1692
1727
  w: "100%",
1693
1728
  size: "xs",
1694
1729
  min: o,
1695
- max: O,
1730
+ max: k,
1696
1731
  zeroMarker: !0,
1697
- value: [n.min, n.max],
1698
- onChange: (y) => i({ ...n, min: y[0], max: y[1] }),
1699
- formatValue: (y) => `${Math.abs(y)}°`,
1700
- valueLabel: (y) => b(y) ?? "",
1701
- positiveNegativeLabels: b(0) ? [b(-1) ?? "", b(1) ?? ""] : void 0,
1702
- 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
1703
1738
  }
1704
1739
  )
1705
1740
  ]
1706
1741
  }
1707
1742
  );
1708
- }, we = (s, n) => "segment" in s && "segment" in n && s.segment === n.segment || "joint" in s && "joint" in n && s.joint === n.joint, fn = ({
1709
- options: s,
1710
- value: n,
1711
- onChange: i,
1712
- 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,
1713
1748
  singleValue: u,
1714
- singleValueSideless: r,
1715
- editOnly: d,
1716
- disableKind: b,
1749
+ singleValueSideless: l,
1750
+ editOnly: c,
1751
+ disableKind: p,
1717
1752
  maxParameters: o,
1718
- ...O
1753
+ ...k
1719
1754
  }) => {
1720
- const y = r ? 2 : o, A = D(
1721
- () => s.map((l) => ({
1722
- label: "segment" in l.id ? at(l.id.segment, l.plane, !0) ?? "Unknown" : lt(l.id.joint, l.plane, !0) ?? "Unknown",
1723
- value: l.id,
1724
- 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
1725
1760
  })),
1726
- [s]
1727
- ), p = D(() => {
1728
- if (!r || n.length === 0)
1729
- return A;
1730
- const l = n[0];
1731
- return A.filter(
1732
- (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
1733
1768
  );
1734
- }, [A, n, r]), C = D(
1735
- () => A.filter(
1736
- (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)
1737
1772
  ),
1738
- [A, n]
1739
- ), a = L(
1740
- (l) => {
1741
- const m = l.map((g) => {
1742
- const x = n.find(
1743
- (E) => we(E.id, g.value) && E.plane === g.plane
1744
- ), S = s.find(
1745
- (E) => we(E.id, g.value) && E.plane === g.plane
1746
- ), F = r ? n.find(
1747
- (E) => ye(E.id) === ye(g.value) && E.plane === g.plane
1748
- ) : 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;
1749
1784
  return x ?? {
1750
- id: g.value,
1751
- plane: g.plane,
1752
- min: _,
1753
- max: M,
1754
- kind: c ?? Ae.Limit
1785
+ id: j.value,
1786
+ plane: j.plane,
1787
+ min: z,
1788
+ max: I,
1789
+ kind: d ?? Me.Limit
1755
1790
  };
1756
1791
  });
1757
- i(m);
1792
+ r(g);
1758
1793
  },
1759
- [i, n, s, c, r]
1794
+ [r, t, n, d, l]
1760
1795
  );
1761
1796
  return se(() => {
1762
- const l = n.filter(
1763
- (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)
1764
1799
  );
1765
- l.length !== n.length && i(l);
1766
- }, [s, i]), /* @__PURE__ */ e.jsxs(Z, { ...O, children: [
1800
+ s.length !== t.length && r(s);
1801
+ }, [n, r]), /* @__PURE__ */ e.jsxs(Z, { ...k, children: [
1767
1802
  /* @__PURE__ */ e.jsx(
1768
- ae,
1803
+ le,
1769
1804
  {
1770
1805
  isMulti: !u,
1771
- placeholder: n.length ? `${n.length} selected` : "Search...",
1806
+ placeholder: t.length ? `${t.length} selected` : "Search...",
1772
1807
  value: C,
1773
- isDisabled: d || C.length >= (y ?? 1 / 0),
1774
- onChange: (l) => Array.isArray(l) ? a([...l]) : a(l !== null ? [l] : []),
1775
- 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,
1776
1811
  controlShouldRenderValue: !1
1777
1812
  }
1778
1813
  ),
1779
1814
  /* @__PURE__ */ e.jsx(
1780
- gn,
1815
+ xn,
1781
1816
  {
1782
1817
  marginTop: 2,
1783
1818
  maxH: "28rem",
1784
- value: n,
1785
- onChange: i,
1786
- forceKind: c,
1787
- disableKind: b,
1788
- isDisabled: d,
1789
- lockRanges: r
1819
+ value: t,
1820
+ onChange: r,
1821
+ forceKind: d,
1822
+ disableKind: p,
1823
+ isDisabled: c,
1824
+ lockRanges: l
1790
1825
  }
1791
1826
  )
1792
1827
  ] });
1793
- }, ct = (s) => {
1794
- switch (s) {
1828
+ }, dt = (n) => {
1829
+ switch (n) {
1795
1830
  case W.Thorax:
1796
1831
  return "Thorax";
1797
1832
  case W.CenterBack:
@@ -1821,8 +1856,8 @@ const Zt = ({
1821
1856
  case W.Head:
1822
1857
  return "Head";
1823
1858
  }
1824
- return console.warn(`Unknown sensor location: ${s}`), "Unknown";
1825
- }, jn = 6, vn = [
1859
+ return console.warn(`Unknown sensor location: ${n}`), "Unknown";
1860
+ }, vn = 6, bn = [
1826
1861
  W.LeftFoot,
1827
1862
  W.LeftShank,
1828
1863
  W.LeftThigh,
@@ -1833,174 +1868,174 @@ const Zt = ({
1833
1868
  W.Thorax,
1834
1869
  W.CenterBack,
1835
1870
  W.Head
1836
- ], bn = vn.map((s) => ({
1837
- label: ct(s),
1838
- value: s
1871
+ ], yn = bn.map((n) => ({
1872
+ label: dt(n),
1873
+ value: n
1839
1874
  })), Re = [
1840
1875
  { key: "module_category", label: "Link Category", multi: !0 },
1841
1876
  { key: "activity_type", label: "Activity Type", multi: !1 },
1842
1877
  { key: "session_type", label: "Session Type", multi: !0 },
1843
1878
  { key: "body_region", label: "Body Region", multi: !0 },
1844
1879
  { key: "sport", label: "Sport", multi: !0 }
1845
- ], Gn = ({
1846
- id: s,
1847
- onError: n,
1848
- onCancel: i,
1849
- onSave: c,
1880
+ ], Pn = ({
1881
+ id: n,
1882
+ onError: t,
1883
+ onCancel: r,
1884
+ onSave: d,
1850
1885
  hideButtons: u,
1851
- setButtonOnClick: r,
1852
- setButtonDisabled: d,
1853
- quantumOwned: b,
1886
+ setButtonOnClick: l,
1887
+ setButtonDisabled: c,
1888
+ quantumOwned: p,
1854
1889
  isView: o
1855
1890
  }) => {
1856
- const O = Nt(), [{ fetching: y }, A] = re(ze), [{ fetching: p }, C] = re(Dt), [{ data: a }] = ce({
1857
- query: Ft,
1858
- variables: { id: s ?? "" },
1859
- pause: !s
1860
- }), l = z(
1861
- de,
1862
- a?.getActionById
1863
- ), m = y || p, g = !!l && !!s, [x, S] = P(""), [F, _] = P(""), [M, E] = P(""), [N, Y] = P(""), [f, k] = P([]), [T, V] = P([]), [j, U] = P({}), J = D(
1864
- () => f.map((I) => I.value),
1865
- [f]
1866
- ), t = Xt(J), [h, w] = P([]), R = x.length > 0, [G, $] = P({});
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({});
1867
1902
  se(() => {
1868
- const I = Re.map(
1869
- (H) => O.query(Rt, { key: H.key })
1903
+ const b = Re.map(
1904
+ (Q) => k.query(Dt, { key: Q.key })
1870
1905
  );
1871
- Promise.all(I).then((H) => {
1872
- const q = {};
1873
- H.forEach((ee) => {
1874
- if (ee.error || !ee.data) return;
1875
- const oe = z(
1906
+ Promise.all(b).then((Q) => {
1907
+ const H = {};
1908
+ Q.forEach((oe) => {
1909
+ if (oe.error || !oe.data) return;
1910
+ const ee = $(
1876
1911
  De,
1877
- ee.data.getMetadataByKey
1878
- ), ke = z(
1912
+ oe.data.getMetadataByKey
1913
+ ), he = $(
1879
1914
  Fe,
1880
- oe.data
1915
+ ee.data
1881
1916
  );
1882
- q[oe.key] = ke.map((ue) => ({
1883
- label: ue.label || ue.value,
1884
- value: ue.value,
1885
- id: ue.id
1917
+ H[ee.key] = he.map((me) => ({
1918
+ label: me.label || me.value,
1919
+ value: me.value,
1920
+ id: me.id
1886
1921
  }));
1887
- }), U(q);
1922
+ }), P(H);
1888
1923
  });
1889
- }, [O]), se(() => {
1890
- if (l) {
1891
- const H = z(
1924
+ }, [k]), se(() => {
1925
+ if (s) {
1926
+ const Q = $(
1892
1927
  De,
1893
- l.metadataGroups
1928
+ s.metadataGroups
1894
1929
  ).map(
1895
- (ee) => ee.data.map((oe) => z(Fe, oe).id)
1896
- ), q = {
1897
- name: l.name,
1898
- description: l.description || "",
1899
- cameraPlacement: l.cameraPlacement || "",
1900
- videoLink: l.videoLink || "",
1901
- sensorLocations: l.sensorLocations.map((ee) => ({
1902
- label: ct(ee),
1903
- 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
1904
1939
  })),
1905
- thresholds: Ht(l.thresholds),
1906
- metadataIds: H.flat()
1940
+ thresholds: Jt(s.thresholds),
1941
+ metadataIds: Q.flat()
1907
1942
  };
1908
- S(q.name), _(q.description), E(q.cameraPlacement), Y(q.videoLink), k(q.sensorLocations), w(q.thresholds), V(q.metadataIds), $(q);
1943
+ M(H.name), z(H.description), _(H.cameraPlacement), N(H.videoLink), E(H.sensorLocations), a(H.thresholds), V(H.metadataIds), U(H);
1909
1944
  }
1910
- }, [l]);
1945
+ }, [s]);
1911
1946
  const B = D(
1912
- () => JSON.stringify(G) !== JSON.stringify({
1947
+ () => JSON.stringify(T) !== JSON.stringify({
1913
1948
  name: x,
1914
1949
  description: F,
1915
- cameraPlacement: M,
1916
- videoLink: N,
1950
+ cameraPlacement: I,
1951
+ videoLink: q,
1917
1952
  sensorLocations: J,
1918
- thresholds: Qe(h),
1919
- metadataIds: T
1953
+ thresholds: qe(m),
1954
+ metadataIds: L
1920
1955
  }),
1921
1956
  [
1922
- G,
1957
+ T,
1923
1958
  x,
1924
1959
  J,
1925
1960
  F,
1926
- M,
1927
- N,
1928
- T,
1929
- h
1961
+ I,
1962
+ q,
1963
+ L,
1964
+ m
1930
1965
  ]
1931
- ), Q = L(() => {
1932
- const I = {
1966
+ ), Y = R(() => {
1967
+ const b = {
1933
1968
  name: x,
1934
1969
  description: F,
1935
- cameraPlacement: M,
1936
- videoLink: N,
1970
+ cameraPlacement: I,
1971
+ videoLink: q,
1937
1972
  sensorLocations: J,
1938
- thresholds: Qe(h),
1939
- metadataItemIds: T,
1973
+ thresholds: qe(m),
1974
+ metadataItemIds: L,
1940
1975
  // Backend requires laterality; keep existing default since UI no longer edits it
1941
- laterality: Bt.Either,
1942
- quantumOwned: b,
1976
+ laterality: Qt.Either,
1977
+ quantumOwned: p,
1943
1978
  //Backend requires session type; keep existing default since UI no longer edits it
1944
1979
  sessionType: []
1945
1980
  };
1946
- let H;
1947
- g && s ? H = C({
1948
- id: s,
1949
- fields: I
1950
- }) : H = A({
1951
- fields: I
1952
- }), H.then(({ error: q }) => {
1953
- q ? n(q) : 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();
1954
1989
  });
1955
1990
  }, [
1956
- b,
1957
- A,
1991
+ p,
1992
+ O,
1958
1993
  C,
1959
- s,
1994
+ n,
1960
1995
  x,
1961
1996
  J,
1962
1997
  F,
1963
- M,
1964
- N,
1965
- T,
1966
- g,
1967
- h,
1968
- c,
1969
- n
1998
+ I,
1999
+ q,
2000
+ L,
2001
+ j,
2002
+ m,
2003
+ d,
2004
+ t
1970
2005
  ]);
1971
2006
  se(() => {
1972
- d && d({
1973
- cancelButton: m,
1974
- saveButton: o ? !0 : m || !R || !B
2007
+ c && c({
2008
+ cancelButton: g,
2009
+ saveButton: o ? !0 : g || !A || !B
1975
2010
  });
1976
- }, [m, d, R, B, o]), se(() => {
1977
- r && r({
1978
- cancelButton: i,
2011
+ }, [g, c, A, B, o]), se(() => {
2012
+ l && l({
2013
+ cancelButton: r,
1979
2014
  saveButton: o ? () => {
1980
- } : Q
2015
+ } : Y
1981
2016
  });
1982
- }, [r, i, Q, o]);
1983
- const pe = (I, H) => {
1984
- const q = Re.find((oe) => oe.key === I);
1985
- if (!q) return;
1986
- const ee = q.multi ? (H ?? []).map(
1987
- (oe) => oe.id
1988
- ) : H ? [H.id] : [];
1989
- V((oe) => [...oe.filter((ue) => Object.values(j).flat().find((be) => be.id === ue) && !Object.keys(j).find(
1990
- (be) => j[be]?.some(
1991
- (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
1992
2027
  )
1993
- )), ...ee]);
2028
+ )), ...oe]);
1994
2029
  };
1995
2030
  return /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-2 gap-4 w-full", children: [
1996
2031
  /* @__PURE__ */ e.jsxs("div", { className: "col-span-2 lg:col-span-1 flex flex-col gap-4", children: [
1997
2032
  /* @__PURE__ */ e.jsxs(X, { children: [
1998
- /* @__PURE__ */ e.jsx(le, { children: "Name" }),
2033
+ /* @__PURE__ */ e.jsx(ce, { children: "Name" }),
1999
2034
  /* @__PURE__ */ e.jsx(
2000
- fe,
2035
+ je,
2001
2036
  {
2002
2037
  value: x,
2003
- onChange: (I) => S(I.target.value),
2038
+ onChange: (b) => M(b.target.value),
2004
2039
  type: "text",
2005
2040
  placeholder: "i.e. Lunge & Return",
2006
2041
  isDisabled: o
@@ -2008,12 +2043,12 @@ const Zt = ({
2008
2043
  )
2009
2044
  ] }),
2010
2045
  /* @__PURE__ */ e.jsxs(X, { children: [
2011
- /* @__PURE__ */ e.jsx(le, { children: "Camera Placement" }),
2046
+ /* @__PURE__ */ e.jsx(ce, { children: "Camera Placement" }),
2012
2047
  /* @__PURE__ */ e.jsx(
2013
- Ue,
2048
+ Be,
2014
2049
  {
2015
- value: M,
2016
- onChange: (I) => E(I.target.value),
2050
+ value: I,
2051
+ onChange: (b) => _(b.target.value),
2017
2052
  rows: 2,
2018
2053
  placeholder: "(optional) Describe camera setup, placement, angles",
2019
2054
  isDisabled: o
@@ -2021,12 +2056,12 @@ const Zt = ({
2021
2056
  )
2022
2057
  ] }),
2023
2058
  /* @__PURE__ */ e.jsxs(X, { children: [
2024
- /* @__PURE__ */ e.jsx(le, { children: "Video Link" }),
2059
+ /* @__PURE__ */ e.jsx(ce, { children: "Video Link" }),
2025
2060
  /* @__PURE__ */ e.jsx(
2026
- fe,
2061
+ je,
2027
2062
  {
2028
- value: N,
2029
- onChange: (I) => Y(I.target.value),
2063
+ value: q,
2064
+ onChange: (b) => N(b.target.value),
2030
2065
  type: "url",
2031
2066
  placeholder: "(optional) https://...",
2032
2067
  isDisabled: o
@@ -2034,12 +2069,12 @@ const Zt = ({
2034
2069
  )
2035
2070
  ] }),
2036
2071
  /* @__PURE__ */ e.jsxs(X, { children: [
2037
- /* @__PURE__ */ e.jsx(le, { children: "Description" }),
2072
+ /* @__PURE__ */ e.jsx(ce, { children: "Description" }),
2038
2073
  /* @__PURE__ */ e.jsx(
2039
- Ue,
2074
+ Be,
2040
2075
  {
2041
2076
  value: F,
2042
- onChange: (I) => _(I.target.value),
2077
+ onChange: (b) => z(b.target.value),
2043
2078
  rows: 2,
2044
2079
  placeholder: "(optional) Describe how to perform the test or exercise",
2045
2080
  isDisabled: o
@@ -2047,51 +2082,51 @@ const Zt = ({
2047
2082
  )
2048
2083
  ] }),
2049
2084
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
2050
- /* @__PURE__ */ e.jsx(le, { children: "Metadata Tags" }),
2051
- Re.map((I) => /* @__PURE__ */ e.jsxs(X, { children: [
2052
- /* @__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 }),
2053
2088
  /* @__PURE__ */ e.jsx(
2054
- ae,
2089
+ le,
2055
2090
  {
2056
- isMulti: I.multi,
2057
- value: j[I.key]?.filter(
2058
- (H) => T.includes(H.id)
2091
+ isMulti: b.multi,
2092
+ value: w[b.key]?.filter(
2093
+ (Q) => L.includes(Q.id)
2059
2094
  ),
2060
- onChange: (H) => {
2061
- pe(I.key, H);
2095
+ onChange: (Q) => {
2096
+ re(b.key, Q);
2062
2097
  },
2063
- options: j[I.key],
2064
- 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()}`,
2065
2100
  isDisabled: o,
2066
- isClearable: I.multi
2101
+ isClearable: b.multi
2067
2102
  }
2068
2103
  )
2069
- ] }, I.key))
2104
+ ] }, b.key))
2070
2105
  ] })
2071
2106
  ] }),
2072
2107
  /* @__PURE__ */ e.jsxs("div", { className: "col-span-2 lg:col-span-1 flex flex-col gap-4", children: [
2073
2108
  /* @__PURE__ */ e.jsxs(X, { children: [
2074
- /* @__PURE__ */ e.jsx(le, { children: "Sensor Locations" }),
2109
+ /* @__PURE__ */ e.jsx(ce, { children: "Sensor Locations" }),
2075
2110
  /* @__PURE__ */ e.jsx(
2076
- ae,
2111
+ le,
2077
2112
  {
2078
2113
  isMulti: !0,
2079
- value: f,
2080
- onChange: (I) => k([...I]),
2081
- options: bn,
2082
- isOptionDisabled: () => f.length >= jn,
2114
+ value: v,
2115
+ onChange: (b) => E([...b]),
2116
+ options: yn,
2117
+ isOptionDisabled: () => v.length >= vn,
2083
2118
  isDisabled: o
2084
2119
  }
2085
2120
  )
2086
2121
  ] }),
2087
2122
  /* @__PURE__ */ e.jsxs(X, { children: [
2088
- /* @__PURE__ */ e.jsx(le, { children: "Default Parameters" }),
2123
+ /* @__PURE__ */ e.jsx(ce, { children: "Default Parameters" }),
2089
2124
  /* @__PURE__ */ e.jsx(
2090
- fn,
2125
+ jn,
2091
2126
  {
2092
- options: t,
2093
- value: h,
2094
- onChange: w,
2127
+ options: i,
2128
+ value: m,
2129
+ onChange: a,
2095
2130
  editOnly: o
2096
2131
  }
2097
2132
  )
@@ -2100,19 +2135,19 @@ const Zt = ({
2100
2135
  /* @__PURE__ */ e.jsx(
2101
2136
  "div",
2102
2137
  {
2103
- className: Jt(
2138
+ className: Xt(
2104
2139
  "col-span-2 flex justify-end",
2105
2140
  (u || o) && "hidden"
2106
2141
  ),
2107
- children: /* @__PURE__ */ e.jsxs(xe, { mt: 16, gap: 4, children: [
2108
- /* @__PURE__ */ e.jsx(K, { 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" }),
2109
2144
  /* @__PURE__ */ e.jsx(
2110
2145
  K,
2111
2146
  {
2112
2147
  colorScheme: "blue",
2113
- isDisabled: m || !R || !B,
2114
- isLoading: m,
2115
- onClick: Q,
2148
+ isDisabled: g || !A || !B,
2149
+ isLoading: g,
2150
+ onClick: Y,
2116
2151
  children: "Save changes"
2117
2152
  }
2118
2153
  )
@@ -2120,102 +2155,102 @@ const Zt = ({
2120
2155
  }
2121
2156
  )
2122
2157
  ] });
2123
- }, le = ({ children: s }) => /* @__PURE__ */ e.jsx(Ye, { fontWeight: "bold", fontFamily: "sans-serif", fontSize: "large", children: s }), Pn = ({
2124
- id: s,
2125
- onCancel: n,
2126
- onSave: i,
2127
- 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,
2128
2163
  hideButtons: u,
2129
- quantumOwned: r,
2130
- setButtonOnClick: d,
2131
- setButtonDisabled: b
2164
+ quantumOwned: l,
2165
+ setButtonOnClick: c,
2166
+ setButtonDisabled: p
2132
2167
  }) => {
2133
- const [{ data: o }] = ce({
2134
- query: r ? Et : zt
2135
- }), [{ data: O }] = ce({
2168
+ const [{ data: o }] = de({
2169
+ query: l ? $t : zt
2170
+ }), [{ data: k }] = de({
2136
2171
  query: _t,
2137
- variables: { id: s },
2138
- pause: !s
2139
- }), [{ data: y }] = ce({
2172
+ variables: { id: n },
2173
+ pause: !n
2174
+ }), [{ data: S }] = de({
2140
2175
  query: Gt
2141
- }), A = z(
2142
- ve,
2143
- y?.moduleCategories
2144
- ), [{ fetching: p }, C] = re(rt), [{ fetching: a }, l] = re(it), m = z(
2145
- de,
2146
- r ? o?.quantumOwnedActions : o?.actions
2147
- ) ?? [], g = z(Se, O?.module), x = z(ot, g?.moduleActions) ?? [], [S, F] = P([
2148
- ...x.map((T) => T.actionId) ?? []
2149
- ]), [_, M] = P(g?.name ?? ""), [E, N] = P([]), [Y, f] = P(g?.description ?? "");
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 ?? "");
2150
2185
  se(() => {
2151
- g && (F(x.map((T) => T.actionId)), M(g.name), f(g.description ?? ""), N(
2152
- g.categories.map(
2153
- (T) => z(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
2154
2189
  ) ?? []
2155
2190
  ));
2156
- }, [g, x]);
2157
- const k = L(() => {
2158
- let T;
2191
+ }, [j, x]);
2192
+ const E = R(() => {
2193
+ let L;
2159
2194
  const V = {
2160
- actions: S,
2161
- name: _,
2162
- categories: E.filter((j) => j !== "other"),
2163
- description: Y,
2164
- quantumOwned: r
2195
+ actions: M,
2196
+ name: z,
2197
+ categories: _.filter((w) => w !== "other"),
2198
+ description: N,
2199
+ quantumOwned: l
2165
2200
  };
2166
- g ? T = C({
2167
- id: g.id,
2201
+ j ? L = C({
2202
+ id: j.id,
2168
2203
  input: V
2169
- }) : T = l({
2204
+ }) : L = s({
2170
2205
  input: V
2171
- }), T.then(({ error: j }) => {
2172
- j ? c(j) : i();
2206
+ }), L.then(({ error: w }) => {
2207
+ w ? d(w) : r();
2173
2208
  });
2174
2209
  }, [
2175
- l,
2210
+ s,
2176
2211
  C,
2177
- S,
2212
+ M,
2213
+ z,
2214
+ N,
2178
2215
  _,
2179
- Y,
2180
- E,
2181
- g,
2182
- i,
2183
- c,
2184
- r
2216
+ j,
2217
+ r,
2218
+ d,
2219
+ l
2185
2220
  ]);
2186
2221
  return se(() => {
2187
- b && b({
2188
- cancelButton: p || a,
2189
- saveButton: p || a || !_ || Y.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
2190
2225
  });
2191
- }, [b, p, a, S, _, Y]), se(() => {
2192
- d && d({
2193
- cancelButton: n,
2194
- saveButton: k
2226
+ }, [p, h, f, M, z, N]), se(() => {
2227
+ c && c({
2228
+ cancelButton: t,
2229
+ saveButton: E
2195
2230
  });
2196
- }, [d, n, k]), /* @__PURE__ */ e.jsxs(Z, { width: "100%", children: [
2231
+ }, [c, t, E]), /* @__PURE__ */ e.jsxs(Z, { width: "100%", children: [
2197
2232
  /* @__PURE__ */ e.jsx(
2198
- dn,
2233
+ un,
2199
2234
  {
2200
- name: _,
2201
- setName: M,
2202
- actions: m,
2203
- selectedActionIds: S,
2235
+ name: z,
2236
+ setName: I,
2237
+ actions: g,
2238
+ selectedActionIds: M,
2204
2239
  setSelectedActionIds: F,
2205
- availableCategories: A ?? [],
2206
- selectedCategoryIds: E,
2207
- setSelectedCategoryIds: N,
2208
- description: Y,
2209
- setDescription: f
2240
+ availableCategories: O ?? [],
2241
+ selectedCategoryIds: _,
2242
+ setSelectedCategoryIds: q,
2243
+ description: N,
2244
+ setDescription: v
2210
2245
  }
2211
2246
  ),
2212
- !u && /* @__PURE__ */ e.jsx(ne, { justifyContent: "flex-start", children: /* @__PURE__ */ e.jsxs(xe, { mt: 16, gap: 4, children: [
2247
+ !u && /* @__PURE__ */ e.jsx(ne, { justifyContent: "flex-start", children: /* @__PURE__ */ e.jsxs(fe, { mt: 16, gap: 4, children: [
2213
2248
  /* @__PURE__ */ e.jsx(
2214
2249
  K,
2215
2250
  {
2216
2251
  colorScheme: "gray",
2217
- isDisabled: p || a,
2218
- onClick: n,
2252
+ isDisabled: h || f,
2253
+ onClick: t,
2219
2254
  children: "Cancel"
2220
2255
  }
2221
2256
  ),
@@ -2223,9 +2258,9 @@ const Zt = ({
2223
2258
  K,
2224
2259
  {
2225
2260
  colorScheme: "blue",
2226
- isDisabled: p || a || !_ || Y.trim().split(/\s+/).filter(Boolean).length > 40,
2227
- isLoading: p || a,
2228
- onClick: k,
2261
+ isDisabled: h || f || !z || N.trim().split(/\s+/).filter(Boolean).length > 40,
2262
+ isLoading: h || f,
2263
+ onClick: E,
2229
2264
  children: "Save"
2230
2265
  }
2231
2266
  )
@@ -2233,12 +2268,12 @@ const Zt = ({
2233
2268
  ] });
2234
2269
  };
2235
2270
  export {
2236
- cn as ActivityList,
2237
- zn as CopyActivityForm,
2238
- _n as CopyModuleForm,
2239
- dn as ModuleForm,
2240
- gn as ParameterEditList,
2241
- fn as ParameterEditSelect,
2242
- Gn as UpsertActivityForm,
2243
- Pn as UpsertModuleForm
2271
+ dn as ActivityList,
2272
+ _n as CopyActivityForm,
2273
+ Gn as CopyModuleForm,
2274
+ un as ModuleForm,
2275
+ xn as ParameterEditList,
2276
+ jn as ParameterEditSelect,
2277
+ Pn as UpsertActivityForm,
2278
+ Wn as UpsertModuleForm
2244
2279
  };