quantum-component-library 1.4.51-dev.2 → 1.4.51-dev.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
1
  import { j as e } from "./react-jsx-runtime-vendor-OVHDjVDe.js";
2
2
  import "./moment-vendor-DMLRxgRE.js";
3
- import { Flex as we, InputGroup as at, InputLeftElement as $t, Icon as bt, Input as Le, FormLabel as Xe, ButtonGroup as Me, Tooltip as tt, Button as se, Box as te, RangeSlider as Ft, RangeSliderMark as et, Text as C, RangeSliderTrack as Dt, RangeSliderFilledTrack as Pt, RangeSliderThumb as it, Select as lt, NumberInput as ct, NumberInputField as dt, HStack as re, Tag as Ne, FormControl as X, TableContainer as Gt, Table as Et, Thead as _t, Tr as ut, Th as Re, Tbody as zt, Td as _e, Image as Bt, useToast as yt, VStack as le, RadioGroup as vt, Radio as Ye, Alert as He, AlertIcon as Je, Spinner as Ct, useDisclosure as Wt, Modal as Ut, ModalOverlay as Qt, ModalContent as qt, ModalHeader as Kt, ModalCloseButton as Yt, ModalBody as Ht, ModalFooter as Jt, Badge as wt, IconButton as Xt, Tabs as Zt, TabList as Vt, Tab as mt, TabPanels as en, TabPanel as ht, Textarea as ze } from "@chakra-ui/react";
4
- import { useMemo as k, useState as B, useEffect as ie, useCallback as G, createContext as tn, useContext as nn, memo as Se, useRef as sn } from "react";
5
- import { getFragmentData as S } from "./generated.js";
3
+ import { Flex as we, InputGroup as at, InputLeftElement as $t, Icon as bt, Input as Le, FormLabel as Xe, ButtonGroup as Me, Tooltip as tt, Button as se, Box as te, RangeSlider as Ft, RangeSliderMark as et, Text as C, RangeSliderTrack as Dt, RangeSliderFilledTrack as Gt, RangeSliderThumb as it, Select as lt, NumberInput as ct, NumberInputField as dt, HStack as re, Tag as Ne, FormControl as X, TableContainer as Pt, Table as Et, Thead as _t, Tr as ut, Th as Re, Tbody as zt, Td as _e, Image as Bt, useToast as yt, VStack as le, RadioGroup as vt, Radio as Ye, Alert as He, AlertIcon as Je, Spinner as Ct, useDisclosure as Wt, Modal as Ut, ModalOverlay as Qt, ModalContent as qt, ModalHeader as Kt, ModalCloseButton as Yt, ModalBody as Ht, ModalFooter as Jt, Badge as wt, IconButton as Xt, Tabs as Zt, TabList as Vt, Tab as mt, TabPanels as en, TabPanel as ht, Textarea as ze } from "@chakra-ui/react";
4
+ import { useMemo as k, useState as B, useEffect as ie, useCallback as P, createContext as tn, useContext as nn, memo as Se, useRef as sn } from "react";
5
+ import { getFragmentData as L } from "./generated.js";
6
6
  import { G as nt, M as je, a as be, b as St, c as rn, C as st, d as Lt, e as It, R as Ze, f as $e, T as Ie, A as ve, g as on, h as Mt, U as Ot, i as Qe, j as At, k as an, l as ln, m as cn, n as dn, o as un, p as mn } from "./graphql-B-0IK2pU.js";
7
7
  import { c as qe } from "./utils-cn-CgdSr4hO.js";
8
8
  import "./lodash-vendor-B-xpwrnm.js";
