quantum-component-library 1.4.70 → 1.4.71

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,193 +1,193 @@
1
1
  import { j as e } from "./react-jsx-runtime-vendor-OVHDjVDe.js";
2
2
  import "./moment-vendor-DMLRxgRE.js";
3
- import { Flex as Me, InputGroup as dt, InputLeftElement as _t, Icon as wt, Input as ye, FormLabel as _e, ButtonGroup as Ne, Tooltip as at, Button as ne, Box as se, RangeSlider as Et, RangeSliderMark as st, Text as M, RangeSliderTrack as zt, RangeSliderFilledTrack as Bt, RangeSliderThumb as ut, Select as mt, NumberInput as ht, NumberInputField as pt, HStack as V, Tag as Fe, FormControl as X, TableContainer as Ut, Table as Wt, Thead as Qt, Tr as gt, Th as De, Tbody as qt, Td as We, IconButton as rt, Image as Kt, useToast as It, VStack as ue, RadioGroup as St, Radio as Ze, Alert as Ve, AlertIcon as et, Spinner as Lt, useDisclosure as Ht, Modal as Yt, ModalOverlay as Jt, ModalContent as Xt, ModalHeader as Zt, ModalCloseButton as Vt, ModalBody as en, ModalFooter as tn, Badge as Oe, Tabs as nn, TabList as sn, Tab as xt, TabPanels as on, TabPanel as ft, Textarea as Qe, Switch as rn } from "@chakra-ui/react";
4
- import { useMemo as $, useState as q, useEffect as ce, useCallback as E, createContext as an, useContext as ln, memo as Ae, useRef as cn } from "react";
5
- import { getFragmentData as A } from "./generated.js";
6
- import { G as it, M as je, a as be, b as kt, c as dn, C as lt, d as Mt, e as At, R as Ge, f as Pe, T as Te, A as ve, g as un, h as Ot, U as Tt, i as Ye, j as Nt, k as mn, l as hn, m as pn, n as gn, o as xn, p as fn } from "./graphql-DFQnN0la.js";
3
+ import { Flex as Me, InputGroup as ut, InputLeftElement as _t, Icon as at, Input as ye, FormLabel as ze, ButtonGroup as Ne, Tooltip as it, Button as ne, Box as se, RangeSlider as zt, RangeSliderMark as ot, Text as S, RangeSliderTrack as Et, RangeSliderFilledTrack as Bt, RangeSliderThumb as mt, Select as ht, NumberInput as pt, NumberInputField as gt, HStack as V, Tag as Ge, FormControl as X, TableContainer as Ut, Table as Wt, Thead as Qt, Tr as xt, Th as De, Tbody as qt, Td as Qe, IconButton as Ze, Image as Kt, useToast as It, VStack as ue, RadioGroup as St, Radio as Ve, Alert as et, AlertIcon as tt, Spinner as Lt, useDisclosure as Ht, Modal as Yt, ModalOverlay as Jt, ModalContent as Xt, ModalHeader as Zt, ModalCloseButton as Vt, ModalBody as en, ModalFooter as tn, Badge as Oe, Tabs as nn, TabList as sn, Tab as ft, TabPanels as on, TabPanel as jt, Textarea as qe, Switch as rn } from "@chakra-ui/react";
4
+ import { useMemo as N, useState as K, useEffect as ce, useCallback as E, createContext as an, useContext as ln, memo as Ae, useRef as cn } from "react";
5
+ import { getFragmentData as k } from "./generated.js";
6
+ import { G as lt, M as je, a as be, b as kt, c as dn, C as ct, d as Mt, e as At, R as Pe, f as _e, T as Te, A as Ce, g as un, h as Ot, U as Tt, i as Ye, j as Nt, k as mn, l as hn, m as pn, n as gn, o as xn, p as fn } from "./graphql-DFQnN0la.js";
7
7
  import { c as Je } from "./utils-cn-CgdSr4hO.js";
8
- import { sensorLocationName as jn, availablePlanes as jt, getAnalysisPartIdNoSide as qe } from "./types.js";
8
+ import { sensorLocationName as jn, availablePlanes as bt, getAnalysisPartIdNoSide as Ke } from "./types.js";
9
9
  import "./lodash-vendor-Deq42ySR.js";
10
- import { useClient as ct, useQuery as Ce, useMutation as fe } from "urql";
10
+ import { useClient as dt, useQuery as ve, useMutation as fe } from "urql";
11
11
  import { useUiLabelContext as xe, useAllPartParameters as bn } from "./hooks.js";
12
12
  import { u as yn } from "./ufuzzy-vendor-Dl0ZI6Av.js";
13
13
  import { s as he } from "./react-select-vendor-B-vWCyYj.js";
14
- import { F as vn, a as Cn, b as wn, c as In, d as Sn, e as Ln } from "./react-icons-vendor-DqOJrTLA.js";
14
+ import { F as Cn, a as vn, b as wn, c as In, d as Sn, e as Ln, f as kn } from "./react-icons-vendor-bPI9-m-x.js";
15
15
  import { reportKindName as ke } from "./services.js";
