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

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