quantum-component-library 1.4.47-dev.9 → 1.4.48-dev.0

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