quantum-component-library 1.4.47-dev.11 → 1.4.47-dev.3

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