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