@@ -19,12 +19,12 @@ const Mn = ({
19
19
  setSearch: r,
20
20
  actions: n,
21
21
  updateUseCases: a,
22
- hideUseCaseFilter: m = !1
22
+ hideUseCaseFilter: p = !1
23
23
  }) => {
24
- const g = k(
25
- () => n?.flatMap((u) => u.useCases).filter((u, h, p) => p.findIndex((s) => s.id === u.id) === h).map((u) => ({
26
- label: u.name,
27
- value: u.id
24
+ const x = k(
25
+ () => n?.flatMap((d) => d.useCases).filter((d, u, h) => h.findIndex((s) => s.id === d.id) === u).map((d) => ({
26
+ label: d.name,
27
+ value: d.id
28
28
  })) || [],
29
29
  [n]
30
30
  );
@@ -36,26 +36,26 @@ const Mn = ({
36
36
  {
37
37
  placeholder: "Search by name...",
38
38
  width: "100%",
39
- maxW: m ? void 0 : "30rem",
40
- onChange: (u) => r(u.target.value)
39
+ maxW: p ? void 0 : "30rem",
40
+ onChange: (d) => r(d.target.value)
41
41
  }
42
42
  )
43
43
  ] }),
44
- !m && /* @__PURE__ */ e.jsx(at, { size: "md", children: /* @__PURE__ */ e.jsx(
44
+ !p && /* @__PURE__ */ e.jsx(at, { size: "md", children: /* @__PURE__ */ e.jsx(
45
45
  ue,
46
46
  {
47
47
  size: "md",
48
48
  chakraStyles: {
49
- container: (u) => ({
50
- ...u,
49
+ container: (d) => ({
50
+ ...d,
51
51
  width: "100%"
52
52
  })
53
53
  },
54
54
  menuPortalTarget: document.body,
55
55
  placeholder: "Filter use case",
56
56
  isMulti: !0,
57
- options: g,
58
- onChange: (u) => a(u.map((h) => h.value))
57
+ options: x,
58
+ onChange: (d) => a(d.map((u) => u.value))
59
59
  }
60
60
  ) })
61
61
  ] });
@@ -65,12 +65,12 @@ const Mn = ({
65
65
  items: r,
66
66
  onChange: n,
67
67
  selectedItem: a,
68
- isDisabled: m,
69
- selectedProps: g,
70
- buttonProps: u
68
+ isDisabled: p,
69
+ selectedProps: x,
70
+ buttonProps: d
71
71
  }) => {
72
- const h = (s) => s === a || s.value === a, p = (s) => h(s) ? { ...u, ...g } : u;
73
- return /* @__PURE__ */ e.jsx(Me, { isAttached: !0, isDisabled: m, children: r.map((s, i) => /* @__PURE__ */ e.jsx(
72
+ const u = (s) => s === a || s.value === a, h = (s) => u(s) ? { ...d, ...x } : d;
73
+ return /* @__PURE__ */ e.jsx(Me, { isAttached: !0, isDisabled: p, children: r.map((s, i) => /* @__PURE__ */ e.jsx(
74
74
  tt,
75
75
  {
76
76
  label: s.tooltip,
@@ -82,9 +82,9 @@ const Mn = ({
82
82
  children: /* @__PURE__ */ e.jsx(
83
83
  se,
84
84
  {
85
- onClick: () => h(s) ? null : n(s, i),
85
+ onClick: () => u(s) ? null : n(s, i),
86
86
  isDisabled: s.disabled,
87
- ...p(s),
87
+ ...h(s),
88
88
  children: s.label
89
89
  }
90
90
  )
@@ -95,62 +95,62 @@ const Mn = ({
95
95
  isReversed: r,
96
96
  min: n,
97
97
  max: a,
98
- value: m,
99
- onChange: g,
100
- inputProps: u,
101
- size: h,
102
- zeroMarker: p,
98
+ value: p,
99
+ onChange: x,
100
+ inputProps: d,
101
+ size: u,
102
+ zeroMarker: h,
103
103
  formatValue: s,
104
104
  valueLabel: i,
105
- positiveNegativeLabels: x,
106
- isDisabled: M,
107
- ...w
105
+ positiveNegativeLabels: g,
106
+ isDisabled: w,
107
+ ...S
108
108
  }) => {
109
- const [I, L] = B([void 0, void 0]), y = I[0], c = I[1], d = p && n < -5 && a > 5, v = Number(m?.[0] ?? c ?? n) > 0 ? 1 : -1, j = Number(m?.[1] ?? c ?? a) < 0 ? -1 : 1, O = x?.[0] === x?.[1], $ = m?.[0], F = m?.[1];
109
+ const [M, I] = B([void 0, void 0]), y = M[0], c = M[1], m = h && n < -5 && a > 5, v = Number(p?.[0] ?? c ?? n) > 0 ? 1 : -1, j = Number(p?.[1] ?? c ?? a) < 0 ? -1 : 1, A = g?.[0] === g?.[1], $ = p?.[0], F = p?.[1];
110
110
  ie(() => {
111
- $ !== void 0 && F !== void 0 && L([$.toFixed(0), F.toFixed(0)]);
112
- }, [$, F, L]);
113
- const A = G(
111
+ $ !== void 0 && F !== void 0 && I([$.toFixed(0), F.toFixed(0)]);
112
+ }, [$, F, I]);
113
+ const O = P(
114
114
  ([T, _]) => {
115
- T < _ && L([T.toFixed(0), _.toFixed(0)]);
115
+ T < _ && I([T.toFixed(0), _.toFixed(0)]);
116
116
  },
117
- [L]
118
- ), N = G(
117
+ [I]
118
+ ), N = P(
119
119
  ([T, _]) => {
120
- T < _ && g([T, _]);
120
+ T < _ && x([T, _]);
121
121
  },
122
- [g]
123
- ), H = G(() => {
124
- L(([T, _]) => {
122
+ [x]
123
+ ), H = P(() => {
124
+ I(([T, _]) => {
125
125
  const J = isNaN(Number(T)) ? n : Number(T), W = isNaN(Number(_)) ? a : Number(_), K = We(Number(J), v), l = We(Number(W), j), t = v < 0 ? Math.max(K, n) : Math.min(K, a), o = j < 0 ? Math.max(l, n) : Math.min(l, a);
126
- return t > o ? (g([o, t]), [o.toFixed(0), t.toFixed(0)]) : (g([t, o]), [t.toFixed(0), o.toFixed(0)]);
126
+ return t > o ? (x([o, t]), [o.toFixed(0), t.toFixed(0)]) : (x([t, o]), [t.toFixed(0), o.toFixed(0)]);
127
127
  });
128
- }, [g, L, v, j, n, a]), oe = G(
128
+ }, [x, I, v, j, n, a]), oe = P(
129
129
  (T) => {
130
130
  const _ = T === "" || isNaN(Number(T)) ? T : We(Number(T), v);
131
- L(([J, W]) => [_.toString(), W]);
131
+ I(([J, W]) => [_.toString(), W]);
132
132
  },
133
- [L, v]
134
- ), R = G(
133
+ [I, v]
134
+ ), R = P(
135
135
  (T) => {
136
136
  const _ = T === "" || isNaN(Number(T)) ? T : We(Number(T), j);
137
- L(([J, W]) => [J, _.toString()]);
137
+ I(([J, W]) => [J, _.toString()]);
138
138
  },
139
- [L, j]
139
+ [I, j]
140
140
  ), Z = k(
141
- () => h === "xs" ? "0.75rem" : void 0,
142
- [h]
143
- ), V = G(
141
+ () => u === "xs" ? "0.75rem" : void 0,
142
+ [u]
143
+ ), V = P(
144
144
  (T, _) => {
145
145
  const J = Number(_.target.value);
146
146
  if (!y || !c || ![-1, 1].includes(J))
147
147
  return;
148
148
  const W = (t) => J < 0 ? -1 * Math.abs(t) : Math.abs(t), K = T ? W(Number(y)) : Number(y), l = T ? Number(c) : W(Number(c));
149
- K > l ? g([l, K]) : g([K, l]);
149
+ K > l ? x([l, K]) : x([K, l]);
150
150
  },
151
- [y, c, g]
151
+ [y, c, x]
152
152
  );
153
- return /* @__PURE__ */ e.jsxs(we, { direction: "column", ...w, children: [
153
+ return /* @__PURE__ */ e.jsxs(we, { direction: "column", ...S, children: [
154
154
  /* @__PURE__ */ e.jsx(te, { pt: "1em", mb: "-0.5em", children: /* @__PURE__ */ e.jsxs(
155
155
  Ft,
156
156
  {
@@ -161,14 +161,14 @@ const Mn = ({
161
161
  min: n,
162
162
  minStepsBetweenThumbs: 3,
163
163
  step: 1,
164
- onChange: A,
164
+ onChange: O,
165
165
  onChangeEnd: N,
166
- isDisabled: M,
166
+ isDisabled: w,
167
167
  children: [
168
168
  /* @__PURE__ */ e.jsx(et, { value: n, top: "-1em", children: /* @__PURE__ */ e.jsx(
169
169
  C,
170
170
  {
171
- fontSize: h ?? "sm",
171
+ fontSize: u ?? "sm",
172
172
  fontWeight: "semibold",
173
173
  whiteSpace: "nowrap",
174
174
  children: s ? s?.(n) : n
@@ -177,15 +177,15 @@ const Mn = ({
177
177
  /* @__PURE__ */ e.jsx(et, { value: a, top: "-1em", children: /* @__PURE__ */ e.jsx(
178
178
  C,
179
179
  {
180
- fontSize: h ?? "sm",
180
+ fontSize: u ?? "sm",
181
181
  fontWeight: "semibold",
182
182
  style: { transform: "translateX(-100%)" },
183
183
  whiteSpace: "nowrap",
184
184
  children: s ? s(a) : a
185
185
  }
186
186
  ) }),
187
- d && /* @__PURE__ */ e.jsxs(et, { value: 0, top: "-1em", pos: "relative", children: [
188
- /* @__PURE__ */ e.jsx(C, { fontSize: h, fontWeight: "semibold", children: s?.(0) ?? "0" }),
187
+ m && /* @__PURE__ */ e.jsxs(et, { value: 0, top: "-1em", pos: "relative", children: [
188
+ /* @__PURE__ */ e.jsx(C, { fontSize: u, fontWeight: "semibold", children: s?.(0) ?? "0" }),
189
189
  /* @__PURE__ */ e.jsx(
190
190
  te,
191
191
  {
@@ -198,7 +198,7 @@ const Mn = ({
198
198
  }
199
199
  )
200
200
  ] }),
201
- /* @__PURE__ */ e.jsx(Dt, { children: /* @__PURE__ */ e.jsx(Pt, {}) }),
201
+ /* @__PURE__ */ e.jsx(Dt, { children: /* @__PURE__ */ e.jsx(Gt, {}) }),
202
202
  /* @__PURE__ */ e.jsx(it, { index: 0, w: Z, h: Z }),
203
203
  /* @__PURE__ */ e.jsx(it, { index: 1, w: Z, h: Z })
204
204
  ]
@@ -213,7 +213,7 @@ const Mn = ({
213
213
  /* @__PURE__ */ e.jsx(
214
214
  C,
215
215
  {
216
- fontSize: h ?? "sm",
216
+ fontSize: u ?? "sm",
217
217
  fontWeight: "semibold",
218
218
  whiteSpace: "nowrap",
219
219
  children: i(n)
@@ -222,7 +222,7 @@ const Mn = ({
222
222
  /* @__PURE__ */ e.jsx(
223
223
  C,
224
224
  {
225
- fontSize: h ?? "sm",
225
+ fontSize: u ?? "sm",
226
226
  fontWeight: "semibold",
227
227
  whiteSpace: "nowrap",
228
228
  children: i(a)
@@ -239,18 +239,18 @@ const Mn = ({
239
239
  alignItems: "center",
240
240
  gap: "0.125em",
241
241
  children: [
242
- x && /* @__PURE__ */ e.jsxs(
242
+ g && /* @__PURE__ */ e.jsxs(
243
243
  lt,
244
244
  {
245
245
  width: "auto",
246
- size: h,
246
+ size: u,
247
247
  fontWeight: "bold",
248
248
  value: v,
249
249
  onChange: (T) => V(!0, T),
250
- isDisabled: O || M,
250
+ isDisabled: A || w,
251
251
  children: [
252
- /* @__PURE__ */ e.jsx("option", { value: -1, children: x[0] }),
253
- /* @__PURE__ */ e.jsx("option", { value: 1, children: x[1] })
252
+ /* @__PURE__ */ e.jsx("option", { value: -1, children: g[0] }),
253
+ /* @__PURE__ */ e.jsx("option", { value: 1, children: g[1] })
254
254
  ]
255
255
  }
256
256
  ),
@@ -258,7 +258,7 @@ const Mn = ({
258
258
  ct,
259
259
  {
260
260
  precision: 0,
261
- size: h ?? "sm",
261
+ size: u ?? "sm",
262
262
  min: 0,
263
263
  max: v < 0 ? Math.abs(n) : F ?? a,
264
264
  value: y === "" ? "" : Math.abs(Number(y ?? n)),
@@ -267,8 +267,8 @@ const Mn = ({
267
267
  borderWidth: 1,
268
268
  borderRadius: 3,
269
269
  borderColor: "#ccc",
270
- isDisabled: M,
271
- ...u,
270
+ isDisabled: w,
271
+ ...d,
272
272
  children: /* @__PURE__ */ e.jsx(
273
273
  dt,
274
274
  {
@@ -282,7 +282,7 @@ const Mn = ({
282
282
  /* @__PURE__ */ e.jsx(
283
283
  ct,
284
284
  {
285
- size: h ?? "sm",
285
+ size: u ?? "sm",
286
286
  min: 0,
287
287
  max: j < 0 ? Math.abs($ ?? n) : a,
288
288
  precision: 0,
@@ -292,8 +292,8 @@ const Mn = ({
292
292
  borderWidth: 1,
293
293
  borderRadius: 3,
294
294
  borderColor: "#ccc",
295
- isDisabled: M,
296
- ...u,
295
+ isDisabled: w,
296
+ ...d,
297
297
  children: /* @__PURE__ */ e.jsx(
298
298
  dt,
299
299
  {
@@ -304,18 +304,18 @@ const Mn = ({
304
304
  )
305
305
  }
306
306
  ),
307
- x && /* @__PURE__ */ e.jsxs(
307
+ g && /* @__PURE__ */ e.jsxs(
308
308
  lt,
309
309
  {
310
310
  width: "auto",
311
- size: h,
311
+ size: u,
312
312
  fontWeight: "bold",
313
313
  value: j,
314
314
  onChange: (T) => V(!1, T),
315
- isDisabled: O || M,
315
+ isDisabled: A || w,
316
316
  children: [
317
- /* @__PURE__ */ e.jsx("option", { value: -1, children: x[0] }),
318
- /* @__PURE__ */ e.jsx("option", { value: 1, children: x[1] })
317
+ /* @__PURE__ */ e.jsx("option", { value: -1, children: g[0] }),
318
+ /* @__PURE__ */ e.jsx("option", { value: 1, children: g[1] })
319
319
  ]
320
320
  }
321
321
  )
@@ -323,17 +323,17 @@ const Mn = ({
323
323
  }
324
324
  )
325
325
  ] });
326
- }, kn = ({ tags: r, containerProps: n, ...a }) => /* @__PURE__ */ e.jsx(re, { ...n, children: r.map((m, g) => /* @__PURE__ */ e.jsx(Ne, { ...a, children: m }, g)) }), Tn = new pn({}), Rn = ({
326
+ }, kn = ({ tags: r, containerProps: n, ...a }) => /* @__PURE__ */ e.jsx(re, { ...n, children: r.map((p, x) => /* @__PURE__ */ e.jsx(Ne, { ...a, children: p }, x)) }), Tn = new pn({}), Rn = ({
327
327
  action: r,
328
328
  quantumIconSrc: n
329
329
  }) => {
330
- const { getLabel: a } = pe(), m = k(() => ({
330
+ const { getLabel: a } = pe(), p = k(() => ({
331
331
  actionLowerCase: a("action").toLocaleLowerCase()
332
332
  }), [a]);
333
333
  return r.quantumOwned ? /* @__PURE__ */ e.jsx(
334
334
  tt,
335
335
  {
336
- label: `This ${m.actionLowerCase} is owned by Quantum`,
336
+ label: `This ${p.actionLowerCase} is owned by Quantum`,
337
337
  "aria-label": "Quantum owned",
338
338
  children: /* @__PURE__ */ e.jsx(
339
339
  te,
@@ -349,7 +349,7 @@ const Mn = ({
349
349
  {
350
350
  src: n,
351
351
  boxSize: "1em",
352
- alt: `Quantum-owned ${m.actionLowerCase}`
352
+ alt: `Quantum-owned ${p.actionLowerCase}`
353
353
  }
354
354
  )
355
355
  }
@@ -359,46 +359,60 @@ const Mn = ({
359
359
  }, Nn = (r, n) => {
360
360
  if (!n || !n.trim().length)
361
361
  return r;
362
- const a = r.map((g) => g.name ?? "");
363
- return Tn.filter(a, n)?.map((g) => r[g]) ?? [];
362
+ const a = r.map((x) => x.name ?? "");
363
+ return Tn.filter(a, n)?.map((x) => r[x]) ?? [];
364
364
  }, $n = (r) => !r || r.length === 0 ? "None" : r.map(
365
365
  (n) => (
366
366
  // Convert camelCase to separate words (e.g., 'LeftFoot' -> 'Left Foot')
367
367
  n.replace(/([A-Z])/g, " $1").trim()
368
368
  )
369
369
  ).join(", "), Fn = (r, n) => !n || n.length == 0 ? r : r.filter(
370
- (a) => a.useCases?.some((m) => n.includes(m.id)) ?? !1
371
- ), Dn = (r, n) => !n || n.length === 0 ? r : r.filter((a) => {
372
- const m = a.metadataGroups?.flatMap((g) => {
373
- const u = S(je, g);
374
- return S(
375
- be,
376
- u.data
377
- ).map((p) => p.id);
378
- }) ?? [];
379
- return n.every(
380
- (g) => m.includes(g)
370
+ (a) => a.useCases?.some((p) => n.includes(p.id)) ?? !1
371
+ ), Dn = (r, n, a) => !n || n.length === 0 ? r : r.filter((p) => {
372
+ const x = {};
373
+ return n.forEach((d) => {
374
+ for (const [u, h] of Object.entries(a || {}))
375
+ if (h.some((s) => s.id === d)) {
376
+ x[u] || (x[u] = []), x[u].push(d);
377
+ break;
378
+ }
379
+ }), Object.entries(x).every(
380
+ ([d, u]) => {
381
+ const h = p.metadataGroups?.find((w) => L(je, w).key === d);
382
+ if (!h)
383
+ return !1;
384
+ const s = L(
385
+ je,
386
+ h
387
+ ), g = L(
388
+ be,
389
+ s.data
390
+ ).map((w) => w.id);
391
+ return u.some(
392
+ (w) => g.includes(w)
393
+ );
394
+ }
381
395
  );
382
- }), Pn = ({
396
+ }), Gn = ({
383
397
  actions: r,
384
398
  totalActions: n,
385
399
  onCreate: a,
386
- onDelete: m,
387
- onEdit: g,
388
- onView: u,
389
- onSelected: h,
390
- onDuplicate: p,
400
+ onDelete: p,
401
+ onEdit: x,
402
+ onView: d,
403
+ onSelected: u,
404
+ onDuplicate: h,
391
405
  disableMultiSelect: s,
392
406
  disableDelete: i,
393
- disableEdit: x,
394
- disableCreate: M,
395
- hideUseCase: w = !0,
396
- showMetadataFilters: I = !0,
397
- tableProps: L,
407
+ disableEdit: g,
408
+ disableCreate: w,
409
+ hideUseCase: S = !0,
410
+ showMetadataFilters: M = !0,
411
+ tableProps: I,
398
412
  containerProps: y,
399
413
  quantumIconSrc: c = "/favicon.ico"
400
414
  }) => {
401
- const [d, v] = B(""), [j, O] = B(), [$, F] = B([]), [A, N] = B({}), { getLabel: H } = pe(), oe = rt(), R = k(() => ({
415
+ const [m, v] = B(""), [j, A] = B(), [$, F] = B([]), [O, N] = B({}), { getLabel: H } = pe(), oe = rt(), R = k(() => ({
402
416
  action: H("action"),
403
417
  actionPlural: H("action_plural"),
404
418
  actionLowerCase: H("action").toLocaleLowerCase(),
@@ -411,7 +425,7 @@ const Mn = ({
411
425
  { key: "sport", label: "Sport", multi: !0 }
412
426
  ], [R.action]);
413
427
  ie(() => {
414
- if (!I)
428
+ if (!M)
415
429
  return;
416
430
  const t = Z.map(
417
431
  (o) => oe.query(nt, { key: o.key })
@@ -420,10 +434,10 @@ const Mn = ({
420
434
  const b = {};
421
435
  o.forEach((U) => {
422
436
  if (U.error || !U.data) return;
423
- const q = S(
437
+ const q = L(
424
438
  je,
425
439
  U.data.getMetadataByKey
426
- ), E = S(
440
+ ), E = L(
427
441
  be,
428
442
  q.data
429
443
  );
@@ -434,51 +448,56 @@ const Mn = ({
434
448
  }));
435
449
  }), N(b);
436
450
  });
437
- }, [oe, Z, I]);
451
+ }, [oe, Z, M]);
438
452
  const V = k(() => {
439
453
  if (!r)
440
454
  return;
441
- const t = Nn(r, d), o = w ? t : Fn(t, j);
442
- return I ? Dn(o, $) : o;
455
+ const t = Nn(r, m), o = S ? t : Fn(t, j);
456
+ return M ? Dn(
457
+ o,
458
+ $,
459
+ O
460
+ ) : o;
443
461
  }, [
444
462
  r,
445
- d,
463
+ m,
446
464
  j,
447
- w,
448
- I,
449
- $
450
- ]), T = G(() => {
451
- if (!m)
465
+ S,
466
+ M,
467
+ $,
468
+ O
469
+ ]), T = P(() => {
470
+ if (!p)
452
471
  return;
453
472
  const o = r.filter(
454
473
  (b) => b.selected && !b.quantumOwned
455
474
  ).map((b) => b.id);
456
- m(o);
457
- }, [r, m]), _ = G(() => {
458
- if (!p)
475
+ p(o);
476
+ }, [r, p]), _ = P(() => {
477
+ if (!h)
459
478
  return;
460
479
  const t = r.filter((o) => o.selected);
461
- p(t.map((o) => o.id)), h && t.forEach((o) => h(o, !1));
462
- }, [r, p, h]), J = k(() => r.some((t) => t.selected && !t.quantumOwned), [r]), W = k(() => r.some((t) => t.selected), [r]), K = k(() => r.some((t) => t.selected && t.quantumOwned), [r]), l = G(
480
+ h(t.map((o) => o.id)), u && t.forEach((o) => u(o, !1));
481
+ }, [r, h, u]), J = k(() => r.some((t) => t.selected && !t.quantumOwned), [r]), W = k(() => r.some((t) => t.selected), [r]), K = k(() => r.some((t) => t.selected && t.quantumOwned), [r]), l = P(
463
482
  (t, o) => {
464
483
  const b = Z.find((q) => q.key === t);
465
484
  if (!b) return;
466
485
  const U = b.multi ? (o ?? []).map((q) => q.id) : o ? [o.id] : [];
467
- F((q) => [...q.filter((D) => Object.values(A).flat().find((ge) => ge.id === D) && !Object.keys(A).find(
468
- (ge) => A[ge]?.some(
486
+ F((q) => [...q.filter((D) => Object.values(O).flat().find((ge) => ge.id === D) && !Object.keys(O).find(
487
+ (ge) => O[ge]?.some(
469
488
  (ye) => ye.id === D && ge === t
470
489
  )
471
490
  )), ...U]);
472
491
  },
473
- [Z, A]
492
+ [Z, O]
474
493
  );
475
494
  return /* @__PURE__ */ e.jsxs(te, { ...y, children: [
476
495
  /* @__PURE__ */ e.jsxs(we, { alignContent: "space-between", gap: 4, children: [
477
- (a || m || p) && /* @__PURE__ */ e.jsxs(Me, { mb: "1rem", gap: 4, children: [
496
+ (a || p || h) && /* @__PURE__ */ e.jsxs(Me, { mb: "1rem", gap: 4, children: [
478
497
  a && /* @__PURE__ */ e.jsxs(
479
498
  se,
480
499
  {
481
- isDisabled: !a || M,
500
+ isDisabled: !a || w,
482
501
  colorScheme: "blackAlpha",
483
502
  backgroundColor: "gray.700",
484
503
  onClick: a,
@@ -488,7 +507,7 @@ const Mn = ({
488
507
  ]
489
508
  }
490
509
  ),
491
- m && !s && /* @__PURE__ */ e.jsx(
510
+ p && !s && /* @__PURE__ */ e.jsx(
492
511
  tt,
493
512
  {
494
513
  label: K ? J ? `Quantum-owned ${R.actionPluralLowerCase} are selected and will be skipped` : `Selected ${R.actionPluralLowerCase} are quantum-owned and cannot be deleted` : void 0,
@@ -497,14 +516,14 @@ const Mn = ({
497
516
  se,
498
517
  {
499
518
  colorScheme: "gray",
500
- isDisabled: !J || !m || i,
519
+ isDisabled: !J || !p || i,
501
520
  onClick: T,
502
521
  children: "Delete Selected"
503
522
  }
504
523
  )
505
524
  }
506
525
  ),
507
- p && !s && /* @__PURE__ */ e.jsx(
526
+ h && !s && /* @__PURE__ */ e.jsx(
508
527
  se,
509
528
  {
510
529
  colorScheme: "gray",
@@ -519,12 +538,12 @@ const Mn = ({
519
538
  {
520
539
  setSearch: v,
521
540
  actions: r,
522
- updateUseCases: O,
523
- hideUseCaseFilter: w
541
+ updateUseCases: A,
542
+ hideUseCaseFilter: S
524
543
  }
525
544
  )
526
545
  ] }),
527
- I && A && /* @__PURE__ */ e.jsx(te, { mb: 4, children: /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4", children: Z.map((t) => /* @__PURE__ */ e.jsxs(X, { children: [
546
+ M && O && /* @__PURE__ */ e.jsx(te, { my: 4, children: /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4", children: Z.map((t) => /* @__PURE__ */ e.jsxs(X, { children: [
528
547
  /* @__PURE__ */ e.jsx(Xe, { fontSize: "sm", children: t.label }),
529
548
  /* @__PURE__ */ e.jsx(
530
549
  ue,
@@ -536,7 +555,7 @@ const Mn = ({
536
555
  })
537
556
  },
538
557
  isMulti: t.multi,
539
- value: A[t.key]?.filter(
558
+ value: O[t.key]?.filter(
540
559
  (o) => $.includes(o.id)
541
560
  ),
542
561
  onChange: (o) => {
@@ -545,13 +564,13 @@ const Mn = ({
545
564
  o
546
565
  );
547
566
  },
548
- options: A[t.key],
567
+ options: O[t.key],
549
568
  placeholder: `Select ${t.multi ? "one or more" : "one"} ${t.label.toLowerCase()}`,
550
569
  isClearable: t.multi
551
570
  }
552
571
  )
553
572
  ] }, t.key)) }) }),
554
- /* @__PURE__ */ e.jsx(Gt, { mr: "2rem", overflowX: "hidden", ...L, children: /* @__PURE__ */ e.jsxs(Et, { size: "md", variant: "simple", children: [
573
+ /* @__PURE__ */ e.jsx(Pt, { mr: "2rem", overflowX: "hidden", ...I, children: /* @__PURE__ */ e.jsxs(Et, { size: "md", variant: "simple", children: [
555
574
  /* @__PURE__ */ e.jsx(_t, { position: "sticky", top: 0, bg: "white", zIndex: 1, children: /* @__PURE__ */ e.jsxs(ut, { children: [
556
575
  /* @__PURE__ */ e.jsxs(Re, { fontWeight: "normal", children: [
557
576
  "(showing ",
@@ -563,7 +582,7 @@ const Mn = ({
563
582
  ] }),
564
583
  /* @__PURE__ */ e.jsx(Re, { children: "Name" }),
565
584
  /* @__PURE__ */ e.jsx(Re, { children: "Sensor Locations" }),
566
- !w && /* @__PURE__ */ e.jsx(Re, { children: "Use Case" }),
585
+ !S && /* @__PURE__ */ e.jsx(Re, { children: "Use Case" }),
567
586
  /* @__PURE__ */ e.jsx(Re, {})
568
587
  ] }) }),
569
588
  /* @__PURE__ */ e.jsx(zt, { children: V?.map((t) => /* @__PURE__ */ e.jsxs(
@@ -575,12 +594,12 @@ const Mn = ({
575
594
  t.selected && "bg-gray-200"
576
595
  ),
577
596
  onClick: () => {
578
- s || h?.(t, !t.selected);
597
+ s || u?.(t, !t.selected);
579
598
  },
580
599
  children: [
581
600
  /* @__PURE__ */ e.jsx(_e, { children: /* @__PURE__ */ e.jsxs(we, { children: [
582
601
  !s && /* @__PURE__ */ e.jsx(e.Fragment, { children: t.selected ? /* @__PURE__ */ e.jsx(xn, { className: "text-blue-500" }) : /* @__PURE__ */ e.jsx(fn, { className: "text-gray-400" }) }),
583
- (t.quantumOwned || !g) && u && /* @__PURE__ */ e.jsx(
602
+ (t.quantumOwned || !x) && d && /* @__PURE__ */ e.jsx(
584
603
  se,
585
604
  {
586
605
  ml: "1em",
@@ -588,21 +607,21 @@ const Mn = ({
588
607
  variant: "link",
589
608
  colorScheme: "blue",
590
609
  onClick: (o) => {
591
- o.stopPropagation(), u(t.id);
610
+ o.stopPropagation(), d(t.id);
592
611
  },
593
612
  children: "View"
594
613
  }
595
614
  ),
596
- !t.quantumOwned && g && /* @__PURE__ */ e.jsx(
615
+ !t.quantumOwned && x && /* @__PURE__ */ e.jsx(
597
616
  se,
598
617
  {
599
- isDisabled: x,
618
+ isDisabled: g,
600
619
  ml: "1em",
601
620
  size: "sm",
602
621
  variant: "link",
603
622
  colorScheme: "blue",
604
623
  onClick: (o) => {
605
- o.stopPropagation(), g(t.id);
624
+ o.stopPropagation(), x(t.id);
606
625
  },
607
626
  children: "Edit"
608
627
  }
@@ -619,7 +638,7 @@ const Mn = ({
619
638
  t.name
620
639
  ] }) }),
621
640
  /* @__PURE__ */ e.jsx(_e, { maxW: "20rem", whiteSpace: "break-spaces", children: $n(t.sensorLocations) }),
622
- !w && /* @__PURE__ */ e.jsx(_e, { maxW: "20rem", children: /* @__PURE__ */ e.jsx(
641
+ !S && /* @__PURE__ */ e.jsx(_e, { maxW: "20rem", children: /* @__PURE__ */ e.jsx(
623
642
  kn,
624
643
  {
625
644
  containerProps: { flexWrap: "wrap" },
@@ -636,66 +655,66 @@ const Mn = ({
636
655
  onSave: r,
637
656
  onCancel: n,
638
657
  onError: a,
639
- hideButtons: m = !1,
640
- setButtonDisabled: g,
641
- setButtonOnClick: u,
642
- quantumOwned: h
658
+ hideButtons: p = !1,
659
+ setButtonDisabled: x,
660
+ setButtonOnClick: d,
661
+ quantumOwned: u
643
662
  }) => {
644
- const p = yt(), { getLabel: s } = pe(), i = k(() => ({
663
+ const h = yt(), { getLabel: s } = pe(), i = k(() => ({
645
664
  singular: s("action"),
646
665
  plural: s("action_plural"),
647
666
  pluralLowerCase: s("action_plural").toLowerCase(),
648
667
  singularLowerCase: s("action").toLowerCase()
649
- }), [s]), [x, M] = B("copy"), [w, I] = B(""), [L, y] = B([]), [c, d] = B(!1), [v] = Ce({
668
+ }), [s]), [g, w] = B("copy"), [S, M] = B(""), [I, y] = B([]), [c, m] = B(!1), [v] = Ce({
650
669
  query: St
651
670
  }), [j] = Ce({
652
671
  query: rn,
653
- variables: { groupId: w },
654
- pause: !w
672
+ variables: { groupId: S },
673
+ pause: !S
655
674
  // Only run when group is selected
656
- }), [, O] = fe(st), [, $] = fe(
675
+ }), [, A] = fe(st), [, $] = fe(
657
676
  Lt
658
677
  ), F = k(() => v.data?.groups ? v.data.groups.map(
659
- (l) => S(It, l)
660
- ) : [], [v.data]), A = k(() => j.data ? j.data.actions.map((t) => {
661
- const o = S(ve, t), b = S(
678
+ (l) => L(It, l)
679
+ ) : [], [v.data]), O = k(() => j.data ? j.data.actions.map((t) => {
680
+ const o = L(ve, t), b = L(
662
681
  Ze,
663
682
  o.reports
664
- ), U = S(
683
+ ), U = L(
665
684
  $e,
666
685
  o.categories
667
- ), E = S(
686
+ ), E = L(
668
687
  je,
669
688
  o.metadataGroups
670
689
  ).map((D) => ({
671
690
  ...D,
672
- data: D.data.map((Y) => S(be, Y))
691
+ data: D.data.map((Y) => L(be, Y))
673
692
  }));
674
693
  return {
675
694
  ...o,
676
- thresholds: S(Ie, o.thresholds),
695
+ thresholds: L(Ie, o.thresholds),
677
696
  reports: b.map((D) => ({
678
697
  ...D,
679
- thresholds: S(Ie, D.thresholds)
698
+ thresholds: L(Ie, D.thresholds)
680
699
  })),
681
700
  categories: U,
682
701
  metadataGroups: E
683
702
  };
684
- }) : [], [j.data]), N = k(() => A.filter(
685
- (l) => L.includes(l.id)
686
- ), [A, L]), H = G(
703
+ }) : [], [j.data]), N = k(() => O.filter(
704
+ (l) => I.includes(l.id)
705
+ ), [O, I]), H = P(
687
706
  (l) => {
688
707
  const t = l?.value || "";
689
- I(t), y([]);
708
+ M(t), y([]);
690
709
  },
691
710
  []
692
- ), oe = G(
711
+ ), oe = P(
693
712
  (l) => {
694
713
  const t = l.map((o) => o.value);
695
714
  y(t);
696
715
  },
697
716
  []
698
- ), R = G(
717
+ ), R = P(
699
718
  async (l) => {
700
719
  const t = {
701
720
  ...l,
@@ -712,7 +731,7 @@ const Mn = ({
712
731
  id: void 0
713
732
  })),
714
733
  categories: l.categories.map((b) => b.id),
715
- quantumOwned: h,
734
+ quantumOwned: u,
716
735
  metadataItemIds: l.metadataGroups.flatMap((b) => b.data.map((U) => U.id)).filter((b) => b !== void 0),
717
736
  reports: l.reports.map((b) => ({
718
737
  ...b,
@@ -723,38 +742,38 @@ const Mn = ({
723
742
  }))
724
743
  })),
725
744
  id: void 0
726
- }, o = await O({ fields: t });
745
+ }, o = await A({ fields: t });
727
746
  if (o.error) throw new Error(o.error.message);
728
747
  if (o.data?.createAction)
729
- return S(ve, o.data.createAction);
748
+ return L(ve, o.data.createAction);
730
749
  throw new Error("No action data returned");
731
750
  },
732
- [O, h]
733
- ), Z = G(
751
+ [A, u]
752
+ ), Z = P(
734
753
  async (l) => {
735
754
  const t = await $({ id: l.id });
736
755
  if (t.error)
737
756
  throw new Error(t.error.message);
738
757
  if (t.data?.convertActionToQuantumOwned)
739
- return S(
758
+ return L(
740
759
  ve,
741
760
  t.data.convertActionToQuantumOwned
742
761
  );
743
762
  throw new Error("No action data returned");
744
763
  },
745
764
  [$]
746
- ), V = G(async () => {
747
- if (d(!0), !N.length) {
765
+ ), V = P(async () => {
766
+ if (m(!0), !N.length) {
748
767
  const l = new Error(
749
- `No ${i.pluralLowerCase} selected for ${x === "copy" ? "copying" : "converting"}`
768
+ `No ${i.pluralLowerCase} selected for ${g === "copy" ? "copying" : "converting"}`
750
769
  );
751
- a?.(l), d(!1);
770
+ a?.(l), m(!1);
752
771
  return;
753
772
  }
754
773
  try {
755
774
  const l = [];
756
775
  let t = 0;
757
- const o = x === "copy" ? R : Z, b = x === "copy" ? "copy" : "convert";
776
+ const o = g === "copy" ? R : Z, b = g === "copy" ? "copy" : "convert";
758
777
  for (const U of N)
759
778
  try {
760
779
  const q = await o(U);
@@ -766,71 +785,71 @@ const Mn = ({
766
785
  ), t++;
767
786
  }
768
787
  if (l.length > 0) {
769
- const U = l.length, q = N.length, E = x === "copy" ? "copied" : "converted", D = x === "copy" ? "copy" : "convert";
770
- p({
788
+ const U = l.length, q = N.length, E = g === "copy" ? "copied" : "converted", D = g === "copy" ? "copy" : "convert";
789
+ h({
771
790
  title: t > 0 ? `Partial ${D} completed` : `${i.plural} ${E} successfully`,
772
791
  description: t > 0 ? `${U} of ${q} ${i.pluralLowerCase} ${E} successfully` : `${U} ${U > 1 ? i.pluralLowerCase : i.singularLowerCase} ${E} successfully`,
773
792
  status: t > 0 ? "warning" : "success",
774
793
  duration: 3e3,
775
794
  isClosable: !0
776
- }), r?.(), I(""), y([]);
795
+ }), r?.(), M(""), y([]);
777
796
  } else
778
797
  throw new Error(
779
798
  `Failed to ${b} any ${i.pluralLowerCase}`
780
799
  );
781
800
  } catch (l) {
782
- const t = x === "copy" ? "copy" : "convert", o = l instanceof Error ? l.message : `Failed to ${t} ${i.pluralLowerCase}`;
783
- p({
784
- title: `${x === "copy" ? "Copy" : "Convert"} failed`,
801
+ const t = g === "copy" ? "copy" : "convert", o = l instanceof Error ? l.message : `Failed to ${t} ${i.pluralLowerCase}`;
802
+ h({
803
+ title: `${g === "copy" ? "Copy" : "Convert"} failed`,
785
804
  description: o,
786
805
  status: "error",
787
806
  duration: 5e3,
788
807
  isClosable: !0
789
808
  }), a?.(l instanceof Error ? l : new Error(o));
790
809
  } finally {
791
- d(!1);
810
+ m(!1);
792
811
  }
793
812
  }, [
794
813
  N,
795
- x,
814
+ g,
796
815
  R,
797
816
  Z,
798
- p,
817
+ h,
799
818
  r,
800
819
  a,
801
820
  i
802
- ]), T = G(() => {
803
- I(""), y([]), M("copy"), n?.();
821
+ ]), T = P(() => {
822
+ M(""), y([]), w("copy"), n?.();
804
823
  }, [n]);
805
824
  ie(() => {
806
- g && g({
825
+ x && x({
807
826
  cancelButton: !1,
808
827
  saveButton: N.length === 0 || c
809
828
  });
810
- }, [N.length, c, g]), ie(() => {
811
- u && u({
829
+ }, [N.length, c, x]), ie(() => {
830
+ d && d({
812
831
  cancelButton: T,
813
832
  saveButton: V
814
833
  });
815
- }, [u, T, V]);
834
+ }, [d, T, V]);
816
835
  const _ = k(() => F.map((l) => ({
817
836
  value: l.id,
818
837
  label: l.name
819
- })), [F]), J = k(() => A.filter((l) => x === "copy" ? !0 : !l.quantumOwned).map((l) => ({
838
+ })), [F]), J = k(() => O.filter((l) => g === "copy" ? !0 : !l.quantumOwned).map((l) => ({
820
839
  value: l.id,
821
840
  label: l.name,
822
841
  // Add custom data to identify quantum-owned actions for UI display
823
842
  isQuantumOwned: l.quantumOwned
824
- })), [A, x]), W = v.fetching, K = j.fetching;
843
+ })), [O, g]), W = v.fetching, K = j.fetching;
825
844
  return /* @__PURE__ */ e.jsx(te, { children: /* @__PURE__ */ e.jsxs(le, { spacing: 6, align: "stretch", children: [
826
- h && /* @__PURE__ */ e.jsxs(X, { children: [
845
+ u && /* @__PURE__ */ e.jsxs(X, { children: [
827
846
  /* @__PURE__ */ e.jsx(he, { children: "Operation Mode" }),
828
847
  /* @__PURE__ */ e.jsx(
829
848
  vt,
830
849
  {
831
- value: x,
850
+ value: g,
832
851
  onChange: (l) => {
833
- M(l), y([]);
852
+ w(l), y([]);
834
853
  },
835
854
  children: /* @__PURE__ */ e.jsxs(re, { spacing: 6, children: [
836
855
  /* @__PURE__ */ e.jsx(Ye, { value: "copy", colorScheme: "blue", children: /* @__PURE__ */ e.jsxs(le, { align: "start", spacing: 1, children: [
@@ -868,7 +887,7 @@ const Mn = ({
868
887
  {
869
888
  placeholder: "Choose a group...",
870
889
  options: _,
871
- value: _.find((l) => l.value === w) || null,
890
+ value: _.find((l) => l.value === S) || null,
872
891
  onChange: H,
873
892
  isLoading: W,
874
893
  isDisabled: W,
@@ -883,13 +902,13 @@ const Mn = ({
883
902
  ] })
884
903
  ] })
885
904
  ] }),
886
- w && /* @__PURE__ */ e.jsxs(X, { children: [
905
+ S && /* @__PURE__ */ e.jsxs(X, { children: [
887
906
  /* @__PURE__ */ e.jsxs(he, { children: [
888
907
  "Select ",
889
908
  i.plural,
890
909
  " to",
891
910
  " ",
892
- x === "copy" ? "Copy" : "Convert"
911
+ g === "copy" ? "Copy" : "Convert"
893
912
  ] }),
894
913
  K ? /* @__PURE__ */ e.jsxs(re, { children: [
895
914
  /* @__PURE__ */ e.jsx(Ct, { size: "sm" }),
@@ -902,10 +921,10 @@ const Mn = ({
902
921
  /* @__PURE__ */ e.jsx(
903
922
  ue,
904
923
  {
905
- placeholder: `Choose ${i.pluralLowerCase} to ${x}...`,
924
+ placeholder: `Choose ${i.pluralLowerCase} to ${g}...`,
906
925
  options: J,
907
926
  value: J.filter(
908
- (l) => L.includes(l.value)
927
+ (l) => I.includes(l.value)
909
928
  ),
910
929
  onChange: oe,
911
930
  isDisabled: J.length === 0,
@@ -939,7 +958,7 @@ const Mn = ({
939
958
  ] })
940
959
  ] }),
941
960
  N.length > 0 && /* @__PURE__ */ e.jsxs(te, { p: 4, bg: "gray.50", borderRadius: "md", children: [
942
- /* @__PURE__ */ e.jsx(C, { fontWeight: "semibold", mb: 3, children: N.length === 1 ? `${i.singular} to ${x === "copy" ? "Copy" : "Convert"}:` : `${N.length} ${i.plural} to ${x === "copy" ? "Copy" : "Convert"}:` }),
961
+ /* @__PURE__ */ e.jsx(C, { fontWeight: "semibold", mb: 3, children: N.length === 1 ? `${i.singular} to ${g === "copy" ? "Copy" : "Convert"}:` : `${N.length} ${i.plural} to ${g === "copy" ? "Copy" : "Convert"}:` }),
943
962
  /* @__PURE__ */ e.jsxs(le, { align: "start", spacing: 3, children: [
944
963
  N.map((l, t) => /* @__PURE__ */ e.jsxs(
945
964
  te,
@@ -1020,13 +1039,13 @@ const Mn = ({
1020
1039
  i.pluralLowerCase,
1021
1040
  " will be",
1022
1041
  " ",
1023
- x === "copy" ? "copied" : "converted"
1042
+ g === "copy" ? "copied" : "converted"
1024
1043
  ] })
1025
1044
  }
1026
1045
  )
1027
1046
  ] })
1028
1047
  ] }),
1029
- !m && /* @__PURE__ */ e.jsxs(Me, { spacing: 4, justifyContent: "flex-end", children: [
1048
+ !p && /* @__PURE__ */ e.jsxs(Me, { spacing: 4, justifyContent: "flex-end", children: [
1030
1049
  /* @__PURE__ */ e.jsx(
1031
1050
  se,
1032
1051
  {
@@ -1039,13 +1058,13 @@ const Mn = ({
1039
1058
  /* @__PURE__ */ e.jsxs(
1040
1059
  se,
1041
1060
  {
1042
- colorScheme: x === "copy" ? "blue" : "green",
1061
+ colorScheme: g === "copy" ? "blue" : "green",
1043
1062
  onClick: V,
1044
1063
  isDisabled: N.length === 0 || c,
1045
1064
  isLoading: c,
1046
- loadingText: `${x === "copy" ? "Copying" : "Converting"}...`,
1065
+ loadingText: `${g === "copy" ? "Copying" : "Converting"}...`,
1047
1066
  children: [
1048
- x === "copy" ? "Copy" : "Convert",
1067
+ g === "copy" ? "Copy" : "Convert",
1049
1068
  " ",
1050
1069
  N.length === 1 ? i.singular : `${N.length} ${i.plural}`
1051
1070
  ]
@@ -1057,74 +1076,74 @@ const Mn = ({
1057
1076
  onSave: r,
1058
1077
  onCancel: n,
1059
1078
  onError: a,
1060
- hideButtons: m = !1,
1061
- setButtonDisabled: g,
1062
- setButtonOnClick: u,
1063
- quantumOwned: h
1079
+ hideButtons: p = !1,
1080
+ setButtonDisabled: x,
1081
+ setButtonOnClick: d,
1082
+ quantumOwned: u
1064
1083
  }) => {
1065
- const p = yt(), { getLabel: s } = pe(), i = k(() => ({
1084
+ const h = yt(), { getLabel: s } = pe(), i = k(() => ({
1066
1085
  singular: s("module"),
1067
1086
  plural: s("module_plural"),
1068
1087
  pluralLowerCase: s("module_plural").toLowerCase(),
1069
1088
  singularLowerCase: s("module").toLowerCase()
1070
- }), [s]), x = k(() => ({
1089
+ }), [s]), g = k(() => ({
1071
1090
  singular: s("action"),
1072
1091
  plural: s("action_plural"),
1073
1092
  pluralLowerCase: s("action_plural").toLowerCase(),
1074
1093
  singularLowerCase: s("action").toLowerCase()
1075
- }), [s]), [M, w] = B(""), [I, L] = B([]), [y, c] = B(!1), [d, v] = B("copy"), [j] = Ce({
1094
+ }), [s]), [w, S] = B(""), [M, I] = B([]), [y, c] = B(!1), [m, v] = B("copy"), [j] = Ce({
1076
1095
  query: St
1077
- }), [O] = Ce({
1096
+ }), [A] = Ce({
1078
1097
  query: on,
1079
- variables: { groupId: M },
1080
- pause: !M
1098
+ variables: { groupId: w },
1099
+ pause: !w
1081
1100
  // Only run when group is selected
1082
- }), [, $] = fe(Mt), [, F] = fe(Ot), [, A] = fe(st), [, N] = fe(
1101
+ }), [, $] = fe(Mt), [, F] = fe(Ot), [, O] = fe(st), [, N] = fe(
1083
1102
  Lt
1084
1103
  ), H = k(() => j.data?.groups ? j.data.groups.map(
1085
- (t) => S(It, t)
1086
- ) : [], [j.data]), oe = k(() => O.data?.modules ? S(
1104
+ (t) => L(It, t)
1105
+ ) : [], [j.data]), oe = k(() => A.data?.modules ? L(
1087
1106
  Qe,
1088
- O.data?.modules
1107
+ A.data?.modules
1089
1108
  ).map((o) => {
1090
- const b = S(
1109
+ const b = L(
1091
1110
  At,
1092
1111
  o.moduleActions
1093
- ), q = S(
1112
+ ), q = L(
1094
1113
  je,
1095
1114
  o.metadataGroups
1096
- ).map((E) => S(be, E.data)).flat();
1115
+ ).map((E) => L(be, E.data)).flat();
1097
1116
  return {
1098
1117
  ...o,
1099
1118
  moduleActions: b.map((E) => ({
1100
1119
  ...E,
1101
- action: S(ve, E.action)
1120
+ action: L(ve, E.action)
1102
1121
  })),
1103
- categories: S(
1122
+ categories: L(
1104
1123
  $e,
1105
1124
  o.categories
1106
1125
  ),
1107
1126
  metadataItems: q
1108
1127
  };
1109
- }) : [], [O.data]), R = k(() => oe.filter(
1110
- (t) => I.includes(t.id)
1111
- ), [oe, I]), Z = G(
1128
+ }) : [], [A.data]), R = k(() => oe.filter(
1129
+ (t) => M.includes(t.id)
1130
+ ), [oe, M]), Z = P(
1112
1131
  (t) => {
1113
1132
  const o = t?.value || "";
1114
- w(o), L([]);
1133
+ S(o), I([]);
1115
1134
  },
1116
1135
  []
1117
- ), V = G(
1136
+ ), V = P(
1118
1137
  (t) => {
1119
1138
  const o = t.map((b) => b.value);
1120
- L(o);
1139
+ I(o);
1121
1140
  },
1122
1141
  []
1123
- ), T = G(async () => {
1142
+ ), T = P(async () => {
1124
1143
  if (c(!0), !R.length) {
1125
1144
  c(!1);
1126
1145
  const t = new Error(
1127
- `No modules selected for ${d === "convert" ? "converting" : "copying"}`
1146
+ `No modules selected for ${m === "convert" ? "converting" : "copying"}`
1128
1147
  );
1129
1148
  a?.(t);
1130
1149
  return;
@@ -1135,48 +1154,48 @@ const Mn = ({
1135
1154
  for (const b of R)
1136
1155
  try {
1137
1156
  let U = b.moduleActions.map((q) => q.actionId);
1138
- if (h) {
1157
+ if (u) {
1139
1158
  const q = b.moduleActions.map((Y) => Y.action), E = async (Y) => {
1140
- if (d === "copy") {
1159
+ if (m === "copy") {
1141
1160
  if (Y.quantumOwned) return Y;
1142
- const ye = S(
1161
+ const ye = L(
1143
1162
  $e,
1144
1163
  Y.categories
1145
- ), Pe = S(
1164
+ ), Ge = L(
1146
1165
  je,
1147
1166
  Y.metadataGroups
1148
- ).map((xe) => S(
1167
+ ).map((xe) => L(
1149
1168
  be,
1150
1169
  xe.data
1151
- ).map((Te) => Te.id)).flat(), Oe = S(
1170
+ ).map((Te) => Te.id)).flat(), Oe = L(
1152
1171
  Ze,
1153
1172
  Y.reports
1154
1173
  ).map((xe) => ({
1155
1174
  ...xe,
1156
1175
  id: void 0,
1157
- thresholds: S(
1176
+ thresholds: L(
1158
1177
  Ie,
1159
1178
  xe.thresholds
1160
1179
  ).map((Te) => ({
1161
1180
  ...Te,
1162
1181
  id: void 0
1163
1182
  }))
1164
- })), Ae = S(
1183
+ })), Ae = L(
1165
1184
  Ie,
1166
1185
  Y.thresholds
1167
1186
  ).map((xe) => ({
1168
1187
  ...xe,
1169
1188
  id: void 0
1170
- })), Ge = {
1189
+ })), Pe = {
1171
1190
  ...Y,
1172
1191
  quantumOwned: !0,
1173
1192
  thresholds: Ae,
1174
1193
  categories: ye?.map((xe) => xe.id),
1175
1194
  reports: Oe,
1176
- metadataIds: Pe,
1195
+ metadataIds: Ge,
1177
1196
  id: void 0
1178
- }, ke = await A({ fields: Ge });
1179
- return ke.error || !ke.data?.createAction ? null : S(
1197
+ }, ke = await O({ fields: Pe });
1198
+ return ke.error || !ke.data?.createAction ? null : L(
1180
1199
  ve,
1181
1200
  ke.data.createAction
1182
1201
  );
@@ -1185,7 +1204,7 @@ const Mn = ({
1185
1204
  const ge = await N({
1186
1205
  id: Y.id
1187
1206
  });
1188
- return ge.error || !ge.data?.convertActionToQuantumOwned ? null : S(
1207
+ return ge.error || !ge.data?.convertActionToQuantumOwned ? null : L(
1189
1208
  ve,
1190
1209
  ge.data.convertActionToQuantumOwned
1191
1210
  );
@@ -1194,7 +1213,7 @@ const Mn = ({
1194
1213
  q.map(E)
1195
1214
  )).filter((Y) => !!Y).map((Y) => Y.id);
1196
1215
  }
1197
- if (d === "convert") {
1216
+ if (m === "convert") {
1198
1217
  const q = {
1199
1218
  name: b.name,
1200
1219
  description: b.description || void 0,
@@ -1207,7 +1226,7 @@ const Mn = ({
1207
1226
  });
1208
1227
  if (E.error) throw new Error(E.error.message);
1209
1228
  if (E.data?.updateModule) {
1210
- const D = S(
1229
+ const D = L(
1211
1230
  Qe,
1212
1231
  E.data.updateModule
1213
1232
  );
@@ -1219,7 +1238,7 @@ const Mn = ({
1219
1238
  description: b.description || void 0,
1220
1239
  actions: U,
1221
1240
  categories: b.categories.map((D) => D.id),
1222
- quantumOwned: h,
1241
+ quantumOwned: u,
1223
1242
  metadataItemIds: b.metadataItems.map((D) => D.id),
1224
1243
  actionReports: b.moduleActions.filter((D) => !!D.reportId).map((D) => ({
1225
1244
  actionId: D.actionId,
@@ -1228,7 +1247,7 @@ const Mn = ({
1228
1247
  }, E = await $({ input: q });
1229
1248
  if (E.error) throw new Error(E.error.message);
1230
1249
  if (E.data?.createModule) {
1231
- const D = S(
1250
+ const D = L(
1232
1251
  Qe,
1233
1252
  E.data.createModule
1234
1253
  );
@@ -1237,27 +1256,27 @@ const Mn = ({
1237
1256
  }
1238
1257
  } catch (U) {
1239
1258
  console.error(
1240
- `Failed to ${d === "convert" ? "convert" : "copy"} module "${b.name}":`,
1259
+ `Failed to ${m === "convert" ? "convert" : "copy"} module "${b.name}":`,
1241
1260
  U
1242
1261
  ), o++;
1243
1262
  }
1244
1263
  if (t.length > 0) {
1245
1264
  const b = t.length, U = R.length;
1246
- p({
1247
- title: o > 0 ? `Partial ${d === "convert" ? "convert" : "copy"} completed` : `${i.plural} ${d === "convert" ? "converted" : "copied"} successfully`,
1248
- description: o > 0 ? `${b} of ${U} ${i.plural} ${d === "convert" ? "converted" : "copied"} successfully` : `${b} ${b > 1 ? i.plural : i.singular} ${d === "convert" ? "converted" : "copied"} successfully`,
1265
+ h({
1266
+ title: o > 0 ? `Partial ${m === "convert" ? "convert" : "copy"} completed` : `${i.plural} ${m === "convert" ? "converted" : "copied"} successfully`,
1267
+ description: o > 0 ? `${b} of ${U} ${i.plural} ${m === "convert" ? "converted" : "copied"} successfully` : `${b} ${b > 1 ? i.plural : i.singular} ${m === "convert" ? "converted" : "copied"} successfully`,
1249
1268
  status: o > 0 ? "warning" : "success",
1250
1269
  duration: 3e3,
1251
1270
  isClosable: !0
1252
- }), t.length > 0 && r?.(), w(""), L([]);
1271
+ }), t.length > 0 && r?.(), S(""), I([]);
1253
1272
  } else
1254
1273
  throw new Error(
1255
- `Failed to ${d === "convert" ? "convert" : "copy"} any modules`
1274
+ `Failed to ${m === "convert" ? "convert" : "copy"} any modules`
1256
1275
  );
1257
1276
  } catch (t) {
1258
- const o = t instanceof Error ? t.message : `Failed to ${d === "convert" ? "convert" : "copy"} modules`;
1259
- p({
1260
- title: d === "convert" ? "Convert failed" : "Copy failed",
1277
+ const o = t instanceof Error ? t.message : `Failed to ${m === "convert" ? "convert" : "copy"} modules`;
1278
+ h({
1279
+ title: m === "convert" ? "Convert failed" : "Copy failed",
1261
1280
  description: o,
1262
1281
  status: "error",
1263
1282
  duration: 5e3,
@@ -1270,46 +1289,46 @@ const Mn = ({
1270
1289
  R,
1271
1290
  $,
1272
1291
  F,
1273
- p,
1292
+ h,
1274
1293
  r,
1275
1294
  a,
1276
- h,
1277
- A,
1295
+ u,
1296
+ O,
1278
1297
  N,
1279
- d,
1298
+ m,
1280
1299
  i
1281
- ]), _ = G(() => {
1282
- w(""), L([]), v("copy"), n?.();
1300
+ ]), _ = P(() => {
1301
+ S(""), I([]), v("copy"), n?.();
1283
1302
  }, [n]);
1284
1303
  ie(() => {
1285
- g && g({
1304
+ x && x({
1286
1305
  cancelButton: !1,
1287
1306
  saveButton: R.length === 0 || y
1288
1307
  });
1289
- }, [R.length, y, g]), ie(() => {
1290
- u && u({
1308
+ }, [R.length, y, x]), ie(() => {
1309
+ d && d({
1291
1310
  cancelButton: _,
1292
1311
  saveButton: T
1293
1312
  });
1294
- }, [u, _, T]);
1313
+ }, [d, _, T]);
1295
1314
  const J = k(() => H.map((t) => ({
1296
1315
  value: t.id,
1297
1316
  label: t.name
1298
- })), [H]), W = k(() => oe.filter((t) => d === "copy" ? !0 : !t.quantumOwned).map((t) => ({
1317
+ })), [H]), W = k(() => oe.filter((t) => m === "copy" ? !0 : !t.quantumOwned).map((t) => ({
1299
1318
  value: t.id,
1300
1319
  label: t.name,
1301
1320
  // Add custom data to identify quantum-owned modules
1302
1321
  isQuantumOwned: t.quantumOwned
1303
- })), [oe, d]), K = j.fetching, l = O.fetching;
1322
+ })), [oe, m]), K = j.fetching, l = A.fetching;
1304
1323
  return /* @__PURE__ */ e.jsx(te, { children: /* @__PURE__ */ e.jsxs(le, { spacing: 6, align: "stretch", children: [
1305
- h && /* @__PURE__ */ e.jsxs(X, { children: [
1324
+ u && /* @__PURE__ */ e.jsxs(X, { children: [
1306
1325
  /* @__PURE__ */ e.jsx(he, { children: "Operation Mode" }),
1307
1326
  /* @__PURE__ */ e.jsx(
1308
1327
  vt,
1309
1328
  {
1310
- value: d,
1329
+ value: m,
1311
1330
  onChange: (t) => {
1312
- v(t), L([]);
1331
+ v(t), I([]);
1313
1332
  },
1314
1333
  children: /* @__PURE__ */ e.jsxs(re, { spacing: 6, children: [
1315
1334
  /* @__PURE__ */ e.jsx(Ye, { value: "copy", colorScheme: "blue", children: /* @__PURE__ */ e.jsxs(le, { align: "start", spacing: 1, children: [
@@ -1342,7 +1361,7 @@ const Mn = ({
1342
1361
  {
1343
1362
  placeholder: "Choose a group...",
1344
1363
  options: J,
1345
- value: J.find((t) => t.value === M) || null,
1364
+ value: J.find((t) => t.value === w) || null,
1346
1365
  onChange: Z,
1347
1366
  isLoading: K,
1348
1367
  isDisabled: K,
@@ -1357,8 +1376,8 @@ const Mn = ({
1357
1376
  ] })
1358
1377
  ] })
1359
1378
  ] }),
1360
- M && /* @__PURE__ */ e.jsxs(X, { children: [
1361
- /* @__PURE__ */ e.jsx(he, { children: d === "convert" ? `Select ${i.plural} to Convert` : `Select ${i.plural} to Copy` }),
1379
+ w && /* @__PURE__ */ e.jsxs(X, { children: [
1380
+ /* @__PURE__ */ e.jsx(he, { children: m === "convert" ? `Select ${i.plural} to Convert` : `Select ${i.plural} to Copy` }),
1362
1381
  l ? /* @__PURE__ */ e.jsxs(re, { children: [
1363
1382
  /* @__PURE__ */ e.jsx(Ct, { size: "sm" }),
1364
1383
  /* @__PURE__ */ e.jsxs(C, { fontSize: "sm", color: "gray.600", children: [
@@ -1370,10 +1389,10 @@ const Mn = ({
1370
1389
  /* @__PURE__ */ e.jsx(
1371
1390
  ue,
1372
1391
  {
1373
- placeholder: d === "convert" ? `Choose ${i.pluralLowerCase} to convert...` : `Choose ${i.pluralLowerCase} to copy...`,
1392
+ placeholder: m === "convert" ? `Choose ${i.pluralLowerCase} to convert...` : `Choose ${i.pluralLowerCase} to copy...`,
1374
1393
  options: W,
1375
1394
  value: W.filter(
1376
- (t) => I.includes(t.value)
1395
+ (t) => M.includes(t.value)
1377
1396
  ),
1378
1397
  onChange: V,
1379
1398
  isDisabled: W.length === 0,
@@ -1395,19 +1414,19 @@ const Mn = ({
1395
1414
  " found in this group"
1396
1415
  ] })
1397
1416
  ] }),
1398
- O.error && /* @__PURE__ */ e.jsxs(He, { status: "error", mt: 2, children: [
1417
+ A.error && /* @__PURE__ */ e.jsxs(He, { status: "error", mt: 2, children: [
1399
1418
  /* @__PURE__ */ e.jsx(Je, {}),
1400
1419
  /* @__PURE__ */ e.jsxs(C, { fontSize: "sm", children: [
1401
1420
  "Failed to load ",
1402
1421
  i.pluralLowerCase,
1403
1422
  ":",
1404
1423
  " ",
1405
- O.error.message
1424
+ A.error.message
1406
1425
  ] })
1407
1426
  ] })
1408
1427
  ] }),
1409
1428
  R.length > 0 && /* @__PURE__ */ e.jsxs(te, { p: 4, bg: "gray.50", borderRadius: "md", children: [
1410
- /* @__PURE__ */ e.jsx(C, { fontWeight: "semibold", mb: 3, children: R.length === 1 ? `${i.singular} to ${d === "copy" ? "Copy" : "Convert"}` : `${R.length} ${i.plural} to ${d === "copy" ? "Copy" : "Convert"}` }),
1429
+ /* @__PURE__ */ e.jsx(C, { fontWeight: "semibold", mb: 3, children: R.length === 1 ? `${i.singular} to ${m === "copy" ? "Copy" : "Convert"}` : `${R.length} ${i.plural} to ${m === "copy" ? "Copy" : "Convert"}` }),
1411
1430
  /* @__PURE__ */ e.jsxs(le, { align: "start", spacing: 3, children: [
1412
1431
  R.map((t, o) => /* @__PURE__ */ e.jsxs(
1413
1432
  te,
@@ -1473,11 +1492,11 @@ const Mn = ({
1473
1492
  i.pluralLowerCase,
1474
1493
  " will be",
1475
1494
  " ",
1476
- d === "copy" ? "copied" : "converted"
1495
+ m === "copy" ? "copied" : "converted"
1477
1496
  ] })
1478
1497
  }
1479
1498
  ),
1480
- h && R.filter((t) => t.moduleActions.some((o) => !o.action.quantumOwned)).length > 0 && /* @__PURE__ */ e.jsx(
1499
+ u && R.filter((t) => t.moduleActions.some((o) => !o.action.quantumOwned)).length > 0 && /* @__PURE__ */ e.jsx(
1481
1500
  te,
1482
1501
  {
1483
1502
  p: 2,
@@ -1485,12 +1504,12 @@ const Mn = ({
1485
1504
  borderRadius: "md",
1486
1505
  border: "1px solid",
1487
1506
  borderColor: "yellow.200",
1488
- children: /* @__PURE__ */ e.jsx(C, { fontSize: "sm", fontWeight: "medium", color: "yellow.800", children: d === "convert" ? `Converting ${i.plural} will convert non QM-Owned ${x.plural} to QM-Owned ${x.plural}` : `Copying ${i.plural} with Non QM-Owned ${x.plural} will create corresponding QM-Owned ${x.plural}` })
1507
+ children: /* @__PURE__ */ e.jsx(C, { fontSize: "sm", fontWeight: "medium", color: "yellow.800", children: m === "convert" ? `Converting ${i.plural} will convert non QM-Owned ${g.plural} to QM-Owned ${g.plural}` : `Copying ${i.plural} with Non QM-Owned ${g.plural} will create corresponding QM-Owned ${g.plural}` })
1489
1508
  }
1490
1509
  )
1491
1510
  ] })
1492
1511
  ] }),
1493
- !m && /* @__PURE__ */ e.jsxs(Me, { spacing: 4, justifyContent: "flex-end", children: [
1512
+ !p && /* @__PURE__ */ e.jsxs(Me, { spacing: 4, justifyContent: "flex-end", children: [
1494
1513
  /* @__PURE__ */ e.jsx(
1495
1514
  se,
1496
1515
  {
@@ -1503,13 +1522,13 @@ const Mn = ({
1503
1522
  /* @__PURE__ */ e.jsxs(
1504
1523
  se,
1505
1524
  {
1506
- colorScheme: d === "copy" ? "blue" : "green",
1525
+ colorScheme: m === "copy" ? "blue" : "green",
1507
1526
  onClick: T,
1508
1527
  isDisabled: R.length === 0 || y,
1509
1528
  isLoading: y,
1510
- loadingText: `${d === "copy" ? "Copying" : "Converting"}...`,
1529
+ loadingText: `${m === "copy" ? "Copying" : "Converting"}...`,
1511
1530
  children: [
1512
- d === "copy" ? "Copy" : "Convert",
1531
+ m === "copy" ? "Copy" : "Convert",
1513
1532
  " ",
1514
1533
  R.length === 1 ? i.singular : `${R.length} ${i.plural}`
1515
1534
  ]
@@ -1524,54 +1543,54 @@ const Mn = ({
1524
1543
  "useUpsertModuleFormContext must be used within a UpsertModuleFormProvider"
1525
1544
  );
1526
1545
  return r;
1527
- }, Gn = ({
1546
+ }, Pn = ({
1528
1547
  name: r,
1529
1548
  setName: n,
1530
1549
  actions: a,
1531
- selectedActionIds: m,
1532
- setSelectedActionIds: g,
1533
- availableCategories: u,
1534
- selectedCategoryIds: h,
1535
- setSelectedCategoryIds: p,
1550
+ selectedActionIds: p,
1551
+ setSelectedActionIds: x,
1552
+ availableCategories: d,
1553
+ selectedCategoryIds: u,
1554
+ setSelectedCategoryIds: h,
1536
1555
  description: s,
1537
1556
  setDescription: i,
1538
- selectedMetadataIds: x,
1539
- setSelectedMetadataIds: M,
1540
- actionReportIds: w,
1541
- setActionReportIds: I,
1542
- ...L
1557
+ selectedMetadataIds: g,
1558
+ setSelectedMetadataIds: w,
1559
+ actionReportIds: S,
1560
+ setActionReportIds: M,
1561
+ ...I
1543
1562
  }) => {
1544
1563
  const y = Wt(), c = k(() => a.map((F) => ({
1545
1564
  ...F,
1546
- selected: m.includes(F.id)
1547
- })), [a, m]), d = k(() => a.reduce((F, A) => (F[A.id] = A, F), {}), [a]), v = k(
1548
- () => m.map((F) => d[F]),
1549
- [m, d]
1550
- ), j = G(
1551
- (F, A) => {
1552
- g(A ? [...m, F.id] : m.filter((N) => N !== F.id));
1565
+ selected: p.includes(F.id)
1566
+ })), [a, p]), m = k(() => a.reduce((F, O) => (F[O.id] = O, F), {}), [a]), v = k(
1567
+ () => p.map((F) => m[F]),
1568
+ [p, m]
1569
+ ), j = P(
1570
+ (F, O) => {
1571
+ x(O ? [...p, F.id] : p.filter((N) => N !== F.id));
1553
1572
  },
1554
- [m, g]
1555
- ), O = G(
1573
+ [p, x]
1574
+ ), A = P(
1556
1575
  (F) => {
1557
1576
  n(F.target.value);
1558
1577
  },
1559
1578
  [n]
1560
- ), $ = G(
1579
+ ), $ = P(
1561
1580
  (F) => {
1562
1581
  i?.(F.target.value);
1563
1582
  },
1564
1583
  [i]
1565
1584
  );
1566
- return /* @__PURE__ */ e.jsxs(te, { ...L, children: [
1585
+ return /* @__PURE__ */ e.jsxs(te, { ...I, children: [
1567
1586
  /* @__PURE__ */ e.jsxs(re, { gap: "2rem", children: [
1568
- /* @__PURE__ */ e.jsx(En, { name: r ?? "", onInputChange: O }),
1587
+ /* @__PURE__ */ e.jsx(En, { name: r ?? "", onInputChange: A }),
1569
1588
  /* @__PURE__ */ e.jsx(
1570
1589
  _n,
1571
1590
  {
1572
- availableCategories: u,
1573
- value: h,
1574
- onChange: p
1591
+ availableCategories: d,
1592
+ value: u,
1593
+ onChange: h
1575
1594
  }
1576
1595
  )
1577
1596
  ] }),
@@ -1585,18 +1604,18 @@ const Mn = ({
1585
1604
  /* @__PURE__ */ e.jsx(
1586
1605
  Qn,
1587
1606
  {
1588
- selectedMetadataIds: x,
1589
- setSelectedMetadataIds: M
1607
+ selectedMetadataIds: g,
1608
+ setSelectedMetadataIds: w
1590
1609
  }
1591
1610
  ),
1592
1611
  /* @__PURE__ */ e.jsx(
1593
1612
  Bn,
1594
1613
  {
1595
1614
  value: v,
1596
- onChange: g,
1615
+ onChange: x,
1597
1616
  onAdjustActivities: () => y.onOpen(),
1598
- actionReportIds: w,
1599
- setActionReportIds: I
1617
+ actionReportIds: S,
1618
+ setActionReportIds: M
1600
1619
  }
1601
1620
  ),
1602
1621
  /* @__PURE__ */ e.jsxs(
@@ -1611,7 +1630,7 @@ const Mn = ({
1611
1630
  /* @__PURE__ */ e.jsx(Kt, { children: "Select Activities" }),
1612
1631
  /* @__PURE__ */ e.jsx(Yt, {}),
1613
1632
  /* @__PURE__ */ e.jsx(Ht, { children: /* @__PURE__ */ e.jsx(
1614
- Pn,
1633
+ Gn,
1615
1634
  {
1616
1635
  actions: c,
1617
1636
  onSelected: j,
@@ -1628,7 +1647,7 @@ const Mn = ({
1628
1647
  {
1629
1648
  colorScheme: "blue",
1630
1649
  onClick: y.onClose,
1631
- isDisabled: m.length === 0,
1650
+ isDisabled: p.length === 0,
1632
1651
  children: "Done"
1633
1652
  }
1634
1653
  ) })
@@ -1642,10 +1661,10 @@ const Mn = ({
1642
1661
  name: r,
1643
1662
  onInputChange: n
1644
1663
  }) => {
1645
- const { getLabel: a } = pe(), m = a("module"), { isView: g } = Fe();
1664
+ const { getLabel: a } = pe(), p = a("module"), { isView: x } = Fe();
1646
1665
  return /* @__PURE__ */ e.jsxs(X, { mb: 4, children: [
1647
1666
  /* @__PURE__ */ e.jsxs(he, { children: [
1648
- m,
1667
+ p,
1649
1668
  " Name"
1650
1669
  ] }),
1651
1670
  /* @__PURE__ */ e.jsx(
@@ -1655,7 +1674,7 @@ const Mn = ({
1655
1674
  value: r,
1656
1675
  onChange: n,
1657
1676
  isRequired: !0,
1658
- isDisabled: g
1677
+ isDisabled: x
1659
1678
  }
1660
1679
  )
1661
1680
  ] });
@@ -1666,27 +1685,27 @@ const Mn = ({
1666
1685
  value: n,
1667
1686
  onChange: a
1668
1687
  }) => {
1669
- const { getLabel: m } = pe(), g = m("module"), { isView: u } = Fe(), h = k(() => [
1688
+ const { getLabel: p } = pe(), x = p("module"), { isView: d } = Fe(), u = k(() => [
1670
1689
  ...r,
1671
1690
  {
1672
1691
  id: "other",
1673
1692
  name: "Other"
1674
1693
  }
1675
- ], [r]), p = k(() => h.map((s) => ({
1694
+ ], [r]), h = k(() => u.map((s) => ({
1676
1695
  value: s.id,
1677
1696
  label: s.name
1678
- })), [h]);
1697
+ })), [u]);
1679
1698
  return /* @__PURE__ */ e.jsxs(X, { mb: 4, children: [
1680
1699
  /* @__PURE__ */ e.jsxs(he, { children: [
1681
- g,
1700
+ x,
1682
1701
  " Category"
1683
1702
  ] }),
1684
1703
  /* @__PURE__ */ e.jsx(
1685
1704
  ue,
1686
1705
  {
1687
- isDisabled: r.length === 0 || u,
1688
- options: p,
1689
- value: n.length === 0 ? { value: "other", label: "Other" } : h.filter((s) => n.includes(s.id)).map((s) => ({
1706
+ isDisabled: r.length === 0 || d,
1707
+ options: h,
1708
+ value: n.length === 0 ? { value: "other", label: "Other" } : u.filter((s) => n.includes(s.id)).map((s) => ({
1690
1709
  value: s.id,
1691
1710
  label: s.name
1692
1711
  }))[0],
@@ -1701,14 +1720,14 @@ const Mn = ({
1701
1720
  description: r,
1702
1721
  onInputChange: n
1703
1722
  }) => {
1704
- const { getLabel: a } = pe(), m = a("module"), { isView: g } = Fe();
1723
+ const { getLabel: a } = pe(), p = a("module"), { isView: x } = Fe();
1705
1724
  return /* @__PURE__ */ e.jsxs(X, { mb: 4, children: [
1706
1725
  /* @__PURE__ */ e.jsx(he, { children: /* @__PURE__ */ e.jsxs("span", { children: [
1707
1726
  "Description",
1708
1727
  /* @__PURE__ */ e.jsxs(C, { fontSize: "sm", color: "gray.500", children: [
1709
1728
  "Briefly describe the objective of this",
1710
1729
  " ",
1711
- m.toLocaleLowerCase(),
1730
+ p.toLocaleLowerCase(),
1712
1731
  ". Max 40 words."
1713
1732
  ] })
1714
1733
  ] }) }),
@@ -1718,7 +1737,7 @@ const Mn = ({
1718
1737
  placeholder: "i.e. Assess readiness to return to play post-ACL reconstruction",
1719
1738
  value: r,
1720
1739
  onChange: n,
1721
- isDisabled: g
1740
+ isDisabled: x
1722
1741
  }
1723
1742
  )
1724
1743
  ] });
@@ -1728,38 +1747,38 @@ const Mn = ({
1728
1747
  value: r,
1729
1748
  onChange: n,
1730
1749
  onAdjustActivities: a,
1731
- actionReportIds: m,
1732
- setActionReportIds: g
1750
+ actionReportIds: p,
1751
+ setActionReportIds: x
1733
1752
  }) => {
1734
- const { getLabel: u } = pe(), { isView: h } = Fe(), p = k(() => ({
1735
- module: u("module"),
1736
- moduleLowerCase: u("module").toLocaleLowerCase(),
1737
- action: u("action"),
1738
- actionPlural: u("action_plural"),
1739
- actionPluralLowerCase: u("action_plural").toLocaleLowerCase()
1740
- }), [u]), s = k(
1753
+ const { getLabel: d } = pe(), { isView: u } = Fe(), h = k(() => ({
1754
+ module: d("module"),
1755
+ moduleLowerCase: d("module").toLocaleLowerCase(),
1756
+ action: d("action"),
1757
+ actionPlural: d("action_plural"),
1758
+ actionPluralLowerCase: d("action_plural").toLocaleLowerCase()
1759
+ }), [d]), s = k(
1741
1760
  () => r.map((i) => ({
1742
1761
  id: i.id,
1743
1762
  name: i.name,
1744
- reports: S(Ze, i.reports) || [],
1745
- selectedReportId: m[i.id] || null
1763
+ reports: L(Ze, i.reports) || [],
1764
+ selectedReportId: p[i.id] || null
1746
1765
  })),
1747
- [r, m]
1766
+ [r, p]
1748
1767
  );
1749
1768
  return /* @__PURE__ */ e.jsxs(X, { mb: 4, children: [
1750
1769
  /* @__PURE__ */ e.jsxs(re, { justifyContent: "space-between", children: [
1751
1770
  /* @__PURE__ */ e.jsx(he, { children: /* @__PURE__ */ e.jsxs("span", { children: [
1752
- p.actionPlural,
1753
- !h && /* @__PURE__ */ e.jsxs(C, { fontSize: "sm", color: "gray.500", children: [
1771
+ h.actionPlural,
1772
+ !u && /* @__PURE__ */ e.jsxs(C, { fontSize: "sm", color: "gray.500", children: [
1754
1773
  "Drag and drop to reorder the ",
1755
- p.actionPluralLowerCase,
1774
+ h.actionPluralLowerCase,
1756
1775
  " ",
1757
1776
  "in this ",
1758
- p.moduleLowerCase,
1777
+ h.moduleLowerCase,
1759
1778
  "."
1760
1779
  ] })
1761
1780
  ] }) }),
1762
- !h && /* @__PURE__ */ e.jsxs(
1781
+ !u && /* @__PURE__ */ e.jsxs(
1763
1782
  se,
1764
1783
  {
1765
1784
  size: "sm",
@@ -1768,19 +1787,19 @@ const Mn = ({
1768
1787
  onClick: a,
1769
1788
  children: [
1770
1789
  "Add / Remove ",
1771
- p.actionPlural
1790
+ h.actionPlural
1772
1791
  ]
1773
1792
  }
1774
1793
  )
1775
1794
  ] }),
1776
1795
  s.length === 0 ? /* @__PURE__ */ e.jsx(le, { children: /* @__PURE__ */ e.jsxs(C, { color: "gray.500", fontSize: "lg", mb: "4rem", mt: "4rem", children: [
1777
1796
  "No ",
1778
- p.actionPluralLowerCase,
1797
+ h.actionPluralLowerCase,
1779
1798
  " selected for this",
1780
1799
  " ",
1781
- p.moduleLowerCase,
1800
+ h.moduleLowerCase,
1782
1801
  ".",
1783
- !h && /* @__PURE__ */ e.jsxs(
1802
+ !u && /* @__PURE__ */ e.jsxs(
1784
1803
  se,
1785
1804
  {
1786
1805
  ml: "0.5em",
@@ -1790,7 +1809,7 @@ const Mn = ({
1790
1809
  onClick: a,
1791
1810
  children: [
1792
1811
  "Add ",
1793
- p.actionPluralLowerCase,
1812
+ h.actionPluralLowerCase,
1794
1813
  "."
1795
1814
  ]
1796
1815
  }
@@ -1800,12 +1819,12 @@ const Mn = ({
1800
1819
  {
1801
1820
  value: s,
1802
1821
  onChange: (i) => {
1803
- const x = i(s);
1804
- n(x.map((M) => M.id));
1822
+ const g = i(s);
1823
+ n(g.map((w) => w.id));
1805
1824
  },
1806
- disabled: h,
1807
- actionReportIds: m,
1808
- setActionReportIds: g
1825
+ disabled: u,
1826
+ actionReportIds: p,
1827
+ setActionReportIds: x
1809
1828
  }
1810
1829
  )
1811
1830
  ] });
@@ -1815,36 +1834,36 @@ const Mn = ({
1815
1834
  value: r,
1816
1835
  onChange: n,
1817
1836
  disabled: a,
1818
- actionReportIds: m,
1819
- setActionReportIds: g
1837
+ actionReportIds: p,
1838
+ setActionReportIds: x
1820
1839
  }) => {
1821
- const [u] = B(
1840
+ const [d] = B(
1822
1841
  () => Math.random().toString(36).substring(2, 15)
1823
- ), h = G(
1824
- (p, s) => {
1842
+ ), u = P(
1843
+ (h, s) => {
1825
1844
  a || n((i) => {
1826
- const x = [...i], [M] = x.splice(p, 1);
1827
- return x.splice(s, 0, M), x;
1845
+ const g = [...i], [w] = g.splice(h, 1);
1846
+ return g.splice(s, 0, w), g;
1828
1847
  });
1829
1848
  },
1830
1849
  [n, a]
1831
1850
  );
1832
- return /* @__PURE__ */ e.jsx(te, { children: /* @__PURE__ */ e.jsx(bn, { backend: yn, children: /* @__PURE__ */ e.jsx(le, { spacing: 3, align: "stretch", children: r.map((p, s) => /* @__PURE__ */ e.jsx(
1851
+ return /* @__PURE__ */ e.jsx(te, { children: /* @__PURE__ */ e.jsx(bn, { backend: yn, children: /* @__PURE__ */ e.jsx(le, { spacing: 3, align: "stretch", children: r.map((h, s) => /* @__PURE__ */ e.jsx(
1833
1852
  Un,
1834
1853
  {
1835
- listKey: u,
1836
- item: p,
1854
+ listKey: d,
1855
+ item: h,
1837
1856
  index: s,
1838
1857
  disabled: !!a,
1839
- move: h,
1858
+ move: u,
1840
1859
  onReportChange: (i) => {
1841
- g({
1842
- ...m,
1843
- [p.id]: i
1860
+ x({
1861
+ ...p,
1862
+ [h.id]: i
1844
1863
  });
1845
1864
  }
1846
1865
  },
1847
- p.id
1866
+ h.id
1848
1867
  )) }) }) });
1849
1868
  }
1850
1869
  ), Un = Se(
@@ -1852,48 +1871,48 @@ const Mn = ({
1852
1871
  listKey: r,
1853
1872
  item: n,
1854
1873
  index: a,
1855
- disabled: m,
1856
- move: g,
1857
- onReportChange: u
1874
+ disabled: p,
1875
+ move: x,
1876
+ onReportChange: d
1858
1877
  }) => {
1859
- const h = sn(null), { getLabel: p } = pe(), s = p("action"), [{ handlerId: i }, x] = vn({
1878
+ const u = sn(null), { getLabel: h } = pe(), s = h("action"), [{ handlerId: i }, g] = vn({
1860
1879
  accept: r,
1861
1880
  collect: (c) => ({
1862
1881
  handlerId: c.getHandlerId()?.toString() ?? ""
1863
1882
  }),
1864
- hover: (c, d) => {
1865
- if (!h.current)
1883
+ hover: (c, m) => {
1884
+ if (!u.current)
1866
1885
  return;
1867
1886
  const v = c.index, j = a;
1868
1887
  if (v === j)
1869
1888
  return;
1870
- const O = h.current?.getBoundingClientRect(), $ = (O.bottom - O.top) / 2, A = d.getClientOffset().y - O.top;
1871
- v < j && A < $ || v > j && A > $ || (g(v, j), c.index = j);
1889
+ const A = u.current?.getBoundingClientRect(), $ = (A.bottom - A.top) / 2, O = m.getClientOffset().y - A.top;
1890
+ v < j && O < $ || v > j && O > $ || (x(v, j), c.index = j);
1872
1891
  }
1873
- }), [{ isDragging: M }, w] = Cn({
1892
+ }), [{ isDragging: w }, S] = Cn({
1874
1893
  type: r,
1875
1894
  item: () => ({ id: n.id, index: a }),
1876
1895
  collect: (c) => ({
1877
1896
  isDragging: c.isDragging()
1878
1897
  }),
1879
- canDrag: !m
1880
- }), I = k(() => [
1898
+ canDrag: !p
1899
+ }), M = k(() => [
1881
1900
  { value: null, label: "No Report" },
1882
1901
  ...n.reports.map((c) => ({
1883
1902
  value: c.id,
1884
1903
  label: c.reportKind || "Report"
1885
1904
  }))
1886
- ], [n.reports]), L = M ? 0.6 : 1, y = m ? "default" : M ? "grabbing" : "grab";
1887
- return w(x(h)), /* @__PURE__ */ e.jsx(
1905
+ ], [n.reports]), I = w ? 0.6 : 1, y = p ? "default" : w ? "grabbing" : "grab";
1906
+ return S(g(u)), /* @__PURE__ */ e.jsx(
1888
1907
  te,
1889
1908
  {
1890
- ref: h,
1909
+ ref: u,
1891
1910
  p: 3,
1892
1911
  border: "1px solid",
1893
1912
  borderColor: "gray.200",
1894
1913
  borderRadius: "md",
1895
1914
  bg: "gray.50",
1896
- style: { opacity: L, cursor: y },
1915
+ style: { opacity: I, cursor: y },
1897
1916
  "data-handler-id": i,
1898
1917
  children: /* @__PURE__ */ e.jsxs(re, { justify: "space-between", align: "center", children: [
1899
1918
  /* @__PURE__ */ e.jsxs(re, { spacing: 3, children: [
@@ -1911,15 +1930,15 @@ const Mn = ({
1911
1930
  /* @__PURE__ */ e.jsx(te, { width: "300px", children: /* @__PURE__ */ e.jsx(
1912
1931
  ue,
1913
1932
  {
1914
- value: I.find(
1933
+ value: M.find(
1915
1934
  (c) => c.value === n.selectedReportId
1916
1935
  ),
1917
1936
  onChange: (c) => {
1918
- u(c?.value || null);
1937
+ d(c?.value || null);
1919
1938
  },
1920
- options: I,
1939
+ options: M,
1921
1940
  placeholder: "Select report...",
1922
- isDisabled: m
1941
+ isDisabled: p
1923
1942
  }
1924
1943
  ) })
1925
1944
  ] })
@@ -1932,7 +1951,7 @@ const Mn = ({
1932
1951
  selectedMetadataIds: r,
1933
1952
  setSelectedMetadataIds: n
1934
1953
  }) => {
1935
- const { getLabel: a } = pe(), { isView: m, metadataOptions: g } = Fe(), u = k(() => [
1954
+ const { getLabel: a } = pe(), { isView: p, metadataOptions: x } = Fe(), d = k(() => [
1936
1955
  {
1937
1956
  key: "activity_type",
1938
1957
  label: `${a("action")} Type`,
@@ -1941,111 +1960,111 @@ const Mn = ({
1941
1960
  { key: "session_type", label: "Session Type", multi: !0 },
1942
1961
  { key: "body_region", label: "Body Region", multi: !0 },
1943
1962
  { key: "sport", label: "Sport", multi: !0 }
1944
- ], [a]), h = G(
1945
- (p, s) => {
1946
- const i = u.find((M) => M.key === p);
1963
+ ], [a]), u = P(
1964
+ (h, s) => {
1965
+ const i = d.find((w) => w.key === h);
1947
1966
  if (!i) return;
1948
- const x = i.multi ? (s ?? []).map((M) => M.id) : s ? [s.id] : [];
1949
- n((M) => [...M.filter((I) => Object.values(g || {}).flat().find((y) => y.id === I) && !Object.keys(g || {}).find(
1950
- (y) => g?.[y]?.some(
1951
- (c) => c.id === I && y === p
1967
+ const g = i.multi ? (s ?? []).map((w) => w.id) : s ? [s.id] : [];
1968
+ n((w) => [...w.filter((M) => Object.values(x || {}).flat().find((y) => y.id === M) && !Object.keys(x || {}).find(
1969
+ (y) => x?.[y]?.some(
1970
+ (c) => c.id === M && y === h
1952
1971
  )
1953
- )), ...x]);
1972
+ )), ...g]);
1954
1973
  },
1955
- [u, g, n]
1974
+ [d, x, n]
1956
1975
  );
1957
- return g ? /* @__PURE__ */ e.jsxs(X, { mb: 4, children: [
1976
+ return x ? /* @__PURE__ */ e.jsxs(X, { mb: 4, children: [
1958
1977
  /* @__PURE__ */ e.jsx(he, { children: "Metadata Tags" }),
1959
- /* @__PURE__ */ e.jsx(re, { gap: "1rem", align: "start", children: u.map((p) => /* @__PURE__ */ e.jsxs(X, { flex: "1", children: [
1960
- /* @__PURE__ */ e.jsx(Xe, { fontSize: "sm", children: p.label }),
1978
+ /* @__PURE__ */ e.jsx(re, { gap: "1rem", align: "start", children: d.map((h) => /* @__PURE__ */ e.jsxs(X, { flex: "1", children: [
1979
+ /* @__PURE__ */ e.jsx(Xe, { fontSize: "sm", children: h.label }),
1961
1980
  /* @__PURE__ */ e.jsx(
1962
1981
  ue,
1963
1982
  {
1964
- isMulti: p.multi,
1965
- value: g[p.key]?.filter(
1983
+ isMulti: h.multi,
1984
+ value: x[h.key]?.filter(
1966
1985
  (s) => r.includes(s.id)
1967
1986
  ),
1968
1987
  onChange: (s) => {
1969
- h(
1970
- p.key,
1988
+ u(
1989
+ h.key,
1971
1990
  s
1972
1991
  );
1973
1992
  },
1974
- options: g[p.key],
1975
- placeholder: `Select ${p.multi ? "one or more" : "one"} ${p.label.toLowerCase()}`,
1976
- isDisabled: m,
1977
- isClearable: p.multi
1993
+ options: x[h.key],
1994
+ placeholder: `Select ${h.multi ? "one or more" : "one"} ${h.label.toLowerCase()}`,
1995
+ isDisabled: p,
1996
+ isClearable: h.multi
1978
1997
  }
1979
1998
  )
1980
- ] }, p.key)) })
1999
+ ] }, h.key)) })
1981
2000
  ] }) : null;
1982
2001
  }
1983
2002
  ), qn = ({
1984
2003
  value: r,
1985
2004
  onChange: n,
1986
2005
  forceKind: a,
1987
- disableRemove: m,
1988
- disableKind: g,
1989
- isDisabled: u,
1990
- lockRanges: h,
1991
- ...p
2006
+ disableRemove: p,
2007
+ disableKind: x,
2008
+ isDisabled: d,
2009
+ lockRanges: u,
2010
+ ...h
1992
2011
  }) => {
1993
- const s = k(() => [...r].sort((w, I) => {
1994
- const L = xt.indexOf(w.plane), y = xt.indexOf(I.plane);
1995
- return L - y;
1996
- }), [r]), i = G((w) => "segment" in w.id ? kt(w.id.segment, w.plane, !0) ?? "Unknown" : Tt(w.id.joint, w.plane, !0) ?? "Unknown", []), x = G(
1997
- (w, I) => {
1998
- const L = s.findIndex(
1999
- (c) => c.id === I.id && c.plane === I.plane
2012
+ const s = k(() => [...r].sort((S, M) => {
2013
+ const I = xt.indexOf(S.plane), y = xt.indexOf(M.plane);
2014
+ return I - y;
2015
+ }), [r]), i = P((S) => "segment" in S.id ? kt(S.id.segment, S.plane, !0) ?? "Unknown" : Tt(S.id.joint, S.plane, !0) ?? "Unknown", []), g = P(
2016
+ (S, M) => {
2017
+ const I = s.findIndex(
2018
+ (c) => c.id === M.id && c.plane === M.plane
2000
2019
  );
2001
2020
  let y = [...s];
2002
- a && (I = { ...I, kind: a }), y[L] = I, h && (y = y.map((c) => ({
2021
+ a && (M = { ...M, kind: a }), y[I] = M, u && (y = y.map((c) => ({
2003
2022
  ...c,
2004
- min: I.min,
2005
- max: I.max
2023
+ min: M.min,
2024
+ max: M.max
2006
2025
  }))), n(y);
2007
2026
  },
2008
- [n, s, a, h]
2009
- ), M = G(
2010
- (w) => {
2011
- const I = s.filter(
2012
- (L) => L.id !== w.id || L.plane !== w.plane
2027
+ [n, s, a, u]
2028
+ ), w = P(
2029
+ (S) => {
2030
+ const M = s.filter(
2031
+ (I) => I.id !== S.id || I.plane !== S.plane
2013
2032
  );
2014
- n(I);
2033
+ n(M);
2015
2034
  },
2016
2035
  [n, s]
2017
2036
  );
2018
- return /* @__PURE__ */ e.jsx(le, { alignItems: "flex-start", overflowY: "auto", ...p, children: s.map((w, I) => /* @__PURE__ */ e.jsx(
2037
+ return /* @__PURE__ */ e.jsx(le, { alignItems: "flex-start", overflowY: "auto", ...h, children: s.map((S, M) => /* @__PURE__ */ e.jsx(
2019
2038
  Kn,
2020
2039
  {
2021
- label: i(w),
2022
- parameter: w,
2023
- onChange: (L) => x(I, L),
2024
- onRemove: m || u ? void 0 : () => M(w),
2040
+ label: i(S),
2041
+ parameter: S,
2042
+ onChange: (I) => g(M, I),
2043
+ onRemove: p || d ? void 0 : () => w(S),
2025
2044
  forceKind: a,
2026
- disableKind: g || u,
2027
- isDisabled: u
2045
+ disableKind: x || d,
2046
+ isDisabled: d
2028
2047
  },
2029
- `${JSON.stringify(w.id)}-${w.plane}`
2048
+ `${JSON.stringify(S.id)}-${S.plane}`
2030
2049
  )) });
2031
2050
  }, Kn = ({
2032
2051
  label: r,
2033
2052
  parameter: n,
2034
2053
  onChange: a,
2035
- onRemove: m,
2036
- forceKind: g,
2037
- disableKind: u,
2038
- isDisabled: h
2054
+ onRemove: p,
2055
+ forceKind: x,
2056
+ disableKind: d,
2057
+ isDisabled: u
2039
2058
  }) => {
2040
- const p = G(
2041
- (x) => "joint" in n.id ? wn(
2059
+ const h = P(
2060
+ (g) => "joint" in n.id ? wn(
2042
2061
  n.id.joint,
2043
2062
  n.plane,
2044
- x < 0 ? -1 : 1
2063
+ g < 0 ? -1 : 1
2045
2064
  ) : Sn(
2046
2065
  n.id.segment,
2047
2066
  n.plane,
2048
- x < 0 ? -1 : 1
2067
+ g < 0 ? -1 : 1
2049
2068
  ),
2050
2069
  [n]
2051
2070
  ), { min: s, max: i } = "joint" in n.id ? Ln(n.id.joint, n.plane) : { min: -180, max: 180 };
@@ -2072,22 +2091,22 @@ const Mn = ({
2072
2091
  }
2073
2092
  ),
2074
2093
  n.sensorOnly && /* @__PURE__ */ e.jsx(wt, { size: "sm", colorScheme: "orange", variant: "subtle", children: "Sensor Only" }),
2075
- m && !h && /* @__PURE__ */ e.jsx(
2094
+ p && !u && /* @__PURE__ */ e.jsx(
2076
2095
  Xt,
2077
2096
  {
2078
2097
  size: "xs",
2079
2098
  variant: "ghost",
2080
2099
  "aria-label": "delete",
2081
2100
  icon: /* @__PURE__ */ e.jsx(bt, { as: jn }),
2082
- onClick: m
2101
+ onClick: p
2083
2102
  }
2084
2103
  ),
2085
- !g && /* @__PURE__ */ e.jsx(
2104
+ !x && /* @__PURE__ */ e.jsx(
2086
2105
  On,
2087
2106
  {
2088
2107
  selectedItem: n?.kind ?? Ke.Limit,
2089
- onChange: ({ value: x }) => a({ ...n, kind: x }),
2090
- isDisabled: u || h,
2108
+ onChange: ({ value: g }) => a({ ...n, kind: g }),
2109
+ isDisabled: d || u,
2091
2110
  buttonProps: {
2092
2111
  size: "sm",
2093
2112
  variant: "outline",
@@ -2113,11 +2132,11 @@ const Mn = ({
2113
2132
  max: i,
2114
2133
  zeroMarker: !0,
2115
2134
  value: [n.min, n.max],
2116
- onChange: (x) => a({ ...n, min: x[0], max: x[1] }),
2117
- formatValue: (x) => `${Math.abs(x)}°`,
2118
- valueLabel: (x) => p(x) ?? "",
2119
- positiveNegativeLabels: p(0) ? [p(-1) ?? "", p(1) ?? ""] : void 0,
2120
- isDisabled: h
2135
+ onChange: (g) => a({ ...n, min: g[0], max: g[1] }),
2136
+ formatValue: (g) => `${Math.abs(g)}°`,
2137
+ valueLabel: (g) => h(g) ?? "",
2138
+ positiveNegativeLabels: h(0) ? [h(-1) ?? "", h(1) ?? ""] : void 0,
2139
+ isDisabled: u
2121
2140
  }
2122
2141
  )
2123
2142
  ]
@@ -2127,101 +2146,101 @@ const Mn = ({
2127
2146
  options: r,
2128
2147
  value: n,
2129
2148
  onChange: a,
2130
- forceKind: m,
2131
- singleValue: g,
2132
- singleValueSideless: u,
2133
- editOnly: h,
2134
- disableKind: p,
2149
+ forceKind: p,
2150
+ singleValue: x,
2151
+ singleValueSideless: d,
2152
+ editOnly: u,
2153
+ disableKind: h,
2135
2154
  maxParameters: s,
2136
2155
  ...i
2137
2156
  }) => {
2138
- const x = u ? 2 : s, M = k(() => {
2157
+ const g = d ? 2 : s, w = k(() => {
2139
2158
  const c = /* @__PURE__ */ new Map();
2140
- return r.forEach((d) => {
2141
- const v = "joint" in d.id;
2142
- let j, O;
2143
- if (v ? (j = Tt(d.id.joint, d.plane, !0) ?? "Unknown", O = `joint:${d.id.joint}`) : (j = kt(d.id.segment, d.plane, !0) ?? "Unknown", O = `segment:${d.id.segment}`), !c.has(O)) {
2144
- const A = v ? pt(d.id.joint) ?? "Unknown Joint" : pt(d.id.segment) ?? "Unknown Segment";
2145
- c.set(O, {
2146
- label: A,
2159
+ return r.forEach((m) => {
2160
+ const v = "joint" in m.id;
2161
+ let j, A;
2162
+ if (v ? (j = Tt(m.id.joint, m.plane, !0) ?? "Unknown", A = `joint:${m.id.joint}`) : (j = kt(m.id.segment, m.plane, !0) ?? "Unknown", A = `segment:${m.id.segment}`), !c.has(A)) {
2163
+ const O = v ? pt(m.id.joint) ?? "Unknown Joint" : pt(m.id.segment) ?? "Unknown Segment";
2164
+ c.set(A, {
2165
+ label: O,
2147
2166
  options: []
2148
2167
  });
2149
2168
  }
2150
- const $ = c.get(O), F = [
2169
+ const $ = c.get(A), F = [
2151
2170
  j,
2152
- v ? d.id.joint : d.id.segment,
2153
- d.plane
2154
- ].filter(Boolean).map((A) => String(A).toLowerCase().replace(/\s+|_/g, ""));
2171
+ v ? m.id.joint : m.id.segment,
2172
+ m.plane
2173
+ ].filter(Boolean).map((O) => String(O).toLowerCase().replace(/\s+|_/g, ""));
2155
2174
  $.options.push({
2156
2175
  label: /* @__PURE__ */ e.jsxs(re, { spacing: 2, justify: "space-between", w: "100%", pl: 3, children: [
2157
2176
  /* @__PURE__ */ e.jsx(C, { children: j }),
2158
- d.sensorOnly && /* @__PURE__ */ e.jsx(wt, { size: "sm", colorScheme: "orange", variant: "subtle", children: "Sensor Only" })
2177
+ m.sensorOnly && /* @__PURE__ */ e.jsx(wt, { size: "sm", colorScheme: "orange", variant: "subtle", children: "Sensor Only" })
2159
2178
  ] }),
2160
- value: d.id,
2161
- plane: d.plane,
2162
- sensorOnly: d.sensorOnly,
2179
+ value: m.id,
2180
+ plane: m.plane,
2181
+ sensorOnly: m.sensorOnly,
2163
2182
  searchTokens: F
2164
2183
  });
2165
2184
  }), Array.from(c.values());
2166
- }, [r]), w = k(() => {
2167
- if (!u || n.length === 0)
2168
- return M;
2185
+ }, [r]), S = k(() => {
2186
+ if (!d || n.length === 0)
2187
+ return w;
2169
2188
  const c = n[0];
2170
- return M.map((d) => ({
2171
- ...d,
2172
- options: d.options.filter(
2189
+ return w.map((m) => ({
2190
+ ...m,
2191
+ options: m.options.filter(
2173
2192
  (v) => Be(v.value) === Be(c.id) && v.plane === c.plane
2174
2193
  )
2175
- })).filter((d) => d.options.length > 0);
2176
- }, [M, n, u]), I = k(() => M.flatMap((d) => d.options).filter(
2177
- (d) => n.some((v) => Ue(v.id, d.value) && v.plane === d.plane)
2178
- ), [M, n]), L = G((c, d) => {
2179
- if (!d) return !0;
2180
- const v = d.toLowerCase().replace(/\s+|_/g, ""), j = c.data;
2194
+ })).filter((m) => m.options.length > 0);
2195
+ }, [w, n, d]), M = k(() => w.flatMap((m) => m.options).filter(
2196
+ (m) => n.some((v) => Ue(v.id, m.value) && v.plane === m.plane)
2197
+ ), [w, n]), I = P((c, m) => {
2198
+ if (!m) return !0;
2199
+ const v = m.toLowerCase().replace(/\s+|_/g, ""), j = c.data;
2181
2200
  return !j || !j.searchTokens ? !1 : j.searchTokens.some(
2182
- (O) => O.includes(v)
2201
+ (A) => A.includes(v)
2183
2202
  );
2184
- }, []), y = G(
2203
+ }, []), y = P(
2185
2204
  (c) => {
2186
- const d = c.map((v) => {
2205
+ const m = c.map((v) => {
2187
2206
  const j = n.find(
2188
2207
  (N) => Ue(N.id, v.value) && N.plane === v.plane
2189
- ), O = r.find(
2208
+ ), A = r.find(
2190
2209
  (N) => Ue(N.id, v.value) && N.plane === v.plane
2191
- ), $ = u ? n.find(
2210
+ ), $ = d ? n.find(
2192
2211
  (N) => Be(N.id) === Be(v.value) && N.plane === v.plane
2193
- ) : void 0, F = $ && !j ? $.min : O && O.min ? O.min : 0, A = $ && !j ? $.max : O && O.max ? O.max : 0;
2212
+ ) : void 0, F = $ && !j ? $.min : A && A.min ? A.min : 0, O = $ && !j ? $.max : A && A.max ? A.max : 0;
2194
2213
  return j ?? {
2195
2214
  id: v.value,
2196
2215
  plane: v.plane,
2197
2216
  min: F,
2198
- max: A,
2217
+ max: O,
2199
2218
  sensorOnly: v.sensorOnly,
2200
- kind: m ?? Ke.Limit
2219
+ kind: p ?? Ke.Limit
2201
2220
  };
2202
2221
  });
2203
- a(d);
2222
+ a(m);
2204
2223
  },
2205
- [a, n, r, m, u]
2224
+ [a, n, r, p, d]
2206
2225
  );
2207
2226
  return ie(() => {
2208
2227
  const c = n.filter(
2209
- (d) => r.some((v) => Ue(v.id, d.id) && v.plane === d.plane)
2228
+ (m) => r.some((v) => Ue(v.id, m.id) && v.plane === m.plane)
2210
2229
  );
2211
2230
  c.length !== n.length && a(c);
2212
2231
  }, [r, a, n]), /* @__PURE__ */ e.jsxs(te, { ...i, children: [
2213
2232
  /* @__PURE__ */ e.jsx(
2214
2233
  ue,
2215
2234
  {
2216
- isMulti: !g,
2235
+ isMulti: !x,
2217
2236
  placeholder: n.length ? `${n.length} selected` : "Search...",
2218
- value: I,
2219
- isDisabled: h || I.length >= (x ?? 1 / 0),
2237
+ value: M,
2238
+ isDisabled: u || M.length >= (g ?? 1 / 0),
2220
2239
  onChange: (c) => Array.isArray(c) ? y([...c]) : y(c !== null ? [c] : []),
2221
- options: w,
2240
+ options: S,
2222
2241
  controlShouldRenderValue: !1,
2223
2242
  formatOptionLabel: (c) => c.label,
2224
- filterOption: L,
2243
+ filterOption: I,
2225
2244
  isSearchable: !0
2226
2245
  }
2227
2246
  ),
@@ -2232,10 +2251,10 @@ const Mn = ({
2232
2251
  maxH: "28rem",
2233
2252
  value: n,
2234
2253
  onChange: a,
2235
- forceKind: m,
2236
- disableKind: p,
2237
- isDisabled: h,
2238
- lockRanges: u
2254
+ forceKind: p,
2255
+ disableKind: h,
2256
+ isDisabled: u,
2257
+ lockRanges: d
2239
2258
  }
2240
2259
  )
2241
2260
  ] });
@@ -2287,41 +2306,41 @@ const Mn = ({
2287
2306
  id: r,
2288
2307
  onError: n,
2289
2308
  onCancel: a,
2290
- onSave: m,
2291
- hideButtons: g,
2292
- setButtonOnClick: u,
2293
- setButtonDisabled: h,
2294
- quantumOwned: p,
2309
+ onSave: p,
2310
+ hideButtons: x,
2311
+ setButtonOnClick: d,
2312
+ setButtonDisabled: u,
2313
+ quantumOwned: h,
2295
2314
  isView: s
2296
2315
  }) => {
2297
- const i = rt(), [{ fetching: x }, M] = fe(st), [{ fetching: w }, I] = fe(an), [{ data: L }] = Ce({
2316
+ const i = rt(), [{ fetching: g }, w] = fe(st), [{ fetching: S }, M] = fe(an), [{ data: I }] = Ce({
2298
2317
  query: ln,
2299
2318
  variables: { id: r ?? "" },
2300
2319
  pause: !r
2301
2320
  }), y = k(() => {
2302
- const f = S(
2321
+ const f = L(
2303
2322
  ve,
2304
- L?.getActionById
2323
+ I?.getActionById
2305
2324
  );
2306
2325
  if (!f) return null;
2307
- const P = S(Ze, f.reports).map((Q) => ({
2326
+ const G = L(Ze, f.reports).map((Q) => ({
2308
2327
  ...Q,
2309
- thresholds: S(Ie, Q.thresholds)
2328
+ thresholds: L(Ie, Q.thresholds)
2310
2329
  }));
2311
2330
  return {
2312
2331
  ...f,
2313
- thresholds: S(Ie, f.thresholds),
2314
- reports: P
2332
+ thresholds: L(Ie, f.thresholds),
2333
+ reports: G
2315
2334
  };
2316
- }, [L]), c = x || w, d = !!y && !!r, { getLabel: v } = pe(), j = k(() => ({
2335
+ }, [I]), c = g || S, m = !!y && !!r, { getLabel: v } = pe(), j = k(() => ({
2317
2336
  action: v("action")
2318
- }), [v]), O = k(() => [
2337
+ }), [v]), A = k(() => [
2319
2338
  { key: "module_category", label: "Link Category", multi: !0 },
2320
2339
  { key: "activity_type", label: `${j.action} Type`, multi: !1 },
2321
2340
  { key: "session_type", label: "Session Type", multi: !0 },
2322
2341
  { key: "body_region", label: "Body Region", multi: !0 },
2323
2342
  { key: "sport", label: "Sport", multi: !0 }
2324
- ], [j.action]), [$, F] = B(""), [A, N] = B(""), [H, oe] = B(""), [R, Z] = B(""), [V, T] = B([]), [_, J] = B({}), [W, K] = B(null), [l, t] = B([]), [o, b] = B([]), [U, q] = B(""), [E, D] = B([]), Y = hn(), ge = k(() => Y.filter((f) => f.sensorOnly), [Y]), ye = k(() => {
2343
+ ], [j.action]), [$, F] = B(""), [O, N] = B(""), [H, oe] = B(""), [R, Z] = B(""), [V, T] = B([]), [_, J] = B({}), [W, K] = B(null), [l, t] = B([]), [o, b] = B([]), [U, q] = B(""), [E, D] = B([]), Y = hn(), ge = k(() => Y.filter((f) => f.sensorOnly), [Y]), ye = k(() => {
2325
2344
  const f = [
2326
2345
  { label: "General Activity", value: ae.GeneralActivity },
2327
2346
  {
@@ -2331,41 +2350,41 @@ const Mn = ({
2331
2350
  { label: "Point of Interest", value: ae.PointOfInterest },
2332
2351
  { label: "Range", value: ae.Range },
2333
2352
  { label: "Stability Balance", value: ae.StabilityBalance }
2334
- ], z = E.map((P) => P.kind);
2353
+ ], z = E.map((G) => G.kind);
2335
2354
  return f.filter(
2336
- (P) => !z.includes(P.value)
2355
+ (G) => !z.includes(G.value)
2337
2356
  );
2338
- }, [E]), De = $.length > 0, [Pe, ot] = B({});
2357
+ }, [E]), De = $.length > 0, [Ge, ot] = B({});
2339
2358
  ie(() => {
2340
- const f = O.map(
2359
+ const f = A.map(
2341
2360
  (z) => i.query(nt, { key: z.key })
2342
2361
  );
2343
2362
  Promise.all(f).then((z) => {
2344
- const P = {};
2363
+ const G = {};
2345
2364
  z.forEach((Q) => {
2346
2365
  if (Q.error || !Q.data) return;
2347
- const ee = S(
2366
+ const ee = L(
2348
2367
  je,
2349
2368
  Q.data.getMetadataByKey
2350
- ), ne = S(
2369
+ ), ne = L(
2351
2370
  be,
2352
2371
  ee.data
2353
2372
  );
2354
- P[ee.key] = ne.map((me) => ({
2373
+ G[ee.key] = ne.map((me) => ({
2355
2374
  label: me.label || me.value,
2356
2375
  value: me.value,
2357
2376
  id: me.id
2358
2377
  }));
2359
- }), J(P);
2378
+ }), J(G);
2360
2379
  });
2361
- }, [i, O]), ie(() => {
2380
+ }, [i, A]), ie(() => {
2362
2381
  if (y) {
2363
- const z = S(
2382
+ const z = L(
2364
2383
  je,
2365
2384
  y.metadataGroups
2366
2385
  ).map(
2367
- (ee) => ee.data.map((ne) => S(be, ne).id)
2368
- ), P = y.reports.map((ee) => ({
2386
+ (ee) => ee.data.map((ne) => L(be, ne).id)
2387
+ ), G = y.reports.map((ee) => ({
2369
2388
  id: ee.id,
2370
2389
  instructions: ee.instructions ?? "",
2371
2390
  kind: ee.reportKind,
@@ -2390,50 +2409,50 @@ const Mn = ({
2390
2409
  cameraPlacement: y.cameraPlacement || "",
2391
2410
  videoLink: y.videoLink || "",
2392
2411
  metadataIds: z.flat(),
2393
- reports: P
2412
+ reports: G
2394
2413
  };
2395
- F(Q.name), N(Q.description), oe(Q.cameraPlacement), Z(Q.videoLink), T(Q.metadataIds), D(P), ot(Q);
2414
+ F(Q.name), N(Q.description), oe(Q.cameraPlacement), Z(Q.videoLink), T(Q.metadataIds), D(G), ot(Q);
2396
2415
  }
2397
2416
  }, [y]);
2398
2417
  const Oe = k(
2399
- () => JSON.stringify(Pe) !== JSON.stringify({
2418
+ () => JSON.stringify(Ge) !== JSON.stringify({
2400
2419
  name: $,
2401
- description: A,
2420
+ description: O,
2402
2421
  cameraPlacement: H,
2403
2422
  videoLink: R,
2404
2423
  metadataIds: V,
2405
2424
  reports: E
2406
2425
  }),
2407
2426
  [
2408
- Pe,
2427
+ Ge,
2409
2428
  $,
2410
- A,
2429
+ O,
2411
2430
  H,
2412
2431
  R,
2413
2432
  V,
2414
2433
  E
2415
2434
  ]
2416
- ), Ae = G(() => {
2435
+ ), Ae = P(() => {
2417
2436
  const f = {
2418
2437
  name: $,
2419
- description: A,
2438
+ description: O,
2420
2439
  cameraPlacement: H,
2421
2440
  videoLink: R,
2422
2441
  metadataItemIds: V,
2423
2442
  // Backend requires laterality; keep existing default since UI no longer edits it
2424
2443
  laterality: In.Either,
2425
- quantumOwned: p,
2444
+ quantumOwned: h,
2426
2445
  //Backend requires session type; keep existing default since UI no longer edits it
2427
2446
  sessionType: [],
2428
2447
  // Backend requires thresholds; use empty array since reports handle parameters now
2429
2448
  thresholds: [],
2430
2449
  // Include reports data
2431
- reports: E.map((P) => ({
2432
- id: P.isNew ? void 0 : P.id,
2433
- reportKind: P.kind,
2434
- sensorLocations: P.sensorLocations,
2435
- instructions: P.instructions,
2436
- thresholds: P.parameters.map((Q) => ({
2450
+ reports: E.map((G) => ({
2451
+ id: G.isNew ? void 0 : G.id,
2452
+ reportKind: G.kind,
2453
+ sensorLocations: G.sensorLocations,
2454
+ instructions: G.instructions,
2455
+ thresholds: G.parameters.map((Q) => ({
2437
2456
  id: Q.oldId,
2438
2457
  kind: Q.kind,
2439
2458
  min: Q.min,
@@ -2445,46 +2464,46 @@ const Mn = ({
2445
2464
  }))
2446
2465
  };
2447
2466
  let z;
2448
- d && r ? z = I({
2467
+ m && r ? z = M({
2449
2468
  id: r,
2450
2469
  fields: f
2451
- }) : z = M({
2470
+ }) : z = w({
2452
2471
  fields: f
2453
- }), z.then(({ error: P }) => {
2454
- P ? n(P) : m();
2472
+ }), z.then(({ error: G }) => {
2473
+ G ? n(G) : p();
2455
2474
  });
2456
2475
  }, [
2457
- p,
2476
+ h,
2477
+ w,
2458
2478
  M,
2459
- I,
2460
2479
  r,
2461
2480
  $,
2462
- A,
2481
+ O,
2463
2482
  H,
2464
2483
  R,
2465
2484
  V,
2466
2485
  E,
2467
- d,
2468
2486
  m,
2487
+ p,
2469
2488
  n
2470
2489
  ]);
2471
2490
  ie(() => {
2472
- h && h({
2491
+ u && u({
2473
2492
  cancelButton: c,
2474
2493
  saveButton: s ? !0 : c || !De || !Oe
2475
2494
  });
2476
- }, [c, h, De, Oe, s]), ie(() => {
2477
- u && u({
2495
+ }, [c, u, De, Oe, s]), ie(() => {
2496
+ d && d({
2478
2497
  cancelButton: a,
2479
2498
  saveButton: s ? () => {
2480
2499
  } : Ae
2481
2500
  });
2482
- }, [u, a, Ae, s]);
2483
- const Ge = G(
2501
+ }, [d, a, Ae, s]);
2502
+ const Pe = P(
2484
2503
  (f) => {
2485
2504
  const z = gt(
2486
2505
  f.map(
2487
- (P) => "joint" in P.id ? P.id.joint : P.id.segment
2506
+ (G) => "joint" in G.id ? G.id.joint : G.id.segment
2488
2507
  )
2489
2508
  );
2490
2509
  b(z);
@@ -2492,9 +2511,9 @@ const Mn = ({
2492
2511
  []
2493
2512
  );
2494
2513
  ie(() => {
2495
- Ge(l);
2496
- }, [l, Ge]);
2497
- const ke = G(() => {
2514
+ Pe(l);
2515
+ }, [l, Pe]);
2516
+ const ke = P(() => {
2498
2517
  if (!W)
2499
2518
  return;
2500
2519
  const f = W === ae.PointOfInterest, z = {
@@ -2506,18 +2525,18 @@ const Mn = ({
2506
2525
  instructions: f ? U : "",
2507
2526
  isNew: !0
2508
2527
  };
2509
- D((P) => [...P, z]), K(null), t([]), b([]), q("");
2528
+ D((G) => [...G, z]), K(null), t([]), b([]), q("");
2510
2529
  }, [
2511
2530
  W,
2512
2531
  l,
2513
2532
  o,
2514
2533
  U
2515
- ]), xe = G((f) => {
2516
- D((z) => z.filter((P) => P.id !== f));
2534
+ ]), xe = P((f) => {
2535
+ D((z) => z.filter((G) => G.id !== f));
2517
2536
  }, []), Te = (f, z) => {
2518
- const P = O.find((ee) => ee.key === f);
2519
- if (!P) return;
2520
- const Q = P.multi ? (z ?? []).map(
2537
+ const G = A.find((ee) => ee.key === f);
2538
+ if (!G) return;
2539
+ const Q = G.multi ? (z ?? []).map(
2521
2540
  (ee) => ee.id
2522
2541
  ) : z ? [z.id] : [];
2523
2542
  T((ee) => [...ee.filter((me) => Object.values(_).flat().find((Ee) => Ee.id === me) && !Object.keys(_).find(
@@ -2579,7 +2598,7 @@ const Mn = ({
2579
2598
  /* @__PURE__ */ e.jsx(
2580
2599
  ze,
2581
2600
  {
2582
- value: A,
2601
+ value: O,
2583
2602
  onChange: (f) => N(f.target.value),
2584
2603
  rows: 2,
2585
2604
  placeholder: "(optional) Describe how to perform the test or exercise",
@@ -2590,7 +2609,7 @@ const Mn = ({
2590
2609
  ] }),
2591
2610
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
2592
2611
  /* @__PURE__ */ e.jsx(de, { children: "Metadata Tags" }),
2593
- O.map((f) => /* @__PURE__ */ e.jsxs(X, { children: [
2612
+ A.map((f) => /* @__PURE__ */ e.jsxs(X, { children: [
2594
2613
  /* @__PURE__ */ e.jsx(de, { children: f.label }),
2595
2614
  /* @__PURE__ */ e.jsx(
2596
2615
  ue,
@@ -2714,7 +2733,7 @@ const Mn = ({
2714
2733
  {
2715
2734
  value: f.instructions,
2716
2735
  onChange: (z) => D(
2717
- (P) => P.map(
2736
+ (G) => G.map(
2718
2737
  (Q) => Q.id === f.id ? { ...Q, instructions: z.target.value } : Q
2719
2738
  )
2720
2739
  ),
@@ -2730,9 +2749,9 @@ const Mn = ({
2730
2749
  options: Y,
2731
2750
  value: f.parameters,
2732
2751
  onChange: (z) => {
2733
- const P = z.map(
2752
+ const G = z.map(
2734
2753
  (ee) => ee.id.joint ?? ee.id.segment
2735
- ), Q = gt(P);
2754
+ ), Q = gt(G);
2736
2755
  D(
2737
2756
  (ee) => ee.map(
2738
2757
  (ne) => ne.id === f.id ? { ...ne, parameters: z, sensorLocations: Q } : ne
@@ -2763,7 +2782,7 @@ const Mn = ({
2763
2782
  re,
2764
2783
  {
2765
2784
  justify: "end",
2766
- className: qe((g || s) && "!hidden"),
2785
+ className: qe((x || s) && "!hidden"),
2767
2786
  children: /* @__PURE__ */ e.jsxs(Me, { gap: 4, children: [
2768
2787
  /* @__PURE__ */ e.jsx(se, { colorScheme: "gray", isDisabled: c, onClick: a, children: "Cancel" }),
2769
2788
  /* @__PURE__ */ e.jsx(
@@ -2785,89 +2804,89 @@ const Mn = ({
2785
2804
  isView: n,
2786
2805
  metadataKeys: a
2787
2806
  }) => {
2788
- const [m, g] = B({}), u = rt();
2807
+ const [p, x] = B({}), d = rt();
2789
2808
  return ie(() => {
2790
- const h = (a ?? []).map(
2791
- (p) => u.query(nt, { key: p })
2809
+ const u = (a ?? []).map(
2810
+ (h) => d.query(nt, { key: h })
2792
2811
  );
2793
- Promise.all(h).then((p) => {
2812
+ Promise.all(u).then((h) => {
2794
2813
  const s = {};
2795
- p.forEach((i) => {
2814
+ h.forEach((i) => {
2796
2815
  if (i.error || !i.data) return;
2797
- const x = S(
2816
+ const g = L(
2798
2817
  je,
2799
2818
  i.data.getMetadataByKey
2800
- ), M = S(
2819
+ ), w = L(
2801
2820
  be,
2802
- x.data
2821
+ g.data
2803
2822
  );
2804
- s[x.key] = M.map((w) => ({
2805
- label: w.label || w.value,
2806
- value: w.value,
2807
- id: w.id
2823
+ s[g.key] = w.map((S) => ({
2824
+ label: S.label || S.value,
2825
+ value: S.value,
2826
+ id: S.id
2808
2827
  }));
2809
- }), g(s);
2828
+ }), x(s);
2810
2829
  });
2811
- }, [u, a]), /* @__PURE__ */ e.jsx(Rt.Provider, { value: { isView: n, metadataOptions: m }, children: r });
2830
+ }, [d, a]), /* @__PURE__ */ e.jsx(Rt.Provider, { value: { isView: n, metadataOptions: p }, children: r });
2812
2831
  }, xs = ({
2813
2832
  id: r,
2814
2833
  onCancel: n,
2815
2834
  onSave: a,
2816
- onError: m,
2817
- hideButtons: g,
2818
- quantumOwned: u,
2819
- setButtonOnClick: h,
2820
- setButtonDisabled: p,
2835
+ onError: p,
2836
+ hideButtons: x,
2837
+ quantumOwned: d,
2838
+ setButtonOnClick: u,
2839
+ setButtonDisabled: h,
2821
2840
  isView: s
2822
2841
  }) => {
2823
- const [{ data: i, fetching: x }] = Ce({
2824
- query: u ? cn : dn
2825
- }), [{ data: M }] = Ce({
2842
+ const [{ data: i, fetching: g }] = Ce({
2843
+ query: d ? cn : dn
2844
+ }), [{ data: w }] = Ce({
2826
2845
  query: un,
2827
2846
  variables: { id: r },
2828
2847
  pause: !r
2829
- }), [{ data: w }] = Ce({
2848
+ }), [{ data: S }] = Ce({
2830
2849
  query: mn
2831
- }), I = S(
2850
+ }), M = L(
2832
2851
  $e,
2833
- w?.moduleCategories
2834
- ), [{ fetching: L }, y] = fe(Ot), [{ fetching: c }, d] = fe(Mt), v = k(() => !i || x ? [] : S(
2852
+ S?.moduleCategories
2853
+ ), [{ fetching: I }, y] = fe(Ot), [{ fetching: c }, m] = fe(Mt), v = k(() => !i || g ? [] : L(
2835
2854
  ve,
2836
- u ? i?.quantumOwnedActions ?? [] : i?.actions ?? []
2837
- ).filter((l) => !!l?.id), [i, u, x]), j = S(Qe, M?.module), O = k(() => S(At, j?.moduleActions) ?? [], [j?.moduleActions]), [$, F] = B([
2838
- ...O.map((K) => K.actionId) ?? []
2839
- ]), [A, N] = B(j?.name ?? ""), [H, oe] = B([]), [R, Z] = B(j?.description ?? ""), [V, T] = B([]), [_, J] = B({});
2855
+ d ? i?.quantumOwnedActions ?? [] : i?.actions ?? []
2856
+ ).filter((l) => !!l?.id), [i, d, g]), j = L(Qe, w?.module), A = k(() => L(At, j?.moduleActions) ?? [], [j?.moduleActions]), [$, F] = B([
2857
+ ...A.map((K) => K.actionId) ?? []
2858
+ ]), [O, N] = B(j?.name ?? ""), [H, oe] = B([]), [R, Z] = B(j?.description ?? ""), [V, T] = B([]), [_, J] = B({});
2840
2859
  ie(() => {
2841
2860
  if (j) {
2842
- F(O.map((o) => o.actionId)), N(j.name), Z(j.description ?? ""), oe(
2861
+ F(A.map((o) => o.actionId)), N(j.name), Z(j.description ?? ""), oe(
2843
2862
  j.categories.map(
2844
- (o) => S($e, o).id
2863
+ (o) => L($e, o).id
2845
2864
  ) ?? []
2846
2865
  );
2847
- const l = S(
2866
+ const l = L(
2848
2867
  je,
2849
2868
  j.metadataGroups
2850
2869
  ).map(
2851
- (o) => o.data.map((b) => S(be, b).id)
2870
+ (o) => o.data.map((b) => L(be, b).id)
2852
2871
  );
2853
2872
  T(l.flat());
2854
2873
  const t = {};
2855
- O.forEach((o) => {
2874
+ A.forEach((o) => {
2856
2875
  t[o.actionId] = o.reportId || null;
2857
2876
  }), J(t);
2858
2877
  }
2859
- }, [j, O]);
2860
- const W = G(() => {
2878
+ }, [j, A]);
2879
+ const W = P(() => {
2861
2880
  let K;
2862
2881
  const l = Object.entries(_).map(([o, b]) => ({
2863
2882
  actionId: o,
2864
2883
  reportId: b
2865
2884
  })).filter(({ reportId: o }) => o !== null), t = {
2866
2885
  actions: $,
2867
- name: A,
2886
+ name: O,
2868
2887
  categories: H.filter((o) => o !== "other"),
2869
2888
  description: R,
2870
- quantumOwned: u,
2889
+ quantumOwned: d,
2871
2890
  metadataItemIds: V,
2872
2891
  actionReports: l.filter(({ reportId: o }) => o !== null).map(({ actionId: o, reportId: b }) => ({
2873
2892
  actionId: o,
@@ -2877,50 +2896,50 @@ const Mn = ({
2877
2896
  j ? K = y({
2878
2897
  id: j.id,
2879
2898
  input: t
2880
- }) : K = d({
2899
+ }) : K = m({
2881
2900
  input: t
2882
2901
  }), K.then(({ error: o }) => {
2883
- o ? m(o instanceof Error ? o : new Error(String(o))) : a();
2902
+ o ? p(o instanceof Error ? o : new Error(String(o))) : a();
2884
2903
  });
2885
2904
  }, [
2886
- d,
2905
+ m,
2887
2906
  y,
2888
2907
  $,
2889
- A,
2908
+ O,
2890
2909
  R,
2891
2910
  H,
2892
2911
  V,
2893
2912
  _,
2894
2913
  j,
2895
2914
  a,
2896
- m,
2897
- u
2915
+ p,
2916
+ d
2898
2917
  ]);
2899
2918
  return ie(() => {
2900
- p && p({
2901
- cancelButton: L || c,
2902
- saveButton: L || c || !A || R.trim().split(/\s+/).filter(Boolean).length > 40
2903
- });
2904
- }, [p, L, c, $, A, R]), ie(() => {
2905
2919
  h && h({
2920
+ cancelButton: I || c,
2921
+ saveButton: I || c || !O || R.trim().split(/\s+/).filter(Boolean).length > 40
2922
+ });
2923
+ }, [h, I, c, $, O, R]), ie(() => {
2924
+ u && u({
2906
2925
  cancelButton: n,
2907
2926
  saveButton: W
2908
2927
  });
2909
- }, [h, n, W]), /* @__PURE__ */ e.jsx(te, { width: "100%", children: /* @__PURE__ */ e.jsxs(
2928
+ }, [u, n, W]), /* @__PURE__ */ e.jsx(te, { width: "100%", children: /* @__PURE__ */ e.jsxs(
2910
2929
  Hn,
2911
2930
  {
2912
2931
  isView: s,
2913
2932
  metadataKeys: ["activity_type", "session_type", "body_region", "sport"],
2914
2933
  children: [
2915
2934
  /* @__PURE__ */ e.jsx(
2916
- Gn,
2935
+ Pn,
2917
2936
  {
2918
- name: A,
2937
+ name: O,
2919
2938
  setName: N,
2920
2939
  actions: v,
2921
2940
  selectedActionIds: $,
2922
2941
  setSelectedActionIds: F,
2923
- availableCategories: I ?? [],
2942
+ availableCategories: M ?? [],
2924
2943
  selectedCategoryIds: H,
2925
2944
  setSelectedCategoryIds: oe,
2926
2945
  description: R,
@@ -2931,12 +2950,12 @@ const Mn = ({
2931
2950
  setActionReportIds: J
2932
2951
  }
2933
2952
  ),
2934
- !g && !s && /* @__PURE__ */ e.jsx(re, { justifyContent: "flex-start", children: /* @__PURE__ */ e.jsxs(Me, { mt: 16, gap: 4, children: [
2953
+ !x && !s && /* @__PURE__ */ e.jsx(re, { justifyContent: "flex-start", children: /* @__PURE__ */ e.jsxs(Me, { mt: 16, gap: 4, children: [
2935
2954
  /* @__PURE__ */ e.jsx(
2936
2955
  se,
2937
2956
  {
2938
2957
  colorScheme: "gray",
2939
- isDisabled: L || c,
2958
+ isDisabled: I || c,
2940
2959
  onClick: n,
2941
2960
  children: "Cancel"
2942
2961
  }
@@ -2945,8 +2964,8 @@ const Mn = ({
2945
2964
  se,
2946
2965
  {
2947
2966
  colorScheme: "blue",
2948
- isDisabled: L || c || !A || R.trim().split(/\s+/).filter(Boolean).length > 40,
2949
- isLoading: L || c,
2967
+ isDisabled: I || c || !O || R.trim().split(/\s+/).filter(Boolean).length > 40,
2968
+ isLoading: I || c,
2950
2969
  onClick: W,
2951
2970
  children: "Save"
2952
2971
  }
@@ -2957,10 +2976,10 @@ const Mn = ({
2957
2976
  ) });
2958
2977
  };
2959
2978
  export {
2960
- Pn as ActivityList,
2979
+ Gn as ActivityList,
2961
2980
  hs as CopyActivityForm,
2962
2981
  ps as CopyModuleForm,
2963
- Gn as ModuleForm,
2982
+ Pn as ModuleForm,
2964
2983
  qn as ParameterEditList,
2965
2984
  ft as ParameterEditSelect,
2966
2985
  gs as UpsertActivityForm,