quantum-component-library 1.4.48-dev.4 → 1.4.48-dev.6

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