16
- import { D as kn, H as Mn, u as An, a as On } from "./react-dnd-vendor-D7ujbWN2.js";
17
- import { g as Rt, a as $t, b as Tn, c as Nn, d as Rn, e as bt, f as yt } from "./services-human-mjbBM3xQ.js";
18
- import { ThresholdKind as Xe, ReportKind as ie, ActionLaterality as $n, SensorLocation as me } from "./generated-graphql.js";
19
- import { f as ot } from "./utils-parameters-BiyUnm5t.js";
20
- const Dn = ({
21
- setSearch: s,
16
+ import { D as Mn, H as An, u as On, a as Tn } from "./react-dnd-vendor-D7ujbWN2.js";
17
+ import { g as Rt, a as $t, b as Nn, c as Rn, d as $n, e as yt, f as Ct } from "./services-human-mjbBM3xQ.js";
18
+ import { ThresholdKind as Xe, ReportKind as ie, ActionLaterality as Dn, SensorLocation as me } from "./generated-graphql.js";
19
+ import { f as rt } from "./utils-parameters-BiyUnm5t.js";
20
+ const Fn = ({
21
+ setSearch: n,
22
22
  actions: t,
23
23
  updateUseCases: r,
24
- hideUseCaseFilter: p = !1
24
+ hideUseCaseFilter: g = !1
25
25
  }) => {
26
- const m = $(
27
- () => t?.flatMap((h) => h.useCases).filter((h, d, g) => g.findIndex((n) => n.id === h.id) === d).map((h) => ({
28
- label: h.name,
29
- value: h.id
26
+ const u = N(
27
+ () => t?.flatMap((m) => m.useCases).filter((m, h, x) => x.findIndex((s) => s.id === m.id) === h).map((m) => ({
28
+ label: m.name,
29
+ value: m.id
30
30
  })) || [],
31
31
  [t]
32
32
  );
33
33
  return /* @__PURE__ */ e.jsxs(Me, { width: "100%", alignContent: "space-evenly", gap: 4, children: [
34
- /* @__PURE__ */ e.jsxs(dt, { size: "md", flex: 1, children: [
35
- /* @__PURE__ */ e.jsx(_t, { children: /* @__PURE__ */ e.jsx(wt, { as: vn, color: "gray.300" }) }),
34
+ /* @__PURE__ */ e.jsxs(ut, { size: "md", flex: 1, children: [
35
+ /* @__PURE__ */ e.jsx(_t, { children: /* @__PURE__ */ e.jsx(at, { as: Cn, color: "gray.300" }) }),
36
36
  /* @__PURE__ */ e.jsx(
37
37
  ye,
38
38
  {
39
39
  placeholder: "Search by name...",
40
40
  width: "100%",
41
- maxW: p ? void 0 : "30rem",
42
- onChange: (h) => s(h.target.value)
41
+ maxW: g ? void 0 : "30rem",
42
+ onChange: (m) => n(m.target.value)
43
43
  }
44
44
  )
45
45
  ] }),
46
- !p && /* @__PURE__ */ e.jsx(dt, { size: "md", children: /* @__PURE__ */ e.jsx(
46
+ !g && /* @__PURE__ */ e.jsx(ut, { size: "md", children: /* @__PURE__ */ e.jsx(
47
47
  he,
48
48
  {
49
49
  size: "md",
50
50
  chakraStyles: {
51
- container: (h) => ({
52
- ...h,
51
+ container: (m) => ({
52
+ ...m,
53
53
  width: "100%"
54
54
  })
55
55
  },
56
56
  menuPortalTarget: document.body,
57
57
  placeholder: "Filter use case",
58
58
  isMulti: !0,
59
- options: m,
60
- onChange: (h) => r(h.map((d) => d.value))
59
+ options: u,
60
+ onChange: (m) => r(m.map((h) => h.value))
61
61
  }
62
62
  ) })
63
63
  ] });
64
64
  }, ge = ({
65
- children: s
66
- }) => /* @__PURE__ */ e.jsx(_e, { fontWeight: "bold", fontFamily: "sans-serif", fontSize: "large", children: s }), Fn = ({
67
- items: s,
65
+ children: n
66
+ }) => /* @__PURE__ */ e.jsx(ze, { fontWeight: "bold", fontFamily: "sans-serif", fontSize: "large", children: n }), Gn = ({
67
+ items: n,
68
68
  onChange: t,
69
69
  selectedItem: r,
70
- isDisabled: p,
71
- selectedProps: m,
72
- buttonProps: h
70
+ isDisabled: g,
71
+ selectedProps: u,
72
+ buttonProps: m
73
73
  }) => {
74
- const d = (n) => n === r || n.value === r, g = (n) => d(n) ? { ...h, ...m } : h;
75
- return /* @__PURE__ */ e.jsx(Ne, { isAttached: !0, isDisabled: p, children: s.map((n, o) => /* @__PURE__ */ e.jsx(
76
- at,
74
+ const h = (s) => s === r || s.value === r, x = (s) => h(s) ? { ...m, ...u } : m;
75
+ return /* @__PURE__ */ e.jsx(Ne, { isAttached: !0, isDisabled: g, children: n.map((s, o) => /* @__PURE__ */ e.jsx(
76
+ it,
77
77
  {
78
- label: n.tooltip,
78
+ label: s.tooltip,
79
79
  openDelay: 50,
80
80
  closeDelay: 200,
81
81
  placement: "top",
82
- visibility: n.tooltip ? "visible" : "hidden",
82
+ visibility: s.tooltip ? "visible" : "hidden",
83
83
  hasArrow: !0,
84
84
  children: /* @__PURE__ */ e.jsx(
85
85
  ne,
86
86
  {
87
- onClick: () => d(n) ? null : t(n, o),
88
- isDisabled: n.disabled,
89
- ...g(n),
90
- children: n.label
87
+ onClick: () => h(s) ? null : t(s, o),
88
+ isDisabled: s.disabled,
89
+ ...x(s),
90
+ children: s.label
91
91
  }
92
92
  )
93
93
  },
94
94
  o
95
95
  )) });
96
- }, Ke = (s, t) => t < 0 ? -1 * Math.abs(s) : Math.abs(s), Gn = ({
97
- isReversed: s,
96
+ }, He = (n, t) => t < 0 ? -1 * Math.abs(n) : Math.abs(n), Pn = ({
97
+ isReversed: n,
98
98
  min: t,
99
99
  max: r,
100
- value: p,
101
- onChange: m,
102
- inputProps: h,
103
- size: d,
104
- zeroMarker: g,
105
- formatValue: n,
100
+ value: g,
101
+ onChange: u,
102
+ inputProps: m,
103
+ size: h,
104
+ zeroMarker: x,
105
+ formatValue: s,
106
106
  valueLabel: o,
107
- positiveNegativeLabels: u,
108
- isDisabled: y,
109
- ...b
107
+ positiveNegativeLabels: b,
108
+ isDisabled: j,
109
+ ...L
110
110
  }) => {
111
- const [w, I] = q([void 0, void 0]), L = w[0], f = w[1], c = g && t < -5 && r > 5, k = Number(p?.[0] ?? f ?? t) > 0 ? 1 : -1, x = Number(p?.[1] ?? f ?? r) < 0 ? -1 : 1, N = u?.[0] === u?.[1], v = p?.[0], z = p?.[1];
111
+ const [M, f] = K([void 0, void 0]), C = M[0], p = M[1], c = x && t < -5 && r > 5, A = Number(g?.[0] ?? p ?? t) > 0 ? 1 : -1, d = Number(g?.[1] ?? p ?? r) < 0 ? -1 : 1, D = b?.[0] === b?.[1], v = g?.[0], z = g?.[1];
112
112
  ce(() => {
113
- v !== void 0 && z !== void 0 && I([v.toFixed(0), z.toFixed(0)]);
114
- }, [v, z, I]);
115
- const R = E(
116
- ([T, U]) => {
117
- T < U && I([T.toFixed(0), U.toFixed(0)]);
113
+ v !== void 0 && z !== void 0 && f([v.toFixed(0), z.toFixed(0)]);
114
+ }, [v, z, f]);
115
+ const T = E(
116
+ ([O, W]) => {
117
+ O < W && f([O.toFixed(0), W.toFixed(0)]);
118
118
  },
119
- [I]
120
- ), O = E(
121
- ([T, U]) => {
122
- T < U && m([T, U]);
119
+ [f]
120
+ ), F = E(
121
+ ([O, W]) => {
122
+ O < W && u([O, W]);
123
123
  },
124
- [m]
125
- ), K = E(() => {
126
- I(([T, U]) => {
127
- const J = isNaN(Number(T)) ? t : Number(T), B = isNaN(Number(U)) ? r : Number(U), Y = Ke(Number(J), k), i = Ke(Number(B), x), a = k < 0 ? Math.max(Y, t) : Math.min(Y, r), C = x < 0 ? Math.max(i, t) : Math.min(i, r);
128
- return a > C ? (m([C, a]), [C.toFixed(0), a.toFixed(0)]) : (m([a, C]), [a.toFixed(0), C.toFixed(0)]);
124
+ [u]
125
+ ), G = E(() => {
126
+ f(([O, W]) => {
127
+ const J = isNaN(Number(O)) ? t : Number(O), U = isNaN(Number(W)) ? r : Number(W), Y = He(Number(J), A), i = He(Number(U), d), a = A < 0 ? Math.max(Y, t) : Math.min(Y, r), w = d < 0 ? Math.max(i, t) : Math.min(i, r);
128
+ return a > w ? (u([w, a]), [w.toFixed(0), a.toFixed(0)]) : (u([a, w]), [a.toFixed(0), w.toFixed(0)]);
129
129
  });
130
- }, [m, I, k, x, t, r]), oe = E(
131
- (T) => {
132
- const U = T === "" || isNaN(Number(T)) ? T : Ke(Number(T), k);
133
- I(([J, B]) => [U.toString(), B]);
130
+ }, [u, f, A, d, t, r]), oe = E(
131
+ (O) => {
132
+ const W = O === "" || isNaN(Number(O)) ? O : He(Number(O), A);
133
+ f(([J, U]) => [W.toString(), U]);
134
134
  },
135
- [I, k]
136
- ), G = E(
137
- (T) => {
138
- const U = T === "" || isNaN(Number(T)) ? T : Ke(Number(T), x);
139
- I(([J, B]) => [J, U.toString()]);
135
+ [f, A]
136
+ ), P = E(
137
+ (O) => {
138
+ const W = O === "" || isNaN(Number(O)) ? O : He(Number(O), d);
139
+ f(([J, U]) => [J, W.toString()]);
140
140
  },
141
- [I, x]
142
- ), ae = $(
143
- () => d === "xs" ? "0.75rem" : void 0,
144
- [d]
141
+ [f, d]
142
+ ), ae = N(
143
+ () => h === "xs" ? "0.75rem" : void 0,
144
+ [h]
145
145
  ), Z = E(
146
- (T, U) => {
147
- const J = Number(U.target.value);
148
- if (!L || !f || ![-1, 1].includes(J))
146
+ (O, W) => {
147
+ const J = Number(W.target.value);
148
+ if (!C || !p || ![-1, 1].includes(J))
149
149
  return;
150
- const B = (a) => J < 0 ? -1 * Math.abs(a) : Math.abs(a), Y = T ? B(Number(L)) : Number(L), i = T ? Number(f) : B(Number(f));
151
- Y > i ? m([i, Y]) : m([Y, i]);
150
+ const U = (a) => J < 0 ? -1 * Math.abs(a) : Math.abs(a), Y = O ? U(Number(C)) : Number(C), i = O ? Number(p) : U(Number(p));
151
+ Y > i ? u([i, Y]) : u([Y, i]);
152
152
  },
153
- [L, f, m]
153
+ [C, p, u]
154
154
  );
155
- return /* @__PURE__ */ e.jsxs(Me, { direction: "column", ...b, children: [
155
+ return /* @__PURE__ */ e.jsxs(Me, { direction: "column", ...L, children: [
156
156
  /* @__PURE__ */ e.jsx(se, { pt: "1em", mb: "-0.5em", children: /* @__PURE__ */ e.jsxs(
157
- Et,
157
+ zt,
158
158
  {
159
159
  "aria-label": ["min", "max"],
160
- isReversed: s,
161
- value: [Number(L ?? t), Number(f ?? r)],
160
+ isReversed: n,
161
+ value: [Number(C ?? t), Number(p ?? r)],
162
162
  max: r,
163
163
  min: t,
164
164
  minStepsBetweenThumbs: 3,
165
165
  step: 1,
166
- onChange: R,
167
- onChangeEnd: O,
168
- isDisabled: y,
166
+ onChange: T,
167
+ onChangeEnd: F,
168
+ isDisabled: j,
169
169
  children: [
170
- /* @__PURE__ */ e.jsx(st, { value: t, top: "-1em", children: /* @__PURE__ */ e.jsx(
171
- M,
170
+ /* @__PURE__ */ e.jsx(ot, { value: t, top: "-1em", children: /* @__PURE__ */ e.jsx(
171
+ S,
172
172
  {
173
- fontSize: d ?? "sm",
173
+ fontSize: h ?? "sm",
174
174
  fontWeight: "semibold",
175
175
  whiteSpace: "nowrap",
176
- children: n ? n?.(t) : t
176
+ children: s ? s?.(t) : t
177
177
  }
178
178
  ) }),
179
- /* @__PURE__ */ e.jsx(st, { value: r, top: "-1em", children: /* @__PURE__ */ e.jsx(
180
- M,
179
+ /* @__PURE__ */ e.jsx(ot, { value: r, top: "-1em", children: /* @__PURE__ */ e.jsx(
180
+ S,
181
181
  {
182
- fontSize: d ?? "sm",
182
+ fontSize: h ?? "sm",
183
183
  fontWeight: "semibold",
184
184
  style: { transform: "translateX(-100%)" },
185
185
  whiteSpace: "nowrap",
186
- children: n ? n(r) : r
186
+ children: s ? s(r) : r
187
187
  }
188
188
  ) }),
189
- c && /* @__PURE__ */ e.jsxs(st, { value: 0, top: "-1em", pos: "relative", children: [
190
- /* @__PURE__ */ e.jsx(M, { fontSize: d, fontWeight: "semibold", children: n?.(0) ?? "0" }),
189
+ c && /* @__PURE__ */ e.jsxs(ot, { value: 0, top: "-1em", pos: "relative", children: [
190
+ /* @__PURE__ */ e.jsx(S, { fontSize: h, fontWeight: "semibold", children: s?.(0) ?? "0" }),
191
191
  /* @__PURE__ */ e.jsx(
192
192
  se,
193
193
  {
@@ -200,31 +200,31 @@ const Dn = ({
200
200
  }
201
201
  )
202
202
  ] }),
203
- /* @__PURE__ */ e.jsx(zt, { children: /* @__PURE__ */ e.jsx(Bt, {}) }),
204
- /* @__PURE__ */ e.jsx(ut, { index: 0, w: ae, h: ae }),
205
- /* @__PURE__ */ e.jsx(ut, { index: 1, w: ae, h: ae })
203
+ /* @__PURE__ */ e.jsx(Et, { children: /* @__PURE__ */ e.jsx(Bt, {}) }),
204
+ /* @__PURE__ */ e.jsx(mt, { index: 0, w: ae, h: ae }),
205
+ /* @__PURE__ */ e.jsx(mt, { index: 1, w: ae, h: ae })
206
206
  ]
207
207
  }
208
208
  ) }),
209
209
  o && /* @__PURE__ */ e.jsxs(
210
210
  Me,
211
211
  {
212
- direction: s ? "row-reverse" : "row",
212
+ direction: n ? "row-reverse" : "row",
213
213
  justifyContent: "space-between",
214
214
  children: [
215
215
  /* @__PURE__ */ e.jsx(
216
- M,
216
+ S,
217
217
  {
218
- fontSize: d ?? "sm",
218
+ fontSize: h ?? "sm",
219
219
  fontWeight: "semibold",
220
220
  whiteSpace: "nowrap",
221
221
  children: o(t)
222
222
  }
223
223
  ),
224
224
  /* @__PURE__ */ e.jsx(
225
- M,
225
+ S,
226
226
  {
227
- fontSize: d ?? "sm",
227
+ fontSize: h ?? "sm",
228
228
  fontWeight: "semibold",
229
229
  whiteSpace: "nowrap",
230
230
  children: o(r)
@@ -236,43 +236,43 @@ const Dn = ({
236
236
  /* @__PURE__ */ e.jsxs(
237
237
  Me,
238
238
  {
239
- direction: s ? "row-reverse" : "row",
239
+ direction: n ? "row-reverse" : "row",
240
240
  justifyContent: "center",
241
241
  alignItems: "center",
242
242
  gap: "0.125em",
243
243
  children: [
244
- u && /* @__PURE__ */ e.jsxs(
245
- mt,
244
+ b && /* @__PURE__ */ e.jsxs(
245
+ ht,
246
246
  {
247
247
  width: "auto",
248
- size: d,
248
+ size: h,
249
249
  fontWeight: "bold",
250
- value: k,
251
- onChange: (T) => Z(!0, T),
252
- isDisabled: N || y,
250
+ value: A,
251
+ onChange: (O) => Z(!0, O),
252
+ isDisabled: D || j,
253
253
  children: [
254
- /* @__PURE__ */ e.jsx("option", { value: -1, children: u[0] }),
255
- /* @__PURE__ */ e.jsx("option", { value: 1, children: u[1] })
254
+ /* @__PURE__ */ e.jsx("option", { value: -1, children: b[0] }),
255
+ /* @__PURE__ */ e.jsx("option", { value: 1, children: b[1] })
256
256
  ]
257
257
  }
258
258
  ),
259
259
  /* @__PURE__ */ e.jsx(
260
- ht,
260
+ pt,
261
261
  {
262
262
  precision: 0,
263
- size: d ?? "sm",
263
+ size: h ?? "sm",
264
264
  min: 0,
265
- max: k < 0 ? Math.abs(t) : z ?? r,
266
- value: L === "" ? "" : Math.abs(Number(L ?? t)),
265
+ max: A < 0 ? Math.abs(t) : z ?? r,
266
+ value: C === "" ? "" : Math.abs(Number(C ?? t)),
267
267
  onChange: oe,
268
- onBlur: K,
268
+ onBlur: G,
269
269
  borderWidth: 1,
270
270
  borderRadius: 3,
271
271
  borderColor: "#ccc",
272
- isDisabled: y,
273
- ...h,
272
+ isDisabled: j,
273
+ ...m,
274
274
  children: /* @__PURE__ */ e.jsx(
275
- pt,
275
+ gt,
276
276
  {
277
277
  backgroundColor: "#fff",
278
278
  paddingRight: 0,
@@ -282,22 +282,22 @@ const Dn = ({
282
282
  }
283
283
  ),
284
284
  /* @__PURE__ */ e.jsx(
285
- ht,
285
+ pt,
286
286
  {
287
- size: d ?? "sm",
287
+ size: h ?? "sm",
288
288
  min: 0,
289
- max: x < 0 ? Math.abs(v ?? t) : r,
289
+ max: d < 0 ? Math.abs(v ?? t) : r,
290
290
  precision: 0,
291
- value: f === "" ? "" : Math.abs(Number(f ?? r)),
292
- onChange: G,
293
- onBlur: K,
291
+ value: p === "" ? "" : Math.abs(Number(p ?? r)),
292
+ onChange: P,
293
+ onBlur: G,
294
294
  borderWidth: 1,
295
295
  borderRadius: 3,
296
296
  borderColor: "#ccc",
297
- isDisabled: y,
298
- ...h,
297
+ isDisabled: j,
298
+ ...m,
299
299
  children: /* @__PURE__ */ e.jsx(
300
- pt,
300
+ gt,
301
301
  {
302
302
  backgroundColor: "#fff",
303
303
  paddingRight: 0,
@@ -306,18 +306,18 @@ const Dn = ({
306
306
  )
307
307
  }
308
308
  ),
309
- u && /* @__PURE__ */ e.jsxs(
310
- mt,
309
+ b && /* @__PURE__ */ e.jsxs(
310
+ ht,
311
311
  {
312
312
  width: "auto",
313
- size: d,
313
+ size: h,
314
314
  fontWeight: "bold",
315
- value: x,
316
- onChange: (T) => Z(!1, T),
317
- isDisabled: N || y,
315
+ value: d,
316
+ onChange: (O) => Z(!1, O),
317
+ isDisabled: D || j,
318
318
  children: [
319
- /* @__PURE__ */ e.jsx("option", { value: -1, children: u[0] }),
320
- /* @__PURE__ */ e.jsx("option", { value: 1, children: u[1] })
319
+ /* @__PURE__ */ e.jsx("option", { value: -1, children: b[0] }),
320
+ /* @__PURE__ */ e.jsx("option", { value: 1, children: b[1] })
321
321
  ]
322
322
  }
323
323
  )
@@ -325,17 +325,17 @@ const Dn = ({
325
325
  }
326
326
  )
327
327
  ] });
328
- }, Pn = ({ tags: s, containerProps: t, ...r }) => /* @__PURE__ */ e.jsx(V, { ...t, children: s.map((p, m) => /* @__PURE__ */ e.jsx(Fe, { ...r, children: p }, m)) }), _n = new yn({}), En = ({
329
- action: s,
328
+ }, _n = ({ tags: n, containerProps: t, ...r }) => /* @__PURE__ */ e.jsx(V, { ...t, children: n.map((g, u) => /* @__PURE__ */ e.jsx(Ge, { ...r, children: g }, u)) }), zn = new yn({}), En = ({
329
+ action: n,
330
330
  quantumIconSrc: t
331
331
  }) => {
332
- const { getLabel: r } = xe(), p = $(() => ({
332
+ const { getLabel: r } = xe(), g = N(() => ({
333
333
  actionLowerCase: r("action").toLocaleLowerCase()
334
334
  }), [r]);
335
- return s.quantumOwned ? /* @__PURE__ */ e.jsx(
336
- at,
335
+ return n.quantumOwned ? /* @__PURE__ */ e.jsx(
336
+ it,
337
337
  {
338
- label: `This ${p.actionLowerCase} is owned by Quantum`,
338
+ label: `This ${g.actionLowerCase} is owned by Quantum`,
339
339
  "aria-label": "Quantum owned",
340
340
  children: /* @__PURE__ */ e.jsx(
341
341
  se,
@@ -351,72 +351,72 @@ const Dn = ({
351
351
  {
352
352
  src: t,
353
353
  boxSize: "1em",
354
- alt: `Quantum-owned ${p.actionLowerCase}`
354
+ alt: `Quantum-owned ${g.actionLowerCase}`
355
355
  }
356
356
  )
357
357
  }
358
358
  )
359
359
  }
360
360
  ) : null;
361
- }, zn = (s, t) => {
361
+ }, Bn = (n, t) => {
362
362
  if (!t || !t.trim().length)
363
- return s;
364
- const r = s.map((m) => m.name ?? "");
365
- return _n.filter(r, t)?.map((m) => s[m]) ?? [];
366
- }, Bn = (s) => !s || s.length === 0 ? "None" : s.map((t) => jn(t)).join(", "), Un = (s, t) => !t || t.length == 0 ? s : s.filter(
367
- (r) => r.useCases?.some((p) => t.includes(p.id)) ?? !1
368
- ), Wn = (s, t, r) => !t || t.length === 0 ? s : s.filter((p) => {
369
- const m = {};
370
- return t.forEach((h) => {
371
- for (const [d, g] of Object.entries(r || {}))
372
- if (g.some((n) => n.id === h)) {
373
- m[d] || (m[d] = []), m[d].push(h);
363
+ return n;
364
+ const r = n.map((u) => u.name ?? "");
365
+ return zn.filter(r, t)?.map((u) => n[u]) ?? [];
366
+ }, Un = (n) => !n || n.length === 0 ? "None" : n.map((t) => jn(t)).join(", "), Wn = (n, t) => !t || t.length == 0 ? n : n.filter(
367
+ (r) => r.useCases?.some((g) => t.includes(g.id)) ?? !1
368
+ ), Qn = (n, t, r) => !t || t.length === 0 ? n : n.filter((g) => {
369
+ const u = {};
370
+ return t.forEach((m) => {
371
+ for (const [h, x] of Object.entries(r || {}))
372
+ if (x.some((s) => s.id === m)) {
373
+ u[h] || (u[h] = []), u[h].push(m);
374
374
  break;
375
375
  }
376
- }), Object.entries(m).every(
377
- ([h, d]) => {
378
- const g = p.metadataGroups?.find((y) => A(je, y).key === h);
379
- if (!g)
376
+ }), Object.entries(u).every(
377
+ ([m, h]) => {
378
+ const x = g.metadataGroups?.find((j) => k(je, j).key === m);
379
+ if (!x)
380
380
  return !1;
381
- const n = A(
381
+ const s = k(
382
382
  je,
383
- g
384
- ), u = A(
383
+ x
384
+ ), b = k(
385
385
  be,
386
- n.data
387
- ).map((y) => y.id);
388
- return d.some(
389
- (y) => u.includes(y)
386
+ s.data
387
+ ).map((j) => j.id);
388
+ return h.some(
389
+ (j) => b.includes(j)
390
390
  );
391
391
  }
392
392
  );
393
- }), Qn = ({
394
- actions: s,
393
+ }), qn = ({
394
+ actions: n,
395
395
  totalActions: t,
396
396
  onCreate: r,
397
- onDelete: p,
398
- onEdit: m,
399
- onView: h,
400
- onSelected: d,
401
- onDuplicate: g,
402
- disableMultiSelect: n,
397
+ onDelete: g,
398
+ onEdit: u,
399
+ onView: m,
400
+ onSelected: h,
401
+ onDuplicate: x,
402
+ disableMultiSelect: s,
403
403
  disableDelete: o,
404
- disableEdit: u,
405
- disableCreate: y,
406
- hideUseCase: b = !0,
407
- showMetadataFilters: w = !0,
408
- tableProps: I,
409
- containerProps: L,
410
- quantumIconSrc: f = "/favicon.ico",
404
+ disableEdit: b,
405
+ disableCreate: j,
406
+ hideUseCase: L = !0,
407
+ showMetadataFilters: M = !0,
408
+ tableProps: f,
409
+ containerProps: C,
410
+ quantumIconSrc: p = "/favicon.ico",
411
411
  allowDuplicateSelection: c = !1,
412
- getSelectedCount: k
412
+ getSelectedCount: A
413
413
  }) => {
414
- const [x, N] = q(""), [v, z] = q(), [R, O] = q([]), [K, oe] = q({}), { getLabel: G } = xe(), ae = ct(), Z = $(() => ({
415
- action: G("action"),
416
- actionPlural: G("action_plural"),
417
- actionLowerCase: G("action").toLocaleLowerCase(),
418
- actionPluralLowerCase: G("action_plural").toLocaleLowerCase()
419
- }), [G]), T = $(() => [
414
+ const [d, D] = K(""), [v, z] = K(), [T, F] = K([]), [G, oe] = K({}), { getLabel: P } = xe(), ae = dt(), Z = N(() => ({
415
+ action: P("action"),
416
+ actionPlural: P("action_plural"),
417
+ actionLowerCase: P("action").toLocaleLowerCase(),
418
+ actionPluralLowerCase: P("action_plural").toLocaleLowerCase()
419
+ }), [P]), O = N(() => [
420
420
  { key: "module_category", label: "Link Category", multi: !0 },
421
421
  { key: "activity_type", label: `${Z.action} Type`, multi: !0 },
422
422
  { key: "session_type", label: "Session Type", multi: !0 },
@@ -424,79 +424,79 @@ const Dn = ({
424
424
  { key: "sport", label: "Sport", multi: !0 }
425
425
  ], [Z.action]);
426
426
  ce(() => {
427
- if (!w)
427
+ if (!M)
428
428
  return;
429
- const l = T.map(
430
- (S) => ae.query(it, { key: S.key })
429
+ const l = O.map(
430
+ (I) => ae.query(lt, { key: I.key })
431
431
  );
432
- Promise.all(l).then((S) => {
433
- const W = {};
434
- S.forEach((P) => {
435
- if (P.error || !P.data) return;
436
- const Q = A(
432
+ Promise.all(l).then((I) => {
433
+ const Q = {};
434
+ I.forEach((_) => {
435
+ if (_.error || !_.data) return;
436
+ const q = k(
437
437
  je,
438
- P.data.getMetadataByKey
439
- ), H = A(
438
+ _.data.getMetadataByKey
439
+ ), H = k(
440
440
  be,
441
- Q.data
441
+ q.data
442
442
  );
443
- W[Q.key] = H.map((re) => ({
443
+ Q[q.key] = H.map((re) => ({
444
444
  label: re.label || re.value,
445
445
  value: re.value,
446
446
  id: re.id
447
447
  }));
448
- }), oe(W);
448
+ }), oe(Q);
449
449
  });
450
- }, [ae, T, w]);
451
- const U = $(() => {
452
- if (!s)
450
+ }, [ae, O, M]);
451
+ const W = N(() => {
452
+ if (!n)
453
453
  return;
454
- const l = zn(s, x), S = b ? l : Un(l, v);
455
- return w ? Wn(
456
- S,
457
- R,
458
- K
459
- ) : S;
454
+ const l = Bn(n, d), I = L ? l : Wn(l, v);
455
+ return M ? Qn(
456
+ I,
457
+ T,
458
+ G
459
+ ) : I;
460
460
  }, [
461
- s,
462
- x,
461
+ n,
462
+ d,
463
463
  v,
464
- b,
465
- w,
466
- R,
467
- K
464
+ L,
465
+ M,
466
+ T,
467
+ G
468
468
  ]), J = E(() => {
469
- if (!p)
470
- return;
471
- const S = s.filter(
472
- (W) => W.selected && !W.quantumOwned
473
- ).map((W) => W.id);
474
- p(S);
475
- }, [s, p]), B = E(() => {
476
469
  if (!g)
477
470
  return;
478
- const l = s.filter((S) => S.selected);
479
- g(l.map((S) => S.id)), d && l.forEach((S) => d(S, !1));
480
- }, [s, g, d]), Y = $(() => s.some((l) => l.selected && !l.quantumOwned), [s]), i = $(() => s.some((l) => l.selected), [s]), a = $(() => s.some((l) => l.selected && l.quantumOwned), [s]), C = E(
481
- (l, S) => {
482
- const W = T.find((Q) => Q.key === l);
483
- if (!W) return;
484
- const P = W.multi ? (S ?? []).map((Q) => Q.id) : S ? [S.id] : [];
485
- O((Q) => [...Q.filter((re) => Object.values(K).flat().find((Ie) => Ie.id === re) && !Object.keys(K).find(
486
- (Ie) => K[Ie]?.some(
471
+ const I = n.filter(
472
+ (Q) => Q.selected && !Q.quantumOwned
473
+ ).map((Q) => Q.id);
474
+ g(I);
475
+ }, [n, g]), U = E(() => {
476
+ if (!x)
477
+ return;
478
+ const l = n.filter((I) => I.selected);
479
+ x(l.map((I) => I.id)), h && l.forEach((I) => h(I, !1));
480
+ }, [n, x, h]), Y = N(() => n.some((l) => l.selected && !l.quantumOwned), [n]), i = N(() => n.some((l) => l.selected), [n]), a = N(() => n.some((l) => l.selected && l.quantumOwned), [n]), w = E(
481
+ (l, I) => {
482
+ const Q = O.find((q) => q.key === l);
483
+ if (!Q) return;
484
+ const _ = Q.multi ? (I ?? []).map((q) => q.id) : I ? [I.id] : [];
485
+ F((q) => [...q.filter((re) => Object.values(G).flat().find((Ie) => Ie.id === re) && !Object.keys(G).find(
486
+ (Ie) => G[Ie]?.some(
487
487
  (Se) => Se.id === re && Ie === l
488
488
  )
489
- )), ...P]);
489
+ )), ..._]);
490
490
  },
491
- [T, K]
491
+ [O, G]
492
492
  );
493
- return /* @__PURE__ */ e.jsxs(se, { ...L, children: [
493
+ return /* @__PURE__ */ e.jsxs(se, { ...C, children: [
494
494
  /* @__PURE__ */ e.jsxs(Me, { alignContent: "space-between", gap: 4, children: [
495
- (r || p || g) && /* @__PURE__ */ e.jsxs(Ne, { mb: "1rem", gap: 4, children: [
495
+ (r || g || x) && /* @__PURE__ */ e.jsxs(Ne, { mb: "1rem", gap: 4, children: [
496
496
  r && /* @__PURE__ */ e.jsxs(
497
497
  ne,
498
498
  {
499
- isDisabled: !r || y,
499
+ isDisabled: !r || j,
500
500
  colorScheme: "blackAlpha",
501
501
  backgroundColor: "gray.700",
502
502
  onClick: r,
@@ -506,8 +506,8 @@ const Dn = ({
506
506
  ]
507
507
  }
508
508
  ),
509
- p && !n && /* @__PURE__ */ e.jsx(
510
- at,
509
+ g && !s && /* @__PURE__ */ e.jsx(
510
+ it,
511
511
  {
512
512
  label: a ? Y ? `Quantum-owned ${Z.actionPluralLowerCase} are selected and will be skipped` : `Selected ${Z.actionPluralLowerCase} are quantum-owned and cannot be deleted` : void 0,
513
513
  shouldWrapChildren: !0,
@@ -515,175 +515,175 @@ const Dn = ({
515
515
  ne,
516
516
  {
517
517
  colorScheme: "gray",
518
- isDisabled: !Y || !p || o,
518
+ isDisabled: !Y || !g || o,
519
519
  onClick: J,
520
520
  children: "Delete Selected"
521
521
  }
522
522
  )
523
523
  }
524
524
  ),
525
- g && !n && /* @__PURE__ */ e.jsx(
525
+ x && !s && /* @__PURE__ */ e.jsx(
526
526
  ne,
527
527
  {
528
528
  colorScheme: "gray",
529
529
  isDisabled: !i,
530
- onClick: B,
530
+ onClick: U,
531
531
  children: "Duplicate Selected"
532
532
  }
533
533
  )
534
534
  ] }),
535
535
  /* @__PURE__ */ e.jsx(
536
- Dn,
536
+ Fn,
537
537
  {
538
- setSearch: N,
539
- actions: s,
538
+ setSearch: D,
539
+ actions: n,
540
540
  updateUseCases: z,
541
- hideUseCaseFilter: b
541
+ hideUseCaseFilter: L
542
542
  }
543
543
  )
544
544
  ] }),
545
- w && K && /* @__PURE__ */ e.jsx(se, { my: 4, children: /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4", children: T.map((l) => /* @__PURE__ */ e.jsxs(X, { children: [
546
- /* @__PURE__ */ e.jsx(_e, { fontSize: "sm", children: l.label }),
545
+ M && G && /* @__PURE__ */ e.jsx(se, { my: 4, children: /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4", children: O.map((l) => /* @__PURE__ */ e.jsxs(X, { children: [
546
+ /* @__PURE__ */ e.jsx(ze, { fontSize: "sm", children: l.label }),
547
547
  /* @__PURE__ */ e.jsx(
548
548
  he,
549
549
  {
550
550
  chakraStyles: {
551
- menu: (S) => ({
552
- ...S,
551
+ menu: (I) => ({
552
+ ...I,
553
553
  zIndex: 2
554
554
  })
555
555
  },
556
556
  isMulti: l.multi,
557
- value: K[l.key]?.filter(
558
- (S) => R.includes(S.id)
557
+ value: G[l.key]?.filter(
558
+ (I) => T.includes(I.id)
559
559
  ),
560
- onChange: (S) => {
561
- C(
560
+ onChange: (I) => {
561
+ w(
562
562
  l.key,
563
- S
563
+ I
564
564
  );
565
565
  },
566
- options: K[l.key],
566
+ options: G[l.key],
567
567
  placeholder: `Select ${l.multi ? "one or more" : "one"} ${l.label.toLowerCase()}`,
568
568
  isClearable: l.multi
569
569
  }
570
570
  )
571
571
  ] }, l.key)) }) }),
572
- /* @__PURE__ */ e.jsx(Ut, { mr: "2rem", overflowX: "hidden", ...I, children: /* @__PURE__ */ e.jsxs(Wt, { size: "md", variant: "simple", children: [
573
- /* @__PURE__ */ e.jsx(Qt, { position: "sticky", top: 0, bg: "white", zIndex: 1, children: /* @__PURE__ */ e.jsxs(gt, { children: [
572
+ /* @__PURE__ */ e.jsx(Ut, { mr: "2rem", overflowX: "hidden", ...f, children: /* @__PURE__ */ e.jsxs(Wt, { size: "md", variant: "simple", children: [
573
+ /* @__PURE__ */ e.jsx(Qt, { position: "sticky", top: 0, bg: "white", zIndex: 1, children: /* @__PURE__ */ e.jsxs(xt, { children: [
574
574
  /* @__PURE__ */ e.jsxs(De, { fontWeight: "normal", children: [
575
575
  "(showing ",
576
- U?.length ?? 0,
576
+ W?.length ?? 0,
577
577
  " of",
578
578
  " ",
579
- t ?? s.length,
579
+ t ?? n.length,
580
580
  ")"
581
581
  ] }),
582
582
  /* @__PURE__ */ e.jsx(De, { children: "Name" }),
583
583
  /* @__PURE__ */ e.jsx(De, { children: "Sensor Locations" }),
584
- !b && /* @__PURE__ */ e.jsx(De, { children: "Use Case" }),
584
+ !L && /* @__PURE__ */ e.jsx(De, { children: "Use Case" }),
585
585
  /* @__PURE__ */ e.jsx(De, {})
586
586
  ] }) }),
587
- /* @__PURE__ */ e.jsx(qt, { children: U?.map((l) => {
588
- const S = c ? k?.(l.id) ?? 0 : 0, W = c ? S > 0 : !!l.selected;
587
+ /* @__PURE__ */ e.jsx(qt, { children: W?.map((l) => {
588
+ const I = c ? A?.(l.id) ?? 0 : 0, Q = c ? I > 0 : !!l.selected;
589
589
  return /* @__PURE__ */ e.jsxs(
590
- gt,
590
+ xt,
591
591
  {
592
592
  className: Je(
593
593
  "hover:bg-[#f7f7f7]",
594
- !n && !c && "cursor-pointer",
595
- W && "bg-gray-200"
594
+ !s && !c && "cursor-pointer",
595
+ Q && "bg-gray-200"
596
596
  ),
597
597
  onClick: () => {
598
- n || c || d?.(l, !l.selected);
598
+ s || c || h?.(l, !l.selected);
599
599
  },
600
600
  children: [
601
- /* @__PURE__ */ e.jsx(We, { children: /* @__PURE__ */ e.jsxs(Me, { alignItems: "center", children: [
602
- !n && c ? /* @__PURE__ */ e.jsxs(
601
+ /* @__PURE__ */ e.jsx(Qe, { children: /* @__PURE__ */ e.jsxs(Me, { alignItems: "center", children: [
602
+ !s && c ? /* @__PURE__ */ e.jsxs(
603
603
  V,
604
604
  {
605
605
  spacing: 1,
606
- onClick: (P) => P.stopPropagation(),
606
+ onClick: (_) => _.stopPropagation(),
607
607
  children: [
608
608
  /* @__PURE__ */ e.jsx(
609
- rt,
609
+ Ze,
610
610
  {
611
611
  "aria-label": "Remove one instance",
612
- icon: /* @__PURE__ */ e.jsx(Cn, {}),
612
+ icon: /* @__PURE__ */ e.jsx(vn, {}),
613
613
  size: "xs",
614
614
  variant: "outline",
615
- isDisabled: S === 0,
616
- onClick: () => d?.(l, !1)
615
+ isDisabled: I === 0,
616
+ onClick: () => h?.(l, !1)
617
617
  }
618
618
  ),
619
619
  /* @__PURE__ */ e.jsx(
620
- M,
620
+ S,
621
621
  {
622
622
  minW: "1.5rem",
623
623
  textAlign: "center",
624
- fontWeight: S > 0 ? "semibold" : "normal",
625
- color: S > 0 ? "blue.600" : "gray.500",
626
- children: S
624
+ fontWeight: I > 0 ? "semibold" : "normal",
625
+ color: I > 0 ? "blue.600" : "gray.500",
626
+ children: I
627
627
  }
628
628
  ),
629
629
  /* @__PURE__ */ e.jsx(
630
- rt,
630
+ Ze,
631
631
  {
632
632
  "aria-label": "Add one instance",
633
633
  icon: /* @__PURE__ */ e.jsx(wn, {}),
634
634
  size: "xs",
635
635
  variant: "outline",
636
636
  colorScheme: "blue",
637
- onClick: () => d?.(l, !0)
637
+ onClick: () => h?.(l, !0)
638
638
  }
639
639
  )
640
640
  ]
641
641
  }
642
- ) : n ? null : /* @__PURE__ */ e.jsx(e.Fragment, { children: l.selected ? /* @__PURE__ */ e.jsx(In, { className: "text-blue-500" }) : /* @__PURE__ */ e.jsx(Sn, { className: "text-gray-400" }) }),
643
- (l.quantumOwned || !m) && h && /* @__PURE__ */ e.jsx(
642
+ ) : s ? null : /* @__PURE__ */ e.jsx(e.Fragment, { children: l.selected ? /* @__PURE__ */ e.jsx(In, { className: "text-blue-500" }) : /* @__PURE__ */ e.jsx(Sn, { className: "text-gray-400" }) }),
643
+ (l.quantumOwned || !u) && m && /* @__PURE__ */ e.jsx(
644
644
  ne,
645
645
  {
646
646
  ml: "1em",
647
647
  size: "sm",
648
648
  variant: "link",
649
649
  colorScheme: "blue",
650
- onClick: (P) => {
651
- P.stopPropagation(), h(l.id);
650
+ onClick: (_) => {
651
+ _.stopPropagation(), m(l.id);
652
652
  },
653
653
  children: "View"
654
654
  }
655
655
  ),
656
- !l.quantumOwned && m && /* @__PURE__ */ e.jsx(
656
+ !l.quantumOwned && u && /* @__PURE__ */ e.jsx(
657
657
  ne,
658
658
  {
659
- isDisabled: u,
659
+ isDisabled: b,
660
660
  ml: "1em",
661
661
  size: "sm",
662
662
  variant: "link",
663
663
  colorScheme: "blue",
664
- onClick: (P) => {
665
- P.stopPropagation(), m(l.id);
664
+ onClick: (_) => {
665
+ _.stopPropagation(), u(l.id);
666
666
  },
667
667
  children: "Edit"
668
668
  }
669
669
  )
670
670
  ] }) }),
671
- /* @__PURE__ */ e.jsx(We, { whiteSpace: "break-spaces", children: /* @__PURE__ */ e.jsxs(Me, { align: "center", gap: 2, children: [
671
+ /* @__PURE__ */ e.jsx(Qe, { whiteSpace: "break-spaces", children: /* @__PURE__ */ e.jsxs(Me, { align: "center", gap: 2, children: [
672
672
  /* @__PURE__ */ e.jsx(
673
673
  En,
674
674
  {
675
675
  action: l,
676
- quantumIconSrc: f
676
+ quantumIconSrc: p
677
677
  }
678
678
  ),
679
679
  l.name
680
680
  ] }) }),
681
- /* @__PURE__ */ e.jsx(We, { maxW: "20rem", whiteSpace: "break-spaces", children: Bn(l.sensorLocations) }),
682
- !b && /* @__PURE__ */ e.jsx(We, { maxW: "20rem", children: /* @__PURE__ */ e.jsx(
683
- Pn,
681
+ /* @__PURE__ */ e.jsx(Qe, { maxW: "20rem", whiteSpace: "break-spaces", children: Un(l.sensorLocations) }),
682
+ !L && /* @__PURE__ */ e.jsx(Qe, { maxW: "20rem", children: /* @__PURE__ */ e.jsx(
683
+ _n,
684
684
  {
685
685
  containerProps: { flexWrap: "wrap" },
686
- tags: l.useCases?.map((P) => P.name) ?? []
686
+ tags: l.useCases?.map((_) => _.name) ?? []
687
687
  }
688
688
  ) })
689
689
  ]
@@ -693,70 +693,70 @@ const Dn = ({
693
693
  }) })
694
694
  ] }) })
695
695
  ] });
696
- }, Cs = ({
697
- onSave: s,
696
+ }, ws = ({
697
+ onSave: n,
698
698
  onCancel: t,
699
699
  onError: r,
700
- hideButtons: p = !1,
701
- setButtonDisabled: m,
702
- setButtonOnClick: h,
703
- quantumOwned: d
700
+ hideButtons: g = !1,
701
+ setButtonDisabled: u,
702
+ setButtonOnClick: m,
703
+ quantumOwned: h
704
704
  }) => {
705
- const g = It(), { getLabel: n } = xe(), o = $(() => ({
706
- singular: n("action"),
707
- plural: n("action_plural"),
708
- pluralLowerCase: n("action_plural").toLowerCase(),
709
- singularLowerCase: n("action").toLowerCase()
710
- }), [n]), [u, y] = q("copy"), [b, w] = q(""), [I, L] = q([]), [f, c] = q(!1), [k] = Ce({
705
+ const x = It(), { getLabel: s } = xe(), o = N(() => ({
706
+ singular: s("action"),
707
+ plural: s("action_plural"),
708
+ pluralLowerCase: s("action_plural").toLowerCase(),
709
+ singularLowerCase: s("action").toLowerCase()
710
+ }), [s]), [b, j] = K("copy"), [L, M] = K(""), [f, C] = K([]), [p, c] = K(!1), [A] = ve({
711
711
  query: kt
712
- }), [x] = Ce({
712
+ }), [d] = ve({
713
713
  query: dn,
714
- variables: { groupId: b },
715
- pause: !b
714
+ variables: { groupId: L },
715
+ pause: !L
716
716
  // Only run when group is selected
717
- }), [, N] = fe(lt), [, v] = fe(
717
+ }), [, D] = fe(ct), [, v] = fe(
718
718
  Mt
719
- ), z = $(() => k.data?.groups ? k.data.groups.map(
720
- (i) => A(At, i)
721
- ) : [], [k.data]), R = $(() => x.data ? x.data.actions.map((a) => {
722
- const C = A(ve, a), l = A(
723
- Ge,
724
- C.reports
725
- ), S = A(
719
+ ), z = N(() => A.data?.groups ? A.data.groups.map(
720
+ (i) => k(At, i)
721
+ ) : [], [A.data]), T = N(() => d.data ? d.data.actions.map((a) => {
722
+ const w = k(Ce, a), l = k(
726
723
  Pe,
727
- C.categories
728
- ), P = A(
724
+ w.reports
725
+ ), I = k(
726
+ _e,
727
+ w.categories
728
+ ), _ = k(
729
729
  je,
730
- C.metadataGroups
731
- ).map((Q) => ({
732
- ...Q,
733
- data: Q.data.map((H) => A(be, H))
730
+ w.metadataGroups
731
+ ).map((q) => ({
732
+ ...q,
733
+ data: q.data.map((H) => k(be, H))
734
734
  }));
735
735
  return {
736
- ...C,
737
- thresholds: A(Te, C.thresholds),
738
- reports: l.map((Q) => ({
739
- ...Q,
740
- thresholds: A(Te, Q.thresholds)
736
+ ...w,
737
+ thresholds: k(Te, w.thresholds),
738
+ reports: l.map((q) => ({
739
+ ...q,
740
+ thresholds: k(Te, q.thresholds)
741
741
  })),
742
- categories: S,
743
- metadataGroups: P
742
+ categories: I,
743
+ metadataGroups: _
744
744
  };
745
- }) : [], [x.data]), O = $(() => R.filter(
746
- (i) => I.includes(i.id)
747
- ), [R, I]), K = E(
745
+ }) : [], [d.data]), F = N(() => T.filter(
746
+ (i) => f.includes(i.id)
747
+ ), [T, f]), G = E(
748
748
  (i) => {
749
749
  const a = i?.value || "";
750
- w(a), L([]);
750
+ M(a), C([]);
751
751
  },
752
752
  []
753
753
  ), oe = E(
754
754
  (i) => {
755
- const a = i.map((C) => C.value);
756
- L(a);
755
+ const a = i.map((w) => w.value);
756
+ C(a);
757
757
  },
758
758
  []
759
- ), G = E(
759
+ ), P = E(
760
760
  async (i) => {
761
761
  const a = {
762
762
  ...i,
@@ -773,41 +773,41 @@ const Dn = ({
773
773
  id: void 0
774
774
  })),
775
775
  categories: i.categories.map((l) => l.id),
776
- quantumOwned: d,
777
- metadataItemIds: i.metadataGroups.flatMap((l) => l.data.map((S) => S.id)).filter((l) => l !== void 0),
776
+ quantumOwned: h,
777
+ metadataItemIds: i.metadataGroups.flatMap((l) => l.data.map((I) => I.id)).filter((l) => l !== void 0),
778
778
  reports: i.reports.map((l) => ({
779
779
  ...l,
780
780
  id: void 0,
781
- thresholds: l.thresholds.map((S) => ({
782
- ...S,
781
+ thresholds: l.thresholds.map((I) => ({
782
+ ...I,
783
783
  id: void 0
784
784
  }))
785
785
  })),
786
786
  id: void 0
787
- }, C = await N({ fields: a });
788
- if (C.error) throw new Error(C.error.message);
789
- if (C.data?.createAction)
790
- return A(ve, C.data.createAction);
787
+ }, w = await D({ fields: a });
788
+ if (w.error) throw new Error(w.error.message);
789
+ if (w.data?.createAction)
790
+ return k(Ce, w.data.createAction);
791
791
  throw new Error("No action data returned");
792
792
  },
793
- [N, d]
793
+ [D, h]
794
794
  ), ae = E(
795
795
  async (i) => {
796
796
  const a = await v({ id: i.id });
797
797
  if (a.error)
798
798
  throw new Error(a.error.message);
799
799
  if (a.data?.convertActionToQuantumOwned)
800
- return A(
801
- ve,
800
+ return k(
801
+ Ce,
802
802
  a.data.convertActionToQuantumOwned
803
803
  );
804
804
  throw new Error("No action data returned");
805
805
  },
806
806
  [v]
807
807
  ), Z = E(async () => {
808
- if (c(!0), !O.length) {
808
+ if (c(!0), !F.length) {
809
809
  const i = new Error(
810
- `No ${o.pluralLowerCase} selected for ${u === "copy" ? "copying" : "converting"}`
810
+ `No ${o.pluralLowerCase} selected for ${b === "copy" ? "copying" : "converting"}`
811
811
  );
812
812
  r?.(i), c(!1);
813
813
  return;
@@ -815,103 +815,103 @@ const Dn = ({
815
815
  try {
816
816
  const i = [];
817
817
  let a = 0;
818
- const C = u === "copy" ? G : ae, l = u === "copy" ? "copy" : "convert";
819
- for (const S of O)
818
+ const w = b === "copy" ? P : ae, l = b === "copy" ? "copy" : "convert";
819
+ for (const I of F)
820
820
  try {
821
- const W = await C(S);
822
- i.push(W);
823
- } catch (W) {
821
+ const Q = await w(I);
822
+ i.push(Q);
823
+ } catch (Q) {
824
824
  console.error(
825
- `Failed to ${l} ${o.singularLowerCase} "${S.name}":`,
826
- W
825
+ `Failed to ${l} ${o.singularLowerCase} "${I.name}":`,
826
+ Q
827
827
  ), a++;
828
828
  }
829
829
  if (i.length > 0) {
830
- const S = i.length, W = O.length, P = u === "copy" ? "copied" : "converted", Q = u === "copy" ? "copy" : "convert";
831
- g({
832
- title: a > 0 ? `Partial ${Q} completed` : `${o.plural} ${P} successfully`,
833
- description: a > 0 ? `${S} of ${W} ${o.pluralLowerCase} ${P} successfully` : `${S} ${S > 1 ? o.pluralLowerCase : o.singularLowerCase} ${P} successfully`,
830
+ const I = i.length, Q = F.length, _ = b === "copy" ? "copied" : "converted", q = b === "copy" ? "copy" : "convert";
831
+ x({
832
+ title: a > 0 ? `Partial ${q} completed` : `${o.plural} ${_} successfully`,
833
+ description: a > 0 ? `${I} of ${Q} ${o.pluralLowerCase} ${_} successfully` : `${I} ${I > 1 ? o.pluralLowerCase : o.singularLowerCase} ${_} successfully`,
834
834
  status: a > 0 ? "warning" : "success",
835
835
  duration: 3e3,
836
836
  isClosable: !0
837
- }), s?.(), w(""), L([]);
837
+ }), n?.(), M(""), C([]);
838
838
  } else
839
839
  throw new Error(
840
840
  `Failed to ${l} any ${o.pluralLowerCase}`
841
841
  );
842
842
  } catch (i) {
843
- const a = u === "copy" ? "copy" : "convert", C = i instanceof Error ? i.message : `Failed to ${a} ${o.pluralLowerCase}`;
844
- g({
845
- title: `${u === "copy" ? "Copy" : "Convert"} failed`,
846
- description: C,
843
+ const a = b === "copy" ? "copy" : "convert", w = i instanceof Error ? i.message : `Failed to ${a} ${o.pluralLowerCase}`;
844
+ x({
845
+ title: `${b === "copy" ? "Copy" : "Convert"} failed`,
846
+ description: w,
847
847
  status: "error",
848
848
  duration: 5e3,
849
849
  isClosable: !0
850
- }), r?.(i instanceof Error ? i : new Error(C));
850
+ }), r?.(i instanceof Error ? i : new Error(w));
851
851
  } finally {
852
852
  c(!1);
853
853
  }
854
854
  }, [
855
- O,
856
- u,
857
- G,
855
+ F,
856
+ b,
857
+ P,
858
858
  ae,
859
- g,
860
- s,
859
+ x,
860
+ n,
861
861
  r,
862
862
  o
863
- ]), T = E(() => {
864
- w(""), L([]), y("copy"), t?.();
863
+ ]), O = E(() => {
864
+ M(""), C([]), j("copy"), t?.();
865
865
  }, [t]);
866
866
  ce(() => {
867
- m && m({
867
+ u && u({
868
868
  cancelButton: !1,
869
- saveButton: O.length === 0 || f
869
+ saveButton: F.length === 0 || p
870
870
  });
871
- }, [O.length, f, m]), ce(() => {
872
- h && h({
873
- cancelButton: T,
871
+ }, [F.length, p, u]), ce(() => {
872
+ m && m({
873
+ cancelButton: O,
874
874
  saveButton: Z
875
875
  });
876
- }, [h, T, Z]);
877
- const U = $(() => z.map((i) => ({
876
+ }, [m, O, Z]);
877
+ const W = N(() => z.map((i) => ({
878
878
  value: i.id,
879
879
  label: i.name
880
- })), [z]), J = $(() => R.filter((i) => u === "copy" ? !0 : !i.quantumOwned).map((i) => ({
880
+ })), [z]), J = N(() => T.filter((i) => b === "copy" ? !0 : !i.quantumOwned).map((i) => ({
881
881
  value: i.id,
882
882
  label: i.name,
883
883
  // Add custom data to identify quantum-owned actions for UI display
884
884
  isQuantumOwned: i.quantumOwned
885
- })), [R, u]), B = k.fetching, Y = x.fetching;
885
+ })), [T, b]), U = A.fetching, Y = d.fetching;
886
886
  return /* @__PURE__ */ e.jsx(se, { children: /* @__PURE__ */ e.jsxs(ue, { spacing: 6, align: "stretch", children: [
887
- d && /* @__PURE__ */ e.jsxs(X, { children: [
887
+ h && /* @__PURE__ */ e.jsxs(X, { children: [
888
888
  /* @__PURE__ */ e.jsx(ge, { children: "Operation Mode" }),
889
889
  /* @__PURE__ */ e.jsx(
890
890
  St,
891
891
  {
892
- value: u,
892
+ value: b,
893
893
  onChange: (i) => {
894
- y(i), L([]);
894
+ j(i), C([]);
895
895
  },
896
896
  children: /* @__PURE__ */ e.jsxs(V, { spacing: 6, children: [
897
- /* @__PURE__ */ e.jsx(Ze, { value: "copy", colorScheme: "blue", children: /* @__PURE__ */ e.jsxs(ue, { align: "start", spacing: 1, children: [
898
- /* @__PURE__ */ e.jsxs(M, { fontWeight: "medium", children: [
897
+ /* @__PURE__ */ e.jsx(Ve, { value: "copy", colorScheme: "blue", children: /* @__PURE__ */ e.jsxs(ue, { align: "start", spacing: 1, children: [
898
+ /* @__PURE__ */ e.jsxs(S, { fontWeight: "medium", children: [
899
899
  "Copy ",
900
900
  o.plural
901
901
  ] }),
902
- /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", color: "gray.600", children: [
902
+ /* @__PURE__ */ e.jsxs(S, { fontSize: "sm", color: "gray.600", children: [
903
903
  "Create new ",
904
904
  o.plural.toLocaleLowerCase(),
905
905
  " ",
906
906
  "based on selected ones"
907
907
  ] })
908
908
  ] }) }),
909
- /* @__PURE__ */ e.jsx(Ze, { value: "convert", colorScheme: "green", children: /* @__PURE__ */ e.jsxs(ue, { align: "start", spacing: 1, children: [
910
- /* @__PURE__ */ e.jsxs(M, { fontWeight: "medium", children: [
909
+ /* @__PURE__ */ e.jsx(Ve, { value: "convert", colorScheme: "green", children: /* @__PURE__ */ e.jsxs(ue, { align: "start", spacing: 1, children: [
910
+ /* @__PURE__ */ e.jsxs(S, { fontWeight: "medium", children: [
911
911
  "Convert to Quantum Owned ",
912
912
  o.singular
913
913
  ] }),
914
- /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", color: "gray.600", children: [
914
+ /* @__PURE__ */ e.jsxs(S, { fontSize: "sm", color: "gray.600", children: [
915
915
  "Convert existing",
916
916
  " ",
917
917
  o.plural.toLocaleLowerCase(),
@@ -928,33 +928,33 @@ const Dn = ({
928
928
  he,
929
929
  {
930
930
  placeholder: "Choose a group...",
931
- options: U,
932
- value: U.find((i) => i.value === b) || null,
933
- onChange: K,
934
- isLoading: B,
935
- isDisabled: B,
931
+ options: W,
932
+ value: W.find((i) => i.value === L) || null,
933
+ onChange: G,
934
+ isLoading: U,
935
+ isDisabled: U,
936
936
  isClearable: !0
937
937
  }
938
938
  ),
939
- k.error && /* @__PURE__ */ e.jsxs(Ve, { status: "error", mt: 2, children: [
940
- /* @__PURE__ */ e.jsx(et, {}),
941
- /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", children: [
939
+ A.error && /* @__PURE__ */ e.jsxs(et, { status: "error", mt: 2, children: [
940
+ /* @__PURE__ */ e.jsx(tt, {}),
941
+ /* @__PURE__ */ e.jsxs(S, { fontSize: "sm", children: [
942
942
  "Failed to load groups: ",
943
- k.error.message
943
+ A.error.message
944
944
  ] })
945
945
  ] })
946
946
  ] }),
947
- b && /* @__PURE__ */ e.jsxs(X, { children: [
947
+ L && /* @__PURE__ */ e.jsxs(X, { children: [
948
948
  /* @__PURE__ */ e.jsxs(ge, { children: [
949
949
  "Select ",
950
950
  o.plural,
951
951
  " to",
952
952
  " ",
953
- u === "copy" ? "Copy" : "Convert"
953
+ b === "copy" ? "Copy" : "Convert"
954
954
  ] }),
955
955
  Y ? /* @__PURE__ */ e.jsxs(V, { children: [
956
956
  /* @__PURE__ */ e.jsx(Lt, { size: "sm" }),
957
- /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", color: "gray.600", children: [
957
+ /* @__PURE__ */ e.jsxs(S, { fontSize: "sm", color: "gray.600", children: [
958
958
  "Loading ",
959
959
  o.pluralLowerCase,
960
960
  "..."
@@ -963,10 +963,10 @@ const Dn = ({
963
963
  /* @__PURE__ */ e.jsx(
964
964
  he,
965
965
  {
966
- placeholder: `Choose ${o.pluralLowerCase} to ${u}...`,
966
+ placeholder: `Choose ${o.pluralLowerCase} to ${b}...`,
967
967
  options: J,
968
968
  value: J.filter(
969
- (i) => I.includes(i.value)
969
+ (i) => f.includes(i.value)
970
970
  ),
971
971
  onChange: oe,
972
972
  isDisabled: J.length === 0,
@@ -975,34 +975,34 @@ const Dn = ({
975
975
  closeMenuOnSelect: !1,
976
976
  formatOptionLabel: (i, { context: a }) => /* @__PURE__ */ e.jsxs(V, { justify: "space-between", w: "100%", children: [
977
977
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
978
- /* @__PURE__ */ e.jsx(M, { children: i.label }),
979
- a === "value" && i.isQuantumOwned && /* @__PURE__ */ e.jsx(M, { color: "blue", fontSize: "xs", children: "(Quantum Owned)" })
978
+ /* @__PURE__ */ e.jsx(S, { children: i.label }),
979
+ a === "value" && i.isQuantumOwned && /* @__PURE__ */ e.jsx(S, { color: "blue", fontSize: "xs", children: "(Quantum Owned)" })
980
980
  ] }),
981
- i.isQuantumOwned && a === "menu" && /* @__PURE__ */ e.jsx(Fe, { size: "sm", colorScheme: "blue", variant: "solid", children: "Quantum Owned" })
981
+ i.isQuantumOwned && a === "menu" && /* @__PURE__ */ e.jsx(Ge, { size: "sm", colorScheme: "blue", variant: "solid", children: "Quantum Owned" })
982
982
  ] })
983
983
  }
984
984
  ),
985
- J.length === 0 && /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", color: "gray.500", mt: 2, children: [
985
+ J.length === 0 && /* @__PURE__ */ e.jsxs(S, { fontSize: "sm", color: "gray.500", mt: 2, children: [
986
986
  "No ",
987
987
  o.pluralLowerCase,
988
988
  " found"
989
989
  ] })
990
990
  ] }),
991
- x.error && /* @__PURE__ */ e.jsxs(Ve, { status: "error", mt: 2, children: [
992
- /* @__PURE__ */ e.jsx(et, {}),
993
- /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", children: [
991
+ d.error && /* @__PURE__ */ e.jsxs(et, { status: "error", mt: 2, children: [
992
+ /* @__PURE__ */ e.jsx(tt, {}),
993
+ /* @__PURE__ */ e.jsxs(S, { fontSize: "sm", children: [
994
994
  "Failed to load ",
995
995
  o.pluralLowerCase,
996
996
  ":",
997
997
  " ",
998
- x.error.message
998
+ d.error.message
999
999
  ] })
1000
1000
  ] })
1001
1001
  ] }),
1002
- O.length > 0 && /* @__PURE__ */ e.jsxs(se, { p: 4, bg: "gray.50", borderRadius: "md", children: [
1003
- /* @__PURE__ */ e.jsx(M, { fontWeight: "semibold", mb: 3, children: O.length === 1 ? `${o.singular} to ${u === "copy" ? "Copy" : "Convert"}:` : `${O.length} ${o.plural} to ${u === "copy" ? "Copy" : "Convert"}:` }),
1002
+ F.length > 0 && /* @__PURE__ */ e.jsxs(se, { p: 4, bg: "gray.50", borderRadius: "md", children: [
1003
+ /* @__PURE__ */ e.jsx(S, { fontWeight: "semibold", mb: 3, children: F.length === 1 ? `${o.singular} to ${b === "copy" ? "Copy" : "Convert"}:` : `${F.length} ${o.plural} to ${b === "copy" ? "Copy" : "Convert"}:` }),
1004
1004
  /* @__PURE__ */ e.jsxs(ue, { align: "start", spacing: 3, children: [
1005
- O.map((i, a) => /* @__PURE__ */ e.jsxs(
1005
+ F.map((i, a) => /* @__PURE__ */ e.jsxs(
1006
1006
  se,
1007
1007
  {
1008
1008
  w: "100%",
@@ -1013,12 +1013,12 @@ const Dn = ({
1013
1013
  borderColor: "gray.200",
1014
1014
  children: [
1015
1015
  /* @__PURE__ */ e.jsxs(V, { justify: "space-between", align: "start", mb: 2, children: [
1016
- /* @__PURE__ */ e.jsxs(M, { fontWeight: "medium", fontSize: "sm", children: [
1016
+ /* @__PURE__ */ e.jsxs(S, { fontWeight: "medium", fontSize: "sm", children: [
1017
1017
  a + 1,
1018
1018
  ". ",
1019
1019
  i.name
1020
1020
  ] }),
1021
- i.quantumOwned && /* @__PURE__ */ e.jsx(Fe, { size: "sm", colorScheme: "blue", variant: "solid", children: "Quantum Owned" })
1021
+ i.quantumOwned && /* @__PURE__ */ e.jsx(Ge, { size: "sm", colorScheme: "blue", variant: "solid", children: "Quantum Owned" })
1022
1022
  ] }),
1023
1023
  /* @__PURE__ */ e.jsxs(
1024
1024
  ue,
@@ -1028,35 +1028,35 @@ const Dn = ({
1028
1028
  fontSize: "sm",
1029
1029
  color: "gray.600",
1030
1030
  children: [
1031
- i.description && /* @__PURE__ */ e.jsxs(M, { children: [
1031
+ i.description && /* @__PURE__ */ e.jsxs(S, { children: [
1032
1032
  /* @__PURE__ */ e.jsx("strong", { children: "Description:" }),
1033
1033
  " ",
1034
1034
  i.description
1035
1035
  ] }),
1036
- /* @__PURE__ */ e.jsxs(M, { children: [
1036
+ /* @__PURE__ */ e.jsxs(S, { children: [
1037
1037
  /* @__PURE__ */ e.jsx("strong", { children: "Type:" }),
1038
1038
  " ",
1039
1039
  i.activityKind
1040
1040
  ] }),
1041
- /* @__PURE__ */ e.jsxs(M, { children: [
1041
+ /* @__PURE__ */ e.jsxs(S, { children: [
1042
1042
  /* @__PURE__ */ e.jsx("strong", { children: "Laterality:" }),
1043
1043
  " ",
1044
1044
  i.laterality
1045
1045
  ] }),
1046
- /* @__PURE__ */ e.jsxs(M, { children: [
1046
+ /* @__PURE__ */ e.jsxs(S, { children: [
1047
1047
  /* @__PURE__ */ e.jsx("strong", { children: "Sensor Locations:" }),
1048
1048
  " ",
1049
1049
  i.sensorLocations.length
1050
1050
  ] }),
1051
- /* @__PURE__ */ e.jsxs(M, { children: [
1051
+ /* @__PURE__ */ e.jsxs(S, { children: [
1052
1052
  /* @__PURE__ */ e.jsx("strong", { children: "Thresholds:" }),
1053
1053
  " ",
1054
1054
  i.thresholds.length
1055
1055
  ] }),
1056
- /* @__PURE__ */ e.jsxs(M, { children: [
1056
+ /* @__PURE__ */ e.jsxs(S, { children: [
1057
1057
  /* @__PURE__ */ e.jsx("strong", { children: "Use Cases:" }),
1058
1058
  " ",
1059
- i.useCases.map((C) => C.name).join(", ") || "None"
1059
+ i.useCases.map((w) => w.name).join(", ") || "None"
1060
1060
  ] })
1061
1061
  ]
1062
1062
  }
@@ -1065,7 +1065,7 @@ const Dn = ({
1065
1065
  },
1066
1066
  i.id
1067
1067
  )),
1068
- O.length > 1 && /* @__PURE__ */ e.jsx(
1068
+ F.length > 1 && /* @__PURE__ */ e.jsx(
1069
1069
  se,
1070
1070
  {
1071
1071
  w: "100%",
@@ -1074,116 +1074,116 @@ const Dn = ({
1074
1074
  borderRadius: "md",
1075
1075
  border: "1px solid",
1076
1076
  borderColor: "blue.200",
1077
- children: /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", fontWeight: "medium", color: "blue.800", children: [
1077
+ children: /* @__PURE__ */ e.jsxs(S, { fontSize: "sm", fontWeight: "medium", color: "blue.800", children: [
1078
1078
  "Total: ",
1079
- O.length,
1079
+ F.length,
1080
1080
  " ",
1081
1081
  o.pluralLowerCase,
1082
1082
  " will be",
1083
1083
  " ",
1084
- u === "copy" ? "copied" : "converted"
1084
+ b === "copy" ? "copied" : "converted"
1085
1085
  ] })
1086
1086
  }
1087
1087
  )
1088
1088
  ] })
1089
1089
  ] }),
1090
- !p && /* @__PURE__ */ e.jsxs(Ne, { spacing: 4, justifyContent: "flex-end", children: [
1090
+ !g && /* @__PURE__ */ e.jsxs(Ne, { spacing: 4, justifyContent: "flex-end", children: [
1091
1091
  /* @__PURE__ */ e.jsx(
1092
1092
  ne,
1093
1093
  {
1094
1094
  variant: "outline",
1095
- onClick: T,
1096
- isDisabled: f,
1095
+ onClick: O,
1096
+ isDisabled: p,
1097
1097
  children: "Cancel"
1098
1098
  }
1099
1099
  ),
1100
1100
  /* @__PURE__ */ e.jsxs(
1101
1101
  ne,
1102
1102
  {
1103
- colorScheme: u === "copy" ? "blue" : "green",
1103
+ colorScheme: b === "copy" ? "blue" : "green",
1104
1104
  onClick: Z,
1105
- isDisabled: O.length === 0 || f,
1106
- isLoading: f,
1107
- loadingText: `${u === "copy" ? "Copying" : "Converting"}...`,
1105
+ isDisabled: F.length === 0 || p,
1106
+ isLoading: p,
1107
+ loadingText: `${b === "copy" ? "Copying" : "Converting"}...`,
1108
1108
  children: [
1109
- u === "copy" ? "Copy" : "Convert",
1109
+ b === "copy" ? "Copy" : "Convert",
1110
1110
  " ",
1111
- O.length === 1 ? o.singular : `${O.length} ${o.plural}`
1111
+ F.length === 1 ? o.singular : `${F.length} ${o.plural}`
1112
1112
  ]
1113
1113
  }
1114
1114
  )
1115
1115
  ] })
1116
1116
  ] }) });
1117
- }, ws = ({
1118
- onSave: s,
1117
+ }, Is = ({
1118
+ onSave: n,
1119
1119
  onCancel: t,
1120
1120
  onError: r,
1121
- hideButtons: p = !1,
1122
- setButtonDisabled: m,
1123
- setButtonOnClick: h,
1124
- quantumOwned: d
1121
+ hideButtons: g = !1,
1122
+ setButtonDisabled: u,
1123
+ setButtonOnClick: m,
1124
+ quantumOwned: h
1125
1125
  }) => {
1126
- const g = It(), { getLabel: n } = xe(), o = $(() => ({
1127
- singular: n("module"),
1128
- plural: n("module_plural"),
1129
- pluralLowerCase: n("module_plural").toLowerCase(),
1130
- singularLowerCase: n("module").toLowerCase()
1131
- }), [n]), u = $(() => ({
1132
- singular: n("action"),
1133
- plural: n("action_plural"),
1134
- pluralLowerCase: n("action_plural").toLowerCase(),
1135
- singularLowerCase: n("action").toLowerCase()
1136
- }), [n]), [y, b] = q(""), [w, I] = q([]), [L, f] = q(!1), [c, k] = q("copy"), [x] = Ce({
1126
+ const x = It(), { getLabel: s } = xe(), o = N(() => ({
1127
+ singular: s("module"),
1128
+ plural: s("module_plural"),
1129
+ pluralLowerCase: s("module_plural").toLowerCase(),
1130
+ singularLowerCase: s("module").toLowerCase()
1131
+ }), [s]), b = N(() => ({
1132
+ singular: s("action"),
1133
+ plural: s("action_plural"),
1134
+ pluralLowerCase: s("action_plural").toLowerCase(),
1135
+ singularLowerCase: s("action").toLowerCase()
1136
+ }), [s]), [j, L] = K(""), [M, f] = K([]), [C, p] = K(!1), [c, A] = K("copy"), [d] = ve({
1137
1137
  query: kt
1138
- }), [N] = Ce({
1138
+ }), [D] = ve({
1139
1139
  query: un,
1140
- variables: { groupId: y },
1141
- pause: !y
1140
+ variables: { groupId: j },
1141
+ pause: !j
1142
1142
  // Only run when group is selected
1143
- }), [, v] = fe(Ot), [, z] = fe(Tt), [, R] = fe(lt), [, O] = fe(
1143
+ }), [, v] = fe(Ot), [, z] = fe(Tt), [, T] = fe(ct), [, F] = fe(
1144
1144
  Mt
1145
- ), K = $(() => x.data?.groups ? x.data.groups.map(
1146
- (a) => A(At, a)
1147
- ) : [], [x.data]), oe = $(() => N.data?.modules ? A(
1145
+ ), G = N(() => d.data?.groups ? d.data.groups.map(
1146
+ (a) => k(At, a)
1147
+ ) : [], [d.data]), oe = N(() => D.data?.modules ? k(
1148
1148
  Ye,
1149
- N.data?.modules
1150
- ).map((C) => {
1151
- const l = A(
1149
+ D.data?.modules
1150
+ ).map((w) => {
1151
+ const l = k(
1152
1152
  Nt,
1153
- C.moduleActions
1154
- ), W = A(
1153
+ w.moduleActions
1154
+ ), Q = k(
1155
1155
  je,
1156
- C.metadataGroups
1157
- ).map((P) => A(be, P.data)).flat();
1156
+ w.metadataGroups
1157
+ ).map((_) => k(be, _.data)).flat();
1158
1158
  return {
1159
- ...C,
1160
- moduleActions: l.map((P) => ({
1161
- ...P,
1162
- action: A(ve, P.action)
1159
+ ...w,
1160
+ moduleActions: l.map((_) => ({
1161
+ ..._,
1162
+ action: k(Ce, _.action)
1163
1163
  })),
1164
- categories: A(
1165
- Pe,
1166
- C.categories
1164
+ categories: k(
1165
+ _e,
1166
+ w.categories
1167
1167
  ),
1168
- metadataItems: W
1168
+ metadataItems: Q
1169
1169
  };
1170
- }) : [], [N.data]), G = $(() => oe.filter(
1171
- (a) => w.includes(a.id)
1172
- ), [oe, w]), ae = E(
1170
+ }) : [], [D.data]), P = N(() => oe.filter(
1171
+ (a) => M.includes(a.id)
1172
+ ), [oe, M]), ae = E(
1173
1173
  (a) => {
1174
- const C = a?.value || "";
1175
- b(C), I([]);
1174
+ const w = a?.value || "";
1175
+ L(w), f([]);
1176
1176
  },
1177
1177
  []
1178
1178
  ), Z = E(
1179
1179
  (a) => {
1180
- const C = a.map((l) => l.value);
1181
- I(C);
1180
+ const w = a.map((l) => l.value);
1181
+ f(w);
1182
1182
  },
1183
1183
  []
1184
- ), T = E(async () => {
1185
- if (f(!0), !G.length) {
1186
- f(!1);
1184
+ ), O = E(async () => {
1185
+ if (p(!0), !P.length) {
1186
+ p(!1);
1187
1187
  const a = new Error(
1188
1188
  `No modules selected for ${c === "convert" ? "converting" : "copying"}`
1189
1189
  );
@@ -1192,37 +1192,37 @@ const Dn = ({
1192
1192
  }
1193
1193
  try {
1194
1194
  const a = [];
1195
- let C = 0;
1196
- for (const l of G)
1195
+ let w = 0;
1196
+ for (const l of P)
1197
1197
  try {
1198
- let S = l.moduleActions.map((W) => W.actionId);
1199
- if (d) {
1200
- const W = l.moduleActions.map((H) => H.action), P = async (H) => {
1198
+ let I = l.moduleActions.map((Q) => Q.actionId);
1199
+ if (h) {
1200
+ const Q = l.moduleActions.map((H) => H.action), _ = async (H) => {
1201
1201
  if (c === "copy") {
1202
1202
  if (H.quantumOwned) return H;
1203
- const we = A(
1204
- Pe,
1203
+ const we = k(
1204
+ _e,
1205
1205
  H.categories
1206
- ), Se = A(
1206
+ ), Se = k(
1207
1207
  je,
1208
1208
  H.metadataGroups
1209
- ).map((pe) => A(
1209
+ ).map((pe) => k(
1210
1210
  be,
1211
1211
  pe.data
1212
- ).map(($e) => $e.id)).flat(), Be = A(
1213
- Ge,
1212
+ ).map(($e) => $e.id)).flat(), Ue = k(
1213
+ Pe,
1214
1214
  H.reports
1215
1215
  ).map((pe) => ({
1216
1216
  ...pe,
1217
1217
  id: void 0,
1218
- thresholds: A(
1218
+ thresholds: k(
1219
1219
  Te,
1220
1220
  pe.thresholds
1221
1221
  ).map(($e) => ({
1222
1222
  ...$e,
1223
1223
  id: void 0
1224
1224
  }))
1225
- })), tt = A(
1225
+ })), nt = k(
1226
1226
  Te,
1227
1227
  H.thresholds
1228
1228
  ).map((pe) => ({
@@ -1231,161 +1231,161 @@ const Dn = ({
1231
1231
  })), Re = {
1232
1232
  ...H,
1233
1233
  quantumOwned: !0,
1234
- thresholds: tt,
1234
+ thresholds: nt,
1235
1235
  categories: we?.map((pe) => pe.id),
1236
- reports: Be,
1236
+ reports: Ue,
1237
1237
  metadataIds: Se,
1238
1238
  id: void 0
1239
- }, Le = await R({ fields: Re });
1240
- return Le.error || !Le.data?.createAction ? null : A(
1241
- ve,
1239
+ }, Le = await T({ fields: Re });
1240
+ return Le.error || !Le.data?.createAction ? null : k(
1241
+ Ce,
1242
1242
  Le.data.createAction
1243
1243
  );
1244
1244
  }
1245
1245
  if (H.quantumOwned) return H;
1246
- const re = await O({
1246
+ const re = await F({
1247
1247
  id: H.id
1248
1248
  });
1249
- return re.error || !re.data?.convertActionToQuantumOwned ? null : A(
1250
- ve,
1249
+ return re.error || !re.data?.convertActionToQuantumOwned ? null : k(
1250
+ Ce,
1251
1251
  re.data.convertActionToQuantumOwned
1252
1252
  );
1253
1253
  };
1254
- S = (await Promise.all(
1255
- W.map(P)
1254
+ I = (await Promise.all(
1255
+ Q.map(_)
1256
1256
  )).filter((H) => !!H?.id).map((H) => H.id);
1257
1257
  }
1258
1258
  if (c === "convert") {
1259
- const W = {
1259
+ const Q = {
1260
1260
  name: l.name,
1261
1261
  description: l.description || void 0,
1262
- actions: S,
1263
- categories: l.categories.map((Q) => Q.id),
1262
+ actions: I,
1263
+ categories: l.categories.map((q) => q.id),
1264
1264
  quantumOwned: !0
1265
- }, P = await z({
1265
+ }, _ = await z({
1266
1266
  id: l.id,
1267
- input: W
1267
+ input: Q
1268
1268
  });
1269
- if (P.error) throw new Error(P.error.message);
1270
- if (P.data?.updateModule) {
1271
- const Q = A(
1269
+ if (_.error) throw new Error(_.error.message);
1270
+ if (_.data?.updateModule) {
1271
+ const q = k(
1272
1272
  Ye,
1273
- P.data.updateModule
1273
+ _.data.updateModule
1274
1274
  );
1275
- a.push(Q);
1275
+ a.push(q);
1276
1276
  }
1277
1277
  } else {
1278
- const W = {
1278
+ const Q = {
1279
1279
  name: `${l.name} (Copy)`,
1280
1280
  description: l.description || void 0,
1281
- moduleActions: l.moduleActions.map((Q) => ({
1282
- actionId: Q.actionId,
1283
- reportId: Q.reportId ?? void 0
1281
+ moduleActions: l.moduleActions.map((q) => ({
1282
+ actionId: q.actionId,
1283
+ reportId: q.reportId ?? void 0
1284
1284
  })),
1285
- categories: l.categories.map((Q) => Q.id),
1286
- quantumOwned: d,
1287
- metadataItemIds: l.metadataItems.map((Q) => Q.id)
1288
- }, P = await v({ input: W });
1289
- if (P.error) throw new Error(P.error.message);
1290
- if (P.data?.createModule) {
1291
- const Q = A(
1285
+ categories: l.categories.map((q) => q.id),
1286
+ quantumOwned: h,
1287
+ metadataItemIds: l.metadataItems.map((q) => q.id)
1288
+ }, _ = await v({ input: Q });
1289
+ if (_.error) throw new Error(_.error.message);
1290
+ if (_.data?.createModule) {
1291
+ const q = k(
1292
1292
  Ye,
1293
- P.data.createModule
1293
+ _.data.createModule
1294
1294
  );
1295
- a.push(Q);
1295
+ a.push(q);
1296
1296
  }
1297
1297
  }
1298
- } catch (S) {
1298
+ } catch (I) {
1299
1299
  console.error(
1300
1300
  `Failed to ${c === "convert" ? "convert" : "copy"} module "${l.name}":`,
1301
- S
1302
- ), C++;
1301
+ I
1302
+ ), w++;
1303
1303
  }
1304
1304
  if (a.length > 0) {
1305
- const l = a.length, S = G.length;
1306
- g({
1307
- title: C > 0 ? `Partial ${c === "convert" ? "convert" : "copy"} completed` : `${o.plural} ${c === "convert" ? "converted" : "copied"} successfully`,
1308
- description: C > 0 ? `${l} of ${S} ${o.plural} ${c === "convert" ? "converted" : "copied"} successfully` : `${l} ${l > 1 ? o.plural : o.singular} ${c === "convert" ? "converted" : "copied"} successfully`,
1309
- status: C > 0 ? "warning" : "success",
1305
+ const l = a.length, I = P.length;
1306
+ x({
1307
+ title: w > 0 ? `Partial ${c === "convert" ? "convert" : "copy"} completed` : `${o.plural} ${c === "convert" ? "converted" : "copied"} successfully`,
1308
+ description: w > 0 ? `${l} of ${I} ${o.plural} ${c === "convert" ? "converted" : "copied"} successfully` : `${l} ${l > 1 ? o.plural : o.singular} ${c === "convert" ? "converted" : "copied"} successfully`,
1309
+ status: w > 0 ? "warning" : "success",
1310
1310
  duration: 3e3,
1311
1311
  isClosable: !0
1312
- }), a.length > 0 && s?.(), b(""), I([]);
1312
+ }), a.length > 0 && n?.(), L(""), f([]);
1313
1313
  } else
1314
1314
  throw new Error(
1315
1315
  `Failed to ${c === "convert" ? "convert" : "copy"} any modules`
1316
1316
  );
1317
1317
  } catch (a) {
1318
- const C = a instanceof Error ? a.message : `Failed to ${c === "convert" ? "convert" : "copy"} modules`;
1319
- g({
1318
+ const w = a instanceof Error ? a.message : `Failed to ${c === "convert" ? "convert" : "copy"} modules`;
1319
+ x({
1320
1320
  title: c === "convert" ? "Convert failed" : "Copy failed",
1321
- description: C,
1321
+ description: w,
1322
1322
  status: "error",
1323
1323
  duration: 5e3,
1324
1324
  isClosable: !0
1325
- }), r?.(a instanceof Error ? a : new Error(C));
1325
+ }), r?.(a instanceof Error ? a : new Error(w));
1326
1326
  } finally {
1327
- f(!1);
1327
+ p(!1);
1328
1328
  }
1329
1329
  }, [
1330
- G,
1330
+ P,
1331
1331
  v,
1332
1332
  z,
1333
- g,
1334
- s,
1333
+ x,
1334
+ n,
1335
1335
  r,
1336
- d,
1337
- R,
1338
- O,
1336
+ h,
1337
+ T,
1338
+ F,
1339
1339
  c,
1340
1340
  o
1341
- ]), U = E(() => {
1342
- b(""), I([]), k("copy"), t?.();
1341
+ ]), W = E(() => {
1342
+ L(""), f([]), A("copy"), t?.();
1343
1343
  }, [t]);
1344
1344
  ce(() => {
1345
- m && m({
1345
+ u && u({
1346
1346
  cancelButton: !1,
1347
- saveButton: G.length === 0 || L
1347
+ saveButton: P.length === 0 || C
1348
1348
  });
1349
- }, [G.length, L, m]), ce(() => {
1350
- h && h({
1351
- cancelButton: U,
1352
- saveButton: T
1349
+ }, [P.length, C, u]), ce(() => {
1350
+ m && m({
1351
+ cancelButton: W,
1352
+ saveButton: O
1353
1353
  });
1354
- }, [h, U, T]);
1355
- const J = $(() => K.map((a) => ({
1354
+ }, [m, W, O]);
1355
+ const J = N(() => G.map((a) => ({
1356
1356
  value: a.id,
1357
1357
  label: a.name
1358
- })), [K]), B = $(() => oe.filter((a) => c === "copy" ? !0 : !a.quantumOwned).map((a) => ({
1358
+ })), [G]), U = N(() => oe.filter((a) => c === "copy" ? !0 : !a.quantumOwned).map((a) => ({
1359
1359
  value: a.id,
1360
1360
  label: a.name,
1361
1361
  // Add custom data to identify quantum-owned modules
1362
1362
  isQuantumOwned: a.quantumOwned
1363
- })), [oe, c]), Y = x.fetching, i = N.fetching;
1363
+ })), [oe, c]), Y = d.fetching, i = D.fetching;
1364
1364
  return /* @__PURE__ */ e.jsx(se, { children: /* @__PURE__ */ e.jsxs(ue, { spacing: 6, align: "stretch", children: [
1365
- d && /* @__PURE__ */ e.jsxs(X, { children: [
1365
+ h && /* @__PURE__ */ e.jsxs(X, { children: [
1366
1366
  /* @__PURE__ */ e.jsx(ge, { children: "Operation Mode" }),
1367
1367
  /* @__PURE__ */ e.jsx(
1368
1368
  St,
1369
1369
  {
1370
1370
  value: c,
1371
1371
  onChange: (a) => {
1372
- k(a), I([]);
1372
+ A(a), f([]);
1373
1373
  },
1374
1374
  children: /* @__PURE__ */ e.jsxs(V, { spacing: 6, children: [
1375
- /* @__PURE__ */ e.jsx(Ze, { value: "copy", colorScheme: "blue", children: /* @__PURE__ */ e.jsxs(ue, { align: "start", spacing: 1, children: [
1376
- /* @__PURE__ */ e.jsxs(M, { fontWeight: "medium", children: [
1375
+ /* @__PURE__ */ e.jsx(Ve, { value: "copy", colorScheme: "blue", children: /* @__PURE__ */ e.jsxs(ue, { align: "start", spacing: 1, children: [
1376
+ /* @__PURE__ */ e.jsxs(S, { fontWeight: "medium", children: [
1377
1377
  "Copy ",
1378
1378
  o.plural
1379
1379
  ] }),
1380
- /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", color: "gray.600", children: [
1380
+ /* @__PURE__ */ e.jsxs(S, { fontSize: "sm", color: "gray.600", children: [
1381
1381
  "Create new ",
1382
1382
  o.pluralLowerCase,
1383
1383
  " based on selected ones"
1384
1384
  ] })
1385
1385
  ] }) }),
1386
- /* @__PURE__ */ e.jsx(Ze, { value: "convert", colorScheme: "green", children: /* @__PURE__ */ e.jsxs(ue, { align: "start", spacing: 1, children: [
1387
- /* @__PURE__ */ e.jsx(M, { fontWeight: "medium", children: "Convert to Quantum Owned" }),
1388
- /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", color: "gray.600", children: [
1386
+ /* @__PURE__ */ e.jsx(Ve, { value: "convert", colorScheme: "green", children: /* @__PURE__ */ e.jsxs(ue, { align: "start", spacing: 1, children: [
1387
+ /* @__PURE__ */ e.jsx(S, { fontWeight: "medium", children: "Convert to Quantum Owned" }),
1388
+ /* @__PURE__ */ e.jsxs(S, { fontSize: "sm", color: "gray.600", children: [
1389
1389
  "Convert existing ",
1390
1390
  o.pluralLowerCase,
1391
1391
  " to quantum-owned"
@@ -1402,26 +1402,26 @@ const Dn = ({
1402
1402
  {
1403
1403
  placeholder: "Choose a group...",
1404
1404
  options: J,
1405
- value: J.find((a) => a.value === y) || null,
1405
+ value: J.find((a) => a.value === j) || null,
1406
1406
  onChange: ae,
1407
1407
  isLoading: Y,
1408
1408
  isDisabled: Y,
1409
1409
  isClearable: !0
1410
1410
  }
1411
1411
  ),
1412
- x.error && /* @__PURE__ */ e.jsxs(Ve, { status: "error", mt: 2, children: [
1413
- /* @__PURE__ */ e.jsx(et, {}),
1414
- /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", children: [
1412
+ d.error && /* @__PURE__ */ e.jsxs(et, { status: "error", mt: 2, children: [
1413
+ /* @__PURE__ */ e.jsx(tt, {}),
1414
+ /* @__PURE__ */ e.jsxs(S, { fontSize: "sm", children: [
1415
1415
  "Failed to load groups: ",
1416
- x.error.message
1416
+ d.error.message
1417
1417
  ] })
1418
1418
  ] })
1419
1419
  ] }),
1420
- y && /* @__PURE__ */ e.jsxs(X, { children: [
1420
+ j && /* @__PURE__ */ e.jsxs(X, { children: [
1421
1421
  /* @__PURE__ */ e.jsx(ge, { children: c === "convert" ? `Select ${o.plural} to Convert` : `Select ${o.plural} to Copy` }),
1422
1422
  i ? /* @__PURE__ */ e.jsxs(V, { children: [
1423
1423
  /* @__PURE__ */ e.jsx(Lt, { size: "sm" }),
1424
- /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", color: "gray.600", children: [
1424
+ /* @__PURE__ */ e.jsxs(S, { fontSize: "sm", color: "gray.600", children: [
1425
1425
  "Loading ",
1426
1426
  o.pluralLowerCase,
1427
1427
  "..."
@@ -1431,45 +1431,45 @@ const Dn = ({
1431
1431
  he,
1432
1432
  {
1433
1433
  placeholder: c === "convert" ? `Choose ${o.pluralLowerCase} to convert...` : `Choose ${o.pluralLowerCase} to copy...`,
1434
- options: B,
1435
- value: B.filter(
1436
- (a) => w.includes(a.value)
1434
+ options: U,
1435
+ value: U.filter(
1436
+ (a) => M.includes(a.value)
1437
1437
  ),
1438
1438
  onChange: Z,
1439
- isDisabled: B.length === 0,
1439
+ isDisabled: U.length === 0,
1440
1440
  isClearable: !0,
1441
1441
  isMulti: !0,
1442
1442
  closeMenuOnSelect: !1,
1443
- formatOptionLabel: (a, { context: C }) => /* @__PURE__ */ e.jsxs(V, { justify: "space-between", w: "100%", children: [
1443
+ formatOptionLabel: (a, { context: w }) => /* @__PURE__ */ e.jsxs(V, { justify: "space-between", w: "100%", children: [
1444
1444
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
1445
- /* @__PURE__ */ e.jsx(M, { children: a.label }),
1446
- C === "value" && a.isQuantumOwned && /* @__PURE__ */ e.jsx(M, { color: "blue", fontSize: "xs", children: "(Quantum Owned)" })
1445
+ /* @__PURE__ */ e.jsx(S, { children: a.label }),
1446
+ w === "value" && a.isQuantumOwned && /* @__PURE__ */ e.jsx(S, { color: "blue", fontSize: "xs", children: "(Quantum Owned)" })
1447
1447
  ] }),
1448
- a.isQuantumOwned && C === "menu" && /* @__PURE__ */ e.jsx(Fe, { size: "sm", colorScheme: "blue", variant: "solid", children: "Quantum Owned" })
1448
+ a.isQuantumOwned && w === "menu" && /* @__PURE__ */ e.jsx(Ge, { size: "sm", colorScheme: "blue", variant: "solid", children: "Quantum Owned" })
1449
1449
  ] })
1450
1450
  }
1451
1451
  ),
1452
- B.length === 0 && /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", color: "gray.500", mt: 2, children: [
1452
+ U.length === 0 && /* @__PURE__ */ e.jsxs(S, { fontSize: "sm", color: "gray.500", mt: 2, children: [
1453
1453
  "No ",
1454
1454
  o.pluralLowerCase,
1455
1455
  " found in this group"
1456
1456
  ] })
1457
1457
  ] }),
1458
- N.error && /* @__PURE__ */ e.jsxs(Ve, { status: "error", mt: 2, children: [
1459
- /* @__PURE__ */ e.jsx(et, {}),
1460
- /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", children: [
1458
+ D.error && /* @__PURE__ */ e.jsxs(et, { status: "error", mt: 2, children: [
1459
+ /* @__PURE__ */ e.jsx(tt, {}),
1460
+ /* @__PURE__ */ e.jsxs(S, { fontSize: "sm", children: [
1461
1461
  "Failed to load ",
1462
1462
  o.pluralLowerCase,
1463
1463
  ":",
1464
1464
  " ",
1465
- N.error.message
1465
+ D.error.message
1466
1466
  ] })
1467
1467
  ] })
1468
1468
  ] }),
1469
- G.length > 0 && /* @__PURE__ */ e.jsxs(se, { p: 4, bg: "gray.50", borderRadius: "md", children: [
1470
- /* @__PURE__ */ e.jsx(M, { fontWeight: "semibold", mb: 3, children: G.length === 1 ? `${o.singular} to ${c === "copy" ? "Copy" : "Convert"}` : `${G.length} ${o.plural} to ${c === "copy" ? "Copy" : "Convert"}` }),
1469
+ P.length > 0 && /* @__PURE__ */ e.jsxs(se, { p: 4, bg: "gray.50", borderRadius: "md", children: [
1470
+ /* @__PURE__ */ e.jsx(S, { fontWeight: "semibold", mb: 3, children: P.length === 1 ? `${o.singular} to ${c === "copy" ? "Copy" : "Convert"}` : `${P.length} ${o.plural} to ${c === "copy" ? "Copy" : "Convert"}` }),
1471
1471
  /* @__PURE__ */ e.jsxs(ue, { align: "start", spacing: 3, children: [
1472
- G.map((a, C) => /* @__PURE__ */ e.jsxs(
1472
+ P.map((a, w) => /* @__PURE__ */ e.jsxs(
1473
1473
  se,
1474
1474
  {
1475
1475
  w: "100%",
@@ -1480,12 +1480,12 @@ const Dn = ({
1480
1480
  borderColor: "gray.200",
1481
1481
  children: [
1482
1482
  /* @__PURE__ */ e.jsxs(V, { justify: "space-between", align: "start", mb: 2, children: [
1483
- /* @__PURE__ */ e.jsxs(M, { fontWeight: "medium", fontSize: "sm", children: [
1484
- C + 1,
1483
+ /* @__PURE__ */ e.jsxs(S, { fontWeight: "medium", fontSize: "sm", children: [
1484
+ w + 1,
1485
1485
  ". ",
1486
1486
  a.name
1487
1487
  ] }),
1488
- a.quantumOwned && /* @__PURE__ */ e.jsx(Fe, { size: "sm", colorScheme: "blue", variant: "solid", children: "Quantum Owned" })
1488
+ a.quantumOwned && /* @__PURE__ */ e.jsx(Ge, { size: "sm", colorScheme: "blue", variant: "solid", children: "Quantum Owned" })
1489
1489
  ] }),
1490
1490
  /* @__PURE__ */ e.jsxs(
1491
1491
  ue,
@@ -1495,17 +1495,17 @@ const Dn = ({
1495
1495
  fontSize: "sm",
1496
1496
  color: "gray.600",
1497
1497
  children: [
1498
- a.description && /* @__PURE__ */ e.jsxs(M, { children: [
1498
+ a.description && /* @__PURE__ */ e.jsxs(S, { children: [
1499
1499
  /* @__PURE__ */ e.jsx("strong", { children: "Description:" }),
1500
1500
  " ",
1501
1501
  a.description
1502
1502
  ] }),
1503
- /* @__PURE__ */ e.jsxs(M, { children: [
1503
+ /* @__PURE__ */ e.jsxs(S, { children: [
1504
1504
  /* @__PURE__ */ e.jsx("strong", { children: "Activities:" }),
1505
1505
  " ",
1506
1506
  a.moduleActions.length
1507
1507
  ] }),
1508
- /* @__PURE__ */ e.jsxs(M, { children: [
1508
+ /* @__PURE__ */ e.jsxs(S, { children: [
1509
1509
  /* @__PURE__ */ e.jsx("strong", { children: "Categories:" }),
1510
1510
  " ",
1511
1511
  a.categories.map((l) => l.name).join(", ") || "None"
@@ -1517,7 +1517,7 @@ const Dn = ({
1517
1517
  },
1518
1518
  a.id
1519
1519
  )),
1520
- G.length > 1 && /* @__PURE__ */ e.jsx(
1520
+ P.length > 1 && /* @__PURE__ */ e.jsx(
1521
1521
  se,
1522
1522
  {
1523
1523
  w: "100%",
@@ -1526,9 +1526,9 @@ const Dn = ({
1526
1526
  borderRadius: "md",
1527
1527
  border: "1px solid",
1528
1528
  borderColor: "blue.200",
1529
- children: /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", fontWeight: "medium", color: "blue.800", children: [
1529
+ children: /* @__PURE__ */ e.jsxs(S, { fontSize: "sm", fontWeight: "medium", color: "blue.800", children: [
1530
1530
  "Total: ",
1531
- G.length,
1531
+ P.length,
1532
1532
  " ",
1533
1533
  o.pluralLowerCase,
1534
1534
  " will be",
@@ -1537,7 +1537,7 @@ const Dn = ({
1537
1537
  ] })
1538
1538
  }
1539
1539
  ),
1540
- d && G.filter((a) => a.moduleActions.some((C) => !C.action.quantumOwned)).length > 0 && /* @__PURE__ */ e.jsx(
1540
+ h && P.filter((a) => a.moduleActions.some((w) => !w.action.quantumOwned)).length > 0 && /* @__PURE__ */ e.jsx(
1541
1541
  se,
1542
1542
  {
1543
1543
  p: 2,
@@ -1545,18 +1545,18 @@ const Dn = ({
1545
1545
  borderRadius: "md",
1546
1546
  border: "1px solid",
1547
1547
  borderColor: "yellow.200",
1548
- children: /* @__PURE__ */ e.jsx(M, { fontSize: "sm", fontWeight: "medium", color: "yellow.800", children: c === "convert" ? `Converting ${o.plural} will convert non QM-Owned ${u.plural} to QM-Owned ${u.plural}` : `Copying ${o.plural} with Non QM-Owned ${u.plural} will create corresponding QM-Owned ${u.plural}` })
1548
+ children: /* @__PURE__ */ e.jsx(S, { fontSize: "sm", fontWeight: "medium", color: "yellow.800", children: c === "convert" ? `Converting ${o.plural} will convert non QM-Owned ${b.plural} to QM-Owned ${b.plural}` : `Copying ${o.plural} with Non QM-Owned ${b.plural} will create corresponding QM-Owned ${b.plural}` })
1549
1549
  }
1550
1550
  )
1551
1551
  ] })
1552
1552
  ] }),
1553
- !p && /* @__PURE__ */ e.jsxs(Ne, { spacing: 4, justifyContent: "flex-end", children: [
1553
+ !g && /* @__PURE__ */ e.jsxs(Ne, { spacing: 4, justifyContent: "flex-end", children: [
1554
1554
  /* @__PURE__ */ e.jsx(
1555
1555
  ne,
1556
1556
  {
1557
1557
  variant: "outline",
1558
- onClick: U,
1559
- isDisabled: L,
1558
+ onClick: W,
1559
+ isDisabled: C,
1560
1560
  children: "Cancel"
1561
1561
  }
1562
1562
  ),
@@ -1564,123 +1564,123 @@ const Dn = ({
1564
1564
  ne,
1565
1565
  {
1566
1566
  colorScheme: c === "copy" ? "blue" : "green",
1567
- onClick: T,
1568
- isDisabled: G.length === 0 || L,
1569
- isLoading: L,
1567
+ onClick: O,
1568
+ isDisabled: P.length === 0 || C,
1569
+ isLoading: C,
1570
1570
  loadingText: `${c === "copy" ? "Copying" : "Converting"}...`,
1571
1571
  children: [
1572
1572
  c === "copy" ? "Copy" : "Convert",
1573
1573
  " ",
1574
- G.length === 1 ? o.singular : `${G.length} ${o.plural}`
1574
+ P.length === 1 ? o.singular : `${P.length} ${o.plural}`
1575
1575
  ]
1576
1576
  }
1577
1577
  )
1578
1578
  ] })
1579
1579
  ] }) });
1580
1580
  }, Dt = an(void 0), Ee = () => {
1581
- const s = ln(Dt);
1582
- if (!s)
1581
+ const n = ln(Dt);
1582
+ if (!n)
1583
1583
  throw new Error(
1584
1584
  "useUpsertModuleFormContext must be used within a UpsertModuleFormProvider"
1585
1585
  );
1586
- return s;
1587
- }, qn = ({
1588
- name: s,
1586
+ return n;
1587
+ }, Kn = ({
1588
+ name: n,
1589
1589
  setName: t,
1590
1590
  actions: r,
1591
- moduleActionEntries: p,
1592
- setModuleActionEntries: m,
1593
- availableCategories: h,
1594
- selectedCategoryIds: d,
1595
- setSelectedCategoryIds: g,
1596
- description: n,
1591
+ moduleActionEntries: g,
1592
+ setModuleActionEntries: u,
1593
+ availableCategories: m,
1594
+ selectedCategoryIds: h,
1595
+ setSelectedCategoryIds: x,
1596
+ description: s,
1597
1597
  setDescription: o,
1598
- selectedMetadataIds: u,
1599
- setSelectedMetadataIds: y,
1600
- ...b
1598
+ selectedMetadataIds: b,
1599
+ setSelectedMetadataIds: j,
1600
+ ...L
1601
1601
  }) => {
1602
- const w = Ht(), I = $(() => {
1602
+ const M = Ht(), f = N(() => {
1603
1603
  const v = {};
1604
- return p.forEach((z) => {
1604
+ return g.forEach((z) => {
1605
1605
  v[z.actionId] = (v[z.actionId] ?? 0) + 1;
1606
1606
  }), v;
1607
- }, [p]), L = E(
1608
- (v) => I[v] ?? 0,
1609
- [I]
1610
- ), f = $(() => r.map((v) => ({
1607
+ }, [g]), C = E(
1608
+ (v) => f[v] ?? 0,
1609
+ [f]
1610
+ ), p = N(() => r.map((v) => ({
1611
1611
  ...v,
1612
- selected: (I[v.id] ?? 0) > 0
1613
- })), [r, I]), c = $(() => r.reduce((v, z) => (v[z.id] = z, v), {}), [r]), k = E(
1612
+ selected: (f[v.id] ?? 0) > 0
1613
+ })), [r, f]), c = N(() => r.reduce((v, z) => (v[z.id] = z, v), {}), [r]), A = E(
1614
1614
  (v, z) => {
1615
1615
  if (z) {
1616
- const R = {
1616
+ const T = {
1617
1617
  key: crypto.randomUUID(),
1618
1618
  actionId: v.id,
1619
1619
  reportId: null
1620
1620
  };
1621
- m((O) => [...O, R]);
1621
+ u((F) => [...F, T]);
1622
1622
  } else
1623
- m((R) => {
1624
- for (let O = R.length - 1; O >= 0; O--)
1625
- if (R[O].actionId === v.id) {
1626
- const K = [...R];
1627
- return K.splice(O, 1), K;
1623
+ u((T) => {
1624
+ for (let F = T.length - 1; F >= 0; F--)
1625
+ if (T[F].actionId === v.id) {
1626
+ const G = [...T];
1627
+ return G.splice(F, 1), G;
1628
1628
  }
1629
- return R;
1629
+ return T;
1630
1630
  });
1631
1631
  },
1632
- [m]
1633
- ), x = E(
1632
+ [u]
1633
+ ), d = E(
1634
1634
  (v) => {
1635
1635
  t(v.target.value);
1636
1636
  },
1637
1637
  [t]
1638
- ), N = E(
1638
+ ), D = E(
1639
1639
  (v) => {
1640
1640
  o?.(v.target.value);
1641
1641
  },
1642
1642
  [o]
1643
1643
  );
1644
- return /* @__PURE__ */ e.jsxs(se, { ...b, children: [
1644
+ return /* @__PURE__ */ e.jsxs(se, { ...L, children: [
1645
1645
  /* @__PURE__ */ e.jsxs(V, { gap: "2rem", children: [
1646
- /* @__PURE__ */ e.jsx(Kn, { name: s ?? "", onInputChange: x }),
1646
+ /* @__PURE__ */ e.jsx(Hn, { name: n ?? "", onInputChange: d }),
1647
1647
  /* @__PURE__ */ e.jsx(
1648
- Hn,
1648
+ Yn,
1649
1649
  {
1650
- availableCategories: h,
1651
- value: d,
1652
- onChange: g
1650
+ availableCategories: m,
1651
+ value: h,
1652
+ onChange: x
1653
1653
  }
1654
1654
  )
1655
1655
  ] }),
1656
1656
  /* @__PURE__ */ e.jsx(
1657
- Yn,
1657
+ Jn,
1658
1658
  {
1659
- description: n ?? "",
1660
- onInputChange: N
1659
+ description: s ?? "",
1660
+ onInputChange: D
1661
1661
  }
1662
1662
  ),
1663
1663
  /* @__PURE__ */ e.jsx(
1664
- Vn,
1664
+ es,
1665
1665
  {
1666
- selectedMetadataIds: u,
1667
- setSelectedMetadataIds: y
1666
+ selectedMetadataIds: b,
1667
+ setSelectedMetadataIds: j
1668
1668
  }
1669
1669
  ),
1670
1670
  /* @__PURE__ */ e.jsx(
1671
- Jn,
1671
+ Xn,
1672
1672
  {
1673
- moduleActionEntries: p,
1674
- setModuleActionEntries: m,
1673
+ moduleActionEntries: g,
1674
+ setModuleActionEntries: u,
1675
1675
  actionsById: c,
1676
- onAdjustActivities: () => w.onOpen()
1676
+ onAdjustActivities: () => M.onOpen()
1677
1677
  }
1678
1678
  ),
1679
1679
  /* @__PURE__ */ e.jsxs(
1680
1680
  Yt,
1681
1681
  {
1682
- isOpen: w.isOpen,
1683
- onClose: w.onClose,
1682
+ isOpen: M.isOpen,
1683
+ onClose: M.onClose,
1684
1684
  size: "6xl",
1685
1685
  children: [
1686
1686
  /* @__PURE__ */ e.jsx(Jt, {}),
@@ -1688,12 +1688,12 @@ const Dn = ({
1688
1688
  /* @__PURE__ */ e.jsx(Zt, { children: "Select Activities" }),
1689
1689
  /* @__PURE__ */ e.jsx(Vt, {}),
1690
1690
  /* @__PURE__ */ e.jsx(en, { children: /* @__PURE__ */ e.jsx(
1691
- Qn,
1691
+ qn,
1692
1692
  {
1693
- actions: f,
1694
- onSelected: k,
1693
+ actions: p,
1694
+ onSelected: A,
1695
1695
  allowDuplicateSelection: !0,
1696
- getSelectedCount: L,
1696
+ getSelectedCount: C,
1697
1697
  disableCreate: !0,
1698
1698
  disableDelete: !0,
1699
1699
  tableProps: {
@@ -1706,8 +1706,8 @@ const Dn = ({
1706
1706
  ne,
1707
1707
  {
1708
1708
  colorScheme: "blue",
1709
- onClick: w.onClose,
1710
- isDisabled: p.length === 0,
1709
+ onClick: M.onClose,
1710
+ isDisabled: g.length === 0,
1711
1711
  children: "Done"
1712
1712
  }
1713
1713
  ) })
@@ -1716,72 +1716,72 @@ const Dn = ({
1716
1716
  }
1717
1717
  )
1718
1718
  ] });
1719
- }, Kn = Ae(
1719
+ }, Hn = Ae(
1720
1720
  ({
1721
- name: s,
1721
+ name: n,
1722
1722
  onInputChange: t
1723
1723
  }) => {
1724
- const { getLabel: r } = xe(), p = r("module"), { isView: m } = Ee();
1724
+ const { getLabel: r } = xe(), g = r("module"), { isView: u } = Ee();
1725
1725
  return /* @__PURE__ */ e.jsxs(X, { mb: 4, children: [
1726
1726
  /* @__PURE__ */ e.jsxs(ge, { children: [
1727
- p,
1727
+ g,
1728
1728
  " Name"
1729
1729
  ] }),
1730
1730
  /* @__PURE__ */ e.jsx(
1731
1731
  ye,
1732
1732
  {
1733
1733
  placeholder: "i.e. ACL RTP Test Battery",
1734
- value: s,
1734
+ value: n,
1735
1735
  onChange: t,
1736
1736
  isRequired: !0,
1737
- isDisabled: m
1737
+ isDisabled: u
1738
1738
  }
1739
1739
  )
1740
1740
  ] });
1741
1741
  }
1742
- ), Hn = Ae(
1742
+ ), Yn = Ae(
1743
1743
  ({
1744
- availableCategories: s,
1744
+ availableCategories: n,
1745
1745
  value: t,
1746
1746
  onChange: r
1747
1747
  }) => {
1748
- const { getLabel: p } = xe(), m = p("module"), { isView: h } = Ee(), d = $(() => s.map((g) => ({
1749
- value: g.id,
1750
- label: g.name
1751
- })), [s]);
1748
+ const { getLabel: g } = xe(), u = g("module"), { isView: m } = Ee(), h = N(() => n.map((x) => ({
1749
+ value: x.id,
1750
+ label: x.name
1751
+ })), [n]);
1752
1752
  return /* @__PURE__ */ e.jsxs(X, { mb: 4, children: [
1753
1753
  /* @__PURE__ */ e.jsxs(ge, { children: [
1754
- m,
1754
+ u,
1755
1755
  " Category"
1756
1756
  ] }),
1757
1757
  /* @__PURE__ */ e.jsx(
1758
1758
  he,
1759
1759
  {
1760
- isDisabled: s.length === 0 || h,
1761
- options: d,
1762
- value: s.filter((g) => t.includes(g.id)).map((g) => ({
1763
- value: g.id,
1764
- label: g.name
1760
+ isDisabled: n.length === 0 || m,
1761
+ options: h,
1762
+ value: n.filter((x) => t.includes(x.id)).map((x) => ({
1763
+ value: x.id,
1764
+ label: x.name
1765
1765
  }))[0] ?? null,
1766
- onChange: (g) => r(g ? [g.value] : []),
1766
+ onChange: (x) => r(x ? [x.value] : []),
1767
1767
  placeholder: "Select category"
1768
1768
  }
1769
1769
  )
1770
1770
  ] });
1771
1771
  }
1772
- ), Yn = Ae(
1772
+ ), Jn = Ae(
1773
1773
  ({
1774
- description: s,
1774
+ description: n,
1775
1775
  onInputChange: t
1776
1776
  }) => {
1777
- const { getLabel: r } = xe(), p = r("module"), { isView: m } = Ee();
1777
+ const { getLabel: r } = xe(), g = r("module"), { isView: u } = Ee();
1778
1778
  return /* @__PURE__ */ e.jsxs(X, { mb: 4, children: [
1779
1779
  /* @__PURE__ */ e.jsx(ge, { children: /* @__PURE__ */ e.jsxs("span", { children: [
1780
1780
  "Description",
1781
- /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", color: "gray.500", children: [
1781
+ /* @__PURE__ */ e.jsxs(S, { fontSize: "sm", color: "gray.500", children: [
1782
1782
  "Briefly describe the objective of this",
1783
1783
  " ",
1784
- p.toLocaleLowerCase(),
1784
+ g.toLocaleLowerCase(),
1785
1785
  ". Max 40 words."
1786
1786
  ] })
1787
1787
  ] }) }),
@@ -1789,266 +1789,266 @@ const Dn = ({
1789
1789
  ye,
1790
1790
  {
1791
1791
  placeholder: "i.e. Assess readiness to return to play post-ACL reconstruction",
1792
- value: s,
1792
+ value: n,
1793
1793
  onChange: t,
1794
- isDisabled: m
1794
+ isDisabled: u
1795
1795
  }
1796
1796
  )
1797
1797
  ] });
1798
1798
  }
1799
- ), Jn = Ae(
1799
+ ), Xn = Ae(
1800
1800
  ({
1801
- moduleActionEntries: s,
1801
+ moduleActionEntries: n,
1802
1802
  setModuleActionEntries: t,
1803
1803
  actionsById: r,
1804
- onAdjustActivities: p
1804
+ onAdjustActivities: g
1805
1805
  }) => {
1806
- const { getLabel: m } = xe(), { isView: h } = Ee(), d = $(() => ({
1807
- module: m("module"),
1808
- moduleLowerCase: m("module").toLocaleLowerCase(),
1809
- action: m("action"),
1810
- actionPlural: m("action_plural"),
1811
- actionPluralLowerCase: m("action_plural").toLocaleLowerCase()
1812
- }), [m]), g = $(
1813
- () => s.map((n) => {
1814
- const o = r[n.actionId];
1806
+ const { getLabel: u } = xe(), { isView: m } = Ee(), h = N(() => ({
1807
+ module: u("module"),
1808
+ moduleLowerCase: u("module").toLocaleLowerCase(),
1809
+ action: u("action"),
1810
+ actionPlural: u("action_plural"),
1811
+ actionPluralLowerCase: u("action_plural").toLocaleLowerCase()
1812
+ }), [u]), x = N(
1813
+ () => n.map((s) => {
1814
+ const o = r[s.actionId];
1815
1815
  return o ? {
1816
- key: n.key,
1817
- actionId: n.actionId,
1816
+ key: s.key,
1817
+ actionId: s.actionId,
1818
1818
  name: o.name,
1819
- reports: A(Ge, o.reports) || [],
1820
- selectedReportId: n.reportId
1819
+ reports: k(Pe, o.reports) || [],
1820
+ selectedReportId: s.reportId
1821
1821
  } : null;
1822
1822
  }).filter(Boolean),
1823
- [s, r]
1823
+ [n, r]
1824
1824
  );
1825
1825
  return /* @__PURE__ */ e.jsxs(X, { mb: 4, children: [
1826
1826
  /* @__PURE__ */ e.jsxs(V, { justifyContent: "space-between", children: [
1827
1827
  /* @__PURE__ */ e.jsx(ge, { children: /* @__PURE__ */ e.jsxs("span", { children: [
1828
- d.actionPlural,
1829
- !h && /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", color: "gray.500", children: [
1828
+ h.actionPlural,
1829
+ !m && /* @__PURE__ */ e.jsxs(S, { fontSize: "sm", color: "gray.500", children: [
1830
1830
  "Drag and drop to reorder the ",
1831
- d.actionPluralLowerCase,
1831
+ h.actionPluralLowerCase,
1832
1832
  " ",
1833
1833
  "in this ",
1834
- d.moduleLowerCase,
1834
+ h.moduleLowerCase,
1835
1835
  "."
1836
1836
  ] })
1837
1837
  ] }) }),
1838
- !h && /* @__PURE__ */ e.jsxs(
1838
+ !m && /* @__PURE__ */ e.jsxs(
1839
1839
  ne,
1840
1840
  {
1841
1841
  size: "sm",
1842
1842
  variant: "solid",
1843
1843
  colorScheme: "blue",
1844
- onClick: p,
1844
+ onClick: g,
1845
1845
  children: [
1846
1846
  "Add / Remove ",
1847
- d.actionPlural
1847
+ h.actionPlural
1848
1848
  ]
1849
1849
  }
1850
1850
  )
1851
1851
  ] }),
1852
- g.length === 0 ? /* @__PURE__ */ e.jsx(ue, { children: /* @__PURE__ */ e.jsxs(M, { color: "gray.500", fontSize: "lg", mb: "4rem", mt: "4rem", children: [
1852
+ x.length === 0 ? /* @__PURE__ */ e.jsx(ue, { children: /* @__PURE__ */ e.jsxs(S, { color: "gray.500", fontSize: "lg", mb: "4rem", mt: "4rem", children: [
1853
1853
  "No ",
1854
- d.actionPluralLowerCase,
1854
+ h.actionPluralLowerCase,
1855
1855
  " selected for this",
1856
1856
  " ",
1857
- d.moduleLowerCase,
1857
+ h.moduleLowerCase,
1858
1858
  ".",
1859
- !h && /* @__PURE__ */ e.jsxs(
1859
+ !m && /* @__PURE__ */ e.jsxs(
1860
1860
  ne,
1861
1861
  {
1862
1862
  ml: "0.5em",
1863
1863
  size: "sm",
1864
1864
  variant: "link",
1865
1865
  colorScheme: "blue",
1866
- onClick: p,
1866
+ onClick: g,
1867
1867
  children: [
1868
1868
  "Add ",
1869
- d.actionPluralLowerCase,
1869
+ h.actionPluralLowerCase,
1870
1870
  "."
1871
1871
  ]
1872
1872
  }
1873
1873
  )
1874
1874
  ] }) }) : /* @__PURE__ */ e.jsx(
1875
- Xn,
1875
+ Zn,
1876
1876
  {
1877
- value: g,
1878
- onChange: (n) => {
1877
+ value: x,
1878
+ onChange: (s) => {
1879
1879
  t((o) => {
1880
- const u = o.map((b) => {
1881
- const w = r[b.actionId];
1882
- return w ? {
1883
- key: b.key,
1884
- actionId: b.actionId,
1885
- name: w.name,
1886
- reports: A(Ge, w.reports) || [],
1887
- selectedReportId: b.reportId
1880
+ const b = o.map((L) => {
1881
+ const M = r[L.actionId];
1882
+ return M ? {
1883
+ key: L.key,
1884
+ actionId: L.actionId,
1885
+ name: M.name,
1886
+ reports: k(Pe, M.reports) || [],
1887
+ selectedReportId: L.reportId
1888
1888
  } : null;
1889
1889
  }).filter(Boolean);
1890
- return n(u).map((b) => ({
1891
- key: b.key,
1892
- actionId: b.actionId,
1893
- reportId: b.selectedReportId
1890
+ return s(b).map((L) => ({
1891
+ key: L.key,
1892
+ actionId: L.actionId,
1893
+ reportId: L.selectedReportId
1894
1894
  }));
1895
1895
  });
1896
1896
  },
1897
- disabled: h,
1897
+ disabled: m,
1898
1898
  setModuleActionEntries: t
1899
1899
  }
1900
1900
  )
1901
1901
  ] });
1902
1902
  }
1903
- ), Xn = Ae(
1903
+ ), Zn = Ae(
1904
1904
  ({
1905
- value: s,
1905
+ value: n,
1906
1906
  onChange: t,
1907
1907
  disabled: r,
1908
- setModuleActionEntries: p
1908
+ setModuleActionEntries: g
1909
1909
  }) => {
1910
- const [m] = q(
1910
+ const [u] = K(
1911
1911
  () => Math.random().toString(36).substring(2, 15)
1912
- ), h = E(
1913
- (n, o) => {
1914
- r || t((u) => {
1915
- const y = [...u], [b] = y.splice(n, 1);
1916
- return y.splice(o, 0, b), y;
1912
+ ), m = E(
1913
+ (s, o) => {
1914
+ r || t((b) => {
1915
+ const j = [...b], [L] = j.splice(s, 1);
1916
+ return j.splice(o, 0, L), j;
1917
1917
  });
1918
1918
  },
1919
1919
  [t, r]
1920
- ), d = E(
1921
- (n) => {
1922
- p((o) => {
1923
- const u = o.findIndex((I) => I.key === n);
1924
- if (u === -1) return o;
1925
- const y = o[u], b = {
1920
+ ), h = E(
1921
+ (s) => {
1922
+ g((o) => {
1923
+ const b = o.findIndex((f) => f.key === s);
1924
+ if (b === -1) return o;
1925
+ const j = o[b], L = {
1926
1926
  key: crypto.randomUUID(),
1927
- actionId: y.actionId,
1927
+ actionId: j.actionId,
1928
1928
  reportId: null
1929
- }, w = [...o];
1930
- return w.splice(u + 1, 0, b), w;
1929
+ }, M = [...o];
1930
+ return M.splice(b + 1, 0, L), M;
1931
1931
  });
1932
1932
  },
1933
- [p]
1934
- ), g = E(
1935
- (n) => {
1936
- p(
1937
- (o) => o.filter((u) => u.key !== n)
1933
+ [g]
1934
+ ), x = E(
1935
+ (s) => {
1936
+ g(
1937
+ (o) => o.filter((b) => b.key !== s)
1938
1938
  );
1939
1939
  },
1940
- [p]
1940
+ [g]
1941
1941
  );
1942
- return /* @__PURE__ */ e.jsx(se, { children: /* @__PURE__ */ e.jsx(kn, { backend: Mn, children: /* @__PURE__ */ e.jsx(ue, { spacing: 3, align: "stretch", children: s.map((n, o) => /* @__PURE__ */ e.jsx(
1943
- Zn,
1942
+ return /* @__PURE__ */ e.jsx(se, { children: /* @__PURE__ */ e.jsx(Mn, { backend: An, children: /* @__PURE__ */ e.jsx(ue, { spacing: 3, align: "stretch", children: n.map((s, o) => /* @__PURE__ */ e.jsx(
1943
+ Vn,
1944
1944
  {
1945
- listKey: m,
1946
- item: n,
1945
+ listKey: u,
1946
+ item: s,
1947
1947
  index: o,
1948
1948
  disabled: !!r,
1949
- move: h,
1950
- onReportChange: (u) => {
1951
- p(
1952
- (y) => y.map(
1953
- (b) => b.key === n.key ? { ...b, reportId: u } : b
1949
+ move: m,
1950
+ onReportChange: (b) => {
1951
+ g(
1952
+ (j) => j.map(
1953
+ (L) => L.key === s.key ? { ...L, reportId: b } : L
1954
1954
  )
1955
1955
  );
1956
1956
  },
1957
- onDuplicate: () => d(n.key),
1958
- onRemove: () => g(n.key)
1957
+ onDuplicate: () => h(s.key),
1958
+ onRemove: () => x(s.key)
1959
1959
  },
1960
- n.key
1960
+ s.key
1961
1961
  )) }) }) });
1962
1962
  }
1963
- ), Zn = Ae(
1963
+ ), Vn = Ae(
1964
1964
  ({
1965
- listKey: s,
1965
+ listKey: n,
1966
1966
  item: t,
1967
1967
  index: r,
1968
- disabled: p,
1969
- move: m,
1970
- onReportChange: h,
1971
- onDuplicate: d,
1972
- onRemove: g
1968
+ disabled: g,
1969
+ move: u,
1970
+ onReportChange: m,
1971
+ onDuplicate: h,
1972
+ onRemove: x
1973
1973
  }) => {
1974
- const n = cn(null), { getLabel: o } = xe(), u = o("action"), [{ handlerId: y }, b] = An({
1975
- accept: s,
1976
- collect: (x) => ({
1977
- handlerId: x.getHandlerId()?.toString() ?? ""
1974
+ const s = cn(null), { getLabel: o } = xe(), b = o("action"), [{ handlerId: j }, L] = On({
1975
+ accept: n,
1976
+ collect: (d) => ({
1977
+ handlerId: d.getHandlerId()?.toString() ?? ""
1978
1978
  }),
1979
- hover: (x, N) => {
1980
- if (!n.current)
1979
+ hover: (d, D) => {
1980
+ if (!s.current)
1981
1981
  return;
1982
- const v = x.index, z = r;
1982
+ const v = d.index, z = r;
1983
1983
  if (v === z)
1984
1984
  return;
1985
- const R = n.current?.getBoundingClientRect(), O = (R.bottom - R.top) / 2, oe = N.getClientOffset().y - R.top;
1986
- v < z && oe < O || v > z && oe > O || (m(v, z), x.index = z);
1985
+ const T = s.current?.getBoundingClientRect(), F = (T.bottom - T.top) / 2, oe = D.getClientOffset().y - T.top;
1986
+ v < z && oe < F || v > z && oe > F || (u(v, z), d.index = z);
1987
1987
  }
1988
- }), [{ isDragging: w }, I] = On({
1989
- type: s,
1988
+ }), [{ isDragging: M }, f] = Tn({
1989
+ type: n,
1990
1990
  item: () => ({ id: t.key, index: r }),
1991
- collect: (x) => ({
1992
- isDragging: x.isDragging()
1991
+ collect: (d) => ({
1992
+ isDragging: d.isDragging()
1993
1993
  }),
1994
- canDrag: !p
1995
- }), L = $(() => `action-report-label-${t.key}`, [t.key]), f = $(() => [
1994
+ canDrag: !g
1995
+ }), C = N(() => `action-report-label-${t.key}`, [t.key]), p = N(() => [
1996
1996
  { value: null, label: "No Report" },
1997
- ...t.reports.map((x) => {
1998
- const N = x.name && x.name.length > 0 ? x.name : "No Name", v = ke(x.reportKind);
1997
+ ...t.reports.map((d) => {
1998
+ const D = d.name && d.name.length > 0 ? d.name : "No Name", v = ke(d.reportKind);
1999
1999
  return {
2000
- value: x.id,
2001
- label: `${N} (${v})`
2000
+ value: d.id,
2001
+ label: `${D} (${v})`
2002
2002
  };
2003
2003
  })
2004
- ], [t.reports]), c = w ? 0.6 : 1, k = p ? "default" : w ? "grabbing" : "grab";
2005
- return I(b(n)), /* @__PURE__ */ e.jsx(
2004
+ ], [t.reports]), c = M ? 0.6 : 1, A = g ? "default" : M ? "grabbing" : "grab";
2005
+ return f(L(s)), /* @__PURE__ */ e.jsx(
2006
2006
  se,
2007
2007
  {
2008
- ref: n,
2008
+ ref: s,
2009
2009
  p: 3,
2010
2010
  border: "1px solid",
2011
2011
  borderColor: "gray.200",
2012
2012
  borderRadius: "md",
2013
2013
  bg: "gray.50",
2014
- style: { opacity: c, cursor: k },
2015
- "data-handler-id": y,
2014
+ style: { opacity: c, cursor: A },
2015
+ "data-handler-id": j,
2016
2016
  children: /* @__PURE__ */ e.jsxs(V, { justify: "space-between", align: "center", children: [
2017
2017
  /* @__PURE__ */ e.jsxs(V, { spacing: 3, children: [
2018
- /* @__PURE__ */ e.jsxs(M, { fontWeight: "semibold", minW: "2rem", children: [
2018
+ /* @__PURE__ */ e.jsxs(S, { fontWeight: "semibold", minW: "2rem", children: [
2019
2019
  r + 1,
2020
2020
  "."
2021
2021
  ] }),
2022
- /* @__PURE__ */ e.jsx(M, { fontWeight: "medium", children: t.name })
2022
+ /* @__PURE__ */ e.jsx(S, { fontWeight: "medium", children: t.name })
2023
2023
  ] }),
2024
2024
  /* @__PURE__ */ e.jsxs(V, { spacing: 3, align: "center", children: [
2025
- /* @__PURE__ */ e.jsxs(M, { id: L, fontSize: "sm", color: "gray.600", children: [
2026
- u,
2025
+ /* @__PURE__ */ e.jsxs(S, { id: C, fontSize: "sm", color: "gray.600", children: [
2026
+ b,
2027
2027
  " Report:"
2028
2028
  ] }),
2029
2029
  /* @__PURE__ */ e.jsx(se, { width: { base: "100%", md: "350px" }, children: /* @__PURE__ */ e.jsx(
2030
2030
  he,
2031
2031
  {
2032
- "aria-labelledby": L,
2033
- value: f.find(
2034
- (x) => x.value === t.selectedReportId
2032
+ "aria-labelledby": C,
2033
+ value: p.find(
2034
+ (d) => d.value === t.selectedReportId
2035
2035
  ),
2036
- onChange: (x) => {
2037
- h(x?.value || null);
2036
+ onChange: (d) => {
2037
+ m(d?.value || null);
2038
2038
  },
2039
- options: f,
2039
+ options: p,
2040
2040
  placeholder: "Select report...",
2041
- isDisabled: p
2041
+ isDisabled: g
2042
2042
  }
2043
2043
  ) }),
2044
- !p && /* @__PURE__ */ e.jsxs(V, { spacing: 1, children: [
2044
+ !g && /* @__PURE__ */ e.jsxs(V, { spacing: 1, children: [
2045
2045
  /* @__PURE__ */ e.jsx(
2046
2046
  ne,
2047
2047
  {
2048
2048
  size: "xs",
2049
2049
  variant: "ghost",
2050
2050
  colorScheme: "blue",
2051
- onClick: d,
2051
+ onClick: h,
2052
2052
  title: "Add another instance with a different report",
2053
2053
  children: "+ Duplicate"
2054
2054
  }
@@ -2059,7 +2059,7 @@ const Dn = ({
2059
2059
  size: "xs",
2060
2060
  variant: "ghost",
2061
2061
  colorScheme: "red",
2062
- onClick: g,
2062
+ onClick: x,
2063
2063
  title: "Remove this entry",
2064
2064
  children: "Remove"
2065
2065
  }
@@ -2070,12 +2070,12 @@ const Dn = ({
2070
2070
  }
2071
2071
  );
2072
2072
  }
2073
- ), Vn = Ae(
2073
+ ), es = Ae(
2074
2074
  ({
2075
- selectedMetadataIds: s,
2075
+ selectedMetadataIds: n,
2076
2076
  setSelectedMetadataIds: t
2077
2077
  }) => {
2078
- const { getLabel: r } = xe(), { isView: p, metadataOptions: m } = Ee(), h = $(() => [
2078
+ const { getLabel: r } = xe(), { isView: g, metadataOptions: u } = Ee(), m = N(() => [
2079
2079
  {
2080
2080
  key: "activity_type",
2081
2081
  label: `${r("action")} Type`,
@@ -2084,114 +2084,117 @@ const Dn = ({
2084
2084
  { key: "session_type", label: "Session Type", multi: !0 },
2085
2085
  { key: "body_region", label: "Body Region", multi: !0 },
2086
2086
  { key: "sport", label: "Sport", multi: !0 }
2087
- ], [r]), d = E(
2088
- (g, n) => {
2089
- const o = h.find((y) => y.key === g);
2087
+ ], [r]), h = E(
2088
+ (x, s) => {
2089
+ const o = m.find((j) => j.key === x);
2090
2090
  if (!o) return;
2091
- const u = o.multi ? (n ?? []).map((y) => y.id) : n ? [n.id] : [];
2092
- t((y) => [...y.filter((w) => Object.values(m || {}).flat().find((L) => L.id === w) && !Object.keys(m || {}).find(
2093
- (L) => m?.[L]?.some(
2094
- (f) => f.id === w && L === g
2091
+ const b = o.multi ? (s ?? []).map((j) => j.id) : s ? [s.id] : [];
2092
+ t((j) => [...j.filter((M) => Object.values(u || {}).flat().find((C) => C.id === M) && !Object.keys(u || {}).find(
2093
+ (C) => u?.[C]?.some(
2094
+ (p) => p.id === M && C === x
2095
2095
  )
2096
- )), ...u]);
2096
+ )), ...b]);
2097
2097
  },
2098
- [h, m, t]
2098
+ [m, u, t]
2099
2099
  );
2100
- return m ? /* @__PURE__ */ e.jsxs(X, { mb: 4, children: [
2100
+ return u ? /* @__PURE__ */ e.jsxs(X, { mb: 4, children: [
2101
2101
  /* @__PURE__ */ e.jsx(ge, { children: "Metadata Tags" }),
2102
- /* @__PURE__ */ e.jsx(V, { gap: "1rem", align: "start", children: h.map((g) => /* @__PURE__ */ e.jsxs(X, { flex: "1", children: [
2103
- /* @__PURE__ */ e.jsx(_e, { fontSize: "sm", children: g.label }),
2102
+ /* @__PURE__ */ e.jsx(V, { gap: "1rem", align: "start", children: m.map((x) => /* @__PURE__ */ e.jsxs(X, { flex: "1", children: [
2103
+ /* @__PURE__ */ e.jsx(ze, { fontSize: "sm", children: x.label }),
2104
2104
  /* @__PURE__ */ e.jsx(
2105
2105
  he,
2106
2106
  {
2107
- isMulti: g.multi,
2108
- value: m[g.key]?.filter(
2109
- (n) => s.includes(n.id)
2107
+ isMulti: x.multi,
2108
+ value: u[x.key]?.filter(
2109
+ (s) => n.includes(s.id)
2110
2110
  ),
2111
- onChange: (n) => {
2112
- d(
2113
- g.key,
2114
- n
2111
+ onChange: (s) => {
2112
+ h(
2113
+ x.key,
2114
+ s
2115
2115
  );
2116
2116
  },
2117
- options: m[g.key],
2118
- placeholder: `Select ${g.multi ? "one or more" : "one"} ${g.label.toLowerCase()}`,
2119
- isDisabled: p,
2120
- isClearable: g.multi
2117
+ options: u[x.key],
2118
+ placeholder: `Select ${x.multi ? "one or more" : "one"} ${x.label.toLowerCase()}`,
2119
+ isDisabled: g,
2120
+ isClearable: x.multi
2121
2121
  }
2122
2122
  )
2123
- ] }, g.key)) })
2123
+ ] }, x.key)) })
2124
2124
  ] }) : null;
2125
2125
  }
2126
- ), es = ({
2127
- value: s,
2126
+ ), ts = ({
2127
+ value: n,
2128
2128
  onChange: t,
2129
2129
  forceKind: r,
2130
- disableRemove: p,
2131
- disableKind: m,
2132
- isDisabled: h,
2133
- lockRanges: d,
2134
- ...g
2130
+ disableRemove: g,
2131
+ disableKind: u,
2132
+ isDisabled: m,
2133
+ lockRanges: h,
2134
+ canAddCopy: x,
2135
+ ...s
2135
2136
  }) => {
2136
- const n = $(() => [...s].sort((b, w) => {
2137
- const I = jt.indexOf(b.plane), L = jt.indexOf(w.plane);
2138
- return I - L;
2139
- }), [s]), o = E((b) => "segment" in b.id ? Rt(b.id.segment, b.plane, !0) ?? "Unknown" : $t(b.id.joint, b.plane, !0) ?? "Unknown", []), u = E(
2140
- (b, w) => {
2141
- const I = n.findIndex(
2142
- (f) => f.id === w.id && f.plane === w.plane
2143
- );
2144
- let L = [...n];
2145
- r && (w = { ...w, kind: r }), L[I] = w, d && (L = L.map((f) => ({
2146
- ...f,
2147
- min: w.min,
2148
- max: w.max
2149
- }))), t(L);
2137
+ const o = N(() => n.map((f, C) => C).sort((f, C) => {
2138
+ const p = bt.indexOf(n[f].plane), c = bt.indexOf(n[C].plane);
2139
+ return p - c;
2140
+ }), [n]), b = E((f) => "segment" in f.id ? Rt(f.id.segment, f.plane, !0) ?? "Unknown" : $t(f.id.joint, f.plane, !0) ?? "Unknown", []), j = E(
2141
+ (f, C) => {
2142
+ let p = [...n];
2143
+ r && (C = { ...C, kind: r }), p[f] = C, h && (p = p.map((c) => ({
2144
+ ...c,
2145
+ min: C.min,
2146
+ max: C.max
2147
+ }))), t(p);
2150
2148
  },
2151
- [t, n, r, d]
2152
- ), y = E(
2153
- (b) => {
2154
- const w = n.filter(
2155
- (I) => I.id !== b.id || I.plane !== b.plane
2156
- );
2157
- t(w);
2149
+ [t, n, r, h]
2150
+ ), L = E(
2151
+ (f) => {
2152
+ t(n.filter((C, p) => p !== f));
2153
+ },
2154
+ [t, n]
2155
+ ), M = E(
2156
+ (f) => {
2157
+ const C = [...n];
2158
+ C.splice(f + 1, 0, { ...n[f], oldId: void 0 }), t(C);
2158
2159
  },
2159
2160
  [t, n]
2160
2161
  );
2161
- return /* @__PURE__ */ e.jsx(ue, { alignItems: "flex-start", overflowY: "auto", ...g, children: n.map((b, w) => /* @__PURE__ */ e.jsx(
2162
- ts,
2162
+ return /* @__PURE__ */ e.jsx(ue, { alignItems: "flex-start", overflowY: "auto", ...s, children: o.map((f) => /* @__PURE__ */ e.jsx(
2163
+ ns,
2163
2164
  {
2164
- label: o(b),
2165
- parameter: b,
2166
- onChange: (I) => u(w, I),
2167
- onRemove: p || h ? void 0 : () => y(b),
2165
+ label: b(n[f]),
2166
+ parameter: n[f],
2167
+ onChange: (C) => j(f, C),
2168
+ onRemove: g || m ? void 0 : () => L(f),
2169
+ onAddCopy: x && !m ? () => M(f) : void 0,
2168
2170
  forceKind: r,
2169
- disableKind: m || h,
2170
- isDisabled: h
2171
+ disableKind: u || m,
2172
+ isDisabled: m
2171
2173
  },
2172
- `${JSON.stringify(b.id)}-${b.plane}`
2174
+ n[f].oldId ?? `new-${f}`
2173
2175
  )) });
2174
- }, ts = ({
2175
- label: s,
2176
+ }, ns = ({
2177
+ label: n,
2176
2178
  parameter: t,
2177
2179
  onChange: r,
2178
- onRemove: p,
2180
+ onRemove: g,
2181
+ onAddCopy: u,
2179
2182
  forceKind: m,
2180
2183
  disableKind: h,
2181
- isDisabled: d
2184
+ isDisabled: x
2182
2185
  }) => {
2183
- const g = E(
2184
- (u) => "joint" in t.id ? Tn(
2186
+ const s = E(
2187
+ (j) => "joint" in t.id ? Nn(
2185
2188
  t.id.joint,
2186
2189
  t.plane,
2187
- u < 0 ? -1 : 1
2188
- ) : Nn(
2190
+ j < 0 ? -1 : 1
2191
+ ) : Rn(
2189
2192
  t.id.segment,
2190
2193
  t.plane,
2191
- u < 0 ? -1 : 1
2194
+ j < 0 ? -1 : 1
2192
2195
  ),
2193
2196
  [t]
2194
- ), { min: n, max: o } = "joint" in t.id ? Rn(t.id.joint, t.plane) : { min: -180, max: 180 };
2197
+ ), { min: o, max: b } = "joint" in t.id ? $n(t.id.joint, t.plane) : { min: -180, max: 180 };
2195
2198
  return /* @__PURE__ */ e.jsxs(
2196
2199
  ue,
2197
2200
  {
@@ -2205,35 +2208,46 @@ const Dn = ({
2205
2208
  children: [
2206
2209
  /* @__PURE__ */ e.jsxs(V, { w: "100%", alignItems: "center", children: [
2207
2210
  /* @__PURE__ */ e.jsx(
2208
- M,
2211
+ S,
2209
2212
  {
2210
2213
  fontSize: "sm",
2211
2214
  flex: 1,
2212
2215
  textTransform: "capitalize",
2213
2216
  fontWeight: "semibold",
2214
- children: s
2217
+ children: n
2215
2218
  }
2216
2219
  ),
2217
2220
  t.sensorOnly ? /* @__PURE__ */ e.jsx(Oe, { size: "sm", colorScheme: "orange", variant: "subtle", children: "Sensor" }) : /* @__PURE__ */ e.jsxs(V, { spacing: 1, children: [
2218
2221
  /* @__PURE__ */ e.jsx(Oe, { size: "sm", colorScheme: "blue", variant: "subtle", children: "Pose" }),
2219
2222
  /* @__PURE__ */ e.jsx(Oe, { size: "sm", colorScheme: "orange", variant: "subtle", children: "Sensor" })
2220
2223
  ] }),
2221
- p && !d && /* @__PURE__ */ e.jsx(
2222
- rt,
2224
+ u && /* @__PURE__ */ e.jsx(
2225
+ Ze,
2226
+ {
2227
+ size: "xs",
2228
+ variant: "ghost",
2229
+ "aria-label": "Add another",
2230
+ title: "Add this parameter again with its own range",
2231
+ icon: /* @__PURE__ */ e.jsx(at, { as: Ln }),
2232
+ onClick: u
2233
+ }
2234
+ ),
2235
+ g && !x && /* @__PURE__ */ e.jsx(
2236
+ Ze,
2223
2237
  {
2224
2238
  size: "xs",
2225
2239
  variant: "ghost",
2226
2240
  "aria-label": "delete",
2227
- icon: /* @__PURE__ */ e.jsx(wt, { as: Ln }),
2228
- onClick: p
2241
+ icon: /* @__PURE__ */ e.jsx(at, { as: kn }),
2242
+ onClick: g
2229
2243
  }
2230
2244
  ),
2231
2245
  !m && /* @__PURE__ */ e.jsx(
2232
- Fn,
2246
+ Gn,
2233
2247
  {
2234
2248
  selectedItem: t?.kind ?? Xe.Limit,
2235
- onChange: ({ value: u }) => r({ ...t, kind: u }),
2236
- isDisabled: h || d,
2249
+ onChange: ({ value: j }) => r({ ...t, kind: j }),
2250
+ isDisabled: h || x,
2237
2251
  buttonProps: {
2238
2252
  size: "sm",
2239
2253
  variant: "outline",
@@ -2251,53 +2265,53 @@ const Dn = ({
2251
2265
  )
2252
2266
  ] }),
2253
2267
  /* @__PURE__ */ e.jsx(
2254
- Gn,
2268
+ Pn,
2255
2269
  {
2256
2270
  w: "100%",
2257
2271
  size: "xs",
2258
- min: n,
2259
- max: o,
2272
+ min: o,
2273
+ max: b,
2260
2274
  zeroMarker: !0,
2261
2275
  value: [t.min, t.max],
2262
- onChange: (u) => r({ ...t, min: u[0], max: u[1] }),
2263
- formatValue: (u) => `${Math.abs(u)}°`,
2264
- valueLabel: (u) => g(u) ?? "",
2265
- positiveNegativeLabels: g(0) ? [g(-1) ?? "", g(1) ?? ""] : void 0,
2266
- isDisabled: d
2276
+ onChange: (j) => r({ ...t, min: j[0], max: j[1] }),
2277
+ formatValue: (j) => `${Math.abs(j)}°`,
2278
+ valueLabel: (j) => s(j) ?? "",
2279
+ positiveNegativeLabels: s(0) ? [s(-1) ?? "", s(1) ?? ""] : void 0,
2280
+ isDisabled: x
2267
2281
  }
2268
2282
  )
2269
2283
  ]
2270
2284
  }
2271
2285
  );
2272
- }, He = (s, t) => "segment" in s && "segment" in t && s.segment === t.segment || "joint" in s && "joint" in t && s.joint === t.joint, vt = ({
2273
- options: s,
2286
+ }, Fe = (n, t) => "segment" in n && "segment" in t && n.segment === t.segment || "joint" in n && "joint" in t && n.joint === t.joint, vt = ({
2287
+ options: n,
2274
2288
  value: t,
2275
2289
  onChange: r,
2276
- forceKind: p,
2277
- singleValue: m,
2278
- singleValueSideless: h,
2279
- editOnly: d,
2280
- disableKind: g,
2281
- maxParameters: n,
2290
+ forceKind: g,
2291
+ singleValue: u,
2292
+ singleValueSideless: m,
2293
+ editOnly: h,
2294
+ disableKind: x,
2295
+ maxParameters: s,
2282
2296
  ...o
2283
2297
  }) => {
2284
- const u = h ? 2 : n, y = $(() => {
2285
- const f = /* @__PURE__ */ new Map();
2286
- return s.forEach((c) => {
2287
- const k = "joint" in c.id;
2288
- let x, N;
2289
- if (k ? (x = $t(c.id.joint, c.plane, !0) ?? "Unknown", N = `joint:${c.id.joint}`) : (x = Rt(c.id.segment, c.plane, !0) ?? "Unknown", N = `segment:${c.id.segment}`), !f.has(N)) {
2290
- const R = k ? bt(c.id.joint) ?? "Unknown Joint" : bt(c.id.segment) ?? "Unknown Segment";
2291
- f.set(N, {
2292
- label: R,
2298
+ const b = m ? 2 : s, j = N(() => {
2299
+ const p = /* @__PURE__ */ new Map();
2300
+ return n.forEach((c) => {
2301
+ const A = "joint" in c.id;
2302
+ let d, D;
2303
+ if (A ? (d = $t(c.id.joint, c.plane, !0) ?? "Unknown", D = `joint:${c.id.joint}`) : (d = Rt(c.id.segment, c.plane, !0) ?? "Unknown", D = `segment:${c.id.segment}`), !p.has(D)) {
2304
+ const T = A ? yt(c.id.joint) ?? "Unknown Joint" : yt(c.id.segment) ?? "Unknown Segment";
2305
+ p.set(D, {
2306
+ label: T,
2293
2307
  options: []
2294
2308
  });
2295
2309
  }
2296
- const v = f.get(N), z = [
2297
- x,
2298
- k ? c.id.joint : c.id.segment,
2310
+ const v = p.get(D), z = [
2311
+ d,
2312
+ A ? c.id.joint : c.id.segment,
2299
2313
  c.plane
2300
- ].filter(Boolean).map((R) => String(R).toLowerCase().replace(/\s+|_/g, ""));
2314
+ ].filter(Boolean).map((T) => String(T).toLowerCase().replace(/\s+|_/g, ""));
2301
2315
  v.options.push({
2302
2316
  label: /* @__PURE__ */ e.jsxs(
2303
2317
  V,
@@ -2308,7 +2322,7 @@ const Dn = ({
2308
2322
  w: "100%",
2309
2323
  pl: 3,
2310
2324
  children: [
2311
- /* @__PURE__ */ e.jsx(M, { children: x }),
2325
+ /* @__PURE__ */ e.jsx(S, { children: d }),
2312
2326
  c.sensorOnly ? /* @__PURE__ */ e.jsx(Oe, { size: "sm", colorScheme: "orange", variant: "subtle", children: "Sensor" }) : /* @__PURE__ */ e.jsxs(V, { spacing: 1, children: [
2313
2327
  /* @__PURE__ */ e.jsx(Oe, { size: "sm", colorScheme: "blue", variant: "subtle", children: "Pose" }),
2314
2328
  /* @__PURE__ */ e.jsx(Oe, { size: "sm", colorScheme: "orange", variant: "subtle", children: "Sensor" })
@@ -2321,85 +2335,94 @@ const Dn = ({
2321
2335
  sensorOnly: c.sensorOnly,
2322
2336
  searchTokens: z
2323
2337
  });
2324
- }), Array.from(f.values());
2325
- }, [s]), b = $(() => {
2326
- if (!h || t.length === 0)
2327
- return y;
2328
- const f = t[0];
2329
- return y.map((c) => ({
2338
+ }), Array.from(p.values());
2339
+ }, [n]), L = N(() => {
2340
+ if (!m || t.length === 0)
2341
+ return j;
2342
+ const p = t[0];
2343
+ return j.map((c) => ({
2330
2344
  ...c,
2331
2345
  options: c.options.filter(
2332
- (k) => qe(k.value) === qe(f.id) && k.plane === f.plane
2346
+ (A) => Ke(A.value) === Ke(p.id) && A.plane === p.plane
2333
2347
  )
2334
2348
  })).filter((c) => c.options.length > 0);
2335
- }, [y, t, h]), w = $(() => y.flatMap((c) => c.options).filter(
2336
- (c) => t.some((k) => He(k.id, c.value) && k.plane === c.plane)
2337
- ), [y, t]), I = E((f, c) => {
2349
+ }, [j, t, m]), M = N(() => j.flatMap((c) => c.options).filter(
2350
+ (c) => t.some((A) => Fe(A.id, c.value) && A.plane === c.plane)
2351
+ ), [j, t]), f = E((p, c) => {
2338
2352
  if (!c) return !0;
2339
- const k = c.toLowerCase().replace(/\s+|_/g, ""), x = f.data;
2340
- return !x || !x.searchTokens ? !1 : x.searchTokens.some(
2341
- (N) => N.includes(k)
2353
+ const A = c.toLowerCase().replace(/\s+|_/g, ""), d = p.data;
2354
+ return !d || !d.searchTokens ? !1 : d.searchTokens.some(
2355
+ (D) => D.includes(A)
2342
2356
  );
2343
- }, []), L = E(
2344
- (f) => {
2345
- const c = f.map((k) => {
2346
- const x = t.find(
2347
- (O) => He(O.id, k.value) && O.plane === k.plane
2348
- ), N = s.find(
2349
- (O) => He(O.id, k.value) && O.plane === k.plane
2350
- ), v = h ? t.find(
2351
- (O) => qe(O.id) === qe(k.value) && O.plane === k.plane
2352
- ) : void 0, z = v && !x ? v.min : N && N.min ? N.min : 0, R = v && !x ? v.max : N && N.max ? N.max : 0;
2353
- return x ?? {
2354
- id: k.value,
2355
- plane: k.plane,
2356
- min: z,
2357
- max: R,
2358
- sensorOnly: k.sensorOnly,
2359
- kind: p ?? Xe.Limit
2360
- };
2357
+ }, []), C = E(
2358
+ (p) => {
2359
+ const c = t.filter(
2360
+ (d) => p.some(
2361
+ (D) => Fe(d.id, D.value) && d.plane === D.plane
2362
+ )
2363
+ ), A = p.flatMap((d) => {
2364
+ if (t.find(
2365
+ (G) => Fe(G.id, d.value) && G.plane === d.plane
2366
+ ))
2367
+ return [];
2368
+ const v = n.find(
2369
+ (G) => Fe(G.id, d.value) && G.plane === d.plane
2370
+ ), z = m ? t.find(
2371
+ (G) => Ke(G.id) === Ke(d.value) && G.plane === d.plane
2372
+ ) : void 0, T = z ? z.min : v && v.min ? v.min : 0, F = z ? z.max : v && v.max ? v.max : 0;
2373
+ return [
2374
+ {
2375
+ id: d.value,
2376
+ plane: d.plane,
2377
+ min: T,
2378
+ max: F,
2379
+ sensorOnly: d.sensorOnly,
2380
+ kind: g ?? Xe.Limit
2381
+ }
2382
+ ];
2361
2383
  });
2362
- r(c);
2384
+ r([...c, ...A]);
2363
2385
  },
2364
- [r, t, s, p, h]
2386
+ [r, t, n, g, m]
2365
2387
  );
2366
2388
  return ce(() => {
2367
- const f = t.filter(
2368
- (c) => s.some((k) => He(k.id, c.id) && k.plane === c.plane)
2389
+ const p = t.filter(
2390
+ (c) => n.some((A) => Fe(A.id, c.id) && A.plane === c.plane)
2369
2391
  );
2370
- f.length !== t.length && r(f);
2371
- }, [s, r, t]), /* @__PURE__ */ e.jsxs(se, { ...o, children: [
2392
+ p.length !== t.length && r(p);
2393
+ }, [n, r, t]), /* @__PURE__ */ e.jsxs(se, { ...o, children: [
2372
2394
  /* @__PURE__ */ e.jsx(
2373
2395
  he,
2374
2396
  {
2375
- isMulti: !m,
2397
+ isMulti: !u,
2376
2398
  placeholder: t.length ? `${t.length} selected` : "Search...",
2377
- value: w,
2378
- isDisabled: d || w.length >= (u ?? 1 / 0),
2379
- onChange: (f) => Array.isArray(f) ? L([...f]) : L(f !== null ? [f] : []),
2380
- options: b,
2399
+ value: M,
2400
+ isDisabled: h || t.length >= (b ?? 1 / 0),
2401
+ onChange: (p) => Array.isArray(p) ? C([...p]) : C(p !== null ? [p] : []),
2402
+ options: L,
2381
2403
  controlShouldRenderValue: !1,
2382
- formatOptionLabel: (f) => f.label,
2383
- filterOption: I,
2404
+ formatOptionLabel: (p) => p.label,
2405
+ filterOption: f,
2384
2406
  isSearchable: !0
2385
2407
  }
2386
2408
  ),
2387
2409
  /* @__PURE__ */ e.jsx(
2388
- es,
2410
+ ts,
2389
2411
  {
2390
2412
  marginTop: 2,
2391
2413
  maxH: "28rem",
2392
2414
  value: t,
2393
2415
  onChange: r,
2394
- forceKind: p,
2395
- disableKind: g,
2396
- isDisabled: d,
2397
- lockRanges: h
2416
+ forceKind: g,
2417
+ disableKind: x,
2418
+ isDisabled: h,
2419
+ lockRanges: m,
2420
+ canAddCopy: !h && !u && !m && t.length < (b ?? 1 / 0)
2398
2421
  }
2399
2422
  )
2400
2423
  ] });
2401
- }, Ct = (s) => {
2402
- switch (s) {
2424
+ }, wt = (n) => {
2425
+ switch (n) {
2403
2426
  case me.Thorax:
2404
2427
  return "Thorax";
2405
2428
  case me.CenterBack:
@@ -2429,41 +2452,41 @@ const Dn = ({
2429
2452
  case me.Head:
2430
2453
  return "Head";
2431
2454
  }
2432
- }, Is = ({
2433
- id: s,
2455
+ }, Ss = ({
2456
+ id: n,
2434
2457
  onError: t,
2435
2458
  onCancel: r,
2436
- onSave: p,
2437
- hideButtons: m,
2438
- setButtonOnClick: h,
2439
- setButtonDisabled: d,
2440
- quantumOwned: g,
2441
- isView: n
2459
+ onSave: g,
2460
+ hideButtons: u,
2461
+ setButtonOnClick: m,
2462
+ setButtonDisabled: h,
2463
+ quantumOwned: x,
2464
+ isView: s
2442
2465
  }) => {
2443
- const o = ct(), [{ fetching: u }, y] = fe(lt), [{ fetching: b }, w] = fe(mn), [{ data: I }] = Ce({
2466
+ const o = dt(), [{ fetching: b }, j] = fe(ct), [{ fetching: L }, M] = fe(mn), [{ data: f }] = ve({
2444
2467
  query: hn,
2445
- variables: { id: s ?? "" },
2446
- pause: !s
2447
- }), L = $(() => {
2448
- const j = A(
2449
- ve,
2450
- I?.getActionById
2468
+ variables: { id: n ?? "" },
2469
+ pause: !n
2470
+ }), C = N(() => {
2471
+ const y = k(
2472
+ Ce,
2473
+ f?.getActionById
2451
2474
  );
2452
- if (!j) return null;
2453
- const D = (A(Ge, j.reports) || []).map((F) => ({
2454
- ...F,
2455
- thresholds: A(Te, F.thresholds)
2475
+ if (!y) return null;
2476
+ const R = (k(Pe, y.reports) || []).map(($) => ({
2477
+ ...$,
2478
+ thresholds: k(Te, $.thresholds)
2456
2479
  }));
2457
2480
  return {
2458
- ...j,
2459
- thresholds: A(Te, j.thresholds),
2460
- reports: D
2481
+ ...y,
2482
+ thresholds: k(Te, y.thresholds),
2483
+ reports: R
2461
2484
  };
2462
- }, [I]), f = u || b, c = !!L && !!s, { getLabel: k } = xe(), x = $(() => ({
2463
- action: k("action")
2464
- }), [k]), N = $(() => [
2485
+ }, [f]), p = b || L, c = !!C && !!n, { getLabel: A } = xe(), d = N(() => ({
2486
+ action: A("action")
2487
+ }), [A]), D = N(() => [
2465
2488
  { key: "module_category", label: "Link Category", multi: !0 },
2466
- { key: "activity_type", label: `${x.action} Type`, multi: !1 },
2489
+ { key: "activity_type", label: `${d.action} Type`, multi: !1 },
2467
2490
  { key: "session_type", label: "Session Type", multi: !0 },
2468
2491
  { key: "body_region", label: "Body Region", multi: !0 },
2469
2492
  { key: "sport", label: "Sport", multi: !0 },
@@ -2472,7 +2495,7 @@ const Dn = ({
2472
2495
  label: "Activity Motion Direction",
2473
2496
  multi: !0
2474
2497
  }
2475
- ], [x.action]), [v, z] = q(""), [R, O] = q(""), [K, oe] = q(""), [G, ae] = q(""), [Z, T] = q([]), [U, J] = q({}), [B, Y] = q(null), [i, a] = q(""), [C, l] = q([]), [S, W] = q([]), [P, Q] = q(""), [H, re] = q([]), we = bn(), Ie = $(() => we.filter((j) => j.sensorOnly), [we]), Se = [
2498
+ ], [d.action]), [v, z] = K(""), [T, F] = K(""), [G, oe] = K(""), [P, ae] = K(""), [Z, O] = K([]), [W, J] = K({}), [U, Y] = K(null), [i, a] = K(""), [w, l] = K([]), [I, Q] = K([]), [_, q] = K(""), [H, re] = K([]), we = bn(), Ie = N(() => we.filter((y) => y.sensorOnly), [we]), Se = [
2476
2499
  {
2477
2500
  label: ke(ie.GeneralActivity),
2478
2501
  value: ie.GeneralActivity
@@ -2490,37 +2513,37 @@ const Dn = ({
2490
2513
  label: ke(ie.PointOfInterest),
2491
2514
  value: ie.PointOfInterest
2492
2515
  }
2493
- ], ze = $(() => v.trim().length > 0, [v]), [Be, tt] = q({});
2516
+ ], Be = N(() => v.trim().length > 0, [v]), [Ue, nt] = K({});
2494
2517
  ce(() => {
2495
- const j = N.map(
2496
- (_) => o.query(it, { key: _.key })
2518
+ const y = D.map(
2519
+ (B) => o.query(lt, { key: B.key })
2497
2520
  );
2498
- Promise.all(j).then((_) => {
2499
- const D = {};
2500
- _.forEach((F) => {
2501
- if (F.error || !F.data) return;
2502
- const ee = A(
2521
+ Promise.all(y).then((B) => {
2522
+ const R = {};
2523
+ B.forEach(($) => {
2524
+ if ($.error || !$.data) return;
2525
+ const ee = k(
2503
2526
  je,
2504
- F.data.getMetadataByKey
2505
- ), te = A(
2527
+ $.data.getMetadataByKey
2528
+ ), te = k(
2506
2529
  be,
2507
2530
  ee.data
2508
2531
  );
2509
- D[ee.key] = te.map((de) => ({
2532
+ R[ee.key] = te.map((de) => ({
2510
2533
  label: de.label || de.value,
2511
2534
  value: de.value,
2512
2535
  id: de.id
2513
2536
  }));
2514
- }), J(D);
2537
+ }), J(R);
2515
2538
  });
2516
- }, [o, N]), ce(() => {
2517
- if (L) {
2518
- const _ = A(
2539
+ }, [o, D]), ce(() => {
2540
+ if (C) {
2541
+ const B = k(
2519
2542
  je,
2520
- L.metadataGroups
2543
+ C.metadataGroups
2521
2544
  ).map(
2522
- (ee) => ee.data.map((te) => A(be, te).id)
2523
- ), D = L.reports.map((ee) => ({
2545
+ (ee) => ee.data.map((te) => k(be, te).id)
2546
+ ), R = C.reports.map((ee) => ({
2524
2547
  id: ee.id,
2525
2548
  name: ee.name ?? "",
2526
2549
  instructions: ee.instructions ?? "",
@@ -2536,166 +2559,166 @@ const Dn = ({
2536
2559
  plane: te.partDimension,
2537
2560
  oldId: te.id,
2538
2561
  sensorOnly: Ie.some((de) => {
2539
- const nt = de.id[te.partKind];
2540
- return nt ? nt === te.partId && de.plane === te.partDimension : !1;
2562
+ const st = de.id[te.partKind];
2563
+ return st ? st === te.partId && de.plane === te.partDimension : !1;
2541
2564
  })
2542
2565
  })),
2543
2566
  sensorLocations: ee.sensorLocations
2544
- })), F = {
2545
- name: L.name,
2546
- description: L.description || "",
2547
- cameraPlacement: L.cameraPlacement || "",
2548
- videoLink: L.videoLink || "",
2549
- metadataIds: _.flat(),
2550
- reports: D
2567
+ })), $ = {
2568
+ name: C.name,
2569
+ description: C.description || "",
2570
+ cameraPlacement: C.cameraPlacement || "",
2571
+ videoLink: C.videoLink || "",
2572
+ metadataIds: B.flat(),
2573
+ reports: R
2551
2574
  };
2552
- z(F.name), O(F.description), oe(F.cameraPlacement), ae(F.videoLink), T(F.metadataIds), re(D), tt(F);
2575
+ z($.name), F($.description), oe($.cameraPlacement), ae($.videoLink), O($.metadataIds), re(R), nt($);
2553
2576
  }
2554
- }, [L]);
2555
- const Re = $(
2556
- () => JSON.stringify(Be) !== JSON.stringify({
2577
+ }, [C]);
2578
+ const Re = N(
2579
+ () => JSON.stringify(Ue) !== JSON.stringify({
2557
2580
  name: v,
2558
- description: R,
2559
- cameraPlacement: K,
2560
- videoLink: G,
2581
+ description: T,
2582
+ cameraPlacement: G,
2583
+ videoLink: P,
2561
2584
  metadataIds: Z,
2562
2585
  reports: H
2563
2586
  }),
2564
2587
  [
2565
- Be,
2588
+ Ue,
2566
2589
  v,
2567
- R,
2568
- K,
2590
+ T,
2569
2591
  G,
2592
+ P,
2570
2593
  Z,
2571
2594
  H
2572
2595
  ]
2573
2596
  ), Le = E(() => {
2574
- const j = {
2597
+ const y = {
2575
2598
  name: v,
2576
- description: R,
2577
- cameraPlacement: K,
2578
- videoLink: G,
2599
+ description: T,
2600
+ cameraPlacement: G,
2601
+ videoLink: P,
2579
2602
  metadataItemIds: Z,
2580
2603
  // Backend requires laterality; keep existing default since UI no longer edits it
2581
- laterality: $n.Either,
2582
- quantumOwned: g,
2604
+ laterality: Dn.Either,
2605
+ quantumOwned: x,
2583
2606
  //Backend requires session type; keep existing default since UI no longer edits it
2584
2607
  sessionType: [],
2585
2608
  // Backend requires thresholds; use empty array since reports handle parameters now
2586
2609
  thresholds: [],
2587
2610
  // Include reports data
2588
- reports: H.map((D) => ({
2589
- id: D.isNew ? void 0 : D.id,
2590
- name: D.name,
2591
- reportKind: D.kind,
2592
- sensorLocations: D.sensorLocations,
2593
- instructions: D.instructions,
2594
- autoGenerate: D.autoGenerate ?? !1,
2595
- thresholds: D.parameters.map((F) => ({
2596
- id: F.oldId,
2597
- kind: F.kind,
2598
- min: F.min,
2599
- max: F.max,
2600
- partKind: "joint" in F.id ? "joint" : "segment",
2601
- partId: "joint" in F.id ? F.id.joint : F.id.segment,
2602
- partDimension: F.plane
2611
+ reports: H.map((R) => ({
2612
+ id: R.isNew ? void 0 : R.id,
2613
+ name: R.name,
2614
+ reportKind: R.kind,
2615
+ sensorLocations: R.sensorLocations,
2616
+ instructions: R.instructions,
2617
+ autoGenerate: R.autoGenerate ?? !1,
2618
+ thresholds: R.parameters.map(($) => ({
2619
+ id: $.oldId,
2620
+ kind: $.kind,
2621
+ min: $.min,
2622
+ max: $.max,
2623
+ partKind: "joint" in $.id ? "joint" : "segment",
2624
+ partId: "joint" in $.id ? $.id.joint : $.id.segment,
2625
+ partDimension: $.plane
2603
2626
  }))
2604
2627
  }))
2605
2628
  };
2606
- let _;
2607
- c && s ? _ = w({
2608
- id: s,
2609
- fields: j
2610
- }) : _ = y({
2611
- fields: j
2612
- }), _.then(({ error: D }) => {
2613
- D ? t(D) : p();
2629
+ let B;
2630
+ c && n ? B = M({
2631
+ id: n,
2632
+ fields: y
2633
+ }) : B = j({
2634
+ fields: y
2635
+ }), B.then(({ error: R }) => {
2636
+ R ? t(R) : g();
2614
2637
  });
2615
2638
  }, [
2616
- g,
2617
- y,
2618
- w,
2619
- s,
2639
+ x,
2640
+ j,
2641
+ M,
2642
+ n,
2620
2643
  v,
2621
- R,
2622
- K,
2644
+ T,
2623
2645
  G,
2646
+ P,
2624
2647
  Z,
2625
2648
  H,
2626
2649
  c,
2627
- p,
2650
+ g,
2628
2651
  t
2629
2652
  ]);
2630
2653
  ce(() => {
2631
- d && d({
2632
- cancelButton: f,
2633
- saveButton: n ? !0 : f || !ze || !Re
2634
- });
2635
- }, [f, d, ze, Re, n]), ce(() => {
2636
2654
  h && h({
2655
+ cancelButton: p,
2656
+ saveButton: s ? !0 : p || !Be || !Re
2657
+ });
2658
+ }, [p, h, Be, Re, s]), ce(() => {
2659
+ m && m({
2637
2660
  cancelButton: r,
2638
- saveButton: n ? () => {
2661
+ saveButton: s ? () => {
2639
2662
  } : Le
2640
2663
  });
2641
- }, [h, r, Le, n]);
2664
+ }, [m, r, Le, s]);
2642
2665
  const pe = E(
2643
- (j) => {
2644
- const _ = yt(
2645
- j.map(
2646
- (D) => "joint" in D.id ? D.id.joint : D.id.segment
2666
+ (y) => {
2667
+ const B = Ct(
2668
+ y.map(
2669
+ (R) => "joint" in R.id ? R.id.joint : R.id.segment
2647
2670
  )
2648
2671
  );
2649
- W(_);
2672
+ Q(B);
2650
2673
  },
2651
2674
  []
2652
2675
  );
2653
2676
  ce(() => {
2654
- pe(C);
2655
- }, [C, pe]);
2677
+ pe(w);
2678
+ }, [w, pe]);
2656
2679
  const $e = E(() => {
2657
- if (!B || !i.trim())
2680
+ if (!U || !i.trim())
2658
2681
  return;
2659
- const j = B === ie.PointOfInterest, _ = {
2682
+ const y = U === ie.PointOfInterest, B = {
2660
2683
  id: Date.now().toString(),
2661
2684
  // Temporary ID
2662
2685
  name: i.trim(),
2663
- kind: B,
2664
- parameters: j ? [] : C,
2665
- sensorLocations: j ? [] : S,
2666
- instructions: j ? P : "",
2686
+ kind: U,
2687
+ parameters: y ? [] : w,
2688
+ sensorLocations: y ? [] : I,
2689
+ instructions: y ? _ : "",
2667
2690
  autoGenerate: !1,
2668
2691
  isNew: !0
2669
2692
  };
2670
- re((D) => [...D, _]), Y(null), a(""), l([]), W([]), Q("");
2693
+ re((R) => [...R, B]), Y(null), a(""), l([]), Q([]), q("");
2671
2694
  }, [
2672
- B,
2695
+ U,
2673
2696
  i,
2674
- C,
2675
- S,
2676
- P
2677
- ]), Ft = E((j) => {
2678
- re((_) => _.filter((D) => D.id !== j));
2679
- }, []), Gt = (j, _) => {
2680
- const D = N.find((ee) => ee.key === j);
2681
- if (!D) return;
2682
- const F = D.multi ? (_ ?? []).map(
2697
+ w,
2698
+ I,
2699
+ _
2700
+ ]), Ft = E((y) => {
2701
+ re((B) => B.filter((R) => R.id !== y));
2702
+ }, []), Gt = (y, B) => {
2703
+ const R = D.find((ee) => ee.key === y);
2704
+ if (!R) return;
2705
+ const $ = R.multi ? (B ?? []).map(
2683
2706
  (ee) => ee.id
2684
- ) : _ ? [_.id] : [];
2685
- T((ee) => [...ee.filter((de) => Object.values(U).flat().find((Ue) => Ue.id === de) && !Object.keys(U).find(
2686
- (Ue) => U[Ue]?.some(
2687
- (Pt) => Pt.id === de && Ue === j
2707
+ ) : B ? [B.id] : [];
2708
+ O((ee) => [...ee.filter((de) => Object.values(W).flat().find((We) => We.id === de) && !Object.keys(W).find(
2709
+ (We) => W[We]?.some(
2710
+ (Pt) => Pt.id === de && We === y
2688
2711
  )
2689
- )), ...F]);
2712
+ )), ...$]);
2690
2713
  };
2691
2714
  return /* @__PURE__ */ e.jsxs(ue, { spacing: 4, w: "full", align: "stretch", children: [
2692
2715
  /* @__PURE__ */ e.jsxs(nn, { children: [
2693
2716
  /* @__PURE__ */ e.jsxs(sn, { children: [
2694
- /* @__PURE__ */ e.jsx(xt, { children: "Activity Configuration" }),
2695
- /* @__PURE__ */ e.jsx(xt, { children: "Reports Configuration" })
2717
+ /* @__PURE__ */ e.jsx(ft, { children: "Activity Configuration" }),
2718
+ /* @__PURE__ */ e.jsx(ft, { children: "Reports Configuration" })
2696
2719
  ] }),
2697
2720
  /* @__PURE__ */ e.jsxs(on, { children: [
2698
- /* @__PURE__ */ e.jsx(ft, { px: 0, children: /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-6", children: [
2721
+ /* @__PURE__ */ e.jsx(jt, { px: 0, children: /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-6", children: [
2699
2722
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
2700
2723
  /* @__PURE__ */ e.jsxs(X, { children: [
2701
2724
  /* @__PURE__ */ e.jsx(le, { children: "Name" }),
@@ -2703,23 +2726,23 @@ const Dn = ({
2703
2726
  ye,
2704
2727
  {
2705
2728
  value: v,
2706
- onChange: (j) => z(j.target.value),
2729
+ onChange: (y) => z(y.target.value),
2707
2730
  type: "text",
2708
2731
  placeholder: "i.e. Lunge & Return",
2709
- isDisabled: n
2732
+ isDisabled: s
2710
2733
  }
2711
2734
  )
2712
2735
  ] }),
2713
2736
  /* @__PURE__ */ e.jsxs(X, { children: [
2714
2737
  /* @__PURE__ */ e.jsx(le, { children: "Camera Placement" }),
2715
2738
  /* @__PURE__ */ e.jsx(
2716
- Qe,
2739
+ qe,
2717
2740
  {
2718
- value: K,
2719
- onChange: (j) => oe(j.target.value),
2741
+ value: G,
2742
+ onChange: (y) => oe(y.target.value),
2720
2743
  rows: 2,
2721
2744
  placeholder: "(optional) Describe camera setup, placement, angles",
2722
- isDisabled: n
2745
+ isDisabled: s
2723
2746
  }
2724
2747
  )
2725
2748
  ] }),
@@ -2728,60 +2751,60 @@ const Dn = ({
2728
2751
  /* @__PURE__ */ e.jsx(
2729
2752
  ye,
2730
2753
  {
2731
- value: G,
2732
- onChange: (j) => ae(j.target.value),
2754
+ value: P,
2755
+ onChange: (y) => ae(y.target.value),
2733
2756
  type: "url",
2734
2757
  placeholder: "(optional) https://...",
2735
- isDisabled: n
2758
+ isDisabled: s
2736
2759
  }
2737
2760
  )
2738
2761
  ] }),
2739
2762
  /* @__PURE__ */ e.jsxs(X, { children: [
2740
2763
  /* @__PURE__ */ e.jsx(le, { children: "Description" }),
2741
2764
  /* @__PURE__ */ e.jsx(
2742
- Qe,
2765
+ qe,
2743
2766
  {
2744
- value: R,
2745
- onChange: (j) => O(j.target.value),
2767
+ value: T,
2768
+ onChange: (y) => F(y.target.value),
2746
2769
  rows: 2,
2747
2770
  placeholder: "(optional) Describe how to perform the test or exercise",
2748
- isDisabled: n
2771
+ isDisabled: s
2749
2772
  }
2750
2773
  )
2751
2774
  ] })
2752
2775
  ] }),
2753
2776
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
2754
2777
  /* @__PURE__ */ e.jsx(le, { children: "Metadata Tags" }),
2755
- N.map((j) => /* @__PURE__ */ e.jsxs(X, { children: [
2756
- /* @__PURE__ */ e.jsx(le, { children: j.label }),
2778
+ D.map((y) => /* @__PURE__ */ e.jsxs(X, { children: [
2779
+ /* @__PURE__ */ e.jsx(le, { children: y.label }),
2757
2780
  /* @__PURE__ */ e.jsx(
2758
2781
  he,
2759
2782
  {
2760
- isMulti: j.multi,
2761
- value: U[j.key]?.filter(
2762
- (_) => Z.includes(_.id)
2783
+ isMulti: y.multi,
2784
+ value: W[y.key]?.filter(
2785
+ (B) => Z.includes(B.id)
2763
2786
  ),
2764
- onChange: (_) => {
2765
- Gt(j.key, _);
2787
+ onChange: (B) => {
2788
+ Gt(y.key, B);
2766
2789
  },
2767
- options: U[j.key],
2768
- placeholder: `Select ${j.multi ? "one or more" : "one"} ${j.label.toLowerCase()}`,
2769
- isDisabled: n,
2770
- isClearable: j.multi
2790
+ options: W[y.key],
2791
+ placeholder: `Select ${y.multi ? "one or more" : "one"} ${y.label.toLowerCase()}`,
2792
+ isDisabled: s,
2793
+ isClearable: y.multi
2771
2794
  }
2772
2795
  )
2773
- ] }, j.key))
2796
+ ] }, y.key))
2774
2797
  ] })
2775
2798
  ] }) }),
2776
- /* @__PURE__ */ e.jsx(ft, { px: 0, children: /* @__PURE__ */ e.jsxs(
2799
+ /* @__PURE__ */ e.jsx(jt, { px: 0, children: /* @__PURE__ */ e.jsxs(
2777
2800
  "div",
2778
2801
  {
2779
2802
  className: Je(
2780
2803
  "grid grid-cols-1 gap-6",
2781
- !n && "md:grid-cols-2"
2804
+ !s && "md:grid-cols-2"
2782
2805
  ),
2783
2806
  children: [
2784
- /* @__PURE__ */ e.jsxs("div", { className: Je("space-y-4", n && "hidden"), children: [
2807
+ /* @__PURE__ */ e.jsxs("div", { className: Je("space-y-4", s && "hidden"), children: [
2785
2808
  /* @__PURE__ */ e.jsx(le, { children: "Add New Report" }),
2786
2809
  /* @__PURE__ */ e.jsxs(X, { children: [
2787
2810
  /* @__PURE__ */ e.jsx(le, { children: "Report Name" }),
@@ -2789,11 +2812,11 @@ const Dn = ({
2789
2812
  ye,
2790
2813
  {
2791
2814
  value: i,
2792
- onChange: (j) => a(j.target.value),
2815
+ onChange: (y) => a(y.target.value),
2793
2816
  maxLength: 120,
2794
2817
  type: "text",
2795
2818
  placeholder: "Enter report name...",
2796
- isDisabled: n
2819
+ isDisabled: s
2797
2820
  }
2798
2821
  )
2799
2822
  ] }),
@@ -2802,35 +2825,35 @@ const Dn = ({
2802
2825
  /* @__PURE__ */ e.jsx(
2803
2826
  he,
2804
2827
  {
2805
- value: B ? Se.find(
2806
- (j) => j.value === B
2828
+ value: U ? Se.find(
2829
+ (y) => y.value === U
2807
2830
  ) : null,
2808
- onChange: (j) => {
2809
- const _ = j?.value || null;
2810
- Y(_);
2811
- const D = ot(_);
2812
- D && l(
2813
- (F) => F.map((ee) => ({ ...ee, kind: D }))
2831
+ onChange: (y) => {
2832
+ const B = y?.value || null;
2833
+ Y(B);
2834
+ const R = rt(B);
2835
+ R && l(
2836
+ ($) => $.map((ee) => ({ ...ee, kind: R }))
2814
2837
  );
2815
2838
  },
2816
2839
  options: Se,
2817
2840
  placeholder: "Select report type...",
2818
- isDisabled: n,
2841
+ isDisabled: s,
2819
2842
  isClearable: !0
2820
2843
  }
2821
2844
  )
2822
2845
  ] }),
2823
- B !== ie.PointOfInterest && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
2846
+ U !== ie.PointOfInterest && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
2824
2847
  /* @__PURE__ */ e.jsxs(X, { children: [
2825
2848
  /* @__PURE__ */ e.jsx(le, { children: "Default Parameters" }),
2826
2849
  /* @__PURE__ */ e.jsx(
2827
2850
  vt,
2828
2851
  {
2829
2852
  options: we,
2830
- value: C,
2853
+ value: w,
2831
2854
  onChange: l,
2832
- forceKind: ot(B),
2833
- editOnly: n
2855
+ forceKind: rt(U),
2856
+ editOnly: s
2834
2857
  }
2835
2858
  )
2836
2859
  ] }),
@@ -2839,8 +2862,8 @@ const Dn = ({
2839
2862
  /* @__PURE__ */ e.jsx(
2840
2863
  ye,
2841
2864
  {
2842
- value: S.map(
2843
- (j) => Ct(j)
2865
+ value: I.map(
2866
+ (y) => wt(y)
2844
2867
  ).join(", "),
2845
2868
  placeholder: "Auto-filled based on parameters...",
2846
2869
  isDisabled: !0
@@ -2848,16 +2871,16 @@ const Dn = ({
2848
2871
  )
2849
2872
  ] })
2850
2873
  ] }),
2851
- B === ie.PointOfInterest && /* @__PURE__ */ e.jsxs(X, { children: [
2874
+ U === ie.PointOfInterest && /* @__PURE__ */ e.jsxs(X, { children: [
2852
2875
  /* @__PURE__ */ e.jsx(le, { children: "Instructions" }),
2853
2876
  /* @__PURE__ */ e.jsx(
2854
- Qe,
2877
+ qe,
2855
2878
  {
2856
- value: P,
2857
- onChange: (j) => Q(j.target.value),
2879
+ value: _,
2880
+ onChange: (y) => q(y.target.value),
2858
2881
  rows: 3,
2859
2882
  placeholder: "Enter specific instructions for this report...",
2860
- isDisabled: n
2883
+ isDisabled: s
2861
2884
  }
2862
2885
  )
2863
2886
  ] }),
@@ -2866,27 +2889,27 @@ const Dn = ({
2866
2889
  {
2867
2890
  colorScheme: "blue",
2868
2891
  onClick: $e,
2869
- isDisabled: !B || !i.trim() || n || Se.length === 0 || B !== ie.PointOfInterest && C.length === 0,
2892
+ isDisabled: !U || !i.trim() || s || Se.length === 0 || U !== ie.PointOfInterest && w.length === 0,
2870
2893
  children: "Add Report"
2871
2894
  }
2872
2895
  ) })
2873
2896
  ] }),
2874
2897
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
2875
2898
  /* @__PURE__ */ e.jsx(le, { children: "Configured Reports" }),
2876
- H.length === 0 ? /* @__PURE__ */ e.jsx(M, { fontSize: "sm", color: "gray.500", children: "No reports created yet" }) : /* @__PURE__ */ e.jsx("div", { className: "space-y-3", children: H.map((j) => /* @__PURE__ */ e.jsxs(
2899
+ H.length === 0 ? /* @__PURE__ */ e.jsx(S, { fontSize: "sm", color: "gray.500", children: "No reports created yet" }) : /* @__PURE__ */ e.jsx("div", { className: "space-y-3", children: H.map((y) => /* @__PURE__ */ e.jsxs(
2877
2900
  "div",
2878
2901
  {
2879
2902
  className: "p-3 border border-gray-200 rounded-md bg-gray-50 flex flex-col gap-2",
2880
2903
  children: [
2881
2904
  /* @__PURE__ */ e.jsxs("div", { className: "flex justify-between items-start", children: [
2882
- /* @__PURE__ */ e.jsx(M, { fontSize: "sm", color: "gray.600", children: ke(j.kind) }),
2883
- !n && /* @__PURE__ */ e.jsx(
2905
+ /* @__PURE__ */ e.jsx(S, { fontSize: "sm", color: "gray.600", children: ke(y.kind) }),
2906
+ !s && /* @__PURE__ */ e.jsx(
2884
2907
  ne,
2885
2908
  {
2886
2909
  size: "xs",
2887
2910
  colorScheme: "red",
2888
2911
  variant: "ghost",
2889
- onClick: () => Ft(j.id),
2912
+ onClick: () => Ft(y.id),
2890
2913
  children: "Remove"
2891
2914
  }
2892
2915
  )
@@ -2896,22 +2919,22 @@ const Dn = ({
2896
2919
  /* @__PURE__ */ e.jsx(
2897
2920
  ye,
2898
2921
  {
2899
- value: j.name,
2900
- onChange: (_) => re(
2901
- (D) => D.map(
2902
- (F) => F.id === j.id ? { ...F, name: _.target.value } : F
2922
+ value: y.name,
2923
+ onChange: (B) => re(
2924
+ (R) => R.map(
2925
+ ($) => $.id === y.id ? { ...$, name: B.target.value } : $
2903
2926
  )
2904
2927
  ),
2905
2928
  placeholder: "Enter report name...",
2906
- isDisabled: n
2929
+ isDisabled: s
2907
2930
  }
2908
2931
  )
2909
2932
  ] }),
2910
2933
  /* @__PURE__ */ e.jsxs(X, { display: "flex", alignItems: "center", children: [
2911
2934
  /* @__PURE__ */ e.jsx(
2912
- _e,
2935
+ ze,
2913
2936
  {
2914
- htmlFor: `auto-generate-${j.id}`,
2937
+ htmlFor: `auto-generate-${y.id}`,
2915
2938
  mb: "0",
2916
2939
  children: "Auto Generate"
2917
2940
  }
@@ -2919,66 +2942,66 @@ const Dn = ({
2919
2942
  /* @__PURE__ */ e.jsx(
2920
2943
  rn,
2921
2944
  {
2922
- id: `auto-generate-${j.id}`,
2923
- isChecked: j.autoGenerate ?? !1,
2924
- onChange: (_) => re(
2925
- (D) => D.map(
2926
- (F) => F.id === j.id ? { ...F, autoGenerate: _.target.checked } : F
2945
+ id: `auto-generate-${y.id}`,
2946
+ isChecked: y.autoGenerate ?? !1,
2947
+ onChange: (B) => re(
2948
+ (R) => R.map(
2949
+ ($) => $.id === y.id ? { ...$, autoGenerate: B.target.checked } : $
2927
2950
  )
2928
2951
  ),
2929
- isDisabled: n
2952
+ isDisabled: s
2930
2953
  }
2931
2954
  )
2932
2955
  ] }),
2933
- j.kind === ie.PointOfInterest && /* @__PURE__ */ e.jsxs(X, { children: [
2956
+ y.kind === ie.PointOfInterest && /* @__PURE__ */ e.jsxs(X, { children: [
2934
2957
  /* @__PURE__ */ e.jsx(le, { children: "Instructions" }),
2935
2958
  /* @__PURE__ */ e.jsx(
2936
- Qe,
2959
+ qe,
2937
2960
  {
2938
- value: j.instructions,
2939
- onChange: (_) => re(
2940
- (D) => D.map(
2941
- (F) => F.id === j.id ? { ...F, instructions: _.target.value } : F
2961
+ value: y.instructions,
2962
+ onChange: (B) => re(
2963
+ (R) => R.map(
2964
+ ($) => $.id === y.id ? { ...$, instructions: B.target.value } : $
2942
2965
  )
2943
2966
  ),
2944
2967
  rows: 3,
2945
2968
  placeholder: "Enter specific instructions for this report...",
2946
- isDisabled: n
2969
+ isDisabled: s
2947
2970
  }
2948
2971
  )
2949
2972
  ] }),
2950
- j.kind !== ie.PointOfInterest && /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col", children: [
2973
+ y.kind !== ie.PointOfInterest && /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col", children: [
2951
2974
  /* @__PURE__ */ e.jsx(le, { children: "Default Parameters" }),
2952
2975
  /* @__PURE__ */ e.jsx(
2953
2976
  vt,
2954
2977
  {
2955
2978
  options: we,
2956
- forceKind: ot(
2957
- j.kind
2979
+ forceKind: rt(
2980
+ y.kind
2958
2981
  ),
2959
- value: j.parameters,
2960
- onChange: (_) => {
2961
- const D = (te) => "joint" in te.id ? te.id.joint : te.id.segment, F = _.map(D), ee = yt(F);
2982
+ value: y.parameters,
2983
+ onChange: (B) => {
2984
+ const R = (te) => "joint" in te.id ? te.id.joint : te.id.segment, $ = B.map(R), ee = Ct($);
2962
2985
  re(
2963
2986
  (te) => te.map(
2964
- (de) => de.id === j.id ? { ...de, parameters: _, sensorLocations: ee } : de
2987
+ (de) => de.id === y.id ? { ...de, parameters: B, sensorLocations: ee } : de
2965
2988
  )
2966
2989
  );
2967
2990
  },
2968
- editOnly: n
2991
+ editOnly: s
2969
2992
  }
2970
2993
  )
2971
2994
  ] }),
2972
- j.kind !== ie.PointOfInterest && /* @__PURE__ */ e.jsxs(M, { fontSize: "sm", color: "gray.600", children: [
2995
+ y.kind !== ie.PointOfInterest && /* @__PURE__ */ e.jsxs(S, { fontSize: "sm", color: "gray.600", children: [
2973
2996
  "Sensors:",
2974
2997
  " ",
2975
- j.sensorLocations.map(
2976
- (_) => Ct(_)
2998
+ y.sensorLocations.map(
2999
+ (B) => wt(B)
2977
3000
  ).join(", ")
2978
3001
  ] })
2979
3002
  ]
2980
3003
  },
2981
- j.id
3004
+ y.id
2982
3005
  )) })
2983
3006
  ] })
2984
3007
  ]
@@ -2990,15 +3013,15 @@ const Dn = ({
2990
3013
  V,
2991
3014
  {
2992
3015
  justify: "end",
2993
- className: Je((m || n) && "!hidden"),
3016
+ className: Je((u || s) && "!hidden"),
2994
3017
  children: /* @__PURE__ */ e.jsxs(Ne, { gap: 4, children: [
2995
- /* @__PURE__ */ e.jsx(ne, { colorScheme: "gray", isDisabled: f, onClick: r, children: "Cancel" }),
3018
+ /* @__PURE__ */ e.jsx(ne, { colorScheme: "gray", isDisabled: p, onClick: r, children: "Cancel" }),
2996
3019
  /* @__PURE__ */ e.jsx(
2997
3020
  ne,
2998
3021
  {
2999
3022
  colorScheme: "blue",
3000
- isDisabled: f || !ze || !Re,
3001
- isLoading: f,
3023
+ isDisabled: p || !Be || !Re,
3024
+ isLoading: p,
3002
3025
  onClick: Le,
3003
3026
  children: "Save changes"
3004
3027
  }
@@ -3007,157 +3030,157 @@ const Dn = ({
3007
3030
  }
3008
3031
  )
3009
3032
  ] });
3010
- }, le = ({ children: s }) => /* @__PURE__ */ e.jsx(_e, { fontWeight: "bold", fontFamily: "sans-serif", fontSize: "large", children: s }), ns = ({
3011
- children: s,
3033
+ }, le = ({ children: n }) => /* @__PURE__ */ e.jsx(ze, { fontWeight: "bold", fontFamily: "sans-serif", fontSize: "large", children: n }), ss = ({
3034
+ children: n,
3012
3035
  isView: t,
3013
3036
  metadataKeys: r
3014
3037
  }) => {
3015
- const [p, m] = q({}), h = ct();
3038
+ const [g, u] = K({}), m = dt();
3016
3039
  return ce(() => {
3017
- let d = !1;
3040
+ let h = !1;
3018
3041
  return (async () => {
3019
- const n = (r ?? []).map(
3020
- (y) => h.query(it, { key: y }).toPromise()
3021
- ), o = await Promise.all(n), u = {};
3022
- for (const y of o) {
3023
- if (y.error || !y.data?.getMetadataByKey) continue;
3024
- const b = A(
3042
+ const s = (r ?? []).map(
3043
+ (j) => m.query(lt, { key: j }).toPromise()
3044
+ ), o = await Promise.all(s), b = {};
3045
+ for (const j of o) {
3046
+ if (j.error || !j.data?.getMetadataByKey) continue;
3047
+ const L = k(
3025
3048
  je,
3026
- y.data.getMetadataByKey
3049
+ j.data.getMetadataByKey
3027
3050
  );
3028
- if (!b) continue;
3029
- const w = A(be, b.data) ?? [];
3030
- u[b.key] = w.map((I) => ({
3031
- label: I.label || I.value,
3032
- value: I.value,
3033
- id: I.id
3051
+ if (!L) continue;
3052
+ const M = k(be, L.data) ?? [];
3053
+ b[L.key] = M.map((f) => ({
3054
+ label: f.label || f.value,
3055
+ value: f.value,
3056
+ id: f.id
3034
3057
  }));
3035
3058
  }
3036
- d || m(u);
3059
+ h || u(b);
3037
3060
  })(), () => {
3038
- d = !0;
3061
+ h = !0;
3039
3062
  };
3040
- }, [h, r]), /* @__PURE__ */ e.jsx(Dt.Provider, { value: { isView: t, metadataOptions: p }, children: s });
3041
- }, Ss = ({
3042
- id: s,
3063
+ }, [m, r]), /* @__PURE__ */ e.jsx(Dt.Provider, { value: { isView: t, metadataOptions: g }, children: n });
3064
+ }, Ls = ({
3065
+ id: n,
3043
3066
  onCancel: t,
3044
3067
  onSave: r,
3045
- onError: p,
3046
- hideButtons: m,
3047
- quantumOwned: h,
3048
- setButtonOnClick: d,
3049
- setButtonDisabled: g,
3050
- isView: n
3068
+ onError: g,
3069
+ hideButtons: u,
3070
+ quantumOwned: m,
3071
+ setButtonOnClick: h,
3072
+ setButtonDisabled: x,
3073
+ isView: s
3051
3074
  }) => {
3052
- const [{ data: o, fetching: u }] = Ce({
3053
- query: h ? pn : gn
3054
- }), [{ data: y }] = Ce({
3075
+ const [{ data: o, fetching: b }] = ve({
3076
+ query: m ? pn : gn
3077
+ }), [{ data: j }] = ve({
3055
3078
  query: xn,
3056
- variables: { id: s },
3057
- pause: !s
3058
- }), [{ data: b }] = Ce({
3079
+ variables: { id: n },
3080
+ pause: !n
3081
+ }), [{ data: L }] = ve({
3059
3082
  query: fn
3060
- }), w = A(
3061
- Pe,
3062
- b?.moduleCategories
3063
- ), [{ fetching: I }, L] = fe(Tt), [{ fetching: f }, c] = fe(Ot), k = $(() => !o || u ? [] : A(
3064
- ve,
3065
- h ? o?.quantumOwnedActions ?? [] : o?.actions ?? []
3066
- ).filter((B) => !!B?.id), [o, h, u]), x = A(Ye, y?.module), N = $(() => A(Nt, x?.moduleActions) ?? [], [x?.moduleActions]), [v, z] = q([]), [R, O] = q(x?.name ?? ""), [K, oe] = q([]), [G, ae] = q(x?.description ?? ""), [Z, T] = q([]);
3083
+ }), M = k(
3084
+ _e,
3085
+ L?.moduleCategories
3086
+ ), [{ fetching: f }, C] = fe(Tt), [{ fetching: p }, c] = fe(Ot), A = N(() => !o || b ? [] : k(
3087
+ Ce,
3088
+ m ? o?.quantumOwnedActions ?? [] : o?.actions ?? []
3089
+ ).filter((U) => !!U?.id), [o, m, b]), d = k(Ye, j?.module), D = N(() => k(Nt, d?.moduleActions) ?? [], [d?.moduleActions]), [v, z] = K([]), [T, F] = K(d?.name ?? ""), [G, oe] = K([]), [P, ae] = K(d?.description ?? ""), [Z, O] = K([]);
3067
3090
  ce(() => {
3068
- if (x) {
3069
- const J = N.map((i, a) => ({
3091
+ if (d) {
3092
+ const J = D.map((i, a) => ({
3070
3093
  key: i.id ?? `${i.actionId}-${a}`,
3071
3094
  actionId: i.actionId,
3072
3095
  reportId: i.reportId || null
3073
3096
  }));
3074
- z(J), O(x.name), ae(x.description ?? ""), oe(
3075
- x.categories.map(
3076
- (i) => A(Pe, i).id
3097
+ z(J), F(d.name), ae(d.description ?? ""), oe(
3098
+ d.categories.map(
3099
+ (i) => k(_e, i).id
3077
3100
  ) ?? []
3078
3101
  );
3079
- const Y = A(
3102
+ const Y = k(
3080
3103
  je,
3081
- x.metadataGroups
3104
+ d.metadataGroups
3082
3105
  ).map(
3083
- (i) => i.data.map((a) => A(be, a).id)
3106
+ (i) => i.data.map((a) => k(be, a).id)
3084
3107
  );
3085
- T(Y.flat());
3108
+ O(Y.flat());
3086
3109
  }
3087
- }, [x, N]);
3088
- const U = E(() => {
3110
+ }, [d, D]);
3111
+ const W = E(() => {
3089
3112
  let J;
3090
- const B = {
3113
+ const U = {
3091
3114
  moduleActions: v.map((Y) => ({
3092
3115
  actionId: Y.actionId,
3093
3116
  reportId: Y.reportId ?? void 0
3094
3117
  })),
3095
- name: R,
3096
- categories: K,
3097
- description: G,
3098
- quantumOwned: h,
3118
+ name: T,
3119
+ categories: G,
3120
+ description: P,
3121
+ quantumOwned: m,
3099
3122
  metadataItemIds: Z
3100
3123
  };
3101
- x ? J = L({
3102
- id: x.id,
3103
- input: B
3124
+ d ? J = C({
3125
+ id: d.id,
3126
+ input: U
3104
3127
  }) : J = c({
3105
- input: B
3128
+ input: U
3106
3129
  }), J.then(({ error: Y }) => {
3107
- Y ? p(Y instanceof Error ? Y : new Error(String(Y))) : r();
3130
+ Y ? g(Y instanceof Error ? Y : new Error(String(Y))) : r();
3108
3131
  });
3109
3132
  }, [
3110
3133
  c,
3111
- L,
3134
+ C,
3112
3135
  v,
3113
- R,
3136
+ T,
3137
+ P,
3114
3138
  G,
3115
- K,
3116
3139
  Z,
3117
- x,
3140
+ d,
3118
3141
  r,
3119
- p,
3120
- h
3142
+ g,
3143
+ m
3121
3144
  ]);
3122
3145
  return ce(() => {
3123
- g && g({
3124
- cancelButton: I || f,
3125
- saveButton: I || f || !R || G.trim().split(/\s+/).filter(Boolean).length > 40
3146
+ x && x({
3147
+ cancelButton: f || p,
3148
+ saveButton: f || p || !T || P.trim().split(/\s+/).filter(Boolean).length > 40
3126
3149
  });
3127
- }, [g, I, f, v, R, G]), ce(() => {
3128
- d && d({
3150
+ }, [x, f, p, v, T, P]), ce(() => {
3151
+ h && h({
3129
3152
  cancelButton: t,
3130
- saveButton: U
3153
+ saveButton: W
3131
3154
  });
3132
- }, [d, t, U]), /* @__PURE__ */ e.jsx(se, { width: "100%", children: /* @__PURE__ */ e.jsxs(
3133
- ns,
3155
+ }, [h, t, W]), /* @__PURE__ */ e.jsx(se, { width: "100%", children: /* @__PURE__ */ e.jsxs(
3156
+ ss,
3134
3157
  {
3135
- isView: n,
3158
+ isView: s,
3136
3159
  metadataKeys: ["activity_type", "session_type", "body_region", "sport"],
3137
3160
  children: [
3138
3161
  /* @__PURE__ */ e.jsx(
3139
- qn,
3162
+ Kn,
3140
3163
  {
3141
- name: R,
3142
- setName: O,
3143
- actions: k,
3164
+ name: T,
3165
+ setName: F,
3166
+ actions: A,
3144
3167
  moduleActionEntries: v,
3145
3168
  setModuleActionEntries: z,
3146
- availableCategories: w ?? [],
3147
- selectedCategoryIds: K,
3169
+ availableCategories: M ?? [],
3170
+ selectedCategoryIds: G,
3148
3171
  setSelectedCategoryIds: oe,
3149
- description: G,
3172
+ description: P,
3150
3173
  setDescription: ae,
3151
3174
  selectedMetadataIds: Z,
3152
- setSelectedMetadataIds: T
3175
+ setSelectedMetadataIds: O
3153
3176
  }
3154
3177
  ),
3155
- !m && !n && /* @__PURE__ */ e.jsx(V, { justifyContent: "flex-start", children: /* @__PURE__ */ e.jsxs(Ne, { mt: 16, gap: 4, children: [
3178
+ !u && !s && /* @__PURE__ */ e.jsx(V, { justifyContent: "flex-start", children: /* @__PURE__ */ e.jsxs(Ne, { mt: 16, gap: 4, children: [
3156
3179
  /* @__PURE__ */ e.jsx(
3157
3180
  ne,
3158
3181
  {
3159
3182
  colorScheme: "gray",
3160
- isDisabled: I || f,
3183
+ isDisabled: f || p,
3161
3184
  onClick: t,
3162
3185
  children: "Cancel"
3163
3186
  }
@@ -3166,9 +3189,9 @@ const Dn = ({
3166
3189
  ne,
3167
3190
  {
3168
3191
  colorScheme: "blue",
3169
- isDisabled: I || f || !R || G.trim().split(/\s+/).filter(Boolean).length > 40,
3170
- isLoading: I || f,
3171
- onClick: U,
3192
+ isDisabled: f || p || !T || P.trim().split(/\s+/).filter(Boolean).length > 40,
3193
+ isLoading: f || p,
3194
+ onClick: W,
3172
3195
  children: "Save"
3173
3196
  }
3174
3197
  )
@@ -3178,12 +3201,12 @@ const Dn = ({
3178
3201
  ) });
3179
3202
  };
3180
3203
  export {
3181
- Qn as ActivityList,
3182
- Cs as CopyActivityForm,
3183
- ws as CopyModuleForm,
3184
- qn as ModuleForm,
3185
- es as ParameterEditList,
3204
+ qn as ActivityList,
3205
+ ws as CopyActivityForm,
3206
+ Is as CopyModuleForm,
3207
+ Kn as ModuleForm,
3208
+ ts as ParameterEditList,
3186
3209
  vt as ParameterEditSelect,
3187
- Is as UpsertActivityForm,
3188
- Ss as UpsertModuleForm
3210
+ Ss as UpsertActivityForm,
3211
+ Ls as UpsertModuleForm
3189
3212
  };