quantum-component-library 1.4.49 → 1.4.50-dev.1

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