quantum-component-library 1.4.48 → 1.4.50-dev.0

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