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